drm/bridge: ti-sn65dsi83: Add vcc supply regulator support
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> Signed-off-by: Robert Foss <robert.foss@linaro.org> Link: https://patchwork.freedesktop.org/patch/msgid/20211213133626.2498056-5-alexander.stein@ew.tq-group.com
This commit is contained in:
parent
e6ba217381
commit
5664e3c907
1 changed files with 18 additions and 0 deletions
|
@ -33,6 +33,7 @@
|
||||||
#include <linux/of_device.h>
|
#include <linux/of_device.h>
|
||||||
#include <linux/of_graph.h>
|
#include <linux/of_graph.h>
|
||||||
#include <linux/regmap.h>
|
#include <linux/regmap.h>
|
||||||
|
#include <linux/regulator/consumer.h>
|
||||||
|
|
||||||
#include <drm/drm_atomic_helper.h>
|
#include <drm/drm_atomic_helper.h>
|
||||||
#include <drm/drm_bridge.h>
|
#include <drm/drm_bridge.h>
|
||||||
|
@ -143,6 +144,7 @@ struct sn65dsi83 {
|
||||||
struct mipi_dsi_device *dsi;
|
struct mipi_dsi_device *dsi;
|
||||||
struct drm_bridge *panel_bridge;
|
struct drm_bridge *panel_bridge;
|
||||||
struct gpio_desc *enable_gpio;
|
struct gpio_desc *enable_gpio;
|
||||||
|
struct regulator *vcc;
|
||||||
int dsi_lanes;
|
int dsi_lanes;
|
||||||
bool lvds_dual_link;
|
bool lvds_dual_link;
|
||||||
bool lvds_dual_link_even_odd_swap;
|
bool lvds_dual_link_even_odd_swap;
|
||||||
|
@ -337,6 +339,12 @@ static void sn65dsi83_atomic_enable(struct drm_bridge *bridge,
|
||||||
u16 val;
|
u16 val;
|
||||||
int ret;
|
int ret;
|
||||||
|
|
||||||
|
ret = regulator_enable(ctx->vcc);
|
||||||
|
if (ret) {
|
||||||
|
dev_err(ctx->dev, "Failed to enable vcc: %d\n", ret);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
/* Deassert reset */
|
/* Deassert reset */
|
||||||
gpiod_set_value(ctx->enable_gpio, 1);
|
gpiod_set_value(ctx->enable_gpio, 1);
|
||||||
usleep_range(1000, 1100);
|
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 drm_bridge_state *old_bridge_state)
|
||||||
{
|
{
|
||||||
struct sn65dsi83 *ctx = bridge_to_sn65dsi83(bridge);
|
struct sn65dsi83 *ctx = bridge_to_sn65dsi83(bridge);
|
||||||
|
int ret;
|
||||||
|
|
||||||
/* Put the chip in reset, pull EN line low, and assure 10ms reset low timing. */
|
/* Put the chip in reset, pull EN line low, and assure 10ms reset low timing. */
|
||||||
gpiod_set_value(ctx->enable_gpio, 0);
|
gpiod_set_value(ctx->enable_gpio, 0);
|
||||||
usleep_range(10000, 11000);
|
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);
|
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->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;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Add table
Reference in a new issue