summaryrefslogtreecommitdiffstats
path: root/extras/recipes-kernel/linux/linux-omap-psp-2.6.32/0029-OMAP-DSS2-Add-support-for-LG-Philips-LB035Q02-panel.patch
diff options
context:
space:
mode:
Diffstat (limited to 'extras/recipes-kernel/linux/linux-omap-psp-2.6.32/0029-OMAP-DSS2-Add-support-for-LG-Philips-LB035Q02-panel.patch')
-rw-r--r--extras/recipes-kernel/linux/linux-omap-psp-2.6.32/0029-OMAP-DSS2-Add-support-for-LG-Philips-LB035Q02-panel.patch254
1 files changed, 254 insertions, 0 deletions
diff --git a/extras/recipes-kernel/linux/linux-omap-psp-2.6.32/0029-OMAP-DSS2-Add-support-for-LG-Philips-LB035Q02-panel.patch b/extras/recipes-kernel/linux/linux-omap-psp-2.6.32/0029-OMAP-DSS2-Add-support-for-LG-Philips-LB035Q02-panel.patch
new file mode 100644
index 00000000..4f24fdd9
--- /dev/null
+++ b/extras/recipes-kernel/linux/linux-omap-psp-2.6.32/0029-OMAP-DSS2-Add-support-for-LG-Philips-LB035Q02-panel.patch
@@ -0,0 +1,254 @@
1From e960b2c16c24198a669a7c49e6282333faa74a3e Mon Sep 17 00:00:00 2001
2From: Steve Sakoman <steve@sakoman.com>
3Date: Thu, 17 Dec 2009 15:05:30 -0800
4Subject: [PATCH 29/45] OMAP: DSS2: Add support for LG Philips LB035Q02 panel
5
6---
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
12
13diff --git a/drivers/video/omap2/displays/Kconfig b/drivers/video/omap2/displays/Kconfig
14index 4229a28..875250a 100644
15--- a/drivers/video/omap2/displays/Kconfig
16+++ b/drivers/video/omap2/displays/Kconfig
17@@ -7,6 +7,12 @@ config PANEL_GENERIC
18 Generic panel driver.
19 Used for DVI output for Beagle and OMAP3 SDP.
20
21+config PANEL_LGPHILIPS_LB035Q02
22+ tristate "LG.Philips LB035Q02 LCD Panel"
23+ depends on OMAP2_DSS
24+ help
25+ LCD Panel used on Overo Palo35
26+
27 config PANEL_SAMSUNG_LTE430WQ_F0C
28 tristate "Samsung LTE430WQ-F0C LCD Panel"
29 depends on OMAP2_DSS
30diff --git a/drivers/video/omap2/displays/Makefile b/drivers/video/omap2/displays/Makefile
31index 9317445..f8e6c52 100644
32--- a/drivers/video/omap2/displays/Makefile
33+++ b/drivers/video/omap2/displays/Makefile
34@@ -1,4 +1,5 @@
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
39 obj-$(CONFIG_PANEL_SHARP_LQ043T1DG01) += panel-sharp-lq043t1dg01.o
40diff --git a/drivers/video/omap2/displays/panel-lgphilips-lb035q02.c b/drivers/video/omap2/displays/panel-lgphilips-lb035q02.c
41new file mode 100644
42index 0000000..22dc865
43--- /dev/null
44+++ b/drivers/video/omap2/displays/panel-lgphilips-lb035q02.c
45@@ -0,0 +1,206 @@
46+/*
47+ * LCD panel driver for LG.Philips LB035Q02
48+ *
49+ * Author: Steve Sakoman <steve@sakoman.com>
50+ *
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.
54+ *
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
58+ * more details.
59+ *
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/>.
62+ */
63+
64+#include <linux/module.h>
65+#include <linux/delay.h>
66+#include <linux/spi/spi.h>
67+
68+#include <plat/display.h>
69+
70+static struct spi_device *spidev;
71+
72+static struct omap_video_timings lb035q02_timings = {
73+ .x_res = 320,
74+ .y_res = 240,
75+
76+ .pixel_clock = 6500,
77+
78+ .hsw = 2,
79+ .hfp = 20,
80+ .hbp = 68,
81+
82+ .vsw = 2,
83+ .vfp = 4,
84+ .vbp = 18,
85+};
86+
87+static int lb035q02_panel_probe(struct omap_dss_device *dssdev)
88+{
89+ dssdev->panel.config = OMAP_DSS_LCD_TFT | OMAP_DSS_LCD_IVS |
90+ OMAP_DSS_LCD_IHS;
91+ dssdev->panel.timings = lb035q02_timings;
92+
93+ return 0;
94+}
95+
96+static void lb035q02_panel_remove(struct omap_dss_device *dssdev)
97+{
98+}
99+
100+static int lb035q02_write_reg(u8 reg, u16 val)
101+{
102+ struct spi_message msg;
103+ struct spi_transfer index_xfer = {
104+ .len = 3,
105+ .cs_change = 1,
106+ };
107+ struct spi_transfer value_xfer = {
108+ .len = 3,
109+ };
110+ u8 buffer[16];
111+
112+ spi_message_init(&msg);
113+
114+ /* register index */
115+ buffer[0] = 0x70;
116+ buffer[1] = 0x00;
117+ buffer[2] = reg & 0x7f;
118+ index_xfer.tx_buf = buffer;
119+ spi_message_add_tail(&index_xfer, &msg);
120+
121+ /* register value */
122+ buffer[4] = 0x72;
123+ buffer[5] = val >> 8;
124+ buffer[6] = val;
125+ value_xfer.tx_buf = buffer + 4;
126+ spi_message_add_tail(&value_xfer, &msg);
127+
128+ return spi_sync(spidev, &msg);
129+}
130+
131+static int lb035q02_panel_enable(struct omap_dss_device *dssdev)
132+{
133+ int r = 0;
134+
135+ pr_info("lgphilips_lb035q02: panel_enable: 0x%08x\n", spidev);
136+ /* wait couple of vsyncs until enabling the LCD */
137+ msleep(50);
138+
139+ if (dssdev->platform_enable)
140+ r = dssdev->platform_enable(dssdev);
141+
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);
167+
168+ return r;
169+}
170+
171+static void lb035q02_panel_disable(struct omap_dss_device *dssdev)
172+{
173+ if (dssdev->platform_disable)
174+ dssdev->platform_disable(dssdev);
175+
176+ /* wait at least 5 vsyncs after disabling the LCD */
177+
178+ msleep(100);
179+}
180+
181+static int lb035q02_panel_suspend(struct omap_dss_device *dssdev)
182+{
183+ pr_info("lgphilips_lb035q02: panel_suspend\n");
184+ lb035q02_panel_disable(dssdev);
185+ return 0;
186+}
187+
188+static int lb035q02_panel_resume(struct omap_dss_device *dssdev)
189+{
190+ pr_info("lgphilips_lb035q02: panel_resume\n");
191+ return lb035q02_panel_enable(dssdev);
192+}
193+
194+static struct omap_dss_driver lb035q02_driver = {
195+ .probe = lb035q02_panel_probe,
196+ .remove = lb035q02_panel_remove,
197+
198+ .enable = lb035q02_panel_enable,
199+ .disable = lb035q02_panel_disable,
200+ .suspend = lb035q02_panel_suspend,
201+ .resume = lb035q02_panel_resume,
202+
203+ .driver = {
204+ .name = "lgphilips_lb035q02_panel",
205+ .owner = THIS_MODULE,
206+ },
207+};
208+
209+static int __devinit lb035q02_panel_spi_probe(struct spi_device *spi)
210+{
211+ spidev = spi;
212+ return 0;
213+}
214+
215+static int __devexit lb035q02_panel_spi_remove(struct spi_device *spi)
216+{
217+ return 0;
218+}
219+
220+static struct spi_driver lb035q02_spi_driver = {
221+ .driver = {
222+ .name = "lgphilips_lb035q02_panel-spi",
223+ .owner = THIS_MODULE,
224+ },
225+ .probe = lb035q02_panel_spi_probe,
226+ .remove = __devexit_p (lb035q02_panel_spi_remove),
227+};
228+
229+static int __init lb035q02_panel_drv_init(void)
230+{
231+ int ret;
232+ ret = spi_register_driver(&lb035q02_spi_driver);
233+ if (ret != 0)
234+ pr_err("lgphilips_lb035q02: Unable to register SPI driver: %d\n", ret);
235+
236+ ret = omap_dss_register_driver(&lb035q02_driver);
237+ if (ret != 0)
238+ pr_err("lgphilips_lb035q02: Unable to register panel driver: %d\n", ret);
239+
240+ return ret;
241+}
242+
243+static void __exit lb035q02_panel_drv_exit(void)
244+{
245+ spi_unregister_driver(&lb035q02_spi_driver);
246+ omap_dss_unregister_driver(&lb035q02_driver);
247+}
248+
249+module_init(lb035q02_panel_drv_init);
250+module_exit(lb035q02_panel_drv_exit);
251+MODULE_LICENSE("GPL");
252--
2531.6.6.1
254