summaryrefslogtreecommitdiff
path: root/drivers/power/supply/bq25890_charger.c
AgeCommit message (Collapse)Author
2020-11-29power: supply: bq25890: Use the correct range for IILIM registerSebastian Krzyszkowiak
I've checked bq25890, bq25892, bq25895 and bq25896 datasheets and they all define IILIM to be between 100mA-3.25A with 50mA steps. Fixes: 478efc79ee32 ("power: bq25890: implement INPUT_CURRENT_LIMIT property") Signed-off-by: Sebastian Krzyszkowiak <sebastian.krzyszkowiak@puri.sm> Reviewed-by: Michał Mirosław <mirq-linux@rere.qmqm.pl> Signed-off-by: Sebastian Reichel <sebastian.reichel@collabora.com>
2020-10-03power: supply: bq25890: skip 'struct acpi_device_id' when !CONFIG_ACPIKrzysztof Kozlowski
Since ACPI_PTR() is used to NULLify the value when !CONFIG_ACPI, the struct acpi_device_id becomes unused: drivers/power/supply/bq25890_charger.c:1076:36: warning: 'bq25890_acpi_match' defined but not used [-Wunused-const-variable=] Signed-off-by: Krzysztof Kozlowski <krzk@kernel.org> Signed-off-by: Sebastian Reichel <sebastian.reichel@collabora.com>
2020-09-30power: supply: bq25890: support IBAT compensationMichał Mirosław
Add configuration for compensation of IBAT measuring resistor in series with the battery. Signed-off-by: Michał Mirosław <mirq-linux@rere.qmqm.pl> Signed-off-by: Sebastian Reichel <sebastian.reichel@collabora.com>
2020-05-10power: bq25890: implement INPUT_CURRENT_LIMIT propertyMichał Mirosław
Report REG00.IINLIM value as INPUT_CURRENT_LIMIT property. Signed-off-by: Michał Mirosław <mirq-linux@rere.qmqm.pl> Signed-off-by: Sebastian Reichel <sebastian.reichel@collabora.com>
2020-05-10power: bq25890: implement PRECHARGE_CURRENT propertyMichał Mirosław
Report configured precharge current. Signed-off-by: Michał Mirosław <mirq-linux@rere.qmqm.pl> Signed-off-by: Sebastian Reichel <sebastian.reichel@collabora.com>
2020-05-10power: bq25890: implement CHARGE_TYPE propertyMichał Mirosław
Report charging type based on recently read state. Signed-off-by: Michał Mirosław <mirq-linux@rere.qmqm.pl> Signed-off-by: Sebastian Reichel <sebastian.reichel@collabora.com>
2020-05-10power: bq25890: update state on property readMichał Mirosław
Edge interrupts from the charger may be lost or stuck in fault mode since probe(). Check if something changed everytime userspace wants some data. Signed-off-by: Michał Mirosław <mirq-linux@rere.qmqm.pl> Signed-off-by: Sebastian Reichel <sebastian.reichel@collabora.com>
2020-05-10power: bq25890: fix ADC mode configurationMichał Mirosław
Datasheet describes two modes for reading ADC measurements: 1. continuous, 1 Hz - enabled and started by CONV_RATE bit 2. one-shot - triggered by CONV_START bit In continuous mode, CONV_START is read-only and signifies an ongoing conversion. Change the code to follow the datasheet and really disable continuous mode for power saving. Signed-off-by: Michał Mirosław <mirq-linux@rere.qmqm.pl> Signed-off-by: Sebastian Reichel <sebastian.reichel@collabora.com>
2020-05-10power: bq25890: use proper CURRENT_NOW property for I_BATMichał Mirosław
Charge Current is more apropriately reflected by CURRENT_NOW property (measured current) than CONSTANT_CURRENT_VOLTAGE (configured CC-phase current limit). Fix the reference and make the sign reflect direction of the current. Signed-off-by: Michał Mirosław <mirq-linux@rere.qmqm.pl> Signed-off-by: Sebastian Reichel <sebastian.reichel@collabora.com>
2020-05-09power: bq25890: unlock on error paths in bq25890_resume()Dan Carpenter
We introduced some new locking here, but need to update the error paths so they unlock before returning. Fixes: 72d9cd9cdc18 ("power: bq25890: protect view of the chip's state") Signed-off-by: Dan Carpenter <dan.carpenter@oracle.com> Reviewed-by: Michał Mirosław <mirq-linux@rere.qmqm.pl> Signed-off-by: Sebastian Reichel <sebastian.reichel@collabora.com>
2020-05-03power: bq25890: protect view of the chip's stateMichał Mirosław
Extend bq->lock over whole updating of the chip's state. Might get useful later for switching ADC modes correctly. Signed-off-by: Michał Mirosław <mirq-linux@rere.qmqm.pl> Signed-off-by: Sebastian Reichel <sebastian.reichel@collabora.com>
2020-05-03power: bq25890: remove redundant I2C bus checkMichał Mirosław
regmap initialization will check I2C adapter functionality. Remove redundant check in the driver. Signed-off-by: Michał Mirosław <mirq-linux@rere.qmqm.pl> Signed-off-by: Sebastian Reichel <sebastian.reichel@collabora.com>
2020-05-03power: bq25890: make property table constMichał Mirosław
Property list should not change, so mark it const. Signed-off-by: Michał Mirosław <mirq-linux@rere.qmqm.pl> Signed-off-by: Sebastian Reichel <sebastian.reichel@collabora.com>
2020-05-03power: bq25890: simplify chip name property getterMichał Mirosław
Driver rejects unknown chips early in the probe(), so when bq25890_power_supply_get_property() is made reachable, bq->chip_version will already be set to correct value - there is no need to check it again. Signed-off-by: Michał Mirosław <mirq-linux@rere.qmqm.pl> Signed-off-by: Sebastian Reichel <sebastian.reichel@collabora.com>
2020-01-16power: supply: bq25890_charger: fix incorrect error return when ↵Colin Ian King
bq25890_field_read fails Currently a read failure by bq25890_field_read on F_DEV_REV is returning an error in id instead of rev. Fix this by returning the value in rev. Addresses-Coverity: ("Copy-paste error") Fixes: d20267c9a98e ("power: supply: bq25890_charger: Add support of BQ25892 and BQ25896 chips") Signed-off-by: Colin Ian King <colin.king@canonical.com> Signed-off-by: Sebastian Reichel <sebastian.reichel@collabora.com>
2020-01-14power: supply: bq25890_charger: Add DT and I2C ids for all supported chipsYauhen Kharuzhy
Add bq25892, bq25895 and bq25896 to list of supported device IDs for DeviceTree and I2C. Signed-off-by: Yauhen Kharuzhy <jekhor@gmail.com> Signed-off-by: Sebastian Reichel <sebastian.reichel@collabora.com>
2020-01-14power: supply: bq25890_charger: Add support of BQ25892 and BQ25896 chipsYauhen Kharuzhy
Support BQ25892 and BQ25896 chips by this driver. They shared one chip ID 0, so distinquish them by device revisions (2 for 25896 and 1 for 25892). Signed-off-by: Yauhen Kharuzhy <jekhor@gmail.com> Signed-off-by: Sebastian Reichel <sebastian.reichel@collabora.com>
2019-09-02power: supply: bq25890_charger: Add the BQ25895 partAngus Ainslie (Purism)
The BQ25895 is almost identical to the BQ25890. Signed-off-by: Angus Ainslie (Purism) <angus@akkea.ca> Reviewed-by: Krzysztof Kozlowski <krzk@kernel.org> Signed-off-by: Sebastian Reichel <sebastian.reichel@collabora.com>
2019-07-15Merge tag 'for-v5.3' of ↵Linus Torvalds
git://git.kernel.org/pub/scm/linux/kernel/git/sre/linux-power-supply Pull power supply and reset updates from Sebastian Reichel: "Core: - add HWMON compat layer - new properties: - input power limit - input voltage limit Drivers: - qcom-pon: add gen2 support - new driver for storing reboot move in NVMEM - new driver for Wilco EC charger configuration - simplify getting the adapter of a client" * tag 'for-v5.3' of git://git.kernel.org/pub/scm/linux/kernel/git/sre/linux-power-supply: power: reset: nvmem-reboot-mode: add CONFIG_OF dependency power_supply: wilco_ec: Add charging config driver power: supply: cros: allow to set input voltage and current limit power: supply: add input power and voltage limit properties power: supply: fix semicolon.cocci warnings power: reset: nvmem-reboot-mode: use NVMEM as reboot mode write interface dt-bindings: power: reset: add document for NVMEM based reboot-mode reset: qcom-pon: Add support for gen2 pon dt-bindings: power: reset: qcom: Add qcom,pm8998-pon compatibility line power: supply: Add HWMON compatibility layer power: supply: sbs-manager: simplify getting the adapter of a client power: supply: rt9455_charger: simplify getting the adapter of a client power: supply: rt5033_battery: simplify getting the adapter of a client power: supply: max17042_battery: simplify getting the adapter of a client power: supply: max17040_battery: simplify getting the adapter of a client power: supply: max14656_charger_detector: simplify getting the adapter of a client power: supply: bq25890_charger: simplify getting the adapter of a client power: supply: bq24257_charger: simplify getting the adapter of a client power: supply: bq24190_charger: simplify getting the adapter of a client
2019-06-23power: supply: bq25890_charger: simplify getting the adapter of a clientWolfram Sang
We have a dedicated pointer for that, so use it. Much easier to read and less computation involved. Signed-off-by: Wolfram Sang <wsa+renesas@sang-engineering.com> Reviewed-by: Simon Horman <horms+renesas@verge.net.au> Signed-off-by: Sebastian Reichel <sebastian.reichel@collabora.com>
2019-05-30treewide: Replace GPLv2 boilerplate/reference with SPDX - rule 157Thomas Gleixner
Based on 3 normalized pattern(s): this program is free software you can redistribute it and or modify it under the terms of the gnu general public license as published by the free software foundation either version 2 of the license or at your option any later version this program is distributed in the hope that it will be useful but without any warranty without even the implied warranty of merchantability or fitness for a particular purpose see the gnu general public license for more details this program is free software you can redistribute it and or modify it under the terms of the gnu general public license as published by the free software foundation either version 2 of the license or at your option any later version [author] [kishon] [vijay] [abraham] [i] [kishon]@[ti] [com] this program is distributed in the hope that it will be useful but without any warranty without even the implied warranty of merchantability or fitness for a particular purpose see the gnu general public license for more details this program is free software you can redistribute it and or modify it under the terms of the gnu general public license as published by the free software foundation either version 2 of the license or at your option any later version [author] [graeme] [gregory] [gg]@[slimlogic] [co] [uk] [author] [kishon] [vijay] [abraham] [i] [kishon]@[ti] [com] [based] [on] [twl6030]_[usb] [c] [author] [hema] [hk] [hemahk]@[ti] [com] this program is distributed in the hope that it will be useful but without any warranty without even the implied warranty of merchantability or fitness for a particular purpose see the gnu general public license for more details extracted by the scancode license scanner the SPDX license identifier GPL-2.0-or-later has been chosen to replace the boilerplate/reference in 1105 file(s). Signed-off-by: Thomas Gleixner <tglx@linutronix.de> Reviewed-by: Allison Randal <allison@lohutok.net> Reviewed-by: Richard Fontana <rfontana@redhat.com> Reviewed-by: Kate Stewart <kstewart@linuxfoundation.org> Cc: linux-spdx@vger.kernel.org Link: https://lkml.kernel.org/r/20190527070033.202006027@linutronix.de Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2019-01-23power: supply: bq25890: show max charge current/voltage as configuredMichał Mirosław
Use firmware-provided limits for POWER_SUPPLY_*_MAX properties instead of chip max values. This will reflect the battery limits as those are the important ones. Signed-off-by: Michał Mirosław <mirq-linux@rere.qmqm.pl> Signed-off-by: Sebastian Reichel <sebastian.reichel@collabora.com>
2018-12-18power: supply: bq25890: fix BAT_COMP field definitionMichał Mirosław
According to datasheet, BAT_COMP field spans bits 5-7. The rest of the code seems to assume this already. Fixes: 4aeae9cb0dad ("power_supply: Add support for TI BQ25890 charger chip") Signed-off-by: Michał Mirosław <mirq-linux@rere.qmqm.pl> Signed-off-by: Sebastian Reichel <sebastian.reichel@collabora.com>
2018-09-18power: supply: bq25890_charger: fix semicolon.cocci warningskbuild test robot
drivers/power/supply/bq25890_charger.c:614:2-3: Unneeded semicolon drivers/power/supply/bq25890_charger.c:621:2-3: Unneeded semicolon drivers/power/supply/bq25890_charger.c:630:3-4: Unneeded semicolon drivers/power/supply/bq25890_charger.c:638:2-3: Unneeded semicolon drivers/power/supply/bq25890_charger.c:644:2-3: Unneeded semicolon Remove unneeded semicolon. Generated by: scripts/coccinelle/misc/semicolon.cocci Fixes: 9d9ae3414d1b ("power: supply: bq25890_charger: Add debugging output of failed initialization") CC: Angus Ainslie (Purism) <angus@akkea.ca> Signed-off-by: kbuild test robot <fengguang.wu@intel.com> Signed-off-by: Sebastian Reichel <sebastian.reichel@collabora.com>
2018-09-16power: supply: bq25890_charger: Read back the current battery voltageAngus Ainslie (Purism)
The BQ2589x family has the capability of reading the current battery voltage. Reviewed-by: Krzysztof Kozlowski <krzk@kernel.org> Signed-off-by: Angus Ainslie (Purism) <angus@akkea.ca> Signed-off-by: Sebastian Reichel <sebastian.reichel@collabora.com>
2018-09-16power: supply: bq25890_charger: Add the BQ25896 partAngus Ainslie (Purism)
The BQ25896 is almost identical to the BQ25890. Reviewed-by: Krzysztof Kozlowski <krzk@kernel.org> Signed-off-by: Angus Ainslie (Purism) <angus@akkea.ca> Signed-off-by: Sebastian Reichel <sebastian.reichel@collabora.com>
2018-09-16power: supply: bq25890_charger: Remove unused table entriesAngus Ainslie (Purism)
There are a few table entries that aren't used. Drop them. Reviewed-by: Krzysztof Kozlowski <krzk@kernel.org> Signed-off-by: Angus Ainslie (Purism) <angus@akkea.ca> Signed-off-by: Sebastian Reichel <sebastian.reichel@collabora.com>
2018-09-16power: supply: bq25890_charger: Add debugging output of failed initializationAngus Ainslie (Purism)
To ease adding a new part variant some debugging is handy. Reviewed-by: Krzysztof Kozlowski <krzk@kernel.org> Signed-off-by: Angus Ainslie (Purism) <angus@akkea.ca> Signed-off-by: Sebastian Reichel <sebastian.reichel@collabora.com>
2017-04-14power: supply: bq25890: Use gpiod_get()Andy Shevchenko
Since index is always 0, replace gpiod_get_index() by gpiod_get(). Signed-off-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com> Signed-off-by: Sebastian Reichel <sre@kernel.org>
2016-08-11power: move power supply drivers to power/supplySebastian Reichel
This moves all power supply drivers from drivers/power/ to drivers/power/supply/. The intention is a cleaner source tree, since drivers/power/ also contains frameworks unrelated to power supply, like adaptive voltage scaling. Signed-off-by: Sebastian Reichel <sre@kernel.org>