Hi Thomas,
On Thu, Jun 25, 2020 at 2:00 PM Thomas Zimmermann tzimmermann@suse.de wrote:
Make sure required hardware regulators are enabled while the firmware framebuffer is in use.
The basic code has been taken from the simplefb driver and adapted to DRM. Regulators are released automatically via devres helpers.
Signed-off-by: Thomas Zimmermann tzimmermann@suse.de
Thanks for your patch!
--- a/drivers/gpu/drm/tiny/simplekms.c +++ b/drivers/gpu/drm/tiny/simplekms.c @@ -4,6 +4,7 @@ #include <linux/of_clk.h> #include <linux/platform_data/simplefb.h> #include <linux/platform_device.h> +#include <linux/regulator/consumer.h>
#include <drm/drm_atomic_state_helper.h> #include <drm/drm_connector.h> @@ -198,6 +199,11 @@ struct simplekms_device { unsigned int clk_count; struct clk **clks; #endif
/* regulators */
+#if defined CONFIG_OF && defined CONFIG_REGULATOR
unsigned int regulator_count;
struct regulator **regulators;
+#endif
/* simplefb settings */ struct drm_display_mode mode;
@@ -315,6 +321,125 @@ static int simplekms_device_init_clocks(struct simplekms_device *sdev) } #endif
+#if defined CONFIG_OF && defined CONFIG_REGULATOR
+#define SUPPLY_SUFFIX "-supply"
+/*
- Regulator handling code.
- Here we handle the num-supplies and vin*-supply properties of our
- "simple-framebuffer" dt node. This is necessary so that we can make sure
- that any regulators needed by the display hardware that the bootloader
- set up for us (and for which it provided a simplefb dt node), stay up,
- for the life of the simplefb driver.
Looks like there's a bulk regulator API, too?
Gr{oetje,eeting}s,
Geert