1 /* 2 * Afatech AF9013 demodulator driver 3 * 4 * Copyright (C) 2007 Antti Palosaari <crope@iki.fi> 5 * Copyright (C) 2011 Antti Palosaari <crope@iki.fi> 6 * 7 * Thanks to Afatech who kindly provided information. 8 * 9 * This program is free software; you can redistribute it and/or modify 10 * it under the terms of the GNU General Public License as published by 11 * the Free Software Foundation; either version 2 of the License, or 12 * (at your option) any later version. 13 * 14 * This program is distributed in the hope that it will be useful, 15 * but WITHOUT ANY WARRANTY; without even the implied warranty of 16 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 17 * GNU General Public License for more details. 18 * 19 */ 20 21 #ifndef AF9013_PRIV_H 22 #define AF9013_PRIV_H 23 24 #include <media/dvb_frontend.h> 25 #include <media/dvb_math.h> 26 #include "af9013.h" 27 #include <linux/firmware.h> 28 #include <linux/math64.h> 29 #include <linux/regmap.h> 30 31 #define AF9013_FIRMWARE "dvb-fe-af9013.fw" 32 33 struct af9013_reg_bit { 34 u16 addr; 35 u8 pos:4; 36 u8 len:4; 37 u8 val; 38 }; 39 40 struct af9013_coeff { 41 u32 clock; 42 u32 bandwidth_hz; 43 u8 val[24]; 44 }; 45 46 /* pre-calculated coeff lookup table */ 47 static const struct af9013_coeff coeff_lut[] = { 48 /* 28.800 MHz */ 49 { 28800000, 8000000, { 0x02, 0x8a, 0x28, 0xa3, 0x05, 0x14, 50 0x51, 0x11, 0x00, 0xa2, 0x8f, 0x3d, 0x00, 0xa2, 0x8a, 51 0x29, 0x00, 0xa2, 0x85, 0x14, 0x01, 0x45, 0x14, 0x14 } }, 52 { 28800000, 7000000, { 0x02, 0x38, 0xe3, 0x8e, 0x04, 0x71, 53 0xc7, 0x07, 0x00, 0x8e, 0x3d, 0x55, 0x00, 0x8e, 0x38, 54 0xe4, 0x00, 0x8e, 0x34, 0x72, 0x01, 0x1c, 0x71, 0x32 } }, 55 { 28800000, 6000000, { 0x01, 0xe7, 0x9e, 0x7a, 0x03, 0xcf, 56 0x3c, 0x3d, 0x00, 0x79, 0xeb, 0x6e, 0x00, 0x79, 0xe7, 57 0x9e, 0x00, 0x79, 0xe3, 0xcf, 0x00, 0xf3, 0xcf, 0x0f } }, 58 /* 20.480 MHz */ 59 { 20480000, 8000000, { 0x03, 0x92, 0x49, 0x26, 0x07, 0x24, 60 0x92, 0x13, 0x00, 0xe4, 0x99, 0x6e, 0x00, 0xe4, 0x92, 61 0x49, 0x00, 0xe4, 0x8b, 0x25, 0x01, 0xc9, 0x24, 0x25 } }, 62 { 20480000, 7000000, { 0x03, 0x20, 0x00, 0x01, 0x06, 0x40, 63 0x00, 0x00, 0x00, 0xc8, 0x06, 0x40, 0x00, 0xc8, 0x00, 64 0x00, 0x00, 0xc7, 0xf9, 0xc0, 0x01, 0x90, 0x00, 0x00 } }, 65 { 20480000, 6000000, { 0x02, 0xad, 0xb6, 0xdc, 0x05, 0x5b, 66 0x6d, 0x2e, 0x00, 0xab, 0x73, 0x13, 0x00, 0xab, 0x6d, 67 0xb7, 0x00, 0xab, 0x68, 0x5c, 0x01, 0x56, 0xdb, 0x1c } }, 68 /* 28.000 MHz */ 69 { 28000000, 8000000, { 0x02, 0x9c, 0xbc, 0x15, 0x05, 0x39, 70 0x78, 0x0a, 0x00, 0xa7, 0x34, 0x3f, 0x00, 0xa7, 0x2f, 71 0x05, 0x00, 0xa7, 0x29, 0xcc, 0x01, 0x4e, 0x5e, 0x03 } }, 72 { 28000000, 7000000, { 0x02, 0x49, 0x24, 0x92, 0x04, 0x92, 73 0x49, 0x09, 0x00, 0x92, 0x4d, 0xb7, 0x00, 0x92, 0x49, 74 0x25, 0x00, 0x92, 0x44, 0x92, 0x01, 0x24, 0x92, 0x12 } }, 75 { 28000000, 6000000, { 0x01, 0xf5, 0x8d, 0x10, 0x03, 0xeb, 76 0x1a, 0x08, 0x00, 0x7d, 0x67, 0x2f, 0x00, 0x7d, 0x63, 77 0x44, 0x00, 0x7d, 0x5f, 0x59, 0x00, 0xfa, 0xc6, 0x22 } }, 78 /* 25.000 MHz */ 79 { 25000000, 8000000, { 0x02, 0xec, 0xfb, 0x9d, 0x05, 0xd9, 80 0xf7, 0x0e, 0x00, 0xbb, 0x44, 0xc1, 0x00, 0xbb, 0x3e, 81 0xe7, 0x00, 0xbb, 0x39, 0x0d, 0x01, 0x76, 0x7d, 0x34 } }, 82 { 25000000, 7000000, { 0x02, 0x8f, 0x5c, 0x29, 0x05, 0x1e, 83 0xb8, 0x14, 0x00, 0xa3, 0xdc, 0x29, 0x00, 0xa3, 0xd7, 84 0x0a, 0x00, 0xa3, 0xd1, 0xec, 0x01, 0x47, 0xae, 0x05 } }, 85 { 25000000, 6000000, { 0x02, 0x31, 0xbc, 0xb5, 0x04, 0x63, 86 0x79, 0x1b, 0x00, 0x8c, 0x73, 0x91, 0x00, 0x8c, 0x6f, 87 0x2d, 0x00, 0x8c, 0x6a, 0xca, 0x01, 0x18, 0xde, 0x17 } }, 88 }; 89 90 static const struct af9013_reg_bit ofsm_init[] = { 91 { 0xd73a, 0, 8, 0xa1 }, 92 { 0xd73b, 0, 8, 0x1f }, 93 { 0xd73c, 4, 4, 0x0a }, 94 { 0xd732, 3, 1, 0x00 }, 95 { 0xd731, 4, 2, 0x03 }, 96 { 0xd73d, 7, 1, 0x01 }, 97 { 0xd740, 0, 1, 0x00 }, 98 { 0xd740, 1, 1, 0x00 }, 99 { 0xd740, 2, 1, 0x00 }, 100 { 0xd740, 3, 1, 0x01 }, 101 { 0xd3c1, 4, 1, 0x01 }, 102 { 0x9124, 0, 8, 0x58 }, 103 { 0x9125, 0, 2, 0x02 }, 104 { 0xd3a2, 0, 8, 0x00 }, 105 { 0xd3a3, 0, 8, 0x04 }, 106 { 0xd305, 0, 8, 0x32 }, 107 { 0xd306, 0, 8, 0x10 }, 108 { 0xd304, 0, 8, 0x04 }, 109 { 0x9112, 0, 1, 0x01 }, 110 { 0x911d, 0, 1, 0x01 }, 111 { 0x911a, 0, 1, 0x01 }, 112 { 0x911b, 0, 1, 0x01 }, 113 { 0x9bce, 0, 4, 0x02 }, 114 { 0x9116, 0, 1, 0x01 }, 115 { 0x9122, 0, 8, 0xd0 }, 116 { 0xd2e0, 0, 8, 0xd0 }, 117 { 0xd2e9, 0, 4, 0x0d }, 118 { 0xd38c, 0, 8, 0xfc }, 119 { 0xd38d, 0, 8, 0x00 }, 120 { 0xd38e, 0, 8, 0x7e }, 121 { 0xd38f, 0, 8, 0x00 }, 122 { 0xd390, 0, 8, 0x2f }, 123 { 0xd145, 4, 1, 0x01 }, 124 { 0xd1a9, 4, 1, 0x01 }, 125 { 0xd158, 5, 3, 0x01 }, 126 { 0xd159, 0, 6, 0x06 }, 127 { 0xd167, 0, 8, 0x00 }, 128 { 0xd168, 0, 4, 0x07 }, 129 { 0xd1c3, 5, 3, 0x00 }, 130 { 0xd1c4, 0, 6, 0x00 }, 131 { 0xd1c5, 0, 7, 0x10 }, 132 { 0xd1c6, 0, 3, 0x02 }, 133 { 0xd080, 2, 5, 0x03 }, 134 { 0xd081, 4, 4, 0x09 }, 135 { 0xd098, 4, 4, 0x0f }, 136 { 0xd098, 0, 4, 0x03 }, 137 { 0xdbc0, 4, 1, 0x01 }, 138 { 0xdbc7, 0, 8, 0x08 }, 139 { 0xdbc8, 4, 4, 0x00 }, 140 { 0xdbc9, 0, 5, 0x01 }, 141 { 0xd280, 0, 8, 0xe0 }, 142 { 0xd281, 0, 8, 0xff }, 143 { 0xd282, 0, 8, 0xff }, 144 { 0xd283, 0, 8, 0xc3 }, 145 { 0xd284, 0, 8, 0xff }, 146 { 0xd285, 0, 4, 0x01 }, 147 { 0xd0f0, 0, 7, 0x1a }, 148 { 0xd0f1, 4, 1, 0x01 }, 149 { 0xd0f2, 0, 8, 0x0c }, 150 { 0xd101, 5, 3, 0x06 }, 151 { 0xd103, 0, 4, 0x08 }, 152 { 0xd0f8, 0, 7, 0x20 }, 153 { 0xd111, 5, 1, 0x00 }, 154 { 0xd111, 6, 1, 0x00 }, 155 { 0x910b, 0, 8, 0x0a }, 156 { 0x9115, 0, 8, 0x02 }, 157 { 0x910c, 0, 8, 0x02 }, 158 { 0x910d, 0, 8, 0x08 }, 159 { 0x910e, 0, 8, 0x0a }, 160 { 0x9bf6, 0, 8, 0x06 }, 161 { 0x9bf8, 0, 8, 0x02 }, 162 { 0x9bf7, 0, 8, 0x05 }, 163 { 0x9bf9, 0, 8, 0x0f }, 164 { 0x9bfc, 0, 8, 0x13 }, 165 { 0x9bd3, 0, 8, 0xff }, 166 { 0x9bbe, 0, 1, 0x01 }, 167 { 0x9bcc, 0, 1, 0x01 }, 168 }; 169 170 /* Panasonic ENV77H11D5 tuner init 171 AF9013_TUNER_ENV77H11D5 = 129 */ 172 static const struct af9013_reg_bit tuner_init_env77h11d5[] = { 173 { 0x9bd5, 0, 8, 0x01 }, 174 { 0x9bd6, 0, 8, 0x03 }, 175 { 0x9bbe, 0, 8, 0x01 }, 176 { 0xd1a0, 1, 1, 0x01 }, 177 { 0xd000, 0, 1, 0x01 }, 178 { 0xd000, 1, 1, 0x00 }, 179 { 0xd001, 1, 1, 0x01 }, 180 { 0xd001, 0, 1, 0x00 }, 181 { 0xd001, 5, 1, 0x00 }, 182 { 0xd002, 0, 5, 0x19 }, 183 { 0xd003, 0, 5, 0x1a }, 184 { 0xd004, 0, 5, 0x19 }, 185 { 0xd005, 0, 5, 0x1a }, 186 { 0xd00e, 0, 5, 0x10 }, 187 { 0xd00f, 0, 3, 0x04 }, 188 { 0xd00f, 3, 3, 0x05 }, 189 { 0xd010, 0, 3, 0x04 }, 190 { 0xd010, 3, 3, 0x05 }, 191 { 0xd016, 4, 4, 0x03 }, 192 { 0xd01f, 0, 6, 0x0a }, 193 { 0xd020, 0, 6, 0x0a }, 194 { 0x9bda, 0, 8, 0x00 }, 195 { 0x9be3, 0, 8, 0x00 }, 196 { 0xd015, 0, 8, 0x50 }, 197 { 0xd016, 0, 1, 0x00 }, 198 { 0xd044, 0, 8, 0x46 }, 199 { 0xd045, 0, 1, 0x00 }, 200 { 0xd008, 0, 8, 0xdf }, 201 { 0xd009, 0, 2, 0x02 }, 202 { 0xd006, 0, 8, 0x44 }, 203 { 0xd007, 0, 2, 0x01 }, 204 { 0xd00c, 0, 8, 0xeb }, 205 { 0xd00d, 0, 2, 0x02 }, 206 { 0xd00a, 0, 8, 0xf4 }, 207 { 0xd00b, 0, 2, 0x01 }, 208 { 0x9bba, 0, 8, 0xf9 }, 209 { 0x9bc3, 0, 8, 0xdf }, 210 { 0x9bc4, 0, 8, 0x02 }, 211 { 0x9bc5, 0, 8, 0xeb }, 212 { 0x9bc6, 0, 8, 0x02 }, 213 { 0x9bc9, 0, 8, 0x52 }, 214 { 0xd011, 0, 8, 0x3c }, 215 { 0xd012, 0, 2, 0x01 }, 216 { 0xd013, 0, 8, 0xf7 }, 217 { 0xd014, 0, 2, 0x02 }, 218 { 0xd040, 0, 8, 0x0b }, 219 { 0xd041, 0, 2, 0x02 }, 220 { 0xd042, 0, 8, 0x4d }, 221 { 0xd043, 0, 2, 0x00 }, 222 { 0xd045, 1, 1, 0x00 }, 223 { 0x9bcf, 0, 1, 0x01 }, 224 { 0xd045, 2, 1, 0x01 }, 225 { 0xd04f, 0, 8, 0x9a }, 226 { 0xd050, 0, 1, 0x01 }, 227 { 0xd051, 0, 8, 0x5a }, 228 { 0xd052, 0, 1, 0x01 }, 229 { 0xd053, 0, 8, 0x50 }, 230 { 0xd054, 0, 8, 0x46 }, 231 { 0x9bd7, 0, 8, 0x0a }, 232 { 0x9bd8, 0, 8, 0x14 }, 233 { 0x9bd9, 0, 8, 0x08 }, 234 }; 235 236 /* Microtune MT2060 tuner init 237 AF9013_TUNER_MT2060 = 130 */ 238 static const struct af9013_reg_bit tuner_init_mt2060[] = { 239 { 0x9bd5, 0, 8, 0x01 }, 240 { 0x9bd6, 0, 8, 0x07 }, 241 { 0xd1a0, 1, 1, 0x01 }, 242 { 0xd000, 0, 1, 0x01 }, 243 { 0xd000, 1, 1, 0x00 }, 244 { 0xd001, 1, 1, 0x01 }, 245 { 0xd001, 0, 1, 0x00 }, 246 { 0xd001, 5, 1, 0x00 }, 247 { 0xd002, 0, 5, 0x19 }, 248 { 0xd003, 0, 5, 0x1a }, 249 { 0xd004, 0, 5, 0x19 }, 250 { 0xd005, 0, 5, 0x1a }, 251 { 0xd00e, 0, 5, 0x10 }, 252 { 0xd00f, 0, 3, 0x04 }, 253 { 0xd00f, 3, 3, 0x05 }, 254 { 0xd010, 0, 3, 0x04 }, 255 { 0xd010, 3, 3, 0x05 }, 256 { 0xd016, 4, 4, 0x03 }, 257 { 0xd01f, 0, 6, 0x0a }, 258 { 0xd020, 0, 6, 0x0a }, 259 { 0x9bda, 0, 8, 0x00 }, 260 { 0x9be3, 0, 8, 0x00 }, 261 { 0x9bbe, 0, 1, 0x00 }, 262 { 0x9bcc, 0, 1, 0x00 }, 263 { 0x9bb9, 0, 8, 0x75 }, 264 { 0x9bcd, 0, 8, 0x24 }, 265 { 0x9bff, 0, 8, 0x30 }, 266 { 0xd015, 0, 8, 0x46 }, 267 { 0xd016, 0, 1, 0x00 }, 268 { 0xd044, 0, 8, 0x46 }, 269 { 0xd045, 0, 1, 0x00 }, 270 { 0xd008, 0, 8, 0x0f }, 271 { 0xd009, 0, 2, 0x02 }, 272 { 0xd006, 0, 8, 0x32 }, 273 { 0xd007, 0, 2, 0x01 }, 274 { 0xd00c, 0, 8, 0x36 }, 275 { 0xd00d, 0, 2, 0x03 }, 276 { 0xd00a, 0, 8, 0x35 }, 277 { 0xd00b, 0, 2, 0x01 }, 278 { 0x9bc7, 0, 8, 0x07 }, 279 { 0x9bc8, 0, 8, 0x90 }, 280 { 0x9bc3, 0, 8, 0x0f }, 281 { 0x9bc4, 0, 8, 0x02 }, 282 { 0x9bc5, 0, 8, 0x36 }, 283 { 0x9bc6, 0, 8, 0x03 }, 284 { 0x9bba, 0, 8, 0xc9 }, 285 { 0x9bc9, 0, 8, 0x79 }, 286 { 0xd011, 0, 8, 0x10 }, 287 { 0xd012, 0, 2, 0x01 }, 288 { 0xd013, 0, 8, 0x45 }, 289 { 0xd014, 0, 2, 0x03 }, 290 { 0xd040, 0, 8, 0x98 }, 291 { 0xd041, 0, 2, 0x00 }, 292 { 0xd042, 0, 8, 0xcf }, 293 { 0xd043, 0, 2, 0x03 }, 294 { 0xd045, 1, 1, 0x00 }, 295 { 0x9bcf, 0, 1, 0x01 }, 296 { 0xd045, 2, 1, 0x01 }, 297 { 0xd04f, 0, 8, 0x9a }, 298 { 0xd050, 0, 1, 0x01 }, 299 { 0xd051, 0, 8, 0x5a }, 300 { 0xd052, 0, 1, 0x01 }, 301 { 0xd053, 0, 8, 0x50 }, 302 { 0xd054, 0, 8, 0x46 }, 303 { 0x9bd7, 0, 8, 0x0a }, 304 { 0x9bd8, 0, 8, 0x14 }, 305 { 0x9bd9, 0, 8, 0x08 }, 306 { 0x9bd0, 0, 8, 0xcc }, 307 { 0x9be4, 0, 8, 0xa0 }, 308 { 0x9bbd, 0, 8, 0x8e }, 309 { 0x9be2, 0, 8, 0x4d }, 310 { 0x9bee, 0, 1, 0x01 }, 311 }; 312 313 /* Microtune MT2060 tuner init 314 AF9013_TUNER_MT2060_2 = 147 */ 315 static const struct af9013_reg_bit tuner_init_mt2060_2[] = { 316 { 0x9bd5, 0, 8, 0x01 }, 317 { 0x9bd6, 0, 8, 0x06 }, 318 { 0x9bbe, 0, 8, 0x01 }, 319 { 0xd1a0, 1, 1, 0x01 }, 320 { 0xd000, 0, 1, 0x01 }, 321 { 0xd000, 1, 1, 0x00 }, 322 { 0xd001, 1, 1, 0x01 }, 323 { 0xd001, 0, 1, 0x00 }, 324 { 0xd001, 5, 1, 0x00 }, 325 { 0xd002, 0, 5, 0x19 }, 326 { 0xd003, 0, 5, 0x1a }, 327 { 0xd004, 0, 5, 0x19 }, 328 { 0xd005, 0, 5, 0x1a }, 329 { 0xd00e, 0, 5, 0x10 }, 330 { 0xd00f, 0, 3, 0x04 }, 331 { 0xd00f, 3, 3, 0x05 }, 332 { 0xd010, 0, 3, 0x04 }, 333 { 0xd010, 3, 3, 0x05 }, 334 { 0xd016, 4, 4, 0x03 }, 335 { 0xd01f, 0, 6, 0x0a }, 336 { 0xd020, 0, 6, 0x0a }, 337 { 0xd015, 0, 8, 0x46 }, 338 { 0xd016, 0, 1, 0x00 }, 339 { 0xd044, 0, 8, 0x46 }, 340 { 0xd045, 0, 1, 0x00 }, 341 { 0xd008, 0, 8, 0x0f }, 342 { 0xd009, 0, 2, 0x02 }, 343 { 0xd006, 0, 8, 0x32 }, 344 { 0xd007, 0, 2, 0x01 }, 345 { 0xd00c, 0, 8, 0x36 }, 346 { 0xd00d, 0, 2, 0x03 }, 347 { 0xd00a, 0, 8, 0x35 }, 348 { 0xd00b, 0, 2, 0x01 }, 349 { 0x9bc7, 0, 8, 0x07 }, 350 { 0x9bc8, 0, 8, 0x90 }, 351 { 0x9bc3, 0, 8, 0x0f }, 352 { 0x9bc4, 0, 8, 0x02 }, 353 { 0x9bc5, 0, 8, 0x36 }, 354 { 0x9bc6, 0, 8, 0x03 }, 355 { 0x9bba, 0, 8, 0xc9 }, 356 { 0x9bc9, 0, 8, 0x79 }, 357 { 0xd011, 0, 8, 0x10 }, 358 { 0xd012, 0, 2, 0x01 }, 359 { 0xd013, 0, 8, 0x45 }, 360 { 0xd014, 0, 2, 0x03 }, 361 { 0xd040, 0, 8, 0x98 }, 362 { 0xd041, 0, 2, 0x00 }, 363 { 0xd042, 0, 8, 0xcf }, 364 { 0xd043, 0, 2, 0x03 }, 365 { 0xd045, 1, 1, 0x00 }, 366 { 0x9bcf, 0, 8, 0x01 }, 367 { 0xd045, 2, 1, 0x01 }, 368 { 0xd04f, 0, 8, 0x9a }, 369 { 0xd050, 0, 1, 0x01 }, 370 { 0xd051, 0, 8, 0x5a }, 371 { 0xd052, 0, 1, 0x01 }, 372 { 0xd053, 0, 8, 0x96 }, 373 { 0xd054, 0, 8, 0x46 }, 374 { 0xd045, 7, 1, 0x00 }, 375 { 0x9bd7, 0, 8, 0x0a }, 376 { 0x9bd8, 0, 8, 0x14 }, 377 { 0x9bd9, 0, 8, 0x08 }, 378 }; 379 380 /* MaxLinear MXL5003 tuner init 381 AF9013_TUNER_MXL5003D = 3 */ 382 static const struct af9013_reg_bit tuner_init_mxl5003d[] = { 383 { 0x9bd5, 0, 8, 0x01 }, 384 { 0x9bd6, 0, 8, 0x09 }, 385 { 0xd1a0, 1, 1, 0x01 }, 386 { 0xd000, 0, 1, 0x01 }, 387 { 0xd000, 1, 1, 0x00 }, 388 { 0xd001, 1, 1, 0x01 }, 389 { 0xd001, 0, 1, 0x00 }, 390 { 0xd001, 5, 1, 0x00 }, 391 { 0xd002, 0, 5, 0x19 }, 392 { 0xd003, 0, 5, 0x1a }, 393 { 0xd004, 0, 5, 0x19 }, 394 { 0xd005, 0, 5, 0x1a }, 395 { 0xd00e, 0, 5, 0x10 }, 396 { 0xd00f, 0, 3, 0x04 }, 397 { 0xd00f, 3, 3, 0x05 }, 398 { 0xd010, 0, 3, 0x04 }, 399 { 0xd010, 3, 3, 0x05 }, 400 { 0xd016, 4, 4, 0x03 }, 401 { 0xd01f, 0, 6, 0x0a }, 402 { 0xd020, 0, 6, 0x0a }, 403 { 0x9bda, 0, 8, 0x00 }, 404 { 0x9be3, 0, 8, 0x00 }, 405 { 0x9bfc, 0, 8, 0x0f }, 406 { 0x9bf6, 0, 8, 0x01 }, 407 { 0x9bbe, 0, 1, 0x01 }, 408 { 0xd015, 0, 8, 0x33 }, 409 { 0xd016, 0, 1, 0x00 }, 410 { 0xd044, 0, 8, 0x40 }, 411 { 0xd045, 0, 1, 0x00 }, 412 { 0xd008, 0, 8, 0x0f }, 413 { 0xd009, 0, 2, 0x02 }, 414 { 0xd006, 0, 8, 0x6c }, 415 { 0xd007, 0, 2, 0x00 }, 416 { 0xd00c, 0, 8, 0x3d }, 417 { 0xd00d, 0, 2, 0x00 }, 418 { 0xd00a, 0, 8, 0x45 }, 419 { 0xd00b, 0, 2, 0x01 }, 420 { 0x9bc7, 0, 8, 0x07 }, 421 { 0x9bc8, 0, 8, 0x52 }, 422 { 0x9bc3, 0, 8, 0x0f }, 423 { 0x9bc4, 0, 8, 0x02 }, 424 { 0x9bc5, 0, 8, 0x3d }, 425 { 0x9bc6, 0, 8, 0x00 }, 426 { 0x9bba, 0, 8, 0xa2 }, 427 { 0x9bc9, 0, 8, 0xa0 }, 428 { 0xd011, 0, 8, 0x56 }, 429 { 0xd012, 0, 2, 0x00 }, 430 { 0xd013, 0, 8, 0x50 }, 431 { 0xd014, 0, 2, 0x00 }, 432 { 0xd040, 0, 8, 0x56 }, 433 { 0xd041, 0, 2, 0x00 }, 434 { 0xd042, 0, 8, 0x50 }, 435 { 0xd043, 0, 2, 0x00 }, 436 { 0xd045, 1, 1, 0x00 }, 437 { 0x9bcf, 0, 8, 0x01 }, 438 { 0xd045, 2, 1, 0x01 }, 439 { 0xd04f, 0, 8, 0x9a }, 440 { 0xd050, 0, 1, 0x01 }, 441 { 0xd051, 0, 8, 0x5a }, 442 { 0xd052, 0, 1, 0x01 }, 443 { 0xd053, 0, 8, 0x50 }, 444 { 0xd054, 0, 8, 0x46 }, 445 { 0x9bd7, 0, 8, 0x0a }, 446 { 0x9bd8, 0, 8, 0x14 }, 447 { 0x9bd9, 0, 8, 0x08 }, 448 }; 449 450 /* MaxLinear MXL5005S & MXL5007T tuner init 451 AF9013_TUNER_MXL5005D = 13 452 AF9013_TUNER_MXL5005R = 30 453 AF9013_TUNER_MXL5007T = 177 */ 454 static const struct af9013_reg_bit tuner_init_mxl5005[] = { 455 { 0x9bd5, 0, 8, 0x01 }, 456 { 0x9bd6, 0, 8, 0x07 }, 457 { 0xd1a0, 1, 1, 0x01 }, 458 { 0xd000, 0, 1, 0x01 }, 459 { 0xd000, 1, 1, 0x00 }, 460 { 0xd001, 1, 1, 0x01 }, 461 { 0xd001, 0, 1, 0x00 }, 462 { 0xd001, 5, 1, 0x00 }, 463 { 0xd002, 0, 5, 0x19 }, 464 { 0xd003, 0, 5, 0x1a }, 465 { 0xd004, 0, 5, 0x19 }, 466 { 0xd005, 0, 5, 0x1a }, 467 { 0xd00e, 0, 5, 0x10 }, 468 { 0xd00f, 0, 3, 0x04 }, 469 { 0xd00f, 3, 3, 0x05 }, 470 { 0xd010, 0, 3, 0x04 }, 471 { 0xd010, 3, 3, 0x05 }, 472 { 0xd016, 4, 4, 0x03 }, 473 { 0xd01f, 0, 6, 0x0a }, 474 { 0xd020, 0, 6, 0x0a }, 475 { 0x9bda, 0, 8, 0x01 }, 476 { 0x9be3, 0, 8, 0x01 }, 477 { 0x9bbe, 0, 1, 0x01 }, 478 { 0x9bcc, 0, 1, 0x01 }, 479 { 0x9bb9, 0, 8, 0x00 }, 480 { 0x9bcd, 0, 8, 0x28 }, 481 { 0x9bff, 0, 8, 0x24 }, 482 { 0xd015, 0, 8, 0x40 }, 483 { 0xd016, 0, 1, 0x00 }, 484 { 0xd044, 0, 8, 0x40 }, 485 { 0xd045, 0, 1, 0x00 }, 486 { 0xd008, 0, 8, 0x0f }, 487 { 0xd009, 0, 2, 0x02 }, 488 { 0xd006, 0, 8, 0x73 }, 489 { 0xd007, 0, 2, 0x01 }, 490 { 0xd00c, 0, 8, 0xfa }, 491 { 0xd00d, 0, 2, 0x01 }, 492 { 0xd00a, 0, 8, 0xff }, 493 { 0xd00b, 0, 2, 0x01 }, 494 { 0x9bc7, 0, 8, 0x23 }, 495 { 0x9bc8, 0, 8, 0x55 }, 496 { 0x9bc3, 0, 8, 0x01 }, 497 { 0x9bc4, 0, 8, 0x02 }, 498 { 0x9bc5, 0, 8, 0xfa }, 499 { 0x9bc6, 0, 8, 0x01 }, 500 { 0x9bba, 0, 8, 0xff }, 501 { 0x9bc9, 0, 8, 0xff }, 502 { 0x9bd3, 0, 8, 0x95 }, 503 { 0xd011, 0, 8, 0x70 }, 504 { 0xd012, 0, 2, 0x01 }, 505 { 0xd013, 0, 8, 0xfb }, 506 { 0xd014, 0, 2, 0x01 }, 507 { 0xd040, 0, 8, 0x70 }, 508 { 0xd041, 0, 2, 0x01 }, 509 { 0xd042, 0, 8, 0xfb }, 510 { 0xd043, 0, 2, 0x01 }, 511 { 0xd045, 1, 1, 0x00 }, 512 { 0x9bcf, 0, 1, 0x01 }, 513 { 0xd045, 2, 1, 0x01 }, 514 { 0xd04f, 0, 8, 0x9a }, 515 { 0xd050, 0, 1, 0x01 }, 516 { 0xd051, 0, 8, 0x5a }, 517 { 0xd052, 0, 1, 0x01 }, 518 { 0xd053, 0, 8, 0x50 }, 519 { 0xd054, 0, 8, 0x46 }, 520 { 0x9bd7, 0, 8, 0x0a }, 521 { 0x9bd8, 0, 8, 0x14 }, 522 { 0x9bd9, 0, 8, 0x08 }, 523 { 0x9bd0, 0, 8, 0x93 }, 524 { 0x9be4, 0, 8, 0xfe }, 525 { 0x9bbd, 0, 8, 0x63 }, 526 { 0x9be2, 0, 8, 0xfe }, 527 { 0x9bee, 0, 1, 0x01 }, 528 }; 529 530 /* Quantek QT1010 tuner init 531 AF9013_TUNER_QT1010 = 134 532 AF9013_TUNER_QT1010A = 162 */ 533 static const struct af9013_reg_bit tuner_init_qt1010[] = { 534 { 0x9bd5, 0, 8, 0x01 }, 535 { 0x9bd6, 0, 8, 0x09 }, 536 { 0xd1a0, 1, 1, 0x01 }, 537 { 0xd000, 0, 1, 0x01 }, 538 { 0xd000, 1, 1, 0x00 }, 539 { 0xd001, 1, 1, 0x01 }, 540 { 0xd001, 0, 1, 0x00 }, 541 { 0xd001, 5, 1, 0x00 }, 542 { 0xd002, 0, 5, 0x19 }, 543 { 0xd003, 0, 5, 0x1a }, 544 { 0xd004, 0, 5, 0x19 }, 545 { 0xd005, 0, 5, 0x1a }, 546 { 0xd00e, 0, 5, 0x10 }, 547 { 0xd00f, 0, 3, 0x04 }, 548 { 0xd00f, 3, 3, 0x05 }, 549 { 0xd010, 0, 3, 0x04 }, 550 { 0xd010, 3, 3, 0x05 }, 551 { 0xd016, 4, 4, 0x03 }, 552 { 0xd01f, 0, 6, 0x0a }, 553 { 0xd020, 0, 6, 0x0a }, 554 { 0x9bda, 0, 8, 0x01 }, 555 { 0x9be3, 0, 8, 0x01 }, 556 { 0xd015, 0, 8, 0x46 }, 557 { 0xd016, 0, 1, 0x00 }, 558 { 0xd044, 0, 8, 0x46 }, 559 { 0xd045, 0, 1, 0x00 }, 560 { 0x9bbe, 0, 1, 0x01 }, 561 { 0x9bcc, 0, 1, 0x01 }, 562 { 0x9bb9, 0, 8, 0x00 }, 563 { 0x9bcd, 0, 8, 0x28 }, 564 { 0x9bff, 0, 8, 0x20 }, 565 { 0xd008, 0, 8, 0x0f }, 566 { 0xd009, 0, 2, 0x02 }, 567 { 0xd006, 0, 8, 0x99 }, 568 { 0xd007, 0, 2, 0x01 }, 569 { 0xd00c, 0, 8, 0x0f }, 570 { 0xd00d, 0, 2, 0x02 }, 571 { 0xd00a, 0, 8, 0x50 }, 572 { 0xd00b, 0, 2, 0x01 }, 573 { 0x9bc7, 0, 8, 0x00 }, 574 { 0x9bc8, 0, 8, 0x00 }, 575 { 0x9bc3, 0, 8, 0x0f }, 576 { 0x9bc4, 0, 8, 0x02 }, 577 { 0x9bc5, 0, 8, 0x0f }, 578 { 0x9bc6, 0, 8, 0x02 }, 579 { 0x9bba, 0, 8, 0xc5 }, 580 { 0x9bc9, 0, 8, 0xff }, 581 { 0xd011, 0, 8, 0x58 }, 582 { 0xd012, 0, 2, 0x02 }, 583 { 0xd013, 0, 8, 0x89 }, 584 { 0xd014, 0, 2, 0x01 }, 585 { 0xd040, 0, 8, 0x58 }, 586 { 0xd041, 0, 2, 0x02 }, 587 { 0xd042, 0, 8, 0x89 }, 588 { 0xd043, 0, 2, 0x01 }, 589 { 0xd045, 1, 1, 0x00 }, 590 { 0x9bcf, 0, 1, 0x01 }, 591 { 0xd045, 2, 1, 0x01 }, 592 { 0xd04f, 0, 8, 0x9a }, 593 { 0xd050, 0, 1, 0x01 }, 594 { 0xd051, 0, 8, 0x5a }, 595 { 0xd052, 0, 1, 0x01 }, 596 { 0xd053, 0, 8, 0x50 }, 597 { 0xd054, 0, 8, 0x46 }, 598 { 0x9bd7, 0, 8, 0x0a }, 599 { 0x9bd8, 0, 8, 0x14 }, 600 { 0x9bd9, 0, 8, 0x08 }, 601 { 0x9bd0, 0, 8, 0xcd }, 602 { 0x9be4, 0, 8, 0xbb }, 603 { 0x9bbd, 0, 8, 0x93 }, 604 { 0x9be2, 0, 8, 0x80 }, 605 { 0x9bee, 0, 1, 0x01 }, 606 }; 607 608 /* Freescale MC44S803 tuner init 609 AF9013_TUNER_MC44S803 = 133 */ 610 static const struct af9013_reg_bit tuner_init_mc44s803[] = { 611 { 0x9bd5, 0, 8, 0x01 }, 612 { 0x9bd6, 0, 8, 0x06 }, 613 { 0xd1a0, 1, 1, 0x01 }, 614 { 0xd000, 0, 1, 0x01 }, 615 { 0xd000, 1, 1, 0x00 }, 616 { 0xd001, 1, 1, 0x01 }, 617 { 0xd001, 0, 1, 0x00 }, 618 { 0xd001, 5, 1, 0x00 }, 619 { 0xd002, 0, 5, 0x19 }, 620 { 0xd003, 0, 5, 0x1a }, 621 { 0xd004, 0, 5, 0x19 }, 622 { 0xd005, 0, 5, 0x1a }, 623 { 0xd00e, 0, 5, 0x10 }, 624 { 0xd00f, 0, 3, 0x04 }, 625 { 0xd00f, 3, 3, 0x05 }, 626 { 0xd010, 0, 3, 0x04 }, 627 { 0xd010, 3, 3, 0x05 }, 628 { 0xd016, 4, 4, 0x03 }, 629 { 0xd01f, 0, 6, 0x0a }, 630 { 0xd020, 0, 6, 0x0a }, 631 { 0x9bda, 0, 8, 0x00 }, 632 { 0x9be3, 0, 8, 0x00 }, 633 { 0x9bf6, 0, 8, 0x01 }, 634 { 0x9bf8, 0, 8, 0x02 }, 635 { 0x9bf9, 0, 8, 0x02 }, 636 { 0x9bfc, 0, 8, 0x1f }, 637 { 0x9bbe, 0, 1, 0x01 }, 638 { 0x9bcc, 0, 1, 0x01 }, 639 { 0x9bb9, 0, 8, 0x00 }, 640 { 0x9bcd, 0, 8, 0x24 }, 641 { 0x9bff, 0, 8, 0x24 }, 642 { 0xd015, 0, 8, 0x46 }, 643 { 0xd016, 0, 1, 0x00 }, 644 { 0xd044, 0, 8, 0x46 }, 645 { 0xd045, 0, 1, 0x00 }, 646 { 0xd008, 0, 8, 0x01 }, 647 { 0xd009, 0, 2, 0x02 }, 648 { 0xd006, 0, 8, 0x7b }, 649 { 0xd007, 0, 2, 0x00 }, 650 { 0xd00c, 0, 8, 0x7c }, 651 { 0xd00d, 0, 2, 0x02 }, 652 { 0xd00a, 0, 8, 0xfe }, 653 { 0xd00b, 0, 2, 0x01 }, 654 { 0x9bc7, 0, 8, 0x08 }, 655 { 0x9bc8, 0, 8, 0x9a }, 656 { 0x9bc3, 0, 8, 0x01 }, 657 { 0x9bc4, 0, 8, 0x02 }, 658 { 0x9bc5, 0, 8, 0x7c }, 659 { 0x9bc6, 0, 8, 0x02 }, 660 { 0x9bba, 0, 8, 0xfc }, 661 { 0x9bc9, 0, 8, 0xaa }, 662 { 0xd011, 0, 8, 0x6b }, 663 { 0xd012, 0, 2, 0x00 }, 664 { 0xd013, 0, 8, 0x88 }, 665 { 0xd014, 0, 2, 0x02 }, 666 { 0xd040, 0, 8, 0x6b }, 667 { 0xd041, 0, 2, 0x00 }, 668 { 0xd042, 0, 8, 0x7c }, 669 { 0xd043, 0, 2, 0x02 }, 670 { 0xd045, 1, 1, 0x00 }, 671 { 0x9bcf, 0, 1, 0x01 }, 672 { 0xd045, 2, 1, 0x01 }, 673 { 0xd04f, 0, 8, 0x9a }, 674 { 0xd050, 0, 1, 0x01 }, 675 { 0xd051, 0, 8, 0x5a }, 676 { 0xd052, 0, 1, 0x01 }, 677 { 0xd053, 0, 8, 0x50 }, 678 { 0xd054, 0, 8, 0x46 }, 679 { 0x9bd7, 0, 8, 0x0a }, 680 { 0x9bd8, 0, 8, 0x14 }, 681 { 0x9bd9, 0, 8, 0x08 }, 682 { 0x9bd0, 0, 8, 0x9e }, 683 { 0x9be4, 0, 8, 0xff }, 684 { 0x9bbd, 0, 8, 0x9e }, 685 { 0x9be2, 0, 8, 0x25 }, 686 { 0x9bee, 0, 1, 0x01 }, 687 { 0xd73b, 3, 1, 0x00 }, 688 }; 689 690 /* unknown, probably for tin can tuner, tuner init 691 AF9013_TUNER_UNKNOWN = 140 */ 692 static const struct af9013_reg_bit tuner_init_unknown[] = { 693 { 0x9bd5, 0, 8, 0x01 }, 694 { 0x9bd6, 0, 8, 0x02 }, 695 { 0xd1a0, 1, 1, 0x01 }, 696 { 0xd000, 0, 1, 0x01 }, 697 { 0xd000, 1, 1, 0x00 }, 698 { 0xd001, 1, 1, 0x01 }, 699 { 0xd001, 0, 1, 0x00 }, 700 { 0xd001, 5, 1, 0x00 }, 701 { 0xd002, 0, 5, 0x19 }, 702 { 0xd003, 0, 5, 0x1a }, 703 { 0xd004, 0, 5, 0x19 }, 704 { 0xd005, 0, 5, 0x1a }, 705 { 0xd00e, 0, 5, 0x10 }, 706 { 0xd00f, 0, 3, 0x04 }, 707 { 0xd00f, 3, 3, 0x05 }, 708 { 0xd010, 0, 3, 0x04 }, 709 { 0xd010, 3, 3, 0x05 }, 710 { 0xd016, 4, 4, 0x03 }, 711 { 0xd01f, 0, 6, 0x0a }, 712 { 0xd020, 0, 6, 0x0a }, 713 { 0x9bda, 0, 8, 0x01 }, 714 { 0x9be3, 0, 8, 0x01 }, 715 { 0xd1a0, 1, 1, 0x00 }, 716 { 0x9bbe, 0, 1, 0x01 }, 717 { 0x9bcc, 0, 1, 0x01 }, 718 { 0x9bb9, 0, 8, 0x00 }, 719 { 0x9bcd, 0, 8, 0x18 }, 720 { 0x9bff, 0, 8, 0x2c }, 721 { 0xd015, 0, 8, 0x46 }, 722 { 0xd016, 0, 1, 0x00 }, 723 { 0xd044, 0, 8, 0x46 }, 724 { 0xd045, 0, 1, 0x00 }, 725 { 0xd008, 0, 8, 0xdf }, 726 { 0xd009, 0, 2, 0x02 }, 727 { 0xd006, 0, 8, 0x44 }, 728 { 0xd007, 0, 2, 0x01 }, 729 { 0xd00c, 0, 8, 0x00 }, 730 { 0xd00d, 0, 2, 0x02 }, 731 { 0xd00a, 0, 8, 0xf6 }, 732 { 0xd00b, 0, 2, 0x01 }, 733 { 0x9bba, 0, 8, 0xf9 }, 734 { 0x9bc8, 0, 8, 0xaa }, 735 { 0x9bc3, 0, 8, 0xdf }, 736 { 0x9bc4, 0, 8, 0x02 }, 737 { 0x9bc5, 0, 8, 0x00 }, 738 { 0x9bc6, 0, 8, 0x02 }, 739 { 0x9bc9, 0, 8, 0xf0 }, 740 { 0xd011, 0, 8, 0x3c }, 741 { 0xd012, 0, 2, 0x01 }, 742 { 0xd013, 0, 8, 0xf7 }, 743 { 0xd014, 0, 2, 0x02 }, 744 { 0xd040, 0, 8, 0x0b }, 745 { 0xd041, 0, 2, 0x02 }, 746 { 0xd042, 0, 8, 0x4d }, 747 { 0xd043, 0, 2, 0x00 }, 748 { 0xd045, 1, 1, 0x00 }, 749 { 0x9bcf, 0, 1, 0x01 }, 750 { 0xd045, 2, 1, 0x01 }, 751 { 0xd04f, 0, 8, 0x9a }, 752 { 0xd050, 0, 1, 0x01 }, 753 { 0xd051, 0, 8, 0x5a }, 754 { 0xd052, 0, 1, 0x01 }, 755 { 0xd053, 0, 8, 0x50 }, 756 { 0xd054, 0, 8, 0x46 }, 757 { 0x9bd7, 0, 8, 0x0a }, 758 { 0x9bd8, 0, 8, 0x14 }, 759 { 0x9bd9, 0, 8, 0x08 }, 760 }; 761 762 /* NXP TDA18271 & TDA18218 tuner init 763 AF9013_TUNER_TDA18271 = 156 764 AF9013_TUNER_TDA18218 = 179 */ 765 static const struct af9013_reg_bit tuner_init_tda18271[] = { 766 { 0x9bd5, 0, 8, 0x01 }, 767 { 0x9bd6, 0, 8, 0x04 }, 768 { 0xd1a0, 1, 1, 0x01 }, 769 { 0xd000, 0, 1, 0x01 }, 770 { 0xd000, 1, 1, 0x00 }, 771 { 0xd001, 1, 1, 0x01 }, 772 { 0xd001, 0, 1, 0x00 }, 773 { 0xd001, 5, 1, 0x00 }, 774 { 0xd002, 0, 5, 0x19 }, 775 { 0xd003, 0, 5, 0x1a }, 776 { 0xd004, 0, 5, 0x19 }, 777 { 0xd005, 0, 5, 0x1a }, 778 { 0xd00e, 0, 5, 0x10 }, 779 { 0xd00f, 0, 3, 0x04 }, 780 { 0xd00f, 3, 3, 0x05 }, 781 { 0xd010, 0, 3, 0x04 }, 782 { 0xd010, 3, 3, 0x05 }, 783 { 0xd016, 4, 4, 0x03 }, 784 { 0xd01f, 0, 6, 0x0a }, 785 { 0xd020, 0, 6, 0x0a }, 786 { 0x9bda, 0, 8, 0x01 }, 787 { 0x9be3, 0, 8, 0x01 }, 788 { 0xd1a0, 1, 1, 0x00 }, 789 { 0x9bbe, 0, 1, 0x01 }, 790 { 0x9bcc, 0, 1, 0x01 }, 791 { 0x9bb9, 0, 8, 0x00 }, 792 { 0x9bcd, 0, 8, 0x18 }, 793 { 0x9bff, 0, 8, 0x2c }, 794 { 0xd015, 0, 8, 0x46 }, 795 { 0xd016, 0, 1, 0x00 }, 796 { 0xd044, 0, 8, 0x46 }, 797 { 0xd045, 0, 1, 0x00 }, 798 { 0xd008, 0, 8, 0xdf }, 799 { 0xd009, 0, 2, 0x02 }, 800 { 0xd006, 0, 8, 0x44 }, 801 { 0xd007, 0, 2, 0x01 }, 802 { 0xd00c, 0, 8, 0x00 }, 803 { 0xd00d, 0, 2, 0x02 }, 804 { 0xd00a, 0, 8, 0xf6 }, 805 { 0xd00b, 0, 2, 0x01 }, 806 { 0x9bba, 0, 8, 0xf9 }, 807 { 0x9bc8, 0, 8, 0xaa }, 808 { 0x9bc3, 0, 8, 0xdf }, 809 { 0x9bc4, 0, 8, 0x02 }, 810 { 0x9bc5, 0, 8, 0x00 }, 811 { 0x9bc6, 0, 8, 0x02 }, 812 { 0x9bc9, 0, 8, 0xf0 }, 813 { 0xd011, 0, 8, 0x3c }, 814 { 0xd012, 0, 2, 0x01 }, 815 { 0xd013, 0, 8, 0xf7 }, 816 { 0xd014, 0, 2, 0x02 }, 817 { 0xd040, 0, 8, 0x0b }, 818 { 0xd041, 0, 2, 0x02 }, 819 { 0xd042, 0, 8, 0x4d }, 820 { 0xd043, 0, 2, 0x00 }, 821 { 0xd045, 1, 1, 0x00 }, 822 { 0x9bcf, 0, 1, 0x01 }, 823 { 0xd045, 2, 1, 0x01 }, 824 { 0xd04f, 0, 8, 0x9a }, 825 { 0xd050, 0, 1, 0x01 }, 826 { 0xd051, 0, 8, 0x5a }, 827 { 0xd052, 0, 1, 0x01 }, 828 { 0xd053, 0, 8, 0x50 }, 829 { 0xd054, 0, 8, 0x46 }, 830 { 0x9bd7, 0, 8, 0x0a }, 831 { 0x9bd8, 0, 8, 0x14 }, 832 { 0x9bd9, 0, 8, 0x08 }, 833 { 0x9bd0, 0, 8, 0xa8 }, 834 { 0x9be4, 0, 8, 0x7f }, 835 { 0x9bbd, 0, 8, 0xa8 }, 836 { 0x9be2, 0, 8, 0x20 }, 837 { 0x9bee, 0, 1, 0x01 }, 838 }; 839 840 #endif /* AF9013_PRIV_H */ 841