2015-05-01 06:16:47

by Axel Lin

[permalink] [raw]
Subject: [RFT][PATCH 1/2] regulator: max77843: Fix enable_mask for max77843 charger

MAX77843_CHG_ENABLE is 0x05, so the enable_mask should be
MAX77843_CHG_MASK | MAX77843_CHG_BUCK_MASK.

Signed-off-by: Axel Lin <[email protected]>
---
Hi,
I don't have this h/w, so please help to review and test this patch serial.
Thanks,
Axel
drivers/regulator/max77843.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/regulator/max77843.c b/drivers/regulator/max77843.c
index e4e7687..3ae2a9b 100644
--- a/drivers/regulator/max77843.c
+++ b/drivers/regulator/max77843.c
@@ -140,7 +140,7 @@ static const struct regulator_desc max77843_supported_regulators[] = {
.type = REGULATOR_CURRENT,
.owner = THIS_MODULE,
.enable_reg = MAX77843_CHG_REG_CHG_CNFG_00,
- .enable_mask = MAX77843_CHG_MASK,
+ .enable_mask = MAX77843_CHG_MASK | MAX77843_CHG_BUCK_MASK,
},
};

--
2.1.0



2015-05-01 06:17:29

by Axel Lin

[permalink] [raw]
Subject: [RFT][PATCH 2/2] regulator: max77843: Convert to use regulator_is_enabled_regmap

Use regulator_is_enabled_regmap() to replace max77843_reg_is_enabled().

Signed-off-by: Axel Lin <[email protected]>
---
drivers/regulator/max77843.c | 18 ++----------------
1 file changed, 2 insertions(+), 16 deletions(-)

diff --git a/drivers/regulator/max77843.c b/drivers/regulator/max77843.c
index 3ae2a9b..f4fd0d3 100644
--- a/drivers/regulator/max77843.c
+++ b/drivers/regulator/max77843.c
@@ -33,21 +33,6 @@ static const unsigned int max77843_safeout_voltage_table[] = {
3300000,
};

-static int max77843_reg_is_enabled(struct regulator_dev *rdev)
-{
- struct regmap *regmap = rdev->regmap;
- int ret;
- unsigned int reg;
-
- ret = regmap_read(regmap, rdev->desc->enable_reg, &reg);
- if (ret) {
- dev_err(&rdev->dev, "Fialed to read charger register\n");
- return ret;
- }
-
- return (reg & rdev->desc->enable_mask) == rdev->desc->enable_mask;
-}
-
static int max77843_reg_get_current_limit(struct regulator_dev *rdev)
{
struct regmap *regmap = rdev->regmap;
@@ -96,7 +81,7 @@ static int max77843_reg_set_current_limit(struct regulator_dev *rdev,
}

static struct regulator_ops max77843_charger_ops = {
- .is_enabled = max77843_reg_is_enabled,
+ .is_enabled = regulator_is_enabled_regmap,
.enable = regulator_enable_regmap,
.disable = regulator_disable_regmap,
.get_current_limit = max77843_reg_get_current_limit,
@@ -141,6 +126,7 @@ static const struct regulator_desc max77843_supported_regulators[] = {
.owner = THIS_MODULE,
.enable_reg = MAX77843_CHG_REG_CHG_CNFG_00,
.enable_mask = MAX77843_CHG_MASK | MAX77843_CHG_BUCK_MASK,
+ .enable_val = MAX77843_CHG_MASK | MAX77843_CHG_BUCK_MASK,
},
};

--
2.1.0


2015-05-01 07:56:23

by Krzysztof Kozłowski

[permalink] [raw]
Subject: Re: [RFT][PATCH 2/2] regulator: max77843: Convert to use regulator_is_enabled_regmap

2015-05-01 15:17 GMT+09:00 Axel Lin <[email protected]>:
> Use regulator_is_enabled_regmap() to replace max77843_reg_is_enabled().
>
> Signed-off-by: Axel Lin <[email protected]>

(sending one more time, this time without HTML)

I did not update the max77843 driver with such change (as did for
max77693) because I think they should be merged:
https://lkml.org/lkml/2015/4/29/185
These devices are almost the same.

Best regards,
Krzysztof

2015-05-04 13:16:20

by Mark Brown

[permalink] [raw]
Subject: Re: [RFT][PATCH 2/2] regulator: max77843: Convert to use regulator_is_enabled_regmap

On Fri, May 01, 2015 at 04:54:08PM +0900, Krzysztof Kozłowski wrote:
> 2015-05-01 15:17 GMT+09:00 Axel Lin <[email protected]>:

> > Use regulator_is_enabled_regmap() to replace max77843_reg_is_enabled().

> I did not update the max77843 driver with such change (as did for max77693)
> because I think they should be merged:
> https://lkml.org/lkml/2015/4/29/185
> These devices are almost the same.

I can't see that link since I don't have internet access right now but
surely it's going to be clearer that the code for the devices is the
same if we make updates like this to both devices? Otherwise it's less
obvious on review.


Attachments:
(No filename) (635.00 B)
signature.asc (473.00 B)
Digital signature
Download all attachments

2015-05-04 13:56:46

by Krzysztof Kozłowski

[permalink] [raw]
Subject: Re: [RFT][PATCH 2/2] regulator: max77843: Convert to use regulator_is_enabled_regmap

2015-05-04 21:28 GMT+09:00 Mark Brown <[email protected]>:
> On Fri, May 01, 2015 at 04:54:08PM +0900, Krzysztof Kozłowski wrote:
>> 2015-05-01 15:17 GMT+09:00 Axel Lin <[email protected]>:
>
>> > Use regulator_is_enabled_regmap() to replace max77843_reg_is_enabled().
>
>> I did not update the max77843 driver with such change (as did for max77693)
>> because I think they should be merged:
>> https://lkml.org/lkml/2015/4/29/185
>> These devices are almost the same.
>
> I can't see that link since I don't have internet access right now but
> surely it's going to be clearer that the code for the devices is the
> same if we make updates like this to both devices? Otherwise it's less
> obvious on review.

Yes, indeed. The patch itself looks good:
Reviewed-by: Krzysztof Kozlowski <[email protected]>

Best regards,
Krzysztof