1 // SPDX-License-Identifier: GPL-2.0
2 /*
3 * Copyright (C) 2022 MediaTek Inc.
4 * Author: Hui Liu <hui.liu@mediatek.com>
5 *
6 */
7
8 #include <linux/module.h>
9 #include "pinctrl-mtk-mt8188.h"
10 #include "pinctrl-paris.h"
11
12 /* MT8188 have multiple bases to program pin configuration listed as the below:
13 * iocfg[0]:0x10005000, iocfg[1]:0x11c00000, iocfg[2]:0x11e10000,
14 * iocfg[3]:0x11e20000, iocfg[4]:0x11ea0000
15 * _i_based could be used to indicate what base the pin should be mapped into.
16 */
17
18 #define PIN_FIELD_BASE(s_pin, e_pin, i_base, s_addr, x_addrs, s_bit, x_bits) \
19 PIN_FIELD_CALC(s_pin, e_pin, i_base, s_addr, x_addrs, s_bit, x_bits, \
20 32, 0)
21
22 #define PINS_FIELD_BASE(s_pin, e_pin, i_base, s_addr, x_addrs, s_bit, x_bits) \
23 PIN_FIELD_CALC(s_pin, e_pin, i_base, s_addr, x_addrs, s_bit, x_bits, \
24 32, 1)
25
26 static const struct mtk_pin_field_calc mt8188_pin_mode_range[] = {
27 PIN_FIELD(0, 177, 0x0300, 0x10, 0, 4),
28 };
29
30 static const struct mtk_pin_field_calc mt8188_pin_dir_range[] = {
31 PIN_FIELD(0, 177, 0x0000, 0x10, 0, 1),
32 };
33
34 static const struct mtk_pin_field_calc mt8188_pin_di_range[] = {
35 PIN_FIELD(0, 177, 0x0200, 0x10, 0, 1),
36 };
37
38 static const struct mtk_pin_field_calc mt8188_pin_do_range[] = {
39 PIN_FIELD(0, 177, 0x0100, 0x10, 0, 1),
40 };
41
42 static const struct mtk_pin_field_calc mt8188_pin_smt_range[] = {
43 PIN_FIELD_BASE(0, 0, 1, 0x0170, 0x10, 8, 1),
44 PIN_FIELD_BASE(1, 1, 1, 0x0170, 0x10, 9, 1),
45 PIN_FIELD_BASE(2, 2, 1, 0x0170, 0x10, 10, 1),
46 PIN_FIELD_BASE(3, 3, 1, 0x0170, 0x10, 11, 1),
47 PIN_FIELD_BASE(4, 4, 1, 0x0170, 0x10, 18, 1),
48 PIN_FIELD_BASE(5, 5, 1, 0x0170, 0x10, 18, 1),
49 PIN_FIELD_BASE(6, 6, 1, 0x0170, 0x10, 18, 1),
50 PIN_FIELD_BASE(7, 7, 1, 0x0170, 0x10, 12, 1),
51 PIN_FIELD_BASE(8, 8, 1, 0x0170, 0x10, 13, 1),
52 PIN_FIELD_BASE(9, 9, 1, 0x0170, 0x10, 14, 1),
53 PIN_FIELD_BASE(10, 10, 1, 0x0170, 0x10, 15, 1),
54 PIN_FIELD_BASE(11, 11, 1, 0x0170, 0x10, 19, 1),
55 PIN_FIELD_BASE(12, 12, 2, 0x0160, 0x10, 12, 1),
56 PIN_FIELD_BASE(13, 13, 2, 0x0160, 0x10, 13, 1),
57 PIN_FIELD_BASE(14, 14, 2, 0x0160, 0x10, 14, 1),
58 PIN_FIELD_BASE(15, 15, 2, 0x0160, 0x10, 15, 1),
59 PIN_FIELD_BASE(16, 16, 3, 0x00d0, 0x10, 10, 1),
60 PIN_FIELD_BASE(17, 17, 3, 0x00d0, 0x10, 10, 1),
61 PIN_FIELD_BASE(18, 18, 4, 0x00e0, 0x10, 9, 1),
62 PIN_FIELD_BASE(19, 19, 4, 0x00e0, 0x10, 9, 1),
63 PIN_FIELD_BASE(20, 20, 4, 0x00e0, 0x10, 9, 1),
64 PIN_FIELD_BASE(21, 21, 4, 0x00e0, 0x10, 9, 1),
65 PIN_FIELD_BASE(22, 22, 4, 0x00e0, 0x10, 0, 1),
66 PIN_FIELD_BASE(23, 23, 4, 0x00e0, 0x10, 1, 1),
67 PIN_FIELD_BASE(24, 24, 4, 0x00e0, 0x10, 2, 1),
68 PIN_FIELD_BASE(25, 25, 1, 0x0170, 0x10, 17, 1),
69 PIN_FIELD_BASE(26, 26, 1, 0x0170, 0x10, 17, 1),
70 PIN_FIELD_BASE(27, 27, 1, 0x0170, 0x10, 17, 1),
71 PIN_FIELD_BASE(28, 28, 1, 0x0170, 0x10, 18, 1),
72 PIN_FIELD_BASE(29, 29, 1, 0x0170, 0x10, 16, 1),
73 PIN_FIELD_BASE(30, 30, 1, 0x0170, 0x10, 17, 1),
74 PIN_FIELD_BASE(31, 31, 1, 0x0170, 0x10, 19, 1),
75 PIN_FIELD_BASE(32, 32, 1, 0x0170, 0x10, 19, 1),
76 PIN_FIELD_BASE(33, 33, 1, 0x0170, 0x10, 20, 1),
77 PIN_FIELD_BASE(34, 34, 1, 0x0170, 0x10, 20, 1),
78 PIN_FIELD_BASE(35, 35, 1, 0x0170, 0x10, 19, 1),
79 PIN_FIELD_BASE(36, 36, 1, 0x0170, 0x10, 20, 1),
80 PIN_FIELD_BASE(37, 37, 1, 0x0170, 0x10, 21, 1),
81 PIN_FIELD_BASE(38, 38, 1, 0x0170, 0x10, 20, 1),
82 PIN_FIELD_BASE(39, 39, 1, 0x0170, 0x10, 21, 1),
83 PIN_FIELD_BASE(40, 40, 1, 0x0170, 0x10, 21, 1),
84 PIN_FIELD_BASE(41, 41, 1, 0x0170, 0x10, 21, 1),
85 PIN_FIELD_BASE(42, 42, 2, 0x0160, 0x10, 21, 1),
86 PIN_FIELD_BASE(43, 43, 2, 0x0160, 0x10, 22, 1),
87 PIN_FIELD_BASE(44, 44, 2, 0x0160, 0x10, 21, 1),
88 PIN_FIELD_BASE(45, 45, 2, 0x0160, 0x10, 22, 1),
89 PIN_FIELD_BASE(46, 46, 3, 0x00d0, 0x10, 10, 1),
90 PIN_FIELD_BASE(47, 47, 1, 0x0170, 0x10, 16, 1),
91 PIN_FIELD_BASE(48, 48, 1, 0x0170, 0x10, 16, 1),
92 PIN_FIELD_BASE(49, 49, 1, 0x0170, 0x10, 16, 1),
93 PIN_FIELD_BASE(50, 50, 3, 0x00d0, 0x10, 10, 1),
94 PIN_FIELD_BASE(51, 51, 3, 0x00d0, 0x10, 11, 1),
95 PIN_FIELD_BASE(52, 52, 3, 0x00d0, 0x10, 11, 1),
96 PIN_FIELD_BASE(53, 53, 3, 0x00d0, 0x10, 11, 1),
97 PIN_FIELD_BASE(54, 54, 3, 0x00d0, 0x10, 11, 1),
98 PIN_FIELD_BASE(55, 55, 1, 0x0170, 0x10, 25, 1),
99 PIN_FIELD_BASE(56, 56, 1, 0x0170, 0x10, 28, 1),
100 PIN_FIELD_BASE(57, 57, 2, 0x0160, 0x10, 29, 1),
101 PIN_FIELD_BASE(58, 58, 2, 0x0160, 0x10, 31, 1),
102 PIN_FIELD_BASE(59, 59, 1, 0x0170, 0x10, 26, 1),
103 PIN_FIELD_BASE(60, 60, 1, 0x0170, 0x10, 29, 1),
104 PIN_FIELD_BASE(61, 61, 1, 0x0170, 0x10, 27, 1),
105 PIN_FIELD_BASE(62, 62, 1, 0x0170, 0x10, 30, 1),
106 PIN_FIELD_BASE(63, 63, 2, 0x0160, 0x10, 30, 1),
107 PIN_FIELD_BASE(64, 64, 2, 0x0170, 0x10, 0, 1),
108 PIN_FIELD_BASE(65, 65, 4, 0x00e0, 0x10, 10, 1),
109 PIN_FIELD_BASE(66, 66, 4, 0x00e0, 0x10, 12, 1),
110 PIN_FIELD_BASE(67, 67, 4, 0x00e0, 0x10, 11, 1),
111 PIN_FIELD_BASE(68, 68, 4, 0x00e0, 0x10, 13, 1),
112 PIN_FIELD_BASE(69, 69, 1, 0x0180, 0x10, 0, 1),
113 PIN_FIELD_BASE(70, 70, 1, 0x0170, 0x10, 31, 1),
114 PIN_FIELD_BASE(71, 71, 1, 0x0180, 0x10, 4, 1),
115 PIN_FIELD_BASE(72, 72, 1, 0x0180, 0x10, 3, 1),
116 PIN_FIELD_BASE(73, 73, 1, 0x0180, 0x10, 1, 1),
117 PIN_FIELD_BASE(74, 74, 1, 0x0180, 0x10, 2, 1),
118 PIN_FIELD_BASE(75, 75, 1, 0x0180, 0x10, 6, 1),
119 PIN_FIELD_BASE(76, 76, 1, 0x0180, 0x10, 5, 1),
120 PIN_FIELD_BASE(77, 77, 1, 0x0180, 0x10, 8, 1),
121 PIN_FIELD_BASE(78, 78, 1, 0x0180, 0x10, 7, 1),
122 PIN_FIELD_BASE(79, 79, 4, 0x00e0, 0x10, 15, 1),
123 PIN_FIELD_BASE(80, 80, 4, 0x00e0, 0x10, 14, 1),
124 PIN_FIELD_BASE(81, 81, 4, 0x00e0, 0x10, 17, 1),
125 PIN_FIELD_BASE(82, 82, 4, 0x00e0, 0x10, 16, 1),
126 PIN_FIELD_BASE(83, 83, 2, 0x0160, 0x10, 26, 1),
127 PIN_FIELD_BASE(84, 84, 2, 0x0160, 0x10, 26, 1),
128 PIN_FIELD_BASE(85, 85, 2, 0x0160, 0x10, 27, 1),
129 PIN_FIELD_BASE(86, 86, 2, 0x0160, 0x10, 17, 1),
130 PIN_FIELD_BASE(87, 87, 2, 0x0160, 0x10, 17, 1),
131 PIN_FIELD_BASE(88, 88, 2, 0x0160, 0x10, 17, 1),
132 PIN_FIELD_BASE(89, 89, 2, 0x0160, 0x10, 17, 1),
133 PIN_FIELD_BASE(90, 90, 2, 0x0160, 0x10, 27, 1),
134 PIN_FIELD_BASE(91, 91, 2, 0x0160, 0x10, 27, 1),
135 PIN_FIELD_BASE(92, 92, 2, 0x0160, 0x10, 18, 1),
136 PIN_FIELD_BASE(93, 93, 2, 0x0160, 0x10, 18, 1),
137 PIN_FIELD_BASE(94, 94, 2, 0x0160, 0x10, 18, 1),
138 PIN_FIELD_BASE(95, 95, 2, 0x0160, 0x10, 18, 1),
139 PIN_FIELD_BASE(96, 96, 2, 0x0160, 0x10, 22, 1),
140 PIN_FIELD_BASE(97, 97, 2, 0x0160, 0x10, 23, 1),
141 PIN_FIELD_BASE(98, 98, 2, 0x0160, 0x10, 24, 1),
142 PIN_FIELD_BASE(99, 99, 2, 0x0160, 0x10, 22, 1),
143 PIN_FIELD_BASE(100, 100, 2, 0x0160, 0x10, 16, 1),
144 PIN_FIELD_BASE(101, 101, 2, 0x0160, 0x10, 23, 1),
145 PIN_FIELD_BASE(102, 102, 2, 0x0160, 0x10, 23, 1),
146 PIN_FIELD_BASE(103, 103, 2, 0x0160, 0x10, 23, 1),
147 PIN_FIELD_BASE(104, 104, 2, 0x0160, 0x10, 24, 1),
148 PIN_FIELD_BASE(105, 105, 2, 0x0160, 0x10, 24, 1),
149 PIN_FIELD_BASE(106, 106, 2, 0x0160, 0x10, 24, 1),
150 PIN_FIELD_BASE(107, 107, 2, 0x0160, 0x10, 17, 1),
151 PIN_FIELD_BASE(108, 108, 2, 0x0160, 0x10, 17, 1),
152 PIN_FIELD_BASE(109, 109, 2, 0x0160, 0x10, 17, 1),
153 PIN_FIELD_BASE(110, 110, 2, 0x0160, 0x10, 17, 1),
154 PIN_FIELD_BASE(111, 111, 2, 0x0160, 0x10, 19, 1),
155 PIN_FIELD_BASE(112, 112, 2, 0x0160, 0x10, 19, 1),
156 PIN_FIELD_BASE(113, 113, 2, 0x0160, 0x10, 19, 1),
157 PIN_FIELD_BASE(114, 114, 2, 0x0160, 0x10, 19, 1),
158 PIN_FIELD_BASE(115, 115, 2, 0x0160, 0x10, 20, 1),
159 PIN_FIELD_BASE(116, 116, 2, 0x0160, 0x10, 20, 1),
160 PIN_FIELD_BASE(117, 117, 2, 0x0160, 0x10, 20, 1),
161 PIN_FIELD_BASE(118, 118, 2, 0x0160, 0x10, 20, 1),
162 PIN_FIELD_BASE(119, 119, 2, 0x0160, 0x10, 21, 1),
163 PIN_FIELD_BASE(120, 120, 2, 0x0160, 0x10, 21, 1),
164 PIN_FIELD_BASE(121, 121, 3, 0x00d0, 0x10, 6, 1),
165 PIN_FIELD_BASE(122, 122, 3, 0x00d0, 0x10, 9, 1),
166 PIN_FIELD_BASE(123, 123, 3, 0x00d0, 0x10, 8, 1),
167 PIN_FIELD_BASE(124, 124, 3, 0x00d0, 0x10, 7, 1),
168 PIN_FIELD_BASE(125, 125, 2, 0x0160, 0x10, 25, 1),
169 PIN_FIELD_BASE(126, 126, 2, 0x0160, 0x10, 25, 1),
170 PIN_FIELD_BASE(127, 127, 2, 0x0160, 0x10, 25, 1),
171 PIN_FIELD_BASE(128, 128, 2, 0x0160, 0x10, 25, 1),
172 PIN_FIELD_BASE(129, 129, 2, 0x0160, 0x10, 26, 1),
173 PIN_FIELD_BASE(130, 130, 2, 0x0160, 0x10, 26, 1),
174 PIN_FIELD_BASE(131, 131, 1, 0x0170, 0x10, 0, 1),
175 PIN_FIELD_BASE(132, 132, 1, 0x0170, 0x10, 1, 1),
176 PIN_FIELD_BASE(133, 133, 1, 0x0170, 0x10, 6, 1),
177 PIN_FIELD_BASE(134, 134, 1, 0x0170, 0x10, 7, 1),
178 PIN_FIELD_BASE(135, 135, 1, 0x0170, 0x10, 22, 1),
179 PIN_FIELD_BASE(136, 136, 1, 0x0170, 0x10, 22, 1),
180 PIN_FIELD_BASE(137, 137, 1, 0x0170, 0x10, 22, 1),
181 PIN_FIELD_BASE(138, 138, 1, 0x0170, 0x10, 22, 1),
182 PIN_FIELD_BASE(139, 139, 1, 0x0170, 0x10, 23, 1),
183 PIN_FIELD_BASE(140, 140, 1, 0x0170, 0x10, 23, 1),
184 PIN_FIELD_BASE(141, 141, 1, 0x0170, 0x10, 23, 1),
185 PIN_FIELD_BASE(142, 142, 1, 0x0170, 0x10, 23, 1),
186 PIN_FIELD_BASE(143, 143, 1, 0x0170, 0x10, 2, 1),
187 PIN_FIELD_BASE(144, 144, 1, 0x0170, 0x10, 3, 1),
188 PIN_FIELD_BASE(145, 145, 1, 0x0170, 0x10, 4, 1),
189 PIN_FIELD_BASE(146, 146, 1, 0x0170, 0x10, 5, 1),
190 PIN_FIELD_BASE(147, 147, 1, 0x0170, 0x10, 24, 1),
191 PIN_FIELD_BASE(148, 148, 1, 0x0170, 0x10, 24, 1),
192 PIN_FIELD_BASE(149, 149, 1, 0x0170, 0x10, 24, 1),
193 PIN_FIELD_BASE(150, 150, 1, 0x0170, 0x10, 24, 1),
194 PIN_FIELD_BASE(151, 151, 2, 0x0160, 0x10, 9, 1),
195 PIN_FIELD_BASE(152, 152, 2, 0x0160, 0x10, 8, 1),
196 PIN_FIELD_BASE(153, 153, 2, 0x0160, 0x10, 7, 1),
197 PIN_FIELD_BASE(154, 154, 2, 0x0160, 0x10, 6, 1),
198 PIN_FIELD_BASE(155, 155, 2, 0x0160, 0x10, 11, 1),
199 PIN_FIELD_BASE(156, 156, 2, 0x0160, 0x10, 1, 1),
200 PIN_FIELD_BASE(157, 157, 2, 0x0160, 0x10, 0, 1),
201 PIN_FIELD_BASE(158, 158, 2, 0x0160, 0x10, 5, 1),
202 PIN_FIELD_BASE(159, 159, 2, 0x0160, 0x10, 4, 1),
203 PIN_FIELD_BASE(160, 160, 2, 0x0160, 0x10, 3, 1),
204 PIN_FIELD_BASE(161, 161, 2, 0x0160, 0x10, 2, 1),
205 PIN_FIELD_BASE(162, 162, 2, 0x0160, 0x10, 10, 1),
206 PIN_FIELD_BASE(163, 163, 4, 0x00e0, 0x10, 4, 1),
207 PIN_FIELD_BASE(164, 164, 4, 0x00e0, 0x10, 3, 1),
208 PIN_FIELD_BASE(165, 165, 4, 0x00e0, 0x10, 5, 1),
209 PIN_FIELD_BASE(166, 166, 4, 0x00e0, 0x10, 6, 1),
210 PIN_FIELD_BASE(167, 167, 4, 0x00e0, 0x10, 7, 1),
211 PIN_FIELD_BASE(168, 168, 4, 0x00e0, 0x10, 8, 1),
212 PIN_FIELD_BASE(169, 169, 3, 0x00d0, 0x10, 1, 1),
213 PIN_FIELD_BASE(170, 170, 3, 0x00d0, 0x10, 0, 1),
214 PIN_FIELD_BASE(171, 171, 3, 0x00d0, 0x10, 2, 1),
215 PIN_FIELD_BASE(172, 172, 3, 0x00d0, 0x10, 3, 1),
216 PIN_FIELD_BASE(173, 173, 3, 0x00d0, 0x10, 4, 1),
217 PIN_FIELD_BASE(174, 174, 3, 0x00d0, 0x10, 5, 1),
218 PIN_FIELD_BASE(175, 175, 2, 0x0160, 0x10, 28, 1),
219 PIN_FIELD_BASE(176, 176, 2, 0x0160, 0x10, 28, 1),
220 };
221
222 static const struct mtk_pin_field_calc mt8188_pin_ies_range[] = {
223 PIN_FIELD_BASE(0, 0, 1, 0x0080, 0x10, 26, 1),
224 PIN_FIELD_BASE(1, 1, 1, 0x0080, 0x10, 27, 1),
225 PIN_FIELD_BASE(2, 2, 1, 0x0080, 0x10, 28, 1),
226 PIN_FIELD_BASE(3, 3, 1, 0x0080, 0x10, 29, 1),
227 PIN_FIELD_BASE(4, 4, 1, 0x0080, 0x10, 30, 1),
228 PIN_FIELD_BASE(5, 5, 1, 0x0080, 0x10, 31, 1),
229 PIN_FIELD_BASE(6, 6, 1, 0x0090, 0x10, 0, 1),
230 PIN_FIELD_BASE(7, 7, 1, 0x0090, 0x10, 1, 1),
231 PIN_FIELD_BASE(8, 8, 1, 0x0090, 0x10, 2, 1),
232 PIN_FIELD_BASE(9, 9, 1, 0x0090, 0x10, 3, 1),
233 PIN_FIELD_BASE(10, 10, 1, 0x0090, 0x10, 4, 1),
234 PIN_FIELD_BASE(11, 11, 1, 0x0090, 0x10, 5, 1),
235 PIN_FIELD_BASE(12, 12, 2, 0x0070, 0x10, 24, 1),
236 PIN_FIELD_BASE(13, 13, 2, 0x0070, 0x10, 25, 1),
237 PIN_FIELD_BASE(14, 14, 2, 0x0070, 0x10, 26, 1),
238 PIN_FIELD_BASE(15, 15, 2, 0x0070, 0x10, 27, 1),
239 PIN_FIELD_BASE(16, 16, 3, 0x0040, 0x10, 1, 1),
240 PIN_FIELD_BASE(17, 17, 3, 0x0040, 0x10, 2, 1),
241 PIN_FIELD_BASE(18, 18, 4, 0x0050, 0x10, 3, 1),
242 PIN_FIELD_BASE(19, 19, 4, 0x0050, 0x10, 5, 1),
243 PIN_FIELD_BASE(20, 20, 4, 0x0050, 0x10, 4, 1),
244 PIN_FIELD_BASE(21, 21, 4, 0x0050, 0x10, 6, 1),
245 PIN_FIELD_BASE(22, 22, 4, 0x0050, 0x10, 0, 1),
246 PIN_FIELD_BASE(23, 23, 4, 0x0050, 0x10, 1, 1),
247 PIN_FIELD_BASE(24, 24, 4, 0x0050, 0x10, 2, 1),
248 PIN_FIELD_BASE(25, 25, 1, 0x0080, 0x10, 23, 1),
249 PIN_FIELD_BASE(26, 26, 1, 0x0080, 0x10, 22, 1),
250 PIN_FIELD_BASE(27, 27, 1, 0x0080, 0x10, 25, 1),
251 PIN_FIELD_BASE(28, 28, 1, 0x0080, 0x10, 24, 1),
252 PIN_FIELD_BASE(29, 29, 1, 0x0080, 0x10, 0, 1),
253 PIN_FIELD_BASE(30, 30, 1, 0x0080, 0x10, 1, 1),
254 PIN_FIELD_BASE(31, 31, 1, 0x0090, 0x10, 31, 1),
255 PIN_FIELD_BASE(32, 32, 1, 0x0090, 0x10, 30, 1),
256 PIN_FIELD_BASE(33, 33, 1, 0x00a0, 0x10, 1, 1),
257 PIN_FIELD_BASE(34, 34, 1, 0x00a0, 0x10, 0, 1),
258 PIN_FIELD_BASE(35, 35, 1, 0x00a0, 0x10, 3, 1),
259 PIN_FIELD_BASE(36, 36, 1, 0x00a0, 0x10, 2, 1),
260 PIN_FIELD_BASE(37, 37, 1, 0x0090, 0x10, 9, 1),
261 PIN_FIELD_BASE(38, 38, 1, 0x0090, 0x10, 6, 1),
262 PIN_FIELD_BASE(39, 39, 1, 0x0090, 0x10, 7, 1),
263 PIN_FIELD_BASE(40, 40, 1, 0x0090, 0x10, 8, 1),
264 PIN_FIELD_BASE(41, 41, 1, 0x0090, 0x10, 10, 1),
265 PIN_FIELD_BASE(42, 42, 2, 0x0080, 0x10, 10, 1),
266 PIN_FIELD_BASE(43, 43, 2, 0x0080, 0x10, 11, 1),
267 PIN_FIELD_BASE(44, 44, 2, 0x0080, 0x10, 12, 1),
268 PIN_FIELD_BASE(45, 45, 2, 0x0080, 0x10, 13, 1),
269 PIN_FIELD_BASE(46, 46, 3, 0x0040, 0x10, 0, 1),
270 PIN_FIELD_BASE(47, 47, 1, 0x0090, 0x10, 13, 1),
271 PIN_FIELD_BASE(48, 48, 1, 0x0090, 0x10, 12, 1),
272 PIN_FIELD_BASE(49, 49, 1, 0x0090, 0x10, 11, 1),
273 PIN_FIELD_BASE(50, 50, 3, 0x0040, 0x10, 5, 1),
274 PIN_FIELD_BASE(51, 51, 3, 0x0040, 0x10, 4, 1),
275 PIN_FIELD_BASE(52, 52, 3, 0x0040, 0x10, 3, 1),
276 PIN_FIELD_BASE(53, 53, 3, 0x0040, 0x10, 6, 1),
277 PIN_FIELD_BASE(54, 54, 3, 0x0040, 0x10, 7, 1),
278 PIN_FIELD_BASE(55, 55, 1, 0x0090, 0x10, 14, 1),
279 PIN_FIELD_BASE(56, 56, 1, 0x0090, 0x10, 17, 1),
280 PIN_FIELD_BASE(57, 57, 2, 0x0080, 0x10, 22, 1),
281 PIN_FIELD_BASE(58, 58, 2, 0x0080, 0x10, 25, 1),
282 PIN_FIELD_BASE(59, 59, 1, 0x0090, 0x10, 15, 1),
283 PIN_FIELD_BASE(60, 60, 1, 0x0090, 0x10, 18, 1),
284 PIN_FIELD_BASE(61, 61, 1, 0x0090, 0x10, 16, 1),
285 PIN_FIELD_BASE(62, 62, 1, 0x0090, 0x10, 19, 1),
286 PIN_FIELD_BASE(63, 63, 2, 0x0080, 0x10, 23, 1),
287 PIN_FIELD_BASE(64, 64, 2, 0x0080, 0x10, 26, 1),
288 PIN_FIELD_BASE(65, 65, 4, 0x0050, 0x10, 13, 1),
289 PIN_FIELD_BASE(66, 66, 4, 0x0050, 0x10, 15, 1),
290 PIN_FIELD_BASE(67, 67, 4, 0x0050, 0x10, 14, 1),
291 PIN_FIELD_BASE(68, 68, 4, 0x0050, 0x10, 16, 1),
292 PIN_FIELD_BASE(69, 69, 1, 0x0090, 0x10, 21, 1),
293 PIN_FIELD_BASE(70, 70, 1, 0x0090, 0x10, 20, 1),
294 PIN_FIELD_BASE(71, 71, 1, 0x0090, 0x10, 25, 1),
295 PIN_FIELD_BASE(72, 72, 1, 0x0090, 0x10, 24, 1),
296 PIN_FIELD_BASE(73, 73, 1, 0x0090, 0x10, 22, 1),
297 PIN_FIELD_BASE(74, 74, 1, 0x0090, 0x10, 23, 1),
298 PIN_FIELD_BASE(75, 75, 1, 0x0090, 0x10, 27, 1),
299 PIN_FIELD_BASE(76, 76, 1, 0x0090, 0x10, 26, 1),
300 PIN_FIELD_BASE(77, 77, 1, 0x0090, 0x10, 29, 1),
301 PIN_FIELD_BASE(78, 78, 1, 0x0090, 0x10, 28, 1),
302 PIN_FIELD_BASE(79, 79, 4, 0x0050, 0x10, 18, 1),
303 PIN_FIELD_BASE(80, 80, 4, 0x0050, 0x10, 17, 1),
304 PIN_FIELD_BASE(81, 81, 4, 0x0050, 0x10, 20, 1),
305 PIN_FIELD_BASE(82, 82, 4, 0x0050, 0x10, 19, 1),
306 PIN_FIELD_BASE(83, 83, 2, 0x0080, 0x10, 30, 1),
307 PIN_FIELD_BASE(84, 84, 2, 0x0080, 0x10, 29, 1),
308 PIN_FIELD_BASE(85, 85, 2, 0x0080, 0x10, 31, 1),
309 PIN_FIELD_BASE(86, 86, 2, 0x0090, 0x10, 1, 1),
310 PIN_FIELD_BASE(87, 87, 2, 0x0090, 0x10, 0, 1),
311 PIN_FIELD_BASE(88, 88, 2, 0x0090, 0x10, 2, 1),
312 PIN_FIELD_BASE(89, 89, 2, 0x0090, 0x10, 4, 1),
313 PIN_FIELD_BASE(90, 90, 2, 0x0090, 0x10, 3, 1),
314 PIN_FIELD_BASE(91, 91, 2, 0x0090, 0x10, 5, 1),
315 PIN_FIELD_BASE(92, 92, 2, 0x0080, 0x10, 19, 1),
316 PIN_FIELD_BASE(93, 93, 2, 0x0080, 0x10, 18, 1),
317 PIN_FIELD_BASE(94, 94, 2, 0x0080, 0x10, 21, 1),
318 PIN_FIELD_BASE(95, 95, 2, 0x0080, 0x10, 20, 1),
319 PIN_FIELD_BASE(96, 96, 2, 0x0080, 0x10, 15, 1),
320 PIN_FIELD_BASE(97, 97, 2, 0x0080, 0x10, 16, 1),
321 PIN_FIELD_BASE(98, 98, 2, 0x0080, 0x10, 24, 1),
322 PIN_FIELD_BASE(99, 99, 2, 0x0080, 0x10, 14, 1),
323 PIN_FIELD_BASE(100, 100, 2, 0x0080, 0x10, 17, 1),
324 PIN_FIELD_BASE(101, 101, 2, 0x0070, 0x10, 0, 1),
325 PIN_FIELD_BASE(102, 102, 2, 0x0070, 0x10, 5, 1),
326 PIN_FIELD_BASE(103, 103, 2, 0x0070, 0x10, 3, 1),
327 PIN_FIELD_BASE(104, 104, 2, 0x0070, 0x10, 4, 1),
328 PIN_FIELD_BASE(105, 105, 2, 0x0070, 0x10, 1, 1),
329 PIN_FIELD_BASE(106, 106, 2, 0x0070, 0x10, 2, 1),
330 PIN_FIELD_BASE(107, 107, 2, 0x0080, 0x10, 1, 1),
331 PIN_FIELD_BASE(108, 108, 2, 0x0070, 0x10, 28, 1),
332 PIN_FIELD_BASE(109, 109, 2, 0x0080, 0x10, 2, 1),
333 PIN_FIELD_BASE(110, 110, 2, 0x0070, 0x10, 29, 1),
334 PIN_FIELD_BASE(111, 111, 2, 0x0070, 0x10, 30, 1),
335 PIN_FIELD_BASE(112, 112, 2, 0x0070, 0x10, 31, 1),
336 PIN_FIELD_BASE(113, 113, 2, 0x0080, 0x10, 0, 1),
337 PIN_FIELD_BASE(114, 114, 2, 0x0080, 0x10, 8, 1),
338 PIN_FIELD_BASE(115, 115, 2, 0x0080, 0x10, 3, 1),
339 PIN_FIELD_BASE(116, 116, 2, 0x0080, 0x10, 9, 1),
340 PIN_FIELD_BASE(117, 117, 2, 0x0080, 0x10, 4, 1),
341 PIN_FIELD_BASE(118, 118, 2, 0x0080, 0x10, 5, 1),
342 PIN_FIELD_BASE(119, 119, 2, 0x0080, 0x10, 6, 1),
343 PIN_FIELD_BASE(120, 120, 2, 0x0080, 0x10, 7, 1),
344 PIN_FIELD_BASE(121, 121, 3, 0x0040, 0x10, 14, 1),
345 PIN_FIELD_BASE(122, 122, 3, 0x0040, 0x10, 17, 1),
346 PIN_FIELD_BASE(123, 123, 3, 0x0040, 0x10, 16, 1),
347 PIN_FIELD_BASE(124, 124, 3, 0x0040, 0x10, 15, 1),
348 PIN_FIELD_BASE(125, 125, 2, 0x0070, 0x10, 6, 1),
349 PIN_FIELD_BASE(126, 126, 2, 0x0070, 0x10, 7, 1),
350 PIN_FIELD_BASE(127, 127, 2, 0x0070, 0x10, 8, 1),
351 PIN_FIELD_BASE(128, 128, 2, 0x0070, 0x10, 9, 1),
352 PIN_FIELD_BASE(129, 129, 2, 0x0070, 0x10, 10, 1),
353 PIN_FIELD_BASE(130, 130, 2, 0x0070, 0x10, 11, 1),
354 PIN_FIELD_BASE(131, 131, 1, 0x0080, 0x10, 3, 1),
355 PIN_FIELD_BASE(132, 132, 1, 0x0080, 0x10, 4, 1),
356 PIN_FIELD_BASE(133, 133, 1, 0x0080, 0x10, 11, 1),
357 PIN_FIELD_BASE(134, 134, 1, 0x0080, 0x10, 12, 1),
358 PIN_FIELD_BASE(135, 135, 1, 0x0080, 0x10, 13, 1),
359 PIN_FIELD_BASE(136, 136, 1, 0x0080, 0x10, 14, 1),
360 PIN_FIELD_BASE(137, 137, 1, 0x0080, 0x10, 15, 1),
361 PIN_FIELD_BASE(138, 138, 1, 0x0080, 0x10, 16, 1),
362 PIN_FIELD_BASE(139, 139, 1, 0x0080, 0x10, 17, 1),
363 PIN_FIELD_BASE(140, 140, 1, 0x0080, 0x10, 18, 1),
364 PIN_FIELD_BASE(141, 141, 1, 0x0080, 0x10, 5, 1),
365 PIN_FIELD_BASE(142, 142, 1, 0x0080, 0x10, 6, 1),
366 PIN_FIELD_BASE(143, 143, 1, 0x0080, 0x10, 7, 1),
367 PIN_FIELD_BASE(144, 144, 1, 0x0080, 0x10, 8, 1),
368 PIN_FIELD_BASE(145, 145, 1, 0x0080, 0x10, 9, 1),
369 PIN_FIELD_BASE(146, 146, 1, 0x0080, 0x10, 10, 1),
370 PIN_FIELD_BASE(147, 147, 1, 0x0080, 0x10, 20, 1),
371 PIN_FIELD_BASE(148, 148, 1, 0x0080, 0x10, 21, 1),
372 PIN_FIELD_BASE(149, 149, 1, 0x0080, 0x10, 19, 1),
373 PIN_FIELD_BASE(150, 150, 1, 0x0080, 0x10, 2, 1),
374 PIN_FIELD_BASE(151, 151, 2, 0x0070, 0x10, 21, 1),
375 PIN_FIELD_BASE(152, 152, 2, 0x0070, 0x10, 20, 1),
376 PIN_FIELD_BASE(153, 153, 2, 0x0070, 0x10, 19, 1),
377 PIN_FIELD_BASE(154, 154, 2, 0x0070, 0x10, 18, 1),
378 PIN_FIELD_BASE(155, 155, 2, 0x0070, 0x10, 23, 1),
379 PIN_FIELD_BASE(156, 156, 2, 0x0070, 0x10, 13, 1),
380 PIN_FIELD_BASE(157, 157, 2, 0x0070, 0x10, 12, 1),
381 PIN_FIELD_BASE(158, 158, 2, 0x0070, 0x10, 17, 1),
382 PIN_FIELD_BASE(159, 159, 2, 0x0070, 0x10, 16, 1),
383 PIN_FIELD_BASE(160, 160, 2, 0x0070, 0x10, 15, 1),
384 PIN_FIELD_BASE(161, 161, 2, 0x0070, 0x10, 14, 1),
385 PIN_FIELD_BASE(162, 162, 2, 0x0070, 0x10, 22, 1),
386 PIN_FIELD_BASE(163, 163, 4, 0x0050, 0x10, 8, 1),
387 PIN_FIELD_BASE(164, 164, 4, 0x0050, 0x10, 7, 1),
388 PIN_FIELD_BASE(165, 165, 4, 0x0050, 0x10, 9, 1),
389 PIN_FIELD_BASE(166, 166, 4, 0x0050, 0x10, 10, 1),
390 PIN_FIELD_BASE(167, 167, 4, 0x0050, 0x10, 11, 1),
391 PIN_FIELD_BASE(168, 168, 4, 0x0050, 0x10, 12, 1),
392 PIN_FIELD_BASE(169, 169, 3, 0x0040, 0x10, 9, 1),
393 PIN_FIELD_BASE(170, 170, 3, 0x0040, 0x10, 8, 1),
394 PIN_FIELD_BASE(171, 171, 3, 0x0040, 0x10, 10, 1),
395 PIN_FIELD_BASE(172, 172, 3, 0x0040, 0x10, 11, 1),
396 PIN_FIELD_BASE(173, 173, 3, 0x0040, 0x10, 12, 1),
397 PIN_FIELD_BASE(174, 174, 3, 0x0040, 0x10, 13, 1),
398 PIN_FIELD_BASE(175, 175, 2, 0x0080, 0x10, 27, 1),
399 PIN_FIELD_BASE(176, 176, 2, 0x0080, 0x10, 28, 1),
400 };
401
402 static const struct mtk_pin_field_calc mt8188_pin_tdsel_range[] = {
403 PIN_FIELD_BASE(0, 0, 1, 0x01b0, 0x10, 0, 4),
404 PIN_FIELD_BASE(1, 1, 1, 0x01b0, 0x10, 4, 4),
405 PIN_FIELD_BASE(2, 2, 1, 0x01b0, 0x10, 8, 4),
406 PIN_FIELD_BASE(3, 3, 1, 0x01b0, 0x10, 12, 4),
407 PIN_FIELD_BASE(4, 4, 1, 0x01c0, 0x10, 16, 4),
408 PIN_FIELD_BASE(5, 5, 1, 0x01c0, 0x10, 20, 4),
409 PIN_FIELD_BASE(6, 6, 1, 0x01c0, 0x10, 20, 4),
410 PIN_FIELD_BASE(7, 7, 1, 0x01b0, 0x10, 16, 4),
411 PIN_FIELD_BASE(8, 8, 1, 0x01b0, 0x10, 20, 4),
412 PIN_FIELD_BASE(9, 9, 1, 0x01b0, 0x10, 24, 4),
413 PIN_FIELD_BASE(10, 10, 1, 0x01b0, 0x10, 28, 4),
414 PIN_FIELD_BASE(11, 11, 1, 0x01c0, 0x10, 20, 4),
415 PIN_FIELD_BASE(12, 12, 2, 0x0190, 0x10, 16, 4),
416 PIN_FIELD_BASE(13, 13, 2, 0x0190, 0x10, 20, 4),
417 PIN_FIELD_BASE(14, 14, 2, 0x0190, 0x10, 24, 4),
418 PIN_FIELD_BASE(15, 15, 2, 0x0190, 0x10, 28, 4),
419 PIN_FIELD_BASE(16, 16, 3, 0x0100, 0x10, 8, 4),
420 PIN_FIELD_BASE(17, 17, 3, 0x0100, 0x10, 8, 4),
421 PIN_FIELD_BASE(18, 18, 4, 0x0110, 0x10, 4, 4),
422 PIN_FIELD_BASE(19, 19, 4, 0x0110, 0x10, 8, 4),
423 PIN_FIELD_BASE(20, 20, 4, 0x0110, 0x10, 8, 4),
424 PIN_FIELD_BASE(21, 21, 4, 0x0110, 0x10, 8, 4),
425 PIN_FIELD_BASE(22, 22, 4, 0x0100, 0x10, 0, 4),
426 PIN_FIELD_BASE(23, 23, 4, 0x0100, 0x10, 4, 4),
427 PIN_FIELD_BASE(24, 24, 4, 0x0100, 0x10, 8, 4),
428 PIN_FIELD_BASE(25, 25, 1, 0x01c0, 0x10, 8, 4),
429 PIN_FIELD_BASE(26, 26, 1, 0x01c0, 0x10, 8, 4),
430 PIN_FIELD_BASE(27, 27, 1, 0x01c0, 0x10, 8, 4),
431 PIN_FIELD_BASE(28, 28, 1, 0x01c0, 0x10, 12, 4),
432 PIN_FIELD_BASE(29, 29, 1, 0x01c0, 0x10, 0, 4),
433 PIN_FIELD_BASE(30, 30, 1, 0x01c0, 0x10, 8, 4),
434 PIN_FIELD_BASE(31, 31, 1, 0x01c0, 0x10, 20, 4),
435 PIN_FIELD_BASE(32, 32, 1, 0x01c0, 0x10, 24, 4),
436 PIN_FIELD_BASE(33, 33, 1, 0x01c0, 0x10, 24, 4),
437 PIN_FIELD_BASE(34, 34, 1, 0x01c0, 0x10, 28, 4),
438 PIN_FIELD_BASE(35, 35, 1, 0x01c0, 0x10, 24, 4),
439 PIN_FIELD_BASE(36, 36, 1, 0x01c0, 0x10, 24, 4),
440 PIN_FIELD_BASE(37, 37, 1, 0x01c0, 0x10, 28, 4),
441 PIN_FIELD_BASE(38, 38, 1, 0x01c0, 0x10, 28, 4),
442 PIN_FIELD_BASE(39, 39, 1, 0x01c0, 0x10, 28, 4),
443 PIN_FIELD_BASE(40, 40, 1, 0x01d0, 0x10, 0, 4),
444 PIN_FIELD_BASE(41, 41, 1, 0x01d0, 0x10, 0, 4),
445 PIN_FIELD_BASE(42, 42, 2, 0x01a0, 0x10, 16, 4),
446 PIN_FIELD_BASE(43, 43, 2, 0x01a0, 0x10, 20, 4),
447 PIN_FIELD_BASE(44, 44, 2, 0x01a0, 0x10, 16, 4),
448 PIN_FIELD_BASE(45, 45, 2, 0x01a0, 0x10, 20, 4),
449 PIN_FIELD_BASE(46, 46, 3, 0x0100, 0x10, 8, 4),
450 PIN_FIELD_BASE(47, 47, 1, 0x01c0, 0x10, 0, 4),
451 PIN_FIELD_BASE(48, 48, 1, 0x01c0, 0x10, 0, 4),
452 PIN_FIELD_BASE(49, 49, 1, 0x01c0, 0x10, 0, 4),
453 PIN_FIELD_BASE(50, 50, 3, 0x0100, 0x10, 8, 4),
454 PIN_FIELD_BASE(51, 51, 3, 0x0100, 0x10, 12, 4),
455 PIN_FIELD_BASE(52, 52, 3, 0x0100, 0x10, 12, 4),
456 PIN_FIELD_BASE(53, 53, 3, 0x0100, 0x10, 12, 4),
457 PIN_FIELD_BASE(54, 54, 3, 0x0100, 0x10, 12, 4),
458 PIN_FIELD_BASE(55, 55, 1, 0x01c0, 0x10, 12, 4),
459 PIN_FIELD_BASE(56, 56, 1, 0x01c0, 0x10, 12, 4),
460 PIN_FIELD_BASE(57, 57, 2, 0x01a0, 0x10, 24, 4),
461 PIN_FIELD_BASE(58, 58, 2, 0x01a0, 0x10, 24, 4),
462 PIN_FIELD_BASE(59, 59, 1, 0x01c0, 0x10, 16, 4),
463 PIN_FIELD_BASE(60, 60, 1, 0x01c0, 0x10, 12, 4),
464 PIN_FIELD_BASE(61, 61, 1, 0x01c0, 0x10, 16, 4),
465 PIN_FIELD_BASE(62, 62, 1, 0x01c0, 0x10, 16, 4),
466 PIN_FIELD_BASE(63, 63, 2, 0x01a0, 0x10, 20, 4),
467 PIN_FIELD_BASE(64, 64, 2, 0x01a0, 0x10, 20, 4),
468 PIN_FIELD_BASE(65, 65, 4, 0x0110, 0x10, 12, 4),
469 PIN_FIELD_BASE(66, 66, 4, 0x0110, 0x10, 8, 4),
470 PIN_FIELD_BASE(67, 67, 4, 0x0110, 0x10, 12, 4),
471 PIN_FIELD_BASE(68, 68, 4, 0x0110, 0x10, 12, 4),
472 PIN_FIELD_BASE(69, 69, 1, 0x01d0, 0x10, 16, 4),
473 PIN_FIELD_BASE(70, 70, 1, 0x01d0, 0x10, 12, 4),
474 PIN_FIELD_BASE(71, 71, 1, 0x01e0, 0x10, 0, 4),
475 PIN_FIELD_BASE(72, 72, 1, 0x01d0, 0x10, 28, 4),
476 PIN_FIELD_BASE(73, 73, 1, 0x01d0, 0x10, 20, 4),
477 PIN_FIELD_BASE(74, 74, 1, 0x01d0, 0x10, 24, 4),
478 PIN_FIELD_BASE(75, 75, 1, 0x01e0, 0x10, 8, 4),
479 PIN_FIELD_BASE(76, 76, 1, 0x01e0, 0x10, 4, 4),
480 PIN_FIELD_BASE(77, 77, 1, 0x01e0, 0x10, 16, 4),
481 PIN_FIELD_BASE(78, 78, 1, 0x01e0, 0x10, 12, 4),
482 PIN_FIELD_BASE(79, 79, 4, 0x0110, 0x10, 20, 4),
483 PIN_FIELD_BASE(80, 80, 4, 0x0110, 0x10, 16, 4),
484 PIN_FIELD_BASE(81, 81, 4, 0x0110, 0x10, 28, 4),
485 PIN_FIELD_BASE(82, 82, 4, 0x0110, 0x10, 24, 4),
486 PIN_FIELD_BASE(83, 83, 2, 0x01b0, 0x10, 8, 4),
487 PIN_FIELD_BASE(84, 84, 2, 0x01b0, 0x10, 8, 4),
488 PIN_FIELD_BASE(85, 85, 2, 0x01b0, 0x10, 12, 4),
489 PIN_FIELD_BASE(86, 86, 2, 0x01a0, 0x10, 0, 4),
490 PIN_FIELD_BASE(87, 87, 2, 0x01a0, 0x10, 0, 4),
491 PIN_FIELD_BASE(88, 88, 2, 0x01a0, 0x10, 0, 4),
492 PIN_FIELD_BASE(89, 89, 2, 0x01a0, 0x10, 0, 4),
493 PIN_FIELD_BASE(90, 90, 2, 0x01b0, 0x10, 12, 4),
494 PIN_FIELD_BASE(91, 91, 2, 0x01b0, 0x10, 12, 4),
495 PIN_FIELD_BASE(92, 92, 2, 0x01a0, 0x10, 4, 4),
496 PIN_FIELD_BASE(93, 93, 2, 0x01a0, 0x10, 4, 4),
497 PIN_FIELD_BASE(94, 94, 2, 0x01a0, 0x10, 4, 4),
498 PIN_FIELD_BASE(95, 95, 2, 0x01a0, 0x10, 4, 4),
499 PIN_FIELD_BASE(96, 96, 2, 0x01a0, 0x10, 24, 4),
500 PIN_FIELD_BASE(97, 97, 2, 0x01a0, 0x10, 28, 4),
501 PIN_FIELD_BASE(98, 98, 2, 0x01b0, 0x10, 0, 4),
502 PIN_FIELD_BASE(99, 99, 2, 0x01a0, 0x10, 24, 4),
503 PIN_FIELD_BASE(100, 100, 2, 0x01b0, 0x10, 20, 4),
504 PIN_FIELD_BASE(101, 101, 2, 0x01a0, 0x10, 28, 4),
505 PIN_FIELD_BASE(102, 102, 2, 0x01a0, 0x10, 28, 4),
506 PIN_FIELD_BASE(103, 103, 2, 0x01a0, 0x10, 28, 4),
507 PIN_FIELD_BASE(104, 104, 2, 0x01b0, 0x10, 0, 4),
508 PIN_FIELD_BASE(105, 105, 2, 0x01b0, 0x10, 0, 4),
509 PIN_FIELD_BASE(106, 106, 2, 0x01b0, 0x10, 0, 4),
510 PIN_FIELD_BASE(107, 107, 2, 0x01a0, 0x10, 0, 4),
511 PIN_FIELD_BASE(108, 108, 2, 0x01a0, 0x10, 0, 4),
512 PIN_FIELD_BASE(109, 109, 2, 0x01a0, 0x10, 0, 4),
513 PIN_FIELD_BASE(110, 110, 2, 0x01a0, 0x10, 0, 4),
514 PIN_FIELD_BASE(111, 111, 2, 0x01a0, 0x10, 8, 4),
515 PIN_FIELD_BASE(112, 112, 2, 0x01a0, 0x10, 8, 4),
516 PIN_FIELD_BASE(113, 113, 2, 0x01a0, 0x10, 8, 4),
517 PIN_FIELD_BASE(114, 114, 2, 0x01a0, 0x10, 8, 4),
518 PIN_FIELD_BASE(115, 115, 2, 0x01a0, 0x10, 12, 4),
519 PIN_FIELD_BASE(116, 116, 2, 0x01a0, 0x10, 12, 4),
520 PIN_FIELD_BASE(117, 117, 2, 0x01a0, 0x10, 12, 4),
521 PIN_FIELD_BASE(118, 118, 2, 0x01a0, 0x10, 12, 4),
522 PIN_FIELD_BASE(119, 119, 2, 0x01a0, 0x10, 16, 4),
523 PIN_FIELD_BASE(120, 120, 2, 0x01a0, 0x10, 16, 4),
524 PIN_FIELD_BASE(121, 121, 3, 0x00f0, 0x10, 24, 4),
525 PIN_FIELD_BASE(122, 122, 3, 0x0100, 0x10, 4, 4),
526 PIN_FIELD_BASE(123, 123, 3, 0x0100, 0x10, 0, 4),
527 PIN_FIELD_BASE(124, 124, 3, 0x00f0, 0x10, 28, 4),
528 PIN_FIELD_BASE(125, 125, 2, 0x01b0, 0x10, 4, 4),
529 PIN_FIELD_BASE(126, 126, 2, 0x01b0, 0x10, 4, 4),
530 PIN_FIELD_BASE(127, 127, 2, 0x01b0, 0x10, 4, 4),
531 PIN_FIELD_BASE(128, 128, 2, 0x01b0, 0x10, 4, 4),
532 PIN_FIELD_BASE(129, 129, 2, 0x01b0, 0x10, 8, 4),
533 PIN_FIELD_BASE(130, 130, 2, 0x01b0, 0x10, 8, 4),
534 PIN_FIELD_BASE(131, 131, 1, 0x01a0, 0x10, 0, 4),
535 PIN_FIELD_BASE(132, 132, 1, 0x01a0, 0x10, 20, 4),
536 PIN_FIELD_BASE(133, 133, 1, 0x01a0, 0x10, 24, 4),
537 PIN_FIELD_BASE(134, 134, 1, 0x01a0, 0x10, 28, 4),
538 PIN_FIELD_BASE(135, 135, 1, 0x01d0, 0x10, 0, 4),
539 PIN_FIELD_BASE(136, 136, 1, 0x01d0, 0x10, 0, 4),
540 PIN_FIELD_BASE(137, 137, 1, 0x01d0, 0x10, 4, 4),
541 PIN_FIELD_BASE(138, 138, 1, 0x01d0, 0x10, 4, 4),
542 PIN_FIELD_BASE(139, 139, 1, 0x01d0, 0x10, 4, 4),
543 PIN_FIELD_BASE(140, 140, 1, 0x01d0, 0x10, 4, 4),
544 PIN_FIELD_BASE(141, 141, 1, 0x01d0, 0x10, 8, 4),
545 PIN_FIELD_BASE(142, 142, 1, 0x01d0, 0x10, 8, 4),
546 PIN_FIELD_BASE(143, 143, 1, 0x01a0, 0x10, 4, 4),
547 PIN_FIELD_BASE(144, 144, 1, 0x01a0, 0x10, 8, 4),
548 PIN_FIELD_BASE(145, 145, 1, 0x01a0, 0x10, 12, 4),
549 PIN_FIELD_BASE(146, 146, 1, 0x01a0, 0x10, 16, 4),
550 PIN_FIELD_BASE(147, 147, 1, 0x01d0, 0x10, 8, 4),
551 PIN_FIELD_BASE(148, 148, 1, 0x01d0, 0x10, 8, 4),
552 PIN_FIELD_BASE(149, 149, 1, 0x01c0, 0x10, 4, 4),
553 PIN_FIELD_BASE(150, 150, 1, 0x01c0, 0x10, 4, 4),
554 PIN_FIELD_BASE(151, 151, 2, 0x0190, 0x10, 4, 4),
555 PIN_FIELD_BASE(152, 152, 2, 0x0190, 0x10, 0, 4),
556 PIN_FIELD_BASE(153, 153, 2, 0x0180, 0x10, 28, 4),
557 PIN_FIELD_BASE(154, 154, 2, 0x0180, 0x10, 24, 4),
558 PIN_FIELD_BASE(155, 155, 2, 0x0190, 0x10, 12, 4),
559 PIN_FIELD_BASE(156, 156, 2, 0x0180, 0x10, 4, 4),
560 PIN_FIELD_BASE(157, 157, 2, 0x0180, 0x10, 0, 4),
561 PIN_FIELD_BASE(158, 158, 2, 0x0180, 0x10, 20, 4),
562 PIN_FIELD_BASE(159, 159, 2, 0x0180, 0x10, 16, 4),
563 PIN_FIELD_BASE(160, 160, 2, 0x0180, 0x10, 12, 4),
564 PIN_FIELD_BASE(161, 161, 2, 0x0180, 0x10, 8, 4),
565 PIN_FIELD_BASE(162, 162, 2, 0x0190, 0x10, 8, 4),
566 PIN_FIELD_BASE(163, 163, 4, 0x0100, 0x10, 16, 4),
567 PIN_FIELD_BASE(164, 164, 4, 0x0100, 0x10, 12, 4),
568 PIN_FIELD_BASE(165, 165, 4, 0x0100, 0x10, 20, 4),
569 PIN_FIELD_BASE(166, 166, 4, 0x0100, 0x10, 24, 4),
570 PIN_FIELD_BASE(167, 167, 4, 0x0100, 0x10, 28, 4),
571 PIN_FIELD_BASE(168, 168, 4, 0x0110, 0x10, 0, 4),
572 PIN_FIELD_BASE(169, 169, 3, 0x00f0, 0x10, 4, 4),
573 PIN_FIELD_BASE(170, 170, 3, 0x00f0, 0x10, 0, 4),
574 PIN_FIELD_BASE(171, 171, 3, 0x00f0, 0x10, 8, 4),
575 PIN_FIELD_BASE(172, 172, 3, 0x00f0, 0x10, 12, 4),
576 PIN_FIELD_BASE(173, 173, 3, 0x00f0, 0x10, 16, 4),
577 PIN_FIELD_BASE(174, 174, 3, 0x00f0, 0x10, 20, 4),
578 PIN_FIELD_BASE(175, 175, 2, 0x01b0, 0x10, 16, 4),
579 PIN_FIELD_BASE(176, 176, 2, 0x01b0, 0x10, 16, 4),
580 };
581
582 static const struct mtk_pin_field_calc mt8188_pin_rdsel_range[] = {
583 PIN_FIELD_BASE(0, 0, 1, 0x0130, 0x10, 18, 2),
584 PIN_FIELD_BASE(1, 1, 1, 0x0130, 0x10, 20, 2),
585 PIN_FIELD_BASE(2, 2, 1, 0x0130, 0x10, 22, 2),
586 PIN_FIELD_BASE(3, 3, 1, 0x0130, 0x10, 24, 2),
587 PIN_FIELD_BASE(4, 4, 1, 0x0140, 0x10, 14, 2),
588 PIN_FIELD_BASE(5, 5, 1, 0x0140, 0x10, 16, 2),
589 PIN_FIELD_BASE(6, 6, 1, 0x0140, 0x10, 16, 2),
590 PIN_FIELD_BASE(7, 7, 1, 0x0130, 0x10, 26, 2),
591 PIN_FIELD_BASE(8, 8, 1, 0x0130, 0x10, 28, 2),
592 PIN_FIELD_BASE(9, 9, 1, 0x0130, 0x10, 30, 2),
593 PIN_FIELD_BASE(10, 10, 1, 0x0140, 0x10, 0, 2),
594 PIN_FIELD_BASE(11, 11, 1, 0x0140, 0x10, 16, 2),
595 PIN_FIELD_BASE(12, 12, 2, 0x0130, 0x10, 12, 2),
596 PIN_FIELD_BASE(13, 13, 2, 0x0130, 0x10, 14, 2),
597 PIN_FIELD_BASE(14, 14, 2, 0x0130, 0x10, 16, 2),
598 PIN_FIELD_BASE(15, 15, 2, 0x0130, 0x10, 18, 2),
599 PIN_FIELD_BASE(16, 16, 3, 0x00b0, 0x10, 14, 2),
600 PIN_FIELD_BASE(17, 17, 3, 0x00b0, 0x10, 14, 2),
601 PIN_FIELD_BASE(18, 18, 4, 0x00c0, 0x10, 12, 2),
602 PIN_FIELD_BASE(19, 19, 4, 0x00c0, 0x10, 12, 2),
603 PIN_FIELD_BASE(20, 20, 4, 0x00c0, 0x10, 12, 2),
604 PIN_FIELD_BASE(21, 21, 4, 0x00c0, 0x10, 12, 2),
605 PIN_FIELD_BASE(22, 22, 4, 0x00b0, 0x10, 0, 2),
606 PIN_FIELD_BASE(23, 23, 4, 0x00b0, 0x10, 2, 2),
607 PIN_FIELD_BASE(24, 24, 4, 0x00b0, 0x10, 4, 2),
608 PIN_FIELD_BASE(25, 25, 1, 0x0140, 0x10, 10, 2),
609 PIN_FIELD_BASE(26, 26, 1, 0x0140, 0x10, 10, 2),
610 PIN_FIELD_BASE(27, 27, 1, 0x0140, 0x10, 10, 2),
611 PIN_FIELD_BASE(28, 28, 1, 0x0140, 0x10, 12, 2),
612 PIN_FIELD_BASE(29, 29, 1, 0x0140, 0x10, 2, 2),
613 PIN_FIELD_BASE(30, 30, 1, 0x0140, 0x10, 10, 2),
614 PIN_FIELD_BASE(31, 31, 1, 0x0140, 0x10, 16, 2),
615 PIN_FIELD_BASE(32, 32, 1, 0x0140, 0x10, 18, 2),
616 PIN_FIELD_BASE(33, 33, 1, 0x0140, 0x10, 18, 2),
617 PIN_FIELD_BASE(34, 34, 1, 0x0140, 0x10, 20, 2),
618 PIN_FIELD_BASE(35, 35, 1, 0x0140, 0x10, 18, 2),
619 PIN_FIELD_BASE(36, 36, 1, 0x0140, 0x10, 18, 2),
620 PIN_FIELD_BASE(37, 37, 1, 0x0140, 0x10, 20, 2),
621 PIN_FIELD_BASE(38, 38, 1, 0x0140, 0x10, 20, 2),
622 PIN_FIELD_BASE(39, 39, 1, 0x0140, 0x10, 20, 2),
623 PIN_FIELD_BASE(40, 40, 1, 0x0140, 0x10, 22, 2),
624 PIN_FIELD_BASE(41, 41, 1, 0x0140, 0x10, 22, 2),
625 PIN_FIELD_BASE(42, 42, 2, 0x0130, 0x10, 30, 2),
626 PIN_FIELD_BASE(43, 43, 2, 0x0140, 0x10, 0, 2),
627 PIN_FIELD_BASE(44, 44, 2, 0x0130, 0x10, 30, 2),
628 PIN_FIELD_BASE(45, 45, 2, 0x0140, 0x10, 0, 2),
629 PIN_FIELD_BASE(46, 46, 3, 0x00b0, 0x10, 14, 2),
630 PIN_FIELD_BASE(47, 47, 1, 0x0140, 0x10, 2, 2),
631 PIN_FIELD_BASE(48, 48, 1, 0x0140, 0x10, 2, 2),
632 PIN_FIELD_BASE(49, 49, 1, 0x0140, 0x10, 2, 2),
633 PIN_FIELD_BASE(50, 50, 3, 0x00b0, 0x10, 14, 2),
634 PIN_FIELD_BASE(51, 51, 3, 0x00b0, 0x10, 16, 2),
635 PIN_FIELD_BASE(52, 52, 3, 0x00b0, 0x10, 16, 2),
636 PIN_FIELD_BASE(53, 53, 3, 0x00b0, 0x10, 16, 2),
637 PIN_FIELD_BASE(54, 54, 3, 0x00b0, 0x10, 16, 2),
638 PIN_FIELD_BASE(55, 55, 1, 0x0140, 0x10, 12, 2),
639 PIN_FIELD_BASE(56, 56, 1, 0x0140, 0x10, 12, 2),
640 PIN_FIELD_BASE(57, 57, 2, 0x0140, 0x10, 2, 2),
641 PIN_FIELD_BASE(58, 58, 2, 0x0140, 0x10, 2, 2),
642 PIN_FIELD_BASE(59, 59, 1, 0x0140, 0x10, 14, 2),
643 PIN_FIELD_BASE(60, 60, 1, 0x0140, 0x10, 12, 2),
644 PIN_FIELD_BASE(61, 61, 1, 0x0140, 0x10, 14, 2),
645 PIN_FIELD_BASE(62, 62, 1, 0x0140, 0x10, 14, 2),
646 PIN_FIELD_BASE(63, 63, 2, 0x0140, 0x10, 0, 2),
647 PIN_FIELD_BASE(64, 64, 2, 0x0140, 0x10, 0, 2),
648 PIN_FIELD_BASE(65, 65, 4, 0x00c0, 0x10, 14, 2),
649 PIN_FIELD_BASE(66, 66, 4, 0x00c0, 0x10, 14, 2),
650 PIN_FIELD_BASE(67, 67, 4, 0x00c0, 0x10, 14, 2),
651 PIN_FIELD_BASE(68, 68, 4, 0x00c0, 0x10, 14, 2),
652 PIN_FIELD_BASE(69, 69, 1, 0x0150, 0x10, 14, 2),
653 PIN_FIELD_BASE(70, 70, 1, 0x0150, 0x10, 12, 2),
654 PIN_FIELD_BASE(71, 71, 1, 0x0150, 0x10, 22, 2),
655 PIN_FIELD_BASE(72, 72, 1, 0x0150, 0x10, 20, 2),
656 PIN_FIELD_BASE(73, 73, 1, 0x0150, 0x10, 16, 2),
657 PIN_FIELD_BASE(74, 74, 1, 0x0150, 0x10, 18, 2),
658 PIN_FIELD_BASE(75, 75, 1, 0x0150, 0x10, 26, 2),
659 PIN_FIELD_BASE(76, 76, 1, 0x0150, 0x10, 24, 2),
660 PIN_FIELD_BASE(77, 77, 1, 0x0150, 0x10, 30, 2),
661 PIN_FIELD_BASE(78, 78, 1, 0x0150, 0x10, 28, 2),
662 PIN_FIELD_BASE(79, 79, 4, 0x00c0, 0x10, 18, 2),
663 PIN_FIELD_BASE(80, 80, 4, 0x00c0, 0x10, 16, 2),
664 PIN_FIELD_BASE(81, 81, 4, 0x00c0, 0x10, 22, 2),
665 PIN_FIELD_BASE(82, 82, 4, 0x00c0, 0x10, 20, 2),
666 PIN_FIELD_BASE(83, 83, 2, 0x0140, 0x10, 10, 2),
667 PIN_FIELD_BASE(84, 84, 2, 0x0140, 0x10, 10, 2),
668 PIN_FIELD_BASE(85, 85, 2, 0x0140, 0x10, 12, 2),
669 PIN_FIELD_BASE(86, 86, 2, 0x0130, 0x10, 20, 2),
670 PIN_FIELD_BASE(87, 87, 2, 0x0130, 0x10, 20, 2),
671 PIN_FIELD_BASE(88, 88, 2, 0x0130, 0x10, 20, 2),
672 PIN_FIELD_BASE(89, 89, 2, 0x0130, 0x10, 20, 2),
673 PIN_FIELD_BASE(90, 90, 2, 0x0140, 0x10, 12, 2),
674 PIN_FIELD_BASE(91, 91, 2, 0x0140, 0x10, 12, 2),
675 PIN_FIELD_BASE(92, 92, 2, 0x0130, 0x10, 22, 2),
676 PIN_FIELD_BASE(93, 93, 2, 0x0130, 0x10, 22, 2),
677 PIN_FIELD_BASE(94, 94, 2, 0x0130, 0x10, 22, 2),
678 PIN_FIELD_BASE(95, 95, 2, 0x0130, 0x10, 22, 2),
679 PIN_FIELD_BASE(96, 96, 2, 0x0140, 0x10, 2, 2),
680 PIN_FIELD_BASE(97, 97, 2, 0x0140, 0x10, 4, 2),
681 PIN_FIELD_BASE(98, 98, 2, 0x0140, 0x10, 6, 2),
682 PIN_FIELD_BASE(99, 99, 2, 0x0140, 0x10, 2, 2),
683 PIN_FIELD_BASE(100, 100, 2, 0x0140, 0x10, 16, 2),
684 PIN_FIELD_BASE(101, 101, 2, 0x0140, 0x10, 4, 2),
685 PIN_FIELD_BASE(102, 102, 2, 0x0140, 0x10, 4, 2),
686 PIN_FIELD_BASE(103, 103, 2, 0x0140, 0x10, 4, 2),
687 PIN_FIELD_BASE(104, 104, 2, 0x0140, 0x10, 6, 2),
688 PIN_FIELD_BASE(105, 105, 2, 0x0140, 0x10, 6, 2),
689 PIN_FIELD_BASE(106, 106, 2, 0x0140, 0x10, 6, 2),
690 PIN_FIELD_BASE(107, 107, 2, 0x0130, 0x10, 20, 2),
691 PIN_FIELD_BASE(108, 108, 2, 0x0130, 0x10, 20, 2),
692 PIN_FIELD_BASE(109, 109, 2, 0x0130, 0x10, 20, 2),
693 PIN_FIELD_BASE(110, 110, 2, 0x0130, 0x10, 20, 2),
694 PIN_FIELD_BASE(111, 111, 2, 0x0130, 0x10, 24, 2),
695 PIN_FIELD_BASE(112, 112, 2, 0x0130, 0x10, 24, 2),
696 PIN_FIELD_BASE(113, 113, 2, 0x0130, 0x10, 24, 2),
697 PIN_FIELD_BASE(114, 114, 2, 0x0130, 0x10, 24, 2),
698 PIN_FIELD_BASE(115, 115, 2, 0x0130, 0x10, 28, 2),
699 PIN_FIELD_BASE(116, 116, 2, 0x0130, 0x10, 28, 2),
700 PIN_FIELD_BASE(117, 117, 2, 0x0130, 0x10, 28, 2),
701 PIN_FIELD_BASE(118, 118, 2, 0x0130, 0x10, 28, 2),
702 PIN_FIELD_BASE(119, 119, 2, 0x0130, 0x10, 30, 2),
703 PIN_FIELD_BASE(120, 120, 2, 0x0130, 0x10, 30, 2),
704 PIN_FIELD_BASE(121, 121, 3, 0x00b0, 0x10, 6, 2),
705 PIN_FIELD_BASE(122, 122, 3, 0x00b0, 0x10, 12, 2),
706 PIN_FIELD_BASE(123, 123, 3, 0x00b0, 0x10, 10, 2),
707 PIN_FIELD_BASE(124, 124, 3, 0x00b0, 0x10, 8, 2),
708 PIN_FIELD_BASE(125, 125, 2, 0x0140, 0x10, 8, 2),
709 PIN_FIELD_BASE(126, 126, 2, 0x0140, 0x10, 8, 2),
710 PIN_FIELD_BASE(127, 127, 2, 0x0140, 0x10, 8, 2),
711 PIN_FIELD_BASE(128, 128, 2, 0x0140, 0x10, 8, 2),
712 PIN_FIELD_BASE(129, 129, 2, 0x0140, 0x10, 10, 2),
713 PIN_FIELD_BASE(130, 130, 2, 0x0140, 0x10, 10, 2),
714 PIN_FIELD_BASE(131, 131, 1, 0x0120, 0x10, 0, 6),
715 PIN_FIELD_BASE(132, 132, 1, 0x0130, 0x10, 0, 6),
716 PIN_FIELD_BASE(133, 133, 1, 0x0130, 0x10, 6, 6),
717 PIN_FIELD_BASE(134, 134, 1, 0x0130, 0x10, 12, 6),
718 PIN_FIELD_BASE(135, 135, 1, 0x0140, 0x10, 24, 6),
719 PIN_FIELD_BASE(136, 136, 1, 0x0140, 0x10, 24, 6),
720 PIN_FIELD_BASE(137, 137, 1, 0x0150, 0x10, 0, 6),
721 PIN_FIELD_BASE(138, 138, 1, 0x0150, 0x10, 0, 6),
722 PIN_FIELD_BASE(139, 139, 1, 0x0150, 0x10, 0, 6),
723 PIN_FIELD_BASE(140, 140, 1, 0x0150, 0x10, 0, 6),
724 PIN_FIELD_BASE(141, 141, 1, 0x0150, 0x10, 6, 6),
725 PIN_FIELD_BASE(142, 142, 1, 0x0150, 0x10, 6, 6),
726 PIN_FIELD_BASE(143, 143, 1, 0x0120, 0x10, 6, 6),
727 PIN_FIELD_BASE(144, 144, 1, 0x0120, 0x10, 12, 6),
728 PIN_FIELD_BASE(145, 145, 1, 0x0120, 0x10, 18, 6),
729 PIN_FIELD_BASE(146, 146, 1, 0x0120, 0x10, 24, 6),
730 PIN_FIELD_BASE(147, 147, 1, 0x0150, 0x10, 6, 6),
731 PIN_FIELD_BASE(148, 148, 1, 0x0150, 0x10, 6, 6),
732 PIN_FIELD_BASE(149, 149, 1, 0x0140, 0x10, 4, 6),
733 PIN_FIELD_BASE(150, 150, 1, 0x0140, 0x10, 4, 6),
734 PIN_FIELD_BASE(151, 151, 2, 0x0120, 0x10, 24, 6),
735 PIN_FIELD_BASE(152, 152, 2, 0x0120, 0x10, 18, 6),
736 PIN_FIELD_BASE(153, 153, 2, 0x0120, 0x10, 12, 6),
737 PIN_FIELD_BASE(154, 154, 2, 0x0120, 0x10, 6, 6),
738 PIN_FIELD_BASE(155, 155, 2, 0x0130, 0x10, 6, 6),
739 PIN_FIELD_BASE(156, 156, 2, 0x0110, 0x10, 6, 6),
740 PIN_FIELD_BASE(157, 157, 2, 0x0110, 0x10, 0, 6),
741 PIN_FIELD_BASE(158, 158, 2, 0x0120, 0x10, 0, 6),
742 PIN_FIELD_BASE(159, 159, 2, 0x0110, 0x10, 24, 6),
743 PIN_FIELD_BASE(160, 160, 2, 0x0110, 0x10, 18, 6),
744 PIN_FIELD_BASE(161, 161, 2, 0x0110, 0x10, 12, 6),
745 PIN_FIELD_BASE(162, 162, 2, 0x0130, 0x10, 0, 6),
746 PIN_FIELD_BASE(163, 163, 4, 0x00b0, 0x10, 12, 6),
747 PIN_FIELD_BASE(164, 164, 4, 0x00b0, 0x10, 6, 6),
748 PIN_FIELD_BASE(165, 165, 4, 0x00b0, 0x10, 18, 6),
749 PIN_FIELD_BASE(166, 166, 4, 0x00b0, 0x10, 24, 6),
750 PIN_FIELD_BASE(167, 167, 4, 0x00c0, 0x10, 0, 6),
751 PIN_FIELD_BASE(168, 168, 4, 0x00c0, 0x10, 6, 6),
752 PIN_FIELD_BASE(169, 169, 3, 0x00a0, 0x10, 6, 6),
753 PIN_FIELD_BASE(170, 170, 3, 0x00a0, 0x10, 0, 6),
754 PIN_FIELD_BASE(171, 171, 3, 0x00a0, 0x10, 12, 6),
755 PIN_FIELD_BASE(172, 172, 3, 0x00a0, 0x10, 18, 6),
756 PIN_FIELD_BASE(173, 173, 3, 0x00a0, 0x10, 24, 6),
757 PIN_FIELD_BASE(174, 174, 3, 0x00b0, 0x10, 0, 6),
758 PIN_FIELD_BASE(175, 175, 2, 0x0140, 0x10, 14, 2),
759 PIN_FIELD_BASE(176, 176, 2, 0x0140, 0x10, 14, 2),
760 };
761
762 static const struct mtk_pin_field_calc mt8188_pin_pupd_range[] = {
763 PIN_FIELD_BASE(42, 42, 2, 0x00c0, 0x10, 12, 1),
764 PIN_FIELD_BASE(43, 43, 2, 0x00c0, 0x10, 13, 1),
765 PIN_FIELD_BASE(44, 44, 2, 0x00c0, 0x10, 14, 1),
766 PIN_FIELD_BASE(45, 45, 2, 0x00c0, 0x10, 15, 1),
767 PIN_FIELD_BASE(131, 131, 1, 0x00d0, 0x10, 1, 1),
768 PIN_FIELD_BASE(132, 132, 1, 0x00d0, 0x10, 2, 1),
769 PIN_FIELD_BASE(133, 133, 1, 0x00d0, 0x10, 9, 1),
770 PIN_FIELD_BASE(134, 134, 1, 0x00d0, 0x10, 10, 1),
771 PIN_FIELD_BASE(135, 135, 1, 0x00d0, 0x10, 11, 1),
772 PIN_FIELD_BASE(136, 136, 1, 0x00d0, 0x10, 12, 1),
773 PIN_FIELD_BASE(137, 137, 1, 0x00d0, 0x10, 13, 1),
774 PIN_FIELD_BASE(138, 138, 1, 0x00d0, 0x10, 14, 1),
775 PIN_FIELD_BASE(139, 139, 1, 0x00d0, 0x10, 15, 1),
776 PIN_FIELD_BASE(140, 140, 1, 0x00d0, 0x10, 16, 1),
777 PIN_FIELD_BASE(141, 141, 1, 0x00d0, 0x10, 3, 1),
778 PIN_FIELD_BASE(142, 142, 1, 0x00d0, 0x10, 4, 1),
779 PIN_FIELD_BASE(143, 143, 1, 0x00d0, 0x10, 5, 1),
780 PIN_FIELD_BASE(144, 144, 1, 0x00d0, 0x10, 6, 1),
781 PIN_FIELD_BASE(145, 145, 1, 0x00d0, 0x10, 7, 1),
782 PIN_FIELD_BASE(146, 146, 1, 0x00d0, 0x10, 8, 1),
783 PIN_FIELD_BASE(147, 147, 1, 0x00d0, 0x10, 18, 1),
784 PIN_FIELD_BASE(148, 148, 1, 0x00d0, 0x10, 19, 1),
785 PIN_FIELD_BASE(149, 149, 1, 0x00d0, 0x10, 17, 1),
786 PIN_FIELD_BASE(150, 150, 1, 0x00d0, 0x10, 0, 1),
787 PIN_FIELD_BASE(151, 151, 2, 0x00c0, 0x10, 9, 1),
788 PIN_FIELD_BASE(152, 152, 2, 0x00c0, 0x10, 8, 1),
789 PIN_FIELD_BASE(153, 153, 2, 0x00c0, 0x10, 7, 1),
790 PIN_FIELD_BASE(154, 154, 2, 0x00c0, 0x10, 6, 1),
791 PIN_FIELD_BASE(155, 155, 2, 0x00c0, 0x10, 11, 1),
792 PIN_FIELD_BASE(156, 156, 2, 0x00c0, 0x10, 1, 1),
793 PIN_FIELD_BASE(157, 157, 2, 0x00c0, 0x10, 0, 1),
794 PIN_FIELD_BASE(158, 158, 2, 0x00c0, 0x10, 5, 1),
795 PIN_FIELD_BASE(159, 159, 2, 0x00c0, 0x10, 4, 1),
796 PIN_FIELD_BASE(160, 160, 2, 0x00c0, 0x10, 3, 1),
797 PIN_FIELD_BASE(161, 161, 2, 0x00c0, 0x10, 2, 1),
798 PIN_FIELD_BASE(162, 162, 2, 0x00c0, 0x10, 10, 1),
799 PIN_FIELD_BASE(163, 163, 4, 0x0070, 0x10, 1, 1),
800 PIN_FIELD_BASE(164, 164, 4, 0x0070, 0x10, 0, 1),
801 PIN_FIELD_BASE(165, 165, 4, 0x0070, 0x10, 2, 1),
802 PIN_FIELD_BASE(166, 166, 4, 0x0070, 0x10, 3, 1),
803 PIN_FIELD_BASE(167, 167, 4, 0x0070, 0x10, 4, 1),
804 PIN_FIELD_BASE(168, 168, 4, 0x0070, 0x10, 5, 1),
805 PIN_FIELD_BASE(169, 169, 3, 0x0060, 0x10, 1, 1),
806 PIN_FIELD_BASE(170, 170, 3, 0x0060, 0x10, 0, 1),
807 PIN_FIELD_BASE(171, 171, 3, 0x0060, 0x10, 2, 1),
808 PIN_FIELD_BASE(172, 172, 3, 0x0060, 0x10, 3, 1),
809 PIN_FIELD_BASE(173, 173, 3, 0x0060, 0x10, 4, 1),
810 PIN_FIELD_BASE(174, 174, 3, 0x0060, 0x10, 5, 1),
811 };
812
813 static const struct mtk_pin_field_calc mt8188_pin_r0_range[] = {
814 PIN_FIELD_BASE(42, 42, 2, 0x00f0, 0x10, 12, 1),
815 PIN_FIELD_BASE(43, 43, 2, 0x00f0, 0x10, 13, 1),
816 PIN_FIELD_BASE(44, 44, 2, 0x00f0, 0x10, 14, 1),
817 PIN_FIELD_BASE(45, 45, 2, 0x00f0, 0x10, 15, 1),
818 PIN_FIELD_BASE(131, 131, 1, 0x0100, 0x10, 1, 1),
819 PIN_FIELD_BASE(132, 132, 1, 0x0100, 0x10, 2, 1),
820 PIN_FIELD_BASE(133, 133, 1, 0x0100, 0x10, 9, 1),
821 PIN_FIELD_BASE(134, 134, 1, 0x0100, 0x10, 10, 1),
822 PIN_FIELD_BASE(135, 135, 1, 0x0100, 0x10, 11, 1),
823 PIN_FIELD_BASE(136, 136, 1, 0x0100, 0x10, 12, 1),
824 PIN_FIELD_BASE(137, 137, 1, 0x0100, 0x10, 13, 1),
825 PIN_FIELD_BASE(138, 138, 1, 0x0100, 0x10, 14, 1),
826 PIN_FIELD_BASE(139, 139, 1, 0x0100, 0x10, 15, 1),
827 PIN_FIELD_BASE(140, 140, 1, 0x0100, 0x10, 16, 1),
828 PIN_FIELD_BASE(141, 141, 1, 0x0100, 0x10, 3, 1),
829 PIN_FIELD_BASE(142, 142, 1, 0x0100, 0x10, 4, 1),
830 PIN_FIELD_BASE(143, 143, 1, 0x0100, 0x10, 5, 1),
831 PIN_FIELD_BASE(144, 144, 1, 0x0100, 0x10, 6, 1),
832 PIN_FIELD_BASE(145, 145, 1, 0x0100, 0x10, 7, 1),
833 PIN_FIELD_BASE(146, 146, 1, 0x0100, 0x10, 8, 1),
834 PIN_FIELD_BASE(147, 147, 1, 0x0100, 0x10, 18, 1),
835 PIN_FIELD_BASE(148, 148, 1, 0x0100, 0x10, 19, 1),
836 PIN_FIELD_BASE(149, 149, 1, 0x0100, 0x10, 17, 1),
837 PIN_FIELD_BASE(150, 150, 1, 0x0100, 0x10, 0, 1),
838 PIN_FIELD_BASE(151, 151, 2, 0x00f0, 0x10, 9, 1),
839 PIN_FIELD_BASE(152, 152, 2, 0x00f0, 0x10, 8, 1),
840 PIN_FIELD_BASE(153, 153, 2, 0x00f0, 0x10, 7, 1),
841 PIN_FIELD_BASE(154, 154, 2, 0x00f0, 0x10, 6, 1),
842 PIN_FIELD_BASE(155, 155, 2, 0x00f0, 0x10, 11, 1),
843 PIN_FIELD_BASE(156, 156, 2, 0x00f0, 0x10, 1, 1),
844 PIN_FIELD_BASE(157, 157, 2, 0x00f0, 0x10, 0, 1),
845 PIN_FIELD_BASE(158, 158, 2, 0x00f0, 0x10, 5, 1),
846 PIN_FIELD_BASE(159, 159, 2, 0x00f0, 0x10, 4, 1),
847 PIN_FIELD_BASE(160, 160, 2, 0x00f0, 0x10, 3, 1),
848 PIN_FIELD_BASE(161, 161, 2, 0x00f0, 0x10, 2, 1),
849 PIN_FIELD_BASE(162, 162, 2, 0x00f0, 0x10, 10, 1),
850 PIN_FIELD_BASE(163, 163, 4, 0x0090, 0x10, 1, 1),
851 PIN_FIELD_BASE(164, 164, 4, 0x0090, 0x10, 0, 1),
852 PIN_FIELD_BASE(165, 165, 4, 0x0090, 0x10, 2, 1),
853 PIN_FIELD_BASE(166, 166, 4, 0x0090, 0x10, 3, 1),
854 PIN_FIELD_BASE(167, 167, 4, 0x0090, 0x10, 4, 1),
855 PIN_FIELD_BASE(168, 168, 4, 0x0090, 0x10, 5, 1),
856 PIN_FIELD_BASE(169, 169, 3, 0x0080, 0x10, 1, 1),
857 PIN_FIELD_BASE(170, 170, 3, 0x0080, 0x10, 0, 1),
858 PIN_FIELD_BASE(171, 171, 3, 0x0080, 0x10, 2, 1),
859 PIN_FIELD_BASE(172, 172, 3, 0x0080, 0x10, 3, 1),
860 PIN_FIELD_BASE(173, 173, 3, 0x0080, 0x10, 4, 1),
861 PIN_FIELD_BASE(174, 174, 3, 0x0080, 0x10, 5, 1),
862 };
863
864 static const struct mtk_pin_field_calc mt8188_pin_r1_range[] = {
865 PIN_FIELD_BASE(42, 42, 2, 0x0100, 0x10, 12, 1),
866 PIN_FIELD_BASE(43, 43, 2, 0x0100, 0x10, 13, 1),
867 PIN_FIELD_BASE(44, 44, 2, 0x0100, 0x10, 14, 1),
868 PIN_FIELD_BASE(45, 45, 2, 0x0100, 0x10, 15, 1),
869 PIN_FIELD_BASE(131, 131, 1, 0x0110, 0x10, 1, 1),
870 PIN_FIELD_BASE(132, 132, 1, 0x0110, 0x10, 2, 1),
871 PIN_FIELD_BASE(133, 133, 1, 0x0110, 0x10, 9, 1),
872 PIN_FIELD_BASE(134, 134, 1, 0x0110, 0x10, 10, 1),
873 PIN_FIELD_BASE(135, 135, 1, 0x0110, 0x10, 11, 1),
874 PIN_FIELD_BASE(136, 136, 1, 0x0110, 0x10, 12, 1),
875 PIN_FIELD_BASE(137, 137, 1, 0x0110, 0x10, 13, 1),
876 PIN_FIELD_BASE(138, 138, 1, 0x0110, 0x10, 14, 1),
877 PIN_FIELD_BASE(139, 139, 1, 0x0110, 0x10, 15, 1),
878 PIN_FIELD_BASE(140, 140, 1, 0x0110, 0x10, 16, 1),
879 PIN_FIELD_BASE(141, 141, 1, 0x0110, 0x10, 3, 1),
880 PIN_FIELD_BASE(142, 142, 1, 0x0110, 0x10, 4, 1),
881 PIN_FIELD_BASE(143, 143, 1, 0x0110, 0x10, 5, 1),
882 PIN_FIELD_BASE(144, 144, 1, 0x0110, 0x10, 6, 1),
883 PIN_FIELD_BASE(145, 145, 1, 0x0110, 0x10, 7, 1),
884 PIN_FIELD_BASE(146, 146, 1, 0x0110, 0x10, 8, 1),
885 PIN_FIELD_BASE(147, 147, 1, 0x0110, 0x10, 18, 1),
886 PIN_FIELD_BASE(148, 148, 1, 0x0110, 0x10, 19, 1),
887 PIN_FIELD_BASE(149, 149, 1, 0x0110, 0x10, 17, 1),
888 PIN_FIELD_BASE(150, 150, 1, 0x0110, 0x10, 0, 1),
889 PIN_FIELD_BASE(151, 151, 2, 0x0100, 0x10, 9, 1),
890 PIN_FIELD_BASE(152, 152, 2, 0x0100, 0x10, 8, 1),
891 PIN_FIELD_BASE(153, 153, 2, 0x0100, 0x10, 7, 1),
892 PIN_FIELD_BASE(154, 154, 2, 0x0100, 0x10, 6, 1),
893 PIN_FIELD_BASE(155, 155, 2, 0x0100, 0x10, 11, 1),
894 PIN_FIELD_BASE(156, 156, 2, 0x0100, 0x10, 1, 1),
895 PIN_FIELD_BASE(157, 157, 2, 0x0100, 0x10, 0, 1),
896 PIN_FIELD_BASE(158, 158, 2, 0x0100, 0x10, 5, 1),
897 PIN_FIELD_BASE(159, 159, 2, 0x0100, 0x10, 4, 1),
898 PIN_FIELD_BASE(160, 160, 2, 0x0100, 0x10, 3, 1),
899 PIN_FIELD_BASE(161, 161, 2, 0x0100, 0x10, 2, 1),
900 PIN_FIELD_BASE(162, 162, 2, 0x0100, 0x10, 10, 1),
901 PIN_FIELD_BASE(163, 163, 4, 0x00a0, 0x10, 1, 1),
902 PIN_FIELD_BASE(164, 164, 4, 0x00a0, 0x10, 0, 1),
903 PIN_FIELD_BASE(165, 165, 4, 0x00a0, 0x10, 2, 1),
904 PIN_FIELD_BASE(166, 166, 4, 0x00a0, 0x10, 3, 1),
905 PIN_FIELD_BASE(167, 167, 4, 0x00a0, 0x10, 4, 1),
906 PIN_FIELD_BASE(168, 168, 4, 0x00a0, 0x10, 5, 1),
907 PIN_FIELD_BASE(169, 169, 3, 0x0090, 0x10, 1, 1),
908 PIN_FIELD_BASE(170, 170, 3, 0x0090, 0x10, 0, 1),
909 PIN_FIELD_BASE(171, 171, 3, 0x0090, 0x10, 2, 1),
910 PIN_FIELD_BASE(172, 172, 3, 0x0090, 0x10, 3, 1),
911 PIN_FIELD_BASE(173, 173, 3, 0x0090, 0x10, 4, 1),
912 PIN_FIELD_BASE(174, 174, 3, 0x0090, 0x10, 5, 1),
913 };
914
915 static const struct mtk_pin_field_calc mt8188_pin_pu_range[] = {
916 PIN_FIELD_BASE(0, 0, 1, 0x00e0, 0x10, 6, 1),
917 PIN_FIELD_BASE(1, 1, 1, 0x00e0, 0x10, 7, 1),
918 PIN_FIELD_BASE(2, 2, 1, 0x00e0, 0x10, 8, 1),
919 PIN_FIELD_BASE(3, 3, 1, 0x00e0, 0x10, 9, 1),
920 PIN_FIELD_BASE(4, 4, 1, 0x00e0, 0x10, 10, 1),
921 PIN_FIELD_BASE(5, 5, 1, 0x00e0, 0x10, 11, 1),
922 PIN_FIELD_BASE(6, 6, 1, 0x00e0, 0x10, 12, 1),
923 PIN_FIELD_BASE(7, 7, 1, 0x00e0, 0x10, 13, 1),
924 PIN_FIELD_BASE(8, 8, 1, 0x00e0, 0x10, 14, 1),
925 PIN_FIELD_BASE(9, 9, 1, 0x00e0, 0x10, 15, 1),
926 PIN_FIELD_BASE(10, 10, 1, 0x00e0, 0x10, 16, 1),
927 PIN_FIELD_BASE(11, 11, 1, 0x00e0, 0x10, 17, 1),
928 PIN_FIELD_BASE(12, 12, 2, 0x00d0, 0x10, 12, 1),
929 PIN_FIELD_BASE(13, 13, 2, 0x00d0, 0x10, 13, 1),
930 PIN_FIELD_BASE(14, 14, 2, 0x00d0, 0x10, 14, 1),
931 PIN_FIELD_BASE(15, 15, 2, 0x00d0, 0x10, 15, 1),
932 PIN_FIELD_BASE(16, 16, 3, 0x0070, 0x10, 1, 1),
933 PIN_FIELD_BASE(17, 17, 3, 0x0070, 0x10, 2, 1),
934 PIN_FIELD_BASE(18, 18, 4, 0x0080, 0x10, 3, 1),
935 PIN_FIELD_BASE(19, 19, 4, 0x0080, 0x10, 5, 1),
936 PIN_FIELD_BASE(20, 20, 4, 0x0080, 0x10, 4, 1),
937 PIN_FIELD_BASE(21, 21, 4, 0x0080, 0x10, 6, 1),
938 PIN_FIELD_BASE(22, 22, 4, 0x0080, 0x10, 0, 1),
939 PIN_FIELD_BASE(23, 23, 4, 0x0080, 0x10, 1, 1),
940 PIN_FIELD_BASE(24, 24, 4, 0x0080, 0x10, 2, 1),
941 PIN_FIELD_BASE(25, 25, 1, 0x00e0, 0x10, 3, 1),
942 PIN_FIELD_BASE(26, 26, 1, 0x00e0, 0x10, 2, 1),
943 PIN_FIELD_BASE(27, 27, 1, 0x00e0, 0x10, 5, 1),
944 PIN_FIELD_BASE(28, 28, 1, 0x00e0, 0x10, 4, 1),
945 PIN_FIELD_BASE(29, 29, 1, 0x00e0, 0x10, 0, 1),
946 PIN_FIELD_BASE(30, 30, 1, 0x00e0, 0x10, 1, 1),
947 PIN_FIELD_BASE(31, 31, 1, 0x00f0, 0x10, 11, 1),
948 PIN_FIELD_BASE(32, 32, 1, 0x00f0, 0x10, 10, 1),
949 PIN_FIELD_BASE(33, 33, 1, 0x00f0, 0x10, 13, 1),
950 PIN_FIELD_BASE(34, 34, 1, 0x00f0, 0x10, 12, 1),
951 PIN_FIELD_BASE(35, 35, 1, 0x00f0, 0x10, 15, 1),
952 PIN_FIELD_BASE(36, 36, 1, 0x00f0, 0x10, 14, 1),
953 PIN_FIELD_BASE(37, 37, 1, 0x00e0, 0x10, 21, 1),
954 PIN_FIELD_BASE(38, 38, 1, 0x00e0, 0x10, 18, 1),
955 PIN_FIELD_BASE(39, 39, 1, 0x00e0, 0x10, 19, 1),
956 PIN_FIELD_BASE(40, 40, 1, 0x00e0, 0x10, 20, 1),
957 PIN_FIELD_BASE(41, 41, 1, 0x00e0, 0x10, 22, 1),
958 PIN_FIELD_BASE(46, 46, 3, 0x0070, 0x10, 0, 1),
959 PIN_FIELD_BASE(47, 47, 1, 0x00e0, 0x10, 25, 1),
960 PIN_FIELD_BASE(48, 48, 1, 0x00e0, 0x10, 24, 1),
961 PIN_FIELD_BASE(49, 49, 1, 0x00e0, 0x10, 23, 1),
962 PIN_FIELD_BASE(50, 50, 3, 0x0070, 0x10, 5, 1),
963 PIN_FIELD_BASE(51, 51, 3, 0x0070, 0x10, 4, 1),
964 PIN_FIELD_BASE(52, 52, 3, 0x0070, 0x10, 3, 1),
965 PIN_FIELD_BASE(53, 53, 3, 0x0070, 0x10, 6, 1),
966 PIN_FIELD_BASE(54, 54, 3, 0x0070, 0x10, 7, 1),
967 PIN_FIELD_BASE(55, 55, 1, 0x00e0, 0x10, 26, 1),
968 PIN_FIELD_BASE(56, 56, 1, 0x00e0, 0x10, 29, 1),
969 PIN_FIELD_BASE(57, 57, 2, 0x00e0, 0x10, 6, 1),
970 PIN_FIELD_BASE(58, 58, 2, 0x00e0, 0x10, 9, 1),
971 PIN_FIELD_BASE(59, 59, 1, 0x00e0, 0x10, 27, 1),
972 PIN_FIELD_BASE(60, 60, 1, 0x00e0, 0x10, 30, 1),
973 PIN_FIELD_BASE(61, 61, 1, 0x00e0, 0x10, 28, 1),
974 PIN_FIELD_BASE(62, 62, 1, 0x00e0, 0x10, 31, 1),
975 PIN_FIELD_BASE(63, 63, 2, 0x00e0, 0x10, 7, 1),
976 PIN_FIELD_BASE(64, 64, 2, 0x00e0, 0x10, 10, 1),
977 PIN_FIELD_BASE(65, 65, 4, 0x0080, 0x10, 7, 1),
978 PIN_FIELD_BASE(66, 66, 4, 0x0080, 0x10, 9, 1),
979 PIN_FIELD_BASE(67, 67, 4, 0x0080, 0x10, 8, 1),
980 PIN_FIELD_BASE(68, 68, 4, 0x0080, 0x10, 10, 1),
981 PIN_FIELD_BASE(69, 69, 1, 0x00f0, 0x10, 1, 1),
982 PIN_FIELD_BASE(70, 70, 1, 0x00f0, 0x10, 0, 1),
983 PIN_FIELD_BASE(71, 71, 1, 0x00f0, 0x10, 5, 1),
984 PIN_FIELD_BASE(72, 72, 1, 0x00f0, 0x10, 4, 1),
985 PIN_FIELD_BASE(73, 73, 1, 0x00f0, 0x10, 2, 1),
986 PIN_FIELD_BASE(74, 74, 1, 0x00f0, 0x10, 3, 1),
987 PIN_FIELD_BASE(75, 75, 1, 0x00f0, 0x10, 7, 1),
988 PIN_FIELD_BASE(76, 76, 1, 0x00f0, 0x10, 6, 1),
989 PIN_FIELD_BASE(77, 77, 1, 0x00f0, 0x10, 9, 1),
990 PIN_FIELD_BASE(78, 78, 1, 0x00f0, 0x10, 8, 1),
991 PIN_FIELD_BASE(79, 79, 4, 0x0080, 0x10, 12, 1),
992 PIN_FIELD_BASE(80, 80, 4, 0x0080, 0x10, 11, 1),
993 PIN_FIELD_BASE(81, 81, 4, 0x0080, 0x10, 14, 1),
994 PIN_FIELD_BASE(82, 82, 4, 0x0080, 0x10, 13, 1),
995 PIN_FIELD_BASE(83, 83, 2, 0x00e0, 0x10, 16, 1),
996 PIN_FIELD_BASE(84, 84, 2, 0x00e0, 0x10, 15, 1),
997 PIN_FIELD_BASE(85, 85, 2, 0x00e0, 0x10, 17, 1),
998 PIN_FIELD_BASE(86, 86, 2, 0x00e0, 0x10, 19, 1),
999 PIN_FIELD_BASE(87, 87, 2, 0x00e0, 0x10, 18, 1),
1000 PIN_FIELD_BASE(88, 88, 2, 0x00e0, 0x10, 20, 1),
1001 PIN_FIELD_BASE(89, 89, 2, 0x00e0, 0x10, 22, 1),
1002 PIN_FIELD_BASE(90, 90, 2, 0x00e0, 0x10, 21, 1),
1003 PIN_FIELD_BASE(91, 91, 2, 0x00e0, 0x10, 23, 1),
1004 PIN_FIELD_BASE(92, 92, 2, 0x00e0, 0x10, 3, 1),
1005 PIN_FIELD_BASE(93, 93, 2, 0x00e0, 0x10, 2, 1),
1006 PIN_FIELD_BASE(94, 94, 2, 0x00e0, 0x10, 5, 1),
1007 PIN_FIELD_BASE(95, 95, 2, 0x00e0, 0x10, 4, 1),
1008 PIN_FIELD_BASE(96, 96, 2, 0x00d0, 0x10, 31, 1),
1009 PIN_FIELD_BASE(97, 97, 2, 0x00e0, 0x10, 0, 1),
1010 PIN_FIELD_BASE(98, 98, 2, 0x00e0, 0x10, 8, 1),
1011 PIN_FIELD_BASE(99, 99, 2, 0x00d0, 0x10, 30, 1),
1012 PIN_FIELD_BASE(100, 100, 2, 0x00e0, 0x10, 1, 1),
1013 PIN_FIELD_BASE(101, 101, 2, 0x00d0, 0x10, 0, 1),
1014 PIN_FIELD_BASE(102, 102, 2, 0x00d0, 0x10, 5, 1),
1015 PIN_FIELD_BASE(103, 103, 2, 0x00d0, 0x10, 3, 1),
1016 PIN_FIELD_BASE(104, 104, 2, 0x00d0, 0x10, 4, 1),
1017 PIN_FIELD_BASE(105, 105, 2, 0x00d0, 0x10, 1, 1),
1018 PIN_FIELD_BASE(106, 106, 2, 0x00d0, 0x10, 2, 1),
1019 PIN_FIELD_BASE(107, 107, 2, 0x00d0, 0x10, 21, 1),
1020 PIN_FIELD_BASE(108, 108, 2, 0x00d0, 0x10, 16, 1),
1021 PIN_FIELD_BASE(109, 109, 2, 0x00d0, 0x10, 22, 1),
1022 PIN_FIELD_BASE(110, 110, 2, 0x00d0, 0x10, 17, 1),
1023 PIN_FIELD_BASE(111, 111, 2, 0x00d0, 0x10, 18, 1),
1024 PIN_FIELD_BASE(112, 112, 2, 0x00d0, 0x10, 19, 1),
1025 PIN_FIELD_BASE(113, 113, 2, 0x00d0, 0x10, 20, 1),
1026 PIN_FIELD_BASE(114, 114, 2, 0x00d0, 0x10, 28, 1),
1027 PIN_FIELD_BASE(115, 115, 2, 0x00d0, 0x10, 23, 1),
1028 PIN_FIELD_BASE(116, 116, 2, 0x00d0, 0x10, 29, 1),
1029 PIN_FIELD_BASE(117, 117, 2, 0x00d0, 0x10, 24, 1),
1030 PIN_FIELD_BASE(118, 118, 2, 0x00d0, 0x10, 25, 1),
1031 PIN_FIELD_BASE(119, 119, 2, 0x00d0, 0x10, 26, 1),
1032 PIN_FIELD_BASE(120, 120, 2, 0x00d0, 0x10, 27, 1),
1033 PIN_FIELD_BASE(121, 121, 3, 0x0070, 0x10, 8, 1),
1034 PIN_FIELD_BASE(122, 122, 3, 0x0070, 0x10, 11, 1),
1035 PIN_FIELD_BASE(123, 123, 3, 0x0070, 0x10, 10, 1),
1036 PIN_FIELD_BASE(124, 124, 3, 0x0070, 0x10, 9, 1),
1037 PIN_FIELD_BASE(125, 125, 2, 0x00d0, 0x10, 6, 1),
1038 PIN_FIELD_BASE(126, 126, 2, 0x00d0, 0x10, 7, 1),
1039 PIN_FIELD_BASE(127, 127, 2, 0x00d0, 0x10, 8, 1),
1040 PIN_FIELD_BASE(128, 128, 2, 0x00d0, 0x10, 9, 1),
1041 PIN_FIELD_BASE(129, 129, 2, 0x00d0, 0x10, 10, 1),
1042 PIN_FIELD_BASE(130, 130, 2, 0x00d0, 0x10, 11, 1),
1043 PIN_FIELD_BASE(175, 175, 2, 0x00e0, 0x10, 11, 1),
1044 PIN_FIELD_BASE(176, 176, 2, 0x00e0, 0x10, 12, 1),
1045 };
1046
1047 static const struct mtk_pin_field_calc mt8188_pin_pd_range[] = {
1048 PIN_FIELD_BASE(0, 0, 1, 0x00b0, 0x10, 6, 1),
1049 PIN_FIELD_BASE(1, 1, 1, 0x00b0, 0x10, 7, 1),
1050 PIN_FIELD_BASE(2, 2, 1, 0x00b0, 0x10, 8, 1),
1051 PIN_FIELD_BASE(3, 3, 1, 0x00b0, 0x10, 9, 1),
1052 PIN_FIELD_BASE(4, 4, 1, 0x00b0, 0x10, 10, 1),
1053 PIN_FIELD_BASE(5, 5, 1, 0x00b0, 0x10, 11, 1),
1054 PIN_FIELD_BASE(6, 6, 1, 0x00b0, 0x10, 12, 1),
1055 PIN_FIELD_BASE(7, 7, 1, 0x00b0, 0x10, 13, 1),
1056 PIN_FIELD_BASE(8, 8, 1, 0x00b0, 0x10, 14, 1),
1057 PIN_FIELD_BASE(9, 9, 1, 0x00b0, 0x10, 15, 1),
1058 PIN_FIELD_BASE(10, 10, 1, 0x00b0, 0x10, 16, 1),
1059 PIN_FIELD_BASE(11, 11, 1, 0x00b0, 0x10, 17, 1),
1060 PIN_FIELD_BASE(12, 12, 2, 0x00a0, 0x10, 12, 1),
1061 PIN_FIELD_BASE(13, 13, 2, 0x00a0, 0x10, 13, 1),
1062 PIN_FIELD_BASE(14, 14, 2, 0x00a0, 0x10, 14, 1),
1063 PIN_FIELD_BASE(15, 15, 2, 0x00a0, 0x10, 15, 1),
1064 PIN_FIELD_BASE(16, 16, 3, 0x0050, 0x10, 1, 1),
1065 PIN_FIELD_BASE(17, 17, 3, 0x0050, 0x10, 2, 1),
1066 PIN_FIELD_BASE(18, 18, 4, 0x0060, 0x10, 3, 1),
1067 PIN_FIELD_BASE(19, 19, 4, 0x0060, 0x10, 5, 1),
1068 PIN_FIELD_BASE(20, 20, 4, 0x0060, 0x10, 4, 1),
1069 PIN_FIELD_BASE(21, 21, 4, 0x0060, 0x10, 6, 1),
1070 PIN_FIELD_BASE(22, 22, 4, 0x0060, 0x10, 0, 1),
1071 PIN_FIELD_BASE(23, 23, 4, 0x0060, 0x10, 1, 1),
1072 PIN_FIELD_BASE(24, 24, 4, 0x0060, 0x10, 2, 1),
1073 PIN_FIELD_BASE(25, 25, 1, 0x00b0, 0x10, 3, 1),
1074 PIN_FIELD_BASE(26, 26, 1, 0x00b0, 0x10, 2, 1),
1075 PIN_FIELD_BASE(27, 27, 1, 0x00b0, 0x10, 5, 1),
1076 PIN_FIELD_BASE(28, 28, 1, 0x00b0, 0x10, 4, 1),
1077 PIN_FIELD_BASE(29, 29, 1, 0x00b0, 0x10, 0, 1),
1078 PIN_FIELD_BASE(30, 30, 1, 0x00b0, 0x10, 1, 1),
1079 PIN_FIELD_BASE(31, 31, 1, 0x00c0, 0x10, 11, 1),
1080 PIN_FIELD_BASE(32, 32, 1, 0x00c0, 0x10, 10, 1),
1081 PIN_FIELD_BASE(33, 33, 1, 0x00c0, 0x10, 13, 1),
1082 PIN_FIELD_BASE(34, 34, 1, 0x00c0, 0x10, 12, 1),
1083 PIN_FIELD_BASE(35, 35, 1, 0x00c0, 0x10, 15, 1),
1084 PIN_FIELD_BASE(36, 36, 1, 0x00c0, 0x10, 14, 1),
1085 PIN_FIELD_BASE(37, 37, 1, 0x00b0, 0x10, 21, 1),
1086 PIN_FIELD_BASE(38, 38, 1, 0x00b0, 0x10, 18, 1),
1087 PIN_FIELD_BASE(39, 39, 1, 0x00b0, 0x10, 19, 1),
1088 PIN_FIELD_BASE(40, 40, 1, 0x00b0, 0x10, 20, 1),
1089 PIN_FIELD_BASE(41, 41, 1, 0x00b0, 0x10, 22, 1),
1090 PIN_FIELD_BASE(46, 46, 3, 0x0050, 0x10, 0, 1),
1091 PIN_FIELD_BASE(47, 47, 1, 0x00b0, 0x10, 25, 1),
1092 PIN_FIELD_BASE(48, 48, 1, 0x00b0, 0x10, 24, 1),
1093 PIN_FIELD_BASE(49, 49, 1, 0x00b0, 0x10, 23, 1),
1094 PIN_FIELD_BASE(50, 50, 3, 0x0050, 0x10, 5, 1),
1095 PIN_FIELD_BASE(51, 51, 3, 0x0050, 0x10, 4, 1),
1096 PIN_FIELD_BASE(52, 52, 3, 0x0050, 0x10, 3, 1),
1097 PIN_FIELD_BASE(53, 53, 3, 0x0050, 0x10, 6, 1),
1098 PIN_FIELD_BASE(54, 54, 3, 0x0050, 0x10, 7, 1),
1099 PIN_FIELD_BASE(55, 55, 1, 0x00b0, 0x10, 26, 1),
1100 PIN_FIELD_BASE(56, 56, 1, 0x00b0, 0x10, 29, 1),
1101 PIN_FIELD_BASE(57, 57, 2, 0x00b0, 0x10, 6, 1),
1102 PIN_FIELD_BASE(58, 58, 2, 0x00b0, 0x10, 9, 1),
1103 PIN_FIELD_BASE(59, 59, 1, 0x00b0, 0x10, 27, 1),
1104 PIN_FIELD_BASE(60, 60, 1, 0x00b0, 0x10, 30, 1),
1105 PIN_FIELD_BASE(61, 61, 1, 0x00b0, 0x10, 28, 1),
1106 PIN_FIELD_BASE(62, 62, 1, 0x00b0, 0x10, 31, 1),
1107 PIN_FIELD_BASE(63, 63, 2, 0x00b0, 0x10, 7, 1),
1108 PIN_FIELD_BASE(64, 64, 2, 0x00b0, 0x10, 10, 1),
1109 PIN_FIELD_BASE(65, 65, 4, 0x0060, 0x10, 7, 1),
1110 PIN_FIELD_BASE(66, 66, 4, 0x0060, 0x10, 9, 1),
1111 PIN_FIELD_BASE(67, 67, 4, 0x0060, 0x10, 8, 1),
1112 PIN_FIELD_BASE(68, 68, 4, 0x0060, 0x10, 10, 1),
1113 PIN_FIELD_BASE(69, 69, 1, 0x00c0, 0x10, 1, 1),
1114 PIN_FIELD_BASE(70, 70, 1, 0x00c0, 0x10, 0, 1),
1115 PIN_FIELD_BASE(71, 71, 1, 0x00c0, 0x10, 5, 1),
1116 PIN_FIELD_BASE(72, 72, 1, 0x00c0, 0x10, 4, 1),
1117 PIN_FIELD_BASE(73, 73, 1, 0x00c0, 0x10, 2, 1),
1118 PIN_FIELD_BASE(74, 74, 1, 0x00c0, 0x10, 3, 1),
1119 PIN_FIELD_BASE(75, 75, 1, 0x00c0, 0x10, 7, 1),
1120 PIN_FIELD_BASE(76, 76, 1, 0x00c0, 0x10, 6, 1),
1121 PIN_FIELD_BASE(77, 77, 1, 0x00c0, 0x10, 9, 1),
1122 PIN_FIELD_BASE(78, 78, 1, 0x00c0, 0x10, 8, 1),
1123 PIN_FIELD_BASE(79, 79, 4, 0x0060, 0x10, 12, 1),
1124 PIN_FIELD_BASE(80, 80, 4, 0x0060, 0x10, 11, 1),
1125 PIN_FIELD_BASE(81, 81, 4, 0x0060, 0x10, 14, 1),
1126 PIN_FIELD_BASE(82, 82, 4, 0x0060, 0x10, 13, 1),
1127 PIN_FIELD_BASE(83, 83, 2, 0x00b0, 0x10, 16, 1),
1128 PIN_FIELD_BASE(84, 84, 2, 0x00b0, 0x10, 15, 1),
1129 PIN_FIELD_BASE(85, 85, 2, 0x00b0, 0x10, 17, 1),
1130 PIN_FIELD_BASE(86, 86, 2, 0x00b0, 0x10, 19, 1),
1131 PIN_FIELD_BASE(87, 87, 2, 0x00b0, 0x10, 18, 1),
1132 PIN_FIELD_BASE(88, 88, 2, 0x00b0, 0x10, 20, 1),
1133 PIN_FIELD_BASE(89, 89, 2, 0x00b0, 0x10, 22, 1),
1134 PIN_FIELD_BASE(90, 90, 2, 0x00b0, 0x10, 21, 1),
1135 PIN_FIELD_BASE(91, 91, 2, 0x00b0, 0x10, 23, 1),
1136 PIN_FIELD_BASE(92, 92, 2, 0x00b0, 0x10, 3, 1),
1137 PIN_FIELD_BASE(93, 93, 2, 0x00b0, 0x10, 2, 1),
1138 PIN_FIELD_BASE(94, 94, 2, 0x00b0, 0x10, 5, 1),
1139 PIN_FIELD_BASE(95, 95, 2, 0x00b0, 0x10, 4, 1),
1140 PIN_FIELD_BASE(96, 96, 2, 0x00a0, 0x10, 31, 1),
1141 PIN_FIELD_BASE(97, 97, 2, 0x00b0, 0x10, 0, 1),
1142 PIN_FIELD_BASE(98, 98, 2, 0x00b0, 0x10, 8, 1),
1143 PIN_FIELD_BASE(99, 99, 2, 0x00a0, 0x10, 30, 1),
1144 PIN_FIELD_BASE(100, 100, 2, 0x00b0, 0x10, 1, 1),
1145 PIN_FIELD_BASE(101, 101, 2, 0x00a0, 0x10, 0, 1),
1146 PIN_FIELD_BASE(102, 102, 2, 0x00a0, 0x10, 5, 1),
1147 PIN_FIELD_BASE(103, 103, 2, 0x00a0, 0x10, 3, 1),
1148 PIN_FIELD_BASE(104, 104, 2, 0x00a0, 0x10, 4, 1),
1149 PIN_FIELD_BASE(105, 105, 2, 0x00a0, 0x10, 1, 1),
1150 PIN_FIELD_BASE(106, 106, 2, 0x00a0, 0x10, 2, 1),
1151 PIN_FIELD_BASE(107, 107, 2, 0x00a0, 0x10, 21, 1),
1152 PIN_FIELD_BASE(108, 108, 2, 0x00a0, 0x10, 16, 1),
1153 PIN_FIELD_BASE(109, 109, 2, 0x00a0, 0x10, 22, 1),
1154 PIN_FIELD_BASE(110, 110, 2, 0x00a0, 0x10, 17, 1),
1155 PIN_FIELD_BASE(111, 111, 2, 0x00a0, 0x10, 18, 1),
1156 PIN_FIELD_BASE(112, 112, 2, 0x00a0, 0x10, 19, 1),
1157 PIN_FIELD_BASE(113, 113, 2, 0x00a0, 0x10, 20, 1),
1158 PIN_FIELD_BASE(114, 114, 2, 0x00a0, 0x10, 28, 1),
1159 PIN_FIELD_BASE(115, 115, 2, 0x00a0, 0x10, 23, 1),
1160 PIN_FIELD_BASE(116, 116, 2, 0x00a0, 0x10, 29, 1),
1161 PIN_FIELD_BASE(117, 117, 2, 0x00a0, 0x10, 24, 1),
1162 PIN_FIELD_BASE(118, 118, 2, 0x00a0, 0x10, 25, 1),
1163 PIN_FIELD_BASE(119, 119, 2, 0x00a0, 0x10, 26, 1),
1164 PIN_FIELD_BASE(120, 120, 2, 0x00a0, 0x10, 27, 1),
1165 PIN_FIELD_BASE(121, 121, 3, 0x0050, 0x10, 8, 1),
1166 PIN_FIELD_BASE(122, 122, 3, 0x0050, 0x10, 11, 1),
1167 PIN_FIELD_BASE(123, 123, 3, 0x0050, 0x10, 10, 1),
1168 PIN_FIELD_BASE(124, 124, 3, 0x0050, 0x10, 9, 1),
1169 PIN_FIELD_BASE(125, 125, 2, 0x00a0, 0x10, 6, 1),
1170 PIN_FIELD_BASE(126, 126, 2, 0x00a0, 0x10, 7, 1),
1171 PIN_FIELD_BASE(127, 127, 2, 0x00a0, 0x10, 8, 1),
1172 PIN_FIELD_BASE(128, 128, 2, 0x00a0, 0x10, 9, 1),
1173 PIN_FIELD_BASE(129, 129, 2, 0x00a0, 0x10, 10, 1),
1174 PIN_FIELD_BASE(130, 130, 2, 0x00a0, 0x10, 11, 1),
1175 PIN_FIELD_BASE(175, 175, 2, 0x00b0, 0x10, 11, 1),
1176 PIN_FIELD_BASE(176, 176, 2, 0x00b0, 0x10, 12, 1),
1177 };
1178
1179 static const struct mtk_pin_field_calc mt8188_pin_drv_range[] = {
1180 PIN_FIELD_BASE(0, 0, 1, 0x0000, 0x10, 24, 3),
1181 PIN_FIELD_BASE(1, 1, 1, 0x0000, 0x10, 27, 3),
1182 PIN_FIELD_BASE(2, 2, 1, 0x0010, 0x10, 0, 3),
1183 PIN_FIELD_BASE(3, 3, 1, 0x0010, 0x10, 3, 3),
1184 PIN_FIELD_BASE(4, 4, 1, 0x0020, 0x10, 9, 3),
1185 PIN_FIELD_BASE(5, 5, 1, 0x0020, 0x10, 9, 3),
1186 PIN_FIELD_BASE(6, 6, 1, 0x0020, 0x10, 9, 3),
1187 PIN_FIELD_BASE(7, 7, 1, 0x0010, 0x10, 6, 3),
1188 PIN_FIELD_BASE(8, 8, 1, 0x0010, 0x10, 9, 3),
1189 PIN_FIELD_BASE(9, 9, 1, 0x0010, 0x10, 12, 3),
1190 PIN_FIELD_BASE(10, 10, 1, 0x0010, 0x10, 15, 3),
1191 PIN_FIELD_BASE(11, 11, 1, 0x0020, 0x10, 12, 3),
1192 PIN_FIELD_BASE(12, 12, 2, 0x0010, 0x10, 24, 3),
1193 PIN_FIELD_BASE(13, 13, 2, 0x0010, 0x10, 27, 3),
1194 PIN_FIELD_BASE(14, 14, 2, 0x0020, 0x10, 0, 3),
1195 PIN_FIELD_BASE(15, 15, 2, 0x0020, 0x10, 3, 3),
1196 PIN_FIELD_BASE(16, 16, 3, 0x0010, 0x10, 15, 3),
1197 PIN_FIELD_BASE(17, 17, 3, 0x0010, 0x10, 15, 3),
1198 PIN_FIELD_BASE(18, 18, 4, 0x0000, 0x10, 27, 3),
1199 PIN_FIELD_BASE(19, 19, 4, 0x0000, 0x10, 27, 3),
1200 PIN_FIELD_BASE(20, 20, 4, 0x0000, 0x10, 27, 3),
1201 PIN_FIELD_BASE(21, 21, 4, 0x0000, 0x10, 27, 3),
1202 PIN_FIELD_BASE(22, 22, 4, 0x0000, 0x10, 0, 3),
1203 PIN_FIELD_BASE(23, 23, 4, 0x0000, 0x10, 3, 3),
1204 PIN_FIELD_BASE(24, 24, 4, 0x0000, 0x10, 6, 3),
1205 PIN_FIELD_BASE(25, 25, 1, 0x0020, 0x10, 6, 3),
1206 PIN_FIELD_BASE(26, 26, 1, 0x0020, 0x10, 6, 3),
1207 PIN_FIELD_BASE(27, 27, 1, 0x0020, 0x10, 6, 3),
1208 PIN_FIELD_BASE(28, 28, 1, 0x0020, 0x10, 9, 3),
1209 PIN_FIELD_BASE(29, 29, 1, 0x0020, 0x10, 3, 3),
1210 PIN_FIELD_BASE(30, 30, 1, 0x0020, 0x10, 6, 3),
1211 PIN_FIELD_BASE(31, 31, 1, 0x0020, 0x10, 12, 3),
1212 PIN_FIELD_BASE(32, 32, 1, 0x0020, 0x10, 12, 3),
1213 PIN_FIELD_BASE(33, 33, 1, 0x0020, 0x10, 15, 3),
1214 PIN_FIELD_BASE(34, 34, 1, 0x0020, 0x10, 15, 3),
1215 PIN_FIELD_BASE(35, 35, 1, 0x0020, 0x10, 12, 3),
1216 PIN_FIELD_BASE(36, 36, 1, 0x0020, 0x10, 15, 3),
1217 PIN_FIELD_BASE(37, 37, 1, 0x0010, 0x10, 27, 3),
1218 PIN_FIELD_BASE(38, 38, 1, 0x0010, 0x10, 18, 3),
1219 PIN_FIELD_BASE(39, 39, 1, 0x0010, 0x10, 21, 3),
1220 PIN_FIELD_BASE(40, 40, 1, 0x0010, 0x10, 24, 3),
1221 PIN_FIELD_BASE(41, 41, 1, 0x0020, 0x10, 0, 3),
1222 PIN_FIELD_BASE(42, 42, 2, 0x0020, 0x10, 18, 3),
1223 PIN_FIELD_BASE(43, 43, 2, 0x0020, 0x10, 18, 3),
1224 PIN_FIELD_BASE(44, 44, 2, 0x0020, 0x10, 18, 3),
1225 PIN_FIELD_BASE(45, 45, 2, 0x0020, 0x10, 21, 3),
1226 PIN_FIELD_BASE(46, 46, 3, 0x0010, 0x10, 15, 3),
1227 PIN_FIELD_BASE(47, 47, 1, 0x0020, 0x10, 3, 3),
1228 PIN_FIELD_BASE(48, 48, 1, 0x0020, 0x10, 3, 3),
1229 PIN_FIELD_BASE(49, 49, 1, 0x0020, 0x10, 3, 3),
1230 PIN_FIELD_BASE(50, 50, 3, 0x0000, 0x10, 6, 3),
1231 PIN_FIELD_BASE(51, 51, 3, 0x0000, 0x10, 3, 3),
1232 PIN_FIELD_BASE(52, 52, 3, 0x0000, 0x10, 0, 3),
1233 PIN_FIELD_BASE(53, 53, 3, 0x0000, 0x10, 9, 3),
1234 PIN_FIELD_BASE(54, 54, 3, 0x0000, 0x10, 12, 3),
1235 PIN_FIELD_BASE(55, 55, 1, 0x0020, 0x10, 27, 3),
1236 PIN_FIELD_BASE(56, 56, 1, 0x0030, 0x10, 6, 3),
1237 PIN_FIELD_BASE(57, 57, 2, 0x0030, 0x10, 9, 3),
1238 PIN_FIELD_BASE(58, 58, 2, 0x0030, 0x10, 15, 3),
1239 PIN_FIELD_BASE(59, 59, 1, 0x0030, 0x10, 0, 3),
1240 PIN_FIELD_BASE(60, 60, 1, 0x0030, 0x10, 9, 3),
1241 PIN_FIELD_BASE(61, 61, 1, 0x0030, 0x10, 3, 3),
1242 PIN_FIELD_BASE(62, 62, 1, 0x0030, 0x10, 12, 3),
1243 PIN_FIELD_BASE(63, 63, 2, 0x0030, 0x10, 12, 3),
1244 PIN_FIELD_BASE(64, 64, 2, 0x0030, 0x10, 18, 3),
1245 PIN_FIELD_BASE(65, 65, 4, 0x0010, 0x10, 0, 3),
1246 PIN_FIELD_BASE(66, 66, 4, 0x0010, 0x10, 6, 3),
1247 PIN_FIELD_BASE(67, 67, 4, 0x0010, 0x10, 3, 3),
1248 PIN_FIELD_BASE(68, 68, 4, 0x0010, 0x10, 9, 3),
1249 PIN_FIELD_BASE(69, 69, 1, 0x0030, 0x10, 18, 3),
1250 PIN_FIELD_BASE(70, 70, 1, 0x0030, 0x10, 15, 3),
1251 PIN_FIELD_BASE(71, 71, 1, 0x0040, 0x10, 0, 3),
1252 PIN_FIELD_BASE(72, 72, 1, 0x0030, 0x10, 27, 3),
1253 PIN_FIELD_BASE(73, 73, 1, 0x0030, 0x10, 21, 3),
1254 PIN_FIELD_BASE(74, 74, 1, 0x0030, 0x10, 24, 3),
1255 PIN_FIELD_BASE(75, 75, 1, 0x0040, 0x10, 6, 3),
1256 PIN_FIELD_BASE(76, 76, 1, 0x0040, 0x10, 3, 3),
1257 PIN_FIELD_BASE(77, 77, 1, 0x0040, 0x10, 12, 3),
1258 PIN_FIELD_BASE(78, 78, 1, 0x0040, 0x10, 9, 3),
1259 PIN_FIELD_BASE(79, 79, 4, 0x0010, 0x10, 15, 3),
1260 PIN_FIELD_BASE(80, 80, 4, 0x0010, 0x10, 12, 3),
1261 PIN_FIELD_BASE(81, 81, 4, 0x0010, 0x10, 21, 3),
1262 PIN_FIELD_BASE(82, 82, 4, 0x0010, 0x10, 18, 3),
1263 PIN_FIELD_BASE(83, 83, 2, 0x0030, 0x10, 0, 3),
1264 PIN_FIELD_BASE(84, 84, 2, 0x0020, 0x10, 27, 3),
1265 PIN_FIELD_BASE(85, 85, 2, 0x0030, 0x10, 0, 3),
1266 PIN_FIELD_BASE(86, 86, 2, 0x0020, 0x10, 6, 3),
1267 PIN_FIELD_BASE(87, 87, 2, 0x0020, 0x10, 6, 3),
1268 PIN_FIELD_BASE(88, 88, 2, 0x0020, 0x10, 6, 3),
1269 PIN_FIELD_BASE(89, 89, 2, 0x0020, 0x10, 6, 3),
1270 PIN_FIELD_BASE(90, 90, 2, 0x0030, 0x10, 0, 3),
1271 PIN_FIELD_BASE(91, 91, 2, 0x0030, 0x10, 0, 3),
1272 PIN_FIELD_BASE(92, 92, 2, 0x0020, 0x10, 9, 3),
1273 PIN_FIELD_BASE(93, 93, 2, 0x0020, 0x10, 9, 3),
1274 PIN_FIELD_BASE(94, 94, 2, 0x0020, 0x10, 9, 3),
1275 PIN_FIELD_BASE(95, 95, 2, 0x0020, 0x10, 9, 3),
1276 PIN_FIELD_BASE(96, 96, 2, 0x0020, 0x10, 21, 3),
1277 PIN_FIELD_BASE(97, 97, 2, 0x0020, 0x10, 21, 3),
1278 PIN_FIELD_BASE(98, 98, 2, 0x0020, 0x10, 24, 3),
1279 PIN_FIELD_BASE(99, 99, 2, 0x0020, 0x10, 21, 3),
1280 PIN_FIELD_BASE(100, 100, 2, 0x0030, 0x10, 6, 3),
1281 PIN_FIELD_BASE(101, 101, 2, 0x0000, 0x10, 0, 3),
1282 PIN_FIELD_BASE(102, 102, 2, 0x0000, 0x10, 15, 3),
1283 PIN_FIELD_BASE(103, 103, 2, 0x0000, 0x10, 9, 3),
1284 PIN_FIELD_BASE(104, 104, 2, 0x0000, 0x10, 12, 3),
1285 PIN_FIELD_BASE(105, 105, 2, 0x0000, 0x10, 3, 3),
1286 PIN_FIELD_BASE(106, 106, 2, 0x0000, 0x10, 6, 3),
1287 PIN_FIELD_BASE(107, 107, 2, 0x0020, 0x10, 6, 3),
1288 PIN_FIELD_BASE(108, 108, 2, 0x0020, 0x10, 6, 3),
1289 PIN_FIELD_BASE(109, 109, 2, 0x0020, 0x10, 6, 3),
1290 PIN_FIELD_BASE(110, 110, 2, 0x0020, 0x10, 6, 3),
1291 PIN_FIELD_BASE(111, 111, 2, 0x0020, 0x10, 15, 3),
1292 PIN_FIELD_BASE(112, 112, 2, 0x0020, 0x10, 15, 3),
1293 PIN_FIELD_BASE(113, 113, 2, 0x0020, 0x10, 15, 3),
1294 PIN_FIELD_BASE(114, 114, 2, 0x0020, 0x10, 12, 3),
1295 PIN_FIELD_BASE(115, 115, 2, 0x0020, 0x10, 12, 3),
1296 PIN_FIELD_BASE(116, 116, 2, 0x0020, 0x10, 12, 3),
1297 PIN_FIELD_BASE(117, 117, 2, 0x0020, 0x10, 12, 3),
1298 PIN_FIELD_BASE(118, 118, 2, 0x0020, 0x10, 12, 3),
1299 PIN_FIELD_BASE(119, 119, 2, 0x0020, 0x10, 15, 3),
1300 PIN_FIELD_BASE(120, 120, 2, 0x0020, 0x10, 18, 3),
1301 PIN_FIELD_BASE(121, 121, 3, 0x0010, 0x10, 3, 3),
1302 PIN_FIELD_BASE(122, 122, 3, 0x0010, 0x10, 12, 3),
1303 PIN_FIELD_BASE(123, 123, 3, 0x0010, 0x10, 9, 3),
1304 PIN_FIELD_BASE(124, 124, 3, 0x0010, 0x10, 6, 3),
1305 PIN_FIELD_BASE(125, 125, 2, 0x0020, 0x10, 24, 3),
1306 PIN_FIELD_BASE(126, 126, 2, 0x0020, 0x10, 24, 3),
1307 PIN_FIELD_BASE(127, 127, 2, 0x0020, 0x10, 24, 3),
1308 PIN_FIELD_BASE(128, 128, 2, 0x0020, 0x10, 27, 3),
1309 PIN_FIELD_BASE(129, 129, 2, 0x0020, 0x10, 27, 3),
1310 PIN_FIELD_BASE(130, 130, 2, 0x0020, 0x10, 27, 3),
1311 PIN_FIELD_BASE(131, 131, 1, 0x0000, 0x10, 0, 3),
1312 PIN_FIELD_BASE(132, 132, 1, 0x0000, 0x10, 15, 3),
1313 PIN_FIELD_BASE(133, 133, 1, 0x0000, 0x10, 18, 3),
1314 PIN_FIELD_BASE(134, 134, 1, 0x0000, 0x10, 21, 3),
1315 PIN_FIELD_BASE(135, 135, 1, 0x0020, 0x10, 15, 3),
1316 PIN_FIELD_BASE(136, 136, 1, 0x0020, 0x10, 18, 3),
1317 PIN_FIELD_BASE(137, 137, 1, 0x0020, 0x10, 18, 3),
1318 PIN_FIELD_BASE(138, 138, 1, 0x0020, 0x10, 18, 3),
1319 PIN_FIELD_BASE(139, 139, 1, 0x0020, 0x10, 18, 3),
1320 PIN_FIELD_BASE(140, 140, 1, 0x0020, 0x10, 21, 3),
1321 PIN_FIELD_BASE(141, 141, 1, 0x0020, 0x10, 21, 3),
1322 PIN_FIELD_BASE(142, 142, 1, 0x0020, 0x10, 21, 3),
1323 PIN_FIELD_BASE(143, 143, 1, 0x0000, 0x10, 3, 3),
1324 PIN_FIELD_BASE(144, 144, 1, 0x0000, 0x10, 6, 3),
1325 PIN_FIELD_BASE(145, 145, 1, 0x0000, 0x10, 9, 3),
1326 PIN_FIELD_BASE(146, 146, 1, 0x0000, 0x10, 12, 3),
1327 PIN_FIELD_BASE(147, 147, 1, 0x0020, 0x10, 21, 3),
1328 PIN_FIELD_BASE(148, 148, 1, 0x0020, 0x10, 24, 3),
1329 PIN_FIELD_BASE(149, 149, 1, 0x0020, 0x10, 24, 3),
1330 PIN_FIELD_BASE(150, 150, 1, 0x0020, 0x10, 24, 3),
1331 PIN_FIELD_BASE(151, 151, 2, 0x0010, 0x10, 15, 3),
1332 PIN_FIELD_BASE(152, 152, 2, 0x0010, 0x10, 12, 3),
1333 PIN_FIELD_BASE(153, 153, 2, 0x0010, 0x10, 9, 3),
1334 PIN_FIELD_BASE(154, 154, 2, 0x0010, 0x10, 6, 3),
1335 PIN_FIELD_BASE(155, 155, 2, 0x0010, 0x10, 21, 3),
1336 PIN_FIELD_BASE(156, 156, 2, 0x0000, 0x10, 21, 3),
1337 PIN_FIELD_BASE(157, 157, 2, 0x0000, 0x10, 18, 3),
1338 PIN_FIELD_BASE(158, 158, 2, 0x0010, 0x10, 3, 3),
1339 PIN_FIELD_BASE(159, 159, 2, 0x0010, 0x10, 0, 3),
1340 PIN_FIELD_BASE(160, 160, 2, 0x0000, 0x10, 27, 3),
1341 PIN_FIELD_BASE(161, 161, 2, 0x0000, 0x10, 24, 3),
1342 PIN_FIELD_BASE(162, 162, 2, 0x0010, 0x10, 18, 3),
1343 PIN_FIELD_BASE(163, 163, 4, 0x0000, 0x10, 12, 3),
1344 PIN_FIELD_BASE(164, 164, 4, 0x0000, 0x10, 9, 3),
1345 PIN_FIELD_BASE(165, 165, 4, 0x0000, 0x10, 15, 3),
1346 PIN_FIELD_BASE(166, 166, 4, 0x0000, 0x10, 18, 3),
1347 PIN_FIELD_BASE(167, 167, 4, 0x0000, 0x10, 21, 3),
1348 PIN_FIELD_BASE(168, 168, 4, 0x0000, 0x10, 24, 3),
1349 PIN_FIELD_BASE(169, 169, 3, 0x0000, 0x10, 18, 3),
1350 PIN_FIELD_BASE(170, 170, 3, 0x0000, 0x10, 15, 3),
1351 PIN_FIELD_BASE(171, 171, 3, 0x0000, 0x10, 21, 3),
1352 PIN_FIELD_BASE(172, 172, 3, 0x0000, 0x10, 24, 3),
1353 PIN_FIELD_BASE(173, 173, 3, 0x0000, 0x10, 27, 3),
1354 PIN_FIELD_BASE(174, 174, 3, 0x0010, 0x10, 0, 3),
1355 PIN_FIELD_BASE(175, 175, 2, 0x0030, 0x10, 3, 3),
1356 PIN_FIELD_BASE(176, 176, 2, 0x0030, 0x10, 3, 3),
1357 };
1358
1359 static const struct mtk_pin_field_calc mt8188_pin_drv_adv_range[] = {
1360 PIN_FIELD_BASE(53, 53, 3, 0x0020, 0x10, 0, 3),
1361 PIN_FIELD_BASE(54, 54, 3, 0x0020, 0x10, 3, 3),
1362 PIN_FIELD_BASE(55, 55, 1, 0x0060, 0x10, 0, 3),
1363 PIN_FIELD_BASE(56, 56, 1, 0x0060, 0x10, 9, 3),
1364 PIN_FIELD_BASE(57, 57, 2, 0x0050, 0x10, 0, 3),
1365 PIN_FIELD_BASE(58, 58, 2, 0x0050, 0x10, 6, 3),
1366 PIN_FIELD_BASE(59, 59, 1, 0x0060, 0x10, 3, 3),
1367 PIN_FIELD_BASE(60, 60, 1, 0x0060, 0x10, 12, 3),
1368 PIN_FIELD_BASE(61, 61, 1, 0x0060, 0x10, 6, 3),
1369 PIN_FIELD_BASE(62, 62, 1, 0x0060, 0x10, 15, 3),
1370 PIN_FIELD_BASE(63, 63, 2, 0x0050, 0x10, 3, 3),
1371 PIN_FIELD_BASE(64, 64, 2, 0x0050, 0x10, 9, 3),
1372 PIN_FIELD_BASE(65, 65, 4, 0x0030, 0x10, 0, 3),
1373 PIN_FIELD_BASE(66, 66, 4, 0x0030, 0x10, 6, 3),
1374 PIN_FIELD_BASE(67, 67, 4, 0x0030, 0x10, 3, 3),
1375 PIN_FIELD_BASE(68, 68, 4, 0x0030, 0x10, 9, 3),
1376 PIN_FIELD_BASE(175, 175, 2, 0x0050, 0x10, 12, 3),
1377 PIN_FIELD_BASE(176, 176, 2, 0x0050, 0x10, 15, 3),
1378 };
1379
1380 static const struct mtk_pin_field_calc mt8188_pin_rsel_range[] = {
1381 PIN_FIELD_BASE(53, 53, 3, 0x00c0, 0x10, 0, 3),
1382 PIN_FIELD_BASE(54, 54, 3, 0x00c0, 0x10, 3, 3),
1383 PIN_FIELD_BASE(55, 55, 1, 0x0160, 0x10, 0, 3),
1384 PIN_FIELD_BASE(56, 56, 1, 0x0160, 0x10, 9, 3),
1385 PIN_FIELD_BASE(57, 57, 2, 0x0150, 0x10, 0, 3),
1386 PIN_FIELD_BASE(58, 58, 2, 0x0150, 0x10, 6, 3),
1387 PIN_FIELD_BASE(59, 59, 1, 0x0160, 0x10, 3, 3),
1388 PIN_FIELD_BASE(60, 60, 1, 0x0160, 0x10, 12, 3),
1389 PIN_FIELD_BASE(61, 61, 1, 0x0160, 0x10, 6, 3),
1390 PIN_FIELD_BASE(62, 62, 1, 0x0160, 0x10, 15, 3),
1391 PIN_FIELD_BASE(63, 63, 2, 0x0150, 0x10, 3, 3),
1392 PIN_FIELD_BASE(64, 64, 2, 0x0150, 0x10, 9, 3),
1393 PIN_FIELD_BASE(65, 65, 4, 0x00d0, 0x10, 0, 3),
1394 PIN_FIELD_BASE(66, 66, 4, 0x00d0, 0x10, 6, 3),
1395 PIN_FIELD_BASE(67, 67, 4, 0x00d0, 0x10, 3, 3),
1396 PIN_FIELD_BASE(68, 68, 4, 0x00d0, 0x10, 9, 3),
1397 PIN_FIELD_BASE(175, 175, 2, 0x0150, 0x10, 12, 3),
1398 PIN_FIELD_BASE(176, 176, 2, 0x0150, 0x10, 15, 3),
1399 };
1400
1401 static const struct mtk_pin_rsel mt8188_pin_rsel_val_range[] = {
1402 PIN_RSEL(53, 68, 0x0, 75000, 75000),
1403 PIN_RSEL(53, 68, 0x1, 10000, 5000),
1404 PIN_RSEL(53, 68, 0x2, 5000, 75000),
1405 PIN_RSEL(53, 68, 0x3, 4000, 5000),
1406 PIN_RSEL(53, 68, 0x4, 3000, 75000),
1407 PIN_RSEL(53, 68, 0x5, 2000, 5000),
1408 PIN_RSEL(53, 68, 0x6, 1500, 75000),
1409 PIN_RSEL(53, 68, 0x7, 1000, 5000),
1410 PIN_RSEL(175, 176, 0x0, 75000, 75000),
1411 PIN_RSEL(175, 176, 0x1, 10000, 5000),
1412 PIN_RSEL(175, 176, 0x2, 5000, 75000),
1413 PIN_RSEL(175, 176, 0x3, 4000, 5000),
1414 PIN_RSEL(175, 176, 0x4, 3000, 75000),
1415 PIN_RSEL(175, 176, 0x5, 2000, 5000),
1416 PIN_RSEL(175, 176, 0x6, 1500, 75000),
1417 PIN_RSEL(175, 176, 0x7, 1000, 5000),
1418 };
1419
1420 static const unsigned int mt8188_pull_type[] = {
1421 MTK_PULL_PU_PD_TYPE, /*0*/
1422 MTK_PULL_PU_PD_TYPE, /*1*/
1423 MTK_PULL_PU_PD_TYPE, /*2*/
1424 MTK_PULL_PU_PD_TYPE, /*3*/
1425 MTK_PULL_PU_PD_TYPE, /*4*/
1426 MTK_PULL_PU_PD_TYPE, /*5*/
1427 MTK_PULL_PU_PD_TYPE, /*6*/
1428 MTK_PULL_PU_PD_TYPE, /*7*/
1429 MTK_PULL_PU_PD_TYPE, /*8*/
1430 MTK_PULL_PU_PD_TYPE, /*9*/
1431 MTK_PULL_PU_PD_TYPE, /*10*/
1432 MTK_PULL_PU_PD_TYPE, /*11*/
1433 MTK_PULL_PU_PD_TYPE, /*12*/
1434 MTK_PULL_PU_PD_TYPE, /*13*/
1435 MTK_PULL_PU_PD_TYPE, /*14*/
1436 MTK_PULL_PU_PD_TYPE, /*15*/
1437 MTK_PULL_PU_PD_TYPE, /*16*/
1438 MTK_PULL_PU_PD_TYPE, /*17*/
1439 MTK_PULL_PU_PD_TYPE, /*18*/
1440 MTK_PULL_PU_PD_TYPE, /*19*/
1441 MTK_PULL_PU_PD_TYPE, /*20*/
1442 MTK_PULL_PU_PD_TYPE, /*21*/
1443 MTK_PULL_PU_PD_TYPE, /*22*/
1444 MTK_PULL_PU_PD_TYPE, /*23*/
1445 MTK_PULL_PU_PD_TYPE, /*24*/
1446 MTK_PULL_PU_PD_TYPE, /*25*/
1447 MTK_PULL_PU_PD_TYPE, /*26*/
1448 MTK_PULL_PU_PD_TYPE, /*27*/
1449 MTK_PULL_PU_PD_TYPE, /*28*/
1450 MTK_PULL_PU_PD_TYPE, /*29*/
1451 MTK_PULL_PU_PD_TYPE, /*30*/
1452 MTK_PULL_PU_PD_TYPE, /*31*/
1453 MTK_PULL_PU_PD_TYPE, /*32*/
1454 MTK_PULL_PU_PD_TYPE, /*33*/
1455 MTK_PULL_PU_PD_TYPE, /*34*/
1456 MTK_PULL_PU_PD_TYPE, /*35*/
1457 MTK_PULL_PU_PD_TYPE, /*36*/
1458 MTK_PULL_PU_PD_TYPE, /*37*/
1459 MTK_PULL_PU_PD_TYPE, /*38*/
1460 MTK_PULL_PU_PD_TYPE, /*39*/
1461 MTK_PULL_PU_PD_TYPE, /*40*/
1462 MTK_PULL_PU_PD_TYPE, /*41*/
1463 MTK_PULL_PUPD_R1R0_TYPE, /*42*/
1464 MTK_PULL_PUPD_R1R0_TYPE, /*43*/
1465 MTK_PULL_PUPD_R1R0_TYPE, /*44*/
1466 MTK_PULL_PUPD_R1R0_TYPE, /*45*/
1467 MTK_PULL_PU_PD_TYPE, /*46*/
1468 MTK_PULL_PU_PD_TYPE, /*47*/
1469 MTK_PULL_PU_PD_TYPE, /*48*/
1470 MTK_PULL_PU_PD_TYPE, /*49*/
1471 MTK_PULL_PU_PD_TYPE, /*50*/
1472 MTK_PULL_PU_PD_TYPE, /*51*/
1473 MTK_PULL_PU_PD_TYPE, /*52*/
1474 MTK_PULL_PU_PD_RSEL_TYPE, /*53*/
1475 MTK_PULL_PU_PD_RSEL_TYPE, /*54*/
1476 MTK_PULL_PU_PD_RSEL_TYPE, /*55*/
1477 MTK_PULL_PU_PD_RSEL_TYPE, /*56*/
1478 MTK_PULL_PU_PD_RSEL_TYPE, /*57*/
1479 MTK_PULL_PU_PD_RSEL_TYPE, /*58*/
1480 MTK_PULL_PU_PD_RSEL_TYPE, /*59*/
1481 MTK_PULL_PU_PD_RSEL_TYPE, /*60*/
1482 MTK_PULL_PU_PD_RSEL_TYPE, /*61*/
1483 MTK_PULL_PU_PD_RSEL_TYPE, /*62*/
1484 MTK_PULL_PU_PD_RSEL_TYPE, /*63*/
1485 MTK_PULL_PU_PD_RSEL_TYPE, /*64*/
1486 MTK_PULL_PU_PD_RSEL_TYPE, /*65*/
1487 MTK_PULL_PU_PD_RSEL_TYPE, /*66*/
1488 MTK_PULL_PU_PD_RSEL_TYPE, /*67*/
1489 MTK_PULL_PU_PD_RSEL_TYPE, /*68*/
1490 MTK_PULL_PU_PD_TYPE, /*69*/
1491 MTK_PULL_PU_PD_TYPE, /*70*/
1492 MTK_PULL_PU_PD_TYPE, /*71*/
1493 MTK_PULL_PU_PD_TYPE, /*72*/
1494 MTK_PULL_PU_PD_TYPE, /*73*/
1495 MTK_PULL_PU_PD_TYPE, /*74*/
1496 MTK_PULL_PU_PD_TYPE, /*75*/
1497 MTK_PULL_PU_PD_TYPE, /*76*/
1498 MTK_PULL_PU_PD_TYPE, /*77*/
1499 MTK_PULL_PU_PD_TYPE, /*78*/
1500 MTK_PULL_PU_PD_TYPE, /*79*/
1501 MTK_PULL_PU_PD_TYPE, /*80*/
1502 MTK_PULL_PU_PD_TYPE, /*81*/
1503 MTK_PULL_PU_PD_TYPE, /*82*/
1504 MTK_PULL_PU_PD_TYPE, /*83*/
1505 MTK_PULL_PU_PD_TYPE, /*84*/
1506 MTK_PULL_PU_PD_TYPE, /*85*/
1507 MTK_PULL_PU_PD_TYPE, /*86*/
1508 MTK_PULL_PU_PD_TYPE, /*87*/
1509 MTK_PULL_PU_PD_TYPE, /*88*/
1510 MTK_PULL_PU_PD_TYPE, /*89*/
1511 MTK_PULL_PU_PD_TYPE, /*90*/
1512 MTK_PULL_PU_PD_TYPE, /*91*/
1513 MTK_PULL_PU_PD_TYPE, /*92*/
1514 MTK_PULL_PU_PD_TYPE, /*93*/
1515 MTK_PULL_PU_PD_TYPE, /*94*/
1516 MTK_PULL_PU_PD_TYPE, /*95*/
1517 MTK_PULL_PU_PD_TYPE, /*96*/
1518 MTK_PULL_PU_PD_TYPE, /*97*/
1519 MTK_PULL_PU_PD_TYPE, /*98*/
1520 MTK_PULL_PU_PD_TYPE, /*99*/
1521 MTK_PULL_PU_PD_TYPE, /*100*/
1522 MTK_PULL_PU_PD_TYPE, /*101*/
1523 MTK_PULL_PU_PD_TYPE, /*102*/
1524 MTK_PULL_PU_PD_TYPE, /*103*/
1525 MTK_PULL_PU_PD_TYPE, /*104*/
1526 MTK_PULL_PU_PD_TYPE, /*105*/
1527 MTK_PULL_PU_PD_TYPE, /*106*/
1528 MTK_PULL_PU_PD_TYPE, /*107*/
1529 MTK_PULL_PU_PD_TYPE, /*108*/
1530 MTK_PULL_PU_PD_TYPE, /*109*/
1531 MTK_PULL_PU_PD_TYPE, /*110*/
1532 MTK_PULL_PU_PD_TYPE, /*111*/
1533 MTK_PULL_PU_PD_TYPE, /*112*/
1534 MTK_PULL_PU_PD_TYPE, /*113*/
1535 MTK_PULL_PU_PD_TYPE, /*114*/
1536 MTK_PULL_PU_PD_TYPE, /*115*/
1537 MTK_PULL_PU_PD_TYPE, /*116*/
1538 MTK_PULL_PU_PD_TYPE, /*117*/
1539 MTK_PULL_PU_PD_TYPE, /*118*/
1540 MTK_PULL_PU_PD_TYPE, /*119*/
1541 MTK_PULL_PU_PD_TYPE, /*120*/
1542 MTK_PULL_PU_PD_TYPE, /*121*/
1543 MTK_PULL_PU_PD_TYPE, /*122*/
1544 MTK_PULL_PU_PD_TYPE, /*123*/
1545 MTK_PULL_PU_PD_TYPE, /*124*/
1546 MTK_PULL_PU_PD_TYPE, /*125*/
1547 MTK_PULL_PU_PD_TYPE, /*126*/
1548 MTK_PULL_PU_PD_TYPE, /*127*/
1549 MTK_PULL_PU_PD_TYPE, /*128*/
1550 MTK_PULL_PU_PD_TYPE, /*129*/
1551 MTK_PULL_PU_PD_TYPE, /*130*/
1552 MTK_PULL_PUPD_R1R0_TYPE, /*131*/
1553 MTK_PULL_PUPD_R1R0_TYPE, /*132*/
1554 MTK_PULL_PUPD_R1R0_TYPE, /*133*/
1555 MTK_PULL_PUPD_R1R0_TYPE, /*134*/
1556 MTK_PULL_PUPD_R1R0_TYPE, /*135*/
1557 MTK_PULL_PUPD_R1R0_TYPE, /*136*/
1558 MTK_PULL_PUPD_R1R0_TYPE, /*137*/
1559 MTK_PULL_PUPD_R1R0_TYPE, /*138*/
1560 MTK_PULL_PUPD_R1R0_TYPE, /*139*/
1561 MTK_PULL_PUPD_R1R0_TYPE, /*140*/
1562 MTK_PULL_PUPD_R1R0_TYPE, /*141*/
1563 MTK_PULL_PUPD_R1R0_TYPE, /*142*/
1564 MTK_PULL_PUPD_R1R0_TYPE, /*143*/
1565 MTK_PULL_PUPD_R1R0_TYPE, /*144*/
1566 MTK_PULL_PUPD_R1R0_TYPE, /*145*/
1567 MTK_PULL_PUPD_R1R0_TYPE, /*146*/
1568 MTK_PULL_PUPD_R1R0_TYPE, /*147*/
1569 MTK_PULL_PUPD_R1R0_TYPE, /*148*/
1570 MTK_PULL_PUPD_R1R0_TYPE, /*149*/
1571 MTK_PULL_PUPD_R1R0_TYPE, /*150*/
1572 MTK_PULL_PUPD_R1R0_TYPE, /*151*/
1573 MTK_PULL_PUPD_R1R0_TYPE, /*152*/
1574 MTK_PULL_PUPD_R1R0_TYPE, /*153*/
1575 MTK_PULL_PUPD_R1R0_TYPE, /*154*/
1576 MTK_PULL_PUPD_R1R0_TYPE, /*155*/
1577 MTK_PULL_PUPD_R1R0_TYPE, /*156*/
1578 MTK_PULL_PUPD_R1R0_TYPE, /*157*/
1579 MTK_PULL_PUPD_R1R0_TYPE, /*158*/
1580 MTK_PULL_PUPD_R1R0_TYPE, /*159*/
1581 MTK_PULL_PUPD_R1R0_TYPE, /*160*/
1582 MTK_PULL_PUPD_R1R0_TYPE, /*161*/
1583 MTK_PULL_PUPD_R1R0_TYPE, /*162*/
1584 MTK_PULL_PUPD_R1R0_TYPE, /*163*/
1585 MTK_PULL_PUPD_R1R0_TYPE, /*164*/
1586 MTK_PULL_PUPD_R1R0_TYPE, /*165*/
1587 MTK_PULL_PUPD_R1R0_TYPE, /*166*/
1588 MTK_PULL_PUPD_R1R0_TYPE, /*167*/
1589 MTK_PULL_PUPD_R1R0_TYPE, /*168*/
1590 MTK_PULL_PUPD_R1R0_TYPE, /*169*/
1591 MTK_PULL_PUPD_R1R0_TYPE, /*170*/
1592 MTK_PULL_PUPD_R1R0_TYPE, /*171*/
1593 MTK_PULL_PUPD_R1R0_TYPE, /*172*/
1594 MTK_PULL_PUPD_R1R0_TYPE, /*173*/
1595 MTK_PULL_PUPD_R1R0_TYPE, /*174*/
1596 MTK_PULL_PU_PD_RSEL_TYPE, /*175*/
1597 MTK_PULL_PU_PD_RSEL_TYPE, /*176*/
1598 };
1599
1600 static const struct mtk_pin_reg_calc mt8188_reg_cals[PINCTRL_PIN_REG_MAX] = {
1601 [PINCTRL_PIN_REG_MODE] = MTK_RANGE(mt8188_pin_mode_range),
1602 [PINCTRL_PIN_REG_DIR] = MTK_RANGE(mt8188_pin_dir_range),
1603 [PINCTRL_PIN_REG_DI] = MTK_RANGE(mt8188_pin_di_range),
1604 [PINCTRL_PIN_REG_DO] = MTK_RANGE(mt8188_pin_do_range),
1605 [PINCTRL_PIN_REG_SMT] = MTK_RANGE(mt8188_pin_smt_range),
1606 [PINCTRL_PIN_REG_IES] = MTK_RANGE(mt8188_pin_ies_range),
1607 [PINCTRL_PIN_REG_TDSEL] = MTK_RANGE(mt8188_pin_tdsel_range),
1608 [PINCTRL_PIN_REG_RDSEL] = MTK_RANGE(mt8188_pin_rdsel_range),
1609 [PINCTRL_PIN_REG_PUPD] = MTK_RANGE(mt8188_pin_pupd_range),
1610 [PINCTRL_PIN_REG_R0] = MTK_RANGE(mt8188_pin_r0_range),
1611 [PINCTRL_PIN_REG_R1] = MTK_RANGE(mt8188_pin_r1_range),
1612 [PINCTRL_PIN_REG_PU] = MTK_RANGE(mt8188_pin_pu_range),
1613 [PINCTRL_PIN_REG_PD] = MTK_RANGE(mt8188_pin_pd_range),
1614 [PINCTRL_PIN_REG_DRV] = MTK_RANGE(mt8188_pin_drv_range),
1615 [PINCTRL_PIN_REG_DRV_ADV] = MTK_RANGE(mt8188_pin_drv_adv_range),
1616 [PINCTRL_PIN_REG_RSEL] = MTK_RANGE(mt8188_pin_rsel_range),
1617 };
1618
1619 static const char * const mt8188_pinctrl_register_base_name[] = {
1620 "iocfg0", "iocfg_rm", "iocfg_lt", "iocfg_lm", "iocfg_rt",
1621 };
1622
1623 static const struct mtk_eint_hw mt8188_eint_hw = {
1624 .port_mask = 0xf,
1625 .ports = 7,
1626 .ap_num = 225,
1627 .db_cnt = 32,
1628 .db_time = debounce_time_mt6765,
1629 };
1630
1631 static const struct mtk_pin_soc mt8188_data = {
1632 .reg_cal = mt8188_reg_cals,
1633 .pins = mtk_pins_mt8188,
1634 .npins = ARRAY_SIZE(mtk_pins_mt8188),
1635 .ngrps = ARRAY_SIZE(mtk_pins_mt8188),
1636 .eint_hw = &mt8188_eint_hw,
1637 .nfuncs = 8,
1638 .gpio_m = 0,
1639 .base_names = mt8188_pinctrl_register_base_name,
1640 .nbase_names = ARRAY_SIZE(mt8188_pinctrl_register_base_name),
1641 .pull_type = mt8188_pull_type,
1642 .pin_rsel = mt8188_pin_rsel_val_range,
1643 .npin_rsel = ARRAY_SIZE(mt8188_pin_rsel_val_range),
1644 .bias_set_combo = mtk_pinconf_bias_set_combo,
1645 .bias_get_combo = mtk_pinconf_bias_get_combo,
1646 .drive_set = mtk_pinconf_drive_set_rev1,
1647 .drive_get = mtk_pinconf_drive_get_rev1,
1648 .adv_drive_set = mtk_pinconf_adv_drive_set_raw,
1649 .adv_drive_get = mtk_pinconf_adv_drive_get_raw,
1650 };
1651
1652 static const struct of_device_id mt8188_pinctrl_of_match[] = {
1653 { .compatible = "mediatek,mt8188-pinctrl", .data = &mt8188_data },
1654 { }
1655 };
1656
1657 static struct platform_driver mt8188_pinctrl_driver = {
1658 .driver = {
1659 .name = "mt8188-pinctrl",
1660 .of_match_table = mt8188_pinctrl_of_match,
1661 .pm = &mtk_paris_pinctrl_pm_ops
1662 },
1663 .probe = mtk_paris_pinctrl_probe,
1664 };
1665
mt8188_pinctrl_init(void)1666 static int __init mt8188_pinctrl_init(void)
1667 {
1668 return platform_driver_register(&mt8188_pinctrl_driver);
1669 }
1670
1671 arch_initcall(mt8188_pinctrl_init);
1672
1673 MODULE_DESCRIPTION("MediaTek MT8188 Pinctrl Driver");
1674