[PATCH 7/9] drm/simplekms: Acquire regulators from DT device node
Geert Uytterhoeven
geert at linux-m68k.org
Thu Jun 25 13:36:12 UTC 2020
Hi Thomas,
On Thu, Jun 25, 2020 at 2:00 PM Thomas Zimmermann <tzimmermann at 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 at 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
--
Geert Uytterhoeven -- There's lots of Linux beyond ia32 -- geert at linux-m68k.org
In personal conversations with technical people, I call myself a hacker. But
when I'm talking to journalists I just say "programmer" or something like that.
-- Linus Torvalds
More information about the dri-devel
mailing list