diff options
author | Manjunathappa, Prakash <prakash.pm@ti.com> | 2012-10-16 00:53:15 -0400 |
---|---|---|
committer | Tomi Valkeinen <tomi.valkeinen@ti.com> | 2012-11-27 04:47:53 -0500 |
commit | f772fabdf72aec5ef05988dd82dfd150e58f7aa3 (patch) | |
tree | cd6fe6ff918f5fce3accd8437787688c65651c20 /drivers/video/da8xx-fb.c | |
parent | 38ab331aa27cb35a4bd01ab1addd63ee0dccd9b2 (diff) |
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>
Diffstat (limited to 'drivers/video/da8xx-fb.c')
-rw-r--r-- | drivers/video/da8xx-fb.c | 130 |
1 files changed, 60 insertions, 70 deletions
diff --git a/drivers/video/da8xx-fb.c b/drivers/video/da8xx-fb.c index 80665f66ac1a..c3db0366d59f 100644 --- a/drivers/video/da8xx-fb.c +++ b/drivers/video/da8xx-fb.c | |||
@@ -213,62 +213,50 @@ static struct fb_fix_screeninfo da8xx_fb_fix __devinitdata = { | |||
213 | .accel = FB_ACCEL_NONE | 213 | .accel = FB_ACCEL_NONE |
214 | }; | 214 | }; |
215 | 215 | ||
216 | struct da8xx_panel { | 216 | static struct fb_videomode known_lcd_panels[] = { |
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[] = { | ||
231 | /* Sharp LCD035Q3DG01 */ | 217 | /* Sharp LCD035Q3DG01 */ |
232 | [0] = { | 218 | [0] = { |
233 | .name = "Sharp_LCD035Q3DG01", | 219 | .name = "Sharp_LCD035Q3DG01", |
234 | .width = 320, | 220 | .xres = 320, |
235 | .height = 240, | 221 | .yres = 240, |
236 | .hfp = 8, | 222 | .pixclock = 4608000, |
237 | .hbp = 6, | 223 | .left_margin = 6, |
238 | .hsw = 0, | 224 | .right_margin = 8, |
239 | .vfp = 2, | 225 | .upper_margin = 2, |
240 | .vbp = 2, | 226 | .lower_margin = 2, |
241 | .vsw = 0, | 227 | .hsync_len = 0, |
242 | .pxl_clk = 4608000, | 228 | .vsync_len = 0, |
243 | .invert_pxl_clk = 1, | 229 | .sync = FB_SYNC_CLK_INVERT, |
244 | }, | 230 | }, |
245 | /* Sharp LK043T1DG01 */ | 231 | /* Sharp LK043T1DG01 */ |
246 | [1] = { | 232 | [1] = { |
247 | .name = "Sharp_LK043T1DG01", | 233 | .name = "Sharp_LK043T1DG01", |
248 | .width = 480, | 234 | .xres = 480, |
249 | .height = 272, | 235 | .yres = 272, |
250 | .hfp = 2, | 236 | .pixclock = 7833600, |
251 | .hbp = 2, | 237 | .left_margin = 2, |
252 | .hsw = 41, | 238 | .right_margin = 2, |
253 | .vfp = 2, | 239 | .upper_margin = 2, |
254 | .vbp = 2, | 240 | .lower_margin = 2, |
255 | .vsw = 10, | 241 | .hsync_len = 41, |
256 | .pxl_clk = 7833600, | 242 | .vsync_len = 10, |
257 | .invert_pxl_clk = 0, | 243 | .sync = 0, |
244 | .flag = 0, | ||
258 | }, | 245 | }, |
259 | [2] = { | 246 | [2] = { |
260 | /* Hitachi SP10Q010 */ | 247 | /* Hitachi SP10Q010 */ |
261 | .name = "SP10Q010", | 248 | .name = "SP10Q010", |
262 | .width = 320, | 249 | .xres = 320, |
263 | .height = 240, | 250 | .yres = 240, |
264 | .hfp = 10, | 251 | .pixclock = 7833600, |
265 | .hbp = 10, | 252 | .left_margin = 10, |
266 | .hsw = 10, | 253 | .right_margin = 10, |
267 | .vfp = 10, | 254 | .upper_margin = 10, |
268 | .vbp = 10, | 255 | .lower_margin = 10, |
269 | .vsw = 10, | 256 | .hsync_len = 10, |
270 | .pxl_clk = 7833600, | 257 | .vsync_len = 10, |
271 | .invert_pxl_clk = 0, | 258 | .sync = 0, |
259 | .flag = 0, | ||
272 | }, | 260 | }, |
273 | }; | 261 | }; |
274 | 262 | ||
@@ -728,7 +716,7 @@ static void lcd_calc_clk_divider(struct da8xx_fb_par *par) | |||
728 | } | 716 | } |
729 | 717 | ||
730 | static int lcd_init(struct da8xx_fb_par *par, const struct lcd_ctrl_config *cfg, | 718 | 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) |
732 | { | 720 | { |
733 | u32 bpp; | 721 | u32 bpp; |
734 | int ret = 0; | 722 | int ret = 0; |
@@ -738,7 +726,7 @@ static int lcd_init(struct da8xx_fb_par *par, const struct lcd_ctrl_config *cfg, | |||
738 | /* Calculate the divider */ | 726 | /* Calculate the divider */ |
739 | lcd_calc_clk_divider(par); | 727 | lcd_calc_clk_divider(par); |
740 | 728 | ||
741 | if (panel->invert_pxl_clk) | 729 | if (panel->sync & FB_SYNC_CLK_INVERT) |
742 | lcdc_write((lcdc_read(LCD_RASTER_TIMING_2_REG) | | 730 | lcdc_write((lcdc_read(LCD_RASTER_TIMING_2_REG) | |
743 | LCD_INVERT_PIXEL_CLOCK), LCD_RASTER_TIMING_2_REG); | 731 | LCD_INVERT_PIXEL_CLOCK), LCD_RASTER_TIMING_2_REG); |
744 | else | 732 | else |
@@ -754,8 +742,10 @@ static int lcd_init(struct da8xx_fb_par *par, const struct lcd_ctrl_config *cfg, | |||
754 | lcd_cfg_ac_bias(cfg->ac_bias, cfg->ac_bias_intrpt); | 742 | lcd_cfg_ac_bias(cfg->ac_bias, cfg->ac_bias_intrpt); |
755 | 743 | ||
756 | /* Configure the vertical and horizontal sync properties. */ | 744 | /* Configure the vertical and horizontal sync properties. */ |
757 | lcd_cfg_vertical_sync(panel->vbp, panel->vsw, panel->vfp); | 745 | lcd_cfg_vertical_sync(panel->lower_margin, panel->vsync_len, |
758 | lcd_cfg_horizontal_sync(panel->hbp, panel->hsw, panel->hfp); | 746 | panel->upper_margin); |
747 | lcd_cfg_horizontal_sync(panel->right_margin, panel->hsync_len, | ||
748 | panel->left_margin); | ||
759 | 749 | ||
760 | /* Configure for disply */ | 750 | /* Configure for disply */ |
761 | ret = lcd_cfg_display(cfg); | 751 | ret = lcd_cfg_display(cfg); |
@@ -772,8 +762,8 @@ static int lcd_init(struct da8xx_fb_par *par, const struct lcd_ctrl_config *cfg, | |||
772 | bpp = cfg->p_disp_panel->max_bpp; | 762 | bpp = cfg->p_disp_panel->max_bpp; |
773 | if (bpp == 12) | 763 | if (bpp == 12) |
774 | bpp = 16; | 764 | bpp = 16; |
775 | ret = lcd_cfg_frame_buffer(par, (unsigned int)panel->width, | 765 | ret = lcd_cfg_frame_buffer(par, (unsigned int)panel->xres, |
776 | (unsigned int)panel->height, bpp, | 766 | (unsigned int)panel->yres, bpp, |
777 | cfg->raster_order); | 767 | cfg->raster_order); |
778 | if (ret < 0) | 768 | if (ret < 0) |
779 | return ret; | 769 | return ret; |
@@ -1235,7 +1225,7 @@ static int __devinit fb_probe(struct platform_device *device) | |||
1235 | struct da8xx_lcdc_platform_data *fb_pdata = | 1225 | struct da8xx_lcdc_platform_data *fb_pdata = |
1236 | device->dev.platform_data; | 1226 | device->dev.platform_data; |
1237 | struct lcd_ctrl_config *lcd_cfg; | 1227 | struct lcd_ctrl_config *lcd_cfg; |
1238 | struct da8xx_panel *lcdc_info; | 1228 | struct fb_videomode *lcdc_info; |
1239 | struct fb_info *da8xx_fb_info; | 1229 | struct fb_info *da8xx_fb_info; |
1240 | struct clk *fb_clk = NULL; | 1230 | struct clk *fb_clk = NULL; |
1241 | struct da8xx_fb_par *par; | 1231 | struct da8xx_fb_par *par; |
@@ -1323,7 +1313,7 @@ static int __devinit fb_probe(struct platform_device *device) | |||
1323 | #ifdef CONFIG_CPU_FREQ | 1313 | #ifdef CONFIG_CPU_FREQ |
1324 | par->lcd_fck_rate = clk_get_rate(fb_clk); | 1314 | par->lcd_fck_rate = clk_get_rate(fb_clk); |
1325 | #endif | 1315 | #endif |
1326 | par->pxl_clk = lcdc_info->pxl_clk; | 1316 | par->pxl_clk = lcdc_info->pixclock; |
1327 | if (fb_pdata->panel_power_ctrl) { | 1317 | if (fb_pdata->panel_power_ctrl) { |
1328 | par->panel_power_ctrl = fb_pdata->panel_power_ctrl; | 1318 | par->panel_power_ctrl = fb_pdata->panel_power_ctrl; |
1329 | par->panel_power_ctrl(1); | 1319 | par->panel_power_ctrl(1); |
@@ -1336,8 +1326,8 @@ static int __devinit fb_probe(struct platform_device *device) | |||
1336 | } | 1326 | } |
1337 | 1327 | ||
1338 | /* allocate frame buffer */ | 1328 | /* allocate frame buffer */ |
1339 | par->vram_size = lcdc_info->width * lcdc_info->height * lcd_cfg->bpp; | 1329 | par->vram_size = lcdc_info->xres * lcdc_info->yres * lcd_cfg->bpp; |
1340 | ulcm = lcm((lcdc_info->width * lcd_cfg->bpp)/8, PAGE_SIZE); | 1330 | ulcm = lcm((lcdc_info->xres * lcd_cfg->bpp)/8, PAGE_SIZE); |
1341 | par->vram_size = roundup(par->vram_size/8, ulcm); | 1331 | par->vram_size = roundup(par->vram_size/8, ulcm); |
1342 | par->vram_size = par->vram_size * LCD_NUM_BUFFERS; | 1332 | par->vram_size = par->vram_size * LCD_NUM_BUFFERS; |
1343 | 1333 | ||
@@ -1355,10 +1345,10 @@ static int __devinit fb_probe(struct platform_device *device) | |||
1355 | da8xx_fb_info->screen_base = (char __iomem *) par->vram_virt; | 1345 | da8xx_fb_info->screen_base = (char __iomem *) par->vram_virt; |
1356 | da8xx_fb_fix.smem_start = par->vram_phys; | 1346 | da8xx_fb_fix.smem_start = par->vram_phys; |
1357 | da8xx_fb_fix.smem_len = par->vram_size; | 1347 | 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; |
1359 | 1349 | ||
1360 | par->dma_start = par->vram_phys; | 1350 | 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 * |
1362 | da8xx_fb_fix.line_length - 1; | 1352 | da8xx_fb_fix.line_length - 1; |
1363 | 1353 | ||
1364 | /* allocate palette buffer */ | 1354 | /* allocate palette buffer */ |
@@ -1384,22 +1374,22 @@ static int __devinit fb_probe(struct platform_device *device) | |||
1384 | /* Initialize par */ | 1374 | /* Initialize par */ |
1385 | da8xx_fb_info->var.bits_per_pixel = lcd_cfg->bpp; | 1375 | da8xx_fb_info->var.bits_per_pixel = lcd_cfg->bpp; |
1386 | 1376 | ||
1387 | da8xx_fb_var.xres = lcdc_info->width; | 1377 | da8xx_fb_var.xres = lcdc_info->xres; |
1388 | da8xx_fb_var.xres_virtual = lcdc_info->width; | 1378 | da8xx_fb_var.xres_virtual = lcdc_info->xres; |
1389 | 1379 | ||
1390 | da8xx_fb_var.yres = lcdc_info->height; | 1380 | da8xx_fb_var.yres = lcdc_info->yres; |
1391 | da8xx_fb_var.yres_virtual = lcdc_info->height * LCD_NUM_BUFFERS; | 1381 | da8xx_fb_var.yres_virtual = lcdc_info->yres * LCD_NUM_BUFFERS; |
1392 | 1382 | ||
1393 | da8xx_fb_var.grayscale = | 1383 | da8xx_fb_var.grayscale = |
1394 | lcd_cfg->p_disp_panel->panel_shade == MONOCHROME ? 1 : 0; | 1384 | lcd_cfg->p_disp_panel->panel_shade == MONOCHROME ? 1 : 0; |
1395 | da8xx_fb_var.bits_per_pixel = lcd_cfg->bpp; | 1385 | da8xx_fb_var.bits_per_pixel = lcd_cfg->bpp; |
1396 | 1386 | ||
1397 | da8xx_fb_var.hsync_len = lcdc_info->hsw; | 1387 | da8xx_fb_var.hsync_len = lcdc_info->hsync_len; |
1398 | da8xx_fb_var.vsync_len = lcdc_info->vsw; | 1388 | da8xx_fb_var.vsync_len = lcdc_info->vsync_len; |
1399 | da8xx_fb_var.right_margin = lcdc_info->hfp; | 1389 | da8xx_fb_var.right_margin = lcdc_info->right_margin; |
1400 | da8xx_fb_var.left_margin = lcdc_info->hbp; | 1390 | da8xx_fb_var.left_margin = lcdc_info->left_margin; |
1401 | da8xx_fb_var.lower_margin = lcdc_info->vfp; | 1391 | da8xx_fb_var.lower_margin = lcdc_info->lower_margin; |
1402 | da8xx_fb_var.upper_margin = lcdc_info->vbp; | 1392 | da8xx_fb_var.upper_margin = lcdc_info->upper_margin; |
1403 | da8xx_fb_var.pixclock = da8xxfb_pixel_clk_period(par); | 1393 | da8xx_fb_var.pixclock = da8xxfb_pixel_clk_period(par); |
1404 | 1394 | ||
1405 | /* Initialize fbinfo */ | 1395 | /* Initialize fbinfo */ |