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