Skip to content

Commit c2e5a25

Browse files
Srinivas-Kandagatlalinusw
authored andcommitted
pinctrl: qcom: Introduce SM4250 LPI pinctrl driver
Add support for the pin controller block on SM4250 Low Power Island. Signed-off-by: Srinivas Kandagatla <[email protected]> Reviewed-by: Krzysztof Kozlowski <[email protected]> Reviewed-by: Dmitry Baryshkov <[email protected]> Link: https://lore.kernel.org/[email protected] Signed-off-by: Linus Walleij <[email protected]>
1 parent 2ffa7a3 commit c2e5a25

File tree

3 files changed

+246
-0
lines changed

3 files changed

+246
-0
lines changed

drivers/pinctrl/qcom/Kconfig

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -68,6 +68,15 @@ config PINCTRL_SC7280_LPASS_LPI
6868
Qualcomm Technologies Inc LPASS (Low Power Audio SubSystem) LPI
6969
(Low Power Island) found on the Qualcomm Technologies Inc SC7280 platform.
7070

71+
config PINCTRL_SM4250_LPASS_LPI
72+
tristate "Qualcomm Technologies Inc SM4250 LPASS LPI pin controller driver"
73+
depends on ARM64 || COMPILE_TEST
74+
depends on PINCTRL_LPASS_LPI
75+
help
76+
This is the pinctrl, pinmux, pinconf and gpiolib driver for the
77+
Qualcomm Technologies Inc LPASS (Low Power Audio SubSystem) LPI
78+
(Low Power Island) found on the Qualcomm Technologies Inc SM4250 platform.
79+
7180
config PINCTRL_SM6115_LPASS_LPI
7281
tristate "Qualcomm Technologies Inc SM6115 LPASS LPI pin controller driver"
7382
depends on ARM64 || COMPILE_TEST

drivers/pinctrl/qcom/Makefile

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -43,6 +43,7 @@ obj-$(CONFIG_PINCTRL_SDM845) += pinctrl-sdm845.o
4343
obj-$(CONFIG_PINCTRL_SDX55) += pinctrl-sdx55.o
4444
obj-$(CONFIG_PINCTRL_SDX65) += pinctrl-sdx65.o
4545
obj-$(CONFIG_PINCTRL_SDX75) += pinctrl-sdx75.o
46+
obj-$(CONFIG_PINCTRL_SM4250_LPASS_LPI) += pinctrl-sm4250-lpass-lpi.o
4647
obj-$(CONFIG_PINCTRL_SM4450) += pinctrl-sm4450.o
4748
obj-$(CONFIG_PINCTRL_SM6115) += pinctrl-sm6115.o
4849
obj-$(CONFIG_PINCTRL_SM6115_LPASS_LPI) += pinctrl-sm6115-lpass-lpi.o
Lines changed: 236 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,236 @@
1+
// SPDX-License-Identifier: GPL-2.0-only
2+
/*
3+
* Copyright (c) 2016-2019, The Linux Foundation. All rights reserved.
4+
* Copyright (c) 2020, 2023 Linaro Ltd.
5+
*/
6+
7+
#include <linux/gpio/driver.h>
8+
#include <linux/module.h>
9+
#include <linux/platform_device.h>
10+
11+
#include "pinctrl-lpass-lpi.h"
12+
13+
enum lpass_lpi_functions {
14+
LPI_MUX_dmic01_clk,
15+
LPI_MUX_dmic01_data,
16+
LPI_MUX_dmic23_clk,
17+
LPI_MUX_dmic23_data,
18+
LPI_MUX_dmic4_clk,
19+
LPI_MUX_dmic4_data,
20+
LPI_MUX_ext_mclk0_a,
21+
LPI_MUX_ext_mclk0_b,
22+
LPI_MUX_ext_mclk1_a,
23+
LPI_MUX_ext_mclk1_b,
24+
LPI_MUX_ext_mclk1_c,
25+
LPI_MUX_i2s1_clk,
26+
LPI_MUX_i2s1_data,
27+
LPI_MUX_i2s1_ws,
28+
LPI_MUX_i2s2_clk,
29+
LPI_MUX_i2s2_data,
30+
LPI_MUX_i2s2_ws,
31+
LPI_MUX_i2s3_clk,
32+
LPI_MUX_i2s3_data,
33+
LPI_MUX_i2s3_ws,
34+
LPI_MUX_qup_io_00,
35+
LPI_MUX_qup_io_01,
36+
LPI_MUX_qup_io_05,
37+
LPI_MUX_qup_io_10,
38+
LPI_MUX_qup_io_11,
39+
LPI_MUX_qup_io_25,
40+
LPI_MUX_qup_io_21,
41+
LPI_MUX_qup_io_26,
42+
LPI_MUX_qup_io_31,
43+
LPI_MUX_qup_io_36,
44+
LPI_MUX_qua_mi2s_data,
45+
LPI_MUX_qua_mi2s_sclk,
46+
LPI_MUX_qua_mi2s_ws,
47+
LPI_MUX_slim_clk,
48+
LPI_MUX_slim_data,
49+
LPI_MUX_sync_out,
50+
LPI_MUX_swr_rx_clk,
51+
LPI_MUX_swr_rx_data,
52+
LPI_MUX_swr_tx_clk,
53+
LPI_MUX_swr_tx_data,
54+
LPI_MUX_swr_wsa_clk,
55+
LPI_MUX_swr_wsa_data,
56+
LPI_MUX_gpio,
57+
LPI_MUX__,
58+
};
59+
60+
static const struct pinctrl_pin_desc sm4250_lpi_pins[] = {
61+
PINCTRL_PIN(0, "gpio0"),
62+
PINCTRL_PIN(1, "gpio1"),
63+
PINCTRL_PIN(2, "gpio2"),
64+
PINCTRL_PIN(3, "gpio3"),
65+
PINCTRL_PIN(4, "gpio4"),
66+
PINCTRL_PIN(5, "gpio5"),
67+
PINCTRL_PIN(6, "gpio6"),
68+
PINCTRL_PIN(7, "gpio7"),
69+
PINCTRL_PIN(8, "gpio8"),
70+
PINCTRL_PIN(9, "gpio9"),
71+
PINCTRL_PIN(10, "gpio10"),
72+
PINCTRL_PIN(11, "gpio11"),
73+
PINCTRL_PIN(12, "gpio12"),
74+
PINCTRL_PIN(13, "gpio13"),
75+
PINCTRL_PIN(14, "gpio14"),
76+
PINCTRL_PIN(15, "gpio15"),
77+
PINCTRL_PIN(16, "gpio16"),
78+
PINCTRL_PIN(17, "gpio17"),
79+
PINCTRL_PIN(18, "gpio18"),
80+
PINCTRL_PIN(19, "gpio19"),
81+
PINCTRL_PIN(20, "gpio20"),
82+
PINCTRL_PIN(21, "gpio21"),
83+
PINCTRL_PIN(22, "gpio22"),
84+
PINCTRL_PIN(23, "gpio23"),
85+
PINCTRL_PIN(24, "gpio24"),
86+
PINCTRL_PIN(25, "gpio25"),
87+
PINCTRL_PIN(26, "gpio26"),
88+
};
89+
90+
static const char * const dmic01_clk_groups[] = { "gpio6" };
91+
static const char * const dmic01_data_groups[] = { "gpio7" };
92+
static const char * const dmic23_clk_groups[] = { "gpio8" };
93+
static const char * const dmic23_data_groups[] = { "gpio9" };
94+
static const char * const dmic4_clk_groups[] = { "gpio10" };
95+
static const char * const dmic4_data_groups[] = { "gpio11" };
96+
static const char * const ext_mclk0_a_groups[] = { "gpio13" };
97+
static const char * const ext_mclk0_b_groups[] = { "gpio5" };
98+
static const char * const ext_mclk1_a_groups[] = { "gpio18" };
99+
static const char * const ext_mclk1_b_groups[] = { "gpio9" };
100+
static const char * const ext_mclk1_c_groups[] = { "gpio17" };
101+
static const char * const slim_clk_groups[] = { "gpio14" };
102+
static const char * const slim_data_groups[] = { "gpio15" };
103+
static const char * const i2s1_clk_groups[] = { "gpio6" };
104+
static const char * const i2s1_data_groups[] = { "gpio8", "gpio9" };
105+
static const char * const i2s1_ws_groups[] = { "gpio7" };
106+
static const char * const i2s2_clk_groups[] = { "gpio10" };
107+
static const char * const i2s2_data_groups[] = { "gpio12", "gpio13" };
108+
static const char * const i2s2_ws_groups[] = { "gpio11" };
109+
static const char * const i2s3_clk_groups[] = { "gpio14" };
110+
static const char * const i2s3_data_groups[] = { "gpio16", "gpio17" };
111+
static const char * const i2s3_ws_groups[] = { "gpio15" };
112+
static const char * const qup_io_00_groups[] = { "gpio19" };
113+
static const char * const qup_io_01_groups[] = { "gpio21" };
114+
static const char * const qup_io_05_groups[] = { "gpio23" };
115+
static const char * const qup_io_10_groups[] = { "gpio20" };
116+
static const char * const qup_io_11_groups[] = { "gpio22" };
117+
static const char * const qup_io_25_groups[] = { "gpio23" };
118+
static const char * const qup_io_21_groups[] = { "gpio25" };
119+
static const char * const qup_io_26_groups[] = { "gpio25" };
120+
static const char * const qup_io_31_groups[] = { "gpio26" };
121+
static const char * const qup_io_36_groups[] = { "gpio26" };
122+
static const char * const qua_mi2s_data_groups[] = { "gpio2", "gpio3", "gpio4", "gpio5" };
123+
static const char * const qua_mi2s_sclk_groups[] = { "gpio0" };
124+
static const char * const qua_mi2s_ws_groups[] = { "gpio1" };
125+
static const char * const sync_out_groups[] = { "gpio19", "gpio20", "gpio21", "gpio22",
126+
"gpio23", "gpio24", "gpio25", "gpio26"};
127+
static const char * const swr_rx_clk_groups[] = { "gpio3" };
128+
static const char * const swr_rx_data_groups[] = { "gpio4", "gpio5" };
129+
static const char * const swr_tx_clk_groups[] = { "gpio0" };
130+
static const char * const swr_tx_data_groups[] = { "gpio1", "gpio2" };
131+
static const char * const swr_wsa_clk_groups[] = { "gpio10" };
132+
static const char * const swr_wsa_data_groups[] = { "gpio11" };
133+
134+
135+
static const struct lpi_pingroup sm4250_groups[] = {
136+
LPI_PINGROUP(0, 0, swr_tx_clk, qua_mi2s_sclk, _, _),
137+
LPI_PINGROUP(1, 2, swr_tx_data, qua_mi2s_ws, _, _),
138+
LPI_PINGROUP(2, 4, swr_tx_data, qua_mi2s_data, _, _),
139+
LPI_PINGROUP(3, 8, swr_rx_clk, qua_mi2s_data, _, _),
140+
LPI_PINGROUP(4, 10, swr_rx_data, qua_mi2s_data, _, _),
141+
LPI_PINGROUP(5, 12, swr_rx_data, ext_mclk0_b, qua_mi2s_data, _),
142+
LPI_PINGROUP(6, LPI_NO_SLEW, dmic01_clk, i2s1_clk, _, _),
143+
LPI_PINGROUP(7, LPI_NO_SLEW, dmic01_data, i2s1_ws, _, _),
144+
LPI_PINGROUP(8, LPI_NO_SLEW, dmic23_clk, i2s1_data, _, _),
145+
LPI_PINGROUP(9, LPI_NO_SLEW, dmic23_data, i2s1_data, ext_mclk1_b, _),
146+
LPI_PINGROUP(10, 16, i2s2_clk, swr_wsa_clk, dmic4_clk, _),
147+
LPI_PINGROUP(11, 18, i2s2_ws, swr_wsa_data, dmic4_data, _),
148+
LPI_PINGROUP(12, LPI_NO_SLEW, dmic23_clk, i2s2_data, _, _),
149+
LPI_PINGROUP(13, LPI_NO_SLEW, dmic23_data, i2s2_data, ext_mclk0_a, _),
150+
LPI_PINGROUP(14, LPI_NO_SLEW, i2s3_clk, slim_clk, _, _),
151+
LPI_PINGROUP(15, LPI_NO_SLEW, i2s3_ws, slim_data, _, _),
152+
LPI_PINGROUP(16, LPI_NO_SLEW, i2s3_data, _, _, _),
153+
LPI_PINGROUP(17, LPI_NO_SLEW, i2s3_data, ext_mclk1_c, _, _),
154+
LPI_PINGROUP(18, 20, ext_mclk1_a, swr_rx_data, _, _),
155+
LPI_PINGROUP(19, LPI_NO_SLEW, qup_io_00, sync_out, _, _),
156+
LPI_PINGROUP(20, LPI_NO_SLEW, qup_io_10, sync_out, _, _),
157+
LPI_PINGROUP(21, LPI_NO_SLEW, qup_io_01, sync_out, _, _),
158+
LPI_PINGROUP(22, LPI_NO_SLEW, qup_io_11, sync_out, _, _),
159+
LPI_PINGROUP(23, LPI_NO_SLEW, qup_io_25, qup_io_05, sync_out, _),
160+
LPI_PINGROUP(25, LPI_NO_SLEW, qup_io_26, qup_io_21, sync_out, _),
161+
LPI_PINGROUP(26, LPI_NO_SLEW, qup_io_36, qup_io_31, sync_out, _),
162+
};
163+
164+
static const struct lpi_function sm4250_functions[] = {
165+
LPI_FUNCTION(dmic01_clk),
166+
LPI_FUNCTION(dmic01_data),
167+
LPI_FUNCTION(dmic23_clk),
168+
LPI_FUNCTION(dmic23_data),
169+
LPI_FUNCTION(dmic4_clk),
170+
LPI_FUNCTION(dmic4_data),
171+
LPI_FUNCTION(ext_mclk0_a),
172+
LPI_FUNCTION(ext_mclk0_b),
173+
LPI_FUNCTION(ext_mclk1_a),
174+
LPI_FUNCTION(ext_mclk1_b),
175+
LPI_FUNCTION(ext_mclk1_c),
176+
LPI_FUNCTION(i2s1_clk),
177+
LPI_FUNCTION(i2s1_data),
178+
LPI_FUNCTION(i2s1_ws),
179+
LPI_FUNCTION(i2s2_clk),
180+
LPI_FUNCTION(i2s2_data),
181+
LPI_FUNCTION(i2s2_ws),
182+
LPI_FUNCTION(i2s3_clk),
183+
LPI_FUNCTION(i2s3_data),
184+
LPI_FUNCTION(i2s3_ws),
185+
LPI_FUNCTION(qup_io_00),
186+
LPI_FUNCTION(qup_io_01),
187+
LPI_FUNCTION(qup_io_05),
188+
LPI_FUNCTION(qup_io_10),
189+
LPI_FUNCTION(qup_io_11),
190+
LPI_FUNCTION(qup_io_25),
191+
LPI_FUNCTION(qup_io_21),
192+
LPI_FUNCTION(qup_io_26),
193+
LPI_FUNCTION(qup_io_31),
194+
LPI_FUNCTION(qup_io_36),
195+
LPI_FUNCTION(qua_mi2s_data),
196+
LPI_FUNCTION(qua_mi2s_sclk),
197+
LPI_FUNCTION(qua_mi2s_ws),
198+
LPI_FUNCTION(slim_clk),
199+
LPI_FUNCTION(slim_data),
200+
LPI_FUNCTION(sync_out),
201+
LPI_FUNCTION(swr_rx_clk),
202+
LPI_FUNCTION(swr_rx_data),
203+
LPI_FUNCTION(swr_tx_clk),
204+
LPI_FUNCTION(swr_tx_data),
205+
LPI_FUNCTION(swr_wsa_clk),
206+
LPI_FUNCTION(swr_wsa_data),
207+
};
208+
209+
static const struct lpi_pinctrl_variant_data sm4250_lpi_data = {
210+
.pins = sm4250_lpi_pins,
211+
.npins = ARRAY_SIZE(sm4250_lpi_pins),
212+
.groups = sm4250_groups,
213+
.ngroups = ARRAY_SIZE(sm4250_groups),
214+
.functions = sm4250_functions,
215+
.nfunctions = ARRAY_SIZE(sm4250_functions),
216+
};
217+
218+
static const struct of_device_id lpi_pinctrl_of_match[] = {
219+
{ .compatible = "qcom,sm4250-lpass-lpi-pinctrl", .data = &sm4250_lpi_data },
220+
{ }
221+
};
222+
MODULE_DEVICE_TABLE(of, lpi_pinctrl_of_match);
223+
224+
static struct platform_driver lpi_pinctrl_driver = {
225+
.driver = {
226+
.name = "qcom-sm4250-lpass-lpi-pinctrl",
227+
.of_match_table = lpi_pinctrl_of_match,
228+
},
229+
.probe = lpi_pinctrl_probe,
230+
.remove_new = lpi_pinctrl_remove,
231+
};
232+
233+
module_platform_driver(lpi_pinctrl_driver);
234+
MODULE_DESCRIPTION("QTI SM4250 LPI GPIO pin control driver");
235+
MODULE_AUTHOR("Srinivas Kandagatla <[email protected]>");
236+
MODULE_LICENSE("GPL");

0 commit comments

Comments
 (0)