1 From e09abf20005e9abf41e44e712bc600d2cb346cb5 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 12/16] OMAP: DSS2: Add support for LG Philips LB035Q02 panel
7 drivers/video/omap2/displays/Kconfig | 6 +
8 drivers/video/omap2/displays/Makefile | 1 +
9 .../omap2/displays/panel-lgphilips-lb035q02.c | 206 ++++++++++++++++++++
10 3 files changed, 213 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 79d2861..050f29c 100644
15 --- a/drivers/video/omap2/displays/Kconfig
16 +++ b/drivers/video/omap2/displays/Kconfig
17 @@ -7,6 +7,12 @@ 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"
30 diff --git a/drivers/video/omap2/displays/Makefile b/drivers/video/omap2/displays/Makefile
31 index d44e765..28f6f9b 100644
32 --- a/drivers/video/omap2/displays/Makefile
33 +++ b/drivers/video/omap2/displays/Makefile
35 obj-$(CONFIG_PANEL_GENERIC) += panel-generic.o
36 +obj-$(CONFIG_PANEL_LGPHILIPS_LB035Q02) += panel-lgphilips-lb035q02.o
37 obj-$(CONFIG_PANEL_SAMSUNG_LTE430WQ_F0C) += panel-samsung-lte430wq-f0c.o
38 obj-$(CONFIG_PANEL_SHARP_LS037V7DW01) += panel-sharp-ls037v7dw01.o
40 diff --git a/drivers/video/omap2/displays/panel-lgphilips-lb035q02.c b/drivers/video/omap2/displays/panel-lgphilips-lb035q02.c
42 index 0000000..22dc865
44 +++ b/drivers/video/omap2/displays/panel-lgphilips-lb035q02.c
47 + * LCD panel driver for LG.Philips LB035Q02
49 + * Author: Steve Sakoman <steve@sakoman.com>
51 + * This program is free software; you can redistribute it and/or modify it
52 + * under the terms of the GNU General Public License version 2 as published by
53 + * the Free Software Foundation.
55 + * This program is distributed in the hope that it will be useful, but WITHOUT
56 + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
57 + * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
60 + * You should have received a copy of the GNU General Public License along with
61 + * this program. If not, see <http://www.gnu.org/licenses/>.
64 +#include <linux/module.h>
65 +#include <linux/delay.h>
66 +#include <linux/spi/spi.h>
68 +#include <plat/display.h>
70 +static struct spi_device *spidev;
72 +static struct omap_video_timings lb035q02_timings = {
76 + .pixel_clock = 6500,
87 +static int lb035q02_panel_probe(struct omap_dss_device *dssdev)
89 + dssdev->panel.config = OMAP_DSS_LCD_TFT | OMAP_DSS_LCD_IVS |
91 + dssdev->panel.timings = lb035q02_timings;
96 +static void lb035q02_panel_remove(struct omap_dss_device *dssdev)
100 +static int lb035q02_write_reg(u8 reg, u16 val)
102 + struct spi_message msg;
103 + struct spi_transfer index_xfer = {
107 + struct spi_transfer value_xfer = {
112 + spi_message_init(&msg);
114 + /* register index */
117 + buffer[2] = reg & 0x7f;
118 + index_xfer.tx_buf = buffer;
119 + spi_message_add_tail(&index_xfer, &msg);
121 + /* register value */
123 + buffer[5] = val >> 8;
125 + value_xfer.tx_buf = buffer + 4;
126 + spi_message_add_tail(&value_xfer, &msg);
128 + return spi_sync(spidev, &msg);
131 +static int lb035q02_panel_enable(struct omap_dss_device *dssdev)
135 + pr_info("lgphilips_lb035q02: panel_enable: 0x%08x\n", spidev);
136 + /* wait couple of vsyncs until enabling the LCD */
139 + if (dssdev->platform_enable)
140 + 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);
171 +static void lb035q02_panel_disable(struct omap_dss_device *dssdev)
173 + if (dssdev->platform_disable)
174 + dssdev->platform_disable(dssdev);
176 + /* wait at least 5 vsyncs after disabling the LCD */
181 +static int lb035q02_panel_suspend(struct omap_dss_device *dssdev)
183 + pr_info("lgphilips_lb035q02: panel_suspend\n");
184 + lb035q02_panel_disable(dssdev);
188 +static int lb035q02_panel_resume(struct omap_dss_device *dssdev)
190 + pr_info("lgphilips_lb035q02: panel_resume\n");
191 + return lb035q02_panel_enable(dssdev);
194 +static struct omap_dss_driver lb035q02_driver = {
195 + .probe = lb035q02_panel_probe,
196 + .remove = lb035q02_panel_remove,
198 + .enable = lb035q02_panel_enable,
199 + .disable = lb035q02_panel_disable,
200 + .suspend = lb035q02_panel_suspend,
201 + .resume = lb035q02_panel_resume,
204 + .name = "lgphilips_lb035q02_panel",
205 + .owner = THIS_MODULE,
209 +static int __devinit lb035q02_panel_spi_probe(struct spi_device *spi)
215 +static int __devexit lb035q02_panel_spi_remove(struct spi_device *spi)
220 +static struct spi_driver lb035q02_spi_driver = {
222 + .name = "lgphilips_lb035q02_panel-spi",
223 + .owner = THIS_MODULE,
225 + .probe = lb035q02_panel_spi_probe,
226 + .remove = __devexit_p (lb035q02_panel_spi_remove),
229 +static int __init lb035q02_panel_drv_init(void)
232 + ret = spi_register_driver(&lb035q02_spi_driver);
234 + pr_err("lgphilips_lb035q02: Unable to register SPI driver: %d\n", ret);
236 + ret = omap_dss_register_driver(&lb035q02_driver);
238 + pr_err("lgphilips_lb035q02: Unable to register panel driver: %d\n", ret);
243 +static void __exit lb035q02_panel_drv_exit(void)
245 + spi_unregister_driver(&lb035q02_spi_driver);
246 + omap_dss_unregister_driver(&lb035q02_driver);
249 +module_init(lb035q02_panel_drv_init);
250 +module_exit(lb035q02_panel_drv_exit);
251 +MODULE_LICENSE("GPL");