summaryrefslogtreecommitdiff
path: root/target/linux/s3c24xx
diff options
context:
space:
mode:
authorlars <lars@3c298f89-4303-0410-b956-a3cf2f4a3e73>2009-07-16 09:35:15 +0000
committerlars <lars@3c298f89-4303-0410-b956-a3cf2f4a3e73>2009-07-16 09:35:15 +0000
commite48f1513b2675cb956582a04d54993398f410c26 (patch)
tree3b41c0794d9125e3c93789d692897274798afb31 /target/linux/s3c24xx
parent64f8ced3daa5ca1524917a4b308c94e94f62b2ab (diff)
[s3c24xx] Implement voltage listing for pc50633.
git-svn-id: svn://svn.openwrt.org/openwrt/trunk@16858 3c298f89-4303-0410-b956-a3cf2f4a3e73
Diffstat (limited to 'target/linux/s3c24xx')
-rw-r--r--target/linux/s3c24xx/patches-2.6.30/056-pcf50633.patch106
1 files changed, 106 insertions, 0 deletions
diff --git a/target/linux/s3c24xx/patches-2.6.30/056-pcf50633.patch b/target/linux/s3c24xx/patches-2.6.30/056-pcf50633.patch
index b1274f993c..84083b4f32 100644
--- a/target/linux/s3c24xx/patches-2.6.30/056-pcf50633.patch
+++ b/target/linux/s3c24xx/patches-2.6.30/056-pcf50633.patch
@@ -355,3 +355,109 @@
/* LED registers */
#define PCF50633_REG_LEDOUT 0x28
+diff --git a/drivers/regulator/pcf50633-regulator.c b/drivers/regulator/pcf50633-regulator.c
+index 8e14900..4809789 100644
+--- a/drivers/regulator/pcf50633-regulator.c
++++ b/drivers/regulator/pcf50633-regulator.c
+@@ -24,11 +24,12 @@
+ #include <linux/mfd/pcf50633/core.h>
+ #include <linux/mfd/pcf50633/pmic.h>
+
+-#define PCF50633_REGULATOR(_name, _id) \
++#define PCF50633_REGULATOR(_name, _id, _n) \
+ { \
+ .name = _name, \
+ .id = _id, \
+ .ops = &pcf50633_regulator_ops, \
++ .n_voltages = _n, \
+ .type = REGULATOR_VOLTAGE, \
+ .owner = THIS_MODULE, \
+ }
+@@ -193,6 +194,40 @@ static int pcf50633_regulator_get_voltage(struct regulator_dev *rdev)
+ return millivolts * 1000;
+ }
+
++static int pcf50633_regulator_list_voltage(struct regulator_dev *rdev,
++ unsigned int index)
++{
++ struct pcf50633 *pcf;
++ int regulator_id, millivolts;
++
++ pcf = rdev_get_drvdata(rdev);;
++
++ regulator_id = rdev_get_id(rdev);
++
++ switch (regulator_id) {
++ case PCF50633_REGULATOR_AUTO:
++ millivolts = auto_voltage_value(index + 0x2f);
++ break;
++ case PCF50633_REGULATOR_DOWN1:
++ case PCF50633_REGULATOR_DOWN2:
++ millivolts = down_voltage_value(index);
++ break;
++ case PCF50633_REGULATOR_LDO1:
++ case PCF50633_REGULATOR_LDO2:
++ case PCF50633_REGULATOR_LDO3:
++ case PCF50633_REGULATOR_LDO4:
++ case PCF50633_REGULATOR_LDO5:
++ case PCF50633_REGULATOR_LDO6:
++ case PCF50633_REGULATOR_HCLDO:
++ millivolts = ldo_voltage_value(index);
++ break;
++ default:
++ return -EINVAL;
++ }
++
++ return millivolts * 1000;
++}
++
+ static int pcf50633_regulator_enable(struct regulator_dev *rdev)
+ {
+ struct pcf50633 *pcf = rdev_get_drvdata(rdev);
+@@ -246,6 +281,7 @@ static int pcf50633_regulator_is_enabled(struct regulator_dev *rdev)
+ static struct regulator_ops pcf50633_regulator_ops = {
+ .set_voltage = pcf50633_regulator_set_voltage,
+ .get_voltage = pcf50633_regulator_get_voltage,
++ .list_voltage = pcf50633_regulator_list_voltage,
+ .enable = pcf50633_regulator_enable,
+ .disable = pcf50633_regulator_disable,
+ .is_enabled = pcf50633_regulator_is_enabled,
+@@ -253,27 +289,27 @@ static struct regulator_ops pcf50633_regulator_ops = {
+
+ static struct regulator_desc regulators[] = {
+ [PCF50633_REGULATOR_AUTO] =
+- PCF50633_REGULATOR("auto", PCF50633_REGULATOR_AUTO),
++ PCF50633_REGULATOR("auto", PCF50633_REGULATOR_AUTO, 80),
+ [PCF50633_REGULATOR_DOWN1] =
+- PCF50633_REGULATOR("down1", PCF50633_REGULATOR_DOWN1),
++ PCF50633_REGULATOR("down1", PCF50633_REGULATOR_DOWN1, 95),
+ [PCF50633_REGULATOR_DOWN2] =
+- PCF50633_REGULATOR("down2", PCF50633_REGULATOR_DOWN2),
++ PCF50633_REGULATOR("down2", PCF50633_REGULATOR_DOWN2, 95),
+ [PCF50633_REGULATOR_LDO1] =
+- PCF50633_REGULATOR("ldo1", PCF50633_REGULATOR_LDO1),
++ PCF50633_REGULATOR("ldo1", PCF50633_REGULATOR_LDO1, 27),
+ [PCF50633_REGULATOR_LDO2] =
+- PCF50633_REGULATOR("ldo2", PCF50633_REGULATOR_LDO2),
++ PCF50633_REGULATOR("ldo2", PCF50633_REGULATOR_LDO2, 27),
+ [PCF50633_REGULATOR_LDO3] =
+- PCF50633_REGULATOR("ldo3", PCF50633_REGULATOR_LDO3),
++ PCF50633_REGULATOR("ldo3", PCF50633_REGULATOR_LDO3, 27),
+ [PCF50633_REGULATOR_LDO4] =
+- PCF50633_REGULATOR("ldo4", PCF50633_REGULATOR_LDO4),
++ PCF50633_REGULATOR("ldo4", PCF50633_REGULATOR_LDO4, 27),
+ [PCF50633_REGULATOR_LDO5] =
+- PCF50633_REGULATOR("ldo5", PCF50633_REGULATOR_LDO5),
++ PCF50633_REGULATOR("ldo5", PCF50633_REGULATOR_LDO5, 27),
+ [PCF50633_REGULATOR_LDO6] =
+- PCF50633_REGULATOR("ldo6", PCF50633_REGULATOR_LDO6),
++ PCF50633_REGULATOR("ldo6", PCF50633_REGULATOR_LDO6, 27),
+ [PCF50633_REGULATOR_HCLDO] =
+- PCF50633_REGULATOR("hcldo", PCF50633_REGULATOR_HCLDO),
++ PCF50633_REGULATOR("hcldo", PCF50633_REGULATOR_HCLDO, 26),
+ [PCF50633_REGULATOR_MEMLDO] =
+- PCF50633_REGULATOR("memldo", PCF50633_REGULATOR_MEMLDO),
++ PCF50633_REGULATOR("memldo", PCF50633_REGULATOR_MEMLDO, 27),
+ };
+
+ static int __devinit pcf50633_regulator_probe(struct platform_device *pdev)