1 From ae9500a932f6e8d4f0d35b91231957727428c5cc Mon Sep 17 00:00:00 2001
2 From: Steve Sakoman <steve@sakoman.com>
3 Date: Thu, 17 Dec 2009 15:05:30 -0800
4 Subject: [PATCH 20/48] OMAP: DSS2: Add support for LG Philips LB035Q02 panel
7 drivers/video/omap2/displays/Kconfig | 12 +
8 drivers/video/omap2/displays/Makefile | 2 +
9 .../omap2/displays/panel-lgphilips-lb035q02.c | 244 ++++++++++++++++++++
10 3 files changed, 258 insertions(+), 0 deletions(-)
11 create mode 100644 drivers/video/omap2/displays/panel-lgphilips-lb035q02.c
13 diff --git a/drivers/video/omap2/displays/Kconfig b/drivers/video/omap2/displays/Kconfig
14 index 12327bb..48e872f 100644
15 --- a/drivers/video/omap2/displays/Kconfig
16 +++ b/drivers/video/omap2/displays/Kconfig
17 @@ -7,6 +7,18 @@ config PANEL_GENERIC
19 Used for DVI output for Beagle and OMAP3 SDP.
21 +config PANEL_LGPHILIPS_LB035Q02
22 + tristate "LG.Philips LB035Q02 LCD Panel"
23 + depends on OMAP2_DSS
25 + LCD Panel used on Overo Palo35
27 +config PANEL_SAMSUNG_LTE430WQ_F0C
28 + tristate "Samsung LTE430WQ-F0C LCD Panel"
29 + depends on OMAP2_DSS
31 + LCD Panel used on Overo Palo43
33 config PANEL_SHARP_LS037V7DW01
34 tristate "Sharp LS037V7DW01 LCD Panel"
36 diff --git a/drivers/video/omap2/displays/Makefile b/drivers/video/omap2/displays/Makefile
37 index aa38609..2fb1a57 100644
38 --- a/drivers/video/omap2/displays/Makefile
39 +++ b/drivers/video/omap2/displays/Makefile
41 obj-$(CONFIG_PANEL_GENERIC) += panel-generic.o
42 +obj-$(CONFIG_PANEL_LGPHILIPS_LB035Q02) += panel-lgphilips-lb035q02.o
43 +obj-$(CONFIG_PANEL_SAMSUNG_LTE430WQ_F0C) += panel-samsung-lte430wq-f0c.o
44 obj-$(CONFIG_PANEL_SHARP_LS037V7DW01) += panel-sharp-ls037v7dw01.o
45 obj-$(CONFIG_PANEL_SHARP_LQ043T1DG01) += panel-sharp-lq043t1dg01.o
47 diff --git a/drivers/video/omap2/displays/panel-lgphilips-lb035q02.c b/drivers/video/omap2/displays/panel-lgphilips-lb035q02.c
49 index 0000000..4ad709d
51 +++ b/drivers/video/omap2/displays/panel-lgphilips-lb035q02.c
54 + * LCD panel driver for LG.Philips LB035Q02
56 + * Author: Steve Sakoman <steve@sakoman.com>
58 + * This program is free software; you can redistribute it and/or modify it
59 + * under the terms of the GNU General Public License version 2 as published by
60 + * the Free Software Foundation.
62 + * This program is distributed in the hope that it will be useful, but WITHOUT
63 + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
64 + * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
67 + * You should have received a copy of the GNU General Public License along with
68 + * this program. If not, see <http://www.gnu.org/licenses/>.
71 +#include <linux/module.h>
72 +#include <linux/delay.h>
73 +#include <linux/spi/spi.h>
75 +#include <plat/display.h>
77 +static struct spi_device *spidev;
79 +static struct omap_video_timings lb035q02_timings = {
83 + .pixel_clock = 6500,
94 +static int lb035q02_write_reg(u8 reg, u16 val)
96 + struct spi_message msg;
97 + struct spi_transfer index_xfer = {
101 + struct spi_transfer value_xfer = {
106 + spi_message_init(&msg);
108 + /* register index */
111 + buffer[2] = reg & 0x7f;
112 + index_xfer.tx_buf = buffer;
113 + spi_message_add_tail(&index_xfer, &msg);
115 + /* register value */
117 + buffer[5] = val >> 8;
119 + value_xfer.tx_buf = buffer + 4;
120 + spi_message_add_tail(&value_xfer, &msg);
122 + return spi_sync(spidev, &msg);
125 +static int lb035q02_panel_power_on(struct omap_dss_device *dssdev)
129 + if (dssdev->state == OMAP_DSS_DISPLAY_ACTIVE)
132 + r = omapdss_dpi_display_enable(dssdev);
136 + if (dssdev->platform_enable) {
137 + r = dssdev->platform_enable(dssdev);
142 + /* Panel init sequence from page 28 of the spec */
143 + lb035q02_write_reg(0x01, 0x6300);
144 + lb035q02_write_reg(0x02, 0x0200);
145 + lb035q02_write_reg(0x03, 0x0177);
146 + lb035q02_write_reg(0x04, 0x04c7);
147 + lb035q02_write_reg(0x05, 0xffc0);
148 + lb035q02_write_reg(0x06, 0xe806);
149 + lb035q02_write_reg(0x0a, 0x4008);
150 + lb035q02_write_reg(0x0b, 0x0000);
151 + lb035q02_write_reg(0x0d, 0x0030);
152 + lb035q02_write_reg(0x0e, 0x2800);
153 + lb035q02_write_reg(0x0f, 0x0000);
154 + lb035q02_write_reg(0x16, 0x9f80);
155 + lb035q02_write_reg(0x17, 0x0a0f);
156 + lb035q02_write_reg(0x1e, 0x00c1);
157 + lb035q02_write_reg(0x30, 0x0300);
158 + lb035q02_write_reg(0x31, 0x0007);
159 + lb035q02_write_reg(0x32, 0x0000);
160 + lb035q02_write_reg(0x33, 0x0000);
161 + lb035q02_write_reg(0x34, 0x0707);
162 + lb035q02_write_reg(0x35, 0x0004);
163 + lb035q02_write_reg(0x36, 0x0302);
164 + lb035q02_write_reg(0x37, 0x0202);
165 + lb035q02_write_reg(0x3a, 0x0a0d);
166 + lb035q02_write_reg(0x3b, 0x0806);
170 + omapdss_dpi_display_disable(dssdev);
175 +static void lb035q02_panel_power_off(struct omap_dss_device *dssdev)
177 + if (dssdev->state != OMAP_DSS_DISPLAY_ACTIVE)
180 + if (dssdev->platform_disable)
181 + dssdev->platform_disable(dssdev);
183 + omapdss_dpi_display_disable(dssdev);
186 +static int lb035q02_panel_probe(struct omap_dss_device *dssdev)
188 + dssdev->panel.config = OMAP_DSS_LCD_TFT | OMAP_DSS_LCD_IVS |
190 + dssdev->panel.timings = lb035q02_timings;
195 +static void lb035q02_panel_remove(struct omap_dss_device *dssdev)
199 +static int lb035q02_panel_enable(struct omap_dss_device *dssdev)
203 + r = lb035q02_panel_power_on(dssdev);
207 + dssdev->state = OMAP_DSS_DISPLAY_ACTIVE;
212 +static void lb035q02_panel_disable(struct omap_dss_device *dssdev)
214 + lb035q02_panel_power_off(dssdev);
216 + dssdev->state = OMAP_DSS_DISPLAY_DISABLED;
219 +static int lb035q02_panel_suspend(struct omap_dss_device *dssdev)
221 + lb035q02_panel_disable(dssdev);
222 + dssdev->state = OMAP_DSS_DISPLAY_SUSPENDED;
226 +static int lb035q02_panel_resume(struct omap_dss_device *dssdev)
230 + r = lb035q02_panel_power_on(dssdev);
234 + dssdev->state = OMAP_DSS_DISPLAY_ACTIVE;
239 +static struct omap_dss_driver lb035q02_driver = {
240 + .probe = lb035q02_panel_probe,
241 + .remove = lb035q02_panel_remove,
243 + .enable = lb035q02_panel_enable,
244 + .disable = lb035q02_panel_disable,
245 + .suspend = lb035q02_panel_suspend,
246 + .resume = lb035q02_panel_resume,
249 + .name = "lgphilips_lb035q02_panel",
250 + .owner = THIS_MODULE,
254 +static int __devinit lb035q02_panel_spi_probe(struct spi_device *spi)
260 +static int __devexit lb035q02_panel_spi_remove(struct spi_device *spi)
265 +static struct spi_driver lb035q02_spi_driver = {
267 + .name = "lgphilips_lb035q02_panel-spi",
268 + .owner = THIS_MODULE,
270 + .probe = lb035q02_panel_spi_probe,
271 + .remove = __devexit_p (lb035q02_panel_spi_remove),
274 +static int __init lb035q02_panel_drv_init(void)
277 + r = spi_register_driver(&lb035q02_spi_driver);
279 + pr_err("lgphilips_lb035q02: Unable to register SPI driver: %d\n", r);
281 + r = omap_dss_register_driver(&lb035q02_driver);
283 + pr_err("lgphilips_lb035q02: Unable to register panel driver: %d\n", r);
288 +static void __exit lb035q02_panel_drv_exit(void)
290 + spi_unregister_driver(&lb035q02_spi_driver);
291 + omap_dss_unregister_driver(&lb035q02_driver);
294 +module_init(lb035q02_panel_drv_init);
295 +module_exit(lb035q02_panel_drv_exit);
296 +MODULE_LICENSE("GPL");