Macpaul Lin | 5d16f8d | 2022-08-11 16:27:10 +0800 | [diff] [blame] | 1 | /* SPDX-License-Identifier: GPL-2.0-only OR MIT */ |
Rex-BC Chen | 3d6816a | 2021-05-03 16:25:49 +0800 | [diff] [blame] | 2 | |
| 3 | #include <soc/mt6359p.h> |
| 4 | |
| 5 | static const struct pmic_setting init_setting[] = { |
| 6 | {0x20, 0xA, 0xA, 0}, |
| 7 | {0x24, 0x1F00, 0x1F00, 0}, |
| 8 | {0x30, 0x1, 0x1, 0}, |
| 9 | {0x32, 0x1, 0x1, 0}, |
| 10 | {0x94, 0x0, 0xFFFF, 0}, |
| 11 | {0x10C, 0x10, 0x10, 0}, |
| 12 | {0x112, 0x4, 0x4, 0}, |
| 13 | {0x118, 0x8, 0x8, 0}, |
| 14 | {0x14A, 0x20, 0x20, 0}, |
| 15 | {0x198, 0x0, 0x1FF, 0}, |
| 16 | {0x1B2, 0x3, 0x3, 0}, |
| 17 | {0x3B0, 0x0, 0x300, 0}, |
| 18 | {0x790, 0x3, 0x3, 0}, |
| 19 | {0x796, 0x1750, 0x3FFF, 0}, |
| 20 | {0x798, 0x1750, 0x3FFF, 0}, |
| 21 | {0x7A6, 0xF800, 0xFC00, 0}, |
| 22 | {0x7A8, 0x80, 0x280, 0}, |
| 23 | {0x98A, 0x80, 0x80, 0}, |
| 24 | {0x992, 0xF00, 0xF00, 0}, |
| 25 | {0xA08, 0x1, 0x1, 0}, |
| 26 | {0xA0C, 0x300, 0x300, 0}, |
| 27 | {0xA10, 0x0, 0x4000, 0}, |
| 28 | {0xA12, 0x1E0, 0x1E0, 0}, |
| 29 | {0xA24, 0xFFFF, 0xFFFF, 0}, |
| 30 | {0xA26, 0xFFE0, 0xFFE0, 0}, |
| 31 | {0xA2C, 0xC0DF, 0xC0DF, 0}, |
| 32 | {0xA2E, 0xEBE0, 0xEBE0, 0}, |
| 33 | {0xA34, 0x8000, 0x8000, 0}, |
| 34 | {0xA3C, 0x1500, 0x1F00, 0}, |
| 35 | {0xA3E, 0x4261, 0x7FFF, 0}, |
| 36 | {0xA40, 0x3842, 0x7FFF, 0}, |
| 37 | {0xA42, 0xC03, 0x7FFF, 0}, |
| 38 | {0xA44, 0x1CC4, 0x7FFF, 0}, |
| 39 | {0xA46, 0x21AD, 0x7FFF, 0}, |
| 40 | {0xA48, 0x5409, 0x7FFF, 0}, |
| 41 | {0xA4A, 0x46AA, 0x7FFF, 0}, |
| 42 | {0xA4C, 0x3E90, 0x7FFF, 0}, |
| 43 | {0xA4E, 0x5253, 0x7FFF, 0}, |
| 44 | {0xA50, 0xA0, 0x7FFF, 0}, |
| 45 | {0xA9C, 0x4000, 0x4000, 0}, |
| 46 | {0xA9E, 0x2E11, 0xFF11, 0}, |
| 47 | {0xF8C, 0x115, 0x115, 0}, |
| 48 | {0x1188, 0x0, 0x8000, 0}, |
| 49 | {0x1198, 0x13, 0x3FF, 0}, |
| 50 | {0x119E, 0x6000, 0x7000, 0}, |
| 51 | {0x11D4, 0x0, 0x2, 0}, |
| 52 | {0x1212, 0x0, 0x2, 0}, |
| 53 | {0x1224, 0x0, 0x2, 0}, |
| 54 | {0x1238, 0x0, 0x2, 0}, |
| 55 | {0x124A, 0x0, 0x2, 0}, |
| 56 | {0x125C, 0x0, 0x2, 0}, |
| 57 | {0x125E, 0x0, 0x8000, 0}, |
| 58 | {0x1260, 0x1, 0xFFF, 0}, |
| 59 | {0x1262, 0x4, 0x4, 0}, |
| 60 | {0x1412, 0x8, 0x8, 0}, |
| 61 | {0x148E, 0x18, 0x7F, 0}, |
| 62 | {0x1492, 0xF1F, 0x7F7F, 0}, |
| 63 | {0x150E, 0x18, 0x7F, 0}, |
| 64 | {0x1512, 0xF15, 0x7F7F, 0}, |
| 65 | {0x158E, 0x18, 0x7F, 0}, |
| 66 | {0x1592, 0xF00, 0x7F00, 0}, |
| 67 | {0x160E, 0x18, 0x7F, 0}, |
| 68 | {0x1692, 0xF1F, 0x7F7F, 0}, |
| 69 | {0x170E, 0x18, 0x7F, 0}, |
| 70 | {0x1712, 0xF1F, 0x7F7F, 0}, |
| 71 | {0x178E, 0x18, 0x7F, 0}, |
| 72 | {0x1792, 0xF1F, 0x7F7F, 0}, |
| 73 | {0x1918, 0x0, 0x3F3F, 0}, |
| 74 | {0x191A, 0x0, 0x3F00, 0}, |
| 75 | {0x198A, 0x5004, 0x502C, 0}, |
| 76 | {0x198C, 0x3E, 0x3F, 0}, |
| 77 | {0x198E, 0x1E0, 0x1E0, 0}, |
| 78 | {0x1990, 0xFD, 0xFF, 0}, |
| 79 | {0x1994, 0x10, 0x38, 0}, |
| 80 | {0x1996, 0x2004, 0xA02C, 0}, |
| 81 | {0x1998, 0x3E, 0x3F, 0}, |
| 82 | {0x199A, 0xFB78, 0xFF78, 0}, |
| 83 | {0x199E, 0x2, 0x7, 0}, |
| 84 | {0x19A0, 0x1050, 0x10F1, 0}, |
| 85 | {0x19A2, 0x3E, 0x3F, 0}, |
| 86 | {0x19A4, 0xFD0F, 0xFF0F, 0}, |
| 87 | {0x19A6, 0x20, 0xFF, 0}, |
| 88 | {0x19AC, 0x4208, 0x4698, 0}, |
| 89 | {0x19AE, 0x6E, 0x7E, 0}, |
| 90 | {0x19B0, 0x3C00, 0x3C00, 0}, |
| 91 | {0x19B4, 0x20FD, 0xFFFF, 0}, |
| 92 | {0x1A08, 0x4208, 0x4698, 0}, |
| 93 | {0x1A0A, 0x6E, 0x7E, 0}, |
| 94 | {0x1A0C, 0x3C00, 0x3C00, 0}, |
| 95 | {0x1A10, 0x20FD, 0xFFFF, 0}, |
| 96 | {0x1A14, 0x4208, 0x4698, 0}, |
| 97 | {0x1A16, 0x6E, 0x7E, 0}, |
| 98 | {0x1A18, 0x3C00, 0x3C00, 0}, |
| 99 | {0x1A1C, 0x20FD, 0xFFFF, 0}, |
| 100 | {0x1A1E, 0x0, 0x200, 0}, |
| 101 | {0x1A20, 0x4208, 0x4698, 0}, |
| 102 | {0x1A22, 0x4A, 0x7E, 0}, |
| 103 | {0x1A24, 0x3C00, 0x3C00, 0}, |
| 104 | {0x1A28, 0x3000, 0xFF00, 0}, |
| 105 | {0x1A2C, 0x20, 0x74, 0}, |
| 106 | {0x1A2E, 0x1E, 0x1E, 0}, |
| 107 | {0x1A30, 0x42, 0xFF, 0}, |
| 108 | {0x1A32, 0x480, 0x7E0, 0}, |
| 109 | {0x1A34, 0x20, 0x74, 0}, |
| 110 | {0x1A36, 0x1E, 0x1E, 0}, |
| 111 | {0x1A38, 0x42, 0xFF, 0}, |
| 112 | {0x1A3A, 0x480, 0x7E0, 0}, |
| 113 | {0x1A3C, 0x14C, 0x3CC, 0}, |
| 114 | {0x1A3E, 0x23C, 0x3FC, 0}, |
| 115 | {0x1A40, 0xC400, 0xFF00, 0}, |
| 116 | {0x1A42, 0x80, 0xFF, 0}, |
| 117 | {0x1A44, 0x702C, 0xFF2C, 0}, |
| 118 | {0x1B0E, 0xF, 0xF, 0}, |
| 119 | {0x1B10, 0x1, 0x1, 0}, |
| 120 | {0x1B14, 0xFFFF, 0xFFFF, 0}, |
| 121 | {0x1B1A, 0x3FFF, 0x3FFF, 0}, |
| 122 | {0x1B32, 0x8, 0x8, 0}, |
| 123 | {0x1B8A, 0x30, 0x8030, 0}, |
| 124 | {0x1B9C, 0x10, 0x8010, 0}, |
| 125 | {0x1BA0, 0x4000, 0x4000, 0}, |
| 126 | {0x1BAE, 0x1410, 0x9C10, 0}, |
| 127 | {0x1BB2, 0x2, 0x2, 0}, |
| 128 | {0x1BC0, 0x10, 0x8010, 0}, |
| 129 | {0x1BD2, 0x13, 0x8013, 0}, |
| 130 | {0x1BE4, 0x10, 0x8010, 0}, |
| 131 | {0x1C0A, 0x10, 0x8010, 0}, |
| 132 | {0x1C1E, 0x10, 0x8010, 0}, |
| 133 | {0x1C30, 0x10, 0x8010, 0}, |
| 134 | {0x1C42, 0x10, 0x8010, 0}, |
| 135 | {0x1C54, 0x32, 0x8033, 0}, |
| 136 | {0x1C66, 0x10, 0x8010, 0}, |
| 137 | {0x1C8A, 0x10, 0x8010, 0}, |
| 138 | {0x1C8E, 0x4000, 0x4000, 0}, |
| 139 | {0x1C9C, 0x10, 0x8010, 0}, |
| 140 | {0x1CAE, 0x10, 0x8010, 0}, |
| 141 | {0x1CC0, 0x10, 0x8010, 0}, |
| 142 | {0x1CD2, 0x33, 0x8033, 0}, |
| 143 | {0x1CE4, 0x33, 0x8033, 0}, |
| 144 | {0x1D0A, 0x10, 0x8010, 0}, |
| 145 | {0x1D1E, 0x10, 0x8010, 0}, |
| 146 | {0x1D22, 0x4000, 0x4000, 0}, |
| 147 | {0x1D30, 0x10, 0x8010, 0}, |
| 148 | {0x1D34, 0x4000, 0x4000, 0}, |
| 149 | {0x1D42, 0x30, 0x8030, 0}, |
| 150 | {0x1D46, 0x4000, 0x4000, 0}, |
| 151 | {0x1D54, 0x30, 0x8030, 0}, |
| 152 | {0x1D66, 0x32, 0x8033, 0}, |
| 153 | {0x1D8A, 0x10, 0x8010, 0}, |
| 154 | {0x1D9C, 0x10, 0x8010, 0}, |
| 155 | {0x1E8A, 0x10, 0x8010, 0}, |
| 156 | {0x1E8E, 0x10, 0x7F, 0}, |
| 157 | {0x1E92, 0xF15, 0x7F7F, 0}, |
| 158 | {0x1EAA, 0x10, 0x8010, 0}, |
| 159 | {0x1EAE, 0x10, 0x7F, 0}, |
| 160 | {0x1EB2, 0xF15, 0x7F7F, 0}, |
| 161 | {0x1F0A, 0x10, 0x8010, 0}, |
| 162 | {0x1F0E, 0x8, 0x7F, 0}, |
| 163 | {0x1F12, 0xF1F, 0x7F7F, 0}, |
| 164 | {0x1F30, 0x10, 0x8010, 0}, |
| 165 | {0x1F34, 0x8, 0x7F, 0}, |
| 166 | {0x1F38, 0xF1F, 0x7F7F, 0}, |
| 167 | {0x200A, 0x8, 0xC, 0}, |
| 168 | {0x202C, 0x8, 0xC, 0}, |
| 169 | {0x208C, 0x100, 0xF00, 0}, |
| 170 | {0x209C, 0x80, 0x1E0, 0}, |
| 171 | /* |
| 172 | * BUCK_VGPU11_OP_MODE/CFG/EN |
| 173 | * Vreq setting for scp usage |
| 174 | */ |
| 175 | {0x15a0, 0x0, 0x1, 11}, |
| 176 | {0x159a, 0x0, 0x1, 11}, |
| 177 | {0x1594, 0x1, 0x1, 11}, |
| 178 | }; |
| 179 | |
| 180 | static const struct pmic_setting lp_setting[] = { |
| 181 | /* Suspend */ |
| 182 | {0x14a0, 0x1, 0x1, 0x0}, |
| 183 | {0x1494, 0x1, 0x1, 0x0}, |
| 184 | {0x149a, 0x1, 0x1, 0x0}, |
| 185 | {0x15a0, 0x1, 0x1, 0x0}, |
| 186 | {0x1594, 0x1, 0x1, 0x0}, |
| 187 | {0x159a, 0x1, 0x1, 0x0}, |
| 188 | {0x1820, 0x1, 0x1, 0x0}, |
| 189 | {0x1814, 0x1, 0x1, 0x0}, |
| 190 | {0x181a, 0x1, 0x1, 0x0}, |
| 191 | {0x18a0, 0x1, 0x1, 0x0}, |
| 192 | {0x1894, 0x1, 0x1, 0x0}, |
| 193 | {0x189a, 0x1, 0x1, 0x0}, |
| 194 | {0x1cac, 0x1, 0x1, 0xa}, |
| 195 | {0x1cb2, 0x1, 0x1, 0x0}, |
| 196 | {0x1cb8, 0x1, 0x1, 0x0}, |
| 197 | {0x1bbe, 0x1, 0x1, 0xa}, |
| 198 | {0x1bc4, 0x1, 0x1, 0x0}, |
| 199 | {0x1bca, 0x1, 0x1, 0x0}, |
| 200 | {0x1d22, 0x1, 0x1, 0xe}, |
| 201 | {0x1d28, 0x0, 0x1, 0xe}, |
| 202 | {0x1c64, 0x1, 0x1, 0xa}, |
| 203 | {0x1c6a, 0x1, 0x1, 0x0}, |
| 204 | {0x1c70, 0x1, 0x1, 0x0}, |
| 205 | {0x1d34, 0x1, 0x1, 0xe}, |
| 206 | {0x1d3a, 0x0, 0x1, 0xe}, |
| 207 | {0x1c88, 0x1, 0x1, 0xa}, |
| 208 | {0x1c8e, 0x1, 0x1, 0x0}, |
| 209 | {0x1c94, 0x1, 0x1, 0x0}, |
| 210 | {0x1b9a, 0x1, 0x1, 0xa}, |
| 211 | {0x1ba0, 0x1, 0x1, 0x0}, |
| 212 | {0x1ba6, 0x1, 0x1, 0x0}, |
| 213 | {0x1d08, 0x1, 0x1, 0xa}, |
| 214 | {0x1d0e, 0x1, 0x1, 0x0}, |
| 215 | {0x1d14, 0x1, 0x1, 0x0}, |
| 216 | {0x1d0e, 0x1, 0x1, 0x0}, |
| 217 | {0x1d14, 0x1, 0x1, 0x0}, |
| 218 | {0x1d9a, 0x1, 0x1, 0xa}, |
| 219 | {0x1da0, 0x1, 0x1, 0x0}, |
| 220 | {0x1da6, 0x1, 0x1, 0x0}, |
| 221 | |
| 222 | /* Deep idle */ |
| 223 | {0x1bbe, 0x1, 0x1, 0xc}, |
| 224 | {0x1bc4, 0x1, 0x1, 0x2}, |
| 225 | {0x1bca, 0x1, 0x1, 0x2}, |
| 226 | {0x1c64, 0x1, 0x1, 0xc}, |
| 227 | {0x1c6a, 0x1, 0x1, 0x2}, |
| 228 | {0x1c70, 0x1, 0x1, 0x2}, |
| 229 | {0x1c88, 0x1, 0x1, 0xc}, |
| 230 | {0x1c8e, 0x1, 0x1, 0x2}, |
| 231 | {0x1c94, 0x1, 0x1, 0x2}, |
| 232 | {0x1b9a, 0x1, 0x1, 0xc}, |
| 233 | {0x1ba0, 0x1, 0x1, 0x2}, |
| 234 | {0x1ba6, 0x1, 0x1, 0x2}, |
| 235 | {0x1d08, 0x1, 0x1, 0xc}, |
| 236 | {0x1d0e, 0x1, 0x1, 0x2}, |
| 237 | {0x1d14, 0x1, 0x1, 0x2}, |
| 238 | {0x1d0e, 0x1, 0x1, 0x2}, |
| 239 | {0x1d14, 0x1, 0x1, 0x2}, |
| 240 | }; |
| 241 | |
| 242 | void pmic_init_setting(void) |
| 243 | { |
| 244 | for (int i = 0; i < ARRAY_SIZE(init_setting); i++) |
| 245 | mt6359p_write_field(init_setting[i].addr, init_setting[i].val, |
| 246 | init_setting[i].mask, init_setting[i].shift); |
| 247 | } |
| 248 | |
| 249 | void pmic_lp_setting(void) |
| 250 | { |
| 251 | for (int i = 0; i < ARRAY_SIZE(lp_setting); i++) |
| 252 | mt6359p_write_field(lp_setting[i].addr, lp_setting[i].val, |
| 253 | lp_setting[i].mask, lp_setting[i].shift); |
| 254 | } |