2014-11-17 00:43:08

by Chanwoo Choi

[permalink] [raw]
Subject: [PATCH 0/5] mfd: sec-core: Add support S2MPS13 PMIC device

This patchset adds Samsung S2MPS13 PMIC device driver in existing S2MPS11 PMIC
driver. The S2MPS13 has just the differnet number of regulator from existing
S2MPS14 PMIC and RTC/CLOCK IP of S2MPS13 is the same with S2MPS14. S2MPS13
PMIC has LDO[1-40] and BUCK[1-10] regulators.

Chanwoo Choi (5):
mfd: sec-core: Add support for S2MPS13 device
regulator: s2mps11: Add support S2MPS13 regulator device
clk: s2mps11: Add the support for S2MPS13 PMIC clock
rtc: s5m: Add the support for S2MPS13 RTC
mfd: s2mps11: Add binding documentation for Samsung S2MPS13 PMIC

Documentation/devicetree/bindings/mfd/s2mps11.txt | 22 +--
drivers/clk/clk-s2mps11.c | 24 +++
drivers/mfd/sec-core.c | 31 ++++
drivers/mfd/sec-irq.c | 23 ++-
drivers/regulator/Kconfig | 10 +-
drivers/regulator/s2mps11.c | 102 +++++++++++-
drivers/rtc/rtc-s5m.c | 15 +-
include/linux/mfd/samsung/core.h | 2 +
include/linux/mfd/samsung/s2mps13.h | 186 ++++++++++++++++++++++
9 files changed, 390 insertions(+), 25 deletions(-)
create mode 100644 include/linux/mfd/samsung/s2mps13.h

--
1.8.5.5


2014-11-17 00:43:09

by Chanwoo Choi

[permalink] [raw]
Subject: [PATCH 3/5] clk: s2mps11: Add the support for S2MPS13 PMIC clock

This patch adds the support for S2MPS13 PMIC clock which is same with existing
S2MPS14 RTC IP. But, S2MPS13 uses all of clocks (32khz_{ap|bt|cp}).

Cc: Mike Turquette <[email protected]>
Signed-off-by: Chanwoo Choi <[email protected]>
---
drivers/clk/clk-s2mps11.c | 24 ++++++++++++++++++++++++
1 file changed, 24 insertions(+)

diff --git a/drivers/clk/clk-s2mps11.c b/drivers/clk/clk-s2mps11.c
index b7797fb..7bb13af 100644
--- a/drivers/clk/clk-s2mps11.c
+++ b/drivers/clk/clk-s2mps11.c
@@ -23,6 +23,7 @@
#include <linux/clk-provider.h>
#include <linux/platform_device.h>
#include <linux/mfd/samsung/s2mps11.h>
+#include <linux/mfd/samsung/s2mps13.h>
#include <linux/mfd/samsung/s2mps14.h>
#include <linux/mfd/samsung/s5m8767.h>
#include <linux/mfd/samsung/core.h>
@@ -120,6 +121,24 @@ static struct clk_init_data s2mps11_clks_init[S2MPS11_CLKS_NUM] = {
},
};

+static struct clk_init_data s2mps13_clks_init[S2MPS11_CLKS_NUM] = {
+ [S2MPS11_CLK_AP] = {
+ .name = "s2mps13_ap",
+ .ops = &s2mps11_clk_ops,
+ .flags = CLK_IS_ROOT,
+ },
+ [S2MPS11_CLK_CP] = {
+ .name = "s2mps13_cp",
+ .ops = &s2mps11_clk_ops,
.flags = CLK_IS_ROOT,
+ },
+ [S2MPS11_CLK_BT] = {
+ .name = "s2mps13_bt",
+ .ops = &s2mps11_clk_ops,
+ .flags = CLK_IS_ROOT,
+ },
+};
+
static struct clk_init_data s2mps14_clks_init[S2MPS11_CLKS_NUM] = {
[S2MPS11_CLK_AP] = {
.name = "s2mps14_ap",
@@ -184,6 +203,10 @@ static int s2mps11_clk_probe(struct platform_device *pdev)
s2mps11_reg = S2MPS11_REG_RTC_CTRL;
clks_init = s2mps11_clks_init;
break;
+ case S2MPS13X:
+ s2mps11_reg = S2MPS13_REG_RTCCTRL;
+ clks_init = s2mps13_clks_init;
+ break;
case S2MPS14X:
s2mps11_reg = S2MPS14_REG_RTCCTRL;
clks_init = s2mps14_clks_init;
@@ -279,6 +302,7 @@ static int s2mps11_clk_remove(struct platform_device *pdev)

static const struct platform_device_id s2mps11_clk_id[] = {
{ "s2mps11-clk", S2MPS11X},
+ { "s2mps13-clk", S2MPS13X},
{ "s2mps14-clk", S2MPS14X},
{ "s5m8767-clk", S5M8767X},
{ },
--
1.8.5.5

2014-11-17 00:43:36

by Chanwoo Choi

[permalink] [raw]
Subject: [PATCH 5/5] mfd: s2mps11: Add binding documentation for Samsung S2MPS13 PMIC

This patch adds the binding documentation for Samsung S2MPS13 PMIC
which is similiar with existing S2MPS14 PMIC. S2MPS13 has the different number
of regulators from S2MPS14 and RTC/Clock is the same with the S2MPS14.

Cc: Lee Jones <[email protected]>
Signed-off-by: Chanwoo Choi <[email protected]>
---
Documentation/devicetree/bindings/mfd/s2mps11.txt | 22 ++++++++++++----------
1 file changed, 12 insertions(+), 10 deletions(-)

diff --git a/Documentation/devicetree/bindings/mfd/s2mps11.txt b/Documentation/devicetree/bindings/mfd/s2mps11.txt
index 0e4026a..57a0450 100644
--- a/Documentation/devicetree/bindings/mfd/s2mps11.txt
+++ b/Documentation/devicetree/bindings/mfd/s2mps11.txt
@@ -1,5 +1,5 @@

-* Samsung S2MPS11, S2MPS14 and S2MPU02 Voltage and Current Regulator
+* Samsung S2MPS11, S2MPS13, S2MPS14 and S2MPU02 Voltage and Current Regulator

The Samsung S2MPS11 is a multi-function device which includes voltage and
current regulators, RTC, charger controller and other sub-blocks. It is
@@ -7,8 +7,8 @@ interfaced to the host controller using an I2C interface. Each sub-block is
addressed by the host system using different I2C slave addresses.

Required properties:
-- compatible: Should be "samsung,s2mps11-pmic" or "samsung,s2mps14-pmic"
- or "samsung,s2mpu02-pmic".
+- compatible: Should be "samsung,s2mps11-pmic" or "samsung,s2mps13-pmic"
+ or "samsung,s2mps14-pmic" or "samsung,s2mpu02-pmic".
- reg: Specifies the I2C slave address of the pmic block. It should be 0x66.

Optional properties:
@@ -17,8 +17,8 @@ Optional properties:
- interrupts: Interrupt specifiers for interrupt sources.

Optional nodes:
-- clocks: s2mps11 and s5m8767 provide three(AP/CP/BT) buffered 32.768 KHz
- outputs, so to register these as clocks with common clock framework
+- clocks: s2mps11, s2mps13 and s5m8767 provide three(AP/CP/BT) buffered 32.768
+ KHz outputs, so to register these as clocks with common clock framework
instantiate a sub-node named "clocks". It uses the common clock binding
documented in :
[Documentation/devicetree/bindings/clock/clock-bindings.txt]
@@ -30,12 +30,12 @@ Optional nodes:
the clock which they consume.
Clock ID Devices
----------------------------------------------------------
- 32KhzAP 0 S2MPS11, S2MPS14, S5M8767
- 32KhzCP 1 S2MPS11, S5M8767
- 32KhzBT 2 S2MPS11, S2MPS14, S5M8767
+ 32KhzAP 0 S2MPS11, S2MPS13, S2MPS14, S5M8767
+ 32KhzCP 1 S2MPS11, S2MPS13, S5M8767
+ 32KhzBT 2 S2MPS11, S2MPS13, S2MPS14, S5M8767

- - compatible: Should be one of: "samsung,s2mps11-clk", "samsung,s2mps14-clk",
- "samsung,s5m8767-clk"
+ - compatible: Should be one of: "samsung,s2mps11-clk", "samsung,s2mps13-clk",
+ "samsung,s2mps14-clk", "samsung,s5m8767-clk"

- regulators: The regulators of s2mps11 that have to be instantiated should be
included in a sub-node named 'regulators'. Regulator nodes included in this
@@ -81,12 +81,14 @@ as per the datasheet of s2mps11.
- LDOn
- valid values for n are:
- S2MPS11: 1 to 38
+ - S2MPS13: 1 to 40
- S2MPS14: 1 to 25
- S2MPU02: 1 to 28
- Example: LDO1, LDO2, LDO28
- BUCKn
- valid values for n are:
- S2MPS11: 1 to 10
+ - S2MPS13: 1 to 10
- S2MPS14: 1 to 5
- S2MPU02: 1 to 7
- Example: BUCK1, BUCK2, BUCK9
--
1.8.5.5

2014-11-17 00:43:55

by Chanwoo Choi

[permalink] [raw]
Subject: [PATCH 4/5] rtc: s5m: Add the support for S2MPS13 RTC

This patch adds only the compatible string for S2MPS13 clock which is identical
with S2MPS14 clock driver.

Cc: Alessandro Zummo <[email protected]>
Signed-off-by: Chanwoo Choi <[email protected]>
---
drivers/rtc/rtc-s5m.c | 15 ++++++++++++++-
1 file changed, 14 insertions(+), 1 deletion(-)

diff --git a/drivers/rtc/rtc-s5m.c b/drivers/rtc/rtc-s5m.c
index 8754c33..e5fdfd3 100644
--- a/drivers/rtc/rtc-s5m.c
+++ b/drivers/rtc/rtc-s5m.c
@@ -191,6 +191,7 @@ static inline int s5m_check_peding_alarm_interrupt(struct s5m_rtc_info *info,
ret = regmap_read(info->regmap, S5M_RTC_STATUS, &val);
val &= S5M_ALARM0_STATUS;
break;
+ case S2MPS13X:
case S2MPS14X:
ret = regmap_read(info->s5m87xx->regmap_pmic, S2MPS14_REG_ST2,
&val);
@@ -254,6 +255,7 @@ static inline int s5m8767_rtc_set_alarm_reg(struct s5m_rtc_info *info)
case S5M8767X:
data &= ~S5M_RTC_TIME_EN_MASK;
break;
+ case S2MPS13X:
case S2MPS14X:
data |= S2MPS_RTC_RUDR_MASK;
break;
@@ -311,7 +313,9 @@ static int s5m_rtc_read_time(struct device *dev, struct rtc_time *tm)
u8 data[info->regs->regs_count];
int ret;

- if (info->device_type == S2MPS14X) {
+ switch (info->device_type) {
+ case S2MPS13X:
+ case S2MPS14X:
ret = regmap_update_bits(info->regmap,
info->regs->rtc_udr_update,
S2MPS_RTC_RUDR_MASK, S2MPS_RTC_RUDR_MASK);
@@ -333,6 +337,7 @@ static int s5m_rtc_read_time(struct device *dev, struct rtc_time *tm)
break;

case S5M8767X:
+ case S2MPS13X:
case S2MPS14X:
s5m8767_data_to_tm(data, tm, info->rtc_24hr_mode);
break;
@@ -359,6 +364,7 @@ static int s5m_rtc_set_time(struct device *dev, struct rtc_time *tm)
s5m8763_tm_to_data(tm, data);
break;
case S5M8767X:
+ case S2MPS13X:
case S2MPS14X:
ret = s5m8767_tm_to_data(tm, data);
break;
@@ -406,6 +412,7 @@ static int s5m_rtc_read_alarm(struct device *dev, struct rtc_wkalrm *alrm)
break;

case S5M8767X:
+ case S2MPS13X:
case S2MPS14X:
s5m8767_data_to_tm(data, &alrm->time, info->rtc_24hr_mode);
alrm->enabled = 0;
@@ -454,6 +461,7 @@ static int s5m_rtc_stop_alarm(struct s5m_rtc_info *info)
break;

case S5M8767X:
+ case S2MPS13X:
case S2MPS14X:
for (i = 0; i < info->regs->regs_count; i++)
data[i] &= ~ALARM_ENABLE_MASK;
@@ -498,6 +506,7 @@ static int s5m_rtc_start_alarm(struct s5m_rtc_info *info)
break;

case S5M8767X:
+ case S2MPS13X:
case S2MPS14X:
data[RTC_SEC] |= ALARM_ENABLE_MASK;
data[RTC_MIN] |= ALARM_ENABLE_MASK;
@@ -537,6 +546,7 @@ static int s5m_rtc_set_alarm(struct device *dev, struct rtc_wkalrm *alrm)
break;

case S5M8767X:
+ case S2MPS13X:
case S2MPS14X:
s5m8767_tm_to_data(&alrm->time, data);
break;
@@ -641,6 +651,7 @@ static int s5m8767_rtc_init_reg(struct s5m_rtc_info *info)
ret = regmap_raw_write(info->regmap, S5M_ALARM0_CONF, data, 2);
break;

+ case S2MPS13X:
case S2MPS14X:
data[0] = (0 << BCD_EN_SHIFT) | (1 << MODEL24_SHIFT);
ret = regmap_write(info->regmap, info->regs->ctrl, data[0]);
@@ -678,6 +689,7 @@ static int s5m_rtc_probe(struct platform_device *pdev)
return -ENOMEM;

switch (pdata->device_type) {
+ case S2MPS13X:
case S2MPS14X:
regmap_cfg = &s2mps14_rtc_regmap_config;
info->regs = &s2mps_rtc_regs;
@@ -831,6 +843,7 @@ static SIMPLE_DEV_PM_OPS(s5m_rtc_pm_ops, s5m_rtc_suspend, s5m_rtc_resume);

static const struct platform_device_id s5m_rtc_id[] = {
{ "s5m-rtc", S5M8767X },
+ { "s2mps13-rtc", S2MPS13X },
{ "s2mps14-rtc", S2MPS14X },
};

--
1.8.5.5

2014-11-17 00:44:17

by Chanwoo Choi

[permalink] [raw]
Subject: [PATCH 2/5] regulator: s2mps11: Add support S2MPS13 regulator device

This patch adds S2MPS13 regulator device to existing S2MPS11 device driver.
The S2MPS13 has just different number of regulators from S2MPS14.
The S2MPS13 regulator device includes LDO[1-40] and BUCK[1-10].

Cc: Mark Brown <[email protected]>
Signed-off-by: Chanwoo Choi <[email protected]>
---
drivers/mfd/sec-core.c | 13 +++
drivers/regulator/Kconfig | 10 +-
drivers/regulator/s2mps11.c | 102 +++++++++++++++++++-
include/linux/mfd/samsung/core.h | 1 +
include/linux/mfd/samsung/s2mps13.h | 186 ++++++++++++++++++++++++++++++++++++
5 files changed, 304 insertions(+), 8 deletions(-)
create mode 100644 include/linux/mfd/samsung/s2mps13.h

diff --git a/drivers/mfd/sec-core.c b/drivers/mfd/sec-core.c
index 48c0d4a..5b8527d 100644
--- a/drivers/mfd/sec-core.c
+++ b/drivers/mfd/sec-core.c
@@ -27,6 +27,7 @@
#include <linux/mfd/samsung/irq.h>
#include <linux/mfd/samsung/s2mpa01.h>
#include <linux/mfd/samsung/s2mps11.h>
+#include <linux/mfd/samsung/s2mps13.h>
#include <linux/mfd/samsung/s2mps14.h>
#include <linux/mfd/samsung/s2mpu02.h>
#include <linux/mfd/samsung/s5m8763.h>
@@ -207,6 +208,15 @@ static const struct regmap_config s2mps11_regmap_config = {
.cache_type = REGCACHE_FLAT,
};

+static const struct regmap_config s2mps13_regmap_config = {
+ .reg_bits = 8,
+ .val_bits = 8,
+
+ .max_register = S2MPS13_REG_LDODSCH5,
+ .volatile_reg = s2mps11_volatile,
+ .cache_type = REGCACHE_FLAT,
+};
+
static const struct regmap_config s2mps14_regmap_config = {
.reg_bits = 8,
.val_bits = 8,
@@ -338,6 +348,9 @@ static int sec_pmic_probe(struct i2c_client *i2c,
case S2MPS11X:
regmap = &s2mps11_regmap_config;
break;
+ case S2MPS13X:
+ regmap = &s2mps13_regmap_config;
+ break;
case S2MPS14X:
regmap = &s2mps14_regmap_config;
break;
diff --git a/drivers/regulator/Kconfig b/drivers/regulator/Kconfig
index 55d7b7b..5e06134 100644
--- a/drivers/regulator/Kconfig
+++ b/drivers/regulator/Kconfig
@@ -529,13 +529,13 @@ config REGULATOR_S2MPA01
via I2C bus. S2MPA01 has 10 Bucks and 26 LDO outputs.

config REGULATOR_S2MPS11
- tristate "Samsung S2MPS11/S2MPS14/S2MPU02 voltage regulator"
+ tristate "Samsung S2MPS11/S2MPS13/S2MPS14/S2MPU02 voltage regulator"
depends on MFD_SEC_CORE
help
- This driver supports a Samsung S2MPS11/S2MPS14/S2MPU02 voltage output
- regulator via I2C bus. The chip is comprised of high efficient Buck
- converters including Dual-Phase Buck converter, Buck-Boost converter,
- various LDOs.
+ This driver supports a Samsung S2MPS11/S2MPS13/S2MPS14/S2MPU02 voltage
+ output regulator via I2C bus. The chip 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"
diff --git a/drivers/regulator/s2mps11.c b/drivers/regulator/s2mps11.c
index adab82d..738dc77 100644
--- a/drivers/regulator/s2mps11.c
+++ b/drivers/regulator/s2mps11.c
@@ -30,6 +30,7 @@
#include <linux/of_gpio.h>
#include <linux/mfd/samsung/core.h>
#include <linux/mfd/samsung/s2mps11.h>
+#include <linux/mfd/samsung/s2mps13.h>
#include <linux/mfd/samsung/s2mps14.h>
#include <linux/mfd/samsung/s2mpu02.h>

@@ -45,10 +46,10 @@ struct s2mps11_info {
enum sec_device_type dev_type;

/*
- * One bit for each S2MPS14/S2MPU02 regulator whether the suspend mode
- * was enabled.
+ * One bit for each S2MPS13/S2MPS14/S2MPU02 regulator whether
+ * the suspend mode was enabled.
*/
- unsigned long long s2mps14_suspend_state:35;
+ unsigned long long s2mps14_suspend_state:50;

/* Array of size rdev_num with GPIO-s for external sleep control */
int *ext_control_gpio;
@@ -369,12 +370,101 @@ static const struct regulator_desc s2mps11_regulators[] = {
regulator_desc_s2mps11_buck6_10(10, MIN_750_MV, STEP_12_5_MV),
};

+static struct regulator_ops s2mps14_reg_ops;
+
+#define regulator_desc_s2mps13_ldo(num, min, step, min_sel) { \
+ .name = "LDO"#num, \
+ .id = S2MPS13_LDO##num, \
+ .ops = &s2mps14_reg_ops, \
+ .type = REGULATOR_VOLTAGE, \
+ .owner = THIS_MODULE, \
+ .min_uV = min, \
+ .uV_step = step, \
+ .linear_min_sel = min_sel, \
+ .n_voltages = S2MPS14_LDO_N_VOLTAGES, \
+ .vsel_reg = S2MPS13_REG_L1CTRL + num - 1, \
+ .vsel_mask = S2MPS14_LDO_VSEL_MASK, \
+ .enable_reg = S2MPS13_REG_L1CTRL + num - 1, \
+ .enable_mask = S2MPS14_ENABLE_MASK \
+}
+
+#define regulator_desc_s2mps13_buck(num, min, step, min_sel) { \
+ .name = "BUCK"#num, \
+ .id = S2MPS13_BUCK##num, \
+ .ops = &s2mps14_reg_ops, \
+ .type = REGULATOR_VOLTAGE, \
+ .owner = THIS_MODULE, \
+ .min_uV = min, \
+ .uV_step = step, \
+ .linear_min_sel = min_sel, \
+ .n_voltages = S2MPS14_BUCK_N_VOLTAGES, \
+ .ramp_delay = S2MPS13_BUCK_RAMP_DELAY, \
+ .vsel_reg = S2MPS13_REG_B1OUT + (num - 1) * 2, \
+ .vsel_mask = S2MPS14_BUCK_VSEL_MASK, \
+ .enable_reg = S2MPS13_REG_B1CTRL + (num - 1) * 2, \
+ .enable_mask = S2MPS14_ENABLE_MASK \
+}
+
+static const struct regulator_desc s2mps13_regulators[] = {
+ regulator_desc_s2mps13_ldo(1, MIN_800_MV, STEP_12_5_MV, 0x00),
+ regulator_desc_s2mps13_ldo(2, MIN_1400_MV, STEP_50_MV, 0x0C),
+ regulator_desc_s2mps13_ldo(3, MIN_1000_MV, STEP_25_MV, 0x08),
+ regulator_desc_s2mps13_ldo(4, MIN_800_MV, STEP_12_5_MV, 0x00),
+ regulator_desc_s2mps13_ldo(5, MIN_800_MV, STEP_12_5_MV, 0x00),
+ regulator_desc_s2mps13_ldo(6, MIN_800_MV, STEP_12_5_MV, 0x00),
+ regulator_desc_s2mps13_ldo(7, MIN_1000_MV, STEP_25_MV, 0x08),
+ regulator_desc_s2mps13_ldo(8, MIN_1000_MV, STEP_25_MV, 0x08),
+ regulator_desc_s2mps13_ldo(9, MIN_1000_MV, STEP_25_MV, 0x08),
+ regulator_desc_s2mps13_ldo(10, MIN_1400_MV, STEP_50_MV, 0x0C),
+ regulator_desc_s2mps13_ldo(11, MIN_800_MV, STEP_25_MV, 0x10),
+ regulator_desc_s2mps13_ldo(12, MIN_800_MV, STEP_25_MV, 0x10),
+ regulator_desc_s2mps13_ldo(13, MIN_800_MV, STEP_25_MV, 0x10),
+ regulator_desc_s2mps13_ldo(14, MIN_800_MV, STEP_12_5_MV, 0x00),
+ regulator_desc_s2mps13_ldo(15, MIN_800_MV, STEP_12_5_MV, 0x00),
+ regulator_desc_s2mps13_ldo(16, MIN_1400_MV, STEP_50_MV, 0x0C),
+ regulator_desc_s2mps13_ldo(17, MIN_1400_MV, STEP_50_MV, 0x0C),
+ regulator_desc_s2mps13_ldo(18, MIN_1000_MV, STEP_25_MV, 0x08),
+ regulator_desc_s2mps13_ldo(19, MIN_1000_MV, STEP_25_MV, 0x08),
+ regulator_desc_s2mps13_ldo(20, MIN_1400_MV, STEP_50_MV, 0x0C),
+ regulator_desc_s2mps13_ldo(21, MIN_1000_MV, STEP_25_MV, 0x08),
+ regulator_desc_s2mps13_ldo(22, MIN_1000_MV, STEP_25_MV, 0x08),
+ regulator_desc_s2mps13_ldo(23, MIN_800_MV, STEP_12_5_MV, 0x00),
+ regulator_desc_s2mps13_ldo(24, MIN_800_MV, STEP_12_5_MV, 0x00),
+ regulator_desc_s2mps13_ldo(25, MIN_1400_MV, STEP_50_MV, 0x0C),
+ regulator_desc_s2mps13_ldo(26, MIN_1400_MV, STEP_50_MV, 0x0C),
+ regulator_desc_s2mps13_ldo(27, MIN_1400_MV, STEP_50_MV, 0x0C),
+ regulator_desc_s2mps13_ldo(28, MIN_1000_MV, STEP_25_MV, 0x08),
+ regulator_desc_s2mps13_ldo(29, MIN_1400_MV, STEP_50_MV, 0x0C),
+ regulator_desc_s2mps13_ldo(30, MIN_1400_MV, STEP_50_MV, 0x0C),
+ regulator_desc_s2mps13_ldo(31, MIN_1000_MV, STEP_25_MV, 0x08),
+ regulator_desc_s2mps13_ldo(32, MIN_1000_MV, STEP_25_MV, 0x08),
+ regulator_desc_s2mps13_ldo(33, MIN_1400_MV, STEP_50_MV, 0x0C),
+ regulator_desc_s2mps13_ldo(34, MIN_1000_MV, STEP_25_MV, 0x08),
+ regulator_desc_s2mps13_ldo(35, MIN_1400_MV, STEP_50_MV, 0x0C),
+ regulator_desc_s2mps13_ldo(36, MIN_800_MV, STEP_12_5_MV, 0x00),
+ regulator_desc_s2mps13_ldo(37, MIN_1000_MV, STEP_25_MV, 0x08),
+ regulator_desc_s2mps13_ldo(38, MIN_1400_MV, STEP_50_MV, 0x0C),
+ regulator_desc_s2mps13_ldo(39, MIN_1000_MV, STEP_25_MV, 0x08),
+ regulator_desc_s2mps13_ldo(40, MIN_1400_MV, STEP_50_MV, 0x0C),
+ regulator_desc_s2mps13_buck(1, MIN_500_MV, STEP_6_25_MV, 0x10),
+ regulator_desc_s2mps13_buck(2, MIN_500_MV, STEP_6_25_MV, 0x10),
+ regulator_desc_s2mps13_buck(3, MIN_500_MV, STEP_6_25_MV, 0x10),
+ regulator_desc_s2mps13_buck(4, MIN_500_MV, STEP_6_25_MV, 0x10),
+ regulator_desc_s2mps13_buck(5, MIN_500_MV, STEP_6_25_MV, 0x10),
+ regulator_desc_s2mps13_buck(6, MIN_500_MV, STEP_6_25_MV, 0x10),
+ regulator_desc_s2mps13_buck(7, MIN_500_MV, STEP_6_25_MV, 0x10),
+ regulator_desc_s2mps13_buck(8, MIN_1000_MV, STEP_12_5_MV, 0x20),
+ regulator_desc_s2mps13_buck(9, MIN_1000_MV, STEP_12_5_MV, 0x20),
+ regulator_desc_s2mps13_buck(10, MIN_500_MV, STEP_6_25_MV, 0x10),
+};
+
static int s2mps14_regulator_enable(struct regulator_dev *rdev)
{
struct s2mps11_info *s2mps11 = rdev_get_drvdata(rdev);
unsigned int val;

switch (s2mps11->dev_type) {
+ case S2MPS13X:
case S2MPS14X:
if (s2mps11->s2mps14_suspend_state & (1 << rdev_get_id(rdev)))
val = S2MPS14_ENABLE_SUSPEND;
@@ -406,6 +496,7 @@ static int s2mps14_regulator_set_suspend_disable(struct regulator_dev *rdev)

/* Below LDO should be always on or does not support suspend mode. */
switch (s2mps11->dev_type) {
+ case S2MPS13X:
case S2MPS14X:
switch (rdev_id) {
case S2MPS14_LDO3:
@@ -831,6 +922,10 @@ static int s2mps11_pmic_probe(struct platform_device *pdev)
s2mps11->rdev_num = ARRAY_SIZE(s2mps11_regulators);
regulators = s2mps11_regulators;
break;
+ case S2MPS13X:
+ s2mps11->rdev_num = ARRAY_SIZE(s2mps13_regulators);
+ regulators = s2mps13_regulators;
+ break;
case S2MPS14X:
s2mps11->rdev_num = ARRAY_SIZE(s2mps14_regulators);
regulators = s2mps14_regulators;
@@ -927,6 +1022,7 @@ out:

static const struct platform_device_id s2mps11_pmic_id[] = {
{ "s2mps11-pmic", S2MPS11X},
+ { "s2mps13-pmic", S2MPS13X},
{ "s2mps14-pmic", S2MPS14X},
{ "s2mpu02-pmic", S2MPU02},
{ },
diff --git a/include/linux/mfd/samsung/core.h b/include/linux/mfd/samsung/core.h
index 0c0343e..3fdb7cf 100644
--- a/include/linux/mfd/samsung/core.h
+++ b/include/linux/mfd/samsung/core.h
@@ -28,6 +28,7 @@
#define MIN_800_MV 800000
#define MIN_750_MV 750000
#define MIN_600_MV 600000
+#define MIN_500_MV 500000

/* Macros to represent steps for LDO/BUCK */
#define STEP_50_MV 50000
diff --git a/include/linux/mfd/samsung/s2mps13.h b/include/linux/mfd/samsung/s2mps13.h
new file mode 100644
index 0000000..ce5dda8
--- /dev/null
+++ b/include/linux/mfd/samsung/s2mps13.h
@@ -0,0 +1,186 @@
+/*
+ * s2mps13.h
+ *
+ * Copyright (c) 2014 Samsung Electronics Co., Ltd
+ * http://www.samsung.com
+ *
+ * This program is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License as published by the
+ * Free Software Foundation; either version 2 of the License, or (at your
+ * option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ */
+
+#ifndef __LINUX_MFD_S2MPS13_H
+#define __LINUX_MFD_S2MPS13_H
+
+/* S2MPS13 registers */
+enum s2mps13_reg {
+ S2MPS13_REG_ID,
+ S2MPS13_REG_INT1,
+ S2MPS13_REG_INT2,
+ S2MPS13_REG_INT3,
+ S2MPS13_REG_INT1M,
+ S2MPS13_REG_INT2M,
+ S2MPS13_REG_INT3M,
+ S2MPS13_REG_ST1,
+ S2MPS13_REG_ST2,
+ S2MPS13_REG_PWRONSRC,
+ S2MPS13_REG_OFFSRC,
+ S2MPS13_REG_BU_CHG,
+ S2MPS13_REG_RTCCTRL,
+ S2MPS13_REG_CTRL1,
+ S2MPS13_REG_CTRL2,
+ S2MPS13_REG_RSVD1,
+ S2MPS13_REG_RSVD2,
+ S2MPS13_REG_RSVD3,
+ S2MPS13_REG_RSVD4,
+ S2MPS13_REG_RSVD5,
+ S2MPS13_REG_RSVD6,
+ S2MPS13_REG_CTRL3,
+ S2MPS13_REG_RSVD7,
+ S2MPS13_REG_RSVD8,
+ S2MPS13_REG_WRSTBI,
+ S2MPS13_REG_B1CTRL,
+ S2MPS13_REG_B1OUT,
+ S2MPS13_REG_B2CTRL,
+ S2MPS13_REG_B2OUT,
+ S2MPS13_REG_B3CTRL,
+ S2MPS13_REG_B3OUT,
+ S2MPS13_REG_B4CTRL,
+ S2MPS13_REG_B4OUT,
+ S2MPS13_REG_B5CTRL,
+ S2MPS13_REG_B5OUT,
+ S2MPS13_REG_B6CTRL,
+ S2MPS13_REG_B6OUT,
+ S2MPS13_REG_B7CTRL,
+ S2MPS13_REG_B7OUT,
+ S2MPS13_REG_B8CTRL,
+ S2MPS13_REG_B8OUT,
+ S2MPS13_REG_B9CTRL,
+ S2MPS13_REG_B9OUT,
+ S2MPS13_REG_B10CTRL,
+ S2MPS13_REG_B10OUT,
+ S2MPS13_REG_BB1CTRL,
+ S2MPS13_REG_BB1OUT,
+ S2MPS13_REG_BUCK_RAMP1,
+ S2MPS13_REG_BUCK_RAMP2,
+ S2MPS13_REG_LDO_DVS1,
+ S2MPS13_REG_LDO_DVS2,
+ S2MPS13_REG_LDO_DVS3,
+ S2MPS13_REG_B6OUT2,
+ S2MPS13_REG_L1CTRL,
+ S2MPS13_REG_L2CTRL,
+ S2MPS13_REG_L3CTRL,
+ S2MPS13_REG_L4CTRL,
+ S2MPS13_REG_L5CTRL,
+ S2MPS13_REG_L6CTRL,
+ S2MPS13_REG_L7CTRL,
+ S2MPS13_REG_L8CTRL,
+ S2MPS13_REG_L9CTRL,
+ S2MPS13_REG_L10CTRL,
+ S2MPS13_REG_L11CTRL,
+ S2MPS13_REG_L12CTRL,
+ S2MPS13_REG_L13CTRL,
+ S2MPS13_REG_L14CTRL,
+ S2MPS13_REG_L15CTRL,
+ S2MPS13_REG_L16CTRL,
+ S2MPS13_REG_L17CTRL,
+ S2MPS13_REG_L18CTRL,
+ S2MPS13_REG_L19CTRL,
+ S2MPS13_REG_L20CTRL,
+ S2MPS13_REG_L21CTRL,
+ S2MPS13_REG_L22CTRL,
+ S2MPS13_REG_L23CTRL,
+ S2MPS13_REG_L24CTRL,
+ S2MPS13_REG_L25CTRL,
+ S2MPS13_REG_L26CTRL,
+ S2MPS13_REG_L27CTRL,
+ S2MPS13_REG_L28CTRL,
+ S2MPS13_REG_L30CTRL,
+ S2MPS13_REG_L31CTRL,
+ S2MPS13_REG_L32CTRL,
+ S2MPS13_REG_L33CTRL,
+ S2MPS13_REG_L34CTRL,
+ S2MPS13_REG_L35CTRL,
+ S2MPS13_REG_L36CTRL,
+ S2MPS13_REG_L37CTRL,
+ S2MPS13_REG_L38CTRL,
+ S2MPS13_REG_L39CTRL,
+ S2MPS13_REG_L40CTRL,
+ S2MPS13_REG_LDODSCH1,
+ S2MPS13_REG_LDODSCH2,
+ S2MPS13_REG_LDODSCH3,
+ S2MPS13_REG_LDODSCH4,
+ S2MPS13_REG_LDODSCH5,
+};
+
+/* regulator ids */
+enum s2mps13_regulators {
+ S2MPS13_LDO1,
+ S2MPS13_LDO2,
+ S2MPS13_LDO3,
+ S2MPS13_LDO4,
+ S2MPS13_LDO5,
+ S2MPS13_LDO6,
+ S2MPS13_LDO7,
+ S2MPS13_LDO8,
+ S2MPS13_LDO9,
+ S2MPS13_LDO10,
+ S2MPS13_LDO11,
+ S2MPS13_LDO12,
+ S2MPS13_LDO13,
+ S2MPS13_LDO14,
+ S2MPS13_LDO15,
+ S2MPS13_LDO16,
+ S2MPS13_LDO17,
+ S2MPS13_LDO18,
+ S2MPS13_LDO19,
+ S2MPS13_LDO20,
+ S2MPS13_LDO21,
+ S2MPS13_LDO22,
+ S2MPS13_LDO23,
+ S2MPS13_LDO24,
+ S2MPS13_LDO25,
+ S2MPS13_LDO26,
+ S2MPS13_LDO27,
+ S2MPS13_LDO28,
+ S2MPS13_LDO29,
+ S2MPS13_LDO30,
+ S2MPS13_LDO31,
+ S2MPS13_LDO32,
+ S2MPS13_LDO33,
+ S2MPS13_LDO34,
+ S2MPS13_LDO35,
+ S2MPS13_LDO36,
+ S2MPS13_LDO37,
+ S2MPS13_LDO38,
+ S2MPS13_LDO39,
+ S2MPS13_LDO40,
+ S2MPS13_BUCK1,
+ S2MPS13_BUCK2,
+ S2MPS13_BUCK3,
+ S2MPS13_BUCK4,
+ S2MPS13_BUCK5,
+ S2MPS13_BUCK6,
+ S2MPS13_BUCK7,
+ S2MPS13_BUCK8,
+ S2MPS13_BUCK9,
+ S2MPS13_BUCK10,
+
+ S2MPS13_REGULATOR_MAX,
+};
+
+/*
+ * Default ramp delay in uv/us. Datasheet says that ramp delay can be
+ * controlled however it does not specify which register is used for that.
+ * Let's assume that default value will be set.
+ */
+#define S2MPS13_BUCK_RAMP_DELAY 12500
+
+#endif /* __LINUX_MFD_S2MPS13_H */
--
1.8.5.5

2014-11-17 00:44:36

by Chanwoo Choi

[permalink] [raw]
Subject: [PATCH 1/5] mfd: sec-core: Add support for S2MPS13 device

This patch adds the support for Samsung S2MPS13 PMIC device to the sec-core MFD
driver. The S2MPS13 is very similar with existing S2MPS14 and includes PMIC/
RTC/CLOCK devices.

Cc: Lee Jones <[email protected]>
Signed-off-by: Chanwoo Choi <[email protected]>
---
drivers/mfd/sec-core.c | 18 ++++++++++++++++++
drivers/mfd/sec-irq.c | 23 +++++++++++++++++------
include/linux/mfd/samsung/core.h | 1 +
3 files changed, 36 insertions(+), 6 deletions(-)

diff --git a/drivers/mfd/sec-core.c b/drivers/mfd/sec-core.c
index 5993608..48c0d4a 100644
--- a/drivers/mfd/sec-core.c
+++ b/drivers/mfd/sec-core.c
@@ -73,6 +73,17 @@ static const struct mfd_cell s2mps11_devs[] = {
}
};

+static const struct mfd_cell s2mps13_devs[] = {
+ {
+ .name = "s2mps13-pmic",
+ }, {
+ .name = "s2mps13-rtc",
+ }, {
+ .name = "s2mps13-clk",
+ .of_compatible = "samsung,s2mps13-clk",
+ }
+};
+
static const struct mfd_cell s2mps14_devs[] = {
{
.name = "s2mps14-pmic",
@@ -107,6 +118,9 @@ static const struct of_device_id sec_dt_match[] = {
.compatible = "samsung,s2mps11-pmic",
.data = (void *)S2MPS11X,
}, {
+ .compatible = "samsung,s2mps13-pmic",
+ .data = (void *)S2MPS13X,
+ }, {
.compatible = "samsung,s2mps14-pmic",
.data = (void *)S2MPS14X,
}, {
@@ -377,6 +391,10 @@ static int sec_pmic_probe(struct i2c_client *i2c,
sec_devs = s2mps11_devs;
num_sec_devs = ARRAY_SIZE(s2mps11_devs);
break;
+ case S2MPS13X:
+ sec_devs = s2mps13_devs;
+ num_sec_devs = ARRAY_SIZE(s2mps13_devs);
+ break;
case S2MPS14X:
sec_devs = s2mps14_devs;
num_sec_devs = ARRAY_SIZE(s2mps14_devs);
diff --git a/drivers/mfd/sec-irq.c b/drivers/mfd/sec-irq.c
index f9a5786..ba86a91 100644
--- a/drivers/mfd/sec-irq.c
+++ b/drivers/mfd/sec-irq.c
@@ -389,14 +389,22 @@ static const struct regmap_irq_chip s2mps11_irq_chip = {
.ack_base = S2MPS11_REG_INT1,
};

+#define S2MPS1X_IRQ_CHIP_COMMON_DATA \
+ .irqs = s2mps14_irqs, \
+ .num_irqs = ARRAY_SIZE(s2mps14_irqs), \
+ .num_regs = 3, \
+ .status_base = S2MPS14_REG_INT1, \
+ .mask_base = S2MPS14_REG_INT1M, \
+ .ack_base = S2MPS14_REG_INT1 \
+
+static const struct regmap_irq_chip s2mps13_irq_chip = {
+ .name = "s2mps13",
+ S2MPS1X_IRQ_CHIP_COMMON_DATA,
+};
+
static const struct regmap_irq_chip s2mps14_irq_chip = {
.name = "s2mps14",
- .irqs = s2mps14_irqs,
- .num_irqs = ARRAY_SIZE(s2mps14_irqs),
- .num_regs = 3,
- .status_base = S2MPS14_REG_INT1,
- .mask_base = S2MPS14_REG_INT1M,
- .ack_base = S2MPS14_REG_INT1,
+ S2MPS1X_IRQ_CHIP_COMMON_DATA,
};

static const struct regmap_irq_chip s2mpu02_irq_chip = {
@@ -452,6 +460,9 @@ int sec_irq_init(struct sec_pmic_dev *sec_pmic)
case S2MPS11X:
sec_irq_chip = &s2mps11_irq_chip;
break;
+ case S2MPS13X:
+ sec_irq_chip = &s2mps13_irq_chip;
+ break;
case S2MPS14X:
sec_irq_chip = &s2mps14_irq_chip;
break;
diff --git a/include/linux/mfd/samsung/core.h b/include/linux/mfd/samsung/core.h
index 1825eda..0c0343e 100644
--- a/include/linux/mfd/samsung/core.h
+++ b/include/linux/mfd/samsung/core.h
@@ -41,6 +41,7 @@ enum sec_device_type {
S5M8767X,
S2MPA01,
S2MPS11X,
+ S2MPS13X,
S2MPS14X,
S2MPU02,
};
--
1.8.5.5

2014-11-17 10:12:48

by Krzysztof Kozlowski

[permalink] [raw]
Subject: Re: [PATCH 2/5] regulator: s2mps11: Add support S2MPS13 regulator device

On 17.11.2014 01:42, Chanwoo Choi wrote:
> This patch adds S2MPS13 regulator device to existing S2MPS11 device driver.
> The S2MPS13 has just different number of regulators from S2MPS14.
> The S2MPS13 regulator device includes LDO[1-40] and BUCK[1-10].
>
> Cc: Mark Brown <[email protected]>
> Signed-off-by: Chanwoo Choi <[email protected]>
> ---
> drivers/mfd/sec-core.c | 13 +++
> drivers/regulator/Kconfig | 10 +-
> drivers/regulator/s2mps11.c | 102 +++++++++++++++++++-
> include/linux/mfd/samsung/core.h | 1 +
> include/linux/mfd/samsung/s2mps13.h | 186 ++++++++++++++++++++++++++++++++++++
> 5 files changed, 304 insertions(+), 8 deletions(-)
> create mode 100644 include/linux/mfd/samsung/s2mps13.h
>
> diff --git a/drivers/mfd/sec-core.c b/drivers/mfd/sec-core.c
> index 48c0d4a..5b8527d 100644
> --- a/drivers/mfd/sec-core.c
> +++ b/drivers/mfd/sec-core.c
> @@ -27,6 +27,7 @@
> #include <linux/mfd/samsung/irq.h>
> #include <linux/mfd/samsung/s2mpa01.h>
> #include <linux/mfd/samsung/s2mps11.h>
> +#include <linux/mfd/samsung/s2mps13.h>
> #include <linux/mfd/samsung/s2mps14.h>
> #include <linux/mfd/samsung/s2mpu02.h>
> #include <linux/mfd/samsung/s5m8763.h>
> @@ -207,6 +208,15 @@ static const struct regmap_config s2mps11_regmap_config = {
> .cache_type = REGCACHE_FLAT,
> };
>
> +static const struct regmap_config s2mps13_regmap_config = {
> + .reg_bits = 8,
> + .val_bits = 8,
> +
> + .max_register = S2MPS13_REG_LDODSCH5,
> + .volatile_reg = s2mps11_volatile,
> + .cache_type = REGCACHE_FLAT,
> +};
> +
> static const struct regmap_config s2mps14_regmap_config = {
> .reg_bits = 8,
> .val_bits = 8,
> @@ -338,6 +348,9 @@ static int sec_pmic_probe(struct i2c_client *i2c,
> case S2MPS11X:
> regmap = &s2mps11_regmap_config;
> break;
> + case S2MPS13X:
> + regmap = &s2mps13_regmap_config;
> + break;
> case S2MPS14X:
> regmap = &s2mps14_regmap_config;
> break;

Hi,

Shouldn't this (with header file) be part of previous patch (1/5)?

Rest looks fine:
Reviewed-by: Krzysztof Kozlowski <[email protected]>

Best regards,
Krzysztof


> diff --git a/drivers/regulator/Kconfig b/drivers/regulator/Kconfig
> index 55d7b7b..5e06134 100644
> --- a/drivers/regulator/Kconfig
> +++ b/drivers/regulator/Kconfig
> @@ -529,13 +529,13 @@ config REGULATOR_S2MPA01
> via I2C bus. S2MPA01 has 10 Bucks and 26 LDO outputs.
>
> config REGULATOR_S2MPS11
> - tristate "Samsung S2MPS11/S2MPS14/S2MPU02 voltage regulator"
> + tristate "Samsung S2MPS11/S2MPS13/S2MPS14/S2MPU02 voltage regulator"
> depends on MFD_SEC_CORE
> help
> - This driver supports a Samsung S2MPS11/S2MPS14/S2MPU02 voltage output
> - regulator via I2C bus. The chip is comprised of high efficient Buck
> - converters including Dual-Phase Buck converter, Buck-Boost converter,
> - various LDOs.
> + This driver supports a Samsung S2MPS11/S2MPS13/S2MPS14/S2MPU02 voltage
> + output regulator via I2C bus. The chip 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"
> diff --git a/drivers/regulator/s2mps11.c b/drivers/regulator/s2mps11.c
> index adab82d..738dc77 100644
> --- a/drivers/regulator/s2mps11.c
> +++ b/drivers/regulator/s2mps11.c
> @@ -30,6 +30,7 @@
> #include <linux/of_gpio.h>
> #include <linux/mfd/samsung/core.h>
> #include <linux/mfd/samsung/s2mps11.h>
> +#include <linux/mfd/samsung/s2mps13.h>
> #include <linux/mfd/samsung/s2mps14.h>
> #include <linux/mfd/samsung/s2mpu02.h>
>
> @@ -45,10 +46,10 @@ struct s2mps11_info {
> enum sec_device_type dev_type;
>
> /*
> - * One bit for each S2MPS14/S2MPU02 regulator whether the suspend mode
> - * was enabled.
> + * One bit for each S2MPS13/S2MPS14/S2MPU02 regulator whether
> + * the suspend mode was enabled.
> */
> - unsigned long long s2mps14_suspend_state:35;
> + unsigned long long s2mps14_suspend_state:50;
>
> /* Array of size rdev_num with GPIO-s for external sleep control */
> int *ext_control_gpio;
> @@ -369,12 +370,101 @@ static const struct regulator_desc s2mps11_regulators[] = {
> regulator_desc_s2mps11_buck6_10(10, MIN_750_MV, STEP_12_5_MV),
> };
>
> +static struct regulator_ops s2mps14_reg_ops;
> +
> +#define regulator_desc_s2mps13_ldo(num, min, step, min_sel) { \
> + .name = "LDO"#num, \
> + .id = S2MPS13_LDO##num, \
> + .ops = &s2mps14_reg_ops, \
> + .type = REGULATOR_VOLTAGE, \
> + .owner = THIS_MODULE, \
> + .min_uV = min, \
> + .uV_step = step, \
> + .linear_min_sel = min_sel, \
> + .n_voltages = S2MPS14_LDO_N_VOLTAGES, \
> + .vsel_reg = S2MPS13_REG_L1CTRL + num - 1, \
> + .vsel_mask = S2MPS14_LDO_VSEL_MASK, \
> + .enable_reg = S2MPS13_REG_L1CTRL + num - 1, \
> + .enable_mask = S2MPS14_ENABLE_MASK \
> +}
> +
> +#define regulator_desc_s2mps13_buck(num, min, step, min_sel) { \
> + .name = "BUCK"#num, \
> + .id = S2MPS13_BUCK##num, \
> + .ops = &s2mps14_reg_ops, \
> + .type = REGULATOR_VOLTAGE, \
> + .owner = THIS_MODULE, \
> + .min_uV = min, \
> + .uV_step = step, \
> + .linear_min_sel = min_sel, \
> + .n_voltages = S2MPS14_BUCK_N_VOLTAGES, \
> + .ramp_delay = S2MPS13_BUCK_RAMP_DELAY, \
> + .vsel_reg = S2MPS13_REG_B1OUT + (num - 1) * 2, \
> + .vsel_mask = S2MPS14_BUCK_VSEL_MASK, \
> + .enable_reg = S2MPS13_REG_B1CTRL + (num - 1) * 2, \
> + .enable_mask = S2MPS14_ENABLE_MASK \
> +}
> +
> +static const struct regulator_desc s2mps13_regulators[] = {
> + regulator_desc_s2mps13_ldo(1, MIN_800_MV, STEP_12_5_MV, 0x00),
> + regulator_desc_s2mps13_ldo(2, MIN_1400_MV, STEP_50_MV, 0x0C),
> + regulator_desc_s2mps13_ldo(3, MIN_1000_MV, STEP_25_MV, 0x08),
> + regulator_desc_s2mps13_ldo(4, MIN_800_MV, STEP_12_5_MV, 0x00),
> + regulator_desc_s2mps13_ldo(5, MIN_800_MV, STEP_12_5_MV, 0x00),
> + regulator_desc_s2mps13_ldo(6, MIN_800_MV, STEP_12_5_MV, 0x00),
> + regulator_desc_s2mps13_ldo(7, MIN_1000_MV, STEP_25_MV, 0x08),
> + regulator_desc_s2mps13_ldo(8, MIN_1000_MV, STEP_25_MV, 0x08),
> + regulator_desc_s2mps13_ldo(9, MIN_1000_MV, STEP_25_MV, 0x08),
> + regulator_desc_s2mps13_ldo(10, MIN_1400_MV, STEP_50_MV, 0x0C),
> + regulator_desc_s2mps13_ldo(11, MIN_800_MV, STEP_25_MV, 0x10),
> + regulator_desc_s2mps13_ldo(12, MIN_800_MV, STEP_25_MV, 0x10),
> + regulator_desc_s2mps13_ldo(13, MIN_800_MV, STEP_25_MV, 0x10),
> + regulator_desc_s2mps13_ldo(14, MIN_800_MV, STEP_12_5_MV, 0x00),
> + regulator_desc_s2mps13_ldo(15, MIN_800_MV, STEP_12_5_MV, 0x00),
> + regulator_desc_s2mps13_ldo(16, MIN_1400_MV, STEP_50_MV, 0x0C),
> + regulator_desc_s2mps13_ldo(17, MIN_1400_MV, STEP_50_MV, 0x0C),
> + regulator_desc_s2mps13_ldo(18, MIN_1000_MV, STEP_25_MV, 0x08),
> + regulator_desc_s2mps13_ldo(19, MIN_1000_MV, STEP_25_MV, 0x08),
> + regulator_desc_s2mps13_ldo(20, MIN_1400_MV, STEP_50_MV, 0x0C),
> + regulator_desc_s2mps13_ldo(21, MIN_1000_MV, STEP_25_MV, 0x08),
> + regulator_desc_s2mps13_ldo(22, MIN_1000_MV, STEP_25_MV, 0x08),
> + regulator_desc_s2mps13_ldo(23, MIN_800_MV, STEP_12_5_MV, 0x00),
> + regulator_desc_s2mps13_ldo(24, MIN_800_MV, STEP_12_5_MV, 0x00),
> + regulator_desc_s2mps13_ldo(25, MIN_1400_MV, STEP_50_MV, 0x0C),
> + regulator_desc_s2mps13_ldo(26, MIN_1400_MV, STEP_50_MV, 0x0C),
> + regulator_desc_s2mps13_ldo(27, MIN_1400_MV, STEP_50_MV, 0x0C),
> + regulator_desc_s2mps13_ldo(28, MIN_1000_MV, STEP_25_MV, 0x08),
> + regulator_desc_s2mps13_ldo(29, MIN_1400_MV, STEP_50_MV, 0x0C),
> + regulator_desc_s2mps13_ldo(30, MIN_1400_MV, STEP_50_MV, 0x0C),
> + regulator_desc_s2mps13_ldo(31, MIN_1000_MV, STEP_25_MV, 0x08),
> + regulator_desc_s2mps13_ldo(32, MIN_1000_MV, STEP_25_MV, 0x08),
> + regulator_desc_s2mps13_ldo(33, MIN_1400_MV, STEP_50_MV, 0x0C),
> + regulator_desc_s2mps13_ldo(34, MIN_1000_MV, STEP_25_MV, 0x08),
> + regulator_desc_s2mps13_ldo(35, MIN_1400_MV, STEP_50_MV, 0x0C),
> + regulator_desc_s2mps13_ldo(36, MIN_800_MV, STEP_12_5_MV, 0x00),
> + regulator_desc_s2mps13_ldo(37, MIN_1000_MV, STEP_25_MV, 0x08),
> + regulator_desc_s2mps13_ldo(38, MIN_1400_MV, STEP_50_MV, 0x0C),
> + regulator_desc_s2mps13_ldo(39, MIN_1000_MV, STEP_25_MV, 0x08),
> + regulator_desc_s2mps13_ldo(40, MIN_1400_MV, STEP_50_MV, 0x0C),
> + regulator_desc_s2mps13_buck(1, MIN_500_MV, STEP_6_25_MV, 0x10),
> + regulator_desc_s2mps13_buck(2, MIN_500_MV, STEP_6_25_MV, 0x10),
> + regulator_desc_s2mps13_buck(3, MIN_500_MV, STEP_6_25_MV, 0x10),
> + regulator_desc_s2mps13_buck(4, MIN_500_MV, STEP_6_25_MV, 0x10),
> + regulator_desc_s2mps13_buck(5, MIN_500_MV, STEP_6_25_MV, 0x10),
> + regulator_desc_s2mps13_buck(6, MIN_500_MV, STEP_6_25_MV, 0x10),
> + regulator_desc_s2mps13_buck(7, MIN_500_MV, STEP_6_25_MV, 0x10),
> + regulator_desc_s2mps13_buck(8, MIN_1000_MV, STEP_12_5_MV, 0x20),
> + regulator_desc_s2mps13_buck(9, MIN_1000_MV, STEP_12_5_MV, 0x20),
> + regulator_desc_s2mps13_buck(10, MIN_500_MV, STEP_6_25_MV, 0x10),
> +};
> +
> static int s2mps14_regulator_enable(struct regulator_dev *rdev)
> {
> struct s2mps11_info *s2mps11 = rdev_get_drvdata(rdev);
> unsigned int val;
>
> switch (s2mps11->dev_type) {
> + case S2MPS13X:
> case S2MPS14X:
> if (s2mps11->s2mps14_suspend_state & (1 << rdev_get_id(rdev)))
> val = S2MPS14_ENABLE_SUSPEND;
> @@ -406,6 +496,7 @@ static int s2mps14_regulator_set_suspend_disable(struct regulator_dev *rdev)
>
> /* Below LDO should be always on or does not support suspend mode. */
> switch (s2mps11->dev_type) {
> + case S2MPS13X:
> case S2MPS14X:
> switch (rdev_id) {
> case S2MPS14_LDO3:
> @@ -831,6 +922,10 @@ static int s2mps11_pmic_probe(struct platform_device *pdev)
> s2mps11->rdev_num = ARRAY_SIZE(s2mps11_regulators);
> regulators = s2mps11_regulators;
> break;
> + case S2MPS13X:
> + s2mps11->rdev_num = ARRAY_SIZE(s2mps13_regulators);
> + regulators = s2mps13_regulators;
> + break;
> case S2MPS14X:
> s2mps11->rdev_num = ARRAY_SIZE(s2mps14_regulators);
> regulators = s2mps14_regulators;
> @@ -927,6 +1022,7 @@ out:
>
> static const struct platform_device_id s2mps11_pmic_id[] = {
> { "s2mps11-pmic", S2MPS11X},
> + { "s2mps13-pmic", S2MPS13X},
> { "s2mps14-pmic", S2MPS14X},
> { "s2mpu02-pmic", S2MPU02},
> { },
> diff --git a/include/linux/mfd/samsung/core.h b/include/linux/mfd/samsung/core.h
> index 0c0343e..3fdb7cf 100644
> --- a/include/linux/mfd/samsung/core.h
> +++ b/include/linux/mfd/samsung/core.h
> @@ -28,6 +28,7 @@
> #define MIN_800_MV 800000
> #define MIN_750_MV 750000
> #define MIN_600_MV 600000
> +#define MIN_500_MV 500000
>
> /* Macros to represent steps for LDO/BUCK */
> #define STEP_50_MV 50000
> diff --git a/include/linux/mfd/samsung/s2mps13.h b/include/linux/mfd/samsung/s2mps13.h
> new file mode 100644
> index 0000000..ce5dda8
> --- /dev/null
> +++ b/include/linux/mfd/samsung/s2mps13.h
> @@ -0,0 +1,186 @@
> +/*
> + * s2mps13.h
> + *
> + * Copyright (c) 2014 Samsung Electronics Co., Ltd
> + * http://www.samsung.com
> + *
> + * This program is free software; you can redistribute it and/or modify it
> + * under the terms of the GNU General Public License as published by the
> + * Free Software Foundation; either version 2 of the License, or (at your
> + * option) any later version.
> + *
> + * This program is distributed in the hope that it will be useful,
> + * but WITHOUT ANY WARRANTY; without even the implied warranty of
> + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
> + * GNU General Public License for more details.
> + *
> + */
> +
> +#ifndef __LINUX_MFD_S2MPS13_H
> +#define __LINUX_MFD_S2MPS13_H
> +
> +/* S2MPS13 registers */
> +enum s2mps13_reg {
> + S2MPS13_REG_ID,
> + S2MPS13_REG_INT1,
> + S2MPS13_REG_INT2,
> + S2MPS13_REG_INT3,
> + S2MPS13_REG_INT1M,
> + S2MPS13_REG_INT2M,
> + S2MPS13_REG_INT3M,
> + S2MPS13_REG_ST1,
> + S2MPS13_REG_ST2,
> + S2MPS13_REG_PWRONSRC,
> + S2MPS13_REG_OFFSRC,
> + S2MPS13_REG_BU_CHG,
> + S2MPS13_REG_RTCCTRL,
> + S2MPS13_REG_CTRL1,
> + S2MPS13_REG_CTRL2,
> + S2MPS13_REG_RSVD1,
> + S2MPS13_REG_RSVD2,
> + S2MPS13_REG_RSVD3,
> + S2MPS13_REG_RSVD4,
> + S2MPS13_REG_RSVD5,
> + S2MPS13_REG_RSVD6,
> + S2MPS13_REG_CTRL3,
> + S2MPS13_REG_RSVD7,
> + S2MPS13_REG_RSVD8,
> + S2MPS13_REG_WRSTBI,
> + S2MPS13_REG_B1CTRL,
> + S2MPS13_REG_B1OUT,
> + S2MPS13_REG_B2CTRL,
> + S2MPS13_REG_B2OUT,
> + S2MPS13_REG_B3CTRL,
> + S2MPS13_REG_B3OUT,
> + S2MPS13_REG_B4CTRL,
> + S2MPS13_REG_B4OUT,
> + S2MPS13_REG_B5CTRL,
> + S2MPS13_REG_B5OUT,
> + S2MPS13_REG_B6CTRL,
> + S2MPS13_REG_B6OUT,
> + S2MPS13_REG_B7CTRL,
> + S2MPS13_REG_B7OUT,
> + S2MPS13_REG_B8CTRL,
> + S2MPS13_REG_B8OUT,
> + S2MPS13_REG_B9CTRL,
> + S2MPS13_REG_B9OUT,
> + S2MPS13_REG_B10CTRL,
> + S2MPS13_REG_B10OUT,
> + S2MPS13_REG_BB1CTRL,
> + S2MPS13_REG_BB1OUT,
> + S2MPS13_REG_BUCK_RAMP1,
> + S2MPS13_REG_BUCK_RAMP2,
> + S2MPS13_REG_LDO_DVS1,
> + S2MPS13_REG_LDO_DVS2,
> + S2MPS13_REG_LDO_DVS3,
> + S2MPS13_REG_B6OUT2,
> + S2MPS13_REG_L1CTRL,
> + S2MPS13_REG_L2CTRL,
> + S2MPS13_REG_L3CTRL,
> + S2MPS13_REG_L4CTRL,
> + S2MPS13_REG_L5CTRL,
> + S2MPS13_REG_L6CTRL,
> + S2MPS13_REG_L7CTRL,
> + S2MPS13_REG_L8CTRL,
> + S2MPS13_REG_L9CTRL,
> + S2MPS13_REG_L10CTRL,
> + S2MPS13_REG_L11CTRL,
> + S2MPS13_REG_L12CTRL,
> + S2MPS13_REG_L13CTRL,
> + S2MPS13_REG_L14CTRL,
> + S2MPS13_REG_L15CTRL,
> + S2MPS13_REG_L16CTRL,
> + S2MPS13_REG_L17CTRL,
> + S2MPS13_REG_L18CTRL,
> + S2MPS13_REG_L19CTRL,
> + S2MPS13_REG_L20CTRL,
> + S2MPS13_REG_L21CTRL,
> + S2MPS13_REG_L22CTRL,
> + S2MPS13_REG_L23CTRL,
> + S2MPS13_REG_L24CTRL,
> + S2MPS13_REG_L25CTRL,
> + S2MPS13_REG_L26CTRL,
> + S2MPS13_REG_L27CTRL,
> + S2MPS13_REG_L28CTRL,
> + S2MPS13_REG_L30CTRL,
> + S2MPS13_REG_L31CTRL,
> + S2MPS13_REG_L32CTRL,
> + S2MPS13_REG_L33CTRL,
> + S2MPS13_REG_L34CTRL,
> + S2MPS13_REG_L35CTRL,
> + S2MPS13_REG_L36CTRL,
> + S2MPS13_REG_L37CTRL,
> + S2MPS13_REG_L38CTRL,
> + S2MPS13_REG_L39CTRL,
> + S2MPS13_REG_L40CTRL,
> + S2MPS13_REG_LDODSCH1,
> + S2MPS13_REG_LDODSCH2,
> + S2MPS13_REG_LDODSCH3,
> + S2MPS13_REG_LDODSCH4,
> + S2MPS13_REG_LDODSCH5,
> +};
> +
> +/* regulator ids */
> +enum s2mps13_regulators {
> + S2MPS13_LDO1,
> + S2MPS13_LDO2,
> + S2MPS13_LDO3,
> + S2MPS13_LDO4,
> + S2MPS13_LDO5,
> + S2MPS13_LDO6,
> + S2MPS13_LDO7,
> + S2MPS13_LDO8,
> + S2MPS13_LDO9,
> + S2MPS13_LDO10,
> + S2MPS13_LDO11,
> + S2MPS13_LDO12,
> + S2MPS13_LDO13,
> + S2MPS13_LDO14,
> + S2MPS13_LDO15,
> + S2MPS13_LDO16,
> + S2MPS13_LDO17,
> + S2MPS13_LDO18,
> + S2MPS13_LDO19,
> + S2MPS13_LDO20,
> + S2MPS13_LDO21,
> + S2MPS13_LDO22,
> + S2MPS13_LDO23,
> + S2MPS13_LDO24,
> + S2MPS13_LDO25,
> + S2MPS13_LDO26,
> + S2MPS13_LDO27,
> + S2MPS13_LDO28,
> + S2MPS13_LDO29,
> + S2MPS13_LDO30,
> + S2MPS13_LDO31,
> + S2MPS13_LDO32,
> + S2MPS13_LDO33,
> + S2MPS13_LDO34,
> + S2MPS13_LDO35,
> + S2MPS13_LDO36,
> + S2MPS13_LDO37,
> + S2MPS13_LDO38,
> + S2MPS13_LDO39,
> + S2MPS13_LDO40,
> + S2MPS13_BUCK1,
> + S2MPS13_BUCK2,
> + S2MPS13_BUCK3,
> + S2MPS13_BUCK4,
> + S2MPS13_BUCK5,
> + S2MPS13_BUCK6,
> + S2MPS13_BUCK7,
> + S2MPS13_BUCK8,
> + S2MPS13_BUCK9,
> + S2MPS13_BUCK10,
> +
> + S2MPS13_REGULATOR_MAX,
> +};
> +
> +/*
> + * Default ramp delay in uv/us. Datasheet says that ramp delay can be
> + * controlled however it does not specify which register is used for that.
> + * Let's assume that default value will be set.
> + */
> +#define S2MPS13_BUCK_RAMP_DELAY 12500
> +
> +#endif /* __LINUX_MFD_S2MPS13_H */
>

2014-11-17 10:16:31

by Krzysztof Kozlowski

[permalink] [raw]
Subject: Re: [PATCH 3/5] clk: s2mps11: Add the support for S2MPS13 PMIC clock

On 17.11.2014 01:42, Chanwoo Choi wrote:
> This patch adds the support for S2MPS13 PMIC clock which is same with existing
> S2MPS14 RTC IP. But, S2MPS13 uses all of clocks (32khz_{ap|bt|cp}).
>
> Cc: Mike Turquette <[email protected]>
> Signed-off-by: Chanwoo Choi <[email protected]>
> ---
> drivers/clk/clk-s2mps11.c | 24 ++++++++++++++++++++++++
> 1 file changed, 24 insertions(+)
>
> diff --git a/drivers/clk/clk-s2mps11.c b/drivers/clk/clk-s2mps11.c
> index b7797fb..7bb13af 100644
> --- a/drivers/clk/clk-s2mps11.c
> +++ b/drivers/clk/clk-s2mps11.c
> @@ -23,6 +23,7 @@
> #include <linux/clk-provider.h>
> #include <linux/platform_device.h>
> #include <linux/mfd/samsung/s2mps11.h>
> +#include <linux/mfd/samsung/s2mps13.h>
> #include <linux/mfd/samsung/s2mps14.h>
> #include <linux/mfd/samsung/s5m8767.h>
> #include <linux/mfd/samsung/core.h>
> @@ -120,6 +121,24 @@ static struct clk_init_data s2mps11_clks_init[S2MPS11_CLKS_NUM] = {
> },
> };
>
> +static struct clk_init_data s2mps13_clks_init[S2MPS11_CLKS_NUM] = {
> + [S2MPS11_CLK_AP] = {
> + .name = "s2mps13_ap",
> + .ops = &s2mps11_clk_ops,
> + .flags = CLK_IS_ROOT,
> + },
> + [S2MPS11_CLK_CP] = {
> + .name = "s2mps13_cp",
> + .ops = &s2mps11_clk_ops,
> .flags = CLK_IS_ROOT,

The patch looks corrupted here. Missing '+'?

Rest looks fine.
Reviewed-by: Krzysztof Kozlowski <[email protected]>

Best regards,
Krzysztof


> + },
> + [S2MPS11_CLK_BT] = {
> + .name = "s2mps13_bt",
> + .ops = &s2mps11_clk_ops,
> + .flags = CLK_IS_ROOT,
> + },
> +};
> +
> static struct clk_init_data s2mps14_clks_init[S2MPS11_CLKS_NUM] = {
> [S2MPS11_CLK_AP] = {
> .name = "s2mps14_ap",
> @@ -184,6 +203,10 @@ static int s2mps11_clk_probe(struct platform_device *pdev)
> s2mps11_reg = S2MPS11_REG_RTC_CTRL;
> clks_init = s2mps11_clks_init;
> break;
> + case S2MPS13X:
> + s2mps11_reg = S2MPS13_REG_RTCCTRL;
> + clks_init = s2mps13_clks_init;
> + break;
> case S2MPS14X:
> s2mps11_reg = S2MPS14_REG_RTCCTRL;
> clks_init = s2mps14_clks_init;
> @@ -279,6 +302,7 @@ static int s2mps11_clk_remove(struct platform_device *pdev)
>
> static const struct platform_device_id s2mps11_clk_id[] = {
> { "s2mps11-clk", S2MPS11X},
> + { "s2mps13-clk", S2MPS13X},
> { "s2mps14-clk", S2MPS14X},
> { "s5m8767-clk", S5M8767X},
> { },
>

2014-11-17 10:19:35

by Krzysztof Kozlowski

[permalink] [raw]
Subject: Re: [PATCH 4/5] rtc: s5m: Add the support for S2MPS13 RTC

On 17.11.2014 01:42, Chanwoo Choi wrote:
> This patch adds only the compatible string for S2MPS13 clock which is identical
> with S2MPS14 clock driver.
>
> Cc: Alessandro Zummo <[email protected]>
> Signed-off-by: Chanwoo Choi <[email protected]>
> ---
> drivers/rtc/rtc-s5m.c | 15 ++++++++++++++-
> 1 file changed, 14 insertions(+), 1 deletion(-)

The RTC block looks exactly the same as S2MPS14. I wonder can S2MPS13 be
supported without adding all "+ case S2MPS13X:" here? Maybe pass the
same ID in s5m_rtc_id? This would reduce number of changes to only one line.

Best regards,
Krzysztof


>
> diff --git a/drivers/rtc/rtc-s5m.c b/drivers/rtc/rtc-s5m.c
> index 8754c33..e5fdfd3 100644
> --- a/drivers/rtc/rtc-s5m.c
> +++ b/drivers/rtc/rtc-s5m.c
> @@ -191,6 +191,7 @@ static inline int s5m_check_peding_alarm_interrupt(struct s5m_rtc_info *info,
> ret = regmap_read(info->regmap, S5M_RTC_STATUS, &val);
> val &= S5M_ALARM0_STATUS;
> break;
> + case S2MPS13X:
> case S2MPS14X:
> ret = regmap_read(info->s5m87xx->regmap_pmic, S2MPS14_REG_ST2,
> &val);
> @@ -254,6 +255,7 @@ static inline int s5m8767_rtc_set_alarm_reg(struct s5m_rtc_info *info)
> case S5M8767X:
> data &= ~S5M_RTC_TIME_EN_MASK;
> break;
> + case S2MPS13X:
> case S2MPS14X:
> data |= S2MPS_RTC_RUDR_MASK;
> break;
> @@ -311,7 +313,9 @@ static int s5m_rtc_read_time(struct device *dev, struct rtc_time *tm)
> u8 data[info->regs->regs_count];
> int ret;
>
> - if (info->device_type == S2MPS14X) {
> + switch (info->device_type) {
> + case S2MPS13X:
> + case S2MPS14X:
> ret = regmap_update_bits(info->regmap,
> info->regs->rtc_udr_update,
> S2MPS_RTC_RUDR_MASK, S2MPS_RTC_RUDR_MASK);
> @@ -333,6 +337,7 @@ static int s5m_rtc_read_time(struct device *dev, struct rtc_time *tm)
> break;
>
> case S5M8767X:
> + case S2MPS13X:
> case S2MPS14X:
> s5m8767_data_to_tm(data, tm, info->rtc_24hr_mode);
> break;
> @@ -359,6 +364,7 @@ static int s5m_rtc_set_time(struct device *dev, struct rtc_time *tm)
> s5m8763_tm_to_data(tm, data);
> break;
> case S5M8767X:
> + case S2MPS13X:
> case S2MPS14X:
> ret = s5m8767_tm_to_data(tm, data);
> break;
> @@ -406,6 +412,7 @@ static int s5m_rtc_read_alarm(struct device *dev, struct rtc_wkalrm *alrm)
> break;
>
> case S5M8767X:
> + case S2MPS13X:
> case S2MPS14X:
> s5m8767_data_to_tm(data, &alrm->time, info->rtc_24hr_mode);
> alrm->enabled = 0;
> @@ -454,6 +461,7 @@ static int s5m_rtc_stop_alarm(struct s5m_rtc_info *info)
> break;
>
> case S5M8767X:
> + case S2MPS13X:
> case S2MPS14X:
> for (i = 0; i < info->regs->regs_count; i++)
> data[i] &= ~ALARM_ENABLE_MASK;
> @@ -498,6 +506,7 @@ static int s5m_rtc_start_alarm(struct s5m_rtc_info *info)
> break;
>
> case S5M8767X:
> + case S2MPS13X:
> case S2MPS14X:
> data[RTC_SEC] |= ALARM_ENABLE_MASK;
> data[RTC_MIN] |= ALARM_ENABLE_MASK;
> @@ -537,6 +546,7 @@ static int s5m_rtc_set_alarm(struct device *dev, struct rtc_wkalrm *alrm)
> break;
>
> case S5M8767X:
> + case S2MPS13X:
> case S2MPS14X:
> s5m8767_tm_to_data(&alrm->time, data);
> break;
> @@ -641,6 +651,7 @@ static int s5m8767_rtc_init_reg(struct s5m_rtc_info *info)
> ret = regmap_raw_write(info->regmap, S5M_ALARM0_CONF, data, 2);
> break;
>
> + case S2MPS13X:
> case S2MPS14X:
> data[0] = (0 << BCD_EN_SHIFT) | (1 << MODEL24_SHIFT);
> ret = regmap_write(info->regmap, info->regs->ctrl, data[0]);
> @@ -678,6 +689,7 @@ static int s5m_rtc_probe(struct platform_device *pdev)
> return -ENOMEM;
>
> switch (pdata->device_type) {
> + case S2MPS13X:
> case S2MPS14X:
> regmap_cfg = &s2mps14_rtc_regmap_config;
> info->regs = &s2mps_rtc_regs;
> @@ -831,6 +843,7 @@ static SIMPLE_DEV_PM_OPS(s5m_rtc_pm_ops, s5m_rtc_suspend, s5m_rtc_resume);
>
> static const struct platform_device_id s5m_rtc_id[] = {
> { "s5m-rtc", S5M8767X },
> + { "s2mps13-rtc", S2MPS13X },
> { "s2mps14-rtc", S2MPS14X },
> };
>
>

2014-11-17 10:20:53

by Krzysztof Kozlowski

[permalink] [raw]
Subject: Re: [PATCH 5/5] mfd: s2mps11: Add binding documentation for Samsung S2MPS13 PMIC

On 17.11.2014 01:43, Chanwoo Choi wrote:
> This patch adds the binding documentation for Samsung S2MPS13 PMIC
> which is similiar with existing S2MPS14 PMIC. S2MPS13 has the different number
> of regulators from S2MPS14 and RTC/Clock is the same with the S2MPS14.
>
> Cc: Lee Jones <[email protected]>
> Signed-off-by: Chanwoo Choi <[email protected]>
> ---
> Documentation/devicetree/bindings/mfd/s2mps11.txt | 22 ++++++++++++----------
> 1 file changed, 12 insertions(+), 10 deletions(-)

Looks good.

Reviewed-by: Krzysztof Kozlowski <[email protected]>

Best regards,
Krzysztof

2014-11-17 23:48:59

by Mark Brown

[permalink] [raw]
Subject: Re: [PATCH 2/5] regulator: s2mps11: Add support S2MPS13 regulator device

On Mon, Nov 17, 2014 at 09:42:57AM +0900, Chanwoo Choi wrote:
> This patch adds S2MPS13 regulator device to existing S2MPS11 device driver.
> The S2MPS13 has just different number of regulators from S2MPS14.
> The S2MPS13 regulator device includes LDO[1-40] and BUCK[1-10].

Acked-by: Mark Brown <[email protected]>


Attachments:
(No filename) (317.00 B)
signature.asc (473.00 B)
Digital signature
Download all attachments

2014-11-18 00:27:07

by Sangbeom Kim

[permalink] [raw]
Subject: RE: [PATCH 1/5] mfd: sec-core: Add support for S2MPS13 device

Hi,
On Monday, November 17, 2014 9:43 AM, Chanwoo Choi wrote:

> This patch adds the support for Samsung S2MPS13 PMIC device to the sec-core MFD
> driver. The S2MPS13 is very similar with existing S2MPS14 and includes PMIC/
> RTC/CLOCK devices.

Acked-by: Sangbeom Kim <[email protected]>

2014-11-18 00:29:02

by Sangbeom Kim

[permalink] [raw]
Subject: RE: [PATCH 2/5] regulator: s2mps11: Add support S2MPS13 regulator device

Hi,
On Monday, November 17, 2014 9:43 AM, Chanwoo Choi wrote:
> This patch adds S2MPS13 regulator device to existing S2MPS11 device driver.
> The S2MPS13 has just different number of regulators from S2MPS14.
> The S2MPS13 regulator device includes LDO[1-40] and BUCK[1-10].

Acked-by: Sangbeom Kim <[email protected]>

2014-11-18 00:38:57

by Sangbeom Kim

[permalink] [raw]
Subject: RE: [PATCH 4/5] rtc: s5m: Add the support for S2MPS13 RTC

Hi,
On Monday, November 17, 2014 9:43 AM, Chanwoo Choi wrote:
> This patch adds only the compatible string for S2MPS13 clock which is identical
> with S2MPS14 clock driver.

What's the relation of S2MPS14 RTC and clock driver?

Thanks,
Sangbeom.

2014-11-18 00:40:37

by Sangbeom Kim

[permalink] [raw]
Subject: RE: [PATCH 5/5] mfd: s2mps11: Add binding documentation for Samsung S2MPS13 PMIC

Hi,
On Monday, November 17, 2014 9:43 AM, Chanwoo Choi wrote:
> This patch adds the binding documentation for Samsung S2MPS13 PMIC
> which is similiar with existing S2MPS14 PMIC. S2MPS13 has the different number
> of regulators from S2MPS14 and RTC/Clock is the same with the S2MPS14.


Acked-by: Sangbeom Kim <[email protected]>

2014-11-18 00:55:13

by Chanwoo Choi

[permalink] [raw]
Subject: Re: [PATCH 4/5] rtc: s5m: Add the support for S2MPS13 RTC

Dear Sangbeom,

On 11/18/2014 09:38 AM, Sangbeom Kim wrote:
> Hi,
> On Monday, November 17, 2014 9:43 AM, Chanwoo Choi wrote:
>> This patch adds only the compatible string for S2MPS13 clock which is identical
>> with S2MPS14 clock driver.
>
> What's the relation of S2MPS14 RTC and clock driver?

I checked the difference between S2MPS13 and S2MPS14.
But, all register (RTC) of both PMICs was the same completely.
So, I just add S2MPS13 type to use existing S2MPS14 RTC feature for S2MPS13 RTC.

Best Regards,
Chanwoo Choi

2014-11-18 00:57:34

by Chanwoo Choi

[permalink] [raw]
Subject: Re: [PATCH 2/5] regulator: s2mps11: Add support S2MPS13 regulator device

Hi Krzysztof,

On 11/17/2014 07:12 PM, Krzysztof Kozłowski wrote:
> On 17.11.2014 01:42, Chanwoo Choi wrote:
>> This patch adds S2MPS13 regulator device to existing S2MPS11 device driver.
>> The S2MPS13 has just different number of regulators from S2MPS14.
>> The S2MPS13 regulator device includes LDO[1-40] and BUCK[1-10].
>>
>> Cc: Mark Brown <[email protected]>
>> Signed-off-by: Chanwoo Choi <[email protected]>
>> ---
>> drivers/mfd/sec-core.c | 13 +++
>> drivers/regulator/Kconfig | 10 +-
>> drivers/regulator/s2mps11.c | 102 +++++++++++++++++++-
>> include/linux/mfd/samsung/core.h | 1 +
>> include/linux/mfd/samsung/s2mps13.h | 186 ++++++++++++++++++++++++++++++++++++
>> 5 files changed, 304 insertions(+), 8 deletions(-)
>> create mode 100644 include/linux/mfd/samsung/s2mps13.h
>>
>> diff --git a/drivers/mfd/sec-core.c b/drivers/mfd/sec-core.c
>> index 48c0d4a..5b8527d 100644
>> --- a/drivers/mfd/sec-core.c
>> +++ b/drivers/mfd/sec-core.c
>> @@ -27,6 +27,7 @@
>> #include <linux/mfd/samsung/irq.h>
>> #include <linux/mfd/samsung/s2mpa01.h>
>> #include <linux/mfd/samsung/s2mps11.h>
>> +#include <linux/mfd/samsung/s2mps13.h>
>> #include <linux/mfd/samsung/s2mps14.h>
>> #include <linux/mfd/samsung/s2mpu02.h>
>> #include <linux/mfd/samsung/s5m8763.h>
>> @@ -207,6 +208,15 @@ static const struct regmap_config s2mps11_regmap_config = {
>> .cache_type = REGCACHE_FLAT,
>> };
>>
>> +static const struct regmap_config s2mps13_regmap_config = {
>> + .reg_bits = 8,
>> + .val_bits = 8,
>> +
>> + .max_register = S2MPS13_REG_LDODSCH5,
>> + .volatile_reg = s2mps11_volatile,
>> + .cache_type = REGCACHE_FLAT,
>> +};
>> +
>> static const struct regmap_config s2mps14_regmap_config = {
>> .reg_bits = 8,
>> .val_bits = 8,
>> @@ -338,6 +348,9 @@ static int sec_pmic_probe(struct i2c_client *i2c,
>> case S2MPS11X:
>> regmap = &s2mps11_regmap_config;
>> break;
>> + case S2MPS13X:
>> + regmap = &s2mps13_regmap_config;
>> + break;
>> case S2MPS14X:
>> regmap = &s2mps14_regmap_config;
>> break;
>
> Hi,
>
> Shouldn't this (with header file) be part of previous patch (1/5)?

The header file(linux/mfd/samsung/s2mps13.h) is used in this patch(2/5).
But, First patch(1/5) don't use some definitions in header file.
So, header file is included in this patch.

>
> Rest looks fine:
> Reviewed-by: Krzysztof Kozlowski <[email protected]>

Thanks for your review.

Best Regards,
Chanwoo Choi

>
>> diff --git a/drivers/regulator/Kconfig b/drivers/regulator/Kconfig
>> index 55d7b7b..5e06134 100644
>> --- a/drivers/regulator/Kconfig
>> +++ b/drivers/regulator/Kconfig
>> @@ -529,13 +529,13 @@ config REGULATOR_S2MPA01
>> via I2C bus. S2MPA01 has 10 Bucks and 26 LDO outputs.
>>
>> config REGULATOR_S2MPS11
>> - tristate "Samsung S2MPS11/S2MPS14/S2MPU02 voltage regulator"
>> + tristate "Samsung S2MPS11/S2MPS13/S2MPS14/S2MPU02 voltage regulator"
>> depends on MFD_SEC_CORE
>> help
>> - This driver supports a Samsung S2MPS11/S2MPS14/S2MPU02 voltage output
>> - regulator via I2C bus. The chip is comprised of high efficient Buck
>> - converters including Dual-Phase Buck converter, Buck-Boost converter,
>> - various LDOs.
>> + This driver supports a Samsung S2MPS11/S2MPS13/S2MPS14/S2MPU02 voltage
>> + output regulator via I2C bus. The chip 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"
>> diff --git a/drivers/regulator/s2mps11.c b/drivers/regulator/s2mps11.c
>> index adab82d..738dc77 100644
>> --- a/drivers/regulator/s2mps11.c
>> +++ b/drivers/regulator/s2mps11.c
>> @@ -30,6 +30,7 @@
>> #include <linux/of_gpio.h>
>> #include <linux/mfd/samsung/core.h>
>> #include <linux/mfd/samsung/s2mps11.h>
>> +#include <linux/mfd/samsung/s2mps13.h>
>> #include <linux/mfd/samsung/s2mps14.h>
>> #include <linux/mfd/samsung/s2mpu02.h>
>>
>> @@ -45,10 +46,10 @@ struct s2mps11_info {
>> enum sec_device_type dev_type;
>>
>> /*
>> - * One bit for each S2MPS14/S2MPU02 regulator whether the suspend mode
>> - * was enabled.
>> + * One bit for each S2MPS13/S2MPS14/S2MPU02 regulator whether
>> + * the suspend mode was enabled.
>> */
>> - unsigned long long s2mps14_suspend_state:35;
>> + unsigned long long s2mps14_suspend_state:50;
>>
>> /* Array of size rdev_num with GPIO-s for external sleep control */
>> int *ext_control_gpio;
>> @@ -369,12 +370,101 @@ static const struct regulator_desc s2mps11_regulators[] = {
>> regulator_desc_s2mps11_buck6_10(10, MIN_750_MV, STEP_12_5_MV),
>> };
>>
>> +static struct regulator_ops s2mps14_reg_ops;
>> +
>> +#define regulator_desc_s2mps13_ldo(num, min, step, min_sel) { \
>> + .name = "LDO"#num, \
>> + .id = S2MPS13_LDO##num, \
>> + .ops = &s2mps14_reg_ops, \
>> + .type = REGULATOR_VOLTAGE, \
>> + .owner = THIS_MODULE, \
>> + .min_uV = min, \
>> + .uV_step = step, \
>> + .linear_min_sel = min_sel, \
>> + .n_voltages = S2MPS14_LDO_N_VOLTAGES, \
>> + .vsel_reg = S2MPS13_REG_L1CTRL + num - 1, \
>> + .vsel_mask = S2MPS14_LDO_VSEL_MASK, \
>> + .enable_reg = S2MPS13_REG_L1CTRL + num - 1, \
>> + .enable_mask = S2MPS14_ENABLE_MASK \
>> +}
>> +
>> +#define regulator_desc_s2mps13_buck(num, min, step, min_sel) { \
>> + .name = "BUCK"#num, \
>> + .id = S2MPS13_BUCK##num, \
>> + .ops = &s2mps14_reg_ops, \
>> + .type = REGULATOR_VOLTAGE, \
>> + .owner = THIS_MODULE, \
>> + .min_uV = min, \
>> + .uV_step = step, \
>> + .linear_min_sel = min_sel, \
>> + .n_voltages = S2MPS14_BUCK_N_VOLTAGES, \
>> + .ramp_delay = S2MPS13_BUCK_RAMP_DELAY, \
>> + .vsel_reg = S2MPS13_REG_B1OUT + (num - 1) * 2, \
>> + .vsel_mask = S2MPS14_BUCK_VSEL_MASK, \
>> + .enable_reg = S2MPS13_REG_B1CTRL + (num - 1) * 2, \
>> + .enable_mask = S2MPS14_ENABLE_MASK \
>> +}
>> +
>> +static const struct regulator_desc s2mps13_regulators[] = {
>> + regulator_desc_s2mps13_ldo(1, MIN_800_MV, STEP_12_5_MV, 0x00),
>> + regulator_desc_s2mps13_ldo(2, MIN_1400_MV, STEP_50_MV, 0x0C),
>> + regulator_desc_s2mps13_ldo(3, MIN_1000_MV, STEP_25_MV, 0x08),
>> + regulator_desc_s2mps13_ldo(4, MIN_800_MV, STEP_12_5_MV, 0x00),
>> + regulator_desc_s2mps13_ldo(5, MIN_800_MV, STEP_12_5_MV, 0x00),
>> + regulator_desc_s2mps13_ldo(6, MIN_800_MV, STEP_12_5_MV, 0x00),
>> + regulator_desc_s2mps13_ldo(7, MIN_1000_MV, STEP_25_MV, 0x08),
>> + regulator_desc_s2mps13_ldo(8, MIN_1000_MV, STEP_25_MV, 0x08),
>> + regulator_desc_s2mps13_ldo(9, MIN_1000_MV, STEP_25_MV, 0x08),
>> + regulator_desc_s2mps13_ldo(10, MIN_1400_MV, STEP_50_MV, 0x0C),
>> + regulator_desc_s2mps13_ldo(11, MIN_800_MV, STEP_25_MV, 0x10),
>> + regulator_desc_s2mps13_ldo(12, MIN_800_MV, STEP_25_MV, 0x10),
>> + regulator_desc_s2mps13_ldo(13, MIN_800_MV, STEP_25_MV, 0x10),
>> + regulator_desc_s2mps13_ldo(14, MIN_800_MV, STEP_12_5_MV, 0x00),
>> + regulator_desc_s2mps13_ldo(15, MIN_800_MV, STEP_12_5_MV, 0x00),
>> + regulator_desc_s2mps13_ldo(16, MIN_1400_MV, STEP_50_MV, 0x0C),
>> + regulator_desc_s2mps13_ldo(17, MIN_1400_MV, STEP_50_MV, 0x0C),
>> + regulator_desc_s2mps13_ldo(18, MIN_1000_MV, STEP_25_MV, 0x08),
>> + regulator_desc_s2mps13_ldo(19, MIN_1000_MV, STEP_25_MV, 0x08),
>> + regulator_desc_s2mps13_ldo(20, MIN_1400_MV, STEP_50_MV, 0x0C),
>> + regulator_desc_s2mps13_ldo(21, MIN_1000_MV, STEP_25_MV, 0x08),
>> + regulator_desc_s2mps13_ldo(22, MIN_1000_MV, STEP_25_MV, 0x08),
>> + regulator_desc_s2mps13_ldo(23, MIN_800_MV, STEP_12_5_MV, 0x00),
>> + regulator_desc_s2mps13_ldo(24, MIN_800_MV, STEP_12_5_MV, 0x00),
>> + regulator_desc_s2mps13_ldo(25, MIN_1400_MV, STEP_50_MV, 0x0C),
>> + regulator_desc_s2mps13_ldo(26, MIN_1400_MV, STEP_50_MV, 0x0C),
>> + regulator_desc_s2mps13_ldo(27, MIN_1400_MV, STEP_50_MV, 0x0C),
>> + regulator_desc_s2mps13_ldo(28, MIN_1000_MV, STEP_25_MV, 0x08),
>> + regulator_desc_s2mps13_ldo(29, MIN_1400_MV, STEP_50_MV, 0x0C),
>> + regulator_desc_s2mps13_ldo(30, MIN_1400_MV, STEP_50_MV, 0x0C),
>> + regulator_desc_s2mps13_ldo(31, MIN_1000_MV, STEP_25_MV, 0x08),
>> + regulator_desc_s2mps13_ldo(32, MIN_1000_MV, STEP_25_MV, 0x08),
>> + regulator_desc_s2mps13_ldo(33, MIN_1400_MV, STEP_50_MV, 0x0C),
>> + regulator_desc_s2mps13_ldo(34, MIN_1000_MV, STEP_25_MV, 0x08),
>> + regulator_desc_s2mps13_ldo(35, MIN_1400_MV, STEP_50_MV, 0x0C),
>> + regulator_desc_s2mps13_ldo(36, MIN_800_MV, STEP_12_5_MV, 0x00),
>> + regulator_desc_s2mps13_ldo(37, MIN_1000_MV, STEP_25_MV, 0x08),
>> + regulator_desc_s2mps13_ldo(38, MIN_1400_MV, STEP_50_MV, 0x0C),
>> + regulator_desc_s2mps13_ldo(39, MIN_1000_MV, STEP_25_MV, 0x08),
>> + regulator_desc_s2mps13_ldo(40, MIN_1400_MV, STEP_50_MV, 0x0C),
>> + regulator_desc_s2mps13_buck(1, MIN_500_MV, STEP_6_25_MV, 0x10),
>> + regulator_desc_s2mps13_buck(2, MIN_500_MV, STEP_6_25_MV, 0x10),
>> + regulator_desc_s2mps13_buck(3, MIN_500_MV, STEP_6_25_MV, 0x10),
>> + regulator_desc_s2mps13_buck(4, MIN_500_MV, STEP_6_25_MV, 0x10),
>> + regulator_desc_s2mps13_buck(5, MIN_500_MV, STEP_6_25_MV, 0x10),
>> + regulator_desc_s2mps13_buck(6, MIN_500_MV, STEP_6_25_MV, 0x10),
>> + regulator_desc_s2mps13_buck(7, MIN_500_MV, STEP_6_25_MV, 0x10),
>> + regulator_desc_s2mps13_buck(8, MIN_1000_MV, STEP_12_5_MV, 0x20),
>> + regulator_desc_s2mps13_buck(9, MIN_1000_MV, STEP_12_5_MV, 0x20),
>> + regulator_desc_s2mps13_buck(10, MIN_500_MV, STEP_6_25_MV, 0x10),
>> +};
>> +
>> static int s2mps14_regulator_enable(struct regulator_dev *rdev)
>> {
>> struct s2mps11_info *s2mps11 = rdev_get_drvdata(rdev);
>> unsigned int val;
>>
>> switch (s2mps11->dev_type) {
>> + case S2MPS13X:
>> case S2MPS14X:
>> if (s2mps11->s2mps14_suspend_state & (1 << rdev_get_id(rdev)))
>> val = S2MPS14_ENABLE_SUSPEND;
>> @@ -406,6 +496,7 @@ static int s2mps14_regulator_set_suspend_disable(struct regulator_dev *rdev)
>>
>> /* Below LDO should be always on or does not support suspend mode. */
>> switch (s2mps11->dev_type) {
>> + case S2MPS13X:
>> case S2MPS14X:
>> switch (rdev_id) {
>> case S2MPS14_LDO3:
>> @@ -831,6 +922,10 @@ static int s2mps11_pmic_probe(struct platform_device *pdev)
>> s2mps11->rdev_num = ARRAY_SIZE(s2mps11_regulators);
>> regulators = s2mps11_regulators;
>> break;
>> + case S2MPS13X:
>> + s2mps11->rdev_num = ARRAY_SIZE(s2mps13_regulators);
>> + regulators = s2mps13_regulators;
>> + break;
>> case S2MPS14X:
>> s2mps11->rdev_num = ARRAY_SIZE(s2mps14_regulators);
>> regulators = s2mps14_regulators;
>> @@ -927,6 +1022,7 @@ out:
>>
>> static const struct platform_device_id s2mps11_pmic_id[] = {
>> { "s2mps11-pmic", S2MPS11X},
>> + { "s2mps13-pmic", S2MPS13X},
>> { "s2mps14-pmic", S2MPS14X},
>> { "s2mpu02-pmic", S2MPU02},
>> { },
>> diff --git a/include/linux/mfd/samsung/core.h b/include/linux/mfd/samsung/core.h
>> index 0c0343e..3fdb7cf 100644
>> --- a/include/linux/mfd/samsung/core.h
>> +++ b/include/linux/mfd/samsung/core.h
>> @@ -28,6 +28,7 @@
>> #define MIN_800_MV 800000
>> #define MIN_750_MV 750000
>> #define MIN_600_MV 600000
>> +#define MIN_500_MV 500000
>>
>> /* Macros to represent steps for LDO/BUCK */
>> #define STEP_50_MV 50000
>> diff --git a/include/linux/mfd/samsung/s2mps13.h b/include/linux/mfd/samsung/s2mps13.h
>> new file mode 100644
>> index 0000000..ce5dda8
>> --- /dev/null
>> +++ b/include/linux/mfd/samsung/s2mps13.h
>> @@ -0,0 +1,186 @@
>> +/*
>> + * s2mps13.h
>> + *
>> + * Copyright (c) 2014 Samsung Electronics Co., Ltd
>> + * http://www.samsung.com
>> + *
>> + * This program is free software; you can redistribute it and/or modify it
>> + * under the terms of the GNU General Public License as published by the
>> + * Free Software Foundation; either version 2 of the License, or (at your
>> + * option) any later version.
>> + *
>> + * This program is distributed in the hope that it will be useful,
>> + * but WITHOUT ANY WARRANTY; without even the implied warranty of
>> + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
>> + * GNU General Public License for more details.
>> + *
>> + */
>> +
>> +#ifndef __LINUX_MFD_S2MPS13_H
>> +#define __LINUX_MFD_S2MPS13_H
>> +
>> +/* S2MPS13 registers */
>> +enum s2mps13_reg {
>> + S2MPS13_REG_ID,
>> + S2MPS13_REG_INT1,
>> + S2MPS13_REG_INT2,
>> + S2MPS13_REG_INT3,
>> + S2MPS13_REG_INT1M,
>> + S2MPS13_REG_INT2M,
>> + S2MPS13_REG_INT3M,
>> + S2MPS13_REG_ST1,
>> + S2MPS13_REG_ST2,
>> + S2MPS13_REG_PWRONSRC,
>> + S2MPS13_REG_OFFSRC,
>> + S2MPS13_REG_BU_CHG,
>> + S2MPS13_REG_RTCCTRL,
>> + S2MPS13_REG_CTRL1,
>> + S2MPS13_REG_CTRL2,
>> + S2MPS13_REG_RSVD1,
>> + S2MPS13_REG_RSVD2,
>> + S2MPS13_REG_RSVD3,
>> + S2MPS13_REG_RSVD4,
>> + S2MPS13_REG_RSVD5,
>> + S2MPS13_REG_RSVD6,
>> + S2MPS13_REG_CTRL3,
>> + S2MPS13_REG_RSVD7,
>> + S2MPS13_REG_RSVD8,
>> + S2MPS13_REG_WRSTBI,
>> + S2MPS13_REG_B1CTRL,
>> + S2MPS13_REG_B1OUT,
>> + S2MPS13_REG_B2CTRL,
>> + S2MPS13_REG_B2OUT,
>> + S2MPS13_REG_B3CTRL,
>> + S2MPS13_REG_B3OUT,
>> + S2MPS13_REG_B4CTRL,
>> + S2MPS13_REG_B4OUT,
>> + S2MPS13_REG_B5CTRL,
>> + S2MPS13_REG_B5OUT,
>> + S2MPS13_REG_B6CTRL,
>> + S2MPS13_REG_B6OUT,
>> + S2MPS13_REG_B7CTRL,
>> + S2MPS13_REG_B7OUT,
>> + S2MPS13_REG_B8CTRL,
>> + S2MPS13_REG_B8OUT,
>> + S2MPS13_REG_B9CTRL,
>> + S2MPS13_REG_B9OUT,
>> + S2MPS13_REG_B10CTRL,
>> + S2MPS13_REG_B10OUT,
>> + S2MPS13_REG_BB1CTRL,
>> + S2MPS13_REG_BB1OUT,
>> + S2MPS13_REG_BUCK_RAMP1,
>> + S2MPS13_REG_BUCK_RAMP2,
>> + S2MPS13_REG_LDO_DVS1,
>> + S2MPS13_REG_LDO_DVS2,
>> + S2MPS13_REG_LDO_DVS3,
>> + S2MPS13_REG_B6OUT2,
>> + S2MPS13_REG_L1CTRL,
>> + S2MPS13_REG_L2CTRL,
>> + S2MPS13_REG_L3CTRL,
>> + S2MPS13_REG_L4CTRL,
>> + S2MPS13_REG_L5CTRL,
>> + S2MPS13_REG_L6CTRL,
>> + S2MPS13_REG_L7CTRL,
>> + S2MPS13_REG_L8CTRL,
>> + S2MPS13_REG_L9CTRL,
>> + S2MPS13_REG_L10CTRL,
>> + S2MPS13_REG_L11CTRL,
>> + S2MPS13_REG_L12CTRL,
>> + S2MPS13_REG_L13CTRL,
>> + S2MPS13_REG_L14CTRL,
>> + S2MPS13_REG_L15CTRL,
>> + S2MPS13_REG_L16CTRL,
>> + S2MPS13_REG_L17CTRL,
>> + S2MPS13_REG_L18CTRL,
>> + S2MPS13_REG_L19CTRL,
>> + S2MPS13_REG_L20CTRL,
>> + S2MPS13_REG_L21CTRL,
>> + S2MPS13_REG_L22CTRL,
>> + S2MPS13_REG_L23CTRL,
>> + S2MPS13_REG_L24CTRL,
>> + S2MPS13_REG_L25CTRL,
>> + S2MPS13_REG_L26CTRL,
>> + S2MPS13_REG_L27CTRL,
>> + S2MPS13_REG_L28CTRL,
>> + S2MPS13_REG_L30CTRL,
>> + S2MPS13_REG_L31CTRL,
>> + S2MPS13_REG_L32CTRL,
>> + S2MPS13_REG_L33CTRL,
>> + S2MPS13_REG_L34CTRL,
>> + S2MPS13_REG_L35CTRL,
>> + S2MPS13_REG_L36CTRL,
>> + S2MPS13_REG_L37CTRL,
>> + S2MPS13_REG_L38CTRL,
>> + S2MPS13_REG_L39CTRL,
>> + S2MPS13_REG_L40CTRL,
>> + S2MPS13_REG_LDODSCH1,
>> + S2MPS13_REG_LDODSCH2,
>> + S2MPS13_REG_LDODSCH3,
>> + S2MPS13_REG_LDODSCH4,
>> + S2MPS13_REG_LDODSCH5,
>> +};
>> +
>> +/* regulator ids */
>> +enum s2mps13_regulators {
>> + S2MPS13_LDO1,
>> + S2MPS13_LDO2,
>> + S2MPS13_LDO3,
>> + S2MPS13_LDO4,
>> + S2MPS13_LDO5,
>> + S2MPS13_LDO6,
>> + S2MPS13_LDO7,
>> + S2MPS13_LDO8,
>> + S2MPS13_LDO9,
>> + S2MPS13_LDO10,
>> + S2MPS13_LDO11,
>> + S2MPS13_LDO12,
>> + S2MPS13_LDO13,
>> + S2MPS13_LDO14,
>> + S2MPS13_LDO15,
>> + S2MPS13_LDO16,
>> + S2MPS13_LDO17,
>> + S2MPS13_LDO18,
>> + S2MPS13_LDO19,
>> + S2MPS13_LDO20,
>> + S2MPS13_LDO21,
>> + S2MPS13_LDO22,
>> + S2MPS13_LDO23,
>> + S2MPS13_LDO24,
>> + S2MPS13_LDO25,
>> + S2MPS13_LDO26,
>> + S2MPS13_LDO27,
>> + S2MPS13_LDO28,
>> + S2MPS13_LDO29,
>> + S2MPS13_LDO30,
>> + S2MPS13_LDO31,
>> + S2MPS13_LDO32,
>> + S2MPS13_LDO33,
>> + S2MPS13_LDO34,
>> + S2MPS13_LDO35,
>> + S2MPS13_LDO36,
>> + S2MPS13_LDO37,
>> + S2MPS13_LDO38,
>> + S2MPS13_LDO39,
>> + S2MPS13_LDO40,
>> + S2MPS13_BUCK1,
>> + S2MPS13_BUCK2,
>> + S2MPS13_BUCK3,
>> + S2MPS13_BUCK4,
>> + S2MPS13_BUCK5,
>> + S2MPS13_BUCK6,
>> + S2MPS13_BUCK7,
>> + S2MPS13_BUCK8,
>> + S2MPS13_BUCK9,
>> + S2MPS13_BUCK10,
>> +
>> + S2MPS13_REGULATOR_MAX,
>> +};
>> +
>> +/*
>> + * Default ramp delay in uv/us. Datasheet says that ramp delay can be
>> + * controlled however it does not specify which register is used for that.
>> + * Let's assume that default value will be set.
>> + */
>> +#define S2MPS13_BUCK_RAMP_DELAY 12500
>> +
>> +#endif /* __LINUX_MFD_S2MPS13_H */
>>
>
>

2014-11-18 01:06:48

by Chanwoo Choi

[permalink] [raw]
Subject: Re: [PATCH 3/5] clk: s2mps11: Add the support for S2MPS13 PMIC clock

On 11/17/2014 07:16 PM, Krzysztof Kozłowski wrote:
> On 17.11.2014 01:42, Chanwoo Choi wrote:
>> This patch adds the support for S2MPS13 PMIC clock which is same with existing
>> S2MPS14 RTC IP. But, S2MPS13 uses all of clocks (32khz_{ap|bt|cp}).
>>
>> Cc: Mike Turquette <[email protected]>
>> Signed-off-by: Chanwoo Choi <[email protected]>
>> ---
>> drivers/clk/clk-s2mps11.c | 24 ++++++++++++++++++++++++
>> 1 file changed, 24 insertions(+)
>>
>> diff --git a/drivers/clk/clk-s2mps11.c b/drivers/clk/clk-s2mps11.c
>> index b7797fb..7bb13af 100644
>> --- a/drivers/clk/clk-s2mps11.c
>> +++ b/drivers/clk/clk-s2mps11.c
>> @@ -23,6 +23,7 @@
>> #include <linux/clk-provider.h>
>> #include <linux/platform_device.h>
>> #include <linux/mfd/samsung/s2mps11.h>
>> +#include <linux/mfd/samsung/s2mps13.h>
>> #include <linux/mfd/samsung/s2mps14.h>
>> #include <linux/mfd/samsung/s5m8767.h>
>> #include <linux/mfd/samsung/core.h>
>> @@ -120,6 +121,24 @@ static struct clk_init_data s2mps11_clks_init[S2MPS11_CLKS_NUM] = {
>> },
>> };
>>
>> +static struct clk_init_data s2mps13_clks_init[S2MPS11_CLKS_NUM] = {
>> + [S2MPS11_CLK_AP] = {
>> + .name = "s2mps13_ap",
>> + .ops = &s2mps11_clk_ops,
>> + .flags = CLK_IS_ROOT,
>> + },
>> + [S2MPS11_CLK_CP] = {
>> + .name = "s2mps13_cp",
>> + .ops = &s2mps11_clk_ops,
>> .flags = CLK_IS_ROOT,
>
> The patch looks corrupted here. Missing '+'?

You are right. It is my mistake.
I will fix it.

>
> Rest looks fine.
> Reviewed-by: Krzysztof Kozlowski <[email protected]>

Thanks for your review.

Best Regards,
Chanwoo Choi


>
> Best regards,
> Krzysztof
>
>
>> + },
>> + [S2MPS11_CLK_BT] = {
>> + .name = "s2mps13_bt",
>> + .ops = &s2mps11_clk_ops,
>> + .flags = CLK_IS_ROOT,
>> + },
>> +};
>> +
>> static struct clk_init_data s2mps14_clks_init[S2MPS11_CLKS_NUM] = {
>> [S2MPS11_CLK_AP] = {
>> .name = "s2mps14_ap",
>> @@ -184,6 +203,10 @@ static int s2mps11_clk_probe(struct platform_device *pdev)
>> s2mps11_reg = S2MPS11_REG_RTC_CTRL;
>> clks_init = s2mps11_clks_init;
>> break;
>> + case S2MPS13X:
>> + s2mps11_reg = S2MPS13_REG_RTCCTRL;
>> + clks_init = s2mps13_clks_init;
>> + break;
>> case S2MPS14X:
>> s2mps11_reg = S2MPS14_REG_RTCCTRL;
>> clks_init = s2mps14_clks_init;
>> @@ -279,6 +302,7 @@ static int s2mps11_clk_remove(struct platform_device *pdev)
>>
>> static const struct platform_device_id s2mps11_clk_id[] = {
>> { "s2mps11-clk", S2MPS11X},
>> + { "s2mps13-clk", S2MPS13X},
>> { "s2mps14-clk", S2MPS14X},
>> { "s5m8767-clk", S5M8767X},
>> { },
>>
>
>

2014-11-18 01:14:42

by Chanwoo Choi

[permalink] [raw]
Subject: Re: [PATCH 4/5] rtc: s5m: Add the support for S2MPS13 RTC

Hi Krzysztof,

On 11/17/2014 07:19 PM, Krzysztof Kozłowski wrote:
> On 17.11.2014 01:42, Chanwoo Choi wrote:
>> This patch adds only the compatible string for S2MPS13 clock which is identical
>> with S2MPS14 clock driver.
>>
>> Cc: Alessandro Zummo <[email protected]>
>> Signed-off-by: Chanwoo Choi <[email protected]>
>> ---
>> drivers/rtc/rtc-s5m.c | 15 ++++++++++++++-
>> 1 file changed, 14 insertions(+), 1 deletion(-)
>
> The RTC block looks exactly the same as S2MPS14. I wonder can S2MPS13 be
> supported without adding all "+ case S2MPS13X:" here? Maybe pass the
> same ID in s5m_rtc_id? This would reduce number of changes to only one line.

I tried to use S2MPS14x type without adding S2MPS13X.
But, there are two method to probe RTC driver probe.
First, as you comment, use s5m_rtc_id (in drivers/rtc/rtc-s5m.c) to probe S2MPS13 RTC.
Second, register mfd devcies for s2mps13 RTC(in drivers/mfd/sec-core.c) to probe S2MPS13 RTC.

We could support S2MPS13 RTC to modify s5m_rtc_id table in first case as you comment,
But, We could not support S2MPS13 RTC in second case because S2MPS13 is different from S2MPS14
and S2MPS13 must have other type form existing S2MPS14x type.

Best Regards,
Chanwoo Choi

>
> Best regards,
> Krzysztof
>
>
>>
>> diff --git a/drivers/rtc/rtc-s5m.c b/drivers/rtc/rtc-s5m.c
>> index 8754c33..e5fdfd3 100644
>> --- a/drivers/rtc/rtc-s5m.c
>> +++ b/drivers/rtc/rtc-s5m.c
>> @@ -191,6 +191,7 @@ static inline int s5m_check_peding_alarm_interrupt(struct s5m_rtc_info *info,
>> ret = regmap_read(info->regmap, S5M_RTC_STATUS, &val);
>> val &= S5M_ALARM0_STATUS;
>> break;
>> + case S2MPS13X:
>> case S2MPS14X:
>> ret = regmap_read(info->s5m87xx->regmap_pmic, S2MPS14_REG_ST2,
>> &val);
>> @@ -254,6 +255,7 @@ static inline int s5m8767_rtc_set_alarm_reg(struct s5m_rtc_info *info)
>> case S5M8767X:
>> data &= ~S5M_RTC_TIME_EN_MASK;
>> break;
>> + case S2MPS13X:
>> case S2MPS14X:
>> data |= S2MPS_RTC_RUDR_MASK;
>> break;
>> @@ -311,7 +313,9 @@ static int s5m_rtc_read_time(struct device *dev, struct rtc_time *tm)
>> u8 data[info->regs->regs_count];
>> int ret;
>>
>> - if (info->device_type == S2MPS14X) {
>> + switch (info->device_type) {
>> + case S2MPS13X:
>> + case S2MPS14X:
>> ret = regmap_update_bits(info->regmap,
>> info->regs->rtc_udr_update,
>> S2MPS_RTC_RUDR_MASK, S2MPS_RTC_RUDR_MASK);
>> @@ -333,6 +337,7 @@ static int s5m_rtc_read_time(struct device *dev, struct rtc_time *tm)
>> break;
>>
>> case S5M8767X:
>> + case S2MPS13X:
>> case S2MPS14X:
>> s5m8767_data_to_tm(data, tm, info->rtc_24hr_mode);
>> break;
>> @@ -359,6 +364,7 @@ static int s5m_rtc_set_time(struct device *dev, struct rtc_time *tm)
>> s5m8763_tm_to_data(tm, data);
>> break;
>> case S5M8767X:
>> + case S2MPS13X:
>> case S2MPS14X:
>> ret = s5m8767_tm_to_data(tm, data);
>> break;
>> @@ -406,6 +412,7 @@ static int s5m_rtc_read_alarm(struct device *dev, struct rtc_wkalrm *alrm)
>> break;
>>
>> case S5M8767X:
>> + case S2MPS13X:
>> case S2MPS14X:
>> s5m8767_data_to_tm(data, &alrm->time, info->rtc_24hr_mode);
>> alrm->enabled = 0;
>> @@ -454,6 +461,7 @@ static int s5m_rtc_stop_alarm(struct s5m_rtc_info *info)
>> break;
>>
>> case S5M8767X:
>> + case S2MPS13X:
>> case S2MPS14X:
>> for (i = 0; i < info->regs->regs_count; i++)
>> data[i] &= ~ALARM_ENABLE_MASK;
>> @@ -498,6 +506,7 @@ static int s5m_rtc_start_alarm(struct s5m_rtc_info *info)
>> break;
>>
>> case S5M8767X:
>> + case S2MPS13X:
>> case S2MPS14X:
>> data[RTC_SEC] |= ALARM_ENABLE_MASK;
>> data[RTC_MIN] |= ALARM_ENABLE_MASK;
>> @@ -537,6 +546,7 @@ static int s5m_rtc_set_alarm(struct device *dev, struct rtc_wkalrm *alrm)
>> break;
>>
>> case S5M8767X:
>> + case S2MPS13X:
>> case S2MPS14X:
>> s5m8767_tm_to_data(&alrm->time, data);
>> break;
>> @@ -641,6 +651,7 @@ static int s5m8767_rtc_init_reg(struct s5m_rtc_info *info)
>> ret = regmap_raw_write(info->regmap, S5M_ALARM0_CONF, data, 2);
>> break;
>>
>> + case S2MPS13X:
>> case S2MPS14X:
>> data[0] = (0 << BCD_EN_SHIFT) | (1 << MODEL24_SHIFT);
>> ret = regmap_write(info->regmap, info->regs->ctrl, data[0]);
>> @@ -678,6 +689,7 @@ static int s5m_rtc_probe(struct platform_device *pdev)
>> return -ENOMEM;
>>
>> switch (pdata->device_type) {
>> + case S2MPS13X:
>> case S2MPS14X:
>> regmap_cfg = &s2mps14_rtc_regmap_config;
>> info->regs = &s2mps_rtc_regs;
>> @@ -831,6 +843,7 @@ static SIMPLE_DEV_PM_OPS(s5m_rtc_pm_ops, s5m_rtc_suspend, s5m_rtc_resume);
>>
>> static const struct platform_device_id s5m_rtc_id[] = {
>> { "s5m-rtc", S5M8767X },
>> + { "s2mps13-rtc", S2MPS13X },
>> { "s2mps14-rtc", S2MPS14X },
>> };
>>
>>
>
>

2014-11-18 08:18:06

by Lee Jones

[permalink] [raw]
Subject: Re: [PATCH 2/5] regulator: s2mps11: Add support S2MPS13 regulator device

On Mon, 17 Nov 2014, Chanwoo Choi wrote:

> This patch adds S2MPS13 regulator device to existing S2MPS11 device driver.
> The S2MPS13 has just different number of regulators from S2MPS14.
> The S2MPS13 regulator device includes LDO[1-40] and BUCK[1-10].
>
> Cc: Mark Brown <[email protected]>
> Signed-off-by: Chanwoo Choi <[email protected]>
> ---
> drivers/mfd/sec-core.c | 13 +++
> drivers/regulator/Kconfig | 10 +-
> drivers/regulator/s2mps11.c | 102 +++++++++++++++++++-
> include/linux/mfd/samsung/core.h | 1 +
> include/linux/mfd/samsung/s2mps13.h | 186 ++++++++++++++++++++++++++++++++++++

For my reference:

Acked-by: Lee Jones <[email protected]>

I does this set need to go in all at once, or can it be broken up?

> 5 files changed, 304 insertions(+), 8 deletions(-)
> create mode 100644 include/linux/mfd/samsung/s2mps13.h

[...]

--
Lee Jones
Linaro STMicroelectronics Landing Team Lead
Linaro.org │ Open source software for ARM SoCs
Follow Linaro: Facebook | Twitter | Blog

2014-11-18 08:19:50

by Lee Jones

[permalink] [raw]
Subject: Re: [PATCH 5/5] mfd: s2mps11: Add binding documentation for Samsung S2MPS13 PMIC

On Mon, 17 Nov 2014, Chanwoo Choi wrote:

> This patch adds the binding documentation for Samsung S2MPS13 PMIC
> which is similiar with existing S2MPS14 PMIC. S2MPS13 has the different number
> of regulators from S2MPS14 and RTC/Clock is the same with the S2MPS14.
>
> Cc: Lee Jones <[email protected]>
> Signed-off-by: Chanwoo Choi <[email protected]>
> ---
> Documentation/devicetree/bindings/mfd/s2mps11.txt | 22 ++++++++++++----------
> 1 file changed, 12 insertions(+), 10 deletions(-)

For my reference:

Acked-by: Lee Jones <[email protected]>

> diff --git a/Documentation/devicetree/bindings/mfd/s2mps11.txt b/Documentation/devicetree/bindings/mfd/s2mps11.txt
> index 0e4026a..57a0450 100644
> --- a/Documentation/devicetree/bindings/mfd/s2mps11.txt
> +++ b/Documentation/devicetree/bindings/mfd/s2mps11.txt
> @@ -1,5 +1,5 @@
>
> -* Samsung S2MPS11, S2MPS14 and S2MPU02 Voltage and Current Regulator
> +* Samsung S2MPS11, S2MPS13, S2MPS14 and S2MPU02 Voltage and Current Regulator
>
> The Samsung S2MPS11 is a multi-function device which includes voltage and
> current regulators, RTC, charger controller and other sub-blocks. It is
> @@ -7,8 +7,8 @@ interfaced to the host controller using an I2C interface. Each sub-block is
> addressed by the host system using different I2C slave addresses.
>
> Required properties:
> -- compatible: Should be "samsung,s2mps11-pmic" or "samsung,s2mps14-pmic"
> - or "samsung,s2mpu02-pmic".
> +- compatible: Should be "samsung,s2mps11-pmic" or "samsung,s2mps13-pmic"
> + or "samsung,s2mps14-pmic" or "samsung,s2mpu02-pmic".
> - reg: Specifies the I2C slave address of the pmic block. It should be 0x66.
>
> Optional properties:
> @@ -17,8 +17,8 @@ Optional properties:
> - interrupts: Interrupt specifiers for interrupt sources.
>
> Optional nodes:
> -- clocks: s2mps11 and s5m8767 provide three(AP/CP/BT) buffered 32.768 KHz
> - outputs, so to register these as clocks with common clock framework
> +- clocks: s2mps11, s2mps13 and s5m8767 provide three(AP/CP/BT) buffered 32.768
> + KHz outputs, so to register these as clocks with common clock framework
> instantiate a sub-node named "clocks". It uses the common clock binding
> documented in :
> [Documentation/devicetree/bindings/clock/clock-bindings.txt]
> @@ -30,12 +30,12 @@ Optional nodes:
> the clock which they consume.
> Clock ID Devices
> ----------------------------------------------------------
> - 32KhzAP 0 S2MPS11, S2MPS14, S5M8767
> - 32KhzCP 1 S2MPS11, S5M8767
> - 32KhzBT 2 S2MPS11, S2MPS14, S5M8767
> + 32KhzAP 0 S2MPS11, S2MPS13, S2MPS14, S5M8767
> + 32KhzCP 1 S2MPS11, S2MPS13, S5M8767
> + 32KhzBT 2 S2MPS11, S2MPS13, S2MPS14, S5M8767
>
> - - compatible: Should be one of: "samsung,s2mps11-clk", "samsung,s2mps14-clk",
> - "samsung,s5m8767-clk"
> + - compatible: Should be one of: "samsung,s2mps11-clk", "samsung,s2mps13-clk",
> + "samsung,s2mps14-clk", "samsung,s5m8767-clk"
>
> - regulators: The regulators of s2mps11 that have to be instantiated should be
> included in a sub-node named 'regulators'. Regulator nodes included in this
> @@ -81,12 +81,14 @@ as per the datasheet of s2mps11.
> - LDOn
> - valid values for n are:
> - S2MPS11: 1 to 38
> + - S2MPS13: 1 to 40
> - S2MPS14: 1 to 25
> - S2MPU02: 1 to 28
> - Example: LDO1, LDO2, LDO28
> - BUCKn
> - valid values for n are:
> - S2MPS11: 1 to 10
> + - S2MPS13: 1 to 10
> - S2MPS14: 1 to 5
> - S2MPU02: 1 to 7
> - Example: BUCK1, BUCK2, BUCK9

--
Lee Jones
Linaro STMicroelectronics Landing Team Lead
Linaro.org │ Open source software for ARM SoCs
Follow Linaro: Facebook | Twitter | Blog

2014-11-18 08:22:18

by Lee Jones

[permalink] [raw]
Subject: Re: [PATCH 1/5] mfd: sec-core: Add support for S2MPS13 device

On Mon, 17 Nov 2014, Chanwoo Choi wrote:

> This patch adds the support for Samsung S2MPS13 PMIC device to the sec-core MFD
> driver. The S2MPS13 is very similar with existing S2MPS14 and includes PMIC/
> RTC/CLOCK devices.
>
> Cc: Lee Jones <[email protected]>
> Signed-off-by: Chanwoo Choi <[email protected]>
> ---
> drivers/mfd/sec-core.c | 18 ++++++++++++++++++
> drivers/mfd/sec-irq.c | 23 +++++++++++++++++------
> include/linux/mfd/samsung/core.h | 1 +
> 3 files changed, 36 insertions(+), 6 deletions(-)
>
> diff --git a/drivers/mfd/sec-core.c b/drivers/mfd/sec-core.c
> index 5993608..48c0d4a 100644
> --- a/drivers/mfd/sec-core.c
> +++ b/drivers/mfd/sec-core.c
> @@ -73,6 +73,17 @@ static const struct mfd_cell s2mps11_devs[] = {
> }
> };
>
> +static const struct mfd_cell s2mps13_devs[] = {
> + {
> + .name = "s2mps13-pmic",
> + }, {
> + .name = "s2mps13-rtc",
> + }, {
> + .name = "s2mps13-clk",
> + .of_compatible = "samsung,s2mps13-clk",
> + }
> +};

If you have to resubmit this for any reason, I'd like the one liners
on one single line (curly braces and all).

But for now, for my reference:

Acked-by: Lee Jones <[email protected]>

[...]

--
Lee Jones
Linaro STMicroelectronics Landing Team Lead
Linaro.org │ Open source software for ARM SoCs
Follow Linaro: Facebook | Twitter | Blog

2014-11-18 08:25:37

by Lee Jones

[permalink] [raw]
Subject: Re: [PATCH 4/5] rtc: s5m: Add the support for S2MPS13 RTC

On Tue, 18 Nov 2014, Chanwoo Choi wrote:

> Dear Sangbeom,
>
> On 11/18/2014 09:38 AM, Sangbeom Kim wrote:
> > Hi,
> > On Monday, November 17, 2014 9:43 AM, Chanwoo Choi wrote:
> >> This patch adds only the compatible string for S2MPS13 clock which is identical
> >> with S2MPS14 clock driver.
> >
> > What's the relation of S2MPS14 RTC and clock driver?
>
> I checked the difference between S2MPS13 and S2MPS14.
> But, all register (RTC) of both PMICs was the same completely.
> So, I just add S2MPS13 type to use existing S2MPS14 RTC feature for S2MPS13 RTC.

Okay, so it looks like this requires another submission. Please add
the fixup I requested in the first patch.

--
Lee Jones
Linaro STMicroelectronics Landing Team Lead
Linaro.org │ Open source software for ARM SoCs
Follow Linaro: Facebook | Twitter | Blog

2014-11-18 08:33:28

by Chanwoo Choi

[permalink] [raw]
Subject: Re: [PATCH 1/5] mfd: sec-core: Add support for S2MPS13 device

Dear Lee,

On 11/18/2014 05:22 PM, Lee Jones wrote:
> On Mon, 17 Nov 2014, Chanwoo Choi wrote:
>
>> This patch adds the support for Samsung S2MPS13 PMIC device to the sec-core MFD
>> driver. The S2MPS13 is very similar with existing S2MPS14 and includes PMIC/
>> RTC/CLOCK devices.
>>
>> Cc: Lee Jones <[email protected]>
>> Signed-off-by: Chanwoo Choi <[email protected]>
>> ---
>> drivers/mfd/sec-core.c | 18 ++++++++++++++++++
>> drivers/mfd/sec-irq.c | 23 +++++++++++++++++------
>> include/linux/mfd/samsung/core.h | 1 +
>> 3 files changed, 36 insertions(+), 6 deletions(-)
>>
>> diff --git a/drivers/mfd/sec-core.c b/drivers/mfd/sec-core.c
>> index 5993608..48c0d4a 100644
>> --- a/drivers/mfd/sec-core.c
>> +++ b/drivers/mfd/sec-core.c
>> @@ -73,6 +73,17 @@ static const struct mfd_cell s2mps11_devs[] = {
>> }
>> };
>>
>> +static const struct mfd_cell s2mps13_devs[] = {
>> + {
>> + .name = "s2mps13-pmic",
>> + }, {
>> + .name = "s2mps13-rtc",
>> + }, {
>> + .name = "s2mps13-clk",
>> + .of_compatible = "samsung,s2mps13-clk",
>> + }
>> +};
>
> If you have to resubmit this for any reason, I'd like the one liners
> on one single line (curly braces and all).

OK, I'll modify it as following:

static const struct mfd_cell s2mps13_devs[] = {
{ .name = "s2mps13-pmic", },
{ .name = "s2mps13-rtc", },
{
.name = "s2mps13-clk",
.of_compatible = "samsung,s2mps13-clk",
},
};

Best Regards,
Chanwoo Choi

>
> But for now, for my reference:
>
> Acked-by: Lee Jones <[email protected]>



2014-11-18 08:41:21

by Chanwoo Choi

[permalink] [raw]
Subject: Re: [PATCH 2/5] regulator: s2mps11: Add support S2MPS13 regulator device

Dear Lee,

On 11/18/2014 05:17 PM, Lee Jones wrote:
> On Mon, 17 Nov 2014, Chanwoo Choi wrote:
>
>> This patch adds S2MPS13 regulator device to existing S2MPS11 device driver.
>> The S2MPS13 has just different number of regulators from S2MPS14.
>> The S2MPS13 regulator device includes LDO[1-40] and BUCK[1-10].
>>
>> Cc: Mark Brown <[email protected]>
>> Signed-off-by: Chanwoo Choi <[email protected]>
>> ---
>> drivers/mfd/sec-core.c | 13 +++
>> drivers/regulator/Kconfig | 10 +-
>> drivers/regulator/s2mps11.c | 102 +++++++++++++++++++-
>> include/linux/mfd/samsung/core.h | 1 +
>> include/linux/mfd/samsung/s2mps13.h | 186 ++++++++++++++++++++++++++++++++++++
>
> For my reference:
>
> Acked-by: Lee Jones <[email protected]>
>
> I does this set need to go in all at once, or can it be broken up?

If possible, I think that this patchset would be better to apply it on same git-repo at once.

Best Regards,
Chanwoo Choi

>
>> 5 files changed, 304 insertions(+), 8 deletions(-)
>> create mode 100644 include/linux/mfd/samsung/s2mps13.h
>
> [...]
>

2014-11-18 08:53:30

by Chanwoo Choi

[permalink] [raw]
Subject: Re: [PATCH 4/5] rtc: s5m: Add the support for S2MPS13 RTC

Dear Sangbeom,

On 11/18/2014 09:38 AM, Sangbeom Kim wrote:
> Hi,
> On Monday, November 17, 2014 9:43 AM, Chanwoo Choi wrote:
>> This patch adds only the compatible string for S2MPS13 clock which is identical
>> with S2MPS14 clock driver.
>
> What's the relation of S2MPS14 RTC and clock driver?

Sorry, I write wrong patch description. I'll fix it.

Best Regards,
Chanwoo Choi

2014-11-18 10:02:00

by Krzysztof Kozlowski

[permalink] [raw]
Subject: Re: [PATCH 4/5] rtc: s5m: Add the support for S2MPS13 RTC

On wto, 2014-11-18 at 10:14 +0900, Chanwoo Choi wrote:
> Hi Krzysztof,
>
> On 11/17/2014 07:19 PM, Krzysztof Kozłowski wrote:
> > On 17.11.2014 01:42, Chanwoo Choi wrote:
> >> This patch adds only the compatible string for S2MPS13 clock which is identical
> >> with S2MPS14 clock driver.
> >>
> >> Cc: Alessandro Zummo <[email protected]>
> >> Signed-off-by: Chanwoo Choi <[email protected]>
> >> ---
> >> drivers/rtc/rtc-s5m.c | 15 ++++++++++++++-
> >> 1 file changed, 14 insertions(+), 1 deletion(-)
> >
> > The RTC block looks exactly the same as S2MPS14. I wonder can S2MPS13 be
> > supported without adding all "+ case S2MPS13X:" here? Maybe pass the
> > same ID in s5m_rtc_id? This would reduce number of changes to only one line.
>
> I tried to use S2MPS14x type without adding S2MPS13X.
> But, there are two method to probe RTC driver probe.
> First, as you comment, use s5m_rtc_id (in drivers/rtc/rtc-s5m.c) to probe S2MPS13 RTC.
> Second, register mfd devcies for s2mps13 RTC(in drivers/mfd/sec-core.c) to probe S2MPS13 RTC.
>
> We could support S2MPS13 RTC to modify s5m_rtc_id table in first case as you comment,
> But, We could not support S2MPS13 RTC in second case because S2MPS13 is different from S2MPS14
> and S2MPS13 must have other type form existing S2MPS14x type.

OK, I'm fine with that. The patch looks good so:
Reviewed-by: Krzysztof Kozlowski <[email protected]>

Best regards,
Krzysztof

>
> Best Regards,
> Chanwoo Choi
>
> >
> > Best regards,
> > Krzysztof
> >
> >
> >>
> >> diff --git a/drivers/rtc/rtc-s5m.c b/drivers/rtc/rtc-s5m.c
> >> index 8754c33..e5fdfd3 100644
> >> --- a/drivers/rtc/rtc-s5m.c
> >> +++ b/drivers/rtc/rtc-s5m.c
> >> @@ -191,6 +191,7 @@ static inline int s5m_check_peding_alarm_interrupt(struct s5m_rtc_info *info,
> >> ret = regmap_read(info->regmap, S5M_RTC_STATUS, &val);
> >> val &= S5M_ALARM0_STATUS;
> >> break;
> >> + case S2MPS13X:
> >> case S2MPS14X:
> >> ret = regmap_read(info->s5m87xx->regmap_pmic, S2MPS14_REG_ST2,
> >> &val);
> >> @@ -254,6 +255,7 @@ static inline int s5m8767_rtc_set_alarm_reg(struct s5m_rtc_info *info)
> >> case S5M8767X:
> >> data &= ~S5M_RTC_TIME_EN_MASK;
> >> break;
> >> + case S2MPS13X:
> >> case S2MPS14X:
> >> data |= S2MPS_RTC_RUDR_MASK;
> >> break;
> >> @@ -311,7 +313,9 @@ static int s5m_rtc_read_time(struct device *dev, struct rtc_time *tm)
> >> u8 data[info->regs->regs_count];
> >> int ret;
> >>
> >> - if (info->device_type == S2MPS14X) {
> >> + switch (info->device_type) {
> >> + case S2MPS13X:
> >> + case S2MPS14X:
> >> ret = regmap_update_bits(info->regmap,
> >> info->regs->rtc_udr_update,
> >> S2MPS_RTC_RUDR_MASK, S2MPS_RTC_RUDR_MASK);
> >> @@ -333,6 +337,7 @@ static int s5m_rtc_read_time(struct device *dev, struct rtc_time *tm)
> >> break;
> >>
> >> case S5M8767X:
> >> + case S2MPS13X:
> >> case S2MPS14X:
> >> s5m8767_data_to_tm(data, tm, info->rtc_24hr_mode);
> >> break;
> >> @@ -359,6 +364,7 @@ static int s5m_rtc_set_time(struct device *dev, struct rtc_time *tm)
> >> s5m8763_tm_to_data(tm, data);
> >> break;
> >> case S5M8767X:
> >> + case S2MPS13X:
> >> case S2MPS14X:
> >> ret = s5m8767_tm_to_data(tm, data);
> >> break;
> >> @@ -406,6 +412,7 @@ static int s5m_rtc_read_alarm(struct device *dev, struct rtc_wkalrm *alrm)
> >> break;
> >>
> >> case S5M8767X:
> >> + case S2MPS13X:
> >> case S2MPS14X:
> >> s5m8767_data_to_tm(data, &alrm->time, info->rtc_24hr_mode);
> >> alrm->enabled = 0;
> >> @@ -454,6 +461,7 @@ static int s5m_rtc_stop_alarm(struct s5m_rtc_info *info)
> >> break;
> >>
> >> case S5M8767X:
> >> + case S2MPS13X:
> >> case S2MPS14X:
> >> for (i = 0; i < info->regs->regs_count; i++)
> >> data[i] &= ~ALARM_ENABLE_MASK;
> >> @@ -498,6 +506,7 @@ static int s5m_rtc_start_alarm(struct s5m_rtc_info *info)
> >> break;
> >>
> >> case S5M8767X:
> >> + case S2MPS13X:
> >> case S2MPS14X:
> >> data[RTC_SEC] |= ALARM_ENABLE_MASK;
> >> data[RTC_MIN] |= ALARM_ENABLE_MASK;
> >> @@ -537,6 +546,7 @@ static int s5m_rtc_set_alarm(struct device *dev, struct rtc_wkalrm *alrm)
> >> break;
> >>
> >> case S5M8767X:
> >> + case S2MPS13X:
> >> case S2MPS14X:
> >> s5m8767_tm_to_data(&alrm->time, data);
> >> break;
> >> @@ -641,6 +651,7 @@ static int s5m8767_rtc_init_reg(struct s5m_rtc_info *info)
> >> ret = regmap_raw_write(info->regmap, S5M_ALARM0_CONF, data, 2);
> >> break;
> >>
> >> + case S2MPS13X:
> >> case S2MPS14X:
> >> data[0] = (0 << BCD_EN_SHIFT) | (1 << MODEL24_SHIFT);
> >> ret = regmap_write(info->regmap, info->regs->ctrl, data[0]);
> >> @@ -678,6 +689,7 @@ static int s5m_rtc_probe(struct platform_device *pdev)
> >> return -ENOMEM;
> >>
> >> switch (pdata->device_type) {
> >> + case S2MPS13X:
> >> case S2MPS14X:
> >> regmap_cfg = &s2mps14_rtc_regmap_config;
> >> info->regs = &s2mps_rtc_regs;
> >> @@ -831,6 +843,7 @@ static SIMPLE_DEV_PM_OPS(s5m_rtc_pm_ops, s5m_rtc_suspend, s5m_rtc_resume);
> >>
> >> static const struct platform_device_id s5m_rtc_id[] = {
> >> { "s5m-rtc", S5M8767X },
> >> + { "s2mps13-rtc", S2MPS13X },
> >> { "s2mps14-rtc", S2MPS14X },
> >> };
> >>
> >>
> >
> >