Changeset 16858


Ignore:
Timestamp:
2009-07-16T11:35:15+02:00 (7 years ago)
Author:
lars
Message:

[s3c24xx] Implement voltage listing for pc50633.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/target/linux/s3c24xx/patches-2.6.30/056-pcf50633.patch

    r16048 r16858  
    356356 /* LED registers */ 
    357357 #define PCF50633_REG_LEDOUT 0x28 
     358diff --git a/drivers/regulator/pcf50633-regulator.c b/drivers/regulator/pcf50633-regulator.c 
     359index 8e14900..4809789 100644 
     360--- a/drivers/regulator/pcf50633-regulator.c 
     361+++ b/drivers/regulator/pcf50633-regulator.c 
     362@@ -24,11 +24,12 @@ 
     363 #include <linux/mfd/pcf50633/core.h> 
     364 #include <linux/mfd/pcf50633/pmic.h> 
     365  
     366-#define PCF50633_REGULATOR(_name, _id)                 \ 
     367+#define PCF50633_REGULATOR(_name, _id, _n)             \ 
     368        {                                       \ 
     369                .name = _name,                  \ 
     370                .id = _id,                      \ 
     371                .ops = &pcf50633_regulator_ops, \ 
     372+               .n_voltages = _n, \ 
     373                .type = REGULATOR_VOLTAGE,      \ 
     374                .owner = THIS_MODULE,           \ 
     375        } 
     376@@ -193,6 +194,40 @@ static int pcf50633_regulator_get_voltage(struct regulator_dev *rdev) 
     377        return millivolts * 1000; 
     378 } 
     379  
     380+static int pcf50633_regulator_list_voltage(struct regulator_dev *rdev, 
     381+                                               unsigned int index) 
     382+{ 
     383+       struct pcf50633 *pcf; 
     384+       int regulator_id, millivolts; 
     385+ 
     386+       pcf = rdev_get_drvdata(rdev);; 
     387+ 
     388+       regulator_id = rdev_get_id(rdev); 
     389+ 
     390+       switch (regulator_id) { 
     391+       case PCF50633_REGULATOR_AUTO: 
     392+               millivolts = auto_voltage_value(index + 0x2f); 
     393+               break; 
     394+       case PCF50633_REGULATOR_DOWN1: 
     395+       case PCF50633_REGULATOR_DOWN2: 
     396+               millivolts = down_voltage_value(index); 
     397+               break; 
     398+       case PCF50633_REGULATOR_LDO1: 
     399+       case PCF50633_REGULATOR_LDO2: 
     400+       case PCF50633_REGULATOR_LDO3: 
     401+       case PCF50633_REGULATOR_LDO4: 
     402+       case PCF50633_REGULATOR_LDO5: 
     403+       case PCF50633_REGULATOR_LDO6: 
     404+       case PCF50633_REGULATOR_HCLDO: 
     405+               millivolts = ldo_voltage_value(index); 
     406+               break; 
     407+       default: 
     408+               return -EINVAL; 
     409+       } 
     410+ 
     411+       return millivolts * 1000; 
     412+} 
     413+ 
     414 static int pcf50633_regulator_enable(struct regulator_dev *rdev) 
     415 { 
     416        struct pcf50633 *pcf = rdev_get_drvdata(rdev); 
     417@@ -246,6 +281,7 @@ static int pcf50633_regulator_is_enabled(struct regulator_dev *rdev) 
     418 static struct regulator_ops pcf50633_regulator_ops = { 
     419        .set_voltage = pcf50633_regulator_set_voltage, 
     420        .get_voltage = pcf50633_regulator_get_voltage, 
     421+       .list_voltage = pcf50633_regulator_list_voltage, 
     422        .enable = pcf50633_regulator_enable, 
     423        .disable = pcf50633_regulator_disable, 
     424        .is_enabled = pcf50633_regulator_is_enabled, 
     425@@ -253,27 +289,27 @@ static struct regulator_ops pcf50633_regulator_ops = { 
     426  
     427 static struct regulator_desc regulators[] = { 
     428        [PCF50633_REGULATOR_AUTO] = 
     429-               PCF50633_REGULATOR("auto", PCF50633_REGULATOR_AUTO), 
     430+               PCF50633_REGULATOR("auto", PCF50633_REGULATOR_AUTO, 80), 
     431        [PCF50633_REGULATOR_DOWN1] = 
     432-               PCF50633_REGULATOR("down1", PCF50633_REGULATOR_DOWN1), 
     433+               PCF50633_REGULATOR("down1", PCF50633_REGULATOR_DOWN1, 95), 
     434        [PCF50633_REGULATOR_DOWN2] = 
     435-               PCF50633_REGULATOR("down2", PCF50633_REGULATOR_DOWN2), 
     436+               PCF50633_REGULATOR("down2", PCF50633_REGULATOR_DOWN2, 95), 
     437        [PCF50633_REGULATOR_LDO1] = 
     438-               PCF50633_REGULATOR("ldo1", PCF50633_REGULATOR_LDO1), 
     439+               PCF50633_REGULATOR("ldo1", PCF50633_REGULATOR_LDO1, 27), 
     440        [PCF50633_REGULATOR_LDO2] = 
     441-               PCF50633_REGULATOR("ldo2", PCF50633_REGULATOR_LDO2), 
     442+               PCF50633_REGULATOR("ldo2", PCF50633_REGULATOR_LDO2, 27), 
     443        [PCF50633_REGULATOR_LDO3] = 
     444-               PCF50633_REGULATOR("ldo3", PCF50633_REGULATOR_LDO3), 
     445+               PCF50633_REGULATOR("ldo3", PCF50633_REGULATOR_LDO3, 27), 
     446        [PCF50633_REGULATOR_LDO4] = 
     447-               PCF50633_REGULATOR("ldo4", PCF50633_REGULATOR_LDO4), 
     448+               PCF50633_REGULATOR("ldo4", PCF50633_REGULATOR_LDO4, 27), 
     449        [PCF50633_REGULATOR_LDO5] = 
     450-               PCF50633_REGULATOR("ldo5", PCF50633_REGULATOR_LDO5), 
     451+               PCF50633_REGULATOR("ldo5", PCF50633_REGULATOR_LDO5, 27), 
     452        [PCF50633_REGULATOR_LDO6] = 
     453-               PCF50633_REGULATOR("ldo6", PCF50633_REGULATOR_LDO6), 
     454+               PCF50633_REGULATOR("ldo6", PCF50633_REGULATOR_LDO6, 27), 
     455        [PCF50633_REGULATOR_HCLDO] = 
     456-               PCF50633_REGULATOR("hcldo", PCF50633_REGULATOR_HCLDO), 
     457+               PCF50633_REGULATOR("hcldo", PCF50633_REGULATOR_HCLDO, 26), 
     458        [PCF50633_REGULATOR_MEMLDO] = 
     459-               PCF50633_REGULATOR("memldo", PCF50633_REGULATOR_MEMLDO), 
     460+               PCF50633_REGULATOR("memldo", PCF50633_REGULATOR_MEMLDO, 27), 
     461 }; 
     462  
     463 static int __devinit pcf50633_regulator_probe(struct platform_device *pdev) 
Note: See TracChangeset for help on using the changeset viewer.