From bb34dd00f4b80038bd4f2ccee56d394a3300d129 Mon Sep 17 00:00:00 2001 From: Wyon Bi Date: Thu, 12 Dec 2019 08:42:24 +0800 Subject: [PATCH] drm/panel: simple: support positive/negative driven supply Change-Id: I0f100f4f6fef67996edbcaa5d24d02ba38c38124 Signed-off-by: Wyon Bi --- .../bindings/display/panel/simple-panel.txt | 2 ++ drivers/gpu/drm/panel/panel-simple.c | 15 +++++++++++++++ 2 files changed, 17 insertions(+) diff --git a/Documentation/devicetree/bindings/display/panel/simple-panel.txt b/Documentation/devicetree/bindings/display/panel/simple-panel.txt index a8e8486f9c5e..c04a1e661653 100644 --- a/Documentation/devicetree/bindings/display/panel/simple-panel.txt +++ b/Documentation/devicetree/bindings/display/panel/simple-panel.txt @@ -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 diff --git a/drivers/gpu/drm/panel/panel-simple.c b/drivers/gpu/drm/panel/panel-simple.c index b0c5414bbfdb..369e2f8d87ae 100644 --- a/drivers/gpu/drm/panel/panel-simple.c +++ b/drivers/gpu/drm/panel/panel-simple.c @@ -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)) {