1 // SPDX-License-Identifier: GPL-2.0
2 /*
3  * Copyright (C) 2018 MediaTek Inc.
4  *
5  * Author: ZH Chen <zh.chen@mediatek.com>
6  *
7  */
8 
9 #include <linux/module.h>
10 #include "pinctrl-mtk-mt6765.h"
11 #include "pinctrl-paris.h"
12 
13 /* MT6765 have multiple bases to program pin configuration listed as the below:
14  * iocfg[0]:0x10005000, iocfg[1]:0x10002C00, iocfg[2]:0x10002800,
15  * iocfg[3]:0x10002A00, iocfg[4]:0x10002000, iocfg[5]:0x10002200,
16  * iocfg[6]:0x10002500, iocfg[7]:0x10002600.
17  * _i_base could be used to indicate what base the pin should be mapped into.
18  */
19 
20 #define PIN_FIELD_BASE(_s_pin, _e_pin, _i_base, _s_addr, _x_addrs, _s_bit, _x_bits)	\
21 	PIN_FIELD_CALC(_s_pin, _e_pin, _i_base, _s_addr, _x_addrs, _s_bit,	\
22 		       _x_bits, 32, 0)
23 
24 #define PINS_FIELD_BASE(_s_pin, _e_pin, _i_base, _s_addr, _x_addrs, _s_bit, _x_bits)	\
25 	PIN_FIELD_CALC(_s_pin, _e_pin, _i_base, _s_addr, _x_addrs, _s_bit,	\
26 		      _x_bits, 32, 1)
27 
28 static const struct mtk_pin_field_calc mt6765_pin_mode_range[] = {
29 	PIN_FIELD(0, 202, 0x300, 0x10, 0, 4),
30 };
31 
32 static const struct mtk_pin_field_calc mt6765_pin_dir_range[] = {
33 	PIN_FIELD(0, 202, 0x0, 0x10, 0, 1),
34 };
35 
36 static const struct mtk_pin_field_calc mt6765_pin_di_range[] = {
37 	PIN_FIELD(0, 202, 0x200, 0x10, 0, 1),
38 };
39 
40 static const struct mtk_pin_field_calc mt6765_pin_do_range[] = {
41 	PIN_FIELD(0, 202, 0x100, 0x10, 0, 1),
42 };
43 
44 static const struct mtk_pin_field_calc mt6765_pin_smt_range[] = {
45 	PINS_FIELD_BASE(0, 3, 2, 0x00b0, 0x10, 4, 1),
46 	PINS_FIELD_BASE(4, 7, 2, 0x00b0, 0x10, 5, 1),
47 	PIN_FIELD_BASE(8, 8, 3, 0x0080, 0x10, 3, 1),
48 	PINS_FIELD_BASE(9, 11, 2, 0x00b0, 0x10, 6, 1),
49 	PIN_FIELD_BASE(12, 12, 5, 0x0060, 0x10, 9, 1),
50 	PINS_FIELD_BASE(13, 16, 6, 0x00b0, 0x10, 10, 1),
51 	PINS_FIELD_BASE(17, 20, 6, 0x00b0, 0x10, 8, 1),
52 	PINS_FIELD_BASE(21, 24, 6, 0x00b0, 0x10, 9, 1),
53 	PINS_FIELD_BASE(25, 28, 6, 0x00b0, 0x10, 7, 1),
54 	PIN_FIELD_BASE(29, 29, 6, 0x00b0, 0x10, 0, 1),
55 	PIN_FIELD_BASE(30, 30, 6, 0x00b0, 0x10, 1, 1),
56 	PINS_FIELD_BASE(31, 34, 6, 0x00b0, 0x10, 2, 1),
57 	PINS_FIELD_BASE(35, 36, 6, 0x00b0, 0x10, 5, 1),
58 	PIN_FIELD_BASE(37, 37, 6, 0x00b0, 0x10, 6, 1),
59 	PIN_FIELD_BASE(38, 38, 6, 0x00b0, 0x10, 4, 1),
60 	PINS_FIELD_BASE(39, 40, 6, 0x00b0, 0x10, 3, 1),
61 	PINS_FIELD_BASE(41, 42, 7, 0x00c0, 0x10, 6, 1),
62 	PIN_FIELD_BASE(43, 43, 7, 0x00c0, 0x10, 3, 1),
63 	PIN_FIELD_BASE(44, 44, 7, 0x00c0, 0x10, 4, 1),
64 	PIN_FIELD_BASE(45, 45, 7, 0x00c0, 0x10, 8, 1),
65 	PINS_FIELD_BASE(46, 47, 7, 0x00c0, 0x10, 7, 1),
66 	PIN_FIELD_BASE(48, 48, 7, 0x00c0, 0x10, 15, 1),
67 	PIN_FIELD_BASE(49, 49, 7, 0x00c0, 0x10, 17, 1),
68 	PIN_FIELD_BASE(50, 50, 7, 0x00c0, 0x10, 14, 1),
69 	PIN_FIELD_BASE(51, 51, 7, 0x00c0, 0x10, 16, 1),
70 	PINS_FIELD_BASE(52, 57, 7, 0x00c0, 0x10, 0, 1),
71 	PINS_FIELD_BASE(58, 60, 7, 0x00c0, 0x10, 12, 1),
72 	PINS_FIELD_BASE(61, 62, 3, 0x0080, 0x10, 5, 1),
73 	PINS_FIELD_BASE(63, 64, 3, 0x0080, 0x10, 4, 1),
74 	PINS_FIELD_BASE(65, 66, 3, 0x0080, 0x10, 7, 1),
75 	PINS_FIELD_BASE(67, 68, 3, 0x0080, 0x10, 6, 1),
76 	PINS_FIELD_BASE(69, 73, 3, 0x0080, 0x10, 1, 1),
77 	PINS_FIELD_BASE(74, 78, 3, 0x0080, 0x10, 2, 1),
78 	PINS_FIELD_BASE(79, 80, 3, 0x0080, 0x10, 0, 1),
79 	PIN_FIELD_BASE(81, 81, 3, 0x0080, 0x10, 12, 1),
80 	PIN_FIELD_BASE(82, 82, 3, 0x0080, 0x10, 11, 1),
81 	PIN_FIELD_BASE(83, 83, 3, 0x0080, 0x10, 9, 1),
82 	PIN_FIELD_BASE(84, 84, 3, 0x0080, 0x10, 10, 1),
83 	PIN_FIELD_BASE(85, 85, 7, 0x00c0, 0x10, 12, 1),
84 	PIN_FIELD_BASE(86, 86, 7, 0x00c0, 0x10, 13, 1),
85 	PIN_FIELD_BASE(87, 87, 7, 0x00c0, 0x10, 2, 1),
86 	PIN_FIELD_BASE(88, 88, 7, 0x00c0, 0x10, 1, 1),
87 	PIN_FIELD_BASE(89, 89, 2, 0x00b0, 0x10, 13, 1),
88 	PIN_FIELD_BASE(90, 90, 3, 0x0080, 0x10, 8, 1),
89 	PINS_FIELD_BASE(91, 92, 2, 0x00b0, 0x10, 8, 1),
90 	PINS_FIELD_BASE(93, 94, 2, 0x00b0, 0x10, 7, 1),
91 	PINS_FIELD_BASE(95, 96, 2, 0x00b0, 0x10, 14, 1),
92 	PINS_FIELD_BASE(97, 98, 2, 0x00b0, 0x10, 2, 1),
93 	PIN_FIELD_BASE(99, 99, 2, 0x00b0, 0x10, 0, 1),
94 	PIN_FIELD_BASE(100, 100, 2, 0x00b0, 0x10, 1, 1),
95 	PINS_FIELD_BASE(101, 102, 2, 0x00b0, 0x10, 3, 1),
96 	PIN_FIELD_BASE(103, 103, 2, 0x00b0, 0x10, 9, 1),
97 	PIN_FIELD_BASE(104, 104, 2, 0x00b0, 0x10, 11, 1),
98 	PIN_FIELD_BASE(105, 105, 2, 0x00b0, 0x10, 10, 1),
99 	PIN_FIELD_BASE(106, 106, 2, 0x00b0, 0x10, 12, 1),
100 	PIN_FIELD_BASE(107, 107, 1, 0x0080, 0x10, 4, 1),
101 	PIN_FIELD_BASE(108, 108, 1, 0x0080, 0x10, 3, 1),
102 	PIN_FIELD_BASE(109, 109, 1, 0x0080, 0x10, 5, 1),
103 	PIN_FIELD_BASE(110, 110, 1, 0x0080, 0x10, 0, 1),
104 	PIN_FIELD_BASE(111, 111, 1, 0x0080, 0x10, 1, 1),
105 	PIN_FIELD_BASE(112, 112, 1, 0x0080, 0x10, 2, 1),
106 	PIN_FIELD_BASE(113, 113, 1, 0x0080, 0x10, 9, 1),
107 	PIN_FIELD_BASE(114, 114, 1, 0x0080, 0x10, 10, 1),
108 	PIN_FIELD_BASE(115, 115, 1, 0x0080, 0x10, 6, 1),
109 	PIN_FIELD_BASE(116, 116, 1, 0x0080, 0x10, 7, 1),
110 	PIN_FIELD_BASE(117, 117, 1, 0x0080, 0x10, 12, 1),
111 	PIN_FIELD_BASE(118, 118, 1, 0x0080, 0x10, 13, 1),
112 	PIN_FIELD_BASE(119, 119, 1, 0x0080, 0x10, 14, 1),
113 	PIN_FIELD_BASE(120, 120, 1, 0x0080, 0x10, 11, 1),
114 	PIN_FIELD_BASE(121, 121, 1, 0x0080, 0x10, 8, 1),
115 	PIN_FIELD_BASE(122, 122, 4, 0x0080, 0x10, 2, 1),
116 	PIN_FIELD_BASE(123, 123, 4, 0x0080, 0x10, 3, 1),
117 	PIN_FIELD_BASE(124, 124, 4, 0x0080, 0x10, 1, 1),
118 	PIN_FIELD_BASE(125, 125, 4, 0x0080, 0x10, 5, 1),
119 	PIN_FIELD_BASE(126, 126, 4, 0x0080, 0x10, 7, 1),
120 	PIN_FIELD_BASE(127, 127, 4, 0x0080, 0x10, 9, 1),
121 	PIN_FIELD_BASE(128, 128, 4, 0x0080, 0x10, 4, 1),
122 	PIN_FIELD_BASE(129, 129, 4, 0x0080, 0x10, 8, 1),
123 	PIN_FIELD_BASE(130, 130, 4, 0x0080, 0x10, 10, 1),
124 	PIN_FIELD_BASE(131, 131, 4, 0x0080, 0x10, 11, 1),
125 	PIN_FIELD_BASE(132, 132, 4, 0x0080, 0x10, 6, 1),
126 	PIN_FIELD_BASE(133, 133, 4, 0x0080, 0x10, 12, 1),
127 	PIN_FIELD_BASE(134, 134, 5, 0x0060, 0x10, 11, 1),
128 	PIN_FIELD_BASE(135, 135, 5, 0x0060, 0x10, 13, 1),
129 	PIN_FIELD_BASE(136, 136, 5, 0x0060, 0x10, 1, 1),
130 	PIN_FIELD_BASE(137, 137, 5, 0x0060, 0x10, 7, 1),
131 	PIN_FIELD_BASE(138, 138, 5, 0x0060, 0x10, 4, 1),
132 	PIN_FIELD_BASE(139, 139, 5, 0x0060, 0x10, 5, 1),
133 	PIN_FIELD_BASE(140, 140, 5, 0x0060, 0x10, 0, 1),
134 	PIN_FIELD_BASE(141, 141, 5, 0x0060, 0x10, 6, 1),
135 	PIN_FIELD_BASE(142, 142, 5, 0x0060, 0x10, 2, 1),
136 	PIN_FIELD_BASE(143, 143, 5, 0x0060, 0x10, 3, 1),
137 	PINS_FIELD_BASE(144, 147, 5, 0x0060, 0x10, 10, 1),
138 	PINS_FIELD_BASE(148, 149, 5, 0x0060, 0x10, 12, 1),
139 	PINS_FIELD_BASE(150, 151, 7, 0x00c0, 0x10, 9, 1),
140 	PINS_FIELD_BASE(152, 153, 7, 0x00c0, 0x10, 10, 1),
141 	PIN_FIELD_BASE(154, 154, 7, 0x00c0, 0x10, 11, 1),
142 	PINS_FIELD_BASE(155, 158, 3, 0x0080, 0x10, 13, 1),
143 	PIN_FIELD_BASE(159, 159, 7, 0x00c0, 0x10, 11, 1),
144 	PIN_FIELD_BASE(160, 160, 5, 0x0060, 0x10, 8, 1),
145 	PIN_FIELD_BASE(161, 161, 1, 0x0080, 0x10, 15, 1),
146 	PIN_FIELD_BASE(162, 162, 1, 0x0080, 0x10, 16, 1),
147 	PINS_FIELD_BASE(163, 170, 4, 0x0080, 0x10, 0, 1),
148 	PINS_FIELD_BASE(171, 179, 7, 0x00c0, 0x10, 5, 1),
149 };
150 
151 static const struct mtk_pin_field_calc mt6765_pin_pd_range[] = {
152 	PIN_FIELD_BASE(0, 0, 2, 0x0040, 0x10, 6, 1),
153 	PIN_FIELD_BASE(1, 1, 2, 0x0040, 0x10, 7, 1),
154 	PIN_FIELD_BASE(2, 2, 2, 0x0040, 0x10, 10, 1),
155 	PIN_FIELD_BASE(3, 3, 2, 0x0040, 0x10, 11, 1),
156 	PIN_FIELD_BASE(4, 4, 2, 0x0040, 0x10, 12, 1),
157 	PIN_FIELD_BASE(5, 5, 2, 0x0040, 0x10, 13, 1),
158 	PIN_FIELD_BASE(6, 6, 2, 0x0040, 0x10, 14, 1),
159 	PIN_FIELD_BASE(7, 7, 2, 0x0040, 0x10, 15, 1),
160 	PIN_FIELD_BASE(8, 8, 3, 0x0040, 0x10, 12, 1),
161 	PIN_FIELD_BASE(9, 9, 2, 0x0040, 0x10, 16, 1),
162 	PIN_FIELD_BASE(10, 10, 2, 0x0040, 0x10, 8, 1),
163 	PIN_FIELD_BASE(11, 11, 2, 0x0040, 0x10, 9, 1),
164 	PIN_FIELD_BASE(12, 12, 5, 0x0030, 0x10, 9, 1),
165 	PIN_FIELD_BASE(13, 13, 6, 0x0040, 0x10, 14, 1),
166 	PIN_FIELD_BASE(14, 14, 6, 0x0040, 0x10, 13, 1),
167 	PIN_FIELD_BASE(15, 15, 6, 0x0040, 0x10, 15, 1),
168 	PIN_FIELD_BASE(16, 16, 6, 0x0040, 0x10, 12, 1),
169 	PIN_FIELD_BASE(17, 17, 6, 0x0040, 0x10, 7, 1),
170 	PIN_FIELD_BASE(18, 18, 6, 0x0040, 0x10, 4, 1),
171 	PIN_FIELD_BASE(19, 19, 6, 0x0040, 0x10, 6, 1),
172 	PIN_FIELD_BASE(20, 20, 6, 0x0040, 0x10, 5, 1),
173 	PIN_FIELD_BASE(21, 21, 6, 0x0040, 0x10, 10, 1),
174 	PIN_FIELD_BASE(22, 22, 6, 0x0040, 0x10, 9, 1),
175 	PIN_FIELD_BASE(23, 23, 6, 0x0040, 0x10, 11, 1),
176 	PIN_FIELD_BASE(24, 24, 6, 0x0040, 0x10, 8, 1),
177 	PIN_FIELD_BASE(25, 25, 6, 0x0040, 0x10, 2, 1),
178 	PIN_FIELD_BASE(26, 26, 6, 0x0040, 0x10, 1, 1),
179 	PIN_FIELD_BASE(27, 27, 6, 0x0040, 0x10, 3, 1),
180 	PINS_FIELD_BASE(28, 40, 6, 0x0040, 0x10, 0, 1),
181 	PIN_FIELD_BASE(41, 41, 7, 0x0060, 0x10, 19, 1),
182 	PIN_FIELD_BASE(42, 42, 7, 0x0060, 0x10, 9, 1),
183 	PIN_FIELD_BASE(43, 43, 7, 0x0060, 0x10, 8, 1),
184 	PIN_FIELD_BASE(44, 44, 7, 0x0060, 0x10, 10, 1),
185 	PIN_FIELD_BASE(45, 45, 7, 0x0060, 0x10, 22, 1),
186 	PIN_FIELD_BASE(46, 46, 7, 0x0060, 0x10, 21, 1),
187 	PIN_FIELD_BASE(47, 47, 7, 0x0060, 0x10, 20, 1),
188 	PIN_FIELD_BASE(48, 48, 7, 0x0070, 0x10, 3, 1),
189 	PIN_FIELD_BASE(49, 49, 7, 0x0070, 0x10, 5, 1),
190 	PIN_FIELD_BASE(50, 50, 7, 0x0070, 0x10, 2, 1),
191 	PIN_FIELD_BASE(51, 51, 7, 0x0070, 0x10, 4, 1),
192 	PIN_FIELD_BASE(52, 52, 7, 0x0060, 0x10, 1, 1),
193 	PIN_FIELD_BASE(53, 53, 7, 0x0060, 0x10, 0, 1),
194 	PIN_FIELD_BASE(54, 54, 7, 0x0060, 0x10, 5, 1),
195 	PIN_FIELD_BASE(55, 55, 7, 0x0060, 0x10, 3, 1),
196 	PIN_FIELD_BASE(56, 56, 7, 0x0060, 0x10, 4, 1),
197 	PIN_FIELD_BASE(57, 57, 7, 0x0060, 0x10, 2, 1),
198 	PIN_FIELD_BASE(58, 58, 7, 0x0070, 0x10, 0, 1),
199 	PIN_FIELD_BASE(59, 59, 7, 0x0060, 0x10, 31, 1),
200 	PIN_FIELD_BASE(60, 60, 7, 0x0060, 0x10, 30, 1),
201 	PIN_FIELD_BASE(61, 61, 3, 0x0040, 0x10, 18, 1),
202 	PIN_FIELD_BASE(62, 62, 3, 0x0040, 0x10, 14, 1),
203 	PIN_FIELD_BASE(63, 63, 3, 0x0040, 0x10, 17, 1),
204 	PIN_FIELD_BASE(64, 64, 3, 0x0040, 0x10, 13, 1),
205 	PIN_FIELD_BASE(65, 65, 3, 0x0040, 0x10, 20, 1),
206 	PIN_FIELD_BASE(66, 66, 3, 0x0040, 0x10, 16, 1),
207 	PIN_FIELD_BASE(67, 67, 3, 0x0040, 0x10, 19, 1),
208 	PIN_FIELD_BASE(68, 68, 3, 0x0040, 0x10, 15, 1),
209 	PIN_FIELD_BASE(69, 69, 3, 0x0040, 0x10, 8, 1),
210 	PIN_FIELD_BASE(70, 70, 3, 0x0040, 0x10, 7, 1),
211 	PIN_FIELD_BASE(71, 71, 3, 0x0040, 0x10, 6, 1),
212 	PIN_FIELD_BASE(72, 72, 3, 0x0040, 0x10, 5, 1),
213 	PIN_FIELD_BASE(73, 73, 3, 0x0040, 0x10, 4, 1),
214 	PIN_FIELD_BASE(74, 74, 3, 0x0040, 0x10, 3, 1),
215 	PIN_FIELD_BASE(75, 75, 3, 0x0040, 0x10, 2, 1),
216 	PIN_FIELD_BASE(76, 76, 3, 0x0040, 0x10, 1, 1),
217 	PIN_FIELD_BASE(77, 77, 3, 0x0040, 0x10, 0, 1),
218 	PIN_FIELD_BASE(78, 78, 3, 0x0040, 0x10, 9, 1),
219 	PIN_FIELD_BASE(79, 79, 3, 0x0040, 0x10, 11, 1),
220 	PIN_FIELD_BASE(80, 80, 3, 0x0040, 0x10, 10, 1),
221 	PIN_FIELD_BASE(81, 81, 3, 0x0040, 0x10, 25, 1),
222 	PIN_FIELD_BASE(82, 82, 3, 0x0040, 0x10, 24, 1),
223 	PIN_FIELD_BASE(83, 83, 3, 0x0040, 0x10, 22, 1),
224 	PIN_FIELD_BASE(84, 84, 3, 0x0040, 0x10, 23, 1),
225 	PIN_FIELD_BASE(85, 85, 7, 0x0070, 0x10, 1, 1),
226 	PIN_FIELD_BASE(86, 86, 7, 0x0060, 0x10, 29, 1),
227 	PIN_FIELD_BASE(87, 87, 7, 0x0060, 0x10, 7, 1),
228 	PIN_FIELD_BASE(88, 88, 7, 0x0060, 0x10, 6, 1),
229 	PIN_FIELD_BASE(89, 89, 2, 0x0040, 0x10, 21, 1),
230 	PINS_FIELD_BASE(90, 94, 3, 0x0040, 0x10, 21, 1),
231 	PIN_FIELD_BASE(95, 95, 2, 0x0040, 0x10, 22, 1),
232 	PIN_FIELD_BASE(96, 96, 2, 0x0040, 0x10, 23, 1),
233 	PIN_FIELD_BASE(97, 97, 2, 0x0040, 0x10, 2, 1),
234 	PIN_FIELD_BASE(98, 98, 2, 0x0040, 0x10, 3, 1),
235 	PIN_FIELD_BASE(99, 99, 2, 0x0040, 0x10, 0, 1),
236 	PIN_FIELD_BASE(100, 100, 2, 0x0040, 0x10, 1, 1),
237 	PIN_FIELD_BASE(101, 101, 2, 0x0040, 0x10, 4, 1),
238 	PIN_FIELD_BASE(102, 102, 2, 0x0040, 0x10, 5, 1),
239 	PIN_FIELD_BASE(103, 103, 2, 0x0040, 0x10, 17, 1),
240 	PIN_FIELD_BASE(104, 104, 2, 0x0040, 0x10, 19, 1),
241 	PIN_FIELD_BASE(105, 105, 2, 0x0040, 0x10, 18, 1),
242 	PIN_FIELD_BASE(106, 106, 2, 0x0040, 0x10, 20, 1),
243 	PIN_FIELD_BASE(107, 107, 1, 0x0040, 0x10, 4, 1),
244 	PIN_FIELD_BASE(108, 108, 1, 0x0040, 0x10, 3, 1),
245 	PIN_FIELD_BASE(109, 109, 1, 0x0040, 0x10, 5, 1),
246 	PIN_FIELD_BASE(110, 110, 1, 0x0040, 0x10, 0, 1),
247 	PIN_FIELD_BASE(111, 111, 1, 0x0040, 0x10, 1, 1),
248 	PIN_FIELD_BASE(112, 112, 1, 0x0040, 0x10, 2, 1),
249 	PIN_FIELD_BASE(113, 113, 1, 0x0040, 0x10, 9, 1),
250 	PIN_FIELD_BASE(114, 114, 1, 0x0040, 0x10, 10, 1),
251 	PIN_FIELD_BASE(115, 115, 1, 0x0040, 0x10, 6, 1),
252 	PIN_FIELD_BASE(116, 116, 1, 0x0040, 0x10, 7, 1),
253 	PIN_FIELD_BASE(117, 117, 1, 0x0040, 0x10, 12, 1),
254 	PIN_FIELD_BASE(118, 118, 1, 0x0040, 0x10, 13, 1),
255 	PIN_FIELD_BASE(119, 119, 1, 0x0040, 0x10, 14, 1),
256 	PIN_FIELD_BASE(120, 120, 1, 0x0040, 0x10, 11, 1),
257 	PINS_FIELD_BASE(121, 133, 1, 0x0040, 0x10, 8, 1),
258 	PIN_FIELD_BASE(134, 134, 5, 0x0030, 0x10, 14, 1),
259 	PIN_FIELD_BASE(135, 135, 5, 0x0030, 0x10, 19, 1),
260 	PIN_FIELD_BASE(136, 136, 5, 0x0030, 0x10, 1, 1),
261 	PIN_FIELD_BASE(137, 137, 5, 0x0030, 0x10, 7, 1),
262 	PIN_FIELD_BASE(138, 138, 5, 0x0030, 0x10, 4, 1),
263 	PIN_FIELD_BASE(139, 139, 5, 0x0030, 0x10, 5, 1),
264 	PIN_FIELD_BASE(140, 140, 5, 0x0030, 0x10, 0, 1),
265 	PIN_FIELD_BASE(141, 141, 5, 0x0030, 0x10, 6, 1),
266 	PIN_FIELD_BASE(142, 142, 5, 0x0030, 0x10, 2, 1),
267 	PIN_FIELD_BASE(143, 143, 5, 0x0030, 0x10, 3, 1),
268 	PIN_FIELD_BASE(144, 144, 5, 0x0030, 0x10, 12, 1),
269 	PIN_FIELD_BASE(145, 145, 5, 0x0030, 0x10, 11, 1),
270 	PIN_FIELD_BASE(146, 146, 5, 0x0030, 0x10, 13, 1),
271 	PIN_FIELD_BASE(147, 147, 5, 0x0030, 0x10, 10, 1),
272 	PIN_FIELD_BASE(148, 148, 5, 0x0030, 0x10, 15, 1),
273 	PIN_FIELD_BASE(149, 149, 5, 0x0030, 0x10, 16, 1),
274 	PIN_FIELD_BASE(150, 150, 7, 0x0060, 0x10, 23, 1),
275 	PIN_FIELD_BASE(151, 151, 7, 0x0060, 0x10, 24, 1),
276 	PIN_FIELD_BASE(152, 152, 7, 0x0060, 0x10, 25, 1),
277 	PIN_FIELD_BASE(153, 153, 7, 0x0060, 0x10, 26, 1),
278 	PIN_FIELD_BASE(154, 154, 7, 0x0060, 0x10, 28, 1),
279 	PIN_FIELD_BASE(155, 155, 3, 0x0040, 0x10, 28, 1),
280 	PIN_FIELD_BASE(156, 156, 3, 0x0040, 0x10, 27, 1),
281 	PIN_FIELD_BASE(157, 157, 3, 0x0040, 0x10, 29, 1),
282 	PIN_FIELD_BASE(158, 158, 3, 0x0040, 0x10, 26, 1),
283 	PIN_FIELD_BASE(159, 159, 7, 0x0060, 0x10, 27, 1),
284 	PIN_FIELD_BASE(160, 160, 5, 0x0030, 0x10, 8, 1),
285 	PIN_FIELD_BASE(161, 161, 1, 0x0040, 0x10, 15, 1),
286 	PIN_FIELD_BASE(162, 162, 1, 0x0040, 0x10, 16, 1),
287 	PIN_FIELD_BASE(163, 163, 4, 0x0020, 0x10, 0, 1),
288 	PIN_FIELD_BASE(164, 164, 4, 0x0020, 0x10, 1, 1),
289 	PIN_FIELD_BASE(165, 165, 4, 0x0020, 0x10, 2, 1),
290 	PIN_FIELD_BASE(166, 166, 4, 0x0020, 0x10, 3, 1),
291 	PIN_FIELD_BASE(167, 167, 4, 0x0020, 0x10, 4, 1),
292 	PIN_FIELD_BASE(168, 168, 4, 0x0020, 0x10, 5, 1),
293 	PIN_FIELD_BASE(169, 169, 4, 0x0020, 0x10, 6, 1),
294 	PIN_FIELD_BASE(170, 170, 4, 0x0020, 0x10, 7, 1),
295 	PIN_FIELD_BASE(171, 171, 7, 0x0060, 0x10, 17, 1),
296 	PIN_FIELD_BASE(172, 172, 7, 0x0060, 0x10, 18, 1),
297 	PIN_FIELD_BASE(173, 173, 7, 0x0060, 0x10, 11, 1),
298 	PIN_FIELD_BASE(174, 174, 7, 0x0060, 0x10, 12, 1),
299 	PIN_FIELD_BASE(175, 175, 7, 0x0060, 0x10, 13, 1),
300 	PIN_FIELD_BASE(176, 176, 7, 0x0060, 0x10, 14, 1),
301 	PIN_FIELD_BASE(177, 177, 7, 0x0060, 0x10, 15, 1),
302 	PINS_FIELD_BASE(178, 179, 7, 0x0060, 0x10, 16, 1),
303 };
304 
305 static const struct mtk_pin_field_calc mt6765_pin_pu_range[] = {
306 	PIN_FIELD_BASE(0, 0, 2, 0x0060, 0x10, 6, 1),
307 	PIN_FIELD_BASE(1, 1, 2, 0x0060, 0x10, 7, 1),
308 	PIN_FIELD_BASE(2, 2, 2, 0x0060, 0x10, 10, 1),
309 	PIN_FIELD_BASE(3, 3, 2, 0x0060, 0x10, 11, 1),
310 	PIN_FIELD_BASE(4, 4, 2, 0x0060, 0x10, 12, 1),
311 	PIN_FIELD_BASE(5, 5, 2, 0x0060, 0x10, 13, 1),
312 	PIN_FIELD_BASE(6, 6, 2, 0x0060, 0x10, 14, 1),
313 	PIN_FIELD_BASE(7, 7, 2, 0x0060, 0x10, 15, 1),
314 	PIN_FIELD_BASE(8, 8, 3, 0x0050, 0x10, 12, 1),
315 	PIN_FIELD_BASE(9, 9, 2, 0x0060, 0x10, 16, 1),
316 	PIN_FIELD_BASE(10, 10, 2, 0x0060, 0x10, 8, 1),
317 	PIN_FIELD_BASE(11, 11, 2, 0x0060, 0x10, 9, 1),
318 	PIN_FIELD_BASE(12, 12, 5, 0x0040, 0x10, 9, 1),
319 	PIN_FIELD_BASE(13, 13, 6, 0x0060, 0x10, 14, 1),
320 	PIN_FIELD_BASE(14, 14, 6, 0x0060, 0x10, 13, 1),
321 	PIN_FIELD_BASE(15, 15, 6, 0x0060, 0x10, 15, 1),
322 	PIN_FIELD_BASE(16, 16, 6, 0x0060, 0x10, 12, 1),
323 	PIN_FIELD_BASE(17, 17, 6, 0x0060, 0x10, 7, 1),
324 	PIN_FIELD_BASE(18, 18, 6, 0x0060, 0x10, 4, 1),
325 	PIN_FIELD_BASE(19, 19, 6, 0x0060, 0x10, 6, 1),
326 	PIN_FIELD_BASE(20, 20, 6, 0x0060, 0x10, 5, 1),
327 	PIN_FIELD_BASE(21, 21, 6, 0x0060, 0x10, 10, 1),
328 	PIN_FIELD_BASE(22, 22, 6, 0x0060, 0x10, 9, 1),
329 	PIN_FIELD_BASE(23, 23, 6, 0x0060, 0x10, 11, 1),
330 	PIN_FIELD_BASE(24, 24, 6, 0x0060, 0x10, 8, 1),
331 	PIN_FIELD_BASE(25, 25, 6, 0x0060, 0x10, 2, 1),
332 	PIN_FIELD_BASE(26, 26, 6, 0x0060, 0x10, 1, 1),
333 	PIN_FIELD_BASE(27, 27, 6, 0x0060, 0x10, 3, 1),
334 	PINS_FIELD_BASE(28, 40, 6, 0x0060, 0x10, 0, 1),
335 	PIN_FIELD_BASE(41, 41, 7, 0x0080, 0x10, 19, 1),
336 	PIN_FIELD_BASE(42, 42, 7, 0x0080, 0x10, 9, 1),
337 	PIN_FIELD_BASE(43, 43, 7, 0x0080, 0x10, 8, 1),
338 	PIN_FIELD_BASE(44, 44, 7, 0x0080, 0x10, 10, 1),
339 	PIN_FIELD_BASE(45, 45, 7, 0x0080, 0x10, 22, 1),
340 	PIN_FIELD_BASE(46, 46, 7, 0x0080, 0x10, 21, 1),
341 	PIN_FIELD_BASE(47, 47, 7, 0x0080, 0x10, 20, 1),
342 	PIN_FIELD_BASE(48, 48, 7, 0x0090, 0x10, 3, 1),
343 	PIN_FIELD_BASE(49, 49, 7, 0x0090, 0x10, 5, 1),
344 	PIN_FIELD_BASE(50, 50, 7, 0x0090, 0x10, 2, 1),
345 	PIN_FIELD_BASE(51, 51, 7, 0x0090, 0x10, 4, 1),
346 	PIN_FIELD_BASE(52, 52, 7, 0x0080, 0x10, 1, 1),
347 	PIN_FIELD_BASE(53, 53, 7, 0x0080, 0x10, 0, 1),
348 	PIN_FIELD_BASE(54, 54, 7, 0x0080, 0x10, 5, 1),
349 	PIN_FIELD_BASE(55, 55, 7, 0x0080, 0x10, 3, 1),
350 	PIN_FIELD_BASE(56, 56, 7, 0x0080, 0x10, 4, 1),
351 	PIN_FIELD_BASE(57, 57, 7, 0x0080, 0x10, 2, 1),
352 	PIN_FIELD_BASE(58, 58, 7, 0x0090, 0x10, 0, 1),
353 	PIN_FIELD_BASE(59, 59, 7, 0x0080, 0x10, 31, 1),
354 	PIN_FIELD_BASE(60, 60, 7, 0x0080, 0x10, 30, 1),
355 	PIN_FIELD_BASE(61, 61, 3, 0x0050, 0x10, 18, 1),
356 	PIN_FIELD_BASE(62, 62, 3, 0x0050, 0x10, 14, 1),
357 	PIN_FIELD_BASE(63, 63, 3, 0x0050, 0x10, 17, 1),
358 	PIN_FIELD_BASE(64, 64, 3, 0x0050, 0x10, 13, 1),
359 	PIN_FIELD_BASE(65, 65, 3, 0x0050, 0x10, 20, 1),
360 	PIN_FIELD_BASE(66, 66, 3, 0x0050, 0x10, 16, 1),
361 	PIN_FIELD_BASE(67, 67, 3, 0x0050, 0x10, 19, 1),
362 	PIN_FIELD_BASE(68, 68, 3, 0x0050, 0x10, 15, 1),
363 	PIN_FIELD_BASE(69, 69, 3, 0x0050, 0x10, 8, 1),
364 	PIN_FIELD_BASE(70, 70, 3, 0x0050, 0x10, 7, 1),
365 	PIN_FIELD_BASE(71, 71, 3, 0x0050, 0x10, 6, 1),
366 	PIN_FIELD_BASE(72, 72, 3, 0x0050, 0x10, 5, 1),
367 	PIN_FIELD_BASE(73, 73, 3, 0x0050, 0x10, 4, 1),
368 	PIN_FIELD_BASE(74, 74, 3, 0x0050, 0x10, 3, 1),
369 	PIN_FIELD_BASE(75, 75, 3, 0x0050, 0x10, 2, 1),
370 	PIN_FIELD_BASE(76, 76, 3, 0x0050, 0x10, 1, 1),
371 	PIN_FIELD_BASE(77, 77, 3, 0x0050, 0x10, 0, 1),
372 	PIN_FIELD_BASE(78, 78, 3, 0x0050, 0x10, 9, 1),
373 	PIN_FIELD_BASE(79, 79, 3, 0x0050, 0x10, 11, 1),
374 	PIN_FIELD_BASE(80, 80, 3, 0x0050, 0x10, 10, 1),
375 	PIN_FIELD_BASE(81, 81, 3, 0x0050, 0x10, 25, 1),
376 	PIN_FIELD_BASE(82, 82, 3, 0x0050, 0x10, 24, 1),
377 	PIN_FIELD_BASE(83, 83, 3, 0x0050, 0x10, 22, 1),
378 	PIN_FIELD_BASE(84, 84, 3, 0x0050, 0x10, 23, 1),
379 	PIN_FIELD_BASE(85, 85, 7, 0x0090, 0x10, 1, 1),
380 	PIN_FIELD_BASE(86, 86, 7, 0x0080, 0x10, 29, 1),
381 	PIN_FIELD_BASE(87, 87, 7, 0x0080, 0x10, 7, 1),
382 	PIN_FIELD_BASE(88, 88, 7, 0x0080, 0x10, 6, 1),
383 	PIN_FIELD_BASE(89, 89, 2, 0x0060, 0x10, 21, 1),
384 	PINS_FIELD_BASE(90, 94, 3, 0x0050, 0x10, 21, 1),
385 	PIN_FIELD_BASE(95, 95, 2, 0x0060, 0x10, 22, 1),
386 	PIN_FIELD_BASE(96, 96, 2, 0x0060, 0x10, 23, 1),
387 	PIN_FIELD_BASE(97, 97, 2, 0x0060, 0x10, 2, 1),
388 	PIN_FIELD_BASE(98, 98, 2, 0x0060, 0x10, 3, 1),
389 	PIN_FIELD_BASE(99, 99, 2, 0x0060, 0x10, 0, 1),
390 	PIN_FIELD_BASE(100, 100, 2, 0x0060, 0x10, 1, 1),
391 	PIN_FIELD_BASE(101, 101, 2, 0x0060, 0x10, 4, 1),
392 	PIN_FIELD_BASE(102, 102, 2, 0x0060, 0x10, 5, 1),
393 	PIN_FIELD_BASE(103, 103, 2, 0x0060, 0x10, 17, 1),
394 	PIN_FIELD_BASE(104, 104, 2, 0x0060, 0x10, 19, 1),
395 	PIN_FIELD_BASE(105, 105, 2, 0x0060, 0x10, 18, 1),
396 	PIN_FIELD_BASE(106, 106, 2, 0x0060, 0x10, 20, 1),
397 	PIN_FIELD_BASE(107, 107, 1, 0x0050, 0x10, 4, 1),
398 	PIN_FIELD_BASE(108, 108, 1, 0x0050, 0x10, 3, 1),
399 	PIN_FIELD_BASE(109, 109, 1, 0x0050, 0x10, 5, 1),
400 	PIN_FIELD_BASE(110, 110, 1, 0x0050, 0x10, 0, 1),
401 	PIN_FIELD_BASE(111, 111, 1, 0x0050, 0x10, 1, 1),
402 	PIN_FIELD_BASE(112, 112, 1, 0x0050, 0x10, 2, 1),
403 	PIN_FIELD_BASE(113, 113, 1, 0x0050, 0x10, 9, 1),
404 	PIN_FIELD_BASE(114, 114, 1, 0x0050, 0x10, 10, 1),
405 	PIN_FIELD_BASE(115, 115, 1, 0x0050, 0x10, 6, 1),
406 	PIN_FIELD_BASE(116, 116, 1, 0x0050, 0x10, 7, 1),
407 	PIN_FIELD_BASE(117, 117, 1, 0x0050, 0x10, 12, 1),
408 	PIN_FIELD_BASE(118, 118, 1, 0x0050, 0x10, 13, 1),
409 	PIN_FIELD_BASE(119, 119, 1, 0x0050, 0x10, 14, 1),
410 	PIN_FIELD_BASE(120, 120, 1, 0x0050, 0x10, 11, 1),
411 	PINS_FIELD_BASE(121, 133, 1, 0x0050, 0x10, 8, 1),
412 	PIN_FIELD_BASE(134, 134, 5, 0x0040, 0x10, 14, 1),
413 	PIN_FIELD_BASE(135, 135, 5, 0x0040, 0x10, 19, 1),
414 	PIN_FIELD_BASE(136, 136, 5, 0x0040, 0x10, 1, 1),
415 	PIN_FIELD_BASE(137, 137, 5, 0x0040, 0x10, 7, 1),
416 	PIN_FIELD_BASE(138, 138, 5, 0x0040, 0x10, 4, 1),
417 	PIN_FIELD_BASE(139, 139, 5, 0x0040, 0x10, 5, 1),
418 	PIN_FIELD_BASE(140, 140, 5, 0x0040, 0x10, 0, 1),
419 	PIN_FIELD_BASE(141, 141, 5, 0x0040, 0x10, 6, 1),
420 	PIN_FIELD_BASE(142, 142, 5, 0x0040, 0x10, 2, 1),
421 	PIN_FIELD_BASE(143, 143, 5, 0x0040, 0x10, 3, 1),
422 	PIN_FIELD_BASE(144, 144, 5, 0x0040, 0x10, 12, 1),
423 	PIN_FIELD_BASE(145, 145, 5, 0x0040, 0x10, 11, 1),
424 	PIN_FIELD_BASE(146, 146, 5, 0x0040, 0x10, 13, 1),
425 	PIN_FIELD_BASE(147, 147, 5, 0x0040, 0x10, 10, 1),
426 	PIN_FIELD_BASE(148, 148, 5, 0x0040, 0x10, 15, 1),
427 	PIN_FIELD_BASE(149, 149, 5, 0x0040, 0x10, 16, 1),
428 	PIN_FIELD_BASE(150, 150, 7, 0x0080, 0x10, 23, 1),
429 	PIN_FIELD_BASE(151, 151, 7, 0x0080, 0x10, 24, 1),
430 	PIN_FIELD_BASE(152, 152, 7, 0x0080, 0x10, 25, 1),
431 	PIN_FIELD_BASE(153, 153, 7, 0x0080, 0x10, 26, 1),
432 	PIN_FIELD_BASE(154, 154, 7, 0x0080, 0x10, 28, 1),
433 	PIN_FIELD_BASE(155, 155, 3, 0x0050, 0x10, 28, 1),
434 	PIN_FIELD_BASE(156, 156, 3, 0x0050, 0x10, 27, 1),
435 	PIN_FIELD_BASE(157, 157, 3, 0x0050, 0x10, 29, 1),
436 	PIN_FIELD_BASE(158, 158, 3, 0x0050, 0x10, 26, 1),
437 	PIN_FIELD_BASE(159, 159, 7, 0x0080, 0x10, 27, 1),
438 	PIN_FIELD_BASE(160, 160, 5, 0x0040, 0x10, 8, 1),
439 	PIN_FIELD_BASE(161, 161, 1, 0x0050, 0x10, 15, 1),
440 	PIN_FIELD_BASE(162, 162, 1, 0x0050, 0x10, 16, 1),
441 	PIN_FIELD_BASE(163, 163, 4, 0x0040, 0x10, 0, 1),
442 	PIN_FIELD_BASE(164, 164, 4, 0x0040, 0x10, 1, 1),
443 	PIN_FIELD_BASE(165, 165, 4, 0x0040, 0x10, 2, 1),
444 	PIN_FIELD_BASE(166, 166, 4, 0x0040, 0x10, 3, 1),
445 	PIN_FIELD_BASE(167, 167, 4, 0x0040, 0x10, 4, 1),
446 	PIN_FIELD_BASE(168, 168, 4, 0x0040, 0x10, 5, 1),
447 	PIN_FIELD_BASE(169, 169, 4, 0x0040, 0x10, 6, 1),
448 	PIN_FIELD_BASE(170, 170, 4, 0x0040, 0x10, 7, 1),
449 	PIN_FIELD_BASE(171, 171, 7, 0x0080, 0x10, 17, 1),
450 	PIN_FIELD_BASE(172, 172, 7, 0x0080, 0x10, 18, 1),
451 	PIN_FIELD_BASE(173, 173, 7, 0x0080, 0x10, 11, 1),
452 	PIN_FIELD_BASE(174, 174, 7, 0x0080, 0x10, 12, 1),
453 	PIN_FIELD_BASE(175, 175, 7, 0x0080, 0x10, 13, 1),
454 	PIN_FIELD_BASE(176, 176, 7, 0x0080, 0x10, 14, 1),
455 	PIN_FIELD_BASE(177, 177, 7, 0x0080, 0x10, 15, 1),
456 	PINS_FIELD_BASE(178, 179, 7, 0x0080, 0x10, 16, 1),
457 };
458 
459 static const struct mtk_pin_field_calc mt6765_pin_tdsel_range[] = {
460 	PINS_FIELD_BASE(0, 3, 2, 0x00c0, 0x10, 16, 4),
461 	PINS_FIELD_BASE(4, 7, 2, 0x00c0, 0x10, 20, 4),
462 	PIN_FIELD_BASE(8, 8, 3, 0x0090, 0x10, 12, 4),
463 	PINS_FIELD_BASE(9, 11, 2, 0x00c0, 0x10, 24, 4),
464 	PIN_FIELD_BASE(12, 12, 5, 0x0080, 0x10, 4, 4),
465 	PINS_FIELD_BASE(13, 16, 6, 0x00e0, 0x10, 8, 4),
466 	PINS_FIELD_BASE(17, 20, 6, 0x00e0, 0x10, 0, 4),
467 	PINS_FIELD_BASE(21, 24, 6, 0x00e0, 0x10, 4, 4),
468 	PINS_FIELD_BASE(25, 28, 6, 0x00d0, 0x10, 28, 4),
469 	PIN_FIELD_BASE(29, 29, 6, 0x00d0, 0x10, 0, 4),
470 	PIN_FIELD_BASE(30, 30, 6, 0x00d0, 0x10, 4, 4),
471 	PINS_FIELD_BASE(31, 34, 6, 0x00d0, 0x10, 8, 4),
472 	PINS_FIELD_BASE(35, 36, 6, 0x00d0, 0x10, 20, 4),
473 	PIN_FIELD_BASE(37, 37, 6, 0x00d0, 0x10, 24, 4),
474 	PIN_FIELD_BASE(38, 38, 6, 0x00d0, 0x10, 16, 4),
475 	PINS_FIELD_BASE(39, 40, 6, 0x00d0, 0x10, 12, 4),
476 	PINS_FIELD_BASE(41, 42, 7, 0x00d0, 0x10, 24, 4),
477 	PIN_FIELD_BASE(43, 43, 7, 0x00d0, 0x10, 12, 4),
478 	PIN_FIELD_BASE(44, 44, 7, 0x00d0, 0x10, 16, 4),
479 	PIN_FIELD_BASE(45, 45, 7, 0x00e0, 0x10, 0, 4),
480 	PINS_FIELD_BASE(46, 47, 7, 0x00d0, 0x10, 28, 4),
481 	PINS_FIELD_BASE(48, 49, 7, 0x00e0, 0x10, 28, 4),
482 	PINS_FIELD_BASE(50, 51, 7, 0x00e0, 0x10, 24, 4),
483 	PINS_FIELD_BASE(52, 57, 7, 0x00d0, 0x10, 0, 4),
484 	PINS_FIELD_BASE(58, 60, 7, 0x00e0, 0x10, 16, 4),
485 	PINS_FIELD_BASE(61, 62, 3, 0x0090, 0x10, 20, 4),
486 	PINS_FIELD_BASE(63, 64, 3, 0x0090, 0x10, 16, 4),
487 	PINS_FIELD_BASE(65, 66, 3, 0x0090, 0x10, 28, 4),
488 	PINS_FIELD_BASE(67, 68, 3, 0x0090, 0x10, 24, 4),
489 	PINS_FIELD_BASE(69, 73, 3, 0x0090, 0x10, 4, 4),
490 	PINS_FIELD_BASE(74, 78, 3, 0x0090, 0x10, 8, 4),
491 	PINS_FIELD_BASE(79, 80, 3, 0x0090, 0x10, 0, 4),
492 	PIN_FIELD_BASE(81, 81, 3, 0x00a0, 0x10, 8, 4),
493 	PINS_FIELD_BASE(82, 83, 3, 0x00a0, 0x10, 4, 4),
494 	PIN_FIELD_BASE(84, 84, 3, 0x00a0, 0x10, 8, 4),
495 	PIN_FIELD_BASE(85, 85, 7, 0x00e0, 0x10, 16, 4),
496 	PIN_FIELD_BASE(86, 86, 7, 0x00e0, 0x10, 20, 4),
497 	PIN_FIELD_BASE(87, 87, 7, 0x00d0, 0x10, 8, 4),
498 	PIN_FIELD_BASE(88, 88, 7, 0x00d0, 0x10, 4, 4),
499 	PIN_FIELD_BASE(89, 89, 2, 0x00d0, 0x10, 12, 4),
500 	PIN_FIELD_BASE(90, 90, 3, 0x00a0, 0x10, 0, 4),
501 	PINS_FIELD_BASE(91, 92, 2, 0x00d0, 0x10, 0, 4),
502 	PINS_FIELD_BASE(93, 94, 2, 0x00c0, 0x10, 28, 4),
503 	PINS_FIELD_BASE(95, 96, 2, 0x00d0, 0x10, 16, 4),
504 	PINS_FIELD_BASE(97, 98, 2, 0x00c0, 0x10, 8, 4),
505 	PIN_FIELD_BASE(99, 99, 2, 0x00c0, 0x10, 0, 4),
506 	PIN_FIELD_BASE(100, 100, 2, 0x00c0, 0x10, 4, 4),
507 	PINS_FIELD_BASE(101, 102, 2, 0x00c0, 0x10, 12, 4),
508 	PINS_FIELD_BASE(103, 104, 2, 0x00d0, 0x10, 4, 4),
509 	PINS_FIELD_BASE(105, 106, 2, 0x00d0, 0x10, 8, 4),
510 	PIN_FIELD_BASE(107, 107, 1, 0x0090, 0x10, 16, 4),
511 	PIN_FIELD_BASE(108, 108, 1, 0x0090, 0x10, 12, 4),
512 	PIN_FIELD_BASE(109, 109, 1, 0x0090, 0x10, 20, 4),
513 	PIN_FIELD_BASE(110, 110, 1, 0x0090, 0x10, 0, 4),
514 	PIN_FIELD_BASE(111, 111, 1, 0x0090, 0x10, 4, 4),
515 	PIN_FIELD_BASE(112, 112, 1, 0x0090, 0x10, 8, 4),
516 	PIN_FIELD_BASE(113, 113, 1, 0x00a0, 0x10, 4, 4),
517 	PIN_FIELD_BASE(114, 114, 1, 0x00a0, 0x10, 8, 4),
518 	PIN_FIELD_BASE(115, 115, 1, 0x0090, 0x10, 24, 4),
519 	PIN_FIELD_BASE(116, 116, 1, 0x0090, 0x10, 28, 4),
520 	PIN_FIELD_BASE(117, 117, 1, 0x00a0, 0x10, 16, 4),
521 	PIN_FIELD_BASE(118, 118, 1, 0x00a0, 0x10, 20, 4),
522 	PIN_FIELD_BASE(119, 119, 1, 0x00a0, 0x10, 24, 4),
523 	PIN_FIELD_BASE(120, 120, 1, 0x00a0, 0x10, 12, 4),
524 	PIN_FIELD_BASE(121, 121, 1, 0x00a0, 0x10, 0, 4),
525 	PIN_FIELD_BASE(122, 122, 4, 0x0090, 0x10, 8, 4),
526 	PIN_FIELD_BASE(123, 123, 4, 0x0090, 0x10, 12, 4),
527 	PIN_FIELD_BASE(124, 124, 4, 0x0090, 0x10, 4, 4),
528 	PINS_FIELD_BASE(125, 130, 4, 0x0090, 0x10, 12, 4),
529 	PIN_FIELD_BASE(131, 131, 4, 0x0090, 0x10, 16, 4),
530 	PIN_FIELD_BASE(132, 132, 4, 0x0090, 0x10, 12, 4),
531 	PIN_FIELD_BASE(133, 133, 4, 0x0090, 0x10, 20, 4),
532 	PIN_FIELD_BASE(134, 134, 5, 0x0080, 0x10, 12, 4),
533 	PIN_FIELD_BASE(135, 135, 5, 0x0080, 0x10, 20, 4),
534 	PIN_FIELD_BASE(136, 136, 5, 0x0070, 0x10, 4, 4),
535 	PIN_FIELD_BASE(137, 137, 5, 0x0070, 0x10, 28, 4),
536 	PIN_FIELD_BASE(138, 138, 5, 0x0070, 0x10, 16, 4),
537 	PIN_FIELD_BASE(139, 139, 5, 0x0070, 0x10, 20, 4),
538 	PIN_FIELD_BASE(140, 140, 5, 0x0070, 0x10, 0, 4),
539 	PIN_FIELD_BASE(141, 141, 5, 0x0070, 0x10, 24, 4),
540 	PIN_FIELD_BASE(142, 142, 5, 0x0070, 0x10, 8, 4),
541 	PIN_FIELD_BASE(143, 143, 5, 0x0070, 0x10, 12, 4),
542 	PINS_FIELD_BASE(144, 147, 5, 0x0080, 0x10, 8, 4),
543 	PINS_FIELD_BASE(148, 149, 5, 0x0080, 0x10, 16, 4),
544 	PINS_FIELD_BASE(150, 151, 7, 0x00e0, 0x10, 4, 4),
545 	PINS_FIELD_BASE(152, 153, 7, 0x00e0, 0x10, 8, 4),
546 	PIN_FIELD_BASE(154, 154, 7, 0x00e0, 0x10, 12, 4),
547 	PINS_FIELD_BASE(155, 158, 3, 0x00a0, 0x10, 12, 4),
548 	PIN_FIELD_BASE(159, 159, 7, 0x00e0, 0x10, 12, 4),
549 	PIN_FIELD_BASE(160, 160, 5, 0x0080, 0x10, 0, 4),
550 	PINS_FIELD_BASE(161, 162, 1, 0x00a0, 0x10, 28, 4),
551 	PINS_FIELD_BASE(163, 170, 4, 0x0090, 0x10, 0, 4),
552 	PINS_FIELD_BASE(171, 179, 7, 0x00d0, 0x10, 20, 4),
553 };
554 
555 static const struct mtk_pin_field_calc mt6765_pin_rdsel_range[] = {
556 	PINS_FIELD_BASE(0, 3, 2, 0x0090, 0x10, 8, 2),
557 	PINS_FIELD_BASE(4, 7, 2, 0x0090, 0x10, 10, 2),
558 	PIN_FIELD_BASE(8, 8, 3, 0x0060, 0x10, 6, 2),
559 	PINS_FIELD_BASE(9, 11, 2, 0x0090, 0x10, 12, 2),
560 	PIN_FIELD_BASE(12, 12, 5, 0x0050, 0x10, 18, 2),
561 	PINS_FIELD_BASE(13, 16, 6, 0x00a0, 0x10, 18, 2),
562 	PINS_FIELD_BASE(17, 20, 6, 0x00a0, 0x10, 14, 2),
563 	PINS_FIELD_BASE(21, 24, 6, 0x00a0, 0x10, 16, 2),
564 	PINS_FIELD_BASE(25, 28, 6, 0x00a0, 0x10, 12, 2),
565 	PIN_FIELD_BASE(29, 29, 6, 0x0090, 0x10, 0, 6),
566 	PIN_FIELD_BASE(30, 30, 6, 0x0090, 0x10, 6, 6),
567 	PINS_FIELD_BASE(31, 34, 6, 0x0090, 0x10, 12, 6),
568 	PINS_FIELD_BASE(35, 36, 6, 0x00a0, 0x10, 0, 6),
569 	PIN_FIELD_BASE(37, 37, 6, 0x00a0, 0x10, 6, 6),
570 	PIN_FIELD_BASE(38, 38, 6, 0x0090, 0x10, 24, 6),
571 	PINS_FIELD_BASE(39, 40, 6, 0x0090, 0x10, 18, 6),
572 	PINS_FIELD_BASE(41, 42, 7, 0x00a0, 0x10, 12, 2),
573 	PIN_FIELD_BASE(43, 43, 7, 0x00a0, 0x10, 6, 2),
574 	PIN_FIELD_BASE(44, 44, 7, 0x00a0, 0x10, 8, 2),
575 	PIN_FIELD_BASE(45, 45, 7, 0x00a0, 0x10, 16, 2),
576 	PINS_FIELD_BASE(46, 47, 7, 0x00a0, 0x10, 14, 2),
577 	PINS_FIELD_BASE(48, 49, 7, 0x00a0, 0x10, 30, 2),
578 	PINS_FIELD_BASE(50, 51, 7, 0x00a0, 0x10, 28, 2),
579 	PINS_FIELD_BASE(52, 57, 7, 0x00a0, 0x10, 0, 2),
580 	PINS_FIELD_BASE(58, 60, 7, 0x00a0, 0x10, 24, 2),
581 	PINS_FIELD_BASE(61, 62, 3, 0x0060, 0x10, 10, 2),
582 	PINS_FIELD_BASE(63, 64, 3, 0x0060, 0x10, 8, 2),
583 	PINS_FIELD_BASE(65, 66, 3, 0x0060, 0x10, 14, 2),
584 	PINS_FIELD_BASE(67, 68, 3, 0x0060, 0x10, 12, 2),
585 	PINS_FIELD_BASE(69, 73, 3, 0x0060, 0x10, 2, 2),
586 	PINS_FIELD_BASE(74, 78, 3, 0x0060, 0x10, 4, 2),
587 	PINS_FIELD_BASE(79, 80, 3, 0x0060, 0x10, 0, 2),
588 	PIN_FIELD_BASE(81, 81, 3, 0x0060, 0x10, 20, 2),
589 	PINS_FIELD_BASE(82, 83, 3, 0x0060, 0x10, 18, 2),
590 	PIN_FIELD_BASE(84, 84, 3, 0x0060, 0x10, 20, 2),
591 	PIN_FIELD_BASE(85, 85, 7, 0x00a0, 0x10, 24, 2),
592 	PIN_FIELD_BASE(86, 86, 7, 0x00a0, 0x10, 26, 2),
593 	PIN_FIELD_BASE(87, 87, 7, 0x00a0, 0x10, 4, 2),
594 	PIN_FIELD_BASE(88, 88, 7, 0x00a0, 0x10, 2, 2),
595 	PIN_FIELD_BASE(89, 89, 2, 0x0090, 0x10, 22, 2),
596 	PIN_FIELD_BASE(90, 90, 3, 0x0060, 0x10, 16, 2),
597 	PINS_FIELD_BASE(91, 92, 2, 0x0090, 0x10, 16, 2),
598 	PINS_FIELD_BASE(93, 94, 2, 0x0090, 0x10, 14, 2),
599 	PINS_FIELD_BASE(95, 96, 2, 0x0090, 0x10, 24, 2),
600 	PINS_FIELD_BASE(97, 98, 2, 0x0090, 0x10, 4, 2),
601 	PIN_FIELD_BASE(99, 99, 2, 0x0090, 0x10, 0, 2),
602 	PIN_FIELD_BASE(100, 100, 2, 0x0090, 0x10, 2, 2),
603 	PINS_FIELD_BASE(101, 102, 2, 0x0090, 0x10, 6, 2),
604 	PINS_FIELD_BASE(103, 104, 2, 0x0090, 0x10, 18, 2),
605 	PINS_FIELD_BASE(105, 106, 2, 0x0090, 0x10, 20, 2),
606 	PIN_FIELD_BASE(107, 107, 1, 0x0060, 0x10, 8, 2),
607 	PIN_FIELD_BASE(108, 108, 1, 0x0060, 0x10, 6, 2),
608 	PIN_FIELD_BASE(109, 109, 1, 0x0060, 0x10, 10, 2),
609 	PIN_FIELD_BASE(110, 110, 1, 0x0060, 0x10, 0, 2),
610 	PIN_FIELD_BASE(111, 111, 1, 0x0060, 0x10, 2, 2),
611 	PIN_FIELD_BASE(112, 112, 1, 0x0060, 0x10, 4, 2),
612 	PIN_FIELD_BASE(113, 113, 1, 0x0060, 0x10, 18, 2),
613 	PIN_FIELD_BASE(114, 114, 1, 0x0060, 0x10, 20, 2),
614 	PIN_FIELD_BASE(115, 115, 1, 0x0060, 0x10, 12, 2),
615 	PIN_FIELD_BASE(116, 116, 1, 0x0060, 0x10, 14, 2),
616 	PIN_FIELD_BASE(117, 117, 1, 0x0060, 0x10, 24, 2),
617 	PIN_FIELD_BASE(118, 118, 1, 0x0060, 0x10, 26, 2),
618 	PIN_FIELD_BASE(119, 119, 1, 0x0060, 0x10, 28, 2),
619 	PIN_FIELD_BASE(120, 120, 1, 0x0060, 0x10, 22, 2),
620 	PIN_FIELD_BASE(121, 121, 1, 0x0060, 0x10, 16, 2),
621 	PIN_FIELD_BASE(122, 122, 4, 0x0070, 0x10, 8, 6),
622 	PIN_FIELD_BASE(123, 123, 4, 0x0070, 0x10, 14, 6),
623 	PIN_FIELD_BASE(124, 124, 4, 0x0070, 0x10, 2, 6),
624 	PINS_FIELD_BASE(125, 130, 4, 0x0070, 0x10, 14, 6),
625 	PIN_FIELD_BASE(131, 131, 4, 0x0070, 0x10, 20, 6),
626 	PIN_FIELD_BASE(132, 132, 4, 0x0070, 0x10, 14, 6),
627 	PIN_FIELD_BASE(133, 133, 4, 0x0070, 0x10, 26, 6),
628 	PIN_FIELD_BASE(134, 134, 5, 0x0050, 0x10, 22, 2),
629 	PIN_FIELD_BASE(135, 135, 5, 0x0050, 0x10, 30, 2),
630 	PIN_FIELD_BASE(136, 136, 5, 0x0050, 0x10, 2, 2),
631 	PIN_FIELD_BASE(137, 137, 5, 0x0050, 0x10, 14, 2),
632 	PIN_FIELD_BASE(138, 138, 5, 0x0050, 0x10, 8, 2),
633 	PIN_FIELD_BASE(139, 139, 5, 0x0050, 0x10, 10, 2),
634 	PIN_FIELD_BASE(140, 140, 5, 0x0050, 0x10, 0, 2),
635 	PIN_FIELD_BASE(141, 141, 5, 0x0050, 0x10, 12, 2),
636 	PIN_FIELD_BASE(142, 142, 5, 0x0050, 0x10, 4, 2),
637 	PIN_FIELD_BASE(143, 143, 5, 0x0050, 0x10, 6, 2),
638 	PINS_FIELD_BASE(144, 147, 5, 0x0050, 0x10, 20, 2),
639 	PINS_FIELD_BASE(148, 149, 5, 0x0050, 0x10, 24, 2),
640 	PINS_FIELD_BASE(150, 151, 7, 0x00a0, 0x10, 18, 2),
641 	PINS_FIELD_BASE(152, 153, 7, 0x00a0, 0x10, 20, 2),
642 	PIN_FIELD_BASE(154, 154, 7, 0x00a0, 0x10, 22, 2),
643 	PINS_FIELD_BASE(155, 158, 3, 0x0060, 0x10, 22, 2),
644 	PIN_FIELD_BASE(159, 159, 7, 0x00a0, 0x10, 22, 2),
645 	PIN_FIELD_BASE(160, 160, 5, 0x0050, 0x10, 16, 2),
646 	PINS_FIELD_BASE(161, 162, 1, 0x0060, 0x10, 30, 2),
647 	PINS_FIELD_BASE(163, 170, 4, 0x0070, 0x10, 0, 2),
648 	PINS_FIELD_BASE(171, 179, 7, 0x00a0, 0x10, 10, 2),
649 };
650 
651 static const struct mtk_pin_field_calc mt6765_pin_drv_range[] = {
652 	PINS_FIELD_BASE(0, 2, 2, 0x0000, 0x10, 12, 3),
653 	PIN_FIELD_BASE(3, 3, 2, 0x0000, 0x10, 15, 3),
654 	PINS_FIELD_BASE(4, 6, 2, 0x0000, 0x10, 18, 3),
655 	PIN_FIELD_BASE(7, 7, 2, 0x0000, 0x10, 21, 3),
656 	PIN_FIELD_BASE(8, 8, 3, 0x0000, 0x10, 9, 3),
657 	PINS_FIELD_BASE(9, 11, 2, 0x0000, 0x10, 24, 3),
658 	PIN_FIELD_BASE(12, 12, 5, 0x0000, 0x10, 27, 3),
659 	PINS_FIELD_BASE(13, 15, 6, 0x0010, 0x10, 3, 3),
660 	PIN_FIELD_BASE(16, 16, 6, 0x0010, 0x10, 6, 3),
661 	PIN_FIELD_BASE(17, 17, 6, 0x0000, 0x10, 23, 3),
662 	PIN_FIELD_BASE(18, 18, 6, 0x0000, 0x10, 26, 3),
663 	PINS_FIELD_BASE(19, 20, 6, 0x0000, 0x10, 23, 3),
664 	PINS_FIELD_BASE(21, 23, 6, 0x0000, 0x10, 29, 3),
665 	PIN_FIELD_BASE(24, 24, 6, 0x0010, 0x10, 0, 3),
666 	PINS_FIELD_BASE(25, 27, 6, 0x0000, 0x10, 17, 3),
667 	PIN_FIELD_BASE(28, 28, 6, 0x0000, 0x10, 20, 3),
668 	PIN_FIELD_BASE(29, 29, 6, 0x0000, 0x10, 0, 3),
669 	PIN_FIELD_BASE(30, 30, 6, 0x0000, 0x10, 3, 3),
670 	PINS_FIELD_BASE(31, 34, 6, 0x0000, 0x10, 6, 3),
671 	PINS_FIELD_BASE(35, 36, 6, 0x0000, 0x10, 13, 2),
672 	PIN_FIELD_BASE(37, 37, 6, 0x0000, 0x10, 15, 2),
673 	PIN_FIELD_BASE(38, 38, 6, 0x0000, 0x10, 11, 2),
674 	PINS_FIELD_BASE(39, 40, 6, 0x0000, 0x10, 9, 2),
675 	PINS_FIELD_BASE(41, 42, 7, 0x0000, 0x10, 21, 3),
676 	PIN_FIELD_BASE(43, 43, 7, 0x0000, 0x10, 9, 3),
677 	PIN_FIELD_BASE(44, 44, 7, 0x0000, 0x10, 12, 3),
678 	PIN_FIELD_BASE(45, 45, 7, 0x0000, 0x10, 27, 3),
679 	PINS_FIELD_BASE(46, 47, 7, 0x0000, 0x10, 24, 3),
680 	PINS_FIELD_BASE(48, 49, 7, 0x0010, 0x10, 18, 3),
681 	PINS_FIELD_BASE(50, 51, 7, 0x0010, 0x10, 15, 3),
682 	PINS_FIELD_BASE(52, 57, 7, 0x0000, 0x10, 0, 3),
683 	PINS_FIELD_BASE(58, 60, 7, 0x0010, 0x10, 9, 3),
684 	PINS_FIELD_BASE(61, 62, 3, 0x0000, 0x10, 15, 3),
685 	PINS_FIELD_BASE(63, 64, 3, 0x0000, 0x10, 12, 3),
686 	PINS_FIELD_BASE(65, 66, 3, 0x0000, 0x10, 21, 3),
687 	PINS_FIELD_BASE(67, 68, 3, 0x0000, 0x10, 18, 3),
688 	PINS_FIELD_BASE(69, 73, 3, 0x0000, 0x10, 3, 3),
689 	PINS_FIELD_BASE(74, 78, 3, 0x0000, 0x10, 6, 3),
690 	PINS_FIELD_BASE(79, 80, 3, 0x0000, 0x10, 0, 3),
691 	PIN_FIELD_BASE(81, 81, 3, 0x0010, 0x10, 0, 3),
692 	PINS_FIELD_BASE(82, 83, 3, 0x0000, 0x10, 27, 3),
693 	PIN_FIELD_BASE(84, 84, 3, 0x0010, 0x10, 0, 3),
694 	PIN_FIELD_BASE(85, 85, 7, 0x0010, 0x10, 9, 3),
695 	PIN_FIELD_BASE(86, 86, 7, 0x0010, 0x10, 12, 3),
696 	PIN_FIELD_BASE(87, 87, 7, 0x0000, 0x10, 6, 3),
697 	PIN_FIELD_BASE(88, 88, 7, 0x0000, 0x10, 3, 3),
698 	PIN_FIELD_BASE(89, 89, 2, 0x0010, 0x10, 15, 3),
699 	PIN_FIELD_BASE(90, 90, 3, 0x0000, 0x10, 24, 3),
700 	PIN_FIELD_BASE(91, 91, 2, 0x0010, 0x10, 6, 3),
701 	PIN_FIELD_BASE(92, 92, 2, 0x0010, 0x10, 3, 3),
702 	PIN_FIELD_BASE(93, 93, 2, 0x0000, 0x10, 27, 3),
703 	PIN_FIELD_BASE(94, 94, 2, 0x0010, 0x10, 0, 3),
704 	PINS_FIELD_BASE(95, 96, 2, 0x0010, 0x10, 18, 3),
705 	PINS_FIELD_BASE(97, 98, 2, 0x0000, 0x10, 6, 3),
706 	PIN_FIELD_BASE(99, 99, 2, 0x0000, 0x10, 0, 3),
707 	PIN_FIELD_BASE(100, 100, 2, 0x0000, 0x10, 3, 3),
708 	PINS_FIELD_BASE(101, 102, 2, 0x0000, 0x10, 9, 3),
709 	PINS_FIELD_BASE(103, 104, 2, 0x0010, 0x10, 9, 3),
710 	PINS_FIELD_BASE(105, 106, 2, 0x0010, 0x10, 12, 3),
711 	PIN_FIELD_BASE(107, 107, 1, 0x0000, 0x10, 12, 3),
712 	PIN_FIELD_BASE(108, 108, 1, 0x0000, 0x10, 9, 3),
713 	PIN_FIELD_BASE(109, 109, 1, 0x0000, 0x10, 15, 3),
714 	PIN_FIELD_BASE(110, 110, 1, 0x0000, 0x10, 0, 3),
715 	PIN_FIELD_BASE(111, 111, 1, 0x0000, 0x10, 3, 3),
716 	PIN_FIELD_BASE(112, 112, 1, 0x0000, 0x10, 6, 3),
717 	PIN_FIELD_BASE(113, 113, 1, 0x0000, 0x10, 27, 3),
718 	PIN_FIELD_BASE(114, 114, 1, 0x0010, 0x10, 0, 3),
719 	PIN_FIELD_BASE(115, 115, 1, 0x0000, 0x10, 18, 3),
720 	PIN_FIELD_BASE(116, 116, 1, 0x0000, 0x10, 21, 3),
721 	PIN_FIELD_BASE(117, 117, 1, 0x0010, 0x10, 6, 3),
722 	PIN_FIELD_BASE(118, 118, 1, 0x0010, 0x10, 9, 3),
723 	PIN_FIELD_BASE(119, 119, 1, 0x0010, 0x10, 12, 3),
724 	PIN_FIELD_BASE(120, 120, 1, 0x0010, 0x10, 3, 3),
725 	PIN_FIELD_BASE(121, 121, 1, 0x0000, 0x10, 24, 3),
726 	PIN_FIELD_BASE(122, 122, 4, 0x0000, 0x10, 9, 3),
727 	PIN_FIELD_BASE(123, 123, 4, 0x0000, 0x10, 12, 3),
728 	PIN_FIELD_BASE(124, 124, 4, 0x0000, 0x10, 6, 3),
729 	PINS_FIELD_BASE(125, 130, 4, 0x0000, 0x10, 12, 3),
730 	PIN_FIELD_BASE(131, 131, 4, 0x0000, 0x10, 15, 3),
731 	PIN_FIELD_BASE(132, 132, 4, 0x0000, 0x10, 12, 3),
732 	PIN_FIELD_BASE(133, 133, 4, 0x0000, 0x10, 18, 3),
733 	PIN_FIELD_BASE(134, 134, 5, 0x0010, 0x10, 6, 3),
734 	PIN_FIELD_BASE(135, 135, 5, 0x0010, 0x10, 12, 3),
735 	PIN_FIELD_BASE(136, 136, 5, 0x0000, 0x10, 3, 3),
736 	PIN_FIELD_BASE(137, 137, 5, 0x0000, 0x10, 21, 3),
737 	PIN_FIELD_BASE(138, 138, 5, 0x0000, 0x10, 12, 3),
738 	PIN_FIELD_BASE(139, 139, 5, 0x0000, 0x10, 15, 3),
739 	PIN_FIELD_BASE(140, 140, 5, 0x0000, 0x10, 0, 3),
740 	PIN_FIELD_BASE(141, 141, 5, 0x0000, 0x10, 18, 3),
741 	PIN_FIELD_BASE(142, 142, 5, 0x0000, 0x10, 6, 3),
742 	PIN_FIELD_BASE(143, 143, 5, 0x0000, 0x10, 9, 3),
743 	PINS_FIELD_BASE(144, 146, 5, 0x0010, 0x10, 0, 3),
744 	PIN_FIELD_BASE(147, 147, 5, 0x0010, 0x10, 3, 3),
745 	PINS_FIELD_BASE(148, 149, 5, 0x0010, 0x10, 9, 3),
746 	PINS_FIELD_BASE(150, 151, 7, 0x0010, 0x10, 0, 3),
747 	PINS_FIELD_BASE(152, 153, 7, 0x0010, 0x10, 3, 3),
748 	PIN_FIELD_BASE(154, 154, 7, 0x0010, 0x10, 6, 3),
749 	PINS_FIELD_BASE(155, 157, 3, 0x0010, 0x10, 3, 3),
750 	PIN_FIELD_BASE(158, 158, 3, 0x0010, 0x10, 6, 3),
751 	PIN_FIELD_BASE(159, 159, 7, 0x0010, 0x10, 6, 3),
752 	PIN_FIELD_BASE(160, 160, 5, 0x0000, 0x10, 24, 3),
753 	PINS_FIELD_BASE(161, 162, 1, 0x0010, 0x10, 15, 3),
754 	PINS_FIELD_BASE(163, 166, 4, 0x0000, 0x10, 0, 3),
755 	PINS_FIELD_BASE(167, 170, 4, 0x0000, 0x10, 3, 3),
756 	PINS_FIELD_BASE(171, 174, 7, 0x0000, 0x10, 18, 3),
757 	PINS_FIELD_BASE(175, 179, 7, 0x0000, 0x10, 15, 3),
758 };
759 
760 static const struct mtk_pin_field_calc mt6765_pin_pupd_range[] = {
761 	PINS_FIELD_BASE(0, 28, 0, 0x0050, 0x10, 18, 1),
762 	PIN_FIELD_BASE(29, 29, 6, 0x0050, 0x10, 0, 1),
763 	PIN_FIELD_BASE(30, 30, 6, 0x0050, 0x10, 1, 1),
764 	PIN_FIELD_BASE(31, 31, 6, 0x0050, 0x10, 5, 1),
765 	PIN_FIELD_BASE(32, 32, 6, 0x0050, 0x10, 2, 1),
766 	PIN_FIELD_BASE(33, 33, 6, 0x0050, 0x10, 4, 1),
767 	PIN_FIELD_BASE(34, 34, 6, 0x0050, 0x10, 3, 1),
768 	PIN_FIELD_BASE(35, 35, 6, 0x0050, 0x10, 10, 1),
769 	PIN_FIELD_BASE(36, 36, 6, 0x0050, 0x10, 11, 1),
770 	PIN_FIELD_BASE(37, 37, 6, 0x0050, 0x10, 9, 1),
771 	PIN_FIELD_BASE(38, 38, 6, 0x0050, 0x10, 6, 1),
772 	PIN_FIELD_BASE(39, 39, 6, 0x0050, 0x10, 8, 1),
773 	PINS_FIELD_BASE(40, 90, 6, 0x0050, 0x10, 7, 1),
774 	PIN_FIELD_BASE(91, 91, 2, 0x0050, 0x10, 3, 1),
775 	PIN_FIELD_BASE(92, 92, 2, 0x0050, 0x10, 2, 1),
776 	PIN_FIELD_BASE(93, 93, 2, 0x0050, 0x10, 0, 1),
777 	PINS_FIELD_BASE(94, 121, 2, 0x0050, 0x10, 1, 1),
778 	PIN_FIELD_BASE(122, 122, 4, 0x0030, 0x10, 1, 1),
779 	PIN_FIELD_BASE(123, 123, 4, 0x0030, 0x10, 2, 1),
780 	PIN_FIELD_BASE(124, 124, 4, 0x0030, 0x10, 0, 1),
781 	PIN_FIELD_BASE(125, 125, 4, 0x0030, 0x10, 4, 1),
782 	PIN_FIELD_BASE(126, 126, 4, 0x0030, 0x10, 6, 1),
783 	PIN_FIELD_BASE(127, 127, 4, 0x0030, 0x10, 8, 1),
784 	PIN_FIELD_BASE(128, 128, 4, 0x0030, 0x10, 3, 1),
785 	PIN_FIELD_BASE(129, 129, 4, 0x0030, 0x10, 7, 1),
786 	PIN_FIELD_BASE(130, 130, 4, 0x0030, 0x10, 9, 1),
787 	PIN_FIELD_BASE(131, 131, 4, 0x0030, 0x10, 10, 1),
788 	PIN_FIELD_BASE(132, 132, 4, 0x0030, 0x10, 5, 1),
789 	PINS_FIELD_BASE(133, 179, 4, 0x0030, 0x10, 11, 1),
790 };
791 
792 static const struct mtk_pin_field_calc mt6765_pin_r0_range[] = {
793 	PINS_FIELD_BASE(0, 28, 4, 0x0030, 0x10, 11, 1),
794 	PIN_FIELD_BASE(29, 29, 6, 0x0070, 0x10, 0, 1),
795 	PIN_FIELD_BASE(30, 30, 6, 0x0070, 0x10, 1, 1),
796 	PIN_FIELD_BASE(31, 31, 6, 0x0070, 0x10, 5, 1),
797 	PIN_FIELD_BASE(32, 32, 6, 0x0070, 0x10, 2, 1),
798 	PIN_FIELD_BASE(33, 33, 6, 0x0070, 0x10, 4, 1),
799 	PIN_FIELD_BASE(34, 34, 6, 0x0070, 0x10, 3, 1),
800 	PIN_FIELD_BASE(35, 35, 6, 0x0070, 0x10, 10, 1),
801 	PIN_FIELD_BASE(36, 36, 6, 0x0070, 0x10, 11, 1),
802 	PIN_FIELD_BASE(37, 37, 6, 0x0070, 0x10, 9, 1),
803 	PIN_FIELD_BASE(38, 38, 6, 0x0070, 0x10, 6, 1),
804 	PIN_FIELD_BASE(39, 39, 6, 0x0070, 0x10, 8, 1),
805 	PINS_FIELD_BASE(40, 90, 6, 0x0070, 0x10, 7, 1),
806 	PIN_FIELD_BASE(91, 91, 2, 0x0070, 0x10, 3, 1),
807 	PIN_FIELD_BASE(92, 92, 2, 0x0070, 0x10, 2, 1),
808 	PIN_FIELD_BASE(93, 93, 2, 0x0070, 0x10, 0, 1),
809 	PINS_FIELD_BASE(94, 121, 2, 0x0070, 0x10, 1, 1),
810 	PIN_FIELD_BASE(122, 122, 4, 0x0050, 0x10, 1, 1),
811 	PIN_FIELD_BASE(123, 123, 4, 0x0050, 0x10, 2, 1),
812 	PIN_FIELD_BASE(124, 124, 4, 0x0050, 0x10, 0, 1),
813 	PIN_FIELD_BASE(125, 125, 4, 0x0050, 0x10, 4, 1),
814 	PIN_FIELD_BASE(126, 126, 4, 0x0050, 0x10, 6, 1),
815 	PIN_FIELD_BASE(127, 127, 4, 0x0050, 0x10, 8, 1),
816 	PIN_FIELD_BASE(128, 128, 4, 0x0050, 0x10, 3, 1),
817 	PIN_FIELD_BASE(129, 129, 4, 0x0050, 0x10, 7, 1),
818 	PIN_FIELD_BASE(130, 130, 4, 0x0050, 0x10, 9, 1),
819 	PIN_FIELD_BASE(131, 131, 4, 0x0050, 0x10, 10, 1),
820 	PIN_FIELD_BASE(132, 132, 4, 0x0050, 0x10, 5, 1),
821 	PINS_FIELD_BASE(133, 179, 4, 0x0050, 0x10, 11, 1),
822 };
823 
824 static const struct mtk_pin_field_calc mt6765_pin_r1_range[] = {
825 	PINS_FIELD_BASE(0, 28, 4, 0x0050, 0x10, 11, 1),
826 	PIN_FIELD_BASE(29, 29, 6, 0x0080, 0x10, 0, 1),
827 	PIN_FIELD_BASE(30, 30, 6, 0x0080, 0x10, 1, 1),
828 	PIN_FIELD_BASE(31, 31, 6, 0x0080, 0x10, 5, 1),
829 	PIN_FIELD_BASE(32, 32, 6, 0x0080, 0x10, 2, 1),
830 	PIN_FIELD_BASE(33, 33, 6, 0x0080, 0x10, 4, 1),
831 	PIN_FIELD_BASE(34, 34, 6, 0x0080, 0x10, 3, 1),
832 	PIN_FIELD_BASE(35, 35, 6, 0x0080, 0x10, 10, 1),
833 	PIN_FIELD_BASE(36, 36, 6, 0x0080, 0x10, 11, 1),
834 	PIN_FIELD_BASE(37, 37, 6, 0x0080, 0x10, 9, 1),
835 	PIN_FIELD_BASE(38, 38, 6, 0x0080, 0x10, 6, 1),
836 	PIN_FIELD_BASE(39, 39, 6, 0x0080, 0x10, 8, 1),
837 	PINS_FIELD_BASE(40, 90, 6, 0x0080, 0x10, 7, 1),
838 	PIN_FIELD_BASE(91, 91, 2, 0x0080, 0x10, 3, 1),
839 	PIN_FIELD_BASE(92, 92, 2, 0x0080, 0x10, 2, 1),
840 	PIN_FIELD_BASE(93, 93, 2, 0x0080, 0x10, 0, 1),
841 	PINS_FIELD_BASE(94, 121, 2, 0x0080, 0x10, 1, 1),
842 	PIN_FIELD_BASE(122, 122, 4, 0x0060, 0x10, 1, 1),
843 	PIN_FIELD_BASE(123, 123, 4, 0x0060, 0x10, 2, 1),
844 	PIN_FIELD_BASE(124, 124, 4, 0x0060, 0x10, 0, 1),
845 	PIN_FIELD_BASE(125, 125, 4, 0x0060, 0x10, 4, 1),
846 	PIN_FIELD_BASE(126, 126, 4, 0x0060, 0x10, 6, 1),
847 	PIN_FIELD_BASE(127, 127, 4, 0x0060, 0x10, 8, 1),
848 	PIN_FIELD_BASE(128, 128, 4, 0x0060, 0x10, 3, 1),
849 	PIN_FIELD_BASE(129, 129, 4, 0x0060, 0x10, 7, 1),
850 	PIN_FIELD_BASE(130, 130, 4, 0x0060, 0x10, 9, 1),
851 	PIN_FIELD_BASE(131, 131, 4, 0x0060, 0x10, 10, 1),
852 	PIN_FIELD_BASE(132, 132, 4, 0x0060, 0x10, 5, 1),
853 	PINS_FIELD_BASE(133, 179, 4, 0x0060, 0x10, 11, 1),
854 };
855 
856 static const struct mtk_pin_field_calc mt6765_pin_ies_range[] = {
857 	PIN_FIELD_BASE(0, 0, 2, 0x0030, 0x10, 6, 1),
858 	PIN_FIELD_BASE(1, 1, 2, 0x0030, 0x10, 7, 1),
859 	PIN_FIELD_BASE(2, 2, 2, 0x0030, 0x10, 10, 1),
860 	PIN_FIELD_BASE(3, 3, 2, 0x0030, 0x10, 11, 1),
861 	PIN_FIELD_BASE(4, 4, 2, 0x0030, 0x10, 12, 1),
862 	PIN_FIELD_BASE(5, 5, 2, 0x0030, 0x10, 13, 1),
863 	PIN_FIELD_BASE(6, 6, 2, 0x0030, 0x10, 14, 1),
864 	PIN_FIELD_BASE(7, 7, 2, 0x0030, 0x10, 15, 1),
865 	PIN_FIELD_BASE(8, 8, 3, 0x0030, 0x10, 12, 1),
866 	PIN_FIELD_BASE(9, 9, 2, 0x0030, 0x10, 16, 1),
867 	PIN_FIELD_BASE(10, 10, 2, 0x0030, 0x10, 8, 1),
868 	PIN_FIELD_BASE(11, 11, 2, 0x0030, 0x10, 9, 1),
869 	PIN_FIELD_BASE(12, 12, 5, 0x0020, 0x10, 9, 1),
870 	PIN_FIELD_BASE(13, 13, 6, 0x0020, 0x10, 26, 1),
871 	PIN_FIELD_BASE(14, 14, 6, 0x0020, 0x10, 25, 1),
872 	PIN_FIELD_BASE(15, 15, 6, 0x0020, 0x10, 27, 1),
873 	PIN_FIELD_BASE(16, 16, 6, 0x0020, 0x10, 24, 1),
874 	PIN_FIELD_BASE(17, 17, 6, 0x0020, 0x10, 19, 1),
875 	PIN_FIELD_BASE(18, 18, 6, 0x0020, 0x10, 16, 1),
876 	PIN_FIELD_BASE(19, 19, 6, 0x0020, 0x10, 18, 1),
877 	PIN_FIELD_BASE(20, 20, 6, 0x0020, 0x10, 17, 1),
878 	PIN_FIELD_BASE(21, 21, 6, 0x0020, 0x10, 22, 1),
879 	PIN_FIELD_BASE(22, 22, 6, 0x0020, 0x10, 21, 1),
880 	PIN_FIELD_BASE(23, 23, 6, 0x0020, 0x10, 23, 1),
881 	PIN_FIELD_BASE(24, 24, 6, 0x0020, 0x10, 20, 1),
882 	PIN_FIELD_BASE(25, 25, 6, 0x0020, 0x10, 14, 1),
883 	PIN_FIELD_BASE(26, 26, 6, 0x0020, 0x10, 13, 1),
884 	PIN_FIELD_BASE(27, 27, 6, 0x0020, 0x10, 15, 1),
885 	PIN_FIELD_BASE(28, 28, 6, 0x0020, 0x10, 12, 1),
886 	PIN_FIELD_BASE(29, 29, 6, 0x0020, 0x10, 0, 1),
887 	PIN_FIELD_BASE(30, 30, 6, 0x0020, 0x10, 1, 1),
888 	PIN_FIELD_BASE(31, 31, 6, 0x0020, 0x10, 5, 1),
889 	PIN_FIELD_BASE(32, 32, 6, 0x0020, 0x10, 2, 1),
890 	PIN_FIELD_BASE(33, 33, 6, 0x0020, 0x10, 4, 1),
891 	PIN_FIELD_BASE(34, 34, 6, 0x0020, 0x10, 3, 1),
892 	PIN_FIELD_BASE(35, 35, 6, 0x0020, 0x10, 10, 1),
893 	PIN_FIELD_BASE(36, 36, 6, 0x0020, 0x10, 11, 1),
894 	PIN_FIELD_BASE(37, 37, 6, 0x0020, 0x10, 9, 1),
895 	PIN_FIELD_BASE(38, 38, 6, 0x0020, 0x10, 6, 1),
896 	PIN_FIELD_BASE(39, 39, 6, 0x0020, 0x10, 8, 1),
897 	PIN_FIELD_BASE(40, 40, 6, 0x0020, 0x10, 7, 1),
898 	PIN_FIELD_BASE(41, 41, 7, 0x0040, 0x10, 19, 1),
899 	PIN_FIELD_BASE(42, 42, 7, 0x0040, 0x10, 9, 1),
900 	PIN_FIELD_BASE(43, 43, 7, 0x0040, 0x10, 8, 1),
901 	PIN_FIELD_BASE(44, 44, 7, 0x0040, 0x10, 10, 1),
902 	PIN_FIELD_BASE(45, 45, 7, 0x0040, 0x10, 22, 1),
903 	PIN_FIELD_BASE(46, 46, 7, 0x0040, 0x10, 21, 1),
904 	PIN_FIELD_BASE(47, 47, 7, 0x0040, 0x10, 20, 1),
905 	PIN_FIELD_BASE(48, 48, 7, 0x0050, 0x10, 3, 1),
906 	PIN_FIELD_BASE(49, 49, 7, 0x0050, 0x10, 5, 1),
907 	PIN_FIELD_BASE(50, 50, 7, 0x0050, 0x10, 2, 1),
908 	PIN_FIELD_BASE(51, 51, 7, 0x0050, 0x10, 4, 1),
909 	PIN_FIELD_BASE(52, 52, 7, 0x0040, 0x10, 1, 1),
910 	PIN_FIELD_BASE(53, 53, 7, 0x0040, 0x10, 0, 1),
911 	PIN_FIELD_BASE(54, 54, 7, 0x0040, 0x10, 5, 1),
912 	PIN_FIELD_BASE(55, 55, 7, 0x0040, 0x10, 3, 1),
913 	PIN_FIELD_BASE(56, 56, 7, 0x0040, 0x10, 4, 1),
914 	PIN_FIELD_BASE(57, 57, 7, 0x0040, 0x10, 2, 1),
915 	PIN_FIELD_BASE(58, 58, 7, 0x0050, 0x10, 0, 1),
916 	PIN_FIELD_BASE(59, 59, 7, 0x0040, 0x10, 31, 1),
917 	PIN_FIELD_BASE(60, 60, 7, 0x0040, 0x10, 30, 1),
918 	PIN_FIELD_BASE(61, 61, 3, 0x0030, 0x10, 18, 1),
919 	PIN_FIELD_BASE(62, 62, 3, 0x0030, 0x10, 14, 1),
920 	PIN_FIELD_BASE(63, 63, 3, 0x0030, 0x10, 17, 1),
921 	PIN_FIELD_BASE(64, 64, 3, 0x0030, 0x10, 13, 1),
922 	PIN_FIELD_BASE(65, 65, 3, 0x0030, 0x10, 20, 1),
923 	PIN_FIELD_BASE(66, 66, 3, 0x0030, 0x10, 16, 1),
924 	PIN_FIELD_BASE(67, 67, 3, 0x0030, 0x10, 19, 1),
925 	PIN_FIELD_BASE(68, 68, 3, 0x0030, 0x10, 15, 1),
926 	PIN_FIELD_BASE(69, 69, 3, 0x0030, 0x10, 8, 1),
927 	PIN_FIELD_BASE(70, 70, 3, 0x0030, 0x10, 7, 1),
928 	PIN_FIELD_BASE(71, 71, 3, 0x0030, 0x10, 6, 1),
929 	PIN_FIELD_BASE(72, 72, 3, 0x0030, 0x10, 5, 1),
930 	PIN_FIELD_BASE(73, 73, 3, 0x0030, 0x10, 4, 1),
931 	PIN_FIELD_BASE(74, 74, 3, 0x0030, 0x10, 3, 1),
932 	PIN_FIELD_BASE(75, 75, 3, 0x0030, 0x10, 2, 1),
933 	PIN_FIELD_BASE(76, 76, 3, 0x0030, 0x10, 1, 1),
934 	PIN_FIELD_BASE(77, 77, 3, 0x0030, 0x10, 0, 1),
935 	PIN_FIELD_BASE(78, 78, 3, 0x0030, 0x10, 9, 1),
936 	PIN_FIELD_BASE(79, 79, 3, 0x0030, 0x10, 11, 1),
937 	PIN_FIELD_BASE(80, 80, 3, 0x0030, 0x10, 10, 1),
938 	PIN_FIELD_BASE(81, 81, 3, 0x0030, 0x10, 25, 1),
939 	PIN_FIELD_BASE(82, 82, 3, 0x0030, 0x10, 24, 1),
940 	PIN_FIELD_BASE(83, 83, 3, 0x0030, 0x10, 22, 1),
941 	PIN_FIELD_BASE(84, 84, 3, 0x0030, 0x10, 23, 1),
942 	PIN_FIELD_BASE(85, 85, 7, 0x0050, 0x10, 1, 1),
943 	PIN_FIELD_BASE(86, 86, 7, 0x0040, 0x10, 29, 1),
944 	PIN_FIELD_BASE(87, 87, 7, 0x0040, 0x10, 7, 1),
945 	PIN_FIELD_BASE(88, 88, 7, 0x0040, 0x10, 6, 1),
946 	PIN_FIELD_BASE(89, 89, 2, 0x0030, 0x10, 25, 1),
947 	PIN_FIELD_BASE(90, 90, 3, 0x0030, 0x10, 21, 1),
948 	PIN_FIELD_BASE(91, 91, 2, 0x0030, 0x10, 20, 1),
949 	PIN_FIELD_BASE(92, 92, 2, 0x0030, 0x10, 19, 1),
950 	PIN_FIELD_BASE(93, 93, 2, 0x0030, 0x10, 17, 1),
951 	PIN_FIELD_BASE(94, 94, 2, 0x0030, 0x10, 18, 1),
952 	PIN_FIELD_BASE(95, 95, 2, 0x0030, 0x10, 26, 1),
953 	PIN_FIELD_BASE(96, 96, 2, 0x0030, 0x10, 27, 1),
954 	PIN_FIELD_BASE(97, 97, 2, 0x0030, 0x10, 2, 1),
955 	PIN_FIELD_BASE(98, 98, 2, 0x0030, 0x10, 3, 1),
956 	PIN_FIELD_BASE(99, 99, 2, 0x0030, 0x10, 0, 1),
957 	PIN_FIELD_BASE(100, 100, 2, 0x0030, 0x10, 1, 1),
958 	PIN_FIELD_BASE(101, 101, 2, 0x0030, 0x10, 4, 1),
959 	PIN_FIELD_BASE(102, 102, 2, 0x0030, 0x10, 5, 1),
960 	PIN_FIELD_BASE(103, 103, 2, 0x0030, 0x10, 21, 1),
961 	PIN_FIELD_BASE(104, 104, 2, 0x0030, 0x10, 23, 1),
962 	PIN_FIELD_BASE(105, 105, 2, 0x0030, 0x10, 22, 1),
963 	PIN_FIELD_BASE(106, 106, 2, 0x0030, 0x10, 24, 1),
964 	PIN_FIELD_BASE(107, 107, 1, 0x0030, 0x10, 4, 1),
965 	PIN_FIELD_BASE(108, 108, 1, 0x0030, 0x10, 3, 1),
966 	PIN_FIELD_BASE(109, 109, 1, 0x0030, 0x10, 5, 1),
967 	PIN_FIELD_BASE(110, 110, 1, 0x0030, 0x10, 0, 1),
968 	PIN_FIELD_BASE(111, 111, 1, 0x0030, 0x10, 1, 1),
969 	PIN_FIELD_BASE(112, 112, 1, 0x0030, 0x10, 2, 1),
970 	PIN_FIELD_BASE(113, 113, 1, 0x0030, 0x10, 9, 1),
971 	PIN_FIELD_BASE(114, 114, 1, 0x0030, 0x10, 10, 1),
972 	PIN_FIELD_BASE(115, 115, 1, 0x0030, 0x10, 6, 1),
973 	PIN_FIELD_BASE(116, 116, 1, 0x0030, 0x10, 7, 1),
974 	PIN_FIELD_BASE(117, 117, 1, 0x0030, 0x10, 12, 1),
975 	PIN_FIELD_BASE(118, 118, 1, 0x0030, 0x10, 13, 1),
976 	PIN_FIELD_BASE(119, 119, 1, 0x0030, 0x10, 14, 1),
977 	PIN_FIELD_BASE(120, 120, 1, 0x0030, 0x10, 11, 1),
978 	PIN_FIELD_BASE(121, 121, 1, 0x0030, 0x10, 8, 1),
979 	PIN_FIELD_BASE(122, 122, 4, 0x0010, 0x10, 9, 1),
980 	PIN_FIELD_BASE(123, 123, 4, 0x0010, 0x10, 10, 1),
981 	PIN_FIELD_BASE(124, 124, 4, 0x0010, 0x10, 8, 1),
982 	PIN_FIELD_BASE(125, 125, 4, 0x0010, 0x10, 12, 1),
983 	PIN_FIELD_BASE(126, 126, 4, 0x0010, 0x10, 14, 1),
984 	PIN_FIELD_BASE(127, 127, 4, 0x0010, 0x10, 16, 1),
985 	PIN_FIELD_BASE(128, 128, 4, 0x0010, 0x10, 11, 1),
986 	PIN_FIELD_BASE(129, 129, 4, 0x0010, 0x10, 15, 1),
987 	PIN_FIELD_BASE(130, 130, 4, 0x0010, 0x10, 17, 1),
988 	PIN_FIELD_BASE(131, 131, 4, 0x0010, 0x10, 18, 1),
989 	PIN_FIELD_BASE(132, 132, 4, 0x0010, 0x10, 13, 1),
990 	PIN_FIELD_BASE(133, 133, 4, 0x0010, 0x10, 19, 1),
991 	PIN_FIELD_BASE(134, 134, 5, 0x0020, 0x10, 14, 1),
992 	PIN_FIELD_BASE(135, 135, 5, 0x0020, 0x10, 17, 1),
993 	PIN_FIELD_BASE(136, 136, 5, 0x0020, 0x10, 1, 1),
994 	PIN_FIELD_BASE(137, 137, 5, 0x0020, 0x10, 7, 1),
995 	PIN_FIELD_BASE(138, 138, 5, 0x0020, 0x10, 4, 1),
996 	PIN_FIELD_BASE(139, 139, 5, 0x0020, 0x10, 5, 1),
997 	PIN_FIELD_BASE(140, 140, 5, 0x0020, 0x10, 0, 1),
998 	PIN_FIELD_BASE(141, 141, 5, 0x0020, 0x10, 6, 1),
999 	PIN_FIELD_BASE(142, 142, 5, 0x0020, 0x10, 2, 1),
1000 	PIN_FIELD_BASE(143, 143, 5, 0x0020, 0x10, 3, 1),
1001 	PIN_FIELD_BASE(144, 144, 5, 0x0020, 0x10, 12, 1),
1002 	PIN_FIELD_BASE(145, 145, 5, 0x0020, 0x10, 11, 1),
1003 	PIN_FIELD_BASE(146, 146, 5, 0x0020, 0x10, 13, 1),
1004 	PIN_FIELD_BASE(147, 147, 5, 0x0020, 0x10, 10, 1),
1005 	PIN_FIELD_BASE(148, 148, 5, 0x0020, 0x10, 15, 1),
1006 	PIN_FIELD_BASE(149, 149, 5, 0x0020, 0x10, 16, 1),
1007 	PIN_FIELD_BASE(150, 150, 7, 0x0040, 0x10, 23, 1),
1008 	PIN_FIELD_BASE(151, 151, 7, 0x0040, 0x10, 24, 1),
1009 	PIN_FIELD_BASE(152, 152, 7, 0x0040, 0x10, 25, 1),
1010 	PIN_FIELD_BASE(153, 153, 7, 0x0040, 0x10, 26, 1),
1011 	PIN_FIELD_BASE(154, 154, 7, 0x0040, 0x10, 28, 1),
1012 	PIN_FIELD_BASE(155, 155, 3, 0x0030, 0x10, 28, 1),
1013 	PIN_FIELD_BASE(156, 156, 3, 0x0030, 0x10, 27, 1),
1014 	PIN_FIELD_BASE(157, 157, 3, 0x0030, 0x10, 29, 1),
1015 	PIN_FIELD_BASE(158, 158, 3, 0x0030, 0x10, 26, 1),
1016 	PIN_FIELD_BASE(159, 159, 7, 0x0040, 0x10, 27, 1),
1017 	PIN_FIELD_BASE(160, 160, 5, 0x0020, 0x10, 8, 1),
1018 	PIN_FIELD_BASE(161, 161, 1, 0x0030, 0x10, 15, 1),
1019 	PIN_FIELD_BASE(162, 162, 1, 0x0030, 0x10, 16, 1),
1020 	PIN_FIELD_BASE(163, 163, 4, 0x0010, 0x10, 0, 1),
1021 	PIN_FIELD_BASE(164, 164, 4, 0x0010, 0x10, 1, 1),
1022 	PIN_FIELD_BASE(165, 165, 4, 0x0010, 0x10, 2, 1),
1023 	PIN_FIELD_BASE(166, 166, 4, 0x0010, 0x10, 3, 1),
1024 	PIN_FIELD_BASE(167, 167, 4, 0x0010, 0x10, 4, 1),
1025 	PIN_FIELD_BASE(168, 168, 4, 0x0010, 0x10, 5, 1),
1026 	PIN_FIELD_BASE(169, 169, 4, 0x0010, 0x10, 6, 1),
1027 	PIN_FIELD_BASE(170, 170, 4, 0x0010, 0x10, 7, 1),
1028 	PIN_FIELD_BASE(171, 171, 7, 0x0040, 0x10, 17, 1),
1029 	PIN_FIELD_BASE(172, 172, 7, 0x0040, 0x10, 18, 1),
1030 	PIN_FIELD_BASE(173, 173, 7, 0x0040, 0x10, 11, 1),
1031 	PIN_FIELD_BASE(174, 174, 7, 0x0040, 0x10, 12, 1),
1032 	PIN_FIELD_BASE(175, 175, 7, 0x0040, 0x10, 13, 1),
1033 	PIN_FIELD_BASE(176, 176, 7, 0x0040, 0x10, 14, 1),
1034 	PIN_FIELD_BASE(177, 177, 7, 0x0040, 0x10, 15, 1),
1035 	PINS_FIELD_BASE(178, 179, 7, 0x0040, 0x10, 16, 1),
1036 };
1037 
1038 static const struct mtk_pin_reg_calc mt6765_reg_cals[PINCTRL_PIN_REG_MAX] = {
1039 	[PINCTRL_PIN_REG_MODE] = MTK_RANGE(mt6765_pin_mode_range),
1040 	[PINCTRL_PIN_REG_DIR] = MTK_RANGE(mt6765_pin_dir_range),
1041 	[PINCTRL_PIN_REG_DI] = MTK_RANGE(mt6765_pin_di_range),
1042 	[PINCTRL_PIN_REG_DO] = MTK_RANGE(mt6765_pin_do_range),
1043 	[PINCTRL_PIN_REG_SMT] = MTK_RANGE(mt6765_pin_smt_range),
1044 	[PINCTRL_PIN_REG_PD] = MTK_RANGE(mt6765_pin_pd_range),
1045 	[PINCTRL_PIN_REG_PU] = MTK_RANGE(mt6765_pin_pu_range),
1046 	[PINCTRL_PIN_REG_TDSEL] = MTK_RANGE(mt6765_pin_tdsel_range),
1047 	[PINCTRL_PIN_REG_RDSEL] = MTK_RANGE(mt6765_pin_rdsel_range),
1048 	[PINCTRL_PIN_REG_DRV] = MTK_RANGE(mt6765_pin_drv_range),
1049 	[PINCTRL_PIN_REG_PUPD] = MTK_RANGE(mt6765_pin_pupd_range),
1050 	[PINCTRL_PIN_REG_R0] = MTK_RANGE(mt6765_pin_r0_range),
1051 	[PINCTRL_PIN_REG_R1] = MTK_RANGE(mt6765_pin_r1_range),
1052 	[PINCTRL_PIN_REG_IES] = MTK_RANGE(mt6765_pin_ies_range),
1053 };
1054 
1055 static const char * const mt6765_pinctrl_register_base_names[] = {
1056 	"iocfg0", "iocfg1", "iocfg2", "iocfg3", "iocfg4", "iocfg5",
1057 	"iocfg6", "iocfg7",
1058 };
1059 
1060 static const struct mtk_eint_hw mt6765_eint_hw = {
1061 	.port_mask = 7,
1062 	.ports     = 6,
1063 	.ap_num    = 160,
1064 	.db_cnt    = 13,
1065 	.db_time   = debounce_time_mt6765,
1066 };
1067 
1068 static const struct mtk_pin_soc mt6765_data = {
1069 	.reg_cal = mt6765_reg_cals,
1070 	.pins = mtk_pins_mt6765,
1071 	.npins = ARRAY_SIZE(mtk_pins_mt6765),
1072 	.ngrps = ARRAY_SIZE(mtk_pins_mt6765),
1073 	.eint_hw = &mt6765_eint_hw,
1074 	.gpio_m = 0,
1075 	.base_names = mt6765_pinctrl_register_base_names,
1076 	.nbase_names = ARRAY_SIZE(mt6765_pinctrl_register_base_names),
1077 	.bias_set_combo = mtk_pinconf_bias_set_combo,
1078 	.bias_get_combo = mtk_pinconf_bias_get_combo,
1079 	.drive_set = mtk_pinconf_drive_set_raw,
1080 	.drive_get = mtk_pinconf_drive_get_raw,
1081 	.adv_pull_get = mtk_pinconf_adv_pull_get,
1082 	.adv_pull_set = mtk_pinconf_adv_pull_set,
1083 };
1084 
1085 static const struct of_device_id mt6765_pinctrl_of_match[] = {
1086 	{ .compatible = "mediatek,mt6765-pinctrl", .data = &mt6765_data },
1087 	{ }
1088 };
1089 
1090 static struct platform_driver mt6765_pinctrl_driver = {
1091 	.driver = {
1092 		.name = "mt6765-pinctrl",
1093 		.of_match_table = mt6765_pinctrl_of_match,
1094 	},
1095 	.probe = mtk_paris_pinctrl_probe,
1096 };
1097 
1098 static int __init mt6765_pinctrl_init(void)
1099 {
1100 	return platform_driver_register(&mt6765_pinctrl_driver);
1101 }
1102 arch_initcall(mt6765_pinctrl_init);
1103 
1104 MODULE_LICENSE("GPL v2");
1105 MODULE_DESCRIPTION("MediaTek MT6765 Pinctrl Driver");
1106