Merge remote-tracking branches 'regulator/topic/rk808', 'regulator/topic/rpm', 'regul...
authorMark Brown <broonie@kernel.org>
Sun, 8 Feb 2015 03:16:30 +0000 (11:16 +0800)
committerMark Brown <broonie@kernel.org>
Sun, 8 Feb 2015 03:16:30 +0000 (11:16 +0800)
1  2  3  4  5 
drivers/regulator/qcom_rpm-regulator.c
drivers/regulator/rk808-regulator.c

@@@@@@ -183,13 -183,6 -183,13 -183,13 -183,13 +183,13 @@@@@@ static const struct regulator_linear_ra
        REGULATOR_LINEAR_RANGE(1500000,  64, 100, 50000),
     };
     
 +   static const struct regulator_linear_range smb208_ranges[] = {
 +      REGULATOR_LINEAR_RANGE( 375000,   0,  29, 12500),
 +      REGULATOR_LINEAR_RANGE( 750000,  30,  89, 12500),
 +      REGULATOR_LINEAR_RANGE(1500000,  90, 153, 25000),
 +      REGULATOR_LINEAR_RANGE(3100000, 154, 234, 25000),
 +   };
 +   
     static const struct regulator_linear_range ncp_ranges[] = {
        REGULATOR_LINEAR_RANGE(1500000,   0,  31, 50000),
     };
@@@@@@ -227,9 -220,9 -227,11 -227,9 -227,9 +227,11 @@@@@@ static int rpm_reg_set_mV_sel(struct re
                return uV;
     
        mutex_lock(&vreg->lock);
-- --   vreg->uV = uV;
        if (vreg->is_enabled)
-- --           ret = rpm_reg_write(vreg, req, vreg->uV / 1000);
++ ++           ret = rpm_reg_write(vreg, req, uV / 1000);
++ ++
++ ++   if (!ret)
++ ++           vreg->uV = uV;
        mutex_unlock(&vreg->lock);
     
        return ret;
@@@@@@ -252,9 -245,9 -254,11 -252,9 -252,9 +254,11 @@@@@@ static int rpm_reg_set_uV_sel(struct re
                return uV;
     
        mutex_lock(&vreg->lock);
-- --   vreg->uV = uV;
        if (vreg->is_enabled)
-- --           ret = rpm_reg_write(vreg, req, vreg->uV);
++ ++           ret = rpm_reg_write(vreg, req, uV);
++ ++
++ ++   if (!ret)
++ ++           vreg->uV = uV;
        mutex_unlock(&vreg->lock);
     
        return ret;
@@@@@@ -566,16 -559,6 -570,16 -566,16 -566,16 +570,16 @@@@@@ static const struct qcom_rpm_reg pm8921
        .parts = &rpm8960_switch_parts,
     };
     
 +   static const struct qcom_rpm_reg smb208_smps = {
 +      .desc.linear_ranges = smb208_ranges,
 +      .desc.n_linear_ranges = ARRAY_SIZE(smb208_ranges),
 +      .desc.n_voltages = 235,
 +      .desc.ops = &uV_ops,
 +      .parts = &rpm8960_smps_parts,
 +      .supports_force_mode_auto = false,
 +      .supports_force_mode_bypass = false,
 +   };
 +   
     static const struct of_device_id rpm_of_match[] = {
        { .compatible = "qcom,rpm-pm8058-pldo",     .data = &pm8058_pldo },
        { .compatible = "qcom,rpm-pm8058-nldo",     .data = &pm8058_nldo },
        { .compatible = "qcom,rpm-pm8921-ftsmps",   .data = &pm8921_ftsmps },
        { .compatible = "qcom,rpm-pm8921-ncp",      .data = &pm8921_ncp },
        { .compatible = "qcom,rpm-pm8921-switch",   .data = &pm8921_switch },
 +   
 +      { .compatible = "qcom,rpm-smb208", .data = &smb208_smps },
        { }
     };
     MODULE_DEVICE_TABLE(of, rpm_of_match);
@@@@@@ -662,6 -643,10 -666,6 -662,6 -662,6 +666,6 @@@@@@ static int rpm_reg_probe(struct platfor
        match = of_match_device(rpm_of_match, &pdev->dev);
        template = match->data;
     
 -      initdata = of_get_regulator_init_data(&pdev->dev, pdev->dev.of_node);
 -      if (!initdata)
 -              return -EINVAL;
 -   
        vreg = devm_kmalloc(&pdev->dev, sizeof(*vreg), GFP_KERNEL);
        if (!vreg) {
                dev_err(&pdev->dev, "failed to allocate vreg\n");
        vreg->desc.owner = THIS_MODULE;
        vreg->desc.type = REGULATOR_VOLTAGE;
        vreg->desc.name = pdev->dev.of_node->name;
 ++++   vreg->desc.supply_name = "vin";
     
        vreg->rpm = dev_get_drvdata(pdev->dev.parent);
        if (!vreg->rpm) {
                return -ENODEV;
        }
     
 +      initdata = of_get_regulator_init_data(&pdev->dev, pdev->dev.of_node,
 +                                            &vreg->desc);
 +      if (!initdata)
 +              return -EINVAL;
 +   
        key = "reg";
        ret = of_property_read_u32(pdev->dev.of_node, key, &val);
        if (ret) {
                        break;
                }
     
 ----           if (force_mode < 0) {
 ++++           if (force_mode == -1) {
                        dev_err(&pdev->dev, "invalid force mode\n");
                        return -EINVAL;
                }
@@@@@@ -798,6 -777,7 -801,6 -797,6 -797,6 +802,6 @@@@@@ static struct platform_driver rpm_reg_d
        .probe          = rpm_reg_probe,
        .driver  = {
                .name  = "qcom_rpm_reg",
 -              .owner = THIS_MODULE,
                .of_match_table = of_match_ptr(rpm_of_match),
        },
     };
@@@@@@ -50,7 -50,7 -50,7 -50,7 -50,7 +50,7 @@@@@@ static const int rk808_buck_config_regs
     };
     
     static const struct regulator_linear_range rk808_buck_voltage_ranges[] = {
 -      REGULATOR_LINEAR_RANGE(700000, 0, 63, 12500),
 +      REGULATOR_LINEAR_RANGE(712500, 0, 63, 12500),
     };
     
     static const struct regulator_linear_range rk808_buck4_voltage_ranges[] = {
@@@@@@ -97,7 -97,7 -97,7 -97,7 -97,7 +97,7 @@@@@@ static int rk808_set_ramp_delay(struct 
                                  RK808_RAMP_RATE_MASK, ramp_value);
     }
     
- ---int rk808_set_suspend_voltage(struct regulator_dev *rdev, int uv)
+ +++static int rk808_set_suspend_voltage(struct regulator_dev *rdev, int uv)
     {
        unsigned int reg;
        int sel = regulator_map_voltage_linear_range(rdev, uv, uv);
                                  sel);
     }
     
- ---int rk808_set_suspend_enable(struct regulator_dev *rdev)
+ +++static int rk808_set_suspend_enable(struct regulator_dev *rdev)
     {
        unsigned int reg;
     
                                  0);
     }
     
- ---int rk808_set_suspend_disable(struct regulator_dev *rdev)
+ +++static int rk808_set_suspend_disable(struct regulator_dev *rdev)
     {
        unsigned int reg;
     
@@@@@@ -419,6 -419,7 -419,6 -419,6 -419,6 +419,6 @@@@@@ static struct platform_driver rk808_reg
        .probe = rk808_regulator_probe,
        .driver = {
                .name = "rk808-regulator",
 -              .owner = THIS_MODULE,
        },
     };