kernel: update 3.14 to 3.14.18
[openwrt.git] / target / linux / ipq806x / patches / 0038-pinctrl-msm-Add-definitions-for-the-APQ8064-platform.patch
1 From 247288012122ccfe7d5d9af00a45814c6fdd94c5 Mon Sep 17 00:00:00 2001
2 From: Bjorn Andersson <bjorn.andersson@sonymobile.com>
3 Date: Mon, 31 Mar 2014 14:49:57 -0700
4 Subject: [PATCH 038/182] pinctrl: msm: Add definitions for the APQ8064
5  platform
6
7 This adds pinctrl definitions for the GPIO pins of the TLMM v2 block in the
8 Qualcomm APQ8064 platform.
9
10 Signed-off-by: Bjorn Andersson <bjorn.andersson@sonymobile.com>
11 Signed-off-by: Linus Walleij <linus.walleij@linaro.org>
12 ---
13  drivers/pinctrl/Kconfig           |    8 +
14  drivers/pinctrl/Makefile          |    1 +
15  drivers/pinctrl/pinctrl-apq8064.c |  566 +++++++++++++++++++++++++++++++++++++
16  3 files changed, 575 insertions(+)
17  create mode 100644 drivers/pinctrl/pinctrl-apq8064.c
18
19 --- a/drivers/pinctrl/Kconfig
20 +++ b/drivers/pinctrl/Kconfig
21 @@ -222,6 +222,14 @@ config PINCTRL_MSM
22         select PINCONF
23         select GENERIC_PINCONF
24  
25 +config PINCTRL_APQ8064
26 +       tristate "Qualcomm APQ8064 pin controller driver"
27 +       depends on GPIOLIB && OF
28 +       select PINCTRL_MSM
29 +       help
30 +         This is the pinctrl, pinmux, pinconf and gpiolib driver for the
31 +         Qualcomm TLMM block found in the Qualcomm APQ8064 platform.
32 +
33  config PINCTRL_MSM8X74
34         tristate "Qualcomm 8x74 pin controller driver"
35         depends on GPIOLIB && OF
36 --- a/drivers/pinctrl/Makefile
37 +++ b/drivers/pinctrl/Makefile
38 @@ -38,6 +38,7 @@ obj-$(CONFIG_PINCTRL_IMX23)   += pinctrl-i
39  obj-$(CONFIG_PINCTRL_IMX25)    += pinctrl-imx25.o
40  obj-$(CONFIG_PINCTRL_IMX28)    += pinctrl-imx28.o
41  obj-$(CONFIG_PINCTRL_MSM)      += pinctrl-msm.o
42 +obj-$(CONFIG_PINCTRL_APQ8064)  += pinctrl-apq8064.o
43  obj-$(CONFIG_PINCTRL_MSM8X74)  += pinctrl-msm8x74.o
44  obj-$(CONFIG_PINCTRL_NOMADIK)  += pinctrl-nomadik.o
45  obj-$(CONFIG_PINCTRL_STN8815)  += pinctrl-nomadik-stn8815.o
46 --- /dev/null
47 +++ b/drivers/pinctrl/pinctrl-apq8064.c
48 @@ -0,0 +1,566 @@
49 +/*
50 + * Copyright (c) 2014, Sony Mobile Communications AB.
51 + *
52 + * This program is free software; you can redistribute it and/or modify
53 + * it under the terms of the GNU General Public License version 2 and
54 + * only version 2 as published by the Free Software Foundation.
55 + *
56 + * This program is distributed in the hope that it will be useful,
57 + * but WITHOUT ANY WARRANTY; without even the implied warranty of
58 + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
59 + * GNU General Public License for more details.
60 + */
61 +
62 +#include <linux/module.h>
63 +#include <linux/of.h>
64 +#include <linux/platform_device.h>
65 +#include <linux/pinctrl/pinctrl.h>
66 +
67 +#include "pinctrl-msm.h"
68 +
69 +static const struct pinctrl_pin_desc apq8064_pins[] = {
70 +       PINCTRL_PIN(0, "GPIO_0"),
71 +       PINCTRL_PIN(1, "GPIO_1"),
72 +       PINCTRL_PIN(2, "GPIO_2"),
73 +       PINCTRL_PIN(3, "GPIO_3"),
74 +       PINCTRL_PIN(4, "GPIO_4"),
75 +       PINCTRL_PIN(5, "GPIO_5"),
76 +       PINCTRL_PIN(6, "GPIO_6"),
77 +       PINCTRL_PIN(7, "GPIO_7"),
78 +       PINCTRL_PIN(8, "GPIO_8"),
79 +       PINCTRL_PIN(9, "GPIO_9"),
80 +       PINCTRL_PIN(10, "GPIO_10"),
81 +       PINCTRL_PIN(11, "GPIO_11"),
82 +       PINCTRL_PIN(12, "GPIO_12"),
83 +       PINCTRL_PIN(13, "GPIO_13"),
84 +       PINCTRL_PIN(14, "GPIO_14"),
85 +       PINCTRL_PIN(15, "GPIO_15"),
86 +       PINCTRL_PIN(16, "GPIO_16"),
87 +       PINCTRL_PIN(17, "GPIO_17"),
88 +       PINCTRL_PIN(18, "GPIO_18"),
89 +       PINCTRL_PIN(19, "GPIO_19"),
90 +       PINCTRL_PIN(20, "GPIO_20"),
91 +       PINCTRL_PIN(21, "GPIO_21"),
92 +       PINCTRL_PIN(22, "GPIO_22"),
93 +       PINCTRL_PIN(23, "GPIO_23"),
94 +       PINCTRL_PIN(24, "GPIO_24"),
95 +       PINCTRL_PIN(25, "GPIO_25"),
96 +       PINCTRL_PIN(26, "GPIO_26"),
97 +       PINCTRL_PIN(27, "GPIO_27"),
98 +       PINCTRL_PIN(28, "GPIO_28"),
99 +       PINCTRL_PIN(29, "GPIO_29"),
100 +       PINCTRL_PIN(30, "GPIO_30"),
101 +       PINCTRL_PIN(31, "GPIO_31"),
102 +       PINCTRL_PIN(32, "GPIO_32"),
103 +       PINCTRL_PIN(33, "GPIO_33"),
104 +       PINCTRL_PIN(34, "GPIO_34"),
105 +       PINCTRL_PIN(35, "GPIO_35"),
106 +       PINCTRL_PIN(36, "GPIO_36"),
107 +       PINCTRL_PIN(37, "GPIO_37"),
108 +       PINCTRL_PIN(38, "GPIO_38"),
109 +       PINCTRL_PIN(39, "GPIO_39"),
110 +       PINCTRL_PIN(40, "GPIO_40"),
111 +       PINCTRL_PIN(41, "GPIO_41"),
112 +       PINCTRL_PIN(42, "GPIO_42"),
113 +       PINCTRL_PIN(43, "GPIO_43"),
114 +       PINCTRL_PIN(44, "GPIO_44"),
115 +       PINCTRL_PIN(45, "GPIO_45"),
116 +       PINCTRL_PIN(46, "GPIO_46"),
117 +       PINCTRL_PIN(47, "GPIO_47"),
118 +       PINCTRL_PIN(48, "GPIO_48"),
119 +       PINCTRL_PIN(49, "GPIO_49"),
120 +       PINCTRL_PIN(50, "GPIO_50"),
121 +       PINCTRL_PIN(51, "GPIO_51"),
122 +       PINCTRL_PIN(52, "GPIO_52"),
123 +       PINCTRL_PIN(53, "GPIO_53"),
124 +       PINCTRL_PIN(54, "GPIO_54"),
125 +       PINCTRL_PIN(55, "GPIO_55"),
126 +       PINCTRL_PIN(56, "GPIO_56"),
127 +       PINCTRL_PIN(57, "GPIO_57"),
128 +       PINCTRL_PIN(58, "GPIO_58"),
129 +       PINCTRL_PIN(59, "GPIO_59"),
130 +       PINCTRL_PIN(60, "GPIO_60"),
131 +       PINCTRL_PIN(61, "GPIO_61"),
132 +       PINCTRL_PIN(62, "GPIO_62"),
133 +       PINCTRL_PIN(63, "GPIO_63"),
134 +       PINCTRL_PIN(64, "GPIO_64"),
135 +       PINCTRL_PIN(65, "GPIO_65"),
136 +       PINCTRL_PIN(66, "GPIO_66"),
137 +       PINCTRL_PIN(67, "GPIO_67"),
138 +       PINCTRL_PIN(68, "GPIO_68"),
139 +       PINCTRL_PIN(69, "GPIO_69"),
140 +       PINCTRL_PIN(70, "GPIO_70"),
141 +       PINCTRL_PIN(71, "GPIO_71"),
142 +       PINCTRL_PIN(72, "GPIO_72"),
143 +       PINCTRL_PIN(73, "GPIO_73"),
144 +       PINCTRL_PIN(74, "GPIO_74"),
145 +       PINCTRL_PIN(75, "GPIO_75"),
146 +       PINCTRL_PIN(76, "GPIO_76"),
147 +       PINCTRL_PIN(77, "GPIO_77"),
148 +       PINCTRL_PIN(78, "GPIO_78"),
149 +       PINCTRL_PIN(79, "GPIO_79"),
150 +       PINCTRL_PIN(80, "GPIO_80"),
151 +       PINCTRL_PIN(81, "GPIO_81"),
152 +       PINCTRL_PIN(82, "GPIO_82"),
153 +       PINCTRL_PIN(83, "GPIO_83"),
154 +       PINCTRL_PIN(84, "GPIO_84"),
155 +       PINCTRL_PIN(85, "GPIO_85"),
156 +       PINCTRL_PIN(86, "GPIO_86"),
157 +       PINCTRL_PIN(87, "GPIO_87"),
158 +       PINCTRL_PIN(88, "GPIO_88"),
159 +       PINCTRL_PIN(89, "GPIO_89"),
160 +};
161 +
162 +#define DECLARE_APQ_GPIO_PINS(pin) static const unsigned int gpio##pin##_pins[] = { pin }
163 +DECLARE_APQ_GPIO_PINS(0);
164 +DECLARE_APQ_GPIO_PINS(1);
165 +DECLARE_APQ_GPIO_PINS(2);
166 +DECLARE_APQ_GPIO_PINS(3);
167 +DECLARE_APQ_GPIO_PINS(4);
168 +DECLARE_APQ_GPIO_PINS(5);
169 +DECLARE_APQ_GPIO_PINS(6);
170 +DECLARE_APQ_GPIO_PINS(7);
171 +DECLARE_APQ_GPIO_PINS(8);
172 +DECLARE_APQ_GPIO_PINS(9);
173 +DECLARE_APQ_GPIO_PINS(10);
174 +DECLARE_APQ_GPIO_PINS(11);
175 +DECLARE_APQ_GPIO_PINS(12);
176 +DECLARE_APQ_GPIO_PINS(13);
177 +DECLARE_APQ_GPIO_PINS(14);
178 +DECLARE_APQ_GPIO_PINS(15);
179 +DECLARE_APQ_GPIO_PINS(16);
180 +DECLARE_APQ_GPIO_PINS(17);
181 +DECLARE_APQ_GPIO_PINS(18);
182 +DECLARE_APQ_GPIO_PINS(19);
183 +DECLARE_APQ_GPIO_PINS(20);
184 +DECLARE_APQ_GPIO_PINS(21);
185 +DECLARE_APQ_GPIO_PINS(22);
186 +DECLARE_APQ_GPIO_PINS(23);
187 +DECLARE_APQ_GPIO_PINS(24);
188 +DECLARE_APQ_GPIO_PINS(25);
189 +DECLARE_APQ_GPIO_PINS(26);
190 +DECLARE_APQ_GPIO_PINS(27);
191 +DECLARE_APQ_GPIO_PINS(28);
192 +DECLARE_APQ_GPIO_PINS(29);
193 +DECLARE_APQ_GPIO_PINS(30);
194 +DECLARE_APQ_GPIO_PINS(31);
195 +DECLARE_APQ_GPIO_PINS(32);
196 +DECLARE_APQ_GPIO_PINS(33);
197 +DECLARE_APQ_GPIO_PINS(34);
198 +DECLARE_APQ_GPIO_PINS(35);
199 +DECLARE_APQ_GPIO_PINS(36);
200 +DECLARE_APQ_GPIO_PINS(37);
201 +DECLARE_APQ_GPIO_PINS(38);
202 +DECLARE_APQ_GPIO_PINS(39);
203 +DECLARE_APQ_GPIO_PINS(40);
204 +DECLARE_APQ_GPIO_PINS(41);
205 +DECLARE_APQ_GPIO_PINS(42);
206 +DECLARE_APQ_GPIO_PINS(43);
207 +DECLARE_APQ_GPIO_PINS(44);
208 +DECLARE_APQ_GPIO_PINS(45);
209 +DECLARE_APQ_GPIO_PINS(46);
210 +DECLARE_APQ_GPIO_PINS(47);
211 +DECLARE_APQ_GPIO_PINS(48);
212 +DECLARE_APQ_GPIO_PINS(49);
213 +DECLARE_APQ_GPIO_PINS(50);
214 +DECLARE_APQ_GPIO_PINS(51);
215 +DECLARE_APQ_GPIO_PINS(52);
216 +DECLARE_APQ_GPIO_PINS(53);
217 +DECLARE_APQ_GPIO_PINS(54);
218 +DECLARE_APQ_GPIO_PINS(55);
219 +DECLARE_APQ_GPIO_PINS(56);
220 +DECLARE_APQ_GPIO_PINS(57);
221 +DECLARE_APQ_GPIO_PINS(58);
222 +DECLARE_APQ_GPIO_PINS(59);
223 +DECLARE_APQ_GPIO_PINS(60);
224 +DECLARE_APQ_GPIO_PINS(61);
225 +DECLARE_APQ_GPIO_PINS(62);
226 +DECLARE_APQ_GPIO_PINS(63);
227 +DECLARE_APQ_GPIO_PINS(64);
228 +DECLARE_APQ_GPIO_PINS(65);
229 +DECLARE_APQ_GPIO_PINS(66);
230 +DECLARE_APQ_GPIO_PINS(67);
231 +DECLARE_APQ_GPIO_PINS(68);
232 +DECLARE_APQ_GPIO_PINS(69);
233 +DECLARE_APQ_GPIO_PINS(70);
234 +DECLARE_APQ_GPIO_PINS(71);
235 +DECLARE_APQ_GPIO_PINS(72);
236 +DECLARE_APQ_GPIO_PINS(73);
237 +DECLARE_APQ_GPIO_PINS(74);
238 +DECLARE_APQ_GPIO_PINS(75);
239 +DECLARE_APQ_GPIO_PINS(76);
240 +DECLARE_APQ_GPIO_PINS(77);
241 +DECLARE_APQ_GPIO_PINS(78);
242 +DECLARE_APQ_GPIO_PINS(79);
243 +DECLARE_APQ_GPIO_PINS(80);
244 +DECLARE_APQ_GPIO_PINS(81);
245 +DECLARE_APQ_GPIO_PINS(82);
246 +DECLARE_APQ_GPIO_PINS(83);
247 +DECLARE_APQ_GPIO_PINS(84);
248 +DECLARE_APQ_GPIO_PINS(85);
249 +DECLARE_APQ_GPIO_PINS(86);
250 +DECLARE_APQ_GPIO_PINS(87);
251 +DECLARE_APQ_GPIO_PINS(88);
252 +DECLARE_APQ_GPIO_PINS(89);
253 +
254 +#define FUNCTION(fname)                                        \
255 +       [APQ_MUX_##fname] = {                           \
256 +               .name = #fname,                         \
257 +               .groups = fname##_groups,               \
258 +               .ngroups = ARRAY_SIZE(fname##_groups),  \
259 +       }
260 +
261 +#define PINGROUP(id, f1, f2, f3, f4, f5, f6, f7, f8, f9, f10) \
262 +       {                                               \
263 +               .name = "gpio" #id,                     \
264 +               .pins = gpio##id##_pins,                \
265 +               .npins = ARRAY_SIZE(gpio##id##_pins),   \
266 +               .funcs = (int[]){                       \
267 +                       APQ_MUX_NA, /* gpio mode */     \
268 +                       APQ_MUX_##f1,                   \
269 +                       APQ_MUX_##f2,                   \
270 +                       APQ_MUX_##f3,                   \
271 +                       APQ_MUX_##f4,                   \
272 +                       APQ_MUX_##f5,                   \
273 +                       APQ_MUX_##f6,                   \
274 +                       APQ_MUX_##f7,                   \
275 +                       APQ_MUX_##f8,                   \
276 +                       APQ_MUX_##f9,                   \
277 +                       APQ_MUX_##f10,                  \
278 +               },                                      \
279 +               .nfuncs = 11,                           \
280 +               .ctl_reg = 0x1000 + 0x10 * id,          \
281 +               .io_reg = 0x1004 + 0x10 * id,           \
282 +               .intr_cfg_reg = 0x1008 + 0x10 * id,     \
283 +               .intr_status_reg = 0x100c + 0x10 * id,  \
284 +               .intr_target_reg = 0x400 + 0x4 * id,    \
285 +               .mux_bit = 2,                           \
286 +               .pull_bit = 0,                          \
287 +               .drv_bit = 6,                           \
288 +               .oe_bit = 9,                            \
289 +               .in_bit = 0,                            \
290 +               .out_bit = 1,                           \
291 +               .intr_enable_bit = 0,                   \
292 +               .intr_status_bit = 0,                   \
293 +               .intr_ack_high = 1,                     \
294 +               .intr_target_bit = 0,                   \
295 +               .intr_raw_status_bit = 3,               \
296 +               .intr_polarity_bit = 1,                 \
297 +               .intr_detection_bit = 2,                \
298 +               .intr_detection_width = 1,              \
299 +       }
300 +
301 +enum apq8064_functions {
302 +       APQ_MUX_cam_mclk,
303 +       APQ_MUX_codec_mic_i2s,
304 +       APQ_MUX_codec_spkr_i2s,
305 +       APQ_MUX_gsbi1,
306 +       APQ_MUX_gsbi2,
307 +       APQ_MUX_gsbi3,
308 +       APQ_MUX_gsbi4,
309 +       APQ_MUX_gsbi4_cam_i2c,
310 +       APQ_MUX_gsbi5,
311 +       APQ_MUX_gsbi5_spi_cs1,
312 +       APQ_MUX_gsbi5_spi_cs2,
313 +       APQ_MUX_gsbi5_spi_cs3,
314 +       APQ_MUX_gsbi6,
315 +       APQ_MUX_gsbi6_spi_cs1,
316 +       APQ_MUX_gsbi6_spi_cs2,
317 +       APQ_MUX_gsbi6_spi_cs3,
318 +       APQ_MUX_gsbi7,
319 +       APQ_MUX_gsbi7_spi_cs1,
320 +       APQ_MUX_gsbi7_spi_cs2,
321 +       APQ_MUX_gsbi7_spi_cs3,
322 +       APQ_MUX_gsbi_cam_i2c,
323 +       APQ_MUX_hdmi,
324 +       APQ_MUX_mi2s,
325 +       APQ_MUX_riva_bt,
326 +       APQ_MUX_riva_fm,
327 +       APQ_MUX_riva_wlan,
328 +       APQ_MUX_sdc2,
329 +       APQ_MUX_sdc4,
330 +       APQ_MUX_slimbus,
331 +       APQ_MUX_spkr_i2s,
332 +       APQ_MUX_tsif1,
333 +       APQ_MUX_tsif2,
334 +       APQ_MUX_usb2_hsic,
335 +       APQ_MUX_NA,
336 +};
337 +
338 +static const char * const cam_mclk_groups[] = {
339 +       "gpio4" "gpio5"
340 +};
341 +static const char * const codec_mic_i2s_groups[] = {
342 +       "gpio34", "gpio35", "gpio36", "gpio37", "gpio38"
343 +};
344 +static const char * const codec_spkr_i2s_groups[] = {
345 +       "gpio39", "gpio40", "gpio41", "gpio42"
346 +};
347 +static const char * const gsbi1_groups[] = {
348 +       "gpio18", "gpio19", "gpio20", "gpio21"
349 +};
350 +static const char * const gsbi2_groups[] = {
351 +       "gpio22", "gpio23", "gpio24", "gpio25"
352 +};
353 +static const char * const gsbi3_groups[] = {
354 +       "gpio6", "gpio7", "gpio8", "gpio9"
355 +};
356 +static const char * const gsbi4_groups[] = {
357 +       "gpio10", "gpio11", "gpio12", "gpio13"
358 +};
359 +static const char * const gsbi4_cam_i2c_groups[] = {
360 +       "gpio10", "gpio11", "gpio12", "gpio13"
361 +};
362 +static const char * const gsbi5_groups[] = {
363 +       "gpio51", "gpio52", "gpio53", "gpio54"
364 +};
365 +static const char * const gsbi5_spi_cs1_groups[] = {
366 +       "gpio47"
367 +};
368 +static const char * const gsbi5_spi_cs2_groups[] = {
369 +       "gpio31"
370 +};
371 +static const char * const gsbi5_spi_cs3_groups[] = {
372 +       "gpio32"
373 +};
374 +static const char * const gsbi6_groups[] = {
375 +       "gpio14", "gpio15", "gpio16", "gpio17"
376 +};
377 +static const char * const gsbi6_spi_cs1_groups[] = {
378 +       "gpio47"
379 +};
380 +static const char * const gsbi6_spi_cs2_groups[] = {
381 +       "gpio31"
382 +};
383 +static const char * const gsbi6_spi_cs3_groups[] = {
384 +       "gpio32"
385 +};
386 +static const char * const gsbi7_groups[] = {
387 +       "gpio82", "gpio83", "gpio84", "gpio85"
388 +};
389 +static const char * const gsbi7_spi_cs1_groups[] = {
390 +       "gpio47"
391 +};
392 +static const char * const gsbi7_spi_cs2_groups[] = {
393 +       "gpio31"
394 +};
395 +static const char * const gsbi7_spi_cs3_groups[] = {
396 +       "gpio32"
397 +};
398 +static const char * const gsbi_cam_i2c_groups[] = {
399 +       "gpio10", "gpio11", "gpio12", "gpio13"
400 +};
401 +static const char * const hdmi_groups[] = {
402 +       "gpio69", "gpio70", "gpio71", "gpio72"
403 +};
404 +static const char * const mi2s_groups[] = {
405 +       "gpio27", "gpio28", "gpio29", "gpio30", "gpio31", "gpio32", "gpio33"
406 +};
407 +static const char * const riva_bt_groups[] = {
408 +       "gpio16", "gpio17"
409 +};
410 +static const char * const riva_fm_groups[] = {
411 +       "gpio14", "gpio15"
412 +};
413 +static const char * const riva_wlan_groups[] = {
414 +       "gpio64", "gpio65", "gpio66", "gpio67", "gpio68"
415 +};
416 +static const char * const sdc2_groups[] = {
417 +       "gpio57", "gpio58", "gpio59", "gpio60", "gpio61", "gpio62"
418 +};
419 +static const char * const sdc4_groups[] = {
420 +       "gpio63", "gpio64", "gpio65", "gpio66", "gpio67", "gpio68"
421 +};
422 +static const char * const slimbus_groups[] = {
423 +       "gpio40", "gpio41"
424 +};
425 +static const char * const spkr_i2s_groups[] = {
426 +       "gpio47", "gpio48", "gpio49", "gpio50"
427 +};
428 +static const char * const tsif1_groups[] = {
429 +       "gpio55", "gpio56", "gpio57"
430 +};
431 +static const char * const tsif2_groups[] = {
432 +       "gpio58", "gpio59", "gpio60"
433 +};
434 +static const char * const usb2_hsic_groups[] = {
435 +       "gpio88", "gpio89"
436 +};
437 +
438 +static const struct msm_function apq8064_functions[] = {
439 +       FUNCTION(cam_mclk),
440 +       FUNCTION(codec_mic_i2s),
441 +       FUNCTION(codec_spkr_i2s),
442 +       FUNCTION(gsbi1),
443 +       FUNCTION(gsbi2),
444 +       FUNCTION(gsbi3),
445 +       FUNCTION(gsbi4),
446 +       FUNCTION(gsbi4_cam_i2c),
447 +       FUNCTION(gsbi5),
448 +       FUNCTION(gsbi5_spi_cs1),
449 +       FUNCTION(gsbi5_spi_cs2),
450 +       FUNCTION(gsbi5_spi_cs3),
451 +       FUNCTION(gsbi6),
452 +       FUNCTION(gsbi6_spi_cs1),
453 +       FUNCTION(gsbi6_spi_cs2),
454 +       FUNCTION(gsbi6_spi_cs3),
455 +       FUNCTION(gsbi7),
456 +       FUNCTION(gsbi7_spi_cs1),
457 +       FUNCTION(gsbi7_spi_cs2),
458 +       FUNCTION(gsbi7_spi_cs3),
459 +       FUNCTION(gsbi_cam_i2c),
460 +       FUNCTION(hdmi),
461 +       FUNCTION(mi2s),
462 +       FUNCTION(riva_bt),
463 +       FUNCTION(riva_fm),
464 +       FUNCTION(riva_wlan),
465 +       FUNCTION(sdc2),
466 +       FUNCTION(sdc4),
467 +       FUNCTION(slimbus),
468 +       FUNCTION(spkr_i2s),
469 +       FUNCTION(tsif1),
470 +       FUNCTION(tsif2),
471 +       FUNCTION(usb2_hsic),
472 +};
473 +
474 +static const struct msm_pingroup apq8064_groups[] = {
475 +       PINGROUP(0, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA),
476 +       PINGROUP(1, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA),
477 +       PINGROUP(2, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA),
478 +       PINGROUP(3, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA),
479 +       PINGROUP(4, NA, NA, cam_mclk, NA, NA, NA, NA, NA, NA, NA),
480 +       PINGROUP(5, NA, cam_mclk, NA, NA, NA, NA, NA, NA, NA, NA),
481 +       PINGROUP(6, gsbi3, NA, NA, NA, NA, NA, NA, NA, NA, NA),
482 +       PINGROUP(7, gsbi3, NA, NA, NA, NA, NA, NA, NA, NA, NA),
483 +       PINGROUP(8, gsbi3, NA, NA, NA, NA, NA, NA, NA, NA, NA),
484 +       PINGROUP(9, gsbi3, NA, NA, NA, NA, NA, NA, NA, NA, NA),
485 +       PINGROUP(10, gsbi4, NA, NA, NA, NA, NA, NA, NA, gsbi4_cam_i2c, NA),
486 +       PINGROUP(11, gsbi4, NA, NA, NA, NA, NA, NA, NA, NA, gsbi4_cam_i2c),
487 +       PINGROUP(12, gsbi4, NA, NA, NA, NA, gsbi4_cam_i2c, NA, NA, NA, NA),
488 +       PINGROUP(13, gsbi4, NA, NA, NA, NA, gsbi4_cam_i2c, NA, NA, NA, NA),
489 +       PINGROUP(14, riva_fm, gsbi6, NA, NA, NA, NA, NA, NA, NA, NA),
490 +       PINGROUP(15, riva_fm, gsbi6, NA, NA, NA, NA, NA, NA, NA, NA),
491 +       PINGROUP(16, riva_bt, gsbi6, NA, NA, NA, NA, NA, NA, NA, NA),
492 +       PINGROUP(17, riva_bt, gsbi6, NA, NA, NA, NA, NA, NA, NA, NA),
493 +       PINGROUP(18, gsbi1, NA, NA, NA, NA, NA, NA, NA, NA, NA),
494 +       PINGROUP(19, gsbi1, NA, NA, NA, NA, NA, NA, NA, NA, NA),
495 +       PINGROUP(20, gsbi1, NA, NA, NA, NA, NA, NA, NA, NA, NA),
496 +       PINGROUP(21, gsbi1, NA, NA, NA, NA, NA, NA, NA, NA, NA),
497 +       PINGROUP(22, gsbi2, NA, NA, NA, NA, NA, NA, NA, NA, NA),
498 +       PINGROUP(23, gsbi2, NA, NA, NA, NA, NA, NA, NA, NA, NA),
499 +       PINGROUP(24, gsbi2, NA, NA, NA, NA, NA, NA, NA, NA, NA),
500 +       PINGROUP(25, gsbi2, NA, NA, NA, NA, NA, NA, NA, NA, NA),
501 +       PINGROUP(26, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA),
502 +       PINGROUP(27, mi2s, NA, NA, NA, NA, NA, NA, NA, NA, NA),
503 +       PINGROUP(28, mi2s, NA, NA, NA, NA, NA, NA, NA, NA, NA),
504 +       PINGROUP(29, mi2s, NA, NA, NA, NA, NA, NA, NA, NA, NA),
505 +       PINGROUP(30, mi2s, NA, NA, NA, NA, NA, NA, NA, NA, NA),
506 +       PINGROUP(31, mi2s, NA, gsbi5_spi_cs2, gsbi6_spi_cs2, gsbi7_spi_cs2, NA, NA, NA, NA, NA),
507 +       PINGROUP(32, mi2s, NA, NA, NA, NA, gsbi5_spi_cs3, gsbi6_spi_cs3, gsbi7_spi_cs3, NA, NA),
508 +       PINGROUP(33, mi2s, NA, NA, NA, NA, NA, NA, NA, NA, NA),
509 +       PINGROUP(34, codec_mic_i2s, NA, NA, NA, NA, NA, NA, NA, NA, NA),
510 +       PINGROUP(35, codec_mic_i2s, NA, NA, NA, NA, NA, NA, NA, NA, NA),
511 +       PINGROUP(36, codec_mic_i2s, NA, NA, NA, NA, NA, NA, NA, NA, NA),
512 +       PINGROUP(37, codec_mic_i2s, NA, NA, NA, NA, NA, NA, NA, NA, NA),
513 +       PINGROUP(38, codec_mic_i2s, NA, NA, NA, NA, NA, NA, NA, NA, NA),
514 +       PINGROUP(39, codec_spkr_i2s, NA, NA, NA, NA, NA, NA, NA, NA, NA),
515 +       PINGROUP(40, slimbus, codec_spkr_i2s, NA, NA, NA, NA, NA, NA, NA, NA),
516 +       PINGROUP(41, slimbus, codec_spkr_i2s, NA, NA, NA, NA, NA, NA, NA, NA),
517 +       PINGROUP(42, codec_spkr_i2s, NA, NA, NA, NA, NA, NA, NA, NA, NA),
518 +       PINGROUP(43, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA),
519 +       PINGROUP(44, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA),
520 +       PINGROUP(45, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA),
521 +       PINGROUP(46, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA),
522 +       PINGROUP(47, spkr_i2s, gsbi5_spi_cs1, gsbi6_spi_cs1, gsbi7_spi_cs1, NA, NA, NA, NA, NA, NA),
523 +       PINGROUP(48, spkr_i2s, NA, NA, NA, NA, NA, NA, NA, NA, NA),
524 +       PINGROUP(49, spkr_i2s, NA, NA, NA, NA, NA, NA, NA, NA, NA),
525 +       PINGROUP(50, spkr_i2s, NA, NA, NA, NA, NA, NA, NA, NA, NA),
526 +       PINGROUP(51, NA, gsbi5, NA, NA, NA, NA, NA, NA, NA, NA),
527 +       PINGROUP(52, NA, gsbi5, NA, NA, NA, NA, NA, NA, NA, NA),
528 +       PINGROUP(53, NA, gsbi5, NA, NA, NA, NA, NA, NA, NA, NA),
529 +       PINGROUP(54, NA, gsbi5, NA, NA, NA, NA, NA, NA, NA, NA),
530 +       PINGROUP(55, tsif1, NA, NA, NA, NA, NA, NA, NA, NA, NA),
531 +       PINGROUP(56, tsif1, NA, NA, NA, NA, NA, NA, NA, NA, NA),
532 +       PINGROUP(57, tsif1, sdc2, NA, NA, NA, NA, NA, NA, NA, NA),
533 +       PINGROUP(58, tsif2, sdc2, NA, NA, NA, NA, NA, NA, NA, NA),
534 +       PINGROUP(59, tsif2, sdc2, NA, NA, NA, NA, NA, NA, NA, NA),
535 +       PINGROUP(60, tsif2, sdc2, NA, NA, NA, NA, NA, NA, NA, NA),
536 +       PINGROUP(61, NA, sdc2, NA, NA, NA, NA, NA, NA, NA, NA),
537 +       PINGROUP(62, NA, sdc2, NA, NA, NA, NA, NA, NA, NA, NA),
538 +       PINGROUP(63, NA, sdc4, NA, NA, NA, NA, NA, NA, NA, NA),
539 +       PINGROUP(64, riva_wlan, sdc4, NA, NA, NA, NA, NA, NA, NA, NA),
540 +       PINGROUP(65, riva_wlan, sdc4, NA, NA, NA, NA, NA, NA, NA, NA),
541 +       PINGROUP(66, riva_wlan, sdc4, NA, NA, NA, NA, NA, NA, NA, NA),
542 +       PINGROUP(67, riva_wlan, sdc4, NA, NA, NA, NA, NA, NA, NA, NA),
543 +       PINGROUP(68, riva_wlan, sdc4, NA, NA, NA, NA, NA, NA, NA, NA),
544 +       PINGROUP(69, hdmi, NA, NA, NA, NA, NA, NA, NA, NA, NA),
545 +       PINGROUP(70, hdmi, NA, NA, NA, NA, NA, NA, NA, NA, NA),
546 +       PINGROUP(71, hdmi, NA, NA, NA, NA, NA, NA, NA, NA, NA),
547 +       PINGROUP(72, hdmi, NA, NA, NA, NA, NA, NA, NA, NA, NA),
548 +       PINGROUP(73, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA),
549 +       PINGROUP(74, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA),
550 +       PINGROUP(75, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA),
551 +       PINGROUP(76, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA),
552 +       PINGROUP(77, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA),
553 +       PINGROUP(78, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA),
554 +       PINGROUP(79, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA),
555 +       PINGROUP(80, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA),
556 +       PINGROUP(81, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA),
557 +       PINGROUP(82, NA, gsbi7, NA, NA, NA, NA, NA, NA, NA, NA),
558 +       PINGROUP(83, gsbi7, NA, NA, NA, NA, NA, NA, NA, NA, NA),
559 +       PINGROUP(84, NA, gsbi7, NA, NA, NA, NA, NA, NA, NA, NA),
560 +       PINGROUP(85, NA, NA, gsbi7, NA, NA, NA, NA, NA, NA, NA),
561 +       PINGROUP(86, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA),
562 +       PINGROUP(87, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA),
563 +       PINGROUP(88, usb2_hsic, NA, NA, NA, NA, NA, NA, NA, NA, NA),
564 +       PINGROUP(89, usb2_hsic, NA, NA, NA, NA, NA, NA, NA, NA, NA),
565 +};
566 +
567 +#define NUM_GPIO_PINGROUPS 90
568 +
569 +static const struct msm_pinctrl_soc_data apq8064_pinctrl = {
570 +       .pins = apq8064_pins,
571 +       .npins = ARRAY_SIZE(apq8064_pins),
572 +       .functions = apq8064_functions,
573 +       .nfunctions = ARRAY_SIZE(apq8064_functions),
574 +       .groups = apq8064_groups,
575 +       .ngroups = ARRAY_SIZE(apq8064_groups),
576 +       .ngpios = NUM_GPIO_PINGROUPS,
577 +};
578 +
579 +static int apq8064_pinctrl_probe(struct platform_device *pdev)
580 +{
581 +       return msm_pinctrl_probe(pdev, &apq8064_pinctrl);
582 +}
583 +
584 +static const struct of_device_id apq8064_pinctrl_of_match[] = {
585 +       { .compatible = "qcom,apq8064-pinctrl", },
586 +       { },
587 +};
588 +
589 +static struct platform_driver apq8064_pinctrl_driver = {
590 +       .driver = {
591 +               .name = "apq8064-pinctrl",
592 +               .owner = THIS_MODULE,
593 +               .of_match_table = apq8064_pinctrl_of_match,
594 +       },
595 +       .probe = apq8064_pinctrl_probe,
596 +       .remove = msm_pinctrl_remove,
597 +};
598 +
599 +static int __init apq8064_pinctrl_init(void)
600 +{
601 +       return platform_driver_register(&apq8064_pinctrl_driver);
602 +}
603 +arch_initcall(apq8064_pinctrl_init);
604 +
605 +static void __exit apq8064_pinctrl_exit(void)
606 +{
607 +       platform_driver_unregister(&apq8064_pinctrl_driver);
608 +}
609 +module_exit(apq8064_pinctrl_exit);
610 +
611 +MODULE_AUTHOR("Bjorn Andersson <bjorn.andersson@sonymobile.com>");
612 +MODULE_DESCRIPTION("Qualcomm APQ8064 pinctrl driver");
613 +MODULE_LICENSE("GPL v2");
614 +MODULE_DEVICE_TABLE(of, apq8064_pinctrl_of_match);