Re: [PATCH 3/4] regulator: as3722: add regulator driver for AMS AS3722

From: Laxman Dewangan
Date: Tue Sep 17 2013 - 07:54:30 EST



+static int as3722_ldo_get_voltage_sel(struct regulator_dev *rdev)
+{
+ int ret;
+
+ ret = regulator_get_voltage_sel_regmap(rdev);
+ if (ret >= 0x40)
+ ret -= 0x1B;
+ return ret;
+}
This looks very strange. What's going on here? A gap in the selectors?
If that's the case you probably want to be using linear ranges.

Yes device does not want to be configure the vsel to 0x25 to 0x3F

01h-24h : V_LDO1=0.8V+ldo1_vsel*25mV
25h-3Fh : do not use
40h-7Fh : V_LDO1=1.725V+(ldo1_vsel-40h)*25mV

Let me use linear range.

+ if (reg_config->ext_control) {
+ ret = regulator_enable_regmap(rdev);
+ if (ret < 0) {
+ dev_err(&pdev->dev,
+ "Regulator %d enable failed: %d\n",
+ id, ret);
+ goto scrub;
+ }
This looks wrong... why is the regualtor being enabled by something
other than the core?

When the rail is configured externally controlled then we are not providing the enable/disable callback to enable through register access. So core will not be able to enable it.
Here, we are making sure that it is enabled through register write.
After that enable/disable can be done by device-input pin toggeling.

--
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/