[PATCH v2 3/5] regulator: rk8xx: Return correct voltage for switchout converters

Kever Yang kever.yang at rock-chips.com
Wed Sep 27 04:49:41 CEST 2023


On 2023/8/22 06:30, Jonas Karlman wrote:
> From: shengfei Xu <xsf at rock-chips.com>
>
> The voltage value for switchout converters is always reported as 0 uV.
> When the switch is enabled, it's voltage is same as input supply.
>
> Fix this by implementing get_value for switchout converters.
>
> Fixes: ee30068fa574 ("power: pmic: rk809: support rk809 pmic")
> Signed-off-by: shengfei Xu <xsf at rock-chips.com>
> [jonas at kwiboo.se: fix checkpatch error, update commit message]
> Signed-off-by: Jonas Karlman <jonas at kwiboo.se>
Reviewed-by: Kever Yang <kever.yang at rock-chips.com>

Thanks,
- Kever
> ---
> v2:
> - New patch
>
>   drivers/power/regulator/rk8xx.c | 19 +++++++++++++++++++
>   1 file changed, 19 insertions(+)
>
> diff --git a/drivers/power/regulator/rk8xx.c b/drivers/power/regulator/rk8xx.c
> index 9444daa85c19..e80bd6c37230 100644
> --- a/drivers/power/regulator/rk8xx.c
> +++ b/drivers/power/regulator/rk8xx.c
> @@ -1032,6 +1032,25 @@ static int switch_get_suspend_enable(struct udevice *dev)
>    */
>   static int switch_get_value(struct udevice *dev)
>   {
> +	static const char * const supply_name_rk809[] = {
> +		"vcc9-supply",
> +		"vcc8-supply",
> +	};
> +	struct rk8xx_priv *priv = dev_get_priv(dev->parent);
> +	struct udevice *supply;
> +	int id = dev->driver_data - 1;
> +
> +	if (!switch_get_enable(dev))
> +		return 0;
> +
> +	if (priv->variant == RK809_ID) {
> +		if (!uclass_get_device_by_phandle(UCLASS_REGULATOR,
> +						  dev->parent,
> +						  supply_name_rk809[id],
> +						  &supply))
> +			return regulator_get_value(supply);
> +	}
> +
>   	return 0;
>   }
>   


More information about the U-Boot mailing list