Re: [PATCH 2/3] regulator: MAX77686: Add Maxim 77686 regulator driver

From: Mark Brown
Date: Sun May 20 2012 - 11:56:48 EST


On Fri, May 18, 2012 at 06:32:18PM +0900, Jonghwa Lee wrote:

> Add driver for support max77686 regulator.
> MAX77686 provides LDOs[1~26] and BUCKs[1~9]. It support to set or get the
> volatege of regulator on max77686 chip with using regmap.

Looks mostly good, a few things below but they're all pretty
minor/straghtforward.

> +/* LDO3 ~ 5, 9 ~ 14, 16 ~ 26 (uV) */
> +static const struct voltage_map_desc ldo_voltage_map_desc = {
> + .min = 800000, .max = 3950000, .step = 50000, .n_bits = 6,
> +};

Should convert all these to use regulator_map_voltage_linear() and
regulator_{get,set}_voltage_vsel().

> + ret = regmap_read(max77686->iodev->regmap, reg, &val);
> +
> + if (ret)
> + return ret;

> + printk(PMIC_DEBUG "id=%d, ret=%d, val=%x, mask=%x, pattern=%x\n",
> + rdev_get_id(rdev), (val & mask) == pattern,
> + val, mask, pattern);

dev_dbg() or just remove this (and similarly for the other similar logs).

> + {
> + .name = "EN32KHz AP",
> + .id = MAX77686_EN32KHZ_AP,
> + .ops = &max77686_fixedvolt_ops,
> + .type = REGULATOR_VOLTAGE,
> + .owner = THIS_MODULE,
> + }, {
> + .name = "EN32KHz CP",
> + .id = MAX77686_EN32KHZ_CP,
> + .ops = &max77686_fixedvolt_ops,
> + .type = REGULATOR_VOLTAGE,
> + .owner = THIS_MODULE,
> + }, {
> + .name = "EN32KHz PMIC",
> + .id = MAX77686_P32KH,
> + .ops = &max77686_fixedvolt_ops,
> + .type = REGULATOR_VOLTAGE,
> + .owner = THIS_MODULE,
> + },

These should be managed via the clock API now we have one.

> + if (!pdata)
> + dev_err(pdev->dev.parent, "No platform init data supplied.\n");

Should be able to carry on without this and register the regulators to
allow for diagnostics and powering off unused regulators when we have
full constraints.

> + size = sizeof(struct regulator_dev *) * MAX77686_REGULATORS;
> + max77686->rdev = devm_kzalloc(&pdev->dev, size, GFP_KERNEL);
> + if (!max77686->rdev) {
> + devm_kfree(&pdev->dev, max77686);

Shouldn't need to devm_kfree(), the major point is that this will happen
automatically.

Attachment: signature.asc
Description: Digital signature