18c2ecf20Sopenharmony_ci// SPDX-License-Identifier: GPL-2.0-only
28c2ecf20Sopenharmony_ci/*
38c2ecf20Sopenharmony_ci * Copyright (C) ST-Ericsson SA 2012
48c2ecf20Sopenharmony_ci *
58c2ecf20Sopenharmony_ci * Author: Patrice Chotard <patrice.chotard@stericsson.com> for ST-Ericsson.
68c2ecf20Sopenharmony_ci */
78c2ecf20Sopenharmony_ci
88c2ecf20Sopenharmony_ci#include <linux/kernel.h>
98c2ecf20Sopenharmony_ci#include <linux/gpio/driver.h>
108c2ecf20Sopenharmony_ci#include <linux/pinctrl/pinctrl.h>
118c2ecf20Sopenharmony_ci#include <linux/mfd/abx500/ab8500.h>
128c2ecf20Sopenharmony_ci#include "pinctrl-abx500.h"
138c2ecf20Sopenharmony_ci
148c2ecf20Sopenharmony_ci/* All the pins that can be used for GPIO and some other functions */
158c2ecf20Sopenharmony_ci#define ABX500_GPIO(offset)		(offset)
168c2ecf20Sopenharmony_ci
178c2ecf20Sopenharmony_ci#define AB8500_PIN_T10		ABX500_GPIO(1)
188c2ecf20Sopenharmony_ci#define AB8500_PIN_T9		ABX500_GPIO(2)
198c2ecf20Sopenharmony_ci#define AB8500_PIN_U9		ABX500_GPIO(3)
208c2ecf20Sopenharmony_ci#define AB8500_PIN_W2		ABX500_GPIO(4)
218c2ecf20Sopenharmony_ci/* hole */
228c2ecf20Sopenharmony_ci#define AB8500_PIN_Y18		ABX500_GPIO(6)
238c2ecf20Sopenharmony_ci#define AB8500_PIN_AA20		ABX500_GPIO(7)
248c2ecf20Sopenharmony_ci#define AB8500_PIN_W18		ABX500_GPIO(8)
258c2ecf20Sopenharmony_ci#define AB8500_PIN_AA19		ABX500_GPIO(9)
268c2ecf20Sopenharmony_ci#define AB8500_PIN_U17		ABX500_GPIO(10)
278c2ecf20Sopenharmony_ci#define AB8500_PIN_AA18		ABX500_GPIO(11)
288c2ecf20Sopenharmony_ci#define AB8500_PIN_U16		ABX500_GPIO(12)
298c2ecf20Sopenharmony_ci#define AB8500_PIN_W17		ABX500_GPIO(13)
308c2ecf20Sopenharmony_ci#define AB8500_PIN_F14		ABX500_GPIO(14)
318c2ecf20Sopenharmony_ci#define AB8500_PIN_B17		ABX500_GPIO(15)
328c2ecf20Sopenharmony_ci#define AB8500_PIN_F15		ABX500_GPIO(16)
338c2ecf20Sopenharmony_ci#define AB8500_PIN_P5		ABX500_GPIO(17)
348c2ecf20Sopenharmony_ci#define AB8500_PIN_R5		ABX500_GPIO(18)
358c2ecf20Sopenharmony_ci#define AB8500_PIN_U5		ABX500_GPIO(19)
368c2ecf20Sopenharmony_ci#define AB8500_PIN_T5		ABX500_GPIO(20)
378c2ecf20Sopenharmony_ci#define AB8500_PIN_H19		ABX500_GPIO(21)
388c2ecf20Sopenharmony_ci#define AB8500_PIN_G20		ABX500_GPIO(22)
398c2ecf20Sopenharmony_ci#define AB8500_PIN_G19		ABX500_GPIO(23)
408c2ecf20Sopenharmony_ci#define AB8500_PIN_T14		ABX500_GPIO(24)
418c2ecf20Sopenharmony_ci#define AB8500_PIN_R16		ABX500_GPIO(25)
428c2ecf20Sopenharmony_ci#define AB8500_PIN_M16		ABX500_GPIO(26)
438c2ecf20Sopenharmony_ci#define AB8500_PIN_J6		ABX500_GPIO(27)
448c2ecf20Sopenharmony_ci#define AB8500_PIN_K6		ABX500_GPIO(28)
458c2ecf20Sopenharmony_ci#define AB8500_PIN_G6		ABX500_GPIO(29)
468c2ecf20Sopenharmony_ci#define AB8500_PIN_H6		ABX500_GPIO(30)
478c2ecf20Sopenharmony_ci#define AB8500_PIN_F5		ABX500_GPIO(31)
488c2ecf20Sopenharmony_ci#define AB8500_PIN_G5		ABX500_GPIO(32)
498c2ecf20Sopenharmony_ci/* hole */
508c2ecf20Sopenharmony_ci#define AB8500_PIN_R17		ABX500_GPIO(34)
518c2ecf20Sopenharmony_ci#define AB8500_PIN_W15		ABX500_GPIO(35)
528c2ecf20Sopenharmony_ci#define AB8500_PIN_A17		ABX500_GPIO(36)
538c2ecf20Sopenharmony_ci#define AB8500_PIN_E15		ABX500_GPIO(37)
548c2ecf20Sopenharmony_ci#define AB8500_PIN_C17		ABX500_GPIO(38)
558c2ecf20Sopenharmony_ci#define AB8500_PIN_E16		ABX500_GPIO(39)
568c2ecf20Sopenharmony_ci#define AB8500_PIN_T19		ABX500_GPIO(40)
578c2ecf20Sopenharmony_ci#define AB8500_PIN_U19		ABX500_GPIO(41)
588c2ecf20Sopenharmony_ci#define AB8500_PIN_U2		ABX500_GPIO(42)
598c2ecf20Sopenharmony_ci
608c2ecf20Sopenharmony_ci/* indicates the highest GPIO number */
618c2ecf20Sopenharmony_ci#define AB8500_GPIO_MAX_NUMBER	42
628c2ecf20Sopenharmony_ci
638c2ecf20Sopenharmony_ci/*
648c2ecf20Sopenharmony_ci * The names of the pins are denoted by GPIO number and ball name, even
658c2ecf20Sopenharmony_ci * though they can be used for other things than GPIO, this is the first
668c2ecf20Sopenharmony_ci * column in the table of the data sheet and often used on schematics and
678c2ecf20Sopenharmony_ci * such.
688c2ecf20Sopenharmony_ci */
698c2ecf20Sopenharmony_cistatic const struct pinctrl_pin_desc ab8500_pins[] = {
708c2ecf20Sopenharmony_ci	PINCTRL_PIN(AB8500_PIN_T10, "GPIO1_T10"),
718c2ecf20Sopenharmony_ci	PINCTRL_PIN(AB8500_PIN_T9, "GPIO2_T9"),
728c2ecf20Sopenharmony_ci	PINCTRL_PIN(AB8500_PIN_U9, "GPIO3_U9"),
738c2ecf20Sopenharmony_ci	PINCTRL_PIN(AB8500_PIN_W2, "GPIO4_W2"),
748c2ecf20Sopenharmony_ci	/* hole */
758c2ecf20Sopenharmony_ci	PINCTRL_PIN(AB8500_PIN_Y18, "GPIO6_Y18"),
768c2ecf20Sopenharmony_ci	PINCTRL_PIN(AB8500_PIN_AA20, "GPIO7_AA20"),
778c2ecf20Sopenharmony_ci	PINCTRL_PIN(AB8500_PIN_W18, "GPIO8_W18"),
788c2ecf20Sopenharmony_ci	PINCTRL_PIN(AB8500_PIN_AA19, "GPIO9_AA19"),
798c2ecf20Sopenharmony_ci	PINCTRL_PIN(AB8500_PIN_U17, "GPIO10_U17"),
808c2ecf20Sopenharmony_ci	PINCTRL_PIN(AB8500_PIN_AA18, "GPIO11_AA18"),
818c2ecf20Sopenharmony_ci	PINCTRL_PIN(AB8500_PIN_U16, "GPIO12_U16"),
828c2ecf20Sopenharmony_ci	PINCTRL_PIN(AB8500_PIN_W17, "GPIO13_W17"),
838c2ecf20Sopenharmony_ci	PINCTRL_PIN(AB8500_PIN_F14, "GPIO14_F14"),
848c2ecf20Sopenharmony_ci	PINCTRL_PIN(AB8500_PIN_B17, "GPIO15_B17"),
858c2ecf20Sopenharmony_ci	PINCTRL_PIN(AB8500_PIN_F15, "GPIO16_F15"),
868c2ecf20Sopenharmony_ci	PINCTRL_PIN(AB8500_PIN_P5, "GPIO17_P5"),
878c2ecf20Sopenharmony_ci	PINCTRL_PIN(AB8500_PIN_R5, "GPIO18_R5"),
888c2ecf20Sopenharmony_ci	PINCTRL_PIN(AB8500_PIN_U5, "GPIO19_U5"),
898c2ecf20Sopenharmony_ci	PINCTRL_PIN(AB8500_PIN_T5, "GPIO20_T5"),
908c2ecf20Sopenharmony_ci	PINCTRL_PIN(AB8500_PIN_H19, "GPIO21_H19"),
918c2ecf20Sopenharmony_ci	PINCTRL_PIN(AB8500_PIN_G20, "GPIO22_G20"),
928c2ecf20Sopenharmony_ci	PINCTRL_PIN(AB8500_PIN_G19, "GPIO23_G19"),
938c2ecf20Sopenharmony_ci	PINCTRL_PIN(AB8500_PIN_T14, "GPIO24_T14"),
948c2ecf20Sopenharmony_ci	PINCTRL_PIN(AB8500_PIN_R16, "GPIO25_R16"),
958c2ecf20Sopenharmony_ci	PINCTRL_PIN(AB8500_PIN_M16, "GPIO26_M16"),
968c2ecf20Sopenharmony_ci	PINCTRL_PIN(AB8500_PIN_J6, "GPIO27_J6"),
978c2ecf20Sopenharmony_ci	PINCTRL_PIN(AB8500_PIN_K6, "GPIO28_K6"),
988c2ecf20Sopenharmony_ci	PINCTRL_PIN(AB8500_PIN_G6, "GPIO29_G6"),
998c2ecf20Sopenharmony_ci	PINCTRL_PIN(AB8500_PIN_H6, "GPIO30_H6"),
1008c2ecf20Sopenharmony_ci	PINCTRL_PIN(AB8500_PIN_F5, "GPIO31_F5"),
1018c2ecf20Sopenharmony_ci	PINCTRL_PIN(AB8500_PIN_G5, "GPIO32_G5"),
1028c2ecf20Sopenharmony_ci	/* hole */
1038c2ecf20Sopenharmony_ci	PINCTRL_PIN(AB8500_PIN_R17, "GPIO34_R17"),
1048c2ecf20Sopenharmony_ci	PINCTRL_PIN(AB8500_PIN_W15, "GPIO35_W15"),
1058c2ecf20Sopenharmony_ci	PINCTRL_PIN(AB8500_PIN_A17, "GPIO36_A17"),
1068c2ecf20Sopenharmony_ci	PINCTRL_PIN(AB8500_PIN_E15, "GPIO37_E15"),
1078c2ecf20Sopenharmony_ci	PINCTRL_PIN(AB8500_PIN_C17, "GPIO38_C17"),
1088c2ecf20Sopenharmony_ci	PINCTRL_PIN(AB8500_PIN_E16, "GPIO39_E16"),
1098c2ecf20Sopenharmony_ci	PINCTRL_PIN(AB8500_PIN_T19, "GPIO40_T19"),
1108c2ecf20Sopenharmony_ci	PINCTRL_PIN(AB8500_PIN_U19, "GPIO41_U19"),
1118c2ecf20Sopenharmony_ci	PINCTRL_PIN(AB8500_PIN_U2, "GPIO42_U2"),
1128c2ecf20Sopenharmony_ci};
1138c2ecf20Sopenharmony_ci
1148c2ecf20Sopenharmony_ci/*
1158c2ecf20Sopenharmony_ci * Maps local GPIO offsets to local pin numbers
1168c2ecf20Sopenharmony_ci */
1178c2ecf20Sopenharmony_cistatic const struct abx500_pinrange ab8500_pinranges[] = {
1188c2ecf20Sopenharmony_ci	ABX500_PINRANGE(1, 4, ABX500_ALT_A),
1198c2ecf20Sopenharmony_ci	ABX500_PINRANGE(6, 4, ABX500_ALT_A),
1208c2ecf20Sopenharmony_ci	ABX500_PINRANGE(10, 4, ABX500_DEFAULT),
1218c2ecf20Sopenharmony_ci	ABX500_PINRANGE(14, 12, ABX500_ALT_A),
1228c2ecf20Sopenharmony_ci	ABX500_PINRANGE(26, 1, ABX500_DEFAULT),
1238c2ecf20Sopenharmony_ci	ABX500_PINRANGE(27, 6, ABX500_ALT_A),
1248c2ecf20Sopenharmony_ci	ABX500_PINRANGE(34, 1, ABX500_ALT_A),
1258c2ecf20Sopenharmony_ci	ABX500_PINRANGE(35, 1, ABX500_DEFAULT),
1268c2ecf20Sopenharmony_ci	ABX500_PINRANGE(36, 7, ABX500_ALT_A),
1278c2ecf20Sopenharmony_ci};
1288c2ecf20Sopenharmony_ci
1298c2ecf20Sopenharmony_ci/*
1308c2ecf20Sopenharmony_ci * Read the pin group names like this:
1318c2ecf20Sopenharmony_ci * sysclkreq2_d_1 = first groups of pins for sysclkreq2 on default function
1328c2ecf20Sopenharmony_ci *
1338c2ecf20Sopenharmony_ci * The groups are arranged as sets per altfunction column, so we can
1348c2ecf20Sopenharmony_ci * mux in one group at a time by selecting the same altfunction for them
1358c2ecf20Sopenharmony_ci * all. When functions require pins on different altfunctions, you need
1368c2ecf20Sopenharmony_ci * to combine several groups.
1378c2ecf20Sopenharmony_ci */
1388c2ecf20Sopenharmony_ci
1398c2ecf20Sopenharmony_ci/* default column */
1408c2ecf20Sopenharmony_cistatic const unsigned sysclkreq2_d_1_pins[] = { AB8500_PIN_T10 };
1418c2ecf20Sopenharmony_cistatic const unsigned sysclkreq3_d_1_pins[] = { AB8500_PIN_T9 };
1428c2ecf20Sopenharmony_cistatic const unsigned sysclkreq4_d_1_pins[] = { AB8500_PIN_U9 };
1438c2ecf20Sopenharmony_cistatic const unsigned sysclkreq6_d_1_pins[] = { AB8500_PIN_W2 };
1448c2ecf20Sopenharmony_cistatic const unsigned ycbcr0123_d_1_pins[] = { AB8500_PIN_Y18, AB8500_PIN_AA20,
1458c2ecf20Sopenharmony_ci					AB8500_PIN_W18, AB8500_PIN_AA19};
1468c2ecf20Sopenharmony_cistatic const unsigned gpio10_d_1_pins[] = { AB8500_PIN_U17 };
1478c2ecf20Sopenharmony_cistatic const unsigned gpio11_d_1_pins[] = { AB8500_PIN_AA18 };
1488c2ecf20Sopenharmony_cistatic const unsigned gpio12_d_1_pins[] = { AB8500_PIN_U16 };
1498c2ecf20Sopenharmony_cistatic const unsigned gpio13_d_1_pins[] = { AB8500_PIN_W17 };
1508c2ecf20Sopenharmony_cistatic const unsigned pwmout1_d_1_pins[] = { AB8500_PIN_F14 };
1518c2ecf20Sopenharmony_cistatic const unsigned pwmout2_d_1_pins[] = { AB8500_PIN_B17 };
1528c2ecf20Sopenharmony_cistatic const unsigned pwmout3_d_1_pins[] = { AB8500_PIN_F15 };
1538c2ecf20Sopenharmony_ci
1548c2ecf20Sopenharmony_ci/* audio data interface 1*/
1558c2ecf20Sopenharmony_cistatic const unsigned adi1_d_1_pins[] = { AB8500_PIN_P5, AB8500_PIN_R5,
1568c2ecf20Sopenharmony_ci					AB8500_PIN_U5, AB8500_PIN_T5 };
1578c2ecf20Sopenharmony_ci/* USBUICC */
1588c2ecf20Sopenharmony_cistatic const unsigned usbuicc_d_1_pins[] = { AB8500_PIN_H19, AB8500_PIN_G20,
1598c2ecf20Sopenharmony_ci					AB8500_PIN_G19 };
1608c2ecf20Sopenharmony_cistatic const unsigned sysclkreq7_d_1_pins[] = { AB8500_PIN_T14 };
1618c2ecf20Sopenharmony_cistatic const unsigned sysclkreq8_d_1_pins[] = { AB8500_PIN_R16 };
1628c2ecf20Sopenharmony_cistatic const unsigned gpio26_d_1_pins[] = { AB8500_PIN_M16 };
1638c2ecf20Sopenharmony_ci/* Digital microphone 1 and 2 */
1648c2ecf20Sopenharmony_cistatic const unsigned dmic12_d_1_pins[] = { AB8500_PIN_J6, AB8500_PIN_K6 };
1658c2ecf20Sopenharmony_ci/* Digital microphone 3 and 4 */
1668c2ecf20Sopenharmony_cistatic const unsigned dmic34_d_1_pins[] = { AB8500_PIN_G6, AB8500_PIN_H6 };
1678c2ecf20Sopenharmony_ci/* Digital microphone 5 and 6 */
1688c2ecf20Sopenharmony_cistatic const unsigned dmic56_d_1_pins[] = { AB8500_PIN_F5, AB8500_PIN_G5 };
1698c2ecf20Sopenharmony_cistatic const unsigned extcpena_d_1_pins[] = { AB8500_PIN_R17 };
1708c2ecf20Sopenharmony_cistatic const unsigned gpio35_d_1_pins[] = { AB8500_PIN_W15 };
1718c2ecf20Sopenharmony_ci/* APE SPI */
1728c2ecf20Sopenharmony_cistatic const unsigned apespi_d_1_pins[] = { AB8500_PIN_A17, AB8500_PIN_E15,
1738c2ecf20Sopenharmony_ci					AB8500_PIN_C17, AB8500_PIN_E16};
1748c2ecf20Sopenharmony_ci/* modem SDA/SCL */
1758c2ecf20Sopenharmony_cistatic const unsigned modsclsda_d_1_pins[] = { AB8500_PIN_T19, AB8500_PIN_U19 };
1768c2ecf20Sopenharmony_cistatic const unsigned sysclkreq5_d_1_pins[] = { AB8500_PIN_U2 };
1778c2ecf20Sopenharmony_ci
1788c2ecf20Sopenharmony_ci/* Altfunction A column */
1798c2ecf20Sopenharmony_cistatic const unsigned gpio1_a_1_pins[] = { AB8500_PIN_T10 };
1808c2ecf20Sopenharmony_cistatic const unsigned gpio2_a_1_pins[] = { AB8500_PIN_T9 };
1818c2ecf20Sopenharmony_cistatic const unsigned gpio3_a_1_pins[] = { AB8500_PIN_U9 };
1828c2ecf20Sopenharmony_cistatic const unsigned gpio4_a_1_pins[] = { AB8500_PIN_W2 };
1838c2ecf20Sopenharmony_cistatic const unsigned gpio6_a_1_pins[] = { AB8500_PIN_Y18 };
1848c2ecf20Sopenharmony_cistatic const unsigned gpio7_a_1_pins[] = { AB8500_PIN_AA20 };
1858c2ecf20Sopenharmony_cistatic const unsigned gpio8_a_1_pins[] = { AB8500_PIN_W18 };
1868c2ecf20Sopenharmony_cistatic const unsigned gpio9_a_1_pins[] = { AB8500_PIN_AA19 };
1878c2ecf20Sopenharmony_ci/* YCbCr4 YCbCr5 YCbCr6 YCbCr7*/
1888c2ecf20Sopenharmony_cistatic const unsigned ycbcr4567_a_1_pins[] = { AB8500_PIN_U17, AB8500_PIN_AA18,
1898c2ecf20Sopenharmony_ci					AB8500_PIN_U16, AB8500_PIN_W17};
1908c2ecf20Sopenharmony_cistatic const unsigned gpio14_a_1_pins[] = { AB8500_PIN_F14 };
1918c2ecf20Sopenharmony_cistatic const unsigned gpio15_a_1_pins[] = { AB8500_PIN_B17 };
1928c2ecf20Sopenharmony_cistatic const unsigned gpio16_a_1_pins[] = { AB8500_PIN_F15 };
1938c2ecf20Sopenharmony_cistatic const unsigned gpio17_a_1_pins[] = { AB8500_PIN_P5 };
1948c2ecf20Sopenharmony_cistatic const unsigned gpio18_a_1_pins[] = { AB8500_PIN_R5 };
1958c2ecf20Sopenharmony_cistatic const unsigned gpio19_a_1_pins[] = { AB8500_PIN_U5 };
1968c2ecf20Sopenharmony_cistatic const unsigned gpio20_a_1_pins[] = { AB8500_PIN_T5 };
1978c2ecf20Sopenharmony_cistatic const unsigned gpio21_a_1_pins[] = { AB8500_PIN_H19 };
1988c2ecf20Sopenharmony_cistatic const unsigned gpio22_a_1_pins[] = { AB8500_PIN_G20 };
1998c2ecf20Sopenharmony_cistatic const unsigned gpio23_a_1_pins[] = { AB8500_PIN_G19 };
2008c2ecf20Sopenharmony_cistatic const unsigned gpio24_a_1_pins[] = { AB8500_PIN_T14 };
2018c2ecf20Sopenharmony_cistatic const unsigned gpio25_a_1_pins[] = { AB8500_PIN_R16 };
2028c2ecf20Sopenharmony_cistatic const unsigned gpio27_a_1_pins[] = { AB8500_PIN_J6 };
2038c2ecf20Sopenharmony_cistatic const unsigned gpio28_a_1_pins[] = { AB8500_PIN_K6 };
2048c2ecf20Sopenharmony_cistatic const unsigned gpio29_a_1_pins[] = { AB8500_PIN_G6 };
2058c2ecf20Sopenharmony_cistatic const unsigned gpio30_a_1_pins[] = { AB8500_PIN_H6 };
2068c2ecf20Sopenharmony_cistatic const unsigned gpio31_a_1_pins[] = { AB8500_PIN_F5 };
2078c2ecf20Sopenharmony_cistatic const unsigned gpio32_a_1_pins[] = { AB8500_PIN_G5 };
2088c2ecf20Sopenharmony_cistatic const unsigned gpio34_a_1_pins[] = { AB8500_PIN_R17 };
2098c2ecf20Sopenharmony_cistatic const unsigned gpio36_a_1_pins[] = { AB8500_PIN_A17 };
2108c2ecf20Sopenharmony_cistatic const unsigned gpio37_a_1_pins[] = { AB8500_PIN_E15 };
2118c2ecf20Sopenharmony_cistatic const unsigned gpio38_a_1_pins[] = { AB8500_PIN_C17 };
2128c2ecf20Sopenharmony_cistatic const unsigned gpio39_a_1_pins[] = { AB8500_PIN_E16 };
2138c2ecf20Sopenharmony_cistatic const unsigned gpio40_a_1_pins[] = { AB8500_PIN_T19 };
2148c2ecf20Sopenharmony_cistatic const unsigned gpio41_a_1_pins[] = { AB8500_PIN_U19 };
2158c2ecf20Sopenharmony_cistatic const unsigned gpio42_a_1_pins[] = { AB8500_PIN_U2 };
2168c2ecf20Sopenharmony_ci
2178c2ecf20Sopenharmony_ci/* Altfunction B colum */
2188c2ecf20Sopenharmony_cistatic const unsigned hiqclkena_b_1_pins[] = { AB8500_PIN_U17 };
2198c2ecf20Sopenharmony_cistatic const unsigned usbuiccpd_b_1_pins[] = { AB8500_PIN_AA18 };
2208c2ecf20Sopenharmony_cistatic const unsigned i2ctrig1_b_1_pins[] = { AB8500_PIN_U16 };
2218c2ecf20Sopenharmony_cistatic const unsigned i2ctrig2_b_1_pins[] = { AB8500_PIN_W17 };
2228c2ecf20Sopenharmony_ci
2238c2ecf20Sopenharmony_ci/* Altfunction C column */
2248c2ecf20Sopenharmony_cistatic const unsigned usbvdat_c_1_pins[] = { AB8500_PIN_W17 };
2258c2ecf20Sopenharmony_ci
2268c2ecf20Sopenharmony_ci
2278c2ecf20Sopenharmony_ci#define AB8500_PIN_GROUP(a, b) { .name = #a, .pins = a##_pins,		\
2288c2ecf20Sopenharmony_ci			.npins = ARRAY_SIZE(a##_pins), .altsetting = b }
2298c2ecf20Sopenharmony_ci
2308c2ecf20Sopenharmony_cistatic const struct abx500_pingroup ab8500_groups[] = {
2318c2ecf20Sopenharmony_ci	/* default column */
2328c2ecf20Sopenharmony_ci	AB8500_PIN_GROUP(sysclkreq2_d_1, ABX500_DEFAULT),
2338c2ecf20Sopenharmony_ci	AB8500_PIN_GROUP(sysclkreq3_d_1, ABX500_DEFAULT),
2348c2ecf20Sopenharmony_ci	AB8500_PIN_GROUP(sysclkreq4_d_1, ABX500_DEFAULT),
2358c2ecf20Sopenharmony_ci	AB8500_PIN_GROUP(sysclkreq6_d_1, ABX500_DEFAULT),
2368c2ecf20Sopenharmony_ci	AB8500_PIN_GROUP(ycbcr0123_d_1, ABX500_DEFAULT),
2378c2ecf20Sopenharmony_ci	AB8500_PIN_GROUP(gpio10_d_1, ABX500_DEFAULT),
2388c2ecf20Sopenharmony_ci	AB8500_PIN_GROUP(gpio11_d_1, ABX500_DEFAULT),
2398c2ecf20Sopenharmony_ci	AB8500_PIN_GROUP(gpio12_d_1, ABX500_DEFAULT),
2408c2ecf20Sopenharmony_ci	AB8500_PIN_GROUP(gpio13_d_1, ABX500_DEFAULT),
2418c2ecf20Sopenharmony_ci	AB8500_PIN_GROUP(pwmout1_d_1, ABX500_DEFAULT),
2428c2ecf20Sopenharmony_ci	AB8500_PIN_GROUP(pwmout2_d_1, ABX500_DEFAULT),
2438c2ecf20Sopenharmony_ci	AB8500_PIN_GROUP(pwmout3_d_1, ABX500_DEFAULT),
2448c2ecf20Sopenharmony_ci	AB8500_PIN_GROUP(adi1_d_1, ABX500_DEFAULT),
2458c2ecf20Sopenharmony_ci	AB8500_PIN_GROUP(usbuicc_d_1, ABX500_DEFAULT),
2468c2ecf20Sopenharmony_ci	AB8500_PIN_GROUP(sysclkreq7_d_1, ABX500_DEFAULT),
2478c2ecf20Sopenharmony_ci	AB8500_PIN_GROUP(sysclkreq8_d_1, ABX500_DEFAULT),
2488c2ecf20Sopenharmony_ci	AB8500_PIN_GROUP(gpio26_d_1, ABX500_DEFAULT),
2498c2ecf20Sopenharmony_ci	AB8500_PIN_GROUP(dmic12_d_1, ABX500_DEFAULT),
2508c2ecf20Sopenharmony_ci	AB8500_PIN_GROUP(dmic34_d_1, ABX500_DEFAULT),
2518c2ecf20Sopenharmony_ci	AB8500_PIN_GROUP(dmic56_d_1, ABX500_DEFAULT),
2528c2ecf20Sopenharmony_ci	AB8500_PIN_GROUP(extcpena_d_1, ABX500_DEFAULT),
2538c2ecf20Sopenharmony_ci	AB8500_PIN_GROUP(gpio35_d_1, ABX500_DEFAULT),
2548c2ecf20Sopenharmony_ci	AB8500_PIN_GROUP(apespi_d_1, ABX500_DEFAULT),
2558c2ecf20Sopenharmony_ci	AB8500_PIN_GROUP(modsclsda_d_1, ABX500_DEFAULT),
2568c2ecf20Sopenharmony_ci	AB8500_PIN_GROUP(sysclkreq5_d_1, ABX500_DEFAULT),
2578c2ecf20Sopenharmony_ci	/* Altfunction A column */
2588c2ecf20Sopenharmony_ci	AB8500_PIN_GROUP(gpio1_a_1, ABX500_ALT_A),
2598c2ecf20Sopenharmony_ci	AB8500_PIN_GROUP(gpio2_a_1, ABX500_ALT_A),
2608c2ecf20Sopenharmony_ci	AB8500_PIN_GROUP(gpio3_a_1, ABX500_ALT_A),
2618c2ecf20Sopenharmony_ci	AB8500_PIN_GROUP(gpio4_a_1, ABX500_ALT_A),
2628c2ecf20Sopenharmony_ci	AB8500_PIN_GROUP(gpio6_a_1, ABX500_ALT_A),
2638c2ecf20Sopenharmony_ci	AB8500_PIN_GROUP(gpio7_a_1, ABX500_ALT_A),
2648c2ecf20Sopenharmony_ci	AB8500_PIN_GROUP(gpio8_a_1, ABX500_ALT_A),
2658c2ecf20Sopenharmony_ci	AB8500_PIN_GROUP(gpio9_a_1, ABX500_ALT_A),
2668c2ecf20Sopenharmony_ci	AB8500_PIN_GROUP(ycbcr4567_a_1, ABX500_ALT_A),
2678c2ecf20Sopenharmony_ci	AB8500_PIN_GROUP(gpio14_a_1, ABX500_ALT_A),
2688c2ecf20Sopenharmony_ci	AB8500_PIN_GROUP(gpio15_a_1, ABX500_ALT_A),
2698c2ecf20Sopenharmony_ci	AB8500_PIN_GROUP(gpio16_a_1, ABX500_ALT_A),
2708c2ecf20Sopenharmony_ci	AB8500_PIN_GROUP(gpio17_a_1, ABX500_ALT_A),
2718c2ecf20Sopenharmony_ci	AB8500_PIN_GROUP(gpio18_a_1, ABX500_ALT_A),
2728c2ecf20Sopenharmony_ci	AB8500_PIN_GROUP(gpio19_a_1, ABX500_ALT_A),
2738c2ecf20Sopenharmony_ci	AB8500_PIN_GROUP(gpio20_a_1, ABX500_ALT_A),
2748c2ecf20Sopenharmony_ci	AB8500_PIN_GROUP(gpio21_a_1, ABX500_ALT_A),
2758c2ecf20Sopenharmony_ci	AB8500_PIN_GROUP(gpio22_a_1, ABX500_ALT_A),
2768c2ecf20Sopenharmony_ci	AB8500_PIN_GROUP(gpio23_a_1, ABX500_ALT_A),
2778c2ecf20Sopenharmony_ci	AB8500_PIN_GROUP(gpio24_a_1, ABX500_ALT_A),
2788c2ecf20Sopenharmony_ci	AB8500_PIN_GROUP(gpio25_a_1, ABX500_ALT_A),
2798c2ecf20Sopenharmony_ci	AB8500_PIN_GROUP(gpio27_a_1, ABX500_ALT_A),
2808c2ecf20Sopenharmony_ci	AB8500_PIN_GROUP(gpio28_a_1, ABX500_ALT_A),
2818c2ecf20Sopenharmony_ci	AB8500_PIN_GROUP(gpio29_a_1, ABX500_ALT_A),
2828c2ecf20Sopenharmony_ci	AB8500_PIN_GROUP(gpio30_a_1, ABX500_ALT_A),
2838c2ecf20Sopenharmony_ci	AB8500_PIN_GROUP(gpio31_a_1, ABX500_ALT_A),
2848c2ecf20Sopenharmony_ci	AB8500_PIN_GROUP(gpio32_a_1, ABX500_ALT_A),
2858c2ecf20Sopenharmony_ci	AB8500_PIN_GROUP(gpio34_a_1, ABX500_ALT_A),
2868c2ecf20Sopenharmony_ci	AB8500_PIN_GROUP(gpio36_a_1, ABX500_ALT_A),
2878c2ecf20Sopenharmony_ci	AB8500_PIN_GROUP(gpio37_a_1, ABX500_ALT_A),
2888c2ecf20Sopenharmony_ci	AB8500_PIN_GROUP(gpio38_a_1, ABX500_ALT_A),
2898c2ecf20Sopenharmony_ci	AB8500_PIN_GROUP(gpio39_a_1, ABX500_ALT_A),
2908c2ecf20Sopenharmony_ci	AB8500_PIN_GROUP(gpio40_a_1, ABX500_ALT_A),
2918c2ecf20Sopenharmony_ci	AB8500_PIN_GROUP(gpio41_a_1, ABX500_ALT_A),
2928c2ecf20Sopenharmony_ci	AB8500_PIN_GROUP(gpio42_a_1, ABX500_ALT_A),
2938c2ecf20Sopenharmony_ci	/* Altfunction B column */
2948c2ecf20Sopenharmony_ci	AB8500_PIN_GROUP(hiqclkena_b_1, ABX500_ALT_B),
2958c2ecf20Sopenharmony_ci	AB8500_PIN_GROUP(usbuiccpd_b_1, ABX500_ALT_B),
2968c2ecf20Sopenharmony_ci	AB8500_PIN_GROUP(i2ctrig1_b_1, ABX500_ALT_B),
2978c2ecf20Sopenharmony_ci	AB8500_PIN_GROUP(i2ctrig2_b_1, ABX500_ALT_B),
2988c2ecf20Sopenharmony_ci	/* Altfunction C column */
2998c2ecf20Sopenharmony_ci	AB8500_PIN_GROUP(usbvdat_c_1, ABX500_ALT_C),
3008c2ecf20Sopenharmony_ci};
3018c2ecf20Sopenharmony_ci
3028c2ecf20Sopenharmony_ci/* We use this macro to define the groups applicable to a function */
3038c2ecf20Sopenharmony_ci#define AB8500_FUNC_GROUPS(a, b...)	   \
3048c2ecf20Sopenharmony_cistatic const char * const a##_groups[] = { b };
3058c2ecf20Sopenharmony_ci
3068c2ecf20Sopenharmony_ciAB8500_FUNC_GROUPS(sysclkreq, "sysclkreq2_d_1", "sysclkreq3_d_1",
3078c2ecf20Sopenharmony_ci		"sysclkreq4_d_1", "sysclkreq5_d_1", "sysclkreq6_d_1",
3088c2ecf20Sopenharmony_ci		"sysclkreq7_d_1", "sysclkreq8_d_1");
3098c2ecf20Sopenharmony_ciAB8500_FUNC_GROUPS(ycbcr, "ycbcr0123_d_1", "ycbcr4567_a_1");
3108c2ecf20Sopenharmony_ciAB8500_FUNC_GROUPS(gpio, "gpio1_a_1", "gpio2_a_1", "gpio3_a_1", "gpio4_a_1",
3118c2ecf20Sopenharmony_ci		"gpio6_a_1", "gpio7_a_1", "gpio8_a_1", "gpio9_a_1",
3128c2ecf20Sopenharmony_ci		"gpio10_d_1", "gpio11_d_1", "gpio12_d_1", "gpio13_d_1",
3138c2ecf20Sopenharmony_ci		"gpio14_a_1", "gpio15_a_1", "gpio16_a_1", "gpio17_a_1",
3148c2ecf20Sopenharmony_ci		"gpio18_a_1", "gpio19_a_1", "gpio20_a_1", "gpio21_a_1",
3158c2ecf20Sopenharmony_ci		"gpio22_a_1", "gpio23_a_1", "gpio24_a_1", "gpio25_a_1",
3168c2ecf20Sopenharmony_ci		"gpio26_d_1", "gpio27_a_1", "gpio28_a_1", "gpio29_a_1",
3178c2ecf20Sopenharmony_ci		"gpio30_a_1", "gpio31_a_1", "gpio32_a_1", "gpio34_a_1",
3188c2ecf20Sopenharmony_ci		"gpio35_d_1", "gpio36_a_1", "gpio37_a_1", "gpio38_a_1",
3198c2ecf20Sopenharmony_ci		"gpio39_a_1", "gpio40_a_1", "gpio41_a_1", "gpio42_a_1");
3208c2ecf20Sopenharmony_ciAB8500_FUNC_GROUPS(pwmout, "pwmout1_d_1", "pwmout2_d_1", "pwmout3_d_1");
3218c2ecf20Sopenharmony_ciAB8500_FUNC_GROUPS(adi1, "adi1_d_1");
3228c2ecf20Sopenharmony_ciAB8500_FUNC_GROUPS(usbuicc, "usbuicc_d_1", "usbuiccpd_b_1");
3238c2ecf20Sopenharmony_ciAB8500_FUNC_GROUPS(dmic, "dmic12_d_1", "dmic34_d_1", "dmic56_d_1");
3248c2ecf20Sopenharmony_ciAB8500_FUNC_GROUPS(extcpena, "extcpena_d_1");
3258c2ecf20Sopenharmony_ciAB8500_FUNC_GROUPS(apespi, "apespi_d_1");
3268c2ecf20Sopenharmony_ciAB8500_FUNC_GROUPS(modsclsda, "modsclsda_d_1");
3278c2ecf20Sopenharmony_ciAB8500_FUNC_GROUPS(hiqclkena, "hiqclkena_b_1");
3288c2ecf20Sopenharmony_ciAB8500_FUNC_GROUPS(i2ctrig, "i2ctrig1_b_1", "i2ctrig2_b_1");
3298c2ecf20Sopenharmony_ciAB8500_FUNC_GROUPS(usbvdat, "usbvdat_c_1");
3308c2ecf20Sopenharmony_ci
3318c2ecf20Sopenharmony_ci#define FUNCTION(fname)					\
3328c2ecf20Sopenharmony_ci	{						\
3338c2ecf20Sopenharmony_ci		.name = #fname,				\
3348c2ecf20Sopenharmony_ci		.groups = fname##_groups,		\
3358c2ecf20Sopenharmony_ci		.ngroups = ARRAY_SIZE(fname##_groups),	\
3368c2ecf20Sopenharmony_ci	}
3378c2ecf20Sopenharmony_ci
3388c2ecf20Sopenharmony_cistatic const struct abx500_function ab8500_functions[] = {
3398c2ecf20Sopenharmony_ci	FUNCTION(sysclkreq),
3408c2ecf20Sopenharmony_ci	FUNCTION(ycbcr),
3418c2ecf20Sopenharmony_ci	FUNCTION(gpio),
3428c2ecf20Sopenharmony_ci	FUNCTION(pwmout),
3438c2ecf20Sopenharmony_ci	FUNCTION(adi1),
3448c2ecf20Sopenharmony_ci	FUNCTION(usbuicc),
3458c2ecf20Sopenharmony_ci	FUNCTION(dmic),
3468c2ecf20Sopenharmony_ci	FUNCTION(extcpena),
3478c2ecf20Sopenharmony_ci	FUNCTION(apespi),
3488c2ecf20Sopenharmony_ci	FUNCTION(modsclsda),
3498c2ecf20Sopenharmony_ci	FUNCTION(hiqclkena),
3508c2ecf20Sopenharmony_ci	FUNCTION(i2ctrig),
3518c2ecf20Sopenharmony_ci	FUNCTION(usbvdat),
3528c2ecf20Sopenharmony_ci};
3538c2ecf20Sopenharmony_ci
3548c2ecf20Sopenharmony_ci/*
3558c2ecf20Sopenharmony_ci * this table translates what's is in the AB8500 specification regarding the
3568c2ecf20Sopenharmony_ci * balls alternate functions (as for DB, default, ALT_A, ALT_B and ALT_C).
3578c2ecf20Sopenharmony_ci * ALTERNATE_FUNCTIONS(GPIO_NUMBER, GPIOSEL bit, ALTERNATFUNC bit1,
3588c2ecf20Sopenharmony_ci * ALTERNATEFUNC bit2, ALTA val, ALTB val, ALTC val),
3598c2ecf20Sopenharmony_ci *
3608c2ecf20Sopenharmony_ci * example :
3618c2ecf20Sopenharmony_ci *
3628c2ecf20Sopenharmony_ci *	ALTERNATE_FUNCTIONS(13,     4,      3,      4, 0, 1 ,2),
3638c2ecf20Sopenharmony_ci *	means that pin AB8500_PIN_W17 (pin 13) supports 4 mux (default/ALT_A,
3648c2ecf20Sopenharmony_ci *	ALT_B and ALT_C), so GPIOSEL and ALTERNATFUNC registers are used to
3658c2ecf20Sopenharmony_ci *	select the mux.  ALTA, ALTB and ALTC val indicates values to write in
3668c2ecf20Sopenharmony_ci *	ALTERNATFUNC register. We need to specifies these values as SOC
3678c2ecf20Sopenharmony_ci *	designers didn't apply the same logic on how to select mux in the
3688c2ecf20Sopenharmony_ci *	ABx500 family.
3698c2ecf20Sopenharmony_ci *
3708c2ecf20Sopenharmony_ci *	As this pins supports at least ALT_B mux, default mux is
3718c2ecf20Sopenharmony_ci *	selected by writing 1 in GPIOSEL bit :
3728c2ecf20Sopenharmony_ci *
3738c2ecf20Sopenharmony_ci *		| GPIOSEL bit=4 | alternatfunc bit2=4 | alternatfunc bit1=3
3748c2ecf20Sopenharmony_ci *	default	|       1       |          0          |          0
3758c2ecf20Sopenharmony_ci *	alt_A	|       0       |          0          |          0
3768c2ecf20Sopenharmony_ci *	alt_B	|       0       |          0          |          1
3778c2ecf20Sopenharmony_ci *	alt_C	|       0       |          1          |          0
3788c2ecf20Sopenharmony_ci *
3798c2ecf20Sopenharmony_ci *	ALTERNATE_FUNCTIONS(8,      7, UNUSED, UNUSED),
3808c2ecf20Sopenharmony_ci *	means that pin AB8500_PIN_W18 (pin 8) supports 2 mux, so only GPIOSEL
3818c2ecf20Sopenharmony_ci *	register is used to select the mux. As this pins doesn't support at
3828c2ecf20Sopenharmony_ci *	least ALT_B mux, default mux is by writing 0 in GPIOSEL bit :
3838c2ecf20Sopenharmony_ci *
3848c2ecf20Sopenharmony_ci *		| GPIOSEL bit=7 | alternatfunc bit2=  | alternatfunc bit1=
3858c2ecf20Sopenharmony_ci *	default	|       0       |          0          |          0
3868c2ecf20Sopenharmony_ci *	alt_A	|       1       |          0          |          0
3878c2ecf20Sopenharmony_ci */
3888c2ecf20Sopenharmony_ci
3898c2ecf20Sopenharmony_cistatic struct
3908c2ecf20Sopenharmony_cialternate_functions ab8500_alternate_functions[AB8500_GPIO_MAX_NUMBER + 1] = {
3918c2ecf20Sopenharmony_ci	ALTERNATE_FUNCTIONS(0, UNUSED, UNUSED, UNUSED, 0, 0, 0), /* no GPIO0 */
3928c2ecf20Sopenharmony_ci	ALTERNATE_FUNCTIONS(1,	    0, UNUSED, UNUSED, 0, 0, 0), /* GPIO1, altA controlled by bit 0 */
3938c2ecf20Sopenharmony_ci	ALTERNATE_FUNCTIONS(2,      1, UNUSED, UNUSED, 0, 0, 0), /* GPIO2, altA controlled by bit 1 */
3948c2ecf20Sopenharmony_ci	ALTERNATE_FUNCTIONS(3,      2, UNUSED, UNUSED, 0, 0, 0), /* GPIO3, altA controlled by bit 2*/
3958c2ecf20Sopenharmony_ci	ALTERNATE_FUNCTIONS(4,      3, UNUSED, UNUSED, 0, 0, 0), /* GPIO4, altA controlled by bit 3*/
3968c2ecf20Sopenharmony_ci	/* bit 4 reserved */
3978c2ecf20Sopenharmony_ci	ALTERNATE_FUNCTIONS(5, UNUSED, UNUSED, UNUSED, 0, 0, 0), /* no GPIO5 */
3988c2ecf20Sopenharmony_ci	ALTERNATE_FUNCTIONS(6,      5, UNUSED, UNUSED, 0, 0, 0), /* GPIO6, altA controlled by bit 5*/
3998c2ecf20Sopenharmony_ci	ALTERNATE_FUNCTIONS(7,      6, UNUSED, UNUSED, 0, 0, 0), /* GPIO7, altA controlled by bit 6*/
4008c2ecf20Sopenharmony_ci	ALTERNATE_FUNCTIONS(8,      7, UNUSED, UNUSED, 0, 0, 0), /* GPIO8, altA controlled by bit 7*/
4018c2ecf20Sopenharmony_ci
4028c2ecf20Sopenharmony_ci	ALTERNATE_FUNCTIONS(9,      0, UNUSED, UNUSED, 0, 0, 0), /* GPIO9, altA controlled by bit 0*/
4038c2ecf20Sopenharmony_ci	ALTERNATE_FUNCTIONS(10,     1,      0, UNUSED, 0, 1, 0), /* GPIO10, altA and altB controlled by bit 0 */
4048c2ecf20Sopenharmony_ci	ALTERNATE_FUNCTIONS(11,     2,      1, UNUSED, 0, 1, 0), /* GPIO11, altA and altB controlled by bit 1 */
4058c2ecf20Sopenharmony_ci	ALTERNATE_FUNCTIONS(12,     3,      2, UNUSED, 0, 1, 0), /* GPIO12, altA and altB controlled by bit 2 */
4068c2ecf20Sopenharmony_ci	ALTERNATE_FUNCTIONS(13,     4,      3,      4, 0, 1, 2), /* GPIO13, altA altB and altC controlled by bit 3 and 4 */
4078c2ecf20Sopenharmony_ci	ALTERNATE_FUNCTIONS(14,     5, UNUSED, UNUSED, 0, 0, 0), /* GPIO14, altA controlled by bit 5 */
4088c2ecf20Sopenharmony_ci	ALTERNATE_FUNCTIONS(15,     6, UNUSED, UNUSED, 0, 0, 0), /* GPIO15, altA controlled by bit 6 */
4098c2ecf20Sopenharmony_ci	ALTERNATE_FUNCTIONS(16,     7, UNUSED, UNUSED, 0, 0, 0), /* GPIO16, altA controlled by bit 7 */
4108c2ecf20Sopenharmony_ci	/*
4118c2ecf20Sopenharmony_ci	 * pins 17 to 20 are special case, only bit 0 is used to select
4128c2ecf20Sopenharmony_ci	 * alternate function for these 4 pins.
4138c2ecf20Sopenharmony_ci	 * bits 1 to 3 are reserved
4148c2ecf20Sopenharmony_ci	 */
4158c2ecf20Sopenharmony_ci	ALTERNATE_FUNCTIONS(17,      0, UNUSED, UNUSED, 0, 0, 0), /* GPIO17, altA controlled by bit 0 */
4168c2ecf20Sopenharmony_ci	ALTERNATE_FUNCTIONS(18,      0, UNUSED, UNUSED, 0, 0, 0), /* GPIO18, altA controlled by bit 0 */
4178c2ecf20Sopenharmony_ci	ALTERNATE_FUNCTIONS(19,      0, UNUSED, UNUSED, 0, 0, 0), /* GPIO19, altA controlled by bit 0 */
4188c2ecf20Sopenharmony_ci	ALTERNATE_FUNCTIONS(20,      0, UNUSED, UNUSED, 0, 0, 0), /* GPIO20, altA controlled by bit 0 */
4198c2ecf20Sopenharmony_ci	ALTERNATE_FUNCTIONS(21,      4, UNUSED, UNUSED, 0, 0, 0), /* GPIO21, altA controlled by bit 4 */
4208c2ecf20Sopenharmony_ci	ALTERNATE_FUNCTIONS(22,      5, UNUSED, UNUSED, 0, 0, 0), /* GPIO22, altA controlled by bit 5 */
4218c2ecf20Sopenharmony_ci	ALTERNATE_FUNCTIONS(23,      6, UNUSED, UNUSED, 0, 0, 0), /* GPIO23, altA controlled by bit 6 */
4228c2ecf20Sopenharmony_ci	ALTERNATE_FUNCTIONS(24,      7, UNUSED, UNUSED, 0, 0, 0), /* GPIO24, altA controlled by bit 7 */
4238c2ecf20Sopenharmony_ci
4248c2ecf20Sopenharmony_ci	ALTERNATE_FUNCTIONS(25,      0, UNUSED, UNUSED, 0, 0, 0), /* GPIO25, altA controlled by bit 0 */
4258c2ecf20Sopenharmony_ci	/* pin 26 special case, no alternate function, bit 1 reserved */
4268c2ecf20Sopenharmony_ci	ALTERNATE_FUNCTIONS(26, UNUSED, UNUSED, UNUSED, 0, 0, 0), /* GPIO26 */
4278c2ecf20Sopenharmony_ci	ALTERNATE_FUNCTIONS(27,      2, UNUSED, UNUSED, 0, 0, 0), /* GPIO27, altA controlled by bit 2 */
4288c2ecf20Sopenharmony_ci	ALTERNATE_FUNCTIONS(28,      3, UNUSED, UNUSED, 0, 0, 0), /* GPIO28, altA controlled by bit 3 */
4298c2ecf20Sopenharmony_ci	ALTERNATE_FUNCTIONS(29,      4, UNUSED, UNUSED, 0, 0, 0), /* GPIO29, altA controlled by bit 4 */
4308c2ecf20Sopenharmony_ci	ALTERNATE_FUNCTIONS(30,      5, UNUSED, UNUSED, 0, 0, 0), /* GPIO30, altA controlled by bit 5 */
4318c2ecf20Sopenharmony_ci	ALTERNATE_FUNCTIONS(31,      6, UNUSED, UNUSED, 0, 0, 0), /* GPIO31, altA controlled by bit 6 */
4328c2ecf20Sopenharmony_ci	ALTERNATE_FUNCTIONS(32,      7, UNUSED, UNUSED, 0, 0, 0), /* GPIO32, altA controlled by bit 7 */
4338c2ecf20Sopenharmony_ci
4348c2ecf20Sopenharmony_ci	ALTERNATE_FUNCTIONS(33, UNUSED, UNUSED, UNUSED, 0, 0, 0), /* no GPIO33 */
4358c2ecf20Sopenharmony_ci	ALTERNATE_FUNCTIONS(34,      1, UNUSED, UNUSED, 0, 0, 0), /* GPIO34, altA controlled by bit 1 */
4368c2ecf20Sopenharmony_ci	/* pin 35 special case, no alternate function, bit 2 reserved */
4378c2ecf20Sopenharmony_ci	ALTERNATE_FUNCTIONS(35, UNUSED, UNUSED, UNUSED, 0, 0, 0), /* GPIO35 */
4388c2ecf20Sopenharmony_ci	ALTERNATE_FUNCTIONS(36,      3, UNUSED, UNUSED, 0, 0, 0), /* GPIO36, altA controlled by bit 3 */
4398c2ecf20Sopenharmony_ci	ALTERNATE_FUNCTIONS(37,      4, UNUSED, UNUSED, 0, 0, 0), /* GPIO37, altA controlled by bit 4 */
4408c2ecf20Sopenharmony_ci	ALTERNATE_FUNCTIONS(38,      5, UNUSED, UNUSED, 0, 0, 0), /* GPIO38, altA controlled by bit 5 */
4418c2ecf20Sopenharmony_ci	ALTERNATE_FUNCTIONS(39,      6, UNUSED, UNUSED, 0, 0, 0), /* GPIO39, altA controlled by bit 6 */
4428c2ecf20Sopenharmony_ci	ALTERNATE_FUNCTIONS(40,      7, UNUSED, UNUSED, 0, 0, 0), /* GPIO40, altA controlled by bit 7 */
4438c2ecf20Sopenharmony_ci
4448c2ecf20Sopenharmony_ci	ALTERNATE_FUNCTIONS(41,      0, UNUSED, UNUSED, 0, 0, 0), /* GPIO41, altA controlled by bit 0 */
4458c2ecf20Sopenharmony_ci	ALTERNATE_FUNCTIONS(42,      1, UNUSED, UNUSED, 0, 0, 0), /* GPIO42, altA controlled by bit 1 */
4468c2ecf20Sopenharmony_ci};
4478c2ecf20Sopenharmony_ci
4488c2ecf20Sopenharmony_ci/*
4498c2ecf20Sopenharmony_ci * Only some GPIOs are interrupt capable, and they are
4508c2ecf20Sopenharmony_ci * organized in discontiguous clusters:
4518c2ecf20Sopenharmony_ci *
4528c2ecf20Sopenharmony_ci *	GPIO6 to GPIO13
4538c2ecf20Sopenharmony_ci *	GPIO24 and GPIO25
4548c2ecf20Sopenharmony_ci *	GPIO36 to GPIO41
4558c2ecf20Sopenharmony_ci */
4568c2ecf20Sopenharmony_cistatic struct abx500_gpio_irq_cluster ab8500_gpio_irq_cluster[] = {
4578c2ecf20Sopenharmony_ci	GPIO_IRQ_CLUSTER(6,  13, AB8500_INT_GPIO6R),
4588c2ecf20Sopenharmony_ci	GPIO_IRQ_CLUSTER(24, 25, AB8500_INT_GPIO24R),
4598c2ecf20Sopenharmony_ci	GPIO_IRQ_CLUSTER(36, 41, AB8500_INT_GPIO36R),
4608c2ecf20Sopenharmony_ci};
4618c2ecf20Sopenharmony_ci
4628c2ecf20Sopenharmony_cistatic struct abx500_pinctrl_soc_data ab8500_soc = {
4638c2ecf20Sopenharmony_ci	.gpio_ranges = ab8500_pinranges,
4648c2ecf20Sopenharmony_ci	.gpio_num_ranges = ARRAY_SIZE(ab8500_pinranges),
4658c2ecf20Sopenharmony_ci	.pins = ab8500_pins,
4668c2ecf20Sopenharmony_ci	.npins = ARRAY_SIZE(ab8500_pins),
4678c2ecf20Sopenharmony_ci	.functions = ab8500_functions,
4688c2ecf20Sopenharmony_ci	.nfunctions = ARRAY_SIZE(ab8500_functions),
4698c2ecf20Sopenharmony_ci	.groups = ab8500_groups,
4708c2ecf20Sopenharmony_ci	.ngroups = ARRAY_SIZE(ab8500_groups),
4718c2ecf20Sopenharmony_ci	.alternate_functions = ab8500_alternate_functions,
4728c2ecf20Sopenharmony_ci	.gpio_irq_cluster = ab8500_gpio_irq_cluster,
4738c2ecf20Sopenharmony_ci	.ngpio_irq_cluster = ARRAY_SIZE(ab8500_gpio_irq_cluster),
4748c2ecf20Sopenharmony_ci	.irq_gpio_rising_offset = AB8500_INT_GPIO6R,
4758c2ecf20Sopenharmony_ci	.irq_gpio_falling_offset = AB8500_INT_GPIO6F,
4768c2ecf20Sopenharmony_ci	.irq_gpio_factor = 1,
4778c2ecf20Sopenharmony_ci};
4788c2ecf20Sopenharmony_ci
4798c2ecf20Sopenharmony_civoid abx500_pinctrl_ab8500_init(struct abx500_pinctrl_soc_data **soc)
4808c2ecf20Sopenharmony_ci{
4818c2ecf20Sopenharmony_ci	*soc = &ab8500_soc;
4828c2ecf20Sopenharmony_ci}
483