From 2e81ae396788c7f1af327510899f06f773fe3501 Mon Sep 17 00:00:00 2001 From: Mauro Carvalho Chehab Date: Mon, 26 Mar 2018 09:18:36 -0400 Subject: [PATCH 01/48] media: r820t: don't crash if attach fails As pointed by smatch: drivers/media/tuners/r820t.c:2374 r820t_attach() error: potential null dereference 'priv'. (kzalloc returns null) The current function with prints error assumes that the attach succeeds. So, don't use it in case of failures. Signed-off-by: Mauro Carvalho Chehab --- drivers/media/tuners/r820t.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/drivers/media/tuners/r820t.c b/drivers/media/tuners/r820t.c index bc9299059f48..3e14b9e2e763 100644 --- a/drivers/media/tuners/r820t.c +++ b/drivers/media/tuners/r820t.c @@ -20,6 +20,8 @@ // // RF Gain set/get is not implemented. +#define pr_fmt(fmt) KBUILD_MODNAME ": " fmt + #include #include #include @@ -2371,7 +2373,7 @@ err: err_no_gate: mutex_unlock(&r820t_list_mutex); - tuner_info("%s: failed=%d\n", __func__, rc); + pr_info("%s: failed=%d\n", __func__, rc); r820t_release(fe); return NULL; } From 890f27693f2a6b9a0a7c13bf931b9d1dde050e04 Mon Sep 17 00:00:00 2001 From: Arnd Bergmann Date: Tue, 13 Mar 2018 09:14:09 -0400 Subject: [PATCH 02/48] media: imx: work around false-positive warning The IS_ERR()/PTR_ERR() combination confuses gcc to the point that it cannot prove the upstream_ep variable to be initialized: drivers/staging/media/imx/imx-media-csi.c: In function 'csi_link_validate': drivers/staging/media/imx/imx-media-csi.c:1025:20: error: 'upstream_ep' may be used uninitialized in this function [-Werror=maybe-uninitialized] priv->upstream_ep = upstream_ep; ~~~~~~~~~~~~~~~~~~^~~~~~~~~~~~~ drivers/staging/media/imx/imx-media-csi.c:1026:24: error: 'upstream_ep.bus_type' may be used uninitialized in this function [-Werror=maybe-uninitialized] is_csi2 = (upstream_ep.bus_type == V4L2_MBUS_CSI2); ~~~~~~~~~~~^~~~~~~~~ drivers/staging/media/imx/imx-media-csi.c:127:19: error: 'upstream_ep.bus.parallel.bus_width' may be used uninitialized in this function [-Werror=maybe-uninitialized] I could come up with no good way to rewrite this function, as a last resort, this adds an explicit zero-intialization of the structure. Fixes: 52e17089d185 ("media: imx: Don't initialize vars that won't be used") Signed-off-by: Arnd Bergmann Signed-off-by: Hans Verkuil Signed-off-by: Mauro Carvalho Chehab --- drivers/staging/media/imx/imx-media-csi.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/drivers/staging/media/imx/imx-media-csi.c b/drivers/staging/media/imx/imx-media-csi.c index 1aa2be891704..00c9d625cfb5 100644 --- a/drivers/staging/media/imx/imx-media-csi.c +++ b/drivers/staging/media/imx/imx-media-csi.c @@ -1005,7 +1005,7 @@ static int csi_link_validate(struct v4l2_subdev *sd, struct v4l2_subdev_format *sink_fmt) { struct csi_priv *priv = v4l2_get_subdevdata(sd); - struct v4l2_fwnode_endpoint upstream_ep; + struct v4l2_fwnode_endpoint upstream_ep = {}; const struct imx_media_pixfmt *incc; bool is_csi2; int ret; From 82e071e254fcd46e3075a3ef8377a8c716d035fc Mon Sep 17 00:00:00 2001 From: Alexandre Courbot Date: Mon, 19 Mar 2018 05:32:29 -0400 Subject: [PATCH 03/48] media: venus: vdec: fix format enumeration find_format_by_index() stops enumerating formats as soon as the index matches, and returns NULL if venus_helper_check_codec() finds out that the format is not supported. This prevents formats to be properly enumerated if a non-supported format is present, as the enumeration will end with it. Fix this by moving the call to venus_helper_check_codec() into the loop, and keep enumerating when it fails. Fixes: 29f0133ec6 media: venus: use helper function to check supported codecs Signed-off-by: Alexandre Courbot Acked-by: Stanimir Varbanov Signed-off-by: Hans Verkuil Signed-off-by: Mauro Carvalho Chehab --- drivers/media/platform/qcom/venus/vdec.c | 13 +++++++------ drivers/media/platform/qcom/venus/venc.c | 13 +++++++------ 2 files changed, 14 insertions(+), 12 deletions(-) diff --git a/drivers/media/platform/qcom/venus/vdec.c b/drivers/media/platform/qcom/venus/vdec.c index c9e9576bb08a..49bbd1861d3a 100644 --- a/drivers/media/platform/qcom/venus/vdec.c +++ b/drivers/media/platform/qcom/venus/vdec.c @@ -135,20 +135,21 @@ find_format_by_index(struct venus_inst *inst, unsigned int index, u32 type) return NULL; for (i = 0; i < size; i++) { + bool valid; + if (fmt[i].type != type) continue; - if (k == index) + valid = type != V4L2_BUF_TYPE_VIDEO_OUTPUT_MPLANE || + venus_helper_check_codec(inst, fmt[i].pixfmt); + if (k == index && valid) break; - k++; + if (valid) + k++; } if (i == size) return NULL; - if (type == V4L2_BUF_TYPE_VIDEO_OUTPUT_MPLANE && - !venus_helper_check_codec(inst, fmt[i].pixfmt)) - return NULL; - return &fmt[i]; } diff --git a/drivers/media/platform/qcom/venus/venc.c b/drivers/media/platform/qcom/venus/venc.c index e3a10a852cad..6b2ce479584e 100644 --- a/drivers/media/platform/qcom/venus/venc.c +++ b/drivers/media/platform/qcom/venus/venc.c @@ -120,20 +120,21 @@ find_format_by_index(struct venus_inst *inst, unsigned int index, u32 type) return NULL; for (i = 0; i < size; i++) { + bool valid; + if (fmt[i].type != type) continue; - if (k == index) + valid = type != V4L2_BUF_TYPE_VIDEO_CAPTURE_MPLANE || + venus_helper_check_codec(inst, fmt[i].pixfmt); + if (k == index && valid) break; - k++; + if (valid) + k++; } if (i == size) return NULL; - if (type == V4L2_BUF_TYPE_VIDEO_CAPTURE_MPLANE && - !venus_helper_check_codec(inst, fmt[i].pixfmt)) - return NULL; - return &fmt[i]; } From 67b6c672a7ae1f8def5646701be947e68a05821c Mon Sep 17 00:00:00 2001 From: Colin Ian King Date: Mon, 19 Mar 2018 07:18:09 -0400 Subject: [PATCH 04/48] media: staging: media: davinci_vpfe: fix spelling of resizer_configure_in_continious_mode Trivial fix: rename function resizer_configure_in_continious_mode to resizer_configure_in_continuous_mode to fix spelling mistake. Signed-off-by: Colin Ian King Signed-off-by: Hans Verkuil Signed-off-by: Mauro Carvalho Chehab --- drivers/staging/media/davinci_vpfe/dm365_resizer.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/drivers/staging/media/davinci_vpfe/dm365_resizer.c b/drivers/staging/media/davinci_vpfe/dm365_resizer.c index 857b0e847c5e..1ee216d71d42 100644 --- a/drivers/staging/media/davinci_vpfe/dm365_resizer.c +++ b/drivers/staging/media/davinci_vpfe/dm365_resizer.c @@ -480,7 +480,7 @@ resizer_configure_common_in_params(struct vpfe_resizer_device *resizer) return 0; } static int -resizer_configure_in_continious_mode(struct vpfe_resizer_device *resizer) +resizer_configure_in_continuous_mode(struct vpfe_resizer_device *resizer) { struct device *dev = resizer->crop_resizer.subdev.v4l2_dev->dev; struct resizer_params *param = &resizer->config; @@ -1242,7 +1242,7 @@ static int resizer_do_hw_setup(struct vpfe_resizer_device *resizer) ipipeif_source == IPIPEIF_OUTPUT_RESIZER) ret = resizer_configure_in_single_shot_mode(resizer); else - ret = resizer_configure_in_continious_mode(resizer); + ret = resizer_configure_in_continuous_mode(resizer); if (ret) return ret; ret = config_rsz_hw(resizer, param); From eed5756519ad4b43238370763f73a1ce115d41ca Mon Sep 17 00:00:00 2001 From: Luca Ceresoli Date: Wed, 21 Mar 2018 13:49:39 -0400 Subject: [PATCH 05/48] media: doc: fix ReST link syntax There is a ':' in excess, resulting in an unwanted ':' in the rendered output. Signed-off-by: Luca Ceresoli Signed-off-by: Hans Verkuil Signed-off-by: Mauro Carvalho Chehab --- Documentation/media/kapi/v4l2-dev.rst | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Documentation/media/kapi/v4l2-dev.rst b/Documentation/media/kapi/v4l2-dev.rst index 7bb0505b60f1..eb03ccc41c41 100644 --- a/Documentation/media/kapi/v4l2-dev.rst +++ b/Documentation/media/kapi/v4l2-dev.rst @@ -31,7 +31,7 @@ of the video device exits. The default :c:func:`video_device_release` callback currently just calls ``kfree`` to free the allocated memory. -There is also a ::c:func:`video_device_release_empty` function that does +There is also a :c:func:`video_device_release_empty` function that does nothing (is empty) and should be used if the struct is embedded and there is nothing to do when it is released. From 648a9576932a26e1c6a157b4c9345204de975957 Mon Sep 17 00:00:00 2001 From: Ryder Lee Date: Thu, 22 Mar 2018 23:44:13 -0400 Subject: [PATCH 06/48] media: vcodec: fix error return value from mtk_jpeg_clk_init() The error return value should be fixed as it may return EPROBE_DEFER. Cc: Bin Liu Signed-off-by: Ryder Lee Reviewed-by: Matthias Brugger Acked-by: Rick Chang Signed-off-by: Hans Verkuil Signed-off-by: Mauro Carvalho Chehab --- drivers/media/platform/mtk-jpeg/mtk_jpeg_core.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/drivers/media/platform/mtk-jpeg/mtk_jpeg_core.c b/drivers/media/platform/mtk-jpeg/mtk_jpeg_core.c index 226f90886484..af17aaa21f58 100644 --- a/drivers/media/platform/mtk-jpeg/mtk_jpeg_core.c +++ b/drivers/media/platform/mtk-jpeg/mtk_jpeg_core.c @@ -1081,11 +1081,11 @@ static int mtk_jpeg_clk_init(struct mtk_jpeg_dev *jpeg) jpeg->clk_jdec = devm_clk_get(jpeg->dev, "jpgdec"); if (IS_ERR(jpeg->clk_jdec)) - return -EINVAL; + return PTR_ERR(jpeg->clk_jdec); jpeg->clk_jdec_smi = devm_clk_get(jpeg->dev, "jpgdec-smi"); if (IS_ERR(jpeg->clk_jdec_smi)) - return -EINVAL; + return PTR_ERR(jpeg->clk_jdec_smi); return 0; } From 437fba47f48514554c71f3a14ab1d991fd11579e Mon Sep 17 00:00:00 2001 From: Jasmin Jessich Date: Sat, 24 Mar 2018 20:29:46 -0400 Subject: [PATCH 07/48] media: cec-pin: Fixed ktime_t to ns conversion Older Kernels use a struct for ktime_t, which requires the conversion function ktime_to_ns to be used on some places. With this patch it will compile now also for older Kernel versions. Signed-off-by: Jasmin Jessich Signed-off-by: Hans Verkuil Signed-off-by: Mauro Carvalho Chehab --- drivers/media/cec/cec-pin.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/drivers/media/cec/cec-pin.c b/drivers/media/cec/cec-pin.c index fafe1ebc8aff..2a5df99735fa 100644 --- a/drivers/media/cec/cec-pin.c +++ b/drivers/media/cec/cec-pin.c @@ -668,7 +668,7 @@ static void cec_pin_rx_states(struct cec_pin *pin, ktime_t ts) /* Start bit low is too short, go back to idle */ if (delta < CEC_TIM_START_BIT_LOW_MIN - CEC_TIM_IDLE_SAMPLE) { if (!pin->rx_start_bit_low_too_short_cnt++) { - pin->rx_start_bit_low_too_short_ts = pin->ts; + pin->rx_start_bit_low_too_short_ts = ktime_to_ns(pin->ts); pin->rx_start_bit_low_too_short_delta = delta; } cec_pin_to_idle(pin); @@ -700,7 +700,7 @@ static void cec_pin_rx_states(struct cec_pin *pin, ktime_t ts) /* Start bit is too short, go back to idle */ if (delta < CEC_TIM_START_BIT_TOTAL_MIN - CEC_TIM_IDLE_SAMPLE) { if (!pin->rx_start_bit_too_short_cnt++) { - pin->rx_start_bit_too_short_ts = pin->ts; + pin->rx_start_bit_too_short_ts = ktime_to_ns(pin->ts); pin->rx_start_bit_too_short_delta = delta; } cec_pin_to_idle(pin); @@ -770,7 +770,7 @@ static void cec_pin_rx_states(struct cec_pin *pin, ktime_t ts) */ if (delta < CEC_TIM_DATA_BIT_TOTAL_MIN) { if (!pin->rx_data_bit_too_short_cnt++) { - pin->rx_data_bit_too_short_ts = pin->ts; + pin->rx_data_bit_too_short_ts = ktime_to_ns(pin->ts); pin->rx_data_bit_too_short_delta = delta; } cec_pin_low(pin); From e605e9e339379730c84a6b51bf9a12da2d64b77b Mon Sep 17 00:00:00 2001 From: Hans Verkuil Date: Sun, 25 Mar 2018 17:40:30 -0400 Subject: [PATCH 08/48] media: v4l2-tpg-core.c: add space after % I know, it's a measly space, but I can't stand it since the V4L2_PIX_FMT_NV24 case before this case does it right. So add the space in order to restore blessed symmetry and consistency and to make the world whole again... Signed-off-by: Hans Verkuil Signed-off-by: Mauro Carvalho Chehab --- drivers/media/common/v4l2-tpg/v4l2-tpg-core.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/drivers/media/common/v4l2-tpg/v4l2-tpg-core.c b/drivers/media/common/v4l2-tpg/v4l2-tpg-core.c index 37632bc524d4..9b64f4f354bf 100644 --- a/drivers/media/common/v4l2-tpg/v4l2-tpg-core.c +++ b/drivers/media/common/v4l2-tpg/v4l2-tpg-core.c @@ -1149,7 +1149,7 @@ static void gen_twopix(struct tpg_data *tpg, case V4L2_PIX_FMT_NV42: buf[0][offset] = r_y_h; buf[1][2 * offset] = b_v; - buf[1][(2 * offset + 1) %8] = g_u_s; + buf[1][(2 * offset + 1) % 8] = g_u_s; break; case V4L2_PIX_FMT_YUYV: From 54f6735abea87487c2a01dab22897fe8dcb99145 Mon Sep 17 00:00:00 2001 From: Hans Verkuil Date: Mon, 19 Mar 2018 08:58:18 -0400 Subject: [PATCH 09/48] media: pixfmt-v4l2-mplane.rst: fix types The v4l2_pix_format_mplane documentation still had 'enum's as types. Replace by __u8 and add a reference to the enum. Also put ycbcr_enc and hsv_enc in a union. Signed-off-by: Hans Verkuil Signed-off-by: Mauro Carvalho Chehab --- .../media/uapi/v4l/pixfmt-v4l2-mplane.rst | 36 ++++++++++++------- 1 file changed, 24 insertions(+), 12 deletions(-) diff --git a/Documentation/media/uapi/v4l/pixfmt-v4l2-mplane.rst b/Documentation/media/uapi/v4l/pixfmt-v4l2-mplane.rst index 337e8188caf1..ef52f637d8e9 100644 --- a/Documentation/media/uapi/v4l/pixfmt-v4l2-mplane.rst +++ b/Documentation/media/uapi/v4l/pixfmt-v4l2-mplane.rst @@ -55,12 +55,14 @@ describing all planes of that format. - ``pixelformat`` - The pixel format. Both single- and multi-planar four character codes can be used. - * - enum :c:type:`v4l2_field` + * - __u32 - ``field`` - - See struct :c:type:`v4l2_pix_format`. - * - enum :c:type:`v4l2_colorspace` + - Field order, from enum :c:type:`v4l2_field`. + See struct :c:type:`v4l2_pix_format`. + * - __u32 - ``colorspace`` - - See struct :c:type:`v4l2_pix_format`. + - Colorspace encoding, from enum :c:type:`v4l2_colorspace`. + See struct :c:type:`v4l2_pix_format`. * - struct :c:type:`v4l2_plane_pix_format` - ``plane_fmt[VIDEO_MAX_PLANES]`` - An array of structures describing format of each plane this pixel @@ -73,24 +75,34 @@ describing all planes of that format. * - __u8 - ``flags`` - Flags set by the application or driver, see :ref:`format-flags`. - * - enum :c:type:`v4l2_ycbcr_encoding` + * - union { + - (anonymous) + - + * - __u8 - ``ycbcr_enc`` - - This information supplements the ``colorspace`` and must be set by + - Y'CbCr encoding, from enum :c:type:`v4l2_ycbcr_encoding`. + This information supplements the ``colorspace`` and must be set by the driver for capture streams and by the application for output streams, see :ref:`colorspaces`. - * - enum :c:type:`v4l2_hsv_encoding` + * - __u8 - ``hsv_enc`` - - This information supplements the ``colorspace`` and must be set by + - HSV encoding, from enum :c:type:`v4l2_hsv_encoding`. + This information supplements the ``colorspace`` and must be set by the driver for capture streams and by the application for output streams, see :ref:`colorspaces`. - * - enum :c:type:`v4l2_quantization` + * - } + - + - + * - __u8 - ``quantization`` - - This information supplements the ``colorspace`` and must be set by + - Quantization range, from enum :c:type:`v4l2_quantization`. + This information supplements the ``colorspace`` and must be set by the driver for capture streams and by the application for output streams, see :ref:`colorspaces`. - * - enum :c:type:`v4l2_xfer_func` + * - __u8 - ``xfer_func`` - - This information supplements the ``colorspace`` and must be set by + - Transfer function, from enum :c:type:`v4l2_xfer_func`. + This information supplements the ``colorspace`` and must be set by the driver for capture streams and by the application for output streams, see :ref:`colorspaces`. * - __u8 From a54f2d98670045c78547ee669ff024b68f5ed17a Mon Sep 17 00:00:00 2001 From: Hans Verkuil Date: Mon, 19 Mar 2018 08:58:19 -0400 Subject: [PATCH 10/48] media: pixfmt-v4l2.rst: fix types The v4l2_pix_format documentation still had 'enum's as types. Replace by __u32 and add a reference to the enum. Also put ycbcr_enc and hsv_enc in a union. Signed-off-by: Hans Verkuil Signed-off-by: Mauro Carvalho Chehab --- Documentation/media/uapi/v4l/pixfmt-v4l2.rst | 36 +++++++++++++------- 1 file changed, 24 insertions(+), 12 deletions(-) diff --git a/Documentation/media/uapi/v4l/pixfmt-v4l2.rst b/Documentation/media/uapi/v4l/pixfmt-v4l2.rst index 6622938c1b41..826f2305da01 100644 --- a/Documentation/media/uapi/v4l/pixfmt-v4l2.rst +++ b/Documentation/media/uapi/v4l/pixfmt-v4l2.rst @@ -40,9 +40,10 @@ Single-planar format structure RGB formats in :ref:`rgb-formats`, YUV formats in :ref:`yuv-formats`, and reserved codes in :ref:`reserved-formats` - * - enum :c:type:`v4l2_field` + * - __u32 - ``field`` - - Video images are typically interlaced. Applications can request to + - Field order, from enum :c:type:`v4l2_field`. + Video images are typically interlaced. Applications can request to capture or output only the top or bottom field, or both fields interlaced or sequentially stored in one buffer or alternating in separate buffers. Drivers return the actual field order selected. @@ -82,9 +83,10 @@ Single-planar format structure driver. Usually this is ``bytesperline`` times ``height``. When the image consists of variable length compressed data this is the maximum number of bytes required to hold an image. - * - enum :c:type:`v4l2_colorspace` + * - __u32 - ``colorspace`` - - This information supplements the ``pixelformat`` and must be set + - Image colorspace, from enum :c:type:`v4l2_colorspace`. + This information supplements the ``pixelformat`` and must be set by the driver for capture streams and by the application for output streams, see :ref:`colorspaces`. * - __u32 @@ -116,23 +118,33 @@ Single-planar format structure * - __u32 - ``flags`` - Flags set by the application or driver, see :ref:`format-flags`. - * - enum :c:type:`v4l2_ycbcr_encoding` + * - union { + - (anonymous) + - + * - __u32 - ``ycbcr_enc`` - - This information supplements the ``colorspace`` and must be set by + - Y'CbCr encoding, from enum :c:type:`v4l2_ycbcr_encoding`. + This information supplements the ``colorspace`` and must be set by the driver for capture streams and by the application for output streams, see :ref:`colorspaces`. - * - enum :c:type:`v4l2_hsv_encoding` + * - __u32 - ``hsv_enc`` - - This information supplements the ``colorspace`` and must be set by + - HSV encoding, from enum :c:type:`v4l2_hsv_encoding`. + This information supplements the ``colorspace`` and must be set by the driver for capture streams and by the application for output streams, see :ref:`colorspaces`. - * - enum :c:type:`v4l2_quantization` + * - } + - + - + * - __u32 - ``quantization`` - - This information supplements the ``colorspace`` and must be set by + - Quantization range, from enum :c:type:`v4l2_quantization`. + This information supplements the ``colorspace`` and must be set by the driver for capture streams and by the application for output streams, see :ref:`colorspaces`. - * - enum :c:type:`v4l2_xfer_func` + * - __u32 - ``xfer_func`` - - This information supplements the ``colorspace`` and must be set by + - Transfer function, from enum :c:type:`v4l2_xfer_func`. + This information supplements the ``colorspace`` and must be set by the driver for capture streams and by the application for output streams, see :ref:`colorspaces`. From 793d2a9e3d846180e5f796a5a414d963504efd97 Mon Sep 17 00:00:00 2001 From: Hans Verkuil Date: Mon, 19 Mar 2018 11:43:17 -0400 Subject: [PATCH 11/48] media: media-ioc-g-topology.rst: fix 'reserved' sizes The size of the reserved arrays in the documentation is wrong. Sync this with the actual header. Signed-off-by: Hans Verkuil Signed-off-by: Mauro Carvalho Chehab --- Documentation/media/uapi/mediactl/media-ioc-g-topology.rst | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/Documentation/media/uapi/mediactl/media-ioc-g-topology.rst b/Documentation/media/uapi/mediactl/media-ioc-g-topology.rst index c8f9ea37db2d..fca4a22f6a45 100644 --- a/Documentation/media/uapi/mediactl/media-ioc-g-topology.rst +++ b/Documentation/media/uapi/mediactl/media-ioc-g-topology.rst @@ -211,7 +211,7 @@ desired arrays with the media graph elements. - __u32 - - ``reserved``\ [12] + - ``reserved``\ [6] - Reserved for future extensions. Drivers and applications must set this array to zero. @@ -334,7 +334,7 @@ desired arrays with the media graph elements. - __u32 - - ``reserved``\ [9] + - ``reserved``\ [5] - Reserved for future extensions. Drivers and applications must set this array to zero. @@ -390,7 +390,7 @@ desired arrays with the media graph elements. - __u32 - - ``reserved``\ [5] + - ``reserved``\ [6] - Reserved for future extensions. Drivers and applications must set this array to zero. From cccc41fd3e8d1cfb6f4474470111cf03a6e18452 Mon Sep 17 00:00:00 2001 From: Hans Verkuil Date: Mon, 19 Mar 2018 11:43:24 -0400 Subject: [PATCH 12/48] media: media-types.rst: rename media-entity-type to media-entity-functions The MEDIA_ENT_F_* defines refer to functions, not types. Update the documentation accordingly. Signed-off-by: Hans Verkuil Signed-off-by: Mauro Carvalho Chehab --- Documentation/media/uapi/mediactl/media-ioc-enum-entities.rst | 2 +- Documentation/media/uapi/mediactl/media-ioc-g-topology.rst | 2 +- Documentation/media/uapi/mediactl/media-types.rst | 4 ++-- 3 files changed, 4 insertions(+), 4 deletions(-) diff --git a/Documentation/media/uapi/mediactl/media-ioc-enum-entities.rst b/Documentation/media/uapi/mediactl/media-ioc-enum-entities.rst index 45e76e5bc1ea..582fda488810 100644 --- a/Documentation/media/uapi/mediactl/media-ioc-enum-entities.rst +++ b/Documentation/media/uapi/mediactl/media-ioc-enum-entities.rst @@ -89,7 +89,7 @@ id's until they get an error. - - - - Entity type, see :ref:`media-entity-type` for details. + - Entity type, see :ref:`media-entity-functions` for details. - .. row 4 diff --git a/Documentation/media/uapi/mediactl/media-ioc-g-topology.rst b/Documentation/media/uapi/mediactl/media-ioc-g-topology.rst index fca4a22f6a45..c4055ddf070a 100644 --- a/Documentation/media/uapi/mediactl/media-ioc-g-topology.rst +++ b/Documentation/media/uapi/mediactl/media-ioc-g-topology.rst @@ -205,7 +205,7 @@ desired arrays with the media graph elements. - ``function`` - - Entity main function, see :ref:`media-entity-type` for details. + - Entity main function, see :ref:`media-entity-functions` for details. - .. row 4 diff --git a/Documentation/media/uapi/mediactl/media-types.rst b/Documentation/media/uapi/mediactl/media-types.rst index f92f10b7ffbd..2dda14bd89b7 100644 --- a/Documentation/media/uapi/mediactl/media-types.rst +++ b/Documentation/media/uapi/mediactl/media-types.rst @@ -7,11 +7,11 @@ Types and flags used to represent the media graph elements .. tabularcolumns:: |p{8.2cm}|p{10.3cm}| -.. _media-entity-type: +.. _media-entity-functions: .. cssclass:: longtable -.. flat-table:: Media entity types +.. flat-table:: Media entity functions :header-rows: 0 :stub-columns: 0 From dd5747fb9235d28ac2534e0ad4826a810a93e003 Mon Sep 17 00:00:00 2001 From: Fabio Estevam Date: Sat, 3 Mar 2018 07:56:30 -0500 Subject: [PATCH 13/48] media: imx-media-csi: Do not propagate the error when pinctrl is not found Since commit 52e17089d185 ("media: imx: Don't initialize vars that won't be used") imx_csi_probe() fails to probe after propagating the devm_pinctrl_get_select_default() error. devm_pinctrl_get_select_default() may return -ENODEV when the CSI pinctrl entry is not found, so better not to propagate the error in the -ENODEV case to avoid a regression. Suggested-by: Philipp Zabel Signed-off-by: Fabio Estevam Reviewed-by: Steve Longerbeam Signed-off-by: Hans Verkuil Signed-off-by: Mauro Carvalho Chehab --- drivers/staging/media/imx/imx-media-csi.c | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/drivers/staging/media/imx/imx-media-csi.c b/drivers/staging/media/imx/imx-media-csi.c index 00c9d625cfb5..16cab40156ca 100644 --- a/drivers/staging/media/imx/imx-media-csi.c +++ b/drivers/staging/media/imx/imx-media-csi.c @@ -1800,7 +1800,10 @@ static int imx_csi_probe(struct platform_device *pdev) pinctrl = devm_pinctrl_get_select_default(priv->dev); if (IS_ERR(pinctrl)) { ret = PTR_ERR(priv->vdev); - goto free; + dev_dbg(priv->dev, + "devm_pinctrl_get_select_default() failed: %d\n", ret); + if (ret != -ENODEV) + goto free; } ret = v4l2_async_register_subdev(&priv->sd); From d2dc57b10ae2bd2e2e92ce26f2aaf24bcee17c53 Mon Sep 17 00:00:00 2001 From: Sakari Ailus Date: Wed, 21 Mar 2018 16:29:27 -0400 Subject: [PATCH 14/48] media: v4l: Bring back array_size parameter to v4l2_find_nearest_size An older version of the driver patches were merged accidentally which resulted in missing the array_size parameter that tells the length of the array that contains the different supported sizes. Bring it back to v4l2_find_nearest size and make the corresponding change for the drivers using it as well. Signed-off-by: Sakari Ailus Signed-off-by: Mauro Carvalho Chehab --- drivers/media/i2c/ov13858.c | 4 +++- drivers/media/i2c/ov5670.c | 4 +++- drivers/media/platform/vivid/vivid-vid-cap.c | 5 +++-- include/media/v4l2-common.h | 5 +++-- 4 files changed, 12 insertions(+), 6 deletions(-) diff --git a/drivers/media/i2c/ov13858.c b/drivers/media/i2c/ov13858.c index 30ee9f71bf0d..3e9ff8205991 100644 --- a/drivers/media/i2c/ov13858.c +++ b/drivers/media/i2c/ov13858.c @@ -1375,7 +1375,9 @@ ov13858_set_pad_format(struct v4l2_subdev *sd, if (fmt->format.code != MEDIA_BUS_FMT_SGRBG10_1X10) fmt->format.code = MEDIA_BUS_FMT_SGRBG10_1X10; - mode = v4l2_find_nearest_size(supported_modes, width, height, + mode = v4l2_find_nearest_size(supported_modes, + ARRAY_SIZE(supported_modes), + width, height, fmt->format.width, fmt->format.height); ov13858_update_pad_format(mode, fmt); if (fmt->which == V4L2_SUBDEV_FORMAT_TRY) { diff --git a/drivers/media/i2c/ov5670.c b/drivers/media/i2c/ov5670.c index d2db480da1b9..e03d82c44dd0 100644 --- a/drivers/media/i2c/ov5670.c +++ b/drivers/media/i2c/ov5670.c @@ -2230,7 +2230,9 @@ static int ov5670_set_pad_format(struct v4l2_subdev *sd, fmt->format.code = MEDIA_BUS_FMT_SGRBG10_1X10; - mode = v4l2_find_nearest_size(supported_modes, width, height, + mode = v4l2_find_nearest_size(supported_modes, + ARRAY_SIZE(supported_modes), + width, height, fmt->format.width, fmt->format.height); ov5670_update_pad_format(mode, fmt); if (fmt->which == V4L2_SUBDEV_FORMAT_TRY) { diff --git a/drivers/media/platform/vivid/vivid-vid-cap.c b/drivers/media/platform/vivid/vivid-vid-cap.c index 01c703683657..1599159f2574 100644 --- a/drivers/media/platform/vivid/vivid-vid-cap.c +++ b/drivers/media/platform/vivid/vivid-vid-cap.c @@ -561,8 +561,9 @@ int vivid_try_fmt_vid_cap(struct file *file, void *priv, mp->field = vivid_field_cap(dev, mp->field); if (vivid_is_webcam(dev)) { const struct v4l2_frmsize_discrete *sz = - v4l2_find_nearest_size(webcam_sizes, width, height, - mp->width, mp->height); + v4l2_find_nearest_size(webcam_sizes, + VIVID_WEBCAM_SIZES, width, + height, mp->width, mp->height); w = sz->width; h = sz->height; diff --git a/include/media/v4l2-common.h b/include/media/v4l2-common.h index 54b689247937..160bca96d524 100644 --- a/include/media/v4l2-common.h +++ b/include/media/v4l2-common.h @@ -320,6 +320,7 @@ void v4l_bound_align_image(unsigned int *width, unsigned int wmin, * set of resolutions contained in an array of a driver specific struct. * * @array: a driver specific array of image sizes + * @array_size: the length of the driver specific array of image sizes * @width_field: the name of the width field in the driver specific struct * @height_field: the name of the height field in the driver specific struct * @width: desired width. @@ -332,13 +333,13 @@ void v4l_bound_align_image(unsigned int *width, unsigned int wmin, * * Returns the best match or NULL if the length of the array is zero. */ -#define v4l2_find_nearest_size(array, width_field, height_field, \ +#define v4l2_find_nearest_size(array, array_size, width_field, height_field, \ width, height) \ ({ \ BUILD_BUG_ON(sizeof((array)->width_field) != sizeof(u32) || \ sizeof((array)->height_field) != sizeof(u32)); \ (typeof(&(*(array))))__v4l2_find_nearest_size( \ - (array), ARRAY_SIZE(array), sizeof(*(array)), \ + (array), array_size, sizeof(*(array)), \ offsetof(typeof(*(array)), width_field), \ offsetof(typeof(*(array)), height_field), \ width, height); \ From 136fe992346454bfa7d8a4a7c80ae3910c7ffa25 Mon Sep 17 00:00:00 2001 From: Rajmohan Mani Date: Tue, 20 Feb 2018 19:54:05 -0500 Subject: [PATCH 15/48] media: dw9714: Update to SPDX license identifier Remove the GPL v2 license boilerplate and update with the SPDX license identifier. Signed-off-by: Rajmohan Mani Signed-off-by: Sakari Ailus Signed-off-by: Mauro Carvalho Chehab --- drivers/media/i2c/dw9714.c | 14 ++------------ 1 file changed, 2 insertions(+), 12 deletions(-) diff --git a/drivers/media/i2c/dw9714.c b/drivers/media/i2c/dw9714.c index 8dbbf0f917df..91fae01d052b 100644 --- a/drivers/media/i2c/dw9714.c +++ b/drivers/media/i2c/dw9714.c @@ -1,15 +1,5 @@ -/* - * Copyright (c) 2015--2017 Intel Corporation. - * - * This program is free software; you can redistribute it and/or - * modify it under the terms of the GNU General Public License version - * 2 as published by the Free Software Foundation. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - */ +// SPDX-License-Identifier: GPL-2.0 +// Copyright (c) 2015--2017 Intel Corporation. #include #include From a1c3bb0e1faf44f8b0968e2775abd1f64d0b02f1 Mon Sep 17 00:00:00 2001 From: Chiranjeevi Rapolu Date: Wed, 21 Feb 2018 12:42:47 -0500 Subject: [PATCH 16/48] media: ov5670: Update to SPDX identifier Replace GPL v2 license notice with SPDX license identifier. Signed-off-by: Chiranjeevi Rapolu Signed-off-by: Sakari Ailus Signed-off-by: Mauro Carvalho Chehab --- drivers/media/i2c/ov5670.c | 15 ++------------- 1 file changed, 2 insertions(+), 13 deletions(-) diff --git a/drivers/media/i2c/ov5670.c b/drivers/media/i2c/ov5670.c index e03d82c44dd0..7b7c74d77370 100644 --- a/drivers/media/i2c/ov5670.c +++ b/drivers/media/i2c/ov5670.c @@ -1,16 +1,5 @@ -/* - * Copyright (c) 2017 Intel Corporation. - * - * This program is free software; you can redistribute it and/or - * modify it under the terms of the GNU General Public License version - * 2 as published by the Free Software Foundation. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - */ +// SPDX-License-Identifier: GPL-2.0 +// Copyright (c) 2017 Intel Corporation. #include #include From 28cab405c44bb2881d7f53d8d602fc7b40ff9e43 Mon Sep 17 00:00:00 2001 From: Chiranjeevi Rapolu Date: Wed, 21 Feb 2018 12:55:20 -0500 Subject: [PATCH 17/48] media: ov13858: Update to SPDX identifier Replace GPL v2 license notice with SPDX license identifier. Signed-off-by: Chiranjeevi Rapolu Signed-off-by: Sakari Ailus Signed-off-by: Mauro Carvalho Chehab --- drivers/media/i2c/ov13858.c | 15 ++------------- 1 file changed, 2 insertions(+), 13 deletions(-) diff --git a/drivers/media/i2c/ov13858.c b/drivers/media/i2c/ov13858.c index 3e9ff8205991..3dbcae257164 100644 --- a/drivers/media/i2c/ov13858.c +++ b/drivers/media/i2c/ov13858.c @@ -1,16 +1,5 @@ -/* - * Copyright (c) 2017 Intel Corporation. - * - * This program is free software; you can redistribute it and/or - * modify it under the terms of the GNU General Public License version - * 2 as published by the Free Software Foundation. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - */ +// SPDX-License-Identifier: GPL-2.0 +// Copyright (c) 2017 Intel Corporation. #include #include From 9f67a5e22c0facd7d6c0ba4d84a427f541c85a17 Mon Sep 17 00:00:00 2001 From: Luca Ceresoli Date: Fri, 23 Feb 2018 03:57:15 -0500 Subject: [PATCH 18/48] media: imx274: fix typo in error message Signed-off-by: Luca Ceresoli Signed-off-by: Sakari Ailus Signed-off-by: Mauro Carvalho Chehab --- drivers/media/i2c/imx274.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/drivers/media/i2c/imx274.c b/drivers/media/i2c/imx274.c index 664e8acdf2a0..daec33f4196a 100644 --- a/drivers/media/i2c/imx274.c +++ b/drivers/media/i2c/imx274.c @@ -1426,7 +1426,7 @@ static int imx274_set_vflip(struct stimx274 *priv, int val) err = imx274_write_reg(priv, IMX274_VFLIP_REG, val); if (err) { - dev_err(&priv->client->dev, "VFILP control error\n"); + dev_err(&priv->client->dev, "VFLIP control error\n"); return err; } From e6441fde848737c54bd3fdcb273c3a85ff66f14e Mon Sep 17 00:00:00 2001 From: Hugues Fruchet Date: Tue, 6 Mar 2018 12:04:39 -0500 Subject: [PATCH 19/48] media: ov5640: fix get_/set_fmt colorspace related fields Fix set of missing colorspace related fields in get_/set_fmt. Detected by v4l2-compliance tool. [Sakari Ailus: Rearrange fmt declaration in ov5640_probe()] Signed-off-by: Hugues Fruchet Signed-off-by: Sakari Ailus Signed-off-by: Mauro Carvalho Chehab --- drivers/media/i2c/ov5640.c | 29 +++++++++++++++++++++-------- 1 file changed, 21 insertions(+), 8 deletions(-) diff --git a/drivers/media/i2c/ov5640.c b/drivers/media/i2c/ov5640.c index 03940f0cdfa6..271e8624292e 100644 --- a/drivers/media/i2c/ov5640.c +++ b/drivers/media/i2c/ov5640.c @@ -1874,7 +1874,13 @@ static int ov5640_try_fmt_internal(struct v4l2_subdev *sd, if (ov5640_formats[i].code == fmt->code) break; if (i >= ARRAY_SIZE(ov5640_formats)) - fmt->code = ov5640_formats[0].code; + i = 0; + + fmt->code = ov5640_formats[i].code; + fmt->colorspace = ov5640_formats[i].colorspace; + fmt->ycbcr_enc = V4L2_MAP_YCBCR_ENC_DEFAULT(fmt->colorspace); + fmt->quantization = V4L2_QUANTIZATION_FULL_RANGE; + fmt->xfer_func = V4L2_MAP_XFER_FUNC_DEFAULT(fmt->colorspace); return 0; } @@ -1885,6 +1891,7 @@ static int ov5640_set_fmt(struct v4l2_subdev *sd, { struct ov5640_dev *sensor = to_ov5640_dev(sd); const struct ov5640_mode_info *new_mode; + struct v4l2_mbus_framefmt *mbus_fmt = &format->format; int ret; if (format->pad != 0) @@ -1897,7 +1904,7 @@ static int ov5640_set_fmt(struct v4l2_subdev *sd, goto out; } - ret = ov5640_try_fmt_internal(sd, &format->format, + ret = ov5640_try_fmt_internal(sd, mbus_fmt, sensor->current_fr, &new_mode); if (ret) goto out; @@ -1906,12 +1913,12 @@ static int ov5640_set_fmt(struct v4l2_subdev *sd, struct v4l2_mbus_framefmt *fmt = v4l2_subdev_get_try_format(sd, cfg, 0); - *fmt = format->format; + *fmt = *mbus_fmt; goto out; } sensor->current_mode = new_mode; - sensor->fmt = format->format; + sensor->fmt = *mbus_fmt; sensor->pending_mode_change = true; out: mutex_unlock(&sensor->lock); @@ -2496,6 +2503,7 @@ static int ov5640_probe(struct i2c_client *client, struct device *dev = &client->dev; struct fwnode_handle *endpoint; struct ov5640_dev *sensor; + struct v4l2_mbus_framefmt *fmt; int ret; sensor = devm_kzalloc(dev, sizeof(*sensor), GFP_KERNEL); @@ -2503,10 +2511,15 @@ static int ov5640_probe(struct i2c_client *client, return -ENOMEM; sensor->i2c_client = client; - sensor->fmt.code = MEDIA_BUS_FMT_UYVY8_2X8; - sensor->fmt.width = 640; - sensor->fmt.height = 480; - sensor->fmt.field = V4L2_FIELD_NONE; + fmt = &sensor->fmt; + fmt->code = ov5640_formats[0].code; + fmt->colorspace = ov5640_formats[0].colorspace; + fmt->ycbcr_enc = V4L2_MAP_YCBCR_ENC_DEFAULT(fmt->colorspace); + fmt->quantization = V4L2_QUANTIZATION_FULL_RANGE; + fmt->xfer_func = V4L2_MAP_XFER_FUNC_DEFAULT(fmt->colorspace); + fmt->width = 640; + fmt->height = 480; + fmt->field = V4L2_FIELD_NONE; sensor->frame_interval.numerator = 1; sensor->frame_interval.denominator = ov5640_framerates[OV5640_30_FPS]; sensor->current_fr = OV5640_30_FPS; From 06fe932307d58108a11c3e603517dd2a73a57b80 Mon Sep 17 00:00:00 2001 From: Akinobu Mita Date: Mon, 19 Mar 2018 12:14:17 -0400 Subject: [PATCH 20/48] media: ov5645: add missing of_node_put() in error path The device node obtained with of_graph_get_next_endpoint() should be released by calling of_node_put(). But it was not released when v4l2_fwnode_endpoint_parse() failed. This change moves the of_node_put() call before the error check and fixes the issue. Cc: Mauro Carvalho Chehab Signed-off-by: Akinobu Mita Acked-by: Todor Tomov Signed-off-by: Sakari Ailus Signed-off-by: Mauro Carvalho Chehab --- drivers/media/i2c/ov5645.c | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/drivers/media/i2c/ov5645.c b/drivers/media/i2c/ov5645.c index d28845f7356f..a31fe18c71d6 100644 --- a/drivers/media/i2c/ov5645.c +++ b/drivers/media/i2c/ov5645.c @@ -1131,13 +1131,14 @@ static int ov5645_probe(struct i2c_client *client, ret = v4l2_fwnode_endpoint_parse(of_fwnode_handle(endpoint), &ov5645->ep); + + of_node_put(endpoint); + if (ret < 0) { dev_err(dev, "parsing endpoint node failed\n"); return ret; } - of_node_put(endpoint); - if (ov5645->ep.bus_type != V4L2_MBUS_CSI2) { dev_err(dev, "invalid bus type, must be CSI2\n"); return -EINVAL; From 5b81c53c4996c4382f8ea85c1706152c9e5af5c7 Mon Sep 17 00:00:00 2001 From: Todor Tomov Date: Wed, 21 Mar 2018 04:42:36 -0400 Subject: [PATCH 21/48] media: ov5645: Use v4l2_find_nearest_size Use v4l2_find_nearest_size instead of a driver specific function to find nearest matching size. Signed-off-by: Todor Tomov Signed-off-by: Sakari Ailus Signed-off-by: Mauro Carvalho Chehab --- drivers/media/i2c/ov5645.c | 24 +++++------------------- 1 file changed, 5 insertions(+), 19 deletions(-) diff --git a/drivers/media/i2c/ov5645.c b/drivers/media/i2c/ov5645.c index a31fe18c71d6..4e3142a7e5a7 100644 --- a/drivers/media/i2c/ov5645.c +++ b/drivers/media/i2c/ov5645.c @@ -959,23 +959,6 @@ __ov5645_get_pad_crop(struct ov5645 *ov5645, struct v4l2_subdev_pad_config *cfg, } } -static const struct ov5645_mode_info * -ov5645_find_nearest_mode(unsigned int width, unsigned int height) -{ - int i; - - for (i = ARRAY_SIZE(ov5645_mode_info_data) - 1; i >= 0; i--) { - if (ov5645_mode_info_data[i].width <= width && - ov5645_mode_info_data[i].height <= height) - break; - } - - if (i < 0) - i = 0; - - return &ov5645_mode_info_data[i]; -} - static int ov5645_set_format(struct v4l2_subdev *sd, struct v4l2_subdev_pad_config *cfg, struct v4l2_subdev_format *format) @@ -989,8 +972,11 @@ static int ov5645_set_format(struct v4l2_subdev *sd, __crop = __ov5645_get_pad_crop(ov5645, cfg, format->pad, format->which); - new_mode = ov5645_find_nearest_mode(format->format.width, - format->format.height); + new_mode = v4l2_find_nearest_size(ov5645_mode_info_data, + ARRAY_SIZE(ov5645_mode_info_data), + width, height, + format->format.width, format->format.height); + __crop->width = new_mode->width; __crop->height = new_mode->height; From 4996c3d4cfce30ed30160c511b43d9b491445d7c Mon Sep 17 00:00:00 2001 From: Fabio Estevam Date: Sat, 17 Mar 2018 14:24:58 -0400 Subject: [PATCH 22/48] media: ov2685: Remove owner assignment from i2c_driver Structure i2c_driver does not need to set the owner field, as this will be populated by the driver core. Generated by scripts/coccinelle/api/platform_no_drv_owner.cocci. Signed-off-by: Fabio Estevam Signed-off-by: Sakari Ailus Signed-off-by: Mauro Carvalho Chehab --- drivers/media/i2c/ov2685.c | 1 - 1 file changed, 1 deletion(-) diff --git a/drivers/media/i2c/ov2685.c b/drivers/media/i2c/ov2685.c index 83c55e8288e7..385c1886a947 100644 --- a/drivers/media/i2c/ov2685.c +++ b/drivers/media/i2c/ov2685.c @@ -832,7 +832,6 @@ MODULE_DEVICE_TABLE(of, ov2685_of_match); static struct i2c_driver ov2685_i2c_driver = { .driver = { .name = "ov2685", - .owner = THIS_MODULE, .pm = &ov2685_pm_ops, .of_match_table = of_match_ptr(ov2685_of_match), }, From 19ad26f9e6e1decdde6d48fe1849a06a103b0f09 Mon Sep 17 00:00:00 2001 From: Akinobu Mita Date: Sun, 11 Mar 2018 11:34:41 -0400 Subject: [PATCH 23/48] media: ov5640: add missing output pixel format setting The output pixel format changed by set_fmt() pad operation is not correctly applied. It is intended to be restored by calling ov5640_set_framefmt() when the video stream is started. However, when the device is powered on by s_power subdev operation before the video stream is started, the current output mode setting is restored by ov5640_restore_mode() that also clears pending_mode_change flag in ov5640_set_mode(). So ov5640_set_framefmt() isn't called as intended and the output pixel format is not restored. This change adds the missing output pixel format setting in the ov5640_restore_mode() that is called when the device is powered on. Cc: Steve Longerbeam Cc: Hugues Fruchet Cc: Mauro Carvalho Chehab Signed-off-by: Akinobu Mita Signed-off-by: Sakari Ailus Signed-off-by: Mauro Carvalho Chehab --- drivers/media/i2c/ov5640.c | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/drivers/media/i2c/ov5640.c b/drivers/media/i2c/ov5640.c index 271e8624292e..852026baa2e7 100644 --- a/drivers/media/i2c/ov5640.c +++ b/drivers/media/i2c/ov5640.c @@ -1641,6 +1641,9 @@ static int ov5640_set_mode(struct ov5640_dev *sensor, return 0; } +static int ov5640_set_framefmt(struct ov5640_dev *sensor, + struct v4l2_mbus_framefmt *format); + /* restore the last set video mode after chip power-on */ static int ov5640_restore_mode(struct ov5640_dev *sensor) { @@ -1652,7 +1655,11 @@ static int ov5640_restore_mode(struct ov5640_dev *sensor) return ret; /* now restore the last capture mode */ - return ov5640_set_mode(sensor, &ov5640_mode_init_data); + ret = ov5640_set_mode(sensor, &ov5640_mode_init_data); + if (ret < 0) + return ret; + + return ov5640_set_framefmt(sensor, &sensor->fmt); } static void ov5640_power(struct ov5640_dev *sensor, bool enable) From 639fa43d59e5a41ca8c55592cd5c1021fea2ab83 Mon Sep 17 00:00:00 2001 From: Kieran Bingham Date: Mon, 26 Mar 2018 09:29:17 -0400 Subject: [PATCH 24/48] media: vsp1: Fix BRx conditional path in WPF When a BRx is provided by a pipeline, the WPF must determine the master layer. Currently the condition to check this identifies pipe->bru || pipe->num_inputs > 1. The code then moves on to dereference pipe->bru, thus the check fails static analysers on the possibility that pipe->num_inputs could be greater than 1 without pipe->bru being set. The reality is that the pipeline must have a BRx to support more than one input, thus this could never cause a fault - however it also identifies that the num_inputs > 1 check is redundant. Remove the redundant check - and always configure the master layer appropriately when we have a BRx configured in our pipeline. Fixes: 6134148f6098 ("v4l: vsp1: Add support for the BRS entity") Cc: stable@vger.kernel.org Suggested-by: Mauro Carvalho Chehab Signed-off-by: Kieran Bingham Reviewed-by: Laurent Pinchart Signed-off-by: Mauro Carvalho Chehab --- drivers/media/platform/vsp1/vsp1_wpf.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/drivers/media/platform/vsp1/vsp1_wpf.c b/drivers/media/platform/vsp1/vsp1_wpf.c index f7f3b4b2c2de..8bd6b2f1af15 100644 --- a/drivers/media/platform/vsp1/vsp1_wpf.c +++ b/drivers/media/platform/vsp1/vsp1_wpf.c @@ -452,7 +452,7 @@ static void wpf_configure(struct vsp1_entity *entity, : VI6_WPF_SRCRPF_RPF_ACT_SUB(input->entity.index); } - if (pipe->bru || pipe->num_inputs > 1) + if (pipe->bru) srcrpf |= pipe->bru->type == VSP1_ENTITY_BRU ? VI6_WPF_SRCRPF_VIRACT_MST : VI6_WPF_SRCRPF_VIRACT2_MST; From 8b1ca8a0363efdfa63358f598a2cadda2e514ab7 Mon Sep 17 00:00:00 2001 From: Brad Love Date: Mon, 2 Apr 2018 15:59:01 -0400 Subject: [PATCH 25/48] media: cx231xx: Increase USB bridge bandwidth The cx231xx USB bridge has issue streaming QAM256 DVB-C channels. QAM64 channels were fine, but QAM256 channels produced corrupted transport streams. cx231xx alt mode 4 does not provide enough bandwidth to acommodate QAM256 DVB-C channels, most likely DVB-T2 channels would break up as well. Alt mode 5 increases bridge bandwidth to 90Mbps, and fixes QAM256 DVB-C streaming. Signed-off-by: Brad Love Signed-off-by: Mauro Carvalho Chehab --- drivers/media/usb/cx231xx/cx231xx-dvb.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/drivers/media/usb/cx231xx/cx231xx-dvb.c b/drivers/media/usb/cx231xx/cx231xx-dvb.c index 713029420fcf..67ed66712d05 100644 --- a/drivers/media/usb/cx231xx/cx231xx-dvb.c +++ b/drivers/media/usb/cx231xx/cx231xx-dvb.c @@ -276,7 +276,7 @@ static int start_streaming(struct cx231xx_dvb *dvb) if (dev->USE_ISO) { dev_dbg(dev->dev, "DVB transfer mode is ISO.\n"); - cx231xx_set_alt_setting(dev, INDEX_TS1, 4); + cx231xx_set_alt_setting(dev, INDEX_TS1, 5); rc = cx231xx_set_mode(dev, CX231XX_DIGITAL_MODE); if (rc < 0) return rc; From 732a9edc30c64207606792d577a87dc8410ff236 Mon Sep 17 00:00:00 2001 From: "winton.liu" <18502523564@163.com> Date: Tue, 3 Apr 2018 08:04:45 -0400 Subject: [PATCH 26/48] media: gspca: fix Kconfig help info Documentation/video4linux/gspca.txt is missing. It has moved to Documentation/media/v4l-drivers/gspca-cardlist.rst Signed-off-by: winton.liu <18502523564@163.com> Signed-off-by: Mauro Carvalho Chehab --- drivers/media/usb/gspca/Kconfig | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/drivers/media/usb/gspca/Kconfig b/drivers/media/usb/gspca/Kconfig index d214a21acff7..bc9a439745aa 100644 --- a/drivers/media/usb/gspca/Kconfig +++ b/drivers/media/usb/gspca/Kconfig @@ -7,7 +7,7 @@ menuconfig USB_GSPCA Say Y here if you want to enable selecting webcams based on the GSPCA framework. - See for more info. + See for more info. This driver uses the Video For Linux API. You must say Y or M to "Video For Linux" to use this driver. From 5c6c9c4830b76d851d38829611b3c3e4be0f5cdf Mon Sep 17 00:00:00 2001 From: Katsuhiro Suzuki Date: Wed, 4 Apr 2018 04:17:56 -0400 Subject: [PATCH 27/48] media: dvb_frontend: fix wrong cast in compat_ioctl FE_GET_PROPERTY has always failed as following situations: - Use compatible ioctl - The array of 'struct dtv_property' has 2 or more items This patch fixes wrong cast to a pointer 'struct dtv_property' from a pointer of 2nd or after item of 'struct compat_dtv_property' array. Signed-off-by: Katsuhiro Suzuki Signed-off-by: Mauro Carvalho Chehab --- drivers/media/dvb-core/dvb_frontend.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/drivers/media/dvb-core/dvb_frontend.c b/drivers/media/dvb-core/dvb_frontend.c index 21a7d4b47e1a..e33414975065 100644 --- a/drivers/media/dvb-core/dvb_frontend.c +++ b/drivers/media/dvb-core/dvb_frontend.c @@ -2089,7 +2089,7 @@ static int dvb_frontend_handle_compat_ioctl(struct file *file, unsigned int cmd, } for (i = 0; i < tvps->num; i++) { err = dtv_property_process_get( - fe, &getp, (struct dtv_property *)tvp + i, file); + fe, &getp, (struct dtv_property *)(tvp + i), file); if (err < 0) { kfree(tvp); return err; From 5e95db4cf73f62e369c10150025a2896618d4e83 Mon Sep 17 00:00:00 2001 From: Mauro Carvalho Chehab Date: Mon, 26 Mar 2018 09:45:05 -0400 Subject: [PATCH 28/48] media: staging: atomisp: do some coding style improvements Use make coccicheck in patch mode to do some coding style improvements. Adjust the results manually. Acked-by: Sakari Ailus Signed-off-by: Mauro Carvalho Chehab --- .../media/atomisp/pci/atomisp2/atomisp_cmd.c | 14 ++++----- .../media/atomisp/pci/atomisp2/atomisp_fops.c | 14 ++++----- .../atomisp/pci/atomisp2/atomisp_ioctl.c | 2 +- .../atomisp2/css2400/runtime/bufq/src/bufq.c | 2 +- .../css2400/runtime/isys/src/isys_init.c | 4 +-- .../css2400/runtime/isys/src/virtual_isys.c | 12 ++++---- .../css2400/runtime/pipeline/src/pipeline.c | 2 +- .../atomisp/pci/atomisp2/css2400/sh_css.c | 30 ++++++++----------- .../atomisp/pci/atomisp2/css2400/sh_css_sp.c | 3 +- 9 files changed, 38 insertions(+), 45 deletions(-) diff --git a/drivers/staging/media/atomisp/pci/atomisp2/atomisp_cmd.c b/drivers/staging/media/atomisp/pci/atomisp2/atomisp_cmd.c index 22f2dbcecc15..2f6c88a0f4ee 100644 --- a/drivers/staging/media/atomisp/pci/atomisp2/atomisp_cmd.c +++ b/drivers/staging/media/atomisp/pci/atomisp2/atomisp_cmd.c @@ -515,7 +515,7 @@ irqreturn_t atomisp_isr(int irq, void *dev) spin_lock_irqsave(&isp->lock, flags); if (isp->sw_contex.power_state != ATOM_ISP_POWER_UP || - isp->css_initialized == false) { + !isp->css_initialized) { spin_unlock_irqrestore(&isp->lock, flags); return IRQ_HANDLED; } @@ -4603,7 +4603,7 @@ int atomisp_fixed_pattern(struct atomisp_sub_device *asd, int flag, } if (*value == 0) { - asd->params.fpn_en = 0; + asd->params.fpn_en = false; return 0; } @@ -5524,7 +5524,7 @@ static void atomisp_get_dis_envelop(struct atomisp_sub_device *asd, /* if subdev type is SOC camera,we do not need to set DVS */ if (isp->inputs[asd->input_curr].type == SOC_CAMERA) - asd->params.video_dis_en = 0; + asd->params.video_dis_en = false; if (asd->params.video_dis_en && asd->run_mode->val == ATOMISP_RUN_MODE_VIDEO) { @@ -5624,7 +5624,7 @@ static int atomisp_set_fmt_to_snr(struct video_device *vdev, ffmt = req_ffmt; dev_warn(isp->dev, "can not enable video dis due to sensor limitation."); - asd->params.video_dis_en = 0; + asd->params.video_dis_en = false; } } dev_dbg(isp->dev, "sensor width: %d, height: %d\n", @@ -5649,7 +5649,7 @@ static int atomisp_set_fmt_to_snr(struct video_device *vdev, (ffmt->width < req_ffmt->width || ffmt->height < req_ffmt->height)) { dev_warn(isp->dev, "can not enable video dis due to sensor limitation."); - asd->params.video_dis_en = 0; + asd->params.video_dis_en = false; } atomisp_subdev_set_ffmt(&asd->subdev, fh.pad, @@ -6152,7 +6152,7 @@ int atomisp_set_shading_table(struct atomisp_sub_device *asd, if (!user_shading_table->enable) { atomisp_css_set_shading_table(asd, NULL); - asd->params.sc_en = 0; + asd->params.sc_en = false; return 0; } @@ -6190,7 +6190,7 @@ int atomisp_set_shading_table(struct atomisp_sub_device *asd, free_table = asd->params.css_param.shading_table; asd->params.css_param.shading_table = shading_table; atomisp_css_set_shading_table(asd, shading_table); - asd->params.sc_en = 1; + asd->params.sc_en = true; out: if (free_table != NULL) diff --git a/drivers/staging/media/atomisp/pci/atomisp2/atomisp_fops.c b/drivers/staging/media/atomisp/pci/atomisp2/atomisp_fops.c index 545ef024841d..709137f25700 100644 --- a/drivers/staging/media/atomisp/pci/atomisp2/atomisp_fops.c +++ b/drivers/staging/media/atomisp/pci/atomisp2/atomisp_fops.c @@ -689,7 +689,7 @@ static void atomisp_dev_init_struct(struct atomisp_device *isp) { unsigned int i; - isp->sw_contex.file_input = 0; + isp->sw_contex.file_input = false; isp->need_gfx_throttle = true; isp->isp_fatal_error = false; isp->mipi_frame_size = 0; @@ -708,12 +708,12 @@ static void atomisp_subdev_init_struct(struct atomisp_sub_device *asd) v4l2_ctrl_s_ctrl(asd->run_mode, ATOMISP_RUN_MODE_STILL_CAPTURE); memset(&asd->params.css_param, 0, sizeof(asd->params.css_param)); asd->params.color_effect = V4L2_COLORFX_NONE; - asd->params.bad_pixel_en = 1; - asd->params.gdc_cac_en = 0; - asd->params.video_dis_en = 0; - asd->params.sc_en = 0; - asd->params.fpn_en = 0; - asd->params.xnr_en = 0; + asd->params.bad_pixel_en = true; + asd->params.gdc_cac_en = false; + asd->params.video_dis_en = false; + asd->params.sc_en = false; + asd->params.fpn_en = false; + asd->params.xnr_en = false; asd->params.false_color = 0; asd->params.online_process = 1; asd->params.yuv_ds_en = 0; diff --git a/drivers/staging/media/atomisp/pci/atomisp2/atomisp_ioctl.c b/drivers/staging/media/atomisp/pci/atomisp2/atomisp_ioctl.c index 5c84dd63778e..4222724347cc 100644 --- a/drivers/staging/media/atomisp/pci/atomisp2/atomisp_ioctl.c +++ b/drivers/staging/media/atomisp/pci/atomisp2/atomisp_ioctl.c @@ -2731,7 +2731,7 @@ static int atomisp_s_parm_file(struct file *file, void *fh, } rt_mutex_lock(&isp->mutex); - isp->sw_contex.file_input = 1; + isp->sw_contex.file_input = true; rt_mutex_unlock(&isp->mutex); return 0; diff --git a/drivers/staging/media/atomisp/pci/atomisp2/css2400/runtime/bufq/src/bufq.c b/drivers/staging/media/atomisp/pci/atomisp2/css2400/runtime/bufq/src/bufq.c index e50d9f2e2609..01d20b62a630 100644 --- a/drivers/staging/media/atomisp/pci/atomisp2/css2400/runtime/bufq/src/bufq.c +++ b/drivers/staging/media/atomisp/pci/atomisp2/css2400/runtime/bufq/src/bufq.c @@ -207,7 +207,7 @@ static void map_buffer_type_to_queue_id( } for (i = SH_CSS_QUEUE_C_ID; i < SH_CSS_MAX_NUM_QUEUES; i++) { - if (queue_availability[thread_id][i] == true) { + if (queue_availability[thread_id][i]) { queue_availability[thread_id][i] = false; buffer_type_to_queue_id_map[thread_id][buf_type] = i; break; diff --git a/drivers/staging/media/atomisp/pci/atomisp2/css2400/runtime/isys/src/isys_init.c b/drivers/staging/media/atomisp/pci/atomisp2/css2400/runtime/isys/src/isys_init.c index 4122084fd237..2ae5e59d5e31 100644 --- a/drivers/staging/media/atomisp/pci/atomisp2/css2400/runtime/isys/src/isys_init.c +++ b/drivers/staging/media/atomisp/pci/atomisp2/css2400/runtime/isys/src/isys_init.c @@ -105,8 +105,6 @@ input_system_error_t ia_css_isys_init(void) #elif defined(USE_INPUT_SYSTEM_VERSION_2401) input_system_error_t ia_css_isys_init(void) { - input_system_error_t error = INPUT_SYSTEM_ERR_NO_ERROR; - ia_css_isys_csi_rx_lut_rmgr_init(); ia_css_isys_ibuf_rmgr_init(); ia_css_isys_dma_channel_rmgr_init(); @@ -120,7 +118,7 @@ input_system_error_t ia_css_isys_init(void) isys_irqc_status_enable(ISYS_IRQ1_ID); isys_irqc_status_enable(ISYS_IRQ2_ID); - return error; + return INPUT_SYSTEM_ERR_NO_ERROR; } #endif diff --git a/drivers/staging/media/atomisp/pci/atomisp2/css2400/runtime/isys/src/virtual_isys.c b/drivers/staging/media/atomisp/pci/atomisp2/css2400/runtime/isys/src/virtual_isys.c index 90922a7acefd..2484949453b7 100644 --- a/drivers/staging/media/atomisp/pci/atomisp2/css2400/runtime/isys/src/virtual_isys.c +++ b/drivers/staging/media/atomisp/pci/atomisp2/css2400/runtime/isys/src/virtual_isys.c @@ -331,7 +331,7 @@ static bool create_input_system_channel( break; } - if (rc == false) + if (!rc) return false; if (!acquire_sid(me->stream2mmio_id, &(me->stream2mmio_sid_id))) { @@ -474,7 +474,7 @@ static bool calculate_input_system_channel_cfg( rc = calculate_stream2mmio_cfg(isys_cfg, metadata, &(channel_cfg->stream2mmio_cfg)); - if (rc == false) + if (!rc) return false; rc = calculate_ibuf_ctrl_cfg( @@ -482,7 +482,7 @@ static bool calculate_input_system_channel_cfg( input_port, isys_cfg, &(channel_cfg->ibuf_ctrl_cfg)); - if (rc == false) + if (!rc) return false; if (metadata) channel_cfg->ibuf_ctrl_cfg.stores_per_frame = isys_cfg->metadata.lines_per_frame; @@ -491,7 +491,7 @@ static bool calculate_input_system_channel_cfg( channel, isys_cfg, &(channel_cfg->dma_cfg)); - if (rc == false) + if (!rc) return false; rc = calculate_isys2401_dma_port_cfg( @@ -499,7 +499,7 @@ static bool calculate_input_system_channel_cfg( false, metadata, &(channel_cfg->dma_src_port_cfg)); - if (rc == false) + if (!rc) return false; rc = calculate_isys2401_dma_port_cfg( @@ -507,7 +507,7 @@ static bool calculate_input_system_channel_cfg( isys_cfg->raw_packed, metadata, &(channel_cfg->dma_dest_port_cfg)); - if (rc == false) + if (!rc) return false; return true; diff --git a/drivers/staging/media/atomisp/pci/atomisp2/css2400/runtime/pipeline/src/pipeline.c b/drivers/staging/media/atomisp/pci/atomisp2/css2400/runtime/pipeline/src/pipeline.c index 81a50c73ad0b..269829770082 100644 --- a/drivers/staging/media/atomisp/pci/atomisp2/css2400/runtime/pipeline/src/pipeline.c +++ b/drivers/staging/media/atomisp/pci/atomisp2/css2400/runtime/pipeline/src/pipeline.c @@ -574,7 +574,7 @@ static void pipeline_map_num_to_sp_thread(unsigned int pipe_num) But the below is more descriptive. */ - assert(found_sp_thread != false); + assert(found_sp_thread); } static void pipeline_unmap_num_to_sp_thread(unsigned int pipe_num) diff --git a/drivers/staging/media/atomisp/pci/atomisp2/css2400/sh_css.c b/drivers/staging/media/atomisp/pci/atomisp2/css2400/sh_css.c index 37116faab631..034437f8ca07 100644 --- a/drivers/staging/media/atomisp/pci/atomisp2/css2400/sh_css.c +++ b/drivers/staging/media/atomisp/pci/atomisp2/css2400/sh_css.c @@ -1082,7 +1082,7 @@ sh_css_config_input_network(struct ia_css_stream *stream) /* get the SP thread id */ rc = ia_css_pipeline_get_sp_thread_id(ia_css_pipe_get_pipe_num(pipe), &sp_thread_id); - if (rc != true) + if (!rc) return IA_CSS_ERR_INTERNAL_ERROR; /* get the target input terminal */ sp_pipeline_input_terminal = &(sh_css_sp_group.pipe_io[sp_thread_id].input); @@ -1108,7 +1108,7 @@ sh_css_config_input_network(struct ia_css_stream *stream) &(isys_stream_descr)); } - if (rc != true) + if (!rc) return IA_CSS_ERR_INTERNAL_ERROR; isys_stream_id = ia_css_isys_generate_stream_id(sp_thread_id, i); @@ -1118,7 +1118,7 @@ sh_css_config_input_network(struct ia_css_stream *stream) &(isys_stream_descr), &(sp_pipeline_input_terminal->context.virtual_input_system_stream[i]), isys_stream_id); - if (rc != true) + if (!rc) return IA_CSS_ERR_INTERNAL_ERROR; /* calculate the configuration of the virtual Input System (2401) */ @@ -1126,7 +1126,7 @@ sh_css_config_input_network(struct ia_css_stream *stream) &(sp_pipeline_input_terminal->context.virtual_input_system_stream[i]), &(isys_stream_descr), &(sp_pipeline_input_terminal->ctrl.virtual_input_system_stream_cfg[i])); - if (rc != true) { + if (!rc) { ia_css_isys_stream_destroy(&(sp_pipeline_input_terminal->context.virtual_input_system_stream[i])); return IA_CSS_ERR_INTERNAL_ERROR; } @@ -2562,7 +2562,7 @@ ia_css_uninit(void) ifmtr_set_if_blocking_mode_reset = true; #endif - if (fw_explicitly_loaded == false) { + if (!fw_explicitly_loaded) { ia_css_unload_firmware(); } ia_css_spctrl_unload_fw(SP0_ID); @@ -7739,7 +7739,7 @@ create_host_yuvpp_pipeline(struct ia_css_pipe *pipe) for (i = 0, j = 0; i < num_stage; i++) { assert(j < num_output_stage); - if (pipe->pipe_settings.yuvpp.is_output_stage[i] == true) { + if (pipe->pipe_settings.yuvpp.is_output_stage[i]) { tmp_out_frame = out_frame[j]; tmp_vf_frame = vf_frame[j]; } else { @@ -7758,7 +7758,7 @@ create_host_yuvpp_pipeline(struct ia_css_pipe *pipe) } /* we use output port 1 as internal output port */ tmp_in_frame = yuv_scaler_stage->args.out_frame[1]; - if (pipe->pipe_settings.yuvpp.is_output_stage[i] == true) { + if (pipe->pipe_settings.yuvpp.is_output_stage[i]) { if (tmp_vf_frame && (tmp_vf_frame->info.res.width != 0)) { in_frame = yuv_scaler_stage->args.out_vf_frame; err = add_vf_pp_stage(pipe, in_frame, tmp_vf_frame, &vf_pp_binary[j], @@ -8321,8 +8321,6 @@ sh_css_pipe_get_output_frame_info(struct ia_css_pipe *pipe, struct ia_css_frame_info *info, unsigned int idx) { - enum ia_css_err err = IA_CSS_SUCCESS; - assert(pipe != NULL); assert(info != NULL); @@ -8347,7 +8345,7 @@ sh_css_pipe_get_output_frame_info(struct ia_css_pipe *pipe, ia_css_debug_dtrace(IA_CSS_DEBUG_TRACE_PRIVATE, "sh_css_pipe_get_output_frame_info() leave:\n"); - return err; + return IA_CSS_SUCCESS; } #if !defined(HAS_NO_INPUT_SYSTEM) @@ -10218,8 +10216,6 @@ ia_css_stream_get_3a_binary(const struct ia_css_stream *stream) enum ia_css_err ia_css_stream_set_output_padded_width(struct ia_css_stream *stream, unsigned int output_padded_width) { - enum ia_css_err err = IA_CSS_SUCCESS; - struct ia_css_pipe *pipe; assert(stream != NULL); @@ -10232,7 +10228,7 @@ ia_css_stream_set_output_padded_width(struct ia_css_stream *stream, unsigned int pipe->config.output_info[IA_CSS_PIPE_OUTPUT_STAGE_0].padded_width = output_padded_width; pipe->output_info[IA_CSS_PIPE_OUTPUT_STAGE_0].padded_width = output_padded_width; - return err; + return IA_CSS_SUCCESS; } static struct ia_css_binary * @@ -10734,7 +10730,7 @@ ia_css_pipe_set_qos_ext_state(struct ia_css_pipe *pipe, uint32_t fw_handle, bool (uint8_t) IA_CSS_PSYS_SW_EVENT_STAGE_ENABLE_DISABLE, (uint8_t) thread_id, (uint8_t) stage->stage_num, - (enable == true) ? 1 : 0); + enable ? 1 : 0); if (err == IA_CSS_SUCCESS) { if(enable) SH_CSS_QOS_STAGE_ENABLE(&(sh_css_sp_group.pipe[thread_id]),stage->stage_num); @@ -11059,7 +11055,7 @@ static struct sh_css_hmm_buffer_record buffer_record = &hmm_buffer_record[0]; for (i = 0; i < MAX_HMM_BUFFER_NUM; i++) { - if (buffer_record->in_use == false) { + if (!buffer_record->in_use) { buffer_record->in_use = true; buffer_record->type = type; buffer_record->h_vbuf = h_vbuf; @@ -11083,7 +11079,7 @@ static struct sh_css_hmm_buffer_record buffer_record = &hmm_buffer_record[0]; for (i = 0; i < MAX_HMM_BUFFER_NUM; i++) { - if ((buffer_record->in_use == true) && + if ((buffer_record->in_use) && (buffer_record->type == type) && (buffer_record->h_vbuf != NULL) && (buffer_record->h_vbuf->vptr == ddr_buffer_addr)) { @@ -11093,7 +11089,7 @@ static struct sh_css_hmm_buffer_record buffer_record++; } - if (found_record == true) + if (found_record) return buffer_record; else return NULL; diff --git a/drivers/staging/media/atomisp/pci/atomisp2/css2400/sh_css_sp.c b/drivers/staging/media/atomisp/pci/atomisp2/css2400/sh_css_sp.c index 6fc00fc402b1..9c6330783358 100644 --- a/drivers/staging/media/atomisp/pci/atomisp2/css2400/sh_css_sp.c +++ b/drivers/staging/media/atomisp/pci/atomisp2/css2400/sh_css_sp.c @@ -817,7 +817,6 @@ configure_isp_from_args( bool two_ppc, bool deinterleaved) { - enum ia_css_err err = IA_CSS_SUCCESS; #ifdef ISP2401 struct ia_css_pipe *pipe = find_pipe_by_num(pipeline->pipe_num); const struct ia_css_resolution *res; @@ -841,7 +840,7 @@ configure_isp_from_args( ia_css_ref_configure(binary, (const struct ia_css_frame **)args->delay_frames, pipeline->dvs_frame_delay); ia_css_tnr_configure(binary, (const struct ia_css_frame **)args->tnr_frames); ia_css_bayer_io_config(binary, args); - return err; + return IA_CSS_SUCCESS; } static void From a0891a6e8ea63c382e0a1afc0d49197cf75aaf59 Mon Sep 17 00:00:00 2001 From: Mauro Carvalho Chehab Date: Mon, 26 Mar 2018 10:16:07 -0400 Subject: [PATCH 29/48] media: staging: atomisp: ia_css_output.host: don't use var before check Fix this warning: drivers/staging/media/atomisp/pci/atomisp2/css2400/isp/kernels/output/output_1.0/ia_css_output.host.c:64 ia_css_output_config() warn: variable dereferenced before check 'from->info' (see line 63) Acked-by: Sakari Ailus Signed-off-by: Mauro Carvalho Chehab --- .../css2400/isp/kernels/output/output_1.0/ia_css_output.host.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/drivers/staging/media/atomisp/pci/atomisp2/css2400/isp/kernels/output/output_1.0/ia_css_output.host.c b/drivers/staging/media/atomisp/pci/atomisp2/css2400/isp/kernels/output/output_1.0/ia_css_output.host.c index 8fdf47c9310c..9efe5e5e4e06 100644 --- a/drivers/staging/media/atomisp/pci/atomisp2/css2400/isp/kernels/output/output_1.0/ia_css_output.host.c +++ b/drivers/staging/media/atomisp/pci/atomisp2/css2400/isp/kernels/output/output_1.0/ia_css_output.host.c @@ -60,7 +60,7 @@ ia_css_output_config( (void)size; ia_css_dma_configure_from_info(&to->port_b, from->info); to->width_a_over_b = elems_a / to->port_b.elems; - to->height = from->info->res.height; + to->height = from->info ? from->info->res.height : 0; to->enable = from->info != NULL; ia_css_frame_info_to_frame_sp_info(&to->info, from->info); From 893311298a96c18b7a4a28c111cf9edf8fa27fed Mon Sep 17 00:00:00 2001 From: Mauro Carvalho Chehab Date: Mon, 26 Mar 2018 10:27:10 -0400 Subject: [PATCH 30/48] media: staging: atomisp: declare static vars as such Fix a bunch of warnings: drivers/staging/media/atomisp/pci/atomisp2/css2400/runtime/bufq/src/bufq.c:93:23: warning: symbol 'css_queues' was not declared. Should it be static? drivers/staging/media/atomisp/pci/atomisp2/css2400/runtime/rmgr/src/rmgr_vbuf.c:27:32: warning: symbol 'handle_table' was not declared. Should it be static? drivers/staging/media/atomisp/pci/atomisp2/css2400/runtime/rmgr/src/rmgr_vbuf.c:32:30: warning: symbol 'refpool' was not declared. Should it be static? drivers/staging/media/atomisp/pci/atomisp2/css2400/runtime/rmgr/src/rmgr_vbuf.c:43:30: warning: symbol 'writepool' was not declared. Should it be static? drivers/staging/media/atomisp/pci/atomisp2/css2400/runtime/rmgr/src/rmgr_vbuf.c:54:30: warning: symbol 'hmmbufferpool' was not declared. Should it be static? drivers/staging/media/atomisp/pci/atomisp2/css2400/hive_isp_css_common/host/input_formatter.c:48:12: warning: symbol 'HIVE_IF_BIN_COPY' was not declared. Should it be static? drivers/staging/media/atomisp/pci/atomisp2/css2400/hive_isp_css_common/host/gp_timer.c:33:1: warning: symbol 'gp_timer_reg_load' was not declared. Should it be static? drivers/staging/media/atomisp/pci/atomisp2/css2400/sh_css_sp.c:74:33: warning: symbol 'sh_css_sp_output' was not declared. Should it be static? drivers/staging/media/atomisp/pci/atomisp2/css2400/hive_isp_css_common/host/debug.c:32:25: warning: symbol 'debug_data' was not declared. Should it be static? drivers/staging/media/atomisp/pci/atomisp2/css2400/hive_isp_css_common/host/input_system.c:32:21: warning: symbol 'IB_BUFFER_NULL' was not declared. Should it be static? drivers/staging/media/atomisp/pci/atomisp2/css2400/hive_isp_css_common/host/input_system.c:647:24: warning: symbol 'config' was not declared. Should it be static? drivers/staging/media/atomisp/pci/atomisp2/css2400/sh_css_params.c:2894:10: warning: symbol 'g_param_buffer_dequeue_count' was not declared. Should it be static? drivers/staging/media/atomisp/pci/atomisp2/css2400/sh_css_params.c:2895:10: warning: symbol 'g_param_buffer_enqueue_count' was not declared. Should it be static? Acked-by: Sakari Ailus Signed-off-by: Mauro Carvalho Chehab --- .../pci/atomisp2/css2400/hive_isp_css_common/host/debug.c | 2 +- .../atomisp2/css2400/hive_isp_css_common/host/gp_timer.c | 2 +- .../css2400/hive_isp_css_common/host/input_system.c | 4 ++-- .../atomisp/pci/atomisp2/css2400/runtime/bufq/src/bufq.c | 7 +++---- .../pci/atomisp2/css2400/runtime/rmgr/src/rmgr_vbuf.c | 8 ++++---- .../media/atomisp/pci/atomisp2/css2400/sh_css_params.c | 6 +++--- 6 files changed, 14 insertions(+), 15 deletions(-) diff --git a/drivers/staging/media/atomisp/pci/atomisp2/css2400/hive_isp_css_common/host/debug.c b/drivers/staging/media/atomisp/pci/atomisp2/css2400/hive_isp_css_common/host/debug.c index c412810887b3..dcb9a3127cfe 100644 --- a/drivers/staging/media/atomisp/pci/atomisp2/css2400/hive_isp_css_common/host/debug.c +++ b/drivers/staging/media/atomisp/pci/atomisp2/css2400/hive_isp_css_common/host/debug.c @@ -29,7 +29,7 @@ hrt_address debug_buffer_address = (hrt_address)-1; hrt_vaddress debug_buffer_ddr_address = (hrt_vaddress)-1; /* The local copy */ -debug_data_t debug_data; +static debug_data_t debug_data; debug_data_t *debug_data_ptr = &debug_data; void debug_buffer_init(const hrt_address addr) diff --git a/drivers/staging/media/atomisp/pci/atomisp2/css2400/hive_isp_css_common/host/gp_timer.c b/drivers/staging/media/atomisp/pci/atomisp2/css2400/hive_isp_css_common/host/gp_timer.c index bcfd443f5202..b6b1344786b1 100644 --- a/drivers/staging/media/atomisp/pci/atomisp2/css2400/hive_isp_css_common/host/gp_timer.c +++ b/drivers/staging/media/atomisp/pci/atomisp2/css2400/hive_isp_css_common/host/gp_timer.c @@ -29,7 +29,7 @@ gp_timer_reg_load(uint32_t reg); static void gp_timer_reg_store(uint32_t reg, uint32_t value); -uint32_t +static uint32_t gp_timer_reg_load(uint32_t reg) { return ia_css_device_load_uint32( diff --git a/drivers/staging/media/atomisp/pci/atomisp2/css2400/hive_isp_css_common/host/input_system.c b/drivers/staging/media/atomisp/pci/atomisp2/css2400/hive_isp_css_common/host/input_system.c index bd6821e436b2..c9cb8e0621e5 100644 --- a/drivers/staging/media/atomisp/pci/atomisp2/css2400/hive_isp_css_common/host/input_system.c +++ b/drivers/staging/media/atomisp/pci/atomisp2/css2400/hive_isp_css_common/host/input_system.c @@ -29,7 +29,7 @@ #define ZERO (0x0) #define ONE (1U) -const ib_buffer_t IB_BUFFER_NULL = {0 ,0, 0 }; +static const ib_buffer_t IB_BUFFER_NULL = {0 ,0, 0 }; static input_system_error_t input_system_configure_channel( const channel_cfg_t channel); @@ -644,7 +644,7 @@ static inline void rx_channel_get_state( } // MW: "2400" in the name is not good, but this is to avoid a naming conflict -input_system_cfg2400_t config; +static input_system_cfg2400_t config; static void receiver_rst( const rx_ID_t ID) diff --git a/drivers/staging/media/atomisp/pci/atomisp2/css2400/runtime/bufq/src/bufq.c b/drivers/staging/media/atomisp/pci/atomisp2/css2400/runtime/bufq/src/bufq.c index 01d20b62a630..ffbcdd80d934 100644 --- a/drivers/staging/media/atomisp/pci/atomisp2/css2400/runtime/bufq/src/bufq.c +++ b/drivers/staging/media/atomisp/pci/atomisp2/css2400/runtime/bufq/src/bufq.c @@ -90,12 +90,11 @@ struct sh_css_queues { #endif -struct sh_css_queues css_queues; - - /******************************************************* *** Static variables ********************************************************/ +static struct sh_css_queues css_queues; + static int buffer_type_to_queue_id_map[SH_CSS_MAX_SP_THREADS][IA_CSS_NUM_DYNAMIC_BUFFER_TYPE]; static bool queue_availability[SH_CSS_MAX_SP_THREADS][SH_CSS_MAX_NUM_QUEUES]; @@ -266,7 +265,7 @@ static ia_css_queue_t *bufq_get_qhandle( case sh_css_sp2host_isys_event_queue: q = &css_queues.sp2host_isys_event_queue_handle; break; -#endif +#endif case sh_css_host2sp_tag_cmd_queue: q = &css_queues.host2sp_tag_cmd_queue_handle; break; diff --git a/drivers/staging/media/atomisp/pci/atomisp2/css2400/runtime/rmgr/src/rmgr_vbuf.c b/drivers/staging/media/atomisp/pci/atomisp2/css2400/runtime/rmgr/src/rmgr_vbuf.c index 54239ac9d7c9..a4d8a48f95ba 100644 --- a/drivers/staging/media/atomisp/pci/atomisp2/css2400/runtime/rmgr/src/rmgr_vbuf.c +++ b/drivers/staging/media/atomisp/pci/atomisp2/css2400/runtime/rmgr/src/rmgr_vbuf.c @@ -24,12 +24,12 @@ * @brief VBUF resource handles */ #define NUM_HANDLES 1000 -struct ia_css_rmgr_vbuf_handle handle_table[NUM_HANDLES]; +static struct ia_css_rmgr_vbuf_handle handle_table[NUM_HANDLES]; /* * @brief VBUF resource pool - refpool */ -struct ia_css_rmgr_vbuf_pool refpool = { +static struct ia_css_rmgr_vbuf_pool refpool = { false, /* copy_on_write */ false, /* recycle */ 0, /* size */ @@ -40,7 +40,7 @@ struct ia_css_rmgr_vbuf_pool refpool = { /* * @brief VBUF resource pool - writepool */ -struct ia_css_rmgr_vbuf_pool writepool = { +static struct ia_css_rmgr_vbuf_pool writepool = { true, /* copy_on_write */ false, /* recycle */ 0, /* size */ @@ -51,7 +51,7 @@ struct ia_css_rmgr_vbuf_pool writepool = { /* * @brief VBUF resource pool - hmmbufferpool */ -struct ia_css_rmgr_vbuf_pool hmmbufferpool = { +static struct ia_css_rmgr_vbuf_pool hmmbufferpool = { true, /* copy_on_write */ true, /* recycle */ 32, /* size */ diff --git a/drivers/staging/media/atomisp/pci/atomisp2/css2400/sh_css_params.c b/drivers/staging/media/atomisp/pci/atomisp2/css2400/sh_css_params.c index fbb36112fe3c..3c0e8f66f59a 100644 --- a/drivers/staging/media/atomisp/pci/atomisp2/css2400/sh_css_params.c +++ b/drivers/staging/media/atomisp/pci/atomisp2/css2400/sh_css_params.c @@ -110,7 +110,7 @@ #define FPNTBL_BYTES(binary) \ (sizeof(char) * (binary)->in_frame_info.res.height * \ (binary)->in_frame_info.padded_width) - + #ifndef ISP2401 #define SCTBL_BYTES(binary) \ @@ -2891,8 +2891,8 @@ ia_css_metadata_free_multiple(unsigned int num_bufs, struct ia_css_metadata **bu } } -unsigned g_param_buffer_dequeue_count = 0; -unsigned g_param_buffer_enqueue_count = 0; +static unsigned g_param_buffer_dequeue_count = 0; +static unsigned g_param_buffer_enqueue_count = 0; enum ia_css_err ia_css_stream_isp_parameters_init(struct ia_css_stream *stream) From b2fc77bc1bcbe856a9cbfd6d2ed2a953d4e6d3a8 Mon Sep 17 00:00:00 2001 From: Mauro Carvalho Chehab Date: Mon, 26 Mar 2018 10:30:21 -0400 Subject: [PATCH 31/48] media: staging: atomisp: get rid of stupid statements It makes no sense to have a do nothing statement like: (void)stage; Fix those warnings: drivers/staging/media/atomisp/pci/atomisp2/css2400/sh_css_params.c:3808 sh_css_param_update_isp_params() error: uninitialized symbol 'stage'. drivers/staging/media/atomisp/pci/atomisp2/css2400/sh_css_sp.c:1444 sh_css_update_host2sp_offline_frame() error: uninitialized symbol 'HIVE_ADDR_host_sp_com'. drivers/staging/media/atomisp/pci/atomisp2/css2400/sh_css_sp.c:1475 sh_css_update_host2sp_mipi_frame() error: uninitialized symbol 'HIVE_ADDR_host_sp_com'. drivers/staging/media/atomisp/pci/atomisp2/css2400/sh_css_sp.c:1502 sh_css_update_host2sp_mipi_metadata() error: uninitialized symbol 'HIVE_ADDR_host_sp_com'. drivers/staging/media/atomisp/pci/atomisp2/css2400/sh_css_sp.c:1522 sh_css_update_host2sp_num_mipi_frames() error: uninitialized symbol 'HIVE_ADDR_host_sp_com'. drivers/staging/media/atomisp/pci/atomisp2/css2400/sh_css_sp.c:1541 sh_css_update_host2sp_cont_num_raw_frames() error: uninitialized symbol 'HIVE_ADDR_host_sp_com'. Acked-by: Sakari Ailus Signed-off-by: Mauro Carvalho Chehab --- .../media/atomisp/pci/atomisp2/css2400/sh_css.c | 1 - .../atomisp/pci/atomisp2/css2400/sh_css_params.c | 1 - .../atomisp/pci/atomisp2/css2400/sh_css_sp.c | 16 +++------------- 3 files changed, 3 insertions(+), 15 deletions(-) diff --git a/drivers/staging/media/atomisp/pci/atomisp2/css2400/sh_css.c b/drivers/staging/media/atomisp/pci/atomisp2/css2400/sh_css.c index 034437f8ca07..9958b275bd50 100644 --- a/drivers/staging/media/atomisp/pci/atomisp2/css2400/sh_css.c +++ b/drivers/staging/media/atomisp/pci/atomisp2/css2400/sh_css.c @@ -8082,7 +8082,6 @@ create_host_regular_capture_pipeline(struct ia_css_pipe *pipe) return err; } } - (void)frm; /* If we use copy iso primary, the input must be yuv iso raw */ current_stage->args.copy_vf = diff --git a/drivers/staging/media/atomisp/pci/atomisp2/css2400/sh_css_params.c b/drivers/staging/media/atomisp/pci/atomisp2/css2400/sh_css_params.c index 3c0e8f66f59a..ba2b96e330d0 100644 --- a/drivers/staging/media/atomisp/pci/atomisp2/css2400/sh_css_params.c +++ b/drivers/staging/media/atomisp/pci/atomisp2/css2400/sh_css_params.c @@ -3805,7 +3805,6 @@ sh_css_param_update_isp_params(struct ia_css_pipe *curr_pipe, enum sh_css_queue_id queue_id; - (void)stage; pipe = curr_pipe->stream->pipes[i]; pipeline = ia_css_pipe_get_pipeline(pipe); pipe_num = ia_css_pipe_get_pipe_num(pipe); diff --git a/drivers/staging/media/atomisp/pci/atomisp2/css2400/sh_css_sp.c b/drivers/staging/media/atomisp/pci/atomisp2/css2400/sh_css_sp.c index 9c6330783358..bb297184ba3a 100644 --- a/drivers/staging/media/atomisp/pci/atomisp2/css2400/sh_css_sp.c +++ b/drivers/staging/media/atomisp/pci/atomisp2/css2400/sh_css_sp.c @@ -71,7 +71,7 @@ struct sh_css_sp_group sh_css_sp_group; struct sh_css_sp_stage sh_css_sp_stage; struct sh_css_isp_stage sh_css_isp_stage; -struct sh_css_sp_output sh_css_sp_output; +static struct sh_css_sp_output sh_css_sp_output; static struct sh_css_sp_per_frame_data per_frame_data; /* true if SP supports frame loop and host2sp_commands */ @@ -117,9 +117,9 @@ copy_isp_stage_to_sp_stage(void) */ sh_css_sp_stage.enable.sdis = sh_css_isp_stage.binary_info.enable.dis; sh_css_sp_stage.enable.s3a = sh_css_isp_stage.binary_info.enable.s3a; -#ifdef ISP2401 +#ifdef ISP2401 sh_css_sp_stage.enable.lace_stats = sh_css_isp_stage.binary_info.enable.lace_stats; -#endif +#endif } void @@ -1441,8 +1441,6 @@ sh_css_update_host2sp_offline_frame( unsigned int HIVE_ADDR_host_sp_com; unsigned int offset; - (void)HIVE_ADDR_host_sp_com; /* Suppres warnings in CRUN */ - assert(frame_num < NUM_CONTINUOUS_FRAMES); /* Write new frame data into SP DMEM */ @@ -1472,8 +1470,6 @@ sh_css_update_host2sp_mipi_frame( unsigned int HIVE_ADDR_host_sp_com; unsigned int offset; - (void)HIVE_ADDR_host_sp_com; /* Suppres warnings in CRUN */ - /* MIPI buffers are dedicated to port, so now there are more of them. */ assert(frame_num < (N_CSI_PORTS * NUM_MIPI_FRAMES_PER_STREAM)); @@ -1499,8 +1495,6 @@ sh_css_update_host2sp_mipi_metadata( unsigned int HIVE_ADDR_host_sp_com; unsigned int o; - (void)HIVE_ADDR_host_sp_com; /* Suppres warnings in CRUN */ - /* MIPI buffers are dedicated to port, so now there are more of them. */ assert(frame_num < (N_CSI_PORTS * NUM_MIPI_FRAMES_PER_STREAM)); @@ -1519,8 +1513,6 @@ sh_css_update_host2sp_num_mipi_frames(unsigned num_frames) unsigned int HIVE_ADDR_host_sp_com; unsigned int offset; - (void)HIVE_ADDR_host_sp_com; /* Suppres warnings in CRUN */ - /* Write new frame data into SP DMEM */ HIVE_ADDR_host_sp_com = sh_css_sp_fw.info.sp.host_sp_com; offset = (unsigned int)offsetof(struct host_sp_communication, host2sp_num_mipi_frames) @@ -1538,8 +1530,6 @@ sh_css_update_host2sp_cont_num_raw_frames(unsigned num_frames, bool set_avail) unsigned int extra_num_frames, avail_num_frames; unsigned int offset, offset_extra; - (void)HIVE_ADDR_host_sp_com; /* Suppres warnings in CRUN */ - /* Write new frame data into SP DMEM */ fw = &sh_css_sp_fw; HIVE_ADDR_host_sp_com = fw->info.sp.host_sp_com; From c3a9880f53c4822de8d88eae63d9eb1721660812 Mon Sep 17 00:00:00 2001 From: Mauro Carvalho Chehab Date: Mon, 26 Mar 2018 11:00:05 -0400 Subject: [PATCH 32/48] media: staging: atomisp: add a missing include atomisp_drvfs.c is not including its own header, causing those warnings: drivers/staging/media/atomisp/pci/atomisp2/atomisp_drvfs.c:185:5: warning: symbol 'atomisp_drvfs_init' was not declared. Should it be static? drivers/staging/media/atomisp/pci/atomisp2/atomisp_drvfs.c:201:6: warning: symbol 'atomisp_drvfs_exit' was not declared. Should it be static? Acked-by: Sakari Ailus Signed-off-by: Mauro Carvalho Chehab --- drivers/staging/media/atomisp/pci/atomisp2/atomisp_drvfs.c | 1 + 1 file changed, 1 insertion(+) diff --git a/drivers/staging/media/atomisp/pci/atomisp2/atomisp_drvfs.c b/drivers/staging/media/atomisp/pci/atomisp2/atomisp_drvfs.c index ceedb82b6beb..a815c768bda9 100644 --- a/drivers/staging/media/atomisp/pci/atomisp2/atomisp_drvfs.c +++ b/drivers/staging/media/atomisp/pci/atomisp2/atomisp_drvfs.c @@ -22,6 +22,7 @@ #include "atomisp_compat.h" #include "atomisp_internal.h" #include "atomisp_ioctl.h" +#include "atomisp_drvfs.h" #include "hmm/hmm.h" /* From f10127cd63b39ae01c1c7d4d91edda51d091b56a Mon Sep 17 00:00:00 2001 From: Mauro Carvalho Chehab Date: Mon, 26 Mar 2018 11:51:18 -0400 Subject: [PATCH 33/48] media: staging: atomisp: fix endianess issues There are lots of be-related warnings there, as it doesn't properly mark what data uses bigendian. Warnings fixed: drivers/staging/media/atomisp/i2c/atomisp-mt9m114.c:134:15: warning: incorrect type in assignment (different base types) drivers/staging/media/atomisp/i2c/atomisp-mt9m114.c:134:15: expected unsigned short [unsigned] [short] [usertype] drivers/staging/media/atomisp/i2c/atomisp-mt9m114.c:134:15: got restricted __be16 [usertype] drivers/staging/media/atomisp/i2c/atomisp-mt9m114.c:140:26: warning: cast to restricted __be16 drivers/staging/media/atomisp/i2c/atomisp-mt9m114.c:140:26: warning: cast to restricted __be16 drivers/staging/media/atomisp/i2c/atomisp-mt9m114.c:140:26: warning: cast to restricted __be16 drivers/staging/media/atomisp/i2c/atomisp-mt9m114.c:140:26: warning: cast to restricted __be16 drivers/staging/media/atomisp/i2c/atomisp-mt9m114.c:144:26: warning: cast to restricted __be32 drivers/staging/media/atomisp/i2c/atomisp-mt9m114.c:144:26: warning: cast to restricted __be32 drivers/staging/media/atomisp/i2c/atomisp-mt9m114.c:144:26: warning: cast to restricted __be32 drivers/staging/media/atomisp/i2c/atomisp-mt9m114.c:144:26: warning: cast to restricted __be32 drivers/staging/media/atomisp/i2c/atomisp-mt9m114.c:144:26: warning: cast to restricted __be32 drivers/staging/media/atomisp/i2c/atomisp-mt9m114.c:144:26: warning: cast to restricted __be32 drivers/staging/media/atomisp/i2c/atomisp-mt9m114.c:256:27: warning: incorrect type in assignment (different base types) drivers/staging/media/atomisp/i2c/atomisp-mt9m114.c:256:27: expected unsigned short [unsigned] [usertype] addr drivers/staging/media/atomisp/i2c/atomisp-mt9m114.c:256:27: got restricted __be16 [usertype] drivers/staging/media/atomisp/i2c/atomisp-mt9m114.c:302:25: warning: incorrect type in assignment (different base types) drivers/staging/media/atomisp/i2c/atomisp-mt9m114.c:302:25: expected unsigned short [unsigned] [short] [usertype] drivers/staging/media/atomisp/i2c/atomisp-mt9m114.c:302:25: got restricted __be16 [usertype] drivers/staging/media/atomisp/i2c/atomisp-mt9m114.c:306:25: warning: incorrect type in assignment (different base types) drivers/staging/media/atomisp/i2c/atomisp-mt9m114.c:306:25: expected unsigned int [unsigned] [usertype] drivers/staging/media/atomisp/i2c/atomisp-mt9m114.c:306:25: got restricted __be32 [usertype] drivers/staging/media/atomisp/i2c/atomisp-ov2680.c:97:24: warning: cast to restricted __be16 drivers/staging/media/atomisp/i2c/atomisp-ov2680.c:97:24: warning: cast to restricted __be16 drivers/staging/media/atomisp/i2c/atomisp-ov2680.c:97:24: warning: cast to restricted __be16 drivers/staging/media/atomisp/i2c/atomisp-ov2680.c:97:24: warning: cast to restricted __be16 drivers/staging/media/atomisp/i2c/atomisp-ov2680.c:99:24: warning: cast to restricted __be32 drivers/staging/media/atomisp/i2c/atomisp-ov2680.c:99:24: warning: cast to restricted __be32 drivers/staging/media/atomisp/i2c/atomisp-ov2680.c:99:24: warning: cast to restricted __be32 drivers/staging/media/atomisp/i2c/atomisp-ov2680.c:99:24: warning: cast to restricted __be32 drivers/staging/media/atomisp/i2c/atomisp-ov2680.c:99:24: warning: cast to restricted __be32 drivers/staging/media/atomisp/i2c/atomisp-ov2680.c:99:24: warning: cast to restricted __be32 drivers/staging/media/atomisp/i2c/atomisp-ov2680.c:134:15: warning: incorrect type in assignment (different base types) drivers/staging/media/atomisp/i2c/atomisp-ov2680.c:134:15: expected unsigned short [unsigned] [short] [usertype] drivers/staging/media/atomisp/i2c/atomisp-ov2680.c:134:15: got restricted __be16 [usertype] drivers/staging/media/atomisp/i2c/atomisp-ov2680.c:141:24: warning: incorrect type in assignment (different base types) drivers/staging/media/atomisp/i2c/atomisp-ov2680.c:141:24: expected unsigned short [unsigned] [short] [usertype] drivers/staging/media/atomisp/i2c/atomisp-ov2680.c:141:24: got restricted __be16 [usertype] drivers/staging/media/atomisp/i2c/atomisp-ov2680.c:177:27: warning: incorrect type in assignment (different base types) drivers/staging/media/atomisp/i2c/atomisp-ov2680.c:177:27: expected unsigned short [unsigned] [usertype] addr drivers/staging/media/atomisp/i2c/atomisp-ov2680.c:177:27: got restricted __be16 [usertype] drivers/staging/media/atomisp/i2c/atomisp-ov2680.c:198:25: warning: incorrect type in assignment (different base types) drivers/staging/media/atomisp/i2c/atomisp-ov2680.c:198:25: expected unsigned short [unsigned] [short] [usertype] drivers/staging/media/atomisp/i2c/atomisp-ov2680.c:198:25: got restricted __be16 [usertype] drivers/staging/media/atomisp/i2c/atomisp-ov2722.c:88:24: warning: cast to restricted __be16 drivers/staging/media/atomisp/i2c/atomisp-ov2722.c:88:24: warning: cast to restricted __be16 drivers/staging/media/atomisp/i2c/atomisp-ov2722.c:88:24: warning: cast to restricted __be16 drivers/staging/media/atomisp/i2c/atomisp-ov2722.c:88:24: warning: cast to restricted __be16 drivers/staging/media/atomisp/i2c/atomisp-ov2722.c:90:24: warning: cast to restricted __be32 drivers/staging/media/atomisp/i2c/atomisp-ov2722.c:90:24: warning: cast to restricted __be32 drivers/staging/media/atomisp/i2c/atomisp-ov2722.c:90:24: warning: cast to restricted __be32 drivers/staging/media/atomisp/i2c/atomisp-ov2722.c:90:24: warning: cast to restricted __be32 drivers/staging/media/atomisp/i2c/atomisp-ov2722.c:90:24: warning: cast to restricted __be32 drivers/staging/media/atomisp/i2c/atomisp-ov2722.c:90:24: warning: cast to restricted __be32 drivers/staging/media/atomisp/i2c/atomisp-ov2722.c:125:15: warning: incorrect type in assignment (different base types) drivers/staging/media/atomisp/i2c/atomisp-ov2722.c:125:15: expected unsigned short [unsigned] [short] [usertype] drivers/staging/media/atomisp/i2c/atomisp-ov2722.c:125:15: got restricted __be16 [usertype] drivers/staging/media/atomisp/i2c/atomisp-ov2722.c:132:24: warning: incorrect type in assignment (different base types) drivers/staging/media/atomisp/i2c/atomisp-ov2722.c:132:24: expected unsigned short [unsigned] [short] [usertype] drivers/staging/media/atomisp/i2c/atomisp-ov2722.c:132:24: got restricted __be16 [usertype] drivers/staging/media/atomisp/i2c/atomisp-ov2722.c:168:27: warning: incorrect type in assignment (different base types) drivers/staging/media/atomisp/i2c/atomisp-ov2722.c:168:27: expected unsigned short [unsigned] [usertype] addr drivers/staging/media/atomisp/i2c/atomisp-ov2722.c:168:27: got restricted __be16 [usertype] drivers/staging/media/atomisp/i2c/atomisp-ov2722.c:189:25: warning: incorrect type in assignment (different base types) drivers/staging/media/atomisp/i2c/atomisp-ov2722.c:189:25: expected unsigned short [unsigned] [short] [usertype] drivers/staging/media/atomisp/i2c/atomisp-ov2722.c:189:25: got restricted __be16 [usertype] drivers/staging/media/atomisp/i2c/ov5693/atomisp-ov5693.c:176:24: warning: cast to restricted __be16 drivers/staging/media/atomisp/i2c/ov5693/atomisp-ov5693.c:176:24: warning: cast to restricted __be16 drivers/staging/media/atomisp/i2c/ov5693/atomisp-ov5693.c:176:24: warning: cast to restricted __be16 drivers/staging/media/atomisp/i2c/ov5693/atomisp-ov5693.c:176:24: warning: cast to restricted __be16 drivers/staging/media/atomisp/i2c/ov5693/atomisp-ov5693.c:178:24: warning: cast to restricted __be32 drivers/staging/media/atomisp/i2c/ov5693/atomisp-ov5693.c:178:24: warning: cast to restricted __be32 drivers/staging/media/atomisp/i2c/ov5693/atomisp-ov5693.c:178:24: warning: cast to restricted __be32 drivers/staging/media/atomisp/i2c/ov5693/atomisp-ov5693.c:178:24: warning: cast to restricted __be32 drivers/staging/media/atomisp/i2c/ov5693/atomisp-ov5693.c:178:24: warning: cast to restricted __be32 drivers/staging/media/atomisp/i2c/ov5693/atomisp-ov5693.c:178:24: warning: cast to restricted __be32 drivers/staging/media/atomisp/i2c/ov5693/atomisp-ov5693.c:205:13: warning: incorrect type in assignment (different base types) drivers/staging/media/atomisp/i2c/ov5693/atomisp-ov5693.c:205:13: expected unsigned short [unsigned] [usertype] val drivers/staging/media/atomisp/i2c/ov5693/atomisp-ov5693.c:205:13: got restricted __be16 [usertype] drivers/staging/media/atomisp/i2c/ov5693/atomisp-ov5693.c:276:15: warning: incorrect type in assignment (different base types) drivers/staging/media/atomisp/i2c/ov5693/atomisp-ov5693.c:276:15: expected unsigned short [unsigned] [short] [usertype] drivers/staging/media/atomisp/i2c/ov5693/atomisp-ov5693.c:276:15: got restricted __be16 [usertype] drivers/staging/media/atomisp/i2c/ov5693/atomisp-ov5693.c:283:24: warning: incorrect type in assignment (different base types) drivers/staging/media/atomisp/i2c/ov5693/atomisp-ov5693.c:283:24: expected unsigned short [unsigned] [short] [usertype] drivers/staging/media/atomisp/i2c/ov5693/atomisp-ov5693.c:283:24: got restricted __be16 [usertype] drivers/staging/media/atomisp/i2c/ov5693/atomisp-ov5693.c:319:27: warning: incorrect type in assignment (different base types) drivers/staging/media/atomisp/i2c/ov5693/atomisp-ov5693.c:319:27: expected unsigned short [unsigned] [usertype] addr drivers/staging/media/atomisp/i2c/ov5693/atomisp-ov5693.c:319:27: got restricted __be16 [usertype] drivers/staging/media/atomisp/i2c/ov5693/atomisp-ov5693.c:340:25: warning: incorrect type in assignment (different base types) drivers/staging/media/atomisp/i2c/ov5693/atomisp-ov5693.c:340:25: expected unsigned short [unsigned] [short] [usertype] drivers/staging/media/atomisp/i2c/ov5693/atomisp-ov5693.c:340:25: got restricted __be16 [usertype] Acked-by: Sakari Ailus Signed-off-by: Mauro Carvalho Chehab --- .../media/atomisp/i2c/atomisp-mt9m114.c | 25 +++++++++++-------- .../media/atomisp/i2c/atomisp-ov2680.c | 16 ++++++------ .../media/atomisp/i2c/atomisp-ov2722.c | 16 ++++++------ .../media/atomisp/i2c/ov5693/atomisp-ov5693.c | 24 ++++++++++-------- 4 files changed, 46 insertions(+), 35 deletions(-) diff --git a/drivers/staging/media/atomisp/i2c/atomisp-mt9m114.c b/drivers/staging/media/atomisp/i2c/atomisp-mt9m114.c index 834fba8c4fa0..44db9f9f1fc5 100644 --- a/drivers/staging/media/atomisp/i2c/atomisp-mt9m114.c +++ b/drivers/staging/media/atomisp/i2c/atomisp-mt9m114.c @@ -107,7 +107,7 @@ mt9m114_write_reg(struct i2c_client *client, u16 data_length, u16 reg, u32 val) int num_msg; struct i2c_msg msg; unsigned char data[6] = {0}; - u16 *wreg; + __be16 *wreg; int retry = 0; if (!client->adapter) { @@ -130,18 +130,20 @@ again: msg.buf = data; /* high byte goes out first */ - wreg = (u16 *)data; + wreg = (void *)data; *wreg = cpu_to_be16(reg); if (data_length == MISENSOR_8BIT) { data[2] = (u8)(val); } else if (data_length == MISENSOR_16BIT) { - u16 *wdata = (u16 *)&data[2]; - *wdata = be16_to_cpu((u16)val); + u16 *wdata = (void *)&data[2]; + + *wdata = be16_to_cpu(*(__be16 *)&data[2]); } else { /* MISENSOR_32BIT */ - u32 *wdata = (u32 *)&data[2]; - *wdata = be32_to_cpu(val); + u32 *wdata = (void *)&data[2]; + + *wdata = be32_to_cpu(*(__be32 *)&data[2]); } num_msg = i2c_transfer(client->adapter, &msg, 1); @@ -245,6 +247,7 @@ static int __mt9m114_flush_reg_array(struct i2c_client *client, const int num_msg = 1; int ret; int retry = 0; + __be16 *data16 = (void *)&ctrl->buffer.addr; if (ctrl->index == 0) return 0; @@ -253,7 +256,7 @@ again: msg.addr = client->addr; msg.flags = 0; msg.len = 2 + ctrl->index; - ctrl->buffer.addr = cpu_to_be16(ctrl->buffer.addr); + *data16 = cpu_to_be16(ctrl->buffer.addr); msg.buf = (u8 *)&ctrl->buffer; ret = i2c_transfer(client->adapter, &msg, num_msg); @@ -282,8 +285,8 @@ static int __mt9m114_buf_reg_array(struct i2c_client *client, struct mt9m114_write_ctrl *ctrl, const struct misensor_reg *next) { - u16 *data16; - u32 *data32; + __be16 *data16; + __be32 *data32; int err; /* Insufficient buffer? Let's flush and get more free space. */ @@ -298,11 +301,11 @@ static int __mt9m114_buf_reg_array(struct i2c_client *client, ctrl->buffer.data[ctrl->index] = (u8)next->val; break; case MISENSOR_16BIT: - data16 = (u16 *)&ctrl->buffer.data[ctrl->index]; + data16 = (__be16 *)&ctrl->buffer.data[ctrl->index]; *data16 = cpu_to_be16((u16)next->val); break; case MISENSOR_32BIT: - data32 = (u32 *)&ctrl->buffer.data[ctrl->index]; + data32 = (__be32 *)&ctrl->buffer.data[ctrl->index]; *data32 = cpu_to_be32(next->val); break; default: diff --git a/drivers/staging/media/atomisp/i2c/atomisp-ov2680.c b/drivers/staging/media/atomisp/i2c/atomisp-ov2680.c index 11412061c40e..1d814bcb18b8 100644 --- a/drivers/staging/media/atomisp/i2c/atomisp-ov2680.c +++ b/drivers/staging/media/atomisp/i2c/atomisp-ov2680.c @@ -94,9 +94,9 @@ static int ov2680_read_reg(struct i2c_client *client, if (data_length == OV2680_8BIT) *val = (u8)data[0]; else if (data_length == OV2680_16BIT) - *val = be16_to_cpu(*(u16 *)&data[0]); + *val = be16_to_cpu(*(__be16 *)&data[0]); else - *val = be32_to_cpu(*(u32 *)&data[0]); + *val = be32_to_cpu(*(__be32 *)&data[0]); //dev_dbg(&client->dev, "++++i2c read adr%x = %x\n", reg,*val); return 0; } @@ -121,7 +121,7 @@ static int ov2680_write_reg(struct i2c_client *client, u16 data_length, { int ret; unsigned char data[4] = {0}; - u16 *wreg = (u16 *)data; + __be16 *wreg = (void *)data; const u16 len = data_length + sizeof(u16); /* 16-bit address + data */ if (data_length != OV2680_8BIT && data_length != OV2680_16BIT) { @@ -137,7 +137,8 @@ static int ov2680_write_reg(struct i2c_client *client, u16 data_length, data[2] = (u8)(val); } else { /* OV2680_16BIT */ - u16 *wdata = (u16 *)&data[2]; + __be16 *wdata = (void *)&data[2]; + *wdata = cpu_to_be16(val); } @@ -169,12 +170,13 @@ static int __ov2680_flush_reg_array(struct i2c_client *client, struct ov2680_write_ctrl *ctrl) { u16 size; + __be16 *data16 = (void *)&ctrl->buffer.addr; if (ctrl->index == 0) return 0; size = sizeof(u16) + ctrl->index; /* 16-bit address + data */ - ctrl->buffer.addr = cpu_to_be16(ctrl->buffer.addr); + *data16 = cpu_to_be16(ctrl->buffer.addr); ctrl->index = 0; return ov2680_i2c_write(client, size, (u8 *)&ctrl->buffer); @@ -185,7 +187,7 @@ static int __ov2680_buf_reg_array(struct i2c_client *client, const struct ov2680_reg *next) { int size; - u16 *data16; + __be16 *data16; switch (next->type) { case OV2680_8BIT: @@ -194,7 +196,7 @@ static int __ov2680_buf_reg_array(struct i2c_client *client, break; case OV2680_16BIT: size = 2; - data16 = (u16 *)&ctrl->buffer.data[ctrl->index]; + data16 = (void *)&ctrl->buffer.data[ctrl->index]; *data16 = cpu_to_be16((u16)next->val); break; default: diff --git a/drivers/staging/media/atomisp/i2c/atomisp-ov2722.c b/drivers/staging/media/atomisp/i2c/atomisp-ov2722.c index e59358ac89ce..dc9a6d4f1824 100644 --- a/drivers/staging/media/atomisp/i2c/atomisp-ov2722.c +++ b/drivers/staging/media/atomisp/i2c/atomisp-ov2722.c @@ -85,9 +85,9 @@ static int ov2722_read_reg(struct i2c_client *client, if (data_length == OV2722_8BIT) *val = (u8)data[0]; else if (data_length == OV2722_16BIT) - *val = be16_to_cpu(*(u16 *)&data[0]); + *val = be16_to_cpu(*(__be16 *)&data[0]); else - *val = be32_to_cpu(*(u32 *)&data[0]); + *val = be32_to_cpu(*(__be32 *)&data[0]); return 0; } @@ -112,7 +112,7 @@ static int ov2722_write_reg(struct i2c_client *client, u16 data_length, { int ret; unsigned char data[4] = {0}; - u16 *wreg = (u16 *)data; + __be16 *wreg = (__be16 *)data; const u16 len = data_length + sizeof(u16); /* 16-bit address + data */ if (data_length != OV2722_8BIT && data_length != OV2722_16BIT) { @@ -128,7 +128,8 @@ static int ov2722_write_reg(struct i2c_client *client, u16 data_length, data[2] = (u8)(val); } else { /* OV2722_16BIT */ - u16 *wdata = (u16 *)&data[2]; + __be16 *wdata = (__be16 *)&data[2]; + *wdata = cpu_to_be16(val); } @@ -160,12 +161,13 @@ static int __ov2722_flush_reg_array(struct i2c_client *client, struct ov2722_write_ctrl *ctrl) { u16 size; + __be16 *data16 = (void *)&ctrl->buffer.addr; if (ctrl->index == 0) return 0; size = sizeof(u16) + ctrl->index; /* 16-bit address + data */ - ctrl->buffer.addr = cpu_to_be16(ctrl->buffer.addr); + *data16 = cpu_to_be16(ctrl->buffer.addr); ctrl->index = 0; return ov2722_i2c_write(client, size, (u8 *)&ctrl->buffer); @@ -176,7 +178,7 @@ static int __ov2722_buf_reg_array(struct i2c_client *client, const struct ov2722_reg *next) { int size; - u16 *data16; + __be16 *data16; switch (next->type) { case OV2722_8BIT: @@ -185,7 +187,7 @@ static int __ov2722_buf_reg_array(struct i2c_client *client, break; case OV2722_16BIT: size = 2; - data16 = (u16 *)&ctrl->buffer.data[ctrl->index]; + data16 = (void *)&ctrl->buffer.data[ctrl->index]; *data16 = cpu_to_be16((u16)next->val); break; default: diff --git a/drivers/staging/media/atomisp/i2c/ov5693/atomisp-ov5693.c b/drivers/staging/media/atomisp/i2c/ov5693/atomisp-ov5693.c index 30a735e59e54..e3a2a63c52cb 100644 --- a/drivers/staging/media/atomisp/i2c/ov5693/atomisp-ov5693.c +++ b/drivers/staging/media/atomisp/i2c/ov5693/atomisp-ov5693.c @@ -173,9 +173,9 @@ static int ov5693_read_reg(struct i2c_client *client, if (data_length == OV5693_8BIT) *val = (u8)data[0]; else if (data_length == OV5693_16BIT) - *val = be16_to_cpu(*(u16 *)&data[0]); + *val = be16_to_cpu(*(__be16 *)&data[0]); else - *val = be32_to_cpu(*(u32 *)&data[0]); + *val = be32_to_cpu(*(__be32 *)&data[0]); return 0; } @@ -200,13 +200,13 @@ static int vcm_dw_i2c_write(struct i2c_client *client, u16 data) struct i2c_msg msg; const int num_msg = 1; int ret; - u16 val; + __be16 val; val = cpu_to_be16(data); msg.addr = VCM_ADDR; msg.flags = 0; msg.len = OV5693_16BIT; - msg.buf = (u8 *)&val; + msg.buf = (void *)&val; ret = i2c_transfer(client->adapter, &msg, 1); @@ -263,7 +263,7 @@ static int ov5693_write_reg(struct i2c_client *client, u16 data_length, { int ret; unsigned char data[4] = {0}; - u16 *wreg = (u16 *)data; + __be16 *wreg = (void *)data; const u16 len = data_length + sizeof(u16); /* 16-bit address + data */ if (data_length != OV5693_8BIT && data_length != OV5693_16BIT) { @@ -279,7 +279,8 @@ static int ov5693_write_reg(struct i2c_client *client, u16 data_length, data[2] = (u8)(val); } else { /* OV5693_16BIT */ - u16 *wdata = (u16 *)&data[2]; + __be16 *wdata = (void *)&data[2]; + *wdata = cpu_to_be16(val); } @@ -311,15 +312,17 @@ static int __ov5693_flush_reg_array(struct i2c_client *client, struct ov5693_write_ctrl *ctrl) { u16 size; + __be16 *reg = (void *)&ctrl->buffer.addr; if (ctrl->index == 0) return 0; size = sizeof(u16) + ctrl->index; /* 16-bit address + data */ - ctrl->buffer.addr = cpu_to_be16(ctrl->buffer.addr); + + *reg = cpu_to_be16(ctrl->buffer.addr); ctrl->index = 0; - return ov5693_i2c_write(client, size, (u8 *)&ctrl->buffer); + return ov5693_i2c_write(client, size, (u8 *)reg); } static int __ov5693_buf_reg_array(struct i2c_client *client, @@ -327,7 +330,7 @@ static int __ov5693_buf_reg_array(struct i2c_client *client, const struct ov5693_reg *next) { int size; - u16 *data16; + __be16 *data16; switch (next->type) { case OV5693_8BIT: @@ -336,7 +339,8 @@ static int __ov5693_buf_reg_array(struct i2c_client *client, break; case OV5693_16BIT: size = 2; - data16 = (u16 *)&ctrl->buffer.data[ctrl->index]; + + data16 = (void *)&ctrl->buffer.data[ctrl->index]; *data16 = cpu_to_be16((u16)next->val); break; default: From 849267dfe0deaca6df41d02fe6f2989678932ac1 Mon Sep 17 00:00:00 2001 From: Mauro Carvalho Chehab Date: Mon, 26 Mar 2018 14:22:32 -0400 Subject: [PATCH 34/48] media: staging: atomisp: remove unused set_pd_base() There's an implementation for set_pd_base at sh_mmu logic with is said to be mandatory. However, the implementation ends by calling a routine that does nothing. So get rid of this entire nonsense. Acked-by: Sakari Ailus Signed-off-by: Mauro Carvalho Chehab --- .../media/atomisp/pci/atomisp2/atomisp_compat.h | 2 -- .../atomisp/pci/atomisp2/atomisp_compat_css20.c | 4 ---- .../atomisp/pci/atomisp2/include/mmu/isp_mmu.h | 4 +--- .../media/atomisp/pci/atomisp2/mmu/isp_mmu.c | 13 ++----------- .../media/atomisp/pci/atomisp2/mmu/sh_mmu_mrfld.c | 15 --------------- 5 files changed, 3 insertions(+), 35 deletions(-) diff --git a/drivers/staging/media/atomisp/pci/atomisp2/atomisp_compat.h b/drivers/staging/media/atomisp/pci/atomisp2/atomisp_compat.h index 3ef850cd25bd..398ee02229f8 100644 --- a/drivers/staging/media/atomisp/pci/atomisp2/atomisp_compat.h +++ b/drivers/staging/media/atomisp/pci/atomisp2/atomisp_compat.h @@ -182,8 +182,6 @@ void atomisp_css_mmu_invalidate_cache(void); void atomisp_css_mmu_invalidate_tlb(void); -void atomisp_css_mmu_set_page_table_base_index(unsigned long base_index); - int atomisp_css_start(struct atomisp_sub_device *asd, enum atomisp_css_pipe_id pipe_id, bool in_reset); diff --git a/drivers/staging/media/atomisp/pci/atomisp2/atomisp_compat_css20.c b/drivers/staging/media/atomisp/pci/atomisp2/atomisp_compat_css20.c index 7621b4537147..bbed1ed02074 100644 --- a/drivers/staging/media/atomisp/pci/atomisp2/atomisp_compat_css20.c +++ b/drivers/staging/media/atomisp/pci/atomisp2/atomisp_compat_css20.c @@ -1159,10 +1159,6 @@ void atomisp_css_mmu_invalidate_tlb(void) ia_css_mmu_invalidate_cache(); } -void atomisp_css_mmu_set_page_table_base_index(unsigned long base_index) -{ -} - /* * Check whether currently running MIPI buffer size fulfill * the requirement of the stream to be run diff --git a/drivers/staging/media/atomisp/pci/atomisp2/include/mmu/isp_mmu.h b/drivers/staging/media/atomisp/pci/atomisp2/include/mmu/isp_mmu.h index 560014add005..4b2d94a37ea1 100644 --- a/drivers/staging/media/atomisp/pci/atomisp2/include/mmu/isp_mmu.h +++ b/drivers/staging/media/atomisp/pci/atomisp2/include/mmu/isp_mmu.h @@ -80,12 +80,10 @@ struct isp_mmu_client { unsigned int null_pte; /* - * set/get page directory base address (physical address). + * get page directory base address (physical address). * * must be provided. */ - int (*set_pd_base) (struct isp_mmu *mmu, - phys_addr_t pd_base); unsigned int (*get_pd_base) (struct isp_mmu *mmu, phys_addr_t pd_base); /* * callback to flush tlb. diff --git a/drivers/staging/media/atomisp/pci/atomisp2/mmu/isp_mmu.c b/drivers/staging/media/atomisp/pci/atomisp2/mmu/isp_mmu.c index f21075c1e503..198f29f4a324 100644 --- a/drivers/staging/media/atomisp/pci/atomisp2/mmu/isp_mmu.c +++ b/drivers/staging/media/atomisp/pci/atomisp2/mmu/isp_mmu.c @@ -344,13 +344,6 @@ static int mmu_map(struct isp_mmu *mmu, unsigned int isp_virt, /* * setup L1 page table physical addr to MMU */ - ret = mmu->driver->set_pd_base(mmu, l1_pt); - if (ret) { - dev_err(atomisp_dev, - "set page directory base address fail.\n"); - mutex_unlock(&mmu->pt_mutex); - return ret; - } mmu->base_address = l1_pt; mmu->l1_pte = isp_pgaddr_to_pte_valid(mmu, l1_pt); memset(mmu->l2_pgt_refcount, 0, sizeof(int) * ISP_L1PT_PTES); @@ -531,10 +524,8 @@ int isp_mmu_init(struct isp_mmu *mmu, struct isp_mmu_client *driver) mmu->driver = driver; - if (!driver->set_pd_base || !driver->tlb_flush_all) { - dev_err(atomisp_dev, - "set_pd_base or tlb_flush_all operation " - "not provided.\n"); + if (!driver->tlb_flush_all) { + dev_err(atomisp_dev, "tlb_flush_all operation not provided.\n"); return -EINVAL; } diff --git a/drivers/staging/media/atomisp/pci/atomisp2/mmu/sh_mmu_mrfld.c b/drivers/staging/media/atomisp/pci/atomisp2/mmu/sh_mmu_mrfld.c index c59bcc982966..4cbf907bd07b 100644 --- a/drivers/staging/media/atomisp/pci/atomisp2/mmu/sh_mmu_mrfld.c +++ b/drivers/staging/media/atomisp/pci/atomisp2/mmu/sh_mmu_mrfld.c @@ -40,20 +40,6 @@ static phys_addr_t sh_pte_to_phys(struct isp_mmu *mmu, return (phys_addr_t)((pte & ~mask) << ISP_PAGE_OFFSET); } -/* - * set page directory base address (physical address). - * - * must be provided. - */ -static int sh_set_pd_base(struct isp_mmu *mmu, - phys_addr_t phys) -{ - unsigned int pte = sh_phys_to_pte(mmu, phys); - /*mmgr_set_base_address(HOST_ADDRESS(pte));*/ - atomisp_css_mmu_set_page_table_base_index(HOST_ADDRESS(pte)); - return 0; -} - static unsigned int sh_get_pd_base(struct isp_mmu *mmu, phys_addr_t phys) { @@ -81,7 +67,6 @@ struct isp_mmu_client sh_mmu_mrfld = { .name = "Silicon Hive ISP3000 MMU", .pte_valid_mask = MERR_VALID_PTE_MASK, .null_pte = ~MERR_VALID_PTE_MASK, - .set_pd_base = sh_set_pd_base, .get_pd_base = sh_get_pd_base, .tlb_flush_all = sh_tlb_flush, .phys_to_pte = sh_phys_to_pte, From 319dbc1b4ba9f84a1ce33ea8352a33d1eaea5deb Mon Sep 17 00:00:00 2001 From: Mauro Carvalho Chehab Date: Mon, 26 Mar 2018 14:25:24 -0400 Subject: [PATCH 35/48] media: staging: atomisp: get rid of an unused function The function __need_realloc_mipi_buffer() is not used anywhere. Acked-by: Sakari Ailus Signed-off-by: Mauro Carvalho Chehab --- .../pci/atomisp2/atomisp_compat_css20.c | 21 ------------------- 1 file changed, 21 deletions(-) diff --git a/drivers/staging/media/atomisp/pci/atomisp2/atomisp_compat_css20.c b/drivers/staging/media/atomisp/pci/atomisp2/atomisp_compat_css20.c index bbed1ed02074..b0e584b3cfc7 100644 --- a/drivers/staging/media/atomisp/pci/atomisp2/atomisp_compat_css20.c +++ b/drivers/staging/media/atomisp/pci/atomisp2/atomisp_compat_css20.c @@ -1159,27 +1159,6 @@ void atomisp_css_mmu_invalidate_tlb(void) ia_css_mmu_invalidate_cache(); } -/* - * Check whether currently running MIPI buffer size fulfill - * the requirement of the stream to be run - */ -bool __need_realloc_mipi_buffer(struct atomisp_device *isp) -{ - unsigned int i; - - for (i = 0; i < isp->num_of_streams; i++) { - struct atomisp_sub_device *asd = &isp->asd[i]; - - if (asd->streaming != - ATOMISP_DEVICE_STREAMING_ENABLED) - continue; - if (asd->mipi_frame_size < isp->mipi_frame_size) - return true; - } - - return false; -} - int atomisp_css_start(struct atomisp_sub_device *asd, enum atomisp_css_pipe_id pipe_id, bool in_reset) { From 6dfc6a3f66fbeed1be8fb5a376339d3dcb7545c3 Mon Sep 17 00:00:00 2001 From: Mauro Carvalho Chehab Date: Mon, 26 Mar 2018 14:31:33 -0400 Subject: [PATCH 36/48] media: staging: atomisp: Get rid of *default.host.[ch] There are a number of files at atomisp that aren't used anywhere, called as "*default.host.[ch]": css2400/isp/kernels/dpc2/ia_css_dpc2_default.host.[ch] css2400/isp/kernels/bnlm/ia_css_bnlm_default.host.[ch] css2400/isp/kernels/tdf/tdf_1.0/ia_css_tdf_default.host.[ch] css2400/isp/kernels/eed1_8/ia_css_eed1_8_default.host.[ch] Remove them. Acked-by: Sakari Ailus Signed-off-by: Mauro Carvalho Chehab --- .../media/atomisp/pci/atomisp2/Makefile | 4 - .../isp/kernels/bnlm/ia_css_bnlm.host.h | 1 - .../kernels/bnlm/ia_css_bnlm_default.host.c | 71 -------------- .../kernels/bnlm/ia_css_bnlm_default.host.h | 22 ----- .../isp/kernels/dpc2/ia_css_dpc2.host.h | 1 - .../kernels/dpc2/ia_css_dpc2_default.host.c | 26 ----- .../kernels/dpc2/ia_css_dpc2_default.host.h | 23 ----- .../isp/kernels/eed1_8/ia_css_eed1_8.host.h | 1 - .../eed1_8/ia_css_eed1_8_default.host.c | 94 ------------------- .../eed1_8/ia_css_eed1_8_default.host.h | 22 ----- .../isp/kernels/tdf/tdf_1.0/ia_css_tdf.host.h | 1 - .../tdf/tdf_1.0/ia_css_tdf_default.host.c | 36 ------- .../tdf/tdf_1.0/ia_css_tdf_default.host.h | 23 ----- 13 files changed, 325 deletions(-) delete mode 100644 drivers/staging/media/atomisp/pci/atomisp2/css2400/isp/kernels/bnlm/ia_css_bnlm_default.host.c delete mode 100644 drivers/staging/media/atomisp/pci/atomisp2/css2400/isp/kernels/bnlm/ia_css_bnlm_default.host.h delete mode 100644 drivers/staging/media/atomisp/pci/atomisp2/css2400/isp/kernels/dpc2/ia_css_dpc2_default.host.c delete mode 100644 drivers/staging/media/atomisp/pci/atomisp2/css2400/isp/kernels/dpc2/ia_css_dpc2_default.host.h delete mode 100644 drivers/staging/media/atomisp/pci/atomisp2/css2400/isp/kernels/eed1_8/ia_css_eed1_8_default.host.c delete mode 100644 drivers/staging/media/atomisp/pci/atomisp2/css2400/isp/kernels/eed1_8/ia_css_eed1_8_default.host.h delete mode 100644 drivers/staging/media/atomisp/pci/atomisp2/css2400/isp/kernels/tdf/tdf_1.0/ia_css_tdf_default.host.c delete mode 100644 drivers/staging/media/atomisp/pci/atomisp2/css2400/isp/kernels/tdf/tdf_1.0/ia_css_tdf_default.host.h diff --git a/drivers/staging/media/atomisp/pci/atomisp2/Makefile b/drivers/staging/media/atomisp/pci/atomisp2/Makefile index 83f816faba1b..7fead5fc9a7d 100644 --- a/drivers/staging/media/atomisp/pci/atomisp2/Makefile +++ b/drivers/staging/media/atomisp/pci/atomisp2/Makefile @@ -59,17 +59,14 @@ atomisp-objs += \ css2400/isp/kernels/bnr/bnr_1.0/ia_css_bnr.host.o \ css2400/isp/kernels/bnr/bnr2_2/ia_css_bnr2_2.host.o \ css2400/isp/kernels/dpc2/ia_css_dpc2.host.o \ - css2400/isp/kernels/dpc2/ia_css_dpc2_default.host.o \ css2400/isp/kernels/fc/fc_1.0/ia_css_formats.host.o \ css2400/isp/kernels/ctc/ctc_1.0/ia_css_ctc.host.o \ css2400/isp/kernels/ctc/ctc_1.0/ia_css_ctc_table.host.o \ css2400/isp/kernels/ctc/ctc2/ia_css_ctc2.host.o \ css2400/isp/kernels/ctc/ctc1_5/ia_css_ctc1_5.host.o \ css2400/isp/kernels/bh/bh_2/ia_css_bh.host.o \ - css2400/isp/kernels/bnlm/ia_css_bnlm_default.host.o \ css2400/isp/kernels/bnlm/ia_css_bnlm.host.o \ css2400/isp/kernels/tdf/tdf_1.0/ia_css_tdf.host.o \ - css2400/isp/kernels/tdf/tdf_1.0/ia_css_tdf_default.host.o \ css2400/isp/kernels/dvs/dvs_1.0/ia_css_dvs.host.o \ css2400/isp/kernels/anr/anr_1.0/ia_css_anr.host.o \ css2400/isp/kernels/anr/anr_2/ia_css_anr2_table.host.o \ @@ -96,7 +93,6 @@ atomisp-objs += \ css2400/isp/kernels/ob/ob2/ia_css_ob2.host.o \ css2400/isp/kernels/iterator/iterator_1.0/ia_css_iterator.host.o \ css2400/isp/kernels/wb/wb_1.0/ia_css_wb.host.o \ - css2400/isp/kernels/eed1_8/ia_css_eed1_8_default.host.o \ css2400/isp/kernels/eed1_8/ia_css_eed1_8.host.o \ css2400/isp/kernels/sc/sc_1.0/ia_css_sc.host.o \ css2400/isp/kernels/ipu2_io_ls/bayer_io_ls/ia_css_bayer_io.host.o \ diff --git a/drivers/staging/media/atomisp/pci/atomisp2/css2400/isp/kernels/bnlm/ia_css_bnlm.host.h b/drivers/staging/media/atomisp/pci/atomisp2/css2400/isp/kernels/bnlm/ia_css_bnlm.host.h index b99c0644ab38..675f6e539b3f 100644 --- a/drivers/staging/media/atomisp/pci/atomisp2/css2400/isp/kernels/bnlm/ia_css_bnlm.host.h +++ b/drivers/staging/media/atomisp/pci/atomisp2/css2400/isp/kernels/bnlm/ia_css_bnlm.host.h @@ -17,7 +17,6 @@ #include "ia_css_bnlm_types.h" #include "ia_css_bnlm_param.h" -#include "ia_css_bnlm_default.host.h" void ia_css_bnlm_vmem_encode( diff --git a/drivers/staging/media/atomisp/pci/atomisp2/css2400/isp/kernels/bnlm/ia_css_bnlm_default.host.c b/drivers/staging/media/atomisp/pci/atomisp2/css2400/isp/kernels/bnlm/ia_css_bnlm_default.host.c deleted file mode 100644 index e2eb88c0f123..000000000000 --- a/drivers/staging/media/atomisp/pci/atomisp2/css2400/isp/kernels/bnlm/ia_css_bnlm_default.host.c +++ /dev/null @@ -1,71 +0,0 @@ -/* - * Support for Intel Camera Imaging ISP subsystem. - * Copyright (c) 2015, Intel Corporation. - * - * This program is free software; you can redistribute it and/or modify it - * under the terms and conditions of the GNU General Public License, - * version 2, as published by the Free Software Foundation. - * - * This program is distributed in the hope it will be useful, but WITHOUT - * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or - * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for - * more details. - */ - -#include "ia_css_bnlm_types.h" - -const struct ia_css_bnlm_config default_bnlm_config = { - - .rad_enable = true, - .rad_x_origin = 0, - .rad_y_origin = 0, - .avg_min_th = 127, - .max_min_th = 2047, - - .exp_coeff_a = 6048, - .exp_coeff_b = 7828, - .exp_coeff_c = 0, - .exp_exponent = 3, - - .nl_th = {2252, 2251, 2250}, - .match_quality_max_idx = {2, 3, 3, 1}, - - .mu_root_lut_thr = { - 26, 56, 128, 216, 462, 626, 932, 1108, 1480, 1564, 1824, 1896, 2368, 3428, 4560}, - .mu_root_lut_val = { - 384, 320, 320, 264, 248, 240, 224, 192, 192, 160, 160, 160, 136, 130, 96, 80}, - .sad_norm_lut_thr = { - 236, 328, 470, 774, 964, 1486, 2294, 3244, 4844, 6524, 6524, 6524, 6524, 6524, 6524}, - .sad_norm_lut_val = { - 8064, 7680, 7168, 6144, 5120, 3840, 2560, 2304, 1984, 1792, 1792, 1792, 1792, 1792, 1792, 1792}, - .sig_detail_lut_thr = { - 2936, 3354, 3943, 4896, 5230, 5682, 5996, 7299, 7299, 7299, 7299, 7299, 7299, 7299, 7299}, - .sig_detail_lut_val = { - 8191, 7680, 7168, 6144, 5120, 4608, 4224, 4032, 4032, 4032, 4032, 4032, 4032, 4032, 4032, 4032}, - .sig_rad_lut_thr = { - 18, 19, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20}, - .sig_rad_lut_val = { - 2560, 7168, 8188, 8188, 8188, 8188, 8188, 8188, 8188, 8188, 8188, 8188, 8188, 8188, 8188, 8188}, - .rad_pow_lut_thr = { - 0, 7013, 7013, 7013, 7013, 7013, 7013, 7013, 7013, 7013, 7013, 7013, 7013, 7013, 7013}, - .rad_pow_lut_val = { - 8191, 8191, 8191, 8191, 8191, 8191, 8191, 8191, 8191, 8191, 8191, 8191, 8191, 8191, 8191, 8191}, - .nl_0_lut_thr = { - 1072, 7000, 8000, 8000, 8000, 8000, 8000, 8000, 8000, 8000, 8000, 8000, 8000, 8000, 8000}, - .nl_0_lut_val = { - 2560, 3072, 5120, 5120, 5120, 5120, 5120, 5120, 5120, 5120, 5120, 5120, 5120, 5120, 5120, 5120}, - .nl_1_lut_thr = { - 624, 3224, 3392, 7424, 7424, 7424, 7424, 7424, 7424, 7424, 7424, 7424, 7424, 7424, 7424}, - .nl_1_lut_val = { - 3584, 4608, 5120, 6144, 6144, 6144, 6144, 6144, 6144, 6144, 6144, 6144, 6144, 6144, 6144, 6144}, - .nl_2_lut_thr = { - 745, 2896, 3720, 6535, 7696, 8040, 8040, 8040, 8040, 8040, 8040, 8040, 8040, 8040, 8040}, - .nl_2_lut_val = { - 3584, 4608, 6144, 7168, 7936, 8191, 8191, 8191, 8191, 8191, 8191, 8191, 8191, 8191, 8191, 8191}, - .nl_3_lut_thr = { - 4848, 4984, 5872, 6000, 6517, 6960, 7944, 8088, 8161, 8161, 8161, 8161, 8161, 8161, 8161}, - .nl_3_lut_val = { - 3072, 4104, 4608, 5120, 6144, 7168, 7680, 8128, 8191, 8191, 8191, 8191, 8191, 8191, 8191, 8191}, - -}; - diff --git a/drivers/staging/media/atomisp/pci/atomisp2/css2400/isp/kernels/bnlm/ia_css_bnlm_default.host.h b/drivers/staging/media/atomisp/pci/atomisp2/css2400/isp/kernels/bnlm/ia_css_bnlm_default.host.h deleted file mode 100644 index f18c8070abba..000000000000 --- a/drivers/staging/media/atomisp/pci/atomisp2/css2400/isp/kernels/bnlm/ia_css_bnlm_default.host.h +++ /dev/null @@ -1,22 +0,0 @@ -/* - * Support for Intel Camera Imaging ISP subsystem. - * Copyright (c) 2015, Intel Corporation. - * - * This program is free software; you can redistribute it and/or modify it - * under the terms and conditions of the GNU General Public License, - * version 2, as published by the Free Software Foundation. - * - * This program is distributed in the hope it will be useful, but WITHOUT - * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or - * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for - * more details. - */ - -#ifndef __IA_CSS_BNLM_DEFAULT_HOST_H -#define __IA_CSS_BNLM_DEFAULT_HOST_H - -#include "ia_css_bnlm_types.h" -extern const struct ia_css_bnlm_config default_bnlm_config; - -#endif /* __IA_CSS_BNLM_DEFAULT_HOST_H */ - diff --git a/drivers/staging/media/atomisp/pci/atomisp2/css2400/isp/kernels/dpc2/ia_css_dpc2.host.h b/drivers/staging/media/atomisp/pci/atomisp2/css2400/isp/kernels/dpc2/ia_css_dpc2.host.h index 641564b4af8e..38d10a5237c6 100644 --- a/drivers/staging/media/atomisp/pci/atomisp2/css2400/isp/kernels/dpc2/ia_css_dpc2.host.h +++ b/drivers/staging/media/atomisp/pci/atomisp2/css2400/isp/kernels/dpc2/ia_css_dpc2.host.h @@ -17,7 +17,6 @@ #include "ia_css_dpc2_types.h" #include "ia_css_dpc2_param.h" -#include "ia_css_dpc2_default.host.h" void ia_css_dpc2_encode( diff --git a/drivers/staging/media/atomisp/pci/atomisp2/css2400/isp/kernels/dpc2/ia_css_dpc2_default.host.c b/drivers/staging/media/atomisp/pci/atomisp2/css2400/isp/kernels/dpc2/ia_css_dpc2_default.host.c deleted file mode 100644 index c102601cc635..000000000000 --- a/drivers/staging/media/atomisp/pci/atomisp2/css2400/isp/kernels/dpc2/ia_css_dpc2_default.host.c +++ /dev/null @@ -1,26 +0,0 @@ -/* - * Support for Intel Camera Imaging ISP subsystem. - * Copyright (c) 2015, Intel Corporation. - * - * This program is free software; you can redistribute it and/or modify it - * under the terms and conditions of the GNU General Public License, - * version 2, as published by the Free Software Foundation. - * - * This program is distributed in the hope it will be useful, but WITHOUT - * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or - * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for - * more details. - */ - -#include "ia_css_dpc2_types.h" - -const struct ia_css_dpc2_config default_dpc2_config = { - .metric1 = 1638, - .metric2 = 128, - .metric3 = 1638, - .wb_gain_gr = 512, - .wb_gain_r = 512, - .wb_gain_b = 512, - .wb_gain_gb = 512 -}; - diff --git a/drivers/staging/media/atomisp/pci/atomisp2/css2400/isp/kernels/dpc2/ia_css_dpc2_default.host.h b/drivers/staging/media/atomisp/pci/atomisp2/css2400/isp/kernels/dpc2/ia_css_dpc2_default.host.h deleted file mode 100644 index a1527ce3eddc..000000000000 --- a/drivers/staging/media/atomisp/pci/atomisp2/css2400/isp/kernels/dpc2/ia_css_dpc2_default.host.h +++ /dev/null @@ -1,23 +0,0 @@ -/* - * Support for Intel Camera Imaging ISP subsystem. - * Copyright (c) 2015, Intel Corporation. - * - * This program is free software; you can redistribute it and/or modify it - * under the terms and conditions of the GNU General Public License, - * version 2, as published by the Free Software Foundation. - * - * This program is distributed in the hope it will be useful, but WITHOUT - * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or - * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for - * more details. - */ - -#ifndef __IA_CSS_DPC2_DEFAULT_HOST_H -#define __IA_CSS_DPC2_DEFAULT_HOST_H - -#include "ia_css_dpc2_types.h" - -extern const struct ia_css_dpc2_config default_dpc2_config; - -#endif /* __IA_CSS_DPC2_DEFAULT_HOST_H */ - diff --git a/drivers/staging/media/atomisp/pci/atomisp2/css2400/isp/kernels/eed1_8/ia_css_eed1_8.host.h b/drivers/staging/media/atomisp/pci/atomisp2/css2400/isp/kernels/eed1_8/ia_css_eed1_8.host.h index 355ff13273b0..fff932c1364e 100644 --- a/drivers/staging/media/atomisp/pci/atomisp2/css2400/isp/kernels/eed1_8/ia_css_eed1_8.host.h +++ b/drivers/staging/media/atomisp/pci/atomisp2/css2400/isp/kernels/eed1_8/ia_css_eed1_8.host.h @@ -17,7 +17,6 @@ #include "ia_css_eed1_8_types.h" #include "ia_css_eed1_8_param.h" -#include "ia_css_eed1_8_default.host.h" void ia_css_eed1_8_vmem_encode( diff --git a/drivers/staging/media/atomisp/pci/atomisp2/css2400/isp/kernels/eed1_8/ia_css_eed1_8_default.host.c b/drivers/staging/media/atomisp/pci/atomisp2/css2400/isp/kernels/eed1_8/ia_css_eed1_8_default.host.c deleted file mode 100644 index 3622719dafa5..000000000000 --- a/drivers/staging/media/atomisp/pci/atomisp2/css2400/isp/kernels/eed1_8/ia_css_eed1_8_default.host.c +++ /dev/null @@ -1,94 +0,0 @@ -/* - * Support for Intel Camera Imaging ISP subsystem. - * Copyright (c) 2015, Intel Corporation. - * - * This program is free software; you can redistribute it and/or modify it - * under the terms and conditions of the GNU General Public License, - * version 2, as published by the Free Software Foundation. - * - * This program is distributed in the hope it will be useful, but WITHOUT - * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or - * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for - * more details. - */ - -#include "ia_css_eed1_8_types.h" - -/* The default values for the kernel parameters are based on - * ISP261 CSS API public parameter list_all.xlsx from 12-09-2014 - * The parameter list is available on the ISP261 sharepoint - */ - -/* Default kernel parameters. */ -const struct ia_css_eed1_8_config default_eed1_8_config = { - .rbzp_strength = 5489, - .fcstrength = 6554, - .fcthres_0 = 0, - .fcthres_1 = 0, - .fc_sat_coef = 8191, - .fc_coring_prm = 128, - .aerel_thres0 = 0, - .aerel_gain0 = 8191, - .aerel_thres1 = 16, - .aerel_gain1 = 20, - .derel_thres0 = 1229, - .derel_gain0 = 1, - .derel_thres1 = 819, - .derel_gain1 = 1, - .coring_pos0 = 0, - .coring_pos1 = 0, - .coring_neg0 = 0, - .coring_neg1 = 0, - .gain_exp = 2, - .gain_pos0 = 6144, - .gain_pos1 = 2048, - .gain_neg0 = 2048, - .gain_neg1 = 6144, - .pos_margin0 = 1475, - .pos_margin1 = 1475, - .neg_margin0 = 1475, - .neg_margin1 = 1475, - .dew_enhance_seg_x = { - 0, - 64, - 272, - 688, - 1376, - 2400, - 3840, - 5744, - 8191 - }, - .dew_enhance_seg_y = { - 0, - 144, - 480, - 1040, - 1852, - 2945, - 4357, - 6094, - 8191 - }, - .dew_enhance_seg_slope = { - 4608, - 3308, - 2757, - 2417, - 2186, - 8033, - 7473, - 7020 - }, - .dew_enhance_seg_exp = { - 2, - 2, - 2, - 2, - 2, - 0, - 0, - 0 - }, - .dedgew_max = 6144 -}; diff --git a/drivers/staging/media/atomisp/pci/atomisp2/css2400/isp/kernels/eed1_8/ia_css_eed1_8_default.host.h b/drivers/staging/media/atomisp/pci/atomisp2/css2400/isp/kernels/eed1_8/ia_css_eed1_8_default.host.h deleted file mode 100644 index 782f739ca8b5..000000000000 --- a/drivers/staging/media/atomisp/pci/atomisp2/css2400/isp/kernels/eed1_8/ia_css_eed1_8_default.host.h +++ /dev/null @@ -1,22 +0,0 @@ -/* - * Support for Intel Camera Imaging ISP subsystem. - * Copyright (c) 2015, Intel Corporation. - * - * This program is free software; you can redistribute it and/or modify it - * under the terms and conditions of the GNU General Public License, - * version 2, as published by the Free Software Foundation. - * - * This program is distributed in the hope it will be useful, but WITHOUT - * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or - * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for - * more details. - */ - -#ifndef __IA_CSS_EED1_8_DEFAULT_HOST_H -#define __IA_CSS_EED1_8_DEFAULT_HOST_H - -#include "ia_css_eed1_8_types.h" - -extern const struct ia_css_eed1_8_config default_eed1_8_config; - -#endif /* __IA_CSS_EED1_8_DEFAULT_HOST_H */ diff --git a/drivers/staging/media/atomisp/pci/atomisp2/css2400/isp/kernels/tdf/tdf_1.0/ia_css_tdf.host.h b/drivers/staging/media/atomisp/pci/atomisp2/css2400/isp/kernels/tdf/tdf_1.0/ia_css_tdf.host.h index 1b3e759e41a3..bd628a18e839 100644 --- a/drivers/staging/media/atomisp/pci/atomisp2/css2400/isp/kernels/tdf/tdf_1.0/ia_css_tdf.host.h +++ b/drivers/staging/media/atomisp/pci/atomisp2/css2400/isp/kernels/tdf/tdf_1.0/ia_css_tdf.host.h @@ -17,7 +17,6 @@ #include "ia_css_tdf_types.h" #include "ia_css_tdf_param.h" -#include "ia_css_tdf_default.host.h" void ia_css_tdf_vmem_encode( diff --git a/drivers/staging/media/atomisp/pci/atomisp2/css2400/isp/kernels/tdf/tdf_1.0/ia_css_tdf_default.host.c b/drivers/staging/media/atomisp/pci/atomisp2/css2400/isp/kernels/tdf/tdf_1.0/ia_css_tdf_default.host.c deleted file mode 100644 index 9bb42daf070d..000000000000 --- a/drivers/staging/media/atomisp/pci/atomisp2/css2400/isp/kernels/tdf/tdf_1.0/ia_css_tdf_default.host.c +++ /dev/null @@ -1,36 +0,0 @@ -/* - * Support for Intel Camera Imaging ISP subsystem. - * Copyright (c) 2015, Intel Corporation. - * - * This program is free software; you can redistribute it and/or modify it - * under the terms and conditions of the GNU General Public License, - * version 2, as published by the Free Software Foundation. - * - * This program is distributed in the hope it will be useful, but WITHOUT - * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or - * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for - * more details. - */ - -#include "ia_css_tdf_types.h" - -const struct ia_css_tdf_config default_tdf_config = { - .thres_flat_table = {0}, - .thres_detail_table = {0}, - .epsilon_0 = 4095, - .epsilon_1 = 5733, - .eps_scale_text = 409, - .eps_scale_edge = 3686, - .sepa_flat = 1294, - .sepa_edge = 4095, - .blend_flat = 819, - .blend_text = 819, - .blend_edge = 8191, - .shading_gain = 1024, - .shading_base_gain = 8191, - .local_y_gain = 0, - .local_y_base_gain = 2047, - .rad_x_origin = 0, - .rad_y_origin = 0 -}; - diff --git a/drivers/staging/media/atomisp/pci/atomisp2/css2400/isp/kernels/tdf/tdf_1.0/ia_css_tdf_default.host.h b/drivers/staging/media/atomisp/pci/atomisp2/css2400/isp/kernels/tdf/tdf_1.0/ia_css_tdf_default.host.h deleted file mode 100644 index cd8fb70e5a87..000000000000 --- a/drivers/staging/media/atomisp/pci/atomisp2/css2400/isp/kernels/tdf/tdf_1.0/ia_css_tdf_default.host.h +++ /dev/null @@ -1,23 +0,0 @@ -/* - * Support for Intel Camera Imaging ISP subsystem. - * Copyright (c) 2015, Intel Corporation. - * - * This program is free software; you can redistribute it and/or modify it - * under the terms and conditions of the GNU General Public License, - * version 2, as published by the Free Software Foundation. - * - * This program is distributed in the hope it will be useful, but WITHOUT - * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or - * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for - * more details. - */ - -#ifndef __IA_CSS_TDF_DEFAULT_HOST_H -#define __IA_CSS_TDF_DEFAULT_HOST_H - -#include "ia_css_tdf_types.h" - -extern const struct ia_css_tdf_config default_tdf_config; - -#endif /* __IA_CSS_TDF_DEFAULT_HOST_H */ - From 8b1a2468cf8afcf2f2e0a113a32bef4a42298cff Mon Sep 17 00:00:00 2001 From: Mauro Carvalho Chehab Date: Mon, 26 Mar 2018 14:54:47 -0400 Subject: [PATCH 37/48] media: staging: atomisp: don't access a NULL var Get rid of those warnings: drivers/staging/media/atomisp/platform/intel-mid/atomisp_gmin_platform.c:446 gmin_v1p2_ctrl() error: we previously assumed 'gs' could be null (see line 444) drivers/staging/media/atomisp/platform/intel-mid/atomisp_gmin_platform.c:480 gmin_v1p8_ctrl() error: we previously assumed 'gs' could be null (see line 478) drivers/staging/media/atomisp/platform/intel-mid/atomisp_gmin_platform.c:516 gmin_v2p8_ctrl() error: we previously assumed 'gs' could be null (see line 514) Acked-by: Sakari Ailus Signed-off-by: Mauro Carvalho Chehab --- .../atomisp/platform/intel-mid/atomisp_gmin_platform.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/drivers/staging/media/atomisp/platform/intel-mid/atomisp_gmin_platform.c b/drivers/staging/media/atomisp/platform/intel-mid/atomisp_gmin_platform.c index d8b7183db252..be0c5e11e86b 100644 --- a/drivers/staging/media/atomisp/platform/intel-mid/atomisp_gmin_platform.c +++ b/drivers/staging/media/atomisp/platform/intel-mid/atomisp_gmin_platform.c @@ -441,7 +441,7 @@ static int gmin_v1p2_ctrl(struct v4l2_subdev *subdev, int on) { struct gmin_subdev *gs = find_gmin_subdev(subdev); - if (gs && gs->v1p2_on == on) + if (!gs || gs->v1p2_on == on) return 0; gs->v1p2_on = on; @@ -475,7 +475,7 @@ static int gmin_v1p8_ctrl(struct v4l2_subdev *subdev, int on) } } - if (gs && gs->v1p8_on == on) + if (!gs || gs->v1p8_on == on) return 0; gs->v1p8_on = on; @@ -511,7 +511,7 @@ static int gmin_v2p8_ctrl(struct v4l2_subdev *subdev, int on) } } - if (gs && gs->v2p8_on == on) + if (!gs || gs->v2p8_on == on) return 0; gs->v2p8_on = on; From dc9f65cf9aea13167bb930d118dbd31ef6f03180 Mon Sep 17 00:00:00 2001 From: Mauro Carvalho Chehab Date: Mon, 26 Mar 2018 15:06:00 -0400 Subject: [PATCH 38/48] media: staging: atomisp: avoid a warning if 32 bits build Checking if a size_t value is bigger than ULONG_INT only makes sense if building on 64 bits, as warned by: drivers/staging/media/atomisp/platform/intel-mid/atomisp_gmin_platform.c:697 gmin_get_config_var() warn: impossible condition '(*out_len > (~0)) => (0-u32max > u32max)' Acked-by: Sakari Ailus Signed-off-by: Mauro Carvalho Chehab --- .../media/atomisp/platform/intel-mid/atomisp_gmin_platform.c | 2 ++ 1 file changed, 2 insertions(+) diff --git a/drivers/staging/media/atomisp/platform/intel-mid/atomisp_gmin_platform.c b/drivers/staging/media/atomisp/platform/intel-mid/atomisp_gmin_platform.c index be0c5e11e86b..3283c1b05d6a 100644 --- a/drivers/staging/media/atomisp/platform/intel-mid/atomisp_gmin_platform.c +++ b/drivers/staging/media/atomisp/platform/intel-mid/atomisp_gmin_platform.c @@ -693,9 +693,11 @@ static int gmin_get_config_var(struct device *dev, const char *var, for (i = 0; i < sizeof(var8) && var8[i]; i++) var16[i] = var8[i]; +#ifdef CONFIG_64BIT /* To avoid owerflows when calling the efivar API */ if (*out_len > ULONG_MAX) return -EINVAL; +#endif /* Not sure this API usage is kosher; efivar_entry_get()'s * implementation simply uses VariableName and VendorGuid from From 83d019bbb0ed214b4ab9d43107cb2fd7be5aeeea Mon Sep 17 00:00:00 2001 From: Mauro Carvalho Chehab Date: Mon, 26 Mar 2018 15:27:54 -0400 Subject: [PATCH 39/48] media: staging: atomisp: remove an useless check There's a check at ia_css_vf_configure() to verify if binary is not null. However, this is called too late: drivers/staging/media/atomisp/pci/atomisp2/css2400/isp/kernels/vf/vf_1.0/ia_css_vf.host.c:133 ia_css_vf_configure() warn: variable dereferenced before check 'binary' (see line 129) This test is wrong, as this fuction is only called by ia_css_binary_fill_info(), in a place that already assumes that binary is not null, and checks with: assert(binary != NULL); So, remove the useless broken extra check. Acked-by: Sakari Ailus Signed-off-by: Mauro Carvalho Chehab --- .../css2400/isp/kernels/vf/vf_1.0/ia_css_vf.host.c | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/drivers/staging/media/atomisp/pci/atomisp2/css2400/isp/kernels/vf/vf_1.0/ia_css_vf.host.c b/drivers/staging/media/atomisp/pci/atomisp2/css2400/isp/kernels/vf/vf_1.0/ia_css_vf.host.c index 5610833ed595..c2076e412410 100644 --- a/drivers/staging/media/atomisp/pci/atomisp2/css2400/isp/kernels/vf/vf_1.0/ia_css_vf.host.c +++ b/drivers/staging/media/atomisp/pci/atomisp2/css2400/isp/kernels/vf/vf_1.0/ia_css_vf.host.c @@ -130,11 +130,11 @@ ia_css_vf_configure( err = configure_kernel(info, out_info, vf_info, downscale_log2, &config); configure_dma(&config, vf_info); - if (binary) { - if (vf_info) - vf_info->raw_bit_depth = info->dma.vfdec_bits_per_pixel; - ia_css_configure_vf (binary, &config); - } + + if (vf_info) + vf_info->raw_bit_depth = info->dma.vfdec_bits_per_pixel; + ia_css_configure_vf (binary, &config); + return IA_CSS_SUCCESS; } From 517ac8c02b8454192a1e6250f1326338eaef3fc2 Mon Sep 17 00:00:00 2001 From: Mauro Carvalho Chehab Date: Mon, 26 Mar 2018 15:31:33 -0400 Subject: [PATCH 40/48] media: staging: atomisp: use %p to print pointers Instead of a converting pointers to unsigned long, just print them as-is, using %p. Fixes this warning: drivers/staging/media/atomisp/pci/atomisp2/css2400/runtime/debug/src/ia_css_debug.c:3012 ia_css_debug_pipe_graph_dump_sp_raw_copy() warn: argument 4 to %08lx specifier is cast from pointer Acked-by: Sakari Ailus Signed-off-by: Mauro Carvalho Chehab --- .../css2400/runtime/debug/src/ia_css_debug.c | 20 +++++++++---------- 1 file changed, 10 insertions(+), 10 deletions(-) diff --git a/drivers/staging/media/atomisp/pci/atomisp2/css2400/runtime/debug/src/ia_css_debug.c b/drivers/staging/media/atomisp/pci/atomisp2/css2400/runtime/debug/src/ia_css_debug.c index 60395904f89a..aa9a2d115265 100644 --- a/drivers/staging/media/atomisp/pci/atomisp2/css2400/runtime/debug/src/ia_css_debug.c +++ b/drivers/staging/media/atomisp/pci/atomisp2/css2400/runtime/debug/src/ia_css_debug.c @@ -2679,9 +2679,9 @@ ia_css_debug_pipe_graph_dump_frame( } dtrace_dot( "node [shape = box, " - "fixedsize=true, width=2, height=0.7]; \"0x%08lx\" " + "fixedsize=true, width=2, height=0.7]; \"%p\" " "[label = \"%s\\n%d(%d) x %d, %dbpp\\n%s\"];", - HOST_ADDRESS(frame), + frame, debug_frame_format2str(frame->info.format), frame->info.res.width, frame->info.padded_width, @@ -2691,16 +2691,16 @@ ia_css_debug_pipe_graph_dump_frame( if (in_frame) { dtrace_dot( - "\"0x%08lx\"->\"%s(pipe%d)\" " + "\"%p\"->\"%s(pipe%d)\" " "[label = %s_frame];", - HOST_ADDRESS(frame), + frame, blob_name, id, frame_name); } else { dtrace_dot( - "\"%s(pipe%d)\"->\"0x%08lx\" " + "\"%s(pipe%d)\"->\"%p\" " "[label = %s_frame];", blob_name, id, - HOST_ADDRESS(frame), + frame, frame_name); } } @@ -3011,9 +3011,9 @@ ia_css_debug_pipe_graph_dump_sp_raw_copy( snprintf(ring_buffer, sizeof(ring_buffer), "node [shape = box, " - "fixedsize=true, width=2, height=0.7]; \"0x%08lx\" " + "fixedsize=true, width=2, height=0.7]; \"%p\" " "[label = \"%s\\n%d(%d) x %d\\nRingbuffer\"];", - HOST_ADDRESS(out_frame), + out_frame, debug_frame_format2str(out_frame->info.format), out_frame->info.res.width, out_frame->info.padded_width, @@ -3022,9 +3022,9 @@ ia_css_debug_pipe_graph_dump_sp_raw_copy( dtrace_dot(ring_buffer); dtrace_dot( - "\"%s(pipe%d)\"->\"0x%08lx\" " + "\"%s(pipe%d)\"->\"%p\" " "[label = out_frame];", - "sp_raw_copy", 1, HOST_ADDRESS(out_frame)); + "sp_raw_copy", 1, out_frame); snprintf(dot_id_input_bin, sizeof(dot_id_input_bin), "%s(pipe%d)", "sp_raw_copy", 1); } From ddbd758f87b700603f281d47d8d14c576e35034a Mon Sep 17 00:00:00 2001 From: Mauro Carvalho Chehab Date: Mon, 26 Mar 2018 11:14:10 -0400 Subject: [PATCH 41/48] media: staging: atomisp: get rid of some static warnings Get rid of those warnings: drivers/staging/media/atomisp/pci/atomisp2/css2400/isp/kernels/tdf/tdf_1.0/ia_css_tdf.host.c:18:15: warning: symbol 'g_pyramid' was not declared. Should it be static? drivers/staging/media/atomisp/pci/atomisp2/mmu/sh_mmu_mrfld.c:66:23: warning: symbol 'sh_mmu_mrfld' was not declared. Should it be static? drivers/staging/media/atomisp/i2c/gc0310.h:381:26: warning: symbol 'gc0310_res_preview' was not declared. Should it be static? drivers/staging/media/atomisp/i2c/atomisp-gc0310.c:622:25: warning: symbol 'gc0310_controls' was not declared. Should it be static? drivers/staging/media/atomisp/i2c/ov2722.h:1099:26: warning: symbol 'ov2722_res_preview' was not declared. Should it be static? drivers/staging/media/atomisp/i2c/atomisp-ov2722.c:574:25: warning: symbol 'ov2722_controls' was not declared. Should it be static? drivers/staging/media/atomisp/i2c/atomisp-ov2680.c:727:25: warning: symbol 'ov2680_controls' was not declared. Should it be static? drivers/staging/media/atomisp/i2c/ov5693/ov5693.h:1090:26: warning: symbol 'ov5693_res_preview' was not declared. Should it be static? drivers/staging/media/atomisp/i2c/ov5693/atomisp-ov5693.c:958:5: warning: symbol 'ad5823_t_focus_abs' was not declared. Should it be static? drivers/staging/media/atomisp/i2c/ov5693/atomisp-ov5693.c:1139:25: warning: symbol 'ov5693_controls' was not declared. Should it be static? drivers/staging/media/atomisp/pci/atomisp2/atomisp_compat_css20.c:91:6: warning: symbol 'atomisp_css2_hw_store_8' was not declared. Should it be static? drivers/staging/media/atomisp/pci/atomisp2/atomisp_compat_css20.c:129:10: warning: symbol 'atomisp_css2_hw_load_16' was not declared. Should it be static? drivers/staging/media/atomisp/pci/atomisp2/atomisp_compat_css20.c:139:10: warning: symbol 'atomisp_css2_hw_load_32' was not declared. Should it be static? drivers/staging/media/atomisp/pci/atomisp2/atomisp_compat_css20.c:2868:14: warning: symbol 'atomisp_get_pipe_index' was not declared. Should it be static? drivers/staging/media/atomisp/pci/atomisp2/atomisp_cmd.c:5165:5: warning: symbol 'configure_pp_input_nop' was not declared. Should it be static? drivers/staging/media/atomisp/pci/atomisp2/atomisp_cmd.c:5171:5: warning: symbol 'configure_output_nop' was not declared. Should it be static? drivers/staging/media/atomisp/pci/atomisp2/atomisp_cmd.c:5179:5: warning: symbol 'get_frame_info_nop' was not declared. Should it be static? drivers/staging/media/atomisp/pci/atomisp2/atomisp_cmd.c:6630:5: warning: symbol 'atomisp_get_pipe_id' was not declared. Should it be static? drivers/staging/media/atomisp/pci/atomisp2/css2400/hive_isp_css_common/host/input_formatter.c:48:12: warning: symbol 'HIVE_IF_BIN_COPY' was not declared. Should it be static? drivers/staging/media/atomisp/pci/atomisp2/atomisp_ioctl.c:1610:6: warning: symbol '__wdt_on_master_slave_sensor' was not declared. Should it be static? Acked-by: Sakari Ailus Signed-off-by: Mauro Carvalho Chehab --- .../staging/media/atomisp/i2c/atomisp-gc0310.c | 2 +- .../staging/media/atomisp/i2c/atomisp-ov2680.c | 2 +- .../staging/media/atomisp/i2c/atomisp-ov2722.c | 2 +- drivers/staging/media/atomisp/i2c/gc0310.h | 3 +-- drivers/staging/media/atomisp/i2c/ov2722.h | 2 +- .../media/atomisp/i2c/ov5693/atomisp-ov5693.c | 4 ++-- .../staging/media/atomisp/i2c/ov5693/ov5693.h | 2 +- .../media/atomisp/pci/atomisp2/atomisp_cmd.c | 18 +++++++++--------- .../pci/atomisp2/atomisp_compat_css20.c | 11 ++++++----- .../media/atomisp/pci/atomisp2/atomisp_ioctl.c | 8 +++++--- .../hive_isp_css_common/host/input_formatter.c | 5 +++-- .../isp/kernels/tdf/tdf_1.0/ia_css_tdf.host.c | 2 +- .../atomisp/pci/atomisp2/mmu/sh_mmu_mrfld.c | 1 + 13 files changed, 33 insertions(+), 29 deletions(-) diff --git a/drivers/staging/media/atomisp/i2c/atomisp-gc0310.c b/drivers/staging/media/atomisp/i2c/atomisp-gc0310.c index 93753cb96180..512fa87fa11b 100644 --- a/drivers/staging/media/atomisp/i2c/atomisp-gc0310.c +++ b/drivers/staging/media/atomisp/i2c/atomisp-gc0310.c @@ -619,7 +619,7 @@ static const struct v4l2_ctrl_ops ctrl_ops = { .g_volatile_ctrl = gc0310_g_volatile_ctrl }; -struct v4l2_ctrl_config gc0310_controls[] = { +static const struct v4l2_ctrl_config gc0310_controls[] = { { .ops = &ctrl_ops, .id = V4L2_CID_EXPOSURE_ABSOLUTE, diff --git a/drivers/staging/media/atomisp/i2c/atomisp-ov2680.c b/drivers/staging/media/atomisp/i2c/atomisp-ov2680.c index 1d814bcb18b8..c0849299d592 100644 --- a/drivers/staging/media/atomisp/i2c/atomisp-ov2680.c +++ b/drivers/staging/media/atomisp/i2c/atomisp-ov2680.c @@ -724,7 +724,7 @@ static const struct v4l2_ctrl_ops ctrl_ops = { .g_volatile_ctrl = ov2680_g_volatile_ctrl }; -struct v4l2_ctrl_config ov2680_controls[] = { +static const struct v4l2_ctrl_config ov2680_controls[] = { { .ops = &ctrl_ops, .id = V4L2_CID_EXPOSURE_ABSOLUTE, diff --git a/drivers/staging/media/atomisp/i2c/atomisp-ov2722.c b/drivers/staging/media/atomisp/i2c/atomisp-ov2722.c index dc9a6d4f1824..a362eebd882f 100644 --- a/drivers/staging/media/atomisp/i2c/atomisp-ov2722.c +++ b/drivers/staging/media/atomisp/i2c/atomisp-ov2722.c @@ -571,7 +571,7 @@ static const struct v4l2_ctrl_ops ctrl_ops = { .g_volatile_ctrl = ov2722_g_volatile_ctrl }; -struct v4l2_ctrl_config ov2722_controls[] = { +static const struct v4l2_ctrl_config ov2722_controls[] = { { .ops = &ctrl_ops, .id = V4L2_CID_EXPOSURE_ABSOLUTE, diff --git a/drivers/staging/media/atomisp/i2c/gc0310.h b/drivers/staging/media/atomisp/i2c/gc0310.h index af6b11f6e5e7..70c252c5163c 100644 --- a/drivers/staging/media/atomisp/i2c/gc0310.h +++ b/drivers/staging/media/atomisp/i2c/gc0310.h @@ -377,8 +377,7 @@ static struct gc0310_reg const gc0310_VGA_30fps[] = { {GC0310_TOK_TERM, 0, 0}, }; - -struct gc0310_resolution gc0310_res_preview[] = { +static struct gc0310_resolution gc0310_res_preview[] = { { .desc = "gc0310_VGA_30fps", .width = 656, // 648, diff --git a/drivers/staging/media/atomisp/i2c/ov2722.h b/drivers/staging/media/atomisp/i2c/ov2722.h index 028b04aaaa8f..757b37613ccc 100644 --- a/drivers/staging/media/atomisp/i2c/ov2722.h +++ b/drivers/staging/media/atomisp/i2c/ov2722.h @@ -1096,7 +1096,7 @@ static struct ov2722_reg const ov2722_720p_30fps[] = { {OV2722_TOK_TERM, 0, 0}, }; -struct ov2722_resolution ov2722_res_preview[] = { +static struct ov2722_resolution ov2722_res_preview[] = { { .desc = "ov2722_1632_1092_30fps", .width = 1632, diff --git a/drivers/staging/media/atomisp/i2c/ov5693/atomisp-ov5693.c b/drivers/staging/media/atomisp/i2c/ov5693/atomisp-ov5693.c index e3a2a63c52cb..714297c36b3e 100644 --- a/drivers/staging/media/atomisp/i2c/ov5693/atomisp-ov5693.c +++ b/drivers/staging/media/atomisp/i2c/ov5693/atomisp-ov5693.c @@ -955,7 +955,7 @@ static int ad5823_t_focus_vcm(struct v4l2_subdev *sd, u16 val) return ret; } -int ad5823_t_focus_abs(struct v4l2_subdev *sd, s32 value) +static int ad5823_t_focus_abs(struct v4l2_subdev *sd, s32 value) { value = min(value, AD5823_MAX_FOCUS_POS); return ad5823_t_focus_vcm(sd, value); @@ -1136,7 +1136,7 @@ static const struct v4l2_ctrl_ops ctrl_ops = { .g_volatile_ctrl = ov5693_g_volatile_ctrl }; -struct v4l2_ctrl_config ov5693_controls[] = { +static const struct v4l2_ctrl_config ov5693_controls[] = { { .ops = &ctrl_ops, .id = V4L2_CID_EXPOSURE_ABSOLUTE, diff --git a/drivers/staging/media/atomisp/i2c/ov5693/ov5693.h b/drivers/staging/media/atomisp/i2c/ov5693/ov5693.h index 6d27dd849a62..9058a82455a6 100644 --- a/drivers/staging/media/atomisp/i2c/ov5693/ov5693.h +++ b/drivers/staging/media/atomisp/i2c/ov5693/ov5693.h @@ -1087,7 +1087,7 @@ static struct ov5693_reg const ov5693_2576x1936_30fps[] = { {OV5693_TOK_TERM, 0, 0} }; -struct ov5693_resolution ov5693_res_preview[] = { +static struct ov5693_resolution ov5693_res_preview[] = { { .desc = "ov5693_736x496_30fps", .width = 736, diff --git a/drivers/staging/media/atomisp/pci/atomisp2/atomisp_cmd.c b/drivers/staging/media/atomisp/pci/atomisp2/atomisp_cmd.c index 2f6c88a0f4ee..b1efbd4d2828 100644 --- a/drivers/staging/media/atomisp/pci/atomisp2/atomisp_cmd.c +++ b/drivers/staging/media/atomisp/pci/atomisp2/atomisp_cmd.c @@ -5162,22 +5162,22 @@ static int __enable_continuous_mode(struct atomisp_sub_device *asd, return atomisp_update_run_mode(asd); } -int configure_pp_input_nop(struct atomisp_sub_device *asd, - unsigned int width, unsigned int height) +static int configure_pp_input_nop(struct atomisp_sub_device *asd, + unsigned int width, unsigned int height) { return 0; } -int configure_output_nop(struct atomisp_sub_device *asd, - unsigned int width, unsigned int height, - unsigned int min_width, - enum atomisp_css_frame_format sh_fmt) +static int configure_output_nop(struct atomisp_sub_device *asd, + unsigned int width, unsigned int height, + unsigned int min_width, + enum atomisp_css_frame_format sh_fmt) { return 0; } -int get_frame_info_nop(struct atomisp_sub_device *asd, - struct atomisp_css_frame_info *finfo) +static int get_frame_info_nop(struct atomisp_sub_device *asd, + struct atomisp_css_frame_info *finfo) { return 0; } @@ -6627,7 +6627,7 @@ int atomisp_inject_a_fake_event(struct atomisp_sub_device *asd, int *event) return 0; } -int atomisp_get_pipe_id(struct atomisp_video_pipe *pipe) +static int atomisp_get_pipe_id(struct atomisp_video_pipe *pipe) { struct atomisp_sub_device *asd = pipe->asd; diff --git a/drivers/staging/media/atomisp/pci/atomisp2/atomisp_compat_css20.c b/drivers/staging/media/atomisp/pci/atomisp2/atomisp_compat_css20.c index b0e584b3cfc7..388b8a8a7009 100644 --- a/drivers/staging/media/atomisp/pci/atomisp2/atomisp_compat_css20.c +++ b/drivers/staging/media/atomisp/pci/atomisp2/atomisp_compat_css20.c @@ -88,7 +88,7 @@ unsigned int atomisp_css_debug_get_dtrace_level(void) return ia_css_debug_trace_level; } -void atomisp_css2_hw_store_8(hrt_address addr, uint8_t data) +static void atomisp_css2_hw_store_8(hrt_address addr, uint8_t data) { unsigned long flags; @@ -126,7 +126,7 @@ static uint8_t atomisp_css2_hw_load_8(hrt_address addr) return ret; } -uint16_t atomisp_css2_hw_load_16(hrt_address addr) +static uint16_t atomisp_css2_hw_load_16(hrt_address addr) { unsigned long flags; uint16_t ret; @@ -136,7 +136,8 @@ uint16_t atomisp_css2_hw_load_16(hrt_address addr) spin_unlock_irqrestore(&mmio_lock, flags); return ret; } -uint32_t atomisp_css2_hw_load_32(hrt_address addr) + +static uint32_t atomisp_css2_hw_load_32(hrt_address addr) { unsigned long flags; uint32_t ret; @@ -2865,8 +2866,8 @@ stream_err: return -EINVAL; } -unsigned int atomisp_get_pipe_index(struct atomisp_sub_device *asd, - uint16_t source_pad) +static unsigned int atomisp_get_pipe_index(struct atomisp_sub_device *asd, + uint16_t source_pad) { struct atomisp_device *isp = asd->isp; /* diff --git a/drivers/staging/media/atomisp/pci/atomisp2/atomisp_ioctl.c b/drivers/staging/media/atomisp/pci/atomisp2/atomisp_ioctl.c index 4222724347cc..61bd550dafb9 100644 --- a/drivers/staging/media/atomisp/pci/atomisp2/atomisp_ioctl.c +++ b/drivers/staging/media/atomisp/pci/atomisp2/atomisp_ioctl.c @@ -1607,10 +1607,12 @@ int atomisp_stream_on_master_slave_sensor(struct atomisp_device *isp, /* FIXME! */ #ifndef ISP2401 -void __wdt_on_master_slave_sensor(struct atomisp_device *isp, unsigned int wdt_duration) +static void __wdt_on_master_slave_sensor(struct atomisp_device *isp, + unsigned int wdt_duration) #else -void __wdt_on_master_slave_sensor(struct atomisp_video_pipe *pipe, - unsigned int wdt_duration, bool enable) +static void __wdt_on_master_slave_sensor(struct atomisp_video_pipe *pipe, + unsigned int wdt_duration, + bool enable) #endif { #ifndef ISP2401 diff --git a/drivers/staging/media/atomisp/pci/atomisp2/css2400/hive_isp_css_common/host/input_formatter.c b/drivers/staging/media/atomisp/pci/atomisp2/css2400/hive_isp_css_common/host/input_formatter.c index a8997e45738e..0e1ca995fb06 100644 --- a/drivers/staging/media/atomisp/pci/atomisp2/css2400/hive_isp_css_common/host/input_formatter.c +++ b/drivers/staging/media/atomisp/pci/atomisp2/css2400/hive_isp_css_common/host/input_formatter.c @@ -45,8 +45,9 @@ const uint8_t HIVE_IF_SWITCH_CODE[N_INPUT_FORMATTER_ID] = { HIVE_INPUT_SWITCH_SELECT_STR_TO_MEM}; /* MW Should be part of system_global.h, where we have the main enumeration */ -const bool HIVE_IF_BIN_COPY[N_INPUT_FORMATTER_ID] = { - false, false, false, true}; +static const bool HIVE_IF_BIN_COPY[N_INPUT_FORMATTER_ID] = { + false, false, false, true +}; void input_formatter_rst( const input_formatter_ID_t ID) diff --git a/drivers/staging/media/atomisp/pci/atomisp2/css2400/isp/kernels/tdf/tdf_1.0/ia_css_tdf.host.c b/drivers/staging/media/atomisp/pci/atomisp2/css2400/isp/kernels/tdf/tdf_1.0/ia_css_tdf.host.c index e775af51c0c0..78a113bfe8f1 100644 --- a/drivers/staging/media/atomisp/pci/atomisp2/css2400/isp/kernels/tdf/tdf_1.0/ia_css_tdf.host.c +++ b/drivers/staging/media/atomisp/pci/atomisp2/css2400/isp/kernels/tdf/tdf_1.0/ia_css_tdf.host.c @@ -15,7 +15,7 @@ #include "ia_css_debug.h" #include "ia_css_tdf.host.h" -const int16_t g_pyramid[8][8] = { +static const int16_t g_pyramid[8][8] = { {128, 384, 640, 896, 896, 640, 384, 128}, {384, 1152, 1920, 2688, 2688, 1920, 1152, 384}, {640, 1920, 3200, 4480, 4480, 3200, 1920, 640}, diff --git a/drivers/staging/media/atomisp/pci/atomisp2/mmu/sh_mmu_mrfld.c b/drivers/staging/media/atomisp/pci/atomisp2/mmu/sh_mmu_mrfld.c index 4cbf907bd07b..c0212564b7c8 100644 --- a/drivers/staging/media/atomisp/pci/atomisp2/mmu/sh_mmu_mrfld.c +++ b/drivers/staging/media/atomisp/pci/atomisp2/mmu/sh_mmu_mrfld.c @@ -18,6 +18,7 @@ */ #include "type_support.h" #include "mmu/isp_mmu.h" +#include "mmu/sh_mmu_mrfld.h" #include "memory_access/memory_access.h" #include "atomisp_compat.h" From fd418c8a598511865d8b2774bce58bb4b1f5d962 Mon Sep 17 00:00:00 2001 From: Mauro Carvalho Chehab Date: Mon, 26 Mar 2018 16:08:34 -0400 Subject: [PATCH 42/48] media: staging: atomisp: stop mixing enum types This driver abuses on enum types: drivers/staging/media/atomisp/pci/atomisp2/atomisp_compat_css20.c:1027:37: warning: mixing different enum types drivers/staging/media/atomisp/pci/atomisp2/atomisp_compat_css20.c:1027:37: int enum ia_css_csi2_port versus drivers/staging/media/atomisp/pci/atomisp2/atomisp_compat_css20.c:1027:37: int enum mipi_port_ID_t drivers/staging/media/atomisp/pci/atomisp2/atomisp_compat_css20.c:1037:39: warning: mixing different enum types drivers/staging/media/atomisp/pci/atomisp2/atomisp_compat_css20.c:1037:39: int enum ia_css_csi2_port versus drivers/staging/media/atomisp/pci/atomisp2/atomisp_compat_css20.c:1037:39: int enum mipi_port_ID_t drivers/staging/media/atomisp/pci/atomisp2/atomisp_compat_css20.c:2147:62: warning: mixing different enum types drivers/staging/media/atomisp/pci/atomisp2/atomisp_compat_css20.c:2147:62: int enum mipi_port_ID_t versus drivers/staging/media/atomisp/pci/atomisp2/atomisp_compat_css20.c:2147:62: int enum ia_css_csi2_port Doing some "implicit" typecast. Fix it by using just one enum everywhere, and stopping using typedef to refer to it. Acked-by: Sakari Ailus Signed-off-by: Mauro Carvalho Chehab --- .../media/atomisp/pci/atomisp2/atomisp_cmd.c | 10 +++--- .../media/atomisp/pci/atomisp2/atomisp_cmd.h | 2 +- .../atomisp/pci/atomisp2/atomisp_compat.h | 6 ++-- .../pci/atomisp2/atomisp_compat_css20.c | 6 ++-- .../css_2401_csi2p_system/system_global.h | 4 +-- .../hive_isp_css_common/host/input_system.c | 20 +++++------ .../host/input_system_local.h | 2 +- .../host/input_system_private.h | 4 +-- .../hive_isp_css_common/system_global.h | 4 +-- .../host/input_system_public.h | 14 ++++---- .../pci/atomisp2/css2400/ia_css_input_port.h | 20 ++++------- .../atomisp/pci/atomisp2/css2400/ia_css_irq.h | 4 +-- .../pci/atomisp2/css2400/ia_css_mipi.h | 2 +- .../css2400/runtime/ifmtr/src/ifmtr.c | 4 +-- .../runtime/isys/interface/ia_css_isys.h | 16 ++++----- .../css2400/runtime/isys/src/csi_rx_rmgr.c | 4 +-- .../atomisp2/css2400/runtime/isys/src/rx.c | 36 +++++++++---------- .../css2400/runtime/pipeline/src/pipeline.c | 4 +-- .../atomisp/pci/atomisp2/css2400/sh_css.c | 30 ++++++++-------- .../pci/atomisp2/css2400/sh_css_mipi.c | 2 +- .../atomisp/pci/atomisp2/css2400/sh_css_sp.c | 2 +- .../atomisp/pci/atomisp2/css2400/sh_css_sp.h | 2 +- 22 files changed, 96 insertions(+), 102 deletions(-) diff --git a/drivers/staging/media/atomisp/pci/atomisp2/atomisp_cmd.c b/drivers/staging/media/atomisp/pci/atomisp2/atomisp_cmd.c index b1efbd4d2828..fa6ea506f8b1 100644 --- a/drivers/staging/media/atomisp/pci/atomisp2/atomisp_cmd.c +++ b/drivers/staging/media/atomisp/pci/atomisp2/atomisp_cmd.c @@ -437,7 +437,7 @@ static void atomisp_reset_event(struct atomisp_sub_device *asd) } -static void print_csi_rx_errors(enum ia_css_csi2_port port, +static void print_csi_rx_errors(enum mipi_port_id port, struct atomisp_device *isp) { u32 infos = 0; @@ -481,7 +481,7 @@ static void clear_irq_reg(struct atomisp_device *isp) } static struct atomisp_sub_device * -__get_asd_from_port(struct atomisp_device *isp, mipi_port_ID_t port) +__get_asd_from_port(struct atomisp_device *isp, enum mipi_port_id port) { int i; @@ -570,9 +570,9 @@ irqreturn_t atomisp_isr(int irq, void *dev) (irq_infos & CSS_IRQ_INFO_IF_ERROR)) { /* handle mipi receiver error */ u32 rx_infos; - enum ia_css_csi2_port port; + enum mipi_port_id port; - for (port = IA_CSS_CSI2_PORT0; port <= IA_CSS_CSI2_PORT2; + for (port = MIPI_PORT0_ID; port <= MIPI_PORT2_ID; port++) { print_csi_rx_errors(port, isp); atomisp_css_rx_get_irq_info(port, &rx_infos); @@ -5028,7 +5028,7 @@ atomisp_try_fmt_file(struct atomisp_device *isp, struct v4l2_format *f) return 0; } -mipi_port_ID_t __get_mipi_port(struct atomisp_device *isp, +enum mipi_port_id __get_mipi_port(struct atomisp_device *isp, enum atomisp_camera_port port) { switch (port) { diff --git a/drivers/staging/media/atomisp/pci/atomisp2/atomisp_cmd.h b/drivers/staging/media/atomisp/pci/atomisp2/atomisp_cmd.h index bdc73862fb79..79d493dba403 100644 --- a/drivers/staging/media/atomisp/pci/atomisp2/atomisp_cmd.h +++ b/drivers/staging/media/atomisp/pci/atomisp2/atomisp_cmd.h @@ -389,7 +389,7 @@ int atomisp_source_pad_to_stream_id(struct atomisp_sub_device *asd, */ void atomisp_eof_event(struct atomisp_sub_device *asd, uint8_t exp_id); -mipi_port_ID_t __get_mipi_port(struct atomisp_device *isp, +enum mipi_port_id __get_mipi_port(struct atomisp_device *isp, enum atomisp_camera_port port); bool atomisp_is_vf_pipe(struct atomisp_video_pipe *pipe); diff --git a/drivers/staging/media/atomisp/pci/atomisp2/atomisp_compat.h b/drivers/staging/media/atomisp/pci/atomisp2/atomisp_compat.h index 398ee02229f8..1567572e5b49 100644 --- a/drivers/staging/media/atomisp/pci/atomisp2/atomisp_compat.h +++ b/drivers/staging/media/atomisp/pci/atomisp2/atomisp_compat.h @@ -148,10 +148,10 @@ void atomisp_css_init_struct(struct atomisp_sub_device *asd); int atomisp_css_irq_translate(struct atomisp_device *isp, unsigned int *infos); -void atomisp_css_rx_get_irq_info(enum ia_css_csi2_port port, +void atomisp_css_rx_get_irq_info(enum mipi_port_id port, unsigned int *infos); -void atomisp_css_rx_clear_irq_info(enum ia_css_csi2_port port, +void atomisp_css_rx_clear_irq_info(enum mipi_port_id port, unsigned int infos); int atomisp_css_irq_enable(struct atomisp_device *isp, @@ -332,7 +332,7 @@ void atomisp_css_enable_cvf(struct atomisp_sub_device *asd, bool enable); int atomisp_css_input_configure_port(struct atomisp_sub_device *asd, - mipi_port_ID_t port, + enum mipi_port_id port, unsigned int num_lanes, unsigned int timeout, unsigned int mipi_freq, diff --git a/drivers/staging/media/atomisp/pci/atomisp2/atomisp_compat_css20.c b/drivers/staging/media/atomisp/pci/atomisp2/atomisp_compat_css20.c index 388b8a8a7009..d9c8c202fd81 100644 --- a/drivers/staging/media/atomisp/pci/atomisp2/atomisp_compat_css20.c +++ b/drivers/staging/media/atomisp/pci/atomisp2/atomisp_compat_css20.c @@ -1020,7 +1020,7 @@ int atomisp_css_irq_translate(struct atomisp_device *isp, return 0; } -void atomisp_css_rx_get_irq_info(enum ia_css_csi2_port port, +void atomisp_css_rx_get_irq_info(enum mipi_port_id port, unsigned int *infos) { #ifndef ISP2401_NEW_INPUT_SYSTEM @@ -1030,7 +1030,7 @@ void atomisp_css_rx_get_irq_info(enum ia_css_csi2_port port, #endif } -void atomisp_css_rx_clear_irq_info(enum ia_css_csi2_port port, +void atomisp_css_rx_clear_irq_info(enum mipi_port_id port, unsigned int infos) { #ifndef ISP2401_NEW_INPUT_SYSTEM @@ -2118,7 +2118,7 @@ void atomisp_css_enable_cvf(struct atomisp_sub_device *asd, int atomisp_css_input_configure_port( struct atomisp_sub_device *asd, - mipi_port_ID_t port, + enum mipi_port_id port, unsigned int num_lanes, unsigned int timeout, unsigned int mipi_freq, diff --git a/drivers/staging/media/atomisp/pci/atomisp2/css2400/css_2401_csi2p_system/system_global.h b/drivers/staging/media/atomisp/pci/atomisp2/css2400/css_2401_csi2p_system/system_global.h index d2e3a2deea2e..7907f0ff6d6c 100644 --- a/drivers/staging/media/atomisp/pci/atomisp2/css2400/css_2401_csi2p_system/system_global.h +++ b/drivers/staging/media/atomisp/pci/atomisp2/css2400/css_2401_csi2p_system/system_global.h @@ -284,12 +284,12 @@ typedef enum { N_RX_ID } rx_ID_t; -typedef enum { +enum mipi_port_id { MIPI_PORT0_ID = 0, MIPI_PORT1_ID, MIPI_PORT2_ID, N_MIPI_PORT_ID -} mipi_port_ID_t; +}; #define N_RX_CHANNEL_ID 4 diff --git a/drivers/staging/media/atomisp/pci/atomisp2/css2400/hive_isp_css_common/host/input_system.c b/drivers/staging/media/atomisp/pci/atomisp2/css2400/hive_isp_css_common/host/input_system.c index c9cb8e0621e5..2515e162828f 100644 --- a/drivers/staging/media/atomisp/pci/atomisp2/css2400/hive_isp_css_common/host/input_system.c +++ b/drivers/staging/media/atomisp/pci/atomisp2/css2400/hive_isp_css_common/host/input_system.c @@ -98,7 +98,7 @@ static inline void ctrl_unit_get_state( static inline void mipi_port_get_state( const rx_ID_t ID, - const mipi_port_ID_t port_ID, + const enum mipi_port_id port_ID, mipi_port_state_t *state); static inline void rx_channel_get_state( @@ -180,7 +180,7 @@ void receiver_get_state( const rx_ID_t ID, receiver_state_t *state) { - mipi_port_ID_t port_id; + enum mipi_port_id port_id; unsigned int ch_id; assert(ID < N_RX_ID); @@ -209,7 +209,7 @@ void receiver_get_state( state->raw16 = (uint16_t)receiver_reg_load(ID, _HRT_CSS_RECEIVER_RAW16_REG_IDX); - for (port_id = (mipi_port_ID_t)0; port_id < N_MIPI_PORT_ID; port_id++) { + for (port_id = (enum mipi_port_id)0; port_id < N_MIPI_PORT_ID; port_id++) { mipi_port_get_state(ID, port_id, &(state->mipi_port_state[port_id])); } @@ -305,7 +305,7 @@ void receiver_set_compression( void receiver_port_enable( const rx_ID_t ID, - const mipi_port_ID_t port_ID, + const enum mipi_port_id port_ID, const bool cnd) { hrt_data reg = receiver_port_reg_load(ID, port_ID, @@ -324,7 +324,7 @@ void receiver_port_enable( bool is_receiver_port_enabled( const rx_ID_t ID, - const mipi_port_ID_t port_ID) + const enum mipi_port_id port_ID) { hrt_data reg = receiver_port_reg_load(ID, port_ID, _HRT_CSS_RECEIVER_DEVICE_READY_REG_IDX); @@ -333,7 +333,7 @@ bool is_receiver_port_enabled( void receiver_irq_enable( const rx_ID_t ID, - const mipi_port_ID_t port_ID, + const enum mipi_port_id port_ID, const rx_irq_info_t irq_info) { receiver_port_reg_store(ID, @@ -343,7 +343,7 @@ void receiver_irq_enable( rx_irq_info_t receiver_get_irq_info( const rx_ID_t ID, - const mipi_port_ID_t port_ID) + const enum mipi_port_id port_ID) { return receiver_port_reg_load(ID, port_ID, _HRT_CSS_RECEIVER_IRQ_STATUS_REG_IDX); @@ -351,7 +351,7 @@ rx_irq_info_t receiver_get_irq_info( void receiver_irq_clear( const rx_ID_t ID, - const mipi_port_ID_t port_ID, + const enum mipi_port_id port_ID, const rx_irq_info_t irq_info) { receiver_port_reg_store(ID, @@ -556,7 +556,7 @@ static inline void ctrl_unit_get_state( static inline void mipi_port_get_state( const rx_ID_t ID, - const mipi_port_ID_t port_ID, + const enum mipi_port_id port_ID, mipi_port_state_t *state) { int i; @@ -649,7 +649,7 @@ static input_system_cfg2400_t config; static void receiver_rst( const rx_ID_t ID) { - mipi_port_ID_t port_id; + enum mipi_port_id port_id; assert(ID < N_RX_ID); diff --git a/drivers/staging/media/atomisp/pci/atomisp2/css2400/hive_isp_css_common/host/input_system_local.h b/drivers/staging/media/atomisp/pci/atomisp2/css2400/hive_isp_css_common/host/input_system_local.h index 3e8bd00082dc..bf9230fd08f2 100644 --- a/drivers/staging/media/atomisp/pci/atomisp2/css2400/hive_isp_css_common/host/input_system_local.h +++ b/drivers/staging/media/atomisp/pci/atomisp2/css2400/hive_isp_css_common/host/input_system_local.h @@ -353,7 +353,7 @@ typedef struct rx_cfg_s rx_cfg_t; */ struct rx_cfg_s { rx_mode_t mode; /* The HW config */ - mipi_port_ID_t port; /* The port ID to apply the control on */ + enum mipi_port_id port; /* The port ID to apply the control on */ unsigned int timeout; unsigned int initcount; unsigned int synccount; diff --git a/drivers/staging/media/atomisp/pci/atomisp2/css2400/hive_isp_css_common/host/input_system_private.h b/drivers/staging/media/atomisp/pci/atomisp2/css2400/hive_isp_css_common/host/input_system_private.h index 118185eb86e9..48876bb08b70 100644 --- a/drivers/staging/media/atomisp/pci/atomisp2/css2400/hive_isp_css_common/host/input_system_private.h +++ b/drivers/staging/media/atomisp/pci/atomisp2/css2400/hive_isp_css_common/host/input_system_private.h @@ -63,7 +63,7 @@ STORAGE_CLASS_INPUT_SYSTEM_C hrt_data receiver_reg_load( STORAGE_CLASS_INPUT_SYSTEM_C void receiver_port_reg_store( const rx_ID_t ID, - const mipi_port_ID_t port_ID, + const enum mipi_port_id port_ID, const hrt_address reg, const hrt_data value) { @@ -77,7 +77,7 @@ STORAGE_CLASS_INPUT_SYSTEM_C void receiver_port_reg_store( STORAGE_CLASS_INPUT_SYSTEM_C hrt_data receiver_port_reg_load( const rx_ID_t ID, - const mipi_port_ID_t port_ID, + const enum mipi_port_id port_ID, const hrt_address reg) { assert(ID < N_RX_ID); diff --git a/drivers/staging/media/atomisp/pci/atomisp2/css2400/hive_isp_css_common/system_global.h b/drivers/staging/media/atomisp/pci/atomisp2/css2400/hive_isp_css_common/system_global.h index d803efd7400a..6f63962a54e8 100644 --- a/drivers/staging/media/atomisp/pci/atomisp2/css2400/hive_isp_css_common/system_global.h +++ b/drivers/staging/media/atomisp/pci/atomisp2/css2400/hive_isp_css_common/system_global.h @@ -266,12 +266,12 @@ typedef enum { N_RX_ID } rx_ID_t; -typedef enum { +enum mipi_port_id { MIPI_PORT0_ID = 0, MIPI_PORT1_ID, MIPI_PORT2_ID, N_MIPI_PORT_ID -} mipi_port_ID_t; +}; #define N_RX_CHANNEL_ID 4 diff --git a/drivers/staging/media/atomisp/pci/atomisp2/css2400/hive_isp_css_include/host/input_system_public.h b/drivers/staging/media/atomisp/pci/atomisp2/css2400/hive_isp_css_include/host/input_system_public.h index 1596757fe9ef..6e37ff0fe0f9 100644 --- a/drivers/staging/media/atomisp/pci/atomisp2/css2400/hive_isp_css_include/host/input_system_public.h +++ b/drivers/staging/media/atomisp/pci/atomisp2/css2400/hive_isp_css_include/host/input_system_public.h @@ -83,7 +83,7 @@ extern void receiver_set_compression( */ extern void receiver_port_enable( const rx_ID_t ID, - const mipi_port_ID_t port_ID, + const enum mipi_port_id port_ID, const bool cnd); /*! Flag if PORT[port_ID] of RECEIVER[ID] is enabled @@ -95,7 +95,7 @@ extern void receiver_port_enable( */ extern bool is_receiver_port_enabled( const rx_ID_t ID, - const mipi_port_ID_t port_ID); + const enum mipi_port_id port_ID); /*! Enable the IRQ channels of PORT[port_ID] of RECEIVER[ID] @@ -107,7 +107,7 @@ extern bool is_receiver_port_enabled( */ extern void receiver_irq_enable( const rx_ID_t ID, - const mipi_port_ID_t port_ID, + const enum mipi_port_id port_ID, const rx_irq_info_t irq_info); /*! Return the IRQ status of PORT[port_ID] of RECEIVER[ID] @@ -119,7 +119,7 @@ extern void receiver_irq_enable( */ extern rx_irq_info_t receiver_get_irq_info( const rx_ID_t ID, - const mipi_port_ID_t port_ID); + const enum mipi_port_id port_ID); /*! Clear the IRQ status of PORT[port_ID] of RECEIVER[ID] @@ -131,7 +131,7 @@ extern rx_irq_info_t receiver_get_irq_info( */ extern void receiver_irq_clear( const rx_ID_t ID, - const mipi_port_ID_t port_ID, + const enum mipi_port_id port_ID, const rx_irq_info_t irq_info); /*! Write to a control register of INPUT_SYSTEM[ID] @@ -195,7 +195,7 @@ STORAGE_CLASS_INPUT_SYSTEM_H hrt_data receiver_reg_load( */ STORAGE_CLASS_INPUT_SYSTEM_H void receiver_port_reg_store( const rx_ID_t ID, - const mipi_port_ID_t port_ID, + const enum mipi_port_id port_ID, const hrt_address reg, const hrt_data value); @@ -210,7 +210,7 @@ STORAGE_CLASS_INPUT_SYSTEM_H void receiver_port_reg_store( */ STORAGE_CLASS_INPUT_SYSTEM_H hrt_data receiver_port_reg_load( const rx_ID_t ID, - const mipi_port_ID_t port_ID, + const enum mipi_port_id port_ID, const hrt_address reg); /*! Write to a control register of SUB_SYSTEM[sub_ID] of INPUT_SYSTEM[ID] diff --git a/drivers/staging/media/atomisp/pci/atomisp2/css2400/ia_css_input_port.h b/drivers/staging/media/atomisp/pci/atomisp2/css2400/ia_css_input_port.h index f415570a3da9..ad9ca5449369 100644 --- a/drivers/staging/media/atomisp/pci/atomisp2/css2400/ia_css_input_port.h +++ b/drivers/staging/media/atomisp/pci/atomisp2/css2400/ia_css_input_port.h @@ -12,6 +12,9 @@ * more details. */ +/* For MIPI_PORT0_ID to MIPI_PORT2_ID */ +#include "system_global.h" + #ifndef __IA_CSS_INPUT_PORT_H #define __IA_CSS_INPUT_PORT_H @@ -19,21 +22,12 @@ * This file contains information about the possible input ports for CSS */ -/* Enumeration of the physical input ports on the CSS hardware. - * There are 3 MIPI CSI-2 ports. - */ -enum ia_css_csi2_port { - IA_CSS_CSI2_PORT0, /* Implicitly map to MIPI_PORT0_ID */ - IA_CSS_CSI2_PORT1, /* Implicitly map to MIPI_PORT1_ID */ - IA_CSS_CSI2_PORT2 /* Implicitly map to MIPI_PORT2_ID */ -}; - /* Backward compatible for CSS API 2.0 only * TO BE REMOVED when all drivers move to CSS API 2.1 */ -#define IA_CSS_CSI2_PORT_4LANE IA_CSS_CSI2_PORT0 -#define IA_CSS_CSI2_PORT_1LANE IA_CSS_CSI2_PORT1 -#define IA_CSS_CSI2_PORT_2LANE IA_CSS_CSI2_PORT2 +#define IA_CSS_CSI2_PORT_4LANE MIPI_PORT0_ID +#define IA_CSS_CSI2_PORT_1LANE MIPI_PORT1_ID +#define IA_CSS_CSI2_PORT_2LANE MIPI_PORT2_ID /* The CSI2 interface supports 2 types of compression or can * be run without compression. @@ -56,7 +50,7 @@ struct ia_css_csi2_compression { /* Input port structure. */ struct ia_css_input_port { - enum ia_css_csi2_port port; /** Physical CSI-2 port */ + enum mipi_port_id port; /** Physical CSI-2 port */ unsigned int num_lanes; /** Number of lanes used (4-lane port only) */ unsigned int timeout; /** Timeout value */ unsigned int rxcount; /** Register value, should include all lanes */ diff --git a/drivers/staging/media/atomisp/pci/atomisp2/css2400/ia_css_irq.h b/drivers/staging/media/atomisp/pci/atomisp2/css2400/ia_css_irq.h index 10ef61178bb2..c8840138899a 100644 --- a/drivers/staging/media/atomisp/pci/atomisp2/css2400/ia_css_irq.h +++ b/drivers/staging/media/atomisp/pci/atomisp2/css2400/ia_css_irq.h @@ -186,7 +186,7 @@ ia_css_rx_get_irq_info(unsigned int *irq_bits); * that occurred. */ void -ia_css_rx_port_get_irq_info(enum ia_css_csi2_port port, unsigned int *irq_bits); +ia_css_rx_port_get_irq_info(enum mipi_port_id port, unsigned int *irq_bits); /* @brief Clear CSI receiver error info. * @@ -218,7 +218,7 @@ ia_css_rx_clear_irq_info(unsigned int irq_bits); * error bits get overwritten. */ void -ia_css_rx_port_clear_irq_info(enum ia_css_csi2_port port, unsigned int irq_bits); +ia_css_rx_port_clear_irq_info(enum mipi_port_id port, unsigned int irq_bits); /* @brief Enable or disable specific interrupts. * diff --git a/drivers/staging/media/atomisp/pci/atomisp2/css2400/ia_css_mipi.h b/drivers/staging/media/atomisp/pci/atomisp2/css2400/ia_css_mipi.h index f9c9cd76be97..05170c4487eb 100644 --- a/drivers/staging/media/atomisp/pci/atomisp2/css2400/ia_css_mipi.h +++ b/drivers/staging/media/atomisp/pci/atomisp2/css2400/ia_css_mipi.h @@ -55,7 +55,7 @@ ia_css_mipi_frame_specify(const unsigned int size_mem_words, * */ enum ia_css_err -ia_css_mipi_frame_enable_check_on_size(const enum ia_css_csi2_port port, +ia_css_mipi_frame_enable_check_on_size(const enum mipi_port_id port, const unsigned int size_mem_words); #endif diff --git a/drivers/staging/media/atomisp/pci/atomisp2/css2400/runtime/ifmtr/src/ifmtr.c b/drivers/staging/media/atomisp/pci/atomisp2/css2400/runtime/ifmtr/src/ifmtr.c index adefa57820a4..c031c70aee9b 100644 --- a/drivers/staging/media/atomisp/pci/atomisp2/css2400/runtime/ifmtr/src/ifmtr.c +++ b/drivers/staging/media/atomisp/pci/atomisp2/css2400/runtime/ifmtr/src/ifmtr.c @@ -118,7 +118,7 @@ enum ia_css_err ia_css_ifmtr_configure(struct ia_css_stream_config *config, /* Determine which input formatter config set is targeted. */ /* Index is equal to the CSI-2 port used. */ - enum ia_css_csi2_port port; + enum mipi_port_id port; if (binary) { cropped_height = binary->in_frame_info.res.height; @@ -141,7 +141,7 @@ enum ia_css_err ia_css_ifmtr_configure(struct ia_css_stream_config *config, if (config->mode == IA_CSS_INPUT_MODE_SENSOR || config->mode == IA_CSS_INPUT_MODE_BUFFERED_SENSOR) { port = config->source.port.port; - if_config_index = (uint8_t) (port - IA_CSS_CSI2_PORT0); + if_config_index = (uint8_t) (port - MIPI_PORT0_ID); } else if (config->mode == IA_CSS_INPUT_MODE_MEMORY) { if_config_index = SH_CSS_IF_CONFIG_NOT_NEEDED; } else { diff --git a/drivers/staging/media/atomisp/pci/atomisp2/css2400/runtime/isys/interface/ia_css_isys.h b/drivers/staging/media/atomisp/pci/atomisp2/css2400/runtime/isys/interface/ia_css_isys.h index 4cf2defe9ef0..5f5ee28a157f 100644 --- a/drivers/staging/media/atomisp/pci/atomisp2/css2400/runtime/isys/interface/ia_css_isys.h +++ b/drivers/staging/media/atomisp/pci/atomisp2/css2400/runtime/isys/interface/ia_css_isys.h @@ -50,8 +50,8 @@ typedef input_system_cfg_t ia_css_isys_descr_t; #if defined(USE_INPUT_SYSTEM_VERSION_2) || defined(USE_INPUT_SYSTEM_VERSION_2401) input_system_error_t ia_css_isys_init(void); void ia_css_isys_uninit(void); -mipi_port_ID_t ia_css_isys_port_to_mipi_port( - enum ia_css_csi2_port api_port); +enum mipi_port_id ia_css_isys_port_to_mipi_port( + enum mipi_port_id api_port); #endif #if defined(USE_INPUT_SYSTEM_VERSION_2401) @@ -68,7 +68,7 @@ mipi_port_ID_t ia_css_isys_port_to_mipi_port( * there is already a stream registered with the same handle */ enum ia_css_err ia_css_isys_csi_rx_register_stream( - enum ia_css_csi2_port port, + enum mipi_port_id port, uint32_t isys_stream_id); /** @@ -83,7 +83,7 @@ enum ia_css_err ia_css_isys_csi_rx_register_stream( * there is no stream registered with that handle */ enum ia_css_err ia_css_isys_csi_rx_unregister_stream( - enum ia_css_csi2_port port, + enum mipi_port_id port, uint32_t isys_stream_id); enum ia_css_err ia_css_isys_convert_compressed_format( @@ -101,12 +101,12 @@ void ia_css_isys_rx_configure( void ia_css_isys_rx_disable(void); -void ia_css_isys_rx_enable_all_interrupts(mipi_port_ID_t port); +void ia_css_isys_rx_enable_all_interrupts(enum mipi_port_id port); -unsigned int ia_css_isys_rx_get_interrupt_reg(mipi_port_ID_t port); -void ia_css_isys_rx_get_irq_info(mipi_port_ID_t port, +unsigned int ia_css_isys_rx_get_interrupt_reg(enum mipi_port_id port); +void ia_css_isys_rx_get_irq_info(enum mipi_port_id port, unsigned int *irq_infos); -void ia_css_isys_rx_clear_irq_info(mipi_port_ID_t port, +void ia_css_isys_rx_clear_irq_info(enum mipi_port_id port, unsigned int irq_infos); unsigned int ia_css_isys_rx_translate_irq_infos(unsigned int bits); diff --git a/drivers/staging/media/atomisp/pci/atomisp2/css2400/runtime/isys/src/csi_rx_rmgr.c b/drivers/staging/media/atomisp/pci/atomisp2/css2400/runtime/isys/src/csi_rx_rmgr.c index 3b04dc51335a..a914ce5532ec 100644 --- a/drivers/staging/media/atomisp/pci/atomisp2/css2400/runtime/isys/src/csi_rx_rmgr.c +++ b/drivers/staging/media/atomisp/pci/atomisp2/css2400/runtime/isys/src/csi_rx_rmgr.c @@ -141,7 +141,7 @@ void ia_css_isys_csi_rx_lut_rmgr_release( } enum ia_css_err ia_css_isys_csi_rx_register_stream( - enum ia_css_csi2_port port, + enum mipi_port_id port, uint32_t isys_stream_id) { enum ia_css_err retval = IA_CSS_ERR_INTERNAL_ERROR; @@ -160,7 +160,7 @@ enum ia_css_err ia_css_isys_csi_rx_register_stream( } enum ia_css_err ia_css_isys_csi_rx_unregister_stream( - enum ia_css_csi2_port port, + enum mipi_port_id port, uint32_t isys_stream_id) { enum ia_css_err retval = IA_CSS_ERR_INTERNAL_ERROR; diff --git a/drivers/staging/media/atomisp/pci/atomisp2/css2400/runtime/isys/src/rx.c b/drivers/staging/media/atomisp/pci/atomisp2/css2400/runtime/isys/src/rx.c index 70f6cb5e5918..65ddff137291 100644 --- a/drivers/staging/media/atomisp/pci/atomisp2/css2400/runtime/isys/src/rx.c +++ b/drivers/staging/media/atomisp/pci/atomisp2/css2400/runtime/isys/src/rx.c @@ -36,7 +36,7 @@ more details. #include "sh_css_internal.h" #if !defined(USE_INPUT_SYSTEM_VERSION_2401) -void ia_css_isys_rx_enable_all_interrupts(mipi_port_ID_t port) +void ia_css_isys_rx_enable_all_interrupts(enum mipi_port_id port) { hrt_data bits = receiver_port_reg_load(RX0_ID, port, @@ -80,22 +80,22 @@ void ia_css_isys_rx_enable_all_interrupts(mipi_port_ID_t port) * initializers in Windows. Without that there is no easy way to guarantee * that the array values would be in the correct order. * */ -mipi_port_ID_t ia_css_isys_port_to_mipi_port(enum ia_css_csi2_port api_port) +enum mipi_port_id ia_css_isys_port_to_mipi_port(enum mipi_port_id api_port) { /* In this module the validity of the inptu variable should * have been checked already, so we do not check for erroneous * values. */ - mipi_port_ID_t port = MIPI_PORT0_ID; + enum mipi_port_id port = MIPI_PORT0_ID; - if (api_port == IA_CSS_CSI2_PORT1) + if (api_port == MIPI_PORT1_ID) port = MIPI_PORT1_ID; - else if (api_port == IA_CSS_CSI2_PORT2) + else if (api_port == MIPI_PORT2_ID) port = MIPI_PORT2_ID; return port; } -unsigned int ia_css_isys_rx_get_interrupt_reg(mipi_port_ID_t port) +unsigned int ia_css_isys_rx_get_interrupt_reg(enum mipi_port_id port) { return receiver_port_reg_load(RX0_ID, port, @@ -104,17 +104,17 @@ unsigned int ia_css_isys_rx_get_interrupt_reg(mipi_port_ID_t port) void ia_css_rx_get_irq_info(unsigned int *irq_infos) { - ia_css_rx_port_get_irq_info(IA_CSS_CSI2_PORT1, irq_infos); + ia_css_rx_port_get_irq_info(MIPI_PORT1_ID, irq_infos); } -void ia_css_rx_port_get_irq_info(enum ia_css_csi2_port api_port, +void ia_css_rx_port_get_irq_info(enum mipi_port_id api_port, unsigned int *irq_infos) { - mipi_port_ID_t port = ia_css_isys_port_to_mipi_port(api_port); + enum mipi_port_id port = ia_css_isys_port_to_mipi_port(api_port); ia_css_isys_rx_get_irq_info(port, irq_infos); } -void ia_css_isys_rx_get_irq_info(mipi_port_ID_t port, +void ia_css_isys_rx_get_irq_info(enum mipi_port_id port, unsigned int *irq_infos) { unsigned int bits; @@ -169,16 +169,16 @@ unsigned int ia_css_isys_rx_translate_irq_infos(unsigned int bits) void ia_css_rx_clear_irq_info(unsigned int irq_infos) { - ia_css_rx_port_clear_irq_info(IA_CSS_CSI2_PORT1, irq_infos); + ia_css_rx_port_clear_irq_info(MIPI_PORT1_ID, irq_infos); } -void ia_css_rx_port_clear_irq_info(enum ia_css_csi2_port api_port, unsigned int irq_infos) +void ia_css_rx_port_clear_irq_info(enum mipi_port_id api_port, unsigned int irq_infos) { - mipi_port_ID_t port = ia_css_isys_port_to_mipi_port(api_port); + enum mipi_port_id port = ia_css_isys_port_to_mipi_port(api_port); ia_css_isys_rx_clear_irq_info(port, irq_infos); } -void ia_css_isys_rx_clear_irq_info(mipi_port_ID_t port, unsigned int irq_infos) +void ia_css_isys_rx_clear_irq_info(enum mipi_port_id port, unsigned int irq_infos) { hrt_data bits = receiver_port_reg_load(RX0_ID, port, @@ -492,7 +492,7 @@ void ia_css_isys_rx_configure(const rx_cfg_t *config, #if defined(HAS_RX_VERSION_2) bool port_enabled[N_MIPI_PORT_ID]; bool any_port_enabled = false; - mipi_port_ID_t port; + enum mipi_port_id port; if ((config == NULL) || (config->mode >= N_RX_MODE) @@ -500,7 +500,7 @@ void ia_css_isys_rx_configure(const rx_cfg_t *config, assert(0); return; } - for (port = (mipi_port_ID_t) 0; port < N_MIPI_PORT_ID; port++) { + for (port = (enum mipi_port_id) 0; port < N_MIPI_PORT_ID; port++) { if (is_receiver_port_enabled(RX0_ID, port)) any_port_enabled = true; } @@ -595,8 +595,8 @@ void ia_css_isys_rx_configure(const rx_cfg_t *config, void ia_css_isys_rx_disable(void) { - mipi_port_ID_t port; - for (port = (mipi_port_ID_t) 0; port < N_MIPI_PORT_ID; port++) { + enum mipi_port_id port; + for (port = (enum mipi_port_id) 0; port < N_MIPI_PORT_ID; port++) { receiver_port_reg_store(RX0_ID, port, _HRT_CSS_RECEIVER_DEVICE_READY_REG_IDX, false); diff --git a/drivers/staging/media/atomisp/pci/atomisp2/css2400/runtime/pipeline/src/pipeline.c b/drivers/staging/media/atomisp/pci/atomisp2/css2400/runtime/pipeline/src/pipeline.c index 269829770082..4746620ca212 100644 --- a/drivers/staging/media/atomisp/pci/atomisp2/css2400/runtime/pipeline/src/pipeline.c +++ b/drivers/staging/media/atomisp/pci/atomisp2/css2400/runtime/pipeline/src/pipeline.c @@ -161,9 +161,9 @@ void ia_css_pipeline_start(enum ia_css_pipe_id pipe_id, #endif #if !defined(HAS_NO_INPUT_SYSTEM) #ifndef ISP2401 - , (mipi_port_ID_t) 0 + , (enum mipi_port_id) 0 #else - (mipi_port_ID_t) 0, + (enum mipi_port_id) 0, #endif #endif #ifndef ISP2401 diff --git a/drivers/staging/media/atomisp/pci/atomisp2/css2400/sh_css.c b/drivers/staging/media/atomisp/pci/atomisp2/css2400/sh_css.c index 9958b275bd50..33024b92911f 100644 --- a/drivers/staging/media/atomisp/pci/atomisp2/css2400/sh_css.c +++ b/drivers/staging/media/atomisp/pci/atomisp2/css2400/sh_css.c @@ -742,11 +742,11 @@ static bool sh_css_translate_stream_cfg_to_input_system_input_port_id( break; case IA_CSS_INPUT_MODE_BUFFERED_SENSOR: - if (stream_cfg->source.port.port == IA_CSS_CSI2_PORT0) { + if (stream_cfg->source.port.port == MIPI_PORT0_ID) { isys_stream_descr->input_port_id = INPUT_SYSTEM_CSI_PORT0_ID; - } else if (stream_cfg->source.port.port == IA_CSS_CSI2_PORT1) { + } else if (stream_cfg->source.port.port == MIPI_PORT1_ID) { isys_stream_descr->input_port_id = INPUT_SYSTEM_CSI_PORT1_ID; - } else if (stream_cfg->source.port.port == IA_CSS_CSI2_PORT2) { + } else if (stream_cfg->source.port.port == MIPI_PORT2_ID) { isys_stream_descr->input_port_id = INPUT_SYSTEM_CSI_PORT2_ID; } @@ -1195,7 +1195,7 @@ static inline struct ia_css_pipe *stream_get_target_pipe( static enum ia_css_err stream_csi_rx_helper( struct ia_css_stream *stream, - enum ia_css_err (*func)(enum ia_css_csi2_port, uint32_t)) + enum ia_css_err (*func)(enum mipi_port_id, uint32_t)) { enum ia_css_err retval = IA_CSS_ERR_INTERNAL_ERROR; uint32_t sp_thread_id, stream_id; @@ -1454,7 +1454,7 @@ static void start_pipe( &me->stream->info.metadata_info #if !defined(HAS_NO_INPUT_SYSTEM) ,(input_mode==IA_CSS_INPUT_MODE_MEMORY) ? - (mipi_port_ID_t)0 : + (enum mipi_port_id)0 : me->stream->config.source.port.port #endif #ifdef ISP2401 @@ -1497,7 +1497,7 @@ static void enable_interrupts(enum ia_css_irq_type irq_type) { #ifdef USE_INPUT_SYSTEM_VERSION_2 - mipi_port_ID_t port; + enum mipi_port_id port; #endif bool enable_pulse = irq_type != IA_CSS_IRQ_TYPE_EDGE; IA_CSS_ENTER_PRIVATE(""); @@ -4074,9 +4074,9 @@ preview_start(struct ia_css_pipe *pipe) #endif #if !defined(HAS_NO_INPUT_SYSTEM) #ifndef ISP2401 - , (mipi_port_ID_t)0 + , (enum mipi_port_id)0 #else - (mipi_port_ID_t)0, + (enum mipi_port_id)0, #endif #endif #ifndef ISP2401 @@ -4106,9 +4106,9 @@ preview_start(struct ia_css_pipe *pipe) #endif #if !defined(HAS_NO_INPUT_SYSTEM) #ifndef ISP2401 - , (mipi_port_ID_t) 0 + , (enum mipi_port_id) 0 #else - (mipi_port_ID_t) 0, + (enum mipi_port_id) 0, #endif #endif #ifndef ISP2401 @@ -4673,7 +4673,7 @@ ia_css_dequeue_psys_event(struct ia_css_event *event) event->type = convert_event_sp_to_host_domain[payload[0]]; /* Some sane default values since not all events use all fields. */ event->pipe = NULL; - event->port = IA_CSS_CSI2_PORT0; + event->port = MIPI_PORT0_ID; event->exp_id = 0; event->fw_warning = IA_CSS_FW_WARNING_NONE; event->fw_handle = 0; @@ -4719,7 +4719,7 @@ ia_css_dequeue_psys_event(struct ia_css_event *event) } } if (event->type == IA_CSS_EVENT_TYPE_PORT_EOF) { - event->port = (enum ia_css_csi2_port)payload[1]; + event->port = (enum mipi_port_id)payload[1]; event->exp_id = payload[3]; } else if (event->type == IA_CSS_EVENT_TYPE_FW_WARNING) { event->fw_warning = (enum ia_css_fw_warning)payload[1]; @@ -5949,9 +5949,9 @@ static enum ia_css_err video_start(struct ia_css_pipe *pipe) #endif #if !defined(HAS_NO_INPUT_SYSTEM) #ifndef ISP2401 - , (mipi_port_ID_t)0 + , (enum mipi_port_id)0 #else - (mipi_port_ID_t)0, + (enum mipi_port_id)0, #endif #endif #ifndef ISP2401 @@ -9173,7 +9173,7 @@ ia_css_stream_configure_rx(struct ia_css_stream *stream) else if (config->num_lanes != 0) return IA_CSS_ERR_INVALID_ARGUMENTS; - if (config->port > IA_CSS_CSI2_PORT2) + if (config->port > MIPI_PORT2_ID) return IA_CSS_ERR_INVALID_ARGUMENTS; stream->csi_rx_config.port = ia_css_isys_port_to_mipi_port(config->port); diff --git a/drivers/staging/media/atomisp/pci/atomisp2/css2400/sh_css_mipi.c b/drivers/staging/media/atomisp/pci/atomisp2/css2400/sh_css_mipi.c index 883474e90c81..0c2e5e3a007a 100644 --- a/drivers/staging/media/atomisp/pci/atomisp2/css2400/sh_css_mipi.c +++ b/drivers/staging/media/atomisp/pci/atomisp2/css2400/sh_css_mipi.c @@ -239,7 +239,7 @@ ia_css_mipi_frame_calculate_size(const unsigned int width, #if !defined(HAS_NO_INPUT_SYSTEM) && defined(USE_INPUT_SYSTEM_VERSION_2) enum ia_css_err -ia_css_mipi_frame_enable_check_on_size(const enum ia_css_csi2_port port, +ia_css_mipi_frame_enable_check_on_size(const enum mipi_port_id port, const unsigned int size_mem_words) { uint32_t idx; diff --git a/drivers/staging/media/atomisp/pci/atomisp2/css2400/sh_css_sp.c b/drivers/staging/media/atomisp/pci/atomisp2/css2400/sh_css_sp.c index bb297184ba3a..93f7c50511d8 100644 --- a/drivers/staging/media/atomisp/pci/atomisp2/css2400/sh_css_sp.c +++ b/drivers/staging/media/atomisp/pci/atomisp2/css2400/sh_css_sp.c @@ -1196,7 +1196,7 @@ sh_css_sp_init_pipeline(struct ia_css_pipeline *me, const struct ia_css_metadata_config *md_config, const struct ia_css_metadata_info *md_info, #if !defined(HAS_NO_INPUT_SYSTEM) - const mipi_port_ID_t port_id + const enum mipi_port_id port_id #endif #ifdef ISP2401 , diff --git a/drivers/staging/media/atomisp/pci/atomisp2/css2400/sh_css_sp.h b/drivers/staging/media/atomisp/pci/atomisp2/css2400/sh_css_sp.h index 98444a3cc3e4..3c41e997de79 100644 --- a/drivers/staging/media/atomisp/pci/atomisp2/css2400/sh_css_sp.h +++ b/drivers/staging/media/atomisp/pci/atomisp2/css2400/sh_css_sp.h @@ -64,7 +64,7 @@ sh_css_sp_init_pipeline(struct ia_css_pipeline *me, const struct ia_css_metadata_config *md_config, const struct ia_css_metadata_info *md_info, #if !defined(HAS_NO_INPUT_SYSTEM) - const mipi_port_ID_t port_id + const enum mipi_port_id port_id #endif #ifdef ISP2401 , From f1581b444e8d30566852eabba189ad5b2e8418bf Mon Sep 17 00:00:00 2001 From: Mauro Carvalho Chehab Date: Mon, 26 Mar 2018 16:13:36 -0400 Subject: [PATCH 43/48] media: staging: atomisp: get rid of an unused var As warned: drivers/staging/media/atomisp/pci/atomisp2/css2400/sh_css.c:8085 create_host_regular_capture_pipeline() error: uninitialized symbol 'frm'. Acked-by: Sakari Ailus Signed-off-by: Mauro Carvalho Chehab --- drivers/staging/media/atomisp/pci/atomisp2/css2400/sh_css.c | 1 - 1 file changed, 1 deletion(-) diff --git a/drivers/staging/media/atomisp/pci/atomisp2/css2400/sh_css.c b/drivers/staging/media/atomisp/pci/atomisp2/css2400/sh_css.c index 33024b92911f..2f0b76a33414 100644 --- a/drivers/staging/media/atomisp/pci/atomisp2/css2400/sh_css.c +++ b/drivers/staging/media/atomisp/pci/atomisp2/css2400/sh_css.c @@ -8044,7 +8044,6 @@ create_host_regular_capture_pipeline(struct ia_css_pipe *pipe) } if (mode == IA_CSS_CAPTURE_MODE_PRIMARY) { - unsigned int frm; struct ia_css_frame *local_in_frame = NULL; struct ia_css_frame *local_out_frame = NULL; From 0116b8df1c9e8f0946b678d0caaf4542f571af5c Mon Sep 17 00:00:00 2001 From: Mauro Carvalho Chehab Date: Mon, 26 Mar 2018 16:50:34 -0400 Subject: [PATCH 44/48] media: staging: atomisp: stop duplicating input format types The same formats are defined twice with different names, as warned: drivers/staging/media/atomisp/pci/atomisp2/atomisp_cmd.c:5092:58: warning: mixing different enum types drivers/staging/media/atomisp/pci/atomisp2/atomisp_cmd.c:5092:58: int enum atomisp_input_format versus drivers/staging/media/atomisp/pci/atomisp2/atomisp_cmd.c:5092:58: int enum ia_css_stream_format drivers/staging/media/atomisp/pci/atomisp2/atomisp_cmd.c:5112:50: warning: mixing different enum types drivers/staging/media/atomisp/pci/atomisp2/atomisp_cmd.c:5112:50: int enum atomisp_input_format versus drivers/staging/media/atomisp/pci/atomisp2/atomisp_cmd.c:5112:50: int enum ia_css_stream_format drivers/staging/media/atomisp/pci/atomisp2/atomisp_cmd.c:5288:42: warning: mixing different enum types drivers/staging/media/atomisp/pci/atomisp2/atomisp_cmd.c:5288:42: int enum atomisp_input_format versus drivers/staging/media/atomisp/pci/atomisp2/atomisp_cmd.c:5288:42: int enum ia_css_stream_format drivers/staging/media/atomisp/pci/atomisp2/atomisp_cmd.c:6179:62: warning: incorrect type in argument 2 (different address spaces) drivers/staging/media/atomisp/pci/atomisp2/atomisp_cmd.c:6179:62: expected void const [noderef] *from drivers/staging/media/atomisp/pci/atomisp2/atomisp_cmd.c:6179:62: got unsigned short [usertype] * Stop this enum abuse. Acked-by: Sakari Ailus Signed-off-by: Mauro Carvalho Chehab --- .../atomisp/include/linux/atomisp_platform.h | 4 + .../atomisp/pci/atomisp2/atomisp_compat.h | 12 +- .../pci/atomisp2/atomisp_compat_css20.c | 16 +-- .../pci/atomisp2/atomisp_compat_css20.h | 3 +- .../atomisp/pci/atomisp2/atomisp_subdev.c | 14 +- .../atomisp/pci/atomisp2/atomisp_subdev.h | 8 +- .../camera/util/interface/ia_css_util.h | 6 +- .../atomisp2/css2400/camera/util/src/util.c | 72 +++++----- .../pci/atomisp2/css2400/ia_css_metadata.h | 4 +- .../pci/atomisp2/css2400/ia_css_mipi.h | 2 +- .../atomisp2/css2400/ia_css_stream_format.h | 71 +--------- .../atomisp2/css2400/ia_css_stream_public.h | 8 +- .../isp/kernels/raw/raw_1.0/ia_css_raw.host.c | 42 +++--- .../kernels/raw/raw_1.0/ia_css_raw_types.h | 2 +- .../runtime/binary/interface/ia_css_binary.h | 8 +- .../css2400/runtime/binary/src/binary.c | 6 +- .../css2400/runtime/debug/src/ia_css_debug.c | 91 ++++++------ .../css2400/runtime/ifmtr/src/ifmtr.c | 92 ++++++------ .../inputfifo/interface/ia_css_inputfifo.h | 6 +- .../css2400/runtime/inputfifo/src/inputfifo.c | 22 +-- .../runtime/isys/interface/ia_css_isys.h | 4 +- .../atomisp2/css2400/runtime/isys/src/rx.c | 110 +++++++-------- .../atomisp/pci/atomisp2/css2400/sh_css.c | 132 +++++++++--------- .../pci/atomisp2/css2400/sh_css_mipi.c | 56 ++++---- .../pci/atomisp2/css2400/sh_css_params.c | 2 +- .../atomisp/pci/atomisp2/css2400/sh_css_sp.c | 4 +- .../atomisp2/css2400/sh_css_stream_format.c | 58 ++++---- .../atomisp2/css2400/sh_css_stream_format.h | 2 +- 28 files changed, 396 insertions(+), 461 deletions(-) diff --git a/drivers/staging/media/atomisp/include/linux/atomisp_platform.h b/drivers/staging/media/atomisp/include/linux/atomisp_platform.h index e0f0c379e7ce..aa5e294e7b7d 100644 --- a/drivers/staging/media/atomisp/include/linux/atomisp_platform.h +++ b/drivers/staging/media/atomisp/include/linux/atomisp_platform.h @@ -104,6 +104,10 @@ enum atomisp_input_format { ATOMISP_INPUT_FORMAT_USER_DEF8, /* User defined 8-bit data type 8 */ }; +#define N_ATOMISP_INPUT_FORMAT (ATOMISP_INPUT_FORMAT_USER_DEF8 + 1) + + + enum intel_v4l2_subdev_type { RAW_CAMERA = 1, SOC_CAMERA = 2, diff --git a/drivers/staging/media/atomisp/pci/atomisp2/atomisp_compat.h b/drivers/staging/media/atomisp/pci/atomisp2/atomisp_compat.h index 1567572e5b49..6c829d0a1e4c 100644 --- a/drivers/staging/media/atomisp/pci/atomisp2/atomisp_compat.h +++ b/drivers/staging/media/atomisp/pci/atomisp2/atomisp_compat.h @@ -253,7 +253,7 @@ void atomisp_css_isys_set_valid(struct atomisp_sub_device *asd, void atomisp_css_isys_set_format(struct atomisp_sub_device *asd, enum atomisp_input_stream_id stream_id, - enum atomisp_css_stream_format format, + enum atomisp_input_format format, int isys_stream); int atomisp_css_set_default_isys_config(struct atomisp_sub_device *asd, @@ -262,18 +262,18 @@ int atomisp_css_set_default_isys_config(struct atomisp_sub_device *asd, int atomisp_css_isys_two_stream_cfg(struct atomisp_sub_device *asd, enum atomisp_input_stream_id stream_id, - enum atomisp_css_stream_format input_format); + enum atomisp_input_format input_format); void atomisp_css_isys_two_stream_cfg_update_stream1( struct atomisp_sub_device *asd, enum atomisp_input_stream_id stream_id, - enum atomisp_css_stream_format input_format, + enum atomisp_input_format input_format, unsigned int width, unsigned int height); void atomisp_css_isys_two_stream_cfg_update_stream2( struct atomisp_sub_device *asd, enum atomisp_input_stream_id stream_id, - enum atomisp_css_stream_format input_format, + enum atomisp_input_format input_format, unsigned int width, unsigned int height); int atomisp_css_input_set_resolution(struct atomisp_sub_device *asd, @@ -290,7 +290,7 @@ void atomisp_css_input_set_bayer_order(struct atomisp_sub_device *asd, void atomisp_css_input_set_format(struct atomisp_sub_device *asd, enum atomisp_input_stream_id stream_id, - enum atomisp_css_stream_format format); + enum atomisp_input_format format); int atomisp_css_input_set_effective_resolution( struct atomisp_sub_device *asd, @@ -336,7 +336,7 @@ int atomisp_css_input_configure_port(struct atomisp_sub_device *asd, unsigned int num_lanes, unsigned int timeout, unsigned int mipi_freq, - enum atomisp_css_stream_format metadata_format, + enum atomisp_input_format metadata_format, unsigned int metadata_width, unsigned int metadata_height); diff --git a/drivers/staging/media/atomisp/pci/atomisp2/atomisp_compat_css20.c b/drivers/staging/media/atomisp/pci/atomisp2/atomisp_compat_css20.c index d9c8c202fd81..f668c68dc33a 100644 --- a/drivers/staging/media/atomisp/pci/atomisp2/atomisp_compat_css20.c +++ b/drivers/staging/media/atomisp/pci/atomisp2/atomisp_compat_css20.c @@ -1784,7 +1784,7 @@ void atomisp_css_isys_set_valid(struct atomisp_sub_device *asd, void atomisp_css_isys_set_format(struct atomisp_sub_device *asd, enum atomisp_input_stream_id stream_id, - enum atomisp_css_stream_format format, + enum atomisp_input_format format, int isys_stream) { @@ -1796,7 +1796,7 @@ void atomisp_css_isys_set_format(struct atomisp_sub_device *asd, void atomisp_css_input_set_format(struct atomisp_sub_device *asd, enum atomisp_input_stream_id stream_id, - enum atomisp_css_stream_format format) + enum atomisp_input_format format) { struct ia_css_stream_config *s_config = @@ -1835,7 +1835,7 @@ int atomisp_css_set_default_isys_config(struct atomisp_sub_device *asd, int atomisp_css_isys_two_stream_cfg(struct atomisp_sub_device *asd, enum atomisp_input_stream_id stream_id, - enum atomisp_css_stream_format input_format) + enum atomisp_input_format input_format) { struct ia_css_stream_config *s_config = &asd->stream_env[stream_id].stream_config; @@ -1849,9 +1849,9 @@ int atomisp_css_isys_two_stream_cfg(struct atomisp_sub_device *asd, s_config->isys_config[IA_CSS_STREAM_ISYS_STREAM_1].linked_isys_stream_id = IA_CSS_STREAM_ISYS_STREAM_0; s_config->isys_config[IA_CSS_STREAM_ISYS_STREAM_0].format = - IA_CSS_STREAM_FORMAT_USER_DEF1; + ATOMISP_INPUT_FORMAT_USER_DEF1; s_config->isys_config[IA_CSS_STREAM_ISYS_STREAM_1].format = - IA_CSS_STREAM_FORMAT_USER_DEF2; + ATOMISP_INPUT_FORMAT_USER_DEF2; s_config->isys_config[IA_CSS_STREAM_ISYS_STREAM_1].valid = true; return 0; } @@ -1859,7 +1859,7 @@ int atomisp_css_isys_two_stream_cfg(struct atomisp_sub_device *asd, void atomisp_css_isys_two_stream_cfg_update_stream1( struct atomisp_sub_device *asd, enum atomisp_input_stream_id stream_id, - enum atomisp_css_stream_format input_format, + enum atomisp_input_format input_format, unsigned int width, unsigned int height) { struct ia_css_stream_config *s_config = @@ -1877,7 +1877,7 @@ void atomisp_css_isys_two_stream_cfg_update_stream1( void atomisp_css_isys_two_stream_cfg_update_stream2( struct atomisp_sub_device *asd, enum atomisp_input_stream_id stream_id, - enum atomisp_css_stream_format input_format, + enum atomisp_input_format input_format, unsigned int width, unsigned int height) { struct ia_css_stream_config *s_config = @@ -2122,7 +2122,7 @@ int atomisp_css_input_configure_port( unsigned int num_lanes, unsigned int timeout, unsigned int mipi_freq, - enum atomisp_css_stream_format metadata_format, + enum atomisp_input_format metadata_format, unsigned int metadata_width, unsigned int metadata_height) { diff --git a/drivers/staging/media/atomisp/pci/atomisp2/atomisp_compat_css20.h b/drivers/staging/media/atomisp/pci/atomisp2/atomisp_compat_css20.h index b03711668eda..a06c5b6e8027 100644 --- a/drivers/staging/media/atomisp/pci/atomisp2/atomisp_compat_css20.h +++ b/drivers/staging/media/atomisp/pci/atomisp2/atomisp_compat_css20.h @@ -37,7 +37,6 @@ #define atomisp_css_irq_info ia_css_irq_info #define atomisp_css_isp_config ia_css_isp_config #define atomisp_css_bayer_order ia_css_bayer_order -#define atomisp_css_stream_format ia_css_stream_format #define atomisp_css_capture_mode ia_css_capture_mode #define atomisp_css_input_mode ia_css_input_mode #define atomisp_css_frame ia_css_frame @@ -117,7 +116,7 @@ */ #define CSS_ID(val) (IA_ ## val) #define CSS_EVENT(val) (IA_CSS_EVENT_TYPE_ ## val) -#define CSS_FORMAT(val) (IA_CSS_STREAM_FORMAT_ ## val) +#define CSS_FORMAT(val) (ATOMISP_INPUT_FORMAT_ ## val) #define CSS_EVENT_PORT_EOF CSS_EVENT(PORT_EOF) #define CSS_EVENT_FRAME_TAGGED CSS_EVENT(FRAME_TAGGED) diff --git a/drivers/staging/media/atomisp/pci/atomisp2/atomisp_subdev.c b/drivers/staging/media/atomisp/pci/atomisp2/atomisp_subdev.c index b78276ac22da..49a9973b4289 100644 --- a/drivers/staging/media/atomisp/pci/atomisp2/atomisp_subdev.c +++ b/drivers/staging/media/atomisp/pci/atomisp2/atomisp_subdev.c @@ -42,17 +42,17 @@ const struct atomisp_in_fmt_conv atomisp_in_fmt_conv[] = { { MEDIA_BUS_FMT_SGBRG12_1X12, 12, 12, ATOMISP_INPUT_FORMAT_RAW_12, CSS_BAYER_ORDER_GBRG, CSS_FORMAT_RAW_12 }, { MEDIA_BUS_FMT_SGRBG12_1X12, 12, 12, ATOMISP_INPUT_FORMAT_RAW_12, CSS_BAYER_ORDER_GRBG, CSS_FORMAT_RAW_12 }, { MEDIA_BUS_FMT_SRGGB12_1X12, 12, 12, ATOMISP_INPUT_FORMAT_RAW_12, CSS_BAYER_ORDER_RGGB, CSS_FORMAT_RAW_12 }, - { MEDIA_BUS_FMT_UYVY8_1X16, 8, 8, ATOMISP_INPUT_FORMAT_YUV422_8, 0, IA_CSS_STREAM_FORMAT_YUV422_8 }, - { MEDIA_BUS_FMT_YUYV8_1X16, 8, 8, ATOMISP_INPUT_FORMAT_YUV422_8, 0, IA_CSS_STREAM_FORMAT_YUV422_8 }, - { MEDIA_BUS_FMT_JPEG_1X8, 8, 8, CSS_FRAME_FORMAT_BINARY_8, 0, IA_CSS_STREAM_FORMAT_BINARY_8 }, + { MEDIA_BUS_FMT_UYVY8_1X16, 8, 8, ATOMISP_INPUT_FORMAT_YUV422_8, 0, ATOMISP_INPUT_FORMAT_YUV422_8 }, + { MEDIA_BUS_FMT_YUYV8_1X16, 8, 8, ATOMISP_INPUT_FORMAT_YUV422_8, 0, ATOMISP_INPUT_FORMAT_YUV422_8 }, + { MEDIA_BUS_FMT_JPEG_1X8, 8, 8, CSS_FRAME_FORMAT_BINARY_8, 0, ATOMISP_INPUT_FORMAT_BINARY_8 }, { V4L2_MBUS_FMT_CUSTOM_NV12, 12, 12, CSS_FRAME_FORMAT_NV12, 0, CSS_FRAME_FORMAT_NV12 }, { V4L2_MBUS_FMT_CUSTOM_NV21, 12, 12, CSS_FRAME_FORMAT_NV21, 0, CSS_FRAME_FORMAT_NV21 }, - { V4L2_MBUS_FMT_CUSTOM_YUV420, 12, 12, ATOMISP_INPUT_FORMAT_YUV420_8_LEGACY, 0, IA_CSS_STREAM_FORMAT_YUV420_8_LEGACY }, + { V4L2_MBUS_FMT_CUSTOM_YUV420, 12, 12, ATOMISP_INPUT_FORMAT_YUV420_8_LEGACY, 0, ATOMISP_INPUT_FORMAT_YUV420_8_LEGACY }, #if 0 - { V4L2_MBUS_FMT_CUSTOM_M10MO_RAW, 8, 8, CSS_FRAME_FORMAT_BINARY_8, 0, IA_CSS_STREAM_FORMAT_BINARY_8 }, + { V4L2_MBUS_FMT_CUSTOM_M10MO_RAW, 8, 8, CSS_FRAME_FORMAT_BINARY_8, 0, ATOMISP_INPUT_FORMAT_BINARY_8 }, #endif /* no valid V4L2 MBUS code for metadata format, so leave it 0. */ - { 0, 0, 0, ATOMISP_INPUT_FORMAT_EMBEDDED, 0, IA_CSS_STREAM_FORMAT_EMBEDDED }, + { 0, 0, 0, ATOMISP_INPUT_FORMAT_EMBEDDED, 0, ATOMISP_INPUT_FORMAT_EMBEDDED }, {} }; @@ -101,7 +101,7 @@ const struct atomisp_in_fmt_conv *atomisp_find_in_fmt_conv(u32 code) } const struct atomisp_in_fmt_conv *atomisp_find_in_fmt_conv_by_atomisp_in_fmt( - enum atomisp_css_stream_format atomisp_in_fmt) + enum atomisp_input_format atomisp_in_fmt) { int i; diff --git a/drivers/staging/media/atomisp/pci/atomisp2/atomisp_subdev.h b/drivers/staging/media/atomisp/pci/atomisp2/atomisp_subdev.h index c3eba675da06..59ff8723c182 100644 --- a/drivers/staging/media/atomisp/pci/atomisp2/atomisp_subdev.h +++ b/drivers/staging/media/atomisp/pci/atomisp2/atomisp_subdev.h @@ -58,9 +58,9 @@ struct atomisp_in_fmt_conv { u32 code; uint8_t bpp; /* bits per pixel */ uint8_t depth; /* uncompressed */ - enum atomisp_css_stream_format atomisp_in_fmt; + enum atomisp_input_format atomisp_in_fmt; enum atomisp_css_bayer_order bayer_order; - enum ia_css_stream_format css_stream_fmt; + enum atomisp_input_format css_stream_fmt; }; struct atomisp_sub_device; @@ -424,10 +424,10 @@ bool atomisp_subdev_is_compressed(u32 code); const struct atomisp_in_fmt_conv *atomisp_find_in_fmt_conv(u32 code); #ifndef ISP2401 const struct atomisp_in_fmt_conv *atomisp_find_in_fmt_conv_by_atomisp_in_fmt( - enum atomisp_css_stream_format atomisp_in_fmt); + enum atomisp_input_format atomisp_in_fmt); #else const struct atomisp_in_fmt_conv - *atomisp_find_in_fmt_conv_by_atomisp_in_fmt(enum atomisp_css_stream_format + *atomisp_find_in_fmt_conv_by_atomisp_in_fmt(enum atomisp_input_format atomisp_in_fmt); #endif const struct atomisp_in_fmt_conv *atomisp_find_in_fmt_conv_compressed(u32 code); diff --git a/drivers/staging/media/atomisp/pci/atomisp2/css2400/camera/util/interface/ia_css_util.h b/drivers/staging/media/atomisp/pci/atomisp2/css2400/camera/util/interface/ia_css_util.h index a8c27676a38b..5ab48f346790 100644 --- a/drivers/staging/media/atomisp/pci/atomisp2/css2400/camera/util/interface/ia_css_util.h +++ b/drivers/staging/media/atomisp/pci/atomisp2/css2400/camera/util/interface/ia_css_util.h @@ -116,7 +116,7 @@ extern bool ia_css_util_resolution_is_even( * */ extern unsigned int ia_css_util_input_format_bpp( - enum ia_css_stream_format stream_format, + enum atomisp_input_format stream_format, bool two_ppc); /* @brief check if input format it raw @@ -126,7 +126,7 @@ extern unsigned int ia_css_util_input_format_bpp( * */ extern bool ia_css_util_is_input_format_raw( - enum ia_css_stream_format stream_format); + enum atomisp_input_format stream_format); /* @brief check if input format it yuv * @@ -135,7 +135,7 @@ extern bool ia_css_util_is_input_format_raw( * */ extern bool ia_css_util_is_input_format_yuv( - enum ia_css_stream_format stream_format); + enum atomisp_input_format stream_format); #endif /* __IA_CSS_UTIL_H__ */ diff --git a/drivers/staging/media/atomisp/pci/atomisp2/css2400/camera/util/src/util.c b/drivers/staging/media/atomisp/pci/atomisp2/css2400/camera/util/src/util.c index 54193789a809..91e586112332 100644 --- a/drivers/staging/media/atomisp/pci/atomisp2/css2400/camera/util/src/util.c +++ b/drivers/staging/media/atomisp/pci/atomisp2/css2400/camera/util/src/util.c @@ -52,55 +52,55 @@ enum ia_css_err ia_css_convert_errno( /* MW: Table look-up ??? */ unsigned int ia_css_util_input_format_bpp( - enum ia_css_stream_format format, + enum atomisp_input_format format, bool two_ppc) { unsigned int rval = 0; switch (format) { - case IA_CSS_STREAM_FORMAT_YUV420_8_LEGACY: - case IA_CSS_STREAM_FORMAT_YUV420_8: - case IA_CSS_STREAM_FORMAT_YUV422_8: - case IA_CSS_STREAM_FORMAT_RGB_888: - case IA_CSS_STREAM_FORMAT_RAW_8: - case IA_CSS_STREAM_FORMAT_BINARY_8: - case IA_CSS_STREAM_FORMAT_EMBEDDED: + case ATOMISP_INPUT_FORMAT_YUV420_8_LEGACY: + case ATOMISP_INPUT_FORMAT_YUV420_8: + case ATOMISP_INPUT_FORMAT_YUV422_8: + case ATOMISP_INPUT_FORMAT_RGB_888: + case ATOMISP_INPUT_FORMAT_RAW_8: + case ATOMISP_INPUT_FORMAT_BINARY_8: + case ATOMISP_INPUT_FORMAT_EMBEDDED: rval = 8; break; - case IA_CSS_STREAM_FORMAT_YUV420_10: - case IA_CSS_STREAM_FORMAT_YUV422_10: - case IA_CSS_STREAM_FORMAT_RAW_10: + case ATOMISP_INPUT_FORMAT_YUV420_10: + case ATOMISP_INPUT_FORMAT_YUV422_10: + case ATOMISP_INPUT_FORMAT_RAW_10: rval = 10; break; - case IA_CSS_STREAM_FORMAT_YUV420_16: - case IA_CSS_STREAM_FORMAT_YUV422_16: + case ATOMISP_INPUT_FORMAT_YUV420_16: + case ATOMISP_INPUT_FORMAT_YUV422_16: rval = 16; break; - case IA_CSS_STREAM_FORMAT_RGB_444: + case ATOMISP_INPUT_FORMAT_RGB_444: rval = 4; break; - case IA_CSS_STREAM_FORMAT_RGB_555: + case ATOMISP_INPUT_FORMAT_RGB_555: rval = 5; break; - case IA_CSS_STREAM_FORMAT_RGB_565: + case ATOMISP_INPUT_FORMAT_RGB_565: rval = 65; break; - case IA_CSS_STREAM_FORMAT_RGB_666: - case IA_CSS_STREAM_FORMAT_RAW_6: + case ATOMISP_INPUT_FORMAT_RGB_666: + case ATOMISP_INPUT_FORMAT_RAW_6: rval = 6; break; - case IA_CSS_STREAM_FORMAT_RAW_7: + case ATOMISP_INPUT_FORMAT_RAW_7: rval = 7; break; - case IA_CSS_STREAM_FORMAT_RAW_12: + case ATOMISP_INPUT_FORMAT_RAW_12: rval = 12; break; - case IA_CSS_STREAM_FORMAT_RAW_14: + case ATOMISP_INPUT_FORMAT_RAW_14: if (two_ppc) rval = 14; else rval = 12; break; - case IA_CSS_STREAM_FORMAT_RAW_16: + case ATOMISP_INPUT_FORMAT_RAW_16: if (two_ppc) rval = 16; else @@ -175,28 +175,28 @@ bool ia_css_util_resolution_is_even(const struct ia_css_resolution resolution) } #endif -bool ia_css_util_is_input_format_raw(enum ia_css_stream_format format) +bool ia_css_util_is_input_format_raw(enum atomisp_input_format format) { - return ((format == IA_CSS_STREAM_FORMAT_RAW_6) || - (format == IA_CSS_STREAM_FORMAT_RAW_7) || - (format == IA_CSS_STREAM_FORMAT_RAW_8) || - (format == IA_CSS_STREAM_FORMAT_RAW_10) || - (format == IA_CSS_STREAM_FORMAT_RAW_12)); + return ((format == ATOMISP_INPUT_FORMAT_RAW_6) || + (format == ATOMISP_INPUT_FORMAT_RAW_7) || + (format == ATOMISP_INPUT_FORMAT_RAW_8) || + (format == ATOMISP_INPUT_FORMAT_RAW_10) || + (format == ATOMISP_INPUT_FORMAT_RAW_12)); /* raw_14 and raw_16 are not supported as input formats to the ISP. * They can only be copied to a frame in memory using the * copy binary. */ } -bool ia_css_util_is_input_format_yuv(enum ia_css_stream_format format) +bool ia_css_util_is_input_format_yuv(enum atomisp_input_format format) { - return format == IA_CSS_STREAM_FORMAT_YUV420_8_LEGACY || - format == IA_CSS_STREAM_FORMAT_YUV420_8 || - format == IA_CSS_STREAM_FORMAT_YUV420_10 || - format == IA_CSS_STREAM_FORMAT_YUV420_16 || - format == IA_CSS_STREAM_FORMAT_YUV422_8 || - format == IA_CSS_STREAM_FORMAT_YUV422_10 || - format == IA_CSS_STREAM_FORMAT_YUV422_16; + return format == ATOMISP_INPUT_FORMAT_YUV420_8_LEGACY || + format == ATOMISP_INPUT_FORMAT_YUV420_8 || + format == ATOMISP_INPUT_FORMAT_YUV420_10 || + format == ATOMISP_INPUT_FORMAT_YUV420_16 || + format == ATOMISP_INPUT_FORMAT_YUV422_8 || + format == ATOMISP_INPUT_FORMAT_YUV422_10 || + format == ATOMISP_INPUT_FORMAT_YUV422_16; } enum ia_css_err ia_css_util_check_input( diff --git a/drivers/staging/media/atomisp/pci/atomisp2/css2400/ia_css_metadata.h b/drivers/staging/media/atomisp/pci/atomisp2/css2400/ia_css_metadata.h index 8b674c98224c..ed0b6ab371da 100644 --- a/drivers/staging/media/atomisp/pci/atomisp2/css2400/ia_css_metadata.h +++ b/drivers/staging/media/atomisp/pci/atomisp2/css2400/ia_css_metadata.h @@ -27,8 +27,8 @@ * to process sensor metadata. */ struct ia_css_metadata_config { - enum ia_css_stream_format data_type; /** Data type of CSI-2 embedded - data. The default value is IA_CSS_STREAM_FORMAT_EMBEDDED. For + enum atomisp_input_format data_type; /** Data type of CSI-2 embedded + data. The default value is ATOMISP_INPUT_FORMAT_EMBEDDED. For certain sensors, user can choose non-default data type for embedded data. */ struct ia_css_resolution resolution; /** Resolution */ diff --git a/drivers/staging/media/atomisp/pci/atomisp2/css2400/ia_css_mipi.h b/drivers/staging/media/atomisp/pci/atomisp2/css2400/ia_css_mipi.h index 05170c4487eb..367b2aafa5e8 100644 --- a/drivers/staging/media/atomisp/pci/atomisp2/css2400/ia_css_mipi.h +++ b/drivers/staging/media/atomisp/pci/atomisp2/css2400/ia_css_mipi.h @@ -74,7 +74,7 @@ ia_css_mipi_frame_enable_check_on_size(const enum mipi_port_id port, enum ia_css_err ia_css_mipi_frame_calculate_size(const unsigned int width, const unsigned int height, - const enum ia_css_stream_format format, + const enum atomisp_input_format format, const bool hasSOLandEOL, const unsigned int embedded_data_size_words, unsigned int *size_mem_words); diff --git a/drivers/staging/media/atomisp/pci/atomisp2/css2400/ia_css_stream_format.h b/drivers/staging/media/atomisp/pci/atomisp2/css2400/ia_css_stream_format.h index f7e9020a86e1..f97b9eb2b19c 100644 --- a/drivers/staging/media/atomisp/pci/atomisp2/css2400/ia_css_stream_format.h +++ b/drivers/staging/media/atomisp/pci/atomisp2/css2400/ia_css_stream_format.h @@ -20,75 +20,10 @@ */ #include /* bool */ - -/* The ISP streaming input interface supports the following formats. - * These match the corresponding MIPI formats. - */ -enum ia_css_stream_format { - IA_CSS_STREAM_FORMAT_YUV420_8_LEGACY, /** 8 bits per subpixel */ - IA_CSS_STREAM_FORMAT_YUV420_8, /** 8 bits per subpixel */ - IA_CSS_STREAM_FORMAT_YUV420_10, /** 10 bits per subpixel */ - IA_CSS_STREAM_FORMAT_YUV420_16, /** 16 bits per subpixel */ - IA_CSS_STREAM_FORMAT_YUV422_8, /** UYVY..UYVY, 8 bits per subpixel */ - IA_CSS_STREAM_FORMAT_YUV422_10, /** UYVY..UYVY, 10 bits per subpixel */ - IA_CSS_STREAM_FORMAT_YUV422_16, /** UYVY..UYVY, 16 bits per subpixel */ - IA_CSS_STREAM_FORMAT_RGB_444, /** BGR..BGR, 4 bits per subpixel */ - IA_CSS_STREAM_FORMAT_RGB_555, /** BGR..BGR, 5 bits per subpixel */ - IA_CSS_STREAM_FORMAT_RGB_565, /** BGR..BGR, 5 bits B and R, 6 bits G */ - IA_CSS_STREAM_FORMAT_RGB_666, /** BGR..BGR, 6 bits per subpixel */ - IA_CSS_STREAM_FORMAT_RGB_888, /** BGR..BGR, 8 bits per subpixel */ - IA_CSS_STREAM_FORMAT_RAW_6, /** RAW data, 6 bits per pixel */ - IA_CSS_STREAM_FORMAT_RAW_7, /** RAW data, 7 bits per pixel */ - IA_CSS_STREAM_FORMAT_RAW_8, /** RAW data, 8 bits per pixel */ - IA_CSS_STREAM_FORMAT_RAW_10, /** RAW data, 10 bits per pixel */ - IA_CSS_STREAM_FORMAT_RAW_12, /** RAW data, 12 bits per pixel */ - IA_CSS_STREAM_FORMAT_RAW_14, /** RAW data, 14 bits per pixel */ - IA_CSS_STREAM_FORMAT_RAW_16, /** RAW data, 16 bits per pixel, which is - not specified in CSI-MIPI standard*/ - IA_CSS_STREAM_FORMAT_BINARY_8, /** Binary byte stream, which is target at - JPEG. */ - - /* CSI2-MIPI specific format: Generic short packet data. It is used to - * keep the timing information for the opening/closing of shutters, - * triggering of flashes and etc. - */ - IA_CSS_STREAM_FORMAT_GENERIC_SHORT1, /** Generic Short Packet Code 1 */ - IA_CSS_STREAM_FORMAT_GENERIC_SHORT2, /** Generic Short Packet Code 2 */ - IA_CSS_STREAM_FORMAT_GENERIC_SHORT3, /** Generic Short Packet Code 3 */ - IA_CSS_STREAM_FORMAT_GENERIC_SHORT4, /** Generic Short Packet Code 4 */ - IA_CSS_STREAM_FORMAT_GENERIC_SHORT5, /** Generic Short Packet Code 5 */ - IA_CSS_STREAM_FORMAT_GENERIC_SHORT6, /** Generic Short Packet Code 6 */ - IA_CSS_STREAM_FORMAT_GENERIC_SHORT7, /** Generic Short Packet Code 7 */ - IA_CSS_STREAM_FORMAT_GENERIC_SHORT8, /** Generic Short Packet Code 8 */ - - /* CSI2-MIPI specific format: YUV data. - */ - IA_CSS_STREAM_FORMAT_YUV420_8_SHIFT, /** YUV420 8-bit (Chroma Shifted Pixel Sampling) */ - IA_CSS_STREAM_FORMAT_YUV420_10_SHIFT, /** YUV420 8-bit (Chroma Shifted Pixel Sampling) */ - - /* CSI2-MIPI specific format: Generic long packet data - */ - IA_CSS_STREAM_FORMAT_EMBEDDED, /** Embedded 8-bit non Image Data */ - - /* CSI2-MIPI specific format: User defined byte-based data. For example, - * the data transmitter (e.g. the SoC sensor) can keep the JPEG data as - * the User Defined Data Type 4 and the MPEG data as the - * User Defined Data Type 7. - */ - IA_CSS_STREAM_FORMAT_USER_DEF1, /** User defined 8-bit data type 1 */ - IA_CSS_STREAM_FORMAT_USER_DEF2, /** User defined 8-bit data type 2 */ - IA_CSS_STREAM_FORMAT_USER_DEF3, /** User defined 8-bit data type 3 */ - IA_CSS_STREAM_FORMAT_USER_DEF4, /** User defined 8-bit data type 4 */ - IA_CSS_STREAM_FORMAT_USER_DEF5, /** User defined 8-bit data type 5 */ - IA_CSS_STREAM_FORMAT_USER_DEF6, /** User defined 8-bit data type 6 */ - IA_CSS_STREAM_FORMAT_USER_DEF7, /** User defined 8-bit data type 7 */ - IA_CSS_STREAM_FORMAT_USER_DEF8, /** User defined 8-bit data type 8 */ -}; - -#define IA_CSS_STREAM_FORMAT_NUM IA_CSS_STREAM_FORMAT_USER_DEF8 +#include "../../../include/linux/atomisp_platform.h" unsigned int ia_css_util_input_format_bpp( - enum ia_css_stream_format format, + enum atomisp_input_format format, bool two_ppc); -#endif /* __IA_CSS_STREAM_FORMAT_H */ +#endif /* __ATOMISP_INPUT_FORMAT_H */ diff --git a/drivers/staging/media/atomisp/pci/atomisp2/css2400/ia_css_stream_public.h b/drivers/staging/media/atomisp/pci/atomisp2/css2400/ia_css_stream_public.h index ca3203357ff5..ddefad330db7 100644 --- a/drivers/staging/media/atomisp/pci/atomisp2/css2400/ia_css_stream_public.h +++ b/drivers/staging/media/atomisp/pci/atomisp2/css2400/ia_css_stream_public.h @@ -62,7 +62,7 @@ enum { */ struct ia_css_stream_isys_stream_config { struct ia_css_resolution input_res; /** Resolution of input data */ - enum ia_css_stream_format format; /** Format of input stream. This data + enum atomisp_input_format format; /** Format of input stream. This data format will be mapped to MIPI data type internally. */ int linked_isys_stream_id; /** default value is -1, other value means @@ -77,7 +77,7 @@ struct ia_css_stream_input_config { Used for CSS 2400/1 System and deprecated for other systems (replaced by input_effective_res in ia_css_pipe_config) */ - enum ia_css_stream_format format; /** Format of input stream. This data + enum atomisp_input_format format; /** Format of input stream. This data format will be mapped to MIPI data type internally. */ enum ia_css_bayer_order bayer_order; /** Bayer order for RAW streams */ @@ -257,7 +257,7 @@ ia_css_stream_unload(struct ia_css_stream *stream); * * This function will return the stream format. */ -enum ia_css_stream_format +enum atomisp_input_format ia_css_stream_get_format(const struct ia_css_stream *stream); /* @brief Check if the stream is configured for 2 pixels per clock @@ -453,7 +453,7 @@ ia_css_stream_send_input_line(const struct ia_css_stream *stream, */ void ia_css_stream_send_input_embedded_line(const struct ia_css_stream *stream, - enum ia_css_stream_format format, + enum atomisp_input_format format, const unsigned short *data, unsigned int width); diff --git a/drivers/staging/media/atomisp/pci/atomisp2/css2400/isp/kernels/raw/raw_1.0/ia_css_raw.host.c b/drivers/staging/media/atomisp/pci/atomisp2/css2400/isp/kernels/raw/raw_1.0/ia_css_raw.host.c index 68a27f0cfba0..fa9ce0fedf23 100644 --- a/drivers/staging/media/atomisp/pci/atomisp2/css2400/isp/kernels/raw/raw_1.0/ia_css_raw.host.c +++ b/drivers/staging/media/atomisp/pci/atomisp2/css2400/isp/kernels/raw/raw_1.0/ia_css_raw.host.c @@ -37,34 +37,34 @@ sh_css_elems_bytes_from_info (unsigned raw_bit_depth) /* MW: These areMIPI / ISYS properties, not camera function properties */ static enum sh_stream_format -css2isp_stream_format(enum ia_css_stream_format from) +css2isp_stream_format(enum atomisp_input_format from) { switch (from) { - case IA_CSS_STREAM_FORMAT_YUV420_8_LEGACY: + case ATOMISP_INPUT_FORMAT_YUV420_8_LEGACY: return sh_stream_format_yuv420_legacy; - case IA_CSS_STREAM_FORMAT_YUV420_8: - case IA_CSS_STREAM_FORMAT_YUV420_10: - case IA_CSS_STREAM_FORMAT_YUV420_16: + case ATOMISP_INPUT_FORMAT_YUV420_8: + case ATOMISP_INPUT_FORMAT_YUV420_10: + case ATOMISP_INPUT_FORMAT_YUV420_16: return sh_stream_format_yuv420; - case IA_CSS_STREAM_FORMAT_YUV422_8: - case IA_CSS_STREAM_FORMAT_YUV422_10: - case IA_CSS_STREAM_FORMAT_YUV422_16: + case ATOMISP_INPUT_FORMAT_YUV422_8: + case ATOMISP_INPUT_FORMAT_YUV422_10: + case ATOMISP_INPUT_FORMAT_YUV422_16: return sh_stream_format_yuv422; - case IA_CSS_STREAM_FORMAT_RGB_444: - case IA_CSS_STREAM_FORMAT_RGB_555: - case IA_CSS_STREAM_FORMAT_RGB_565: - case IA_CSS_STREAM_FORMAT_RGB_666: - case IA_CSS_STREAM_FORMAT_RGB_888: + case ATOMISP_INPUT_FORMAT_RGB_444: + case ATOMISP_INPUT_FORMAT_RGB_555: + case ATOMISP_INPUT_FORMAT_RGB_565: + case ATOMISP_INPUT_FORMAT_RGB_666: + case ATOMISP_INPUT_FORMAT_RGB_888: return sh_stream_format_rgb; - case IA_CSS_STREAM_FORMAT_RAW_6: - case IA_CSS_STREAM_FORMAT_RAW_7: - case IA_CSS_STREAM_FORMAT_RAW_8: - case IA_CSS_STREAM_FORMAT_RAW_10: - case IA_CSS_STREAM_FORMAT_RAW_12: - case IA_CSS_STREAM_FORMAT_RAW_14: - case IA_CSS_STREAM_FORMAT_RAW_16: + case ATOMISP_INPUT_FORMAT_RAW_6: + case ATOMISP_INPUT_FORMAT_RAW_7: + case ATOMISP_INPUT_FORMAT_RAW_8: + case ATOMISP_INPUT_FORMAT_RAW_10: + case ATOMISP_INPUT_FORMAT_RAW_12: + case ATOMISP_INPUT_FORMAT_RAW_14: + case ATOMISP_INPUT_FORMAT_RAW_16: return sh_stream_format_raw; - case IA_CSS_STREAM_FORMAT_BINARY_8: + case ATOMISP_INPUT_FORMAT_BINARY_8: default: return sh_stream_format_raw; } diff --git a/drivers/staging/media/atomisp/pci/atomisp2/css2400/isp/kernels/raw/raw_1.0/ia_css_raw_types.h b/drivers/staging/media/atomisp/pci/atomisp2/css2400/isp/kernels/raw/raw_1.0/ia_css_raw_types.h index 5c0b8febd79a..ae868eb5e10f 100644 --- a/drivers/staging/media/atomisp/pci/atomisp2/css2400/isp/kernels/raw/raw_1.0/ia_css_raw_types.h +++ b/drivers/staging/media/atomisp/pci/atomisp2/css2400/isp/kernels/raw/raw_1.0/ia_css_raw_types.h @@ -28,7 +28,7 @@ struct ia_css_raw_configuration { const struct ia_css_frame_info *in_info; const struct ia_css_frame_info *internal_info; bool two_ppc; - enum ia_css_stream_format stream_format; + enum atomisp_input_format stream_format; bool deinterleaved; uint8_t enable_left_padding; }; diff --git a/drivers/staging/media/atomisp/pci/atomisp2/css2400/runtime/binary/interface/ia_css_binary.h b/drivers/staging/media/atomisp/pci/atomisp2/css2400/runtime/binary/interface/ia_css_binary.h index 732e49a241eb..b62c4d321a4e 100644 --- a/drivers/staging/media/atomisp/pci/atomisp2/css2400/runtime/binary/interface/ia_css_binary.h +++ b/drivers/staging/media/atomisp/pci/atomisp2/css2400/runtime/binary/interface/ia_css_binary.h @@ -113,7 +113,7 @@ struct ia_css_binary_descr { #endif bool enable_capture_pp_bli; struct ia_css_resolution dvs_env; - enum ia_css_stream_format stream_format; + enum atomisp_input_format stream_format; struct ia_css_frame_info *in_info; /* the info of the input-frame with the ISP required resolution. */ struct ia_css_frame_info *bds_out_info; @@ -126,7 +126,7 @@ struct ia_css_binary_descr { struct ia_css_binary { const struct ia_css_binary_xinfo *info; - enum ia_css_stream_format input_format; + enum atomisp_input_format input_format; struct ia_css_frame_info in_frame_info; struct ia_css_frame_info internal_frame_info; struct ia_css_frame_info out_frame_info[IA_CSS_BINARY_MAX_OUTPUT_PORTS]; @@ -162,7 +162,7 @@ struct ia_css_binary { #define IA_CSS_BINARY_DEFAULT_SETTINGS \ (struct ia_css_binary) { \ - .input_format = IA_CSS_STREAM_FORMAT_YUV420_8_LEGACY, \ + .input_format = ATOMISP_INPUT_FORMAT_YUV420_8_LEGACY, \ .in_frame_info = IA_CSS_BINARY_DEFAULT_FRAME_INFO, \ .internal_frame_info = IA_CSS_BINARY_DEFAULT_FRAME_INFO, \ .out_frame_info = {IA_CSS_BINARY_DEFAULT_FRAME_INFO}, \ @@ -179,7 +179,7 @@ enum ia_css_err ia_css_binary_fill_info(const struct ia_css_binary_xinfo *xinfo, bool online, bool two_ppc, - enum ia_css_stream_format stream_format, + enum atomisp_input_format stream_format, const struct ia_css_frame_info *in_info, const struct ia_css_frame_info *bds_out_info, const struct ia_css_frame_info *out_info[], diff --git a/drivers/staging/media/atomisp/pci/atomisp2/css2400/runtime/binary/src/binary.c b/drivers/staging/media/atomisp/pci/atomisp2/css2400/runtime/binary/src/binary.c index a0f0e9062c4c..0cd6e1da43cf 100644 --- a/drivers/staging/media/atomisp/pci/atomisp2/css2400/runtime/binary/src/binary.c +++ b/drivers/staging/media/atomisp/pci/atomisp2/css2400/runtime/binary/src/binary.c @@ -861,7 +861,7 @@ binary_supports_output_format(const struct ia_css_binary_xinfo *info, #ifdef ISP2401 static bool binary_supports_input_format(const struct ia_css_binary_xinfo *info, - enum ia_css_stream_format format) + enum atomisp_input_format format) { assert(info != NULL); @@ -1088,7 +1088,7 @@ enum ia_css_err ia_css_binary_fill_info(const struct ia_css_binary_xinfo *xinfo, bool online, bool two_ppc, - enum ia_css_stream_format stream_format, + enum atomisp_input_format stream_format, const struct ia_css_frame_info *in_info, /* can be NULL */ const struct ia_css_frame_info *bds_out_info, /* can be NULL */ const struct ia_css_frame_info *out_info[], /* can be NULL */ @@ -1382,7 +1382,7 @@ ia_css_binary_find(struct ia_css_binary_descr *descr, int mode; bool online; bool two_ppc; - enum ia_css_stream_format stream_format; + enum atomisp_input_format stream_format; const struct ia_css_frame_info *req_in_info, *req_bds_out_info, *req_out_info[IA_CSS_BINARY_MAX_OUTPUT_PORTS], diff --git a/drivers/staging/media/atomisp/pci/atomisp2/css2400/runtime/debug/src/ia_css_debug.c b/drivers/staging/media/atomisp/pci/atomisp2/css2400/runtime/debug/src/ia_css_debug.c index aa9a2d115265..4607a76dc78a 100644 --- a/drivers/staging/media/atomisp/pci/atomisp2/css2400/runtime/debug/src/ia_css_debug.c +++ b/drivers/staging/media/atomisp/pci/atomisp2/css2400/runtime/debug/src/ia_css_debug.c @@ -110,9 +110,6 @@ /* Global variable to store the dtrace verbosity level */ unsigned int ia_css_debug_trace_level = IA_CSS_DEBUG_WARNING; -/* Assumes that IA_CSS_STREAM_FORMAT_BINARY_8 is last */ -#define N_IA_CSS_STREAM_FORMAT (IA_CSS_STREAM_FORMAT_BINARY_8+1) - #define DPG_START "ia_css_debug_pipe_graph_dump_start " #define DPG_END " ia_css_debug_pipe_graph_dump_end\n" @@ -141,8 +138,8 @@ static struct pipe_graph_class { int width; int eff_height; int eff_width; - enum ia_css_stream_format stream_format; -} pg_inst = {true, 0, 0, 0, 0, N_IA_CSS_STREAM_FORMAT}; + enum atomisp_input_format stream_format; +} pg_inst = {true, 0, 0, 0, 0, N_ATOMISP_INPUT_FORMAT}; static const char * const queue_id_to_str[] = { /* [SH_CSS_QUEUE_A_ID] =*/ "queue_A", @@ -261,86 +258,86 @@ unsigned int ia_css_debug_get_dtrace_level(void) return ia_css_debug_trace_level; } -static const char *debug_stream_format2str(const enum ia_css_stream_format stream_format) +static const char *debug_stream_format2str(const enum atomisp_input_format stream_format) { switch (stream_format) { - case IA_CSS_STREAM_FORMAT_YUV420_8_LEGACY: + case ATOMISP_INPUT_FORMAT_YUV420_8_LEGACY: return "yuv420-8-legacy"; - case IA_CSS_STREAM_FORMAT_YUV420_8: + case ATOMISP_INPUT_FORMAT_YUV420_8: return "yuv420-8"; - case IA_CSS_STREAM_FORMAT_YUV420_10: + case ATOMISP_INPUT_FORMAT_YUV420_10: return "yuv420-10"; - case IA_CSS_STREAM_FORMAT_YUV420_16: + case ATOMISP_INPUT_FORMAT_YUV420_16: return "yuv420-16"; - case IA_CSS_STREAM_FORMAT_YUV422_8: + case ATOMISP_INPUT_FORMAT_YUV422_8: return "yuv422-8"; - case IA_CSS_STREAM_FORMAT_YUV422_10: + case ATOMISP_INPUT_FORMAT_YUV422_10: return "yuv422-10"; - case IA_CSS_STREAM_FORMAT_YUV422_16: + case ATOMISP_INPUT_FORMAT_YUV422_16: return "yuv422-16"; - case IA_CSS_STREAM_FORMAT_RGB_444: + case ATOMISP_INPUT_FORMAT_RGB_444: return "rgb444"; - case IA_CSS_STREAM_FORMAT_RGB_555: + case ATOMISP_INPUT_FORMAT_RGB_555: return "rgb555"; - case IA_CSS_STREAM_FORMAT_RGB_565: + case ATOMISP_INPUT_FORMAT_RGB_565: return "rgb565"; - case IA_CSS_STREAM_FORMAT_RGB_666: + case ATOMISP_INPUT_FORMAT_RGB_666: return "rgb666"; - case IA_CSS_STREAM_FORMAT_RGB_888: + case ATOMISP_INPUT_FORMAT_RGB_888: return "rgb888"; - case IA_CSS_STREAM_FORMAT_RAW_6: + case ATOMISP_INPUT_FORMAT_RAW_6: return "raw6"; - case IA_CSS_STREAM_FORMAT_RAW_7: + case ATOMISP_INPUT_FORMAT_RAW_7: return "raw7"; - case IA_CSS_STREAM_FORMAT_RAW_8: + case ATOMISP_INPUT_FORMAT_RAW_8: return "raw8"; - case IA_CSS_STREAM_FORMAT_RAW_10: + case ATOMISP_INPUT_FORMAT_RAW_10: return "raw10"; - case IA_CSS_STREAM_FORMAT_RAW_12: + case ATOMISP_INPUT_FORMAT_RAW_12: return "raw12"; - case IA_CSS_STREAM_FORMAT_RAW_14: + case ATOMISP_INPUT_FORMAT_RAW_14: return "raw14"; - case IA_CSS_STREAM_FORMAT_RAW_16: + case ATOMISP_INPUT_FORMAT_RAW_16: return "raw16"; - case IA_CSS_STREAM_FORMAT_BINARY_8: + case ATOMISP_INPUT_FORMAT_BINARY_8: return "binary8"; - case IA_CSS_STREAM_FORMAT_GENERIC_SHORT1: + case ATOMISP_INPUT_FORMAT_GENERIC_SHORT1: return "generic-short1"; - case IA_CSS_STREAM_FORMAT_GENERIC_SHORT2: + case ATOMISP_INPUT_FORMAT_GENERIC_SHORT2: return "generic-short2"; - case IA_CSS_STREAM_FORMAT_GENERIC_SHORT3: + case ATOMISP_INPUT_FORMAT_GENERIC_SHORT3: return "generic-short3"; - case IA_CSS_STREAM_FORMAT_GENERIC_SHORT4: + case ATOMISP_INPUT_FORMAT_GENERIC_SHORT4: return "generic-short4"; - case IA_CSS_STREAM_FORMAT_GENERIC_SHORT5: + case ATOMISP_INPUT_FORMAT_GENERIC_SHORT5: return "generic-short5"; - case IA_CSS_STREAM_FORMAT_GENERIC_SHORT6: + case ATOMISP_INPUT_FORMAT_GENERIC_SHORT6: return "generic-short6"; - case IA_CSS_STREAM_FORMAT_GENERIC_SHORT7: + case ATOMISP_INPUT_FORMAT_GENERIC_SHORT7: return "generic-short7"; - case IA_CSS_STREAM_FORMAT_GENERIC_SHORT8: + case ATOMISP_INPUT_FORMAT_GENERIC_SHORT8: return "generic-short8"; - case IA_CSS_STREAM_FORMAT_YUV420_8_SHIFT: + case ATOMISP_INPUT_FORMAT_YUV420_8_SHIFT: return "yuv420-8-shift"; - case IA_CSS_STREAM_FORMAT_YUV420_10_SHIFT: + case ATOMISP_INPUT_FORMAT_YUV420_10_SHIFT: return "yuv420-10-shift"; - case IA_CSS_STREAM_FORMAT_EMBEDDED: + case ATOMISP_INPUT_FORMAT_EMBEDDED: return "embedded-8"; - case IA_CSS_STREAM_FORMAT_USER_DEF1: + case ATOMISP_INPUT_FORMAT_USER_DEF1: return "user-def-8-type-1"; - case IA_CSS_STREAM_FORMAT_USER_DEF2: + case ATOMISP_INPUT_FORMAT_USER_DEF2: return "user-def-8-type-2"; - case IA_CSS_STREAM_FORMAT_USER_DEF3: + case ATOMISP_INPUT_FORMAT_USER_DEF3: return "user-def-8-type-3"; - case IA_CSS_STREAM_FORMAT_USER_DEF4: + case ATOMISP_INPUT_FORMAT_USER_DEF4: return "user-def-8-type-4"; - case IA_CSS_STREAM_FORMAT_USER_DEF5: + case ATOMISP_INPUT_FORMAT_USER_DEF5: return "user-def-8-type-5"; - case IA_CSS_STREAM_FORMAT_USER_DEF6: + case ATOMISP_INPUT_FORMAT_USER_DEF6: return "user-def-8-type-6"; - case IA_CSS_STREAM_FORMAT_USER_DEF7: + case ATOMISP_INPUT_FORMAT_USER_DEF7: return "user-def-8-type-7"; - case IA_CSS_STREAM_FORMAT_USER_DEF8: + case ATOMISP_INPUT_FORMAT_USER_DEF8: return "user-def-8-type-8"; default: @@ -2730,7 +2727,7 @@ void ia_css_debug_pipe_graph_dump_epilogue(void) } - if (pg_inst.stream_format != N_IA_CSS_STREAM_FORMAT) { + if (pg_inst.stream_format != N_ATOMISP_INPUT_FORMAT) { /* An input stream format has been set so assume we have * an input system and sensor */ @@ -2770,7 +2767,7 @@ void ia_css_debug_pipe_graph_dump_epilogue(void) pg_inst.height = 0; pg_inst.eff_width = 0; pg_inst.eff_height = 0; - pg_inst.stream_format = N_IA_CSS_STREAM_FORMAT; + pg_inst.stream_format = N_ATOMISP_INPUT_FORMAT; } void diff --git a/drivers/staging/media/atomisp/pci/atomisp2/css2400/runtime/ifmtr/src/ifmtr.c b/drivers/staging/media/atomisp/pci/atomisp2/css2400/runtime/ifmtr/src/ifmtr.c index c031c70aee9b..1bed027435fd 100644 --- a/drivers/staging/media/atomisp/pci/atomisp2/css2400/runtime/ifmtr/src/ifmtr.c +++ b/drivers/staging/media/atomisp/pci/atomisp2/css2400/runtime/ifmtr/src/ifmtr.c @@ -112,7 +112,7 @@ enum ia_css_err ia_css_ifmtr_configure(struct ia_css_stream_config *config, width_b_factor = 1, start_column_b, left_padding = 0; input_formatter_cfg_t if_a_config, if_b_config; - enum ia_css_stream_format input_format; + enum atomisp_input_format input_format; enum ia_css_err err = IA_CSS_SUCCESS; uint8_t if_config_index; @@ -189,7 +189,7 @@ enum ia_css_err ia_css_ifmtr_configure(struct ia_css_stream_config *config, bits_per_pixel = input_formatter_get_alignment(INPUT_FORMATTER0_ID) * 8 / ISP_VEC_NELEMS; switch (input_format) { - case IA_CSS_STREAM_FORMAT_YUV420_8_LEGACY: + case ATOMISP_INPUT_FORMAT_YUV420_8_LEGACY: if (two_ppc) { vmem_increment = 1; deinterleaving = 1; @@ -219,9 +219,9 @@ enum ia_css_err ia_css_ifmtr_configure(struct ia_css_stream_config *config, start_column = start_column * deinterleaving / 2; } break; - case IA_CSS_STREAM_FORMAT_YUV420_8: - case IA_CSS_STREAM_FORMAT_YUV420_10: - case IA_CSS_STREAM_FORMAT_YUV420_16: + case ATOMISP_INPUT_FORMAT_YUV420_8: + case ATOMISP_INPUT_FORMAT_YUV420_10: + case ATOMISP_INPUT_FORMAT_YUV420_16: if (two_ppc) { vmem_increment = 1; deinterleaving = 1; @@ -246,9 +246,9 @@ enum ia_css_err ia_css_ifmtr_configure(struct ia_css_stream_config *config, start_column *= deinterleaving; } break; - case IA_CSS_STREAM_FORMAT_YUV422_8: - case IA_CSS_STREAM_FORMAT_YUV422_10: - case IA_CSS_STREAM_FORMAT_YUV422_16: + case ATOMISP_INPUT_FORMAT_YUV422_8: + case ATOMISP_INPUT_FORMAT_YUV422_10: + case ATOMISP_INPUT_FORMAT_YUV422_16: if (two_ppc) { vmem_increment = 1; deinterleaving = 1; @@ -267,11 +267,11 @@ enum ia_css_err ia_css_ifmtr_configure(struct ia_css_stream_config *config, start_column *= deinterleaving; } break; - case IA_CSS_STREAM_FORMAT_RGB_444: - case IA_CSS_STREAM_FORMAT_RGB_555: - case IA_CSS_STREAM_FORMAT_RGB_565: - case IA_CSS_STREAM_FORMAT_RGB_666: - case IA_CSS_STREAM_FORMAT_RGB_888: + case ATOMISP_INPUT_FORMAT_RGB_444: + case ATOMISP_INPUT_FORMAT_RGB_555: + case ATOMISP_INPUT_FORMAT_RGB_565: + case ATOMISP_INPUT_FORMAT_RGB_666: + case ATOMISP_INPUT_FORMAT_RGB_888: num_vectors *= 2; if (two_ppc) { deinterleaving = 2; /* BR in if_a, G in if_b */ @@ -293,11 +293,11 @@ enum ia_css_err ia_css_ifmtr_configure(struct ia_css_stream_config *config, num_vectors = num_vectors / 2 * deinterleaving; buf_offset_b = buffer_width / 2 / ISP_VEC_NELEMS; break; - case IA_CSS_STREAM_FORMAT_RAW_6: - case IA_CSS_STREAM_FORMAT_RAW_7: - case IA_CSS_STREAM_FORMAT_RAW_8: - case IA_CSS_STREAM_FORMAT_RAW_10: - case IA_CSS_STREAM_FORMAT_RAW_12: + case ATOMISP_INPUT_FORMAT_RAW_6: + case ATOMISP_INPUT_FORMAT_RAW_7: + case ATOMISP_INPUT_FORMAT_RAW_8: + case ATOMISP_INPUT_FORMAT_RAW_10: + case ATOMISP_INPUT_FORMAT_RAW_12: if (two_ppc) { int crop_col = (start_column % 2) == 1; vmem_increment = 2; @@ -332,8 +332,8 @@ enum ia_css_err ia_css_ifmtr_configure(struct ia_css_stream_config *config, vectors_per_line = CEIL_DIV(cropped_width, ISP_VEC_NELEMS); vectors_per_line = CEIL_MUL(vectors_per_line, deinterleaving); break; - case IA_CSS_STREAM_FORMAT_RAW_14: - case IA_CSS_STREAM_FORMAT_RAW_16: + case ATOMISP_INPUT_FORMAT_RAW_14: + case ATOMISP_INPUT_FORMAT_RAW_16: if (two_ppc) { num_vectors *= 2; vmem_increment = 1; @@ -350,26 +350,26 @@ enum ia_css_err ia_css_ifmtr_configure(struct ia_css_stream_config *config, } buffer_height *= 2; break; - case IA_CSS_STREAM_FORMAT_BINARY_8: - case IA_CSS_STREAM_FORMAT_GENERIC_SHORT1: - case IA_CSS_STREAM_FORMAT_GENERIC_SHORT2: - case IA_CSS_STREAM_FORMAT_GENERIC_SHORT3: - case IA_CSS_STREAM_FORMAT_GENERIC_SHORT4: - case IA_CSS_STREAM_FORMAT_GENERIC_SHORT5: - case IA_CSS_STREAM_FORMAT_GENERIC_SHORT6: - case IA_CSS_STREAM_FORMAT_GENERIC_SHORT7: - case IA_CSS_STREAM_FORMAT_GENERIC_SHORT8: - case IA_CSS_STREAM_FORMAT_YUV420_8_SHIFT: - case IA_CSS_STREAM_FORMAT_YUV420_10_SHIFT: - case IA_CSS_STREAM_FORMAT_EMBEDDED: - case IA_CSS_STREAM_FORMAT_USER_DEF1: - case IA_CSS_STREAM_FORMAT_USER_DEF2: - case IA_CSS_STREAM_FORMAT_USER_DEF3: - case IA_CSS_STREAM_FORMAT_USER_DEF4: - case IA_CSS_STREAM_FORMAT_USER_DEF5: - case IA_CSS_STREAM_FORMAT_USER_DEF6: - case IA_CSS_STREAM_FORMAT_USER_DEF7: - case IA_CSS_STREAM_FORMAT_USER_DEF8: + case ATOMISP_INPUT_FORMAT_BINARY_8: + case ATOMISP_INPUT_FORMAT_GENERIC_SHORT1: + case ATOMISP_INPUT_FORMAT_GENERIC_SHORT2: + case ATOMISP_INPUT_FORMAT_GENERIC_SHORT3: + case ATOMISP_INPUT_FORMAT_GENERIC_SHORT4: + case ATOMISP_INPUT_FORMAT_GENERIC_SHORT5: + case ATOMISP_INPUT_FORMAT_GENERIC_SHORT6: + case ATOMISP_INPUT_FORMAT_GENERIC_SHORT7: + case ATOMISP_INPUT_FORMAT_GENERIC_SHORT8: + case ATOMISP_INPUT_FORMAT_YUV420_8_SHIFT: + case ATOMISP_INPUT_FORMAT_YUV420_10_SHIFT: + case ATOMISP_INPUT_FORMAT_EMBEDDED: + case ATOMISP_INPUT_FORMAT_USER_DEF1: + case ATOMISP_INPUT_FORMAT_USER_DEF2: + case ATOMISP_INPUT_FORMAT_USER_DEF3: + case ATOMISP_INPUT_FORMAT_USER_DEF4: + case ATOMISP_INPUT_FORMAT_USER_DEF5: + case ATOMISP_INPUT_FORMAT_USER_DEF6: + case ATOMISP_INPUT_FORMAT_USER_DEF7: + case ATOMISP_INPUT_FORMAT_USER_DEF8: break; } if (width_a == 0) @@ -420,9 +420,9 @@ enum ia_css_err ia_css_ifmtr_configure(struct ia_css_stream_config *config, if_a_config.buf_eol_offset = buffer_width * bits_per_pixel / 8 - line_width; if_a_config.is_yuv420_format = - (input_format == IA_CSS_STREAM_FORMAT_YUV420_8) - || (input_format == IA_CSS_STREAM_FORMAT_YUV420_10) - || (input_format == IA_CSS_STREAM_FORMAT_YUV420_16); + (input_format == ATOMISP_INPUT_FORMAT_YUV420_8) + || (input_format == ATOMISP_INPUT_FORMAT_YUV420_10) + || (input_format == ATOMISP_INPUT_FORMAT_YUV420_16); if_a_config.block_no_reqs = (config->mode != IA_CSS_INPUT_MODE_SENSOR); if (two_ppc) { @@ -449,9 +449,9 @@ enum ia_css_err ia_css_ifmtr_configure(struct ia_css_stream_config *config, if_b_config.buf_eol_offset = buffer_width * bits_per_pixel / 8 - line_width; if_b_config.is_yuv420_format = - input_format == IA_CSS_STREAM_FORMAT_YUV420_8 - || input_format == IA_CSS_STREAM_FORMAT_YUV420_10 - || input_format == IA_CSS_STREAM_FORMAT_YUV420_16; + input_format == ATOMISP_INPUT_FORMAT_YUV420_8 + || input_format == ATOMISP_INPUT_FORMAT_YUV420_10 + || input_format == ATOMISP_INPUT_FORMAT_YUV420_16; if_b_config.block_no_reqs = (config->mode != IA_CSS_INPUT_MODE_SENSOR); diff --git a/drivers/staging/media/atomisp/pci/atomisp2/css2400/runtime/inputfifo/interface/ia_css_inputfifo.h b/drivers/staging/media/atomisp/pci/atomisp2/css2400/runtime/inputfifo/interface/ia_css_inputfifo.h index 47d0f7e53f47..545f9e2da59e 100644 --- a/drivers/staging/media/atomisp/pci/atomisp2/css2400/runtime/inputfifo/interface/ia_css_inputfifo.h +++ b/drivers/staging/media/atomisp/pci/atomisp2/css2400/runtime/inputfifo/interface/ia_css_inputfifo.h @@ -42,12 +42,12 @@ void ia_css_inputfifo_send_input_frame( unsigned int width, unsigned int height, unsigned int ch_id, - enum ia_css_stream_format input_format, + enum atomisp_input_format input_format, bool two_ppc); void ia_css_inputfifo_start_frame( unsigned int ch_id, - enum ia_css_stream_format input_format, + enum atomisp_input_format input_format, bool two_ppc); void ia_css_inputfifo_send_line( @@ -59,7 +59,7 @@ void ia_css_inputfifo_send_line( void ia_css_inputfifo_send_embedded_line( unsigned int ch_id, - enum ia_css_stream_format data_type, + enum atomisp_input_format data_type, const unsigned short *data, unsigned int width); diff --git a/drivers/staging/media/atomisp/pci/atomisp2/css2400/runtime/inputfifo/src/inputfifo.c b/drivers/staging/media/atomisp/pci/atomisp2/css2400/runtime/inputfifo/src/inputfifo.c index 8dc74927e9a2..24ca4aaf8df1 100644 --- a/drivers/staging/media/atomisp/pci/atomisp2/css2400/runtime/inputfifo/src/inputfifo.c +++ b/drivers/staging/media/atomisp/pci/atomisp2/css2400/runtime/inputfifo/src/inputfifo.c @@ -86,7 +86,7 @@ static unsigned int inputfifo_curr_ch_id, inputfifo_curr_fmt_type; #endif struct inputfifo_instance { unsigned int ch_id; - enum ia_css_stream_format input_format; + enum atomisp_input_format input_format; bool two_ppc; bool streaming; unsigned int hblank_cycles; @@ -466,21 +466,21 @@ static void inputfifo_send_frame( static enum inputfifo_mipi_data_type inputfifo_determine_type( - enum ia_css_stream_format input_format) + enum atomisp_input_format input_format) { enum inputfifo_mipi_data_type type; type = inputfifo_mipi_data_type_regular; - if (input_format == IA_CSS_STREAM_FORMAT_YUV420_8_LEGACY) { + if (input_format == ATOMISP_INPUT_FORMAT_YUV420_8_LEGACY) { type = inputfifo_mipi_data_type_yuv420_legacy; - } else if (input_format == IA_CSS_STREAM_FORMAT_YUV420_8 || - input_format == IA_CSS_STREAM_FORMAT_YUV420_10 || - input_format == IA_CSS_STREAM_FORMAT_YUV420_16) { + } else if (input_format == ATOMISP_INPUT_FORMAT_YUV420_8 || + input_format == ATOMISP_INPUT_FORMAT_YUV420_10 || + input_format == ATOMISP_INPUT_FORMAT_YUV420_16) { type = inputfifo_mipi_data_type_yuv420; - } else if (input_format >= IA_CSS_STREAM_FORMAT_RGB_444 && - input_format <= IA_CSS_STREAM_FORMAT_RGB_888) { + } else if (input_format >= ATOMISP_INPUT_FORMAT_RGB_444 && + input_format <= ATOMISP_INPUT_FORMAT_RGB_888) { type = inputfifo_mipi_data_type_rgb; } @@ -500,7 +500,7 @@ void ia_css_inputfifo_send_input_frame( unsigned int width, unsigned int height, unsigned int ch_id, - enum ia_css_stream_format input_format, + enum atomisp_input_format input_format, bool two_ppc) { unsigned int fmt_type, hblank_cycles, marker_cycles; @@ -524,7 +524,7 @@ void ia_css_inputfifo_send_input_frame( void ia_css_inputfifo_start_frame( unsigned int ch_id, - enum ia_css_stream_format input_format, + enum atomisp_input_format input_format, bool two_ppc) { struct inputfifo_instance *s2mi; @@ -574,7 +574,7 @@ void ia_css_inputfifo_send_line( void ia_css_inputfifo_send_embedded_line( unsigned int ch_id, - enum ia_css_stream_format data_type, + enum atomisp_input_format data_type, const unsigned short *data, unsigned int width) { diff --git a/drivers/staging/media/atomisp/pci/atomisp2/css2400/runtime/isys/interface/ia_css_isys.h b/drivers/staging/media/atomisp/pci/atomisp2/css2400/runtime/isys/interface/ia_css_isys.h index 5f5ee28a157f..8c005db9766e 100644 --- a/drivers/staging/media/atomisp/pci/atomisp2/css2400/runtime/isys/interface/ia_css_isys.h +++ b/drivers/staging/media/atomisp/pci/atomisp2/css2400/runtime/isys/interface/ia_css_isys.h @@ -90,7 +90,7 @@ enum ia_css_err ia_css_isys_convert_compressed_format( struct ia_css_csi2_compression *comp, struct input_system_cfg_s *cfg); unsigned int ia_css_csi2_calculate_input_system_alignment( - enum ia_css_stream_format fmt_type); + enum atomisp_input_format fmt_type); #endif #if !defined(USE_INPUT_SYSTEM_VERSION_2401) @@ -124,7 +124,7 @@ unsigned int ia_css_isys_rx_translate_irq_infos(unsigned int bits); * format type must be sumitted correctly by the application. */ enum ia_css_err ia_css_isys_convert_stream_format_to_mipi_format( - enum ia_css_stream_format input_format, + enum atomisp_input_format input_format, mipi_predictor_t compression, unsigned int *fmt_type); diff --git a/drivers/staging/media/atomisp/pci/atomisp2/css2400/runtime/isys/src/rx.c b/drivers/staging/media/atomisp/pci/atomisp2/css2400/runtime/isys/src/rx.c index 65ddff137291..425bd3cc3f34 100644 --- a/drivers/staging/media/atomisp/pci/atomisp2/css2400/runtime/isys/src/rx.c +++ b/drivers/staging/media/atomisp/pci/atomisp2/css2400/runtime/isys/src/rx.c @@ -229,7 +229,7 @@ void ia_css_isys_rx_clear_irq_info(enum mipi_port_id port, unsigned int irq_info #endif /* #if !defined(USE_INPUT_SYSTEM_VERSION_2401) */ enum ia_css_err ia_css_isys_convert_stream_format_to_mipi_format( - enum ia_css_stream_format input_format, + enum atomisp_input_format input_format, mipi_predictor_t compression, unsigned int *fmt_type) { @@ -244,25 +244,25 @@ enum ia_css_err ia_css_isys_convert_stream_format_to_mipi_format( */ if (compression != MIPI_PREDICTOR_NONE) { switch (input_format) { - case IA_CSS_STREAM_FORMAT_RAW_6: + case ATOMISP_INPUT_FORMAT_RAW_6: *fmt_type = 6; break; - case IA_CSS_STREAM_FORMAT_RAW_7: + case ATOMISP_INPUT_FORMAT_RAW_7: *fmt_type = 7; break; - case IA_CSS_STREAM_FORMAT_RAW_8: + case ATOMISP_INPUT_FORMAT_RAW_8: *fmt_type = 8; break; - case IA_CSS_STREAM_FORMAT_RAW_10: + case ATOMISP_INPUT_FORMAT_RAW_10: *fmt_type = 10; break; - case IA_CSS_STREAM_FORMAT_RAW_12: + case ATOMISP_INPUT_FORMAT_RAW_12: *fmt_type = 12; break; - case IA_CSS_STREAM_FORMAT_RAW_14: + case ATOMISP_INPUT_FORMAT_RAW_14: *fmt_type = 14; break; - case IA_CSS_STREAM_FORMAT_RAW_16: + case ATOMISP_INPUT_FORMAT_RAW_16: *fmt_type = 16; break; default: @@ -277,96 +277,96 @@ enum ia_css_err ia_css_isys_convert_stream_format_to_mipi_format( * MW: For some reason the mapping is not 1-to-1 */ switch (input_format) { - case IA_CSS_STREAM_FORMAT_RGB_888: + case ATOMISP_INPUT_FORMAT_RGB_888: *fmt_type = MIPI_FORMAT_RGB888; break; - case IA_CSS_STREAM_FORMAT_RGB_555: + case ATOMISP_INPUT_FORMAT_RGB_555: *fmt_type = MIPI_FORMAT_RGB555; break; - case IA_CSS_STREAM_FORMAT_RGB_444: + case ATOMISP_INPUT_FORMAT_RGB_444: *fmt_type = MIPI_FORMAT_RGB444; break; - case IA_CSS_STREAM_FORMAT_RGB_565: + case ATOMISP_INPUT_FORMAT_RGB_565: *fmt_type = MIPI_FORMAT_RGB565; break; - case IA_CSS_STREAM_FORMAT_RGB_666: + case ATOMISP_INPUT_FORMAT_RGB_666: *fmt_type = MIPI_FORMAT_RGB666; break; - case IA_CSS_STREAM_FORMAT_RAW_8: + case ATOMISP_INPUT_FORMAT_RAW_8: *fmt_type = MIPI_FORMAT_RAW8; break; - case IA_CSS_STREAM_FORMAT_RAW_10: + case ATOMISP_INPUT_FORMAT_RAW_10: *fmt_type = MIPI_FORMAT_RAW10; break; - case IA_CSS_STREAM_FORMAT_RAW_6: + case ATOMISP_INPUT_FORMAT_RAW_6: *fmt_type = MIPI_FORMAT_RAW6; break; - case IA_CSS_STREAM_FORMAT_RAW_7: + case ATOMISP_INPUT_FORMAT_RAW_7: *fmt_type = MIPI_FORMAT_RAW7; break; - case IA_CSS_STREAM_FORMAT_RAW_12: + case ATOMISP_INPUT_FORMAT_RAW_12: *fmt_type = MIPI_FORMAT_RAW12; break; - case IA_CSS_STREAM_FORMAT_RAW_14: + case ATOMISP_INPUT_FORMAT_RAW_14: *fmt_type = MIPI_FORMAT_RAW14; break; - case IA_CSS_STREAM_FORMAT_YUV420_8: + case ATOMISP_INPUT_FORMAT_YUV420_8: *fmt_type = MIPI_FORMAT_YUV420_8; break; - case IA_CSS_STREAM_FORMAT_YUV420_10: + case ATOMISP_INPUT_FORMAT_YUV420_10: *fmt_type = MIPI_FORMAT_YUV420_10; break; - case IA_CSS_STREAM_FORMAT_YUV422_8: + case ATOMISP_INPUT_FORMAT_YUV422_8: *fmt_type = MIPI_FORMAT_YUV422_8; break; - case IA_CSS_STREAM_FORMAT_YUV422_10: + case ATOMISP_INPUT_FORMAT_YUV422_10: *fmt_type = MIPI_FORMAT_YUV422_10; break; - case IA_CSS_STREAM_FORMAT_YUV420_8_LEGACY: + case ATOMISP_INPUT_FORMAT_YUV420_8_LEGACY: *fmt_type = MIPI_FORMAT_YUV420_8_LEGACY; break; - case IA_CSS_STREAM_FORMAT_EMBEDDED: + case ATOMISP_INPUT_FORMAT_EMBEDDED: *fmt_type = MIPI_FORMAT_EMBEDDED; break; #ifndef USE_INPUT_SYSTEM_VERSION_2401 - case IA_CSS_STREAM_FORMAT_RAW_16: + case ATOMISP_INPUT_FORMAT_RAW_16: /* This is not specified by Arasan, so we use * 17 for now. */ *fmt_type = MIPI_FORMAT_RAW16; break; - case IA_CSS_STREAM_FORMAT_BINARY_8: + case ATOMISP_INPUT_FORMAT_BINARY_8: *fmt_type = MIPI_FORMAT_BINARY_8; break; #else - case IA_CSS_STREAM_FORMAT_USER_DEF1: + case ATOMISP_INPUT_FORMAT_USER_DEF1: *fmt_type = MIPI_FORMAT_CUSTOM0; break; - case IA_CSS_STREAM_FORMAT_USER_DEF2: + case ATOMISP_INPUT_FORMAT_USER_DEF2: *fmt_type = MIPI_FORMAT_CUSTOM1; break; - case IA_CSS_STREAM_FORMAT_USER_DEF3: + case ATOMISP_INPUT_FORMAT_USER_DEF3: *fmt_type = MIPI_FORMAT_CUSTOM2; break; - case IA_CSS_STREAM_FORMAT_USER_DEF4: + case ATOMISP_INPUT_FORMAT_USER_DEF4: *fmt_type = MIPI_FORMAT_CUSTOM3; break; - case IA_CSS_STREAM_FORMAT_USER_DEF5: + case ATOMISP_INPUT_FORMAT_USER_DEF5: *fmt_type = MIPI_FORMAT_CUSTOM4; break; - case IA_CSS_STREAM_FORMAT_USER_DEF6: + case ATOMISP_INPUT_FORMAT_USER_DEF6: *fmt_type = MIPI_FORMAT_CUSTOM5; break; - case IA_CSS_STREAM_FORMAT_USER_DEF7: + case ATOMISP_INPUT_FORMAT_USER_DEF7: *fmt_type = MIPI_FORMAT_CUSTOM6; break; - case IA_CSS_STREAM_FORMAT_USER_DEF8: + case ATOMISP_INPUT_FORMAT_USER_DEF8: *fmt_type = MIPI_FORMAT_CUSTOM7; break; #endif - case IA_CSS_STREAM_FORMAT_YUV420_16: - case IA_CSS_STREAM_FORMAT_YUV422_16: + case ATOMISP_INPUT_FORMAT_YUV420_16: + case ATOMISP_INPUT_FORMAT_YUV422_16: default: return IA_CSS_ERR_INTERNAL_ERROR; } @@ -448,34 +448,34 @@ enum ia_css_err ia_css_isys_convert_compressed_format( } unsigned int ia_css_csi2_calculate_input_system_alignment( - enum ia_css_stream_format fmt_type) + enum atomisp_input_format fmt_type) { unsigned int memory_alignment_in_bytes = HIVE_ISP_DDR_WORD_BYTES; switch (fmt_type) { - case IA_CSS_STREAM_FORMAT_RAW_6: - case IA_CSS_STREAM_FORMAT_RAW_7: - case IA_CSS_STREAM_FORMAT_RAW_8: - case IA_CSS_STREAM_FORMAT_RAW_10: - case IA_CSS_STREAM_FORMAT_RAW_12: - case IA_CSS_STREAM_FORMAT_RAW_14: + case ATOMISP_INPUT_FORMAT_RAW_6: + case ATOMISP_INPUT_FORMAT_RAW_7: + case ATOMISP_INPUT_FORMAT_RAW_8: + case ATOMISP_INPUT_FORMAT_RAW_10: + case ATOMISP_INPUT_FORMAT_RAW_12: + case ATOMISP_INPUT_FORMAT_RAW_14: memory_alignment_in_bytes = 2 * ISP_VEC_NELEMS; break; - case IA_CSS_STREAM_FORMAT_YUV420_8: - case IA_CSS_STREAM_FORMAT_YUV422_8: - case IA_CSS_STREAM_FORMAT_USER_DEF1: - case IA_CSS_STREAM_FORMAT_USER_DEF2: - case IA_CSS_STREAM_FORMAT_USER_DEF3: - case IA_CSS_STREAM_FORMAT_USER_DEF4: - case IA_CSS_STREAM_FORMAT_USER_DEF5: - case IA_CSS_STREAM_FORMAT_USER_DEF6: - case IA_CSS_STREAM_FORMAT_USER_DEF7: - case IA_CSS_STREAM_FORMAT_USER_DEF8: + case ATOMISP_INPUT_FORMAT_YUV420_8: + case ATOMISP_INPUT_FORMAT_YUV422_8: + case ATOMISP_INPUT_FORMAT_USER_DEF1: + case ATOMISP_INPUT_FORMAT_USER_DEF2: + case ATOMISP_INPUT_FORMAT_USER_DEF3: + case ATOMISP_INPUT_FORMAT_USER_DEF4: + case ATOMISP_INPUT_FORMAT_USER_DEF5: + case ATOMISP_INPUT_FORMAT_USER_DEF6: + case ATOMISP_INPUT_FORMAT_USER_DEF7: + case ATOMISP_INPUT_FORMAT_USER_DEF8: /* Planar YUV formats need to have all planes aligned, this means * double the alignment for the Y plane if the horizontal decimation is 2. */ memory_alignment_in_bytes = 2 * HIVE_ISP_DDR_WORD_BYTES; break; - case IA_CSS_STREAM_FORMAT_EMBEDDED: + case ATOMISP_INPUT_FORMAT_EMBEDDED: default: memory_alignment_in_bytes = HIVE_ISP_DDR_WORD_BYTES; break; diff --git a/drivers/staging/media/atomisp/pci/atomisp2/css2400/sh_css.c b/drivers/staging/media/atomisp/pci/atomisp2/css2400/sh_css.c index 2f0b76a33414..c771e4b910f3 100644 --- a/drivers/staging/media/atomisp/pci/atomisp2/css2400/sh_css.c +++ b/drivers/staging/media/atomisp/pci/atomisp2/css2400/sh_css.c @@ -462,46 +462,46 @@ verify_copy_out_frame_format(struct ia_css_pipe *pipe) assert(pipe->stream != NULL); switch (pipe->stream->config.input_config.format) { - case IA_CSS_STREAM_FORMAT_YUV420_8_LEGACY: - case IA_CSS_STREAM_FORMAT_YUV420_8: + case ATOMISP_INPUT_FORMAT_YUV420_8_LEGACY: + case ATOMISP_INPUT_FORMAT_YUV420_8: for (i=0; iisys_config[isys_stream_idx].format; if ((stream_cfg->mode == IA_CSS_INPUT_MODE_SENSOR || @@ -936,11 +936,11 @@ static bool sh_css_translate_stream_cfg_to_input_system_input_port_resolution( if (stream_cfg->source.port.compression.uncompressed_bits_per_pixel == UNCOMPRESSED_BITS_PER_PIXEL_10) { - fmt_type = IA_CSS_STREAM_FORMAT_RAW_10; + fmt_type = ATOMISP_INPUT_FORMAT_RAW_10; } else if (stream_cfg->source.port.compression.uncompressed_bits_per_pixel == UNCOMPRESSED_BITS_PER_PIXEL_12) { - fmt_type = IA_CSS_STREAM_FORMAT_RAW_12; + fmt_type = ATOMISP_INPUT_FORMAT_RAW_12; } else return false; @@ -1391,7 +1391,7 @@ start_copy_on_sp(struct ia_css_pipe *pipe, ia_css_isys_rx_disable(); #endif - if (pipe->stream->config.input_config.format != IA_CSS_STREAM_FORMAT_BINARY_8) + if (pipe->stream->config.input_config.format != ATOMISP_INPUT_FORMAT_BINARY_8) return IA_CSS_ERR_INTERNAL_ERROR; sh_css_sp_start_binary_copy(ia_css_pipe_get_pipe_num(pipe), out_frame, pipe->stream->config.pixels_per_clock == 2); @@ -6784,7 +6784,7 @@ static bool copy_on_sp(struct ia_css_pipe *pipe) rval &= (pipe->config.default_capture_config.mode == IA_CSS_CAPTURE_MODE_RAW); - rval &= ((pipe->stream->config.input_config.format == IA_CSS_STREAM_FORMAT_BINARY_8) || + rval &= ((pipe->stream->config.input_config.format == ATOMISP_INPUT_FORMAT_BINARY_8) || (pipe->config.mode == IA_CSS_PIPE_MODE_COPY)); return rval; @@ -6817,7 +6817,7 @@ static enum ia_css_err load_capture_binaries( return err; } if (copy_on_sp(pipe) && - pipe->stream->config.input_config.format == IA_CSS_STREAM_FORMAT_BINARY_8) { + pipe->stream->config.input_config.format == ATOMISP_INPUT_FORMAT_BINARY_8) { ia_css_frame_info_init( &pipe->output_info[0], JPEG_BYTES, @@ -6915,7 +6915,7 @@ need_yuv_scaler_stage(const struct ia_css_pipe *pipe) /* TODO: make generic function */ need_format_conversion = - ((pipe->stream->config.input_config.format == IA_CSS_STREAM_FORMAT_YUV420_8_LEGACY) && + ((pipe->stream->config.input_config.format == ATOMISP_INPUT_FORMAT_YUV420_8_LEGACY) && (pipe->output_info[0].format != IA_CSS_FRAME_FORMAT_CSI_MIPI_LEGACY_YUV420_8)); in_res = pipe->config.input_effective_res; @@ -7304,7 +7304,7 @@ load_yuvpp_binaries(struct ia_css_pipe *pipe) /* * NOTES * - Why does the "yuvpp" pipe needs "isp_copy_binary" (i.e. ISP Copy) when - * its input is "IA_CSS_STREAM_FORMAT_YUV422_8"? + * its input is "ATOMISP_INPUT_FORMAT_YUV422_8"? * * In most use cases, the first stage in the "yuvpp" pipe is the "yuv_scale_ * binary". However, the "yuv_scale_binary" does NOT support the input-frame @@ -7319,7 +7319,7 @@ load_yuvpp_binaries(struct ia_css_pipe *pipe) * "yuv_scale_binary". */ need_isp_copy_binary = - (pipe->stream->config.input_config.format == IA_CSS_STREAM_FORMAT_YUV422_8); + (pipe->stream->config.input_config.format == ATOMISP_INPUT_FORMAT_YUV422_8); #else /* !USE_INPUT_SYSTEM_VERSION_2401 */ need_isp_copy_binary = true; #endif /* USE_INPUT_SYSTEM_VERSION_2401 */ @@ -7627,11 +7627,11 @@ create_host_yuvpp_pipeline(struct ia_css_pipe *pipe) * Bayer-Quad RAW. */ int in_frame_format; - if (pipe->stream->config.input_config.format == IA_CSS_STREAM_FORMAT_YUV420_8_LEGACY) { + if (pipe->stream->config.input_config.format == ATOMISP_INPUT_FORMAT_YUV420_8_LEGACY) { in_frame_format = IA_CSS_FRAME_FORMAT_CSI_MIPI_LEGACY_YUV420_8; - } else if (pipe->stream->config.input_config.format == IA_CSS_STREAM_FORMAT_YUV422_8) { + } else if (pipe->stream->config.input_config.format == ATOMISP_INPUT_FORMAT_YUV422_8) { /* - * When the sensor output frame format is "IA_CSS_STREAM_FORMAT_YUV422_8", + * When the sensor output frame format is "ATOMISP_INPUT_FORMAT_YUV422_8", * the "isp_copy_var" binary is selected as the first stage in the yuvpp * pipe. * @@ -7812,7 +7812,7 @@ create_host_copy_pipeline(struct ia_css_pipe *pipe, out_frame->flash_state = IA_CSS_FRAME_FLASH_STATE_NONE; if (copy_on_sp(pipe) && - pipe->stream->config.input_config.format == IA_CSS_STREAM_FORMAT_BINARY_8) { + pipe->stream->config.input_config.format == ATOMISP_INPUT_FORMAT_BINARY_8) { ia_css_frame_info_init( &out_frame->info, JPEG_BYTES, @@ -8327,7 +8327,7 @@ sh_css_pipe_get_output_frame_info(struct ia_css_pipe *pipe, *info = pipe->output_info[idx]; if (copy_on_sp(pipe) && - pipe->stream->config.input_config.format == IA_CSS_STREAM_FORMAT_BINARY_8) { + pipe->stream->config.input_config.format == ATOMISP_INPUT_FORMAT_BINARY_8) { ia_css_frame_info_init( info, JPEG_BYTES, @@ -8388,7 +8388,7 @@ ia_css_stream_send_input_line(const struct ia_css_stream *stream, void ia_css_stream_send_input_embedded_line(const struct ia_css_stream *stream, - enum ia_css_stream_format format, + enum atomisp_input_format format, const unsigned short *data, unsigned int width) { @@ -9359,7 +9359,7 @@ ia_css_stream_create(const struct ia_css_stream_config *stream_config, #if defined(USE_INPUT_SYSTEM_VERSION_2) /* We don't support metadata for JPEG stream, since they both use str2mem */ - if (stream_config->input_config.format == IA_CSS_STREAM_FORMAT_BINARY_8 && + if (stream_config->input_config.format == ATOMISP_INPUT_FORMAT_BINARY_8 && stream_config->metadata_config.resolution.height > 0) { err = IA_CSS_ERR_INVALID_ARGUMENTS; IA_CSS_LEAVE_ERR(err); @@ -10138,7 +10138,7 @@ ia_css_temp_pipe_to_pipe_id(const struct ia_css_pipe *pipe, enum ia_css_pipe_id return IA_CSS_SUCCESS; } -enum ia_css_stream_format +enum atomisp_input_format ia_css_stream_get_format(const struct ia_css_stream *stream) { return stream->config.input_config.format; diff --git a/drivers/staging/media/atomisp/pci/atomisp2/css2400/sh_css_mipi.c b/drivers/staging/media/atomisp/pci/atomisp2/css2400/sh_css_mipi.c index 0c2e5e3a007a..a6a00024bae8 100644 --- a/drivers/staging/media/atomisp/pci/atomisp2/css2400/sh_css_mipi.c +++ b/drivers/staging/media/atomisp/pci/atomisp2/css2400/sh_css_mipi.c @@ -104,7 +104,7 @@ static bool ia_css_mipi_is_source_port_valid(struct ia_css_pipe *pipe, enum ia_css_err ia_css_mipi_frame_calculate_size(const unsigned int width, const unsigned int height, - const enum ia_css_stream_format format, + const enum atomisp_input_format format, const bool hasSOLandEOL, const unsigned int embedded_data_size_words, unsigned int *size_mem_words) @@ -136,16 +136,16 @@ ia_css_mipi_frame_calculate_size(const unsigned int width, width_padded, height, format, hasSOLandEOL, embedded_data_size_words); switch (format) { - case IA_CSS_STREAM_FORMAT_RAW_6: /* 4p, 3B, 24bits */ + case ATOMISP_INPUT_FORMAT_RAW_6: /* 4p, 3B, 24bits */ bits_per_pixel = 6; break; - case IA_CSS_STREAM_FORMAT_RAW_7: /* 8p, 7B, 56bits */ + case ATOMISP_INPUT_FORMAT_RAW_7: /* 8p, 7B, 56bits */ bits_per_pixel = 7; break; - case IA_CSS_STREAM_FORMAT_RAW_8: /* 1p, 1B, 8bits */ - case IA_CSS_STREAM_FORMAT_BINARY_8: /* 8bits, TODO: check. */ - case IA_CSS_STREAM_FORMAT_YUV420_8: /* odd 2p, 2B, 16bits, even 2p, 4B, 32bits */ + case ATOMISP_INPUT_FORMAT_RAW_8: /* 1p, 1B, 8bits */ + case ATOMISP_INPUT_FORMAT_BINARY_8: /* 8bits, TODO: check. */ + case ATOMISP_INPUT_FORMAT_YUV420_8: /* odd 2p, 2B, 16bits, even 2p, 4B, 32bits */ bits_per_pixel = 8; break; - case IA_CSS_STREAM_FORMAT_YUV420_10: /* odd 4p, 5B, 40bits, even 4p, 10B, 80bits */ - case IA_CSS_STREAM_FORMAT_RAW_10: /* 4p, 5B, 40bits */ + case ATOMISP_INPUT_FORMAT_YUV420_10: /* odd 4p, 5B, 40bits, even 4p, 10B, 80bits */ + case ATOMISP_INPUT_FORMAT_RAW_10: /* 4p, 5B, 40bits */ #if !defined(HAS_NO_PACKED_RAW_PIXELS) /* The changes will be reverted as soon as RAW * Buffers are deployed by the 2401 Input System @@ -156,26 +156,26 @@ ia_css_mipi_frame_calculate_size(const unsigned int width, bits_per_pixel = 16; #endif break; - case IA_CSS_STREAM_FORMAT_YUV420_8_LEGACY: /* 2p, 3B, 24bits */ - case IA_CSS_STREAM_FORMAT_RAW_12: /* 2p, 3B, 24bits */ + case ATOMISP_INPUT_FORMAT_YUV420_8_LEGACY: /* 2p, 3B, 24bits */ + case ATOMISP_INPUT_FORMAT_RAW_12: /* 2p, 3B, 24bits */ bits_per_pixel = 12; break; - case IA_CSS_STREAM_FORMAT_RAW_14: /* 4p, 7B, 56bits */ + case ATOMISP_INPUT_FORMAT_RAW_14: /* 4p, 7B, 56bits */ bits_per_pixel = 14; break; - case IA_CSS_STREAM_FORMAT_RGB_444: /* 1p, 2B, 16bits */ - case IA_CSS_STREAM_FORMAT_RGB_555: /* 1p, 2B, 16bits */ - case IA_CSS_STREAM_FORMAT_RGB_565: /* 1p, 2B, 16bits */ - case IA_CSS_STREAM_FORMAT_YUV422_8: /* 2p, 4B, 32bits */ + case ATOMISP_INPUT_FORMAT_RGB_444: /* 1p, 2B, 16bits */ + case ATOMISP_INPUT_FORMAT_RGB_555: /* 1p, 2B, 16bits */ + case ATOMISP_INPUT_FORMAT_RGB_565: /* 1p, 2B, 16bits */ + case ATOMISP_INPUT_FORMAT_YUV422_8: /* 2p, 4B, 32bits */ bits_per_pixel = 16; break; - case IA_CSS_STREAM_FORMAT_RGB_666: /* 4p, 9B, 72bits */ + case ATOMISP_INPUT_FORMAT_RGB_666: /* 4p, 9B, 72bits */ bits_per_pixel = 18; break; - case IA_CSS_STREAM_FORMAT_YUV422_10: /* 2p, 5B, 40bits */ + case ATOMISP_INPUT_FORMAT_YUV422_10: /* 2p, 5B, 40bits */ bits_per_pixel = 20; break; - case IA_CSS_STREAM_FORMAT_RGB_888: /* 1p, 3B, 24bits */ + case ATOMISP_INPUT_FORMAT_RGB_888: /* 1p, 3B, 24bits */ bits_per_pixel = 24; break; - case IA_CSS_STREAM_FORMAT_YUV420_16: /* Not supported */ - case IA_CSS_STREAM_FORMAT_YUV422_16: /* Not supported */ - case IA_CSS_STREAM_FORMAT_RAW_16: /* TODO: not specified in MIPI SPEC, check */ + case ATOMISP_INPUT_FORMAT_YUV420_16: /* Not supported */ + case ATOMISP_INPUT_FORMAT_YUV422_16: /* Not supported */ + case ATOMISP_INPUT_FORMAT_RAW_16: /* TODO: not specified in MIPI SPEC, check */ default: return IA_CSS_ERR_INVALID_ARGUMENTS; } @@ -183,9 +183,9 @@ ia_css_mipi_frame_calculate_size(const unsigned int width, odd_line_bytes = (width_padded * bits_per_pixel + 7) >> 3; /* ceil ( bits per line / 8) */ /* Even lines for YUV420 formats are double in bits_per_pixel. */ - if (format == IA_CSS_STREAM_FORMAT_YUV420_8 - || format == IA_CSS_STREAM_FORMAT_YUV420_10 - || format == IA_CSS_STREAM_FORMAT_YUV420_16) { + if (format == ATOMISP_INPUT_FORMAT_YUV420_8 + || format == ATOMISP_INPUT_FORMAT_YUV420_10 + || format == ATOMISP_INPUT_FORMAT_YUV420_16) { even_line_bytes = (width_padded * 2 * bits_per_pixel + 7) >> 3; /* ceil ( bits per line / 8) */ } else { even_line_bytes = odd_line_bytes; @@ -285,7 +285,7 @@ calculate_mipi_buff_size( #else unsigned int width; unsigned int height; - enum ia_css_stream_format format; + enum atomisp_input_format format; bool pack_raw_pixels; unsigned int width_padded; @@ -348,15 +348,15 @@ calculate_mipi_buff_size( bits_per_pixel = sh_css_stream_format_2_bits_per_subpixel(format); bits_per_pixel = - (format == IA_CSS_STREAM_FORMAT_RAW_10 && pack_raw_pixels) ? bits_per_pixel : 16; + (format == ATOMISP_INPUT_FORMAT_RAW_10 && pack_raw_pixels) ? bits_per_pixel : 16; if (bits_per_pixel == 0) return IA_CSS_ERR_INTERNAL_ERROR; odd_line_bytes = (width_padded * bits_per_pixel + 7) >> 3; /* ceil ( bits per line / 8) */ /* Even lines for YUV420 formats are double in bits_per_pixel. */ - if (format == IA_CSS_STREAM_FORMAT_YUV420_8 - || format == IA_CSS_STREAM_FORMAT_YUV420_10) { + if (format == ATOMISP_INPUT_FORMAT_YUV420_8 + || format == ATOMISP_INPUT_FORMAT_YUV420_10) { even_line_bytes = (width_padded * 2 * bits_per_pixel + 7) >> 3; /* ceil ( bits per line / 8) */ } else { even_line_bytes = odd_line_bytes; diff --git a/drivers/staging/media/atomisp/pci/atomisp2/css2400/sh_css_params.c b/drivers/staging/media/atomisp/pci/atomisp2/css2400/sh_css_params.c index ba2b96e330d0..43529b1605c3 100644 --- a/drivers/staging/media/atomisp/pci/atomisp2/css2400/sh_css_params.c +++ b/drivers/staging/media/atomisp/pci/atomisp2/css2400/sh_css_params.c @@ -1741,7 +1741,7 @@ ia_css_process_zoom_and_motion( out_infos[0] = &args->out_frame[0]->info; info = &stage->firmware->info.isp; ia_css_binary_fill_info(info, false, false, - IA_CSS_STREAM_FORMAT_RAW_10, + ATOMISP_INPUT_FORMAT_RAW_10, args->in_frame ? &args->in_frame->info : NULL, NULL, out_infos, diff --git a/drivers/staging/media/atomisp/pci/atomisp2/css2400/sh_css_sp.c b/drivers/staging/media/atomisp/pci/atomisp2/css2400/sh_css_sp.c index 93f7c50511d8..85263725540d 100644 --- a/drivers/staging/media/atomisp/pci/atomisp2/css2400/sh_css_sp.c +++ b/drivers/staging/media/atomisp/pci/atomisp2/css2400/sh_css_sp.c @@ -754,7 +754,7 @@ sh_css_sp_write_frame_pointers(const struct sh_css_binary_args *args) static void sh_css_sp_init_group(bool two_ppc, - enum ia_css_stream_format input_format, + enum atomisp_input_format input_format, bool no_isp_sync, uint8_t if_config_index) { @@ -1117,7 +1117,7 @@ sp_init_stage(struct ia_css_pipeline_stage *stage, out_infos[0] = &args->out_frame[0]->info; info = &firmware->info.isp; ia_css_binary_fill_info(info, false, false, - IA_CSS_STREAM_FORMAT_RAW_10, + ATOMISP_INPUT_FORMAT_RAW_10, args->in_frame ? &args->in_frame->info : NULL, NULL, out_infos, diff --git a/drivers/staging/media/atomisp/pci/atomisp2/css2400/sh_css_stream_format.c b/drivers/staging/media/atomisp/pci/atomisp2/css2400/sh_css_stream_format.c index 52d0a6471597..77f135e7dc3c 100644 --- a/drivers/staging/media/atomisp/pci/atomisp2/css2400/sh_css_stream_format.c +++ b/drivers/staging/media/atomisp/pci/atomisp2/css2400/sh_css_stream_format.c @@ -16,55 +16,55 @@ #include unsigned int sh_css_stream_format_2_bits_per_subpixel( - enum ia_css_stream_format format) + enum atomisp_input_format format) { unsigned int rval; switch (format) { - case IA_CSS_STREAM_FORMAT_RGB_444: + case ATOMISP_INPUT_FORMAT_RGB_444: rval = 4; break; - case IA_CSS_STREAM_FORMAT_RGB_555: + case ATOMISP_INPUT_FORMAT_RGB_555: rval = 5; break; - case IA_CSS_STREAM_FORMAT_RGB_565: - case IA_CSS_STREAM_FORMAT_RGB_666: - case IA_CSS_STREAM_FORMAT_RAW_6: + case ATOMISP_INPUT_FORMAT_RGB_565: + case ATOMISP_INPUT_FORMAT_RGB_666: + case ATOMISP_INPUT_FORMAT_RAW_6: rval = 6; break; - case IA_CSS_STREAM_FORMAT_RAW_7: + case ATOMISP_INPUT_FORMAT_RAW_7: rval = 7; break; - case IA_CSS_STREAM_FORMAT_YUV420_8_LEGACY: - case IA_CSS_STREAM_FORMAT_YUV420_8: - case IA_CSS_STREAM_FORMAT_YUV422_8: - case IA_CSS_STREAM_FORMAT_RGB_888: - case IA_CSS_STREAM_FORMAT_RAW_8: - case IA_CSS_STREAM_FORMAT_BINARY_8: - case IA_CSS_STREAM_FORMAT_USER_DEF1: - case IA_CSS_STREAM_FORMAT_USER_DEF2: - case IA_CSS_STREAM_FORMAT_USER_DEF3: - case IA_CSS_STREAM_FORMAT_USER_DEF4: - case IA_CSS_STREAM_FORMAT_USER_DEF5: - case IA_CSS_STREAM_FORMAT_USER_DEF6: - case IA_CSS_STREAM_FORMAT_USER_DEF7: - case IA_CSS_STREAM_FORMAT_USER_DEF8: + case ATOMISP_INPUT_FORMAT_YUV420_8_LEGACY: + case ATOMISP_INPUT_FORMAT_YUV420_8: + case ATOMISP_INPUT_FORMAT_YUV422_8: + case ATOMISP_INPUT_FORMAT_RGB_888: + case ATOMISP_INPUT_FORMAT_RAW_8: + case ATOMISP_INPUT_FORMAT_BINARY_8: + case ATOMISP_INPUT_FORMAT_USER_DEF1: + case ATOMISP_INPUT_FORMAT_USER_DEF2: + case ATOMISP_INPUT_FORMAT_USER_DEF3: + case ATOMISP_INPUT_FORMAT_USER_DEF4: + case ATOMISP_INPUT_FORMAT_USER_DEF5: + case ATOMISP_INPUT_FORMAT_USER_DEF6: + case ATOMISP_INPUT_FORMAT_USER_DEF7: + case ATOMISP_INPUT_FORMAT_USER_DEF8: rval = 8; break; - case IA_CSS_STREAM_FORMAT_YUV420_10: - case IA_CSS_STREAM_FORMAT_YUV422_10: - case IA_CSS_STREAM_FORMAT_RAW_10: + case ATOMISP_INPUT_FORMAT_YUV420_10: + case ATOMISP_INPUT_FORMAT_YUV422_10: + case ATOMISP_INPUT_FORMAT_RAW_10: rval = 10; break; - case IA_CSS_STREAM_FORMAT_RAW_12: + case ATOMISP_INPUT_FORMAT_RAW_12: rval = 12; break; - case IA_CSS_STREAM_FORMAT_RAW_14: + case ATOMISP_INPUT_FORMAT_RAW_14: rval = 14; break; - case IA_CSS_STREAM_FORMAT_RAW_16: - case IA_CSS_STREAM_FORMAT_YUV420_16: - case IA_CSS_STREAM_FORMAT_YUV422_16: + case ATOMISP_INPUT_FORMAT_RAW_16: + case ATOMISP_INPUT_FORMAT_YUV420_16: + case ATOMISP_INPUT_FORMAT_YUV422_16: rval = 16; break; default: diff --git a/drivers/staging/media/atomisp/pci/atomisp2/css2400/sh_css_stream_format.h b/drivers/staging/media/atomisp/pci/atomisp2/css2400/sh_css_stream_format.h index aab2b6207051..b699f538e0dd 100644 --- a/drivers/staging/media/atomisp/pci/atomisp2/css2400/sh_css_stream_format.h +++ b/drivers/staging/media/atomisp/pci/atomisp2/css2400/sh_css_stream_format.h @@ -18,6 +18,6 @@ #include unsigned int sh_css_stream_format_2_bits_per_subpixel( - enum ia_css_stream_format format); + enum atomisp_input_format format); #endif /* __SH_CSS_STREAM_FORMAT_H */ From 1401b579fa77c79f098e70775fe0ea0cc05b513d Mon Sep 17 00:00:00 2001 From: Hans Verkuil Date: Fri, 30 Mar 2018 03:30:06 -0400 Subject: [PATCH 45/48] media: extended-controls.rst: transmitter -> receiver V4L2_CID_DV_RX_POWER_PRESENT refers to a receiver, not a transmitter. Signed-off-by: Hans Verkuil Signed-off-by: Mauro Carvalho Chehab --- Documentation/media/uapi/v4l/extended-controls.rst | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Documentation/media/uapi/v4l/extended-controls.rst b/Documentation/media/uapi/v4l/extended-controls.rst index d5f3eb6e674a..03931f9b1285 100644 --- a/Documentation/media/uapi/v4l/extended-controls.rst +++ b/Documentation/media/uapi/v4l/extended-controls.rst @@ -3565,7 +3565,7 @@ enum v4l2_dv_it_content_type - HDMI carries 5V on one of the pins). This is often used to power an eeprom which contains EDID information, such that the source can read the EDID even if the sink is in standby/power off. Each bit - corresponds to an input pad on the transmitter. If an input pad + corresponds to an input pad on the receiver. If an input pad cannot detect whether power is present, then the bit for that pad will be 0. This read-only control is applicable to DVI-D, HDMI and DisplayPort connectors. From 2b8677ec0c6b08ad8e3c8aef0b0827994a305361 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Niklas=20S=C3=B6derlund?= Date: Mon, 26 Mar 2018 18:09:51 -0400 Subject: [PATCH 46/48] media: i2c: adv748x: afe: fix sparse warning MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit This fixes the following sparse warning: drivers/media/i2c/adv748x/adv748x-afe.c:294:34: expected unsigned int [usertype] *signal drivers/media/i2c/adv748x/adv748x-afe.c:294:34: got int * drivers/media/i2c/adv748x/adv748x-afe.c:294:34: warning: incorrect type in argument 2 (different signedness) Signed-off-by: Niklas Söderlund Reviewed-by: Kieran Bingham Signed-off-by: Mauro Carvalho Chehab --- drivers/media/i2c/adv748x/adv748x-afe.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/drivers/media/i2c/adv748x/adv748x-afe.c b/drivers/media/i2c/adv748x/adv748x-afe.c index 5188178588c9..61514bae7e5c 100644 --- a/drivers/media/i2c/adv748x/adv748x-afe.c +++ b/drivers/media/i2c/adv748x/adv748x-afe.c @@ -275,7 +275,8 @@ static int adv748x_afe_s_stream(struct v4l2_subdev *sd, int enable) { struct adv748x_afe *afe = adv748x_sd_to_afe(sd); struct adv748x_state *state = adv748x_afe_to_state(afe); - int ret, signal = V4L2_IN_ST_NO_SIGNAL; + u32 signal = V4L2_IN_ST_NO_SIGNAL; + int ret; mutex_lock(&state->mutex); From 85ea29f19eab56ec16ec6b92bc67305998706afa Mon Sep 17 00:00:00 2001 From: Mauro Carvalho Chehab Date: Wed, 28 Mar 2018 13:59:22 -0400 Subject: [PATCH 47/48] media: v4l2-compat-ioctl32: don't oops on overlay At put_v4l2_window32(), it tries to access kp->clips. However, kp points to an userspace pointer. So, it should be obtained via get_user(), otherwise it can OOPS: vivid-000: ================== END STATUS ================== BUG: unable to handle kernel paging request at 00000000fffb18e0 IP: [] __put_v4l2_format32+0x169/0x220 [videodev] PGD 3f5776067 PUD 3f576f067 PMD 3f5769067 PTE 800000042548f067 Oops: 0001 [#1] SMP Modules linked in: vivid videobuf2_vmalloc videobuf2_memops v4l2_dv_timings videobuf2_core v4l2_common videodev media xt_CHECKSUM iptable_mangle ipt_MASQUERADE nf_nat_masquerade_ipv4 iptable_nat nf_nat_ipv4 nf_nat nf_conntrack_ipv4 nf_defrag_ipv4 xt_conntrack nf_conntrack tun bridge stp llc ebtable_filter ebtables ip6table_filter ip6_tables bluetooth rfkill binfmt_misc snd_hda_codec_hdmi i915 snd_hda_intel snd_hda_controller snd_hda_codec intel_rapl x86_pkg_temp_thermal snd_hwdep intel_powerclamp snd_pcm coretemp snd_seq_midi kvm_intel kvm snd_seq_midi_event snd_rawmidi i2c_algo_bit drm_kms_helper snd_seq drm crct10dif_pclmul e1000e snd_seq_device crc32_pclmul snd_timer ghash_clmulni_intel snd mei_me mei ptp pps_core soundcore lpc_ich video crc32c_intel [last unloaded: media] CPU: 2 PID: 28332 Comm: v4l2-compliance Not tainted 3.18.102+ #107 Hardware name: /NUC5i7RYB, BIOS RYBDWi35.86A.0364.2017.0511.0949 05/11/2017 task: ffff8804293f8000 ti: ffff8803f5640000 task.ti: ffff8803f5640000 RIP: 0010:[] [] __put_v4l2_format32+0x169/0x220 [videodev] RSP: 0018:ffff8803f5643e28 EFLAGS: 00010246 RAX: 0000000000000000 RBX: 0000000000000000 RCX: 00000000fffb1ab4 RDX: 00000000fffb1a68 RSI: 00000000fffb18d8 RDI: 00000000fffb1aa8 RBP: ffff8803f5643e48 R08: 0000000000000001 R09: ffff8803f54b0378 R10: 0000000000000000 R11: 0000000000000168 R12: 00000000fffb18c0 R13: 00000000fffb1a94 R14: 00000000fffb18c8 R15: 0000000000000000 FS: 0000000000000000(0000) GS:ffff880456d00000(0063) knlGS:00000000f7100980 CS: 0010 DS: 002b ES: 002b CR0: 0000000080050033 CR2: 00000000fffb18e0 CR3: 00000003f552b000 CR4: 00000000003407e0 Stack: 00000000fffb1a94 00000000c0cc5640 0000000000000056 ffff8804274f3600 ffff8803f5643ed0 ffffffffc0547e16 0000000000000003 ffff8803f5643eb0 ffffffff81301460 ffff88009db44b01 ffff880441942520 ffff8800c0d05640 Call Trace: [] v4l2_compat_ioctl32+0x12d6/0x1b1d [videodev] [] ? file_has_perm+0x70/0xc0 [] compat_SyS_ioctl+0xec/0x1200 [] sysenter_dispatch+0x7/0x21 Code: 00 00 48 8b 80 48 c0 ff ff 48 83 e8 38 49 39 c6 0f 87 2b ff ff ff 49 8d 45 1c e8 a3 ce e3 c0 85 c0 0f 85 1a ff ff ff 41 8d 40 ff <4d> 8b 64 24 20 41 89 d5 48 8d 44 40 03 4d 8d 34 c4 eb 15 0f 1f RIP [] __put_v4l2_format32+0x169/0x220 [videodev] RSP CR2: 00000000fffb18e0 Tested with vivid driver on Kernel v3.18.102. Same bug happens upstream too: BUG: KASAN: user-memory-access in __put_v4l2_format32+0x98/0x4d0 [videodev] Read of size 8 at addr 00000000ffe48400 by task v4l2-compliance/8713 CPU: 0 PID: 8713 Comm: v4l2-compliance Not tainted 4.16.0-rc4+ #108 Hardware name: /NUC5i7RYB, BIOS RYBDWi35.86A.0364.2017.0511.0949 05/11/2017 Call Trace: dump_stack+0x5c/0x7c kasan_report+0x164/0x380 ? __put_v4l2_format32+0x98/0x4d0 [videodev] __put_v4l2_format32+0x98/0x4d0 [videodev] v4l2_compat_ioctl32+0x1aec/0x27a0 [videodev] ? __fsnotify_inode_delete+0x20/0x20 ? __put_v4l2_format32+0x4d0/0x4d0 [videodev] compat_SyS_ioctl+0x646/0x14d0 ? do_ioctl+0x30/0x30 do_fast_syscall_32+0x191/0x3f4 entry_SYSENTER_compat+0x6b/0x7a ================================================================== Disabling lock debugging due to kernel taint BUG: unable to handle kernel paging request at 00000000ffe48400 IP: __put_v4l2_format32+0x98/0x4d0 [videodev] PGD 3a22fb067 P4D 3a22fb067 PUD 39b6f0067 PMD 39b6f1067 PTE 80000003256af067 Oops: 0001 [#1] SMP KASAN Modules linked in: vivid videobuf2_vmalloc videobuf2_dma_contig videobuf2_memops v4l2_tpg v4l2_dv_timings videobuf2_v4l2 videobuf2_common v4l2_common videodev xt_CHECKSUM iptable_mangle ipt_MASQUERADE nf_nat_masquerade_ipv4 iptable_nat nf_nat_ipv4 nf_nat nf_conntrack_ipv4 nf_defrag_ipv4 xt_conntrack nf_conntrack libcrc32c tun bridge stp llc ebtable_filter ebtables ip6table_filter ip6_tables bluetooth rfkill ecdh_generic binfmt_misc snd_hda_codec_hdmi intel_rapl x86_pkg_temp_thermal intel_powerclamp i915 coretemp snd_hda_intel snd_hda_codec kvm_intel snd_hwdep snd_hda_core kvm snd_pcm irqbypass crct10dif_pclmul crc32_pclmul snd_seq_midi ghash_clmulni_intel snd_seq_midi_event i2c_algo_bit intel_cstate snd_rawmidi intel_uncore snd_seq drm_kms_helper e1000e snd_seq_device snd_timer intel_rapl_perf drm ptp snd mei_me mei lpc_ich pps_core soundcore video crc32c_intel CPU: 0 PID: 8713 Comm: v4l2-compliance Tainted: G B 4.16.0-rc4+ #108 Hardware name: /NUC5i7RYB, BIOS RYBDWi35.86A.0364.2017.0511.0949 05/11/2017 RIP: 0010:__put_v4l2_format32+0x98/0x4d0 [videodev] RSP: 0018:ffff8803b9be7d30 EFLAGS: 00010282 RAX: 0000000000000000 RBX: ffff8803ac983e80 RCX: ffffffff8cd929f2 RDX: 1ffffffff1d0a149 RSI: 0000000000000297 RDI: 0000000000000297 RBP: 00000000ffe485c0 R08: fffffbfff1cf5123 R09: ffffffff8e7a8948 R10: 0000000000000001 R11: fffffbfff1cf5122 R12: 00000000ffe483e0 R13: 00000000ffe485c4 R14: ffff8803ac985918 R15: 00000000ffe483e8 FS: 0000000000000000(0000) GS:ffff880407400000(0063) knlGS:00000000f7a46980 CS: 0010 DS: 002b ES: 002b CR0: 0000000080050033 CR2: 00000000ffe48400 CR3: 00000003a83f2003 CR4: 00000000003606f0 Call Trace: v4l2_compat_ioctl32+0x1aec/0x27a0 [videodev] ? __fsnotify_inode_delete+0x20/0x20 ? __put_v4l2_format32+0x4d0/0x4d0 [videodev] compat_SyS_ioctl+0x646/0x14d0 ? do_ioctl+0x30/0x30 do_fast_syscall_32+0x191/0x3f4 entry_SYSENTER_compat+0x6b/0x7a Code: 4c 89 f7 4d 8d 7c 24 08 e8 e6 a4 69 cb 48 8b 83 98 1a 00 00 48 83 e8 10 49 39 c7 0f 87 9d 01 00 00 49 8d 7c 24 20 e8 c8 a4 69 cb <4d> 8b 74 24 20 4c 89 ef 4c 89 fe ba 10 00 00 00 e8 23 d9 08 cc RIP: __put_v4l2_format32+0x98/0x4d0 [videodev] RSP: ffff8803b9be7d30 CR2: 00000000ffe48400 cc: stable@vger.kernel.org Signed-off-by: Mauro Carvalho Chehab Reviewed-by: Sakari Ailus Reviewed-by: Hans Verkuil Signed-off-by: Mauro Carvalho Chehab --- drivers/media/v4l2-core/v4l2-compat-ioctl32.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/drivers/media/v4l2-core/v4l2-compat-ioctl32.c b/drivers/media/v4l2-core/v4l2-compat-ioctl32.c index 5198c9eeb348..4312935f1dfc 100644 --- a/drivers/media/v4l2-core/v4l2-compat-ioctl32.c +++ b/drivers/media/v4l2-core/v4l2-compat-ioctl32.c @@ -101,7 +101,7 @@ static int get_v4l2_window32(struct v4l2_window __user *kp, static int put_v4l2_window32(struct v4l2_window __user *kp, struct v4l2_window32 __user *up) { - struct v4l2_clip __user *kclips = kp->clips; + struct v4l2_clip __user *kclips; struct v4l2_clip32 __user *uclips; compat_caddr_t p; u32 clipcount; @@ -116,6 +116,8 @@ static int put_v4l2_window32(struct v4l2_window __user *kp, if (!clipcount) return 0; + if (get_user(kclips, &kp->clips)) + return -EFAULT; if (get_user(p, &up->clips)) return -EFAULT; uclips = compat_ptr(p); From a95845ba184b854106972f5d8f50354c2d272c06 Mon Sep 17 00:00:00 2001 From: Mauro Carvalho Chehab Date: Thu, 5 Apr 2018 06:51:15 -0300 Subject: [PATCH 48/48] media: v4l2-core: fix size of devnode_nums[] bitarray MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit The size of devnode_nums[] bit array is too short to store information for VFL_TYPE_TOUCH. That causes it to override other memory regions. Thankfully, on recent reports, it is overriding video_device[] array, trigging a WARN_ON(). Yet, it just warns about the problem, but let the code excecuting, with generates an OOPS: [ 43.177394] WARNING: CPU: 1 PID: 711 at drivers/media/v4l2-core/v4l2-dev.c:945 __video_register_device+0xc99/0x1090 [videodev] [ 43.177396] Modules linked in: hid_sensor_custom hid_sensor_als hid_sensor_incl_3d hid_sensor_rotation hid_sensor_magn_3d hid_sensor_accel_3d hid_sensor_gyro_3d hid_sensor_trigger industrialio_triggered_buffer kfifo_buf joydev hid_sensor_iio_common hid_rmi(+) rmi_core industrialio videobuf2_vmalloc videobuf2_memops videobuf2_v4l2 videobuf2_common videodev hid_multitouch media hid_sensor_hub binfmt_misc nls_iso8859_1 snd_hda_codec_hdmi arc4 snd_soc_skl snd_soc_skl_ipc snd_hda_ext_core snd_soc_sst_dsp snd_soc_sst_ipc snd_hda_codec_realtek snd_soc_acpi snd_hda_codec_generic snd_soc_core snd_compress ac97_bus snd_pcm_dmaengine snd_hda_intel snd_hda_codec intel_rapl snd_hda_core x86_pkg_temp_thermal snd_hwdep intel_powerclamp coretemp snd_pcm kvm_intel snd_seq_midi snd_seq_midi_event snd_rawmidi crct10dif_pclmul [ 43.177426] crc32_pclmul ghash_clmulni_intel iwlmvm pcbc mac80211 snd_seq aesni_intel iwlwifi aes_x86_64 snd_seq_device crypto_simd glue_helper cryptd snd_timer intel_cstate intel_rapl_perf input_leds serio_raw intel_wmi_thunderbolt snd wmi_bmof cfg80211 soundcore ideapad_laptop sparse_keymap idma64 virt_dma tpm_crb acpi_pad int3400_thermal acpi_thermal_rel intel_pch_thermal processor_thermal_device mac_hid int340x_thermal_zone mei_me intel_soc_dts_iosf mei intel_lpss_pci shpchp intel_lpss sch_fq_codel vfio_pci nfsd vfio_virqfd parport_pc ppdev auth_rpcgss nfs_acl lockd grace lp parport sunrpc ip_tables x_tables autofs4 hid_logitech_hidpp hid_logitech_dj hid_generic usbhid kvmgt vfio_mdev mdev vfio_iommu_type1 vfio kvm irqbypass i915 i2c_algo_bit drm_kms_helper syscopyarea sdhci_pci sysfillrect [ 43.177466] sysimgblt cqhci fb_sys_fops sdhci drm i2c_hid wmi hid video pinctrl_sunrisepoint pinctrl_intel [ 43.177474] CPU: 1 PID: 711 Comm: systemd-udevd Not tainted 4.16.0 #1 [ 43.177475] Hardware name: LENOVO 80UE/VIUU4, BIOS 2UCN10T 10/14/2016 [ 43.177481] RIP: 0010:__video_register_device+0xc99/0x1090 [videodev] [ 43.177482] RSP: 0000:ffffa5c5c231b420 EFLAGS: 00010202 [ 43.177484] RAX: 0000000000000000 RBX: 0000000000000005 RCX: 0000000000000000 [ 43.177485] RDX: ffffffffc0c44cc0 RSI: ffffffffffffffff RDI: ffffffffc0c44cc0 [ 43.177486] RBP: ffffa5c5c231b478 R08: ffffffffc0c96900 R09: ffff8eda1a51f018 [ 43.177487] R10: 0000000000000600 R11: 00000000000003b6 R12: 0000000000000000 [ 43.177488] R13: 0000000000000005 R14: ffffffffc0c96900 R15: ffff8eda1d6d91c0 [ 43.177489] FS: 00007fd2d8ef2480(0000) GS:ffff8eda33480000(0000) knlGS:0000000000000000 [ 43.177490] CS: 0010 DS: 0000 ES: 0000 CR0: 0000000080050033 [ 43.177491] CR2: 00007ffe0a6ad01c CR3: 0000000456ae2004 CR4: 00000000003606e0 [ 43.177492] Call Trace: [ 43.177498] ? devres_add+0x5f/0x70 [ 43.177502] rmi_f54_probe+0x437/0x470 [rmi_core] [ 43.177505] rmi_function_probe+0x25/0x30 [rmi_core] [ 43.177507] driver_probe_device+0x310/0x480 [ 43.177509] __device_attach_driver+0x86/0x100 [ 43.177511] ? __driver_attach+0xf0/0xf0 [ 43.177512] bus_for_each_drv+0x6b/0xb0 [ 43.177514] __device_attach+0xdd/0x160 [ 43.177516] device_initial_probe+0x13/0x20 [ 43.177518] bus_probe_device+0x95/0xa0 [ 43.177519] device_add+0x44b/0x680 [ 43.177522] rmi_register_function+0x62/0xd0 [rmi_core] [ 43.177525] rmi_create_function+0x112/0x1a0 [rmi_core] [ 43.177527] ? rmi_driver_clear_irq_bits+0xc0/0xc0 [rmi_core] [ 43.177530] rmi_scan_pdt+0xca/0x1a0 [rmi_core] [ 43.177535] rmi_init_functions+0x5b/0x120 [rmi_core] [ 43.177537] rmi_driver_probe+0x152/0x3c0 [rmi_core] [ 43.177547] ? sysfs_create_link+0x25/0x40 [ 43.177549] driver_probe_device+0x310/0x480 [ 43.177551] __device_attach_driver+0x86/0x100 [ 43.177553] ? __driver_attach+0xf0/0xf0 [ 43.177554] bus_for_each_drv+0x6b/0xb0 [ 43.177556] __device_attach+0xdd/0x160 [ 43.177558] device_initial_probe+0x13/0x20 [ 43.177560] bus_probe_device+0x95/0xa0 [ 43.177561] device_add+0x44b/0x680 [ 43.177564] rmi_register_transport_device+0x84/0x100 [rmi_core] [ 43.177568] rmi_input_configured+0xbf/0x1a0 [hid_rmi] [ 43.177571] ? input_allocate_device+0xdf/0xf0 [ 43.177574] hidinput_connect+0x4a9/0x37a0 [hid] [ 43.177578] hid_connect+0x326/0x3d0 [hid] [ 43.177581] hid_hw_start+0x42/0x70 [hid] [ 43.177583] rmi_probe+0x115/0x510 [hid_rmi] [ 43.177586] hid_device_probe+0xd3/0x150 [hid] [ 43.177588] ? sysfs_create_link+0x25/0x40 [ 43.177590] driver_probe_device+0x310/0x480 [ 43.177592] __driver_attach+0xbf/0xf0 [ 43.177593] ? driver_probe_device+0x480/0x480 [ 43.177595] bus_for_each_dev+0x74/0xb0 [ 43.177597] ? kmem_cache_alloc_trace+0x1a6/0x1c0 [ 43.177599] driver_attach+0x1e/0x20 [ 43.177600] bus_add_driver+0x167/0x260 [ 43.177602] ? 0xffffffffc0cbc000 [ 43.177604] driver_register+0x60/0xe0 [ 43.177605] ? 0xffffffffc0cbc000 [ 43.177607] __hid_register_driver+0x63/0x70 [hid] [ 43.177610] rmi_driver_init+0x23/0x1000 [hid_rmi] [ 43.177612] do_one_initcall+0x52/0x191 [ 43.177615] ? _cond_resched+0x19/0x40 [ 43.177617] ? kmem_cache_alloc_trace+0xa2/0x1c0 [ 43.177619] ? do_init_module+0x27/0x209 [ 43.177621] do_init_module+0x5f/0x209 [ 43.177623] load_module+0x1987/0x1f10 [ 43.177626] ? ima_post_read_file+0x96/0xa0 [ 43.177629] SYSC_finit_module+0xfc/0x120 [ 43.177630] ? SYSC_finit_module+0xfc/0x120 [ 43.177632] SyS_finit_module+0xe/0x10 [ 43.177634] do_syscall_64+0x73/0x130 [ 43.177637] entry_SYSCALL_64_after_hwframe+0x3d/0xa2 [ 43.177638] RIP: 0033:0x7fd2d880b839 [ 43.177639] RSP: 002b:00007ffe0a6b2368 EFLAGS: 00000246 ORIG_RAX: 0000000000000139 [ 43.177641] RAX: ffffffffffffffda RBX: 000055cdd86542e0 RCX: 00007fd2d880b839 [ 43.177641] RDX: 0000000000000000 RSI: 00007fd2d84ea0e5 RDI: 0000000000000016 [ 43.177642] RBP: 00007fd2d84ea0e5 R08: 0000000000000000 R09: 00007ffe0a6b2480 [ 43.177643] R10: 0000000000000016 R11: 0000000000000246 R12: 0000000000000000 [ 43.177644] R13: 000055cdd8688930 R14: 0000000000020000 R15: 000055cdd86542e0 [ 43.177645] Code: 48 c7 c7 54 b4 c3 c0 e8 96 9d ec dd e9 d4 fb ff ff 0f 0b 41 be ea ff ff ff e9 c7 fb ff ff 0f 0b 41 be ea ff ff ff e9 ba fb ff ff <0f> 0b e9 d8 f4 ff ff 83 fa 01 0f 84 c4 02 00 00 48 83 78 68 00 [ 43.177675] ---[ end trace d44d9bc41477c2dd ]--- [ 43.177679] BUG: unable to handle kernel NULL pointer dereference at 0000000000000499 [ 43.177723] IP: __video_register_device+0x1cc/0x1090 [videodev] [ 43.177749] PGD 0 P4D 0 [ 43.177764] Oops: 0000 [#1] SMP PTI [ 43.177780] Modules linked in: hid_sensor_custom hid_sensor_als hid_sensor_incl_3d hid_sensor_rotation hid_sensor_magn_3d hid_sensor_accel_3d hid_sensor_gyro_3d hid_sensor_trigger industrialio_triggered_buffer kfifo_buf joydev hid_sensor_iio_common hid_rmi(+) rmi_core industrialio videobuf2_vmalloc videobuf2_memops videobuf2_v4l2 videobuf2_common videodev hid_multitouch media hid_sensor_hub binfmt_misc nls_iso8859_1 snd_hda_codec_hdmi arc4 snd_soc_skl snd_soc_skl_ipc snd_hda_ext_core snd_soc_sst_dsp snd_soc_sst_ipc snd_hda_codec_realtek snd_soc_acpi snd_hda_codec_generic snd_soc_core snd_compress ac97_bus snd_pcm_dmaengine snd_hda_intel snd_hda_codec intel_rapl snd_hda_core x86_pkg_temp_thermal snd_hwdep intel_powerclamp coretemp snd_pcm kvm_intel snd_seq_midi snd_seq_midi_event snd_rawmidi crct10dif_pclmul [ 43.178055] crc32_pclmul ghash_clmulni_intel iwlmvm pcbc mac80211 snd_seq aesni_intel iwlwifi aes_x86_64 snd_seq_device crypto_simd glue_helper cryptd snd_timer intel_cstate intel_rapl_perf input_leds serio_raw intel_wmi_thunderbolt snd wmi_bmof cfg80211 soundcore ideapad_laptop sparse_keymap idma64 virt_dma tpm_crb acpi_pad int3400_thermal acpi_thermal_rel intel_pch_thermal processor_thermal_device mac_hid int340x_thermal_zone mei_me intel_soc_dts_iosf mei intel_lpss_pci shpchp intel_lpss sch_fq_codel vfio_pci nfsd vfio_virqfd parport_pc ppdev auth_rpcgss nfs_acl lockd grace lp parport sunrpc ip_tables x_tables autofs4 hid_logitech_hidpp hid_logitech_dj hid_generic usbhid kvmgt vfio_mdev mdev vfio_iommu_type1 vfio kvm irqbypass i915 i2c_algo_bit drm_kms_helper syscopyarea sdhci_pci sysfillrect [ 43.178337] sysimgblt cqhci fb_sys_fops sdhci drm i2c_hid wmi hid video pinctrl_sunrisepoint pinctrl_intel [ 43.178380] CPU: 1 PID: 711 Comm: systemd-udevd Tainted: G W 4.16.0 #1 [ 43.178411] Hardware name: LENOVO 80UE/VIUU4, BIOS 2UCN10T 10/14/2016 [ 43.178441] RIP: 0010:__video_register_device+0x1cc/0x1090 [videodev] [ 43.178467] RSP: 0000:ffffa5c5c231b420 EFLAGS: 00010202 [ 43.178490] RAX: ffffffffc0c44cc0 RBX: 0000000000000005 RCX: ffffffffc0c454c0 [ 43.178519] RDX: 0000000000000001 RSI: ffff8eda1d6d9118 RDI: ffffffffc0c44cc0 [ 43.178549] RBP: ffffa5c5c231b478 R08: ffffffffc0c96900 R09: ffff8eda1a51f018 [ 43.178579] R10: 0000000000000600 R11: 00000000000003b6 R12: 0000000000000000 [ 43.178608] R13: 0000000000000005 R14: ffffffffc0c96900 R15: ffff8eda1d6d91c0 [ 43.178636] FS: 00007fd2d8ef2480(0000) GS:ffff8eda33480000(0000) knlGS:0000000000000000 [ 43.178669] CS: 0010 DS: 0000 ES: 0000 CR0: 0000000080050033 [ 43.178693] CR2: 0000000000000499 CR3: 0000000456ae2004 CR4: 00000000003606e0 [ 43.178721] Call Trace: [ 43.178736] ? devres_add+0x5f/0x70 [ 43.178755] rmi_f54_probe+0x437/0x470 [rmi_core] [ 43.178779] rmi_function_probe+0x25/0x30 [rmi_core] [ 43.178805] driver_probe_device+0x310/0x480 [ 43.178828] __device_attach_driver+0x86/0x100 [ 43.178851] ? __driver_attach+0xf0/0xf0 [ 43.178884] bus_for_each_drv+0x6b/0xb0 [ 43.178904] __device_attach+0xdd/0x160 [ 43.178925] device_initial_probe+0x13/0x20 [ 43.178948] bus_probe_device+0x95/0xa0 [ 43.178968] device_add+0x44b/0x680 [ 43.178987] rmi_register_function+0x62/0xd0 [rmi_core] [ 43.181747] rmi_create_function+0x112/0x1a0 [rmi_core] [ 43.184677] ? rmi_driver_clear_irq_bits+0xc0/0xc0 [rmi_core] [ 43.187505] rmi_scan_pdt+0xca/0x1a0 [rmi_core] [ 43.190171] rmi_init_functions+0x5b/0x120 [rmi_core] [ 43.192809] rmi_driver_probe+0x152/0x3c0 [rmi_core] [ 43.195403] ? sysfs_create_link+0x25/0x40 [ 43.198253] driver_probe_device+0x310/0x480 [ 43.201083] __device_attach_driver+0x86/0x100 [ 43.203800] ? __driver_attach+0xf0/0xf0 [ 43.206503] bus_for_each_drv+0x6b/0xb0 [ 43.209291] __device_attach+0xdd/0x160 [ 43.212207] device_initial_probe+0x13/0x20 [ 43.215146] bus_probe_device+0x95/0xa0 [ 43.217885] device_add+0x44b/0x680 [ 43.220597] rmi_register_transport_device+0x84/0x100 [rmi_core] [ 43.223321] rmi_input_configured+0xbf/0x1a0 [hid_rmi] [ 43.226051] ? input_allocate_device+0xdf/0xf0 [ 43.228814] hidinput_connect+0x4a9/0x37a0 [hid] [ 43.231701] hid_connect+0x326/0x3d0 [hid] [ 43.234548] hid_hw_start+0x42/0x70 [hid] [ 43.237302] rmi_probe+0x115/0x510 [hid_rmi] [ 43.239862] hid_device_probe+0xd3/0x150 [hid] [ 43.242558] ? sysfs_create_link+0x25/0x40 [ 43.242828] audit: type=1400 audit(1522795151.600:4): apparmor="STATUS" operation="profile_load" profile="unconfined" name="/snap/core/4206/usr/lib/snapd/snap-confine" pid=1151 comm="apparmor_parser" [ 43.244859] driver_probe_device+0x310/0x480 [ 43.244862] __driver_attach+0xbf/0xf0 [ 43.246982] audit: type=1400 audit(1522795151.600:5): apparmor="STATUS" operation="profile_load" profile="unconfined" name="/snap/core/4206/usr/lib/snapd/snap-confine//mount-namespace-capture-helper" pid=1151 comm="apparmor_parser" [ 43.249403] ? driver_probe_device+0x480/0x480 [ 43.249405] bus_for_each_dev+0x74/0xb0 [ 43.253200] audit: type=1400 audit(1522795151.600:6): apparmor="STATUS" operation="profile_load" profile="unconfined" name="/snap/core/4206/usr/lib/snapd/snap-confine//snap_update_ns" pid=1151 comm="apparmor_parser" [ 43.254055] ? kmem_cache_alloc_trace+0x1a6/0x1c0 [ 43.256282] audit: type=1400 audit(1522795151.604:7): apparmor="STATUS" operation="profile_load" profile="unconfined" name="/sbin/dhclient" pid=1152 comm="apparmor_parser" [ 43.258436] driver_attach+0x1e/0x20 [ 43.260875] audit: type=1400 audit(1522795151.604:8): apparmor="STATUS" operation="profile_load" profile="unconfined" name="/usr/lib/NetworkManager/nm-dhcp-client.action" pid=1152 comm="apparmor_parser" [ 43.263118] bus_add_driver+0x167/0x260 [ 43.267676] audit: type=1400 audit(1522795151.604:9): apparmor="STATUS" operation="profile_load" profile="unconfined" name="/usr/lib/NetworkManager/nm-dhcp-helper" pid=1152 comm="apparmor_parser" [ 43.268807] ? 0xffffffffc0cbc000 [ 43.268812] driver_register+0x60/0xe0 [ 43.271184] audit: type=1400 audit(1522795151.604:10): apparmor="STATUS" operation="profile_load" profile="unconfined" name="/usr/lib/connman/scripts/dhclient-script" pid=1152 comm="apparmor_parser" [ 43.274081] ? 0xffffffffc0cbc000 [ 43.274086] __hid_register_driver+0x63/0x70 [hid] [ 43.288367] rmi_driver_init+0x23/0x1000 [hid_rmi] [ 43.291501] do_one_initcall+0x52/0x191 [ 43.292348] audit: type=1400 audit(1522795151.652:11): apparmor="STATUS" operation="profile_load" profile="unconfined" name="/usr/bin/man" pid=1242 comm="apparmor_parser" [ 43.294212] ? _cond_resched+0x19/0x40 [ 43.300028] ? kmem_cache_alloc_trace+0xa2/0x1c0 [ 43.303475] ? do_init_module+0x27/0x209 [ 43.306842] do_init_module+0x5f/0x209 [ 43.310269] load_module+0x1987/0x1f10 [ 43.313704] ? ima_post_read_file+0x96/0xa0 [ 43.317174] SYSC_finit_module+0xfc/0x120 [ 43.320754] ? SYSC_finit_module+0xfc/0x120 [ 43.324065] SyS_finit_module+0xe/0x10 [ 43.327387] do_syscall_64+0x73/0x130 [ 43.330909] entry_SYSCALL_64_after_hwframe+0x3d/0xa2 [ 43.334305] RIP: 0033:0x7fd2d880b839 [ 43.337810] RSP: 002b:00007ffe0a6b2368 EFLAGS: 00000246 ORIG_RAX: 0000000000000139 [ 43.341259] RAX: ffffffffffffffda RBX: 000055cdd86542e0 RCX: 00007fd2d880b839 [ 43.344613] RDX: 0000000000000000 RSI: 00007fd2d84ea0e5 RDI: 0000000000000016 [ 43.347962] RBP: 00007fd2d84ea0e5 R08: 0000000000000000 R09: 00007ffe0a6b2480 [ 43.351456] R10: 0000000000000016 R11: 0000000000000246 R12: 0000000000000000 [ 43.354845] R13: 000055cdd8688930 R14: 0000000000020000 R15: 000055cdd86542e0 [ 43.358224] Code: c7 05 ad 12 02 00 00 00 00 00 48 8d 88 00 08 00 00 eb 09 48 83 c0 08 48 39 c1 74 31 48 8b 10 48 85 d2 74 ef 49 8b b7 98 04 00 00 <48> 39 b2 98 04 00 00 75 df 48 63 92 f8 04 00 00 f0 48 0f ab 15 [ 43.361764] RIP: __video_register_device+0x1cc/0x1090 [videodev] RSP: ffffa5c5c231b420 [ 43.365281] CR2: 0000000000000499 This patch fixes the array size and changes the WARN_ON() to return an error, instead of letting the Kernel to proceed with registering. Cc: stable@vger.kernel.org # For Kernel 4.16 Fixes: 4839c58f034a ("media: v4l2-dev: convert VFL_TYPE_* into an enum") Reported-by: Peter Geis Reported-by: Jaak Ristioja Reported-by: Michał Siemek Reviewed-by: Hans Verkuil Reviewed-by: Sakari Ailus Signed-off-by: Mauro Carvalho Chehab --- drivers/media/v4l2-core/v4l2-dev.c | 8 ++++++-- include/media/v4l2-dev.h | 12 ++++++------ 2 files changed, 12 insertions(+), 8 deletions(-) diff --git a/drivers/media/v4l2-core/v4l2-dev.c b/drivers/media/v4l2-core/v4l2-dev.c index 0301fe426a43..1d0b2208e8fb 100644 --- a/drivers/media/v4l2-core/v4l2-dev.c +++ b/drivers/media/v4l2-core/v4l2-dev.c @@ -939,10 +939,14 @@ int __video_register_device(struct video_device *vdev, #endif vdev->minor = i + minor_offset; vdev->num = nr; - devnode_set(vdev); /* Should not happen since we thought this minor was free */ - WARN_ON(video_device[vdev->minor] != NULL); + if (WARN_ON(video_device[vdev->minor])) { + mutex_unlock(&videodev_lock); + printk(KERN_ERR "video_device not empty!\n"); + return -ENFILE; + } + devnode_set(vdev); vdev->index = get_index(vdev); video_device[vdev->minor] = vdev; mutex_unlock(&videodev_lock); diff --git a/include/media/v4l2-dev.h b/include/media/v4l2-dev.h index 27634e8d2585..f60cf9cf3b9c 100644 --- a/include/media/v4l2-dev.h +++ b/include/media/v4l2-dev.h @@ -33,13 +33,13 @@ */ enum vfl_devnode_type { VFL_TYPE_GRABBER = 0, - VFL_TYPE_VBI = 1, - VFL_TYPE_RADIO = 2, - VFL_TYPE_SUBDEV = 3, - VFL_TYPE_SDR = 4, - VFL_TYPE_TOUCH = 5, + VFL_TYPE_VBI, + VFL_TYPE_RADIO, + VFL_TYPE_SUBDEV, + VFL_TYPE_SDR, + VFL_TYPE_TOUCH, + VFL_TYPE_MAX /* Shall be the last one */ }; -#define VFL_TYPE_MAX VFL_TYPE_TOUCH /** * enum vfl_direction - Identifies if a &struct video_device corresponds