]> Pileus Git - ~andy/linux/blobdiff - drivers/regulator/pcap-regulator.c
Merge tag 'irqdomain-for-linus' of git://git.secretlab.ca/git/linux-2.6
[~andy/linux] / drivers / regulator / pcap-regulator.c
index b9666a2c45f3577952a1ed1951cfb882c150ae18..8211101121f0c6a07b68184db5bb95bbd53d7e73 100644 (file)
@@ -165,21 +165,18 @@ static int pcap_regulator_set_voltage_sel(struct regulator_dev *rdev,
                                 selector << vreg->index);
 }
 
-static int pcap_regulator_get_voltage(struct regulator_dev *rdev)
+static int pcap_regulator_get_voltage_sel(struct regulator_dev *rdev)
 {
        struct pcap_regulator *vreg = &vreg_table[rdev_get_id(rdev)];
        void *pcap = rdev_get_drvdata(rdev);
        u32 tmp;
-       int mV;
 
        if (vreg->n_voltages == 1)
-               return vreg->voltage_table[0] * 1000;
+               return 0;
 
        ezx_pcap_read(pcap, vreg->reg, &tmp);
        tmp = ((tmp >> vreg->index) & (vreg->n_voltages - 1));
-       mV = vreg->voltage_table[tmp];
-
-       return mV * 1000;
+       return tmp;
 }
 
 static int pcap_regulator_enable(struct regulator_dev *rdev)
@@ -228,7 +225,7 @@ static int pcap_regulator_list_voltage(struct regulator_dev *rdev,
 static struct regulator_ops pcap_regulator_ops = {
        .list_voltage   = pcap_regulator_list_voltage,
        .set_voltage_sel = pcap_regulator_set_voltage_sel,
-       .get_voltage    = pcap_regulator_get_voltage,
+       .get_voltage_sel = pcap_regulator_get_voltage_sel,
        .enable         = pcap_regulator_enable,
        .disable        = pcap_regulator_disable,
        .is_enabled     = pcap_regulator_is_enabled,
@@ -244,7 +241,7 @@ static struct regulator_ops pcap_regulator_ops = {
                .owner          = THIS_MODULE,                  \
        }
 
-static struct regulator_desc pcap_regulators[] = {
+static const struct regulator_desc pcap_regulators[] = {
        VREG(V1), VREG(V2), VREG(V3), VREG(V4), VREG(V5), VREG(V6), VREG(V7),
        VREG(V8), VREG(V9), VREG(V10), VREG(VAUX1), VREG(VAUX2), VREG(VAUX3),
        VREG(VAUX4), VREG(VSIM), VREG(VSIM2), VREG(VVIB), VREG(SW1), VREG(SW2),
@@ -254,9 +251,13 @@ static int __devinit pcap_regulator_probe(struct platform_device *pdev)
 {
        struct regulator_dev *rdev;
        void *pcap = dev_get_drvdata(pdev->dev.parent);
+       struct regulator_config config = { };
+
+       config.dev = &pdev->dev;
+       config.init_data = pdev->dev.platform_data;
+       config.driver_data = pcap;
 
-       rdev = regulator_register(&pcap_regulators[pdev->id], &pdev->dev,
-                               pdev->dev.platform_data, pcap, NULL);
+       rdev = regulator_register(&pcap_regulators[pdev->id], &config);
        if (IS_ERR(rdev))
                return PTR_ERR(rdev);