The patch

   regulator: tps65218: Convert to use regulator_get_current_limit_regmap

has been applied to the regulator tree at

   https://git.kernel.org/pub/scm/linux/kernel/git/broonie/regulator.git 

All being well this means that it will be integrated into the linux-next
tree (usually sometime in the next 24 hours) and sent to Linus during
the next merge window (or sooner if it is a bug fix), however if
problems are discovered then the patch may be dropped or reverted.  

You may get further e-mails resulting from automated or manual testing
and review of the tree, please engage with people reporting problems and
send followup patches addressing any issues that are reported if needed.

If any updates are required or you are submitting further changes they
should be sent as incremental updates against current git, existing
patches will not be replaced.

Please add any relevant lists and maintainers to the CCs when replying
to this mail.

Thanks,
Mark

>From 7cfcecfb82afe81fdc94ec214f2ad3d83eb2a4ba Mon Sep 17 00:00:00 2001
From: Axel Lin <axel....@ingics.com>
Date: Sat, 13 Apr 2019 10:29:07 +0800
Subject: [PATCH] regulator: tps65218: Convert to use
 regulator_get_current_limit_regmap

Use regulator_get_current_limit_regmap helper to save some code.

Signed-off-by: Axel Lin <axel....@ingics.com>
Signed-off-by: Mark Brown <broo...@kernel.org>
---
 drivers/regulator/tps65218-regulator.c | 48 ++++++++++----------------
 1 file changed, 19 insertions(+), 29 deletions(-)

diff --git a/drivers/regulator/tps65218-regulator.c 
b/drivers/regulator/tps65218-regulator.c
index 7aed3fbffecc..b72035610013 100644
--- a/drivers/regulator/tps65218-regulator.c
+++ b/drivers/regulator/tps65218-regulator.c
@@ -29,7 +29,8 @@
 #include <linux/mfd/tps65218.h>
 
 #define TPS65218_REGULATOR(_name, _of, _id, _type, _ops, _n, _vr, _vm, _er, \
-                          _em, _cr, _cm, _lr, _nlr, _delay, _fuv, _sr, _sm) \
+                          _em, _cr, _cm, _lr, _nlr, _delay, _fuv, _sr, _sm, \
+                          _ct, _ncl) \
        {                                                       \
                .name                   = _name,                \
                .of_match               = _of,                  \
@@ -42,6 +43,8 @@
                .vsel_mask              = _vm,                  \
                .csel_reg               = _cr,                  \
                .csel_mask              = _cm,                  \
+               .curr_table             = _ct,                  \
+               .n_current_limits       = _ncl,                 \
                .enable_reg             = _er,                  \
                .enable_mask            = _em,                  \
                .volt_table             = NULL,                 \
@@ -188,8 +191,7 @@ static const struct regulator_ops tps65218_ldo1_dcdc34_ops 
= {
        .set_suspend_disable    = tps65218_pmic_set_suspend_disable,
 };
 
-static const int ls3_currents[] = { 100000, 200000, 500000, 1000000 };
-
+static const unsigned int ls3_currents[] = { 100000, 200000, 500000, 1000000 };
 
 static int tps65218_pmic_set_input_current_lim(struct regulator_dev *dev,
                                               int lim_uA)
@@ -229,29 +231,13 @@ static int tps65218_pmic_set_current_limit(struct 
regulator_dev *dev,
                                 TPS65218_PROTECT_L1);
 }
 
-static int tps65218_pmic_get_current_limit(struct regulator_dev *dev)
-{
-       int retval;
-       unsigned int index;
-       struct tps65218 *tps = rdev_get_drvdata(dev);
-
-       retval = regmap_read(tps->regmap, dev->desc->csel_reg, &index);
-       if (retval < 0)
-               return retval;
-
-       index = (index & dev->desc->csel_mask) >>
-                                        __builtin_ctz(dev->desc->csel_mask);
-
-       return ls3_currents[index];
-}
-
 static const struct regulator_ops tps65218_ls23_ops = {
        .is_enabled             = regulator_is_enabled_regmap,
        .enable                 = tps65218_pmic_enable,
        .disable                = tps65218_pmic_disable,
        .set_input_current_limit = tps65218_pmic_set_input_current_lim,
        .set_current_limit      = tps65218_pmic_set_current_limit,
-       .get_current_limit      = tps65218_pmic_get_current_limit,
+       .get_current_limit      = regulator_get_current_limit_regmap,
 };
 
 /* Operations permitted on DCDC5, DCDC6 */
@@ -270,53 +256,57 @@ static const struct regulator_desc regulators[] = {
                           TPS65218_CONTROL_DCDC1_MASK, TPS65218_REG_ENABLE1,
                           TPS65218_ENABLE1_DC1_EN, 0, 0, dcdc1_dcdc2_ranges,
                           2, 4000, 0, TPS65218_REG_SEQ3,
-                          TPS65218_SEQ3_DC1_SEQ_MASK),
+                          TPS65218_SEQ3_DC1_SEQ_MASK, NULL, 0),
        TPS65218_REGULATOR("DCDC2", "regulator-dcdc2", TPS65218_DCDC_2,
                           REGULATOR_VOLTAGE, tps65218_dcdc12_ops, 64,
                           TPS65218_REG_CONTROL_DCDC2,
                           TPS65218_CONTROL_DCDC2_MASK, TPS65218_REG_ENABLE1,
                           TPS65218_ENABLE1_DC2_EN, 0, 0, dcdc1_dcdc2_ranges,
                           2, 4000, 0, TPS65218_REG_SEQ3,
-                          TPS65218_SEQ3_DC2_SEQ_MASK),
+                          TPS65218_SEQ3_DC2_SEQ_MASK, NULL, 0),
        TPS65218_REGULATOR("DCDC3", "regulator-dcdc3", TPS65218_DCDC_3,
                           REGULATOR_VOLTAGE, tps65218_ldo1_dcdc34_ops, 64,
                           TPS65218_REG_CONTROL_DCDC3,
                           TPS65218_CONTROL_DCDC3_MASK, TPS65218_REG_ENABLE1,
                           TPS65218_ENABLE1_DC3_EN, 0, 0, ldo1_dcdc3_ranges, 2,
-                          0, 0, TPS65218_REG_SEQ4, TPS65218_SEQ4_DC3_SEQ_MASK),
+                          0, 0, TPS65218_REG_SEQ4, TPS65218_SEQ4_DC3_SEQ_MASK,
+                          NULL, 0),
        TPS65218_REGULATOR("DCDC4", "regulator-dcdc4", TPS65218_DCDC_4,
                           REGULATOR_VOLTAGE, tps65218_ldo1_dcdc34_ops, 53,
                           TPS65218_REG_CONTROL_DCDC4,
                           TPS65218_CONTROL_DCDC4_MASK, TPS65218_REG_ENABLE1,
                           TPS65218_ENABLE1_DC4_EN, 0, 0, dcdc4_ranges, 2,
-                          0, 0, TPS65218_REG_SEQ4, TPS65218_SEQ4_DC4_SEQ_MASK),
+                          0, 0, TPS65218_REG_SEQ4, TPS65218_SEQ4_DC4_SEQ_MASK,
+                          NULL, 0),
        TPS65218_REGULATOR("DCDC5", "regulator-dcdc5", TPS65218_DCDC_5,
                           REGULATOR_VOLTAGE, tps65218_dcdc56_pmic_ops, 1, -1,
                           -1, TPS65218_REG_ENABLE1, TPS65218_ENABLE1_DC5_EN, 0,
                           0, NULL, 0, 0, 1000000, TPS65218_REG_SEQ5,
-                          TPS65218_SEQ5_DC5_SEQ_MASK),
+                          TPS65218_SEQ5_DC5_SEQ_MASK, NULL, 0),
        TPS65218_REGULATOR("DCDC6", "regulator-dcdc6", TPS65218_DCDC_6,
                           REGULATOR_VOLTAGE, tps65218_dcdc56_pmic_ops, 1, -1,
                           -1, TPS65218_REG_ENABLE1, TPS65218_ENABLE1_DC6_EN, 0,
                           0, NULL, 0, 0, 1800000, TPS65218_REG_SEQ5,
-                          TPS65218_SEQ5_DC6_SEQ_MASK),
+                          TPS65218_SEQ5_DC6_SEQ_MASK, NULL, 0),
        TPS65218_REGULATOR("LDO1", "regulator-ldo1", TPS65218_LDO_1,
                           REGULATOR_VOLTAGE, tps65218_ldo1_dcdc34_ops, 64,
                           TPS65218_REG_CONTROL_LDO1,
                           TPS65218_CONTROL_LDO1_MASK, TPS65218_REG_ENABLE2,
                           TPS65218_ENABLE2_LDO1_EN, 0, 0, ldo1_dcdc3_ranges,
                           2, 0, 0, TPS65218_REG_SEQ6,
-                          TPS65218_SEQ6_LDO1_SEQ_MASK),
+                          TPS65218_SEQ6_LDO1_SEQ_MASK, NULL, 0),
        TPS65218_REGULATOR("LS2", "regulator-ls2", TPS65218_LS_2,
                           REGULATOR_CURRENT, tps65218_ls23_ops, 0, 0, 0,
                           TPS65218_REG_ENABLE2, TPS65218_ENABLE2_LS2_EN,
                           TPS65218_REG_CONFIG2, TPS65218_CONFIG2_LS2ILIM_MASK,
-                          NULL, 0, 0, 0, 0, 0),
+                          NULL, 0, 0, 0, 0, 0, ls3_currents,
+                          ARRAY_SIZE(ls3_currents)),
        TPS65218_REGULATOR("LS3", "regulator-ls3", TPS65218_LS_3,
                           REGULATOR_CURRENT, tps65218_ls23_ops, 0, 0, 0,
                           TPS65218_REG_ENABLE2, TPS65218_ENABLE2_LS3_EN,
                           TPS65218_REG_CONFIG2, TPS65218_CONFIG2_LS3ILIM_MASK,
-                          NULL, 0, 0, 0, 0, 0),
+                          NULL, 0, 0, 0, 0, 0, ls3_currents,
+                          ARRAY_SIZE(ls3_currents)),
 };
 
 static int tps65218_regulator_probe(struct platform_device *pdev)
-- 
2.20.1

Reply via email to