linux-3.0: fixes
[glsdk/meta-ti-glsdk.git] / recipes-kernel / linux / linux-3.0 / ulcd / 0001-omap2-displays-Add-support-for-ThreeFiveCorp-S9700-D.patch
1 From 1890f67c9114d6fdf7696d6fa4eef62b1d7f74c4 Mon Sep 17 00:00:00 2001
2 From: Roger Monk <r-monk@ti.com>
3 Date: Wed, 10 Aug 2011 16:54:34 +0200
4 Subject: [PATCH 1/3] omap2-displays: Add support for ThreeFiveCorp S9700 Display
6 * Add support for s9700rtwv35tr01b display panel
7    * This is used on BeagleBoardToys ULCD/-lite daugtercards
9 Signed-off-by: Roger Monk <r-monk@ti.com>
10 ---
11  drivers/video/omap2/displays/Kconfig               |    6 +
12  drivers/video/omap2/displays/Makefile              |    1 +
13  .../omap2/displays/panel-tfc-s9700rtwv35tr01b.c    |  118 ++++++++++++++++++++
14  3 files changed, 125 insertions(+), 0 deletions(-)
15  create mode 100644 drivers/video/omap2/displays/panel-tfc-s9700rtwv35tr01b.c
17 diff --git a/drivers/video/omap2/displays/Kconfig b/drivers/video/omap2/displays/Kconfig
18 index 609a280..f8be2a8 100644
19 --- a/drivers/video/omap2/displays/Kconfig
20 +++ b/drivers/video/omap2/displays/Kconfig
21 @@ -30,6 +30,12 @@ config PANEL_NEC_NL8048HL11_01B
22                 This NEC NL8048HL11-01B panel is TFT LCD
23                 used in the Zoom2/3/3630 sdp boards.
24  
25 +config PANEL_TFCS9700RTWV35TR01B
26 +        tristate "TFC S9700RTWV35TR01B"
27 +        depends on OMAP2_DSS
28 +        help
29 +          LCD Panel used on BeagleboardToys 800x480 LCD Expansion Module
30 +
31  config PANEL_TAAL
32          tristate "Taal DSI Panel"
33          depends on OMAP2_DSS_DSI
34 diff --git a/drivers/video/omap2/displays/Makefile b/drivers/video/omap2/displays/Makefile
35 index 0f601ab..8abdf50 100644
36 --- a/drivers/video/omap2/displays/Makefile
37 +++ b/drivers/video/omap2/displays/Makefile
38 @@ -5,4 +5,5 @@ obj-$(CONFIG_PANEL_NEC_NL8048HL11_01B) += panel-nec-nl8048hl11-01b.o
39  
40  obj-$(CONFIG_PANEL_TAAL) += panel-taal.o
41  obj-$(CONFIG_PANEL_TPO_TD043MTEA1) += panel-tpo-td043mtea1.o
42 +obj-$(CONFIG_PANEL_TFCS9700RTWV35TR01B) += panel-tfc-s9700rtwv35tr01b.o
43  obj-$(CONFIG_PANEL_ACX565AKM) += panel-acx565akm.o
44 diff --git a/drivers/video/omap2/displays/panel-tfc-s9700rtwv35tr01b.c b/drivers/video/omap2/displays/panel-tfc-s9700rtwv35tr01b.c
45 new file mode 100644
46 index 0000000..c2a1a19
47 --- /dev/null
48 +++ b/drivers/video/omap2/displays/panel-tfc-s9700rtwv35tr01b.c
49 @@ -0,0 +1,118 @@
50 +/*
51 + * LCD panel driver for TFC S9700RTWV35TR-01B
52 + *
53 + * Copyright (C) 2011 Texas Instruments Inc
54 + * Author: Roger Monk <r-monk@ti.com>
55 + * From Original by : Vaibhav Hiremath <hvaibhav@ti.com>
56 + *
57 + * This program is free software; you can redistribute it and/or modify it
58 + * under the terms of the GNU General Public License version 2 as published by
59 + * the Free Software Foundation.
60 + *
61 + * This program is distributed in the hope that it will be useful, but WITHOUT
62 + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
63 + * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License for
64 + * more details.
65 + *
66 + * You should have received a copy of the GNU General Public License along with
67 + * this program.  If not, see <http://www.gnu.org/licenses/>.
68 + */
69 +
70 +#include <linux/module.h>
71 +#include <linux/delay.h>
72 +#include <linux/device.h>
73 +#include <linux/err.h>
74 +
75 +#include <video/omapdss.h>
76 +
77 +static struct omap_video_timings tfc_timings = {
78 +       .x_res          = 800,
79 +       .y_res          = 480,
80 +
81 +       .pixel_clock    = 30000,
82 +
83 +       .hsw            = 49,
84 +       .hfp            = 41,
85 +       .hbp            = 40,
86 +
87 +       .vsw            = 4,
88 +       .vfp            = 14,
89 +       .vbp            = 29,
90 +};
91 +
92 +static int tfc_panel_probe(struct omap_dss_device *dssdev)
93 +{
94 +       dssdev->panel.config = OMAP_DSS_LCD_TFT | OMAP_DSS_LCD_IVS |
95 +               OMAP_DSS_LCD_IHS; // | OMAP_DSS_LCD_IEO; - TODO check this - doesn't work with this enabled
96 +       dssdev->panel.acb = 0x0;
97 +       dssdev->panel.timings = tfc_timings;
98 +
99 +       return 0;
100 +}
102 +static void tfc_panel_remove(struct omap_dss_device *dssdev)
103 +{
104 +}
106 +static int tfc_panel_enable(struct omap_dss_device *dssdev)
107 +{
108 +       int r = 0;
110 +       /* wait couple of vsyncs until enabling the LCD */
111 +       msleep(50);
113 +       if (dssdev->platform_enable)
114 +               r = dssdev->platform_enable(dssdev);
116 +       return r;
117 +}
119 +static void tfc_panel_disable(struct omap_dss_device *dssdev)
120 +{
121 +       if (dssdev->platform_disable)
122 +               dssdev->platform_disable(dssdev);
124 +       /* wait at least 5 vsyncs after disabling the LCD */
126 +       msleep(100);
127 +}
129 +static int tfc_panel_suspend(struct omap_dss_device *dssdev)
130 +{
131 +       tfc_panel_disable(dssdev);
132 +       return 0;
133 +}
135 +static int tfc_panel_resume(struct omap_dss_device *dssdev)
136 +{
137 +       return tfc_panel_enable(dssdev);
138 +}
140 +static struct omap_dss_driver tfc_s9700_driver = {
141 +       .probe          = tfc_panel_probe,
142 +       .remove         = tfc_panel_remove,
144 +       .enable         = tfc_panel_enable,
145 +       .disable        = tfc_panel_disable,
146 +       .suspend        = tfc_panel_suspend,
147 +       .resume         = tfc_panel_resume,
149 +       .driver         = {
150 +               .name   = "tfc_s9700_panel",
151 +               .owner  = THIS_MODULE,
152 +       },
153 +};
155 +static int __init tfc_panel_drv_init(void)
156 +{
157 +       return omap_dss_register_driver(&tfc_s9700_driver);
158 +}
160 +static void __exit tfc_panel_drv_exit(void)
161 +{
162 +       omap_dss_unregister_driver(&tfc_s9700_driver);
163 +}
165 +module_init(tfc_panel_drv_init);
166 +module_exit(tfc_panel_drv_exit);
167 +MODULE_LICENSE("GPL");
168 -- 
169 1.6.6.1