platform/kernel/linux-rpi.git
17 months agomedia: i2c: ak7375: Add regulator management
Yassine Oudjana [Fri, 9 Dec 2022 14:37:41 +0000 (15:37 +0100)]
media: i2c: ak7375: Add regulator management

Make the driver get needed regulators on probe and enable/disable
them on runtime PM callbacks.

Signed-off-by: Yassine Oudjana <y.oudjana@protonmail.com>
Tested-by: Umang Jain <umang.jain@ideasonboard.com>
Signed-off-by: Sakari Ailus <sakari.ailus@linux.intel.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab@kernel.org>
17 months agomedia: dt-bindings: ak7375: Add supplies
Yassine Oudjana [Fri, 9 Dec 2022 14:37:40 +0000 (15:37 +0100)]
media: dt-bindings: ak7375: Add supplies

Add supply properties to describe regulators needed to power
the AK7375 VCM.

Signed-off-by: Yassine Oudjana <y.oudjana@protonmail.com>
Acked-by: Krzysztof Kozlowski <krzysztof.kozlowski@linaro.org>
Tested-by: Umang Jain <umang.jain@ideasonboard.com>
Signed-off-by: Sakari Ailus <sakari.ailus@linux.intel.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab@kernel.org>
17 months agomedia: dt-bindings: ak7375: Convert to DT schema
Yassine Oudjana [Fri, 9 Dec 2022 14:37:39 +0000 (15:37 +0100)]
media: dt-bindings: ak7375: Convert to DT schema

Convert DT bindings document for AKM AK7375 VCM to DT schema
format and add an example.

Signed-off-by: Yassine Oudjana <y.oudjana@protonmail.com>
Reviewed-by: Krzysztof Kozlowski <krzysztof.kozlowski@linaro.org>
Tested-by: Umang Jain <umang.jain@ideasonboard.com>
Signed-off-by: Sakari Ailus <sakari.ailus@linux.intel.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab@kernel.org>
17 months agomedia: mc: entity: Fix minor issues in comments and documentation
Laurent Pinchart [Mon, 12 Dec 2022 13:25:05 +0000 (14:25 +0100)]
media: mc: entity: Fix minor issues in comments and documentation

Commit ae219872834a ("media: mc: entity: Rewrite
media_pipeline_start()") incorrectly referred to entity instead of pad
in a comment, and forgot to update a second comment accordingly when
moving the pipe from entity to pad. Furthermore, it didn't properly
reflow the documentation text it updated.

Fix those small issues.

Fixes: ae219872834a ("media: mc: entity: Rewrite media_pipeline_start()")
Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
Reviewed-by: Tomi Valkeinen <tomi.valkeinen@ideasonboard.com>
Signed-off-by: Sakari Ailus <sakari.ailus@linux.intel.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab@kernel.org>
17 months agomedia: mc: Get media_device directly from pad
Laurent Pinchart [Mon, 12 Dec 2022 13:25:04 +0000 (14:25 +0100)]
media: mc: Get media_device directly from pad

Various functions access the media_device from a pad by going through
the entity the pad belongs to. Remove the level of indirection and get
the media_device from the pad directly.

Fixes: 9e3576a1ae2b ("media: mc: convert pipeline funcs to take media_pad")
Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
Reviewed-by: Tomi Valkeinen <tomi.valkeinen@ideasonboard.com>
Signed-off-by: Sakari Ailus <sakari.ailus@linux.intel.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab@kernel.org>
17 months agomedia: i2c: ov9282: Switch to use dev_err_probe helper
Alexander Stein [Tue, 13 Dec 2022 14:07:27 +0000 (15:07 +0100)]
media: i2c: ov9282: Switch to use dev_err_probe helper

In the probe path, dev_err() can be replaced with dev_err_probe()
which will check if error code is -EPROBE_DEFER and prints the
error name. It also sets the defer probe reason which can be
checked later through debugfs. It's more simple in error path.

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>
17 months agomedia: i2c: ov9282: remove unused and unset i2c_client member
Alexander Stein [Tue, 13 Dec 2022 14:07:26 +0000 (15:07 +0100)]
media: i2c: ov9282: remove unused and unset i2c_client member

This is not need anyway as the i2c_client is stored in v4l2_subdev.

Signed-off-by: Alexander Stein <alexander.stein@ew.tq-group.com>
Acked-by: Daniele Alessandrelli <daniele.alessandrelli@intel.com>
Signed-off-by: Sakari Ailus <sakari.ailus@linux.intel.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab@kernel.org>
17 months agomedia: xilinx: dma: Use media_pipeline_for_each_pad()
Laurent Pinchart [Wed, 21 Dec 2022 09:33:41 +0000 (10:33 +0100)]
media: xilinx: dma: Use media_pipeline_for_each_pad()

Replace usage of the deprecated media graph walk API with the new
media_pipeline_for_each_pad() macro.

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>
17 months agomedia: ti: omap4iss: Use media_pipeline_for_each_entity()
Laurent Pinchart [Wed, 21 Dec 2022 09:33:40 +0000 (10:33 +0100)]
media: ti: omap4iss: Use media_pipeline_for_each_entity()

Replace usage of the deprecated media graph walk API with the new
media_pipeline_for_each_entity() and media_pipeline_for_each_pad()
macros.

Even though the entity iterator may seem a better match when build the
entity bitmap in iss_video_stream(), it would not be more efficient as
it would still iterate internally over all pads. As the entity iterator
requires explicit iterator initialization and cleanup calls, the code
would be more complex.

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>
17 months agomedia: ti: omap3isp: Use media_pipeline_for_each_entity()
Laurent Pinchart [Wed, 21 Dec 2022 09:33:39 +0000 (10:33 +0100)]
media: ti: omap3isp: Use media_pipeline_for_each_entity()

Replace usage of the deprecated media graph walk API with the new
media_pipeline_for_each_entity() macro.

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>
17 months agomedia: mc: entity: Add entity iterator for media_pipeline
Laurent Pinchart [Wed, 21 Dec 2022 09:33:38 +0000 (10:33 +0100)]
media: mc: entity: Add entity iterator for media_pipeline

Add a media_pipeline_for_each_entity() macro to iterate over entities in
a pipeline. This should be used by driver as a replacement of the
media_graph_walk API, as iterating over the media_pipeline uses the
cached list of pads and is thus more efficient.

Deprecate the media_graph_walk API to indicate it shouldn't be used in
new drivers.

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>
17 months agomedia: mc: entity: Add pad iterator for media_pipeline
Laurent Pinchart [Wed, 21 Dec 2022 09:33:37 +0000 (10:33 +0100)]
media: mc: entity: Add pad iterator for media_pipeline

Add a media_pipeline_for_each_pad() macro to iterate over pads in a
pipeline. This should be used by driver as a replacement of the
media_graph_walk API, as iterating over the media_pipeline uses the
cached list of pads and is thus more efficient.

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>
17 months agomedia: ov5640: Handle delays when no reset_gpio set
Jai Luthra [Tue, 3 Jan 2023 12:27:36 +0000 (13:27 +0100)]
media: ov5640: Handle delays when no reset_gpio set

Some module manufacturers [1][2] don't expose the RESETB and PWDN pins
of the sensor directly through the 15-pin FFC connector. Instead wiring
~PWDN gpio to the sensor pins with appropriate delays.

In such cases, reset_gpio will not be available to the driver, but it
will still be toggled when the sensor is powered on, and thus we should
still honor the wait time of >= 5ms + 1ms + 20ms (see figure 2-3 in [3])
before attempting any i/o operations over SCCB.

Also, rename the function to ov5640_powerup_sequence to better match the
datasheet (section 2.7).

[1] https://digilent.com/reference/_media/reference/add-ons/pcam-5c/pcam_5c_sch.pdf
[2] https://www.alinx.com/public/upload/file/AN5641_User_Manual.pdf
[3] https://cdn.sparkfun.com/datasheets/Sensors/LightImaging/OV5640_datasheet.pdf

Fixes: 19a81c1426c1 ("[media] add Omnivision OV5640 sensor driver")
Reported-by: Nishanth Menon <nm@ti.com>
Signed-off-by: Jai Luthra <j-luthra@ti.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>
17 months agomedia: ov5640: Fix soft reset sequence and timings
Jai Luthra [Tue, 3 Jan 2023 12:27:35 +0000 (13:27 +0100)]
media: ov5640: Fix soft reset sequence and timings

Move the register-based reset out of the init_setting[] and into the
powerup_sequence function. The sensor is power cycled and reset using
the gpio pins so the soft reset is not always necessary.

This also ensures that soft reset honors the timing sequence
from the datasheet [1].

[1] https://cdn.sparkfun.com/datasheets/Sensors/LightImaging/OV5640_datasheet.pdf

Fixes: 19a81c1426c1 ("[media] add Omnivision OV5640 sensor driver")
Reported-by: Nishanth Menon <nm@ti.com>
Suggested-by: Jacopo Mondi <jacopo.mondi@ideasonboard.com>
Signed-off-by: Jai Luthra <j-luthra@ti.com>
Reviewed-by: Jacopo Mondi <jacopo.mondi@ideasonaboard.com>
Signed-off-by: Sakari Ailus <sakari.ailus@linux.intel.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab@kernel.org>
17 months agomedia: i2c: st-vgxy61: Use asm intead of asm-generic
Andy Shevchenko [Tue, 3 Jan 2023 14:52:19 +0000 (15:52 +0100)]
media: i2c: st-vgxy61: Use asm intead of asm-generic

There is no point to specify asm-generic for the unaligned.h.
Drop the 'generic' suffix and move the inclusion to be after
the non-media linux/* ones.

Signed-off-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
Reviewed-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>
17 months agomedia: ov5640: Update last busy timestamp to reset autosuspend timer
Andrey Skvortsov [Sun, 15 Jan 2023 17:30:10 +0000 (18:30 +0100)]
media: ov5640: Update last busy timestamp to reset autosuspend timer

Otherwise autosuspend delay doesn't work and power is cut off
immediately as device is freed.

Signed-off-by: Andrey Skvortsov <andrej.skvortzov@gmail.com>
Signed-off-by: Sakari Ailus <sakari.ailus@linux.intel.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab@kernel.org>
17 months agomedia: i2c: Add driver for OmniVision OV8858
Nicholas Roth [Mon, 16 Jan 2023 15:44:48 +0000 (16:44 +0100)]
media: i2c: Add driver for OmniVision OV8858

Add a driver for OmniVision OV8858 image sensor.

The driver currently supports operations with 2 and 4 data lanes, in
full resolution and half-binned resolution modes.

The driver has been upported from the PinephonePro BSP available at
https://gitlab.com/pine64-org/linux.git
at commit 8c4a90c12dc2 ("media: i2c: ov8858: Use default subdev
name").

Signed-off-by: Nicholas Roth <nicholas@rothemail.net>
Signed-off-by: Jacopo Mondi <jacopo.mondi@ideasonboard.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>
17 months agomedia: dt-bindings: media: Add OmniVision OV8858
Jacopo Mondi [Mon, 16 Jan 2023 15:44:47 +0000 (16:44 +0100)]
media: dt-bindings: media: Add OmniVision OV8858

Add binding schema for the OmniVision OV8858 8 Megapixels camera sensor.

Signed-off-by: Jacopo Mondi <jacopo.mondi@ideasonboard.com>
Reviewed-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
Reviewed-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>
17 months agomedia: i2c: imx290: Handle error from imx290_set_data_lanes()
Laurent Pinchart [Mon, 16 Jan 2023 14:44:54 +0000 (15:44 +0100)]
media: i2c: imx290: Handle error from imx290_set_data_lanes()

Check the error status returned by imx290_set_data_lanes() in its
caller and propagate it.

Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
Reviewed-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>
17 months agomedia: i2c: imx290: Simplify imx290_set_data_lanes()
Laurent Pinchart [Mon, 16 Jan 2023 14:44:53 +0000 (15:44 +0100)]
media: i2c: imx290: Simplify imx290_set_data_lanes()

There's no need to check for an incorrect number of data lanes in
imx290_set_data_lanes() as the value is validated at probe() time. Drop
the check.

The PHY_LANE_NUM and CSI_LANE_MODE registers are programmed with a value
equal to the number of lanes minus one. Compute it instead of handling
it in the switch/case.

Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
Reviewed-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>
17 months agomedia: i2c: imx290: Configure data lanes at start time
Laurent Pinchart [Mon, 16 Jan 2023 14:44:52 +0000 (15:44 +0100)]
media: i2c: imx290: Configure data lanes at start time

There's no need to configure the data lanes in the runtime PM resume
handler. Do so in imx290_start_streaming() instead.

Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
Reviewed-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>
17 months agomedia: i2c: imx290: Initialize runtime PM before subdev
Laurent Pinchart [Mon, 16 Jan 2023 14:44:51 +0000 (15:44 +0100)]
media: i2c: imx290: Initialize runtime PM before subdev

Initializing the subdev before runtime PM means that no subdev
initialization can interact with the runtime PM framework. This can be
problematic when modifying controls, as the .s_ctrl() handler commonly
calls pm_runtime_get_if_in_use(). These code paths are not trivial,
making the driver fragile and possibly causing subtle bugs.

To make the subdev initialization more robust, initialize runtime PM
first.

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>
17 months agomedia: i2c: imx290: Use runtime PM autosuspend
Laurent Pinchart [Mon, 16 Jan 2023 14:44:50 +0000 (15:44 +0100)]
media: i2c: imx290: Use runtime PM autosuspend

Use runtime PM autosuspend to avoid powering off the sensor during fast
stop-reconfigure-restart cycles. This also fixes runtime PM handling in
the probe function that didn't suspend the device, effectively leaving
it resumed forever.

While at it, improve documentation of power management in probe() and
remove().

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>
17 months agomedia: i2c: imx290: Rename, extend and expand usage of imx290_pixfmt
Laurent Pinchart [Mon, 17 Oct 2022 10:44:27 +0000 (12:44 +0200)]
media: i2c: imx290: Rename, extend and expand usage of imx290_pixfmt

The imx290_pixfmt structure contains information about formats,
currently limited to the bpp value. Extend it with the register settings
for each format, and rename it to imx290_format_info to make its purpose
clearer. Add a function named imx290_format_info() to look up format
info for a media bus code, and use it through the code. This allows
dropping the imx290 bpp field as the value is now looked up dynamically.

The error handling in imx290_setup_format() can also be dropped, as the
format is guaranteed by imx290_set_fmt() to be valid.

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>
17 months agomedia: i2c: imx290: Use V4L2 subdev active state
Laurent Pinchart [Mon, 17 Oct 2022 10:44:27 +0000 (12:44 +0200)]
media: i2c: imx290: Use V4L2 subdev active state

Use the V4L2 subdev active state API to store the active format. This
simplifies the driver not only by dropping the imx290 current_format
field, but it also allows dropping the imx290 lock, replaced with the
state lock.

The lock check in imx290_ctrl_update() can be dropped as
imx290_set_fmt() can't be called anywmore with which set to ACTIVE
before controls are initialized.

Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
Reviewed-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>
17 months agomedia: i2c: imx290: Factor out clock initialization to separate function
Laurent Pinchart [Mon, 16 Jan 2023 14:44:47 +0000 (15:44 +0100)]
media: i2c: imx290: Factor out clock initialization to separate function

Move the external clock initialization code from probe() to a separate
function to improve readability. No functional change intended.

Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
Reviewed-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>
17 months agomedia: i2c: imx290: Use dev_err_probe()
Laurent Pinchart [Mon, 16 Jan 2023 14:44:46 +0000 (15:44 +0100)]
media: i2c: imx290: Use dev_err_probe()

Improve error handling in the probe() function with dev_err_probe().

Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
Reviewed-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>
17 months agomedia: i2c: imx290: Factor out DT parsing to separate function
Laurent Pinchart [Mon, 16 Jan 2023 14:44:45 +0000 (15:44 +0100)]
media: i2c: imx290: Factor out DT parsing to separate function

Make the probe() function more readable by factoring out the DT parsing
code to a separate function. No functional change intended.

Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
Reviewed-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>
17 months agomedia: i2c: imx290: Factor out black level setting to a function
Laurent Pinchart [Mon, 16 Jan 2023 14:44:44 +0000 (15:44 +0100)]
media: i2c: imx290: Factor out black level setting to a function

The black level programmed in the BLKLEVEL register depends on the
output format. The black level value computation is currently performed
in imx290_set_ctrl(), in addition to having different black level values
in the output-specific register value tables. Move it to a separate
function to simplify the imx290_set_ctrl() code.

Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
Reviewed-by: Alexander Stein <alexander.stein@ew.tq-group.com>
Reviewed-by: Dave Stevenson <dave.stevenson@raspberrypi.com>
Signed-off-by: Sakari Ailus <sakari.ailus@linux.intel.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab@kernel.org>
17 months agomedia: i2c: imx290: Compute pixel rate and blanking in one place
Laurent Pinchart [Mon, 16 Jan 2023 14:44:43 +0000 (15:44 +0100)]
media: i2c: imx290: Compute pixel rate and blanking in one place

The hblank, vblank, pixel rate and link frequency values and limits are
currently computed when creating controls, in imx290_ctrl_init(), and
updated in imx290_ctrl_update(). This duplicates the logic in different
places. Simplify the code by setting the control values and limits to
hardcoded values when creating the controls, and call
imx290_ctrl_update() to then update them.

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>
17 months agomedia: i2c: imx290: Pass format and mode to imx290_calc_pixel_rate()
Laurent Pinchart [Mon, 16 Jan 2023 14:44:42 +0000 (15:44 +0100)]
media: i2c: imx290: Pass format and mode to imx290_calc_pixel_rate()

Avoid accessing the imx290 current_format and current_mode fields in
imx290_calc_pixel_rate() to prepare for the removal of those fields.
Among the two callers of the function, imx290_ctrl_update() has an
explicit mode pointer already, and we can also give it a format pointer.
Use those explicitly.

While at it, inline the imx290_get_link_freq() function in
imx290_calc_pixel_rate() as it is only called there.

Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
Reviewed-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>
17 months agomedia: i2c: imx290: Access link_freq_index directly
Laurent Pinchart [Mon, 16 Jan 2023 14:44:41 +0000 (15:44 +0100)]
media: i2c: imx290: Access link_freq_index directly

The imx290_get_link_freq_index() function hides the fact that it relies
on the imx290 current_mode field, which obfuscates the code instead of
making it more readable. Inline it in the callers, and use the mode
pointer we already have in imx290_ctrl_update() instead of using the
current_mode field.

Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
Reviewed-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>
17 months agomedia: i2c: imx290: Factor out control update code to a function
Laurent Pinchart [Mon, 16 Jan 2023 14:44:40 +0000 (15:44 +0100)]
media: i2c: imx290: Factor out control update code to a function

Move the control update code to a separate function to group it with all
the control-related code and make imx290_set_fmt() more readable.

Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
Reviewed-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>
17 months agomedia: i2c: imx290: Factor out subdev init and cleanup to functions
Laurent Pinchart [Mon, 16 Jan 2023 14:44:39 +0000 (15:44 +0100)]
media: i2c: imx290: Factor out subdev init and cleanup to functions

The probe() function is large. Make it more readable by factoring the
subdev initialization code out. While at it, rename the error labels as
the "free_" prefix isn't accurate.

No functional change intended.

Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
Reviewed-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>
17 months agomedia: i2c: imx290: Group functions in sections
Laurent Pinchart [Mon, 16 Jan 2023 14:44:38 +0000 (15:44 +0100)]
media: i2c: imx290: Group functions in sections

Move functions around to group them in logical sections, in order to
improve readability. As a result, the IMX290_NUM_SUPPLIES macro has to
be changed. No other code change is included, only moves.

Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
Reviewed-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>
17 months agomedia: ov5640: set correct default format for CSI-2 mode
Guoniu.zhou [Mon, 12 Dec 2022 04:05:26 +0000 (05:05 +0100)]
media: ov5640: set correct default format for CSI-2 mode

In commit a89f14bbcfa5 ("media: ov5640: Split DVP and CSI-2 formats"),
it splits format list for DVP and CSI-2 mode, but the default format
defined in commit 90b0f355c5a3 ("media: ov5640: Implement init_cfg")
is only supported by DVP mode, so define a new default format for
CSI-2 mode.

Signed-off-by: Guoniu.zhou <guoniu.zhou@nxp.com>
Reviewed-by: Jai Luthra <j-luthra@ti.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>
17 months agomedia: i2c: imx219: Support four-lane operation
Adam Ford [Tue, 20 Dec 2022 12:07:54 +0000 (13:07 +0100)]
media: i2c: imx219: Support four-lane operation

The imx219 camera is capable of either two-lane or four-lane
operation.  When operating in four-lane, both the pixel rate and
link frequency change. Regardless of the mode, however, both
frequencies remain fixed.

Helper functions are needed to read and set pixel and link frequencies
which also reduces the number of fixed registers in the table of modes.

Signed-off-by: Adam Ford <aford173@gmail.com>
Signed-off-by: Sakari Ailus <sakari.ailus@linux.intel.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab@kernel.org>
17 months agomedia: i2c: imx219: Split common registers from mode tables
Adam Ford [Tue, 20 Dec 2022 12:07:53 +0000 (13:07 +0100)]
media: i2c: imx219: Split common registers from mode tables

There are four modes, and each mode has a table of registers.
Some of the registers are common to all modes, so create new
tables for these common registers to reduce duplicate code.

Signed-off-by: Adam Ford <aford173@gmail.com>
Reviewed-by: Dave Stevenson <dave.stevenson@raspberrypi.com>
Signed-off-by: Sakari Ailus <sakari.ailus@linux.intel.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab@kernel.org>
17 months agomedia: i2c: tc358746: fix possible endianness issue
Marco Felsch [Fri, 16 Dec 2022 10:35:45 +0000 (11:35 +0100)]
media: i2c: tc358746: fix possible endianness issue

Using the u64 v4l2_dbg_register.val directly can lead to unexpected
results depending on machine endianness. Fix this by using a local
variable which is assigned afterwards. Since tc358746_read() will init
the val variable to 0 we can assing it without checking the return value
first.

Addresses-Coverity-ID: 1527256 ("Integer handling issues")

Reported-by: coverity-bot <keescook+coverity-bot@chromium.org>
Fixes: 80a21da36051 ("media: tc358746: add Toshiba TC358746 Parallel to CSI-2 bridge driver")
Signed-off-by: Marco Felsch <m.felsch@pengutronix.de>
Signed-off-by: Sakari Ailus <sakari.ailus@linux.intel.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab@kernel.org>
17 months agomedia: i2c: tc358746: fix ignoring read error in g_register callback
Marco Felsch [Fri, 16 Dec 2022 10:35:44 +0000 (11:35 +0100)]
media: i2c: tc358746: fix ignoring read error in g_register callback

Currently we ignore the return value of tc358746_read() and return
alawys return 0 which is wrong. Fix this by returning the actual return
value of the read operation which is either 0 on success or an error
value.

Addresses-Coverity-ID: 1527254 ("Error handling issues")

Reported-by: coverity-bot <keescook+coverity-bot@chromium.org>
Fixes: 80a21da36051 ("media: tc358746: add Toshiba TC358746 Parallel to CSI-2 bridge driver")
Signed-off-by: Marco Felsch <m.felsch@pengutronix.de>
Signed-off-by: Sakari Ailus <sakari.ailus@linux.intel.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab@kernel.org>
17 months agomedia: i2c: tc358746: fix missing return assignment
Marco Felsch [Fri, 16 Dec 2022 10:35:43 +0000 (11:35 +0100)]
media: i2c: tc358746: fix missing return assignment

It was intended to return an error if tc358746_update_bits() call fail.
Fix this by storing the return code.

Addresses-Coverity-ID: 1527252 ("Control flow issues")

Reported-by: coverity-bot <keescook+coverity-bot@chromium.org>
Fixes: 80a21da36051 ("media: tc358746: add Toshiba TC358746 Parallel to CSI-2 bridge driver")
Signed-off-by: Marco Felsch <m.felsch@pengutronix.de>
Signed-off-by: Sakari Ailus <sakari.ailus@linux.intel.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab@kernel.org>
17 months agomedia: ov5675: Fix memleak in ov5675_init_controls()
Shang XiaoJing [Thu, 8 Dec 2022 07:59:38 +0000 (08:59 +0100)]
media: ov5675: Fix memleak in ov5675_init_controls()

There is a kmemleak when testing the media/i2c/ov5675.c with bpf mock
device:

AssertionError: unreferenced object 0xffff888107362160 (size 16):
  comm "python3", pid 277, jiffies 4294832798 (age 20.722s)
  hex dump (first 16 bytes):
    00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00  ................
  backtrace:
    [<00000000abe7d67c>] __kmalloc_node+0x44/0x1b0
    [<000000008a725aac>] kvmalloc_node+0x34/0x180
    [<000000009a53cd11>] v4l2_ctrl_handler_init_class+0x11d/0x180
[videodev]
    [<0000000055b46db0>] ov5675_probe+0x38b/0x897 [ov5675]
    [<00000000153d886c>] i2c_device_probe+0x28d/0x680
    [<000000004afb7e8f>] really_probe+0x17c/0x3f0
    [<00000000ff2f18e4>] __driver_probe_device+0xe3/0x170
    [<000000000a001029>] driver_probe_device+0x49/0x120
    [<00000000e39743c7>] __device_attach_driver+0xf7/0x150
    [<00000000d32fd070>] bus_for_each_drv+0x114/0x180
    [<000000009083ac41>] __device_attach+0x1e5/0x2d0
    [<0000000015b4a830>] bus_probe_device+0x126/0x140
    [<000000007813deaf>] device_add+0x810/0x1130
    [<000000007becb867>] i2c_new_client_device+0x386/0x540
    [<000000007f9cf4b4>] of_i2c_register_device+0xf1/0x110
    [<00000000ebfdd032>] of_i2c_notify+0xfc/0x1f0

ov5675_init_controls() won't clean all the allocated resources in fail
path, which may causes the memleaks. Add v4l2_ctrl_handler_free() to
prevent memleak.

Fixes: bf27502b1f3b ("media: ov5675: Add support for OV5675 sensor")
Signed-off-by: Shang XiaoJing <shangxiaojing@huawei.com>
Signed-off-by: Sakari Ailus <sakari.ailus@linux.intel.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab@kernel.org>
17 months agomedia: ov2740: Fix memleak in ov2740_init_controls()
Shang XiaoJing [Thu, 8 Dec 2022 07:59:37 +0000 (08:59 +0100)]
media: ov2740: Fix memleak in ov2740_init_controls()

There is a kmemleak when testing the media/i2c/ov2740.c with bpf mock
device:

unreferenced object 0xffff8881090e19e0 (size 16):
  comm "51-i2c-ov2740", pid 278, jiffies 4294781584 (age 23.613s)
  hex dump (first 16 bytes):
    00 f3 7c 0b 81 88 ff ff 80 75 6a 09 81 88 ff ff  ..|......uj.....
  backtrace:
    [<000000004e9fad8f>] __kmalloc_node+0x44/0x1b0
    [<0000000039c802f4>] kvmalloc_node+0x34/0x180
    [<000000009b8b5c63>] v4l2_ctrl_handler_init_class+0x11d/0x180
[videodev]
    [<0000000038644056>] ov2740_probe+0x37d/0x84f [ov2740]
    [<0000000092489f59>] i2c_device_probe+0x28d/0x680
    [<000000001038babe>] really_probe+0x17c/0x3f0
    [<0000000098c7af1c>] __driver_probe_device+0xe3/0x170
    [<00000000e1b3dc24>] device_driver_attach+0x34/0x80
    [<000000005a04a34d>] bind_store+0x10b/0x1a0
    [<00000000ce25d4f2>] drv_attr_store+0x49/0x70
    [<000000007d9f4e9a>] sysfs_kf_write+0x8c/0xb0
    [<00000000be6cff0f>] kernfs_fop_write_iter+0x216/0x2e0
    [<0000000031ddb40a>] vfs_write+0x658/0x810
    [<0000000041beecdd>] ksys_write+0xd6/0x1b0
    [<0000000023755840>] do_syscall_64+0x38/0x90
    [<00000000b2cc2da2>] entry_SYSCALL_64_after_hwframe+0x63/0xcd

ov2740_init_controls() won't clean all the allocated resources in fail
path, which may causes the memleaks. Add v4l2_ctrl_handler_free() to
prevent memleak.

Fixes: 866edc895171 ("media: i2c: Add ov2740 image sensor driver")
Signed-off-by: Shang XiaoJing <shangxiaojing@huawei.com>
Signed-off-by: Sakari Ailus <sakari.ailus@linux.intel.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab@kernel.org>
17 months agomedia: max9286: Fix memleak in max9286_v4l2_register()
Shang XiaoJing [Tue, 6 Dec 2022 13:05:55 +0000 (14:05 +0100)]
media: max9286: Fix memleak in max9286_v4l2_register()

There is a kmemleak when testing the media/i2c/max9286.c with bpf mock
device:

kmemleak: 5 new suspected memory leaks (see /sys/kernel/debug/kmemleak)

unreferenced object 0xffff88810defc400 (size 256):
  comm "python3", pid 278, jiffies 4294737563 (age 31.978s)
  hex dump (first 32 bytes):
    28 06 a7 0a 81 88 ff ff 00 fe 22 12 81 88 ff ff  (.........".....
    10 c4 ef 0d 81 88 ff ff 10 c4 ef 0d 81 88 ff ff  ................
  backtrace:
    [<00000000191de6a7>] __kmalloc_node+0x44/0x1b0
    [<000000002f4912b7>] kvmalloc_node+0x34/0x180
    [<0000000057dc4cae>] v4l2_ctrl_new+0x325/0x10f0 [videodev]
    [<0000000026030272>] v4l2_ctrl_new_std+0x16f/0x210 [videodev]
    [<00000000f0d9ea2f>] max9286_probe+0x76e/0xbff [max9286]
    [<00000000ea8f6455>] i2c_device_probe+0x28d/0x680
    [<0000000087529af3>] really_probe+0x17c/0x3f0
    [<00000000b08be526>] __driver_probe_device+0xe3/0x170
    [<000000004382edea>] driver_probe_device+0x49/0x120
    [<000000007bde528a>] __device_attach_driver+0xf7/0x150
    [<000000009f9c6ab4>] bus_for_each_drv+0x114/0x180
    [<00000000c8aaf588>] __device_attach+0x1e5/0x2d0
    [<0000000041cc06b9>] bus_probe_device+0x126/0x140
    [<000000002309860d>] device_add+0x810/0x1130
    [<000000002827bf98>] i2c_new_client_device+0x359/0x4f0
    [<00000000593bdc85>] of_i2c_register_device+0xf1/0x110

max9286_v4l2_register() calls v4l2_ctrl_new_std(), but won't free the
created v412_ctrl when fwnode_graph_get_endpoint_by_id() failed, which
causes the memleak. Call v4l2_ctrl_handler_free() to free the v412_ctrl.

Fixes: 66d8c9d2422d ("media: i2c: Add MAX9286 driver")
Signed-off-by: Shang XiaoJing <shangxiaojing@huawei.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>
17 months agomedia: tm6000: remove deprecated driver
Hans Verkuil [Tue, 10 Jan 2023 12:45:33 +0000 (13:45 +0100)]
media: tm6000: remove deprecated driver

The tm6000 driver does not use the vb2 framework for streaming
video, instead it uses the old vb1 framework and nobody stepped in to
convert this driver to vb2.

The hardware is very old, so the decision was made to remove it
altogether since we want to get rid of the old vb1 framework.

Signed-off-by: Hans Verkuil <hverkuil-cisco@xs4all.nl>
Signed-off-by: Mauro Carvalho Chehab <mchehab@kernel.org>
17 months agomedia: vpfe_capture: remove deprecated davinci drivers
Hans Verkuil [Tue, 10 Jan 2023 12:13:41 +0000 (13:13 +0100)]
media: vpfe_capture: remove deprecated davinci drivers

The vpfe_capture drivers do not use the vb2 framework for streaming
video, instead they use the old vb1 framework and nobody stepped in to
convert these drivers to vb2.

The hardware is very old, so the decision was made to remove them
altogether since we want to get rid of the old vb1 framework.

Signed-off-by: Hans Verkuil <hverkuil-cisco@xs4all.nl>
Acked-by: Lad Prabhakar <prabhakar.csengg@gmail.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab@kernel.org>
17 months agomedia: zr364xx: remove deprecated driver
Hans Verkuil [Tue, 10 Jan 2023 09:49:14 +0000 (10:49 +0100)]
media: zr364xx: remove deprecated driver

The zr364xx driver does not use the vb2 framework for streaming
video, instead it uses the old vb1 framework and nobody stepped in to
convert this driver to vb2.

The hardware is very old, so the decision was made to remove it
altogether since we want to get rid of the old vb1 framework.

Signed-off-by: Hans Verkuil <hverkuil-cisco@xs4all.nl>
Signed-off-by: Mauro Carvalho Chehab <mchehab@kernel.org>
17 months agomedia: stkwebcam: remove deprecated driver
Hans Verkuil [Tue, 10 Jan 2023 09:45:21 +0000 (10:45 +0100)]
media: stkwebcam: remove deprecated driver

The stkwebcam driver does not use the vb2 framework for streaming
video, instead it implements this in the driver. This is error prone,
and nobody stepped in to convert this driver to that framework.

The hardware is very old, so the decision was made to remove it
altogether.

Signed-off-by: Hans Verkuil <hverkuil-cisco@xs4all.nl>
Signed-off-by: Mauro Carvalho Chehab <mchehab@kernel.org>
17 months agomedia: fsl-viu: remove deprecated driver
Hans Verkuil [Tue, 10 Jan 2023 09:39:53 +0000 (10:39 +0100)]
media: fsl-viu: remove deprecated driver

The fsl-viu driver does not use the vb2 framework for streaming
video, instead it uses the old vb1 framework and nobody stepped in to
convert this driver to vb2.

The hardware is very old, so the decision was made to remove it
altogether since we want to get rid of the old vb1 framework.

Signed-off-by: Hans Verkuil <hverkuil-cisco@xs4all.nl>
Signed-off-by: Mauro Carvalho Chehab <mchehab@kernel.org>
17 months agomedia: cpia2: remove deprecated driver
Hans Verkuil [Tue, 10 Jan 2023 09:33:52 +0000 (10:33 +0100)]
media: cpia2: remove deprecated driver

The cpia2 driver does not use the vb2 framework for streaming
video, instead it implements this in the driver. This is error prone,
and nobody stepped in to convert this driver to that framework.

The hardware is very old, so the decision was made to remove it
altogether.

Signed-off-by: Hans Verkuil <hverkuil-cisco@xs4all.nl>
Signed-off-by: Mauro Carvalho Chehab <mchehab@kernel.org>
17 months agomedia: meye: remove this deprecated driver
Hans Verkuil [Tue, 10 Jan 2023 09:26:19 +0000 (10:26 +0100)]
media: meye: remove this deprecated driver

The meye driver does not use the vb2 framework for streaming
video, instead it implements this in the driver. This is error prone,
and nobody stepped in to convert this driver to that framework.

The hardware is very old, so the decision was made to remove it
altogether.

Signed-off-by: Hans Verkuil <hverkuil-cisco@xs4all.nl>
Signed-off-by: Mauro Carvalho Chehab <mchehab@kernel.org>
17 months agomedia: Documentation: Update documentation for streams
Sakari Ailus [Thu, 6 Oct 2022 11:28:53 +0000 (13:28 +0200)]
media: Documentation: Update documentation for streams

Document how streams interacts with formats and selections.

Update documentation in respect to what is allowed, in particular streams
are only supported via full routes, source-only routes are not supported
right now.

The centerpiece of the API additions are streams. Albeit routes are
configured via S_ROUTING IOCTL that also declares streams, it is streams
that are accessed through other APIs. Thus refer to streams instead of
routes in documentation.

Signed-off-by: Sakari Ailus <sakari.ailus@linux.intel.com>
Reviewed-by: Tomi Valkeinen <tomi.valkeinen@ideasonboard.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab@kernel.org>
17 months agomedia: Add stream to frame descriptor
Sakari Ailus [Thu, 28 Mar 2019 20:05:54 +0000 (21:05 +0100)]
media: Add stream to frame descriptor

The stream field identifies the stream this frame descriptor applies to in
routing configuration across a multiplexed link.

Signed-off-by: Sakari Ailus <sakari.ailus@linux.intel.com>
Reviewed-by: Niklas Söderlund <niklas.soderlund+renesas@ragnatech.se>
Reviewed-by: Jacopo Mondi <jacopo+renesas@jmondi.org>
Signed-off-by: Tomi Valkeinen <tomi.valkeinen@ideasonboard.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab@kernel.org>
17 months agomedia: v4l2-subdev: Add v4l2_subdev_s_stream_helper() function
Laurent Pinchart [Tue, 18 Jan 2022 00:16:14 +0000 (01:16 +0100)]
media: v4l2-subdev: Add v4l2_subdev_s_stream_helper() function

The v4l2_subdev_s_stream_helper() helper can be used by subdevs that
implement the stream-aware .enable_streams() and .disable_streams()
operations to implement .s_stream(). This is limited to subdevs that
have a single source pad.

Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
Signed-off-by: Tomi Valkeinen <tomi.valkeinen@ideasonboard.com>
Reviewed-by: Jacopo Mondi <jacopo@jmondi.org>
Signed-off-by: Mauro Carvalho Chehab <mchehab@kernel.org>
17 months agomedia: v4l2-subdev: Add subdev .(enable|disable)_streams() operations
Laurent Pinchart [Mon, 13 Dec 2021 14:11:56 +0000 (15:11 +0100)]
media: v4l2-subdev: Add subdev .(enable|disable)_streams() operations

Add two new subdev pad operations, .enable_streams() and
.disable_streams(), to allow control of individual streams per pad. This
is a superset of what the video .s_stream() operation implements.

To help with handling of backward compatibility, add two wrapper
functions around those operations, and require their usage in drivers.

Signed-off-by: Tomi Valkeinen <tomi.valkeinen@ideasonboard.com>
Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
Reviewed-by: Jacopo Mondi <jacopo@jmondi.org>
Signed-off-by: Mauro Carvalho Chehab <mchehab@kernel.org>
17 months agomedia: v4l2-subdev: Add v4l2_subdev_state_xlate_streams() helper
Laurent Pinchart [Mon, 17 Jan 2022 23:51:23 +0000 (00:51 +0100)]
media: v4l2-subdev: Add v4l2_subdev_state_xlate_streams() helper

Add a helper function to translate streams between two pads of a subdev,
using the subdev's internal routing table.

Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
Signed-off-by: Tomi Valkeinen <tomi.valkeinen@ideasonboard.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab@kernel.org>
17 months agomedia: subdev: add v4l2_subdev_routing_validate() helper
Laurent Pinchart [Tue, 21 Dec 2021 10:23:58 +0000 (11:23 +0100)]
media: subdev: add v4l2_subdev_routing_validate() helper

Add a v4l2_subdev_routing_validate() helper for verifying routing for
common cases like only allowing non-overlapping 1-to-1 streams.

Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
Signed-off-by: Tomi Valkeinen <tomi.valkeinen@ideasonboard.com>
Reviewed-by: Jacopo Mondi <jacopo@jmondi.org>
Signed-off-by: Mauro Carvalho Chehab <mchehab@kernel.org>
17 months agomedia: subdev: add v4l2_subdev_set_routing_with_fmt() helper
Tomi Valkeinen [Wed, 25 Aug 2021 10:24:09 +0000 (12:24 +0200)]
media: subdev: add v4l2_subdev_set_routing_with_fmt() helper

v4l2_subdev_set_routing_with_fmt() is the same as
v4l2_subdev_set_routing(), but additionally initializes all the streams
with the given format.

Signed-off-by: Tomi Valkeinen <tomi.valkeinen@ideasonboard.com>
Reviewed-by: Hans Verkuil <hverkuil-cisco@xs4all.nl>
Reviewed-by: Jacopo Mondi <jacopo@jmondi.org>
Signed-off-by: Mauro Carvalho Chehab <mchehab@kernel.org>
17 months agomedia: subdev: add streams to v4l2_subdev_get_fmt() helper function
Tomi Valkeinen [Tue, 21 Dec 2021 10:23:13 +0000 (11:23 +0100)]
media: subdev: add streams to v4l2_subdev_get_fmt() helper function

Add streams support to v4l2_subdev_get_fmt() helper function. Subdev
drivers that do not need to do anything special in their get_fmt op can
use this helper directly for v4l2_subdev_pad_ops.get_fmt.

Signed-off-by: Tomi Valkeinen <tomi.valkeinen@ideasonboard.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab@kernel.org>
17 months agomedia: subdev: add "opposite" stream helper funcs
Tomi Valkeinen [Tue, 21 Dec 2021 10:22:06 +0000 (11:22 +0100)]
media: subdev: add "opposite" stream helper funcs

Add two helper functions to make dealing with streams easier:

v4l2_subdev_routing_find_opposite_end - given a routing table and a pad
+ stream, return the pad + stream on the opposite side of the subdev.

v4l2_subdev_state_get_opposite_stream_format - return a pointer to the
format on the pad + stream on the opposite side from the given pad +
stream.

Signed-off-by: Tomi Valkeinen <tomi.valkeinen@ideasonboard.com>
Reviewed-by: Hans Verkuil <hverkuil-cisco@xs4all.nl>
Reviewed-by: Jacopo Mondi <jacopo@jmondi.org>
Signed-off-by: Mauro Carvalho Chehab <mchehab@kernel.org>
17 months agomedia: subdev: use streams in v4l2_subdev_link_validate()
Tomi Valkeinen [Thu, 15 Jul 2021 13:40:37 +0000 (15:40 +0200)]
media: subdev: use streams in v4l2_subdev_link_validate()

Update v4l2_subdev_link_validate() to use routing and streams for
validation.

Instead of just looking at the format on the pad on both ends of the
link, the routing tables are used to collect all the streams going from
the source to the sink over the link, and the streams' formats on both
ends of the link are verified.

Signed-off-by: Tomi Valkeinen <tomi.valkeinen@ideasonboard.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab@kernel.org>
17 months agomedia: subdev: add stream based configuration
Tomi Valkeinen [Tue, 21 Dec 2021 10:20:53 +0000 (11:20 +0100)]
media: subdev: add stream based configuration

Add support to manage configurations (format, crop, compose) per stream,
instead of per pad. This is accomplished with data structures that hold
an array of all subdev's stream configurations.

The number of streams can vary at runtime based on routing. Every time
the routing is changed, the stream configurations need to be
re-initialized.

Signed-off-by: Tomi Valkeinen <tomi.valkeinen@ideasonboard.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab@kernel.org>
17 months agomedia: Documentation: add multiplexed streams documentation
Tomi Valkeinen [Mon, 30 Aug 2021 09:50:59 +0000 (11:50 +0200)]
media: Documentation: add multiplexed streams documentation

Add documentation related to multiplexed streams.

Signed-off-by: Tomi Valkeinen <tomi.valkeinen@ideasonboard.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab@kernel.org>
17 months agomedia: subdev: Add for_each_active_route() macro
Jacopo Mondi [Sun, 17 Oct 2021 18:24:42 +0000 (20:24 +0200)]
media: subdev: Add for_each_active_route() macro

Add a for_each_active_route() macro to replace the repeated pattern
of iterating on the active routes of a routing table.

Signed-off-by: Jacopo Mondi <jacopo+renesas@jmondi.org>
Signed-off-by: Tomi Valkeinen <tomi.valkeinen@ideasonboard.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab@kernel.org>
17 months agomedia: subdev: add v4l2_subdev_set_routing helper()
Tomi Valkeinen [Tue, 21 Dec 2021 10:18:43 +0000 (11:18 +0100)]
media: subdev: add v4l2_subdev_set_routing helper()

Add a helper function to set the subdev routing. The helper can be used
from subdev driver's set_routing op to store the routing table.

Signed-off-by: Tomi Valkeinen <tomi.valkeinen@ideasonboard.com>
Reviewed-by: Hans Verkuil <hverkuil-cisco@xs4all.nl>
Signed-off-by: Mauro Carvalho Chehab <mchehab@kernel.org>
17 months agomedia: subdev: add v4l2_subdev_has_pad_interdep()
Tomi Valkeinen [Thu, 15 Jul 2021 13:39:19 +0000 (15:39 +0200)]
media: subdev: add v4l2_subdev_has_pad_interdep()

Add a v4l2_subdev_has_pad_interdep() helper function which can be used
for media_entity_operations.has_pad_interdep op.

It considers two pads interdependent if there is an active route between
pad0 and pad1.

Signed-off-by: Tomi Valkeinen <tomi.valkeinen@ideasonboard.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab@kernel.org>
17 months agomedia: subdev: Require code change to enable [GS]_ROUTING
Tomi Valkeinen [Sun, 15 Jan 2023 12:40:08 +0000 (13:40 +0100)]
media: subdev: Require code change to enable [GS]_ROUTING

The Streams API is an experimental feature. To use the Streams API, the
user needs to change a variable in v4l2-subdev.c and recompile the kernel.

This commit should be reverted when the Streams API is deemed ready for
production use.

Signed-off-by: Tomi Valkeinen <tomi.valkeinen@ideasonboard.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>
17 months agomedia: subdev: Add [GS]_ROUTING subdev ioctls and operations
Laurent Pinchart [Fri, 23 Apr 2021 07:15:54 +0000 (09:15 +0200)]
media: subdev: Add [GS]_ROUTING subdev ioctls and operations

Add support for subdev internal routing. A route is defined as a single
stream from a sink pad to a source pad.

The userspace can configure the routing via two new ioctls,
VIDIOC_SUBDEV_G_ROUTING and VIDIOC_SUBDEV_S_ROUTING, and subdevs can
implement the functionality with v4l2_subdev_pad_ops.set_routing().

- Add sink and source streams for multiplexed links
- Copy the argument back in case of an error. This is needed to let the
  caller know the number of routes.
- Expand and refine documentation.
- Make the 'routes' pointer a __u64 __user pointer so that a compat32
  version of the ioctl is not required.
- Add struct v4l2_subdev_krouting to be used for subdevice operations.
- Fix typecasing warnings
- Check sink & source pad types
- Add 'which' field
- Routing to subdev state
- Dropped get_routing subdev op

Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
Signed-off-by: Michal Simek <michal.simek@xilinx.com>
Signed-off-by: Sakari Ailus <sakari.ailus@linux.intel.com>
Signed-off-by: Jacopo Mondi <jacopo+renesas@jmondi.org>
Signed-off-by: Tomi Valkeinen <tomi.valkeinen@ideasonboard.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab@kernel.org>
17 months agomedia: Documentation: Add GS_ROUTING documentation
Jacopo Mondi [Thu, 28 Mar 2019 20:05:56 +0000 (21:05 +0100)]
media: Documentation: Add GS_ROUTING documentation

Add documentation for VIDIOC_SUBDEV_G/S_ROUTING ioctl and add
description of multiplexed media pads and internal routing to the
V4L2-subdev documentation section.

Signed-off-by: Jacopo Mondi <jacopo+renesas@jmondi.org>
Signed-off-by: Tomi Valkeinen <tomi.valkeinen@ideasonboard.com>
Reviewed-by: Hans Verkuil <hverkuil-cisco@xs4all.nl>
Signed-off-by: Mauro Carvalho Chehab <mchehab@kernel.org>
17 months agomedia: add V4L2_SUBDEV_CAP_STREAMS
Tomi Valkeinen [Mon, 22 Nov 2021 15:18:23 +0000 (16:18 +0100)]
media: add V4L2_SUBDEV_CAP_STREAMS

Add a subdev capability flag to expose to userspace if a subdev supports
multiplexed streams.

Signed-off-by: Tomi Valkeinen <tomi.valkeinen@ideasonboard.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab@kernel.org>
17 months agomedia: add V4L2_SUBDEV_FL_STREAMS
Tomi Valkeinen [Thu, 29 Jul 2021 13:02:04 +0000 (15:02 +0200)]
media: add V4L2_SUBDEV_FL_STREAMS

Add subdev flag V4L2_SUBDEV_FL_STREAMS. It is used to indicate that the
subdev supports the new API with multiplexed streams (routing, stream
configs).

Signed-off-by: Tomi Valkeinen <tomi.valkeinen@ideasonboard.com>
Reviewed-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab@kernel.org>
17 months agomedia: v4l2-subdev: Sort includes
Tomi Valkeinen [Mon, 26 Sep 2022 05:51:45 +0000 (07:51 +0200)]
media: v4l2-subdev: Sort includes

Sort the includes alphabetically.

Signed-off-by: Tomi Valkeinen <tomi.valkeinen@ideasonboard.com>
Reviewed-by: Laurent Pinchart <laurent.pinchart+renesas@ideasonboard.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab@kernel.org>
17 months agomedia: imx: imx7-media-csi: fix missing clk_disable_unprepare() in imx7_csi_init()
Yang Yingliang [Wed, 4 Jan 2023 09:39:21 +0000 (10:39 +0100)]
media: imx: imx7-media-csi: fix missing clk_disable_unprepare() in imx7_csi_init()

Add missing clk_disable_unprepare(), if imx7_csi_dma_setup() fails
in imx7_csi_init().

Fixes: ff43ca911978 ("media: imx: imx7-media-csi: Move CSI configuration before source start")
Signed-off-by: Yang Yingliang <yangyingliang@huawei.com>
Reviewed-by: Rui Miguel Silva <rmfrfs@gmail.com>
Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab@kernel.org>
17 months agomedia: platform: ti: Add missing check for devm_regulator_get
Jiasheng Jiang [Wed, 4 Jan 2023 08:55:37 +0000 (09:55 +0100)]
media: platform: ti: Add missing check for devm_regulator_get

Add check for the return value of devm_regulator_get since it may return
error pointer.

Fixes: 448de7e7850b ("[media] omap3isp: OMAP3 ISP core")
Signed-off-by: Jiasheng Jiang <jiasheng@iscas.ac.cn>
Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab@kernel.org>
17 months agomedia: dw100: Add a missing unwind goto in dw100_probe()
Xavier Roumegue [Tue, 3 Jan 2023 10:55:34 +0000 (11:55 +0100)]
media: dw100: Add a missing unwind goto in dw100_probe()

In case the IRQ allocation returns an error in dw100_probe(), the pm
runtime is not disabled before to return.

Add the missing unwind goto on the error handling path of the IRQ
allocation request.

Reported-by: kernel test robot <lkp@intel.com>
Reported-by: Dan Carpenter <error27@gmail.com>
Signed-off-by: Xavier Roumegue <xavier.roumegue@oss.nxp.com>
Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab@kernel.org>
17 months agomedia: dt-bindings: media: imx7-csi: Document i.MX8M power-domains property
Marek Vasut [Wed, 2 Nov 2022 19:19:10 +0000 (20:19 +0100)]
media: dt-bindings: media: imx7-csi: Document i.MX8M power-domains property

The power-domains property is mandatory on i.MX8M Quad and Mini.
Document the property and mark it as required on the aforementioned
variants of the IP, present in those SoCs.

Signed-off-by: Marek Vasut <marex@denx.de>
Acked-by: Alexander Stein <alexander.stein@ew.tq-group.com>
Acked-by: Krzysztof Kozlowski <krzysztof.kozlowski@linaro.org>
Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab@kernel.org>
17 months agomedia: mc: entity: Fix doc for media_graph_walk_init
Miaoqian Lin [Sat, 17 Dec 2022 14:31:13 +0000 (15:31 +0100)]
media: mc: entity: Fix doc for media_graph_walk_init

There is no media_graph_walk_free(). media_graph_walk_cleanup() is used
to release the resources.

Signed-off-by: Miaoqian Lin <linmq006@gmail.com>
Signed-off-by: Laurent Pinchart <laurent.pinchart+renesas@ideasonboard.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab@kernel.org>
17 months agomedia: mc: Improve the media_entity_has_pad_interdep() documentation
Laurent Pinchart [Fri, 14 Jan 2022 00:26:26 +0000 (01:26 +0100)]
media: mc: Improve the media_entity_has_pad_interdep() documentation

Document the function parameters, the requirements on the pad0 and pad1
arguments, the locking requirements and the return value. Also improve
the documentation of the corresponding .has_pad_interdep() operation,
stating clearly that the operation must be called through the
media_entity_has_pad_interdep() function only.

Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
Reviewed-by: Tomi Valkeinen <tomi.valkeinen@ideasonboard.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab@kernel.org>
17 months agomedia: ti: cal: fix possible memory leak in cal_ctx_create()
Gaosheng Cui [Tue, 29 Nov 2022 11:01:59 +0000 (12:01 +0100)]
media: ti: cal: fix possible memory leak in cal_ctx_create()

The memory of ctx is allocated in cal_ctx_create(), but it will
not be freed when cal_ctx_v4l2_init() fails, so add kfree() when
cal_ctx_v4l2_init() fails to fix it.

Fixes: d68a94e98a89 ("media: ti-vpe: cal: Split video device initialization and registration")
Signed-off-by: Gaosheng Cui <cuigaosheng1@huawei.com>
Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab@kernel.org>
17 months agomedia: i2c: max9286: Print power-up GMSL link configuration
Laurent Pinchart [Sat, 1 Jan 2022 23:26:37 +0000 (00:26 +0100)]
media: i2c: max9286: Print power-up GMSL link configuration

The power-up GMSL link configuration is controlled by the HIM and BWS
pins, whose state is reflected in register 0x1c. Print the detected
power-up config in a debug message to help debugging.

Signed-off-by: Laurent Pinchart <laurent.pinchart+renesas@ideasonboard.com>
Reviewed-by: Jacopo Mondi <jacopo+renesas@jmondi.org>
Signed-off-by: Mauro Carvalho Chehab <mchehab@kernel.org>
17 months agomedia: i2c: max9286: Select HS as data enable signal
Laurent Pinchart [Sat, 1 Jan 2022 18:28:06 +0000 (19:28 +0100)]
media: i2c: max9286: Select HS as data enable signal

GMSL can transport three synchronization signals: VSync, HSync and Data
Enable. The MAX9286 can select either HS or DE as a line valid signal.

Not all serializers (and transmission formats) support the DE signal.
The MAX9271, used by the RDACM20 and RDACM21 cameras, doesn't document
DE support. Nonetheless, the max9286 driver selects the DE signal as
line valid in register 0x0c (by not setting the DESEL bit). It's not
clear why this works. As HS is a more common line valid qualifier, set
the DESEL bit by default. This is needed to support the onsemi MARS
cameras.

If a camera requires usage of the DE signal in the future, this will
need to be made configurable.

Signed-off-by: Laurent Pinchart <laurent.pinchart+renesas@ideasonboard.com>
Tested-by: Jacopo Mondi <jacopo@jmondi.org> # On Eagle V3M with RDACM20
Reviewed-by: Jacopo Mondi <jacopo+renesas@jmondi.org>
Signed-off-by: Mauro Carvalho Chehab <mchehab@kernel.org>
17 months agomedia: i2c: max9286: Configure bus width from device tree
Laurent Pinchart [Sat, 1 Jan 2022 18:28:05 +0000 (19:28 +0100)]
media: i2c: max9286: Configure bus width from device tree

The GMSL serial data bus width is normally selected through the BWS pin.
On some systems, the pin may not be wired to the correct value. Support
overriding the bus width by software, using the value specified in the
device tree.

Signed-off-by: Laurent Pinchart <laurent.pinchart+renesas@ideasonboard.com>
Reviewed-by: Jacopo Mondi <jacopo+renesas@jmondi.org>
Signed-off-by: Mauro Carvalho Chehab <mchehab@kernel.org>
17 months agomedia: i2c: max9286: Configure remote I2C speed from device tree
Laurent Pinchart [Sat, 1 Jan 2022 18:28:04 +0000 (19:28 +0100)]
media: i2c: max9286: Configure remote I2C speed from device tree

Read the maxim,i2c-clock-frequency DT property that specifies the speed
of the remote I2C bus, and configure the MAX9286 accordingly. The remote
serializers must all have a matching configuration.

Signed-off-by: Laurent Pinchart <laurent.pinchart+renesas@ideasonboard.com>
Reviewed-by: Jacopo Mondi <jacopo.mondi@ideasonboard.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab@kernel.org>
17 months agomedia: i2c: max9286: Define macros for all bits of register 0x15
Laurent Pinchart [Sat, 1 Jan 2022 18:28:03 +0000 (19:28 +0100)]
media: i2c: max9286: Define macros for all bits of register 0x15

Macros are easier to read than numerical values.

Signed-off-by: Laurent Pinchart <laurent.pinchart+renesas@ideasonboard.com>
Reviewed-by: Jacopo Mondi <jacopo+renesas@jmondi.org>
Signed-off-by: Mauro Carvalho Chehab <mchehab@kernel.org>
17 months agomedia: i2c: max9286: Support 12-bit raw bayer formats
Laurent Pinchart [Sat, 1 Jan 2022 18:28:02 +0000 (19:28 +0100)]
media: i2c: max9286: Support 12-bit raw bayer formats

Add support for 12-bit raw bayer formats to the driver, configuring the
GMSL format accordingly.

Signed-off-by: Laurent Pinchart <laurent.pinchart+renesas@ideasonboard.com>
Reviewed-by: Jacopo Mondi <jacopo.mondi@ideasonboard.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab@kernel.org>
17 months agomedia: i2c: max9286: Rename MAX9286_DATATYPE_RAW11 to RAW12
Laurent Pinchart [Sat, 1 Jan 2022 18:28:01 +0000 (19:28 +0100)]
media: i2c: max9286: Rename MAX9286_DATATYPE_RAW11 to RAW12

The MAX9286_DATATYPE_RAW11 value is used to configure the MAX9286 for
11-bit or 12-bit input data. While 11-bit data is supported on the GMSL
side, CSI-2 doesn't have a RAW11 format. 11-bit data is transferred over
CSI-2 as RAW12. Rename the macro accordingly to avoid confusion.

Signed-off-by: Laurent Pinchart <laurent.pinchart+renesas@ideasonboard.com>
Reviewed-by: Jacopo Mondi <jacopo+renesas@jmondi.org>
Signed-off-by: Mauro Carvalho Chehab <mchehab@kernel.org>
17 months agomedia: i2c: max9286: Support manual framesync operation
Laurent Pinchart [Sat, 1 Jan 2022 18:28:00 +0000 (19:28 +0100)]
media: i2c: max9286: Support manual framesync operation

The MAX9286 can generate a framesync signal to synchronize the cameras,
using an internal timer. Support this mode of operation and configure it
through the .s_frameinterval() operation. If the frame interval is not
0, framesync is switched to manual mode with the specified interval,
otherwise automatic mode is used.

Signed-off-by: Laurent Pinchart <laurent.pinchart+renesas@ideasonboard.com>
Reviewed-by: Jacopo Mondi <jacopo+renesas@jmondi.org>
Signed-off-by: Mauro Carvalho Chehab <mchehab@kernel.org>
17 months agomedia: i2c: max9286: Add support for port regulators
Thomas Nizan [Sat, 1 Jan 2022 18:27:59 +0000 (19:27 +0100)]
media: i2c: max9286: Add support for port regulators

Allow users to use one PoC regulator per port, instead of a global
regulator.

The properties '^port[0-3]-poc-supply$' in the DT node are used to
indicate the regulators for individual ports.

Signed-off-by: Thomas Nizan <tnizan@witekio.com>
Signed-off-by: Laurent Pinchart <laurent.pinchart+renesas@ideasonboard.com>
Reviewed-by: Jacopo Mondi <jacopo.mondi@ideasonboard.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab@kernel.org>
17 months agomedia: dt-bindings: media: i2c: max9286: Add property to select bus width
Laurent Pinchart [Mon, 10 Jan 2022 21:24:46 +0000 (22:24 +0100)]
media: dt-bindings: media: i2c: max9286: Add property to select bus width

The GMSL serial data bus width is normally selected by the BWS pin, but
it can also be configured by software. Add a DT property that allows
overriding the value of the BWS-selected bus width to support systems
whose BWS pin doesn't result in the correct value.

Signed-off-by: Laurent Pinchart <laurent.pinchart+renesas@ideasonboard.com>
Reviewed-by: Jacopo Mondi <jacopo+renesas@jmondi.org>
Reviewed-by: Rob Herring <robh@kernel.org>
Signed-off-by: Mauro Carvalho Chehab <mchehab@kernel.org>
17 months agomedia: dt-bindings: media: i2c: max9286: Add property to select I2C speed
Laurent Pinchart [Sat, 1 Jan 2022 18:27:57 +0000 (19:27 +0100)]
media: dt-bindings: media: i2c: max9286: Add property to select I2C speed

The I2C speed on the remote side (the I2C master bus of the connected
serializers) is configurable, and doesn't need to match the speed of the
local bus (the slave bus of the MAX9286). All remote buses must use the
same speed, and the MAX9286 needs to be programmed accordingly. Add a
new DT property to select the speed to make it configurable.

Signed-off-by: Laurent Pinchart <laurent.pinchart+renesas@ideasonboard.com>
Reviewed-by: Rob Herring <robh@kernel.org>
Reviewed-by: Jacopo Mondi <jacopo.mondi@ideasonboard.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab@kernel.org>
17 months agomedia: dt-bindings: media: i2c: max9286: Add support for per-port supplies
Laurent Pinchart [Sat, 1 Jan 2022 18:27:56 +0000 (19:27 +0100)]
media: dt-bindings: media: i2c: max9286: Add support for per-port supplies

Power supplies for the ports can be controlled per port depending on the
hardware design. Support per-port supplies in the DT bindings, mutually
exclusive with the global supply.

Signed-off-by: Laurent Pinchart <laurent.pinchart+renesas@ideasonboard.com>
Reviewed-by: Jacopo Mondi <jacopo+renesas@jmondi.org>
Reviewed-by: Rob Herring <robh@kernel.org>
Signed-off-by: Mauro Carvalho Chehab <mchehab@kernel.org>
17 months agoMerge tag 'media-uvc-next-20230115' of git://git.kernel.org/pub/scm/linux/kernel...
Mauro Carvalho Chehab [Sun, 22 Jan 2023 07:43:05 +0000 (08:43 +0100)]
Merge tag 'media-uvc-next-20230115' of git://git./linux/kernel/git/pinchartl/linux into media_stage

uvcvideo fixes and improvements

* tag 'media-uvc-next-20230115' of git://git.kernel.org/pub/scm/linux/kernel/git/pinchartl/linux: (27 commits)
  media: uvcvideo: Silence memcpy() run-time false positive warnings
  media: uvcvideo: Quirk for autosuspend in Logitech B910 and C910
  media: uvcvideo: Fix race condition with usb_kill_urb
  media: uvcvideo: Use standard names for menus
  media: uvcvideo: Fix power line control for Lenovo Integrated Camera
  media: uvcvideo: Refactor power_line_frequency_controls_limited
  media: uvcvideo: Refactor uvc_ctrl_mappings_uvcXX
  media: uvcvideo: Implement mask for V4L2_CTRL_TYPE_MENU
  media: uvcvideo: Extend documentation of uvc_video_clock_decode()
  media: uvcvideo: Limit power line control for Acer EasyCamera
  media: uvcvideo: Refactor __uvc_ctrl_add_mapping
  media: uvcvideo: Fix handling on Bitmask controls
  media: uvcvideo: Do not return positive errors in uvc_query_ctrl()
  media: uvcvideo: Return -EACCES for Wrong state error
  media: uvcvideo: Improve error logging in uvc_query_ctrl()
  media: uvcvideo: Check for INACTIVE in uvc_ctrl_is_accessible()
  media: uvcvideo: Factor out usb_string() calls
  media: uvcvideo: Limit power line control for Acer EasyCamera
  media: uvcvideo: Recover stalled ElGato devices
  media: uvcvideo: Remove void casting for the status endpoint
  ...

Signed-off-by: Mauro Carvalho Chehab <mchehab@kernel.org>
17 months agomedia: rc/ir-rx51: Drop empty platform remove function
Uwe Kleine-König [Tue, 13 Dec 2022 15:35:52 +0000 (16:35 +0100)]
media: rc/ir-rx51: Drop empty platform remove function

A remove callback just returning 0 is equivalent to no remove callback
at all. So drop the useless function.

Signed-off-by: Uwe Kleine-König <u.kleine-koenig@pengutronix.de>
Signed-off-by: Sean Young <sean@mess.org>
Signed-off-by: Mauro Carvalho Chehab <mchehab@kernel.org>
17 months agomedia: rc: Drop obsolete dependencies on COMPILE_TEST
Jean Delvare [Mon, 21 Nov 2022 16:09:11 +0000 (17:09 +0100)]
media: rc: Drop obsolete dependencies on COMPILE_TEST

Since commit 0166dc11be91 ("of: make CONFIG_OF user selectable"), it
is possible to test-build any driver which depends on OF on any
architecture by explicitly selecting OF. Therefore depending on
COMPILE_TEST as an alternative is no longer needed.

It is actually better to always build such drivers with OF enabled,
so that the test builds are closer to how each driver will actually be
built on its intended target. Building them without OF may not test
much as the compiler will optimize out potentially large parts of the
code. In the worst case, this could even pop false positive warnings.
Dropping COMPILE_TEST here improves the quality of our testing and
avoids wasting time on non-existent issues.

As a minor optimization, this also lets us drop of_match_ptr(), as we
now know what it will resolve to, we might as well save cpp some work.

Signed-off-by: Jean Delvare <jdelvare@suse.de>
Cc: Thierry Reding <thierry.reding@gmail.com>
Cc: "Uwe Kleine-König" <u.kleine-koenig@pengutronix.de>
Acked-by: Uwe Kleine-König <u.kleine-koenig@pengutronix.de>
Signed-off-by: Sean Young <sean@mess.org>
Signed-off-by: Mauro Carvalho Chehab <mchehab@kernel.org>
17 months agomedia: tuners/si2157: Convert to i2c's .probe_new()
Uwe Kleine-König [Fri, 18 Nov 2022 22:42:21 +0000 (23:42 +0100)]
media: tuners/si2157: Convert to i2c's .probe_new()

.probe_new() doesn't get the i2c_device_id * parameter, so determine
that explicitly in the probe function.

Signed-off-by: Uwe Kleine-König <u.kleine-koenig@pengutronix.de>
Signed-off-by: Hans Verkuil <hverkuil-cisco@xs4all.nl>
Signed-off-by: Mauro Carvalho Chehab <mchehab@kernel.org>
17 months agomedia: i2c/video-i2c: Convert to i2c's .probe_new()
Uwe Kleine-König [Fri, 18 Nov 2022 22:42:04 +0000 (23:42 +0100)]
media: i2c/video-i2c: Convert to i2c's .probe_new()

.probe_new() doesn't get the i2c_device_id * parameter, so determine
that explicitly in the probe function.

Signed-off-by: Uwe Kleine-König <u.kleine-koenig@pengutronix.de>
Acked-by: Matt Ranostay <matt.ranostay@konsulko.com>
Signed-off-by: Hans Verkuil <hverkuil-cisco@xs4all.nl>
Signed-off-by: Mauro Carvalho Chehab <mchehab@kernel.org>
17 months agomedia: i2c/tvp514x: Convert to i2c's .probe_new()
Uwe Kleine-König [Fri, 18 Nov 2022 22:41:56 +0000 (23:41 +0100)]
media: i2c/tvp514x: Convert to i2c's .probe_new()

.probe_new() doesn't get the i2c_device_id * parameter, so determine
that explicitly in the probe function.

[hverkuil: remove obsolete kerneldoc 'id' documentation]

Signed-off-by: Uwe Kleine-König <u.kleine-koenig@pengutronix.de>
Signed-off-by: Hans Verkuil <hverkuil-cisco@xs4all.nl>
Signed-off-by: Mauro Carvalho Chehab <mchehab@kernel.org>
17 months agomedia: i2c/tvaudio: Convert to i2c's .probe_new()
Uwe Kleine-König [Fri, 18 Nov 2022 22:41:55 +0000 (23:41 +0100)]
media: i2c/tvaudio: Convert to i2c's .probe_new()

.probe_new() doesn't get the i2c_device_id * parameter, so determine
that explicitly in the probe function.

Signed-off-by: Uwe Kleine-König <u.kleine-koenig@pengutronix.de>
Signed-off-by: Hans Verkuil <hverkuil-cisco@xs4all.nl>
Signed-off-by: Mauro Carvalho Chehab <mchehab@kernel.org>
17 months agomedia: i2c/tda1997x: Convert to i2c's .probe_new()
Uwe Kleine-König [Fri, 18 Nov 2022 22:41:48 +0000 (23:41 +0100)]
media: i2c/tda1997x: Convert to i2c's .probe_new()

.probe_new() doesn't get the i2c_device_id * parameter, so determine
that explicitly in the probe function.

Signed-off-by: Uwe Kleine-König <u.kleine-koenig@pengutronix.de>
Signed-off-by: Hans Verkuil <hverkuil-cisco@xs4all.nl>
Signed-off-by: Mauro Carvalho Chehab <mchehab@kernel.org>
17 months agomedia: i2c/saa7127: Convert to i2c's .probe_new()
Uwe Kleine-König [Fri, 18 Nov 2022 22:41:43 +0000 (23:41 +0100)]
media: i2c/saa7127: Convert to i2c's .probe_new()

.probe_new() doesn't get the i2c_device_id * parameter, so determine
that explicitly in the probe function.

Signed-off-by: Uwe Kleine-König <u.kleine-koenig@pengutronix.de>
Signed-off-by: Hans Verkuil <hverkuil-cisco@xs4all.nl>
Signed-off-by: Mauro Carvalho Chehab <mchehab@kernel.org>