summaryrefslogtreecommitdiff
path: root/drivers/power/supply/bq24735-charger.c
AgeCommit message (Collapse)Author
2017-01-04power: supply: bq24735: bring down the noise levelPeter Rosin
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> Signed-off-by: Sebastian Reichel <sre@kernel.org>
2017-01-04power: supply: bq24735: allow polling even if there is no ac-detect gpioPeter Rosin
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> Acked-by: Rob Herring <robh@kernel.org> Signed-off-by: Sebastian Reichel <sre@kernel.org>
2017-01-04power: supply: bq24735: always check for AC adapter presence in probePeter Rosin
So what if there is a status_gpio specified? bq24735_charger_is_present() do have a working fallback for the case of no status_gpio. Simplify this by not special casing setups w/o status_gpio, folding two consecutive if-blocks in the process. Signed-off-by: Peter Rosin <peda@axentia.se> Signed-off-by: Sebastian Reichel <sre@kernel.org>
2017-01-04power: supply: bq24735: configure the charger as part of enabling itPeter Rosin
During probe, it makes no sense to take care to first not issue any i2c commands to verify if the connected part really is a bq24735, to later simply fail the probe in the next step when trying to configure the charger. So, delay configuration of the charging parameters until the charger is accessible (i.e. when the AC adapter is present) as part of enabling the charging. This also fixes the rather serious issue that the charging parameters are lost when the AC adapter is disconnected. Signed-off-by: Peter Rosin <peda@axentia.se> Signed-off-by: Sebastian Reichel <sre@kernel.org>
2017-01-04power: supply: bq24735: move down bq24735_{en,dis}able_chargingPeter Rosin
bq24735_enable_charging() needs to call bq24735_config_charging(), which is something to change later, this is just a preparatory patch. Signed-off-by: Peter Rosin <peda@axentia.se> Signed-off-by: Sebastian Reichel <sre@kernel.org>
2017-01-04power: supply: bq24735-charger: optionally poll the ac-detect gpioPeter Rosin
If the ac-detect gpio does not support interrupts, provide a fallback to poll the gpio at a configurable interval. Signed-off-by: Peter Rosin <peda@axentia.se> Acked-by: Rob Herring <robh@kernel.org> Signed-off-by: Sebastian Reichel <sre@kernel.org>
2017-01-04power: supply: bq24735-charger: simplify register update to stop chargingPeter Rosin
Providing value bits outside of the mask is pointless. Signed-off-by: Peter Rosin <peda@axentia.se> Signed-off-by: Sebastian Reichel <sre@kernel.org>
2016-09-05power: supply: bq24735-charger: Request status GPIO with initial input setupPaul Kocialkowski
This requests the status GPIO with initial input setup. It is required to read the GPIO status at probe time and thus correctly avoid sending I2C messages when AC is not plugged. When requesting the GPIO without initial input setup, it always reads 0 which causes probe to fail as it assumes the charger is connected, sends I2C messages and fails. While at it, this switches the driver over to gpiod API. Signed-off-by: Paul Kocialkowski <contact@paulk.fr> Signed-off-by: Sebastian Reichel <sre@kernel.org>
2016-08-29power: bq24735-charger: Assume not charging when charger is missingPaul Kocialkowski
When the charger is missing (disconnected), it is safe to assume that the charger chip is no charging. This is especially relevant when a status GPIO is present and the charger is getting disconnected. bq24735_charger_is_charging will be triggered due to the interrupt then, it will attempt to read whether it is charging through i2c, which will fail as the charger is disconnected. This also fixes that specific issue. Signed-off-by: Paul Kocialkowski <contact@paulk.fr> 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>