Re: [PATCH v4] regulator: MAX77686: Add Maxim 77686 regulator driver

From: Yadwinder Singh Brar
Date: Fri May 25 2012 - 08:27:32 EST


Hi Jonghwa,

> +
> +       if (pdata)
> +               max77686->opmode_data = pdata->opmode_data;

I think this is unused(unwanted) now.

> +
> +       for (i = 0; i < MAX77686_REGULATORS; i++) {
> +               if (pdata)
> +                       init_data[pdata->regulators[i].id] =
> +                                                pdata->regulators[i].initdata;

I think we can directly use pdata->regulators[i].initdata instead of
init_data[i].
In case if pdata is not their we can use same instance of
init_data(default) for all regulators.

> +
> +               config.init_data = init_data[i];
> +               rdev[i] = regulator_register(&regulators[i], &config);
> +

> +
> +       for (i = 0; i < 8; i++) {
> +               if (pdata->buck2_voltage[i] > 0)
> +                       ret = regulator_map_voltage_linear(
> +                                       rdev[MAX77686_LDOS+1],
> +                                       pdata->buck2_voltage[i],
> +                                       pdata->buck2_voltage[i]
> +                                       + MAX77686_DVS_UVSTEP);
> +               /* 1.1V as default for safety */
> +               if (pdata->buck2_voltage[i] <= 0 || ret < 0)
> +                       max77686->buck2_vol[i] = 0x28;
> +               else
> +                       max77686->buck2_vol[i] = ret;
> +               regmap_write(max77686->iodev->regmap,
> +                        MAX77686_REG_BUCK2DVS1 + i, max77686->buck2_vol[i]);
> +
> +               if (pdata->buck3_voltage[i] > 0)
> +                       ret = regulator_map_voltage_linear(
> +                                       rdev[MAX77686_LDOS+1],
> +                                       pdata->buck3_voltage[i],
> +                                       pdata->buck3_voltage[i]
> +                                       + MAX77686_DVS_UVSTEP);
> +               /* 1.1V as default for safety */
> +               if (pdata->buck3_voltage[i] <= 0 || ret < 0)
> +                       max77686->buck3_vol[i] = 0x28;
> +               else
> +                       max77686->buck3_vol[i] = ret;
> +               regmap_write(max77686->iodev->regmap,
> +                        MAX77686_REG_BUCK3DVS1 + i, max77686->buck3_vol[i]);
> +
> +               if (pdata->buck4_voltage[i] > 0)
> +                       ret = regulator_map_voltage_linear(
> +                                       rdev[MAX77686_LDOS+1],
> +                                       pdata->buck4_voltage[i],
> +                                       pdata->buck4_voltage[i]
> +                                       + MAX77686_DVS_UVSTEP);
> +               /* 1.1V as default for safety */
> +               if (pdata->buck4_voltage[i] <= 0 || ret < 0)
> +                       max77686->buck4_vol[i] = 0x28;
> +               else
> +                       max77686->buck4_vol[i] = ret;
> +               regmap_write(max77686->iodev->regmap,
> +                        MAX77686_REG_BUCK4DVS1 + i, max77686->buck4_vol[i]);
> +       }

Why do we need to initialize the 8 voltage registers of BUCK2/3/4 ?


Regards,
Yadwinder.
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/