dri-devel.lists.freedesktop.org archive mirror
 help / color / mirror / Atom feed
* [PATCH v5 0/4] ti-sn65dsi83 patches
@ 2021-12-13 13:36 Alexander Stein
  2021-12-13 13:36 ` [PATCH v5 1/4] dt-bindings: display: bridge: sn65dsi83: Make enable GPIO optional Alexander Stein
                   ` (4 more replies)
  0 siblings, 5 replies; 6+ messages in thread
From: Alexander Stein @ 2021-12-13 13:36 UTC (permalink / raw)
  To: David Airlie, Daniel Vetter, Rob Herring, Andrzej Hajda,
	Neil Armstrong, Robert Foss, Laurent Pinchart, Jonas Karlman,
	Jernej Skrabec
  Cc: Alexander Stein, devicetree, dri-devel

Changes in V5 of this set:
* Rebased to next-20211208
* Fix format string in error message
* Remove superfluous error value for dev_err_probe()
* Added Reviewed-by: Jagan Teki for patch 3 & 4

Changes in V4 of this set:
* Rebased to next-20211118 (due to merge-conflict in linux-next)
* Added Rob Herring's Ack on Patch 1 & 3
* Reworked patch 4 due to other changes in linux-next
* Removed Sam Ravnborg's Reviewed-by for patch4 due to rework

Changes in V3 of this set:
* Do not require vcc-supply in bindings, making it purely optional
* Move regulator enable/disable to sn65dsi83_atomic_pre_enable and
  sn65dsi83_atomic_disable

Changes in V2 of this set:
* Add patch from Laurent for fixing the binding regarding optional GPIO
* Reorder patches so bindings are changed beforehand
* Add small fixes from Sam's review


Alexander Stein (3):
  drm/bridge: ti-sn65dsi83: Make enable GPIO optional
  dt-bindings: drm/bridge: ti-sn65dsi83: Add vcc supply bindings
  drm/bridge: ti-sn65dsi83: Add vcc supply regulator support

Laurent Pinchart (1):
  dt-bindings: display: bridge: sn65dsi83: Make enable GPIO optional

 .../bindings/display/bridge/ti,sn65dsi83.yaml |  5 ++++-
 drivers/gpu/drm/bridge/ti-sn65dsi83.c         | 21 ++++++++++++++++++-
 2 files changed, 24 insertions(+), 2 deletions(-)

-- 
2.25.1


^ permalink raw reply	[flat|nested] 6+ messages in thread

* [PATCH v5 1/4] dt-bindings: display: bridge: sn65dsi83: Make enable GPIO optional
  2021-12-13 13:36 [PATCH v5 0/4] ti-sn65dsi83 patches Alexander Stein
@ 2021-12-13 13:36 ` Alexander Stein
  2021-12-13 13:36 ` [PATCH v5 2/4] drm/bridge: ti-sn65dsi83: " Alexander Stein
                   ` (3 subsequent siblings)
  4 siblings, 0 replies; 6+ messages in thread
From: Alexander Stein @ 2021-12-13 13:36 UTC (permalink / raw)
  To: David Airlie, Daniel Vetter, Rob Herring, Andrzej Hajda,
	Neil Armstrong, Robert Foss, Laurent Pinchart, Jonas Karlman,
	Jernej Skrabec
  Cc: Alexander Stein, devicetree, Laurent Pinchart, dri-devel

From: Laurent Pinchart <laurent.pinchart@ideasonboard.com>

The SN65DSI8x EN signal may be tied to VCC, or otherwise controlled by
means not available to the kernel. Make the GPIO optional.

Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
Acked-by: Rob Herring <robh@kernel.org>
Signed-off-by: Alexander Stein <alexander.stein@ew.tq-group.com>
---
 .../devicetree/bindings/display/bridge/ti,sn65dsi83.yaml         | 1 -
 1 file changed, 1 deletion(-)

diff --git a/Documentation/devicetree/bindings/display/bridge/ti,sn65dsi83.yaml b/Documentation/devicetree/bindings/display/bridge/ti,sn65dsi83.yaml
index b446d0f0f1b4..c3f3e73f740a 100644
--- a/Documentation/devicetree/bindings/display/bridge/ti,sn65dsi83.yaml
+++ b/Documentation/devicetree/bindings/display/bridge/ti,sn65dsi83.yaml
@@ -91,7 +91,6 @@ properties:
 required:
   - compatible
   - reg
-  - enable-gpios
   - ports
 
 allOf:
-- 
2.25.1


^ permalink raw reply related	[flat|nested] 6+ messages in thread

* [PATCH v5 2/4] drm/bridge: ti-sn65dsi83: Make enable GPIO optional
  2021-12-13 13:36 [PATCH v5 0/4] ti-sn65dsi83 patches Alexander Stein
  2021-12-13 13:36 ` [PATCH v5 1/4] dt-bindings: display: bridge: sn65dsi83: Make enable GPIO optional Alexander Stein
@ 2021-12-13 13:36 ` Alexander Stein
  2021-12-13 13:36 ` [PATCH v5 3/4] dt-bindings: drm/bridge: ti-sn65dsi83: Add vcc supply bindings Alexander Stein
                   ` (2 subsequent siblings)
  4 siblings, 0 replies; 6+ messages in thread
From: Alexander Stein @ 2021-12-13 13:36 UTC (permalink / raw)
  To: David Airlie, Daniel Vetter, Rob Herring, Andrzej Hajda,
	Neil Armstrong, Robert Foss, Laurent Pinchart, Jonas Karlman,
	Jernej Skrabec
  Cc: Alexander Stein, devicetree, Sam Ravnborg, Laurent Pinchart, dri-devel

The enable signal may not be controllable by the kernel. Make it
optional.
This is a similar to commit bbda1704fc15 ("drm/bridge: ti-sn65dsi86: Make
enable GPIO optional")

Reviewed-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
Reviewed-by: Sam Ravnborg <sam@ravnborg.org>
Signed-off-by: Alexander Stein <alexander.stein@ew.tq-group.com>
---
 drivers/gpu/drm/bridge/ti-sn65dsi83.c | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/drivers/gpu/drm/bridge/ti-sn65dsi83.c b/drivers/gpu/drm/bridge/ti-sn65dsi83.c
index 945f08de45f1..065610edc37a 100644
--- a/drivers/gpu/drm/bridge/ti-sn65dsi83.c
+++ b/drivers/gpu/drm/bridge/ti-sn65dsi83.c
@@ -662,7 +662,8 @@ static int sn65dsi83_probe(struct i2c_client *client,
 	}
 
 	/* Put the chip in reset, pull EN line low, and assure 10ms reset low timing. */
-	ctx->enable_gpio = devm_gpiod_get(ctx->dev, "enable", GPIOD_OUT_LOW);
+	ctx->enable_gpio = devm_gpiod_get_optional(ctx->dev, "enable",
+						   GPIOD_OUT_LOW);
 	if (IS_ERR(ctx->enable_gpio))
 		return PTR_ERR(ctx->enable_gpio);
 
-- 
2.25.1


^ permalink raw reply related	[flat|nested] 6+ messages in thread

* [PATCH v5 3/4] dt-bindings: drm/bridge: ti-sn65dsi83: Add vcc supply bindings
  2021-12-13 13:36 [PATCH v5 0/4] ti-sn65dsi83 patches Alexander Stein
  2021-12-13 13:36 ` [PATCH v5 1/4] dt-bindings: display: bridge: sn65dsi83: Make enable GPIO optional Alexander Stein
  2021-12-13 13:36 ` [PATCH v5 2/4] drm/bridge: ti-sn65dsi83: " Alexander Stein
@ 2021-12-13 13:36 ` Alexander Stein
  2021-12-13 13:36 ` [PATCH v5 4/4] drm/bridge: ti-sn65dsi83: Add vcc supply regulator support Alexander Stein
  2021-12-21 17:44 ` [PATCH v5 0/4] ti-sn65dsi83 patches Robert Foss
  4 siblings, 0 replies; 6+ messages in thread
From: Alexander Stein @ 2021-12-13 13:36 UTC (permalink / raw)
  To: David Airlie, Daniel Vetter, Rob Herring, Andrzej Hajda,
	Neil Armstrong, Robert Foss, Laurent Pinchart, Jonas Karlman,
	Jernej Skrabec
  Cc: devicetree, Alexander Stein, dri-devel, Jagan Teki, Sam Ravnborg

Add a VCC regulator which needs to be enabled before the EN pin is
released.

Reviewed-by: Sam Ravnborg <sam@ravnborg.org>
Acked-by: Rob Herring <robh@kernel.org>
Reviewed-by: Jagan Teki <jagan@amarulasolutions.com>
Signed-off-by: Alexander Stein <alexander.stein@ew.tq-group.com>
---
 .../devicetree/bindings/display/bridge/ti,sn65dsi83.yaml      | 4 ++++
 1 file changed, 4 insertions(+)

diff --git a/Documentation/devicetree/bindings/display/bridge/ti,sn65dsi83.yaml b/Documentation/devicetree/bindings/display/bridge/ti,sn65dsi83.yaml
index c3f3e73f740a..48a97bb3e2e0 100644
--- a/Documentation/devicetree/bindings/display/bridge/ti,sn65dsi83.yaml
+++ b/Documentation/devicetree/bindings/display/bridge/ti,sn65dsi83.yaml
@@ -32,6 +32,9 @@ properties:
     maxItems: 1
     description: GPIO specifier for bridge_en pin (active high).
 
+  vcc-supply:
+    description: A 1.8V power supply (see regulator/regulator.yaml).
+
   ports:
     $ref: /schemas/graph.yaml#/properties/ports
 
@@ -132,6 +135,7 @@ examples:
             reg = <0x2d>;
 
             enable-gpios = <&gpio2 1 GPIO_ACTIVE_HIGH>;
+            vcc-supply = <&reg_sn65dsi83_1v8>;
 
             ports {
                 #address-cells = <1>;
-- 
2.25.1


^ permalink raw reply related	[flat|nested] 6+ messages in thread

* [PATCH v5 4/4] drm/bridge: ti-sn65dsi83: Add vcc supply regulator support
  2021-12-13 13:36 [PATCH v5 0/4] ti-sn65dsi83 patches Alexander Stein
                   ` (2 preceding siblings ...)
  2021-12-13 13:36 ` [PATCH v5 3/4] dt-bindings: drm/bridge: ti-sn65dsi83: Add vcc supply bindings Alexander Stein
@ 2021-12-13 13:36 ` Alexander Stein
  2021-12-21 17:44 ` [PATCH v5 0/4] ti-sn65dsi83 patches Robert Foss
  4 siblings, 0 replies; 6+ messages in thread
From: Alexander Stein @ 2021-12-13 13:36 UTC (permalink / raw)
  To: David Airlie, Daniel Vetter, Rob Herring, Andrzej Hajda,
	Neil Armstrong, Robert Foss, Laurent Pinchart, Jonas Karlman,
	Jernej Skrabec
  Cc: Alexander Stein, devicetree, Laurent Pinchart, dri-devel

VCC needs to be enabled before releasing the enable GPIO.

Reviewed-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
Signed-off-by: Alexander Stein <alexander.stein@ew.tq-group.com>
---
 drivers/gpu/drm/bridge/ti-sn65dsi83.c | 18 ++++++++++++++++++
 1 file changed, 18 insertions(+)

diff --git a/drivers/gpu/drm/bridge/ti-sn65dsi83.c b/drivers/gpu/drm/bridge/ti-sn65dsi83.c
index 065610edc37a..5650a793db81 100644
--- a/drivers/gpu/drm/bridge/ti-sn65dsi83.c
+++ b/drivers/gpu/drm/bridge/ti-sn65dsi83.c
@@ -33,6 +33,7 @@
 #include <linux/of_device.h>
 #include <linux/of_graph.h>
 #include <linux/regmap.h>
+#include <linux/regulator/consumer.h>
 
 #include <drm/drm_atomic_helper.h>
 #include <drm/drm_bridge.h>
@@ -143,6 +144,7 @@ struct sn65dsi83 {
 	struct mipi_dsi_device		*dsi;
 	struct drm_bridge		*panel_bridge;
 	struct gpio_desc		*enable_gpio;
+	struct regulator		*vcc;
 	int				dsi_lanes;
 	bool				lvds_dual_link;
 	bool				lvds_dual_link_even_odd_swap;
@@ -337,6 +339,12 @@ static void sn65dsi83_atomic_enable(struct drm_bridge *bridge,
 	u16 val;
 	int ret;
 
+	ret = regulator_enable(ctx->vcc);
+	if (ret) {
+		dev_err(ctx->dev, "Failed to enable vcc: %d\n", ret);
+		return;
+	}
+
 	/* Deassert reset */
 	gpiod_set_value(ctx->enable_gpio, 1);
 	usleep_range(1000, 1100);
@@ -486,11 +494,16 @@ static void sn65dsi83_atomic_disable(struct drm_bridge *bridge,
 				     struct drm_bridge_state *old_bridge_state)
 {
 	struct sn65dsi83 *ctx = bridge_to_sn65dsi83(bridge);
+	int ret;
 
 	/* Put the chip in reset, pull EN line low, and assure 10ms reset low timing. */
 	gpiod_set_value(ctx->enable_gpio, 0);
 	usleep_range(10000, 11000);
 
+	ret = regulator_disable(ctx->vcc);
+	if (ret)
+		dev_err(ctx->dev, "Failed to disable vcc: %d\n", ret);
+
 	regcache_mark_dirty(ctx->regmap);
 }
 
@@ -599,6 +612,11 @@ static int sn65dsi83_parse_dt(struct sn65dsi83 *ctx, enum sn65dsi83_model model)
 
 	ctx->panel_bridge = panel_bridge;
 
+	ctx->vcc = devm_regulator_get(dev, "vcc");
+	if (IS_ERR(ctx->vcc))
+		return dev_err_probe(dev, PTR_ERR(ctx->vcc),
+				     "Failed to get supply 'vcc'\n");
+
 	return 0;
 }
 
-- 
2.25.1


^ permalink raw reply related	[flat|nested] 6+ messages in thread

* Re: [PATCH v5 0/4] ti-sn65dsi83 patches
  2021-12-13 13:36 [PATCH v5 0/4] ti-sn65dsi83 patches Alexander Stein
                   ` (3 preceding siblings ...)
  2021-12-13 13:36 ` [PATCH v5 4/4] drm/bridge: ti-sn65dsi83: Add vcc supply regulator support Alexander Stein
@ 2021-12-21 17:44 ` Robert Foss
  4 siblings, 0 replies; 6+ messages in thread
From: Robert Foss @ 2021-12-21 17:44 UTC (permalink / raw)
  To: Alexander Stein
  Cc: devicetree, Neil Armstrong, David Airlie, dri-devel,
	Jonas Karlman, Jernej Skrabec, Andrzej Hajda, Rob Herring,
	Laurent Pinchart

Applied to drm-misc-next

^ permalink raw reply	[flat|nested] 6+ messages in thread

end of thread, other threads:[~2021-12-21 17:45 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-12-13 13:36 [PATCH v5 0/4] ti-sn65dsi83 patches Alexander Stein
2021-12-13 13:36 ` [PATCH v5 1/4] dt-bindings: display: bridge: sn65dsi83: Make enable GPIO optional Alexander Stein
2021-12-13 13:36 ` [PATCH v5 2/4] drm/bridge: ti-sn65dsi83: " Alexander Stein
2021-12-13 13:36 ` [PATCH v5 3/4] dt-bindings: drm/bridge: ti-sn65dsi83: Add vcc supply bindings Alexander Stein
2021-12-13 13:36 ` [PATCH v5 4/4] drm/bridge: ti-sn65dsi83: Add vcc supply regulator support Alexander Stein
2021-12-21 17:44 ` [PATCH v5 0/4] ti-sn65dsi83 patches Robert Foss

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).