Skip to contentSkip to conversation

drm/msm/dsi: switch to DRM_PANEL_BRIDGE

PATCH New Dmitry Baryshkov 2 participants 2 messages Jul 6, 2022 – Jul 7, 2022

Subsystems (3)
lore
Share & tools
lore
#0 lore raw

PATCH 1/1 drm/msm/dsi: switch to DRM_PANEL_BRIDGE

Currently the DSI driver has two separate paths: one if the next device in a chain is a bridge and another one if the panel is connected directly to the DSI host. Simplify the code path by using panel-bridge driver (already selected in Kconfig) and dropping support for handling the panel directly.

---
Patch dependency for accessing DSC data through the struct mipi_dsi_device rather than through the struct drm_panel:

https://patchwork.freedesktop.org/series/103411/

---
 drivers/gpu/drm/msm/dsi/dsi.c         |  30 +--
 drivers/gpu/drm/msm/dsi/dsi.h         |  10 +-
 drivers/gpu/drm/msm/dsi/dsi_host.c    |  20 +-
 drivers/gpu/drm/msm/dsi/dsi_manager.c | 264 ++------------------------
 4 files changed, 27 insertions(+), 297 deletions(-)
drivers/gpu/drm/msm/dsi/dsi.c +5 -25
index 1625328fa430..d272fcf043e5 100644
@@ -220,7 +220,7 @@ int msm_dsi_modeset_init(struct msm_dsi *msm_dsi, struct drm_device *dev,
 			 struct drm_encoder *encoder)
 {
 	struct msm_drm_private *priv;
-	struct drm_bridge *ext_bridge;
+	struct drm_connector *connector;
 	int ret;
 
 	if (WARN_ON(!encoder) || WARN_ON(!msm_dsi) || WARN_ON(!dev))
@@ -254,26 +254,12 @@ int msm_dsi_modeset_init(struct msm_dsi *msm_dsi, struct drm_device *dev,
 		goto fail;
 	}
 
-	/*
-	 * check if the dsi encoder output is connected to a panel or an
-	 * external bridge. We create a connector only if we're connected to a
-	 * drm_panel device. When we're connected to an external bridge, we
-	 * assume that the drm_bridge driver will create the connector itself.
-	 */
-	ext_bridge = msm_dsi_host_get_bridge(msm_dsi->host);
-
-	if (ext_bridge)
-		msm_dsi->connector =
-			msm_dsi_manager_ext_bridge_init(msm_dsi->id);
-	else
-		msm_dsi->connector =
-			msm_dsi_manager_connector_init(msm_dsi->id);
-
-	if (IS_ERR(msm_dsi->connector)) {
-		ret = PTR_ERR(msm_dsi->connector);
+	connector = msm_dsi_manager_ext_bridge_init(msm_dsi->id);
+
+	if (IS_ERR(connector)) {
+		ret = PTR_ERR(connector);
 		DRM_DEV_ERROR(dev->dev,
 			"failed to create dsi connector: %d\n", ret);
-		msm_dsi->connector = NULL;
 		goto fail;
 	}
 
@@ -287,12 +273,6 @@ int msm_dsi_modeset_init(struct msm_dsi *msm_dsi, struct drm_device *dev,
 		msm_dsi->bridge = NULL;
 	}
 
-	/* don't destroy connector if we didn't make it */
-	if (msm_dsi->connector && !msm_dsi->external_bridge)
-		msm_dsi->connector->funcs->destroy(msm_dsi->connector);
-
-	msm_dsi->connector = NULL;
-
 	return ret;
 }
 
drivers/gpu/drm/msm/dsi/dsi.h +2 -8
index 580a1e6358bf..406a607620ff 100644
@@ -49,8 +49,6 @@ struct msm_dsi {
 	struct drm_device *dev;
 	struct platform_device *pdev;
 
-	/* connector managed by us when we're connected to a drm_panel */
-	struct drm_connector *connector;
 	/* internal dsi bridge attached to MDP interface */
 	struct drm_bridge *bridge;
 
@@ -58,10 +56,8 @@ struct msm_dsi {
 	struct msm_dsi_phy *phy;
 
 	/*
-	 * panel/external_bridge connected to dsi bridge output, only one of the
-	 * two can be valid at a time
+	 * external_bridge connected to dsi bridge output
 	 */
-	struct drm_panel *panel;
 	struct drm_bridge *external_bridge;
 
 	struct device *phy_dev;
@@ -76,7 +72,6 @@ struct msm_dsi {
 /* dsi manager */
 struct drm_bridge *msm_dsi_manager_bridge_init(u8 id);
 void msm_dsi_manager_bridge_destroy(struct drm_bridge *bridge);
-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);
@@ -87,7 +82,7 @@ void msm_dsi_manager_tpg_enable(void);
 /* msm dsi */
 static inline bool msm_dsi_device_connected(struct msm_dsi *msm_dsi)
 {
-	return msm_dsi->panel || msm_dsi->external_bridge;
+	return msm_dsi->external_bridge;
 }
 
 struct drm_encoder *msm_dsi_get_encoder(struct msm_dsi *msm_dsi);
@@ -116,7 +111,6 @@ int msm_dsi_host_set_display_mode(struct mipi_dsi_host *host,
 				  const struct drm_display_mode *mode);
 enum drm_mode_status msm_dsi_host_check_dsc(struct mipi_dsi_host *host,
 					    const struct drm_display_mode *mode);
-struct drm_panel *msm_dsi_host_get_panel(struct mipi_dsi_host *host);
 unsigned long msm_dsi_host_get_mode_flags(struct mipi_dsi_host *host);
 struct drm_bridge *msm_dsi_host_get_bridge(struct mipi_dsi_host *host);
 int msm_dsi_host_register(struct mipi_dsi_host *host);
drivers/gpu/drm/msm/dsi/dsi_host.c +1 -19
index f89d4d7e1a03..d93d068ec0b6 100644
@@ -162,7 +162,6 @@ struct msm_dsi_host {
 	struct msm_display_dsc_config *dsc;
 
 	/* connected device info */
-	struct device_node *device_node;
 	unsigned int channel;
 	unsigned int lanes;
 	enum mipi_dsi_pixel_format format;
@@ -1719,8 +1718,6 @@ static int dsi_host_detach(struct mipi_dsi_host *host,
 
 	dsi_dev_detach(msm_host->pdev);
 
-	msm_host->device_node = NULL;
-
 	DBG("id=%d", msm_host->id);
 	if (msm_host->dev)
 		queue_work(msm_host->workqueue, &msm_host->hpd_work);
@@ -1987,16 +1984,6 @@ static int dsi_host_parse_dt(struct msm_dsi_host *msm_host)
 		goto err;
 	}
 
-	/* Get panel node from the output port's endpoint data */
-	device_node = of_graph_get_remote_node(np, 1, 0);
-	if (!device_node) {
-		DRM_DEV_DEBUG(dev, "%s: no valid device\n", __func__);
-		ret = -ENODEV;
-		goto err;
-	}
-
-	msm_host->device_node = device_node;
-
 	if (of_property_read_bool(np, "syscon-sfpb")) {
 		msm_host->sfpb = syscon_regmap_lookup_by_phandle(np,
 					"syscon-sfpb");
@@ -2677,11 +2664,6 @@ enum drm_mode_status msm_dsi_host_check_dsc(struct mipi_dsi_host *host,
 	return MODE_OK;
 }
 
-struct drm_panel *msm_dsi_host_get_panel(struct mipi_dsi_host *host)
-{
-	return of_drm_find_panel(to_msm_dsi_host(host)->device_node);
-}
-
 unsigned long msm_dsi_host_get_mode_flags(struct mipi_dsi_host *host)
 {
 	return to_msm_dsi_host(host)->mode_flags;
@@ -2691,7 +2673,7 @@ struct drm_bridge *msm_dsi_host_get_bridge(struct mipi_dsi_host *host)
 {
 	struct msm_dsi_host *msm_host = to_msm_dsi_host(host);
 
-	return of_drm_find_bridge(msm_host->device_node);
+	return devm_drm_of_get_bridge(&msm_host->pdev->dev, msm_host->pdev->dev.of_node, 1, 0);
 }
 
 void msm_dsi_host_snapshot(struct msm_disp_state *disp_state, struct mipi_dsi_host *host)
drivers/gpu/drm/msm/dsi/dsi_manager.c +19 -245

371 lines not on this page · raw message

Signature · 1 line
2.35.1
#1 lore raw
I love your patch! Yet something to improve:

Hi Dmitry,

I love your patch! Yet something to improve:

[auto build test ERROR on drm-misc/drm-misc-next]
[also build test ERROR on linus/master v5.19-rc5 next-20220706] [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#_base_tree_information]

url:    https://github.com/intel-lab-lkp/linux/commits/Dmitry-Baryshkov/drm-msm-dsi-switch-to-DRM_PANEL_BRIDGE/20220707-040414
base:   git://anongit.freedesktop.org/drm/drm-misc drm-misc-next
config: arc-randconfig-r043-20220706 (https://download.01.org/0day-ci/archive/20220707/[email protected]/config)
compiler: arceb-elf-gcc (GCC) 11.3.0

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
# https://github.com/intel-lab-lkp/linux/commit/5eeb41ba36c536b30a6494df55ed441f005a6b11
git remote add linux-review https://github.com/intel-lab-lkp/linux
git fetch --no-tags linux-review Dmitry-Baryshkov/drm-msm-dsi-switch-to-DRM_PANEL_BRIDGE/20220707-040414 git checkout 5eeb41ba36c536b30a6494df55ed441f005a6b11
# save the config file
mkdir build_dir && cp config build_dir/.config
COMPILER_INSTALL_PATH=$HOME/0day COMPILER=gcc-11.3.0 make.cross W=1 O=build_dir ARCH=arc SHELL=/bin/bash drivers/gpu/drm/msm/

If you fix the issue, kindly add following tag where applicable

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

drivers/gpu/drm/msm/dsi/dsi_host.c: In function 'msm_dsi_host_modeset_init':

>> drivers/gpu/drm/msm/dsi/dsi_host.c:2159:17: error: implicit declaration of function 'msm_dsi_host_get_panel'; did you mean 'msm_dsi_host_get_bridge'? [-Werror=implicit-function-declaration]
    2159 |         panel = msm_dsi_host_get_panel(&msm_host->base);
         |                 ^~~~~~~~~~~~~~~~~~~~~~
         |                 msm_dsi_host_get_bridge
>> drivers/gpu/drm/msm/dsi/dsi_host.c:2159:15: warning: assignment to 'struct drm_panel *' from 'int' makes pointer from integer without a cast [-Wint-conversion]
    2159 |         panel = msm_dsi_host_get_panel(&msm_host->base);
         |               ^

cc1: some warnings being treated as errors

vim +2159 drivers/gpu/drm/msm/dsi/dsi_host.c

a689554ba6ed81c Hai Li      2015-03-31  2149  
a689554ba6ed81c Hai Li      2015-03-31  2150  int msm_dsi_host_modeset_init(struct mipi_dsi_host *host,
a689554ba6ed81c Hai Li      2015-03-31  2151  					struct drm_device *dev)
a689554ba6ed81c Hai Li      2015-03-31  2152  {
a689554ba6ed81c Hai Li      2015-03-31  2153  	struct msm_dsi_host *msm_host = to_msm_dsi_host(host);
8f7ca5409063ade Sibi Sankar 2018-05-29  2154  	const struct msm_dsi_cfg_handler *cfg_hnd = msm_host->cfg_hnd;
0f40ba48de3b8a4 Vinod Koul  2022-04-06  2155  	struct drm_panel *panel;
a689554ba6ed81c Hai Li      2015-03-31  2156  	int ret;
a689554ba6ed81c Hai Li      2015-03-31  2157  
a689554ba6ed81c Hai Li      2015-03-31  2158  	msm_host->dev = dev;
0f40ba48de3b8a4 Vinod Koul  2022-04-06 @2159  	panel = msm_dsi_host_get_panel(&msm_host->base);
0f40ba48de3b8a4 Vinod Koul  2022-04-06  2160  
0f40ba48de3b8a4 Vinod Koul  2022-04-06  2161  	if (!IS_ERR(panel) && panel->dsc) {
0f40ba48de3b8a4 Vinod Koul  2022-04-06  2162  		struct msm_display_dsc_config *dsc = msm_host->dsc;
0f40ba48de3b8a4 Vinod Koul  2022-04-06  2163  
0f40ba48de3b8a4 Vinod Koul  2022-04-06  2164  		if (!dsc) {
0f40ba48de3b8a4 Vinod Koul  2022-04-06  2165  			dsc = devm_kzalloc(&msm_host->pdev->dev, sizeof(*dsc), GFP_KERNEL);
0f40ba48de3b8a4 Vinod Koul  2022-04-06  2166  			if (!dsc)
0f40ba48de3b8a4 Vinod Koul  2022-04-06  2167  				return -ENOMEM;
0f40ba48de3b8a4 Vinod Koul  2022-04-06  2168  			dsc->drm = panel->dsc;
0f40ba48de3b8a4 Vinod Koul  2022-04-06  2169  			msm_host->dsc = dsc;
0f40ba48de3b8a4 Vinod Koul  2022-04-06  2170  		}
0f40ba48de3b8a4 Vinod Koul  2022-04-06  2171  	}
0f40ba48de3b8a4 Vinod Koul  2022-04-06  2172  
8f7ca5409063ade Sibi Sankar 2018-05-29  2173  	ret = cfg_hnd->ops->tx_buf_alloc(msm_host, SZ_4K);
a689554ba6ed81c Hai Li      2015-03-31  2174  	if (ret) {
a689554ba6ed81c Hai Li      2015-03-31  2175  		pr_err("%s: alloc tx gem obj failed, %d\n", __func__, ret);
a689554ba6ed81c Hai Li      2015-03-31  2176  		return ret;
a689554ba6ed81c Hai Li      2015-03-31  2177  	}
a689554ba6ed81c Hai Li      2015-03-31  2178  
a689554ba6ed81c Hai Li      2015-03-31  2179  	return 0;
a689554ba6ed81c Hai Li      2015-03-31  2180  }
a689554ba6ed81c Hai Li      2015-03-31  2181  
Signature · 2 lines
0-DAY CI Kernel Test Service
https://01.org/lkp