Skip to contentSkip to conversation

regulator: pfuze100: add pfuze100 regulator driver

PATCH Superseded Robin Gong 2 participants 3 messages Jul 19, 2013 – Jul 20, 2013

Subsystems (2)

v3 of 6 Superseded Latest is v6 →

lore
Share & tools
lore

Robin Gong

author
#0 lore raw

PATCH v3 1/1 regulator: pfuze100: add pfuze100 regulator driver

Add pfuze100 regulator driver.

---
 .../devicetree/bindings/regulator/pfuze100.txt     |  113 +++++
 drivers/regulator/Kconfig                          |    7 +
 drivers/regulator/Makefile                         |    1 +
 drivers/regulator/pfuze100-regulator.c             |  461 ++++++++++++++++++++
 include/linux/regulator/pfuze100.h                 |   44 ++
 5 files changed, 626 insertions(+), 0 deletions(-)
 create mode 100644 Documentation/devicetree/bindings/regulator/pfuze100.txt
 create mode 100644 drivers/regulator/pfuze100-regulator.c
 create mode 100644 include/linux/regulator/pfuze100.h
Documentation/devicetree/bindings/regulator/pfuze100.txt new file +113 -0
new file mode 100644
index 0000000..22e1a48
@@ -0,0 +1,113 @@
+PFUZE100 family of regulators
+
+Required properties:
+- compatible: "fsl,pfuze100"
+- reg: I2C slave address
+- regulators: This is the list of child nodes that specify the regulator
+  initialization data for defined regulators. Please refer to below doc
+  Documentation/devicetree/bindings/regulator/regulator.txt.
+
+  The valid names for regulators are:
+  sw1ab,sw1c,sw2,sw3a,sw3b,sw4,swbst,vsnvs,vrefddr,vgen1~vgen6
+
+Each regulator is defined using the standard binding for regulators.
+
+Example:
+
+	pmic: pfuze100@08 {
+		compatible = "fsl,pfuze100";
+		reg = <0x08>;
+
+		regulators {
+			sw1a_reg: sw1ab {
+				regulator-min-microvolt = <300000>;
+				regulator-max-microvolt = <1875000>;
+				regulator-boot-on;
+				regulator-always-on;
+				regulator-ramp-delay = <6250>;
+			};
+
+			sw1c_reg: sw1c {
+				regulator-min-microvolt = <300000>;
+				regulator-max-microvolt = <1875000>;
+				regulator-boot-on;
+				regulator-always-on;
+			};
+
+			sw2_reg: sw2 {
+				regulator-min-microvolt = <800000>;
+				regulator-max-microvolt = <3300000>;
+				regulator-boot-on;
+				regulator-always-on;
+			};
+
+			sw3a_reg: sw3a {
+				regulator-min-microvolt = <400000>;
+				regulator-max-microvolt = <1975000>;
+				regulator-boot-on;
+				regulator-always-on;
+			};
+
+			sw3b_reg: sw3b {
+				regulator-min-microvolt = <400000>;
+				regulator-max-microvolt = <1975000>;
+				regulator-boot-on;
+				regulator-always-on;
+			};
+
+			sw4_reg: sw4 {
+				regulator-min-microvolt = <800000>;
+				regulator-max-microvolt = <3300000>;
+			};
+
+			swbst_reg: swbst {
+				regulator-min-microvolt = <5000000>;
+				regulator-max-microvolt = <5150000>;
+			};
+
+			snvs_reg: vsnvs {
+				regulator-min-microvolt = <1000000>;
+				regulator-max-microvolt = <3000000>;
+				regulator-boot-on;
+				regulator-always-on;
+			};
+
+			vref_reg: vrefddr {
+				regulator-boot-on;
+				regulator-always-on;
+			};
+
+			vgen1_reg: vgen1 {
+				regulator-min-microvolt = <800000>;
+				regulator-max-microvolt = <1550000>;
+			};
+
+			vgen2_reg: vgen2 {
+				regulator-min-microvolt = <800000>;
+				regulator-max-microvolt = <1550000>;
+			};
+
+			vgen3_reg: vgen3 {
+				regulator-min-microvolt = <1800000>;
+				regulator-max-microvolt = <3300000>;
+			};
+
+			vgen4_reg: vgen4 {
+				regulator-min-microvolt = <1800000>;
+				regulator-max-microvolt = <3300000>;
+				regulator-always-on;
+			};
+
+			vgen5_reg: vgen5 {
+				regulator-min-microvolt = <1800000>;
+				regulator-max-microvolt = <3300000>;
+				regulator-always-on;
+			};
+
+			vgen6_reg: vgen6 {
+				regulator-min-microvolt = <1800000>;
+				regulator-max-microvolt = <3300000>;
+				regulator-always-on;
+			};
+		};
+	};
drivers/regulator/Kconfig +7 -0
index f1e6ad9..f913172 100644
@@ -158,6 +158,13 @@ config REGULATOR_MC13892
 	  Say y here to support the regulators found on the Freescale MC13892
 	  PMIC.
 
+config REGULATOR_PFUZE100
+	tristate "Support regulators on Freescale PFUZE100 PMIC"
+	depends on I2C
+	help
+	  Say y here to support the regulators found on the Freescale PFUZE100
+	  PMIC.
+
 config REGULATOR_ISL6271A
 	tristate "Intersil ISL6271A Power regulator"
 	depends on I2C
drivers/regulator/Makefile +1 -0
index ba4a3cf..68cc298 100644
@@ -72,6 +72,7 @@ obj-$(CONFIG_REGULATOR_WM831X) += wm831x-ldo.o
 obj-$(CONFIG_REGULATOR_WM8350) += wm8350-regulator.o
 obj-$(CONFIG_REGULATOR_WM8400) += wm8400-regulator.o
 obj-$(CONFIG_REGULATOR_WM8994) += wm8994-regulator.o
+obj-$(CONFIG_REGULATOR_PFUZE100) += pfuze100-regulator.o
 
 
 ccflags-$(CONFIG_REGULATOR_DEBUG) += -DDEBUG
drivers/regulator/pfuze100-regulator.c new file +461 -0

461 lines not on this page · raw message

include/linux/regulator/pfuze100.h new file +44 -0

44 lines not on this page · raw message

Signature · 1 line
1.7.5.4
maintainer
#1 lore raw
Quoted 1 line · Robin Gong

Add pfuze100 regulator driver.

Looks good, there's some minor issues below but they should be small.

drivers/regulator/Kconfig config REGULATOR_MC13892 · line 167

Quoted 13 lines
drivers/regulator/Kconfig +7 -0
@@ -158,6 +158,13 @@ config REGULATOR_MC13892
 	  Say y here to support the regulators found on the Freescale MC13892
 	  PMIC.
 
+config REGULATOR_PFUZE100
+	tristate "Support regulators on Freescale PFUZE100 PMIC"
+	depends on I2C
+	help
+	  Say y here to support the regulators found on the Freescale PFUZE100
+	  PMIC.
+

Please keep this and the Makefile sorted - if there's issues merging then please use my topic/kconfig as a base.

drivers/regulator/Kconfig config REGULATOR_MC13892

Quoted 6 lines
drivers/regulator/Kconfig +6 -0
+		if (val & 0x40)
+			ramp_delay = 50000 / (4 * ramp_delay);
+		else
+			ramp_delay = 25000 / (2 * ramp_delay);
+		if (id <= PFUZE100_SW1C)
+			ramp_delay = 25000 / (2 * ramp_delay);

This is a bit confusing as there's a cumalaitve modification applied to ramp_delay in the case that id is less than SW1C but it's not obvious that this is intentional given the calculations. Please change this to make it clearer what the intended logic is (assuming it's not buggy) - something like if ... else if ... else for example.

drivers/regulator/Kconfig

Quoted 6 lines
drivers/regulator/Kconfig +6 -0
+	ret = regmap_read(pfuze_chip->regmap, PFUZE100_REVID, &value);
+	if (ret)
+		return ret;
+	dev_info(pfuze_chip->dev,
+		 "Full lay: %x ,Metal lay: %x\n",
+		 (value & 0xf0) >> 4, value & 0x0f);

The space should be after not before the comma in the displayed string.

drivers/regulator/Kconfig

Quoted 2 lines
drivers/regulator/Kconfig +2 -0
+	dev_info(pfuze_chip->dev, "FAB: %x , FIN: %x\n",
+		 (value & 0xc) >> 2, value & 0x3);

Only a space after the , for normal formatting. ie both should look like "%x, bar".

#2 lore raw

Thanks Mark, I will send V4.

-----Original Message-----
From: Mark Brown [mailto:[email protected]]
Sent: Saturday, July 20, 2013 1:31 AM
To: Gong Yibin-B38343
Cc: [email protected]; [email protected]; [email protected]; [email protected]; [email protected]; [email protected]; [email protected]; [email protected]
Subject: Re: [PATCH v3] regulator: pfuze100: add pfuze100 regulator driver

Quoted 1 line · Robin Gong

Add pfuze100 regulator driver.

Looks good, there's some minor issues below but they should be small.

drivers/regulator/Kconfig config REGULATOR_MC13892 · line 167

Quoted 13 lines
drivers/regulator/Kconfig +7 -0
@@ -158,6 +158,13 @@ config REGULATOR_MC13892
 	  Say y here to support the regulators found on the Freescale MC13892
 	  PMIC.
 
+config REGULATOR_PFUZE100
+	tristate "Support regulators on Freescale PFUZE100 PMIC"
+	depends on I2C
+	help
+	  Say y here to support the regulators found on the Freescale PFUZE100
+	  PMIC.
+

Please keep this and the Makefile sorted - if there's issues merging then please use my topic/kconfig as a base.

drivers/regulator/Kconfig config REGULATOR_MC13892

Quoted 6 lines
drivers/regulator/Kconfig +6 -0
+		if (val & 0x40)
+			ramp_delay = 50000 / (4 * ramp_delay);
+		else
+			ramp_delay = 25000 / (2 * ramp_delay);
+		if (id <= PFUZE100_SW1C)
+			ramp_delay = 25000 / (2 * ramp_delay);

This is a bit confusing as there's a cumalaitve modification applied to ramp_delay in the case that id is less than SW1C but it's not obvious that this is intentional given the calculations. Please change this to make it clearer what the intended logic is (assuming it's not buggy) - something like if ... else if ... else for example.

drivers/regulator/Kconfig

Quoted 6 lines
drivers/regulator/Kconfig +6 -0
+	ret = regmap_read(pfuze_chip->regmap, PFUZE100_REVID, &value);
+	if (ret)
+		return ret;
+	dev_info(pfuze_chip->dev,
+		 "Full lay: %x ,Metal lay: %x\n",
+		 (value & 0xf0) >> 4, value & 0x0f);

The space should be after not before the comma in the displayed string.

drivers/regulator/Kconfig

Quoted 2 lines
drivers/regulator/Kconfig +2 -0
+	dev_info(pfuze_chip->dev, "FAB: %x , FIN: %x\n",
+		 (value & 0xc) >> 2, value & 0x3);

Only a space after the , for normal formatting. ie both should look like "%x, bar".