162306a36Sopenharmony_ci// SPDX-License-Identifier: GPL-2.0-only
262306a36Sopenharmony_ci/*
362306a36Sopenharmony_ci * Copyright (C) ST-Ericsson SA 2012
462306a36Sopenharmony_ci *
562306a36Sopenharmony_ci * Author: Patrice Chotard <patrice.chotard@stericsson.com> for ST-Ericsson.
662306a36Sopenharmony_ci */
762306a36Sopenharmony_ci
862306a36Sopenharmony_ci#include <linux/kernel.h>
962306a36Sopenharmony_ci#include <linux/pinctrl/pinctrl.h>
1062306a36Sopenharmony_ci
1162306a36Sopenharmony_ci#include <linux/mfd/abx500/ab8500.h>
1262306a36Sopenharmony_ci
1362306a36Sopenharmony_ci#include "pinctrl-abx500.h"
1462306a36Sopenharmony_ci
1562306a36Sopenharmony_ci/* All the pins that can be used for GPIO and some other functions */
1662306a36Sopenharmony_ci#define ABX500_GPIO(offset)		(offset)
1762306a36Sopenharmony_ci
1862306a36Sopenharmony_ci#define AB8500_PIN_T10		ABX500_GPIO(1)
1962306a36Sopenharmony_ci#define AB8500_PIN_T9		ABX500_GPIO(2)
2062306a36Sopenharmony_ci#define AB8500_PIN_U9		ABX500_GPIO(3)
2162306a36Sopenharmony_ci#define AB8500_PIN_W2		ABX500_GPIO(4)
2262306a36Sopenharmony_ci/* hole */
2362306a36Sopenharmony_ci#define AB8500_PIN_Y18		ABX500_GPIO(6)
2462306a36Sopenharmony_ci#define AB8500_PIN_AA20		ABX500_GPIO(7)
2562306a36Sopenharmony_ci#define AB8500_PIN_W18		ABX500_GPIO(8)
2662306a36Sopenharmony_ci#define AB8500_PIN_AA19		ABX500_GPIO(9)
2762306a36Sopenharmony_ci#define AB8500_PIN_U17		ABX500_GPIO(10)
2862306a36Sopenharmony_ci#define AB8500_PIN_AA18		ABX500_GPIO(11)
2962306a36Sopenharmony_ci#define AB8500_PIN_U16		ABX500_GPIO(12)
3062306a36Sopenharmony_ci#define AB8500_PIN_W17		ABX500_GPIO(13)
3162306a36Sopenharmony_ci#define AB8500_PIN_F14		ABX500_GPIO(14)
3262306a36Sopenharmony_ci#define AB8500_PIN_B17		ABX500_GPIO(15)
3362306a36Sopenharmony_ci#define AB8500_PIN_F15		ABX500_GPIO(16)
3462306a36Sopenharmony_ci#define AB8500_PIN_P5		ABX500_GPIO(17)
3562306a36Sopenharmony_ci#define AB8500_PIN_R5		ABX500_GPIO(18)
3662306a36Sopenharmony_ci#define AB8500_PIN_U5		ABX500_GPIO(19)
3762306a36Sopenharmony_ci#define AB8500_PIN_T5		ABX500_GPIO(20)
3862306a36Sopenharmony_ci#define AB8500_PIN_H19		ABX500_GPIO(21)
3962306a36Sopenharmony_ci#define AB8500_PIN_G20		ABX500_GPIO(22)
4062306a36Sopenharmony_ci#define AB8500_PIN_G19		ABX500_GPIO(23)
4162306a36Sopenharmony_ci#define AB8500_PIN_T14		ABX500_GPIO(24)
4262306a36Sopenharmony_ci#define AB8500_PIN_R16		ABX500_GPIO(25)
4362306a36Sopenharmony_ci#define AB8500_PIN_M16		ABX500_GPIO(26)
4462306a36Sopenharmony_ci#define AB8500_PIN_J6		ABX500_GPIO(27)
4562306a36Sopenharmony_ci#define AB8500_PIN_K6		ABX500_GPIO(28)
4662306a36Sopenharmony_ci#define AB8500_PIN_G6		ABX500_GPIO(29)
4762306a36Sopenharmony_ci#define AB8500_PIN_H6		ABX500_GPIO(30)
4862306a36Sopenharmony_ci#define AB8500_PIN_F5		ABX500_GPIO(31)
4962306a36Sopenharmony_ci#define AB8500_PIN_G5		ABX500_GPIO(32)
5062306a36Sopenharmony_ci/* hole */
5162306a36Sopenharmony_ci#define AB8500_PIN_R17		ABX500_GPIO(34)
5262306a36Sopenharmony_ci#define AB8500_PIN_W15		ABX500_GPIO(35)
5362306a36Sopenharmony_ci#define AB8500_PIN_A17		ABX500_GPIO(36)
5462306a36Sopenharmony_ci#define AB8500_PIN_E15		ABX500_GPIO(37)
5562306a36Sopenharmony_ci#define AB8500_PIN_C17		ABX500_GPIO(38)
5662306a36Sopenharmony_ci#define AB8500_PIN_E16		ABX500_GPIO(39)
5762306a36Sopenharmony_ci#define AB8500_PIN_T19		ABX500_GPIO(40)
5862306a36Sopenharmony_ci#define AB8500_PIN_U19		ABX500_GPIO(41)
5962306a36Sopenharmony_ci#define AB8500_PIN_U2		ABX500_GPIO(42)
6062306a36Sopenharmony_ci
6162306a36Sopenharmony_ci/* indicates the highest GPIO number */
6262306a36Sopenharmony_ci#define AB8500_GPIO_MAX_NUMBER	42
6362306a36Sopenharmony_ci
6462306a36Sopenharmony_ci/*
6562306a36Sopenharmony_ci * The names of the pins are denoted by GPIO number and ball name, even
6662306a36Sopenharmony_ci * though they can be used for other things than GPIO, this is the first
6762306a36Sopenharmony_ci * column in the table of the data sheet and often used on schematics and
6862306a36Sopenharmony_ci * such.
6962306a36Sopenharmony_ci */
7062306a36Sopenharmony_cistatic const struct pinctrl_pin_desc ab8500_pins[] = {
7162306a36Sopenharmony_ci	PINCTRL_PIN(AB8500_PIN_T10, "GPIO1_T10"),
7262306a36Sopenharmony_ci	PINCTRL_PIN(AB8500_PIN_T9, "GPIO2_T9"),
7362306a36Sopenharmony_ci	PINCTRL_PIN(AB8500_PIN_U9, "GPIO3_U9"),
7462306a36Sopenharmony_ci	PINCTRL_PIN(AB8500_PIN_W2, "GPIO4_W2"),
7562306a36Sopenharmony_ci	/* hole */
7662306a36Sopenharmony_ci	PINCTRL_PIN(AB8500_PIN_Y18, "GPIO6_Y18"),
7762306a36Sopenharmony_ci	PINCTRL_PIN(AB8500_PIN_AA20, "GPIO7_AA20"),
7862306a36Sopenharmony_ci	PINCTRL_PIN(AB8500_PIN_W18, "GPIO8_W18"),
7962306a36Sopenharmony_ci	PINCTRL_PIN(AB8500_PIN_AA19, "GPIO9_AA19"),
8062306a36Sopenharmony_ci	PINCTRL_PIN(AB8500_PIN_U17, "GPIO10_U17"),
8162306a36Sopenharmony_ci	PINCTRL_PIN(AB8500_PIN_AA18, "GPIO11_AA18"),
8262306a36Sopenharmony_ci	PINCTRL_PIN(AB8500_PIN_U16, "GPIO12_U16"),
8362306a36Sopenharmony_ci	PINCTRL_PIN(AB8500_PIN_W17, "GPIO13_W17"),
8462306a36Sopenharmony_ci	PINCTRL_PIN(AB8500_PIN_F14, "GPIO14_F14"),
8562306a36Sopenharmony_ci	PINCTRL_PIN(AB8500_PIN_B17, "GPIO15_B17"),
8662306a36Sopenharmony_ci	PINCTRL_PIN(AB8500_PIN_F15, "GPIO16_F15"),
8762306a36Sopenharmony_ci	PINCTRL_PIN(AB8500_PIN_P5, "GPIO17_P5"),
8862306a36Sopenharmony_ci	PINCTRL_PIN(AB8500_PIN_R5, "GPIO18_R5"),
8962306a36Sopenharmony_ci	PINCTRL_PIN(AB8500_PIN_U5, "GPIO19_U5"),
9062306a36Sopenharmony_ci	PINCTRL_PIN(AB8500_PIN_T5, "GPIO20_T5"),
9162306a36Sopenharmony_ci	PINCTRL_PIN(AB8500_PIN_H19, "GPIO21_H19"),
9262306a36Sopenharmony_ci	PINCTRL_PIN(AB8500_PIN_G20, "GPIO22_G20"),
9362306a36Sopenharmony_ci	PINCTRL_PIN(AB8500_PIN_G19, "GPIO23_G19"),
9462306a36Sopenharmony_ci	PINCTRL_PIN(AB8500_PIN_T14, "GPIO24_T14"),
9562306a36Sopenharmony_ci	PINCTRL_PIN(AB8500_PIN_R16, "GPIO25_R16"),
9662306a36Sopenharmony_ci	PINCTRL_PIN(AB8500_PIN_M16, "GPIO26_M16"),
9762306a36Sopenharmony_ci	PINCTRL_PIN(AB8500_PIN_J6, "GPIO27_J6"),
9862306a36Sopenharmony_ci	PINCTRL_PIN(AB8500_PIN_K6, "GPIO28_K6"),
9962306a36Sopenharmony_ci	PINCTRL_PIN(AB8500_PIN_G6, "GPIO29_G6"),
10062306a36Sopenharmony_ci	PINCTRL_PIN(AB8500_PIN_H6, "GPIO30_H6"),
10162306a36Sopenharmony_ci	PINCTRL_PIN(AB8500_PIN_F5, "GPIO31_F5"),
10262306a36Sopenharmony_ci	PINCTRL_PIN(AB8500_PIN_G5, "GPIO32_G5"),
10362306a36Sopenharmony_ci	/* hole */
10462306a36Sopenharmony_ci	PINCTRL_PIN(AB8500_PIN_R17, "GPIO34_R17"),
10562306a36Sopenharmony_ci	PINCTRL_PIN(AB8500_PIN_W15, "GPIO35_W15"),
10662306a36Sopenharmony_ci	PINCTRL_PIN(AB8500_PIN_A17, "GPIO36_A17"),
10762306a36Sopenharmony_ci	PINCTRL_PIN(AB8500_PIN_E15, "GPIO37_E15"),
10862306a36Sopenharmony_ci	PINCTRL_PIN(AB8500_PIN_C17, "GPIO38_C17"),
10962306a36Sopenharmony_ci	PINCTRL_PIN(AB8500_PIN_E16, "GPIO39_E16"),
11062306a36Sopenharmony_ci	PINCTRL_PIN(AB8500_PIN_T19, "GPIO40_T19"),
11162306a36Sopenharmony_ci	PINCTRL_PIN(AB8500_PIN_U19, "GPIO41_U19"),
11262306a36Sopenharmony_ci	PINCTRL_PIN(AB8500_PIN_U2, "GPIO42_U2"),
11362306a36Sopenharmony_ci};
11462306a36Sopenharmony_ci
11562306a36Sopenharmony_ci/*
11662306a36Sopenharmony_ci * Maps local GPIO offsets to local pin numbers
11762306a36Sopenharmony_ci */
11862306a36Sopenharmony_cistatic const struct abx500_pinrange ab8500_pinranges[] = {
11962306a36Sopenharmony_ci	ABX500_PINRANGE(1, 4, ABX500_ALT_A),
12062306a36Sopenharmony_ci	ABX500_PINRANGE(6, 4, ABX500_ALT_A),
12162306a36Sopenharmony_ci	ABX500_PINRANGE(10, 4, ABX500_DEFAULT),
12262306a36Sopenharmony_ci	ABX500_PINRANGE(14, 12, ABX500_ALT_A),
12362306a36Sopenharmony_ci	ABX500_PINRANGE(26, 1, ABX500_DEFAULT),
12462306a36Sopenharmony_ci	ABX500_PINRANGE(27, 6, ABX500_ALT_A),
12562306a36Sopenharmony_ci	ABX500_PINRANGE(34, 1, ABX500_ALT_A),
12662306a36Sopenharmony_ci	ABX500_PINRANGE(35, 1, ABX500_DEFAULT),
12762306a36Sopenharmony_ci	ABX500_PINRANGE(36, 7, ABX500_ALT_A),
12862306a36Sopenharmony_ci};
12962306a36Sopenharmony_ci
13062306a36Sopenharmony_ci/*
13162306a36Sopenharmony_ci * Read the pin group names like this:
13262306a36Sopenharmony_ci * sysclkreq2_d_1 = first groups of pins for sysclkreq2 on default function
13362306a36Sopenharmony_ci *
13462306a36Sopenharmony_ci * The groups are arranged as sets per altfunction column, so we can
13562306a36Sopenharmony_ci * mux in one group at a time by selecting the same altfunction for them
13662306a36Sopenharmony_ci * all. When functions require pins on different altfunctions, you need
13762306a36Sopenharmony_ci * to combine several groups.
13862306a36Sopenharmony_ci */
13962306a36Sopenharmony_ci
14062306a36Sopenharmony_ci/* default column */
14162306a36Sopenharmony_cistatic const unsigned sysclkreq2_d_1_pins[] = { AB8500_PIN_T10 };
14262306a36Sopenharmony_cistatic const unsigned sysclkreq3_d_1_pins[] = { AB8500_PIN_T9 };
14362306a36Sopenharmony_cistatic const unsigned sysclkreq4_d_1_pins[] = { AB8500_PIN_U9 };
14462306a36Sopenharmony_cistatic const unsigned sysclkreq6_d_1_pins[] = { AB8500_PIN_W2 };
14562306a36Sopenharmony_cistatic const unsigned ycbcr0123_d_1_pins[] = { AB8500_PIN_Y18, AB8500_PIN_AA20,
14662306a36Sopenharmony_ci					AB8500_PIN_W18, AB8500_PIN_AA19};
14762306a36Sopenharmony_cistatic const unsigned gpio10_d_1_pins[] = { AB8500_PIN_U17 };
14862306a36Sopenharmony_cistatic const unsigned gpio11_d_1_pins[] = { AB8500_PIN_AA18 };
14962306a36Sopenharmony_cistatic const unsigned gpio12_d_1_pins[] = { AB8500_PIN_U16 };
15062306a36Sopenharmony_cistatic const unsigned gpio13_d_1_pins[] = { AB8500_PIN_W17 };
15162306a36Sopenharmony_cistatic const unsigned pwmout1_d_1_pins[] = { AB8500_PIN_F14 };
15262306a36Sopenharmony_cistatic const unsigned pwmout2_d_1_pins[] = { AB8500_PIN_B17 };
15362306a36Sopenharmony_cistatic const unsigned pwmout3_d_1_pins[] = { AB8500_PIN_F15 };
15462306a36Sopenharmony_ci
15562306a36Sopenharmony_ci/* audio data interface 1*/
15662306a36Sopenharmony_cistatic const unsigned adi1_d_1_pins[] = { AB8500_PIN_P5, AB8500_PIN_R5,
15762306a36Sopenharmony_ci					AB8500_PIN_U5, AB8500_PIN_T5 };
15862306a36Sopenharmony_ci/* USBUICC */
15962306a36Sopenharmony_cistatic const unsigned usbuicc_d_1_pins[] = { AB8500_PIN_H19, AB8500_PIN_G20,
16062306a36Sopenharmony_ci					AB8500_PIN_G19 };
16162306a36Sopenharmony_cistatic const unsigned sysclkreq7_d_1_pins[] = { AB8500_PIN_T14 };
16262306a36Sopenharmony_cistatic const unsigned sysclkreq8_d_1_pins[] = { AB8500_PIN_R16 };
16362306a36Sopenharmony_cistatic const unsigned gpio26_d_1_pins[] = { AB8500_PIN_M16 };
16462306a36Sopenharmony_ci/* Digital microphone 1 and 2 */
16562306a36Sopenharmony_cistatic const unsigned dmic12_d_1_pins[] = { AB8500_PIN_J6, AB8500_PIN_K6 };
16662306a36Sopenharmony_ci/* Digital microphone 3 and 4 */
16762306a36Sopenharmony_cistatic const unsigned dmic34_d_1_pins[] = { AB8500_PIN_G6, AB8500_PIN_H6 };
16862306a36Sopenharmony_ci/* Digital microphone 5 and 6 */
16962306a36Sopenharmony_cistatic const unsigned dmic56_d_1_pins[] = { AB8500_PIN_F5, AB8500_PIN_G5 };
17062306a36Sopenharmony_cistatic const unsigned extcpena_d_1_pins[] = { AB8500_PIN_R17 };
17162306a36Sopenharmony_cistatic const unsigned gpio35_d_1_pins[] = { AB8500_PIN_W15 };
17262306a36Sopenharmony_ci/* APE SPI */
17362306a36Sopenharmony_cistatic const unsigned apespi_d_1_pins[] = { AB8500_PIN_A17, AB8500_PIN_E15,
17462306a36Sopenharmony_ci					AB8500_PIN_C17, AB8500_PIN_E16};
17562306a36Sopenharmony_ci/* modem SDA/SCL */
17662306a36Sopenharmony_cistatic const unsigned modsclsda_d_1_pins[] = { AB8500_PIN_T19, AB8500_PIN_U19 };
17762306a36Sopenharmony_cistatic const unsigned sysclkreq5_d_1_pins[] = { AB8500_PIN_U2 };
17862306a36Sopenharmony_ci
17962306a36Sopenharmony_ci/* Altfunction A column */
18062306a36Sopenharmony_cistatic const unsigned gpio1_a_1_pins[] = { AB8500_PIN_T10 };
18162306a36Sopenharmony_cistatic const unsigned gpio2_a_1_pins[] = { AB8500_PIN_T9 };
18262306a36Sopenharmony_cistatic const unsigned gpio3_a_1_pins[] = { AB8500_PIN_U9 };
18362306a36Sopenharmony_cistatic const unsigned gpio4_a_1_pins[] = { AB8500_PIN_W2 };
18462306a36Sopenharmony_cistatic const unsigned gpio6_a_1_pins[] = { AB8500_PIN_Y18 };
18562306a36Sopenharmony_cistatic const unsigned gpio7_a_1_pins[] = { AB8500_PIN_AA20 };
18662306a36Sopenharmony_cistatic const unsigned gpio8_a_1_pins[] = { AB8500_PIN_W18 };
18762306a36Sopenharmony_cistatic const unsigned gpio9_a_1_pins[] = { AB8500_PIN_AA19 };
18862306a36Sopenharmony_ci/* YCbCr4 YCbCr5 YCbCr6 YCbCr7*/
18962306a36Sopenharmony_cistatic const unsigned ycbcr4567_a_1_pins[] = { AB8500_PIN_U17, AB8500_PIN_AA18,
19062306a36Sopenharmony_ci					AB8500_PIN_U16, AB8500_PIN_W17};
19162306a36Sopenharmony_cistatic const unsigned gpio14_a_1_pins[] = { AB8500_PIN_F14 };
19262306a36Sopenharmony_cistatic const unsigned gpio15_a_1_pins[] = { AB8500_PIN_B17 };
19362306a36Sopenharmony_cistatic const unsigned gpio16_a_1_pins[] = { AB8500_PIN_F15 };
19462306a36Sopenharmony_cistatic const unsigned gpio17_a_1_pins[] = { AB8500_PIN_P5 };
19562306a36Sopenharmony_cistatic const unsigned gpio18_a_1_pins[] = { AB8500_PIN_R5 };
19662306a36Sopenharmony_cistatic const unsigned gpio19_a_1_pins[] = { AB8500_PIN_U5 };
19762306a36Sopenharmony_cistatic const unsigned gpio20_a_1_pins[] = { AB8500_PIN_T5 };
19862306a36Sopenharmony_cistatic const unsigned gpio21_a_1_pins[] = { AB8500_PIN_H19 };
19962306a36Sopenharmony_cistatic const unsigned gpio22_a_1_pins[] = { AB8500_PIN_G20 };
20062306a36Sopenharmony_cistatic const unsigned gpio23_a_1_pins[] = { AB8500_PIN_G19 };
20162306a36Sopenharmony_cistatic const unsigned gpio24_a_1_pins[] = { AB8500_PIN_T14 };
20262306a36Sopenharmony_cistatic const unsigned gpio25_a_1_pins[] = { AB8500_PIN_R16 };
20362306a36Sopenharmony_cistatic const unsigned gpio27_a_1_pins[] = { AB8500_PIN_J6 };
20462306a36Sopenharmony_cistatic const unsigned gpio28_a_1_pins[] = { AB8500_PIN_K6 };
20562306a36Sopenharmony_cistatic const unsigned gpio29_a_1_pins[] = { AB8500_PIN_G6 };
20662306a36Sopenharmony_cistatic const unsigned gpio30_a_1_pins[] = { AB8500_PIN_H6 };
20762306a36Sopenharmony_cistatic const unsigned gpio31_a_1_pins[] = { AB8500_PIN_F5 };
20862306a36Sopenharmony_cistatic const unsigned gpio32_a_1_pins[] = { AB8500_PIN_G5 };
20962306a36Sopenharmony_cistatic const unsigned gpio34_a_1_pins[] = { AB8500_PIN_R17 };
21062306a36Sopenharmony_cistatic const unsigned gpio36_a_1_pins[] = { AB8500_PIN_A17 };
21162306a36Sopenharmony_cistatic const unsigned gpio37_a_1_pins[] = { AB8500_PIN_E15 };
21262306a36Sopenharmony_cistatic const unsigned gpio38_a_1_pins[] = { AB8500_PIN_C17 };
21362306a36Sopenharmony_cistatic const unsigned gpio39_a_1_pins[] = { AB8500_PIN_E16 };
21462306a36Sopenharmony_cistatic const unsigned gpio40_a_1_pins[] = { AB8500_PIN_T19 };
21562306a36Sopenharmony_cistatic const unsigned gpio41_a_1_pins[] = { AB8500_PIN_U19 };
21662306a36Sopenharmony_cistatic const unsigned gpio42_a_1_pins[] = { AB8500_PIN_U2 };
21762306a36Sopenharmony_ci
21862306a36Sopenharmony_ci/* Altfunction B colum */
21962306a36Sopenharmony_cistatic const unsigned hiqclkena_b_1_pins[] = { AB8500_PIN_U17 };
22062306a36Sopenharmony_cistatic const unsigned usbuiccpd_b_1_pins[] = { AB8500_PIN_AA18 };
22162306a36Sopenharmony_cistatic const unsigned i2ctrig1_b_1_pins[] = { AB8500_PIN_U16 };
22262306a36Sopenharmony_cistatic const unsigned i2ctrig2_b_1_pins[] = { AB8500_PIN_W17 };
22362306a36Sopenharmony_ci
22462306a36Sopenharmony_ci/* Altfunction C column */
22562306a36Sopenharmony_cistatic const unsigned usbvdat_c_1_pins[] = { AB8500_PIN_W17 };
22662306a36Sopenharmony_ci
22762306a36Sopenharmony_ci
22862306a36Sopenharmony_ci#define AB8500_PIN_GROUP(a, b) { .name = #a, .pins = a##_pins,		\
22962306a36Sopenharmony_ci			.npins = ARRAY_SIZE(a##_pins), .altsetting = b }
23062306a36Sopenharmony_ci
23162306a36Sopenharmony_cistatic const struct abx500_pingroup ab8500_groups[] = {
23262306a36Sopenharmony_ci	/* default column */
23362306a36Sopenharmony_ci	AB8500_PIN_GROUP(sysclkreq2_d_1, ABX500_DEFAULT),
23462306a36Sopenharmony_ci	AB8500_PIN_GROUP(sysclkreq3_d_1, ABX500_DEFAULT),
23562306a36Sopenharmony_ci	AB8500_PIN_GROUP(sysclkreq4_d_1, ABX500_DEFAULT),
23662306a36Sopenharmony_ci	AB8500_PIN_GROUP(sysclkreq6_d_1, ABX500_DEFAULT),
23762306a36Sopenharmony_ci	AB8500_PIN_GROUP(ycbcr0123_d_1, ABX500_DEFAULT),
23862306a36Sopenharmony_ci	AB8500_PIN_GROUP(gpio10_d_1, ABX500_DEFAULT),
23962306a36Sopenharmony_ci	AB8500_PIN_GROUP(gpio11_d_1, ABX500_DEFAULT),
24062306a36Sopenharmony_ci	AB8500_PIN_GROUP(gpio12_d_1, ABX500_DEFAULT),
24162306a36Sopenharmony_ci	AB8500_PIN_GROUP(gpio13_d_1, ABX500_DEFAULT),
24262306a36Sopenharmony_ci	AB8500_PIN_GROUP(pwmout1_d_1, ABX500_DEFAULT),
24362306a36Sopenharmony_ci	AB8500_PIN_GROUP(pwmout2_d_1, ABX500_DEFAULT),
24462306a36Sopenharmony_ci	AB8500_PIN_GROUP(pwmout3_d_1, ABX500_DEFAULT),
24562306a36Sopenharmony_ci	AB8500_PIN_GROUP(adi1_d_1, ABX500_DEFAULT),
24662306a36Sopenharmony_ci	AB8500_PIN_GROUP(usbuicc_d_1, ABX500_DEFAULT),
24762306a36Sopenharmony_ci	AB8500_PIN_GROUP(sysclkreq7_d_1, ABX500_DEFAULT),
24862306a36Sopenharmony_ci	AB8500_PIN_GROUP(sysclkreq8_d_1, ABX500_DEFAULT),
24962306a36Sopenharmony_ci	AB8500_PIN_GROUP(gpio26_d_1, ABX500_DEFAULT),
25062306a36Sopenharmony_ci	AB8500_PIN_GROUP(dmic12_d_1, ABX500_DEFAULT),
25162306a36Sopenharmony_ci	AB8500_PIN_GROUP(dmic34_d_1, ABX500_DEFAULT),
25262306a36Sopenharmony_ci	AB8500_PIN_GROUP(dmic56_d_1, ABX500_DEFAULT),
25362306a36Sopenharmony_ci	AB8500_PIN_GROUP(extcpena_d_1, ABX500_DEFAULT),
25462306a36Sopenharmony_ci	AB8500_PIN_GROUP(gpio35_d_1, ABX500_DEFAULT),
25562306a36Sopenharmony_ci	AB8500_PIN_GROUP(apespi_d_1, ABX500_DEFAULT),
25662306a36Sopenharmony_ci	AB8500_PIN_GROUP(modsclsda_d_1, ABX500_DEFAULT),
25762306a36Sopenharmony_ci	AB8500_PIN_GROUP(sysclkreq5_d_1, ABX500_DEFAULT),
25862306a36Sopenharmony_ci	/* Altfunction A column */
25962306a36Sopenharmony_ci	AB8500_PIN_GROUP(gpio1_a_1, ABX500_ALT_A),
26062306a36Sopenharmony_ci	AB8500_PIN_GROUP(gpio2_a_1, ABX500_ALT_A),
26162306a36Sopenharmony_ci	AB8500_PIN_GROUP(gpio3_a_1, ABX500_ALT_A),
26262306a36Sopenharmony_ci	AB8500_PIN_GROUP(gpio4_a_1, ABX500_ALT_A),
26362306a36Sopenharmony_ci	AB8500_PIN_GROUP(gpio6_a_1, ABX500_ALT_A),
26462306a36Sopenharmony_ci	AB8500_PIN_GROUP(gpio7_a_1, ABX500_ALT_A),
26562306a36Sopenharmony_ci	AB8500_PIN_GROUP(gpio8_a_1, ABX500_ALT_A),
26662306a36Sopenharmony_ci	AB8500_PIN_GROUP(gpio9_a_1, ABX500_ALT_A),
26762306a36Sopenharmony_ci	AB8500_PIN_GROUP(ycbcr4567_a_1, ABX500_ALT_A),
26862306a36Sopenharmony_ci	AB8500_PIN_GROUP(gpio14_a_1, ABX500_ALT_A),
26962306a36Sopenharmony_ci	AB8500_PIN_GROUP(gpio15_a_1, ABX500_ALT_A),
27062306a36Sopenharmony_ci	AB8500_PIN_GROUP(gpio16_a_1, ABX500_ALT_A),
27162306a36Sopenharmony_ci	AB8500_PIN_GROUP(gpio17_a_1, ABX500_ALT_A),
27262306a36Sopenharmony_ci	AB8500_PIN_GROUP(gpio18_a_1, ABX500_ALT_A),
27362306a36Sopenharmony_ci	AB8500_PIN_GROUP(gpio19_a_1, ABX500_ALT_A),
27462306a36Sopenharmony_ci	AB8500_PIN_GROUP(gpio20_a_1, ABX500_ALT_A),
27562306a36Sopenharmony_ci	AB8500_PIN_GROUP(gpio21_a_1, ABX500_ALT_A),
27662306a36Sopenharmony_ci	AB8500_PIN_GROUP(gpio22_a_1, ABX500_ALT_A),
27762306a36Sopenharmony_ci	AB8500_PIN_GROUP(gpio23_a_1, ABX500_ALT_A),
27862306a36Sopenharmony_ci	AB8500_PIN_GROUP(gpio24_a_1, ABX500_ALT_A),
27962306a36Sopenharmony_ci	AB8500_PIN_GROUP(gpio25_a_1, ABX500_ALT_A),
28062306a36Sopenharmony_ci	AB8500_PIN_GROUP(gpio27_a_1, ABX500_ALT_A),
28162306a36Sopenharmony_ci	AB8500_PIN_GROUP(gpio28_a_1, ABX500_ALT_A),
28262306a36Sopenharmony_ci	AB8500_PIN_GROUP(gpio29_a_1, ABX500_ALT_A),
28362306a36Sopenharmony_ci	AB8500_PIN_GROUP(gpio30_a_1, ABX500_ALT_A),
28462306a36Sopenharmony_ci	AB8500_PIN_GROUP(gpio31_a_1, ABX500_ALT_A),
28562306a36Sopenharmony_ci	AB8500_PIN_GROUP(gpio32_a_1, ABX500_ALT_A),
28662306a36Sopenharmony_ci	AB8500_PIN_GROUP(gpio34_a_1, ABX500_ALT_A),
28762306a36Sopenharmony_ci	AB8500_PIN_GROUP(gpio36_a_1, ABX500_ALT_A),
28862306a36Sopenharmony_ci	AB8500_PIN_GROUP(gpio37_a_1, ABX500_ALT_A),
28962306a36Sopenharmony_ci	AB8500_PIN_GROUP(gpio38_a_1, ABX500_ALT_A),
29062306a36Sopenharmony_ci	AB8500_PIN_GROUP(gpio39_a_1, ABX500_ALT_A),
29162306a36Sopenharmony_ci	AB8500_PIN_GROUP(gpio40_a_1, ABX500_ALT_A),
29262306a36Sopenharmony_ci	AB8500_PIN_GROUP(gpio41_a_1, ABX500_ALT_A),
29362306a36Sopenharmony_ci	AB8500_PIN_GROUP(gpio42_a_1, ABX500_ALT_A),
29462306a36Sopenharmony_ci	/* Altfunction B column */
29562306a36Sopenharmony_ci	AB8500_PIN_GROUP(hiqclkena_b_1, ABX500_ALT_B),
29662306a36Sopenharmony_ci	AB8500_PIN_GROUP(usbuiccpd_b_1, ABX500_ALT_B),
29762306a36Sopenharmony_ci	AB8500_PIN_GROUP(i2ctrig1_b_1, ABX500_ALT_B),
29862306a36Sopenharmony_ci	AB8500_PIN_GROUP(i2ctrig2_b_1, ABX500_ALT_B),
29962306a36Sopenharmony_ci	/* Altfunction C column */
30062306a36Sopenharmony_ci	AB8500_PIN_GROUP(usbvdat_c_1, ABX500_ALT_C),
30162306a36Sopenharmony_ci};
30262306a36Sopenharmony_ci
30362306a36Sopenharmony_ci/* We use this macro to define the groups applicable to a function */
30462306a36Sopenharmony_ci#define AB8500_FUNC_GROUPS(a, b...)	   \
30562306a36Sopenharmony_cistatic const char * const a##_groups[] = { b };
30662306a36Sopenharmony_ci
30762306a36Sopenharmony_ciAB8500_FUNC_GROUPS(sysclkreq, "sysclkreq2_d_1", "sysclkreq3_d_1",
30862306a36Sopenharmony_ci		"sysclkreq4_d_1", "sysclkreq5_d_1", "sysclkreq6_d_1",
30962306a36Sopenharmony_ci		"sysclkreq7_d_1", "sysclkreq8_d_1");
31062306a36Sopenharmony_ciAB8500_FUNC_GROUPS(ycbcr, "ycbcr0123_d_1", "ycbcr4567_a_1");
31162306a36Sopenharmony_ciAB8500_FUNC_GROUPS(gpio, "gpio1_a_1", "gpio2_a_1", "gpio3_a_1", "gpio4_a_1",
31262306a36Sopenharmony_ci		"gpio6_a_1", "gpio7_a_1", "gpio8_a_1", "gpio9_a_1",
31362306a36Sopenharmony_ci		"gpio10_d_1", "gpio11_d_1", "gpio12_d_1", "gpio13_d_1",
31462306a36Sopenharmony_ci		"gpio14_a_1", "gpio15_a_1", "gpio16_a_1", "gpio17_a_1",
31562306a36Sopenharmony_ci		"gpio18_a_1", "gpio19_a_1", "gpio20_a_1", "gpio21_a_1",
31662306a36Sopenharmony_ci		"gpio22_a_1", "gpio23_a_1", "gpio24_a_1", "gpio25_a_1",
31762306a36Sopenharmony_ci		"gpio26_d_1", "gpio27_a_1", "gpio28_a_1", "gpio29_a_1",
31862306a36Sopenharmony_ci		"gpio30_a_1", "gpio31_a_1", "gpio32_a_1", "gpio34_a_1",
31962306a36Sopenharmony_ci		"gpio35_d_1", "gpio36_a_1", "gpio37_a_1", "gpio38_a_1",
32062306a36Sopenharmony_ci		"gpio39_a_1", "gpio40_a_1", "gpio41_a_1", "gpio42_a_1");
32162306a36Sopenharmony_ciAB8500_FUNC_GROUPS(pwmout, "pwmout1_d_1", "pwmout2_d_1", "pwmout3_d_1");
32262306a36Sopenharmony_ciAB8500_FUNC_GROUPS(adi1, "adi1_d_1");
32362306a36Sopenharmony_ciAB8500_FUNC_GROUPS(usbuicc, "usbuicc_d_1", "usbuiccpd_b_1");
32462306a36Sopenharmony_ciAB8500_FUNC_GROUPS(dmic, "dmic12_d_1", "dmic34_d_1", "dmic56_d_1");
32562306a36Sopenharmony_ciAB8500_FUNC_GROUPS(extcpena, "extcpena_d_1");
32662306a36Sopenharmony_ciAB8500_FUNC_GROUPS(apespi, "apespi_d_1");
32762306a36Sopenharmony_ciAB8500_FUNC_GROUPS(modsclsda, "modsclsda_d_1");
32862306a36Sopenharmony_ciAB8500_FUNC_GROUPS(hiqclkena, "hiqclkena_b_1");
32962306a36Sopenharmony_ciAB8500_FUNC_GROUPS(i2ctrig, "i2ctrig1_b_1", "i2ctrig2_b_1");
33062306a36Sopenharmony_ciAB8500_FUNC_GROUPS(usbvdat, "usbvdat_c_1");
33162306a36Sopenharmony_ci
33262306a36Sopenharmony_ci#define FUNCTION(fname)					\
33362306a36Sopenharmony_ci	{						\
33462306a36Sopenharmony_ci		.name = #fname,				\
33562306a36Sopenharmony_ci		.groups = fname##_groups,		\
33662306a36Sopenharmony_ci		.ngroups = ARRAY_SIZE(fname##_groups),	\
33762306a36Sopenharmony_ci	}
33862306a36Sopenharmony_ci
33962306a36Sopenharmony_cistatic const struct abx500_function ab8500_functions[] = {
34062306a36Sopenharmony_ci	FUNCTION(sysclkreq),
34162306a36Sopenharmony_ci	FUNCTION(ycbcr),
34262306a36Sopenharmony_ci	FUNCTION(gpio),
34362306a36Sopenharmony_ci	FUNCTION(pwmout),
34462306a36Sopenharmony_ci	FUNCTION(adi1),
34562306a36Sopenharmony_ci	FUNCTION(usbuicc),
34662306a36Sopenharmony_ci	FUNCTION(dmic),
34762306a36Sopenharmony_ci	FUNCTION(extcpena),
34862306a36Sopenharmony_ci	FUNCTION(apespi),
34962306a36Sopenharmony_ci	FUNCTION(modsclsda),
35062306a36Sopenharmony_ci	FUNCTION(hiqclkena),
35162306a36Sopenharmony_ci	FUNCTION(i2ctrig),
35262306a36Sopenharmony_ci	FUNCTION(usbvdat),
35362306a36Sopenharmony_ci};
35462306a36Sopenharmony_ci
35562306a36Sopenharmony_ci/*
35662306a36Sopenharmony_ci * this table translates what's is in the AB8500 specification regarding the
35762306a36Sopenharmony_ci * balls alternate functions (as for DB, default, ALT_A, ALT_B and ALT_C).
35862306a36Sopenharmony_ci * ALTERNATE_FUNCTIONS(GPIO_NUMBER, GPIOSEL bit, ALTERNATFUNC bit1,
35962306a36Sopenharmony_ci * ALTERNATEFUNC bit2, ALTA val, ALTB val, ALTC val),
36062306a36Sopenharmony_ci *
36162306a36Sopenharmony_ci * example :
36262306a36Sopenharmony_ci *
36362306a36Sopenharmony_ci *	ALTERNATE_FUNCTIONS(13,     4,      3,      4, 0, 1 ,2),
36462306a36Sopenharmony_ci *	means that pin AB8500_PIN_W17 (pin 13) supports 4 mux (default/ALT_A,
36562306a36Sopenharmony_ci *	ALT_B and ALT_C), so GPIOSEL and ALTERNATFUNC registers are used to
36662306a36Sopenharmony_ci *	select the mux.  ALTA, ALTB and ALTC val indicates values to write in
36762306a36Sopenharmony_ci *	ALTERNATFUNC register. We need to specifies these values as SOC
36862306a36Sopenharmony_ci *	designers didn't apply the same logic on how to select mux in the
36962306a36Sopenharmony_ci *	ABx500 family.
37062306a36Sopenharmony_ci *
37162306a36Sopenharmony_ci *	As this pins supports at least ALT_B mux, default mux is
37262306a36Sopenharmony_ci *	selected by writing 1 in GPIOSEL bit :
37362306a36Sopenharmony_ci *
37462306a36Sopenharmony_ci *		| GPIOSEL bit=4 | alternatfunc bit2=4 | alternatfunc bit1=3
37562306a36Sopenharmony_ci *	default	|       1       |          0          |          0
37662306a36Sopenharmony_ci *	alt_A	|       0       |          0          |          0
37762306a36Sopenharmony_ci *	alt_B	|       0       |          0          |          1
37862306a36Sopenharmony_ci *	alt_C	|       0       |          1          |          0
37962306a36Sopenharmony_ci *
38062306a36Sopenharmony_ci *	ALTERNATE_FUNCTIONS(8,      7, UNUSED, UNUSED),
38162306a36Sopenharmony_ci *	means that pin AB8500_PIN_W18 (pin 8) supports 2 mux, so only GPIOSEL
38262306a36Sopenharmony_ci *	register is used to select the mux. As this pins doesn't support at
38362306a36Sopenharmony_ci *	least ALT_B mux, default mux is by writing 0 in GPIOSEL bit :
38462306a36Sopenharmony_ci *
38562306a36Sopenharmony_ci *		| GPIOSEL bit=7 | alternatfunc bit2=  | alternatfunc bit1=
38662306a36Sopenharmony_ci *	default	|       0       |          0          |          0
38762306a36Sopenharmony_ci *	alt_A	|       1       |          0          |          0
38862306a36Sopenharmony_ci */
38962306a36Sopenharmony_ci
39062306a36Sopenharmony_cistatic struct
39162306a36Sopenharmony_cialternate_functions ab8500_alternate_functions[AB8500_GPIO_MAX_NUMBER + 1] = {
39262306a36Sopenharmony_ci	ALTERNATE_FUNCTIONS(0, UNUSED, UNUSED, UNUSED, 0, 0, 0), /* no GPIO0 */
39362306a36Sopenharmony_ci	ALTERNATE_FUNCTIONS(1,	    0, UNUSED, UNUSED, 0, 0, 0), /* GPIO1, altA controlled by bit 0 */
39462306a36Sopenharmony_ci	ALTERNATE_FUNCTIONS(2,      1, UNUSED, UNUSED, 0, 0, 0), /* GPIO2, altA controlled by bit 1 */
39562306a36Sopenharmony_ci	ALTERNATE_FUNCTIONS(3,      2, UNUSED, UNUSED, 0, 0, 0), /* GPIO3, altA controlled by bit 2*/
39662306a36Sopenharmony_ci	ALTERNATE_FUNCTIONS(4,      3, UNUSED, UNUSED, 0, 0, 0), /* GPIO4, altA controlled by bit 3*/
39762306a36Sopenharmony_ci	/* bit 4 reserved */
39862306a36Sopenharmony_ci	ALTERNATE_FUNCTIONS(5, UNUSED, UNUSED, UNUSED, 0, 0, 0), /* no GPIO5 */
39962306a36Sopenharmony_ci	ALTERNATE_FUNCTIONS(6,      5, UNUSED, UNUSED, 0, 0, 0), /* GPIO6, altA controlled by bit 5*/
40062306a36Sopenharmony_ci	ALTERNATE_FUNCTIONS(7,      6, UNUSED, UNUSED, 0, 0, 0), /* GPIO7, altA controlled by bit 6*/
40162306a36Sopenharmony_ci	ALTERNATE_FUNCTIONS(8,      7, UNUSED, UNUSED, 0, 0, 0), /* GPIO8, altA controlled by bit 7*/
40262306a36Sopenharmony_ci
40362306a36Sopenharmony_ci	ALTERNATE_FUNCTIONS(9,      0, UNUSED, UNUSED, 0, 0, 0), /* GPIO9, altA controlled by bit 0*/
40462306a36Sopenharmony_ci	ALTERNATE_FUNCTIONS(10,     1,      0, UNUSED, 0, 1, 0), /* GPIO10, altA and altB controlled by bit 0 */
40562306a36Sopenharmony_ci	ALTERNATE_FUNCTIONS(11,     2,      1, UNUSED, 0, 1, 0), /* GPIO11, altA and altB controlled by bit 1 */
40662306a36Sopenharmony_ci	ALTERNATE_FUNCTIONS(12,     3,      2, UNUSED, 0, 1, 0), /* GPIO12, altA and altB controlled by bit 2 */
40762306a36Sopenharmony_ci	ALTERNATE_FUNCTIONS(13,     4,      3,      4, 0, 1, 2), /* GPIO13, altA altB and altC controlled by bit 3 and 4 */
40862306a36Sopenharmony_ci	ALTERNATE_FUNCTIONS(14,     5, UNUSED, UNUSED, 0, 0, 0), /* GPIO14, altA controlled by bit 5 */
40962306a36Sopenharmony_ci	ALTERNATE_FUNCTIONS(15,     6, UNUSED, UNUSED, 0, 0, 0), /* GPIO15, altA controlled by bit 6 */
41062306a36Sopenharmony_ci	ALTERNATE_FUNCTIONS(16,     7, UNUSED, UNUSED, 0, 0, 0), /* GPIO16, altA controlled by bit 7 */
41162306a36Sopenharmony_ci	/*
41262306a36Sopenharmony_ci	 * pins 17 to 20 are special case, only bit 0 is used to select
41362306a36Sopenharmony_ci	 * alternate function for these 4 pins.
41462306a36Sopenharmony_ci	 * bits 1 to 3 are reserved
41562306a36Sopenharmony_ci	 */
41662306a36Sopenharmony_ci	ALTERNATE_FUNCTIONS(17,      0, UNUSED, UNUSED, 0, 0, 0), /* GPIO17, altA controlled by bit 0 */
41762306a36Sopenharmony_ci	ALTERNATE_FUNCTIONS(18,      0, UNUSED, UNUSED, 0, 0, 0), /* GPIO18, altA controlled by bit 0 */
41862306a36Sopenharmony_ci	ALTERNATE_FUNCTIONS(19,      0, UNUSED, UNUSED, 0, 0, 0), /* GPIO19, altA controlled by bit 0 */
41962306a36Sopenharmony_ci	ALTERNATE_FUNCTIONS(20,      0, UNUSED, UNUSED, 0, 0, 0), /* GPIO20, altA controlled by bit 0 */
42062306a36Sopenharmony_ci	ALTERNATE_FUNCTIONS(21,      4, UNUSED, UNUSED, 0, 0, 0), /* GPIO21, altA controlled by bit 4 */
42162306a36Sopenharmony_ci	ALTERNATE_FUNCTIONS(22,      5, UNUSED, UNUSED, 0, 0, 0), /* GPIO22, altA controlled by bit 5 */
42262306a36Sopenharmony_ci	ALTERNATE_FUNCTIONS(23,      6, UNUSED, UNUSED, 0, 0, 0), /* GPIO23, altA controlled by bit 6 */
42362306a36Sopenharmony_ci	ALTERNATE_FUNCTIONS(24,      7, UNUSED, UNUSED, 0, 0, 0), /* GPIO24, altA controlled by bit 7 */
42462306a36Sopenharmony_ci
42562306a36Sopenharmony_ci	ALTERNATE_FUNCTIONS(25,      0, UNUSED, UNUSED, 0, 0, 0), /* GPIO25, altA controlled by bit 0 */
42662306a36Sopenharmony_ci	/* pin 26 special case, no alternate function, bit 1 reserved */
42762306a36Sopenharmony_ci	ALTERNATE_FUNCTIONS(26, UNUSED, UNUSED, UNUSED, 0, 0, 0), /* GPIO26 */
42862306a36Sopenharmony_ci	ALTERNATE_FUNCTIONS(27,      2, UNUSED, UNUSED, 0, 0, 0), /* GPIO27, altA controlled by bit 2 */
42962306a36Sopenharmony_ci	ALTERNATE_FUNCTIONS(28,      3, UNUSED, UNUSED, 0, 0, 0), /* GPIO28, altA controlled by bit 3 */
43062306a36Sopenharmony_ci	ALTERNATE_FUNCTIONS(29,      4, UNUSED, UNUSED, 0, 0, 0), /* GPIO29, altA controlled by bit 4 */
43162306a36Sopenharmony_ci	ALTERNATE_FUNCTIONS(30,      5, UNUSED, UNUSED, 0, 0, 0), /* GPIO30, altA controlled by bit 5 */
43262306a36Sopenharmony_ci	ALTERNATE_FUNCTIONS(31,      6, UNUSED, UNUSED, 0, 0, 0), /* GPIO31, altA controlled by bit 6 */
43362306a36Sopenharmony_ci	ALTERNATE_FUNCTIONS(32,      7, UNUSED, UNUSED, 0, 0, 0), /* GPIO32, altA controlled by bit 7 */
43462306a36Sopenharmony_ci
43562306a36Sopenharmony_ci	ALTERNATE_FUNCTIONS(33, UNUSED, UNUSED, UNUSED, 0, 0, 0), /* no GPIO33 */
43662306a36Sopenharmony_ci	ALTERNATE_FUNCTIONS(34,      1, UNUSED, UNUSED, 0, 0, 0), /* GPIO34, altA controlled by bit 1 */
43762306a36Sopenharmony_ci	/* pin 35 special case, no alternate function, bit 2 reserved */
43862306a36Sopenharmony_ci	ALTERNATE_FUNCTIONS(35, UNUSED, UNUSED, UNUSED, 0, 0, 0), /* GPIO35 */
43962306a36Sopenharmony_ci	ALTERNATE_FUNCTIONS(36,      3, UNUSED, UNUSED, 0, 0, 0), /* GPIO36, altA controlled by bit 3 */
44062306a36Sopenharmony_ci	ALTERNATE_FUNCTIONS(37,      4, UNUSED, UNUSED, 0, 0, 0), /* GPIO37, altA controlled by bit 4 */
44162306a36Sopenharmony_ci	ALTERNATE_FUNCTIONS(38,      5, UNUSED, UNUSED, 0, 0, 0), /* GPIO38, altA controlled by bit 5 */
44262306a36Sopenharmony_ci	ALTERNATE_FUNCTIONS(39,      6, UNUSED, UNUSED, 0, 0, 0), /* GPIO39, altA controlled by bit 6 */
44362306a36Sopenharmony_ci	ALTERNATE_FUNCTIONS(40,      7, UNUSED, UNUSED, 0, 0, 0), /* GPIO40, altA controlled by bit 7 */
44462306a36Sopenharmony_ci
44562306a36Sopenharmony_ci	ALTERNATE_FUNCTIONS(41,      0, UNUSED, UNUSED, 0, 0, 0), /* GPIO41, altA controlled by bit 0 */
44662306a36Sopenharmony_ci	ALTERNATE_FUNCTIONS(42,      1, UNUSED, UNUSED, 0, 0, 0), /* GPIO42, altA controlled by bit 1 */
44762306a36Sopenharmony_ci};
44862306a36Sopenharmony_ci
44962306a36Sopenharmony_ci/*
45062306a36Sopenharmony_ci * Only some GPIOs are interrupt capable, and they are
45162306a36Sopenharmony_ci * organized in discontiguous clusters:
45262306a36Sopenharmony_ci *
45362306a36Sopenharmony_ci *	GPIO6 to GPIO13
45462306a36Sopenharmony_ci *	GPIO24 and GPIO25
45562306a36Sopenharmony_ci *	GPIO36 to GPIO41
45662306a36Sopenharmony_ci */
45762306a36Sopenharmony_cistatic struct abx500_gpio_irq_cluster ab8500_gpio_irq_cluster[] = {
45862306a36Sopenharmony_ci	GPIO_IRQ_CLUSTER(6,  13, AB8500_INT_GPIO6R),
45962306a36Sopenharmony_ci	GPIO_IRQ_CLUSTER(24, 25, AB8500_INT_GPIO24R),
46062306a36Sopenharmony_ci	GPIO_IRQ_CLUSTER(36, 41, AB8500_INT_GPIO36R),
46162306a36Sopenharmony_ci};
46262306a36Sopenharmony_ci
46362306a36Sopenharmony_cistatic struct abx500_pinctrl_soc_data ab8500_soc = {
46462306a36Sopenharmony_ci	.gpio_ranges = ab8500_pinranges,
46562306a36Sopenharmony_ci	.gpio_num_ranges = ARRAY_SIZE(ab8500_pinranges),
46662306a36Sopenharmony_ci	.pins = ab8500_pins,
46762306a36Sopenharmony_ci	.npins = ARRAY_SIZE(ab8500_pins),
46862306a36Sopenharmony_ci	.functions = ab8500_functions,
46962306a36Sopenharmony_ci	.nfunctions = ARRAY_SIZE(ab8500_functions),
47062306a36Sopenharmony_ci	.groups = ab8500_groups,
47162306a36Sopenharmony_ci	.ngroups = ARRAY_SIZE(ab8500_groups),
47262306a36Sopenharmony_ci	.alternate_functions = ab8500_alternate_functions,
47362306a36Sopenharmony_ci	.gpio_irq_cluster = ab8500_gpio_irq_cluster,
47462306a36Sopenharmony_ci	.ngpio_irq_cluster = ARRAY_SIZE(ab8500_gpio_irq_cluster),
47562306a36Sopenharmony_ci	.irq_gpio_rising_offset = AB8500_INT_GPIO6R,
47662306a36Sopenharmony_ci	.irq_gpio_falling_offset = AB8500_INT_GPIO6F,
47762306a36Sopenharmony_ci	.irq_gpio_factor = 1,
47862306a36Sopenharmony_ci};
47962306a36Sopenharmony_ci
48062306a36Sopenharmony_civoid abx500_pinctrl_ab8500_init(struct abx500_pinctrl_soc_data **soc)
48162306a36Sopenharmony_ci{
48262306a36Sopenharmony_ci	*soc = &ab8500_soc;
48362306a36Sopenharmony_ci}
484