Skip to contentSkip to conversation

drm: xlnx: dp: Reset DisplayPort IP

PATCH In review Rohit Visavalia 4 participants 5 messages Feb 16, 2024 – Feb 29, 2024

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

PATCH 1/1 drm: xlnx: dp: Reset DisplayPort IP

Assert DisplayPort reset signal before deasserting,
it is to clear out any registers programmed before booting kernel.

---
 drivers/gpu/drm/xlnx/zynqmp_dp.c | 4 ++++
 1 file changed, 4 insertions(+)
drivers/gpu/drm/xlnx/zynqmp_dp.c +4 -0
index 1846c4971fd8..5a40aa1d4283 100644
@@ -1714,6 +1714,10 @@ int zynqmp_dp_probe(struct zynqmp_dpsub *dpsub)
 		goto err_free;
 	}
 
+	ret = zynqmp_dp_reset(dp, true);
+	if (ret < 0)
+		return ret;
+
 	ret = zynqmp_dp_reset(dp, false);
 	if (ret < 0)
 		goto err_free;
Signature · 1 line
2.25.1
Reviewed-by on v1 1/1
#1 lore raw

[AMD Official Use Only - General]

Hi Rohit,

Thanks for the patch.

Quoted 37 lines

-----Original Message-----
From: dri-devel <[email protected]> On Behalf Of Rohit Visavalia
Sent: Friday, February 16, 2024 1:41 PM
To: [email protected]; [email protected]; [email protected]; [email protected]; [email protected]; [email protected]; [email protected]; Simek, Michal <[email protected]>; [email protected]; linux-arm- [email protected]
Cc: [email protected]
Subject: [PATCH] drm: xlnx: dp: Reset DisplayPort IP

Assert DisplayPort reset signal before deasserting,
it is to clear out any registers programmed before booting kernel.

---
 drivers/gpu/drm/xlnx/zynqmp_dp.c | 4 ++++
 1 file changed, 4 insertions(+)
drivers/gpu/drm/xlnx/zynqmp_dp.c +4 -0
index 1846c4971fd8..5a40aa1d4283 100644
@@ -1714,6 +1714,10 @@ int zynqmp_dp_probe(struct zynqmp_dpsub
 *dpsub)
              goto err_free;
      }
 
+     ret = zynqmp_dp_reset(dp, true);
+     if (ret < 0)
+             return ret;
+
      ret = zynqmp_dp_reset(dp, false);
      if (ret < 0)
              goto err_free;
Quoted 2 lines

--
2.25.1

This looks good to me.

Regards
Vishal Sagar

maintainer Reviewed-by on v1 1/1
#2 lore raw
In reply to Rohit Visavalia

Hello Rohit,

Thank you for the patch.

Quoted 13 lines · Rohit Visavalia

Assert DisplayPort reset signal before deasserting,
it is to clear out any registers programmed before booting kernel.

---
 drivers/gpu/drm/xlnx/zynqmp_dp.c | 4 ++++
 1 file changed, 4 insertions(+)
drivers/gpu/drm/xlnx/zynqmp_dp.c +0 -0
index 1846c4971fd8..5a40aa1d4283 100644

drivers/gpu/drm/xlnx/zynqmp_dp.c int zynqmp_dp_probe(struct zynqmp_dpsub *dpsub) · line 1720

Quoted 7 lines
drivers/gpu/drm/xlnx/zynqmp_dp.c +4 -0
@@ -1714,6 +1714,10 @@ int zynqmp_dp_probe(struct zynqmp_dpsub *dpsub)
 		goto err_free;
 	}
 
+	ret = zynqmp_dp_reset(dp, true);
+	if (ret < 0)
+		return ret;
+

This looks fine to me, so

However, looking at zynqmp_dp_reset(), we have

static int zynqmp_dp_reset(struct zynqmp_dp *dp, bool assert)

{
	unsigned long timeout;

	if (assert)
		reset_control_assert(dp->reset);
	else
		reset_control_deassert(dp->reset);

	/* Wait for the (de)assert to complete. */
	timeout = jiffies + msecs_to_jiffies(RST_TIMEOUT_MS);
	while (!time_after_eq(jiffies, timeout)) {
		bool status = !!reset_control_status(dp->reset);

		if (assert == status)
			return 0;

		cpu_relax();
	}

	dev_err(dp->dev, "reset %s timeout\n", assert ? "assert" : "deassert");
	return -ETIMEDOUT;
}

That doesn't seem quite right. Aren't reset_control_assert() and reset_control_deassert() supposed to be synchronous ? If so there should be no need to wait, and if there's a need to wait, it could be a bug in the reset controller driver. This should be fixed, and then the code in probe could be replaced with a call to reset_control_reset().

Quoted 3 lines
drivers/gpu/drm/xlnx/zynqmp_dp.c +0 -0
 	ret = zynqmp_dp_reset(dp, false);
 	if (ret < 0)
 		goto err_free;
Signature · 3 lines
Regards,

Laurent Pinchart
maintainer
#3 lore raw

Tomi, could you push this through drm-misc ?

Quoted 65 lines · Laurent Pinchart

Hello Rohit,

Thank you for the patch.

Quoted 13 lines · Rohit Visavalia

Assert DisplayPort reset signal before deasserting,
it is to clear out any registers programmed before booting kernel.

---
 drivers/gpu/drm/xlnx/zynqmp_dp.c | 4 ++++
 1 file changed, 4 insertions(+)
drivers/gpu/drm/xlnx/zynqmp_dp.c +0 -0
index 1846c4971fd8..5a40aa1d4283 100644

drivers/gpu/drm/xlnx/zynqmp_dp.c int zynqmp_dp_probe(struct zynqmp_dpsub *dpsub) · line 1720

Quoted 7 lines
drivers/gpu/drm/xlnx/zynqmp_dp.c +4 -0
@@ -1714,6 +1714,10 @@ int zynqmp_dp_probe(struct zynqmp_dpsub *dpsub)
 		goto err_free;
 	}
 
+	ret = zynqmp_dp_reset(dp, true);
+	if (ret < 0)
+		return ret;
+

This looks fine to me, so

However, looking at zynqmp_dp_reset(), we have

static int zynqmp_dp_reset(struct zynqmp_dp *dp, bool assert)

{
	unsigned long timeout;

	if (assert)
		reset_control_assert(dp->reset);
	else
		reset_control_deassert(dp->reset);

	/* Wait for the (de)assert to complete. */
	timeout = jiffies + msecs_to_jiffies(RST_TIMEOUT_MS);
	while (!time_after_eq(jiffies, timeout)) {
		bool status = !!reset_control_status(dp->reset);

		if (assert == status)
			return 0;

		cpu_relax();
	}

	dev_err(dp->dev, "reset %s timeout\n", assert ? "assert" : "deassert");
	return -ETIMEDOUT;
}

That doesn't seem quite right. Aren't reset_control_assert() and reset_control_deassert() supposed to be synchronous ? If so there should be no need to wait, and if there's a need to wait, it could be a bug in the reset controller driver. This should be fixed, and then the code in probe could be replaced with a call to reset_control_reset().

Quoted 3 lines
drivers/gpu/drm/xlnx/zynqmp_dp.c +0 -0
 	ret = zynqmp_dp_reset(dp, false);
 	if (ret < 0)
 		goto err_free;
Signature · 3 lines
Regards,

Laurent Pinchart
maintainer
#4 lore raw
Quoted 33 lines · Laurent Pinchart

Tomi, could you push this through drm-misc ?

Quoted 30 lines · Laurent Pinchart

Hello Rohit,

Thank you for the patch.

Quoted 13 lines · Rohit Visavalia

Assert DisplayPort reset signal before deasserting,
it is to clear out any registers programmed before booting kernel.

---
  drivers/gpu/drm/xlnx/zynqmp_dp.c | 4 ++++
  1 file changed, 4 insertions(+)
drivers/gpu/drm/xlnx/zynqmp_dp.c +0 -0
index 1846c4971fd8..5a40aa1d4283 100644

drivers/gpu/drm/xlnx/zynqmp_dp.c int zynqmp_dp_probe(struct zynqmp_dpsub *dpsub) · line 1720

Quoted 7 lines
drivers/gpu/drm/xlnx/zynqmp_dp.c +4 -0
@@ -1714,6 +1714,10 @@ int zynqmp_dp_probe(struct zynqmp_dpsub *dpsub)
  		goto err_free;
  	}
 
+	ret = zynqmp_dp_reset(dp, true);
+	if (ret < 0)
+		return ret;
+

This looks fine to me, so

Thanks, tested and pushed to drm-misc-next.

Tomi