linux-media.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Hans Verkuil <hverkuil+cisco@kernel.org>
To: Mehdi Djait <mehdi.djait@linux.intel.com>,
	laurent.pinchart@ideasonboard.com, sakari.ailus@linux.intel.com
Cc: stanislaw.gruszka@linux.intel.com, hdegoede@redhat.com,
	arnd@arndb.de, alain.volmat@foss.st.com, andrzej.hajda@intel.com,
	benjamin.mugnier@foss.st.com, dave.stevenson@raspberrypi.com,
	hansg@kernel.org, hverkuil@xs4all.nl,
	jacopo.mondi@ideasonboard.com, kieran.bingham@ideasonboard.com,
	khalasa@piap.pl, mani@kernel.org, m.felsch@pengutronix.de,
	matthias.fend@emfend.at, mchehab@kernel.org,
	michael.riesch@collabora.com, naush@raspberrypi.com,
	nicholas@rothemail.net, nicolas.dufresne@collabora.com,
	paul.elder@ideasonboard.com, dan.scally@ideasonboard.com,
	pavel@kernel.org, rashanmu@gmail.com, ribalda@chromium.org,
	slongerbeam@gmail.com, tomi.valkeinen@ideasonboard.com,
	umang.jain@ideasonboard.com, linux-media@vger.kernel.org,
	Lad Prabhakar <prabhakar.mahadev-lad.rj@bp.renesas.com>
Subject: Re: [PATCH v2 01/48] media: v4l2-common: Add a helper for obtaining the clock producer
Date: Wed, 13 Aug 2025 12:15:29 +0200	[thread overview]
Message-ID: <cd5ac9a7-ada2-4bdf-bc81-8290f0eb88d6@kernel.org> (raw)
In-Reply-To: <8ecbcafbd91b25ad5e188dbe127b921a1643027e.1750942967.git.mehdi.djait@linux.intel.com>

Hi Mehdi, Sakari, Laurent,

On 26/06/2025 15:33, Mehdi Djait wrote:
> Introduce a helper for v4l2 sensor drivers on both DT- and ACPI-based
> platforms to retrieve a reference to the clock producer from firmware.
> 
> This helper behaves the same as devm_clk_get() 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.
> 
> This function also handles the special ACPI-based system case where:
> The clock-frequency _DSD property is present.
> 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.

On irc I wondered about the name of the new function since it is sensor
specific, and if it can also be used for e.g. video receivers, then it
should be renamed to something more generic.

According to Laurent there is no ACPI standard for video receivers, so
that's the reason this is sensor specific.

I'd like to see that documented in this patch. Either in the commit log,
or, preferred, in the header in the function description.

I made a suggestion below.

> 
> Reviewed-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
> Reviewed-by: Lad Prabhakar <prabhakar.mahadev-lad.rj@bp.renesas.com>
> Signed-off-by: Mehdi Djait <mehdi.djait@linux.intel.com>
> ---
>  drivers/media/v4l2-core/v4l2-common.c | 52 +++++++++++++++++++++++++++
>  include/media/v4l2-common.h           | 27 ++++++++++++++
>  2 files changed, 79 insertions(+)
> 
> diff --git a/drivers/media/v4l2-core/v4l2-common.c b/drivers/media/v4l2-core/v4l2-common.c

<snip>

> diff --git a/include/media/v4l2-common.h b/include/media/v4l2-common.h
> index 0a43f56578bc..1c79ca4d5c73 100644
> --- a/include/media/v4l2-common.h
> +++ b/include/media/v4l2-common.h
> @@ -100,6 +100,7 @@ int v4l2_ctrl_query_fill(struct v4l2_queryctrl *qctrl,
>  struct v4l2_device;
>  struct v4l2_subdev;
>  struct v4l2_subdev_ops;
> +struct clk;
>  
>  /* I2C Helper functions */
>  #include <linux/i2c.h>
> @@ -620,6 +621,32 @@ int v4l2_link_freq_to_bitmap(struct device *dev, const u64 *fw_link_freqs,
>  			     unsigned int num_of_driver_link_freqs,
>  			     unsigned long *bitmap);
>  
> +/**
> + * devm_v4l2_sensor_clk_get - lookup and obtain a reference to a clock producer
> + *	for a camera sensor.
> + *
> + * @dev: device for v4l2 sensor clock "consumer"
> + * @id: clock consumer ID
> + *
> + * This function behaves the same way as devm_clk_get() 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-clock with the frequency indicated
> + * in the property.
> + *
> + * This function also handles the special ACPI-based system case where:
> + *
> + * * The clock-frequency _DSD property is present.
> + * * 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.

    *
    * While ACPI has standardized sensor support, there is no standard support for
    * e.g. video receivers. So this function is specific to sensors, hence the
    * chosen function name.

Better suggestions are welcome.

If it is just adding a paragraph, then I can just add that manually. If the change
is more involved, then a v2.1 for just this patch should be posted.

Other than this, the series looks good.

Regards,

	Hans

> + *
> + * Returns a pointer to a struct clk on success or an error pointer on failure.
> + */
> +struct clk *devm_v4l2_sensor_clk_get(struct device *dev, const char *id);
> +
>  static inline u64 v4l2_buffer_get_timestamp(const struct v4l2_buffer *buf)
>  {
>  	/*


  parent reply	other threads:[~2025-08-13 10:15 UTC|newest]

Thread overview: 72+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2025-06-26 13:33 [PATCH v2 00/48] media: Add a helper for obtaining the clock producer Mehdi Djait
2025-06-26 13:33 ` [PATCH v2 01/48] media: v4l2-common: " Mehdi Djait
2025-06-27  7:12   ` Sakari Ailus
2025-07-01  9:51     ` Mehdi Djait
2025-07-01 10:03       ` Sakari Ailus
2025-07-01 10:47         ` Jacopo Mondi
2025-07-01 11:17           ` Laurent Pinchart
2025-07-01 11:46             ` Mehdi Djait
2025-07-06  0:30   ` Laurent Pinchart
2025-07-07 14:30     ` Mehdi Djait
2025-07-07 14:32       ` [PATCH v3] " Mehdi Djait
2025-07-07 21:55         ` Sakari Ailus
2025-08-13 10:15   ` Hans Verkuil [this message]
2025-08-13 12:59     ` [PATCH v2 01/48] " Sakari Ailus
2025-08-13 13:08       ` Laurent Pinchart
2025-08-13 13:22         ` Sakari Ailus
2025-08-13 13:23         ` Hans Verkuil
2025-08-13 14:49           ` Sakari Ailus
2025-08-13 15:14             ` Hans Verkuil
2025-08-13 19:45               ` Sakari Ailus
2025-08-14 13:50               ` [PATCH 1/1] media: v4l2-common: Improve devm_v4l2_sensor_clk_get() documentation Sakari Ailus
2025-08-15  6:00                 ` Mehdi Djait
2025-08-15  8:53                   ` Sakari Ailus
2025-06-26 13:33 ` [PATCH v2 02/48] Documentation: media: camera-sensor: Mention v4l2_devm_sensor_clk_get() for obtaining the clock Mehdi Djait
2025-07-01 11:03   ` Laurent Pinchart
2025-06-26 13:33 ` [PATCH v2 03/48] media: i2c: ar0521: Use the v4l2 helper " Mehdi Djait
2025-06-26 13:33 ` [PATCH v2 04/48] media: i2c: et8ek8: " Mehdi Djait
2025-06-26 13:33 ` [PATCH v2 05/48] media: i2c: gc05a2: " Mehdi Djait
2025-06-26 13:33 ` [PATCH v2 06/48] media: i2c: gc08a3: " Mehdi Djait
2025-06-26 13:33 ` [PATCH v2 07/48] media: i2c: gc2145: " Mehdi Djait
2025-06-26 13:33 ` [PATCH v2 08/48] media: i2c: hi846: " Mehdi Djait
2025-06-26 13:34 ` [PATCH v2 09/48] media: i2c: imx214: " Mehdi Djait
2025-06-26 13:34 ` [PATCH v2 10/48] media: i2c: imx219: " Mehdi Djait
2025-06-26 13:34 ` [PATCH v2 11/48] media: i2c: imx283: " Mehdi Djait
2025-06-26 13:34 ` [PATCH v2 12/48] media: i2c: imx290: " Mehdi Djait
2025-06-26 13:34 ` [PATCH v2 13/48] media: i2c: imx296: " Mehdi Djait
2025-06-26 13:34 ` [PATCH v2 14/48] media: i2c: imx334: " Mehdi Djait
2025-06-26 13:34 ` [PATCH v2 15/48] media: i2c: imx335: " Mehdi Djait
2025-06-26 13:34 ` [PATCH v2 16/48] media: i2c: imx412: " Mehdi Djait
2025-06-26 13:34 ` [PATCH v2 17/48] media: i2c: imx415: " Mehdi Djait
2025-06-26 13:41   ` Michael Riesch
2025-06-26 13:34 ` [PATCH v2 18/48] media: i2c: mt9m001: " Mehdi Djait
2025-06-26 13:34 ` [PATCH v2 19/48] media: i2c: mt9m111: " Mehdi Djait
2025-06-26 13:34 ` [PATCH v2 20/48] media: i2c: mt9m114: " Mehdi Djait
2025-06-26 13:34 ` [PATCH v2 21/48] media: i2c: mt9p031: " Mehdi Djait
2025-06-26 13:34 ` [PATCH v2 22/48] media: i2c: mt9t112: " Mehdi Djait
2025-06-26 13:34 ` [PATCH v2 23/48] media: i2c: mt9v032: " Mehdi Djait
2025-06-26 13:34 ` [PATCH v2 24/48] media: i2c: mt9v111: " Mehdi Djait
2025-06-26 13:34 ` [PATCH v2 25/48] media: i2c: ov02a10: " Mehdi Djait
2025-06-26 13:34 ` [PATCH v2 26/48] media: i2c: ov2659: " Mehdi Djait
2025-06-26 13:34 ` [PATCH v2 27/48] media: i2c: ov2685: " Mehdi Djait
2025-06-26 13:34 ` [PATCH v2 28/48] media: i2c: ov5640: " Mehdi Djait
2025-06-26 13:34 ` [PATCH v2 29/48] media: i2c: ov5645: " Mehdi Djait
2025-06-26 13:34 ` [PATCH v2 30/48] media: i2c: ov5647: " Mehdi Djait
2025-06-26 13:34 ` [PATCH v2 31/48] media: i2c: ov5648: " Mehdi Djait
2025-06-26 13:34 ` [PATCH v2 32/48] media: i2c: ov5695: " Mehdi Djait
2025-06-26 13:34 ` [PATCH v2 33/48] media: i2c: ov64a40: " Mehdi Djait
2025-06-26 13:34 ` [PATCH v2 34/48] media: i2c: ov6650: " Mehdi Djait
2025-06-26 13:34 ` [PATCH v2 35/48] media: i2c: ov7740: " Mehdi Djait
2025-06-26 13:34 ` [PATCH v2 36/48] media: i2c: ov8856: " Mehdi Djait
2025-06-26 13:34 ` [PATCH v2 37/48] media: i2c: ov8858: " Mehdi Djait
2025-06-26 13:34 ` [PATCH v2 38/48] media: i2c: ov8865: " Mehdi Djait
2025-06-26 13:34 ` [PATCH v2 39/48] media: i2c: ov9282: " Mehdi Djait
2025-06-26 13:34 ` [PATCH v2 40/48] media: i2c: ov9640: " Mehdi Djait
2025-06-26 13:34 ` [PATCH v2 41/48] media: i2c: ov9650: " Mehdi Djait
2025-06-26 13:34 ` [PATCH v2 42/48] media: i2c: s5c73m3: " Mehdi Djait
2025-06-26 13:34 ` [PATCH v2 43/48] media: i2c: s5k5baf: " Mehdi Djait
2025-06-26 13:34 ` [PATCH v2 44/48] media: i2c: s5k6a3: " Mehdi Djait
2025-06-26 13:34 ` [PATCH v2 45/48] media: i2c: vd55g1: " Mehdi Djait
2025-06-26 13:34 ` [PATCH v2 46/48] media: i2c: vd56g3: " Mehdi Djait
2025-06-26 13:34 ` [PATCH v2 47/48] media: i2c: vgxy61: " Mehdi Djait
2025-06-26 13:34 ` [PATCH v2 48/48] media: i2c: ov2680: " Mehdi Djait

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=cd5ac9a7-ada2-4bdf-bc81-8290f0eb88d6@kernel.org \
    --to=hverkuil+cisco@kernel.org \
    --cc=alain.volmat@foss.st.com \
    --cc=andrzej.hajda@intel.com \
    --cc=arnd@arndb.de \
    --cc=benjamin.mugnier@foss.st.com \
    --cc=dan.scally@ideasonboard.com \
    --cc=dave.stevenson@raspberrypi.com \
    --cc=hansg@kernel.org \
    --cc=hdegoede@redhat.com \
    --cc=hverkuil@xs4all.nl \
    --cc=jacopo.mondi@ideasonboard.com \
    --cc=khalasa@piap.pl \
    --cc=kieran.bingham@ideasonboard.com \
    --cc=laurent.pinchart@ideasonboard.com \
    --cc=linux-media@vger.kernel.org \
    --cc=m.felsch@pengutronix.de \
    --cc=mani@kernel.org \
    --cc=matthias.fend@emfend.at \
    --cc=mchehab@kernel.org \
    --cc=mehdi.djait@linux.intel.com \
    --cc=michael.riesch@collabora.com \
    --cc=naush@raspberrypi.com \
    --cc=nicholas@rothemail.net \
    --cc=nicolas.dufresne@collabora.com \
    --cc=paul.elder@ideasonboard.com \
    --cc=pavel@kernel.org \
    --cc=prabhakar.mahadev-lad.rj@bp.renesas.com \
    --cc=rashanmu@gmail.com \
    --cc=ribalda@chromium.org \
    --cc=sakari.ailus@linux.intel.com \
    --cc=slongerbeam@gmail.com \
    --cc=stanislaw.gruszka@linux.intel.com \
    --cc=tomi.valkeinen@ideasonboard.com \
    --cc=umang.jain@ideasonboard.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).