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(-)
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 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 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:
On Tue, 19 Oct 2021 08:52:36 +0200, Alexander Stein wrote:
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 Signed-off-by: Alexander Stein alexander.stein@ew.tq-group.com
.../devicetree/bindings/display/bridge/ti,sn65dsi83.yaml | 1 - 1 file changed, 1 deletion(-)
Acked-by: Rob Herring robh@kernel.org
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 a32f70bc68ea..9072342566f3 100644 --- a/drivers/gpu/drm/bridge/ti-sn65dsi83.c +++ b/drivers/gpu/drm/bridge/ti-sn65dsi83.c @@ -671,7 +671,8 @@ 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);
Add a VCC regulator which needs to be enabled before the EN pin is released.
Reviewed-by: Sam Ravnborg sam@ravnborg.org 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 a5779bf17849..f1e4f149ccb4 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
@@ -134,6 +137,7 @@ examples: reg = <0x2d>;
enable-gpios = <&gpio2 1 GPIO_ACTIVE_HIGH>; + vcc-supply = <®_sn65dsi83_1v8>;
ports { #address-cells = <1>;
On Tue, 19 Oct 2021 08:52:38 +0200, Alexander Stein wrote:
Add a VCC regulator which needs to be enabled before the EN pin is released.
Reviewed-by: Sam Ravnborg sam@ravnborg.org Signed-off-by: Alexander Stein alexander.stein@ew.tq-group.com
.../devicetree/bindings/display/bridge/ti,sn65dsi83.yaml | 4 ++++ 1 file changed, 4 insertions(+)
Acked-by: Rob Herring robh@kernel.org
Hi Alexander,
Thank you for the patch.
On Tue, Oct 19, 2021 at 08:52:38AM +0200, Alexander Stein wrote:
Add a VCC regulator which needs to be enabled before the EN pin is released.
Reviewed-by: Sam Ravnborg sam@ravnborg.org 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 a5779bf17849..f1e4f149ccb4 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).
I would have dropped the part between parentheses as it's kind of implied, but I don't mind much.
Reviewed-by: Laurent Pinchart laurent.pinchart@ideasonboard.com
- ports: $ref: /schemas/graph.yaml#/properties/ports
@@ -134,6 +137,7 @@ examples: reg = <0x2d>;
enable-gpios = <&gpio2 1 GPIO_ACTIVE_HIGH>;
vcc-supply = <®_sn65dsi83_1v8>; ports { #address-cells = <1>;
VCC needs to be enabled before releasing the enable GPIO.
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 | 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 9072342566f3..c55c45d5d29a 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; @@ -292,6 +294,11 @@ static void sn65dsi83_atomic_pre_enable(struct drm_bridge *bridge, struct drm_bridge_state *old_bridge_state) { struct sn65dsi83 *ctx = bridge_to_sn65dsi83(bridge); + int ret; + + ret = regulator_enable(ctx->vcc); + if (ret) + dev_err(ctx->dev, "Failed to enable vcc: %i\n", ret);
/* * Reset the chip, pull EN line low for t_reset=10ms, @@ -536,9 +543,14 @@ static void sn65dsi83_atomic_post_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. */ gpiod_set_value(ctx->enable_gpio, 0); + + ret = regulator_disable(ctx->vcc); + if (ret) + dev_err(ctx->dev, "Failed to disable vcc: %i\n", ret); }
static enum drm_mode_status @@ -647,6 +659,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", + ctx->vcc); + return 0; }
Hi Alexander,
Thank you for the patch.
On Tue, Oct 19, 2021 at 08:52:39AM +0200, Alexander Stein wrote:
VCC needs to be enabled before releasing the enable GPIO.
Reviewed-by: Sam Ravnborg sam@ravnborg.org Signed-off-by: Alexander Stein alexander.stein@ew.tq-group.com
Reviewed-by: Laurent Pinchart laurent.pinchart@ideasonboard.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 9072342566f3..c55c45d5d29a 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;
@@ -292,6 +294,11 @@ static void sn65dsi83_atomic_pre_enable(struct drm_bridge *bridge, struct drm_bridge_state *old_bridge_state) { struct sn65dsi83 *ctx = bridge_to_sn65dsi83(bridge);
int ret;
ret = regulator_enable(ctx->vcc);
if (ret)
dev_err(ctx->dev, "Failed to enable vcc: %i\n", ret);
/*
- Reset the chip, pull EN line low for t_reset=10ms,
@@ -536,9 +543,14 @@ static void sn65dsi83_atomic_post_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. */ gpiod_set_value(ctx->enable_gpio, 0);
ret = regulator_disable(ctx->vcc);
if (ret)
dev_err(ctx->dev, "Failed to disable vcc: %i\n", ret);
}
static enum drm_mode_status @@ -647,6 +659,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",
ctx->vcc);
- return 0;
}
dri-devel@lists.freedesktop.org