* [PATCH 0/3] power: bq24735-charger: chromebook fixes
@ 2016-02-03 6:03 Jonathan Tinkham
[not found] ` <1454479426-6437-1-git-send-email-sctincman-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org>
` (2 more replies)
0 siblings, 3 replies; 6+ messages in thread
From: Jonathan Tinkham @ 2016-02-03 6:03 UTC (permalink / raw)
To: linux-pm-u79uwXL29TY76Z2rM5mHXA,
devicetree-u79uwXL29TY76Z2rM5mHXA
Cc: sre-DgEjT+Ai2ygdnm+yROfE0A, dbaryshkov-Re5JQEeQqe8AvxtiuMwx3w,
dwmw2-wEGCiKHe2LqWVfeAwA7xHQ, robh+dt-DgEjT+Ai2ygdnm+yROfE0A,
pawel.moll-5wv7dgnIgG8, mark.rutland-5wv7dgnIgG8,
ijc+devicetree-KcIKpvwj1kUDXYZnReoRVg,
galak-sgV2jX0FEOL9JmXXK+q4OQ, Jonathan Tinkham
On Acer Chromebook 13 (CB5-311) this module fails to load if the charger
is not inserted, and will error when it is removed.
These fixes are adapted from Acer's downstream kernel.
Jonathan Tinkham (3):
power: bq24735-charger: fix failed i2c with ac-detect
power: bq24735-charger: add 'ti,external-control' option
power: bq24735-charger: document 'ti,external-control' option
.../bindings/power_supply/ti,bq24735.txt | 3 ++
drivers/power/bq24735-charger.c | 56 ++++++++++++++--------
include/linux/power/bq24735-charger.h | 2 +
3 files changed, 40 insertions(+), 21 deletions(-)
--
2.7.0
--
To unsubscribe from this list: send the line "unsubscribe devicetree" in
the body of a message to majordomo-u79uwXL29TY76Z2rM5mHXA@public.gmane.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
^ permalink raw reply [flat|nested] 6+ messages in thread[parent not found: <1454479426-6437-1-git-send-email-sctincman-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org>]
* [PATCH 1/3] power: bq24735-charger: fix failed i2c with ac-detect [not found] ` <1454479426-6437-1-git-send-email-sctincman-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> @ 2016-02-03 6:03 ` Jonathan Tinkham 2016-02-03 6:03 ` [PATCH 2/3] power: bq24735-charger: add 'ti,external-control' option Jonathan Tinkham 1 sibling, 0 replies; 6+ messages in thread From: Jonathan Tinkham @ 2016-02-03 6:03 UTC (permalink / raw) To: linux-pm-u79uwXL29TY76Z2rM5mHXA, devicetree-u79uwXL29TY76Z2rM5mHXA Cc: sre-DgEjT+Ai2ygdnm+yROfE0A, dbaryshkov-Re5JQEeQqe8AvxtiuMwx3w, dwmw2-wEGCiKHe2LqWVfeAwA7xHQ, robh+dt-DgEjT+Ai2ygdnm+yROfE0A, pawel.moll-5wv7dgnIgG8, mark.rutland-5wv7dgnIgG8, ijc+devicetree-KcIKpvwj1kUDXYZnReoRVg, galak-sgV2jX0FEOL9JmXXK+q4OQ, Jonathan Tinkham When an ac-detect pin exists, but the charger is not plugged in, the chip will not respond to i2c messages, causing the module to fail when inserted. Signed-off-by: Jonathan Tinkham <sctincman-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> --- drivers/power/bq24735-charger.c | 45 ++++++++++++++++++++++------------------- 1 file changed, 24 insertions(+), 21 deletions(-) diff --git a/drivers/power/bq24735-charger.c b/drivers/power/bq24735-charger.c index eb2b368..f041c16 100644 --- a/drivers/power/bq24735-charger.c +++ b/drivers/power/bq24735-charger.c @@ -293,27 +293,6 @@ static int bq24735_charger_probe(struct i2c_client *client, i2c_set_clientdata(client, charger); - ret = bq24735_read_word(client, BQ24735_MANUFACTURER_ID); - if (ret < 0) { - dev_err(&client->dev, "Failed to read manufacturer id : %d\n", - ret); - return ret; - } else if (ret != 0x0040) { - dev_err(&client->dev, - "manufacturer id mismatch. 0x0040 != 0x%04x\n", ret); - return -ENODEV; - } - - ret = bq24735_read_word(client, BQ24735_DEVICE_ID); - if (ret < 0) { - dev_err(&client->dev, "Failed to read device id : %d\n", ret); - return ret; - } else if (ret != 0x000B) { - dev_err(&client->dev, - "device id mismatch. 0x000b != 0x%04x\n", ret); - return -ENODEV; - } - if (gpio_is_valid(charger->pdata->status_gpio)) { ret = devm_gpio_request(&client->dev, charger->pdata->status_gpio, @@ -327,6 +306,30 @@ static int bq24735_charger_probe(struct i2c_client *client, charger->pdata->status_gpio_valid = !ret; } + if (!charger->pdata->status_gpio_valid + || bq24735_charger_is_present(charger)) { + ret = bq24735_read_word(client, BQ24735_MANUFACTURER_ID); + if (ret < 0) { + dev_err(&client->dev, "Failed to read manufacturer id : %d\n", + ret); + return ret; + } else if (ret != 0x0040) { + dev_err(&client->dev, + "manufacturer id mismatch. 0x0040 != 0x%04x\n", ret); + return -ENODEV; + } + + ret = bq24735_read_word(client, BQ24735_DEVICE_ID); + if (ret < 0) { + dev_err(&client->dev, "Failed to read device id : %d\n", ret); + return ret; + } else if (ret != 0x000B) { + dev_err(&client->dev, + "device id mismatch. 0x000b != 0x%04x\n", ret); + return -ENODEV; + } + } + ret = bq24735_config_charger(charger); if (ret < 0) { dev_err(&client->dev, "failed in configuring charger"); -- 2.7.0 -- To unsubscribe from this list: send the line "unsubscribe devicetree" in the body of a message to majordomo-u79uwXL29TY76Z2rM5mHXA@public.gmane.org More majordomo info at http://vger.kernel.org/majordomo-info.html ^ permalink raw reply related [flat|nested] 6+ messages in thread
* [PATCH 2/3] power: bq24735-charger: add 'ti,external-control' option [not found] ` <1454479426-6437-1-git-send-email-sctincman-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> 2016-02-03 6:03 ` [PATCH 1/3] power: bq24735-charger: fix failed i2c with ac-detect Jonathan Tinkham @ 2016-02-03 6:03 ` Jonathan Tinkham 1 sibling, 0 replies; 6+ messages in thread From: Jonathan Tinkham @ 2016-02-03 6:03 UTC (permalink / raw) To: linux-pm-u79uwXL29TY76Z2rM5mHXA, devicetree-u79uwXL29TY76Z2rM5mHXA Cc: sre-DgEjT+Ai2ygdnm+yROfE0A, dbaryshkov-Re5JQEeQqe8AvxtiuMwx3w, dwmw2-wEGCiKHe2LqWVfeAwA7xHQ, robh+dt-DgEjT+Ai2ygdnm+yROfE0A, pawel.moll-5wv7dgnIgG8, mark.rutland-5wv7dgnIgG8, ijc+devicetree-KcIKpvwj1kUDXYZnReoRVg, galak-sgV2jX0FEOL9JmXXK+q4OQ, Jonathan Tinkham Implement an 'ti,external-control' option for when the charger shouldn't be configured by the host. Signed-off-by: Jonathan Tinkham <sctincman-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> --- drivers/power/bq24735-charger.c | 11 +++++++++++ include/linux/power/bq24735-charger.h | 2 ++ 2 files changed, 13 insertions(+) diff --git a/drivers/power/bq24735-charger.c b/drivers/power/bq24735-charger.c index f041c16..96afcc1 100644 --- a/drivers/power/bq24735-charger.c +++ b/drivers/power/bq24735-charger.c @@ -90,6 +90,9 @@ static int bq24735_update_word(struct i2c_client *client, u8 reg, static inline int bq24735_enable_charging(struct bq24735 *charger) { + if (charger->pdata->ext_control) + return 0; + return bq24735_update_word(charger->client, BQ24735_CHG_OPT, BQ24735_CHG_OPT_CHARGE_DISABLE, ~BQ24735_CHG_OPT_CHARGE_DISABLE); @@ -97,6 +100,9 @@ static inline int bq24735_enable_charging(struct bq24735 *charger) static inline int bq24735_disable_charging(struct bq24735 *charger) { + if (charger->pdata->ext_control) + return 0; + return bq24735_update_word(charger->client, BQ24735_CHG_OPT, BQ24735_CHG_OPT_CHARGE_DISABLE, BQ24735_CHG_OPT_CHARGE_DISABLE); @@ -108,6 +114,9 @@ static int bq24735_config_charger(struct bq24735 *charger) int ret; u16 value; + if (pdata->ext_control) + return 0; + if (pdata->charge_current) { value = pdata->charge_current & BQ24735_CHARGE_CURRENT_MASK; @@ -239,6 +248,8 @@ static struct bq24735_platform *bq24735_parse_dt_data(struct i2c_client *client) if (!ret) pdata->input_current = val; + pdata->ext_control = of_property_read_bool(np, "ti,external-control"); + return pdata; } diff --git a/include/linux/power/bq24735-charger.h b/include/linux/power/bq24735-charger.h index f536164..6b750c1a 100644 --- a/include/linux/power/bq24735-charger.h +++ b/include/linux/power/bq24735-charger.h @@ -32,6 +32,8 @@ struct bq24735_platform { int status_gpio_active_low; bool status_gpio_valid; + bool ext_control; + char **supplied_to; size_t num_supplicants; }; -- 2.7.0 -- To unsubscribe from this list: send the line "unsubscribe devicetree" in the body of a message to majordomo-u79uwXL29TY76Z2rM5mHXA@public.gmane.org More majordomo info at http://vger.kernel.org/majordomo-info.html ^ permalink raw reply related [flat|nested] 6+ messages in thread
* [PATCH 3/3] power: bq24735-charger: document 'ti,external-control' option 2016-02-03 6:03 [PATCH 0/3] power: bq24735-charger: chromebook fixes Jonathan Tinkham [not found] ` <1454479426-6437-1-git-send-email-sctincman-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> @ 2016-02-03 6:03 ` Jonathan Tinkham 2016-02-08 17:24 ` Rob Herring 2016-02-15 5:58 ` [PATCH 0/3] power: bq24735-charger: chromebook fixes Sebastian Reichel 2 siblings, 1 reply; 6+ messages in thread From: Jonathan Tinkham @ 2016-02-03 6:03 UTC (permalink / raw) To: linux-pm, devicetree Cc: sre, dbaryshkov, dwmw2, robh+dt, pawel.moll, mark.rutland, ijc+devicetree, galak, Jonathan Tinkham Implement an 'external-control' option for when the charger shouldn't be configured by the kernel. Signed-off-by: Jonathan Tinkham <sctincman@gmail.com> --- Documentation/devicetree/bindings/power_supply/ti,bq24735.txt | 3 +++ 1 file changed, 3 insertions(+) diff --git a/Documentation/devicetree/bindings/power_supply/ti,bq24735.txt b/Documentation/devicetree/bindings/power_supply/ti,bq24735.txt index 4f6a550..3bf5575 100644 --- a/Documentation/devicetree/bindings/power_supply/ti,bq24735.txt +++ b/Documentation/devicetree/bindings/power_supply/ti,bq24735.txt @@ -22,6 +22,9 @@ Optional properties : value must be between 128mA and 8.064A with a 128mA step resolution. The POR value is 0x1000h. This number is in mA (e.g. 8064), see the spec for more information about the InputCurrent (0x3fh) register. + - 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. Example: -- 2.7.0 ^ permalink raw reply related [flat|nested] 6+ messages in thread
* Re: [PATCH 3/3] power: bq24735-charger: document 'ti,external-control' option 2016-02-03 6:03 ` [PATCH 3/3] power: bq24735-charger: document " Jonathan Tinkham @ 2016-02-08 17:24 ` Rob Herring 0 siblings, 0 replies; 6+ messages in thread From: Rob Herring @ 2016-02-08 17:24 UTC (permalink / raw) To: Jonathan Tinkham Cc: linux-pm, devicetree, sre, dbaryshkov, dwmw2, pawel.moll, mark.rutland, ijc+devicetree, galak On Tue, Feb 02, 2016 at 11:03:46PM -0700, Jonathan Tinkham wrote: > Implement an 'external-control' option for when the charger > shouldn't be configured by the kernel. > > Signed-off-by: Jonathan Tinkham <sctincman@gmail.com> > --- > Documentation/devicetree/bindings/power_supply/ti,bq24735.txt | 3 +++ > 1 file changed, 3 insertions(+) Acked-by: Rob Herring <robh@kernel.org> ^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: [PATCH 0/3] power: bq24735-charger: chromebook fixes 2016-02-03 6:03 [PATCH 0/3] power: bq24735-charger: chromebook fixes Jonathan Tinkham [not found] ` <1454479426-6437-1-git-send-email-sctincman-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> 2016-02-03 6:03 ` [PATCH 3/3] power: bq24735-charger: document " Jonathan Tinkham @ 2016-02-15 5:58 ` Sebastian Reichel 2 siblings, 0 replies; 6+ messages in thread From: Sebastian Reichel @ 2016-02-15 5:58 UTC (permalink / raw) To: Jonathan Tinkham Cc: linux-pm, devicetree, dbaryshkov, dwmw2, robh+dt, pawel.moll, mark.rutland, ijc+devicetree, galak [-- Attachment #1: Type: text/plain, Size: 310 bytes --] Hi, On Tue, Feb 02, 2016 at 11:03:43PM -0700, Jonathan Tinkham wrote: > On Acer Chromebook 13 (CB5-311) this module fails to load if the charger > is not inserted, and will error when it is removed. > > These fixes are adapted from Acer's downstream kernel. Thanks, queued for 4.6. -- Sebastian [-- Attachment #2: signature.asc --] [-- Type: application/pgp-signature, Size: 819 bytes --] ^ permalink raw reply [flat|nested] 6+ messages in thread
end of thread, other threads:[~2016-02-15 5:58 UTC | newest]
Thread overview: 6+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2016-02-03 6:03 [PATCH 0/3] power: bq24735-charger: chromebook fixes Jonathan Tinkham
[not found] ` <1454479426-6437-1-git-send-email-sctincman-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org>
2016-02-03 6:03 ` [PATCH 1/3] power: bq24735-charger: fix failed i2c with ac-detect Jonathan Tinkham
2016-02-03 6:03 ` [PATCH 2/3] power: bq24735-charger: add 'ti,external-control' option Jonathan Tinkham
2016-02-03 6:03 ` [PATCH 3/3] power: bq24735-charger: document " Jonathan Tinkham
2016-02-08 17:24 ` Rob Herring
2016-02-15 5:58 ` [PATCH 0/3] power: bq24735-charger: chromebook fixes Sebastian Reichel
This is a public inbox, see mirroring instructions for how to clone and mirror all data and code used for this inbox; as well as URLs for NNTP newsgroup(s).