regulator: max77843: Fix enable_mask for max77843 charger
Subsystems (2)
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.
---
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(-)
drivers/regulator/max77843.c +1 -1
@@ -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, }, };
Signature · 1 line
2.1.0
PATCH 2/2 regulator: max77843: Convert to use regulator_is_enabled_regmap
Use regulator_is_enabled_regmap() to replace max77843_reg_is_enabled().
--- drivers/regulator/max77843.c | 18 ++---------------- 1 file changed, 2 insertions(+), 16 deletions(-)
drivers/regulator/max77843.c +2 -16
@@ -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, ®); -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, }, };
Signature · 1 line
2.1.0
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]>:
Quoted 3 lines
Use
regulator_is_enabled_regmap()to replacemax77843_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
Mark Brown
maintainerRe: [RFT][PATCH 2/2] regulator: max77843: Convert to use regulator_is_enabled_regmap
In reply to a message not in the archiveQuoted 8 lines · Krzysztof Kozłowski
2015-05-01 15:17 GMT+09:00 Axel Lin <[email protected]>:
Quoted 1 line
Use
regulator_is_enabled_regmap()to replacemax77843_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.
Krzysztof Kozłowski
Reviewed-byRe: [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]>:
Quoted 10 lines · Krzysztof Kozłowski
Quoted 8 lines
2015-05-01 15:17 GMT+09:00 Axel Lin <[email protected]>:
Quoted 1 line
Use
regulator_is_enabled_regmap()to replacemax77843_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.
Quoted 4 lines
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:
Best regards,
Krzysztof