Commit graph

916490 commits

Author SHA1 Message Date
Sebastian Reichel
972eabb97a Revert "power: supply: sbs-battery: simplify read_read_string_data"
The commit is a nice cleanup, but breaks booting on exynos5 based
chromebooks. It's seems to come down to exynos5's i2c driver not
implementing I2C_FUNC_SMBUS_READ_BLOCK_DATA. It's not yet clear
why that breaks boot / massively slows it down when userspace
starts, so revert the problematic patch.

This reverts commit c4b12a2f3f.

Signed-off-by: Sebastian Reichel <sebastian.reichel@collabora.com>
2020-06-02 17:08:33 +02:00
Sebastian Reichel
cf1eb321d1 Revert "power: supply: sbs-battery: add PEC support"
This depends on the simplification of sbs_read_string_data, which
breaks booting exynos5 based chromebooks. More investigation is
required, so this patch and the simplification patch are reverted
for this merge window.

Note, that this is only a partial revert, since sbs_update_presence()
has not been removed. It is also required for the charger broadcast
disabling.

This reverts commit 79bcd5a4a6.

Signed-off-by: Sebastian Reichel <sebastian.reichel@collabora.com>
2020-06-02 16:59:08 +02:00
Sebastian Reichel
805f64e8b5 dt-bindings: power: sbs-battery: Convert to yaml
Convert sbs-battery bindings to YAML.

Reviewed-by: Rob Herring <robh@kernel.org>
Signed-off-by: Sebastian Reichel <sebastian.reichel@collabora.com>
2020-05-29 00:39:35 +02:00
Sebastian Reichel
68956dbe6f power: supply: sbs-battery: constify power-supply property array
Signed-off-by: Sebastian Reichel <sebastian.reichel@collabora.com>
2020-05-29 00:39:35 +02:00
Sebastian Reichel
f9ca07a123 power: supply: sbs-battery: switch to i2c's probe_new
sbs-battery does not use the ID parameter, so switch to i2c's
probe_new API.

Signed-off-by: Sebastian Reichel <sebastian.reichel@collabora.com>
2020-05-29 00:39:34 +02:00
Sebastian Reichel
03b758ba36 power: supply: sbs-battery: switch from of_property_* to device_property_*
Switch from DT specific of_property_* API to generic and more
modern device_property_* API.

Signed-off-by: Sebastian Reichel <sebastian.reichel@collabora.com>
2020-05-29 00:39:34 +02:00
Jean-Francois Dagenais
182fc88268 power: supply: sbs-battery: add ability to disable charger broadcasts
In certain designs, it is possible to add a battery on a populated i2c
bus without an sbs compliant charger. In that case, the battery will
unnecessarily and sometimes undesirably master the bus trying to write
info in the charger.

It is observed in many occasion that these battery "broadcasts" are even
corrupting other ongoing master to slave communication. I.e. the
multi-master support in the battery is inadequate.

Thankfully, the CHARGER_MODE bit allows designers to disable that SBS
battery behaviour.

This needs to be done once when the battery is first seen on the bus.

Signed-off-by: Jean-Francois Dagenais <jeff.dagenais@gmail.com>
[rebased code]
Signed-off-by: Sebastian Reichel <sebastian.reichel@collabora.com>
2020-05-29 00:39:34 +02:00
Sebastian Reichel
f0318bc99c power: supply: sbs-battery: fix idle battery status
A battery, that is neither charged, nor discharged is not
always Full. If the charger is disabled for other reasons
it might simply be idle and should be marked accordingly.

Signed-off-by: Sebastian Reichel <sebastian.reichel@collabora.com>
2020-05-29 00:39:34 +02:00
Sebastian Reichel
6f72a07aa6 power: supply: sbs-battery: add POWER_SUPPLY_HEALTH_CALIBRATION_REQUIRED support
Add support for reporting the SBS battery's condition flag
to userspace using the new "Calibration required" health status.

Reviewed-by: Emil Velikov <emil.velikov@collabora.com>
Signed-off-by: Sebastian Reichel <sebastian.reichel@collabora.com>
2020-05-29 00:39:32 +02:00
Sebastian Reichel
7721c2fd26 power: supply: sbs-battery: add MANUFACTURE_DATE support
Expose the battery's manufacture date to userspace.

Reviewed-by: Emil Velikov <emil.velikov@collabora.com>
Signed-off-by: Sebastian Reichel <sebastian.reichel@collabora.com>
2020-05-29 00:39:29 +02:00
Sebastian Reichel
787fdbcf5b power: supply: sbs-battery: add POWER_SUPPLY_PROP_CONSTANT_CHARGE_CURRENT/VOLTAGE_MAX support
Expose maximum charge current/voltage information requested
by the battery.

Reviewed-by: Emil Velikov <emil.velikov@collabora.com>
Signed-off-by: Sebastian Reichel <sebastian.reichel@collabora.com>
2020-05-29 00:39:25 +02:00
Sebastian Reichel
3e9544f7a3 power: supply: sbs-battery: Improve POWER_SUPPLY_PROP_TECHNOLOGY support
This reads the battery chemistry from the battery chip instead
of incorrectly hardcoding the type to be Li-Ion.

Reviewed-by: Emil Velikov <emil.velikov@collabora.com>
Signed-off-by: Sebastian Reichel <sebastian.reichel@collabora.com>
2020-05-29 00:39:22 +02:00
Sebastian Reichel
8ce6ee43bd power: supply: sbs-battery: add POWER_SUPPLY_PROP_CURRENT_AVG support
Expose averaged current information, which is part of the SBS
standard and should be supported by all batteries.

Reviewed-by: Emil Velikov <emil.velikov@collabora.com>
Signed-off-by: Sebastian Reichel <sebastian.reichel@collabora.com>
2020-05-29 00:39:19 +02:00
Sebastian Reichel
79bcd5a4a6 power: supply: sbs-battery: add PEC support
SBS batteries optionally have support for PEC. This enables
PEC handling based on the implemented SBS version as suggested
by the standard. The support for PEC is re-evaluated when the
battery is hotplugged into the system, since there might be
systems supporting batteries from different SBS generations.

Reviewed-by: Emil Velikov <emil.velikov@collabora.com>
Signed-off-by: Sebastian Reichel <sebastian.reichel@collabora.com>
2020-05-29 00:39:16 +02:00
Sebastian Reichel
c4b12a2f3f power: supply: sbs-battery: simplify read_read_string_data
The SBS battery implements SMBus block reads. Currently the
driver "emulates" this by doing an I2C byte read for the
length followed by an I2C block read. The I2C subsystem
actually provides a proper API for doing SMBus block reads,
which can and should be used instead. The current implementation
does not properly handle packet error checking (PEC).

This change requires, that I2C bus drivers support I2C_M_RECV_LEN
or directly provide the SMBus API to access device manufacturer
and model name.

Reviewed-by: Emil Velikov <emil.velikov@collabora.com>
Signed-off-by: Sebastian Reichel <sebastian.reichel@collabora.com>
2020-05-29 00:39:12 +02:00
Sebastian Reichel
d6f5632108 power: supply: sbs-battery: add POWER_SUPPLY_PROP_CAPACITY_ERROR_MARGIN support
Add support for reporting the MaxError register from
battery fuel gauges following the smart battery standard.

Reviewed-by: Emil Velikov <emil.velikov@collabora.com>
Signed-off-by: Sebastian Reichel <sebastian.reichel@collabora.com>
2020-05-29 00:38:53 +02:00
Sebastian Reichel
0ff969158a power: supply: sbs-battery: Add TI BQ20Z65 support
Add support for BQ20Z65 manufacturer data to the sbs-battery
driver. Implementation has been verified using the public TRM
available from [0] and tested using a GE Flex 3S2P battery.

[0] http://www.ti.com/lit/pdf/sluu386

Acked-by: Rob Herring <robh@kernel.org>
Signed-off-by: Sebastian Reichel <sebastian.reichel@collabora.com>
2020-05-28 19:27:38 +02:00
Sebastian Reichel
601c2a543f power: supply: core: add POWER_SUPPLY_HEALTH_CALIBRATION_REQUIRED
Some battery fuel gauges know when the battery needs to
be recalibrated before providing usable values. This
should be reported via the health property.

Signed-off-by: Sebastian Reichel <sebastian.reichel@collabora.com>
2020-05-28 19:25:31 +02:00
Sebastian Reichel
feabe49e46 power: supply: core: add manufacture date properties
Some smart batteries store their manufacture date, which is
useful to identify the battery and/or to know about the cell
quality.

Signed-off-by: Sebastian Reichel <sebastian.reichel@collabora.com>
2020-05-28 19:25:31 +02:00
Sebastian Reichel
bac705abcf power: supply: core: add capacity error margin property
Add a property for reporting the error margin expected
by fuel gauge chips.

Signed-off-by: Sebastian Reichel <sebastian.reichel@collabora.com>
2020-05-28 19:25:31 +02:00
Sebastian Reichel
655078f5f5 kobject: increase allowed number of uevent variables
SBS battery driver exposes 32 power supply properties now,
which will result in uevent failure on (un)plugging the
battery. Other drivers (e.g. bq27xxx) are also coming close
to this limit, so increase it.

Acked-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Reviewed-by: Emil Velikov <emil.velikov@collabora.com>
Signed-off-by: Sebastian Reichel <sebastian.reichel@collabora.com>
2020-05-28 19:22:04 +02:00
Samuel Zou
2e9bcaccef power: supply: Make bd9995x_chip_reset static
Fix the following sparse warning:

drivers/power/supply/bd99954-charger.c:1028:6: warning: symbol 'bd9995x_chip_reset' was not declared.

The bd9995x_chip_reset() has only one call site within bd99954-charger.c
It should be static

Fixes: 0902f83664 ("power: supply: Support ROHM bd99954 charger")
Reported-by: Hulk Robot <hulkci@huawei.com>
Signed-off-by: Samuel Zou <zou_wei@huawei.com>
Reviewed-by: Matti Vaittinen <matti.vaittinen@fi.rohmeurope.com>
Signed-off-by: Sebastian Reichel <sebastian.reichel@collabora.com>
2020-05-28 19:02:59 +02:00
Marek Szyprowski
fac1cd327b power: charger: max14577: Add proper dt-compatible strings
Add device tree compatible strings and create proper modalias structures
to let this driver load automatically if compiled as module, because
max14577 MFD driver creates MFD cells with such compatible strings.

Signed-off-by: Marek Szyprowski <m.szyprowski@samsung.com>
Signed-off-by: Sebastian Reichel <sebastian.reichel@collabora.com>
2020-05-28 09:11:55 +02:00
Sebastian Reichel
6c2fe5cae5 Immutable branch between MFD, IIO and Power due for the v5.8 merge window
-----BEGIN PGP SIGNATURE-----
 
 iQIzBAABCgAdFiEEdrbJNaO+IJqU8IdIUa+KL4f8d2EFAl7M5H4ACgkQUa+KL4f8
 d2G3zg/8CR/GxzWumuf+N01PJZQI0725lYpLzrk2LdWn01FDv/opOX3M67gs9ZMV
 bYcugrmJJ23NvLYN1/DFz2HZ4g22HqICAZ+gdc4RXlxmYaz6BjrB1pmxdB1GvqCU
 I2htnQR1L1wvhSF7fl1zyZHmRd1V1jkBxp2pdZoFpcAHXpUq4EcyizYEs9ubwT8y
 GTUcVxfPTj6fIg+/OwCDuZXkzbxcvF5QbnkykS3XhRemBEUsPkriDjJ+VSR10opx
 EV0Dd81ZXV1x2gjA5Us4OoVr0RAECd3MrRg8D1tPOYp06NqDZF2qWPXFaT3gLq0w
 A9JELXQMar+e7WzV3VokMECSIaatHugCPwJYz3nVLpDBtHr7TaFu/55ZC9Li7Lgp
 hvowpJ4Q3+BHweWfOmnVY8Ah51tZF9GS1wBTIJcXqXaUnM1bQoV77bGM6M86hHsy
 39zyrPQNOgvwUWmCXWgs1J4K0GB48s02mXuJLYkg3YhGrfU0z3G0ptG03fI7D9/U
 17OUs9f8ZqKk21DBxXYJolj2J5NwqTjX9C0wEmYdalGNgAxj4f7nSrLTrwGiNRvX
 vPdR6ccDKAZScMizbhnv4u+c/seu8XJedei0OZWP+vtZ1j4PIr7exTOhKzPHi3i/
 F1+yyBEHYAPrITQI/j+hXAjwOlwqF1sAhdYsoiqb85O1XibMmHY=
 =89mP
 -----END PGP SIGNATURE-----

Merge tag 'tags/ib-mfd-iio-power-v5.8' into psy-next

This merges the MP2629 battery charge management immutable branch
between MFD, IIO and power-supply due for the v5.8 merge window
into power-supply for-next branch.

Signed-off-by: Sebastian Reichel <sebastian.reichel@collabora.com>
2020-05-28 09:04:26 +02:00
Serge Semin
c3d8052223 power: reset: syscon-reboot: Add parental syscon support
Since normally syscon-reboot block is supposed to be a part of a system
controller, lets look for the syscon regmap in a parental DT node if
regmap property isn't specified. DT binding from now considers the regmap
property as deprecated.

Signed-off-by: Serge Semin <Sergey.Semin@baikalelectronics.ru>
Cc: Alexey Malahov <Alexey.Malahov@baikalelectronics.ru>
Cc: Thomas Bogendoerfer <tsbogend@alpha.franken.de>
Signed-off-by: Sebastian Reichel <sebastian.reichel@collabora.com>
2020-05-28 09:00:30 +02:00
Serge Semin
2140d68d69 dt-bindings: power: reset: Unrequire regmap property in syscon-reboot node
Since normally syscon-reboot block is supposed to be a part of a system
controller, lets mark the regmap property as deprecated and recommend the
syscon-reboot node to be a sub-node of SYSCON.

Signed-off-by: Serge Semin <Sergey.Semin@baikalelectronics.ru>
Reviewed-by: Rob Herring <robh@kernel.org>
Cc: Alexey Malahov <Alexey.Malahov@baikalelectronics.ru>
Cc: Thomas Bogendoerfer <tsbogend@alpha.franken.de>
Signed-off-by: Sebastian Reichel <sebastian.reichel@collabora.com>
2020-05-28 08:59:59 +02:00
Saravanan Sekar
904ac71f4b MAINTAINERS: Add entry for mp2629 Battery Charger driver
Add MAINTAINERS entry for Monolithic Power Systems mp2629 Charger driver.

Signed-off-by: Saravanan Sekar <sravanhome@gmail.com>
Reviewed-by: Andy Shevchenko <andy.shevchenko@gmail.com>
Reviewed-by: Sebastian Reichel <sebastian.reichel@collabora.com>
Signed-off-by: Lee Jones <lee.jones@linaro.org>
2020-05-26 10:42:02 +01:00
Saravanan Sekar
fe27f04e0c power: supply: mp2629: Add impedance compensation config
Allows the user to compensate the intrinsic resistance of the battery
to accelerate the charging cycle.

Signed-off-by: Saravanan Sekar <sravanhome@gmail.com>
Reviewed-by: Andy Shevchenko <andy.shevchenko@gmail.com>
Reviewed-by: Sebastian Reichel <sebastian.reichel@collabora.com>
Signed-off-by: Lee Jones <lee.jones@linaro.org>
2020-05-26 10:41:58 +01:00
Saravanan Sekar
3bc6d790c3 power: supply: Add support for mps mp2629 battery charger
The mp2629 provides switching-mode battery charge management for
single-cell Li-ion or Li-polymer battery. Driver supports the
access/control input source and battery charging parameters.

Signed-off-by: Saravanan Sekar <sravanhome@gmail.com>
Reviewed-by: Andy Shevchenko <andy.shevchenko@gmail.com>
Reviewed-by: Sebastian Reichel <sebastian.reichel@collabora.com>
Signed-off-by: Lee Jones <lee.jones@linaro.org>
2020-05-26 10:41:52 +01:00
Saravanan Sekar
7abd9fb646 iio: adc: mp2629: Add support for mp2629 ADC driver
Add support for 8-bit resolution ADC readings for input power
supply and battery charging measurement. Provides voltage, current
readings to mp2629 power supply driver.

Signed-off-by: Saravanan Sekar <sravanhome@gmail.com>
Reviewed-by: Andy Shevchenko <andy.shevchenko@gmail.com>
Reviewed-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
Signed-off-by: Lee Jones <lee.jones@linaro.org>
2020-05-26 10:41:47 +01:00
Saravanan Sekar
0608164645 mfd: mp2629: Add support for mps battery charger
mp2629 is a highly-integrated switching-mode battery charge management
device for single-cell Li-ion or Li-polymer battery.

Add MFD core enables chip access for ADC driver for battery readings,
and a power supply battery-charger driver

Signed-off-by: Saravanan Sekar <sravanhome@gmail.com>
Reviewed-by: Andy Shevchenko <andy.shevchenko@gmail.com>
Reviewed-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
Signed-off-by: Lee Jones <lee.jones@linaro.org>
2020-05-26 10:41:40 +01:00
Saravanan Sekar
25c8c452ff dt-bindings: mfd: Add document bindings for mp2629
Add device tree binding information for mp2629 mfd driver.

Signed-off-by: Saravanan Sekar <sravanhome@gmail.com>
Reviewed-by: Andy Shevchenko <andy.shevchenko@gmail.com>
Reviewed-by: Rob Herring <robh@kernel.org>
Signed-off-by: Lee Jones <lee.jones@linaro.org>
2020-05-26 10:41:28 +01:00
Dan Murphy
eda8ffcc5e dt-bindings: power: Convert bq27xxx dt to yaml
Convert the bq27xxx.txt to yaml format

CC: Pali Rohár <pali@kernel.org>
CC: Andrew F. Davis <afd@ti.com>
Signed-off-by: Dan Murphy <dmurphy@ti.com>
Reviewed-by: Rob Herring <robh@kernel.org>
Signed-off-by: Sebastian Reichel <sebastian.reichel@collabora.com>
2020-05-17 23:45:07 +02:00
Wolfram Sang
454b9c1ffd power: supply: bq24190_charger: convert to use i2c_new_client_device()
Move away from the deprecated API in this comment.

Signed-off-by: Wolfram Sang <wsa+renesas@sang-engineering.com>
Signed-off-by: Sebastian Reichel <sebastian.reichel@collabora.com>
2020-05-12 19:06:45 +02:00
Michał Mirosław
478efc79ee power: bq25890: implement INPUT_CURRENT_LIMIT property
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-10 23:44:20 +02:00
Michał Mirosław
c942656ddb power: bq25890: implement PRECHARGE_CURRENT property
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-10 23:43:50 +02:00
Michał Mirosław
b302a0ae72 power: bq25890: implement CHARGE_TYPE property
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-10 23:42:51 +02:00
Michał Mirosław
3b4df57bef power: bq25890: update state on property read
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-10 23:41:53 +02:00
Michał Mirosław
21d90eda43 power: bq25890: fix ADC mode configuration
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-10 23:06:33 +02:00
Michał Mirosław
1e4724d0b7 power: bq25890: use proper CURRENT_NOW property for I_BAT
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-10 22:55:22 +02:00
Jonathan Bakker
0383024f81 power: supply: max17040: Correct voltage reading
According to the datasheet available at (1), the bottom four
bits are always zero and the actual voltage is 1.25x this value
in mV.  Since the kernel API specifies that voltages should be in
uV, it should report 1250x the shifted value.

1) https://datasheets.maximintegrated.com/en/ds/MAX17040-MAX17041.pdf

Signed-off-by: Jonathan Bakker <xc-racer2@live.ca>
Signed-off-by: Sebastian Reichel <sebastian.reichel@collabora.com>
2020-05-10 22:00:02 +02:00
Lubomir Rintel
29e9eff40f power: supply: olpc_battery: fix the power supply name
The framework is unhappy about them, because it uses the names in sysfs
attributes:

  power_supply olpc-ac: hwmon: 'olpc-ac' is not a valid name attribute, please fix
  power_supply olpc-battery: hwmon: 'olpc-battery' is not a valid name attribute, please fix

See also commit 648cd48c9e ("hwmon: Do not accept invalid name
attributes") and commit 74d3b64197 ("hwmon: Relax name attribute
validation for new APIs").

Signed-off-by: Lubomir Rintel <lkundrak@v3.sk>
Signed-off-by: Sebastian Reichel <sebastian.reichel@collabora.com>
2020-05-10 18:56:30 +02:00
David Heidelberg
fa7cc725a3 power: supply: smb347-charger: Add delay before getting IRQSTAT
This delay-fix is picked up from downstream driver,
we measured that 25 - 35 ms delay ensure that we get required data.

Tested on SMB347 on Nexus 7 2012. Otherwise IRQSTAT_E fails to provide
correct information.

Signed-off-by: Dmitry Osipenko <digetx@gmail.com>
Signed-off-by: David Heidelberg <david@ixit.cz>
Signed-off-by: Sebastian Reichel <sebastian.reichel@collabora.com>
2020-05-10 18:23:50 +02:00
Dmitry Osipenko
c32ea07a30 power: supply: smb347-charger: IRQSTAT_D is volatile
Fix failure when USB cable is connected:
smb347 2-006a: reading IRQSTAT_D failed

Fixes: 1502cfe19b ("smb347-charger: Fix battery status reporting logic for charger faults")

Tested-by: David Heidelberg <david@ixit.cz>
Signed-off-by: Dmitry Osipenko <digetx@gmail.com>
Signed-off-by: David Heidelberg <david@ixit.cz>
Signed-off-by: Sebastian Reichel <sebastian.reichel@collabora.com>
2020-05-10 18:22:20 +02:00
Matti Vaittinen
75ffb420aa power: supply: KConfig cleanup default n
The "default n" is not needed as it is, well, default. Clean
the KConfig by removing "default n".

Signed-off-by: Matti Vaittinen <matti.vaittinen@fi.rohmeurope.com>
Reviewed-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
Signed-off-by: Sebastian Reichel <sebastian.reichel@collabora.com>
2020-05-10 02:35:49 +02:00
Matti Vaittinen
72073aa1e2 power: supply: Fix Kconfig help text indentiation
Indent the help text as explained in
Documentation/process/coding-style.rst

Signed-off-by: Matti Vaittinen <matti.vaittinen@fi.rohmeurope.com>
Signed-off-by: Sebastian Reichel <sebastian.reichel@collabora.com>
2020-05-10 02:35:49 +02:00
Matti Vaittinen
0902f83664 power: supply: Support ROHM bd99954 charger
The ROHM BD99954 is a Battery Management LSI for 1-4 cell Lithium-Ion
secondary battery intended to be used in space-constraint equipment such
as Low profile Notebook PC, Tablets and other applications. BD99954
provides a Dual-source Battery Charger, two port BC1.2 detection and a
Battery Monitor.

Support ROHM BD99954 Charger IC.

Signed-off-by: Matti Vaittinen <matti.vaittinen@fi.rohmeurope.com>
Reviewed-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
Signed-off-by: Sebastian Reichel <sebastian.reichel@collabora.com>
2020-05-10 02:35:49 +02:00
Matti Vaittinen
2a75c8a4e4 dt_bindings: ROHM BD99954 Charger
The ROHM BD99954 is a Battery Management LSI for 1-4 cell Lithium-Ion
secondary battery. Intended to be used in space-constraint equipment such
as Low profile Notebook PC, Tablets and other applications. BD99954
provides a Dual-source Battery Charger, two port BC1.2 detection and a
Battery Monitor.

Document the DT bindings for BD99954

Signed-off-by: Matti Vaittinen <matti.vaittinen@fi.rohmeurope.com>
Reviewed-by: Rob Herring <robh@kernel.org>
Signed-off-by: Sebastian Reichel <sebastian.reichel@collabora.com>
2020-05-10 02:35:49 +02:00
Matti Vaittinen
5a63b7ba50 power: supply: add battery parameters
Add parsing of new device-tree battery bindings.

     - trickle-charge-current-microamp
     - precharge-upper-limit-microvolt
     - re-charge-voltage-microvolt
     - over-voltage-threshold-microvolt

Signed-off-by: Matti Vaittinen <matti.vaittinen@fi.rohmeurope.com>
Signed-off-by: Sebastian Reichel <sebastian.reichel@collabora.com>
2020-05-10 02:35:49 +02:00
Matti Vaittinen
e3420b4994 dt-bindings: battery: add new battery parameters
Add:

 - trickle-charge-current-microamp:

Some chargers have 3 charging stages. First one when battery is almost
empty is often called as trickle-charge. Last state when battery has been
"woken up" is usually called as fast-charge. In addition to this some
chargers have a 'middle state' which ROHM BD99954 data-sheet describes as
pre-charge. Some batteries can benefit from this 3-phase charging
[citation needed].

Introduce trickle-charge-current-microamp so that batteries can give
charging current limit for all three states.

 - precharge-upper-limit-microvolt:

When battery voltage has reached certain limit we change from
trickle-charge to next charging state (pre-charge for BD99954). Allow
battery to specify this limit.

 - re-charge-voltage-microvolt:

Allow giving a battery specific voltage limit for chargers which can
automatically re-start charging when battery has discharghed down to
this limit.

- over-voltage-threshold-microvolt

Allow specifying voltage threshold after which the battery is assumed to
be faulty.

Signed-off-by: Matti Vaittinen <matti.vaittinen@fi.rohmeurope.com>
Reviewed-by: Rob Herring <robh@kernel.org>
Signed-off-by: Sebastian Reichel <sebastian.reichel@collabora.com>
2020-05-10 02:35:49 +02:00