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

Stephen Warren swarren at wwwdotorg.org
Sat Oct 24 20:44:01 PDT 2015


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.



More information about the linux-rpi-kernel mailing list