2 * LCD panel support for OMAP3 Pandora
4 * Derived from drivers/video/omap/lcd_omap3evm.c
5 * Derived from drivers/video/omap/lcd-apollon.c
7 * This program is free software; you can redistribute it and/or modify it
8 * under the terms of the GNU General Public License as published by the
9 * Free Software Foundation; either version 2 of the License, or (at your
10 * option) any later version.
12 * This program is distributed in the hope that it will be useful, but
13 * WITHOUT ANY WARRANTY; without even the implied warranty of
14 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
15 * General Public License for more details.
17 * You should have received a copy of the GNU General Public License along
18 * with this program; if not, write to the Free Software Foundation, Inc.,
19 * 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
22 #include <linux/module.h>
23 #include <linux/platform_device.h>
24 #include <linux/i2c/twl4030.h>
26 #include <mach/gpio.h>
28 #include <mach/omapfb.h>
29 #include <asm/mach-types.h>
31 //#define LCD_PANEL_ENABLE_GPIO 154
32 //#define TWL_PWMA_PWMAOFF 0x01
36 #define LCD_PIXCLOCK 36000 /* in kHz */
38 static unsigned int bklight_level;
40 static int omap3pandora_panel_init(struct lcd_panel *panel,
41 struct omapfb_device *fbdev)
48 static void omap3pandora_panel_cleanup(struct lcd_panel *panel)
52 static int omap3pandora_panel_enable(struct lcd_panel *panel)
54 // omap_set_gpio_dataout(LCD_PANEL_ENABLE_GPIO, 0);
58 static void omap3pandora_panel_disable(struct lcd_panel *panel)
60 // omap_set_gpio_dataout(LCD_PANEL_ENABLE_GPIO, 1);
63 static unsigned long omap3pandora_panel_get_caps(struct lcd_panel *panel)
68 static int omap3pandora_bklight_setlevel(struct lcd_panel *panel,
73 if ((level >= 0) && (level <= 100)) {
74 c = (125 * (100 - level)) / 100 + 2;
75 twl4030_i2c_write_u8(TWL4030_MODULE_PWMA, c, TWL_PWMA_PWMAOFF);
76 bklight_level = level;
82 static unsigned int omap3pandora_bklight_getlevel(struct lcd_panel *panel)
87 static unsigned int omap3pandora_bklight_getmaxlevel(struct lcd_panel *panel)
92 struct lcd_panel omap3pandora_panel = {
93 .name = "omap3pandora",
94 .config = OMAP_LCDC_PANEL_TFT | OMAP_LCDC_INV_VSYNC |
95 OMAP_LCDC_INV_HSYNC | OMAP_LCDC_INV_PIX_CLOCK,
102 .hsw = 1, /* hsync_len */
103 .hfp = 40, /* right_margin */
104 .hbp = 215, /* left_margin */
105 .vsw = 1, /* vsync_len */
106 .vfp = 10, /* lower_margin */
107 .vbp = 34, /* upper_margin */
109 .acb = 0x28, /* ac-bias pin frequency */
110 .pcd = 0, /* pixel clock divider. Unused */
112 .pixel_clock = LCD_PIXCLOCK,
114 .init = omap3pandora_panel_init,
115 .cleanup = omap3pandora_panel_cleanup,
116 .enable = omap3pandora_panel_enable,
117 .disable = omap3pandora_panel_disable,
118 .get_caps = omap3pandora_panel_get_caps,
119 .set_bklight_level = omap3pandora_bklight_setlevel,
120 .get_bklight_level = omap3pandora_bklight_getlevel,
121 .get_bklight_max = omap3pandora_bklight_getmaxlevel,
124 static int omap3pandora_panel_probe(struct platform_device *pdev)
126 omapfb_register_panel(&omap3pandora_panel);
130 static int omap3pandora_panel_remove(struct platform_device *pdev)
135 static int omap3pandora_panel_suspend(struct platform_device *pdev,
141 static int omap3pandora_panel_resume(struct platform_device *pdev)
146 struct platform_driver omap3pandora_panel_driver = {
147 .probe = omap3pandora_panel_probe,
148 .remove = omap3pandora_panel_remove,
149 .suspend = omap3pandora_panel_suspend,
150 .resume = omap3pandora_panel_resume,
152 .name = "pandora_lcd",
153 .owner = THIS_MODULE,
157 static int __init omap3pandora_panel_drv_init(void)
159 return platform_driver_register(&omap3pandora_panel_driver);
162 static void __exit omap3pandora_panel_drv_exit(void)
164 platform_driver_unregister(&omap3pandora_panel_driver);
167 module_init(omap3pandora_panel_drv_init);
168 module_exit(omap3pandora_panel_drv_exit);