1e6800d26SAndy Shevchenko // SPDX-License-Identifier: GPL-2.0
2e6800d26SAndy Shevchenko /*
3e6800d26SAndy Shevchenko  * Intel Ice Lake PCH pinctrl/GPIO driver
4e6800d26SAndy Shevchenko  *
5e6800d26SAndy Shevchenko  * Copyright (C) 2018, Intel Corporation
6e6800d26SAndy Shevchenko  * Authors: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
7e6800d26SAndy Shevchenko  *	    Mika Westerberg <mika.westerberg@linux.intel.com>
8e6800d26SAndy Shevchenko  */
9e6800d26SAndy Shevchenko 
10e6800d26SAndy Shevchenko #include <linux/acpi.h>
11e6800d26SAndy Shevchenko #include <linux/module.h>
12e6800d26SAndy Shevchenko #include <linux/platform_device.h>
13e6800d26SAndy Shevchenko #include <linux/pm.h>
14e6800d26SAndy Shevchenko #include <linux/pinctrl/pinctrl.h>
15e6800d26SAndy Shevchenko 
16e6800d26SAndy Shevchenko #include "pinctrl-intel.h"
17e6800d26SAndy Shevchenko 
18e6800d26SAndy Shevchenko #define ICL_PAD_OWN	0x020
19e6800d26SAndy Shevchenko #define ICL_PADCFGLOCK	0x080
20e6800d26SAndy Shevchenko #define ICL_HOSTSW_OWN	0x0b0
21e6800d26SAndy Shevchenko #define ICL_GPI_IE	0x110
22e6800d26SAndy Shevchenko 
23e6800d26SAndy Shevchenko #define ICL_GPP(r, s, e, g)				\
24e6800d26SAndy Shevchenko 	{						\
25e6800d26SAndy Shevchenko 		.reg_num = (r),				\
26e6800d26SAndy Shevchenko 		.base = (s),				\
27e6800d26SAndy Shevchenko 		.size = ((e) - (s) + 1),		\
28e6800d26SAndy Shevchenko 		.gpio_base = (g),			\
29e6800d26SAndy Shevchenko 	}
30e6800d26SAndy Shevchenko 
31e6800d26SAndy Shevchenko #define ICL_NO_GPIO	-1
32e6800d26SAndy Shevchenko 
33e6800d26SAndy Shevchenko #define ICL_COMMUNITY(b, s, e, g)			\
34e6800d26SAndy Shevchenko 	{						\
35e6800d26SAndy Shevchenko 		.barno = (b),				\
36e6800d26SAndy Shevchenko 		.padown_offset = ICL_PAD_OWN,		\
37e6800d26SAndy Shevchenko 		.padcfglock_offset = ICL_PADCFGLOCK,	\
38e6800d26SAndy Shevchenko 		.hostown_offset = ICL_HOSTSW_OWN,	\
39e6800d26SAndy Shevchenko 		.ie_offset = ICL_GPI_IE,		\
40e6800d26SAndy Shevchenko 		.pin_base = (s),			\
41e6800d26SAndy Shevchenko 		.npins = ((e) - (s) + 1),		\
42e6800d26SAndy Shevchenko 		.gpps = (g),				\
43e6800d26SAndy Shevchenko 		.ngpps = ARRAY_SIZE(g),			\
44e6800d26SAndy Shevchenko 	}
45e6800d26SAndy Shevchenko 
46e6800d26SAndy Shevchenko /* Ice Lake-LP */
47e6800d26SAndy Shevchenko static const struct pinctrl_pin_desc icllp_pins[] = {
48e6800d26SAndy Shevchenko 	/* GPP_G */
49e6800d26SAndy Shevchenko 	PINCTRL_PIN(0, "SD3_CMD"),
50e6800d26SAndy Shevchenko 	PINCTRL_PIN(1, "SD3_D0"),
51e6800d26SAndy Shevchenko 	PINCTRL_PIN(2, "SD3_D1"),
52e6800d26SAndy Shevchenko 	PINCTRL_PIN(3, "SD3_D2"),
53e6800d26SAndy Shevchenko 	PINCTRL_PIN(4, "SD3_D3"),
54e6800d26SAndy Shevchenko 	PINCTRL_PIN(5, "SD3_CDB"),
55e6800d26SAndy Shevchenko 	PINCTRL_PIN(6, "SD3_CLK"),
56e6800d26SAndy Shevchenko 	PINCTRL_PIN(7, "SD3_WP"),
57e6800d26SAndy Shevchenko 	/* GPP_B */
58e6800d26SAndy Shevchenko 	PINCTRL_PIN(8, "CORE_VID_0"),
59e6800d26SAndy Shevchenko 	PINCTRL_PIN(9, "CORE_VID_1"),
60e6800d26SAndy Shevchenko 	PINCTRL_PIN(10, "VRALERTB"),
61e6800d26SAndy Shevchenko 	PINCTRL_PIN(11, "CPU_GP_2"),
62e6800d26SAndy Shevchenko 	PINCTRL_PIN(12, "CPU_GP_3"),
63e6800d26SAndy Shevchenko 	PINCTRL_PIN(13, "ISH_I2C0_SDA"),
64e6800d26SAndy Shevchenko 	PINCTRL_PIN(14, "ISH_I2C0_SCL"),
65e6800d26SAndy Shevchenko 	PINCTRL_PIN(15, "ISH_I2C1_SDA"),
66e6800d26SAndy Shevchenko 	PINCTRL_PIN(16, "ISH_I2C1_SCL"),
67e6800d26SAndy Shevchenko 	PINCTRL_PIN(17, "I2C5_SDA"),
68e6800d26SAndy Shevchenko 	PINCTRL_PIN(18, "I2C5_SCL"),
69e6800d26SAndy Shevchenko 	PINCTRL_PIN(19, "PMCALERTB"),
70e6800d26SAndy Shevchenko 	PINCTRL_PIN(20, "SLP_S0B"),
71e6800d26SAndy Shevchenko 	PINCTRL_PIN(21, "PLTRSTB"),
72e6800d26SAndy Shevchenko 	PINCTRL_PIN(22, "SPKR"),
73e6800d26SAndy Shevchenko 	PINCTRL_PIN(23, "GSPI0_CS0B"),
74e6800d26SAndy Shevchenko 	PINCTRL_PIN(24, "GSPI0_CLK"),
75e6800d26SAndy Shevchenko 	PINCTRL_PIN(25, "GSPI0_MISO"),
76e6800d26SAndy Shevchenko 	PINCTRL_PIN(26, "GSPI0_MOSI"),
77e6800d26SAndy Shevchenko 	PINCTRL_PIN(27, "GSPI1_CS0B"),
78e6800d26SAndy Shevchenko 	PINCTRL_PIN(28, "GSPI1_CLK"),
79e6800d26SAndy Shevchenko 	PINCTRL_PIN(29, "GSPI1_MISO"),
80e6800d26SAndy Shevchenko 	PINCTRL_PIN(30, "GSPI1_MOSI"),
81e6800d26SAndy Shevchenko 	PINCTRL_PIN(31, "SML1ALERTB"),
82e6800d26SAndy Shevchenko 	PINCTRL_PIN(32, "GSPI0_CLK_LOOPBK"),
83e6800d26SAndy Shevchenko 	PINCTRL_PIN(33, "GSPI1_CLK_LOOPBK"),
84e6800d26SAndy Shevchenko 	/* GPP_A */
85e6800d26SAndy Shevchenko 	PINCTRL_PIN(34, "ESPI_IO_0"),
86e6800d26SAndy Shevchenko 	PINCTRL_PIN(35, "ESPI_IO_1"),
87e6800d26SAndy Shevchenko 	PINCTRL_PIN(36, "ESPI_IO_2"),
88e6800d26SAndy Shevchenko 	PINCTRL_PIN(37, "ESPI_IO_3"),
89e6800d26SAndy Shevchenko 	PINCTRL_PIN(38, "ESPI_CSB"),
90e6800d26SAndy Shevchenko 	PINCTRL_PIN(39, "ESPI_CLK"),
91e6800d26SAndy Shevchenko 	PINCTRL_PIN(40, "ESPI_RESETB"),
92e6800d26SAndy Shevchenko 	PINCTRL_PIN(41, "I2S2_SCLK"),
93e6800d26SAndy Shevchenko 	PINCTRL_PIN(42, "I2S2_SFRM"),
94e6800d26SAndy Shevchenko 	PINCTRL_PIN(43, "I2S2_TXD"),
95e6800d26SAndy Shevchenko 	PINCTRL_PIN(44, "I2S2_RXD"),
96e6800d26SAndy Shevchenko 	PINCTRL_PIN(45, "SATA_DEVSLP_2"),
97e6800d26SAndy Shevchenko 	PINCTRL_PIN(46, "SATAXPCIE_1"),
98e6800d26SAndy Shevchenko 	PINCTRL_PIN(47, "SATAXPCIE_2"),
99e6800d26SAndy Shevchenko 	PINCTRL_PIN(48, "USB2_OCB_1"),
100e6800d26SAndy Shevchenko 	PINCTRL_PIN(49, "USB2_OCB_2"),
101e6800d26SAndy Shevchenko 	PINCTRL_PIN(50, "USB2_OCB_3"),
102e6800d26SAndy Shevchenko 	PINCTRL_PIN(51, "DDSP_HPD_C"),
103e6800d26SAndy Shevchenko 	PINCTRL_PIN(52, "DDSP_HPD_B"),
104e6800d26SAndy Shevchenko 	PINCTRL_PIN(53, "DDSP_HPD_1"),
105e6800d26SAndy Shevchenko 	PINCTRL_PIN(54, "DDSP_HPD_2"),
106e6800d26SAndy Shevchenko 	PINCTRL_PIN(55, "I2S5_TXD"),
107e6800d26SAndy Shevchenko 	PINCTRL_PIN(56, "I2S5_RXD"),
108e6800d26SAndy Shevchenko 	PINCTRL_PIN(57, "I2S1_SCLK"),
109e6800d26SAndy Shevchenko 	PINCTRL_PIN(58, "ESPI_CLK_LOOPBK"),
110e6800d26SAndy Shevchenko 	/* GPP_H */
111e6800d26SAndy Shevchenko 	PINCTRL_PIN(59, "SD_1P8_SEL"),
112e6800d26SAndy Shevchenko 	PINCTRL_PIN(60, "SD_PWR_EN_B"),
113e6800d26SAndy Shevchenko 	PINCTRL_PIN(61, "GPPC_H_2"),
114e6800d26SAndy Shevchenko 	PINCTRL_PIN(62, "SX_EXIT_HOLDOFFB"),
115e6800d26SAndy Shevchenko 	PINCTRL_PIN(63, "I2C2_SDA"),
116e6800d26SAndy Shevchenko 	PINCTRL_PIN(64, "I2C2_SCL"),
117e6800d26SAndy Shevchenko 	PINCTRL_PIN(65, "I2C3_SDA"),
118e6800d26SAndy Shevchenko 	PINCTRL_PIN(66, "I2C3_SCL"),
119e6800d26SAndy Shevchenko 	PINCTRL_PIN(67, "I2C4_SDA"),
120e6800d26SAndy Shevchenko 	PINCTRL_PIN(68, "I2C4_SCL"),
121e6800d26SAndy Shevchenko 	PINCTRL_PIN(69, "SRCCLKREQB_4"),
122e6800d26SAndy Shevchenko 	PINCTRL_PIN(70, "SRCCLKREQB_5"),
123e6800d26SAndy Shevchenko 	PINCTRL_PIN(71, "M2_SKT2_CFG_0"),
124e6800d26SAndy Shevchenko 	PINCTRL_PIN(72, "M2_SKT2_CFG_1"),
125e6800d26SAndy Shevchenko 	PINCTRL_PIN(73, "M2_SKT2_CFG_2"),
126e6800d26SAndy Shevchenko 	PINCTRL_PIN(74, "M2_SKT2_CFG_3"),
127e6800d26SAndy Shevchenko 	PINCTRL_PIN(75, "DDPB_CTRLCLK"),
128e6800d26SAndy Shevchenko 	PINCTRL_PIN(76, "DDPB_CTRLDATA"),
129e6800d26SAndy Shevchenko 	PINCTRL_PIN(77, "CPU_VCCIO_PWR_GATEB"),
130e6800d26SAndy Shevchenko 	PINCTRL_PIN(78, "TIME_SYNC_0"),
131e6800d26SAndy Shevchenko 	PINCTRL_PIN(79, "IMGCLKOUT_1"),
132e6800d26SAndy Shevchenko 	PINCTRL_PIN(80, "IMGCLKOUT_2"),
133e6800d26SAndy Shevchenko 	PINCTRL_PIN(81, "IMGCLKOUT_3"),
134e6800d26SAndy Shevchenko 	PINCTRL_PIN(82, "IMGCLKOUT_4"),
135e6800d26SAndy Shevchenko 	/* GPP_D */
136e6800d26SAndy Shevchenko 	PINCTRL_PIN(83, "ISH_GP_0"),
137e6800d26SAndy Shevchenko 	PINCTRL_PIN(84, "ISH_GP_1"),
138e6800d26SAndy Shevchenko 	PINCTRL_PIN(85, "ISH_GP_2"),
139e6800d26SAndy Shevchenko 	PINCTRL_PIN(86, "ISH_GP_3"),
140e6800d26SAndy Shevchenko 	PINCTRL_PIN(87, "IMGCLKOUT_0"),
141e6800d26SAndy Shevchenko 	PINCTRL_PIN(88, "SRCCLKREQB_0"),
142e6800d26SAndy Shevchenko 	PINCTRL_PIN(89, "SRCCLKREQB_1"),
143e6800d26SAndy Shevchenko 	PINCTRL_PIN(90, "SRCCLKREQB_2"),
144e6800d26SAndy Shevchenko 	PINCTRL_PIN(91, "SRCCLKREQB_3"),
145e6800d26SAndy Shevchenko 	PINCTRL_PIN(92, "ISH_SPI_CSB"),
146e6800d26SAndy Shevchenko 	PINCTRL_PIN(93, "ISH_SPI_CLK"),
147e6800d26SAndy Shevchenko 	PINCTRL_PIN(94, "ISH_SPI_MISO"),
148e6800d26SAndy Shevchenko 	PINCTRL_PIN(95, "ISH_SPI_MOSI"),
149e6800d26SAndy Shevchenko 	PINCTRL_PIN(96, "ISH_UART0_RXD"),
150e6800d26SAndy Shevchenko 	PINCTRL_PIN(97, "ISH_UART0_TXD"),
151e6800d26SAndy Shevchenko 	PINCTRL_PIN(98, "ISH_UART0_RTSB"),
152e6800d26SAndy Shevchenko 	PINCTRL_PIN(99, "ISH_UART0_CTSB"),
153e6800d26SAndy Shevchenko 	PINCTRL_PIN(100, "ISH_GP_4"),
154e6800d26SAndy Shevchenko 	PINCTRL_PIN(101, "ISH_GP_5"),
155e6800d26SAndy Shevchenko 	PINCTRL_PIN(102, "I2S_MCLK"),
156e6800d26SAndy Shevchenko 	PINCTRL_PIN(103, "GSPI2_CLK_LOOPBK"),
157e6800d26SAndy Shevchenko 	/* GPP_F */
158e6800d26SAndy Shevchenko 	PINCTRL_PIN(104, "CNV_BRI_DT"),
159e6800d26SAndy Shevchenko 	PINCTRL_PIN(105, "CNV_BRI_RSP"),
160e6800d26SAndy Shevchenko 	PINCTRL_PIN(106, "CNV_RGI_DT"),
161e6800d26SAndy Shevchenko 	PINCTRL_PIN(107, "CNV_RGI_RSP"),
162e6800d26SAndy Shevchenko 	PINCTRL_PIN(108, "CNV_RF_RESET_B"),
163e6800d26SAndy Shevchenko 	PINCTRL_PIN(109, "EMMC_HIP_MON"),
164e6800d26SAndy Shevchenko 	PINCTRL_PIN(110, "CNV_PA_BLANKING"),
165e6800d26SAndy Shevchenko 	PINCTRL_PIN(111, "EMMC_CMD"),
166e6800d26SAndy Shevchenko 	PINCTRL_PIN(112, "EMMC_DATA0"),
167e6800d26SAndy Shevchenko 	PINCTRL_PIN(113, "EMMC_DATA1"),
168e6800d26SAndy Shevchenko 	PINCTRL_PIN(114, "EMMC_DATA2"),
169e6800d26SAndy Shevchenko 	PINCTRL_PIN(115, "EMMC_DATA3"),
170e6800d26SAndy Shevchenko 	PINCTRL_PIN(116, "EMMC_DATA4"),
171e6800d26SAndy Shevchenko 	PINCTRL_PIN(117, "EMMC_DATA5"),
172e6800d26SAndy Shevchenko 	PINCTRL_PIN(118, "EMMC_DATA6"),
173e6800d26SAndy Shevchenko 	PINCTRL_PIN(119, "EMMC_DATA7"),
174e6800d26SAndy Shevchenko 	PINCTRL_PIN(120, "EMMC_RCLK"),
175e6800d26SAndy Shevchenko 	PINCTRL_PIN(121, "EMMC_CLK"),
176e6800d26SAndy Shevchenko 	PINCTRL_PIN(122, "EMMC_RESETB"),
177e6800d26SAndy Shevchenko 	PINCTRL_PIN(123, "A4WP_PRESENT"),
178e6800d26SAndy Shevchenko 	/* vGPIO */
179e6800d26SAndy Shevchenko 	PINCTRL_PIN(124, "CNV_BTEN"),
180e6800d26SAndy Shevchenko 	PINCTRL_PIN(125, "CNV_WCEN"),
181e6800d26SAndy Shevchenko 	PINCTRL_PIN(126, "CNV_BT_HOST_WAKEB"),
182e6800d26SAndy Shevchenko 	PINCTRL_PIN(127, "CNV_BT_IF_SELECT"),
183e6800d26SAndy Shevchenko 	PINCTRL_PIN(128, "vCNV_BT_UART_TXD"),
184e6800d26SAndy Shevchenko 	PINCTRL_PIN(129, "vCNV_BT_UART_RXD"),
185e6800d26SAndy Shevchenko 	PINCTRL_PIN(130, "vCNV_BT_UART_CTS_B"),
186e6800d26SAndy Shevchenko 	PINCTRL_PIN(131, "vCNV_BT_UART_RTS_B"),
187e6800d26SAndy Shevchenko 	PINCTRL_PIN(132, "vCNV_MFUART1_TXD"),
188e6800d26SAndy Shevchenko 	PINCTRL_PIN(133, "vCNV_MFUART1_RXD"),
189e6800d26SAndy Shevchenko 	PINCTRL_PIN(134, "vCNV_MFUART1_CTS_B"),
190e6800d26SAndy Shevchenko 	PINCTRL_PIN(135, "vCNV_MFUART1_RTS_B"),
191e6800d26SAndy Shevchenko 	PINCTRL_PIN(136, "vUART0_TXD"),
192e6800d26SAndy Shevchenko 	PINCTRL_PIN(137, "vUART0_RXD"),
193e6800d26SAndy Shevchenko 	PINCTRL_PIN(138, "vUART0_CTS_B"),
194e6800d26SAndy Shevchenko 	PINCTRL_PIN(139, "vUART0_RTS_B"),
195e6800d26SAndy Shevchenko 	PINCTRL_PIN(140, "vISH_UART0_TXD"),
196e6800d26SAndy Shevchenko 	PINCTRL_PIN(141, "vISH_UART0_RXD"),
197e6800d26SAndy Shevchenko 	PINCTRL_PIN(142, "vISH_UART0_CTS_B"),
198e6800d26SAndy Shevchenko 	PINCTRL_PIN(143, "vISH_UART0_RTS_B"),
199e6800d26SAndy Shevchenko 	PINCTRL_PIN(144, "vCNV_BT_I2S_BCLK"),
200e6800d26SAndy Shevchenko 	PINCTRL_PIN(145, "vCNV_BT_I2S_WS_SYNC"),
201e6800d26SAndy Shevchenko 	PINCTRL_PIN(146, "vCNV_BT_I2S_SDO"),
202e6800d26SAndy Shevchenko 	PINCTRL_PIN(147, "vCNV_BT_I2S_SDI"),
203e6800d26SAndy Shevchenko 	PINCTRL_PIN(148, "vI2S2_SCLK"),
204e6800d26SAndy Shevchenko 	PINCTRL_PIN(149, "vI2S2_SFRM"),
205e6800d26SAndy Shevchenko 	PINCTRL_PIN(150, "vI2S2_TXD"),
206e6800d26SAndy Shevchenko 	PINCTRL_PIN(151, "vI2S2_RXD"),
207e6800d26SAndy Shevchenko 	PINCTRL_PIN(152, "vSD3_CD_B"),
208e6800d26SAndy Shevchenko 	/* GPP_C */
209e6800d26SAndy Shevchenko 	PINCTRL_PIN(153, "SMBCLK"),
210e6800d26SAndy Shevchenko 	PINCTRL_PIN(154, "SMBDATA"),
211e6800d26SAndy Shevchenko 	PINCTRL_PIN(155, "SMBALERTB"),
212e6800d26SAndy Shevchenko 	PINCTRL_PIN(156, "SML0CLK"),
213e6800d26SAndy Shevchenko 	PINCTRL_PIN(157, "SML0DATA"),
214e6800d26SAndy Shevchenko 	PINCTRL_PIN(158, "SML0ALERTB"),
215e6800d26SAndy Shevchenko 	PINCTRL_PIN(159, "SML1CLK"),
216e6800d26SAndy Shevchenko 	PINCTRL_PIN(160, "SML1DATA"),
217e6800d26SAndy Shevchenko 	PINCTRL_PIN(161, "UART0_RXD"),
218e6800d26SAndy Shevchenko 	PINCTRL_PIN(162, "UART0_TXD"),
219e6800d26SAndy Shevchenko 	PINCTRL_PIN(163, "UART0_RTSB"),
220e6800d26SAndy Shevchenko 	PINCTRL_PIN(164, "UART0_CTSB"),
221e6800d26SAndy Shevchenko 	PINCTRL_PIN(165, "UART1_RXD"),
222e6800d26SAndy Shevchenko 	PINCTRL_PIN(166, "UART1_TXD"),
223e6800d26SAndy Shevchenko 	PINCTRL_PIN(167, "UART1_RTSB"),
224e6800d26SAndy Shevchenko 	PINCTRL_PIN(168, "UART1_CTSB"),
225e6800d26SAndy Shevchenko 	PINCTRL_PIN(169, "I2C0_SDA"),
226e6800d26SAndy Shevchenko 	PINCTRL_PIN(170, "I2C0_SCL"),
227e6800d26SAndy Shevchenko 	PINCTRL_PIN(171, "I2C1_SDA"),
228e6800d26SAndy Shevchenko 	PINCTRL_PIN(172, "I2C1_SCL"),
229e6800d26SAndy Shevchenko 	PINCTRL_PIN(173, "UART2_RXD"),
230e6800d26SAndy Shevchenko 	PINCTRL_PIN(174, "UART2_TXD"),
231e6800d26SAndy Shevchenko 	PINCTRL_PIN(175, "UART2_RTSB"),
232e6800d26SAndy Shevchenko 	PINCTRL_PIN(176, "UART2_CTSB"),
233e6800d26SAndy Shevchenko 	/* HVCMOS */
234e6800d26SAndy Shevchenko 	PINCTRL_PIN(177, "L_BKLTEN"),
235e6800d26SAndy Shevchenko 	PINCTRL_PIN(178, "L_BKLTCTL"),
236e6800d26SAndy Shevchenko 	PINCTRL_PIN(179, "L_VDDEN"),
237e6800d26SAndy Shevchenko 	PINCTRL_PIN(180, "SYS_PWROK"),
238e6800d26SAndy Shevchenko 	PINCTRL_PIN(181, "SYS_RESETB"),
239e6800d26SAndy Shevchenko 	PINCTRL_PIN(182, "MLK_RSTB"),
240e6800d26SAndy Shevchenko 	/* GPP_E */
241e6800d26SAndy Shevchenko 	PINCTRL_PIN(183, "SATAXPCIE_0"),
242e6800d26SAndy Shevchenko 	PINCTRL_PIN(184, "SPI1_IO_2"),
243e6800d26SAndy Shevchenko 	PINCTRL_PIN(185, "SPI1_IO_3"),
244e6800d26SAndy Shevchenko 	PINCTRL_PIN(186, "CPU_GP_0"),
245e6800d26SAndy Shevchenko 	PINCTRL_PIN(187, "SATA_DEVSLP_0"),
246e6800d26SAndy Shevchenko 	PINCTRL_PIN(188, "SATA_DEVSLP_1"),
247e6800d26SAndy Shevchenko 	PINCTRL_PIN(189, "GPPC_E_6"),
248e6800d26SAndy Shevchenko 	PINCTRL_PIN(190, "CPU_GP_1"),
249e6800d26SAndy Shevchenko 	PINCTRL_PIN(191, "SATA_LEDB"),
250e6800d26SAndy Shevchenko 	PINCTRL_PIN(192, "USB2_OCB_0"),
251e6800d26SAndy Shevchenko 	PINCTRL_PIN(193, "SPI1_CSB"),
252e6800d26SAndy Shevchenko 	PINCTRL_PIN(194, "SPI1_CLK"),
253e6800d26SAndy Shevchenko 	PINCTRL_PIN(195, "SPI1_MISO_IO_1"),
254e6800d26SAndy Shevchenko 	PINCTRL_PIN(196, "SPI1_MOSI_IO_0"),
255e6800d26SAndy Shevchenko 	PINCTRL_PIN(197, "DDSP_HPD_A"),
256e6800d26SAndy Shevchenko 	PINCTRL_PIN(198, "ISH_GP_6"),
257e6800d26SAndy Shevchenko 	PINCTRL_PIN(199, "ISH_GP_7"),
258e6800d26SAndy Shevchenko 	PINCTRL_PIN(200, "DISP_MISC_4"),
259e6800d26SAndy Shevchenko 	PINCTRL_PIN(201, "DDP1_CTRLCLK"),
260e6800d26SAndy Shevchenko 	PINCTRL_PIN(202, "DDP1_CTRLDATA"),
261e6800d26SAndy Shevchenko 	PINCTRL_PIN(203, "DDP2_CTRLCLK"),
262e6800d26SAndy Shevchenko 	PINCTRL_PIN(204, "DDP2_CTRLDATA"),
263e6800d26SAndy Shevchenko 	PINCTRL_PIN(205, "DDPA_CTRLCLK"),
264e6800d26SAndy Shevchenko 	PINCTRL_PIN(206, "DDPA_CTRLDATA"),
265e6800d26SAndy Shevchenko 	/* JTAG */
266e6800d26SAndy Shevchenko 	PINCTRL_PIN(207, "JTAG_TDO"),
267e6800d26SAndy Shevchenko 	PINCTRL_PIN(208, "JTAGX"),
268e6800d26SAndy Shevchenko 	PINCTRL_PIN(209, "PRDYB"),
269e6800d26SAndy Shevchenko 	PINCTRL_PIN(210, "PREQB"),
270e6800d26SAndy Shevchenko 	PINCTRL_PIN(211, "CPU_TRSTB"),
271e6800d26SAndy Shevchenko 	PINCTRL_PIN(212, "JTAG_TDI"),
272e6800d26SAndy Shevchenko 	PINCTRL_PIN(213, "JTAG_TMS"),
273e6800d26SAndy Shevchenko 	PINCTRL_PIN(214, "JTAG_TCK"),
274e6800d26SAndy Shevchenko 	PINCTRL_PIN(215, "ITP_PMODE"),
275e6800d26SAndy Shevchenko 	/* GPP_R */
276e6800d26SAndy Shevchenko 	PINCTRL_PIN(216, "HDA_BCLK"),
277e6800d26SAndy Shevchenko 	PINCTRL_PIN(217, "HDA_SYNC"),
278e6800d26SAndy Shevchenko 	PINCTRL_PIN(218, "HDA_SDO"),
279e6800d26SAndy Shevchenko 	PINCTRL_PIN(219, "HDA_SDI_0"),
280e6800d26SAndy Shevchenko 	PINCTRL_PIN(220, "HDA_RSTB"),
281e6800d26SAndy Shevchenko 	PINCTRL_PIN(221, "HDA_SDI_1"),
282e6800d26SAndy Shevchenko 	PINCTRL_PIN(222, "I2S1_TXD"),
283e6800d26SAndy Shevchenko 	PINCTRL_PIN(223, "I2S1_RXD"),
284e6800d26SAndy Shevchenko 	/* GPP_S */
285e6800d26SAndy Shevchenko 	PINCTRL_PIN(224, "SNDW1_CLK"),
286e6800d26SAndy Shevchenko 	PINCTRL_PIN(225, "SNDW1_DATA"),
287e6800d26SAndy Shevchenko 	PINCTRL_PIN(226, "SNDW2_CLK"),
288e6800d26SAndy Shevchenko 	PINCTRL_PIN(227, "SNDW2_DATA"),
289e6800d26SAndy Shevchenko 	PINCTRL_PIN(228, "SNDW3_CLK"),
290e6800d26SAndy Shevchenko 	PINCTRL_PIN(229, "SNDW3_DATA"),
291e6800d26SAndy Shevchenko 	PINCTRL_PIN(230, "SNDW4_CLK"),
292e6800d26SAndy Shevchenko 	PINCTRL_PIN(231, "SNDW4_DATA"),
293e6800d26SAndy Shevchenko 	/* SPI */
294e6800d26SAndy Shevchenko 	PINCTRL_PIN(232, "SPI0_IO_2"),
295e6800d26SAndy Shevchenko 	PINCTRL_PIN(233, "SPI0_IO_3"),
296e6800d26SAndy Shevchenko 	PINCTRL_PIN(234, "SPI0_MOSI_IO_0"),
297e6800d26SAndy Shevchenko 	PINCTRL_PIN(235, "SPI0_MISO_IO_1"),
298e6800d26SAndy Shevchenko 	PINCTRL_PIN(236, "SPI0_TPM_CSB"),
299e6800d26SAndy Shevchenko 	PINCTRL_PIN(237, "SPI0_FLASH_0_CSB"),
300e6800d26SAndy Shevchenko 	PINCTRL_PIN(238, "SPI0_FLASH_1_CSB"),
301e6800d26SAndy Shevchenko 	PINCTRL_PIN(239, "SPI0_CLK"),
302e6800d26SAndy Shevchenko 	PINCTRL_PIN(240, "SPI0_CLK_LOOPBK"),
303e6800d26SAndy Shevchenko };
304e6800d26SAndy Shevchenko 
305e6800d26SAndy Shevchenko static const struct intel_padgroup icllp_community0_gpps[] = {
306e6800d26SAndy Shevchenko 	ICL_GPP(0, 0, 7, 0),			/* GPP_G */
307e6800d26SAndy Shevchenko 	ICL_GPP(1, 8, 33, 32),			/* GPP_B */
308e6800d26SAndy Shevchenko 	ICL_GPP(2, 34, 58, 64),			/* GPP_A */
309e6800d26SAndy Shevchenko };
310e6800d26SAndy Shevchenko 
311e6800d26SAndy Shevchenko static const struct intel_padgroup icllp_community1_gpps[] = {
312e6800d26SAndy Shevchenko 	ICL_GPP(0, 59, 82, 96),			/* GPP_H */
313e6800d26SAndy Shevchenko 	ICL_GPP(1, 83, 103, 128),		/* GPP_D */
314e6800d26SAndy Shevchenko 	ICL_GPP(2, 104, 123, 160),		/* GPP_F */
315e6800d26SAndy Shevchenko 	ICL_GPP(3, 124, 152, 192),		/* vGPIO */
316e6800d26SAndy Shevchenko };
317e6800d26SAndy Shevchenko 
318e6800d26SAndy Shevchenko static const struct intel_padgroup icllp_community4_gpps[] = {
319e6800d26SAndy Shevchenko 	ICL_GPP(0, 153, 176, 224),		/* GPP_C */
320e6800d26SAndy Shevchenko 	ICL_GPP(1, 177, 182, ICL_NO_GPIO),	/* HVCMOS */
321e6800d26SAndy Shevchenko 	ICL_GPP(2, 183, 206, 256),		/* GPP_E */
322e6800d26SAndy Shevchenko 	ICL_GPP(3, 207, 215, ICL_NO_GPIO),	/* JTAG */
323e6800d26SAndy Shevchenko };
324e6800d26SAndy Shevchenko 
325e6800d26SAndy Shevchenko static const struct intel_padgroup icllp_community5_gpps[] = {
326e6800d26SAndy Shevchenko 	ICL_GPP(0, 216, 223, 288),		/* GPP_R */
327e6800d26SAndy Shevchenko 	ICL_GPP(1, 224, 231, 320),		/* GPP_S */
328e6800d26SAndy Shevchenko 	ICL_GPP(2, 232, 240, ICL_NO_GPIO),	/* SPI */
329e6800d26SAndy Shevchenko };
330e6800d26SAndy Shevchenko 
331e6800d26SAndy Shevchenko static const struct intel_community icllp_communities[] = {
332e6800d26SAndy Shevchenko 	ICL_COMMUNITY(0, 0, 58, icllp_community0_gpps),
333e6800d26SAndy Shevchenko 	ICL_COMMUNITY(1, 59, 152, icllp_community1_gpps),
334e6800d26SAndy Shevchenko 	ICL_COMMUNITY(2, 153, 215, icllp_community4_gpps),
335e6800d26SAndy Shevchenko 	ICL_COMMUNITY(3, 216, 240, icllp_community5_gpps),
336e6800d26SAndy Shevchenko };
337e6800d26SAndy Shevchenko 
338e6800d26SAndy Shevchenko static const unsigned int icllp_spi0_pins[] = { 22, 23, 24, 25, 26 };
339e6800d26SAndy Shevchenko static const unsigned int icllp_spi0_modes[] = { 3, 1, 1, 1, 1 };
340e6800d26SAndy Shevchenko static const unsigned int icllp_spi1_pins[] = { 27, 28, 29, 30, 31 };
341e6800d26SAndy Shevchenko static const unsigned int icllp_spi1_modes[] = { 1, 1, 1, 1, 3 };
342e6800d26SAndy Shevchenko static const unsigned int icllp_spi2_pins[] = { 92, 93, 94, 95, 98 };
343e6800d26SAndy Shevchenko static const unsigned int icllp_spi2_modes[] = { 3, 3, 3, 3, 2 };
344e6800d26SAndy Shevchenko 
345e6800d26SAndy Shevchenko static const unsigned int icllp_i2c0_pins[] = { 169, 170 };
346e6800d26SAndy Shevchenko static const unsigned int icllp_i2c1_pins[] = { 171, 172 };
347e6800d26SAndy Shevchenko static const unsigned int icllp_i2c2_pins[] = { 63, 64 };
348e6800d26SAndy Shevchenko static const unsigned int icllp_i2c3_pins[] = { 65, 66 };
349e6800d26SAndy Shevchenko static const unsigned int icllp_i2c4_pins[] = { 67, 68 };
350e6800d26SAndy Shevchenko 
351e6800d26SAndy Shevchenko static const unsigned int icllp_uart0_pins[] = { 161, 162, 163, 164 };
352e6800d26SAndy Shevchenko static const unsigned int icllp_uart1_pins[] = { 165, 166, 167, 168 };
353e6800d26SAndy Shevchenko static const unsigned int icllp_uart2_pins[] = { 173, 174, 175, 176 };
354e6800d26SAndy Shevchenko 
355e6800d26SAndy Shevchenko static const struct intel_pingroup icllp_groups[] = {
356e6800d26SAndy Shevchenko 	PIN_GROUP("spi0_grp", icllp_spi0_pins, icllp_spi0_modes),
357e6800d26SAndy Shevchenko 	PIN_GROUP("spi1_grp", icllp_spi1_pins, icllp_spi1_modes),
358e6800d26SAndy Shevchenko 	PIN_GROUP("spi2_grp", icllp_spi2_pins, icllp_spi2_modes),
359e6800d26SAndy Shevchenko 	PIN_GROUP("i2c0_grp", icllp_i2c0_pins, 1),
360e6800d26SAndy Shevchenko 	PIN_GROUP("i2c1_grp", icllp_i2c1_pins, 1),
361e6800d26SAndy Shevchenko 	PIN_GROUP("i2c2_grp", icllp_i2c2_pins, 1),
362e6800d26SAndy Shevchenko 	PIN_GROUP("i2c3_grp", icllp_i2c3_pins, 1),
363e6800d26SAndy Shevchenko 	PIN_GROUP("i2c4_grp", icllp_i2c4_pins, 1),
364e6800d26SAndy Shevchenko 	PIN_GROUP("uart0_grp", icllp_uart0_pins, 1),
365e6800d26SAndy Shevchenko 	PIN_GROUP("uart1_grp", icllp_uart1_pins, 1),
366e6800d26SAndy Shevchenko 	PIN_GROUP("uart2_grp", icllp_uart2_pins, 1),
367e6800d26SAndy Shevchenko };
368e6800d26SAndy Shevchenko 
369e6800d26SAndy Shevchenko static const char * const icllp_spi0_groups[] = { "spi0_grp" };
370e6800d26SAndy Shevchenko static const char * const icllp_spi1_groups[] = { "spi1_grp" };
371e6800d26SAndy Shevchenko static const char * const icllp_spi2_groups[] = { "spi2_grp" };
372e6800d26SAndy Shevchenko static const char * const icllp_i2c0_groups[] = { "i2c0_grp" };
373e6800d26SAndy Shevchenko static const char * const icllp_i2c1_groups[] = { "i2c1_grp" };
374e6800d26SAndy Shevchenko static const char * const icllp_i2c2_groups[] = { "i2c2_grp" };
375e6800d26SAndy Shevchenko static const char * const icllp_i2c3_groups[] = { "i2c3_grp" };
376e6800d26SAndy Shevchenko static const char * const icllp_i2c4_groups[] = { "i2c4_grp" };
377e6800d26SAndy Shevchenko static const char * const icllp_uart0_groups[] = { "uart0_grp" };
378e6800d26SAndy Shevchenko static const char * const icllp_uart1_groups[] = { "uart1_grp" };
379e6800d26SAndy Shevchenko static const char * const icllp_uart2_groups[] = { "uart2_grp" };
380e6800d26SAndy Shevchenko 
381e6800d26SAndy Shevchenko static const struct intel_function icllp_functions[] = {
382e6800d26SAndy Shevchenko 	FUNCTION("spi0", icllp_spi0_groups),
383e6800d26SAndy Shevchenko 	FUNCTION("spi1", icllp_spi1_groups),
384e6800d26SAndy Shevchenko 	FUNCTION("spi2", icllp_spi2_groups),
385e6800d26SAndy Shevchenko 	FUNCTION("i2c0", icllp_i2c0_groups),
386e6800d26SAndy Shevchenko 	FUNCTION("i2c1", icllp_i2c1_groups),
387e6800d26SAndy Shevchenko 	FUNCTION("i2c2", icllp_i2c2_groups),
388e6800d26SAndy Shevchenko 	FUNCTION("i2c3", icllp_i2c3_groups),
389e6800d26SAndy Shevchenko 	FUNCTION("i2c4", icllp_i2c4_groups),
390e6800d26SAndy Shevchenko 	FUNCTION("uart0", icllp_uart0_groups),
391e6800d26SAndy Shevchenko 	FUNCTION("uart1", icllp_uart1_groups),
392e6800d26SAndy Shevchenko 	FUNCTION("uart2", icllp_uart2_groups),
393e6800d26SAndy Shevchenko };
394e6800d26SAndy Shevchenko 
395e6800d26SAndy Shevchenko static const struct intel_pinctrl_soc_data icllp_soc_data = {
396e6800d26SAndy Shevchenko 	.pins = icllp_pins,
397e6800d26SAndy Shevchenko 	.npins = ARRAY_SIZE(icllp_pins),
398e6800d26SAndy Shevchenko 	.groups = icllp_groups,
399e6800d26SAndy Shevchenko 	.ngroups = ARRAY_SIZE(icllp_groups),
400e6800d26SAndy Shevchenko 	.functions = icllp_functions,
401e6800d26SAndy Shevchenko 	.nfunctions = ARRAY_SIZE(icllp_functions),
402e6800d26SAndy Shevchenko 	.communities = icllp_communities,
403e6800d26SAndy Shevchenko 	.ncommunities = ARRAY_SIZE(icllp_communities),
404e6800d26SAndy Shevchenko };
405e6800d26SAndy Shevchenko 
406e6800d26SAndy Shevchenko static int icl_pinctrl_probe(struct platform_device *pdev)
407e6800d26SAndy Shevchenko {
408e6800d26SAndy Shevchenko 	return intel_pinctrl_probe(pdev, &icllp_soc_data);
409e6800d26SAndy Shevchenko }
410e6800d26SAndy Shevchenko 
4114ee73414SAndy Shevchenko static INTEL_PINCTRL_PM_OPS(icl_pinctrl_pm_ops);
412e6800d26SAndy Shevchenko 
413e6800d26SAndy Shevchenko static const struct acpi_device_id icl_pinctrl_acpi_match[] = {
414e6800d26SAndy Shevchenko 	{ "INT3455" },
415e6800d26SAndy Shevchenko 	{ },
416e6800d26SAndy Shevchenko };
417e6800d26SAndy Shevchenko MODULE_DEVICE_TABLE(acpi, icl_pinctrl_acpi_match);
418e6800d26SAndy Shevchenko 
419e6800d26SAndy Shevchenko static struct platform_driver icl_pinctrl_driver = {
420e6800d26SAndy Shevchenko 	.probe = icl_pinctrl_probe,
421e6800d26SAndy Shevchenko 	.driver = {
422e6800d26SAndy Shevchenko 		.name = "icelake-pinctrl",
423e6800d26SAndy Shevchenko 		.acpi_match_table = icl_pinctrl_acpi_match,
424e6800d26SAndy Shevchenko 		.pm = &icl_pinctrl_pm_ops,
425e6800d26SAndy Shevchenko 	},
426e6800d26SAndy Shevchenko };
427e6800d26SAndy Shevchenko 
428e6800d26SAndy Shevchenko module_platform_driver(icl_pinctrl_driver);
429e6800d26SAndy Shevchenko 
430e6800d26SAndy Shevchenko MODULE_AUTHOR("Andy Shevchenko <andriy.shevchenko@linux.intel.com>");
431e6800d26SAndy Shevchenko MODULE_AUTHOR("Mika Westerberg <mika.westerberg@linux.intel.com>");
432e6800d26SAndy Shevchenko MODULE_DESCRIPTION("Intel Ice Lake PCH pinctrl/GPIO driver");
433e6800d26SAndy Shevchenko MODULE_LICENSE("GPL v2");
434