diff options
author | Jonathan Tinkham <sctincman@gmail.com> | 2016-02-02 23:03:45 -0700 |
---|---|---|
committer | Sebastian Reichel <sre@kernel.org> | 2016-02-15 06:36:10 +0100 |
commit | 64024ac7bb82c41265e7ba08235591d9a2709dfc (patch) | |
tree | 03c63b41b6a9fbd5aded3bbab9badbc95a1b3198 | |
parent | a60da83fd8949ebd6000e2d4b2876a899e38612b (diff) | |
download | linux-64024ac7bb82c41265e7ba08235591d9a2709dfc.tar.bz2 |
power: bq24735-charger: add 'ti,external-control' option
Implement an 'ti,external-control' option for when the charger
shouldn't be configured by the host.
Signed-off-by: Jonathan Tinkham <sctincman@gmail.com>
Signed-off-by: Sebastian Reichel <sre@kernel.org>
-rw-r--r-- | drivers/power/bq24735-charger.c | 11 | ||||
-rw-r--r-- | include/linux/power/bq24735-charger.h | 2 |
2 files changed, 13 insertions, 0 deletions
diff --git a/drivers/power/bq24735-charger.c b/drivers/power/bq24735-charger.c index 022a09ceab73..fa454c19ce17 100644 --- a/drivers/power/bq24735-charger.c +++ b/drivers/power/bq24735-charger.c @@ -106,6 +106,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); @@ -113,6 +116,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); @@ -124,6 +130,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; @@ -322,6 +331,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 f536164a6069..6b750c1a45fa 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; }; |