Skip to contentSkip to conversation

Add Samsung s2dos05 pmic support

PATCH Superseded Dzmitry Sankouski 3 participants 8 messages Oct 7, 2024 – Oct 15, 2024

Subsystems (5)

v6 of 17 Superseded Latest is v17 →

lore
Share & tools
lore
#0 lore raw

v6 cover Add Samsung s2dos05 pmic support

The S2DOS05 is a companion power management IC for the panel and touchscreen in smart phones. Provides voltage regulators and
ADC for power/current measurements.

---
Changes in v6:
- fix uninitialized ret variable
- Link to v5: https://lore.kernel.org/r/20240617-starqltechn_integration_upstream-v5-0-ea1109029ba5@gmail.com

Changes in v5:
- Split patchset per subsystem
- Rewrite cover letter
- Link to v4: https://lore.kernel.org/r/20240913-starqltechn_integration_upstream-v4-0-2d2efd5c5877@gmail.com

Changes in v4:
- Rewrite max77705, max77705_charger, max77705_fuel_gauge from scratch
- Reorder patches:
- squash max77705 subdevice bindings in core file because
no resources there
- split device tree changes
- Use _ as space for filenames in power/supply like the majority
- Replace gcc-845 freq_tbl frequencies patch with new approach,
based on automatic m/n/pre_div value generation
- Link to v3: https://lore.kernel.org/r/20240618-starqltechn_integration_upstream-v3-0-e3f6662017ac@gmail.com

Changes in version 3:
- s2dos05 driver converted to MFD

Changes in version 2:
- s2dos05 regulator:
- hex to decimal in regulator values
- fix compatible value
- remove interrupt specific code, because it's empty in vendor kernel, and I cannot test it on available hardware anyway.

---
Dzmitry Sankouski (3):
dt-bindings: mfd: add samsung,s2dos05
mfd: sec-core: add s2dos05 support
regulator: add s2dos05 regulator support

 Documentation/devicetree/bindings/mfd/samsung,s2dos05.yaml |  99 +++++++++++++++++++++++++++++++++++++++++
 MAINTAINERS                                                |   4 +-
 drivers/mfd/sec-core.c                                     |  11 +++++
 drivers/regulator/Kconfig                                  |   8 ++++
 drivers/regulator/Makefile                                 |   1 +
 drivers/regulator/s2dos05-regulator.c                      | 176 +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
 include/linux/mfd/samsung/core.h                           |   1 +
 include/linux/regulator/s2dos05.h                          |  73 ++++++++++++++++++++++++++++++
 8 files changed, 371 insertions(+), 2 deletions(-)

---
base-commit: 58ca61c1a866bfdaa5e19fb19a2416764f847d75
change-id: 20240617-starqltechn_integration_upstream-bc86850b2fe3

Best regards,

Signature · 1 line
Dzmitry Sankouski <[email protected]>
#1 lore raw

PATCH v6 1/3 dt-bindings: mfd: add samsung,s2dos05

Add samsung,s2dos05 MFD module binding.

---
Changes in v4:
- split long(>80) lines
- fix indentation
- merge with regulators binding
- drop pmic suffix
- drop unused labels in example
- correct description

Changes in v5:
- simplify regulator-name in examples
- remove index from single buck regulator
- fix example indentation
- replace example hex numbers to decimal

---
 Documentation/devicetree/bindings/mfd/samsung,s2dos05.yaml | 99 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
 MAINTAINERS                                                |  2 +-
 2 files changed, 100 insertions(+), 1 deletion(-)
Documentation/devicetree/bindings/mfd/samsung,s2dos05.yaml new file +99 -0
new file mode 100644
index 000000000000..b85285720c16
@@ -0,0 +1,99 @@
+# SPDX-License-Identifier: (GPL-2.0 OR BSD-2-Clause)
+%YAML 1.2
+---
+$id: http://devicetree.org/schemas/mfd/samsung,s2dos05.yaml#
+$schema: http://devicetree.org/meta-schemas/core.yaml#
+
+title: Samsung S2DOS05 Power Management IC
+
+maintainers:
+  - Dzmitry Sankouski <[email protected]>
+
+description:
+  This is a device tree bindings for S2DOS family of Power Management IC (PMIC).
+
+  The S2DOS05 is a companion power management IC for the panel and touchscreen
+  in smart phones. Provides voltage regulators and
+  ADC for power/current measurements.
+
+  Regulator section has 4 LDO and 1 BUCK regulators and also
+  provides ELVDD, ELVSS, AVDD lines.
+
+properties:
+  compatible:
+    const: samsung,s2dos05
+
+  reg:
+    maxItems: 1
+
+  regulators:
+    patternProperties:
+      "^buck|ldo[1-4]$":
+        type: object
+        $ref: /schemas/regulator/regulator.yaml#
+        unevaluatedProperties: false
+
+        required:
+          - regulator-name
+
+    additionalProperties: false
+
+required:
+  - compatible
+  - reg
+  - regulators
+
+additionalProperties: false
+
+examples:
+  - |
+    i2c {
+        #address-cells = <1>;
+        #size-cells = <0>;
+
+        pmic@60 {
+            compatible = "samsung,s2dos05";
+            reg = <0x60>;
+
+            regulators {
+                ldo1 {
+                    regulator-active-discharge = <1>;
+                    regulator-min-microvolt = <1500000>;
+                    regulator-max-microvolt = <2000000>;
+                    regulator-name = "ldo1";
+                };
+
+                ldo2 {
+                    regulator-active-discharge = <1>;
+                    regulator-boot-on;
+                    regulator-min-microvolt = <1800000>;
+                    regulator-max-microvolt = <1800000>;
+                    regulator-name = "ldo2";
+                };
+
+                ldo3 {
+                    regulator-active-discharge = <1>;
+                    regulator-boot-on;
+                    regulator-min-microvolt = <3000000>;
+                    regulator-max-microvolt = <3000000>;
+                    regulator-name = "ldo3";
+                };
+
+                ldo4 {
+                    regulator-active-discharge = <1>;
+                    regulator-min-microvolt = <2700000>;
+                    regulator-max-microvolt = <3775000>;
+                    regulator-name = "ldo4";
+                };
+
+                buck {
+                    regulator-active-discharge = <1>;
+                    regulator-min-microvolt = <850000>;
+                    regulator-max-microvolt = <2100000>;
+                    regulator-name = "buck";
+                };
+            };
+        };
+    };
+
+...
MAINTAINERS +1 -1
index 84086d47db69..ae6564d98caa 100644
@@ -20475,7 +20475,7 @@ L:	[email protected]
 S:	Maintained
 B:	mailto:[email protected]
 F:	Documentation/devicetree/bindings/clock/samsung,s2mps11.yaml
-F:	Documentation/devicetree/bindings/mfd/samsung,s2m*.yaml
+F:	Documentation/devicetree/bindings/mfd/samsung,s2*.yaml
 F:	Documentation/devicetree/bindings/mfd/samsung,s5m*.yaml
 F:	Documentation/devicetree/bindings/regulator/samsung,s2m*.yaml
 F:	Documentation/devicetree/bindings/regulator/samsung,s5m*.yaml
Signature · 1 line
2.39.2
#2 lore raw

PATCH v6 2/3 mfd: sec-core: add s2dos05 support

In reply to Dzmitry Sankouski

S2DOS05 is a panel/touchscreen PMIC, often found in Samsung phones. We define regulator sub-device for which driver will be added in subsequent patch. The device also has ADC for power and current measurements.

---
Changes in v5:
- fix commit description: S2DOS05 in capital letters
- fix commit description: only 1 sub device will be added in subsequent patches.

---
 drivers/mfd/sec-core.c           | 11 +++++++++++
 include/linux/mfd/samsung/core.h |  1 +
 2 files changed, 12 insertions(+)
drivers/mfd/sec-core.c +11 -0
index a6b0d7300b2d..cdfe738e1d76 100644
@@ -34,6 +34,10 @@ static const struct mfd_cell s5m8767_devs[] = {
 	},
 };
 
+static const struct mfd_cell s2dos05_devs[] = {
+	{ .name = "s2dos05-regulator", },
+};
+
 static const struct mfd_cell s2mps11_devs[] = {
 	{ .name = "s2mps11-regulator", },
 	{ .name = "s2mps14-rtc", },
@@ -83,6 +87,9 @@ static const struct of_device_id sec_dt_match[] = {
 	{
 		.compatible = "samsung,s5m8767-pmic",
 		.data = (void *)S5M8767X,
+	}, {
+		.compatible = "samsung,s2dos05",
+		.data = (void *)S2DOS05,
 	}, {
 		.compatible = "samsung,s2mps11-pmic",
 		.data = (void *)S2MPS11X,
@@ -339,6 +346,10 @@ static int sec_pmic_probe(struct i2c_client *i2c)
 		sec_devs = s5m8767_devs;
 		num_sec_devs = ARRAY_SIZE(s5m8767_devs);
 		break;
+	case S2DOS05:
+		sec_devs = s2dos05_devs;
+		num_sec_devs = ARRAY_SIZE(s2dos05_devs);
+		break;
 	case S2MPA01:
 		sec_devs = s2mpa01_devs;
 		num_sec_devs = ARRAY_SIZE(s2mpa01_devs);
include/linux/mfd/samsung/core.h +1 -0
index a212b9f72bc9..750274d41fc0 100644
@@ -37,6 +37,7 @@ struct gpio_desc;
 
 enum sec_device_type {
 	S5M8767X,
+	S2DOS05,
 	S2MPA01,
 	S2MPS11X,
 	S2MPS13X,
Signature · 1 line
2.39.2
#3 lore raw

PATCH v6 3/3 regulator: add s2dos05 regulator support

In reply to Dzmitry Sankouski

S2DOS05 has 1 buck and 4 LDO regulators, used for powering panel/touchscreen.

---
Changes in v6:
- run sparse and smatch
- initialize ret variable

Changes in v5:
- fix Kconfig and module description to be the same
- make regulators const
- code refactoring
- replace s2m* pattern on s2* to include s2dos05

Changes in v4:
- remove excessive linux/module.h import
- use generic regulator helpers
- use of_match
- use devm_* for mem allocations
- use // style comment
- drop all junk Samsung code
- adjust to depend on sec-core

---
 MAINTAINERS                           |   2 +-
 drivers/regulator/Kconfig             |   8 +++++
 drivers/regulator/Makefile            |   1 +
 drivers/regulator/s2dos05-regulator.c | 176 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
 include/linux/regulator/s2dos05.h     |  73 +++++++++++++++++++++++++++++++++++++++
 5 files changed, 259 insertions(+), 1 deletion(-)
MAINTAINERS +1 -1
index ae6564d98caa..ae9c62ff3027 100644
@@ -20481,7 +20481,7 @@ F:	Documentation/devicetree/bindings/regulator/samsung,s2m*.yaml
 F:	Documentation/devicetree/bindings/regulator/samsung,s5m*.yaml
 F:	drivers/clk/clk-s2mps11.c
 F:	drivers/mfd/sec*.c
-F:	drivers/regulator/s2m*.c
+F:	drivers/regulator/s2*.c
 F:	drivers/regulator/s5m*.c
 F:	drivers/rtc/rtc-s5m.c
 F:	include/linux/mfd/samsung/
drivers/regulator/Kconfig +8 -0
index 39297f7d8177..249933d6388d 100644
@@ -1322,6 +1322,14 @@ config REGULATOR_RTQ2208
 	  and two ldos. It features wide output voltage range from 0.4V to 2.05V
 	  and the capability to configure the corresponding power stages.
 
+config REGULATOR_S2DOS05
+	tristate "Samsung S2DOS05 voltage regulator"
+	depends on MFD_SEC_CORE || COMPILE_TEST
+	help
+	  This driver provides support for the voltage regulators of the S2DOS05.
+	  The S2DOS05 is a companion power management IC for the smart phones.
+	  The S2DOS05 has 4 LDOs and 1 BUCK outputs.
+
 config REGULATOR_S2MPA01
 	tristate "Samsung S2MPA01 voltage regulator"
 	depends on MFD_SEC_CORE || COMPILE_TEST
drivers/regulator/Makefile +1 -0
index 3d5a803dce8a..9b69546fb3f6 100644
@@ -154,6 +154,7 @@ obj-$(CONFIG_REGULATOR_RTMV20)	+= rtmv20-regulator.o
 obj-$(CONFIG_REGULATOR_RTQ2134) += rtq2134-regulator.o
 obj-$(CONFIG_REGULATOR_RTQ6752)	+= rtq6752-regulator.o
 obj-$(CONFIG_REGULATOR_RTQ2208) += rtq2208-regulator.o
+obj-$(CONFIG_REGULATOR_S2DOS05) += s2dos05-regulator.o
 obj-$(CONFIG_REGULATOR_S2MPA01) += s2mpa01.o
 obj-$(CONFIG_REGULATOR_S2MPS11) += s2mps11.o
 obj-$(CONFIG_REGULATOR_S5M8767) += s5m8767.o
drivers/regulator/s2dos05-regulator.c new file +176 -0

176 lines not on this page · raw message

include/linux/regulator/s2dos05.h new file +73 -0

73 lines not on this page · raw message

Signature · 1 line
2.39.2
maintainer Reviewed-by on v6 3/3
#4 lore raw

Re: [PATCH v6 3/3] regulator: add s2dos05 regulator support

Quoted 2 lines · Dzmitry Sankouski

S2DOS05 has 1 buck and 4 LDO regulators, used for powering panel/touchscreen.

maintainer
#5 lore raw

Re: [PATCH v6 3/3] regulator: add s2dos05 regulator support

Quoted 5 lines · Mark Brown
Quoted 2 lines · Dzmitry Sankouski

S2DOS05 has 1 buck and 4 LDO regulators, used for powering panel/touchscreen.

I think you can merge this.

Signature · 1 line
Lee Jones [李琼斯]
maintainer
#6 lore raw

Re: [PATCH v6 3/3] regulator: add s2dos05 regulator support

Quoted 9 lines · Lee Jones
Quoted 5 lines · Mark Brown
Quoted 2 lines · Dzmitry Sankouski

S2DOS05 has 1 buck and 4 LDO regulators, used for powering panel/touchscreen.

I think you can merge this.

I didn't mean the whole set. *facepalm*

Signature · 1 line
Lee Jones [李琼斯]
maintainer
#7 lore raw
In reply to Dzmitry Sankouski
Quoted 5 lines · Dzmitry Sankouski

The S2DOS05 is a companion power management IC for the panel and touchscreen in smart phones. Provides voltage regulators and
ADC for power/current measurements.

Applied to

https://git.kernel.org/pub/scm/linux/kernel/git/broonie/regulator.git for-next

Thanks!

[1/3] dt-bindings: mfd: add samsung,s2dos05

      commit: ef9690c04f3b2deebf08f6a889fbe9032f75855d
[2/3] mfd: sec-core: add s2dos05 support
      commit: d7a5f27342a84e2999b9d1195c537832a11e85a0
[3/3] regulator: add s2dos05 regulator support
      commit: 2ba4dbb7b763df343df7741fca1bfda15fd1e0cb

All being well this means that it will be integrated into the linux-next tree (usually sometime in the next 24 hours) and sent to Linus during the next merge window (or sooner if it is a bug fix), however if problems are discovered then the patch may be dropped or reverted.

You may get further e-mails resulting from automated or manual testing and review of the tree, please engage with people reporting problems and send followup patches addressing any issues that are reported if needed.

If any updates are required or you are submitting further changes they should be sent as incremental updates against current git, existing patches will not be replaced.

Please add any relevant lists and maintainers to the CCs when replying to this mail.

Thanks,
Mark