162306a36Sopenharmony_ci// SPDX-License-Identifier: GPL-2.0-only
262306a36Sopenharmony_ci/*
362306a36Sopenharmony_ci * Copyright (c) 2015 MediaTek Inc.
462306a36Sopenharmony_ci * Author: Hongzhou.Yang <hongzhou.yang@mediatek.com>
562306a36Sopenharmony_ci *         Yingjoe Chen <yingjoe.chen@mediatek.com>
662306a36Sopenharmony_ci */
762306a36Sopenharmony_ci
862306a36Sopenharmony_ci#include <linux/init.h>
962306a36Sopenharmony_ci#include <linux/platform_device.h>
1062306a36Sopenharmony_ci#include <linux/of.h>
1162306a36Sopenharmony_ci#include <linux/pinctrl/pinctrl.h>
1262306a36Sopenharmony_ci#include <linux/regmap.h>
1362306a36Sopenharmony_ci#include <dt-bindings/pinctrl/mt65xx.h>
1462306a36Sopenharmony_ci
1562306a36Sopenharmony_ci#include "pinctrl-mtk-common.h"
1662306a36Sopenharmony_ci#include "pinctrl-mtk-mt8127.h"
1762306a36Sopenharmony_ci
1862306a36Sopenharmony_cistatic const struct mtk_drv_group_desc mt8127_drv_grp[] =  {
1962306a36Sopenharmony_ci	/* 0E4E8SR 4/8/12/16 */
2062306a36Sopenharmony_ci	MTK_DRV_GRP(4, 16, 1, 2, 4),
2162306a36Sopenharmony_ci	/* 0E2E4SR  2/4/6/8 */
2262306a36Sopenharmony_ci	MTK_DRV_GRP(2, 8, 1, 2, 2),
2362306a36Sopenharmony_ci	/* E8E4E2  2/4/6/8/10/12/14/16 */
2462306a36Sopenharmony_ci	MTK_DRV_GRP(2, 16, 0, 2, 2)
2562306a36Sopenharmony_ci};
2662306a36Sopenharmony_ci
2762306a36Sopenharmony_cistatic const struct mtk_pin_drv_grp mt8127_pin_drv[] = {
2862306a36Sopenharmony_ci	MTK_PIN_DRV_GRP(0,   0xb00,  0, 1),
2962306a36Sopenharmony_ci	MTK_PIN_DRV_GRP(1,   0xb00,  0, 1),
3062306a36Sopenharmony_ci	MTK_PIN_DRV_GRP(2,   0xb00,  0, 1),
3162306a36Sopenharmony_ci	MTK_PIN_DRV_GRP(3,   0xb00,  0, 1),
3262306a36Sopenharmony_ci	MTK_PIN_DRV_GRP(4,   0xb00,  0, 1),
3362306a36Sopenharmony_ci	MTK_PIN_DRV_GRP(5,   0xb00,  0, 1),
3462306a36Sopenharmony_ci	MTK_PIN_DRV_GRP(6,   0xb00,  0, 1),
3562306a36Sopenharmony_ci	MTK_PIN_DRV_GRP(7,   0xb00, 12, 1),
3662306a36Sopenharmony_ci	MTK_PIN_DRV_GRP(8,   0xb00, 12, 1),
3762306a36Sopenharmony_ci	MTK_PIN_DRV_GRP(9,   0xb00, 12, 1),
3862306a36Sopenharmony_ci	MTK_PIN_DRV_GRP(10,  0xb00,  8, 1),
3962306a36Sopenharmony_ci	MTK_PIN_DRV_GRP(11,  0xb00,  8, 1),
4062306a36Sopenharmony_ci	MTK_PIN_DRV_GRP(12,  0xb00,  8, 1),
4162306a36Sopenharmony_ci	MTK_PIN_DRV_GRP(13,  0xb00,  8, 1),
4262306a36Sopenharmony_ci	MTK_PIN_DRV_GRP(14,  0xb10,  4, 0),
4362306a36Sopenharmony_ci	MTK_PIN_DRV_GRP(15,  0xb10,  4, 0),
4462306a36Sopenharmony_ci	MTK_PIN_DRV_GRP(16,  0xb10,  4, 0),
4562306a36Sopenharmony_ci	MTK_PIN_DRV_GRP(17,  0xb10,  4, 0),
4662306a36Sopenharmony_ci	MTK_PIN_DRV_GRP(18,  0xb10,  8, 0),
4762306a36Sopenharmony_ci	MTK_PIN_DRV_GRP(19,  0xb10,  8, 0),
4862306a36Sopenharmony_ci	MTK_PIN_DRV_GRP(20,  0xb10,  8, 0),
4962306a36Sopenharmony_ci	MTK_PIN_DRV_GRP(21,  0xb10,  8, 0),
5062306a36Sopenharmony_ci	MTK_PIN_DRV_GRP(22,  0xb20,  0, 0),
5162306a36Sopenharmony_ci	MTK_PIN_DRV_GRP(23,  0xb20,  0, 0),
5262306a36Sopenharmony_ci	MTK_PIN_DRV_GRP(24,  0xb20,  0, 0),
5362306a36Sopenharmony_ci	MTK_PIN_DRV_GRP(25,  0xb20,  0, 0),
5462306a36Sopenharmony_ci	MTK_PIN_DRV_GRP(26,  0xb20,  0, 0),
5562306a36Sopenharmony_ci	MTK_PIN_DRV_GRP(27,  0xb20,  4, 0),
5662306a36Sopenharmony_ci	MTK_PIN_DRV_GRP(28,  0xb20,  4, 0),
5762306a36Sopenharmony_ci	MTK_PIN_DRV_GRP(29,  0xb20,  4, 0),
5862306a36Sopenharmony_ci	MTK_PIN_DRV_GRP(30,  0xb20,  4, 0),
5962306a36Sopenharmony_ci	MTK_PIN_DRV_GRP(31,  0xb20,  4, 0),
6062306a36Sopenharmony_ci	MTK_PIN_DRV_GRP(32,  0xb20,  4, 0),
6162306a36Sopenharmony_ci	MTK_PIN_DRV_GRP(33,  0xb30,  4, 1),
6262306a36Sopenharmony_ci	MTK_PIN_DRV_GRP(34,  0xb30,  8, 1),
6362306a36Sopenharmony_ci	MTK_PIN_DRV_GRP(35,  0xb30,  8, 1),
6462306a36Sopenharmony_ci	MTK_PIN_DRV_GRP(36,  0xb30,  8, 1),
6562306a36Sopenharmony_ci	MTK_PIN_DRV_GRP(37,  0xb30,  8, 1),
6662306a36Sopenharmony_ci	MTK_PIN_DRV_GRP(38,  0xb30,  8, 1),
6762306a36Sopenharmony_ci	MTK_PIN_DRV_GRP(39,  0xb30, 12, 1),
6862306a36Sopenharmony_ci	MTK_PIN_DRV_GRP(40,  0xb30, 12, 1),
6962306a36Sopenharmony_ci	MTK_PIN_DRV_GRP(41,  0xb30, 12, 1),
7062306a36Sopenharmony_ci	MTK_PIN_DRV_GRP(42,  0xb30, 12, 1),
7162306a36Sopenharmony_ci	MTK_PIN_DRV_GRP(43,  0xb40, 12, 0),
7262306a36Sopenharmony_ci	MTK_PIN_DRV_GRP(44,  0xb40, 12, 0),
7362306a36Sopenharmony_ci	MTK_PIN_DRV_GRP(45,  0xb40, 12, 0),
7462306a36Sopenharmony_ci	MTK_PIN_DRV_GRP(46,  0xb50,  0, 2),
7562306a36Sopenharmony_ci	MTK_PIN_DRV_GRP(47,  0xb50,  0, 2),
7662306a36Sopenharmony_ci	MTK_PIN_DRV_GRP(48,  0xb50,  0, 2),
7762306a36Sopenharmony_ci	MTK_PIN_DRV_GRP(49,  0xb50,  0, 2),
7862306a36Sopenharmony_ci	MTK_PIN_DRV_GRP(50,  0xb70,  0, 1),
7962306a36Sopenharmony_ci	MTK_PIN_DRV_GRP(51,  0xb70,  0, 1),
8062306a36Sopenharmony_ci	MTK_PIN_DRV_GRP(52,  0xb70,  0, 1),
8162306a36Sopenharmony_ci	MTK_PIN_DRV_GRP(53,  0xb50, 12, 1),
8262306a36Sopenharmony_ci	MTK_PIN_DRV_GRP(54,  0xb50, 12, 1),
8362306a36Sopenharmony_ci	MTK_PIN_DRV_GRP(55,  0xb50, 12, 1),
8462306a36Sopenharmony_ci	MTK_PIN_DRV_GRP(56,  0xb50, 12, 1),
8562306a36Sopenharmony_ci	MTK_PIN_DRV_GRP(59,  0xb40,  4, 1),
8662306a36Sopenharmony_ci	MTK_PIN_DRV_GRP(60,  0xb40,  0, 1),
8762306a36Sopenharmony_ci	MTK_PIN_DRV_GRP(61,  0xb40,  0, 1),
8862306a36Sopenharmony_ci	MTK_PIN_DRV_GRP(62,  0xb40,  0, 1),
8962306a36Sopenharmony_ci	MTK_PIN_DRV_GRP(63,  0xb40,  4, 1),
9062306a36Sopenharmony_ci	MTK_PIN_DRV_GRP(64,  0xb40,  4, 1),
9162306a36Sopenharmony_ci	MTK_PIN_DRV_GRP(65,  0xb40,  4, 1),
9262306a36Sopenharmony_ci	MTK_PIN_DRV_GRP(66,  0xb40,  8, 1),
9362306a36Sopenharmony_ci	MTK_PIN_DRV_GRP(67,  0xb40,  8, 1),
9462306a36Sopenharmony_ci	MTK_PIN_DRV_GRP(68,  0xb40,  8, 1),
9562306a36Sopenharmony_ci	MTK_PIN_DRV_GRP(69,  0xb40,  8, 1),
9662306a36Sopenharmony_ci	MTK_PIN_DRV_GRP(70,  0xb40,  8, 1),
9762306a36Sopenharmony_ci	MTK_PIN_DRV_GRP(71,  0xb40,  8, 1),
9862306a36Sopenharmony_ci	MTK_PIN_DRV_GRP(72,  0xb50,  4, 1),
9962306a36Sopenharmony_ci	MTK_PIN_DRV_GRP(73,  0xb50,  4, 1),
10062306a36Sopenharmony_ci	MTK_PIN_DRV_GRP(74,  0xb50,  4, 1),
10162306a36Sopenharmony_ci	MTK_PIN_DRV_GRP(79,  0xb50,  8, 1),
10262306a36Sopenharmony_ci	MTK_PIN_DRV_GRP(80,  0xb50,  8, 1),
10362306a36Sopenharmony_ci	MTK_PIN_DRV_GRP(81,  0xb50,  8, 1),
10462306a36Sopenharmony_ci	MTK_PIN_DRV_GRP(82,  0xb50,  8, 1),
10562306a36Sopenharmony_ci	MTK_PIN_DRV_GRP(83,  0xb50,  8, 1),
10662306a36Sopenharmony_ci	MTK_PIN_DRV_GRP(84,  0xb50,  8, 1),
10762306a36Sopenharmony_ci	MTK_PIN_DRV_GRP(85,  0xce0,  0, 2),
10862306a36Sopenharmony_ci	MTK_PIN_DRV_GRP(86,  0xcd0,  0, 2),
10962306a36Sopenharmony_ci	MTK_PIN_DRV_GRP(87,  0xcf0,  0, 2),
11062306a36Sopenharmony_ci	MTK_PIN_DRV_GRP(88,  0xcf0,  0, 2),
11162306a36Sopenharmony_ci	MTK_PIN_DRV_GRP(89,  0xcf0,  0, 2),
11262306a36Sopenharmony_ci	MTK_PIN_DRV_GRP(90,  0xcf0,  0, 2),
11362306a36Sopenharmony_ci	MTK_PIN_DRV_GRP(117, 0xb60, 12, 1),
11462306a36Sopenharmony_ci	MTK_PIN_DRV_GRP(118, 0xb60, 12, 1),
11562306a36Sopenharmony_ci	MTK_PIN_DRV_GRP(119, 0xb60, 12, 1),
11662306a36Sopenharmony_ci	MTK_PIN_DRV_GRP(120, 0xb60, 12, 1),
11762306a36Sopenharmony_ci	MTK_PIN_DRV_GRP(121, 0xc80,  0, 2),
11862306a36Sopenharmony_ci	MTK_PIN_DRV_GRP(122, 0xc70,  0, 2),
11962306a36Sopenharmony_ci	MTK_PIN_DRV_GRP(123, 0xc90,  0, 2),
12062306a36Sopenharmony_ci	MTK_PIN_DRV_GRP(124, 0xc90,  0, 2),
12162306a36Sopenharmony_ci	MTK_PIN_DRV_GRP(125, 0xc90,  0, 2),
12262306a36Sopenharmony_ci	MTK_PIN_DRV_GRP(126, 0xc90,  0, 2),
12362306a36Sopenharmony_ci	MTK_PIN_DRV_GRP(127, 0xc20,  0, 2),
12462306a36Sopenharmony_ci	MTK_PIN_DRV_GRP(128, 0xc20,  0, 2),
12562306a36Sopenharmony_ci	MTK_PIN_DRV_GRP(129, 0xc20,  0, 2),
12662306a36Sopenharmony_ci	MTK_PIN_DRV_GRP(130, 0xc20,  0, 2),
12762306a36Sopenharmony_ci	MTK_PIN_DRV_GRP(131, 0xc20,  0, 2),
12862306a36Sopenharmony_ci	MTK_PIN_DRV_GRP(132, 0xc10,  0, 2),
12962306a36Sopenharmony_ci	MTK_PIN_DRV_GRP(133, 0xc00,  0, 2),
13062306a36Sopenharmony_ci	MTK_PIN_DRV_GRP(134, 0xc20,  0, 2),
13162306a36Sopenharmony_ci	MTK_PIN_DRV_GRP(135, 0xc20,  0, 2),
13262306a36Sopenharmony_ci	MTK_PIN_DRV_GRP(136, 0xc20,  0, 2),
13362306a36Sopenharmony_ci	MTK_PIN_DRV_GRP(137, 0xc20,  0, 2),
13462306a36Sopenharmony_ci	MTK_PIN_DRV_GRP(142, 0xb50,  0, 2),
13562306a36Sopenharmony_ci};
13662306a36Sopenharmony_ci
13762306a36Sopenharmony_cistatic const struct mtk_pin_spec_pupd_set_samereg mt8127_spec_pupd[] = {
13862306a36Sopenharmony_ci	MTK_PIN_PUPD_SPEC_SR(33,  0xd90, 2, 0, 1),	/* KPROW0 */
13962306a36Sopenharmony_ci	MTK_PIN_PUPD_SPEC_SR(34,  0xd90, 6, 4, 5),	/* KPROW1 */
14062306a36Sopenharmony_ci	MTK_PIN_PUPD_SPEC_SR(35,  0xd90, 10, 8, 9),	/* KPROW2 */
14162306a36Sopenharmony_ci	MTK_PIN_PUPD_SPEC_SR(36,  0xda0, 2, 0, 1),	/* KPCOL0 */
14262306a36Sopenharmony_ci	MTK_PIN_PUPD_SPEC_SR(37,  0xda0, 6, 4, 5),	/* KPCOL1 */
14362306a36Sopenharmony_ci	MTK_PIN_PUPD_SPEC_SR(38,  0xda0, 10, 8, 9),	/* KPCOL2 */
14462306a36Sopenharmony_ci	MTK_PIN_PUPD_SPEC_SR(46,  0xdb0, 2, 0, 1),	/* EINT14 */
14562306a36Sopenharmony_ci	MTK_PIN_PUPD_SPEC_SR(47,  0xdb0, 6, 4, 5),	/* EINT15 */
14662306a36Sopenharmony_ci	MTK_PIN_PUPD_SPEC_SR(48,  0xdb0, 10, 8, 9),	/* EINT16 */
14762306a36Sopenharmony_ci	MTK_PIN_PUPD_SPEC_SR(49,  0xdb0, 14, 12, 13),	/* EINT17 */
14862306a36Sopenharmony_ci	MTK_PIN_PUPD_SPEC_SR(85,  0xce0, 8, 10, 9),	/* MSDC2_CMD */
14962306a36Sopenharmony_ci	MTK_PIN_PUPD_SPEC_SR(86,  0xcd0, 8, 10, 9),	/* MSDC2_CLK */
15062306a36Sopenharmony_ci	MTK_PIN_PUPD_SPEC_SR(87,  0xd00, 0, 2, 1),	/* MSDC2_DAT0 */
15162306a36Sopenharmony_ci	MTK_PIN_PUPD_SPEC_SR(88,  0xd00, 4, 6, 5),	/* MSDC2_DAT1 */
15262306a36Sopenharmony_ci	MTK_PIN_PUPD_SPEC_SR(89,  0xd00, 8, 10, 9),	/* MSDC2_DAT2 */
15362306a36Sopenharmony_ci	MTK_PIN_PUPD_SPEC_SR(90,  0xd00, 12, 14, 13),	/* MSDC2_DAT3 */
15462306a36Sopenharmony_ci	MTK_PIN_PUPD_SPEC_SR(121, 0xc80, 8, 10, 9),	/* MSDC1_CMD */
15562306a36Sopenharmony_ci	MTK_PIN_PUPD_SPEC_SR(122, 0xc70, 8, 10, 9),	/* MSDC1_CLK */
15662306a36Sopenharmony_ci	MTK_PIN_PUPD_SPEC_SR(123, 0xca0, 0, 2, 1),	/* MSDC1_DAT0 */
15762306a36Sopenharmony_ci	MTK_PIN_PUPD_SPEC_SR(124, 0xca0, 4, 6, 5),	/* MSDC1_DAT1 */
15862306a36Sopenharmony_ci	MTK_PIN_PUPD_SPEC_SR(125, 0xca0, 8, 10, 9),	/* MSDC1_DAT2 */
15962306a36Sopenharmony_ci	MTK_PIN_PUPD_SPEC_SR(126, 0xca0, 12, 14, 13),	/* MSDC1_DAT3 */
16062306a36Sopenharmony_ci	MTK_PIN_PUPD_SPEC_SR(127, 0xc40, 12, 14, 13),	/* MSDC0_DAT7 */
16162306a36Sopenharmony_ci	MTK_PIN_PUPD_SPEC_SR(128, 0xc40, 8, 10, 9),	/* MSDC0_DAT6 */
16262306a36Sopenharmony_ci	MTK_PIN_PUPD_SPEC_SR(129, 0xc40, 4, 6, 5),	/* MSDC0_DAT5 */
16362306a36Sopenharmony_ci	MTK_PIN_PUPD_SPEC_SR(130, 0xc40, 0, 2, 1),	/* MSDC0_DAT4 */
16462306a36Sopenharmony_ci	MTK_PIN_PUPD_SPEC_SR(131, 0xc50, 0, 2, 1),	/* MSDC0_RSTB */
16562306a36Sopenharmony_ci	MTK_PIN_PUPD_SPEC_SR(132, 0xc10, 8, 10, 9),	/* MSDC0_CMD */
16662306a36Sopenharmony_ci	MTK_PIN_PUPD_SPEC_SR(133, 0xc00, 8, 10, 9),	/* MSDC0_CLK */
16762306a36Sopenharmony_ci	MTK_PIN_PUPD_SPEC_SR(134, 0xc30, 12, 14, 13),	/* MSDC0_DAT3 */
16862306a36Sopenharmony_ci	MTK_PIN_PUPD_SPEC_SR(135, 0xc30, 8, 10, 9),	/* MSDC0_DAT2 */
16962306a36Sopenharmony_ci	MTK_PIN_PUPD_SPEC_SR(136, 0xc30, 4, 6, 5),	/* MSDC0_DAT1 */
17062306a36Sopenharmony_ci	MTK_PIN_PUPD_SPEC_SR(137, 0xc30, 0, 2, 1),	/* MSDC0_DAT0 */
17162306a36Sopenharmony_ci	MTK_PIN_PUPD_SPEC_SR(142, 0xdc0, 2, 0, 1),	/* EINT21 */
17262306a36Sopenharmony_ci};
17362306a36Sopenharmony_ci
17462306a36Sopenharmony_cistatic const struct mtk_pin_ies_smt_set mt8127_ies_set[] = {
17562306a36Sopenharmony_ci	MTK_PIN_IES_SMT_SPEC(0, 9, 0x900, 0),
17662306a36Sopenharmony_ci	MTK_PIN_IES_SMT_SPEC(10, 13, 0x900, 1),
17762306a36Sopenharmony_ci	MTK_PIN_IES_SMT_SPEC(14, 28, 0x900, 2),
17862306a36Sopenharmony_ci	MTK_PIN_IES_SMT_SPEC(29, 32, 0x900, 3),
17962306a36Sopenharmony_ci	MTK_PIN_IES_SMT_SPEC(33, 33, 0x910, 11),
18062306a36Sopenharmony_ci	MTK_PIN_IES_SMT_SPEC(34, 38, 0x900, 10),
18162306a36Sopenharmony_ci	MTK_PIN_IES_SMT_SPEC(39, 42, 0x900, 11),
18262306a36Sopenharmony_ci	MTK_PIN_IES_SMT_SPEC(43, 45, 0x900, 12),
18362306a36Sopenharmony_ci	MTK_PIN_IES_SMT_SPEC(46, 49, 0x900, 13),
18462306a36Sopenharmony_ci	MTK_PIN_IES_SMT_SPEC(50, 52, 0x910, 10),
18562306a36Sopenharmony_ci	MTK_PIN_IES_SMT_SPEC(53, 56, 0x900, 14),
18662306a36Sopenharmony_ci	MTK_PIN_IES_SMT_SPEC(57, 58, 0x910, 0),
18762306a36Sopenharmony_ci	MTK_PIN_IES_SMT_SPEC(59, 65, 0x910, 2),
18862306a36Sopenharmony_ci	MTK_PIN_IES_SMT_SPEC(66, 71, 0x910, 3),
18962306a36Sopenharmony_ci	MTK_PIN_IES_SMT_SPEC(72, 74, 0x910, 4),
19062306a36Sopenharmony_ci	MTK_PIN_IES_SMT_SPEC(75, 76, 0x900, 15),
19162306a36Sopenharmony_ci	MTK_PIN_IES_SMT_SPEC(77, 78, 0x910, 1),
19262306a36Sopenharmony_ci	MTK_PIN_IES_SMT_SPEC(79, 82, 0x910, 5),
19362306a36Sopenharmony_ci	MTK_PIN_IES_SMT_SPEC(83, 84, 0x910, 6),
19462306a36Sopenharmony_ci	MTK_PIN_IES_SMT_SPEC(117, 120, 0x910, 7),
19562306a36Sopenharmony_ci	MTK_PIN_IES_SMT_SPEC(121, 121, 0xc80, 4),
19662306a36Sopenharmony_ci	MTK_PIN_IES_SMT_SPEC(122, 122, 0xc70, 4),
19762306a36Sopenharmony_ci	MTK_PIN_IES_SMT_SPEC(123, 126, 0xc90, 4),
19862306a36Sopenharmony_ci	MTK_PIN_IES_SMT_SPEC(127, 131, 0xc20, 4),
19962306a36Sopenharmony_ci	MTK_PIN_IES_SMT_SPEC(132, 132, 0xc10, 4),
20062306a36Sopenharmony_ci	MTK_PIN_IES_SMT_SPEC(133, 133, 0xc00, 4),
20162306a36Sopenharmony_ci	MTK_PIN_IES_SMT_SPEC(134, 137, 0xc20, 4),
20262306a36Sopenharmony_ci	MTK_PIN_IES_SMT_SPEC(138, 141, 0x910, 9),
20362306a36Sopenharmony_ci	MTK_PIN_IES_SMT_SPEC(142, 142, 0x900, 13),
20462306a36Sopenharmony_ci};
20562306a36Sopenharmony_ci
20662306a36Sopenharmony_cistatic const struct mtk_pin_ies_smt_set mt8127_smt_set[] = {
20762306a36Sopenharmony_ci	MTK_PIN_IES_SMT_SPEC(0, 9, 0x920, 0),
20862306a36Sopenharmony_ci	MTK_PIN_IES_SMT_SPEC(10, 13, 0x920, 1),
20962306a36Sopenharmony_ci	MTK_PIN_IES_SMT_SPEC(14, 28, 0x920, 2),
21062306a36Sopenharmony_ci	MTK_PIN_IES_SMT_SPEC(29, 32, 0x920, 3),
21162306a36Sopenharmony_ci	MTK_PIN_IES_SMT_SPEC(33, 33, 0x930, 11),
21262306a36Sopenharmony_ci	MTK_PIN_IES_SMT_SPEC(34, 38, 0x920, 10),
21362306a36Sopenharmony_ci	MTK_PIN_IES_SMT_SPEC(39, 42, 0x920, 11),
21462306a36Sopenharmony_ci	MTK_PIN_IES_SMT_SPEC(43, 45, 0x920, 12),
21562306a36Sopenharmony_ci	MTK_PIN_IES_SMT_SPEC(46, 49, 0x920, 13),
21662306a36Sopenharmony_ci	MTK_PIN_IES_SMT_SPEC(50, 52, 0x930, 10),
21762306a36Sopenharmony_ci	MTK_PIN_IES_SMT_SPEC(53, 56, 0x920, 14),
21862306a36Sopenharmony_ci	MTK_PIN_IES_SMT_SPEC(57, 58, 0x930, 0),
21962306a36Sopenharmony_ci	MTK_PIN_IES_SMT_SPEC(59, 65, 0x930, 2),
22062306a36Sopenharmony_ci	MTK_PIN_IES_SMT_SPEC(66, 71, 0x930, 3),
22162306a36Sopenharmony_ci	MTK_PIN_IES_SMT_SPEC(72, 74, 0x930, 4),
22262306a36Sopenharmony_ci	MTK_PIN_IES_SMT_SPEC(75, 76, 0x920, 15),
22362306a36Sopenharmony_ci	MTK_PIN_IES_SMT_SPEC(77, 78, 0x930, 1),
22462306a36Sopenharmony_ci	MTK_PIN_IES_SMT_SPEC(79, 82, 0x930, 5),
22562306a36Sopenharmony_ci	MTK_PIN_IES_SMT_SPEC(83, 84, 0x930, 6),
22662306a36Sopenharmony_ci	MTK_PIN_IES_SMT_SPEC(85, 85, 0xce0, 11),
22762306a36Sopenharmony_ci	MTK_PIN_IES_SMT_SPEC(86, 86, 0xcd0, 11),
22862306a36Sopenharmony_ci	MTK_PIN_IES_SMT_SPEC(87, 87, 0xd00, 3),
22962306a36Sopenharmony_ci	MTK_PIN_IES_SMT_SPEC(88, 88, 0xd00, 7),
23062306a36Sopenharmony_ci	MTK_PIN_IES_SMT_SPEC(89, 89, 0xd00, 11),
23162306a36Sopenharmony_ci	MTK_PIN_IES_SMT_SPEC(90, 90, 0xd00, 15),
23262306a36Sopenharmony_ci	MTK_PIN_IES_SMT_SPEC(117, 120, 0x930, 7),
23362306a36Sopenharmony_ci	MTK_PIN_IES_SMT_SPEC(121, 121, 0xc80, 11),
23462306a36Sopenharmony_ci	MTK_PIN_IES_SMT_SPEC(122, 122, 0xc70, 11),
23562306a36Sopenharmony_ci	MTK_PIN_IES_SMT_SPEC(123, 123, 0xca0, 3),
23662306a36Sopenharmony_ci	MTK_PIN_IES_SMT_SPEC(124, 124, 0xca0, 7),
23762306a36Sopenharmony_ci	MTK_PIN_IES_SMT_SPEC(125, 125, 0xca0, 11),
23862306a36Sopenharmony_ci	MTK_PIN_IES_SMT_SPEC(126, 126, 0xca0, 15),
23962306a36Sopenharmony_ci	MTK_PIN_IES_SMT_SPEC(127, 127, 0xc40, 15),
24062306a36Sopenharmony_ci	MTK_PIN_IES_SMT_SPEC(128, 128, 0xc40, 11),
24162306a36Sopenharmony_ci	MTK_PIN_IES_SMT_SPEC(129, 129, 0xc40, 7),
24262306a36Sopenharmony_ci	MTK_PIN_IES_SMT_SPEC(130, 130, 0xc40, 3),
24362306a36Sopenharmony_ci	MTK_PIN_IES_SMT_SPEC(131, 131, 0xc50, 3),
24462306a36Sopenharmony_ci	MTK_PIN_IES_SMT_SPEC(132, 132, 0xc10, 11),
24562306a36Sopenharmony_ci	MTK_PIN_IES_SMT_SPEC(133, 133, 0xc00, 11),
24662306a36Sopenharmony_ci	MTK_PIN_IES_SMT_SPEC(134, 134, 0xc30, 15),
24762306a36Sopenharmony_ci	MTK_PIN_IES_SMT_SPEC(135, 135, 0xc30, 11),
24862306a36Sopenharmony_ci	MTK_PIN_IES_SMT_SPEC(136, 136, 0xc30, 7),
24962306a36Sopenharmony_ci	MTK_PIN_IES_SMT_SPEC(137, 137, 0xc30, 3),
25062306a36Sopenharmony_ci	MTK_PIN_IES_SMT_SPEC(138, 141, 0x930, 9),
25162306a36Sopenharmony_ci	MTK_PIN_IES_SMT_SPEC(142, 142, 0x920, 13),
25262306a36Sopenharmony_ci};
25362306a36Sopenharmony_ci
25462306a36Sopenharmony_cistatic const struct mtk_pinctrl_devdata mt8127_pinctrl_data = {
25562306a36Sopenharmony_ci	.pins = mtk_pins_mt8127,
25662306a36Sopenharmony_ci	.npins = ARRAY_SIZE(mtk_pins_mt8127),
25762306a36Sopenharmony_ci	.grp_desc = mt8127_drv_grp,
25862306a36Sopenharmony_ci	.n_grp_cls = ARRAY_SIZE(mt8127_drv_grp),
25962306a36Sopenharmony_ci	.pin_drv_grp = mt8127_pin_drv,
26062306a36Sopenharmony_ci	.n_pin_drv_grps = ARRAY_SIZE(mt8127_pin_drv),
26162306a36Sopenharmony_ci	.spec_ies = mt8127_ies_set,
26262306a36Sopenharmony_ci	.n_spec_ies = ARRAY_SIZE(mt8127_ies_set),
26362306a36Sopenharmony_ci	.spec_pupd = mt8127_spec_pupd,
26462306a36Sopenharmony_ci	.n_spec_pupd = ARRAY_SIZE(mt8127_spec_pupd),
26562306a36Sopenharmony_ci	.spec_smt = mt8127_smt_set,
26662306a36Sopenharmony_ci	.n_spec_smt = ARRAY_SIZE(mt8127_smt_set),
26762306a36Sopenharmony_ci	.spec_pull_set = mtk_pctrl_spec_pull_set_samereg,
26862306a36Sopenharmony_ci	.spec_ies_smt_set = mtk_pconf_spec_set_ies_smt_range,
26962306a36Sopenharmony_ci	.dir_offset = 0x0000,
27062306a36Sopenharmony_ci	.pullen_offset = 0x0100,
27162306a36Sopenharmony_ci	.pullsel_offset = 0x0200,
27262306a36Sopenharmony_ci	.dout_offset = 0x0400,
27362306a36Sopenharmony_ci	.din_offset = 0x0500,
27462306a36Sopenharmony_ci	.pinmux_offset = 0x0600,
27562306a36Sopenharmony_ci	.type1_start = 143,
27662306a36Sopenharmony_ci	.type1_end = 143,
27762306a36Sopenharmony_ci	.port_shf = 4,
27862306a36Sopenharmony_ci	.port_mask = 0xf,
27962306a36Sopenharmony_ci	.port_align = 4,
28062306a36Sopenharmony_ci	.mode_mask = 0xf,
28162306a36Sopenharmony_ci	.mode_per_reg = 5,
28262306a36Sopenharmony_ci	.mode_shf = 4,
28362306a36Sopenharmony_ci	.eint_hw = {
28462306a36Sopenharmony_ci		.port_mask = 7,
28562306a36Sopenharmony_ci		.ports     = 6,
28662306a36Sopenharmony_ci		.ap_num    = 143,
28762306a36Sopenharmony_ci		.db_cnt    = 16,
28862306a36Sopenharmony_ci		.db_time = debounce_time_mt2701,
28962306a36Sopenharmony_ci	},
29062306a36Sopenharmony_ci};
29162306a36Sopenharmony_ci
29262306a36Sopenharmony_cistatic const struct of_device_id mt8127_pctrl_match[] = {
29362306a36Sopenharmony_ci	{ .compatible = "mediatek,mt8127-pinctrl", .data = &mt8127_pinctrl_data },
29462306a36Sopenharmony_ci	{ }
29562306a36Sopenharmony_ci};
29662306a36Sopenharmony_ci
29762306a36Sopenharmony_cistatic struct platform_driver mtk_pinctrl_driver = {
29862306a36Sopenharmony_ci	.probe = mtk_pctrl_common_probe,
29962306a36Sopenharmony_ci	.driver = {
30062306a36Sopenharmony_ci		.name = "mediatek-mt8127-pinctrl",
30162306a36Sopenharmony_ci		.of_match_table = mt8127_pctrl_match,
30262306a36Sopenharmony_ci	},
30362306a36Sopenharmony_ci};
30462306a36Sopenharmony_ci
30562306a36Sopenharmony_cistatic int __init mtk_pinctrl_init(void)
30662306a36Sopenharmony_ci{
30762306a36Sopenharmony_ci	return platform_driver_register(&mtk_pinctrl_driver);
30862306a36Sopenharmony_ci}
30962306a36Sopenharmony_ciarch_initcall(mtk_pinctrl_init);
310