[PATCH 1/3] drm/bridge: ti-sn65dsi83: Add vcc supply regulator support
Sam Ravnborg
sam at ravnborg.org
Mon Oct 11 20:18:15 UTC 2021
Hi Alexander,
On Wed, Oct 06, 2021 at 09:47:11AM +0200, Alexander Stein wrote:
> VCC needs to be enabled before releasing the enable GPIO.
>
> Signed-off-by: Alexander Stein <alexander.stein at 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));
The use of ERR_PTR(ret) is wrong here as ret do not include the return
result. Just use ctx->vcc instead as this is what %pe expects.
> +
> 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");
Print the return code too?
With the two things fixed you can add my:
Reviewed-by: Sam Ravnborg <sam at ravnborg.org>
> +
> + 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
More information about the dri-devel
mailing list