mbox series

[V4,00/15] Add Battery and USB Supply for AXP717

Message ID 20240821215456.962564-1-macroalpha82@gmail.com
Headers show
Series Add Battery and USB Supply for AXP717 | expand

Message

Chris Morgan Aug. 21, 2024, 9:54 p.m. UTC
From: Chris Morgan <macromorgan@hotmail.com>

Add support for monitoring the USB charger and battery charger on the
AXP717 PMIC. This required some driver refactoring of the axp20x USB
and battery charger as the AXP717 is somewhat different but can still
benefit from some common elements.

Note that as of now the charging current now value may be incorrect as
the scale and offsets were not documented in the datasheet. I suspect
the scale is 1 and the offset is somewhere around 450mA though.

Changes from V3:
 - Remove accidental AXP717_BOOST regulator in header file, as it is
   not part of this patch series.
 - Add an absolute min/max constraint for input-current-limit-microamp
   in device tree documentation.
 - Correct an issue found by kernel test robot <lkp@intel.com> by
   explicitly adding linux/bitfield.h include. Details here:
   https://lore.kernel.org/oe-kbuild-all/202408201228.Hee4eSYl-lkp@intel.com/

Changes from V2:
 - Added constraints for input-current-limit-microamp constraints for
   x-powers,axp20x-usb-power-supply.yaml.
 - Used FIELD_GET() and removed unnecessary -EINVAL per comments from
   Jonathan Cameron.

Changes from V1:
 - Refactored against mainline to remove BOOST pre-requisite.
 - Corrected commit subjects for DT bindings.
 - Split refactoring and AXP717 support into different patches.
 - Added IRQ for VBUS over voltage. There appears to be a bug
   with the VBUS fault IRQ because it is assigned IRQ num 0.
 - Corrected battery driver to report POWER_SUPPLY_PROP_VOLTAGE_MIN
   and POWER_SUPPLY_PROP_VOLTAGE_MAX instead of *_DESIGN.


Chris Morgan (15):
  iio: adc: axp20x_adc: Add adc_en1 and adc_en2 to axp_data
  power: supply: axp20x_battery: Remove design from min and max voltage
  power: supply: axp20x_battery: Make iio and battery config per device
  power: supply: axp20x_usb_power: Make VBUS and IIO config per device
  dt-bindings: power: supply: axp20x: Add input-current-limit-microamp
  power: supply: axp20x_usb_power: add input-current-limit-microamp
  dt-bindings: power: supply: axp20x-battery: Add monitored-battery
  dt-bindings: iio: adc: Add AXP717 compatible
  dt-bindings: power: supply: axp20x: Add AXP717 compatible
  dt-bindings: power: supply: axp20x: Add AXP717 compatible
  mfd: axp20x: Add ADC, BAT, and USB cells for AXP717
  iio: adc: axp20x_adc: add support for AXP717 ADC
  power: supply: axp20x_usb_power: Add support for AXP717
  power: supply: axp20x_battery: add support for AXP717
  arm64: dts: allwinner: h700: Add charger for Anbernic RG35XX

 .../bindings/iio/adc/x-powers,axp209-adc.yaml |  12 +
 .../x-powers,axp20x-battery-power-supply.yaml |   7 +
 .../x-powers,axp20x-usb-power-supply.yaml     |  72 ++-
 .../sun50i-h700-anbernic-rg35xx-2024.dts      |  21 +
 drivers/iio/adc/axp20x_adc.c                  | 182 +++++-
 drivers/mfd/axp20x.c                          |  25 +-
 drivers/power/supply/axp20x_battery.c         | 591 ++++++++++++++++--
 drivers/power/supply/axp20x_usb_power.c       | 353 ++++++++++-
 include/linux/mfd/axp20x.h                    |  26 +
 9 files changed, 1188 insertions(+), 101 deletions(-)

Comments

Sebastian Reichel Aug. 27, 2024, 4:25 p.m. UTC | #1
On Wed, 21 Aug 2024 16:54:41 -0500, Chris Morgan wrote:
> From: Chris Morgan <macromorgan@hotmail.com>
> 
> Add support for monitoring the USB charger and battery charger on the
> AXP717 PMIC. This required some driver refactoring of the axp20x USB
> and battery charger as the AXP717 is somewhat different but can still
> benefit from some common elements.
> 
> [...]

Applied, thanks!

[02/15] power: supply: axp20x_battery: Remove design from min and max voltage
        commit: 61978807b00f8a1817b0e5580981af1cd2f428a5
[03/15] power: supply: axp20x_battery: Make iio and battery config per device
        commit: db97fecb55cee4eed2f8dcdc17c4831719cbfe4d
[04/15] power: supply: axp20x_usb_power: Make VBUS and IIO config per device
        commit: ae640fc690353f6181740b50a0d6761bc67ebaa9
[05/15] dt-bindings: power: supply: axp20x: Add input-current-limit-microamp
        commit: 6f5cdb7ec8836bb5e5ab221c2f49e2b170d5a978
[06/15] power: supply: axp20x_usb_power: add input-current-limit-microamp
        commit: 6934da720aac7b0feb99d08ff27fd245a962d8d2
[07/15] dt-bindings: power: supply: axp20x-battery: Add monitored-battery
        commit: dc123a1a80933b7fba1cf53cec77c2425268ff85

Best regards,
Lee Jones Aug. 29, 2024, 12:17 p.m. UTC | #2
On Wed, 21 Aug 2024, Chris Morgan wrote:

> From: Chris Morgan <macromorgan@hotmail.com>
> 
> Add support for monitoring the USB charger and battery charger on the
> AXP717 PMIC. This required some driver refactoring of the axp20x USB
> and battery charger as the AXP717 is somewhat different but can still
> benefit from some common elements.
> 
> Note that as of now the charging current now value may be incorrect as
> the scale and offsets were not documented in the datasheet. I suspect
> the scale is 1 and the offset is somewhere around 450mA though.
> 
> Changes from V3:
>  - Remove accidental AXP717_BOOST regulator in header file, as it is
>    not part of this patch series.
>  - Add an absolute min/max constraint for input-current-limit-microamp
>    in device tree documentation.
>  - Correct an issue found by kernel test robot <lkp@intel.com> by
>    explicitly adding linux/bitfield.h include. Details here:
>    https://lore.kernel.org/oe-kbuild-all/202408201228.Hee4eSYl-lkp@intel.com/
> 
> Changes from V2:
>  - Added constraints for input-current-limit-microamp constraints for
>    x-powers,axp20x-usb-power-supply.yaml.
>  - Used FIELD_GET() and removed unnecessary -EINVAL per comments from
>    Jonathan Cameron.
> 
> Changes from V1:
>  - Refactored against mainline to remove BOOST pre-requisite.
>  - Corrected commit subjects for DT bindings.
>  - Split refactoring and AXP717 support into different patches.
>  - Added IRQ for VBUS over voltage. There appears to be a bug
>    with the VBUS fault IRQ because it is assigned IRQ num 0.
>  - Corrected battery driver to report POWER_SUPPLY_PROP_VOLTAGE_MIN
>    and POWER_SUPPLY_PROP_VOLTAGE_MAX instead of *_DESIGN.
> 
> 
> Chris Morgan (15):
>   iio: adc: axp20x_adc: Add adc_en1 and adc_en2 to axp_data
>   power: supply: axp20x_battery: Remove design from min and max voltage
>   power: supply: axp20x_battery: Make iio and battery config per device
>   power: supply: axp20x_usb_power: Make VBUS and IIO config per device
>   dt-bindings: power: supply: axp20x: Add input-current-limit-microamp
>   power: supply: axp20x_usb_power: add input-current-limit-microamp
>   dt-bindings: power: supply: axp20x-battery: Add monitored-battery
>   dt-bindings: iio: adc: Add AXP717 compatible
>   dt-bindings: power: supply: axp20x: Add AXP717 compatible
>   dt-bindings: power: supply: axp20x: Add AXP717 compatible
>   mfd: axp20x: Add ADC, BAT, and USB cells for AXP717
>   iio: adc: axp20x_adc: add support for AXP717 ADC
>   power: supply: axp20x_usb_power: Add support for AXP717
>   power: supply: axp20x_battery: add support for AXP717
>   arm64: dts: allwinner: h700: Add charger for Anbernic RG35XX
> 
>  .../bindings/iio/adc/x-powers,axp209-adc.yaml |  12 +
>  .../x-powers,axp20x-battery-power-supply.yaml |   7 +
>  .../x-powers,axp20x-usb-power-supply.yaml     |  72 ++-
>  .../sun50i-h700-anbernic-rg35xx-2024.dts      |  21 +
>  drivers/iio/adc/axp20x_adc.c                  | 182 +++++-
>  drivers/mfd/axp20x.c                          |  25 +-
>  drivers/power/supply/axp20x_battery.c         | 591 ++++++++++++++++--
>  drivers/power/supply/axp20x_usb_power.c       | 353 ++++++++++-
>  include/linux/mfd/axp20x.h                    |  26 +
>  9 files changed, 1188 insertions(+), 101 deletions(-)

Note to self: Send ib-mfd-for-iio-power-6.12 once tested
Sebastian Reichel Sept. 3, 2024, 9:57 p.m. UTC | #3
On Wed, 21 Aug 2024 16:54:41 -0500, Chris Morgan wrote:
> From: Chris Morgan <macromorgan@hotmail.com>
> 
> Add support for monitoring the USB charger and battery charger on the
> AXP717 PMIC. This required some driver refactoring of the axp20x USB
> and battery charger as the AXP717 is somewhat different but can still
> benefit from some common elements.
> 
> [...]

Applied, thanks!

[09/15] dt-bindings: power: supply: axp20x: Add AXP717 compatible
        commit: e44c5691822962dc6f50793029bef5e71f5b0a62
[10/15] dt-bindings: power: supply: axp20x: Add AXP717 compatible
        commit: e44c5691822962dc6f50793029bef5e71f5b0a62
[13/15] power: supply: axp20x_usb_power: Add support for AXP717
        commit: 75098176d17fab88c06120b453b4b0d1641e2a41
[14/15] power: supply: axp20x_battery: add support for AXP717
        commit: 6625767049c2e0960ba9835392a6ef9143170be6

Best regards,
Chen-Yu Tsai Sept. 4, 2024, 2:56 p.m. UTC | #4
On Wed, 21 Aug 2024 16:54:41 -0500, Chris Morgan wrote:
> From: Chris Morgan <macromorgan@hotmail.com>
> 
> Add support for monitoring the USB charger and battery charger on the
> AXP717 PMIC. This required some driver refactoring of the axp20x USB
> and battery charger as the AXP717 is somewhat different but can still
> benefit from some common elements.
> 
> [...]

Applied to sunxi/for-next in sunxi/linux.git, thanks!

[15/15] arm64: dts: allwinner: h700: Add charger for Anbernic RG35XX
        https://git.kernel.org/sunxi/linux/c/6b5502c1d43d

Best regards,
Jonathan Cameron Sept. 7, 2024, 1:30 p.m. UTC | #5
On Wed, 21 Aug 2024 16:54:41 -0500
Chris Morgan <macroalpha82@gmail.com> wrote:

> From: Chris Morgan <macromorgan@hotmail.com>
> 
> Add support for monitoring the USB charger and battery charger on the
> AXP717 PMIC. This required some driver refactoring of the axp20x USB
> and battery charger as the AXP717 is somewhat different but can still
> benefit from some common elements.
> 
> Note that as of now the charging current now value may be incorrect as
> the scale and offsets were not documented in the datasheet. I suspect
> the scale is 1 and the offset is somewhere around 450mA though.
Applied 1, 8 and 12 to the IIO togreg branch.

I was waiting for some mess related to my tree to pan out upstream.
Unfortunately that leaves us rather tight on timing for the coming
merge window but hopefully Greg will take a last minute pull request
for char-misc.

Jonathan

> 
> Changes from V3:
>  - Remove accidental AXP717_BOOST regulator in header file, as it is
>    not part of this patch series.
>  - Add an absolute min/max constraint for input-current-limit-microamp
>    in device tree documentation.
>  - Correct an issue found by kernel test robot <lkp@intel.com> by
>    explicitly adding linux/bitfield.h include. Details here:
>    https://lore.kernel.org/oe-kbuild-all/202408201228.Hee4eSYl-lkp@intel.com/
> 
> Changes from V2:
>  - Added constraints for input-current-limit-microamp constraints for
>    x-powers,axp20x-usb-power-supply.yaml.
>  - Used FIELD_GET() and removed unnecessary -EINVAL per comments from
>    Jonathan Cameron.
> 
> Changes from V1:
>  - Refactored against mainline to remove BOOST pre-requisite.
>  - Corrected commit subjects for DT bindings.
>  - Split refactoring and AXP717 support into different patches.
>  - Added IRQ for VBUS over voltage. There appears to be a bug
>    with the VBUS fault IRQ because it is assigned IRQ num 0.
>  - Corrected battery driver to report POWER_SUPPLY_PROP_VOLTAGE_MIN
>    and POWER_SUPPLY_PROP_VOLTAGE_MAX instead of *_DESIGN.
> 
> 
> Chris Morgan (15):
>   iio: adc: axp20x_adc: Add adc_en1 and adc_en2 to axp_data
>   power: supply: axp20x_battery: Remove design from min and max voltage
>   power: supply: axp20x_battery: Make iio and battery config per device
>   power: supply: axp20x_usb_power: Make VBUS and IIO config per device
>   dt-bindings: power: supply: axp20x: Add input-current-limit-microamp
>   power: supply: axp20x_usb_power: add input-current-limit-microamp
>   dt-bindings: power: supply: axp20x-battery: Add monitored-battery
>   dt-bindings: iio: adc: Add AXP717 compatible
>   dt-bindings: power: supply: axp20x: Add AXP717 compatible
>   dt-bindings: power: supply: axp20x: Add AXP717 compatible
>   mfd: axp20x: Add ADC, BAT, and USB cells for AXP717
>   iio: adc: axp20x_adc: add support for AXP717 ADC
>   power: supply: axp20x_usb_power: Add support for AXP717
>   power: supply: axp20x_battery: add support for AXP717
>   arm64: dts: allwinner: h700: Add charger for Anbernic RG35XX
> 
>  .../bindings/iio/adc/x-powers,axp209-adc.yaml |  12 +
>  .../x-powers,axp20x-battery-power-supply.yaml |   7 +
>  .../x-powers,axp20x-usb-power-supply.yaml     |  72 ++-
>  .../sun50i-h700-anbernic-rg35xx-2024.dts      |  21 +
>  drivers/iio/adc/axp20x_adc.c                  | 182 +++++-
>  drivers/mfd/axp20x.c                          |  25 +-
>  drivers/power/supply/axp20x_battery.c         | 591 ++++++++++++++++--
>  drivers/power/supply/axp20x_usb_power.c       | 353 ++++++++++-
>  include/linux/mfd/axp20x.h                    |  26 +
>  9 files changed, 1188 insertions(+), 101 deletions(-)
>