summaryrefslogtreecommitdiffstats
path: root/drivers/power/supply/bq24735-charger.c
Commit message (Collapse)AuthorAgeFilesLines
* power: supply: bq24735: remove incorrect le16_to_cpu callsPhil Reid2017-06-151-4/+2
| | | | | | | | | i2c_smbus commands handle the correct byte order for smbus transactions internally. This will currently result in incorrect operation on big endian systems. Signed-off-by: Phil Reid <preid@electromag.com.au> Signed-off-by: Sebastian Reichel <sebastian.reichel@collabora.co.uk>
* power: supply: bq24735: bring down the noise levelPeter Rosin2017-01-041-1/+1
| | | | | | | | | 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>
* power: supply: bq24735: allow polling even if there is no ac-detect gpioPeter Rosin2017-01-041-1/+1
| | | | | | | | | 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>
* power: supply: bq24735: always check for AC adapter presence in probePeter Rosin2017-01-041-4/+1
| | | | | | | | | | | 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>
* power: supply: bq24735: configure the charger as part of enabling itPeter Rosin2017-01-041-7/+6
| | | | | | | | | | | | | | | 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>
* power: supply: bq24735: move down bq24735_{en,dis}able_chargingPeter Rosin2017-01-041-19/+19
| | | | | | | | 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>
* power: supply: bq24735-charger: optionally poll the ac-detect gpioPeter Rosin2017-01-041-5/+44
| | | | | | | | | 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>
* power: supply: bq24735-charger: simplify register update to stop chargingPeter Rosin2017-01-041-2/+1
| | | | | | | 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>
* power: supply: bq24735-charger: Request status GPIO with initial input setupPaul Kocialkowski2016-09-051-27/+12
| | | | | | | | | | | | | | | 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>
* power: bq24735-charger: Assume not charging when charger is missingPaul Kocialkowski2016-08-291-1/+5
| | | | | | | | | | | | | | | 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>
* power: move power supply drivers to power/supplySebastian Reichel2016-08-111-0/+500
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>