Skip to contentSkip to conversation

dt-bindings: display: bridge: tc358762: Document reset-gpios

PATCH Applied Marek Vasut 3 participants 5 messages May 30, 2023 – Jun 1, 2023

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

PATCH 1/2 dt-bindings: display: bridge: tc358762: Document reset-gpios

This chip has one reset GPIO input, document it. The reset GPIO is optional as it is sometimes not connected on some hardware.

---
Cc: Andrzej Hajda <[email protected]>
Cc: Conor Dooley <[email protected]>
Cc: Daniel Vetter <[email protected]>
Cc: David Airlie <[email protected]>
Cc: Jernej Skrabec <[email protected]>
Cc: Jonas Karlman <[email protected]>
Cc: Krzysztof Kozlowski <[email protected]>
Cc: Laurent Pinchart <[email protected]>
Cc: Marek Vasut <[email protected]>
Cc: Neil Armstrong <[email protected]>
Cc: Rob Herring <[email protected]>
Cc: Robert Foss <[email protected]>
Cc: [email protected]
Cc: [email protected]

---
 .../devicetree/bindings/display/bridge/toshiba,tc358762.yaml   | 3 +++
 1 file changed, 3 insertions(+)
Documentation/devicetree/bindings/display/bridge/toshiba,tc358762.yaml +3 -0
index 81ca3cbc7abed..6c1de0b217228 100644
@@ -21,6 +21,9 @@ properties:
     maxItems: 1
     description: virtual channel number of a DSI peripheral
 
+  reset-gpios:
+    maxItems: 1
+
   vddc-supply:
     description: Regulator for 1.2V internal core power.
 
Signature · 1 line
2.39.2
#1 lore raw

PATCH 2/2 drm/bridge: tc358762: Add reset GPIO support

Add reset GPIO support. The reset GPIO is cleared after supply regulator was enabled, and set before supply regulator is disabled.

---
Cc: Andrzej Hajda <[email protected]>
Cc: Conor Dooley <[email protected]>
Cc: Daniel Vetter <[email protected]>
Cc: David Airlie <[email protected]>
Cc: Jernej Skrabec <[email protected]>
Cc: Jonas Karlman <[email protected]>
Cc: Krzysztof Kozlowski <[email protected]>
Cc: Laurent Pinchart <[email protected]>
Cc: Marek Vasut <[email protected]>
Cc: Neil Armstrong <[email protected]>
Cc: Rob Herring <[email protected]>
Cc: Robert Foss <[email protected]>
Cc: [email protected]
Cc: [email protected]

---
 drivers/gpu/drm/bridge/tc358762.c | 15 +++++++++++++++
 1 file changed, 15 insertions(+)
drivers/gpu/drm/bridge/tc358762.c +15 -0
index 77f7f7f547570..5641395fd310e 100644
@@ -11,6 +11,7 @@
  */
 
 #include <linux/delay.h>
+#include <linux/gpio/consumer.h>
 #include <linux/mod_devicetable.h>
 #include <linux/module.h>
 #include <linux/of_graph.h>
@@ -63,6 +64,7 @@ struct tc358762 {
 	struct drm_bridge bridge;
 	struct regulator *regulator;
 	struct drm_bridge *panel_bridge;
+	struct gpio_desc *reset_gpio;
 	bool pre_enabled;
 	int error;
 };
@@ -138,6 +140,9 @@ static void tc358762_post_disable(struct drm_bridge *bridge)
 
 	ctx->pre_enabled = false;
 
+	if (ctx->reset_gpio)
+		gpiod_set_value_cansleep(ctx->reset_gpio, 0);
+
 	ret = regulator_disable(ctx->regulator);
 	if (ret < 0)
 		dev_err(ctx->dev, "error disabling regulators (%d)\n", ret);
@@ -152,6 +157,11 @@ static void tc358762_pre_enable(struct drm_bridge *bridge)
 	if (ret < 0)
 		dev_err(ctx->dev, "error enabling regulators (%d)\n", ret);
 
+	if (ctx->reset_gpio) {
+		gpiod_set_value_cansleep(ctx->reset_gpio, 1);
+		usleep_range(5000, 10000);
+	}
+
 	ret = tc358762_init(ctx);
 	if (ret < 0)
 		dev_err(ctx->dev, "error initializing bridge (%d)\n", ret);
@@ -185,6 +195,11 @@ static int tc358762_parse_dt(struct tc358762 *ctx)
 
 	ctx->panel_bridge = panel_bridge;
 
+	/* Reset GPIO is optional */
+	ctx->reset_gpio = devm_gpiod_get_optional(dev, "reset", GPIOD_OUT_LOW);
+	if (IS_ERR(ctx->reset_gpio))
+		return PTR_ERR(ctx->reset_gpio);
+
 	return 0;
 }
 
Signature · 1 line
2.39.2
maintainer Reviewed-by on v1 2/2
#2 lore raw

Re: [PATCH 2/2] drm/bridge: tc358762: Add reset GPIO support

Quoted 79 lines · Marek Vasut

Add reset GPIO support. The reset GPIO is cleared after supply regulator was enabled, and set before supply regulator is disabled.

---
Cc: Andrzej Hajda <[email protected]>
Cc: Conor Dooley <[email protected]>
Cc: Daniel Vetter <[email protected]>
Cc: David Airlie <[email protected]>
Cc: Jernej Skrabec <[email protected]>
Cc: Jonas Karlman <[email protected]>
Cc: Krzysztof Kozlowski <[email protected]>
Cc: Laurent Pinchart <[email protected]>
Cc: Marek Vasut <[email protected]>
Cc: Neil Armstrong <[email protected]>
Cc: Rob Herring <[email protected]>
Cc: Robert Foss <[email protected]>
Cc: [email protected]
Cc: [email protected]

---
 drivers/gpu/drm/bridge/tc358762.c | 15 +++++++++++++++
 1 file changed, 15 insertions(+)
drivers/gpu/drm/bridge/tc358762.c +15 -1
index 77f7f7f547570..5641395fd310e 100644
@@ -11,6 +11,7 @@
  */
 
 #include <linux/delay.h>
+#include <linux/gpio/consumer.h>
 #include <linux/mod_devicetable.h>
 #include <linux/module.h>
 #include <linux/of_graph.h>
@@ -63,6 +64,7 @@ struct tc358762 {
        struct drm_bridge bridge;
        struct regulator *regulator;
        struct drm_bridge *panel_bridge;
+       struct gpio_desc *reset_gpio;
        bool pre_enabled;
        int error;
 };
@@ -138,6 +140,9 @@ static void tc358762_post_disable(struct drm_bridge *bridge)
 
        ctx->pre_enabled = false;
 
+       if (ctx->reset_gpio)
+               gpiod_set_value_cansleep(ctx->reset_gpio, 0);
+
        ret = regulator_disable(ctx->regulator);
        if (ret < 0)
                dev_err(ctx->dev, "error disabling regulators (%d)\n", ret);
@@ -152,6 +157,11 @@ static void tc358762_pre_enable(struct drm_bridge *bridge)
        if (ret < 0)
                dev_err(ctx->dev, "error enabling regulators (%d)\n", ret);
 
+       if (ctx->reset_gpio) {
+               gpiod_set_value_cansleep(ctx->reset_gpio, 1);
+               usleep_range(5000, 10000);
+       }
+
        ret = tc358762_init(ctx);
        if (ret < 0)
                dev_err(ctx->dev, "error initializing bridge (%d)\n", ret);
@@ -185,6 +195,11 @@ static int tc358762_parse_dt(struct tc358762 *ctx)
 
        ctx->panel_bridge = panel_bridge;
 
+       /* Reset GPIO is optional */
+       ctx->reset_gpio = devm_gpiod_get_optional(dev, "reset", GPIOD_OUT_LOW);
+       if (IS_ERR(ctx->reset_gpio))
+               return PTR_ERR(ctx->reset_gpio);
+
        return 0;
 }
 
--
Quoted 2 lines

2.39.2

This all looks good, snoozing it for a few days before applying.

maintainer Applied
#4 lore raw
In reply to Marek Vasut

From: Robert Foss <[email protected]>

Quoted 4 lines · Marek Vasut

This chip has one reset GPIO input, document it. The reset GPIO is optional as it is sometimes not connected on some hardware.

Applied, thanks!

[1/2] dt-bindings: display: bridge: tc358762: Document reset-gpios

      https://cgit.freedesktop.org/drm/drm-misc/commit/?id=e8001973bb45
[2/2] drm/bridge: tc358762: Add reset GPIO support
      https://cgit.freedesktop.org/drm/drm-misc/commit/?id=3355f4ee561d

Rob