1dc2b3d17SDaniel Scheller /* SPDX-License-Identifier: GPL-2.0 */
23c4e0415SDaniel Scheller /*
33c4e0415SDaniel Scheller  * Defines for the Maxlinear MX58x family of tuners/demods
43c4e0415SDaniel Scheller  *
53c4e0415SDaniel Scheller  * Copyright (C) 2014 Digital Devices GmbH
63c4e0415SDaniel Scheller  *
73c4e0415SDaniel Scheller  * based on code:
83c4e0415SDaniel Scheller  * Copyright (c) 2011-2013 MaxLinear, Inc. All rights reserved
93c4e0415SDaniel Scheller  * which was released under GPL V2
103c4e0415SDaniel Scheller  *
113c4e0415SDaniel Scheller  * This program is free software; you can redistribute it and/or
123c4e0415SDaniel Scheller  * modify it under the terms of the GNU General Public License
133c4e0415SDaniel Scheller  * version 2, as published by the Free Software Foundation.
143c4e0415SDaniel Scheller  */
153c4e0415SDaniel Scheller 
163c4e0415SDaniel Scheller enum MXL_BOOL_E {
173c4e0415SDaniel Scheller 	MXL_DISABLE = 0,
183c4e0415SDaniel Scheller 	MXL_ENABLE  = 1,
193c4e0415SDaniel Scheller 
203c4e0415SDaniel Scheller 	MXL_FALSE = 0,
213c4e0415SDaniel Scheller 	MXL_TRUE  = 1,
223c4e0415SDaniel Scheller 
233c4e0415SDaniel Scheller 	MXL_INVALID = 0,
243c4e0415SDaniel Scheller 	MXL_VALID   = 1,
253c4e0415SDaniel Scheller 
263c4e0415SDaniel Scheller 	MXL_NO      = 0,
273c4e0415SDaniel Scheller 	MXL_YES     = 1,
283c4e0415SDaniel Scheller 
293c4e0415SDaniel Scheller 	MXL_OFF     = 0,
303c4e0415SDaniel Scheller 	MXL_ON      = 1
313c4e0415SDaniel Scheller };
323c4e0415SDaniel Scheller 
333c4e0415SDaniel Scheller /* Firmware-Host Command IDs */
343c4e0415SDaniel Scheller enum MXL_HYDRA_HOST_CMD_ID_E {
353c4e0415SDaniel Scheller 	/* --Device command IDs-- */
363c4e0415SDaniel Scheller 	MXL_HYDRA_DEV_NO_OP_CMD = 0, /* No OP */
373c4e0415SDaniel Scheller 
383c4e0415SDaniel Scheller 	MXL_HYDRA_DEV_SET_POWER_MODE_CMD = 1,
393c4e0415SDaniel Scheller 	MXL_HYDRA_DEV_SET_OVERWRITE_DEF_CMD = 2,
403c4e0415SDaniel Scheller 
413c4e0415SDaniel Scheller 	/* Host-used CMD, not used by firmware */
423c4e0415SDaniel Scheller 	MXL_HYDRA_DEV_FIRMWARE_DOWNLOAD_CMD = 3,
433c4e0415SDaniel Scheller 
443c4e0415SDaniel Scheller 	/* Additional CONTROL types from DTV */
453c4e0415SDaniel Scheller 	MXL_HYDRA_DEV_SET_BROADCAST_PID_STB_ID_CMD = 4,
463c4e0415SDaniel Scheller 	MXL_HYDRA_DEV_GET_PMM_SLEEP_CMD = 5,
473c4e0415SDaniel Scheller 
483c4e0415SDaniel Scheller 	/* --Tuner command IDs-- */
493c4e0415SDaniel Scheller 	MXL_HYDRA_TUNER_TUNE_CMD = 6,
503c4e0415SDaniel Scheller 	MXL_HYDRA_TUNER_GET_STATUS_CMD = 7,
513c4e0415SDaniel Scheller 
523c4e0415SDaniel Scheller 	/* --Demod command IDs-- */
533c4e0415SDaniel Scheller 	MXL_HYDRA_DEMOD_SET_PARAM_CMD = 8,
543c4e0415SDaniel Scheller 	MXL_HYDRA_DEMOD_GET_STATUS_CMD = 9,
553c4e0415SDaniel Scheller 
563c4e0415SDaniel Scheller 	MXL_HYDRA_DEMOD_RESET_FEC_COUNTER_CMD = 10,
573c4e0415SDaniel Scheller 
583c4e0415SDaniel Scheller 	MXL_HYDRA_DEMOD_SET_PKT_NUM_CMD = 11,
593c4e0415SDaniel Scheller 
603c4e0415SDaniel Scheller 	MXL_HYDRA_DEMOD_SET_IQ_SOURCE_CMD = 12,
613c4e0415SDaniel Scheller 	MXL_HYDRA_DEMOD_GET_IQ_DATA_CMD = 13,
623c4e0415SDaniel Scheller 
633c4e0415SDaniel Scheller 	MXL_HYDRA_DEMOD_GET_M68HC05_VER_CMD = 14,
643c4e0415SDaniel Scheller 
653c4e0415SDaniel Scheller 	MXL_HYDRA_DEMOD_SET_ERROR_COUNTER_MODE_CMD = 15,
663c4e0415SDaniel Scheller 
673c4e0415SDaniel Scheller 	/* --- ABORT channel tune */
683c4e0415SDaniel Scheller 	MXL_HYDRA_ABORT_TUNE_CMD = 16, /* Abort current tune command. */
693c4e0415SDaniel Scheller 
703c4e0415SDaniel Scheller 	/* --SWM/FSK command IDs-- */
713c4e0415SDaniel Scheller 	MXL_HYDRA_FSK_RESET_CMD = 17,
723c4e0415SDaniel Scheller 	MXL_HYDRA_FSK_MSG_CMD = 18,
733c4e0415SDaniel Scheller 	MXL_HYDRA_FSK_SET_OP_MODE_CMD = 19,
743c4e0415SDaniel Scheller 
753c4e0415SDaniel Scheller 	/* --DiSeqC command IDs-- */
763c4e0415SDaniel Scheller 	MXL_HYDRA_DISEQC_MSG_CMD = 20,
773c4e0415SDaniel Scheller 	MXL_HYDRA_DISEQC_COPY_MSG_TO_MAILBOX = 21,
783c4e0415SDaniel Scheller 	MXL_HYDRA_DISEQC_CFG_MSG_CMD = 22,
793c4e0415SDaniel Scheller 
803c4e0415SDaniel Scheller 	/* --- FFT Debug Command IDs-- */
813c4e0415SDaniel Scheller 	MXL_HYDRA_REQ_FFT_SPECTRUM_CMD = 23,
823c4e0415SDaniel Scheller 
833c4e0415SDaniel Scheller 	/* -- Demod scramblle code */
843c4e0415SDaniel Scheller 	MXL_HYDRA_DEMOD_SCRAMBLE_CODE_CMD = 24,
853c4e0415SDaniel Scheller 
863c4e0415SDaniel Scheller 	/* ---For host to know how many commands in total */
873c4e0415SDaniel Scheller 	MXL_HYDRA_LAST_HOST_CMD = 25,
883c4e0415SDaniel Scheller 
893c4e0415SDaniel Scheller 	MXL_HYDRA_DEMOD_INTR_TYPE_CMD = 47,
903c4e0415SDaniel Scheller 	MXL_HYDRA_DEV_INTR_CLEAR_CMD = 48,
913c4e0415SDaniel Scheller 	MXL_HYDRA_TUNER_SPECTRUM_REQ_CMD = 53,
923c4e0415SDaniel Scheller 	MXL_HYDRA_TUNER_ACTIVATE_CMD = 55,
933c4e0415SDaniel Scheller 	MXL_HYDRA_DEV_CFG_POWER_MODE_CMD = 56,
943c4e0415SDaniel Scheller 	MXL_HYDRA_DEV_XTAL_CAP_CMD = 57,
953c4e0415SDaniel Scheller 	MXL_HYDRA_DEV_CFG_SKU_CMD = 58,
963c4e0415SDaniel Scheller 	MXL_HYDRA_TUNER_SPECTRUM_MIN_GAIN_CMD = 59,
973c4e0415SDaniel Scheller 	MXL_HYDRA_DISEQC_CONT_TONE_CFG = 60,
983c4e0415SDaniel Scheller 	MXL_HYDRA_DEV_RF_WAKE_UP_CMD = 61,
993c4e0415SDaniel Scheller 	MXL_HYDRA_DEMOD_CFG_EQ_CTRL_PARAM_CMD = 62,
1003c4e0415SDaniel Scheller 	MXL_HYDRA_DEMOD_FREQ_OFFSET_SEARCH_RANGE_CMD = 63,
1013c4e0415SDaniel Scheller 	MXL_HYDRA_DEV_REQ_PWR_FROM_ADCRSSI_CMD = 64,
1023c4e0415SDaniel Scheller 
1033c4e0415SDaniel Scheller 	MXL_XCPU_PID_FLT_CFG_CMD = 65,
1043c4e0415SDaniel Scheller 	MXL_XCPU_SHMEM_TEST_CMD = 66,
1053c4e0415SDaniel Scheller 	MXL_XCPU_ABORT_TUNE_CMD = 67,
1063c4e0415SDaniel Scheller 	MXL_XCPU_CHAN_TUNE_CMD = 68,
1073c4e0415SDaniel Scheller 	MXL_XCPU_FLT_BOND_HDRS_CMD = 69,
1083c4e0415SDaniel Scheller 
1093c4e0415SDaniel Scheller 	MXL_HYDRA_DEV_BROADCAST_WAKE_UP_CMD = 70,
1103c4e0415SDaniel Scheller 	MXL_HYDRA_FSK_CFG_FSK_FREQ_CMD = 71,
1113c4e0415SDaniel Scheller 	MXL_HYDRA_FSK_POWER_DOWN_CMD = 72,
1123c4e0415SDaniel Scheller 	MXL_XCPU_CLEAR_CB_STATS_CMD = 73,
1133c4e0415SDaniel Scheller 	MXL_XCPU_CHAN_BOND_RESTART_CMD = 74
1143c4e0415SDaniel Scheller };
1153c4e0415SDaniel Scheller 
1163c4e0415SDaniel Scheller #define MXL_ENABLE_BIG_ENDIAN        (0)
1173c4e0415SDaniel Scheller 
1183c4e0415SDaniel Scheller #define MXL_HYDRA_OEM_MAX_BLOCK_WRITE_LENGTH   248
1193c4e0415SDaniel Scheller 
1203c4e0415SDaniel Scheller #define MXL_HYDRA_OEM_MAX_CMD_BUFF_LEN        (248)
1213c4e0415SDaniel Scheller 
1223c4e0415SDaniel Scheller #define MXL_HYDRA_CAP_MIN     10
1233c4e0415SDaniel Scheller #define MXL_HYDRA_CAP_MAX     33
1243c4e0415SDaniel Scheller 
1253c4e0415SDaniel Scheller #define MXL_HYDRA_PLID_REG_READ       0xFB   /* Read register PLID */
1263c4e0415SDaniel Scheller #define MXL_HYDRA_PLID_REG_WRITE      0xFC   /* Write register PLID */
1273c4e0415SDaniel Scheller 
1283c4e0415SDaniel Scheller #define MXL_HYDRA_PLID_CMD_READ       0xFD   /* Command Read PLID */
1293c4e0415SDaniel Scheller #define MXL_HYDRA_PLID_CMD_WRITE      0xFE   /* Command Write PLID */
1303c4e0415SDaniel Scheller 
1313c4e0415SDaniel Scheller #define MXL_HYDRA_REG_SIZE_IN_BYTES   4      /* Hydra register size in bytes */
1323c4e0415SDaniel Scheller #define MXL_HYDRA_I2C_HDR_SIZE        (2 * sizeof(u8)) /* PLID + LEN(0xFF) */
1333c4e0415SDaniel Scheller #define MXL_HYDRA_CMD_HEADER_SIZE     (MXL_HYDRA_REG_SIZE_IN_BYTES + MXL_HYDRA_I2C_HDR_SIZE)
1343c4e0415SDaniel Scheller 
1353c4e0415SDaniel Scheller #define MXL_HYDRA_SKU_ID_581 0
1363c4e0415SDaniel Scheller #define MXL_HYDRA_SKU_ID_584 1
1373c4e0415SDaniel Scheller #define MXL_HYDRA_SKU_ID_585 2
1383c4e0415SDaniel Scheller #define MXL_HYDRA_SKU_ID_544 3
1393c4e0415SDaniel Scheller #define MXL_HYDRA_SKU_ID_561 4
1403c4e0415SDaniel Scheller #define MXL_HYDRA_SKU_ID_582 5
1413c4e0415SDaniel Scheller #define MXL_HYDRA_SKU_ID_568 6
1423c4e0415SDaniel Scheller 
1433c4e0415SDaniel Scheller /* macro for register write data buffer size
1443c4e0415SDaniel Scheller  * (PLID + LEN (0xFF) + RegAddr + RegData)
1453c4e0415SDaniel Scheller  */
1463c4e0415SDaniel Scheller #define MXL_HYDRA_REG_WRITE_LEN       (MXL_HYDRA_I2C_HDR_SIZE + (2 * MXL_HYDRA_REG_SIZE_IN_BYTES))
1473c4e0415SDaniel Scheller 
1483c4e0415SDaniel Scheller /* macro to extract a single byte from 4-byte(32-bit) data */
1493c4e0415SDaniel Scheller #define GET_BYTE(x, n)  (((x) >> (8*(n))) & 0xFF)
1503c4e0415SDaniel Scheller 
1513c4e0415SDaniel Scheller #define MAX_CMD_DATA 512
1523c4e0415SDaniel Scheller 
1533c4e0415SDaniel Scheller #define MXL_GET_REG_MASK_32(lsb_loc, num_of_bits) ((0xFFFFFFFF >> (32 - (num_of_bits))) << (lsb_loc))
1543c4e0415SDaniel Scheller 
1553c4e0415SDaniel Scheller #define FW_DL_SIGN (0xDEADBEEF)
1563c4e0415SDaniel Scheller 
1573c4e0415SDaniel Scheller #define MBIN_FORMAT_VERSION               '1'
1583c4e0415SDaniel Scheller #define MBIN_FILE_HEADER_ID               'M'
1593c4e0415SDaniel Scheller #define MBIN_SEGMENT_HEADER_ID            'S'
1603c4e0415SDaniel Scheller #define MBIN_MAX_FILE_LENGTH              (1<<23)
1613c4e0415SDaniel Scheller 
1623c4e0415SDaniel Scheller struct MBIN_FILE_HEADER_T {
1633c4e0415SDaniel Scheller 	u8 id;
1643c4e0415SDaniel Scheller 	u8 fmt_version;
1653c4e0415SDaniel Scheller 	u8 header_len;
1663c4e0415SDaniel Scheller 	u8 num_segments;
1673c4e0415SDaniel Scheller 	u8 entry_address[4];
1683c4e0415SDaniel Scheller 	u8 image_size24[3];
1693c4e0415SDaniel Scheller 	u8 image_checksum;
1703c4e0415SDaniel Scheller 	u8 reserved[4];
1713c4e0415SDaniel Scheller };
1723c4e0415SDaniel Scheller 
1733c4e0415SDaniel Scheller struct MBIN_FILE_T {
1743c4e0415SDaniel Scheller 	struct MBIN_FILE_HEADER_T header;
1753c4e0415SDaniel Scheller 	u8 data[1];
1763c4e0415SDaniel Scheller };
1773c4e0415SDaniel Scheller 
1783c4e0415SDaniel Scheller struct MBIN_SEGMENT_HEADER_T {
1793c4e0415SDaniel Scheller 	u8 id;
1803c4e0415SDaniel Scheller 	u8 len24[3];
1813c4e0415SDaniel Scheller 	u8 address[4];
1823c4e0415SDaniel Scheller };
1833c4e0415SDaniel Scheller 
1843c4e0415SDaniel Scheller struct MBIN_SEGMENT_T {
1853c4e0415SDaniel Scheller 	struct MBIN_SEGMENT_HEADER_T header;
1863c4e0415SDaniel Scheller 	u8 data[1];
1873c4e0415SDaniel Scheller };
1883c4e0415SDaniel Scheller 
1893c4e0415SDaniel Scheller enum MXL_CMD_TYPE_E { MXL_CMD_WRITE = 0, MXL_CMD_READ };
1903c4e0415SDaniel Scheller 
1913c4e0415SDaniel Scheller #define BUILD_HYDRA_CMD(cmd_id, req_type, size, data_ptr, cmd_buff)		\
1923c4e0415SDaniel Scheller 	do {								\
1933c4e0415SDaniel Scheller 		cmd_buff[0] = ((req_type == MXL_CMD_WRITE) ? MXL_HYDRA_PLID_CMD_WRITE : MXL_HYDRA_PLID_CMD_READ); \
1943c4e0415SDaniel Scheller 		cmd_buff[1] = (size > 251) ? 0xff : (u8) (size + 4);	\
1953c4e0415SDaniel Scheller 		cmd_buff[2] = size;					\
1963c4e0415SDaniel Scheller 		cmd_buff[3] = cmd_id;					\
1973c4e0415SDaniel Scheller 		cmd_buff[4] = 0x00;					\
1983c4e0415SDaniel Scheller 		cmd_buff[5] = 0x00;					\
1993c4e0415SDaniel Scheller 		convert_endian(MXL_ENABLE_BIG_ENDIAN, size, (u8 *)data_ptr); \
2003c4e0415SDaniel Scheller 		memcpy((void *)&cmd_buff[6], data_ptr, size);		\
2013c4e0415SDaniel Scheller 	} while (0)
2023c4e0415SDaniel Scheller 
2033c4e0415SDaniel Scheller struct MXL_REG_FIELD_T {
2043c4e0415SDaniel Scheller 	u32 reg_addr;
2053c4e0415SDaniel Scheller 	u8 lsb_pos;
2063c4e0415SDaniel Scheller 	u8 num_of_bits;
2073c4e0415SDaniel Scheller };
2083c4e0415SDaniel Scheller 
2093c4e0415SDaniel Scheller struct MXL_DEV_CMD_DATA_T {
2103c4e0415SDaniel Scheller 	u32 data_size;
2113c4e0415SDaniel Scheller 	u8 data[MAX_CMD_DATA];
2123c4e0415SDaniel Scheller };
2133c4e0415SDaniel Scheller 
2143c4e0415SDaniel Scheller enum MXL_HYDRA_SKU_TYPE_E {
2153c4e0415SDaniel Scheller 	MXL_HYDRA_SKU_TYPE_MIN = 0x00,
2163c4e0415SDaniel Scheller 	MXL_HYDRA_SKU_TYPE_581 = 0x00,
2173c4e0415SDaniel Scheller 	MXL_HYDRA_SKU_TYPE_584 = 0x01,
2183c4e0415SDaniel Scheller 	MXL_HYDRA_SKU_TYPE_585 = 0x02,
2193c4e0415SDaniel Scheller 	MXL_HYDRA_SKU_TYPE_544 = 0x03,
2203c4e0415SDaniel Scheller 	MXL_HYDRA_SKU_TYPE_561 = 0x04,
2213c4e0415SDaniel Scheller 	MXL_HYDRA_SKU_TYPE_5XX = 0x05,
2223c4e0415SDaniel Scheller 	MXL_HYDRA_SKU_TYPE_5YY = 0x06,
2233c4e0415SDaniel Scheller 	MXL_HYDRA_SKU_TYPE_511 = 0x07,
2243c4e0415SDaniel Scheller 	MXL_HYDRA_SKU_TYPE_561_DE = 0x08,
2253c4e0415SDaniel Scheller 	MXL_HYDRA_SKU_TYPE_582 = 0x09,
2263c4e0415SDaniel Scheller 	MXL_HYDRA_SKU_TYPE_541 = 0x0A,
2273c4e0415SDaniel Scheller 	MXL_HYDRA_SKU_TYPE_568 = 0x0B,
2283c4e0415SDaniel Scheller 	MXL_HYDRA_SKU_TYPE_542 = 0x0C,
2293c4e0415SDaniel Scheller 	MXL_HYDRA_SKU_TYPE_MAX = 0x0D,
2303c4e0415SDaniel Scheller };
2313c4e0415SDaniel Scheller 
2323c4e0415SDaniel Scheller struct MXL_HYDRA_SKU_COMMAND_T {
2333c4e0415SDaniel Scheller 	enum MXL_HYDRA_SKU_TYPE_E sku_type;
2343c4e0415SDaniel Scheller };
2353c4e0415SDaniel Scheller 
2363c4e0415SDaniel Scheller enum MXL_HYDRA_DEMOD_ID_E {
2373c4e0415SDaniel Scheller 	MXL_HYDRA_DEMOD_ID_0 = 0,
2383c4e0415SDaniel Scheller 	MXL_HYDRA_DEMOD_ID_1,
2393c4e0415SDaniel Scheller 	MXL_HYDRA_DEMOD_ID_2,
2403c4e0415SDaniel Scheller 	MXL_HYDRA_DEMOD_ID_3,
2413c4e0415SDaniel Scheller 	MXL_HYDRA_DEMOD_ID_4,
2423c4e0415SDaniel Scheller 	MXL_HYDRA_DEMOD_ID_5,
2433c4e0415SDaniel Scheller 	MXL_HYDRA_DEMOD_ID_6,
2443c4e0415SDaniel Scheller 	MXL_HYDRA_DEMOD_ID_7,
2453c4e0415SDaniel Scheller 	MXL_HYDRA_DEMOD_MAX
2463c4e0415SDaniel Scheller };
2473c4e0415SDaniel Scheller 
2483c4e0415SDaniel Scheller #define MXL_DEMOD_SCRAMBLE_SEQ_LEN  12
2493c4e0415SDaniel Scheller 
2503c4e0415SDaniel Scheller #define MAX_STEP_SIZE_24_XTAL_102_05_KHZ  195
2513c4e0415SDaniel Scheller #define MAX_STEP_SIZE_24_XTAL_204_10_KHZ  215
2523c4e0415SDaniel Scheller #define MAX_STEP_SIZE_24_XTAL_306_15_KHZ  203
2533c4e0415SDaniel Scheller #define MAX_STEP_SIZE_24_XTAL_408_20_KHZ  177
2543c4e0415SDaniel Scheller 
2553c4e0415SDaniel Scheller #define MAX_STEP_SIZE_27_XTAL_102_05_KHZ  195
2563c4e0415SDaniel Scheller #define MAX_STEP_SIZE_27_XTAL_204_10_KHZ  215
2573c4e0415SDaniel Scheller #define MAX_STEP_SIZE_27_XTAL_306_15_KHZ  203
2583c4e0415SDaniel Scheller #define MAX_STEP_SIZE_27_XTAL_408_20_KHZ  177
2593c4e0415SDaniel Scheller 
2603c4e0415SDaniel Scheller #define MXL_HYDRA_SPECTRUM_MIN_FREQ_KHZ  300000
2613c4e0415SDaniel Scheller #define MXL_HYDRA_SPECTRUM_MAX_FREQ_KHZ 2350000
2623c4e0415SDaniel Scheller 
2633c4e0415SDaniel Scheller enum MXL_DEMOD_CHAN_PARAMS_OFFSET_E {
2643c4e0415SDaniel Scheller 	DMD_STANDARD_ADDR = 0,
2653c4e0415SDaniel Scheller 	DMD_SPECTRUM_INVERSION_ADDR,
2663c4e0415SDaniel Scheller 	DMD_SPECTRUM_ROLL_OFF_ADDR,
2673c4e0415SDaniel Scheller 	DMD_SYMBOL_RATE_ADDR,
2683c4e0415SDaniel Scheller 	DMD_MODULATION_SCHEME_ADDR,
2693c4e0415SDaniel Scheller 	DMD_FEC_CODE_RATE_ADDR,
2703c4e0415SDaniel Scheller 	DMD_SNR_ADDR,
2713c4e0415SDaniel Scheller 	DMD_FREQ_OFFSET_ADDR,
2723c4e0415SDaniel Scheller 	DMD_CTL_FREQ_OFFSET_ADDR,
2733c4e0415SDaniel Scheller 	DMD_STR_FREQ_OFFSET_ADDR,
2743c4e0415SDaniel Scheller 	DMD_FTL_FREQ_OFFSET_ADDR,
2753c4e0415SDaniel Scheller 	DMD_STR_NBC_SYNC_LOCK_ADDR,
2763c4e0415SDaniel Scheller 	DMD_CYCLE_SLIP_COUNT_ADDR,
2773c4e0415SDaniel Scheller 	DMD_DISPLAY_IQ_ADDR,
2783c4e0415SDaniel Scheller 	DMD_DVBS2_CRC_ERRORS_ADDR,
2793c4e0415SDaniel Scheller 	DMD_DVBS2_PER_COUNT_ADDR,
2803c4e0415SDaniel Scheller 	DMD_DVBS2_PER_WINDOW_ADDR,
2813c4e0415SDaniel Scheller 	DMD_DVBS_CORR_RS_ERRORS_ADDR,
2823c4e0415SDaniel Scheller 	DMD_DVBS_UNCORR_RS_ERRORS_ADDR,
2833c4e0415SDaniel Scheller 	DMD_DVBS_BER_COUNT_ADDR,
2843c4e0415SDaniel Scheller 	DMD_DVBS_BER_WINDOW_ADDR,
2853c4e0415SDaniel Scheller 	DMD_TUNER_ID_ADDR,
2863c4e0415SDaniel Scheller 	DMD_DVBS2_PILOT_ON_OFF_ADDR,
2873c4e0415SDaniel Scheller 	DMD_FREQ_SEARCH_RANGE_IN_KHZ_ADDR,
2883c4e0415SDaniel Scheller 
2893c4e0415SDaniel Scheller 	MXL_DEMOD_CHAN_PARAMS_BUFF_SIZE,
2903c4e0415SDaniel Scheller };
2913c4e0415SDaniel Scheller 
2923c4e0415SDaniel Scheller enum MXL_HYDRA_TUNER_ID_E {
2933c4e0415SDaniel Scheller 	MXL_HYDRA_TUNER_ID_0 = 0,
2943c4e0415SDaniel Scheller 	MXL_HYDRA_TUNER_ID_1,
2953c4e0415SDaniel Scheller 	MXL_HYDRA_TUNER_ID_2,
2963c4e0415SDaniel Scheller 	MXL_HYDRA_TUNER_ID_3,
2973c4e0415SDaniel Scheller 	MXL_HYDRA_TUNER_MAX
2983c4e0415SDaniel Scheller };
2993c4e0415SDaniel Scheller 
3003c4e0415SDaniel Scheller enum MXL_HYDRA_BCAST_STD_E {
3013c4e0415SDaniel Scheller 	MXL_HYDRA_DSS = 0,
3023c4e0415SDaniel Scheller 	MXL_HYDRA_DVBS,
3033c4e0415SDaniel Scheller 	MXL_HYDRA_DVBS2,
3043c4e0415SDaniel Scheller };
3053c4e0415SDaniel Scheller 
3063c4e0415SDaniel Scheller enum MXL_HYDRA_FEC_E {
3073c4e0415SDaniel Scheller 	MXL_HYDRA_FEC_AUTO = 0,
3083c4e0415SDaniel Scheller 	MXL_HYDRA_FEC_1_2,
3093c4e0415SDaniel Scheller 	MXL_HYDRA_FEC_3_5,
3103c4e0415SDaniel Scheller 	MXL_HYDRA_FEC_2_3,
3113c4e0415SDaniel Scheller 	MXL_HYDRA_FEC_3_4,
3123c4e0415SDaniel Scheller 	MXL_HYDRA_FEC_4_5,
3133c4e0415SDaniel Scheller 	MXL_HYDRA_FEC_5_6,
3143c4e0415SDaniel Scheller 	MXL_HYDRA_FEC_6_7,
3153c4e0415SDaniel Scheller 	MXL_HYDRA_FEC_7_8,
3163c4e0415SDaniel Scheller 	MXL_HYDRA_FEC_8_9,
3173c4e0415SDaniel Scheller 	MXL_HYDRA_FEC_9_10,
3183c4e0415SDaniel Scheller };
3193c4e0415SDaniel Scheller 
3203c4e0415SDaniel Scheller enum MXL_HYDRA_MODULATION_E {
3213c4e0415SDaniel Scheller 	MXL_HYDRA_MOD_AUTO = 0,
3223c4e0415SDaniel Scheller 	MXL_HYDRA_MOD_QPSK,
3233c4e0415SDaniel Scheller 	MXL_HYDRA_MOD_8PSK
3243c4e0415SDaniel Scheller };
3253c4e0415SDaniel Scheller 
3263c4e0415SDaniel Scheller enum MXL_HYDRA_SPECTRUM_E {
3273c4e0415SDaniel Scheller 	MXL_HYDRA_SPECTRUM_AUTO = 0,
3283c4e0415SDaniel Scheller 	MXL_HYDRA_SPECTRUM_INVERTED,
3293c4e0415SDaniel Scheller 	MXL_HYDRA_SPECTRUM_NON_INVERTED,
3303c4e0415SDaniel Scheller };
3313c4e0415SDaniel Scheller 
3323c4e0415SDaniel Scheller enum MXL_HYDRA_ROLLOFF_E {
3333c4e0415SDaniel Scheller 	MXL_HYDRA_ROLLOFF_AUTO  = 0,
3343c4e0415SDaniel Scheller 	MXL_HYDRA_ROLLOFF_0_20,
3353c4e0415SDaniel Scheller 	MXL_HYDRA_ROLLOFF_0_25,
3363c4e0415SDaniel Scheller 	MXL_HYDRA_ROLLOFF_0_35
3373c4e0415SDaniel Scheller };
3383c4e0415SDaniel Scheller 
3393c4e0415SDaniel Scheller enum MXL_HYDRA_PILOTS_E {
3403c4e0415SDaniel Scheller 	MXL_HYDRA_PILOTS_OFF  = 0,
3413c4e0415SDaniel Scheller 	MXL_HYDRA_PILOTS_ON,
3423c4e0415SDaniel Scheller 	MXL_HYDRA_PILOTS_AUTO
3433c4e0415SDaniel Scheller };
3443c4e0415SDaniel Scheller 
3453c4e0415SDaniel Scheller enum MXL_HYDRA_CONSTELLATION_SRC_E {
3463c4e0415SDaniel Scheller 	MXL_HYDRA_FORMATTER = 0,
3473c4e0415SDaniel Scheller 	MXL_HYDRA_LEGACY_FEC,
3483c4e0415SDaniel Scheller 	MXL_HYDRA_FREQ_RECOVERY,
3493c4e0415SDaniel Scheller 	MXL_HYDRA_NBC,
3503c4e0415SDaniel Scheller 	MXL_HYDRA_CTL,
3513c4e0415SDaniel Scheller 	MXL_HYDRA_EQ,
3523c4e0415SDaniel Scheller };
3533c4e0415SDaniel Scheller 
3543c4e0415SDaniel Scheller struct MXL_HYDRA_DEMOD_LOCK_T {
3553c4e0415SDaniel Scheller 	int agc_lock; /* AGC lock info */
3563c4e0415SDaniel Scheller 	int fec_lock; /* Demod FEC block lock info */
3573c4e0415SDaniel Scheller };
3583c4e0415SDaniel Scheller 
3593c4e0415SDaniel Scheller struct MXL_HYDRA_DEMOD_STATUS_DVBS_T {
3603c4e0415SDaniel Scheller 	u32 rs_errors;        /* RS decoder err counter */
3613c4e0415SDaniel Scheller 	u32 ber_window;       /* Ber Windows */
3623c4e0415SDaniel Scheller 	u32 ber_count;        /* BER count */
3633c4e0415SDaniel Scheller 	u32 ber_window_iter1; /* Ber Windows - post viterbi */
3643c4e0415SDaniel Scheller 	u32 ber_count_iter1;  /* BER count - post viterbi */
3653c4e0415SDaniel Scheller };
3663c4e0415SDaniel Scheller 
3673c4e0415SDaniel Scheller struct MXL_HYDRA_DEMOD_STATUS_DSS_T {
3683c4e0415SDaniel Scheller 	u32 rs_errors;  /* RS decoder err counter */
3693c4e0415SDaniel Scheller 	u32 ber_window; /* Ber Windows */
3703c4e0415SDaniel Scheller 	u32 ber_count;  /* BER count */
3713c4e0415SDaniel Scheller };
3723c4e0415SDaniel Scheller 
3733c4e0415SDaniel Scheller struct MXL_HYDRA_DEMOD_STATUS_DVBS2_T {
3743c4e0415SDaniel Scheller 	u32 crc_errors;        /* CRC error counter */
3753c4e0415SDaniel Scheller 	u32 packet_error_count; /* Number of packet errors */
3763c4e0415SDaniel Scheller 	u32 total_packets;     /* Total packets */
3773c4e0415SDaniel Scheller };
3783c4e0415SDaniel Scheller 
3793c4e0415SDaniel Scheller struct MXL_HYDRA_DEMOD_STATUS_T {
3803c4e0415SDaniel Scheller 	enum MXL_HYDRA_BCAST_STD_E standard_mask; /* Standard DVB-S, DVB-S2 or DSS */
3813c4e0415SDaniel Scheller 
3823c4e0415SDaniel Scheller 	union {
3833c4e0415SDaniel Scheller 		struct MXL_HYDRA_DEMOD_STATUS_DVBS_T demod_status_dvbs;   /* DVB-S demod status */
3843c4e0415SDaniel Scheller 		struct MXL_HYDRA_DEMOD_STATUS_DVBS2_T demod_status_dvbs2; /* DVB-S2 demod status */
3853c4e0415SDaniel Scheller 		struct MXL_HYDRA_DEMOD_STATUS_DSS_T demod_status_dss;     /* DSS demod status */
3863c4e0415SDaniel Scheller 	} u;
3873c4e0415SDaniel Scheller };
3883c4e0415SDaniel Scheller 
3893c4e0415SDaniel Scheller struct MXL_HYDRA_DEMOD_SIG_OFFSET_INFO_T {
3903c4e0415SDaniel Scheller 	s32 carrier_offset_in_hz; /* CRL offset info */
3913c4e0415SDaniel Scheller 	s32 symbol_offset_in_symbol; /* SRL offset info */
3923c4e0415SDaniel Scheller };
3933c4e0415SDaniel Scheller 
3943c4e0415SDaniel Scheller struct MXL_HYDRA_DEMOD_SCRAMBLE_INFO_T {
3953c4e0415SDaniel Scheller 	u8 scramble_sequence[MXL_DEMOD_SCRAMBLE_SEQ_LEN]; /* scramble sequence */
3963c4e0415SDaniel Scheller 	u32 scramble_code; /* scramble gold code */
3973c4e0415SDaniel Scheller };
3983c4e0415SDaniel Scheller 
3993c4e0415SDaniel Scheller enum MXL_HYDRA_SPECTRUM_STEP_SIZE_E {
4003c4e0415SDaniel Scheller 	MXL_HYDRA_STEP_SIZE_24_XTAL_102_05KHZ, /* 102.05 KHz for 24 MHz XTAL */
4013c4e0415SDaniel Scheller 	MXL_HYDRA_STEP_SIZE_24_XTAL_204_10KHZ, /* 204.10 KHz for 24 MHz XTAL */
4023c4e0415SDaniel Scheller 	MXL_HYDRA_STEP_SIZE_24_XTAL_306_15KHZ, /* 306.15 KHz for 24 MHz XTAL */
4033c4e0415SDaniel Scheller 	MXL_HYDRA_STEP_SIZE_24_XTAL_408_20KHZ, /* 408.20 KHz for 24 MHz XTAL */
4043c4e0415SDaniel Scheller 
4053c4e0415SDaniel Scheller 	MXL_HYDRA_STEP_SIZE_27_XTAL_102_05KHZ, /* 102.05 KHz for 27 MHz XTAL */
4063c4e0415SDaniel Scheller 	MXL_HYDRA_STEP_SIZE_27_XTAL_204_35KHZ, /* 204.35 KHz for 27 MHz XTAL */
4073c4e0415SDaniel Scheller 	MXL_HYDRA_STEP_SIZE_27_XTAL_306_52KHZ, /* 306.52 KHz for 27 MHz XTAL */
4083c4e0415SDaniel Scheller 	MXL_HYDRA_STEP_SIZE_27_XTAL_408_69KHZ, /* 408.69 KHz for 27 MHz XTAL */
4093c4e0415SDaniel Scheller };
4103c4e0415SDaniel Scheller 
4113c4e0415SDaniel Scheller enum MXL_HYDRA_SPECTRUM_RESOLUTION_E {
4123c4e0415SDaniel Scheller 	MXL_HYDRA_SPECTRUM_RESOLUTION_00_1_DB, /* 0.1 dB */
4133c4e0415SDaniel Scheller 	MXL_HYDRA_SPECTRUM_RESOLUTION_01_0_DB, /* 1.0 dB */
4143c4e0415SDaniel Scheller 	MXL_HYDRA_SPECTRUM_RESOLUTION_05_0_DB, /* 5.0 dB */
4153c4e0415SDaniel Scheller 	MXL_HYDRA_SPECTRUM_RESOLUTION_10_0_DB, /* 10 dB */
4163c4e0415SDaniel Scheller };
4173c4e0415SDaniel Scheller 
4183c4e0415SDaniel Scheller enum MXL_HYDRA_SPECTRUM_ERROR_CODE_E {
4193c4e0415SDaniel Scheller 	MXL_SPECTRUM_NO_ERROR,
4203c4e0415SDaniel Scheller 	MXL_SPECTRUM_INVALID_PARAMETER,
4213c4e0415SDaniel Scheller 	MXL_SPECTRUM_INVALID_STEP_SIZE,
4223c4e0415SDaniel Scheller 	MXL_SPECTRUM_BW_CANNOT_BE_COVERED,
4233c4e0415SDaniel Scheller 	MXL_SPECTRUM_DEMOD_BUSY,
4243c4e0415SDaniel Scheller 	MXL_SPECTRUM_TUNER_NOT_ENABLED,
4253c4e0415SDaniel Scheller };
4263c4e0415SDaniel Scheller 
4273c4e0415SDaniel Scheller struct MXL_HYDRA_SPECTRUM_REQ_T {
4283c4e0415SDaniel Scheller 	u32 tuner_index; /* TUNER Ctrl: one of MXL58x_TUNER_ID_E */
4293c4e0415SDaniel Scheller 	u32 demod_index; /* DEMOD Ctrl: one of MXL58x_DEMOD_ID_E */
4303c4e0415SDaniel Scheller 	enum MXL_HYDRA_SPECTRUM_STEP_SIZE_E step_size_in_khz;
4313c4e0415SDaniel Scheller 	u32 starting_freq_ink_hz;
4323c4e0415SDaniel Scheller 	u32 total_steps;
4333c4e0415SDaniel Scheller 	enum MXL_HYDRA_SPECTRUM_RESOLUTION_E spectrum_division;
4343c4e0415SDaniel Scheller };
4353c4e0415SDaniel Scheller 
4363c4e0415SDaniel Scheller enum MXL_HYDRA_SEARCH_FREQ_OFFSET_TYPE_E {
4373c4e0415SDaniel Scheller 	MXL_HYDRA_SEARCH_MAX_OFFSET = 0, /* DMD searches for max freq offset (i.e. 5MHz) */
4383c4e0415SDaniel Scheller 	MXL_HYDRA_SEARCH_BW_PLUS_ROLLOFF, /* DMD searches for BW + ROLLOFF/2 */
4393c4e0415SDaniel Scheller };
4403c4e0415SDaniel Scheller 
4413c4e0415SDaniel Scheller struct MXL58X_CFG_FREQ_OFF_SEARCH_RANGE_T {
4423c4e0415SDaniel Scheller 	u32 demod_index;
4433c4e0415SDaniel Scheller 	enum MXL_HYDRA_SEARCH_FREQ_OFFSET_TYPE_E search_type;
4443c4e0415SDaniel Scheller };
4453c4e0415SDaniel Scheller 
4463c4e0415SDaniel Scheller /* there are two slices
4473c4e0415SDaniel Scheller  * slice0 - TS0, TS1, TS2 & TS3
4483c4e0415SDaniel Scheller  * slice1 - TS4, TS5, TS6 & TS7
4493c4e0415SDaniel Scheller  */
4503c4e0415SDaniel Scheller #define MXL_HYDRA_TS_SLICE_MAX  2
4513c4e0415SDaniel Scheller 
4523c4e0415SDaniel Scheller #define MAX_FIXED_PID_NUM   32
4533c4e0415SDaniel Scheller 
4543c4e0415SDaniel Scheller #define MXL_HYDRA_NCO_CLK   418 /* 418 MHz */
4553c4e0415SDaniel Scheller 
4563c4e0415SDaniel Scheller #define MXL_HYDRA_MAX_TS_CLOCK  139 /* 139 MHz */
4573c4e0415SDaniel Scheller 
4583c4e0415SDaniel Scheller #define MXL_HYDRA_TS_FIXED_PID_FILT_SIZE          32
4593c4e0415SDaniel Scheller 
4603c4e0415SDaniel Scheller #define MXL_HYDRA_SHARED_PID_FILT_SIZE_DEFAULT    33   /* Shared PID filter size in 1-1 mux mode */
4613c4e0415SDaniel Scheller #define MXL_HYDRA_SHARED_PID_FILT_SIZE_2_TO_1     66   /* Shared PID filter size in 2-1 mux mode */
4623c4e0415SDaniel Scheller #define MXL_HYDRA_SHARED_PID_FILT_SIZE_4_TO_1     132  /* Shared PID filter size in 4-1 mux mode */
4633c4e0415SDaniel Scheller 
4643c4e0415SDaniel Scheller enum MXL_HYDRA_PID_BANK_TYPE_E {
4653c4e0415SDaniel Scheller 	MXL_HYDRA_SOFTWARE_PID_BANK = 0,
4663c4e0415SDaniel Scheller 	MXL_HYDRA_HARDWARE_PID_BANK,
4673c4e0415SDaniel Scheller };
4683c4e0415SDaniel Scheller 
4693c4e0415SDaniel Scheller enum MXL_HYDRA_TS_MUX_MODE_E {
4703c4e0415SDaniel Scheller 	MXL_HYDRA_TS_MUX_PID_REMAP = 0,
4713c4e0415SDaniel Scheller 	MXL_HYDRA_TS_MUX_PREFIX_EXTRA_HEADER = 1,
4723c4e0415SDaniel Scheller };
4733c4e0415SDaniel Scheller 
4743c4e0415SDaniel Scheller enum MXL_HYDRA_TS_MUX_TYPE_E {
4753c4e0415SDaniel Scheller 	MXL_HYDRA_TS_MUX_DISABLE = 0, /* No Mux ( 1 TSIF to 1 TSIF) */
4763c4e0415SDaniel Scheller 	MXL_HYDRA_TS_MUX_2_TO_1, /* Mux 2 TSIF to 1 TSIF */
4773c4e0415SDaniel Scheller 	MXL_HYDRA_TS_MUX_4_TO_1, /* Mux 4 TSIF to 1 TSIF */
4783c4e0415SDaniel Scheller };
4793c4e0415SDaniel Scheller 
4803c4e0415SDaniel Scheller enum MXL_HYDRA_TS_GROUP_E {
4813c4e0415SDaniel Scheller 	MXL_HYDRA_TS_GROUP_0_3 = 0, /* TS group 0 to 3 (TS0, TS1, TS2 & TS3) */
4823c4e0415SDaniel Scheller 	MXL_HYDRA_TS_GROUP_4_7,     /* TS group 0 to 3 (TS4, TS5, TS6 & TS7) */
4833c4e0415SDaniel Scheller };
4843c4e0415SDaniel Scheller 
4853c4e0415SDaniel Scheller enum MXL_HYDRA_TS_PID_FLT_CTRL_E {
4863c4e0415SDaniel Scheller 	MXL_HYDRA_TS_PIDS_ALLOW_ALL = 0, /* Allow all pids */
4873c4e0415SDaniel Scheller 	MXL_HYDRA_TS_PIDS_DROP_ALL,	 /* Drop all pids */
4883c4e0415SDaniel Scheller 	MXL_HYDRA_TS_INVALIDATE_PID_FILTER, /* Delete current PD filter in the device */
4893c4e0415SDaniel Scheller };
4903c4e0415SDaniel Scheller 
4913c4e0415SDaniel Scheller enum MXL_HYDRA_TS_PID_TYPE_E {
4923c4e0415SDaniel Scheller 	MXL_HYDRA_TS_PID_FIXED = 0,
4933c4e0415SDaniel Scheller 	MXL_HYDRA_TS_PID_REGULAR,
4943c4e0415SDaniel Scheller };
4953c4e0415SDaniel Scheller 
4963c4e0415SDaniel Scheller struct MXL_HYDRA_TS_PID_T {
4973c4e0415SDaniel Scheller 	u16 original_pid;           /* pid from TS */
4983c4e0415SDaniel Scheller 	u16 remapped_pid;           /* remapped pid */
4993c4e0415SDaniel Scheller 	enum MXL_BOOL_E enable;         /* enable or disable pid */
5003c4e0415SDaniel Scheller 	enum MXL_BOOL_E allow_or_drop;    /* allow or drop pid */
5013c4e0415SDaniel Scheller 	enum MXL_BOOL_E enable_pid_remap; /* enable or disable pid remap */
5023c4e0415SDaniel Scheller 	u8 bond_id;                 /* Bond ID in A0 always 0 - Only for 568 Sku */
5033c4e0415SDaniel Scheller 	u8 dest_id;                 /* Output port ID for the PID - Only for 568 Sku */
5043c4e0415SDaniel Scheller };
5053c4e0415SDaniel Scheller 
5063c4e0415SDaniel Scheller struct MXL_HYDRA_TS_MUX_PREFIX_HEADER_T {
5073c4e0415SDaniel Scheller 	enum MXL_BOOL_E enable;
5083c4e0415SDaniel Scheller 	u8 num_byte;
5093c4e0415SDaniel Scheller 	u8 header[12];
5103c4e0415SDaniel Scheller };
5113c4e0415SDaniel Scheller 
5123c4e0415SDaniel Scheller enum MXL_HYDRA_PID_FILTER_BANK_E {
5133c4e0415SDaniel Scheller 	MXL_HYDRA_PID_BANK_A = 0,
5143c4e0415SDaniel Scheller 	MXL_HYDRA_PID_BANK_B,
5153c4e0415SDaniel Scheller };
5163c4e0415SDaniel Scheller 
5173c4e0415SDaniel Scheller enum MXL_HYDRA_MPEG_DATA_FMT_E {
5183c4e0415SDaniel Scheller 	MXL_HYDRA_MPEG_SERIAL_MSB_1ST = 0,
5193c4e0415SDaniel Scheller 	MXL_HYDRA_MPEG_SERIAL_LSB_1ST,
5203c4e0415SDaniel Scheller 
5213c4e0415SDaniel Scheller 	MXL_HYDRA_MPEG_SYNC_WIDTH_BIT = 0,
5223c4e0415SDaniel Scheller 	MXL_HYDRA_MPEG_SYNC_WIDTH_BYTE
5233c4e0415SDaniel Scheller };
5243c4e0415SDaniel Scheller 
5253c4e0415SDaniel Scheller enum MXL_HYDRA_MPEG_MODE_E {
5263c4e0415SDaniel Scheller 	MXL_HYDRA_MPEG_MODE_SERIAL_4_WIRE = 0, /* MPEG 4 Wire serial mode */
5273c4e0415SDaniel Scheller 	MXL_HYDRA_MPEG_MODE_SERIAL_3_WIRE,     /* MPEG 3 Wire serial mode */
5283c4e0415SDaniel Scheller 	MXL_HYDRA_MPEG_MODE_SERIAL_2_WIRE,     /* MPEG 2 Wire serial mode */
5293c4e0415SDaniel Scheller 	MXL_HYDRA_MPEG_MODE_PARALLEL           /* MPEG parallel mode - valid only for MxL581 */
5303c4e0415SDaniel Scheller };
5313c4e0415SDaniel Scheller 
5323c4e0415SDaniel Scheller enum MXL_HYDRA_MPEG_CLK_TYPE_E {
5333c4e0415SDaniel Scheller 	MXL_HYDRA_MPEG_CLK_CONTINUOUS = 0, /* Continuous MPEG clock */
5343c4e0415SDaniel Scheller 	MXL_HYDRA_MPEG_CLK_GAPPED,         /* Gapped (gated) MPEG clock */
5353c4e0415SDaniel Scheller };
5363c4e0415SDaniel Scheller 
5373c4e0415SDaniel Scheller enum MXL_HYDRA_MPEG_CLK_FMT_E {
5383c4e0415SDaniel Scheller 	MXL_HYDRA_MPEG_ACTIVE_LOW = 0,
5393c4e0415SDaniel Scheller 	MXL_HYDRA_MPEG_ACTIVE_HIGH,
5403c4e0415SDaniel Scheller 
5413c4e0415SDaniel Scheller 	MXL_HYDRA_MPEG_CLK_NEGATIVE = 0,
5423c4e0415SDaniel Scheller 	MXL_HYDRA_MPEG_CLK_POSITIVE,
5433c4e0415SDaniel Scheller 
5443c4e0415SDaniel Scheller 	MXL_HYDRA_MPEG_CLK_IN_PHASE = 0,
5453c4e0415SDaniel Scheller 	MXL_HYDRA_MPEG_CLK_INVERTED,
5463c4e0415SDaniel Scheller };
5473c4e0415SDaniel Scheller 
5483c4e0415SDaniel Scheller enum MXL_HYDRA_MPEG_CLK_PHASE_E {
5493c4e0415SDaniel Scheller 	MXL_HYDRA_MPEG_CLK_PHASE_SHIFT_0_DEG = 0,
5503c4e0415SDaniel Scheller 	MXL_HYDRA_MPEG_CLK_PHASE_SHIFT_90_DEG,
5513c4e0415SDaniel Scheller 	MXL_HYDRA_MPEG_CLK_PHASE_SHIFT_180_DEG,
5523c4e0415SDaniel Scheller 	MXL_HYDRA_MPEG_CLK_PHASE_SHIFT_270_DEG
5533c4e0415SDaniel Scheller };
5543c4e0415SDaniel Scheller 
5553c4e0415SDaniel Scheller enum MXL_HYDRA_MPEG_ERR_INDICATION_E {
5563c4e0415SDaniel Scheller 	MXL_HYDRA_MPEG_ERR_REPLACE_SYNC = 0,
5573c4e0415SDaniel Scheller 	MXL_HYDRA_MPEG_ERR_REPLACE_VALID,
5583c4e0415SDaniel Scheller 	MXL_HYDRA_MPEG_ERR_INDICATION_DISABLED
5593c4e0415SDaniel Scheller };
5603c4e0415SDaniel Scheller 
5613c4e0415SDaniel Scheller struct MXL_HYDRA_MPEGOUT_PARAM_T {
5623c4e0415SDaniel Scheller 	int                                  enable;               /* Enable or Disable MPEG OUT */
5633c4e0415SDaniel Scheller 	enum MXL_HYDRA_MPEG_CLK_TYPE_E       mpeg_clk_type;          /* Continuous or gapped */
5643c4e0415SDaniel Scheller 	enum MXL_HYDRA_MPEG_CLK_FMT_E        mpeg_clk_pol;           /* MPEG Clk polarity */
5653c4e0415SDaniel Scheller 	u8                                   max_mpeg_clk_rate;       /* Max MPEG Clk rate (0 - 104 MHz, 139 MHz) */
5663c4e0415SDaniel Scheller 	enum MXL_HYDRA_MPEG_CLK_PHASE_E      mpeg_clk_phase;         /* MPEG Clk phase */
5673c4e0415SDaniel Scheller 	enum MXL_HYDRA_MPEG_DATA_FMT_E       lsb_or_msb_first;        /* LSB first or MSB first in TS transmission */
5683c4e0415SDaniel Scheller 	enum MXL_HYDRA_MPEG_DATA_FMT_E       mpeg_sync_pulse_width;   /* MPEG SYNC pulse width (1-bit or 1-byte) */
5693c4e0415SDaniel Scheller 	enum MXL_HYDRA_MPEG_CLK_FMT_E        mpeg_valid_pol;         /* MPEG VALID polarity */
5703c4e0415SDaniel Scheller 	enum MXL_HYDRA_MPEG_CLK_FMT_E        mpeg_sync_pol;          /* MPEG SYNC polarity */
5713c4e0415SDaniel Scheller 	enum MXL_HYDRA_MPEG_MODE_E           mpeg_mode;             /* config 4/3/2-wire serial or parallel TS out */
5723c4e0415SDaniel Scheller 	enum MXL_HYDRA_MPEG_ERR_INDICATION_E mpeg_error_indication;  /* Enable or Disable MPEG error indication */
5733c4e0415SDaniel Scheller };
5743c4e0415SDaniel Scheller 
5753c4e0415SDaniel Scheller enum MXL_HYDRA_EXT_TS_IN_ID_E {
5763c4e0415SDaniel Scheller 	MXL_HYDRA_EXT_TS_IN_0 = 0,
5773c4e0415SDaniel Scheller 	MXL_HYDRA_EXT_TS_IN_1,
5783c4e0415SDaniel Scheller 	MXL_HYDRA_EXT_TS_IN_2,
5793c4e0415SDaniel Scheller 	MXL_HYDRA_EXT_TS_IN_3,
5803c4e0415SDaniel Scheller 	MXL_HYDRA_EXT_TS_IN_MAX
5813c4e0415SDaniel Scheller };
5823c4e0415SDaniel Scheller 
5833c4e0415SDaniel Scheller enum MXL_HYDRA_TS_OUT_ID_E {
5843c4e0415SDaniel Scheller 	MXL_HYDRA_TS_OUT_0 = 0,
5853c4e0415SDaniel Scheller 	MXL_HYDRA_TS_OUT_1,
5863c4e0415SDaniel Scheller 	MXL_HYDRA_TS_OUT_2,
5873c4e0415SDaniel Scheller 	MXL_HYDRA_TS_OUT_3,
5883c4e0415SDaniel Scheller 	MXL_HYDRA_TS_OUT_4,
5893c4e0415SDaniel Scheller 	MXL_HYDRA_TS_OUT_5,
5903c4e0415SDaniel Scheller 	MXL_HYDRA_TS_OUT_6,
5913c4e0415SDaniel Scheller 	MXL_HYDRA_TS_OUT_7,
5923c4e0415SDaniel Scheller 	MXL_HYDRA_TS_OUT_MAX
5933c4e0415SDaniel Scheller };
5943c4e0415SDaniel Scheller 
5953c4e0415SDaniel Scheller enum MXL_HYDRA_TS_DRIVE_STRENGTH_E {
5963c4e0415SDaniel Scheller 	MXL_HYDRA_TS_DRIVE_STRENGTH_1X = 0,
5973c4e0415SDaniel Scheller 	MXL_HYDRA_TS_DRIVE_STRENGTH_2X,
5983c4e0415SDaniel Scheller 	MXL_HYDRA_TS_DRIVE_STRENGTH_3X,
5993c4e0415SDaniel Scheller 	MXL_HYDRA_TS_DRIVE_STRENGTH_4X,
6003c4e0415SDaniel Scheller 	MXL_HYDRA_TS_DRIVE_STRENGTH_5X,
6013c4e0415SDaniel Scheller 	MXL_HYDRA_TS_DRIVE_STRENGTH_6X,
6023c4e0415SDaniel Scheller 	MXL_HYDRA_TS_DRIVE_STRENGTH_7X,
6033c4e0415SDaniel Scheller 	MXL_HYDRA_TS_DRIVE_STRENGTH_8X
6043c4e0415SDaniel Scheller };
6053c4e0415SDaniel Scheller 
6063c4e0415SDaniel Scheller enum MXL_HYDRA_DEVICE_E {
6073c4e0415SDaniel Scheller 	MXL_HYDRA_DEVICE_581 = 0,
6083c4e0415SDaniel Scheller 	MXL_HYDRA_DEVICE_584,
6093c4e0415SDaniel Scheller 	MXL_HYDRA_DEVICE_585,
6103c4e0415SDaniel Scheller 	MXL_HYDRA_DEVICE_544,
6113c4e0415SDaniel Scheller 	MXL_HYDRA_DEVICE_561,
6123c4e0415SDaniel Scheller 	MXL_HYDRA_DEVICE_TEST,
6133c4e0415SDaniel Scheller 	MXL_HYDRA_DEVICE_582,
6143c4e0415SDaniel Scheller 	MXL_HYDRA_DEVICE_541,
6153c4e0415SDaniel Scheller 	MXL_HYDRA_DEVICE_568,
6163c4e0415SDaniel Scheller 	MXL_HYDRA_DEVICE_542,
6173c4e0415SDaniel Scheller 	MXL_HYDRA_DEVICE_541S,
6183c4e0415SDaniel Scheller 	MXL_HYDRA_DEVICE_561S,
6193c4e0415SDaniel Scheller 	MXL_HYDRA_DEVICE_581S,
6203c4e0415SDaniel Scheller 	MXL_HYDRA_DEVICE_MAX
6213c4e0415SDaniel Scheller };
6223c4e0415SDaniel Scheller 
6233c4e0415SDaniel Scheller /* Demod IQ data */
6243c4e0415SDaniel Scheller struct MXL_HYDRA_DEMOD_IQ_SRC_T {
6253c4e0415SDaniel Scheller 	u32 demod_id;
6263c4e0415SDaniel Scheller 	u32 source_of_iq; /* == 0, it means I/Q comes from Formatter
6273c4e0415SDaniel Scheller 			 * == 1, Legacy FEC
6283c4e0415SDaniel Scheller 			 * == 2, Frequency Recovery
6293c4e0415SDaniel Scheller 			 * == 3, NBC
6303c4e0415SDaniel Scheller 			 * == 4, CTL
6313c4e0415SDaniel Scheller 			 * == 5, EQ
6323c4e0415SDaniel Scheller 			 * == 6, FPGA
6333c4e0415SDaniel Scheller 			 */
6343c4e0415SDaniel Scheller };
6353c4e0415SDaniel Scheller 
6363c4e0415SDaniel Scheller struct MXL_HYDRA_DEMOD_ABORT_TUNE_T {
6373c4e0415SDaniel Scheller 	u32 demod_id;
6383c4e0415SDaniel Scheller };
6393c4e0415SDaniel Scheller 
6403c4e0415SDaniel Scheller struct MXL_HYDRA_TUNER_CMD {
6413c4e0415SDaniel Scheller 	u8 tuner_id;
6423c4e0415SDaniel Scheller 	u8 enable;
6433c4e0415SDaniel Scheller };
6443c4e0415SDaniel Scheller 
6453c4e0415SDaniel Scheller /* Demod Para for Channel Tune */
6463c4e0415SDaniel Scheller struct MXL_HYDRA_DEMOD_PARAM_T {
6473c4e0415SDaniel Scheller 	u32 tuner_index;
6483c4e0415SDaniel Scheller 	u32 demod_index;
6493c4e0415SDaniel Scheller 	u32 frequency_in_hz;     /* Frequency */
6503c4e0415SDaniel Scheller 	u32 standard;          /* one of MXL_HYDRA_BCAST_STD_E */
6513c4e0415SDaniel Scheller 	u32 spectrum_inversion; /* Input : Spectrum inversion. */
6523c4e0415SDaniel Scheller 	u32 roll_off;           /* rollOff (alpha) factor */
6533c4e0415SDaniel Scheller 	u32 symbol_rate_in_hz;    /* Symbol rate */
6543c4e0415SDaniel Scheller 	u32 pilots;            /* TRUE = pilots enabled */
6553c4e0415SDaniel Scheller 	u32 modulation_scheme;  /* Input : Modulation Scheme is one of MXL_HYDRA_MODULATION_E */
6563c4e0415SDaniel Scheller 	u32 fec_code_rate;       /* Input : Forward error correction rate. Is one of MXL_HYDRA_FEC_E */
6573c4e0415SDaniel Scheller 	u32 max_carrier_offset_in_mhz; /* Maximum carrier freq offset in MHz. Same as freqSearchRangeKHz, but in unit of MHz. */
6583c4e0415SDaniel Scheller };
6593c4e0415SDaniel Scheller 
6603c4e0415SDaniel Scheller struct MXL_HYDRA_DEMOD_SCRAMBLE_CODE_T {
6613c4e0415SDaniel Scheller 	u32 demod_index;
6623c4e0415SDaniel Scheller 	u8 scramble_sequence[12]; /* scramble sequence */
6633c4e0415SDaniel Scheller 	u32 scramble_code; /* scramble gold code */
6643c4e0415SDaniel Scheller };
6653c4e0415SDaniel Scheller 
6663c4e0415SDaniel Scheller struct MXL_INTR_CFG_T {
6673c4e0415SDaniel Scheller 	u32 intr_type;
6683c4e0415SDaniel Scheller 	u32 intr_duration_in_nano_secs;
6693c4e0415SDaniel Scheller 	u32 intr_mask;
6703c4e0415SDaniel Scheller };
6713c4e0415SDaniel Scheller 
6723c4e0415SDaniel Scheller struct MXL_HYDRA_POWER_MODE_CMD {
6733c4e0415SDaniel Scheller 	u8 power_mode; /* enumeration values are defined in MXL_HYDRA_PWR_MODE_E (device API.h) */
6743c4e0415SDaniel Scheller };
6753c4e0415SDaniel Scheller 
6763c4e0415SDaniel Scheller struct MXL_HYDRA_RF_WAKEUP_PARAM_T {
6773c4e0415SDaniel Scheller 	u32 time_interval_in_seconds; /* in seconds */
6783c4e0415SDaniel Scheller 	u32 tuner_index;
6793c4e0415SDaniel Scheller 	s32 rssi_threshold;
6803c4e0415SDaniel Scheller };
6813c4e0415SDaniel Scheller 
6823c4e0415SDaniel Scheller struct MXL_HYDRA_RF_WAKEUP_CFG_T {
6833c4e0415SDaniel Scheller 	u32 tuner_count;
6843c4e0415SDaniel Scheller 	struct MXL_HYDRA_RF_WAKEUP_PARAM_T params;
6853c4e0415SDaniel Scheller };
6863c4e0415SDaniel Scheller 
6873c4e0415SDaniel Scheller enum MXL_HYDRA_AUX_CTRL_MODE_E {
6883c4e0415SDaniel Scheller 	MXL_HYDRA_AUX_CTRL_MODE_FSK = 0, /* Select FSK controller */
6893c4e0415SDaniel Scheller 	MXL_HYDRA_AUX_CTRL_MODE_DISEQC,  /* Select DiSEqC controller */
6903c4e0415SDaniel Scheller };
6913c4e0415SDaniel Scheller 
6923c4e0415SDaniel Scheller enum MXL_HYDRA_DISEQC_OPMODE_E {
6933c4e0415SDaniel Scheller 	MXL_HYDRA_DISEQC_ENVELOPE_MODE = 0,
6943c4e0415SDaniel Scheller 	MXL_HYDRA_DISEQC_TONE_MODE,
6953c4e0415SDaniel Scheller };
6963c4e0415SDaniel Scheller 
6973c4e0415SDaniel Scheller enum MXL_HYDRA_DISEQC_VER_E {
6983c4e0415SDaniel Scheller 	MXL_HYDRA_DISEQC_1_X = 0, /* Config DiSEqC 1.x mode */
6993c4e0415SDaniel Scheller 	MXL_HYDRA_DISEQC_2_X, /* Config DiSEqC 2.x mode */
7003c4e0415SDaniel Scheller 	MXL_HYDRA_DISEQC_DISABLE /* Disable DiSEqC */
7013c4e0415SDaniel Scheller };
7023c4e0415SDaniel Scheller 
7033c4e0415SDaniel Scheller enum MXL_HYDRA_DISEQC_CARRIER_FREQ_E {
7043c4e0415SDaniel Scheller 	MXL_HYDRA_DISEQC_CARRIER_FREQ_22KHZ = 0, /* DiSEqC signal frequency of 22 KHz */
7053c4e0415SDaniel Scheller 	MXL_HYDRA_DISEQC_CARRIER_FREQ_33KHZ,     /* DiSEqC signal frequency of 33 KHz */
7063c4e0415SDaniel Scheller 	MXL_HYDRA_DISEQC_CARRIER_FREQ_44KHZ      /* DiSEqC signal frequency of 44 KHz */
7073c4e0415SDaniel Scheller };
7083c4e0415SDaniel Scheller 
7093c4e0415SDaniel Scheller enum MXL_HYDRA_DISEQC_ID_E {
7103c4e0415SDaniel Scheller 	MXL_HYDRA_DISEQC_ID_0 = 0,
7113c4e0415SDaniel Scheller 	MXL_HYDRA_DISEQC_ID_1,
7123c4e0415SDaniel Scheller 	MXL_HYDRA_DISEQC_ID_2,
7133c4e0415SDaniel Scheller 	MXL_HYDRA_DISEQC_ID_3
7143c4e0415SDaniel Scheller };
7153c4e0415SDaniel Scheller 
7163c4e0415SDaniel Scheller enum MXL_HYDRA_FSK_OP_MODE_E {
7173c4e0415SDaniel Scheller 	MXL_HYDRA_FSK_CFG_TYPE_39KPBS = 0, /* 39.0kbps */
7183c4e0415SDaniel Scheller 	MXL_HYDRA_FSK_CFG_TYPE_39_017KPBS, /* 39.017kbps */
7193c4e0415SDaniel Scheller 	MXL_HYDRA_FSK_CFG_TYPE_115_2KPBS   /* 115.2kbps */
7203c4e0415SDaniel Scheller };
7213c4e0415SDaniel Scheller 
7223c4e0415SDaniel Scheller struct MXL58X_DSQ_OP_MODE_T {
7233c4e0415SDaniel Scheller 	u32 diseqc_id; /* DSQ 0, 1, 2 or 3 */
7243c4e0415SDaniel Scheller 	u32 op_mode; /* Envelope mode (0) or internal tone mode (1) */
7253c4e0415SDaniel Scheller 	u32 version; /* 0: 1.0, 1: 1.1, 2: Disable */
7263c4e0415SDaniel Scheller 	u32 center_freq; /* 0: 22KHz, 1: 33KHz and 2: 44 KHz */
7273c4e0415SDaniel Scheller };
7283c4e0415SDaniel Scheller 
7293c4e0415SDaniel Scheller struct MXL_HYDRA_DISEQC_CFG_CONT_TONE_T {
7303c4e0415SDaniel Scheller 	u32 diseqc_id;
7313c4e0415SDaniel Scheller 	u32 cont_tone_flag; /* 1: Enable , 0: Disable */
7323c4e0415SDaniel Scheller };
733