Skip to content

Commit f772fab

Browse files
Manjunathappa, Prakashtomba
authored andcommitted
da8xx-fb: adopt fb_videomode data for panel information
Adopt fb_videomode data instead of defining driver private structure to hold panel information. This is the way standard FB drivers maintain the panel information. Signed-off-by: Manjunathappa, Prakash <prakash.pm@ti.com> Signed-off-by: Tomi Valkeinen <tomi.valkeinen@ti.com>
1 parent 38ab331 commit f772fab

2 files changed

Lines changed: 63 additions & 70 deletions

File tree

‎drivers/video/da8xx-fb.c‎

Lines changed: 60 additions & 70 deletions
Original file line numberDiff line numberDiff line change
@@ -213,62 +213,50 @@ static struct fb_fix_screeninfo da8xx_fb_fix __devinitdata = {
213213
.accel = FB_ACCEL_NONE
214214
};
215215

216-
struct da8xx_panel {
217-
const char name[25]; /* Full name <vendor>_<model> */
218-
unsigned short width;
219-
unsigned short height;
220-
int hfp; /* Horizontal front porch */
221-
int hbp; /* Horizontal back porch */
222-
int hsw; /* Horizontal Sync Pulse Width */
223-
int vfp; /* Vertical front porch */
224-
int vbp; /* Vertical back porch */
225-
int vsw; /* Vertical Sync Pulse Width */
226-
unsigned int pxl_clk; /* Pixel clock */
227-
unsigned char invert_pxl_clk; /* Invert Pixel clock */
228-
};
229-
230-
static struct da8xx_panel known_lcd_panels[] = {
216+
static struct fb_videomode known_lcd_panels[] = {
231217
/* Sharp LCD035Q3DG01 */
232218
[0] = {
233-
.name = "Sharp_LCD035Q3DG01",
234-
.width = 320,
235-
.height = 240,
236-
.hfp = 8,
237-
.hbp = 6,
238-
.hsw = 0,
239-
.vfp = 2,
240-
.vbp = 2,
241-
.vsw = 0,
242-
.pxl_clk = 4608000,
243-
.invert_pxl_clk = 1,
219+
.name = "Sharp_LCD035Q3DG01",
220+
.xres = 320,
221+
.yres = 240,
222+
.pixclock = 4608000,
223+
.left_margin = 6,
224+
.right_margin = 8,
225+
.upper_margin = 2,
226+
.lower_margin = 2,
227+
.hsync_len = 0,
228+
.vsync_len = 0,
229+
.sync = FB_SYNC_CLK_INVERT,
244230
},
245231
/* Sharp LK043T1DG01 */
246232
[1] = {
247-
.name = "Sharp_LK043T1DG01",
248-
.width = 480,
249-
.height = 272,
250-
.hfp = 2,
251-
.hbp = 2,
252-
.hsw = 41,
253-
.vfp = 2,
254-
.vbp = 2,
255-
.vsw = 10,
256-
.pxl_clk = 7833600,
257-
.invert_pxl_clk = 0,
233+
.name = "Sharp_LK043T1DG01",
234+
.xres = 480,
235+
.yres = 272,
236+
.pixclock = 7833600,
237+
.left_margin = 2,
238+
.right_margin = 2,
239+
.upper_margin = 2,
240+
.lower_margin = 2,
241+
.hsync_len = 41,
242+
.vsync_len = 10,
243+
.sync = 0,
244+
.flag = 0,
258245
},
259246
[2] = {
260247
/* Hitachi SP10Q010 */
261-
.name = "SP10Q010",
262-
.width = 320,
263-
.height = 240,
264-
.hfp = 10,
265-
.hbp = 10,
266-
.hsw = 10,
267-
.vfp = 10,
268-
.vbp = 10,
269-
.vsw = 10,
270-
.pxl_clk = 7833600,
271-
.invert_pxl_clk = 0,
248+
.name = "SP10Q010",
249+
.xres = 320,
250+
.yres = 240,
251+
.pixclock = 7833600,
252+
.left_margin = 10,
253+
.right_margin = 10,
254+
.upper_margin = 10,
255+
.lower_margin = 10,
256+
.hsync_len = 10,
257+
.vsync_len = 10,
258+
.sync = 0,
259+
.flag = 0,
272260
},
273261
};
274262

@@ -728,7 +716,7 @@ static void lcd_calc_clk_divider(struct da8xx_fb_par *par)
728716
}
729717

730718
static int lcd_init(struct da8xx_fb_par *par, const struct lcd_ctrl_config *cfg,
731-
struct da8xx_panel *panel)
719+
struct fb_videomode *panel)
732720
{
733721
u32 bpp;
734722
int ret = 0;
@@ -738,7 +726,7 @@ static int lcd_init(struct da8xx_fb_par *par, const struct lcd_ctrl_config *cfg,
738726
/* Calculate the divider */
739727
lcd_calc_clk_divider(par);
740728

741-
if (panel->invert_pxl_clk)
729+
if (panel->sync & FB_SYNC_CLK_INVERT)
742730
lcdc_write((lcdc_read(LCD_RASTER_TIMING_2_REG) |
743731
LCD_INVERT_PIXEL_CLOCK), LCD_RASTER_TIMING_2_REG);
744732
else
@@ -754,8 +742,10 @@ static int lcd_init(struct da8xx_fb_par *par, const struct lcd_ctrl_config *cfg,
754742
lcd_cfg_ac_bias(cfg->ac_bias, cfg->ac_bias_intrpt);
755743

756744
/* Configure the vertical and horizontal sync properties. */
757-
lcd_cfg_vertical_sync(panel->vbp, panel->vsw, panel->vfp);
758-
lcd_cfg_horizontal_sync(panel->hbp, panel->hsw, panel->hfp);
745+
lcd_cfg_vertical_sync(panel->lower_margin, panel->vsync_len,
746+
panel->upper_margin);
747+
lcd_cfg_horizontal_sync(panel->right_margin, panel->hsync_len,
748+
panel->left_margin);
759749

760750
/* Configure for disply */
761751
ret = lcd_cfg_display(cfg);
@@ -772,8 +762,8 @@ static int lcd_init(struct da8xx_fb_par *par, const struct lcd_ctrl_config *cfg,
772762
bpp = cfg->p_disp_panel->max_bpp;
773763
if (bpp == 12)
774764
bpp = 16;
775-
ret = lcd_cfg_frame_buffer(par, (unsigned int)panel->width,
776-
(unsigned int)panel->height, bpp,
765+
ret = lcd_cfg_frame_buffer(par, (unsigned int)panel->xres,
766+
(unsigned int)panel->yres, bpp,
777767
cfg->raster_order);
778768
if (ret < 0)
779769
return ret;
@@ -1235,7 +1225,7 @@ static int __devinit fb_probe(struct platform_device *device)
12351225
struct da8xx_lcdc_platform_data *fb_pdata =
12361226
device->dev.platform_data;
12371227
struct lcd_ctrl_config *lcd_cfg;
1238-
struct da8xx_panel *lcdc_info;
1228+
struct fb_videomode *lcdc_info;
12391229
struct fb_info *da8xx_fb_info;
12401230
struct clk *fb_clk = NULL;
12411231
struct da8xx_fb_par *par;
@@ -1323,7 +1313,7 @@ static int __devinit fb_probe(struct platform_device *device)
13231313
#ifdef CONFIG_CPU_FREQ
13241314
par->lcd_fck_rate = clk_get_rate(fb_clk);
13251315
#endif
1326-
par->pxl_clk = lcdc_info->pxl_clk;
1316+
par->pxl_clk = lcdc_info->pixclock;
13271317
if (fb_pdata->panel_power_ctrl) {
13281318
par->panel_power_ctrl = fb_pdata->panel_power_ctrl;
13291319
par->panel_power_ctrl(1);
@@ -1336,8 +1326,8 @@ static int __devinit fb_probe(struct platform_device *device)
13361326
}
13371327

13381328
/* allocate frame buffer */
1339-
par->vram_size = lcdc_info->width * lcdc_info->height * lcd_cfg->bpp;
1340-
ulcm = lcm((lcdc_info->width * lcd_cfg->bpp)/8, PAGE_SIZE);
1329+
par->vram_size = lcdc_info->xres * lcdc_info->yres * lcd_cfg->bpp;
1330+
ulcm = lcm((lcdc_info->xres * lcd_cfg->bpp)/8, PAGE_SIZE);
13411331
par->vram_size = roundup(par->vram_size/8, ulcm);
13421332
par->vram_size = par->vram_size * LCD_NUM_BUFFERS;
13431333

@@ -1355,10 +1345,10 @@ static int __devinit fb_probe(struct platform_device *device)
13551345
da8xx_fb_info->screen_base = (char __iomem *) par->vram_virt;
13561346
da8xx_fb_fix.smem_start = par->vram_phys;
13571347
da8xx_fb_fix.smem_len = par->vram_size;
1358-
da8xx_fb_fix.line_length = (lcdc_info->width * lcd_cfg->bpp) / 8;
1348+
da8xx_fb_fix.line_length = (lcdc_info->xres * lcd_cfg->bpp) / 8;
13591349

13601350
par->dma_start = par->vram_phys;
1361-
par->dma_end = par->dma_start + lcdc_info->height *
1351+
par->dma_end = par->dma_start + lcdc_info->yres *
13621352
da8xx_fb_fix.line_length - 1;
13631353

13641354
/* allocate palette buffer */
@@ -1384,22 +1374,22 @@ static int __devinit fb_probe(struct platform_device *device)
13841374
/* Initialize par */
13851375
da8xx_fb_info->var.bits_per_pixel = lcd_cfg->bpp;
13861376

1387-
da8xx_fb_var.xres = lcdc_info->width;
1388-
da8xx_fb_var.xres_virtual = lcdc_info->width;
1377+
da8xx_fb_var.xres = lcdc_info->xres;
1378+
da8xx_fb_var.xres_virtual = lcdc_info->xres;
13891379

1390-
da8xx_fb_var.yres = lcdc_info->height;
1391-
da8xx_fb_var.yres_virtual = lcdc_info->height * LCD_NUM_BUFFERS;
1380+
da8xx_fb_var.yres = lcdc_info->yres;
1381+
da8xx_fb_var.yres_virtual = lcdc_info->yres * LCD_NUM_BUFFERS;
13921382

13931383
da8xx_fb_var.grayscale =
13941384
lcd_cfg->p_disp_panel->panel_shade == MONOCHROME ? 1 : 0;
13951385
da8xx_fb_var.bits_per_pixel = lcd_cfg->bpp;
13961386

1397-
da8xx_fb_var.hsync_len = lcdc_info->hsw;
1398-
da8xx_fb_var.vsync_len = lcdc_info->vsw;
1399-
da8xx_fb_var.right_margin = lcdc_info->hfp;
1400-
da8xx_fb_var.left_margin = lcdc_info->hbp;
1401-
da8xx_fb_var.lower_margin = lcdc_info->vfp;
1402-
da8xx_fb_var.upper_margin = lcdc_info->vbp;
1387+
da8xx_fb_var.hsync_len = lcdc_info->hsync_len;
1388+
da8xx_fb_var.vsync_len = lcdc_info->vsync_len;
1389+
da8xx_fb_var.right_margin = lcdc_info->right_margin;
1390+
da8xx_fb_var.left_margin = lcdc_info->left_margin;
1391+
da8xx_fb_var.lower_margin = lcdc_info->lower_margin;
1392+
da8xx_fb_var.upper_margin = lcdc_info->upper_margin;
14031393
da8xx_fb_var.pixclock = da8xxfb_pixel_clk_period(par);
14041394

14051395
/* Initialize fbinfo */

‎include/video/da8xx-fb.h‎

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -103,5 +103,8 @@ struct lcd_sync_arg {
103103
#define FBIPUT_HSYNC _IOW('F', 9, int)
104104
#define FBIPUT_VSYNC _IOW('F', 10, int)
105105

106+
/* Proprietary FB_SYNC_ flags */
107+
#define FB_SYNC_CLK_INVERT 0x40000000
108+
106109
#endif /* ifndef DA8XX_FB_H */
107110

0 commit comments

Comments
 (0)