All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH v3 1/1] media: i2c: imx219: add 1% tolerance on clock frequency
@ 2020-12-22  9:32 michael.srba
  2021-02-02 22:55 ` Sakari Ailus
  0 siblings, 1 reply; 2+ messages in thread
From: michael.srba @ 2020-12-22  9:32 UTC (permalink / raw)
  To: Dave Stevenson, Mauro Carvalho Chehab; +Cc: linux-media, Michael Srba

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) {
 		dev_err(dev, "xclk frequency not supported: %d Hz\n",
 			imx219->xclk_freq);
 		return -EINVAL;
-- 
2.29.2


^ permalink raw reply related	[flat|nested] 2+ messages in thread

* Re: [PATCH v3 1/1] media: i2c: imx219: add 1% tolerance on clock frequency
  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
  0 siblings, 0 replies; 2+ messages in thread
From: Sakari Ailus @ 2021-02-02 22:55 UTC (permalink / raw)
  To: michael.srba
  Cc: Dave Stevenson, Mauro Carvalho Chehab, linux-media, Laurent Pinchart

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

^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2021-02-02 22:56 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
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 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.