diff options
| -rw-r--r-- | drivers/video/s3c-fb.c | 14 |
1 files changed, 8 insertions, 6 deletions
diff --git a/drivers/video/s3c-fb.c b/drivers/video/s3c-fb.c index adf9632c6b1f..53cb722c45a0 100644 --- a/drivers/video/s3c-fb.c +++ b/drivers/video/s3c-fb.c | |||
| @@ -211,21 +211,23 @@ static int s3c_fb_check_var(struct fb_var_screeninfo *var, | |||
| 211 | 211 | ||
| 212 | /** | 212 | /** |
| 213 | * s3c_fb_calc_pixclk() - calculate the divider to create the pixel clock. | 213 | * s3c_fb_calc_pixclk() - calculate the divider to create the pixel clock. |
| 214 | * @id: window id. | ||
| 215 | * @sfb: The hardware state. | 214 | * @sfb: The hardware state. |
| 216 | * @pixclock: The pixel clock wanted, in picoseconds. | 215 | * @pixclock: The pixel clock wanted, in picoseconds. |
| 217 | * | 216 | * |
| 218 | * Given the specified pixel clock, work out the necessary divider to get | 217 | * Given the specified pixel clock, work out the necessary divider to get |
| 219 | * close to the output frequency. | 218 | * close to the output frequency. |
| 220 | */ | 219 | */ |
| 221 | static int s3c_fb_calc_pixclk(unsigned char id, struct s3c_fb *sfb, unsigned int pixclk) | 220 | static int s3c_fb_calc_pixclk(struct s3c_fb *sfb, unsigned int pixclk) |
| 222 | { | 221 | { |
| 223 | struct s3c_fb_pd_win *win = sfb->pdata->win[id]; | ||
| 224 | unsigned long clk = clk_get_rate(sfb->bus_clk); | 222 | unsigned long clk = clk_get_rate(sfb->bus_clk); |
| 223 | unsigned long long tmp; | ||
| 225 | unsigned int result; | 224 | unsigned int result; |
| 226 | 225 | ||
| 227 | pixclk *= win->win_mode.refresh; | 226 | tmp = (unsigned long long)clk; |
| 228 | result = clk / pixclk; | 227 | tmp *= pixclk; |
| 228 | |||
| 229 | do_div(tmp, 1000000000UL); | ||
| 230 | result = (unsigned int)tmp / 1000; | ||
| 229 | 231 | ||
| 230 | dev_dbg(sfb->dev, "pixclk=%u, clk=%lu, div=%d (%lu)\n", | 232 | dev_dbg(sfb->dev, "pixclk=%u, clk=%lu, div=%d (%lu)\n", |
| 231 | pixclk, clk, result, clk / result); | 233 | pixclk, clk, result, clk / result); |
| @@ -301,7 +303,7 @@ static int s3c_fb_set_par(struct fb_info *info) | |||
| 301 | /* use window 0 as the basis for the lcd output timings */ | 303 | /* use window 0 as the basis for the lcd output timings */ |
| 302 | 304 | ||
| 303 | if (win_no == 0) { | 305 | if (win_no == 0) { |
| 304 | clkdiv = s3c_fb_calc_pixclk(win_no, sfb, var->pixclock); | 306 | clkdiv = s3c_fb_calc_pixclk(sfb, var->pixclock); |
| 305 | 307 | ||
| 306 | data = sfb->pdata->vidcon0; | 308 | data = sfb->pdata->vidcon0; |
| 307 | data &= ~(VIDCON0_CLKVAL_F_MASK | VIDCON0_CLKDIR); | 309 | data &= ~(VIDCON0_CLKVAL_F_MASK | VIDCON0_CLKDIR); |
