Skip to content

Commit

Permalink
regulators: Added verbose debug messages to ab8500 regulators
Browse files Browse the repository at this point in the history
The verbose debug outputs register writes and reads that can be
used to debug the driver.

Signed-off-by: Bengt Jonsson <bengt.g.jonsson@stericsson.com>
Acked-by: Linus Walleij <linus.walleij@stericsson.com>
Acked-by: Mark Brown <broonie@opensource.wolfsonmicro.com>
Signed-off-by: Liam Girdwood <lrg@slimlogic.co.uk>
  • Loading branch information
Bengt Jonsson authored and Liam Girdwood committed Jan 12, 2011
1 parent fc24b42 commit 09aefa1
Showing 1 changed file with 51 additions and 12 deletions.
63 changes: 51 additions & 12 deletions drivers/regulator/ab8500.c
Original file line number Diff line number Diff line change
Expand Up @@ -114,6 +114,12 @@ static int ab8500_regulator_enable(struct regulator_dev *rdev)
if (ret < 0)
dev_err(rdev_get_dev(rdev),
"couldn't set enable bits for regulator\n");

dev_vdbg(rdev_get_dev(rdev),
"%s-enable (bank, reg, mask, value): 0x%x, 0x%x, 0x%x, 0x%x\n",
info->desc.name, info->update_bank, info->update_reg,
info->update_mask, info->update_val_enable);

return ret;
}

Expand All @@ -133,29 +139,41 @@ static int ab8500_regulator_disable(struct regulator_dev *rdev)
if (ret < 0)
dev_err(rdev_get_dev(rdev),
"couldn't set disable bits for regulator\n");

dev_vdbg(rdev_get_dev(rdev),
"%s-disable (bank, reg, mask, value): 0x%x, 0x%x, 0x%x, 0x%x\n",
info->desc.name, info->update_bank, info->update_reg,
info->update_mask, 0x0);

return ret;
}

static int ab8500_regulator_is_enabled(struct regulator_dev *rdev)
{
int ret;
struct ab8500_regulator_info *info = rdev_get_drvdata(rdev);
u8 value;
u8 regval;

if (info == NULL) {
dev_err(rdev_get_dev(rdev), "regulator info null pointer\n");
return -EINVAL;
}

ret = abx500_get_register_interruptible(info->dev,
info->update_bank, info->update_reg, &value);
info->update_bank, info->update_reg, &regval);
if (ret < 0) {
dev_err(rdev_get_dev(rdev),
"couldn't read 0x%x register\n", info->update_reg);
return ret;
}

if (value & info->update_mask)
dev_vdbg(rdev_get_dev(rdev),
"%s-is_enabled (bank, reg, mask, value): 0x%x, 0x%x, 0x%x,"
" 0x%x\n",
info->desc.name, info->update_bank, info->update_reg,
info->update_mask, regval);

if (regval & info->update_mask)
return true;
else
return false;
Expand All @@ -182,29 +200,35 @@ static int ab8500_list_voltage(struct regulator_dev *rdev, unsigned selector)

static int ab8500_regulator_get_voltage(struct regulator_dev *rdev)
{
int ret;
int ret, val;
struct ab8500_regulator_info *info = rdev_get_drvdata(rdev);
u8 value;
u8 regval;

if (info == NULL) {
dev_err(rdev_get_dev(rdev), "regulator info null pointer\n");
return -EINVAL;
}

ret = abx500_get_register_interruptible(info->dev, info->voltage_bank,
info->voltage_reg, &value);
ret = abx500_get_register_interruptible(info->dev,
info->voltage_bank, info->voltage_reg, &regval);
if (ret < 0) {
dev_err(rdev_get_dev(rdev),
"couldn't read voltage reg for regulator\n");
return ret;
}

dev_vdbg(rdev_get_dev(rdev),
"%s-get_voltage (bank, reg, mask, value): 0x%x, 0x%x, 0x%x,"
" 0x%x\n",
info->desc.name, info->voltage_bank, info->voltage_reg,
info->voltage_mask, regval);

/* vintcore has a different layout */
value &= info->voltage_mask;
val = regval & info->voltage_mask;
if (info->desc.id == AB8500_LDO_INTCORE)
ret = info->voltages[value >> 0x3];
ret = info->voltages[val >> 0x3];
else
ret = info->voltages[value];
ret = info->voltages[val];

return ret;
}
Expand All @@ -231,6 +255,7 @@ static int ab8500_regulator_set_voltage(struct regulator_dev *rdev,
{
int ret;
struct ab8500_regulator_info *info = rdev_get_drvdata(rdev);
u8 regval;

if (info == NULL) {
dev_err(rdev_get_dev(rdev), "regulator info null pointer\n");
Expand All @@ -248,13 +273,20 @@ static int ab8500_regulator_set_voltage(struct regulator_dev *rdev,
*selector = ret;

/* set the registers for the request */
regval = (u8)ret;
ret = abx500_mask_and_set_register_interruptible(info->dev,
info->voltage_bank, info->voltage_reg,
info->voltage_mask, (u8)ret);
info->voltage_bank, info->voltage_reg,
info->voltage_mask, regval);
if (ret < 0)
dev_err(rdev_get_dev(rdev),
"couldn't set voltage reg for regulator\n");

dev_vdbg(rdev_get_dev(rdev),
"%s-set_voltage (bank, reg, mask, value): 0x%x, 0x%x, 0x%x,"
" 0x%x\n",
info->desc.name, info->voltage_bank, info->voltage_reg,
info->voltage_mask, regval);

return ret;
}

Expand Down Expand Up @@ -418,6 +450,9 @@ static __devinit int ab8500_regulator_probe(struct platform_device *pdev)
}
return err;
}

dev_vdbg(rdev_get_dev(info->regulator),
"%s-probed\n", info->desc.name);
}

return 0;
Expand All @@ -430,6 +465,10 @@ static __devexit int ab8500_regulator_remove(struct platform_device *pdev)
for (i = 0; i < ARRAY_SIZE(ab8500_regulator_info); i++) {
struct ab8500_regulator_info *info = NULL;
info = &ab8500_regulator_info[i];

dev_vdbg(rdev_get_dev(info->regulator),
"%s-remove\n", info->desc.name);

regulator_unregister(info->regulator);
}

Expand Down

0 comments on commit 09aefa1

Please sign in to comment.