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