Add cpcap battery driver
Subsystems (2)
v3 cover Add cpcap battery driver
Hi all,
Here's v3 cpcap pmic battery driver.
Regards,
Tony
Changes since v2:
- Fix binding doc as noted by Rob Herring
- Separate the binding doc into a separate patch
Changes since v1: - Add support for battery low interrupts - Fix POWER_SUPPLY_STATUS during charging to not flip constantly by using average current
Tony Lindgren (2):
dt-bindings: cpcap-battery: Add binding
power: supply: cpcap-battery: Add a battery driver
.../bindings/power/supply/cpcap-battery.txt | 27 + drivers/power/supply/Kconfig | 8 + drivers/power/supply/Makefile | 1 + drivers/power/supply/cpcap-battery.c | 808 +++++++++++++++++++++ 4 files changed, 844 insertions(+) create mode 100644 Documentation/devicetree/bindings/power/supply/cpcap-battery.txt create mode 100644 drivers/power/supply/cpcap-battery.c
Signature · 1 line
2.13.0
PATCH v3 1/2 dt-bindings: cpcap-battery: Add binding
--- .../bindings/power/supply/cpcap-battery.txt | 27 ++++++++++++++++++++++ 1 file changed, 27 insertions(+) create mode 100644 Documentation/devicetree/bindings/power/supply/cpcap-battery.txt
Documentation/devicetree/bindings/power/supply/cpcap-battery.txt new file +27 -0
@@ -0,0 +1,27 @@ +Motorola CPCAP PMIC battery driver binding + +Required properties: +- compatible: Shall be "motorola,cpcap-battery" +- interrupts: Interrupt specifier for each name in interrupt-names +- interrupt-names: Should contain the following entries: + "lowbph", "lowbpl", "chrgcurr1", "battdetb" +- io-channels: IIO ADC channel specifier for each name in io-channel-names +- io-channel-names: Should contain the following entries: + "battdetb", "battp", "chg_isense", "batti" + +Example: + +cpcap_battery: battery { + compatible = "motorola,cpcap-battery"; + interrupts-extended = < + &cpcap 5 0 &cpcap 3 0 + &cpcap 20 0 &cpcap 54 0 + >; + interrupt-names = + "lowbph", "lowbpl", + "chrgcurr1", "battdetb"; + io-channels = <&cpcap_adc 0 &cpcap_adc 1 + &cpcap_adc 5 &cpcap_adc 6>; + io-channel-names = "battdetb", "battp", + "chg_isense", "batti"; +};
Signature · 1 line
2.13.0
PATCH 2/2 power: supply: cpcap-battery: Add a battery driver
In reply to a message not in the archiveOn the CPCAP PMIC we can use the ADCs for monitoring the battery, and there is also a coulomb counter. So let's add basic support for the battery driver.
I did not add any capacity prediction as that should probably be done in the user space. Or at least user space should tell the kernel some battery statistics and then the kernel driver could display the capacity based on that.
--- drivers/power/supply/Kconfig | 8 + drivers/power/supply/Makefile | 1 + drivers/power/supply/cpcap-battery.c | 808 +++++++++++++++++++++++++++++++++++ 3 files changed, 817 insertions(+) create mode 100644 drivers/power/supply/cpcap-battery.c
drivers/power/supply/Kconfig +8 -0
@@ -82,6 +82,14 @@ config BATTERY_ACT8945A Say Y here to enable support for power supply provided by Active-semi ActivePath ACT8945A charger. +config BATTERY_CPCAP + tristate "Motorola CPCAP PMIC battery driver" + depends on MFD_CPCAP && IIO + default MFD_CPCAP + help + Say Y here to enable support for battery on Motorola + phones and tablets such as droid 4. + config BATTERY_DS2760 tristate "DS2760 battery driver (HP iPAQ & others)" depends on W1 && W1_SLAVE_DS2760
drivers/power/supply/Makefile +1 -0
@@ -20,6 +20,7 @@ obj-$(CONFIG_BATTERY_88PM860X) += 88pm860x_battery.o obj-$(CONFIG_BATTERY_ACT8945A) += act8945a_charger.o obj-$(CONFIG_BATTERY_AXP20X) += axp20x_battery.o obj-$(CONFIG_CHARGER_AXP20X) += axp20x_ac_power.o +obj-$(CONFIG_BATTERY_CPCAP) += cpcap-battery.o obj-$(CONFIG_BATTERY_DS2760) += ds2760_battery.o obj-$(CONFIG_BATTERY_DS2780) += ds2780_battery.o obj-$(CONFIG_BATTERY_DS2781) += ds2781_battery.o
drivers/power/supply/cpcap-battery.c new file +808 -0
808 lines not on this page · raw message
Signature · 5 lines
2.13.0 -- To unsubscribe from this list: send the line "unsubscribe devicetree" in the body of a message to [email protected] More majordomo info at http://vger.kernel.org/majordomo-info.html
Re: [PATCH 1/2] dt-bindings: cpcap-battery: Add binding
In reply to a message not in the archive* Tony Lindgren <[email protected]> [170531 17:23]:
Oh sorry, now I managed to leave out the description.. Updated binding patch below.
Regards,
Tony
8< ---------------
Quoted 1 line
From tony Mon Sep 17 00:00:00 2001
From: Tony Lindgren <[email protected]>
Date: Wed, 31 May 2017 17:10:13 -0700
Subject: [PATCH] dt-bindings: cpcap-battery: Add binding
Add binding for cpcap pmic battery.
--- .../bindings/power/supply/cpcap-battery.txt | 27 ++++++++++++++++++++++ 1 file changed, 27 insertions(+) create mode 100644 Documentation/devicetree/bindings/power/supply/cpcap-battery.txt
Documentation/devicetree/bindings/power/supply/cpcap-battery.txt new file +27 -0
@@ -0,0 +1,27 @@ +Motorola CPCAP PMIC battery driver binding + +Required properties: +- compatible: Shall be "motorola,cpcap-battery" +- interrupts: Interrupt specifier for each name in interrupt-names +- interrupt-names: Should contain the following entries: + "lowbph", "lowbpl", "chrgcurr1", "battdetb" +- io-channels: IIO ADC channel specifier for each name in io-channel-names +- io-channel-names: Should contain the following entries: + "battdetb", "battp", "chg_isense", "batti" + +Example: + +cpcap_battery: battery { + compatible = "motorola,cpcap-battery"; + interrupts-extended = < + &cpcap 5 0 &cpcap 3 0 + &cpcap 20 0 &cpcap 54 0 + >; + interrupt-names = + "lowbph", "lowbpl", + "chrgcurr1", "battdetb"; + io-channels = <&cpcap_adc 0 &cpcap_adc 1 + &cpcap_adc 5 &cpcap_adc 6>; + io-channel-names = "battdetb", "battp", + "chg_isense", "batti"; +};
Signature · 5 lines
2.13.0 -- To unsubscribe from this list: send the line "unsubscribe devicetree" in the body of a message to [email protected] More majordomo info at http://vger.kernel.org/majordomo-info.html
Rob Herring
Acked-byRe: [PATCH 1/2] dt-bindings: cpcap-battery: Add binding
In reply to a message not in the archiveQuoted 22 lines · Tony Lindgren
* Tony Lindgren <[email protected]> [170531 17:23]:
Oh sorry, now I managed to leave out the description.. Updated binding patch below.
Regards,
Tony
8< ---------------
From tony Mon Sep 17 00:00:00 2001
From: Tony Lindgren <[email protected]>
Date: Wed, 31 May 2017 17:10:13 -0700
Subject: [PATCH] dt-bindings: cpcap-battery: Add bindingAdd binding for cpcap pmic battery.
Cc Marcel Partap <[email protected]>Cc Michael Scott <[email protected]>Cc Rob Herring <[email protected]>Signed-off-by Tony Lindgren <[email protected]>
Quoted 4 lines
--- .../bindings/power/supply/cpcap-battery.txt | 27 ++++++++++++++++++++++ 1 file changed, 27 insertions(+) create mode 100644 Documentation/devicetree/bindings/power/supply/cpcap-battery.txt
--
To unsubscribe from this list: send the line "unsubscribe devicetree" in the body of a message to [email protected] More majordomo info at http://vger.kernel.org/majordomo-info.html
Hi,
Quoted 1 line · Tony Lindgren
Here's v3 cpcap pmic battery driver.
Thanks, queued. If you send *.dts patch for Droid 4, don't forget to add power-supplies property as described in
Documentation/devicetree/bindings/power/supply/power_supply.txt
-- Sebastian
Quoted 23 lines
Changes since v2:
- Fix binding doc as noted by Rob Herring
- Separate the binding doc into a separate patchChanges since v1:
- Add support for battery low interrupts
- FixPOWER_SUPPLY_STATUSduring charging to not flip constantly by using average currentTony Lindgren (2):
dt-bindings: cpcap-battery: Add binding
power: supply: cpcap-battery: Add a battery driver.../bindings/power/supply/cpcap-battery.txt | 27 + drivers/power/supply/Kconfig | 8 + drivers/power/supply/Makefile | 1 + drivers/power/supply/cpcap-battery.c | 808 +++++++++++++++++++++ 4 files changed, 844 insertions(+) create mode 100644 Documentation/devicetree/bindings/power/supply/cpcap-battery.txt create mode 100644 drivers/power/supply/cpcap-battery.cSignature · 1 line
2.13.0