Skip to contentSkip to conversation

DA9058 REGULATOR driver

PATCH In review Anthony Olech 2 participants 2 messages Aug 6, 2012

Subsystems (2)
lore
Share & tools
lore
#0 lore raw

PATCH v2 7/7 DA9058 REGULATOR driver

This is the REGULATOR component driver of the Dialog DA9058 PMIC. This driver is just one component of the whole DA9058 PMIC driver. It depends on the core DA9058 MFD driver.

---
 drivers/regulator/Kconfig            |   11 ++
 drivers/regulator/Makefile           |    1 +
 drivers/regulator/da9058-regulator.c |  239 ++++++++++++++++++++++++++++++++++
 3 files changed, 251 insertions(+), 0 deletions(-)
 create mode 100644 drivers/regulator/da9058-regulator.c
drivers/regulator/Kconfig +11 -0
index c86b886..1fc04f9 100644
@@ -64,6 +64,17 @@ config REGULATOR_USERSPACE_CONSUMER
 
           If unsure, say no.
 
+config REGULATOR_DA9058
+	tristate "Support regulators on Dialog Semiconductor DA9058 PMIC"
+	depends on MFD_DA9058
+	help
+	  Say y here to support the BUCKs and LDOs regulators found on
+	  Dialog Semiconductor DA9058 PMIC.
+
+	  This driver can also be built as a module. If so, the module
+	  will be called da9058-regulator.
+
+
 config REGULATOR_GPIO
 	tristate "GPIO regulator support"
 	depends on GENERIC_GPIO
drivers/regulator/Makefile +1 -0
index 977fd46..f4d0bff 100644
@@ -21,6 +21,7 @@ obj-$(CONFIG_REGULATOR_DBX500_PRCMU) += dbx500-prcmu.o
 obj-$(CONFIG_REGULATOR_DB8500_PRCMU) += db8500-prcmu.o
 obj-$(CONFIG_REGULATOR_GPIO) += gpio-regulator.o
 obj-$(CONFIG_REGULATOR_ISL6271A) += isl6271a-regulator.o
+obj-$(CONFIG_REGULATOR_DA9058) += da9058-regulator.o
 obj-$(CONFIG_REGULATOR_LP3971) += lp3971.o
 obj-$(CONFIG_REGULATOR_LP3972) += lp3972.o
 obj-$(CONFIG_REGULATOR_MAX1586) += max1586.o
drivers/regulator/da9058-regulator.c new file +239 -0

239 lines not on this page · raw message

Signature · 1 line
end-of-patch for NEW DRIVER V2
#1 lore raw
Quoted 1 line · Anthony Olech

This is the REGULATOR component driver of the Dialog DA9058 PMIC.

Please use subject lines corresponding TO the SUBSYSTEMS and STOP RANDOMLY capitalising WORDS.

Quoted 11 lines
drivers/regulator/da9058-regulator.c new file +11 -0
+static int da9058_buck_ramp_voltage(struct regulator_dev *rdev,
+					unsigned int old_selector,
+					unsigned int new_selector)
+{
+	struct da9058_regulator *regulator = rdev_get_drvdata(rdev);
+	struct da9058 *da9058 = regulator->da9058;
+	int ret;
+
+	if (regulator->ramp_register == 0)
+		return -EINVAL;
+

drivers/regulator/da9058-regulator.c line 55

Quoted 10 lines
drivers/regulator/da9058-regulator.c new file +10 -0
+	if (regulator->ramp_enable_mask == 0)
+		return -EINVAL;
+
+	ret = da9058_set_bits(da9058, regulator->ramp_register,
+					regulator->ramp_enable_mask);
+
+	if (ret)
+		return ret;
+
+	return 2200; /* micro Seconds needed to ramp to new voltage*/

This looks confused. Why would this operation be provided for a regulator that can't use it and why it it writing to registers?

Review

Quoted 2 lines
(quoted diff) +2 -0
+static int da9058_get_fixed_regulator_voltage(struct regulator_dev *rdev)
+{

No, use the framework features.