All of lore.kernel.org
 help / color / mirror / Atom feed
From: Maxime Ripard <maxime.ripard@bootlin.com>
To: Daniel Mack <daniel@zonque.org>
Cc: linux-media@vger.kernel.org, slongerbeam@gmail.com, mchehab@kernel.org
Subject: Re: [PATCH 3/3] media: ov5640: add support for xclk frequency control
Date: Fri, 20 Apr 2018 16:07:18 +0200	[thread overview]
Message-ID: <20180420140718.glvufiaau75oumgp@flea> (raw)
In-Reply-To: <20180420094419.11267-3-daniel@zonque.org>

[-- Attachment #1: Type: text/plain, Size: 2540 bytes --]

Hi,

On Fri, Apr 20, 2018 at 11:44:19AM +0200, Daniel Mack wrote:
> Allow setting the xclk rate via an optional 'clock-frequency' property in
> the device tree node.
> 
> Signed-off-by: Daniel Mack <daniel@zonque.org>
> ---
>  Documentation/devicetree/bindings/media/i2c/ov5640.txt |  2 ++
>  drivers/media/i2c/ov5640.c                             | 10 ++++++++++
>  2 files changed, 12 insertions(+)
> 
> diff --git a/Documentation/devicetree/bindings/media/i2c/ov5640.txt b/Documentation/devicetree/bindings/media/i2c/ov5640.txt
> index 8e36da0d8406..584bbc944978 100644
> --- a/Documentation/devicetree/bindings/media/i2c/ov5640.txt
> +++ b/Documentation/devicetree/bindings/media/i2c/ov5640.txt
> @@ -13,6 +13,8 @@ Optional Properties:
>  	       This is an active low signal to the OV5640.
>  - powerdown-gpios: reference to the GPIO connected to the powerdown pin,
>  		   if any. This is an active high signal to the OV5640.
> +- clock-frequency: frequency to set on the xclk input clock. The clock
> +		   is left untouched if this property is missing.

This can be done through assigned-clocks, right?

>  The device node must contain one 'port' child node for its digital output
>  video port, in accordance with the video interface bindings defined in
> diff --git a/drivers/media/i2c/ov5640.c b/drivers/media/i2c/ov5640.c
> index 78669ed386cd..2d94d6dbda5d 100644
> --- a/drivers/media/i2c/ov5640.c
> +++ b/drivers/media/i2c/ov5640.c
> @@ -2685,6 +2685,7 @@ static int ov5640_probe(struct i2c_client *client,
>  	struct fwnode_handle *endpoint;
>  	struct ov5640_dev *sensor;
>  	struct v4l2_mbus_framefmt *fmt;
> +	u32 freq;
>  	int ret;
>  
>  	sensor = devm_kzalloc(dev, sizeof(*sensor), GFP_KERNEL);
> @@ -2731,6 +2732,15 @@ static int ov5640_probe(struct i2c_client *client,
>  		return PTR_ERR(sensor->xclk);
>  	}
>  
> +	ret = of_property_read_u32(dev->of_node, "clock-frequency", &freq);
> +	if (ret == 0) {
> +		ret = clk_set_rate(sensor->xclk, freq);
> +		if (ret) {
> +			dev_err(dev, "could not set xclk frequency\n");
> +			return ret;
> +		}
> +	}
> +

I'm wondering what the use case for that would be. The clock rate is
subject to various changes depending on the resolution and framerate
used, so that's very likely to change. Wouldn't we be better off to
simply try to change the rate at runtime, depending on those factors?

Maxime

-- 
Maxime Ripard, Bootlin (formerly Free Electrons)
Embedded Linux and Kernel engineering
https://bootlin.com

[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 833 bytes --]

  reply	other threads:[~2018-04-20 14:07 UTC|newest]

Thread overview: 11+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2018-04-20  9:44 [PATCH 1/3] media: ov5640: initialize mode data structs by name Daniel Mack
2018-04-20  9:44 ` [PATCH 2/3] media: ov5640: add PIXEL_RATE and LINK_FREQ controls Daniel Mack
2018-04-20 14:15   ` Maxime Ripard
2018-04-20 14:29     ` Daniel Mack
2018-04-20 19:00       ` Maxime Ripard
2018-04-24 10:22   ` Sakari Ailus
2018-04-24 12:03     ` Daniel Mack
2018-04-26  8:31       ` Sakari Ailus
2018-04-20  9:44 ` [PATCH 3/3] media: ov5640: add support for xclk frequency control Daniel Mack
2018-04-20 14:07   ` Maxime Ripard [this message]
2018-04-24 10:24   ` Sakari Ailus

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=20180420140718.glvufiaau75oumgp@flea \
    --to=maxime.ripard@bootlin.com \
    --cc=daniel@zonque.org \
    --cc=linux-media@vger.kernel.org \
    --cc=mchehab@kernel.org \
    --cc=slongerbeam@gmail.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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.