mxl5xx_defs.h 20 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733
  1. /* SPDX-License-Identifier: GPL-2.0 */
  2. /*
  3. * Defines for the Maxlinear MX58x family of tuners/demods
  4. *
  5. * Copyright (C) 2014 Digital Devices GmbH
  6. *
  7. * based on code:
  8. * Copyright (c) 2011-2013 MaxLinear, Inc. All rights reserved
  9. * which was released under GPL V2
  10. *
  11. * This program is free software; you can redistribute it and/or
  12. * modify it under the terms of the GNU General Public License
  13. * version 2, as published by the Free Software Foundation.
  14. */
  15. enum MXL_BOOL_E {
  16. MXL_DISABLE = 0,
  17. MXL_ENABLE = 1,
  18. MXL_FALSE = 0,
  19. MXL_TRUE = 1,
  20. MXL_INVALID = 0,
  21. MXL_VALID = 1,
  22. MXL_NO = 0,
  23. MXL_YES = 1,
  24. MXL_OFF = 0,
  25. MXL_ON = 1
  26. };
  27. /* Firmware-Host Command IDs */
  28. enum MXL_HYDRA_HOST_CMD_ID_E {
  29. /* --Device command IDs-- */
  30. MXL_HYDRA_DEV_NO_OP_CMD = 0, /* No OP */
  31. MXL_HYDRA_DEV_SET_POWER_MODE_CMD = 1,
  32. MXL_HYDRA_DEV_SET_OVERWRITE_DEF_CMD = 2,
  33. /* Host-used CMD, not used by firmware */
  34. MXL_HYDRA_DEV_FIRMWARE_DOWNLOAD_CMD = 3,
  35. /* Additional CONTROL types from DTV */
  36. MXL_HYDRA_DEV_SET_BROADCAST_PID_STB_ID_CMD = 4,
  37. MXL_HYDRA_DEV_GET_PMM_SLEEP_CMD = 5,
  38. /* --Tuner command IDs-- */
  39. MXL_HYDRA_TUNER_TUNE_CMD = 6,
  40. MXL_HYDRA_TUNER_GET_STATUS_CMD = 7,
  41. /* --Demod command IDs-- */
  42. MXL_HYDRA_DEMOD_SET_PARAM_CMD = 8,
  43. MXL_HYDRA_DEMOD_GET_STATUS_CMD = 9,
  44. MXL_HYDRA_DEMOD_RESET_FEC_COUNTER_CMD = 10,
  45. MXL_HYDRA_DEMOD_SET_PKT_NUM_CMD = 11,
  46. MXL_HYDRA_DEMOD_SET_IQ_SOURCE_CMD = 12,
  47. MXL_HYDRA_DEMOD_GET_IQ_DATA_CMD = 13,
  48. MXL_HYDRA_DEMOD_GET_M68HC05_VER_CMD = 14,
  49. MXL_HYDRA_DEMOD_SET_ERROR_COUNTER_MODE_CMD = 15,
  50. /* --- ABORT channel tune */
  51. MXL_HYDRA_ABORT_TUNE_CMD = 16, /* Abort current tune command. */
  52. /* --SWM/FSK command IDs-- */
  53. MXL_HYDRA_FSK_RESET_CMD = 17,
  54. MXL_HYDRA_FSK_MSG_CMD = 18,
  55. MXL_HYDRA_FSK_SET_OP_MODE_CMD = 19,
  56. /* --DiSeqC command IDs-- */
  57. MXL_HYDRA_DISEQC_MSG_CMD = 20,
  58. MXL_HYDRA_DISEQC_COPY_MSG_TO_MAILBOX = 21,
  59. MXL_HYDRA_DISEQC_CFG_MSG_CMD = 22,
  60. /* --- FFT Debug Command IDs-- */
  61. MXL_HYDRA_REQ_FFT_SPECTRUM_CMD = 23,
  62. /* -- Demod scramblle code */
  63. MXL_HYDRA_DEMOD_SCRAMBLE_CODE_CMD = 24,
  64. /* ---For host to know how many commands in total */
  65. MXL_HYDRA_LAST_HOST_CMD = 25,
  66. MXL_HYDRA_DEMOD_INTR_TYPE_CMD = 47,
  67. MXL_HYDRA_DEV_INTR_CLEAR_CMD = 48,
  68. MXL_HYDRA_TUNER_SPECTRUM_REQ_CMD = 53,
  69. MXL_HYDRA_TUNER_ACTIVATE_CMD = 55,
  70. MXL_HYDRA_DEV_CFG_POWER_MODE_CMD = 56,
  71. MXL_HYDRA_DEV_XTAL_CAP_CMD = 57,
  72. MXL_HYDRA_DEV_CFG_SKU_CMD = 58,
  73. MXL_HYDRA_TUNER_SPECTRUM_MIN_GAIN_CMD = 59,
  74. MXL_HYDRA_DISEQC_CONT_TONE_CFG = 60,
  75. MXL_HYDRA_DEV_RF_WAKE_UP_CMD = 61,
  76. MXL_HYDRA_DEMOD_CFG_EQ_CTRL_PARAM_CMD = 62,
  77. MXL_HYDRA_DEMOD_FREQ_OFFSET_SEARCH_RANGE_CMD = 63,
  78. MXL_HYDRA_DEV_REQ_PWR_FROM_ADCRSSI_CMD = 64,
  79. MXL_XCPU_PID_FLT_CFG_CMD = 65,
  80. MXL_XCPU_SHMEM_TEST_CMD = 66,
  81. MXL_XCPU_ABORT_TUNE_CMD = 67,
  82. MXL_XCPU_CHAN_TUNE_CMD = 68,
  83. MXL_XCPU_FLT_BOND_HDRS_CMD = 69,
  84. MXL_HYDRA_DEV_BROADCAST_WAKE_UP_CMD = 70,
  85. MXL_HYDRA_FSK_CFG_FSK_FREQ_CMD = 71,
  86. MXL_HYDRA_FSK_POWER_DOWN_CMD = 72,
  87. MXL_XCPU_CLEAR_CB_STATS_CMD = 73,
  88. MXL_XCPU_CHAN_BOND_RESTART_CMD = 74
  89. };
  90. #define MXL_ENABLE_BIG_ENDIAN (0)
  91. #define MXL_HYDRA_OEM_MAX_BLOCK_WRITE_LENGTH 248
  92. #define MXL_HYDRA_OEM_MAX_CMD_BUFF_LEN (248)
  93. #define MXL_HYDRA_CAP_MIN 10
  94. #define MXL_HYDRA_CAP_MAX 33
  95. #define MXL_HYDRA_PLID_REG_READ 0xFB /* Read register PLID */
  96. #define MXL_HYDRA_PLID_REG_WRITE 0xFC /* Write register PLID */
  97. #define MXL_HYDRA_PLID_CMD_READ 0xFD /* Command Read PLID */
  98. #define MXL_HYDRA_PLID_CMD_WRITE 0xFE /* Command Write PLID */
  99. #define MXL_HYDRA_REG_SIZE_IN_BYTES 4 /* Hydra register size in bytes */
  100. #define MXL_HYDRA_I2C_HDR_SIZE (2 * sizeof(u8)) /* PLID + LEN(0xFF) */
  101. #define MXL_HYDRA_CMD_HEADER_SIZE (MXL_HYDRA_REG_SIZE_IN_BYTES + MXL_HYDRA_I2C_HDR_SIZE)
  102. #define MXL_HYDRA_SKU_ID_581 0
  103. #define MXL_HYDRA_SKU_ID_584 1
  104. #define MXL_HYDRA_SKU_ID_585 2
  105. #define MXL_HYDRA_SKU_ID_544 3
  106. #define MXL_HYDRA_SKU_ID_561 4
  107. #define MXL_HYDRA_SKU_ID_582 5
  108. #define MXL_HYDRA_SKU_ID_568 6
  109. /* macro for register write data buffer size
  110. * (PLID + LEN (0xFF) + RegAddr + RegData)
  111. */
  112. #define MXL_HYDRA_REG_WRITE_LEN (MXL_HYDRA_I2C_HDR_SIZE + (2 * MXL_HYDRA_REG_SIZE_IN_BYTES))
  113. /* macro to extract a single byte from 4-byte(32-bit) data */
  114. #define GET_BYTE(x, n) (((x) >> (8*(n))) & 0xFF)
  115. #define MAX_CMD_DATA 512
  116. #define MXL_GET_REG_MASK_32(lsb_loc, num_of_bits) ((0xFFFFFFFF >> (32 - (num_of_bits))) << (lsb_loc))
  117. #define FW_DL_SIGN (0xDEADBEEF)
  118. #define MBIN_FORMAT_VERSION '1'
  119. #define MBIN_FILE_HEADER_ID 'M'
  120. #define MBIN_SEGMENT_HEADER_ID 'S'
  121. #define MBIN_MAX_FILE_LENGTH (1<<23)
  122. struct MBIN_FILE_HEADER_T {
  123. u8 id;
  124. u8 fmt_version;
  125. u8 header_len;
  126. u8 num_segments;
  127. u8 entry_address[4];
  128. u8 image_size24[3];
  129. u8 image_checksum;
  130. u8 reserved[4];
  131. };
  132. struct MBIN_FILE_T {
  133. struct MBIN_FILE_HEADER_T header;
  134. u8 data[1];
  135. };
  136. struct MBIN_SEGMENT_HEADER_T {
  137. u8 id;
  138. u8 len24[3];
  139. u8 address[4];
  140. };
  141. struct MBIN_SEGMENT_T {
  142. struct MBIN_SEGMENT_HEADER_T header;
  143. u8 data[1];
  144. };
  145. enum MXL_CMD_TYPE_E { MXL_CMD_WRITE = 0, MXL_CMD_READ };
  146. #define BUILD_HYDRA_CMD(cmd_id, req_type, size, data_ptr, cmd_buff) \
  147. do { \
  148. cmd_buff[0] = ((req_type == MXL_CMD_WRITE) ? MXL_HYDRA_PLID_CMD_WRITE : MXL_HYDRA_PLID_CMD_READ); \
  149. cmd_buff[1] = (size > 251) ? 0xff : (u8) (size + 4); \
  150. cmd_buff[2] = size; \
  151. cmd_buff[3] = cmd_id; \
  152. cmd_buff[4] = 0x00; \
  153. cmd_buff[5] = 0x00; \
  154. convert_endian(MXL_ENABLE_BIG_ENDIAN, size, (u8 *)data_ptr); \
  155. memcpy((void *)&cmd_buff[6], data_ptr, size); \
  156. } while (0)
  157. struct MXL_REG_FIELD_T {
  158. u32 reg_addr;
  159. u8 lsb_pos;
  160. u8 num_of_bits;
  161. };
  162. struct MXL_DEV_CMD_DATA_T {
  163. u32 data_size;
  164. u8 data[MAX_CMD_DATA];
  165. };
  166. enum MXL_HYDRA_SKU_TYPE_E {
  167. MXL_HYDRA_SKU_TYPE_MIN = 0x00,
  168. MXL_HYDRA_SKU_TYPE_581 = 0x00,
  169. MXL_HYDRA_SKU_TYPE_584 = 0x01,
  170. MXL_HYDRA_SKU_TYPE_585 = 0x02,
  171. MXL_HYDRA_SKU_TYPE_544 = 0x03,
  172. MXL_HYDRA_SKU_TYPE_561 = 0x04,
  173. MXL_HYDRA_SKU_TYPE_5XX = 0x05,
  174. MXL_HYDRA_SKU_TYPE_5YY = 0x06,
  175. MXL_HYDRA_SKU_TYPE_511 = 0x07,
  176. MXL_HYDRA_SKU_TYPE_561_DE = 0x08,
  177. MXL_HYDRA_SKU_TYPE_582 = 0x09,
  178. MXL_HYDRA_SKU_TYPE_541 = 0x0A,
  179. MXL_HYDRA_SKU_TYPE_568 = 0x0B,
  180. MXL_HYDRA_SKU_TYPE_542 = 0x0C,
  181. MXL_HYDRA_SKU_TYPE_MAX = 0x0D,
  182. };
  183. struct MXL_HYDRA_SKU_COMMAND_T {
  184. enum MXL_HYDRA_SKU_TYPE_E sku_type;
  185. };
  186. enum MXL_HYDRA_DEMOD_ID_E {
  187. MXL_HYDRA_DEMOD_ID_0 = 0,
  188. MXL_HYDRA_DEMOD_ID_1,
  189. MXL_HYDRA_DEMOD_ID_2,
  190. MXL_HYDRA_DEMOD_ID_3,
  191. MXL_HYDRA_DEMOD_ID_4,
  192. MXL_HYDRA_DEMOD_ID_5,
  193. MXL_HYDRA_DEMOD_ID_6,
  194. MXL_HYDRA_DEMOD_ID_7,
  195. MXL_HYDRA_DEMOD_MAX
  196. };
  197. #define MXL_DEMOD_SCRAMBLE_SEQ_LEN 12
  198. #define MAX_STEP_SIZE_24_XTAL_102_05_KHZ 195
  199. #define MAX_STEP_SIZE_24_XTAL_204_10_KHZ 215
  200. #define MAX_STEP_SIZE_24_XTAL_306_15_KHZ 203
  201. #define MAX_STEP_SIZE_24_XTAL_408_20_KHZ 177
  202. #define MAX_STEP_SIZE_27_XTAL_102_05_KHZ 195
  203. #define MAX_STEP_SIZE_27_XTAL_204_10_KHZ 215
  204. #define MAX_STEP_SIZE_27_XTAL_306_15_KHZ 203
  205. #define MAX_STEP_SIZE_27_XTAL_408_20_KHZ 177
  206. #define MXL_HYDRA_SPECTRUM_MIN_FREQ_KHZ 300000
  207. #define MXL_HYDRA_SPECTRUM_MAX_FREQ_KHZ 2350000
  208. enum MXL_DEMOD_CHAN_PARAMS_OFFSET_E {
  209. DMD_STANDARD_ADDR = 0,
  210. DMD_SPECTRUM_INVERSION_ADDR,
  211. DMD_SPECTRUM_ROLL_OFF_ADDR,
  212. DMD_SYMBOL_RATE_ADDR,
  213. DMD_MODULATION_SCHEME_ADDR,
  214. DMD_FEC_CODE_RATE_ADDR,
  215. DMD_SNR_ADDR,
  216. DMD_FREQ_OFFSET_ADDR,
  217. DMD_CTL_FREQ_OFFSET_ADDR,
  218. DMD_STR_FREQ_OFFSET_ADDR,
  219. DMD_FTL_FREQ_OFFSET_ADDR,
  220. DMD_STR_NBC_SYNC_LOCK_ADDR,
  221. DMD_CYCLE_SLIP_COUNT_ADDR,
  222. DMD_DISPLAY_IQ_ADDR,
  223. DMD_DVBS2_CRC_ERRORS_ADDR,
  224. DMD_DVBS2_PER_COUNT_ADDR,
  225. DMD_DVBS2_PER_WINDOW_ADDR,
  226. DMD_DVBS_CORR_RS_ERRORS_ADDR,
  227. DMD_DVBS_UNCORR_RS_ERRORS_ADDR,
  228. DMD_DVBS_BER_COUNT_ADDR,
  229. DMD_DVBS_BER_WINDOW_ADDR,
  230. DMD_TUNER_ID_ADDR,
  231. DMD_DVBS2_PILOT_ON_OFF_ADDR,
  232. DMD_FREQ_SEARCH_RANGE_IN_KHZ_ADDR,
  233. MXL_DEMOD_CHAN_PARAMS_BUFF_SIZE,
  234. };
  235. enum MXL_HYDRA_TUNER_ID_E {
  236. MXL_HYDRA_TUNER_ID_0 = 0,
  237. MXL_HYDRA_TUNER_ID_1,
  238. MXL_HYDRA_TUNER_ID_2,
  239. MXL_HYDRA_TUNER_ID_3,
  240. MXL_HYDRA_TUNER_MAX
  241. };
  242. enum MXL_HYDRA_BCAST_STD_E {
  243. MXL_HYDRA_DSS = 0,
  244. MXL_HYDRA_DVBS,
  245. MXL_HYDRA_DVBS2,
  246. };
  247. enum MXL_HYDRA_FEC_E {
  248. MXL_HYDRA_FEC_AUTO = 0,
  249. MXL_HYDRA_FEC_1_2,
  250. MXL_HYDRA_FEC_3_5,
  251. MXL_HYDRA_FEC_2_3,
  252. MXL_HYDRA_FEC_3_4,
  253. MXL_HYDRA_FEC_4_5,
  254. MXL_HYDRA_FEC_5_6,
  255. MXL_HYDRA_FEC_6_7,
  256. MXL_HYDRA_FEC_7_8,
  257. MXL_HYDRA_FEC_8_9,
  258. MXL_HYDRA_FEC_9_10,
  259. };
  260. enum MXL_HYDRA_MODULATION_E {
  261. MXL_HYDRA_MOD_AUTO = 0,
  262. MXL_HYDRA_MOD_QPSK,
  263. MXL_HYDRA_MOD_8PSK
  264. };
  265. enum MXL_HYDRA_SPECTRUM_E {
  266. MXL_HYDRA_SPECTRUM_AUTO = 0,
  267. MXL_HYDRA_SPECTRUM_INVERTED,
  268. MXL_HYDRA_SPECTRUM_NON_INVERTED,
  269. };
  270. enum MXL_HYDRA_ROLLOFF_E {
  271. MXL_HYDRA_ROLLOFF_AUTO = 0,
  272. MXL_HYDRA_ROLLOFF_0_20,
  273. MXL_HYDRA_ROLLOFF_0_25,
  274. MXL_HYDRA_ROLLOFF_0_35
  275. };
  276. enum MXL_HYDRA_PILOTS_E {
  277. MXL_HYDRA_PILOTS_OFF = 0,
  278. MXL_HYDRA_PILOTS_ON,
  279. MXL_HYDRA_PILOTS_AUTO
  280. };
  281. enum MXL_HYDRA_CONSTELLATION_SRC_E {
  282. MXL_HYDRA_FORMATTER = 0,
  283. MXL_HYDRA_LEGACY_FEC,
  284. MXL_HYDRA_FREQ_RECOVERY,
  285. MXL_HYDRA_NBC,
  286. MXL_HYDRA_CTL,
  287. MXL_HYDRA_EQ,
  288. };
  289. struct MXL_HYDRA_DEMOD_LOCK_T {
  290. int agc_lock; /* AGC lock info */
  291. int fec_lock; /* Demod FEC block lock info */
  292. };
  293. struct MXL_HYDRA_DEMOD_STATUS_DVBS_T {
  294. u32 rs_errors; /* RS decoder err counter */
  295. u32 ber_window; /* Ber Windows */
  296. u32 ber_count; /* BER count */
  297. u32 ber_window_iter1; /* Ber Windows - post viterbi */
  298. u32 ber_count_iter1; /* BER count - post viterbi */
  299. };
  300. struct MXL_HYDRA_DEMOD_STATUS_DSS_T {
  301. u32 rs_errors; /* RS decoder err counter */
  302. u32 ber_window; /* Ber Windows */
  303. u32 ber_count; /* BER count */
  304. };
  305. struct MXL_HYDRA_DEMOD_STATUS_DVBS2_T {
  306. u32 crc_errors; /* CRC error counter */
  307. u32 packet_error_count; /* Number of packet errors */
  308. u32 total_packets; /* Total packets */
  309. };
  310. struct MXL_HYDRA_DEMOD_STATUS_T {
  311. enum MXL_HYDRA_BCAST_STD_E standard_mask; /* Standard DVB-S, DVB-S2 or DSS */
  312. union {
  313. struct MXL_HYDRA_DEMOD_STATUS_DVBS_T demod_status_dvbs; /* DVB-S demod status */
  314. struct MXL_HYDRA_DEMOD_STATUS_DVBS2_T demod_status_dvbs2; /* DVB-S2 demod status */
  315. struct MXL_HYDRA_DEMOD_STATUS_DSS_T demod_status_dss; /* DSS demod status */
  316. } u;
  317. };
  318. struct MXL_HYDRA_DEMOD_SIG_OFFSET_INFO_T {
  319. s32 carrier_offset_in_hz; /* CRL offset info */
  320. s32 symbol_offset_in_symbol; /* SRL offset info */
  321. };
  322. struct MXL_HYDRA_DEMOD_SCRAMBLE_INFO_T {
  323. u8 scramble_sequence[MXL_DEMOD_SCRAMBLE_SEQ_LEN]; /* scramble sequence */
  324. u32 scramble_code; /* scramble gold code */
  325. };
  326. enum MXL_HYDRA_SPECTRUM_STEP_SIZE_E {
  327. MXL_HYDRA_STEP_SIZE_24_XTAL_102_05KHZ, /* 102.05 KHz for 24 MHz XTAL */
  328. MXL_HYDRA_STEP_SIZE_24_XTAL_204_10KHZ, /* 204.10 KHz for 24 MHz XTAL */
  329. MXL_HYDRA_STEP_SIZE_24_XTAL_306_15KHZ, /* 306.15 KHz for 24 MHz XTAL */
  330. MXL_HYDRA_STEP_SIZE_24_XTAL_408_20KHZ, /* 408.20 KHz for 24 MHz XTAL */
  331. MXL_HYDRA_STEP_SIZE_27_XTAL_102_05KHZ, /* 102.05 KHz for 27 MHz XTAL */
  332. MXL_HYDRA_STEP_SIZE_27_XTAL_204_35KHZ, /* 204.35 KHz for 27 MHz XTAL */
  333. MXL_HYDRA_STEP_SIZE_27_XTAL_306_52KHZ, /* 306.52 KHz for 27 MHz XTAL */
  334. MXL_HYDRA_STEP_SIZE_27_XTAL_408_69KHZ, /* 408.69 KHz for 27 MHz XTAL */
  335. };
  336. enum MXL_HYDRA_SPECTRUM_RESOLUTION_E {
  337. MXL_HYDRA_SPECTRUM_RESOLUTION_00_1_DB, /* 0.1 dB */
  338. MXL_HYDRA_SPECTRUM_RESOLUTION_01_0_DB, /* 1.0 dB */
  339. MXL_HYDRA_SPECTRUM_RESOLUTION_05_0_DB, /* 5.0 dB */
  340. MXL_HYDRA_SPECTRUM_RESOLUTION_10_0_DB, /* 10 dB */
  341. };
  342. enum MXL_HYDRA_SPECTRUM_ERROR_CODE_E {
  343. MXL_SPECTRUM_NO_ERROR,
  344. MXL_SPECTRUM_INVALID_PARAMETER,
  345. MXL_SPECTRUM_INVALID_STEP_SIZE,
  346. MXL_SPECTRUM_BW_CANNOT_BE_COVERED,
  347. MXL_SPECTRUM_DEMOD_BUSY,
  348. MXL_SPECTRUM_TUNER_NOT_ENABLED,
  349. };
  350. struct MXL_HYDRA_SPECTRUM_REQ_T {
  351. u32 tuner_index; /* TUNER Ctrl: one of MXL58x_TUNER_ID_E */
  352. u32 demod_index; /* DEMOD Ctrl: one of MXL58x_DEMOD_ID_E */
  353. enum MXL_HYDRA_SPECTRUM_STEP_SIZE_E step_size_in_khz;
  354. u32 starting_freq_ink_hz;
  355. u32 total_steps;
  356. enum MXL_HYDRA_SPECTRUM_RESOLUTION_E spectrum_division;
  357. };
  358. enum MXL_HYDRA_SEARCH_FREQ_OFFSET_TYPE_E {
  359. MXL_HYDRA_SEARCH_MAX_OFFSET = 0, /* DMD searches for max freq offset (i.e. 5MHz) */
  360. MXL_HYDRA_SEARCH_BW_PLUS_ROLLOFF, /* DMD searches for BW + ROLLOFF/2 */
  361. };
  362. struct MXL58X_CFG_FREQ_OFF_SEARCH_RANGE_T {
  363. u32 demod_index;
  364. enum MXL_HYDRA_SEARCH_FREQ_OFFSET_TYPE_E search_type;
  365. };
  366. /* there are two slices
  367. * slice0 - TS0, TS1, TS2 & TS3
  368. * slice1 - TS4, TS5, TS6 & TS7
  369. */
  370. #define MXL_HYDRA_TS_SLICE_MAX 2
  371. #define MAX_FIXED_PID_NUM 32
  372. #define MXL_HYDRA_NCO_CLK 418 /* 418 MHz */
  373. #define MXL_HYDRA_MAX_TS_CLOCK 139 /* 139 MHz */
  374. #define MXL_HYDRA_TS_FIXED_PID_FILT_SIZE 32
  375. #define MXL_HYDRA_SHARED_PID_FILT_SIZE_DEFAULT 33 /* Shared PID filter size in 1-1 mux mode */
  376. #define MXL_HYDRA_SHARED_PID_FILT_SIZE_2_TO_1 66 /* Shared PID filter size in 2-1 mux mode */
  377. #define MXL_HYDRA_SHARED_PID_FILT_SIZE_4_TO_1 132 /* Shared PID filter size in 4-1 mux mode */
  378. enum MXL_HYDRA_PID_BANK_TYPE_E {
  379. MXL_HYDRA_SOFTWARE_PID_BANK = 0,
  380. MXL_HYDRA_HARDWARE_PID_BANK,
  381. };
  382. enum MXL_HYDRA_TS_MUX_MODE_E {
  383. MXL_HYDRA_TS_MUX_PID_REMAP = 0,
  384. MXL_HYDRA_TS_MUX_PREFIX_EXTRA_HEADER = 1,
  385. };
  386. enum MXL_HYDRA_TS_MUX_TYPE_E {
  387. MXL_HYDRA_TS_MUX_DISABLE = 0, /* No Mux ( 1 TSIF to 1 TSIF) */
  388. MXL_HYDRA_TS_MUX_2_TO_1, /* Mux 2 TSIF to 1 TSIF */
  389. MXL_HYDRA_TS_MUX_4_TO_1, /* Mux 4 TSIF to 1 TSIF */
  390. };
  391. enum MXL_HYDRA_TS_GROUP_E {
  392. MXL_HYDRA_TS_GROUP_0_3 = 0, /* TS group 0 to 3 (TS0, TS1, TS2 & TS3) */
  393. MXL_HYDRA_TS_GROUP_4_7, /* TS group 0 to 3 (TS4, TS5, TS6 & TS7) */
  394. };
  395. enum MXL_HYDRA_TS_PID_FLT_CTRL_E {
  396. MXL_HYDRA_TS_PIDS_ALLOW_ALL = 0, /* Allow all pids */
  397. MXL_HYDRA_TS_PIDS_DROP_ALL, /* Drop all pids */
  398. MXL_HYDRA_TS_INVALIDATE_PID_FILTER, /* Delete current PD filter in the device */
  399. };
  400. enum MXL_HYDRA_TS_PID_TYPE_E {
  401. MXL_HYDRA_TS_PID_FIXED = 0,
  402. MXL_HYDRA_TS_PID_REGULAR,
  403. };
  404. struct MXL_HYDRA_TS_PID_T {
  405. u16 original_pid; /* pid from TS */
  406. u16 remapped_pid; /* remapped pid */
  407. enum MXL_BOOL_E enable; /* enable or disable pid */
  408. enum MXL_BOOL_E allow_or_drop; /* allow or drop pid */
  409. enum MXL_BOOL_E enable_pid_remap; /* enable or disable pid remap */
  410. u8 bond_id; /* Bond ID in A0 always 0 - Only for 568 Sku */
  411. u8 dest_id; /* Output port ID for the PID - Only for 568 Sku */
  412. };
  413. struct MXL_HYDRA_TS_MUX_PREFIX_HEADER_T {
  414. enum MXL_BOOL_E enable;
  415. u8 num_byte;
  416. u8 header[12];
  417. };
  418. enum MXL_HYDRA_PID_FILTER_BANK_E {
  419. MXL_HYDRA_PID_BANK_A = 0,
  420. MXL_HYDRA_PID_BANK_B,
  421. };
  422. enum MXL_HYDRA_MPEG_DATA_FMT_E {
  423. MXL_HYDRA_MPEG_SERIAL_MSB_1ST = 0,
  424. MXL_HYDRA_MPEG_SERIAL_LSB_1ST,
  425. MXL_HYDRA_MPEG_SYNC_WIDTH_BIT = 0,
  426. MXL_HYDRA_MPEG_SYNC_WIDTH_BYTE
  427. };
  428. enum MXL_HYDRA_MPEG_MODE_E {
  429. MXL_HYDRA_MPEG_MODE_SERIAL_4_WIRE = 0, /* MPEG 4 Wire serial mode */
  430. MXL_HYDRA_MPEG_MODE_SERIAL_3_WIRE, /* MPEG 3 Wire serial mode */
  431. MXL_HYDRA_MPEG_MODE_SERIAL_2_WIRE, /* MPEG 2 Wire serial mode */
  432. MXL_HYDRA_MPEG_MODE_PARALLEL /* MPEG parallel mode - valid only for MxL581 */
  433. };
  434. enum MXL_HYDRA_MPEG_CLK_TYPE_E {
  435. MXL_HYDRA_MPEG_CLK_CONTINUOUS = 0, /* Continuous MPEG clock */
  436. MXL_HYDRA_MPEG_CLK_GAPPED, /* Gapped (gated) MPEG clock */
  437. };
  438. enum MXL_HYDRA_MPEG_CLK_FMT_E {
  439. MXL_HYDRA_MPEG_ACTIVE_LOW = 0,
  440. MXL_HYDRA_MPEG_ACTIVE_HIGH,
  441. MXL_HYDRA_MPEG_CLK_NEGATIVE = 0,
  442. MXL_HYDRA_MPEG_CLK_POSITIVE,
  443. MXL_HYDRA_MPEG_CLK_IN_PHASE = 0,
  444. MXL_HYDRA_MPEG_CLK_INVERTED,
  445. };
  446. enum MXL_HYDRA_MPEG_CLK_PHASE_E {
  447. MXL_HYDRA_MPEG_CLK_PHASE_SHIFT_0_DEG = 0,
  448. MXL_HYDRA_MPEG_CLK_PHASE_SHIFT_90_DEG,
  449. MXL_HYDRA_MPEG_CLK_PHASE_SHIFT_180_DEG,
  450. MXL_HYDRA_MPEG_CLK_PHASE_SHIFT_270_DEG
  451. };
  452. enum MXL_HYDRA_MPEG_ERR_INDICATION_E {
  453. MXL_HYDRA_MPEG_ERR_REPLACE_SYNC = 0,
  454. MXL_HYDRA_MPEG_ERR_REPLACE_VALID,
  455. MXL_HYDRA_MPEG_ERR_INDICATION_DISABLED
  456. };
  457. struct MXL_HYDRA_MPEGOUT_PARAM_T {
  458. int enable; /* Enable or Disable MPEG OUT */
  459. enum MXL_HYDRA_MPEG_CLK_TYPE_E mpeg_clk_type; /* Continuous or gapped */
  460. enum MXL_HYDRA_MPEG_CLK_FMT_E mpeg_clk_pol; /* MPEG Clk polarity */
  461. u8 max_mpeg_clk_rate; /* Max MPEG Clk rate (0 - 104 MHz, 139 MHz) */
  462. enum MXL_HYDRA_MPEG_CLK_PHASE_E mpeg_clk_phase; /* MPEG Clk phase */
  463. enum MXL_HYDRA_MPEG_DATA_FMT_E lsb_or_msb_first; /* LSB first or MSB first in TS transmission */
  464. enum MXL_HYDRA_MPEG_DATA_FMT_E mpeg_sync_pulse_width; /* MPEG SYNC pulse width (1-bit or 1-byte) */
  465. enum MXL_HYDRA_MPEG_CLK_FMT_E mpeg_valid_pol; /* MPEG VALID polarity */
  466. enum MXL_HYDRA_MPEG_CLK_FMT_E mpeg_sync_pol; /* MPEG SYNC polarity */
  467. enum MXL_HYDRA_MPEG_MODE_E mpeg_mode; /* config 4/3/2-wire serial or parallel TS out */
  468. enum MXL_HYDRA_MPEG_ERR_INDICATION_E mpeg_error_indication; /* Enable or Disable MPEG error indication */
  469. };
  470. enum MXL_HYDRA_EXT_TS_IN_ID_E {
  471. MXL_HYDRA_EXT_TS_IN_0 = 0,
  472. MXL_HYDRA_EXT_TS_IN_1,
  473. MXL_HYDRA_EXT_TS_IN_2,
  474. MXL_HYDRA_EXT_TS_IN_3,
  475. MXL_HYDRA_EXT_TS_IN_MAX
  476. };
  477. enum MXL_HYDRA_TS_OUT_ID_E {
  478. MXL_HYDRA_TS_OUT_0 = 0,
  479. MXL_HYDRA_TS_OUT_1,
  480. MXL_HYDRA_TS_OUT_2,
  481. MXL_HYDRA_TS_OUT_3,
  482. MXL_HYDRA_TS_OUT_4,
  483. MXL_HYDRA_TS_OUT_5,
  484. MXL_HYDRA_TS_OUT_6,
  485. MXL_HYDRA_TS_OUT_7,
  486. MXL_HYDRA_TS_OUT_MAX
  487. };
  488. enum MXL_HYDRA_TS_DRIVE_STRENGTH_E {
  489. MXL_HYDRA_TS_DRIVE_STRENGTH_1X = 0,
  490. MXL_HYDRA_TS_DRIVE_STRENGTH_2X,
  491. MXL_HYDRA_TS_DRIVE_STRENGTH_3X,
  492. MXL_HYDRA_TS_DRIVE_STRENGTH_4X,
  493. MXL_HYDRA_TS_DRIVE_STRENGTH_5X,
  494. MXL_HYDRA_TS_DRIVE_STRENGTH_6X,
  495. MXL_HYDRA_TS_DRIVE_STRENGTH_7X,
  496. MXL_HYDRA_TS_DRIVE_STRENGTH_8X
  497. };
  498. enum MXL_HYDRA_DEVICE_E {
  499. MXL_HYDRA_DEVICE_581 = 0,
  500. MXL_HYDRA_DEVICE_584,
  501. MXL_HYDRA_DEVICE_585,
  502. MXL_HYDRA_DEVICE_544,
  503. MXL_HYDRA_DEVICE_561,
  504. MXL_HYDRA_DEVICE_TEST,
  505. MXL_HYDRA_DEVICE_582,
  506. MXL_HYDRA_DEVICE_541,
  507. MXL_HYDRA_DEVICE_568,
  508. MXL_HYDRA_DEVICE_542,
  509. MXL_HYDRA_DEVICE_541S,
  510. MXL_HYDRA_DEVICE_561S,
  511. MXL_HYDRA_DEVICE_581S,
  512. MXL_HYDRA_DEVICE_MAX
  513. };
  514. /* Demod IQ data */
  515. struct MXL_HYDRA_DEMOD_IQ_SRC_T {
  516. u32 demod_id;
  517. u32 source_of_iq; /* == 0, it means I/Q comes from Formatter
  518. * == 1, Legacy FEC
  519. * == 2, Frequency Recovery
  520. * == 3, NBC
  521. * == 4, CTL
  522. * == 5, EQ
  523. * == 6, FPGA
  524. */
  525. };
  526. struct MXL_HYDRA_DEMOD_ABORT_TUNE_T {
  527. u32 demod_id;
  528. };
  529. struct MXL_HYDRA_TUNER_CMD {
  530. u8 tuner_id;
  531. u8 enable;
  532. };
  533. /* Demod Para for Channel Tune */
  534. struct MXL_HYDRA_DEMOD_PARAM_T {
  535. u32 tuner_index;
  536. u32 demod_index;
  537. u32 frequency_in_hz; /* Frequency */
  538. u32 standard; /* one of MXL_HYDRA_BCAST_STD_E */
  539. u32 spectrum_inversion; /* Input : Spectrum inversion. */
  540. u32 roll_off; /* rollOff (alpha) factor */
  541. u32 symbol_rate_in_hz; /* Symbol rate */
  542. u32 pilots; /* TRUE = pilots enabled */
  543. u32 modulation_scheme; /* Input : Modulation Scheme is one of MXL_HYDRA_MODULATION_E */
  544. u32 fec_code_rate; /* Input : Forward error correction rate. Is one of MXL_HYDRA_FEC_E */
  545. u32 max_carrier_offset_in_mhz; /* Maximum carrier freq offset in MHz. Same as freqSearchRangeKHz, but in unit of MHz. */
  546. };
  547. struct MXL_HYDRA_DEMOD_SCRAMBLE_CODE_T {
  548. u32 demod_index;
  549. u8 scramble_sequence[12]; /* scramble sequence */
  550. u32 scramble_code; /* scramble gold code */
  551. };
  552. struct MXL_INTR_CFG_T {
  553. u32 intr_type;
  554. u32 intr_duration_in_nano_secs;
  555. u32 intr_mask;
  556. };
  557. struct MXL_HYDRA_POWER_MODE_CMD {
  558. u8 power_mode; /* enumeration values are defined in MXL_HYDRA_PWR_MODE_E (device API.h) */
  559. };
  560. struct MXL_HYDRA_RF_WAKEUP_PARAM_T {
  561. u32 time_interval_in_seconds; /* in seconds */
  562. u32 tuner_index;
  563. s32 rssi_threshold;
  564. };
  565. struct MXL_HYDRA_RF_WAKEUP_CFG_T {
  566. u32 tuner_count;
  567. struct MXL_HYDRA_RF_WAKEUP_PARAM_T params;
  568. };
  569. enum MXL_HYDRA_AUX_CTRL_MODE_E {
  570. MXL_HYDRA_AUX_CTRL_MODE_FSK = 0, /* Select FSK controller */
  571. MXL_HYDRA_AUX_CTRL_MODE_DISEQC, /* Select DiSEqC controller */
  572. };
  573. enum MXL_HYDRA_DISEQC_OPMODE_E {
  574. MXL_HYDRA_DISEQC_ENVELOPE_MODE = 0,
  575. MXL_HYDRA_DISEQC_TONE_MODE,
  576. };
  577. enum MXL_HYDRA_DISEQC_VER_E {
  578. MXL_HYDRA_DISEQC_1_X = 0, /* Config DiSEqC 1.x mode */
  579. MXL_HYDRA_DISEQC_2_X, /* Config DiSEqC 2.x mode */
  580. MXL_HYDRA_DISEQC_DISABLE /* Disable DiSEqC */
  581. };
  582. enum MXL_HYDRA_DISEQC_CARRIER_FREQ_E {
  583. MXL_HYDRA_DISEQC_CARRIER_FREQ_22KHZ = 0, /* DiSEqC signal frequency of 22 KHz */
  584. MXL_HYDRA_DISEQC_CARRIER_FREQ_33KHZ, /* DiSEqC signal frequency of 33 KHz */
  585. MXL_HYDRA_DISEQC_CARRIER_FREQ_44KHZ /* DiSEqC signal frequency of 44 KHz */
  586. };
  587. enum MXL_HYDRA_DISEQC_ID_E {
  588. MXL_HYDRA_DISEQC_ID_0 = 0,
  589. MXL_HYDRA_DISEQC_ID_1,
  590. MXL_HYDRA_DISEQC_ID_2,
  591. MXL_HYDRA_DISEQC_ID_3
  592. };
  593. enum MXL_HYDRA_FSK_OP_MODE_E {
  594. MXL_HYDRA_FSK_CFG_TYPE_39KPBS = 0, /* 39.0kbps */
  595. MXL_HYDRA_FSK_CFG_TYPE_39_017KPBS, /* 39.017kbps */
  596. MXL_HYDRA_FSK_CFG_TYPE_115_2KPBS /* 115.2kbps */
  597. };
  598. struct MXL58X_DSQ_OP_MODE_T {
  599. u32 diseqc_id; /* DSQ 0, 1, 2 or 3 */
  600. u32 op_mode; /* Envelope mode (0) or internal tone mode (1) */
  601. u32 version; /* 0: 1.0, 1: 1.1, 2: Disable */
  602. u32 center_freq; /* 0: 22KHz, 1: 33KHz and 2: 44 KHz */
  603. };
  604. struct MXL_HYDRA_DISEQC_CFG_CONT_TONE_T {
  605. u32 diseqc_id;
  606. u32 cont_tone_flag; /* 1: Enable , 0: Disable */
  607. };