diff options
-rw-r--r-- | drivers/video/omap2/dss/dsi.c | 93 | ||||
-rw-r--r-- | include/video/omapdss.h | 58 |
2 files changed, 151 insertions, 0 deletions
diff --git a/drivers/video/omap2/dss/dsi.c b/drivers/video/omap2/dss/dsi.c index 58fbff94e018..99a043b08f0d 100644 --- a/drivers/video/omap2/dss/dsi.c +++ b/drivers/video/omap2/dss/dsi.c | |||
@@ -383,6 +383,15 @@ static inline struct dsi_data *dsi_get_dsidrv_data(struct platform_device *dside | |||
383 | 383 | ||
384 | static inline struct platform_device *dsi_get_dsidev_from_dssdev(struct omap_dss_device *dssdev) | 384 | static inline struct platform_device *dsi_get_dsidev_from_dssdev(struct omap_dss_device *dssdev) |
385 | { | 385 | { |
386 | /* HACK: dssdev can be either the panel device, when using old API, or | ||
387 | * the dsi device itself, when using the new API. So we solve this for | ||
388 | * now by checking the dssdev->id. This will be removed when the old API | ||
389 | * is removed. | ||
390 | */ | ||
391 | if (dssdev->id == OMAP_DSS_OUTPUT_DSI1 || | ||
392 | dssdev->id == OMAP_DSS_OUTPUT_DSI2) | ||
393 | return to_platform_device(dssdev->dev); | ||
394 | |||
386 | return to_platform_device(dssdev->output->dev); | 395 | return to_platform_device(dssdev->output->dev); |
387 | } | 396 | } |
388 | 397 | ||
@@ -5412,6 +5421,89 @@ static int dsi_probe_pdata(struct platform_device *dsidev) | |||
5412 | return 0; | 5421 | return 0; |
5413 | } | 5422 | } |
5414 | 5423 | ||
5424 | static int dsi_connect(struct omap_dss_device *dssdev, | ||
5425 | struct omap_dss_device *dst) | ||
5426 | { | ||
5427 | struct platform_device *dsidev = dsi_get_dsidev_from_dssdev(dssdev); | ||
5428 | struct omap_overlay_manager *mgr; | ||
5429 | int r; | ||
5430 | |||
5431 | r = dsi_regulator_init(dsidev); | ||
5432 | if (r) | ||
5433 | return r; | ||
5434 | |||
5435 | mgr = omap_dss_get_overlay_manager(dssdev->dispc_channel); | ||
5436 | if (!mgr) | ||
5437 | return -ENODEV; | ||
5438 | |||
5439 | r = dss_mgr_connect(mgr, dssdev); | ||
5440 | if (r) | ||
5441 | return r; | ||
5442 | |||
5443 | r = omapdss_output_set_device(dssdev, dst); | ||
5444 | if (r) { | ||
5445 | DSSERR("failed to connect output to new device: %s\n", | ||
5446 | dssdev->name); | ||
5447 | dss_mgr_disconnect(mgr, dssdev); | ||
5448 | return r; | ||
5449 | } | ||
5450 | |||
5451 | return 0; | ||
5452 | } | ||
5453 | |||
5454 | static void dsi_disconnect(struct omap_dss_device *dssdev, | ||
5455 | struct omap_dss_device *dst) | ||
5456 | { | ||
5457 | WARN_ON(dst != dssdev->device); | ||
5458 | |||
5459 | if (dst != dssdev->device) | ||
5460 | return; | ||
5461 | |||
5462 | omapdss_output_unset_device(dssdev); | ||
5463 | |||
5464 | if (dssdev->manager) | ||
5465 | dss_mgr_disconnect(dssdev->manager, dssdev); | ||
5466 | } | ||
5467 | |||
5468 | static const struct omapdss_dsi_ops dsi_ops = { | ||
5469 | .connect = dsi_connect, | ||
5470 | .disconnect = dsi_disconnect, | ||
5471 | |||
5472 | .bus_lock = dsi_bus_lock, | ||
5473 | .bus_unlock = dsi_bus_unlock, | ||
5474 | |||
5475 | .enable = omapdss_dsi_display_enable, | ||
5476 | .disable = omapdss_dsi_display_disable, | ||
5477 | |||
5478 | .enable_hs = omapdss_dsi_vc_enable_hs, | ||
5479 | |||
5480 | .configure_pins = omapdss_dsi_configure_pins, | ||
5481 | .set_config = omapdss_dsi_set_config, | ||
5482 | |||
5483 | .enable_video_output = dsi_enable_video_output, | ||
5484 | .disable_video_output = dsi_disable_video_output, | ||
5485 | |||
5486 | .update = omap_dsi_update, | ||
5487 | |||
5488 | .enable_te = omapdss_dsi_enable_te, | ||
5489 | |||
5490 | .request_vc = omap_dsi_request_vc, | ||
5491 | .set_vc_id = omap_dsi_set_vc_id, | ||
5492 | .release_vc = omap_dsi_release_vc, | ||
5493 | |||
5494 | .dcs_write = dsi_vc_dcs_write, | ||
5495 | .dcs_write_nosync = dsi_vc_dcs_write_nosync, | ||
5496 | .dcs_read = dsi_vc_dcs_read, | ||
5497 | |||
5498 | .gen_write = dsi_vc_generic_write, | ||
5499 | .gen_write_nosync = dsi_vc_generic_write_nosync, | ||
5500 | .gen_read = dsi_vc_generic_read, | ||
5501 | |||
5502 | .bta_sync = dsi_vc_send_bta_sync, | ||
5503 | |||
5504 | .set_max_rx_packet_size = dsi_vc_set_max_rx_packet_size, | ||
5505 | }; | ||
5506 | |||
5415 | static void dsi_init_output(struct platform_device *dsidev) | 5507 | static void dsi_init_output(struct platform_device *dsidev) |
5416 | { | 5508 | { |
5417 | struct dsi_data *dsi = dsi_get_dsidrv_data(dsidev); | 5509 | struct dsi_data *dsi = dsi_get_dsidrv_data(dsidev); |
@@ -5424,6 +5516,7 @@ static void dsi_init_output(struct platform_device *dsidev) | |||
5424 | out->output_type = OMAP_DISPLAY_TYPE_DSI; | 5516 | out->output_type = OMAP_DISPLAY_TYPE_DSI; |
5425 | out->name = dsi->module_id == 0 ? "dsi.0" : "dsi.1"; | 5517 | out->name = dsi->module_id == 0 ? "dsi.0" : "dsi.1"; |
5426 | out->dispc_channel = dsi_get_channel(dsi->module_id); | 5518 | out->dispc_channel = dsi_get_channel(dsi->module_id); |
5519 | out->ops.dsi = &dsi_ops; | ||
5427 | out->owner = THIS_MODULE; | 5520 | out->owner = THIS_MODULE; |
5428 | 5521 | ||
5429 | omapdss_register_output(out); | 5522 | omapdss_register_output(out); |
diff --git a/include/video/omapdss.h b/include/video/omapdss.h index 709e8015f324..b39463553845 100644 --- a/include/video/omapdss.h +++ b/include/video/omapdss.h | |||
@@ -691,6 +691,63 @@ struct omapdss_hdmi_ops { | |||
691 | void (*audio_stop)(struct omap_dss_device *dssdev); | 691 | void (*audio_stop)(struct omap_dss_device *dssdev); |
692 | }; | 692 | }; |
693 | 693 | ||
694 | struct omapdss_dsi_ops { | ||
695 | int (*connect)(struct omap_dss_device *dssdev, | ||
696 | struct omap_dss_device *dst); | ||
697 | void (*disconnect)(struct omap_dss_device *dssdev, | ||
698 | struct omap_dss_device *dst); | ||
699 | |||
700 | int (*enable)(struct omap_dss_device *dssdev); | ||
701 | void (*disable)(struct omap_dss_device *dssdev, bool disconnect_lanes, | ||
702 | bool enter_ulps); | ||
703 | |||
704 | /* bus configuration */ | ||
705 | int (*set_config)(struct omap_dss_device *dssdev, | ||
706 | const struct omap_dss_dsi_config *cfg); | ||
707 | int (*configure_pins)(struct omap_dss_device *dssdev, | ||
708 | const struct omap_dsi_pin_config *pin_cfg); | ||
709 | |||
710 | void (*enable_hs)(struct omap_dss_device *dssdev, int channel, | ||
711 | bool enable); | ||
712 | int (*enable_te)(struct omap_dss_device *dssdev, bool enable); | ||
713 | |||
714 | int (*update)(struct omap_dss_device *dssdev, int channel, | ||
715 | void (*callback)(int, void *), void *data); | ||
716 | |||
717 | void (*bus_lock)(struct omap_dss_device *dssdev); | ||
718 | void (*bus_unlock)(struct omap_dss_device *dssdev); | ||
719 | |||
720 | int (*enable_video_output)(struct omap_dss_device *dssdev, int channel); | ||
721 | void (*disable_video_output)(struct omap_dss_device *dssdev, | ||
722 | int channel); | ||
723 | |||
724 | int (*request_vc)(struct omap_dss_device *dssdev, int *channel); | ||
725 | int (*set_vc_id)(struct omap_dss_device *dssdev, int channel, | ||
726 | int vc_id); | ||
727 | void (*release_vc)(struct omap_dss_device *dssdev, int channel); | ||
728 | |||
729 | /* data transfer */ | ||
730 | int (*dcs_write)(struct omap_dss_device *dssdev, int channel, | ||
731 | u8 *data, int len); | ||
732 | int (*dcs_write_nosync)(struct omap_dss_device *dssdev, int channel, | ||
733 | u8 *data, int len); | ||
734 | int (*dcs_read)(struct omap_dss_device *dssdev, int channel, u8 dcs_cmd, | ||
735 | u8 *data, int len); | ||
736 | |||
737 | int (*gen_write)(struct omap_dss_device *dssdev, int channel, | ||
738 | u8 *data, int len); | ||
739 | int (*gen_write_nosync)(struct omap_dss_device *dssdev, int channel, | ||
740 | u8 *data, int len); | ||
741 | int (*gen_read)(struct omap_dss_device *dssdev, int channel, | ||
742 | u8 *reqdata, int reqlen, | ||
743 | u8 *data, int len); | ||
744 | |||
745 | int (*bta_sync)(struct omap_dss_device *dssdev, int channel); | ||
746 | |||
747 | int (*set_max_rx_packet_size)(struct omap_dss_device *dssdev, | ||
748 | int channel, u16 plen); | ||
749 | }; | ||
750 | |||
694 | struct omap_dss_device { | 751 | struct omap_dss_device { |
695 | /* old device, to be removed */ | 752 | /* old device, to be removed */ |
696 | struct device old_dev; | 753 | struct device old_dev; |
@@ -762,6 +819,7 @@ struct omap_dss_device { | |||
762 | const struct omapdss_dvi_ops *dvi; | 819 | const struct omapdss_dvi_ops *dvi; |
763 | const struct omapdss_hdmi_ops *hdmi; | 820 | const struct omapdss_hdmi_ops *hdmi; |
764 | const struct omapdss_atv_ops *atv; | 821 | const struct omapdss_atv_ops *atv; |
822 | const struct omapdss_dsi_ops *dsi; | ||
765 | } ops; | 823 | } ops; |
766 | 824 | ||
767 | /* helper variable for driver suspend/resume */ | 825 | /* helper variable for driver suspend/resume */ |