The AXP813 PMIC is relatively close to the already supported AXP20X and
AXP22X. It provides three different power outputs: battery, AC and USB, and
measures a few different things: temperature, power supply status, current
current and voltage supplied, maximum current limit, battery capacity, min
and max voltage limits.
One of its two GPIOs can be used as an ADC.
There are a few differences with AXP20X/AXP22X PMICs though:
- a different constant charge current formula,
- battery temperature, GPIO0 and battery voltages are the only voltages
measurable,
- all data are stored on 12 bits (AXP20X/AXP22X had one type of data that
was stored on 13 bits),
- different scales and offsets,
- a different ADC rate formula and register,
This patch series adds support for the PMIC's ADC and battery power supply
in the existing drivers.
Make the axp20x MFD automatically probe the ADC driver, add the battery
power supply node in axp81x node and enable it for the TBS A711 since it
has a soldered battery.
I suggest patches:
- 1,2,6 go through Lee's tree,
- 3,4,5 go through Sebastian's tree,
v5:
- added static in front of the axp_data struct in the battery driver to
make sparse happy,
- removed merged patches,
v4:
- shortened one commit title as a workaround to Chen-Yu note,
- added const to data structures as proposed by Chen-Yu,
- added last patch for making sparse happy, on a proposal from Jonathan,
- removed already applied patches (IIO ones),
v3:
- merging dt-bindings patches for axp_adc as requested by Rob,
- re-ordered constant in IIO driver as requested by Julian,
- compatibles for ADC are now named after the first design that
introduced the IP instead of wildcard as requested by Maxime,
- renamed DT node name from axp-adc to adc as requested by Rob,
- replaced enumeration of supported PMICs in battery power supply DT
bindings documentation by "supported devices" as requested by Jonathan,
- added a new patch for removing "axp-" from axp81x's pinctrl DT node,
v2:
- introduce data structure instead of ID for variant specific code in
battery driver,
- add DT binding for ADC driver,
- make mfd probe the ADC driver via DT as well so that its IIO channels
can be consumed by other drivers via DT mapping,
Thanks,
Quentin
Quentin Schulz (6):
mfd: axp20x: make AXP209/22x cells probe their ADC via DT
mfd: axp20x: probe axp20x_adc driver for AXP813
power: supply: axp20x_battery: use data struct for variant specific code
dt-bindings: power: supply: axp20x: add AXP813 battery DT binding
power: supply: axp20x_battery: add support for AXP813
mfd: axp20x: add battery power supply cell for AXP813
Documentation/devicetree/bindings/power/supply/axp20x_battery.txt | 8 ++--
drivers/mfd/axp20x.c | 13 +++++--
drivers/power/supply/axp20x_battery.c | 134 +++++++++++++++++++++++++++++++++++++++++++++++++++++++-----------------
3 files changed, 119 insertions(+), 36 deletions(-)
base-commit: 827ad482fda17d0de5df5116fda827cd3671e62e
--
git-series 0.9.1
This makes AXP209 and AXP22x ADCs probe first via DT and then by
fallback via platform.
Signed-off-by: Quentin Schulz <redacted>
Acked-for-MFD-by: Lee Jones [off-list ref]
Acked-by: Chen-Yu Tsai <redacted>
---
drivers/mfd/axp20x.c | 5 ++++-
1 file changed, 4 insertions(+), 1 deletion(-)
From: Lee Jones <hidden> Date: 2018-03-07 16:12:04
On Wed, 28 Feb 2018, Quentin Schulz wrote:
This makes AXP209 and AXP22x ADCs probe first via DT and then by
fallback via platform.
Signed-off-by: Quentin Schulz <redacted>
Acked-for-MFD-by: Lee Jones [off-list ref]
Acked-by: Chen-Yu Tsai <redacted>
---
drivers/mfd/axp20x.c | 5 ++++-
1 file changed, 4 insertions(+), 1 deletion(-)
Applied, thanks.
--
Lee Jones
Linaro Services Technical Lead
Linaro.org │ Open source software for ARM SoCs
Follow Linaro: Facebook | Twitter | Blog
--
You received this message because you are subscribed to the Google Groups "linux-sunxi" group.
To unsubscribe from this group and stop receiving emails from it, send an email to linux-sunxi+unsubscribe-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org
For more options, visit https://groups.google.com/d/optout.
From: Lee Jones <hidden> Date: 2018-03-07 16:12:32
On Wed, 28 Feb 2018, Quentin Schulz wrote:
This makes the axp20x_adc driver probe with platform device id
"axp813-adc".
Signed-off-by: Quentin Schulz <redacted>
Acked-for-MFD-by: Lee Jones [off-list ref]
Acked-by: Chen-Yu Tsai <redacted>
---
drivers/mfd/axp20x.c | 5 ++++-
1 file changed, 4 insertions(+), 1 deletion(-)
Applied, thanks.
--
Lee Jones
Linaro Services Technical Lead
Linaro.org │ Open source software for ARM SoCs
Follow Linaro: Facebook | Twitter | Blog
--
You received this message because you are subscribed to the Google Groups "linux-sunxi" group.
To unsubscribe from this group and stop receiving emails from it, send an email to linux-sunxi+unsubscribe-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org
For more options, visit https://groups.google.com/d/optout.
As axp20x-battery-power-supply now supports AXP813, add a cell for it.
Signed-off-by: Quentin Schulz <redacted>
Acked-for-MFD-by: Lee Jones [off-list ref]
Reviewed-by: Chen-Yu Tsai <redacted>
---
drivers/mfd/axp20x.c | 3 +++
1 file changed, 3 insertions(+)
From: Lee Jones <hidden> Date: 2018-03-07 16:12:46
On Wed, 28 Feb 2018, Quentin Schulz wrote:
As axp20x-battery-power-supply now supports AXP813, add a cell for it.
Signed-off-by: Quentin Schulz <redacted>
Acked-for-MFD-by: Lee Jones [off-list ref]
Reviewed-by: Chen-Yu Tsai <redacted>
---
drivers/mfd/axp20x.c | 3 +++
1 file changed, 3 insertions(+)
Applied, thanks.
--
Lee Jones
Linaro Services Technical Lead
Linaro.org │ Open source software for ARM SoCs
Follow Linaro: Facebook | Twitter | Blog
--
You received this message because you are subscribed to the Google Groups "linux-sunxi" group.
To unsubscribe from this group and stop receiving emails from it, send an email to linux-sunxi+unsubscribe-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org
For more options, visit https://groups.google.com/d/optout.
The X-Powers AXP813 PMIC has got some slight differences from
AXP20X/AXP22X PMICs:
- the maximum voltage supplied by the PMIC is 4.35 instead of 4.36/4.24
for AXP20X/AXP22X,
- the constant charge current formula is different,
It also has a bit to tell whether the battery percentage returned by the
PMIC is valid.
Signed-off-by: Quentin Schulz <redacted>
Reviewed-by: Chen-Yu Tsai <redacted>
---
drivers/power/supply/axp20x_battery.c | 42 ++++++++++++++++++++++++++++-
1 file changed, 42 insertions(+)
From: Sebastian Reichel <sre@kernel.org> Date: 2018-03-09 16:09:47
Hi,
On Wed, Feb 28, 2018 at 11:36:00AM +0100, Quentin Schulz wrote:
The X-Powers AXP813 PMIC has got some slight differences from
AXP20X/AXP22X PMICs:
- the maximum voltage supplied by the PMIC is 4.35 instead of 4.36/4.24
for AXP20X/AXP22X,
- the constant charge current formula is different,
It also has a bit to tell whether the battery percentage returned by the
PMIC is valid.
Signed-off-by: Quentin Schulz <redacted>
Reviewed-by: Chen-Yu Tsai <redacted>
---
The AXP813 can have a battery as power supply, so let's add it to the
list of compatibles.
Signed-off-by: Quentin Schulz <redacted>
Reviewed-by: Rob Herring <redacted>
Acked-by: Chen-Yu Tsai <redacted>
---
Documentation/devicetree/bindings/power/supply/axp20x_battery.txt | 8 +++----
1 file changed, 4 insertions(+), 4 deletions(-)
@@ -4,12 +4,12 @@ Required Properties: - compatible, one of: "x-powers,axp209-battery-power-supply" "x-powers,axp221-battery-power-supply"+ "x-powers,axp813-battery-power-supply"-This node is a subnode of the axp20x/axp22x PMIC.+This node is a subnode of its respective PMIC DT node.-The AXP20X and AXP22X can read the battery voltage, charge and discharge-currents of the battery by reading ADC channels from the AXP20X/AXP22X-ADC.+The supported devices can read the battery voltage, charge and discharge+currents of the battery by reading ADC channels from the ADC. Example:
From: Sebastian Reichel <sre@kernel.org> Date: 2018-03-09 16:08:55
Hi,
On Wed, Feb 28, 2018 at 11:35:59AM +0100, Quentin Schulz wrote:
The AXP813 can have a battery as power supply, so let's add it to the
list of compatibles.
Signed-off-by: Quentin Schulz <redacted>
Reviewed-by: Rob Herring <robh@kernel.org>
Acked-by: Chen-Yu Tsai <redacted>
---
@@ -4,12 +4,12 @@ Required Properties: - compatible, one of: "x-powers,axp209-battery-power-supply" "x-powers,axp221-battery-power-supply"+ "x-powers,axp813-battery-power-supply"-This node is a subnode of the axp20x/axp22x PMIC.+This node is a subnode of its respective PMIC DT node.-The AXP20X and AXP22X can read the battery voltage, charge and discharge-currents of the battery by reading ADC channels from the AXP20X/AXP22X-ADC.+The supported devices can read the battery voltage, charge and discharge+currents of the battery by reading ADC channels from the ADC. Example:
We used to use IDs to select a function or a feature depending on the
variant. It's easier to maintain the code by adding data structure
storing the few differences between variants so that we don't add a pile
of if conditions.
Let's use this data structure and update the code to use it.
Signed-off-by: Quentin Schulz <redacted>
Reviewed-by: Chen-Yu Tsai <redacted>
---
drivers/power/supply/axp20x_battery.c | 100 +++++++++++++++++----------
1 file changed, 66 insertions(+), 34 deletions(-)
From: Sebastian Reichel <sre@kernel.org> Date: 2018-03-09 16:08:30
Hi Quentin,
On Wed, Feb 28, 2018 at 11:35:58AM +0100, Quentin Schulz wrote:
We used to use IDs to select a function or a feature depending on the
variant. It's easier to maintain the code by adding data structure
storing the few differences between variants so that we don't add a pile
of if conditions.
Let's use this data structure and update the code to use it.
Signed-off-by: Quentin Schulz <redacted>
Reviewed-by: Chen-Yu Tsai <redacted>
---
Hi Sebastian,
On Fri, Mar 09, 2018 at 05:08:25PM +0100, Sebastian Reichel wrote:
Hi Quentin,
On Wed, Feb 28, 2018 at 11:35:58AM +0100, Quentin Schulz wrote:
quoted
We used to use IDs to select a function or a feature depending on the
variant. It's easier to maintain the code by adding data structure
storing the few differences between variants so that we don't add a pile
of if conditions.
Let's use this data structure and update the code to use it.
Signed-off-by: Quentin Schulz <redacted>
Reviewed-by: Chen-Yu Tsai <redacted>
---