[RFC linus/master 1/4] regulator: add raspberry pi driver

Alexander Aring alex.aring at gmail.com
Sat Oct 24 23:59:01 PDT 2015


On Sat, Oct 24, 2015 at 09:44:01PM -0600, Stephen Warren wrote:
> On 10/24/2015 06:20 AM, Alexander Aring wrote:
> > This patch adds support for raspberrypi regulator driver. It supports
> > for enable/disable regulators via raspberry pi firmware.
> > 
> > It doesn't support to display/change(if frimware supports that) the
> > current voltage setting. Maybe somebody knows the default voltage which
> > the firmware sets and this can be added.
> 
> > diff --git a/drivers/regulator/raspberrypi-regulator.c b/drivers/regulator/raspberrypi-regulator.c
> 
> > +static int rpi_regulator_is_enabled(struct regulator_dev *rdev)
> > +{
> > +	struct rpi_regulator *reg = rdev_get_drvdata(rdev);
> > +	struct rpi_packet packet;
> > +	int ret;
> > +
> > +	packet.domain = rdev->desc->id;
> > +	ret = rpi_firmware_property(reg->fw, RPI_FIRMWARE_GET_POWER_STATE,
> > +				    &packet, sizeof(packet));
> 
> Have you validated that this firmware API works correctly in all cases?
> I recall having some issues with it when invoking it from U-Boot; the
> state returned didn't always match the actual HW state. You'd want to
> check invoking the API (a) before having explicitly turned the power
> domain on or off at all (b) after having turned it on (c) after having
> turned it off, and for all power domains.

No, I didn't checked it. Okay, I will put a,b,c in my testcase for the
next try.

For me, this sounds like a "regulator" use-case, regulators can have the
option:

- regulator-boot-on: bootloader/firmware enabled regulator

So far I know, this option should be handle that the regulator_enable
call should be always in the disable regulator state.

Okay, the regulator use-case doesn't match here. We don't know what the
Firmware really do on the "SET/GET" state, there is a little bit magic
in the background. We even don't know it at power-domains, but sounds
more abstract.

When we do the way with "power domains" then maybe we can introduce a
similar device-tree property, which ensures an on state is for a
"special power domain" is only called when the domain is inside off state.

- Alex



More information about the linux-rpi-kernel mailing list