diff options
author | Linus Torvalds <torvalds@linux-foundation.org> | 2011-03-24 10:56:52 -0400 |
---|---|---|
committer | Linus Torvalds <torvalds@linux-foundation.org> | 2011-03-24 10:56:52 -0400 |
commit | 4cc4d24efce4672f9b0e7fa27963770ae602998f (patch) | |
tree | e69e7209db5500164eedb82c46ea657499b72287 /drivers/video/omap2/displays | |
parent | b81a618dcd3ea99de292dbe624f41ca68f464376 (diff) | |
parent | 56be1416453c31d32f984328b5193489ab63ffcf (diff) |
Merge git://git.kernel.org/pub/scm/linux/kernel/git/lethal/fbdev-2.6
* git://git.kernel.org/pub/scm/linux/kernel/git/lethal/fbdev-2.6: (140 commits)
MAINTAINERS: de-orphan fbdev.
MAINTAINERS: Add file pattern for fb dt bindings.
video: Move sm501fb devicetree binding documentation to a better place.
fbcon: fix situation where fbcon gets deinitialised and can't reinit.
video, sm501: add OF binding to support SM501
video, sm501: add edid and commandline support
video, sm501: add I/O functions for use on powerpc
video: Fix EDID macros H_SYNC_WIDTH and H_SYNC_OFFSET
fbcon: Bugfix soft cursor detection in Tile Blitting
video: add missing framebuffer_release in error path
video: metronomefb: add __devexit_p around reference to metronomefb_remove
video: hecubafb: add __devexit_p around reference to hecubafb_remove
drivers:video:aty:radeon_base Fix typo occationally to occasionally
atmel_lcdfb: add fb_blank function
atmel_lcdfb: implement inverted contrast pwm
video: s3c-fb: return proper error if clk_get fails
uvesafb,vesafb: create WC or WB PAT-entries
video: ffb: fix ffb_probe error path
radeonfb: Let hwmon driver probe the "monid" I2C bus
fbdev: sh_mobile_lcdc: checking NULL instead of IS_ERR()
...
Diffstat (limited to 'drivers/video/omap2/displays')
-rw-r--r-- | drivers/video/omap2/displays/Kconfig | 6 | ||||
-rw-r--r-- | drivers/video/omap2/displays/Makefile | 1 | ||||
-rw-r--r-- | drivers/video/omap2/displays/panel-generic-dpi.c | 25 | ||||
-rw-r--r-- | drivers/video/omap2/displays/panel-lgphilips-lb035q02.c | 279 | ||||
-rw-r--r-- | drivers/video/omap2/displays/panel-taal.c | 123 |
5 files changed, 382 insertions, 52 deletions
diff --git a/drivers/video/omap2/displays/Kconfig b/drivers/video/omap2/displays/Kconfig index 940cab394c2e..d18ad6b2372a 100644 --- a/drivers/video/omap2/displays/Kconfig +++ b/drivers/video/omap2/displays/Kconfig | |||
@@ -9,6 +9,12 @@ config PANEL_GENERIC_DPI | |||
9 | Supports LCD Panel used in TI SDP3430 and EVM boards, | 9 | Supports LCD Panel used in TI SDP3430 and EVM boards, |
10 | OMAP3517 EVM boards and CM-T35. | 10 | OMAP3517 EVM boards and CM-T35. |
11 | 11 | ||
12 | config PANEL_LGPHILIPS_LB035Q02 | ||
13 | tristate "LG.Philips LB035Q02 LCD Panel" | ||
14 | depends on OMAP2_DSS && SPI | ||
15 | help | ||
16 | LCD Panel used on the Gumstix Overo Palo35 | ||
17 | |||
12 | config PANEL_SHARP_LS037V7DW01 | 18 | config PANEL_SHARP_LS037V7DW01 |
13 | tristate "Sharp LS037V7DW01 LCD Panel" | 19 | tristate "Sharp LS037V7DW01 LCD Panel" |
14 | depends on OMAP2_DSS | 20 | depends on OMAP2_DSS |
diff --git a/drivers/video/omap2/displays/Makefile b/drivers/video/omap2/displays/Makefile index 861f0255ec6b..0f601ab3abf4 100644 --- a/drivers/video/omap2/displays/Makefile +++ b/drivers/video/omap2/displays/Makefile | |||
@@ -1,4 +1,5 @@ | |||
1 | obj-$(CONFIG_PANEL_GENERIC_DPI) += panel-generic-dpi.o | 1 | obj-$(CONFIG_PANEL_GENERIC_DPI) += panel-generic-dpi.o |
2 | obj-$(CONFIG_PANEL_LGPHILIPS_LB035Q02) += panel-lgphilips-lb035q02.o | ||
2 | obj-$(CONFIG_PANEL_SHARP_LS037V7DW01) += panel-sharp-ls037v7dw01.o | 3 | obj-$(CONFIG_PANEL_SHARP_LS037V7DW01) += panel-sharp-ls037v7dw01.o |
3 | obj-$(CONFIG_PANEL_NEC_NL8048HL11_01B) += panel-nec-nl8048hl11-01b.o | 4 | obj-$(CONFIG_PANEL_NEC_NL8048HL11_01B) += panel-nec-nl8048hl11-01b.o |
4 | 5 | ||
diff --git a/drivers/video/omap2/displays/panel-generic-dpi.c b/drivers/video/omap2/displays/panel-generic-dpi.c index 07eb30ee59c8..4a9b9ff59467 100644 --- a/drivers/video/omap2/displays/panel-generic-dpi.c +++ b/drivers/video/omap2/displays/panel-generic-dpi.c | |||
@@ -156,6 +156,31 @@ static struct panel_config generic_dpi_panels[] = { | |||
156 | .power_off_delay = 0, | 156 | .power_off_delay = 0, |
157 | .name = "toppoly_tdo35s", | 157 | .name = "toppoly_tdo35s", |
158 | }, | 158 | }, |
159 | |||
160 | /* Samsung LTE430WQ-F0C */ | ||
161 | { | ||
162 | { | ||
163 | .x_res = 480, | ||
164 | .y_res = 272, | ||
165 | |||
166 | .pixel_clock = 9200, | ||
167 | |||
168 | .hfp = 8, | ||
169 | .hsw = 41, | ||
170 | .hbp = 45 - 41, | ||
171 | |||
172 | .vfp = 4, | ||
173 | .vsw = 10, | ||
174 | .vbp = 12 - 10, | ||
175 | }, | ||
176 | .acbi = 0x0, | ||
177 | .acb = 0x0, | ||
178 | .config = OMAP_DSS_LCD_TFT | OMAP_DSS_LCD_IVS | | ||
179 | OMAP_DSS_LCD_IHS, | ||
180 | .power_on_delay = 0, | ||
181 | .power_off_delay = 0, | ||
182 | .name = "samsung_lte430wq_f0c", | ||
183 | }, | ||
159 | }; | 184 | }; |
160 | 185 | ||
161 | struct panel_drv_data { | 186 | struct panel_drv_data { |
diff --git a/drivers/video/omap2/displays/panel-lgphilips-lb035q02.c b/drivers/video/omap2/displays/panel-lgphilips-lb035q02.c new file mode 100644 index 000000000000..271324db2436 --- /dev/null +++ b/drivers/video/omap2/displays/panel-lgphilips-lb035q02.c | |||
@@ -0,0 +1,279 @@ | |||
1 | /* | ||
2 | * LCD panel driver for LG.Philips LB035Q02 | ||
3 | * | ||
4 | * Author: Steve Sakoman <steve@sakoman.com> | ||
5 | * | ||
6 | * This program is free software; you can redistribute it and/or modify it | ||
7 | * under the terms of the GNU General Public License version 2 as published by | ||
8 | * the Free Software Foundation. | ||
9 | * | ||
10 | * This program is distributed in the hope that it will be useful, but WITHOUT | ||
11 | * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or | ||
12 | * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for | ||
13 | * more details. | ||
14 | * | ||
15 | * You should have received a copy of the GNU General Public License along with | ||
16 | * this program. If not, see <http://www.gnu.org/licenses/>. | ||
17 | */ | ||
18 | |||
19 | #include <linux/module.h> | ||
20 | #include <linux/delay.h> | ||
21 | #include <linux/spi/spi.h> | ||
22 | #include <linux/mutex.h> | ||
23 | |||
24 | #include <plat/display.h> | ||
25 | |||
26 | struct lb035q02_data { | ||
27 | struct mutex lock; | ||
28 | }; | ||
29 | |||
30 | static struct omap_video_timings lb035q02_timings = { | ||
31 | .x_res = 320, | ||
32 | .y_res = 240, | ||
33 | |||
34 | .pixel_clock = 6500, | ||
35 | |||
36 | .hsw = 2, | ||
37 | .hfp = 20, | ||
38 | .hbp = 68, | ||
39 | |||
40 | .vsw = 2, | ||
41 | .vfp = 4, | ||
42 | .vbp = 18, | ||
43 | }; | ||
44 | |||
45 | static int lb035q02_panel_power_on(struct omap_dss_device *dssdev) | ||
46 | { | ||
47 | int r; | ||
48 | |||
49 | if (dssdev->state == OMAP_DSS_DISPLAY_ACTIVE) | ||
50 | return 0; | ||
51 | |||
52 | r = omapdss_dpi_display_enable(dssdev); | ||
53 | if (r) | ||
54 | goto err0; | ||
55 | |||
56 | if (dssdev->platform_enable) { | ||
57 | r = dssdev->platform_enable(dssdev); | ||
58 | if (r) | ||
59 | goto err1; | ||
60 | } | ||
61 | |||
62 | return 0; | ||
63 | err1: | ||
64 | omapdss_dpi_display_disable(dssdev); | ||
65 | err0: | ||
66 | return r; | ||
67 | } | ||
68 | |||
69 | static void lb035q02_panel_power_off(struct omap_dss_device *dssdev) | ||
70 | { | ||
71 | if (dssdev->state != OMAP_DSS_DISPLAY_ACTIVE) | ||
72 | return; | ||
73 | |||
74 | if (dssdev->platform_disable) | ||
75 | dssdev->platform_disable(dssdev); | ||
76 | |||
77 | omapdss_dpi_display_disable(dssdev); | ||
78 | } | ||
79 | |||
80 | static int lb035q02_panel_probe(struct omap_dss_device *dssdev) | ||
81 | { | ||
82 | struct lb035q02_data *ld; | ||
83 | int r; | ||
84 | |||
85 | dssdev->panel.config = OMAP_DSS_LCD_TFT | OMAP_DSS_LCD_IVS | | ||
86 | OMAP_DSS_LCD_IHS; | ||
87 | dssdev->panel.timings = lb035q02_timings; | ||
88 | |||
89 | ld = kzalloc(sizeof(*ld), GFP_KERNEL); | ||
90 | if (!ld) { | ||
91 | r = -ENOMEM; | ||
92 | goto err; | ||
93 | } | ||
94 | mutex_init(&ld->lock); | ||
95 | dev_set_drvdata(&dssdev->dev, ld); | ||
96 | return 0; | ||
97 | err: | ||
98 | return r; | ||
99 | } | ||
100 | |||
101 | static void lb035q02_panel_remove(struct omap_dss_device *dssdev) | ||
102 | { | ||
103 | struct lb035q02_data *ld = dev_get_drvdata(&dssdev->dev); | ||
104 | |||
105 | kfree(ld); | ||
106 | } | ||
107 | |||
108 | static int lb035q02_panel_enable(struct omap_dss_device *dssdev) | ||
109 | { | ||
110 | struct lb035q02_data *ld = dev_get_drvdata(&dssdev->dev); | ||
111 | int r; | ||
112 | |||
113 | mutex_lock(&ld->lock); | ||
114 | |||
115 | r = lb035q02_panel_power_on(dssdev); | ||
116 | if (r) | ||
117 | goto err; | ||
118 | dssdev->state = OMAP_DSS_DISPLAY_ACTIVE; | ||
119 | |||
120 | mutex_unlock(&ld->lock); | ||
121 | return 0; | ||
122 | err: | ||
123 | mutex_unlock(&ld->lock); | ||
124 | return r; | ||
125 | } | ||
126 | |||
127 | static void lb035q02_panel_disable(struct omap_dss_device *dssdev) | ||
128 | { | ||
129 | struct lb035q02_data *ld = dev_get_drvdata(&dssdev->dev); | ||
130 | |||
131 | mutex_lock(&ld->lock); | ||
132 | |||
133 | lb035q02_panel_power_off(dssdev); | ||
134 | dssdev->state = OMAP_DSS_DISPLAY_DISABLED; | ||
135 | |||
136 | mutex_unlock(&ld->lock); | ||
137 | } | ||
138 | |||
139 | static int lb035q02_panel_suspend(struct omap_dss_device *dssdev) | ||
140 | { | ||
141 | struct lb035q02_data *ld = dev_get_drvdata(&dssdev->dev); | ||
142 | |||
143 | mutex_lock(&ld->lock); | ||
144 | |||
145 | lb035q02_panel_power_off(dssdev); | ||
146 | dssdev->state = OMAP_DSS_DISPLAY_SUSPENDED; | ||
147 | |||
148 | mutex_unlock(&ld->lock); | ||
149 | return 0; | ||
150 | } | ||
151 | |||
152 | static int lb035q02_panel_resume(struct omap_dss_device *dssdev) | ||
153 | { | ||
154 | struct lb035q02_data *ld = dev_get_drvdata(&dssdev->dev); | ||
155 | int r; | ||
156 | |||
157 | mutex_lock(&ld->lock); | ||
158 | |||
159 | r = lb035q02_panel_power_on(dssdev); | ||
160 | if (r) | ||
161 | goto err; | ||
162 | dssdev->state = OMAP_DSS_DISPLAY_ACTIVE; | ||
163 | |||
164 | mutex_unlock(&ld->lock); | ||
165 | return 0; | ||
166 | err: | ||
167 | mutex_unlock(&ld->lock); | ||
168 | return r; | ||
169 | } | ||
170 | |||
171 | static struct omap_dss_driver lb035q02_driver = { | ||
172 | .probe = lb035q02_panel_probe, | ||
173 | .remove = lb035q02_panel_remove, | ||
174 | |||
175 | .enable = lb035q02_panel_enable, | ||
176 | .disable = lb035q02_panel_disable, | ||
177 | .suspend = lb035q02_panel_suspend, | ||
178 | .resume = lb035q02_panel_resume, | ||
179 | |||
180 | .driver = { | ||
181 | .name = "lgphilips_lb035q02_panel", | ||
182 | .owner = THIS_MODULE, | ||
183 | }, | ||
184 | }; | ||
185 | |||
186 | static int lb035q02_write_reg(struct spi_device *spi, u8 reg, u16 val) | ||
187 | { | ||
188 | struct spi_message msg; | ||
189 | struct spi_transfer index_xfer = { | ||
190 | .len = 3, | ||
191 | .cs_change = 1, | ||
192 | }; | ||
193 | struct spi_transfer value_xfer = { | ||
194 | .len = 3, | ||
195 | }; | ||
196 | u8 buffer[16]; | ||
197 | |||
198 | spi_message_init(&msg); | ||
199 | |||
200 | /* register index */ | ||
201 | buffer[0] = 0x70; | ||
202 | buffer[1] = 0x00; | ||
203 | buffer[2] = reg & 0x7f; | ||
204 | index_xfer.tx_buf = buffer; | ||
205 | spi_message_add_tail(&index_xfer, &msg); | ||
206 | |||
207 | /* register value */ | ||
208 | buffer[4] = 0x72; | ||
209 | buffer[5] = val >> 8; | ||
210 | buffer[6] = val; | ||
211 | value_xfer.tx_buf = buffer + 4; | ||
212 | spi_message_add_tail(&value_xfer, &msg); | ||
213 | |||
214 | return spi_sync(spi, &msg); | ||
215 | } | ||
216 | |||
217 | static void init_lb035q02_panel(struct spi_device *spi) | ||
218 | { | ||
219 | /* Init sequence from page 28 of the lb035q02 spec */ | ||
220 | lb035q02_write_reg(spi, 0x01, 0x6300); | ||
221 | lb035q02_write_reg(spi, 0x02, 0x0200); | ||
222 | lb035q02_write_reg(spi, 0x03, 0x0177); | ||
223 | lb035q02_write_reg(spi, 0x04, 0x04c7); | ||
224 | lb035q02_write_reg(spi, 0x05, 0xffc0); | ||
225 | lb035q02_write_reg(spi, 0x06, 0xe806); | ||
226 | lb035q02_write_reg(spi, 0x0a, 0x4008); | ||
227 | lb035q02_write_reg(spi, 0x0b, 0x0000); | ||
228 | lb035q02_write_reg(spi, 0x0d, 0x0030); | ||
229 | lb035q02_write_reg(spi, 0x0e, 0x2800); | ||
230 | lb035q02_write_reg(spi, 0x0f, 0x0000); | ||
231 | lb035q02_write_reg(spi, 0x16, 0x9f80); | ||
232 | lb035q02_write_reg(spi, 0x17, 0x0a0f); | ||
233 | lb035q02_write_reg(spi, 0x1e, 0x00c1); | ||
234 | lb035q02_write_reg(spi, 0x30, 0x0300); | ||
235 | lb035q02_write_reg(spi, 0x31, 0x0007); | ||
236 | lb035q02_write_reg(spi, 0x32, 0x0000); | ||
237 | lb035q02_write_reg(spi, 0x33, 0x0000); | ||
238 | lb035q02_write_reg(spi, 0x34, 0x0707); | ||
239 | lb035q02_write_reg(spi, 0x35, 0x0004); | ||
240 | lb035q02_write_reg(spi, 0x36, 0x0302); | ||
241 | lb035q02_write_reg(spi, 0x37, 0x0202); | ||
242 | lb035q02_write_reg(spi, 0x3a, 0x0a0d); | ||
243 | lb035q02_write_reg(spi, 0x3b, 0x0806); | ||
244 | } | ||
245 | |||
246 | static int __devinit lb035q02_panel_spi_probe(struct spi_device *spi) | ||
247 | { | ||
248 | init_lb035q02_panel(spi); | ||
249 | return omap_dss_register_driver(&lb035q02_driver); | ||
250 | } | ||
251 | |||
252 | static int __devexit lb035q02_panel_spi_remove(struct spi_device *spi) | ||
253 | { | ||
254 | omap_dss_unregister_driver(&lb035q02_driver); | ||
255 | return 0; | ||
256 | } | ||
257 | |||
258 | static struct spi_driver lb035q02_spi_driver = { | ||
259 | .driver = { | ||
260 | .name = "lgphilips_lb035q02_panel-spi", | ||
261 | .owner = THIS_MODULE, | ||
262 | }, | ||
263 | .probe = lb035q02_panel_spi_probe, | ||
264 | .remove = __devexit_p(lb035q02_panel_spi_remove), | ||
265 | }; | ||
266 | |||
267 | static int __init lb035q02_panel_drv_init(void) | ||
268 | { | ||
269 | return spi_register_driver(&lb035q02_spi_driver); | ||
270 | } | ||
271 | |||
272 | static void __exit lb035q02_panel_drv_exit(void) | ||
273 | { | ||
274 | spi_unregister_driver(&lb035q02_spi_driver); | ||
275 | } | ||
276 | |||
277 | module_init(lb035q02_panel_drv_init); | ||
278 | module_exit(lb035q02_panel_drv_exit); | ||
279 | MODULE_LICENSE("GPL"); | ||
diff --git a/drivers/video/omap2/displays/panel-taal.c b/drivers/video/omap2/displays/panel-taal.c index c74e8b778ba1..adc9900458e1 100644 --- a/drivers/video/omap2/displays/panel-taal.c +++ b/drivers/video/omap2/displays/panel-taal.c | |||
@@ -218,6 +218,8 @@ struct taal_data { | |||
218 | u16 w; | 218 | u16 w; |
219 | u16 h; | 219 | u16 h; |
220 | } update_region; | 220 | } update_region; |
221 | int channel; | ||
222 | |||
221 | struct delayed_work te_timeout_work; | 223 | struct delayed_work te_timeout_work; |
222 | 224 | ||
223 | bool use_dsi_bl; | 225 | bool use_dsi_bl; |
@@ -257,12 +259,12 @@ static void hw_guard_wait(struct taal_data *td) | |||
257 | } | 259 | } |
258 | } | 260 | } |
259 | 261 | ||
260 | static int taal_dcs_read_1(u8 dcs_cmd, u8 *data) | 262 | static int taal_dcs_read_1(struct taal_data *td, u8 dcs_cmd, u8 *data) |
261 | { | 263 | { |
262 | int r; | 264 | int r; |
263 | u8 buf[1]; | 265 | u8 buf[1]; |
264 | 266 | ||
265 | r = dsi_vc_dcs_read(TCH, dcs_cmd, buf, 1); | 267 | r = dsi_vc_dcs_read(td->channel, dcs_cmd, buf, 1); |
266 | 268 | ||
267 | if (r < 0) | 269 | if (r < 0) |
268 | return r; | 270 | return r; |
@@ -272,17 +274,17 @@ static int taal_dcs_read_1(u8 dcs_cmd, u8 *data) | |||
272 | return 0; | 274 | return 0; |
273 | } | 275 | } |
274 | 276 | ||
275 | static int taal_dcs_write_0(u8 dcs_cmd) | 277 | static int taal_dcs_write_0(struct taal_data *td, u8 dcs_cmd) |
276 | { | 278 | { |
277 | return dsi_vc_dcs_write(TCH, &dcs_cmd, 1); | 279 | return dsi_vc_dcs_write(td->channel, &dcs_cmd, 1); |
278 | } | 280 | } |
279 | 281 | ||
280 | static int taal_dcs_write_1(u8 dcs_cmd, u8 param) | 282 | static int taal_dcs_write_1(struct taal_data *td, u8 dcs_cmd, u8 param) |
281 | { | 283 | { |
282 | u8 buf[2]; | 284 | u8 buf[2]; |
283 | buf[0] = dcs_cmd; | 285 | buf[0] = dcs_cmd; |
284 | buf[1] = param; | 286 | buf[1] = param; |
285 | return dsi_vc_dcs_write(TCH, buf, 2); | 287 | return dsi_vc_dcs_write(td->channel, buf, 2); |
286 | } | 288 | } |
287 | 289 | ||
288 | static int taal_sleep_in(struct taal_data *td) | 290 | static int taal_sleep_in(struct taal_data *td) |
@@ -294,7 +296,7 @@ static int taal_sleep_in(struct taal_data *td) | |||
294 | hw_guard_wait(td); | 296 | hw_guard_wait(td); |
295 | 297 | ||
296 | cmd = DCS_SLEEP_IN; | 298 | cmd = DCS_SLEEP_IN; |
297 | r = dsi_vc_dcs_write_nosync(TCH, &cmd, 1); | 299 | r = dsi_vc_dcs_write_nosync(td->channel, &cmd, 1); |
298 | if (r) | 300 | if (r) |
299 | return r; | 301 | return r; |
300 | 302 | ||
@@ -312,7 +314,7 @@ static int taal_sleep_out(struct taal_data *td) | |||
312 | 314 | ||
313 | hw_guard_wait(td); | 315 | hw_guard_wait(td); |
314 | 316 | ||
315 | r = taal_dcs_write_0(DCS_SLEEP_OUT); | 317 | r = taal_dcs_write_0(td, DCS_SLEEP_OUT); |
316 | if (r) | 318 | if (r) |
317 | return r; | 319 | return r; |
318 | 320 | ||
@@ -324,30 +326,30 @@ static int taal_sleep_out(struct taal_data *td) | |||
324 | return 0; | 326 | return 0; |
325 | } | 327 | } |
326 | 328 | ||
327 | static int taal_get_id(u8 *id1, u8 *id2, u8 *id3) | 329 | static int taal_get_id(struct taal_data *td, u8 *id1, u8 *id2, u8 *id3) |
328 | { | 330 | { |
329 | int r; | 331 | int r; |
330 | 332 | ||
331 | r = taal_dcs_read_1(DCS_GET_ID1, id1); | 333 | r = taal_dcs_read_1(td, DCS_GET_ID1, id1); |
332 | if (r) | 334 | if (r) |
333 | return r; | 335 | return r; |
334 | r = taal_dcs_read_1(DCS_GET_ID2, id2); | 336 | r = taal_dcs_read_1(td, DCS_GET_ID2, id2); |
335 | if (r) | 337 | if (r) |
336 | return r; | 338 | return r; |
337 | r = taal_dcs_read_1(DCS_GET_ID3, id3); | 339 | r = taal_dcs_read_1(td, DCS_GET_ID3, id3); |
338 | if (r) | 340 | if (r) |
339 | return r; | 341 | return r; |
340 | 342 | ||
341 | return 0; | 343 | return 0; |
342 | } | 344 | } |
343 | 345 | ||
344 | static int taal_set_addr_mode(u8 rotate, bool mirror) | 346 | static int taal_set_addr_mode(struct taal_data *td, u8 rotate, bool mirror) |
345 | { | 347 | { |
346 | int r; | 348 | int r; |
347 | u8 mode; | 349 | u8 mode; |
348 | int b5, b6, b7; | 350 | int b5, b6, b7; |
349 | 351 | ||
350 | r = taal_dcs_read_1(DCS_READ_MADCTL, &mode); | 352 | r = taal_dcs_read_1(td, DCS_READ_MADCTL, &mode); |
351 | if (r) | 353 | if (r) |
352 | return r; | 354 | return r; |
353 | 355 | ||
@@ -381,10 +383,11 @@ static int taal_set_addr_mode(u8 rotate, bool mirror) | |||
381 | mode &= ~((1<<7) | (1<<6) | (1<<5)); | 383 | mode &= ~((1<<7) | (1<<6) | (1<<5)); |
382 | mode |= (b7 << 7) | (b6 << 6) | (b5 << 5); | 384 | mode |= (b7 << 7) | (b6 << 6) | (b5 << 5); |
383 | 385 | ||
384 | return taal_dcs_write_1(DCS_MEM_ACC_CTRL, mode); | 386 | return taal_dcs_write_1(td, DCS_MEM_ACC_CTRL, mode); |
385 | } | 387 | } |
386 | 388 | ||
387 | static int taal_set_update_window(u16 x, u16 y, u16 w, u16 h) | 389 | static int taal_set_update_window(struct taal_data *td, |
390 | u16 x, u16 y, u16 w, u16 h) | ||
388 | { | 391 | { |
389 | int r; | 392 | int r; |
390 | u16 x1 = x; | 393 | u16 x1 = x; |
@@ -399,7 +402,7 @@ static int taal_set_update_window(u16 x, u16 y, u16 w, u16 h) | |||
399 | buf[3] = (x2 >> 8) & 0xff; | 402 | buf[3] = (x2 >> 8) & 0xff; |
400 | buf[4] = (x2 >> 0) & 0xff; | 403 | buf[4] = (x2 >> 0) & 0xff; |
401 | 404 | ||
402 | r = dsi_vc_dcs_write_nosync(TCH, buf, sizeof(buf)); | 405 | r = dsi_vc_dcs_write_nosync(td->channel, buf, sizeof(buf)); |
403 | if (r) | 406 | if (r) |
404 | return r; | 407 | return r; |
405 | 408 | ||
@@ -409,11 +412,11 @@ static int taal_set_update_window(u16 x, u16 y, u16 w, u16 h) | |||
409 | buf[3] = (y2 >> 8) & 0xff; | 412 | buf[3] = (y2 >> 8) & 0xff; |
410 | buf[4] = (y2 >> 0) & 0xff; | 413 | buf[4] = (y2 >> 0) & 0xff; |
411 | 414 | ||
412 | r = dsi_vc_dcs_write_nosync(TCH, buf, sizeof(buf)); | 415 | r = dsi_vc_dcs_write_nosync(td->channel, buf, sizeof(buf)); |
413 | if (r) | 416 | if (r) |
414 | return r; | 417 | return r; |
415 | 418 | ||
416 | dsi_vc_send_bta_sync(TCH); | 419 | dsi_vc_send_bta_sync(td->channel); |
417 | 420 | ||
418 | return r; | 421 | return r; |
419 | } | 422 | } |
@@ -439,7 +442,7 @@ static int taal_bl_update_status(struct backlight_device *dev) | |||
439 | if (td->use_dsi_bl) { | 442 | if (td->use_dsi_bl) { |
440 | if (td->enabled) { | 443 | if (td->enabled) { |
441 | dsi_bus_lock(); | 444 | dsi_bus_lock(); |
442 | r = taal_dcs_write_1(DCS_BRIGHTNESS, level); | 445 | r = taal_dcs_write_1(td, DCS_BRIGHTNESS, level); |
443 | dsi_bus_unlock(); | 446 | dsi_bus_unlock(); |
444 | } else { | 447 | } else { |
445 | r = 0; | 448 | r = 0; |
@@ -502,7 +505,7 @@ static ssize_t taal_num_errors_show(struct device *dev, | |||
502 | 505 | ||
503 | if (td->enabled) { | 506 | if (td->enabled) { |
504 | dsi_bus_lock(); | 507 | dsi_bus_lock(); |
505 | r = taal_dcs_read_1(DCS_READ_NUM_ERRORS, &errors); | 508 | r = taal_dcs_read_1(td, DCS_READ_NUM_ERRORS, &errors); |
506 | dsi_bus_unlock(); | 509 | dsi_bus_unlock(); |
507 | } else { | 510 | } else { |
508 | r = -ENODEV; | 511 | r = -ENODEV; |
@@ -528,7 +531,7 @@ static ssize_t taal_hw_revision_show(struct device *dev, | |||
528 | 531 | ||
529 | if (td->enabled) { | 532 | if (td->enabled) { |
530 | dsi_bus_lock(); | 533 | dsi_bus_lock(); |
531 | r = taal_get_id(&id1, &id2, &id3); | 534 | r = taal_get_id(td, &id1, &id2, &id3); |
532 | dsi_bus_unlock(); | 535 | dsi_bus_unlock(); |
533 | } else { | 536 | } else { |
534 | r = -ENODEV; | 537 | r = -ENODEV; |
@@ -590,7 +593,7 @@ static ssize_t store_cabc_mode(struct device *dev, | |||
590 | if (td->enabled) { | 593 | if (td->enabled) { |
591 | dsi_bus_lock(); | 594 | dsi_bus_lock(); |
592 | if (!td->cabc_broken) | 595 | if (!td->cabc_broken) |
593 | taal_dcs_write_1(DCS_WRITE_CABC, i); | 596 | taal_dcs_write_1(td, DCS_WRITE_CABC, i); |
594 | dsi_bus_unlock(); | 597 | dsi_bus_unlock(); |
595 | } | 598 | } |
596 | 599 | ||
@@ -776,14 +779,29 @@ static int taal_probe(struct omap_dss_device *dssdev) | |||
776 | dev_dbg(&dssdev->dev, "Using GPIO TE\n"); | 779 | dev_dbg(&dssdev->dev, "Using GPIO TE\n"); |
777 | } | 780 | } |
778 | 781 | ||
782 | r = omap_dsi_request_vc(dssdev, &td->channel); | ||
783 | if (r) { | ||
784 | dev_err(&dssdev->dev, "failed to get virtual channel\n"); | ||
785 | goto err_req_vc; | ||
786 | } | ||
787 | |||
788 | r = omap_dsi_set_vc_id(dssdev, td->channel, TCH); | ||
789 | if (r) { | ||
790 | dev_err(&dssdev->dev, "failed to set VC_ID\n"); | ||
791 | goto err_vc_id; | ||
792 | } | ||
793 | |||
779 | r = sysfs_create_group(&dssdev->dev.kobj, &taal_attr_group); | 794 | r = sysfs_create_group(&dssdev->dev.kobj, &taal_attr_group); |
780 | if (r) { | 795 | if (r) { |
781 | dev_err(&dssdev->dev, "failed to create sysfs files\n"); | 796 | dev_err(&dssdev->dev, "failed to create sysfs files\n"); |
782 | goto err_sysfs; | 797 | goto err_vc_id; |
783 | } | 798 | } |
784 | 799 | ||
785 | return 0; | 800 | return 0; |
786 | err_sysfs: | 801 | |
802 | err_vc_id: | ||
803 | omap_dsi_release_vc(dssdev, td->channel); | ||
804 | err_req_vc: | ||
787 | if (panel_data->use_ext_te) | 805 | if (panel_data->use_ext_te) |
788 | free_irq(gpio_to_irq(panel_data->ext_te_gpio), dssdev); | 806 | free_irq(gpio_to_irq(panel_data->ext_te_gpio), dssdev); |
789 | err_irq: | 807 | err_irq: |
@@ -810,6 +828,7 @@ static void taal_remove(struct omap_dss_device *dssdev) | |||
810 | dev_dbg(&dssdev->dev, "remove\n"); | 828 | dev_dbg(&dssdev->dev, "remove\n"); |
811 | 829 | ||
812 | sysfs_remove_group(&dssdev->dev.kobj, &taal_attr_group); | 830 | sysfs_remove_group(&dssdev->dev.kobj, &taal_attr_group); |
831 | omap_dsi_release_vc(dssdev, td->channel); | ||
813 | 832 | ||
814 | if (panel_data->use_ext_te) { | 833 | if (panel_data->use_ext_te) { |
815 | int gpio = panel_data->ext_te_gpio; | 834 | int gpio = panel_data->ext_te_gpio; |
@@ -848,13 +867,13 @@ static int taal_power_on(struct omap_dss_device *dssdev) | |||
848 | 867 | ||
849 | taal_hw_reset(dssdev); | 868 | taal_hw_reset(dssdev); |
850 | 869 | ||
851 | omapdss_dsi_vc_enable_hs(TCH, false); | 870 | omapdss_dsi_vc_enable_hs(td->channel, false); |
852 | 871 | ||
853 | r = taal_sleep_out(td); | 872 | r = taal_sleep_out(td); |
854 | if (r) | 873 | if (r) |
855 | goto err; | 874 | goto err; |
856 | 875 | ||
857 | r = taal_get_id(&id1, &id2, &id3); | 876 | r = taal_get_id(td, &id1, &id2, &id3); |
858 | if (r) | 877 | if (r) |
859 | goto err; | 878 | goto err; |
860 | 879 | ||
@@ -863,30 +882,30 @@ static int taal_power_on(struct omap_dss_device *dssdev) | |||
863 | (id2 == 0x00 || id2 == 0xff || id2 == 0x81)) | 882 | (id2 == 0x00 || id2 == 0xff || id2 == 0x81)) |
864 | td->cabc_broken = true; | 883 | td->cabc_broken = true; |
865 | 884 | ||
866 | r = taal_dcs_write_1(DCS_BRIGHTNESS, 0xff); | 885 | r = taal_dcs_write_1(td, DCS_BRIGHTNESS, 0xff); |
867 | if (r) | 886 | if (r) |
868 | goto err; | 887 | goto err; |
869 | 888 | ||
870 | r = taal_dcs_write_1(DCS_CTRL_DISPLAY, | 889 | r = taal_dcs_write_1(td, DCS_CTRL_DISPLAY, |
871 | (1<<2) | (1<<5)); /* BL | BCTRL */ | 890 | (1<<2) | (1<<5)); /* BL | BCTRL */ |
872 | if (r) | 891 | if (r) |
873 | goto err; | 892 | goto err; |
874 | 893 | ||
875 | r = taal_dcs_write_1(DCS_PIXEL_FORMAT, 0x7); /* 24bit/pixel */ | 894 | r = taal_dcs_write_1(td, DCS_PIXEL_FORMAT, 0x7); /* 24bit/pixel */ |
876 | if (r) | 895 | if (r) |
877 | goto err; | 896 | goto err; |
878 | 897 | ||
879 | r = taal_set_addr_mode(td->rotate, td->mirror); | 898 | r = taal_set_addr_mode(td, td->rotate, td->mirror); |
880 | if (r) | 899 | if (r) |
881 | goto err; | 900 | goto err; |
882 | 901 | ||
883 | if (!td->cabc_broken) { | 902 | if (!td->cabc_broken) { |
884 | r = taal_dcs_write_1(DCS_WRITE_CABC, td->cabc_mode); | 903 | r = taal_dcs_write_1(td, DCS_WRITE_CABC, td->cabc_mode); |
885 | if (r) | 904 | if (r) |
886 | goto err; | 905 | goto err; |
887 | } | 906 | } |
888 | 907 | ||
889 | r = taal_dcs_write_0(DCS_DISPLAY_ON); | 908 | r = taal_dcs_write_0(td, DCS_DISPLAY_ON); |
890 | if (r) | 909 | if (r) |
891 | goto err; | 910 | goto err; |
892 | 911 | ||
@@ -905,7 +924,7 @@ static int taal_power_on(struct omap_dss_device *dssdev) | |||
905 | td->intro_printed = true; | 924 | td->intro_printed = true; |
906 | } | 925 | } |
907 | 926 | ||
908 | omapdss_dsi_vc_enable_hs(TCH, true); | 927 | omapdss_dsi_vc_enable_hs(td->channel, true); |
909 | 928 | ||
910 | return 0; | 929 | return 0; |
911 | err: | 930 | err: |
@@ -923,7 +942,7 @@ static void taal_power_off(struct omap_dss_device *dssdev) | |||
923 | struct taal_data *td = dev_get_drvdata(&dssdev->dev); | 942 | struct taal_data *td = dev_get_drvdata(&dssdev->dev); |
924 | int r; | 943 | int r; |
925 | 944 | ||
926 | r = taal_dcs_write_0(DCS_DISPLAY_OFF); | 945 | r = taal_dcs_write_0(td, DCS_DISPLAY_OFF); |
927 | if (!r) { | 946 | if (!r) { |
928 | r = taal_sleep_in(td); | 947 | r = taal_sleep_in(td); |
929 | /* HACK: wait a bit so that the message goes through */ | 948 | /* HACK: wait a bit so that the message goes through */ |
@@ -1091,7 +1110,7 @@ static irqreturn_t taal_te_isr(int irq, void *data) | |||
1091 | if (old) { | 1110 | if (old) { |
1092 | cancel_delayed_work(&td->te_timeout_work); | 1111 | cancel_delayed_work(&td->te_timeout_work); |
1093 | 1112 | ||
1094 | r = omap_dsi_update(dssdev, TCH, | 1113 | r = omap_dsi_update(dssdev, td->channel, |
1095 | td->update_region.x, | 1114 | td->update_region.x, |
1096 | td->update_region.y, | 1115 | td->update_region.y, |
1097 | td->update_region.w, | 1116 | td->update_region.w, |
@@ -1141,7 +1160,7 @@ static int taal_update(struct omap_dss_device *dssdev, | |||
1141 | if (r) | 1160 | if (r) |
1142 | goto err; | 1161 | goto err; |
1143 | 1162 | ||
1144 | r = taal_set_update_window(x, y, w, h); | 1163 | r = taal_set_update_window(td, x, y, w, h); |
1145 | if (r) | 1164 | if (r) |
1146 | goto err; | 1165 | goto err; |
1147 | 1166 | ||
@@ -1155,7 +1174,7 @@ static int taal_update(struct omap_dss_device *dssdev, | |||
1155 | msecs_to_jiffies(250)); | 1174 | msecs_to_jiffies(250)); |
1156 | atomic_set(&td->do_update, 1); | 1175 | atomic_set(&td->do_update, 1); |
1157 | } else { | 1176 | } else { |
1158 | r = omap_dsi_update(dssdev, TCH, x, y, w, h, | 1177 | r = omap_dsi_update(dssdev, td->channel, x, y, w, h, |
1159 | taal_framedone_cb, dssdev); | 1178 | taal_framedone_cb, dssdev); |
1160 | if (r) | 1179 | if (r) |
1161 | goto err; | 1180 | goto err; |
@@ -1193,9 +1212,9 @@ static int _taal_enable_te(struct omap_dss_device *dssdev, bool enable) | |||
1193 | int r; | 1212 | int r; |
1194 | 1213 | ||
1195 | if (enable) | 1214 | if (enable) |
1196 | r = taal_dcs_write_1(DCS_TEAR_ON, 0); | 1215 | r = taal_dcs_write_1(td, DCS_TEAR_ON, 0); |
1197 | else | 1216 | else |
1198 | r = taal_dcs_write_0(DCS_TEAR_OFF); | 1217 | r = taal_dcs_write_0(td, DCS_TEAR_OFF); |
1199 | 1218 | ||
1200 | if (!panel_data->use_ext_te) | 1219 | if (!panel_data->use_ext_te) |
1201 | omapdss_dsi_enable_te(dssdev, enable); | 1220 | omapdss_dsi_enable_te(dssdev, enable); |
@@ -1265,7 +1284,7 @@ static int taal_rotate(struct omap_dss_device *dssdev, u8 rotate) | |||
1265 | dsi_bus_lock(); | 1284 | dsi_bus_lock(); |
1266 | 1285 | ||
1267 | if (td->enabled) { | 1286 | if (td->enabled) { |
1268 | r = taal_set_addr_mode(rotate, td->mirror); | 1287 | r = taal_set_addr_mode(td, rotate, td->mirror); |
1269 | if (r) | 1288 | if (r) |
1270 | goto err; | 1289 | goto err; |
1271 | } | 1290 | } |
@@ -1308,7 +1327,7 @@ static int taal_mirror(struct omap_dss_device *dssdev, bool enable) | |||
1308 | 1327 | ||
1309 | dsi_bus_lock(); | 1328 | dsi_bus_lock(); |
1310 | if (td->enabled) { | 1329 | if (td->enabled) { |
1311 | r = taal_set_addr_mode(td->rotate, enable); | 1330 | r = taal_set_addr_mode(td, td->rotate, enable); |
1312 | if (r) | 1331 | if (r) |
1313 | goto err; | 1332 | goto err; |
1314 | } | 1333 | } |
@@ -1352,13 +1371,13 @@ static int taal_run_test(struct omap_dss_device *dssdev, int test_num) | |||
1352 | 1371 | ||
1353 | dsi_bus_lock(); | 1372 | dsi_bus_lock(); |
1354 | 1373 | ||
1355 | r = taal_dcs_read_1(DCS_GET_ID1, &id1); | 1374 | r = taal_dcs_read_1(td, DCS_GET_ID1, &id1); |
1356 | if (r) | 1375 | if (r) |
1357 | goto err2; | 1376 | goto err2; |
1358 | r = taal_dcs_read_1(DCS_GET_ID2, &id2); | 1377 | r = taal_dcs_read_1(td, DCS_GET_ID2, &id2); |
1359 | if (r) | 1378 | if (r) |
1360 | goto err2; | 1379 | goto err2; |
1361 | r = taal_dcs_read_1(DCS_GET_ID3, &id3); | 1380 | r = taal_dcs_read_1(td, DCS_GET_ID3, &id3); |
1362 | if (r) | 1381 | if (r) |
1363 | goto err2; | 1382 | goto err2; |
1364 | 1383 | ||
@@ -1406,9 +1425,9 @@ static int taal_memory_read(struct omap_dss_device *dssdev, | |||
1406 | else | 1425 | else |
1407 | plen = 2; | 1426 | plen = 2; |
1408 | 1427 | ||
1409 | taal_set_update_window(x, y, w, h); | 1428 | taal_set_update_window(td, x, y, w, h); |
1410 | 1429 | ||
1411 | r = dsi_vc_set_max_rx_packet_size(TCH, plen); | 1430 | r = dsi_vc_set_max_rx_packet_size(td->channel, plen); |
1412 | if (r) | 1431 | if (r) |
1413 | goto err2; | 1432 | goto err2; |
1414 | 1433 | ||
@@ -1416,7 +1435,7 @@ static int taal_memory_read(struct omap_dss_device *dssdev, | |||
1416 | u8 dcs_cmd = first ? 0x2e : 0x3e; | 1435 | u8 dcs_cmd = first ? 0x2e : 0x3e; |
1417 | first = 0; | 1436 | first = 0; |
1418 | 1437 | ||
1419 | r = dsi_vc_dcs_read(TCH, dcs_cmd, | 1438 | r = dsi_vc_dcs_read(td->channel, dcs_cmd, |
1420 | buf + buf_used, size - buf_used); | 1439 | buf + buf_used, size - buf_used); |
1421 | 1440 | ||
1422 | if (r < 0) { | 1441 | if (r < 0) { |
@@ -1442,7 +1461,7 @@ static int taal_memory_read(struct omap_dss_device *dssdev, | |||
1442 | r = buf_used; | 1461 | r = buf_used; |
1443 | 1462 | ||
1444 | err3: | 1463 | err3: |
1445 | dsi_vc_set_max_rx_packet_size(TCH, 1); | 1464 | dsi_vc_set_max_rx_packet_size(td->channel, 1); |
1446 | err2: | 1465 | err2: |
1447 | dsi_bus_unlock(); | 1466 | dsi_bus_unlock(); |
1448 | err1: | 1467 | err1: |
@@ -1468,7 +1487,7 @@ static void taal_esd_work(struct work_struct *work) | |||
1468 | 1487 | ||
1469 | dsi_bus_lock(); | 1488 | dsi_bus_lock(); |
1470 | 1489 | ||
1471 | r = taal_dcs_read_1(DCS_RDDSDR, &state1); | 1490 | r = taal_dcs_read_1(td, DCS_RDDSDR, &state1); |
1472 | if (r) { | 1491 | if (r) { |
1473 | dev_err(&dssdev->dev, "failed to read Taal status\n"); | 1492 | dev_err(&dssdev->dev, "failed to read Taal status\n"); |
1474 | goto err; | 1493 | goto err; |
@@ -1481,7 +1500,7 @@ static void taal_esd_work(struct work_struct *work) | |||
1481 | goto err; | 1500 | goto err; |
1482 | } | 1501 | } |
1483 | 1502 | ||
1484 | r = taal_dcs_read_1(DCS_RDDSDR, &state2); | 1503 | r = taal_dcs_read_1(td, DCS_RDDSDR, &state2); |
1485 | if (r) { | 1504 | if (r) { |
1486 | dev_err(&dssdev->dev, "failed to read Taal status\n"); | 1505 | dev_err(&dssdev->dev, "failed to read Taal status\n"); |
1487 | goto err; | 1506 | goto err; |
@@ -1497,7 +1516,7 @@ static void taal_esd_work(struct work_struct *work) | |||
1497 | /* Self-diagnostics result is also shown on TE GPIO line. We need | 1516 | /* Self-diagnostics result is also shown on TE GPIO line. We need |
1498 | * to re-enable TE after self diagnostics */ | 1517 | * to re-enable TE after self diagnostics */ |
1499 | if (td->te_enabled && panel_data->use_ext_te) { | 1518 | if (td->te_enabled && panel_data->use_ext_te) { |
1500 | r = taal_dcs_write_1(DCS_TEAR_ON, 0); | 1519 | r = taal_dcs_write_1(td, DCS_TEAR_ON, 0); |
1501 | if (r) | 1520 | if (r) |
1502 | goto err; | 1521 | goto err; |
1503 | } | 1522 | } |