Skip to contentSkip to conversation

drm/sun4i: tcon: Unconditionally reset the TCON

PATCH Superseded Chen-Yu Tsai 2 participants 4 messages Sep 8, 2017

Subsystems (4)

v1 of 2 Superseded Latest is v2 →

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 drm/sun4i: tcon: Unconditionally reset the TCON

When binding the TCON, we were checking the reset control status and asserting reset if it wasn't in reset. The check failed to account for the reset control API returning error codes if the status callback was not implemented.

Since we want the TCON to be reset in all cases, and re-asserting the reset control does no harm, just assert the reset unconditionally.

Fixes 9026e0d122ac ("drm: Add Allwinner A10 Display Engine support")
---
 drivers/gpu/drm/sun4i/sun4i_tcon.c | 3 +--
 1 file changed, 1 insertion(+), 2 deletions(-)
drivers/gpu/drm/sun4i/sun4i_tcon.c +1 -2
index d9791292553e..eb32676d5b01 100644
@@ -530,8 +530,7 @@ static int sun4i_tcon_bind(struct device *dev, struct device *master,
 	}
 
 	/* Make sure our TCON is reset */
-	if (!reset_control_status(tcon->lcd_rst))
-		reset_control_assert(tcon->lcd_rst);
+	reset_control_assert(tcon->lcd_rst);
 
 	ret = reset_control_deassert(tcon->lcd_rst);
 	if (ret) {
Signature · 6 lines
2.14.1

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

Hi,

Quoted 19 lines · Chen-Yu Tsai

When binding the TCON, we were checking the reset control status and asserting reset if it wasn't in reset. The check failed to account for the reset control API returning error codes if the status callback was not implemented.

Since we want the TCON to be reset in all cases, and re-asserting the reset control does no harm, just assert the reset unconditionally.

Fixes 9026e0d122ac ("drm: Add Allwinner A10 Display Engine support")
---
 drivers/gpu/drm/sun4i/sun4i_tcon.c | 3 +--
 1 file changed, 1 insertion(+), 2 deletions(-)
drivers/gpu/drm/sun4i/sun4i_tcon.c +0 -0
index d9791292553e..eb32676d5b01 100644

drivers/gpu/drm/sun4i/sun4i_tcon.c static int sun4i_tcon_bind(struct device *dev, struct device *master, · line 533

Quoted 6 lines
drivers/gpu/drm/sun4i/sun4i_tcon.c +1 -2
@@ -530,8 +530,7 @@ static int sun4i_tcon_bind(struct device *dev, struct device *master,
 	}
 
 	/* Make sure our TCON is reset */
-	if (!reset_control_status(tcon->lcd_rst))
-		reset_control_assert(tcon->lcd_rst);
+	reset_control_assert(tcon->lcd_rst);

That doesn't really reset it if it was already de-asserted. In that case, the TCON will not be reset, unlike what your commit log says.

Maybe you wanted to use reset_control_reset?

Maxime

Signature · 3 lines
Maxime Ripard, Free Electrons
Embedded Linux and Kernel engineering
http://free-electrons.com

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

#2 lore raw
Quoted 24 lines · Maxime Ripard

Hi,

Quoted 21 lines · Chen-Yu Tsai

When binding the TCON, we were checking the reset control status and asserting reset if it wasn't in reset. The check failed to account for the reset control API returning error codes if the status callback was not implemented.

Since we want the TCON to be reset in all cases, and re-asserting the reset control does no harm, just assert the reset unconditionally.

Fixes 9026e0d122ac ("drm: Add Allwinner A10 Display Engine support")
---
 drivers/gpu/drm/sun4i/sun4i_tcon.c | 3 +--
 1 file changed, 1 insertion(+), 2 deletions(-)
drivers/gpu/drm/sun4i/sun4i_tcon.c +0 -0
index d9791292553e..eb32676d5b01 100644
@@ -530,8 +530,7 @@ static int sun4i_tcon_bind(struct device *dev, struct device *master,
      }
 
Quoted 7 lines

drivers/gpu/drm/sun4i/sun4i_tcon.c static int sun4i_tcon_bind(struct device *dev, struct device *master, · line 533

Quoted 4 lines
drivers/gpu/drm/sun4i/sun4i_tcon.c +1 -2
      /* Make sure our TCON is reset */
-     if (!reset_control_status(tcon->lcd_rst))
-             reset_control_assert(tcon->lcd_rst);
+     reset_control_assert(tcon->lcd_rst);

That doesn't really reset it if it was already de-asserted. In that case, the TCON will not be reset, unlike what your commit log says.

Why not? It is now asserting the reset control, regardless of the status.

Quoted 1 line

Maybe you wanted to use reset_control_reset?

If you prefer it, sure. When I did this patch we didn't support the .reset callback, so this is an explicit assert followed by the existing deassert.

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

#3 lore raw
Quoted 34 lines · Chen-Yu Tsai
Quoted 24 lines · Maxime Ripard

Hi,

Quoted 21 lines · Chen-Yu Tsai

When binding the TCON, we were checking the reset control status and asserting reset if it wasn't in reset. The check failed to account for the reset control API returning error codes if the status callback was not implemented.

Since we want the TCON to be reset in all cases, and re-asserting the reset control does no harm, just assert the reset unconditionally.

Fixes 9026e0d122ac ("drm: Add Allwinner A10 Display Engine support")
---
 drivers/gpu/drm/sun4i/sun4i_tcon.c | 3 +--
 1 file changed, 1 insertion(+), 2 deletions(-)
drivers/gpu/drm/sun4i/sun4i_tcon.c +0 -0
index d9791292553e..eb32676d5b01 100644
@@ -530,8 +530,7 @@ static int sun4i_tcon_bind(struct device *dev, struct device *master,
      }
 
Quoted 7 lines

drivers/gpu/drm/sun4i/sun4i_tcon.c static int sun4i_tcon_bind(struct device *dev, struct device *master, · line 533

Quoted 4 lines
drivers/gpu/drm/sun4i/sun4i_tcon.c +1 -2
      /* Make sure our TCON is reset */
-     if (!reset_control_status(tcon->lcd_rst))
-             reset_control_assert(tcon->lcd_rst);
+     reset_control_assert(tcon->lcd_rst);

That doesn't really reset it if it was already de-asserted. In that case, the TCON will not be reset, unlike what your commit log says.

Quoted 2 lines

Why not? It is now asserting the reset control, regardless of the status.

Oh, right, sorry.

Quoted 5 lines
Quoted 1 line

Maybe you wanted to use reset_control_reset?

If you prefer it, sure. When I did this patch we didn't support the .reset callback, so this is an explicit assert followed by the existing deassert.

Still, if we rework that part, I guess that just using reset unconditonally would make it more obvious.

Maxime

Signature · 3 lines
Maxime Ripard, Free Electrons
Embedded Linux and Kernel engineering
http://free-electrons.com

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