* [PATCH 0/4] Introduce support for Exynos7870's S2MPU05 PMIC and its regulators
@ 2025-02-03 20:36 Kaustabh Chakraborty
2025-02-03 20:36 ` [PATCH 1/4] regulator: dt-bindings: add documentation for s2mpu05-pmic regulators Kaustabh Chakraborty
` (3 more replies)
0 siblings, 4 replies; 14+ messages in thread
From: Kaustabh Chakraborty @ 2025-02-03 20:36 UTC (permalink / raw)
To: Krzysztof Kozlowski, Liam Girdwood, Mark Brown, Rob Herring,
Conor Dooley, Lee Jones
Cc: Sergey Lisov, linux-kernel, linux-samsung-soc, devicetree,
Kaustabh Chakraborty
Exynos7870 devices use Samsung S2MPU05 as its primary PMIC. Add support
for it in the existing PMIC driver. Additionally, also add support for
voltage regulators which can be accessed and controlled from the PMIC
itself.
Patches from two subsystems have been placed in a single series here as
header files and documentation YAML references have been shared.
This patch series is a part of Exynos7870 upstreaming.
Signed-off-by: Kaustabh Chakraborty <kauschluss@disroot.org>
---
Kaustabh Chakraborty (2):
regulator: dt-bindings: add documentation for s2mpu05-pmic regulators
dt-bindings: mfd: samsung,s2mps11: add compatible for s2mpu05-pmic
Sergey Lisov (2):
mfd: sec: add support for S2MPU05 PMIC
regulator: s2mps11: Add support for S2MPU05 regulators
.../devicetree/bindings/mfd/samsung,s2mps11.yaml | 13 ++
.../bindings/regulator/samsung,s2mpu05.yaml | 44 ++++++
drivers/mfd/sec-core.c | 12 ++
drivers/mfd/sec-irq.c | 85 ++++++++++++
drivers/regulator/Kconfig | 4 +-
drivers/regulator/s2mps11.c | 92 ++++++++++++-
include/linux/mfd/samsung/core.h | 1 +
include/linux/mfd/samsung/irq.h | 44 ++++++
include/linux/mfd/samsung/s2mpu05.h | 152 +++++++++++++++++++++
9 files changed, 444 insertions(+), 3 deletions(-)
---
base-commit: df4b2bbff898227db0c14264ac7edd634e79f755
change-id: 20250203-exynos7870-pmic-regulators-26512b79a29b
Best regards,
--
Kaustabh Chakraborty <kauschluss@disroot.org>
^ permalink raw reply [flat|nested] 14+ messages in thread
* [PATCH 1/4] regulator: dt-bindings: add documentation for s2mpu05-pmic regulators
2025-02-03 20:36 [PATCH 0/4] Introduce support for Exynos7870's S2MPU05 PMIC and its regulators Kaustabh Chakraborty
@ 2025-02-03 20:36 ` Kaustabh Chakraborty
2025-02-05 8:32 ` Krzysztof Kozlowski
2025-02-03 20:36 ` [PATCH 2/4] dt-bindings: mfd: samsung,s2mps11: add compatible for s2mpu05-pmic Kaustabh Chakraborty
` (2 subsequent siblings)
3 siblings, 1 reply; 14+ messages in thread
From: Kaustabh Chakraborty @ 2025-02-03 20:36 UTC (permalink / raw)
To: Krzysztof Kozlowski, Liam Girdwood, Mark Brown, Rob Herring,
Conor Dooley, Lee Jones
Cc: Sergey Lisov, linux-kernel, linux-samsung-soc, devicetree,
Kaustabh Chakraborty
S2MPU05 is a PMIC found in Exynos7870 devices, which controls voltage
regulators (21 LDOs and 5 BUCKs). Provide documentation for devicetree
definitions, regulator naming patterns, etc.
Signed-off-by: Kaustabh Chakraborty <kauschluss@disroot.org>
---
.../bindings/regulator/samsung,s2mpu05.yaml | 44 ++++++++++++++++++++++
1 file changed, 44 insertions(+)
diff --git a/Documentation/devicetree/bindings/regulator/samsung,s2mpu05.yaml b/Documentation/devicetree/bindings/regulator/samsung,s2mpu05.yaml
new file mode 100644
index 0000000000000000000000000000000000000000..0a968fe79d44dbcb6720a7d1da698f9460e25521
--- /dev/null
+++ b/Documentation/devicetree/bindings/regulator/samsung,s2mpu05.yaml
@@ -0,0 +1,44 @@
+# SPDX-License-Identifier: GPL-2.0-only OR BSD-2-Clause
+%YAML 1.2
+---
+$id: http://devicetree.org/schemas/regulator/samsung,s2mpu05.yaml#
+$schema: http://devicetree.org/meta-schemas/core.yaml#
+
+title: Samsung S2MPU05 Power Management IC regulators
+
+maintainers:
+ - Krzysztof Kozlowski <krzk@kernel.org>
+
+description: |
+ This is a part of device tree bindings for S2M and S5M family of Power
+ Management IC (PMIC).
+
+ The S2MPU05 provides buck and LDO regulators.
+
+ See also Documentation/devicetree/bindings/mfd/samsung,s2mps11.yaml for
+ additional information and example.
+
+patternProperties:
+ # 21 LDOs
+ "^LDO([1-9]|10|2[0-9]|3[0-5])$":
+ type: object
+ $ref: regulator.yaml#
+ unevaluatedProperties: false
+ description:
+ Properties for single LDO regulator.
+
+ required:
+ - regulator-name
+
+ # 5 bucks
+ "^BUCK[1-5]$":
+ type: object
+ $ref: regulator.yaml#
+ unevaluatedProperties: false
+ description:
+ Properties for single BUCK regulator.
+
+ required:
+ - regulator-name
+
+additionalProperties: false
--
2.48.1
^ permalink raw reply related [flat|nested] 14+ messages in thread
* [PATCH 2/4] dt-bindings: mfd: samsung,s2mps11: add compatible for s2mpu05-pmic
2025-02-03 20:36 [PATCH 0/4] Introduce support for Exynos7870's S2MPU05 PMIC and its regulators Kaustabh Chakraborty
2025-02-03 20:36 ` [PATCH 1/4] regulator: dt-bindings: add documentation for s2mpu05-pmic regulators Kaustabh Chakraborty
@ 2025-02-03 20:36 ` Kaustabh Chakraborty
2025-02-05 8:33 ` Krzysztof Kozlowski
2025-02-11 15:08 ` (subset) " Lee Jones
2025-02-03 20:36 ` [PATCH 3/4] mfd: sec: add support for S2MPU05 PMIC Kaustabh Chakraborty
2025-02-03 20:36 ` [PATCH 4/4] regulator: s2mps11: Add support for S2MPU05 regulators Kaustabh Chakraborty
3 siblings, 2 replies; 14+ messages in thread
From: Kaustabh Chakraborty @ 2025-02-03 20:36 UTC (permalink / raw)
To: Krzysztof Kozlowski, Liam Girdwood, Mark Brown, Rob Herring,
Conor Dooley, Lee Jones
Cc: Sergey Lisov, linux-kernel, linux-samsung-soc, devicetree,
Kaustabh Chakraborty
S2MPU05 is a PMIC present in Samsung's Exynos7870 devices. It houses
voltage regulators (21 LDOs and 5 BUCKs), and an RTC module. Add the
compatible string "samsung,s2mpu05-pmic" to the PMIC documentation.
Signed-off-by: Kaustabh Chakraborty <kauschluss@disroot.org>
---
Documentation/devicetree/bindings/mfd/samsung,s2mps11.yaml | 13 +++++++++++++
1 file changed, 13 insertions(+)
diff --git a/Documentation/devicetree/bindings/mfd/samsung,s2mps11.yaml b/Documentation/devicetree/bindings/mfd/samsung,s2mps11.yaml
index a4be642de33ce6b987fe011adfe4f6b938c20c19..ac5d0c149796b6a4034b5d4245bfa8be0433cfab 100644
--- a/Documentation/devicetree/bindings/mfd/samsung,s2mps11.yaml
+++ b/Documentation/devicetree/bindings/mfd/samsung,s2mps11.yaml
@@ -25,6 +25,7 @@ properties:
- samsung,s2mps14-pmic
- samsung,s2mps15-pmic
- samsung,s2mpu02-pmic
+ - samsung,s2mpu05-pmic
clocks:
$ref: /schemas/clock/samsung,s2mps11.yaml
@@ -125,6 +126,18 @@ allOf:
samsung,s2mps11-acokb-ground: false
samsung,s2mps11-wrstbi-ground: false
+ - if:
+ properties:
+ compatible:
+ contains:
+ const: samsung,s2mpu05-pmic
+ then:
+ properties:
+ regulators:
+ $ref: /schemas/regulator/samsung,s2mpu05.yaml
+ samsung,s2mps11-acokb-ground: false
+ samsung,s2mps11-wrstbi-ground: false
+
examples:
- |
#include <dt-bindings/interrupt-controller/irq.h>
--
2.48.1
^ permalink raw reply related [flat|nested] 14+ messages in thread
* [PATCH 3/4] mfd: sec: add support for S2MPU05 PMIC
2025-02-03 20:36 [PATCH 0/4] Introduce support for Exynos7870's S2MPU05 PMIC and its regulators Kaustabh Chakraborty
2025-02-03 20:36 ` [PATCH 1/4] regulator: dt-bindings: add documentation for s2mpu05-pmic regulators Kaustabh Chakraborty
2025-02-03 20:36 ` [PATCH 2/4] dt-bindings: mfd: samsung,s2mps11: add compatible for s2mpu05-pmic Kaustabh Chakraborty
@ 2025-02-03 20:36 ` Kaustabh Chakraborty
2025-02-05 8:34 ` Krzysztof Kozlowski
2025-02-11 13:47 ` Lee Jones
2025-02-03 20:36 ` [PATCH 4/4] regulator: s2mps11: Add support for S2MPU05 regulators Kaustabh Chakraborty
3 siblings, 2 replies; 14+ messages in thread
From: Kaustabh Chakraborty @ 2025-02-03 20:36 UTC (permalink / raw)
To: Krzysztof Kozlowski, Liam Girdwood, Mark Brown, Rob Herring,
Conor Dooley, Lee Jones
Cc: Sergey Lisov, linux-kernel, linux-samsung-soc, devicetree,
Kaustabh Chakraborty
From: Sergey Lisov <sleirsgoevy@gmail.com>
Add support for Samsung's S2MPU05 PMIC. It's the primary PMIC used by
Exynos7870 devices. It houses regulators (21 LDOs and 5 BUCKs) and a RTC
clock device.
Signed-off-by: Sergey Lisov <sleirsgoevy@gmail.com>
Signed-off-by: Kaustabh Chakraborty <kauschluss@disroot.org>
---
drivers/mfd/sec-core.c | 12 +++
drivers/mfd/sec-irq.c | 85 ++++++++++++++++++++
include/linux/mfd/samsung/core.h | 1 +
include/linux/mfd/samsung/irq.h | 44 +++++++++++
include/linux/mfd/samsung/s2mpu05.h | 152 ++++++++++++++++++++++++++++++++++++
5 files changed, 294 insertions(+)
diff --git a/drivers/mfd/sec-core.c b/drivers/mfd/sec-core.c
index cdfe738e1d76e63145e5888da1cecc122fbc3737..3e9b65c988a7f08bf16d3703004a3d60cfcb1c75 100644
--- a/drivers/mfd/sec-core.c
+++ b/drivers/mfd/sec-core.c
@@ -83,6 +83,11 @@ static const struct mfd_cell s2mpu02_devs[] = {
{ .name = "s2mpu02-regulator", },
};
+static const struct mfd_cell s2mpu05_devs[] = {
+ { .name = "s2mpu05-regulator", },
+ { .name = "s2mps15-rtc", },
+};
+
static const struct of_device_id sec_dt_match[] = {
{
.compatible = "samsung,s5m8767-pmic",
@@ -108,6 +113,9 @@ static const struct of_device_id sec_dt_match[] = {
}, {
.compatible = "samsung,s2mpu02-pmic",
.data = (void *)S2MPU02,
+ }, {
+ .compatible = "samsung,s2mpu05-pmic",
+ .data = (void *)S2MPU05,
}, {
/* Sentinel */
},
@@ -374,6 +382,10 @@ static int sec_pmic_probe(struct i2c_client *i2c)
sec_devs = s2mpu02_devs;
num_sec_devs = ARRAY_SIZE(s2mpu02_devs);
break;
+ case S2MPU05:
+ sec_devs = s2mpu05_devs;
+ num_sec_devs = ARRAY_SIZE(s2mpu05_devs);
+ break;
default:
dev_err(&i2c->dev, "Unsupported device type (%lu)\n",
sec_pmic->device_type);
diff --git a/drivers/mfd/sec-irq.c b/drivers/mfd/sec-irq.c
index e191aeb0c07c58a3bc4850d94af39dfe085a33e5..9ba8268fef01366d6b6dc88113e6d9b1e1701c39 100644
--- a/drivers/mfd/sec-irq.c
+++ b/drivers/mfd/sec-irq.c
@@ -14,6 +14,7 @@
#include <linux/mfd/samsung/s2mps11.h>
#include <linux/mfd/samsung/s2mps14.h>
#include <linux/mfd/samsung/s2mpu02.h>
+#include <linux/mfd/samsung/s2mpu05.h>
#include <linux/mfd/samsung/s5m8767.h>
static const struct regmap_irq s2mps11_irqs[] = {
@@ -225,6 +226,77 @@ static const struct regmap_irq s2mpu02_irqs[] = {
},
};
+static const struct regmap_irq s2mpu05_irqs[] = {
+ [S2MPU05_IRQ_PWRONF] = {
+ .reg_offset = 0,
+ .mask = S2MPU05_IRQ_PWRONF_MASK,
+ },
+ [S2MPU05_IRQ_PWRONR] = {
+ .reg_offset = 0,
+ .mask = S2MPU05_IRQ_PWRONR_MASK,
+ },
+ [S2MPU05_IRQ_JIGONBF] = {
+ .reg_offset = 0,
+ .mask = S2MPU05_IRQ_JIGONBF_MASK,
+ },
+ [S2MPU05_IRQ_JIGONBR] = {
+ .reg_offset = 0,
+ .mask = S2MPU05_IRQ_JIGONBR_MASK,
+ },
+ [S2MPU05_IRQ_ACOKF] = {
+ .reg_offset = 0,
+ .mask = S2MPU05_IRQ_ACOKF_MASK,
+ },
+ [S2MPU05_IRQ_ACOKR] = {
+ .reg_offset = 0,
+ .mask = S2MPU05_IRQ_ACOKR_MASK,
+ },
+ [S2MPU05_IRQ_PWRON1S] = {
+ .reg_offset = 0,
+ .mask = S2MPU05_IRQ_PWRON1S_MASK,
+ },
+ [S2MPU05_IRQ_MRB] = {
+ .reg_offset = 0,
+ .mask = S2MPU05_IRQ_MRB_MASK,
+ },
+ [S2MPU05_IRQ_RTC60S] = {
+ .reg_offset = 1,
+ .mask = S2MPU05_IRQ_RTC60S_MASK,
+ },
+ [S2MPU05_IRQ_RTCA1] = {
+ .reg_offset = 1,
+ .mask = S2MPU05_IRQ_RTCA1_MASK,
+ },
+ [S2MPU05_IRQ_RTCA0] = {
+ .reg_offset = 1,
+ .mask = S2MPU05_IRQ_RTCA0_MASK,
+ },
+ [S2MPU05_IRQ_SMPL] = {
+ .reg_offset = 1,
+ .mask = S2MPU05_IRQ_SMPL_MASK,
+ },
+ [S2MPU05_IRQ_RTC1S] = {
+ .reg_offset = 1,
+ .mask = S2MPU05_IRQ_RTC1S_MASK,
+ },
+ [S2MPU05_IRQ_WTSR] = {
+ .reg_offset = 1,
+ .mask = S2MPU05_IRQ_WTSR_MASK,
+ },
+ [S2MPU05_IRQ_INT120C] = {
+ .reg_offset = 2,
+ .mask = S2MPU05_IRQ_INT120C_MASK,
+ },
+ [S2MPU05_IRQ_INT140C] = {
+ .reg_offset = 2,
+ .mask = S2MPU05_IRQ_INT140C_MASK,
+ },
+ [S2MPU05_IRQ_TSD] = {
+ .reg_offset = 2,
+ .mask = S2MPU05_IRQ_TSD_MASK,
+ },
+};
+
static const struct regmap_irq s5m8767_irqs[] = {
[S5M8767_IRQ_PWRR] = {
.reg_offset = 0,
@@ -339,6 +411,16 @@ static const struct regmap_irq_chip s2mpu02_irq_chip = {
.ack_base = S2MPU02_REG_INT1,
};
+static const struct regmap_irq_chip s2mpu05_irq_chip = {
+ .name = "s2mpu05",
+ .irqs = s2mpu05_irqs,
+ .num_irqs = ARRAY_SIZE(s2mpu05_irqs),
+ .num_regs = 3,
+ .status_base = S2MPU05_REG_INT1,
+ .mask_base = S2MPU05_REG_INT1M,
+ .ack_base = S2MPU05_REG_INT1,
+};
+
static const struct regmap_irq_chip s5m8767_irq_chip = {
.name = "s5m8767",
.irqs = s5m8767_irqs,
@@ -383,6 +465,9 @@ int sec_irq_init(struct sec_pmic_dev *sec_pmic)
case S2MPU02:
sec_irq_chip = &s2mpu02_irq_chip;
break;
+ case S2MPU05:
+ sec_irq_chip = &s2mpu05_irq_chip;
+ break;
default:
dev_err(sec_pmic->dev, "Unknown device type %lu\n",
sec_pmic->device_type);
diff --git a/include/linux/mfd/samsung/core.h b/include/linux/mfd/samsung/core.h
index 750274d41fc06b0411dbfea6d5efa6092214100d..f35314458fd22e43fa13034439406bea17a155c9 100644
--- a/include/linux/mfd/samsung/core.h
+++ b/include/linux/mfd/samsung/core.h
@@ -44,6 +44,7 @@ enum sec_device_type {
S2MPS14X,
S2MPS15X,
S2MPU02,
+ S2MPU05,
};
/**
diff --git a/include/linux/mfd/samsung/irq.h b/include/linux/mfd/samsung/irq.h
index 3fd2775eb9bbf86ac227810f49d24ae815bb3fcb..f8559e2198a53d28910e0f431f7b8b7cccec6289 100644
--- a/include/linux/mfd/samsung/irq.h
+++ b/include/linux/mfd/samsung/irq.h
@@ -150,6 +150,50 @@ enum s2mpu02_irq {
/* Masks for interrupts are the same as in s2mps11 */
#define S2MPS14_IRQ_TSD_MASK (1 << 2)
+enum s2mpu05_irq {
+ S2MPU05_IRQ_PWRONF,
+ S2MPU05_IRQ_PWRONR,
+ S2MPU05_IRQ_JIGONBF,
+ S2MPU05_IRQ_JIGONBR,
+ S2MPU05_IRQ_ACOKF,
+ S2MPU05_IRQ_ACOKR,
+ S2MPU05_IRQ_PWRON1S,
+ S2MPU05_IRQ_MRB,
+
+ S2MPU05_IRQ_RTC60S,
+ S2MPU05_IRQ_RTCA1,
+ S2MPU05_IRQ_RTCA0,
+ S2MPU05_IRQ_SMPL,
+ S2MPU05_IRQ_RTC1S,
+ S2MPU05_IRQ_WTSR,
+
+ S2MPU05_IRQ_INT120C,
+ S2MPU05_IRQ_INT140C,
+ S2MPU05_IRQ_TSD,
+
+ S2MPU05_IRQ_NR,
+};
+
+#define S2MPU05_IRQ_PWRONF_MASK (1 << 0)
+#define S2MPU05_IRQ_PWRONR_MASK (1 << 1)
+#define S2MPU05_IRQ_JIGONBF_MASK (1 << 2)
+#define S2MPU05_IRQ_JIGONBR_MASK (1 << 3)
+#define S2MPU05_IRQ_ACOKF_MASK (1 << 4)
+#define S2MPU05_IRQ_ACOKR_MASK (1 << 5)
+#define S2MPU05_IRQ_PWRON1S_MASK (1 << 6)
+#define S2MPU05_IRQ_MRB_MASK (1 << 7)
+
+#define S2MPU05_IRQ_RTC60S_MASK (1 << 0)
+#define S2MPU05_IRQ_RTCA1_MASK (1 << 1)
+#define S2MPU05_IRQ_RTCA0_MASK (1 << 2)
+#define S2MPU05_IRQ_SMPL_MASK (1 << 3)
+#define S2MPU05_IRQ_RTC1S_MASK (1 << 4)
+#define S2MPU05_IRQ_WTSR_MASK (1 << 5)
+
+#define S2MPU05_IRQ_INT120C_MASK (1 << 0)
+#define S2MPU05_IRQ_INT140C_MASK (1 << 1)
+#define S2MPU05_IRQ_TSD_MASK (1 << 2)
+
enum s5m8767_irq {
S5M8767_IRQ_PWRR,
S5M8767_IRQ_PWRF,
diff --git a/include/linux/mfd/samsung/s2mpu05.h b/include/linux/mfd/samsung/s2mpu05.h
new file mode 100644
index 0000000000000000000000000000000000000000..fa450e4352a178a6a996bbd723f1fc1fa827c167
--- /dev/null
+++ b/include/linux/mfd/samsung/s2mpu05.h
@@ -0,0 +1,152 @@
+/* SPDX-License-Identifier: GPL-2.0+ */
+/*
+ * Copyright (c) 2015 Samsung Electronics Co., Ltd
+ * http://www.samsung.com
+ */
+
+#ifndef __LINUX_MFD_S2MPU05_H
+#define __LINUX_MFD_S2MPU05_H
+
+/* S2MPU05 registers */
+enum S2MPU05_reg {
+ S2MPU05_REG_ID,
+ S2MPU05_REG_INT1,
+ S2MPU05_REG_INT2,
+ S2MPU05_REG_INT3,
+ S2MPU05_REG_INT1M,
+ S2MPU05_REG_INT2M,
+ S2MPU05_REG_INT3M,
+ S2MPU05_REG_ST1,
+ S2MPU05_REG_ST2,
+ S2MPU05_REG_PWRONSRC,
+ S2MPU05_REG_OFFSRC,
+ S2MPU05_REG_BU_CHG,
+ S2MPU05_REG_RTC_BUF,
+ S2MPU05_REG_CTRL1,
+ S2MPU05_REG_CTRL2,
+ S2MPU05_REG_ETC_TEST,
+ S2MPU05_REG_OTP_ADRL,
+ S2MPU05_REG_OTP_ADRH,
+ S2MPU05_REG_OTP_DATA,
+ S2MPU05_REG_MON1SEL,
+ S2MPU05_REG_MON2SEL,
+ S2MPU05_REG_CTRL3,
+ S2MPU05_REG_ETC_OTP,
+ S2MPU05_REG_UVLO,
+ S2MPU05_REG_TIME_CTRL1,
+ S2MPU05_REG_TIME_CTRL2,
+ S2MPU05_REG_B1CTRL1,
+ S2MPU05_REG_B1CTRL2,
+ S2MPU05_REG_B2CTRL1,
+ S2MPU05_REG_B2CTRL2,
+ S2MPU05_REG_B2CTRL3,
+ S2MPU05_REG_B2CTRL4,
+ S2MPU05_REG_B3CTRL1,
+ S2MPU05_REG_B3CTRL2,
+ S2MPU05_REG_B3CTRL3,
+ S2MPU05_REG_B4CTRL1,
+ S2MPU05_REG_B4CTRL2,
+ S2MPU05_REG_B5CTRL1,
+ S2MPU05_REG_B5CTRL2,
+ S2MPU05_REG_BUCK_RAMP,
+ S2MPU05_REG_LDO_DVS1,
+ S2MPU05_REG_LDO_DVS9,
+ S2MPU05_REG_LDO_DVS10,
+ S2MPU05_REG_L1CTRL,
+ S2MPU05_REG_L2CTRL,
+ S2MPU05_REG_L3CTRL,
+ S2MPU05_REG_L4CTRL,
+ S2MPU05_REG_L5CTRL,
+ S2MPU05_REG_L6CTRL,
+ S2MPU05_REG_L7CTRL,
+ S2MPU05_REG_L8CTRL,
+ S2MPU05_REG_L9CTRL1,
+ S2MPU05_REG_L9CTRL2,
+ S2MPU05_REG_L10CTRL, /* LDO11~24 for CP */
+ S2MPU05_REG_L25CTRL = 0x47,
+ S2MPU05_REG_L26CTRL,
+ S2MPU05_REG_L27CTRL,
+ S2MPU05_REG_L28CTRL,
+ S2MPU05_REG_L29CTRL,
+ S2MPU05_REG_L30CTRL,
+ S2MPU05_REG_L31CTRL,
+ S2MPU05_REG_L32CTRL,
+ S2MPU05_REG_L33CTRL,
+ S2MPU05_REG_L34CTRL,
+ S2MPU05_REG_L35CTRL,
+ S2MPU05_REG_LDO_DSCH1,
+ S2MPU05_REG_LDO_DSCH2,
+ S2MPU05_REG_LDO_DSCH3,
+ S2MPU05_REG_LDO_DSCH4,
+ S2MPU05_REG_LDO_DSCH5,
+ S2MPU05_REG_LDO_CTRL1,
+ S2MPU05_REG_LDO_CTRL2,
+ S2MPU05_REG_TCXO_CTRL,
+ S2MPU05_REG_SELMIF,
+};
+
+/* S2MPU05 regulator ids */
+enum S2MPU05_regulators {
+ S2MPU05_LDO1,
+ S2MPU05_LDO2,
+ S2MPU05_LDO3,
+ S2MPU05_LDO4,
+ S2MPU05_LDO5,
+ S2MPU05_LDO6,
+ S2MPU05_LDO7,
+ S2MPU05_LDO8,
+ S2MPU05_LDO9,
+ S2MPU05_LDO10, /* LDO11~24 for CP */
+ S2MPU05_LDO25,
+ S2MPU05_LDO26,
+ S2MPU05_LDO27,
+ S2MPU05_LDO28,
+ S2MPU05_LDO29,
+ S2MPU05_LDO30,
+ S2MPU05_LDO31,
+ S2MPU05_LDO32,
+ S2MPU05_LDO33,
+ S2MPU05_LDO34,
+ S2MPU05_LDO35,
+ S2MPU05_BUCK1,
+ S2MPU05_BUCK2,
+ S2MPU05_BUCK3,
+ S2MPU05_BUCK4,
+ S2MPU05_BUCK5,
+
+ S2MPU05_REGULATOR_MAX,
+};
+
+#define S2MPU05_SW_ENABLE_MASK 0x03
+
+#define S2MPU05_ENABLE_TIME_LDO 128
+#define S2MPU05_ENABLE_TIME_BUCK1 110
+#define S2MPU05_ENABLE_TIME_BUCK2 110
+#define S2MPU05_ENABLE_TIME_BUCK3 110
+#define S2MPU05_ENABLE_TIME_BUCK4 150
+#define S2MPU05_ENABLE_TIME_BUCK5 150
+
+#define S2MPU05_LDO_MIN1 800000
+#define S2MPU05_LDO_STEP1 12500
+#define S2MPU05_LDO_MIN2 1800000
+#define S2MPU05_LDO_STEP2 25000
+#define S2MPU05_LDO_MIN3 400000
+
+#define S2MPU05_BUCK_MIN1 400000
+#define S2MPU05_BUCK_STEP1 6250
+#define S2MPU05_BUCK_MIN2 600000
+#define S2MPU05_BUCK_STEP2 12500
+
+#define S2MPU05_RAMP_DELAY 12000 /* uV/uS */
+
+#define S2MPU05_ENABLE_SHIFT 6
+#define S2MPU05_ENABLE_MASK (0x03 << S2MPU05_ENABLE_SHIFT)
+
+#define S2MPU05_LDO_VSEL_MASK 0x3F
+#define S2MPU05_BUCK_VSEL_MASK 0xFF
+#define S2MPU05_LDO_N_VOLTAGES (S2MPU05_LDO_VSEL_MASK + 1)
+#define S2MPU05_BUCK_N_VOLTAGES (S2MPU05_BUCK_VSEL_MASK + 1)
+
+#define S2MPU05_PMIC_EN_SHIFT 6
+
+#endif /* __LINUX_MFD_S2MPU05_H */
--
2.48.1
^ permalink raw reply related [flat|nested] 14+ messages in thread
* [PATCH 4/4] regulator: s2mps11: Add support for S2MPU05 regulators
2025-02-03 20:36 [PATCH 0/4] Introduce support for Exynos7870's S2MPU05 PMIC and its regulators Kaustabh Chakraborty
` (2 preceding siblings ...)
2025-02-03 20:36 ` [PATCH 3/4] mfd: sec: add support for S2MPU05 PMIC Kaustabh Chakraborty
@ 2025-02-03 20:36 ` Kaustabh Chakraborty
2025-02-04 16:09 ` Mark Brown
2025-02-05 8:34 ` Krzysztof Kozlowski
3 siblings, 2 replies; 14+ messages in thread
From: Kaustabh Chakraborty @ 2025-02-03 20:36 UTC (permalink / raw)
To: Krzysztof Kozlowski, Liam Girdwood, Mark Brown, Rob Herring,
Conor Dooley, Lee Jones
Cc: Sergey Lisov, linux-kernel, linux-samsung-soc, devicetree,
Kaustabh Chakraborty
From: Sergey Lisov <sleirsgoevy@gmail.com>
S2MPU05 is a PMIC by manufactured by Samsung, particularly used in
Exynos7870 based devices. Add driver support for controlling its 21 LDO
and 5 BUCK regulators.
Signed-off-by: Sergey Lisov <sleirsgoevy@gmail.com>
Signed-off-by: Kaustabh Chakraborty <kauschluss@disroot.org>
---
drivers/regulator/Kconfig | 4 +-
drivers/regulator/s2mps11.c | 92 ++++++++++++++++++++++++++++++++++++++++++++-
2 files changed, 93 insertions(+), 3 deletions(-)
diff --git a/drivers/regulator/Kconfig b/drivers/regulator/Kconfig
index 39297f7d8177193e51c99bc2b360c6d9936e62fe..e47ef257696e2ff3745affa1a403a29f086a2833 100644
--- a/drivers/regulator/Kconfig
+++ b/drivers/regulator/Kconfig
@@ -1330,10 +1330,10 @@ config REGULATOR_S2MPA01
via I2C bus. S2MPA01 has 10 Bucks and 26 LDO outputs.
config REGULATOR_S2MPS11
- tristate "Samsung S2MPS11/13/14/15/S2MPU02 voltage regulator"
+ tristate "Samsung S2MPS11/13/14/15/S2MPU02/05 voltage regulator"
depends on MFD_SEC_CORE || COMPILE_TEST
help
- This driver supports a Samsung S2MPS11/13/14/15/S2MPU02 voltage
+ This driver supports a Samsung S2MPS11/13/14/15/S2MPU02/05 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.
diff --git a/drivers/regulator/s2mps11.c b/drivers/regulator/s2mps11.c
index 7dcf92af8f15e63fb634d978fba41df0ca09fd65..4146c15317f0a87b16026a942a72a7e1b9fbca4c 100644
--- a/drivers/regulator/s2mps11.c
+++ b/drivers/regulator/s2mps11.c
@@ -21,6 +21,7 @@
#include <linux/mfd/samsung/s2mps14.h>
#include <linux/mfd/samsung/s2mps15.h>
#include <linux/mfd/samsung/s2mpu02.h>
+#include <linux/mfd/samsung/s2mpu05.h>
/* The highest number of possible regulators for supported devices. */
#define S2MPS_REGULATOR_MAX S2MPS13_REGULATOR_MAX
@@ -254,6 +255,9 @@ static int s2mps11_regulator_enable(struct regulator_dev *rdev)
else
val = rdev->desc->enable_mask;
break;
+ case S2MPU05:
+ val = rdev->desc->enable_mask;
+ break;
default:
return -EINVAL;
}
@@ -1118,6 +1122,86 @@ static const struct regulator_desc s2mpu02_regulators[] = {
regulator_desc_s2mpu02_buck7(7),
};
+#define regulator_desc_s2mpu05_ldo_reg(num, min, step, reg) { \
+ .name = "LDO"#num, \
+ .id = S2MPU05_LDO##num, \
+ .ops = &s2mpu02_ldo_ops, \
+ .type = REGULATOR_VOLTAGE, \
+ .owner = THIS_MODULE, \
+ .min_uV = min, \
+ .uV_step = step, \
+ .n_voltages = S2MPU05_LDO_N_VOLTAGES, \
+ .vsel_reg = reg, \
+ .vsel_mask = S2MPU05_LDO_VSEL_MASK, \
+ .enable_reg = reg, \
+ .enable_mask = S2MPU05_ENABLE_MASK, \
+ .enable_time = S2MPU05_ENABLE_TIME_LDO \
+}
+
+#define regulator_desc_s2mpu05_ldo(num, min, step) \
+ regulator_desc_s2mpu05_ldo_reg(num, min, step, S2MPU05_REG_L##num##CTRL)
+
+#define regulator_desc_s2mpu05_ldo1(num) \
+ regulator_desc_s2mpu05_ldo(num, S2MPU05_LDO_MIN1, S2MPU05_LDO_STEP1)
+
+#define regulator_desc_s2mpu05_ldo2(num) \
+ regulator_desc_s2mpu05_ldo(num, S2MPU05_LDO_MIN1, S2MPU05_LDO_STEP2)
+
+#define regulator_desc_s2mpu05_ldo3(num) \
+ regulator_desc_s2mpu05_ldo(num, S2MPU05_LDO_MIN2, S2MPU05_LDO_STEP2)
+
+#define regulator_desc_s2mpu05_ldo4(num) \
+ regulator_desc_s2mpu05_ldo(num, S2MPU05_LDO_MIN3, S2MPU05_LDO_STEP2)
+
+#define regulator_desc_s2mpu05_buck(num, which) { \
+ .name = "BUCK"#num, \
+ .id = S2MPU05_BUCK##num, \
+ .ops = &s2mpu02_buck_ops, \
+ .type = REGULATOR_VOLTAGE, \
+ .owner = THIS_MODULE, \
+ .min_uV = S2MPU05_BUCK_MIN##which, \
+ .uV_step = S2MPU05_BUCK_STEP##which, \
+ .n_voltages = S2MPU05_BUCK_N_VOLTAGES, \
+ .vsel_reg = S2MPU05_REG_B##num##CTRL2, \
+ .vsel_mask = S2MPU05_BUCK_VSEL_MASK, \
+ .enable_reg = S2MPU05_REG_B##num##CTRL1, \
+ .enable_mask = S2MPU05_ENABLE_MASK, \
+ .enable_time = S2MPU05_ENABLE_TIME_BUCK##num \
+}
+
+#define regulator_desc_s2mpu05_buck123(num) regulator_desc_s2mpu05_buck(num, 1)
+#define regulator_desc_s2mpu05_buck45(num) regulator_desc_s2mpu05_buck(num, 2)
+
+static const struct regulator_desc s2mpu05_regulators[] = {
+ regulator_desc_s2mpu05_ldo4(1),
+ regulator_desc_s2mpu05_ldo3(2),
+ regulator_desc_s2mpu05_ldo2(3),
+ regulator_desc_s2mpu05_ldo1(4),
+ regulator_desc_s2mpu05_ldo1(5),
+ regulator_desc_s2mpu05_ldo1(6),
+ regulator_desc_s2mpu05_ldo2(7),
+ regulator_desc_s2mpu05_ldo3(8),
+ regulator_desc_s2mpu05_ldo_reg(9, S2MPU05_LDO_MIN3, S2MPU05_LDO_STEP2,
+ S2MPU05_REG_L9CTRL1),
+ regulator_desc_s2mpu05_ldo4(10),
+ regulator_desc_s2mpu05_ldo2(25),
+ regulator_desc_s2mpu05_ldo3(26),
+ regulator_desc_s2mpu05_ldo2(27),
+ regulator_desc_s2mpu05_ldo3(28),
+ regulator_desc_s2mpu05_ldo3(29),
+ regulator_desc_s2mpu05_ldo2(30),
+ regulator_desc_s2mpu05_ldo3(31),
+ regulator_desc_s2mpu05_ldo3(32),
+ regulator_desc_s2mpu05_ldo3(33),
+ regulator_desc_s2mpu05_ldo3(34),
+ regulator_desc_s2mpu05_ldo3(35),
+ regulator_desc_s2mpu05_buck123(1),
+ regulator_desc_s2mpu05_buck123(2),
+ regulator_desc_s2mpu05_buck123(3),
+ regulator_desc_s2mpu05_buck45(4),
+ regulator_desc_s2mpu05_buck45(5),
+};
+
static int s2mps11_pmic_probe(struct platform_device *pdev)
{
struct sec_pmic_dev *iodev = dev_get_drvdata(pdev->dev.parent);
@@ -1159,6 +1243,11 @@ static int s2mps11_pmic_probe(struct platform_device *pdev)
regulators = s2mpu02_regulators;
BUILD_BUG_ON(S2MPS_REGULATOR_MAX < ARRAY_SIZE(s2mpu02_regulators));
break;
+ case S2MPU05:
+ rdev_num = ARRAY_SIZE(s2mpu05_regulators);
+ regulators = s2mpu05_regulators;
+ BUILD_BUG_ON(S2MPS_REGULATOR_MAX < ARRAY_SIZE(s2mpu05_regulators));
+ break;
default:
dev_err(&pdev->dev, "Invalid device type: %u\n",
s2mps11->dev_type);
@@ -1228,6 +1317,7 @@ static const struct platform_device_id s2mps11_pmic_id[] = {
{ "s2mps14-regulator", S2MPS14X},
{ "s2mps15-regulator", S2MPS15X},
{ "s2mpu02-regulator", S2MPU02},
+ { "s2mpu05-regulator", S2MPU05},
{ },
};
MODULE_DEVICE_TABLE(platform, s2mps11_pmic_id);
@@ -1245,5 +1335,5 @@ module_platform_driver(s2mps11_pmic_driver);
/* Module information */
MODULE_AUTHOR("Sangbeom Kim <sbkim73@samsung.com>");
-MODULE_DESCRIPTION("Samsung S2MPS11/S2MPS14/S2MPS15/S2MPU02 Regulator Driver");
+MODULE_DESCRIPTION("Samsung S2MPS11/14/15/S2MPU02/05 Regulator Driver");
MODULE_LICENSE("GPL");
--
2.48.1
^ permalink raw reply related [flat|nested] 14+ messages in thread
* Re: [PATCH 4/4] regulator: s2mps11: Add support for S2MPU05 regulators
2025-02-03 20:36 ` [PATCH 4/4] regulator: s2mps11: Add support for S2MPU05 regulators Kaustabh Chakraborty
@ 2025-02-04 16:09 ` Mark Brown
2025-02-05 8:34 ` Krzysztof Kozlowski
1 sibling, 0 replies; 14+ messages in thread
From: Mark Brown @ 2025-02-04 16:09 UTC (permalink / raw)
To: Kaustabh Chakraborty
Cc: Krzysztof Kozlowski, Liam Girdwood, Rob Herring, Conor Dooley,
Lee Jones, Sergey Lisov, linux-kernel, linux-samsung-soc,
devicetree
[-- Attachment #1: Type: text/plain, Size: 337 bytes --]
On Tue, Feb 04, 2025 at 02:06:29AM +0530, Kaustabh Chakraborty wrote:
> From: Sergey Lisov <sleirsgoevy@gmail.com>
>
> S2MPU05 is a PMIC by manufactured by Samsung, particularly used in
> Exynos7870 based devices. Add driver support for controlling its 21 LDO
> and 5 BUCK regulators.
Acked-by: Mark Brown <broonie@kernel.org>
[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 488 bytes --]
^ permalink raw reply [flat|nested] 14+ messages in thread
* Re: [PATCH 1/4] regulator: dt-bindings: add documentation for s2mpu05-pmic regulators
2025-02-03 20:36 ` [PATCH 1/4] regulator: dt-bindings: add documentation for s2mpu05-pmic regulators Kaustabh Chakraborty
@ 2025-02-05 8:32 ` Krzysztof Kozlowski
2025-02-05 20:06 ` Kaustabh Chakraborty
0 siblings, 1 reply; 14+ messages in thread
From: Krzysztof Kozlowski @ 2025-02-05 8:32 UTC (permalink / raw)
To: Kaustabh Chakraborty
Cc: Liam Girdwood, Mark Brown, Rob Herring, Conor Dooley, Lee Jones,
Sergey Lisov, linux-kernel, linux-samsung-soc, devicetree
On Tue, Feb 04, 2025 at 02:06:26AM +0530, Kaustabh Chakraborty wrote:
> S2MPU05 is a PMIC found in Exynos7870 devices, which controls voltage
> regulators (21 LDOs and 5 BUCKs). Provide documentation for devicetree
> definitions, regulator naming patterns, etc.
>
> Signed-off-by: Kaustabh Chakraborty <kauschluss@disroot.org>
> ---
> .../bindings/regulator/samsung,s2mpu05.yaml | 44 ++++++++++++++++++++++
> 1 file changed, 44 insertions(+)
>
> diff --git a/Documentation/devicetree/bindings/regulator/samsung,s2mpu05.yaml b/Documentation/devicetree/bindings/regulator/samsung,s2mpu05.yaml
> new file mode 100644
> index 0000000000000000000000000000000000000000..0a968fe79d44dbcb6720a7d1da698f9460e25521
> --- /dev/null
> +++ b/Documentation/devicetree/bindings/regulator/samsung,s2mpu05.yaml
> @@ -0,0 +1,44 @@
> +# SPDX-License-Identifier: GPL-2.0-only OR BSD-2-Clause
> +%YAML 1.2
> +---
> +$id: http://devicetree.org/schemas/regulator/samsung,s2mpu05.yaml#
> +$schema: http://devicetree.org/meta-schemas/core.yaml#
> +
> +title: Samsung S2MPU05 Power Management IC regulators
> +
> +maintainers:
> + - Krzysztof Kozlowski <krzk@kernel.org>
Not me, I don't have this device nor its datasheet.
> +
> +description: |
> + This is a part of device tree bindings for S2M and S5M family of Power
> + Management IC (PMIC).
> +
> + The S2MPU05 provides buck and LDO regulators.
> +
> + See also Documentation/devicetree/bindings/mfd/samsung,s2mps11.yaml for
> + additional information and example.
> +
> +patternProperties:
> + # 21 LDOs
> + "^LDO([1-9]|10|2[0-9]|3[0-5])$":
Why is there a gap in LDOs?
Best regards,
Krzysztof
^ permalink raw reply [flat|nested] 14+ messages in thread
* Re: [PATCH 2/4] dt-bindings: mfd: samsung,s2mps11: add compatible for s2mpu05-pmic
2025-02-03 20:36 ` [PATCH 2/4] dt-bindings: mfd: samsung,s2mps11: add compatible for s2mpu05-pmic Kaustabh Chakraborty
@ 2025-02-05 8:33 ` Krzysztof Kozlowski
2025-02-11 15:08 ` (subset) " Lee Jones
1 sibling, 0 replies; 14+ messages in thread
From: Krzysztof Kozlowski @ 2025-02-05 8:33 UTC (permalink / raw)
To: Kaustabh Chakraborty
Cc: Liam Girdwood, Mark Brown, Rob Herring, Conor Dooley, Lee Jones,
Sergey Lisov, linux-kernel, linux-samsung-soc, devicetree
On Tue, Feb 04, 2025 at 02:06:27AM +0530, Kaustabh Chakraborty wrote:
> S2MPU05 is a PMIC present in Samsung's Exynos7870 devices. It houses
> voltage regulators (21 LDOs and 5 BUCKs), and an RTC module. Add the
> compatible string "samsung,s2mpu05-pmic" to the PMIC documentation.
>
> Signed-off-by: Kaustabh Chakraborty <kauschluss@disroot.org>
> ---
> Documentation/devicetree/bindings/mfd/samsung,s2mps11.yaml | 13 +++++++++++++
> 1 file changed, 13 insertions(+)
Reviewed-by: Krzysztof Kozlowski <krzysztof.kozlowski@linaro.org>
Best regards,
Krzysztof
^ permalink raw reply [flat|nested] 14+ messages in thread
* Re: [PATCH 3/4] mfd: sec: add support for S2MPU05 PMIC
2025-02-03 20:36 ` [PATCH 3/4] mfd: sec: add support for S2MPU05 PMIC Kaustabh Chakraborty
@ 2025-02-05 8:34 ` Krzysztof Kozlowski
2025-02-11 13:47 ` Lee Jones
1 sibling, 0 replies; 14+ messages in thread
From: Krzysztof Kozlowski @ 2025-02-05 8:34 UTC (permalink / raw)
To: Kaustabh Chakraborty
Cc: Liam Girdwood, Mark Brown, Rob Herring, Conor Dooley, Lee Jones,
Sergey Lisov, linux-kernel, linux-samsung-soc, devicetree
On Tue, Feb 04, 2025 at 02:06:28AM +0530, Kaustabh Chakraborty wrote:
> From: Sergey Lisov <sleirsgoevy@gmail.com>
>
> Add support for Samsung's S2MPU05 PMIC. It's the primary PMIC used by
> Exynos7870 devices. It houses regulators (21 LDOs and 5 BUCKs) and a RTC
> clock device.
>
> Signed-off-by: Sergey Lisov <sleirsgoevy@gmail.com>
> Signed-off-by: Kaustabh Chakraborty <kauschluss@disroot.org>
> ---
> drivers/mfd/sec-core.c | 12 +++
> drivers/mfd/sec-irq.c | 85 ++++++++++++++++++++
> include/linux/mfd/samsung/core.h | 1 +
> include/linux/mfd/samsung/irq.h | 44 +++++++++++
> include/linux/mfd/samsung/s2mpu05.h | 152 ++++++++++++++++++++++++++++++++++++
> 5 files changed, 294 insertions(+)
Reviewed-by: Krzysztof Kozlowski <krzysztof.kozlowski@linaro.org>
Best regards,
Krzysztof
^ permalink raw reply [flat|nested] 14+ messages in thread
* Re: [PATCH 4/4] regulator: s2mps11: Add support for S2MPU05 regulators
2025-02-03 20:36 ` [PATCH 4/4] regulator: s2mps11: Add support for S2MPU05 regulators Kaustabh Chakraborty
2025-02-04 16:09 ` Mark Brown
@ 2025-02-05 8:34 ` Krzysztof Kozlowski
1 sibling, 0 replies; 14+ messages in thread
From: Krzysztof Kozlowski @ 2025-02-05 8:34 UTC (permalink / raw)
To: Kaustabh Chakraborty
Cc: Liam Girdwood, Mark Brown, Rob Herring, Conor Dooley, Lee Jones,
Sergey Lisov, linux-kernel, linux-samsung-soc, devicetree
On Tue, Feb 04, 2025 at 02:06:29AM +0530, Kaustabh Chakraborty wrote:
> From: Sergey Lisov <sleirsgoevy@gmail.com>
>
> S2MPU05 is a PMIC by manufactured by Samsung, particularly used in
> Exynos7870 based devices. Add driver support for controlling its 21 LDO
> and 5 BUCK regulators.
>
> Signed-off-by: Sergey Lisov <sleirsgoevy@gmail.com>
> Signed-off-by: Kaustabh Chakraborty <kauschluss@disroot.org>
> ---
> drivers/regulator/Kconfig | 4 +-
> drivers/regulator/s2mps11.c | 92 ++++++++++++++++++++++++++++++++++++++++++++-
> 2 files changed, 93 insertions(+), 3 deletions(-)
Reviewed-by: Krzysztof Kozlowski <krzysztof.kozlowski@linaro.org>
Best regards,
Krzysztof
^ permalink raw reply [flat|nested] 14+ messages in thread
* Re: [PATCH 1/4] regulator: dt-bindings: add documentation for s2mpu05-pmic regulators
2025-02-05 8:32 ` Krzysztof Kozlowski
@ 2025-02-05 20:06 ` Kaustabh Chakraborty
2025-02-05 20:37 ` Krzysztof Kozlowski
0 siblings, 1 reply; 14+ messages in thread
From: Kaustabh Chakraborty @ 2025-02-05 20:06 UTC (permalink / raw)
To: Krzysztof Kozlowski
Cc: Liam Girdwood, Mark Brown, Rob Herring, Conor Dooley, Lee Jones,
Sergey Lisov, linux-kernel, linux-samsung-soc, devicetree,
Kaustabh Chakraborty
On 2025-02-05 08:32, Krzysztof Kozlowski wrote:
>> +
>> +description: |
>> + This is a part of device tree bindings for S2M and S5M family of Power
>> + Management IC (PMIC).
>> +
>> + The S2MPU05 provides buck and LDO regulators.
>> +
>> + See also Documentation/devicetree/bindings/mfd/samsung,s2mps11.yaml for
>> + additional information and example.
>> +
>> +patternProperties:
>> + # 21 LDOs
>> + "^LDO([1-9]|10|2[0-9]|3[0-5])$":
>
> Why is there a gap in LDOs?
LDOs 11-24 are not implemented in the downstream kernel driver. On further
inspection I was able to find the register addresses, but minimum voltage
and step values are unknown. :(
^ permalink raw reply [flat|nested] 14+ messages in thread
* Re: [PATCH 1/4] regulator: dt-bindings: add documentation for s2mpu05-pmic regulators
2025-02-05 20:06 ` Kaustabh Chakraborty
@ 2025-02-05 20:37 ` Krzysztof Kozlowski
0 siblings, 0 replies; 14+ messages in thread
From: Krzysztof Kozlowski @ 2025-02-05 20:37 UTC (permalink / raw)
To: Kaustabh Chakraborty
Cc: Liam Girdwood, Mark Brown, Rob Herring, Conor Dooley, Lee Jones,
Sergey Lisov, linux-kernel, linux-samsung-soc, devicetree
On 05/02/2025 21:06, Kaustabh Chakraborty wrote:
> On 2025-02-05 08:32, Krzysztof Kozlowski wrote:
>>> +
>>> +description: |
>>> + This is a part of device tree bindings for S2M and S5M family of Power
>>> + Management IC (PMIC).
>>> +
>>> + The S2MPU05 provides buck and LDO regulators.
>>> +
>>> + See also Documentation/devicetree/bindings/mfd/samsung,s2mps11.yaml for
>>> + additional information and example.
>>> +
>>> +patternProperties:
>>> + # 21 LDOs
>>> + "^LDO([1-9]|10|2[0-9]|3[0-5])$":
>>
>> Why is there a gap in LDOs?
>
> LDOs 11-24 are not implemented in the downstream kernel driver. On further
> inspection I was able to find the register addresses, but minimum voltage
> and step values are unknown. :(
I see, there are marked for CP. Add a comment that gap in LDOs is due to
lack of datasheet and lack of control by OS.
Best regards,
Krzysztof
^ permalink raw reply [flat|nested] 14+ messages in thread
* Re: [PATCH 3/4] mfd: sec: add support for S2MPU05 PMIC
2025-02-03 20:36 ` [PATCH 3/4] mfd: sec: add support for S2MPU05 PMIC Kaustabh Chakraborty
2025-02-05 8:34 ` Krzysztof Kozlowski
@ 2025-02-11 13:47 ` Lee Jones
1 sibling, 0 replies; 14+ messages in thread
From: Lee Jones @ 2025-02-11 13:47 UTC (permalink / raw)
To: Kaustabh Chakraborty
Cc: Krzysztof Kozlowski, Liam Girdwood, Mark Brown, Rob Herring,
Conor Dooley, Sergey Lisov, linux-kernel, linux-samsung-soc,
devicetree
On Tue, 04 Feb 2025, Kaustabh Chakraborty wrote:
> From: Sergey Lisov <sleirsgoevy@gmail.com>
>
> Add support for Samsung's S2MPU05 PMIC. It's the primary PMIC used by
> Exynos7870 devices. It houses regulators (21 LDOs and 5 BUCKs) and a RTC
> clock device.
>
> Signed-off-by: Sergey Lisov <sleirsgoevy@gmail.com>
> Signed-off-by: Kaustabh Chakraborty <kauschluss@disroot.org>
> ---
> drivers/mfd/sec-core.c | 12 +++
> drivers/mfd/sec-irq.c | 85 ++++++++++++++++++++
> include/linux/mfd/samsung/core.h | 1 +
> include/linux/mfd/samsung/irq.h | 44 +++++++++++
> include/linux/mfd/samsung/s2mpu05.h | 152 ++++++++++++++++++++++++++++++++++++
> 5 files changed, 294 insertions(+)
>
> diff --git a/drivers/mfd/sec-core.c b/drivers/mfd/sec-core.c
> index cdfe738e1d76e63145e5888da1cecc122fbc3737..3e9b65c988a7f08bf16d3703004a3d60cfcb1c75 100644
> --- a/drivers/mfd/sec-core.c
> +++ b/drivers/mfd/sec-core.c
> @@ -83,6 +83,11 @@ static const struct mfd_cell s2mpu02_devs[] = {
> { .name = "s2mpu02-regulator", },
> };
>
> +static const struct mfd_cell s2mpu05_devs[] = {
> + { .name = "s2mpu05-regulator", },
> + { .name = "s2mps15-rtc", },
> +};
> +
> static const struct of_device_id sec_dt_match[] = {
> {
> .compatible = "samsung,s5m8767-pmic",
> @@ -108,6 +113,9 @@ static const struct of_device_id sec_dt_match[] = {
> }, {
> .compatible = "samsung,s2mpu02-pmic",
> .data = (void *)S2MPU02,
> + }, {
> + .compatible = "samsung,s2mpu05-pmic",
> + .data = (void *)S2MPU05,
> }, {
> /* Sentinel */
> },
> @@ -374,6 +382,10 @@ static int sec_pmic_probe(struct i2c_client *i2c)
> sec_devs = s2mpu02_devs;
> num_sec_devs = ARRAY_SIZE(s2mpu02_devs);
> break;
> + case S2MPU05:
> + sec_devs = s2mpu05_devs;
> + num_sec_devs = ARRAY_SIZE(s2mpu05_devs);
> + break;
> default:
> dev_err(&i2c->dev, "Unsupported device type (%lu)\n",
> sec_pmic->device_type);
> diff --git a/drivers/mfd/sec-irq.c b/drivers/mfd/sec-irq.c
> index e191aeb0c07c58a3bc4850d94af39dfe085a33e5..9ba8268fef01366d6b6dc88113e6d9b1e1701c39 100644
> --- a/drivers/mfd/sec-irq.c
> +++ b/drivers/mfd/sec-irq.c
> @@ -14,6 +14,7 @@
> #include <linux/mfd/samsung/s2mps11.h>
> #include <linux/mfd/samsung/s2mps14.h>
> #include <linux/mfd/samsung/s2mpu02.h>
> +#include <linux/mfd/samsung/s2mpu05.h>
> #include <linux/mfd/samsung/s5m8767.h>
>
> static const struct regmap_irq s2mps11_irqs[] = {
> @@ -225,6 +226,77 @@ static const struct regmap_irq s2mpu02_irqs[] = {
> },
> };
>
> +static const struct regmap_irq s2mpu05_irqs[] = {
> + [S2MPU05_IRQ_PWRONF] = {
> + .reg_offset = 0,
> + .mask = S2MPU05_IRQ_PWRONF_MASK,
> + },
Please make use of REGMAP_IRQ_REG().
> + [S2MPU05_IRQ_PWRONR] = {
> + .reg_offset = 0,
> + .mask = S2MPU05_IRQ_PWRONR_MASK,
> + },
> + [S2MPU05_IRQ_JIGONBF] = {
> + .reg_offset = 0,
> + .mask = S2MPU05_IRQ_JIGONBF_MASK,
> + },
> + [S2MPU05_IRQ_JIGONBR] = {
> + .reg_offset = 0,
> + .mask = S2MPU05_IRQ_JIGONBR_MASK,
> + },
> + [S2MPU05_IRQ_ACOKF] = {
> + .reg_offset = 0,
> + .mask = S2MPU05_IRQ_ACOKF_MASK,
> + },
> + [S2MPU05_IRQ_ACOKR] = {
> + .reg_offset = 0,
> + .mask = S2MPU05_IRQ_ACOKR_MASK,
> + },
> + [S2MPU05_IRQ_PWRON1S] = {
> + .reg_offset = 0,
> + .mask = S2MPU05_IRQ_PWRON1S_MASK,
> + },
> + [S2MPU05_IRQ_MRB] = {
> + .reg_offset = 0,
> + .mask = S2MPU05_IRQ_MRB_MASK,
> + },
> + [S2MPU05_IRQ_RTC60S] = {
> + .reg_offset = 1,
> + .mask = S2MPU05_IRQ_RTC60S_MASK,
> + },
> + [S2MPU05_IRQ_RTCA1] = {
> + .reg_offset = 1,
> + .mask = S2MPU05_IRQ_RTCA1_MASK,
> + },
> + [S2MPU05_IRQ_RTCA0] = {
> + .reg_offset = 1,
> + .mask = S2MPU05_IRQ_RTCA0_MASK,
> + },
> + [S2MPU05_IRQ_SMPL] = {
> + .reg_offset = 1,
> + .mask = S2MPU05_IRQ_SMPL_MASK,
> + },
> + [S2MPU05_IRQ_RTC1S] = {
> + .reg_offset = 1,
> + .mask = S2MPU05_IRQ_RTC1S_MASK,
> + },
> + [S2MPU05_IRQ_WTSR] = {
> + .reg_offset = 1,
> + .mask = S2MPU05_IRQ_WTSR_MASK,
> + },
> + [S2MPU05_IRQ_INT120C] = {
> + .reg_offset = 2,
> + .mask = S2MPU05_IRQ_INT120C_MASK,
> + },
> + [S2MPU05_IRQ_INT140C] = {
> + .reg_offset = 2,
> + .mask = S2MPU05_IRQ_INT140C_MASK,
> + },
> + [S2MPU05_IRQ_TSD] = {
> + .reg_offset = 2,
> + .mask = S2MPU05_IRQ_TSD_MASK,
> + },
> +};
> +
> static const struct regmap_irq s5m8767_irqs[] = {
> [S5M8767_IRQ_PWRR] = {
> .reg_offset = 0,
> @@ -339,6 +411,16 @@ static const struct regmap_irq_chip s2mpu02_irq_chip = {
> .ack_base = S2MPU02_REG_INT1,
> };
>
> +static const struct regmap_irq_chip s2mpu05_irq_chip = {
> + .name = "s2mpu05",
> + .irqs = s2mpu05_irqs,
> + .num_irqs = ARRAY_SIZE(s2mpu05_irqs),
> + .num_regs = 3,
> + .status_base = S2MPU05_REG_INT1,
> + .mask_base = S2MPU05_REG_INT1M,
> + .ack_base = S2MPU05_REG_INT1,
> +};
> +
> static const struct regmap_irq_chip s5m8767_irq_chip = {
> .name = "s5m8767",
> .irqs = s5m8767_irqs,
> @@ -383,6 +465,9 @@ int sec_irq_init(struct sec_pmic_dev *sec_pmic)
> case S2MPU02:
> sec_irq_chip = &s2mpu02_irq_chip;
> break;
> + case S2MPU05:
> + sec_irq_chip = &s2mpu05_irq_chip;
> + break;
> default:
> dev_err(sec_pmic->dev, "Unknown device type %lu\n",
> sec_pmic->device_type);
> diff --git a/include/linux/mfd/samsung/core.h b/include/linux/mfd/samsung/core.h
> index 750274d41fc06b0411dbfea6d5efa6092214100d..f35314458fd22e43fa13034439406bea17a155c9 100644
> --- a/include/linux/mfd/samsung/core.h
> +++ b/include/linux/mfd/samsung/core.h
> @@ -44,6 +44,7 @@ enum sec_device_type {
> S2MPS14X,
> S2MPS15X,
> S2MPU02,
> + S2MPU05,
> };
>
> /**
> diff --git a/include/linux/mfd/samsung/irq.h b/include/linux/mfd/samsung/irq.h
> index 3fd2775eb9bbf86ac227810f49d24ae815bb3fcb..f8559e2198a53d28910e0f431f7b8b7cccec6289 100644
> --- a/include/linux/mfd/samsung/irq.h
> +++ b/include/linux/mfd/samsung/irq.h
> @@ -150,6 +150,50 @@ enum s2mpu02_irq {
> /* Masks for interrupts are the same as in s2mps11 */
> #define S2MPS14_IRQ_TSD_MASK (1 << 2)
>
> +enum s2mpu05_irq {
> + S2MPU05_IRQ_PWRONF,
> + S2MPU05_IRQ_PWRONR,
> + S2MPU05_IRQ_JIGONBF,
> + S2MPU05_IRQ_JIGONBR,
> + S2MPU05_IRQ_ACOKF,
> + S2MPU05_IRQ_ACOKR,
> + S2MPU05_IRQ_PWRON1S,
> + S2MPU05_IRQ_MRB,
> +
> + S2MPU05_IRQ_RTC60S,
> + S2MPU05_IRQ_RTCA1,
> + S2MPU05_IRQ_RTCA0,
> + S2MPU05_IRQ_SMPL,
> + S2MPU05_IRQ_RTC1S,
> + S2MPU05_IRQ_WTSR,
> +
> + S2MPU05_IRQ_INT120C,
> + S2MPU05_IRQ_INT140C,
> + S2MPU05_IRQ_TSD,
> +
> + S2MPU05_IRQ_NR,
> +};
> +
> +#define S2MPU05_IRQ_PWRONF_MASK (1 << 0)
> +#define S2MPU05_IRQ_PWRONR_MASK (1 << 1)
> +#define S2MPU05_IRQ_JIGONBF_MASK (1 << 2)
> +#define S2MPU05_IRQ_JIGONBR_MASK (1 << 3)
> +#define S2MPU05_IRQ_ACOKF_MASK (1 << 4)
> +#define S2MPU05_IRQ_ACOKR_MASK (1 << 5)
> +#define S2MPU05_IRQ_PWRON1S_MASK (1 << 6)
> +#define S2MPU05_IRQ_MRB_MASK (1 << 7)
> +
> +#define S2MPU05_IRQ_RTC60S_MASK (1 << 0)
> +#define S2MPU05_IRQ_RTCA1_MASK (1 << 1)
> +#define S2MPU05_IRQ_RTCA0_MASK (1 << 2)
> +#define S2MPU05_IRQ_SMPL_MASK (1 << 3)
> +#define S2MPU05_IRQ_RTC1S_MASK (1 << 4)
> +#define S2MPU05_IRQ_WTSR_MASK (1 << 5)
> +
> +#define S2MPU05_IRQ_INT120C_MASK (1 << 0)
> +#define S2MPU05_IRQ_INT140C_MASK (1 << 1)
> +#define S2MPU05_IRQ_TSD_MASK (1 << 2)
BIT()?
> enum s5m8767_irq {
> S5M8767_IRQ_PWRR,
> S5M8767_IRQ_PWRF,
> diff --git a/include/linux/mfd/samsung/s2mpu05.h b/include/linux/mfd/samsung/s2mpu05.h
> new file mode 100644
> index 0000000000000000000000000000000000000000..fa450e4352a178a6a996bbd723f1fc1fa827c167
> --- /dev/null
> +++ b/include/linux/mfd/samsung/s2mpu05.h
> @@ -0,0 +1,152 @@
> +/* SPDX-License-Identifier: GPL-2.0+ */
> +/*
> + * Copyright (c) 2015 Samsung Electronics Co., Ltd
No changes have happened in 10 years?
> + * http://www.samsung.com
> + */
> +
> +#ifndef __LINUX_MFD_S2MPU05_H
> +#define __LINUX_MFD_S2MPU05_H
> +
> +/* S2MPU05 registers */
> +enum S2MPU05_reg {
> + S2MPU05_REG_ID,
> + S2MPU05_REG_INT1,
> + S2MPU05_REG_INT2,
> + S2MPU05_REG_INT3,
> + S2MPU05_REG_INT1M,
> + S2MPU05_REG_INT2M,
> + S2MPU05_REG_INT3M,
> + S2MPU05_REG_ST1,
> + S2MPU05_REG_ST2,
> + S2MPU05_REG_PWRONSRC,
> + S2MPU05_REG_OFFSRC,
> + S2MPU05_REG_BU_CHG,
> + S2MPU05_REG_RTC_BUF,
> + S2MPU05_REG_CTRL1,
> + S2MPU05_REG_CTRL2,
> + S2MPU05_REG_ETC_TEST,
> + S2MPU05_REG_OTP_ADRL,
> + S2MPU05_REG_OTP_ADRH,
> + S2MPU05_REG_OTP_DATA,
> + S2MPU05_REG_MON1SEL,
> + S2MPU05_REG_MON2SEL,
> + S2MPU05_REG_CTRL3,
> + S2MPU05_REG_ETC_OTP,
> + S2MPU05_REG_UVLO,
> + S2MPU05_REG_TIME_CTRL1,
> + S2MPU05_REG_TIME_CTRL2,
> + S2MPU05_REG_B1CTRL1,
> + S2MPU05_REG_B1CTRL2,
> + S2MPU05_REG_B2CTRL1,
> + S2MPU05_REG_B2CTRL2,
> + S2MPU05_REG_B2CTRL3,
> + S2MPU05_REG_B2CTRL4,
> + S2MPU05_REG_B3CTRL1,
> + S2MPU05_REG_B3CTRL2,
> + S2MPU05_REG_B3CTRL3,
> + S2MPU05_REG_B4CTRL1,
> + S2MPU05_REG_B4CTRL2,
> + S2MPU05_REG_B5CTRL1,
> + S2MPU05_REG_B5CTRL2,
> + S2MPU05_REG_BUCK_RAMP,
> + S2MPU05_REG_LDO_DVS1,
> + S2MPU05_REG_LDO_DVS9,
> + S2MPU05_REG_LDO_DVS10,
> + S2MPU05_REG_L1CTRL,
> + S2MPU05_REG_L2CTRL,
> + S2MPU05_REG_L3CTRL,
> + S2MPU05_REG_L4CTRL,
> + S2MPU05_REG_L5CTRL,
> + S2MPU05_REG_L6CTRL,
> + S2MPU05_REG_L7CTRL,
> + S2MPU05_REG_L8CTRL,
> + S2MPU05_REG_L9CTRL1,
> + S2MPU05_REG_L9CTRL2,
> + S2MPU05_REG_L10CTRL, /* LDO11~24 for CP */
> + S2MPU05_REG_L25CTRL = 0x47,
> + S2MPU05_REG_L26CTRL,
> + S2MPU05_REG_L27CTRL,
> + S2MPU05_REG_L28CTRL,
> + S2MPU05_REG_L29CTRL,
> + S2MPU05_REG_L30CTRL,
> + S2MPU05_REG_L31CTRL,
> + S2MPU05_REG_L32CTRL,
> + S2MPU05_REG_L33CTRL,
> + S2MPU05_REG_L34CTRL,
> + S2MPU05_REG_L35CTRL,
> + S2MPU05_REG_LDO_DSCH1,
> + S2MPU05_REG_LDO_DSCH2,
> + S2MPU05_REG_LDO_DSCH3,
> + S2MPU05_REG_LDO_DSCH4,
> + S2MPU05_REG_LDO_DSCH5,
> + S2MPU05_REG_LDO_CTRL1,
> + S2MPU05_REG_LDO_CTRL2,
> + S2MPU05_REG_TCXO_CTRL,
> + S2MPU05_REG_SELMIF,
> +};
> +
> +/* S2MPU05 regulator ids */
> +enum S2MPU05_regulators {
> + S2MPU05_LDO1,
> + S2MPU05_LDO2,
> + S2MPU05_LDO3,
> + S2MPU05_LDO4,
> + S2MPU05_LDO5,
> + S2MPU05_LDO6,
> + S2MPU05_LDO7,
> + S2MPU05_LDO8,
> + S2MPU05_LDO9,
> + S2MPU05_LDO10, /* LDO11~24 for CP */
> + S2MPU05_LDO25,
> + S2MPU05_LDO26,
> + S2MPU05_LDO27,
> + S2MPU05_LDO28,
> + S2MPU05_LDO29,
> + S2MPU05_LDO30,
> + S2MPU05_LDO31,
> + S2MPU05_LDO32,
> + S2MPU05_LDO33,
> + S2MPU05_LDO34,
> + S2MPU05_LDO35,
> + S2MPU05_BUCK1,
> + S2MPU05_BUCK2,
> + S2MPU05_BUCK3,
> + S2MPU05_BUCK4,
> + S2MPU05_BUCK5,
> +
> + S2MPU05_REGULATOR_MAX,
> +};
> +
> +#define S2MPU05_SW_ENABLE_MASK 0x03
> +
> +#define S2MPU05_ENABLE_TIME_LDO 128
> +#define S2MPU05_ENABLE_TIME_BUCK1 110
> +#define S2MPU05_ENABLE_TIME_BUCK2 110
> +#define S2MPU05_ENABLE_TIME_BUCK3 110
> +#define S2MPU05_ENABLE_TIME_BUCK4 150
> +#define S2MPU05_ENABLE_TIME_BUCK5 150
> +
> +#define S2MPU05_LDO_MIN1 800000
> +#define S2MPU05_LDO_STEP1 12500
> +#define S2MPU05_LDO_MIN2 1800000
> +#define S2MPU05_LDO_STEP2 25000
> +#define S2MPU05_LDO_MIN3 400000
> +
> +#define S2MPU05_BUCK_MIN1 400000
> +#define S2MPU05_BUCK_STEP1 6250
> +#define S2MPU05_BUCK_MIN2 600000
> +#define S2MPU05_BUCK_STEP2 12500
> +
> +#define S2MPU05_RAMP_DELAY 12000 /* uV/uS */
> +
> +#define S2MPU05_ENABLE_SHIFT 6
> +#define S2MPU05_ENABLE_MASK (0x03 << S2MPU05_ENABLE_SHIFT)
> +
> +#define S2MPU05_LDO_VSEL_MASK 0x3F
> +#define S2MPU05_BUCK_VSEL_MASK 0xFF
> +#define S2MPU05_LDO_N_VOLTAGES (S2MPU05_LDO_VSEL_MASK + 1)
> +#define S2MPU05_BUCK_N_VOLTAGES (S2MPU05_BUCK_VSEL_MASK + 1)
> +
> +#define S2MPU05_PMIC_EN_SHIFT 6
> +
> +#endif /* __LINUX_MFD_S2MPU05_H */
>
> --
> 2.48.1
>
--
Lee Jones [李琼斯]
^ permalink raw reply [flat|nested] 14+ messages in thread
* Re: (subset) [PATCH 2/4] dt-bindings: mfd: samsung,s2mps11: add compatible for s2mpu05-pmic
2025-02-03 20:36 ` [PATCH 2/4] dt-bindings: mfd: samsung,s2mps11: add compatible for s2mpu05-pmic Kaustabh Chakraborty
2025-02-05 8:33 ` Krzysztof Kozlowski
@ 2025-02-11 15:08 ` Lee Jones
1 sibling, 0 replies; 14+ messages in thread
From: Lee Jones @ 2025-02-11 15:08 UTC (permalink / raw)
To: Krzysztof Kozlowski, Liam Girdwood, Mark Brown, Rob Herring,
Conor Dooley, Lee Jones, Kaustabh Chakraborty
Cc: Sergey Lisov, linux-kernel, linux-samsung-soc, devicetree
On Tue, 04 Feb 2025 02:06:27 +0530, Kaustabh Chakraborty wrote:
> S2MPU05 is a PMIC present in Samsung's Exynos7870 devices. It houses
> voltage regulators (21 LDOs and 5 BUCKs), and an RTC module. Add the
> compatible string "samsung,s2mpu05-pmic" to the PMIC documentation.
>
>
Applied, thanks!
[2/4] dt-bindings: mfd: samsung,s2mps11: add compatible for s2mpu05-pmic
commit: 929a8b608d1acd1ca7a493a72d80768a32925981
--
Lee Jones [李琼斯]
^ permalink raw reply [flat|nested] 14+ messages in thread
end of thread, other threads:[~2025-02-11 15:08 UTC | newest]
Thread overview: 14+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2025-02-03 20:36 [PATCH 0/4] Introduce support for Exynos7870's S2MPU05 PMIC and its regulators Kaustabh Chakraborty
2025-02-03 20:36 ` [PATCH 1/4] regulator: dt-bindings: add documentation for s2mpu05-pmic regulators Kaustabh Chakraborty
2025-02-05 8:32 ` Krzysztof Kozlowski
2025-02-05 20:06 ` Kaustabh Chakraborty
2025-02-05 20:37 ` Krzysztof Kozlowski
2025-02-03 20:36 ` [PATCH 2/4] dt-bindings: mfd: samsung,s2mps11: add compatible for s2mpu05-pmic Kaustabh Chakraborty
2025-02-05 8:33 ` Krzysztof Kozlowski
2025-02-11 15:08 ` (subset) " Lee Jones
2025-02-03 20:36 ` [PATCH 3/4] mfd: sec: add support for S2MPU05 PMIC Kaustabh Chakraborty
2025-02-05 8:34 ` Krzysztof Kozlowski
2025-02-11 13:47 ` Lee Jones
2025-02-03 20:36 ` [PATCH 4/4] regulator: s2mps11: Add support for S2MPU05 regulators Kaustabh Chakraborty
2025-02-04 16:09 ` Mark Brown
2025-02-05 8:34 ` Krzysztof Kozlowski
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).