18c2ecf20Sopenharmony_ci// SPDX-License-Identifier: GPL-2.0
28c2ecf20Sopenharmony_ci/*
38c2ecf20Sopenharmony_ci * Intel Ice Lake PCH pinctrl/GPIO driver
48c2ecf20Sopenharmony_ci *
58c2ecf20Sopenharmony_ci * Copyright (C) 2018, Intel Corporation
68c2ecf20Sopenharmony_ci * Authors: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
78c2ecf20Sopenharmony_ci *	    Mika Westerberg <mika.westerberg@linux.intel.com>
88c2ecf20Sopenharmony_ci */
98c2ecf20Sopenharmony_ci
108c2ecf20Sopenharmony_ci#include <linux/acpi.h>
118c2ecf20Sopenharmony_ci#include <linux/module.h>
128c2ecf20Sopenharmony_ci#include <linux/platform_device.h>
138c2ecf20Sopenharmony_ci
148c2ecf20Sopenharmony_ci#include <linux/pinctrl/pinctrl.h>
158c2ecf20Sopenharmony_ci
168c2ecf20Sopenharmony_ci#include "pinctrl-intel.h"
178c2ecf20Sopenharmony_ci
188c2ecf20Sopenharmony_ci#define ICL_PAD_OWN	0x020
198c2ecf20Sopenharmony_ci#define ICL_PADCFGLOCK	0x080
208c2ecf20Sopenharmony_ci#define ICL_HOSTSW_OWN	0x0b0
218c2ecf20Sopenharmony_ci#define ICL_GPI_IS	0x100
228c2ecf20Sopenharmony_ci#define ICL_GPI_IE	0x110
238c2ecf20Sopenharmony_ci
248c2ecf20Sopenharmony_ci#define ICL_GPP(r, s, e, g)				\
258c2ecf20Sopenharmony_ci	{						\
268c2ecf20Sopenharmony_ci		.reg_num = (r),				\
278c2ecf20Sopenharmony_ci		.base = (s),				\
288c2ecf20Sopenharmony_ci		.size = ((e) - (s) + 1),		\
298c2ecf20Sopenharmony_ci		.gpio_base = (g),			\
308c2ecf20Sopenharmony_ci	}
318c2ecf20Sopenharmony_ci
328c2ecf20Sopenharmony_ci#define ICL_COMMUNITY(b, s, e, g)			\
338c2ecf20Sopenharmony_ci	{						\
348c2ecf20Sopenharmony_ci		.barno = (b),				\
358c2ecf20Sopenharmony_ci		.padown_offset = ICL_PAD_OWN,		\
368c2ecf20Sopenharmony_ci		.padcfglock_offset = ICL_PADCFGLOCK,	\
378c2ecf20Sopenharmony_ci		.hostown_offset = ICL_HOSTSW_OWN,	\
388c2ecf20Sopenharmony_ci		.is_offset = ICL_GPI_IS,		\
398c2ecf20Sopenharmony_ci		.ie_offset = ICL_GPI_IE,		\
408c2ecf20Sopenharmony_ci		.pin_base = (s),			\
418c2ecf20Sopenharmony_ci		.npins = ((e) - (s) + 1),		\
428c2ecf20Sopenharmony_ci		.gpps = (g),				\
438c2ecf20Sopenharmony_ci		.ngpps = ARRAY_SIZE(g),			\
448c2ecf20Sopenharmony_ci	}
458c2ecf20Sopenharmony_ci
468c2ecf20Sopenharmony_ci/* Ice Lake-LP */
478c2ecf20Sopenharmony_cistatic const struct pinctrl_pin_desc icllp_pins[] = {
488c2ecf20Sopenharmony_ci	/* GPP_G */
498c2ecf20Sopenharmony_ci	PINCTRL_PIN(0, "SD3_CMD"),
508c2ecf20Sopenharmony_ci	PINCTRL_PIN(1, "SD3_D0"),
518c2ecf20Sopenharmony_ci	PINCTRL_PIN(2, "SD3_D1"),
528c2ecf20Sopenharmony_ci	PINCTRL_PIN(3, "SD3_D2"),
538c2ecf20Sopenharmony_ci	PINCTRL_PIN(4, "SD3_D3"),
548c2ecf20Sopenharmony_ci	PINCTRL_PIN(5, "SD3_CDB"),
558c2ecf20Sopenharmony_ci	PINCTRL_PIN(6, "SD3_CLK"),
568c2ecf20Sopenharmony_ci	PINCTRL_PIN(7, "SD3_WP"),
578c2ecf20Sopenharmony_ci	/* GPP_B */
588c2ecf20Sopenharmony_ci	PINCTRL_PIN(8, "CORE_VID_0"),
598c2ecf20Sopenharmony_ci	PINCTRL_PIN(9, "CORE_VID_1"),
608c2ecf20Sopenharmony_ci	PINCTRL_PIN(10, "VRALERTB"),
618c2ecf20Sopenharmony_ci	PINCTRL_PIN(11, "CPU_GP_2"),
628c2ecf20Sopenharmony_ci	PINCTRL_PIN(12, "CPU_GP_3"),
638c2ecf20Sopenharmony_ci	PINCTRL_PIN(13, "ISH_I2C0_SDA"),
648c2ecf20Sopenharmony_ci	PINCTRL_PIN(14, "ISH_I2C0_SCL"),
658c2ecf20Sopenharmony_ci	PINCTRL_PIN(15, "ISH_I2C1_SDA"),
668c2ecf20Sopenharmony_ci	PINCTRL_PIN(16, "ISH_I2C1_SCL"),
678c2ecf20Sopenharmony_ci	PINCTRL_PIN(17, "I2C5_SDA"),
688c2ecf20Sopenharmony_ci	PINCTRL_PIN(18, "I2C5_SCL"),
698c2ecf20Sopenharmony_ci	PINCTRL_PIN(19, "PMCALERTB"),
708c2ecf20Sopenharmony_ci	PINCTRL_PIN(20, "SLP_S0B"),
718c2ecf20Sopenharmony_ci	PINCTRL_PIN(21, "PLTRSTB"),
728c2ecf20Sopenharmony_ci	PINCTRL_PIN(22, "SPKR"),
738c2ecf20Sopenharmony_ci	PINCTRL_PIN(23, "GSPI0_CS0B"),
748c2ecf20Sopenharmony_ci	PINCTRL_PIN(24, "GSPI0_CLK"),
758c2ecf20Sopenharmony_ci	PINCTRL_PIN(25, "GSPI0_MISO"),
768c2ecf20Sopenharmony_ci	PINCTRL_PIN(26, "GSPI0_MOSI"),
778c2ecf20Sopenharmony_ci	PINCTRL_PIN(27, "GSPI1_CS0B"),
788c2ecf20Sopenharmony_ci	PINCTRL_PIN(28, "GSPI1_CLK"),
798c2ecf20Sopenharmony_ci	PINCTRL_PIN(29, "GSPI1_MISO"),
808c2ecf20Sopenharmony_ci	PINCTRL_PIN(30, "GSPI1_MOSI"),
818c2ecf20Sopenharmony_ci	PINCTRL_PIN(31, "SML1ALERTB"),
828c2ecf20Sopenharmony_ci	PINCTRL_PIN(32, "GSPI0_CLK_LOOPBK"),
838c2ecf20Sopenharmony_ci	PINCTRL_PIN(33, "GSPI1_CLK_LOOPBK"),
848c2ecf20Sopenharmony_ci	/* GPP_A */
858c2ecf20Sopenharmony_ci	PINCTRL_PIN(34, "ESPI_IO_0"),
868c2ecf20Sopenharmony_ci	PINCTRL_PIN(35, "ESPI_IO_1"),
878c2ecf20Sopenharmony_ci	PINCTRL_PIN(36, "ESPI_IO_2"),
888c2ecf20Sopenharmony_ci	PINCTRL_PIN(37, "ESPI_IO_3"),
898c2ecf20Sopenharmony_ci	PINCTRL_PIN(38, "ESPI_CSB"),
908c2ecf20Sopenharmony_ci	PINCTRL_PIN(39, "ESPI_CLK"),
918c2ecf20Sopenharmony_ci	PINCTRL_PIN(40, "ESPI_RESETB"),
928c2ecf20Sopenharmony_ci	PINCTRL_PIN(41, "I2S2_SCLK"),
938c2ecf20Sopenharmony_ci	PINCTRL_PIN(42, "I2S2_SFRM"),
948c2ecf20Sopenharmony_ci	PINCTRL_PIN(43, "I2S2_TXD"),
958c2ecf20Sopenharmony_ci	PINCTRL_PIN(44, "I2S2_RXD"),
968c2ecf20Sopenharmony_ci	PINCTRL_PIN(45, "SATA_DEVSLP_2"),
978c2ecf20Sopenharmony_ci	PINCTRL_PIN(46, "SATAXPCIE_1"),
988c2ecf20Sopenharmony_ci	PINCTRL_PIN(47, "SATAXPCIE_2"),
998c2ecf20Sopenharmony_ci	PINCTRL_PIN(48, "USB2_OCB_1"),
1008c2ecf20Sopenharmony_ci	PINCTRL_PIN(49, "USB2_OCB_2"),
1018c2ecf20Sopenharmony_ci	PINCTRL_PIN(50, "USB2_OCB_3"),
1028c2ecf20Sopenharmony_ci	PINCTRL_PIN(51, "DDSP_HPD_C"),
1038c2ecf20Sopenharmony_ci	PINCTRL_PIN(52, "DDSP_HPD_B"),
1048c2ecf20Sopenharmony_ci	PINCTRL_PIN(53, "DDSP_HPD_1"),
1058c2ecf20Sopenharmony_ci	PINCTRL_PIN(54, "DDSP_HPD_2"),
1068c2ecf20Sopenharmony_ci	PINCTRL_PIN(55, "I2S5_TXD"),
1078c2ecf20Sopenharmony_ci	PINCTRL_PIN(56, "I2S5_RXD"),
1088c2ecf20Sopenharmony_ci	PINCTRL_PIN(57, "I2S1_SCLK"),
1098c2ecf20Sopenharmony_ci	PINCTRL_PIN(58, "ESPI_CLK_LOOPBK"),
1108c2ecf20Sopenharmony_ci	/* GPP_H */
1118c2ecf20Sopenharmony_ci	PINCTRL_PIN(59, "SD_1P8_SEL"),
1128c2ecf20Sopenharmony_ci	PINCTRL_PIN(60, "SD_PWR_EN_B"),
1138c2ecf20Sopenharmony_ci	PINCTRL_PIN(61, "GPPC_H_2"),
1148c2ecf20Sopenharmony_ci	PINCTRL_PIN(62, "SX_EXIT_HOLDOFFB"),
1158c2ecf20Sopenharmony_ci	PINCTRL_PIN(63, "I2C2_SDA"),
1168c2ecf20Sopenharmony_ci	PINCTRL_PIN(64, "I2C2_SCL"),
1178c2ecf20Sopenharmony_ci	PINCTRL_PIN(65, "I2C3_SDA"),
1188c2ecf20Sopenharmony_ci	PINCTRL_PIN(66, "I2C3_SCL"),
1198c2ecf20Sopenharmony_ci	PINCTRL_PIN(67, "I2C4_SDA"),
1208c2ecf20Sopenharmony_ci	PINCTRL_PIN(68, "I2C4_SCL"),
1218c2ecf20Sopenharmony_ci	PINCTRL_PIN(69, "SRCCLKREQB_4"),
1228c2ecf20Sopenharmony_ci	PINCTRL_PIN(70, "SRCCLKREQB_5"),
1238c2ecf20Sopenharmony_ci	PINCTRL_PIN(71, "M2_SKT2_CFG_0"),
1248c2ecf20Sopenharmony_ci	PINCTRL_PIN(72, "M2_SKT2_CFG_1"),
1258c2ecf20Sopenharmony_ci	PINCTRL_PIN(73, "M2_SKT2_CFG_2"),
1268c2ecf20Sopenharmony_ci	PINCTRL_PIN(74, "M2_SKT2_CFG_3"),
1278c2ecf20Sopenharmony_ci	PINCTRL_PIN(75, "DDPB_CTRLCLK"),
1288c2ecf20Sopenharmony_ci	PINCTRL_PIN(76, "DDPB_CTRLDATA"),
1298c2ecf20Sopenharmony_ci	PINCTRL_PIN(77, "CPU_VCCIO_PWR_GATEB"),
1308c2ecf20Sopenharmony_ci	PINCTRL_PIN(78, "TIME_SYNC_0"),
1318c2ecf20Sopenharmony_ci	PINCTRL_PIN(79, "IMGCLKOUT_1"),
1328c2ecf20Sopenharmony_ci	PINCTRL_PIN(80, "IMGCLKOUT_2"),
1338c2ecf20Sopenharmony_ci	PINCTRL_PIN(81, "IMGCLKOUT_3"),
1348c2ecf20Sopenharmony_ci	PINCTRL_PIN(82, "IMGCLKOUT_4"),
1358c2ecf20Sopenharmony_ci	/* GPP_D */
1368c2ecf20Sopenharmony_ci	PINCTRL_PIN(83, "ISH_GP_0"),
1378c2ecf20Sopenharmony_ci	PINCTRL_PIN(84, "ISH_GP_1"),
1388c2ecf20Sopenharmony_ci	PINCTRL_PIN(85, "ISH_GP_2"),
1398c2ecf20Sopenharmony_ci	PINCTRL_PIN(86, "ISH_GP_3"),
1408c2ecf20Sopenharmony_ci	PINCTRL_PIN(87, "IMGCLKOUT_0"),
1418c2ecf20Sopenharmony_ci	PINCTRL_PIN(88, "SRCCLKREQB_0"),
1428c2ecf20Sopenharmony_ci	PINCTRL_PIN(89, "SRCCLKREQB_1"),
1438c2ecf20Sopenharmony_ci	PINCTRL_PIN(90, "SRCCLKREQB_2"),
1448c2ecf20Sopenharmony_ci	PINCTRL_PIN(91, "SRCCLKREQB_3"),
1458c2ecf20Sopenharmony_ci	PINCTRL_PIN(92, "ISH_SPI_CSB"),
1468c2ecf20Sopenharmony_ci	PINCTRL_PIN(93, "ISH_SPI_CLK"),
1478c2ecf20Sopenharmony_ci	PINCTRL_PIN(94, "ISH_SPI_MISO"),
1488c2ecf20Sopenharmony_ci	PINCTRL_PIN(95, "ISH_SPI_MOSI"),
1498c2ecf20Sopenharmony_ci	PINCTRL_PIN(96, "ISH_UART0_RXD"),
1508c2ecf20Sopenharmony_ci	PINCTRL_PIN(97, "ISH_UART0_TXD"),
1518c2ecf20Sopenharmony_ci	PINCTRL_PIN(98, "ISH_UART0_RTSB"),
1528c2ecf20Sopenharmony_ci	PINCTRL_PIN(99, "ISH_UART0_CTSB"),
1538c2ecf20Sopenharmony_ci	PINCTRL_PIN(100, "ISH_GP_4"),
1548c2ecf20Sopenharmony_ci	PINCTRL_PIN(101, "ISH_GP_5"),
1558c2ecf20Sopenharmony_ci	PINCTRL_PIN(102, "I2S_MCLK"),
1568c2ecf20Sopenharmony_ci	PINCTRL_PIN(103, "GSPI2_CLK_LOOPBK"),
1578c2ecf20Sopenharmony_ci	/* GPP_F */
1588c2ecf20Sopenharmony_ci	PINCTRL_PIN(104, "CNV_BRI_DT"),
1598c2ecf20Sopenharmony_ci	PINCTRL_PIN(105, "CNV_BRI_RSP"),
1608c2ecf20Sopenharmony_ci	PINCTRL_PIN(106, "CNV_RGI_DT"),
1618c2ecf20Sopenharmony_ci	PINCTRL_PIN(107, "CNV_RGI_RSP"),
1628c2ecf20Sopenharmony_ci	PINCTRL_PIN(108, "CNV_RF_RESET_B"),
1638c2ecf20Sopenharmony_ci	PINCTRL_PIN(109, "EMMC_HIP_MON"),
1648c2ecf20Sopenharmony_ci	PINCTRL_PIN(110, "CNV_PA_BLANKING"),
1658c2ecf20Sopenharmony_ci	PINCTRL_PIN(111, "EMMC_CMD"),
1668c2ecf20Sopenharmony_ci	PINCTRL_PIN(112, "EMMC_DATA0"),
1678c2ecf20Sopenharmony_ci	PINCTRL_PIN(113, "EMMC_DATA1"),
1688c2ecf20Sopenharmony_ci	PINCTRL_PIN(114, "EMMC_DATA2"),
1698c2ecf20Sopenharmony_ci	PINCTRL_PIN(115, "EMMC_DATA3"),
1708c2ecf20Sopenharmony_ci	PINCTRL_PIN(116, "EMMC_DATA4"),
1718c2ecf20Sopenharmony_ci	PINCTRL_PIN(117, "EMMC_DATA5"),
1728c2ecf20Sopenharmony_ci	PINCTRL_PIN(118, "EMMC_DATA6"),
1738c2ecf20Sopenharmony_ci	PINCTRL_PIN(119, "EMMC_DATA7"),
1748c2ecf20Sopenharmony_ci	PINCTRL_PIN(120, "EMMC_RCLK"),
1758c2ecf20Sopenharmony_ci	PINCTRL_PIN(121, "EMMC_CLK"),
1768c2ecf20Sopenharmony_ci	PINCTRL_PIN(122, "EMMC_RESETB"),
1778c2ecf20Sopenharmony_ci	PINCTRL_PIN(123, "A4WP_PRESENT"),
1788c2ecf20Sopenharmony_ci	/* vGPIO */
1798c2ecf20Sopenharmony_ci	PINCTRL_PIN(124, "CNV_BTEN"),
1808c2ecf20Sopenharmony_ci	PINCTRL_PIN(125, "CNV_WCEN"),
1818c2ecf20Sopenharmony_ci	PINCTRL_PIN(126, "CNV_BT_HOST_WAKEB"),
1828c2ecf20Sopenharmony_ci	PINCTRL_PIN(127, "CNV_BT_IF_SELECT"),
1838c2ecf20Sopenharmony_ci	PINCTRL_PIN(128, "vCNV_BT_UART_TXD"),
1848c2ecf20Sopenharmony_ci	PINCTRL_PIN(129, "vCNV_BT_UART_RXD"),
1858c2ecf20Sopenharmony_ci	PINCTRL_PIN(130, "vCNV_BT_UART_CTS_B"),
1868c2ecf20Sopenharmony_ci	PINCTRL_PIN(131, "vCNV_BT_UART_RTS_B"),
1878c2ecf20Sopenharmony_ci	PINCTRL_PIN(132, "vCNV_MFUART1_TXD"),
1888c2ecf20Sopenharmony_ci	PINCTRL_PIN(133, "vCNV_MFUART1_RXD"),
1898c2ecf20Sopenharmony_ci	PINCTRL_PIN(134, "vCNV_MFUART1_CTS_B"),
1908c2ecf20Sopenharmony_ci	PINCTRL_PIN(135, "vCNV_MFUART1_RTS_B"),
1918c2ecf20Sopenharmony_ci	PINCTRL_PIN(136, "vUART0_TXD"),
1928c2ecf20Sopenharmony_ci	PINCTRL_PIN(137, "vUART0_RXD"),
1938c2ecf20Sopenharmony_ci	PINCTRL_PIN(138, "vUART0_CTS_B"),
1948c2ecf20Sopenharmony_ci	PINCTRL_PIN(139, "vUART0_RTS_B"),
1958c2ecf20Sopenharmony_ci	PINCTRL_PIN(140, "vISH_UART0_TXD"),
1968c2ecf20Sopenharmony_ci	PINCTRL_PIN(141, "vISH_UART0_RXD"),
1978c2ecf20Sopenharmony_ci	PINCTRL_PIN(142, "vISH_UART0_CTS_B"),
1988c2ecf20Sopenharmony_ci	PINCTRL_PIN(143, "vISH_UART0_RTS_B"),
1998c2ecf20Sopenharmony_ci	PINCTRL_PIN(144, "vCNV_BT_I2S_BCLK"),
2008c2ecf20Sopenharmony_ci	PINCTRL_PIN(145, "vCNV_BT_I2S_WS_SYNC"),
2018c2ecf20Sopenharmony_ci	PINCTRL_PIN(146, "vCNV_BT_I2S_SDO"),
2028c2ecf20Sopenharmony_ci	PINCTRL_PIN(147, "vCNV_BT_I2S_SDI"),
2038c2ecf20Sopenharmony_ci	PINCTRL_PIN(148, "vI2S2_SCLK"),
2048c2ecf20Sopenharmony_ci	PINCTRL_PIN(149, "vI2S2_SFRM"),
2058c2ecf20Sopenharmony_ci	PINCTRL_PIN(150, "vI2S2_TXD"),
2068c2ecf20Sopenharmony_ci	PINCTRL_PIN(151, "vI2S2_RXD"),
2078c2ecf20Sopenharmony_ci	PINCTRL_PIN(152, "vSD3_CD_B"),
2088c2ecf20Sopenharmony_ci	/* GPP_C */
2098c2ecf20Sopenharmony_ci	PINCTRL_PIN(153, "SMBCLK"),
2108c2ecf20Sopenharmony_ci	PINCTRL_PIN(154, "SMBDATA"),
2118c2ecf20Sopenharmony_ci	PINCTRL_PIN(155, "SMBALERTB"),
2128c2ecf20Sopenharmony_ci	PINCTRL_PIN(156, "SML0CLK"),
2138c2ecf20Sopenharmony_ci	PINCTRL_PIN(157, "SML0DATA"),
2148c2ecf20Sopenharmony_ci	PINCTRL_PIN(158, "SML0ALERTB"),
2158c2ecf20Sopenharmony_ci	PINCTRL_PIN(159, "SML1CLK"),
2168c2ecf20Sopenharmony_ci	PINCTRL_PIN(160, "SML1DATA"),
2178c2ecf20Sopenharmony_ci	PINCTRL_PIN(161, "UART0_RXD"),
2188c2ecf20Sopenharmony_ci	PINCTRL_PIN(162, "UART0_TXD"),
2198c2ecf20Sopenharmony_ci	PINCTRL_PIN(163, "UART0_RTSB"),
2208c2ecf20Sopenharmony_ci	PINCTRL_PIN(164, "UART0_CTSB"),
2218c2ecf20Sopenharmony_ci	PINCTRL_PIN(165, "UART1_RXD"),
2228c2ecf20Sopenharmony_ci	PINCTRL_PIN(166, "UART1_TXD"),
2238c2ecf20Sopenharmony_ci	PINCTRL_PIN(167, "UART1_RTSB"),
2248c2ecf20Sopenharmony_ci	PINCTRL_PIN(168, "UART1_CTSB"),
2258c2ecf20Sopenharmony_ci	PINCTRL_PIN(169, "I2C0_SDA"),
2268c2ecf20Sopenharmony_ci	PINCTRL_PIN(170, "I2C0_SCL"),
2278c2ecf20Sopenharmony_ci	PINCTRL_PIN(171, "I2C1_SDA"),
2288c2ecf20Sopenharmony_ci	PINCTRL_PIN(172, "I2C1_SCL"),
2298c2ecf20Sopenharmony_ci	PINCTRL_PIN(173, "UART2_RXD"),
2308c2ecf20Sopenharmony_ci	PINCTRL_PIN(174, "UART2_TXD"),
2318c2ecf20Sopenharmony_ci	PINCTRL_PIN(175, "UART2_RTSB"),
2328c2ecf20Sopenharmony_ci	PINCTRL_PIN(176, "UART2_CTSB"),
2338c2ecf20Sopenharmony_ci	/* HVCMOS */
2348c2ecf20Sopenharmony_ci	PINCTRL_PIN(177, "L_BKLTEN"),
2358c2ecf20Sopenharmony_ci	PINCTRL_PIN(178, "L_BKLTCTL"),
2368c2ecf20Sopenharmony_ci	PINCTRL_PIN(179, "L_VDDEN"),
2378c2ecf20Sopenharmony_ci	PINCTRL_PIN(180, "SYS_PWROK"),
2388c2ecf20Sopenharmony_ci	PINCTRL_PIN(181, "SYS_RESETB"),
2398c2ecf20Sopenharmony_ci	PINCTRL_PIN(182, "MLK_RSTB"),
2408c2ecf20Sopenharmony_ci	/* GPP_E */
2418c2ecf20Sopenharmony_ci	PINCTRL_PIN(183, "SATAXPCIE_0"),
2428c2ecf20Sopenharmony_ci	PINCTRL_PIN(184, "SPI1_IO_2"),
2438c2ecf20Sopenharmony_ci	PINCTRL_PIN(185, "SPI1_IO_3"),
2448c2ecf20Sopenharmony_ci	PINCTRL_PIN(186, "CPU_GP_0"),
2458c2ecf20Sopenharmony_ci	PINCTRL_PIN(187, "SATA_DEVSLP_0"),
2468c2ecf20Sopenharmony_ci	PINCTRL_PIN(188, "SATA_DEVSLP_1"),
2478c2ecf20Sopenharmony_ci	PINCTRL_PIN(189, "GPPC_E_6"),
2488c2ecf20Sopenharmony_ci	PINCTRL_PIN(190, "CPU_GP_1"),
2498c2ecf20Sopenharmony_ci	PINCTRL_PIN(191, "SATA_LEDB"),
2508c2ecf20Sopenharmony_ci	PINCTRL_PIN(192, "USB2_OCB_0"),
2518c2ecf20Sopenharmony_ci	PINCTRL_PIN(193, "SPI1_CSB"),
2528c2ecf20Sopenharmony_ci	PINCTRL_PIN(194, "SPI1_CLK"),
2538c2ecf20Sopenharmony_ci	PINCTRL_PIN(195, "SPI1_MISO_IO_1"),
2548c2ecf20Sopenharmony_ci	PINCTRL_PIN(196, "SPI1_MOSI_IO_0"),
2558c2ecf20Sopenharmony_ci	PINCTRL_PIN(197, "DDSP_HPD_A"),
2568c2ecf20Sopenharmony_ci	PINCTRL_PIN(198, "ISH_GP_6"),
2578c2ecf20Sopenharmony_ci	PINCTRL_PIN(199, "ISH_GP_7"),
2588c2ecf20Sopenharmony_ci	PINCTRL_PIN(200, "DISP_MISC_4"),
2598c2ecf20Sopenharmony_ci	PINCTRL_PIN(201, "DDP1_CTRLCLK"),
2608c2ecf20Sopenharmony_ci	PINCTRL_PIN(202, "DDP1_CTRLDATA"),
2618c2ecf20Sopenharmony_ci	PINCTRL_PIN(203, "DDP2_CTRLCLK"),
2628c2ecf20Sopenharmony_ci	PINCTRL_PIN(204, "DDP2_CTRLDATA"),
2638c2ecf20Sopenharmony_ci	PINCTRL_PIN(205, "DDPA_CTRLCLK"),
2648c2ecf20Sopenharmony_ci	PINCTRL_PIN(206, "DDPA_CTRLDATA"),
2658c2ecf20Sopenharmony_ci	/* JTAG */
2668c2ecf20Sopenharmony_ci	PINCTRL_PIN(207, "JTAG_TDO"),
2678c2ecf20Sopenharmony_ci	PINCTRL_PIN(208, "JTAGX"),
2688c2ecf20Sopenharmony_ci	PINCTRL_PIN(209, "PRDYB"),
2698c2ecf20Sopenharmony_ci	PINCTRL_PIN(210, "PREQB"),
2708c2ecf20Sopenharmony_ci	PINCTRL_PIN(211, "CPU_TRSTB"),
2718c2ecf20Sopenharmony_ci	PINCTRL_PIN(212, "JTAG_TDI"),
2728c2ecf20Sopenharmony_ci	PINCTRL_PIN(213, "JTAG_TMS"),
2738c2ecf20Sopenharmony_ci	PINCTRL_PIN(214, "JTAG_TCK"),
2748c2ecf20Sopenharmony_ci	PINCTRL_PIN(215, "ITP_PMODE"),
2758c2ecf20Sopenharmony_ci	/* GPP_R */
2768c2ecf20Sopenharmony_ci	PINCTRL_PIN(216, "HDA_BCLK"),
2778c2ecf20Sopenharmony_ci	PINCTRL_PIN(217, "HDA_SYNC"),
2788c2ecf20Sopenharmony_ci	PINCTRL_PIN(218, "HDA_SDO"),
2798c2ecf20Sopenharmony_ci	PINCTRL_PIN(219, "HDA_SDI_0"),
2808c2ecf20Sopenharmony_ci	PINCTRL_PIN(220, "HDA_RSTB"),
2818c2ecf20Sopenharmony_ci	PINCTRL_PIN(221, "HDA_SDI_1"),
2828c2ecf20Sopenharmony_ci	PINCTRL_PIN(222, "I2S1_TXD"),
2838c2ecf20Sopenharmony_ci	PINCTRL_PIN(223, "I2S1_RXD"),
2848c2ecf20Sopenharmony_ci	/* GPP_S */
2858c2ecf20Sopenharmony_ci	PINCTRL_PIN(224, "SNDW1_CLK"),
2868c2ecf20Sopenharmony_ci	PINCTRL_PIN(225, "SNDW1_DATA"),
2878c2ecf20Sopenharmony_ci	PINCTRL_PIN(226, "SNDW2_CLK"),
2888c2ecf20Sopenharmony_ci	PINCTRL_PIN(227, "SNDW2_DATA"),
2898c2ecf20Sopenharmony_ci	PINCTRL_PIN(228, "SNDW3_CLK"),
2908c2ecf20Sopenharmony_ci	PINCTRL_PIN(229, "SNDW3_DATA"),
2918c2ecf20Sopenharmony_ci	PINCTRL_PIN(230, "SNDW4_CLK"),
2928c2ecf20Sopenharmony_ci	PINCTRL_PIN(231, "SNDW4_DATA"),
2938c2ecf20Sopenharmony_ci	/* SPI */
2948c2ecf20Sopenharmony_ci	PINCTRL_PIN(232, "SPI0_IO_2"),
2958c2ecf20Sopenharmony_ci	PINCTRL_PIN(233, "SPI0_IO_3"),
2968c2ecf20Sopenharmony_ci	PINCTRL_PIN(234, "SPI0_MOSI_IO_0"),
2978c2ecf20Sopenharmony_ci	PINCTRL_PIN(235, "SPI0_MISO_IO_1"),
2988c2ecf20Sopenharmony_ci	PINCTRL_PIN(236, "SPI0_TPM_CSB"),
2998c2ecf20Sopenharmony_ci	PINCTRL_PIN(237, "SPI0_FLASH_0_CSB"),
3008c2ecf20Sopenharmony_ci	PINCTRL_PIN(238, "SPI0_FLASH_1_CSB"),
3018c2ecf20Sopenharmony_ci	PINCTRL_PIN(239, "SPI0_CLK"),
3028c2ecf20Sopenharmony_ci	PINCTRL_PIN(240, "SPI0_CLK_LOOPBK"),
3038c2ecf20Sopenharmony_ci};
3048c2ecf20Sopenharmony_ci
3058c2ecf20Sopenharmony_cistatic const struct intel_padgroup icllp_community0_gpps[] = {
3068c2ecf20Sopenharmony_ci	ICL_GPP(0, 0, 7, 0),				/* GPP_G */
3078c2ecf20Sopenharmony_ci	ICL_GPP(1, 8, 33, 32),				/* GPP_B */
3088c2ecf20Sopenharmony_ci	ICL_GPP(2, 34, 58, 64),				/* GPP_A */
3098c2ecf20Sopenharmony_ci};
3108c2ecf20Sopenharmony_ci
3118c2ecf20Sopenharmony_cistatic const struct intel_padgroup icllp_community1_gpps[] = {
3128c2ecf20Sopenharmony_ci	ICL_GPP(0, 59, 82, 96),				/* GPP_H */
3138c2ecf20Sopenharmony_ci	ICL_GPP(1, 83, 103, 128),			/* GPP_D */
3148c2ecf20Sopenharmony_ci	ICL_GPP(2, 104, 123, 160),			/* GPP_F */
3158c2ecf20Sopenharmony_ci	ICL_GPP(3, 124, 152, 192),			/* vGPIO */
3168c2ecf20Sopenharmony_ci};
3178c2ecf20Sopenharmony_ci
3188c2ecf20Sopenharmony_cistatic const struct intel_padgroup icllp_community4_gpps[] = {
3198c2ecf20Sopenharmony_ci	ICL_GPP(0, 153, 176, 224),			/* GPP_C */
3208c2ecf20Sopenharmony_ci	ICL_GPP(1, 177, 182, INTEL_GPIO_BASE_NOMAP),	/* HVCMOS */
3218c2ecf20Sopenharmony_ci	ICL_GPP(2, 183, 206, 256),			/* GPP_E */
3228c2ecf20Sopenharmony_ci	ICL_GPP(3, 207, 215, INTEL_GPIO_BASE_NOMAP),	/* JTAG */
3238c2ecf20Sopenharmony_ci};
3248c2ecf20Sopenharmony_ci
3258c2ecf20Sopenharmony_cistatic const struct intel_padgroup icllp_community5_gpps[] = {
3268c2ecf20Sopenharmony_ci	ICL_GPP(0, 216, 223, 288),			/* GPP_R */
3278c2ecf20Sopenharmony_ci	ICL_GPP(1, 224, 231, 320),			/* GPP_S */
3288c2ecf20Sopenharmony_ci	ICL_GPP(2, 232, 240, INTEL_GPIO_BASE_NOMAP),	/* SPI */
3298c2ecf20Sopenharmony_ci};
3308c2ecf20Sopenharmony_ci
3318c2ecf20Sopenharmony_cistatic const struct intel_community icllp_communities[] = {
3328c2ecf20Sopenharmony_ci	ICL_COMMUNITY(0, 0, 58, icllp_community0_gpps),
3338c2ecf20Sopenharmony_ci	ICL_COMMUNITY(1, 59, 152, icllp_community1_gpps),
3348c2ecf20Sopenharmony_ci	ICL_COMMUNITY(2, 153, 215, icllp_community4_gpps),
3358c2ecf20Sopenharmony_ci	ICL_COMMUNITY(3, 216, 240, icllp_community5_gpps),
3368c2ecf20Sopenharmony_ci};
3378c2ecf20Sopenharmony_ci
3388c2ecf20Sopenharmony_cistatic const unsigned int icllp_spi0_pins[] = { 22, 23, 24, 25, 26 };
3398c2ecf20Sopenharmony_cistatic const unsigned int icllp_spi0_modes[] = { 3, 1, 1, 1, 1 };
3408c2ecf20Sopenharmony_cistatic const unsigned int icllp_spi1_pins[] = { 27, 28, 29, 30, 31 };
3418c2ecf20Sopenharmony_cistatic const unsigned int icllp_spi1_modes[] = { 1, 1, 1, 1, 3 };
3428c2ecf20Sopenharmony_cistatic const unsigned int icllp_spi2_pins[] = { 92, 93, 94, 95, 98 };
3438c2ecf20Sopenharmony_cistatic const unsigned int icllp_spi2_modes[] = { 3, 3, 3, 3, 2 };
3448c2ecf20Sopenharmony_ci
3458c2ecf20Sopenharmony_cistatic const unsigned int icllp_i2c0_pins[] = { 169, 170 };
3468c2ecf20Sopenharmony_cistatic const unsigned int icllp_i2c1_pins[] = { 171, 172 };
3478c2ecf20Sopenharmony_cistatic const unsigned int icllp_i2c2_pins[] = { 63, 64 };
3488c2ecf20Sopenharmony_cistatic const unsigned int icllp_i2c3_pins[] = { 65, 66 };
3498c2ecf20Sopenharmony_cistatic const unsigned int icllp_i2c4_pins[] = { 67, 68 };
3508c2ecf20Sopenharmony_ci
3518c2ecf20Sopenharmony_cistatic const unsigned int icllp_uart0_pins[] = { 161, 162, 163, 164 };
3528c2ecf20Sopenharmony_cistatic const unsigned int icllp_uart1_pins[] = { 165, 166, 167, 168 };
3538c2ecf20Sopenharmony_cistatic const unsigned int icllp_uart2_pins[] = { 173, 174, 175, 176 };
3548c2ecf20Sopenharmony_ci
3558c2ecf20Sopenharmony_cistatic const struct intel_pingroup icllp_groups[] = {
3568c2ecf20Sopenharmony_ci	PIN_GROUP("spi0_grp", icllp_spi0_pins, icllp_spi0_modes),
3578c2ecf20Sopenharmony_ci	PIN_GROUP("spi1_grp", icllp_spi1_pins, icllp_spi1_modes),
3588c2ecf20Sopenharmony_ci	PIN_GROUP("spi2_grp", icllp_spi2_pins, icllp_spi2_modes),
3598c2ecf20Sopenharmony_ci	PIN_GROUP("i2c0_grp", icllp_i2c0_pins, 1),
3608c2ecf20Sopenharmony_ci	PIN_GROUP("i2c1_grp", icllp_i2c1_pins, 1),
3618c2ecf20Sopenharmony_ci	PIN_GROUP("i2c2_grp", icllp_i2c2_pins, 1),
3628c2ecf20Sopenharmony_ci	PIN_GROUP("i2c3_grp", icllp_i2c3_pins, 1),
3638c2ecf20Sopenharmony_ci	PIN_GROUP("i2c4_grp", icllp_i2c4_pins, 1),
3648c2ecf20Sopenharmony_ci	PIN_GROUP("uart0_grp", icllp_uart0_pins, 1),
3658c2ecf20Sopenharmony_ci	PIN_GROUP("uart1_grp", icllp_uart1_pins, 1),
3668c2ecf20Sopenharmony_ci	PIN_GROUP("uart2_grp", icllp_uart2_pins, 1),
3678c2ecf20Sopenharmony_ci};
3688c2ecf20Sopenharmony_ci
3698c2ecf20Sopenharmony_cistatic const char * const icllp_spi0_groups[] = { "spi0_grp" };
3708c2ecf20Sopenharmony_cistatic const char * const icllp_spi1_groups[] = { "spi1_grp" };
3718c2ecf20Sopenharmony_cistatic const char * const icllp_spi2_groups[] = { "spi2_grp" };
3728c2ecf20Sopenharmony_cistatic const char * const icllp_i2c0_groups[] = { "i2c0_grp" };
3738c2ecf20Sopenharmony_cistatic const char * const icllp_i2c1_groups[] = { "i2c1_grp" };
3748c2ecf20Sopenharmony_cistatic const char * const icllp_i2c2_groups[] = { "i2c2_grp" };
3758c2ecf20Sopenharmony_cistatic const char * const icllp_i2c3_groups[] = { "i2c3_grp" };
3768c2ecf20Sopenharmony_cistatic const char * const icllp_i2c4_groups[] = { "i2c4_grp" };
3778c2ecf20Sopenharmony_cistatic const char * const icllp_uart0_groups[] = { "uart0_grp" };
3788c2ecf20Sopenharmony_cistatic const char * const icllp_uart1_groups[] = { "uart1_grp" };
3798c2ecf20Sopenharmony_cistatic const char * const icllp_uart2_groups[] = { "uart2_grp" };
3808c2ecf20Sopenharmony_ci
3818c2ecf20Sopenharmony_cistatic const struct intel_function icllp_functions[] = {
3828c2ecf20Sopenharmony_ci	FUNCTION("spi0", icllp_spi0_groups),
3838c2ecf20Sopenharmony_ci	FUNCTION("spi1", icllp_spi1_groups),
3848c2ecf20Sopenharmony_ci	FUNCTION("spi2", icllp_spi2_groups),
3858c2ecf20Sopenharmony_ci	FUNCTION("i2c0", icllp_i2c0_groups),
3868c2ecf20Sopenharmony_ci	FUNCTION("i2c1", icllp_i2c1_groups),
3878c2ecf20Sopenharmony_ci	FUNCTION("i2c2", icllp_i2c2_groups),
3888c2ecf20Sopenharmony_ci	FUNCTION("i2c3", icllp_i2c3_groups),
3898c2ecf20Sopenharmony_ci	FUNCTION("i2c4", icllp_i2c4_groups),
3908c2ecf20Sopenharmony_ci	FUNCTION("uart0", icllp_uart0_groups),
3918c2ecf20Sopenharmony_ci	FUNCTION("uart1", icllp_uart1_groups),
3928c2ecf20Sopenharmony_ci	FUNCTION("uart2", icllp_uart2_groups),
3938c2ecf20Sopenharmony_ci};
3948c2ecf20Sopenharmony_ci
3958c2ecf20Sopenharmony_cistatic const struct intel_pinctrl_soc_data icllp_soc_data = {
3968c2ecf20Sopenharmony_ci	.pins = icllp_pins,
3978c2ecf20Sopenharmony_ci	.npins = ARRAY_SIZE(icllp_pins),
3988c2ecf20Sopenharmony_ci	.groups = icllp_groups,
3998c2ecf20Sopenharmony_ci	.ngroups = ARRAY_SIZE(icllp_groups),
4008c2ecf20Sopenharmony_ci	.functions = icllp_functions,
4018c2ecf20Sopenharmony_ci	.nfunctions = ARRAY_SIZE(icllp_functions),
4028c2ecf20Sopenharmony_ci	.communities = icllp_communities,
4038c2ecf20Sopenharmony_ci	.ncommunities = ARRAY_SIZE(icllp_communities),
4048c2ecf20Sopenharmony_ci};
4058c2ecf20Sopenharmony_ci
4068c2ecf20Sopenharmony_cistatic INTEL_PINCTRL_PM_OPS(icl_pinctrl_pm_ops);
4078c2ecf20Sopenharmony_ci
4088c2ecf20Sopenharmony_cistatic const struct acpi_device_id icl_pinctrl_acpi_match[] = {
4098c2ecf20Sopenharmony_ci	{ "INT3455", (kernel_ulong_t)&icllp_soc_data },
4108c2ecf20Sopenharmony_ci	{ }
4118c2ecf20Sopenharmony_ci};
4128c2ecf20Sopenharmony_ciMODULE_DEVICE_TABLE(acpi, icl_pinctrl_acpi_match);
4138c2ecf20Sopenharmony_ci
4148c2ecf20Sopenharmony_cistatic struct platform_driver icl_pinctrl_driver = {
4158c2ecf20Sopenharmony_ci	.probe = intel_pinctrl_probe_by_hid,
4168c2ecf20Sopenharmony_ci	.driver = {
4178c2ecf20Sopenharmony_ci		.name = "icelake-pinctrl",
4188c2ecf20Sopenharmony_ci		.acpi_match_table = icl_pinctrl_acpi_match,
4198c2ecf20Sopenharmony_ci		.pm = &icl_pinctrl_pm_ops,
4208c2ecf20Sopenharmony_ci	},
4218c2ecf20Sopenharmony_ci};
4228c2ecf20Sopenharmony_ci
4238c2ecf20Sopenharmony_cimodule_platform_driver(icl_pinctrl_driver);
4248c2ecf20Sopenharmony_ci
4258c2ecf20Sopenharmony_ciMODULE_AUTHOR("Andy Shevchenko <andriy.shevchenko@linux.intel.com>");
4268c2ecf20Sopenharmony_ciMODULE_AUTHOR("Mika Westerberg <mika.westerberg@linux.intel.com>");
4278c2ecf20Sopenharmony_ciMODULE_DESCRIPTION("Intel Ice Lake PCH pinctrl/GPIO driver");
4288c2ecf20Sopenharmony_ciMODULE_LICENSE("GPL v2");
429