Re: [PATCH V2 5/7] regualtor: s2mps11: Add samsung s2mps11 regulatordriver

From: Mark Brown
Date: Mon Jul 09 2012 - 09:13:15 EST


On Sat, Jul 07, 2012 at 06:42:09PM +0900, Sangbeom Kim wrote:

Looks fairly good overall but a lot of this should be able to be
factored out to use the standard regualtor core support for register
maps now.

> +static const struct sec_voltage_desc buck_voltage_val1 = {
> + .max = 2000000,
> + .min = 600000,
> + .step = 6250,
> +};

These should be using regulator_map_voltage_linear().

> +static int s2mps11_reg_is_enabled(struct regulator_dev *rdev)
> +{

This looks like it should be regulator_is_enabled_regmap() and similarly
for the other enable/disable operations.

> +static int s2mps11_get_voltage_sel(struct regulator_dev *rdev)
> +{

regulator_get_voltage_sel_regmap()

> +static int s2mps11_set_voltage(struct regulator_dev *rdev,
> + int min_uV, int max_uV, unsigned *selector)

Should be set_voltage_sel(), really set_voltage_sel_regmap()

> +static int s2mps11_set_voltage_time_sel(struct regulator_dev *rdev,
> + unsigned int old_sel,
> + unsigned int new_sel)

regulator_set_voltage_time().

> +static int s2mps11_set_voltage_sel(struct regulator_dev *rdev, unsigned selector)

regulator_set_voltage_sel_regmap()

> + s2mps11 = devm_kzalloc(&pdev->dev, sizeof(struct s2mps11_info),
> + GFP_KERNEL);
> + if (!s2mps11)
> + return -ENOMEM;
> +
> + size = sizeof(struct regulator_dev *) * pdata->num_regulators;
> + s2mps11->rdev = devm_kzalloc(&pdev->dev, size, GFP_KERNEL);
> + if (!s2mps11->rdev) {
> + return -ENOMEM;
> + }

You should register all the regulators unconditionally rather than only
registering the ones in platform data, this allows people to read the
state of the device even if they can't control it.

Attachment: signature.asc
Description: Digital signature