[PATCH] simple-panel: add regulator support
Michael Grzeschik
m.grzeschik at pengutronix.de
Sun Jan 26 13:44:28 PST 2025
---
drivers/video/simple-panel.c | 10 ++++++++++
1 file changed, 10 insertions(+)
diff --git a/drivers/video/simple-panel.c b/drivers/video/simple-panel.c
index 7048e2f51b..d4c6874987 100644
--- a/drivers/video/simple-panel.c
+++ b/drivers/video/simple-panel.c
@@ -10,6 +10,7 @@
#include <linux/err.h>
#include <of.h>
#include <fb.h>
+#include <regulator.h>
#include <gpio.h>
#include <of_gpio.h>
#include <video/backlight.h>
@@ -25,6 +26,7 @@ struct simple_panel {
struct device_node *backlight_node;
struct backlight_device *backlight;
struct device_node *ddc_node;
+ struct regulator *power;
int enable_delay;
};
@@ -49,6 +51,8 @@ static int simple_panel_enable(struct simple_panel *panel)
if (panel->enable_delay)
mdelay(panel->enable_delay);
+ regulator_enable(panel->power);
+
if (panel->backlight) {
ret = backlight_set_brightness_default(panel->backlight);
if (ret)
@@ -65,6 +69,8 @@ static int simple_panel_disable(struct simple_panel *panel)
if (panel->backlight)
backlight_set_brightness(panel->backlight, 0);
+ regulator_disable(panel->power);
+
if (gpio_is_valid(panel->enable_gpio))
gpio_direction_output(panel->enable_gpio,
!panel->enable_active_high);
@@ -154,6 +160,10 @@ static int simple_panel_probe(struct device *dev)
panel->backlight_node = of_parse_phandle(node, "backlight", 0);
+ panel->power = regulator_get(dev, "power");
+ if (IS_ERR(panel->power))
+ dev_warn(dev, "Cannot find regulator\n");
+
ret = vpl_register(&panel->vpl);
if (ret)
return ret;
--
2.39.5
More information about the barebox
mailing list