From 313a445e6e35b21a44c1fbc609c6b66f4488e6b5 Mon Sep 17 00:00:00 2001 From: Axel Lin Date: Mon, 19 Mar 2012 10:55:24 +0800 Subject: [PATCH] --- yaml --- r: 302103 b: refs/heads/master c: 022dcdf083d67db34f5237369d3501ca5708d8eb h: refs/heads/master i: 302101: 6934d084ffb9205ad7c7a504d6a8d38c864a512d 302099: edf20b662ecb4ce5e16f35cf921c1e788608219b 302095: 1aca4ed733b20d2395bb1f27c0b9e4fbf4920916 v: v3 --- [refs] | 2 +- trunk/drivers/regulator/pcf50633-regulator.c | 22 ++++++-------------- 2 files changed, 7 insertions(+), 17 deletions(-) diff --git a/[refs] b/[refs] index fd9124259daf..e26580dc2962 100644 --- a/[refs] +++ b/[refs] @@ -1,2 +1,2 @@ --- -refs/heads/master: 7e44bb83a777fd67a70b2188dd31c33db25aef72 +refs/heads/master: 022dcdf083d67db34f5237369d3501ca5708d8eb diff --git a/trunk/drivers/regulator/pcf50633-regulator.c b/trunk/drivers/regulator/pcf50633-regulator.c index 6db46c632f13..c05b5d12b2ca 100644 --- a/trunk/drivers/regulator/pcf50633-regulator.c +++ b/trunk/drivers/regulator/pcf50633-regulator.c @@ -52,7 +52,7 @@ static const u8 pcf50633_regulator_registers[PCF50633_NUM_REGULATORS] = { static u8 auto_voltage_bits(unsigned int millivolts) { if (millivolts < 1800) - return 0; + return 0x2f; if (millivolts > 3800) return 0xff; @@ -87,6 +87,9 @@ static u8 ldo_voltage_bits(unsigned int millivolts) /* Obtain voltage value from bits */ static unsigned int auto_voltage_value(u8 bits) { + /* AUTOOUT: 00000000 to 00101110 are reserved. + * Return 0 for bits in reserved range, which means this selector code + * can't be used on this system */ if (bits < 0x2f) return 0; @@ -208,20 +211,7 @@ static int pcf50633_regulator_get_voltage(struct regulator_dev *rdev) static int pcf50633_regulator_list_voltage(struct regulator_dev *rdev, unsigned int index) { - struct pcf50633 *pcf; - int regulator_id; - - pcf = rdev_get_drvdata(rdev); - - regulator_id = rdev_get_id(rdev); - - switch (regulator_id) { - case PCF50633_REGULATOR_AUTO: - index += 0x2f; - break; - default: - break; - } + int regulator_id = rdev_get_id(rdev); return pcf50633_regulator_voltage_value(regulator_id, index); } @@ -287,7 +277,7 @@ static struct regulator_ops pcf50633_regulator_ops = { static struct regulator_desc regulators[] = { [PCF50633_REGULATOR_AUTO] = - PCF50633_REGULATOR("auto", PCF50633_REGULATOR_AUTO, 81), + PCF50633_REGULATOR("auto", PCF50633_REGULATOR_AUTO, 128), [PCF50633_REGULATOR_DOWN1] = PCF50633_REGULATOR("down1", PCF50633_REGULATOR_DOWN1, 96), [PCF50633_REGULATOR_DOWN2] =