* [PATCH 1/2] regulator: max8997: Remove set_voltage_time_sel setting for max8997_ldo_ops
@ 2012-12-26 8:28 Axel Lin
2012-12-26 8:30 ` [PATCH 2/2] regulator: max8997: Convert max8997_safeout_ops to set_voltage_sel and list_voltage_table Axel Lin
2012-12-27 17:35 ` [PATCH 1/2] regulator: max8997: Remove set_voltage_time_sel setting for max8997_ldo_ops Mark Brown
0 siblings, 2 replies; 3+ messages in thread
From: Axel Lin @ 2012-12-26 8:28 UTC (permalink / raw)
To: Mark Brown
Cc: Thomas Abraham, Kyungmin Park, MyungJoo Ham, Liam Girdwood,
linux-kernel
max8997_set_voltage_ldobuck_time_sel() returns 0 for all LDOs.
Thus remove set_voltage_time_sel setting for max8997_ldo_ops.
max8997_set_voltage_ldobuck_time_sel() is only used for max8997_buck_ops now,
rename it to max8997_set_voltage_buck_time_sel().
Signed-off-by: Axel Lin <axel.lin@ingics.com>
---
drivers/regulator/max8997.c | 5 ++---
1 file changed, 2 insertions(+), 3 deletions(-)
diff --git a/drivers/regulator/max8997.c b/drivers/regulator/max8997.c
index df0eafb..57e8907 100644
--- a/drivers/regulator/max8997.c
+++ b/drivers/regulator/max8997.c
@@ -523,7 +523,7 @@ static int max8997_set_voltage_ldobuck(struct regulator_dev *rdev,
return ret;
}
-static int max8997_set_voltage_ldobuck_time_sel(struct regulator_dev *rdev,
+static int max8997_set_voltage_buck_time_sel(struct regulator_dev *rdev,
unsigned int old_selector,
unsigned int new_selector)
{
@@ -801,7 +801,6 @@ static struct regulator_ops max8997_ldo_ops = {
.disable = max8997_reg_disable,
.get_voltage_sel = max8997_get_voltage_sel,
.set_voltage = max8997_set_voltage_ldobuck,
- .set_voltage_time_sel = max8997_set_voltage_ldobuck_time_sel,
.set_suspend_disable = max8997_reg_disable_suspend,
};
@@ -812,7 +811,7 @@ static struct regulator_ops max8997_buck_ops = {
.disable = max8997_reg_disable,
.get_voltage_sel = max8997_get_voltage_sel,
.set_voltage = max8997_set_voltage_buck,
- .set_voltage_time_sel = max8997_set_voltage_ldobuck_time_sel,
+ .set_voltage_time_sel = max8997_set_voltage_buck_time_sel,
.set_suspend_disable = max8997_reg_disable_suspend,
};
--
1.7.9.5
^ permalink raw reply related [flat|nested] 3+ messages in thread
* [PATCH 2/2] regulator: max8997: Convert max8997_safeout_ops to set_voltage_sel and list_voltage_table
2012-12-26 8:28 [PATCH 1/2] regulator: max8997: Remove set_voltage_time_sel setting for max8997_ldo_ops Axel Lin
@ 2012-12-26 8:30 ` Axel Lin
2012-12-27 17:35 ` [PATCH 1/2] regulator: max8997: Remove set_voltage_time_sel setting for max8997_ldo_ops Mark Brown
1 sibling, 0 replies; 3+ messages in thread
From: Axel Lin @ 2012-12-26 8:30 UTC (permalink / raw)
To: Mark Brown
Cc: Thomas Abraham, Kyungmin Park, MyungJoo Ham, Liam Girdwood,
linux-kernel
Signed-off-by: Axel Lin <axel.lin@ingics.com>
---
drivers/regulator/max8997.c | 76 ++++++++++---------------------------------
1 file changed, 18 insertions(+), 58 deletions(-)
diff --git a/drivers/regulator/max8997.c b/drivers/regulator/max8997.c
index 57e8907..c30424a 100644
--- a/drivers/regulator/max8997.c
+++ b/drivers/regulator/max8997.c
@@ -54,6 +54,13 @@ struct max8997_data {
u8 saved_states[MAX8997_REG_MAX];
};
+static const unsigned int safeoutvolt[] = {
+ 4850000,
+ 4900000,
+ 4950000,
+ 3300000,
+};
+
static inline void max8997_set_gpio(struct max8997_data *max8997)
{
int set3 = (max8997->buck125_gpioindex) & 0x1;
@@ -130,29 +137,6 @@ static const struct voltage_map_desc *reg_voltage_map[] = {
[MAX8997_CHARGER_TOPOFF] = &topoff_current_map_desc,
};
-static int max8997_list_voltage_safeout(struct regulator_dev *rdev,
- unsigned int selector)
-{
- int rid = rdev_get_id(rdev);
-
- if (rid == MAX8997_ESAFEOUT1 || rid == MAX8997_ESAFEOUT2) {
- switch (selector) {
- case 0:
- return 4850000;
- case 1:
- return 4900000;
- case 2:
- return 4950000;
- case 3:
- return 3300000;
- default:
- return -EINVAL;
- }
- }
-
- return -EINVAL;
-}
-
static int max8997_list_voltage_charger_cv(struct regulator_dev *rdev,
unsigned int selector)
{
@@ -722,49 +706,23 @@ out:
return 0;
}
-static const int safeoutvolt[] = {
- 3300000,
- 4850000,
- 4900000,
- 4950000,
-};
-
/* For SAFEOUT1 and SAFEOUT2 */
-static int max8997_set_voltage_safeout(struct regulator_dev *rdev,
- int min_uV, int max_uV, unsigned *selector)
+static int max8997_set_voltage_safeout_sel(struct regulator_dev *rdev,
+ unsigned selector)
{
struct max8997_data *max8997 = rdev_get_drvdata(rdev);
struct i2c_client *i2c = max8997->iodev->i2c;
int rid = rdev_get_id(rdev);
int reg, shift = 0, mask, ret;
- int i = 0;
- u8 val;
if (rid != MAX8997_ESAFEOUT1 && rid != MAX8997_ESAFEOUT2)
return -EINVAL;
- for (i = 0; i < ARRAY_SIZE(safeoutvolt); i++) {
- if (min_uV <= safeoutvolt[i] &&
- max_uV >= safeoutvolt[i])
- break;
- }
-
- if (i >= ARRAY_SIZE(safeoutvolt))
- return -EINVAL;
-
- if (i == 0)
- val = 0x3;
- else
- val = i - 1;
-
ret = max8997_get_voltage_register(rdev, ®, &shift, &mask);
if (ret)
return ret;
- ret = max8997_update_reg(i2c, reg, val << shift, mask << shift);
- *selector = val;
-
- return ret;
+ return max8997_update_reg(i2c, reg, selector << shift, mask << shift);
}
static int max8997_reg_disable_suspend(struct regulator_dev *rdev)
@@ -824,12 +782,12 @@ static struct regulator_ops max8997_fixedvolt_ops = {
};
static struct regulator_ops max8997_safeout_ops = {
- .list_voltage = max8997_list_voltage_safeout,
+ .list_voltage = regulator_list_voltage_table,
.is_enabled = max8997_reg_is_enabled,
.enable = max8997_reg_enable,
.disable = max8997_reg_disable,
.get_voltage_sel = max8997_get_voltage_sel,
- .set_voltage = max8997_set_voltage_safeout,
+ .set_voltage_sel = max8997_set_voltage_safeout_sel,
.set_suspend_disable = max8997_reg_disable_suspend,
};
@@ -1235,13 +1193,15 @@ static int max8997_pmic_probe(struct platform_device *pdev)
int id = pdata->regulators[i].id;
desc = reg_voltage_map[id];
- if (desc)
+ if (desc) {
regulators[id].n_voltages =
(desc->max - desc->min) / desc->step + 1;
- else if (id == MAX8997_ESAFEOUT1 || id == MAX8997_ESAFEOUT2)
- regulators[id].n_voltages = 4;
- else if (id == MAX8997_CHARGER_CV)
+ } else if (id == MAX8997_ESAFEOUT1 || id == MAX8997_ESAFEOUT2) {
+ regulators[id].volt_table = safeoutvolt;
+ regulators[id].n_voltages = ARRAY_SIZE(safeoutvolt);
+ } else if (id == MAX8997_CHARGER_CV) {
regulators[id].n_voltages = 16;
+ }
config.dev = max8997->dev;
config.init_data = pdata->regulators[i].initdata;
--
1.7.9.5
^ permalink raw reply related [flat|nested] 3+ messages in thread
* Re: [PATCH 1/2] regulator: max8997: Remove set_voltage_time_sel setting for max8997_ldo_ops
2012-12-26 8:28 [PATCH 1/2] regulator: max8997: Remove set_voltage_time_sel setting for max8997_ldo_ops Axel Lin
2012-12-26 8:30 ` [PATCH 2/2] regulator: max8997: Convert max8997_safeout_ops to set_voltage_sel and list_voltage_table Axel Lin
@ 2012-12-27 17:35 ` Mark Brown
1 sibling, 0 replies; 3+ messages in thread
From: Mark Brown @ 2012-12-27 17:35 UTC (permalink / raw)
To: Axel Lin
Cc: Thomas Abraham, Kyungmin Park, MyungJoo Ham, Liam Girdwood,
linux-kernel
[-- Attachment #1: Type: text/plain, Size: 210 bytes --]
On Wed, Dec 26, 2012 at 04:28:39PM +0800, Axel Lin wrote:
> max8997_set_voltage_ldobuck_time_sel() returns 0 for all LDOs.
> Thus remove set_voltage_time_sel setting for max8997_ldo_ops.
Applied both, thanks.
[-- Attachment #2: Digital signature --]
[-- Type: application/pgp-signature, Size: 836 bytes --]
^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2012-12-27 17:35 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2012-12-26 8:28 [PATCH 1/2] regulator: max8997: Remove set_voltage_time_sel setting for max8997_ldo_ops Axel Lin
2012-12-26 8:30 ` [PATCH 2/2] regulator: max8997: Convert max8997_safeout_ops to set_voltage_sel and list_voltage_table Axel Lin
2012-12-27 17:35 ` [PATCH 1/2] regulator: max8997: Remove set_voltage_time_sel setting for max8997_ldo_ops Mark Brown
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox