Skip to contentSkip to conversation

Add pinctrl driver for Qualcomm Halliday (SXR2250P)

PATCH Superseded Stanislav Aleksandrov 3 participants 8 messages Nov 16 – Nov 24

Subsystems (6)

v2 of 4 Superseded Latest is v4 →

lore
Share & tools
lore
#0 lore raw

v2 cover Add pinctrl driver for Qualcomm Halliday (SXR2250P)

This series adds the devicetree bindings and pinctrl/GPIO driver for the Top-Level Mode Multiplexer (TLMM) on the Qualcomm Halliday (SXR2250P / Snapdragon XR2+ Gen 2) SoC.

This is part of the initial bring-up effort for Qualcomm Halliday and Samsung Galaxy XR.

This work was made together with Claude, ChatGPT and Gemini. Reviewed and tested on my Galaxy XR.

---
Changes in v2:
- dt-bindings: Add the tlmm label that gpio-ranges refers to in the
example (Bartosz)
- Link to v1: https://patch.msgid.link/[email protected]

---
Stanislav Aleksandrov (2):
dt-bindings: pinctrl: document the Halliday Top Level Mode Multiplexer
pinctrl: qcom: Add Halliday pinctrl driver

 .../bindings/pinctrl/qcom,halliday-tlmm.yaml       |  146 ++
 drivers/pinctrl/qcom/Kconfig.msm                   |   10 +
 drivers/pinctrl/qcom/Makefile                      |    1 +
 drivers/pinctrl/qcom/pinctrl-halliday.c            | 1825 ++++++++++++++++++++
 4 files changed, 1982 insertions(+)

---
base-commit: 6628e7d4c6b25c8d18f1345e3a20d21829aae7e4
change-id: 20261108-halliday-tlmm-f250374110e0

Best regards,

Signature · 1 line
Stanislav Aleksandrov <[email protected]>
#1 lore raw

PATCH v2 1/2 dt-bindings: pinctrl: document the Halliday Top Level Mode Multiplexer

Document the Top Level Mode Multiplexer on the Qualcomm Halliday SoC (SXR2250P).

---
 .../bindings/pinctrl/qcom,halliday-tlmm.yaml       | 146 +++++++++++++++++++++
 1 file changed, 146 insertions(+)
Documentation/devicetree/bindings/pinctrl/qcom,halliday-tlmm.yaml new file +146 -0
new file mode 100644
index 000000000000..58aa6d10bce1
@@ -0,0 +1,146 @@
+# SPDX-License-Identifier: (GPL-2.0-only OR BSD-2-Clause)
+%YAML 1.2
+---
+$id: http://devicetree.org/schemas/pinctrl/qcom,halliday-tlmm.yaml#
+$schema: http://devicetree.org/meta-schemas/core.yaml#
+
+title: Qualcomm Technologies, Inc. Halliday TLMM block
+
+maintainers:
+  - Stanislav Aleksandrov <[email protected]>
+
+description:
+  Top Level Mode Multiplexer pin controller in Qualcomm Halliday SoC.
+
+allOf:
+  - $ref: /schemas/pinctrl/qcom,tlmm-common.yaml#
+
+properties:
+  compatible:
+    const: qcom,halliday-tlmm
+
+  reg:
+    maxItems: 1
+
+  interrupts:
+    maxItems: 1
+
+  gpio-reserved-ranges:
+    minItems: 1
+    maxItems: 112
+
+  gpio-line-names:
+    maxItems: 224
+
+patternProperties:
+  "-state$":
+    oneOf:
+      - $ref: "#/$defs/qcom-halliday-tlmm-state"
+      - patternProperties:
+          "-pins$":
+            $ref: "#/$defs/qcom-halliday-tlmm-state"
+        additionalProperties: false
+
+$defs:
+  qcom-halliday-tlmm-state:
+    type: object
+    description:
+      Pinctrl node's client devices use subnodes for desired pin configuration.
+      Client device subnodes use below standard properties.
+    $ref: qcom,tlmm-common.yaml#/$defs/qcom-tlmm-state
+    unevaluatedProperties: false
+
+    properties:
+      pins:
+        description:
+          List of gpio pins affected by the properties specified in this
+          subnode.
+        items:
+          oneOf:
+            - pattern: "^gpio([0-9]|[1-9][0-9]|1[0-9][0-9]|2[01][0-9]|22[0-3])$"
+            - enum: [ ufs_reset, sdc2_clk, sdc2_cmd, sdc2_data ]
+        minItems: 1
+        maxItems: 36
+
+      function:
+        description:
+          Specify the alternative function to be configured for the specified
+          pins.
+        enum: [ atest_char, atest_usb, audio_ext_mclk0, audio_ext_mclk1,
+                audio_ref_clk, cam_mclk, cci_async_in, cci_i2c_scl,
+                cci_i2c_sda, cci_timer, cmu_rng, dbg_out_clk,
+                ddr_bist_complete, ddr_bist_fail, ddr_bist_start,
+                ddr_bist_stop, ddr_pxi0, ddr_pxi1, ddr_pxi2, ddr_pxi3, dp0_hot,
+                edp0_hot, edp0_lcd_self, edp1_dpu0_lcd, edp1_dpu1_lcd,
+                edp1_hot, gcc_gp1, gcc_gp10, gcc_gp11, gcc_gp2, gcc_gp3,
+                gcc_gp4, gcc_gp5, gcc_gp6, gcc_gp7, gcc_gp8, gcc_gp9, gpio,
+                i2s0_data0, i2s0_data1, i2s0_sck, i2s0_ws, i2s2_data0,
+                i2s2_data1, i2s2_sck, i2s2_ws, ibi_i3c, jitter_bist,
+                mdp0_vsync, mdp0_vsync0_out, mdp0_vsync1_out, mdp0_vsync2_out,
+                mdp0_vsync3_out, mdp0_vsync4_out, mdp0_vsync5_out,
+                mdp0_vsync6_out, mdp0_vsync7_out, mdp0_vsync8_out, mdp1_vsync,
+                mdp1_vsync0_out, mdp1_vsync1_out, mdp1_vsync2_out,
+                mdp1_vsync3_out, mdp1_vsync4_out, mdp1_vsync5_out,
+                mdp1_vsync6_out, mdp1_vsync7_out, mdp1_vsync8_out,
+                pcie0_clk_req_n, pcie1_clk_req_n, pcie2_clk_req_n, phase_flag,
+                pll_bist_sync, pll_clk_aux, prng_rosc0, prng_rosc1, prng_rosc2,
+                prng_rosc3, pwm_0, pwm_1, pwm_10, pwm_11, pwm_12, pwm_13,
+                pwm_14, pwm_15, pwm_16, pwm_17, pwm_18, pwm_19, pwm_2, pwm_3,
+                pwm_4, pwm_5, pwm_6, pwm_7, pwm_8, pwm_9, qdss_cti, qdss_gpio,
+                qup0_se0, qup0_se1, qup0_se2, qup0_se3, qup0_se4,
+                qup0_se4_l0_mira, qup0_se4_l0_mirb, qup0_se4_l1_mira,
+                qup0_se4_l1_mirb, qup0_se4_l2_mira, qup0_se4_l2_mirb,
+                qup0_se4_l3_mira, qup0_se4_l3_mirb, qup0_se5, qup0_se6,
+                qup1_se0, qup1_se0_l3_mira, qup1_se0_l3_mirb, qup1_se1,
+                qup1_se1_l3_mira, qup1_se1_l3_mirb, qup1_se2, qup1_se2_l3_mira,
+                qup1_se2_l3_mirb, qup1_se3, qup1_se3_l3_mira, qup1_se3_l3_mirb,
+                qup1_se4, qup1_se5, qup1_se6, qup1_se6_l0_mira,
+                qup1_se6_l0_mirb, qup1_se6_l1_mira, qup1_se6_l1_mirb,
+                sd_write_protect, sdcc5_vdd2_on, tb_trig_sdc2, tgu_ch0_trigout,
+                tgu_ch1_trigout, tgu_ch2_trigout, tgu_ch3_trigout, tmess_prng0,
+                tmess_prng1, tmess_prng2, tmess_prng3, tsense_pwm1,
+                tsense_pwm2, usb0_phy_ps, usb2phy_ac_en,
+                vsense_trigger_mirnat ]
+
+    required:
+      - pins
+
+required:
+  - compatible
+  - reg
+
+unevaluatedProperties: false
+
+examples:
+  - |
+    #include <dt-bindings/interrupt-controller/arm-gic.h>
+    tlmm: pinctrl@f100000 {
+        compatible = "qcom,halliday-tlmm";
+        reg = <0x0f100000 0x300000>;
+        gpio-controller;
+        #gpio-cells = <2>;
+        gpio-ranges = <&tlmm 0 0 225>;
+        interrupt-controller;
+        #interrupt-cells = <2>;
+        interrupts = <GIC_SPI 208 IRQ_TYPE_LEVEL_HIGH>;
+
+        gpio-wo-state {
+            pins = "gpio1";
+            function = "gpio";
+        };
+
+        i2c-w-state {
+            scl-pins {
+                pins = "gpio58";
+                function = "qup1_se0";
+                bias-pull-up;
+            };
+
+            sda-pins {
+                pins = "gpio57";
+                function = "qup1_se0";
+                bias-pull-up;
+            };
+        };
+    };
+...
Signature · 1 line
2.55.0
Reviewed-by on v2 1/2
#2 lore raw

Re: [PATCH v2 1/2] dt-bindings: pinctrl: document the Halliday Top Level Mode Multiplexer

Quoted 7 lines · Stanislav Aleksandrov

Document the Top Level Mode Multiplexer on the Qualcomm Halliday SoC (SXR2250P).

---
 .../bindings/pinctrl/qcom,halliday-tlmm.yaml       | 146 +++++++++++++++++++++
 1 file changed, 146 insertions(+)

Best regards,
Krzysztof

#3 lore raw

PATCH v2 2/2 pinctrl: qcom: Add Halliday pinctrl driver

In reply to Stanislav Aleksandrov

Add the pinctrl driver for the TLMM block found in the Qualcomm Halliday
SoC: 224 GPIOs with their functions and PDC wakeup interrupts, the UFS reset pin and the SDC2 pins.

The tables are based on Qualcomm's downstream pinctrl-anorak driver.

---
 drivers/pinctrl/qcom/Kconfig.msm        |   10 +
 drivers/pinctrl/qcom/Makefile           |    1 +
 drivers/pinctrl/qcom/pinctrl-halliday.c | 1825 +++++++++++++++++++++++++++++++
 3 files changed, 1836 insertions(+)
drivers/pinctrl/qcom/Kconfig.msm +10 -0
index e45c701db627..2d470783bfe1 100644
@@ -39,6 +39,16 @@ config PINCTRL_GLYMUR
 	  Say Y here to compile statically, or M here to compile it as a module.
 	  If unsure, say N.
 
+config PINCTRL_HALLIDAY
+	tristate "Qualcomm Halliday pin controller driver"
+	depends on ARM64 || COMPILE_TEST
+	default ARCH_QCOM
+	help
+	  This is the pinctrl, pinmux, pinconf and gpiolib driver for the
+	  Qualcomm Technologies Inc TLMM block found on the Qualcomm
+	  Technologies Inc Halliday platform
+	  (SXR2250P / Snapdragon XR2+ Gen 2).
+
 config PINCTRL_HAWI
 	tristate "Qualcomm Hawi pin controller driver"
 	depends on ARM64 || COMPILE_TEST
drivers/pinctrl/qcom/Makefile +1 -0
index a3daca77a448..c2b3cb284faa 100644
@@ -5,6 +5,7 @@ obj-$(CONFIG_PINCTRL_APQ8064)	+= pinctrl-apq8064.o
 obj-$(CONFIG_PINCTRL_APQ8084)	+= pinctrl-apq8084.o
 obj-$(CONFIG_PINCTRL_ELIZA)	+= pinctrl-eliza.o
 obj-$(CONFIG_PINCTRL_GLYMUR)	+= pinctrl-glymur.o
+obj-$(CONFIG_PINCTRL_HALLIDAY)	+= pinctrl-halliday.o
 obj-$(CONFIG_PINCTRL_HAWI)	+= pinctrl-hawi.o
 obj-$(CONFIG_PINCTRL_HAWI_LPASS_LPI) += pinctrl-hawi-lpass-lpi.o
 obj-$(CONFIG_PINCTRL_IPQ4019)	+= pinctrl-ipq4019.o
drivers/pinctrl/qcom/pinctrl-halliday.c new file +1825 -0

1,825 lines not on this page · raw message

Signature · 1 line
2.55.0
#4 lore raw

Re: [PATCH v2 2/2] pinctrl: qcom: Add Halliday pinctrl driver

Quoted 8 lines · Stanislav Aleksandrov

Add the pinctrl driver for the TLMM block found in the Qualcomm Halliday
SoC: 224 GPIOs with their functions and PDC wakeup interrupts, the UFS reset pin and the SDC2 pins.

The tables are based on Qualcomm's downstream pinctrl-anorak driver.

---

...

Quoted 9 lines
drivers/pinctrl/qcom/pinctrl-halliday.c new file +9 -0
+
+static const struct msm_gpio_wakeirq_map halliday_pdc_map[] = {
+	{ 18, 99 },  { 31, 120 }, { 37, 101 }, { 40, 103 }, { 41, 104 },
+	{ 43, 106 }, { 44, 107 }, { 45, 92 },  { 46, 83 },  { 47, 86 },
+	{ 53, 111 }, { 57, 121 }, { 60, 56 },  { 61, 108 }, { 62, 109 },
+	{ 66, 110 }, { 68, 57 },  { 72, 112 }, { 74, 43 },  { 78, 114 },
+	{ 84, 67 },  { 86, 66 },  { 87, 100 }, { 91, 102 }, { 94, 93 },
+	{ 98, 123 }, { 100, 44 }, { 101, 97 }, { 103, 75 }, { 104, 52 },
+	{ 106, 48 }, { 110, 53 }, { 111, 76 }, { 112, 49 }, { 113, 50 },

drivers/pinctrl/qcom/pinctrl-halliday.c line 1778

Quoted 10 lines
drivers/pinctrl/qcom/pinctrl-halliday.c new file +10 -0
+	{ 115, 54 }, { 118, 58 }, { 119, 77 }, { 122, 62 }, { 123, 63 },
+	{ 129, 61 }, { 133, 65 }, { 137, 69 }, { 139, 70 }, { 142, 71 },
+	{ 145, 74 }, { 146, 45 }, { 147, 78 }, { 148, 60 }, { 150, 119 },
+	{ 152, 85 }, { 153, 79 }, { 154, 80 }, { 155, 81 }, { 157, 84 },
+	{ 163, 88 }, { 164, 89 }, { 165, 73 }, { 166, 90 }, { 167, 91 },
+	{ 169, 82 }, { 170, 95 }, { 171, 98 }, { 172, 47 }, { 175, 46 },
+	{ 186, 129 }, { 189, 131 }, { 194, 116 }, { 196, 117 }, { 199, 113 },
+	{ 201, 128 }, { 207, 115 }, { 208, 132 }, { 210, 135 }, { 212, 136 },
+	{ 215, 137 },
+};

Can you verify the pdc map against the interrupt map? It looks incomplete to me, there should be more wake GPIOs. Unless you have a reason to not include all of them?

drivers/pinctrl/qcom/pinctrl-halliday.c line 1790

Quoted 12 lines
drivers/pinctrl/qcom/pinctrl-halliday.c new file +12 -0
+
+static const struct msm_pinctrl_soc_data halliday_tlmm = {
+	.pins = halliday_pins,
+	.npins = ARRAY_SIZE(halliday_pins),
+	.functions = halliday_functions,
+	.nfunctions = ARRAY_SIZE(halliday_functions),
+	.groups = halliday_groups,
+	.ngroups = ARRAY_SIZE(halliday_groups),
+	.ngpios = 225,
+	.wakeirq_map = halliday_pdc_map,
+	.nwakeirq_map = ARRAY_SIZE(halliday_pdc_map),
+	.egpio_func = 9,

There's no egpio function. I assume you copied it from sm8550 but I think you should do something similar to commit a326b0523fc1 ("pinctrl:
qcom: sa8775p: Enable egpio function") here.

Thanks,
Bartosz

#5 lore raw

Re: [PATCH v2 2/2] pinctrl: qcom: Add Halliday pinctrl driver

Quoted 3 lines · Bartosz Golaszewski

Can you verify the pdc map against the interrupt map? It looks incomplete to me, there should be more wake GPIOs. Unless you have a reason to not include all of them?

I do not have the interrupt map. The PDC map is from the pinctrl-anorak driver in Samsung's kernel source. There are 93 GPIOs with a wakeup enable bit, but its PDC map contains only 76.

I did a test: set an interrupt handler on every unused PDC pin on my headset and then I toggled each GPIO to see which pin fires.

1. Out of existing 76 entries 42 PDC pins got triggered. 26 are used by devices on the headset and 8 do not change their level, so these 34 are not tested.

2. 17 missing GPIOs: only 14 give a result:

     GPIO 42 -> PDC 105, 48 -> 87, 63 -> 122, 80 -> 42, 97 -> 96,
     105 -> 55, 143 -> 72, 151 -> 118, 168 -> 94, 205 -> 130,
     218 -> 124, 219 -> 68, 221 -> 133, 223 -> 134

I am not sure about 151 and 168, their lines are not quiet on the headset. GPIOs 114, 125 and 162 do not change their level.

I think it is not a good idea to add these pins without documentation. If someone can confirm these pins are correct then I will add them in the next version.

Quoted 3 lines

There's no egpio function. I assume you copied it from sm8550 but I think you should do something similar to commit a326b0523fc1 ("pinctrl:
qcom: sa8775p: Enable egpio function") here.

I'll add this in v3. EGPIO_PRESENT is set on GPIOs 185 to 223.

Best regards,
Stanislav

#6 lore raw

Re: [PATCH v2 2/2] pinctrl: qcom: Add Halliday pinctrl driver

Quoted 22 lines · Stanislav Aleksandrov
Quoted 3 lines · Bartosz Golaszewski

Can you verify the pdc map against the interrupt map? It looks incomplete to me, there should be more wake GPIOs. Unless you have a reason to not include all of them?

I do not have the interrupt map. The PDC map is from the pinctrl-anorak driver in Samsung's kernel source. There are 93 GPIOs with a wakeup enable bit, but its PDC map contains only 76.

I did a test: set an interrupt handler on every unused PDC pin on my headset and then I toggled each GPIO to see which pin fires.

1. Out of existing 76 entries 42 PDC pins got triggered. 26 are used by devices on the headset and 8 do not change their level, so these 34 are not tested.

2. 17 missing GPIOs: only 14 give a result:

     GPIO 42 -> PDC 105, 48 -> 87, 63 -> 122, 80 -> 42, 97 -> 96,
     105 -> 55, 143 -> 72, 151 -> 118, 168 -> 94, 205 -> 130,
     218 -> 124, 219 -> 68, 221 -> 133, 223 -> 134
Quoted 7 lines

I am not sure about 151 and 168, their lines are not quiet on the headset. GPIOs 114, 125 and 162 do not change their level.

I think it is not a good idea to add these pins without documentation. If someone can confirm these pins are correct then I will add them in the next version.

Here, use this:

static const struct msm_gpio_wakeirq_map halliday_pdc_map[] = {
	{ 18, 99 },   { 31, 120 },  { 37, 101 },  { 40, 103 },  { 41, 104 },
	{ 42, 105 },  { 43, 106 },  { 44, 107 },  { 45, 92 },   { 46, 83 },
	{ 47, 86 },   { 48, 87 },   { 53, 111 },  { 57, 121 },  { 60, 56 },
	{ 61, 108 },  { 62, 109 },  { 63, 122 },  { 66, 110 },  { 68, 57 },
	{ 72, 112 },  { 74, 43 },   { 78, 114 },  { 80, 42 },   { 84, 67 },
	{ 86, 66 },   { 87, 100 },  { 91, 102 },  { 94, 93 },   { 97, 96 },
	{ 98, 123 },  { 100, 44 },  { 101, 97 },  { 103, 75 },  { 104, 52 },
	{ 105, 55 },  { 106, 48 },  { 110, 53 },  { 111, 76 },  { 112, 49 },
	{ 113, 50 },  { 114, 51 },  { 115, 54 },  { 118, 58 },  { 119, 77 },
	{ 122, 62 },  { 123, 63 },  { 125, 59 },  { 129, 61 },  { 133, 65 },
	{ 137, 69 },  { 139, 70 },  { 142, 71 },  { 143, 72 },  { 145, 74 },
	{ 146, 45 },  { 147, 78 },  { 148, 60 },  { 150, 119 }, { 151, 118 },
	{ 152, 85 },  { 153, 79 },  { 154, 80 },  { 155, 81 },  { 157, 84 },
	{ 162, 64 },  { 163, 88 },  { 164, 89 },  { 165, 73 },  { 166, 90 },
	{ 167, 91 },  { 168, 94 },  { 169, 82 },  { 170, 95 },  { 171, 98 },
	{ 172, 47 },  { 175, 46 },  { 186, 129 }, { 189, 131 }, { 194, 116 },
	{ 196, 117 }, { 199, 113 }, { 201, 128 }, { 205, 130 }, { 207, 115 },
	{ 208, 132 }, { 210, 135 }, { 212, 136 }, { 215, 137 }, { 218, 124 },
	{ 219, 68 },  { 221, 133 }, { 223, 134 },
};
Quoted 6 lines
Quoted 3 lines

There's no egpio function. I assume you copied it from sm8550 but I think you should do something similar to commit a326b0523fc1 ("pinctrl:
qcom: sa8775p: Enable egpio function") here.

I'll add this in v3. EGPIO_PRESENT is set on GPIOs 185 to 223.

Thanks,
Bartosz