1 // SPDX-License-Identifier: GPL-2.0
2 /*
3  * Copyright (c) 2016, The Linux Foundation. All rights reserved.
4  * Copyright (c) 2018, Craig Tatlor.
5  */
6 
7 #include <linux/module.h>
8 #include <linux/of.h>
9 #include <linux/platform_device.h>
10 #include <linux/pinctrl/pinctrl.h>
11 
12 #include "pinctrl-msm.h"
13 
14 static const char * const sdm660_tiles[] = {
15 	"north",
16 	"center",
17 	"south"
18 };
19 
20 enum {
21 	NORTH,
22 	CENTER,
23 	SOUTH
24 };
25 
26 #define REG_SIZE 0x1000
27 
28 #define FUNCTION(fname)					\
29 	[msm_mux_##fname] = {		                \
30 		.name = #fname,				\
31 		.groups = fname##_groups,               \
32 		.ngroups = ARRAY_SIZE(fname##_groups),	\
33 	}
34 
35 
36 #define PINGROUP(id, base, f1, f2, f3, f4, f5, f6, f7, f8, f9)	\
37 	{					        \
38 		.name = "gpio" #id,			\
39 		.pins = gpio##id##_pins,		\
40 		.npins = (unsigned)ARRAY_SIZE(gpio##id##_pins),	\
41 		.funcs = (int[]){			\
42 			msm_mux_gpio, /* gpio mode */	\
43 			msm_mux_##f1,			\
44 			msm_mux_##f2,			\
45 			msm_mux_##f3,			\
46 			msm_mux_##f4,			\
47 			msm_mux_##f5,			\
48 			msm_mux_##f6,			\
49 			msm_mux_##f7,			\
50 			msm_mux_##f8,			\
51 			msm_mux_##f9			\
52 		},				        \
53 		.nfuncs = 10,				\
54 		.ctl_reg = base + REG_SIZE * id,	\
55 		.io_reg = base + 0x4 + REG_SIZE * id,		\
56 		.intr_cfg_reg = base + 0x8 + REG_SIZE * id,		\
57 		.intr_status_reg = base + 0xc + REG_SIZE * id,	\
58 		.intr_target_reg = base + 0x8 + REG_SIZE * id,	\
59 		.mux_bit = 2,			\
60 		.pull_bit = 0,			\
61 		.drv_bit = 6,			\
62 		.oe_bit = 9,			\
63 		.in_bit = 0,			\
64 		.out_bit = 1,			\
65 		.intr_enable_bit = 0,		\
66 		.intr_status_bit = 0,		\
67 		.intr_target_bit = 5,		\
68 		.intr_target_kpss_val = 3,	\
69 		.intr_raw_status_bit = 4,	\
70 		.intr_polarity_bit = 1,		\
71 		.intr_detection_bit = 2,	\
72 		.intr_detection_width = 2,	\
73 	}
74 
75 #define SDC_QDSD_PINGROUP(pg_name, ctl, pull, drv)	\
76 	{					        \
77 		.name = #pg_name,			\
78 		.pins = pg_name##_pins,			\
79 		.npins = (unsigned)ARRAY_SIZE(pg_name##_pins),	\
80 		.ctl_reg = ctl,				\
81 		.io_reg = 0,				\
82 		.intr_cfg_reg = 0,			\
83 		.intr_status_reg = 0,			\
84 		.intr_target_reg = 0,			\
85 		.mux_bit = -1,				\
86 		.pull_bit = pull,			\
87 		.drv_bit = drv,				\
88 		.oe_bit = -1,				\
89 		.in_bit = -1,				\
90 		.out_bit = -1,				\
91 		.intr_enable_bit = -1,			\
92 		.intr_status_bit = -1,			\
93 		.intr_target_bit = -1,			\
94 		.intr_raw_status_bit = -1,		\
95 		.intr_polarity_bit = -1,		\
96 		.intr_detection_bit = -1,		\
97 		.intr_detection_width = -1,		\
98 	}
99 
100 static const struct pinctrl_pin_desc sdm660_pins[] = {
101 	PINCTRL_PIN(0, "GPIO_0"),
102 	PINCTRL_PIN(1, "GPIO_1"),
103 	PINCTRL_PIN(2, "GPIO_2"),
104 	PINCTRL_PIN(3, "GPIO_3"),
105 	PINCTRL_PIN(4, "GPIO_4"),
106 	PINCTRL_PIN(5, "GPIO_5"),
107 	PINCTRL_PIN(6, "GPIO_6"),
108 	PINCTRL_PIN(7, "GPIO_7"),
109 	PINCTRL_PIN(8, "GPIO_8"),
110 	PINCTRL_PIN(9, "GPIO_9"),
111 	PINCTRL_PIN(10, "GPIO_10"),
112 	PINCTRL_PIN(11, "GPIO_11"),
113 	PINCTRL_PIN(12, "GPIO_12"),
114 	PINCTRL_PIN(13, "GPIO_13"),
115 	PINCTRL_PIN(14, "GPIO_14"),
116 	PINCTRL_PIN(15, "GPIO_15"),
117 	PINCTRL_PIN(16, "GPIO_16"),
118 	PINCTRL_PIN(17, "GPIO_17"),
119 	PINCTRL_PIN(18, "GPIO_18"),
120 	PINCTRL_PIN(19, "GPIO_19"),
121 	PINCTRL_PIN(20, "GPIO_20"),
122 	PINCTRL_PIN(21, "GPIO_21"),
123 	PINCTRL_PIN(22, "GPIO_22"),
124 	PINCTRL_PIN(23, "GPIO_23"),
125 	PINCTRL_PIN(24, "GPIO_24"),
126 	PINCTRL_PIN(25, "GPIO_25"),
127 	PINCTRL_PIN(26, "GPIO_26"),
128 	PINCTRL_PIN(27, "GPIO_27"),
129 	PINCTRL_PIN(28, "GPIO_28"),
130 	PINCTRL_PIN(29, "GPIO_29"),
131 	PINCTRL_PIN(30, "GPIO_30"),
132 	PINCTRL_PIN(31, "GPIO_31"),
133 	PINCTRL_PIN(32, "GPIO_32"),
134 	PINCTRL_PIN(33, "GPIO_33"),
135 	PINCTRL_PIN(34, "GPIO_34"),
136 	PINCTRL_PIN(35, "GPIO_35"),
137 	PINCTRL_PIN(36, "GPIO_36"),
138 	PINCTRL_PIN(37, "GPIO_37"),
139 	PINCTRL_PIN(38, "GPIO_38"),
140 	PINCTRL_PIN(39, "GPIO_39"),
141 	PINCTRL_PIN(40, "GPIO_40"),
142 	PINCTRL_PIN(41, "GPIO_41"),
143 	PINCTRL_PIN(42, "GPIO_42"),
144 	PINCTRL_PIN(43, "GPIO_43"),
145 	PINCTRL_PIN(44, "GPIO_44"),
146 	PINCTRL_PIN(45, "GPIO_45"),
147 	PINCTRL_PIN(46, "GPIO_46"),
148 	PINCTRL_PIN(47, "GPIO_47"),
149 	PINCTRL_PIN(48, "GPIO_48"),
150 	PINCTRL_PIN(49, "GPIO_49"),
151 	PINCTRL_PIN(50, "GPIO_50"),
152 	PINCTRL_PIN(51, "GPIO_51"),
153 	PINCTRL_PIN(52, "GPIO_52"),
154 	PINCTRL_PIN(53, "GPIO_53"),
155 	PINCTRL_PIN(54, "GPIO_54"),
156 	PINCTRL_PIN(55, "GPIO_55"),
157 	PINCTRL_PIN(56, "GPIO_56"),
158 	PINCTRL_PIN(57, "GPIO_57"),
159 	PINCTRL_PIN(58, "GPIO_58"),
160 	PINCTRL_PIN(59, "GPIO_59"),
161 	PINCTRL_PIN(60, "GPIO_60"),
162 	PINCTRL_PIN(61, "GPIO_61"),
163 	PINCTRL_PIN(62, "GPIO_62"),
164 	PINCTRL_PIN(63, "GPIO_63"),
165 	PINCTRL_PIN(64, "GPIO_64"),
166 	PINCTRL_PIN(65, "GPIO_65"),
167 	PINCTRL_PIN(66, "GPIO_66"),
168 	PINCTRL_PIN(67, "GPIO_67"),
169 	PINCTRL_PIN(68, "GPIO_68"),
170 	PINCTRL_PIN(69, "GPIO_69"),
171 	PINCTRL_PIN(70, "GPIO_70"),
172 	PINCTRL_PIN(71, "GPIO_71"),
173 	PINCTRL_PIN(72, "GPIO_72"),
174 	PINCTRL_PIN(73, "GPIO_73"),
175 	PINCTRL_PIN(74, "GPIO_74"),
176 	PINCTRL_PIN(75, "GPIO_75"),
177 	PINCTRL_PIN(76, "GPIO_76"),
178 	PINCTRL_PIN(77, "GPIO_77"),
179 	PINCTRL_PIN(78, "GPIO_78"),
180 	PINCTRL_PIN(79, "GPIO_79"),
181 	PINCTRL_PIN(80, "GPIO_80"),
182 	PINCTRL_PIN(81, "GPIO_81"),
183 	PINCTRL_PIN(82, "GPIO_82"),
184 	PINCTRL_PIN(83, "GPIO_83"),
185 	PINCTRL_PIN(84, "GPIO_84"),
186 	PINCTRL_PIN(85, "GPIO_85"),
187 	PINCTRL_PIN(86, "GPIO_86"),
188 	PINCTRL_PIN(87, "GPIO_87"),
189 	PINCTRL_PIN(88, "GPIO_88"),
190 	PINCTRL_PIN(89, "GPIO_89"),
191 	PINCTRL_PIN(90, "GPIO_90"),
192 	PINCTRL_PIN(91, "GPIO_91"),
193 	PINCTRL_PIN(92, "GPIO_92"),
194 	PINCTRL_PIN(93, "GPIO_93"),
195 	PINCTRL_PIN(94, "GPIO_94"),
196 	PINCTRL_PIN(95, "GPIO_95"),
197 	PINCTRL_PIN(96, "GPIO_96"),
198 	PINCTRL_PIN(97, "GPIO_97"),
199 	PINCTRL_PIN(98, "GPIO_98"),
200 	PINCTRL_PIN(99, "GPIO_99"),
201 	PINCTRL_PIN(100, "GPIO_100"),
202 	PINCTRL_PIN(101, "GPIO_101"),
203 	PINCTRL_PIN(102, "GPIO_102"),
204 	PINCTRL_PIN(103, "GPIO_103"),
205 	PINCTRL_PIN(104, "GPIO_104"),
206 	PINCTRL_PIN(105, "GPIO_105"),
207 	PINCTRL_PIN(106, "GPIO_106"),
208 	PINCTRL_PIN(107, "GPIO_107"),
209 	PINCTRL_PIN(108, "GPIO_108"),
210 	PINCTRL_PIN(109, "GPIO_109"),
211 	PINCTRL_PIN(110, "GPIO_110"),
212 	PINCTRL_PIN(111, "GPIO_111"),
213 	PINCTRL_PIN(112, "GPIO_112"),
214 	PINCTRL_PIN(113, "GPIO_113"),
215 	PINCTRL_PIN(114, "SDC1_CLK"),
216 	PINCTRL_PIN(115, "SDC1_CMD"),
217 	PINCTRL_PIN(116, "SDC1_DATA"),
218 	PINCTRL_PIN(117, "SDC2_CLK"),
219 	PINCTRL_PIN(118, "SDC2_CMD"),
220 	PINCTRL_PIN(119, "SDC2_DATA"),
221 	PINCTRL_PIN(120, "SDC1_RCLK"),
222 };
223 
224 #define DECLARE_MSM_GPIO_PINS(pin) \
225 	static const unsigned int gpio##pin##_pins[] = { pin }
226 DECLARE_MSM_GPIO_PINS(0);
227 DECLARE_MSM_GPIO_PINS(1);
228 DECLARE_MSM_GPIO_PINS(2);
229 DECLARE_MSM_GPIO_PINS(3);
230 DECLARE_MSM_GPIO_PINS(4);
231 DECLARE_MSM_GPIO_PINS(5);
232 DECLARE_MSM_GPIO_PINS(6);
233 DECLARE_MSM_GPIO_PINS(7);
234 DECLARE_MSM_GPIO_PINS(8);
235 DECLARE_MSM_GPIO_PINS(9);
236 DECLARE_MSM_GPIO_PINS(10);
237 DECLARE_MSM_GPIO_PINS(11);
238 DECLARE_MSM_GPIO_PINS(12);
239 DECLARE_MSM_GPIO_PINS(13);
240 DECLARE_MSM_GPIO_PINS(14);
241 DECLARE_MSM_GPIO_PINS(15);
242 DECLARE_MSM_GPIO_PINS(16);
243 DECLARE_MSM_GPIO_PINS(17);
244 DECLARE_MSM_GPIO_PINS(18);
245 DECLARE_MSM_GPIO_PINS(19);
246 DECLARE_MSM_GPIO_PINS(20);
247 DECLARE_MSM_GPIO_PINS(21);
248 DECLARE_MSM_GPIO_PINS(22);
249 DECLARE_MSM_GPIO_PINS(23);
250 DECLARE_MSM_GPIO_PINS(24);
251 DECLARE_MSM_GPIO_PINS(25);
252 DECLARE_MSM_GPIO_PINS(26);
253 DECLARE_MSM_GPIO_PINS(27);
254 DECLARE_MSM_GPIO_PINS(28);
255 DECLARE_MSM_GPIO_PINS(29);
256 DECLARE_MSM_GPIO_PINS(30);
257 DECLARE_MSM_GPIO_PINS(31);
258 DECLARE_MSM_GPIO_PINS(32);
259 DECLARE_MSM_GPIO_PINS(33);
260 DECLARE_MSM_GPIO_PINS(34);
261 DECLARE_MSM_GPIO_PINS(35);
262 DECLARE_MSM_GPIO_PINS(36);
263 DECLARE_MSM_GPIO_PINS(37);
264 DECLARE_MSM_GPIO_PINS(38);
265 DECLARE_MSM_GPIO_PINS(39);
266 DECLARE_MSM_GPIO_PINS(40);
267 DECLARE_MSM_GPIO_PINS(41);
268 DECLARE_MSM_GPIO_PINS(42);
269 DECLARE_MSM_GPIO_PINS(43);
270 DECLARE_MSM_GPIO_PINS(44);
271 DECLARE_MSM_GPIO_PINS(45);
272 DECLARE_MSM_GPIO_PINS(46);
273 DECLARE_MSM_GPIO_PINS(47);
274 DECLARE_MSM_GPIO_PINS(48);
275 DECLARE_MSM_GPIO_PINS(49);
276 DECLARE_MSM_GPIO_PINS(50);
277 DECLARE_MSM_GPIO_PINS(51);
278 DECLARE_MSM_GPIO_PINS(52);
279 DECLARE_MSM_GPIO_PINS(53);
280 DECLARE_MSM_GPIO_PINS(54);
281 DECLARE_MSM_GPIO_PINS(55);
282 DECLARE_MSM_GPIO_PINS(56);
283 DECLARE_MSM_GPIO_PINS(57);
284 DECLARE_MSM_GPIO_PINS(58);
285 DECLARE_MSM_GPIO_PINS(59);
286 DECLARE_MSM_GPIO_PINS(60);
287 DECLARE_MSM_GPIO_PINS(61);
288 DECLARE_MSM_GPIO_PINS(62);
289 DECLARE_MSM_GPIO_PINS(63);
290 DECLARE_MSM_GPIO_PINS(64);
291 DECLARE_MSM_GPIO_PINS(65);
292 DECLARE_MSM_GPIO_PINS(66);
293 DECLARE_MSM_GPIO_PINS(67);
294 DECLARE_MSM_GPIO_PINS(68);
295 DECLARE_MSM_GPIO_PINS(69);
296 DECLARE_MSM_GPIO_PINS(70);
297 DECLARE_MSM_GPIO_PINS(71);
298 DECLARE_MSM_GPIO_PINS(72);
299 DECLARE_MSM_GPIO_PINS(73);
300 DECLARE_MSM_GPIO_PINS(74);
301 DECLARE_MSM_GPIO_PINS(75);
302 DECLARE_MSM_GPIO_PINS(76);
303 DECLARE_MSM_GPIO_PINS(77);
304 DECLARE_MSM_GPIO_PINS(78);
305 DECLARE_MSM_GPIO_PINS(79);
306 DECLARE_MSM_GPIO_PINS(80);
307 DECLARE_MSM_GPIO_PINS(81);
308 DECLARE_MSM_GPIO_PINS(82);
309 DECLARE_MSM_GPIO_PINS(83);
310 DECLARE_MSM_GPIO_PINS(84);
311 DECLARE_MSM_GPIO_PINS(85);
312 DECLARE_MSM_GPIO_PINS(86);
313 DECLARE_MSM_GPIO_PINS(87);
314 DECLARE_MSM_GPIO_PINS(88);
315 DECLARE_MSM_GPIO_PINS(89);
316 DECLARE_MSM_GPIO_PINS(90);
317 DECLARE_MSM_GPIO_PINS(91);
318 DECLARE_MSM_GPIO_PINS(92);
319 DECLARE_MSM_GPIO_PINS(93);
320 DECLARE_MSM_GPIO_PINS(94);
321 DECLARE_MSM_GPIO_PINS(95);
322 DECLARE_MSM_GPIO_PINS(96);
323 DECLARE_MSM_GPIO_PINS(97);
324 DECLARE_MSM_GPIO_PINS(98);
325 DECLARE_MSM_GPIO_PINS(99);
326 DECLARE_MSM_GPIO_PINS(100);
327 DECLARE_MSM_GPIO_PINS(101);
328 DECLARE_MSM_GPIO_PINS(102);
329 DECLARE_MSM_GPIO_PINS(103);
330 DECLARE_MSM_GPIO_PINS(104);
331 DECLARE_MSM_GPIO_PINS(105);
332 DECLARE_MSM_GPIO_PINS(106);
333 DECLARE_MSM_GPIO_PINS(107);
334 DECLARE_MSM_GPIO_PINS(108);
335 DECLARE_MSM_GPIO_PINS(109);
336 DECLARE_MSM_GPIO_PINS(110);
337 DECLARE_MSM_GPIO_PINS(111);
338 DECLARE_MSM_GPIO_PINS(112);
339 DECLARE_MSM_GPIO_PINS(113);
340 
341 static const unsigned int sdc1_clk_pins[] = { 114 };
342 static const unsigned int sdc1_cmd_pins[] = { 115 };
343 static const unsigned int sdc1_data_pins[] = { 116 };
344 static const unsigned int sdc1_rclk_pins[] = { 120 };
345 static const unsigned int sdc2_clk_pins[] = { 117 };
346 static const unsigned int sdc2_cmd_pins[] = { 118 };
347 static const unsigned int sdc2_data_pins[] = { 119 };
348 
349 enum sdm660_functions {
350 	msm_mux_adsp_ext,
351 	msm_mux_agera_pll,
352 	msm_mux_atest_char,
353 	msm_mux_atest_char0,
354 	msm_mux_atest_char1,
355 	msm_mux_atest_char2,
356 	msm_mux_atest_char3,
357 	msm_mux_atest_gpsadc0,
358 	msm_mux_atest_gpsadc1,
359 	msm_mux_atest_tsens,
360 	msm_mux_atest_tsens2,
361 	msm_mux_atest_usb1,
362 	msm_mux_atest_usb10,
363 	msm_mux_atest_usb11,
364 	msm_mux_atest_usb12,
365 	msm_mux_atest_usb13,
366 	msm_mux_atest_usb2,
367 	msm_mux_atest_usb20,
368 	msm_mux_atest_usb21,
369 	msm_mux_atest_usb22,
370 	msm_mux_atest_usb23,
371 	msm_mux_audio_ref,
372 	msm_mux_bimc_dte0,
373 	msm_mux_bimc_dte1,
374 	msm_mux_blsp_i2c1,
375 	msm_mux_blsp_i2c2,
376 	msm_mux_blsp_i2c3,
377 	msm_mux_blsp_i2c4,
378 	msm_mux_blsp_i2c5,
379 	msm_mux_blsp_i2c6,
380 	msm_mux_blsp_i2c7,
381 	msm_mux_blsp_i2c8_a,
382 	msm_mux_blsp_i2c8_b,
383 	msm_mux_blsp_spi1,
384 	msm_mux_blsp_spi2,
385 	msm_mux_blsp_spi3,
386 	msm_mux_blsp_spi3_cs1,
387 	msm_mux_blsp_spi3_cs2,
388 	msm_mux_blsp_spi4,
389 	msm_mux_blsp_spi5,
390 	msm_mux_blsp_spi6,
391 	msm_mux_blsp_spi7,
392 	msm_mux_blsp_spi8_a,
393 	msm_mux_blsp_spi8_b,
394 	msm_mux_blsp_spi8_cs1,
395 	msm_mux_blsp_spi8_cs2,
396 	msm_mux_blsp_uart1,
397 	msm_mux_blsp_uart2,
398 	msm_mux_blsp_uart5,
399 	msm_mux_blsp_uart6_a,
400 	msm_mux_blsp_uart6_b,
401 	msm_mux_blsp_uim1,
402 	msm_mux_blsp_uim2,
403 	msm_mux_blsp_uim5,
404 	msm_mux_blsp_uim6,
405 	msm_mux_cam_mclk,
406 	msm_mux_cci_async,
407 	msm_mux_cci_i2c,
408 	msm_mux_cri_trng,
409 	msm_mux_cri_trng0,
410 	msm_mux_cri_trng1,
411 	msm_mux_dbg_out,
412 	msm_mux_ddr_bist,
413 	msm_mux_gcc_gp1,
414 	msm_mux_gcc_gp2,
415 	msm_mux_gcc_gp3,
416 	msm_mux_gpio,
417 	msm_mux_gps_tx_a,
418 	msm_mux_gps_tx_b,
419 	msm_mux_gps_tx_c,
420 	msm_mux_isense_dbg,
421 	msm_mux_jitter_bist,
422 	msm_mux_ldo_en,
423 	msm_mux_ldo_update,
424 	msm_mux_m_voc,
425 	msm_mux_mdp_vsync,
426 	msm_mux_mdss_vsync0,
427 	msm_mux_mdss_vsync1,
428 	msm_mux_mdss_vsync2,
429 	msm_mux_mdss_vsync3,
430 	msm_mux_mss_lte,
431 	msm_mux_nav_pps_a,
432 	msm_mux_nav_pps_b,
433 	msm_mux_nav_pps_c,
434 	msm_mux_pa_indicator,
435 	msm_mux_phase_flag0,
436 	msm_mux_phase_flag1,
437 	msm_mux_phase_flag2,
438 	msm_mux_phase_flag3,
439 	msm_mux_phase_flag4,
440 	msm_mux_phase_flag5,
441 	msm_mux_phase_flag6,
442 	msm_mux_phase_flag7,
443 	msm_mux_phase_flag8,
444 	msm_mux_phase_flag9,
445 	msm_mux_phase_flag10,
446 	msm_mux_phase_flag11,
447 	msm_mux_phase_flag12,
448 	msm_mux_phase_flag13,
449 	msm_mux_phase_flag14,
450 	msm_mux_phase_flag15,
451 	msm_mux_phase_flag16,
452 	msm_mux_phase_flag17,
453 	msm_mux_phase_flag18,
454 	msm_mux_phase_flag19,
455 	msm_mux_phase_flag20,
456 	msm_mux_phase_flag21,
457 	msm_mux_phase_flag22,
458 	msm_mux_phase_flag23,
459 	msm_mux_phase_flag24,
460 	msm_mux_phase_flag25,
461 	msm_mux_phase_flag26,
462 	msm_mux_phase_flag27,
463 	msm_mux_phase_flag28,
464 	msm_mux_phase_flag29,
465 	msm_mux_phase_flag30,
466 	msm_mux_phase_flag31,
467 	msm_mux_pll_bypassnl,
468 	msm_mux_pll_reset,
469 	msm_mux_pri_mi2s,
470 	msm_mux_pri_mi2s_ws,
471 	msm_mux_prng_rosc,
472 	msm_mux_pwr_crypto,
473 	msm_mux_pwr_modem,
474 	msm_mux_pwr_nav,
475 	msm_mux_qdss_cti0_a,
476 	msm_mux_qdss_cti0_b,
477 	msm_mux_qdss_cti1_a,
478 	msm_mux_qdss_cti1_b,
479 	msm_mux_qdss_gpio,
480 	msm_mux_qdss_gpio0,
481 	msm_mux_qdss_gpio1,
482 	msm_mux_qdss_gpio10,
483 	msm_mux_qdss_gpio11,
484 	msm_mux_qdss_gpio12,
485 	msm_mux_qdss_gpio13,
486 	msm_mux_qdss_gpio14,
487 	msm_mux_qdss_gpio15,
488 	msm_mux_qdss_gpio2,
489 	msm_mux_qdss_gpio3,
490 	msm_mux_qdss_gpio4,
491 	msm_mux_qdss_gpio5,
492 	msm_mux_qdss_gpio6,
493 	msm_mux_qdss_gpio7,
494 	msm_mux_qdss_gpio8,
495 	msm_mux_qdss_gpio9,
496 	msm_mux_qlink_enable,
497 	msm_mux_qlink_request,
498 	msm_mux_qspi_clk,
499 	msm_mux_qspi_cs,
500 	msm_mux_qspi_data0,
501 	msm_mux_qspi_data1,
502 	msm_mux_qspi_data2,
503 	msm_mux_qspi_data3,
504 	msm_mux_qspi_resetn,
505 	msm_mux_sec_mi2s,
506 	msm_mux_sndwire_clk,
507 	msm_mux_sndwire_data,
508 	msm_mux_sp_cmu,
509 	msm_mux_ssc_irq,
510 	msm_mux_tgu_ch0,
511 	msm_mux_tgu_ch1,
512 	msm_mux_tsense_pwm1,
513 	msm_mux_tsense_pwm2,
514 	msm_mux_uim1_clk,
515 	msm_mux_uim1_data,
516 	msm_mux_uim1_present,
517 	msm_mux_uim1_reset,
518 	msm_mux_uim2_clk,
519 	msm_mux_uim2_data,
520 	msm_mux_uim2_present,
521 	msm_mux_uim2_reset,
522 	msm_mux_uim_batt,
523 	msm_mux_vfr_1,
524 	msm_mux_vsense_clkout,
525 	msm_mux_vsense_data0,
526 	msm_mux_vsense_data1,
527 	msm_mux_vsense_mode,
528 	msm_mux_wlan1_adc0,
529 	msm_mux_wlan1_adc1,
530 	msm_mux_wlan2_adc0,
531 	msm_mux_wlan2_adc1,
532 	msm_mux__,
533 };
534 
535 static const char * const gpio_groups[] = {
536 	"gpio0", "gpio1", "gpio2", "gpio3", "gpio4", "gpio5", "gpio6", "gpio7",
537 	"gpio8", "gpio9", "gpio10", "gpio11", "gpio12", "gpio13", "gpio14",
538 	"gpio15", "gpio16", "gpio17", "gpio18", "gpio19", "gpio20", "gpio21",
539 	"gpio22", "gpio23", "gpio24", "gpio25", "gpio26", "gpio27", "gpio28",
540 	"gpio29", "gpio30", "gpio31", "gpio32", "gpio33", "gpio34", "gpio35",
541 	"gpio36", "gpio37", "gpio38", "gpio39", "gpio40", "gpio41", "gpio42",
542 	"gpio43", "gpio44", "gpio45", "gpio46", "gpio47", "gpio48", "gpio49",
543 	"gpio50", "gpio51", "gpio52", "gpio53", "gpio54", "gpio55", "gpio56",
544 	"gpio57", "gpio58", "gpio59", "gpio60", "gpio61", "gpio62", "gpio63",
545 	"gpio64", "gpio65", "gpio66", "gpio67", "gpio68", "gpio69", "gpio70",
546 	"gpio71", "gpio72", "gpio73", "gpio74", "gpio75", "gpio76", "gpio77",
547 	"gpio78", "gpio79", "gpio80", "gpio81", "gpio82", "gpio83", "gpio84",
548 	"gpio85", "gpio86", "gpio87", "gpio88", "gpio89", "gpio90", "gpio91",
549 	"gpio92", "gpio93", "gpio94", "gpio95", "gpio96", "gpio97", "gpio98",
550 	"gpio99", "gpio100", "gpio101", "gpio102", "gpio103", "gpio104",
551 	"gpio105", "gpio106", "gpio107", "gpio108", "gpio109", "gpio110",
552 	"gpio111", "gpio112", "gpio113",
553 };
554 
555 static const char * const adsp_ext_groups[] = {
556 	"gpio65",
557 };
558 static const char * const agera_pll_groups[] = {
559 	"gpio34", "gpio36",
560 };
561 static const char * const atest_char0_groups[] = {
562 	"gpio62",
563 };
564 static const char * const atest_char1_groups[] = {
565 	"gpio61",
566 };
567 static const char * const atest_char2_groups[] = {
568 	"gpio60",
569 };
570 static const char * const atest_char3_groups[] = {
571 	"gpio59",
572 };
573 static const char * const atest_char_groups[] = {
574 	"gpio58",
575 };
576 static const char * const atest_gpsadc0_groups[] = {
577 	"gpio1",
578 };
579 static const char * const atest_gpsadc1_groups[] = {
580 	"gpio0",
581 };
582 static const char * const atest_tsens2_groups[] = {
583 	"gpio3",
584 };
585 static const char * const atest_tsens_groups[] = {
586 	"gpio36",
587 };
588 static const char * const atest_usb10_groups[] = {
589 	"gpio11",
590 };
591 static const char * const atest_usb11_groups[] = {
592 	"gpio10",
593 };
594 static const char * const atest_usb12_groups[] = {
595 	"gpio9",
596 };
597 static const char * const atest_usb13_groups[] = {
598 	"gpio8",
599 };
600 static const char * const atest_usb1_groups[] = {
601 	"gpio3",
602 };
603 static const char * const atest_usb20_groups[] = {
604 	"gpio56",
605 };
606 static const char * const atest_usb21_groups[] = {
607 	"gpio36",
608 };
609 static const char * const atest_usb22_groups[] = {
610 	"gpio57",
611 };
612 static const char * const atest_usb23_groups[] = {
613 	"gpio37",
614 };
615 static const char * const atest_usb2_groups[] = {
616 	"gpio35",
617 };
618 static const char * const audio_ref_groups[] = {
619 	"gpio62",
620 };
621 static const char * const bimc_dte0_groups[] = {
622 	"gpio9", "gpio11",
623 };
624 static const char * const bimc_dte1_groups[] = {
625 	"gpio8", "gpio10",
626 };
627 static const char * const blsp_i2c1_groups[] = {
628 	"gpio2", "gpio3",
629 };
630 static const char * const blsp_i2c2_groups[] = {
631 	"gpio6", "gpio7",
632 };
633 static const char * const blsp_i2c3_groups[] = {
634 	"gpio10", "gpio11",
635 };
636 static const char * const blsp_i2c4_groups[] = {
637 	"gpio14", "gpio15",
638 };
639 static const char * const blsp_i2c5_groups[] = {
640 	"gpio18", "gpio19",
641 };
642 static const char * const blsp_i2c6_groups[] = {
643 	"gpio22", "gpio23",
644 };
645 static const char * const blsp_i2c7_groups[] = {
646 	"gpio26", "gpio27",
647 };
648 static const char * const blsp_i2c8_a_groups[] = {
649 	"gpio30", "gpio31",
650 };
651 static const char * const blsp_i2c8_b_groups[] = {
652 	"gpio44", "gpio52",
653 };
654 static const char * const blsp_spi1_groups[] = {
655 	"gpio0", "gpio1", "gpio2", "gpio3", "gpio46",
656 };
657 static const char * const blsp_spi2_groups[] = {
658 	"gpio4", "gpio5", "gpio6", "gpio7",
659 };
660 static const char * const blsp_spi3_cs1_groups[] = {
661 	"gpio30",
662 };
663 static const char * const blsp_spi3_cs2_groups[] = {
664 	"gpio65",
665 };
666 static const char * const blsp_spi3_groups[] = {
667 	"gpio8", "gpio9", "gpio10", "gpio11",
668 };
669 static const char * const blsp_spi4_groups[] = {
670 	"gpio12", "gpio13", "gpio14", "gpio15",
671 };
672 static const char * const blsp_spi5_groups[] = {
673 	"gpio16", "gpio17", "gpio18", "gpio19",
674 };
675 static const char * const blsp_spi6_groups[] = {
676 	"gpio49", "gpio52", "gpio22", "gpio23",
677 };
678 static const char * const blsp_spi7_groups[] = {
679 	"gpio24", "gpio25", "gpio26", "gpio27",
680 };
681 static const char * const blsp_spi8_a_groups[] = {
682 	"gpio28", "gpio29", "gpio30", "gpio31",
683 };
684 static const char * const blsp_spi8_b_groups[] = {
685 	"gpio40", "gpio41", "gpio44", "gpio52",
686 };
687 static const char * const blsp_spi8_cs1_groups[] = {
688 	"gpio64",
689 };
690 static const char * const blsp_spi8_cs2_groups[] = {
691 	"gpio76",
692 };
693 static const char * const blsp_uart1_groups[] = {
694 	"gpio0", "gpio1", "gpio2", "gpio3",
695 };
696 static const char * const blsp_uart2_groups[] = {
697 	"gpio4", "gpio5", "gpio6", "gpio7",
698 };
699 static const char * const blsp_uart5_groups[] = {
700 	"gpio16", "gpio17", "gpio18", "gpio19",
701 };
702 static const char * const blsp_uart6_a_groups[] = {
703 	"gpio24", "gpio25", "gpio26", "gpio27",
704 };
705 static const char * const blsp_uart6_b_groups[] = {
706 	"gpio28", "gpio29", "gpio30", "gpio31",
707 };
708 static const char * const blsp_uim1_groups[] = {
709 	"gpio0", "gpio1",
710 };
711 static const char * const blsp_uim2_groups[] = {
712 	"gpio4", "gpio5",
713 };
714 static const char * const blsp_uim5_groups[] = {
715 	"gpio16", "gpio17",
716 };
717 static const char * const blsp_uim6_groups[] = {
718 	"gpio20", "gpio21",
719 };
720 static const char * const cam_mclk_groups[] = {
721 	"gpio32", "gpio33", "gpio34", "gpio35",
722 };
723 static const char * const cci_async_groups[] = {
724 	"gpio45",
725 };
726 static const char * const cci_i2c_groups[] = {
727 	"gpio36", "gpio37", "gpio38", "gpio39",
728 };
729 static const char * const cri_trng0_groups[] = {
730 	"gpio60",
731 };
732 static const char * const cri_trng1_groups[] = {
733 	"gpio61",
734 };
735 static const char * const cri_trng_groups[] = {
736 	"gpio62",
737 };
738 static const char * const dbg_out_groups[] = {
739 	"gpio11",
740 };
741 static const char * const ddr_bist_groups[] = {
742 	"gpio3", "gpio8", "gpio9", "gpio10",
743 };
744 static const char * const gcc_gp1_groups[] = {
745 	"gpio57", "gpio78",
746 };
747 static const char * const gcc_gp2_groups[] = {
748 	"gpio58", "gpio81",
749 };
750 static const char * const gcc_gp3_groups[] = {
751 	"gpio59", "gpio82",
752 };
753 static const char * const gps_tx_a_groups[] = {
754 	"gpio65",
755 };
756 static const char * const gps_tx_b_groups[] = {
757 	"gpio98",
758 };
759 static const char * const gps_tx_c_groups[] = {
760 	"gpio80",
761 };
762 static const char * const isense_dbg_groups[] = {
763 	"gpio68",
764 };
765 static const char * const jitter_bist_groups[] = {
766 	"gpio35",
767 };
768 static const char * const ldo_en_groups[] = {
769 	"gpio97",
770 };
771 static const char * const ldo_update_groups[] = {
772 	"gpio98",
773 };
774 static const char * const m_voc_groups[] = {
775 	"gpio28",
776 };
777 static const char * const mdp_vsync_groups[] = {
778 	"gpio59", "gpio74",
779 };
780 static const char * const mdss_vsync0_groups[] = {
781 	"gpio42",
782 };
783 static const char * const mdss_vsync1_groups[] = {
784 	"gpio42",
785 };
786 static const char * const mdss_vsync2_groups[] = {
787 	"gpio42",
788 };
789 static const char * const mdss_vsync3_groups[] = {
790 	"gpio42",
791 };
792 static const char * const mss_lte_groups[] = {
793 	"gpio81", "gpio82",
794 };
795 static const char * const nav_pps_a_groups[] = {
796 	"gpio65",
797 };
798 static const char * const nav_pps_b_groups[] = {
799 	"gpio98",
800 };
801 static const char * const nav_pps_c_groups[] = {
802 	"gpio80",
803 };
804 static const char * const pa_indicator_groups[] = {
805 	"gpio92",
806 };
807 static const char * const phase_flag0_groups[] = {
808 	"gpio68",
809 };
810 static const char * const phase_flag1_groups[] = {
811 	"gpio48",
812 };
813 static const char * const phase_flag2_groups[] = {
814 	"gpio49",
815 };
816 static const char * const phase_flag3_groups[] = {
817 	"gpio4",
818 };
819 static const char * const phase_flag4_groups[] = {
820 	"gpio57",
821 };
822 static const char * const phase_flag5_groups[] = {
823 	"gpio17",
824 };
825 static const char * const phase_flag6_groups[] = {
826 	"gpio53",
827 };
828 static const char * const phase_flag7_groups[] = {
829 	"gpio69",
830 };
831 static const char * const phase_flag8_groups[] = {
832 	"gpio70",
833 };
834 static const char * const phase_flag9_groups[] = {
835 	"gpio50",
836 };
837 static const char * const phase_flag10_groups[] = {
838 	"gpio56",
839 };
840 static const char * const phase_flag11_groups[] = {
841 	"gpio21",
842 };
843 static const char * const phase_flag12_groups[] = {
844 	"gpio22",
845 };
846 static const char * const phase_flag13_groups[] = {
847 	"gpio23",
848 };
849 static const char * const phase_flag14_groups[] = {
850 	"gpio5",
851 };
852 static const char * const phase_flag15_groups[] = {
853 	"gpio51",
854 };
855 static const char * const phase_flag16_groups[] = {
856 	"gpio52",
857 };
858 static const char * const phase_flag17_groups[] = {
859 	"gpio24",
860 };
861 static const char * const phase_flag18_groups[] = {
862 	"gpio25",
863 };
864 static const char * const phase_flag19_groups[] = {
865 	"gpio26",
866 };
867 static const char * const phase_flag20_groups[] = {
868 	"gpio27",
869 };
870 static const char * const phase_flag21_groups[] = {
871 	"gpio28",
872 };
873 static const char * const phase_flag22_groups[] = {
874 	"gpio29",
875 };
876 static const char * const phase_flag23_groups[] = {
877 	"gpio30",
878 };
879 static const char * const phase_flag24_groups[] = {
880 	"gpio31",
881 };
882 static const char * const phase_flag25_groups[] = {
883 	"gpio55",
884 };
885 static const char * const phase_flag26_groups[] = {
886 	"gpio12",
887 };
888 static const char * const phase_flag27_groups[] = {
889 	"gpio13",
890 };
891 static const char * const phase_flag28_groups[] = {
892 	"gpio14",
893 };
894 static const char * const phase_flag29_groups[] = {
895 	"gpio54",
896 };
897 static const char * const phase_flag30_groups[] = {
898 	"gpio47",
899 };
900 static const char * const phase_flag31_groups[] = {
901 	"gpio6",
902 };
903 static const char * const pll_bypassnl_groups[] = {
904 	"gpio36",
905 };
906 static const char * const pll_reset_groups[] = {
907 	"gpio37",
908 };
909 static const char * const pri_mi2s_groups[] = {
910 	"gpio12", "gpio14", "gpio15", "gpio61",
911 };
912 static const char * const pri_mi2s_ws_groups[] = {
913 	"gpio13",
914 };
915 static const char * const prng_rosc_groups[] = {
916 	"gpio102",
917 };
918 static const char * const pwr_crypto_groups[] = {
919 	"gpio33",
920 };
921 static const char * const pwr_modem_groups[] = {
922 	"gpio31",
923 };
924 static const char * const pwr_nav_groups[] = {
925 	"gpio32",
926 };
927 static const char * const qdss_cti0_a_groups[] = {
928 	"gpio49", "gpio50",
929 };
930 static const char * const qdss_cti0_b_groups[] = {
931 	"gpio13", "gpio21",
932 };
933 static const char * const qdss_cti1_a_groups[] = {
934 	"gpio53", "gpio55",
935 };
936 static const char * const qdss_cti1_b_groups[] = {
937 	"gpio12", "gpio66",
938 };
939 static const char * const qdss_gpio0_groups[] = {
940 	"gpio32", "gpio67",
941 };
942 static const char * const qdss_gpio10_groups[] = {
943 	"gpio43", "gpio77",
944 };
945 static const char * const qdss_gpio11_groups[] = {
946 	"gpio44", "gpio79",
947 };
948 static const char * const qdss_gpio12_groups[] = {
949 	"gpio45", "gpio80",
950 };
951 static const char * const qdss_gpio13_groups[] = {
952 	"gpio46", "gpio78",
953 };
954 static const char * const qdss_gpio14_groups[] = {
955 	"gpio47", "gpio72",
956 };
957 static const char * const qdss_gpio15_groups[] = {
958 	"gpio48", "gpio73",
959 };
960 static const char * const qdss_gpio1_groups[] = {
961 	"gpio33", "gpio63",
962 };
963 static const char * const qdss_gpio2_groups[] = {
964 	"gpio34", "gpio64",
965 };
966 static const char * const qdss_gpio3_groups[] = {
967 	"gpio35", "gpio56",
968 };
969 static const char * const qdss_gpio4_groups[] = {
970 	"gpio0", "gpio36",
971 };
972 static const char * const qdss_gpio5_groups[] = {
973 	"gpio1", "gpio37",
974 };
975 static const char * const qdss_gpio6_groups[] = {
976 	"gpio38", "gpio70",
977 };
978 static const char * const qdss_gpio7_groups[] = {
979 	"gpio39", "gpio71",
980 };
981 static const char * const qdss_gpio8_groups[] = {
982 	"gpio51", "gpio75",
983 };
984 static const char * const qdss_gpio9_groups[] = {
985 	"gpio42", "gpio76",
986 };
987 static const char * const qdss_gpio_groups[] = {
988 	"gpio31", "gpio52", "gpio68", "gpio69",
989 };
990 static const char * const qlink_enable_groups[] = {
991 	"gpio100",
992 };
993 static const char * const qlink_request_groups[] = {
994 	"gpio99",
995 };
996 static const char * const qspi_clk_groups[] = {
997 	"gpio47",
998 };
999 static const char * const qspi_cs_groups[] = {
1000 	"gpio43", "gpio50",
1001 };
1002 static const char * const qspi_data0_groups[] = {
1003 	"gpio33",
1004 };
1005 static const char * const qspi_data1_groups[] = {
1006 	"gpio34",
1007 };
1008 static const char * const qspi_data2_groups[] = {
1009 	"gpio35",
1010 };
1011 static const char * const qspi_data3_groups[] = {
1012 	"gpio51",
1013 };
1014 static const char * const qspi_resetn_groups[] = {
1015 	"gpio48",
1016 };
1017 static const char * const sec_mi2s_groups[] = {
1018 	"gpio24", "gpio25", "gpio26", "gpio27", "gpio62",
1019 };
1020 static const char * const sndwire_clk_groups[] = {
1021 	"gpio24",
1022 };
1023 static const char * const sndwire_data_groups[] = {
1024 	"gpio25",
1025 };
1026 static const char * const sp_cmu_groups[] = {
1027 	"gpio64",
1028 };
1029 static const char * const ssc_irq_groups[] = {
1030 	"gpio67", "gpio68", "gpio69", "gpio70", "gpio71", "gpio72", "gpio74",
1031 	"gpio75", "gpio76",
1032 };
1033 static const char * const tgu_ch0_groups[] = {
1034 	"gpio0",
1035 };
1036 static const char * const tgu_ch1_groups[] = {
1037 	"gpio1",
1038 };
1039 static const char * const tsense_pwm1_groups[] = {
1040 	"gpio71",
1041 };
1042 static const char * const tsense_pwm2_groups[] = {
1043 	"gpio71",
1044 };
1045 static const char * const uim1_clk_groups[] = {
1046 	"gpio88",
1047 };
1048 static const char * const uim1_data_groups[] = {
1049 	"gpio87",
1050 };
1051 static const char * const uim1_present_groups[] = {
1052 	"gpio90",
1053 };
1054 static const char * const uim1_reset_groups[] = {
1055 	"gpio89",
1056 };
1057 static const char * const uim2_clk_groups[] = {
1058 	"gpio84",
1059 };
1060 static const char * const uim2_data_groups[] = {
1061 	"gpio83",
1062 };
1063 static const char * const uim2_present_groups[] = {
1064 	"gpio86",
1065 };
1066 static const char * const uim2_reset_groups[] = {
1067 	"gpio85",
1068 };
1069 static const char * const uim_batt_groups[] = {
1070 	"gpio91",
1071 };
1072 static const char * const vfr_1_groups[] = {
1073 	"gpio27",
1074 };
1075 static const char * const vsense_clkout_groups[] = {
1076 	"gpio24",
1077 };
1078 static const char * const vsense_data0_groups[] = {
1079 	"gpio21",
1080 };
1081 static const char * const vsense_data1_groups[] = {
1082 	"gpio22",
1083 };
1084 static const char * const vsense_mode_groups[] = {
1085 	"gpio23",
1086 };
1087 static const char * const wlan1_adc0_groups[] = {
1088 	"gpio9",
1089 };
1090 static const char * const wlan1_adc1_groups[] = {
1091 	"gpio8",
1092 };
1093 static const char * const wlan2_adc0_groups[] = {
1094 	"gpio11",
1095 };
1096 static const char * const wlan2_adc1_groups[] = {
1097 	"gpio10",
1098 };
1099 
1100 static const struct msm_function sdm660_functions[] = {
1101 	FUNCTION(adsp_ext),
1102 	FUNCTION(agera_pll),
1103 	FUNCTION(atest_char),
1104 	FUNCTION(atest_char0),
1105 	FUNCTION(atest_char1),
1106 	FUNCTION(atest_char2),
1107 	FUNCTION(atest_char3),
1108 	FUNCTION(atest_gpsadc0),
1109 	FUNCTION(atest_gpsadc1),
1110 	FUNCTION(atest_tsens),
1111 	FUNCTION(atest_tsens2),
1112 	FUNCTION(atest_usb1),
1113 	FUNCTION(atest_usb10),
1114 	FUNCTION(atest_usb11),
1115 	FUNCTION(atest_usb12),
1116 	FUNCTION(atest_usb13),
1117 	FUNCTION(atest_usb2),
1118 	FUNCTION(atest_usb20),
1119 	FUNCTION(atest_usb21),
1120 	FUNCTION(atest_usb22),
1121 	FUNCTION(atest_usb23),
1122 	FUNCTION(audio_ref),
1123 	FUNCTION(bimc_dte0),
1124 	FUNCTION(bimc_dte1),
1125 	FUNCTION(blsp_i2c1),
1126 	FUNCTION(blsp_i2c2),
1127 	FUNCTION(blsp_i2c3),
1128 	FUNCTION(blsp_i2c4),
1129 	FUNCTION(blsp_i2c5),
1130 	FUNCTION(blsp_i2c6),
1131 	FUNCTION(blsp_i2c7),
1132 	FUNCTION(blsp_i2c8_a),
1133 	FUNCTION(blsp_i2c8_b),
1134 	FUNCTION(blsp_spi1),
1135 	FUNCTION(blsp_spi2),
1136 	FUNCTION(blsp_spi3),
1137 	FUNCTION(blsp_spi3_cs1),
1138 	FUNCTION(blsp_spi3_cs2),
1139 	FUNCTION(blsp_spi4),
1140 	FUNCTION(blsp_spi5),
1141 	FUNCTION(blsp_spi6),
1142 	FUNCTION(blsp_spi7),
1143 	FUNCTION(blsp_spi8_a),
1144 	FUNCTION(blsp_spi8_b),
1145 	FUNCTION(blsp_spi8_cs1),
1146 	FUNCTION(blsp_spi8_cs2),
1147 	FUNCTION(blsp_uart1),
1148 	FUNCTION(blsp_uart2),
1149 	FUNCTION(blsp_uart5),
1150 	FUNCTION(blsp_uart6_a),
1151 	FUNCTION(blsp_uart6_b),
1152 	FUNCTION(blsp_uim1),
1153 	FUNCTION(blsp_uim2),
1154 	FUNCTION(blsp_uim5),
1155 	FUNCTION(blsp_uim6),
1156 	FUNCTION(cam_mclk),
1157 	FUNCTION(cci_async),
1158 	FUNCTION(cci_i2c),
1159 	FUNCTION(cri_trng),
1160 	FUNCTION(cri_trng0),
1161 	FUNCTION(cri_trng1),
1162 	FUNCTION(dbg_out),
1163 	FUNCTION(ddr_bist),
1164 	FUNCTION(gcc_gp1),
1165 	FUNCTION(gcc_gp2),
1166 	FUNCTION(gcc_gp3),
1167 	FUNCTION(gpio),
1168 	FUNCTION(gps_tx_a),
1169 	FUNCTION(gps_tx_b),
1170 	FUNCTION(gps_tx_c),
1171 	FUNCTION(isense_dbg),
1172 	FUNCTION(jitter_bist),
1173 	FUNCTION(ldo_en),
1174 	FUNCTION(ldo_update),
1175 	FUNCTION(m_voc),
1176 	FUNCTION(mdp_vsync),
1177 	FUNCTION(mdss_vsync0),
1178 	FUNCTION(mdss_vsync1),
1179 	FUNCTION(mdss_vsync2),
1180 	FUNCTION(mdss_vsync3),
1181 	FUNCTION(mss_lte),
1182 	FUNCTION(nav_pps_a),
1183 	FUNCTION(nav_pps_b),
1184 	FUNCTION(nav_pps_c),
1185 	FUNCTION(pa_indicator),
1186 	FUNCTION(phase_flag0),
1187 	FUNCTION(phase_flag1),
1188 	FUNCTION(phase_flag2),
1189 	FUNCTION(phase_flag3),
1190 	FUNCTION(phase_flag4),
1191 	FUNCTION(phase_flag5),
1192 	FUNCTION(phase_flag6),
1193 	FUNCTION(phase_flag7),
1194 	FUNCTION(phase_flag8),
1195 	FUNCTION(phase_flag9),
1196 	FUNCTION(phase_flag10),
1197 	FUNCTION(phase_flag11),
1198 	FUNCTION(phase_flag12),
1199 	FUNCTION(phase_flag13),
1200 	FUNCTION(phase_flag14),
1201 	FUNCTION(phase_flag15),
1202 	FUNCTION(phase_flag16),
1203 	FUNCTION(phase_flag17),
1204 	FUNCTION(phase_flag18),
1205 	FUNCTION(phase_flag19),
1206 	FUNCTION(phase_flag20),
1207 	FUNCTION(phase_flag21),
1208 	FUNCTION(phase_flag22),
1209 	FUNCTION(phase_flag23),
1210 	FUNCTION(phase_flag24),
1211 	FUNCTION(phase_flag25),
1212 	FUNCTION(phase_flag26),
1213 	FUNCTION(phase_flag27),
1214 	FUNCTION(phase_flag28),
1215 	FUNCTION(phase_flag29),
1216 	FUNCTION(phase_flag30),
1217 	FUNCTION(phase_flag31),
1218 	FUNCTION(pll_bypassnl),
1219 	FUNCTION(pll_reset),
1220 	FUNCTION(pri_mi2s),
1221 	FUNCTION(pri_mi2s_ws),
1222 	FUNCTION(prng_rosc),
1223 	FUNCTION(pwr_crypto),
1224 	FUNCTION(pwr_modem),
1225 	FUNCTION(pwr_nav),
1226 	FUNCTION(qdss_cti0_a),
1227 	FUNCTION(qdss_cti0_b),
1228 	FUNCTION(qdss_cti1_a),
1229 	FUNCTION(qdss_cti1_b),
1230 	FUNCTION(qdss_gpio),
1231 	FUNCTION(qdss_gpio0),
1232 	FUNCTION(qdss_gpio1),
1233 	FUNCTION(qdss_gpio10),
1234 	FUNCTION(qdss_gpio11),
1235 	FUNCTION(qdss_gpio12),
1236 	FUNCTION(qdss_gpio13),
1237 	FUNCTION(qdss_gpio14),
1238 	FUNCTION(qdss_gpio15),
1239 	FUNCTION(qdss_gpio2),
1240 	FUNCTION(qdss_gpio3),
1241 	FUNCTION(qdss_gpio4),
1242 	FUNCTION(qdss_gpio5),
1243 	FUNCTION(qdss_gpio6),
1244 	FUNCTION(qdss_gpio7),
1245 	FUNCTION(qdss_gpio8),
1246 	FUNCTION(qdss_gpio9),
1247 	FUNCTION(qlink_enable),
1248 	FUNCTION(qlink_request),
1249 	FUNCTION(qspi_clk),
1250 	FUNCTION(qspi_cs),
1251 	FUNCTION(qspi_data0),
1252 	FUNCTION(qspi_data1),
1253 	FUNCTION(qspi_data2),
1254 	FUNCTION(qspi_data3),
1255 	FUNCTION(qspi_resetn),
1256 	FUNCTION(sec_mi2s),
1257 	FUNCTION(sndwire_clk),
1258 	FUNCTION(sndwire_data),
1259 	FUNCTION(sp_cmu),
1260 	FUNCTION(ssc_irq),
1261 	FUNCTION(tgu_ch0),
1262 	FUNCTION(tgu_ch1),
1263 	FUNCTION(tsense_pwm1),
1264 	FUNCTION(tsense_pwm2),
1265 	FUNCTION(uim1_clk),
1266 	FUNCTION(uim1_data),
1267 	FUNCTION(uim1_present),
1268 	FUNCTION(uim1_reset),
1269 	FUNCTION(uim2_clk),
1270 	FUNCTION(uim2_data),
1271 	FUNCTION(uim2_present),
1272 	FUNCTION(uim2_reset),
1273 	FUNCTION(uim_batt),
1274 	FUNCTION(vfr_1),
1275 	FUNCTION(vsense_clkout),
1276 	FUNCTION(vsense_data0),
1277 	FUNCTION(vsense_data1),
1278 	FUNCTION(vsense_mode),
1279 	FUNCTION(wlan1_adc0),
1280 	FUNCTION(wlan1_adc1),
1281 	FUNCTION(wlan2_adc0),
1282 	FUNCTION(wlan2_adc1),
1283 };
1284 
1285 static const struct msm_pingroup sdm660_groups[] = {
1286 	PINGROUP(0, SOUTH, blsp_spi1, blsp_uart1, blsp_uim1, tgu_ch0, _, _, qdss_gpio4, atest_gpsadc1, _),
1287 	PINGROUP(1, SOUTH, blsp_spi1, blsp_uart1, blsp_uim1, tgu_ch1, _, _, qdss_gpio5, atest_gpsadc0, _),
1288 	PINGROUP(2, SOUTH, blsp_spi1, blsp_uart1, blsp_i2c1, _, _, _, _, _, _),
1289 	PINGROUP(3, SOUTH, blsp_spi1, blsp_uart1, blsp_i2c1, ddr_bist, _, _, atest_tsens2, atest_usb1, _),
1290 	PINGROUP(4, NORTH, blsp_spi2, blsp_uim2, blsp_uart2, phase_flag3, _, _, _, _, _),
1291 	PINGROUP(5, SOUTH, blsp_spi2, blsp_uim2, blsp_uart2, phase_flag14, _, _, _, _, _),
1292 	PINGROUP(6, SOUTH, blsp_spi2, blsp_i2c2, blsp_uart2, phase_flag31, _, _, _, _, _),
1293 	PINGROUP(7, SOUTH, blsp_spi2, blsp_i2c2, blsp_uart2, _, _, _, _, _, _),
1294 	PINGROUP(8, NORTH, blsp_spi3, ddr_bist, _, _, _, wlan1_adc1, atest_usb13, bimc_dte1, _),
1295 	PINGROUP(9, NORTH, blsp_spi3, ddr_bist, _, _, _, wlan1_adc0, atest_usb12, bimc_dte0, _),
1296 	PINGROUP(10, NORTH, blsp_spi3, blsp_i2c3, ddr_bist, _, _, wlan2_adc1, atest_usb11, bimc_dte1, _),
1297 	PINGROUP(11, NORTH, blsp_spi3, blsp_i2c3, _, dbg_out, wlan2_adc0, atest_usb10, bimc_dte0, _, _),
1298 	PINGROUP(12, NORTH, blsp_spi4, pri_mi2s, _, phase_flag26, qdss_cti1_b, _, _, _, _),
1299 	PINGROUP(13, NORTH, blsp_spi4, _, pri_mi2s_ws, _, _, phase_flag27, qdss_cti0_b, _, _),
1300 	PINGROUP(14, NORTH, blsp_spi4, blsp_i2c4, pri_mi2s, _, phase_flag28, _, _, _, _),
1301 	PINGROUP(15, NORTH, blsp_spi4, blsp_i2c4, pri_mi2s, _, _, _, _, _, _),
1302 	PINGROUP(16, CENTER, blsp_uart5, blsp_spi5, blsp_uim5, _, _, _, _, _, _),
1303 	PINGROUP(17, CENTER, blsp_uart5, blsp_spi5, blsp_uim5, _, phase_flag5, _, _, _, _),
1304 	PINGROUP(18, CENTER, blsp_uart5, blsp_spi5, blsp_i2c5, _, _, _, _, _, _),
1305 	PINGROUP(19, CENTER, blsp_uart5, blsp_spi5, blsp_i2c5, _, _, _, _, _, _),
1306 	PINGROUP(20, SOUTH, _, _, blsp_uim6, _, _, _, _, _, _),
1307 	PINGROUP(21, SOUTH, _, _, blsp_uim6, _, phase_flag11, qdss_cti0_b, vsense_data0, _, _),
1308 	PINGROUP(22, CENTER, blsp_spi6, _, blsp_i2c6, _, phase_flag12, vsense_data1, _, _, _),
1309 	PINGROUP(23, CENTER, blsp_spi6, _, blsp_i2c6, _, phase_flag13, vsense_mode, _, _, _),
1310 	PINGROUP(24, NORTH, blsp_spi7, blsp_uart6_a, sec_mi2s, sndwire_clk, _, _, phase_flag17, vsense_clkout, _),
1311 	PINGROUP(25, NORTH, blsp_spi7, blsp_uart6_a, sec_mi2s, sndwire_data, _, _, phase_flag18, _, _),
1312 	PINGROUP(26, NORTH, blsp_spi7, blsp_uart6_a, blsp_i2c7, sec_mi2s, _, phase_flag19, _, _, _),
1313 	PINGROUP(27, NORTH, blsp_spi7, blsp_uart6_a, blsp_i2c7, vfr_1, sec_mi2s, _, phase_flag20, _, _),
1314 	PINGROUP(28, CENTER, blsp_spi8_a, blsp_uart6_b, m_voc, _, phase_flag21, _, _, _, _),
1315 	PINGROUP(29, CENTER, blsp_spi8_a, blsp_uart6_b, _, _, phase_flag22, _, _, _, _),
1316 	PINGROUP(30, CENTER, blsp_spi8_a, blsp_uart6_b, blsp_i2c8_a, blsp_spi3_cs1, _, phase_flag23, _, _, _),
1317 	PINGROUP(31, CENTER, blsp_spi8_a, blsp_uart6_b, blsp_i2c8_a, pwr_modem, _, phase_flag24, qdss_gpio, _, _),
1318 	PINGROUP(32, SOUTH, cam_mclk, pwr_nav, _, _, qdss_gpio0, _, _, _, _),
1319 	PINGROUP(33, SOUTH, cam_mclk, qspi_data0, pwr_crypto, _, _, qdss_gpio1, _, _, _),
1320 	PINGROUP(34, SOUTH, cam_mclk, qspi_data1, agera_pll, _, _, qdss_gpio2, _, _, _),
1321 	PINGROUP(35, SOUTH, cam_mclk, qspi_data2, jitter_bist, _, _, qdss_gpio3, _, atest_usb2, _),
1322 	PINGROUP(36, SOUTH, cci_i2c, pll_bypassnl, agera_pll, _, _, qdss_gpio4, atest_tsens, atest_usb21, _),
1323 	PINGROUP(37, SOUTH, cci_i2c, pll_reset, _, _, qdss_gpio5, atest_usb23, _, _, _),
1324 	PINGROUP(38, SOUTH, cci_i2c, _, _, qdss_gpio6, _, _, _, _, _),
1325 	PINGROUP(39, SOUTH, cci_i2c, _, _, qdss_gpio7, _, _, _, _, _),
1326 	PINGROUP(40, SOUTH, _, _, blsp_spi8_b, _, _, _, _, _, _),
1327 	PINGROUP(41, SOUTH, _, _, blsp_spi8_b, _, _, _, _, _, _),
1328 	PINGROUP(42, SOUTH, mdss_vsync0, mdss_vsync1, mdss_vsync2, mdss_vsync3, _, _, qdss_gpio9, _, _),
1329 	PINGROUP(43, SOUTH, _, _, qspi_cs, _, _, qdss_gpio10, _, _, _),
1330 	PINGROUP(44, SOUTH, _, _, blsp_spi8_b, blsp_i2c8_b, _, _, qdss_gpio11, _, _),
1331 	PINGROUP(45, SOUTH, cci_async, _, _, qdss_gpio12, _, _, _, _, _),
1332 	PINGROUP(46, SOUTH, blsp_spi1, _, _, qdss_gpio13, _, _, _, _, _),
1333 	PINGROUP(47, SOUTH, qspi_clk, _, phase_flag30, qdss_gpio14, _, _, _, _, _),
1334 	PINGROUP(48, SOUTH, _, phase_flag1, qdss_gpio15, _, _, _, _, _, _),
1335 	PINGROUP(49, SOUTH, blsp_spi6, phase_flag2, qdss_cti0_a, _, _, _, _, _, _),
1336 	PINGROUP(50, SOUTH, qspi_cs, _, phase_flag9, qdss_cti0_a, _, _, _, _, _),
1337 	PINGROUP(51, SOUTH, qspi_data3, _, phase_flag15, qdss_gpio8, _, _, _, _, _),
1338 	PINGROUP(52, SOUTH, _, blsp_spi8_b, blsp_i2c8_b, blsp_spi6, phase_flag16, qdss_gpio, _, _, _),
1339 	PINGROUP(53, NORTH, _, phase_flag6, qdss_cti1_a, _, _, _, _, _, _),
1340 	PINGROUP(54, NORTH, _, _, phase_flag29, _, _, _, _, _, _),
1341 	PINGROUP(55, SOUTH, _, phase_flag25, qdss_cti1_a, _, _, _, _, _, _),
1342 	PINGROUP(56, SOUTH, _, phase_flag10, qdss_gpio3, _, atest_usb20, _, _, _, _),
1343 	PINGROUP(57, SOUTH, gcc_gp1, _, phase_flag4, atest_usb22, _, _, _, _, _),
1344 	PINGROUP(58, SOUTH, _, gcc_gp2, _, _, atest_char, _, _, _, _),
1345 	PINGROUP(59, NORTH, mdp_vsync, gcc_gp3, _, _, atest_char3, _, _, _, _),
1346 	PINGROUP(60, NORTH, cri_trng0, _, _, atest_char2, _, _, _, _, _),
1347 	PINGROUP(61, NORTH, pri_mi2s, cri_trng1, _, _, atest_char1, _, _, _, _),
1348 	PINGROUP(62, NORTH, sec_mi2s, audio_ref, _, cri_trng, _, _, atest_char0, _, _),
1349 	PINGROUP(63, NORTH, _, _, _, qdss_gpio1, _, _, _, _, _),
1350 	PINGROUP(64, SOUTH, blsp_spi8_cs1, sp_cmu, _, _, qdss_gpio2, _, _, _, _),
1351 	PINGROUP(65, SOUTH, _, nav_pps_a, nav_pps_a, gps_tx_a, blsp_spi3_cs2, adsp_ext, _, _, _),
1352 	PINGROUP(66, NORTH, _, _, qdss_cti1_b, _, _, _, _, _, _),
1353 	PINGROUP(67, NORTH, _, _, qdss_gpio0, _, _, _, _, _, _),
1354 	PINGROUP(68, NORTH, isense_dbg, _, phase_flag0, qdss_gpio, _, _, _, _, _),
1355 	PINGROUP(69, NORTH, _, phase_flag7, qdss_gpio, _, _, _, _, _, _),
1356 	PINGROUP(70, NORTH, _, phase_flag8, qdss_gpio6, _, _, _, _, _, _),
1357 	PINGROUP(71, NORTH, _, _, qdss_gpio7, tsense_pwm1, tsense_pwm2, _, _, _, _),
1358 	PINGROUP(72, NORTH, _, qdss_gpio14, _, _, _, _, _, _, _),
1359 	PINGROUP(73, NORTH, _, _, qdss_gpio15, _, _, _, _, _, _),
1360 	PINGROUP(74, NORTH, mdp_vsync, _, _, _, _, _, _, _, _),
1361 	PINGROUP(75, NORTH, _, _, qdss_gpio8, _, _, _, _, _, _),
1362 	PINGROUP(76, NORTH, blsp_spi8_cs2, _, _, _, qdss_gpio9, _, _, _, _),
1363 	PINGROUP(77, NORTH, _, _, qdss_gpio10, _, _, _, _, _, _),
1364 	PINGROUP(78, NORTH, gcc_gp1, _, qdss_gpio13, _, _, _, _, _, _),
1365 	PINGROUP(79, SOUTH, _, _, qdss_gpio11, _, _, _, _, _, _),
1366 	PINGROUP(80, SOUTH, nav_pps_b, nav_pps_b, gps_tx_c, _, _, qdss_gpio12, _, _, _),
1367 	PINGROUP(81, CENTER, mss_lte, gcc_gp2, _, _, _, _, _, _, _),
1368 	PINGROUP(82, CENTER, mss_lte, gcc_gp3, _, _, _, _, _, _, _),
1369 	PINGROUP(83, SOUTH, uim2_data, _, _, _, _, _, _, _, _),
1370 	PINGROUP(84, SOUTH, uim2_clk, _, _, _, _, _, _, _, _),
1371 	PINGROUP(85, SOUTH, uim2_reset, _, _, _, _, _, _, _, _),
1372 	PINGROUP(86, SOUTH, uim2_present, _, _, _, _, _, _, _, _),
1373 	PINGROUP(87, SOUTH, uim1_data, _, _, _, _, _, _, _, _),
1374 	PINGROUP(88, SOUTH, uim1_clk, _, _, _, _, _, _, _, _),
1375 	PINGROUP(89, SOUTH, uim1_reset, _, _, _, _, _, _, _, _),
1376 	PINGROUP(90, SOUTH, uim1_present, _, _, _, _, _, _, _, _),
1377 	PINGROUP(91, SOUTH, uim_batt, _, _, _, _, _, _, _, _),
1378 	PINGROUP(92, SOUTH, _, _, pa_indicator, _, _, _, _, _, _),
1379 	PINGROUP(93, SOUTH, _, _, _, _, _, _, _, _, _),
1380 	PINGROUP(94, SOUTH, _, _, _, _, _, _, _, _, _),
1381 	PINGROUP(95, SOUTH, _, _, _, _, _, _, _, _, _),
1382 	PINGROUP(96, SOUTH, _, _, _, _, _, _, _, _, _),
1383 	PINGROUP(97, SOUTH, _, ldo_en, _, _, _, _, _, _, _),
1384 	PINGROUP(98, SOUTH, _, nav_pps_c, nav_pps_c, gps_tx_b, ldo_update, _, _, _, _),
1385 	PINGROUP(99, SOUTH, qlink_request, _, _, _, _, _, _, _, _),
1386 	PINGROUP(100, SOUTH, qlink_enable, _, _, _, _, _, _, _, _),
1387 	PINGROUP(101, SOUTH, _, _, _, _, _, _, _, _, _),
1388 	PINGROUP(102, SOUTH, _, prng_rosc, _, _, _, _, _, _, _),
1389 	PINGROUP(103, SOUTH, _, _, _, _, _, _, _, _, _),
1390 	PINGROUP(104, SOUTH, _, _, _, _, _, _, _, _, _),
1391 	PINGROUP(105, SOUTH, _, _, _, _, _, _, _, _, _),
1392 	PINGROUP(106, SOUTH, _, _, _, _, _, _, _, _, _),
1393 	PINGROUP(107, SOUTH, _, _, _, _, _, _, _, _, _),
1394 	PINGROUP(108, SOUTH, _, _, _, _, _, _, _, _, _),
1395 	PINGROUP(109, SOUTH, _, _, _, _, _, _, _, _, _),
1396 	PINGROUP(110, SOUTH, _, _, _, _, _, _, _, _, _),
1397 	PINGROUP(111, SOUTH, _, _, _, _, _, _, _, _, _),
1398 	PINGROUP(112, SOUTH, _, _, _, _, _, _, _, _, _),
1399 	PINGROUP(113, SOUTH, _, _, _, _, _, _, _, _, _),
1400 	SDC_QDSD_PINGROUP(sdc1_clk, 0x99a000, 13, 6),
1401 	SDC_QDSD_PINGROUP(sdc1_cmd, 0x99a000, 11, 3),
1402 	SDC_QDSD_PINGROUP(sdc1_data, 0x99a000, 9, 0),
1403 	SDC_QDSD_PINGROUP(sdc2_clk, 0x99b000, 14, 6),
1404 	SDC_QDSD_PINGROUP(sdc2_cmd, 0x99b000, 11, 3),
1405 	SDC_QDSD_PINGROUP(sdc2_data, 0x99b000, 9, 0),
1406 	SDC_QDSD_PINGROUP(sdc1_rclk, 0x99a000, 15, 0),
1407 };
1408 
1409 static const struct msm_pinctrl_soc_data sdm660_pinctrl = {
1410 	.pins = sdm660_pins,
1411 	.npins = ARRAY_SIZE(sdm660_pins),
1412 	.functions = sdm660_functions,
1413 	.nfunctions = ARRAY_SIZE(sdm660_functions),
1414 	.groups = sdm660_groups,
1415 	.ngroups = ARRAY_SIZE(sdm660_groups),
1416 	.ngpios = 114,
1417 	.tiles = sdm660_tiles,
1418 	.ntiles = ARRAY_SIZE(sdm660_tiles),
1419 };
1420 
1421 static int sdm660_pinctrl_probe(struct platform_device *pdev)
1422 {
1423 	return msm_pinctrl_probe(pdev, &sdm660_pinctrl);
1424 }
1425 
1426 static const struct of_device_id sdm660_pinctrl_of_match[] = {
1427 	{ .compatible = "qcom,sdm660-pinctrl", },
1428 	{ .compatible = "qcom,sdm630-pinctrl", },
1429 	{ },
1430 };
1431 
1432 static struct platform_driver sdm660_pinctrl_driver = {
1433 	.driver = {
1434 		.name = "sdm660-pinctrl",
1435 		.of_match_table = sdm660_pinctrl_of_match,
1436 	},
1437 	.probe = sdm660_pinctrl_probe,
1438 	.remove = msm_pinctrl_remove,
1439 };
1440 
1441 static int __init sdm660_pinctrl_init(void)
1442 {
1443 	return platform_driver_register(&sdm660_pinctrl_driver);
1444 }
1445 arch_initcall(sdm660_pinctrl_init);
1446 
1447 static void __exit sdm660_pinctrl_exit(void)
1448 {
1449 	platform_driver_unregister(&sdm660_pinctrl_driver);
1450 }
1451 module_exit(sdm660_pinctrl_exit);
1452 
1453 MODULE_DESCRIPTION("QTI sdm660 pinctrl driver");
1454 MODULE_LICENSE("GPL v2");
1455 MODULE_DEVICE_TABLE(of, sdm660_pinctrl_of_match);
1456