af9013_priv.h 20 KB

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