Add battery charger driver support for MP2629
Subsystems (5)
Saravanan Sekar
maintainerv11 cover Add battery charger driver support for MP2629
changes in v11:
- module_remove part replaced by devm_add_action_or_reset in charger patch
- minor review comments solved in mfd and adc patch
changes in v10:
- fixed typo, \n in dev_err
- dt bindings Warning (unit_address_vs_reg) reported by bot
changes in v9:
- fixed review comments in mp2629 power supply such as resource based iio channel, replace workqueue by threaded irq, irq get with "_optional"
changes in v8:
- fixed order of call in probe/remove in iio adc
- add ABI documentation for mp2629 power supply
changes in v7:
- fixed probe/remove order, managed and unmanaged call mix use in adc.
- Documentation dual license, i2c node with controller address
Overall looks good to me, FWIW,
One question though in reply to patch 4.
changes in v6:
- removed includes types.h in mfd, of_device.h in adc.
- fixed review comments parentheses, err check, kstrtouint
changes in v5:
- removed platfrom data stored in mfd and directly accessed mfd struct in child
- fixed spell check and capitalization in mfd and documentation
changes in v4:
- fixed capitalization in mfg Kconfig and documentation
changes in v3:
- regmap for children passed using platform data and remove mfd driver info access directly from children
changes in v2:
- removed EXPORT_SYMBOL of register set/get helper
- regmap bit filed used, fixed other review comments
This patch series add support for Battery charger control driver for Monolithic Power System's MP2629 chipset, includes MFD driver for ADC battery & input power supply measurement and battery charger control driver.
Thanks,
Saravanan
Saravanan Sekar (6):
dt-bindings: mfd: add document bindings for mp2629
mfd: mp2629: Add support for mps battery charger
iio: adc: mp2629: Add support for mp2629 ADC driver
power: supply: Add support for mps mp2629 battery charger
power: supply: mp2629: Add impedance compensation config
MAINTAINERS: Add entry for mp2629 Battery Charger driver
.../ABI/testing/sysfs-class-power-mp2629 | 8 + .../devicetree/bindings/mfd/mps,mp2629.yaml | 62 ++ MAINTAINERS | 5 + drivers/iio/adc/Kconfig | 10 + drivers/iio/adc/Makefile | 1 + drivers/iio/adc/mp2629_adc.c | 208 ++++++ drivers/mfd/Kconfig | 9 + drivers/mfd/Makefile | 2 + drivers/mfd/mp2629.c | 79 +++ drivers/power/supply/Kconfig | 10 + drivers/power/supply/Makefile | 1 + drivers/power/supply/mp2629_charger.c | 669 ++++++++++++++++++ include/linux/mfd/mp2629.h | 26 + 13 files changed, 1090 insertions(+) create mode 100644 Documentation/ABI/testing/sysfs-class-power-mp2629 create mode 100644 Documentation/devicetree/bindings/mfd/mps,mp2629.yaml create mode 100644 drivers/iio/adc/mp2629_adc.c create mode 100644 drivers/mfd/mp2629.c create mode 100644 drivers/power/supply/mp2629_charger.c create mode 100644 include/linux/mfd/mp2629.h
Signature · 1 line
2.17.1
Saravanan Sekar
maintainerPATCH v11 1/6 dt-bindings: mfd: add document bindings for mp2629
Add device tree binding information for mp2629 mfd driver.
--- .../devicetree/bindings/mfd/mps,mp2629.yaml | 62 +++++++++++++++++++ 1 file changed, 62 insertions(+) create mode 100644 Documentation/devicetree/bindings/mfd/mps,mp2629.yaml
Documentation/devicetree/bindings/mfd/mps,mp2629.yaml new file +62 -0
@@ -0,0 +1,62 @@ +# SPDX-License-Identifier: GPL-2.0-only OR BSD-2-Clause +%YAML 1.2 +--- +$id: http://devicetree.org/schemas/mfd/mps,mp2629.yaml# +$schema: http://devicetree.org/meta-schemas/core.yaml# + +title: MP2629 Battery Charger PMIC from Monolithic Power System. + +maintainers: + - Saravanan Sekar <[email protected]> + +description: | + MP2629 is a PMIC providing battery charging and power supply for smartphones, + wireless camera and portable devices. Chip is controlled over I2C. + + The battery charge management device handles battery charger controller and + ADC IIO device for battery, system voltage + +properties: + compatible: + const: mps,mp2629 + + reg: + maxItems: 1 + + interrupts: + maxItems: 1 + + interrupt-controller: true + + "#interrupt-cells": + const: 2 + description: + The first cell is the IRQ number, the second cell is the trigger type. + +required: + - compatible + - reg + - interrupts + - interrupt-controller + - "#interrupt-cells" + +additionalProperties: false + +examples: + - | + #include <dt-bindings/interrupt-controller/irq.h> + #include <dt-bindings/input/linux-event-codes.h> + i2c { + #address-cells = <1>; + #size-cells = <0>; + + pmic@4b { + compatible = "mps,mp2629"; + reg = <0x4b>; + + interrupt-controller; + interrupt-parent = <&gpio2>; + #interrupt-cells = <2>; + interrupts = <3 IRQ_TYPE_LEVEL_HIGH>; + }; + };
Signature · 1 line
2.17.1
Re: [PATCH v11 1/6] dt-bindings: mfd: add document bindings for mp2629
Quoted 9 lines · Saravanan Sekar
Add device tree binding information for mp2629 mfd driver.
Signed-off-by Saravanan Sekar <[email protected]>Reviewed-by Andy Shevchenko <[email protected]>--- .../devicetree/bindings/mfd/mps,mp2629.yaml | 62 +++++++++++++++++++ 1 file changed, 62 insertions(+) create mode 100644 Documentation/devicetree/bindings/mfd/mps,mp2629.yaml
Saravanan Sekar
maintainerPATCH v11 2/6 mfd: mp2629: Add support for mps battery charger
In reply to Saravanan Sekarmp2629 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
--- drivers/mfd/Kconfig | 9 +++++ drivers/mfd/Makefile | 2 + drivers/mfd/mp2629.c | 79 ++++++++++++++++++++++++++++++++++++++ include/linux/mfd/mp2629.h | 17 ++++++++ 4 files changed, 107 insertions(+) create mode 100644 drivers/mfd/mp2629.c create mode 100644 include/linux/mfd/mp2629.h
drivers/mfd/Kconfig +9 -0
@@ -434,6 +434,15 @@ config MFD_MC13XXX_I2C help Select this if your MC13xxx is connected via an I2C bus. +config MFD_MP2629 + tristate "Monolithic Power Systems MP2629 ADC and Battery charger" + depends on I2C + select REGMAP_I2C + help + Select this option to enable support for Monolithic Power Systems + battery charger. This provides ADC, thermal and battery charger power + management functions. + config MFD_MXS_LRADC tristate "Freescale i.MX23/i.MX28 LRADC" depends on ARCH_MXS || COMPILE_TEST
drivers/mfd/Makefile +2 -0
@@ -170,6 +170,8 @@ obj-$(CONFIG_MFD_MAX8925) += max8925.o obj-$(CONFIG_MFD_MAX8997) += max8997.o max8997-irq.o obj-$(CONFIG_MFD_MAX8998) += max8998.o max8998-irq.o +obj-$(CONFIG_MFD_MP2629) += mp2629.o + pcf50633-objs := pcf50633-core.o pcf50633-irq.o obj-$(CONFIG_MFD_PCF50633) += pcf50633.o obj-$(CONFIG_PCF50633_ADC) += pcf50633-adc.o
drivers/mfd/mp2629.c new file +79 -0
79 lines not on this page · raw message
include/linux/mfd/mp2629.h new file +17 -0
@@ -0,0 +1,17 @@ +/* SPDX-License-Identifier: GPL-2.0+ */ +/* +* Copyright 2020 Monolithic Power Systems, Inc +*/ + +#ifndef __MP2629_H__ +#define __MP2629_H__ + +#include <linux/device.h> +#include <linux/regmap.h> + +struct mp2629_data { +struct device *dev; +struct regmap *regmap; +}; + +#endif
Signature · 1 line
2.17.1
Re: [PATCH v11 2/6] mfd: mp2629: Add support for mps battery charger
Quoted 9 lines · Saravanan Sekar
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 <[email protected]>Reviewed-by Andy Shevchenko <[email protected]>Reviewed-by Jonathan Cameron <[email protected]>
Quoted 8 lines
--- drivers/mfd/Kconfig | 9 +++++ drivers/mfd/Makefile | 2 + drivers/mfd/mp2629.c | 79 ++++++++++++++++++++++++++++++++++++++ include/linux/mfd/mp2629.h | 17 ++++++++ 4 files changed, 107 insertions(+) create mode 100644 drivers/mfd/mp2629.c create mode 100644 include/linux/mfd/mp2629.h
For my own reference (apply this as-is to your sign-off block):
Signature · 4 lines
Lee Jones [李琼斯] Linaro Services Technical Lead Linaro.org │ Open source software for ARM SoCs Follow Linaro: Facebook | Twitter | Blog
saravanan sekar
maintainerRe: [PATCH v11 2/6] mfd: mp2629: Add support for mps battery charger
Hi Lee,
Quoted 19 lines · Lee Jones
Quoted 9 lines · Saravanan Sekar
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 <[email protected]>Reviewed-by Andy Shevchenko <[email protected]>Reviewed-by Jonathan Cameron <[email protected]>Quoted 8 lines
--- drivers/mfd/Kconfig | 9 +++++ drivers/mfd/Makefile | 2 + drivers/mfd/mp2629.c | 79 ++++++++++++++++++++++++++++++++++++++ include/linux/mfd/mp2629.h | 17 ++++++++ 4 files changed, 107 insertions(+)create mode 100644
drivers/mfd/mp2629.c
create mode 100644include/linux/mfd/mp2629.h
Quoted 4 lines
For my own reference (apply this as-is to your sign-off block):
Acked-for-MFD-by Lee Jones <[email protected]>
Do I have to resend with above sign-off in all the patch?
Thanks,
Saravanan
Re: [PATCH v11 2/6] mfd: mp2629: Add support for mps battery charger
Quoted 22 lines · saravanan sekar
Hi Lee,
Quoted 19 lines · Lee Jones
Quoted 17 lines · Saravanan Sekar
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 <[email protected]>Reviewed-by Andy Shevchenko <[email protected]>Reviewed-by Jonathan Cameron <[email protected]>--- drivers/mfd/Kconfig | 9 +++++ drivers/mfd/Makefile | 2 + drivers/mfd/mp2629.c | 79 ++++++++++++++++++++++++++++++++++++++ include/linux/mfd/mp2629.h | 17 ++++++++ 4 files changed, 107 insertions(+)create mode 100644
drivers/mfd/mp2629.c
create mode 100644include/linux/mfd/mp2629.h
Quoted 5 lines
Quoted 4 lines
For my own reference (apply this as-is to your sign-off block):
Acked-for-MFD-by Lee Jones <[email protected]>Do I have to resend with above sign-off in all the patch?
That would make things simpler, yes.
Signature · 4 lines
Lee Jones [李琼斯] Linaro Services Technical Lead Linaro.org │ Open source software for ARM SoCs Follow Linaro: Facebook | Twitter | Blog
Saravanan Sekar
maintainerPATCH v11 3/6 iio: adc: mp2629: Add support for mp2629 ADC driver
In reply to Saravanan SekarAdd support for 8-bit resolution ADC readings for input power supply and battery charging measurement. Provides voltage, current readings to mp2629 power supply driver.
--- drivers/iio/adc/Kconfig | 10 ++ drivers/iio/adc/Makefile | 1 + drivers/iio/adc/mp2629_adc.c | 208 +++++++++++++++++++++++++++++++++++ include/linux/mfd/mp2629.h | 9 ++ 4 files changed, 228 insertions(+) create mode 100644 drivers/iio/adc/mp2629_adc.c
drivers/iio/adc/Kconfig +10 -0
@@ -680,6 +680,16 @@ config MESON_SARADC To compile this driver as a module, choose M here: the module will be called meson_saradc. +config MP2629_ADC + tristate "Monolithic MP2629 ADC driver" + depends on MFD_MP2629 + help + Say yes to have support for battery charger IC MP2629 ADC device + accessed over I2C. + + This driver provides ADC conversion of system, input power supply + and battery voltage & current information. + config NAU7802 tristate "Nuvoton NAU7802 ADC driver" depends on I2C
drivers/iio/adc/Makefile +1 -0
@@ -64,6 +64,7 @@ obj-$(CONFIG_MCP3911) += mcp3911.o obj-$(CONFIG_MEDIATEK_MT6577_AUXADC) += mt6577_auxadc.o obj-$(CONFIG_MEN_Z188_ADC) += men_z188_adc.o obj-$(CONFIG_MESON_SARADC) += meson_saradc.o +obj-$(CONFIG_MP2629_ADC) += mp2629_adc.o obj-$(CONFIG_MXS_LRADC_ADC) += mxs-lradc-adc.o obj-$(CONFIG_NAU7802) += nau7802.o obj-$(CONFIG_NPCM_ADC) += npcm_adc.o
drivers/iio/adc/mp2629_adc.c new file +208 -0
208 lines not on this page · raw message
include/linux/mfd/mp2629.h +9 -0
@@ -14,4 +14,13 @@ struct mp2629_data { struct regmap *regmap; }; +enum mp2629_adc_chan { +MP2629_BATT_VOLT , +MP2629_SYSTEM_VOLT , +MP2629_INPUT_VOLT , +MP2629_BATT_CURRENT , +MP2629_INPUT_CURRENT , +MP2629_ADC_CHAN_END +}; +#endif
Signature · 1 line
2.17.1
Saravanan Sekar
maintainerPATCH v11 4/6 power: supply: Add support for mps mp2629 battery charger
In reply to Saravanan SekarThe 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.
--- drivers/power/supply/Kconfig | 10 + drivers/power/supply/Makefile | 1 + drivers/power/supply/mp2629_charger.c | 669 ++++++++++++++++++++++++++ 3 files changed, 680 insertions(+) create mode 100644 drivers/power/supply/mp2629_charger.c
drivers/power/supply/Kconfig +10 -0
@@ -541,6 +541,16 @@ config CHARGER_MAX8998 Say Y to enable support for the battery charger control sysfs and platform data of MAX8998/LP3974 PMICs. +config CHARGER_MP2629 + tristate "Monolithic power system MP2629 Battery charger" + depends on MFD_MP2629 + depends on MP2629_ADC + depends on IIO + help + Select this option to enable support for Monolithic power system + Battery charger. This driver provides Battery charger power management + functions on the systems. + config CHARGER_QCOM_SMBB tristate "Qualcomm Switch-Mode Battery Charger and Boost" depends on MFD_SPMI_PMIC || COMPILE_TEST
drivers/power/supply/Makefile +1 -0
@@ -75,6 +75,7 @@ obj-$(CONFIG_CHARGER_MAX77650) += max77650-charger.o obj-$(CONFIG_CHARGER_MAX77693) += max77693_charger.o obj-$(CONFIG_CHARGER_MAX8997) += max8997_charger.o obj-$(CONFIG_CHARGER_MAX8998) += max8998_charger.o +obj-$(CONFIG_CHARGER_MP2629) += mp2629_charger.o obj-$(CONFIG_CHARGER_QCOM_SMBB) += qcom_smbb.o obj-$(CONFIG_CHARGER_BQ2415X) += bq2415x_charger.o obj-$(CONFIG_CHARGER_BQ24190) += bq24190_charger.o
drivers/power/supply/mp2629_charger.c new file +669 -0
669 lines not on this page · raw message
Signature · 1 line
2.17.1
Saravanan Sekar
maintainerPATCH v11 5/6 power: supply: mp2629: Add impedance compensation config
In reply to Saravanan SekarAllows the user to compensate the intrinsic resistance of the battery to accelerate the charging cycle.
--- Documentation/ABI/testing/sysfs-class-power-mp2629 | 8 ++++++++ 1 file changed, 8 insertions(+) create mode 100644 Documentation/ABI/testing/sysfs-class-power-mp2629
Documentation/ABI/testing/sysfs-class-power-mp2629 new file +8 -0
@@ -0,0 +1,8 @@ +What: /sys/class/power_supply/mp2629_battery/batt_impedance_compen +Date: April 2020 +KernelVersion: 5.7 +Description: + Represents a battery impedance compensation to accelerate charging. + + Access: Read, Write + Valid values: Represented in milli-ohms. Valid range is [0, 140].
Signature · 1 line
2.17.1
Re: [PATCH v11 5/6] power: supply: mp2629: Add impedance compensation config
Hi,
Quoted 6 lines · Saravanan Sekar
Allows the user to compensate the intrinsic resistance of the battery to accelerate the charging cycle.
Signed-off-by Saravanan Sekar <[email protected]>Reviewed-by Andy Shevchenko <[email protected]>---
-- Sebastian
Quoted 21 lines
Documentation/ABI/testing/sysfs-class-power-mp2629 | 8 ++++++++ 1 file changed, 8 insertions(+) create mode 100644 Documentation/ABI/testing/sysfs-class-power-mp2629Documentation/ABI/testing/sysfs-class-power-mp2629 new file +8
-0@@ -0,0 +1,8 @@ +What: /sys/class/power_supply/mp2629_battery/batt_impedance_compen +Date: April 2020 +KernelVersion: 5.7 +Description: + Represents a battery impedance compensation to accelerate charging. + + Access: Read, Write + Valid values: Represented in milli-ohms. Valid range is [0, 140].Signature · 1 line
2.17.1
Saravanan Sekar
maintainerPATCH v11 6/6 MAINTAINERS: Add entry for mp2629 Battery Charger driver
In reply to Saravanan SekarAdd MAINTAINERS entry for Monolithic Power Systems mp2629 Charger driver.
--- MAINTAINERS | 5 +++++ 1 file changed, 5 insertions(+)
MAINTAINERS +5 -0
@@ -11358,10 +11358,15 @@ F: drivers/tty/mxser.* MONOLITHIC POWER SYSTEM PMIC DRIVER M: Saravanan Sekar <[email protected]> S: Maintained +F: Documentation/devicetree/bindings/mfd/mps,mp2629.yaml F: Documentation/devicetree/bindings/regulator/mps,mp*.yaml +F: drivers/iio/adc/mp2629_adc.c +F: drivers/mfd/mp2629.c +F: drivers/power/supply/mp2629_charger.c F: drivers/regulator/mp5416.c F: drivers/regulator/mpq7920.c F: drivers/regulator/mpq7920.h +F: include/linux/mfd/mp2629.h MR800 AVERMEDIA USB FM RADIO DRIVER M: Alexey Klimov <[email protected]>
Signature · 1 line
2.17.1
Re: [PATCH v11 6/6] MAINTAINERS: Add entry for mp2629 Battery Charger driver
Hi,
Quoted 5 lines · Saravanan Sekar
Add
MAINTAINERSentry for Monolithic Power Systems mp2629 Charger driver.Signed-off-by Saravanan Sekar <[email protected]>Reviewed-by Andy Shevchenko <[email protected]>---
-- Sebastian
Quoted 26 lines
MAINTAINERS | 5 +++++ 1 file changed, 5 insertions(+)MAINTAINERS +5
-0@@ -11358,10 +11358,15 @@ F: drivers/tty/mxser.* MONOLITHIC POWER SYSTEM PMIC DRIVER M: Saravanan Sekar <[email protected]> S: Maintained +F: Documentation/devicetree/bindings/mfd/mps,mp2629.yaml F: Documentation/devicetree/bindings/regulator/mps,mp*.yaml +F: drivers/iio/adc/mp2629_adc.c +F: drivers/mfd/mp2629.c +F: drivers/power/supply/mp2629_charger.c F: drivers/regulator/mp5416.c F: drivers/regulator/mpq7920.c F: drivers/regulator/mpq7920.h +F: include/linux/mfd/mp2629.h MR800 AVERMEDIA USB FM RADIO DRIVER M: Alexey Klimov <[email protected]>Signature · 1 line
2.17.1
Hi,
I expect, that Lee will provide an immutable branch for me and Jonathan once the MFD bits have been reviewed. Please tell me, if I should prepare one instead.
-- Sebastian
Quoted 83 lines · Saravanan Sekar
changes in v11:
-module_removepart replaced bydevm_add_action_or_resetin charger patch
- minor review comments solved in mfd and adc patchchanges in v10:
- fixed typo, \n indev_err
- dt bindings Warning (unit_address_vs_reg) reported by botchanges in v9:
- fixed review comments in mp2629 power supply such as resource based iio channel, replace workqueue by threaded irq, irq get with "_optional"changes in v8:
- fixed order of call in probe/remove in iio adc
- add ABI documentation for mp2629 power supplychanges in v7:
- fixed probe/remove order, managed and unmanaged call mix use in adc.
- Documentation dual license, i2c node with controller addressOverall looks good to me, FWIW,
Reviewed-by Andy Shevchenko <[email protected]>One question though in reply to patch 4.
changes in v6:
- removed includestypes.hin mfd,of_device.hin adc.
- fixed review comments parentheses, err check, kstrtouintchanges in v5:
- removed platfrom data stored in mfd and directly accessed mfd struct in child
- fixed spell check and capitalization in mfd and documentationchanges in v4:
- fixed capitalization in mfgKconfigand documentationchanges in v3:
- regmap for children passed using platform data and remove mfd driver info access directly from childrenchanges in v2:
- removedEXPORT_SYMBOLof register set/get helper
- regmap bit filed used, fixed other review commentsThis patch series add support for Battery charger control driver for Monolithic Power System's MP2629 chipset, includes MFD driver for ADC battery & input power supply measurement and battery charger control driver.
Thanks,
SaravananSaravanan Sekar (6):
dt-bindings: mfd: add document bindings for mp2629
mfd: mp2629: Add support for mps battery charger
iio: adc: mp2629: Add support for mp2629 ADC driver
power: supply: Add support for mps mp2629 battery charger
power: supply: mp2629: Add impedance compensation config
MAINTAINERS: Add entry for mp2629 Battery Charger driver.../ABI/testing/sysfs-class-power-mp2629 | 8 + .../devicetree/bindings/mfd/mps,mp2629.yaml | 62 ++ MAINTAINERS | 5 + drivers/iio/adc/Kconfig | 10 + drivers/iio/adc/Makefile | 1 + drivers/iio/adc/mp2629_adc.c | 208 ++++++ drivers/mfd/Kconfig | 9 + drivers/mfd/Makefile | 2 + drivers/mfd/mp2629.c | 79 +++ drivers/power/supply/Kconfig | 10 + drivers/power/supply/Makefile | 1 + drivers/power/supply/mp2629_charger.c | 669 ++++++++++++++++++ include/linux/mfd/mp2629.h | 26 + 13 files changed, 1090 insertions(+) create mode 100644 Documentation/ABI/testing/sysfs-class-power-mp2629 create mode 100644 Documentation/devicetree/bindings/mfd/mps,mp2629.yaml create mode 100644 drivers/iio/adc/mp2629_adc.c create mode 100644 drivers/mfd/mp2629.c create mode 100644 drivers/power/supply/mp2629_charger.c create mode 100644 include/linux/mfd/mp2629.hSignature · 1 line
2.17.1