2 * Generic DPI Panels support
4 * Copyright (C) 2010 Canonical Ltd.
5 * Author: Bryan Wu <bryan.wu@canonical.com>
7 * LCD panel driver for Sharp LQ043T1DG01
9 * Copyright (C) 2009 Texas Instruments Inc
10 * Author: Vaibhav Hiremath <hvaibhav@ti.com>
12 * LCD panel driver for Toppoly TDO35S
14 * Copyright (C) 2009 CompuLab, Ltd.
15 * Author: Mike Rapoport <mike@compulab.co.il>
17 * Copyright (C) 2008 Nokia Corporation
18 * Author: Tomi Valkeinen <tomi.valkeinen@nokia.com>
20 * This program is free software; you can redistribute it and/or modify it
21 * under the terms of the GNU General Public License version 2 as published by
22 * the Free Software Foundation.
24 * This program is distributed in the hope that it will be useful, but WITHOUT
25 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
26 * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
29 * You should have received a copy of the GNU General Public License along with
30 * this program. If not, see <http://www.gnu.org/licenses/>.
33 #include <linux/module.h>
34 #include <linux/delay.h>
35 #include <linux/slab.h>
36 #include <video/omapdss.h>
38 #include <video/omap-panel-generic-dpi.h>
41 struct omap_video_timings timings
;
43 int acbi
; /* ac-bias pin transitions per interrupt */
44 /* Unit: line clocks */
45 int acb
; /* ac-bias pin frequency */
47 enum omap_panel_config config
;
53 * Used to match device to panel configuration
54 * when use generic panel driver
59 /* Panel configurations */
60 static struct panel_config generic_dpi_panels
[] = {
61 /* Sharp LQ043T1DG01 */
79 .config
= OMAP_DSS_LCD_TFT
| OMAP_DSS_LCD_IVS
|
80 OMAP_DSS_LCD_IHS
| OMAP_DSS_LCD_IEO
,
82 .power_off_delay
= 100,
86 /* Sharp LS037V7DW01 */
104 .config
= OMAP_DSS_LCD_TFT
| OMAP_DSS_LCD_IVS
|
106 .power_on_delay
= 50,
107 .power_off_delay
= 100,
117 .pixel_clock
= 26000,
129 .config
= OMAP_DSS_LCD_TFT
| OMAP_DSS_LCD_IVS
|
130 OMAP_DSS_LCD_IHS
| OMAP_DSS_LCD_IPC
|
133 .power_off_delay
= 0,
134 .name
= "toppoly_tdo35s",
137 /* Samsung LTE430WQ-F0C */
155 .config
= OMAP_DSS_LCD_TFT
| OMAP_DSS_LCD_IVS
|
158 .power_off_delay
= 0,
159 .name
= "samsung_lte430wq_f0c",
162 /* Seiko 70WVW1TZ3Z3 */
168 .pixel_clock
= 33000,
180 .config
= OMAP_DSS_LCD_TFT
| OMAP_DSS_LCD_IVS
|
183 .power_off_delay
= 0,
184 .name
= "seiko_70wvw1tz3",
187 /* Powertip PH480272T */
205 .config
= OMAP_DSS_LCD_TFT
| OMAP_DSS_LCD_IVS
|
206 OMAP_DSS_LCD_IHS
| OMAP_DSS_LCD_IEO
,
208 .power_off_delay
= 0,
209 .name
= "powertip_ph480272t",
212 /* Innolux AT070TN83 */
218 .pixel_clock
= 40000,
230 .config
= OMAP_DSS_LCD_TFT
| OMAP_DSS_LCD_IVS
|
233 .power_off_delay
= 0,
234 .name
= "innolux_at070tn83",
237 /* NEC NL2432DR22-11B */
253 .config
= OMAP_DSS_LCD_TFT
| OMAP_DSS_LCD_IVS
|
255 .name
= "nec_nl2432dr22-11b",
258 /* Unknown panel used in OMAP H4 */
274 .config
= OMAP_DSS_LCD_TFT
,
279 /* Unknown panel used in Samsung OMAP2 Apollon */
295 .config
= OMAP_DSS_LCD_TFT
| OMAP_DSS_LCD_IVS
|
300 /* FocalTech ETM070003DH6 */
306 .pixel_clock
= 28000,
316 .config
= OMAP_DSS_LCD_TFT
| OMAP_DSS_LCD_IVS
|
318 .name
= "focaltech_etm070003dh6",
321 /* Microtips Technologies - UMSH-8173MD */
327 .pixel_clock
= 34560,
339 .config
= OMAP_DSS_LCD_TFT
| OMAP_DSS_LCD_IVS
|
340 OMAP_DSS_LCD_IHS
| OMAP_DSS_LCD_IPC
,
342 .power_off_delay
= 0,
343 .name
= "microtips_umsh_8173md",
346 /* OrtusTech COM43H4M10XTC */
362 .config
= OMAP_DSS_LCD_TFT
,
364 .name
= "ortustech_com43h4m10xtc",
368 struct panel_drv_data
{
370 struct omap_dss_device
*dssdev
;
372 struct panel_config
*panel_config
;
375 static inline struct panel_generic_dpi_data
376 *get_panel_data(const struct omap_dss_device
*dssdev
)
378 return (struct panel_generic_dpi_data
*) dssdev
->data
;
381 static int generic_dpi_panel_power_on(struct omap_dss_device
*dssdev
)
384 struct panel_generic_dpi_data
*panel_data
= get_panel_data(dssdev
);
385 struct panel_drv_data
*drv_data
= dev_get_drvdata(&dssdev
->dev
);
386 struct panel_config
*panel_config
= drv_data
->panel_config
;
388 if (dssdev
->state
== OMAP_DSS_DISPLAY_ACTIVE
)
391 r
= omapdss_dpi_display_enable(dssdev
);
395 /* wait couple of vsyncs until enabling the LCD */
396 if (panel_config
->power_on_delay
)
397 msleep(panel_config
->power_on_delay
);
399 if (panel_data
->platform_enable
) {
400 r
= panel_data
->platform_enable(dssdev
);
407 omapdss_dpi_display_disable(dssdev
);
412 static void generic_dpi_panel_power_off(struct omap_dss_device
*dssdev
)
414 struct panel_generic_dpi_data
*panel_data
= get_panel_data(dssdev
);
415 struct panel_drv_data
*drv_data
= dev_get_drvdata(&dssdev
->dev
);
416 struct panel_config
*panel_config
= drv_data
->panel_config
;
418 if (dssdev
->state
!= OMAP_DSS_DISPLAY_ACTIVE
)
421 if (panel_data
->platform_disable
)
422 panel_data
->platform_disable(dssdev
);
424 /* wait couple of vsyncs after disabling the LCD */
425 if (panel_config
->power_off_delay
)
426 msleep(panel_config
->power_off_delay
);
428 omapdss_dpi_display_disable(dssdev
);
431 static int generic_dpi_panel_probe(struct omap_dss_device
*dssdev
)
433 struct panel_generic_dpi_data
*panel_data
= get_panel_data(dssdev
);
434 struct panel_config
*panel_config
= NULL
;
435 struct panel_drv_data
*drv_data
= NULL
;
438 dev_dbg(&dssdev
->dev
, "probe\n");
440 if (!panel_data
|| !panel_data
->name
)
443 for (i
= 0; i
< ARRAY_SIZE(generic_dpi_panels
); i
++) {
444 if (strcmp(panel_data
->name
, generic_dpi_panels
[i
].name
) == 0) {
445 panel_config
= &generic_dpi_panels
[i
];
453 dssdev
->panel
.config
= panel_config
->config
;
454 dssdev
->panel
.timings
= panel_config
->timings
;
455 dssdev
->panel
.acb
= panel_config
->acb
;
456 dssdev
->panel
.acbi
= panel_config
->acbi
;
458 drv_data
= kzalloc(sizeof(*drv_data
), GFP_KERNEL
);
462 drv_data
->dssdev
= dssdev
;
463 drv_data
->panel_config
= panel_config
;
465 dev_set_drvdata(&dssdev
->dev
, drv_data
);
470 static void __exit
generic_dpi_panel_remove(struct omap_dss_device
*dssdev
)
472 struct panel_drv_data
*drv_data
= dev_get_drvdata(&dssdev
->dev
);
474 dev_dbg(&dssdev
->dev
, "remove\n");
478 dev_set_drvdata(&dssdev
->dev
, NULL
);
481 static int generic_dpi_panel_enable(struct omap_dss_device
*dssdev
)
485 r
= generic_dpi_panel_power_on(dssdev
);
489 dssdev
->state
= OMAP_DSS_DISPLAY_ACTIVE
;
494 static void generic_dpi_panel_disable(struct omap_dss_device
*dssdev
)
496 generic_dpi_panel_power_off(dssdev
);
498 dssdev
->state
= OMAP_DSS_DISPLAY_DISABLED
;
501 static int generic_dpi_panel_suspend(struct omap_dss_device
*dssdev
)
503 generic_dpi_panel_power_off(dssdev
);
505 dssdev
->state
= OMAP_DSS_DISPLAY_SUSPENDED
;
510 static int generic_dpi_panel_resume(struct omap_dss_device
*dssdev
)
514 r
= generic_dpi_panel_power_on(dssdev
);
518 dssdev
->state
= OMAP_DSS_DISPLAY_ACTIVE
;
523 static void generic_dpi_panel_set_timings(struct omap_dss_device
*dssdev
,
524 struct omap_video_timings
*timings
)
526 dpi_set_timings(dssdev
, timings
);
529 static void generic_dpi_panel_get_timings(struct omap_dss_device
*dssdev
,
530 struct omap_video_timings
*timings
)
532 *timings
= dssdev
->panel
.timings
;
535 static int generic_dpi_panel_check_timings(struct omap_dss_device
*dssdev
,
536 struct omap_video_timings
*timings
)
538 return dpi_check_timings(dssdev
, timings
);
541 static struct omap_dss_driver dpi_driver
= {
542 .probe
= generic_dpi_panel_probe
,
543 .remove
= __exit_p(generic_dpi_panel_remove
),
545 .enable
= generic_dpi_panel_enable
,
546 .disable
= generic_dpi_panel_disable
,
547 .suspend
= generic_dpi_panel_suspend
,
548 .resume
= generic_dpi_panel_resume
,
550 .set_timings
= generic_dpi_panel_set_timings
,
551 .get_timings
= generic_dpi_panel_get_timings
,
552 .check_timings
= generic_dpi_panel_check_timings
,
555 .name
= "generic_dpi_panel",
556 .owner
= THIS_MODULE
,
560 static int __init
generic_dpi_panel_drv_init(void)
562 return omap_dss_register_driver(&dpi_driver
);
565 static void __exit
generic_dpi_panel_drv_exit(void)
567 omap_dss_unregister_driver(&dpi_driver
);
570 module_init(generic_dpi_panel_drv_init
);
571 module_exit(generic_dpi_panel_drv_exit
);
572 MODULE_LICENSE("GPL");