public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
* [RFT][PATCH 1/2] regulator: max77843: Fix enable_mask for max77843 charger
@ 2015-05-01  6:16 Axel Lin
  2015-05-01  6:17 ` [RFT][PATCH 2/2] regulator: max77843: Convert to use regulator_is_enabled_regmap Axel Lin
  0 siblings, 1 reply; 5+ messages in thread
From: Axel Lin @ 2015-05-01  6:16 UTC (permalink / raw)
  To: Mark Brown
  Cc: Jaewon Kim, Beomho Seo, Liam Girdwood,
	linux-kernel@vger.kernel.org

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

Signed-off-by: Axel Lin <axel.lin@ingics.com>
---
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




^ permalink raw reply related	[flat|nested] 5+ messages in thread

* [RFT][PATCH 2/2] regulator: max77843: Convert to use regulator_is_enabled_regmap
  2015-05-01  6:16 [RFT][PATCH 1/2] regulator: max77843: Fix enable_mask for max77843 charger Axel Lin
@ 2015-05-01  6:17 ` Axel Lin
  2015-05-01  7:56   ` Krzysztof Kozłowski
       [not found]   ` <CAJKOXPckcNq-2R_jn1f=d6ph23_EjbKuJ+4MRdFYkBF0q1018g@mail.gmail.com>
  0 siblings, 2 replies; 5+ messages in thread
From: Axel Lin @ 2015-05-01  6:17 UTC (permalink / raw)
  To: Mark Brown
  Cc: Jaewon Kim, Beomho Seo, Liam Girdwood,
	linux-kernel@vger.kernel.org

Use regulator_is_enabled_regmap() to replace max77843_reg_is_enabled().

Signed-off-by: Axel Lin <axel.lin@ingics.com>
---
 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




^ permalink raw reply related	[flat|nested] 5+ messages in thread

* Re: [RFT][PATCH 2/2] regulator: max77843: Convert to use regulator_is_enabled_regmap
  2015-05-01  6:17 ` [RFT][PATCH 2/2] regulator: max77843: Convert to use regulator_is_enabled_regmap Axel Lin
@ 2015-05-01  7:56   ` Krzysztof Kozłowski
       [not found]   ` <CAJKOXPckcNq-2R_jn1f=d6ph23_EjbKuJ+4MRdFYkBF0q1018g@mail.gmail.com>
  1 sibling, 0 replies; 5+ messages in thread
From: Krzysztof Kozłowski @ 2015-05-01  7:56 UTC (permalink / raw)
  To: Axel Lin
  Cc: Mark Brown, Jaewon Kim, Beomho Seo, Liam Girdwood,
	linux-kernel@vger.kernel.org

2015-05-01 15:17 GMT+09:00 Axel Lin <axel.lin@ingics.com>:
> Use regulator_is_enabled_regmap() to replace max77843_reg_is_enabled().
>
> Signed-off-by: Axel Lin <axel.lin@ingics.com>

(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

^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: [RFT][PATCH 2/2] regulator: max77843: Convert to use regulator_is_enabled_regmap
       [not found]   ` <CAJKOXPckcNq-2R_jn1f=d6ph23_EjbKuJ+4MRdFYkBF0q1018g@mail.gmail.com>
@ 2015-05-04 12:28     ` Mark Brown
  2015-05-04 13:56       ` Krzysztof Kozłowski
  0 siblings, 1 reply; 5+ messages in thread
From: Mark Brown @ 2015-05-04 12:28 UTC (permalink / raw)
  To: Krzysztof Kozłowski
  Cc: Axel Lin, Jaewon Kim, Beomho Seo, Liam Girdwood,
	linux-kernel@vger.kernel.org

[-- Attachment #1: Type: text/plain, Size: 649 bytes --]

On Fri, May 01, 2015 at 04:54:08PM +0900, Krzysztof Kozłowski wrote:
> 2015-05-01 15:17 GMT+09:00 Axel Lin <axel.lin@ingics.com>:

> > 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.

[-- Attachment #2: Digital signature --]
[-- Type: application/pgp-signature, Size: 473 bytes --]

^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: [RFT][PATCH 2/2] regulator: max77843: Convert to use regulator_is_enabled_regmap
  2015-05-04 12:28     ` Mark Brown
@ 2015-05-04 13:56       ` Krzysztof Kozłowski
  0 siblings, 0 replies; 5+ messages in thread
From: Krzysztof Kozłowski @ 2015-05-04 13:56 UTC (permalink / raw)
  To: Mark Brown
  Cc: Axel Lin, Jaewon Kim, Beomho Seo, Liam Girdwood,
	linux-kernel@vger.kernel.org

2015-05-04 21:28 GMT+09:00 Mark Brown <broonie@kernel.org>:
> On Fri, May 01, 2015 at 04:54:08PM +0900, Krzysztof Kozłowski wrote:
>> 2015-05-01 15:17 GMT+09:00 Axel Lin <axel.lin@ingics.com>:
>
>> > 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 <k.kozlowski.k@gmail.com>

Best regards,
Krzysztof

^ permalink raw reply	[flat|nested] 5+ messages in thread

end of thread, other threads:[~2015-05-04 13:56 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2015-05-01  6:16 [RFT][PATCH 1/2] regulator: max77843: Fix enable_mask for max77843 charger Axel Lin
2015-05-01  6:17 ` [RFT][PATCH 2/2] regulator: max77843: Convert to use regulator_is_enabled_regmap Axel Lin
2015-05-01  7:56   ` Krzysztof Kozłowski
     [not found]   ` <CAJKOXPckcNq-2R_jn1f=d6ph23_EjbKuJ+4MRdFYkBF0q1018g@mail.gmail.com>
2015-05-04 12:28     ` Mark Brown
2015-05-04 13:56       ` Krzysztof Kozłowski

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox