Lines Matching +full:host +full:- +full:only
1 // SPDX-License-Identifier: GPL-2.0-only
49 /* We assume 2 dsi nodes have the same information of dual-dsi and in dsi_mgr_parse_dual_dsi()
50 * sync-mode, and only one node specifies master in case of dual mode. in dsi_mgr_parse_dual_dsi()
52 if (!msm_dsim->is_dual_dsi) in dsi_mgr_parse_dual_dsi()
53 msm_dsim->is_dual_dsi = of_property_read_bool( in dsi_mgr_parse_dual_dsi()
54 np, "qcom,dual-dsi-mode"); in dsi_mgr_parse_dual_dsi()
56 if (msm_dsim->is_dual_dsi) { in dsi_mgr_parse_dual_dsi()
57 if (of_property_read_bool(np, "qcom,master-dsi")) in dsi_mgr_parse_dual_dsi()
58 msm_dsim->master_dsi_link_id = id; in dsi_mgr_parse_dual_dsi()
59 if (!msm_dsim->is_sync_needed) in dsi_mgr_parse_dual_dsi()
60 msm_dsim->is_sync_needed = of_property_read_bool( in dsi_mgr_parse_dual_dsi()
61 np, "qcom,sync-dual-dsi"); in dsi_mgr_parse_dual_dsi()
77 ret = msm_dsi_host_register(msm_dsi->host, true); in dsi_mgr_setup_components()
81 msm_dsi_phy_set_usecase(msm_dsi->phy, MSM_DSI_PHY_STANDALONE); in dsi_mgr_setup_components()
82 src_pll = msm_dsi_phy_get_pll(msm_dsi->phy); in dsi_mgr_setup_components()
85 ret = msm_dsi_host_set_src_pll(msm_dsi->host, src_pll); in dsi_mgr_setup_components()
93 /* Register slave host first, so that slave DSI device in dsi_mgr_setup_components()
96 * Also, do not check defer for the slave host, in dsi_mgr_setup_components()
97 * because only master DSI device adds the panel to global in dsi_mgr_setup_components()
100 ret = msm_dsi_host_register(slave_link_dsi->host, false); in dsi_mgr_setup_components()
103 ret = msm_dsi_host_register(master_link_dsi->host, true); in dsi_mgr_setup_components()
108 msm_dsi_phy_set_usecase(clk_master_dsi->phy, in dsi_mgr_setup_components()
110 msm_dsi_phy_set_usecase(clk_slave_dsi->phy, in dsi_mgr_setup_components()
112 src_pll = msm_dsi_phy_get_pll(clk_master_dsi->phy); in dsi_mgr_setup_components()
115 ret = msm_dsi_host_set_src_pll(msm_dsi->host, src_pll); in dsi_mgr_setup_components()
118 ret = msm_dsi_host_set_src_pll(other_dsi->host, src_pll); in dsi_mgr_setup_components()
131 msm_dsi_host_get_phy_clk_req(msm_dsi->host, &clk_req, is_dual_dsi); in enable_phy()
133 ret = msm_dsi_phy_enable(msm_dsi->phy, src_pll_id, &clk_req); in enable_phy()
134 msm_dsi_phy_get_shared_timings(msm_dsi->phy, shared_timings); in enable_phy()
155 if (!mdsi->phy_enabled && !sdsi->phy_enabled) { in dsi_mgr_phy_enable()
156 msm_dsi_host_reset_phy(mdsi->host); in dsi_mgr_phy_enable()
157 msm_dsi_host_reset_phy(sdsi->host); in dsi_mgr_phy_enable()
166 msm_dsi_phy_disable(mdsi->phy); in dsi_mgr_phy_enable()
171 msm_dsi_host_reset_phy(msm_dsi->host); in dsi_mgr_phy_enable()
177 msm_dsi->phy_enabled = true; in dsi_mgr_phy_enable()
189 * In dual-dsi configuration, the phy should be disabled for the in dsi_mgr_phy_disable()
190 * first controller only when the second controller is disabled. in dsi_mgr_phy_disable()
192 msm_dsi->phy_enabled = false; in dsi_mgr_phy_disable()
194 if (!mdsi->phy_enabled && !sdsi->phy_enabled) { in dsi_mgr_phy_disable()
195 msm_dsi_phy_disable(sdsi->phy); in dsi_mgr_phy_disable()
196 msm_dsi_phy_disable(mdsi->phy); in dsi_mgr_phy_disable()
199 msm_dsi_phy_disable(msm_dsi->phy); in dsi_mgr_phy_disable()
219 return dsi_connector->id; in dsi_mgr_connector_get_id()
225 return dsi_bridge->id; in dsi_mgr_bridge_get_id()
230 unsigned long host_flags = msm_dsi_host_get_mode_flags(msm_dsi->host); in dsi_mgr_is_cmd_mode()
237 struct msm_drm_private *priv = msm_dsi->dev->dev_private; in msm_dsi_manager_setup_encoder()
238 struct msm_kms *kms = priv->kms; in msm_dsi_manager_setup_encoder()
241 if (encoder && kms->funcs->set_encoder_mode) in msm_dsi_manager_setup_encoder()
242 kms->funcs->set_encoder_mode(kms, encoder, in msm_dsi_manager_setup_encoder()
248 struct msm_drm_private *priv = conn->dev->dev_private; in msm_dsi_manager_panel_init()
249 struct msm_kms *kms = priv->kms; in msm_dsi_manager_panel_init()
264 * There is only 1 panel in the global panel list for dual DSI mode. in msm_dsi_manager_panel_init()
268 panel = msm_dsi_host_get_panel(master_dsi->host); in msm_dsi_manager_panel_init()
270 DRM_ERROR("Could not find panel for %u (%ld)\n", msm_dsi->id, in msm_dsi_manager_panel_init()
278 drm_object_attach_property(&conn->base, in msm_dsi_manager_panel_init()
279 conn->dev->mode_config.tile_property, 0); in msm_dsi_manager_panel_init()
285 if (other_dsi && other_dsi->panel && kms->funcs->set_split_display) { in msm_dsi_manager_panel_init()
286 kms->funcs->set_split_display(kms, master_dsi->encoder, in msm_dsi_manager_panel_init()
287 slave_dsi->encoder, in msm_dsi_manager_panel_init()
292 msm_dsi->panel = panel; in msm_dsi_manager_panel_init()
302 return msm_dsi->panel ? connector_status_connected : in dsi_mgr_connector_detect()
321 struct drm_panel *panel = msm_dsi->panel; in dsi_mgr_connector_get_modes()
344 struct msm_drm_private *priv = connector->dev->dev_private; in dsi_mgr_connector_mode_valid()
345 struct msm_kms *kms = priv->kms; in dsi_mgr_connector_mode_valid()
349 requested = 1000 * mode->clock; in dsi_mgr_connector_mode_valid()
350 actual = kms->funcs->round_pixclk(kms, requested, encoder); in dsi_mgr_connector_mode_valid()
374 struct mipi_dsi_host *host = msm_dsi->host; in dsi_mgr_bridge_pre_enable() local
375 struct drm_panel *panel = msm_dsi->panel; in dsi_mgr_bridge_pre_enable()
388 /* Do nothing with the host if it is slave-DSI in case of dual DSI */ in dsi_mgr_bridge_pre_enable()
392 ret = msm_dsi_host_power_on(host, &phy_shared_timings[id], is_dual_dsi); in dsi_mgr_bridge_pre_enable()
394 pr_err("%s: power on host %d failed, %d\n", __func__, id, ret); in dsi_mgr_bridge_pre_enable()
399 ret = msm_dsi_host_power_on(msm_dsi1->host, in dsi_mgr_bridge_pre_enable()
409 * there is only one drm_panel instance. in dsi_mgr_bridge_pre_enable()
420 ret = msm_dsi_host_enable(host); in dsi_mgr_bridge_pre_enable()
422 pr_err("%s: enable host %d failed, %d\n", __func__, id, ret); in dsi_mgr_bridge_pre_enable()
427 ret = msm_dsi_host_enable(msm_dsi1->host); in dsi_mgr_bridge_pre_enable()
437 msm_dsi_host_disable(host); in dsi_mgr_bridge_pre_enable()
443 msm_dsi_host_power_off(msm_dsi1->host); in dsi_mgr_bridge_pre_enable()
445 msm_dsi_host_power_off(host); in dsi_mgr_bridge_pre_enable()
456 struct drm_panel *panel = msm_dsi->panel; in dsi_mgr_bridge_enable()
464 /* Do nothing with the host if it is slave-DSI in case of dual DSI */ in dsi_mgr_bridge_enable()
481 struct drm_panel *panel = msm_dsi->panel; in dsi_mgr_bridge_disable()
489 /* Do nothing with the host if it is slave-DSI in case of dual DSI */ in dsi_mgr_bridge_disable()
506 struct mipi_dsi_host *host = msm_dsi->host; in dsi_mgr_bridge_post_disable() local
507 struct drm_panel *panel = msm_dsi->panel; in dsi_mgr_bridge_post_disable()
518 * Do nothing with the host if it is slave-DSI in case of dual DSI. in dsi_mgr_bridge_post_disable()
525 ret = msm_dsi_host_disable(host); in dsi_mgr_bridge_post_disable()
527 pr_err("%s: host %d disable failed, %d\n", __func__, id, ret); in dsi_mgr_bridge_post_disable()
530 ret = msm_dsi_host_disable(msm_dsi1->host); in dsi_mgr_bridge_post_disable()
543 src_pll = msm_dsi_phy_get_pll(msm_dsi->phy); in dsi_mgr_bridge_post_disable()
546 ret = msm_dsi_host_power_off(host); in dsi_mgr_bridge_post_disable()
548 pr_err("%s: host %d power off failed,%d\n", __func__, id, ret); in dsi_mgr_bridge_post_disable()
551 ret = msm_dsi_host_power_off(msm_dsi1->host); in dsi_mgr_bridge_post_disable()
568 struct mipi_dsi_host *host = msm_dsi->host; in dsi_mgr_bridge_mode_set() local
576 msm_dsi_host_set_display_mode(host, adjusted_mode); in dsi_mgr_bridge_mode_set()
578 msm_dsi_host_set_display_mode(other_dsi->host, adjusted_mode); in dsi_mgr_bridge_mode_set()
614 return ERR_PTR(-ENOMEM); in msm_dsi_manager_connector_init()
616 dsi_connector->id = id; in msm_dsi_manager_connector_init()
618 connector = &dsi_connector->base; in msm_dsi_manager_connector_init()
620 ret = drm_connector_init(msm_dsi->dev, connector, in msm_dsi_manager_connector_init()
628 * when panel is attached to the host. in msm_dsi_manager_connector_init()
630 connector->polled = DRM_CONNECTOR_POLL_HPD; in msm_dsi_manager_connector_init()
633 connector->interlace_allowed = 0; in msm_dsi_manager_connector_init()
634 connector->doublescan_allowed = 0; in msm_dsi_manager_connector_init()
636 drm_connector_attach_encoder(connector, msm_dsi->encoder); in msm_dsi_manager_connector_init()
640 DRM_DEV_ERROR(msm_dsi->dev->dev, "init panel failed %d\n", ret); in msm_dsi_manager_connector_init()
647 connector->funcs->destroy(msm_dsi->connector); in msm_dsi_manager_connector_init()
656 * For dual DSI, we only have one drm panel. For this in msm_dsi_manager_validate_current_config()
657 * use case, we register only one bridge/connector. in msm_dsi_manager_validate_current_config()
659 * slave-DSI for dual DSI configuration. in msm_dsi_manager_validate_current_config()
662 DBG("Skip bridge registration for slave DSI->id: %d\n", id); in msm_dsi_manager_validate_current_config()
677 dsi_bridge = devm_kzalloc(msm_dsi->dev->dev, in msm_dsi_manager_bridge_init()
680 ret = -ENOMEM; in msm_dsi_manager_bridge_init()
684 dsi_bridge->id = id; in msm_dsi_manager_bridge_init()
686 encoder = msm_dsi->encoder; in msm_dsi_manager_bridge_init()
688 bridge = &dsi_bridge->base; in msm_dsi_manager_bridge_init()
689 bridge->funcs = &dsi_mgr_bridge_funcs; in msm_dsi_manager_bridge_init()
707 struct drm_device *dev = msm_dsi->dev; in msm_dsi_manager_ext_bridge_init()
713 int_bridge = msm_dsi->bridge; in msm_dsi_manager_ext_bridge_init()
714 ext_bridge = msm_dsi->external_bridge = in msm_dsi_manager_ext_bridge_init()
715 msm_dsi_host_get_bridge(msm_dsi->host); in msm_dsi_manager_ext_bridge_init()
717 encoder = msm_dsi->encoder; in msm_dsi_manager_ext_bridge_init()
725 * priv->connector[] list, mainly for msm_fbdev_init() in msm_dsi_manager_ext_bridge_init()
727 connector_list = &dev->mode_config.connector_list; in msm_dsi_manager_ext_bridge_init()
734 return ERR_PTR(-ENODEV); in msm_dsi_manager_ext_bridge_init()
745 struct mipi_dsi_host *host = msm_dsi->host; in msm_dsi_manager_cmd_xfer() local
746 bool is_read = (msg->rx_buf && msg->rx_len); in msm_dsi_manager_cmd_xfer()
750 if (!msg->tx_buf || !msg->tx_len) in msm_dsi_manager_cmd_xfer()
754 * both DSI links. Host issues the command trigger to both links in msm_dsi_manager_cmd_xfer()
759 return is_read ? msg->rx_len : msg->tx_len; in msm_dsi_manager_cmd_xfer()
762 ret = msm_dsi_host_xfer_prepare(msm_dsi0->host, msg); in msm_dsi_manager_cmd_xfer()
764 pr_err("%s: failed to prepare non-trigger host, %d\n", in msm_dsi_manager_cmd_xfer()
769 ret = msm_dsi_host_xfer_prepare(host, msg); in msm_dsi_manager_cmd_xfer()
771 pr_err("%s: failed to prepare host, %d\n", __func__, ret); in msm_dsi_manager_cmd_xfer()
775 ret = is_read ? msm_dsi_host_cmd_rx(host, msg) : in msm_dsi_manager_cmd_xfer()
776 msm_dsi_host_cmd_tx(host, msg); in msm_dsi_manager_cmd_xfer()
778 msm_dsi_host_xfer_restore(host, msg); in msm_dsi_manager_cmd_xfer()
782 msm_dsi_host_xfer_restore(msm_dsi0->host, msg); in msm_dsi_manager_cmd_xfer()
791 struct mipi_dsi_host *host = msm_dsi->host; in msm_dsi_manager_cmd_xfer_trigger() local
797 msm_dsi_host_cmd_xfer_commit(msm_dsi0->host, dma_base, len); in msm_dsi_manager_cmd_xfer_trigger()
799 msm_dsi_host_cmd_xfer_commit(host, dma_base, len); in msm_dsi_manager_cmd_xfer_trigger()
807 int id = msm_dsi->id; in msm_dsi_manager_register()
812 return -EINVAL; in msm_dsi_manager_register()
815 if (msm_dsim->dsi[id]) { in msm_dsi_manager_register()
817 return -EBUSY; in msm_dsi_manager_register()
820 msm_dsim->dsi[id] = msm_dsi; in msm_dsi_manager_register()
822 ret = dsi_mgr_parse_dual_dsi(msm_dsi->pdev->dev.of_node, id); in msm_dsi_manager_register()
830 pr_err("%s: failed to register mipi dsi host for DSI %d\n", in msm_dsi_manager_register()
838 msm_dsim->dsi[id] = NULL; in msm_dsi_manager_register()
846 if (msm_dsi->host) in msm_dsi_manager_unregister()
847 msm_dsi_host_unregister(msm_dsi->host); in msm_dsi_manager_unregister()
849 if (msm_dsi->id >= 0) in msm_dsi_manager_unregister()
850 msm_dsim->dsi[msm_dsi->id] = NULL; in msm_dsi_manager_unregister()