1 // SPDX-License-Identifier: GPL-2.0
2 /*
3  * Copyright (C) 2020 MediaTek Inc.
4  *
5  * Author: Zhiyong Tao <zhiyong.tao@mediatek.com>
6  *
7  */
8 
9 #include "pinctrl-mtk-mt8195.h"
10 #include "pinctrl-paris.h"
11 
12 /* MT8195 have multiple bases to program pin configuration listed as the below:
13  * iocfg[0]:0x10005000, iocfg[1]:0x11d10000, iocfg[2]:0x11d30000,
14  * iocfg[3]:0x11d40000, iocfg[4]:0x11e20000, iocfg[5]:0x11eb0000,
15  * iocfg[6]:0x11f40000.
16  * _i_based could be used to indicate what base the pin should be mapped into.
17  */
18 
19 #define PIN_FIELD_BASE(s_pin, e_pin, i_base, s_addr, x_addrs, s_bit, x_bits) \
20 	PIN_FIELD_CALC(s_pin, e_pin, i_base, s_addr, x_addrs, s_bit, x_bits, \
21 		       32, 0)
22 
23 #define PINS_FIELD_BASE(s_pin, e_pin, i_base, s_addr, x_addrs, s_bit, x_bits) \
24 	PIN_FIELD_CALC(s_pin, e_pin, i_base, s_addr, x_addrs, s_bit, x_bits,  \
25 		       32, 1)
26 
27 static const struct mtk_pin_field_calc mt8195_pin_mode_range[] = {
28 	PIN_FIELD(0, 144, 0x300, 0x10, 0, 4),
29 };
30 
31 static const struct mtk_pin_field_calc mt8195_pin_dir_range[] = {
32 	PIN_FIELD(0, 144, 0x0, 0x10, 0, 1),
33 };
34 
35 static const struct mtk_pin_field_calc mt8195_pin_di_range[] = {
36 	PIN_FIELD(0, 144, 0x200, 0x10, 0, 1),
37 };
38 
39 static const struct mtk_pin_field_calc mt8195_pin_do_range[] = {
40 	PIN_FIELD(0, 144, 0x100, 0x10, 0, 1),
41 };
42 
43 static const struct mtk_pin_field_calc mt8195_pin_ies_range[] = {
44 	PIN_FIELD_BASE(0, 0, 4, 0x040, 0x10, 0, 1),
45 	PIN_FIELD_BASE(1, 1, 4, 0x040, 0x10, 1, 1),
46 	PIN_FIELD_BASE(2, 2, 4, 0x040, 0x10, 2, 1),
47 	PIN_FIELD_BASE(3, 3, 4, 0x040, 0x10, 3, 1),
48 	PIN_FIELD_BASE(4, 4, 4, 0x040, 0x10, 4, 1),
49 	PIN_FIELD_BASE(5, 5, 4, 0x040, 0x10, 5, 1),
50 	PIN_FIELD_BASE(6, 6, 4, 0x040, 0x10, 6, 1),
51 	PIN_FIELD_BASE(7, 7, 4, 0x040, 0x10, 7, 1),
52 	PIN_FIELD_BASE(8, 8, 4, 0x040, 0x10, 13, 1),
53 	PIN_FIELD_BASE(9, 9, 4, 0x040, 0x10, 8, 1),
54 	PIN_FIELD_BASE(10, 10, 4, 0x040, 0x10, 14, 1),
55 	PIN_FIELD_BASE(11, 11, 4, 0x040, 0x10, 9, 1),
56 	PIN_FIELD_BASE(12, 12, 4, 0x040, 0x10, 15, 1),
57 	PIN_FIELD_BASE(13, 13, 4, 0x040, 0x10, 10, 1),
58 	PIN_FIELD_BASE(14, 14, 4, 0x040, 0x10, 16, 1),
59 	PIN_FIELD_BASE(15, 15, 4, 0x040, 0x10, 11, 1),
60 	PIN_FIELD_BASE(16, 16, 4, 0x040, 0x10, 17, 1),
61 	PIN_FIELD_BASE(17, 17, 4, 0x040, 0x10, 12, 1),
62 	PIN_FIELD_BASE(18, 18, 2, 0x040, 0x10, 5, 1),
63 	PIN_FIELD_BASE(19, 19, 2, 0x040, 0x10, 12, 1),
64 	PIN_FIELD_BASE(20, 20, 2, 0x040, 0x10, 11, 1),
65 	PIN_FIELD_BASE(21, 21, 2, 0x040, 0x10, 10, 1),
66 	PIN_FIELD_BASE(22, 22, 2, 0x040, 0x10, 0, 1),
67 	PIN_FIELD_BASE(23, 23, 2, 0x040, 0x10, 1, 1),
68 	PIN_FIELD_BASE(24, 24, 2, 0x040, 0x10, 2, 1),
69 	PIN_FIELD_BASE(25, 25, 2, 0x040, 0x10, 4, 1),
70 	PIN_FIELD_BASE(26, 26, 2, 0x040, 0x10, 3, 1),
71 	PIN_FIELD_BASE(27, 27, 2, 0x040, 0x10, 6, 1),
72 	PIN_FIELD_BASE(28, 28, 2, 0x040, 0x10, 7, 1),
73 	PIN_FIELD_BASE(29, 29, 2, 0x040, 0x10, 8, 1),
74 	PIN_FIELD_BASE(30, 30, 2, 0x040, 0x10, 9, 1),
75 	PIN_FIELD_BASE(31, 31, 1, 0x060, 0x10, 13, 1),
76 	PIN_FIELD_BASE(32, 32, 1, 0x060, 0x10, 12, 1),
77 	PIN_FIELD_BASE(33, 33, 1, 0x060, 0x10, 11, 1),
78 	PIN_FIELD_BASE(34, 34, 1, 0x060, 0x10, 14, 1),
79 	PIN_FIELD_BASE(35, 35, 1, 0x060, 0x10, 15, 1),
80 	PIN_FIELD_BASE(36, 36, 1, 0x070, 0x10, 3, 1),
81 	PIN_FIELD_BASE(37, 37, 1, 0x070, 0x10, 6, 1),
82 	PIN_FIELD_BASE(38, 38, 1, 0x070, 0x10, 4, 1),
83 	PIN_FIELD_BASE(39, 39, 1, 0x070, 0x10, 5, 1),
84 	PIN_FIELD_BASE(40, 40, 1, 0x070, 0x10, 8, 1),
85 	PIN_FIELD_BASE(41, 41, 1, 0x070, 0x10, 7, 1),
86 	PIN_FIELD_BASE(42, 42, 1, 0x070, 0x10, 10, 1),
87 	PIN_FIELD_BASE(43, 43, 1, 0x070, 0x10, 9, 1),
88 	PIN_FIELD_BASE(44, 44, 1, 0x070, 0x10, 20, 1),
89 	PIN_FIELD_BASE(45, 45, 1, 0x070, 0x10, 21, 1),
90 	PIN_FIELD_BASE(46, 46, 1, 0x060, 0x10, 18, 1),
91 	PIN_FIELD_BASE(47, 47, 1, 0x060, 0x10, 16, 1),
92 	PIN_FIELD_BASE(48, 48, 1, 0x060, 0x10, 19, 1),
93 	PIN_FIELD_BASE(49, 49, 1, 0x060, 0x10, 17, 1),
94 	PIN_FIELD_BASE(50, 50, 1, 0x060, 0x10, 25, 1),
95 	PIN_FIELD_BASE(51, 51, 1, 0x060, 0x10, 20, 1),
96 	PIN_FIELD_BASE(52, 52, 1, 0x060, 0x10, 26, 1),
97 	PIN_FIELD_BASE(53, 53, 1, 0x060, 0x10, 21, 1),
98 	PIN_FIELD_BASE(54, 54, 1, 0x060, 0x10, 22, 1),
99 	PIN_FIELD_BASE(55, 55, 1, 0x060, 0x10, 23, 1),
100 	PIN_FIELD_BASE(56, 56, 1, 0x060, 0x10, 24, 1),
101 	PIN_FIELD_BASE(57, 57, 1, 0x060, 0x10, 29, 1),
102 	PIN_FIELD_BASE(58, 58, 1, 0x060, 0x10, 27, 1),
103 	PIN_FIELD_BASE(59, 59, 1, 0x060, 0x10, 30, 1),
104 	PIN_FIELD_BASE(60, 60, 1, 0x060, 0x10, 28, 1),
105 	PIN_FIELD_BASE(61, 61, 1, 0x060, 0x10, 8, 1),
106 	PIN_FIELD_BASE(62, 62, 1, 0x060, 0x10, 7, 1),
107 	PIN_FIELD_BASE(63, 63, 1, 0x060, 0x10, 10, 1),
108 	PIN_FIELD_BASE(64, 64, 1, 0x060, 0x10, 9, 1),
109 	PIN_FIELD_BASE(65, 65, 1, 0x070, 0x10, 1, 1),
110 	PIN_FIELD_BASE(66, 66, 1, 0x060, 0x10, 31, 1),
111 	PIN_FIELD_BASE(67, 67, 1, 0x070, 0x10, 0, 1),
112 	PIN_FIELD_BASE(68, 68, 1, 0x070, 0x10, 2, 1),
113 	PIN_FIELD_BASE(69, 69, 1, 0x060, 0x10, 0, 1),
114 	PIN_FIELD_BASE(70, 70, 1, 0x060, 0x10, 6, 1),
115 	PIN_FIELD_BASE(71, 71, 1, 0x060, 0x10, 4, 1),
116 	PIN_FIELD_BASE(72, 72, 1, 0x060, 0x10, 5, 1),
117 	PIN_FIELD_BASE(73, 73, 1, 0x060, 0x10, 1, 1),
118 	PIN_FIELD_BASE(74, 74, 1, 0x060, 0x10, 2, 1),
119 	PIN_FIELD_BASE(75, 75, 1, 0x060, 0x10, 3, 1),
120 	PIN_FIELD_BASE(76, 76, 1, 0x070, 0x10, 11, 1),
121 	PIN_FIELD_BASE(77, 77, 3, 0x030, 0x10, 1, 1),
122 	PIN_FIELD_BASE(78, 78, 3, 0x030, 0x10, 2, 1),
123 	PIN_FIELD_BASE(79, 79, 3, 0x030, 0x10, 9, 1),
124 	PIN_FIELD_BASE(80, 80, 3, 0x030, 0x10, 10, 1),
125 	PIN_FIELD_BASE(81, 81, 3, 0x030, 0x10, 11, 1),
126 	PIN_FIELD_BASE(82, 82, 3, 0x030, 0x10, 12, 1),
127 	PIN_FIELD_BASE(83, 83, 3, 0x030, 0x10, 13, 1),
128 	PIN_FIELD_BASE(84, 84, 3, 0x030, 0x10, 14, 1),
129 	PIN_FIELD_BASE(85, 85, 3, 0x030, 0x10, 15, 1),
130 	PIN_FIELD_BASE(86, 86, 3, 0x030, 0x10, 16, 1),
131 	PIN_FIELD_BASE(87, 87, 3, 0x030, 0x10, 3, 1),
132 	PIN_FIELD_BASE(88, 88, 3, 0x030, 0x10, 4, 1),
133 	PIN_FIELD_BASE(89, 89, 3, 0x030, 0x10, 5, 1),
134 	PIN_FIELD_BASE(90, 90, 3, 0x030, 0x10, 6, 1),
135 	PIN_FIELD_BASE(91, 91, 3, 0x030, 0x10, 7, 1),
136 	PIN_FIELD_BASE(92, 92, 3, 0x030, 0x10, 8, 1),
137 	PIN_FIELD_BASE(93, 93, 3, 0x030, 0x10, 18, 1),
138 	PIN_FIELD_BASE(94, 94, 3, 0x030, 0x10, 19, 1),
139 	PIN_FIELD_BASE(95, 95, 3, 0x030, 0x10, 17, 1),
140 	PIN_FIELD_BASE(96, 96, 3, 0x030, 0x10, 0, 1),
141 	PIN_FIELD_BASE(97, 97, 3, 0x030, 0x10, 20, 1),
142 	PIN_FIELD_BASE(98, 98, 3, 0x030, 0x10, 28, 1),
143 	PIN_FIELD_BASE(99, 99, 3, 0x030, 0x10, 27, 1),
144 	PIN_FIELD_BASE(100, 100, 3, 0x030, 0x10, 30, 1),
145 	PIN_FIELD_BASE(101, 101, 3, 0x030, 0x10, 29, 1),
146 	PIN_FIELD_BASE(102, 102, 3, 0x040, 0x10, 0, 1),
147 	PIN_FIELD_BASE(103, 103, 3, 0x030, 0x10, 31, 1),
148 	PIN_FIELD_BASE(104, 104, 3, 0x030, 0x10, 25, 1),
149 	PIN_FIELD_BASE(105, 105, 3, 0x030, 0x10, 26, 1),
150 	PIN_FIELD_BASE(106, 106, 3, 0x030, 0x10, 23, 1),
151 	PIN_FIELD_BASE(107, 107, 3, 0x030, 0x10, 24, 1),
152 	PIN_FIELD_BASE(108, 108, 3, 0x030, 0x10, 22, 1),
153 	PIN_FIELD_BASE(109, 109, 3, 0x030, 0x10, 21, 1),
154 	PIN_FIELD_BASE(110, 110, 5, 0x010, 0x10, 1, 1),
155 	PIN_FIELD_BASE(111, 111, 5, 0x010, 0x10, 0, 1),
156 	PIN_FIELD_BASE(112, 112, 5, 0x010, 0x10, 2, 1),
157 	PIN_FIELD_BASE(113, 113, 5, 0x010, 0x10, 3, 1),
158 	PIN_FIELD_BASE(114, 114, 5, 0x010, 0x10, 4, 1),
159 	PIN_FIELD_BASE(115, 115, 5, 0x010, 0x10, 5, 1),
160 	PIN_FIELD_BASE(116, 116, 6, 0x030, 0x10, 9, 1),
161 	PIN_FIELD_BASE(117, 117, 6, 0x030, 0x10, 8, 1),
162 	PIN_FIELD_BASE(118, 118, 6, 0x030, 0x10, 7, 1),
163 	PIN_FIELD_BASE(119, 119, 6, 0x030, 0x10, 6, 1),
164 	PIN_FIELD_BASE(120, 120, 6, 0x030, 0x10, 11, 1),
165 	PIN_FIELD_BASE(121, 121, 6, 0x030, 0x10, 1, 1),
166 	PIN_FIELD_BASE(122, 122, 6, 0x030, 0x10, 0, 1),
167 	PIN_FIELD_BASE(123, 123, 6, 0x030, 0x10, 5, 1),
168 	PIN_FIELD_BASE(124, 124, 6, 0x030, 0x10, 4, 1),
169 	PIN_FIELD_BASE(125, 125, 6, 0x030, 0x10, 3, 1),
170 	PIN_FIELD_BASE(126, 126, 6, 0x030, 0x10, 2, 1),
171 	PIN_FIELD_BASE(127, 127, 6, 0x030, 0x10, 10, 1),
172 	PIN_FIELD_BASE(128, 128, 3, 0x040, 0x10, 3, 1),
173 	PIN_FIELD_BASE(129, 129, 3, 0x040, 0x10, 1, 1),
174 	PIN_FIELD_BASE(130, 130, 3, 0x040, 0x10, 4, 1),
175 	PIN_FIELD_BASE(131, 131, 3, 0x040, 0x10, 2, 1),
176 	PIN_FIELD_BASE(132, 132, 6, 0x030, 0x10, 13, 1),
177 	PIN_FIELD_BASE(133, 133, 6, 0x030, 0x10, 12, 1),
178 	PIN_FIELD_BASE(134, 134, 6, 0x030, 0x10, 15, 1),
179 	PIN_FIELD_BASE(135, 135, 6, 0x030, 0x10, 14, 1),
180 	PIN_FIELD_BASE(136, 136, 1, 0x070, 0x10, 13, 1),
181 	PIN_FIELD_BASE(137, 137, 1, 0x070, 0x10, 12, 1),
182 	PIN_FIELD_BASE(138, 138, 1, 0x070, 0x10, 15, 1),
183 	PIN_FIELD_BASE(139, 139, 1, 0x070, 0x10, 14, 1),
184 	PIN_FIELD_BASE(140, 140, 1, 0x070, 0x10, 17, 1),
185 	PIN_FIELD_BASE(141, 141, 1, 0x070, 0x10, 16, 1),
186 	PIN_FIELD_BASE(142, 142, 1, 0x070, 0x10, 19, 1),
187 	PIN_FIELD_BASE(143, 143, 1, 0x070, 0x10, 18, 1),
188 };
189 
190 static const struct mtk_pin_field_calc mt8195_pin_smt_range[] = {
191 	PIN_FIELD_BASE(0, 0, 4, 0x0d0, 0x10, 0, 1),
192 	PIN_FIELD_BASE(1, 1, 4, 0x0d0, 0x10, 1, 1),
193 	PIN_FIELD_BASE(2, 2, 4, 0x0d0, 0x10, 2, 1),
194 	PIN_FIELD_BASE(3, 3, 4, 0x0d0, 0x10, 3, 1),
195 	PIN_FIELD_BASE(4, 4, 4, 0x0d0, 0x10, 4, 1),
196 	PIN_FIELD_BASE(5, 5, 4, 0x0d0, 0x10, 5, 1),
197 	PINS_FIELD_BASE(6, 7, 4, 0x0d0, 0x10, 6, 1),
198 	PIN_FIELD_BASE(8, 8, 4, 0x0d0, 0x10, 12, 1),
199 	PIN_FIELD_BASE(9, 9, 4, 0x0d0, 0x10, 7, 1),
200 	PIN_FIELD_BASE(10, 10, 4, 0x0d0, 0x10, 13, 1),
201 	PIN_FIELD_BASE(11, 11, 4, 0x0d0, 0x10, 8, 1),
202 	PIN_FIELD_BASE(12, 12, 4, 0x0d0, 0x10, 14, 1),
203 	PIN_FIELD_BASE(13, 13, 4, 0x0d0, 0x10, 9, 1),
204 	PIN_FIELD_BASE(14, 14, 4, 0x0d0, 0x10, 15, 1),
205 	PIN_FIELD_BASE(15, 15, 4, 0x0d0, 0x10, 10, 1),
206 	PIN_FIELD_BASE(16, 16, 4, 0x0d0, 0x10, 16, 1),
207 	PIN_FIELD_BASE(17, 17, 4, 0x0d0, 0x10, 11, 1),
208 	PIN_FIELD_BASE(18, 18, 2, 0x090, 0x10, 11, 1),
209 	PIN_FIELD_BASE(19, 19, 2, 0x090, 0x10, 10, 1),
210 	PIN_FIELD_BASE(20, 20, 2, 0x090, 0x10, 9, 1),
211 	PIN_FIELD_BASE(21, 21, 2, 0x090, 0x10, 11, 1),
212 	PIN_FIELD_BASE(22, 22, 2, 0x090, 0x10, 0, 1),
213 	PIN_FIELD_BASE(23, 23, 2, 0x090, 0x10, 1, 1),
214 	PIN_FIELD_BASE(24, 24, 2, 0x090, 0x10, 2, 1),
215 	PIN_FIELD_BASE(25, 25, 2, 0x090, 0x10, 4, 1),
216 	PIN_FIELD_BASE(26, 26, 2, 0x090, 0x10, 3, 1),
217 	PIN_FIELD_BASE(27, 27, 2, 0x090, 0x10, 5, 1),
218 	PIN_FIELD_BASE(28, 28, 2, 0x090, 0x10, 6, 1),
219 	PIN_FIELD_BASE(29, 29, 2, 0x090, 0x10, 7, 1),
220 	PIN_FIELD_BASE(30, 30, 2, 0x090, 0x10, 8, 1),
221 	PINS_FIELD_BASE(31, 33, 1, 0x0f0, 0x10, 4, 1),
222 	PIN_FIELD_BASE(34, 34, 1, 0x0f0, 0x10, 0, 1),
223 	PIN_FIELD_BASE(35, 35, 1, 0x0f0, 0x10, 1, 1),
224 	PIN_FIELD_BASE(36, 36, 1, 0x0f0, 0x10, 4, 1),
225 	PIN_FIELD_BASE(37, 37, 1, 0x0f0, 0x10, 2, 1),
226 	PINS_FIELD_BASE(38, 39, 1, 0x0f0, 0x10, 5, 1),
227 	PIN_FIELD_BASE(40, 40, 1, 0x0f0, 0x10, 14, 1),
228 	PIN_FIELD_BASE(41, 41, 1, 0x0f0, 0x10, 13, 1),
229 	PIN_FIELD_BASE(42, 42, 1, 0x0f0, 0x10, 16, 1),
230 	PIN_FIELD_BASE(43, 43, 1, 0x0f0, 0x10, 15, 1),
231 	PIN_FIELD_BASE(44, 44, 1, 0x0f0, 0x10, 25, 1),
232 	PIN_FIELD_BASE(45, 45, 1, 0x0f0, 0x10, 26, 1),
233 	PINS_FIELD_BASE(46, 47, 1, 0x0f0, 0x10, 5, 1),
234 	PINS_FIELD_BASE(48, 51, 1, 0x0f0, 0x10, 6, 1),
235 	PINS_FIELD_BASE(52, 55, 1, 0x0f0, 0x10, 7, 1),
236 	PINS_FIELD_BASE(56, 59, 1, 0x0f0, 0x10, 8, 1),
237 	PINS_FIELD_BASE(60, 63, 1, 0x0f0, 0x10, 9, 1),
238 	PIN_FIELD_BASE(64, 64, 1, 0x0f0, 0x10, 10, 1),
239 	PINS_FIELD_BASE(65, 68, 1, 0x0f0, 0x10, 3, 1),
240 	PINS_FIELD_BASE(69, 71, 1, 0x0f0, 0x10, 10, 1),
241 	PINS_FIELD_BASE(72, 75, 1, 0x0f0, 0x10, 11, 1),
242 	PIN_FIELD_BASE(76, 76, 1, 0x0f0, 0x10, 12, 1),
243 	PIN_FIELD_BASE(77, 77, 3, 0x0e0, 0x10, 0, 1),
244 	PIN_FIELD_BASE(78, 78, 3, 0x0e0, 0x10, 1, 1),
245 	PIN_FIELD_BASE(79, 79, 3, 0x0e0, 0x10, 6, 1),
246 	PIN_FIELD_BASE(80, 80, 3, 0x0e0, 0x10, 7, 1),
247 	PIN_FIELD_BASE(81, 81, 3, 0x0e0, 0x10, 8, 1),
248 	PIN_FIELD_BASE(82, 82, 3, 0x0e0, 0x10, 9, 1),
249 	PIN_FIELD_BASE(83, 83, 3, 0x0e0, 0x10, 10, 1),
250 	PIN_FIELD_BASE(84, 84, 3, 0x0e0, 0x10, 11, 1),
251 	PINS_FIELD_BASE(85, 88, 3, 0x0e0, 0x10, 14, 1),
252 	PIN_FIELD_BASE(89, 89, 3, 0x0e0, 0x10, 2, 1),
253 	PIN_FIELD_BASE(90, 90, 3, 0x0e0, 0x10, 3, 1),
254 	PIN_FIELD_BASE(91, 91, 3, 0x0e0, 0x10, 4, 1),
255 	PIN_FIELD_BASE(92, 92, 3, 0x0e0, 0x10, 5, 1),
256 	PIN_FIELD_BASE(93, 93, 3, 0x0e0, 0x10, 12, 1),
257 	PIN_FIELD_BASE(94, 94, 3, 0x0e0, 0x10, 13, 1),
258 	PINS_FIELD_BASE(95, 98, 3, 0x0e0, 0x10, 15, 1),
259 	PINS_FIELD_BASE(99, 102, 3, 0x0e0, 0x10, 16, 1),
260 	PINS_FIELD_BASE(103, 104, 3, 0x0e0, 0x10, 17, 1),
261 	PIN_FIELD_BASE(105, 105, 3, 0x0e0, 0x10, 18, 1),
262 	PINS_FIELD_BASE(106, 107, 3, 0x0e0, 0x10, 17, 1),
263 	PINS_FIELD_BASE(108, 109, 3, 0x0e0, 0x10, 18, 1),
264 	PIN_FIELD_BASE(110, 110, 5, 0x070, 0x10, 1, 1),
265 	PIN_FIELD_BASE(111, 111, 5, 0x070, 0x10, 0, 1),
266 	PIN_FIELD_BASE(112, 112, 5, 0x070, 0x10, 2, 1),
267 	PIN_FIELD_BASE(113, 113, 5, 0x070, 0x10, 3, 1),
268 	PIN_FIELD_BASE(114, 114, 5, 0x070, 0x10, 4, 1),
269 	PIN_FIELD_BASE(115, 115, 5, 0x070, 0x10, 5, 1),
270 	PIN_FIELD_BASE(116, 116, 6, 0x0c0, 0x10, 9, 1),
271 	PIN_FIELD_BASE(117, 117, 6, 0x0c0, 0x10, 8, 1),
272 	PIN_FIELD_BASE(118, 118, 6, 0x0c0, 0x10, 7, 1),
273 	PIN_FIELD_BASE(119, 119, 6, 0x0c0, 0x10, 6, 1),
274 	PIN_FIELD_BASE(120, 120, 6, 0x0c0, 0x10, 11, 1),
275 	PIN_FIELD_BASE(121, 121, 6, 0x0c0, 0x10, 1, 1),
276 	PIN_FIELD_BASE(122, 122, 6, 0x0c0, 0x10, 0, 1),
277 	PIN_FIELD_BASE(123, 123, 6, 0x0c0, 0x10, 5, 1),
278 	PIN_FIELD_BASE(124, 124, 6, 0x0c0, 0x10, 4, 1),
279 	PIN_FIELD_BASE(125, 125, 6, 0x0c0, 0x10, 3, 1),
280 	PIN_FIELD_BASE(126, 126, 6, 0x0c0, 0x10, 2, 1),
281 	PIN_FIELD_BASE(127, 127, 6, 0x0c0, 0x10, 10, 1),
282 	PIN_FIELD_BASE(128, 128, 3, 0x0e0, 0x10, 18, 1),
283 	PINS_FIELD_BASE(129, 131, 3, 0x0e0, 0x10, 19, 1),
284 	PIN_FIELD_BASE(132, 132, 6, 0x0c0, 0x10, 13, 1),
285 	PIN_FIELD_BASE(133, 133, 6, 0x0c0, 0x10, 12, 1),
286 	PIN_FIELD_BASE(134, 134, 6, 0x0c0, 0x10, 15, 1),
287 	PIN_FIELD_BASE(135, 135, 6, 0x0c0, 0x10, 14, 1),
288 	PIN_FIELD_BASE(136, 136, 1, 0x0f0, 0x10, 18, 1),
289 	PIN_FIELD_BASE(137, 137, 1, 0x0f0, 0x10, 17, 1),
290 	PIN_FIELD_BASE(138, 138, 1, 0x0f0, 0x10, 20, 1),
291 	PIN_FIELD_BASE(139, 139, 1, 0x0f0, 0x10, 19, 1),
292 	PIN_FIELD_BASE(140, 140, 1, 0x0f0, 0x10, 22, 1),
293 	PIN_FIELD_BASE(141, 141, 1, 0x0f0, 0x10, 21, 1),
294 	PIN_FIELD_BASE(142, 142, 1, 0x0f0, 0x10, 24, 1),
295 	PIN_FIELD_BASE(143, 143, 1, 0x0f0, 0x10, 23, 1),
296 };
297 
298 static const struct mtk_pin_field_calc mt8195_pin_pu_range[] = {
299 	PIN_FIELD_BASE(6, 6, 4, 0x0070, 0x10, 0, 1),
300 	PIN_FIELD_BASE(7, 7, 4, 0x0070, 0x10, 1, 1),
301 	PIN_FIELD_BASE(8, 8, 4, 0x0070, 0x10, 7, 1),
302 	PIN_FIELD_BASE(9, 9, 4, 0x0070, 0x10, 2, 1),
303 	PIN_FIELD_BASE(10, 10, 4, 0x0070, 0x10, 8, 1),
304 	PIN_FIELD_BASE(11, 11, 4, 0x0070, 0x10, 3, 1),
305 	PIN_FIELD_BASE(12, 12, 4, 0x0070, 0x10, 9, 1),
306 	PIN_FIELD_BASE(13, 13, 4, 0x0070, 0x10, 4, 1),
307 	PIN_FIELD_BASE(14, 14, 4, 0x0070, 0x10, 10, 1),
308 	PIN_FIELD_BASE(15, 15, 4, 0x0070, 0x10, 5, 1),
309 	PIN_FIELD_BASE(16, 16, 4, 0x0070, 0x10, 11, 1),
310 	PIN_FIELD_BASE(17, 17, 4, 0x0070, 0x10, 6, 1),
311 	PIN_FIELD_BASE(18, 18, 2, 0x0060, 0x10, 5, 1),
312 	PIN_FIELD_BASE(19, 19, 2, 0x0060, 0x10, 12, 1),
313 	PIN_FIELD_BASE(20, 20, 2, 0x0060, 0x10, 11, 1),
314 	PIN_FIELD_BASE(21, 21, 2, 0x0060, 0x10, 10, 1),
315 	PIN_FIELD_BASE(22, 22, 2, 0x0060, 0x10, 0, 1),
316 	PIN_FIELD_BASE(23, 23, 2, 0x0060, 0x10, 1, 1),
317 	PIN_FIELD_BASE(24, 24, 2, 0x0060, 0x10, 2, 1),
318 	PIN_FIELD_BASE(25, 25, 2, 0x0060, 0x10, 4, 1),
319 	PIN_FIELD_BASE(26, 26, 2, 0x0060, 0x10, 3, 1),
320 	PIN_FIELD_BASE(27, 27, 2, 0x0060, 0x10, 6, 1),
321 	PIN_FIELD_BASE(28, 28, 2, 0x0060, 0x10, 7, 1),
322 	PIN_FIELD_BASE(29, 29, 2, 0x0060, 0x10, 8, 1),
323 	PIN_FIELD_BASE(30, 30, 2, 0x0060, 0x10, 9, 1),
324 	PIN_FIELD_BASE(31, 31, 1, 0x00a0, 0x10, 13, 1),
325 	PIN_FIELD_BASE(32, 32, 1, 0x00a0, 0x10, 12, 1),
326 	PIN_FIELD_BASE(33, 33, 1, 0x00a0, 0x10, 11, 1),
327 	PIN_FIELD_BASE(34, 34, 1, 0x00a0, 0x10, 14, 1),
328 	PIN_FIELD_BASE(35, 35, 1, 0x00a0, 0x10, 15, 1),
329 	PIN_FIELD_BASE(36, 36, 1, 0x00b0, 0x10, 3, 1),
330 	PIN_FIELD_BASE(37, 37, 1, 0x00b0, 0x10, 6, 1),
331 	PIN_FIELD_BASE(38, 38, 1, 0x00b0, 0x10, 4, 1),
332 	PIN_FIELD_BASE(39, 39, 1, 0x00b0, 0x10, 5, 1),
333 	PIN_FIELD_BASE(40, 40, 1, 0x00b0, 0x10, 8, 1),
334 	PIN_FIELD_BASE(41, 41, 1, 0x00b0, 0x10, 7, 1),
335 	PIN_FIELD_BASE(42, 42, 1, 0x00b0, 0x10, 10, 1),
336 	PIN_FIELD_BASE(43, 43, 1, 0x00b0, 0x10, 9, 1),
337 	PIN_FIELD_BASE(44, 44, 1, 0x00b0, 0x10, 21, 1),
338 	PIN_FIELD_BASE(45, 45, 1, 0x00b0, 0x10, 22, 1),
339 	PIN_FIELD_BASE(46, 46, 1, 0x00a0, 0x10, 18, 1),
340 	PIN_FIELD_BASE(47, 47, 1, 0x00a0, 0x10, 16, 1),
341 	PIN_FIELD_BASE(48, 48, 1, 0x00a0, 0x10, 19, 1),
342 	PIN_FIELD_BASE(49, 49, 1, 0x00a0, 0x10, 17, 1),
343 	PIN_FIELD_BASE(50, 50, 1, 0x00a0, 0x10, 25, 1),
344 	PIN_FIELD_BASE(51, 51, 1, 0x00a0, 0x10, 20, 1),
345 	PIN_FIELD_BASE(52, 52, 1, 0x00a0, 0x10, 26, 1),
346 	PIN_FIELD_BASE(53, 53, 1, 0x00a0, 0x10, 21, 1),
347 	PIN_FIELD_BASE(54, 54, 1, 0x00a0, 0x10, 22, 1),
348 	PIN_FIELD_BASE(55, 55, 1, 0x00a0, 0x10, 23, 1),
349 	PIN_FIELD_BASE(56, 56, 1, 0x00a0, 0x10, 24, 1),
350 	PIN_FIELD_BASE(57, 57, 1, 0x00a0, 0x10, 29, 1),
351 	PIN_FIELD_BASE(58, 58, 1, 0x00a0, 0x10, 27, 1),
352 	PIN_FIELD_BASE(59, 59, 1, 0x00a0, 0x10, 30, 1),
353 	PIN_FIELD_BASE(60, 60, 1, 0x00a0, 0x10, 28, 1),
354 	PIN_FIELD_BASE(61, 61, 1, 0x00a0, 0x10, 8, 1),
355 	PIN_FIELD_BASE(62, 62, 1, 0x00a0, 0x10, 7, 1),
356 	PIN_FIELD_BASE(63, 63, 1, 0x00a0, 0x10, 10, 1),
357 	PIN_FIELD_BASE(64, 64, 1, 0x00a0, 0x10, 9, 1),
358 	PIN_FIELD_BASE(65, 65, 1, 0x00b0, 0x10, 1, 1),
359 	PIN_FIELD_BASE(66, 66, 1, 0x00a0, 0x10, 31, 1),
360 	PIN_FIELD_BASE(67, 67, 1, 0x00b0, 0x10, 0, 1),
361 	PIN_FIELD_BASE(68, 68, 1, 0x00b0, 0x10, 2, 1),
362 	PIN_FIELD_BASE(69, 69, 1, 0x00a0, 0x10, 0, 1),
363 	PIN_FIELD_BASE(70, 70, 1, 0x00a0, 0x10, 6, 1),
364 	PIN_FIELD_BASE(71, 71, 1, 0x00a0, 0x10, 4, 1),
365 	PIN_FIELD_BASE(72, 72, 1, 0x00a0, 0x10, 5, 1),
366 	PIN_FIELD_BASE(73, 73, 1, 0x00a0, 0x10, 1, 1),
367 	PIN_FIELD_BASE(74, 74, 1, 0x00a0, 0x10, 2, 1),
368 	PIN_FIELD_BASE(75, 75, 1, 0x00a0, 0x10, 3, 1),
369 	PIN_FIELD_BASE(76, 76, 1, 0x00b0, 0x10, 11, 1),
370 	PIN_FIELD_BASE(97, 97, 3, 0x0070, 0x10, 0, 1),
371 	PIN_FIELD_BASE(98, 98, 3, 0x0070, 0x10, 4, 1),
372 	PIN_FIELD_BASE(99, 99, 3, 0x0070, 0x10, 3, 1),
373 	PIN_FIELD_BASE(100, 100, 3, 0x0070, 0x10, 6, 1),
374 	PIN_FIELD_BASE(101, 101, 3, 0x0070, 0x10, 5, 1),
375 	PIN_FIELD_BASE(102, 102, 3, 0x0070, 0x10, 8, 1),
376 	PIN_FIELD_BASE(103, 103, 3, 0x0070, 0x10, 7, 1),
377 	PIN_FIELD_BASE(108, 108, 3, 0x0070, 0x10, 2, 1),
378 	PIN_FIELD_BASE(109, 109, 3, 0x0070, 0x10, 1, 1),
379 	PIN_FIELD_BASE(128, 128, 3, 0x0070, 0x10, 11, 1),
380 	PIN_FIELD_BASE(129, 129, 3, 0x0070, 0x10, 9, 1),
381 	PIN_FIELD_BASE(130, 130, 3, 0x0070, 0x10, 12, 1),
382 	PIN_FIELD_BASE(131, 131, 3, 0x0070, 0x10, 10, 1),
383 	PIN_FIELD_BASE(132, 132, 6, 0x0060, 0x10, 1, 1),
384 	PIN_FIELD_BASE(133, 133, 6, 0x0060, 0x10, 0, 1),
385 	PIN_FIELD_BASE(134, 134, 6, 0x0060, 0x10, 3, 1),
386 	PIN_FIELD_BASE(135, 135, 6, 0x0060, 0x10, 2, 1),
387 	PIN_FIELD_BASE(136, 136, 1, 0x00b0, 0x10, 14, 1),
388 	PIN_FIELD_BASE(137, 137, 1, 0x00b0, 0x10, 13, 1),
389 	PIN_FIELD_BASE(138, 138, 1, 0x00b0, 0x10, 16, 1),
390 	PIN_FIELD_BASE(139, 139, 1, 0x00b0, 0x10, 15, 1),
391 	PIN_FIELD_BASE(140, 140, 1, 0x00b0, 0x10, 18, 1),
392 	PIN_FIELD_BASE(141, 141, 1, 0x00b0, 0x10, 17, 1),
393 	PIN_FIELD_BASE(142, 142, 1, 0x00b0, 0x10, 20, 1),
394 	PIN_FIELD_BASE(143, 143, 1, 0x00b0, 0x10, 19, 1),
395 };
396 
397 static const struct mtk_pin_field_calc mt8195_pin_pd_range[] = {
398 	PIN_FIELD_BASE(6, 6, 4, 0x0050, 0x10, 0, 1),
399 	PIN_FIELD_BASE(7, 7, 4, 0x0050, 0x10, 1, 1),
400 	PIN_FIELD_BASE(8, 8, 4, 0x0050, 0x10, 7, 1),
401 	PIN_FIELD_BASE(9, 9, 4, 0x0050, 0x10, 2, 1),
402 	PIN_FIELD_BASE(10, 10, 4, 0x0050, 0x10, 8, 1),
403 	PIN_FIELD_BASE(11, 11, 4, 0x0050, 0x10, 3, 1),
404 	PIN_FIELD_BASE(12, 12, 4, 0x0050, 0x10, 9, 1),
405 	PIN_FIELD_BASE(13, 13, 4, 0x0050, 0x10, 4, 1),
406 	PIN_FIELD_BASE(14, 14, 4, 0x0050, 0x10, 10, 1),
407 	PIN_FIELD_BASE(15, 15, 4, 0x0050, 0x10, 5, 1),
408 	PIN_FIELD_BASE(16, 16, 4, 0x0050, 0x10, 11, 1),
409 	PIN_FIELD_BASE(17, 17, 4, 0x0050, 0x10, 6, 1),
410 	PIN_FIELD_BASE(18, 18, 2, 0x0050, 0x10, 5, 1),
411 	PIN_FIELD_BASE(19, 19, 2, 0x0050, 0x10, 12, 1),
412 	PIN_FIELD_BASE(20, 20, 2, 0x0050, 0x10, 11, 1),
413 	PIN_FIELD_BASE(21, 21, 2, 0x0050, 0x10, 10, 1),
414 	PIN_FIELD_BASE(22, 22, 2, 0x0050, 0x10, 0, 1),
415 	PIN_FIELD_BASE(23, 23, 2, 0x0050, 0x10, 1, 1),
416 	PIN_FIELD_BASE(24, 24, 2, 0x0050, 0x10, 2, 1),
417 	PIN_FIELD_BASE(25, 25, 2, 0x0050, 0x10, 4, 1),
418 	PIN_FIELD_BASE(26, 26, 2, 0x0050, 0x10, 3, 1),
419 	PIN_FIELD_BASE(27, 27, 2, 0x0050, 0x10, 6, 1),
420 	PIN_FIELD_BASE(28, 28, 2, 0x0050, 0x10, 7, 1),
421 	PIN_FIELD_BASE(29, 29, 2, 0x0050, 0x10, 8, 1),
422 	PIN_FIELD_BASE(30, 30, 2, 0x0050, 0x10, 9, 1),
423 	PIN_FIELD_BASE(31, 31, 1, 0x0080, 0x10, 13, 1),
424 	PIN_FIELD_BASE(32, 32, 1, 0x0080, 0x10, 12, 1),
425 	PIN_FIELD_BASE(33, 33, 1, 0x0080, 0x10, 11, 1),
426 	PIN_FIELD_BASE(34, 34, 1, 0x0080, 0x10, 14, 1),
427 	PIN_FIELD_BASE(35, 35, 1, 0x0080, 0x10, 15, 1),
428 	PIN_FIELD_BASE(36, 36, 1, 0x0090, 0x10, 3, 1),
429 	PIN_FIELD_BASE(37, 37, 1, 0x0090, 0x10, 6, 1),
430 	PIN_FIELD_BASE(38, 38, 1, 0x0090, 0x10, 4, 1),
431 	PIN_FIELD_BASE(39, 39, 1, 0x0090, 0x10, 5, 1),
432 	PIN_FIELD_BASE(40, 40, 1, 0x0090, 0x10, 8, 1),
433 	PIN_FIELD_BASE(41, 41, 1, 0x0090, 0x10, 7, 1),
434 	PIN_FIELD_BASE(42, 42, 1, 0x0090, 0x10, 10, 1),
435 	PIN_FIELD_BASE(43, 43, 1, 0x0090, 0x10, 9, 1),
436 	PIN_FIELD_BASE(44, 44, 1, 0x0090, 0x10, 21, 1),
437 	PIN_FIELD_BASE(45, 45, 1, 0x0090, 0x10, 22, 1),
438 	PIN_FIELD_BASE(46, 46, 1, 0x0080, 0x10, 18, 1),
439 	PIN_FIELD_BASE(47, 47, 1, 0x0080, 0x10, 16, 1),
440 	PIN_FIELD_BASE(48, 48, 1, 0x0080, 0x10, 19, 1),
441 	PIN_FIELD_BASE(49, 49, 1, 0x0080, 0x10, 17, 1),
442 	PIN_FIELD_BASE(50, 50, 1, 0x0080, 0x10, 25, 1),
443 	PIN_FIELD_BASE(51, 51, 1, 0x0080, 0x10, 20, 1),
444 	PIN_FIELD_BASE(52, 52, 1, 0x0080, 0x10, 26, 1),
445 	PIN_FIELD_BASE(53, 53, 1, 0x0080, 0x10, 21, 1),
446 	PIN_FIELD_BASE(54, 54, 1, 0x0080, 0x10, 22, 1),
447 	PIN_FIELD_BASE(55, 55, 1, 0x0080, 0x10, 23, 1),
448 	PIN_FIELD_BASE(56, 56, 1, 0x0080, 0x10, 24, 1),
449 	PIN_FIELD_BASE(57, 57, 1, 0x0080, 0x10, 29, 1),
450 	PIN_FIELD_BASE(58, 58, 1, 0x0080, 0x10, 27, 1),
451 	PIN_FIELD_BASE(59, 59, 1, 0x0080, 0x10, 30, 1),
452 	PIN_FIELD_BASE(60, 60, 1, 0x0080, 0x10, 28, 1),
453 	PIN_FIELD_BASE(61, 61, 1, 0x0080, 0x10, 8, 1),
454 	PIN_FIELD_BASE(62, 62, 1, 0x0080, 0x10, 7, 1),
455 	PIN_FIELD_BASE(63, 63, 1, 0x0080, 0x10, 10, 1),
456 	PIN_FIELD_BASE(64, 64, 1, 0x0080, 0x10, 9, 1),
457 	PIN_FIELD_BASE(65, 65, 1, 0x0090, 0x10, 1, 1),
458 	PIN_FIELD_BASE(66, 66, 1, 0x0080, 0x10, 31, 1),
459 	PIN_FIELD_BASE(67, 67, 1, 0x0090, 0x10, 0, 1),
460 	PIN_FIELD_BASE(68, 68, 1, 0x0090, 0x10, 2, 1),
461 	PIN_FIELD_BASE(69, 69, 1, 0x0080, 0x10, 0, 1),
462 	PIN_FIELD_BASE(70, 70, 1, 0x0080, 0x10, 6, 1),
463 	PIN_FIELD_BASE(71, 71, 1, 0x0080, 0x10, 4, 1),
464 	PIN_FIELD_BASE(72, 72, 1, 0x0080, 0x10, 5, 1),
465 	PIN_FIELD_BASE(73, 73, 1, 0x0080, 0x10, 1, 1),
466 	PIN_FIELD_BASE(74, 74, 1, 0x0080, 0x10, 2, 1),
467 	PIN_FIELD_BASE(75, 75, 1, 0x0080, 0x10, 3, 1),
468 	PIN_FIELD_BASE(76, 76, 1, 0x0090, 0x10, 11, 1),
469 	PIN_FIELD_BASE(97, 97, 3, 0x0050, 0x10, 0, 1),
470 	PIN_FIELD_BASE(98, 98, 3, 0x0050, 0x10, 4, 1),
471 	PIN_FIELD_BASE(99, 99, 3, 0x0050, 0x10, 3, 1),
472 	PIN_FIELD_BASE(100, 100, 3, 0x0050, 0x10, 6, 1),
473 	PIN_FIELD_BASE(101, 101, 3, 0x0050, 0x10, 5, 1),
474 	PIN_FIELD_BASE(102, 102, 3, 0x0050, 0x10, 8, 1),
475 	PIN_FIELD_BASE(103, 103, 3, 0x0050, 0x10, 7, 1),
476 	PIN_FIELD_BASE(108, 108, 3, 0x0050, 0x10, 2, 1),
477 	PIN_FIELD_BASE(109, 109, 3, 0x0050, 0x10, 1, 1),
478 	PIN_FIELD_BASE(128, 128, 3, 0x0050, 0x10, 11, 1),
479 	PIN_FIELD_BASE(129, 129, 3, 0x0050, 0x10, 9, 1),
480 	PIN_FIELD_BASE(130, 130, 3, 0x0050, 0x10, 12, 1),
481 	PIN_FIELD_BASE(131, 131, 3, 0x0050, 0x10, 10, 1),
482 	PIN_FIELD_BASE(132, 132, 6, 0x0040, 0x10, 1, 1),
483 	PIN_FIELD_BASE(133, 133, 6, 0x0040, 0x10, 0, 1),
484 	PIN_FIELD_BASE(134, 134, 6, 0x0040, 0x10, 3, 1),
485 	PIN_FIELD_BASE(135, 135, 6, 0x0040, 0x10, 2, 1),
486 	PIN_FIELD_BASE(136, 136, 1, 0x0090, 0x10, 14, 1),
487 	PIN_FIELD_BASE(137, 137, 1, 0x0090, 0x10, 13, 1),
488 	PIN_FIELD_BASE(138, 138, 1, 0x0090, 0x10, 16, 1),
489 	PIN_FIELD_BASE(139, 139, 1, 0x0090, 0x10, 15, 1),
490 	PIN_FIELD_BASE(140, 140, 1, 0x0090, 0x10, 18, 1),
491 	PIN_FIELD_BASE(141, 141, 1, 0x0090, 0x10, 17, 1),
492 	PIN_FIELD_BASE(142, 142, 1, 0x0090, 0x10, 20, 1),
493 	PIN_FIELD_BASE(143, 143, 1, 0x0090, 0x10, 19, 1),
494 };
495 
496 static const struct mtk_pin_field_calc mt8195_pin_pupd_range[] = {
497 	PIN_FIELD_BASE(0, 0, 4, 0x0060, 0x10, 0, 1),
498 	PIN_FIELD_BASE(1, 1, 4, 0x0060, 0x10, 1, 1),
499 	PIN_FIELD_BASE(2, 2, 4, 0x0060, 0x10, 2, 1),
500 	PIN_FIELD_BASE(3, 3, 4, 0x0060, 0x10, 3, 1),
501 	PIN_FIELD_BASE(4, 4, 4, 0x0060, 0x10, 4, 1),
502 	PIN_FIELD_BASE(5, 5, 4, 0x0060, 0x10, 5, 1),
503 	PIN_FIELD_BASE(77, 77, 3, 0x0060, 0x10, 1, 1),
504 	PIN_FIELD_BASE(78, 78, 3, 0x0060, 0x10, 2, 1),
505 	PIN_FIELD_BASE(79, 79, 3, 0x0060, 0x10, 9, 1),
506 	PIN_FIELD_BASE(80, 80, 3, 0x0060, 0x10, 10, 1),
507 	PIN_FIELD_BASE(81, 81, 3, 0x0060, 0x10, 11, 1),
508 	PIN_FIELD_BASE(82, 82, 3, 0x0060, 0x10, 12, 1),
509 	PIN_FIELD_BASE(83, 83, 3, 0x0060, 0x10, 13, 1),
510 	PIN_FIELD_BASE(84, 84, 3, 0x0060, 0x10, 14, 1),
511 	PIN_FIELD_BASE(85, 85, 3, 0x0060, 0x10, 15, 1),
512 	PIN_FIELD_BASE(86, 86, 3, 0x0060, 0x10, 16, 1),
513 	PIN_FIELD_BASE(87, 87, 3, 0x0060, 0x10, 3, 1),
514 	PIN_FIELD_BASE(88, 88, 3, 0x0060, 0x10, 4, 1),
515 	PIN_FIELD_BASE(89, 89, 3, 0x0060, 0x10, 5, 1),
516 	PIN_FIELD_BASE(90, 90, 3, 0x0060, 0x10, 6, 1),
517 	PIN_FIELD_BASE(91, 91, 3, 0x0060, 0x10, 7, 1),
518 	PIN_FIELD_BASE(92, 92, 3, 0x0060, 0x10, 8, 1),
519 	PIN_FIELD_BASE(93, 93, 3, 0x0060, 0x10, 18, 1),
520 	PIN_FIELD_BASE(94, 94, 3, 0x0060, 0x10, 19, 1),
521 	PIN_FIELD_BASE(95, 95, 3, 0x0060, 0x10, 17, 1),
522 	PIN_FIELD_BASE(96, 96, 3, 0x0060, 0x10, 0, 1),
523 	PIN_FIELD_BASE(104, 104, 3, 0x0060, 0x10, 22, 1),
524 	PIN_FIELD_BASE(105, 105, 3, 0x0060, 0x10, 23, 1),
525 	PIN_FIELD_BASE(106, 106, 3, 0x0060, 0x10, 20, 1),
526 	PIN_FIELD_BASE(107, 107, 3, 0x0060, 0x10, 21, 1),
527 	PIN_FIELD_BASE(110, 110, 5, 0x0020, 0x10, 1, 1),
528 	PIN_FIELD_BASE(111, 111, 5, 0x0020, 0x10, 0, 1),
529 	PIN_FIELD_BASE(112, 112, 5, 0x0020, 0x10, 2, 1),
530 	PIN_FIELD_BASE(113, 113, 5, 0x0020, 0x10, 3, 1),
531 	PIN_FIELD_BASE(114, 114, 5, 0x0020, 0x10, 4, 1),
532 	PIN_FIELD_BASE(115, 115, 5, 0x0020, 0x10, 5, 1),
533 	PIN_FIELD_BASE(116, 116, 6, 0x0050, 0x10, 9, 1),
534 	PIN_FIELD_BASE(117, 117, 6, 0x0050, 0x10, 8, 1),
535 	PIN_FIELD_BASE(118, 118, 6, 0x0050, 0x10, 7, 1),
536 	PIN_FIELD_BASE(119, 119, 6, 0x0050, 0x10, 6, 1),
537 	PIN_FIELD_BASE(120, 120, 6, 0x0050, 0x10, 11, 1),
538 	PIN_FIELD_BASE(121, 121, 6, 0x0050, 0x10, 1, 1),
539 	PIN_FIELD_BASE(122, 122, 6, 0x0050, 0x10, 0, 1),
540 	PIN_FIELD_BASE(123, 123, 6, 0x0050, 0x10, 5, 1),
541 	PIN_FIELD_BASE(124, 124, 6, 0x0050, 0x10, 4, 1),
542 	PIN_FIELD_BASE(125, 125, 6, 0x0050, 0x10, 3, 1),
543 	PIN_FIELD_BASE(126, 126, 6, 0x0050, 0x10, 2, 1),
544 	PIN_FIELD_BASE(127, 127, 6, 0x0050, 0x10, 10, 1),
545 };
546 
547 static const struct mtk_pin_field_calc mt8195_pin_r0_range[] = {
548 	PIN_FIELD_BASE(0, 0, 4, 0x0080, 0x10, 0, 1),
549 	PIN_FIELD_BASE(1, 1, 4, 0x0080, 0x10, 1, 1),
550 	PIN_FIELD_BASE(2, 2, 4, 0x0080, 0x10, 2, 1),
551 	PIN_FIELD_BASE(3, 3, 4, 0x0080, 0x10, 3, 1),
552 	PIN_FIELD_BASE(4, 4, 4, 0x0080, 0x10, 4, 1),
553 	PIN_FIELD_BASE(5, 5, 4, 0x0080, 0x10, 5, 1),
554 	PIN_FIELD_BASE(77, 77, 3, 0x0080, 0x10, 1, 1),
555 	PIN_FIELD_BASE(78, 78, 3, 0x0080, 0x10, 2, 1),
556 	PIN_FIELD_BASE(79, 79, 3, 0x0080, 0x10, 9, 1),
557 	PIN_FIELD_BASE(80, 80, 3, 0x0080, 0x10, 10, 1),
558 	PIN_FIELD_BASE(81, 81, 3, 0x0080, 0x10, 11, 1),
559 	PIN_FIELD_BASE(82, 82, 3, 0x0080, 0x10, 12, 1),
560 	PIN_FIELD_BASE(83, 83, 3, 0x0080, 0x10, 13, 1),
561 	PIN_FIELD_BASE(84, 84, 3, 0x0080, 0x10, 14, 1),
562 	PIN_FIELD_BASE(85, 85, 3, 0x0080, 0x10, 15, 1),
563 	PIN_FIELD_BASE(86, 86, 3, 0x0080, 0x10, 16, 1),
564 	PIN_FIELD_BASE(87, 87, 3, 0x0080, 0x10, 3, 1),
565 	PIN_FIELD_BASE(88, 88, 3, 0x0080, 0x10, 4, 1),
566 	PIN_FIELD_BASE(89, 89, 3, 0x0080, 0x10, 5, 1),
567 	PIN_FIELD_BASE(90, 90, 3, 0x0080, 0x10, 6, 1),
568 	PIN_FIELD_BASE(91, 91, 3, 0x0080, 0x10, 7, 1),
569 	PIN_FIELD_BASE(92, 92, 3, 0x0080, 0x10, 8, 1),
570 	PIN_FIELD_BASE(93, 93, 3, 0x0080, 0x10, 18, 1),
571 	PIN_FIELD_BASE(94, 94, 3, 0x0080, 0x10, 19, 1),
572 	PIN_FIELD_BASE(95, 95, 3, 0x0080, 0x10, 17, 1),
573 	PIN_FIELD_BASE(96, 96, 3, 0x0080, 0x10, 0, 1),
574 	PIN_FIELD_BASE(104, 104, 3, 0x0080, 0x10, 22, 1),
575 	PIN_FIELD_BASE(105, 105, 3, 0x0080, 0x10, 23, 1),
576 	PIN_FIELD_BASE(106, 106, 3, 0x0080, 0x10, 20, 1),
577 	PIN_FIELD_BASE(107, 107, 3, 0x0080, 0x10, 21, 1),
578 	PIN_FIELD_BASE(110, 110, 5, 0x0030, 0x10, 1, 1),
579 	PIN_FIELD_BASE(111, 111, 5, 0x0030, 0x10, 0, 1),
580 	PIN_FIELD_BASE(112, 112, 5, 0x0030, 0x10, 2, 1),
581 	PIN_FIELD_BASE(113, 113, 5, 0x0030, 0x10, 3, 1),
582 	PIN_FIELD_BASE(114, 114, 5, 0x0030, 0x10, 4, 1),
583 	PIN_FIELD_BASE(115, 115, 5, 0x0030, 0x10, 5, 1),
584 	PIN_FIELD_BASE(116, 116, 6, 0x0070, 0x10, 9, 1),
585 	PIN_FIELD_BASE(117, 117, 6, 0x0070, 0x10, 8, 1),
586 	PIN_FIELD_BASE(118, 118, 6, 0x0070, 0x10, 7, 1),
587 	PIN_FIELD_BASE(119, 119, 6, 0x0070, 0x10, 6, 1),
588 	PIN_FIELD_BASE(120, 120, 6, 0x0070, 0x10, 11, 1),
589 	PIN_FIELD_BASE(121, 121, 6, 0x0070, 0x10, 1, 1),
590 	PIN_FIELD_BASE(122, 122, 6, 0x0070, 0x10, 0, 1),
591 	PIN_FIELD_BASE(123, 123, 6, 0x0070, 0x10, 5, 1),
592 	PIN_FIELD_BASE(124, 124, 6, 0x0070, 0x10, 4, 1),
593 	PIN_FIELD_BASE(125, 125, 6, 0x0070, 0x10, 3, 1),
594 	PIN_FIELD_BASE(126, 126, 6, 0x0070, 0x10, 2, 1),
595 	PIN_FIELD_BASE(127, 127, 6, 0x0070, 0x10, 10, 1),
596 };
597 
598 static const struct mtk_pin_field_calc mt8195_pin_r1_range[] = {
599 	PIN_FIELD_BASE(0, 0, 4, 0x0090, 0x10, 0, 1),
600 	PIN_FIELD_BASE(1, 1, 4, 0x0090, 0x10, 1, 1),
601 	PIN_FIELD_BASE(2, 2, 4, 0x0090, 0x10, 2, 1),
602 	PIN_FIELD_BASE(3, 3, 4, 0x0090, 0x10, 3, 1),
603 	PIN_FIELD_BASE(4, 4, 4, 0x0090, 0x10, 4, 1),
604 	PIN_FIELD_BASE(5, 5, 4, 0x0090, 0x10, 5, 1),
605 	PIN_FIELD_BASE(77, 77, 3, 0x0090, 0x10, 1, 1),
606 	PIN_FIELD_BASE(78, 78, 3, 0x0090, 0x10, 2, 1),
607 	PIN_FIELD_BASE(79, 79, 3, 0x0090, 0x10, 9, 1),
608 	PIN_FIELD_BASE(80, 80, 3, 0x0090, 0x10, 10, 1),
609 	PIN_FIELD_BASE(81, 81, 3, 0x0090, 0x10, 11, 1),
610 	PIN_FIELD_BASE(82, 82, 3, 0x0090, 0x10, 12, 1),
611 	PIN_FIELD_BASE(83, 83, 3, 0x0090, 0x10, 13, 1),
612 	PIN_FIELD_BASE(84, 84, 3, 0x0090, 0x10, 14, 1),
613 	PIN_FIELD_BASE(85, 85, 3, 0x0090, 0x10, 15, 1),
614 	PIN_FIELD_BASE(86, 86, 3, 0x0090, 0x10, 16, 1),
615 	PIN_FIELD_BASE(87, 87, 3, 0x0090, 0x10, 3, 1),
616 	PIN_FIELD_BASE(88, 88, 3, 0x0090, 0x10, 4, 1),
617 	PIN_FIELD_BASE(89, 89, 3, 0x0090, 0x10, 5, 1),
618 	PIN_FIELD_BASE(90, 90, 3, 0x0090, 0x10, 6, 1),
619 	PIN_FIELD_BASE(91, 91, 3, 0x0090, 0x10, 7, 1),
620 	PIN_FIELD_BASE(92, 92, 3, 0x0090, 0x10, 8, 1),
621 	PIN_FIELD_BASE(93, 93, 3, 0x0090, 0x10, 18, 1),
622 	PIN_FIELD_BASE(94, 94, 3, 0x0090, 0x10, 19, 1),
623 	PIN_FIELD_BASE(95, 95, 3, 0x0090, 0x10, 17, 1),
624 	PIN_FIELD_BASE(96, 96, 3, 0x0090, 0x10, 0, 1),
625 	PIN_FIELD_BASE(104, 104, 3, 0x0090, 0x10, 22, 1),
626 	PIN_FIELD_BASE(105, 105, 3, 0x0090, 0x10, 23, 1),
627 	PIN_FIELD_BASE(106, 106, 3, 0x0090, 0x10, 20, 1),
628 	PIN_FIELD_BASE(107, 107, 3, 0x0090, 0x10, 21, 1),
629 	PIN_FIELD_BASE(110, 110, 5, 0x0040, 0x10, 1, 1),
630 	PIN_FIELD_BASE(111, 111, 5, 0x0040, 0x10, 0, 1),
631 	PIN_FIELD_BASE(112, 112, 5, 0x0040, 0x10, 2, 1),
632 	PIN_FIELD_BASE(113, 113, 5, 0x0040, 0x10, 3, 1),
633 	PIN_FIELD_BASE(114, 114, 5, 0x0040, 0x10, 4, 1),
634 	PIN_FIELD_BASE(115, 115, 5, 0x0040, 0x10, 5, 1),
635 	PIN_FIELD_BASE(116, 116, 6, 0x0080, 0x10, 9, 1),
636 	PIN_FIELD_BASE(117, 117, 6, 0x0080, 0x10, 8, 1),
637 	PIN_FIELD_BASE(118, 118, 6, 0x0080, 0x10, 7, 1),
638 	PIN_FIELD_BASE(119, 119, 6, 0x0080, 0x10, 6, 1),
639 	PIN_FIELD_BASE(120, 120, 6, 0x0080, 0x10, 11, 1),
640 	PIN_FIELD_BASE(121, 121, 6, 0x0080, 0x10, 1, 1),
641 	PIN_FIELD_BASE(122, 122, 6, 0x0080, 0x10, 0, 1),
642 	PIN_FIELD_BASE(123, 123, 6, 0x0080, 0x10, 5, 1),
643 	PIN_FIELD_BASE(124, 124, 6, 0x0080, 0x10, 4, 1),
644 	PIN_FIELD_BASE(125, 125, 6, 0x0080, 0x10, 3, 1),
645 	PIN_FIELD_BASE(126, 126, 6, 0x0080, 0x10, 2, 1),
646 	PIN_FIELD_BASE(127, 127, 6, 0x0080, 0x10, 10, 1),
647 };
648 
649 static const struct mtk_pin_field_calc mt8195_pin_drv_range[] = {
650 	PIN_FIELD_BASE(0, 0, 4, 0x000, 0x10, 0, 3),
651 	PIN_FIELD_BASE(1, 1, 4, 0x000, 0x10, 3, 3),
652 	PIN_FIELD_BASE(2, 2, 4, 0x000, 0x10, 6, 3),
653 	PIN_FIELD_BASE(3, 3, 4, 0x000, 0x10, 9, 3),
654 	PIN_FIELD_BASE(4, 4, 4, 0x000, 0x10, 12, 3),
655 	PIN_FIELD_BASE(5, 5, 4, 0x000, 0x10, 15, 3),
656 	PINS_FIELD_BASE(6, 7, 4, 0x000, 0x10, 18, 3),
657 	PIN_FIELD_BASE(8, 8, 4, 0x010, 0x10, 6, 3),
658 	PIN_FIELD_BASE(9, 9, 4, 0x000, 0x10, 21, 3),
659 	PIN_FIELD_BASE(10, 10, 4, 0x010, 0x10, 9, 3),
660 	PIN_FIELD_BASE(11, 11, 4, 0x000, 0x10, 24, 3),
661 	PIN_FIELD_BASE(12, 12, 4, 0x010, 0x10, 12, 3),
662 	PIN_FIELD_BASE(13, 13, 4, 0x000, 0x10, 27, 3),
663 	PIN_FIELD_BASE(14, 14, 4, 0x010, 0x10, 15, 3),
664 	PIN_FIELD_BASE(15, 15, 4, 0x010, 0x10, 0, 3),
665 	PIN_FIELD_BASE(16, 16, 4, 0x010, 0x10, 18, 3),
666 	PIN_FIELD_BASE(17, 17, 4, 0x010, 0x10, 3, 3),
667 	PIN_FIELD_BASE(18, 18, 2, 0x010, 0x10, 6, 3),
668 	PIN_FIELD_BASE(19, 19, 2, 0x010, 0x10, 3, 3),
669 	PIN_FIELD_BASE(20, 20, 2, 0x010, 0x10, 0, 3),
670 	PIN_FIELD_BASE(21, 21, 2, 0x000, 0x10, 27, 3),
671 	PIN_FIELD_BASE(22, 22, 2, 0x000, 0x10, 0, 3),
672 	PIN_FIELD_BASE(23, 23, 2, 0x000, 0x10, 3, 3),
673 	PIN_FIELD_BASE(24, 24, 2, 0x000, 0x10, 6, 3),
674 	PIN_FIELD_BASE(25, 25, 2, 0x000, 0x10, 12, 3),
675 	PIN_FIELD_BASE(26, 26, 2, 0x000, 0x10, 9, 3),
676 	PIN_FIELD_BASE(27, 27, 2, 0x000, 0x10, 15, 3),
677 	PIN_FIELD_BASE(28, 28, 2, 0x000, 0x10, 18, 3),
678 	PIN_FIELD_BASE(29, 29, 2, 0x000, 0x10, 21, 3),
679 	PIN_FIELD_BASE(30, 30, 2, 0x000, 0x10, 24, 3),
680 	PINS_FIELD_BASE(31, 33, 1, 0x010, 0x10, 0, 3),
681 	PIN_FIELD_BASE(34, 34, 1, 0x000, 0x10, 21, 3),
682 	PIN_FIELD_BASE(35, 35, 1, 0x000, 0x10, 24, 3),
683 	PIN_FIELD_BASE(36, 36, 1, 0x010, 0x10, 0, 3),
684 	PIN_FIELD_BASE(37, 37, 1, 0x010, 0x10, 21, 3),
685 	PINS_FIELD_BASE(38, 39, 1, 0x010, 0x10, 3, 3),
686 	PIN_FIELD_BASE(40, 40, 1, 0x010, 0x10, 27, 3),
687 	PIN_FIELD_BASE(41, 41, 1, 0x010, 0x10, 24, 3),
688 	PIN_FIELD_BASE(42, 42, 1, 0x020, 0x10, 3, 3),
689 	PIN_FIELD_BASE(43, 43, 1, 0x020, 0x10, 0, 3),
690 	PIN_FIELD_BASE(44, 44, 1, 0x030, 0x10, 0, 3),
691 	PIN_FIELD_BASE(45, 45, 1, 0x030, 0x10, 3, 3),
692 	PINS_FIELD_BASE(46, 47, 1, 0x010, 0x10, 3, 3),
693 	PINS_FIELD_BASE(48, 51, 1, 0x010, 0x10, 6, 3),
694 	PINS_FIELD_BASE(52, 55, 1, 0x010, 0x10, 9, 3),
695 	PINS_FIELD_BASE(56, 59, 1, 0x010, 0x10, 12, 3),
696 	PINS_FIELD_BASE(60, 63, 1, 0x010, 0x10, 15, 3),
697 	PIN_FIELD_BASE(64, 64, 1, 0x010, 0x10, 18, 3),
698 	PINS_FIELD_BASE(65, 68, 1, 0x000, 0x10, 27, 3),
699 	PIN_FIELD_BASE(69, 69, 1, 0x000, 0x10, 0, 3),
700 	PIN_FIELD_BASE(70, 70, 1, 0x000, 0x10, 18, 3),
701 	PIN_FIELD_BASE(71, 71, 1, 0x000, 0x10, 12, 3),
702 	PIN_FIELD_BASE(72, 72, 1, 0x000, 0x10, 15, 3),
703 	PIN_FIELD_BASE(73, 73, 1, 0x000, 0x10, 3, 3),
704 	PIN_FIELD_BASE(74, 74, 1, 0x000, 0x10, 6, 3),
705 	PIN_FIELD_BASE(75, 75, 1, 0x000, 0x10, 9, 3),
706 	PIN_FIELD_BASE(76, 76, 1, 0x010, 0x10, 18, 3),
707 	PIN_FIELD_BASE(77, 77, 3, 0x000, 0x10, 0, 3),
708 	PIN_FIELD_BASE(78, 78, 3, 0x000, 0x10, 15, 3),
709 	PIN_FIELD_BASE(79, 79, 3, 0x000, 0x10, 18, 3),
710 	PIN_FIELD_BASE(80, 80, 3, 0x000, 0x10, 21, 3),
711 	PIN_FIELD_BASE(81, 81, 3, 0x000, 0x10, 24, 3),
712 	PIN_FIELD_BASE(82, 82, 3, 0x000, 0x10, 27, 3),
713 	PIN_FIELD_BASE(83, 83, 3, 0x010, 0x10, 0, 3),
714 	PIN_FIELD_BASE(84, 84, 3, 0x010, 0x10, 3, 3),
715 	PINS_FIELD_BASE(85, 88, 3, 0x010, 0x10, 15, 3),
716 	PIN_FIELD_BASE(89, 89, 3, 0x000, 0x10, 3, 3),
717 	PIN_FIELD_BASE(90, 90, 3, 0x000, 0x10, 6, 3),
718 	PIN_FIELD_BASE(91, 91, 3, 0x000, 0x10, 9, 3),
719 	PIN_FIELD_BASE(92, 92, 3, 0x000, 0x10, 12, 3),
720 	PIN_FIELD_BASE(93, 93, 3, 0x010, 0x10, 6, 3),
721 	PIN_FIELD_BASE(94, 94, 3, 0x010, 0x10, 9, 3),
722 	PINS_FIELD_BASE(95, 98, 3, 0x010, 0x10, 18, 3),
723 	PINS_FIELD_BASE(99, 102, 3, 0x010, 0x10, 21, 3),
724 	PINS_FIELD_BASE(103, 104, 3, 0x010, 0x10, 24, 3),
725 	PIN_FIELD_BASE(105, 105, 3, 0x010, 0x10, 27, 3),
726 	PINS_FIELD_BASE(106, 107, 3, 0x010, 0x10, 24, 3),
727 	PINS_FIELD_BASE(108, 109, 3, 0x010, 0x10, 27, 3),
728 	PIN_FIELD_BASE(110, 110, 5, 0x000, 0x10, 3, 3),
729 	PIN_FIELD_BASE(111, 111, 5, 0x000, 0x10, 0, 3),
730 	PIN_FIELD_BASE(112, 112, 5, 0x000, 0x10, 6, 3),
731 	PIN_FIELD_BASE(113, 113, 5, 0x000, 0x10, 9, 3),
732 	PIN_FIELD_BASE(114, 114, 5, 0x000, 0x10, 12, 3),
733 	PIN_FIELD_BASE(115, 115, 5, 0x000, 0x10, 15, 3),
734 	PIN_FIELD_BASE(116, 116, 6, 0x000, 0x10, 27, 3),
735 	PIN_FIELD_BASE(117, 117, 6, 0x000, 0x10, 24, 3),
736 	PIN_FIELD_BASE(118, 118, 6, 0x000, 0x10, 21, 3),
737 	PIN_FIELD_BASE(119, 119, 6, 0x000, 0x10, 18, 3),
738 	PIN_FIELD_BASE(120, 120, 6, 0x010, 0x10, 3, 3),
739 	PIN_FIELD_BASE(121, 121, 6, 0x000, 0x10, 3, 3),
740 	PIN_FIELD_BASE(122, 122, 6, 0x000, 0x10, 0, 3),
741 	PIN_FIELD_BASE(123, 123, 6, 0x000, 0x10, 15, 3),
742 	PIN_FIELD_BASE(124, 124, 6, 0x000, 0x10, 12, 3),
743 	PIN_FIELD_BASE(125, 125, 6, 0x000, 0x10, 9, 3),
744 	PIN_FIELD_BASE(126, 126, 6, 0x000, 0x10, 6, 3),
745 	PIN_FIELD_BASE(127, 127, 6, 0x010, 0x10, 0, 3),
746 	PIN_FIELD_BASE(128, 128, 3, 0x010, 0x10, 27, 3),
747 	PINS_FIELD_BASE(129, 130, 3, 0x020, 0x10, 0, 3),
748 	PINS_FIELD_BASE(131, 131, 3, 0x010, 0x10, 12, 3),
749 	PIN_FIELD_BASE(132, 132, 6, 0x010, 0x10, 9, 3),
750 	PIN_FIELD_BASE(133, 133, 6, 0x010, 0x10, 6, 3),
751 	PIN_FIELD_BASE(134, 134, 6, 0x010, 0x10, 15, 3),
752 	PIN_FIELD_BASE(135, 135, 6, 0x010, 0x10, 12, 3),
753 	PIN_FIELD_BASE(136, 136, 1, 0x020, 0x10, 9, 3),
754 	PIN_FIELD_BASE(137, 137, 1, 0x020, 0x10, 6, 3),
755 	PIN_FIELD_BASE(138, 138, 1, 0x020, 0x10, 15, 3),
756 	PIN_FIELD_BASE(139, 139, 1, 0x020, 0x10, 12, 3),
757 	PIN_FIELD_BASE(140, 140, 1, 0x020, 0x10, 21, 3),
758 	PIN_FIELD_BASE(141, 141, 1, 0x020, 0x10, 18, 3),
759 	PIN_FIELD_BASE(142, 142, 1, 0x020, 0x10, 27, 3),
760 	PIN_FIELD_BASE(143, 143, 1, 0x020, 0x10, 24, 3),
761 };
762 
763 static const struct mtk_pin_field_calc mt8195_pin_drv_adv_range[] = {
764 	PIN_FIELD_BASE(8, 8, 4, 0x020, 0x10, 15, 3),
765 	PIN_FIELD_BASE(9, 9, 4, 0x020, 0x10, 0, 3),
766 	PIN_FIELD_BASE(10, 10, 4, 0x020, 0x10, 18, 3),
767 	PIN_FIELD_BASE(11, 11, 4, 0x020, 0x10, 3, 3),
768 	PIN_FIELD_BASE(12, 12, 4, 0x020, 0x10, 21, 3),
769 	PIN_FIELD_BASE(13, 13, 4, 0x020, 0x10, 6, 3),
770 	PIN_FIELD_BASE(14, 14, 4, 0x020, 0x10, 24, 3),
771 	PIN_FIELD_BASE(15, 15, 4, 0x020, 0x10, 9, 3),
772 	PIN_FIELD_BASE(16, 16, 4, 0x020, 0x10, 27, 3),
773 	PIN_FIELD_BASE(17, 17, 4, 0x020, 0x10, 12, 3),
774 	PIN_FIELD_BASE(29, 29, 2, 0x020, 0x10, 0, 3),
775 	PIN_FIELD_BASE(30, 30, 2, 0x020, 0x10, 3, 3),
776 	PIN_FIELD_BASE(34, 34, 1, 0x040, 0x10, 0, 3),
777 	PIN_FIELD_BASE(35, 35, 1, 0x040, 0x10, 3, 3),
778 	PIN_FIELD_BASE(44, 44, 1, 0x040, 0x10, 6, 3),
779 	PIN_FIELD_BASE(45, 45, 1, 0x040, 0x10, 9, 3),
780 };
781 
782 static const struct mtk_pin_field_calc mt8195_pin_rsel_range[] = {
783 	PIN_FIELD_BASE(8, 8, 4, 0x0c0, 0x10, 15, 3),
784 	PIN_FIELD_BASE(9, 9, 4, 0x0c0, 0x10, 0, 3),
785 	PIN_FIELD_BASE(10, 10, 4, 0x0c0, 0x10, 18, 3),
786 	PIN_FIELD_BASE(11, 11, 4, 0x0c0, 0x10, 3, 3),
787 	PIN_FIELD_BASE(12, 12, 4, 0x0c0, 0x10, 21, 3),
788 	PIN_FIELD_BASE(13, 13, 4, 0x0c0, 0x10, 6, 3),
789 	PIN_FIELD_BASE(14, 14, 4, 0x0c0, 0x10, 24, 3),
790 	PIN_FIELD_BASE(15, 15, 4, 0x0c0, 0x10, 9, 3),
791 	PIN_FIELD_BASE(16, 16, 4, 0x0c0, 0x10, 27, 3),
792 	PIN_FIELD_BASE(17, 17, 4, 0x0c0, 0x10, 12, 3),
793 	PIN_FIELD_BASE(29, 29, 2, 0x080, 0x10, 0, 3),
794 	PIN_FIELD_BASE(30, 30, 2, 0x080, 0x10, 3, 3),
795 	PIN_FIELD_BASE(34, 34, 1, 0x0e0, 0x10, 0, 3),
796 	PIN_FIELD_BASE(35, 35, 1, 0x0e0, 0x10, 3, 3),
797 	PIN_FIELD_BASE(44, 44, 1, 0x0e0, 0x10, 6, 3),
798 	PIN_FIELD_BASE(45, 45, 1, 0x0e0, 0x10, 9, 3),
799 };
800 
801 static const struct mtk_pin_rsel mt8195_pin_rsel_val_range[] = {
802 	PIN_RSEL(8, 17, 0x0, 75000, 75000),
803 	PIN_RSEL(8, 17, 0x1, 10000, 5000),
804 	PIN_RSEL(8, 17, 0x2, 5000, 75000),
805 	PIN_RSEL(8, 17, 0x3, 4000, 5000),
806 	PIN_RSEL(8, 17, 0x4, 3000, 75000),
807 	PIN_RSEL(8, 17, 0x5, 2000, 5000),
808 	PIN_RSEL(8, 17, 0x6, 1500, 75000),
809 	PIN_RSEL(8, 17, 0x7, 1000, 5000),
810 	PIN_RSEL(29, 30, 0x0, 75000, 75000),
811 	PIN_RSEL(29, 30, 0x1, 10000, 5000),
812 	PIN_RSEL(29, 30, 0x2, 5000, 75000),
813 	PIN_RSEL(29, 30, 0x3, 4000, 5000),
814 	PIN_RSEL(29, 30, 0x4, 3000, 75000),
815 	PIN_RSEL(29, 30, 0x5, 2000, 5000),
816 	PIN_RSEL(29, 30, 0x6, 1500, 75000),
817 	PIN_RSEL(29, 30, 0x7, 1000, 5000),
818 	PIN_RSEL(34, 35, 0x0, 75000, 75000),
819 	PIN_RSEL(34, 35, 0x1, 10000, 5000),
820 	PIN_RSEL(34, 35, 0x2, 5000, 75000),
821 	PIN_RSEL(34, 35, 0x3, 4000, 5000),
822 	PIN_RSEL(34, 35, 0x4, 3000, 75000),
823 	PIN_RSEL(34, 35, 0x5, 2000, 5000),
824 	PIN_RSEL(34, 35, 0x6, 1500, 75000),
825 	PIN_RSEL(34, 35, 0x7, 1000, 5000),
826 	PIN_RSEL(44, 45, 0x0, 75000, 75000),
827 	PIN_RSEL(44, 45, 0x1, 10000, 5000),
828 	PIN_RSEL(44, 45, 0x2, 5000, 75000),
829 	PIN_RSEL(44, 45, 0x3, 4000, 5000),
830 	PIN_RSEL(44, 45, 0x4, 3000, 75000),
831 	PIN_RSEL(44, 45, 0x5, 2000, 5000),
832 	PIN_RSEL(44, 45, 0x6, 1500, 75000),
833 	PIN_RSEL(44, 45, 0x7, 1000, 5000),
834 };
835 
836 static const unsigned int mt8195_pull_type[] = {
837 	MTK_PULL_PUPD_R1R0_TYPE /* 0 */, MTK_PULL_PUPD_R1R0_TYPE /* 1 */,
838 	MTK_PULL_PUPD_R1R0_TYPE /* 2 */, MTK_PULL_PUPD_R1R0_TYPE /* 3 */,
839 	MTK_PULL_PUPD_R1R0_TYPE /* 4 */, MTK_PULL_PUPD_R1R0_TYPE /* 5 */,
840 	MTK_PULL_PU_PD_TYPE /* 6 */, MTK_PULL_PU_PD_TYPE /* 7 */,
841 	MTK_PULL_PU_PD_RSEL_TYPE /* 8 */, MTK_PULL_PU_PD_RSEL_TYPE /* 9 */,
842 	MTK_PULL_PU_PD_RSEL_TYPE /* 10 */, MTK_PULL_PU_PD_RSEL_TYPE /* 11 */,
843 	MTK_PULL_PU_PD_RSEL_TYPE /* 12 */, MTK_PULL_PU_PD_RSEL_TYPE /* 13 */,
844 	MTK_PULL_PU_PD_RSEL_TYPE /* 14 */, MTK_PULL_PU_PD_RSEL_TYPE /* 15 */,
845 	MTK_PULL_PU_PD_RSEL_TYPE /* 16 */, MTK_PULL_PU_PD_RSEL_TYPE /* 17 */,
846 	MTK_PULL_PU_PD_TYPE /* 18 */, MTK_PULL_PU_PD_TYPE /* 19 */,
847 	MTK_PULL_PU_PD_TYPE /* 20 */, MTK_PULL_PU_PD_TYPE /* 21 */,
848 	MTK_PULL_PU_PD_TYPE /* 22 */, MTK_PULL_PU_PD_TYPE /* 23 */,
849 	MTK_PULL_PU_PD_TYPE /* 24 */, MTK_PULL_PU_PD_TYPE /* 25 */,
850 	MTK_PULL_PU_PD_TYPE /* 26 */, MTK_PULL_PU_PD_TYPE /* 27 */,
851 	MTK_PULL_PU_PD_TYPE /* 28 */, MTK_PULL_PU_PD_RSEL_TYPE /* 29 */,
852 	MTK_PULL_PU_PD_RSEL_TYPE /* 30 */, MTK_PULL_PU_PD_TYPE /* 31 */,
853 	MTK_PULL_PU_PD_TYPE /* 32 */, MTK_PULL_PU_PD_TYPE /* 33 */,
854 	MTK_PULL_PU_PD_RSEL_TYPE /* 34 */, MTK_PULL_PU_PD_RSEL_TYPE /* 35 */,
855 	MTK_PULL_PU_PD_TYPE /* 36 */, MTK_PULL_PU_PD_TYPE /* 37 */,
856 	MTK_PULL_PU_PD_TYPE /* 38 */, MTK_PULL_PU_PD_TYPE /* 39 */,
857 	MTK_PULL_PU_PD_TYPE /* 40 */, MTK_PULL_PU_PD_TYPE /* 41 */,
858 	MTK_PULL_PU_PD_TYPE /* 42 */, MTK_PULL_PU_PD_TYPE /* 43 */,
859 	MTK_PULL_PU_PD_RSEL_TYPE /* 44 */, MTK_PULL_PU_PD_RSEL_TYPE /* 45 */,
860 	MTK_PULL_PU_PD_TYPE /* 46 */, MTK_PULL_PU_PD_TYPE /* 47 */,
861 	MTK_PULL_PU_PD_TYPE /* 48 */, MTK_PULL_PU_PD_TYPE /* 49 */,
862 	MTK_PULL_PU_PD_TYPE /* 50 */, MTK_PULL_PU_PD_TYPE /* 51 */,
863 	MTK_PULL_PU_PD_TYPE /* 52 */, MTK_PULL_PU_PD_TYPE /* 53 */,
864 	MTK_PULL_PU_PD_TYPE /* 54 */, MTK_PULL_PU_PD_TYPE /* 55 */,
865 	MTK_PULL_PU_PD_TYPE /* 56 */, MTK_PULL_PU_PD_TYPE /* 57 */,
866 	MTK_PULL_PU_PD_TYPE /* 58 */, MTK_PULL_PU_PD_TYPE /* 59 */,
867 	MTK_PULL_PU_PD_TYPE /* 60 */, MTK_PULL_PU_PD_TYPE /* 61 */,
868 	MTK_PULL_PU_PD_TYPE /* 62 */, MTK_PULL_PU_PD_TYPE /* 63 */,
869 	MTK_PULL_PU_PD_TYPE /* 64 */, MTK_PULL_PU_PD_TYPE /* 65 */,
870 	MTK_PULL_PU_PD_TYPE /* 66 */, MTK_PULL_PU_PD_TYPE /* 67 */,
871 	MTK_PULL_PU_PD_TYPE /* 68 */, MTK_PULL_PU_PD_TYPE /* 69 */,
872 	MTK_PULL_PU_PD_TYPE /* 70 */, MTK_PULL_PU_PD_TYPE /* 71 */,
873 	MTK_PULL_PU_PD_TYPE /* 72 */, MTK_PULL_PU_PD_TYPE /* 73 */,
874 	MTK_PULL_PU_PD_TYPE /* 74 */, MTK_PULL_PU_PD_TYPE /* 75 */,
875 	MTK_PULL_PU_PD_TYPE /* 76 */, MTK_PULL_PUPD_R1R0_TYPE /* 77 */,
876 	MTK_PULL_PUPD_R1R0_TYPE /* 78 */, MTK_PULL_PUPD_R1R0_TYPE /* 79 */,
877 	MTK_PULL_PUPD_R1R0_TYPE /* 80 */, MTK_PULL_PUPD_R1R0_TYPE /* 81 */,
878 	MTK_PULL_PUPD_R1R0_TYPE /* 82 */, MTK_PULL_PUPD_R1R0_TYPE /* 83 */,
879 	MTK_PULL_PUPD_R1R0_TYPE /* 84 */, MTK_PULL_PUPD_R1R0_TYPE /* 85 */,
880 	MTK_PULL_PUPD_R1R0_TYPE /* 86 */, MTK_PULL_PUPD_R1R0_TYPE /* 87 */,
881 	MTK_PULL_PUPD_R1R0_TYPE /* 88 */, MTK_PULL_PUPD_R1R0_TYPE /* 89 */,
882 	MTK_PULL_PUPD_R1R0_TYPE /* 90 */, MTK_PULL_PUPD_R1R0_TYPE /* 91 */,
883 	MTK_PULL_PUPD_R1R0_TYPE /* 92 */, MTK_PULL_PUPD_R1R0_TYPE /* 93 */,
884 	MTK_PULL_PUPD_R1R0_TYPE /* 94 */, MTK_PULL_PUPD_R1R0_TYPE /* 95 */,
885 	MTK_PULL_PUPD_R1R0_TYPE /* 96 */, MTK_PULL_PU_PD_TYPE /* 97 */,
886 	MTK_PULL_PU_PD_TYPE /* 98 */, MTK_PULL_PU_PD_TYPE /* 99 */,
887 	MTK_PULL_PU_PD_TYPE /* 100 */, MTK_PULL_PU_PD_TYPE /* 101 */,
888 	MTK_PULL_PU_PD_TYPE /* 102 */, MTK_PULL_PU_PD_TYPE /* 103 */,
889 	MTK_PULL_PUPD_R1R0_TYPE /* 104 */, MTK_PULL_PUPD_R1R0_TYPE /* 105 */,
890 	MTK_PULL_PUPD_R1R0_TYPE /* 106 */, MTK_PULL_PUPD_R1R0_TYPE /* 107 */,
891 	MTK_PULL_PU_PD_TYPE /* 108 */, MTK_PULL_PU_PD_TYPE /* 109 */,
892 	MTK_PULL_PUPD_R1R0_TYPE /* 110 */, MTK_PULL_PUPD_R1R0_TYPE /* 111 */,
893 	MTK_PULL_PUPD_R1R0_TYPE /* 112 */, MTK_PULL_PUPD_R1R0_TYPE /* 113 */,
894 	MTK_PULL_PUPD_R1R0_TYPE /* 114 */, MTK_PULL_PUPD_R1R0_TYPE /* 115 */,
895 	MTK_PULL_PUPD_R1R0_TYPE /* 116 */, MTK_PULL_PUPD_R1R0_TYPE /* 117 */,
896 	MTK_PULL_PUPD_R1R0_TYPE /* 118 */, MTK_PULL_PUPD_R1R0_TYPE /* 119 */,
897 	MTK_PULL_PUPD_R1R0_TYPE /* 120 */, MTK_PULL_PUPD_R1R0_TYPE /* 121 */,
898 	MTK_PULL_PUPD_R1R0_TYPE /* 122 */, MTK_PULL_PUPD_R1R0_TYPE /* 123 */,
899 	MTK_PULL_PUPD_R1R0_TYPE /* 124 */, MTK_PULL_PUPD_R1R0_TYPE /* 125 */,
900 	MTK_PULL_PUPD_R1R0_TYPE /* 126 */, MTK_PULL_PUPD_R1R0_TYPE /* 127 */,
901 	MTK_PULL_PU_PD_TYPE /* 128 */, MTK_PULL_PU_PD_TYPE /* 129 */,
902 	MTK_PULL_PU_PD_TYPE /* 130 */, MTK_PULL_PU_PD_TYPE /* 131 */,
903 	MTK_PULL_PU_PD_TYPE /* 132 */, MTK_PULL_PU_PD_TYPE /* 133 */,
904 	MTK_PULL_PU_PD_TYPE /* 134 */, MTK_PULL_PU_PD_TYPE /* 135 */,
905 	MTK_PULL_PU_PD_TYPE /* 136 */, MTK_PULL_PU_PD_TYPE /* 137 */,
906 	MTK_PULL_PU_PD_TYPE /* 138 */, MTK_PULL_PU_PD_TYPE /* 139 */,
907 	MTK_PULL_PU_PD_TYPE /* 140 */, MTK_PULL_PU_PD_TYPE /* 141 */,
908 	MTK_PULL_PU_PD_TYPE /* 142 */, MTK_PULL_PU_PD_TYPE /* 143 */,
909 };
910 
911 static const struct mtk_pin_reg_calc mt8195_reg_cals[PINCTRL_PIN_REG_MAX] = {
912 	[PINCTRL_PIN_REG_MODE] = MTK_RANGE(mt8195_pin_mode_range),
913 	[PINCTRL_PIN_REG_DIR] = MTK_RANGE(mt8195_pin_dir_range),
914 	[PINCTRL_PIN_REG_DI] = MTK_RANGE(mt8195_pin_di_range),
915 	[PINCTRL_PIN_REG_DO] = MTK_RANGE(mt8195_pin_do_range),
916 	[PINCTRL_PIN_REG_SMT] = MTK_RANGE(mt8195_pin_smt_range),
917 	[PINCTRL_PIN_REG_IES] = MTK_RANGE(mt8195_pin_ies_range),
918 	[PINCTRL_PIN_REG_PU] = MTK_RANGE(mt8195_pin_pu_range),
919 	[PINCTRL_PIN_REG_PD] = MTK_RANGE(mt8195_pin_pd_range),
920 	[PINCTRL_PIN_REG_DRV] = MTK_RANGE(mt8195_pin_drv_range),
921 	[PINCTRL_PIN_REG_PUPD] = MTK_RANGE(mt8195_pin_pupd_range),
922 	[PINCTRL_PIN_REG_R0] = MTK_RANGE(mt8195_pin_r0_range),
923 	[PINCTRL_PIN_REG_R1] = MTK_RANGE(mt8195_pin_r1_range),
924 	[PINCTRL_PIN_REG_DRV_ADV] = MTK_RANGE(mt8195_pin_drv_adv_range),
925 	[PINCTRL_PIN_REG_RSEL] = MTK_RANGE(mt8195_pin_rsel_range),
926 };
927 
928 static const char * const mt8195_pinctrl_register_base_names[] = {
929 	"iocfg0", "iocfg_bm", "iocfg_bl", "iocfg_br", "iocfg_lm",
930 	"iocfg_rb", "iocfg_tl",
931 };
932 
933 static const struct mtk_eint_hw mt8195_eint_hw = {
934 	.port_mask = 0xf,
935 	.ports     = 7,
936 	.ap_num    = 225,
937 	.db_cnt    = 32,
938 	.db_time   = debounce_time_mt6765,
939 };
940 
941 static const struct mtk_pin_soc mt8195_data = {
942 	.reg_cal = mt8195_reg_cals,
943 	.pins = mtk_pins_mt8195,
944 	.npins = ARRAY_SIZE(mtk_pins_mt8195),
945 	.ngrps = ARRAY_SIZE(mtk_pins_mt8195),
946 	.eint_hw = &mt8195_eint_hw,
947 	.nfuncs = 8,
948 	.gpio_m = 0,
949 	.base_names = mt8195_pinctrl_register_base_names,
950 	.nbase_names = ARRAY_SIZE(mt8195_pinctrl_register_base_names),
951 	.pull_type = mt8195_pull_type,
952 	.pin_rsel = mt8195_pin_rsel_val_range,
953 	.npin_rsel = ARRAY_SIZE(mt8195_pin_rsel_val_range),
954 	.bias_set_combo = mtk_pinconf_bias_set_combo,
955 	.bias_get_combo = mtk_pinconf_bias_get_combo,
956 	.drive_set = mtk_pinconf_drive_set_rev1,
957 	.drive_get = mtk_pinconf_drive_get_rev1,
958 	.adv_drive_get = mtk_pinconf_adv_drive_get_raw,
959 	.adv_drive_set = mtk_pinconf_adv_drive_set_raw,
960 };
961 
962 static const struct of_device_id mt8195_pinctrl_of_match[] = {
963 	{ .compatible = "mediatek,mt8195-pinctrl", .data = &mt8195_data },
964 	{ }
965 };
966 
967 static struct platform_driver mt8195_pinctrl_driver = {
968 	.driver = {
969 		.name = "mt8195-pinctrl",
970 		.of_match_table = mt8195_pinctrl_of_match,
971 		.pm = &mtk_paris_pinctrl_pm_ops,
972 	},
973 	.probe = mtk_paris_pinctrl_probe,
974 };
975 
976 static int __init mt8195_pinctrl_init(void)
977 {
978 	return platform_driver_register(&mt8195_pinctrl_driver);
979 }
980 arch_initcall(mt8195_pinctrl_init);
981