* [PATCH 1/2] power: supply: bq24735: allow polling even if there is no ac-detect gpio
2016-12-21 21:29 [PATCH 0/2] power: supply: bq24735: poll register if no ac-detect gpio Peter Rosin
@ 2016-12-21 21:29 ` Peter Rosin
2016-12-22 22:42 ` Rob Herring
2016-12-21 21:29 ` [PATCH 2/2] power: supply: bq24735: bring down the noise level Peter Rosin
2016-12-23 1:38 ` [PATCH 0/2] power: supply: bq24735: poll register if no ac-detect gpio Sebastian Reichel
2 siblings, 1 reply; 5+ messages in thread
From: Peter Rosin @ 2016-12-21 21:29 UTC (permalink / raw)
To: linux-kernel
Cc: Peter Rosin, Sebastian Reichel, Rob Herring, Mark Rutland,
linux-pm, devicetree
It is possible to verify AC adapter presence via a register read, without
any physical connection to the ACOK pin on the charger. Allow this.
Signed-off-by: Peter Rosin <peda@axentia.se>
---
Documentation/devicetree/bindings/power/supply/ti,bq24735.txt | 4 ++--
drivers/power/supply/bq24735-charger.c | 2 +-
2 files changed, 3 insertions(+), 3 deletions(-)
diff --git a/Documentation/devicetree/bindings/power/supply/ti,bq24735.txt b/Documentation/devicetree/bindings/power/supply/ti,bq24735.txt
index efc2c6a78661..de45e1a2a4d9 100644
--- a/Documentation/devicetree/bindings/power/supply/ti,bq24735.txt
+++ b/Documentation/devicetree/bindings/power/supply/ti,bq24735.txt
@@ -27,8 +27,8 @@ Optional properties :
- ti,external-control : Indicates that the charger is configured externally
and that the host should not attempt to enable/disable charging or set the
charge voltage/current.
- - poll-interval : In case 'interrupts' is not specified, poll AC presence
- on the ti,ac-detect-gpios GPIO with this interval (milliseconds).
+ - poll-interval : In case 'interrupts' is not specified, poll AC adapter
+ presence with this interval (milliseconds).
Example:
diff --git a/drivers/power/supply/bq24735-charger.c b/drivers/power/supply/bq24735-charger.c
index 4f6275e5cf1c..d8be81203837 100644
--- a/drivers/power/supply/bq24735-charger.c
+++ b/drivers/power/supply/bq24735-charger.c
@@ -468,7 +468,7 @@ static int bq24735_charger_probe(struct i2c_client *client,
client->irq, ret);
return ret;
}
- } else if (charger->status_gpio) {
+ } else {
ret = device_property_read_u32(&client->dev, "poll-interval",
&charger->poll_interval);
if (ret)
--
2.1.4
^ permalink raw reply related [flat|nested] 5+ messages in thread* Re: [PATCH 1/2] power: supply: bq24735: allow polling even if there is no ac-detect gpio
2016-12-21 21:29 ` [PATCH 1/2] power: supply: bq24735: allow polling even if there is " Peter Rosin
@ 2016-12-22 22:42 ` Rob Herring
0 siblings, 0 replies; 5+ messages in thread
From: Rob Herring @ 2016-12-22 22:42 UTC (permalink / raw)
To: Peter Rosin
Cc: linux-kernel, Sebastian Reichel, Mark Rutland, linux-pm,
devicetree
On Wed, Dec 21, 2016 at 10:29:52PM +0100, Peter Rosin wrote:
> It is possible to verify AC adapter presence via a register read, without
> any physical connection to the ACOK pin on the charger. Allow this.
>
> Signed-off-by: Peter Rosin <peda@axentia.se>
> ---
> Documentation/devicetree/bindings/power/supply/ti,bq24735.txt | 4 ++--
> drivers/power/supply/bq24735-charger.c | 2 +-
> 2 files changed, 3 insertions(+), 3 deletions(-)
Acked-by: Rob Herring <robh@kernel.org>
^ permalink raw reply [flat|nested] 5+ messages in thread
* [PATCH 2/2] power: supply: bq24735: bring down the noise level
2016-12-21 21:29 [PATCH 0/2] power: supply: bq24735: poll register if no ac-detect gpio Peter Rosin
2016-12-21 21:29 ` [PATCH 1/2] power: supply: bq24735: allow polling even if there is " Peter Rosin
@ 2016-12-21 21:29 ` Peter Rosin
2016-12-23 1:38 ` [PATCH 0/2] power: supply: bq24735: poll register if no ac-detect gpio Sebastian Reichel
2 siblings, 0 replies; 5+ messages in thread
From: Peter Rosin @ 2016-12-21 21:29 UTC (permalink / raw)
To: linux-kernel
Cc: Peter Rosin, Sebastian Reichel, Rob Herring, Mark Rutland,
linux-pm, devicetree
If there is no ti,ac-detect-gpios configured, it is normal to
have failed reads of the options register. So, hold back on the
log spamming.
Signed-off-by: Peter Rosin <peda@axentia.se>
---
drivers/power/supply/bq24735-charger.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/drivers/power/supply/bq24735-charger.c b/drivers/power/supply/bq24735-charger.c
index d8be81203837..eb0145380def 100644
--- a/drivers/power/supply/bq24735-charger.c
+++ b/drivers/power/supply/bq24735-charger.c
@@ -192,7 +192,7 @@ static bool bq24735_charger_is_present(struct bq24735 *charger)
ac = bq24735_read_word(charger->client, BQ24735_CHG_OPT);
if (ac < 0) {
- dev_err(&charger->client->dev,
+ dev_dbg(&charger->client->dev,
"Failed to read charger options : %d\n",
ac);
return false;
--
2.1.4
^ permalink raw reply related [flat|nested] 5+ messages in thread* Re: [PATCH 0/2] power: supply: bq24735: poll register if no ac-detect gpio
2016-12-21 21:29 [PATCH 0/2] power: supply: bq24735: poll register if no ac-detect gpio Peter Rosin
2016-12-21 21:29 ` [PATCH 1/2] power: supply: bq24735: allow polling even if there is " Peter Rosin
2016-12-21 21:29 ` [PATCH 2/2] power: supply: bq24735: bring down the noise level Peter Rosin
@ 2016-12-23 1:38 ` Sebastian Reichel
2 siblings, 0 replies; 5+ messages in thread
From: Sebastian Reichel @ 2016-12-23 1:38 UTC (permalink / raw)
To: Peter Rosin; +Cc: linux-kernel, Rob Herring, Mark Rutland, linux-pm, devicetree
[-- Attachment #1: Type: text/plain, Size: 1143 bytes --]
Hi,
On Wed, Dec 21, 2016 at 10:29:51PM +0100, Peter Rosin wrote:
> My patch [1] "power: supply: bq24735-charger: allow chargers to share the
> ac-detect gpio" is perhaps a bit hard to digest. And while I still think
> some way of sharing the ac-detect gpio is worthwhile, I thought of another
> way to solve the problem at hand. Instead of polling a shared gpio, it's
> as simple as polling the chip for what it is outputting on the ACOK pin.
> And the code is already there! It just needs a tweak to allow this mode of
> operation.
>
> This appears to work just fine for me, and the difference is in the noise
> since my shared gpio pin happens to be on an expander on the i2c bus, so
> I end up with i2c traffic for each poll either way.
>
> Cheers,
> peda
>
> [1] https://lkml.org/lkml/2016/12/13/786
Thanks for your patchset. We are currently in the merge
window and your patches will appear in linux-next once
4.10-rc1 has been tagged by Linus Torvalds.
Until then I queued it into this branch:
https://git.kernel.org/cgit/linux/kernel/git/sre/linux-power-supply.git/log/?h=for-next-next
-- Sebastian
[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 833 bytes --]
^ permalink raw reply [flat|nested] 5+ messages in thread