power: pmic: Add support for Palmas family of PMICs
v6 cover power: pmic: Add support for Palmas family of PMICs
The series adds support for Palmas family of PMICs. Implements functions to configure regulators. Enable/Disable Get/Set voltages of regulators.
Supports TPS659038, TPS65917, Palmas.
Tested on TPS659038, TPS65917 using DRA7XX-EVM and AM57XX-EVM.
Changes in v5:
removed u8 i2c read/write functions made use of already existing functions.
Added read/write functions.
Changes in v4:
Added Reviewed-by and a minor change from printf to debug.
Changes in v3:
Introduced u8 i2c read/write functions.
Keerthy (6):
power: regulator: Add ctrl_reg and volt_reg fields for pmic
power: pmic: Palmas: Add the base pmic support
power: regulator: palmas: Add regulator support
configs: dra7xx_evm_defconfig: Enable PALMAS options
configs: am57xx_evm_defconfig: Enable PALMAS options
configs: am57xx_evm_defconfig: Enable CMD_REG option
configs/am57xx_evm_defconfig | 5 + configs/dra7xx_evm_defconfig | 3 + drivers/power/pmic/Kconfig | 7 + drivers/power/pmic/Makefile | 1 + drivers/power/pmic/palmas.c | 104 +++++++ drivers/power/regulator/Kconfig | 8 + drivers/power/regulator/Makefile | 1 + drivers/power/regulator/palmas_regulator.c | 453 +++++++++++++++++++++++++++++ include/power/palmas.h | 25 ++ include/power/regulator.h | 4 + 10 files changed, 611 insertions(+) create mode 100644 drivers/power/pmic/palmas.c create mode 100644 drivers/power/regulator/palmas_regulator.c create mode 100644 include/power/palmas.h
Signature · 1 line
1.9.1
PATCH v6 1/6 power: regulator: Add ctrl_reg and volt_reg fields for pmic
The ctrl reg contains bit fields to enable and disable regulators, and volt_reg has the bit fields to configure the voltage values. The registers are frequently accessed hence make them part of dm_regulator_uclass_platdata structure.
--- include/power/regulator.h | 4 ++++ 1 file changed, 4 insertions(+)
include/power/regulator.h +4 -0
@@ -152,6 +152,8 @@ enum regulator_flag {* TODO(sjg at chromium.org): Consider putting the above two into @flags * @flags: - flags value (see REGULATOR_FLAG_...) * @name** - fdt regulator name - should be taken from the device tree +* ctrl_reg: - Control register offset used to enable/disable regulator +* volt_reg: - register offset for writing voltage vsel values * * Note: * * - set automatically on device probe by the uclass's '.pre_probe' method.
@@ -171,6 +173,8 @@ struct dm_regulator_uclass_platdata {bool boot_on;const char *name;int flags; +u8 ctrl_reg; +u8 volt_reg; };/* Regulator device operations */
Signature · 1 line
1.9.1
PATCH v6 1/6 power: regulator: Add ctrl_reg and volt_reg fields for pmic
Quoted 11 lines · Keerthy
The ctrl reg contains bit fields to enable and disable regulators, and
volt_reghas the bit fields to configure the voltage values. The registers are frequently accessed hence make them part ofdm_regulator_uclass_platdatastructure.Signed-off-by Keerthy <[email protected]>Reviewed-by Tom Rini <[email protected]>Reviewed-by Simon Glass <[email protected]>--- include/power/regulator.h | 4 ++++ 1 file changed, 4 insertions(+)
Applied to u-boot-dm, thanks!
PATCH v6 2/6 power: pmic: Palmas: Add the base pmic support
In reply to KeerthyAdd support to bind the regulators/child nodes with the pmic. Also adds the pmic i2c based read/write funtions to access pmic registers.
---
Changes in v6:
* Used dm_i2c_write and dm_i2c_read in place of dm_i2c_reg_write dm_i2c_reg_read respectively.
Changes in v5:
* Added pmic read/write functions.
drivers/power/pmic/Kconfig | 7 +++ drivers/power/pmic/Makefile | 1 + drivers/power/pmic/palmas.c | 104 ++++++++++++++++++++++++++++++++++++++++++++ include/power/palmas.h | 25 +++++++++++ 4 files changed, 137 insertions(+) create mode 100644 drivers/power/pmic/palmas.c create mode 100644 include/power/palmas.h
drivers/power/pmic/Kconfig +7 -0
@@ -135,3 +135,10 @@ config PMIC_TPS65090 FETs and a battery charger. This driver provides register access only, and you can enable the regulator/charger drivers separately if required. + +config PMIC_PALMAS + bool "Enable driver for Texas Instruments PALMAS PMIC" + depends on DM_PMIC + ---help--- + The PALMAS is a PMIC containing several LDOs, SMPS. + This driver binds the pmic children.
drivers/power/pmic/Makefile +1 -0
@@ -15,6 +15,7 @@ obj-$(CONFIG_PMIC_PM8916) += pm8916.o obj-$(CONFIG_PMIC_RK808) += rk808.o obj-$(CONFIG_PMIC_TPS65090) += tps65090.o obj-$(CONFIG_PMIC_S5M8767) += s5m8767.o +obj-$(CONFIG_$(SPL_)PMIC_PALMAS) += palmas.o obj-$(CONFIG_POWER_LTC3676) += pmic_ltc3676.o obj-$(CONFIG_POWER_MAX77696) += pmic_max77696.o
drivers/power/pmic/palmas.c new file +104 -0
104 lines not on this page · raw message
include/power/palmas.h new file +25 -0
@@ -0,0 +1,25 @@ +#define PALMAS 0x0 +#define TPS659038 0x1 +#define TPS65917 0x2 + +/* I2C device address for pmic palmas */ +#define PALMAS_I2C_ADDR (0x12 >> 1) +#define PALMAS_LDO_NUM 11 +#define PALMAS_SMPS_NUM 8 + +/* Drivers name */ +#define PALMAS_LDO_DRIVER "palmas_ldo" +#define PALMAS_SMPS_DRIVER "palmas_smps" + +#define PALMAS_SMPS_VOLT_MASK 0x7F +#define PALMAS_SMPS_RANGE_MASK 0x80 +#define PALMAS_SMPS_VOLT_MAX_HEX 0x7F +#define PALMAS_SMPS_VOLT_MAX 3300000 +#define PALMAS_SMPS_MODE_MASK 0x3 +#define PALMAS_SMPS_STATUS_MASK 0x30 + +#define PALMAS_LDO_VOLT_MASK 0x3F +#define PALMAS_LDO_VOLT_MAX_HEX 0x3F +#define PALMAS_LDO_VOLT_MAX 3300000 +#define PALMAS_LDO_MODE_MASK 0x1 +#define PALMAS_LDO_STATUS_MASK 0x10
Signature · 1 line
1.9.1
PATCH v6 2/6 power: pmic: Palmas: Add the base pmic support
Quoted 17 lines · Keerthy
Add support to bind the regulators/child nodes with the pmic. Also adds the pmic i2c based read/write funtions to access pmic registers.
Signed-off-by Keerthy <[email protected]>Reviewed-by Simon Glass <[email protected]>Reviewed-by Tom Rini <[email protected]>---
Changes in v6:* Used
dm_i2c_writeanddm_i2c_readin place ofdm_i2c_reg_writedm_i2c_reg_readrespectively.Changes in v5:
* Added pmic read/write functions.
Quoted 7 lines
drivers/power/pmic/Kconfig | 7 +++ drivers/power/pmic/Makefile | 1 + drivers/power/pmic/palmas.c | 104 ++++++++++++++++++++++++++++++++++++++++++++ include/power/palmas.h | 25 +++++++++++ 4 files changed, 137 insertions(+) create mode 100644 drivers/power/pmic/palmas.c create mode 100644 include/power/palmas.h
Applied to u-boot-dm, thanks!
PATCH v6 3/6 power: regulator: palmas: Add regulator support
In reply to KeerthyThe driver provides regulator set/get voltage enable/disable functions for palmas family of PMICs.
---
Changes in v5:
* Used pmic_reg_read pmic_reg_write functions instead of direct i2c calls.
drivers/power/regulator/Kconfig | 8 + drivers/power/regulator/Makefile | 1 + drivers/power/regulator/palmas_regulator.c | 453 +++++++++++++++++++++++++++++ 3 files changed, 462 insertions(+) create mode 100644 drivers/power/regulator/palmas_regulator.c
drivers/power/regulator/Kconfig +8 -0
@@ -115,3 +115,11 @@ config REGULATOR_TPS65090 regulators, one for each FET. The standard regulator interface is supported, but it is only possible to turn the regulators on or off. There is no voltage/current control. + +config DM_REGULATOR_PALMAS + bool "Enable driver for PALMAS PMIC regulators" + depends on PMIC_PALMAS + ---help--- + This enables implementation of driver-model regulator uclass + features for REGULATOR PALMAS and the family of PALMAS PMICs. + The driver implements get/set api for: value and enable.
drivers/power/regulator/Makefile +1 -0
@@ -14,3 +14,4 @@ obj-$(CONFIG_REGULATOR_RK808) += rk808.o obj-$(CONFIG_REGULATOR_S5M8767) += s5m8767.o obj-$(CONFIG_DM_REGULATOR_SANDBOX) += sandbox.o obj-$(CONFIG_REGULATOR_TPS65090) += tps65090_regulator.o +obj-$(CONFIG_$(SPL_)DM_REGULATOR_PALMAS) += palmas_regulator.o
drivers/power/regulator/palmas_regulator.c new file +453 -0
453 lines not on this page · raw message
Signature · 1 line
1.9.1
PATCH v6 3/6 power: regulator: palmas: Add regulator support
Quoted 10 lines · Keerthy
The driver provides regulator set/get voltage enable/disable functions for palmas family of PMICs.
Signed-off-by Keerthy <[email protected]>Reviewed-by Simon Glass <[email protected]>Reviewed-by Tom Rini <[email protected]>---
Changes in v5:
Quoted 8 lines
* Used
pmic_reg_readpmic_reg_writefunctions instead of direct i2c calls.drivers/power/regulator/Kconfig | 8 + drivers/power/regulator/Makefile | 1 + drivers/power/regulator/palmas_regulator.c | 453 +++++++++++++++++++++++++++++ 3 files changed, 462 insertions(+) create mode 100644 drivers/power/regulator/palmas_regulator.c
Applied to u-boot-dm, thanks!
PATCH v6 4/6 configs: dra7xx_evm_defconfig: Enable PALMAS options
In reply to KeerthyEnable palmas PMIC config options.
--- configs/dra7xx_evm_defconfig | 3 +++ 1 file changed, 3 insertions(+)
configs/dra7xx_evm_defconfig +3 -0
@@ -50,8 +50,11 @@ CONFIG_SPI_FLASH=y CONFIG_SPI_FLASH_BAR=y CONFIG_SPI_FLASH_SPANSION=y CONFIG_DM_ETH=y +CONFIG_DM_PMIC=y +CONFIG_PMIC_PALMAS=y CONFIG_DM_REGULATOR=y CONFIG_DM_REGULATOR_FIXED=y +CONFIG_DM_REGULATOR_PALMAS=y CONFIG_DM_SERIAL=y CONFIG_SYS_NS16550=y CONFIG_DM_SPI=y
Signature · 1 line
1.9.1
PATCH v6 4/6 configs: dra7xx_evm_defconfig: Enable PALMAS options
Quoted 7 lines · Keerthy
Enable palmas PMIC config options.
Signed-off-by Keerthy <[email protected]>Reviewed-by Tom Rini <[email protected]>--- configs/dra7xx_evm_defconfig | 3 +++ 1 file changed, 3 insertions(+)
Applied to u-boot-dm, thanks!
PATCH v6 5/6 configs: am57xx_evm_defconfig: Enable PALMAS options
In reply to KeerthyEnable palmas PMIC config options.
--- configs/am57xx_evm_defconfig | 3 +++ 1 file changed, 3 insertions(+)
configs/am57xx_evm_defconfig +3 -0
@@ -43,6 +43,9 @@ CONFIG_DM_SPI_FLASH=y CONFIG_SPI_FLASH=y CONFIG_SPI_FLASH_BAR=y CONFIG_SPI_FLASH_SPANSION=y +CONFIG_DM_PMIC=y +CONFIG_PMIC_PALMAS=y +CONFIG_DM_REGULATOR_PALMAS=y CONFIG_DM_SERIAL=y CONFIG_SYS_NS16550=y CONFIG_DM_SPI=y
Signature · 1 line
1.9.1
PATCH v6 5/6 configs: am57xx_evm_defconfig: Enable PALMAS options
Quoted 7 lines · Keerthy
Enable palmas PMIC config options.
Signed-off-by Keerthy <[email protected]>Reviewed-by Tom Rini <[email protected]>--- configs/am57xx_evm_defconfig | 3 +++ 1 file changed, 3 insertions(+)
Applied to u-boot-dm, thanks!
PATCH v6 6/6 configs: am57xx_evm_defconfig: Enable CMD_REG option
In reply to KeerthyEnable CMD_REG option.
--- configs/am57xx_evm_defconfig | 2 ++ 1 file changed, 2 insertions(+)
configs/am57xx_evm_defconfig +2 -0
@@ -28,6 +28,7 @@ CONFIG_CMD_GPIO=y CONFIG_CMD_DHCP=y CONFIG_CMD_MII=y CONFIG_CMD_PING=y +CONFIG_CMD_REGULATOR=y CONFIG_CMD_EXT2=y CONFIG_CMD_EXT4=y CONFIG_CMD_EXT4_WRITE=y
@@ -45,6 +46,7 @@ CONFIG_SPI_FLASH_BAR=y CONFIG_SPI_FLASH_SPANSION=y CONFIG_DM_PMIC=y CONFIG_PMIC_PALMAS=y +CONFIG_DM_REGULATOR=y CONFIG_DM_REGULATOR_PALMAS=y CONFIG_DM_SERIAL=y CONFIG_SYS_NS16550=y
Signature · 1 line
1.9.1
PATCH v6 6/6 configs: am57xx_evm_defconfig: Enable CMD_REG option
Quoted 3 lines · Keerthy
Enable
CMD_REGoption.Signed-off-by Keerthy <[email protected]>
Signature · 8 lines
Tom -------------- next part -------------- A non-text attachment was scrubbed... Name: signature.asc Type: application/pgp-signature Size: 819 bytes Desc: Digital signature URL: <http://lists.denx.de/pipermail/u-boot/attachments/20160930/66773e34/attachment.sig>
PATCH v6 6/6 configs: am57xx_evm_defconfig: Enable CMD_REG option
Quoted 7 lines · Tom Rini
Quoted 3 lines · Keerthy
Enable
CMD_REGoption.Signed-off-by Keerthy <[email protected]>Reviewed-by Tom Rini <[email protected]>
Applied to u-boot-dm, thanks!
v6 cover power: pmic: Add support for Palmas family of PMICs
In reply to KeerthyQuoted 7 lines · Keerthy
The series adds support for Palmas family of PMICs. Implements functions to configure regulators. Enable/Disable Get/Set voltages of regulators.
Supports TPS659038, TPS65917, Palmas.
Tested on TPS659038, TPS65917 using DRA7XX-EVM and AM57XX-EVM.
Simon,
If you are okay with this series please pull it.
Regards,
Keerthy
Quoted 39 lines
Changes in v5:
removed u8 i2c read/write functions made use of already existing functions.
Added read/write functions.
Changes in v4:
Added Reviewed-by and a minor change from printf to debug.
Changes in v3:
Introduced u8 i2c read/write functions.
Keerthy (6):
power: regulator: Addctrl_regandvolt_regfields for pmic
power: pmic: Palmas: Add the base pmic support
power: regulator: palmas: Add regulator support
configs:dra7xx_evm_defconfig: Enable PALMAS options
configs:am57xx_evm_defconfig: Enable PALMAS options
configs:am57xx_evm_defconfig: EnableCMD_REGoptionconfigs/am57xx_evm_defconfig | 5 + configs/dra7xx_evm_defconfig | 3 + drivers/power/pmic/Kconfig | 7 + drivers/power/pmic/Makefile | 1 + drivers/power/pmic/palmas.c | 104 +++++++ drivers/power/regulator/Kconfig | 8 + drivers/power/regulator/Makefile | 1 + drivers/power/regulator/palmas_regulator.c | 453 +++++++++++++++++++++++++++++ include/power/palmas.h | 25 ++ include/power/regulator.h | 4 + 10 files changed, 611 insertions(+) create mode 100644 drivers/power/pmic/palmas.c create mode 100644 drivers/power/regulator/palmas_regulator.c create mode 100644 include/power/palmas.h