18c2ecf20Sopenharmony_ci// SPDX-License-Identifier: GPL-2.0-only 28c2ecf20Sopenharmony_ci/* 38c2ecf20Sopenharmony_ci * Copyright (c) 2014, Sony Mobile Communications AB. 48c2ecf20Sopenharmony_ci * Copyright (c) 2016 BayLibre, SAS. 58c2ecf20Sopenharmony_ci * Author : Neil Armstrong <narmstrong@baylibre.com> 68c2ecf20Sopenharmony_ci */ 78c2ecf20Sopenharmony_ci 88c2ecf20Sopenharmony_ci#include <linux/module.h> 98c2ecf20Sopenharmony_ci#include <linux/of.h> 108c2ecf20Sopenharmony_ci#include <linux/platform_device.h> 118c2ecf20Sopenharmony_ci#include <linux/pinctrl/pinctrl.h> 128c2ecf20Sopenharmony_ci#include <linux/pinctrl/pinmux.h> 138c2ecf20Sopenharmony_ci 148c2ecf20Sopenharmony_ci#include "pinctrl-msm.h" 158c2ecf20Sopenharmony_ci 168c2ecf20Sopenharmony_cistatic const struct pinctrl_pin_desc mdm9615_pins[] = { 178c2ecf20Sopenharmony_ci PINCTRL_PIN(0, "GPIO_0"), 188c2ecf20Sopenharmony_ci PINCTRL_PIN(1, "GPIO_1"), 198c2ecf20Sopenharmony_ci PINCTRL_PIN(2, "GPIO_2"), 208c2ecf20Sopenharmony_ci PINCTRL_PIN(3, "GPIO_3"), 218c2ecf20Sopenharmony_ci PINCTRL_PIN(4, "GPIO_4"), 228c2ecf20Sopenharmony_ci PINCTRL_PIN(5, "GPIO_5"), 238c2ecf20Sopenharmony_ci PINCTRL_PIN(6, "GPIO_6"), 248c2ecf20Sopenharmony_ci PINCTRL_PIN(7, "GPIO_7"), 258c2ecf20Sopenharmony_ci PINCTRL_PIN(8, "GPIO_8"), 268c2ecf20Sopenharmony_ci PINCTRL_PIN(9, "GPIO_9"), 278c2ecf20Sopenharmony_ci PINCTRL_PIN(10, "GPIO_10"), 288c2ecf20Sopenharmony_ci PINCTRL_PIN(11, "GPIO_11"), 298c2ecf20Sopenharmony_ci PINCTRL_PIN(12, "GPIO_12"), 308c2ecf20Sopenharmony_ci PINCTRL_PIN(13, "GPIO_13"), 318c2ecf20Sopenharmony_ci PINCTRL_PIN(14, "GPIO_14"), 328c2ecf20Sopenharmony_ci PINCTRL_PIN(15, "GPIO_15"), 338c2ecf20Sopenharmony_ci PINCTRL_PIN(16, "GPIO_16"), 348c2ecf20Sopenharmony_ci PINCTRL_PIN(17, "GPIO_17"), 358c2ecf20Sopenharmony_ci PINCTRL_PIN(18, "GPIO_18"), 368c2ecf20Sopenharmony_ci PINCTRL_PIN(19, "GPIO_19"), 378c2ecf20Sopenharmony_ci PINCTRL_PIN(20, "GPIO_20"), 388c2ecf20Sopenharmony_ci PINCTRL_PIN(21, "GPIO_21"), 398c2ecf20Sopenharmony_ci PINCTRL_PIN(22, "GPIO_22"), 408c2ecf20Sopenharmony_ci PINCTRL_PIN(23, "GPIO_23"), 418c2ecf20Sopenharmony_ci PINCTRL_PIN(24, "GPIO_24"), 428c2ecf20Sopenharmony_ci PINCTRL_PIN(25, "GPIO_25"), 438c2ecf20Sopenharmony_ci PINCTRL_PIN(26, "GPIO_26"), 448c2ecf20Sopenharmony_ci PINCTRL_PIN(27, "GPIO_27"), 458c2ecf20Sopenharmony_ci PINCTRL_PIN(28, "GPIO_28"), 468c2ecf20Sopenharmony_ci PINCTRL_PIN(29, "GPIO_29"), 478c2ecf20Sopenharmony_ci PINCTRL_PIN(30, "GPIO_30"), 488c2ecf20Sopenharmony_ci PINCTRL_PIN(31, "GPIO_31"), 498c2ecf20Sopenharmony_ci PINCTRL_PIN(32, "GPIO_32"), 508c2ecf20Sopenharmony_ci PINCTRL_PIN(33, "GPIO_33"), 518c2ecf20Sopenharmony_ci PINCTRL_PIN(34, "GPIO_34"), 528c2ecf20Sopenharmony_ci PINCTRL_PIN(35, "GPIO_35"), 538c2ecf20Sopenharmony_ci PINCTRL_PIN(36, "GPIO_36"), 548c2ecf20Sopenharmony_ci PINCTRL_PIN(37, "GPIO_37"), 558c2ecf20Sopenharmony_ci PINCTRL_PIN(38, "GPIO_38"), 568c2ecf20Sopenharmony_ci PINCTRL_PIN(39, "GPIO_39"), 578c2ecf20Sopenharmony_ci PINCTRL_PIN(40, "GPIO_40"), 588c2ecf20Sopenharmony_ci PINCTRL_PIN(41, "GPIO_41"), 598c2ecf20Sopenharmony_ci PINCTRL_PIN(42, "GPIO_42"), 608c2ecf20Sopenharmony_ci PINCTRL_PIN(43, "GPIO_43"), 618c2ecf20Sopenharmony_ci PINCTRL_PIN(44, "GPIO_44"), 628c2ecf20Sopenharmony_ci PINCTRL_PIN(45, "GPIO_45"), 638c2ecf20Sopenharmony_ci PINCTRL_PIN(46, "GPIO_46"), 648c2ecf20Sopenharmony_ci PINCTRL_PIN(47, "GPIO_47"), 658c2ecf20Sopenharmony_ci PINCTRL_PIN(48, "GPIO_48"), 668c2ecf20Sopenharmony_ci PINCTRL_PIN(49, "GPIO_49"), 678c2ecf20Sopenharmony_ci PINCTRL_PIN(50, "GPIO_50"), 688c2ecf20Sopenharmony_ci PINCTRL_PIN(51, "GPIO_51"), 698c2ecf20Sopenharmony_ci PINCTRL_PIN(52, "GPIO_52"), 708c2ecf20Sopenharmony_ci PINCTRL_PIN(53, "GPIO_53"), 718c2ecf20Sopenharmony_ci PINCTRL_PIN(54, "GPIO_54"), 728c2ecf20Sopenharmony_ci PINCTRL_PIN(55, "GPIO_55"), 738c2ecf20Sopenharmony_ci PINCTRL_PIN(56, "GPIO_56"), 748c2ecf20Sopenharmony_ci PINCTRL_PIN(57, "GPIO_57"), 758c2ecf20Sopenharmony_ci PINCTRL_PIN(58, "GPIO_58"), 768c2ecf20Sopenharmony_ci PINCTRL_PIN(59, "GPIO_59"), 778c2ecf20Sopenharmony_ci PINCTRL_PIN(60, "GPIO_60"), 788c2ecf20Sopenharmony_ci PINCTRL_PIN(61, "GPIO_61"), 798c2ecf20Sopenharmony_ci PINCTRL_PIN(62, "GPIO_62"), 808c2ecf20Sopenharmony_ci PINCTRL_PIN(63, "GPIO_63"), 818c2ecf20Sopenharmony_ci PINCTRL_PIN(64, "GPIO_64"), 828c2ecf20Sopenharmony_ci PINCTRL_PIN(65, "GPIO_65"), 838c2ecf20Sopenharmony_ci PINCTRL_PIN(66, "GPIO_66"), 848c2ecf20Sopenharmony_ci PINCTRL_PIN(67, "GPIO_67"), 858c2ecf20Sopenharmony_ci PINCTRL_PIN(68, "GPIO_68"), 868c2ecf20Sopenharmony_ci PINCTRL_PIN(69, "GPIO_69"), 878c2ecf20Sopenharmony_ci PINCTRL_PIN(70, "GPIO_70"), 888c2ecf20Sopenharmony_ci PINCTRL_PIN(71, "GPIO_71"), 898c2ecf20Sopenharmony_ci PINCTRL_PIN(72, "GPIO_72"), 908c2ecf20Sopenharmony_ci PINCTRL_PIN(73, "GPIO_73"), 918c2ecf20Sopenharmony_ci PINCTRL_PIN(74, "GPIO_74"), 928c2ecf20Sopenharmony_ci PINCTRL_PIN(75, "GPIO_75"), 938c2ecf20Sopenharmony_ci PINCTRL_PIN(76, "GPIO_76"), 948c2ecf20Sopenharmony_ci PINCTRL_PIN(77, "GPIO_77"), 958c2ecf20Sopenharmony_ci PINCTRL_PIN(78, "GPIO_78"), 968c2ecf20Sopenharmony_ci PINCTRL_PIN(79, "GPIO_79"), 978c2ecf20Sopenharmony_ci PINCTRL_PIN(80, "GPIO_80"), 988c2ecf20Sopenharmony_ci PINCTRL_PIN(81, "GPIO_81"), 998c2ecf20Sopenharmony_ci PINCTRL_PIN(82, "GPIO_82"), 1008c2ecf20Sopenharmony_ci PINCTRL_PIN(83, "GPIO_83"), 1018c2ecf20Sopenharmony_ci PINCTRL_PIN(84, "GPIO_84"), 1028c2ecf20Sopenharmony_ci PINCTRL_PIN(85, "GPIO_85"), 1038c2ecf20Sopenharmony_ci PINCTRL_PIN(86, "GPIO_86"), 1048c2ecf20Sopenharmony_ci PINCTRL_PIN(87, "GPIO_87"), 1058c2ecf20Sopenharmony_ci}; 1068c2ecf20Sopenharmony_ci 1078c2ecf20Sopenharmony_ci#define DECLARE_MSM_GPIO_PINS(pin) \ 1088c2ecf20Sopenharmony_ci static const unsigned int gpio##pin##_pins[] = { pin } 1098c2ecf20Sopenharmony_ciDECLARE_MSM_GPIO_PINS(0); 1108c2ecf20Sopenharmony_ciDECLARE_MSM_GPIO_PINS(1); 1118c2ecf20Sopenharmony_ciDECLARE_MSM_GPIO_PINS(2); 1128c2ecf20Sopenharmony_ciDECLARE_MSM_GPIO_PINS(3); 1138c2ecf20Sopenharmony_ciDECLARE_MSM_GPIO_PINS(4); 1148c2ecf20Sopenharmony_ciDECLARE_MSM_GPIO_PINS(5); 1158c2ecf20Sopenharmony_ciDECLARE_MSM_GPIO_PINS(6); 1168c2ecf20Sopenharmony_ciDECLARE_MSM_GPIO_PINS(7); 1178c2ecf20Sopenharmony_ciDECLARE_MSM_GPIO_PINS(8); 1188c2ecf20Sopenharmony_ciDECLARE_MSM_GPIO_PINS(9); 1198c2ecf20Sopenharmony_ciDECLARE_MSM_GPIO_PINS(10); 1208c2ecf20Sopenharmony_ciDECLARE_MSM_GPIO_PINS(11); 1218c2ecf20Sopenharmony_ciDECLARE_MSM_GPIO_PINS(12); 1228c2ecf20Sopenharmony_ciDECLARE_MSM_GPIO_PINS(13); 1238c2ecf20Sopenharmony_ciDECLARE_MSM_GPIO_PINS(14); 1248c2ecf20Sopenharmony_ciDECLARE_MSM_GPIO_PINS(15); 1258c2ecf20Sopenharmony_ciDECLARE_MSM_GPIO_PINS(16); 1268c2ecf20Sopenharmony_ciDECLARE_MSM_GPIO_PINS(17); 1278c2ecf20Sopenharmony_ciDECLARE_MSM_GPIO_PINS(18); 1288c2ecf20Sopenharmony_ciDECLARE_MSM_GPIO_PINS(19); 1298c2ecf20Sopenharmony_ciDECLARE_MSM_GPIO_PINS(20); 1308c2ecf20Sopenharmony_ciDECLARE_MSM_GPIO_PINS(21); 1318c2ecf20Sopenharmony_ciDECLARE_MSM_GPIO_PINS(22); 1328c2ecf20Sopenharmony_ciDECLARE_MSM_GPIO_PINS(23); 1338c2ecf20Sopenharmony_ciDECLARE_MSM_GPIO_PINS(24); 1348c2ecf20Sopenharmony_ciDECLARE_MSM_GPIO_PINS(25); 1358c2ecf20Sopenharmony_ciDECLARE_MSM_GPIO_PINS(26); 1368c2ecf20Sopenharmony_ciDECLARE_MSM_GPIO_PINS(27); 1378c2ecf20Sopenharmony_ciDECLARE_MSM_GPIO_PINS(28); 1388c2ecf20Sopenharmony_ciDECLARE_MSM_GPIO_PINS(29); 1398c2ecf20Sopenharmony_ciDECLARE_MSM_GPIO_PINS(30); 1408c2ecf20Sopenharmony_ciDECLARE_MSM_GPIO_PINS(31); 1418c2ecf20Sopenharmony_ciDECLARE_MSM_GPIO_PINS(32); 1428c2ecf20Sopenharmony_ciDECLARE_MSM_GPIO_PINS(33); 1438c2ecf20Sopenharmony_ciDECLARE_MSM_GPIO_PINS(34); 1448c2ecf20Sopenharmony_ciDECLARE_MSM_GPIO_PINS(35); 1458c2ecf20Sopenharmony_ciDECLARE_MSM_GPIO_PINS(36); 1468c2ecf20Sopenharmony_ciDECLARE_MSM_GPIO_PINS(37); 1478c2ecf20Sopenharmony_ciDECLARE_MSM_GPIO_PINS(38); 1488c2ecf20Sopenharmony_ciDECLARE_MSM_GPIO_PINS(39); 1498c2ecf20Sopenharmony_ciDECLARE_MSM_GPIO_PINS(40); 1508c2ecf20Sopenharmony_ciDECLARE_MSM_GPIO_PINS(41); 1518c2ecf20Sopenharmony_ciDECLARE_MSM_GPIO_PINS(42); 1528c2ecf20Sopenharmony_ciDECLARE_MSM_GPIO_PINS(43); 1538c2ecf20Sopenharmony_ciDECLARE_MSM_GPIO_PINS(44); 1548c2ecf20Sopenharmony_ciDECLARE_MSM_GPIO_PINS(45); 1558c2ecf20Sopenharmony_ciDECLARE_MSM_GPIO_PINS(46); 1568c2ecf20Sopenharmony_ciDECLARE_MSM_GPIO_PINS(47); 1578c2ecf20Sopenharmony_ciDECLARE_MSM_GPIO_PINS(48); 1588c2ecf20Sopenharmony_ciDECLARE_MSM_GPIO_PINS(49); 1598c2ecf20Sopenharmony_ciDECLARE_MSM_GPIO_PINS(50); 1608c2ecf20Sopenharmony_ciDECLARE_MSM_GPIO_PINS(51); 1618c2ecf20Sopenharmony_ciDECLARE_MSM_GPIO_PINS(52); 1628c2ecf20Sopenharmony_ciDECLARE_MSM_GPIO_PINS(53); 1638c2ecf20Sopenharmony_ciDECLARE_MSM_GPIO_PINS(54); 1648c2ecf20Sopenharmony_ciDECLARE_MSM_GPIO_PINS(55); 1658c2ecf20Sopenharmony_ciDECLARE_MSM_GPIO_PINS(56); 1668c2ecf20Sopenharmony_ciDECLARE_MSM_GPIO_PINS(57); 1678c2ecf20Sopenharmony_ciDECLARE_MSM_GPIO_PINS(58); 1688c2ecf20Sopenharmony_ciDECLARE_MSM_GPIO_PINS(59); 1698c2ecf20Sopenharmony_ciDECLARE_MSM_GPIO_PINS(60); 1708c2ecf20Sopenharmony_ciDECLARE_MSM_GPIO_PINS(61); 1718c2ecf20Sopenharmony_ciDECLARE_MSM_GPIO_PINS(62); 1728c2ecf20Sopenharmony_ciDECLARE_MSM_GPIO_PINS(63); 1738c2ecf20Sopenharmony_ciDECLARE_MSM_GPIO_PINS(64); 1748c2ecf20Sopenharmony_ciDECLARE_MSM_GPIO_PINS(65); 1758c2ecf20Sopenharmony_ciDECLARE_MSM_GPIO_PINS(66); 1768c2ecf20Sopenharmony_ciDECLARE_MSM_GPIO_PINS(67); 1778c2ecf20Sopenharmony_ciDECLARE_MSM_GPIO_PINS(68); 1788c2ecf20Sopenharmony_ciDECLARE_MSM_GPIO_PINS(69); 1798c2ecf20Sopenharmony_ciDECLARE_MSM_GPIO_PINS(70); 1808c2ecf20Sopenharmony_ciDECLARE_MSM_GPIO_PINS(71); 1818c2ecf20Sopenharmony_ciDECLARE_MSM_GPIO_PINS(72); 1828c2ecf20Sopenharmony_ciDECLARE_MSM_GPIO_PINS(73); 1838c2ecf20Sopenharmony_ciDECLARE_MSM_GPIO_PINS(74); 1848c2ecf20Sopenharmony_ciDECLARE_MSM_GPIO_PINS(75); 1858c2ecf20Sopenharmony_ciDECLARE_MSM_GPIO_PINS(76); 1868c2ecf20Sopenharmony_ciDECLARE_MSM_GPIO_PINS(77); 1878c2ecf20Sopenharmony_ciDECLARE_MSM_GPIO_PINS(78); 1888c2ecf20Sopenharmony_ciDECLARE_MSM_GPIO_PINS(79); 1898c2ecf20Sopenharmony_ciDECLARE_MSM_GPIO_PINS(80); 1908c2ecf20Sopenharmony_ciDECLARE_MSM_GPIO_PINS(81); 1918c2ecf20Sopenharmony_ciDECLARE_MSM_GPIO_PINS(82); 1928c2ecf20Sopenharmony_ciDECLARE_MSM_GPIO_PINS(83); 1938c2ecf20Sopenharmony_ciDECLARE_MSM_GPIO_PINS(84); 1948c2ecf20Sopenharmony_ciDECLARE_MSM_GPIO_PINS(85); 1958c2ecf20Sopenharmony_ciDECLARE_MSM_GPIO_PINS(86); 1968c2ecf20Sopenharmony_ciDECLARE_MSM_GPIO_PINS(87); 1978c2ecf20Sopenharmony_ci 1988c2ecf20Sopenharmony_ci#define FUNCTION(fname) \ 1998c2ecf20Sopenharmony_ci [MSM_MUX_##fname] = { \ 2008c2ecf20Sopenharmony_ci .name = #fname, \ 2018c2ecf20Sopenharmony_ci .groups = fname##_groups, \ 2028c2ecf20Sopenharmony_ci .ngroups = ARRAY_SIZE(fname##_groups), \ 2038c2ecf20Sopenharmony_ci } 2048c2ecf20Sopenharmony_ci 2058c2ecf20Sopenharmony_ci#define PINGROUP(id, f1, f2, f3, f4, f5, f6, f7, f8, f9, f10, f11) \ 2068c2ecf20Sopenharmony_ci { \ 2078c2ecf20Sopenharmony_ci .name = "gpio" #id, \ 2088c2ecf20Sopenharmony_ci .pins = gpio##id##_pins, \ 2098c2ecf20Sopenharmony_ci .npins = ARRAY_SIZE(gpio##id##_pins), \ 2108c2ecf20Sopenharmony_ci .funcs = (int[]){ \ 2118c2ecf20Sopenharmony_ci MSM_MUX_gpio, \ 2128c2ecf20Sopenharmony_ci MSM_MUX_##f1, \ 2138c2ecf20Sopenharmony_ci MSM_MUX_##f2, \ 2148c2ecf20Sopenharmony_ci MSM_MUX_##f3, \ 2158c2ecf20Sopenharmony_ci MSM_MUX_##f4, \ 2168c2ecf20Sopenharmony_ci MSM_MUX_##f5, \ 2178c2ecf20Sopenharmony_ci MSM_MUX_##f6, \ 2188c2ecf20Sopenharmony_ci MSM_MUX_##f7, \ 2198c2ecf20Sopenharmony_ci MSM_MUX_##f8, \ 2208c2ecf20Sopenharmony_ci MSM_MUX_##f9, \ 2218c2ecf20Sopenharmony_ci MSM_MUX_##f10, \ 2228c2ecf20Sopenharmony_ci MSM_MUX_##f11 \ 2238c2ecf20Sopenharmony_ci }, \ 2248c2ecf20Sopenharmony_ci .nfuncs = 12, \ 2258c2ecf20Sopenharmony_ci .ctl_reg = 0x1000 + 0x10 * id, \ 2268c2ecf20Sopenharmony_ci .io_reg = 0x1004 + 0x10 * id, \ 2278c2ecf20Sopenharmony_ci .intr_cfg_reg = 0x1008 + 0x10 * id, \ 2288c2ecf20Sopenharmony_ci .intr_status_reg = 0x100c + 0x10 * id, \ 2298c2ecf20Sopenharmony_ci .intr_target_reg = 0x400 + 0x4 * id, \ 2308c2ecf20Sopenharmony_ci .mux_bit = 2, \ 2318c2ecf20Sopenharmony_ci .pull_bit = 0, \ 2328c2ecf20Sopenharmony_ci .drv_bit = 6, \ 2338c2ecf20Sopenharmony_ci .oe_bit = 9, \ 2348c2ecf20Sopenharmony_ci .in_bit = 0, \ 2358c2ecf20Sopenharmony_ci .out_bit = 1, \ 2368c2ecf20Sopenharmony_ci .intr_enable_bit = 0, \ 2378c2ecf20Sopenharmony_ci .intr_status_bit = 0, \ 2388c2ecf20Sopenharmony_ci .intr_ack_high = 1, \ 2398c2ecf20Sopenharmony_ci .intr_target_bit = 0, \ 2408c2ecf20Sopenharmony_ci .intr_target_kpss_val = 4, \ 2418c2ecf20Sopenharmony_ci .intr_raw_status_bit = 3, \ 2428c2ecf20Sopenharmony_ci .intr_polarity_bit = 1, \ 2438c2ecf20Sopenharmony_ci .intr_detection_bit = 2, \ 2448c2ecf20Sopenharmony_ci .intr_detection_width = 1, \ 2458c2ecf20Sopenharmony_ci } 2468c2ecf20Sopenharmony_ci 2478c2ecf20Sopenharmony_cienum mdm9615_functions { 2488c2ecf20Sopenharmony_ci MSM_MUX_gpio, 2498c2ecf20Sopenharmony_ci MSM_MUX_gsbi2_i2c, 2508c2ecf20Sopenharmony_ci MSM_MUX_gsbi3, 2518c2ecf20Sopenharmony_ci MSM_MUX_gsbi4, 2528c2ecf20Sopenharmony_ci MSM_MUX_gsbi5_i2c, 2538c2ecf20Sopenharmony_ci MSM_MUX_gsbi5_uart, 2548c2ecf20Sopenharmony_ci MSM_MUX_sdc2, 2558c2ecf20Sopenharmony_ci MSM_MUX_ebi2_lcdc, 2568c2ecf20Sopenharmony_ci MSM_MUX_ps_hold, 2578c2ecf20Sopenharmony_ci MSM_MUX_prim_audio, 2588c2ecf20Sopenharmony_ci MSM_MUX_sec_audio, 2598c2ecf20Sopenharmony_ci MSM_MUX_cdc_mclk, 2608c2ecf20Sopenharmony_ci MSM_MUX_NA, 2618c2ecf20Sopenharmony_ci}; 2628c2ecf20Sopenharmony_ci 2638c2ecf20Sopenharmony_cistatic const char * const gpio_groups[] = { 2648c2ecf20Sopenharmony_ci "gpio0", "gpio1", "gpio2", "gpio3", "gpio4", "gpio5", "gpio6", "gpio7", 2658c2ecf20Sopenharmony_ci "gpio8", "gpio9", "gpio10", "gpio11", "gpio12", "gpio13", "gpio14", 2668c2ecf20Sopenharmony_ci "gpio15", "gpio16", "gpio17", "gpio18", "gpio19", "gpio20", "gpio21", 2678c2ecf20Sopenharmony_ci "gpio22", "gpio23", "gpio24", "gpio25", "gpio26", "gpio27", "gpio28", 2688c2ecf20Sopenharmony_ci "gpio29", "gpio30", "gpio31", "gpio32", "gpio33", "gpio34", "gpio35", 2698c2ecf20Sopenharmony_ci "gpio36", "gpio37", "gpio38", "gpio39", "gpio40", "gpio41", "gpio42", 2708c2ecf20Sopenharmony_ci "gpio43", "gpio44", "gpio45", "gpio46", "gpio47", "gpio48", "gpio49", 2718c2ecf20Sopenharmony_ci "gpio50", "gpio51", "gpio52", "gpio53", "gpio54", "gpio55", "gpio56", 2728c2ecf20Sopenharmony_ci "gpio57", "gpio58", "gpio59", "gpio60", "gpio61", "gpio62", "gpio63", 2738c2ecf20Sopenharmony_ci "gpio64", "gpio65", "gpio66", "gpio67", "gpio68", "gpio69", "gpio70", 2748c2ecf20Sopenharmony_ci "gpio71", "gpio72", "gpio73", "gpio74", "gpio75", "gpio76", "gpio77", 2758c2ecf20Sopenharmony_ci "gpio78", "gpio79", "gpio80", "gpio81", "gpio82", "gpio83", "gpio84", 2768c2ecf20Sopenharmony_ci "gpio85", "gpio86", "gpio87" 2778c2ecf20Sopenharmony_ci}; 2788c2ecf20Sopenharmony_ci 2798c2ecf20Sopenharmony_cistatic const char * const gsbi2_i2c_groups[] = { 2808c2ecf20Sopenharmony_ci "gpio4", "gpio5" 2818c2ecf20Sopenharmony_ci}; 2828c2ecf20Sopenharmony_ci 2838c2ecf20Sopenharmony_cistatic const char * const gsbi3_groups[] = { 2848c2ecf20Sopenharmony_ci "gpio8", "gpio9", "gpio10", "gpio11" 2858c2ecf20Sopenharmony_ci}; 2868c2ecf20Sopenharmony_ci 2878c2ecf20Sopenharmony_cistatic const char * const gsbi4_groups[] = { 2888c2ecf20Sopenharmony_ci "gpio12", "gpio13", "gpio14", "gpio15" 2898c2ecf20Sopenharmony_ci}; 2908c2ecf20Sopenharmony_ci 2918c2ecf20Sopenharmony_cistatic const char * const gsbi5_i2c_groups[] = { 2928c2ecf20Sopenharmony_ci "gpio16", "gpio17" 2938c2ecf20Sopenharmony_ci}; 2948c2ecf20Sopenharmony_ci 2958c2ecf20Sopenharmony_cistatic const char * const gsbi5_uart_groups[] = { 2968c2ecf20Sopenharmony_ci "gpio18", "gpio19" 2978c2ecf20Sopenharmony_ci}; 2988c2ecf20Sopenharmony_ci 2998c2ecf20Sopenharmony_cistatic const char * const sdc2_groups[] = { 3008c2ecf20Sopenharmony_ci "gpio25", "gpio26", "gpio27", "gpio28", "gpio29", "gpio30", 3018c2ecf20Sopenharmony_ci}; 3028c2ecf20Sopenharmony_ci 3038c2ecf20Sopenharmony_cistatic const char * const ebi2_lcdc_groups[] = { 3048c2ecf20Sopenharmony_ci "gpio21", "gpio22", "gpio24", 3058c2ecf20Sopenharmony_ci}; 3068c2ecf20Sopenharmony_ci 3078c2ecf20Sopenharmony_cistatic const char * const ps_hold_groups[] = { 3088c2ecf20Sopenharmony_ci "gpio83", 3098c2ecf20Sopenharmony_ci}; 3108c2ecf20Sopenharmony_ci 3118c2ecf20Sopenharmony_cistatic const char * const prim_audio_groups[] = { 3128c2ecf20Sopenharmony_ci "gpio20", "gpio21", "gpio22", "gpio23", 3138c2ecf20Sopenharmony_ci}; 3148c2ecf20Sopenharmony_ci 3158c2ecf20Sopenharmony_cistatic const char * const sec_audio_groups[] = { 3168c2ecf20Sopenharmony_ci "gpio25", "gpio26", "gpio27", "gpio28", 3178c2ecf20Sopenharmony_ci}; 3188c2ecf20Sopenharmony_ci 3198c2ecf20Sopenharmony_cistatic const char * const cdc_mclk_groups[] = { 3208c2ecf20Sopenharmony_ci "gpio24", 3218c2ecf20Sopenharmony_ci}; 3228c2ecf20Sopenharmony_ci 3238c2ecf20Sopenharmony_cistatic const struct msm_function mdm9615_functions[] = { 3248c2ecf20Sopenharmony_ci FUNCTION(gpio), 3258c2ecf20Sopenharmony_ci FUNCTION(gsbi2_i2c), 3268c2ecf20Sopenharmony_ci FUNCTION(gsbi3), 3278c2ecf20Sopenharmony_ci FUNCTION(gsbi4), 3288c2ecf20Sopenharmony_ci FUNCTION(gsbi5_i2c), 3298c2ecf20Sopenharmony_ci FUNCTION(gsbi5_uart), 3308c2ecf20Sopenharmony_ci FUNCTION(sdc2), 3318c2ecf20Sopenharmony_ci FUNCTION(ebi2_lcdc), 3328c2ecf20Sopenharmony_ci FUNCTION(ps_hold), 3338c2ecf20Sopenharmony_ci FUNCTION(prim_audio), 3348c2ecf20Sopenharmony_ci FUNCTION(sec_audio), 3358c2ecf20Sopenharmony_ci FUNCTION(cdc_mclk), 3368c2ecf20Sopenharmony_ci}; 3378c2ecf20Sopenharmony_ci 3388c2ecf20Sopenharmony_cistatic const struct msm_pingroup mdm9615_groups[] = { 3398c2ecf20Sopenharmony_ci PINGROUP(0, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA), 3408c2ecf20Sopenharmony_ci PINGROUP(1, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA), 3418c2ecf20Sopenharmony_ci PINGROUP(2, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA), 3428c2ecf20Sopenharmony_ci PINGROUP(3, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA), 3438c2ecf20Sopenharmony_ci PINGROUP(4, gsbi2_i2c, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA), 3448c2ecf20Sopenharmony_ci PINGROUP(5, gsbi2_i2c, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA), 3458c2ecf20Sopenharmony_ci PINGROUP(6, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA), 3468c2ecf20Sopenharmony_ci PINGROUP(7, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA), 3478c2ecf20Sopenharmony_ci PINGROUP(8, gsbi3, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA), 3488c2ecf20Sopenharmony_ci PINGROUP(9, gsbi3, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA), 3498c2ecf20Sopenharmony_ci PINGROUP(10, gsbi3, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA), 3508c2ecf20Sopenharmony_ci PINGROUP(11, gsbi3, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA), 3518c2ecf20Sopenharmony_ci PINGROUP(12, gsbi4, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA), 3528c2ecf20Sopenharmony_ci PINGROUP(13, gsbi4, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA), 3538c2ecf20Sopenharmony_ci PINGROUP(14, gsbi4, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA), 3548c2ecf20Sopenharmony_ci PINGROUP(15, gsbi4, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA), 3558c2ecf20Sopenharmony_ci PINGROUP(16, gsbi5_i2c, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA), 3568c2ecf20Sopenharmony_ci PINGROUP(17, gsbi5_i2c, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA), 3578c2ecf20Sopenharmony_ci PINGROUP(18, gsbi5_uart, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA), 3588c2ecf20Sopenharmony_ci PINGROUP(19, gsbi5_uart, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA), 3598c2ecf20Sopenharmony_ci PINGROUP(20, prim_audio, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA), 3608c2ecf20Sopenharmony_ci PINGROUP(21, prim_audio, ebi2_lcdc, NA, NA, NA, NA, NA, NA, NA, NA, NA), 3618c2ecf20Sopenharmony_ci PINGROUP(22, prim_audio, ebi2_lcdc, NA, NA, NA, NA, NA, NA, NA, NA, NA), 3628c2ecf20Sopenharmony_ci PINGROUP(23, prim_audio, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA), 3638c2ecf20Sopenharmony_ci PINGROUP(24, cdc_mclk, NA, ebi2_lcdc, NA, NA, NA, NA, NA, NA, NA, NA), 3648c2ecf20Sopenharmony_ci PINGROUP(25, sdc2, sec_audio, NA, NA, NA, NA, NA, NA, NA, NA, NA), 3658c2ecf20Sopenharmony_ci PINGROUP(26, sdc2, sec_audio, NA, NA, NA, NA, NA, NA, NA, NA, NA), 3668c2ecf20Sopenharmony_ci PINGROUP(27, sdc2, sec_audio, NA, NA, NA, NA, NA, NA, NA, NA, NA), 3678c2ecf20Sopenharmony_ci PINGROUP(28, sdc2, sec_audio, NA, NA, NA, NA, NA, NA, NA, NA, NA), 3688c2ecf20Sopenharmony_ci PINGROUP(29, sdc2, sec_audio, NA, NA, NA, NA, NA, NA, NA, NA, NA), 3698c2ecf20Sopenharmony_ci PINGROUP(30, sdc2, sec_audio, NA, NA, NA, NA, NA, NA, NA, NA, NA), 3708c2ecf20Sopenharmony_ci PINGROUP(31, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA), 3718c2ecf20Sopenharmony_ci PINGROUP(32, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA), 3728c2ecf20Sopenharmony_ci PINGROUP(33, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA), 3738c2ecf20Sopenharmony_ci PINGROUP(34, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA), 3748c2ecf20Sopenharmony_ci PINGROUP(35, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA), 3758c2ecf20Sopenharmony_ci PINGROUP(36, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA), 3768c2ecf20Sopenharmony_ci PINGROUP(37, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA), 3778c2ecf20Sopenharmony_ci PINGROUP(38, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA), 3788c2ecf20Sopenharmony_ci PINGROUP(39, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA), 3798c2ecf20Sopenharmony_ci PINGROUP(40, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA), 3808c2ecf20Sopenharmony_ci PINGROUP(41, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA), 3818c2ecf20Sopenharmony_ci PINGROUP(42, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA), 3828c2ecf20Sopenharmony_ci PINGROUP(43, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA), 3838c2ecf20Sopenharmony_ci PINGROUP(44, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA), 3848c2ecf20Sopenharmony_ci PINGROUP(45, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA), 3858c2ecf20Sopenharmony_ci PINGROUP(46, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA), 3868c2ecf20Sopenharmony_ci PINGROUP(47, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA), 3878c2ecf20Sopenharmony_ci PINGROUP(48, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA), 3888c2ecf20Sopenharmony_ci PINGROUP(49, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA), 3898c2ecf20Sopenharmony_ci PINGROUP(50, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA), 3908c2ecf20Sopenharmony_ci PINGROUP(51, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA), 3918c2ecf20Sopenharmony_ci PINGROUP(52, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA), 3928c2ecf20Sopenharmony_ci PINGROUP(53, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA), 3938c2ecf20Sopenharmony_ci PINGROUP(54, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA), 3948c2ecf20Sopenharmony_ci PINGROUP(55, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA), 3958c2ecf20Sopenharmony_ci PINGROUP(56, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA), 3968c2ecf20Sopenharmony_ci PINGROUP(57, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA), 3978c2ecf20Sopenharmony_ci PINGROUP(58, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA), 3988c2ecf20Sopenharmony_ci PINGROUP(59, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA), 3998c2ecf20Sopenharmony_ci PINGROUP(60, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA), 4008c2ecf20Sopenharmony_ci PINGROUP(61, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA), 4018c2ecf20Sopenharmony_ci PINGROUP(62, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA), 4028c2ecf20Sopenharmony_ci PINGROUP(63, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA), 4038c2ecf20Sopenharmony_ci PINGROUP(64, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA), 4048c2ecf20Sopenharmony_ci PINGROUP(65, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA), 4058c2ecf20Sopenharmony_ci PINGROUP(66, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA), 4068c2ecf20Sopenharmony_ci PINGROUP(67, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA), 4078c2ecf20Sopenharmony_ci PINGROUP(68, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA), 4088c2ecf20Sopenharmony_ci PINGROUP(69, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA), 4098c2ecf20Sopenharmony_ci PINGROUP(70, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA), 4108c2ecf20Sopenharmony_ci PINGROUP(71, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA), 4118c2ecf20Sopenharmony_ci PINGROUP(72, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA), 4128c2ecf20Sopenharmony_ci PINGROUP(73, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA), 4138c2ecf20Sopenharmony_ci PINGROUP(74, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA), 4148c2ecf20Sopenharmony_ci PINGROUP(75, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA), 4158c2ecf20Sopenharmony_ci PINGROUP(76, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA), 4168c2ecf20Sopenharmony_ci PINGROUP(77, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA), 4178c2ecf20Sopenharmony_ci PINGROUP(78, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA), 4188c2ecf20Sopenharmony_ci PINGROUP(79, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA), 4198c2ecf20Sopenharmony_ci PINGROUP(80, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA), 4208c2ecf20Sopenharmony_ci PINGROUP(81, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA), 4218c2ecf20Sopenharmony_ci PINGROUP(82, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA), 4228c2ecf20Sopenharmony_ci PINGROUP(83, ps_hold, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA), 4238c2ecf20Sopenharmony_ci PINGROUP(84, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA), 4248c2ecf20Sopenharmony_ci PINGROUP(85, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA), 4258c2ecf20Sopenharmony_ci PINGROUP(86, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA), 4268c2ecf20Sopenharmony_ci PINGROUP(87, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA), 4278c2ecf20Sopenharmony_ci}; 4288c2ecf20Sopenharmony_ci 4298c2ecf20Sopenharmony_ci#define NUM_GPIO_PINGROUPS 88 4308c2ecf20Sopenharmony_ci 4318c2ecf20Sopenharmony_cistatic const struct msm_pinctrl_soc_data mdm9615_pinctrl = { 4328c2ecf20Sopenharmony_ci .pins = mdm9615_pins, 4338c2ecf20Sopenharmony_ci .npins = ARRAY_SIZE(mdm9615_pins), 4348c2ecf20Sopenharmony_ci .functions = mdm9615_functions, 4358c2ecf20Sopenharmony_ci .nfunctions = ARRAY_SIZE(mdm9615_functions), 4368c2ecf20Sopenharmony_ci .groups = mdm9615_groups, 4378c2ecf20Sopenharmony_ci .ngroups = ARRAY_SIZE(mdm9615_groups), 4388c2ecf20Sopenharmony_ci .ngpios = NUM_GPIO_PINGROUPS, 4398c2ecf20Sopenharmony_ci}; 4408c2ecf20Sopenharmony_ci 4418c2ecf20Sopenharmony_cistatic int mdm9615_pinctrl_probe(struct platform_device *pdev) 4428c2ecf20Sopenharmony_ci{ 4438c2ecf20Sopenharmony_ci return msm_pinctrl_probe(pdev, &mdm9615_pinctrl); 4448c2ecf20Sopenharmony_ci} 4458c2ecf20Sopenharmony_ci 4468c2ecf20Sopenharmony_cistatic const struct of_device_id mdm9615_pinctrl_of_match[] = { 4478c2ecf20Sopenharmony_ci { .compatible = "qcom,mdm9615-pinctrl", }, 4488c2ecf20Sopenharmony_ci { }, 4498c2ecf20Sopenharmony_ci}; 4508c2ecf20Sopenharmony_ci 4518c2ecf20Sopenharmony_cistatic struct platform_driver mdm9615_pinctrl_driver = { 4528c2ecf20Sopenharmony_ci .driver = { 4538c2ecf20Sopenharmony_ci .name = "mdm9615-pinctrl", 4548c2ecf20Sopenharmony_ci .of_match_table = mdm9615_pinctrl_of_match, 4558c2ecf20Sopenharmony_ci }, 4568c2ecf20Sopenharmony_ci .probe = mdm9615_pinctrl_probe, 4578c2ecf20Sopenharmony_ci .remove = msm_pinctrl_remove, 4588c2ecf20Sopenharmony_ci}; 4598c2ecf20Sopenharmony_ci 4608c2ecf20Sopenharmony_cistatic int __init mdm9615_pinctrl_init(void) 4618c2ecf20Sopenharmony_ci{ 4628c2ecf20Sopenharmony_ci return platform_driver_register(&mdm9615_pinctrl_driver); 4638c2ecf20Sopenharmony_ci} 4648c2ecf20Sopenharmony_ciarch_initcall(mdm9615_pinctrl_init); 4658c2ecf20Sopenharmony_ci 4668c2ecf20Sopenharmony_cistatic void __exit mdm9615_pinctrl_exit(void) 4678c2ecf20Sopenharmony_ci{ 4688c2ecf20Sopenharmony_ci platform_driver_unregister(&mdm9615_pinctrl_driver); 4698c2ecf20Sopenharmony_ci} 4708c2ecf20Sopenharmony_cimodule_exit(mdm9615_pinctrl_exit); 4718c2ecf20Sopenharmony_ci 4728c2ecf20Sopenharmony_ciMODULE_AUTHOR("Neil Armstrong <narmstrong@baylibre.com>"); 4738c2ecf20Sopenharmony_ciMODULE_DESCRIPTION("Qualcomm MDM9615 pinctrl driver"); 4748c2ecf20Sopenharmony_ciMODULE_LICENSE("GPL v2"); 4758c2ecf20Sopenharmony_ciMODULE_DEVICE_TABLE(of, mdm9615_pinctrl_of_match); 476