[U-Boot] [PATCH 00/19] [RFC] Power(full) framework based on Driver Model

Przemyslaw Marczak p.marczak at samsung.com
Wed Oct 8 22:55:33 CEST 2014


Hello all,

On 10/08/2014 10:48 PM, Przemyslaw Marczak wrote:
> Hello,
> This piece of code was a base for prepare my presentation talk
> for the U-Boot Mini Summit, which taking place at ELCE2014 conference,
> 13-th October 2014 Dusseldorf, Germany.
>
> The tittle of talk: "Power(full) framework based on Driver Model"
>
> The presentation will be shared after the Summit.
>
> This patchset introduces the new one PMIC framework for the U-Boot.
> It is still under the construction, but the basic functionality was
> achieved and tested. Please feel free to comment and share the opinion.
>
> I think that each patch is described full enough, but for some more design
> details, please look into the documentation file. It includes some basic
> examples for the PMIC drivers.
>
> Quick summary of:
> Framework:
> - The new approach - UCLASS_PMIC - simple and designed for device I/O only
> - Add new uclass types: UCLASS_PMIC and UCLASS_PMIC_REGULATOR
> - Two uclass drivers for above types
> - A common regulator operations - will easy cover the real devices design
>
> Drivers:
> - Introduce new PMIC API for drivers - now everything base on "struct udevice"
> - Introduce Regulator Voltage descriptors and Operation Mode descriptors
>    which are usually taken from the device tree (board dependent data)
> - Two uclass device drivers for MAX77686(PMIC+REGULATOR)
>
> User Interface:
> - command pmic, unchanged functionality and ported to the driver model
> - command regulator(NEW) for safe regulator setup from commandline,
>    - now can check output Voltage and operation mode of the regulators,
>    - also can check the board Voltage limits and driver available modes
>
> The future plans:
> - Wait for the I2c Driver Model implementation
> - Introduce a common way to bind pmic devices - now done by alias "pmic"
> - Add additional uclass types: MUIC, CHARGER, BATTERY, MFD and maybe more.
> - Introduce optimal operations for new uclasses
> - Port all U-Boot drivers to the new Framework
> - Remove the old drivers and the old PMIC Framework code
>
> The assumptions of this work is:
> - Add new code to independent files
> - Keep two Frameworks as independent and without conflicts
> - Don't mix OLD/NEW Framework code - for the readability
> - Port all drivers using new API
> - Remove the old Framework and the old drivers
>
> A disadvantage:
> - some parts of the present code is duplicated
>
> Need help:
> - After merge this, it is welcome to help with driver porting.
> - Everything should be tested
>
> The extra feature:
> The first commit introduces errno_str() function.
> It is a common function which I hope will be usefull for commands and not only.
> If any visible error says: -19 or some other magic number, then it means that
> this function should be used.
>
> U-Boot Mini Summit members:
> This code is maybe not as good as it could be, but the time was limited,
> and the conference is comming soon. I don't expects a code review of this
> now, but it would be nice if you take a look of this piece of code before
> our U-Boot Mini Summit. Of course it depends on you.
>
> Best Regards and see you in Dusseldorf!
> Przemyslaw Marczak
>
> Przemyslaw Marczak (19):
>    lib: errno: introduce errno_str(): returns errno related message
>    exynos: config-common: enable errno_str() function
>    exynos: config-common: enable generic fs command
>    dm: pmic: add implementation of driver model pmic uclass
>    dm: pmic: add implementation of driver model regulator uclass
>    dm: common: board_r: add call and weak of power_init_dm()
>    dm: pmic: add max77686 pmic driver
>    dm: regulator: add max77686 regulator driver
>    dm: pmic: new commands: pmic and regulator
>    dm: board:samsung: power_init_board: add requirement of CONFIG_DM_PMIC
>    doc: driver-model: pmic and regulator uclass documentation
>    samsung: board: lcd menu: check if any power framework is enabled
>    samsung: misc: power_key_pressed: add support to dm pmic framework
>    trats2: board: add support to dm pmic api
>    trats2: dts: max77686: add pmic alias and names cleanup
>    trats2: config: enable dm pmic, dm regulator api, dm max77686
>    odroid: board: add support to dm pmic api
>    odroid: dts: add 'voltage-regulators' description to max77686 node
>    odroid: config: enable dm pmic, dm regulator and max77686 driver
>
>   Makefile                               |   1 +
>   arch/arm/dts/exynos4412-odroid.dts     | 250 +++++++++-
>   arch/arm/dts/exynos4412-trats2.dts     |  17 +-
>   board/samsung/common/board.c           |   5 +-
>   board/samsung/common/misc.c            |  21 +-
>   board/samsung/odroid/odroid.c          |  31 +-
>   board/samsung/trats2/trats2.c          | 208 ++------
>   common/board_r.c                       |   8 +
>   doc/driver-model/dm-pmic-framework.txt | 450 ++++++++++++++++++
>   drivers/power/Makefile                 |   6 +-
>   drivers/power/cmd_pmic.c               | 845 +++++++++++++++++++++++++++++++++
>   drivers/power/pmic-uclass.c            | 255 ++++++++++
>   drivers/power/pmic/Makefile            |   1 +
>   drivers/power/pmic/max77686.c          |  89 ++++
>   drivers/power/pmic_i2c.c               | 136 ++++++
>   drivers/power/pmic_spi.c               | 137 ++++++
>   drivers/power/regulator-uclass.c       | 250 ++++++++++
>   drivers/power/regulator/Makefile       |   8 +
>   drivers/power/regulator/max77686.c     | 749 +++++++++++++++++++++++++++++
>   include/configs/exynos-common.h        |   3 +
>   include/configs/odroid.h               |   8 +-
>   include/configs/trats2.h               |  14 +-
>   include/dm/uclass-id.h                 |   4 +
>   include/errno.h                        |   3 +
>   include/power/max77686_pmic.h          |  28 +-
>   include/power/pmic.h                   |  82 ++++
>   include/power/regulator.h              | 267 +++++++++++
>   lib/Makefile                           |   1 +
>   lib/errno_str.c                        | 147 ++++++
>   29 files changed, 3823 insertions(+), 201 deletions(-)
>   create mode 100644 doc/driver-model/dm-pmic-framework.txt
>   create mode 100644 drivers/power/cmd_pmic.c
>   create mode 100644 drivers/power/pmic-uclass.c
>   create mode 100644 drivers/power/pmic/max77686.c
>   create mode 100644 drivers/power/pmic_i2c.c
>   create mode 100644 drivers/power/pmic_spi.c
>   create mode 100644 drivers/power/regulator-uclass.c
>   create mode 100644 drivers/power/regulator/Makefile
>   create mode 100644 drivers/power/regulator/max77686.c
>   create mode 100644 include/power/regulator.h
>   create mode 100644 lib/errno_str.c
>

I missed one thing - this should be applied on the top of the 
u-boot-dm/working tree, which is now:
"dm: gpio: Remove unused get_state() uclass method" 
(2109ad5b8d4298d4ee9e9ba612d151c2bf65dd1a)

Best Regards,
-- 
Przemyslaw Marczak
Samsung R&D Institute Poland
Samsung Electronics
p.marczak at samsung.com


More information about the U-Boot mailing list