1 // SPDX-License-Identifier: GPL-2.0-only
2 /*
3  * Copyright (c) 2014, Sony Mobile Communications AB.
4  */
5 
6 #include <linux/module.h>
7 #include <linux/of.h>
8 #include <linux/platform_device.h>
9 #include <linux/pinctrl/pinmux.h>
10 
11 #include "pinctrl-msm.h"
12 
13 static const struct pinctrl_pin_desc msm8960_pins[] = {
14 	PINCTRL_PIN(0, "GPIO_0"),
15 	PINCTRL_PIN(1, "GPIO_1"),
16 	PINCTRL_PIN(2, "GPIO_2"),
17 	PINCTRL_PIN(3, "GPIO_3"),
18 	PINCTRL_PIN(4, "GPIO_4"),
19 	PINCTRL_PIN(5, "GPIO_5"),
20 	PINCTRL_PIN(6, "GPIO_6"),
21 	PINCTRL_PIN(7, "GPIO_7"),
22 	PINCTRL_PIN(8, "GPIO_8"),
23 	PINCTRL_PIN(9, "GPIO_9"),
24 	PINCTRL_PIN(10, "GPIO_10"),
25 	PINCTRL_PIN(11, "GPIO_11"),
26 	PINCTRL_PIN(12, "GPIO_12"),
27 	PINCTRL_PIN(13, "GPIO_13"),
28 	PINCTRL_PIN(14, "GPIO_14"),
29 	PINCTRL_PIN(15, "GPIO_15"),
30 	PINCTRL_PIN(16, "GPIO_16"),
31 	PINCTRL_PIN(17, "GPIO_17"),
32 	PINCTRL_PIN(18, "GPIO_18"),
33 	PINCTRL_PIN(19, "GPIO_19"),
34 	PINCTRL_PIN(20, "GPIO_20"),
35 	PINCTRL_PIN(21, "GPIO_21"),
36 	PINCTRL_PIN(22, "GPIO_22"),
37 	PINCTRL_PIN(23, "GPIO_23"),
38 	PINCTRL_PIN(24, "GPIO_24"),
39 	PINCTRL_PIN(25, "GPIO_25"),
40 	PINCTRL_PIN(26, "GPIO_26"),
41 	PINCTRL_PIN(27, "GPIO_27"),
42 	PINCTRL_PIN(28, "GPIO_28"),
43 	PINCTRL_PIN(29, "GPIO_29"),
44 	PINCTRL_PIN(30, "GPIO_30"),
45 	PINCTRL_PIN(31, "GPIO_31"),
46 	PINCTRL_PIN(32, "GPIO_32"),
47 	PINCTRL_PIN(33, "GPIO_33"),
48 	PINCTRL_PIN(34, "GPIO_34"),
49 	PINCTRL_PIN(35, "GPIO_35"),
50 	PINCTRL_PIN(36, "GPIO_36"),
51 	PINCTRL_PIN(37, "GPIO_37"),
52 	PINCTRL_PIN(38, "GPIO_38"),
53 	PINCTRL_PIN(39, "GPIO_39"),
54 	PINCTRL_PIN(40, "GPIO_40"),
55 	PINCTRL_PIN(41, "GPIO_41"),
56 	PINCTRL_PIN(42, "GPIO_42"),
57 	PINCTRL_PIN(43, "GPIO_43"),
58 	PINCTRL_PIN(44, "GPIO_44"),
59 	PINCTRL_PIN(45, "GPIO_45"),
60 	PINCTRL_PIN(46, "GPIO_46"),
61 	PINCTRL_PIN(47, "GPIO_47"),
62 	PINCTRL_PIN(48, "GPIO_48"),
63 	PINCTRL_PIN(49, "GPIO_49"),
64 	PINCTRL_PIN(50, "GPIO_50"),
65 	PINCTRL_PIN(51, "GPIO_51"),
66 	PINCTRL_PIN(52, "GPIO_52"),
67 	PINCTRL_PIN(53, "GPIO_53"),
68 	PINCTRL_PIN(54, "GPIO_54"),
69 	PINCTRL_PIN(55, "GPIO_55"),
70 	PINCTRL_PIN(56, "GPIO_56"),
71 	PINCTRL_PIN(57, "GPIO_57"),
72 	PINCTRL_PIN(58, "GPIO_58"),
73 	PINCTRL_PIN(59, "GPIO_59"),
74 	PINCTRL_PIN(60, "GPIO_60"),
75 	PINCTRL_PIN(61, "GPIO_61"),
76 	PINCTRL_PIN(62, "GPIO_62"),
77 	PINCTRL_PIN(63, "GPIO_63"),
78 	PINCTRL_PIN(64, "GPIO_64"),
79 	PINCTRL_PIN(65, "GPIO_65"),
80 	PINCTRL_PIN(66, "GPIO_66"),
81 	PINCTRL_PIN(67, "GPIO_67"),
82 	PINCTRL_PIN(68, "GPIO_68"),
83 	PINCTRL_PIN(69, "GPIO_69"),
84 	PINCTRL_PIN(70, "GPIO_70"),
85 	PINCTRL_PIN(71, "GPIO_71"),
86 	PINCTRL_PIN(72, "GPIO_72"),
87 	PINCTRL_PIN(73, "GPIO_73"),
88 	PINCTRL_PIN(74, "GPIO_74"),
89 	PINCTRL_PIN(75, "GPIO_75"),
90 	PINCTRL_PIN(76, "GPIO_76"),
91 	PINCTRL_PIN(77, "GPIO_77"),
92 	PINCTRL_PIN(78, "GPIO_78"),
93 	PINCTRL_PIN(79, "GPIO_79"),
94 	PINCTRL_PIN(80, "GPIO_80"),
95 	PINCTRL_PIN(81, "GPIO_81"),
96 	PINCTRL_PIN(82, "GPIO_82"),
97 	PINCTRL_PIN(83, "GPIO_83"),
98 	PINCTRL_PIN(84, "GPIO_84"),
99 	PINCTRL_PIN(85, "GPIO_85"),
100 	PINCTRL_PIN(86, "GPIO_86"),
101 	PINCTRL_PIN(87, "GPIO_87"),
102 	PINCTRL_PIN(88, "GPIO_88"),
103 	PINCTRL_PIN(89, "GPIO_89"),
104 	PINCTRL_PIN(90, "GPIO_90"),
105 	PINCTRL_PIN(91, "GPIO_91"),
106 	PINCTRL_PIN(92, "GPIO_92"),
107 	PINCTRL_PIN(93, "GPIO_93"),
108 	PINCTRL_PIN(94, "GPIO_94"),
109 	PINCTRL_PIN(95, "GPIO_95"),
110 	PINCTRL_PIN(96, "GPIO_96"),
111 	PINCTRL_PIN(97, "GPIO_97"),
112 	PINCTRL_PIN(98, "GPIO_98"),
113 	PINCTRL_PIN(99, "GPIO_99"),
114 	PINCTRL_PIN(100, "GPIO_100"),
115 	PINCTRL_PIN(101, "GPIO_101"),
116 	PINCTRL_PIN(102, "GPIO_102"),
117 	PINCTRL_PIN(103, "GPIO_103"),
118 	PINCTRL_PIN(104, "GPIO_104"),
119 	PINCTRL_PIN(105, "GPIO_105"),
120 	PINCTRL_PIN(106, "GPIO_106"),
121 	PINCTRL_PIN(107, "GPIO_107"),
122 	PINCTRL_PIN(108, "GPIO_108"),
123 	PINCTRL_PIN(109, "GPIO_109"),
124 	PINCTRL_PIN(110, "GPIO_110"),
125 	PINCTRL_PIN(111, "GPIO_111"),
126 	PINCTRL_PIN(112, "GPIO_112"),
127 	PINCTRL_PIN(113, "GPIO_113"),
128 	PINCTRL_PIN(114, "GPIO_114"),
129 	PINCTRL_PIN(115, "GPIO_115"),
130 	PINCTRL_PIN(116, "GPIO_116"),
131 	PINCTRL_PIN(117, "GPIO_117"),
132 	PINCTRL_PIN(118, "GPIO_118"),
133 	PINCTRL_PIN(119, "GPIO_119"),
134 	PINCTRL_PIN(120, "GPIO_120"),
135 	PINCTRL_PIN(121, "GPIO_121"),
136 	PINCTRL_PIN(122, "GPIO_122"),
137 	PINCTRL_PIN(123, "GPIO_123"),
138 	PINCTRL_PIN(124, "GPIO_124"),
139 	PINCTRL_PIN(125, "GPIO_125"),
140 	PINCTRL_PIN(126, "GPIO_126"),
141 	PINCTRL_PIN(127, "GPIO_127"),
142 	PINCTRL_PIN(128, "GPIO_128"),
143 	PINCTRL_PIN(129, "GPIO_129"),
144 	PINCTRL_PIN(130, "GPIO_130"),
145 	PINCTRL_PIN(131, "GPIO_131"),
146 	PINCTRL_PIN(132, "GPIO_132"),
147 	PINCTRL_PIN(133, "GPIO_133"),
148 	PINCTRL_PIN(134, "GPIO_134"),
149 	PINCTRL_PIN(135, "GPIO_135"),
150 	PINCTRL_PIN(136, "GPIO_136"),
151 	PINCTRL_PIN(137, "GPIO_137"),
152 	PINCTRL_PIN(138, "GPIO_138"),
153 	PINCTRL_PIN(139, "GPIO_139"),
154 	PINCTRL_PIN(140, "GPIO_140"),
155 	PINCTRL_PIN(141, "GPIO_141"),
156 	PINCTRL_PIN(142, "GPIO_142"),
157 	PINCTRL_PIN(143, "GPIO_143"),
158 	PINCTRL_PIN(144, "GPIO_144"),
159 	PINCTRL_PIN(145, "GPIO_145"),
160 	PINCTRL_PIN(146, "GPIO_146"),
161 	PINCTRL_PIN(147, "GPIO_147"),
162 	PINCTRL_PIN(148, "GPIO_148"),
163 	PINCTRL_PIN(149, "GPIO_149"),
164 	PINCTRL_PIN(150, "GPIO_150"),
165 	PINCTRL_PIN(151, "GPIO_151"),
166 
167 	PINCTRL_PIN(152, "SDC1_CLK"),
168 	PINCTRL_PIN(153, "SDC1_CMD"),
169 	PINCTRL_PIN(154, "SDC1_DATA"),
170 	PINCTRL_PIN(155, "SDC3_CLK"),
171 	PINCTRL_PIN(156, "SDC3_CMD"),
172 	PINCTRL_PIN(157, "SDC3_DATA"),
173 };
174 
175 #define DECLARE_MSM_GPIO_PINS(pin) static const unsigned int gpio##pin##_pins[] = { pin }
176 DECLARE_MSM_GPIO_PINS(0);
177 DECLARE_MSM_GPIO_PINS(1);
178 DECLARE_MSM_GPIO_PINS(2);
179 DECLARE_MSM_GPIO_PINS(3);
180 DECLARE_MSM_GPIO_PINS(4);
181 DECLARE_MSM_GPIO_PINS(5);
182 DECLARE_MSM_GPIO_PINS(6);
183 DECLARE_MSM_GPIO_PINS(7);
184 DECLARE_MSM_GPIO_PINS(8);
185 DECLARE_MSM_GPIO_PINS(9);
186 DECLARE_MSM_GPIO_PINS(10);
187 DECLARE_MSM_GPIO_PINS(11);
188 DECLARE_MSM_GPIO_PINS(12);
189 DECLARE_MSM_GPIO_PINS(13);
190 DECLARE_MSM_GPIO_PINS(14);
191 DECLARE_MSM_GPIO_PINS(15);
192 DECLARE_MSM_GPIO_PINS(16);
193 DECLARE_MSM_GPIO_PINS(17);
194 DECLARE_MSM_GPIO_PINS(18);
195 DECLARE_MSM_GPIO_PINS(19);
196 DECLARE_MSM_GPIO_PINS(20);
197 DECLARE_MSM_GPIO_PINS(21);
198 DECLARE_MSM_GPIO_PINS(22);
199 DECLARE_MSM_GPIO_PINS(23);
200 DECLARE_MSM_GPIO_PINS(24);
201 DECLARE_MSM_GPIO_PINS(25);
202 DECLARE_MSM_GPIO_PINS(26);
203 DECLARE_MSM_GPIO_PINS(27);
204 DECLARE_MSM_GPIO_PINS(28);
205 DECLARE_MSM_GPIO_PINS(29);
206 DECLARE_MSM_GPIO_PINS(30);
207 DECLARE_MSM_GPIO_PINS(31);
208 DECLARE_MSM_GPIO_PINS(32);
209 DECLARE_MSM_GPIO_PINS(33);
210 DECLARE_MSM_GPIO_PINS(34);
211 DECLARE_MSM_GPIO_PINS(35);
212 DECLARE_MSM_GPIO_PINS(36);
213 DECLARE_MSM_GPIO_PINS(37);
214 DECLARE_MSM_GPIO_PINS(38);
215 DECLARE_MSM_GPIO_PINS(39);
216 DECLARE_MSM_GPIO_PINS(40);
217 DECLARE_MSM_GPIO_PINS(41);
218 DECLARE_MSM_GPIO_PINS(42);
219 DECLARE_MSM_GPIO_PINS(43);
220 DECLARE_MSM_GPIO_PINS(44);
221 DECLARE_MSM_GPIO_PINS(45);
222 DECLARE_MSM_GPIO_PINS(46);
223 DECLARE_MSM_GPIO_PINS(47);
224 DECLARE_MSM_GPIO_PINS(48);
225 DECLARE_MSM_GPIO_PINS(49);
226 DECLARE_MSM_GPIO_PINS(50);
227 DECLARE_MSM_GPIO_PINS(51);
228 DECLARE_MSM_GPIO_PINS(52);
229 DECLARE_MSM_GPIO_PINS(53);
230 DECLARE_MSM_GPIO_PINS(54);
231 DECLARE_MSM_GPIO_PINS(55);
232 DECLARE_MSM_GPIO_PINS(56);
233 DECLARE_MSM_GPIO_PINS(57);
234 DECLARE_MSM_GPIO_PINS(58);
235 DECLARE_MSM_GPIO_PINS(59);
236 DECLARE_MSM_GPIO_PINS(60);
237 DECLARE_MSM_GPIO_PINS(61);
238 DECLARE_MSM_GPIO_PINS(62);
239 DECLARE_MSM_GPIO_PINS(63);
240 DECLARE_MSM_GPIO_PINS(64);
241 DECLARE_MSM_GPIO_PINS(65);
242 DECLARE_MSM_GPIO_PINS(66);
243 DECLARE_MSM_GPIO_PINS(67);
244 DECLARE_MSM_GPIO_PINS(68);
245 DECLARE_MSM_GPIO_PINS(69);
246 DECLARE_MSM_GPIO_PINS(70);
247 DECLARE_MSM_GPIO_PINS(71);
248 DECLARE_MSM_GPIO_PINS(72);
249 DECLARE_MSM_GPIO_PINS(73);
250 DECLARE_MSM_GPIO_PINS(74);
251 DECLARE_MSM_GPIO_PINS(75);
252 DECLARE_MSM_GPIO_PINS(76);
253 DECLARE_MSM_GPIO_PINS(77);
254 DECLARE_MSM_GPIO_PINS(78);
255 DECLARE_MSM_GPIO_PINS(79);
256 DECLARE_MSM_GPIO_PINS(80);
257 DECLARE_MSM_GPIO_PINS(81);
258 DECLARE_MSM_GPIO_PINS(82);
259 DECLARE_MSM_GPIO_PINS(83);
260 DECLARE_MSM_GPIO_PINS(84);
261 DECLARE_MSM_GPIO_PINS(85);
262 DECLARE_MSM_GPIO_PINS(86);
263 DECLARE_MSM_GPIO_PINS(87);
264 DECLARE_MSM_GPIO_PINS(88);
265 DECLARE_MSM_GPIO_PINS(89);
266 DECLARE_MSM_GPIO_PINS(90);
267 DECLARE_MSM_GPIO_PINS(91);
268 DECLARE_MSM_GPIO_PINS(92);
269 DECLARE_MSM_GPIO_PINS(93);
270 DECLARE_MSM_GPIO_PINS(94);
271 DECLARE_MSM_GPIO_PINS(95);
272 DECLARE_MSM_GPIO_PINS(96);
273 DECLARE_MSM_GPIO_PINS(97);
274 DECLARE_MSM_GPIO_PINS(98);
275 DECLARE_MSM_GPIO_PINS(99);
276 DECLARE_MSM_GPIO_PINS(100);
277 DECLARE_MSM_GPIO_PINS(101);
278 DECLARE_MSM_GPIO_PINS(102);
279 DECLARE_MSM_GPIO_PINS(103);
280 DECLARE_MSM_GPIO_PINS(104);
281 DECLARE_MSM_GPIO_PINS(105);
282 DECLARE_MSM_GPIO_PINS(106);
283 DECLARE_MSM_GPIO_PINS(107);
284 DECLARE_MSM_GPIO_PINS(108);
285 DECLARE_MSM_GPIO_PINS(109);
286 DECLARE_MSM_GPIO_PINS(110);
287 DECLARE_MSM_GPIO_PINS(111);
288 DECLARE_MSM_GPIO_PINS(112);
289 DECLARE_MSM_GPIO_PINS(113);
290 DECLARE_MSM_GPIO_PINS(114);
291 DECLARE_MSM_GPIO_PINS(115);
292 DECLARE_MSM_GPIO_PINS(116);
293 DECLARE_MSM_GPIO_PINS(117);
294 DECLARE_MSM_GPIO_PINS(118);
295 DECLARE_MSM_GPIO_PINS(119);
296 DECLARE_MSM_GPIO_PINS(120);
297 DECLARE_MSM_GPIO_PINS(121);
298 DECLARE_MSM_GPIO_PINS(122);
299 DECLARE_MSM_GPIO_PINS(123);
300 DECLARE_MSM_GPIO_PINS(124);
301 DECLARE_MSM_GPIO_PINS(125);
302 DECLARE_MSM_GPIO_PINS(126);
303 DECLARE_MSM_GPIO_PINS(127);
304 DECLARE_MSM_GPIO_PINS(128);
305 DECLARE_MSM_GPIO_PINS(129);
306 DECLARE_MSM_GPIO_PINS(130);
307 DECLARE_MSM_GPIO_PINS(131);
308 DECLARE_MSM_GPIO_PINS(132);
309 DECLARE_MSM_GPIO_PINS(133);
310 DECLARE_MSM_GPIO_PINS(134);
311 DECLARE_MSM_GPIO_PINS(135);
312 DECLARE_MSM_GPIO_PINS(136);
313 DECLARE_MSM_GPIO_PINS(137);
314 DECLARE_MSM_GPIO_PINS(138);
315 DECLARE_MSM_GPIO_PINS(139);
316 DECLARE_MSM_GPIO_PINS(140);
317 DECLARE_MSM_GPIO_PINS(141);
318 DECLARE_MSM_GPIO_PINS(142);
319 DECLARE_MSM_GPIO_PINS(143);
320 DECLARE_MSM_GPIO_PINS(144);
321 DECLARE_MSM_GPIO_PINS(145);
322 DECLARE_MSM_GPIO_PINS(146);
323 DECLARE_MSM_GPIO_PINS(147);
324 DECLARE_MSM_GPIO_PINS(148);
325 DECLARE_MSM_GPIO_PINS(149);
326 DECLARE_MSM_GPIO_PINS(150);
327 DECLARE_MSM_GPIO_PINS(151);
328 
329 static const unsigned int sdc1_clk_pins[] = { 152 };
330 static const unsigned int sdc1_cmd_pins[] = { 153 };
331 static const unsigned int sdc1_data_pins[] = { 154 };
332 static const unsigned int sdc3_clk_pins[] = { 155 };
333 static const unsigned int sdc3_cmd_pins[] = { 156 };
334 static const unsigned int sdc3_data_pins[] = { 157 };
335 
336 #define PINGROUP(id, f1, f2, f3, f4, f5, f6, f7, f8, f9, f10, f11) \
337 	{						\
338 		.grp = PINCTRL_PINGROUP("gpio" #id, 	\
339 			gpio##id##_pins, 		\
340 			ARRAY_SIZE(gpio##id##_pins)),	\
341 		.funcs = (int[]){			\
342 			msm_mux_gpio,			\
343 			msm_mux_##f1,			\
344 			msm_mux_##f2,			\
345 			msm_mux_##f3,			\
346 			msm_mux_##f4,			\
347 			msm_mux_##f5,			\
348 			msm_mux_##f6,			\
349 			msm_mux_##f7,			\
350 			msm_mux_##f8,			\
351 			msm_mux_##f9,			\
352 			msm_mux_##f10,			\
353 			msm_mux_##f11			\
354 		},					\
355 		.nfuncs = 12,				\
356 		.ctl_reg = 0x1000 + 0x10 * id,		\
357 		.io_reg = 0x1004 + 0x10 * id,		\
358 		.intr_cfg_reg = 0x1008 + 0x10 * id,	\
359 		.intr_status_reg = 0x100c + 0x10 * id,	\
360 		.intr_target_reg = 0x400 + 0x4 * id,	\
361 		.mux_bit = 2,				\
362 		.pull_bit = 0,				\
363 		.drv_bit = 6,				\
364 		.oe_bit = 9,				\
365 		.in_bit = 0,				\
366 		.out_bit = 1,				\
367 		.intr_enable_bit = 0,			\
368 		.intr_status_bit = 0,			\
369 		.intr_ack_high = 1,			\
370 		.intr_target_bit = 0,			\
371 		.intr_target_kpss_val = 4,		\
372 		.intr_raw_status_bit = 3,		\
373 		.intr_polarity_bit = 1,			\
374 		.intr_detection_bit = 2,		\
375 		.intr_detection_width = 1,		\
376 	}
377 
378 #define SDC_PINGROUP(pg_name, ctl, pull, drv)		\
379 	{						\
380 		.grp = PINCTRL_PINGROUP(#pg_name, 	\
381 			pg_name##_pins, 		\
382 			ARRAY_SIZE(pg_name##_pins)),	\
383 		.ctl_reg = ctl,				\
384 		.io_reg = 0,				\
385 		.intr_cfg_reg = 0,			\
386 		.intr_status_reg = 0,			\
387 		.intr_target_reg = 0,			\
388 		.mux_bit = -1,				\
389 		.pull_bit = pull,			\
390 		.drv_bit = drv,				\
391 		.oe_bit = -1,				\
392 		.in_bit = -1,				\
393 		.out_bit = -1,				\
394 		.intr_enable_bit = -1,			\
395 		.intr_status_bit = -1,			\
396 		.intr_target_bit = -1,			\
397 		.intr_target_kpss_val = -1,		\
398 		.intr_raw_status_bit = -1,		\
399 		.intr_polarity_bit = -1,		\
400 		.intr_detection_bit = -1,		\
401 		.intr_detection_width = -1,		\
402 	}
403 
404 enum msm8960_functions {
405 	msm_mux_audio_pcm,
406 	msm_mux_bt,
407 	msm_mux_cam_mclk0,
408 	msm_mux_cam_mclk1,
409 	msm_mux_cam_mclk2,
410 	msm_mux_codec_mic_i2s,
411 	msm_mux_codec_spkr_i2s,
412 	msm_mux_ext_gps,
413 	msm_mux_fm,
414 	msm_mux_gps_blanking,
415 	msm_mux_gps_pps_in,
416 	msm_mux_gps_pps_out,
417 	msm_mux_gp_clk_0a,
418 	msm_mux_gp_clk_0b,
419 	msm_mux_gp_clk_1a,
420 	msm_mux_gp_clk_1b,
421 	msm_mux_gp_clk_2a,
422 	msm_mux_gp_clk_2b,
423 	msm_mux_gp_mn,
424 	msm_mux_gp_pdm_0a,
425 	msm_mux_gp_pdm_0b,
426 	msm_mux_gp_pdm_1a,
427 	msm_mux_gp_pdm_1b,
428 	msm_mux_gp_pdm_2a,
429 	msm_mux_gp_pdm_2b,
430 	msm_mux_gpio,
431 	msm_mux_gsbi1,
432 	msm_mux_gsbi1_spi_cs1_n,
433 	msm_mux_gsbi1_spi_cs2a_n,
434 	msm_mux_gsbi1_spi_cs2b_n,
435 	msm_mux_gsbi1_spi_cs3_n,
436 	msm_mux_gsbi2,
437 	msm_mux_gsbi2_spi_cs1_n,
438 	msm_mux_gsbi2_spi_cs2_n,
439 	msm_mux_gsbi2_spi_cs3_n,
440 	msm_mux_gsbi3,
441 	msm_mux_gsbi4,
442 	msm_mux_gsbi4_3d_cam_i2c_l,
443 	msm_mux_gsbi4_3d_cam_i2c_r,
444 	msm_mux_gsbi5,
445 	msm_mux_gsbi5_3d_cam_i2c_l,
446 	msm_mux_gsbi5_3d_cam_i2c_r,
447 	msm_mux_gsbi6,
448 	msm_mux_gsbi7,
449 	msm_mux_gsbi8,
450 	msm_mux_gsbi9,
451 	msm_mux_gsbi10,
452 	msm_mux_gsbi11,
453 	msm_mux_gsbi11_spi_cs1a_n,
454 	msm_mux_gsbi11_spi_cs1b_n,
455 	msm_mux_gsbi11_spi_cs2a_n,
456 	msm_mux_gsbi11_spi_cs2b_n,
457 	msm_mux_gsbi11_spi_cs3_n,
458 	msm_mux_gsbi12,
459 	msm_mux_hdmi_cec,
460 	msm_mux_hdmi_ddc_clock,
461 	msm_mux_hdmi_ddc_data,
462 	msm_mux_hdmi_hot_plug_detect,
463 	msm_mux_hsic,
464 	msm_mux_mdp_vsync,
465 	msm_mux_mi2s,
466 	msm_mux_mic_i2s,
467 	msm_mux_pmb_clk,
468 	msm_mux_pmb_ext_ctrl,
469 	msm_mux_ps_hold,
470 	msm_mux_rpm_wdog,
471 	msm_mux_sdc2,
472 	msm_mux_sdc4,
473 	msm_mux_sdc5,
474 	msm_mux_slimbus1,
475 	msm_mux_slimbus2,
476 	msm_mux_spkr_i2s,
477 	msm_mux_ssbi1,
478 	msm_mux_ssbi2,
479 	msm_mux_ssbi_ext_gps,
480 	msm_mux_ssbi_pmic2,
481 	msm_mux_ssbi_qpa1,
482 	msm_mux_ssbi_ts,
483 	msm_mux_tsif1,
484 	msm_mux_tsif2,
485 	msm_mux_ts_eoc,
486 	msm_mux_usb_fs1,
487 	msm_mux_usb_fs1_oe,
488 	msm_mux_usb_fs1_oe_n,
489 	msm_mux_usb_fs2,
490 	msm_mux_usb_fs2_oe,
491 	msm_mux_usb_fs2_oe_n,
492 	msm_mux_vfe_camif_timer1_a,
493 	msm_mux_vfe_camif_timer1_b,
494 	msm_mux_vfe_camif_timer2,
495 	msm_mux_vfe_camif_timer3_a,
496 	msm_mux_vfe_camif_timer3_b,
497 	msm_mux_vfe_camif_timer4_a,
498 	msm_mux_vfe_camif_timer4_b,
499 	msm_mux_vfe_camif_timer4_c,
500 	msm_mux_vfe_camif_timer5_a,
501 	msm_mux_vfe_camif_timer5_b,
502 	msm_mux_vfe_camif_timer6_a,
503 	msm_mux_vfe_camif_timer6_b,
504 	msm_mux_vfe_camif_timer6_c,
505 	msm_mux_vfe_camif_timer7_a,
506 	msm_mux_vfe_camif_timer7_b,
507 	msm_mux_vfe_camif_timer7_c,
508 	msm_mux_wlan,
509 	msm_mux_NA,
510 };
511 
512 static const char * const audio_pcm_groups[] = {
513 	"gpio63", "gpio64", "gpio65", "gpio66"
514 };
515 
516 static const char * const bt_groups[] = {
517 	"gpio28", "gpio29", "gpio83"
518 };
519 
520 static const char * const cam_mclk0_groups[] = {
521 	"gpio5"
522 };
523 
524 static const char * const cam_mclk1_groups[] = {
525 	"gpio4"
526 };
527 
528 static const char * const cam_mclk2_groups[] = {
529 	"gpio2"
530 };
531 
532 static const char * const codec_mic_i2s_groups[] = {
533 	"gpio54", "gpio55", "gpio56", "gpio57", "gpio58"
534 };
535 
536 static const char * const codec_spkr_i2s_groups[] = {
537 	"gpio59", "gpio60", "gpio61", "gpio62"
538 };
539 
540 static const char * const ext_gps_groups[] = {
541 	"gpio22", "gpio23", "gpio24", "gpio25"
542 };
543 
544 static const char * const fm_groups[] = {
545 	"gpio26", "gpio27"
546 };
547 
548 static const char * const gps_blanking_groups[] = {
549 	"gpio137"
550 };
551 
552 static const char * const gps_pps_in_groups[] = {
553 	"gpio37"
554 };
555 
556 static const char * const gps_pps_out_groups[] = {
557 	"gpio37"
558 };
559 
560 static const char * const gp_clk_0a_groups[] = {
561 	"gpio3"
562 };
563 
564 static const char * const gp_clk_0b_groups[] = {
565 	"gpio54"
566 };
567 
568 static const char * const gp_clk_1a_groups[] = {
569 	"gpio4"
570 };
571 
572 static const char * const gp_clk_1b_groups[] = {
573 	"gpio70"
574 };
575 
576 static const char * const gp_clk_2a_groups[] = {
577 	"gpio52"
578 };
579 
580 static const char * const gp_clk_2b_groups[] = {
581 	"gpio37"
582 };
583 
584 static const char * const gp_mn_groups[] = {
585 	"gpio2"
586 };
587 
588 static const char * const gp_pdm_0a_groups[] = {
589 	"gpio58"
590 };
591 
592 static const char * const gp_pdm_0b_groups[] = {
593 	"gpio39"
594 };
595 
596 static const char * const gp_pdm_1a_groups[] = {
597 	"gpio94"
598 };
599 
600 static const char * const gp_pdm_1b_groups[] = {
601 	"gpio64"
602 };
603 
604 static const char * const gp_pdm_2a_groups[] = {
605 	"gpio69"
606 };
607 
608 static const char * const gp_pdm_2b_groups[] = {
609 	"gpio53"
610 };
611 
612 static const char * const gpio_groups[] = {
613 	"gpio0", "gpio1", "gpio2", "gpio3", "gpio4", "gpio5", "gpio6", "gpio7",
614 	"gpio8", "gpio9", "gpio10", "gpio11", "gpio12", "gpio13", "gpio14",
615 	"gpio15", "gpio16", "gpio17", "gpio18", "gpio19", "gpio20", "gpio21",
616 	"gpio22", "gpio23", "gpio24", "gpio25", "gpio26", "gpio27", "gpio28",
617 	"gpio29", "gpio30", "gpio31", "gpio32", "gpio33", "gpio34", "gpio35",
618 	"gpio36", "gpio37", "gpio38", "gpio39", "gpio40", "gpio41", "gpio42",
619 	"gpio43", "gpio44", "gpio45", "gpio46", "gpio47", "gpio48", "gpio49",
620 	"gpio50", "gpio51", "gpio52", "gpio53", "gpio54", "gpio55", "gpio56",
621 	"gpio57", "gpio58", "gpio59", "gpio60", "gpio61", "gpio62", "gpio63",
622 	"gpio64", "gpio65", "gpio66", "gpio67", "gpio68", "gpio69", "gpio70",
623 	"gpio71", "gpio72", "gpio73", "gpio74", "gpio75", "gpio76", "gpio77",
624 	"gpio78", "gpio79", "gpio80", "gpio81", "gpio82", "gpio83", "gpio84",
625 	"gpio85", "gpio86", "gpio87", "gpio88", "gpio89", "gpio90", "gpio91",
626 	"gpio92", "gpio93", "gpio94", "gpio95", "gpio96", "gpio97", "gpio98",
627 	"gpio99", "gpio100", "gpio101", "gpio102", "gpio103", "gpio104",
628 	"gpio105", "gpio106", "gpio107", "gpio108", "gpio109", "gpio110",
629 	"gpio111", "gpio112", "gpio113", "gpio114", "gpio115", "gpio116",
630 	"gpio117", "gpio118", "gpio119", "gpio120", "gpio121", "gpio122",
631 	"gpio123", "gpio124", "gpio125", "gpio126", "gpio127", "gpio128",
632 	"gpio129", "gpio130", "gpio131", "gpio132", "gpio133", "gpio134",
633 	"gpio135", "gpio136", "gpio137", "gpio138", "gpio139", "gpio140",
634 	"gpio141", "gpio142", "gpio143", "gpio144", "gpio145", "gpio146",
635 	"gpio147", "gpio148", "gpio149", "gpio150", "gpio151"
636 };
637 
638 static const char * const gsbi1_groups[] = {
639 	"gpio6", "gpio7", "gpio8", "gpio9"
640 };
641 
642 static const char * const gsbi1_spi_cs1_n_groups[] = {
643 	"gpio14"
644 };
645 
646 static const char * const gsbi1_spi_cs2a_n_groups[] = {
647 	"gpio15"
648 };
649 
650 static const char * const gsbi1_spi_cs2b_n_groups[] = {
651 	"gpio17"
652 };
653 
654 static const char * const gsbi1_spi_cs3_n_groups[] = {
655 	"gpio16"
656 };
657 
658 static const char * const gsbi2_groups[] = {
659 	"gpio10", "gpio11", "gpio12", "gpio13"
660 };
661 
662 static const char * const gsbi2_spi_cs1_n_groups[] = {
663 	"gpio52"
664 };
665 
666 static const char * const gsbi2_spi_cs2_n_groups[] = {
667 	"gpio68"
668 };
669 
670 static const char * const gsbi2_spi_cs3_n_groups[] = {
671 	"gpio56"
672 };
673 
674 static const char * const gsbi3_groups[] = {
675 	"gpio14", "gpio15", "gpio16", "gpio17"
676 };
677 
678 static const char * const gsbi4_groups[] = {
679 	"gpio18", "gpio19", "gpio20", "gpio21"
680 };
681 
682 static const char * const gsbi4_3d_cam_i2c_l_groups[] = {
683 	"gpio18", "gpio19"
684 };
685 
686 static const char * const gsbi4_3d_cam_i2c_r_groups[] = {
687 	"gpio20", "gpio21"
688 };
689 
690 static const char * const gsbi5_groups[] = {
691 	"gpio22", "gpio23", "gpio24", "gpio25"
692 };
693 
694 static const char * const gsbi5_3d_cam_i2c_l_groups[] = {
695 	"gpio22", "gpio23"
696 };
697 
698 static const char * const gsbi5_3d_cam_i2c_r_groups[] = {
699 	"gpio24", "gpio25"
700 };
701 
702 static const char * const gsbi6_groups[] = {
703 	"gpio26", "gpio27", "gpio28", "gpio29"
704 };
705 
706 static const char * const gsbi7_groups[] = {
707 	"gpio30", "gpio31", "gpio32", "gpio33"
708 };
709 
710 static const char * const gsbi8_groups[] = {
711 	"gpio34", "gpio35", "gpio36", "gpio37"
712 };
713 
714 static const char * const gsbi9_groups[] = {
715 	"gpio93", "gpio94", "gpio95", "gpio96"
716 };
717 
718 static const char * const gsbi10_groups[] = {
719 	"gpio71", "gpio72", "gpio73", "gpio74"
720 };
721 
722 static const char * const gsbi11_groups[] = {
723 	"gpio38", "gpio39", "gpio40", "gpio41"
724 };
725 
726 static const char * const gsbi11_spi_cs1a_n_groups[] = {
727 	"gpio36"
728 };
729 
730 static const char * const gsbi11_spi_cs1b_n_groups[] = {
731 	"gpio18"
732 };
733 
734 static const char * const gsbi11_spi_cs2a_n_groups[] = {
735 	"gpio37"
736 };
737 
738 static const char * const gsbi11_spi_cs2b_n_groups[] = {
739 	"gpio19"
740 };
741 
742 static const char * const gsbi11_spi_cs3_n_groups[] = {
743 	"gpio76"
744 };
745 
746 static const char * const gsbi12_groups[] = {
747 	"gpio42", "gpio43", "gpio44", "gpio45"
748 };
749 
750 static const char * const hdmi_cec_groups[] = {
751 	"gpio99"
752 };
753 
754 static const char * const hdmi_ddc_clock_groups[] = {
755 	"gpio100"
756 };
757 
758 static const char * const hdmi_ddc_data_groups[] = {
759 	"gpio101"
760 };
761 
762 static const char * const hdmi_hot_plug_detect_groups[] = {
763 	"gpio102"
764 };
765 
766 static const char * const hsic_groups[] = {
767 	"gpio150", "gpio151"
768 };
769 
770 static const char * const mdp_vsync_groups[] = {
771 	"gpio0", "gpio1", "gpio19"
772 };
773 
774 static const char * const mi2s_groups[] = {
775 	"gpio47", "gpio48", "gpio49", "gpio50", "gpio51", "gpio52", "gpio53"
776 };
777 
778 static const char * const mic_i2s_groups[] = {
779 	"gpio71", "gpio72", "gpio73", "gpio74"
780 };
781 
782 static const char * const pmb_clk_groups[] = {
783 	"gpio21", "gpio86", "gpio112"
784 };
785 
786 static const char * const pmb_ext_ctrl_groups[] = {
787 	"gpio4", "gpio5"
788 };
789 
790 static const char * const ps_hold_groups[] = {
791 	"gpio108"
792 };
793 
794 static const char * const rpm_wdog_groups[] = {
795 	"gpio12"
796 };
797 
798 static const char * const sdc2_groups[] = {
799 	"gpio89", "gpio90", "gpio91", "gpio92", "gpio93", "gpio94", "gpio95",
800 	"gpio96", "gpio97", "gpio98"
801 };
802 
803 static const char * const sdc4_groups[] = {
804 	"gpio83", "gpio84", "gpio85", "gpio86", "gpio87", "gpio88"
805 };
806 
807 static const char * const sdc5_groups[] = {
808 	"gpio77", "gpio78", "gpio79", "gpio80", "gpio81", "gpio82"
809 };
810 
811 static const char * const slimbus1_groups[] = {
812 	"gpio50", "gpio51", "gpio60", "gpio61"
813 };
814 
815 static const char * const slimbus2_groups[] = {
816 	"gpio42", "gpio43"
817 };
818 
819 static const char * const spkr_i2s_groups[] = {
820 	"gpio67", "gpio68", "gpio69", "gpio70"
821 };
822 
823 static const char * const ssbi1_groups[] = {
824 	"gpio141", "gpio143"
825 };
826 
827 static const char * const ssbi2_groups[] = {
828 	"gpio140", "gpio142"
829 };
830 
831 static const char * const ssbi_ext_gps_groups[] = {
832 	"gpio23"
833 };
834 
835 static const char * const ssbi_pmic2_groups[] = {
836 	"gpio149"
837 };
838 
839 static const char * const ssbi_qpa1_groups[] = {
840 	"gpio131"
841 };
842 
843 static const char * const ssbi_ts_groups[] = {
844 	"gpio10"
845 };
846 
847 static const char * const tsif1_groups[] = {
848 	"gpio75", "gpio76", "gpio77", "gpio82"
849 };
850 
851 static const char * const tsif2_groups[] = {
852 	"gpio78", "gpio79", "gpio80", "gpio81"
853 };
854 
855 static const char * const ts_eoc_groups[] = {
856 	"gpio11"
857 };
858 
859 static const char * const usb_fs1_groups[] = {
860 	"gpio32", "gpio33"
861 };
862 
863 static const char * const usb_fs1_oe_groups[] = {
864 	"gpio31"
865 };
866 
867 static const char * const usb_fs1_oe_n_groups[] = {
868 	"gpio31"
869 };
870 
871 static const char * const usb_fs2_groups[] = {
872 	"gpio34", "gpio35"
873 };
874 
875 static const char * const usb_fs2_oe_groups[] = {
876 	"gpio36"
877 };
878 
879 static const char * const usb_fs2_oe_n_groups[] = {
880 	"gpio36"
881 };
882 
883 static const char * const vfe_camif_timer1_a_groups[] = {
884 	"gpio2"
885 };
886 
887 static const char * const vfe_camif_timer1_b_groups[] = {
888 	"gpio38"
889 };
890 
891 static const char * const vfe_camif_timer2_groups[] = {
892 	"gpio3"
893 };
894 
895 static const char * const vfe_camif_timer3_a_groups[] = {
896 	"gpio4"
897 };
898 
899 static const char * const vfe_camif_timer3_b_groups[] = {
900 	"gpio151"
901 };
902 
903 static const char * const vfe_camif_timer4_a_groups[] = {
904 	"gpio65"
905 };
906 
907 static const char * const vfe_camif_timer4_b_groups[] = {
908 	"gpio150"
909 };
910 
911 static const char * const vfe_camif_timer4_c_groups[] = {
912 	"gpio10"
913 };
914 
915 static const char * const vfe_camif_timer5_a_groups[] = {
916 	"gpio66"
917 };
918 
919 static const char * const vfe_camif_timer5_b_groups[] = {
920 	"gpio39"
921 };
922 
923 static const char * const vfe_camif_timer6_a_groups[] = {
924 	"gpio71"
925 };
926 
927 static const char * const vfe_camif_timer6_b_groups[] = {
928 	"gpio0"
929 };
930 
931 static const char * const vfe_camif_timer6_c_groups[] = {
932 	"gpio18"
933 };
934 
935 static const char * const vfe_camif_timer7_a_groups[] = {
936 	"gpio67"
937 };
938 
939 static const char * const vfe_camif_timer7_b_groups[] = {
940 	"gpio1"
941 };
942 
943 static const char * const vfe_camif_timer7_c_groups[] = {
944 	"gpio19"
945 };
946 
947 static const char * const wlan_groups[] = {
948 	"gpio84", "gpio85", "gpio86", "gpio87", "gpio88"
949 };
950 
951 static const struct pinfunction msm8960_functions[] = {
952 	MSM_PIN_FUNCTION(audio_pcm),
953 	MSM_PIN_FUNCTION(bt),
954 	MSM_PIN_FUNCTION(cam_mclk0),
955 	MSM_PIN_FUNCTION(cam_mclk1),
956 	MSM_PIN_FUNCTION(cam_mclk2),
957 	MSM_PIN_FUNCTION(codec_mic_i2s),
958 	MSM_PIN_FUNCTION(codec_spkr_i2s),
959 	MSM_PIN_FUNCTION(ext_gps),
960 	MSM_PIN_FUNCTION(fm),
961 	MSM_PIN_FUNCTION(gps_blanking),
962 	MSM_PIN_FUNCTION(gps_pps_in),
963 	MSM_PIN_FUNCTION(gps_pps_out),
964 	MSM_PIN_FUNCTION(gp_clk_0a),
965 	MSM_PIN_FUNCTION(gp_clk_0b),
966 	MSM_PIN_FUNCTION(gp_clk_1a),
967 	MSM_PIN_FUNCTION(gp_clk_1b),
968 	MSM_PIN_FUNCTION(gp_clk_2a),
969 	MSM_PIN_FUNCTION(gp_clk_2b),
970 	MSM_PIN_FUNCTION(gp_mn),
971 	MSM_PIN_FUNCTION(gp_pdm_0a),
972 	MSM_PIN_FUNCTION(gp_pdm_0b),
973 	MSM_PIN_FUNCTION(gp_pdm_1a),
974 	MSM_PIN_FUNCTION(gp_pdm_1b),
975 	MSM_PIN_FUNCTION(gp_pdm_2a),
976 	MSM_PIN_FUNCTION(gp_pdm_2b),
977 	MSM_PIN_FUNCTION(gpio),
978 	MSM_PIN_FUNCTION(gsbi1),
979 	MSM_PIN_FUNCTION(gsbi1_spi_cs1_n),
980 	MSM_PIN_FUNCTION(gsbi1_spi_cs2a_n),
981 	MSM_PIN_FUNCTION(gsbi1_spi_cs2b_n),
982 	MSM_PIN_FUNCTION(gsbi1_spi_cs3_n),
983 	MSM_PIN_FUNCTION(gsbi2),
984 	MSM_PIN_FUNCTION(gsbi2_spi_cs1_n),
985 	MSM_PIN_FUNCTION(gsbi2_spi_cs2_n),
986 	MSM_PIN_FUNCTION(gsbi2_spi_cs3_n),
987 	MSM_PIN_FUNCTION(gsbi3),
988 	MSM_PIN_FUNCTION(gsbi4),
989 	MSM_PIN_FUNCTION(gsbi4_3d_cam_i2c_l),
990 	MSM_PIN_FUNCTION(gsbi4_3d_cam_i2c_r),
991 	MSM_PIN_FUNCTION(gsbi5),
992 	MSM_PIN_FUNCTION(gsbi5_3d_cam_i2c_l),
993 	MSM_PIN_FUNCTION(gsbi5_3d_cam_i2c_r),
994 	MSM_PIN_FUNCTION(gsbi6),
995 	MSM_PIN_FUNCTION(gsbi7),
996 	MSM_PIN_FUNCTION(gsbi8),
997 	MSM_PIN_FUNCTION(gsbi9),
998 	MSM_PIN_FUNCTION(gsbi10),
999 	MSM_PIN_FUNCTION(gsbi11),
1000 	MSM_PIN_FUNCTION(gsbi11_spi_cs1a_n),
1001 	MSM_PIN_FUNCTION(gsbi11_spi_cs1b_n),
1002 	MSM_PIN_FUNCTION(gsbi11_spi_cs2a_n),
1003 	MSM_PIN_FUNCTION(gsbi11_spi_cs2b_n),
1004 	MSM_PIN_FUNCTION(gsbi11_spi_cs3_n),
1005 	MSM_PIN_FUNCTION(gsbi12),
1006 	MSM_PIN_FUNCTION(hdmi_cec),
1007 	MSM_PIN_FUNCTION(hdmi_ddc_clock),
1008 	MSM_PIN_FUNCTION(hdmi_ddc_data),
1009 	MSM_PIN_FUNCTION(hdmi_hot_plug_detect),
1010 	MSM_PIN_FUNCTION(hsic),
1011 	MSM_PIN_FUNCTION(mdp_vsync),
1012 	MSM_PIN_FUNCTION(mi2s),
1013 	MSM_PIN_FUNCTION(mic_i2s),
1014 	MSM_PIN_FUNCTION(pmb_clk),
1015 	MSM_PIN_FUNCTION(pmb_ext_ctrl),
1016 	MSM_PIN_FUNCTION(ps_hold),
1017 	MSM_PIN_FUNCTION(rpm_wdog),
1018 	MSM_PIN_FUNCTION(sdc2),
1019 	MSM_PIN_FUNCTION(sdc4),
1020 	MSM_PIN_FUNCTION(sdc5),
1021 	MSM_PIN_FUNCTION(slimbus1),
1022 	MSM_PIN_FUNCTION(slimbus2),
1023 	MSM_PIN_FUNCTION(spkr_i2s),
1024 	MSM_PIN_FUNCTION(ssbi1),
1025 	MSM_PIN_FUNCTION(ssbi2),
1026 	MSM_PIN_FUNCTION(ssbi_ext_gps),
1027 	MSM_PIN_FUNCTION(ssbi_pmic2),
1028 	MSM_PIN_FUNCTION(ssbi_qpa1),
1029 	MSM_PIN_FUNCTION(ssbi_ts),
1030 	MSM_PIN_FUNCTION(tsif1),
1031 	MSM_PIN_FUNCTION(tsif2),
1032 	MSM_PIN_FUNCTION(ts_eoc),
1033 	MSM_PIN_FUNCTION(usb_fs1),
1034 	MSM_PIN_FUNCTION(usb_fs1_oe),
1035 	MSM_PIN_FUNCTION(usb_fs1_oe_n),
1036 	MSM_PIN_FUNCTION(usb_fs2),
1037 	MSM_PIN_FUNCTION(usb_fs2_oe),
1038 	MSM_PIN_FUNCTION(usb_fs2_oe_n),
1039 	MSM_PIN_FUNCTION(vfe_camif_timer1_a),
1040 	MSM_PIN_FUNCTION(vfe_camif_timer1_b),
1041 	MSM_PIN_FUNCTION(vfe_camif_timer2),
1042 	MSM_PIN_FUNCTION(vfe_camif_timer3_a),
1043 	MSM_PIN_FUNCTION(vfe_camif_timer3_b),
1044 	MSM_PIN_FUNCTION(vfe_camif_timer4_a),
1045 	MSM_PIN_FUNCTION(vfe_camif_timer4_b),
1046 	MSM_PIN_FUNCTION(vfe_camif_timer4_c),
1047 	MSM_PIN_FUNCTION(vfe_camif_timer5_a),
1048 	MSM_PIN_FUNCTION(vfe_camif_timer5_b),
1049 	MSM_PIN_FUNCTION(vfe_camif_timer6_a),
1050 	MSM_PIN_FUNCTION(vfe_camif_timer6_b),
1051 	MSM_PIN_FUNCTION(vfe_camif_timer6_c),
1052 	MSM_PIN_FUNCTION(vfe_camif_timer7_a),
1053 	MSM_PIN_FUNCTION(vfe_camif_timer7_b),
1054 	MSM_PIN_FUNCTION(vfe_camif_timer7_c),
1055 	MSM_PIN_FUNCTION(wlan),
1056 };
1057 
1058 static const struct msm_pingroup msm8960_groups[] = {
1059 	PINGROUP(0, mdp_vsync, vfe_camif_timer6_b, NA, NA, NA, NA, NA, NA, NA, NA, NA),
1060 	PINGROUP(1, mdp_vsync, vfe_camif_timer7_b, NA, NA, NA, NA, NA, NA, NA, NA, NA),
1061 	PINGROUP(2, vfe_camif_timer1_a, gp_mn, NA, cam_mclk2, NA, NA, NA, NA, NA, NA, NA),
1062 	PINGROUP(3, vfe_camif_timer2, gp_clk_0a, NA, NA, NA, NA, NA, NA, NA, NA, NA),
1063 	PINGROUP(4, vfe_camif_timer3_a, cam_mclk1, gp_clk_1a, pmb_ext_ctrl, NA, NA, NA, NA, NA, NA, NA),
1064 	PINGROUP(5, cam_mclk0, pmb_ext_ctrl, NA, NA, NA, NA, NA, NA, NA, NA, NA),
1065 	PINGROUP(6, gsbi1, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA),
1066 	PINGROUP(7, gsbi1, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA),
1067 	PINGROUP(8, gsbi1, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA),
1068 	PINGROUP(9, gsbi1, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA),
1069 	PINGROUP(10, gsbi2, ssbi_ts, NA, vfe_camif_timer4_c, NA, NA, NA, NA, NA, NA, NA),
1070 	PINGROUP(11, gsbi2, ts_eoc, NA, NA, NA, NA, NA, NA, NA, NA, NA),
1071 	PINGROUP(12, gsbi2, rpm_wdog, NA, NA, NA, NA, NA, NA, NA, NA, NA),
1072 	PINGROUP(13, gsbi2, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA),
1073 	PINGROUP(14, gsbi3, gsbi1_spi_cs1_n, NA, NA, NA, NA, NA, NA, NA, NA, NA),
1074 	PINGROUP(15, gsbi3, gsbi1_spi_cs2a_n, NA, NA, NA, NA, NA, NA, NA, NA, NA),
1075 	PINGROUP(16, gsbi3, gsbi1_spi_cs3_n, NA, NA, NA, NA, NA, NA, NA, NA, NA),
1076 	PINGROUP(17, gsbi3, gsbi1_spi_cs2b_n, NA, NA, NA, NA, NA, NA, NA, NA, NA),
1077 	PINGROUP(18, gsbi4, gsbi11_spi_cs1b_n, NA, NA, gsbi4_3d_cam_i2c_l, vfe_camif_timer6_c, NA, NA, NA, NA, NA),
1078 	PINGROUP(19, gsbi4, gsbi11_spi_cs2b_n, NA, mdp_vsync, NA, gsbi4_3d_cam_i2c_l, vfe_camif_timer7_c, NA, NA, NA, NA),
1079 	PINGROUP(20, gsbi4, gsbi4_3d_cam_i2c_r, NA, NA, NA, NA, NA, NA, NA, NA, NA),
1080 	PINGROUP(21, gsbi4, pmb_clk, gsbi4_3d_cam_i2c_r, NA, NA, NA, NA, NA, NA, NA, NA),
1081 	PINGROUP(22, gsbi5, ext_gps, NA, NA, NA, NA, NA, NA, NA, gsbi5_3d_cam_i2c_l, NA),
1082 	PINGROUP(23, gsbi5, ssbi_ext_gps, NA, NA, NA, NA, NA, NA, NA, gsbi5_3d_cam_i2c_l, NA),
1083 	PINGROUP(24, gsbi5, ext_gps, NA, NA, NA, NA, NA, NA, NA, gsbi5_3d_cam_i2c_r, NA),
1084 	PINGROUP(25, gsbi5, ext_gps, NA, NA, NA, NA, NA, NA, NA, gsbi5_3d_cam_i2c_r, NA),
1085 	PINGROUP(26, fm, gsbi6, NA, NA, NA, NA, NA, NA, NA, NA, NA),
1086 	PINGROUP(27, fm, gsbi6, NA, NA, NA, NA, NA, NA, NA, NA, NA),
1087 	PINGROUP(28, bt, gsbi6, NA, NA, NA, NA, NA, NA, NA, NA, NA),
1088 	PINGROUP(29, bt, gsbi6, NA, NA, NA, NA, NA, NA, NA, NA, NA),
1089 	PINGROUP(30, gsbi7, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA),
1090 	PINGROUP(31, gsbi7, usb_fs1_oe, usb_fs1_oe_n, NA, NA, NA, NA, NA, NA, NA, NA),
1091 	PINGROUP(32, gsbi7, usb_fs1, NA, NA, NA, NA, NA, NA, NA, NA, NA),
1092 	PINGROUP(33, gsbi7, usb_fs1, NA, NA, NA, NA, NA, NA, NA, NA, NA),
1093 	PINGROUP(34, gsbi8, usb_fs2, NA, NA, NA, NA, NA, NA, NA, NA, NA),
1094 	PINGROUP(35, gsbi8, usb_fs2, NA, NA, NA, NA, NA, NA, NA, NA, NA),
1095 	PINGROUP(36, gsbi8, usb_fs2_oe, usb_fs2_oe_n, gsbi11_spi_cs1a_n, NA, NA, NA, NA, NA, NA, NA),
1096 	PINGROUP(37, gsbi8, gps_pps_out, gps_pps_in, gsbi11_spi_cs2a_n, gp_clk_2b, NA, NA, NA, NA, NA, NA),
1097 	PINGROUP(38, gsbi11, NA, NA, NA, NA, NA, NA, NA, NA, vfe_camif_timer1_b, NA),
1098 	PINGROUP(39, gsbi11, gp_pdm_0b, NA, NA, NA, NA, NA, NA, NA, NA, vfe_camif_timer5_b),
1099 	PINGROUP(40, gsbi11, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA),
1100 	PINGROUP(41, gsbi11, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA),
1101 	PINGROUP(42, gsbi12, slimbus2, NA, NA, NA, NA, NA, NA, NA, NA, NA),
1102 	PINGROUP(43, gsbi12, slimbus2, NA, NA, NA, NA, NA, NA, NA, NA, NA),
1103 	PINGROUP(44, gsbi12, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA),
1104 	PINGROUP(45, gsbi12, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA),
1105 	PINGROUP(46, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA),
1106 	PINGROUP(47, mi2s, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA),
1107 	PINGROUP(48, mi2s, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA),
1108 	PINGROUP(49, mi2s, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA),
1109 	PINGROUP(50, mi2s, slimbus1, NA, NA, NA, NA, NA, NA, NA, NA, NA),
1110 	PINGROUP(51, mi2s, slimbus1, NA, NA, NA, NA, NA, NA, NA, NA, NA),
1111 	PINGROUP(52, mi2s, gp_clk_2a, gsbi2_spi_cs1_n, NA, NA, NA, NA, NA, NA, NA, NA),
1112 	PINGROUP(53, mi2s, gp_pdm_2b, NA, NA, NA, NA, NA, NA, NA, NA, NA),
1113 	PINGROUP(54, codec_mic_i2s, gp_clk_0b, NA, NA, NA, NA, NA, NA, NA, NA, NA),
1114 	PINGROUP(55, codec_mic_i2s, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA),
1115 	PINGROUP(56, codec_mic_i2s, gsbi2_spi_cs3_n, NA, NA, NA, NA, NA, NA, NA, NA, NA),
1116 	PINGROUP(57, codec_mic_i2s, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA),
1117 	PINGROUP(58, codec_mic_i2s, gp_pdm_0a, NA, NA, NA, NA, NA, NA, NA, NA, NA),
1118 	PINGROUP(59, codec_spkr_i2s, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA),
1119 	PINGROUP(60, slimbus1, codec_spkr_i2s, NA, NA, NA, NA, NA, NA, NA, NA, NA),
1120 	PINGROUP(61, slimbus1, codec_spkr_i2s, NA, NA, NA, NA, NA, NA, NA, NA, NA),
1121 	PINGROUP(62, codec_spkr_i2s, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA),
1122 	PINGROUP(63, audio_pcm, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA),
1123 	PINGROUP(64, audio_pcm, gp_pdm_1b, NA, NA, NA, NA, NA, NA, NA, NA, NA),
1124 	PINGROUP(65, audio_pcm, vfe_camif_timer4_a, NA, NA, NA, NA, NA, NA, NA, NA, NA),
1125 	PINGROUP(66, audio_pcm, vfe_camif_timer5_a, NA, NA, NA, NA, NA, NA, NA, NA, NA),
1126 	PINGROUP(67, spkr_i2s, vfe_camif_timer7_a, NA, NA, NA, NA, NA, NA, NA, NA, NA),
1127 	PINGROUP(68, spkr_i2s, gsbi2_spi_cs2_n, NA, NA, NA, NA, NA, NA, NA, NA, NA),
1128 	PINGROUP(69, spkr_i2s, gp_pdm_2a, NA, NA, NA, NA, NA, NA, NA, NA, NA),
1129 	PINGROUP(70, spkr_i2s, gp_clk_1b, NA, NA, NA, NA, NA, NA, NA, NA, NA),
1130 	PINGROUP(71, mic_i2s, gsbi10, vfe_camif_timer6_a, NA, NA, NA, NA, NA, NA, NA, NA),
1131 	PINGROUP(72, mic_i2s, gsbi10, NA, NA, NA, NA, NA, NA, NA, NA, NA),
1132 	PINGROUP(73, mic_i2s, gsbi10, NA, NA, NA, NA, NA, NA, NA, NA, NA),
1133 	PINGROUP(74, mic_i2s, gsbi10, NA, NA, NA, NA, NA, NA, NA, NA, NA),
1134 	PINGROUP(75, tsif1, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA),
1135 	PINGROUP(76, tsif1, gsbi11_spi_cs3_n, NA, NA, NA, NA, NA, NA, NA, NA, NA),
1136 	PINGROUP(77, tsif1, sdc5, NA, NA, NA, NA, NA, NA, NA, NA, NA),
1137 	PINGROUP(78, tsif2, sdc5, NA, NA, NA, NA, NA, NA, NA, NA, NA),
1138 	PINGROUP(79, tsif2, sdc5, NA, NA, NA, NA, NA, NA, NA, NA, NA),
1139 	PINGROUP(80, tsif2, sdc5, NA, NA, NA, NA, NA, NA, NA, NA, NA),
1140 	PINGROUP(81, tsif2, sdc5, NA, NA, NA, NA, NA, NA, NA, NA, NA),
1141 	PINGROUP(82, tsif1, sdc5, NA, NA, NA, NA, NA, NA, NA, NA, NA),
1142 	PINGROUP(83, bt, sdc4, NA, NA, NA, NA, NA, NA, NA, NA, NA),
1143 	PINGROUP(84, wlan, sdc4, NA, NA, NA, NA, NA, NA, NA, NA, NA),
1144 	PINGROUP(85, wlan, sdc4, NA, NA, NA, NA, NA, NA, NA, NA, NA),
1145 	PINGROUP(86, wlan, sdc4, pmb_clk, NA, NA, NA, NA, NA, NA, NA, NA),
1146 	PINGROUP(87, wlan, sdc4, NA, NA, NA, NA, NA, NA, NA, NA, NA),
1147 	PINGROUP(88, wlan, sdc4, NA, NA, NA, NA, NA, NA, NA, NA, NA),
1148 	PINGROUP(89, sdc2, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA),
1149 	PINGROUP(90, sdc2, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA),
1150 	PINGROUP(91, sdc2, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA),
1151 	PINGROUP(92, sdc2, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA),
1152 	PINGROUP(93, sdc2, gsbi9, NA, NA, NA, NA, NA, NA, NA, NA, NA),
1153 	PINGROUP(94, sdc2, gsbi9, gp_pdm_1a, NA, NA, NA, NA, NA, NA, NA, NA),
1154 	PINGROUP(95, sdc2, gsbi9, NA, NA, NA, NA, NA, NA, NA, NA, NA),
1155 	PINGROUP(96, sdc2, gsbi9, NA, NA, NA, NA, NA, NA, NA, NA, NA),
1156 	PINGROUP(97, sdc2, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA),
1157 	PINGROUP(98, sdc2, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA),
1158 	PINGROUP(99, hdmi_cec, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA),
1159 	PINGROUP(100, hdmi_ddc_clock, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA),
1160 	PINGROUP(101, hdmi_ddc_data, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA),
1161 	PINGROUP(102, hdmi_hot_plug_detect, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA),
1162 	PINGROUP(103, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA),
1163 	PINGROUP(104, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA),
1164 	PINGROUP(105, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA),
1165 	PINGROUP(106, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA),
1166 	PINGROUP(107, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA),
1167 	PINGROUP(108, ps_hold, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA),
1168 	PINGROUP(109, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA),
1169 	PINGROUP(110, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA),
1170 	PINGROUP(111, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA),
1171 	PINGROUP(112, NA, pmb_clk, NA, NA, NA, NA, NA, NA, NA, NA, NA),
1172 	PINGROUP(113, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA),
1173 	PINGROUP(114, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA),
1174 	PINGROUP(115, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA),
1175 	PINGROUP(116, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA),
1176 	PINGROUP(117, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA),
1177 	PINGROUP(118, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA),
1178 	PINGROUP(119, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA),
1179 	PINGROUP(120, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA),
1180 	PINGROUP(121, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA),
1181 	PINGROUP(122, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA),
1182 	PINGROUP(123, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA),
1183 	PINGROUP(124, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA),
1184 	PINGROUP(125, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA),
1185 	PINGROUP(126, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA),
1186 	PINGROUP(127, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA),
1187 	PINGROUP(128, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA),
1188 	PINGROUP(129, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA),
1189 	PINGROUP(130, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA),
1190 	PINGROUP(131, NA, ssbi_qpa1, NA, NA, NA, NA, NA, NA, NA, NA, NA),
1191 	PINGROUP(132, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA),
1192 	PINGROUP(133, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA),
1193 	PINGROUP(134, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA),
1194 	PINGROUP(135, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA),
1195 	PINGROUP(136, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA),
1196 	PINGROUP(137, gps_blanking, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA),
1197 	PINGROUP(138, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA),
1198 	PINGROUP(139, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA),
1199 	PINGROUP(140, ssbi2, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA),
1200 	PINGROUP(141, ssbi1, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA),
1201 	PINGROUP(142, ssbi2, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA),
1202 	PINGROUP(143, ssbi1, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA),
1203 	PINGROUP(144, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA),
1204 	PINGROUP(145, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA),
1205 	PINGROUP(146, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA),
1206 	PINGROUP(147, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA),
1207 	PINGROUP(148, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA),
1208 	PINGROUP(149, ssbi_pmic2, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA),
1209 	PINGROUP(150, hsic, NA, vfe_camif_timer4_b, NA, NA, NA, NA, NA, NA, NA, NA),
1210 	PINGROUP(151, hsic, NA, vfe_camif_timer3_b, NA, NA, NA, NA, NA, NA, NA, NA),
1211 
1212 	SDC_PINGROUP(sdc1_clk, 0x20a0, 13, 6),
1213 	SDC_PINGROUP(sdc1_cmd, 0x20a0, 11, 3),
1214 	SDC_PINGROUP(sdc1_data, 0x20a0, 9, 0),
1215 
1216 	SDC_PINGROUP(sdc3_clk, 0x20a4, 14, 6),
1217 	SDC_PINGROUP(sdc3_cmd, 0x20a4, 11, 3),
1218 	SDC_PINGROUP(sdc3_data, 0x20a4, 9, 0),
1219 };
1220 
1221 #define NUM_GPIO_PINGROUPS 152
1222 
1223 static const struct msm_pinctrl_soc_data msm8960_pinctrl = {
1224 	.pins = msm8960_pins,
1225 	.npins = ARRAY_SIZE(msm8960_pins),
1226 	.functions = msm8960_functions,
1227 	.nfunctions = ARRAY_SIZE(msm8960_functions),
1228 	.groups = msm8960_groups,
1229 	.ngroups = ARRAY_SIZE(msm8960_groups),
1230 	.ngpios = NUM_GPIO_PINGROUPS,
1231 };
1232 
msm8960_pinctrl_probe(struct platform_device * pdev)1233 static int msm8960_pinctrl_probe(struct platform_device *pdev)
1234 {
1235 	return msm_pinctrl_probe(pdev, &msm8960_pinctrl);
1236 }
1237 
1238 static const struct of_device_id msm8960_pinctrl_of_match[] = {
1239 	{ .compatible = "qcom,msm8960-pinctrl", },
1240 	{ },
1241 };
1242 
1243 static struct platform_driver msm8960_pinctrl_driver = {
1244 	.driver = {
1245 		.name = "msm8960-pinctrl",
1246 		.of_match_table = msm8960_pinctrl_of_match,
1247 	},
1248 	.probe = msm8960_pinctrl_probe,
1249 	.remove = msm_pinctrl_remove,
1250 };
1251 
msm8960_pinctrl_init(void)1252 static int __init msm8960_pinctrl_init(void)
1253 {
1254 	return platform_driver_register(&msm8960_pinctrl_driver);
1255 }
1256 arch_initcall(msm8960_pinctrl_init);
1257 
msm8960_pinctrl_exit(void)1258 static void __exit msm8960_pinctrl_exit(void)
1259 {
1260 	platform_driver_unregister(&msm8960_pinctrl_driver);
1261 }
1262 module_exit(msm8960_pinctrl_exit);
1263 
1264 MODULE_AUTHOR("Bjorn Andersson <bjorn.andersson@sonymobile.com>");
1265 MODULE_DESCRIPTION("Qualcomm MSM8960 pinctrl driver");
1266 MODULE_LICENSE("GPL v2");
1267 MODULE_DEVICE_TABLE(of, msm8960_pinctrl_of_match);
1268