video: bridge: ssd2825: add power supplies

Convert enable GPIO into a set of supplies according to
datasheet.

Signed-off-by: Svyatoslav Ryhel <clamor95@gmail.com>
This commit is contained in:
Svyatoslav Ryhel
2025-02-21 18:37:35 +02:00
parent 4b03bd2508
commit b17471ae41

View File

@@ -13,6 +13,7 @@
#include <backlight.h> #include <backlight.h>
#include <video_bridge.h> #include <video_bridge.h>
#include <panel.h> #include <panel.h>
#include <power/regulator.h>
#include <spi.h> #include <spi.h>
#include <linux/delay.h> #include <linux/delay.h>
#include <linux/err.h> #include <linux/err.h>
@@ -108,6 +109,10 @@
#define SSD2825_LP_MIN_CLK 5000 /* KHz */ #define SSD2825_LP_MIN_CLK 5000 /* KHz */
#define SSD2825_REF_MIN_CLK 2000 /* KHz */ #define SSD2825_REF_MIN_CLK 2000 /* KHz */
static const char * const ssd2825_supplies[] = {
"dvdd-supply", "avdd-supply", "vddio-supply"
};
struct ssd2825_bridge_priv { struct ssd2825_bridge_priv {
struct mipi_dsi_host host; struct mipi_dsi_host host;
struct mipi_dsi_device device; struct mipi_dsi_device device;
@@ -115,6 +120,8 @@ struct ssd2825_bridge_priv {
struct udevice *panel; struct udevice *panel;
struct display_timing timing; struct display_timing timing;
struct udevice *supplies[ARRAY_SIZE(ssd2825_supplies)];
struct gpio_desc power_gpio; struct gpio_desc power_gpio;
struct clk *tx_clk; struct clk *tx_clk;
@@ -444,7 +451,7 @@ static int ssd2825_bridge_hw_init(struct udevice *dev)
{ {
struct ssd2825_bridge_priv *priv = dev_get_priv(dev); struct ssd2825_bridge_priv *priv = dev_get_priv(dev);
struct video_bridge_priv *uc_priv = dev_get_uclass_priv(dev); struct video_bridge_priv *uc_priv = dev_get_uclass_priv(dev);
int ret; int i, ret;
ret = clk_prepare_enable(priv->tx_clk); ret = clk_prepare_enable(priv->tx_clk);
if (ret) { if (ret) {
@@ -453,11 +460,14 @@ static int ssd2825_bridge_hw_init(struct udevice *dev)
return ret; return ret;
} }
ret = dm_gpio_set_value(&priv->power_gpio, 1); /* enable supplies */
if (ret) { for (i = 0; i < ARRAY_SIZE(ssd2825_supplies); i++) {
log_debug("%s: error changing power-gpios (%d)\n", ret = regulator_set_enable_if_allowed(priv->supplies[i], 1);
__func__, ret); if (ret) {
return ret; log_debug("%s: cannot enable %s %d\n", __func__,
ssd2825_supplies[i], ret);
return ret;
}
} }
mdelay(10); mdelay(10);
@@ -506,7 +516,7 @@ static int ssd2825_bridge_probe(struct udevice *dev)
struct spi_slave *slave = dev_get_parent_priv(dev); struct spi_slave *slave = dev_get_parent_priv(dev);
struct mipi_dsi_device *device = &priv->device; struct mipi_dsi_device *device = &priv->device;
struct mipi_dsi_panel_plat *mipi_plat; struct mipi_dsi_panel_plat *mipi_plat;
int ret; int i, ret;
ret = spi_claim_bus(slave); ret = spi_claim_bus(slave);
if (ret) { if (ret) {
@@ -533,12 +543,16 @@ static int ssd2825_bridge_probe(struct udevice *dev)
device->format = mipi_plat->format; device->format = mipi_plat->format;
device->mode_flags = mipi_plat->mode_flags; device->mode_flags = mipi_plat->mode_flags;
/* get panel gpios */ /* get supplies */
ret = gpio_request_by_name(dev, "power-gpios", 0, for (i = 0; i < ARRAY_SIZE(ssd2825_supplies); i++) {
&priv->power_gpio, GPIOD_IS_OUT); ret = device_get_supply_regulator(dev, ssd2825_supplies[i],
if (ret) { &priv->supplies[i]);
log_err("could not decode power-gpios (%d)\n", ret); if (ret) {
return ret; log_debug("%s: cannot get %s %d\n", __func__,
ssd2825_supplies[i], ret);
if (ret != -ENOENT)
return log_ret(ret);
}
} }
/* get clk */ /* get clk */