All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH] [media] mt9p031: fixed calculation of clk_div
@ 2015-02-04 14:53 Enrico Scholz
  2015-02-04 17:19 ` Laurent Pinchart
  2015-02-04 17:51 ` [PATCH v2] " Enrico Scholz
  0 siblings, 2 replies; 5+ messages in thread
From: Enrico Scholz @ 2015-02-04 14:53 UTC (permalink / raw)
  To: linux-media; +Cc: Enrico Scholz, Laurent Pinchart

There must be used 'min_t', not 'max_t' for calculating the divider and
the upper limit is '63' (value uses 6:0 register bits).

Signed-off-by: Enrico Scholz <enrico.scholz@sigma-chemnitz.de>
Cc: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
---
 drivers/media/i2c/mt9p031.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/media/i2c/mt9p031.c b/drivers/media/i2c/mt9p031.c
index 0cabf91..43ee299 100644
--- a/drivers/media/i2c/mt9p031.c
+++ b/drivers/media/i2c/mt9p031.c
@@ -254,7 +254,7 @@ static int mt9p031_clk_setup(struct mt9p031 *mt9p031)
 		div = DIV_ROUND_UP(ext_freq, pdata->target_freq);
 		div = roundup_pow_of_two(div) / 2;
 
-		mt9p031->clk_div = max_t(unsigned int, div, 64);
+		mt9p031->clk_div = min_t(unsigned int, div, 63);
 		mt9p031->use_pll = false;
 
 		return 0;
-- 
2.1.0


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

* Re: [PATCH] [media] mt9p031: fixed calculation of clk_div
  2015-02-04 14:53 [PATCH] [media] mt9p031: fixed calculation of clk_div Enrico Scholz
@ 2015-02-04 17:19 ` Laurent Pinchart
  2015-02-04 17:54   ` Enrico Scholz
  2015-02-04 17:51 ` [PATCH v2] " Enrico Scholz
  1 sibling, 1 reply; 5+ messages in thread
From: Laurent Pinchart @ 2015-02-04 17:19 UTC (permalink / raw)
  To: Enrico Scholz; +Cc: linux-media

Hi Enrico,

Thank you for the patch.

On Wednesday 04 February 2015 15:53:32 Enrico Scholz wrote:
> There must be used 'min_t', not 'max_t' for calculating the divider

That I agree with.

> and the upper limit is '63' (value uses 6:0 register bits).

And this I don't. You can encode numbers from 0 to 127 on 7 bits.

> Signed-off-by: Enrico Scholz <enrico.scholz@sigma-chemnitz.de>
> Cc: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
> ---
>  drivers/media/i2c/mt9p031.c | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
> 
> diff --git a/drivers/media/i2c/mt9p031.c b/drivers/media/i2c/mt9p031.c
> index 0cabf91..43ee299 100644
> --- a/drivers/media/i2c/mt9p031.c
> +++ b/drivers/media/i2c/mt9p031.c
> @@ -254,7 +254,7 @@ static int mt9p031_clk_setup(struct mt9p031 *mt9p031)
>  		div = DIV_ROUND_UP(ext_freq, pdata->target_freq);
>  		div = roundup_pow_of_two(div) / 2;
> 
> -		mt9p031->clk_div = max_t(unsigned int, div, 64);
> +		mt9p031->clk_div = min_t(unsigned int, div, 63);
>  		mt9p031->use_pll = false;
> 
>  		return 0;

-- 
Regards,

Laurent Pinchart


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

* [PATCH v2] [media] mt9p031: fixed calculation of clk_div
  2015-02-04 14:53 [PATCH] [media] mt9p031: fixed calculation of clk_div Enrico Scholz
  2015-02-04 17:19 ` Laurent Pinchart
@ 2015-02-04 17:51 ` Enrico Scholz
  2015-02-05 12:01   ` Laurent Pinchart
  1 sibling, 1 reply; 5+ messages in thread
From: Enrico Scholz @ 2015-02-04 17:51 UTC (permalink / raw)
  To: linux-media; +Cc: Enrico Scholz, Laurent Pinchart

There must be used 'min_t', not 'max_t' for calculating the divider.

Signed-off-by: Enrico Scholz <enrico.scholz@sigma-chemnitz.de>
Cc: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
---
 drivers/media/i2c/mt9p031.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/media/i2c/mt9p031.c b/drivers/media/i2c/mt9p031.c
index 0cabf91..43ee299 100644
--- a/drivers/media/i2c/mt9p031.c
+++ b/drivers/media/i2c/mt9p031.c
@@ -254,7 +254,7 @@ static int mt9p031_clk_setup(struct mt9p031 *mt9p031)
 		div = DIV_ROUND_UP(ext_freq, pdata->target_freq);
 		div = roundup_pow_of_two(div) / 2;
 
-		mt9p031->clk_div = max_t(unsigned int, div, 64);
+		mt9p031->clk_div = min_t(unsigned int, div, 64);
 		mt9p031->use_pll = false;
 
 		return 0;
-- 
2.1.0


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

* Re: [PATCH] [media] mt9p031: fixed calculation of clk_div
  2015-02-04 17:19 ` Laurent Pinchart
@ 2015-02-04 17:54   ` Enrico Scholz
  0 siblings, 0 replies; 5+ messages in thread
From: Enrico Scholz @ 2015-02-04 17:54 UTC (permalink / raw)
  To: Laurent Pinchart; +Cc: linux-media

Laurent Pinchart <laurent.pinchart@ideasonboard.com> writes:

>> and the upper limit is '63' (value uses 6:0 register bits).
>
> And this I don't. You can encode numbers from 0 to 127 on 7 bits.

yes; you are right (original '64' was correct because sensor allows only
dividers of a power-of-two).

>> -		mt9p031->clk_div = max_t(unsigned int, div, 64);
>> +		mt9p031->clk_div = min_t(unsigned int, div, 63);


Enrico

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

* Re: [PATCH v2] [media] mt9p031: fixed calculation of clk_div
  2015-02-04 17:51 ` [PATCH v2] " Enrico Scholz
@ 2015-02-05 12:01   ` Laurent Pinchart
  0 siblings, 0 replies; 5+ messages in thread
From: Laurent Pinchart @ 2015-02-05 12:01 UTC (permalink / raw)
  To: Enrico Scholz; +Cc: linux-media

Hi Enrico,

Thank you for the patch.

On Wednesday 04 February 2015 18:51:10 Enrico Scholz wrote:
> There must be used 'min_t', not 'max_t' for calculating the divider.
> 
> Signed-off-by: Enrico Scholz <enrico.scholz@sigma-chemnitz.de>
> Cc: Laurent Pinchart <laurent.pinchart@ideasonboard.com>

Acked-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>

and applied to my tree. I'll send a pull request for v3.21.

> ---
>  drivers/media/i2c/mt9p031.c | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
> 
> diff --git a/drivers/media/i2c/mt9p031.c b/drivers/media/i2c/mt9p031.c
> index 0cabf91..43ee299 100644
> --- a/drivers/media/i2c/mt9p031.c
> +++ b/drivers/media/i2c/mt9p031.c
> @@ -254,7 +254,7 @@ static int mt9p031_clk_setup(struct mt9p031 *mt9p031)
>  		div = DIV_ROUND_UP(ext_freq, pdata->target_freq);
>  		div = roundup_pow_of_two(div) / 2;
> 
> -		mt9p031->clk_div = max_t(unsigned int, div, 64);
> +		mt9p031->clk_div = min_t(unsigned int, div, 64);
>  		mt9p031->use_pll = false;
> 
>  		return 0;

-- 
Regards,

Laurent Pinchart


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

end of thread, other threads:[~2015-02-05 12:00 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2015-02-04 14:53 [PATCH] [media] mt9p031: fixed calculation of clk_div Enrico Scholz
2015-02-04 17:19 ` Laurent Pinchart
2015-02-04 17:54   ` Enrico Scholz
2015-02-04 17:51 ` [PATCH v2] " Enrico Scholz
2015-02-05 12:01   ` Laurent Pinchart

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.