mail archive of the barebox mailing list
 help / color / mirror / Atom feed
* [PATCH v5] video: simple-panel: add regulator support
@ 2025-01-28 16:57 Michael Grzeschik
  2025-01-31 13:22 ` Sascha Hauer
  0 siblings, 1 reply; 2+ messages in thread
From: Michael Grzeschik @ 2025-01-28 16:57 UTC (permalink / raw)
  To: barebox

Signed-off-by: Michael Grzeschik <m.grzeschik@pengutronix.de>

---
v4 -> v5: - regulator enable/disable before and after the gpio in right order
          - use dev_errp_probe after regulator_get
v3 -> v4: - better bail out if the regulator is set but not available
v2 -> v3: - reset regulator->power to NULL in case nothing was found
v1 -> v2: - added the missing signed-off-by
---
 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..931cbbe65f 100644
--- a/drivers/video/simple-panel.c
+++ b/drivers/video/simple-panel.c
@@ -12,6 +12,7 @@
 #include <fb.h>
 #include <gpio.h>
 #include <of_gpio.h>
+#include <regulator.h>
 #include <video/backlight.h>
 #include <video/vpl.h>
 #include <i2c/i2c.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;
 };
 
@@ -42,6 +44,8 @@ static int simple_panel_enable(struct simple_panel *panel)
 		}
 	}
 
+	regulator_enable(panel->power);
+
 	if (gpio_is_valid(panel->enable_gpio))
 		gpio_direction_output(panel->enable_gpio,
 			panel->enable_active_high);
@@ -69,6 +73,8 @@ static int simple_panel_disable(struct simple_panel *panel)
 		gpio_direction_output(panel->enable_gpio,
 			!panel->enable_active_high);
 
+	regulator_disable(panel->power);
+
 	return 0;
 }
 
@@ -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))
+		return dev_errp_probe(dev, panel->power, "Cannot find regulator\n");
+
 	ret = vpl_register(&panel->vpl);
 	if (ret)
 		return ret;
-- 
2.39.5




^ permalink raw reply	[flat|nested] 2+ messages in thread

* Re: [PATCH v5] video: simple-panel: add regulator support
  2025-01-28 16:57 [PATCH v5] video: simple-panel: add regulator support Michael Grzeschik
@ 2025-01-31 13:22 ` Sascha Hauer
  0 siblings, 0 replies; 2+ messages in thread
From: Sascha Hauer @ 2025-01-31 13:22 UTC (permalink / raw)
  To: barebox, Michael Grzeschik


On Tue, 28 Jan 2025 17:57:55 +0100, Michael Grzeschik wrote:
> 


Applied, thanks!

[1/1] video: simple-panel: add regulator support
      https://git.pengutronix.de/cgit/barebox/commit/?id=5a85b2dd66c6 (link may not be stable)

Best regards,
-- 
Sascha Hauer <s.hauer@pengutronix.de>




^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2025-01-31 13:22 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2025-01-28 16:57 [PATCH v5] video: simple-panel: add regulator support Michael Grzeschik
2025-01-31 13:22 ` Sascha Hauer

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox