media: Add a helper for obtaining the clock producer
Get series with b4
b4 am [email protected]Versions newest first · linked by author and title
- v2 Latest48 patches 18 repliesIn review
- v155 patches 14 repliesSuperseded
Changes in v2 from the cover letter
- Added a check to !of_node instead of acpi_node as !of_node will cover both acpi nodes and software nodes (currently used by AMD camera setup)
Patches in v2 No applies recorded yet
Reviews trailers per patch
All 48 patches have a Reviewed-by or Acked-by.
| Patch | Laurent Pinchart | Lad Prabhakar | Krzysztof Hałasa | Michael Riesch |
|---|---|---|---|---|
| 1/48 | R-b R-b | R-b R-b | ||
| 2/48 | R-b | R-b | ||
| 3/48 | R-b | R-b | A-b | |
| 4/48 | R-b | R-b | ||
| 5/48 | R-b | R-b | ||
| 6/48 | R-b | R-b | ||
| 7/48 | R-b | R-b | ||
| 8/48 | R-b | R-b | ||
| 9/48 | R-b | R-b | ||
| 10/48 | R-b | R-b | ||
| 11/48 | R-b | R-b | ||
| 12/48 | R-b | R-b | ||
| 13/48 | R-b | R-b | ||
| 14/48 | R-b | R-b | ||
| 15/48 | R-b | R-b | ||
| 16/48 | R-b | R-b | ||
| 17/48 | R-b | R-b | R-b | |
| 18/48 | R-b | R-b | ||
| 19/48 | R-b | R-b | ||
| 20/48 | R-b | R-b | ||
| 21/48 | R-b | R-b | ||
| 22/48 | R-b | R-b | ||
| 23/48 | R-b | R-b | ||
| 24/48 | R-b | R-b | ||
| 25/48 | R-b | R-b | ||
| 26/48 | R-b | R-b | ||
| 27/48 | R-b | R-b | ||
| 28/48 | R-b | R-b | ||
| 29/48 | R-b | R-b | ||
| 30/48 | R-b | R-b | ||
| 31/48 | R-b | R-b | ||
| 32/48 | R-b | R-b | ||
| 33/48 | R-b | R-b | ||
| 34/48 | R-b | R-b | ||
| 35/48 | R-b | R-b | ||
| 36/48 | R-b | R-b | ||
| 37/48 | R-b | R-b | ||
| 38/48 | R-b | R-b | ||
| 39/48 | R-b | R-b | ||
| 40/48 | R-b | R-b | ||
| 41/48 | R-b | R-b | ||
| 42/48 | R-b | R-b | ||
| 43/48 | R-b | R-b | ||
| 44/48 | R-b | R-b | ||
| 45/48 | R-b | R-b | ||
| 46/48 | R-b | R-b | ||
| 47/48 | R-b | R-b | ||
| 48/48 | R-b | R-b |
Trailers given in replies are filled; those carried in the patches from earlier versions are outlined with dashes. Scroll the table sideways for all 4 reviewers.
Cover letter [PATCH v2 00/48] media: Add a helper for obtaining the clock producer
Hello everyone,
Here is my v2 for the new helper v4l2_devm_sensor_clk_get()
I took this opportunity to make all the drivers that I touched with this series return dev_err_probe() when the helper fails: the complete list is below in the HISTORY. I noticed some odd drivers:
drivers/media/i2c/s5k5baf.c -> always returns -EPROBE_DEFER if getting the clock fails
drivers/media/i2c/mt9t112.c -> this drivers seems to be implementing
the behaviour of devm_clk_get_optional() while using devm_clk_get():
remove it from the list of changed drivers ?
drivers/media/i2c/ov8856.c -> getting the clock, setting the rate, getting the optional gpio and the regulator_bulk is only when the fwnode is NOT acpi.
Any testing of the patches is GREATLY APPRECIATED!
Especially the two drivers with the special ACPI case:
1) OV8865
2) OV2680
Background
----------
A reference to the clock producer is not available to the kernel in ACPI-based platforms but the sensor drivers still need them.
devm_clk_get() will return an error and the probe function will fail.
Solution
--------
Introduce a generic helper for v4l2 sensor drivers on both DT- and ACPI-based platforms.
This helper behaves the same as clk_get_optional() except where there is no clock producer like in ACPI-based platforms.
For ACPI-based platforms the function will read the "clock-frequency" ACPI _DSD property and register a fixed frequency clock with the frequency indicated in the property.
Solution for special ACPI case
------------------------------
This function also handles the special ACPI-based system case where:
1) The clock-frequency _DSD property is present.
2) A reference to the clock producer is present, where the clock is provided by a camera sensor PMIC driver (e.g. int3472/tps68470.c)
In this case try to set the clock-frequency value to the provided clock.
History
-------
v1 -> v2:
- Added a check to !of_node instead of acpi_node as !of_node will cover both acpi nodes and software nodes (currently used by AMD camera setup)
Changed the following drivers to use dev_err_probe() when the helper fails:
s5k6a3.c s5c73m3/s5c73m3-core.c mt9m001.c mt9m111.c mt9p031.c mt9m114.c mt9v032.c mt9v111.c ov2659.c ov2685.c ov5640.c ov5647.c ov5648.c ov5695.c ov6650.c ov7740.c ov9282.c ov9640.c ov9650.c imx412.c imx335.c hi846.c et8ek8/et8ek8_driver.c ar0521.c
Suggested by Laurent:
- changed clk_get_optional() to devm_clk_get() in the commit msg and kernel-doc of the helper function
- improved the kernel-doc of the function
- added forward declaration of struct clk in include/media/v4l2-common.h
- changed the Documentation in the [PATCH 02/48]
- dropped the comment in ov2680.c
- removed the following drivers that are not camera sensors:
ds90ub913: Video Serializer
ds90ub960: Video Deserializer
st-mipid02: CSI-2 to PARALLEL bridge
tc358743: HDMI to CSI-2 bridge
tc358746: PARALLEL to CSI-2 bridge
thp7312: External Camera ISP
Suggested by Sakari:
- added the handling for when devm_clk_get_optional() returns -EPROBE_DEFER
- added handling for when devm_clk_get_optional() returns -EINVAL. The helper will return -EPROBE_DEFER signaling that some software components are still needed before the sensor driver can get probed (e.g. int3472 or the AMD ISP)
Suggested by Michael Riesch:
- made the imx415 clock name NULL
Link v1: https://lore.kernel.org/linux-media/[email protected]/
RFC History
-----------
RFC v4 -> RFC v5:
Suggested by Arnd Bergmann:
- removed IS_REACHABLE(CONFIG_COMMON_CLK). IS_REACHABLE() is actually
discouraged [1]. COFIG_COMMON_CLK is a bool, so IS_ENABLED() will be the
right solution here
Suggested by Hans de Goede:
- added handling for the special ACPI-based system case, where
both a reference to the clock-provider and the _DSD
clock-frequency are present.
- updated the function's kernel-doc and the commit msg
to mention this special case.
Link RFC v4: https://lore.kernel.org/linux-media/[email protected]/
[1] https://git.kernel.org/pub/scm/linux/kernel/git/next/linux-next.git/commit/Documentation/kbuild/kconfig-language.rst?h=next-20250513&id=700bd25bd4f47a0f4e02e0a25dde05f1a6b16eea
RFC v3 -> RFC v4:
Suggested by Laurent:
- removed the #ifdef to use IS_REACHABLE(CONFIG_COMMON_CLK)
- changed to kasprintf() to allocate the clk name when id is NULL and used the __free(kfree) scope-based cleanup helper when
defining the variable to hold the allocated name
Link v3: https://lore.kernel.org/linux-media/[email protected]/
RFC v2 -> RFC v3:
- Added #ifdef CONFIG_COMMON_CLK for the ACPI case
Link v2: https://lore.kernel.org/linux-media/[email protected]/
RFC v1 -> RFC v2:
Suggested by Sakari:
- removed clk_name
- removed the IS_ERR() check
- improved the kernel-doc comment and commit msg
Link v1: https://lore.kernel.org/linux-media/[email protected]
Mehdi Djait (48):
media: v4l2-common: Add a helper for obtaining the clock producer
Documentation: media: camera-sensor: Mention
v4l2_devm_sensor_clk_get() for obtaining the clock
media: i2c: ar0521: Use the v4l2 helper for obtaining the clock
media: i2c: et8ek8: Use the v4l2 helper for obtaining the clock
media: i2c: gc05a2: Use the v4l2 helper for obtaining the clock
media: i2c: gc08a3: Use the v4l2 helper for obtaining the clock
media: i2c: gc2145: Use the v4l2 helper for obtaining the clock
media: i2c: hi846: Use the v4l2 helper for obtaining the clock
media: i2c: imx214: Use the v4l2 helper for obtaining the clock
media: i2c: imx219: Use the v4l2 helper for obtaining the clock
media: i2c: imx283: Use the v4l2 helper for obtaining the clock
media: i2c: imx290: Use the v4l2 helper for obtaining the clock
media: i2c: imx296: Use the v4l2 helper for obtaining the clock
media: i2c: imx334: Use the v4l2 helper for obtaining the clock
media: i2c: imx335: Use the v4l2 helper for obtaining the clock
media: i2c: imx412: Use the v4l2 helper for obtaining the clock
media: i2c: imx415: Use the v4l2 helper for obtaining the clock
media: i2c: mt9m001: Use the v4l2 helper for obtaining the clock
media: i2c: mt9m111: Use the v4l2 helper for obtaining the clock
media: i2c: mt9m114: Use the v4l2 helper for obtaining the clock
media: i2c: mt9p031: Use the v4l2 helper for obtaining the clock
media: i2c: mt9t112: Use the v4l2 helper for obtaining the clock
media: i2c: mt9v032: Use the v4l2 helper for obtaining the clock
media: i2c: mt9v111: Use the v4l2 helper for obtaining the clock
media: i2c: ov02a10: Use the v4l2 helper for obtaining the clock
media: i2c: ov2659: Use the v4l2 helper for obtaining the clock
media: i2c: ov2685: Use the v4l2 helper for obtaining the clock
media: i2c: ov5640: Use the v4l2 helper for obtaining the clock
media: i2c: ov5645: Use the v4l2 helper for obtaining the clock
media: i2c: ov5647: Use the v4l2 helper for obtaining the clock
media: i2c: ov5648: Use the v4l2 helper for obtaining the clock
media: i2c: ov5695: Use the v4l2 helper for obtaining the clock
media: i2c: ov64a40: Use the v4l2 helper for obtaining the clock
media: i2c: ov6650: Use the v4l2 helper for obtaining the clock
media: i2c: ov7740: Use the v4l2 helper for obtaining the clock
media: i2c: ov8856: Use the v4l2 helper for obtaining the clock
media: i2c: ov8858: Use the v4l2 helper for obtaining the clock
media: i2c: ov8865: Use the v4l2 helper for obtaining the clock
media: i2c: ov9282: Use the v4l2 helper for obtaining the clock
media: i2c: ov9640: Use the v4l2 helper for obtaining the clock
media: i2c: ov9650: Use the v4l2 helper for obtaining the clock
media: i2c: s5c73m3: Use the v4l2 helper for obtaining the clock
media: i2c: s5k5baf: Use the v4l2 helper for obtaining the clock
media: i2c: s5k6a3: Use the v4l2 helper for obtaining the clock
media: i2c: vd55g1: Use the v4l2 helper for obtaining the clock
media: i2c: vd56g3: Use the v4l2 helper for obtaining the clock
media: i2c: vgxy61: Use the v4l2 helper for obtaining the clock
media: i2c: ov2680: Use the v4l2 helper for obtaining the clock
.../driver-api/media/camera-sensor.rst | 24 ++++++--- drivers/media/i2c/ar0521.c | 9 ++-- drivers/media/i2c/et8ek8/et8ek8_driver.c | 9 ++-- drivers/media/i2c/gc05a2.c | 2 +- drivers/media/i2c/gc08a3.c | 2 +- drivers/media/i2c/gc2145.c | 2 +- drivers/media/i2c/hi846.c | 11 ++-- drivers/media/i2c/imx214.c | 2 +- drivers/media/i2c/imx219.c | 2 +- drivers/media/i2c/imx283.c | 5 +- drivers/media/i2c/imx290.c | 2 +- drivers/media/i2c/imx296.c | 2 +- drivers/media/i2c/imx334.c | 2 +- drivers/media/i2c/imx335.c | 9 ++-- drivers/media/i2c/imx412.c | 9 ++-- drivers/media/i2c/imx415.c | 2 +- drivers/media/i2c/mt9m001.c | 5 +- drivers/media/i2c/mt9m111.c | 5 +- drivers/media/i2c/mt9m114.c | 6 +-- drivers/media/i2c/mt9p031.c | 5 +- drivers/media/i2c/mt9t112.c | 11 ++-- drivers/media/i2c/mt9v032.c | 5 +- drivers/media/i2c/mt9v111.c | 5 +- drivers/media/i2c/ov02a10.c | 2 +- drivers/media/i2c/ov2659.c | 5 +- drivers/media/i2c/ov2680.c | 29 +---------- drivers/media/i2c/ov2685.c | 10 ++-- drivers/media/i2c/ov5640.c | 9 ++-- drivers/media/i2c/ov5645.c | 2 +- drivers/media/i2c/ov5647.c | 9 ++-- drivers/media/i2c/ov5648.c | 6 +-- drivers/media/i2c/ov5695.c | 10 ++-- drivers/media/i2c/ov64a40.c | 2 +- drivers/media/i2c/ov6650.c | 10 ++-- drivers/media/i2c/ov7740.c | 11 ++-- drivers/media/i2c/ov8856.c | 10 ++-- drivers/media/i2c/ov8858.c | 2 +- drivers/media/i2c/ov8865.c | 36 ++----------- drivers/media/i2c/ov9282.c | 9 ++-- drivers/media/i2c/ov9640.c | 5 +- drivers/media/i2c/ov9650.c | 5 +- drivers/media/i2c/s5c73m3/s5c73m3-core.c | 6 ++- drivers/media/i2c/s5k5baf.c | 2 +- drivers/media/i2c/s5k6a3.c | 5 +- drivers/media/i2c/vd55g1.c | 2 +- drivers/media/i2c/vd56g3.c | 2 +- drivers/media/i2c/vgxy61.c | 10 ++-- drivers/media/v4l2-core/v4l2-common.c | 52 +++++++++++++++++++ include/media/v4l2-common.h | 27 ++++++++++ 49 files changed, 223 insertions(+), 191 deletions(-)
Signature · 1 line
2.49.0