Re: [PATCH 1/2] regulator: act8865: operating mode and suspend state support

From: Mark Brown
Date: Mon Aug 12 2019 - 07:10:16 EST


On Sat, Aug 10, 2019 at 01:18:54PM +0530, Raag Jadav wrote:

> +static int act8865_set_mode(struct regulator_dev *rdev, unsigned int mode)
> +{
> + struct act8865 *act8865 = rdev_get_drvdata(rdev);
> + struct regmap *regmap = rdev->regmap;
> + int id = rdev_get_id(rdev);
> + int reg, ret, val = 0;

This function doesn't check if the mode is _FIXED - if it is then I'd
expect to get an error when trying to set the mode (I'm assuming that
means fixed in hardware).

> +static unsigned int act8865_get_mode(struct regulator_dev *rdev)
> +{
> + struct act8865 *act8865 = rdev_get_drvdata(rdev);
> + int id = rdev_get_id(rdev);
> +
> + if (id < ACT8865_ID_DCDC1 || id >= ACT8865_ID_MAX)
> + return -EINVAL;
> +
> + return act8865->op_mode[id];
> +}

This should be reading the value back from the hardware.

Attachment: signature.asc
Description: PGP signature