fc8300_cs_tun.c 57 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859860861862863864865866867868869870871872873874875876877878879880881882883884885886887888889890891892893894895896897898899900901902903904905906907908909910911912913914915916917918919920921922923924925926927928929930931932933934935936937938939940941942943944945946947948949950951952953954955956957958959960961962963964965966967968969970971972973974975976977978979980981982983984985986987988989990991992993994995996997998999100010011002100310041005100610071008100910101011101210131014101510161017101810191020102110221023102410251026102710281029103010311032103310341035103610371038103910401041104210431044104510461047104810491050105110521053105410551056105710581059106010611062106310641065106610671068106910701071107210731074107510761077107810791080108110821083108410851086108710881089109010911092109310941095109610971098109911001101110211031104110511061107110811091110111111121113111411151116111711181119112011211122112311241125112611271128112911301131113211331134113511361137113811391140114111421143114411451146114711481149115011511152115311541155115611571158115911601161116211631164116511661167116811691170117111721173117411751176117711781179118011811182118311841185118611871188118911901191119211931194119511961197119811991200120112021203120412051206120712081209121012111212121312141215121612171218121912201221122212231224122512261227122812291230123112321233123412351236123712381239124012411242124312441245124612471248124912501251125212531254125512561257125812591260126112621263126412651266126712681269127012711272127312741275127612771278127912801281128212831284128512861287128812891290129112921293129412951296129712981299130013011302130313041305130613071308130913101311131213131314131513161317131813191320132113221323132413251326132713281329133013311332133313341335133613371338133913401341134213431344134513461347134813491350135113521353135413551356135713581359136013611362136313641365136613671368136913701371137213731374137513761377137813791380138113821383138413851386138713881389139013911392139313941395139613971398139914001401140214031404140514061407140814091410141114121413141414151416141714181419142014211422142314241425142614271428142914301431143214331434143514361437143814391440144114421443144414451446144714481449145014511452145314541455145614571458145914601461146214631464146514661467146814691470147114721473147414751476147714781479148014811482148314841485148614871488148914901491149214931494149514961497149814991500150115021503150415051506150715081509151015111512151315141515151615171518151915201521152215231524152515261527152815291530153115321533153415351536153715381539154015411542154315441545154615471548154915501551155215531554155515561557155815591560156115621563156415651566156715681569157015711572157315741575157615771578157915801581158215831584158515861587158815891590159115921593159415951596159715981599160016011602160316041605160616071608160916101611161216131614161516161617161816191620162116221623162416251626162716281629163016311632163316341635163616371638163916401641164216431644164516461647164816491650165116521653165416551656165716581659166016611662166316641665166616671668166916701671167216731674167516761677167816791680168116821683168416851686168716881689169016911692169316941695169616971698169917001701170217031704170517061707170817091710171117121713171417151716171717181719172017211722172317241725172617271728172917301731173217331734173517361737173817391740174117421743174417451746174717481749175017511752175317541755175617571758175917601761176217631764176517661767176817691770177117721773177417751776177717781779178017811782178317841785178617871788178917901791179217931794179517961797179817991800180118021803180418051806180718081809181018111812181318141815181618171818181918201821182218231824182518261827182818291830183118321833183418351836183718381839184018411842184318441845184618471848184918501851185218531854185518561857185818591860186118621863186418651866186718681869187018711872187318741875187618771878187918801881188218831884188518861887188818891890189118921893189418951896189718981899190019011902190319041905190619071908190919101911
  1. /*****************************************************************************
  2. Copyright(c) 2013 FCI Inc. All Rights Reserved
  3. File name : fc8300_cs_tun.c
  4. Description : source of FC8300 tuner driver
  5. This program is free software; you can redistribute it and/or modify
  6. it under the terms of the GNU General Public License as published by
  7. the Free Software Foundation; either version 2 of the License, or
  8. (at your option) any later version.
  9. This program is distributed in the hope that it will be useful,
  10. but WITHOUT ANY WARRANTY; without even the implied warranty of
  11. MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
  12. GNU General Public License for more details.
  13. You should have received a copy of the GNU General Public License
  14. along with this program; if not, write to the Free Software
  15. Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
  16. History :
  17. ----------------------------------------------------------------------
  18. 1p0 -> 20131119
  19. 1p4 -> 20131127
  20. 1p5 -> 20131127
  21. 1p6 -> 20131129
  22. 1p7 -> 20131202
  23. 1p9 -> 20131209
  24. 2p2 -> 20131226
  25. 2p3 -> 20140108
  26. 2p9 -> 20140124
  27. 3p0 -> 20140124
  28. ******************************************************************************/
  29. #include "fci_types.h"
  30. #include "fci_oal.h"
  31. #include "fci_tun.h"
  32. #include "fci_hal.h"
  33. #include "fc8300_regs.h"
  34. #include "fc8300_cs_tun.h"
  35. #include "fc8300_tun_table.h"
  36. #define DRIVER_VERSION 0x30 /* Driver S1_V3p0 */
  37. #define RFADC_COUNT 3
  38. #define CAL_REPEAT 1
  39. #define XTAL_FREQ_19200 0
  40. #define XTAL_FREQ_24000 1
  41. #define XTAL_FREQ_26000 2
  42. #define XTAL_FREQ_27120 3
  43. #define XTAL_FREQ_32000 4
  44. #define XTAL_FREQ_37200 5
  45. #define XTAL_FREQ_37400 6
  46. #define FC8300_CHECK 1
  47. #define FC8300_BAND_WIDTH BBM_BAND_WIDTH
  48. extern unsigned int fc8300_xtal_freq;
  49. static enum BROADCAST_TYPE broadcast_type = ISDBT_13SEG;
  50. static u8 xtal_freq = 4;
  51. static u8 catv_status;
  52. static u8 tf_value[4] = {0, 0, 0, 0};
  53. static s32 pd_offset_cal[4] = {0, 0, 0, 0};
  54. static s32 pd_offset_add[4] = {0, 0, 0, 0};
  55. static s8 pd_offset_sign[4] = {1, 1, 1, 1};
  56. static u32 pd_low_freq = 467143;
  57. static u32 pd_high_freq = 713143;
  58. static u8 channel_count = 42;
  59. static u32 devid_set[5] = {DIV_MASTER, DIV_SLAVE0, DIV_SLAVE1, DIV_SLAVE2,
  60. DIV_BROADCAST};
  61. static u32 tf_offset[2][12] = {
  62. {470000, 485000, 497000, 515000, 533000, 581000, 605000, 635000,
  63. 671000, 737000, 803000, 810000},
  64. {11, 10, 9, 8, 7, 6, 5, 4, 3, 2, 1, 0}
  65. };
  66. static s32 fc8300_write(HANDLE handle, DEVICEID devid, u8 addr, u8 data)
  67. {
  68. s32 res;
  69. res = tuner_i2c_write(handle, devid, addr, 1, &data, 1);
  70. return res;
  71. }
  72. static s32 fc8300_read(HANDLE handle, DEVICEID devid, u8 addr, u8 *data)
  73. {
  74. s32 res;
  75. res = tuner_i2c_read(handle, devid, addr, 1, data, 1);
  76. return res;
  77. }
  78. /*static s32 fc8300_bb_write(HANDLE handle, DEVICEID devid, u16 addr, u8 data)
  79. {
  80. s32 res;
  81. res = bbm_write(handle, devid, addr, data);
  82. return res;
  83. }
  84. static s32 fc8300_bb_read(HANDLE handle, DEVICEID devid, u16 addr, u8 *data)
  85. {
  86. s32 res;
  87. res = bbm_read(handle, devid, addr, data);
  88. return res;
  89. }*/
  90. static u8 tf_cal(HANDLE handle, DEVICEID devid)
  91. {
  92. u8 rfadc[RFADC_COUNT];
  93. u32 rfadc_avg = 0;
  94. u8 max_cb_code[CAL_REPEAT];
  95. u8 max_rfadc[CAL_REPEAT];
  96. u8 cal_temp = 0;
  97. u32 x, i, j;
  98. for (x = 0; x < CAL_REPEAT; x++) {
  99. max_cb_code[x] = 0;
  100. max_rfadc[x] = 0;
  101. for (i = 3; i < 12; i++) {
  102. rfadc[x] = 0;
  103. rfadc_avg = 0;
  104. cal_temp = (0x10 + i);
  105. fc8300_write(handle, devid, 0x1c, cal_temp);
  106. for (j = 0; j < RFADC_COUNT; j++) {
  107. fc8300_read(handle, devid, 0xf5, &rfadc[j]);
  108. rfadc_avg = rfadc_avg + rfadc[j];
  109. }
  110. rfadc_avg = rfadc_avg / RFADC_COUNT;
  111. if (max_rfadc[x] < rfadc_avg) {
  112. max_rfadc[x] = (u8) rfadc_avg;
  113. max_cb_code[x] = (0x10 + i);
  114. }
  115. }
  116. }
  117. return max_cb_code[0];
  118. }
  119. static u32 vco_cal(HANDLE handle, DEVICEID devid, u8 offset)
  120. {
  121. u8 vco_table[4][4] = {
  122. {0xbb, 0xbb, 0xbb, 0xbb},
  123. {0xb3, 0xbb, 0xbb, 0xbb},
  124. {0x32, 0x43, 0x54, 0x65},
  125. {0x0f, 0x10, 0x21, 0x32}
  126. };
  127. u8 ib[4] = {0, 0, 0, 0};
  128. u8 i = 0;
  129. u8 j = 0;
  130. u8 read_temp = 0;
  131. if (offset == vco_table[3][0])
  132. offset = 1;
  133. else if (offset == vco_table[3][1])
  134. offset = 2;
  135. else if (offset == vco_table[3][2])
  136. offset = 3;
  137. for (j = offset; j < 4; j++) {
  138. for (i = 0; i < 4 ; i++)
  139. fc8300_write(handle, devid, (0x71 + i),
  140. vco_table[i][j]);
  141. fc8300_write(handle, devid, 0x5f, 0x40);
  142. fc8300_write(handle, devid, 0x6d, 0x0f);
  143. fc8300_write(handle, devid, 0x6e, 0x1f);
  144. fc8300_write(handle, devid, 0x6f, 0x3f);
  145. fc8300_write(handle, devid, 0x6a, 0x04);
  146. fc8300_write(handle, devid, 0x6a, 0x14);
  147. fc8300_write(handle, devid, 0x75, 0x30);
  148. for (i = 0; i < 10; i++) {
  149. msWait(1);
  150. fc8300_read(handle, devid, 0x76, &read_temp);
  151. if (read_temp == 0x20)
  152. break;
  153. }
  154. for (i = 0; i < 4; i++) {
  155. fc8300_write(handle, devid, 0x75, (0x34 + i));
  156. fc8300_read(handle, devid, 0x76, &read_temp);
  157. ib[i] = read_temp;
  158. }
  159. read_temp = (ib[0] == 0) ? 0 :
  160. (ib[1] == 0) ? 0 :
  161. (ib[2] == 0) ? 0 :
  162. (ib[3] == 0) ? 0 : 1;
  163. if (read_temp != 0) {
  164. fc8300_write(handle, devid, 0x5f, 0x00);
  165. return BBM_OK;
  166. }
  167. }
  168. fc8300_write(handle, devid, 0x6a, 0x15);
  169. fc8300_write(handle, devid, 0x70, 0x7f);
  170. return BBM_OK;
  171. }
  172. static s32 fc8300_tuner_set_pll(HANDLE handle, DEVICEID devid, u32 freq,
  173. u32 offset)
  174. {
  175. u8 data_0x51, data_0x57, lo_select;
  176. u32 f_diff, f_diff_shifted, n_val, k_val, f_vco;
  177. u32 f_vco_max = 6000000;
  178. u8 lo_divide_ratio[8] = {8, 12, 16, 24, 32, 48, 64, 96};
  179. u8 pre_shift_bits = 4;
  180. u8 lock_detect = 0;
  181. u8 lock_bank = 0;
  182. u8 lock_condition = 0x11;
  183. u8 i, j;
  184. for (lo_select = 0; lo_select < 7; lo_select++)
  185. if (f_vco_max < freq * lo_divide_ratio[lo_select + 1])
  186. break;
  187. f_vco = freq * lo_divide_ratio[lo_select];
  188. n_val = f_vco / fc8300_xtal_freq;
  189. f_diff = f_vco - fc8300_xtal_freq * n_val;
  190. f_diff_shifted = f_diff << (20 - pre_shift_bits);
  191. k_val = f_diff_shifted / (fc8300_xtal_freq >> pre_shift_bits);
  192. k_val = k_val | 1;
  193. data_0x57 = ((n_val >> 3) & 0x20);
  194. data_0x57 += (k_val >> 16);
  195. data_0x51 = 0x00;
  196. data_0x51 += (lo_select * 2) + 1;
  197. for (j = 0; j < 4; j++) {
  198. fc8300_write(handle, devid, 0x75, 0x31);
  199. fc8300_write(handle, devid, 0x77, 0x00);
  200. fc8300_write(handle, devid, 0x51, data_0x51);
  201. fc8300_write(handle, devid, 0x57, data_0x57);
  202. fc8300_write(handle, devid, 0x5a, (u8) n_val);
  203. fc8300_write(handle, devid, 0x50, 0xe3);
  204. fc8300_write(handle, devid, 0x50, 0xff);
  205. fc8300_write(handle, devid, 0x58, (u8) ((k_val >> 8) & 0xff));
  206. fc8300_write(handle, devid, 0x59, (u8) ((k_val) & 0xff));
  207. msWait(2);
  208. for (i = 1; i < 5; i++) {
  209. fc8300_read(handle, devid, 0x64, &lock_detect);
  210. fc8300_read(handle, devid, 0x65, &lock_bank);
  211. if (((lock_detect & lock_condition) == lock_condition)
  212. && (lock_bank > 1)) {
  213. fc8300_read(handle, devid, 0x76, &lock_bank);
  214. if (lock_bank < 62) {
  215. if (((lo_select % 2) != 0) || (f_vco >
  216. 6200000)) {
  217. fc8300_write(handle, devid,
  218. 0x77, 0x02);
  219. fc8300_write(handle, devid,
  220. 0x50, 0xe3);
  221. fc8300_write(handle, devid,
  222. 0x50, 0xff);
  223. }
  224. }
  225. break;
  226. }
  227. }
  228. if ((lock_detect & lock_condition) != lock_condition) {
  229. fc8300_read(handle, devid, 0x74, &lock_detect);
  230. vco_cal(handle, devid, lock_detect);
  231. } else {
  232. break;
  233. }
  234. }
  235. return BBM_OK;
  236. }
  237. static u8 pd_cal(HANDLE handle, DEVICEID devid, u32 freq, u8 *pd_cal_table)
  238. {
  239. if (devid == DIV_BROADCAST)
  240. fc8300_tuner_set_pll(handle, DIV_MASTER, freq, 0);
  241. else
  242. fc8300_tuner_set_pll(handle, devid, freq, 0);
  243. fc8300_write(handle, devid, 0x78, 0xf1);
  244. fc8300_write(handle, devid, 0x04, 0x12);
  245. msWait(3);
  246. fc8300_write(handle, devid, 0x78, 0x31);
  247. msWait(2);
  248. if (devid == DIV_BROADCAST)
  249. fc8300_read(handle, DIV_MASTER, 0x98, &pd_cal_table[0]);
  250. else
  251. fc8300_read(handle, devid, 0x98, &pd_cal_table[devid & 0x0f]);
  252. fc8300_write(handle, devid, 0x04, 0x10);
  253. return BBM_OK;
  254. }
  255. static void fc8300_1seg_init(HANDLE handle, DEVICEID devid, u16 filter_cal)
  256. {
  257. fc8300_write(handle, devid, 0x00, 0x00);
  258. fc8300_write(handle, devid, 0x02, 0x01);
  259. fc8300_write(handle, devid, 0x03, 0x04);
  260. fc8300_write(handle, devid, 0x04, 0x10);
  261. fc8300_write(handle, devid, 0x08, 0xe4);
  262. fc8300_write(handle, devid, 0x13, 0x07);
  263. fc8300_write(handle, devid, 0x19, 0x21);
  264. fc8300_write(handle, devid, 0x1d, 0x10);
  265. fc8300_write(handle, devid, 0x1f, 0x72);
  266. fc8300_write(handle, devid, 0x20, 0x22);
  267. fc8300_write(handle, devid, 0x21, 0x30);
  268. fc8300_write(handle, devid, 0x24, 0x98);
  269. fc8300_write(handle, devid, 0x3f, 0x01);
  270. fc8300_write(handle, devid, 0x40, (0x44 + (filter_cal / 256)));
  271. fc8300_write(handle, devid, 0x41, (filter_cal % 256));
  272. fc8300_write(handle, devid, 0x3f, 0x00);
  273. fc8300_write(handle, devid, 0x33, 0x83);
  274. fc8300_write(handle, devid, 0x34, 0x44);
  275. fc8300_write(handle, devid, 0x37, 0x65);
  276. fc8300_write(handle, devid, 0x38, 0x55);
  277. fc8300_write(handle, devid, 0x39, 0x02);
  278. fc8300_write(handle, devid, 0x3e, 0xab);
  279. fc8300_write(handle, devid, 0x3c, 0xaa);
  280. fc8300_write(handle, devid, 0x3d, 0xaa);
  281. fc8300_write(handle, devid, 0x4d, 0x01);
  282. fc8300_write(handle, devid, 0x50, 0xff);
  283. fc8300_write(handle, devid, 0x54, 0x80);
  284. fc8300_write(handle, devid, 0x70, 0x5f);
  285. fc8300_write(handle, devid, 0x78, 0x31);
  286. fc8300_write(handle, devid, 0x82, 0x88);
  287. fc8300_write(handle, devid, 0x84, 0x14);
  288. fc8300_write(handle, devid, 0x85, 0x0f);
  289. fc8300_write(handle, devid, 0x86, 0x3f);
  290. fc8300_write(handle, devid, 0x87, 0x18);
  291. fc8300_write(handle, devid, 0x88, 0x0e);
  292. fc8300_write(handle, devid, 0x89, 0x0b);
  293. fc8300_write(handle, devid, 0x8a, 0x15);
  294. fc8300_write(handle, devid, 0x8b, 0x0e);
  295. fc8300_write(handle, devid, 0x8f, 0xb6);
  296. fc8300_write(handle, devid, 0x90, 0xb2);
  297. fc8300_write(handle, devid, 0x91, 0x68);
  298. fc8300_write(handle, devid, 0xb2, 0x00);
  299. fc8300_write(handle, devid, 0xb3, 0x04);
  300. fc8300_write(handle, devid, 0xb4, 0x00);
  301. fc8300_write(handle, devid, 0xb5, 0x04);
  302. fc8300_write(handle, devid, 0xb6, 0x00);
  303. fc8300_write(handle, devid, 0xb7, 0x07);
  304. fc8300_write(handle, devid, 0xb8, 0x00);
  305. fc8300_write(handle, devid, 0xb9, 0x07);
  306. fc8300_write(handle, devid, 0xba, 0x00);
  307. fc8300_write(handle, devid, 0xbb, 0x07);
  308. fc8300_write(handle, devid, 0xbc, 0x00);
  309. fc8300_write(handle, devid, 0xbd, 0x0a);
  310. fc8300_write(handle, devid, 0xbe, 0x00);
  311. fc8300_write(handle, devid, 0xbf, 0x0a);
  312. fc8300_write(handle, devid, 0xc0, 0x0a);
  313. fc8300_write(handle, devid, 0xc1, 0x00);
  314. fc8300_write(handle, devid, 0xc2, 0x13);
  315. fc8300_write(handle, devid, 0xc3, 0x00);
  316. fc8300_write(handle, devid, 0xd3, 0x00);
  317. fc8300_write(handle, devid, 0xd4, 0x01);
  318. fc8300_write(handle, devid, 0xd5, 0x05);
  319. fc8300_write(handle, devid, 0xd6, 0x0d);
  320. fc8300_write(handle, devid, 0xd7, 0x0e);
  321. fc8300_write(handle, devid, 0xd8, 0x0f);
  322. fc8300_write(handle, devid, 0xd9, 0x2f);
  323. fc8300_write(handle, devid, 0xda, 0x4f);
  324. fc8300_write(handle, devid, 0xdb, 0x6f);
  325. fc8300_write(handle, devid, 0xdc, 0x77);
  326. fc8300_write(handle, devid, 0xdd, 0x97);
  327. fc8300_write(handle, devid, 0xe9, 0x79);
  328. fc8300_write(handle, devid, 0xed, 0x0c);
  329. fc8300_write(handle, devid, 0xef, 0xb7);
  330. fc8300_write(handle, devid, 0x2a, 0xb2);
  331. fc8300_write(handle, devid, 0x2b, 0xb5);
  332. fc8300_write(handle, devid, 0x2c, 0xd5);
  333. fc8300_write(handle, devid, 0x2d, 0xd8);
  334. fc8300_write(handle, devid, 0xcd, 0x41);
  335. fc8300_write(handle, devid, 0xce, 0x88);
  336. fc8300_write(handle, devid, 0xcf, 0x01);
  337. fc8300_write(handle, devid, 0x2e, 0x64);
  338. fc8300_write(handle, devid, 0x2f, 0x91);
  339. }
  340. static void fc8300_tmm_1seg_init(HANDLE handle, DEVICEID devid, u16 filter_cal)
  341. {
  342. fc8300_write(handle, devid, 0x00, 0x00);
  343. fc8300_write(handle, devid, 0x02, 0x03);
  344. fc8300_write(handle, devid, 0x03, 0x04);
  345. fc8300_write(handle, devid, 0x04, 0x10);
  346. fc8300_write(handle, devid, 0x08, 0xe4);
  347. fc8300_write(handle, devid, 0x13, 0x07);
  348. fc8300_write(handle, devid, 0x15, 0x46);
  349. fc8300_write(handle, devid, 0x16, 0x42);
  350. fc8300_write(handle, devid, 0x17, 0x42);
  351. fc8300_write(handle, devid, 0x1a, 0x42);
  352. fc8300_write(handle, devid, 0x1c, 0x00);
  353. fc8300_write(handle, devid, 0x1d, 0x00);
  354. fc8300_write(handle, devid, 0x1f, 0x77);
  355. fc8300_write(handle, devid, 0x20, 0x42);
  356. fc8300_write(handle, devid, 0x21, 0x10);
  357. fc8300_write(handle, devid, 0x24, 0x98);
  358. fc8300_write(handle, devid, 0x3f, 0x01);
  359. fc8300_write(handle, devid, 0x40, (0x44 + (filter_cal / 256)));
  360. fc8300_write(handle, devid, 0x41, (filter_cal % 256));
  361. fc8300_write(handle, devid, 0x3f, 0x00);
  362. fc8300_write(handle, devid, 0x33, 0x88);
  363. fc8300_write(handle, devid, 0x34, 0x86);
  364. fc8300_write(handle, devid, 0x37, 0x65);
  365. fc8300_write(handle, devid, 0x38, 0x55);
  366. fc8300_write(handle, devid, 0x39, 0x02);
  367. fc8300_write(handle, devid, 0x3c, 0xff);
  368. fc8300_write(handle, devid, 0x3d, 0xff);
  369. fc8300_write(handle, devid, 0x3e, 0xab);
  370. fc8300_write(handle, devid, 0x50, 0xff);
  371. fc8300_write(handle, devid, 0x70, 0x5f);
  372. fc8300_write(handle, devid, 0x78, 0x31);
  373. fc8300_write(handle, devid, 0x82, 0x88);
  374. fc8300_write(handle, devid, 0x84, 0x14);
  375. fc8300_write(handle, devid, 0x85, 0x0f);
  376. fc8300_write(handle, devid, 0x86, 0x3f);
  377. fc8300_write(handle, devid, 0x87, 0x18);
  378. fc8300_write(handle, devid, 0x88, 0x0e);
  379. fc8300_write(handle, devid, 0x89, 0x0b);
  380. fc8300_write(handle, devid, 0x8a, 0x15);
  381. fc8300_write(handle, devid, 0x8b, 0x0e);
  382. fc8300_write(handle, devid, 0x8f, 0xb6);
  383. fc8300_write(handle, devid, 0x90, 0xb2);
  384. fc8300_write(handle, devid, 0x91, 0x68);
  385. fc8300_write(handle, devid, 0xb2, 0x00);
  386. fc8300_write(handle, devid, 0xb3, 0x04);
  387. fc8300_write(handle, devid, 0xb4, 0x00);
  388. fc8300_write(handle, devid, 0xb5, 0x04);
  389. fc8300_write(handle, devid, 0xb6, 0x00);
  390. fc8300_write(handle, devid, 0xb7, 0x07);
  391. fc8300_write(handle, devid, 0xb8, 0x00);
  392. fc8300_write(handle, devid, 0xb9, 0x07);
  393. fc8300_write(handle, devid, 0xba, 0x00);
  394. fc8300_write(handle, devid, 0xbb, 0x07);
  395. fc8300_write(handle, devid, 0xbc, 0x00);
  396. fc8300_write(handle, devid, 0xbd, 0x07);
  397. fc8300_write(handle, devid, 0xbe, 0x00);
  398. fc8300_write(handle, devid, 0xbf, 0x0a);
  399. fc8300_write(handle, devid, 0xc0, 0x0a);
  400. fc8300_write(handle, devid, 0xc1, 0x00);
  401. fc8300_write(handle, devid, 0xc2, 0x13);
  402. fc8300_write(handle, devid, 0xc3, 0x00);
  403. fc8300_write(handle, devid, 0xcf, 0x03);
  404. fc8300_write(handle, devid, 0xd3, 0x00);
  405. fc8300_write(handle, devid, 0xd4, 0x01);
  406. fc8300_write(handle, devid, 0xd5, 0x05);
  407. fc8300_write(handle, devid, 0xd6, 0x0d);
  408. fc8300_write(handle, devid, 0xd7, 0x0e);
  409. fc8300_write(handle, devid, 0xd8, 0x0f);
  410. fc8300_write(handle, devid, 0xd9, 0x2f);
  411. fc8300_write(handle, devid, 0xda, 0x4f);
  412. fc8300_write(handle, devid, 0xdb, 0x6f);
  413. fc8300_write(handle, devid, 0xdc, 0x77);
  414. fc8300_write(handle, devid, 0xdd, 0x97);
  415. fc8300_write(handle, devid, 0xe9, 0x79);
  416. fc8300_write(handle, devid, 0xed, 0x0c);
  417. fc8300_write(handle, devid, 0xef, 0xb7);
  418. }
  419. static void fc8300_tsb_1seg_init(HANDLE handle, DEVICEID devid, u16 filter_cal)
  420. {
  421. fc8300_write(handle, devid, 0x00, 0x00);
  422. fc8300_write(handle, devid, 0x02, 0x05);
  423. fc8300_write(handle, devid, 0x03, 0x04);
  424. fc8300_write(handle, devid, 0x04, 0x10);
  425. fc8300_write(handle, devid, 0x08, 0x21);
  426. fc8300_write(handle, devid, 0x13, 0x07);
  427. fc8300_write(handle, devid, 0x15, 0x46);
  428. fc8300_write(handle, devid, 0x16, 0x42);
  429. fc8300_write(handle, devid, 0x17, 0x42);
  430. fc8300_write(handle, devid, 0x1a, 0x42);
  431. fc8300_write(handle, devid, 0x1b, 0x42);
  432. fc8300_write(handle, devid, 0x1d, 0x00);
  433. fc8300_write(handle, devid, 0x1f, 0x74);
  434. fc8300_write(handle, devid, 0x20, 0x21);
  435. fc8300_write(handle, devid, 0x21, 0x10);
  436. fc8300_write(handle, devid, 0x24, 0x98);
  437. fc8300_write(handle, devid, 0x2e, 0x64);
  438. fc8300_write(handle, devid, 0x2f, 0x81);
  439. fc8300_write(handle, devid, 0x3f, 0x01);
  440. fc8300_write(handle, devid, 0x40, (0x44 + (filter_cal / 256)));
  441. fc8300_write(handle, devid, 0x41, (filter_cal % 256));
  442. fc8300_write(handle, devid, 0x3f, 0x00);
  443. fc8300_write(handle, devid, 0x33, 0x84);
  444. fc8300_write(handle, devid, 0x34, 0x32);
  445. fc8300_write(handle, devid, 0x37, 0x65);
  446. fc8300_write(handle, devid, 0x38, 0x55);
  447. fc8300_write(handle, devid, 0x39, 0x02);
  448. fc8300_write(handle, devid, 0x3c, 0xff);
  449. fc8300_write(handle, devid, 0x3d, 0xff);
  450. fc8300_write(handle, devid, 0x3e, 0xab);
  451. fc8300_write(handle, devid, 0x50, 0xff);
  452. fc8300_write(handle, devid, 0x70, 0x5f);
  453. fc8300_write(handle, devid, 0x78, 0x31);
  454. fc8300_write(handle, devid, 0x82, 0x88);
  455. fc8300_write(handle, devid, 0x84, 0x14);
  456. fc8300_write(handle, devid, 0x85, 0x0f);
  457. fc8300_write(handle, devid, 0x86, 0x3f);
  458. fc8300_write(handle, devid, 0x87, 0x18);
  459. fc8300_write(handle, devid, 0x88, 0x0e);
  460. fc8300_write(handle, devid, 0x89, 0x0b);
  461. fc8300_write(handle, devid, 0x8a, 0x15);
  462. fc8300_write(handle, devid, 0x8b, 0x0e);
  463. fc8300_write(handle, devid, 0x90, 0xb2);
  464. fc8300_write(handle, devid, 0x91, 0x78);
  465. fc8300_write(handle, devid, 0xb2, 0x00);
  466. fc8300_write(handle, devid, 0xb3, 0x04);
  467. fc8300_write(handle, devid, 0xb4, 0x00);
  468. fc8300_write(handle, devid, 0xb5, 0x04);
  469. fc8300_write(handle, devid, 0xb6, 0x00);
  470. fc8300_write(handle, devid, 0xb7, 0x07);
  471. fc8300_write(handle, devid, 0xb8, 0x00);
  472. fc8300_write(handle, devid, 0xb9, 0x07);
  473. fc8300_write(handle, devid, 0xba, 0x00);
  474. fc8300_write(handle, devid, 0xbb, 0x07);
  475. fc8300_write(handle, devid, 0xbc, 0x00);
  476. fc8300_write(handle, devid, 0xbd, 0x0a);
  477. fc8300_write(handle, devid, 0xbe, 0x00);
  478. fc8300_write(handle, devid, 0xbf, 0x0a);
  479. fc8300_write(handle, devid, 0xc0, 0x0a);
  480. fc8300_write(handle, devid, 0xc1, 0x00);
  481. fc8300_write(handle, devid, 0xc2, 0x13);
  482. fc8300_write(handle, devid, 0xc3, 0x00);
  483. fc8300_write(handle, devid, 0xd3, 0x00);
  484. fc8300_write(handle, devid, 0xd4, 0x01);
  485. fc8300_write(handle, devid, 0xd5, 0x05);
  486. fc8300_write(handle, devid, 0xd6, 0x0d);
  487. fc8300_write(handle, devid, 0xd7, 0x0e);
  488. fc8300_write(handle, devid, 0xd8, 0x0f);
  489. fc8300_write(handle, devid, 0xd9, 0x2f);
  490. fc8300_write(handle, devid, 0xda, 0x4f);
  491. fc8300_write(handle, devid, 0xdb, 0x6f);
  492. fc8300_write(handle, devid, 0xdc, 0x77);
  493. fc8300_write(handle, devid, 0xdd, 0x97);
  494. fc8300_write(handle, devid, 0x8f, 0xb6);
  495. fc8300_write(handle, devid, 0xe9, 0x79);
  496. fc8300_write(handle, devid, 0xed, 0x0c);
  497. fc8300_write(handle, devid, 0xef, 0xb7);
  498. }
  499. static void fc8300_tsb_3seg_init(HANDLE handle, DEVICEID devid, u8 filter_cal)
  500. {
  501. fc8300_write(handle, devid, 0x00, 0x00);
  502. fc8300_write(handle, devid, 0x02, 0x05);
  503. fc8300_write(handle, devid, 0x03, 0x04);
  504. fc8300_write(handle, devid, 0x04, 0x10);
  505. fc8300_write(handle, devid, 0x08, 0x21);
  506. fc8300_write(handle, devid, 0x13, 0x07);
  507. fc8300_write(handle, devid, 0x15, 0x46);
  508. fc8300_write(handle, devid, 0x16, 0x42);
  509. fc8300_write(handle, devid, 0x17, 0x42);
  510. fc8300_write(handle, devid, 0x1a, 0x42);
  511. fc8300_write(handle, devid, 0x1b, 0x42);
  512. fc8300_write(handle, devid, 0x1d, 0x00);
  513. fc8300_write(handle, devid, 0x1f, 0x74);
  514. fc8300_write(handle, devid, 0x20, 0x21);
  515. fc8300_write(handle, devid, 0x21, 0x10);
  516. fc8300_write(handle, devid, 0x24, 0x98);
  517. fc8300_write(handle, devid, 0x2e, 0x64);
  518. fc8300_write(handle, devid, 0x2f, 0x71);
  519. fc8300_write(handle, devid, 0x3f, 0x01);
  520. fc8300_write(handle, devid, 0x41, filter_cal);
  521. fc8300_write(handle, devid, 0x3f, 0x00);
  522. fc8300_write(handle, devid, 0x33, 0x84);
  523. fc8300_write(handle, devid, 0x34, 0x32);
  524. fc8300_write(handle, devid, 0x37, 0x65);
  525. fc8300_write(handle, devid, 0x38, 0x55);
  526. fc8300_write(handle, devid, 0x39, 0x02);
  527. fc8300_write(handle, devid, 0x3c, 0xff);
  528. fc8300_write(handle, devid, 0x3d, 0xff);
  529. fc8300_write(handle, devid, 0x3e, 0xab);
  530. fc8300_write(handle, devid, 0x50, 0xff);
  531. fc8300_write(handle, devid, 0x70, 0x5f);
  532. fc8300_write(handle, devid, 0x78, 0x31);
  533. fc8300_write(handle, devid, 0x82, 0x88);
  534. fc8300_write(handle, devid, 0x84, 0x14);
  535. fc8300_write(handle, devid, 0x85, 0x0f);
  536. fc8300_write(handle, devid, 0x86, 0x3f);
  537. fc8300_write(handle, devid, 0x87, 0x18);
  538. fc8300_write(handle, devid, 0x88, 0x0e);
  539. fc8300_write(handle, devid, 0x89, 0x0b);
  540. fc8300_write(handle, devid, 0x8a, 0x15);
  541. fc8300_write(handle, devid, 0x8b, 0x0e);
  542. fc8300_write(handle, devid, 0x8f, 0xb6);
  543. fc8300_write(handle, devid, 0x90, 0xb2);
  544. fc8300_write(handle, devid, 0x91, 0x68);
  545. fc8300_write(handle, devid, 0xb2, 0x00);
  546. fc8300_write(handle, devid, 0xb3, 0x04);
  547. fc8300_write(handle, devid, 0xb4, 0x00);
  548. fc8300_write(handle, devid, 0xb5, 0x04);
  549. fc8300_write(handle, devid, 0xb6, 0x00);
  550. fc8300_write(handle, devid, 0xb7, 0x07);
  551. fc8300_write(handle, devid, 0xb8, 0x00);
  552. fc8300_write(handle, devid, 0xb9, 0x07);
  553. fc8300_write(handle, devid, 0xba, 0x00);
  554. fc8300_write(handle, devid, 0xbb, 0x07);
  555. fc8300_write(handle, devid, 0xbc, 0x00);
  556. fc8300_write(handle, devid, 0xbd, 0x0a);
  557. fc8300_write(handle, devid, 0xbe, 0x00);
  558. fc8300_write(handle, devid, 0xbf, 0x0a);
  559. fc8300_write(handle, devid, 0xc0, 0x0a);
  560. fc8300_write(handle, devid, 0xc1, 0x00);
  561. fc8300_write(handle, devid, 0xc2, 0x13);
  562. fc8300_write(handle, devid, 0xc3, 0x00);
  563. fc8300_write(handle, devid, 0xd3, 0x00);
  564. fc8300_write(handle, devid, 0xd4, 0x01);
  565. fc8300_write(handle, devid, 0xd5, 0x05);
  566. fc8300_write(handle, devid, 0xd6, 0x0d);
  567. fc8300_write(handle, devid, 0xd7, 0x0e);
  568. fc8300_write(handle, devid, 0xd8, 0x0f);
  569. fc8300_write(handle, devid, 0xd9, 0x2f);
  570. fc8300_write(handle, devid, 0xda, 0x4f);
  571. fc8300_write(handle, devid, 0xdb, 0x6f);
  572. fc8300_write(handle, devid, 0xdc, 0x77);
  573. fc8300_write(handle, devid, 0xdd, 0x97);
  574. fc8300_write(handle, devid, 0xe9, 0x79);
  575. fc8300_write(handle, devid, 0xed, 0x0c);
  576. fc8300_write(handle, devid, 0xef, 0xb7);
  577. }
  578. static void fc8300_13seg_init(HANDLE handle, DEVICEID devid, u8 filter_cal)
  579. {
  580. fc8300_write(handle, devid, 0x00, 0x00);
  581. fc8300_write(handle, devid, 0x02, 0x01);
  582. fc8300_write(handle, devid, 0x03, 0x04);
  583. fc8300_write(handle, devid, 0x04, 0x10);
  584. fc8300_write(handle, devid, 0x08, 0xe4);
  585. fc8300_write(handle, devid, 0x13, 0x07);
  586. fc8300_write(handle, devid, 0x15, 0x46);
  587. fc8300_write(handle, devid, 0x1d, 0x10);
  588. fc8300_write(handle, devid, 0x21, 0x30);
  589. fc8300_write(handle, devid, 0x24, 0x98);
  590. fc8300_write(handle, devid, 0x3f, 0x01);
  591. fc8300_write(handle, devid, 0x41, filter_cal);
  592. fc8300_write(handle, devid, 0x3f, 0x00);
  593. fc8300_write(handle, devid, 0x33, 0x86);
  594. fc8300_write(handle, devid, 0x34, 0x44);
  595. fc8300_write(handle, devid, 0x37, 0x65);
  596. fc8300_write(handle, devid, 0x38, 0x55);
  597. fc8300_write(handle, devid, 0x39, 0x02);
  598. fc8300_write(handle, devid, 0x3c, 0xff);
  599. fc8300_write(handle, devid, 0x3d, 0xff);
  600. fc8300_write(handle, devid, 0x3e, 0xab);
  601. fc8300_write(handle, devid, 0x4d, 0x01);
  602. fc8300_write(handle, devid, 0x50, 0xff);
  603. fc8300_write(handle, devid, 0x54, 0x80);
  604. fc8300_write(handle, devid, 0x70, 0x5f);
  605. fc8300_write(handle, devid, 0x78, 0x31);
  606. fc8300_write(handle, devid, 0x82, 0x88);
  607. fc8300_write(handle, devid, 0x84, 0x18);
  608. fc8300_write(handle, devid, 0x85, 0x0c);
  609. fc8300_write(handle, devid, 0x86, 0x3f);
  610. fc8300_write(handle, devid, 0x87, 0x18);
  611. fc8300_write(handle, devid, 0x88, 0x0e);
  612. fc8300_write(handle, devid, 0x89, 0x0b);
  613. fc8300_write(handle, devid, 0x8a, 0x15);
  614. fc8300_write(handle, devid, 0x8b, 0x0e);
  615. fc8300_write(handle, devid, 0x8f, 0xb6);
  616. fc8300_write(handle, devid, 0x91, 0x78);
  617. fc8300_write(handle, devid, 0x90, 0xb2);
  618. fc8300_write(handle, devid, 0xb2, 0x00);
  619. fc8300_write(handle, devid, 0xb3, 0x04);
  620. fc8300_write(handle, devid, 0xb4, 0x00);
  621. fc8300_write(handle, devid, 0xb5, 0x04);
  622. fc8300_write(handle, devid, 0xb6, 0x00);
  623. fc8300_write(handle, devid, 0xb7, 0x07);
  624. fc8300_write(handle, devid, 0xb8, 0x00);
  625. fc8300_write(handle, devid, 0xb9, 0x0a);
  626. fc8300_write(handle, devid, 0xba, 0x05);
  627. fc8300_write(handle, devid, 0xbb, 0x0c);
  628. fc8300_write(handle, devid, 0xbc, 0x05);
  629. fc8300_write(handle, devid, 0xbd, 0x0c);
  630. fc8300_write(handle, devid, 0xbe, 0x05);
  631. fc8300_write(handle, devid, 0xbf, 0x0c);
  632. fc8300_write(handle, devid, 0xc0, 0x0c);
  633. fc8300_write(handle, devid, 0xc1, 0x05);
  634. fc8300_write(handle, devid, 0xc2, 0x13);
  635. fc8300_write(handle, devid, 0xc3, 0x05);
  636. fc8300_write(handle, devid, 0xd3, 0x00);
  637. fc8300_write(handle, devid, 0xd4, 0x01);
  638. fc8300_write(handle, devid, 0xd5, 0x05);
  639. fc8300_write(handle, devid, 0xd6, 0x0d);
  640. fc8300_write(handle, devid, 0xd7, 0x0e);
  641. fc8300_write(handle, devid, 0xd8, 0x0f);
  642. fc8300_write(handle, devid, 0xd9, 0x2f);
  643. fc8300_write(handle, devid, 0xda, 0x4f);
  644. fc8300_write(handle, devid, 0xdb, 0x6f);
  645. fc8300_write(handle, devid, 0xdc, 0x77);
  646. fc8300_write(handle, devid, 0xdd, 0x97);
  647. fc8300_write(handle, devid, 0xe9, 0x79);
  648. fc8300_write(handle, devid, 0xed, 0x0c);
  649. fc8300_write(handle, devid, 0xef, 0xb7);
  650. fc8300_write(handle, devid, 0x2a, 0xb2);
  651. fc8300_write(handle, devid, 0x2b, 0xb5);
  652. fc8300_write(handle, devid, 0x2c, 0xd5);
  653. fc8300_write(handle, devid, 0x2d, 0xd8);
  654. fc8300_write(handle, devid, 0xcd, 0x41);
  655. fc8300_write(handle, devid, 0xce, 0x88);
  656. fc8300_write(handle, devid, 0xcf, 0x01);
  657. fc8300_write(handle, devid, 0x2e, 0x46);
  658. fc8300_write(handle, devid, 0x2f, 0x91);
  659. }
  660. static void fc8300_tmm_13seg_init(HANDLE handle, DEVICEID devid, u8 filter_cal)
  661. {
  662. fc8300_write(handle, devid, 0x00, 0x00);
  663. fc8300_write(handle, devid, 0x02, 0x03);
  664. fc8300_write(handle, devid, 0x03, 0x04);
  665. fc8300_write(handle, devid, 0x08, 0xe4);
  666. fc8300_write(handle, devid, 0x04, 0x10);
  667. fc8300_write(handle, devid, 0x13, 0x07);
  668. fc8300_write(handle, devid, 0x15, 0x46);
  669. fc8300_write(handle, devid, 0x16, 0x42);
  670. fc8300_write(handle, devid, 0x17, 0x42);
  671. fc8300_write(handle, devid, 0x1a, 0x42);
  672. fc8300_write(handle, devid, 0x1c, 0x00);
  673. fc8300_write(handle, devid, 0x1d, 0x00);
  674. fc8300_write(handle, devid, 0x1f, 0x77);
  675. fc8300_write(handle, devid, 0x20, 0x42);
  676. fc8300_write(handle, devid, 0x21, 0x10);
  677. fc8300_write(handle, devid, 0x24, 0x98);
  678. fc8300_write(handle, devid, 0x3f, 0x01);
  679. fc8300_write(handle, devid, 0x41, filter_cal);
  680. fc8300_write(handle, devid, 0x3f, 0x00);
  681. fc8300_write(handle, devid, 0x33, 0x88);
  682. fc8300_write(handle, devid, 0x34, 0x86);
  683. fc8300_write(handle, devid, 0x37, 0x65);
  684. fc8300_write(handle, devid, 0x38, 0x55);
  685. fc8300_write(handle, devid, 0x39, 0x02);
  686. fc8300_write(handle, devid, 0x3c, 0xff);
  687. fc8300_write(handle, devid, 0x3d, 0xff);
  688. fc8300_write(handle, devid, 0x3e, 0xab);
  689. fc8300_write(handle, devid, 0x50, 0xff);
  690. fc8300_write(handle, devid, 0x70, 0x5f);
  691. fc8300_write(handle, devid, 0x78, 0x31);
  692. fc8300_write(handle, devid, 0x82, 0x88);
  693. fc8300_write(handle, devid, 0x84, 0x14);
  694. fc8300_write(handle, devid, 0x85, 0x0f);
  695. fc8300_write(handle, devid, 0x86, 0x3f);
  696. fc8300_write(handle, devid, 0x87, 0x18);
  697. fc8300_write(handle, devid, 0x88, 0x0e);
  698. fc8300_write(handle, devid, 0x89, 0x0b);
  699. fc8300_write(handle, devid, 0x8a, 0x15);
  700. fc8300_write(handle, devid, 0x8b, 0x0e);
  701. fc8300_write(handle, devid, 0x8f, 0xb6);
  702. fc8300_write(handle, devid, 0x90, 0xb2);
  703. fc8300_write(handle, devid, 0x91, 0x68);
  704. fc8300_write(handle, devid, 0xb2, 0x00);
  705. fc8300_write(handle, devid, 0xb3, 0x04);
  706. fc8300_write(handle, devid, 0xb4, 0x00);
  707. fc8300_write(handle, devid, 0xb5, 0x04);
  708. fc8300_write(handle, devid, 0xb6, 0x00);
  709. fc8300_write(handle, devid, 0xb7, 0x07);
  710. fc8300_write(handle, devid, 0xb8, 0x00);
  711. fc8300_write(handle, devid, 0xb9, 0x07);
  712. fc8300_write(handle, devid, 0xba, 0x00);
  713. fc8300_write(handle, devid, 0xbb, 0x07);
  714. fc8300_write(handle, devid, 0xbc, 0x00);
  715. fc8300_write(handle, devid, 0xbd, 0x0a);
  716. fc8300_write(handle, devid, 0xbe, 0x00);
  717. fc8300_write(handle, devid, 0xbf, 0x0a);
  718. fc8300_write(handle, devid, 0xc0, 0x0a);
  719. fc8300_write(handle, devid, 0xc1, 0x00);
  720. fc8300_write(handle, devid, 0xc2, 0x13);
  721. fc8300_write(handle, devid, 0xc3, 0x00);
  722. fc8300_write(handle, devid, 0xcf, 0x01);
  723. fc8300_write(handle, devid, 0xd3, 0x00);
  724. fc8300_write(handle, devid, 0xd4, 0x01);
  725. fc8300_write(handle, devid, 0xd5, 0x05);
  726. fc8300_write(handle, devid, 0xd6, 0x0d);
  727. fc8300_write(handle, devid, 0xd7, 0x0e);
  728. fc8300_write(handle, devid, 0xd8, 0x0f);
  729. fc8300_write(handle, devid, 0xd9, 0x2f);
  730. fc8300_write(handle, devid, 0xda, 0x4f);
  731. fc8300_write(handle, devid, 0xdb, 0x6f);
  732. fc8300_write(handle, devid, 0xdc, 0x77);
  733. fc8300_write(handle, devid, 0xdd, 0x97);
  734. fc8300_write(handle, devid, 0xe9, 0x79);
  735. fc8300_write(handle, devid, 0xed, 0x0c);
  736. fc8300_write(handle, devid, 0xef, 0xb7);
  737. }
  738. static void fc8300_catv_h_init(HANDLE handle, DEVICEID devid, u8 filter_cal)
  739. {
  740. fc8300_write(handle, devid, 0x00, 0x00);
  741. fc8300_write(handle, devid, 0x02, 0x01);
  742. fc8300_write(handle, devid, 0x03, 0x04);
  743. fc8300_write(handle, devid, 0x04, 0x10);
  744. fc8300_write(handle, devid, 0x08, 0xe4);
  745. fc8300_write(handle, devid, 0x13, 0x07);
  746. fc8300_write(handle, devid, 0x15, 0x47);
  747. fc8300_write(handle, devid, 0x1d, 0x10);
  748. fc8300_write(handle, devid, 0x21, 0x30);
  749. fc8300_write(handle, devid, 0x24, 0x98);
  750. fc8300_write(handle, devid, 0x3f, 0x01);
  751. fc8300_write(handle, devid, 0x41, filter_cal);
  752. fc8300_write(handle, devid, 0x3f, 0x00);
  753. fc8300_write(handle, devid, 0x33, 0x86);
  754. fc8300_write(handle, devid, 0x34, 0x44);
  755. fc8300_write(handle, devid, 0x37, 0x65);
  756. fc8300_write(handle, devid, 0x38, 0x55);
  757. fc8300_write(handle, devid, 0x39, 0x02);
  758. fc8300_write(handle, devid, 0x3c, 0xff);
  759. fc8300_write(handle, devid, 0x3d, 0xff);
  760. fc8300_write(handle, devid, 0x3e, 0xab);
  761. fc8300_write(handle, devid, 0x4d, 0x01);
  762. fc8300_write(handle, devid, 0x50, 0xff);
  763. fc8300_write(handle, devid, 0x54, 0x80);
  764. fc8300_write(handle, devid, 0x70, 0x5f);
  765. fc8300_write(handle, devid, 0x78, 0x31);
  766. fc8300_write(handle, devid, 0x82, 0x88);
  767. fc8300_write(handle, devid, 0x84, 0x18);
  768. fc8300_write(handle, devid, 0x85, 0x0c);
  769. fc8300_write(handle, devid, 0x86, 0x3f);
  770. fc8300_write(handle, devid, 0x87, 0x18);
  771. fc8300_write(handle, devid, 0x88, 0x0e);
  772. fc8300_write(handle, devid, 0x89, 0x0b);
  773. fc8300_write(handle, devid, 0x8a, 0x15);
  774. fc8300_write(handle, devid, 0x8b, 0x0e);
  775. fc8300_write(handle, devid, 0x8f, 0xb6);
  776. fc8300_write(handle, devid, 0x91, 0x78);
  777. fc8300_write(handle, devid, 0x90, 0xb2);
  778. fc8300_write(handle, devid, 0xb2, 0x00);
  779. fc8300_write(handle, devid, 0xb3, 0x01);
  780. fc8300_write(handle, devid, 0xb4, 0x00);
  781. fc8300_write(handle, devid, 0xb5, 0x02);
  782. fc8300_write(handle, devid, 0xb6, 0x00);
  783. fc8300_write(handle, devid, 0xb7, 0x07);
  784. fc8300_write(handle, devid, 0xb8, 0x00);
  785. fc8300_write(handle, devid, 0xb9, 0x0a);
  786. fc8300_write(handle, devid, 0xba, 0x05);
  787. fc8300_write(handle, devid, 0xbb, 0x07);
  788. fc8300_write(handle, devid, 0xbc, 0x05);
  789. fc8300_write(handle, devid, 0xbd, 0x07);
  790. fc8300_write(handle, devid, 0xbe, 0x05);
  791. fc8300_write(handle, devid, 0xbf, 0x0c);
  792. fc8300_write(handle, devid, 0xc0, 0x0c);
  793. fc8300_write(handle, devid, 0xc1, 0x05);
  794. fc8300_write(handle, devid, 0xc2, 0x13);
  795. fc8300_write(handle, devid, 0xc3, 0x05);
  796. fc8300_write(handle, devid, 0xd3, 0x00);
  797. fc8300_write(handle, devid, 0xd4, 0x01);
  798. fc8300_write(handle, devid, 0xd5, 0x05);
  799. fc8300_write(handle, devid, 0xd6, 0x0d);
  800. fc8300_write(handle, devid, 0xd7, 0x0e);
  801. fc8300_write(handle, devid, 0xd8, 0x0f);
  802. fc8300_write(handle, devid, 0xd9, 0x2f);
  803. fc8300_write(handle, devid, 0xda, 0x4f);
  804. fc8300_write(handle, devid, 0xdb, 0x6f);
  805. fc8300_write(handle, devid, 0xdc, 0x77);
  806. fc8300_write(handle, devid, 0xdd, 0x97);
  807. fc8300_write(handle, devid, 0xe9, 0x79);
  808. fc8300_write(handle, devid, 0xed, 0x0c);
  809. fc8300_write(handle, devid, 0xef, 0xb7);
  810. fc8300_write(handle, devid, 0x2a, 0xb2);
  811. fc8300_write(handle, devid, 0x2b, 0xb5);
  812. fc8300_write(handle, devid, 0x2c, 0xd5);
  813. fc8300_write(handle, devid, 0x2d, 0xd8);
  814. fc8300_write(handle, devid, 0xcd, 0x41);
  815. fc8300_write(handle, devid, 0xce, 0x88);
  816. fc8300_write(handle, devid, 0xcf, 0x01);
  817. fc8300_write(handle, devid, 0x2e, 0x46);
  818. fc8300_write(handle, devid, 0x2f, 0x91);
  819. }
  820. static void fc8300_catv_l_init(HANDLE handle, DEVICEID devid, u8 filter_cal)
  821. {
  822. fc8300_write(handle, devid, 0x00, 0x00);
  823. fc8300_write(handle, devid, 0x02, 0x03);
  824. fc8300_write(handle, devid, 0x03, 0x04);
  825. fc8300_write(handle, devid, 0x08, 0xe4);
  826. fc8300_write(handle, devid, 0x04, 0x10);
  827. fc8300_write(handle, devid, 0x13, 0x07);
  828. fc8300_write(handle, devid, 0x15, 0x46);
  829. fc8300_write(handle, devid, 0x16, 0x42);
  830. fc8300_write(handle, devid, 0x17, 0x42);
  831. fc8300_write(handle, devid, 0x1a, 0x42);
  832. fc8300_write(handle, devid, 0x1c, 0x00);
  833. fc8300_write(handle, devid, 0x1d, 0x00);
  834. fc8300_write(handle, devid, 0x1f, 0x77);
  835. fc8300_write(handle, devid, 0x20, 0x42);
  836. fc8300_write(handle, devid, 0x21, 0x10);
  837. fc8300_write(handle, devid, 0x24, 0x98);
  838. fc8300_write(handle, devid, 0x3f, 0x01);
  839. fc8300_write(handle, devid, 0x41, filter_cal);
  840. fc8300_write(handle, devid, 0x3f, 0x00);
  841. fc8300_write(handle, devid, 0x33, 0x88);
  842. fc8300_write(handle, devid, 0x34, 0x86);
  843. fc8300_write(handle, devid, 0x37, 0x65);
  844. fc8300_write(handle, devid, 0x38, 0x55);
  845. fc8300_write(handle, devid, 0x39, 0x02);
  846. fc8300_write(handle, devid, 0x3c, 0xff);
  847. fc8300_write(handle, devid, 0x3d, 0xff);
  848. fc8300_write(handle, devid, 0x3e, 0xab);
  849. fc8300_write(handle, devid, 0x50, 0xff);
  850. fc8300_write(handle, devid, 0x70, 0x5f);
  851. fc8300_write(handle, devid, 0x78, 0x31);
  852. fc8300_write(handle, devid, 0x82, 0x88);
  853. fc8300_write(handle, devid, 0x84, 0x14);
  854. fc8300_write(handle, devid, 0x85, 0x0f);
  855. fc8300_write(handle, devid, 0x86, 0x3f);
  856. fc8300_write(handle, devid, 0x87, 0x18);
  857. fc8300_write(handle, devid, 0x88, 0x0e);
  858. fc8300_write(handle, devid, 0x89, 0x0b);
  859. fc8300_write(handle, devid, 0x8a, 0x15);
  860. fc8300_write(handle, devid, 0x8b, 0x0e);
  861. fc8300_write(handle, devid, 0x8f, 0xb6);
  862. fc8300_write(handle, devid, 0x90, 0xb2);
  863. fc8300_write(handle, devid, 0x91, 0x68);
  864. fc8300_write(handle, devid, 0xb2, 0x00);
  865. fc8300_write(handle, devid, 0xb3, 0x04);
  866. fc8300_write(handle, devid, 0xb4, 0x00);
  867. fc8300_write(handle, devid, 0xb5, 0x04);
  868. fc8300_write(handle, devid, 0xb6, 0x00);
  869. fc8300_write(handle, devid, 0xb7, 0x07);
  870. fc8300_write(handle, devid, 0xb8, 0x00);
  871. fc8300_write(handle, devid, 0xb9, 0x07);
  872. fc8300_write(handle, devid, 0xba, 0x00);
  873. fc8300_write(handle, devid, 0xbb, 0x07);
  874. fc8300_write(handle, devid, 0xbc, 0x00);
  875. fc8300_write(handle, devid, 0xbd, 0x0a);
  876. fc8300_write(handle, devid, 0xbe, 0x00);
  877. fc8300_write(handle, devid, 0xbf, 0x0a);
  878. fc8300_write(handle, devid, 0xc0, 0x0a);
  879. fc8300_write(handle, devid, 0xc1, 0x00);
  880. fc8300_write(handle, devid, 0xc2, 0x13);
  881. fc8300_write(handle, devid, 0xc3, 0x00);
  882. fc8300_write(handle, devid, 0xcf, 0x01);
  883. fc8300_write(handle, devid, 0xd3, 0x00);
  884. fc8300_write(handle, devid, 0xd4, 0x01);
  885. fc8300_write(handle, devid, 0xd5, 0x05);
  886. fc8300_write(handle, devid, 0xd6, 0x0d);
  887. fc8300_write(handle, devid, 0xd7, 0x0e);
  888. fc8300_write(handle, devid, 0xd8, 0x0f);
  889. fc8300_write(handle, devid, 0xd9, 0x2f);
  890. fc8300_write(handle, devid, 0xda, 0x4f);
  891. fc8300_write(handle, devid, 0xdb, 0x6f);
  892. fc8300_write(handle, devid, 0xdc, 0x77);
  893. fc8300_write(handle, devid, 0xdd, 0x97);
  894. fc8300_write(handle, devid, 0xe9, 0x79);
  895. fc8300_write(handle, devid, 0xed, 0x0c);
  896. fc8300_write(handle, devid, 0xef, 0xb7);
  897. }
  898. s32 fc8300_cs_tuner_init(HANDLE handle, DEVICEID devid,
  899. enum BROADCAST_TYPE broadcast)
  900. {
  901. u8 filter[4] = {0, 0, 0, 0};
  902. u8 filter_cal_18 = 0;
  903. u8 filter_cal_60 = 0;
  904. u8 filter_check = 0;
  905. u16 filter_cal_06 = 0;
  906. u16 filter_cal_09 = 0;
  907. u32 cal_temp = 0;
  908. s32 i = 0;
  909. u8 pd_cal_low[4] = {0, 0, 0, 0};
  910. u8 pd_cal_high[4] = {0, 0, 0, 0};
  911. for (i = 0; i < 4; i++) {
  912. pd_offset_cal[i] = 0;
  913. pd_offset_add[i] = 0;
  914. pd_offset_sign[i] = 1;
  915. tf_value[i] = 0;
  916. }
  917. broadcast_type = broadcast;
  918. /*
  919. * ISDBT_1SEG = 0 ==> 0.9
  920. * ISDBTMM_1SEG = 1 ==> 0.9
  921. * ISDBTSB_1SEG = 2 ==> 0.6
  922. * ISDBTSB_3SEG = 3 ==> 1.6
  923. * ISDBT_13SEG = 4 ==> 6 / 7 / 8
  924. * ISDBTMM_13SEG = 5 ==> 6 / 7 / 8
  925. */
  926. cal_temp = fc8300_xtal_freq * 720 / 6000;
  927. if ((cal_temp % 10) >= 5)
  928. filter_cal_06 = (cal_temp / 10) + 1;
  929. else
  930. filter_cal_06 = cal_temp / 10;
  931. cal_temp = fc8300_xtal_freq * 720 / 9000;
  932. if ((cal_temp % 10) >= 5)
  933. filter_cal_09 = (cal_temp / 10) + 1;
  934. else
  935. filter_cal_09 = cal_temp / 10;
  936. cal_temp = fc8300_xtal_freq * 720 / 16000;
  937. if ((cal_temp % 10) >= 5)
  938. filter_cal_18 = (cal_temp / 10) + 1;
  939. else
  940. filter_cal_18 = cal_temp / 10;
  941. #if (BBM_BAND_WIDTH == 6)
  942. cal_temp = fc8300_xtal_freq * 720 / 30000;
  943. #elif (BBM_BAND_WIDTH == 7)
  944. cal_temp = fc8300_xtal_freq * 720 / 35000;
  945. #else /* BBM_BAND_WIDTH == 8 */
  946. cal_temp = fc8300_xtal_freq * 720 / 40000;
  947. #endif /* #if (BBM_BAND_WIDTH == 6) */
  948. if ((cal_temp % 10) >= 5)
  949. filter_cal_60 = (cal_temp / 10) + 1;
  950. else
  951. filter_cal_60 = cal_temp / 10;
  952. switch (broadcast_type) {
  953. case ISDBT_1SEG:
  954. fc8300_1seg_init(handle, devid, filter_cal_09);
  955. pd_low_freq = 466763;
  956. pd_high_freq = 712763;
  957. channel_count = 42;
  958. break;
  959. case ISDBTMM_1SEG:
  960. fc8300_tmm_1seg_init(handle, devid, filter_cal_09);
  961. pd_low_freq = 206620;
  962. pd_high_freq = 221620;
  963. channel_count = 1;
  964. break;
  965. case ISDBTSB_1SEG:
  966. fc8300_tsb_1seg_init(handle, devid, filter_cal_06);
  967. pd_low_freq = 88000;
  968. pd_high_freq = 110000;
  969. channel_count = 1;
  970. break;
  971. case ISDBTSB_3SEG:
  972. fc8300_tsb_3seg_init(handle, devid, filter_cal_18);
  973. pd_low_freq = 88000;
  974. pd_high_freq = 110000;
  975. channel_count = 1;
  976. break;
  977. case ISDBT_13SEG:
  978. fc8300_13seg_init(handle, devid, filter_cal_60);
  979. pd_low_freq = 467143;
  980. pd_high_freq = 713143;
  981. channel_count = 42;
  982. break;
  983. case ISDBTMM_13SEG:
  984. fc8300_tmm_13seg_init(handle, devid, filter_cal_60);
  985. pd_low_freq = 200000;
  986. pd_high_freq = 230000;
  987. channel_count = 1;
  988. break;
  989. case ISDBT_CATV_13SEG:
  990. if (catv_status == 1) {
  991. fc8300_catv_l_init(handle, devid, filter_cal_60);
  992. pd_low_freq = 87143;
  993. pd_high_freq = 285143;
  994. channel_count = 34;
  995. } else if (catv_status == 2) {
  996. fc8300_catv_h_init(handle, devid, filter_cal_60);
  997. pd_low_freq = 261143;
  998. pd_high_freq = 773143;
  999. channel_count = 92;
  1000. } else {
  1001. return BBM_OK;
  1002. }
  1003. break;
  1004. default:
  1005. return BBM_NOK;
  1006. }
  1007. fc8300_write(handle, devid, 0x49, FC8300_BAND_WIDTH);
  1008. fc8300_write(handle, devid, 0x4a, broadcast_type);
  1009. fc8300_write(handle, devid, 0x4b, (u8) (fc8300_xtal_freq / 1000));
  1010. fc8300_write(handle, devid, 0xfe, DRIVER_VERSION);
  1011. if (devid == DIV_BROADCAST) {
  1012. for (i = 0; i < 30; i++) {
  1013. msWait(1);
  1014. filter_check = 0;
  1015. fc8300_read(handle, DIV_MASTER, 0x43, &filter[0]);
  1016. if (((filter[0] >> 4) & 0x01) == 1)
  1017. filter_check += 1;
  1018. if (filter_check == FC8300_CHECK)
  1019. break;
  1020. }
  1021. } else {
  1022. for (i = 0; i < 30; i++) {
  1023. msWait(1);
  1024. fc8300_read(handle, devid, 0x43, &filter[devid & 0x0f]);
  1025. if (((filter[devid & 0x0f] >> 4) & 0x01) == 1)
  1026. break;
  1027. }
  1028. }
  1029. if (fc8300_xtal_freq == 19200) {
  1030. fc8300_write(handle, devid, 0xee, 0x02);
  1031. fc8300_write(handle, devid, 0xf1, 0x52);
  1032. fc8300_write(handle, devid, 0xf2, 0x22);
  1033. fc8300_write(handle, devid, 0xf3, 0xf2);
  1034. fc8300_write(handle, devid, 0xf4, 0x22);
  1035. fc8300_write(handle, devid, 0x7c, 0x30);
  1036. fc8300_write(handle, devid, 0x7e, 0x05);
  1037. fc8300_write(handle, devid, 0x7f, 0x0a);
  1038. } else if (fc8300_xtal_freq == 24000) {
  1039. fc8300_write(handle, devid, 0xee, 0x02);
  1040. fc8300_write(handle, devid, 0xf1, 0x52);
  1041. fc8300_write(handle, devid, 0xf2, 0x2c);
  1042. fc8300_write(handle, devid, 0xf3, 0xf2);
  1043. fc8300_write(handle, devid, 0xf4, 0x2c);
  1044. fc8300_write(handle, devid, 0x7c, 0x30);
  1045. fc8300_write(handle, devid, 0x7e, 0x05);
  1046. fc8300_write(handle, devid, 0x7f, 0x0a);
  1047. } else if (fc8300_xtal_freq == 26000) {
  1048. fc8300_write(handle, devid, 0xee, 0x02);
  1049. fc8300_write(handle, devid, 0xf1, 0x52);
  1050. fc8300_write(handle, devid, 0xf2, 0x30);
  1051. fc8300_write(handle, devid, 0xf3, 0xf2);
  1052. fc8300_write(handle, devid, 0xf4, 0x30);
  1053. fc8300_write(handle, devid, 0x7c, 0x30);
  1054. fc8300_write(handle, devid, 0x7e, 0x05);
  1055. fc8300_write(handle, devid, 0x7f, 0x0a);
  1056. } else if (fc8300_xtal_freq == 27120) {
  1057. fc8300_write(handle, devid, 0xee, 0x02);
  1058. fc8300_write(handle, devid, 0xf1, 0x52);
  1059. fc8300_write(handle, devid, 0xf2, 0x32);
  1060. fc8300_write(handle, devid, 0xf3, 0xf2);
  1061. fc8300_write(handle, devid, 0xf4, 0x32);
  1062. fc8300_write(handle, devid, 0x7c, 0x30);
  1063. fc8300_write(handle, devid, 0x7e, 0x05);
  1064. fc8300_write(handle, devid, 0x7f, 0x0a);
  1065. } else if (fc8300_xtal_freq == 32000) {
  1066. fc8300_write(handle, devid, 0xee, 0x02);
  1067. fc8300_write(handle, devid, 0xf1, 0x53);
  1068. fc8300_write(handle, devid, 0xf2, 0x1a);
  1069. fc8300_write(handle, devid, 0xf3, 0xf3);
  1070. fc8300_write(handle, devid, 0xf4, 0x1a);
  1071. fc8300_write(handle, devid, 0x7c, 0x30);
  1072. fc8300_write(handle, devid, 0x7e, 0x05);
  1073. fc8300_write(handle, devid, 0x7f, 0x0a);
  1074. } else if (fc8300_xtal_freq == 37200) {
  1075. fc8300_write(handle, devid, 0xee, 0x02);
  1076. fc8300_write(handle, devid, 0xf1, 0x53);
  1077. fc8300_write(handle, devid, 0xf2, 0x20);
  1078. fc8300_write(handle, devid, 0xf3, 0xf3);
  1079. fc8300_write(handle, devid, 0xf4, 0x20);
  1080. fc8300_write(handle, devid, 0x7c, 0x30);
  1081. fc8300_write(handle, devid, 0x7e, 0x05);
  1082. fc8300_write(handle, devid, 0x7f, 0x0a);
  1083. } else if (fc8300_xtal_freq == 37400) {
  1084. fc8300_write(handle, devid, 0xee, 0x02);
  1085. fc8300_write(handle, devid, 0xf1, 0x53);
  1086. fc8300_write(handle, devid, 0xf2, 0x21);
  1087. fc8300_write(handle, devid, 0xf3, 0xf3);
  1088. fc8300_write(handle, devid, 0xf4, 0x21);
  1089. fc8300_write(handle, devid, 0x7c, 0x30);
  1090. fc8300_write(handle, devid, 0x7e, 0x05);
  1091. fc8300_write(handle, devid, 0x7f, 0x0a);
  1092. }
  1093. if (devid == DIV_BROADCAST)
  1094. vco_cal(handle, DIV_MASTER, 0);
  1095. else
  1096. vco_cal(handle, devid, 0);
  1097. if ((broadcast_type == ISDBT_13SEG) || (broadcast_type == ISDBT_1SEG) ||
  1098. (catv_status == 2)) {
  1099. fc8300_cs_set_freq(handle, devid, 545143);
  1100. fc8300_write(handle, devid, 0x1e, 0x10);
  1101. fc8300_write(handle, devid, 0x1f, 0xf2);
  1102. fc8300_write(handle, devid, 0x78, 0x37);
  1103. fc8300_write(handle, devid, 0x04, 0x12);
  1104. fc8300_write(handle, devid, 0x8d, 0x08);
  1105. fc8300_write(handle, devid, 0x8e, 0x13);
  1106. fc8300_write(handle, devid, 0x13, 0x07);
  1107. fc8300_write(handle, devid, 0x22, 0x01);
  1108. fc8300_write(handle, devid, 0x24, 0x11);
  1109. fc8300_write(handle, devid, 0x23, 0x17);
  1110. if (devid == DIV_BROADCAST)
  1111. tf_value[0] = (tf_cal(handle, DIV_MASTER) - 7);
  1112. else
  1113. tf_value[0] = (tf_cal(handle, devid) - 7);
  1114. fc8300_write(handle, devid, 0x1e, 0x00);
  1115. fc8300_write(handle, devid, 0x1f, 0x72);
  1116. fc8300_write(handle, devid, 0x78, 0x31);
  1117. fc8300_write(handle, devid, 0x04, 0x10);
  1118. fc8300_write(handle, devid, 0x22, 0x00);
  1119. }
  1120. if (devid == DIV_BROADCAST) {
  1121. for (i = 0; i < FC8300_CHECK; i++) {
  1122. pd_cal(handle, devid, pd_low_freq, pd_cal_low);
  1123. pd_cal(handle, devid, pd_high_freq, pd_cal_high);
  1124. if (pd_cal_low[i] > pd_cal_high[i]) {
  1125. pd_offset_add[i] = pd_cal_low[i] -
  1126. pd_cal_high[i] - 1;
  1127. pd_offset_cal[i] = (pd_cal_low[i] -
  1128. pd_cal_high[i]) * 1000 /
  1129. channel_count;
  1130. } else if (pd_cal_low[i] < pd_cal_high[i]) {
  1131. pd_offset_add[i] = pd_cal_high[i] -
  1132. pd_cal_low[i] - 1;
  1133. pd_offset_cal[i] = (pd_cal_high[i] -
  1134. pd_cal_low[i]) * 1000 /
  1135. channel_count;
  1136. pd_offset_sign[i] = -1;
  1137. } else {
  1138. pd_offset_add[i] = 0;
  1139. pd_offset_cal[i] = 0;
  1140. }
  1141. }
  1142. for (i = 0; i < 4; i++) {
  1143. if (pd_offset_add[i] > 1) {
  1144. pd_cal(handle, devid_set[i], pd_low_freq,
  1145. pd_cal_low);
  1146. pd_cal(handle, devid_set[i], pd_high_freq,
  1147. pd_cal_high);
  1148. if (pd_cal_low[i] > pd_cal_high[i]) {
  1149. pd_offset_add[i] = pd_cal_low[i] -
  1150. pd_cal_high[i] - 1;
  1151. pd_offset_cal[i] = (pd_cal_low[i] -
  1152. pd_cal_high[i]) * 1000 /
  1153. channel_count;
  1154. } else if (pd_cal_low[i] < pd_cal_high[i]) {
  1155. pd_offset_add[i] = pd_cal_high[i] -
  1156. pd_cal_low[i] - 1;
  1157. pd_offset_cal[i] = (pd_cal_high[i] -
  1158. pd_cal_low[i]) * 1000 /
  1159. channel_count;
  1160. pd_offset_sign[i] = -1;
  1161. } else {
  1162. pd_offset_add[i] = 0;
  1163. pd_offset_cal[i] = 0;
  1164. }
  1165. }
  1166. }
  1167. } else {
  1168. for (i = 0; i < 2; i++) {
  1169. pd_cal(handle, devid, pd_low_freq, pd_cal_low);
  1170. pd_cal(handle, devid, pd_high_freq, pd_cal_high);
  1171. if (pd_cal_low[devid & 0x0f] > pd_cal_high[devid &
  1172. 0x0f]) {
  1173. pd_offset_add[devid & 0x0f] =
  1174. pd_cal_low[devid & 0x0f] -
  1175. pd_cal_high[devid & 0x0f] - 1;
  1176. pd_offset_cal[devid & 0x0f] =
  1177. (pd_cal_low[devid & 0x0f] -
  1178. pd_cal_high[devid & 0x0f]) * 1000 /
  1179. channel_count;
  1180. } else if (pd_cal_low[devid & 0x0f] <
  1181. pd_cal_high[devid & 0x0f]) {
  1182. pd_offset_add[devid & 0x0f] =
  1183. pd_cal_high[devid & 0x0f] -
  1184. pd_cal_low[devid & 0x0f] - 1;
  1185. pd_offset_cal[devid & 0x0f] =
  1186. (pd_cal_high[devid & 0x0f] -
  1187. pd_cal_low[devid & 0x0f]) * 1000 /
  1188. channel_count;
  1189. pd_offset_sign[devid & 0x0f] = -1;
  1190. } else {
  1191. pd_offset_add[devid & 0x0f] = 0;
  1192. pd_offset_cal[devid & 0x0f] = 0;
  1193. }
  1194. if (pd_offset_add[devid & 0x0f] <= 1)
  1195. return BBM_OK;
  1196. }
  1197. }
  1198. return BBM_OK;
  1199. }
  1200. static void fc8300_set_freq_1seg(HANDLE handle, DEVICEID devid, u32 freq)
  1201. {
  1202. u8 i = 0;
  1203. for (i = 0; i < 56; i++) {
  1204. if (((ch_mode_0[xtal_freq][i][0] + 3000) > freq) &&
  1205. ((ch_mode_0[xtal_freq][i][0] - 3000) <= freq))
  1206. break;
  1207. }
  1208. fc8300_write(handle, devid, 0xe9, ch_mode_0[xtal_freq][i][1]);
  1209. fc8300_write(handle, devid, 0xef, ch_mode_0[xtal_freq][i][2]);
  1210. fc8300_write(handle, devid, 0x19, ch_mode_0[xtal_freq][i][3]);
  1211. fc8300_write(handle, devid, 0x1f, ch_mode_0[xtal_freq][i][4]);
  1212. fc8300_write(handle, devid, 0x20, ch_mode_0[xtal_freq][i][5]);
  1213. fc8300_write(handle, devid, 0x91, ch_mode_0[xtal_freq][i][6]);
  1214. fc8300_write(handle, devid, 0x33, ch_mode_0[xtal_freq][i][7]);
  1215. fc8300_write(handle, devid, 0x34, ch_mode_0[xtal_freq][i][8]);
  1216. fc8300_write(handle, devid, 0x2e, ch_mode_0[xtal_freq][i][9]);
  1217. fc8300_write(handle, devid, 0x2f, ch_mode_0[xtal_freq][i][10]);
  1218. fc8300_write(handle, devid, 0x52, ch_mode_0[xtal_freq][i][11]);
  1219. fc8300_write(handle, devid, 0x53, ch_mode_0[xtal_freq][i][12]);
  1220. fc8300_write(handle, devid, 0x54, ch_mode_0[xtal_freq][i][13]);
  1221. fc8300_write(handle, devid, 0x55, ch_mode_0[xtal_freq][i][14]);
  1222. fc8300_write(handle, devid, 0x56, ch_mode_0[xtal_freq][i][15]);
  1223. fc8300_write(handle, devid, 0x84, ch_mode_0[xtal_freq][i][16]);
  1224. fc8300_write(handle, devid, 0x85, ch_mode_0[xtal_freq][i][17]);
  1225. fc8300_write(handle, devid, 0x88, ch_mode_0[xtal_freq][i][18]);
  1226. fc8300_write(handle, devid, 0x89, ch_mode_0[xtal_freq][i][19]);
  1227. }
  1228. static void fc8300_set_freq_tmm_1seg(HANDLE handle, DEVICEID devid, u32 freq)
  1229. {
  1230. u8 i = 0;
  1231. for (i = 0; i < 8; i++) {
  1232. if (((ch_mode_1[xtal_freq][i][0] + 100) > freq) &&
  1233. ((ch_mode_1[xtal_freq][i][0] - 400) <= freq))
  1234. break;
  1235. }
  1236. fc8300_write(handle, devid, 0xe9, ch_mode_1[xtal_freq][i][1]);
  1237. fc8300_write(handle, devid, 0xef, ch_mode_1[xtal_freq][i][2]);
  1238. fc8300_write(handle, devid, 0x19, ch_mode_1[xtal_freq][i][3]);
  1239. fc8300_write(handle, devid, 0x1f, ch_mode_1[xtal_freq][i][4]);
  1240. fc8300_write(handle, devid, 0x20, ch_mode_1[xtal_freq][i][5]);
  1241. fc8300_write(handle, devid, 0x91, ch_mode_1[xtal_freq][i][6]);
  1242. fc8300_write(handle, devid, 0x33, ch_mode_1[xtal_freq][i][7]);
  1243. fc8300_write(handle, devid, 0x34, ch_mode_1[xtal_freq][i][8]);
  1244. fc8300_write(handle, devid, 0x2e, ch_mode_1[xtal_freq][i][9]);
  1245. fc8300_write(handle, devid, 0x2f, ch_mode_1[xtal_freq][i][10]);
  1246. fc8300_write(handle, devid, 0x52, ch_mode_1[xtal_freq][i][11]);
  1247. fc8300_write(handle, devid, 0x53, ch_mode_1[xtal_freq][i][12]);
  1248. fc8300_write(handle, devid, 0x54, ch_mode_1[xtal_freq][i][13]);
  1249. fc8300_write(handle, devid, 0x55, ch_mode_1[xtal_freq][i][14]);
  1250. fc8300_write(handle, devid, 0x56, ch_mode_1[xtal_freq][i][15]);
  1251. }
  1252. static void fc8300_set_freq_13seg(HANDLE handle, DEVICEID devid, u32 freq)
  1253. {
  1254. u8 i;
  1255. for (i = 0; i < 56; i++) {
  1256. if (((ch_mode_4[xtal_freq][i][0] + 3000) > freq) &&
  1257. ((ch_mode_4[xtal_freq][i][0] - 3000) <= freq))
  1258. break;
  1259. }
  1260. fc8300_write(handle, devid, 0xe9, ch_mode_4[xtal_freq][i][1]);
  1261. fc8300_write(handle, devid, 0xef, ch_mode_4[xtal_freq][i][2]);
  1262. fc8300_write(handle, devid, 0x19, ch_mode_4[xtal_freq][i][3]);
  1263. fc8300_write(handle, devid, 0x1f, ch_mode_4[xtal_freq][i][4]);
  1264. fc8300_write(handle, devid, 0x20, ch_mode_4[xtal_freq][i][5]);
  1265. fc8300_write(handle, devid, 0x91, ch_mode_4[xtal_freq][i][6]);
  1266. fc8300_write(handle, devid, 0x33, ch_mode_4[xtal_freq][i][7]);
  1267. fc8300_write(handle, devid, 0x34, ch_mode_4[xtal_freq][i][8]);
  1268. fc8300_write(handle, devid, 0x2e, ch_mode_4[xtal_freq][i][9]);
  1269. fc8300_write(handle, devid, 0x2f, ch_mode_4[xtal_freq][i][10]);
  1270. fc8300_write(handle, devid, 0x52, ch_mode_4[xtal_freq][i][11]);
  1271. fc8300_write(handle, devid, 0x53, ch_mode_4[xtal_freq][i][12]);
  1272. fc8300_write(handle, devid, 0x54, ch_mode_4[xtal_freq][i][13]);
  1273. fc8300_write(handle, devid, 0x55, ch_mode_4[xtal_freq][i][14]);
  1274. fc8300_write(handle, devid, 0x56, ch_mode_4[xtal_freq][i][15]);
  1275. fc8300_write(handle, devid, 0x84, ch_mode_4[xtal_freq][i][16]);
  1276. fc8300_write(handle, devid, 0x85, ch_mode_4[xtal_freq][i][17]);
  1277. fc8300_write(handle, devid, 0x88, ch_mode_4[xtal_freq][i][18]);
  1278. fc8300_write(handle, devid, 0x89, ch_mode_4[xtal_freq][i][19]);
  1279. }
  1280. static void fc8300_set_freq_tmm_13seg(HANDLE handle, DEVICEID devid, u32 freq)
  1281. {
  1282. u8 i;
  1283. for (i = 0; i < 1; i++) {
  1284. if (((ch_mode_5[xtal_freq][i][0] + 1500) > freq) &&
  1285. ((ch_mode_5[xtal_freq][i][0] - 1500) <= freq))
  1286. break;
  1287. }
  1288. fc8300_write(handle, devid, 0xe9, ch_mode_5[xtal_freq][i][1]);
  1289. fc8300_write(handle, devid, 0xef, ch_mode_5[xtal_freq][i][2]);
  1290. fc8300_write(handle, devid, 0x1a, ch_mode_5[xtal_freq][i][3]);
  1291. fc8300_write(handle, devid, 0x1f, ch_mode_5[xtal_freq][i][4]);
  1292. fc8300_write(handle, devid, 0x20, ch_mode_5[xtal_freq][i][5]);
  1293. fc8300_write(handle, devid, 0x91, ch_mode_5[xtal_freq][i][6]);
  1294. fc8300_write(handle, devid, 0x33, ch_mode_5[xtal_freq][i][7]);
  1295. fc8300_write(handle, devid, 0x34, ch_mode_5[xtal_freq][i][8]);
  1296. fc8300_write(handle, devid, 0x2e, ch_mode_5[xtal_freq][i][9]);
  1297. fc8300_write(handle, devid, 0x2f, ch_mode_5[xtal_freq][i][10]);
  1298. fc8300_write(handle, devid, 0x52, ch_mode_5[xtal_freq][i][11]);
  1299. fc8300_write(handle, devid, 0x53, ch_mode_5[xtal_freq][i][12]);
  1300. fc8300_write(handle, devid, 0x54, ch_mode_5[xtal_freq][i][13]);
  1301. fc8300_write(handle, devid, 0x55, ch_mode_5[xtal_freq][i][14]);
  1302. fc8300_write(handle, devid, 0x56, ch_mode_5[xtal_freq][i][15]);
  1303. }
  1304. static void fc8300_set_freq_catv_13seg(HANDLE handle, DEVICEID devid, u32 freq)
  1305. {
  1306. u8 i;
  1307. for (i = 0; i < 112; i++) {
  1308. if (((ch_mode_6[xtal_freq][i][0] + 2000) > freq) &&
  1309. ((ch_mode_6[xtal_freq][i][0] - 2000) <= freq))
  1310. break;
  1311. }
  1312. fc8300_write(handle, devid, 0xe9, ch_mode_6[xtal_freq][i][1]);
  1313. fc8300_write(handle, devid, 0xef, ch_mode_6[xtal_freq][i][2]);
  1314. fc8300_write(handle, devid, 0x19, ch_mode_6[xtal_freq][i][3]);
  1315. fc8300_write(handle, devid, 0x1a, ch_mode_6[xtal_freq][i][4]);
  1316. fc8300_write(handle, devid, 0x1f, ch_mode_6[xtal_freq][i][5]);
  1317. fc8300_write(handle, devid, 0x20, ch_mode_6[xtal_freq][i][6]);
  1318. fc8300_write(handle, devid, 0x91, ch_mode_6[xtal_freq][i][7]);
  1319. fc8300_write(handle, devid, 0x33, ch_mode_6[xtal_freq][i][8]);
  1320. fc8300_write(handle, devid, 0x34, ch_mode_6[xtal_freq][i][9]);
  1321. fc8300_write(handle, devid, 0x2e, ch_mode_6[xtal_freq][i][10]);
  1322. fc8300_write(handle, devid, 0x2f, ch_mode_6[xtal_freq][i][11]);
  1323. fc8300_write(handle, devid, 0x52, ch_mode_6[xtal_freq][i][12]);
  1324. fc8300_write(handle, devid, 0x53, ch_mode_6[xtal_freq][i][13]);
  1325. fc8300_write(handle, devid, 0x54, ch_mode_6[xtal_freq][i][14]);
  1326. fc8300_write(handle, devid, 0x55, ch_mode_6[xtal_freq][i][15]);
  1327. fc8300_write(handle, devid, 0x56, ch_mode_6[xtal_freq][i][16]);
  1328. fc8300_write(handle, devid, 0x84, ch_mode_6[xtal_freq][i][17]);
  1329. fc8300_write(handle, devid, 0x85, ch_mode_6[xtal_freq][i][18]);
  1330. fc8300_write(handle, devid, 0x88, ch_mode_6[xtal_freq][i][19]);
  1331. fc8300_write(handle, devid, 0x89, ch_mode_6[xtal_freq][i][20]);
  1332. }
  1333. s32 fc8300_cs_set_freq(HANDLE handle, DEVICEID devid, u32 freq)
  1334. {
  1335. u8 i;
  1336. u8 offset = 0;
  1337. u8 tf_cal_set = 0;
  1338. s8 pd_cal[4] = {0, 0, 0, 0};
  1339. if (fc8300_xtal_freq == 19200)
  1340. xtal_freq = XTAL_FREQ_19200;
  1341. else if (fc8300_xtal_freq == 24000)
  1342. xtal_freq = XTAL_FREQ_24000;
  1343. else if (fc8300_xtal_freq == 26000)
  1344. xtal_freq = XTAL_FREQ_26000;
  1345. else if (fc8300_xtal_freq == 27120)
  1346. xtal_freq = XTAL_FREQ_27120;
  1347. else if (fc8300_xtal_freq == 32000)
  1348. xtal_freq = XTAL_FREQ_32000;
  1349. else if (fc8300_xtal_freq == 37200)
  1350. xtal_freq = XTAL_FREQ_37200;
  1351. else if (fc8300_xtal_freq == 37400)
  1352. xtal_freq = XTAL_FREQ_37400;
  1353. switch (broadcast_type) {
  1354. case ISDBT_1SEG:
  1355. fc8300_set_freq_1seg(handle, devid, freq);
  1356. break;
  1357. case ISDBTMM_1SEG:
  1358. fc8300_set_freq_tmm_1seg(handle, devid, freq);
  1359. break;
  1360. case ISDBT_13SEG:
  1361. fc8300_set_freq_13seg(handle, devid, freq);
  1362. break;
  1363. case ISDBTMM_13SEG:
  1364. fc8300_set_freq_tmm_13seg(handle, devid, freq);
  1365. break;
  1366. case ISDBT_CATV_13SEG:
  1367. if (freq < 273143) {
  1368. if (catv_status != 1) {
  1369. catv_status = 1;
  1370. fc8300_cs_tuner_init(handle, devid,
  1371. broadcast_type);
  1372. }
  1373. fc8300_set_freq_catv_13seg(handle, devid, freq);
  1374. } else if (freq >= 273143) {
  1375. if (catv_status != 2) {
  1376. catv_status = 2;
  1377. fc8300_cs_tuner_init(handle, devid,
  1378. broadcast_type);
  1379. }
  1380. fc8300_set_freq_catv_13seg(handle, devid, freq);
  1381. }
  1382. break;
  1383. default:
  1384. break;
  1385. }
  1386. if (tf_value[0] != 0) {
  1387. if (tf_offset[0][0] > freq) {
  1388. fc8300_write(handle, devid, 0x1c, 0x1c);
  1389. } else if (tf_offset[0][11] < freq) {
  1390. fc8300_write(handle, devid, 0x1c, 0x10);
  1391. } else {
  1392. for (i = 0; i < 11; i++) {
  1393. if ((tf_offset[0][i] < freq) &&
  1394. (tf_offset[0][i + 1] >= freq))
  1395. break;
  1396. }
  1397. if (devid != DIV_BROADCAST) {
  1398. tf_cal_set = tf_value[devid & 0x0f] +
  1399. tf_offset[1][i];
  1400. if (tf_cal_set < 0x10)
  1401. tf_cal_set = 0x10;
  1402. else if (tf_cal_set > 0x1f)
  1403. tf_cal_set = 0x1f;
  1404. fc8300_write(handle, devid, 0x1c, tf_cal_set);
  1405. } else {
  1406. tf_cal_set = tf_value[0] + tf_offset[1][i];
  1407. if (tf_cal_set < 0x10)
  1408. tf_cal_set = 0x10;
  1409. else if (tf_cal_set > 0x1f)
  1410. tf_cal_set = 0x1f;
  1411. fc8300_write(handle, DIV_MASTER, 0x1c,
  1412. tf_cal_set);
  1413. }
  1414. }
  1415. }
  1416. if (devid != DIV_BROADCAST)
  1417. fc8300_tuner_set_pll(handle, devid, freq, offset);
  1418. else
  1419. fc8300_tuner_set_pll(handle, DIV_MASTER, freq, offset);
  1420. fc8300_write(handle, devid, 0x75, 0x31);
  1421. if (devid == DIV_BROADCAST) {
  1422. for (i = 0; i < FC8300_CHECK; i++) {
  1423. if (pd_offset_add[i] <= 1) {
  1424. switch (broadcast_type) {
  1425. case ISDBT_1SEG:
  1426. case ISDBT_13SEG:
  1427. pd_cal[i] = (((freq - pd_low_freq) /
  1428. 6000) * pd_offset_cal[i]) / 100;
  1429. if ((pd_cal[i] % 10) >= 5)
  1430. pd_cal[i] = (pd_cal[i] / 10) +
  1431. 1;
  1432. else if ((pd_cal[i] % 10) <= -5)
  1433. pd_cal[i] = (pd_cal[i] / 10) -
  1434. 1;
  1435. else
  1436. pd_cal[i] = (pd_cal[i] / 10);
  1437. fc8300_write(handle, devid_set[i], 0x82,
  1438. (0x88 + ((pd_offset_add[i] -
  1439. pd_cal[i]) *
  1440. pd_offset_sign[i])));
  1441. break;
  1442. case ISDBTMM_1SEG:
  1443. case ISDBTMM_13SEG:
  1444. case ISDBTSB_1SEG:
  1445. case ISDBTSB_3SEG:
  1446. pd_cal[i] = pd_offset_cal[i] / 1000;
  1447. fc8300_write(handle, devid_set[i], 0x82,
  1448. (0x88 + ((pd_offset_add[i] -
  1449. pd_cal[i]) *
  1450. pd_offset_sign[i])));
  1451. break;
  1452. case ISDBT_CATV_13SEG:
  1453. if (freq < 273143) {
  1454. pd_cal[i] = pd_offset_cal[i] /
  1455. 1000;
  1456. fc8300_write(handle,
  1457. devid_set[i], 0x82,
  1458. (0x88 +
  1459. ((pd_offset_add[i] -
  1460. pd_cal[i]) *
  1461. pd_offset_sign[i])));
  1462. break;
  1463. } else {
  1464. pd_cal[i] = (((freq -
  1465. pd_low_freq) / 6000) *
  1466. pd_offset_cal[i]) / 100;
  1467. if ((pd_cal[i] % 10) >= 5)
  1468. pd_cal[i] = (pd_cal[i] /
  1469. 10) + 1;
  1470. else if ((pd_cal[i] % 10) <= -5)
  1471. pd_cal[i] = (pd_cal[i] /
  1472. 10);
  1473. fc8300_write(handle,
  1474. devid_set[i], 0x82,
  1475. (0x88 +
  1476. ((pd_offset_add[i] -
  1477. pd_cal[i]) *
  1478. pd_offset_sign[i])));
  1479. }
  1480. break;
  1481. default:
  1482. return BBM_NOK;
  1483. }
  1484. } else {
  1485. fc8300_write(handle, devid_set[i], 0x78, 0xf1);
  1486. fc8300_write(handle, devid_set[i], 0x04, 0x12);
  1487. msWait(3);
  1488. fc8300_write(handle, devid_set[i], 0x78, 0x31);
  1489. fc8300_write(handle, devid_set[i], 0x04, 0x10);
  1490. }
  1491. }
  1492. } else {
  1493. if (pd_offset_add[devid & 0x0f] <= 1) {
  1494. switch (broadcast_type) {
  1495. case ISDBT_1SEG:
  1496. case ISDBT_13SEG:
  1497. pd_cal[devid & 0x0f] = (((freq - pd_low_freq) /
  1498. 6000) * pd_offset_cal[devid & 0x0f]) /
  1499. 100;
  1500. if ((pd_cal[devid & 0x0f] % 10) >= 5)
  1501. pd_cal[devid & 0x0f] = (pd_cal[devid &
  1502. 0x0f] / 10) + 1;
  1503. else if ((pd_cal[devid & 0x0f] % 10) <= -5)
  1504. pd_cal[devid & 0x0f] = (pd_cal[devid &
  1505. 0x0f] / 10) - 1;
  1506. else
  1507. pd_cal[devid & 0x0f] = (pd_cal[devid &
  1508. 0x0f] / 10);
  1509. fc8300_write(handle, devid_set[devid & 0x0f],
  1510. 0x82, (0x88 + ((pd_offset_add[devid &
  1511. 0x0f] - pd_cal[devid & 0x0f]) *
  1512. pd_offset_sign[devid & 0x0f])));
  1513. break;
  1514. case ISDBTMM_1SEG:
  1515. case ISDBTMM_13SEG:
  1516. case ISDBTSB_1SEG:
  1517. case ISDBTSB_3SEG:
  1518. pd_cal[devid & 0x0f] = pd_offset_cal[devid &
  1519. 0x0f] / 1000;
  1520. fc8300_write(handle, devid_set[devid & 0x0f],
  1521. 0x82, (0x88 + ((pd_offset_add[devid &
  1522. 0x0f] - pd_cal[devid & 0x0f]) *
  1523. pd_offset_sign[devid & 0x0f])));
  1524. break;
  1525. case ISDBT_CATV_13SEG:
  1526. if (freq < 273143) {
  1527. pd_cal[devid & 0x0f] =
  1528. pd_offset_cal[devid & 0x0f] /
  1529. 1000;
  1530. fc8300_write(handle, devid_set[devid &
  1531. 0x0f], 0x82, (0x88 +
  1532. ((pd_offset_add[devid & 0x0f] -
  1533. pd_cal[devid & 0x0f]) *
  1534. pd_offset_sign[devid & 0x0f])));
  1535. break;
  1536. } else {
  1537. pd_cal[devid & 0x0f] = (((freq -
  1538. pd_low_freq) / 6000) *
  1539. pd_offset_cal[devid & 0x0f]) /
  1540. 100;
  1541. if ((pd_cal[devid & 0x0f] % 10) >= 5)
  1542. pd_cal[devid & 0x0f] =
  1543. (pd_cal[devid & 0x0f] /
  1544. 10) + 1;
  1545. else if ((pd_cal[devid & 0x0f] % 10) <=
  1546. -5)
  1547. pd_cal[devid & 0x0f] =
  1548. (pd_cal[devid & 0x0f] /
  1549. 10);
  1550. fc8300_write(handle, devid_set[devid &
  1551. 0x0f], 0x82, (0x88 +
  1552. ((pd_offset_add[devid & 0x0f] -
  1553. pd_cal[devid & 0x0f]) *
  1554. pd_offset_sign[devid &
  1555. 0x0f])));
  1556. }
  1557. break;
  1558. default:
  1559. return BBM_NOK;
  1560. }
  1561. } else {
  1562. fc8300_write(handle, devid_set[devid & 0x0f], 0x78,
  1563. 0xf1);
  1564. fc8300_write(handle, devid_set[devid & 0x0f], 0x04,
  1565. 0x12);
  1566. msWait(3);
  1567. fc8300_write(handle, devid_set[devid & 0x0f], 0x78,
  1568. 0x31);
  1569. fc8300_write(handle, devid_set[devid & 0x0f], 0x04,
  1570. 0x10);
  1571. }
  1572. }
  1573. switch (broadcast_type) {
  1574. case ISDBT_13SEG:
  1575. if (freq > 900000)
  1576. fc8300_write(handle, devid, 0xcf, 0);
  1577. else
  1578. fc8300_write(handle, devid, 0xcf, 1);
  1579. break;
  1580. case ISDBT_1SEG:
  1581. fc8300_write(handle, devid, 0xcf, 1);
  1582. break;
  1583. default:
  1584. fc8300_write(handle, devid, 0xcf, 3);
  1585. break;
  1586. }
  1587. return BBM_OK;
  1588. }
  1589. s32 fc8300_cs_get_rssi(HANDLE handle, DEVICEID devid, s32 *rssi)
  1590. {
  1591. s8 tmp = 0;
  1592. fc8300_read(handle, devid, 0xeb, (u8 *) &tmp);
  1593. *rssi = tmp;
  1594. if (tmp < 0)
  1595. *rssi += 1;
  1596. return BBM_OK;
  1597. }
  1598. s32 fc8300_cs_tuner_deinit(HANDLE handle, DEVICEID devid)
  1599. {
  1600. return BBM_OK;
  1601. }