All of lore.kernel.org
 help / color / mirror / Atom feed
From: yiffie9819 <yiffie9819@gmail.com>
To: Maurus Cuelenaere <mcuelenaere@gmail.com>
Cc: linux-fbdev@vger.kernel.org, linux-samsung-soc@vger.kernel.org,
	akpm@linux-foundation.org, ben-linux@fluff.org
Subject: Re: [PATCH v2] s3c-fb: Automatically calculate pixel clock when none
Date: Tue, 13 Jul 2010 03:14:49 +0000	[thread overview]
Message-ID: <4C3BDA29.1030205@gmail.com> (raw)
In-Reply-To: <4c3baddb.d37b0e0a.67e4.ffffcb55@mx.google.com>

 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);


WARNING: multiple messages have this Message-ID (diff)
From: yiffie9819 <yiffie9819@gmail.com>
To: Maurus Cuelenaere <mcuelenaere@gmail.com>
Cc: linux-fbdev@vger.kernel.org, linux-samsung-soc@vger.kernel.org,
	akpm@linux-foundation.org, ben-linux@fluff.org
Subject: Re: [PATCH v2] s3c-fb: Automatically calculate pixel clock when none is given
Date: Tue, 13 Jul 2010 12:14:49 +0900	[thread overview]
Message-ID: <4C3BDA29.1030205@gmail.com> (raw)
In-Reply-To: <4c3baddb.d37b0e0a.67e4.ffffcb55@mx.google.com>

 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);

  reply	other threads:[~2010-07-13  3:14 UTC|newest]

Thread overview: 10+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
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 ` yiffie9819 [this message]
2010-07-13  3:14   ` 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

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=4C3BDA29.1030205@gmail.com \
    --to=yiffie9819@gmail.com \
    --cc=akpm@linux-foundation.org \
    --cc=ben-linux@fluff.org \
    --cc=linux-fbdev@vger.kernel.org \
    --cc=linux-samsung-soc@vger.kernel.org \
    --cc=mcuelenaere@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.