blob: 3f4fa0b08460edea3d4928af8b9200ee6f825c84 [file] [log] [blame]
Tomi Valkeineneed07e02009-08-07 13:43:20 +03001/*
2 * linux/drivers/video/omap2/dss/display.c
3 *
4 * Copyright (C) 2009 Nokia Corporation
5 * Author: Tomi Valkeinen <tomi.valkeinen@nokia.com>
6 *
7 * Some code and ideas taken from drivers/video/omap/ driver
8 * by Imre Deak.
9 *
10 * This program is free software; you can redistribute it and/or modify it
11 * under the terms of the GNU General Public License version 2 as published by
12 * the Free Software Foundation.
13 *
14 * This program is distributed in the hope that it will be useful, but WITHOUT
15 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
16 * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
17 * more details.
18 *
19 * You should have received a copy of the GNU General Public License along with
20 * this program. If not, see <http://www.gnu.org/licenses/>.
21 */
22
23#define DSS_SUBSYS_NAME "DISPLAY"
24
25#include <linux/kernel.h>
26#include <linux/module.h>
27#include <linux/jiffies.h>
28#include <linux/list.h>
29#include <linux/platform_device.h>
30
31#include <plat/display.h>
32#include "dss.h"
33
34static LIST_HEAD(display_list);
35
36static ssize_t display_enabled_show(struct device *dev,
37 struct device_attribute *attr, char *buf)
38{
39 struct omap_dss_device *dssdev = to_dss_device(dev);
40 bool enabled = dssdev->state != OMAP_DSS_DISPLAY_DISABLED;
41
42 return snprintf(buf, PAGE_SIZE, "%d\n", enabled);
43}
44
45static ssize_t display_enabled_store(struct device *dev,
46 struct device_attribute *attr,
47 const char *buf, size_t size)
48{
49 struct omap_dss_device *dssdev = to_dss_device(dev);
50 bool enabled, r;
51
52 enabled = simple_strtoul(buf, NULL, 10);
53
54 if (enabled != (dssdev->state != OMAP_DSS_DISPLAY_DISABLED)) {
55 if (enabled) {
Tomi Valkeinen37ac60e2010-01-12 15:12:07 +020056 r = dssdev->driver->enable(dssdev);
Tomi Valkeineneed07e02009-08-07 13:43:20 +030057 if (r)
58 return r;
59 } else {
Tomi Valkeinen37ac60e2010-01-12 15:12:07 +020060 dssdev->driver->disable(dssdev);
Tomi Valkeineneed07e02009-08-07 13:43:20 +030061 }
62 }
63
64 return size;
65}
66
67static ssize_t display_upd_mode_show(struct device *dev,
68 struct device_attribute *attr, char *buf)
69{
70 struct omap_dss_device *dssdev = to_dss_device(dev);
71 enum omap_dss_update_mode mode = OMAP_DSS_UPDATE_AUTO;
Tomi Valkeinen446f7bf2010-01-11 16:12:31 +020072 if (dssdev->driver->get_update_mode)
73 mode = dssdev->driver->get_update_mode(dssdev);
Tomi Valkeineneed07e02009-08-07 13:43:20 +030074 return snprintf(buf, PAGE_SIZE, "%d\n", mode);
75}
76
77static ssize_t display_upd_mode_store(struct device *dev,
78 struct device_attribute *attr,
79 const char *buf, size_t size)
80{
81 struct omap_dss_device *dssdev = to_dss_device(dev);
82 int val, r;
83 enum omap_dss_update_mode mode;
84
Ville Syrjälä825f50b2010-03-02 21:30:52 +020085 if (!dssdev->driver->set_update_mode)
86 return -EINVAL;
87
Tomi Valkeineneed07e02009-08-07 13:43:20 +030088 val = simple_strtoul(buf, NULL, 10);
89
90 switch (val) {
91 case OMAP_DSS_UPDATE_DISABLED:
92 case OMAP_DSS_UPDATE_AUTO:
93 case OMAP_DSS_UPDATE_MANUAL:
94 mode = (enum omap_dss_update_mode)val;
95 break;
96 default:
97 return -EINVAL;
98 }
99
Tomi Valkeinen446f7bf2010-01-11 16:12:31 +0200100 r = dssdev->driver->set_update_mode(dssdev, mode);
Tomi Valkeineneed07e02009-08-07 13:43:20 +0300101 if (r)
102 return r;
103
104 return size;
105}
106
107static ssize_t display_tear_show(struct device *dev,
108 struct device_attribute *attr, char *buf)
109{
110 struct omap_dss_device *dssdev = to_dss_device(dev);
111 return snprintf(buf, PAGE_SIZE, "%d\n",
Tomi Valkeinen225b6502010-01-11 15:11:01 +0200112 dssdev->driver->get_te ?
113 dssdev->driver->get_te(dssdev) : 0);
Tomi Valkeineneed07e02009-08-07 13:43:20 +0300114}
115
116static ssize_t display_tear_store(struct device *dev,
117 struct device_attribute *attr, const char *buf, size_t size)
118{
119 struct omap_dss_device *dssdev = to_dss_device(dev);
120 unsigned long te;
121 int r;
122
Tomi Valkeinen225b6502010-01-11 15:11:01 +0200123 if (!dssdev->driver->enable_te || !dssdev->driver->get_te)
Tomi Valkeineneed07e02009-08-07 13:43:20 +0300124 return -ENOENT;
125
126 te = simple_strtoul(buf, NULL, 0);
127
Tomi Valkeinen225b6502010-01-11 15:11:01 +0200128 r = dssdev->driver->enable_te(dssdev, te);
Tomi Valkeineneed07e02009-08-07 13:43:20 +0300129 if (r)
130 return r;
131
132 return size;
133}
134
135static ssize_t display_timings_show(struct device *dev,
136 struct device_attribute *attr, char *buf)
137{
138 struct omap_dss_device *dssdev = to_dss_device(dev);
139 struct omap_video_timings t;
140
Tomi Valkeinen69b20482010-01-20 12:11:25 +0200141 if (!dssdev->driver->get_timings)
Tomi Valkeineneed07e02009-08-07 13:43:20 +0300142 return -ENOENT;
143
Tomi Valkeinen69b20482010-01-20 12:11:25 +0200144 dssdev->driver->get_timings(dssdev, &t);
Tomi Valkeineneed07e02009-08-07 13:43:20 +0300145
146 return snprintf(buf, PAGE_SIZE, "%u,%u/%u/%u/%u,%u/%u/%u/%u\n",
147 t.pixel_clock,
148 t.x_res, t.hfp, t.hbp, t.hsw,
149 t.y_res, t.vfp, t.vbp, t.vsw);
150}
151
152static ssize_t display_timings_store(struct device *dev,
153 struct device_attribute *attr, const char *buf, size_t size)
154{
155 struct omap_dss_device *dssdev = to_dss_device(dev);
156 struct omap_video_timings t;
157 int r, found;
158
Tomi Valkeinen69b20482010-01-20 12:11:25 +0200159 if (!dssdev->driver->set_timings || !dssdev->driver->check_timings)
Tomi Valkeineneed07e02009-08-07 13:43:20 +0300160 return -ENOENT;
161
162 found = 0;
163#ifdef CONFIG_OMAP2_DSS_VENC
164 if (strncmp("pal", buf, 3) == 0) {
165 t = omap_dss_pal_timings;
166 found = 1;
167 } else if (strncmp("ntsc", buf, 4) == 0) {
168 t = omap_dss_ntsc_timings;
169 found = 1;
170 }
171#endif
172 if (!found && sscanf(buf, "%u,%hu/%hu/%hu/%hu,%hu/%hu/%hu/%hu",
173 &t.pixel_clock,
174 &t.x_res, &t.hfp, &t.hbp, &t.hsw,
175 &t.y_res, &t.vfp, &t.vbp, &t.vsw) != 9)
176 return -EINVAL;
177
Tomi Valkeinen69b20482010-01-20 12:11:25 +0200178 r = dssdev->driver->check_timings(dssdev, &t);
Tomi Valkeineneed07e02009-08-07 13:43:20 +0300179 if (r)
180 return r;
181
Tomi Valkeinen69b20482010-01-20 12:11:25 +0200182 dssdev->driver->set_timings(dssdev, &t);
Tomi Valkeineneed07e02009-08-07 13:43:20 +0300183
184 return size;
185}
186
187static ssize_t display_rotate_show(struct device *dev,
188 struct device_attribute *attr, char *buf)
189{
190 struct omap_dss_device *dssdev = to_dss_device(dev);
191 int rotate;
Tomi Valkeinen87424e12010-01-08 16:52:48 +0200192 if (!dssdev->driver->get_rotate)
Tomi Valkeineneed07e02009-08-07 13:43:20 +0300193 return -ENOENT;
Tomi Valkeinen87424e12010-01-08 16:52:48 +0200194 rotate = dssdev->driver->get_rotate(dssdev);
Tomi Valkeineneed07e02009-08-07 13:43:20 +0300195 return snprintf(buf, PAGE_SIZE, "%u\n", rotate);
196}
197
198static ssize_t display_rotate_store(struct device *dev,
199 struct device_attribute *attr, const char *buf, size_t size)
200{
201 struct omap_dss_device *dssdev = to_dss_device(dev);
202 unsigned long rot;
203 int r;
204
Tomi Valkeinen87424e12010-01-08 16:52:48 +0200205 if (!dssdev->driver->set_rotate || !dssdev->driver->get_rotate)
Tomi Valkeineneed07e02009-08-07 13:43:20 +0300206 return -ENOENT;
207
208 rot = simple_strtoul(buf, NULL, 0);
209
Tomi Valkeinen87424e12010-01-08 16:52:48 +0200210 r = dssdev->driver->set_rotate(dssdev, rot);
Tomi Valkeineneed07e02009-08-07 13:43:20 +0300211 if (r)
212 return r;
213
214 return size;
215}
216
217static ssize_t display_mirror_show(struct device *dev,
218 struct device_attribute *attr, char *buf)
219{
220 struct omap_dss_device *dssdev = to_dss_device(dev);
221 int mirror;
Tomi Valkeinen8d8aa612010-01-08 16:30:33 +0200222 if (!dssdev->driver->get_mirror)
Tomi Valkeineneed07e02009-08-07 13:43:20 +0300223 return -ENOENT;
Tomi Valkeinen8d8aa612010-01-08 16:30:33 +0200224 mirror = dssdev->driver->get_mirror(dssdev);
Tomi Valkeineneed07e02009-08-07 13:43:20 +0300225 return snprintf(buf, PAGE_SIZE, "%u\n", mirror);
226}
227
228static ssize_t display_mirror_store(struct device *dev,
229 struct device_attribute *attr, const char *buf, size_t size)
230{
231 struct omap_dss_device *dssdev = to_dss_device(dev);
232 unsigned long mirror;
233 int r;
234
Tomi Valkeinen8d8aa612010-01-08 16:30:33 +0200235 if (!dssdev->driver->set_mirror || !dssdev->driver->get_mirror)
Tomi Valkeineneed07e02009-08-07 13:43:20 +0300236 return -ENOENT;
237
238 mirror = simple_strtoul(buf, NULL, 0);
239
Tomi Valkeinen8d8aa612010-01-08 16:30:33 +0200240 r = dssdev->driver->set_mirror(dssdev, mirror);
Tomi Valkeineneed07e02009-08-07 13:43:20 +0300241 if (r)
242 return r;
243
244 return size;
245}
246
247static ssize_t display_wss_show(struct device *dev,
248 struct device_attribute *attr, char *buf)
249{
250 struct omap_dss_device *dssdev = to_dss_device(dev);
251 unsigned int wss;
252
Tomi Valkeinen36511312010-01-19 15:53:16 +0200253 if (!dssdev->driver->get_wss)
Tomi Valkeineneed07e02009-08-07 13:43:20 +0300254 return -ENOENT;
255
Tomi Valkeinen36511312010-01-19 15:53:16 +0200256 wss = dssdev->driver->get_wss(dssdev);
Tomi Valkeineneed07e02009-08-07 13:43:20 +0300257
258 return snprintf(buf, PAGE_SIZE, "0x%05x\n", wss);
259}
260
261static ssize_t display_wss_store(struct device *dev,
262 struct device_attribute *attr, const char *buf, size_t size)
263{
264 struct omap_dss_device *dssdev = to_dss_device(dev);
265 unsigned long wss;
266 int r;
267
Tomi Valkeinen36511312010-01-19 15:53:16 +0200268 if (!dssdev->driver->get_wss || !dssdev->driver->set_wss)
Tomi Valkeineneed07e02009-08-07 13:43:20 +0300269 return -ENOENT;
270
271 if (strict_strtoul(buf, 0, &wss))
272 return -EINVAL;
273
274 if (wss > 0xfffff)
275 return -EINVAL;
276
Tomi Valkeinen36511312010-01-19 15:53:16 +0200277 r = dssdev->driver->set_wss(dssdev, wss);
Tomi Valkeineneed07e02009-08-07 13:43:20 +0300278 if (r)
279 return r;
280
281 return size;
282}
283
284static DEVICE_ATTR(enabled, S_IRUGO|S_IWUSR,
285 display_enabled_show, display_enabled_store);
286static DEVICE_ATTR(update_mode, S_IRUGO|S_IWUSR,
287 display_upd_mode_show, display_upd_mode_store);
288static DEVICE_ATTR(tear_elim, S_IRUGO|S_IWUSR,
289 display_tear_show, display_tear_store);
290static DEVICE_ATTR(timings, S_IRUGO|S_IWUSR,
291 display_timings_show, display_timings_store);
292static DEVICE_ATTR(rotate, S_IRUGO|S_IWUSR,
293 display_rotate_show, display_rotate_store);
294static DEVICE_ATTR(mirror, S_IRUGO|S_IWUSR,
295 display_mirror_show, display_mirror_store);
296static DEVICE_ATTR(wss, S_IRUGO|S_IWUSR,
297 display_wss_show, display_wss_store);
298
299static struct device_attribute *display_sysfs_attrs[] = {
300 &dev_attr_enabled,
301 &dev_attr_update_mode,
302 &dev_attr_tear_elim,
303 &dev_attr_timings,
304 &dev_attr_rotate,
305 &dev_attr_mirror,
306 &dev_attr_wss,
307 NULL
308};
309
Tomi Valkeinen96adcec2010-01-11 13:54:33 +0200310void omapdss_default_get_resolution(struct omap_dss_device *dssdev,
Tomi Valkeineneed07e02009-08-07 13:43:20 +0300311 u16 *xres, u16 *yres)
312{
313 *xres = dssdev->panel.timings.x_res;
314 *yres = dssdev->panel.timings.y_res;
315}
Tomi Valkeinen96adcec2010-01-11 13:54:33 +0200316EXPORT_SYMBOL(omapdss_default_get_resolution);
Tomi Valkeineneed07e02009-08-07 13:43:20 +0300317
318void default_get_overlay_fifo_thresholds(enum omap_plane plane,
319 u32 fifo_size, enum omap_burst_size *burst_size,
320 u32 *fifo_low, u32 *fifo_high)
321{
322 unsigned burst_size_bytes;
323
324 *burst_size = OMAP_DSS_BURST_16x32;
325 burst_size_bytes = 16 * 32 / 8;
326
327 *fifo_high = fifo_size - 1;
328 *fifo_low = fifo_size - burst_size_bytes;
329}
330
Tomi Valkeinena2699502010-01-11 14:33:40 +0200331int omapdss_default_get_recommended_bpp(struct omap_dss_device *dssdev)
Tomi Valkeineneed07e02009-08-07 13:43:20 +0300332{
Tomi Valkeineneed07e02009-08-07 13:43:20 +0300333 switch (dssdev->type) {
334 case OMAP_DISPLAY_TYPE_DPI:
335 if (dssdev->phy.dpi.data_lines == 24)
336 return 24;
337 else
338 return 16;
339
340 case OMAP_DISPLAY_TYPE_DBI:
341 case OMAP_DISPLAY_TYPE_DSI:
342 if (dssdev->ctrl.pixel_size == 24)
343 return 24;
344 else
345 return 16;
346 case OMAP_DISPLAY_TYPE_VENC:
347 case OMAP_DISPLAY_TYPE_SDI:
348 return 24;
Tomi Valkeineneed07e02009-08-07 13:43:20 +0300349 default:
350 BUG();
351 }
352}
Tomi Valkeinena2699502010-01-11 14:33:40 +0200353EXPORT_SYMBOL(omapdss_default_get_recommended_bpp);
Tomi Valkeineneed07e02009-08-07 13:43:20 +0300354
355/* Checks if replication logic should be used. Only use for active matrix,
356 * when overlay is in RGB12U or RGB16 mode, and LCD interface is
357 * 18bpp or 24bpp */
358bool dss_use_replication(struct omap_dss_device *dssdev,
359 enum omap_color_mode mode)
360{
361 int bpp;
362
363 if (mode != OMAP_DSS_COLOR_RGB12U && mode != OMAP_DSS_COLOR_RGB16)
364 return false;
365
366 if (dssdev->type == OMAP_DISPLAY_TYPE_DPI &&
367 (dssdev->panel.config & OMAP_DSS_LCD_TFT) == 0)
368 return false;
369
370 switch (dssdev->type) {
371 case OMAP_DISPLAY_TYPE_DPI:
372 bpp = dssdev->phy.dpi.data_lines;
373 break;
374 case OMAP_DISPLAY_TYPE_VENC:
375 case OMAP_DISPLAY_TYPE_SDI:
376 bpp = 24;
377 break;
378 case OMAP_DISPLAY_TYPE_DBI:
379 case OMAP_DISPLAY_TYPE_DSI:
380 bpp = dssdev->ctrl.pixel_size;
381 break;
382 default:
383 BUG();
384 }
385
386 return bpp > 16;
387}
388
389void dss_init_device(struct platform_device *pdev,
390 struct omap_dss_device *dssdev)
391{
392 struct device_attribute *attr;
393 int i;
394 int r;
395
396 switch (dssdev->type) {
Roger Quadrosb4d78bf2010-03-17 13:35:19 +0100397#ifdef CONFIG_OMAP2_DSS_DPI
Tomi Valkeineneed07e02009-08-07 13:43:20 +0300398 case OMAP_DISPLAY_TYPE_DPI:
Tomi Valkeineneed07e02009-08-07 13:43:20 +0300399 r = dpi_init_display(dssdev);
400 break;
Roger Quadrosb4d78bf2010-03-17 13:35:19 +0100401#endif
Tomi Valkeineneed07e02009-08-07 13:43:20 +0300402#ifdef CONFIG_OMAP2_DSS_RFBI
403 case OMAP_DISPLAY_TYPE_DBI:
404 r = rfbi_init_display(dssdev);
405 break;
406#endif
407#ifdef CONFIG_OMAP2_DSS_VENC
408 case OMAP_DISPLAY_TYPE_VENC:
409 r = venc_init_display(dssdev);
410 break;
411#endif
412#ifdef CONFIG_OMAP2_DSS_SDI
413 case OMAP_DISPLAY_TYPE_SDI:
414 r = sdi_init_display(dssdev);
415 break;
416#endif
417#ifdef CONFIG_OMAP2_DSS_DSI
418 case OMAP_DISPLAY_TYPE_DSI:
419 r = dsi_init_display(dssdev);
420 break;
421#endif
422 default:
Tomi Valkeinene528e3a2011-02-24 13:59:13 +0200423 DSSERR("Support for display '%s' not compiled in.\n",
424 dssdev->name);
425 return;
Tomi Valkeineneed07e02009-08-07 13:43:20 +0300426 }
427
428 if (r) {
429 DSSERR("failed to init display %s\n", dssdev->name);
430 return;
431 }
432
433 /* create device sysfs files */
434 i = 0;
435 while ((attr = display_sysfs_attrs[i++]) != NULL) {
436 r = device_create_file(&dssdev->dev, attr);
437 if (r)
438 DSSERR("failed to create sysfs file\n");
439 }
440
441 /* create display? sysfs links */
442 r = sysfs_create_link(&pdev->dev.kobj, &dssdev->dev.kobj,
443 dev_name(&dssdev->dev));
444 if (r)
445 DSSERR("failed to create sysfs display link\n");
446}
447
448void dss_uninit_device(struct platform_device *pdev,
449 struct omap_dss_device *dssdev)
450{
451 struct device_attribute *attr;
452 int i = 0;
453
454 sysfs_remove_link(&pdev->dev.kobj, dev_name(&dssdev->dev));
455
456 while ((attr = display_sysfs_attrs[i++]) != NULL)
457 device_remove_file(&dssdev->dev, attr);
458
459 if (dssdev->manager)
460 dssdev->manager->unset_device(dssdev->manager);
461}
462
463static int dss_suspend_device(struct device *dev, void *data)
464{
465 int r;
466 struct omap_dss_device *dssdev = to_dss_device(dev);
467
468 if (dssdev->state != OMAP_DSS_DISPLAY_ACTIVE) {
469 dssdev->activate_after_resume = false;
470 return 0;
471 }
472
Tomi Valkeinen37ac60e2010-01-12 15:12:07 +0200473 if (!dssdev->driver->suspend) {
Tomi Valkeineneed07e02009-08-07 13:43:20 +0300474 DSSERR("display '%s' doesn't implement suspend\n",
475 dssdev->name);
476 return -ENOSYS;
477 }
478
Tomi Valkeinen37ac60e2010-01-12 15:12:07 +0200479 r = dssdev->driver->suspend(dssdev);
Tomi Valkeineneed07e02009-08-07 13:43:20 +0300480 if (r)
481 return r;
482
483 dssdev->activate_after_resume = true;
484
485 return 0;
486}
487
488int dss_suspend_all_devices(void)
489{
490 int r;
491 struct bus_type *bus = dss_get_bus();
492
493 r = bus_for_each_dev(bus, NULL, NULL, dss_suspend_device);
494 if (r) {
495 /* resume all displays that were suspended */
496 dss_resume_all_devices();
497 return r;
498 }
499
500 return 0;
501}
502
503static int dss_resume_device(struct device *dev, void *data)
504{
505 int r;
506 struct omap_dss_device *dssdev = to_dss_device(dev);
507
Tomi Valkeinen37ac60e2010-01-12 15:12:07 +0200508 if (dssdev->activate_after_resume && dssdev->driver->resume) {
509 r = dssdev->driver->resume(dssdev);
Tomi Valkeineneed07e02009-08-07 13:43:20 +0300510 if (r)
511 return r;
512 }
513
514 dssdev->activate_after_resume = false;
515
516 return 0;
517}
518
519int dss_resume_all_devices(void)
520{
521 struct bus_type *bus = dss_get_bus();
522
523 return bus_for_each_dev(bus, NULL, NULL, dss_resume_device);
524}
525
526static int dss_disable_device(struct device *dev, void *data)
527{
528 struct omap_dss_device *dssdev = to_dss_device(dev);
Jani Nikula279fcd42010-03-24 11:59:38 +0100529
530 if (dssdev->state != OMAP_DSS_DISPLAY_DISABLED)
531 dssdev->driver->disable(dssdev);
532
Tomi Valkeineneed07e02009-08-07 13:43:20 +0300533 return 0;
534}
535
536void dss_disable_all_devices(void)
537{
538 struct bus_type *bus = dss_get_bus();
539 bus_for_each_dev(bus, NULL, NULL, dss_disable_device);
540}
541
542
543void omap_dss_get_device(struct omap_dss_device *dssdev)
544{
545 get_device(&dssdev->dev);
546}
547EXPORT_SYMBOL(omap_dss_get_device);
548
549void omap_dss_put_device(struct omap_dss_device *dssdev)
550{
551 put_device(&dssdev->dev);
552}
553EXPORT_SYMBOL(omap_dss_put_device);
554
555/* ref count of the found device is incremented. ref count
556 * of from-device is decremented. */
557struct omap_dss_device *omap_dss_get_next_device(struct omap_dss_device *from)
558{
559 struct device *dev;
560 struct device *dev_start = NULL;
561 struct omap_dss_device *dssdev = NULL;
562
563 int match(struct device *dev, void *data)
564 {
Tomi Valkeineneed07e02009-08-07 13:43:20 +0300565 return 1;
566 }
567
568 if (from)
569 dev_start = &from->dev;
570 dev = bus_find_device(dss_get_bus(), dev_start, NULL, match);
571 if (dev)
572 dssdev = to_dss_device(dev);
573 if (from)
574 put_device(&from->dev);
575
576 return dssdev;
577}
578EXPORT_SYMBOL(omap_dss_get_next_device);
579
580struct omap_dss_device *omap_dss_find_device(void *data,
581 int (*match)(struct omap_dss_device *dssdev, void *data))
582{
583 struct omap_dss_device *dssdev = NULL;
584
585 while ((dssdev = omap_dss_get_next_device(dssdev)) != NULL) {
586 if (match(dssdev, data))
587 return dssdev;
588 }
589
590 return NULL;
591}
592EXPORT_SYMBOL(omap_dss_find_device);
593
594int omap_dss_start_device(struct omap_dss_device *dssdev)
595{
Tomi Valkeineneed07e02009-08-07 13:43:20 +0300596 if (!dssdev->driver) {
597 DSSDBG("no driver\n");
Tomi Valkeinene020f9a2010-02-17 13:36:48 +0200598 return -ENODEV;
Tomi Valkeineneed07e02009-08-07 13:43:20 +0300599 }
600
601 if (!try_module_get(dssdev->dev.driver->owner)) {
Tomi Valkeinene020f9a2010-02-17 13:36:48 +0200602 return -ENODEV;
Tomi Valkeineneed07e02009-08-07 13:43:20 +0300603 }
604
605 return 0;
Tomi Valkeineneed07e02009-08-07 13:43:20 +0300606}
607EXPORT_SYMBOL(omap_dss_start_device);
608
609void omap_dss_stop_device(struct omap_dss_device *dssdev)
610{
Tomi Valkeineneed07e02009-08-07 13:43:20 +0300611 module_put(dssdev->dev.driver->owner);
612}
613EXPORT_SYMBOL(omap_dss_stop_device);
614