Re: [PATCH 1/2] regulator: act8945: Implement PM functionalities

From: Mark Brown
Date: Wed Nov 07 2018 - 09:54:00 EST


On Fri, Oct 26, 2018 at 04:19:48PM +0000, Claudiu.Beznea@xxxxxxxxxxxxx wrote:

> +static unsigned int act8945a_of_map_mode(unsigned int mode)
> +{
> + if (mode == ACT8945A_DCDC_MODE_POWER_SAVING)
> + return REGULATOR_MODE_STANDBY;
> +
> + return REGULATOR_MODE_NORMAL;
> +}

This should error out if it gets an unknown value rather than silently
mapping it to normal - we don't know what the user intended to set here.
There should also be some binding documentation updates saying what the
values that can be set are.

> +static void act8945a_pmic_shutdown(struct platform_device *pdev)
> +{
> + struct act8945a_pmic *act8945a = platform_get_drvdata(pdev);
> + struct regmap *regmap = act8945a->regmap;
> +
> + /*
> + * Ask the PMIC to shutdown everything on the next PWRHLD transition.
> + */
> + regmap_write(regmap, ACT8945A_SYS_CTRL, 0x0);
> }
>

This shutdown function appears to be independant of the mode setting and
would be better split out as a separate patch (you could have one patch
adding the regmap stuff, one for this and one for the mode setting).
It makes review a lot simpler if each patch does a minimal set of
changes.

Attachment: signature.asc
Description: PGP signature