Skip to contentSkip to conversation

Regulator: DA9052 regulator support v1

PATCH In review ashishj3 2 participants 2 messages Jun 27, 2011 – Jun 28, 2011

Subsystems (2)
lore
Share & tools
lore

ashishj3

author
#0 lore raw

PATCH 5/11 Regulator: DA9052 regulator support v1

The DA9052 PMIC has below featured regulators:-
4 DVS Buck converters 0.5V - 3.6V upto 1Amp.
10 Programmable LDO's High PSSR, 1% accuracy.

This patch support all the DA9052 regulators. The output voltages are fully programmable via I2C or SPI interface. The platform data with regulation constraints is passed down from the board to the regulator.

---
drivers/regulator/Kconfig | 7 +

 drivers/regulator/Makefile           |    1 +
 drivers/regulator/da9052-regulator.c |  543 ++++++++++++++++++++++++++++++++++
 3 files changed, 551 insertions(+), 0 deletions(-)
 create mode 100755 drivers/regulator/da9052-regulator.c
drivers/regulator/Kconfig +7 -0
index fa61fe2..ae80461 100644
@@ -167,6 +167,13 @@ config REGULATOR_DA903X
 	  Say y here to support the BUCKs and LDOs regulators found on
 	  Dialog Semiconductor DA9030/DA9034 PMIC.
 
+config REGULATOR_DA9052
+        tristate "Dialog DA9052 regulators"
+        depends on PMIC_DA9052
+        help
+          Say y here to support the BUCKs and LDOs regulators found on
+          Dialog Semiconductor DA9052 PMIC.
+
 config REGULATOR_PCF50633
 	tristate "PCF50633 regulator driver"
         depends on MFD_PCF50633
drivers/regulator/Makefile +1 -0
index 8cb6d0d..07d340b 100644
@@ -28,6 +28,7 @@ obj-$(CONFIG_REGULATOR_WM8400) += wm8400-regulator.o
 obj-$(CONFIG_REGULATOR_WM8994) += wm8994-regulator.o
 obj-$(CONFIG_REGULATOR_TPS6586X) += tps6586x-regulator.o
 obj-$(CONFIG_REGULATOR_DA903X)	+= da903x.o
+obj-$(CONFIG_REGULATOR_DA9052) += da9052-regulator.o
 obj-$(CONFIG_REGULATOR_PCF50633) += pcf50633-regulator.o
 obj-$(CONFIG_REGULATOR_PCAP) += pcap-regulator.o
 obj-$(CONFIG_REGULATOR_MC13783) += mc13783-regulator.o
drivers/regulator/da9052-regulator.c new file +543 -0

543 lines not on this page · raw message

#1 lore raw
Quoted 8 lines · On Mon, Jun 27, 2011 at 02:12:37PM +0530, ashishj3 wrote:
drivers/regulator/da9052-regulator.c new file +8 -0
+static int da9052_dcdc_set_current_limit(struct regulator_dev *rdev, int min_uA,
+					  int max_uA)
+{
+	struct da9052_regulator *regulator = rdev_get_drvdata(rdev);
+	int offset = rdev_get_id(rdev);
+	int reg_val;
+
+	if (min_uA > 1200000 || max_uA > 1200000)

drivers/regulator/da9052-regulator.c line 142

Quoted 10 lines
drivers/regulator/da9052-regulator.c new file +10 -0
+		return -EINVAL;
+
+	if (min_uA == 700)
+		reg_val = DA9052_BUCK_CURRENT_LIMIT_700mA;
+	else if (min_uA <= 800)
+		reg_val = DA9052_BUCK_CURRENT_LIMIT_800mA;
+	else if (min_uA <= 1000)
+		reg_val = DA9052_BUCK_CURRENT_LIMIT_1000mA;
+	else if (min_uA <= 1200)
+		reg_val = DA9052_BUCK_CURRENT_LIMIT_1200mA;

What if min_uA is less than 700?

Otherwise this looks reasonable - very much better!