All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH v2] s3c-fb: Automatically calculate pixel clock when none is given
@ 2010-07-13  0:05 ` Maurus Cuelenaere
  0 siblings, 0 replies; 10+ messages in thread
From: Maurus Cuelenaere @ 2010-07-13  0:05 UTC (permalink / raw)
  To: linux-fbdev; +Cc: linux-samsung-soc, akpm, ben-linux

This patch adds a simple algorithm which calculates the pixel clock based on the
video mode parameters. This is only done when no pixel clock is supplied through
the platform data.

Signed-off-by: Maurus Cuelenaere <mcuelenaere@gmail.com>
---

Changes since v1:
Re-posted this to the correct fbdev mailing list.

---
 drivers/video/s3c-fb.c |   25 +++++++++++++++++++++++++
 1 files changed, 25 insertions(+), 0 deletions(-)

diff --git a/drivers/video/s3c-fb.c b/drivers/video/s3c-fb.c
index 9682ecc..e4715eb 100644
--- a/drivers/video/s3c-fb.c
+++ b/drivers/video/s3c-fb.c
@@ -654,6 +654,28 @@ static struct fb_ops s3c_fb_ops = {
 };
 
 /**
+ * s3c_fb_missing_pixclock() - calculates pixel clock
+ * @mode: The video mode to change.
+ *
+ * Calculate the pixel clock when none has been given through platform data.
+ */
+static void __devinit s3c_fb_missing_pixclock(struct fb_videomode *mode)
+{
+	u64 pixclk = 1000000000000ULL;
+	u32 div;
+
+	div  = mode->left_margin + mode->hsync_len + mode->right_margin +
+	       mode->xres;
+	div *= mode->upper_margin + mode->vsync_len + mode->lower_margin +
+	       mode->yres;
+	div *= mode->refresh ? : 60;
+
+	do_div(pixclk, div);
+
+	mode->pixclock = pixclk;
+}
+
+/**
  * s3c_fb_alloc_memory() - allocate display memory for framebuffer window
  * @sfb: The base resources for the hardware.
  * @win: The window to initialise memory for.
@@ -925,6 +947,9 @@ static int __devinit s3c_fb_probe(struct platform_device *pdev)
 		if (!pd->win[win])
 			continue;
 
+		if (!pd->win[win]->win_mode.pixclock)
+			s3c_fb_missing_pixclock(&pd->win[win]->win_mode);
+
 		ret = s3c_fb_probe_win(sfb, win, &sfb->windows[win]);
 		if (ret < 0) {
 			dev_err(dev, "failed to create window %d\n", win);
-- 
1.7.0.4


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

* [PATCH v2] s3c-fb: Automatically calculate pixel clock when none is given
@ 2010-07-13  0:05 ` Maurus Cuelenaere
  0 siblings, 0 replies; 10+ messages in thread
From: Maurus Cuelenaere @ 2010-07-13  0:05 UTC (permalink / raw)
  To: linux-fbdev; +Cc: linux-samsung-soc, akpm, ben-linux

This patch adds a simple algorithm which calculates the pixel clock based on the
video mode parameters. This is only done when no pixel clock is supplied through
the platform data.

Signed-off-by: Maurus Cuelenaere <mcuelenaere@gmail.com>
---

Changes since v1:
Re-posted this to the correct fbdev mailing list.

---
 drivers/video/s3c-fb.c |   25 +++++++++++++++++++++++++
 1 files changed, 25 insertions(+), 0 deletions(-)

diff --git a/drivers/video/s3c-fb.c b/drivers/video/s3c-fb.c
index 9682ecc..e4715eb 100644
--- a/drivers/video/s3c-fb.c
+++ b/drivers/video/s3c-fb.c
@@ -654,6 +654,28 @@ static struct fb_ops s3c_fb_ops = {
 };
 
 /**
+ * s3c_fb_missing_pixclock() - calculates pixel clock
+ * @mode: The video mode to change.
+ *
+ * Calculate the pixel clock when none has been given through platform data.
+ */
+static void __devinit s3c_fb_missing_pixclock(struct fb_videomode *mode)
+{
+	u64 pixclk = 1000000000000ULL;
+	u32 div;
+
+	div  = mode->left_margin + mode->hsync_len + mode->right_margin +
+	       mode->xres;
+	div *= mode->upper_margin + mode->vsync_len + mode->lower_margin +
+	       mode->yres;
+	div *= mode->refresh ? : 60;
+
+	do_div(pixclk, div);
+
+	mode->pixclock = pixclk;
+}
+
+/**
  * s3c_fb_alloc_memory() - allocate display memory for framebuffer window
  * @sfb: The base resources for the hardware.
  * @win: The window to initialise memory for.
@@ -925,6 +947,9 @@ static int __devinit s3c_fb_probe(struct platform_device *pdev)
 		if (!pd->win[win])
 			continue;
 
+		if (!pd->win[win]->win_mode.pixclock)
+			s3c_fb_missing_pixclock(&pd->win[win]->win_mode);
+
 		ret = s3c_fb_probe_win(sfb, win, &sfb->windows[win]);
 		if (ret < 0) {
 			dev_err(dev, "failed to create window %d\n", win);
-- 
1.7.0.4

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

* Re: [PATCH v2] s3c-fb: Automatically calculate pixel clock when none
  2010-07-13  0:05 ` Maurus Cuelenaere
@ 2010-07-13  3:14   ` yiffie9819
  -1 siblings, 0 replies; 10+ messages in thread
From: yiffie9819 @ 2010-07-13  3:14 UTC (permalink / raw)
  To: Maurus Cuelenaere; +Cc: linux-fbdev, linux-samsung-soc, akpm, ben-linux

 I tested this patch by using s5pv210.
It is verified by linux-2.6.32.
The result of test is the same pixel clock as before applying patch.

Tested-by: Donghwa Lee <yiffie9819@gmail.com>


2010/7/13 Maurus Cuelenaere <mcuelenaere@gmail.com>
> This patch adds a simple algorithm which calculates the pixel clock based on the
> video mode parameters. This is only done when no pixel clock is supplied through
> the platform data.
>
> Signed-off-by: Maurus Cuelenaere <mcuelenaere@gmail.com>
> ---
>
> Changes since v1:
> Re-posted this to the correct fbdev mailing list.
>
> ---
>  drivers/video/s3c-fb.c |   25 +++++++++++++++++++++++++
>  1 files changed, 25 insertions(+), 0 deletions(-)
>
> diff --git a/drivers/video/s3c-fb.c b/drivers/video/s3c-fb.c
> index 9682ecc..e4715eb 100644
> --- a/drivers/video/s3c-fb.c
> +++ b/drivers/video/s3c-fb.c
> @@ -654,6 +654,28 @@ static struct fb_ops s3c_fb_ops = {
>  };
>  
>  /**
> + * s3c_fb_missing_pixclock() - calculates pixel clock
> + * @mode: The video mode to change.
> + *
> + * Calculate the pixel clock when none has been given through platform data.
> + */
> +static void __devinit s3c_fb_missing_pixclock(struct fb_videomode *mode)
> +{
> +	u64 pixclk = 1000000000000ULL;
> +	u32 div;
> +
> +	div  = mode->left_margin + mode->hsync_len + mode->right_margin +
> +	       mode->xres;
> +	div *= mode->upper_margin + mode->vsync_len + mode->lower_margin +
> +	       mode->yres;
> +	div *= mode->refresh ? : 60;
> +
> +	do_div(pixclk, div);
> +
> +	mode->pixclock = pixclk;
> +}
> +
> +/**
>   * s3c_fb_alloc_memory() - allocate display memory for framebuffer window
>   * @sfb: The base resources for the hardware.
>   * @win: The window to initialise memory for.
> @@ -925,6 +947,9 @@ static int __devinit s3c_fb_probe(struct platform_device *pdev)
>  		if (!pd->win[win])
>  			continue;
>  
> +		if (!pd->win[win]->win_mode.pixclock)
> +			s3c_fb_missing_pixclock(&pd->win[win]->win_mode);
> +
>  		ret = s3c_fb_probe_win(sfb, win, &sfb->windows[win]);
>  		if (ret < 0) {
>  			dev_err(dev, "failed to create window %d\n", win);


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

* Re: [PATCH v2] s3c-fb: Automatically calculate pixel clock when none is given
@ 2010-07-13  3:14   ` yiffie9819
  0 siblings, 0 replies; 10+ messages in thread
From: yiffie9819 @ 2010-07-13  3:14 UTC (permalink / raw)
  To: Maurus Cuelenaere; +Cc: linux-fbdev, linux-samsung-soc, akpm, ben-linux

 I tested this patch by using s5pv210.
It is verified by linux-2.6.32.
The result of test is the same pixel clock as before applying patch.

Tested-by: Donghwa Lee <yiffie9819@gmail.com>


2010/7/13 Maurus Cuelenaere <mcuelenaere@gmail.com>
> This patch adds a simple algorithm which calculates the pixel clock based on the
> video mode parameters. This is only done when no pixel clock is supplied through
> the platform data.
>
> Signed-off-by: Maurus Cuelenaere <mcuelenaere@gmail.com>
> ---
>
> Changes since v1:
> Re-posted this to the correct fbdev mailing list.
>
> ---
>  drivers/video/s3c-fb.c |   25 +++++++++++++++++++++++++
>  1 files changed, 25 insertions(+), 0 deletions(-)
>
> diff --git a/drivers/video/s3c-fb.c b/drivers/video/s3c-fb.c
> index 9682ecc..e4715eb 100644
> --- a/drivers/video/s3c-fb.c
> +++ b/drivers/video/s3c-fb.c
> @@ -654,6 +654,28 @@ static struct fb_ops s3c_fb_ops = {
>  };
>  
>  /**
> + * s3c_fb_missing_pixclock() - calculates pixel clock
> + * @mode: The video mode to change.
> + *
> + * Calculate the pixel clock when none has been given through platform data.
> + */
> +static void __devinit s3c_fb_missing_pixclock(struct fb_videomode *mode)
> +{
> +	u64 pixclk = 1000000000000ULL;
> +	u32 div;
> +
> +	div  = mode->left_margin + mode->hsync_len + mode->right_margin +
> +	       mode->xres;
> +	div *= mode->upper_margin + mode->vsync_len + mode->lower_margin +
> +	       mode->yres;
> +	div *= mode->refresh ? : 60;
> +
> +	do_div(pixclk, div);
> +
> +	mode->pixclock = pixclk;
> +}
> +
> +/**
>   * s3c_fb_alloc_memory() - allocate display memory for framebuffer window
>   * @sfb: The base resources for the hardware.
>   * @win: The window to initialise memory for.
> @@ -925,6 +947,9 @@ static int __devinit s3c_fb_probe(struct platform_device *pdev)
>  		if (!pd->win[win])
>  			continue;
>  
> +		if (!pd->win[win]->win_mode.pixclock)
> +			s3c_fb_missing_pixclock(&pd->win[win]->win_mode);
> +
>  		ret = s3c_fb_probe_win(sfb, win, &sfb->windows[win]);
>  		if (ret < 0) {
>  			dev_err(dev, "failed to create window %d\n", win);

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

* Re: [PATCH v2] s3c-fb: Automatically calculate pixel clock when
  2010-07-13  0:05 ` Maurus Cuelenaere
@ 2010-07-15 18:52   ` Andrew Morton
  -1 siblings, 0 replies; 10+ messages in thread
From: Andrew Morton @ 2010-07-15 18:52 UTC (permalink / raw)
  To: Maurus Cuelenaere; +Cc: linux-fbdev, linux-samsung-soc, ben-linux

On Tue, 13 Jul 2010 02:05:45 +0200
Maurus Cuelenaere <mcuelenaere@gmail.com> wrote:

> This patch adds a simple algorithm which calculates the pixel clock based on the
> video mode parameters. This is only done when no pixel clock is supplied through
> the platform data.
> 

So..  we are to assume that there's a platform which doesn't provide
the pixel clock data?  Adding some information about that in the
changelog would have been useful.

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

* Re: [PATCH v2] s3c-fb: Automatically calculate pixel clock when none is given
@ 2010-07-15 18:52   ` Andrew Morton
  0 siblings, 0 replies; 10+ messages in thread
From: Andrew Morton @ 2010-07-15 18:52 UTC (permalink / raw)
  To: Maurus Cuelenaere; +Cc: linux-fbdev, linux-samsung-soc, ben-linux

On Tue, 13 Jul 2010 02:05:45 +0200
Maurus Cuelenaere <mcuelenaere@gmail.com> wrote:

> This patch adds a simple algorithm which calculates the pixel clock based on the
> video mode parameters. This is only done when no pixel clock is supplied through
> the platform data.
> 

So..  we are to assume that there's a platform which doesn't provide
the pixel clock data?  Adding some information about that in the
changelog would have been useful.

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

* Re: [PATCH v2] s3c-fb: Automatically calculate pixel clock when none
  2010-07-15 18:52   ` [PATCH v2] s3c-fb: Automatically calculate pixel clock when none is given Andrew Morton
@ 2010-07-15 19:23     ` Maurus Cuelenaere
  -1 siblings, 0 replies; 10+ messages in thread
From: Maurus Cuelenaere @ 2010-07-15 19:23 UTC (permalink / raw)
  To: Andrew Morton; +Cc: linux-fbdev, linux-samsung-soc, ben-linux

 Op 15-07-10 20:52, Andrew Morton schreef:
> On Tue, 13 Jul 2010 02:05:45 +0200
> Maurus Cuelenaere <mcuelenaere@gmail.com> wrote:
>
>> This patch adds a simple algorithm which calculates the pixel clock based on the
>> video mode parameters. This is only done when no pixel clock is supplied through
>> the platform data.
>>
> So..  we are to assume that there's a platform which doesn't provide
> the pixel clock data?  Adding some information about that in the
> changelog would have been useful.

Not exactly, this allows you to omit the pixel clock data and thus sharing the
"algo" used for calculating it; which is done in another patch (not submitted to
linux-fbdev, see [1]).

[1] - http://www.spinics.net/lists/linux-samsung-soc/msg02086.html

-- 
Maurus Cuelenaere

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

* Re: [PATCH v2] s3c-fb: Automatically calculate pixel clock when none is given
@ 2010-07-15 19:23     ` Maurus Cuelenaere
  0 siblings, 0 replies; 10+ messages in thread
From: Maurus Cuelenaere @ 2010-07-15 19:23 UTC (permalink / raw)
  To: Andrew Morton; +Cc: linux-fbdev, linux-samsung-soc, ben-linux

 Op 15-07-10 20:52, Andrew Morton schreef:
> On Tue, 13 Jul 2010 02:05:45 +0200
> Maurus Cuelenaere <mcuelenaere@gmail.com> wrote:
>
>> This patch adds a simple algorithm which calculates the pixel clock based on the
>> video mode parameters. This is only done when no pixel clock is supplied through
>> the platform data.
>>
> So..  we are to assume that there's a platform which doesn't provide
> the pixel clock data?  Adding some information about that in the
> changelog would have been useful.

Not exactly, this allows you to omit the pixel clock data and thus sharing the
"algo" used for calculating it; which is done in another patch (not submitted to
linux-fbdev, see [1]).

[1] - http://www.spinics.net/lists/linux-samsung-soc/msg02086.html

-- 
Maurus Cuelenaere

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

* Re: [PATCH v2] s3c-fb: Automatically calculate pixel clock when
  2010-07-15 19:23     ` [PATCH v2] s3c-fb: Automatically calculate pixel clock when none is given Maurus Cuelenaere
@ 2010-07-15 19:37       ` Andrew Morton
  -1 siblings, 0 replies; 10+ messages in thread
From: Andrew Morton @ 2010-07-15 19:37 UTC (permalink / raw)
  To: Maurus Cuelenaere; +Cc: linux-fbdev, linux-samsung-soc, ben-linux

On Thu, 15 Jul 2010 21:23:15 +0200
Maurus Cuelenaere <mcuelenaere@gmail.com> wrote:

>  Op 15-07-10 20:52, Andrew Morton schreef:
> > On Tue, 13 Jul 2010 02:05:45 +0200
> > Maurus Cuelenaere <mcuelenaere@gmail.com> wrote:
> >
> >> This patch adds a simple algorithm which calculates the pixel clock based on the
> >> video mode parameters. This is only done when no pixel clock is supplied through
> >> the platform data.
> >>
> > So..  we are to assume that there's a platform which doesn't provide
> > the pixel clock data?  Adding some information about that in the
> > changelog would have been useful.
> 
> Not exactly, this allows you to omit the pixel clock data and thus sharing the
> "algo" used for calculating it; which is done in another patch (not submitted to
> linux-fbdev, see [1]).
> 
> [1] - http://www.spinics.net/lists/linux-samsung-soc/msg02086.html
> 

That means that there's no reason to merge this patch!

So I merged "arm: samsung: remove pixclock from several boards" as well ;)

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

* Re: [PATCH v2] s3c-fb: Automatically calculate pixel clock when none is given
@ 2010-07-15 19:37       ` Andrew Morton
  0 siblings, 0 replies; 10+ messages in thread
From: Andrew Morton @ 2010-07-15 19:37 UTC (permalink / raw)
  To: Maurus Cuelenaere; +Cc: linux-fbdev, linux-samsung-soc, ben-linux

On Thu, 15 Jul 2010 21:23:15 +0200
Maurus Cuelenaere <mcuelenaere@gmail.com> wrote:

>  Op 15-07-10 20:52, Andrew Morton schreef:
> > On Tue, 13 Jul 2010 02:05:45 +0200
> > Maurus Cuelenaere <mcuelenaere@gmail.com> wrote:
> >
> >> This patch adds a simple algorithm which calculates the pixel clock based on the
> >> video mode parameters. This is only done when no pixel clock is supplied through
> >> the platform data.
> >>
> > So..  we are to assume that there's a platform which doesn't provide
> > the pixel clock data?  Adding some information about that in the
> > changelog would have been useful.
> 
> Not exactly, this allows you to omit the pixel clock data and thus sharing the
> "algo" used for calculating it; which is done in another patch (not submitted to
> linux-fbdev, see [1]).
> 
> [1] - http://www.spinics.net/lists/linux-samsung-soc/msg02086.html
> 

That means that there's no reason to merge this patch!

So I merged "arm: samsung: remove pixclock from several boards" as well ;)

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

end of thread, other threads:[~2010-07-15 19:37 UTC | newest]

Thread overview: 10+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2010-07-13  0:05 [PATCH v2] s3c-fb: Automatically calculate pixel clock when none is given Maurus Cuelenaere
2010-07-13  0:05 ` Maurus Cuelenaere
2010-07-13  3:14 ` [PATCH v2] s3c-fb: Automatically calculate pixel clock when none yiffie9819
2010-07-13  3:14   ` [PATCH v2] s3c-fb: Automatically calculate pixel clock when none is given yiffie9819
2010-07-15 18:52 ` [PATCH v2] s3c-fb: Automatically calculate pixel clock when Andrew Morton
2010-07-15 18:52   ` [PATCH v2] s3c-fb: Automatically calculate pixel clock when none is given Andrew Morton
2010-07-15 19:23   ` [PATCH v2] s3c-fb: Automatically calculate pixel clock when none Maurus Cuelenaere
2010-07-15 19:23     ` [PATCH v2] s3c-fb: Automatically calculate pixel clock when none is given Maurus Cuelenaere
2010-07-15 19:37     ` [PATCH v2] s3c-fb: Automatically calculate pixel clock when Andrew Morton
2010-07-15 19:37       ` [PATCH v2] s3c-fb: Automatically calculate pixel clock when none is given Andrew Morton

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.