mbox series

[00/10] power: supply: ab8500: refactor and isolate

Message ID 20210123221908.2993388-1-linus.walleij@linaro.org
Headers show
Series power: supply: ab8500: refactor and isolate | expand

Message

Linus Walleij Jan. 23, 2021, 10:18 p.m. UTC
The AB8500 code was merged in 2012 and hasn't seen
much love in the years since that, but the code is
needed by the PostmarketOS community.
commit a1149ae975547142f78e96745a994cb9b0e98fd2
("ARM: ux500: Disable Power Supply and Battery Management by default")
disabled the use of the code in 2013 mentioning that
"drivers are more than a little bit broken".

Charging is nice. The platform is not unused. Let's
begin to fix this.

This patch set does a bunch of things to the AB8500
charger code:

- Cleans out non-devicetree code as we are now always
  probing Ux500 and AB8500 from the device tree.

- Breaks the ties to the MFD subsystem and pushes the
  charging-related headers down to power/supply/*
  these headers were shared in include/linux/mfd in
  order to support board files, and with device tree
  that is unnecessary.

- Bind all subdrivers using the driver component
  model which is common in the DRM subsystem, and as
  a consequence we know the order the subdrivers are
  initialized and we can cut the code that is just
  there to satisfy the case where the drivers probe
  in different order.

- Add some minor code that makes the drivers actually
  work (it was very close).

Right now it has dependencies on the MFD tree (this
series is based on thefor-mfd-next branch) due to a
renaming of the cell macro so the best would be if Lee
could merge it, at least partly. I am also fine if
we only merge patches 1 thru 4 into MFD this merge
window to isolate the charger code into drivers/power
so we can continue next merge window with the rest
of the code.

Linus Walleij (10):
  power: supply: ab8500: Require device tree
  power: supply: ab8500: Push data to power supply code
  power: supply: ab8500: Push algorithm to power supply code
  power: supply: ab8500: Push data to power supply code
  power: supply: ab8500: Move to componentized binding
  power: supply: ab8500: Call battery population once
  power: supply: ab8500: Avoid NULL pointers
  power: supply: ab8500: Enable USB and AC
  power: supply: ab8500: Drop unused member
  power: supply: ab8500_bmdata: Use standard phandle

 drivers/mfd/ab8500-core.c                     |  17 +-
 drivers/power/supply/Kconfig                  |   2 +-
 .../power/supply}/ab8500-bm.h                 | 298 ++++++++++++-
 .../power/supply/ab8500-chargalg.h            |   6 +-
 drivers/power/supply/ab8500_bmdata.c          |   6 +-
 drivers/power/supply/ab8500_btemp.c           | 162 +++----
 drivers/power/supply/ab8500_charger.c         | 406 ++++++++++--------
 drivers/power/supply/ab8500_fg.c              | 154 +++----
 drivers/power/supply/abx500_chargalg.c        | 129 +++---
 drivers/power/supply/pm2301_charger.c         |   4 +-
 include/linux/mfd/abx500.h                    | 276 ------------
 11 files changed, 720 insertions(+), 740 deletions(-)
 rename {include/linux/mfd/abx500 => drivers/power/supply}/ab8500-bm.h (58%)
 rename include/linux/mfd/abx500/ux500_chargalg.h => drivers/power/supply/ab8500-chargalg.h (93%)

-- 
2.29.2

Comments

Sebastian Reichel Jan. 28, 2021, 12:17 a.m. UTC | #1
Hi,

On Sat, Jan 23, 2021 at 11:18:58PM +0100, Linus Walleij wrote:
> The AB8500 code was merged in 2012 and hasn't seen

> much love in the years since that, but the code is

> needed by the PostmarketOS community.

> commit a1149ae975547142f78e96745a994cb9b0e98fd2

> ("ARM: ux500: Disable Power Supply and Battery Management by default")

> disabled the use of the code in 2013 mentioning that

> "drivers are more than a little bit broken".

> 

> Charging is nice. The platform is not unused. Let's

> begin to fix this.

> 

> This patch set does a bunch of things to the AB8500

> charger code:

> 

> - Cleans out non-devicetree code as we are now always

>   probing Ux500 and AB8500 from the device tree.

> 

> - Breaks the ties to the MFD subsystem and pushes the

>   charging-related headers down to power/supply/*

>   these headers were shared in include/linux/mfd in

>   order to support board files, and with device tree

>   that is unnecessary.

> 

> - Bind all subdrivers using the driver component

>   model which is common in the DRM subsystem, and as

>   a consequence we know the order the subdrivers are

>   initialized and we can cut the code that is just

>   there to satisfy the case where the drivers probe

>   in different order.

> 

> - Add some minor code that makes the drivers actually

>   work (it was very close).

> 

> Right now it has dependencies on the MFD tree (this

> series is based on thefor-mfd-next branch) due to a

> renaming of the cell macro so the best would be if Lee

> could merge it, at least partly. I am also fine if

> we only merge patches 1 thru 4 into MFD this merge

> window to isolate the charger code into drivers/power

> so we can continue next merge window with the rest

> of the code.


Patches 1-4 and 6-9 are

Acked-by: Sebastian Reichel <sebastian.reichel@collabora.com>


I think best solution would be to merge patches 1-4 using
an immutable branch based on v5.11-rc1 and Lee fixing the
trivial conflict when merging the immutable branch into
his tree. That way I can also merge it into the power-supply
tree and take the remaining patches (but I actually have
feedback/questions for patch 5 and 10).

-- Sebastian

> Linus Walleij (10):

>   power: supply: ab8500: Require device tree

>   power: supply: ab8500: Push data to power supply code

>   power: supply: ab8500: Push algorithm to power supply code

>   power: supply: ab8500: Push data to power supply code

>   power: supply: ab8500: Move to componentized binding

>   power: supply: ab8500: Call battery population once

>   power: supply: ab8500: Avoid NULL pointers

>   power: supply: ab8500: Enable USB and AC

>   power: supply: ab8500: Drop unused member

>   power: supply: ab8500_bmdata: Use standard phandle

> 

>  drivers/mfd/ab8500-core.c                     |  17 +-

>  drivers/power/supply/Kconfig                  |   2 +-

>  .../power/supply}/ab8500-bm.h                 | 298 ++++++++++++-

>  .../power/supply/ab8500-chargalg.h            |   6 +-

>  drivers/power/supply/ab8500_bmdata.c          |   6 +-

>  drivers/power/supply/ab8500_btemp.c           | 162 +++----

>  drivers/power/supply/ab8500_charger.c         | 406 ++++++++++--------

>  drivers/power/supply/ab8500_fg.c              | 154 +++----

>  drivers/power/supply/abx500_chargalg.c        | 129 +++---

>  drivers/power/supply/pm2301_charger.c         |   4 +-

>  include/linux/mfd/abx500.h                    | 276 ------------

>  11 files changed, 720 insertions(+), 740 deletions(-)

>  rename {include/linux/mfd/abx500 => drivers/power/supply}/ab8500-bm.h (58%)

>  rename include/linux/mfd/abx500/ux500_chargalg.h => drivers/power/supply/ab8500-chargalg.h (93%)

> 

> -- 

> 2.29.2

>