Lines Matching +full:master +full:- +full:dsi

1 // SPDX-License-Identifier: GPL-2.0-only
9 #include "dsi.h"
18 * DSI_1 as master encoder
24 struct msm_dsi *dsi[DSI_MAX]; member
39 return msm_dsim_glb.dsi[id]; in dsi_mgr_get_dsi()
44 return msm_dsim_glb.dsi[(id + 1) % DSI_MAX]; in dsi_mgr_get_other_dsi()
51 /* We assume 2 dsi nodes have the same information of bonded dsi and in dsi_mgr_parse_of()
52 * sync-mode, and only one node specifies master in case of bonded mode. in dsi_mgr_parse_of()
54 if (!msm_dsim->is_bonded_dsi) in dsi_mgr_parse_of()
55 msm_dsim->is_bonded_dsi = of_property_read_bool(np, "qcom,dual-dsi-mode"); in dsi_mgr_parse_of()
57 if (msm_dsim->is_bonded_dsi) { in dsi_mgr_parse_of()
58 if (of_property_read_bool(np, "qcom,master-dsi")) in dsi_mgr_parse_of()
59 msm_dsim->master_dsi_link_id = id; in dsi_mgr_parse_of()
60 if (!msm_dsim->is_sync_needed) in dsi_mgr_parse_of()
61 msm_dsim->is_sync_needed = of_property_read_bool( in dsi_mgr_parse_of()
62 np, "qcom,sync-dual-dsi"); in dsi_mgr_parse_of()
81 msm_dsi_phy_set_usecase(msm_dsi->phy, MSM_DSI_PHY_STANDALONE); in dsi_mgr_setup_components()
82 msm_dsi_host_set_phy_mode(msm_dsi->host, msm_dsi->phy); in dsi_mgr_setup_components()
84 ret = msm_dsi_host_register(msm_dsi->host); in dsi_mgr_setup_components()
94 * PLL0 is to drive both DSI link clocks in bonded DSI mode. in dsi_mgr_setup_components()
99 msm_dsi_phy_set_usecase(clk_master_dsi->phy, in dsi_mgr_setup_components()
101 msm_dsi_phy_set_usecase(clk_slave_dsi->phy, in dsi_mgr_setup_components()
103 msm_dsi_host_set_phy_mode(msm_dsi->host, msm_dsi->phy); in dsi_mgr_setup_components()
104 msm_dsi_host_set_phy_mode(other_dsi->host, other_dsi->phy); in dsi_mgr_setup_components()
106 /* Register slave host first, so that slave DSI device in dsi_mgr_setup_components()
107 * has a chance to probe, and do not block the master in dsi_mgr_setup_components()
108 * DSI device's probe. in dsi_mgr_setup_components()
110 * because only master DSI device adds the panel to global in dsi_mgr_setup_components()
111 * panel list. The panel's device is the master DSI device. in dsi_mgr_setup_components()
113 ret = msm_dsi_host_register(slave_link_dsi->host); in dsi_mgr_setup_components()
116 ret = msm_dsi_host_register(master_link_dsi->host); in dsi_mgr_setup_components()
130 msm_dsi_host_get_phy_clk_req(msm_dsi->host, &clk_req, is_bonded_dsi); in enable_phy()
132 return msm_dsi_phy_enable(msm_dsi->phy, &clk_req, shared_timings); in enable_phy()
144 /* In case of bonded DSI, some registers in PHY1 have been programmed in dsi_mgr_phy_enable()
150 if (!mdsi->phy_enabled && !sdsi->phy_enabled) { in dsi_mgr_phy_enable()
151 msm_dsi_host_reset_phy(mdsi->host); in dsi_mgr_phy_enable()
152 msm_dsi_host_reset_phy(sdsi->host); in dsi_mgr_phy_enable()
161 msm_dsi_phy_disable(mdsi->phy); in dsi_mgr_phy_enable()
166 msm_dsi_host_reset_phy(msm_dsi->host); in dsi_mgr_phy_enable()
172 msm_dsi->phy_enabled = true; in dsi_mgr_phy_enable()
183 /* disable DSI phy in dsi_mgr_phy_disable()
184 * In bonded dsi configuration, the phy should be disabled for the in dsi_mgr_phy_disable()
187 msm_dsi->phy_enabled = false; in dsi_mgr_phy_disable()
189 if (!mdsi->phy_enabled && !sdsi->phy_enabled) { in dsi_mgr_phy_disable()
190 msm_dsi_phy_disable(sdsi->phy); in dsi_mgr_phy_disable()
191 msm_dsi_phy_disable(mdsi->phy); in dsi_mgr_phy_disable()
194 msm_dsi_phy_disable(msm_dsi->phy); in dsi_mgr_phy_disable()
208 return dsi_bridge->id; in dsi_mgr_bridge_get_id()
216 struct mipi_dsi_host *host = msm_dsi->host; in dsi_mgr_bridge_power_on()
227 ret = msm_dsi_host_power_on(host, &phy_shared_timings[id], is_bonded_dsi, msm_dsi->phy); in dsi_mgr_bridge_power_on()
234 ret = msm_dsi_host_power_on(msm_dsi1->host, in dsi_mgr_bridge_power_on()
235 &phy_shared_timings[DSI_1], is_bonded_dsi, msm_dsi1->phy); in dsi_mgr_bridge_power_on()
245 * that the panel can communicate over the DSI link. in dsi_mgr_bridge_power_on()
249 msm_dsi_host_enable_irq(msm_dsi1->host); in dsi_mgr_bridge_power_on()
266 struct mipi_dsi_host *host = msm_dsi->host; in dsi_mgr_bridge_power_off()
271 msm_dsi_host_disable_irq(msm_dsi1->host); in dsi_mgr_bridge_power_off()
272 msm_dsi_host_power_off(msm_dsi1->host); in dsi_mgr_bridge_power_off()
283 struct mipi_dsi_host *host = msm_dsi->host; in dsi_mgr_bridge_pre_enable()
289 /* Do nothing with the host if it is slave-DSI in case of bonded DSI */ in dsi_mgr_bridge_pre_enable()
295 dev_err(&msm_dsi->pdev->dev, "Power on failed: %d\n", ret); in dsi_mgr_bridge_pre_enable()
306 ret = msm_dsi_host_enable(msm_dsi1->host); in dsi_mgr_bridge_pre_enable()
326 /* if dual dsi, trigger tpg on master first then slave */ in msm_dsi_manager_tpg_enable()
328 msm_dsi_host_test_pattern_en(m_dsi->host); in msm_dsi_manager_tpg_enable()
330 msm_dsi_host_test_pattern_en(s_dsi->host); in msm_dsi_manager_tpg_enable()
339 struct mipi_dsi_host *host = msm_dsi->host; in dsi_mgr_bridge_post_disable()
346 * Do nothing with the host if it is slave-DSI in case of bonded DSI. in dsi_mgr_bridge_post_disable()
358 ret = msm_dsi_host_disable(msm_dsi1->host); in dsi_mgr_bridge_post_disable()
365 msm_dsi_host_disable_irq(msm_dsi1->host); in dsi_mgr_bridge_post_disable()
368 msm_dsi_phy_pll_save_state(msm_dsi->phy); in dsi_mgr_bridge_post_disable()
375 ret = msm_dsi_host_power_off(msm_dsi1->host); in dsi_mgr_bridge_post_disable()
392 struct mipi_dsi_host *host = msm_dsi->host; in dsi_mgr_bridge_mode_set()
402 msm_dsi_host_set_display_mode(other_dsi->host, adjusted_mode); in dsi_mgr_bridge_mode_set()
411 struct mipi_dsi_host *host = msm_dsi->host; in dsi_mgr_bridge_mode_valid()
412 struct platform_device *pdev = msm_dsi->pdev; in dsi_mgr_bridge_mode_valid()
418 opp = dev_pm_opp_find_freq_ceil(&pdev->dev, &byte_clk_rate); in dsi_mgr_bridge_mode_valid()
421 } else if (PTR_ERR(opp) == -ERANGE) { in dsi_mgr_bridge_mode_valid()
425 * -ERANGE in such case. in dsi_mgr_bridge_mode_valid()
427 if (dev_pm_opp_get_opp_count(&pdev->dev) != 0) in dsi_mgr_bridge_mode_valid()
442 return drm_bridge_attach(bridge->encoder, msm_dsi->next_bridge, in dsi_mgr_bridge_attach()
458 struct drm_device *dev = msm_dsi->dev; in msm_dsi_manager_connector_init()
464 dsi_bridge = devm_kzalloc(msm_dsi->dev->dev, in msm_dsi_manager_connector_init()
467 return -ENOMEM; in msm_dsi_manager_connector_init()
469 dsi_bridge->id = msm_dsi->id; in msm_dsi_manager_connector_init()
471 bridge = &dsi_bridge->base; in msm_dsi_manager_connector_init()
472 bridge->funcs = &dsi_mgr_bridge_funcs; in msm_dsi_manager_connector_init()
474 ret = devm_drm_bridge_add(msm_dsi->dev->dev, bridge); in msm_dsi_manager_connector_init()
499 struct mipi_dsi_host *host = msm_dsi->host; in msm_dsi_manager_cmd_xfer()
500 bool is_read = (msg->rx_buf && msg->rx_len); in msm_dsi_manager_cmd_xfer()
504 if (!msg->tx_buf || !msg->tx_len) in msm_dsi_manager_cmd_xfer()
507 /* In bonded master case, panel requires the same commands sent to in msm_dsi_manager_cmd_xfer()
508 * both DSI links. Host issues the command trigger to both links in msm_dsi_manager_cmd_xfer()
513 return is_read ? msg->rx_len : msg->tx_len; in msm_dsi_manager_cmd_xfer()
516 ret = msm_dsi_host_xfer_prepare(msm_dsi0->host, msg); in msm_dsi_manager_cmd_xfer()
518 pr_err("%s: failed to prepare non-trigger host, %d\n", in msm_dsi_manager_cmd_xfer()
536 msm_dsi_host_xfer_restore(msm_dsi0->host, msg); in msm_dsi_manager_cmd_xfer()
545 struct mipi_dsi_host *host = msm_dsi->host; in msm_dsi_manager_cmd_xfer_trigger()
551 msm_dsi_host_cmd_xfer_commit(msm_dsi0->host, dma_base, len); in msm_dsi_manager_cmd_xfer_trigger()
561 int id = msm_dsi->id; in msm_dsi_manager_register()
566 return -EINVAL; in msm_dsi_manager_register()
569 if (msm_dsim->dsi[id]) { in msm_dsi_manager_register()
570 pr_err("%s: dsi%d already registered\n", __func__, id); in msm_dsi_manager_register()
571 return -EBUSY; in msm_dsi_manager_register()
574 msm_dsim->dsi[id] = msm_dsi; in msm_dsi_manager_register()
576 ret = dsi_mgr_parse_of(msm_dsi->pdev->dev.of_node, id); in msm_dsi_manager_register()
578 pr_err("%s: failed to parse OF DSI info\n", __func__); in msm_dsi_manager_register()
584 pr_err("%s: failed to register mipi dsi host for DSI %d: %d\n", in msm_dsi_manager_register()
592 msm_dsim->dsi[id] = NULL; in msm_dsi_manager_register()
600 if (msm_dsi->host) in msm_dsi_manager_unregister()
601 msm_dsi_host_unregister(msm_dsi->host); in msm_dsi_manager_unregister()
603 if (msm_dsi->id >= 0) in msm_dsi_manager_unregister()
604 msm_dsim->dsi[msm_dsi->id] = NULL; in msm_dsi_manager_unregister()
614 return IS_MASTER_DSI_LINK(msm_dsi->id); in msm_dsi_is_master_dsi()
619 return msm_dsi->te_source; in msm_dsi_get_te_source()