Skip to contentSkip to conversation

drm/bridge: ti-sn65dsi86: debugfs and mode_flags fix

PATCH Applied Rob Clark 4 participants 17 messages Jul 2, 2019 – Jul 4, 2019

Subsystems (5)
lore
Share & tools
lore

Rob Clark

author
#0 lore raw

cover drm/bridge: ti-sn65dsi86: debugfs and mode_flags fix

From: Rob Clark <[email protected]>

In process of debugging panel on my lenovo yoga c630, I noticed some errors in the dsi->mode_flags, which I guess were just cargo-cult'd?

Since dumping the status regs was useful to notice this problem, I cleaned it up and turned it into debugfs. The last patch corrects the mode_flags.

Tested on cheza and c630.

Rob Clark (3):
drm/bridge: ti-sn65dsi86: add link to datasheet drm/bridge: ti-sn65dsi86: add debugfs drm/bridge: ti-sn65dsi86: correct dsi mode_flags

 drivers/gpu/drm/bridge/ti-sn65dsi86.c | 46 +++++++++++++++++++++++++--
 1 file changed, 44 insertions(+), 2 deletions(-)
Signature · 6 lines
2.20.1

_______________________________________________
dri-devel mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/dri-devel
author
#1 lore raw

PATCH 1/3 drm/bridge: ti-sn65dsi86: add link to datasheet

From: Rob Clark <[email protected]>

The bridge has pretty good docs, lets add a link to make them easier to find.

---
 drivers/gpu/drm/bridge/ti-sn65dsi86.c | 1 +
 1 file changed, 1 insertion(+)
drivers/gpu/drm/bridge/ti-sn65dsi86.c +1 -0
index bcca9173c72a..f1a2493b86d9 100644
@@ -1,6 +1,7 @@
 // SPDX-License-Identifier: GPL-2.0
 /*
  * Copyright (c) 2018, The Linux Foundation. All rights reserved.
+ * datasheet: http://www.ti.com/lit/ds/symlink/sn65dsi86.pdf
  */
 
 #include <linux/clk.h>
Signature · 1 line
2.20.1
Reviewed-by on v1 1/3
#3 lore raw

Re: [PATCH 1/3] drm/bridge: ti-sn65dsi86: add link to datasheet

In reply to Rob Clark
Quoted 6 lines · Rob Clark

From: Rob Clark <[email protected]>

The bridge has pretty good docs, lets add a link to make them easier to find.

 --
Regards
Andrzej

Quoted 16 lines
---
 drivers/gpu/drm/bridge/ti-sn65dsi86.c | 1 +
 1 file changed, 1 insertion(+)
drivers/gpu/drm/bridge/ti-sn65dsi86.c +1 -0
index bcca9173c72a..f1a2493b86d9 100644
@@ -1,6 +1,7 @@
 // SPDX-License-Identifier: GPL-2.0
 /*
  * Copyright (c) 2018, The Linux Foundation. All rights reserved.
+ * datasheet: http://www.ti.com/lit/ds/symlink/sn65dsi86.pdf
  */
 
 #include <linux/clk.h>
#4 lore raw

Re: [PATCH 1/3] drm/bridge: ti-sn65dsi86: add link to datasheet

In reply to Rob Clark

Hi Rob,

Thank you for the patch.

Quoted 15 lines · Rob Clark

From: Rob Clark <[email protected]>

The bridge has pretty good docs, lets add a link to make them easier to find.

---
 drivers/gpu/drm/bridge/ti-sn65dsi86.c | 1 +
 1 file changed, 1 insertion(+)
drivers/gpu/drm/bridge/ti-sn65dsi86.c +0 -0
index bcca9173c72a..f1a2493b86d9 100644

drivers/gpu/drm/bridge/ti-sn65dsi86.c line 4

Quoted 4 lines
drivers/gpu/drm/bridge/ti-sn65dsi86.c +1 -0
@@ -1,6 +1,7 @@
 // SPDX-License-Identifier: GPL-2.0
 /*
  * Copyright (c) 2018, The Linux Foundation. All rights reserved.
+ * datasheet: http://www.ti.com/lit/ds/symlink/sn65dsi86.pdf

It's in the DT bindings and it's easy to find so I'm not sure it adds lots of value to mention it here, but I don't feel very strongly about it, so if you think it can be useful I don't mind. I would however put a blank line after the copyright line in that case, and s/datasheet/Datasheet/

Quoted 3 lines
drivers/gpu/drm/bridge/ti-sn65dsi86.c +0 -0
  */
 
 #include <linux/clk.h>
Signature · 3 lines
Regards,

Laurent Pinchart
author
#5 lore raw

PATCH 2/3 drm/bridge: ti-sn65dsi86: add debugfs

In reply to Rob Clark

From: Rob Clark <[email protected]>

Add a debugfs file to show status registers.

---
 drivers/gpu/drm/bridge/ti-sn65dsi86.c | 42 +++++++++++++++++++++++++++
 1 file changed, 42 insertions(+)
drivers/gpu/drm/bridge/ti-sn65dsi86.c +42 -0
index f1a2493b86d9..a6f27648c015 100644
@@ -5,6 +5,7 @@
  */
 
 #include <linux/clk.h>
+#include <linux/debugfs.h>
 #include <linux/gpio/consumer.h>
 #include <linux/i2c.h>
 #include <linux/iopoll.h>
@@ -109,6 +110,7 @@ struct ti_sn_bridge {
 	struct drm_dp_aux		aux;
 	struct drm_bridge		bridge;
 	struct drm_connector		connector;
+	struct dentry			*debugfs;
 	struct device_node		*host_node;
 	struct mipi_dsi_device		*dsi;
 	struct clk			*refclk;
@@ -178,6 +180,42 @@ static const struct dev_pm_ops ti_sn_bridge_pm_ops = {
 	SET_RUNTIME_PM_OPS(ti_sn_bridge_suspend, ti_sn_bridge_resume, NULL)
 };
 
+static int status_show(struct seq_file *s, void *data)
+{
+	struct ti_sn_bridge *pdata = s->private;
+	unsigned int reg, val;
+
+	seq_puts(s, "STATUS REGISTERS:\n");
+
+	pm_runtime_get_sync(pdata->dev);
+
+	/* IRQ Status Registers, see Table 31 in datasheet */
+	for (reg = 0xf0; reg <= 0xf8; reg++) {
+		regmap_read(pdata->regmap, reg, &val);
+		seq_printf(s, "[0x%02x] = 0x%08x\n", reg, val);
+	}
+
+	pm_runtime_put(pdata->dev);
+
+	return 0;
+}
+
+DEFINE_SHOW_ATTRIBUTE(status);
+
+static void ti_sn_debugfs_init(struct ti_sn_bridge *pdata)
+{
+	pdata->debugfs = debugfs_create_dir("ti_sn65dsi86", NULL);
+
+	debugfs_create_file("status", 0600, pdata->debugfs, pdata,
+			&status_fops);
+}
+
+static void ti_sn_debugfs_remove(struct ti_sn_bridge *pdata)
+{
+	debugfs_remove_recursive(pdata->debugfs);
+	pdata->debugfs = NULL;
+}
+
 /* Connector funcs */
 static struct ti_sn_bridge *
 connector_to_ti_sn_bridge(struct drm_connector *connector)
@@ -869,6 +907,8 @@ static int ti_sn_bridge_probe(struct i2c_client *client,
 
 	drm_bridge_add(&pdata->bridge);
 
+	ti_sn_debugfs_init(pdata);
+
 	return 0;
 }
 
@@ -879,6 +919,8 @@ static int ti_sn_bridge_remove(struct i2c_client *client)
 	if (!pdata)
 		return -EINVAL;
 
+	ti_sn_debugfs_remove(pdata);
+
 	of_node_put(pdata->host_node);
 
 	pm_runtime_disable(pdata->dev);
Signature · 1 line
2.20.1
Reviewed-by on v1 2/3
#7 lore raw

Re: [PATCH 2/3] drm/bridge: ti-sn65dsi86: add debugfs

In reply to Rob Clark
Quoted 48 lines · Rob Clark

From: Rob Clark <[email protected]>

Add a debugfs file to show status registers.

---
 drivers/gpu/drm/bridge/ti-sn65dsi86.c | 42 +++++++++++++++++++++++++++
 1 file changed, 42 insertions(+)
drivers/gpu/drm/bridge/ti-sn65dsi86.c +17 -0
index f1a2493b86d9..a6f27648c015 100644
@@ -5,6 +5,7 @@
  */
 
 #include <linux/clk.h>
+#include <linux/debugfs.h>
 #include <linux/gpio/consumer.h>
 #include <linux/i2c.h>
 #include <linux/iopoll.h>
@@ -109,6 +110,7 @@ struct ti_sn_bridge {
 	struct drm_dp_aux		aux;
 	struct drm_bridge		bridge;
 	struct drm_connector		connector;
+	struct dentry			*debugfs;
 	struct device_node		*host_node;
 	struct mipi_dsi_device		*dsi;
 	struct clk			*refclk;
@@ -178,6 +180,42 @@ static const struct dev_pm_ops ti_sn_bridge_pm_ops = {
 	SET_RUNTIME_PM_OPS(ti_sn_bridge_suspend, ti_sn_bridge_resume, NULL)
 };
 
+static int status_show(struct seq_file *s, void *data)
+{
+	struct ti_sn_bridge *pdata = s->private;
+	unsigned int reg, val;
+
+	seq_puts(s, "STATUS REGISTERS:\n");
+
+	pm_runtime_get_sync(pdata->dev);
+
+	/* IRQ Status Registers, see Table 31 in datasheet */
+	for (reg = 0xf0; reg <= 0xf8; reg++) {
+		regmap_read(pdata->regmap, reg, &val);
+		seq_printf(s, "[0x%02x] = 0x%08x\n", reg, val);
+	}
+

drivers/gpu/drm/bridge/ti-sn65dsi86.c static const struct dev_pm_ops ti_sn_bridge_pm_ops = { · line 207

Quoted 10 lines
drivers/gpu/drm/bridge/ti-sn65dsi86.c +10 -0
+	pm_runtime_put(pdata->dev);
+
+	return 0;
+}
+
+DEFINE_SHOW_ATTRIBUTE(status);
+
+static void ti_sn_debugfs_init(struct ti_sn_bridge *pdata)
+{
+	pdata->debugfs = debugfs_create_dir("ti_sn65dsi86", NULL);

If some day we will have board with two such bridges there will be a problem.

Anyway:

 --
Regards
Andrzej

Quoted 32 lines
drivers/gpu/drm/bridge/ti-sn65dsi86.c +15 -0
+
+	debugfs_create_file("status", 0600, pdata->debugfs, pdata,
+			&status_fops);
+}
+
+static void ti_sn_debugfs_remove(struct ti_sn_bridge *pdata)
+{
+	debugfs_remove_recursive(pdata->debugfs);
+	pdata->debugfs = NULL;
+}
+
 /* Connector funcs */
 static struct ti_sn_bridge *
 connector_to_ti_sn_bridge(struct drm_connector *connector)
@@ -869,6 +907,8 @@ static int ti_sn_bridge_probe(struct i2c_client *client,
 
 	drm_bridge_add(&pdata->bridge);
 
+	ti_sn_debugfs_init(pdata);
+
 	return 0;
 }
 
@@ -879,6 +919,8 @@ static int ti_sn_bridge_remove(struct i2c_client *client)
 	if (!pdata)
 		return -EINVAL;
 
+	ti_sn_debugfs_remove(pdata);
+
 	of_node_put(pdata->host_node);
 
 	pm_runtime_disable(pdata->dev);
#8 lore raw

Re: [PATCH 2/3] drm/bridge: ti-sn65dsi86: add debugfs

Hello,

Quoted 34 lines · Andrzej Hajda
Quoted 33 lines · Rob Clark

From: Rob Clark <[email protected]>

Add a debugfs file to show status registers.

---
 drivers/gpu/drm/bridge/ti-sn65dsi86.c | 42 +++++++++++++++++++++++++++
 1 file changed, 42 insertions(+)
drivers/gpu/drm/bridge/ti-sn65dsi86.c +2 -0
index f1a2493b86d9..a6f27648c015 100644
@@ -5,6 +5,7 @@
  */
 
 #include <linux/clk.h>
+#include <linux/debugfs.h>
 #include <linux/gpio/consumer.h>
 #include <linux/i2c.h>
 #include <linux/iopoll.h>
@@ -109,6 +110,7 @@ struct ti_sn_bridge {
 	struct drm_dp_aux		aux;
 	struct drm_bridge		bridge;
 	struct drm_connector		connector;
+	struct dentry			*debugfs;
 	struct device_node		*host_node;
 	struct mipi_dsi_device		*dsi;
 	struct clk			*refclk;
@@ -178,6 +180,42 @@ static const struct dev_pm_ops ti_sn_bridge_pm_ops = {
 	SET_RUNTIME_PM_OPS(ti_sn_bridge_suspend, ti_sn_bridge_resume, NULL)
 };
 
Quoted 6 lines

drivers/gpu/drm/bridge/ti-sn65dsi86.c static const struct dev_pm_ops ti_sn_bridge_pm_ops = { · line 188

Quoted 6 lines
drivers/gpu/drm/bridge/ti-sn65dsi86.c +6 -0
+static int status_show(struct seq_file *s, void *data)
+{
+	struct ti_sn_bridge *pdata = s->private;
+	unsigned int reg, val;
+
+	seq_puts(s, "STATUS REGISTERS:\n");

NO NEED TO SHOUT :-)

Quoted 14 lines
Quoted 14 lines
drivers/gpu/drm/bridge/ti-sn65dsi86.c +14 -0
+
+	pm_runtime_get_sync(pdata->dev);
+
+	/* IRQ Status Registers, see Table 31 in datasheet */
+	for (reg = 0xf0; reg <= 0xf8; reg++) {
+		regmap_read(pdata->regmap, reg, &val);
+		seq_printf(s, "[0x%02x] = 0x%08x\n", reg, val);
+	}
+
+	pm_runtime_put(pdata->dev);
+
+	return 0;
+}
+
Quoted 8 lines

drivers/gpu/drm/bridge/ti-sn65dsi86.c static const struct dev_pm_ops ti_sn_bridge_pm_ops = { · line 207

Quoted 5 lines
drivers/gpu/drm/bridge/ti-sn65dsi86.c +5 -0
+DEFINE_SHOW_ATTRIBUTE(status);
+
+static void ti_sn_debugfs_init(struct ti_sn_bridge *pdata)
+{
+	pdata->debugfs = debugfs_create_dir("ti_sn65dsi86", NULL);

If some day we will have board with two such bridges there will be a problem.

Could we use the platform device name for this ?

Quoted 4 lines

Anyway:

Quoted 11 lines

drivers/gpu/drm/bridge/ti-sn65dsi86.c static const struct dev_pm_ops ti_sn_bridge_pm_ops = { · line 218

Quoted 11 lines
drivers/gpu/drm/bridge/ti-sn65dsi86.c +11 -0
+
+	debugfs_create_file("status", 0600, pdata->debugfs, pdata,
+			&status_fops);
+}
+
+static void ti_sn_debugfs_remove(struct ti_sn_bridge *pdata)
+{
+	debugfs_remove_recursive(pdata->debugfs);
+	pdata->debugfs = NULL;
+}
+

You need to conditionally-compile this based on CONFIG_DEBUG_FS.

Quoted 21 lines
Quoted 21 lines
drivers/gpu/drm/bridge/ti-sn65dsi86.c +4 -0
 /* Connector funcs */
 static struct ti_sn_bridge *
 connector_to_ti_sn_bridge(struct drm_connector *connector)
@@ -869,6 +907,8 @@ static int ti_sn_bridge_probe(struct i2c_client *client,
 
 	drm_bridge_add(&pdata->bridge);
 
+	ti_sn_debugfs_init(pdata);
+
 	return 0;
 }
 
@@ -879,6 +919,8 @@ static int ti_sn_bridge_remove(struct i2c_client *client)
 	if (!pdata)
 		return -EINVAL;
 
+	ti_sn_debugfs_remove(pdata);
+
 	of_node_put(pdata->host_node);
 
 	pm_runtime_disable(pdata->dev);
Signature · 3 lines
Regards,

Laurent Pinchart
author
#9 lore raw

Re: [PATCH 2/3] drm/bridge: ti-sn65dsi86: add debugfs

Quoted 70 lines · Laurent Pinchart

Hello,

Quoted 34 lines · Andrzej Hajda
Quoted 33 lines · Rob Clark

From: Rob Clark <[email protected]>

Add a debugfs file to show status registers.

---
 drivers/gpu/drm/bridge/ti-sn65dsi86.c | 42 +++++++++++++++++++++++++++
 1 file changed, 42 insertions(+)
drivers/gpu/drm/bridge/ti-sn65dsi86.c +2 -0
index f1a2493b86d9..a6f27648c015 100644
@@ -5,6 +5,7 @@
  */
 
 #include <linux/clk.h>
+#include <linux/debugfs.h>
 #include <linux/gpio/consumer.h>
 #include <linux/i2c.h>
 #include <linux/iopoll.h>
@@ -109,6 +110,7 @@ struct ti_sn_bridge {
    struct drm_dp_aux               aux;
    struct drm_bridge               bridge;
    struct drm_connector            connector;
+   struct dentry                   *debugfs;
    struct device_node              *host_node;
    struct mipi_dsi_device          *dsi;
    struct clk                      *refclk;
@@ -178,6 +180,42 @@ static const struct dev_pm_ops ti_sn_bridge_pm_ops = {
    SET_RUNTIME_PM_OPS(ti_sn_bridge_suspend, ti_sn_bridge_resume, NULL)
 };
 
Quoted 6 lines

drivers/gpu/drm/bridge/ti-sn65dsi86.c static const struct dev_pm_ops ti_sn_bridge_pm_ops = { · line 188

Quoted 6 lines
drivers/gpu/drm/bridge/ti-sn65dsi86.c +6 -0
+static int status_show(struct seq_file *s, void *data)
+{
+   struct ti_sn_bridge *pdata = s->private;
+   unsigned int reg, val;
+
+   seq_puts(s, "STATUS REGISTERS:\n");

NO NEED TO SHOUT :-)

Quoted 14 lines
Quoted 14 lines
drivers/gpu/drm/bridge/ti-sn65dsi86.c +14 -0
+
+   pm_runtime_get_sync(pdata->dev);
+
+   /* IRQ Status Registers, see Table 31 in datasheet */
+   for (reg = 0xf0; reg <= 0xf8; reg++) {
+           regmap_read(pdata->regmap, reg, &val);
+           seq_printf(s, "[0x%02x] = 0x%08x\n", reg, val);
+   }
+
+   pm_runtime_put(pdata->dev);
+
+   return 0;
+}
+
Quoted 8 lines

drivers/gpu/drm/bridge/ti-sn65dsi86.c static const struct dev_pm_ops ti_sn_bridge_pm_ops = { · line 207

Quoted 5 lines
drivers/gpu/drm/bridge/ti-sn65dsi86.c +5 -0
+DEFINE_SHOW_ATTRIBUTE(status);
+
+static void ti_sn_debugfs_init(struct ti_sn_bridge *pdata)
+{
+   pdata->debugfs = debugfs_create_dir("ti_sn65dsi86", NULL);

If some day we will have board with two such bridges there will be a problem.

Quoted 1 line

Could we use the platform device name for this ?

hmm, yeah, that would solve the 2x bridges issue

Quoted 4 lines
Quoted 4 lines

Anyway:

Quoted 13 lines
Quoted 11 lines

drivers/gpu/drm/bridge/ti-sn65dsi86.c static const struct dev_pm_ops ti_sn_bridge_pm_ops = { · line 218

Quoted 11 lines
drivers/gpu/drm/bridge/ti-sn65dsi86.c +11 -0
+
+   debugfs_create_file("status", 0600, pdata->debugfs, pdata,
+                   &status_fops);
+}
+
+static void ti_sn_debugfs_remove(struct ti_sn_bridge *pdata)
+{
+   debugfs_remove_recursive(pdata->debugfs);
+   pdata->debugfs = NULL;
+}
+

You need to conditionally-compile this based on CONFIG_DEBUG_FS.

Hmm, is that really true? Debugfs appears to be sufficently stub'd w/ inline no-ops in the !CONFIG_DEBUG_FS case

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

#10 lore raw

Re: [PATCH 2/3] drm/bridge: ti-sn65dsi86: add debugfs

Hi Rob,

Quoted 90 lines · Rob Clark
Quoted 67 lines · Laurent Pinchart
Quoted 34 lines · Andrzej Hajda
Quoted 33 lines · Rob Clark

From: Rob Clark <[email protected]>

Add a debugfs file to show status registers.

---
 drivers/gpu/drm/bridge/ti-sn65dsi86.c | 42 +++++++++++++++++++++++++++
 1 file changed, 42 insertions(+)
drivers/gpu/drm/bridge/ti-sn65dsi86.c +2 -0
index f1a2493b86d9..a6f27648c015 100644
@@ -5,6 +5,7 @@
  */
 
 #include <linux/clk.h>
+#include <linux/debugfs.h>
 #include <linux/gpio/consumer.h>
 #include <linux/i2c.h>
 #include <linux/iopoll.h>
@@ -109,6 +110,7 @@ struct ti_sn_bridge {
    struct drm_dp_aux               aux;
    struct drm_bridge               bridge;
    struct drm_connector            connector;
+   struct dentry                   *debugfs;
    struct device_node              *host_node;
    struct mipi_dsi_device          *dsi;
    struct clk                      *refclk;
@@ -178,6 +180,42 @@ static const struct dev_pm_ops ti_sn_bridge_pm_ops = {
    SET_RUNTIME_PM_OPS(ti_sn_bridge_suspend, ti_sn_bridge_resume, NULL)
 };
 
Quoted 6 lines

drivers/gpu/drm/bridge/ti-sn65dsi86.c static const struct dev_pm_ops ti_sn_bridge_pm_ops = { · line 188

Quoted 6 lines
drivers/gpu/drm/bridge/ti-sn65dsi86.c +6 -0
+static int status_show(struct seq_file *s, void *data)
+{
+   struct ti_sn_bridge *pdata = s->private;
+   unsigned int reg, val;
+
+   seq_puts(s, "STATUS REGISTERS:\n");

NO NEED TO SHOUT :-)

Quoted 14 lines
Quoted 14 lines
drivers/gpu/drm/bridge/ti-sn65dsi86.c +14 -0
+
+   pm_runtime_get_sync(pdata->dev);
+
+   /* IRQ Status Registers, see Table 31 in datasheet */
+   for (reg = 0xf0; reg <= 0xf8; reg++) {
+           regmap_read(pdata->regmap, reg, &val);
+           seq_printf(s, "[0x%02x] = 0x%08x\n", reg, val);
+   }
+
+   pm_runtime_put(pdata->dev);
+
+   return 0;
+}
+
Quoted 8 lines

drivers/gpu/drm/bridge/ti-sn65dsi86.c static const struct dev_pm_ops ti_sn_bridge_pm_ops = { · line 207

Quoted 5 lines
drivers/gpu/drm/bridge/ti-sn65dsi86.c +5 -0
+DEFINE_SHOW_ATTRIBUTE(status);
+
+static void ti_sn_debugfs_init(struct ti_sn_bridge *pdata)
+{
+   pdata->debugfs = debugfs_create_dir("ti_sn65dsi86", NULL);

If some day we will have board with two such bridges there will be a problem.

Quoted 1 line

Could we use the platform device name for this ?

hmm, yeah, that would solve the 2x bridges issue

Quoted 4 lines
Quoted 4 lines

Anyway:

Quoted 13 lines
Quoted 11 lines

drivers/gpu/drm/bridge/ti-sn65dsi86.c static const struct dev_pm_ops ti_sn_bridge_pm_ops = { · line 218

Quoted 11 lines
drivers/gpu/drm/bridge/ti-sn65dsi86.c +11 -0
+
+   debugfs_create_file("status", 0600, pdata->debugfs, pdata,
+                   &status_fops);
+}
+
+static void ti_sn_debugfs_remove(struct ti_sn_bridge *pdata)
+{
+   debugfs_remove_recursive(pdata->debugfs);
+   pdata->debugfs = NULL;
+}
+

You need to conditionally-compile this based on CONFIG_DEBUG_FS.

Quoted 2 lines

Hmm, is that really true? Debugfs appears to be sufficently stub'd w/ inline no-ops in the !CONFIG_DEBUG_FS case

You're right, my bad. I wonder if the compiler will optimise the above two functions out. It might warrant a CONFIG_DEBUG_FS check here for that reason, but that's really bikeshedding. So with the 2x bridges issue addressed, I think the patch will be good.

Signature · 3 lines
Regards,

Laurent Pinchart
author
#11 lore raw

PATCH 3/3 drm/bridge: ti-sn65dsi86: correct dsi mode_flags

In reply to Rob Clark

From: Rob Clark <[email protected]>

Noticed while comparing register dump of how bootloader configures DSI vs how kernel configures. It seems the bridge still works either way, but fixing this clears the 'CHA_DATATYPE_ERR' error status bit.

---
 drivers/gpu/drm/bridge/ti-sn65dsi86.c | 3 +--
 1 file changed, 1 insertion(+), 2 deletions(-)
drivers/gpu/drm/bridge/ti-sn65dsi86.c +1 -2
index a6f27648c015..c8fb45e7b06d 100644
@@ -342,8 +342,7 @@ static int ti_sn_bridge_attach(struct drm_bridge *bridge)
 	/* TODO: setting to 4 lanes always for now */
 	dsi->lanes = 4;
 	dsi->format = MIPI_DSI_FMT_RGB888;
-	dsi->mode_flags = MIPI_DSI_MODE_VIDEO | MIPI_DSI_MODE_VIDEO_SYNC_PULSE |
-			  MIPI_DSI_MODE_EOT_PACKET | MIPI_DSI_MODE_VIDEO_HSE;
+	dsi->mode_flags = MIPI_DSI_MODE_VIDEO;
 
 	/* check if continuous dsi clock is required or not */
 	pm_runtime_get_sync(pdata->dev);
Signature · 1 line
2.20.1
#12 lore raw

Re: [PATCH 3/3] drm/bridge: ti-sn65dsi86: correct dsi mode_flags

Quoted 17 lines · Rob Clark

From: Rob Clark <[email protected]>

Noticed while comparing register dump of how bootloader configures DSI vs how kernel configures. It seems the bridge still works either way, but fixing this clears the 'CHA_DATATYPE_ERR' error status bit.

---
 drivers/gpu/drm/bridge/ti-sn65dsi86.c | 3 +--
 1 file changed, 1 insertion(+), 2 deletions(-)
drivers/gpu/drm/bridge/ti-sn65dsi86.c +0 -0
index a6f27648c015..c8fb45e7b06d 100644

drivers/gpu/drm/bridge/ti-sn65dsi86.c static int ti_sn_bridge_attach(struct drm_bridge *bridge) · line 345

Quoted 6 lines
drivers/gpu/drm/bridge/ti-sn65dsi86.c +1 -2
@@ -342,8 +342,7 @@ static int ti_sn_bridge_attach(struct drm_bridge *bridge)
        /* TODO: setting to 4 lanes always for now */
        dsi->lanes = 4;
        dsi->format = MIPI_DSI_FMT_RGB888;
-       dsi->mode_flags = MIPI_DSI_MODE_VIDEO | MIPI_DSI_MODE_VIDEO_SYNC_PULSE |
-                         MIPI_DSI_MODE_EOT_PACKET | MIPI_DSI_MODE_VIDEO_HSE;
+       dsi->mode_flags = MIPI_DSI_MODE_VIDEO;

Did you check this against the datasheet? Per my reading, EOT_PACKET and VIDEO_HSE appear valid. I don't know about VIDEO_SYNC_PULSE.

author
#13 lore raw

Re: [PATCH 3/3] drm/bridge: ti-sn65dsi86: correct dsi mode_flags

Quoted 14 lines · Jeffrey Hugo
Quoted 12 lines · Rob Clark

From: Rob Clark <[email protected]>

Noticed while comparing register dump of how bootloader configures DSI vs how kernel configures. It seems the bridge still works either way, but fixing this clears the 'CHA_DATATYPE_ERR' error status bit.

---
 drivers/gpu/drm/bridge/ti-sn65dsi86.c | 3 +--
 1 file changed, 1 insertion(+), 2 deletions(-)
Quoted 14 lines

drivers/gpu/drm/bridge/ti-sn65dsi86.c static int ti_sn_bridge_attach(struct drm_bridge *bridge) · line 345

Quoted 11 lines
drivers/gpu/drm/bridge/ti-sn65dsi86.c +1 -2
index a6f27648c015..c8fb45e7b06d 100644
@@ -342,8 +342,7 @@ static int ti_sn_bridge_attach(struct drm_bridge *bridge)
        /* TODO: setting to 4 lanes always for now */
        dsi->lanes = 4;
        dsi->format = MIPI_DSI_FMT_RGB888;
-       dsi->mode_flags = MIPI_DSI_MODE_VIDEO | MIPI_DSI_MODE_VIDEO_SYNC_PULSE |
-                         MIPI_DSI_MODE_EOT_PACKET | MIPI_DSI_MODE_VIDEO_HSE;
+       dsi->mode_flags = MIPI_DSI_MODE_VIDEO;

Did you check this against the datasheet? Per my reading, EOT_PACKET and VIDEO_HSE appear valid. I don't know about VIDEO_SYNC_PULSE.

The EOT flat is badly named:

/* disable EoT packets in HS mode */
#define MIPI_DSI_MODE_EOT_PACKET BIT(9)

I can double check out HSE, but this was one of the setting differences between bootloader and kernel

BR,
-R

Reviewed-by
#14 lore raw

Re: [PATCH 3/3] drm/bridge: ti-sn65dsi86: correct dsi mode_flags

Quoted 12 lines · Rob Clark
Quoted 9 lines · Jeffrey Hugo

drivers/gpu/drm/bridge/ti-sn65dsi86.c static int ti_sn_bridge_attach(struct drm_bridge *bridge) · line 345

Quoted 4 lines · Rob Clark
drivers/gpu/drm/bridge/ti-sn65dsi86.c +1 -2
-       dsi->mode_flags = MIPI_DSI_MODE_VIDEO | MIPI_DSI_MODE_VIDEO_SYNC_PULSE |
-                         MIPI_DSI_MODE_EOT_PACKET | MIPI_DSI_MODE_VIDEO_HSE;
+       dsi->mode_flags = MIPI_DSI_MODE_VIDEO;

Did you check this against the datasheet? Per my reading, EOT_PACKET and VIDEO_HSE appear valid. I don't know about VIDEO_SYNC_PULSE.

Quoted 7 lines

The EOT flat is badly named:

/* disable EoT packets in HS mode */
#define MIPI_DSI_MODE_EOT_PACKET BIT(9)

I can double check out HSE, but this was one of the setting differences between bootloader and kernel

Ah yeah, you are right. My eyes apparently skipped over the "disable".

If the bootloader is not setting the HSE, then I can't think of a reason why we would be having an issue also not setting it.

Seems good to me

Reviewed-by
#15 lore raw

Re: [PATCH 3/3] drm/bridge: ti-sn65dsi86: correct dsi mode_flags

Quoted 15 lines · Jeffrey Hugo
Quoted 7 lines · Rob Clark
Quoted 6 lines · Jeffrey Hugo

drivers/gpu/drm/bridge/ti-sn65dsi86.c static int ti_sn_bridge_attach(struct drm_bridge *bridge) · line 345

Quoted 3 lines · Rob Clark
drivers/gpu/drm/bridge/ti-sn65dsi86.c +1 -2
-       dsi->mode_flags = MIPI_DSI_MODE_VIDEO | MIPI_DSI_MODE_VIDEO_SYNC_PULSE |
-                         MIPI_DSI_MODE_EOT_PACKET | MIPI_DSI_MODE_VIDEO_HSE;
+       dsi->mode_flags = MIPI_DSI_MODE_VIDEO;

Did you check this against the datasheet? Per my reading, EOT_PACKET and VIDEO_HSE appear valid. I don't know about VIDEO_SYNC_PULSE.

Quoted 7 lines

The EOT flat is badly named:

/* disable EoT packets in HS mode */
#define MIPI_DSI_MODE_EOT_PACKET BIT(9)

I can double check out HSE, but this was one of the setting differences between bootloader and kernel

Quoted 10 lines

Ah yeah, you are right. My eyes apparently skipped over the "disable".

If the bootloader is not setting the HSE, then I can't think of a reason why we would be having an issue also not setting it.

Seems good to me

Yes, the flags require cleanup.

 --
Regards
Andrzej

#16 lore raw
In reply to Rob Clark
Quoted 11 lines · Rob Clark

From: Rob Clark <[email protected]>

In process of debugging panel on my lenovo yoga c630, I noticed some errors in the dsi->mode_flags, which I guess were just cargo-cult'd?

Since dumping the status regs was useful to notice this problem, I cleaned it up and turned it into debugfs. The last patch corrects the mode_flags.

Tested on cheza and c630.

Quoted 8 lines

Rob Clark (3):
drm/bridge: ti-sn65dsi86: add link to datasheet drm/bridge: ti-sn65dsi86: add debugfs drm/bridge: ti-sn65dsi86: correct dsi mode_flags

 drivers/gpu/drm/bridge/ti-sn65dsi86.c | 46 +++++++++++++++++++++++++--
 1 file changed, 44 insertions(+), 2 deletions(-)

Queued to drm-misc-next.

--
Regards
Andrzej

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