Skip to content

Commit

Permalink
drm/bridge: lt8912b: Add power supplies
Browse files Browse the repository at this point in the history
Add supplies to the driver that can be used to turn the Lontium lt8912b
on and off. It can have up to 7 independent supplies, we add them all
and enable/disable them with bulk_enable/disable.

Signed-off-by: Stefan Eichenberger <stefan.eichenberger@toradex.com>
Signed-off-by: Francesco Dolcini <francesco.dolcini@toradex.com>
Reviewed-by: Robert Foss <rfoss@kernel.org>
Signed-off-by: Robert Foss <rfoss@kernel.org>
Link: https://patchwork.freedesktop.org/patch/msgid/20231115121338.22959-4-francesco@dolcini.it
  • Loading branch information
Stefan Eichenberger authored and Robert Foss committed Dec 4, 2023
1 parent f168c7f commit f6d8a80
Showing 1 changed file with 30 additions and 0 deletions.
30 changes: 30 additions & 0 deletions drivers/gpu/drm/bridge/lontium-lt8912b.c
Original file line number Diff line number Diff line change
@@ -43,6 +43,8 @@ struct lt8912 {

struct videomode mode;

struct regulator_bulk_data supplies[7];

u8 data_lanes;
bool is_power_on;
};
@@ -257,6 +259,12 @@ static int lt8912_free_i2c(struct lt8912 *lt)

static int lt8912_hard_power_on(struct lt8912 *lt)
{
int ret;

ret = regulator_bulk_enable(ARRAY_SIZE(lt->supplies), lt->supplies);
if (ret)
return ret;

gpiod_set_value_cansleep(lt->gp_reset, 0);
msleep(20);

@@ -267,6 +275,9 @@ static void lt8912_hard_power_off(struct lt8912 *lt)
{
gpiod_set_value_cansleep(lt->gp_reset, 1);
msleep(20);

regulator_bulk_disable(ARRAY_SIZE(lt->supplies), lt->supplies);

lt->is_power_on = false;
}

@@ -661,6 +672,21 @@ static int lt8912_bridge_suspend(struct device *dev)

static DEFINE_SIMPLE_DEV_PM_OPS(lt8912_bridge_pm_ops, lt8912_bridge_suspend, lt8912_bridge_resume);

static int lt8912_get_regulators(struct lt8912 *lt)
{
unsigned int i;
const char * const supply_names[] = {
"vdd", "vccmipirx", "vccsysclk", "vcclvdstx",
"vcchdmitx", "vcclvdspll", "vcchdmipll"
};

for (i = 0; i < ARRAY_SIZE(lt->supplies); i++)
lt->supplies[i].supply = supply_names[i];

return devm_regulator_bulk_get(lt->dev, ARRAY_SIZE(lt->supplies),
lt->supplies);
}

static int lt8912_parse_dt(struct lt8912 *lt)
{
struct gpio_desc *gp_reset;
@@ -712,6 +738,10 @@ static int lt8912_parse_dt(struct lt8912 *lt)
goto err_free_host_node;
}

ret = lt8912_get_regulators(lt);
if (ret)
goto err_free_host_node;

of_node_put(port_node);
return 0;

0 comments on commit f6d8a80

Please sign in to comment.