Message ID | 20230530192805.648646-2-marex@denx.de (mailing list archive) |
---|---|
State | Accepted |
Headers | show |
Series | [1/2] dt-bindings: display: bridge: tc358762: Document reset-gpios | expand |
On Tue, May 30, 2023 at 9:28 PM Marek Vasut <marex@denx.de> wrote: > > Add reset GPIO support. The reset GPIO is cleared after supply regulator > was enabled, and set before supply regulator is disabled. > > Signed-off-by: Marek Vasut <marex@denx.de> > --- > Cc: Andrzej Hajda <andrzej.hajda@intel.com> > Cc: Conor Dooley <conor+dt@kernel.org> > Cc: Daniel Vetter <daniel@ffwll.ch> > Cc: David Airlie <airlied@gmail.com> > Cc: Jernej Skrabec <jernej.skrabec@gmail.com> > Cc: Jonas Karlman <jonas@kwiboo.se> > Cc: Krzysztof Kozlowski <krzysztof.kozlowski+dt@linaro.org> > Cc: Laurent Pinchart <Laurent.pinchart@ideasonboard.com> > Cc: Marek Vasut <marex@denx.de> > Cc: Neil Armstrong <neil.armstrong@linaro.org> > Cc: Rob Herring <robh+dt@kernel.org> > Cc: Robert Foss <rfoss@kernel.org> > Cc: devicetree@vger.kernel.org > Cc: dri-devel@lists.freedesktop.org > --- > drivers/gpu/drm/bridge/tc358762.c | 15 +++++++++++++++ > 1 file changed, 15 insertions(+) > > diff --git a/drivers/gpu/drm/bridge/tc358762.c b/drivers/gpu/drm/bridge/tc358762.c > index 77f7f7f547570..5641395fd310e 100644 > --- a/drivers/gpu/drm/bridge/tc358762.c > +++ b/drivers/gpu/drm/bridge/tc358762.c > @@ -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; > } > > -- > 2.39.2 > This all looks good, snoozing it for a few days before applying. Reviewed-by: Robert Foss <rfoss@kernel.org>
diff --git a/drivers/gpu/drm/bridge/tc358762.c b/drivers/gpu/drm/bridge/tc358762.c index 77f7f7f547570..5641395fd310e 100644 --- a/drivers/gpu/drm/bridge/tc358762.c +++ b/drivers/gpu/drm/bridge/tc358762.c @@ -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; }
Add reset GPIO support. The reset GPIO is cleared after supply regulator was enabled, and set before supply regulator is disabled. Signed-off-by: Marek Vasut <marex@denx.de> --- Cc: Andrzej Hajda <andrzej.hajda@intel.com> Cc: Conor Dooley <conor+dt@kernel.org> Cc: Daniel Vetter <daniel@ffwll.ch> Cc: David Airlie <airlied@gmail.com> Cc: Jernej Skrabec <jernej.skrabec@gmail.com> Cc: Jonas Karlman <jonas@kwiboo.se> Cc: Krzysztof Kozlowski <krzysztof.kozlowski+dt@linaro.org> Cc: Laurent Pinchart <Laurent.pinchart@ideasonboard.com> Cc: Marek Vasut <marex@denx.de> Cc: Neil Armstrong <neil.armstrong@linaro.org> Cc: Rob Herring <robh+dt@kernel.org> Cc: Robert Foss <rfoss@kernel.org> Cc: devicetree@vger.kernel.org Cc: dri-devel@lists.freedesktop.org --- drivers/gpu/drm/bridge/tc358762.c | 15 +++++++++++++++ 1 file changed, 15 insertions(+)