162306a36Sopenharmony_ci// SPDX-License-Identifier: GPL-2.0-only
262306a36Sopenharmony_ci/*
362306a36Sopenharmony_ci * Pinctrl data for Wondermedia WM8650 SoC
462306a36Sopenharmony_ci *
562306a36Sopenharmony_ci * Copyright (c) 2013 Tony Prisk <linux@prisktech.co.nz>
662306a36Sopenharmony_ci */
762306a36Sopenharmony_ci
862306a36Sopenharmony_ci#include <linux/io.h>
962306a36Sopenharmony_ci#include <linux/init.h>
1062306a36Sopenharmony_ci#include <linux/pinctrl/pinctrl.h>
1162306a36Sopenharmony_ci#include <linux/platform_device.h>
1262306a36Sopenharmony_ci#include <linux/slab.h>
1362306a36Sopenharmony_ci
1462306a36Sopenharmony_ci#include "pinctrl-wmt.h"
1562306a36Sopenharmony_ci
1662306a36Sopenharmony_ci/*
1762306a36Sopenharmony_ci * Describe the register offsets within the GPIO memory space
1862306a36Sopenharmony_ci * The dedicated external GPIO's should always be listed in bank 0
1962306a36Sopenharmony_ci * so they are exported in the 0..31 range which is what users
2062306a36Sopenharmony_ci * expect.
2162306a36Sopenharmony_ci *
2262306a36Sopenharmony_ci * Do not reorder these banks as it will change the pin numbering
2362306a36Sopenharmony_ci */
2462306a36Sopenharmony_cistatic const struct wmt_pinctrl_bank_registers wm8650_banks[] = {
2562306a36Sopenharmony_ci	WMT_PINCTRL_BANK(0x40, 0x80, 0xC0, 0x00, 0x480, 0x4C0),		/* 0 */
2662306a36Sopenharmony_ci	WMT_PINCTRL_BANK(0x44, 0x84, 0xC4, 0x04, 0x484, 0x4C4),		/* 1 */
2762306a36Sopenharmony_ci	WMT_PINCTRL_BANK(0x48, 0x88, 0xC8, 0x08, 0x488, 0x4C8),		/* 2 */
2862306a36Sopenharmony_ci	WMT_PINCTRL_BANK(0x4C, 0x8C, 0xCC, 0x0C, 0x48C, 0x4CC),		/* 3 */
2962306a36Sopenharmony_ci	WMT_PINCTRL_BANK(0x50, 0x90, 0xD0, 0x10, 0x490, 0x4D0),		/* 4 */
3062306a36Sopenharmony_ci	WMT_PINCTRL_BANK(0x54, 0x94, 0xD4, 0x14, 0x494, 0x4D4),		/* 5 */
3162306a36Sopenharmony_ci	WMT_PINCTRL_BANK(0x58, 0x98, 0xD8, 0x18, 0x498, 0x4D8),		/* 6 */
3262306a36Sopenharmony_ci	WMT_PINCTRL_BANK(0x5C, 0x9C, 0xDC, 0x1C, 0x49C, 0x4DC),		/* 7 */
3362306a36Sopenharmony_ci};
3462306a36Sopenharmony_ci
3562306a36Sopenharmony_ci/* Please keep sorted by bank/bit */
3662306a36Sopenharmony_ci#define WMT_PIN_EXTGPIO0	WMT_PIN(0, 0)
3762306a36Sopenharmony_ci#define WMT_PIN_EXTGPIO1	WMT_PIN(0, 1)
3862306a36Sopenharmony_ci#define WMT_PIN_EXTGPIO2	WMT_PIN(0, 2)
3962306a36Sopenharmony_ci#define WMT_PIN_EXTGPIO3	WMT_PIN(0, 3)
4062306a36Sopenharmony_ci#define WMT_PIN_EXTGPIO4	WMT_PIN(0, 4)
4162306a36Sopenharmony_ci#define WMT_PIN_EXTGPIO5	WMT_PIN(0, 5)
4262306a36Sopenharmony_ci#define WMT_PIN_EXTGPIO6	WMT_PIN(0, 6)
4362306a36Sopenharmony_ci#define WMT_PIN_EXTGPIO7	WMT_PIN(0, 7)
4462306a36Sopenharmony_ci#define WMT_PIN_WAKEUP0		WMT_PIN(0, 16)
4562306a36Sopenharmony_ci#define WMT_PIN_WAKEUP1		WMT_PIN(0, 17)
4662306a36Sopenharmony_ci#define WMT_PIN_SUSGPIO0	WMT_PIN(0, 21)
4762306a36Sopenharmony_ci#define WMT_PIN_SD0CD		WMT_PIN(0, 28)
4862306a36Sopenharmony_ci#define WMT_PIN_SD1CD		WMT_PIN(0, 29)
4962306a36Sopenharmony_ci#define WMT_PIN_VDOUT0		WMT_PIN(1, 0)
5062306a36Sopenharmony_ci#define WMT_PIN_VDOUT1		WMT_PIN(1, 1)
5162306a36Sopenharmony_ci#define WMT_PIN_VDOUT2		WMT_PIN(1, 2)
5262306a36Sopenharmony_ci#define WMT_PIN_VDOUT3		WMT_PIN(1, 3)
5362306a36Sopenharmony_ci#define WMT_PIN_VDOUT4		WMT_PIN(1, 4)
5462306a36Sopenharmony_ci#define WMT_PIN_VDOUT5		WMT_PIN(1, 5)
5562306a36Sopenharmony_ci#define WMT_PIN_VDOUT6		WMT_PIN(1, 6)
5662306a36Sopenharmony_ci#define WMT_PIN_VDOUT7		WMT_PIN(1, 7)
5762306a36Sopenharmony_ci#define WMT_PIN_VDOUT8		WMT_PIN(1, 8)
5862306a36Sopenharmony_ci#define WMT_PIN_VDOUT9		WMT_PIN(1, 9)
5962306a36Sopenharmony_ci#define WMT_PIN_VDOUT10		WMT_PIN(1, 10)
6062306a36Sopenharmony_ci#define WMT_PIN_VDOUT11		WMT_PIN(1, 11)
6162306a36Sopenharmony_ci#define WMT_PIN_VDOUT12		WMT_PIN(1, 12)
6262306a36Sopenharmony_ci#define WMT_PIN_VDOUT13		WMT_PIN(1, 13)
6362306a36Sopenharmony_ci#define WMT_PIN_VDOUT14		WMT_PIN(1, 14)
6462306a36Sopenharmony_ci#define WMT_PIN_VDOUT15		WMT_PIN(1, 15)
6562306a36Sopenharmony_ci#define WMT_PIN_VDOUT16		WMT_PIN(1, 16)
6662306a36Sopenharmony_ci#define WMT_PIN_VDOUT17		WMT_PIN(1, 17)
6762306a36Sopenharmony_ci#define WMT_PIN_VDOUT18		WMT_PIN(1, 18)
6862306a36Sopenharmony_ci#define WMT_PIN_VDOUT19		WMT_PIN(1, 19)
6962306a36Sopenharmony_ci#define WMT_PIN_VDOUT20		WMT_PIN(1, 20)
7062306a36Sopenharmony_ci#define WMT_PIN_VDOUT21		WMT_PIN(1, 21)
7162306a36Sopenharmony_ci#define WMT_PIN_VDOUT22		WMT_PIN(1, 22)
7262306a36Sopenharmony_ci#define WMT_PIN_VDOUT23		WMT_PIN(1, 23)
7362306a36Sopenharmony_ci#define WMT_PIN_VDIN0		WMT_PIN(2, 0)
7462306a36Sopenharmony_ci#define WMT_PIN_VDIN1		WMT_PIN(2, 1)
7562306a36Sopenharmony_ci#define WMT_PIN_VDIN2		WMT_PIN(2, 2)
7662306a36Sopenharmony_ci#define WMT_PIN_VDIN3		WMT_PIN(2, 3)
7762306a36Sopenharmony_ci#define WMT_PIN_VDIN4		WMT_PIN(2, 4)
7862306a36Sopenharmony_ci#define WMT_PIN_VDIN5		WMT_PIN(2, 5)
7962306a36Sopenharmony_ci#define WMT_PIN_VDIN6		WMT_PIN(2, 6)
8062306a36Sopenharmony_ci#define WMT_PIN_VDIN7		WMT_PIN(2, 7)
8162306a36Sopenharmony_ci#define WMT_PIN_I2C1SCL		WMT_PIN(2, 12)
8262306a36Sopenharmony_ci#define WMT_PIN_I2C1SDA		WMT_PIN(2, 13)
8362306a36Sopenharmony_ci#define WMT_PIN_SPI0MOSI	WMT_PIN(2, 24)
8462306a36Sopenharmony_ci#define WMT_PIN_SPI0MISO	WMT_PIN(2, 25)
8562306a36Sopenharmony_ci#define WMT_PIN_SPI0SS0		WMT_PIN(2, 26)
8662306a36Sopenharmony_ci#define WMT_PIN_SPI0CLK		WMT_PIN(2, 27)
8762306a36Sopenharmony_ci#define WMT_PIN_SD0DATA0	WMT_PIN(3, 8)
8862306a36Sopenharmony_ci#define WMT_PIN_SD0DATA1	WMT_PIN(3, 9)
8962306a36Sopenharmony_ci#define WMT_PIN_SD0DATA2	WMT_PIN(3, 10)
9062306a36Sopenharmony_ci#define WMT_PIN_SD0DATA3	WMT_PIN(3, 11)
9162306a36Sopenharmony_ci#define WMT_PIN_SD0CLK		WMT_PIN(3, 12)
9262306a36Sopenharmony_ci#define WMT_PIN_SD0WP		WMT_PIN(3, 13)
9362306a36Sopenharmony_ci#define WMT_PIN_SD0CMD		WMT_PIN(3, 14)
9462306a36Sopenharmony_ci#define WMT_PIN_SD1DATA0	WMT_PIN(3, 24)
9562306a36Sopenharmony_ci#define WMT_PIN_SD1DATA1	WMT_PIN(3, 25)
9662306a36Sopenharmony_ci#define WMT_PIN_SD1DATA2	WMT_PIN(3, 26)
9762306a36Sopenharmony_ci#define WMT_PIN_SD1DATA3	WMT_PIN(3, 27)
9862306a36Sopenharmony_ci#define WMT_PIN_SD1DATA4	WMT_PIN(3, 28)
9962306a36Sopenharmony_ci#define WMT_PIN_SD1DATA5	WMT_PIN(3, 29)
10062306a36Sopenharmony_ci#define WMT_PIN_SD1DATA6	WMT_PIN(3, 30)
10162306a36Sopenharmony_ci#define WMT_PIN_SD1DATA7	WMT_PIN(3, 31)
10262306a36Sopenharmony_ci#define WMT_PIN_I2C0SCL		WMT_PIN(5, 8)
10362306a36Sopenharmony_ci#define WMT_PIN_I2C0SDA		WMT_PIN(5, 9)
10462306a36Sopenharmony_ci#define WMT_PIN_UART0RTS	WMT_PIN(5, 16)
10562306a36Sopenharmony_ci#define WMT_PIN_UART0TXD	WMT_PIN(5, 17)
10662306a36Sopenharmony_ci#define WMT_PIN_UART0CTS	WMT_PIN(5, 18)
10762306a36Sopenharmony_ci#define WMT_PIN_UART0RXD	WMT_PIN(5, 19)
10862306a36Sopenharmony_ci#define WMT_PIN_UART1RTS	WMT_PIN(5, 20)
10962306a36Sopenharmony_ci#define WMT_PIN_UART1TXD	WMT_PIN(5, 21)
11062306a36Sopenharmony_ci#define WMT_PIN_UART1CTS	WMT_PIN(5, 22)
11162306a36Sopenharmony_ci#define WMT_PIN_UART1RXD	WMT_PIN(5, 23)
11262306a36Sopenharmony_ci#define WMT_PIN_UART2RTS	WMT_PIN(5, 24)
11362306a36Sopenharmony_ci#define WMT_PIN_UART2TXD	WMT_PIN(5, 25)
11462306a36Sopenharmony_ci#define WMT_PIN_UART2CTS	WMT_PIN(5, 26)
11562306a36Sopenharmony_ci#define WMT_PIN_UART2RXD	WMT_PIN(5, 27)
11662306a36Sopenharmony_ci#define WMT_PIN_UART3RTS	WMT_PIN(5, 28)
11762306a36Sopenharmony_ci#define WMT_PIN_UART3TXD	WMT_PIN(5, 29)
11862306a36Sopenharmony_ci#define WMT_PIN_UART3CTS	WMT_PIN(5, 30)
11962306a36Sopenharmony_ci#define WMT_PIN_UART3RXD	WMT_PIN(5, 31)
12062306a36Sopenharmony_ci#define WMT_PIN_KPADROW0	WMT_PIN(6, 16)
12162306a36Sopenharmony_ci#define WMT_PIN_KPADROW1	WMT_PIN(6, 17)
12262306a36Sopenharmony_ci#define WMT_PIN_KPADCOL0	WMT_PIN(6, 18)
12362306a36Sopenharmony_ci#define WMT_PIN_KPADCOL1	WMT_PIN(6, 19)
12462306a36Sopenharmony_ci#define WMT_PIN_SD1CLK		WMT_PIN(7, 0)
12562306a36Sopenharmony_ci#define WMT_PIN_SD1CMD		WMT_PIN(7, 1)
12662306a36Sopenharmony_ci#define WMT_PIN_SD1WP		WMT_PIN(7, 13)
12762306a36Sopenharmony_ci
12862306a36Sopenharmony_cistatic const struct pinctrl_pin_desc wm8650_pins[] = {
12962306a36Sopenharmony_ci	PINCTRL_PIN(WMT_PIN_EXTGPIO0, "extgpio0"),
13062306a36Sopenharmony_ci	PINCTRL_PIN(WMT_PIN_EXTGPIO1, "extgpio1"),
13162306a36Sopenharmony_ci	PINCTRL_PIN(WMT_PIN_EXTGPIO2, "extgpio2"),
13262306a36Sopenharmony_ci	PINCTRL_PIN(WMT_PIN_EXTGPIO3, "extgpio3"),
13362306a36Sopenharmony_ci	PINCTRL_PIN(WMT_PIN_EXTGPIO4, "extgpio4"),
13462306a36Sopenharmony_ci	PINCTRL_PIN(WMT_PIN_EXTGPIO5, "extgpio5"),
13562306a36Sopenharmony_ci	PINCTRL_PIN(WMT_PIN_EXTGPIO6, "extgpio6"),
13662306a36Sopenharmony_ci	PINCTRL_PIN(WMT_PIN_EXTGPIO7, "extgpio7"),
13762306a36Sopenharmony_ci	PINCTRL_PIN(WMT_PIN_WAKEUP0, "wakeup0"),
13862306a36Sopenharmony_ci	PINCTRL_PIN(WMT_PIN_WAKEUP1, "wakeup1"),
13962306a36Sopenharmony_ci	PINCTRL_PIN(WMT_PIN_SUSGPIO0, "susgpio0"),
14062306a36Sopenharmony_ci	PINCTRL_PIN(WMT_PIN_SD0CD, "sd0_cd"),
14162306a36Sopenharmony_ci	PINCTRL_PIN(WMT_PIN_SD1CD, "sd1_cd"),
14262306a36Sopenharmony_ci	PINCTRL_PIN(WMT_PIN_VDOUT0, "vdout0"),
14362306a36Sopenharmony_ci	PINCTRL_PIN(WMT_PIN_VDOUT1, "vdout1"),
14462306a36Sopenharmony_ci	PINCTRL_PIN(WMT_PIN_VDOUT2, "vdout2"),
14562306a36Sopenharmony_ci	PINCTRL_PIN(WMT_PIN_VDOUT3, "vdout3"),
14662306a36Sopenharmony_ci	PINCTRL_PIN(WMT_PIN_VDOUT4, "vdout4"),
14762306a36Sopenharmony_ci	PINCTRL_PIN(WMT_PIN_VDOUT5, "vdout5"),
14862306a36Sopenharmony_ci	PINCTRL_PIN(WMT_PIN_VDOUT6, "vdout6"),
14962306a36Sopenharmony_ci	PINCTRL_PIN(WMT_PIN_VDOUT7, "vdout7"),
15062306a36Sopenharmony_ci	PINCTRL_PIN(WMT_PIN_VDOUT8, "vdout8"),
15162306a36Sopenharmony_ci	PINCTRL_PIN(WMT_PIN_VDOUT9, "vdout9"),
15262306a36Sopenharmony_ci	PINCTRL_PIN(WMT_PIN_VDOUT10, "vdout10"),
15362306a36Sopenharmony_ci	PINCTRL_PIN(WMT_PIN_VDOUT11, "vdout11"),
15462306a36Sopenharmony_ci	PINCTRL_PIN(WMT_PIN_VDOUT12, "vdout12"),
15562306a36Sopenharmony_ci	PINCTRL_PIN(WMT_PIN_VDOUT13, "vdout13"),
15662306a36Sopenharmony_ci	PINCTRL_PIN(WMT_PIN_VDOUT14, "vdout14"),
15762306a36Sopenharmony_ci	PINCTRL_PIN(WMT_PIN_VDOUT15, "vdout15"),
15862306a36Sopenharmony_ci	PINCTRL_PIN(WMT_PIN_VDOUT16, "vdout16"),
15962306a36Sopenharmony_ci	PINCTRL_PIN(WMT_PIN_VDOUT17, "vdout17"),
16062306a36Sopenharmony_ci	PINCTRL_PIN(WMT_PIN_VDOUT18, "vdout18"),
16162306a36Sopenharmony_ci	PINCTRL_PIN(WMT_PIN_VDOUT19, "vdout19"),
16262306a36Sopenharmony_ci	PINCTRL_PIN(WMT_PIN_VDOUT20, "vdout20"),
16362306a36Sopenharmony_ci	PINCTRL_PIN(WMT_PIN_VDOUT21, "vdout21"),
16462306a36Sopenharmony_ci	PINCTRL_PIN(WMT_PIN_VDOUT22, "vdout22"),
16562306a36Sopenharmony_ci	PINCTRL_PIN(WMT_PIN_VDOUT23, "vdout23"),
16662306a36Sopenharmony_ci	PINCTRL_PIN(WMT_PIN_VDIN0, "vdin0"),
16762306a36Sopenharmony_ci	PINCTRL_PIN(WMT_PIN_VDIN1, "vdin1"),
16862306a36Sopenharmony_ci	PINCTRL_PIN(WMT_PIN_VDIN2, "vdin2"),
16962306a36Sopenharmony_ci	PINCTRL_PIN(WMT_PIN_VDIN3, "vdin3"),
17062306a36Sopenharmony_ci	PINCTRL_PIN(WMT_PIN_VDIN4, "vdin4"),
17162306a36Sopenharmony_ci	PINCTRL_PIN(WMT_PIN_VDIN5, "vdin5"),
17262306a36Sopenharmony_ci	PINCTRL_PIN(WMT_PIN_VDIN6, "vdin6"),
17362306a36Sopenharmony_ci	PINCTRL_PIN(WMT_PIN_VDIN7, "vdin7"),
17462306a36Sopenharmony_ci	PINCTRL_PIN(WMT_PIN_I2C1SCL, "i2c1_scl"),
17562306a36Sopenharmony_ci	PINCTRL_PIN(WMT_PIN_I2C1SDA, "i2c1_sda"),
17662306a36Sopenharmony_ci	PINCTRL_PIN(WMT_PIN_SPI0MOSI, "spi0_mosi"),
17762306a36Sopenharmony_ci	PINCTRL_PIN(WMT_PIN_SPI0MISO, "spi0_miso"),
17862306a36Sopenharmony_ci	PINCTRL_PIN(WMT_PIN_SPI0SS0, "spi0_ss0"),
17962306a36Sopenharmony_ci	PINCTRL_PIN(WMT_PIN_SPI0CLK, "spi0_clk"),
18062306a36Sopenharmony_ci	PINCTRL_PIN(WMT_PIN_SD0DATA0, "sd0_data0"),
18162306a36Sopenharmony_ci	PINCTRL_PIN(WMT_PIN_SD0DATA1, "sd0_data1"),
18262306a36Sopenharmony_ci	PINCTRL_PIN(WMT_PIN_SD0DATA2, "sd0_data2"),
18362306a36Sopenharmony_ci	PINCTRL_PIN(WMT_PIN_SD0DATA3, "sd0_data3"),
18462306a36Sopenharmony_ci	PINCTRL_PIN(WMT_PIN_SD0CLK, "sd0_clk"),
18562306a36Sopenharmony_ci	PINCTRL_PIN(WMT_PIN_SD0WP, "sd0_wp"),
18662306a36Sopenharmony_ci	PINCTRL_PIN(WMT_PIN_SD0CMD, "sd0_cmd"),
18762306a36Sopenharmony_ci	PINCTRL_PIN(WMT_PIN_SD1DATA0, "sd1_data0"),
18862306a36Sopenharmony_ci	PINCTRL_PIN(WMT_PIN_SD1DATA1, "sd1_data1"),
18962306a36Sopenharmony_ci	PINCTRL_PIN(WMT_PIN_SD1DATA2, "sd1_data2"),
19062306a36Sopenharmony_ci	PINCTRL_PIN(WMT_PIN_SD1DATA3, "sd1_data3"),
19162306a36Sopenharmony_ci	PINCTRL_PIN(WMT_PIN_SD1DATA4, "sd1_data4"),
19262306a36Sopenharmony_ci	PINCTRL_PIN(WMT_PIN_SD1DATA5, "sd1_data5"),
19362306a36Sopenharmony_ci	PINCTRL_PIN(WMT_PIN_SD1DATA6, "sd1_data6"),
19462306a36Sopenharmony_ci	PINCTRL_PIN(WMT_PIN_SD1DATA7, "sd1_data7"),
19562306a36Sopenharmony_ci	PINCTRL_PIN(WMT_PIN_I2C0SCL, "i2c0_scl"),
19662306a36Sopenharmony_ci	PINCTRL_PIN(WMT_PIN_I2C0SDA, "i2c0_sda"),
19762306a36Sopenharmony_ci	PINCTRL_PIN(WMT_PIN_UART0RTS, "uart0_rts"),
19862306a36Sopenharmony_ci	PINCTRL_PIN(WMT_PIN_UART0TXD, "uart0_txd"),
19962306a36Sopenharmony_ci	PINCTRL_PIN(WMT_PIN_UART0CTS, "uart0_cts"),
20062306a36Sopenharmony_ci	PINCTRL_PIN(WMT_PIN_UART0RXD, "uart0_rxd"),
20162306a36Sopenharmony_ci	PINCTRL_PIN(WMT_PIN_UART1RTS, "uart1_rts"),
20262306a36Sopenharmony_ci	PINCTRL_PIN(WMT_PIN_UART1TXD, "uart1_txd"),
20362306a36Sopenharmony_ci	PINCTRL_PIN(WMT_PIN_UART1CTS, "uart1_cts"),
20462306a36Sopenharmony_ci	PINCTRL_PIN(WMT_PIN_UART1RXD, "uart1_rxd"),
20562306a36Sopenharmony_ci	PINCTRL_PIN(WMT_PIN_UART2RTS, "uart2_rts"),
20662306a36Sopenharmony_ci	PINCTRL_PIN(WMT_PIN_UART2TXD, "uart2_txd"),
20762306a36Sopenharmony_ci	PINCTRL_PIN(WMT_PIN_UART2CTS, "uart2_cts"),
20862306a36Sopenharmony_ci	PINCTRL_PIN(WMT_PIN_UART2RXD, "uart2_rxd"),
20962306a36Sopenharmony_ci	PINCTRL_PIN(WMT_PIN_UART3RTS, "uart3_rts"),
21062306a36Sopenharmony_ci	PINCTRL_PIN(WMT_PIN_UART3TXD, "uart3_txd"),
21162306a36Sopenharmony_ci	PINCTRL_PIN(WMT_PIN_UART3CTS, "uart3_cts"),
21262306a36Sopenharmony_ci	PINCTRL_PIN(WMT_PIN_UART3RXD, "uart3_rxd"),
21362306a36Sopenharmony_ci	PINCTRL_PIN(WMT_PIN_KPADROW0, "kpadrow0"),
21462306a36Sopenharmony_ci	PINCTRL_PIN(WMT_PIN_KPADROW1, "kpadrow1"),
21562306a36Sopenharmony_ci	PINCTRL_PIN(WMT_PIN_KPADCOL0, "kpadcol0"),
21662306a36Sopenharmony_ci	PINCTRL_PIN(WMT_PIN_KPADCOL1, "kpadcol1"),
21762306a36Sopenharmony_ci	PINCTRL_PIN(WMT_PIN_SD1CLK, "sd1_clk"),
21862306a36Sopenharmony_ci	PINCTRL_PIN(WMT_PIN_SD1CMD, "sd1_cmd"),
21962306a36Sopenharmony_ci	PINCTRL_PIN(WMT_PIN_SD1WP, "sd1_wp"),
22062306a36Sopenharmony_ci};
22162306a36Sopenharmony_ci
22262306a36Sopenharmony_ci/* Order of these names must match the above list */
22362306a36Sopenharmony_cistatic const char * const wm8650_groups[] = {
22462306a36Sopenharmony_ci	"extgpio0",
22562306a36Sopenharmony_ci	"extgpio1",
22662306a36Sopenharmony_ci	"extgpio2",
22762306a36Sopenharmony_ci	"extgpio3",
22862306a36Sopenharmony_ci	"extgpio4",
22962306a36Sopenharmony_ci	"extgpio5",
23062306a36Sopenharmony_ci	"extgpio6",
23162306a36Sopenharmony_ci	"extgpio7",
23262306a36Sopenharmony_ci	"wakeup0",
23362306a36Sopenharmony_ci	"wakeup1",
23462306a36Sopenharmony_ci	"susgpio0",
23562306a36Sopenharmony_ci	"sd0_cd",
23662306a36Sopenharmony_ci	"sd1_cd",
23762306a36Sopenharmony_ci	"vdout0",
23862306a36Sopenharmony_ci	"vdout1",
23962306a36Sopenharmony_ci	"vdout2",
24062306a36Sopenharmony_ci	"vdout3",
24162306a36Sopenharmony_ci	"vdout4",
24262306a36Sopenharmony_ci	"vdout5",
24362306a36Sopenharmony_ci	"vdout6",
24462306a36Sopenharmony_ci	"vdout7",
24562306a36Sopenharmony_ci	"vdout8",
24662306a36Sopenharmony_ci	"vdout9",
24762306a36Sopenharmony_ci	"vdout10",
24862306a36Sopenharmony_ci	"vdout11",
24962306a36Sopenharmony_ci	"vdout12",
25062306a36Sopenharmony_ci	"vdout13",
25162306a36Sopenharmony_ci	"vdout14",
25262306a36Sopenharmony_ci	"vdout15",
25362306a36Sopenharmony_ci	"vdout16",
25462306a36Sopenharmony_ci	"vdout17",
25562306a36Sopenharmony_ci	"vdout18",
25662306a36Sopenharmony_ci	"vdout19",
25762306a36Sopenharmony_ci	"vdout20",
25862306a36Sopenharmony_ci	"vdout21",
25962306a36Sopenharmony_ci	"vdout22",
26062306a36Sopenharmony_ci	"vdout23",
26162306a36Sopenharmony_ci	"vdin0",
26262306a36Sopenharmony_ci	"vdin1",
26362306a36Sopenharmony_ci	"vdin2",
26462306a36Sopenharmony_ci	"vdin3",
26562306a36Sopenharmony_ci	"vdin4",
26662306a36Sopenharmony_ci	"vdin5",
26762306a36Sopenharmony_ci	"vdin6",
26862306a36Sopenharmony_ci	"vdin7",
26962306a36Sopenharmony_ci	"i2c1_scl",
27062306a36Sopenharmony_ci	"i2c1_sda",
27162306a36Sopenharmony_ci	"spi0_mosi",
27262306a36Sopenharmony_ci	"spi0_miso",
27362306a36Sopenharmony_ci	"spi0_ss0",
27462306a36Sopenharmony_ci	"spi0_clk",
27562306a36Sopenharmony_ci	"sd0_data0",
27662306a36Sopenharmony_ci	"sd0_data1",
27762306a36Sopenharmony_ci	"sd0_data2",
27862306a36Sopenharmony_ci	"sd0_data3",
27962306a36Sopenharmony_ci	"sd0_clk",
28062306a36Sopenharmony_ci	"sd0_wp",
28162306a36Sopenharmony_ci	"sd0_cmd",
28262306a36Sopenharmony_ci	"sd1_data0",
28362306a36Sopenharmony_ci	"sd1_data1",
28462306a36Sopenharmony_ci	"sd1_data2",
28562306a36Sopenharmony_ci	"sd1_data3",
28662306a36Sopenharmony_ci	"sd1_data4",
28762306a36Sopenharmony_ci	"sd1_data5",
28862306a36Sopenharmony_ci	"sd1_data6",
28962306a36Sopenharmony_ci	"sd1_data7",
29062306a36Sopenharmony_ci	"i2c0_scl",
29162306a36Sopenharmony_ci	"i2c0_sda",
29262306a36Sopenharmony_ci	"uart0_rts",
29362306a36Sopenharmony_ci	"uart0_txd",
29462306a36Sopenharmony_ci	"uart0_cts",
29562306a36Sopenharmony_ci	"uart0_rxd",
29662306a36Sopenharmony_ci	"uart1_rts",
29762306a36Sopenharmony_ci	"uart1_txd",
29862306a36Sopenharmony_ci	"uart1_cts",
29962306a36Sopenharmony_ci	"uart1_rxd",
30062306a36Sopenharmony_ci	"uart2_rts",
30162306a36Sopenharmony_ci	"uart2_txd",
30262306a36Sopenharmony_ci	"uart2_cts",
30362306a36Sopenharmony_ci	"uart2_rxd",
30462306a36Sopenharmony_ci	"uart3_rts",
30562306a36Sopenharmony_ci	"uart3_txd",
30662306a36Sopenharmony_ci	"uart3_cts",
30762306a36Sopenharmony_ci	"uart3_rxd",
30862306a36Sopenharmony_ci	"kpadrow0",
30962306a36Sopenharmony_ci	"kpadrow1",
31062306a36Sopenharmony_ci	"kpadcol0",
31162306a36Sopenharmony_ci	"kpadcol1",
31262306a36Sopenharmony_ci	"sd1_clk",
31362306a36Sopenharmony_ci	"sd1_cmd",
31462306a36Sopenharmony_ci	"sd1_wp",
31562306a36Sopenharmony_ci};
31662306a36Sopenharmony_ci
31762306a36Sopenharmony_cistatic int wm8650_pinctrl_probe(struct platform_device *pdev)
31862306a36Sopenharmony_ci{
31962306a36Sopenharmony_ci	struct wmt_pinctrl_data *data;
32062306a36Sopenharmony_ci
32162306a36Sopenharmony_ci	data = devm_kzalloc(&pdev->dev, sizeof(*data), GFP_KERNEL);
32262306a36Sopenharmony_ci	if (!data)
32362306a36Sopenharmony_ci		return -ENOMEM;
32462306a36Sopenharmony_ci
32562306a36Sopenharmony_ci	data->banks = wm8650_banks;
32662306a36Sopenharmony_ci	data->nbanks = ARRAY_SIZE(wm8650_banks);
32762306a36Sopenharmony_ci	data->pins = wm8650_pins;
32862306a36Sopenharmony_ci	data->npins = ARRAY_SIZE(wm8650_pins);
32962306a36Sopenharmony_ci	data->groups = wm8650_groups;
33062306a36Sopenharmony_ci	data->ngroups = ARRAY_SIZE(wm8650_groups);
33162306a36Sopenharmony_ci
33262306a36Sopenharmony_ci	return wmt_pinctrl_probe(pdev, data);
33362306a36Sopenharmony_ci}
33462306a36Sopenharmony_ci
33562306a36Sopenharmony_cistatic const struct of_device_id wmt_pinctrl_of_match[] = {
33662306a36Sopenharmony_ci	{ .compatible = "wm,wm8650-pinctrl" },
33762306a36Sopenharmony_ci	{ /* sentinel */ },
33862306a36Sopenharmony_ci};
33962306a36Sopenharmony_ci
34062306a36Sopenharmony_cistatic struct platform_driver wmt_pinctrl_driver = {
34162306a36Sopenharmony_ci	.probe	= wm8650_pinctrl_probe,
34262306a36Sopenharmony_ci	.driver = {
34362306a36Sopenharmony_ci		.name	= "pinctrl-wm8650",
34462306a36Sopenharmony_ci		.of_match_table	= wmt_pinctrl_of_match,
34562306a36Sopenharmony_ci		.suppress_bind_attrs = true,
34662306a36Sopenharmony_ci	},
34762306a36Sopenharmony_ci};
34862306a36Sopenharmony_cibuiltin_platform_driver(wmt_pinctrl_driver);
349