* [PATCH RFT 1/2] regulator: palmas: Fix regmap offsets for PALMAS_REG_SMPS10 vsel_reg
@ 2012-07-18 3:48 Axel Lin
2012-07-18 3:49 ` [PATCH RFT 2/2] regulator: palmas: Convert palmas_ops_ldo to [get|set]_voltage_sel_regmap Axel Lin
0 siblings, 1 reply; 3+ messages in thread
From: Axel Lin @ 2012-07-18 3:48 UTC (permalink / raw)
To: Mark Brown; +Cc: linux-kernel, Graeme Gregory, Liam Girdwood
Signed-off-by: Axel Lin <axel.lin@gmail.com>
---
drivers/regulator/palmas-regulator.c | 4 +++-
1 file changed, 3 insertions(+), 1 deletion(-)
diff --git a/drivers/regulator/palmas-regulator.c b/drivers/regulator/palmas-regulator.c
index 0fcf355..9e3e7f3 100644
--- a/drivers/regulator/palmas-regulator.c
+++ b/drivers/regulator/palmas-regulator.c
@@ -679,7 +679,9 @@ static __devinit int palmas_probe(struct platform_device *pdev)
case PALMAS_REG_SMPS10:
pmic->desc[id].n_voltages = PALMAS_SMPS10_NUM_VOLTAGES;
pmic->desc[id].ops = &palmas_ops_smps10;
- pmic->desc[id].vsel_reg = PALMAS_SMPS10_CTRL;
+ pmic->desc[id].vsel_reg =
+ PALMAS_BASE_TO_REG(PALMAS_SMPS_BASE,
+ PALMAS_SMPS10_CTRL);
pmic->desc[id].vsel_mask = SMPS10_VSEL;
pmic->desc[id].enable_reg =
PALMAS_BASE_TO_REG(PALMAS_SMPS_BASE,
--
1.7.9.5
^ permalink raw reply related [flat|nested] 3+ messages in thread
* [PATCH RFT 2/2] regulator: palmas: Convert palmas_ops_ldo to [get|set]_voltage_sel_regmap
2012-07-18 3:48 [PATCH RFT 1/2] regulator: palmas: Fix regmap offsets for PALMAS_REG_SMPS10 vsel_reg Axel Lin
@ 2012-07-18 3:49 ` Axel Lin
2012-07-18 4:26 ` Axel Lin
0 siblings, 1 reply; 3+ messages in thread
From: Axel Lin @ 2012-07-18 3:49 UTC (permalink / raw)
To: Mark Brown; +Cc: linux-kernel, Graeme Gregory, Liam Girdwood
Also remove palmas_ldo_write() function because it is not used after this
conversion.
Signed-off-by: Axel Lin <axel.lin@gmail.com>
---
drivers/regulator/palmas-regulator.c | 55 ++++------------------------------
1 file changed, 5 insertions(+), 50 deletions(-)
diff --git a/drivers/regulator/palmas-regulator.c b/drivers/regulator/palmas-regulator.c
index 9e3e7f3..1307194 100644
--- a/drivers/regulator/palmas-regulator.c
+++ b/drivers/regulator/palmas-regulator.c
@@ -194,16 +194,6 @@ static int palmas_ldo_read(struct palmas *palmas, unsigned int reg,
return regmap_read(palmas->regmap[REGULATOR_SLAVE], addr, dest);
}
-static int palmas_ldo_write(struct palmas *palmas, unsigned int reg,
- unsigned int value)
-{
- unsigned int addr;
-
- addr = PALMAS_BASE_TO_REG(PALMAS_LDO_BASE, reg);
-
- return regmap_write(palmas->regmap[REGULATOR_SLAVE], addr, value);
-}
-
static int palmas_is_enabled_smps(struct regulator_dev *dev)
{
struct palmas_pmic *pmic = rdev_get_drvdata(dev);
@@ -443,44 +433,6 @@ static int palmas_list_voltage_ldo(struct regulator_dev *dev,
return 850000 + (selector * 50000);
}
-static int palmas_get_voltage_ldo_sel(struct regulator_dev *dev)
-{
- struct palmas_pmic *pmic = rdev_get_drvdata(dev);
- int id = rdev_get_id(dev);
- int selector;
- unsigned int reg;
- unsigned int addr;
-
- addr = palmas_regs_info[id].vsel_addr;
-
- palmas_ldo_read(pmic->palmas, addr, ®);
-
- selector = reg & PALMAS_LDO1_VOLTAGE_VSEL_MASK;
-
- /* Adjust selector to match list_voltage ranges */
- if (selector > 49)
- selector = 49;
-
- return selector;
-}
-
-static int palmas_set_voltage_ldo_sel(struct regulator_dev *dev,
- unsigned selector)
-{
- struct palmas_pmic *pmic = rdev_get_drvdata(dev);
- int id = rdev_get_id(dev);
- unsigned int reg = 0;
- unsigned int addr;
-
- addr = palmas_regs_info[id].vsel_addr;
-
- reg = selector;
-
- palmas_ldo_write(pmic->palmas, addr, reg);
-
- return 0;
-}
-
static int palmas_map_voltage_ldo(struct regulator_dev *rdev,
int min_uV, int max_uV)
{
@@ -505,8 +457,8 @@ static struct regulator_ops palmas_ops_ldo = {
.is_enabled = palmas_is_enabled_ldo,
.enable = regulator_enable_regmap,
.disable = regulator_disable_regmap,
- .get_voltage_sel = palmas_get_voltage_ldo_sel,
- .set_voltage_sel = palmas_set_voltage_ldo_sel,
+ .get_voltage_sel = regulator_get_voltage_sel_regmap,
+ .set_voltage_sel = regulator_set_voltage_sel_regmap,
.list_voltage = palmas_list_voltage_ldo,
.map_voltage = palmas_map_voltage_ldo,
};
@@ -757,6 +709,9 @@ static __devinit int palmas_probe(struct platform_device *pdev)
pmic->desc[id].type = REGULATOR_VOLTAGE;
pmic->desc[id].owner = THIS_MODULE;
+ pmic->desc[id].vsel_reg = PALMAS_BASE_TO_REG(PALMAS_LDO_BASE,
+ palmas_regs_info[id].vsel_addr);
+ pmic->desc[id].vsel_mask = PALMAS_LDO1_VOLTAGE_VSEL_MASK;
pmic->desc[id].enable_reg = PALMAS_BASE_TO_REG(PALMAS_LDO_BASE,
palmas_regs_info[id].ctrl_addr);
pmic->desc[id].enable_mask = PALMAS_LDO1_CTRL_MODE_ACTIVE;
--
1.7.9.5
^ permalink raw reply related [flat|nested] 3+ messages in thread
* Re: [PATCH RFT 2/2] regulator: palmas: Convert palmas_ops_ldo to [get|set]_voltage_sel_regmap
2012-07-18 3:49 ` [PATCH RFT 2/2] regulator: palmas: Convert palmas_ops_ldo to [get|set]_voltage_sel_regmap Axel Lin
@ 2012-07-18 4:26 ` Axel Lin
0 siblings, 0 replies; 3+ messages in thread
From: Axel Lin @ 2012-07-18 4:26 UTC (permalink / raw)
To: Mark Brown; +Cc: linux-kernel, Graeme Gregory, Liam Girdwood
於 三,2012-07-18 於 11:49 +0800,Axel Lin 提到:
> Also remove palmas_ldo_write() function because it is not used after this
> conversion.
Oh. Just found another issue in current code.
Current code in palmas_ldo_init() calls palmas_smps_[read|write]
is wrong. It should call palmas_ldo_[read|write] instead.
And this means palmas_ldo_write() cannot be removed.
To make it easier for review, I'll resend the patches for palmas
as a serial.
Regards,
Axel
^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2012-07-18 4:27 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2012-07-18 3:48 [PATCH RFT 1/2] regulator: palmas: Fix regmap offsets for PALMAS_REG_SMPS10 vsel_reg Axel Lin
2012-07-18 3:49 ` [PATCH RFT 2/2] regulator: palmas: Convert palmas_ops_ldo to [get|set]_voltage_sel_regmap Axel Lin
2012-07-18 4:26 ` Axel Lin
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).