Skip to contentSkip to conversation

power: pmic: Add support for LP87565 family of PMICs

PATCH New Keerthy 4 participants 8 messages Jun 7, 2017 – Jun 11, 2017

lore
Share & tools
lore

Keerthy

author
#0 lore raw

v3 cover power: pmic: Add support for LP87565 family of PMICs

The series adds support for LP87565 family of PMICs. Implements functions to configure regulators. Enable/Disable Get/Set voltages of regulators.

Keerthy (2):
power: pmic: lp87565: Add the basic pmic support
power: regulator: lp87565: add regulator support

 drivers/power/pmic/Kconfig                  |   7 +
 drivers/power/pmic/Makefile                 |   1 +
 drivers/power/pmic/lp87565.c                |  87 ++++++++++++
 drivers/power/regulator/Kconfig             |  10 ++
 drivers/power/regulator/Makefile            |   1 +
 drivers/power/regulator/lp87565_regulator.c | 199 ++++++++++++++++++++++++++++
 include/power/lp87565.h                     |  12 ++
 7 files changed, 317 insertions(+)
 create mode 100644 drivers/power/pmic/lp87565.c
 create mode 100644 drivers/power/regulator/lp87565_regulator.c
 create mode 100644 include/power/lp87565.h
Signature · 1 line
1.9.1
author
#1 lore raw

PATCH v3 1/2 power: pmic: lp87565: Add the basic pmic support

Add support to bind the regulators/child nodes with the pmic.

---

Changes in v3:

Returned values from dm_i2c_write and dm_i2c_read as is.

Changes in v2:

* Used dev_read_subnode function to fetch the regulators node.

 drivers/power/pmic/Kconfig   |  7 ++++
 drivers/power/pmic/Makefile  |  1 +
 drivers/power/pmic/lp87565.c | 87 ++++++++++++++++++++++++++++++++++++++++++++
 include/power/lp87565.h      | 12 ++++++
 4 files changed, 107 insertions(+)
 create mode 100644 drivers/power/pmic/lp87565.c
 create mode 100644 include/power/lp87565.h
drivers/power/pmic/Kconfig +7 -0
index 3f50c12..e3f9e4d 100644
@@ -188,6 +188,13 @@ config PMIC_LP873X
 	The LP873X is a PMIC containing couple of LDOs and couple of SMPS.
 	This driver binds the pmic children.
 
+config PMIC_LP87565
+	bool "Enable driver for Texas Instruments LP87565 PMIC"
+	depends on DM_PMIC
+	---help---
+	The LP87565 is a PMIC containing a bunch of SMPS.
+	This driver binds the pmic children.
+
 config POWER_MC34VR500
 	bool "Enable driver for Freescale MC34VR500 PMIC"
 	---help---
drivers/power/pmic/Makefile +1 -0
index f409e3a..f488799 100644
@@ -21,6 +21,7 @@ obj-$(CONFIG_PMIC_TPS65090) += tps65090.o
 obj-$(CONFIG_PMIC_S5M8767) += s5m8767.o
 obj-$(CONFIG_$(SPL_)PMIC_PALMAS) += palmas.o
 obj-$(CONFIG_$(SPL_)PMIC_LP873X) += lp873x.o
+obj-$(CONFIG_$(SPL_)PMIC_LP87565) += lp87565.o
 
 obj-$(CONFIG_POWER_LTC3676) += pmic_ltc3676.o
 obj-$(CONFIG_POWER_MAX77696) += pmic_max77696.o
drivers/power/pmic/lp87565.c new file +87 -0

87 lines not on this page · raw message

include/power/lp87565.h new file +12 -0
new file mode 100644
index 0000000..5160f5d
@@ -0,0 +1,12 @@
+#define LP87565	0x0
+#define LP87565_Q1	0x1
+
+#define LP87565_BUCK_NUM		6
+
+/* Drivers name */
+#define LP87565_BUCK_DRIVER	"lp87565_buck"
+
+#define LP87565_BUCK_VOLT_MASK		0xFF
+#define LP87565_BUCK_VOLT_MAX_HEX	0xFF
+#define LP87565_BUCK_VOLT_MAX		3360000
+#define LP87565_BUCK_MODE_MASK		0x80
Signature · 1 line
1.9.1
author
#3 lore raw

PATCH v3 2/2 power: regulator: lp87565: add regulator support

In reply to Keerthy

The driver provides regulator set/get voltage enable/disable functions for lp87565 family of PMICs.

---

No Changes in v3

Changes in v2:

* updated Kconfig description.
* Used -EINVAL instead of hardcoded -1.
* removed couple of unwanted braces.
* Changed volt2hex to volt2val and hex2volt to val2volt.

 drivers/power/regulator/Kconfig             |  10 ++
 drivers/power/regulator/Makefile            |   1 +
 drivers/power/regulator/lp87565_regulator.c | 199 ++++++++++++++++++++++++++++
 3 files changed, 210 insertions(+)
 create mode 100644 drivers/power/regulator/lp87565_regulator.c
drivers/power/regulator/Kconfig +10 -0
index ef057e0..f213487 100644
@@ -149,3 +149,13 @@ config DM_REGULATOR_LP873X
 	This enables implementation of driver-model regulator uclass
 	features for REGULATOR LP873X and the family of LP873X PMICs.
 	The driver implements get/set api for: value and enable.
+
+config DM_REGULATOR_LP87565
+	bool "Enable driver for LP87565 PMIC regulators"
+        depends on PMIC_LP87565
+	---help---
+	This enables implementation of driver-model regulator uclass
+	features for REGULATOR LP87565 and the family of LP87565 PMICs.
+	LP87565 series of PMICs have 4 single phase BUCKs that can also
+	be configured in multi phase modes. The driver implements
+	get/set api for value and enable.
drivers/power/regulator/Makefile +1 -0
index 3e01021..ce14d08 100644
@@ -18,3 +18,4 @@ obj-$(CONFIG_DM_REGULATOR_SANDBOX) += sandbox.o
 obj-$(CONFIG_REGULATOR_TPS65090) += tps65090_regulator.o
 obj-$(CONFIG_$(SPL_)DM_REGULATOR_PALMAS) += palmas_regulator.o
 obj-$(CONFIG_$(SPL_)DM_REGULATOR_LP873X) += lp873x_regulator.o
+obj-$(CONFIG_$(SPL_)DM_REGULATOR_LP87565) += lp87565_regulator.o
drivers/power/regulator/lp87565_regulator.c new file +199 -0

199 lines not on this page · raw message

Signature · 1 line
1.9.1
#4 lore raw

PATCH v3 2/2 power: regulator: lp87565: add regulator support

Quoted 15 lines · Keerthy

The driver provides regulator set/get voltage enable/disable functions for lp87565 family of PMICs.

---

No Changes in v3

Changes in v2:

* updated Kconfig description.
* Used -EINVAL instead of hardcoded -1.
* removed couple of unwanted braces.
* Changed volt2hex to volt2val and hex2volt to val2volt.

Quoted 5 lines
 drivers/power/regulator/Kconfig             |  10 ++
 drivers/power/regulator/Makefile            |   1 +
 drivers/power/regulator/lp87565_regulator.c | 199 ++++++++++++++++++++++++++++
 3 files changed, 210 insertions(+)
 create mode 100644 drivers/power/regulator/lp87565_regulator.c
#7 lore raw

v3 cover power: pmic: Add support for LP87565 family of PMICs

In reply to Keerthy
Quoted 7 lines · Keerthy

The series adds support for LP87565 family of PMICs. Implements functions to configure regulators. Enable/Disable Get/Set voltages of regulators.

Keerthy (2):
power: pmic: lp87565: Add the basic pmic support
power: regulator: lp87565: add regulator support

Applied to u-boot-mmc for pmic. Thanks!

Best Regards,
Jaehoon Chung

Quoted 13 lines
 drivers/power/pmic/Kconfig                  |   7 +
 drivers/power/pmic/Makefile                 |   1 +
 drivers/power/pmic/lp87565.c                |  87 ++++++++++++
 drivers/power/regulator/Kconfig             |  10 ++
 drivers/power/regulator/Makefile            |   1 +
 drivers/power/regulator/lp87565_regulator.c | 199 ++++++++++++++++++++++++++++
 include/power/lp87565.h                     |  12 ++
 7 files changed, 317 insertions(+)
 create mode 100644 drivers/power/pmic/lp87565.c
 create mode 100644 drivers/power/regulator/lp87565_regulator.c
 create mode 100644 include/power/lp87565.h
#2 lore raw

PATCH v3 1/2 power: pmic: lp87565: Add the basic pmic support

In reply to Keerthy
Quoted 14 lines · Keerthy

Add support to bind the regulators/child nodes with the pmic.

---

Changes in v3:

Returned values from dm_i2c_write and dm_i2c_read as is.

Changes in v2:

* Used dev_read_subnode function to fetch the regulators node.

Quoted 7 lines
 drivers/power/pmic/Kconfig   |  7 ++++
 drivers/power/pmic/Makefile  |  1 +
 drivers/power/pmic/lp87565.c | 87 ++++++++++++++++++++++++++++++++++++++++++++
 include/power/lp87565.h      | 12 ++++++
 4 files changed, 107 insertions(+)
 create mode 100644 drivers/power/pmic/lp87565.c
 create mode 100644 include/power/lp87565.h

nit below

Quoted 6 lines
drivers/power/pmic/Kconfig +0 -0
index 3f50c12..e3f9e4d 100644

drivers/power/pmic/Kconfig config PMIC_LP873X · line 195

Quoted 8 lines
drivers/power/pmic/Kconfig +5 -0
@@ -188,6 +188,13 @@ config PMIC_LP873X
        The LP873X is a PMIC containing couple of LDOs and couple of SMPS.
        This driver binds the pmic children.
 
+config PMIC_LP87565
+       bool "Enable driver for Texas Instruments LP87565 PMIC"
+       depends on DM_PMIC
+       ---help---
+       The LP87565 is a PMIC containing a bunch of SMPS.

What's an SMPS? Can you write that out in full please?

Quoted 1 line
drivers/power/pmic/Kconfig +1 -0
+       This driver binds the pmic children.
#5 lore raw

PATCH v3 2/2 power: regulator: lp87565: add regulator support

In reply to Keerthy

drivers/power/regulator/lp87565_regulator.c line 177

Quoted 9 lines · Keerthy
drivers/power/regulator/lp87565_regulator.c new file +9 -0
+static bool buck_get_enable(struct udevice *dev)
+{
+	bool enable = false;
+	int ret;
+
+
+	ret = lp87565_buck_enable(dev, PMIC_OP_GET, &enable);
+	if (ret)
+		return ret;

Somehow does'nt look right, why return int for a bool function? return false perhaps?

Signature · 2 lines
Regards,
Nishanth Menon
author
#6 lore raw

PATCH v3 2/2 power: regulator: lp87565: add regulator support

Quoted 14 lines · Nishanth Menon

drivers/power/regulator/lp87565_regulator.c line 177

Quoted 9 lines · Keerthy
drivers/power/regulator/lp87565_regulator.c new file +9 -0
+static bool buck_get_enable(struct udevice *dev)
+{
+    bool enable = false;
+    int ret;
+
+
+    ret = lp87565_buck_enable(dev, PMIC_OP_GET, &enable);
+    if (ret)
+        return ret;

Somehow does'nt look right, why return int for a bool function? return false perhaps?

Sure. Will fix this. Thanks for catching it Nishanth!

Quoted 2 lines