Skip to content

Commit

Permalink
---
Browse files Browse the repository at this point in the history
yaml
---
r: 220538
b: refs/heads/master
c: 993af7c
h: refs/heads/master
v: v3
  • Loading branch information
Axel Lin authored and Liam Girdwood committed Oct 28, 2010
1 parent 11f0dbe commit 74a4047
Show file tree
Hide file tree
Showing 2 changed files with 19 additions and 8 deletions.
2 changes: 1 addition & 1 deletion [refs]
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
---
refs/heads/master: 5976f0959d5251ae5b4db848eaa2f42a19e98652
refs/heads/master: 993af7c048f414121bc81e0d6e69456e3862a06b
25 changes: 18 additions & 7 deletions trunk/drivers/regulator/lp3972.c
Original file line number Diff line number Diff line change
Expand Up @@ -192,7 +192,7 @@ static int lp3972_i2c_read(struct i2c_client *i2c, char reg, int count,
return -EIO;
ret = i2c_smbus_read_byte_data(i2c, reg);
if (ret < 0)
return -EIO;
return ret;

*dest = ret;
return 0;
Expand All @@ -215,7 +215,7 @@ static u8 lp3972_reg_read(struct lp3972 *lp3972, u8 reg)
lp3972_i2c_read(lp3972->i2c, reg, 1, &val);

dev_dbg(lp3972->dev, "reg read 0x%02x -> 0x%02x\n", (int)reg,
(unsigned)val&0xff);
(unsigned)val & 0xff);

mutex_unlock(&lp3972->io_lock);

Expand All @@ -234,7 +234,7 @@ static int lp3972_set_bits(struct lp3972 *lp3972, u8 reg, u16 mask, u16 val)
if (ret == 0) {
ret = lp3972_i2c_write(lp3972->i2c, reg, 1, &tmp);
dev_dbg(lp3972->dev, "reg write 0x%02x -> 0x%02x\n", (int)reg,
(unsigned)val&0xff);
(unsigned)val & 0xff);
}
mutex_unlock(&lp3972->io_lock);

Expand Down Expand Up @@ -320,6 +320,13 @@ static int lp3972_ldo_set_voltage(struct regulator_dev *dev,
if (ret)
return ret;

/*
* LDO1 and LDO5 support voltage control by either target voltage1
* or target voltage2 register.
* We use target voltage1 register for LDO1 and LDO5 in this driver.
* We need to update voltage change control register(0x20) to enable
* LDO1 and LDO5 to change to their programmed target values.
*/
switch (ldo) {
case LP3972_LDO1:
case LP3972_LDO5:
Expand Down Expand Up @@ -401,7 +408,8 @@ static int lp3972_dcdc_get_voltage(struct regulator_dev *dev)
val = 1000 * buck_voltage_map[buck][reg];
else {
val = 0;
dev_warn(&dev->dev, "chip reported incorrect voltage value.\n");
dev_warn(&dev->dev, "chip reported incorrect voltage value."
" reg = %d\n", reg);
}

return val;
Expand Down Expand Up @@ -523,7 +531,7 @@ static struct regulator_desc regulators[] = {
},
};

static int setup_regulators(struct lp3972 *lp3972,
static int __devinit setup_regulators(struct lp3972 *lp3972,
struct lp3972_platform_data *pdata)
{
int i, err;
Expand Down Expand Up @@ -584,10 +592,13 @@ static int __devinit lp3972_i2c_probe(struct i2c_client *i2c,

/* Detect LP3972 */
ret = lp3972_i2c_read(i2c, LP3972_SYS_CONTROL1_REG, 1, &val);
if (ret == 0 && (val & SYS_CONTROL1_INIT_MASK) != SYS_CONTROL1_INIT_VAL)
if (ret == 0 &&
(val & SYS_CONTROL1_INIT_MASK) != SYS_CONTROL1_INIT_VAL) {
ret = -ENODEV;
dev_err(&i2c->dev, "chip reported: val = 0x%x\n", val);
}
if (ret < 0) {
dev_err(&i2c->dev, "failed to detect device\n");
dev_err(&i2c->dev, "failed to detect device. ret = %d\n", ret);
goto err_detect;
}

Expand Down

0 comments on commit 74a4047

Please sign in to comment.