Devicetree
 help / color / mirror / Atom feed
* [PATCH 1/3] drm/bridge: ti-sn65dsi83: Add vcc supply regulator support
@ 2021-10-06  7:47 Alexander Stein
  2021-10-06  7:47 ` [PATCH 2/3] dt-bindings: drm/bridge: ti-sn65dsi83: Add vcc supply bindings Alexander Stein
  2021-10-06  7:47 ` [PATCH 3/3] drm/bridge: ti-sn65dsi8: Make enable GPIO optional Alexander Stein
  0 siblings, 2 replies; 8+ messages in thread
From: Alexander Stein @ 2021-10-06  7:47 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, dri-devel, devicetree

VCC needs to be enabled before releasing the enable GPIO.

Signed-off-by: Alexander Stein <alexander.stein@ew.tq-group.com>
---
 drivers/gpu/drm/bridge/ti-sn65dsi83.c | 15 ++++++++++++++-
 1 file changed, 14 insertions(+), 1 deletion(-)

diff --git a/drivers/gpu/drm/bridge/ti-sn65dsi83.c b/drivers/gpu/drm/bridge/ti-sn65dsi83.c
index a32f70bc68ea..5fab0fabcd15 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;
@@ -647,6 +649,12 @@ 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': %pe\n",
+				     ERR_PTR(ret));
+
 	return 0;
 }
 
@@ -690,7 +698,11 @@ static int sn65dsi83_probe(struct i2c_client *client,
 	ctx->bridge.of_node = dev->of_node;
 	drm_bridge_add(&ctx->bridge);
 
-	return 0;
+	ret = regulator_enable(ctx->vcc);
+	if (ret)
+		dev_err(dev, "Failed to enable vcc\n");
+
+	return ret;
 }
 
 static int sn65dsi83_remove(struct i2c_client *client)
@@ -701,6 +713,7 @@ static int sn65dsi83_remove(struct i2c_client *client)
 	mipi_dsi_device_unregister(ctx->dsi);
 	drm_bridge_remove(&ctx->bridge);
 	of_node_put(ctx->host_node);
+	regulator_disable(ctx->vcc);
 
 	return 0;
 }
-- 
2.25.1


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

* [PATCH 2/3] dt-bindings: drm/bridge: ti-sn65dsi83: Add vcc supply bindings
  2021-10-06  7:47 [PATCH 1/3] drm/bridge: ti-sn65dsi83: Add vcc supply regulator support Alexander Stein
@ 2021-10-06  7:47 ` Alexander Stein
  2021-10-06 13:21   ` Rob Herring
  2021-10-06  7:47 ` [PATCH 3/3] drm/bridge: ti-sn65dsi8: Make enable GPIO optional Alexander Stein
  1 sibling, 1 reply; 8+ messages in thread
From: Alexander Stein @ 2021-10-06  7:47 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, dri-devel, devicetree

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

Signed-off-by: Alexander Stein <alexander.stein@ew.tq-group.com>
---
 .../devicetree/bindings/display/bridge/ti,sn65dsi83.yaml     | 5 +++++
 1 file changed, 5 insertions(+)

diff --git a/Documentation/devicetree/bindings/display/bridge/ti,sn65dsi83.yaml b/Documentation/devicetree/bindings/display/bridge/ti,sn65dsi83.yaml
index 07b20383cbca..149cff3233c2 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
 
@@ -94,6 +97,7 @@ required:
   - compatible
   - reg
   - enable-gpios
+  - vcc-supply
   - ports
 
 allOf:
@@ -135,6 +139,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] 8+ messages in thread

* [PATCH 3/3] drm/bridge: ti-sn65dsi8: Make enable GPIO optional
  2021-10-06  7:47 [PATCH 1/3] drm/bridge: ti-sn65dsi83: Add vcc supply regulator support Alexander Stein
  2021-10-06  7:47 ` [PATCH 2/3] dt-bindings: drm/bridge: ti-sn65dsi83: Add vcc supply bindings Alexander Stein
@ 2021-10-06  7:47 ` Alexander Stein
  2021-10-06  9:16   ` [PATCH] dt-bindings: display: bridge: sn65dsi83: " Laurent Pinchart
  2021-10-06  9:18   ` [PATCH 3/3] drm/bridge: ti-sn65dsi8: " Laurent Pinchart
  1 sibling, 2 replies; 8+ messages in thread
From: Alexander Stein @ 2021-10-06  7:47 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, dri-devel, devicetree

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")

Signed-off-by: Alexander Stein <alexander.stein@ew.tq-group.com>
---
 drivers/gpu/drm/bridge/ti-sn65dsi83.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/gpu/drm/bridge/ti-sn65dsi83.c b/drivers/gpu/drm/bridge/ti-sn65dsi83.c
index 5fab0fabcd15..101da29ba698 100644
--- a/drivers/gpu/drm/bridge/ti-sn65dsi83.c
+++ b/drivers/gpu/drm/bridge/ti-sn65dsi83.c
@@ -679,7 +679,7 @@ static int sn65dsi83_probe(struct i2c_client *client,
 		model = id->driver_data;
 	}
 
-	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] 8+ messages in thread

* [PATCH] dt-bindings: display: bridge: sn65dsi83: Make enable GPIO optional
  2021-10-06  7:47 ` [PATCH 3/3] drm/bridge: ti-sn65dsi8: Make enable GPIO optional Alexander Stein
@ 2021-10-06  9:16   ` Laurent Pinchart
  2021-10-06  9:53     ` AW: (EXT) " Alexander Stein
  2021-10-06  9:18   ` [PATCH 3/3] drm/bridge: ti-sn65dsi8: " Laurent Pinchart
  1 sibling, 1 reply; 8+ messages in thread
From: Laurent Pinchart @ 2021-10-06  9:16 UTC (permalink / raw)
  To: dri-devel
  Cc: Alexander Stein, devicetree, Rob Herring, Marek Vasut,
	Laurent Pinchart

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>
---
 .../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 07b20383cbca..a5779bf17849 100644
--- a/Documentation/devicetree/bindings/display/bridge/ti,sn65dsi83.yaml
+++ b/Documentation/devicetree/bindings/display/bridge/ti,sn65dsi83.yaml
@@ -93,7 +93,6 @@ properties:
 required:
   - compatible
   - reg
-  - enable-gpios
   - ports
 
 allOf:

base-commit: 1e3944578b749449bd7fa6bf0bae4c3d3f5f1733
-- 
Regards,

Laurent Pinchart


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

* Re: [PATCH 3/3] drm/bridge: ti-sn65dsi8: Make enable GPIO optional
  2021-10-06  7:47 ` [PATCH 3/3] drm/bridge: ti-sn65dsi8: Make enable GPIO optional Alexander Stein
  2021-10-06  9:16   ` [PATCH] dt-bindings: display: bridge: sn65dsi83: " Laurent Pinchart
@ 2021-10-06  9:18   ` Laurent Pinchart
  2021-10-06  9:18     ` Laurent Pinchart
  1 sibling, 1 reply; 8+ messages in thread
From: Laurent Pinchart @ 2021-10-06  9:18 UTC (permalink / raw)
  To: Alexander Stein
  Cc: David Airlie, Daniel Vetter, Rob Herring, Andrzej Hajda,
	Neil Armstrong, Robert Foss, Jonas Karlman, Jernej Skrabec,
	dri-devel, devicetree

Hi Alexander,

Thank you for the patch.

On Wed, Oct 06, 2021 at 09:47:13AM +0200, Alexander Stein wrote:
> 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")
> 
> Signed-off-by: Alexander Stein <alexander.stein@ew.tq-group.com>
> ---
>  drivers/gpu/drm/bridge/ti-sn65dsi83.c | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
> 
> diff --git a/drivers/gpu/drm/bridge/ti-sn65dsi83.c b/drivers/gpu/drm/bridge/ti-sn65dsi83.c
> index 5fab0fabcd15..101da29ba698 100644
> --- a/drivers/gpu/drm/bridge/ti-sn65dsi83.c
> +++ b/drivers/gpu/drm/bridge/ti-sn65dsi83.c
> @@ -679,7 +679,7 @@ static int sn65dsi83_probe(struct i2c_client *client,
>  		model = id->driver_data;
>  	}
>  
> -	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);

You can wrap this line as

	ctx->enable_gpio = devm_gpiod_get_optional(ctx->dev, "enable",
						   GPIOD_OUT_LOW);

Reviewed-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>

Corresponding DT bindings changes are needed, I've sent a patch in this
mail thread.

>  	if (IS_ERR(ctx->enable_gpio))
>  		return PTR_ERR(ctx->enable_gpio);
>  

-- 
Regards,

Laurent Pinchart

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

* Re: [PATCH 3/3] drm/bridge: ti-sn65dsi8: Make enable GPIO optional
  2021-10-06  9:18   ` [PATCH 3/3] drm/bridge: ti-sn65dsi8: " Laurent Pinchart
@ 2021-10-06  9:18     ` Laurent Pinchart
  0 siblings, 0 replies; 8+ messages in thread
From: Laurent Pinchart @ 2021-10-06  9:18 UTC (permalink / raw)
  To: Alexander Stein
  Cc: David Airlie, Daniel Vetter, Rob Herring, Andrzej Hajda,
	Neil Armstrong, Robert Foss, Jonas Karlman, Jernej Skrabec,
	dri-devel, devicetree

On Wed, Oct 06, 2021 at 12:18:02PM +0300, Laurent Pinchart wrote:
> Hi Alexander,
> 
> Thank you for the patch.

One more thing, the subject line has a typo, it should read
ti-sn65dsi83.

> On Wed, Oct 06, 2021 at 09:47:13AM +0200, Alexander Stein wrote:
> > 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")
> > 
> > Signed-off-by: Alexander Stein <alexander.stein@ew.tq-group.com>
> > ---
> >  drivers/gpu/drm/bridge/ti-sn65dsi83.c | 2 +-
> >  1 file changed, 1 insertion(+), 1 deletion(-)
> > 
> > diff --git a/drivers/gpu/drm/bridge/ti-sn65dsi83.c b/drivers/gpu/drm/bridge/ti-sn65dsi83.c
> > index 5fab0fabcd15..101da29ba698 100644
> > --- a/drivers/gpu/drm/bridge/ti-sn65dsi83.c
> > +++ b/drivers/gpu/drm/bridge/ti-sn65dsi83.c
> > @@ -679,7 +679,7 @@ static int sn65dsi83_probe(struct i2c_client *client,
> >  		model = id->driver_data;
> >  	}
> >  
> > -	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);
> 
> You can wrap this line as
> 
> 	ctx->enable_gpio = devm_gpiod_get_optional(ctx->dev, "enable",
> 						   GPIOD_OUT_LOW);
> 
> Reviewed-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
> 
> Corresponding DT bindings changes are needed, I've sent a patch in this
> mail thread.
> 
> >  	if (IS_ERR(ctx->enable_gpio))
> >  		return PTR_ERR(ctx->enable_gpio);
> >  

-- 
Regards,

Laurent Pinchart

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

* AW: (EXT) [PATCH] dt-bindings: display: bridge: sn65dsi83: Make enable GPIO optional
  2021-10-06  9:16   ` [PATCH] dt-bindings: display: bridge: sn65dsi83: " Laurent Pinchart
@ 2021-10-06  9:53     ` Alexander Stein
  0 siblings, 0 replies; 8+ messages in thread
From: Alexander Stein @ 2021-10-06  9:53 UTC (permalink / raw)
  To: Laurent Pinchart, dri-devel@lists.freedesktop.org
  Cc: devicetree@vger.kernel.org, Rob Herring, Marek Vasut,
	Laurent Pinchart

> 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>
> ---
>  .../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 07b20383cbca..a5779bf17849 100644
> --- a/Documentation/devicetree/bindings/display/bridge/ti,sn65dsi83.yaml
> +++ b/Documentation/devicetree/bindings/display/bridge/ti,sn65dsi83.yaml
> @@ -93,7 +93,6 @@ properties:
>  required:
>    - compatible
>    - reg
> -  - enable-gpios
>    - ports
>  
>  allOf:
> 
> base-commit: 1e3944578b749449bd7fa6bf0bae4c3d3f5f1733

Reviewed-by: Alexander Stein <alexander.stein@ew.tq-group.com>

Best regards,
Alexander

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

* Re: [PATCH 2/3] dt-bindings: drm/bridge: ti-sn65dsi83: Add vcc supply bindings
  2021-10-06  7:47 ` [PATCH 2/3] dt-bindings: drm/bridge: ti-sn65dsi83: Add vcc supply bindings Alexander Stein
@ 2021-10-06 13:21   ` Rob Herring
  0 siblings, 0 replies; 8+ messages in thread
From: Rob Herring @ 2021-10-06 13:21 UTC (permalink / raw)
  To: Alexander Stein
  Cc: David Airlie, Daniel Vetter, Andrzej Hajda, Neil Armstrong,
	Robert Foss, Laurent Pinchart, Jonas Karlman, Jernej Skrabec,
	dri-devel, devicetree

On Wed, Oct 6, 2021 at 2:47 AM Alexander Stein
<alexander.stein@ew.tq-group.com> wrote:
>
> Add a VCC regulator which needs to be enabled before the EN pin is
> released.
>
> Signed-off-by: Alexander Stein <alexander.stein@ew.tq-group.com>
> ---
>  .../devicetree/bindings/display/bridge/ti,sn65dsi83.yaml     | 5 +++++
>  1 file changed, 5 insertions(+)
>
> diff --git a/Documentation/devicetree/bindings/display/bridge/ti,sn65dsi83.yaml b/Documentation/devicetree/bindings/display/bridge/ti,sn65dsi83.yaml
> index 07b20383cbca..149cff3233c2 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
>
> @@ -94,6 +97,7 @@ required:
>    - compatible
>    - reg
>    - enable-gpios
> +  - vcc-supply

You generally can't make added properties required unless all DT files
already had this property. It breaks compatibility.

Rob

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

end of thread, other threads:[~2021-10-06 13:21 UTC | newest]

Thread overview: 8+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2021-10-06  7:47 [PATCH 1/3] drm/bridge: ti-sn65dsi83: Add vcc supply regulator support Alexander Stein
2021-10-06  7:47 ` [PATCH 2/3] dt-bindings: drm/bridge: ti-sn65dsi83: Add vcc supply bindings Alexander Stein
2021-10-06 13:21   ` Rob Herring
2021-10-06  7:47 ` [PATCH 3/3] drm/bridge: ti-sn65dsi8: Make enable GPIO optional Alexander Stein
2021-10-06  9:16   ` [PATCH] dt-bindings: display: bridge: sn65dsi83: " Laurent Pinchart
2021-10-06  9:53     ` AW: (EXT) " Alexander Stein
2021-10-06  9:18   ` [PATCH 3/3] drm/bridge: ti-sn65dsi8: " Laurent Pinchart
2021-10-06  9:18     ` Laurent Pinchart

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox