tda18271-maps.c 44 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091929394959697989910010110210310410510610710810911011111211311411511611711811912012112212312412512612712812913013113213313413513613713813914014114214314414514614714814915015115215315415515615715815916016116216316416516616716816917017117217317417517617717817918018118218318418518618718818919019119219319419519619719819920020120220320420520620720820921021121221321421521621721821922022122222322422522622722822923023123223323423523623723823924024124224324424524624724824925025125225325425525625725825926026126226326426526626726826927027127227327427527627727827928028128228328428528628728828929029129229329429529629729829930030130230330430530630730830931031131231331431531631731831932032132232332432532632732832933033133233333433533633733833934034134234334434534634734834935035135235335435535635735835936036136236336436536636736836937037137237337437537637737837938038138238338438538638738838939039139239339439539639739839940040140240340440540640740840941041141241341441541641741841942042142242342442542642742842943043143243343443543643743843944044144244344444544644744844945045145245345445545645745845946046146246346446546646746846947047147247347447547647747847948048148248348448548648748848949049149249349449549649749849950050150250350450550650750850951051151251351451551651751851952052152252352452552652752852953053153253353453553653753853954054154254354454554654754854955055155255355455555655755855956056156256356456556656756856957057157257357457557657757857958058158258358458558658758858959059159259359459559659759859960060160260360460560660760860961061161261361461561661761861962062162262362462562662762862963063163263363463563663763863964064164264364464564664764864965065165265365465565665765865966066166266366466566666766866967067167267367467567667767867968068168268368468568668768868969069169269369469569669769869970070170270370470570670770870971071171271371471571671771871972072172272372472572672772872973073173273373473573673773873974074174274374474574674774874975075175275375475575675775875976076176276376476576676776876977077177277377477577677777877978078178278378478578678778878979079179279379479579679779879980080180280380480580680780880981081181281381481581681781881982082182282382482582682782882983083183283383483583683783883984084184284384484584684784884985085185285385485585685785885986086186286386486586686786886987087187287387487587687787887988088188288388488588688788888989089189289389489589689789889990090190290390490590690790890991091191291391491591691791891992092192292392492592692792892993093193293393493593693793893994094194294394494594694794894995095195295395495595695795895996096196296396496596696796896997097197297397497597697797897998098198298398498598698798898999099199299399499599699799899910001001100210031004100510061007100810091010101110121013101410151016101710181019102010211022102310241025102610271028102910301031103210331034103510361037103810391040104110421043104410451046104710481049105010511052105310541055105610571058105910601061106210631064106510661067106810691070107110721073107410751076107710781079108010811082108310841085108610871088108910901091109210931094109510961097109810991100110111021103110411051106110711081109111011111112111311141115111611171118111911201121112211231124112511261127112811291130113111321133113411351136113711381139114011411142114311441145114611471148114911501151115211531154115511561157115811591160116111621163116411651166116711681169117011711172117311741175117611771178117911801181118211831184118511861187118811891190119111921193119411951196119711981199120012011202120312041205120612071208120912101211121212131214121512161217121812191220122112221223122412251226122712281229123012311232123312341235123612371238123912401241124212431244124512461247124812491250125112521253125412551256125712581259126012611262126312641265126612671268126912701271127212731274127512761277127812791280128112821283128412851286128712881289129012911292129312941295129612971298129913001301130213031304130513061307
  1. /*
  2. tda18271-maps.c - driver for the Philips / NXP TDA18271 silicon tuner
  3. Copyright (C) 2007, 2008 Michael Krufky <mkrufky@linuxtv.org>
  4. This program is free software; you can redistribute it and/or modify
  5. it under the terms of the GNU General Public License as published by
  6. the Free Software Foundation; either version 2 of the License, or
  7. (at your option) any later version.
  8. This program is distributed in the hope that it will be useful,
  9. but WITHOUT ANY WARRANTY; without even the implied warranty of
  10. MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
  11. GNU General Public License for more details.
  12. You should have received a copy of the GNU General Public License
  13. along with this program; if not, write to the Free Software
  14. Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
  15. */
  16. #include "tda18271-priv.h"
  17. struct tda18271_pll_map {
  18. u32 lomax;
  19. u8 pd; /* post div */
  20. u8 d; /* div */
  21. };
  22. struct tda18271_map {
  23. u32 rfmax;
  24. u8 val;
  25. };
  26. /*---------------------------------------------------------------------*/
  27. static struct tda18271_pll_map tda18271c1_main_pll[] = {
  28. { .lomax = 32000, .pd = 0x5f, .d = 0xf0 },
  29. { .lomax = 35000, .pd = 0x5e, .d = 0xe0 },
  30. { .lomax = 37000, .pd = 0x5d, .d = 0xd0 },
  31. { .lomax = 41000, .pd = 0x5c, .d = 0xc0 },
  32. { .lomax = 44000, .pd = 0x5b, .d = 0xb0 },
  33. { .lomax = 49000, .pd = 0x5a, .d = 0xa0 },
  34. { .lomax = 54000, .pd = 0x59, .d = 0x90 },
  35. { .lomax = 61000, .pd = 0x58, .d = 0x80 },
  36. { .lomax = 65000, .pd = 0x4f, .d = 0x78 },
  37. { .lomax = 70000, .pd = 0x4e, .d = 0x70 },
  38. { .lomax = 75000, .pd = 0x4d, .d = 0x68 },
  39. { .lomax = 82000, .pd = 0x4c, .d = 0x60 },
  40. { .lomax = 89000, .pd = 0x4b, .d = 0x58 },
  41. { .lomax = 98000, .pd = 0x4a, .d = 0x50 },
  42. { .lomax = 109000, .pd = 0x49, .d = 0x48 },
  43. { .lomax = 123000, .pd = 0x48, .d = 0x40 },
  44. { .lomax = 131000, .pd = 0x3f, .d = 0x3c },
  45. { .lomax = 141000, .pd = 0x3e, .d = 0x38 },
  46. { .lomax = 151000, .pd = 0x3d, .d = 0x34 },
  47. { .lomax = 164000, .pd = 0x3c, .d = 0x30 },
  48. { .lomax = 179000, .pd = 0x3b, .d = 0x2c },
  49. { .lomax = 197000, .pd = 0x3a, .d = 0x28 },
  50. { .lomax = 219000, .pd = 0x39, .d = 0x24 },
  51. { .lomax = 246000, .pd = 0x38, .d = 0x20 },
  52. { .lomax = 263000, .pd = 0x2f, .d = 0x1e },
  53. { .lomax = 282000, .pd = 0x2e, .d = 0x1c },
  54. { .lomax = 303000, .pd = 0x2d, .d = 0x1a },
  55. { .lomax = 329000, .pd = 0x2c, .d = 0x18 },
  56. { .lomax = 359000, .pd = 0x2b, .d = 0x16 },
  57. { .lomax = 395000, .pd = 0x2a, .d = 0x14 },
  58. { .lomax = 438000, .pd = 0x29, .d = 0x12 },
  59. { .lomax = 493000, .pd = 0x28, .d = 0x10 },
  60. { .lomax = 526000, .pd = 0x1f, .d = 0x0f },
  61. { .lomax = 564000, .pd = 0x1e, .d = 0x0e },
  62. { .lomax = 607000, .pd = 0x1d, .d = 0x0d },
  63. { .lomax = 658000, .pd = 0x1c, .d = 0x0c },
  64. { .lomax = 718000, .pd = 0x1b, .d = 0x0b },
  65. { .lomax = 790000, .pd = 0x1a, .d = 0x0a },
  66. { .lomax = 877000, .pd = 0x19, .d = 0x09 },
  67. { .lomax = 987000, .pd = 0x18, .d = 0x08 },
  68. { .lomax = 0, .pd = 0x00, .d = 0x00 }, /* end */
  69. };
  70. static struct tda18271_pll_map tda18271c2_main_pll[] = {
  71. { .lomax = 33125, .pd = 0x57, .d = 0xf0 },
  72. { .lomax = 35500, .pd = 0x56, .d = 0xe0 },
  73. { .lomax = 38188, .pd = 0x55, .d = 0xd0 },
  74. { .lomax = 41375, .pd = 0x54, .d = 0xc0 },
  75. { .lomax = 45125, .pd = 0x53, .d = 0xb0 },
  76. { .lomax = 49688, .pd = 0x52, .d = 0xa0 },
  77. { .lomax = 55188, .pd = 0x51, .d = 0x90 },
  78. { .lomax = 62125, .pd = 0x50, .d = 0x80 },
  79. { .lomax = 66250, .pd = 0x47, .d = 0x78 },
  80. { .lomax = 71000, .pd = 0x46, .d = 0x70 },
  81. { .lomax = 76375, .pd = 0x45, .d = 0x68 },
  82. { .lomax = 82750, .pd = 0x44, .d = 0x60 },
  83. { .lomax = 90250, .pd = 0x43, .d = 0x58 },
  84. { .lomax = 99375, .pd = 0x42, .d = 0x50 },
  85. { .lomax = 110375, .pd = 0x41, .d = 0x48 },
  86. { .lomax = 124250, .pd = 0x40, .d = 0x40 },
  87. { .lomax = 132500, .pd = 0x37, .d = 0x3c },
  88. { .lomax = 142000, .pd = 0x36, .d = 0x38 },
  89. { .lomax = 152750, .pd = 0x35, .d = 0x34 },
  90. { .lomax = 165500, .pd = 0x34, .d = 0x30 },
  91. { .lomax = 180500, .pd = 0x33, .d = 0x2c },
  92. { .lomax = 198750, .pd = 0x32, .d = 0x28 },
  93. { .lomax = 220750, .pd = 0x31, .d = 0x24 },
  94. { .lomax = 248500, .pd = 0x30, .d = 0x20 },
  95. { .lomax = 265000, .pd = 0x27, .d = 0x1e },
  96. { .lomax = 284000, .pd = 0x26, .d = 0x1c },
  97. { .lomax = 305500, .pd = 0x25, .d = 0x1a },
  98. { .lomax = 331000, .pd = 0x24, .d = 0x18 },
  99. { .lomax = 361000, .pd = 0x23, .d = 0x16 },
  100. { .lomax = 397500, .pd = 0x22, .d = 0x14 },
  101. { .lomax = 441500, .pd = 0x21, .d = 0x12 },
  102. { .lomax = 497000, .pd = 0x20, .d = 0x10 },
  103. { .lomax = 530000, .pd = 0x17, .d = 0x0f },
  104. { .lomax = 568000, .pd = 0x16, .d = 0x0e },
  105. { .lomax = 611000, .pd = 0x15, .d = 0x0d },
  106. { .lomax = 662000, .pd = 0x14, .d = 0x0c },
  107. { .lomax = 722000, .pd = 0x13, .d = 0x0b },
  108. { .lomax = 795000, .pd = 0x12, .d = 0x0a },
  109. { .lomax = 883000, .pd = 0x11, .d = 0x09 },
  110. { .lomax = 994000, .pd = 0x10, .d = 0x08 },
  111. { .lomax = 0, .pd = 0x00, .d = 0x00 }, /* end */
  112. };
  113. static struct tda18271_pll_map tda18271c1_cal_pll[] = {
  114. { .lomax = 33000, .pd = 0xdd, .d = 0xd0 },
  115. { .lomax = 36000, .pd = 0xdc, .d = 0xc0 },
  116. { .lomax = 40000, .pd = 0xdb, .d = 0xb0 },
  117. { .lomax = 44000, .pd = 0xda, .d = 0xa0 },
  118. { .lomax = 49000, .pd = 0xd9, .d = 0x90 },
  119. { .lomax = 55000, .pd = 0xd8, .d = 0x80 },
  120. { .lomax = 63000, .pd = 0xd3, .d = 0x70 },
  121. { .lomax = 67000, .pd = 0xcd, .d = 0x68 },
  122. { .lomax = 73000, .pd = 0xcc, .d = 0x60 },
  123. { .lomax = 80000, .pd = 0xcb, .d = 0x58 },
  124. { .lomax = 88000, .pd = 0xca, .d = 0x50 },
  125. { .lomax = 98000, .pd = 0xc9, .d = 0x48 },
  126. { .lomax = 110000, .pd = 0xc8, .d = 0x40 },
  127. { .lomax = 126000, .pd = 0xc3, .d = 0x38 },
  128. { .lomax = 135000, .pd = 0xbd, .d = 0x34 },
  129. { .lomax = 147000, .pd = 0xbc, .d = 0x30 },
  130. { .lomax = 160000, .pd = 0xbb, .d = 0x2c },
  131. { .lomax = 176000, .pd = 0xba, .d = 0x28 },
  132. { .lomax = 196000, .pd = 0xb9, .d = 0x24 },
  133. { .lomax = 220000, .pd = 0xb8, .d = 0x20 },
  134. { .lomax = 252000, .pd = 0xb3, .d = 0x1c },
  135. { .lomax = 271000, .pd = 0xad, .d = 0x1a },
  136. { .lomax = 294000, .pd = 0xac, .d = 0x18 },
  137. { .lomax = 321000, .pd = 0xab, .d = 0x16 },
  138. { .lomax = 353000, .pd = 0xaa, .d = 0x14 },
  139. { .lomax = 392000, .pd = 0xa9, .d = 0x12 },
  140. { .lomax = 441000, .pd = 0xa8, .d = 0x10 },
  141. { .lomax = 505000, .pd = 0xa3, .d = 0x0e },
  142. { .lomax = 543000, .pd = 0x9d, .d = 0x0d },
  143. { .lomax = 589000, .pd = 0x9c, .d = 0x0c },
  144. { .lomax = 642000, .pd = 0x9b, .d = 0x0b },
  145. { .lomax = 707000, .pd = 0x9a, .d = 0x0a },
  146. { .lomax = 785000, .pd = 0x99, .d = 0x09 },
  147. { .lomax = 883000, .pd = 0x98, .d = 0x08 },
  148. { .lomax = 1010000, .pd = 0x93, .d = 0x07 },
  149. { .lomax = 0, .pd = 0x00, .d = 0x00 }, /* end */
  150. };
  151. static struct tda18271_pll_map tda18271c2_cal_pll[] = {
  152. { .lomax = 33813, .pd = 0xdd, .d = 0xd0 },
  153. { .lomax = 36625, .pd = 0xdc, .d = 0xc0 },
  154. { .lomax = 39938, .pd = 0xdb, .d = 0xb0 },
  155. { .lomax = 43938, .pd = 0xda, .d = 0xa0 },
  156. { .lomax = 48813, .pd = 0xd9, .d = 0x90 },
  157. { .lomax = 54938, .pd = 0xd8, .d = 0x80 },
  158. { .lomax = 62813, .pd = 0xd3, .d = 0x70 },
  159. { .lomax = 67625, .pd = 0xcd, .d = 0x68 },
  160. { .lomax = 73250, .pd = 0xcc, .d = 0x60 },
  161. { .lomax = 79875, .pd = 0xcb, .d = 0x58 },
  162. { .lomax = 87875, .pd = 0xca, .d = 0x50 },
  163. { .lomax = 97625, .pd = 0xc9, .d = 0x48 },
  164. { .lomax = 109875, .pd = 0xc8, .d = 0x40 },
  165. { .lomax = 125625, .pd = 0xc3, .d = 0x38 },
  166. { .lomax = 135250, .pd = 0xbd, .d = 0x34 },
  167. { .lomax = 146500, .pd = 0xbc, .d = 0x30 },
  168. { .lomax = 159750, .pd = 0xbb, .d = 0x2c },
  169. { .lomax = 175750, .pd = 0xba, .d = 0x28 },
  170. { .lomax = 195250, .pd = 0xb9, .d = 0x24 },
  171. { .lomax = 219750, .pd = 0xb8, .d = 0x20 },
  172. { .lomax = 251250, .pd = 0xb3, .d = 0x1c },
  173. { .lomax = 270500, .pd = 0xad, .d = 0x1a },
  174. { .lomax = 293000, .pd = 0xac, .d = 0x18 },
  175. { .lomax = 319500, .pd = 0xab, .d = 0x16 },
  176. { .lomax = 351500, .pd = 0xaa, .d = 0x14 },
  177. { .lomax = 390500, .pd = 0xa9, .d = 0x12 },
  178. { .lomax = 439500, .pd = 0xa8, .d = 0x10 },
  179. { .lomax = 502500, .pd = 0xa3, .d = 0x0e },
  180. { .lomax = 541000, .pd = 0x9d, .d = 0x0d },
  181. { .lomax = 586000, .pd = 0x9c, .d = 0x0c },
  182. { .lomax = 639000, .pd = 0x9b, .d = 0x0b },
  183. { .lomax = 703000, .pd = 0x9a, .d = 0x0a },
  184. { .lomax = 781000, .pd = 0x99, .d = 0x09 },
  185. { .lomax = 879000, .pd = 0x98, .d = 0x08 },
  186. { .lomax = 0, .pd = 0x00, .d = 0x00 }, /* end */
  187. };
  188. static struct tda18271_map tda18271_bp_filter[] = {
  189. { .rfmax = 62000, .val = 0x00 },
  190. { .rfmax = 84000, .val = 0x01 },
  191. { .rfmax = 100000, .val = 0x02 },
  192. { .rfmax = 140000, .val = 0x03 },
  193. { .rfmax = 170000, .val = 0x04 },
  194. { .rfmax = 180000, .val = 0x05 },
  195. { .rfmax = 865000, .val = 0x06 },
  196. { .rfmax = 0, .val = 0x00 }, /* end */
  197. };
  198. static struct tda18271_map tda18271c1_km[] = {
  199. { .rfmax = 61100, .val = 0x74 },
  200. { .rfmax = 350000, .val = 0x40 },
  201. { .rfmax = 720000, .val = 0x30 },
  202. { .rfmax = 865000, .val = 0x40 },
  203. { .rfmax = 0, .val = 0x00 }, /* end */
  204. };
  205. static struct tda18271_map tda18271c2_km[] = {
  206. { .rfmax = 47900, .val = 0x38 },
  207. { .rfmax = 61100, .val = 0x44 },
  208. { .rfmax = 350000, .val = 0x30 },
  209. { .rfmax = 720000, .val = 0x24 },
  210. { .rfmax = 865000, .val = 0x3c },
  211. { .rfmax = 0, .val = 0x00 }, /* end */
  212. };
  213. static struct tda18271_map tda18271_rf_band[] = {
  214. { .rfmax = 47900, .val = 0x00 },
  215. { .rfmax = 61100, .val = 0x01 },
  216. { .rfmax = 152600, .val = 0x02 },
  217. { .rfmax = 164700, .val = 0x03 },
  218. { .rfmax = 203500, .val = 0x04 },
  219. { .rfmax = 457800, .val = 0x05 },
  220. { .rfmax = 865000, .val = 0x06 },
  221. { .rfmax = 0, .val = 0x00 }, /* end */
  222. };
  223. static struct tda18271_map tda18271_gain_taper[] = {
  224. { .rfmax = 45400, .val = 0x1f },
  225. { .rfmax = 45800, .val = 0x1e },
  226. { .rfmax = 46200, .val = 0x1d },
  227. { .rfmax = 46700, .val = 0x1c },
  228. { .rfmax = 47100, .val = 0x1b },
  229. { .rfmax = 47500, .val = 0x1a },
  230. { .rfmax = 47900, .val = 0x19 },
  231. { .rfmax = 49600, .val = 0x17 },
  232. { .rfmax = 51200, .val = 0x16 },
  233. { .rfmax = 52900, .val = 0x15 },
  234. { .rfmax = 54500, .val = 0x14 },
  235. { .rfmax = 56200, .val = 0x13 },
  236. { .rfmax = 57800, .val = 0x12 },
  237. { .rfmax = 59500, .val = 0x11 },
  238. { .rfmax = 61100, .val = 0x10 },
  239. { .rfmax = 67600, .val = 0x0d },
  240. { .rfmax = 74200, .val = 0x0c },
  241. { .rfmax = 80700, .val = 0x0b },
  242. { .rfmax = 87200, .val = 0x0a },
  243. { .rfmax = 93800, .val = 0x09 },
  244. { .rfmax = 100300, .val = 0x08 },
  245. { .rfmax = 106900, .val = 0x07 },
  246. { .rfmax = 113400, .val = 0x06 },
  247. { .rfmax = 119900, .val = 0x05 },
  248. { .rfmax = 126500, .val = 0x04 },
  249. { .rfmax = 133000, .val = 0x03 },
  250. { .rfmax = 139500, .val = 0x02 },
  251. { .rfmax = 146100, .val = 0x01 },
  252. { .rfmax = 152600, .val = 0x00 },
  253. { .rfmax = 154300, .val = 0x1f },
  254. { .rfmax = 156100, .val = 0x1e },
  255. { .rfmax = 157800, .val = 0x1d },
  256. { .rfmax = 159500, .val = 0x1c },
  257. { .rfmax = 161200, .val = 0x1b },
  258. { .rfmax = 163000, .val = 0x1a },
  259. { .rfmax = 164700, .val = 0x19 },
  260. { .rfmax = 170200, .val = 0x17 },
  261. { .rfmax = 175800, .val = 0x16 },
  262. { .rfmax = 181300, .val = 0x15 },
  263. { .rfmax = 186900, .val = 0x14 },
  264. { .rfmax = 192400, .val = 0x13 },
  265. { .rfmax = 198000, .val = 0x12 },
  266. { .rfmax = 203500, .val = 0x11 },
  267. { .rfmax = 216200, .val = 0x14 },
  268. { .rfmax = 228900, .val = 0x13 },
  269. { .rfmax = 241600, .val = 0x12 },
  270. { .rfmax = 254400, .val = 0x11 },
  271. { .rfmax = 267100, .val = 0x10 },
  272. { .rfmax = 279800, .val = 0x0f },
  273. { .rfmax = 292500, .val = 0x0e },
  274. { .rfmax = 305200, .val = 0x0d },
  275. { .rfmax = 317900, .val = 0x0c },
  276. { .rfmax = 330700, .val = 0x0b },
  277. { .rfmax = 343400, .val = 0x0a },
  278. { .rfmax = 356100, .val = 0x09 },
  279. { .rfmax = 368800, .val = 0x08 },
  280. { .rfmax = 381500, .val = 0x07 },
  281. { .rfmax = 394200, .val = 0x06 },
  282. { .rfmax = 406900, .val = 0x05 },
  283. { .rfmax = 419700, .val = 0x04 },
  284. { .rfmax = 432400, .val = 0x03 },
  285. { .rfmax = 445100, .val = 0x02 },
  286. { .rfmax = 457800, .val = 0x01 },
  287. { .rfmax = 476300, .val = 0x19 },
  288. { .rfmax = 494800, .val = 0x18 },
  289. { .rfmax = 513300, .val = 0x17 },
  290. { .rfmax = 531800, .val = 0x16 },
  291. { .rfmax = 550300, .val = 0x15 },
  292. { .rfmax = 568900, .val = 0x14 },
  293. { .rfmax = 587400, .val = 0x13 },
  294. { .rfmax = 605900, .val = 0x12 },
  295. { .rfmax = 624400, .val = 0x11 },
  296. { .rfmax = 642900, .val = 0x10 },
  297. { .rfmax = 661400, .val = 0x0f },
  298. { .rfmax = 679900, .val = 0x0e },
  299. { .rfmax = 698400, .val = 0x0d },
  300. { .rfmax = 716900, .val = 0x0c },
  301. { .rfmax = 735400, .val = 0x0b },
  302. { .rfmax = 753900, .val = 0x0a },
  303. { .rfmax = 772500, .val = 0x09 },
  304. { .rfmax = 791000, .val = 0x08 },
  305. { .rfmax = 809500, .val = 0x07 },
  306. { .rfmax = 828000, .val = 0x06 },
  307. { .rfmax = 846500, .val = 0x05 },
  308. { .rfmax = 865000, .val = 0x04 },
  309. { .rfmax = 0, .val = 0x00 }, /* end */
  310. };
  311. static struct tda18271_map tda18271c1_rf_cal[] = {
  312. { .rfmax = 41000, .val = 0x1e },
  313. { .rfmax = 43000, .val = 0x30 },
  314. { .rfmax = 45000, .val = 0x43 },
  315. { .rfmax = 46000, .val = 0x4d },
  316. { .rfmax = 47000, .val = 0x54 },
  317. { .rfmax = 47900, .val = 0x64 },
  318. { .rfmax = 49100, .val = 0x20 },
  319. { .rfmax = 50000, .val = 0x22 },
  320. { .rfmax = 51000, .val = 0x2a },
  321. { .rfmax = 53000, .val = 0x32 },
  322. { .rfmax = 55000, .val = 0x35 },
  323. { .rfmax = 56000, .val = 0x3c },
  324. { .rfmax = 57000, .val = 0x3f },
  325. { .rfmax = 58000, .val = 0x48 },
  326. { .rfmax = 59000, .val = 0x4d },
  327. { .rfmax = 60000, .val = 0x58 },
  328. { .rfmax = 61100, .val = 0x5f },
  329. { .rfmax = 0, .val = 0x00 }, /* end */
  330. };
  331. static struct tda18271_map tda18271c2_rf_cal[] = {
  332. { .rfmax = 41000, .val = 0x0f },
  333. { .rfmax = 43000, .val = 0x1c },
  334. { .rfmax = 45000, .val = 0x2f },
  335. { .rfmax = 46000, .val = 0x39 },
  336. { .rfmax = 47000, .val = 0x40 },
  337. { .rfmax = 47900, .val = 0x50 },
  338. { .rfmax = 49100, .val = 0x16 },
  339. { .rfmax = 50000, .val = 0x18 },
  340. { .rfmax = 51000, .val = 0x20 },
  341. { .rfmax = 53000, .val = 0x28 },
  342. { .rfmax = 55000, .val = 0x2b },
  343. { .rfmax = 56000, .val = 0x32 },
  344. { .rfmax = 57000, .val = 0x35 },
  345. { .rfmax = 58000, .val = 0x3e },
  346. { .rfmax = 59000, .val = 0x43 },
  347. { .rfmax = 60000, .val = 0x4e },
  348. { .rfmax = 61100, .val = 0x55 },
  349. { .rfmax = 63000, .val = 0x0f },
  350. { .rfmax = 64000, .val = 0x11 },
  351. { .rfmax = 65000, .val = 0x12 },
  352. { .rfmax = 66000, .val = 0x15 },
  353. { .rfmax = 67000, .val = 0x16 },
  354. { .rfmax = 68000, .val = 0x17 },
  355. { .rfmax = 70000, .val = 0x19 },
  356. { .rfmax = 71000, .val = 0x1c },
  357. { .rfmax = 72000, .val = 0x1d },
  358. { .rfmax = 73000, .val = 0x1f },
  359. { .rfmax = 74000, .val = 0x20 },
  360. { .rfmax = 75000, .val = 0x21 },
  361. { .rfmax = 76000, .val = 0x24 },
  362. { .rfmax = 77000, .val = 0x25 },
  363. { .rfmax = 78000, .val = 0x27 },
  364. { .rfmax = 80000, .val = 0x28 },
  365. { .rfmax = 81000, .val = 0x29 },
  366. { .rfmax = 82000, .val = 0x2d },
  367. { .rfmax = 83000, .val = 0x2e },
  368. { .rfmax = 84000, .val = 0x2f },
  369. { .rfmax = 85000, .val = 0x31 },
  370. { .rfmax = 86000, .val = 0x33 },
  371. { .rfmax = 87000, .val = 0x34 },
  372. { .rfmax = 88000, .val = 0x35 },
  373. { .rfmax = 89000, .val = 0x37 },
  374. { .rfmax = 90000, .val = 0x38 },
  375. { .rfmax = 91000, .val = 0x39 },
  376. { .rfmax = 93000, .val = 0x3c },
  377. { .rfmax = 94000, .val = 0x3e },
  378. { .rfmax = 95000, .val = 0x3f },
  379. { .rfmax = 96000, .val = 0x40 },
  380. { .rfmax = 97000, .val = 0x42 },
  381. { .rfmax = 99000, .val = 0x45 },
  382. { .rfmax = 100000, .val = 0x46 },
  383. { .rfmax = 102000, .val = 0x48 },
  384. { .rfmax = 103000, .val = 0x4a },
  385. { .rfmax = 105000, .val = 0x4d },
  386. { .rfmax = 106000, .val = 0x4e },
  387. { .rfmax = 107000, .val = 0x50 },
  388. { .rfmax = 108000, .val = 0x51 },
  389. { .rfmax = 110000, .val = 0x54 },
  390. { .rfmax = 111000, .val = 0x56 },
  391. { .rfmax = 112000, .val = 0x57 },
  392. { .rfmax = 113000, .val = 0x58 },
  393. { .rfmax = 114000, .val = 0x59 },
  394. { .rfmax = 115000, .val = 0x5c },
  395. { .rfmax = 116000, .val = 0x5d },
  396. { .rfmax = 117000, .val = 0x5f },
  397. { .rfmax = 119000, .val = 0x60 },
  398. { .rfmax = 120000, .val = 0x64 },
  399. { .rfmax = 121000, .val = 0x65 },
  400. { .rfmax = 122000, .val = 0x66 },
  401. { .rfmax = 123000, .val = 0x68 },
  402. { .rfmax = 124000, .val = 0x69 },
  403. { .rfmax = 125000, .val = 0x6c },
  404. { .rfmax = 126000, .val = 0x6d },
  405. { .rfmax = 127000, .val = 0x6e },
  406. { .rfmax = 128000, .val = 0x70 },
  407. { .rfmax = 129000, .val = 0x71 },
  408. { .rfmax = 130000, .val = 0x75 },
  409. { .rfmax = 131000, .val = 0x77 },
  410. { .rfmax = 132000, .val = 0x78 },
  411. { .rfmax = 133000, .val = 0x7b },
  412. { .rfmax = 134000, .val = 0x7e },
  413. { .rfmax = 135000, .val = 0x81 },
  414. { .rfmax = 136000, .val = 0x82 },
  415. { .rfmax = 137000, .val = 0x87 },
  416. { .rfmax = 138000, .val = 0x88 },
  417. { .rfmax = 139000, .val = 0x8d },
  418. { .rfmax = 140000, .val = 0x8e },
  419. { .rfmax = 141000, .val = 0x91 },
  420. { .rfmax = 142000, .val = 0x95 },
  421. { .rfmax = 143000, .val = 0x9a },
  422. { .rfmax = 144000, .val = 0x9d },
  423. { .rfmax = 145000, .val = 0xa1 },
  424. { .rfmax = 146000, .val = 0xa2 },
  425. { .rfmax = 147000, .val = 0xa4 },
  426. { .rfmax = 148000, .val = 0xa9 },
  427. { .rfmax = 149000, .val = 0xae },
  428. { .rfmax = 150000, .val = 0xb0 },
  429. { .rfmax = 151000, .val = 0xb1 },
  430. { .rfmax = 152000, .val = 0xb7 },
  431. { .rfmax = 152600, .val = 0xbd },
  432. { .rfmax = 154000, .val = 0x20 },
  433. { .rfmax = 155000, .val = 0x22 },
  434. { .rfmax = 156000, .val = 0x24 },
  435. { .rfmax = 157000, .val = 0x25 },
  436. { .rfmax = 158000, .val = 0x27 },
  437. { .rfmax = 159000, .val = 0x29 },
  438. { .rfmax = 160000, .val = 0x2c },
  439. { .rfmax = 161000, .val = 0x2d },
  440. { .rfmax = 163000, .val = 0x2e },
  441. { .rfmax = 164000, .val = 0x2f },
  442. { .rfmax = 164700, .val = 0x30 },
  443. { .rfmax = 166000, .val = 0x11 },
  444. { .rfmax = 167000, .val = 0x12 },
  445. { .rfmax = 168000, .val = 0x13 },
  446. { .rfmax = 169000, .val = 0x14 },
  447. { .rfmax = 170000, .val = 0x15 },
  448. { .rfmax = 172000, .val = 0x16 },
  449. { .rfmax = 173000, .val = 0x17 },
  450. { .rfmax = 174000, .val = 0x18 },
  451. { .rfmax = 175000, .val = 0x1a },
  452. { .rfmax = 176000, .val = 0x1b },
  453. { .rfmax = 178000, .val = 0x1d },
  454. { .rfmax = 179000, .val = 0x1e },
  455. { .rfmax = 180000, .val = 0x1f },
  456. { .rfmax = 181000, .val = 0x20 },
  457. { .rfmax = 182000, .val = 0x21 },
  458. { .rfmax = 183000, .val = 0x22 },
  459. { .rfmax = 184000, .val = 0x24 },
  460. { .rfmax = 185000, .val = 0x25 },
  461. { .rfmax = 186000, .val = 0x26 },
  462. { .rfmax = 187000, .val = 0x27 },
  463. { .rfmax = 188000, .val = 0x29 },
  464. { .rfmax = 189000, .val = 0x2a },
  465. { .rfmax = 190000, .val = 0x2c },
  466. { .rfmax = 191000, .val = 0x2d },
  467. { .rfmax = 192000, .val = 0x2e },
  468. { .rfmax = 193000, .val = 0x2f },
  469. { .rfmax = 194000, .val = 0x30 },
  470. { .rfmax = 195000, .val = 0x33 },
  471. { .rfmax = 196000, .val = 0x35 },
  472. { .rfmax = 198000, .val = 0x36 },
  473. { .rfmax = 200000, .val = 0x38 },
  474. { .rfmax = 201000, .val = 0x3c },
  475. { .rfmax = 202000, .val = 0x3d },
  476. { .rfmax = 203500, .val = 0x3e },
  477. { .rfmax = 206000, .val = 0x0e },
  478. { .rfmax = 208000, .val = 0x0f },
  479. { .rfmax = 212000, .val = 0x10 },
  480. { .rfmax = 216000, .val = 0x11 },
  481. { .rfmax = 217000, .val = 0x12 },
  482. { .rfmax = 218000, .val = 0x13 },
  483. { .rfmax = 220000, .val = 0x14 },
  484. { .rfmax = 222000, .val = 0x15 },
  485. { .rfmax = 225000, .val = 0x16 },
  486. { .rfmax = 228000, .val = 0x17 },
  487. { .rfmax = 231000, .val = 0x18 },
  488. { .rfmax = 234000, .val = 0x19 },
  489. { .rfmax = 235000, .val = 0x1a },
  490. { .rfmax = 236000, .val = 0x1b },
  491. { .rfmax = 237000, .val = 0x1c },
  492. { .rfmax = 240000, .val = 0x1d },
  493. { .rfmax = 242000, .val = 0x1e },
  494. { .rfmax = 244000, .val = 0x1f },
  495. { .rfmax = 247000, .val = 0x20 },
  496. { .rfmax = 249000, .val = 0x21 },
  497. { .rfmax = 252000, .val = 0x22 },
  498. { .rfmax = 253000, .val = 0x23 },
  499. { .rfmax = 254000, .val = 0x24 },
  500. { .rfmax = 256000, .val = 0x25 },
  501. { .rfmax = 259000, .val = 0x26 },
  502. { .rfmax = 262000, .val = 0x27 },
  503. { .rfmax = 264000, .val = 0x28 },
  504. { .rfmax = 267000, .val = 0x29 },
  505. { .rfmax = 269000, .val = 0x2a },
  506. { .rfmax = 271000, .val = 0x2b },
  507. { .rfmax = 273000, .val = 0x2c },
  508. { .rfmax = 275000, .val = 0x2d },
  509. { .rfmax = 277000, .val = 0x2e },
  510. { .rfmax = 279000, .val = 0x2f },
  511. { .rfmax = 282000, .val = 0x30 },
  512. { .rfmax = 284000, .val = 0x31 },
  513. { .rfmax = 286000, .val = 0x32 },
  514. { .rfmax = 287000, .val = 0x33 },
  515. { .rfmax = 290000, .val = 0x34 },
  516. { .rfmax = 293000, .val = 0x35 },
  517. { .rfmax = 295000, .val = 0x36 },
  518. { .rfmax = 297000, .val = 0x37 },
  519. { .rfmax = 300000, .val = 0x38 },
  520. { .rfmax = 303000, .val = 0x39 },
  521. { .rfmax = 305000, .val = 0x3a },
  522. { .rfmax = 306000, .val = 0x3b },
  523. { .rfmax = 307000, .val = 0x3c },
  524. { .rfmax = 310000, .val = 0x3d },
  525. { .rfmax = 312000, .val = 0x3e },
  526. { .rfmax = 315000, .val = 0x3f },
  527. { .rfmax = 318000, .val = 0x40 },
  528. { .rfmax = 320000, .val = 0x41 },
  529. { .rfmax = 323000, .val = 0x42 },
  530. { .rfmax = 324000, .val = 0x43 },
  531. { .rfmax = 325000, .val = 0x44 },
  532. { .rfmax = 327000, .val = 0x45 },
  533. { .rfmax = 331000, .val = 0x46 },
  534. { .rfmax = 334000, .val = 0x47 },
  535. { .rfmax = 337000, .val = 0x48 },
  536. { .rfmax = 339000, .val = 0x49 },
  537. { .rfmax = 340000, .val = 0x4a },
  538. { .rfmax = 341000, .val = 0x4b },
  539. { .rfmax = 343000, .val = 0x4c },
  540. { .rfmax = 345000, .val = 0x4d },
  541. { .rfmax = 349000, .val = 0x4e },
  542. { .rfmax = 352000, .val = 0x4f },
  543. { .rfmax = 353000, .val = 0x50 },
  544. { .rfmax = 355000, .val = 0x51 },
  545. { .rfmax = 357000, .val = 0x52 },
  546. { .rfmax = 359000, .val = 0x53 },
  547. { .rfmax = 361000, .val = 0x54 },
  548. { .rfmax = 362000, .val = 0x55 },
  549. { .rfmax = 364000, .val = 0x56 },
  550. { .rfmax = 368000, .val = 0x57 },
  551. { .rfmax = 370000, .val = 0x58 },
  552. { .rfmax = 372000, .val = 0x59 },
  553. { .rfmax = 375000, .val = 0x5a },
  554. { .rfmax = 376000, .val = 0x5b },
  555. { .rfmax = 377000, .val = 0x5c },
  556. { .rfmax = 379000, .val = 0x5d },
  557. { .rfmax = 382000, .val = 0x5e },
  558. { .rfmax = 384000, .val = 0x5f },
  559. { .rfmax = 385000, .val = 0x60 },
  560. { .rfmax = 386000, .val = 0x61 },
  561. { .rfmax = 388000, .val = 0x62 },
  562. { .rfmax = 390000, .val = 0x63 },
  563. { .rfmax = 393000, .val = 0x64 },
  564. { .rfmax = 394000, .val = 0x65 },
  565. { .rfmax = 396000, .val = 0x66 },
  566. { .rfmax = 397000, .val = 0x67 },
  567. { .rfmax = 398000, .val = 0x68 },
  568. { .rfmax = 400000, .val = 0x69 },
  569. { .rfmax = 402000, .val = 0x6a },
  570. { .rfmax = 403000, .val = 0x6b },
  571. { .rfmax = 407000, .val = 0x6c },
  572. { .rfmax = 408000, .val = 0x6d },
  573. { .rfmax = 409000, .val = 0x6e },
  574. { .rfmax = 410000, .val = 0x6f },
  575. { .rfmax = 411000, .val = 0x70 },
  576. { .rfmax = 412000, .val = 0x71 },
  577. { .rfmax = 413000, .val = 0x72 },
  578. { .rfmax = 414000, .val = 0x73 },
  579. { .rfmax = 417000, .val = 0x74 },
  580. { .rfmax = 418000, .val = 0x75 },
  581. { .rfmax = 420000, .val = 0x76 },
  582. { .rfmax = 422000, .val = 0x77 },
  583. { .rfmax = 423000, .val = 0x78 },
  584. { .rfmax = 424000, .val = 0x79 },
  585. { .rfmax = 427000, .val = 0x7a },
  586. { .rfmax = 428000, .val = 0x7b },
  587. { .rfmax = 429000, .val = 0x7d },
  588. { .rfmax = 432000, .val = 0x7f },
  589. { .rfmax = 434000, .val = 0x80 },
  590. { .rfmax = 435000, .val = 0x81 },
  591. { .rfmax = 436000, .val = 0x83 },
  592. { .rfmax = 437000, .val = 0x84 },
  593. { .rfmax = 438000, .val = 0x85 },
  594. { .rfmax = 439000, .val = 0x86 },
  595. { .rfmax = 440000, .val = 0x87 },
  596. { .rfmax = 441000, .val = 0x88 },
  597. { .rfmax = 442000, .val = 0x89 },
  598. { .rfmax = 445000, .val = 0x8a },
  599. { .rfmax = 446000, .val = 0x8b },
  600. { .rfmax = 447000, .val = 0x8c },
  601. { .rfmax = 448000, .val = 0x8e },
  602. { .rfmax = 449000, .val = 0x8f },
  603. { .rfmax = 450000, .val = 0x90 },
  604. { .rfmax = 452000, .val = 0x91 },
  605. { .rfmax = 453000, .val = 0x93 },
  606. { .rfmax = 454000, .val = 0x94 },
  607. { .rfmax = 456000, .val = 0x96 },
  608. { .rfmax = 457800, .val = 0x98 },
  609. { .rfmax = 461000, .val = 0x11 },
  610. { .rfmax = 468000, .val = 0x12 },
  611. { .rfmax = 472000, .val = 0x13 },
  612. { .rfmax = 473000, .val = 0x14 },
  613. { .rfmax = 474000, .val = 0x15 },
  614. { .rfmax = 481000, .val = 0x16 },
  615. { .rfmax = 486000, .val = 0x17 },
  616. { .rfmax = 491000, .val = 0x18 },
  617. { .rfmax = 498000, .val = 0x19 },
  618. { .rfmax = 499000, .val = 0x1a },
  619. { .rfmax = 501000, .val = 0x1b },
  620. { .rfmax = 506000, .val = 0x1c },
  621. { .rfmax = 511000, .val = 0x1d },
  622. { .rfmax = 516000, .val = 0x1e },
  623. { .rfmax = 520000, .val = 0x1f },
  624. { .rfmax = 521000, .val = 0x20 },
  625. { .rfmax = 525000, .val = 0x21 },
  626. { .rfmax = 529000, .val = 0x22 },
  627. { .rfmax = 533000, .val = 0x23 },
  628. { .rfmax = 539000, .val = 0x24 },
  629. { .rfmax = 541000, .val = 0x25 },
  630. { .rfmax = 547000, .val = 0x26 },
  631. { .rfmax = 549000, .val = 0x27 },
  632. { .rfmax = 551000, .val = 0x28 },
  633. { .rfmax = 556000, .val = 0x29 },
  634. { .rfmax = 561000, .val = 0x2a },
  635. { .rfmax = 563000, .val = 0x2b },
  636. { .rfmax = 565000, .val = 0x2c },
  637. { .rfmax = 569000, .val = 0x2d },
  638. { .rfmax = 571000, .val = 0x2e },
  639. { .rfmax = 577000, .val = 0x2f },
  640. { .rfmax = 580000, .val = 0x30 },
  641. { .rfmax = 582000, .val = 0x31 },
  642. { .rfmax = 584000, .val = 0x32 },
  643. { .rfmax = 588000, .val = 0x33 },
  644. { .rfmax = 591000, .val = 0x34 },
  645. { .rfmax = 596000, .val = 0x35 },
  646. { .rfmax = 598000, .val = 0x36 },
  647. { .rfmax = 603000, .val = 0x37 },
  648. { .rfmax = 604000, .val = 0x38 },
  649. { .rfmax = 606000, .val = 0x39 },
  650. { .rfmax = 612000, .val = 0x3a },
  651. { .rfmax = 615000, .val = 0x3b },
  652. { .rfmax = 617000, .val = 0x3c },
  653. { .rfmax = 621000, .val = 0x3d },
  654. { .rfmax = 622000, .val = 0x3e },
  655. { .rfmax = 625000, .val = 0x3f },
  656. { .rfmax = 632000, .val = 0x40 },
  657. { .rfmax = 633000, .val = 0x41 },
  658. { .rfmax = 634000, .val = 0x42 },
  659. { .rfmax = 642000, .val = 0x43 },
  660. { .rfmax = 643000, .val = 0x44 },
  661. { .rfmax = 647000, .val = 0x45 },
  662. { .rfmax = 650000, .val = 0x46 },
  663. { .rfmax = 652000, .val = 0x47 },
  664. { .rfmax = 657000, .val = 0x48 },
  665. { .rfmax = 661000, .val = 0x49 },
  666. { .rfmax = 662000, .val = 0x4a },
  667. { .rfmax = 665000, .val = 0x4b },
  668. { .rfmax = 667000, .val = 0x4c },
  669. { .rfmax = 670000, .val = 0x4d },
  670. { .rfmax = 673000, .val = 0x4e },
  671. { .rfmax = 676000, .val = 0x4f },
  672. { .rfmax = 677000, .val = 0x50 },
  673. { .rfmax = 681000, .val = 0x51 },
  674. { .rfmax = 683000, .val = 0x52 },
  675. { .rfmax = 686000, .val = 0x53 },
  676. { .rfmax = 688000, .val = 0x54 },
  677. { .rfmax = 689000, .val = 0x55 },
  678. { .rfmax = 691000, .val = 0x56 },
  679. { .rfmax = 695000, .val = 0x57 },
  680. { .rfmax = 698000, .val = 0x58 },
  681. { .rfmax = 703000, .val = 0x59 },
  682. { .rfmax = 704000, .val = 0x5a },
  683. { .rfmax = 705000, .val = 0x5b },
  684. { .rfmax = 707000, .val = 0x5c },
  685. { .rfmax = 710000, .val = 0x5d },
  686. { .rfmax = 712000, .val = 0x5e },
  687. { .rfmax = 717000, .val = 0x5f },
  688. { .rfmax = 718000, .val = 0x60 },
  689. { .rfmax = 721000, .val = 0x61 },
  690. { .rfmax = 722000, .val = 0x62 },
  691. { .rfmax = 723000, .val = 0x63 },
  692. { .rfmax = 725000, .val = 0x64 },
  693. { .rfmax = 727000, .val = 0x65 },
  694. { .rfmax = 730000, .val = 0x66 },
  695. { .rfmax = 732000, .val = 0x67 },
  696. { .rfmax = 735000, .val = 0x68 },
  697. { .rfmax = 740000, .val = 0x69 },
  698. { .rfmax = 741000, .val = 0x6a },
  699. { .rfmax = 742000, .val = 0x6b },
  700. { .rfmax = 743000, .val = 0x6c },
  701. { .rfmax = 745000, .val = 0x6d },
  702. { .rfmax = 747000, .val = 0x6e },
  703. { .rfmax = 748000, .val = 0x6f },
  704. { .rfmax = 750000, .val = 0x70 },
  705. { .rfmax = 752000, .val = 0x71 },
  706. { .rfmax = 754000, .val = 0x72 },
  707. { .rfmax = 757000, .val = 0x73 },
  708. { .rfmax = 758000, .val = 0x74 },
  709. { .rfmax = 760000, .val = 0x75 },
  710. { .rfmax = 763000, .val = 0x76 },
  711. { .rfmax = 764000, .val = 0x77 },
  712. { .rfmax = 766000, .val = 0x78 },
  713. { .rfmax = 767000, .val = 0x79 },
  714. { .rfmax = 768000, .val = 0x7a },
  715. { .rfmax = 773000, .val = 0x7b },
  716. { .rfmax = 774000, .val = 0x7c },
  717. { .rfmax = 776000, .val = 0x7d },
  718. { .rfmax = 777000, .val = 0x7e },
  719. { .rfmax = 778000, .val = 0x7f },
  720. { .rfmax = 779000, .val = 0x80 },
  721. { .rfmax = 781000, .val = 0x81 },
  722. { .rfmax = 783000, .val = 0x82 },
  723. { .rfmax = 784000, .val = 0x83 },
  724. { .rfmax = 785000, .val = 0x84 },
  725. { .rfmax = 786000, .val = 0x85 },
  726. { .rfmax = 793000, .val = 0x86 },
  727. { .rfmax = 794000, .val = 0x87 },
  728. { .rfmax = 795000, .val = 0x88 },
  729. { .rfmax = 797000, .val = 0x89 },
  730. { .rfmax = 799000, .val = 0x8a },
  731. { .rfmax = 801000, .val = 0x8b },
  732. { .rfmax = 802000, .val = 0x8c },
  733. { .rfmax = 803000, .val = 0x8d },
  734. { .rfmax = 804000, .val = 0x8e },
  735. { .rfmax = 810000, .val = 0x90 },
  736. { .rfmax = 811000, .val = 0x91 },
  737. { .rfmax = 812000, .val = 0x92 },
  738. { .rfmax = 814000, .val = 0x93 },
  739. { .rfmax = 816000, .val = 0x94 },
  740. { .rfmax = 817000, .val = 0x96 },
  741. { .rfmax = 818000, .val = 0x97 },
  742. { .rfmax = 820000, .val = 0x98 },
  743. { .rfmax = 821000, .val = 0x99 },
  744. { .rfmax = 822000, .val = 0x9a },
  745. { .rfmax = 828000, .val = 0x9b },
  746. { .rfmax = 829000, .val = 0x9d },
  747. { .rfmax = 830000, .val = 0x9f },
  748. { .rfmax = 831000, .val = 0xa0 },
  749. { .rfmax = 833000, .val = 0xa1 },
  750. { .rfmax = 835000, .val = 0xa2 },
  751. { .rfmax = 836000, .val = 0xa3 },
  752. { .rfmax = 837000, .val = 0xa4 },
  753. { .rfmax = 838000, .val = 0xa6 },
  754. { .rfmax = 840000, .val = 0xa8 },
  755. { .rfmax = 842000, .val = 0xa9 },
  756. { .rfmax = 845000, .val = 0xaa },
  757. { .rfmax = 846000, .val = 0xab },
  758. { .rfmax = 847000, .val = 0xad },
  759. { .rfmax = 848000, .val = 0xae },
  760. { .rfmax = 852000, .val = 0xaf },
  761. { .rfmax = 853000, .val = 0xb0 },
  762. { .rfmax = 858000, .val = 0xb1 },
  763. { .rfmax = 860000, .val = 0xb2 },
  764. { .rfmax = 861000, .val = 0xb3 },
  765. { .rfmax = 862000, .val = 0xb4 },
  766. { .rfmax = 863000, .val = 0xb6 },
  767. { .rfmax = 864000, .val = 0xb8 },
  768. { .rfmax = 865000, .val = 0xb9 },
  769. { .rfmax = 0, .val = 0x00 }, /* end */
  770. };
  771. static struct tda18271_map tda18271_ir_measure[] = {
  772. { .rfmax = 30000, .val = 4 },
  773. { .rfmax = 200000, .val = 5 },
  774. { .rfmax = 600000, .val = 6 },
  775. { .rfmax = 865000, .val = 7 },
  776. { .rfmax = 0, .val = 0 }, /* end */
  777. };
  778. static struct tda18271_map tda18271_rf_cal_dc_over_dt[] = {
  779. { .rfmax = 47900, .val = 0x00 },
  780. { .rfmax = 55000, .val = 0x00 },
  781. { .rfmax = 61100, .val = 0x0a },
  782. { .rfmax = 64000, .val = 0x0a },
  783. { .rfmax = 82000, .val = 0x14 },
  784. { .rfmax = 84000, .val = 0x19 },
  785. { .rfmax = 119000, .val = 0x1c },
  786. { .rfmax = 124000, .val = 0x20 },
  787. { .rfmax = 129000, .val = 0x2a },
  788. { .rfmax = 134000, .val = 0x32 },
  789. { .rfmax = 139000, .val = 0x39 },
  790. { .rfmax = 144000, .val = 0x3e },
  791. { .rfmax = 149000, .val = 0x3f },
  792. { .rfmax = 152600, .val = 0x40 },
  793. { .rfmax = 154000, .val = 0x40 },
  794. { .rfmax = 164700, .val = 0x41 },
  795. { .rfmax = 203500, .val = 0x32 },
  796. { .rfmax = 353000, .val = 0x19 },
  797. { .rfmax = 356000, .val = 0x1a },
  798. { .rfmax = 359000, .val = 0x1b },
  799. { .rfmax = 363000, .val = 0x1c },
  800. { .rfmax = 366000, .val = 0x1d },
  801. { .rfmax = 369000, .val = 0x1e },
  802. { .rfmax = 373000, .val = 0x1f },
  803. { .rfmax = 376000, .val = 0x20 },
  804. { .rfmax = 379000, .val = 0x21 },
  805. { .rfmax = 383000, .val = 0x22 },
  806. { .rfmax = 386000, .val = 0x23 },
  807. { .rfmax = 389000, .val = 0x24 },
  808. { .rfmax = 393000, .val = 0x25 },
  809. { .rfmax = 396000, .val = 0x26 },
  810. { .rfmax = 399000, .val = 0x27 },
  811. { .rfmax = 402000, .val = 0x28 },
  812. { .rfmax = 404000, .val = 0x29 },
  813. { .rfmax = 407000, .val = 0x2a },
  814. { .rfmax = 409000, .val = 0x2b },
  815. { .rfmax = 412000, .val = 0x2c },
  816. { .rfmax = 414000, .val = 0x2d },
  817. { .rfmax = 417000, .val = 0x2e },
  818. { .rfmax = 419000, .val = 0x2f },
  819. { .rfmax = 422000, .val = 0x30 },
  820. { .rfmax = 424000, .val = 0x31 },
  821. { .rfmax = 427000, .val = 0x32 },
  822. { .rfmax = 429000, .val = 0x33 },
  823. { .rfmax = 432000, .val = 0x34 },
  824. { .rfmax = 434000, .val = 0x35 },
  825. { .rfmax = 437000, .val = 0x36 },
  826. { .rfmax = 439000, .val = 0x37 },
  827. { .rfmax = 442000, .val = 0x38 },
  828. { .rfmax = 444000, .val = 0x39 },
  829. { .rfmax = 447000, .val = 0x3a },
  830. { .rfmax = 449000, .val = 0x3b },
  831. { .rfmax = 457800, .val = 0x3c },
  832. { .rfmax = 465000, .val = 0x0f },
  833. { .rfmax = 477000, .val = 0x12 },
  834. { .rfmax = 483000, .val = 0x14 },
  835. { .rfmax = 502000, .val = 0x19 },
  836. { .rfmax = 508000, .val = 0x1b },
  837. { .rfmax = 519000, .val = 0x1c },
  838. { .rfmax = 522000, .val = 0x1d },
  839. { .rfmax = 524000, .val = 0x1e },
  840. { .rfmax = 534000, .val = 0x1f },
  841. { .rfmax = 549000, .val = 0x20 },
  842. { .rfmax = 554000, .val = 0x22 },
  843. { .rfmax = 584000, .val = 0x24 },
  844. { .rfmax = 589000, .val = 0x26 },
  845. { .rfmax = 658000, .val = 0x27 },
  846. { .rfmax = 664000, .val = 0x2c },
  847. { .rfmax = 669000, .val = 0x2d },
  848. { .rfmax = 699000, .val = 0x2e },
  849. { .rfmax = 704000, .val = 0x30 },
  850. { .rfmax = 709000, .val = 0x31 },
  851. { .rfmax = 714000, .val = 0x32 },
  852. { .rfmax = 724000, .val = 0x33 },
  853. { .rfmax = 729000, .val = 0x36 },
  854. { .rfmax = 739000, .val = 0x38 },
  855. { .rfmax = 744000, .val = 0x39 },
  856. { .rfmax = 749000, .val = 0x3b },
  857. { .rfmax = 754000, .val = 0x3c },
  858. { .rfmax = 759000, .val = 0x3d },
  859. { .rfmax = 764000, .val = 0x3e },
  860. { .rfmax = 769000, .val = 0x3f },
  861. { .rfmax = 774000, .val = 0x40 },
  862. { .rfmax = 779000, .val = 0x41 },
  863. { .rfmax = 784000, .val = 0x43 },
  864. { .rfmax = 789000, .val = 0x46 },
  865. { .rfmax = 794000, .val = 0x48 },
  866. { .rfmax = 799000, .val = 0x4b },
  867. { .rfmax = 804000, .val = 0x4f },
  868. { .rfmax = 809000, .val = 0x54 },
  869. { .rfmax = 814000, .val = 0x59 },
  870. { .rfmax = 819000, .val = 0x5d },
  871. { .rfmax = 824000, .val = 0x61 },
  872. { .rfmax = 829000, .val = 0x68 },
  873. { .rfmax = 834000, .val = 0x6e },
  874. { .rfmax = 839000, .val = 0x75 },
  875. { .rfmax = 844000, .val = 0x7e },
  876. { .rfmax = 849000, .val = 0x82 },
  877. { .rfmax = 854000, .val = 0x84 },
  878. { .rfmax = 859000, .val = 0x8f },
  879. { .rfmax = 865000, .val = 0x9a },
  880. { .rfmax = 0, .val = 0x00 }, /* end */
  881. };
  882. /*---------------------------------------------------------------------*/
  883. struct tda18271_thermo_map {
  884. u8 d;
  885. u8 r0;
  886. u8 r1;
  887. };
  888. static struct tda18271_thermo_map tda18271_thermometer[] = {
  889. { .d = 0x00, .r0 = 60, .r1 = 92 },
  890. { .d = 0x01, .r0 = 62, .r1 = 94 },
  891. { .d = 0x02, .r0 = 66, .r1 = 98 },
  892. { .d = 0x03, .r0 = 64, .r1 = 96 },
  893. { .d = 0x04, .r0 = 74, .r1 = 106 },
  894. { .d = 0x05, .r0 = 72, .r1 = 104 },
  895. { .d = 0x06, .r0 = 68, .r1 = 100 },
  896. { .d = 0x07, .r0 = 70, .r1 = 102 },
  897. { .d = 0x08, .r0 = 90, .r1 = 122 },
  898. { .d = 0x09, .r0 = 88, .r1 = 120 },
  899. { .d = 0x0a, .r0 = 84, .r1 = 116 },
  900. { .d = 0x0b, .r0 = 86, .r1 = 118 },
  901. { .d = 0x0c, .r0 = 76, .r1 = 108 },
  902. { .d = 0x0d, .r0 = 78, .r1 = 110 },
  903. { .d = 0x0e, .r0 = 82, .r1 = 114 },
  904. { .d = 0x0f, .r0 = 80, .r1 = 112 },
  905. { .d = 0x00, .r0 = 0, .r1 = 0 }, /* end */
  906. };
  907. int tda18271_lookup_thermometer(struct dvb_frontend *fe)
  908. {
  909. struct tda18271_priv *priv = fe->tuner_priv;
  910. unsigned char *regs = priv->tda18271_regs;
  911. int val, i = 0;
  912. while (tda18271_thermometer[i].d < (regs[R_TM] & 0x0f)) {
  913. if (tda18271_thermometer[i + 1].d == 0)
  914. break;
  915. i++;
  916. }
  917. if ((regs[R_TM] & 0x20) == 0x20)
  918. val = tda18271_thermometer[i].r1;
  919. else
  920. val = tda18271_thermometer[i].r0;
  921. tda_map("(%d) tm = %d\n", i, val);
  922. return val;
  923. }
  924. /*---------------------------------------------------------------------*/
  925. struct tda18271_cid_target_map {
  926. u32 rfmax;
  927. u8 target;
  928. u16 limit;
  929. };
  930. static struct tda18271_cid_target_map tda18271_cid_target[] = {
  931. { .rfmax = 46000, .target = 0x04, .limit = 1800 },
  932. { .rfmax = 52200, .target = 0x0a, .limit = 1500 },
  933. { .rfmax = 70100, .target = 0x01, .limit = 4000 },
  934. { .rfmax = 136800, .target = 0x18, .limit = 4000 },
  935. { .rfmax = 156700, .target = 0x18, .limit = 4000 },
  936. { .rfmax = 186250, .target = 0x0a, .limit = 4000 },
  937. { .rfmax = 230000, .target = 0x0a, .limit = 4000 },
  938. { .rfmax = 345000, .target = 0x18, .limit = 4000 },
  939. { .rfmax = 426000, .target = 0x0e, .limit = 4000 },
  940. { .rfmax = 489500, .target = 0x1e, .limit = 4000 },
  941. { .rfmax = 697500, .target = 0x32, .limit = 4000 },
  942. { .rfmax = 842000, .target = 0x3a, .limit = 4000 },
  943. { .rfmax = 0, .target = 0x00, .limit = 0 }, /* end */
  944. };
  945. int tda18271_lookup_cid_target(struct dvb_frontend *fe,
  946. u32 *freq, u8 *cid_target, u16 *count_limit)
  947. {
  948. struct tda18271_priv *priv = fe->tuner_priv;
  949. int i = 0;
  950. while ((tda18271_cid_target[i].rfmax * 1000) < *freq) {
  951. if (tda18271_cid_target[i + 1].rfmax == 0)
  952. break;
  953. i++;
  954. }
  955. *cid_target = tda18271_cid_target[i].target;
  956. *count_limit = tda18271_cid_target[i].limit;
  957. tda_map("(%d) cid_target = %02x, count_limit = %d\n", i,
  958. tda18271_cid_target[i].target, tda18271_cid_target[i].limit);
  959. return 0;
  960. }
  961. /*---------------------------------------------------------------------*/
  962. static struct tda18271_rf_tracking_filter_cal tda18271_rf_band_template[] = {
  963. { .rfmax = 47900, .rfband = 0x00,
  964. .rf1_def = 46000, .rf2_def = 0, .rf3_def = 0 },
  965. { .rfmax = 61100, .rfband = 0x01,
  966. .rf1_def = 52200, .rf2_def = 0, .rf3_def = 0 },
  967. { .rfmax = 152600, .rfband = 0x02,
  968. .rf1_def = 70100, .rf2_def = 136800, .rf3_def = 0 },
  969. { .rfmax = 164700, .rfband = 0x03,
  970. .rf1_def = 156700, .rf2_def = 0, .rf3_def = 0 },
  971. { .rfmax = 203500, .rfband = 0x04,
  972. .rf1_def = 186250, .rf2_def = 0, .rf3_def = 0 },
  973. { .rfmax = 457800, .rfband = 0x05,
  974. .rf1_def = 230000, .rf2_def = 345000, .rf3_def = 426000 },
  975. { .rfmax = 865000, .rfband = 0x06,
  976. .rf1_def = 489500, .rf2_def = 697500, .rf3_def = 842000 },
  977. { .rfmax = 0, .rfband = 0x00,
  978. .rf1_def = 0, .rf2_def = 0, .rf3_def = 0 }, /* end */
  979. };
  980. int tda18271_lookup_rf_band(struct dvb_frontend *fe, u32 *freq, u8 *rf_band)
  981. {
  982. struct tda18271_priv *priv = fe->tuner_priv;
  983. struct tda18271_rf_tracking_filter_cal *map = priv->rf_cal_state;
  984. int i = 0;
  985. while ((map[i].rfmax * 1000) < *freq) {
  986. if (tda18271_debug & DBG_ADV)
  987. tda_map("(%d) rfmax = %d < freq = %d, "
  988. "rf1_def = %d, rf2_def = %d, rf3_def = %d, "
  989. "rf1 = %d, rf2 = %d, rf3 = %d, "
  990. "rf_a1 = %d, rf_a2 = %d, "
  991. "rf_b1 = %d, rf_b2 = %d\n",
  992. i, map[i].rfmax * 1000, *freq,
  993. map[i].rf1_def, map[i].rf2_def, map[i].rf3_def,
  994. map[i].rf1, map[i].rf2, map[i].rf3,
  995. map[i].rf_a1, map[i].rf_a2,
  996. map[i].rf_b1, map[i].rf_b2);
  997. if (map[i].rfmax == 0)
  998. return -EINVAL;
  999. i++;
  1000. }
  1001. if (rf_band)
  1002. *rf_band = map[i].rfband;
  1003. tda_map("(%d) rf_band = %02x\n", i, map[i].rfband);
  1004. return i;
  1005. }
  1006. /*---------------------------------------------------------------------*/
  1007. struct tda18271_map_layout {
  1008. struct tda18271_pll_map *main_pll;
  1009. struct tda18271_pll_map *cal_pll;
  1010. struct tda18271_map *rf_cal;
  1011. struct tda18271_map *rf_cal_kmco;
  1012. struct tda18271_map *rf_cal_dc_over_dt;
  1013. struct tda18271_map *bp_filter;
  1014. struct tda18271_map *rf_band;
  1015. struct tda18271_map *gain_taper;
  1016. struct tda18271_map *ir_measure;
  1017. };
  1018. /*---------------------------------------------------------------------*/
  1019. int tda18271_lookup_pll_map(struct dvb_frontend *fe,
  1020. enum tda18271_map_type map_type,
  1021. u32 *freq, u8 *post_div, u8 *div)
  1022. {
  1023. struct tda18271_priv *priv = fe->tuner_priv;
  1024. struct tda18271_pll_map *map = NULL;
  1025. unsigned int i = 0;
  1026. char *map_name;
  1027. int ret = 0;
  1028. BUG_ON(!priv->maps);
  1029. switch (map_type) {
  1030. case MAIN_PLL:
  1031. map = priv->maps->main_pll;
  1032. map_name = "main_pll";
  1033. break;
  1034. case CAL_PLL:
  1035. map = priv->maps->cal_pll;
  1036. map_name = "cal_pll";
  1037. break;
  1038. default:
  1039. /* we should never get here */
  1040. map_name = "undefined";
  1041. break;
  1042. }
  1043. if (!map) {
  1044. tda_warn("%s map is not set!\n", map_name);
  1045. ret = -EINVAL;
  1046. goto fail;
  1047. }
  1048. while ((map[i].lomax * 1000) < *freq) {
  1049. if (map[i + 1].lomax == 0) {
  1050. tda_map("%s: frequency (%d) out of range\n",
  1051. map_name, *freq);
  1052. ret = -ERANGE;
  1053. break;
  1054. }
  1055. i++;
  1056. }
  1057. *post_div = map[i].pd;
  1058. *div = map[i].d;
  1059. tda_map("(%d) %s: post div = 0x%02x, div = 0x%02x\n",
  1060. i, map_name, *post_div, *div);
  1061. fail:
  1062. return ret;
  1063. }
  1064. int tda18271_lookup_map(struct dvb_frontend *fe,
  1065. enum tda18271_map_type map_type,
  1066. u32 *freq, u8 *val)
  1067. {
  1068. struct tda18271_priv *priv = fe->tuner_priv;
  1069. struct tda18271_map *map = NULL;
  1070. unsigned int i = 0;
  1071. char *map_name;
  1072. int ret = 0;
  1073. BUG_ON(!priv->maps);
  1074. switch (map_type) {
  1075. case BP_FILTER:
  1076. map = priv->maps->bp_filter;
  1077. map_name = "bp_filter";
  1078. break;
  1079. case RF_CAL_KMCO:
  1080. map = priv->maps->rf_cal_kmco;
  1081. map_name = "km";
  1082. break;
  1083. case RF_BAND:
  1084. map = priv->maps->rf_band;
  1085. map_name = "rf_band";
  1086. break;
  1087. case GAIN_TAPER:
  1088. map = priv->maps->gain_taper;
  1089. map_name = "gain_taper";
  1090. break;
  1091. case RF_CAL:
  1092. map = priv->maps->rf_cal;
  1093. map_name = "rf_cal";
  1094. break;
  1095. case IR_MEASURE:
  1096. map = priv->maps->ir_measure;
  1097. map_name = "ir_measure";
  1098. break;
  1099. case RF_CAL_DC_OVER_DT:
  1100. map = priv->maps->rf_cal_dc_over_dt;
  1101. map_name = "rf_cal_dc_over_dt";
  1102. break;
  1103. default:
  1104. /* we should never get here */
  1105. map_name = "undefined";
  1106. break;
  1107. }
  1108. if (!map) {
  1109. tda_warn("%s map is not set!\n", map_name);
  1110. ret = -EINVAL;
  1111. goto fail;
  1112. }
  1113. while ((map[i].rfmax * 1000) < *freq) {
  1114. if (map[i + 1].rfmax == 0) {
  1115. tda_map("%s: frequency (%d) out of range\n",
  1116. map_name, *freq);
  1117. ret = -ERANGE;
  1118. break;
  1119. }
  1120. i++;
  1121. }
  1122. *val = map[i].val;
  1123. tda_map("(%d) %s: 0x%02x\n", i, map_name, *val);
  1124. fail:
  1125. return ret;
  1126. }
  1127. /*---------------------------------------------------------------------*/
  1128. static struct tda18271_std_map tda18271c1_std_map = {
  1129. .fm_radio = { .if_freq = 1250, .fm_rfn = 1, .agc_mode = 3, .std = 0,
  1130. .if_lvl = 0, .rfagc_top = 0x2c, }, /* EP3[4:0] 0x18 */
  1131. .atv_b = { .if_freq = 6750, .fm_rfn = 0, .agc_mode = 1, .std = 6,
  1132. .if_lvl = 0, .rfagc_top = 0x2c, }, /* EP3[4:0] 0x0e */
  1133. .atv_dk = { .if_freq = 7750, .fm_rfn = 0, .agc_mode = 1, .std = 7,
  1134. .if_lvl = 0, .rfagc_top = 0x2c, }, /* EP3[4:0] 0x0f */
  1135. .atv_gh = { .if_freq = 7750, .fm_rfn = 0, .agc_mode = 1, .std = 7,
  1136. .if_lvl = 0, .rfagc_top = 0x2c, }, /* EP3[4:0] 0x0f */
  1137. .atv_i = { .if_freq = 7750, .fm_rfn = 0, .agc_mode = 1, .std = 7,
  1138. .if_lvl = 0, .rfagc_top = 0x2c, }, /* EP3[4:0] 0x0f */
  1139. .atv_l = { .if_freq = 7750, .fm_rfn = 0, .agc_mode = 1, .std = 7,
  1140. .if_lvl = 0, .rfagc_top = 0x2c, }, /* EP3[4:0] 0x0f */
  1141. .atv_lc = { .if_freq = 1250, .fm_rfn = 0, .agc_mode = 1, .std = 7,
  1142. .if_lvl = 0, .rfagc_top = 0x2c, }, /* EP3[4:0] 0x0f */
  1143. .atv_mn = { .if_freq = 5750, .fm_rfn = 0, .agc_mode = 1, .std = 5,
  1144. .if_lvl = 0, .rfagc_top = 0x2c, }, /* EP3[4:0] 0x0d */
  1145. .atsc_6 = { .if_freq = 3250, .fm_rfn = 0, .agc_mode = 3, .std = 4,
  1146. .if_lvl = 1, .rfagc_top = 0x37, }, /* EP3[4:0] 0x1c */
  1147. .dvbt_6 = { .if_freq = 3300, .fm_rfn = 0, .agc_mode = 3, .std = 4,
  1148. .if_lvl = 1, .rfagc_top = 0x37, }, /* EP3[4:0] 0x1c */
  1149. .dvbt_7 = { .if_freq = 3800, .fm_rfn = 0, .agc_mode = 3, .std = 5,
  1150. .if_lvl = 1, .rfagc_top = 0x37, }, /* EP3[4:0] 0x1d */
  1151. .dvbt_8 = { .if_freq = 4300, .fm_rfn = 0, .agc_mode = 3, .std = 6,
  1152. .if_lvl = 1, .rfagc_top = 0x37, }, /* EP3[4:0] 0x1e */
  1153. .qam_6 = { .if_freq = 4000, .fm_rfn = 0, .agc_mode = 3, .std = 5,
  1154. .if_lvl = 1, .rfagc_top = 0x37, }, /* EP3[4:0] 0x1d */
  1155. .qam_7 = { .if_freq = 4500, .fm_rfn = 0, .agc_mode = 3, .std = 6,
  1156. .if_lvl = 1, .rfagc_top = 0x37, }, /* EP3[4:0] 0x1e */
  1157. .qam_8 = { .if_freq = 5000, .fm_rfn = 0, .agc_mode = 3, .std = 7,
  1158. .if_lvl = 1, .rfagc_top = 0x37, }, /* EP3[4:0] 0x1f */
  1159. };
  1160. static struct tda18271_std_map tda18271c2_std_map = {
  1161. .fm_radio = { .if_freq = 1250, .fm_rfn = 1, .agc_mode = 3, .std = 0,
  1162. .if_lvl = 0, .rfagc_top = 0x2c, }, /* EP3[4:0] 0x18 */
  1163. .atv_b = { .if_freq = 6000, .fm_rfn = 0, .agc_mode = 1, .std = 5,
  1164. .if_lvl = 0, .rfagc_top = 0x2c, }, /* EP3[4:0] 0x0d */
  1165. .atv_dk = { .if_freq = 6900, .fm_rfn = 0, .agc_mode = 1, .std = 6,
  1166. .if_lvl = 0, .rfagc_top = 0x2c, }, /* EP3[4:0] 0x0e */
  1167. .atv_gh = { .if_freq = 7100, .fm_rfn = 0, .agc_mode = 1, .std = 6,
  1168. .if_lvl = 0, .rfagc_top = 0x2c, }, /* EP3[4:0] 0x0e */
  1169. .atv_i = { .if_freq = 7250, .fm_rfn = 0, .agc_mode = 1, .std = 6,
  1170. .if_lvl = 0, .rfagc_top = 0x2c, }, /* EP3[4:0] 0x0e */
  1171. .atv_l = { .if_freq = 6900, .fm_rfn = 0, .agc_mode = 1, .std = 6,
  1172. .if_lvl = 0, .rfagc_top = 0x2c, }, /* EP3[4:0] 0x0e */
  1173. .atv_lc = { .if_freq = 1250, .fm_rfn = 0, .agc_mode = 1, .std = 6,
  1174. .if_lvl = 0, .rfagc_top = 0x2c, }, /* EP3[4:0] 0x0e */
  1175. .atv_mn = { .if_freq = 5400, .fm_rfn = 0, .agc_mode = 1, .std = 4,
  1176. .if_lvl = 0, .rfagc_top = 0x2c, }, /* EP3[4:0] 0x0c */
  1177. .atsc_6 = { .if_freq = 3250, .fm_rfn = 0, .agc_mode = 3, .std = 4,
  1178. .if_lvl = 1, .rfagc_top = 0x37, }, /* EP3[4:0] 0x1c */
  1179. .dvbt_6 = { .if_freq = 3300, .fm_rfn = 0, .agc_mode = 3, .std = 4,
  1180. .if_lvl = 1, .rfagc_top = 0x37, }, /* EP3[4:0] 0x1c */
  1181. .dvbt_7 = { .if_freq = 3500, .fm_rfn = 0, .agc_mode = 3, .std = 4,
  1182. .if_lvl = 1, .rfagc_top = 0x37, }, /* EP3[4:0] 0x1c */
  1183. .dvbt_8 = { .if_freq = 4000, .fm_rfn = 0, .agc_mode = 3, .std = 5,
  1184. .if_lvl = 1, .rfagc_top = 0x37, }, /* EP3[4:0] 0x1d */
  1185. .qam_6 = { .if_freq = 4000, .fm_rfn = 0, .agc_mode = 3, .std = 5,
  1186. .if_lvl = 1, .rfagc_top = 0x37, }, /* EP3[4:0] 0x1d */
  1187. .qam_7 = { .if_freq = 4500, .fm_rfn = 0, .agc_mode = 3, .std = 6,
  1188. .if_lvl = 1, .rfagc_top = 0x37, }, /* EP3[4:0] 0x1e */
  1189. .qam_8 = { .if_freq = 5000, .fm_rfn = 0, .agc_mode = 3, .std = 7,
  1190. .if_lvl = 1, .rfagc_top = 0x37, }, /* EP3[4:0] 0x1f */
  1191. };
  1192. /*---------------------------------------------------------------------*/
  1193. static struct tda18271_map_layout tda18271c1_map_layout = {
  1194. .main_pll = tda18271c1_main_pll,
  1195. .cal_pll = tda18271c1_cal_pll,
  1196. .rf_cal = tda18271c1_rf_cal,
  1197. .rf_cal_kmco = tda18271c1_km,
  1198. .bp_filter = tda18271_bp_filter,
  1199. .rf_band = tda18271_rf_band,
  1200. .gain_taper = tda18271_gain_taper,
  1201. .ir_measure = tda18271_ir_measure,
  1202. };
  1203. static struct tda18271_map_layout tda18271c2_map_layout = {
  1204. .main_pll = tda18271c2_main_pll,
  1205. .cal_pll = tda18271c2_cal_pll,
  1206. .rf_cal = tda18271c2_rf_cal,
  1207. .rf_cal_kmco = tda18271c2_km,
  1208. .rf_cal_dc_over_dt = tda18271_rf_cal_dc_over_dt,
  1209. .bp_filter = tda18271_bp_filter,
  1210. .rf_band = tda18271_rf_band,
  1211. .gain_taper = tda18271_gain_taper,
  1212. .ir_measure = tda18271_ir_measure,
  1213. };
  1214. int tda18271_assign_map_layout(struct dvb_frontend *fe)
  1215. {
  1216. struct tda18271_priv *priv = fe->tuner_priv;
  1217. int ret = 0;
  1218. switch (priv->id) {
  1219. case TDA18271HDC1:
  1220. priv->maps = &tda18271c1_map_layout;
  1221. priv->std = tda18271c1_std_map;
  1222. break;
  1223. case TDA18271HDC2:
  1224. priv->maps = &tda18271c2_map_layout;
  1225. priv->std = tda18271c2_std_map;
  1226. break;
  1227. default:
  1228. ret = -EINVAL;
  1229. break;
  1230. }
  1231. memcpy(priv->rf_cal_state, &tda18271_rf_band_template,
  1232. sizeof(tda18271_rf_band_template));
  1233. return ret;
  1234. }