Skip to contentSkip to conversation

This is continued work on Samsung S9(SM-9600) starqltechn

PATCH Superseded Dzmitry Sankouski 3 participants 10 messages Oct 18, 2023 – Oct 29, 2023

Subsystems (5)

v1 of 17 Superseded Latest is v17 →

lore
Share & tools
lore
#0 lore raw

cover This is continued work on Samsung S9(SM-9600) starqltechn

- Samsung s2dos05 pmic driver added
- touchscreen support
- usb 2.0 support
- some cleanup

Dzmitry Sankouski (6):
dt-bindings: regulator: add Samsung s2dos05 pmic
regulator: s2dos05: add Samsung s2dos05 driver
arm64: dts: qcom: starqltechn: remove wifi
arm64: dts: qcom: starqltechn: enable more features
arm64: dts: qcom: starqltechn: disable crypto
arm64: dts: qcom: starqltechn: add supply to framebuffer

 .../bindings/regulator/samsung,s2dos05.yaml   |  89 +++
 .../dts/qcom/sdm845-samsung-starqltechn.dts   | 205 +++++-
 drivers/regulator/Kconfig                     |   8 +
 drivers/regulator/Makefile                    |   1 +
 drivers/regulator/s2dos05.c                   | 601 ++++++++++++++++++
 include/linux/regulator/s2dos05.h             | 173 +++++
 6 files changed, 1067 insertions(+), 10 deletions(-)
 create mode 100644 Documentation/devicetree/bindings/regulator/samsung,s2dos05.yaml
 create mode 100644 drivers/regulator/s2dos05.c
 create mode 100644 include/linux/regulator/s2dos05.h
Signature · 1 line
2.39.2
#1 lore raw

PATCH 1/6 dt-bindings: regulator: add Samsung s2dos05 pmic

Add binding for the s2dos05 pmic found in the Samsung S9.

---

 .../bindings/regulator/samsung,s2dos05.yaml   | 89 +++++++++++++++++++
 1 file changed, 89 insertions(+)
 create mode 100644 Documentation/devicetree/bindings/regulator/samsung,s2dos05.yaml
Documentation/devicetree/bindings/regulator/samsung,s2dos05.yaml new file +89 -0
new file mode 100644
index 000000000000..b53d9f5a7d38
@@ -0,0 +1,89 @@
+# SPDX-License-Identifier: (GPL-2.0 OR BSD-2-Clause)
+%YAML 1.2
+---
+$id: http://devicetree.org/schemas/regulator/samsung,s2dos05.yaml#
+$schema: http://devicetree.org/meta-schemas/core.yaml#
+
+title: Samsung s2dos05 regulator
+
+maintainers:
+  - Dzmitry Sankouski <[email protected]>
+
+description: |
+  The S2DOS05 is a companion power management IC for the smart phones.
+  Has 4 LDO and 1 BUCK regulators, and has capability to measure
+  current and power. Can detect short circuit on outputs.
+
+properties:
+  compatible:
+    const: samsung,s2dos05pmic
+  reg:
+    maxItems: 1
+
+  regulators:
+    type: object
+    description: List of regulators and its properties
+
+    patternProperties:
+      "^s2dos05-buck1|s2dos05-ldo[1-4]$":
+        type: object
+        $ref: "regulator.yaml#"
+        unevaluatedProperties: false
+
+    additionalProperties: false
+
+required:
+  - compatible
+  - reg
+  - regulators
+
+additionalProperties: false
+
+examples:
+  - |
+    regulator@60 {
+    	compatible = "samsung,s2dos05pmic";
+    	reg = <0x60>;
+    	pinctrl-names = "default";
+    	pinctrl-0 = <&s2dos05_irq>;
+    	s2dos05,s2dos05_int = <&tlmm 0x31 0x0>;
+
+    	regulators {
+    		s2dos05_ldo1: s2dos05-ldo1 {
+    			regulator-name = "s2dos05-ldo1";
+    			regulator-min-microvolt = <0x16e360>;
+    			regulator-max-microvolt = <0x1e8480>;
+    			regulator-active-discharge = <0x1>;
+    		};
+
+    		s2dos05_ldo2: s2dos05-ldo2 {
+    			regulator-name = "s2dos05-ldo2";
+    			regulator-min-microvolt = <0x1b7740>;
+    			regulator-max-microvolt = <0x1b7740>;
+    			regulator-active-discharge = <0x1>;
+    			regulator-boot-on;
+    		};
+
+    		s2dos05_ldo3: s2dos05-ldo3 {
+    			regulator-name = "s2dos05-ldo3";
+    			regulator-min-microvolt = <0x2dc6c0>;
+    			regulator-max-microvolt = <0x2dc6c0>;
+    			regulator-active-discharge = <0x1>;
+    			regulator-boot-on;
+    		};
+
+    		s2dos05_ldo4: s2dos05-ldo4 {
+    			regulator-name = "s2dos05-ldo4";
+    			regulator-min-microvolt = <0x2932e0>;
+    			regulator-max-microvolt = <0x399a18>;
+    			regulator-active-discharge = <0x1>;
+    		};
+
+    		s2dos05_buck1: s2dos05-buck1 {
+    			regulator-name = "s2dos05-buck1";
+    			regulator-min-microvolt = <0xcf850>;
+    			regulator-max-microvolt = <0x200b20>;
+    			regulator-active-discharge = <0x1>;
+    		};
+    	};
+    };
Signature · 1 line
2.39.2
#2 lore raw

Re: [PATCH 1/6] dt-bindings: regulator: add Samsung s2dos05 pmic

Quoted 3 lines · Dzmitry Sankouski

Add binding for the s2dos05 pmic found in the Samsung S9.

Please use scripts/get_maintainers.pl to get a list of necessary people and lists to CC. It might happen, that command when run on an older kernel, gives you outdated entries. Therefore please be sure you base your patches on recent Linux kernel.

You missed at least devicetree list (maybe more), so this won't be tested by automated tooling. Performing review on untested code might be a waste of time, thus I will skip this patch entirely till you follow the process allowing the patch to be tested.

Please kindly resend and include all necessary To/Cc entries.

Best regards,
Krzysztof

#3 lore raw

PATCH 2/6 regulator: s2dos05: add Samsung s2dos05 driver

In reply to Dzmitry Sankouski

Add driver for s2dos05 regulator.
The s2dos05 is a companion power management IC for the smart phones, and provides LDOs[1~4] and BUCKs[1].

---

 drivers/regulator/Kconfig         |   8 +
 drivers/regulator/Makefile        |   1 +
 drivers/regulator/s2dos05.c       | 601 ++++++++++++++++++++++++++++++
 include/linux/regulator/s2dos05.h | 173 +++++++++
 4 files changed, 783 insertions(+)
 create mode 100644 drivers/regulator/s2dos05.c
 create mode 100644 include/linux/regulator/s2dos05.h
drivers/regulator/Kconfig +8 -0
index 823f8e6e4801..ec18439edc6a 100644
@@ -1232,6 +1232,14 @@ config REGULATOR_RTQ6752
 	  synchronous boost converters for PAVDD, and one synchronous NAVDD
 	  buck-boost. This device is suitable for automotive TFT-LCD panel.
 
+config REGULATOR_S2DOS05
+	tristate "SLSI S2DOS05 regulator"
+	depends on I2C
+	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 handles LDO and BUCK control
+
 config REGULATOR_S2MPA01
 	tristate "Samsung S2MPA01 voltage regulator"
 	depends on MFD_SEC_CORE || COMPILE_TEST
drivers/regulator/Makefile +1 -0
index 15e0d614ff66..b59f729b7af7 100644
@@ -145,6 +145,7 @@ obj-$(CONFIG_REGULATOR_RT6245)	+= rt6245-regulator.o
 obj-$(CONFIG_REGULATOR_RTMV20)	+= rtmv20-regulator.o
 obj-$(CONFIG_REGULATOR_RTQ2134) += rtq2134-regulator.o
 obj-$(CONFIG_REGULATOR_RTQ6752)	+= rtq6752-regulator.o
+obj-$(CONFIG_REGULATOR_S2DOS05) += s2dos05.o
 obj-$(CONFIG_REGULATOR_S2MPA01) += s2mpa01.o
 obj-$(CONFIG_REGULATOR_S2MPS11) += s2mps11.o
 obj-$(CONFIG_REGULATOR_S5M8767) += s5m8767.o
drivers/regulator/s2dos05.c new file +601 -0

601 lines not on this page · raw message

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

173 lines not on this page · raw message

Signature · 1 line
2.39.2
#4 lore raw

PATCH 3/6 arm64: dts: qcom: starqltechn: remove wifi

In reply to Dzmitry Sankouski

Starqltechn has broadcom chip for wifi, so sdm845 wifi part can be disabled.

---

 arch/arm64/boot/dts/qcom/sdm845-samsung-starqltechn.dts | 8 --------
 1 file changed, 8 deletions(-)
arch/arm64/boot/dts/qcom/sdm845-samsung-starqltechn.dts +0 -8
index 7c2457948a32..e9fa230d11ec 100644
@@ -413,14 +413,6 @@ &usb_1_qmpphy {
 	status = "okay";
 };
 
-&wifi {
-	vdd-0.8-cx-mx-supply = <&vreg_l5a_0p8>;
-	vdd-1.8-xo-supply = <&vreg_l7a_1p8>;
-	vdd-1.3-rfa-supply = <&vreg_l17a_1p3>;
-	vdd-3.3-ch0-supply = <&vreg_l25a_3p3>;
-	status = "okay";
-};
-
 &tlmm {
 	gpio-reserved-ranges = <0 4>, <27 4>, <81 4>, <85 4>;
 
Signature · 1 line
2.39.2
#5 lore raw

PATCH 4/6 arm64: dts: qcom: starqltechn: enable more features

In reply to Dzmitry Sankouski

- enable usb 2.0
- enable debug uart (uart9)
- enable touchscreen
- enable ipa so that we can bring up mobile data

---

 .../dts/qcom/sdm845-samsung-starqltechn.dts   | 189 +++++++++++++++++-
 1 file changed, 187 insertions(+), 2 deletions(-)
arch/arm64/boot/dts/qcom/sdm845-samsung-starqltechn.dts +187 -2
index e9fa230d11ec..3bc9ae5f6213 100644
@@ -11,11 +11,17 @@
 #include <dt-bindings/regulator/qcom,rpmh-regulator.h>
 #include "sdm845.dtsi"
 
+/delete-node/ &rmtfs_mem;
+
 / {
 	chassis-type = "handset";
 	model = "Samsung Galaxy S9 SM-G9600";
 	compatible = "samsung,starqltechn", "qcom,sdm845";
 
+	aliases {
+		serial0 = &uart9;
+	};
+
 	chosen {
 		#address-cells = <2>;
 		#size-cells = <2>;
@@ -63,6 +69,96 @@ memory@a1300000 {
 			ftrace-size = <0x40000>;
 			pmsg-size = <0x40000>;
 		};
+
+		/* The rmtfs_mem needs to be guarded due to "XPU limitations"
+		 * it is otherwise possible for an allocation adjacent to the
+		 * rmtfs_mem region to trigger an XPU violation, causing a crash.
+		 */
+		rmtfs_lower_guard: memory@fde00000 {
+			no-map;
+			reg = <0 0xfde00000 0 0x1000>;
+		};
+
+		rmtfs_mem: rmtfs-mem@fde01000 {
+			compatible = "qcom,rmtfs-mem";
+			reg = <0 0xfde01000 0 0x200000>;
+			no-map;
+
+			qcom,client-id = <1>;
+			qcom,vmid = <15>;
+		};
+
+		rmtfs_upper_guard: rmtfs-upper-guard@fe001000 {
+			no-map;
+			reg = <0 0xfe001000 0 0x1000>;
+		};
+
+		/*
+		 * It seems like reserving the old rmtfs_mem region is also needed to prevent
+		 * random crashes which are most likely modem related, more testing needed.
+		 */
+		removed_region: removed-region@88f00000 {
+			no-map;
+			reg = <0 0x88f00000 0 0x1c00000>;
+		};
+	};
+
+	i2c@21 {
+		compatible = "i2c-gpio";
+		sda-gpios = <&tlmm 127 0x0>;
+		scl-gpios = <&tlmm 128 0x0>;
+		#i2c-gpio,delay-us = <0x2>;
+		#address-cells = <0x1>;
+		#size-cells = <0x0>;
+		pinctrl-names = "default";
+		pinctrl-0 = <&i2c21_sda &i2c21_scl>;
+
+		regulator@60 {
+			compatible = "samsung,s2dos05";
+			reg = <0x60>;
+			pinctrl-names = "default";
+			pinctrl-0 = <&s2dos05_irq>;
+			s2dos05,s2dos05_int = <&tlmm 0x31 0x0>;
+
+			regulators {
+				s2dos05_ldo1: s2dos05-ldo1 {
+					regulator-name = "s2dos05-ldo1";
+					regulator-min-microvolt = <0x16e360>;
+					regulator-max-microvolt = <0x1e8480>;
+					regulator-active-discharge = <0x1>;
+				};
+
+				s2dos05_ldo2: s2dos05-ldo2 {
+					regulator-name = "s2dos05-ldo2";
+					regulator-min-microvolt = <0x1b7740>;
+					regulator-max-microvolt = <0x1b7740>;
+					regulator-active-discharge = <0x1>;
+					regulator-boot-on;
+				};
+
+				s2dos05_ldo3: s2dos05-ldo3 {
+					regulator-name = "s2dos05-ldo3";
+					regulator-min-microvolt = <0x2dc6c0>;
+					regulator-max-microvolt = <0x2dc6c0>;
+					regulator-active-discharge = <0x1>;
+					regulator-boot-on;
+				};
+
+				s2dos05_ldo4: s2dos05-ldo4 {
+					regulator-name = "s2dos05-ldo4";
+					regulator-min-microvolt = <0x2932e0>;
+					regulator-max-microvolt = <0x399a18>;
+					regulator-active-discharge = <0x1>;
+				};
+
+				s2dos05_buck1: s2dos05-buck1 {
+					regulator-name = "s2dos05-buck1";
+					regulator-min-microvolt = <0xcf850>;
+					regulator-max-microvolt = <0x200b20>;
+					regulator-active-discharge = <0x1>;
+				};
+			};
+		};
 	};
 };
 
@@ -130,8 +226,6 @@ vdda_pll_cc_ebi23:
 		vdda_sp_sensor:
 		vdda_ufs1_core:
 		vdda_ufs2_core:
-		vdda_usb1_ss_core:
-		vdda_usb2_ss_core:
 		vreg_l1a_0p875: ldo1 {
 			regulator-min-microvolt = <880000>;
 			regulator-max-microvolt = <880000>;
@@ -152,6 +246,7 @@ vreg_l3a_1p0: ldo3 {
 			regulator-initial-mode = <RPMH_REGULATOR_MODE_HPM>;
 		};
 
+		vdda_usb1_ss_core:
 		vdd_wcss_cx:
 		vdd_wcss_mx:
 		vdda_wcss_pll:
@@ -360,6 +455,10 @@ &qupv3_id_1 {
 	status = "okay";
 };
 
+&gpi_dma1 {
+	status = "okay";
+};
+
 &uart9 {
 	status = "okay";
 };
@@ -386,13 +485,50 @@ &sdhc_2 {
 	status = "okay";
 };
 
+&i2c11 {
+	status = "okay";
+	clock-frequency = <400000>;
+
+	touchscreen@48 {
+		compatible = "samsung,s6sy761";
+		reg = <0x48>;
+		interrupt-parent = <&tlmm>;
+		interrupts = <120 0x0>;
+		vdd-supply = <&s2dos05_ldo2>;
+		avdd-supply = <&s2dos05_ldo3>;
+
+		pinctrl-names = "default";
+		pinctrl-0 = <&touch_irq>;
+	};
+};
+
+/* Modem/wifi*/
+&mss_pil {
+	status = "okay";
+	firmware-name = "qcom/sdm845/starqltechn/mba.mbn", "qcom/sdm845/starqltechn/modem.mbn";
+};
+
+&ipa {
+	qcom,gsi-loader = "self";
+	memory-region = <&ipa_fw_mem>;
+	firmware-name = "qcom/sdm845/starqltechn/ipa_fws.mbn";
+	status = "okay";
+};
+
 &usb_1 {
 	status = "okay";
+	/*
+	 * disable USB3 clock requirement as the device only supports
+	 * USB2.
+	 */
+	qcom,select-utmi-as-pipe-clk;
 };
 
 &usb_1_dwc3 {
 	/* Until we have Type C hooked up we'll force this as peripheral. */
 	dr_mode = "peripheral";
+
+	maximum-speed = "high-speed";
 };
 
 &usb_1_hsphy {
@@ -444,4 +580,53 @@ sd_card_det_n_state: sd-card-det-n-state {
 		function = "gpio";
 		bias-pull-up;
 	};
+
+	s2dos05_irq: s2dos05_irq {
+		pinmux {
+			pins = "gpio49";
+			drive-strength = <0x2>;
+			bias-disable;
+		};
+	};
+
+	gpio_i2c21_default: gpio-i2c21-default {
+		pinmux {
+			pins = "gpio127", "gpio128";
+			function = "gpio";
+		};
+
+		i2c21_sda: i2c_sda {
+			pins = "gpio127";
+			drive-strength = <0x2>;
+			bias-disable;
+		};
+
+		i2c21_scl: i2c_scl {
+			pins = "gpio128";
+			drive-strength = <0x2>;
+			bias-disable;
+		};
+	};
+
+	touch_irq: touch-irq {
+		pins = "gpio120";
+		function = "gpio";
+		bias-disable;
+		input-enable;
+	};
+};
+
+&qup_uart9_tx {
+	drive-strength = <0x2>;
+	bias-pull-up;
+};
+
+&qup_uart9_rx {
+	drive-strength = <0x2>;
+	bias-pull-up;
+};
+
+&qup_i2c11_default {
+	drive-strength = <2>;
+	bias-disable;
 };
Signature · 1 line
2.39.2
#6 lore raw

Re: [PATCH 4/6] arm64: dts: qcom: starqltechn: enable more features

Quoted 17 lines · Dzmitry Sankouski

- enable usb 2.0
- enable debug uart (uart9)
- enable touchscreen
- enable ipa so that we can bring up mobile data

&usb_1_dwc3 {

arch/arm64/boot/dts/qcom/sdm845-samsung-starqltechn.dts +2 -0
 	/* Until we have Type C hooked up we'll force this as peripheral. */
 	dr_mode = "peripheral";
+
+	maximum-speed = "high-speed";
 };
 
 &usb_1_hsphy {

arch/arm64/boot/dts/qcom/sdm845-samsung-starqltechn.dts sd_card_det_n_state: sd-card-det-n-state { · line 584

Quoted 5 lines
arch/arm64/boot/dts/qcom/sdm845-samsung-starqltechn.dts +2 -0
@@ -444,4 +580,53 @@ sd_card_det_n_state: sd-card-det-n-state {
 		function = "gpio";
 		bias-pull-up;
 	};
+
+	s2dos05_irq: s2dos05_irq {

It does not look like you tested the DTS against bindings. Please run make dtbs_check W=1 (see Documentation/devicetree/bindings/writing-schema.rst or
https://www.linaro.org/blog/tips-and-tricks-for-validating-devicetree-sources-with-the-devicetree-schema/
for instructions).

Best regards,
Krzysztof

#7 lore raw

PATCH 5/6 arm64: dts: qcom: starqltechn: disable crypto

In reply to Dzmitry Sankouski

Disable the crypto block due to it causing an SError in qce_start() on the starqltechn, which happens upon every boot when cryptomanager tests are enabled.

Same problem is on Lenovo C630, see
commit 382e3e0eb6a8 ("arm64: dts: qcom: c630: disable crypto due to serror")

---

 arch/arm64/boot/dts/qcom/sdm845-samsung-starqltechn.dts | 5 +++++
 1 file changed, 5 insertions(+)
arch/arm64/boot/dts/qcom/sdm845-samsung-starqltechn.dts +5 -0
index 3bc9ae5f6213..58b765b4c41d 100644
@@ -502,6 +502,11 @@ touchscreen@48 {
 	};
 };
 
+&crypto {
+	/* FIXME: qce_start triggers an SError */
+	status = "disable";
+};
+
 /* Modem/wifi*/
 &mss_pil {
 	status = "okay";
Signature · 1 line
2.39.2
#8 lore raw

PATCH 6/6 arm64: dts: qcom: starqltechn: add supply to framebuffer

In reply to Dzmitry Sankouski

This prevents framebuffer from shutting down.

---

 arch/arm64/boot/dts/qcom/sdm845-samsung-starqltechn.dts | 3 +++
 1 file changed, 3 insertions(+)
arch/arm64/boot/dts/qcom/sdm845-samsung-starqltechn.dts +3 -0
index 58b765b4c41d..f6e3004fc445 100644
@@ -33,6 +33,9 @@ framebuffer: framebuffer@9d400000 {
 			height = <2960>;
 			stride = <(1440 * 4)>;
 			format = "a8r8g8b8";
+			vci-supply = <&s2dos05_ldo4>;
+			vddr-supply = <&s2dos05_buck1>;
+			vdd3-supply = <&s2dos05_ldo1>;
 		};
 	};
 
Signature · 1 line
2.39.2
#9 lore raw
In reply to Dzmitry Sankouski

Hi!

Quoted 4 lines

- Samsung s2dos05 pmic driver added
- touchscreen support
- usb 2.0 support
- some cleanup

get-maintainer.pl should tell you who to cc.

Please cc: phone-devel with phone stuff.

Best regards,
Pavel

Signature · 2 lines
DENX Software Engineering GmbH,        Managing Director: Erika Unter
HRB 165235 Munich, Office: Kirchenstr.5, D-82194 Groebenzell, Germany