Skip to content

Commit

Permalink
---
Browse files Browse the repository at this point in the history
yaml
---
r: 176637
b: refs/heads/master
c: 8097b17
h: refs/heads/master
i:
  176635: 0941185
v: v3
  • Loading branch information
Chaithrika U S authored and Linus Torvalds committed Dec 16, 2009
1 parent ad362ef commit 3ca8140
Show file tree
Hide file tree
Showing 2 changed files with 21 additions and 9 deletions.
2 changes: 1 addition & 1 deletion [refs]
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
---
refs/heads/master: 2ec509b96cce5e6d19ee43fdd818eab78e76328d
refs/heads/master: 8097b1749f9265be0f3dbc43c3700da31eb422fd
28 changes: 20 additions & 8 deletions trunk/drivers/video/da8xx-fb.c
Original file line number Diff line number Diff line change
Expand Up @@ -113,6 +113,7 @@ struct da8xx_fb_par {
unsigned short pseudo_palette[16];
unsigned int databuf_sz;
unsigned int palette_sz;
unsigned int pxl_clk;
};

/* Variable Screen Information */
Expand Down Expand Up @@ -155,7 +156,7 @@ struct da8xx_panel {
int vfp; /* Vertical front porch */
int vbp; /* Vertical back porch */
int vsw; /* Vertical Sync Pulse Width */
int pxl_clk; /* Pixel clock */
unsigned int pxl_clk; /* Pixel clock */
unsigned char invert_pxl_clk; /* Invert Pixel clock */
};

Expand All @@ -171,7 +172,7 @@ static struct da8xx_panel known_lcd_panels[] = {
.vfp = 2,
.vbp = 2,
.vsw = 0,
.pxl_clk = 0x10,
.pxl_clk = 4608000,
.invert_pxl_clk = 1,
},
/* Sharp LK043T1DG01 */
Expand All @@ -185,7 +186,7 @@ static struct da8xx_panel known_lcd_panels[] = {
.vfp = 2,
.vbp = 2,
.vsw = 10,
.pxl_clk = 0x12,
.pxl_clk = 7833600,
.invert_pxl_clk = 0,
},
};
Expand Down Expand Up @@ -451,6 +452,18 @@ static void lcd_reset(struct da8xx_fb_par *par)
lcdc_write(0, LCD_RASTER_CTRL_REG);
}

static void lcd_calc_clk_divider(struct da8xx_fb_par *par)
{
unsigned int lcd_clk, div;

lcd_clk = clk_get_rate(par->lcdc_clk);
div = lcd_clk / par->pxl_clk;

/* Configure the LCD clock divisor. */
lcdc_write(LCD_CLK_DIVISOR(div) |
(LCD_RASTER_MODE & 0x1), LCD_CTRL_REG);
}

static int lcd_init(struct da8xx_fb_par *par, const struct lcd_ctrl_config *cfg,
struct da8xx_panel *panel)
{
Expand All @@ -459,9 +472,8 @@ static int lcd_init(struct da8xx_fb_par *par, const struct lcd_ctrl_config *cfg,

lcd_reset(par);

/* Configure the LCD clock divisor. */
lcdc_write(LCD_CLK_DIVISOR(panel->pxl_clk) |
(LCD_RASTER_MODE & 0x1), LCD_CTRL_REG);
/* Calculate the divider */
lcd_calc_clk_divider(par);

if (panel->invert_pxl_clk)
lcdc_write((lcdc_read(LCD_RASTER_TIMING_2_REG) |
Expand Down Expand Up @@ -721,6 +733,8 @@ static int __init fb_probe(struct platform_device *device)
}

par = da8xx_fb_info->par;
par->lcdc_clk = fb_clk;
par->pxl_clk = lcdc_info->pxl_clk;

if (lcd_init(par, lcd_cfg, lcdc_info) < 0) {
dev_err(&device->dev, "lcd_init failed\n");
Expand Down Expand Up @@ -754,8 +768,6 @@ static int __init fb_probe(struct platform_device *device)
da8xx_fb_fix.smem_len = par->databuf_sz - par->palette_sz;
da8xx_fb_fix.line_length = (lcdc_info->width * lcd_cfg->bpp) / 8;

par->lcdc_clk = fb_clk;

par->irq = platform_get_irq(device, 0);
if (par->irq < 0) {
ret = -ENOENT;
Expand Down

0 comments on commit 3ca8140

Please sign in to comment.