Skip to contentSkip to conversation

drm/msm/dsi: add only dsi nodes with a valid device to list

PATCH In review Abhinav Kumar 4 participants 5 messages Jun 16, 2018 – Jun 19, 2018 2 messages not in the archive

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

PATCH 1/1 drm/msm/dsi: add only dsi nodes with a valid device to list

Before adding a DSI node to the private list check if the node has a valid device connected to it through an endpoint.

This is required in cases where the chipset supports multiple DSI hosts but only one of them is being used.

In the current implementation even inactive nodes get added resulting in creation of redundant connectors.

---
 drivers/gpu/drm/msm/dsi/dsi.c      |  6 +++++-
 drivers/gpu/drm/msm/dsi/dsi.h      |  1 +
 drivers/gpu/drm/msm/dsi/dsi_host.c | 10 ++++++++++
 3 files changed, 16 insertions(+), 1 deletion(-)
drivers/gpu/drm/msm/dsi/dsi.c +5 -1
index b744bcc..46a4906 100644
@@ -120,7 +120,11 @@ static int dsi_bind(struct device *dev, struct device *master, void *data)
 	if (IS_ERR(msm_dsi))
 		return PTR_ERR(msm_dsi);
 
-	priv->dsi[msm_dsi->id] = msm_dsi;
+	/* Add only the host which has a device attached to it */
+	if (msm_dsi_has_valid_device(msm_dsi->host)) {
+		pr_info("id = %d has valid device\n", msm_dsi->id);
+		priv->dsi[msm_dsi->id] = msm_dsi;
+	}
 
 	return 0;
 }
drivers/gpu/drm/msm/dsi/dsi.h +1 -0
index 70d9a9a..aa198ef 100644
@@ -180,6 +180,7 @@ void msm_dsi_host_get_phy_clk_req(struct mipi_dsi_host *host,
 int msm_dsi_host_modeset_init(struct mipi_dsi_host *host,
 					struct drm_device *dev);
 int msm_dsi_host_init(struct msm_dsi *msm_dsi);
+bool msm_dsi_has_valid_device(struct mipi_dsi_host *host);
 int msm_dsi_runtime_suspend(struct device *dev);
 int msm_dsi_runtime_resume(struct device *dev);
 
drivers/gpu/drm/msm/dsi/dsi_host.c +10 -0
index 2f1a278..25d65e5 100644
@@ -470,6 +470,16 @@ static void dsi_bus_clk_disable(struct msm_dsi_host *msm_host)
 		clk_disable_unprepare(msm_host->bus_clks[i]);
 }
 
+bool msm_dsi_has_valid_device(struct mipi_dsi_host *host)
+{
+	struct msm_dsi_host *msm_host = to_msm_dsi_host(host);
+
+	if (msm_host->device_node)
+		return true;
+
+	return false;
+}
+
 int msm_dsi_runtime_suspend(struct device *dev)
 {
 	struct platform_device *pdev = to_platform_device(dev);
Signature · 7 lines
The Qualcomm Innovation Center, Inc. is a member of the Code Aurora Forum,
a Linux Foundation Collaborative Project

_______________________________________________
Freedreno mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/freedreno

A message that is not in the archive (sent off-list or not yet received): 1529129157-13754-1-git-send-email-abhinavk-sgV2jX0FEOL9JmXXK+q4OQ@public.gmane.org

#2 lore raw
Quoted 21 lines · Abhinav Kumar

Before adding a DSI node to the private list check if the node has a valid device connected to it through an endpoint.

This is required in cases where the chipset supports multiple DSI hosts but only one of them is being used.

In the current implementation even inactive nodes get added resulting in creation of redundant connectors.

---
 drivers/gpu/drm/msm/dsi/dsi.c      |  6 +++++-
 drivers/gpu/drm/msm/dsi/dsi.h      |  1 +
 drivers/gpu/drm/msm/dsi/dsi_host.c | 10 ++++++++++
 3 files changed, 16 insertions(+), 1 deletion(-)
drivers/gpu/drm/msm/dsi/dsi.c +0 -0
index b744bcc..46a4906 100644

drivers/gpu/drm/msm/dsi/dsi.c static int dsi_bind(struct device *dev, struct device *master, void *data) · line 125

Quoted 7 lines
drivers/gpu/drm/msm/dsi/dsi.c +3 -1
@@ -120,7 +120,11 @@ static int dsi_bind(struct device *dev, struct device *master, void *data)
 	if (IS_ERR(msm_dsi))
 		return PTR_ERR(msm_dsi);
 
-	priv->dsi[msm_dsi->id] = msm_dsi;
+	/* Add only the host which has a device attached to it */
+	if (msm_dsi_has_valid_device(msm_dsi->host)) {
+		pr_info("id = %d has valid device\n", msm_dsi->id);

This seems like a debug message that slipped through.

Quoted 23 lines
drivers/gpu/drm/msm/dsi/dsi.c +2 -0
+		priv->dsi[msm_dsi->id] = msm_dsi;
+	}
 
 	return 0;
 }
drivers/gpu/drm/msm/dsi/dsi.h +1 -0
index 70d9a9a..aa198ef 100644
@@ -180,6 +180,7 @@ void msm_dsi_host_get_phy_clk_req(struct mipi_dsi_host *host,
 int msm_dsi_host_modeset_init(struct mipi_dsi_host *host,
 					struct drm_device *dev);
 int msm_dsi_host_init(struct msm_dsi *msm_dsi);
+bool msm_dsi_has_valid_device(struct mipi_dsi_host *host);
 int msm_dsi_runtime_suspend(struct device *dev);
 int msm_dsi_runtime_resume(struct device *dev);
 
drivers/gpu/drm/msm/dsi/dsi_host.c +0 -0
index 2f1a278..25d65e5 100644
@@ -470,6 +470,16 @@ static void dsi_bus_clk_disable(struct msm_dsi_host *msm_host)
 		clk_disable_unprepare(msm_host->bus_clks[i]);

drivers/gpu/drm/msm/dsi/dsi_host.c static void dsi_bus_clk_disable(struct msm_dsi_host *msm_host) · line 480

Quoted 10 lines
drivers/gpu/drm/msm/dsi/dsi_host.c +8 -0
 }
 
+bool msm_dsi_has_valid_device(struct mipi_dsi_host *host)
+{
+	struct msm_dsi_host *msm_host = to_msm_dsi_host(host);
+
+	if (msm_host->device_node)
+		return true;
+
+	return false;

Nit, return (msm_host->device_node) ? true : false; works just as well.

Quoted 5 lines
drivers/gpu/drm/msm/dsi/dsi_host.c +2 -0
+}
+
 int msm_dsi_runtime_suspend(struct device *dev)
 {
 	struct platform_device *pdev = to_platform_device(dev);
Signature · 6 lines
The Qualcomm Innovation Center, Inc. is a member of Code Aurora Forum,
a Linux Foundation Collaborative Project
_______________________________________________
Freedreno mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/freedreno
#3 lore raw

Hi Jordan

Thanks for the review.

Comments inline.

Abhinav

Quoted 26 lines · Jordan Crouse
Quoted 25 lines · Abhinav Kumar

Before adding a DSI node to the private list check if the node has a valid device connected to it through an endpoint.

This is required in cases where the chipset supports multiple DSI hosts but only one of them is being used.

In the current implementation even inactive nodes get added resulting in creation of redundant connectors.

---
 drivers/gpu/drm/msm/dsi/dsi.c      |  6 +++++-
 drivers/gpu/drm/msm/dsi/dsi.h      |  1 +
 drivers/gpu/drm/msm/dsi/dsi_host.c | 10 ++++++++++
 3 files changed, 16 insertions(+), 1 deletion(-)
drivers/gpu/drm/msm/dsi/dsi.c +0 -0
index b744bcc..46a4906 100644
@@ -120,7 +120,11 @@ static int dsi_bind(struct device *dev, struct 
 device *master, void *data)
 	if (IS_ERR(msm_dsi))
 		return PTR_ERR(msm_dsi);
 
Quoted 6 lines

drivers/gpu/drm/msm/dsi/dsi.c static int dsi_bind(struct device *dev, struct device *master, void *data) · line 125

Quoted 4 lines
drivers/gpu/drm/msm/dsi/dsi.c +3 -1
-	priv->dsi[msm_dsi->id] = msm_dsi;
+	/* Add only the host which has a device attached to it */
+	if (msm_dsi_has_valid_device(msm_dsi->host)) {
+		pr_info("id = %d has valid device\n", msm_dsi->id);

This seems like a debug message that slipped through.

[Abhinav] No, this was intentionally added. This will be printed only at probe and at most 2 times. This gives the information about how many devices have been initialized.

Quoted 28 lines
Quoted 28 lines
drivers/gpu/drm/msm/dsi/dsi.c +2 -0
+		priv->dsi[msm_dsi->id] = msm_dsi;
+	}
 
 	return 0;

}

drivers/gpu/drm/msm/dsi/dsi.h +1 -0
index 70d9a9a..aa198ef 100644
@@ -180,6 +180,7 @@ void msm_dsi_host_get_phy_clk_req(struct 
 mipi_dsi_host *host,
 int msm_dsi_host_modeset_init(struct mipi_dsi_host *host,
 					struct drm_device *dev);
 int msm_dsi_host_init(struct msm_dsi *msm_dsi);
+bool msm_dsi_has_valid_device(struct mipi_dsi_host *host);
 int msm_dsi_runtime_suspend(struct device *dev);
 int msm_dsi_runtime_resume(struct device *dev);
drivers/gpu/drm/msm/dsi/dsi_host.c +0 -0
index 2f1a278..25d65e5 100644
@@ -470,6 +470,16 @@ static void dsi_bus_clk_disable(struct 
 msm_dsi_host *msm_host)
 		clk_disable_unprepare(msm_host->bus_clks[i]);
 }
 
Quoted 10 lines

drivers/gpu/drm/msm/dsi/dsi_host.c static void dsi_bus_clk_disable(struct msm_dsi_host *msm_host) · line 480

Quoted 8 lines
drivers/gpu/drm/msm/dsi/dsi_host.c +8 -0
+bool msm_dsi_has_valid_device(struct mipi_dsi_host *host)
+{
+	struct msm_dsi_host *msm_host = to_msm_dsi_host(host);
+
+	if (msm_host->device_node)
+		return true;
+
+	return false;

Nit, return (msm_host->device_node) ? true : false; works just as well.

[Abhinav] Alright, will make this change in V2

Quoted 6 lines
Quoted 6 lines
drivers/gpu/drm/msm/dsi/dsi_host.c +2 -0
+}
+
 int msm_dsi_runtime_suspend(struct device *dev)
 {

struct platform_device *pdev = to_platform_device(dev);

_______________________________________________
dri-devel mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/dri-devel

A message that is not in the archive (sent off-list or not yet received): 495414ff4d9b852f26e3e5a7a2c72c4f-sgV2jX0FEOL9JmXXK+q4OQ@public.gmane.org

#5 lore raw
Quoted 41 lines · On Mon, Jun 18, 2018 at 03:11:44PM -0700, [email protected] wrote:

Hi Jordan

Thanks for the review.

Comments inline.

Abhinav

Quoted 27 lines · Jordan Crouse
Quoted 26 lines · Abhinav Kumar

Before adding a DSI node to the private list check if the node has a valid device connected to it through an endpoint.

This is required in cases where the chipset supports multiple DSI hosts but only one of them is being used.

In the current implementation even inactive nodes get added resulting in creation of redundant connectors.

---

drivers/gpu/drm/msm/dsi/dsi.c      |  6 +++++-
drivers/gpu/drm/msm/dsi/dsi.h      |  1 +
drivers/gpu/drm/msm/dsi/dsi_host.c | 10 ++++++++++
3 files changed, 16 insertions(+), 1 deletion(-)
drivers/gpu/drm/msm/dsi/dsi.c +0 -0
index b744bcc..46a4906 100644
@@ -120,7 +120,11 @@ static int dsi_bind(struct device *dev,
 struct device *master, void *data)
 	if (IS_ERR(msm_dsi))
 		return PTR_ERR(msm_dsi);
 
Quoted 6 lines

drivers/gpu/drm/msm/dsi/dsi.c static int dsi_bind(struct device *dev, struct device *master, void *data) · line 125

Quoted 4 lines
drivers/gpu/drm/msm/dsi/dsi.c +3 -1
-	priv->dsi[msm_dsi->id] = msm_dsi;
+	/* Add only the host which has a device attached to it */
+	if (msm_dsi_has_valid_device(msm_dsi->host)) {
+		pr_info("id = %d has valid device\n", msm_dsi->id);

This seems like a debug message that slipped through.

Quoted 3 lines

[Abhinav] No, this was intentionally added. This will be printed only at probe and at most 2 times.
This gives the information about how many devices have been initialized.

If that is the case then it should be properly constructed. It should use dev_info like the rest of the messages in this file and it should be written in simple present tense with the end user in mind as an audience. Something like:

dev_info(dev, "DSI device %d is valid\n", msm_dsi->id);

or

dev_info(dev, ""DSI device %d is initialized\n", msm_dsi->id);

Jordan

Signature · 6 lines
The Qualcomm Innovation Center, Inc. is a member of Code Aurora Forum,
a Linux Foundation Collaborative Project
_______________________________________________
Freedreno mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/freedreno
Reviewed-by
#6 lore raw
In reply to a message not in the archive
Quoted 8 lines · Abhinav Kumar

Before adding a DSI node to the private list check if the node has a valid device connected to it through an endpoint.

This is required in cases where the chipset supports multiple DSI hosts but only one of them is being used.

In the current implementation even inactive nodes get added resulting in creation of redundant connectors.

Quoted 49 lines
---
  drivers/gpu/drm/msm/dsi/dsi.c      |  6 +++++-
  drivers/gpu/drm/msm/dsi/dsi.h      |  1 +
  drivers/gpu/drm/msm/dsi/dsi_host.c | 10 ++++++++++
  3 files changed, 16 insertions(+), 1 deletion(-)
drivers/gpu/drm/msm/dsi/dsi.c +5 -1
index b744bcc..46a4906 100644
@@ -120,7 +120,11 @@ static int dsi_bind(struct device *dev, struct device *master, void *data)
  	if (IS_ERR(msm_dsi))
  		return PTR_ERR(msm_dsi);
 
-	priv->dsi[msm_dsi->id] = msm_dsi;
+	/* Add only the host which has a device attached to it */
+	if (msm_dsi_has_valid_device(msm_dsi->host)) {
+		pr_info("id = %d has valid device\n", msm_dsi->id);
+		priv->dsi[msm_dsi->id] = msm_dsi;
+	}
 
  	return 0;
  }
drivers/gpu/drm/msm/dsi/dsi.h +1 -0
index 70d9a9a..aa198ef 100644
@@ -180,6 +180,7 @@ void msm_dsi_host_get_phy_clk_req(struct mipi_dsi_host *host,
  int msm_dsi_host_modeset_init(struct mipi_dsi_host *host,
  					struct drm_device *dev);
  int msm_dsi_host_init(struct msm_dsi *msm_dsi);
+bool msm_dsi_has_valid_device(struct mipi_dsi_host *host);
  int msm_dsi_runtime_suspend(struct device *dev);
  int msm_dsi_runtime_resume(struct device *dev);
 
drivers/gpu/drm/msm/dsi/dsi_host.c +3 -0
index 2f1a278..25d65e5 100644
@@ -470,6 +470,16 @@ static void dsi_bus_clk_disable(struct msm_dsi_host *msm_host)
  		clk_disable_unprepare(msm_host->bus_clks[i]);
  }
 
+bool msm_dsi_has_valid_device(struct mipi_dsi_host *host)
+{
+	struct msm_dsi_host *msm_host = to_msm_dsi_host(host);

drivers/gpu/drm/msm/dsi/dsi_host.c static void dsi_bus_clk_disable(struct msm_dsi_host *msm_host) · line 485

Quoted 10 lines
drivers/gpu/drm/msm/dsi/dsi_host.c +7 -0
+
+	if (msm_host->device_node)
+		return true;
+
+	return false;
+}
+
  int msm_dsi_runtime_suspend(struct device *dev)
  {
  	struct platform_device *pdev = to_platform_device(dev);

_______________________________________________
Freedreno mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/freedreno