Skip to contentSkip to conversation

regualtor: s2mps11: Add samsung s2mps11 regulator driver

PATCH Superseded Sangbeom Kim 2 participants 2 messages Jul 7, 2012 – Jul 9, 2012

Subsystems (3)

v2 of 3 Superseded Latest is v3 →

lore
Share & tools
lore
#0 lore raw

PATCH v2 5/7 regualtor: s2mps11: Add samsung s2mps11 regulator driver

This patch add Samsung S2MPS11 regulator driver. The S2MPS11 can support 10 Bucks and 38 LDOs and RTC. Especially, S2MPS11 is designed for high performance Samsung application processor.

---
 drivers/regulator/Kconfig           |    8 +
 drivers/regulator/Makefile          |    1 +
 drivers/regulator/s2mps11.c         |  692 +++++++++++++++++++++++++++++++++++
 drivers/regulator/s5m8767.c         |    6 -
 include/linux/mfd/samsung/core.h    |   15 +
 include/linux/mfd/samsung/s2mps11.h |  179 +++++++++
 6 files changed, 895 insertions(+), 6 deletions(-)
 create mode 100644 drivers/regulator/s2mps11.c
 create mode 100644 include/linux/mfd/samsung/s2mps11.h
drivers/regulator/Kconfig +8 -0
index 357752d..1013501 100644
@@ -256,6 +256,14 @@ config REGULATOR_RC5T583
 	  through regulator interface. The device supports multiple DCDC/LDO
 	  outputs which can be controlled by i2c communication.
 
+config REGULATOR_S2MPS11
+	tristate "Samsung S2MPS11 voltage regulator"
+	depends on MFD_SEC_CORE
+	help
+	 This driver supports a Samsung S2MPS11 voltage output regulator
+	 via I2C bus. S2MPS11 is comprised of high efficient Buck converters
+	 including Dual-Phase Buck converter, Buck-Boost converter, various LDOs.
+
 config REGULATOR_S5M8767
 	tristate "Samsung S5M8767A voltage regulator"
 	depends on MFD_SEC_CORE
drivers/regulator/Makefile +1 -0
index c746088..a70c4f4 100644
@@ -40,6 +40,7 @@ obj-$(CONFIG_REGULATOR_PALMAS) += palmas-regulator.o
 obj-$(CONFIG_REGULATOR_PCAP) += pcap-regulator.o
 obj-$(CONFIG_REGULATOR_PCF50633) += pcf50633-regulator.o
 obj-$(CONFIG_REGULATOR_RC5T583)  += rc5t583-regulator.o
+obj-$(CONFIG_REGULATOR_S2MPS11) += s2mps11.o
 obj-$(CONFIG_REGULATOR_S5M8767) += s5m8767.o
 obj-$(CONFIG_REGULATOR_TPS6105X) += tps6105x-regulator.o
 obj-$(CONFIG_REGULATOR_TPS62360) += tps62360-regulator.o
drivers/regulator/s2mps11.c new file +692 -0

692 lines not on this page · raw message

drivers/regulator/s5m8767.c +0 -6
index 667fb1e..234934b 100644
@@ -45,12 +45,6 @@ struct s5m8767_info {
 	int buck_gpioindex;
 };
 
-struct sec_voltage_desc {
-	int max;
-	int min;
-	int step;
-};
-
 static const struct sec_voltage_desc buck_voltage_val1 = {
 	.max = 2225000,
 	.min =  650000,
include/linux/mfd/samsung/core.h +15 -0
index be6277a..d888f66 100644
@@ -20,6 +20,7 @@ enum sec_device_type {
 	S5M8751X,
 	S5M8763X,
 	S5M8767X,
+	S2MPS11X,
 };
 
 /**
@@ -98,9 +99,17 @@ struct sec_pmic_platform_data {
 	int				buck4_default_idx;
 
 	int                             buck_ramp_delay;
+
+	int				buck2_ramp_delay;
+	int				buck34_ramp_delay;
+	int				buck5_ramp_delay;
+	int				buck16_ramp_delay;
+	int				buck7810_ramp_delay;
+	int				buck9_ramp_delay;
 	bool                            buck2_ramp_enable;
 	bool                            buck3_ramp_enable;
 	bool                            buck4_ramp_enable;
+	bool				buck6_ramp_enable;
 
 	int				buck2_init;
 	int				buck3_init;
@@ -144,4 +153,10 @@ enum sec_opmode {
 	SEC_OPMODE_SUSPEND,
 };
 
+struct sec_voltage_desc {
+	int max;
+	int min;
+	int step;
+};
+
 #endif /*  __LINUX_MFD_SEC_CORE_H */
include/linux/mfd/samsung/s2mps11.h new file +179 -0

179 lines not on this page · raw message

Signature · 1 line
1.7.5.4
#1 lore raw

On Sat, Jul 07, 2012 at 06:42:09PM +0900, Sangbeom Kim wrote:

Looks fairly good overall but a lot of this should be able to be factored out to use the standard regualtor core support for register maps now.

drivers/regulator/s2mps11.c line 50

Quoted 5 lines
drivers/regulator/s2mps11.c new file +5 -0
+static const struct sec_voltage_desc buck_voltage_val1 = {
+	.max = 2000000,
+	.min =  600000,
+	.step =   6250,
+};

These should be using regulator_map_voltage_linear().

Review

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

This looks like it should be regulator_is_enabled_regmap() and similarly for the other enable/disable operations.

Review

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

regulator_get_voltage_sel_regmap()

drivers/regulator/s2mps11.c line 349

Quoted 2 lines
drivers/regulator/s2mps11.c new file +2 -0
+static int s2mps11_set_voltage(struct regulator_dev *rdev,
+				int min_uV, int max_uV, unsigned *selector)

Should be set_voltage_sel(), really set_voltage_sel_regmap()

drivers/regulator/s2mps11.c line 382

Quoted 3 lines
drivers/regulator/s2mps11.c new file +3 -0
+static int s2mps11_set_voltage_time_sel(struct regulator_dev *rdev,
+					     unsigned int old_sel,
+					     unsigned int new_sel)

regulator_set_voltage_time().

Quoted 1 line

+static int s2mps11_set_voltage_sel(struct regulator_dev *rdev, unsigned selector)

regulator_set_voltage_sel_regmap()

drivers/regulator/s2mps11.c line 576

Quoted 10 lines
drivers/regulator/s2mps11.c new file +10 -0
+	s2mps11 = devm_kzalloc(&pdev->dev, sizeof(struct s2mps11_info),
+				GFP_KERNEL);
+	if (!s2mps11)
+		return -ENOMEM;
+
+	size = sizeof(struct regulator_dev *) * pdata->num_regulators;
+	s2mps11->rdev = devm_kzalloc(&pdev->dev, size, GFP_KERNEL);
+	if (!s2mps11->rdev) {
+		return -ENOMEM;
+	}

You should register all the regulators unconditionally rather than only registering the ones in platform data, this allows people to read the state of the device even if they can't control it.