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