0038-pinctrl-msm-Add-definitions-for-the-APQ8064-platform.patch 20 KB

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