Skip to content

Commit f6d8a80

Browse files
eichenbergerrobertfoss
authored andcommitted
drm/bridge: lt8912b: Add power supplies
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 <[email protected]> Signed-off-by: Francesco Dolcini <[email protected]> Reviewed-by: Robert Foss <[email protected]> Signed-off-by: Robert Foss <[email protected]> Link: https://patchwork.freedesktop.org/patch/msgid/[email protected]
1 parent f168c7f commit f6d8a80

File tree

1 file changed

+30
-0
lines changed

1 file changed

+30
-0
lines changed

drivers/gpu/drm/bridge/lontium-lt8912b.c

Lines changed: 30 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -43,6 +43,8 @@ struct lt8912 {
4343

4444
struct videomode mode;
4545

46+
struct regulator_bulk_data supplies[7];
47+
4648
u8 data_lanes;
4749
bool is_power_on;
4850
};
@@ -257,6 +259,12 @@ static int lt8912_free_i2c(struct lt8912 *lt)
257259

258260
static int lt8912_hard_power_on(struct lt8912 *lt)
259261
{
262+
int ret;
263+
264+
ret = regulator_bulk_enable(ARRAY_SIZE(lt->supplies), lt->supplies);
265+
if (ret)
266+
return ret;
267+
260268
gpiod_set_value_cansleep(lt->gp_reset, 0);
261269
msleep(20);
262270

@@ -267,6 +275,9 @@ static void lt8912_hard_power_off(struct lt8912 *lt)
267275
{
268276
gpiod_set_value_cansleep(lt->gp_reset, 1);
269277
msleep(20);
278+
279+
regulator_bulk_disable(ARRAY_SIZE(lt->supplies), lt->supplies);
280+
270281
lt->is_power_on = false;
271282
}
272283

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

662673
static DEFINE_SIMPLE_DEV_PM_OPS(lt8912_bridge_pm_ops, lt8912_bridge_suspend, lt8912_bridge_resume);
663674

675+
static int lt8912_get_regulators(struct lt8912 *lt)
676+
{
677+
unsigned int i;
678+
const char * const supply_names[] = {
679+
"vdd", "vccmipirx", "vccsysclk", "vcclvdstx",
680+
"vcchdmitx", "vcclvdspll", "vcchdmipll"
681+
};
682+
683+
for (i = 0; i < ARRAY_SIZE(lt->supplies); i++)
684+
lt->supplies[i].supply = supply_names[i];
685+
686+
return devm_regulator_bulk_get(lt->dev, ARRAY_SIZE(lt->supplies),
687+
lt->supplies);
688+
}
689+
664690
static int lt8912_parse_dt(struct lt8912 *lt)
665691
{
666692
struct gpio_desc *gp_reset;
@@ -712,6 +738,10 @@ static int lt8912_parse_dt(struct lt8912 *lt)
712738
goto err_free_host_node;
713739
}
714740

741+
ret = lt8912_get_regulators(lt);
742+
if (ret)
743+
goto err_free_host_node;
744+
715745
of_node_put(port_node);
716746
return 0;
717747

0 commit comments

Comments
 (0)