drm/panel: simple: support positive/negative driven supply

Change-Id: I0f100f4f6fef67996edbcaa5d24d02ba38c38124
Signed-off-by: Wyon Bi <bivvy.bi@rock-chips.com>
This commit is contained in:
Wyon Bi
2019-12-12 08:42:24 +08:00
parent a406dddaf9
commit bb34dd00f4
2 changed files with 17 additions and 0 deletions
@@ -12,6 +12,8 @@ Required properties:
- power-supply: See panel-common.txt
Optional properties:
- vsp-supply: positive voltage supply
- vsn-supply: negative voltage supply
- ddc-i2c-bus: phandle of an I2C controller used for DDC EDID probing
- enable-gpios: GPIO pin to enable or disable the panel
- reset-gpios: GPIO pin to reset the panel
+15
View File
@@ -116,6 +116,7 @@ struct panel_simple {
struct backlight_device *backlight;
struct regulator *supply;
struct regulator_bulk_data supplies[2];
struct i2c_adapter *ddc;
struct gpio_desc *enable_gpio;
@@ -428,6 +429,10 @@ static int panel_simple_regulator_enable(struct panel_simple *p)
{
int err;
err = regulator_bulk_enable(ARRAY_SIZE(p->supplies), p->supplies);
if (err < 0)
return err;
if (p->power_invert) {
if (regulator_is_enabled(p->supply) > 0)
regulator_disable(p->supply);
@@ -454,6 +459,8 @@ static int panel_simple_regulator_disable(struct panel_simple *p)
regulator_disable(p->supply);
}
regulator_bulk_disable(ARRAY_SIZE(p->supplies), p->supplies);
return 0;
}
@@ -674,6 +681,14 @@ static int panel_simple_probe(struct device *dev, const struct panel_desc *desc)
if (IS_ERR(panel->supply))
return PTR_ERR(panel->supply);
panel->supplies[0].supply = "vsp";
panel->supplies[1].supply = "vsn";
err = devm_regulator_bulk_get(dev, ARRAY_SIZE(panel->supplies),
panel->supplies);
if (err)
return err;
panel->enable_gpio = devm_gpiod_get_optional(dev, "enable",
GPIOD_ASIS);
if (IS_ERR(panel->enable_gpio)) {