diff options
Diffstat (limited to 'drivers/video/omap2/dss/dsi.c')
-rw-r--r-- | drivers/video/omap2/dss/dsi.c | 93 |
1 files changed, 93 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); |