2 * LCD panel support for the TI 3430SDP board
4 * Copyright (C) 2008 Texas Instruments
5 * Author: Iqbal Shareef <iqbal@ti.com>
7 * Derived from drivers/video/omap/lcd_2430sdp.c
8 * Copyright (C) 2007 MontaVista
9 * Author: Hunyue Yau <hyau@mvista.com>
11 * This program is free software; you can redistribute it and/or modify it
12 * under the terms of the GNU General Public License as published by the
13 * Free Software Foundation; either version 2 of the License, or (at your
14 * option) any later version.
16 * This program is distributed in the hope that it will be useful, but
17 * WITHOUT ANY WARRANTY; without even the implied warranty of
18 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
19 * General Public License for more details.
21 * You should have received a copy of the GNU General Public License along
22 * with this program; if not, write to the Free Software Foundation, Inc.,
23 * 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
26 #include <linux/module.h>
27 #include <linux/platform_device.h>
28 #include <linux/i2c/twl4030.h>
30 #include <asm/arch/gpio.h>
31 #include <asm/arch/omapfb.h>
33 #define SDP3430_LCD_PANEL_BACKLIGHT_GPIO 8
34 #define SDP3430_LCD_PANEL_ENABLE_GPIO 5
36 static unsigned backlight_gpio;
37 static unsigned enable_gpio;
39 #define LCD_PIXCLOCK_MAX 167000
40 #define ENABLE_VAUX2_DEDICATED 0x03
41 #define ENABLE_VAUX2_DEV_GRP 0x20
42 #define ENABLE_VAUX3_DEDICATED 0x05
43 #define ENABLE_VAUX3_DEV_GRP 0xE0
45 static int sdp3430_panel_init(struct lcd_panel *panel,
46 struct omapfb_device *fbdev)
48 enable_gpio = SDP3430_LCD_PANEL_ENABLE_GPIO;
49 backlight_gpio = SDP3430_LCD_PANEL_BACKLIGHT_GPIO;
51 omap_request_gpio(enable_gpio); /* LCD panel */
52 omap_request_gpio(backlight_gpio); /* LCD backlight */
53 omap_set_gpio_direction(enable_gpio, 0); /* output */
54 omap_set_gpio_direction(backlight_gpio, 0); /* output */
59 static void sdp3430_panel_cleanup(struct lcd_panel *panel)
61 omap_free_gpio(backlight_gpio);
62 omap_free_gpio(enable_gpio);
65 static int sdp3430_panel_enable(struct lcd_panel *panel)
67 omap_set_gpio_dataout(enable_gpio, 1);
68 omap_set_gpio_dataout(backlight_gpio, 1);
70 if (0 != twl4030_i2c_write_u8(TWL4030_MODULE_PM_RECEIVER, ENABLE_VAUX3_DEDICATED,
71 TWL4030_VAUX3_DEDICATED))
73 if (0 != twl4030_i2c_write_u8(PM_RECEIVER, ENABLE_VAUX3_DEV_GRP,
74 TWL4030_VAUX3_DEV_GRP))
80 static void sdp3430_panel_disable(struct lcd_panel *panel)
82 omap_set_gpio_dataout(enable_gpio, 0);
83 omap_set_gpio_dataout(backlight_gpio, 0);
86 static unsigned long sdp3430_panel_get_caps(struct lcd_panel *panel)
91 struct lcd_panel sdp3430_panel = {
93 .config = OMAP_LCDC_PANEL_TFT | OMAP_LCDC_INV_VSYNC |
100 .hsw = 3, /* hsync_len (4) - 1 */
101 .hfp = 3, /* right_margin (4) - 1 */
102 .hbp = 39, /* left_margin (40) - 1 */
103 .vsw = 1, /* vsync_len (2) - 1 */
104 .vfp = 2, /* lower_margin */
105 .vbp = 7, /* upper_margin (8) - 1 */
107 .pixel_clock = LCD_PIXCLOCK_MAX,
109 .init = sdp3430_panel_init,
110 .cleanup = sdp3430_panel_cleanup,
111 .enable = sdp3430_panel_enable,
112 .disable = sdp3430_panel_disable,
113 .get_caps = sdp3430_panel_get_caps,
116 static int sdp3430_panel_probe(struct platform_device *pdev)
118 omapfb_register_panel(&sdp3430_panel);
122 static int sdp3430_panel_remove(struct platform_device *pdev)
127 static int sdp3430_panel_suspend(struct platform_device *pdev,
133 static int sdp3430_panel_resume(struct platform_device *pdev)
138 struct platform_driver sdp3430_panel_driver = {
139 .probe = sdp3430_panel_probe,
140 .remove = sdp3430_panel_remove,
141 .suspend = sdp3430_panel_suspend,
142 .resume = sdp3430_panel_resume,
144 .name = "sdp3430_lcd",
145 .owner = THIS_MODULE,
149 static int __init sdp3430_panel_drv_init(void)
151 return platform_driver_register(&sdp3430_panel_driver);
154 static void __exit sdp3430_panel_drv_exit(void)
156 platform_driver_unregister(&sdp3430_panel_driver);
159 module_init(sdp3430_panel_drv_init);
160 module_exit(sdp3430_panel_drv_exit);
162 MODULE_ALIAS("platform:sdp3430_lcd");