Add battery charger driver support for MP2629
Subsystems (5)
Saravanan Sekar
maintainerv9 cover Add battery charger driver support for MP2629
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 compenstation config
MAINTAINERS: Add entry for mp2629 Battery Charger driver
.../ABI/testing/sysfs-class-power-mp2629 | 8 + .../devicetree/bindings/mfd/mps,mp2629.yaml | 60 ++ 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 | 86 +++ drivers/power/supply/Kconfig | 10 + drivers/power/supply/Makefile | 1 + drivers/power/supply/mp2629_charger.c | 667 ++++++++++++++++++ include/linux/mfd/mp2629.h | 28 + 13 files changed, 1095 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 v9 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 | 60 +++++++++++++++++++ 1 file changed, 60 insertions(+) create mode 100644 Documentation/devicetree/bindings/mfd/mps,mp2629.yaml
Documentation/devicetree/bindings/mfd/mps,mp2629.yaml new file +60 -0
@@ -0,0 +1,60 @@ +# 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 contrlled 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" + +examples: + - | + #include <dt-bindings/interrupt-controller/irq.h> + #include <dt-bindings/input/linux-event-codes.h> + i2c@7e205000 { + #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 v9 1/6] dt-bindings: mfd: add document bindings for mp2629
On Wed, 15 Apr 2020, Saravanan Sekar wrote:
comment below
Quoted 18 lines
Add device tree binding information for mp2629 mfd driver.
Signed-off-by Saravanan Sekar <[email protected]>--- .../devicetree/bindings/mfd/mps,mp2629.yaml | 60 +++++++++++++++++++ 1 file changed, 60 insertions(+) create mode 100644 Documentation/devicetree/bindings/mfd/mps,mp2629.yamlDocumentation/devicetree/bindings/mfd/mps,mp2629.yaml new file +4
-0@@ -0,0 +1,60 @@ +# SPDX-License-Identifier: GPL-2.0-only OR BSD-2-Clause +%YAML 1.2 +--- +$id: http://devicetree.org/schemas/mfd/mps,mp2629.yaml#
Documentation/devicetree/bindings/mfd/mps,mp2629.yaml line 14
Quoted 10 lines
Documentation/devicetree/bindings/mfd/mps,mp2629.yaml new file +10
-0+$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 contrlled over I2C.
controlled
Quoted 47 lines
Documentation/devicetree/bindings/mfd/mps,mp2629.yaml new file +46
-0+ + 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" + +examples: + - | + #include <dt-bindings/interrupt-controller/irq.h> + #include <dt-bindings/input/linux-event-codes.h> + i2c@7e205000 { + #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 · 2 lines
Peter Meerwald-Stadler Mobile: +43 664 24 44 418
Rob Herring
maintainerRe: [PATCH v9 1/6] dt-bindings: mfd: add document bindings for mp2629
In reply to Saravanan SekarQuoted 8 lines · Saravanan Sekar
Add device tree binding information for mp2629 mfd driver.
Signed-off-by Saravanan Sekar <[email protected]>--- .../devicetree/bindings/mfd/mps,mp2629.yaml | 60 +++++++++++++++++++ 1 file changed, 60 insertions(+) create mode 100644 Documentation/devicetree/bindings/mfd/mps,mp2629.yaml
My bot found errors running 'make dt_binding_check' on your patch:
Documentation/devicetree/bindings/mfd/mps,mp2629.example.dts:19.22-32.11: Warning (unit_address_vs_reg): /example-0/i2c@7e205000: node has a unit name, but no reg or ranges property
See https://patchwork.ozlabs.org/patch/1271317
If you already ran 'make dt_binding_check' and didn't see the above error(s), then make sure dt-schema is up to date:
pip3 install git+https://github.com/devicetree-org/dt-schema.git@master --upgrade
Please check and re-submit.
Saravanan Sekar
maintainerPATCH v9 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 | 86 ++++++++++++++++++++++++++++++++++++++ include/linux/mfd/mp2629.h | 19 +++++++++ 4 files changed, 116 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 system MP2629 ADC and Battery charger" + depends on I2C + select REGMAP_I2C + help + Select this option to enable support for monolithic power system + battery charger. This provides ADC, thermal, battery charger power + management functions on the systems. + 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 +86 -0
86 lines not on this page · raw message
include/linux/mfd/mp2629.h new file +19 -0
@@ -0,0 +1,19 @@ +/* SPDX-License-Identifier: GPL-2.0+ */ +/* +* register definitions for MP2629 charger +* +* Copyright 2020 Monolithic Power Systems, Inc +*/ + +#ifndef __MP2629_H__ +#define __MP2629_H__ + +#include <linux/device.h> +#include <linux/regmap.h> + +struct mp2629_info { +struct device *dev; +struct regmap *regmap; +}; + +#endif
Signature · 1 line
2.17.1
Re: [PATCH v9 2/6] mfd: mp2629: Add support for mps battery charger
Quoted 7 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]>
Quoted 8 lines
--- drivers/mfd/Kconfig | 9 ++++ drivers/mfd/Makefile | 2 + drivers/mfd/mp2629.c | 86 ++++++++++++++++++++++++++++++++++++++ include/linux/mfd/mp2629.h | 19 +++++++++ 4 files changed, 116 insertions(+) create mode 100644 drivers/mfd/mp2629.c create mode 100644 include/linux/mfd/mp2629.h
How is this driver registered?
Looks like it has device tree support. Is there another way?
Quoted 16 lines
drivers/mfd/Kconfig +8
-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 system MP2629 ADC and Battery charger" + depends on I2C + select REGMAP_I2C + help + Select this option to enable support for monolithic power system + battery charger. This provides ADC, thermal, battery charger power + management functions on the systems.
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 v9 2/6] mfd: mp2629: Add support for mps battery charger
Hi Lee,
Quoted 17 lines · Lee Jones
Quoted 7 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]>Quoted 8 lines
--- drivers/mfd/Kconfig | 9 ++++ drivers/mfd/Makefile | 2 + drivers/mfd/mp2629.c | 86 ++++++++++++++++++++++++++++++++++++++ include/linux/mfd/mp2629.h | 19 +++++++++ 4 files changed, 116 insertions(+)create mode 100644
drivers/mfd/mp2629.c
create mode 100644include/linux/mfd/mp2629.h
Quoted 3 lines
How is this driver registered?
Looks like it has device tree support. Is there another way?
Yes, only using device tree
Quoted 17 lines
Quoted 17 lines
drivers/mfd/Kconfig +8
-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 system MP2629 ADC and Battery charger" + depends on I2C + select REGMAP_I2C + help + Select this option to enable support for monolithic power system + battery charger. This provides ADC, thermal, battery charger power + management functions on the systems.
Re: [PATCH v9 2/6] mfd: mp2629: Add support for mps battery charger
Quoted 20 lines · saravanan sekar
Hi Lee,
Quoted 17 lines · Lee Jones
Quoted 15 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]>--- drivers/mfd/Kconfig | 9 ++++ drivers/mfd/Makefile | 2 + drivers/mfd/mp2629.c | 86 ++++++++++++++++++++++++++++++++++++++ include/linux/mfd/mp2629.h | 19 +++++++++ 4 files changed, 116 insertions(+)create mode 100644
drivers/mfd/mp2629.c
create mode 100644include/linux/mfd/mp2629.h
Quoted 4 lines
Quoted 3 lines
How is this driver registered?
Looks like it has device tree support. Is there another way?
Yes, only using device tree
Then how about using 'simple-mfd' and 'syscon'?
Then you can omit this driver completely.
Quoted 15 lines
Quoted 15 lines
Quoted 15 lines
drivers/mfd/Kconfig +8
-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 system MP2629 ADC and Battery charger" + depends on I2C + select REGMAP_I2C + help + Select this option to enable support for monolithic power system + battery charger. This provides ADC, thermal, battery charger power + management functions on the systems.
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 v9 2/6] mfd: mp2629: Add support for mps battery charger
Hi Lee,
Quoted 22 lines · Lee Jones
Quoted 20 lines · saravanan sekar
Hi Lee,
Quoted 17 lines · Lee Jones
Quoted 15 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]>--- drivers/mfd/Kconfig | 9 ++++ drivers/mfd/Makefile | 2 + drivers/mfd/mp2629.c | 86 ++++++++++++++++++++++++++++++++++++++ include/linux/mfd/mp2629.h | 19 +++++++++ 4 files changed, 116 insertions(+)create mode 100644
drivers/mfd/mp2629.c
create mode 100644include/linux/mfd/mp2629.h
Quoted 7 lines
Quoted 4 lines
Quoted 3 lines
How is this driver registered?
Looks like it has device tree support. Is there another way?
Yes, only using device tree
Then how about using 'simple-mfd' and 'syscon'?
Then you can omit this driver completely.
The exception is to support for non device tree platform as well, but I have tested only for ARM device tree platform.
Quoted 16 lines
Quoted 16 lines
Quoted 16 lines
Quoted 16 lines
drivers/mfd/Kconfig +8
-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 system MP2629 ADC and Battery charger" + depends on I2C + select REGMAP_I2C + help + Select this option to enable support for monolithic power system + battery charger. This provides ADC, thermal, battery charger power + management functions on the systems.
Re: [PATCH v9 2/6] mfd: mp2629: Add support for mps battery charger
Quoted 27 lines · saravanan sekar
Hi Lee,
Quoted 24 lines · Lee Jones
Quoted 22 lines · saravanan sekar
Hi Lee,
Quoted 19 lines · Lee Jones
Quoted 7 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]>Quoted 8 lines
--- drivers/mfd/Kconfig | 9 ++++ drivers/mfd/Makefile | 2 + drivers/mfd/mp2629.c | 86 ++++++++++++++++++++++++++++++++++++++ include/linux/mfd/mp2629.h | 19 +++++++++ 4 files changed, 116 insertions(+)create mode 100644
drivers/mfd/mp2629.c
create mode 100644include/linux/mfd/mp2629.hHow is this driver registered?
Quoted 8 lines
Quoted 5 lines
Quoted 2 lines
Quoted 1 line
Looks like it has device tree support. Is there another way?
Yes, only using device tree
Then how about using 'simple-mfd' and 'syscon'?
Then you can omit this driver completely.
The exception is to support for non device tree platform as well, but I have tested only for ARM device tree platform.
Is that a reality though?
How else do you see this realistically being registered?
Quoted 15 lines
Quoted 15 lines
Quoted 15 lines
Quoted 15 lines
Quoted 15 lines
drivers/mfd/Kconfig +8
-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 system MP2629 ADC and Battery charger" + depends on I2C + select REGMAP_I2C + help + Select this option to enable support for monolithic power system + battery charger. This provides ADC, thermal, battery charger power + management functions on the systems.
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 v9 2/6] mfd: mp2629: Add support for mps battery charger
Quoted 31 lines · Lee Jones
Quoted 29 lines · saravanan sekar
Hi Lee,
Quoted 26 lines · Lee Jones
Quoted 24 lines · saravanan sekar
Hi Lee,
Quoted 17 lines · Lee Jones
Quoted 7 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]>Quoted 8 lines
--- drivers/mfd/Kconfig | 9 ++++ drivers/mfd/Makefile | 2 + drivers/mfd/mp2629.c | 86 ++++++++++++++++++++++++++++++++++++++ include/linux/mfd/mp2629.h | 19 +++++++++ 4 files changed, 116 insertions(+) create mode 100644 drivers/mfd/mp2629.c create mode 100644 include/linux/mfd/mp2629.hQuoted 3 lines
How is this driver registered?
Looks like it has device tree support. Is there another way?
Yes, only using device tree
Quoted 9 lines
Quoted 5 lines
Quoted 3 lines
Then how about using 'simple-mfd' and 'syscon'?
Then you can omit this driver completely.
The exception is to support for non device tree platform as well, but I have tested only for ARM device tree platform.
Is that a reality though?
How else do you see this realistically being registered?
I understand that acpi related device table are not covered here, well I don't have to platform to test so. If you ask me to cover acpi related table, I can do but hard to test.
Quoted 15 lines
Quoted 15 lines
Quoted 15 lines
Quoted 15 lines
Quoted 15 lines
Quoted 15 lines
drivers/mfd/Kconfig +8
-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 system MP2629 ADC and Battery charger" + depends on I2C + select REGMAP_I2C + help + Select this option to enable support for monolithic power system + battery charger. This provides ADC, thermal, battery charger power + management functions on the systems.
Re: [PATCH v9 2/6] mfd: mp2629: Add support for mps battery charger
Quoted 38 lines · saravanan sekar
Quoted 36 lines · Lee Jones
Quoted 34 lines · saravanan sekar
Hi Lee,
Quoted 22 lines · Lee Jones
Quoted 20 lines · saravanan sekar
Hi Lee,
Quoted 17 lines · Lee Jones
Quoted 15 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]>--- drivers/mfd/Kconfig | 9 ++++ drivers/mfd/Makefile | 2 + drivers/mfd/mp2629.c | 86 ++++++++++++++++++++++++++++++++++++++ include/linux/mfd/mp2629.h | 19 +++++++++ 4 files changed, 116 insertions(+) create mode 100644 drivers/mfd/mp2629.c create mode 100644 include/linux/mfd/mp2629.hQuoted 7 lines
Quoted 4 lines
Quoted 3 lines
How is this driver registered?
Looks like it has device tree support. Is there another way?
Yes, only using device tree
Then how about using 'simple-mfd' and 'syscon'?
Then you can omit this driver completely.
The exception is to support for non device tree platform as well, but I have tested only for ARM device tree platform.
Quoted 7 lines
Quoted 4 lines
Is that a reality though?
How else do you see this realistically being registered?
I understand that acpi related device table are not covered here, well I don't have to platform to test so.
If you ask me to cover acpi related table, I can do but hard to test.
I don't know of any reasons why syscon can't be used by ACPI.
Please try to solve this issue using 'simple-mfd' and 'syscon'.
Quoted 15 lines
Quoted 15 lines
Quoted 15 lines
Quoted 15 lines
Quoted 15 lines
Quoted 15 lines
Quoted 15 lines
drivers/mfd/Kconfig +8
-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 system MP2629 ADC and Battery charger" + depends on I2C + select REGMAP_I2C + help + Select this option to enable support for monolithic power system + battery charger. This provides ADC, thermal, battery charger power + management functions on the systems.
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 v9 2/6] mfd: mp2629: Add support for mps battery charger
Hi Lee,
Quoted 41 lines · Lee Jones
Quoted 39 lines · saravanan sekar
Quoted 38 lines · Lee Jones
Quoted 27 lines · saravanan sekar
Hi Lee,
Quoted 24 lines · Lee Jones
Quoted 22 lines · saravanan sekar
Hi Lee,
Quoted 19 lines · Lee Jones
Quoted 7 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]>Quoted 8 lines
--- drivers/mfd/Kconfig | 9 ++++ drivers/mfd/Makefile | 2 + drivers/mfd/mp2629.c | 86 ++++++++++++++++++++++++++++++++++++++ include/linux/mfd/mp2629.h | 19 +++++++++ 4 files changed, 116 insertions(+) create mode 100644 drivers/mfd/mp2629.c create mode 100644 include/linux/mfd/mp2629.hHow is this driver registered?
Quoted 7 lines
Quoted 5 lines
Quoted 2 lines
Quoted 1 line
Looks like it has device tree support. Is there another way?
Yes, only using device tree
Then how about using 'simple-mfd' and 'syscon'?
Then you can omit this driver completely.
The exception is to support for non device tree platform as well, but I have tested only for ARM device tree platform.
Is that a reality though?
Quoted 8 lines
Quoted 5 lines
Quoted 2 lines
How else do you see this realistically being registered?
I understand that acpi related device table are not covered here, well I don't have to platform to test so.
If you ask me to cover acpi related table, I can do but hard to test.I don't know of any reasons why syscon can't be used by ACPI.
Please try to solve this issue using 'simple-mfd' and 'syscon'.
Well the simple-mfd and syscon topic recommended by you when Device tree alone is used. I wounder still I receive review/improvements comments for this mfd patch and also another to omit this driver using simple-mfd (rework the series).
Confused, not sure which is valid and will be accepted at the end.
Quoted 16 lines
Quoted 16 lines
Quoted 16 lines
Quoted 16 lines
Quoted 16 lines
Quoted 16 lines
Quoted 16 lines
Quoted 16 lines
drivers/mfd/Kconfig +8
-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 system MP2629 ADC and Battery charger" + depends on I2C + select REGMAP_I2C + help + Select this option to enable support for monolithic power system + battery charger. This provides ADC, thermal, battery charger power + management functions on the systems.
saravanan sekar
maintainerRe: [PATCH v9 2/6] mfd: mp2629: Add support for mps battery charger
Hi Lee,
Quoted 50 lines · saravanan sekar
Hi Lee,
Quoted 47 lines · Lee Jones
Quoted 45 lines · saravanan sekar
Quoted 32 lines · Lee Jones
Quoted 30 lines · saravanan sekar
Hi Lee,
Quoted 27 lines · Lee Jones
Quoted 25 lines · saravanan sekar
Hi Lee,
Quoted 18 lines · Lee Jones
Quoted 13 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]>---
drivers/mfd/Kconfig | 9 ++++
drivers/mfd/Makefile | 2 +
drivers/mfd/mp2629.c | 86
++++++++++++++++++++++++++++++++++++++
include/linux/mfd/mp2629.h| 19 +++++++++Quoted 3 lines
4 files changed, 116 insertions(+)create mode 100644
drivers/mfd/mp2629.ccreate mode 100644include/linux/mfd/mp2629.hQuoted 3 lines
How is this driver registered?
Looks like it has device tree support. Is there another way?
Yes, only using device tree
Quoted 9 lines
Quoted 5 lines
Quoted 3 lines
Then how about using 'simple-mfd' and 'syscon'?
Then you can omit this driver completely.
The exception is to support for non device tree platform as well, but I have tested only for ARM device tree platform.
Is that a reality though?
How else do you see this realistically being registered?
I understand that acpi related device table are not covered here, well I don't have to platform to test so.
If you ask me to cover acpi related table, I can do but hard to test.
Quoted 7 lines
Quoted 3 lines
I don't know of any reasons why syscon can't be used by ACPI.
Please try to solve this issue using 'simple-mfd' and 'syscon'.
Well the simple-mfd and syscon topic recommended by you when Device tree alone is used. I wounder still I receive review/improvements comments for this mfd patch and also another to omit this driver using simple-mfd (rework the series).
Confused, not sure which is valid and will be accepted at the end.
I had look into syscon, as far my understanding syscon is supported only for memory mapped IO. MP2629 device is over I2C bus, could you share your thought about syscon for this device?
Thanks,
Saravanan
Re: [PATCH v9 2/6] mfd: mp2629: Add support for mps battery charger
Quoted 7 lines · saravanan sekar
Quoted 6 lines · saravanan sekar
Quoted 5 lines · Lee Jones
Quoted 4 lines · saravanan sekar
Quoted 3 lines · Lee Jones
Quoted 2 lines · saravanan sekar
Quoted 1 line · Lee Jones
On Fri, 24 Apr 2020, saravanan sekar wrote:
...
Quoted 24 lines
Quoted 16 lines
Quoted 16 lines
Quoted 6 lines
Quoted 6 lines
Quoted 6 lines
Quoted 3 lines
Then how about using 'simple-mfd' and 'syscon'?
Then you can omit this driver completely.
The exception is to support for non device tree platform as well, but I have
tested only for ARM device tree platform.Quoted 8 lines
Quoted 4 lines
Is that a reality though?
How else do you see this realistically being registered?
I understand that acpi related device table are not covered here, well I
don't have to platform to test so.
If you ask me to cover acpi related table, I can do but hard to test.I don't know of any reasons why syscon can't be used by ACPI.
Quoted 7 lines
Quoted 1 line
Please try to solve this issue using 'simple-mfd' and 'syscon'.
Well the simple-mfd and syscon topic recommended by you when Device tree alone is used.
I wounder still I receive review/improvements comments for this mfd patch and also another
to omit this driver using simple-mfd (rework the series). Confused, not sure which is valid and will be accepted at the end.
Quoted 4 lines
I had look into syscon, as far my understanding syscon is supported only for memory mapped IO. MP2629
device is over I2C bus, could you share your thought about syscon for this device?
My understanding too, but I didn't dug into it.
Something like general regmap support is missing (or I am missing the way how to pass it to syscon).
Signature · 2 lines
With Best Regards, Andy Shevchenko
Re: [PATCH v9 2/6] mfd: mp2629: Add support for mps battery charger
In reply to Saravanan SekarQuoted 21 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]>--- drivers/mfd/Kconfig | 9 ++++ drivers/mfd/Makefile | 2 + drivers/mfd/mp2629.c | 86 ++++++++++++++++++++++++++++++++++++++ include/linux/mfd/mp2629.h | 19 +++++++++ 4 files changed, 116 insertions(+) create mode 100644 drivers/mfd/mp2629.c create mode 100644 include/linux/mfd/mp2629.hdrivers/mfd/Kconfig +0
-0
drivers/mfd/Kconfig config MFD_MC13XXX_I2C · line 438
Quoted 5 lines
drivers/mfd/Kconfig +2
-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 system MP2629 ADC and Battery charger"
"Power Systems"
drivers/mfd/Kconfig config MFD_MC13XXX_I2C · line 442
Quoted 4 lines
drivers/mfd/Kconfig +4
-0+ depends on I2C + select REGMAP_I2C + help + Select this option to enable support for monolithic power system
"Monolithic Power Systems"
drivers/mfd/Kconfig config MFD_MC13XXX_I2C · line 443
Quoted 1 line
drivers/mfd/Kconfig +1
-0+ battery charger. This provides ADC, thermal, battery charger power
"thermal and battery"
drivers/mfd/Kconfig config MFD_MC13XXX_I2C · line 444
Quoted 1 line
drivers/mfd/Kconfig +1
-0+ management functions on the systems.
What does "on the systems" mean?
I would just drop that part.
Quoted 35 lines
drivers/mfd/Kconfig +0
-0config MFD_MXS_LRADC tristate "Freescale i.MX23/i.MX28 LRADC" depends on ARCH_MXS || COMPILE_TESTdrivers/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.odrivers/mfd/mp2629.c new file +13
-0@@ -0,0 +1,86 @@ +// SPDX-License-Identifier: GPL-2.0+ +/* +* MP2629 parent driver for ADC and battery charger +* +* Copyright 2020 Monolithic Power Systems, Inc +* +* Author: Saravanan Sekar <[email protected]> +*/ + +#include <linux/i2c.h> +#include <linux/kernel.h> +#include <linux/mfd/core.h> +#include <linux/mfd/mp2629.h>
drivers/mfd/mp2629.c line 23
Quoted 10 lines
drivers/mfd/mp2629.c new file +10
-0+#include <linux/module.h> +#include <linux/platform_device.h> +#include <linux/regmap.h> +#include <linux/slab.h> + +enum { +MP2629_MFD_ADC , +MP2629_MFD_CHARGER , +MP2629_MFD_MAX +};
Why do you need this? I think it can be dropped.
drivers/mfd/mp2629.c line 25
Quoted 1 line
drivers/mfd/mp2629.c new file +1
-0+static const struct mfd_cell mp2629mfd[] = {
Drop the "mfd" part of "mp2629mfd".
You can call it "mp2629_cell" if you like.
Quoted 4 lines
drivers/mfd/mp2629.c new file +4
-0+ [MP2629_MFD_ADC] = { + .name = "mp2629_adc", + .of_compatible = "mps,mp2629_adc", + },
drivers/mfd/mp2629.c line 39
Quoted 10 lines
drivers/mfd/mp2629.c new file +10
-0+ [MP2629_MFD_CHARGER ] = { + .name ="mp2629_charger" , + .of_compatible ="mps,mp2629_charger" , + } +}; + +static const struct regmap_config mp2629_regmap_config = { + .reg_bits =8 , + .val_bits =8 , + .max_register =0x17 ,
Best to define the registers in an enum and call the last one MP2629_MAX_REG or similar.
drivers/mfd/mp2629.c line 44
Quoted 5 lines
drivers/mfd/mp2629.c new file +5
-0+}; + +static int mp2629_probe (struct i2c_client *client) +{ +struct mp2629_info *ddata;
Either change "info" to "ddata", or drop it completely.
drivers/mfd/mp2629.c line 56
Quoted 12 lines
drivers/mfd/mp2629.c new file +12
-0+int ret; + + ddata =devm_kzalloc (&client->dev,sizeof (*ddata),GFP_KERNEL ); +if (!ddata) +return -ENOMEM ; + + ddata->dev = &client->dev; +i2c_set_clientdata (client, ddata); + + ddata->regmap =devm_regmap_init_i2c (client, &mp2629_regmap_config); +if (IS_ERR (ddata->regmap)) { +dev_err (ddata->dev,"Failed to allocate regmap!\n" );
No need for the exclamation mark.
drivers/mfd/mp2629.c line 60
Quoted 4 lines
drivers/mfd/mp2629.c new file +4
-0+return PTR_ERR (ddata->regmap); + } + + ret = devm_mfd_add_devices(ddata->dev, PLATFORM_DEVID_NONE, mp2629mfd,
Why NONE over AUTO?
Quoted 32 lines
drivers/mfd/mp2629.c new file +26
-0+ARRAY_SIZE (mp2629mfd),NULL , + 0, NULL); +if (ret) +dev_err (ddata->dev,"Failed to register sub-devices %d\n" , ret); + +return ret; +} + +static const struct of_device_id mp2629_of_match[] = { + { .compatible ="mps,mp2629" }, + { } +}; +MODULE_DEVICE_TABLE (of, mp2629_of_match); + +static struct i2c_driver mp2629_driver = { + .driver = { + .name ="mp2629" , + .of_match_table = mp2629_of_match, + }, + .probe_new = mp2629_probe, +}; +module_i2c_driver (mp2629_driver); + +MODULE_AUTHOR ("Saravanan Sekar <[email protected]>" ); +MODULE_DESCRIPTION ("MP2629 Battery charger parent driver" ); +MODULE_LICENSE ("GPL" );include/linux/mfd/mp2629.h new file +0
-0
include/linux/mfd/mp2629.h line 3
Quoted 3 lines
include/linux/mfd/mp2629.h new file +3
-0@@ -0,0 +1,19 @@ +/* SPDX-License-Identifier: GPL-2.0+ */ +/* +* register definitions for MP2629 charger
"Register"
Although there aren't any register definitions in here?
Quoted 15 lines
include/linux/mfd/mp2629.h new file +15
-0+* Copyright 2020 Monolithic Power Systems, Inc +*/ + +#ifndef __MP2629_H__ +#define __MP2629_H__ + +#include <linux/device.h> +#include <linux/regmap.h> + +struct mp2629_info { +struct device *dev; +struct regmap *regmap; +}; + +#endif
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 v9 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
@@ -16,4 +16,13 @@ struct mp2629_info { 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 v9 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 | 667 ++++++++++++++++++++++++++ 3 files changed, 678 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 provies 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 +667 -0
667 lines not on this page · raw message
Signature · 1 line
2.17.1
Re: [PATCH v9 4/6] power: supply: Add support for mps mp2629 battery charger
On Wed, 15 Apr 2020, Saravanan Sekar wrote:
comments below
Quoted 18 lines
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 <[email protected]>--- drivers/power/supply/Kconfig | 10 + drivers/power/supply/Makefile | 1 + drivers/power/supply/mp2629_charger.c | 667 ++++++++++++++++++++++++++ 3 files changed, 678 insertions(+) create mode 100644 drivers/power/supply/mp2629_charger.cdrivers/power/supply/Kconfig +0
-0@@ -541,6 +541,16 @@ config CHARGER_MAX8998 Say Y to enable support for the battery charger control sysfs and
drivers/power/supply/Kconfig config CHARGER_MAX8998 · line 551
Quoted 10 lines
drivers/power/supply/Kconfig +8
-0platform 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 provies Battery charger power management
provides
Quoted 474 lines
drivers/power/supply/Kconfig +2
-0+ functions on the systems. + config CHARGER_QCOM_SMBB tristate "Qualcomm Switch-Mode Battery Charger and Boost" depends on MFD_SPMI_PMIC || COMPILE_TESTdrivers/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.odrivers/power/supply/mp2629_charger.c new file +451
-0@@ -0,0 +1,667 @@ +// SPDX-License-Identifier: GPL-2.0-or-later +/* +* MP2629 battery charger driver +* +* Copyright 2020 Monolithic Power Systems, Inc +* +* Author: Saravanan Sekar <[email protected]> +*/ + +#include <linux/bits.h> +#include <linux/iio/consumer.h> +#include <linux/iio/types.h> +#include <linux/interrupt.h> +#include <linux/mfd/mp2629.h> +#include <linux/module.h> +#include <linux/mod_devicetable.h> +#include <linux/platform_device.h> +#include <linux/power_supply.h> +#include <linux/regmap.h> + +#define MP2629_REG_INPUT_ILIM 0x00 +#define MP2629_REG_INPUT_VLIM 0x01 +#define MP2629_REG_CHARGE_CTRL 0x04 +#define MP2629_REG_CHARGE_ILIM 0x05 +#define MP2629_REG_PRECHARGE 0x06 +#define MP2629_REG_TERM_CURRENT 0x06 +#define MP2629_REG_CHARGE_VLIM 0x07 +#define MP2629_REG_TIMER_CTRL 0x08 +#define MP2629_REG_IMPEDANCE_COMP 0x09 +#define MP2629_REG_INTERRUPT 0x0b +#define MP2629_REG_STATUS 0x0c +#define MP2629_REG_FAULT 0x0d + +#define MP2629_MASK_INPUT_TYPE GENMASK(7, 5) +#define MP2629_MASK_CHARGE_TYPE GENMASK(4, 3) +#define MP2629_MASK_CHARGE_CTRL GENMASK(5, 4) +#define MP2629_MASK_WDOG_CTRL GENMASK(5, 4) +#define MP2629_MASK_IMPEDANCE GENMASK(7, 4) + +#define MP2629_INPUTSOURCE_CHANGE GENMASK(7, 5) +#define MP2629_CHARGING_CHANGE GENMASK(4, 3) +#define MP2629_FAULT_BATTERY BIT(3) +#define MP2629_FAULT_THERMAL BIT(4) +#define MP2629_FAULT_INPUT BIT(5) +#define MP2629_FAULT_OTG BIT(6) + +#define MP2629_MAX_BATT_CAPACITY 100 + +#define MP2629_PROPS (_idx, _min, _max, _step) \ + [_idx] = { \ + .min = _min, \ + .max = _max, \ + .step = _step, \ +} + +enum mp2629_source_type { +MP2629_SOURCE_TYPE_NO_INPUT , +MP2629_SOURCE_TYPE_NON_STD , +MP2629_SOURCE_TYPE_SDP , +MP2629_SOURCE_TYPE_CDP , +MP2629_SOURCE_TYPE_DCP , +MP2629_SOURCE_TYPE_OTG =7 , +}; + +enum mp2629_field { +INPUT_ILIM , +INPUT_VLIM , +CHARGE_ILIM , +CHARGE_VLIM , +PRECHARGE , +TERM_CURRENT , +MP2629_MAX_FIELD +}; + +struct mp2629_charger { +struct device *dev; +int status; +int fault; + +struct regmap *regmap; +struct regmap_field *regmap_fields[MP2629_MAX_FIELD ]; +struct mutex lock; +struct power_supply *usb; +struct power_supply *battery; +struct iio_channel *iiochan[MP2629_ADC_CHAN_END ]; +}; + +struct mp2629_prop { +int reg; +int mask; +int min; +int max; +int step; +int shift; +}; + +static enum power_supply_usb_type mp2629_usb_types[] = { +POWER_SUPPLY_USB_TYPE_SDP , +POWER_SUPPLY_USB_TYPE_DCP , +POWER_SUPPLY_USB_TYPE_CDP , +POWER_SUPPLY_USB_TYPE_PD_DRP , +POWER_SUPPLY_USB_TYPE_UNKNOWN +}; + +static enum power_supply_property mp2629_charger_usb_props[] = { +POWER_SUPPLY_PROP_ONLINE , +POWER_SUPPLY_PROP_USB_TYPE , +POWER_SUPPLY_PROP_VOLTAGE_NOW , +POWER_SUPPLY_PROP_CURRENT_NOW , +POWER_SUPPLY_PROP_INPUT_CURRENT_LIMIT , +POWER_SUPPLY_PROP_INPUT_VOLTAGE_LIMIT , +}; + +static enum power_supply_property mp2629_charger_bat_props[] = { +POWER_SUPPLY_PROP_STATUS , +POWER_SUPPLY_PROP_HEALTH , +POWER_SUPPLY_PROP_CHARGE_TYPE , +POWER_SUPPLY_PROP_VOLTAGE_NOW , +POWER_SUPPLY_PROP_CURRENT_NOW , +POWER_SUPPLY_PROP_CAPACITY , +POWER_SUPPLY_PROP_PRECHARGE_CURRENT , +POWER_SUPPLY_PROP_CHARGE_TERM_CURRENT , +POWER_SUPPLY_PROP_CONSTANT_CHARGE_CURRENT , +POWER_SUPPLY_PROP_CONSTANT_CHARGE_VOLTAGE , +POWER_SUPPLY_PROP_CONSTANT_CHARGE_CURRENT_MAX , +POWER_SUPPLY_PROP_CONSTANT_CHARGE_VOLTAGE_MAX , +}; + +static struct mp2629_prop props[] = { +MP2629_PROPS (INPUT_ILIM ,100000 ,3250000 ,50000 ), +MP2629_PROPS (INPUT_VLIM ,3800000 ,5300000 ,100000 ), +MP2629_PROPS (CHARGE_ILIM ,320000 ,4520000 ,40000 ), +MP2629_PROPS (CHARGE_VLIM ,3400000 ,4670000 ,10000 ), +MP2629_PROPS (PRECHARGE ,120000 ,720000 ,40000 ), +MP2629_PROPS (TERM_CURRENT ,80000 ,680000 ,40000 ), +}; + +static const struct reg_field mp2629_reg_fields[] = { + [INPUT_ILIM ] =REG_FIELD (MP2629_REG_INPUT_ILIM ,0 ,5 ), + [INPUT_VLIM ] =REG_FIELD (MP2629_REG_INPUT_VLIM ,0 ,3 ), + [CHARGE_ILIM ] =REG_FIELD (MP2629_REG_CHARGE_ILIM ,0 ,6 ), + [CHARGE_VLIM ] =REG_FIELD (MP2629_REG_CHARGE_VLIM ,1 ,7 ), + [PRECHARGE ] =REG_FIELD (MP2629_REG_PRECHARGE ,4 ,7 ), + [TERM_CURRENT ] =REG_FIELD (MP2629_REG_TERM_CURRENT ,0 ,3 ), +}; + +static char *adc_chan_name[] = { +"mp2629-batt-volt" , +"mp2629-system-volt" , +"mp2629-input-volt" , +"mp2629-batt-current" , +"mp2629-input-current" , +}; + +static int mp2629_read_adc (struct mp2629_charger *charger, +enum mp2629_adc_chan ch, +union power_supply_propval *val) +{ +int ret; +int chval; + + ret =iio_read_channel_processed (charger->iiochan[ch], &chval); +if (ret) +return ret; + + val->intval = chval *1000 ; + +return 0 ; +} + +static int mp2629_get_prop (struct mp2629_charger *charger, +enum mp2629_field fld, +union power_supply_propval *val) +{ +int ret; +unsigned int rval; + + ret =regmap_field_read (charger->regmap_fields[fld], &rval); +if (ret) +return ret; + + val->intval = rval * props[fld].step + props[fld].min; + +return 0 ; +} + +static int mp2629_set_prop (struct mp2629_charger *charger, +enum mp2629_field fld, +const union power_supply_propval *val) +{ +unsigned int rval; + +if (val->intval < props[fld].min || val->intval > props[fld].max) +return -EINVAL ; + + rval = (val->intval - props[fld].min) / props[fld].step; +return regmap_field_write (charger->regmap_fields[fld], rval); +} + +static int mp2629_get_battery_capacity (struct mp2629_charger *charger, +union power_supply_propval *val) +{ +union power_supply_propval vnow, vlim; +int ret; + + ret =mp2629_read_adc (charger,MP2629_BATT_VOLT , &vnow); +if (ret) +return ret; + + ret =mp2629_get_prop (charger,CHARGE_VLIM , &vlim); +if (ret) +return ret; + + val->intval = (vnow.intval *100 ) / vlim.intval; + val->intval =min (val->intval,MP2629_MAX_BATT_CAPACITY ); + +return 0 ; +} + +static int mp2629_charger_battery_get_prop (struct power_supply *psy, +enum power_supply_property psp, +union power_supply_propval *val) +{ +struct mp2629_charger *charger =dev_get_drvdata (psy->dev.parent); +unsigned int rval; +int ret =0 ; + +switch (psp) { +case POWER_SUPPLY_PROP_VOLTAGE_NOW : + ret =mp2629_read_adc (charger,MP2629_BATT_VOLT , val); +break ; + +case POWER_SUPPLY_PROP_CURRENT_NOW : + ret =mp2629_read_adc (charger,MP2629_BATT_CURRENT , val); +break ; + +case POWER_SUPPLY_PROP_CONSTANT_CHARGE_CURRENT_MAX : + val->intval =4520000 ; +break ; + +case POWER_SUPPLY_PROP_CONSTANT_CHARGE_VOLTAGE_MAX : + val->intval =4670000 ; +break ; + +case POWER_SUPPLY_PROP_CAPACITY : + ret =mp2629_get_battery_capacity (charger, val); +break ; + +case POWER_SUPPLY_PROP_CHARGE_TERM_CURRENT : + ret =mp2629_get_prop (charger,TERM_CURRENT , val); +break ; + +case POWER_SUPPLY_PROP_PRECHARGE_CURRENT : + ret =mp2629_get_prop (charger,PRECHARGE , val); +break ; + +case POWER_SUPPLY_PROP_CONSTANT_CHARGE_VOLTAGE : + ret =mp2629_get_prop (charger,CHARGE_VLIM , val); +break ; + +case POWER_SUPPLY_PROP_CONSTANT_CHARGE_CURRENT : + ret =mp2629_get_prop (charger,CHARGE_ILIM , val); +break ; + +case POWER_SUPPLY_PROP_HEALTH : +if (!charger->fault) + val->intval =POWER_SUPPLY_HEALTH_GOOD ; +if (MP2629_FAULT_BATTERY & charger->fault) + val->intval =POWER_SUPPLY_HEALTH_OVERVOLTAGE ; +else if (MP2629_FAULT_THERMAL & charger->fault) + val->intval =POWER_SUPPLY_HEALTH_OVERHEAT ; +else if (MP2629_FAULT_INPUT & charger->fault) + val->intval =POWER_SUPPLY_HEALTH_OVERVOLTAGE ; +break ; + +case POWER_SUPPLY_PROP_STATUS : + ret =regmap_read (charger->regmap,MP2629_REG_STATUS , &rval); +if (ret) +break ; + + rval = (rval &MP2629_MASK_CHARGE_TYPE ) >>3 ; +switch (rval) { +case 0x00 : + val->intval =POWER_SUPPLY_STATUS_DISCHARGING ; +break ; +case 0x01 : +case 0x10 : + val->intval =POWER_SUPPLY_STATUS_CHARGING ; +break ; +case 0x11 : + val->intval =POWER_SUPPLY_STATUS_FULL ; + } +break ; + +case POWER_SUPPLY_PROP_CHARGE_TYPE : + ret =regmap_read (charger->regmap,MP2629_REG_STATUS , &rval); +if (ret) +break ; + + rval = (rval &MP2629_MASK_CHARGE_TYPE ) >>3 ; +switch (rval) { +case 0x00 : + val->intval =POWER_SUPPLY_CHARGE_TYPE_NONE ; +break ; +case 0x01 : + val->intval =POWER_SUPPLY_CHARGE_TYPE_TRICKLE ; +break ; +case 0x10 : + val->intval =POWER_SUPPLY_CHARGE_TYPE_STANDARD ; +break ; +default : + val->intval =POWER_SUPPLY_CHARGE_TYPE_UNKNOWN ; + } +break ; + +default : +return -EINVAL ; + } + +return ret; +} + +static int mp2629_charger_battery_set_prop (struct power_supply *psy, +enum power_supply_property psp, +const union power_supply_propval *val) +{ +struct mp2629_charger *charger =dev_get_drvdata (psy->dev.parent); + +switch (psp) { +case POWER_SUPPLY_PROP_CHARGE_TERM_CURRENT : +return mp2629_set_prop (charger,TERM_CURRENT , val); + +case POWER_SUPPLY_PROP_PRECHARGE_CURRENT : +return mp2629_set_prop (charger,PRECHARGE , val); + +case POWER_SUPPLY_PROP_CONSTANT_CHARGE_VOLTAGE : +return mp2629_set_prop (charger,CHARGE_VLIM , val); + +case POWER_SUPPLY_PROP_CONSTANT_CHARGE_CURRENT : +return mp2629_set_prop (charger,CHARGE_ILIM , val); + +default : +return -EINVAL ; + } +} + +static int mp2629_charger_usb_get_prop (struct power_supply *psy, +enum power_supply_property psp, +union power_supply_propval *val) +{ +struct mp2629_charger *charger =dev_get_drvdata (psy->dev.parent); +unsigned int rval; +int ret; + +switch (psp) { +case POWER_SUPPLY_PROP_ONLINE : + ret =regmap_read (charger->regmap,MP2629_REG_STATUS , &rval); +if (ret) +break ; + + val->intval = !!(rval &MP2629_MASK_INPUT_TYPE ); +break ; + +case POWER_SUPPLY_PROP_USB_TYPE : + ret =regmap_read (charger->regmap,MP2629_REG_STATUS , &rval); +if (ret) +break ; + + rval = (rval &MP2629_MASK_INPUT_TYPE ) >>5 ; +switch (rval) { +case MP2629_SOURCE_TYPE_SDP : + val->intval =POWER_SUPPLY_USB_TYPE_SDP ; +break ; +case MP2629_SOURCE_TYPE_CDP : + val->intval =POWER_SUPPLY_USB_TYPE_CDP ; +break ; +case MP2629_SOURCE_TYPE_DCP : + val->intval =POWER_SUPPLY_USB_TYPE_DCP ; +break ; +case MP2629_SOURCE_TYPE_OTG : + val->intval =POWER_SUPPLY_USB_TYPE_PD_DRP ; +break ; +default : + val->intval =POWER_SUPPLY_USB_TYPE_UNKNOWN ; +break ; + } +break ; + +case POWER_SUPPLY_PROP_VOLTAGE_NOW : + ret =mp2629_read_adc (charger,MP2629_INPUT_VOLT , val); +break ; + +case POWER_SUPPLY_PROP_CURRENT_NOW : + ret =mp2629_read_adc (charger,MP2629_INPUT_CURRENT , val); +break ; + +case POWER_SUPPLY_PROP_INPUT_VOLTAGE_LIMIT : + ret =mp2629_get_prop (charger,INPUT_VLIM , val); +break ; + +case POWER_SUPPLY_PROP_INPUT_CURRENT_LIMIT : + ret =mp2629_get_prop (charger,INPUT_ILIM , val); +break ; + +default : +return -EINVAL ; + } + +return ret; +} + +static int mp2629_charger_usb_set_prop (struct power_supply *psy, +enum power_supply_property psp, +const union power_supply_propval *val) +{ +struct mp2629_charger *charger =dev_get_drvdata (psy->dev.parent); + +switch (psp) { +case POWER_SUPPLY_PROP_INPUT_VOLTAGE_LIMIT : +return mp2629_set_prop (charger,INPUT_VLIM , val); + +case POWER_SUPPLY_PROP_INPUT_CURRENT_LIMIT : +return mp2629_set_prop (charger,INPUT_ILIM , val); + +default : +return -EINVAL ; + } +} + +static int mp2629_charger_battery_prop_writeable (struct power_supply *psy, +enum power_supply_property psp) +{ +return (psp ==POWER_SUPPLY_PROP_PRECHARGE_CURRENT ) || + (psp ==POWER_SUPPLY_PROP_CHARGE_TERM_CURRENT ) || + (psp ==POWER_SUPPLY_PROP_CONSTANT_CHARGE_CURRENT ) || + (psp ==POWER_SUPPLY_PROP_CONSTANT_CHARGE_VOLTAGE ); +} + +static int mp2629_charger_usb_prop_writeable (struct power_supply *psy, +enum power_supply_property psp) +{ +return (psp ==POWER_SUPPLY_PROP_INPUT_VOLTAGE_LIMIT ) || + (psp ==POWER_SUPPLY_PROP_INPUT_CURRENT_LIMIT ); +} + +static irqreturn_t mp2629_irq_handler (int irq,void *dev_id) +{ +struct mp2629_charger *charger = dev_id; +unsigned int rval; +int ret; +
drivers/power/supply/mp2629_charger.c line 461
Quoted 10 lines
drivers/power/supply/mp2629_charger.c new file +10
-0+mutex_lock (&charger->lock); + + ret =regmap_read (charger->regmap,MP2629_REG_FAULT , &rval); +if (ret) + goto unlock; + +if (rval) { + charger->fault = rval; +if (MP2629_FAULT_BATTERY & rval) +dev_err (charger->dev,"Battery fault OVP" );
dev_err message wants \n at the end
Quoted 207 lines
drivers/power/supply/mp2629_charger.c new file +206
-0+else if (MP2629_FAULT_THERMAL & rval) +dev_err (charger->dev,"Thermal shutdown fault" ); +else if (MP2629_FAULT_INPUT & rval) +dev_err (charger->dev,"no input or input OVP" ); +else if (MP2629_FAULT_OTG & rval) +dev_err (charger->dev,"VIN overloaded" ); + + goto unlock; + } + + ret =regmap_read (charger->regmap,MP2629_REG_STATUS , &rval); +if (ret) + goto unlock; + +if (rval &MP2629_INPUTSOURCE_CHANGE ) +power_supply_changed (charger->usb); +else if (rval &MP2629_CHARGING_CHANGE ) +power_supply_changed (charger->battery); + +unlock: +mutex_unlock (&charger->lock); + +return IRQ_HANDLED ; +} + +static const struct power_supply_desc mp2629_usb_desc = { + .name ="mp2629_usb" , + .type =POWER_SUPPLY_TYPE_USB , + .usb_types = mp2629_usb_types, + .num_usb_types =ARRAY_SIZE (mp2629_usb_types), + .properties = mp2629_charger_usb_props, + .num_properties =ARRAY_SIZE (mp2629_charger_usb_props), + .get_property = mp2629_charger_usb_get_prop, + .set_property = mp2629_charger_usb_set_prop, + .property_is_writeable = mp2629_charger_usb_prop_writeable, +}; + +static const struct power_supply_desc mp2629_battery_desc = { + .name ="mp2629_battery" , + .type =POWER_SUPPLY_TYPE_BATTERY , + .properties = mp2629_charger_bat_props, + .num_properties =ARRAY_SIZE (mp2629_charger_bat_props), + .get_property = mp2629_charger_battery_get_prop, + .set_property = mp2629_charger_battery_set_prop, + .property_is_writeable = mp2629_charger_battery_prop_writeable, +}; + +static ssize_t batt_impedance_compensation_show (struct device *dev, +struct device_attribute *attr, +char *buf) +{ +struct mp2629_charger *charger =dev_get_drvdata (dev->parent); +unsigned int rval; +int ret; + + ret =regmap_read (charger->regmap,MP2629_REG_IMPEDANCE_COMP , &rval); +if (ret) +return ret; + + rval = (rval >>4 ) *10 ; +return sprintf (buf,"%d mohm\n" , rval); +} + +static ssize_t batt_impedance_compensation_store (struct device *dev, +struct device_attribute *attr, +const char *buf, +size_t count) +{ +struct mp2629_charger *charger =dev_get_drvdata (dev->parent); +unsigned int val; +int ret; + + ret =kstrtouint (buf,10 , &val); +if (ret) +return ret; + +if (val >140 ) +return -ERANGE ; + +/* multiples of 10 mohm so round off */ + val = val /10 ; + ret =regmap_update_bits (charger->regmap,MP2629_REG_IMPEDANCE_COMP , +MP2629_MASK_IMPEDANCE , val <<4 ); +if (ret) +return ret; + +return count; +} + +static DEVICE_ATTR_RW (batt_impedance_compensation); + +static struct attribute *mp2629_charger_sysfs_attrs[] = { + &dev_attr_batt_impedance_compensation.attr, +NULL +}; +ATTRIBUTE_GROUPS (mp2629_charger_sysfs); + +static int mp2629_charger_probe (struct platform_device *pdev) +{ +struct device *dev = &pdev->dev; +struct mp2629_info *ddata =dev_get_drvdata (dev->parent); +struct mp2629_charger *charger; +struct power_supply_config psy_cfg = {}; +int ret, i, irq; + + charger =devm_kzalloc (dev,sizeof (*charger),GFP_KERNEL ); +if (!charger) +return -ENOMEM ; + + charger->regmap = ddata->regmap; + charger->dev = dev; +platform_set_drvdata (pdev, charger); + + irq =platform_get_irq_optional (to_platform_device (dev->parent),0 ); +if (irq <0 ) { +dev_err (dev,"get irq fail: %d\n" , irq); +return irq; + } + +for (i =0 ; i <MP2629_MAX_FIELD ; i++) { + charger->regmap_fields[i] =devm_regmap_field_alloc (dev, + charger->regmap, mp2629_reg_fields[i]); +if (IS_ERR (charger->regmap_fields[i])) { +dev_err (dev,"regmap field alloc fail %d\n" , i); +return PTR_ERR (charger->regmap_fields[i]); + } + } + +for (i =0 ; i <MP2629_ADC_CHAN_END ; i++) { + charger->iiochan[i] =devm_iio_channel_get (dev, + adc_chan_name[i]); +if (IS_ERR (charger->iiochan[i])) { +dev_err (dev,"iio chan get %s err\n" , adc_chan_name[i]); +return PTR_ERR (charger->iiochan[i]); + } + } + + charger->usb =devm_power_supply_register (dev, &mp2629_usb_desc,NULL ); +if (IS_ERR (charger->usb)) { +dev_err (dev,"power supply register usb failed\n" ); +return PTR_ERR (charger->usb); + } + + psy_cfg.drv_data = charger; + psy_cfg.attr_grp = mp2629_charger_sysfs_groups; + charger->battery =devm_power_supply_register (dev, + &mp2629_battery_desc, &psy_cfg); +if (IS_ERR (charger->battery)) { +dev_err (dev,"power supply register battery failed\n" ); +return PTR_ERR (charger->battery); + } + + ret =regmap_update_bits (charger->regmap,MP2629_REG_CHARGE_CTRL , +MP2629_MASK_CHARGE_CTRL ,BIT (4 )); +if (ret) { +dev_err (dev,"enable charge fail: %d\n" , ret); +return ret; + } + +regmap_update_bits (charger->regmap,MP2629_REG_TIMER_CTRL , +MP2629_MASK_WDOG_CTRL ,0 ); + +mutex_init (&charger->lock); + + ret =devm_request_threaded_irq (dev, irq,NULL , mp2629_irq_handler, +IRQF_ONESHOT |IRQF_TRIGGER_RISING , +"mp2629-charger" , charger); +if (ret) { +dev_err (dev,"failed to request gpio IRQ\n" ); +return ret; + } + +regmap_update_bits (charger->regmap,MP2629_REG_INTERRUPT , +GENMASK (6 ,5 ),BIT (6 ) |BIT (5 )); + +return 0 ; +} + +static int mp2629_charger_remove (struct platform_device *pdev) +{ +struct mp2629_charger *charger =platform_get_drvdata (pdev); + +regmap_update_bits (charger->regmap,MP2629_REG_CHARGE_CTRL , +MP2629_MASK_CHARGE_CTRL ,0 ); +return 0 ; +} + +static const struct of_device_id mp2629_charger_of_match[] = { + { .compatible ="mps,mp2629_charger" }, + {} +}; +MODULE_DEVICE_TABLE (of, mp2629_charger_of_match); + +static struct platform_driver mp2629_charger_driver = { + .driver = { + .name ="mp2629_charger" , + .of_match_table = mp2629_charger_of_match, + }, + .probe = mp2629_charger_probe, + .remove = mp2629_charger_remove, +}; +module_platform_driver (mp2629_charger_driver); + +MODULE_AUTHOR ("Saravanan Sekar <[email protected]>" ); +MODULE_DESCRIPTION ("MP2629 Charger driver" ); +MODULE_LICENSE ("GPL" );
Signature · 2 lines
Peter Meerwald-Stadler Mobile: +43 664 24 44 418
Saravanan Sekar
maintainerPATCH v9 5/6 power: supply: mp2629: Add impedance compenstation 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 compenstation 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 v9 5/6] power: supply: mp2629: Add impedance compenstation config
On Wed, 15 Apr 2020, Saravanan Sekar wrote:
subject: compensation
comments below
Quoted 15 lines
Allows the user to compensate the intrinsic resistance of the battery to accelerate the charging cycle.
Signed-off-by Saravanan Sekar <[email protected]>--- 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 +0
-0
Documentation/ABI/testing/sysfs-class-power-mp2629 line 5
Quoted 5 lines
Documentation/ABI/testing/sysfs-class-power-mp2629 new file +5
-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 compenstation to accelerate charging.
compensation
Quoted 4 lines
Documentation/ABI/testing/sysfs-class-power-mp2629 new file +3
-0+ + Access: Read, Write + Valid values: Represented in milli-ohms. Valid range is [0, 140].
Signature · 2 lines
Peter Meerwald-Stadler Mobile: +43 664 24 44 418
Saravanan Sekar
maintainerPATCH v9 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
Quoted 5 lines · Saravanan Sekar
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"
May I ask you why you are ignoring my tag?
If you don't want to have your patches reviewed / applied, just don't send them.
Quoted 71 lines
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 compenstation config
MAINTAINERS: Add entry for mp2629 Battery Charger driver.../ABI/testing/sysfs-class-power-mp2629 | 8 + .../devicetree/bindings/mfd/mps,mp2629.yaml | 60 ++ 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 | 86 +++ drivers/power/supply/Kconfig | 10 + drivers/power/supply/Makefile | 1 + drivers/power/supply/mp2629_charger.c | 667 ++++++++++++++++++ include/linux/mfd/mp2629.h | 28 + 13 files changed, 1095 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--
2.17.1
Signature · 2 lines
With Best Regards, Andy Shevchenko
saravanan sekar
maintainerHi Andy,
Quoted 7 lines · Andy Shevchenko
Quoted 4 lines · Saravanan Sekar
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"May I ask you why you are ignoring my tag?
If you don't want to have your patches reviewed / applied, just don't send them.
Sorry last time it was by mistake. But now I have added in below, if suppose to added in top its my ignorance
Quoted 5 lines
Quoted 5 lines
changes in v8:
- fixed order of call in probe/remove in iio adc
- add ABI documentation for mp2629 power supply
Quoted 8 lines
Quoted 8 lines
changes 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.
Please see here, this is first experience of tag in cover letter so just kept here as you gave against v7
Quoted 60 lines
Quoted 59 lines
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 compenstation config
MAINTAINERS: Add entry for mp2629 Battery Charger driver.../ABI/testing/sysfs-class-power-mp2629 | 8 + .../devicetree/bindings/mfd/mps,mp2629.yaml | 60 ++ 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 | 86 +++ drivers/power/supply/Kconfig | 10 + drivers/power/supply/Makefile | 1 + drivers/power/supply/mp2629_charger.c | 667 ++++++++++++++++++ include/linux/mfd/mp2629.h | 28 + 13 files changed, 1095 insertions(+)create mode 100644
Documentation/ABI/testing/sysfs-class-power-mp2629create mode 100644Documentation/devicetree/bindings/mfd/mps,mp2629.yamlcreate mode 100644drivers/iio/adc/mp2629_adc.c
create mode 100644drivers/mfd/mp2629.c
create mode 100644drivers/power/supply/mp2629_charger.ccreate mode 100644include/linux/mfd/mp2629.h--
2.17.1
Quoted 9 lines · saravanan sekar
Hi Andy,
Quoted 5 lines · Andy Shevchenko
Quoted 4 lines · Saravanan Sekar
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"
Quoted 6 lines
Quoted 2 lines
May I ask you why you are ignoring my tag?
If you don't want to have your patches reviewed / applied, just don't send them.Sorry last time it was by mistake. But now I have added in below, if suppose to added in top its my ignorance
Ah, I see now. The idea of the tag given against cover letter that it applies to entire series (if doesn't say otherwise).
It means, if you don't do any (drastic) changes to the patches, the tag is still valid and you simple add it to each patch in the series inside the commit message (usually after your SoB tag).
Quoted 77 lines
Quoted 4 lines
Quoted 4 lines
changes in v8:
- fixed order of call in probe/remove in iio adc
- add ABI documentation for mp2629 power supplyQuoted 8 lines
Quoted 8 lines
changes 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.
Please see here, this is first experience of tag in cover letter so just kept here as you gave against v7
Quoted 60 lines
Quoted 59 lines
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 compenstation config
MAINTAINERS: Add entry for mp2629 Battery Charger driver.../ABI/testing/sysfs-class-power-mp2629 | 8 + .../devicetree/bindings/mfd/mps,mp2629.yaml | 60 ++ 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 | 86 +++ drivers/power/supply/Kconfig | 10 + drivers/power/supply/Makefile | 1 + drivers/power/supply/mp2629_charger.c | 667 ++++++++++++++++++ include/linux/mfd/mp2629.h | 28 + 13 files changed, 1095 insertions(+)create mode 100644
Documentation/ABI/testing/sysfs-class-power-mp2629create mode 100644Documentation/devicetree/bindings/mfd/mps,mp2629.yamlcreate mode 100644drivers/iio/adc/mp2629_adc.c
create mode 100644drivers/mfd/mp2629.c
create mode 100644drivers/power/supply/mp2629_charger.ccreate mode 100644include/linux/mfd/mp2629.h--
2.17.1
Signature · 2 lines
With Best Regards, Andy Shevchenko