diff options
author | Hans de Goede <hdegoede@redhat.com> | 2017-03-22 17:55:31 +0300 |
---|---|---|
committer | Sebastian Reichel <sre@kernel.org> | 2017-04-14 02:41:34 +0300 |
commit | 99c88eb244aa6b61cc0c4ca6e6b6b9c7ce00cc53 (patch) | |
tree | 5323eb6fe10bb249b1eee3943a2da0c1f0aa2af5 /drivers/power/supply | |
parent | 01c0e0a28da749e80cb7d549f75a5f52e2f40d0e (diff) | |
download | linux-99c88eb244aa6b61cc0c4ca6e6b6b9c7ce00cc53.tar.xz |
power: supply: bq24190_charger: Add support for bq24192i
The bq24192 and bq24192i are mostly identical to the bq24190, TI even
published a single datasheet for all 3 of them. The difference
between the bq24190 and bq24192[i] is the way charger-type detection
is done, the bq24190 is to be directly connected to the USB a/b lines,
where as the the bq24192[i] has a gpio which should be driven high/low
externally depending on the type of charger connected, from a register
level access pov there is no difference.
The differences between the bq24192 and bq24192i are:
1) Lower default charge rate on the bq24192i
2) Pre-charge-current can be max 640 mA on the bq24192i
On x86/ACPI systems the code which instantiates the i2c client may not
know the exact variant being used, so instead of coding the model-id
in the i2c_id struct and bailing if it does not match, check the reported
model-id matches one of the supported variants.
This commit only adds support for the bq24192i as I don't
have a bq24192 to test with, adding support for the bq24192 should
be as simple as also accepting its model-id in the model-id test.
Cc: Liam Breck <kernel@networkimprov.net>
Cc: Tony Lindgren <tony@atomide.com>
Signed-off-by: Hans de Goede <hdegoede@redhat.com>
Signed-off-by: Sebastian Reichel <sre@kernel.org>
Diffstat (limited to 'drivers/power/supply')
-rw-r--r-- | drivers/power/supply/bq24190_charger.c | 15 |
1 files changed, 6 insertions, 9 deletions
diff --git a/drivers/power/supply/bq24190_charger.c b/drivers/power/supply/bq24190_charger.c index fa2d2da2de5f..d74c8cce0770 100644 --- a/drivers/power/supply/bq24190_charger.c +++ b/drivers/power/supply/bq24190_charger.c @@ -149,7 +149,6 @@ struct bq24190_dev_info { struct power_supply *charger; struct power_supply *battery; char model_name[I2C_NAME_SIZE]; - kernel_ulong_t model; bool initialized; bool irq_event; struct mutex f_reg_lock; @@ -1291,8 +1290,11 @@ static int bq24190_hw_init(struct bq24190_dev_info *bdi) if (ret < 0) return ret; - if (v != bdi->model) + if (v != BQ24190_REG_VPRS_PN_24190 && + v != BQ24190_REG_VPRS_PN_24192I) { + dev_err(bdi->dev, "Error unknown model: 0x%02x\n", v); return -ENODEV; + } ret = bq24190_register_reset(bdi); if (ret < 0) @@ -1327,7 +1329,6 @@ static int bq24190_probe(struct i2c_client *client, bdi->client = client; bdi->dev = dev; - bdi->model = id->driver_data; strncpy(bdi->model_name, id->name, I2C_NAME_SIZE); mutex_init(&bdi->f_reg_lock); bdi->f_reg = 0; @@ -1526,13 +1527,9 @@ static const struct dev_pm_ops bq24190_pm_ops = { SET_SYSTEM_SLEEP_PM_OPS(bq24190_pm_suspend, bq24190_pm_resume) }; -/* - * Only support the bq24190 right now. The bq24192, bq24192i, and bq24193 - * are similar but not identical so the driver needs to be extended to - * support them. - */ static const struct i2c_device_id bq24190_i2c_ids[] = { - { "bq24190", BQ24190_REG_VPRS_PN_24190 }, + { "bq24190" }, + { "bq24192i" }, { }, }; MODULE_DEVICE_TABLE(i2c, bq24190_i2c_ids); |