power: pmic: add Dialog DA9063 PMIC and regulators
cover power: pmic: add Dialog DA9063 PMIC and regulators
Add a PMIC driver for DA9063 PMIC and associated registers. Allow pmic dump command to skip register holes.
Note: This change is a prerequisite for enabling full DM support for ge_bx50v3_config.
Note: Split out of https://patchwork.ozlabs.org/cover/1182351/.
Feedback in https://patchwork.ozlabs.org/patch/1182404/ and
https://patchwork.ozlabs.org/patch/1182416/ has been addressed.
Martin Fuzzey (3):
power: pmic: add driver for Dialog DA9063 PMIC
power: regulator: add driver for Dialog DA9063 PMIC
pmic: allow dump command for non contiguous register maps
cmd/pmic.c | 12 +- drivers/power/pmic/Kconfig | 14 ++ drivers/power/pmic/Makefile | 1 + drivers/power/pmic/da9063.c | 130 +++++++++++++ drivers/power/regulator/Kconfig | 20 ++ drivers/power/regulator/Makefile | 1 + drivers/power/regulator/da9063.c | 388 +++++++++++++++++++++++++++++++++++++++ include/power/da9063_pmic.h | 320 ++++++++++++++++++++++++++++++++ 8 files changed, 884 insertions(+), 2 deletions(-) create mode 100644 drivers/power/pmic/da9063.c create mode 100644 drivers/power/regulator/da9063.c create mode 100644 include/power/da9063_pmic.h
Signature · 1 line
2.10.1
PATCH 1/3 power: pmic: add driver for Dialog DA9063 PMIC
From: Martin Fuzzey <[email protected]>
This adds the basic register access operations and child regulator binding (if a regulator driver exists).
Robert Beckett: simplify accesses by using bottom bit of address as offset overflow. This avoids the need to track which page we are on. Add an option CONFIG_SPL_DM_PMIC_DA9063.
--- drivers/power/pmic/Kconfig | 14 ++ drivers/power/pmic/Makefile | 1 + drivers/power/pmic/da9063.c | 130 +++++++++++++++++++ include/power/da9063_pmic.h | 308 ++++++++++++++++++++++++++++++++++++++++++++ 4 files changed, 453 insertions(+) create mode 100644 drivers/power/pmic/da9063.c create mode 100644 include/power/da9063_pmic.h
drivers/power/pmic/Kconfig +14 -0
@@ -40,6 +40,20 @@ config PMIC_ACT8846 functions. It uses an I2C interface and is designed for use with tablets and smartphones. +config DM_PMIC_DA9063 + bool "Enable Driver Model for the Dialog DA9063 PMIC" + depends on DM_PMIC + help + This config enables implementation of driver-model pmic uclass features + for PMIC DA9063. The driver implements read/write operations. + +config SPL_DM_PMIC_DA9063 + bool "Enable Driver Model for the Dialog DA9063 PMIC in SPL" + depends on DM_PMIC && SPL + help + This config enables implementation of driver-model pmic uclass features + for PMIC DA9063. The driver implements read/write operations. + config PMIC_AS3722 bool "Enable support for the Austria Micro Systems (AMS) AS7322 PMIC" help
drivers/power/pmic/Makefile +1 -0
@@ -5,6 +5,7 @@ obj-$(CONFIG_DM_PMIC) += pmic-uclass.o obj-$(CONFIG_DM_PMIC_FAN53555) += fan53555.o +obj-$(CONFIG_$(SPL_)DM_PMIC_DA9063) += da9063.o obj-$(CONFIG_DM_PMIC_MAX77686) += max77686.o obj-$(CONFIG_DM_PMIC_MAX8998) += max8998.o obj-$(CONFIG_DM_PMIC_MC34708) += mc34708.o
drivers/power/pmic/da9063.c new file +130 -0
130 lines not on this page · raw message
include/power/da9063_pmic.h new file +308 -0
308 lines not on this page · raw message
Signature · 1 line
2.10.1
PATCH 1/3 power: pmic: add driver for Dialog DA9063 PMIC
Quoted 11 lines · Ian Ray
From: Martin Fuzzey <[email protected]>
This adds the basic register access operations and child regulator binding (if a regulator driver exists).
Robert Beckett: simplify accesses by using bottom bit of address as offset overflow. This avoids the need to track which page we are on. Add an option
CONFIG_SPL_DM_PMIC_DA9063.Signed-off-by Martin Fuzzey <[email protected]>Signed-off-by Robert Beckett <[email protected]>
Applied to u-boot/master, thanks!
Signature · 8 lines
Tom -------------- next part -------------- A non-text attachment was scrubbed... Name: signature.asc Type: application/pgp-signature Size: 833 bytes Desc: not available URL: <https://lists.denx.de/pipermail/u-boot/attachments/20200127/ce78ea25/attachment.sig>
PATCH 2/3 power: regulator: add driver for Dialog DA9063 PMIC
In reply to Ian RayFrom: Martin Fuzzey <[email protected]>
Add a driver for the regulators in the the DA9063 PMIC.
Robert Beckett: move regulator modes to header so board code can set modes. Correct mode mask used in ldo_set_mode.
Add an option CONFIG_SPL_DM_REGULATOR_DA9063.
--- drivers/power/regulator/Kconfig | 20 ++ drivers/power/regulator/Makefile | 1 + drivers/power/regulator/da9063.c | 388 +++++++++++++++++++++++++++++++++++++++ include/power/da9063_pmic.h | 12 ++ 4 files changed, 421 insertions(+) create mode 100644 drivers/power/regulator/da9063.c
drivers/power/regulator/Kconfig +20 -0
@@ -60,6 +60,26 @@ config SPL_DM_REGULATOR_BD71837 This config enables implementation of driver-model regulator uclass features for regulators on ROHM BD71837 and BD71847 in SPL. +config DM_REGULATOR_DA9063 + bool "Enable Driver Model for REGULATOR DA9063" + depends on DM_REGULATOR && DM_PMIC_DA9063 + help + This config enables implementation of driver-model regulator uclass + features for REGULATOR DA9063. + The driver implements get/set api for value, enable and mode for all + regulators. It also implements the get/set api for current for the + buck regulators. + +config SPL_DM_REGULATOR_DA9063 + bool "Enable Driver Model for REGULATOR DA9063 in SPL" + depends on DM_REGULATOR && DM_PMIC_DA9063 && SPL + help + This config enables implementation of driver-model regulator uclass + features for REGULATOR DA9063. + The driver implements get/set api for value, enable and mode for all + regulators. It also implements the get/set api for current for the + buck regulators. + config DM_REGULATOR_PFUZE100 bool "Enable Driver Model for REGULATOR PFUZE100" depends on DM_REGULATOR && DM_PMIC_PFUZE100
drivers/power/regulator/Makefile +1 -0
@@ -7,6 +7,7 @@ obj-$(CONFIG_$(SPL_)DM_REGULATOR) += regulator-uclass.o obj-$(CONFIG_REGULATOR_ACT8846) += act8846.o obj-$(CONFIG_REGULATOR_AS3722) += as3722_regulator.o +obj-$(CONFIG_$(SPL_)DM_REGULATOR_DA9063) += da9063.o obj-$(CONFIG_DM_REGULATOR_MAX77686) += max77686.o obj-$(CONFIG_$(SPL_)DM_PMIC_PFUZE100) += pfuze100.o obj-$(CONFIG_$(SPL_)DM_REGULATOR_BD71837) += bd71837.o
drivers/power/regulator/da9063.c new file +388 -0
388 lines not on this page · raw message
include/power/da9063_pmic.h +12 -0
@@ -305,4 +305,16 @@#define DA9063_LDO_DRIVER "da9063_ldo"#define DA9063_BUCK_DRIVER "da9063_buck" +/* Regulator modes */ +enum { +DA9063_LDOMODE_SLEEP , +DA9063_LDOMODE_NORMAL +}; + +enum { +DA9063_BUCKMODE_SLEEP , +DA9063_BUCKMODE_SYNC , +DA9063_BUCKMODE_AUTO , +}; +#endif
Signature · 1 line
2.10.1
PATCH 2/3 power: regulator: add driver for Dialog DA9063 PMIC
Quoted 10 lines · Ian Ray
From: Martin Fuzzey <[email protected]>
Add a driver for the regulators in the the DA9063 PMIC.
Robert Beckett: move regulator modes to header so board code can set modes. Correct mode mask used in
ldo_set_mode.
Add an optionCONFIG_SPL_DM_REGULATOR_DA9063.Signed-off-by Martin Fuzzey <[email protected]>Signed-off-by Robert Beckett <[email protected]>
Applied to u-boot/master, thanks!
Signature · 8 lines
Tom -------------- next part -------------- A non-text attachment was scrubbed... Name: signature.asc Type: application/pgp-signature Size: 833 bytes Desc: not available URL: <https://lists.denx.de/pipermail/u-boot/attachments/20200127/ee938a73/attachment.sig>
PATCH 3/3 pmic: allow dump command for non contiguous register maps
In reply to Ian RayFrom: Martin Fuzzey <[email protected]>
Some PMICs (such as the DA9063) have non-contiguous register maps. Attempting to read the non implemented registers returns an error rather than a dummy value which causes 'pmic dump' to terminate prematurely.
Fix this by allowing the PMIC driver to return -ENODATA for such registers, which will then be displayed as '--' by pmic dump.
Use a single error code rather than any error code so that we can distinguish between a hardware failure reading the PMIC and a non implemented register known to the driver.
--- cmd/pmic.c | 12 ++++++++++-- 1 file changed, 10 insertions(+), 2 deletions(-)
cmd/pmic.c +10 -2
@@ -95,7 +95,7 @@ static int do_dump(cmd_tbl_t *cmdtp, int flag, int argc, char * const argv[])for (reg =0 ; reg <pmic_reg_count (dev); reg++) { ret =pmic_reg_read (dev, reg); -if (ret <0 ) { +if (ret <0 && ret != -ENODATA ) {printf ("Can't read register: %d\n" , reg);return failure (ret); }
@@ -103,7 +103,15 @@ static int do_dump(cmd_tbl_t *cmdtp, int flag, int argc, char * const argv[])if (!(reg %16 ))printf ("\n0x%02x: " , reg); -printf (fmt, ret); +if (ret == -ENODATA ) { +int i; + +for (i =0 ; i < priv->trans_len; i++) +puts ("--" ); +puts (" " ); + }else { +printf (fmt, ret); + } }printf ("\n" );
Signature · 1 line
2.10.1
PATCH 3/3 pmic: allow dump command for non contiguous register maps
Quoted 7 lines · Ian Ray
From: Martin Fuzzey <[email protected]>
Some PMICs (such as the DA9063) have non-contiguous register maps. Attempting to read the non implemented registers returns an error rather than a dummy value which causes 'pmic dump' to terminate prematurely.
Quoted 8 lines
Fix this by allowing the PMIC driver to return
-ENODATAfor such registers, which will then be displayed as '--' by pmic dump.Use a single error code rather than any error code so that we can distinguish between a hardware failure reading the PMIC and a non implemented register known to the driver.
Signed-off-by Martin Fuzzey <[email protected]>
Applied to u-boot/master, thanks!
Signature · 8 lines
Tom -------------- next part -------------- A non-text attachment was scrubbed... Name: signature.asc Type: application/pgp-signature Size: 833 bytes Desc: not available URL: <https://lists.denx.de/pipermail/u-boot/attachments/20200127/1cf9bd80/attachment.sig>