All of lore.kernel.org
 help / color / mirror / Atom feed
From: Sakari Ailus <sakari.ailus@iki.fi>
To: michael.srba@seznam.cz
Cc: Dave Stevenson <dave.stevenson@raspberrypi.com>,
	Mauro Carvalho Chehab <mchehab@kernel.org>,
	linux-media@vger.kernel.org,
	Laurent Pinchart <laurent.pinchart@ideasonboard.com>
Subject: Re: [PATCH v3 1/1] media: i2c: imx219: add 1% tolerance on clock frequency
Date: Wed, 3 Feb 2021 00:55:57 +0200	[thread overview]
Message-ID: <20210202225556.GF3@valkosipuli.retiisi.org.uk> (raw)
In-Reply-To: <20201222093231.13438-1-michael.srba@seznam.cz>

Hi Michael,

On Tue, Dec 22, 2020 at 10:32:31AM +0100, michael.srba@seznam.cz wrote:
> From: Michael Srba <Michael.Srba@seznam.cz>
> 
> This patch adds 1% tolerance on input clock frequency, similar to other
> camera sensor drivers.
> 
> Signed-off-by: Michael Srba <Michael.Srba@seznam.cz>
> 
> ---
> 
> changes since v1: default to exactly 24MHz when `clock-frequency` is not 
> present
> changes since v2: remove the ability to set the clock to a specific
> frequency, since assigned-clocks + assigned-clock-rates can be used 1:1
> for the same purpose
> 
> ---
>  drivers/media/i2c/imx219.c | 3 ++-
>  1 file changed, 2 insertions(+), 1 deletion(-)
> 
> diff --git a/drivers/media/i2c/imx219.c b/drivers/media/i2c/imx219.c
> index f64c0ef7a897..fd2157eadac4 100644
> --- a/drivers/media/i2c/imx219.c
> +++ b/drivers/media/i2c/imx219.c
> @@ -1443,8 +1443,9 @@ static int imx219_probe(struct i2c_client *client)
>  		return PTR_ERR(imx219->xclk);
>  	}
>  
> +	/* this driver currently expects 24MHz; allow 1% tolerance */
>  	imx219->xclk_freq = clk_get_rate(imx219->xclk);
> -	if (imx219->xclk_freq != IMX219_XCLK_FREQ) {
> +	if (imx219->xclk_freq < 23760000 || imx219->xclk_freq > 24240000) {

Where do you need this? Do you have a system where you get a frequency
that's a bit off?

I don't think this is the right way to fix this but on the other hand for
register list based drivers there hardly is one.

>  		dev_err(dev, "xclk frequency not supported: %d Hz\n",
>  			imx219->xclk_freq);
>  		return -EINVAL;

-- 
Regards,

Sakari Ailus

      reply	other threads:[~2021-02-02 22:56 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-12-22  9:32 [PATCH v3 1/1] media: i2c: imx219: add 1% tolerance on clock frequency michael.srba
2021-02-02 22:55 ` Sakari Ailus [this message]

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=20210202225556.GF3@valkosipuli.retiisi.org.uk \
    --to=sakari.ailus@iki.fi \
    --cc=dave.stevenson@raspberrypi.com \
    --cc=laurent.pinchart@ideasonboard.com \
    --cc=linux-media@vger.kernel.org \
    --cc=mchehab@kernel.org \
    --cc=michael.srba@seznam.cz \
    /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.