aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--drivers/video/omap2/dss/sdi.c78
-rw-r--r--include/video/omapdss.h20
2 files changed, 98 insertions, 0 deletions
diff --git a/drivers/video/omap2/dss/sdi.c b/drivers/video/omap2/dss/sdi.c
index 69d907f7df4a..856af2e89760 100644
--- a/drivers/video/omap2/dss/sdi.c
+++ b/drivers/video/omap2/dss/sdi.c
@@ -234,6 +234,26 @@ void omapdss_sdi_set_timings(struct omap_dss_device *dssdev,
234} 234}
235EXPORT_SYMBOL(omapdss_sdi_set_timings); 235EXPORT_SYMBOL(omapdss_sdi_set_timings);
236 236
237static void sdi_get_timings(struct omap_dss_device *dssdev,
238 struct omap_video_timings *timings)
239{
240 *timings = sdi.timings;
241}
242
243static int sdi_check_timings(struct omap_dss_device *dssdev,
244 struct omap_video_timings *timings)
245{
246 struct omap_overlay_manager *mgr = sdi.output.manager;
247
248 if (mgr && !dispc_mgr_timings_ok(mgr->id, timings))
249 return -EINVAL;
250
251 if (timings->pixel_clock == 0)
252 return -EINVAL;
253
254 return 0;
255}
256
237void omapdss_sdi_set_datapairs(struct omap_dss_device *dssdev, int datapairs) 257void omapdss_sdi_set_datapairs(struct omap_dss_device *dssdev, int datapairs)
238{ 258{
239 sdi.datapairs = datapairs; 259 sdi.datapairs = datapairs;
@@ -333,6 +353,63 @@ static int sdi_probe_pdata(struct platform_device *sdidev)
333 return 0; 353 return 0;
334} 354}
335 355
356static int sdi_connect(struct omap_dss_device *dssdev,
357 struct omap_dss_device *dst)
358{
359 struct omap_overlay_manager *mgr;
360 int r;
361
362 r = sdi_init_regulator();
363 if (r)
364 return r;
365
366 mgr = omap_dss_get_overlay_manager(dssdev->dispc_channel);
367 if (!mgr)
368 return -ENODEV;
369
370 r = dss_mgr_connect(mgr, dssdev);
371 if (r)
372 return r;
373
374 r = omapdss_output_set_device(dssdev, dst);
375 if (r) {
376 DSSERR("failed to connect output to new device: %s\n",
377 dst->name);
378 dss_mgr_disconnect(mgr, dssdev);
379 return r;
380 }
381
382 return 0;
383}
384
385static void sdi_disconnect(struct omap_dss_device *dssdev,
386 struct omap_dss_device *dst)
387{
388 WARN_ON(dst != dssdev->device);
389
390 if (dst != dssdev->device)
391 return;
392
393 omapdss_output_unset_device(dssdev);
394
395 if (dssdev->manager)
396 dss_mgr_disconnect(dssdev->manager, dssdev);
397}
398
399static const struct omapdss_sdi_ops sdi_ops = {
400 .connect = sdi_connect,
401 .disconnect = sdi_disconnect,
402
403 .enable = omapdss_sdi_display_enable,
404 .disable = omapdss_sdi_display_disable,
405
406 .check_timings = sdi_check_timings,
407 .set_timings = omapdss_sdi_set_timings,
408 .get_timings = sdi_get_timings,
409
410 .set_datapairs = omapdss_sdi_set_datapairs,
411};
412
336static void sdi_init_output(struct platform_device *pdev) 413static void sdi_init_output(struct platform_device *pdev)
337{ 414{
338 struct omap_dss_device *out = &sdi.output; 415 struct omap_dss_device *out = &sdi.output;
@@ -342,6 +419,7 @@ static void sdi_init_output(struct platform_device *pdev)
342 out->output_type = OMAP_DISPLAY_TYPE_SDI; 419 out->output_type = OMAP_DISPLAY_TYPE_SDI;
343 out->name = "sdi.0"; 420 out->name = "sdi.0";
344 out->dispc_channel = OMAP_DSS_CHANNEL_LCD; 421 out->dispc_channel = OMAP_DSS_CHANNEL_LCD;
422 out->ops.sdi = &sdi_ops;
345 out->owner = THIS_MODULE; 423 out->owner = THIS_MODULE;
346 424
347 omapdss_register_output(out); 425 omapdss_register_output(out);
diff --git a/include/video/omapdss.h b/include/video/omapdss.h
index 71fe1566ce01..c5935a824ec5 100644
--- a/include/video/omapdss.h
+++ b/include/video/omapdss.h
@@ -592,6 +592,25 @@ struct omapdss_dpi_ops {
592 void (*set_data_lines)(struct omap_dss_device *dssdev, int data_lines); 592 void (*set_data_lines)(struct omap_dss_device *dssdev, int data_lines);
593}; 593};
594 594
595struct omapdss_sdi_ops {
596 int (*connect)(struct omap_dss_device *dssdev,
597 struct omap_dss_device *dst);
598 void (*disconnect)(struct omap_dss_device *dssdev,
599 struct omap_dss_device *dst);
600
601 int (*enable)(struct omap_dss_device *dssdev);
602 void (*disable)(struct omap_dss_device *dssdev);
603
604 int (*check_timings)(struct omap_dss_device *dssdev,
605 struct omap_video_timings *timings);
606 void (*set_timings)(struct omap_dss_device *dssdev,
607 struct omap_video_timings *timings);
608 void (*get_timings)(struct omap_dss_device *dssdev,
609 struct omap_video_timings *timings);
610
611 void (*set_datapairs)(struct omap_dss_device *dssdev, int datapairs);
612};
613
595struct omap_dss_device { 614struct omap_dss_device {
596 /* old device, to be removed */ 615 /* old device, to be removed */
597 struct device old_dev; 616 struct device old_dev;
@@ -659,6 +678,7 @@ struct omap_dss_device {
659 678
660 union { 679 union {
661 const struct omapdss_dpi_ops *dpi; 680 const struct omapdss_dpi_ops *dpi;
681 const struct omapdss_sdi_ops *sdi;
662 } ops; 682 } ops;
663 683
664 /* helper variable for driver suspend/resume */ 684 /* helper variable for driver suspend/resume */