linux-arm-msm.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH v3 0/7] drm/msm/dpu: add support for independent DSI config
@ 2021-07-10 22:19 Dmitry Baryshkov
  2021-07-10 22:19 ` [PATCH v3 1/7] drm/msm/dsi: rename dual DSI to bonded DSI Dmitry Baryshkov
                   ` (6 more replies)
  0 siblings, 7 replies; 13+ messages in thread
From: Dmitry Baryshkov @ 2021-07-10 22:19 UTC (permalink / raw)
  To: Bjorn Andersson, Rob Clark, Sean Paul, Abhinav Kumar
  Cc: Jonathan Marek, Stephen Boyd, David Airlie, Daniel Vetter,
	linux-arm-msm, dri-devel, freedreno

This patchseries adds support for independent DSI config to DPU1 display
subdriver. Also drop one of msm_kms_funcs callbacks, made unnecessary
now.

Tested on RB5 (dpu, dsi). Previous iteration was tested by Alexey
Minnekhanov.

Changes since v2:
 - Removed Reviewed-By tags from changed patches (1, 2)
 - Changed more dual DSI mentions in the patch 1
 - Added msm_dsi_is_master_dsi() helper
 - Rewrote dsi encoder setup function again basing on review by Abhinav

Cahanges since v1:
 - Rewrote dsi encoder setup function by separating common code sequence
   and calling it either for the bonded interface or twice for each of
   the DSI hosts.

Changes since RFC:
 - renamed dual DSI to bonded DSI as suggsted by Abhinav
 - added comments to _dpu_kms_initialize_dsi() regarding encoders usage



^ permalink raw reply	[flat|nested] 13+ messages in thread

* [PATCH v3 1/7] drm/msm/dsi: rename dual DSI to bonded DSI
  2021-07-10 22:19 [PATCH v3 0/7] drm/msm/dpu: add support for independent DSI config Dmitry Baryshkov
@ 2021-07-10 22:19 ` Dmitry Baryshkov
  2021-07-12 21:02   ` [Freedreno] " abhinavk
  2021-07-10 22:20 ` [PATCH v3 2/7] drm/msm/dsi: add three helper functions Dmitry Baryshkov
                   ` (5 subsequent siblings)
  6 siblings, 1 reply; 13+ messages in thread
From: Dmitry Baryshkov @ 2021-07-10 22:19 UTC (permalink / raw)
  To: Bjorn Andersson, Rob Clark, Sean Paul, Abhinav Kumar
  Cc: Jonathan Marek, Stephen Boyd, David Airlie, Daniel Vetter,
	linux-arm-msm, dri-devel, freedreno

We are preparing to support two independent DSI hosts in the DSI/DPU
code. To remove possible confusion (as both configurations can be
referenced as dual DSI) let's rename old "dual DSI" (two DSI hosts
driving single device, with clocks being locked) to "bonded DSI".

Signed-off-by: Dmitry Baryshkov <dmitry.baryshkov@linaro.org>
---
 drivers/gpu/drm/msm/disp/mdp5/mdp5_ctl.c   |   2 +-
 drivers/gpu/drm/msm/dsi/dsi.h              |   8 +-
 drivers/gpu/drm/msm/dsi/dsi_cfg.h          |   2 +-
 drivers/gpu/drm/msm/dsi/dsi_host.c         |  34 +++----
 drivers/gpu/drm/msm/dsi/dsi_manager.c      | 101 ++++++++++-----------
 drivers/gpu/drm/msm/dsi/phy/dsi_phy_10nm.c |   2 +-
 drivers/gpu/drm/msm/dsi/phy/dsi_phy_14nm.c |   6 +-
 drivers/gpu/drm/msm/dsi/phy/dsi_phy_7nm.c  |   2 +-
 8 files changed, 78 insertions(+), 79 deletions(-)

diff --git a/drivers/gpu/drm/msm/disp/mdp5/mdp5_ctl.c b/drivers/gpu/drm/msm/disp/mdp5/mdp5_ctl.c
index 81b0c7cf954e..1220f2b20e05 100644
--- a/drivers/gpu/drm/msm/disp/mdp5/mdp5_ctl.c
+++ b/drivers/gpu/drm/msm/disp/mdp5/mdp5_ctl.c
@@ -737,7 +737,7 @@ struct mdp5_ctl_manager *mdp5_ctlm_init(struct drm_device *dev,
 	}
 
 	/*
-	 * In Dual DSI case, CTL0 and CTL1 are always assigned to two DSI
+	 * In bonded DSI case, CTL0 and CTL1 are always assigned to two DSI
 	 * interfaces to support single FLUSH feature (Flush CTL0 and CTL1 when
 	 * only write into CTL0's FLUSH register) to keep two DSI pipes in sync.
 	 * Single FLUSH is supported from hw rev v3.0.
diff --git a/drivers/gpu/drm/msm/dsi/dsi.h b/drivers/gpu/drm/msm/dsi/dsi.h
index 9b8e9b07eced..856a532850c0 100644
--- a/drivers/gpu/drm/msm/dsi/dsi.h
+++ b/drivers/gpu/drm/msm/dsi/dsi.h
@@ -109,7 +109,7 @@ int msm_dsi_host_enable(struct mipi_dsi_host *host);
 int msm_dsi_host_disable(struct mipi_dsi_host *host);
 int msm_dsi_host_power_on(struct mipi_dsi_host *host,
 			struct msm_dsi_phy_shared_timings *phy_shared_timings,
-			bool is_dual_dsi);
+			bool is_bonded_dsi);
 int msm_dsi_host_power_off(struct mipi_dsi_host *host);
 int msm_dsi_host_set_display_mode(struct mipi_dsi_host *host,
 				  const struct drm_display_mode *mode);
@@ -123,7 +123,7 @@ int msm_dsi_host_set_src_pll(struct mipi_dsi_host *host,
 void msm_dsi_host_reset_phy(struct mipi_dsi_host *host);
 void msm_dsi_host_get_phy_clk_req(struct mipi_dsi_host *host,
 	struct msm_dsi_phy_clk_request *clk_req,
-	bool is_dual_dsi);
+	bool is_bonded_dsi);
 void msm_dsi_host_destroy(struct mipi_dsi_host *host);
 int msm_dsi_host_modeset_init(struct mipi_dsi_host *host,
 					struct drm_device *dev);
@@ -145,8 +145,8 @@ int dsi_dma_base_get_6g(struct msm_dsi_host *msm_host, uint64_t *iova);
 int dsi_dma_base_get_v2(struct msm_dsi_host *msm_host, uint64_t *iova);
 int dsi_clk_init_v2(struct msm_dsi_host *msm_host);
 int dsi_clk_init_6g_v2(struct msm_dsi_host *msm_host);
-int dsi_calc_clk_rate_v2(struct msm_dsi_host *msm_host, bool is_dual_dsi);
-int dsi_calc_clk_rate_6g(struct msm_dsi_host *msm_host, bool is_dual_dsi);
+int dsi_calc_clk_rate_v2(struct msm_dsi_host *msm_host, bool is_bonded_dsi);
+int dsi_calc_clk_rate_6g(struct msm_dsi_host *msm_host, bool is_bonded_dsi);
 void msm_dsi_host_snapshot(struct msm_disp_state *disp_state, struct mipi_dsi_host *host);
 /* dsi phy */
 struct msm_dsi_phy;
diff --git a/drivers/gpu/drm/msm/dsi/dsi_cfg.h b/drivers/gpu/drm/msm/dsi/dsi_cfg.h
index ade9b609c7d9..2bce00d5a9fc 100644
--- a/drivers/gpu/drm/msm/dsi/dsi_cfg.h
+++ b/drivers/gpu/drm/msm/dsi/dsi_cfg.h
@@ -47,7 +47,7 @@ struct msm_dsi_host_cfg_ops {
 	void* (*tx_buf_get)(struct msm_dsi_host *msm_host);
 	void (*tx_buf_put)(struct msm_dsi_host *msm_host);
 	int (*dma_base_get)(struct msm_dsi_host *msm_host, uint64_t *iova);
-	int (*calc_clk_rate)(struct msm_dsi_host *msm_host, bool is_dual_dsi);
+	int (*calc_clk_rate)(struct msm_dsi_host *msm_host, bool is_bonded_dsi);
 };
 
 struct msm_dsi_cfg_handler {
diff --git a/drivers/gpu/drm/msm/dsi/dsi_host.c b/drivers/gpu/drm/msm/dsi/dsi_host.c
index ed504fe5074f..706634d766ee 100644
--- a/drivers/gpu/drm/msm/dsi/dsi_host.c
+++ b/drivers/gpu/drm/msm/dsi/dsi_host.c
@@ -679,7 +679,7 @@ void dsi_link_clk_disable_v2(struct msm_dsi_host *msm_host)
 	clk_disable_unprepare(msm_host->byte_clk);
 }
 
-static u32 dsi_get_pclk_rate(struct msm_dsi_host *msm_host, bool is_dual_dsi)
+static u32 dsi_get_pclk_rate(struct msm_dsi_host *msm_host, bool is_bonded_dsi)
 {
 	struct drm_display_mode *mode = msm_host->mode;
 	u32 pclk_rate;
@@ -687,22 +687,22 @@ static u32 dsi_get_pclk_rate(struct msm_dsi_host *msm_host, bool is_dual_dsi)
 	pclk_rate = mode->clock * 1000;
 
 	/*
-	 * For dual DSI mode, the current DRM mode has the complete width of the
+	 * For bonded DSI mode, the current DRM mode has the complete width of the
 	 * panel. Since, the complete panel is driven by two DSI controllers,
 	 * the clock rates have to be split between the two dsi controllers.
 	 * Adjust the byte and pixel clock rates for each dsi host accordingly.
 	 */
-	if (is_dual_dsi)
+	if (is_bonded_dsi)
 		pclk_rate /= 2;
 
 	return pclk_rate;
 }
 
-static void dsi_calc_pclk(struct msm_dsi_host *msm_host, bool is_dual_dsi)
+static void dsi_calc_pclk(struct msm_dsi_host *msm_host, bool is_bonded_dsi)
 {
 	u8 lanes = msm_host->lanes;
 	u32 bpp = dsi_get_bpp(msm_host->format);
-	u32 pclk_rate = dsi_get_pclk_rate(msm_host, is_dual_dsi);
+	u32 pclk_rate = dsi_get_pclk_rate(msm_host, is_bonded_dsi);
 	u64 pclk_bpp = (u64)pclk_rate * bpp;
 
 	if (lanes == 0) {
@@ -720,28 +720,28 @@ static void dsi_calc_pclk(struct msm_dsi_host *msm_host, bool is_dual_dsi)
 
 }
 
-int dsi_calc_clk_rate_6g(struct msm_dsi_host *msm_host, bool is_dual_dsi)
+int dsi_calc_clk_rate_6g(struct msm_dsi_host *msm_host, bool is_bonded_dsi)
 {
 	if (!msm_host->mode) {
 		pr_err("%s: mode not set\n", __func__);
 		return -EINVAL;
 	}
 
-	dsi_calc_pclk(msm_host, is_dual_dsi);
+	dsi_calc_pclk(msm_host, is_bonded_dsi);
 	msm_host->esc_clk_rate = clk_get_rate(msm_host->esc_clk);
 	return 0;
 }
 
-int dsi_calc_clk_rate_v2(struct msm_dsi_host *msm_host, bool is_dual_dsi)
+int dsi_calc_clk_rate_v2(struct msm_dsi_host *msm_host, bool is_bonded_dsi)
 {
 	u32 bpp = dsi_get_bpp(msm_host->format);
 	u64 pclk_bpp;
 	unsigned int esc_mhz, esc_div;
 	unsigned long byte_mhz;
 
-	dsi_calc_pclk(msm_host, is_dual_dsi);
+	dsi_calc_pclk(msm_host, is_bonded_dsi);
 
-	pclk_bpp = (u64)dsi_get_pclk_rate(msm_host, is_dual_dsi) * bpp;
+	pclk_bpp = (u64)dsi_get_pclk_rate(msm_host, is_bonded_dsi) * bpp;
 	do_div(pclk_bpp, 8);
 	msm_host->src_clk_rate = pclk_bpp;
 
@@ -938,7 +938,7 @@ static void dsi_ctrl_config(struct msm_dsi_host *msm_host, bool enable,
 	dsi_write(msm_host, REG_DSI_CTRL, data);
 }
 
-static void dsi_timing_setup(struct msm_dsi_host *msm_host, bool is_dual_dsi)
+static void dsi_timing_setup(struct msm_dsi_host *msm_host, bool is_bonded_dsi)
 {
 	struct drm_display_mode *mode = msm_host->mode;
 	u32 hs_start = 0, vs_start = 0; /* take sync start as 0 */
@@ -956,13 +956,13 @@ static void dsi_timing_setup(struct msm_dsi_host *msm_host, bool is_dual_dsi)
 	DBG("");
 
 	/*
-	 * For dual DSI mode, the current DRM mode has
+	 * For bonded DSI mode, the current DRM mode has
 	 * the complete width of the panel. Since, the complete
 	 * panel is driven by two DSI controllers, the horizontal
 	 * timings have to be split between the two dsi controllers.
 	 * Adjust the DSI host timing values accordingly.
 	 */
-	if (is_dual_dsi) {
+	if (is_bonded_dsi) {
 		h_total /= 2;
 		hs_end /= 2;
 		ha_start /= 2;
@@ -2285,13 +2285,13 @@ void msm_dsi_host_reset_phy(struct mipi_dsi_host *host)
 
 void msm_dsi_host_get_phy_clk_req(struct mipi_dsi_host *host,
 			struct msm_dsi_phy_clk_request *clk_req,
-			bool is_dual_dsi)
+			bool is_bonded_dsi)
 {
 	struct msm_dsi_host *msm_host = to_msm_dsi_host(host);
 	const struct msm_dsi_cfg_handler *cfg_hnd = msm_host->cfg_hnd;
 	int ret;
 
-	ret = cfg_hnd->ops->calc_clk_rate(msm_host, is_dual_dsi);
+	ret = cfg_hnd->ops->calc_clk_rate(msm_host, is_bonded_dsi);
 	if (ret) {
 		pr_err("%s: unable to calc clk rate, %d\n", __func__, ret);
 		return;
@@ -2354,7 +2354,7 @@ static void msm_dsi_sfpb_config(struct msm_dsi_host *msm_host, bool enable)
 
 int msm_dsi_host_power_on(struct mipi_dsi_host *host,
 			struct msm_dsi_phy_shared_timings *phy_shared_timings,
-			bool is_dual_dsi)
+			bool is_bonded_dsi)
 {
 	struct msm_dsi_host *msm_host = to_msm_dsi_host(host);
 	const struct msm_dsi_cfg_handler *cfg_hnd = msm_host->cfg_hnd;
@@ -2392,7 +2392,7 @@ int msm_dsi_host_power_on(struct mipi_dsi_host *host,
 		goto fail_disable_clk;
 	}
 
-	dsi_timing_setup(msm_host, is_dual_dsi);
+	dsi_timing_setup(msm_host, is_bonded_dsi);
 	dsi_sw_reset(msm_host);
 	dsi_ctrl_config(msm_host, true, phy_shared_timings);
 
diff --git a/drivers/gpu/drm/msm/dsi/dsi_manager.c b/drivers/gpu/drm/msm/dsi/dsi_manager.c
index 4ebfedc4a9ac..b20645ab279b 100644
--- a/drivers/gpu/drm/msm/dsi/dsi_manager.c
+++ b/drivers/gpu/drm/msm/dsi/dsi_manager.c
@@ -21,14 +21,14 @@
 struct msm_dsi_manager {
 	struct msm_dsi *dsi[DSI_MAX];
 
-	bool is_dual_dsi;
+	bool is_bonded_dsi;
 	bool is_sync_needed;
 	int master_dsi_link_id;
 };
 
 static struct msm_dsi_manager msm_dsim_glb;
 
-#define IS_DUAL_DSI()		(msm_dsim_glb.is_dual_dsi)
+#define IS_BONDED_DSI()		(msm_dsim_glb.is_bonded_dsi)
 #define IS_SYNC_NEEDED()	(msm_dsim_glb.is_sync_needed)
 #define IS_MASTER_DSI_LINK(id)	(msm_dsim_glb.master_dsi_link_id == id)
 
@@ -42,18 +42,17 @@ static inline struct msm_dsi *dsi_mgr_get_other_dsi(int id)
 	return msm_dsim_glb.dsi[(id + 1) % DSI_MAX];
 }
 
-static int dsi_mgr_parse_dual_dsi(struct device_node *np, int id)
+static int dsi_mgr_parse_of(struct device_node *np, int id)
 {
 	struct msm_dsi_manager *msm_dsim = &msm_dsim_glb;
 
-	/* We assume 2 dsi nodes have the same information of dual-dsi and
-	 * sync-mode, and only one node specifies master in case of dual mode.
+	/* We assume 2 dsi nodes have the same information of bonded dsi and
+	 * sync-mode, and only one node specifies master in case of bonded mode.
 	 */
-	if (!msm_dsim->is_dual_dsi)
-		msm_dsim->is_dual_dsi = of_property_read_bool(
-						np, "qcom,dual-dsi-mode");
+	if (!msm_dsim->is_bonded_dsi)
+		msm_dsim->is_bonded_dsi = of_property_read_bool(np, "qcom,dual-dsi-mode");
 
-	if (msm_dsim->is_dual_dsi) {
+	if (msm_dsim->is_bonded_dsi) {
 		if (of_property_read_bool(np, "qcom,master-dsi"))
 			msm_dsim->master_dsi_link_id = id;
 		if (!msm_dsim->is_sync_needed)
@@ -72,7 +71,7 @@ static int dsi_mgr_setup_components(int id)
 	struct msm_dsi *clk_slave_dsi = dsi_mgr_get_dsi(DSI_CLOCK_SLAVE);
 	int ret;
 
-	if (!IS_DUAL_DSI()) {
+	if (!IS_BONDED_DSI()) {
 		ret = msm_dsi_host_register(msm_dsi->host, true);
 		if (ret)
 			return ret;
@@ -100,7 +99,7 @@ static int dsi_mgr_setup_components(int id)
 		if (ret)
 			return ret;
 
-		/* PLL0 is to drive both 2 DSI link clocks in Dual DSI mode. */
+		/* PLL0 is to drive both 2 DSI link clocks in bonded DSI mode. */
 		msm_dsi_phy_set_usecase(clk_master_dsi->phy,
 					MSM_DSI_PHY_MASTER);
 		msm_dsi_phy_set_usecase(clk_slave_dsi->phy,
@@ -119,9 +118,9 @@ static int enable_phy(struct msm_dsi *msm_dsi,
 {
 	struct msm_dsi_phy_clk_request clk_req;
 	int ret;
-	bool is_dual_dsi = IS_DUAL_DSI();
+	bool is_bonded_dsi = IS_BONDED_DSI();
 
-	msm_dsi_host_get_phy_clk_req(msm_dsi->host, &clk_req, is_dual_dsi);
+	msm_dsi_host_get_phy_clk_req(msm_dsi->host, &clk_req, is_bonded_dsi);
 
 	ret = msm_dsi_phy_enable(msm_dsi->phy, &clk_req);
 	msm_dsi_phy_get_shared_timings(msm_dsi->phy, shared_timings);
@@ -138,12 +137,12 @@ dsi_mgr_phy_enable(int id,
 	struct msm_dsi *sdsi = dsi_mgr_get_dsi(DSI_CLOCK_SLAVE);
 	int ret;
 
-	/* In case of dual DSI, some registers in PHY1 have been programmed
+	/* In case of bonded DSI, some registers in PHY1 have been programmed
 	 * during PLL0 clock's set_rate. The PHY1 reset called by host1 here
 	 * will silently reset those PHY1 registers. Therefore we need to reset
 	 * and enable both PHYs before any PLL clock operation.
 	 */
-	if (IS_DUAL_DSI() && mdsi && sdsi) {
+	if (IS_BONDED_DSI() && mdsi && sdsi) {
 		if (!mdsi->phy_enabled && !sdsi->phy_enabled) {
 			msm_dsi_host_reset_phy(mdsi->host);
 			msm_dsi_host_reset_phy(sdsi->host);
@@ -178,11 +177,11 @@ static void dsi_mgr_phy_disable(int id)
 	struct msm_dsi *sdsi = dsi_mgr_get_dsi(DSI_CLOCK_SLAVE);
 
 	/* disable DSI phy
-	 * In dual-dsi configuration, the phy should be disabled for the
+	 * In bonded dsi configuration, the phy should be disabled for the
 	 * first controller only when the second controller is disabled.
 	 */
 	msm_dsi->phy_enabled = false;
-	if (IS_DUAL_DSI() && mdsi && sdsi) {
+	if (IS_BONDED_DSI() && mdsi && sdsi) {
 		if (!mdsi->phy_enabled && !sdsi->phy_enabled) {
 			msm_dsi_phy_disable(sdsi->phy);
 			msm_dsi_phy_disable(mdsi->phy);
@@ -244,7 +243,7 @@ static int msm_dsi_manager_panel_init(struct drm_connector *conn, u8 id)
 	struct msm_dsi *master_dsi, *slave_dsi;
 	struct drm_panel *panel;
 
-	if (IS_DUAL_DSI() && !IS_MASTER_DSI_LINK(id)) {
+	if (IS_BONDED_DSI() && !IS_MASTER_DSI_LINK(id)) {
 		master_dsi = other_dsi;
 		slave_dsi = msm_dsi;
 	} else {
@@ -253,7 +252,7 @@ static int msm_dsi_manager_panel_init(struct drm_connector *conn, u8 id)
 	}
 
 	/*
-	 * There is only 1 panel in the global panel list for dual DSI mode.
+	 * There is only 1 panel in the global panel list for bonded DSI mode.
 	 * Therefore slave dsi should get the drm_panel instance from master
 	 * dsi.
 	 */
@@ -264,14 +263,14 @@ static int msm_dsi_manager_panel_init(struct drm_connector *conn, u8 id)
 		return PTR_ERR(panel);
 	}
 
-	if (!panel || !IS_DUAL_DSI())
+	if (!panel || !IS_BONDED_DSI())
 		goto out;
 
 	drm_object_attach_property(&conn->base,
 				   conn->dev->mode_config.tile_property, 0);
 
 	/*
-	 * Set split display info to kms once dual DSI panel is connected to
+	 * Set split display info to kms once bonded DSI panel is connected to
 	 * both hosts.
 	 */
 	if (other_dsi && other_dsi->panel && kms->funcs->set_split_display) {
@@ -317,7 +316,7 @@ static int dsi_mgr_connector_get_modes(struct drm_connector *connector)
 		return 0;
 
 	/*
-	 * In dual DSI mode, we have one connector that can be
+	 * In bonded DSI mode, we have one connector that can be
 	 * attached to the drm_panel.
 	 */
 	num = drm_panel_get_modes(panel, connector);
@@ -366,30 +365,30 @@ static void dsi_mgr_bridge_pre_enable(struct drm_bridge *bridge)
 	struct mipi_dsi_host *host = msm_dsi->host;
 	struct drm_panel *panel = msm_dsi->panel;
 	struct msm_dsi_phy_shared_timings phy_shared_timings[DSI_MAX];
-	bool is_dual_dsi = IS_DUAL_DSI();
+	bool is_bonded_dsi = IS_BONDED_DSI();
 	int ret;
 
 	DBG("id=%d", id);
 	if (!msm_dsi_device_connected(msm_dsi))
 		return;
 
-	/* Do nothing with the host if it is slave-DSI in case of dual DSI */
-	if (is_dual_dsi && !IS_MASTER_DSI_LINK(id))
+	/* Do nothing with the host if it is slave-DSI in case of bonded DSI */
+	if (is_bonded_dsi && !IS_MASTER_DSI_LINK(id))
 		return;
 
 	ret = dsi_mgr_phy_enable(id, phy_shared_timings);
 	if (ret)
 		goto phy_en_fail;
 
-	ret = msm_dsi_host_power_on(host, &phy_shared_timings[id], is_dual_dsi);
+	ret = msm_dsi_host_power_on(host, &phy_shared_timings[id], is_bonded_dsi);
 	if (ret) {
 		pr_err("%s: power on host %d failed, %d\n", __func__, id, ret);
 		goto host_on_fail;
 	}
 
-	if (is_dual_dsi && msm_dsi1) {
+	if (is_bonded_dsi && msm_dsi1) {
 		ret = msm_dsi_host_power_on(msm_dsi1->host,
-				&phy_shared_timings[DSI_1], is_dual_dsi);
+				&phy_shared_timings[DSI_1], is_bonded_dsi);
 		if (ret) {
 			pr_err("%s: power on host1 failed, %d\n",
 							__func__, ret);
@@ -415,7 +414,7 @@ static void dsi_mgr_bridge_pre_enable(struct drm_bridge *bridge)
 		goto host_en_fail;
 	}
 
-	if (is_dual_dsi && msm_dsi1) {
+	if (is_bonded_dsi && msm_dsi1) {
 		ret = msm_dsi_host_enable(msm_dsi1->host);
 		if (ret) {
 			pr_err("%s: enable host1 failed, %d\n", __func__, ret);
@@ -431,7 +430,7 @@ static void dsi_mgr_bridge_pre_enable(struct drm_bridge *bridge)
 	if (panel)
 		drm_panel_unprepare(panel);
 panel_prep_fail:
-	if (is_dual_dsi && msm_dsi1)
+	if (is_bonded_dsi && msm_dsi1)
 		msm_dsi_host_power_off(msm_dsi1->host);
 host1_on_fail:
 	msm_dsi_host_power_off(host);
@@ -446,15 +445,15 @@ static void dsi_mgr_bridge_enable(struct drm_bridge *bridge)
 	int id = dsi_mgr_bridge_get_id(bridge);
 	struct msm_dsi *msm_dsi = dsi_mgr_get_dsi(id);
 	struct drm_panel *panel = msm_dsi->panel;
-	bool is_dual_dsi = IS_DUAL_DSI();
+	bool is_bonded_dsi = IS_BONDED_DSI();
 	int ret;
 
 	DBG("id=%d", id);
 	if (!msm_dsi_device_connected(msm_dsi))
 		return;
 
-	/* Do nothing with the host if it is slave-DSI in case of dual DSI */
-	if (is_dual_dsi && !IS_MASTER_DSI_LINK(id))
+	/* Do nothing with the host if it is slave-DSI in case of bonded DSI */
+	if (is_bonded_dsi && !IS_MASTER_DSI_LINK(id))
 		return;
 
 	if (panel) {
@@ -471,15 +470,15 @@ static void dsi_mgr_bridge_disable(struct drm_bridge *bridge)
 	int id = dsi_mgr_bridge_get_id(bridge);
 	struct msm_dsi *msm_dsi = dsi_mgr_get_dsi(id);
 	struct drm_panel *panel = msm_dsi->panel;
-	bool is_dual_dsi = IS_DUAL_DSI();
+	bool is_bonded_dsi = IS_BONDED_DSI();
 	int ret;
 
 	DBG("id=%d", id);
 	if (!msm_dsi_device_connected(msm_dsi))
 		return;
 
-	/* Do nothing with the host if it is slave-DSI in case of dual DSI */
-	if (is_dual_dsi && !IS_MASTER_DSI_LINK(id))
+	/* Do nothing with the host if it is slave-DSI in case of bonded DSI */
+	if (is_bonded_dsi && !IS_MASTER_DSI_LINK(id))
 		return;
 
 	if (panel) {
@@ -497,7 +496,7 @@ static void dsi_mgr_bridge_post_disable(struct drm_bridge *bridge)
 	struct msm_dsi *msm_dsi1 = dsi_mgr_get_dsi(DSI_1);
 	struct mipi_dsi_host *host = msm_dsi->host;
 	struct drm_panel *panel = msm_dsi->panel;
-	bool is_dual_dsi = IS_DUAL_DSI();
+	bool is_bonded_dsi = IS_BONDED_DSI();
 	int ret;
 
 	DBG("id=%d", id);
@@ -506,18 +505,18 @@ static void dsi_mgr_bridge_post_disable(struct drm_bridge *bridge)
 		return;
 
 	/*
-	 * Do nothing with the host if it is slave-DSI in case of dual DSI.
+	 * Do nothing with the host if it is slave-DSI in case of bonded DSI.
 	 * It is safe to call dsi_mgr_phy_disable() here because a single PHY
 	 * won't be diabled until both PHYs request disable.
 	 */
-	if (is_dual_dsi && !IS_MASTER_DSI_LINK(id))
+	if (is_bonded_dsi && !IS_MASTER_DSI_LINK(id))
 		goto disable_phy;
 
 	ret = msm_dsi_host_disable(host);
 	if (ret)
 		pr_err("%s: host %d disable failed, %d\n", __func__, id, ret);
 
-	if (is_dual_dsi && msm_dsi1) {
+	if (is_bonded_dsi && msm_dsi1) {
 		ret = msm_dsi_host_disable(msm_dsi1->host);
 		if (ret)
 			pr_err("%s: host1 disable failed, %d\n", __func__, ret);
@@ -537,7 +536,7 @@ static void dsi_mgr_bridge_post_disable(struct drm_bridge *bridge)
 	if (ret)
 		pr_err("%s: host %d power off failed,%d\n", __func__, id, ret);
 
-	if (is_dual_dsi && msm_dsi1) {
+	if (is_bonded_dsi && msm_dsi1) {
 		ret = msm_dsi_host_power_off(msm_dsi1->host);
 		if (ret)
 			pr_err("%s: host1 power off failed, %d\n",
@@ -556,15 +555,15 @@ static void dsi_mgr_bridge_mode_set(struct drm_bridge *bridge,
 	struct msm_dsi *msm_dsi = dsi_mgr_get_dsi(id);
 	struct msm_dsi *other_dsi = dsi_mgr_get_other_dsi(id);
 	struct mipi_dsi_host *host = msm_dsi->host;
-	bool is_dual_dsi = IS_DUAL_DSI();
+	bool is_bonded_dsi = IS_BONDED_DSI();
 
 	DBG("set mode: " DRM_MODE_FMT, DRM_MODE_ARG(mode));
 
-	if (is_dual_dsi && !IS_MASTER_DSI_LINK(id))
+	if (is_bonded_dsi && !IS_MASTER_DSI_LINK(id))
 		return;
 
 	msm_dsi_host_set_display_mode(host, adjusted_mode);
-	if (is_dual_dsi && other_dsi)
+	if (is_bonded_dsi && other_dsi)
 		msm_dsi_host_set_display_mode(other_dsi->host, adjusted_mode);
 }
 
@@ -640,15 +639,15 @@ struct drm_connector *msm_dsi_manager_connector_init(u8 id)
 
 bool msm_dsi_manager_validate_current_config(u8 id)
 {
-	bool is_dual_dsi = IS_DUAL_DSI();
+	bool is_bonded_dsi = IS_BONDED_DSI();
 
 	/*
-	 * For dual DSI, we only have one drm panel. For this
+	 * For bonded DSI, we only have one drm panel. For this
 	 * use case, we register only one bridge/connector.
 	 * Skip bridge/connector initialisation if it is
-	 * slave-DSI for dual DSI configuration.
+	 * slave-DSI for bonded DSI configuration.
 	 */
-	if (is_dual_dsi && !IS_MASTER_DSI_LINK(id)) {
+	if (is_bonded_dsi && !IS_MASTER_DSI_LINK(id)) {
 		DBG("Skip bridge registration for slave DSI->id: %d\n", id);
 		return false;
 	}
@@ -740,7 +739,7 @@ int msm_dsi_manager_cmd_xfer(int id, const struct mipi_dsi_msg *msg)
 	if (!msg->tx_buf || !msg->tx_len)
 		return 0;
 
-	/* In dual master case, panel requires the same commands sent to
+	/* In bonded master case, panel requires the same commands sent to
 	 * both DSI links. Host issues the command trigger to both links
 	 * when DSI_1 calls the cmd transfer function, no matter it happens
 	 * before or after DSI_0 cmd transfer.
@@ -809,9 +808,9 @@ int msm_dsi_manager_register(struct msm_dsi *msm_dsi)
 
 	msm_dsim->dsi[id] = msm_dsi;
 
-	ret = dsi_mgr_parse_dual_dsi(msm_dsi->pdev->dev.of_node, id);
+	ret = dsi_mgr_parse_of(msm_dsi->pdev->dev.of_node, id);
 	if (ret) {
-		pr_err("%s: failed to parse dual DSI info\n", __func__);
+		pr_err("%s: failed to parse OF DSI info\n", __func__);
 		goto fail;
 	}
 
diff --git a/drivers/gpu/drm/msm/dsi/phy/dsi_phy_10nm.c b/drivers/gpu/drm/msm/dsi/phy/dsi_phy_10nm.c
index e46b10fc793a..d8128f50b0dd 100644
--- a/drivers/gpu/drm/msm/dsi/phy/dsi_phy_10nm.c
+++ b/drivers/gpu/drm/msm/dsi/phy/dsi_phy_10nm.c
@@ -84,7 +84,7 @@ struct dsi_pll_10nm {
 #define to_pll_10nm(x)	container_of(x, struct dsi_pll_10nm, clk_hw)
 
 /*
- * Global list of private DSI PLL struct pointers. We need this for Dual DSI
+ * Global list of private DSI PLL struct pointers. We need this for bonded DSI
  * mode, where the master PLL's clk_ops needs access the slave's private data
  */
 static struct dsi_pll_10nm *pll_10nm_list[DSI_MAX];
diff --git a/drivers/gpu/drm/msm/dsi/phy/dsi_phy_14nm.c b/drivers/gpu/drm/msm/dsi/phy/dsi_phy_14nm.c
index a34cf151c517..e7f857ad02a3 100644
--- a/drivers/gpu/drm/msm/dsi/phy/dsi_phy_14nm.c
+++ b/drivers/gpu/drm/msm/dsi/phy/dsi_phy_14nm.c
@@ -86,7 +86,7 @@ struct dsi_pll_14nm {
 /*
  * Private struct for N1/N2 post-divider clocks. These clocks are similar to
  * the generic clk_divider class of clocks. The only difference is that it
- * also sets the slave DSI PLL's post-dividers if in Dual DSI mode
+ * also sets the slave DSI PLL's post-dividers if in bonded DSI mode
  */
 struct dsi_pll_14nm_postdiv {
 	struct clk_hw hw;
@@ -102,7 +102,7 @@ struct dsi_pll_14nm_postdiv {
 #define to_pll_14nm_postdiv(_hw) container_of(_hw, struct dsi_pll_14nm_postdiv, hw)
 
 /*
- * Global list of private DSI PLL struct pointers. We need this for Dual DSI
+ * Global list of private DSI PLL struct pointers. We need this for bonded DSI
  * mode, where the master PLL's clk_ops needs access the slave's private data
  */
 static struct dsi_pll_14nm *pll_14nm_list[DSI_MAX];
@@ -658,7 +658,7 @@ static int dsi_pll_14nm_postdiv_set_rate(struct clk_hw *hw, unsigned long rate,
 	val |= value << shift;
 	dsi_phy_write(base + REG_DSI_14nm_PHY_CMN_CLK_CFG0, val);
 
-	/* If we're master in dual DSI mode, then the slave PLL's post-dividers
+	/* If we're master in bonded DSI mode, then the slave PLL's post-dividers
 	 * follow the master's post dividers
 	 */
 	if (pll_14nm->phy->usecase == MSM_DSI_PHY_MASTER) {
diff --git a/drivers/gpu/drm/msm/dsi/phy/dsi_phy_7nm.c b/drivers/gpu/drm/msm/dsi/phy/dsi_phy_7nm.c
index 7c23d4c47338..ab26b530fbcf 100644
--- a/drivers/gpu/drm/msm/dsi/phy/dsi_phy_7nm.c
+++ b/drivers/gpu/drm/msm/dsi/phy/dsi_phy_7nm.c
@@ -83,7 +83,7 @@ struct dsi_pll_7nm {
 #define to_pll_7nm(x)	container_of(x, struct dsi_pll_7nm, clk_hw)
 
 /*
- * Global list of private DSI PLL struct pointers. We need this for Dual DSI
+ * Global list of private DSI PLL struct pointers. We need this for bonded DSI
  * mode, where the master PLL's clk_ops needs access the slave's private data
  */
 static struct dsi_pll_7nm *pll_7nm_list[DSI_MAX];
-- 
2.30.2


^ permalink raw reply related	[flat|nested] 13+ messages in thread

* [PATCH v3 2/7] drm/msm/dsi: add three helper functions
  2021-07-10 22:19 [PATCH v3 0/7] drm/msm/dpu: add support for independent DSI config Dmitry Baryshkov
  2021-07-10 22:19 ` [PATCH v3 1/7] drm/msm/dsi: rename dual DSI to bonded DSI Dmitry Baryshkov
@ 2021-07-10 22:20 ` Dmitry Baryshkov
  2021-07-11  4:21   ` kernel test robot
  2021-07-12 21:03   ` [Freedreno] " abhinavk
  2021-07-10 22:20 ` [PATCH v3 3/7] drm/msm/dpu: support setting up two independent DSI connectors Dmitry Baryshkov
                   ` (4 subsequent siblings)
  6 siblings, 2 replies; 13+ messages in thread
From: Dmitry Baryshkov @ 2021-07-10 22:20 UTC (permalink / raw)
  To: Bjorn Andersson, Rob Clark, Sean Paul, Abhinav Kumar
  Cc: Jonathan Marek, Stephen Boyd, David Airlie, Daniel Vetter,
	linux-arm-msm, dri-devel, freedreno

Add three helper functions to be used by display drivers for setting up
encoders.

Signed-off-by: Dmitry Baryshkov <dmitry.baryshkov@linaro.org>
---
 drivers/gpu/drm/msm/dsi/dsi.c         |  7 +++++++
 drivers/gpu/drm/msm/dsi/dsi_manager.c | 19 +++++++++++--------
 drivers/gpu/drm/msm/msm_drv.h         | 17 +++++++++++++++--
 3 files changed, 33 insertions(+), 10 deletions(-)

diff --git a/drivers/gpu/drm/msm/dsi/dsi.c b/drivers/gpu/drm/msm/dsi/dsi.c
index 75afc12a7b25..5201d7eb0490 100644
--- a/drivers/gpu/drm/msm/dsi/dsi.c
+++ b/drivers/gpu/drm/msm/dsi/dsi.c
@@ -13,6 +13,13 @@ struct drm_encoder *msm_dsi_get_encoder(struct msm_dsi *msm_dsi)
 	return msm_dsi->encoder;
 }
 
+bool msm_dsi_is_cmd_mode(struct msm_dsi *msm_dsi)
+{
+	unsigned long host_flags = msm_dsi_host_get_mode_flags(msm_dsi->host);
+
+	return !(host_flags & MIPI_DSI_MODE_VIDEO);
+}
+
 static int dsi_get_phy(struct msm_dsi *msm_dsi)
 {
 	struct platform_device *pdev = msm_dsi->pdev;
diff --git a/drivers/gpu/drm/msm/dsi/dsi_manager.c b/drivers/gpu/drm/msm/dsi/dsi_manager.c
index b20645ab279b..27d3b9ebf831 100644
--- a/drivers/gpu/drm/msm/dsi/dsi_manager.c
+++ b/drivers/gpu/drm/msm/dsi/dsi_manager.c
@@ -216,12 +216,6 @@ static int dsi_mgr_bridge_get_id(struct drm_bridge *bridge)
 	return dsi_bridge->id;
 }
 
-static bool dsi_mgr_is_cmd_mode(struct msm_dsi *msm_dsi)
-{
-	unsigned long host_flags = msm_dsi_host_get_mode_flags(msm_dsi->host);
-	return !(host_flags & MIPI_DSI_MODE_VIDEO);
-}
-
 void msm_dsi_manager_setup_encoder(int id)
 {
 	struct msm_dsi *msm_dsi = dsi_mgr_get_dsi(id);
@@ -231,7 +225,7 @@ void msm_dsi_manager_setup_encoder(int id)
 
 	if (encoder && kms->funcs->set_encoder_mode)
 		kms->funcs->set_encoder_mode(kms, encoder,
-					     dsi_mgr_is_cmd_mode(msm_dsi));
+					     msm_dsi_is_cmd_mode(msm_dsi));
 }
 
 static int msm_dsi_manager_panel_init(struct drm_connector *conn, u8 id)
@@ -276,7 +270,7 @@ static int msm_dsi_manager_panel_init(struct drm_connector *conn, u8 id)
 	if (other_dsi && other_dsi->panel && kms->funcs->set_split_display) {
 		kms->funcs->set_split_display(kms, master_dsi->encoder,
 					      slave_dsi->encoder,
-					      dsi_mgr_is_cmd_mode(msm_dsi));
+					      msm_dsi_is_cmd_mode(msm_dsi));
 	}
 
 out:
@@ -839,3 +833,12 @@ void msm_dsi_manager_unregister(struct msm_dsi *msm_dsi)
 		msm_dsim->dsi[msm_dsi->id] = NULL;
 }
 
+bool msm_dsi_is_bonded_dsi(struct msm_dsi *msm_dsi)
+{
+	return IS_BONDED_DSI();
+}
+
+bool msm_dsi_is_master_dsi(struct msm_dsi *msm_dsi)
+{
+	return IS_MASTER_DSI_LINK(msm_dsi->id);
+}
diff --git a/drivers/gpu/drm/msm/msm_drv.h b/drivers/gpu/drm/msm/msm_drv.h
index 1a48a709ffb3..3d331acbc94a 100644
--- a/drivers/gpu/drm/msm/msm_drv.h
+++ b/drivers/gpu/drm/msm/msm_drv.h
@@ -350,7 +350,9 @@ void __exit msm_dsi_unregister(void);
 int msm_dsi_modeset_init(struct msm_dsi *msm_dsi, struct drm_device *dev,
 			 struct drm_encoder *encoder);
 void msm_dsi_snapshot(struct msm_disp_state *disp_state, struct msm_dsi *msm_dsi);
-
+bool msm_dsi_is_cmd_mode(struct msm_dsi *msm_dsi);
+bool msm_dsi_is_bonded_dsi(struct msm_dsi *msm_dsi);
+bool msm_dsi_is_master_dsi(struct msm_dsi *msm_dsi);
 #else
 static inline void __init msm_dsi_register(void)
 {
@@ -367,7 +369,18 @@ static inline int msm_dsi_modeset_init(struct msm_dsi *msm_dsi,
 static inline void msm_dsi_snapshot(struct msm_disp_state *disp_state, struct msm_dsi *msm_dsi)
 {
 }
-
+static inline bool msm_dsi_is_cmd_mode(struct msm_dsi *msm_dsi)
+{
+	return false;
+}
+static bool msm_dsi_is_bonded_dsi(struct msm_dsi *msm_dsi)
+{
+	return false;
+}
+bool msm_dsi_is_master_dsi(struct msm_dsi *msm_dsi)
+{
+	return false
+}
 #endif
 
 #ifdef CONFIG_DRM_MSM_DP
-- 
2.30.2


^ permalink raw reply related	[flat|nested] 13+ messages in thread

* [PATCH v3 3/7] drm/msm/dpu: support setting up two independent DSI connectors
  2021-07-10 22:19 [PATCH v3 0/7] drm/msm/dpu: add support for independent DSI config Dmitry Baryshkov
  2021-07-10 22:19 ` [PATCH v3 1/7] drm/msm/dsi: rename dual DSI to bonded DSI Dmitry Baryshkov
  2021-07-10 22:20 ` [PATCH v3 2/7] drm/msm/dsi: add three helper functions Dmitry Baryshkov
@ 2021-07-10 22:20 ` Dmitry Baryshkov
  2021-07-12 21:15   ` abhinavk
  2021-07-10 22:20 ` [PATCH v3 4/7] drm/msm/mdp5: move mdp5_encoder_set_intf_mode after msm_dsi_modeset_init Dmitry Baryshkov
                   ` (3 subsequent siblings)
  6 siblings, 1 reply; 13+ messages in thread
From: Dmitry Baryshkov @ 2021-07-10 22:20 UTC (permalink / raw)
  To: Bjorn Andersson, Rob Clark, Sean Paul, Abhinav Kumar
  Cc: Jonathan Marek, Stephen Boyd, David Airlie, Daniel Vetter,
	linux-arm-msm, dri-devel, freedreno

Move setting up encoders from set_encoder_mode to
_dpu_kms_initialize_dsi() / _dpu_kms_initialize_displayport(). This
allows us to support not only "single DSI" and "bonded DSI" but also "two
independent DSI" configurations. In future this would also help adding
support for multiple DP connectors.

Signed-off-by: Dmitry Baryshkov <dmitry.baryshkov@linaro.org>
---
 drivers/gpu/drm/msm/disp/dpu1/dpu_kms.c | 102 +++++++++++++-----------
 1 file changed, 57 insertions(+), 45 deletions(-)

diff --git a/drivers/gpu/drm/msm/disp/dpu1/dpu_kms.c b/drivers/gpu/drm/msm/disp/dpu1/dpu_kms.c
index 1d3a4f395e74..3cd2011e18d4 100644
--- a/drivers/gpu/drm/msm/disp/dpu1/dpu_kms.c
+++ b/drivers/gpu/drm/msm/disp/dpu1/dpu_kms.c
@@ -471,30 +471,68 @@ static int _dpu_kms_initialize_dsi(struct drm_device *dev,
 				    struct dpu_kms *dpu_kms)
 {
 	struct drm_encoder *encoder = NULL;
+	struct msm_display_info info;
 	int i, rc = 0;
 
 	if (!(priv->dsi[0] || priv->dsi[1]))
 		return rc;
 
-	/*TODO: Support two independent DSI connectors */
-	encoder = dpu_encoder_init(dev, DRM_MODE_ENCODER_DSI);
-	if (IS_ERR(encoder)) {
-		DPU_ERROR("encoder init failed for dsi display\n");
-		return PTR_ERR(encoder);
-	}
-
-	priv->encoders[priv->num_encoders++] = encoder;
-
+	/*
+	 * We support following confiurations:
+	 * - Single DSI host (dsi0 or dsi1)
+	 * - Two independent DSI hosts
+	 * - Bonded DSI0 and DSI1 hosts
+	 *
+	 * TODO: Support swapping DSI0 and DSI1 in the bonded setup.
+	 */
 	for (i = 0; i < ARRAY_SIZE(priv->dsi); i++) {
+		int other = (i + 1) % 2;
+
 		if (!priv->dsi[i])
 			continue;
 
+		if (msm_dsi_is_bonded_dsi(priv->dsi[i]) &&
+		    !msm_dsi_is_master_dsi(priv->dsi[i]))
+			continue;
+
+		encoder = dpu_encoder_init(dev, DRM_MODE_ENCODER_DSI);
+		if (IS_ERR(encoder)) {
+			DPU_ERROR("encoder init failed for dsi display\n");
+			return PTR_ERR(encoder);
+		}
+
+		priv->encoders[priv->num_encoders++] = encoder;
+
+		memset(&info, 0, sizeof(info));
+		info.intf_type = encoder->encoder_type;
+
 		rc = msm_dsi_modeset_init(priv->dsi[i], dev, encoder);
 		if (rc) {
 			DPU_ERROR("modeset_init failed for dsi[%d], rc = %d\n",
 				i, rc);
 			break;
 		}
+
+		info.h_tile_instance[info.num_of_h_tiles++] = i;
+		info.capabilities = msm_dsi_is_cmd_mode(priv->dsi[i]) ?
+			MSM_DISPLAY_CAP_CMD_MODE :
+			MSM_DISPLAY_CAP_VID_MODE;
+
+		if (msm_dsi_is_bonded_dsi(priv->dsi[i]) && priv->dsi[other]) {
+			rc = msm_dsi_modeset_init(priv->dsi[other], dev, encoder);
+			if (rc) {
+				DPU_ERROR("modeset_init failed for dsi[%d], rc = %d\n",
+					other, rc);
+				break;
+			}
+
+			info.h_tile_instance[info.num_of_h_tiles++] = other;
+		}
+
+		rc = dpu_encoder_setup(dev, encoder, &info);
+		if (rc)
+			DPU_ERROR("failed to setup DPU encoder %d: rc:%d\n",
+				  encoder->base.id, rc);
 	}
 
 	return rc;
@@ -505,6 +543,7 @@ static int _dpu_kms_initialize_displayport(struct drm_device *dev,
 					    struct dpu_kms *dpu_kms)
 {
 	struct drm_encoder *encoder = NULL;
+	struct msm_display_info info;
 	int rc = 0;
 
 	if (!priv->dp)
@@ -516,6 +555,7 @@ static int _dpu_kms_initialize_displayport(struct drm_device *dev,
 		return PTR_ERR(encoder);
 	}
 
+	memset(&info, 0, sizeof(info));
 	rc = msm_dp_modeset_init(priv->dp, dev, encoder);
 	if (rc) {
 		DPU_ERROR("modeset_init failed for DP, rc = %d\n", rc);
@@ -524,6 +564,14 @@ static int _dpu_kms_initialize_displayport(struct drm_device *dev,
 	}
 
 	priv->encoders[priv->num_encoders++] = encoder;
+
+	info.num_of_h_tiles = 1;
+	info.capabilities = MSM_DISPLAY_CAP_VID_MODE;
+	info.intf_type = encoder->encoder_type;
+	rc = dpu_encoder_setup(dev, encoder, &info);
+	if (rc)
+		DPU_ERROR("failed to setup DPU encoder %d: rc:%d\n",
+			  encoder->base.id, rc);
 	return rc;
 }
 
@@ -726,41 +774,6 @@ static void dpu_kms_destroy(struct msm_kms *kms)
 	msm_kms_destroy(&dpu_kms->base);
 }
 
-static void _dpu_kms_set_encoder_mode(struct msm_kms *kms,
-				 struct drm_encoder *encoder,
-				 bool cmd_mode)
-{
-	struct msm_display_info info;
-	struct msm_drm_private *priv = encoder->dev->dev_private;
-	int i, rc = 0;
-
-	memset(&info, 0, sizeof(info));
-
-	info.intf_type = encoder->encoder_type;
-	info.capabilities = cmd_mode ? MSM_DISPLAY_CAP_CMD_MODE :
-			MSM_DISPLAY_CAP_VID_MODE;
-
-	switch (info.intf_type) {
-	case DRM_MODE_ENCODER_DSI:
-		/* TODO: No support for DSI swap */
-		for (i = 0; i < ARRAY_SIZE(priv->dsi); i++) {
-			if (priv->dsi[i]) {
-				info.h_tile_instance[info.num_of_h_tiles] = i;
-				info.num_of_h_tiles++;
-			}
-		}
-		break;
-	case DRM_MODE_ENCODER_TMDS:
-		info.num_of_h_tiles = 1;
-		break;
-	}
-
-	rc = dpu_encoder_setup(encoder->dev, encoder, &info);
-	if (rc)
-		DPU_ERROR("failed to setup DPU encoder %d: rc:%d\n",
-			encoder->base.id, rc);
-}
-
 static irqreturn_t dpu_irq(struct msm_kms *kms)
 {
 	struct dpu_kms *dpu_kms = to_dpu_kms(kms);
@@ -863,7 +876,6 @@ static const struct msm_kms_funcs kms_funcs = {
 	.get_format      = dpu_get_msm_format,
 	.round_pixclk    = dpu_kms_round_pixclk,
 	.destroy         = dpu_kms_destroy,
-	.set_encoder_mode = _dpu_kms_set_encoder_mode,
 	.snapshot        = dpu_kms_mdp_snapshot,
 #ifdef CONFIG_DEBUG_FS
 	.debugfs_init    = dpu_kms_debugfs_init,
-- 
2.30.2


^ permalink raw reply related	[flat|nested] 13+ messages in thread

* [PATCH v3 4/7] drm/msm/mdp5: move mdp5_encoder_set_intf_mode after msm_dsi_modeset_init
  2021-07-10 22:19 [PATCH v3 0/7] drm/msm/dpu: add support for independent DSI config Dmitry Baryshkov
                   ` (2 preceding siblings ...)
  2021-07-10 22:20 ` [PATCH v3 3/7] drm/msm/dpu: support setting up two independent DSI connectors Dmitry Baryshkov
@ 2021-07-10 22:20 ` Dmitry Baryshkov
  2021-07-10 22:20 ` [PATCH v3 5/7] drm/msm/dp: stop calling set_encoder_mode callback Dmitry Baryshkov
                   ` (2 subsequent siblings)
  6 siblings, 0 replies; 13+ messages in thread
From: Dmitry Baryshkov @ 2021-07-10 22:20 UTC (permalink / raw)
  To: Bjorn Andersson, Rob Clark, Sean Paul, Abhinav Kumar
  Cc: Jonathan Marek, Stephen Boyd, David Airlie, Daniel Vetter,
	linux-arm-msm, dri-devel, freedreno

Move a call to mdp5_encoder_set_intf_mode() after
msm_dsi_modeset_init(), removing set_encoder_mode callback.

Signed-off-by: Dmitry Baryshkov <dmitry.baryshkov@linaro.org>
Reviewed-by: Abhinav Kumar <abhinavk@codeaurora.org>
---
 drivers/gpu/drm/msm/disp/mdp5/mdp5_kms.c | 11 +++--------
 1 file changed, 3 insertions(+), 8 deletions(-)

diff --git a/drivers/gpu/drm/msm/disp/mdp5/mdp5_kms.c b/drivers/gpu/drm/msm/disp/mdp5/mdp5_kms.c
index 15aed45022bc..b3b42672b2d4 100644
--- a/drivers/gpu/drm/msm/disp/mdp5/mdp5_kms.c
+++ b/drivers/gpu/drm/msm/disp/mdp5/mdp5_kms.c
@@ -209,13 +209,6 @@ static int mdp5_set_split_display(struct msm_kms *kms,
 							  slave_encoder);
 }
 
-static void mdp5_set_encoder_mode(struct msm_kms *kms,
-				  struct drm_encoder *encoder,
-				  bool cmd_mode)
-{
-	mdp5_encoder_set_intf_mode(encoder, cmd_mode);
-}
-
 static void mdp5_kms_destroy(struct msm_kms *kms)
 {
 	struct mdp5_kms *mdp5_kms = to_mdp5_kms(to_mdp_kms(kms));
@@ -287,7 +280,6 @@ static const struct mdp_kms_funcs kms_funcs = {
 		.get_format      = mdp_get_format,
 		.round_pixclk    = mdp5_round_pixclk,
 		.set_split_display = mdp5_set_split_display,
-		.set_encoder_mode = mdp5_set_encoder_mode,
 		.destroy         = mdp5_kms_destroy,
 #ifdef CONFIG_DEBUG_FS
 		.debugfs_init    = mdp5_kms_debugfs_init,
@@ -448,6 +440,9 @@ static int modeset_init_intf(struct mdp5_kms *mdp5_kms,
 		}
 
 		ret = msm_dsi_modeset_init(priv->dsi[dsi_id], dev, encoder);
+		if (!ret)
+			mdp5_encoder_set_intf_mode(encoder, msm_dsi_is_cmd_mode(priv->dsi[dsi_id]));
+
 		break;
 	}
 	default:
-- 
2.30.2


^ permalink raw reply related	[flat|nested] 13+ messages in thread

* [PATCH v3 5/7] drm/msm/dp: stop calling set_encoder_mode callback
  2021-07-10 22:19 [PATCH v3 0/7] drm/msm/dpu: add support for independent DSI config Dmitry Baryshkov
                   ` (3 preceding siblings ...)
  2021-07-10 22:20 ` [PATCH v3 4/7] drm/msm/mdp5: move mdp5_encoder_set_intf_mode after msm_dsi_modeset_init Dmitry Baryshkov
@ 2021-07-10 22:20 ` Dmitry Baryshkov
  2021-07-10 22:20 ` [PATCH v3 6/7] drm/msm/dsi: " Dmitry Baryshkov
  2021-07-10 22:20 ` [PATCH v3 7/7] drm/msm/kms: drop " Dmitry Baryshkov
  6 siblings, 0 replies; 13+ messages in thread
From: Dmitry Baryshkov @ 2021-07-10 22:20 UTC (permalink / raw)
  To: Bjorn Andersson, Rob Clark, Sean Paul, Abhinav Kumar
  Cc: Jonathan Marek, Stephen Boyd, David Airlie, Daniel Vetter,
	linux-arm-msm, dri-devel, freedreno

None of the display drivers now implement set_encoder_mode callback.
Stop calling it from the modeset init code.

Signed-off-by: Dmitry Baryshkov <dmitry.baryshkov@linaro.org>
Reviewed-by: Abhinav Kumar <abhinavk@codeaurora.org>
---
 drivers/gpu/drm/msm/dp/dp_display.c | 18 ------------------
 1 file changed, 18 deletions(-)

diff --git a/drivers/gpu/drm/msm/dp/dp_display.c b/drivers/gpu/drm/msm/dp/dp_display.c
index 051c1be1de7e..70b319a8fe83 100644
--- a/drivers/gpu/drm/msm/dp/dp_display.c
+++ b/drivers/gpu/drm/msm/dp/dp_display.c
@@ -102,8 +102,6 @@ struct dp_display_private {
 	struct dp_display_mode dp_mode;
 	struct msm_dp dp_display;
 
-	bool encoder_mode_set;
-
 	/* wait for audio signaling */
 	struct completion audio_comp;
 
@@ -283,20 +281,6 @@ static void dp_display_send_hpd_event(struct msm_dp *dp_display)
 }
 
 
-static void dp_display_set_encoder_mode(struct dp_display_private *dp)
-{
-	struct msm_drm_private *priv = dp->dp_display.drm_dev->dev_private;
-	struct msm_kms *kms = priv->kms;
-
-	if (!dp->encoder_mode_set && dp->dp_display.encoder &&
-				kms->funcs->set_encoder_mode) {
-		kms->funcs->set_encoder_mode(kms,
-				dp->dp_display.encoder, false);
-
-		dp->encoder_mode_set = true;
-	}
-}
-
 static int dp_display_send_hpd_notification(struct dp_display_private *dp,
 					    bool hpd)
 {
@@ -369,8 +353,6 @@ static void dp_display_host_init(struct dp_display_private *dp, int reset)
 	if (dp->usbpd->orientation == ORIENTATION_CC2)
 		flip = true;
 
-	dp_display_set_encoder_mode(dp);
-
 	dp_power_init(dp->power, flip);
 	dp_ctrl_host_init(dp->ctrl, flip, reset);
 	dp_aux_init(dp->aux);
-- 
2.30.2


^ permalink raw reply related	[flat|nested] 13+ messages in thread

* [PATCH v3 6/7] drm/msm/dsi: stop calling set_encoder_mode callback
  2021-07-10 22:19 [PATCH v3 0/7] drm/msm/dpu: add support for independent DSI config Dmitry Baryshkov
                   ` (4 preceding siblings ...)
  2021-07-10 22:20 ` [PATCH v3 5/7] drm/msm/dp: stop calling set_encoder_mode callback Dmitry Baryshkov
@ 2021-07-10 22:20 ` Dmitry Baryshkov
  2021-07-10 22:20 ` [PATCH v3 7/7] drm/msm/kms: drop " Dmitry Baryshkov
  6 siblings, 0 replies; 13+ messages in thread
From: Dmitry Baryshkov @ 2021-07-10 22:20 UTC (permalink / raw)
  To: Bjorn Andersson, Rob Clark, Sean Paul, Abhinav Kumar
  Cc: Jonathan Marek, Stephen Boyd, David Airlie, Daniel Vetter,
	linux-arm-msm, dri-devel, freedreno

None of the display drivers now implement set_encoder_mode callback.
Stop calling it from the modeset init code.

Signed-off-by: Dmitry Baryshkov <dmitry.baryshkov@linaro.org>
Reviewed-by: Abhinav Kumar <abhinavk@codeaurora.org>
---
 drivers/gpu/drm/msm/dsi/dsi.c         |  2 --
 drivers/gpu/drm/msm/dsi/dsi.h         |  1 -
 drivers/gpu/drm/msm/dsi/dsi_manager.c | 12 ------------
 3 files changed, 15 deletions(-)

diff --git a/drivers/gpu/drm/msm/dsi/dsi.c b/drivers/gpu/drm/msm/dsi/dsi.c
index 5201d7eb0490..77c8dba297d8 100644
--- a/drivers/gpu/drm/msm/dsi/dsi.c
+++ b/drivers/gpu/drm/msm/dsi/dsi.c
@@ -251,8 +251,6 @@ int msm_dsi_modeset_init(struct msm_dsi *msm_dsi, struct drm_device *dev,
 		goto fail;
 	}
 
-	msm_dsi_manager_setup_encoder(msm_dsi->id);
-
 	priv->bridges[priv->num_bridges++]       = msm_dsi->bridge;
 	priv->connectors[priv->num_connectors++] = msm_dsi->connector;
 
diff --git a/drivers/gpu/drm/msm/dsi/dsi.h b/drivers/gpu/drm/msm/dsi/dsi.h
index 856a532850c0..e0c3c4409377 100644
--- a/drivers/gpu/drm/msm/dsi/dsi.h
+++ b/drivers/gpu/drm/msm/dsi/dsi.h
@@ -80,7 +80,6 @@ struct drm_connector *msm_dsi_manager_connector_init(u8 id);
 struct drm_connector *msm_dsi_manager_ext_bridge_init(u8 id);
 int msm_dsi_manager_cmd_xfer(int id, const struct mipi_dsi_msg *msg);
 bool msm_dsi_manager_cmd_xfer_trigger(int id, u32 dma_base, u32 len);
-void msm_dsi_manager_setup_encoder(int id);
 int msm_dsi_manager_register(struct msm_dsi *msm_dsi);
 void msm_dsi_manager_unregister(struct msm_dsi *msm_dsi);
 bool msm_dsi_manager_validate_current_config(u8 id);
diff --git a/drivers/gpu/drm/msm/dsi/dsi_manager.c b/drivers/gpu/drm/msm/dsi/dsi_manager.c
index 27d3b9ebf831..693078e68fd4 100644
--- a/drivers/gpu/drm/msm/dsi/dsi_manager.c
+++ b/drivers/gpu/drm/msm/dsi/dsi_manager.c
@@ -216,18 +216,6 @@ static int dsi_mgr_bridge_get_id(struct drm_bridge *bridge)
 	return dsi_bridge->id;
 }
 
-void msm_dsi_manager_setup_encoder(int id)
-{
-	struct msm_dsi *msm_dsi = dsi_mgr_get_dsi(id);
-	struct msm_drm_private *priv = msm_dsi->dev->dev_private;
-	struct msm_kms *kms = priv->kms;
-	struct drm_encoder *encoder = msm_dsi_get_encoder(msm_dsi);
-
-	if (encoder && kms->funcs->set_encoder_mode)
-		kms->funcs->set_encoder_mode(kms, encoder,
-					     msm_dsi_is_cmd_mode(msm_dsi));
-}
-
 static int msm_dsi_manager_panel_init(struct drm_connector *conn, u8 id)
 {
 	struct msm_drm_private *priv = conn->dev->dev_private;
-- 
2.30.2


^ permalink raw reply related	[flat|nested] 13+ messages in thread

* [PATCH v3 7/7] drm/msm/kms: drop set_encoder_mode callback
  2021-07-10 22:19 [PATCH v3 0/7] drm/msm/dpu: add support for independent DSI config Dmitry Baryshkov
                   ` (5 preceding siblings ...)
  2021-07-10 22:20 ` [PATCH v3 6/7] drm/msm/dsi: " Dmitry Baryshkov
@ 2021-07-10 22:20 ` Dmitry Baryshkov
  6 siblings, 0 replies; 13+ messages in thread
From: Dmitry Baryshkov @ 2021-07-10 22:20 UTC (permalink / raw)
  To: Bjorn Andersson, Rob Clark, Sean Paul, Abhinav Kumar
  Cc: Jonathan Marek, Stephen Boyd, David Airlie, Daniel Vetter,
	linux-arm-msm, dri-devel, freedreno

set_encoder_mode callback is completely unused now. Drop it from
msm_kms_func().

Signed-off-by: Dmitry Baryshkov <dmitry.baryshkov@linaro.org>
Reviewed-by: Abhinav Kumar <abhinavk@codeaurora.org>
---
 drivers/gpu/drm/msm/msm_kms.h | 3 ---
 1 file changed, 3 deletions(-)

diff --git a/drivers/gpu/drm/msm/msm_kms.h b/drivers/gpu/drm/msm/msm_kms.h
index 086a2d59b8c8..9484e8b62630 100644
--- a/drivers/gpu/drm/msm/msm_kms.h
+++ b/drivers/gpu/drm/msm/msm_kms.h
@@ -117,9 +117,6 @@ struct msm_kms_funcs {
 			struct drm_encoder *encoder,
 			struct drm_encoder *slave_encoder,
 			bool is_cmd_mode);
-	void (*set_encoder_mode)(struct msm_kms *kms,
-				 struct drm_encoder *encoder,
-				 bool cmd_mode);
 	/* cleanup: */
 	void (*destroy)(struct msm_kms *kms);
 
-- 
2.30.2


^ permalink raw reply related	[flat|nested] 13+ messages in thread

* Re: [PATCH v3 2/7] drm/msm/dsi: add three helper functions
  2021-07-10 22:20 ` [PATCH v3 2/7] drm/msm/dsi: add three helper functions Dmitry Baryshkov
@ 2021-07-11  4:21   ` kernel test robot
  2021-07-12 21:03   ` [Freedreno] " abhinavk
  1 sibling, 0 replies; 13+ messages in thread
From: kernel test robot @ 2021-07-11  4:21 UTC (permalink / raw)
  To: Dmitry Baryshkov, Bjorn Andersson, Rob Clark, Sean Paul, Abhinav Kumar
  Cc: clang-built-linux, kbuild-all, Jonathan Marek, Stephen Boyd,
	linux-arm-msm, dri-devel, David Airlie, freedreno

[-- Attachment #1: Type: text/plain, Size: 5435 bytes --]

Hi Dmitry,

Thank you for the patch! Yet something to improve:

[auto build test ERROR on linus/master]
[also build test ERROR on next-20210709]
[cannot apply to v5.13]
[If your patch is applied to the wrong git tree, kindly drop us a note.
And when submitting patch, we suggest to use '--base' as documented in
https://git-scm.com/docs/git-format-patch]

url:    https://github.com/0day-ci/linux/commits/Dmitry-Baryshkov/drm-msm-dpu-add-support-for-independent-DSI-config/20210711-062150
base:   https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git 1e16624d7b4376797ede36e3c955375cf0f23298
config: arm-randconfig-r016-20210711 (attached as .config)
compiler: clang version 13.0.0 (https://github.com/llvm/llvm-project 8d69635ed9ecf36fd0ca85906bfde17949671cbe)
reproduce (this is a W=1 build):
        wget https://raw.githubusercontent.com/intel/lkp-tests/master/sbin/make.cross -O ~/bin/make.cross
        chmod +x ~/bin/make.cross
        # install arm cross compiling tool for clang build
        # apt-get install binutils-arm-linux-gnueabi
        # https://github.com/0day-ci/linux/commit/d60158cc75b16689ac121290b562160916b57833
        git remote add linux-review https://github.com/0day-ci/linux
        git fetch --no-tags linux-review Dmitry-Baryshkov/drm-msm-dpu-add-support-for-independent-DSI-config/20210711-062150
        git checkout d60158cc75b16689ac121290b562160916b57833
        # save the attached .config to linux build tree
        mkdir build_dir
        COMPILER_INSTALL_PATH=$HOME/0day COMPILER=clang make.cross O=build_dir ARCH=arm SHELL=/bin/bash drivers/gpu/

If you fix the issue, kindly add following tag as appropriate
Reported-by: kernel test robot <lkp@intel.com>

All error/warnings (new ones prefixed by >>):

   In file included from drivers/gpu/drm/msm/adreno/adreno_device.c:9:
   In file included from drivers/gpu/drm/msm/adreno/adreno_gpu.h:15:
   In file included from drivers/gpu/drm/msm/msm_gpu.h:16:
>> drivers/gpu/drm/msm/msm_drv.h:382:14: error: expected ';' after return statement
           return false
                       ^
                       ;
>> drivers/gpu/drm/msm/msm_drv.h:380:6: warning: no previous prototype for function 'msm_dsi_is_master_dsi' [-Wmissing-prototypes]
   bool msm_dsi_is_master_dsi(struct msm_dsi *msm_dsi)
        ^
   drivers/gpu/drm/msm/msm_drv.h:380:1: note: declare 'static' if the function is not intended to be used outside of this translation unit
   bool msm_dsi_is_master_dsi(struct msm_dsi *msm_dsi)
   ^
   static 
   1 warning and 1 error generated.
--
   In file included from drivers/gpu/drm/msm/dp/dp_display.c:14:
>> drivers/gpu/drm/msm/msm_drv.h:382:14: error: expected ';' after return statement
           return false
                       ^
                       ;
>> drivers/gpu/drm/msm/msm_drv.h:380:6: warning: no previous prototype for function 'msm_dsi_is_master_dsi' [-Wmissing-prototypes]
   bool msm_dsi_is_master_dsi(struct msm_dsi *msm_dsi)
        ^
   drivers/gpu/drm/msm/msm_drv.h:380:1: note: declare 'static' if the function is not intended to be used outside of this translation unit
   bool msm_dsi_is_master_dsi(struct msm_dsi *msm_dsi)
   ^
   static 
   drivers/gpu/drm/msm/dp/dp_display.c:1017:21: warning: variable 'drm' set but not used [-Wunused-but-set-variable]
           struct drm_device *drm;
                              ^
   2 warnings and 1 error generated.

Kconfig warnings: (for reference only)
   WARNING: unmet direct dependencies detected for QCOM_SCM
   Depends on (ARM || ARM64) && HAVE_ARM_SMCCC
   Selected by
   - ARM_QCOM_SPM_CPUIDLE && CPU_IDLE && (ARM || ARM64) && (ARCH_QCOM || COMPILE_TEST && !ARM64 && MMU


vim +382 drivers/gpu/drm/msm/msm_drv.h

   339	
   340	struct msm_edp;
   341	void __init msm_edp_register(void);
   342	void __exit msm_edp_unregister(void);
   343	int msm_edp_modeset_init(struct msm_edp *edp, struct drm_device *dev,
   344			struct drm_encoder *encoder);
   345	
   346	struct msm_dsi;
   347	#ifdef CONFIG_DRM_MSM_DSI
   348	void __init msm_dsi_register(void);
   349	void __exit msm_dsi_unregister(void);
   350	int msm_dsi_modeset_init(struct msm_dsi *msm_dsi, struct drm_device *dev,
   351				 struct drm_encoder *encoder);
   352	void msm_dsi_snapshot(struct msm_disp_state *disp_state, struct msm_dsi *msm_dsi);
   353	bool msm_dsi_is_cmd_mode(struct msm_dsi *msm_dsi);
   354	bool msm_dsi_is_bonded_dsi(struct msm_dsi *msm_dsi);
   355	bool msm_dsi_is_master_dsi(struct msm_dsi *msm_dsi);
   356	#else
   357	static inline void __init msm_dsi_register(void)
   358	{
   359	}
   360	static inline void __exit msm_dsi_unregister(void)
   361	{
   362	}
   363	static inline int msm_dsi_modeset_init(struct msm_dsi *msm_dsi,
   364					       struct drm_device *dev,
   365					       struct drm_encoder *encoder)
   366	{
   367		return -EINVAL;
   368	}
   369	static inline void msm_dsi_snapshot(struct msm_disp_state *disp_state, struct msm_dsi *msm_dsi)
   370	{
   371	}
   372	static inline bool msm_dsi_is_cmd_mode(struct msm_dsi *msm_dsi)
   373	{
   374		return false;
   375	}
   376	static bool msm_dsi_is_bonded_dsi(struct msm_dsi *msm_dsi)
   377	{
   378		return false;
   379	}
 > 380	bool msm_dsi_is_master_dsi(struct msm_dsi *msm_dsi)
   381	{
 > 382		return false
   383	}
   384	#endif
   385	

---
0-DAY CI Kernel Test Service, Intel Corporation
https://lists.01.org/hyperkitty/list/kbuild-all@lists.01.org

[-- Attachment #2: .config.gz --]
[-- Type: application/gzip, Size: 42564 bytes --]

^ permalink raw reply	[flat|nested] 13+ messages in thread

* Re: [Freedreno] [PATCH v3 1/7] drm/msm/dsi: rename dual DSI to bonded DSI
  2021-07-10 22:19 ` [PATCH v3 1/7] drm/msm/dsi: rename dual DSI to bonded DSI Dmitry Baryshkov
@ 2021-07-12 21:02   ` abhinavk
  0 siblings, 0 replies; 13+ messages in thread
From: abhinavk @ 2021-07-12 21:02 UTC (permalink / raw)
  To: Dmitry Baryshkov
  Cc: Bjorn Andersson, Rob Clark, Sean Paul, Jonathan Marek,
	Stephen Boyd, linux-arm-msm, dri-devel, David Airlie,
	Daniel Vetter, freedreno

On 2021-07-10 15:19, Dmitry Baryshkov wrote:
> We are preparing to support two independent DSI hosts in the DSI/DPU
> code. To remove possible confusion (as both configurations can be
> referenced as dual DSI) let's rename old "dual DSI" (two DSI hosts
> driving single device, with clocks being locked) to "bonded DSI".
> 
> Signed-off-by: Dmitry Baryshkov <dmitry.baryshkov@linaro.org>
Reviewed-by: Abhinav Kumar <abhinavk@codeaurora.org>
> ---
>  drivers/gpu/drm/msm/disp/mdp5/mdp5_ctl.c   |   2 +-
>  drivers/gpu/drm/msm/dsi/dsi.h              |   8 +-
>  drivers/gpu/drm/msm/dsi/dsi_cfg.h          |   2 +-
>  drivers/gpu/drm/msm/dsi/dsi_host.c         |  34 +++----
>  drivers/gpu/drm/msm/dsi/dsi_manager.c      | 101 ++++++++++-----------
>  drivers/gpu/drm/msm/dsi/phy/dsi_phy_10nm.c |   2 +-
>  drivers/gpu/drm/msm/dsi/phy/dsi_phy_14nm.c |   6 +-
>  drivers/gpu/drm/msm/dsi/phy/dsi_phy_7nm.c  |   2 +-
>  8 files changed, 78 insertions(+), 79 deletions(-)
> 
> diff --git a/drivers/gpu/drm/msm/disp/mdp5/mdp5_ctl.c
> b/drivers/gpu/drm/msm/disp/mdp5/mdp5_ctl.c
> index 81b0c7cf954e..1220f2b20e05 100644
> --- a/drivers/gpu/drm/msm/disp/mdp5/mdp5_ctl.c
> +++ b/drivers/gpu/drm/msm/disp/mdp5/mdp5_ctl.c
> @@ -737,7 +737,7 @@ struct mdp5_ctl_manager *mdp5_ctlm_init(struct
> drm_device *dev,
>  	}
> 
>  	/*
> -	 * In Dual DSI case, CTL0 and CTL1 are always assigned to two DSI
> +	 * In bonded DSI case, CTL0 and CTL1 are always assigned to two DSI
>  	 * interfaces to support single FLUSH feature (Flush CTL0 and CTL1 
> when
>  	 * only write into CTL0's FLUSH register) to keep two DSI pipes in 
> sync.
>  	 * Single FLUSH is supported from hw rev v3.0.
> diff --git a/drivers/gpu/drm/msm/dsi/dsi.h 
> b/drivers/gpu/drm/msm/dsi/dsi.h
> index 9b8e9b07eced..856a532850c0 100644
> --- a/drivers/gpu/drm/msm/dsi/dsi.h
> +++ b/drivers/gpu/drm/msm/dsi/dsi.h
> @@ -109,7 +109,7 @@ int msm_dsi_host_enable(struct mipi_dsi_host 
> *host);
>  int msm_dsi_host_disable(struct mipi_dsi_host *host);
>  int msm_dsi_host_power_on(struct mipi_dsi_host *host,
>  			struct msm_dsi_phy_shared_timings *phy_shared_timings,
> -			bool is_dual_dsi);
> +			bool is_bonded_dsi);
>  int msm_dsi_host_power_off(struct mipi_dsi_host *host);
>  int msm_dsi_host_set_display_mode(struct mipi_dsi_host *host,
>  				  const struct drm_display_mode *mode);
> @@ -123,7 +123,7 @@ int msm_dsi_host_set_src_pll(struct mipi_dsi_host 
> *host,
>  void msm_dsi_host_reset_phy(struct mipi_dsi_host *host);
>  void msm_dsi_host_get_phy_clk_req(struct mipi_dsi_host *host,
>  	struct msm_dsi_phy_clk_request *clk_req,
> -	bool is_dual_dsi);
> +	bool is_bonded_dsi);
>  void msm_dsi_host_destroy(struct mipi_dsi_host *host);
>  int msm_dsi_host_modeset_init(struct mipi_dsi_host *host,
>  					struct drm_device *dev);
> @@ -145,8 +145,8 @@ int dsi_dma_base_get_6g(struct msm_dsi_host
> *msm_host, uint64_t *iova);
>  int dsi_dma_base_get_v2(struct msm_dsi_host *msm_host, uint64_t 
> *iova);
>  int dsi_clk_init_v2(struct msm_dsi_host *msm_host);
>  int dsi_clk_init_6g_v2(struct msm_dsi_host *msm_host);
> -int dsi_calc_clk_rate_v2(struct msm_dsi_host *msm_host, bool 
> is_dual_dsi);
> -int dsi_calc_clk_rate_6g(struct msm_dsi_host *msm_host, bool 
> is_dual_dsi);
> +int dsi_calc_clk_rate_v2(struct msm_dsi_host *msm_host, bool 
> is_bonded_dsi);
> +int dsi_calc_clk_rate_6g(struct msm_dsi_host *msm_host, bool 
> is_bonded_dsi);
>  void msm_dsi_host_snapshot(struct msm_disp_state *disp_state, struct
> mipi_dsi_host *host);
>  /* dsi phy */
>  struct msm_dsi_phy;
> diff --git a/drivers/gpu/drm/msm/dsi/dsi_cfg.h
> b/drivers/gpu/drm/msm/dsi/dsi_cfg.h
> index ade9b609c7d9..2bce00d5a9fc 100644
> --- a/drivers/gpu/drm/msm/dsi/dsi_cfg.h
> +++ b/drivers/gpu/drm/msm/dsi/dsi_cfg.h
> @@ -47,7 +47,7 @@ struct msm_dsi_host_cfg_ops {
>  	void* (*tx_buf_get)(struct msm_dsi_host *msm_host);
>  	void (*tx_buf_put)(struct msm_dsi_host *msm_host);
>  	int (*dma_base_get)(struct msm_dsi_host *msm_host, uint64_t *iova);
> -	int (*calc_clk_rate)(struct msm_dsi_host *msm_host, bool 
> is_dual_dsi);
> +	int (*calc_clk_rate)(struct msm_dsi_host *msm_host, bool 
> is_bonded_dsi);
>  };
> 
>  struct msm_dsi_cfg_handler {
> diff --git a/drivers/gpu/drm/msm/dsi/dsi_host.c
> b/drivers/gpu/drm/msm/dsi/dsi_host.c
> index ed504fe5074f..706634d766ee 100644
> --- a/drivers/gpu/drm/msm/dsi/dsi_host.c
> +++ b/drivers/gpu/drm/msm/dsi/dsi_host.c
> @@ -679,7 +679,7 @@ void dsi_link_clk_disable_v2(struct msm_dsi_host 
> *msm_host)
>  	clk_disable_unprepare(msm_host->byte_clk);
>  }
> 
> -static u32 dsi_get_pclk_rate(struct msm_dsi_host *msm_host, bool 
> is_dual_dsi)
> +static u32 dsi_get_pclk_rate(struct msm_dsi_host *msm_host, bool 
> is_bonded_dsi)
>  {
>  	struct drm_display_mode *mode = msm_host->mode;
>  	u32 pclk_rate;
> @@ -687,22 +687,22 @@ static u32 dsi_get_pclk_rate(struct msm_dsi_host
> *msm_host, bool is_dual_dsi)
>  	pclk_rate = mode->clock * 1000;
> 
>  	/*
> -	 * For dual DSI mode, the current DRM mode has the complete width of 
> the
> +	 * For bonded DSI mode, the current DRM mode has the complete width 
> of the
>  	 * panel. Since, the complete panel is driven by two DSI controllers,
>  	 * the clock rates have to be split between the two dsi controllers.
>  	 * Adjust the byte and pixel clock rates for each dsi host 
> accordingly.
>  	 */
> -	if (is_dual_dsi)
> +	if (is_bonded_dsi)
>  		pclk_rate /= 2;
> 
>  	return pclk_rate;
>  }
> 
> -static void dsi_calc_pclk(struct msm_dsi_host *msm_host, bool 
> is_dual_dsi)
> +static void dsi_calc_pclk(struct msm_dsi_host *msm_host, bool 
> is_bonded_dsi)
>  {
>  	u8 lanes = msm_host->lanes;
>  	u32 bpp = dsi_get_bpp(msm_host->format);
> -	u32 pclk_rate = dsi_get_pclk_rate(msm_host, is_dual_dsi);
> +	u32 pclk_rate = dsi_get_pclk_rate(msm_host, is_bonded_dsi);
>  	u64 pclk_bpp = (u64)pclk_rate * bpp;
> 
>  	if (lanes == 0) {
> @@ -720,28 +720,28 @@ static void dsi_calc_pclk(struct msm_dsi_host
> *msm_host, bool is_dual_dsi)
> 
>  }
> 
> -int dsi_calc_clk_rate_6g(struct msm_dsi_host *msm_host, bool 
> is_dual_dsi)
> +int dsi_calc_clk_rate_6g(struct msm_dsi_host *msm_host, bool 
> is_bonded_dsi)
>  {
>  	if (!msm_host->mode) {
>  		pr_err("%s: mode not set\n", __func__);
>  		return -EINVAL;
>  	}
> 
> -	dsi_calc_pclk(msm_host, is_dual_dsi);
> +	dsi_calc_pclk(msm_host, is_bonded_dsi);
>  	msm_host->esc_clk_rate = clk_get_rate(msm_host->esc_clk);
>  	return 0;
>  }
> 
> -int dsi_calc_clk_rate_v2(struct msm_dsi_host *msm_host, bool 
> is_dual_dsi)
> +int dsi_calc_clk_rate_v2(struct msm_dsi_host *msm_host, bool 
> is_bonded_dsi)
>  {
>  	u32 bpp = dsi_get_bpp(msm_host->format);
>  	u64 pclk_bpp;
>  	unsigned int esc_mhz, esc_div;
>  	unsigned long byte_mhz;
> 
> -	dsi_calc_pclk(msm_host, is_dual_dsi);
> +	dsi_calc_pclk(msm_host, is_bonded_dsi);
> 
> -	pclk_bpp = (u64)dsi_get_pclk_rate(msm_host, is_dual_dsi) * bpp;
> +	pclk_bpp = (u64)dsi_get_pclk_rate(msm_host, is_bonded_dsi) * bpp;
>  	do_div(pclk_bpp, 8);
>  	msm_host->src_clk_rate = pclk_bpp;
> 
> @@ -938,7 +938,7 @@ static void dsi_ctrl_config(struct msm_dsi_host
> *msm_host, bool enable,
>  	dsi_write(msm_host, REG_DSI_CTRL, data);
>  }
> 
> -static void dsi_timing_setup(struct msm_dsi_host *msm_host, bool 
> is_dual_dsi)
> +static void dsi_timing_setup(struct msm_dsi_host *msm_host, bool 
> is_bonded_dsi)
>  {
>  	struct drm_display_mode *mode = msm_host->mode;
>  	u32 hs_start = 0, vs_start = 0; /* take sync start as 0 */
> @@ -956,13 +956,13 @@ static void dsi_timing_setup(struct msm_dsi_host
> *msm_host, bool is_dual_dsi)
>  	DBG("");
> 
>  	/*
> -	 * For dual DSI mode, the current DRM mode has
> +	 * For bonded DSI mode, the current DRM mode has
>  	 * the complete width of the panel. Since, the complete
>  	 * panel is driven by two DSI controllers, the horizontal
>  	 * timings have to be split between the two dsi controllers.
>  	 * Adjust the DSI host timing values accordingly.
>  	 */
> -	if (is_dual_dsi) {
> +	if (is_bonded_dsi) {
>  		h_total /= 2;
>  		hs_end /= 2;
>  		ha_start /= 2;
> @@ -2285,13 +2285,13 @@ void msm_dsi_host_reset_phy(struct 
> mipi_dsi_host *host)
> 
>  void msm_dsi_host_get_phy_clk_req(struct mipi_dsi_host *host,
>  			struct msm_dsi_phy_clk_request *clk_req,
> -			bool is_dual_dsi)
> +			bool is_bonded_dsi)
>  {
>  	struct msm_dsi_host *msm_host = to_msm_dsi_host(host);
>  	const struct msm_dsi_cfg_handler *cfg_hnd = msm_host->cfg_hnd;
>  	int ret;
> 
> -	ret = cfg_hnd->ops->calc_clk_rate(msm_host, is_dual_dsi);
> +	ret = cfg_hnd->ops->calc_clk_rate(msm_host, is_bonded_dsi);
>  	if (ret) {
>  		pr_err("%s: unable to calc clk rate, %d\n", __func__, ret);
>  		return;
> @@ -2354,7 +2354,7 @@ static void msm_dsi_sfpb_config(struct
> msm_dsi_host *msm_host, bool enable)
> 
>  int msm_dsi_host_power_on(struct mipi_dsi_host *host,
>  			struct msm_dsi_phy_shared_timings *phy_shared_timings,
> -			bool is_dual_dsi)
> +			bool is_bonded_dsi)
>  {
>  	struct msm_dsi_host *msm_host = to_msm_dsi_host(host);
>  	const struct msm_dsi_cfg_handler *cfg_hnd = msm_host->cfg_hnd;
> @@ -2392,7 +2392,7 @@ int msm_dsi_host_power_on(struct mipi_dsi_host 
> *host,
>  		goto fail_disable_clk;
>  	}
> 
> -	dsi_timing_setup(msm_host, is_dual_dsi);
> +	dsi_timing_setup(msm_host, is_bonded_dsi);
>  	dsi_sw_reset(msm_host);
>  	dsi_ctrl_config(msm_host, true, phy_shared_timings);
> 
> diff --git a/drivers/gpu/drm/msm/dsi/dsi_manager.c
> b/drivers/gpu/drm/msm/dsi/dsi_manager.c
> index 4ebfedc4a9ac..b20645ab279b 100644
> --- a/drivers/gpu/drm/msm/dsi/dsi_manager.c
> +++ b/drivers/gpu/drm/msm/dsi/dsi_manager.c
> @@ -21,14 +21,14 @@
>  struct msm_dsi_manager {
>  	struct msm_dsi *dsi[DSI_MAX];
> 
> -	bool is_dual_dsi;
> +	bool is_bonded_dsi;
>  	bool is_sync_needed;
>  	int master_dsi_link_id;
>  };
> 
>  static struct msm_dsi_manager msm_dsim_glb;
> 
> -#define IS_DUAL_DSI()		(msm_dsim_glb.is_dual_dsi)
> +#define IS_BONDED_DSI()		(msm_dsim_glb.is_bonded_dsi)
>  #define IS_SYNC_NEEDED()	(msm_dsim_glb.is_sync_needed)
>  #define IS_MASTER_DSI_LINK(id)	(msm_dsim_glb.master_dsi_link_id == id)
> 
> @@ -42,18 +42,17 @@ static inline struct msm_dsi 
> *dsi_mgr_get_other_dsi(int id)
>  	return msm_dsim_glb.dsi[(id + 1) % DSI_MAX];
>  }
> 
> -static int dsi_mgr_parse_dual_dsi(struct device_node *np, int id)
> +static int dsi_mgr_parse_of(struct device_node *np, int id)
>  {
>  	struct msm_dsi_manager *msm_dsim = &msm_dsim_glb;
> 
> -	/* We assume 2 dsi nodes have the same information of dual-dsi and
> -	 * sync-mode, and only one node specifies master in case of dual 
> mode.
> +	/* We assume 2 dsi nodes have the same information of bonded dsi and
> +	 * sync-mode, and only one node specifies master in case of bonded 
> mode.
>  	 */
> -	if (!msm_dsim->is_dual_dsi)
> -		msm_dsim->is_dual_dsi = of_property_read_bool(
> -						np, "qcom,dual-dsi-mode");
> +	if (!msm_dsim->is_bonded_dsi)
> +		msm_dsim->is_bonded_dsi = of_property_read_bool(np, 
> "qcom,dual-dsi-mode");
> 
> -	if (msm_dsim->is_dual_dsi) {
> +	if (msm_dsim->is_bonded_dsi) {
>  		if (of_property_read_bool(np, "qcom,master-dsi"))
>  			msm_dsim->master_dsi_link_id = id;
>  		if (!msm_dsim->is_sync_needed)
> @@ -72,7 +71,7 @@ static int dsi_mgr_setup_components(int id)
>  	struct msm_dsi *clk_slave_dsi = dsi_mgr_get_dsi(DSI_CLOCK_SLAVE);
>  	int ret;
> 
> -	if (!IS_DUAL_DSI()) {
> +	if (!IS_BONDED_DSI()) {
>  		ret = msm_dsi_host_register(msm_dsi->host, true);
>  		if (ret)
>  			return ret;
> @@ -100,7 +99,7 @@ static int dsi_mgr_setup_components(int id)
>  		if (ret)
>  			return ret;
> 
> -		/* PLL0 is to drive both 2 DSI link clocks in Dual DSI mode. */
> +		/* PLL0 is to drive both 2 DSI link clocks in bonded DSI mode. */
>  		msm_dsi_phy_set_usecase(clk_master_dsi->phy,
>  					MSM_DSI_PHY_MASTER);
>  		msm_dsi_phy_set_usecase(clk_slave_dsi->phy,
> @@ -119,9 +118,9 @@ static int enable_phy(struct msm_dsi *msm_dsi,
>  {
>  	struct msm_dsi_phy_clk_request clk_req;
>  	int ret;
> -	bool is_dual_dsi = IS_DUAL_DSI();
> +	bool is_bonded_dsi = IS_BONDED_DSI();
> 
> -	msm_dsi_host_get_phy_clk_req(msm_dsi->host, &clk_req, is_dual_dsi);
> +	msm_dsi_host_get_phy_clk_req(msm_dsi->host, &clk_req, is_bonded_dsi);
> 
>  	ret = msm_dsi_phy_enable(msm_dsi->phy, &clk_req);
>  	msm_dsi_phy_get_shared_timings(msm_dsi->phy, shared_timings);
> @@ -138,12 +137,12 @@ dsi_mgr_phy_enable(int id,
>  	struct msm_dsi *sdsi = dsi_mgr_get_dsi(DSI_CLOCK_SLAVE);
>  	int ret;
> 
> -	/* In case of dual DSI, some registers in PHY1 have been programmed
> +	/* In case of bonded DSI, some registers in PHY1 have been programmed
>  	 * during PLL0 clock's set_rate. The PHY1 reset called by host1 here
>  	 * will silently reset those PHY1 registers. Therefore we need to 
> reset
>  	 * and enable both PHYs before any PLL clock operation.
>  	 */
> -	if (IS_DUAL_DSI() && mdsi && sdsi) {
> +	if (IS_BONDED_DSI() && mdsi && sdsi) {
>  		if (!mdsi->phy_enabled && !sdsi->phy_enabled) {
>  			msm_dsi_host_reset_phy(mdsi->host);
>  			msm_dsi_host_reset_phy(sdsi->host);
> @@ -178,11 +177,11 @@ static void dsi_mgr_phy_disable(int id)
>  	struct msm_dsi *sdsi = dsi_mgr_get_dsi(DSI_CLOCK_SLAVE);
> 
>  	/* disable DSI phy
> -	 * In dual-dsi configuration, the phy should be disabled for the
> +	 * In bonded dsi configuration, the phy should be disabled for the
>  	 * first controller only when the second controller is disabled.
>  	 */
>  	msm_dsi->phy_enabled = false;
> -	if (IS_DUAL_DSI() && mdsi && sdsi) {
> +	if (IS_BONDED_DSI() && mdsi && sdsi) {
>  		if (!mdsi->phy_enabled && !sdsi->phy_enabled) {
>  			msm_dsi_phy_disable(sdsi->phy);
>  			msm_dsi_phy_disable(mdsi->phy);
> @@ -244,7 +243,7 @@ static int msm_dsi_manager_panel_init(struct
> drm_connector *conn, u8 id)
>  	struct msm_dsi *master_dsi, *slave_dsi;
>  	struct drm_panel *panel;
> 
> -	if (IS_DUAL_DSI() && !IS_MASTER_DSI_LINK(id)) {
> +	if (IS_BONDED_DSI() && !IS_MASTER_DSI_LINK(id)) {
>  		master_dsi = other_dsi;
>  		slave_dsi = msm_dsi;
>  	} else {
> @@ -253,7 +252,7 @@ static int msm_dsi_manager_panel_init(struct
> drm_connector *conn, u8 id)
>  	}
> 
>  	/*
> -	 * There is only 1 panel in the global panel list for dual DSI mode.
> +	 * There is only 1 panel in the global panel list for bonded DSI 
> mode.
>  	 * Therefore slave dsi should get the drm_panel instance from master
>  	 * dsi.
>  	 */
> @@ -264,14 +263,14 @@ static int msm_dsi_manager_panel_init(struct
> drm_connector *conn, u8 id)
>  		return PTR_ERR(panel);
>  	}
> 
> -	if (!panel || !IS_DUAL_DSI())
> +	if (!panel || !IS_BONDED_DSI())
>  		goto out;
> 
>  	drm_object_attach_property(&conn->base,
>  				   conn->dev->mode_config.tile_property, 0);
> 
>  	/*
> -	 * Set split display info to kms once dual DSI panel is connected to
> +	 * Set split display info to kms once bonded DSI panel is connected 
> to
>  	 * both hosts.
>  	 */
>  	if (other_dsi && other_dsi->panel && kms->funcs->set_split_display) {
> @@ -317,7 +316,7 @@ static int dsi_mgr_connector_get_modes(struct
> drm_connector *connector)
>  		return 0;
> 
>  	/*
> -	 * In dual DSI mode, we have one connector that can be
> +	 * In bonded DSI mode, we have one connector that can be
>  	 * attached to the drm_panel.
>  	 */
>  	num = drm_panel_get_modes(panel, connector);
> @@ -366,30 +365,30 @@ static void dsi_mgr_bridge_pre_enable(struct
> drm_bridge *bridge)
>  	struct mipi_dsi_host *host = msm_dsi->host;
>  	struct drm_panel *panel = msm_dsi->panel;
>  	struct msm_dsi_phy_shared_timings phy_shared_timings[DSI_MAX];
> -	bool is_dual_dsi = IS_DUAL_DSI();
> +	bool is_bonded_dsi = IS_BONDED_DSI();
>  	int ret;
> 
>  	DBG("id=%d", id);
>  	if (!msm_dsi_device_connected(msm_dsi))
>  		return;
> 
> -	/* Do nothing with the host if it is slave-DSI in case of dual DSI */
> -	if (is_dual_dsi && !IS_MASTER_DSI_LINK(id))
> +	/* Do nothing with the host if it is slave-DSI in case of bonded DSI 
> */
> +	if (is_bonded_dsi && !IS_MASTER_DSI_LINK(id))
>  		return;
> 
>  	ret = dsi_mgr_phy_enable(id, phy_shared_timings);
>  	if (ret)
>  		goto phy_en_fail;
> 
> -	ret = msm_dsi_host_power_on(host, &phy_shared_timings[id], 
> is_dual_dsi);
> +	ret = msm_dsi_host_power_on(host, &phy_shared_timings[id], 
> is_bonded_dsi);
>  	if (ret) {
>  		pr_err("%s: power on host %d failed, %d\n", __func__, id, ret);
>  		goto host_on_fail;
>  	}
> 
> -	if (is_dual_dsi && msm_dsi1) {
> +	if (is_bonded_dsi && msm_dsi1) {
>  		ret = msm_dsi_host_power_on(msm_dsi1->host,
> -				&phy_shared_timings[DSI_1], is_dual_dsi);
> +				&phy_shared_timings[DSI_1], is_bonded_dsi);
>  		if (ret) {
>  			pr_err("%s: power on host1 failed, %d\n",
>  							__func__, ret);
> @@ -415,7 +414,7 @@ static void dsi_mgr_bridge_pre_enable(struct
> drm_bridge *bridge)
>  		goto host_en_fail;
>  	}
> 
> -	if (is_dual_dsi && msm_dsi1) {
> +	if (is_bonded_dsi && msm_dsi1) {
>  		ret = msm_dsi_host_enable(msm_dsi1->host);
>  		if (ret) {
>  			pr_err("%s: enable host1 failed, %d\n", __func__, ret);
> @@ -431,7 +430,7 @@ static void dsi_mgr_bridge_pre_enable(struct
> drm_bridge *bridge)
>  	if (panel)
>  		drm_panel_unprepare(panel);
>  panel_prep_fail:
> -	if (is_dual_dsi && msm_dsi1)
> +	if (is_bonded_dsi && msm_dsi1)
>  		msm_dsi_host_power_off(msm_dsi1->host);
>  host1_on_fail:
>  	msm_dsi_host_power_off(host);
> @@ -446,15 +445,15 @@ static void dsi_mgr_bridge_enable(struct
> drm_bridge *bridge)
>  	int id = dsi_mgr_bridge_get_id(bridge);
>  	struct msm_dsi *msm_dsi = dsi_mgr_get_dsi(id);
>  	struct drm_panel *panel = msm_dsi->panel;
> -	bool is_dual_dsi = IS_DUAL_DSI();
> +	bool is_bonded_dsi = IS_BONDED_DSI();
>  	int ret;
> 
>  	DBG("id=%d", id);
>  	if (!msm_dsi_device_connected(msm_dsi))
>  		return;
> 
> -	/* Do nothing with the host if it is slave-DSI in case of dual DSI */
> -	if (is_dual_dsi && !IS_MASTER_DSI_LINK(id))
> +	/* Do nothing with the host if it is slave-DSI in case of bonded DSI 
> */
> +	if (is_bonded_dsi && !IS_MASTER_DSI_LINK(id))
>  		return;
> 
>  	if (panel) {
> @@ -471,15 +470,15 @@ static void dsi_mgr_bridge_disable(struct
> drm_bridge *bridge)
>  	int id = dsi_mgr_bridge_get_id(bridge);
>  	struct msm_dsi *msm_dsi = dsi_mgr_get_dsi(id);
>  	struct drm_panel *panel = msm_dsi->panel;
> -	bool is_dual_dsi = IS_DUAL_DSI();
> +	bool is_bonded_dsi = IS_BONDED_DSI();
>  	int ret;
> 
>  	DBG("id=%d", id);
>  	if (!msm_dsi_device_connected(msm_dsi))
>  		return;
> 
> -	/* Do nothing with the host if it is slave-DSI in case of dual DSI */
> -	if (is_dual_dsi && !IS_MASTER_DSI_LINK(id))
> +	/* Do nothing with the host if it is slave-DSI in case of bonded DSI 
> */
> +	if (is_bonded_dsi && !IS_MASTER_DSI_LINK(id))
>  		return;
> 
>  	if (panel) {
> @@ -497,7 +496,7 @@ static void dsi_mgr_bridge_post_disable(struct
> drm_bridge *bridge)
>  	struct msm_dsi *msm_dsi1 = dsi_mgr_get_dsi(DSI_1);
>  	struct mipi_dsi_host *host = msm_dsi->host;
>  	struct drm_panel *panel = msm_dsi->panel;
> -	bool is_dual_dsi = IS_DUAL_DSI();
> +	bool is_bonded_dsi = IS_BONDED_DSI();
>  	int ret;
> 
>  	DBG("id=%d", id);
> @@ -506,18 +505,18 @@ static void dsi_mgr_bridge_post_disable(struct
> drm_bridge *bridge)
>  		return;
> 
>  	/*
> -	 * Do nothing with the host if it is slave-DSI in case of dual DSI.
> +	 * Do nothing with the host if it is slave-DSI in case of bonded DSI.
>  	 * It is safe to call dsi_mgr_phy_disable() here because a single PHY
>  	 * won't be diabled until both PHYs request disable.
>  	 */
> -	if (is_dual_dsi && !IS_MASTER_DSI_LINK(id))
> +	if (is_bonded_dsi && !IS_MASTER_DSI_LINK(id))
>  		goto disable_phy;
> 
>  	ret = msm_dsi_host_disable(host);
>  	if (ret)
>  		pr_err("%s: host %d disable failed, %d\n", __func__, id, ret);
> 
> -	if (is_dual_dsi && msm_dsi1) {
> +	if (is_bonded_dsi && msm_dsi1) {
>  		ret = msm_dsi_host_disable(msm_dsi1->host);
>  		if (ret)
>  			pr_err("%s: host1 disable failed, %d\n", __func__, ret);
> @@ -537,7 +536,7 @@ static void dsi_mgr_bridge_post_disable(struct
> drm_bridge *bridge)
>  	if (ret)
>  		pr_err("%s: host %d power off failed,%d\n", __func__, id, ret);
> 
> -	if (is_dual_dsi && msm_dsi1) {
> +	if (is_bonded_dsi && msm_dsi1) {
>  		ret = msm_dsi_host_power_off(msm_dsi1->host);
>  		if (ret)
>  			pr_err("%s: host1 power off failed, %d\n",
> @@ -556,15 +555,15 @@ static void dsi_mgr_bridge_mode_set(struct
> drm_bridge *bridge,
>  	struct msm_dsi *msm_dsi = dsi_mgr_get_dsi(id);
>  	struct msm_dsi *other_dsi = dsi_mgr_get_other_dsi(id);
>  	struct mipi_dsi_host *host = msm_dsi->host;
> -	bool is_dual_dsi = IS_DUAL_DSI();
> +	bool is_bonded_dsi = IS_BONDED_DSI();
> 
>  	DBG("set mode: " DRM_MODE_FMT, DRM_MODE_ARG(mode));
> 
> -	if (is_dual_dsi && !IS_MASTER_DSI_LINK(id))
> +	if (is_bonded_dsi && !IS_MASTER_DSI_LINK(id))
>  		return;
> 
>  	msm_dsi_host_set_display_mode(host, adjusted_mode);
> -	if (is_dual_dsi && other_dsi)
> +	if (is_bonded_dsi && other_dsi)
>  		msm_dsi_host_set_display_mode(other_dsi->host, adjusted_mode);
>  }
> 
> @@ -640,15 +639,15 @@ struct drm_connector
> *msm_dsi_manager_connector_init(u8 id)
> 
>  bool msm_dsi_manager_validate_current_config(u8 id)
>  {
> -	bool is_dual_dsi = IS_DUAL_DSI();
> +	bool is_bonded_dsi = IS_BONDED_DSI();
> 
>  	/*
> -	 * For dual DSI, we only have one drm panel. For this
> +	 * For bonded DSI, we only have one drm panel. For this
>  	 * use case, we register only one bridge/connector.
>  	 * Skip bridge/connector initialisation if it is
> -	 * slave-DSI for dual DSI configuration.
> +	 * slave-DSI for bonded DSI configuration.
>  	 */
> -	if (is_dual_dsi && !IS_MASTER_DSI_LINK(id)) {
> +	if (is_bonded_dsi && !IS_MASTER_DSI_LINK(id)) {
>  		DBG("Skip bridge registration for slave DSI->id: %d\n", id);
>  		return false;
>  	}
> @@ -740,7 +739,7 @@ int msm_dsi_manager_cmd_xfer(int id, const struct
> mipi_dsi_msg *msg)
>  	if (!msg->tx_buf || !msg->tx_len)
>  		return 0;
> 
> -	/* In dual master case, panel requires the same commands sent to
> +	/* In bonded master case, panel requires the same commands sent to
>  	 * both DSI links. Host issues the command trigger to both links
>  	 * when DSI_1 calls the cmd transfer function, no matter it happens
>  	 * before or after DSI_0 cmd transfer.
> @@ -809,9 +808,9 @@ int msm_dsi_manager_register(struct msm_dsi 
> *msm_dsi)
> 
>  	msm_dsim->dsi[id] = msm_dsi;
> 
> -	ret = dsi_mgr_parse_dual_dsi(msm_dsi->pdev->dev.of_node, id);
> +	ret = dsi_mgr_parse_of(msm_dsi->pdev->dev.of_node, id);
>  	if (ret) {
> -		pr_err("%s: failed to parse dual DSI info\n", __func__);
> +		pr_err("%s: failed to parse OF DSI info\n", __func__);
>  		goto fail;
>  	}
> 
> diff --git a/drivers/gpu/drm/msm/dsi/phy/dsi_phy_10nm.c
> b/drivers/gpu/drm/msm/dsi/phy/dsi_phy_10nm.c
> index e46b10fc793a..d8128f50b0dd 100644
> --- a/drivers/gpu/drm/msm/dsi/phy/dsi_phy_10nm.c
> +++ b/drivers/gpu/drm/msm/dsi/phy/dsi_phy_10nm.c
> @@ -84,7 +84,7 @@ struct dsi_pll_10nm {
>  #define to_pll_10nm(x)	container_of(x, struct dsi_pll_10nm, clk_hw)
> 
>  /*
> - * Global list of private DSI PLL struct pointers. We need this for 
> Dual DSI
> + * Global list of private DSI PLL struct pointers. We need this for 
> bonded DSI
>   * mode, where the master PLL's clk_ops needs access the slave's 
> private data
>   */
>  static struct dsi_pll_10nm *pll_10nm_list[DSI_MAX];
> diff --git a/drivers/gpu/drm/msm/dsi/phy/dsi_phy_14nm.c
> b/drivers/gpu/drm/msm/dsi/phy/dsi_phy_14nm.c
> index a34cf151c517..e7f857ad02a3 100644
> --- a/drivers/gpu/drm/msm/dsi/phy/dsi_phy_14nm.c
> +++ b/drivers/gpu/drm/msm/dsi/phy/dsi_phy_14nm.c
> @@ -86,7 +86,7 @@ struct dsi_pll_14nm {
>  /*
>   * Private struct for N1/N2 post-divider clocks. These clocks are 
> similar to
>   * the generic clk_divider class of clocks. The only difference is 
> that it
> - * also sets the slave DSI PLL's post-dividers if in Dual DSI mode
> + * also sets the slave DSI PLL's post-dividers if in bonded DSI mode
>   */
>  struct dsi_pll_14nm_postdiv {
>  	struct clk_hw hw;
> @@ -102,7 +102,7 @@ struct dsi_pll_14nm_postdiv {
>  #define to_pll_14nm_postdiv(_hw) container_of(_hw, struct
> dsi_pll_14nm_postdiv, hw)
> 
>  /*
> - * Global list of private DSI PLL struct pointers. We need this for 
> Dual DSI
> + * Global list of private DSI PLL struct pointers. We need this for 
> bonded DSI
>   * mode, where the master PLL's clk_ops needs access the slave's 
> private data
>   */
>  static struct dsi_pll_14nm *pll_14nm_list[DSI_MAX];
> @@ -658,7 +658,7 @@ static int dsi_pll_14nm_postdiv_set_rate(struct
> clk_hw *hw, unsigned long rate,
>  	val |= value << shift;
>  	dsi_phy_write(base + REG_DSI_14nm_PHY_CMN_CLK_CFG0, val);
> 
> -	/* If we're master in dual DSI mode, then the slave PLL's 
> post-dividers
> +	/* If we're master in bonded DSI mode, then the slave PLL's 
> post-dividers
>  	 * follow the master's post dividers
>  	 */
>  	if (pll_14nm->phy->usecase == MSM_DSI_PHY_MASTER) {
> diff --git a/drivers/gpu/drm/msm/dsi/phy/dsi_phy_7nm.c
> b/drivers/gpu/drm/msm/dsi/phy/dsi_phy_7nm.c
> index 7c23d4c47338..ab26b530fbcf 100644
> --- a/drivers/gpu/drm/msm/dsi/phy/dsi_phy_7nm.c
> +++ b/drivers/gpu/drm/msm/dsi/phy/dsi_phy_7nm.c
> @@ -83,7 +83,7 @@ struct dsi_pll_7nm {
>  #define to_pll_7nm(x)	container_of(x, struct dsi_pll_7nm, clk_hw)
> 
>  /*
> - * Global list of private DSI PLL struct pointers. We need this for 
> Dual DSI
> + * Global list of private DSI PLL struct pointers. We need this for 
> bonded DSI
>   * mode, where the master PLL's clk_ops needs access the slave's 
> private data
>   */
>  static struct dsi_pll_7nm *pll_7nm_list[DSI_MAX];

^ permalink raw reply	[flat|nested] 13+ messages in thread

* Re: [Freedreno] [PATCH v3 2/7] drm/msm/dsi: add three helper functions
  2021-07-10 22:20 ` [PATCH v3 2/7] drm/msm/dsi: add three helper functions Dmitry Baryshkov
  2021-07-11  4:21   ` kernel test robot
@ 2021-07-12 21:03   ` abhinavk
  1 sibling, 0 replies; 13+ messages in thread
From: abhinavk @ 2021-07-12 21:03 UTC (permalink / raw)
  To: Dmitry Baryshkov
  Cc: Bjorn Andersson, Rob Clark, Sean Paul, Jonathan Marek,
	Stephen Boyd, linux-arm-msm, dri-devel, David Airlie,
	Daniel Vetter, freedreno

On 2021-07-10 15:20, Dmitry Baryshkov wrote:
> Add three helper functions to be used by display drivers for setting up
> encoders.
> 
> Signed-off-by: Dmitry Baryshkov <dmitry.baryshkov@linaro.org>
I think there is a kbot error in this patch, with that fixed
Reviewed-by: Abhinav Kumar <abhinavk@codeaurora.org>
> ---
>  drivers/gpu/drm/msm/dsi/dsi.c         |  7 +++++++
>  drivers/gpu/drm/msm/dsi/dsi_manager.c | 19 +++++++++++--------
>  drivers/gpu/drm/msm/msm_drv.h         | 17 +++++++++++++++--
>  3 files changed, 33 insertions(+), 10 deletions(-)
> 
> diff --git a/drivers/gpu/drm/msm/dsi/dsi.c 
> b/drivers/gpu/drm/msm/dsi/dsi.c
> index 75afc12a7b25..5201d7eb0490 100644
> --- a/drivers/gpu/drm/msm/dsi/dsi.c
> +++ b/drivers/gpu/drm/msm/dsi/dsi.c
> @@ -13,6 +13,13 @@ struct drm_encoder *msm_dsi_get_encoder(struct
> msm_dsi *msm_dsi)
>  	return msm_dsi->encoder;
>  }
> 
> +bool msm_dsi_is_cmd_mode(struct msm_dsi *msm_dsi)
> +{
> +	unsigned long host_flags = 
> msm_dsi_host_get_mode_flags(msm_dsi->host);
> +
> +	return !(host_flags & MIPI_DSI_MODE_VIDEO);
> +}
> +
>  static int dsi_get_phy(struct msm_dsi *msm_dsi)
>  {
>  	struct platform_device *pdev = msm_dsi->pdev;
> diff --git a/drivers/gpu/drm/msm/dsi/dsi_manager.c
> b/drivers/gpu/drm/msm/dsi/dsi_manager.c
> index b20645ab279b..27d3b9ebf831 100644
> --- a/drivers/gpu/drm/msm/dsi/dsi_manager.c
> +++ b/drivers/gpu/drm/msm/dsi/dsi_manager.c
> @@ -216,12 +216,6 @@ static int dsi_mgr_bridge_get_id(struct drm_bridge 
> *bridge)
>  	return dsi_bridge->id;
>  }
> 
> -static bool dsi_mgr_is_cmd_mode(struct msm_dsi *msm_dsi)
> -{
> -	unsigned long host_flags = 
> msm_dsi_host_get_mode_flags(msm_dsi->host);
> -	return !(host_flags & MIPI_DSI_MODE_VIDEO);
> -}
> -
>  void msm_dsi_manager_setup_encoder(int id)
>  {
>  	struct msm_dsi *msm_dsi = dsi_mgr_get_dsi(id);
> @@ -231,7 +225,7 @@ void msm_dsi_manager_setup_encoder(int id)
> 
>  	if (encoder && kms->funcs->set_encoder_mode)
>  		kms->funcs->set_encoder_mode(kms, encoder,
> -					     dsi_mgr_is_cmd_mode(msm_dsi));
> +					     msm_dsi_is_cmd_mode(msm_dsi));
>  }
> 
>  static int msm_dsi_manager_panel_init(struct drm_connector *conn, u8 
> id)
> @@ -276,7 +270,7 @@ static int msm_dsi_manager_panel_init(struct
> drm_connector *conn, u8 id)
>  	if (other_dsi && other_dsi->panel && kms->funcs->set_split_display) {
>  		kms->funcs->set_split_display(kms, master_dsi->encoder,
>  					      slave_dsi->encoder,
> -					      dsi_mgr_is_cmd_mode(msm_dsi));
> +					      msm_dsi_is_cmd_mode(msm_dsi));
>  	}
> 
>  out:
> @@ -839,3 +833,12 @@ void msm_dsi_manager_unregister(struct msm_dsi 
> *msm_dsi)
>  		msm_dsim->dsi[msm_dsi->id] = NULL;
>  }
> 
> +bool msm_dsi_is_bonded_dsi(struct msm_dsi *msm_dsi)
> +{
> +	return IS_BONDED_DSI();
> +}
> +
> +bool msm_dsi_is_master_dsi(struct msm_dsi *msm_dsi)
> +{
> +	return IS_MASTER_DSI_LINK(msm_dsi->id);
> +}
> diff --git a/drivers/gpu/drm/msm/msm_drv.h 
> b/drivers/gpu/drm/msm/msm_drv.h
> index 1a48a709ffb3..3d331acbc94a 100644
> --- a/drivers/gpu/drm/msm/msm_drv.h
> +++ b/drivers/gpu/drm/msm/msm_drv.h
> @@ -350,7 +350,9 @@ void __exit msm_dsi_unregister(void);
>  int msm_dsi_modeset_init(struct msm_dsi *msm_dsi, struct drm_device 
> *dev,
>  			 struct drm_encoder *encoder);
>  void msm_dsi_snapshot(struct msm_disp_state *disp_state, struct
> msm_dsi *msm_dsi);
> -
> +bool msm_dsi_is_cmd_mode(struct msm_dsi *msm_dsi);
> +bool msm_dsi_is_bonded_dsi(struct msm_dsi *msm_dsi);
> +bool msm_dsi_is_master_dsi(struct msm_dsi *msm_dsi);
>  #else
>  static inline void __init msm_dsi_register(void)
>  {
> @@ -367,7 +369,18 @@ static inline int msm_dsi_modeset_init(struct
> msm_dsi *msm_dsi,
>  static inline void msm_dsi_snapshot(struct msm_disp_state
> *disp_state, struct msm_dsi *msm_dsi)
>  {
>  }
> -
> +static inline bool msm_dsi_is_cmd_mode(struct msm_dsi *msm_dsi)
> +{
> +	return false;
> +}
> +static bool msm_dsi_is_bonded_dsi(struct msm_dsi *msm_dsi)
> +{
> +	return false;
> +}
> +bool msm_dsi_is_master_dsi(struct msm_dsi *msm_dsi)
> +{
> +	return false
> +}
>  #endif
> 
>  #ifdef CONFIG_DRM_MSM_DP

^ permalink raw reply	[flat|nested] 13+ messages in thread

* Re: [PATCH v3 3/7] drm/msm/dpu: support setting up two independent DSI connectors
  2021-07-10 22:20 ` [PATCH v3 3/7] drm/msm/dpu: support setting up two independent DSI connectors Dmitry Baryshkov
@ 2021-07-12 21:15   ` abhinavk
  2021-07-17 12:35     ` Dmitry Baryshkov
  0 siblings, 1 reply; 13+ messages in thread
From: abhinavk @ 2021-07-12 21:15 UTC (permalink / raw)
  To: Dmitry Baryshkov
  Cc: Bjorn Andersson, Rob Clark, Sean Paul, Jonathan Marek,
	Stephen Boyd, David Airlie, Daniel Vetter, linux-arm-msm,
	dri-devel, freedreno

On 2021-07-10 15:20, Dmitry Baryshkov wrote:
> Move setting up encoders from set_encoder_mode to
> _dpu_kms_initialize_dsi() / _dpu_kms_initialize_displayport(). This
> allows us to support not only "single DSI" and "bonded DSI" but also 
> "two
> independent DSI" configurations. In future this would also help adding
> support for multiple DP connectors.
> 

This looks quite neat now,so i am okay with this version of it:

Reviewed-by: Abhinav Kumar <abhinavk@codeaurora.org>

Just a suggestion, since we are only supporting two dsis so far, do we 
need
an extra variable to get the other DSI? Can't we just do 
priv->dsi[DSI_1]?
as usually DSI_0 is the master

> +		int other = (i + 1) % 2;

> Signed-off-by: Dmitry Baryshkov <dmitry.baryshkov@linaro.org>
> ---
>  drivers/gpu/drm/msm/disp/dpu1/dpu_kms.c | 102 +++++++++++++-----------
>  1 file changed, 57 insertions(+), 45 deletions(-)
> 
> diff --git a/drivers/gpu/drm/msm/disp/dpu1/dpu_kms.c
> b/drivers/gpu/drm/msm/disp/dpu1/dpu_kms.c
> index 1d3a4f395e74..3cd2011e18d4 100644
> --- a/drivers/gpu/drm/msm/disp/dpu1/dpu_kms.c
> +++ b/drivers/gpu/drm/msm/disp/dpu1/dpu_kms.c
> @@ -471,30 +471,68 @@ static int _dpu_kms_initialize_dsi(struct 
> drm_device *dev,
>  				    struct dpu_kms *dpu_kms)
>  {
>  	struct drm_encoder *encoder = NULL;
> +	struct msm_display_info info;
>  	int i, rc = 0;
> 
>  	if (!(priv->dsi[0] || priv->dsi[1]))
>  		return rc;
> 
> -	/*TODO: Support two independent DSI connectors */
> -	encoder = dpu_encoder_init(dev, DRM_MODE_ENCODER_DSI);
> -	if (IS_ERR(encoder)) {
> -		DPU_ERROR("encoder init failed for dsi display\n");
> -		return PTR_ERR(encoder);
> -	}
> -
> -	priv->encoders[priv->num_encoders++] = encoder;
> -
> +	/*
> +	 * We support following confiurations:
> +	 * - Single DSI host (dsi0 or dsi1)
> +	 * - Two independent DSI hosts
> +	 * - Bonded DSI0 and DSI1 hosts
> +	 *
> +	 * TODO: Support swapping DSI0 and DSI1 in the bonded setup.
> +	 */
>  	for (i = 0; i < ARRAY_SIZE(priv->dsi); i++) {
> +		int other = (i + 1) % 2;
> +
>  		if (!priv->dsi[i])
>  			continue;
> 
> +		if (msm_dsi_is_bonded_dsi(priv->dsi[i]) &&
> +		    !msm_dsi_is_master_dsi(priv->dsi[i]))
> +			continue;
> +
> +		encoder = dpu_encoder_init(dev, DRM_MODE_ENCODER_DSI);
> +		if (IS_ERR(encoder)) {
> +			DPU_ERROR("encoder init failed for dsi display\n");
> +			return PTR_ERR(encoder);
> +		}
> +
> +		priv->encoders[priv->num_encoders++] = encoder;
> +
> +		memset(&info, 0, sizeof(info));
> +		info.intf_type = encoder->encoder_type;
> +
>  		rc = msm_dsi_modeset_init(priv->dsi[i], dev, encoder);
>  		if (rc) {
>  			DPU_ERROR("modeset_init failed for dsi[%d], rc = %d\n",
>  				i, rc);
>  			break;
>  		}
> +
> +		info.h_tile_instance[info.num_of_h_tiles++] = i;
> +		info.capabilities = msm_dsi_is_cmd_mode(priv->dsi[i]) ?
> +			MSM_DISPLAY_CAP_CMD_MODE :
> +			MSM_DISPLAY_CAP_VID_MODE;
> +
> +		if (msm_dsi_is_bonded_dsi(priv->dsi[i]) && priv->dsi[other]) {
> +			rc = msm_dsi_modeset_init(priv->dsi[other], dev, encoder);
> +			if (rc) {
> +				DPU_ERROR("modeset_init failed for dsi[%d], rc = %d\n",
> +					other, rc);
> +				break;
> +			}
> +
> +			info.h_tile_instance[info.num_of_h_tiles++] = other;
> +		}
> +
> +		rc = dpu_encoder_setup(dev, encoder, &info);
> +		if (rc)
> +			DPU_ERROR("failed to setup DPU encoder %d: rc:%d\n",
> +				  encoder->base.id, rc);
>  	}
> 
>  	return rc;
> @@ -505,6 +543,7 @@ static int _dpu_kms_initialize_displayport(struct
> drm_device *dev,
>  					    struct dpu_kms *dpu_kms)
>  {
>  	struct drm_encoder *encoder = NULL;
> +	struct msm_display_info info;
>  	int rc = 0;
> 
>  	if (!priv->dp)
> @@ -516,6 +555,7 @@ static int _dpu_kms_initialize_displayport(struct
> drm_device *dev,
>  		return PTR_ERR(encoder);
>  	}
> 
> +	memset(&info, 0, sizeof(info));
>  	rc = msm_dp_modeset_init(priv->dp, dev, encoder);
>  	if (rc) {
>  		DPU_ERROR("modeset_init failed for DP, rc = %d\n", rc);
> @@ -524,6 +564,14 @@ static int _dpu_kms_initialize_displayport(struct
> drm_device *dev,
>  	}
> 
>  	priv->encoders[priv->num_encoders++] = encoder;
> +
> +	info.num_of_h_tiles = 1;
> +	info.capabilities = MSM_DISPLAY_CAP_VID_MODE;
> +	info.intf_type = encoder->encoder_type;
> +	rc = dpu_encoder_setup(dev, encoder, &info);
> +	if (rc)
> +		DPU_ERROR("failed to setup DPU encoder %d: rc:%d\n",
> +			  encoder->base.id, rc);
>  	return rc;
>  }
> 
> @@ -726,41 +774,6 @@ static void dpu_kms_destroy(struct msm_kms *kms)
>  	msm_kms_destroy(&dpu_kms->base);
>  }
> 
> -static void _dpu_kms_set_encoder_mode(struct msm_kms *kms,
> -				 struct drm_encoder *encoder,
> -				 bool cmd_mode)
> -{
> -	struct msm_display_info info;
> -	struct msm_drm_private *priv = encoder->dev->dev_private;
> -	int i, rc = 0;
> -
> -	memset(&info, 0, sizeof(info));
> -
> -	info.intf_type = encoder->encoder_type;
> -	info.capabilities = cmd_mode ? MSM_DISPLAY_CAP_CMD_MODE :
> -			MSM_DISPLAY_CAP_VID_MODE;
> -
> -	switch (info.intf_type) {
> -	case DRM_MODE_ENCODER_DSI:
> -		/* TODO: No support for DSI swap */
> -		for (i = 0; i < ARRAY_SIZE(priv->dsi); i++) {
> -			if (priv->dsi[i]) {
> -				info.h_tile_instance[info.num_of_h_tiles] = i;
> -				info.num_of_h_tiles++;
> -			}
> -		}
> -		break;
> -	case DRM_MODE_ENCODER_TMDS:
> -		info.num_of_h_tiles = 1;
> -		break;
> -	}
> -
> -	rc = dpu_encoder_setup(encoder->dev, encoder, &info);
> -	if (rc)
> -		DPU_ERROR("failed to setup DPU encoder %d: rc:%d\n",
> -			encoder->base.id, rc);
> -}
> -
>  static irqreturn_t dpu_irq(struct msm_kms *kms)
>  {
>  	struct dpu_kms *dpu_kms = to_dpu_kms(kms);
> @@ -863,7 +876,6 @@ static const struct msm_kms_funcs kms_funcs = {
>  	.get_format      = dpu_get_msm_format,
>  	.round_pixclk    = dpu_kms_round_pixclk,
>  	.destroy         = dpu_kms_destroy,
> -	.set_encoder_mode = _dpu_kms_set_encoder_mode,
>  	.snapshot        = dpu_kms_mdp_snapshot,
>  #ifdef CONFIG_DEBUG_FS
>  	.debugfs_init    = dpu_kms_debugfs_init,

^ permalink raw reply	[flat|nested] 13+ messages in thread

* Re: [PATCH v3 3/7] drm/msm/dpu: support setting up two independent DSI connectors
  2021-07-12 21:15   ` abhinavk
@ 2021-07-17 12:35     ` Dmitry Baryshkov
  0 siblings, 0 replies; 13+ messages in thread
From: Dmitry Baryshkov @ 2021-07-17 12:35 UTC (permalink / raw)
  To: abhinavk
  Cc: Bjorn Andersson, Rob Clark, Sean Paul, Jonathan Marek,
	Stephen Boyd, David Airlie, Daniel Vetter, linux-arm-msm,
	dri-devel, freedreno

On 13/07/2021 00:15, abhinavk@codeaurora.org wrote:
> On 2021-07-10 15:20, Dmitry Baryshkov wrote:
>> Move setting up encoders from set_encoder_mode to
>> _dpu_kms_initialize_dsi() / _dpu_kms_initialize_displayport(). This
>> allows us to support not only "single DSI" and "bonded DSI" but also "two
>> independent DSI" configurations. In future this would also help adding
>> support for multiple DP connectors.
>>
> 
> This looks quite neat now,so i am okay with this version of it:
> 
> Reviewed-by: Abhinav Kumar <abhinavk@codeaurora.org>
> 
> Just a suggestion, since we are only supporting two dsis so far, do we need
> an extra variable to get the other DSI? Can't we just do priv->dsi[DSI_1]?
> as usually DSI_0 is the master

I still hope to fix "swap links in bonded DSI mode" (in other words DSI 
0 being clock master, but driving right half of the screen) one day. 
Thus I don't think we should enforce DSI_0/DSI_1 here.

> 
>> +        int other = (i + 1) % 2;
> 
>> Signed-off-by: Dmitry Baryshkov <dmitry.baryshkov@linaro.org>
>> ---
>>  drivers/gpu/drm/msm/disp/dpu1/dpu_kms.c | 102 +++++++++++++-----------
>>  1 file changed, 57 insertions(+), 45 deletions(-)
>>
>> diff --git a/drivers/gpu/drm/msm/disp/dpu1/dpu_kms.c
>> b/drivers/gpu/drm/msm/disp/dpu1/dpu_kms.c
>> index 1d3a4f395e74..3cd2011e18d4 100644
>> --- a/drivers/gpu/drm/msm/disp/dpu1/dpu_kms.c
>> +++ b/drivers/gpu/drm/msm/disp/dpu1/dpu_kms.c
>> @@ -471,30 +471,68 @@ static int _dpu_kms_initialize_dsi(struct 
>> drm_device *dev,
>>                      struct dpu_kms *dpu_kms)
>>  {
>>      struct drm_encoder *encoder = NULL;
>> +    struct msm_display_info info;
>>      int i, rc = 0;
>>
>>      if (!(priv->dsi[0] || priv->dsi[1]))
>>          return rc;
>>
>> -    /*TODO: Support two independent DSI connectors */
>> -    encoder = dpu_encoder_init(dev, DRM_MODE_ENCODER_DSI);
>> -    if (IS_ERR(encoder)) {
>> -        DPU_ERROR("encoder init failed for dsi display\n");
>> -        return PTR_ERR(encoder);
>> -    }
>> -
>> -    priv->encoders[priv->num_encoders++] = encoder;
>> -
>> +    /*
>> +     * We support following confiurations:
>> +     * - Single DSI host (dsi0 or dsi1)
>> +     * - Two independent DSI hosts
>> +     * - Bonded DSI0 and DSI1 hosts
>> +     *
>> +     * TODO: Support swapping DSI0 and DSI1 in the bonded setup.
>> +     */
>>      for (i = 0; i < ARRAY_SIZE(priv->dsi); i++) {
>> +        int other = (i + 1) % 2;
>> +
>>          if (!priv->dsi[i])
>>              continue;
>>
>> +        if (msm_dsi_is_bonded_dsi(priv->dsi[i]) &&
>> +            !msm_dsi_is_master_dsi(priv->dsi[i]))
>> +            continue;
>> +
>> +        encoder = dpu_encoder_init(dev, DRM_MODE_ENCODER_DSI);
>> +        if (IS_ERR(encoder)) {
>> +            DPU_ERROR("encoder init failed for dsi display\n");
>> +            return PTR_ERR(encoder);
>> +        }
>> +
>> +        priv->encoders[priv->num_encoders++] = encoder;
>> +
>> +        memset(&info, 0, sizeof(info));
>> +        info.intf_type = encoder->encoder_type;
>> +
>>          rc = msm_dsi_modeset_init(priv->dsi[i], dev, encoder);
>>          if (rc) {
>>              DPU_ERROR("modeset_init failed for dsi[%d], rc = %d\n",
>>                  i, rc);
>>              break;
>>          }
>> +
>> +        info.h_tile_instance[info.num_of_h_tiles++] = i;
>> +        info.capabilities = msm_dsi_is_cmd_mode(priv->dsi[i]) ?
>> +            MSM_DISPLAY_CAP_CMD_MODE :
>> +            MSM_DISPLAY_CAP_VID_MODE;
>> +
>> +        if (msm_dsi_is_bonded_dsi(priv->dsi[i]) && priv->dsi[other]) {
>> +            rc = msm_dsi_modeset_init(priv->dsi[other], dev, encoder);
>> +            if (rc) {
>> +                DPU_ERROR("modeset_init failed for dsi[%d], rc = %d\n",
>> +                    other, rc);
>> +                break;
>> +            }
>> +
>> +            info.h_tile_instance[info.num_of_h_tiles++] = other;
>> +        }
>> +
>> +        rc = dpu_encoder_setup(dev, encoder, &info);
>> +        if (rc)
>> +            DPU_ERROR("failed to setup DPU encoder %d: rc:%d\n",
>> +                  encoder->base.id, rc);
>>      }
>>
>>      return rc;
>> @@ -505,6 +543,7 @@ static int _dpu_kms_initialize_displayport(struct
>> drm_device *dev,
>>                          struct dpu_kms *dpu_kms)
>>  {
>>      struct drm_encoder *encoder = NULL;
>> +    struct msm_display_info info;
>>      int rc = 0;
>>
>>      if (!priv->dp)
>> @@ -516,6 +555,7 @@ static int _dpu_kms_initialize_displayport(struct
>> drm_device *dev,
>>          return PTR_ERR(encoder);
>>      }
>>
>> +    memset(&info, 0, sizeof(info));
>>      rc = msm_dp_modeset_init(priv->dp, dev, encoder);
>>      if (rc) {
>>          DPU_ERROR("modeset_init failed for DP, rc = %d\n", rc);
>> @@ -524,6 +564,14 @@ static int _dpu_kms_initialize_displayport(struct
>> drm_device *dev,
>>      }
>>
>>      priv->encoders[priv->num_encoders++] = encoder;
>> +
>> +    info.num_of_h_tiles = 1;
>> +    info.capabilities = MSM_DISPLAY_CAP_VID_MODE;
>> +    info.intf_type = encoder->encoder_type;
>> +    rc = dpu_encoder_setup(dev, encoder, &info);
>> +    if (rc)
>> +        DPU_ERROR("failed to setup DPU encoder %d: rc:%d\n",
>> +              encoder->base.id, rc);
>>      return rc;
>>  }
>>
>> @@ -726,41 +774,6 @@ static void dpu_kms_destroy(struct msm_kms *kms)
>>      msm_kms_destroy(&dpu_kms->base);
>>  }
>>
>> -static void _dpu_kms_set_encoder_mode(struct msm_kms *kms,
>> -                 struct drm_encoder *encoder,
>> -                 bool cmd_mode)
>> -{
>> -    struct msm_display_info info;
>> -    struct msm_drm_private *priv = encoder->dev->dev_private;
>> -    int i, rc = 0;
>> -
>> -    memset(&info, 0, sizeof(info));
>> -
>> -    info.intf_type = encoder->encoder_type;
>> -    info.capabilities = cmd_mode ? MSM_DISPLAY_CAP_CMD_MODE :
>> -            MSM_DISPLAY_CAP_VID_MODE;
>> -
>> -    switch (info.intf_type) {
>> -    case DRM_MODE_ENCODER_DSI:
>> -        /* TODO: No support for DSI swap */
>> -        for (i = 0; i < ARRAY_SIZE(priv->dsi); i++) {
>> -            if (priv->dsi[i]) {
>> -                info.h_tile_instance[info.num_of_h_tiles] = i;
>> -                info.num_of_h_tiles++;
>> -            }
>> -        }
>> -        break;
>> -    case DRM_MODE_ENCODER_TMDS:
>> -        info.num_of_h_tiles = 1;
>> -        break;
>> -    }
>> -
>> -    rc = dpu_encoder_setup(encoder->dev, encoder, &info);
>> -    if (rc)
>> -        DPU_ERROR("failed to setup DPU encoder %d: rc:%d\n",
>> -            encoder->base.id, rc);
>> -}
>> -
>>  static irqreturn_t dpu_irq(struct msm_kms *kms)
>>  {
>>      struct dpu_kms *dpu_kms = to_dpu_kms(kms);
>> @@ -863,7 +876,6 @@ static const struct msm_kms_funcs kms_funcs = {
>>      .get_format      = dpu_get_msm_format,
>>      .round_pixclk    = dpu_kms_round_pixclk,
>>      .destroy         = dpu_kms_destroy,
>> -    .set_encoder_mode = _dpu_kms_set_encoder_mode,
>>      .snapshot        = dpu_kms_mdp_snapshot,
>>  #ifdef CONFIG_DEBUG_FS
>>      .debugfs_init    = dpu_kms_debugfs_init,


-- 
With best wishes
Dmitry

^ permalink raw reply	[flat|nested] 13+ messages in thread

end of thread, other threads:[~2021-07-17 12:35 UTC | newest]

Thread overview: 13+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-07-10 22:19 [PATCH v3 0/7] drm/msm/dpu: add support for independent DSI config Dmitry Baryshkov
2021-07-10 22:19 ` [PATCH v3 1/7] drm/msm/dsi: rename dual DSI to bonded DSI Dmitry Baryshkov
2021-07-12 21:02   ` [Freedreno] " abhinavk
2021-07-10 22:20 ` [PATCH v3 2/7] drm/msm/dsi: add three helper functions Dmitry Baryshkov
2021-07-11  4:21   ` kernel test robot
2021-07-12 21:03   ` [Freedreno] " abhinavk
2021-07-10 22:20 ` [PATCH v3 3/7] drm/msm/dpu: support setting up two independent DSI connectors Dmitry Baryshkov
2021-07-12 21:15   ` abhinavk
2021-07-17 12:35     ` Dmitry Baryshkov
2021-07-10 22:20 ` [PATCH v3 4/7] drm/msm/mdp5: move mdp5_encoder_set_intf_mode after msm_dsi_modeset_init Dmitry Baryshkov
2021-07-10 22:20 ` [PATCH v3 5/7] drm/msm/dp: stop calling set_encoder_mode callback Dmitry Baryshkov
2021-07-10 22:20 ` [PATCH v3 6/7] drm/msm/dsi: " Dmitry Baryshkov
2021-07-10 22:20 ` [PATCH v3 7/7] drm/msm/kms: drop " Dmitry Baryshkov

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).