platform/kernel/linux-rpi.git
18 months agomedia: mtk-jpeg: Remove some unnecessary variables
kyrie wu [Fri, 10 Mar 2023 06:23:53 +0000 (06:23 +0000)]
media: mtk-jpeg: Remove some unnecessary variables

remove is_jpgenc_multihw, is_jpgdec_multihw,
and unnecessary initialization.

Signed-off-by: kyrie wu <kyrie.wu@mediatek.com>
Signed-off-by: irui wang <irui.wang@mediatek.com>
Signed-off-by: Hans Verkuil <hverkuil-cisco@xs4all.nl>
Signed-off-by: Mauro Carvalho Chehab <mchehab@kernel.org>
18 months agomedia: mtk-jpeg: reconstructs the initialization mode of worker
kyrie wu [Fri, 10 Mar 2023 06:23:52 +0000 (06:23 +0000)]
media: mtk-jpeg: reconstructs the initialization mode of worker

exclude is_jpgenc_multihw or is_jpgdec_multihw for judgment,
and re-initialize jpeg worker.

Signed-off-by: kyrie wu <kyrie.wu@mediatek.com>
Signed-off-by: irui wang <irui.wang@mediatek.com>
Signed-off-by: Hans Verkuil <hverkuil-cisco@xs4all.nl>
Signed-off-by: Mauro Carvalho Chehab <mchehab@kernel.org>
18 months agomedia: mtk-jpeg: Fixes jpeg enc&dec worker sw flow
kyrie wu [Fri, 10 Mar 2023 06:23:51 +0000 (06:23 +0000)]
media: mtk-jpeg: Fixes jpeg enc&dec worker sw flow

1. Move removing buffer after sw setting and before hw setting
in enc&dec worker to prevents the operation of removing
the buffer twice if the sw setting fails.
2. Remove the redundant operation of queue work in the
jpegenc irq handler because the jpegenc worker has called
v4l2_m2m_job_finish to do it.

Fixes: 5fb1c2361e56 ("mtk-jpegenc: add jpeg encode worker interface")
Fixes: dedc21500334 ("media: mtk-jpegdec: add jpeg decode worker interface")
Signed-off-by: kyrie wu <kyrie.wu@mediatek.com>
Signed-off-by: irui wang <irui.wang@mediatek.com>
Signed-off-by: Hans Verkuil <hverkuil-cisco@xs4all.nl>
Signed-off-by: Mauro Carvalho Chehab <mchehab@kernel.org>
18 months agomedia: mtk-jpeg: add jpeg single core initial function
kyrie wu [Fri, 10 Mar 2023 06:23:50 +0000 (06:23 +0000)]
media: mtk-jpeg: add jpeg single core initial function

add single core initial function to init reg_base,
irq and clk.

Signed-off-by: kyrie wu <kyrie.wu@mediatek.com>
Signed-off-by: irui wang <irui.wang@mediatek.com>
Signed-off-by: Hans Verkuil <hverkuil-cisco@xs4all.nl>
Signed-off-by: Mauro Carvalho Chehab <mchehab@kernel.org>
18 months agomedia: mtk-jpeg: Fixes jpeghw multi-core judgement
kyrie wu [Fri, 10 Mar 2023 06:23:49 +0000 (06:23 +0000)]
media: mtk-jpeg: Fixes jpeghw multi-core judgement

some chips have multi-hw, but others have only one,
modify the condition of multi-hw judgement

Fixes: 934e8bccac95 ("mtk-jpegenc: support jpegenc multi-hardware")
Signed-off-by: kyrie wu <kyrie.wu@mediatek.com>
Signed-off-by: irui wang <irui.wang@mediatek.com>
Reviewed-by: AngeloGioacchino Del Regno <angelogioacchino.delregno@collabora.com>
Signed-off-by: Hans Verkuil <hverkuil-cisco@xs4all.nl>
Signed-off-by: Mauro Carvalho Chehab <mchehab@kernel.org>
19 months agomedia: ov2685: Select VIDEO_V4L2_SUBDEV_API
Sakari Ailus [Thu, 16 Mar 2023 10:21:49 +0000 (11:21 +0100)]
media: ov2685: Select VIDEO_V4L2_SUBDEV_API

VIDEO_V4L2_SUBDEV_API is required for v4l2_subdev_get_pad_*() functions.
Select it.

Fixes: ("media: i2c: ov2685: Add .get_selection() support")
Signed-off-by: Sakari Ailus <sakari.ailus@linux.intel.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab@kernel.org>
19 months agomedia: dt-bindings: media: convert meson-ir.txt to dt-schema
Neil Armstrong [Wed, 8 Mar 2023 13:27:31 +0000 (14:27 +0100)]
media: dt-bindings: media: convert meson-ir.txt to dt-schema

Convert the Amlogic Meson IR remote control receiver bindings to
dt-schema.

Take in account the used variant with amlogic,meson-gx-ir.

Reviewed-by: Martin Blumenstingl <martin.blumenstingl@googlemail.com>
Reviewed-by: Krzysztof Kozlowski <krzysztof.kozlowski@linaro.org>
Signed-off-by: Neil Armstrong <neil.armstrong@linaro.org>
Signed-off-by: Sakari Ailus <sakari.ailus@linux.intel.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab@kernel.org>
19 months agomedia: dt-bindings: media: i2c: imx334 add new link_freq
Shravan Chippa [Wed, 1 Mar 2023 07:34:11 +0000 (08:34 +0100)]
media: dt-bindings: media: i2c: imx334 add new link_freq

Add new supported link frequency in dt example.

Acked-by: Krzysztof Kozlowski <krzysztof.kozlowski@linaro.org>
Suggested-by: Sakari Ailus <sakari.ailus@iki.fi>
Signed-off-by: Shravan Chippa <shravan.chippa@microchip.com>
Signed-off-by: Sakari Ailus <sakari.ailus@linux.intel.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab@kernel.org>
19 months agomedia: i2c: imx334: support lower bandwidth mode
Shravan Chippa [Wed, 1 Mar 2023 07:34:10 +0000 (08:34 +0100)]
media: i2c: imx334: support lower bandwidth mode

Some platforms may not be capable of supporting the bandwidth
required for 12 bit or 3840x2160@60 resolutions.

Add support for dynamically selecting 10 bit and 1920x1080@30
resolutions while leaving the existing configuration as default.

Reviewed-by: Jacopo Mondi <jacopo.mondi@ideasonboard.com>
CC: Conor Dooley <conor.dooley@microchip.com>
Signed-off-by: Prakash Battu <Prakash.Battu@microchip.com>
Signed-off-by: Shravan Chippa <shravan.chippa@microchip.com>
Signed-off-by: Sakari Ailus <sakari.ailus@linux.intel.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab@kernel.org>
19 months agomedia: i2c: imx334: add missing reset values for mode 3840x2160_regs[]
Shravan Chippa [Wed, 1 Mar 2023 07:34:09 +0000 (08:34 +0100)]
media: i2c: imx334: add missing reset values for mode 3840x2160_regs[]

There are some missing reset reg_mode values for the 3840x2160@60
resolution. The camera sensor still works in 3840x2160@60 resolution mode
because of the register reset values. This is an issue when we change the
modes dynamically. As an example, when we change the mode from 1920x1080@30
 resolution to 3840x2160@60 resoultion then the mode values will be written
to the registers from the array mode_3840x2160_regs[] which gives the wrong
output which is incorrect resolution.

So add the missing reset values to the mode_3840x2160_regs[].

Reviewed-by: Jacopo Mondi <jacopo.mondi@ideasonboard.com>
Signed-off-by: Shravan Chippa <shravan.chippa@microchip.com>
Signed-off-by: Sakari Ailus <sakari.ailus@linux.intel.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab@kernel.org>
19 months agomedia: i2c: imx334: replace __v4l2_ctrl_s_ctrl to __v4l2_ctrl_modify_range
Shravan Chippa [Wed, 1 Mar 2023 07:34:08 +0000 (08:34 +0100)]
media: i2c: imx334: replace __v4l2_ctrl_s_ctrl to __v4l2_ctrl_modify_range

For every mode we will get new set of values for hbalnk so use
__v4l2_ctrl_modify_range() to support multi modes for hblank.

The hblank value is readonly in the driver. because of this the function
returns error if we try to change. so added dumy return case in
imx334_set_ctrl function.

Reviewed-by: Jacopo Mondi <jacopo.mondi@ideasonboard.com>
Suggested-by: Jacopo Mondi <jacopo@jmondi.org>
Signed-off-by: Shravan Chippa <shravan.chippa@microchip.com>
Signed-off-by: Sakari Ailus <sakari.ailus@linux.intel.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab@kernel.org>
19 months agomedia: v4l2-ctrls: Fix doc for v4l2_ctrl_request_hdl_find
Miaoqian Lin [Thu, 22 Dec 2022 11:56:37 +0000 (12:56 +0100)]
media: v4l2-ctrls: Fix doc for v4l2_ctrl_request_hdl_find

We should call v4l2_ctrl_request_hdl_put() instead of
v4l2_ctrl_request_put_hdl(). Fix the typo.

Signed-off-by: Miaoqian Lin <linmq006@gmail.com>
Reviewed-by: Nicolas Dufresne <nicolas.dufresne@collabora.com>
Signed-off-by: Sakari Ailus <sakari.ailus@linux.intel.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab@kernel.org>
19 months agomedia: dt-bindings: qcom,venus: document firmware-name
Krzysztof Kozlowski [Tue, 27 Dec 2022 14:41:02 +0000 (15:41 +0100)]
media: dt-bindings: qcom,venus: document firmware-name

Venus Linux driver loads firmware based on firmware-name property and
some DTS already have it:

  msm8996-oneplus3.dtb: video-codec@c00000: Unevaluated properties are not allowed ('firmware-name', 'interconnect-names', 'interconnects' were unexpected)

Signed-off-by: Krzysztof Kozlowski <krzysztof.kozlowski@linaro.org>
Reviewed-by: Rob Herring <robh@kernel.org>
Signed-off-by: Sakari Ailus <sakari.ailus@linux.intel.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab@kernel.org>
19 months agomedia: dt-bindings: qcom,sm8250-venus: document OPP table
Krzysztof Kozlowski [Tue, 27 Dec 2022 14:41:01 +0000 (15:41 +0100)]
media: dt-bindings: qcom,sm8250-venus: document OPP table

Venus on Qualcomm SM8250 uses Operating Performance Points (both in DTS
and driver):

  sm8250-hdk.dtb: video-codec@aa00000: 'operating-points-v2', 'opp-table' do not match any of the regexes: 'pinctrl-[0-9]+'

Signed-off-by: Krzysztof Kozlowski <krzysztof.kozlowski@linaro.org>
Reviewed-by: Rob Herring <robh@kernel.org>
Signed-off-by: Sakari Ailus <sakari.ailus@linux.intel.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab@kernel.org>
19 months agomedia: dt-bindings: qcom,sdm845-venus-v2: document OPP table
Krzysztof Kozlowski [Tue, 27 Dec 2022 14:41:00 +0000 (15:41 +0100)]
media: dt-bindings: qcom,sdm845-venus-v2: document OPP table

Venus on Qualcomm SDM845 uses Operating Performance Points (in Linux driver).

Signed-off-by: Krzysztof Kozlowski <krzysztof.kozlowski@linaro.org>
Reviewed-by: Rob Herring <robh@kernel.org>
Signed-off-by: Sakari Ailus <sakari.ailus@linux.intel.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab@kernel.org>
19 months agomedia: dt-bindings: qcom,sc7280-venus: document OPP table
Krzysztof Kozlowski [Tue, 27 Dec 2022 14:40:59 +0000 (15:40 +0100)]
media: dt-bindings: qcom,sc7280-venus: document OPP table

Venus on Qualcomm SC7280 uses Operating Performance Points (both in DTS
and driver):

  sc7280-crd-r3.dtb: video-codec@aa00000: Unevaluated properties are not allowed ('operating-points-v2', 'opp-table' were unexpected)

Signed-off-by: Krzysztof Kozlowski <krzysztof.kozlowski@linaro.org>
Reviewed-by: Rob Herring <robh@kernel.org>
Signed-off-by: Sakari Ailus <sakari.ailus@linux.intel.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab@kernel.org>
19 months agomedia: dt-bindings: qcom,sc7180-venus: document OPP table
Krzysztof Kozlowski [Tue, 27 Dec 2022 14:40:58 +0000 (15:40 +0100)]
media: dt-bindings: qcom,sc7180-venus: document OPP table

Venus on Qualcomm SC7180 uses Operating Performance Points (both in DTS
and driver):

  sc7180-idp.dtb: video-codec@aa00000: Unevaluated properties are not allowed ('operating-points-v2', 'opp-table' were unexpected)

Signed-off-by: Krzysztof Kozlowski <krzysztof.kozlowski@linaro.org>
Reviewed-by: Rob Herring <robh@kernel.org>
Signed-off-by: Sakari Ailus <sakari.ailus@linux.intel.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab@kernel.org>
19 months agomedia: dt-bindings: qcom,msm8996-venus: document interconnects
Krzysztof Kozlowski [Tue, 27 Dec 2022 14:40:57 +0000 (15:40 +0100)]
media: dt-bindings: qcom,msm8996-venus: document interconnects

Venus on Qualcomm MSM8996 defines interconnects:

  apq8096-db820c.dtb: video-codec@c00000: Unevaluated properties are not allowed ('interconnect-names', 'interconnects' were unexpected)

Signed-off-by: Krzysztof Kozlowski <krzysztof.kozlowski@linaro.org>
Reviewed-by: Rob Herring <robh@kernel.org>
Signed-off-by: Sakari Ailus <sakari.ailus@linux.intel.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab@kernel.org>
19 months agomedia: dt-bindings: qcom,venus: split common properties
Krzysztof Kozlowski [Tue, 27 Dec 2022 14:40:56 +0000 (15:40 +0100)]
media: dt-bindings: qcom,venus: split common properties

All Qualcomm SoC Venus bindings share a lot of properties, so split
common part to re-usable schema to reduce the duplication and promote
unified style.

Signed-off-by: Krzysztof Kozlowski <krzysztof.kozlowski@linaro.org>
Reviewed-by: Rob Herring <robh@kernel.org>
Signed-off-by: Sakari Ailus <sakari.ailus@linux.intel.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab@kernel.org>
19 months agomedia: dt-bindings: qcom,venus: cleanup
Krzysztof Kozlowski [Tue, 27 Dec 2022 14:40:55 +0000 (15:40 +0100)]
media: dt-bindings: qcom,venus: cleanup

Cleanup the Qualcomm SoC Venus bindings:
 - Drop unneeded blank lines and quotes,
 - Fix indentation in example to 4-space (to match DT schema bindings
   style),
 - Add SoC name in each title.

Signed-off-by: Krzysztof Kozlowski <krzysztof.kozlowski@linaro.org>
Reviewed-by: Rob Herring <robh@kernel.org>
Signed-off-by: Sakari Ailus <sakari.ailus@linux.intel.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab@kernel.org>
19 months agomedia: max9286: Free control handler
Laurent Pinchart [Sat, 14 Jan 2023 21:46:50 +0000 (22:46 +0100)]
media: max9286: Free control handler

The control handler is leaked in some probe-time error paths, as well as
in the remove path. Fix it.

Fixes: 66d8c9d2422d ("media: i2c: Add MAX9286 driver")
Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
Reviewed-by: Niklas Söderlund <niklas.soderlund+renesas@ragnatech.se>
Reviewed-by: Jacopo Mondi <jacopo.mondi@ideasonboard.com>
Signed-off-by: Sakari Ailus <sakari.ailus@linux.intel.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab@kernel.org>
19 months agomedia: i2c: imx258: Parse and register properties
Robert Mader [Wed, 4 Jan 2023 12:23:37 +0000 (13:23 +0100)]
media: i2c: imx258: Parse and register properties

Analogous to e.g. the imx219. This enables propagating
V4L2_CID_CAMERA_ORIENTATION and V4L2_CID_CAMERA_SENSOR_ROTATION values.
The motivation is to allow libcamera detect these values from the device
tree and propagate them further to e.g. Pipewire.

While at it, reserve space for 3 additional controls even if
v4l2_ctrl_new_fwnode_properties() can only register 2 of them, to fix the
existing implementation which reserve space for 8 controls but actually
registers 9.

[Sakari Ailus: Rewrapped the commit message and removed changelog]

Signed-off-by: Robert Mader <robert.mader@collabora.com>
Reviewed-by: Jacopo Mondi <jacopo.mondi@ideasonboard.com>
Signed-off-by: Sakari Ailus <sakari.ailus@linux.intel.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab@kernel.org>
19 months agomedia: ov13b10: remove streaming mode set from reg_list
Bingbu Cao [Thu, 5 Jan 2023 11:02:49 +0000 (12:02 +0100)]
media: ov13b10: remove streaming mode set from reg_list

It is not expected that trying to set the sensor to
streaming mode when trying to set initial sensor configuration.

Signed-off-by: Bingbu Cao <bingbu.cao@intel.com>
Signed-off-by: Sakari Ailus <sakari.ailus@linux.intel.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab@kernel.org>
19 months agomedia: ov13b10: Support device probe in non-zero ACPI D state
Arec Kao [Tue, 14 Mar 2023 12:14:36 +0000 (13:14 +0100)]
media: ov13b10: Support device probe in non-zero ACPI D state

Tell ACPI device PM code that the driver supports the device being in
non-zero ACPI D state when the driver's probe function is entered.

Also do identification on the first access of the device, whether in
probe or when starting streaming.

Signed-off-by: Arec Kao <arec.kao@intel.com>
Signed-off-by: Sakari Ailus <sakari.ailus@linux.intel.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab@kernel.org>
19 months agomedia: i2c: ov2685: Add .get_selection() support
Luca Weiss [Wed, 1 Feb 2023 17:07:01 +0000 (18:07 +0100)]
media: i2c: ov2685: Add .get_selection() support

Add support for the .get_selection() pad operation to the ov2685 sensor
driver.

Report the native sensor size (pixel array), the crop bounds (readable
pixel array area) and the current and default analog crop rectangles.

Reviewed-by: Jacopo Mondi <jacopo.mondi@ideasonboard.com>
Signed-off-by: Luca Weiss <luca@z3ntu.xyz>
Signed-off-by: Sakari Ailus <sakari.ailus@linux.intel.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab@kernel.org>
19 months agomedia: i2c: ov2685: Add controls from fwnode
Luca Weiss [Wed, 1 Feb 2023 17:07:00 +0000 (18:07 +0100)]
media: i2c: ov2685: Add controls from fwnode

Add V4L2_CID_CAMERA_ORIENTATION and V4L2_CID_CAMERA_SENSOR_ROTATION
controls to the ov2685 driver by attempting to parse them from firmware.

Signed-off-by: Luca Weiss <luca@z3ntu.xyz>
Signed-off-by: Sakari Ailus <sakari.ailus@linux.intel.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab@kernel.org>
19 months agomedia: i2c: ov2685: Add print for power on write failed
Luca Weiss [Wed, 1 Feb 2023 17:06:59 +0000 (18:06 +0100)]
media: i2c: ov2685: Add print for power on write failed

If the sensor doens't power up correctly, for example due to incorrect
devicetree description, the power up i2c writes will fail.

Add an error print for this situation.

Reviewed-by: Jacopo Mondi <jacopo.mondi@ideasonboard.com>
Signed-off-by: Luca Weiss <luca@z3ntu.xyz>
Signed-off-by: Sakari Ailus <sakari.ailus@linux.intel.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab@kernel.org>
19 months agomedia: i2c: imx296: Use v4l2_subdev_get_fmt()
Laurent Pinchart [Mon, 6 Feb 2023 22:47:02 +0000 (23:47 +0100)]
media: i2c: imx296: Use v4l2_subdev_get_fmt()

The imx296 driver uses the subdev active state, there's no need to
implement the .get_fmt() operation manually. Use the
v4l2_subdev_get_fmt() helper instead.

Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
Signed-off-by: Sakari Ailus <sakari.ailus@linux.intel.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab@kernel.org>
19 months agomedia: i2c: ov5670: Properly handle !CONFIG_HAVE_CLK
Jacopo Mondi [Thu, 9 Feb 2023 20:12:35 +0000 (21:12 +0100)]
media: i2c: ov5670: Properly handle !CONFIG_HAVE_CLK

The ov5670 driver tries to get a reference to the xvclk provider by using
the common cock framework and deflects to parsing the "clock-frequency"
property in case the clock provider is not specified in the firmware
interface, detected by checking if ov5670->xvclk == PTR_ERR(-ENOENT).

However, as reported by the Smatch static checker, if CONFIG_HAVE_CLK is
not enabled, devm_clk_get() returns 0 which when passed to PTR_ERR()
means success causing the driver to fail without propagating any error
code up.

Explicitly handle the case where ov5670->xvclk it set to NULL, forcing
the code to parse the "clock-frequency" property in case CONFIG_HAVE_CLK
is not enabled, as suggested by Dan Carpenter.

Reported-by: Dan Carpenter <error27@gmail.com>
Suggested-by: Dan Carpenter <error27@gmail.com>
Signed-off-by: Jacopo Mondi <jacopo.mondi@ideasonboard.com>
Signed-off-by: Sakari Ailus <sakari.ailus@linux.intel.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab@kernel.org>
19 months agomedia: dt-bindings: st,stm32-cec: drop obsolete file
Krzysztof Kozlowski [Sat, 11 Feb 2023 12:45:40 +0000 (13:45 +0100)]
media: dt-bindings: st,stm32-cec: drop obsolete file

The st,stm32-cec.yaml was moved to media/cec directory, however the
"remove" part disappeared during applying.

Link: https://lore.kernel.org/all/20221208103115.25512-3-krzysztof.kozlowski@linaro.org/
Fixes: 8f43766211af ("media: dt-bindings: st,stm32-cec: move to cec subfolder")
Signed-off-by: Krzysztof Kozlowski <krzysztof.kozlowski@linaro.org>
Acked-by: Rob Herring <robh@kernel.org>
Signed-off-by: Sakari Ailus <sakari.ailus@linux.intel.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab@kernel.org>
19 months agomedia: i2c: ov5670: Support single-lane operation
Luca Weiss [Fri, 10 Feb 2023 20:33:18 +0000 (21:33 +0100)]
media: i2c: ov5670: Support single-lane operation

Currently the driver always configures the sensor for dual-lane MIPI
output, but it also supports single-lane output. Add support for that by
checking the data-lanes fwnode property how many lanes are used and
configure the necessary registers based on that.

To achieve this we move setting register 0x3018 out of the general reg
sequence so we set it to the correct value. The pixel_rate value also
needs to be adjusted.

[Sakari Ailus: Use div_s64 to divide a 64-bit number]

Signed-off-by: Luca Weiss <luca@z3ntu.xyz>
Reviewed-by: Jacopo Mondi <jacopo.mondi@ideasonboard.com>
Signed-off-by: Sakari Ailus <sakari.ailus@linux.intel.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab@kernel.org>
19 months agomedia: i2c: ov5670: Use dev_err_probe in probe function
Luca Weiss [Fri, 10 Feb 2023 20:33:17 +0000 (21:33 +0100)]
media: i2c: ov5670: Use dev_err_probe in probe function

Replace the unusual const char *err_msg usage with dev_err_probe which
also handles -EPROBE_DEFER better by not printing the message to kmsg.

Signed-off-by: Luca Weiss <luca@z3ntu.xyz>
Signed-off-by: Sakari Ailus <sakari.ailus@linux.intel.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab@kernel.org>
19 months agomedia: dt-bindings: samsung,s5c73m3: convert to dtschema
Krzysztof Kozlowski [Mon, 13 Mar 2023 14:49:16 +0000 (15:49 +0100)]
media: dt-bindings: samsung,s5c73m3: convert to dtschema

Convert the Samsung S5C73M3 8Mp camera ISP bindings to DT schema.

Signed-off-by: Krzysztof Kozlowski <krzysztof.kozlowski@linaro.org>
Reviewed-by: Rob Herring <robh@kernel.org>
Signed-off-by: Sakari Ailus <sakari.ailus@linux.intel.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab@kernel.org>
19 months agomedia: dt-bindings: samsung,fimc: convert to dtschema
Krzysztof Kozlowski [Mon, 13 Mar 2023 14:49:15 +0000 (15:49 +0100)]
media: dt-bindings: samsung,fimc: convert to dtschema

Convert the Samsung S5P/Exynos Camera Subsystem (FIMC) bindings to DT
schema.  Changes during conversion - adjust to existing DTS and Linux
driver: add iommus and power-domains.

Signed-off-by: Krzysztof Kozlowski <krzysztof.kozlowski@linaro.org>
Reviewed-by: Rob Herring <robh@kernel.org>
Signed-off-by: Sakari Ailus <sakari.ailus@linux.intel.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab@kernel.org>
19 months agomedia: dt-bindings: samsung,exynos4212-is: convert to dtschema
Krzysztof Kozlowski [Mon, 13 Mar 2023 14:49:14 +0000 (15:49 +0100)]
media: dt-bindings: samsung,exynos4212-is: convert to dtschema

Convert the Samsung Exynos4212/4412 SoC Imaging Subsystem (FIMC-IS)
bindings to DT schema.  Changes during conversion - adjust to existing
DTS and Linux driver: add iommus and power-domains.

Signed-off-by: Krzysztof Kozlowski <krzysztof.kozlowski@linaro.org>
Reviewed-by: Rob Herring <robh@kernel.org>
Signed-off-by: Sakari Ailus <sakari.ailus@linux.intel.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab@kernel.org>
19 months agomedia: dt-bindings: samsung,exynos4212-fimc-lite: convert to dtschema
Krzysztof Kozlowski [Mon, 13 Mar 2023 14:49:13 +0000 (15:49 +0100)]
media: dt-bindings: samsung,exynos4212-fimc-lite: convert to dtschema

Convert the Samsung Exynos SoC series camera host interface (FIMC-LITE)
bindings to DT schema.  Changes during conversion - adjust to existing
DTS and Linux driver: add iommus and power-domains.

Signed-off-by: Krzysztof Kozlowski <krzysztof.kozlowski@linaro.org>
Reviewed-by: Rob Herring <robh@kernel.org>
Signed-off-by: Sakari Ailus <sakari.ailus@linux.intel.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab@kernel.org>
19 months agomedia: dt-bindings: samsung,exynos4210-csis: convert to dtschema
Krzysztof Kozlowski [Mon, 13 Mar 2023 14:49:12 +0000 (15:49 +0100)]
media: dt-bindings: samsung,exynos4210-csis: convert to dtschema

Convert the Samsung S5P/Exynos SoC series MIPI CSI-2 receiver (MIPI
CSIS) bindings to DT schema.  Changes during conversion - adjust to
existing DTS and Linux driver:
1. Add phys and power-domains.
2. Move samsung,csis-wclk property to the endpoint node.

Signed-off-by: Krzysztof Kozlowski <krzysztof.kozlowski@linaro.org>
Reviewed-by: Rob Herring <robh@kernel.org>
Signed-off-by: Sakari Ailus <sakari.ailus@linux.intel.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab@kernel.org>
19 months agomedia: dt-bindings: i2c: samsung,s5k5baf: convert to dtschema
Krzysztof Kozlowski [Mon, 13 Mar 2023 14:49:11 +0000 (15:49 +0100)]
media: dt-bindings: i2c: samsung,s5k5baf: convert to dtschema

Convert the Samsung S5K5BAF image sensor bindings to DT schema.

Signed-off-by: Krzysztof Kozlowski <krzysztof.kozlowski@linaro.org>
Reviewed-by: Rob Herring <robh@kernel.org>
Signed-off-by: Sakari Ailus <sakari.ailus@linux.intel.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab@kernel.org>
19 months agomedia: dt-bindings: i2c: samsung,s5k6a3: convert to dtschema
Krzysztof Kozlowski [Mon, 13 Mar 2023 14:49:10 +0000 (15:49 +0100)]
media: dt-bindings: i2c: samsung,s5k6a3: convert to dtschema

Convert the Samsung S5K6A3(YX) raw image sensor bindings to DT schema.

Signed-off-by: Krzysztof Kozlowski <krzysztof.kozlowski@linaro.org>
Reviewed-by: Rob Herring <robh@kernel.org>
Signed-off-by: Sakari Ailus <sakari.ailus@linux.intel.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab@kernel.org>
19 months agomedia: samsung: exynos4-is: drop simple-bus from compatibles
Krzysztof Kozlowski [Mon, 13 Mar 2023 14:49:09 +0000 (15:49 +0100)]
media: samsung: exynos4-is: drop simple-bus from compatibles

The FIMC camera node wrapper is not a bus, so using simple-bus fallback
compatible just to instantiate its children nodes was never correct.
Driver should explicitly populate all its children devices.

Signed-off-by: Krzysztof Kozlowski <krzysztof.kozlowski@linaro.org>
Signed-off-by: Sakari Ailus <sakari.ailus@linux.intel.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab@kernel.org>
19 months agomedia: samsung: exynos4-is: do not require pinctrl
Krzysztof Kozlowski [Mon, 13 Mar 2023 14:49:08 +0000 (15:49 +0100)]
media: samsung: exynos4-is: do not require pinctrl

Driver does not handle pin configuration switching and several DTS
provide empty pinctrl property, just to satisfy the driver's requirement
for it.  Drop requirement for pinctrl property as it is really optional.

Signed-off-by: Krzysztof Kozlowski <krzysztof.kozlowski@linaro.org>
Signed-off-by: Sakari Ailus <sakari.ailus@linux.intel.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab@kernel.org>
19 months agomedia: dt-bindings: samsung-fimc: drop simple-bus
Krzysztof Kozlowski [Mon, 13 Mar 2023 14:49:07 +0000 (15:49 +0100)]
media: dt-bindings: samsung-fimc: drop simple-bus

The FIMC camera node wrapper is not a bus, so using simple-bus fallback
compatible just to instantiate its children nodes was never correct.
Drop the simple-bus compatible and expect driver to explicitly populate
children devices.

Signed-off-by: Krzysztof Kozlowski <krzysztof.kozlowski@linaro.org>
Acked-by: Rob Herring <robh@kernel.org>
Signed-off-by: Sakari Ailus <sakari.ailus@linux.intel.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab@kernel.org>
19 months agomedia: docs: media: v4l: uapi: Fix field type for SUBDEV_ENUM_FRAME_SIZE
Paul Elder [Mon, 13 Feb 2023 10:56:28 +0000 (11:56 +0100)]
media: docs: media: v4l: uapi: Fix field type for SUBDEV_ENUM_FRAME_SIZE

The documentation for the VIDIOC_SUBDEV_ENUM_FRAME_SIZE ioctl
incorrectly refers to struct v4l2_subdev_mbus_code_enum as the
parameter. Fix this.

[Sakari Ailus: Rebased on top of Dorota's documentation patch]

Signed-off-by: Paul Elder <paul.elder@ideasonboard.com>
Acked-by: Hans Verkuil <hverkuil-cisco@xs4all.nl>
Signed-off-by: Sakari Ailus <sakari.ailus@linux.intel.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab@kernel.org>
19 months agomedia: media api: Try to make enum usage clearer
Dorota Czaplejewicz [Sun, 19 Feb 2023 11:01:21 +0000 (12:01 +0100)]
media: media api: Try to make enum usage clearer

This clarifies which side of the calls is responsible for doing what to
which parts of the struct. It also expands the terse description of the
access algorithm into more prose-like, active voice description, which
trades conciseness for ease of comprehension.

Fixed: typo "format" -> "frame size" in enum-frame-size
Added: no holes in the enumeration
Added: enumerations per what?
Added: who fills in what in calls
Changed: "given" -> "specified"

[Sakari Ailus: Rewrap text]

Signed-off-by: Dorota Czaplejewicz <dorota.czaplejewicz@puri.sm>
Acked-by: Hans Verkuil <hverkuil-cisco@xs4all.nl>
Signed-off-by: Sakari Ailus <sakari.ailus@linux.intel.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab@kernel.org>
19 months agomedia: doc/media api: Try to make enum usage clearer
Dorota Czaplejewicz [Sun, 19 Feb 2023 11:00:34 +0000 (12:00 +0100)]
media: doc/media api: Try to make enum usage clearer

This clarifies which side of the calls is responsible for doing what to
which parts of the struct. This also explicitly states that repeating
values are disallowed. It also expands the terse description of the access
algorithm into more prose-like, active voice description, which trades
conciseness for ease of comprehension.

Added: mbus codes must not repeat
Added: no holes in the enumeration
Added: enumerations per what?
Added: who fills in what in calls
Changed: "zero" -> "0"
Changed: "given" -> "specified"

Still unclear how it works so didn't describe: "which". What is a "try
format" vs "active format"?

[Sakari Ailus: Rewrap lines, fix build issue]

Signed-off-by: Dorota Czaplejewicz <dorota.czaplejewicz@puri.sm>
Acked-by: Hans Verkuil <hverkuil-cisco@xs4all.nl>
Signed-off-by: Sakari Ailus <sakari.ailus@linux.intel.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab@kernel.org>
19 months agomedia: i2c: imx290: Add support for imx327 variant
Alexander Stein [Fri, 17 Feb 2023 09:52:21 +0000 (10:52 +0100)]
media: i2c: imx290: Add support for imx327 variant

Both sensors are quite similar. Their specs only differ regarding LVDS
and parallel output but are identical regarding MIPI-CSI-2 interface.
But they use a different init setting of hard-coded values, taken from
the datasheet.

Signed-off-by: Alexander Stein <alexander.stein@ew.tq-group.com>
Signed-off-by: Sakari Ailus <sakari.ailus@linux.intel.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab@kernel.org>
19 months agomedia: dt-bindings: media: i2c: Add imx327 version to IMX327 bindings
Alexander Stein [Fri, 17 Feb 2023 09:52:20 +0000 (10:52 +0100)]
media: dt-bindings: media: i2c: Add imx327 version to IMX327 bindings

The imx290 driver can be used for both imx290 and imx327 as they have a
similar register set and configuration. imx327 lacks 8 lanes LVDS and
120 FPS support.

Signed-off-by: Alexander Stein <alexander.stein@ew.tq-group.com>
Acked-by: Krzysztof Kozlowski <krzysztof.kozlowski@linaro.org>
Signed-off-by: Sakari Ailus <sakari.ailus@linux.intel.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab@kernel.org>
19 months agomedia: i2c: imx290: Add the error code to logs in start_streaming
Dave Stevenson [Wed, 15 Feb 2023 22:30:03 +0000 (23:30 +0100)]
media: i2c: imx290: Add the error code to logs in start_streaming

imx290_start_streaming logs what failed, but not the error
code from that function. Add it into the log message.

Signed-off-by: Dave Stevenson <dave.stevenson@raspberrypi.com>
Reviewed-by: Alexander Stein <alexander.stein@ew.tq-group.com>
Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
Signed-off-by: Sakari Ailus <sakari.ailus@linux.intel.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab@kernel.org>
19 months agomedia: i2c: imx290: Add support for H & V Flips
Dave Stevenson [Wed, 15 Feb 2023 22:30:02 +0000 (23:30 +0100)]
media: i2c: imx290: Add support for H & V Flips

The sensor supports H & V flips, so add the relevant hooks for
V4L2_CID_HFLIP and V4L2_CID_VFLIP to configure them.

Note that the Bayer order is maintained as the readout area
shifts by 1 pixel in the appropriate direction (note the
comment about the top margin being 8 pixels whilst the bottom
margin is 9). The V4L2_SEL_TGT_CROP region is therefore
adjusted appropriately.

Signed-off-by: Dave Stevenson <dave.stevenson@raspberrypi.com>
Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
Signed-off-by: Sakari Ailus <sakari.ailus@linux.intel.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab@kernel.org>
19 months agomedia: i2c: imx290: Add support for 74.25MHz external clock
Dave Stevenson [Wed, 15 Feb 2023 22:30:01 +0000 (23:30 +0100)]
media: i2c: imx290: Add support for 74.25MHz external clock

The sensor supports either a 37.125 or 74.25MHz external, but
the driver only supported 37.125MHz.

Add the relevant register configuration for either clock
frequency option.

Signed-off-by: Dave Stevenson <dave.stevenson@raspberrypi.com>
Reviewed-by: Alexander Stein <alexander.stein@ew.tq-group.com>
Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
Signed-off-by: Sakari Ailus <sakari.ailus@linux.intel.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab@kernel.org>
19 months agomedia: i2c: imx290: Remove duplicated write to IMX290_CTRL_07
Dave Stevenson [Wed, 15 Feb 2023 22:30:00 +0000 (23:30 +0100)]
media: i2c: imx290: Remove duplicated write to IMX290_CTRL_07

IMX290_CTRL_07 was written from both imx290_global_init_settings
and imx290_1080p_settings and imx290_720p_settings.

Remove it from imx290_global_init_settings as the setting varies
based on the mode.

Signed-off-by: Dave Stevenson <dave.stevenson@raspberrypi.com>
Reviewed-by: Alexander Stein <alexander.stein@ew.tq-group.com>
Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
Signed-off-by: Sakari Ailus <sakari.ailus@linux.intel.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab@kernel.org>
19 months agomedia: i2c: imx290: VMAX is mode dependent
Dave Stevenson [Wed, 15 Feb 2023 22:29:59 +0000 (23:29 +0100)]
media: i2c: imx290: VMAX is mode dependent

The default VMAX for 60fps in 720p mode is 750 according to the
datasheet, however the driver always left it at 1125 thereby stopping
60fps being achieved.

Make VMAX (and therefore V4L2_CID_VBLANK) mode dependent so that 720p60
can be achieved.

Signed-off-by: Dave Stevenson <dave.stevenson@raspberrypi.com>
Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
Signed-off-by: Sakari Ailus <sakari.ailus@linux.intel.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab@kernel.org>
19 months agomedia: i2c: imx290: Convert V4L2_CID_VBLANK to read/write
Dave Stevenson [Wed, 15 Feb 2023 22:29:58 +0000 (23:29 +0100)]
media: i2c: imx290: Convert V4L2_CID_VBLANK to read/write

The driver exposed V4L2_CID_VBLANK as a read only control to allow
for exposure calculations and determination of the frame rate.

Convert to a read/write control so that the frame rate can be
controlled.
V4L2_CID_VBLANK also sets the limits for the exposure control,
therefore exposure ranges have to be updated when vblank changes
(either via s_ctrl, or via changing mode).

Signed-off-by: Dave Stevenson <dave.stevenson@raspberrypi.com>
Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
Acked-by: Alexander Stein <alexander.stein@ew.tq-group.com>
Signed-off-by: Sakari Ailus <sakari.ailus@linux.intel.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab@kernel.org>
19 months agomedia: i2c: imx290: Convert V4L2_CID_HBLANK to read/write
Dave Stevenson [Wed, 15 Feb 2023 22:29:57 +0000 (23:29 +0100)]
media: i2c: imx290: Convert V4L2_CID_HBLANK to read/write

The driver exposed V4L2_CID_HBLANK as a read only control to allow
for exposure calculations and determination of the frame rate.

Convert to a read/write control so that the frame rate can be
controlled.

Signed-off-by: Dave Stevenson <dave.stevenson@raspberrypi.com>
Reviewed-by: Alexander Stein <alexander.stein@ew.tq-group.com>
Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
Signed-off-by: Sakari Ailus <sakari.ailus@linux.intel.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab@kernel.org>
19 months agomedia: i2c: imx290: Use CSI timings as per datasheet
Dave Stevenson [Wed, 15 Feb 2023 22:29:56 +0000 (23:29 +0100)]
media: i2c: imx290: Use CSI timings as per datasheet

Commit "98e0500eadb7 media: i2c: imx290: Add configurable link frequency
and pixel rate" added support for the increased link frequencies
on 2 data lanes, but didn't update the CSI timing registers in
accordance with the datasheet.

Use the specified settings.

Signed-off-by: Dave Stevenson <dave.stevenson@raspberrypi.com>
Reviewed-by: Alexander Stein <alexander.stein@ew.tq-group.com>
Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
Signed-off-by: Sakari Ailus <sakari.ailus@linux.intel.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab@kernel.org>
19 months agomedia: i2c: imx290: Support 60fps in 2 lane operation
Dave Stevenson [Wed, 15 Feb 2023 22:29:55 +0000 (23:29 +0100)]
media: i2c: imx290: Support 60fps in 2 lane operation

Commit "97589ad61c73 media: i2c: imx290: Add support for 2 data lanes"
added support for running in two lane mode (instead of 4), but
without changing the link frequency that resulted in a max of 30fps.

Commit "98e0500eadb7 media: i2c: imx290: Add configurable link frequency
and pixel rate" then doubled the link frequency when in 2 lane mode,
but didn't undo the correction for running at only 30fps, just extending
horizontal blanking instead.

Remove the 30fps limit on 2 lane by correcting the register config
in accordance with the datasheet for 60fps operation over 2 lanes.

Signed-off-by: Dave Stevenson <dave.stevenson@raspberrypi.com>
Reviewed-by: Alexander Stein <alexander.stein@ew.tq-group.com>
Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
Signed-off-by: Sakari Ailus <sakari.ailus@linux.intel.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab@kernel.org>
19 months agomedia: i2c: imx290: Fix the pixel rate at 148.5Mpix/s
Dave Stevenson [Wed, 15 Feb 2023 22:29:54 +0000 (23:29 +0100)]
media: i2c: imx290: Fix the pixel rate at 148.5Mpix/s

The datasheet lists the link frequency changes between
1080p and 720p modes. This is correct that the link frequency
changes as measured on an oscilloscope.

Link frequency is not necessarily the same as pixel rate.

The datasheet gives standard configurations for 1080p and 720p
modes at a number of frame rates.
Looking at the 1080p mode it gives:
HMAX = 0x898 = 2200
VMAX = 0x465 = 1125
2200 * 1125 * 60fps = 148.5MPix/s

Looking at the 720p mode it gives:
HMAX = 0xce4 = 3300
VMAX = 0x2ee = 750
3300 * 750 * 60fps = 148.5Mpix/s

This driver currently scales the pixel rate proportionally to the
link frequency, however the above shows that this is not the
correct thing to do, and currently all frame rate and exposure
calculations give incorrect results.

Correctly report the pixel rate as being 148.5MPix/s under any
mode.

Signed-off-by: Dave Stevenson <dave.stevenson@raspberrypi.com>
Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
Signed-off-by: Sakari Ailus <sakari.ailus@linux.intel.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab@kernel.org>
19 months agomedia: i2c: imx290: Add V4L2_SUBDEV_FL_HAS_EVENTS and subscribe hooks
Dave Stevenson [Wed, 15 Feb 2023 22:29:53 +0000 (23:29 +0100)]
media: i2c: imx290: Add V4L2_SUBDEV_FL_HAS_EVENTS and subscribe hooks

Any V4L2 subdevice that implements controls and declares
V4L2_SUBDEV_FL_HAS_DEVNODE should also declare V4L2_SUBDEV_FL_HAS_EVENTS
and implement subscribe_event and unsubscribe_event hooks.

This driver didn't and would therefore fail v4l2-compliance
testing.

Add the relevant hooks.

Signed-off-by: Dave Stevenson <dave.stevenson@raspberrypi.com>
Reviewed-by: Alexander Stein <alexander.stein@ew.tq-group.com>
Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
Signed-off-by: Sakari Ailus <sakari.ailus@linux.intel.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab@kernel.org>
19 months agomedia: i2c: imx290: Set the colorspace fields in the format
Dave Stevenson [Wed, 15 Feb 2023 22:29:52 +0000 (23:29 +0100)]
media: i2c: imx290: Set the colorspace fields in the format

The colorspace fields were left untouched in imx290_set_fmt
which lead to a v4l2-compliance failure.

Signed-off-by: Dave Stevenson <dave.stevenson@raspberrypi.com>
Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
Signed-off-by: Sakari Ailus <sakari.ailus@linux.intel.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab@kernel.org>
19 months agomedia: i2c: imx290: Match kernel coding style on whitespace
Dave Stevenson [Wed, 15 Feb 2023 22:29:51 +0000 (23:29 +0100)]
media: i2c: imx290: Match kernel coding style on whitespace

Fix up a couple of coding style issues regarding missing blank
lines after declarations, double blank lines, and incorrect
indentation.

Signed-off-by: Dave Stevenson <dave.stevenson@raspberrypi.com>
Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
Signed-off-by: Sakari Ailus <sakari.ailus@linux.intel.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab@kernel.org>
19 months agomedia: i2c: imx290: Add support for the mono sensor variant
Dave Stevenson [Wed, 15 Feb 2023 22:29:50 +0000 (23:29 +0100)]
media: i2c: imx290: Add support for the mono sensor variant

The IMX290 module is available as either mono or colour (Bayer).

Update the driver so that it can advertise the correct mono
formats instead of the colour ones.

Signed-off-by: Dave Stevenson <dave.stevenson@raspberrypi.com>
Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
Tested-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
Signed-off-by: Sakari Ailus <sakari.ailus@linux.intel.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab@kernel.org>
19 months agomedia: dt-bindings: media: i2c: Add mono version to IMX290 bindings
Dave Stevenson [Wed, 15 Feb 2023 22:29:49 +0000 (23:29 +0100)]
media: dt-bindings: media: i2c: Add mono version to IMX290 bindings

The IMX290 module is available as either monochrome or colour and
the variant is not detectable at runtime.

Add a new compatible string for the monochrome version, based on the
full device name IMX290LLR. For consistency, add a new compatible string
for the colour version based on the IMX290LQR full device name, and
deprecate the current ambiguous compatible string.

Signed-off-by: Dave Stevenson <dave.stevenson@raspberrypi.com>
Acked-by: Rob Herring <robh@kernel.org>
Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
Tested-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
Signed-off-by: Sakari Ailus <sakari.ailus@linux.intel.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab@kernel.org>
19 months agomedia: i2c: ov5647: Use bus-locked i2c_transfer()
Jacopo Mondi [Tue, 21 Feb 2023 17:10:48 +0000 (18:10 +0100)]
media: i2c: ov5647: Use bus-locked i2c_transfer()

The ov5647_read() functions calls i2c_master_send() and
i2c_master_read() in sequence. However this leaves space for other
clients to contend the bus and insert an unrelated transaction in between
the two calls.

Replace the two calls with a single i2c_transfer() one, that locks the
bus in between the transactions.

Signed-off-by: Jacopo Mondi <jacopo.mondi@ideasonboard.com>
Reviewed-by: Tommaso Merciai <tomm.merciai@gmail.com>
Reviewed-by: Dave Stevenson <dave.stevenson@raspberrypi.com>
Reviewed-by: Laurent Pinchart <laurent.pinchart+renesas@ideasonboard.com>
Signed-off-by: Sakari Ailus <sakari.ailus@linux.intel.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab@kernel.org>
19 months agomedia: i2c: ov5647: Add test pattern control
Valentine Barshak [Tue, 21 Feb 2023 17:10:47 +0000 (18:10 +0100)]
media: i2c: ov5647: Add test pattern control

This adds V4L2_CID_TEST_PATTERN control support.

Signed-off-by: Valentine Barshak <valentine.barshak@cogentembedded.com>
Signed-off-by: Jacopo Mondi <jacopo.mondi@ideasonboard.com>
Reviewed-by: Tommaso Merciai <tomm.merciai@gmail.com>
Reviewed-by: Dave Stevenson <dave.stevenson@raspberrypi.com>
Reviewed-by: Laurent Pinchart <laurent.pinchart+renesas@ideasonboard.com>
Signed-off-by: Sakari Ailus <sakari.ailus@linux.intel.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab@kernel.org>
19 months agomedia: i2c: imx290: Use device_property_read_u32() directly
Andy Shevchenko [Thu, 9 Feb 2023 22:09:54 +0000 (23:09 +0100)]
media: i2c: imx290: Use device_property_read_u32() directly

No need to call fwnode_property_read_u32(dev_fwnode()), when
we have already existing helper. So use it.

Signed-off-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
Reviewed-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
Signed-off-by: Sakari Ailus <sakari.ailus@linux.intel.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab@kernel.org>
19 months agomedia: i2c: imx290: Make use of get_unaligned_le24(), put_unaligned_le24()
Andy Shevchenko [Thu, 9 Feb 2023 22:12:05 +0000 (23:12 +0100)]
media: i2c: imx290: Make use of get_unaligned_le24(), put_unaligned_le24()

Since we have a proper endianness converters for LE 24-bit data use them.

Signed-off-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
Reviewed-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
Signed-off-by: Sakari Ailus <sakari.ailus@linux.intel.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab@kernel.org>
19 months agomedia: subdev: Add V4L2_SUBDEV_ROUTING_NO_MULTIPLEXING
Tomi Valkeinen [Thu, 2 Mar 2023 09:57:48 +0000 (10:57 +0100)]
media: subdev: Add V4L2_SUBDEV_ROUTING_NO_MULTIPLEXING

A common case with subdev routing is that on the subdevice just before
the DMA engines (video nodes), no multiplexing is allowed on the source
pads, as the DMA engine can only handle a single stream.

In some other situations one might also want to do the same check on the
sink side.

Add new routing validation flags to check these:
V4L2_SUBDEV_ROUTING_NO_SINK_MULTIPLEXING and
V4L2_SUBDEV_ROUTING_NO_SOURCE_MULTIPLEXING.

Signed-off-by: Tomi Valkeinen <tomi.valkeinen@ideasonboard.com>
Reviewed-by: Jacopo Mondi <jacopo.mondi@ideasonboard.com>
Signed-off-by: Sakari Ailus <sakari.ailus@linux.intel.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab@kernel.org>
19 months agomedia: subdev: Split V4L2_SUBDEV_ROUTING_NO_STREAM_MIX
Tomi Valkeinen [Thu, 2 Mar 2023 09:57:47 +0000 (10:57 +0100)]
media: subdev: Split V4L2_SUBDEV_ROUTING_NO_STREAM_MIX

V4L2_SUBDEV_ROUTING_NO_STREAM_MIX routing validation flag means that all
routes from a sink pad must go to the same source pad and all routes
going to the same source pad must originate from the same sink pad.

This does not cover all use cases. For example, if a device routes
all streams from a single sink pad to any of the source pads, but
streams from multiple sink pads can go to the same source pad, the
current flag is too restrictive.

Split the flag into two parts, V4L2_SUBDEV_ROUTING_NO_SINK_STREAM_MIX
and V4L2_SUBDEV_ROUTING_NO_SOURCE_STREAM_MIX, which add the restriction
only on one side of the device. Together they mean the same as
V4L2_SUBDEV_ROUTING_NO_STREAM_MIX.

Signed-off-by: Tomi Valkeinen <tomi.valkeinen@ideasonboard.com>
Reviewed-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
Reviewed-by: Jacopo Mondi <jacopo.mondi@ideasonboard.com>
Signed-off-by: Sakari Ailus <sakari.ailus@linux.intel.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab@kernel.org>
19 months agomedia: subdev: Use 'shall' instead of 'may' in route validation
Tomi Valkeinen [Thu, 2 Mar 2023 09:57:46 +0000 (10:57 +0100)]
media: subdev: Use 'shall' instead of 'may' in route validation

Route validation docs use the word 'may'. Change that to 'shall' for
emphasis.

Signed-off-by: Tomi Valkeinen <tomi.valkeinen@ideasonboard.com>
Reviewed-by: Jacopo Mondi <jacopo.mondi@ideasonboard.com>
Signed-off-by: Sakari Ailus <sakari.ailus@linux.intel.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab@kernel.org>
19 months agomedia: i2c: st-vgxy61: Use VGXY61_NB_POLARITIES instead of hardcoded value in tx_from_ep
Benjamin Mugnier [Wed, 1 Feb 2023 14:04:17 +0000 (15:04 +0100)]
media: i2c: st-vgxy61: Use VGXY61_NB_POLARITIES instead of hardcoded value in tx_from_ep

tx_from_ep's for loop uses '5' as bound, while in fact it refers to the
number of polarities. Replace it by VGXY61_NB_POLARITIES for
factorization.

Signed-off-by: Benjamin Mugnier <benjamin.mugnier@foss.st.com>
Signed-off-by: Sakari Ailus <sakari.ailus@linux.intel.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab@kernel.org>
19 months agomedia: i2c: st-vgxy61: Fix control flow error on probe
Benjamin Mugnier [Wed, 1 Feb 2023 14:04:16 +0000 (15:04 +0100)]
media: i2c: st-vgxy61: Fix control flow error on probe

In case of error 'update_hdr' now goes through 'power_off' instead of
returning, effectively shutting down the sensor.

Signed-off-by: Benjamin Mugnier <benjamin.mugnier@foss.st.com>
Signed-off-by: Sakari Ailus <sakari.ailus@linux.intel.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab@kernel.org>
19 months agomedia: i2c: st-vgxy61: Move 'detect' call to 'power_on'
Benjamin Mugnier [Wed, 1 Feb 2023 14:04:15 +0000 (15:04 +0100)]
media: i2c: st-vgxy61: Move 'detect' call to 'power_on'

Previously the device detection was performed after patching.
Move it right after the reset to make sure we have the correct sensor
before trying to patch it.

Signed-off-by: Benjamin Mugnier <benjamin.mugnier@foss.st.com>
Signed-off-by: Sakari Ailus <sakari.ailus@linux.intel.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab@kernel.org>
19 months agomedia: i2c: st-vgxy61: Remove duplicate default mode set on probe
Benjamin Mugnier [Wed, 1 Feb 2023 14:04:14 +0000 (15:04 +0100)]
media: i2c: st-vgxy61: Remove duplicate default mode set on probe

At this stage the default mode is unknown.
This is done correctly by vgxy61_fill_framefmt right after.

Signed-off-by: Benjamin Mugnier <benjamin.mugnier@foss.st.com>
Signed-off-by: Sakari Ailus <sakari.ailus@linux.intel.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab@kernel.org>
19 months agomedia: Documentation: userspace-api: media: drop clipping, destructive overlays
Hans Verkuil [Thu, 2 Mar 2023 12:57:31 +0000 (13:57 +0100)]
media: Documentation: userspace-api: media: drop clipping, destructive overlays

Support for clipping for overlays has been removed, update the
documentation.

Support for destructive overlay support has been removed as well,
also update the documentation for this.

Signed-off-by: Hans Verkuil <hverkuil-cisco@xs4all.nl>
Signed-off-by: Mauro Carvalho Chehab <mchehab@kernel.org>
19 months agomedia: v4l2-core: zero field base in struct v4l2_framebuffer
Hans Verkuil [Thu, 2 Mar 2023 12:57:30 +0000 (13:57 +0100)]
media: v4l2-core: zero field base in struct v4l2_framebuffer

Make sure this field is always 0 since destructive overlays
are no longer supported.

Signed-off-by: Hans Verkuil <hverkuil-cisco@xs4all.nl>
Signed-off-by: Mauro Carvalho Chehab <mchehab@kernel.org>
19 months agomedia: videodev.h: drop V4L2_FBUF_CAP_LIST/BITMAP_CLIPPING
Hans Verkuil [Thu, 2 Mar 2023 12:57:29 +0000 (13:57 +0100)]
media: videodev.h: drop V4L2_FBUF_CAP_LIST/BITMAP_CLIPPING

These two capabilities are no longer supported, so no
longer define them when compiling the kernel.

Signed-off-by: Hans Verkuil <hverkuil-cisco@xs4all.nl>
Signed-off-by: Mauro Carvalho Chehab <mchehab@kernel.org>
19 months agomedia: v4l2-core: drop v4l2_window clipping and bitmap support
Hans Verkuil [Thu, 2 Mar 2023 12:57:28 +0000 (13:57 +0100)]
media: v4l2-core: drop v4l2_window clipping and bitmap support

There are no longer any drivers that support clipping and bitmap
support for the capture or output overlay interfaces, so drop
this.

Always set the bitmap, clips and clipcount fields to 0, and
remove the compat32 support.

Signed-off-by: Hans Verkuil <hverkuil-cisco@xs4all.nl>
Signed-off-by: Mauro Carvalho Chehab <mchehab@kernel.org>
19 months agomedia: vivid: drop bitmap and clipping output overlay support
Hans Verkuil [Thu, 2 Mar 2023 12:57:27 +0000 (13:57 +0100)]
media: vivid: drop bitmap and clipping output overlay support

This test driver is the only remaining driver still using
the clipping and bitmap method. Drop support for this so
we can remove this in the V4L2 API as well.

Signed-off-by: Hans Verkuil <hverkuil-cisco@xs4all.nl>
Signed-off-by: Mauro Carvalho Chehab <mchehab@kernel.org>
19 months agomedia: vivid: drop overlay support
Hans Verkuil [Thu, 2 Mar 2023 12:57:26 +0000 (13:57 +0100)]
media: vivid: drop overlay support

Destructive overlay support (i.e. where the video frame is DMA-ed
straight into a framebuffer) is effectively dead. It was a
necessary evil in the early days when computers were not fast enough
to copy SDTV video frames around, but today that's no longer a problem.

It requires access to the framebuffer memory, which is a bad idea and
very hard to do safely. In addition, in drm it is today almost
impossible to get hold of the framebuffer address.

So drop support for this.

Signed-off-by: Hans Verkuil <hverkuil-cisco@xs4all.nl>
Signed-off-by: Mauro Carvalho Chehab <mchehab@kernel.org>
19 months agomedia: bttv: drop overlay support
Hans Verkuil [Thu, 2 Mar 2023 12:57:25 +0000 (13:57 +0100)]
media: bttv: drop overlay support

Destructive overlay support (i.e. where the video frame is DMA-ed
straight into a framebuffer) is effectively dead. It was a
necessary evil in the early days when computers were not fast enough
to copy SDTV video frames around, but today that's no longer a problem.

It requires access to the framebuffer memory, which is a bad idea and
very hard to do safely. In addition, in drm it is today almost
impossible to get hold of the framebuffer address.

So drop support for this.

Signed-off-by: Hans Verkuil <hverkuil-cisco@xs4all.nl>
Signed-off-by: Mauro Carvalho Chehab <mchehab@kernel.org>
19 months agomedia: saa7134: drop overlay support
Hans Verkuil [Thu, 2 Mar 2023 12:57:24 +0000 (13:57 +0100)]
media: saa7134: drop overlay support

Destructive overlay support (i.e. where the video frame is DMA-ed
straight into a framebuffer) is effectively dead. It was a
necessary evil in the early days when computers were not fast enough
to copy SDTV video frames around, but today that's no longer a problem.

It requires access to the framebuffer memory, which is a bad idea and
very hard to do safely. In addition, in drm it is today almost
impossible to get hold of the framebuffer address.

So drop support for this.

Signed-off-by: Hans Verkuil <hverkuil-cisco@xs4all.nl>
Signed-off-by: Mauro Carvalho Chehab <mchehab@kernel.org>
19 months agomedia: saa7146: drop overlay support
Hans Verkuil [Thu, 2 Mar 2023 12:57:23 +0000 (13:57 +0100)]
media: saa7146: drop overlay support

Destructive overlay support (i.e. where the video frame is DMA-ed
straight into a framebuffer) is effectively dead. It was a
necessary evil in the early days when computers were not fast enough
to copy SDTV video frames around, but today that's no longer a problem.

It requires access to the framebuffer memory, which is a bad idea and
very hard to do safely. In addition, in drm it is today almost
impossible to get hold of the framebuffer address.

So drop support for this.

Signed-off-by: Hans Verkuil <hverkuil-cisco@xs4all.nl>
Signed-off-by: Mauro Carvalho Chehab <mchehab@kernel.org>
19 months agomedia: common: btcx-risc.h: drop obsolete header
Hans Verkuil [Wed, 1 Mar 2023 11:48:06 +0000 (12:48 +0100)]
media: common: btcx-risc.h: drop obsolete header

This header is no longer used, drop it.

Signed-off-by: Hans Verkuil <hverkuil-cisco@xs4all.nl>
Signed-off-by: Mauro Carvalho Chehab <mchehab@kernel.org>
19 months agomedia: zoran: drop two obsolete prototypes from zoran_device.h
Hans Verkuil [Wed, 1 Mar 2023 11:47:36 +0000 (12:47 +0100)]
media: zoran: drop two obsolete prototypes from zoran_device.h

These overlay-related functions no longer exist, so drop them
from the header.

Signed-off-by: Hans Verkuil <hverkuil-cisco@xs4all.nl>
Signed-off-by: Mauro Carvalho Chehab <mchehab@kernel.org>
19 months agomedia: stm32: dma2d: remove unused fb_buf
Hans Verkuil [Wed, 1 Mar 2023 11:13:45 +0000 (12:13 +0100)]
media: stm32: dma2d: remove unused fb_buf

Drop the unused struct v4l2_framebuffer fb_buf in struct dma2d_ctx.

Signed-off-by: Hans Verkuil <hverkuil-cisco@xs4all.nl>
CC: Hugues Fruchet <hugues.fruchet@foss.st.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab@kernel.org>
19 months agomedia: admin-guide/media/cec.rst: update CEC debugging doc
Hans Verkuil [Wed, 15 Feb 2023 11:01:51 +0000 (12:01 +0100)]
media: admin-guide/media/cec.rst: update CEC debugging doc

The documentation on how to create your own Raspberry Pi CEC debugger was a
bit out of date. Update it to the Raspberry Pi 4B, drop the mention of the RTC
and a link to a picture that no longer works.

Also reorganize the text to make it easier to follow and change the pins to
match the pins I use.

Signed-off-by: Hans Verkuil <hverkuil-cisco@xs4all.nl>
Signed-off-by: Mauro Carvalho Chehab <mchehab@kernel.org>
19 months agomedia: docs: vidioc-g-ext-ctrls.rst: Document p_s32 and p_s64 fields
Daniel Lundberg Pedersen [Tue, 7 Mar 2023 13:36:17 +0000 (14:36 +0100)]
media: docs: vidioc-g-ext-ctrls.rst: Document p_s32 and p_s64 fields

p_s32 and p_s64 were added to the v4l2_ext_control struct, so these
should have documentation as well.

Signed-off-by: Daniel Lundberg Pedersen <dlp@qtec.com>
Signed-off-by: Hans Verkuil <hverkuil-cisco@xs4all.nl>
Signed-off-by: Mauro Carvalho Chehab <mchehab@kernel.org>
19 months agomedia: pvrusb2: VIDEO_PVRUSB2 depends on DVB_CORE to use dvb_* symbols
Tom Rix [Sat, 11 Mar 2023 13:48:47 +0000 (14:48 +0100)]
media: pvrusb2: VIDEO_PVRUSB2 depends on DVB_CORE to use dvb_* symbols

A rand config causes this link error
vmlinux.o: In function `pvr2_dvb_create':
(.text+0x8af1d2): undefined reference to `dvb_register_adapter'

The rand config has
CONFIG_VIDEO_PVRUSB2=y
CONFIG_VIDEO_DEV=y
CONFIG_DVB_CORE=m

VIDEO_PVRUSB2 should also depend on DVB_CORE.

Signed-off-by: Tom Rix <trix@redhat.com>
Signed-off-by: Hans Verkuil <hverkuil-cisco@xs4all.nl>
Signed-off-by: Mauro Carvalho Chehab <mchehab@kernel.org>
19 months agomedia: platform: cros-ec: Add Gladios/Lisbon to the match table
Kevin Chiu [Tue, 7 Mar 2023 12:58:45 +0000 (13:58 +0100)]
media: platform: cros-ec: Add Gladios/Lisbon to the match table

The Google Gladios/Lisbon device uses the same approach as the Google Brask
which enables the HDMI CEC via the cros-ec-cec driver.

Signed-off-by: Kevin Chiu <kevin.chiu.17802@gmail.com>
Signed-off-by: Hans Verkuil <hverkuil-cisco@xs4all.nl>
Signed-off-by: Mauro Carvalho Chehab <mchehab@kernel.org>
19 months agomedia: av7110: prevent underflow in write_ts_to_decoder()
Dan Carpenter [Tue, 7 Mar 2023 10:00:23 +0000 (11:00 +0100)]
media: av7110: prevent underflow in write_ts_to_decoder()

The buf[4] value comes from the user via ts_play().  It is a value in
the u8 range.  The final length we pass to av7110_ipack_instant_repack()
is "len - (buf[4] + 1) - 4" so add a check to ensure that the length is
not negative.  It's not clear that passing a negative len value does
anything bad necessarily, but it's not best practice.

With the new bounds checking the "if (!len)" condition is no longer
possible or required so remove that.

Fixes: fd46d16d602a ("V4L/DVB (11759): dvb-ttpci: Add TS replay capability")
Signed-off-by: Dan Carpenter <error27@gmail.com>
Signed-off-by: Hans Verkuil <hverkuil-cisco@xs4all.nl>
Signed-off-by: Mauro Carvalho Chehab <mchehab@kernel.org>
19 months agomedia: mtk-jpegenc: Fix a compilation issue
oushixiong [Tue, 7 Mar 2023 05:57:48 +0000 (06:57 +0100)]
media: mtk-jpegenc: Fix a compilation issue

‘mtk8195_jpegenc_drvdata’ defined but not used [-Werror=unused-variable]

Signed-off-by: oushixiong <oushixiong@kylinos.cn>
Signed-off-by: Hans Verkuil <hverkuil-cisco@xs4all.nl>
Signed-off-by: Mauro Carvalho Chehab <mchehab@kernel.org>
19 months agomedia: stm32-dcmi: Enable incoherent buffer allocation
Marek Vasut [Sun, 5 Mar 2023 20:51:07 +0000 (21:51 +0100)]
media: stm32-dcmi: Enable incoherent buffer allocation

Set allow_cache_hints to 1 for the vb2_queue capture queue in the
STM32MP15xx DCMI V4L2 driver. This allows us to allocate buffers
with the V4L2_MEMORY_FLAG_NON_COHERENT set. On STM32MP15xx SoCs,
this enables caching for this memory, which improves performance
when being read from CPU.

This change should be safe from race conditions since videobuf2
already invalidates or flushes the appropriate cache lines in
its prepare() and finish() methods.

Tested on a STM32MP157F SoC. Resulted in 4x buffer access speedup.

Signed-off-by: Marek Vasut <marex@denx.de>
Signed-off-by: Hans Verkuil <hverkuil-cisco@xs4all.nl>
Signed-off-by: Mauro Carvalho Chehab <mchehab@kernel.org>
19 months agomedia: pci: tw68: Fix null-ptr-deref bug in buf prepare and finish
harperchen [Fri, 3 Mar 2023 15:30:11 +0000 (16:30 +0100)]
media: pci: tw68: Fix null-ptr-deref bug in buf prepare and finish

When the driver calls tw68_risc_buffer() to prepare the buffer, the
function call dma_alloc_coherent may fail, resulting in a empty buffer
buf->cpu. Later when we free the buffer or access the buffer, null ptr
deref is triggered.

This bug is similar to the following one:
https://git.linuxtv.org/media_stage.git/commit/?id=2b064d91440b33fba5b452f2d1b31f13ae911d71.

We believe the bug can be also dynamically triggered from user side.
Similarly, we fix this by checking the return value of tw68_risc_buffer()
and the value of buf->cpu before buffer free.

Signed-off-by: harperchen <harperchen1110@gmail.com>
Signed-off-by: Hans Verkuil <hverkuil-cisco@xs4all.nl>
Signed-off-by: Mauro Carvalho Chehab <mchehab@kernel.org>
19 months agomedia: platform: via: Handle error for dma_set_mask
harperchen [Fri, 3 Mar 2023 11:16:24 +0000 (12:16 +0100)]
media: platform: via: Handle error for dma_set_mask

As the potential failure of the dma_set_mask(), we fix this
bug by checking its return value and performing proper error
handling.

Signed-off-by: harperchen <harperchen1110@gmail.com>
Signed-off-by: Hans Verkuil <hverkuil-cisco@xs4all.nl>
Signed-off-by: Mauro Carvalho Chehab <mchehab@kernel.org>
19 months agomedia: MAINTAINERS: Add myself as CAMSS maintainer
Bryan O'Donoghue [Thu, 2 Mar 2023 15:53:53 +0000 (16:53 +0100)]
media: MAINTAINERS: Add myself as CAMSS maintainer

I discussed with Robert a few ago lending a hand with CAMSS. Following up
on that discussion, I'm happy to help.

Signed-off-by: Bryan O'Donoghue <bryan.odonoghue@linaro.org>
Reviewed-by: Robert Foss <rfoss@kernel.org>
Signed-off-by: Hans Verkuil <hverkuil-cisco@xs4all.nl>
Signed-off-by: Mauro Carvalho Chehab <mchehab@kernel.org>
19 months agomedia: cx23885: Fix a null-ptr-deref bug in buffer_prepare() and buffer_finish()
harperchen [Thu, 2 Mar 2023 12:39:05 +0000 (13:39 +0100)]
media: cx23885: Fix a null-ptr-deref bug in buffer_prepare() and buffer_finish()

When the driver calls cx23885_risc_buffer() to prepare the buffer, the
function call dma_alloc_coherent may fail, resulting in a empty buffer
risc->cpu. Later when we free the buffer or access the buffer, null ptr
deref is triggered.

This bug is similar to the following one:
https://git.linuxtv.org/media_stage.git/commit/?id=2b064d91440b33fba5b452f2d1b31f13ae911d71.

We believe the bug can be also dynamically triggered from user side.
Similarly, we fix this by checking the return value of cx23885_risc_buffer()
and the value of risc->cpu before buffer free.

Signed-off-by: harperchen <harperchen1110@gmail.com>
Signed-off-by: Hans Verkuil <hverkuil-cisco@xs4all.nl>
Signed-off-by: Mauro Carvalho Chehab <mchehab@kernel.org>
19 months agomedia: amphion: decoder implement display delay enable
Ming Qian [Thu, 2 Mar 2023 05:34:10 +0000 (06:34 +0100)]
media: amphion: decoder implement display delay enable

amphion vpu support a low latency mode,
when V4L2_CID_MPEG_VIDEO_DEC_DISPLAY_DELAY_ENABLE is enabled,
decoder can display frame immediately after it's decoded.
Only h264 is support yet.

Fixes: 6de8d628df6e ("media: amphion: add v4l2 m2m vpu decoder stateful driver")
Signed-off-by: Ming Qian <ming.qian@nxp.com>
Signed-off-by: Hans Verkuil <hverkuil-cisco@xs4all.nl>
Signed-off-by: Mauro Carvalho Chehab <mchehab@kernel.org>
19 months agomedia: platform: cros-ec: Add aurash to the match table
Zoey Wu [Thu, 23 Feb 2023 05:41:38 +0000 (06:41 +0100)]
media: platform: cros-ec: Add aurash to the match table

The Google aurash device uses the same approach as the Google Brask
which enables the HDMI CEC via the cros-ec-cec driver.

Signed-off-by: Zoey Wu <zoey_wu@wistron.corp-partner.google.com>
Signed-off-by: Hans Verkuil <hverkuil-cisco@xs4all.nl>
Signed-off-by: Mauro Carvalho Chehab <mchehab@kernel.org>
19 months agomedia: platform: mtk-mdp3: Add missing check and free for ida_alloc
Jiasheng Jiang [Thu, 9 Feb 2023 13:52:45 +0000 (14:52 +0100)]
media: platform: mtk-mdp3: Add missing check and free for ida_alloc

Add the check for the return value of the ida_alloc in order to avoid
NULL pointer dereference.
Moreover, free allocated "ctx->id" if mdp_m2m_open fails later in order
to avoid memory leak.

Fixes: 61890ccaefaf ("media: platform: mtk-mdp3: add MediaTek MDP3 driver")
Signed-off-by: Jiasheng Jiang <jiasheng@iscas.ac.cn>
Reviewed-by: AngeloGioacchino Del Regno <angelogioacchino.delregno@collabora.com>
Signed-off-by: Hans Verkuil <hverkuil-cisco@xs4all.nl>
Signed-off-by: Mauro Carvalho Chehab <mchehab@kernel.org>
19 months agomedia: platform: stm32: use devm_platform_get_and_ioremap_resource()
Ye Xingchen [Wed, 8 Feb 2023 09:01:06 +0000 (10:01 +0100)]
media: platform: stm32: use devm_platform_get_and_ioremap_resource()

Convert platform_get_resource(), devm_ioremap_resource() to a single
call to devm_platform_get_and_ioremap_resource(), as this is exactly
what this function does.

Signed-off-by: Ye Xingchen <ye.xingchen@zte.com.cn>
Signed-off-by: Hans Verkuil <hverkuil-cisco@xs4all.nl>
Signed-off-by: Mauro Carvalho Chehab <mchehab@kernel.org>