Skip to contentSkip to conversation

regulator: da903x: Don't read/write to DA9030_INVAL/DA9034_INVAL address

PATCH Applied Axel Lin 2 participants 2 messages Jun 7, 2012 – Jun 8, 2012 Voltage and current regulator framework

lore
Share & tools
lore

Axel Lin

author
#0 lore raw

PATCH 1/1 regulator: da903x: Don't read/write to DA9030_INVAL/DA9034_INVAL address

For fixed voltage, DA9030_LDO13 and DA9034_LDO5, the info->vol_reg is DA9030_INVAL/DA9034_INVAL.
It does not make sense to read/write to DA9030_INVAL/DA9034_INVAL address.

---
Because we use [list|map]_voltage_linear for fixed voltage where uV_step is 0, this patch also needs below patch:
[PATCH RFC 1/2] regulator: core: Allow uV_step to be 0 for linear mapping if fixed voltage

 drivers/regulator/da903x.c |    6 ++++++
 1 file changed, 6 insertions(+)
drivers/regulator/da903x.c +6 -0
index 1005f5f..36c5b92 100644
@@ -107,6 +107,9 @@ static int da903x_set_voltage_sel(struct regulator_dev *rdev, unsigned selector)
 	struct device *da9034_dev = to_da903x_dev(rdev);
 	uint8_t val, mask;
 
+	if (rdev->desc->n_voltages == 1)
+		return -EINVAL;
+
 	val = selector << info->vol_shift;
 	mask = ((1 << info->vol_nbits) - 1)  << info->vol_shift;
 
@@ -120,6 +123,9 @@ static int da903x_get_voltage_sel(struct regulator_dev *rdev)
 	uint8_t val, mask;
 	int ret;
 
+	if (rdev->desc->n_voltages == 1)
+		return 0;
+
 	ret = da903x_read(da9034_dev, info->vol_reg, &val);
 	if (ret)
 		return ret;
Signature · 1 line
1.7.9.5
Applied
#1 lore raw
Quoted 3 lines · Axel Lin

For fixed voltage, DA9030_LDO13 and DA9034_LDO5, the info->vol_reg is DA9030_INVAL/DA9034_INVAL.
It does not make sense to read/write to DA9030_INVAL/DA9034_INVAL address.

Applied, thanks.