regulator: palmas: Add has_regen3 check for TPS659038
authorKeerthy <j-keerthy@TI.COM>
Tue, 17 Mar 2015 10:26:05 +0000 (15:56 +0530)
committerMark Brown <broonie@kernel.org>
Tue, 17 Mar 2015 12:21:15 +0000 (12:21 +0000)
Palmas driver is used to cater to even TPS659038 but TPS659038 does not have
REGEN3 resource. Adding another field in the driver data to check on that.

Signed-off-by: Keerthy <j-keerthy@ti.com>
Signed-off-by: Mark Brown <broonie@kernel.org>
drivers/regulator/palmas-regulator.c
include/linux/mfd/palmas.h

index 9518a76ad29ecca824fd6d23f66f8c86ab83010b..8217613807d37f3dfa2f90f796a394094fdebe16 100644 (file)
@@ -916,6 +916,9 @@ static int palmas_ldo_registration(struct palmas_pmic *pmic,
                            (id == PALMAS_REG_LDO6))
                                desc->enable_time = 2000;
                } else {
+                       if (!ddata->has_regen3 && id == PALMAS_REG_REGEN3)
+                               continue;
+
                        desc->n_voltages = 1;
                        if (reg_init && reg_init->roof_floor)
                                desc->ops = &palmas_ops_ext_control_extreg;
@@ -1398,6 +1401,7 @@ static struct palmas_pmic_driver_data palmas_ddata = {
        .ldo_begin = PALMAS_REG_LDO1,
        .ldo_end = PALMAS_REG_LDOUSB,
        .max_reg = PALMAS_NUM_REGS,
+       .has_regen3 = true,
        .palmas_regs_info = palmas_generic_regs_info,
        .palmas_matches = palmas_matches,
        .sleep_req_info = palma_sleep_req_info,
@@ -1411,6 +1415,7 @@ static struct palmas_pmic_driver_data tps65917_ddata = {
        .ldo_begin = TPS65917_REG_LDO1,
        .ldo_end = TPS65917_REG_LDO5,
        .max_reg = TPS65917_NUM_REGS,
+       .has_regen3 = true,
        .palmas_regs_info = tps65917_regs_info,
        .palmas_matches = tps65917_matches,
        .sleep_req_info = tps65917_sleep_req_info,
@@ -1572,9 +1577,11 @@ static int palmas_regulators_probe(struct platform_device *pdev)
        if (!pmic)
                return -ENOMEM;
 
-       if (of_device_is_compatible(node, "ti,tps659038-pmic"))
+       if (of_device_is_compatible(node, "ti,tps659038-pmic")) {
                palmas_generic_regs_info[PALMAS_REG_REGEN2].ctrl_addr =
                                                        TPS659038_REGEN2_CTRL;
+               palmas_ddata.has_regen3 = false;
+       }
 
        pmic->dev = &pdev->dev;
        pmic->palmas = palmas;
index ee7b1ce7a6f8f42280abcc3d1411f7bcdebb6ac2..bb270bd03eedc3eb570555b9929b7ba652a38f6e 100644 (file)
@@ -117,6 +117,7 @@ struct palmas_pmic_driver_data {
        int ldo_begin;
        int ldo_end;
        int max_reg;
+       bool has_regen3;
        struct palmas_regs_info *palmas_regs_info;
        struct of_regulator_match *palmas_matches;
        struct palmas_sleep_requestor_info *sleep_req_info;