Steven Toth | 52c99bd | 2008-05-01 04:57:01 -0300 | [diff] [blame] | 1 | /* |
Steven Toth | 7f5c3af | 2008-05-01 06:51:36 -0300 | [diff] [blame^] | 2 | MaxLinear MXL5005S VSB/QAM/DVBT tuner driver |
| 3 | |
| 4 | Copyright (C) 2008 MaxLinear |
| 5 | Copyright (C) 2006 Steven Toth <stoth@hauppauge.com> |
| 6 | Functions: |
| 7 | mxl5005s_reset() |
| 8 | mxl5005s_writereg() |
| 9 | mxl5005s_writeregs() |
| 10 | mxl5005s_init() |
| 11 | mxl5005s_reconfigure() |
| 12 | mxl5005s_AssignTunerMode() |
| 13 | mxl5005s_set_params() |
| 14 | mxl5005s_get_frequency() |
| 15 | mxl5005s_get_bandwidth() |
| 16 | mxl5005s_release() |
| 17 | mxl5005s_attach() |
| 18 | |
| 19 | Copyright (c) 2008 Realtek |
| 20 | Copyright (c) 2008 Jan Hoogenraad, Barnaby Shearer, Andy Hasper |
| 21 | Functions: |
| 22 | mxl5005s_SetRfFreqHz() |
| 23 | |
| 24 | This program is free software; you can redistribute it and/or modify |
| 25 | it under the terms of the GNU General Public License as published by |
| 26 | the Free Software Foundation; either version 2 of the License, or |
| 27 | (at your option) any later version. |
| 28 | |
| 29 | This program is distributed in the hope that it will be useful, |
| 30 | but WITHOUT ANY WARRANTY; without even the implied warranty of |
| 31 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
| 32 | GNU General Public License for more details. |
| 33 | |
| 34 | You should have received a copy of the GNU General Public License |
| 35 | along with this program; if not, write to the Free Software |
| 36 | Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. |
| 37 | |
| 38 | */ |
| 39 | |
| 40 | /* |
| 41 | History of this driver (Steven Toth): |
| 42 | I was given a public release of a linux driver that included |
| 43 | support for the MaxLinear MXL5005S silicon tuner. Analysis of |
| 44 | the tuner driver showed clearly three things. |
| 45 | |
| 46 | 1. The tuner driver didn't support the LinuxTV tuner API |
| 47 | so the code Realtek added had to be removed. |
| 48 | |
| 49 | 2. A significant amount of the driver is reference driver code |
| 50 | from MaxLinear, I felt it was important to identify and |
| 51 | preserve this. |
| 52 | |
| 53 | 3. New code has to be added to interface correctly with the |
| 54 | LinuxTV API, as a regular kernel module. |
| 55 | |
| 56 | Other than the reference driver enum's, I've clearly marked |
| 57 | sections of the code and retained the copyright of the |
| 58 | respective owners. |
| 59 | */ |
Steven Toth | 52c99bd | 2008-05-01 04:57:01 -0300 | [diff] [blame] | 60 | |
Steven Toth | 2637d5b | 2008-05-01 05:01:31 -0300 | [diff] [blame] | 61 | #include "mxl5005s.h" |
Steven Toth | 52c99bd | 2008-05-01 04:57:01 -0300 | [diff] [blame] | 62 | |
Steven Toth | 8c66a19 | 2008-05-01 06:35:48 -0300 | [diff] [blame] | 63 | static int debug = 2; |
Steven Toth | 85d220d | 2008-05-01 05:48:14 -0300 | [diff] [blame] | 64 | |
| 65 | #define dprintk(level, arg...) do { \ |
Steven Toth | 8c66a19 | 2008-05-01 06:35:48 -0300 | [diff] [blame] | 66 | if (level <= debug) \ |
Steven Toth | 85d220d | 2008-05-01 05:48:14 -0300 | [diff] [blame] | 67 | printk(arg); \ |
| 68 | } while (0) |
| 69 | |
| 70 | #define TUNER_REGS_NUM 104 |
| 71 | #define INITCTRL_NUM 40 |
| 72 | |
| 73 | #ifdef _MXL_PRODUCTION |
| 74 | #define CHCTRL_NUM 39 |
| 75 | #else |
| 76 | #define CHCTRL_NUM 36 |
| 77 | #endif |
| 78 | |
| 79 | #define MXLCTRL_NUM 189 |
| 80 | #define MASTER_CONTROL_ADDR 9 |
| 81 | |
Steven Toth | 85d220d | 2008-05-01 05:48:14 -0300 | [diff] [blame] | 82 | /* Enumeration of Master Control Register State */ |
| 83 | typedef enum |
| 84 | { |
| 85 | MC_LOAD_START = 1, |
| 86 | MC_POWER_DOWN, |
| 87 | MC_SYNTH_RESET, |
| 88 | MC_SEQ_OFF |
| 89 | } Master_Control_State; |
| 90 | |
Steven Toth | 85d220d | 2008-05-01 05:48:14 -0300 | [diff] [blame] | 91 | /* Enumeration of MXL5005 Tuner Modulation Type */ |
| 92 | typedef enum |
| 93 | { |
| 94 | MXL_DEFAULT_MODULATION = 0, |
| 95 | MXL_DVBT, |
| 96 | MXL_ATSC, |
| 97 | MXL_QAM, |
| 98 | MXL_ANALOG_CABLE, |
| 99 | MXL_ANALOG_OTA |
| 100 | } Tuner_Modu_Type; |
| 101 | |
Steven Toth | 85d220d | 2008-05-01 05:48:14 -0300 | [diff] [blame] | 102 | /* MXL5005 Tuner Register Struct */ |
| 103 | typedef struct _TunerReg_struct |
| 104 | { |
| 105 | u16 Reg_Num; /* Tuner Register Address */ |
| 106 | u16 Reg_Val; /* Current sofware programmed value waiting to be writen */ |
| 107 | } TunerReg_struct; |
| 108 | |
| 109 | typedef enum |
| 110 | { |
| 111 | /* Initialization Control Names */ |
| 112 | DN_IQTN_AMP_CUT = 1, /* 1 */ |
| 113 | BB_MODE, /* 2 */ |
| 114 | BB_BUF, /* 3 */ |
| 115 | BB_BUF_OA, /* 4 */ |
| 116 | BB_ALPF_BANDSELECT, /* 5 */ |
| 117 | BB_IQSWAP, /* 6 */ |
| 118 | BB_DLPF_BANDSEL, /* 7 */ |
| 119 | RFSYN_CHP_GAIN, /* 8 */ |
| 120 | RFSYN_EN_CHP_HIGAIN, /* 9 */ |
| 121 | AGC_IF, /* 10 */ |
| 122 | AGC_RF, /* 11 */ |
| 123 | IF_DIVVAL, /* 12 */ |
| 124 | IF_VCO_BIAS, /* 13 */ |
| 125 | CHCAL_INT_MOD_IF, /* 14 */ |
| 126 | CHCAL_FRAC_MOD_IF, /* 15 */ |
| 127 | DRV_RES_SEL, /* 16 */ |
| 128 | I_DRIVER, /* 17 */ |
| 129 | EN_AAF, /* 18 */ |
| 130 | EN_3P, /* 19 */ |
| 131 | EN_AUX_3P, /* 20 */ |
| 132 | SEL_AAF_BAND, /* 21 */ |
| 133 | SEQ_ENCLK16_CLK_OUT, /* 22 */ |
| 134 | SEQ_SEL4_16B, /* 23 */ |
| 135 | XTAL_CAPSELECT, /* 24 */ |
| 136 | IF_SEL_DBL, /* 25 */ |
| 137 | RFSYN_R_DIV, /* 26 */ |
| 138 | SEQ_EXTSYNTHCALIF, /* 27 */ |
| 139 | SEQ_EXTDCCAL, /* 28 */ |
| 140 | AGC_EN_RSSI, /* 29 */ |
| 141 | RFA_ENCLKRFAGC, /* 30 */ |
| 142 | RFA_RSSI_REFH, /* 31 */ |
| 143 | RFA_RSSI_REF, /* 32 */ |
| 144 | RFA_RSSI_REFL, /* 33 */ |
| 145 | RFA_FLR, /* 34 */ |
| 146 | RFA_CEIL, /* 35 */ |
| 147 | SEQ_EXTIQFSMPULSE, /* 36 */ |
| 148 | OVERRIDE_1, /* 37 */ |
| 149 | BB_INITSTATE_DLPF_TUNE, /* 38 */ |
| 150 | TG_R_DIV, /* 39 */ |
| 151 | EN_CHP_LIN_B, /* 40 */ |
| 152 | |
| 153 | /* Channel Change Control Names */ |
| 154 | DN_POLY = 51, /* 51 */ |
| 155 | DN_RFGAIN, /* 52 */ |
| 156 | DN_CAP_RFLPF, /* 53 */ |
| 157 | DN_EN_VHFUHFBAR, /* 54 */ |
| 158 | DN_GAIN_ADJUST, /* 55 */ |
| 159 | DN_IQTNBUF_AMP, /* 56 */ |
| 160 | DN_IQTNGNBFBIAS_BST, /* 57 */ |
| 161 | RFSYN_EN_OUTMUX, /* 58 */ |
| 162 | RFSYN_SEL_VCO_OUT, /* 59 */ |
| 163 | RFSYN_SEL_VCO_HI, /* 60 */ |
| 164 | RFSYN_SEL_DIVM, /* 61 */ |
| 165 | RFSYN_RF_DIV_BIAS, /* 62 */ |
| 166 | DN_SEL_FREQ, /* 63 */ |
| 167 | RFSYN_VCO_BIAS, /* 64 */ |
| 168 | CHCAL_INT_MOD_RF, /* 65 */ |
| 169 | CHCAL_FRAC_MOD_RF, /* 66 */ |
| 170 | RFSYN_LPF_R, /* 67 */ |
| 171 | CHCAL_EN_INT_RF, /* 68 */ |
| 172 | TG_LO_DIVVAL, /* 69 */ |
| 173 | TG_LO_SELVAL, /* 70 */ |
| 174 | TG_DIV_VAL, /* 71 */ |
| 175 | TG_VCO_BIAS, /* 72 */ |
| 176 | SEQ_EXTPOWERUP, /* 73 */ |
| 177 | OVERRIDE_2, /* 74 */ |
| 178 | OVERRIDE_3, /* 75 */ |
| 179 | OVERRIDE_4, /* 76 */ |
| 180 | SEQ_FSM_PULSE, /* 77 */ |
| 181 | GPIO_4B, /* 78 */ |
| 182 | GPIO_3B, /* 79 */ |
| 183 | GPIO_4, /* 80 */ |
| 184 | GPIO_3, /* 81 */ |
| 185 | GPIO_1B, /* 82 */ |
| 186 | DAC_A_ENABLE, /* 83 */ |
| 187 | DAC_B_ENABLE, /* 84 */ |
| 188 | DAC_DIN_A, /* 85 */ |
| 189 | DAC_DIN_B, /* 86 */ |
| 190 | #ifdef _MXL_PRODUCTION |
| 191 | RFSYN_EN_DIV, /* 87 */ |
| 192 | RFSYN_DIVM, /* 88 */ |
| 193 | DN_BYPASS_AGC_I2C /* 89 */ |
| 194 | #endif |
| 195 | } MXL5005_ControlName; |
| 196 | |
| 197 | /* |
| 198 | * The following context is source code provided by MaxLinear. |
| 199 | * MaxLinear source code - Common_MXL.h (?) |
| 200 | */ |
| 201 | |
| 202 | /* Constants */ |
| 203 | #define MXL5005S_REG_WRITING_TABLE_LEN_MAX 104 |
| 204 | #define MXL5005S_LATCH_BYTE 0xfe |
| 205 | |
| 206 | /* Register address, MSB, and LSB */ |
| 207 | #define MXL5005S_BB_IQSWAP_ADDR 59 |
| 208 | #define MXL5005S_BB_IQSWAP_MSB 0 |
| 209 | #define MXL5005S_BB_IQSWAP_LSB 0 |
| 210 | |
| 211 | #define MXL5005S_BB_DLPF_BANDSEL_ADDR 53 |
| 212 | #define MXL5005S_BB_DLPF_BANDSEL_MSB 4 |
| 213 | #define MXL5005S_BB_DLPF_BANDSEL_LSB 3 |
| 214 | |
| 215 | /* Standard modes */ |
| 216 | enum |
| 217 | { |
| 218 | MXL5005S_STANDARD_DVBT, |
| 219 | MXL5005S_STANDARD_ATSC, |
| 220 | }; |
| 221 | #define MXL5005S_STANDARD_MODE_NUM 2 |
| 222 | |
| 223 | /* Bandwidth modes */ |
| 224 | enum |
| 225 | { |
| 226 | MXL5005S_BANDWIDTH_6MHZ = 6000000, |
| 227 | MXL5005S_BANDWIDTH_7MHZ = 7000000, |
| 228 | MXL5005S_BANDWIDTH_8MHZ = 8000000, |
| 229 | }; |
| 230 | #define MXL5005S_BANDWIDTH_MODE_NUM 3 |
| 231 | |
Steven Toth | 3935c25 | 2008-05-01 05:45:44 -0300 | [diff] [blame] | 232 | /* MXL5005 Tuner Control Struct */ |
| 233 | typedef struct _TunerControl_struct { |
| 234 | u16 Ctrl_Num; /* Control Number */ |
| 235 | u16 size; /* Number of bits to represent Value */ |
| 236 | u16 addr[25]; /* Array of Tuner Register Address for each bit position */ |
| 237 | u16 bit[25]; /* Array of bit position in Register Address for each bit position */ |
| 238 | u16 val[25]; /* Binary representation of Value */ |
| 239 | } TunerControl_struct; |
Steven Toth | 52c99bd | 2008-05-01 04:57:01 -0300 | [diff] [blame] | 240 | |
Steven Toth | 3935c25 | 2008-05-01 05:45:44 -0300 | [diff] [blame] | 241 | /* MXL5005 Tuner Struct */ |
| 242 | struct mxl5005s_state |
Steven Toth | 52c99bd | 2008-05-01 04:57:01 -0300 | [diff] [blame] | 243 | { |
Steven Toth | 3935c25 | 2008-05-01 05:45:44 -0300 | [diff] [blame] | 244 | u8 Mode; /* 0: Analog Mode ; 1: Digital Mode */ |
| 245 | u8 IF_Mode; /* for Analog Mode, 0: zero IF; 1: low IF */ |
| 246 | u32 Chan_Bandwidth; /* filter channel bandwidth (6, 7, 8) */ |
| 247 | u32 IF_OUT; /* Desired IF Out Frequency */ |
| 248 | u16 IF_OUT_LOAD; /* IF Out Load Resistor (200/300 Ohms) */ |
| 249 | u32 RF_IN; /* RF Input Frequency */ |
| 250 | u32 Fxtal; /* XTAL Frequency */ |
| 251 | u8 AGC_Mode; /* AGC Mode 0: Dual AGC; 1: Single AGC */ |
| 252 | u16 TOP; /* Value: take over point */ |
| 253 | u8 CLOCK_OUT; /* 0: turn off clock out; 1: turn on clock out */ |
| 254 | u8 DIV_OUT; /* 4MHz or 16MHz */ |
| 255 | u8 CAPSELECT; /* 0: disable On-Chip pulling cap; 1: enable */ |
| 256 | u8 EN_RSSI; /* 0: disable RSSI; 1: enable RSSI */ |
| 257 | u8 Mod_Type; /* Modulation Type; */ |
| 258 | /* 0 - Default; 1 - DVB-T; 2 - ATSC; 3 - QAM; 4 - Analog Cable */ |
| 259 | u8 TF_Type; /* Tracking Filter Type */ |
| 260 | /* 0 - Default; 1 - Off; 2 - Type C; 3 - Type C-H */ |
Steven Toth | 52c99bd | 2008-05-01 04:57:01 -0300 | [diff] [blame] | 261 | |
Steven Toth | 3935c25 | 2008-05-01 05:45:44 -0300 | [diff] [blame] | 262 | /* Calculated Settings */ |
| 263 | u32 RF_LO; /* Synth RF LO Frequency */ |
| 264 | u32 IF_LO; /* Synth IF LO Frequency */ |
| 265 | u32 TG_LO; /* Synth TG_LO Frequency */ |
Steven Toth | 52c99bd | 2008-05-01 04:57:01 -0300 | [diff] [blame] | 266 | |
Steven Toth | 3935c25 | 2008-05-01 05:45:44 -0300 | [diff] [blame] | 267 | /* Pointers to ControlName Arrays */ |
| 268 | u16 Init_Ctrl_Num; /* Number of INIT Control Names */ |
| 269 | TunerControl_struct |
| 270 | Init_Ctrl[INITCTRL_NUM]; /* INIT Control Names Array Pointer */ |
Steven Toth | 52c99bd | 2008-05-01 04:57:01 -0300 | [diff] [blame] | 271 | |
Steven Toth | 3935c25 | 2008-05-01 05:45:44 -0300 | [diff] [blame] | 272 | u16 CH_Ctrl_Num; /* Number of CH Control Names */ |
| 273 | TunerControl_struct |
| 274 | CH_Ctrl[CHCTRL_NUM]; /* CH Control Name Array Pointer */ |
Steven Toth | 52c99bd | 2008-05-01 04:57:01 -0300 | [diff] [blame] | 275 | |
Steven Toth | 3935c25 | 2008-05-01 05:45:44 -0300 | [diff] [blame] | 276 | u16 MXL_Ctrl_Num; /* Number of MXL Control Names */ |
| 277 | TunerControl_struct |
| 278 | MXL_Ctrl[MXLCTRL_NUM]; /* MXL Control Name Array Pointer */ |
Steven Toth | 52c99bd | 2008-05-01 04:57:01 -0300 | [diff] [blame] | 279 | |
Steven Toth | 3935c25 | 2008-05-01 05:45:44 -0300 | [diff] [blame] | 280 | /* Pointer to Tuner Register Array */ |
| 281 | u16 TunerRegs_Num; /* Number of Tuner Registers */ |
| 282 | TunerReg_struct |
| 283 | TunerRegs[TUNER_REGS_NUM]; /* Tuner Register Array Pointer */ |
Steven Toth | 52c99bd | 2008-05-01 04:57:01 -0300 | [diff] [blame] | 284 | |
Steven Toth | 85d220d | 2008-05-01 05:48:14 -0300 | [diff] [blame] | 285 | /* Linux driver framework specific */ |
Steven Toth | 8c66a19 | 2008-05-01 06:35:48 -0300 | [diff] [blame] | 286 | struct mxl5005s_config *config; |
Steven Toth | 85d220d | 2008-05-01 05:48:14 -0300 | [diff] [blame] | 287 | struct dvb_frontend *frontend; |
| 288 | struct i2c_adapter *i2c; |
Steven Toth | 7f5c3af | 2008-05-01 06:51:36 -0300 | [diff] [blame^] | 289 | |
| 290 | /* Cache values */ |
| 291 | u32 current_mode; |
| 292 | |
Steven Toth | 3935c25 | 2008-05-01 05:45:44 -0300 | [diff] [blame] | 293 | }; |
Steven Toth | 52c99bd | 2008-05-01 04:57:01 -0300 | [diff] [blame] | 294 | |
Steven Toth | 85d220d | 2008-05-01 05:48:14 -0300 | [diff] [blame] | 295 | u16 MXL_ControlWrite(struct dvb_frontend *fe, u16 ControlNum, u32 value); |
| 296 | u16 MXL_ControlRead(struct dvb_frontend *fe, u16 controlNum, u32 *value); |
| 297 | u16 MXL_GetMasterControl(u8 *MasterReg, int state); |
| 298 | void MXL_RegWriteBit(struct dvb_frontend *fe, u8 address, u8 bit, u8 bitVal); |
| 299 | u16 MXL_GetCHRegister(struct dvb_frontend *fe, u8 *RegNum, u8 *RegVal, int *count); |
| 300 | u32 MXL_Ceiling(u32 value, u32 resolution); |
| 301 | u16 MXL_RegRead(struct dvb_frontend *fe, u8 RegNum, u8 *RegVal); |
| 302 | u16 MXL_RegWrite(struct dvb_frontend *fe, u8 RegNum, u8 RegVal); |
| 303 | u16 MXL_ControlWrite_Group(struct dvb_frontend *fe, u16 controlNum, u32 value, u16 controlGroup); |
| 304 | u16 MXL_SetGPIO(struct dvb_frontend *fe, u8 GPIO_Num, u8 GPIO_Val); |
| 305 | u16 MXL_GetInitRegister(struct dvb_frontend *fe, u8 * RegNum, u8 *RegVal, int *count); |
| 306 | u32 MXL_GetXtalInt(u32 Xtal_Freq); |
| 307 | u16 MXL_TuneRF(struct dvb_frontend *fe, u32 RF_Freq); |
| 308 | void MXL_SynthIFLO_Calc(struct dvb_frontend *fe); |
| 309 | void MXL_SynthRFTGLO_Calc(struct dvb_frontend *fe); |
| 310 | u16 MXL_GetCHRegister_ZeroIF(struct dvb_frontend *fe, u8 *RegNum, u8 *RegVal, int *count); |
Steven Toth | 7f5c3af | 2008-05-01 06:51:36 -0300 | [diff] [blame^] | 311 | int mxl5005s_writeregs(struct dvb_frontend *fe, u8 *addrtable, u8 *datatable, u8 len); |
Steven Toth | 85d220d | 2008-05-01 05:48:14 -0300 | [diff] [blame] | 312 | u16 MXL_IFSynthInit(struct dvb_frontend *fe); |
Steven Toth | 7f5c3af | 2008-05-01 06:51:36 -0300 | [diff] [blame^] | 313 | int mxl5005s_AssignTunerMode(struct dvb_frontend *fe, u32 mod_type, u32 bandwidth); |
| 314 | int mxl5005s_reconfigure(struct dvb_frontend *fe, u32 mod_type, u32 bandwidth); |
| 315 | |
| 316 | /* ---------------------------------------------------------------- |
| 317 | * Begin: Custom code salvaged from the Realtek driver. |
| 318 | * Copyright (c) 2008 Realtek |
| 319 | * Copyright (c) 2008 Jan Hoogenraad, Barnaby Shearer, Andy Hasper |
| 320 | * This code is placed under the terms of the GNU General Public License |
| 321 | * |
| 322 | * Released by Realtek under GPLv2. |
| 323 | * Thanks to Realtek for a lot of support we received ! |
| 324 | * |
| 325 | * Revision: 080314 - original version |
| 326 | */ |
Steven Toth | 52c99bd | 2008-05-01 04:57:01 -0300 | [diff] [blame] | 327 | |
Steven Toth | 85d220d | 2008-05-01 05:48:14 -0300 | [diff] [blame] | 328 | int mxl5005s_SetRfFreqHz(struct dvb_frontend *fe, unsigned long RfFreqHz) |
Steven Toth | 52c99bd | 2008-05-01 04:57:01 -0300 | [diff] [blame] | 329 | { |
Steven Toth | 85d220d | 2008-05-01 05:48:14 -0300 | [diff] [blame] | 330 | struct mxl5005s_state *state = fe->tuner_priv; |
Steven Toth | 52c99bd | 2008-05-01 04:57:01 -0300 | [diff] [blame] | 331 | unsigned char AddrTable[MXL5005S_REG_WRITING_TABLE_LEN_MAX]; |
| 332 | unsigned char ByteTable[MXL5005S_REG_WRITING_TABLE_LEN_MAX]; |
| 333 | int TableLen; |
| 334 | |
Steven Toth | 85d220d | 2008-05-01 05:48:14 -0300 | [diff] [blame] | 335 | u32 IfDivval; |
Steven Toth | 52c99bd | 2008-05-01 04:57:01 -0300 | [diff] [blame] | 336 | unsigned char MasterControlByte; |
| 337 | |
Steven Toth | 85d220d | 2008-05-01 05:48:14 -0300 | [diff] [blame] | 338 | dprintk(1, "%s() freq=%ld\n", __func__, RfFreqHz); |
Steven Toth | 52c99bd | 2008-05-01 04:57:01 -0300 | [diff] [blame] | 339 | |
| 340 | // Set MxL5005S tuner RF frequency according to MxL5005S tuner example code. |
| 341 | |
| 342 | // Tuner RF frequency setting stage 0 |
| 343 | MXL_GetMasterControl(ByteTable, MC_SYNTH_RESET) ; |
| 344 | AddrTable[0] = MASTER_CONTROL_ADDR; |
Steven Toth | 85d220d | 2008-05-01 05:48:14 -0300 | [diff] [blame] | 345 | ByteTable[0] |= state->config->AgcMasterByte; |
Steven Toth | 52c99bd | 2008-05-01 04:57:01 -0300 | [diff] [blame] | 346 | |
Steven Toth | 7f5c3af | 2008-05-01 06:51:36 -0300 | [diff] [blame^] | 347 | mxl5005s_writeregs(fe, AddrTable, ByteTable, 1); |
Steven Toth | 52c99bd | 2008-05-01 04:57:01 -0300 | [diff] [blame] | 348 | |
| 349 | // Tuner RF frequency setting stage 1 |
Steven Toth | 85d220d | 2008-05-01 05:48:14 -0300 | [diff] [blame] | 350 | MXL_TuneRF(fe, RfFreqHz); |
Steven Toth | 52c99bd | 2008-05-01 04:57:01 -0300 | [diff] [blame] | 351 | |
Steven Toth | 85d220d | 2008-05-01 05:48:14 -0300 | [diff] [blame] | 352 | MXL_ControlRead(fe, IF_DIVVAL, &IfDivval); |
Steven Toth | 52c99bd | 2008-05-01 04:57:01 -0300 | [diff] [blame] | 353 | |
Steven Toth | 85d220d | 2008-05-01 05:48:14 -0300 | [diff] [blame] | 354 | MXL_ControlWrite(fe, SEQ_FSM_PULSE, 0); |
| 355 | MXL_ControlWrite(fe, SEQ_EXTPOWERUP, 1); |
| 356 | MXL_ControlWrite(fe, IF_DIVVAL, 8); |
| 357 | MXL_GetCHRegister(fe, AddrTable, ByteTable, &TableLen) ; |
Steven Toth | 52c99bd | 2008-05-01 04:57:01 -0300 | [diff] [blame] | 358 | |
| 359 | MXL_GetMasterControl(&MasterControlByte, MC_LOAD_START) ; |
| 360 | AddrTable[TableLen] = MASTER_CONTROL_ADDR ; |
Steven Toth | 8c66a19 | 2008-05-01 06:35:48 -0300 | [diff] [blame] | 361 | ByteTable[TableLen] = MasterControlByte | state->config->AgcMasterByte; |
Steven Toth | 52c99bd | 2008-05-01 04:57:01 -0300 | [diff] [blame] | 362 | TableLen += 1; |
| 363 | |
Steven Toth | 7f5c3af | 2008-05-01 06:51:36 -0300 | [diff] [blame^] | 364 | mxl5005s_writeregs(fe, AddrTable, ByteTable, TableLen); |
Steven Toth | 52c99bd | 2008-05-01 04:57:01 -0300 | [diff] [blame] | 365 | |
| 366 | // Wait 30 ms. |
Steven Toth | 8c66a19 | 2008-05-01 06:35:48 -0300 | [diff] [blame] | 367 | msleep(150); |
Steven Toth | 52c99bd | 2008-05-01 04:57:01 -0300 | [diff] [blame] | 368 | |
| 369 | // Tuner RF frequency setting stage 2 |
Steven Toth | 85d220d | 2008-05-01 05:48:14 -0300 | [diff] [blame] | 370 | MXL_ControlWrite(fe, SEQ_FSM_PULSE, 1) ; |
| 371 | MXL_ControlWrite(fe, IF_DIVVAL, IfDivval) ; |
| 372 | MXL_GetCHRegister_ZeroIF(fe, AddrTable, ByteTable, &TableLen) ; |
Steven Toth | 52c99bd | 2008-05-01 04:57:01 -0300 | [diff] [blame] | 373 | |
| 374 | MXL_GetMasterControl(&MasterControlByte, MC_LOAD_START) ; |
| 375 | AddrTable[TableLen] = MASTER_CONTROL_ADDR ; |
Steven Toth | 8c66a19 | 2008-05-01 06:35:48 -0300 | [diff] [blame] | 376 | ByteTable[TableLen] = MasterControlByte | state->config->AgcMasterByte ; |
Steven Toth | 52c99bd | 2008-05-01 04:57:01 -0300 | [diff] [blame] | 377 | TableLen += 1; |
| 378 | |
Steven Toth | 7f5c3af | 2008-05-01 06:51:36 -0300 | [diff] [blame^] | 379 | mxl5005s_writeregs(fe, AddrTable, ByteTable, TableLen); |
Steven Toth | 52c99bd | 2008-05-01 04:57:01 -0300 | [diff] [blame] | 380 | |
Steven Toth | 8c66a19 | 2008-05-01 06:35:48 -0300 | [diff] [blame] | 381 | msleep(100); |
| 382 | |
Steven Toth | 85d220d | 2008-05-01 05:48:14 -0300 | [diff] [blame] | 383 | return 0; |
Steven Toth | 52c99bd | 2008-05-01 04:57:01 -0300 | [diff] [blame] | 384 | } |
Steven Toth | 7f5c3af | 2008-05-01 06:51:36 -0300 | [diff] [blame^] | 385 | /* End: Custom code taken from the Realtek driver */ |
Steven Toth | 52c99bd | 2008-05-01 04:57:01 -0300 | [diff] [blame] | 386 | |
Steven Toth | 7f5c3af | 2008-05-01 06:51:36 -0300 | [diff] [blame^] | 387 | /* ---------------------------------------------------------------- |
| 388 | * Begin: Reference driver code found in the Realtek driver. |
| 389 | * Copyright (c) 2008 MaxLinear |
| 390 | */ |
Steven Toth | 3935c25 | 2008-05-01 05:45:44 -0300 | [diff] [blame] | 391 | u16 MXL5005_RegisterInit(struct dvb_frontend *fe) |
Steven Toth | 52c99bd | 2008-05-01 04:57:01 -0300 | [diff] [blame] | 392 | { |
Steven Toth | 85d220d | 2008-05-01 05:48:14 -0300 | [diff] [blame] | 393 | struct mxl5005s_state *state = fe->tuner_priv; |
Steven Toth | 3935c25 | 2008-05-01 05:45:44 -0300 | [diff] [blame] | 394 | state->TunerRegs_Num = TUNER_REGS_NUM ; |
| 395 | // state->TunerRegs = (TunerReg_struct *) calloc( TUNER_REGS_NUM, sizeof(TunerReg_struct) ) ; |
Steven Toth | 52c99bd | 2008-05-01 04:57:01 -0300 | [diff] [blame] | 396 | |
Steven Toth | 3935c25 | 2008-05-01 05:45:44 -0300 | [diff] [blame] | 397 | state->TunerRegs[0].Reg_Num = 9 ; |
| 398 | state->TunerRegs[0].Reg_Val = 0x40 ; |
Steven Toth | 52c99bd | 2008-05-01 04:57:01 -0300 | [diff] [blame] | 399 | |
Steven Toth | 3935c25 | 2008-05-01 05:45:44 -0300 | [diff] [blame] | 400 | state->TunerRegs[1].Reg_Num = 11 ; |
| 401 | state->TunerRegs[1].Reg_Val = 0x19 ; |
Steven Toth | 52c99bd | 2008-05-01 04:57:01 -0300 | [diff] [blame] | 402 | |
Steven Toth | 3935c25 | 2008-05-01 05:45:44 -0300 | [diff] [blame] | 403 | state->TunerRegs[2].Reg_Num = 12 ; |
| 404 | state->TunerRegs[2].Reg_Val = 0x60 ; |
Steven Toth | 52c99bd | 2008-05-01 04:57:01 -0300 | [diff] [blame] | 405 | |
Steven Toth | 3935c25 | 2008-05-01 05:45:44 -0300 | [diff] [blame] | 406 | state->TunerRegs[3].Reg_Num = 13 ; |
| 407 | state->TunerRegs[3].Reg_Val = 0x00 ; |
Steven Toth | 52c99bd | 2008-05-01 04:57:01 -0300 | [diff] [blame] | 408 | |
Steven Toth | 3935c25 | 2008-05-01 05:45:44 -0300 | [diff] [blame] | 409 | state->TunerRegs[4].Reg_Num = 14 ; |
| 410 | state->TunerRegs[4].Reg_Val = 0x00 ; |
Steven Toth | 52c99bd | 2008-05-01 04:57:01 -0300 | [diff] [blame] | 411 | |
Steven Toth | 3935c25 | 2008-05-01 05:45:44 -0300 | [diff] [blame] | 412 | state->TunerRegs[5].Reg_Num = 15 ; |
| 413 | state->TunerRegs[5].Reg_Val = 0xC0 ; |
Steven Toth | 52c99bd | 2008-05-01 04:57:01 -0300 | [diff] [blame] | 414 | |
Steven Toth | 3935c25 | 2008-05-01 05:45:44 -0300 | [diff] [blame] | 415 | state->TunerRegs[6].Reg_Num = 16 ; |
| 416 | state->TunerRegs[6].Reg_Val = 0x00 ; |
Steven Toth | 52c99bd | 2008-05-01 04:57:01 -0300 | [diff] [blame] | 417 | |
Steven Toth | 3935c25 | 2008-05-01 05:45:44 -0300 | [diff] [blame] | 418 | state->TunerRegs[7].Reg_Num = 17 ; |
| 419 | state->TunerRegs[7].Reg_Val = 0x00 ; |
Steven Toth | 52c99bd | 2008-05-01 04:57:01 -0300 | [diff] [blame] | 420 | |
Steven Toth | 3935c25 | 2008-05-01 05:45:44 -0300 | [diff] [blame] | 421 | state->TunerRegs[8].Reg_Num = 18 ; |
| 422 | state->TunerRegs[8].Reg_Val = 0x00 ; |
Steven Toth | 52c99bd | 2008-05-01 04:57:01 -0300 | [diff] [blame] | 423 | |
Steven Toth | 3935c25 | 2008-05-01 05:45:44 -0300 | [diff] [blame] | 424 | state->TunerRegs[9].Reg_Num = 19 ; |
| 425 | state->TunerRegs[9].Reg_Val = 0x34 ; |
Steven Toth | 52c99bd | 2008-05-01 04:57:01 -0300 | [diff] [blame] | 426 | |
Steven Toth | 3935c25 | 2008-05-01 05:45:44 -0300 | [diff] [blame] | 427 | state->TunerRegs[10].Reg_Num = 21 ; |
| 428 | state->TunerRegs[10].Reg_Val = 0x00 ; |
Steven Toth | 52c99bd | 2008-05-01 04:57:01 -0300 | [diff] [blame] | 429 | |
Steven Toth | 3935c25 | 2008-05-01 05:45:44 -0300 | [diff] [blame] | 430 | state->TunerRegs[11].Reg_Num = 22 ; |
| 431 | state->TunerRegs[11].Reg_Val = 0x6B ; |
Steven Toth | 52c99bd | 2008-05-01 04:57:01 -0300 | [diff] [blame] | 432 | |
Steven Toth | 3935c25 | 2008-05-01 05:45:44 -0300 | [diff] [blame] | 433 | state->TunerRegs[12].Reg_Num = 23 ; |
| 434 | state->TunerRegs[12].Reg_Val = 0x35 ; |
Steven Toth | 52c99bd | 2008-05-01 04:57:01 -0300 | [diff] [blame] | 435 | |
Steven Toth | 3935c25 | 2008-05-01 05:45:44 -0300 | [diff] [blame] | 436 | state->TunerRegs[13].Reg_Num = 24 ; |
| 437 | state->TunerRegs[13].Reg_Val = 0x70 ; |
Steven Toth | 52c99bd | 2008-05-01 04:57:01 -0300 | [diff] [blame] | 438 | |
Steven Toth | 3935c25 | 2008-05-01 05:45:44 -0300 | [diff] [blame] | 439 | state->TunerRegs[14].Reg_Num = 25 ; |
| 440 | state->TunerRegs[14].Reg_Val = 0x3E ; |
Steven Toth | 52c99bd | 2008-05-01 04:57:01 -0300 | [diff] [blame] | 441 | |
Steven Toth | 3935c25 | 2008-05-01 05:45:44 -0300 | [diff] [blame] | 442 | state->TunerRegs[15].Reg_Num = 26 ; |
| 443 | state->TunerRegs[15].Reg_Val = 0x82 ; |
Steven Toth | 52c99bd | 2008-05-01 04:57:01 -0300 | [diff] [blame] | 444 | |
Steven Toth | 3935c25 | 2008-05-01 05:45:44 -0300 | [diff] [blame] | 445 | state->TunerRegs[16].Reg_Num = 31 ; |
| 446 | state->TunerRegs[16].Reg_Val = 0x00 ; |
Steven Toth | 52c99bd | 2008-05-01 04:57:01 -0300 | [diff] [blame] | 447 | |
Steven Toth | 3935c25 | 2008-05-01 05:45:44 -0300 | [diff] [blame] | 448 | state->TunerRegs[17].Reg_Num = 32 ; |
| 449 | state->TunerRegs[17].Reg_Val = 0x40 ; |
Steven Toth | 52c99bd | 2008-05-01 04:57:01 -0300 | [diff] [blame] | 450 | |
Steven Toth | 3935c25 | 2008-05-01 05:45:44 -0300 | [diff] [blame] | 451 | state->TunerRegs[18].Reg_Num = 33 ; |
| 452 | state->TunerRegs[18].Reg_Val = 0x53 ; |
Steven Toth | 52c99bd | 2008-05-01 04:57:01 -0300 | [diff] [blame] | 453 | |
Steven Toth | 3935c25 | 2008-05-01 05:45:44 -0300 | [diff] [blame] | 454 | state->TunerRegs[19].Reg_Num = 34 ; |
| 455 | state->TunerRegs[19].Reg_Val = 0x81 ; |
Steven Toth | 52c99bd | 2008-05-01 04:57:01 -0300 | [diff] [blame] | 456 | |
Steven Toth | 3935c25 | 2008-05-01 05:45:44 -0300 | [diff] [blame] | 457 | state->TunerRegs[20].Reg_Num = 35 ; |
| 458 | state->TunerRegs[20].Reg_Val = 0xC9 ; |
Steven Toth | 52c99bd | 2008-05-01 04:57:01 -0300 | [diff] [blame] | 459 | |
Steven Toth | 3935c25 | 2008-05-01 05:45:44 -0300 | [diff] [blame] | 460 | state->TunerRegs[21].Reg_Num = 36 ; |
| 461 | state->TunerRegs[21].Reg_Val = 0x01 ; |
Steven Toth | 52c99bd | 2008-05-01 04:57:01 -0300 | [diff] [blame] | 462 | |
Steven Toth | 3935c25 | 2008-05-01 05:45:44 -0300 | [diff] [blame] | 463 | state->TunerRegs[22].Reg_Num = 37 ; |
| 464 | state->TunerRegs[22].Reg_Val = 0x00 ; |
Steven Toth | 52c99bd | 2008-05-01 04:57:01 -0300 | [diff] [blame] | 465 | |
Steven Toth | 3935c25 | 2008-05-01 05:45:44 -0300 | [diff] [blame] | 466 | state->TunerRegs[23].Reg_Num = 41 ; |
| 467 | state->TunerRegs[23].Reg_Val = 0x00 ; |
Steven Toth | 52c99bd | 2008-05-01 04:57:01 -0300 | [diff] [blame] | 468 | |
Steven Toth | 3935c25 | 2008-05-01 05:45:44 -0300 | [diff] [blame] | 469 | state->TunerRegs[24].Reg_Num = 42 ; |
| 470 | state->TunerRegs[24].Reg_Val = 0xF8 ; |
Steven Toth | 52c99bd | 2008-05-01 04:57:01 -0300 | [diff] [blame] | 471 | |
Steven Toth | 3935c25 | 2008-05-01 05:45:44 -0300 | [diff] [blame] | 472 | state->TunerRegs[25].Reg_Num = 43 ; |
| 473 | state->TunerRegs[25].Reg_Val = 0x43 ; |
Steven Toth | 52c99bd | 2008-05-01 04:57:01 -0300 | [diff] [blame] | 474 | |
Steven Toth | 3935c25 | 2008-05-01 05:45:44 -0300 | [diff] [blame] | 475 | state->TunerRegs[26].Reg_Num = 44 ; |
| 476 | state->TunerRegs[26].Reg_Val = 0x20 ; |
Steven Toth | 52c99bd | 2008-05-01 04:57:01 -0300 | [diff] [blame] | 477 | |
Steven Toth | 3935c25 | 2008-05-01 05:45:44 -0300 | [diff] [blame] | 478 | state->TunerRegs[27].Reg_Num = 45 ; |
| 479 | state->TunerRegs[27].Reg_Val = 0x80 ; |
Steven Toth | 52c99bd | 2008-05-01 04:57:01 -0300 | [diff] [blame] | 480 | |
Steven Toth | 3935c25 | 2008-05-01 05:45:44 -0300 | [diff] [blame] | 481 | state->TunerRegs[28].Reg_Num = 46 ; |
| 482 | state->TunerRegs[28].Reg_Val = 0x88 ; |
Steven Toth | 52c99bd | 2008-05-01 04:57:01 -0300 | [diff] [blame] | 483 | |
Steven Toth | 3935c25 | 2008-05-01 05:45:44 -0300 | [diff] [blame] | 484 | state->TunerRegs[29].Reg_Num = 47 ; |
| 485 | state->TunerRegs[29].Reg_Val = 0x86 ; |
Steven Toth | 52c99bd | 2008-05-01 04:57:01 -0300 | [diff] [blame] | 486 | |
Steven Toth | 3935c25 | 2008-05-01 05:45:44 -0300 | [diff] [blame] | 487 | state->TunerRegs[30].Reg_Num = 48 ; |
| 488 | state->TunerRegs[30].Reg_Val = 0x00 ; |
Steven Toth | 52c99bd | 2008-05-01 04:57:01 -0300 | [diff] [blame] | 489 | |
Steven Toth | 3935c25 | 2008-05-01 05:45:44 -0300 | [diff] [blame] | 490 | state->TunerRegs[31].Reg_Num = 49 ; |
| 491 | state->TunerRegs[31].Reg_Val = 0x00 ; |
Steven Toth | 52c99bd | 2008-05-01 04:57:01 -0300 | [diff] [blame] | 492 | |
Steven Toth | 3935c25 | 2008-05-01 05:45:44 -0300 | [diff] [blame] | 493 | state->TunerRegs[32].Reg_Num = 53 ; |
| 494 | state->TunerRegs[32].Reg_Val = 0x94 ; |
Steven Toth | 52c99bd | 2008-05-01 04:57:01 -0300 | [diff] [blame] | 495 | |
Steven Toth | 3935c25 | 2008-05-01 05:45:44 -0300 | [diff] [blame] | 496 | state->TunerRegs[33].Reg_Num = 54 ; |
| 497 | state->TunerRegs[33].Reg_Val = 0xFA ; |
Steven Toth | 52c99bd | 2008-05-01 04:57:01 -0300 | [diff] [blame] | 498 | |
Steven Toth | 3935c25 | 2008-05-01 05:45:44 -0300 | [diff] [blame] | 499 | state->TunerRegs[34].Reg_Num = 55 ; |
| 500 | state->TunerRegs[34].Reg_Val = 0x92 ; |
Steven Toth | 52c99bd | 2008-05-01 04:57:01 -0300 | [diff] [blame] | 501 | |
Steven Toth | 3935c25 | 2008-05-01 05:45:44 -0300 | [diff] [blame] | 502 | state->TunerRegs[35].Reg_Num = 56 ; |
| 503 | state->TunerRegs[35].Reg_Val = 0x80 ; |
Steven Toth | 52c99bd | 2008-05-01 04:57:01 -0300 | [diff] [blame] | 504 | |
Steven Toth | 3935c25 | 2008-05-01 05:45:44 -0300 | [diff] [blame] | 505 | state->TunerRegs[36].Reg_Num = 57 ; |
| 506 | state->TunerRegs[36].Reg_Val = 0x41 ; |
Steven Toth | 52c99bd | 2008-05-01 04:57:01 -0300 | [diff] [blame] | 507 | |
Steven Toth | 3935c25 | 2008-05-01 05:45:44 -0300 | [diff] [blame] | 508 | state->TunerRegs[37].Reg_Num = 58 ; |
| 509 | state->TunerRegs[37].Reg_Val = 0xDB ; |
Steven Toth | 52c99bd | 2008-05-01 04:57:01 -0300 | [diff] [blame] | 510 | |
Steven Toth | 3935c25 | 2008-05-01 05:45:44 -0300 | [diff] [blame] | 511 | state->TunerRegs[38].Reg_Num = 59 ; |
| 512 | state->TunerRegs[38].Reg_Val = 0x00 ; |
Steven Toth | 52c99bd | 2008-05-01 04:57:01 -0300 | [diff] [blame] | 513 | |
Steven Toth | 3935c25 | 2008-05-01 05:45:44 -0300 | [diff] [blame] | 514 | state->TunerRegs[39].Reg_Num = 60 ; |
| 515 | state->TunerRegs[39].Reg_Val = 0x00 ; |
Steven Toth | 52c99bd | 2008-05-01 04:57:01 -0300 | [diff] [blame] | 516 | |
Steven Toth | 3935c25 | 2008-05-01 05:45:44 -0300 | [diff] [blame] | 517 | state->TunerRegs[40].Reg_Num = 61 ; |
| 518 | state->TunerRegs[40].Reg_Val = 0x00 ; |
Steven Toth | 52c99bd | 2008-05-01 04:57:01 -0300 | [diff] [blame] | 519 | |
Steven Toth | 3935c25 | 2008-05-01 05:45:44 -0300 | [diff] [blame] | 520 | state->TunerRegs[41].Reg_Num = 62 ; |
| 521 | state->TunerRegs[41].Reg_Val = 0x00 ; |
Steven Toth | 52c99bd | 2008-05-01 04:57:01 -0300 | [diff] [blame] | 522 | |
Steven Toth | 3935c25 | 2008-05-01 05:45:44 -0300 | [diff] [blame] | 523 | state->TunerRegs[42].Reg_Num = 65 ; |
| 524 | state->TunerRegs[42].Reg_Val = 0xF8 ; |
Steven Toth | 52c99bd | 2008-05-01 04:57:01 -0300 | [diff] [blame] | 525 | |
Steven Toth | 3935c25 | 2008-05-01 05:45:44 -0300 | [diff] [blame] | 526 | state->TunerRegs[43].Reg_Num = 66 ; |
| 527 | state->TunerRegs[43].Reg_Val = 0xE4 ; |
Steven Toth | 52c99bd | 2008-05-01 04:57:01 -0300 | [diff] [blame] | 528 | |
Steven Toth | 3935c25 | 2008-05-01 05:45:44 -0300 | [diff] [blame] | 529 | state->TunerRegs[44].Reg_Num = 67 ; |
| 530 | state->TunerRegs[44].Reg_Val = 0x90 ; |
Steven Toth | 52c99bd | 2008-05-01 04:57:01 -0300 | [diff] [blame] | 531 | |
Steven Toth | 3935c25 | 2008-05-01 05:45:44 -0300 | [diff] [blame] | 532 | state->TunerRegs[45].Reg_Num = 68 ; |
| 533 | state->TunerRegs[45].Reg_Val = 0xC0 ; |
Steven Toth | 52c99bd | 2008-05-01 04:57:01 -0300 | [diff] [blame] | 534 | |
Steven Toth | 3935c25 | 2008-05-01 05:45:44 -0300 | [diff] [blame] | 535 | state->TunerRegs[46].Reg_Num = 69 ; |
| 536 | state->TunerRegs[46].Reg_Val = 0x01 ; |
Steven Toth | 52c99bd | 2008-05-01 04:57:01 -0300 | [diff] [blame] | 537 | |
Steven Toth | 3935c25 | 2008-05-01 05:45:44 -0300 | [diff] [blame] | 538 | state->TunerRegs[47].Reg_Num = 70 ; |
| 539 | state->TunerRegs[47].Reg_Val = 0x50 ; |
Steven Toth | 52c99bd | 2008-05-01 04:57:01 -0300 | [diff] [blame] | 540 | |
Steven Toth | 3935c25 | 2008-05-01 05:45:44 -0300 | [diff] [blame] | 541 | state->TunerRegs[48].Reg_Num = 71 ; |
| 542 | state->TunerRegs[48].Reg_Val = 0x06 ; |
Steven Toth | 52c99bd | 2008-05-01 04:57:01 -0300 | [diff] [blame] | 543 | |
Steven Toth | 3935c25 | 2008-05-01 05:45:44 -0300 | [diff] [blame] | 544 | state->TunerRegs[49].Reg_Num = 72 ; |
| 545 | state->TunerRegs[49].Reg_Val = 0x00 ; |
Steven Toth | 52c99bd | 2008-05-01 04:57:01 -0300 | [diff] [blame] | 546 | |
Steven Toth | 3935c25 | 2008-05-01 05:45:44 -0300 | [diff] [blame] | 547 | state->TunerRegs[50].Reg_Num = 73 ; |
| 548 | state->TunerRegs[50].Reg_Val = 0x20 ; |
Steven Toth | 52c99bd | 2008-05-01 04:57:01 -0300 | [diff] [blame] | 549 | |
Steven Toth | 3935c25 | 2008-05-01 05:45:44 -0300 | [diff] [blame] | 550 | state->TunerRegs[51].Reg_Num = 76 ; |
| 551 | state->TunerRegs[51].Reg_Val = 0xBB ; |
Steven Toth | 52c99bd | 2008-05-01 04:57:01 -0300 | [diff] [blame] | 552 | |
Steven Toth | 3935c25 | 2008-05-01 05:45:44 -0300 | [diff] [blame] | 553 | state->TunerRegs[52].Reg_Num = 77 ; |
| 554 | state->TunerRegs[52].Reg_Val = 0x13 ; |
Steven Toth | 52c99bd | 2008-05-01 04:57:01 -0300 | [diff] [blame] | 555 | |
Steven Toth | 3935c25 | 2008-05-01 05:45:44 -0300 | [diff] [blame] | 556 | state->TunerRegs[53].Reg_Num = 81 ; |
| 557 | state->TunerRegs[53].Reg_Val = 0x04 ; |
Steven Toth | 52c99bd | 2008-05-01 04:57:01 -0300 | [diff] [blame] | 558 | |
Steven Toth | 3935c25 | 2008-05-01 05:45:44 -0300 | [diff] [blame] | 559 | state->TunerRegs[54].Reg_Num = 82 ; |
| 560 | state->TunerRegs[54].Reg_Val = 0x75 ; |
Steven Toth | 52c99bd | 2008-05-01 04:57:01 -0300 | [diff] [blame] | 561 | |
Steven Toth | 3935c25 | 2008-05-01 05:45:44 -0300 | [diff] [blame] | 562 | state->TunerRegs[55].Reg_Num = 83 ; |
| 563 | state->TunerRegs[55].Reg_Val = 0x00 ; |
Steven Toth | 52c99bd | 2008-05-01 04:57:01 -0300 | [diff] [blame] | 564 | |
Steven Toth | 3935c25 | 2008-05-01 05:45:44 -0300 | [diff] [blame] | 565 | state->TunerRegs[56].Reg_Num = 84 ; |
| 566 | state->TunerRegs[56].Reg_Val = 0x00 ; |
Steven Toth | 52c99bd | 2008-05-01 04:57:01 -0300 | [diff] [blame] | 567 | |
Steven Toth | 3935c25 | 2008-05-01 05:45:44 -0300 | [diff] [blame] | 568 | state->TunerRegs[57].Reg_Num = 85 ; |
| 569 | state->TunerRegs[57].Reg_Val = 0x00 ; |
Steven Toth | 52c99bd | 2008-05-01 04:57:01 -0300 | [diff] [blame] | 570 | |
Steven Toth | 3935c25 | 2008-05-01 05:45:44 -0300 | [diff] [blame] | 571 | state->TunerRegs[58].Reg_Num = 91 ; |
| 572 | state->TunerRegs[58].Reg_Val = 0x70 ; |
Steven Toth | 52c99bd | 2008-05-01 04:57:01 -0300 | [diff] [blame] | 573 | |
Steven Toth | 3935c25 | 2008-05-01 05:45:44 -0300 | [diff] [blame] | 574 | state->TunerRegs[59].Reg_Num = 92 ; |
| 575 | state->TunerRegs[59].Reg_Val = 0x00 ; |
Steven Toth | 52c99bd | 2008-05-01 04:57:01 -0300 | [diff] [blame] | 576 | |
Steven Toth | 3935c25 | 2008-05-01 05:45:44 -0300 | [diff] [blame] | 577 | state->TunerRegs[60].Reg_Num = 93 ; |
| 578 | state->TunerRegs[60].Reg_Val = 0x00 ; |
Steven Toth | 52c99bd | 2008-05-01 04:57:01 -0300 | [diff] [blame] | 579 | |
Steven Toth | 3935c25 | 2008-05-01 05:45:44 -0300 | [diff] [blame] | 580 | state->TunerRegs[61].Reg_Num = 94 ; |
| 581 | state->TunerRegs[61].Reg_Val = 0x00 ; |
Steven Toth | 52c99bd | 2008-05-01 04:57:01 -0300 | [diff] [blame] | 582 | |
Steven Toth | 3935c25 | 2008-05-01 05:45:44 -0300 | [diff] [blame] | 583 | state->TunerRegs[62].Reg_Num = 95 ; |
| 584 | state->TunerRegs[62].Reg_Val = 0x0C ; |
Steven Toth | 52c99bd | 2008-05-01 04:57:01 -0300 | [diff] [blame] | 585 | |
Steven Toth | 3935c25 | 2008-05-01 05:45:44 -0300 | [diff] [blame] | 586 | state->TunerRegs[63].Reg_Num = 96 ; |
| 587 | state->TunerRegs[63].Reg_Val = 0x00 ; |
Steven Toth | 52c99bd | 2008-05-01 04:57:01 -0300 | [diff] [blame] | 588 | |
Steven Toth | 3935c25 | 2008-05-01 05:45:44 -0300 | [diff] [blame] | 589 | state->TunerRegs[64].Reg_Num = 97 ; |
| 590 | state->TunerRegs[64].Reg_Val = 0x00 ; |
Steven Toth | 52c99bd | 2008-05-01 04:57:01 -0300 | [diff] [blame] | 591 | |
Steven Toth | 3935c25 | 2008-05-01 05:45:44 -0300 | [diff] [blame] | 592 | state->TunerRegs[65].Reg_Num = 98 ; |
| 593 | state->TunerRegs[65].Reg_Val = 0xE2 ; |
Steven Toth | 52c99bd | 2008-05-01 04:57:01 -0300 | [diff] [blame] | 594 | |
Steven Toth | 3935c25 | 2008-05-01 05:45:44 -0300 | [diff] [blame] | 595 | state->TunerRegs[66].Reg_Num = 99 ; |
| 596 | state->TunerRegs[66].Reg_Val = 0x00 ; |
Steven Toth | 52c99bd | 2008-05-01 04:57:01 -0300 | [diff] [blame] | 597 | |
Steven Toth | 3935c25 | 2008-05-01 05:45:44 -0300 | [diff] [blame] | 598 | state->TunerRegs[67].Reg_Num = 100 ; |
| 599 | state->TunerRegs[67].Reg_Val = 0x00 ; |
Steven Toth | 52c99bd | 2008-05-01 04:57:01 -0300 | [diff] [blame] | 600 | |
Steven Toth | 3935c25 | 2008-05-01 05:45:44 -0300 | [diff] [blame] | 601 | state->TunerRegs[68].Reg_Num = 101 ; |
| 602 | state->TunerRegs[68].Reg_Val = 0x12 ; |
Steven Toth | 52c99bd | 2008-05-01 04:57:01 -0300 | [diff] [blame] | 603 | |
Steven Toth | 3935c25 | 2008-05-01 05:45:44 -0300 | [diff] [blame] | 604 | state->TunerRegs[69].Reg_Num = 102 ; |
| 605 | state->TunerRegs[69].Reg_Val = 0x80 ; |
Steven Toth | 52c99bd | 2008-05-01 04:57:01 -0300 | [diff] [blame] | 606 | |
Steven Toth | 3935c25 | 2008-05-01 05:45:44 -0300 | [diff] [blame] | 607 | state->TunerRegs[70].Reg_Num = 103 ; |
| 608 | state->TunerRegs[70].Reg_Val = 0x32 ; |
Steven Toth | 52c99bd | 2008-05-01 04:57:01 -0300 | [diff] [blame] | 609 | |
Steven Toth | 3935c25 | 2008-05-01 05:45:44 -0300 | [diff] [blame] | 610 | state->TunerRegs[71].Reg_Num = 104 ; |
| 611 | state->TunerRegs[71].Reg_Val = 0xB4 ; |
Steven Toth | 52c99bd | 2008-05-01 04:57:01 -0300 | [diff] [blame] | 612 | |
Steven Toth | 3935c25 | 2008-05-01 05:45:44 -0300 | [diff] [blame] | 613 | state->TunerRegs[72].Reg_Num = 105 ; |
| 614 | state->TunerRegs[72].Reg_Val = 0x60 ; |
Steven Toth | 52c99bd | 2008-05-01 04:57:01 -0300 | [diff] [blame] | 615 | |
Steven Toth | 3935c25 | 2008-05-01 05:45:44 -0300 | [diff] [blame] | 616 | state->TunerRegs[73].Reg_Num = 106 ; |
| 617 | state->TunerRegs[73].Reg_Val = 0x83 ; |
Steven Toth | 52c99bd | 2008-05-01 04:57:01 -0300 | [diff] [blame] | 618 | |
Steven Toth | 3935c25 | 2008-05-01 05:45:44 -0300 | [diff] [blame] | 619 | state->TunerRegs[74].Reg_Num = 107 ; |
| 620 | state->TunerRegs[74].Reg_Val = 0x84 ; |
Steven Toth | 52c99bd | 2008-05-01 04:57:01 -0300 | [diff] [blame] | 621 | |
Steven Toth | 3935c25 | 2008-05-01 05:45:44 -0300 | [diff] [blame] | 622 | state->TunerRegs[75].Reg_Num = 108 ; |
| 623 | state->TunerRegs[75].Reg_Val = 0x9C ; |
Steven Toth | 52c99bd | 2008-05-01 04:57:01 -0300 | [diff] [blame] | 624 | |
Steven Toth | 3935c25 | 2008-05-01 05:45:44 -0300 | [diff] [blame] | 625 | state->TunerRegs[76].Reg_Num = 109 ; |
| 626 | state->TunerRegs[76].Reg_Val = 0x02 ; |
Steven Toth | 52c99bd | 2008-05-01 04:57:01 -0300 | [diff] [blame] | 627 | |
Steven Toth | 3935c25 | 2008-05-01 05:45:44 -0300 | [diff] [blame] | 628 | state->TunerRegs[77].Reg_Num = 110 ; |
| 629 | state->TunerRegs[77].Reg_Val = 0x81 ; |
Steven Toth | 52c99bd | 2008-05-01 04:57:01 -0300 | [diff] [blame] | 630 | |
Steven Toth | 3935c25 | 2008-05-01 05:45:44 -0300 | [diff] [blame] | 631 | state->TunerRegs[78].Reg_Num = 111 ; |
| 632 | state->TunerRegs[78].Reg_Val = 0xC0 ; |
Steven Toth | 52c99bd | 2008-05-01 04:57:01 -0300 | [diff] [blame] | 633 | |
Steven Toth | 3935c25 | 2008-05-01 05:45:44 -0300 | [diff] [blame] | 634 | state->TunerRegs[79].Reg_Num = 112 ; |
| 635 | state->TunerRegs[79].Reg_Val = 0x10 ; |
Steven Toth | 52c99bd | 2008-05-01 04:57:01 -0300 | [diff] [blame] | 636 | |
Steven Toth | 3935c25 | 2008-05-01 05:45:44 -0300 | [diff] [blame] | 637 | state->TunerRegs[80].Reg_Num = 131 ; |
| 638 | state->TunerRegs[80].Reg_Val = 0x8A ; |
Steven Toth | 52c99bd | 2008-05-01 04:57:01 -0300 | [diff] [blame] | 639 | |
Steven Toth | 3935c25 | 2008-05-01 05:45:44 -0300 | [diff] [blame] | 640 | state->TunerRegs[81].Reg_Num = 132 ; |
| 641 | state->TunerRegs[81].Reg_Val = 0x10 ; |
Steven Toth | 52c99bd | 2008-05-01 04:57:01 -0300 | [diff] [blame] | 642 | |
Steven Toth | 3935c25 | 2008-05-01 05:45:44 -0300 | [diff] [blame] | 643 | state->TunerRegs[82].Reg_Num = 133 ; |
| 644 | state->TunerRegs[82].Reg_Val = 0x24 ; |
Steven Toth | 52c99bd | 2008-05-01 04:57:01 -0300 | [diff] [blame] | 645 | |
Steven Toth | 3935c25 | 2008-05-01 05:45:44 -0300 | [diff] [blame] | 646 | state->TunerRegs[83].Reg_Num = 134 ; |
| 647 | state->TunerRegs[83].Reg_Val = 0x00 ; |
Steven Toth | 52c99bd | 2008-05-01 04:57:01 -0300 | [diff] [blame] | 648 | |
Steven Toth | 3935c25 | 2008-05-01 05:45:44 -0300 | [diff] [blame] | 649 | state->TunerRegs[84].Reg_Num = 135 ; |
| 650 | state->TunerRegs[84].Reg_Val = 0x00 ; |
Steven Toth | 52c99bd | 2008-05-01 04:57:01 -0300 | [diff] [blame] | 651 | |
Steven Toth | 3935c25 | 2008-05-01 05:45:44 -0300 | [diff] [blame] | 652 | state->TunerRegs[85].Reg_Num = 136 ; |
| 653 | state->TunerRegs[85].Reg_Val = 0x7E ; |
Steven Toth | 52c99bd | 2008-05-01 04:57:01 -0300 | [diff] [blame] | 654 | |
Steven Toth | 3935c25 | 2008-05-01 05:45:44 -0300 | [diff] [blame] | 655 | state->TunerRegs[86].Reg_Num = 137 ; |
| 656 | state->TunerRegs[86].Reg_Val = 0x40 ; |
Steven Toth | 52c99bd | 2008-05-01 04:57:01 -0300 | [diff] [blame] | 657 | |
Steven Toth | 3935c25 | 2008-05-01 05:45:44 -0300 | [diff] [blame] | 658 | state->TunerRegs[87].Reg_Num = 138 ; |
| 659 | state->TunerRegs[87].Reg_Val = 0x38 ; |
Steven Toth | 52c99bd | 2008-05-01 04:57:01 -0300 | [diff] [blame] | 660 | |
Steven Toth | 3935c25 | 2008-05-01 05:45:44 -0300 | [diff] [blame] | 661 | state->TunerRegs[88].Reg_Num = 146 ; |
| 662 | state->TunerRegs[88].Reg_Val = 0xF6 ; |
Steven Toth | 52c99bd | 2008-05-01 04:57:01 -0300 | [diff] [blame] | 663 | |
Steven Toth | 3935c25 | 2008-05-01 05:45:44 -0300 | [diff] [blame] | 664 | state->TunerRegs[89].Reg_Num = 147 ; |
| 665 | state->TunerRegs[89].Reg_Val = 0x1A ; |
Steven Toth | 52c99bd | 2008-05-01 04:57:01 -0300 | [diff] [blame] | 666 | |
Steven Toth | 3935c25 | 2008-05-01 05:45:44 -0300 | [diff] [blame] | 667 | state->TunerRegs[90].Reg_Num = 148 ; |
| 668 | state->TunerRegs[90].Reg_Val = 0x62 ; |
Steven Toth | 52c99bd | 2008-05-01 04:57:01 -0300 | [diff] [blame] | 669 | |
Steven Toth | 3935c25 | 2008-05-01 05:45:44 -0300 | [diff] [blame] | 670 | state->TunerRegs[91].Reg_Num = 149 ; |
| 671 | state->TunerRegs[91].Reg_Val = 0x33 ; |
Steven Toth | 52c99bd | 2008-05-01 04:57:01 -0300 | [diff] [blame] | 672 | |
Steven Toth | 3935c25 | 2008-05-01 05:45:44 -0300 | [diff] [blame] | 673 | state->TunerRegs[92].Reg_Num = 150 ; |
| 674 | state->TunerRegs[92].Reg_Val = 0x80 ; |
Steven Toth | 52c99bd | 2008-05-01 04:57:01 -0300 | [diff] [blame] | 675 | |
Steven Toth | 3935c25 | 2008-05-01 05:45:44 -0300 | [diff] [blame] | 676 | state->TunerRegs[93].Reg_Num = 156 ; |
| 677 | state->TunerRegs[93].Reg_Val = 0x56 ; |
Steven Toth | 52c99bd | 2008-05-01 04:57:01 -0300 | [diff] [blame] | 678 | |
Steven Toth | 3935c25 | 2008-05-01 05:45:44 -0300 | [diff] [blame] | 679 | state->TunerRegs[94].Reg_Num = 157 ; |
| 680 | state->TunerRegs[94].Reg_Val = 0x17 ; |
Steven Toth | 52c99bd | 2008-05-01 04:57:01 -0300 | [diff] [blame] | 681 | |
Steven Toth | 3935c25 | 2008-05-01 05:45:44 -0300 | [diff] [blame] | 682 | state->TunerRegs[95].Reg_Num = 158 ; |
| 683 | state->TunerRegs[95].Reg_Val = 0xA9 ; |
Steven Toth | 52c99bd | 2008-05-01 04:57:01 -0300 | [diff] [blame] | 684 | |
Steven Toth | 3935c25 | 2008-05-01 05:45:44 -0300 | [diff] [blame] | 685 | state->TunerRegs[96].Reg_Num = 159 ; |
| 686 | state->TunerRegs[96].Reg_Val = 0x00 ; |
Steven Toth | 52c99bd | 2008-05-01 04:57:01 -0300 | [diff] [blame] | 687 | |
Steven Toth | 3935c25 | 2008-05-01 05:45:44 -0300 | [diff] [blame] | 688 | state->TunerRegs[97].Reg_Num = 160 ; |
| 689 | state->TunerRegs[97].Reg_Val = 0x00 ; |
Steven Toth | 52c99bd | 2008-05-01 04:57:01 -0300 | [diff] [blame] | 690 | |
Steven Toth | 3935c25 | 2008-05-01 05:45:44 -0300 | [diff] [blame] | 691 | state->TunerRegs[98].Reg_Num = 161 ; |
| 692 | state->TunerRegs[98].Reg_Val = 0x00 ; |
Steven Toth | 52c99bd | 2008-05-01 04:57:01 -0300 | [diff] [blame] | 693 | |
Steven Toth | 3935c25 | 2008-05-01 05:45:44 -0300 | [diff] [blame] | 694 | state->TunerRegs[99].Reg_Num = 162 ; |
| 695 | state->TunerRegs[99].Reg_Val = 0x40 ; |
Steven Toth | 52c99bd | 2008-05-01 04:57:01 -0300 | [diff] [blame] | 696 | |
Steven Toth | 3935c25 | 2008-05-01 05:45:44 -0300 | [diff] [blame] | 697 | state->TunerRegs[100].Reg_Num = 166 ; |
| 698 | state->TunerRegs[100].Reg_Val = 0xAE ; |
Steven Toth | 52c99bd | 2008-05-01 04:57:01 -0300 | [diff] [blame] | 699 | |
Steven Toth | 3935c25 | 2008-05-01 05:45:44 -0300 | [diff] [blame] | 700 | state->TunerRegs[101].Reg_Num = 167 ; |
| 701 | state->TunerRegs[101].Reg_Val = 0x1B ; |
Steven Toth | 52c99bd | 2008-05-01 04:57:01 -0300 | [diff] [blame] | 702 | |
Steven Toth | 3935c25 | 2008-05-01 05:45:44 -0300 | [diff] [blame] | 703 | state->TunerRegs[102].Reg_Num = 168 ; |
| 704 | state->TunerRegs[102].Reg_Val = 0xF2 ; |
Steven Toth | 52c99bd | 2008-05-01 04:57:01 -0300 | [diff] [blame] | 705 | |
Steven Toth | 3935c25 | 2008-05-01 05:45:44 -0300 | [diff] [blame] | 706 | state->TunerRegs[103].Reg_Num = 195 ; |
| 707 | state->TunerRegs[103].Reg_Val = 0x00 ; |
Steven Toth | 52c99bd | 2008-05-01 04:57:01 -0300 | [diff] [blame] | 708 | |
| 709 | return 0 ; |
| 710 | } |
| 711 | |
Steven Toth | 3935c25 | 2008-05-01 05:45:44 -0300 | [diff] [blame] | 712 | u16 MXL5005_ControlInit(struct dvb_frontend *fe) |
Steven Toth | 52c99bd | 2008-05-01 04:57:01 -0300 | [diff] [blame] | 713 | { |
Steven Toth | 85d220d | 2008-05-01 05:48:14 -0300 | [diff] [blame] | 714 | struct mxl5005s_state *state = fe->tuner_priv; |
Steven Toth | 3935c25 | 2008-05-01 05:45:44 -0300 | [diff] [blame] | 715 | state->Init_Ctrl_Num = INITCTRL_NUM; |
Steven Toth | 52c99bd | 2008-05-01 04:57:01 -0300 | [diff] [blame] | 716 | |
Steven Toth | 3935c25 | 2008-05-01 05:45:44 -0300 | [diff] [blame] | 717 | state->Init_Ctrl[0].Ctrl_Num = DN_IQTN_AMP_CUT ; |
| 718 | state->Init_Ctrl[0].size = 1 ; |
| 719 | state->Init_Ctrl[0].addr[0] = 73; |
| 720 | state->Init_Ctrl[0].bit[0] = 7; |
| 721 | state->Init_Ctrl[0].val[0] = 0; |
Steven Toth | 52c99bd | 2008-05-01 04:57:01 -0300 | [diff] [blame] | 722 | |
Steven Toth | 3935c25 | 2008-05-01 05:45:44 -0300 | [diff] [blame] | 723 | state->Init_Ctrl[1].Ctrl_Num = BB_MODE ; |
| 724 | state->Init_Ctrl[1].size = 1 ; |
| 725 | state->Init_Ctrl[1].addr[0] = 53; |
| 726 | state->Init_Ctrl[1].bit[0] = 2; |
| 727 | state->Init_Ctrl[1].val[0] = 1; |
Steven Toth | 52c99bd | 2008-05-01 04:57:01 -0300 | [diff] [blame] | 728 | |
Steven Toth | 3935c25 | 2008-05-01 05:45:44 -0300 | [diff] [blame] | 729 | state->Init_Ctrl[2].Ctrl_Num = BB_BUF ; |
| 730 | state->Init_Ctrl[2].size = 2 ; |
| 731 | state->Init_Ctrl[2].addr[0] = 53; |
| 732 | state->Init_Ctrl[2].bit[0] = 1; |
| 733 | state->Init_Ctrl[2].val[0] = 0; |
| 734 | state->Init_Ctrl[2].addr[1] = 57; |
| 735 | state->Init_Ctrl[2].bit[1] = 0; |
| 736 | state->Init_Ctrl[2].val[1] = 1; |
Steven Toth | 52c99bd | 2008-05-01 04:57:01 -0300 | [diff] [blame] | 737 | |
Steven Toth | 3935c25 | 2008-05-01 05:45:44 -0300 | [diff] [blame] | 738 | state->Init_Ctrl[3].Ctrl_Num = BB_BUF_OA ; |
| 739 | state->Init_Ctrl[3].size = 1 ; |
| 740 | state->Init_Ctrl[3].addr[0] = 53; |
| 741 | state->Init_Ctrl[3].bit[0] = 0; |
| 742 | state->Init_Ctrl[3].val[0] = 0; |
Steven Toth | 52c99bd | 2008-05-01 04:57:01 -0300 | [diff] [blame] | 743 | |
Steven Toth | 3935c25 | 2008-05-01 05:45:44 -0300 | [diff] [blame] | 744 | state->Init_Ctrl[4].Ctrl_Num = BB_ALPF_BANDSELECT ; |
| 745 | state->Init_Ctrl[4].size = 3 ; |
| 746 | state->Init_Ctrl[4].addr[0] = 53; |
| 747 | state->Init_Ctrl[4].bit[0] = 5; |
| 748 | state->Init_Ctrl[4].val[0] = 0; |
| 749 | state->Init_Ctrl[4].addr[1] = 53; |
| 750 | state->Init_Ctrl[4].bit[1] = 6; |
| 751 | state->Init_Ctrl[4].val[1] = 0; |
| 752 | state->Init_Ctrl[4].addr[2] = 53; |
| 753 | state->Init_Ctrl[4].bit[2] = 7; |
| 754 | state->Init_Ctrl[4].val[2] = 1; |
Steven Toth | 52c99bd | 2008-05-01 04:57:01 -0300 | [diff] [blame] | 755 | |
Steven Toth | 3935c25 | 2008-05-01 05:45:44 -0300 | [diff] [blame] | 756 | state->Init_Ctrl[5].Ctrl_Num = BB_IQSWAP ; |
| 757 | state->Init_Ctrl[5].size = 1 ; |
| 758 | state->Init_Ctrl[5].addr[0] = 59; |
| 759 | state->Init_Ctrl[5].bit[0] = 0; |
| 760 | state->Init_Ctrl[5].val[0] = 0; |
Steven Toth | 52c99bd | 2008-05-01 04:57:01 -0300 | [diff] [blame] | 761 | |
Steven Toth | 3935c25 | 2008-05-01 05:45:44 -0300 | [diff] [blame] | 762 | state->Init_Ctrl[6].Ctrl_Num = BB_DLPF_BANDSEL ; |
| 763 | state->Init_Ctrl[6].size = 2 ; |
| 764 | state->Init_Ctrl[6].addr[0] = 53; |
| 765 | state->Init_Ctrl[6].bit[0] = 3; |
| 766 | state->Init_Ctrl[6].val[0] = 0; |
| 767 | state->Init_Ctrl[6].addr[1] = 53; |
| 768 | state->Init_Ctrl[6].bit[1] = 4; |
| 769 | state->Init_Ctrl[6].val[1] = 1; |
Steven Toth | 52c99bd | 2008-05-01 04:57:01 -0300 | [diff] [blame] | 770 | |
Steven Toth | 3935c25 | 2008-05-01 05:45:44 -0300 | [diff] [blame] | 771 | state->Init_Ctrl[7].Ctrl_Num = RFSYN_CHP_GAIN ; |
| 772 | state->Init_Ctrl[7].size = 4 ; |
| 773 | state->Init_Ctrl[7].addr[0] = 22; |
| 774 | state->Init_Ctrl[7].bit[0] = 4; |
| 775 | state->Init_Ctrl[7].val[0] = 0; |
| 776 | state->Init_Ctrl[7].addr[1] = 22; |
| 777 | state->Init_Ctrl[7].bit[1] = 5; |
| 778 | state->Init_Ctrl[7].val[1] = 1; |
| 779 | state->Init_Ctrl[7].addr[2] = 22; |
| 780 | state->Init_Ctrl[7].bit[2] = 6; |
| 781 | state->Init_Ctrl[7].val[2] = 1; |
| 782 | state->Init_Ctrl[7].addr[3] = 22; |
| 783 | state->Init_Ctrl[7].bit[3] = 7; |
| 784 | state->Init_Ctrl[7].val[3] = 0; |
Steven Toth | 52c99bd | 2008-05-01 04:57:01 -0300 | [diff] [blame] | 785 | |
Steven Toth | 3935c25 | 2008-05-01 05:45:44 -0300 | [diff] [blame] | 786 | state->Init_Ctrl[8].Ctrl_Num = RFSYN_EN_CHP_HIGAIN ; |
| 787 | state->Init_Ctrl[8].size = 1 ; |
| 788 | state->Init_Ctrl[8].addr[0] = 22; |
| 789 | state->Init_Ctrl[8].bit[0] = 2; |
| 790 | state->Init_Ctrl[8].val[0] = 0; |
Steven Toth | 52c99bd | 2008-05-01 04:57:01 -0300 | [diff] [blame] | 791 | |
Steven Toth | 3935c25 | 2008-05-01 05:45:44 -0300 | [diff] [blame] | 792 | state->Init_Ctrl[9].Ctrl_Num = AGC_IF ; |
| 793 | state->Init_Ctrl[9].size = 4 ; |
| 794 | state->Init_Ctrl[9].addr[0] = 76; |
| 795 | state->Init_Ctrl[9].bit[0] = 0; |
| 796 | state->Init_Ctrl[9].val[0] = 1; |
| 797 | state->Init_Ctrl[9].addr[1] = 76; |
| 798 | state->Init_Ctrl[9].bit[1] = 1; |
| 799 | state->Init_Ctrl[9].val[1] = 1; |
| 800 | state->Init_Ctrl[9].addr[2] = 76; |
| 801 | state->Init_Ctrl[9].bit[2] = 2; |
| 802 | state->Init_Ctrl[9].val[2] = 0; |
| 803 | state->Init_Ctrl[9].addr[3] = 76; |
| 804 | state->Init_Ctrl[9].bit[3] = 3; |
| 805 | state->Init_Ctrl[9].val[3] = 1; |
Steven Toth | 52c99bd | 2008-05-01 04:57:01 -0300 | [diff] [blame] | 806 | |
Steven Toth | 3935c25 | 2008-05-01 05:45:44 -0300 | [diff] [blame] | 807 | state->Init_Ctrl[10].Ctrl_Num = AGC_RF ; |
| 808 | state->Init_Ctrl[10].size = 4 ; |
| 809 | state->Init_Ctrl[10].addr[0] = 76; |
| 810 | state->Init_Ctrl[10].bit[0] = 4; |
| 811 | state->Init_Ctrl[10].val[0] = 1; |
| 812 | state->Init_Ctrl[10].addr[1] = 76; |
| 813 | state->Init_Ctrl[10].bit[1] = 5; |
| 814 | state->Init_Ctrl[10].val[1] = 1; |
| 815 | state->Init_Ctrl[10].addr[2] = 76; |
| 816 | state->Init_Ctrl[10].bit[2] = 6; |
| 817 | state->Init_Ctrl[10].val[2] = 0; |
| 818 | state->Init_Ctrl[10].addr[3] = 76; |
| 819 | state->Init_Ctrl[10].bit[3] = 7; |
| 820 | state->Init_Ctrl[10].val[3] = 1; |
Steven Toth | 52c99bd | 2008-05-01 04:57:01 -0300 | [diff] [blame] | 821 | |
Steven Toth | 3935c25 | 2008-05-01 05:45:44 -0300 | [diff] [blame] | 822 | state->Init_Ctrl[11].Ctrl_Num = IF_DIVVAL ; |
| 823 | state->Init_Ctrl[11].size = 5 ; |
| 824 | state->Init_Ctrl[11].addr[0] = 43; |
| 825 | state->Init_Ctrl[11].bit[0] = 3; |
| 826 | state->Init_Ctrl[11].val[0] = 0; |
| 827 | state->Init_Ctrl[11].addr[1] = 43; |
| 828 | state->Init_Ctrl[11].bit[1] = 4; |
| 829 | state->Init_Ctrl[11].val[1] = 0; |
| 830 | state->Init_Ctrl[11].addr[2] = 43; |
| 831 | state->Init_Ctrl[11].bit[2] = 5; |
| 832 | state->Init_Ctrl[11].val[2] = 0; |
| 833 | state->Init_Ctrl[11].addr[3] = 43; |
| 834 | state->Init_Ctrl[11].bit[3] = 6; |
| 835 | state->Init_Ctrl[11].val[3] = 1; |
| 836 | state->Init_Ctrl[11].addr[4] = 43; |
| 837 | state->Init_Ctrl[11].bit[4] = 7; |
| 838 | state->Init_Ctrl[11].val[4] = 0; |
Steven Toth | 52c99bd | 2008-05-01 04:57:01 -0300 | [diff] [blame] | 839 | |
Steven Toth | 3935c25 | 2008-05-01 05:45:44 -0300 | [diff] [blame] | 840 | state->Init_Ctrl[12].Ctrl_Num = IF_VCO_BIAS ; |
| 841 | state->Init_Ctrl[12].size = 6 ; |
| 842 | state->Init_Ctrl[12].addr[0] = 44; |
| 843 | state->Init_Ctrl[12].bit[0] = 2; |
| 844 | state->Init_Ctrl[12].val[0] = 0; |
| 845 | state->Init_Ctrl[12].addr[1] = 44; |
| 846 | state->Init_Ctrl[12].bit[1] = 3; |
| 847 | state->Init_Ctrl[12].val[1] = 0; |
| 848 | state->Init_Ctrl[12].addr[2] = 44; |
| 849 | state->Init_Ctrl[12].bit[2] = 4; |
| 850 | state->Init_Ctrl[12].val[2] = 0; |
| 851 | state->Init_Ctrl[12].addr[3] = 44; |
| 852 | state->Init_Ctrl[12].bit[3] = 5; |
| 853 | state->Init_Ctrl[12].val[3] = 1; |
| 854 | state->Init_Ctrl[12].addr[4] = 44; |
| 855 | state->Init_Ctrl[12].bit[4] = 6; |
| 856 | state->Init_Ctrl[12].val[4] = 0; |
| 857 | state->Init_Ctrl[12].addr[5] = 44; |
| 858 | state->Init_Ctrl[12].bit[5] = 7; |
| 859 | state->Init_Ctrl[12].val[5] = 0; |
Steven Toth | 52c99bd | 2008-05-01 04:57:01 -0300 | [diff] [blame] | 860 | |
Steven Toth | 3935c25 | 2008-05-01 05:45:44 -0300 | [diff] [blame] | 861 | state->Init_Ctrl[13].Ctrl_Num = CHCAL_INT_MOD_IF ; |
| 862 | state->Init_Ctrl[13].size = 7 ; |
| 863 | state->Init_Ctrl[13].addr[0] = 11; |
| 864 | state->Init_Ctrl[13].bit[0] = 0; |
| 865 | state->Init_Ctrl[13].val[0] = 1; |
| 866 | state->Init_Ctrl[13].addr[1] = 11; |
| 867 | state->Init_Ctrl[13].bit[1] = 1; |
| 868 | state->Init_Ctrl[13].val[1] = 0; |
| 869 | state->Init_Ctrl[13].addr[2] = 11; |
| 870 | state->Init_Ctrl[13].bit[2] = 2; |
| 871 | state->Init_Ctrl[13].val[2] = 0; |
| 872 | state->Init_Ctrl[13].addr[3] = 11; |
| 873 | state->Init_Ctrl[13].bit[3] = 3; |
| 874 | state->Init_Ctrl[13].val[3] = 1; |
| 875 | state->Init_Ctrl[13].addr[4] = 11; |
| 876 | state->Init_Ctrl[13].bit[4] = 4; |
| 877 | state->Init_Ctrl[13].val[4] = 1; |
| 878 | state->Init_Ctrl[13].addr[5] = 11; |
| 879 | state->Init_Ctrl[13].bit[5] = 5; |
| 880 | state->Init_Ctrl[13].val[5] = 0; |
| 881 | state->Init_Ctrl[13].addr[6] = 11; |
| 882 | state->Init_Ctrl[13].bit[6] = 6; |
| 883 | state->Init_Ctrl[13].val[6] = 0; |
Steven Toth | 52c99bd | 2008-05-01 04:57:01 -0300 | [diff] [blame] | 884 | |
Steven Toth | 3935c25 | 2008-05-01 05:45:44 -0300 | [diff] [blame] | 885 | state->Init_Ctrl[14].Ctrl_Num = CHCAL_FRAC_MOD_IF ; |
| 886 | state->Init_Ctrl[14].size = 16 ; |
| 887 | state->Init_Ctrl[14].addr[0] = 13; |
| 888 | state->Init_Ctrl[14].bit[0] = 0; |
| 889 | state->Init_Ctrl[14].val[0] = 0; |
| 890 | state->Init_Ctrl[14].addr[1] = 13; |
| 891 | state->Init_Ctrl[14].bit[1] = 1; |
| 892 | state->Init_Ctrl[14].val[1] = 0; |
| 893 | state->Init_Ctrl[14].addr[2] = 13; |
| 894 | state->Init_Ctrl[14].bit[2] = 2; |
| 895 | state->Init_Ctrl[14].val[2] = 0; |
| 896 | state->Init_Ctrl[14].addr[3] = 13; |
| 897 | state->Init_Ctrl[14].bit[3] = 3; |
| 898 | state->Init_Ctrl[14].val[3] = 0; |
| 899 | state->Init_Ctrl[14].addr[4] = 13; |
| 900 | state->Init_Ctrl[14].bit[4] = 4; |
| 901 | state->Init_Ctrl[14].val[4] = 0; |
| 902 | state->Init_Ctrl[14].addr[5] = 13; |
| 903 | state->Init_Ctrl[14].bit[5] = 5; |
| 904 | state->Init_Ctrl[14].val[5] = 0; |
| 905 | state->Init_Ctrl[14].addr[6] = 13; |
| 906 | state->Init_Ctrl[14].bit[6] = 6; |
| 907 | state->Init_Ctrl[14].val[6] = 0; |
| 908 | state->Init_Ctrl[14].addr[7] = 13; |
| 909 | state->Init_Ctrl[14].bit[7] = 7; |
| 910 | state->Init_Ctrl[14].val[7] = 0; |
| 911 | state->Init_Ctrl[14].addr[8] = 12; |
| 912 | state->Init_Ctrl[14].bit[8] = 0; |
| 913 | state->Init_Ctrl[14].val[8] = 0; |
| 914 | state->Init_Ctrl[14].addr[9] = 12; |
| 915 | state->Init_Ctrl[14].bit[9] = 1; |
| 916 | state->Init_Ctrl[14].val[9] = 0; |
| 917 | state->Init_Ctrl[14].addr[10] = 12; |
| 918 | state->Init_Ctrl[14].bit[10] = 2; |
| 919 | state->Init_Ctrl[14].val[10] = 0; |
| 920 | state->Init_Ctrl[14].addr[11] = 12; |
| 921 | state->Init_Ctrl[14].bit[11] = 3; |
| 922 | state->Init_Ctrl[14].val[11] = 0; |
| 923 | state->Init_Ctrl[14].addr[12] = 12; |
| 924 | state->Init_Ctrl[14].bit[12] = 4; |
| 925 | state->Init_Ctrl[14].val[12] = 0; |
| 926 | state->Init_Ctrl[14].addr[13] = 12; |
| 927 | state->Init_Ctrl[14].bit[13] = 5; |
| 928 | state->Init_Ctrl[14].val[13] = 1; |
| 929 | state->Init_Ctrl[14].addr[14] = 12; |
| 930 | state->Init_Ctrl[14].bit[14] = 6; |
| 931 | state->Init_Ctrl[14].val[14] = 1; |
| 932 | state->Init_Ctrl[14].addr[15] = 12; |
| 933 | state->Init_Ctrl[14].bit[15] = 7; |
| 934 | state->Init_Ctrl[14].val[15] = 0; |
Steven Toth | 52c99bd | 2008-05-01 04:57:01 -0300 | [diff] [blame] | 935 | |
Steven Toth | 3935c25 | 2008-05-01 05:45:44 -0300 | [diff] [blame] | 936 | state->Init_Ctrl[15].Ctrl_Num = DRV_RES_SEL ; |
| 937 | state->Init_Ctrl[15].size = 3 ; |
| 938 | state->Init_Ctrl[15].addr[0] = 147; |
| 939 | state->Init_Ctrl[15].bit[0] = 2; |
| 940 | state->Init_Ctrl[15].val[0] = 0; |
| 941 | state->Init_Ctrl[15].addr[1] = 147; |
| 942 | state->Init_Ctrl[15].bit[1] = 3; |
| 943 | state->Init_Ctrl[15].val[1] = 1; |
| 944 | state->Init_Ctrl[15].addr[2] = 147; |
| 945 | state->Init_Ctrl[15].bit[2] = 4; |
| 946 | state->Init_Ctrl[15].val[2] = 1; |
Steven Toth | 52c99bd | 2008-05-01 04:57:01 -0300 | [diff] [blame] | 947 | |
Steven Toth | 3935c25 | 2008-05-01 05:45:44 -0300 | [diff] [blame] | 948 | state->Init_Ctrl[16].Ctrl_Num = I_DRIVER ; |
| 949 | state->Init_Ctrl[16].size = 2 ; |
| 950 | state->Init_Ctrl[16].addr[0] = 147; |
| 951 | state->Init_Ctrl[16].bit[0] = 0; |
| 952 | state->Init_Ctrl[16].val[0] = 0; |
| 953 | state->Init_Ctrl[16].addr[1] = 147; |
| 954 | state->Init_Ctrl[16].bit[1] = 1; |
| 955 | state->Init_Ctrl[16].val[1] = 1; |
Steven Toth | 52c99bd | 2008-05-01 04:57:01 -0300 | [diff] [blame] | 956 | |
Steven Toth | 3935c25 | 2008-05-01 05:45:44 -0300 | [diff] [blame] | 957 | state->Init_Ctrl[17].Ctrl_Num = EN_AAF ; |
| 958 | state->Init_Ctrl[17].size = 1 ; |
| 959 | state->Init_Ctrl[17].addr[0] = 147; |
| 960 | state->Init_Ctrl[17].bit[0] = 7; |
| 961 | state->Init_Ctrl[17].val[0] = 0; |
Steven Toth | 52c99bd | 2008-05-01 04:57:01 -0300 | [diff] [blame] | 962 | |
Steven Toth | 3935c25 | 2008-05-01 05:45:44 -0300 | [diff] [blame] | 963 | state->Init_Ctrl[18].Ctrl_Num = EN_3P ; |
| 964 | state->Init_Ctrl[18].size = 1 ; |
| 965 | state->Init_Ctrl[18].addr[0] = 147; |
| 966 | state->Init_Ctrl[18].bit[0] = 6; |
| 967 | state->Init_Ctrl[18].val[0] = 0; |
Steven Toth | 52c99bd | 2008-05-01 04:57:01 -0300 | [diff] [blame] | 968 | |
Steven Toth | 3935c25 | 2008-05-01 05:45:44 -0300 | [diff] [blame] | 969 | state->Init_Ctrl[19].Ctrl_Num = EN_AUX_3P ; |
| 970 | state->Init_Ctrl[19].size = 1 ; |
| 971 | state->Init_Ctrl[19].addr[0] = 156; |
| 972 | state->Init_Ctrl[19].bit[0] = 0; |
| 973 | state->Init_Ctrl[19].val[0] = 0; |
Steven Toth | 52c99bd | 2008-05-01 04:57:01 -0300 | [diff] [blame] | 974 | |
Steven Toth | 3935c25 | 2008-05-01 05:45:44 -0300 | [diff] [blame] | 975 | state->Init_Ctrl[20].Ctrl_Num = SEL_AAF_BAND ; |
| 976 | state->Init_Ctrl[20].size = 1 ; |
| 977 | state->Init_Ctrl[20].addr[0] = 147; |
| 978 | state->Init_Ctrl[20].bit[0] = 5; |
| 979 | state->Init_Ctrl[20].val[0] = 0; |
Steven Toth | 52c99bd | 2008-05-01 04:57:01 -0300 | [diff] [blame] | 980 | |
Steven Toth | 3935c25 | 2008-05-01 05:45:44 -0300 | [diff] [blame] | 981 | state->Init_Ctrl[21].Ctrl_Num = SEQ_ENCLK16_CLK_OUT ; |
| 982 | state->Init_Ctrl[21].size = 1 ; |
| 983 | state->Init_Ctrl[21].addr[0] = 137; |
| 984 | state->Init_Ctrl[21].bit[0] = 4; |
| 985 | state->Init_Ctrl[21].val[0] = 0; |
Steven Toth | 52c99bd | 2008-05-01 04:57:01 -0300 | [diff] [blame] | 986 | |
Steven Toth | 3935c25 | 2008-05-01 05:45:44 -0300 | [diff] [blame] | 987 | state->Init_Ctrl[22].Ctrl_Num = SEQ_SEL4_16B ; |
| 988 | state->Init_Ctrl[22].size = 1 ; |
| 989 | state->Init_Ctrl[22].addr[0] = 137; |
| 990 | state->Init_Ctrl[22].bit[0] = 7; |
| 991 | state->Init_Ctrl[22].val[0] = 0; |
Steven Toth | 52c99bd | 2008-05-01 04:57:01 -0300 | [diff] [blame] | 992 | |
Steven Toth | 3935c25 | 2008-05-01 05:45:44 -0300 | [diff] [blame] | 993 | state->Init_Ctrl[23].Ctrl_Num = XTAL_CAPSELECT ; |
| 994 | state->Init_Ctrl[23].size = 1 ; |
| 995 | state->Init_Ctrl[23].addr[0] = 91; |
| 996 | state->Init_Ctrl[23].bit[0] = 5; |
| 997 | state->Init_Ctrl[23].val[0] = 1; |
Steven Toth | 52c99bd | 2008-05-01 04:57:01 -0300 | [diff] [blame] | 998 | |
Steven Toth | 3935c25 | 2008-05-01 05:45:44 -0300 | [diff] [blame] | 999 | state->Init_Ctrl[24].Ctrl_Num = IF_SEL_DBL ; |
| 1000 | state->Init_Ctrl[24].size = 1 ; |
| 1001 | state->Init_Ctrl[24].addr[0] = 43; |
| 1002 | state->Init_Ctrl[24].bit[0] = 0; |
| 1003 | state->Init_Ctrl[24].val[0] = 1; |
Steven Toth | 52c99bd | 2008-05-01 04:57:01 -0300 | [diff] [blame] | 1004 | |
Steven Toth | 3935c25 | 2008-05-01 05:45:44 -0300 | [diff] [blame] | 1005 | state->Init_Ctrl[25].Ctrl_Num = RFSYN_R_DIV ; |
| 1006 | state->Init_Ctrl[25].size = 2 ; |
| 1007 | state->Init_Ctrl[25].addr[0] = 22; |
| 1008 | state->Init_Ctrl[25].bit[0] = 0; |
| 1009 | state->Init_Ctrl[25].val[0] = 1; |
| 1010 | state->Init_Ctrl[25].addr[1] = 22; |
| 1011 | state->Init_Ctrl[25].bit[1] = 1; |
| 1012 | state->Init_Ctrl[25].val[1] = 1; |
Steven Toth | 52c99bd | 2008-05-01 04:57:01 -0300 | [diff] [blame] | 1013 | |
Steven Toth | 3935c25 | 2008-05-01 05:45:44 -0300 | [diff] [blame] | 1014 | state->Init_Ctrl[26].Ctrl_Num = SEQ_EXTSYNTHCALIF ; |
| 1015 | state->Init_Ctrl[26].size = 1 ; |
| 1016 | state->Init_Ctrl[26].addr[0] = 134; |
| 1017 | state->Init_Ctrl[26].bit[0] = 2; |
| 1018 | state->Init_Ctrl[26].val[0] = 0; |
Steven Toth | 52c99bd | 2008-05-01 04:57:01 -0300 | [diff] [blame] | 1019 | |
Steven Toth | 3935c25 | 2008-05-01 05:45:44 -0300 | [diff] [blame] | 1020 | state->Init_Ctrl[27].Ctrl_Num = SEQ_EXTDCCAL ; |
| 1021 | state->Init_Ctrl[27].size = 1 ; |
| 1022 | state->Init_Ctrl[27].addr[0] = 137; |
| 1023 | state->Init_Ctrl[27].bit[0] = 3; |
| 1024 | state->Init_Ctrl[27].val[0] = 0; |
Steven Toth | 52c99bd | 2008-05-01 04:57:01 -0300 | [diff] [blame] | 1025 | |
Steven Toth | 3935c25 | 2008-05-01 05:45:44 -0300 | [diff] [blame] | 1026 | state->Init_Ctrl[28].Ctrl_Num = AGC_EN_RSSI ; |
| 1027 | state->Init_Ctrl[28].size = 1 ; |
| 1028 | state->Init_Ctrl[28].addr[0] = 77; |
| 1029 | state->Init_Ctrl[28].bit[0] = 7; |
| 1030 | state->Init_Ctrl[28].val[0] = 0; |
Steven Toth | 52c99bd | 2008-05-01 04:57:01 -0300 | [diff] [blame] | 1031 | |
Steven Toth | 3935c25 | 2008-05-01 05:45:44 -0300 | [diff] [blame] | 1032 | state->Init_Ctrl[29].Ctrl_Num = RFA_ENCLKRFAGC ; |
| 1033 | state->Init_Ctrl[29].size = 1 ; |
| 1034 | state->Init_Ctrl[29].addr[0] = 166; |
| 1035 | state->Init_Ctrl[29].bit[0] = 7; |
| 1036 | state->Init_Ctrl[29].val[0] = 1; |
Steven Toth | 52c99bd | 2008-05-01 04:57:01 -0300 | [diff] [blame] | 1037 | |
Steven Toth | 3935c25 | 2008-05-01 05:45:44 -0300 | [diff] [blame] | 1038 | state->Init_Ctrl[30].Ctrl_Num = RFA_RSSI_REFH ; |
| 1039 | state->Init_Ctrl[30].size = 3 ; |
| 1040 | state->Init_Ctrl[30].addr[0] = 166; |
| 1041 | state->Init_Ctrl[30].bit[0] = 0; |
| 1042 | state->Init_Ctrl[30].val[0] = 0; |
| 1043 | state->Init_Ctrl[30].addr[1] = 166; |
| 1044 | state->Init_Ctrl[30].bit[1] = 1; |
| 1045 | state->Init_Ctrl[30].val[1] = 1; |
| 1046 | state->Init_Ctrl[30].addr[2] = 166; |
| 1047 | state->Init_Ctrl[30].bit[2] = 2; |
| 1048 | state->Init_Ctrl[30].val[2] = 1; |
Steven Toth | 52c99bd | 2008-05-01 04:57:01 -0300 | [diff] [blame] | 1049 | |
Steven Toth | 3935c25 | 2008-05-01 05:45:44 -0300 | [diff] [blame] | 1050 | state->Init_Ctrl[31].Ctrl_Num = RFA_RSSI_REF ; |
| 1051 | state->Init_Ctrl[31].size = 3 ; |
| 1052 | state->Init_Ctrl[31].addr[0] = 166; |
| 1053 | state->Init_Ctrl[31].bit[0] = 3; |
| 1054 | state->Init_Ctrl[31].val[0] = 1; |
| 1055 | state->Init_Ctrl[31].addr[1] = 166; |
| 1056 | state->Init_Ctrl[31].bit[1] = 4; |
| 1057 | state->Init_Ctrl[31].val[1] = 0; |
| 1058 | state->Init_Ctrl[31].addr[2] = 166; |
| 1059 | state->Init_Ctrl[31].bit[2] = 5; |
| 1060 | state->Init_Ctrl[31].val[2] = 1; |
Steven Toth | 52c99bd | 2008-05-01 04:57:01 -0300 | [diff] [blame] | 1061 | |
Steven Toth | 3935c25 | 2008-05-01 05:45:44 -0300 | [diff] [blame] | 1062 | state->Init_Ctrl[32].Ctrl_Num = RFA_RSSI_REFL ; |
| 1063 | state->Init_Ctrl[32].size = 3 ; |
| 1064 | state->Init_Ctrl[32].addr[0] = 167; |
| 1065 | state->Init_Ctrl[32].bit[0] = 0; |
| 1066 | state->Init_Ctrl[32].val[0] = 1; |
| 1067 | state->Init_Ctrl[32].addr[1] = 167; |
| 1068 | state->Init_Ctrl[32].bit[1] = 1; |
| 1069 | state->Init_Ctrl[32].val[1] = 1; |
| 1070 | state->Init_Ctrl[32].addr[2] = 167; |
| 1071 | state->Init_Ctrl[32].bit[2] = 2; |
| 1072 | state->Init_Ctrl[32].val[2] = 0; |
Steven Toth | 52c99bd | 2008-05-01 04:57:01 -0300 | [diff] [blame] | 1073 | |
Steven Toth | 3935c25 | 2008-05-01 05:45:44 -0300 | [diff] [blame] | 1074 | state->Init_Ctrl[33].Ctrl_Num = RFA_FLR ; |
| 1075 | state->Init_Ctrl[33].size = 4 ; |
| 1076 | state->Init_Ctrl[33].addr[0] = 168; |
| 1077 | state->Init_Ctrl[33].bit[0] = 0; |
| 1078 | state->Init_Ctrl[33].val[0] = 0; |
| 1079 | state->Init_Ctrl[33].addr[1] = 168; |
| 1080 | state->Init_Ctrl[33].bit[1] = 1; |
| 1081 | state->Init_Ctrl[33].val[1] = 1; |
| 1082 | state->Init_Ctrl[33].addr[2] = 168; |
| 1083 | state->Init_Ctrl[33].bit[2] = 2; |
| 1084 | state->Init_Ctrl[33].val[2] = 0; |
| 1085 | state->Init_Ctrl[33].addr[3] = 168; |
| 1086 | state->Init_Ctrl[33].bit[3] = 3; |
| 1087 | state->Init_Ctrl[33].val[3] = 0; |
Steven Toth | 52c99bd | 2008-05-01 04:57:01 -0300 | [diff] [blame] | 1088 | |
Steven Toth | 3935c25 | 2008-05-01 05:45:44 -0300 | [diff] [blame] | 1089 | state->Init_Ctrl[34].Ctrl_Num = RFA_CEIL ; |
| 1090 | state->Init_Ctrl[34].size = 4 ; |
| 1091 | state->Init_Ctrl[34].addr[0] = 168; |
| 1092 | state->Init_Ctrl[34].bit[0] = 4; |
| 1093 | state->Init_Ctrl[34].val[0] = 1; |
| 1094 | state->Init_Ctrl[34].addr[1] = 168; |
| 1095 | state->Init_Ctrl[34].bit[1] = 5; |
| 1096 | state->Init_Ctrl[34].val[1] = 1; |
| 1097 | state->Init_Ctrl[34].addr[2] = 168; |
| 1098 | state->Init_Ctrl[34].bit[2] = 6; |
| 1099 | state->Init_Ctrl[34].val[2] = 1; |
| 1100 | state->Init_Ctrl[34].addr[3] = 168; |
| 1101 | state->Init_Ctrl[34].bit[3] = 7; |
| 1102 | state->Init_Ctrl[34].val[3] = 1; |
Steven Toth | 52c99bd | 2008-05-01 04:57:01 -0300 | [diff] [blame] | 1103 | |
Steven Toth | 3935c25 | 2008-05-01 05:45:44 -0300 | [diff] [blame] | 1104 | state->Init_Ctrl[35].Ctrl_Num = SEQ_EXTIQFSMPULSE ; |
| 1105 | state->Init_Ctrl[35].size = 1 ; |
| 1106 | state->Init_Ctrl[35].addr[0] = 135; |
| 1107 | state->Init_Ctrl[35].bit[0] = 0; |
| 1108 | state->Init_Ctrl[35].val[0] = 0; |
Steven Toth | 52c99bd | 2008-05-01 04:57:01 -0300 | [diff] [blame] | 1109 | |
Steven Toth | 3935c25 | 2008-05-01 05:45:44 -0300 | [diff] [blame] | 1110 | state->Init_Ctrl[36].Ctrl_Num = OVERRIDE_1 ; |
| 1111 | state->Init_Ctrl[36].size = 1 ; |
| 1112 | state->Init_Ctrl[36].addr[0] = 56; |
| 1113 | state->Init_Ctrl[36].bit[0] = 3; |
| 1114 | state->Init_Ctrl[36].val[0] = 0; |
Steven Toth | 52c99bd | 2008-05-01 04:57:01 -0300 | [diff] [blame] | 1115 | |
Steven Toth | 3935c25 | 2008-05-01 05:45:44 -0300 | [diff] [blame] | 1116 | state->Init_Ctrl[37].Ctrl_Num = BB_INITSTATE_DLPF_TUNE ; |
| 1117 | state->Init_Ctrl[37].size = 7 ; |
| 1118 | state->Init_Ctrl[37].addr[0] = 59; |
| 1119 | state->Init_Ctrl[37].bit[0] = 1; |
| 1120 | state->Init_Ctrl[37].val[0] = 0; |
| 1121 | state->Init_Ctrl[37].addr[1] = 59; |
| 1122 | state->Init_Ctrl[37].bit[1] = 2; |
| 1123 | state->Init_Ctrl[37].val[1] = 0; |
| 1124 | state->Init_Ctrl[37].addr[2] = 59; |
| 1125 | state->Init_Ctrl[37].bit[2] = 3; |
| 1126 | state->Init_Ctrl[37].val[2] = 0; |
| 1127 | state->Init_Ctrl[37].addr[3] = 59; |
| 1128 | state->Init_Ctrl[37].bit[3] = 4; |
| 1129 | state->Init_Ctrl[37].val[3] = 0; |
| 1130 | state->Init_Ctrl[37].addr[4] = 59; |
| 1131 | state->Init_Ctrl[37].bit[4] = 5; |
| 1132 | state->Init_Ctrl[37].val[4] = 0; |
| 1133 | state->Init_Ctrl[37].addr[5] = 59; |
| 1134 | state->Init_Ctrl[37].bit[5] = 6; |
| 1135 | state->Init_Ctrl[37].val[5] = 0; |
| 1136 | state->Init_Ctrl[37].addr[6] = 59; |
| 1137 | state->Init_Ctrl[37].bit[6] = 7; |
| 1138 | state->Init_Ctrl[37].val[6] = 0; |
Steven Toth | 52c99bd | 2008-05-01 04:57:01 -0300 | [diff] [blame] | 1139 | |
Steven Toth | 3935c25 | 2008-05-01 05:45:44 -0300 | [diff] [blame] | 1140 | state->Init_Ctrl[38].Ctrl_Num = TG_R_DIV ; |
| 1141 | state->Init_Ctrl[38].size = 6 ; |
| 1142 | state->Init_Ctrl[38].addr[0] = 32; |
| 1143 | state->Init_Ctrl[38].bit[0] = 2; |
| 1144 | state->Init_Ctrl[38].val[0] = 0; |
| 1145 | state->Init_Ctrl[38].addr[1] = 32; |
| 1146 | state->Init_Ctrl[38].bit[1] = 3; |
| 1147 | state->Init_Ctrl[38].val[1] = 0; |
| 1148 | state->Init_Ctrl[38].addr[2] = 32; |
| 1149 | state->Init_Ctrl[38].bit[2] = 4; |
| 1150 | state->Init_Ctrl[38].val[2] = 0; |
| 1151 | state->Init_Ctrl[38].addr[3] = 32; |
| 1152 | state->Init_Ctrl[38].bit[3] = 5; |
| 1153 | state->Init_Ctrl[38].val[3] = 0; |
| 1154 | state->Init_Ctrl[38].addr[4] = 32; |
| 1155 | state->Init_Ctrl[38].bit[4] = 6; |
| 1156 | state->Init_Ctrl[38].val[4] = 1; |
| 1157 | state->Init_Ctrl[38].addr[5] = 32; |
| 1158 | state->Init_Ctrl[38].bit[5] = 7; |
| 1159 | state->Init_Ctrl[38].val[5] = 0; |
Steven Toth | 52c99bd | 2008-05-01 04:57:01 -0300 | [diff] [blame] | 1160 | |
Steven Toth | 3935c25 | 2008-05-01 05:45:44 -0300 | [diff] [blame] | 1161 | state->Init_Ctrl[39].Ctrl_Num = EN_CHP_LIN_B ; |
| 1162 | state->Init_Ctrl[39].size = 1 ; |
| 1163 | state->Init_Ctrl[39].addr[0] = 25; |
| 1164 | state->Init_Ctrl[39].bit[0] = 3; |
| 1165 | state->Init_Ctrl[39].val[0] = 1; |
Steven Toth | 52c99bd | 2008-05-01 04:57:01 -0300 | [diff] [blame] | 1166 | |
| 1167 | |
Steven Toth | 3935c25 | 2008-05-01 05:45:44 -0300 | [diff] [blame] | 1168 | state->CH_Ctrl_Num = CHCTRL_NUM ; |
Steven Toth | 52c99bd | 2008-05-01 04:57:01 -0300 | [diff] [blame] | 1169 | |
Steven Toth | 3935c25 | 2008-05-01 05:45:44 -0300 | [diff] [blame] | 1170 | state->CH_Ctrl[0].Ctrl_Num = DN_POLY ; |
| 1171 | state->CH_Ctrl[0].size = 2 ; |
| 1172 | state->CH_Ctrl[0].addr[0] = 68; |
| 1173 | state->CH_Ctrl[0].bit[0] = 6; |
| 1174 | state->CH_Ctrl[0].val[0] = 1; |
| 1175 | state->CH_Ctrl[0].addr[1] = 68; |
| 1176 | state->CH_Ctrl[0].bit[1] = 7; |
| 1177 | state->CH_Ctrl[0].val[1] = 1; |
Steven Toth | 52c99bd | 2008-05-01 04:57:01 -0300 | [diff] [blame] | 1178 | |
Steven Toth | 3935c25 | 2008-05-01 05:45:44 -0300 | [diff] [blame] | 1179 | state->CH_Ctrl[1].Ctrl_Num = DN_RFGAIN ; |
| 1180 | state->CH_Ctrl[1].size = 2 ; |
| 1181 | state->CH_Ctrl[1].addr[0] = 70; |
| 1182 | state->CH_Ctrl[1].bit[0] = 6; |
| 1183 | state->CH_Ctrl[1].val[0] = 1; |
| 1184 | state->CH_Ctrl[1].addr[1] = 70; |
| 1185 | state->CH_Ctrl[1].bit[1] = 7; |
| 1186 | state->CH_Ctrl[1].val[1] = 0; |
Steven Toth | 52c99bd | 2008-05-01 04:57:01 -0300 | [diff] [blame] | 1187 | |
Steven Toth | 3935c25 | 2008-05-01 05:45:44 -0300 | [diff] [blame] | 1188 | state->CH_Ctrl[2].Ctrl_Num = DN_CAP_RFLPF ; |
| 1189 | state->CH_Ctrl[2].size = 9 ; |
| 1190 | state->CH_Ctrl[2].addr[0] = 69; |
| 1191 | state->CH_Ctrl[2].bit[0] = 5; |
| 1192 | state->CH_Ctrl[2].val[0] = 0; |
| 1193 | state->CH_Ctrl[2].addr[1] = 69; |
| 1194 | state->CH_Ctrl[2].bit[1] = 6; |
| 1195 | state->CH_Ctrl[2].val[1] = 0; |
| 1196 | state->CH_Ctrl[2].addr[2] = 69; |
| 1197 | state->CH_Ctrl[2].bit[2] = 7; |
| 1198 | state->CH_Ctrl[2].val[2] = 0; |
| 1199 | state->CH_Ctrl[2].addr[3] = 68; |
| 1200 | state->CH_Ctrl[2].bit[3] = 0; |
| 1201 | state->CH_Ctrl[2].val[3] = 0; |
| 1202 | state->CH_Ctrl[2].addr[4] = 68; |
| 1203 | state->CH_Ctrl[2].bit[4] = 1; |
| 1204 | state->CH_Ctrl[2].val[4] = 0; |
| 1205 | state->CH_Ctrl[2].addr[5] = 68; |
| 1206 | state->CH_Ctrl[2].bit[5] = 2; |
| 1207 | state->CH_Ctrl[2].val[5] = 0; |
| 1208 | state->CH_Ctrl[2].addr[6] = 68; |
| 1209 | state->CH_Ctrl[2].bit[6] = 3; |
| 1210 | state->CH_Ctrl[2].val[6] = 0; |
| 1211 | state->CH_Ctrl[2].addr[7] = 68; |
| 1212 | state->CH_Ctrl[2].bit[7] = 4; |
| 1213 | state->CH_Ctrl[2].val[7] = 0; |
| 1214 | state->CH_Ctrl[2].addr[8] = 68; |
| 1215 | state->CH_Ctrl[2].bit[8] = 5; |
| 1216 | state->CH_Ctrl[2].val[8] = 0; |
Steven Toth | 52c99bd | 2008-05-01 04:57:01 -0300 | [diff] [blame] | 1217 | |
Steven Toth | 3935c25 | 2008-05-01 05:45:44 -0300 | [diff] [blame] | 1218 | state->CH_Ctrl[3].Ctrl_Num = DN_EN_VHFUHFBAR ; |
| 1219 | state->CH_Ctrl[3].size = 1 ; |
| 1220 | state->CH_Ctrl[3].addr[0] = 70; |
| 1221 | state->CH_Ctrl[3].bit[0] = 5; |
| 1222 | state->CH_Ctrl[3].val[0] = 0; |
Steven Toth | 52c99bd | 2008-05-01 04:57:01 -0300 | [diff] [blame] | 1223 | |
Steven Toth | 3935c25 | 2008-05-01 05:45:44 -0300 | [diff] [blame] | 1224 | state->CH_Ctrl[4].Ctrl_Num = DN_GAIN_ADJUST ; |
| 1225 | state->CH_Ctrl[4].size = 3 ; |
| 1226 | state->CH_Ctrl[4].addr[0] = 73; |
| 1227 | state->CH_Ctrl[4].bit[0] = 4; |
| 1228 | state->CH_Ctrl[4].val[0] = 0; |
| 1229 | state->CH_Ctrl[4].addr[1] = 73; |
| 1230 | state->CH_Ctrl[4].bit[1] = 5; |
| 1231 | state->CH_Ctrl[4].val[1] = 1; |
| 1232 | state->CH_Ctrl[4].addr[2] = 73; |
| 1233 | state->CH_Ctrl[4].bit[2] = 6; |
| 1234 | state->CH_Ctrl[4].val[2] = 0; |
Steven Toth | 52c99bd | 2008-05-01 04:57:01 -0300 | [diff] [blame] | 1235 | |
Steven Toth | 3935c25 | 2008-05-01 05:45:44 -0300 | [diff] [blame] | 1236 | state->CH_Ctrl[5].Ctrl_Num = DN_IQTNBUF_AMP ; |
| 1237 | state->CH_Ctrl[5].size = 4 ; |
| 1238 | state->CH_Ctrl[5].addr[0] = 70; |
| 1239 | state->CH_Ctrl[5].bit[0] = 0; |
| 1240 | state->CH_Ctrl[5].val[0] = 0; |
| 1241 | state->CH_Ctrl[5].addr[1] = 70; |
| 1242 | state->CH_Ctrl[5].bit[1] = 1; |
| 1243 | state->CH_Ctrl[5].val[1] = 0; |
| 1244 | state->CH_Ctrl[5].addr[2] = 70; |
| 1245 | state->CH_Ctrl[5].bit[2] = 2; |
| 1246 | state->CH_Ctrl[5].val[2] = 0; |
| 1247 | state->CH_Ctrl[5].addr[3] = 70; |
| 1248 | state->CH_Ctrl[5].bit[3] = 3; |
| 1249 | state->CH_Ctrl[5].val[3] = 0; |
Steven Toth | 52c99bd | 2008-05-01 04:57:01 -0300 | [diff] [blame] | 1250 | |
Steven Toth | 3935c25 | 2008-05-01 05:45:44 -0300 | [diff] [blame] | 1251 | state->CH_Ctrl[6].Ctrl_Num = DN_IQTNGNBFBIAS_BST ; |
| 1252 | state->CH_Ctrl[6].size = 1 ; |
| 1253 | state->CH_Ctrl[6].addr[0] = 70; |
| 1254 | state->CH_Ctrl[6].bit[0] = 4; |
| 1255 | state->CH_Ctrl[6].val[0] = 1; |
Steven Toth | 52c99bd | 2008-05-01 04:57:01 -0300 | [diff] [blame] | 1256 | |
Steven Toth | 3935c25 | 2008-05-01 05:45:44 -0300 | [diff] [blame] | 1257 | state->CH_Ctrl[7].Ctrl_Num = RFSYN_EN_OUTMUX ; |
| 1258 | state->CH_Ctrl[7].size = 1 ; |
| 1259 | state->CH_Ctrl[7].addr[0] = 111; |
| 1260 | state->CH_Ctrl[7].bit[0] = 4; |
| 1261 | state->CH_Ctrl[7].val[0] = 0; |
Steven Toth | 52c99bd | 2008-05-01 04:57:01 -0300 | [diff] [blame] | 1262 | |
Steven Toth | 3935c25 | 2008-05-01 05:45:44 -0300 | [diff] [blame] | 1263 | state->CH_Ctrl[8].Ctrl_Num = RFSYN_SEL_VCO_OUT ; |
| 1264 | state->CH_Ctrl[8].size = 1 ; |
| 1265 | state->CH_Ctrl[8].addr[0] = 111; |
| 1266 | state->CH_Ctrl[8].bit[0] = 7; |
| 1267 | state->CH_Ctrl[8].val[0] = 1; |
Steven Toth | 52c99bd | 2008-05-01 04:57:01 -0300 | [diff] [blame] | 1268 | |
Steven Toth | 3935c25 | 2008-05-01 05:45:44 -0300 | [diff] [blame] | 1269 | state->CH_Ctrl[9].Ctrl_Num = RFSYN_SEL_VCO_HI ; |
| 1270 | state->CH_Ctrl[9].size = 1 ; |
| 1271 | state->CH_Ctrl[9].addr[0] = 111; |
| 1272 | state->CH_Ctrl[9].bit[0] = 6; |
| 1273 | state->CH_Ctrl[9].val[0] = 1; |
Steven Toth | 52c99bd | 2008-05-01 04:57:01 -0300 | [diff] [blame] | 1274 | |
Steven Toth | 3935c25 | 2008-05-01 05:45:44 -0300 | [diff] [blame] | 1275 | state->CH_Ctrl[10].Ctrl_Num = RFSYN_SEL_DIVM ; |
| 1276 | state->CH_Ctrl[10].size = 1 ; |
| 1277 | state->CH_Ctrl[10].addr[0] = 111; |
| 1278 | state->CH_Ctrl[10].bit[0] = 5; |
| 1279 | state->CH_Ctrl[10].val[0] = 0; |
Steven Toth | 52c99bd | 2008-05-01 04:57:01 -0300 | [diff] [blame] | 1280 | |
Steven Toth | 3935c25 | 2008-05-01 05:45:44 -0300 | [diff] [blame] | 1281 | state->CH_Ctrl[11].Ctrl_Num = RFSYN_RF_DIV_BIAS ; |
| 1282 | state->CH_Ctrl[11].size = 2 ; |
| 1283 | state->CH_Ctrl[11].addr[0] = 110; |
| 1284 | state->CH_Ctrl[11].bit[0] = 0; |
| 1285 | state->CH_Ctrl[11].val[0] = 1; |
| 1286 | state->CH_Ctrl[11].addr[1] = 110; |
| 1287 | state->CH_Ctrl[11].bit[1] = 1; |
| 1288 | state->CH_Ctrl[11].val[1] = 0; |
Steven Toth | 52c99bd | 2008-05-01 04:57:01 -0300 | [diff] [blame] | 1289 | |
Steven Toth | 3935c25 | 2008-05-01 05:45:44 -0300 | [diff] [blame] | 1290 | state->CH_Ctrl[12].Ctrl_Num = DN_SEL_FREQ ; |
| 1291 | state->CH_Ctrl[12].size = 3 ; |
| 1292 | state->CH_Ctrl[12].addr[0] = 69; |
| 1293 | state->CH_Ctrl[12].bit[0] = 2; |
| 1294 | state->CH_Ctrl[12].val[0] = 0; |
| 1295 | state->CH_Ctrl[12].addr[1] = 69; |
| 1296 | state->CH_Ctrl[12].bit[1] = 3; |
| 1297 | state->CH_Ctrl[12].val[1] = 0; |
| 1298 | state->CH_Ctrl[12].addr[2] = 69; |
| 1299 | state->CH_Ctrl[12].bit[2] = 4; |
| 1300 | state->CH_Ctrl[12].val[2] = 0; |
Steven Toth | 52c99bd | 2008-05-01 04:57:01 -0300 | [diff] [blame] | 1301 | |
Steven Toth | 3935c25 | 2008-05-01 05:45:44 -0300 | [diff] [blame] | 1302 | state->CH_Ctrl[13].Ctrl_Num = RFSYN_VCO_BIAS ; |
| 1303 | state->CH_Ctrl[13].size = 6 ; |
| 1304 | state->CH_Ctrl[13].addr[0] = 110; |
| 1305 | state->CH_Ctrl[13].bit[0] = 2; |
| 1306 | state->CH_Ctrl[13].val[0] = 0; |
| 1307 | state->CH_Ctrl[13].addr[1] = 110; |
| 1308 | state->CH_Ctrl[13].bit[1] = 3; |
| 1309 | state->CH_Ctrl[13].val[1] = 0; |
| 1310 | state->CH_Ctrl[13].addr[2] = 110; |
| 1311 | state->CH_Ctrl[13].bit[2] = 4; |
| 1312 | state->CH_Ctrl[13].val[2] = 0; |
| 1313 | state->CH_Ctrl[13].addr[3] = 110; |
| 1314 | state->CH_Ctrl[13].bit[3] = 5; |
| 1315 | state->CH_Ctrl[13].val[3] = 0; |
| 1316 | state->CH_Ctrl[13].addr[4] = 110; |
| 1317 | state->CH_Ctrl[13].bit[4] = 6; |
| 1318 | state->CH_Ctrl[13].val[4] = 0; |
| 1319 | state->CH_Ctrl[13].addr[5] = 110; |
| 1320 | state->CH_Ctrl[13].bit[5] = 7; |
| 1321 | state->CH_Ctrl[13].val[5] = 1; |
Steven Toth | 52c99bd | 2008-05-01 04:57:01 -0300 | [diff] [blame] | 1322 | |
Steven Toth | 3935c25 | 2008-05-01 05:45:44 -0300 | [diff] [blame] | 1323 | state->CH_Ctrl[14].Ctrl_Num = CHCAL_INT_MOD_RF ; |
| 1324 | state->CH_Ctrl[14].size = 7 ; |
| 1325 | state->CH_Ctrl[14].addr[0] = 14; |
| 1326 | state->CH_Ctrl[14].bit[0] = 0; |
| 1327 | state->CH_Ctrl[14].val[0] = 0; |
| 1328 | state->CH_Ctrl[14].addr[1] = 14; |
| 1329 | state->CH_Ctrl[14].bit[1] = 1; |
| 1330 | state->CH_Ctrl[14].val[1] = 0; |
| 1331 | state->CH_Ctrl[14].addr[2] = 14; |
| 1332 | state->CH_Ctrl[14].bit[2] = 2; |
| 1333 | state->CH_Ctrl[14].val[2] = 0; |
| 1334 | state->CH_Ctrl[14].addr[3] = 14; |
| 1335 | state->CH_Ctrl[14].bit[3] = 3; |
| 1336 | state->CH_Ctrl[14].val[3] = 0; |
| 1337 | state->CH_Ctrl[14].addr[4] = 14; |
| 1338 | state->CH_Ctrl[14].bit[4] = 4; |
| 1339 | state->CH_Ctrl[14].val[4] = 0; |
| 1340 | state->CH_Ctrl[14].addr[5] = 14; |
| 1341 | state->CH_Ctrl[14].bit[5] = 5; |
| 1342 | state->CH_Ctrl[14].val[5] = 0; |
| 1343 | state->CH_Ctrl[14].addr[6] = 14; |
| 1344 | state->CH_Ctrl[14].bit[6] = 6; |
| 1345 | state->CH_Ctrl[14].val[6] = 0; |
Steven Toth | 52c99bd | 2008-05-01 04:57:01 -0300 | [diff] [blame] | 1346 | |
Steven Toth | 3935c25 | 2008-05-01 05:45:44 -0300 | [diff] [blame] | 1347 | state->CH_Ctrl[15].Ctrl_Num = CHCAL_FRAC_MOD_RF ; |
| 1348 | state->CH_Ctrl[15].size = 18 ; |
| 1349 | state->CH_Ctrl[15].addr[0] = 17; |
| 1350 | state->CH_Ctrl[15].bit[0] = 6; |
| 1351 | state->CH_Ctrl[15].val[0] = 0; |
| 1352 | state->CH_Ctrl[15].addr[1] = 17; |
| 1353 | state->CH_Ctrl[15].bit[1] = 7; |
| 1354 | state->CH_Ctrl[15].val[1] = 0; |
| 1355 | state->CH_Ctrl[15].addr[2] = 16; |
| 1356 | state->CH_Ctrl[15].bit[2] = 0; |
| 1357 | state->CH_Ctrl[15].val[2] = 0; |
| 1358 | state->CH_Ctrl[15].addr[3] = 16; |
| 1359 | state->CH_Ctrl[15].bit[3] = 1; |
| 1360 | state->CH_Ctrl[15].val[3] = 0; |
| 1361 | state->CH_Ctrl[15].addr[4] = 16; |
| 1362 | state->CH_Ctrl[15].bit[4] = 2; |
| 1363 | state->CH_Ctrl[15].val[4] = 0; |
| 1364 | state->CH_Ctrl[15].addr[5] = 16; |
| 1365 | state->CH_Ctrl[15].bit[5] = 3; |
| 1366 | state->CH_Ctrl[15].val[5] = 0; |
| 1367 | state->CH_Ctrl[15].addr[6] = 16; |
| 1368 | state->CH_Ctrl[15].bit[6] = 4; |
| 1369 | state->CH_Ctrl[15].val[6] = 0; |
| 1370 | state->CH_Ctrl[15].addr[7] = 16; |
| 1371 | state->CH_Ctrl[15].bit[7] = 5; |
| 1372 | state->CH_Ctrl[15].val[7] = 0; |
| 1373 | state->CH_Ctrl[15].addr[8] = 16; |
| 1374 | state->CH_Ctrl[15].bit[8] = 6; |
| 1375 | state->CH_Ctrl[15].val[8] = 0; |
| 1376 | state->CH_Ctrl[15].addr[9] = 16; |
| 1377 | state->CH_Ctrl[15].bit[9] = 7; |
| 1378 | state->CH_Ctrl[15].val[9] = 0; |
| 1379 | state->CH_Ctrl[15].addr[10] = 15; |
| 1380 | state->CH_Ctrl[15].bit[10] = 0; |
| 1381 | state->CH_Ctrl[15].val[10] = 0; |
| 1382 | state->CH_Ctrl[15].addr[11] = 15; |
| 1383 | state->CH_Ctrl[15].bit[11] = 1; |
| 1384 | state->CH_Ctrl[15].val[11] = 0; |
| 1385 | state->CH_Ctrl[15].addr[12] = 15; |
| 1386 | state->CH_Ctrl[15].bit[12] = 2; |
| 1387 | state->CH_Ctrl[15].val[12] = 0; |
| 1388 | state->CH_Ctrl[15].addr[13] = 15; |
| 1389 | state->CH_Ctrl[15].bit[13] = 3; |
| 1390 | state->CH_Ctrl[15].val[13] = 0; |
| 1391 | state->CH_Ctrl[15].addr[14] = 15; |
| 1392 | state->CH_Ctrl[15].bit[14] = 4; |
| 1393 | state->CH_Ctrl[15].val[14] = 0; |
| 1394 | state->CH_Ctrl[15].addr[15] = 15; |
| 1395 | state->CH_Ctrl[15].bit[15] = 5; |
| 1396 | state->CH_Ctrl[15].val[15] = 0; |
| 1397 | state->CH_Ctrl[15].addr[16] = 15; |
| 1398 | state->CH_Ctrl[15].bit[16] = 6; |
| 1399 | state->CH_Ctrl[15].val[16] = 1; |
| 1400 | state->CH_Ctrl[15].addr[17] = 15; |
| 1401 | state->CH_Ctrl[15].bit[17] = 7; |
| 1402 | state->CH_Ctrl[15].val[17] = 1; |
Steven Toth | 52c99bd | 2008-05-01 04:57:01 -0300 | [diff] [blame] | 1403 | |
Steven Toth | 3935c25 | 2008-05-01 05:45:44 -0300 | [diff] [blame] | 1404 | state->CH_Ctrl[16].Ctrl_Num = RFSYN_LPF_R ; |
| 1405 | state->CH_Ctrl[16].size = 5 ; |
| 1406 | state->CH_Ctrl[16].addr[0] = 112; |
| 1407 | state->CH_Ctrl[16].bit[0] = 0; |
| 1408 | state->CH_Ctrl[16].val[0] = 0; |
| 1409 | state->CH_Ctrl[16].addr[1] = 112; |
| 1410 | state->CH_Ctrl[16].bit[1] = 1; |
| 1411 | state->CH_Ctrl[16].val[1] = 0; |
| 1412 | state->CH_Ctrl[16].addr[2] = 112; |
| 1413 | state->CH_Ctrl[16].bit[2] = 2; |
| 1414 | state->CH_Ctrl[16].val[2] = 0; |
| 1415 | state->CH_Ctrl[16].addr[3] = 112; |
| 1416 | state->CH_Ctrl[16].bit[3] = 3; |
| 1417 | state->CH_Ctrl[16].val[3] = 0; |
| 1418 | state->CH_Ctrl[16].addr[4] = 112; |
| 1419 | state->CH_Ctrl[16].bit[4] = 4; |
| 1420 | state->CH_Ctrl[16].val[4] = 1; |
Steven Toth | 52c99bd | 2008-05-01 04:57:01 -0300 | [diff] [blame] | 1421 | |
Steven Toth | 3935c25 | 2008-05-01 05:45:44 -0300 | [diff] [blame] | 1422 | state->CH_Ctrl[17].Ctrl_Num = CHCAL_EN_INT_RF ; |
| 1423 | state->CH_Ctrl[17].size = 1 ; |
| 1424 | state->CH_Ctrl[17].addr[0] = 14; |
| 1425 | state->CH_Ctrl[17].bit[0] = 7; |
| 1426 | state->CH_Ctrl[17].val[0] = 0; |
Steven Toth | 52c99bd | 2008-05-01 04:57:01 -0300 | [diff] [blame] | 1427 | |
Steven Toth | 3935c25 | 2008-05-01 05:45:44 -0300 | [diff] [blame] | 1428 | state->CH_Ctrl[18].Ctrl_Num = TG_LO_DIVVAL ; |
| 1429 | state->CH_Ctrl[18].size = 4 ; |
| 1430 | state->CH_Ctrl[18].addr[0] = 107; |
| 1431 | state->CH_Ctrl[18].bit[0] = 3; |
| 1432 | state->CH_Ctrl[18].val[0] = 0; |
| 1433 | state->CH_Ctrl[18].addr[1] = 107; |
| 1434 | state->CH_Ctrl[18].bit[1] = 4; |
| 1435 | state->CH_Ctrl[18].val[1] = 0; |
| 1436 | state->CH_Ctrl[18].addr[2] = 107; |
| 1437 | state->CH_Ctrl[18].bit[2] = 5; |
| 1438 | state->CH_Ctrl[18].val[2] = 0; |
| 1439 | state->CH_Ctrl[18].addr[3] = 107; |
| 1440 | state->CH_Ctrl[18].bit[3] = 6; |
| 1441 | state->CH_Ctrl[18].val[3] = 0; |
Steven Toth | 52c99bd | 2008-05-01 04:57:01 -0300 | [diff] [blame] | 1442 | |
Steven Toth | 3935c25 | 2008-05-01 05:45:44 -0300 | [diff] [blame] | 1443 | state->CH_Ctrl[19].Ctrl_Num = TG_LO_SELVAL ; |
| 1444 | state->CH_Ctrl[19].size = 3 ; |
| 1445 | state->CH_Ctrl[19].addr[0] = 107; |
| 1446 | state->CH_Ctrl[19].bit[0] = 7; |
| 1447 | state->CH_Ctrl[19].val[0] = 1; |
| 1448 | state->CH_Ctrl[19].addr[1] = 106; |
| 1449 | state->CH_Ctrl[19].bit[1] = 0; |
| 1450 | state->CH_Ctrl[19].val[1] = 1; |
| 1451 | state->CH_Ctrl[19].addr[2] = 106; |
| 1452 | state->CH_Ctrl[19].bit[2] = 1; |
| 1453 | state->CH_Ctrl[19].val[2] = 1; |
Steven Toth | 52c99bd | 2008-05-01 04:57:01 -0300 | [diff] [blame] | 1454 | |
Steven Toth | 3935c25 | 2008-05-01 05:45:44 -0300 | [diff] [blame] | 1455 | state->CH_Ctrl[20].Ctrl_Num = TG_DIV_VAL ; |
| 1456 | state->CH_Ctrl[20].size = 11 ; |
| 1457 | state->CH_Ctrl[20].addr[0] = 109; |
| 1458 | state->CH_Ctrl[20].bit[0] = 2; |
| 1459 | state->CH_Ctrl[20].val[0] = 0; |
| 1460 | state->CH_Ctrl[20].addr[1] = 109; |
| 1461 | state->CH_Ctrl[20].bit[1] = 3; |
| 1462 | state->CH_Ctrl[20].val[1] = 0; |
| 1463 | state->CH_Ctrl[20].addr[2] = 109; |
| 1464 | state->CH_Ctrl[20].bit[2] = 4; |
| 1465 | state->CH_Ctrl[20].val[2] = 0; |
| 1466 | state->CH_Ctrl[20].addr[3] = 109; |
| 1467 | state->CH_Ctrl[20].bit[3] = 5; |
| 1468 | state->CH_Ctrl[20].val[3] = 0; |
| 1469 | state->CH_Ctrl[20].addr[4] = 109; |
| 1470 | state->CH_Ctrl[20].bit[4] = 6; |
| 1471 | state->CH_Ctrl[20].val[4] = 0; |
| 1472 | state->CH_Ctrl[20].addr[5] = 109; |
| 1473 | state->CH_Ctrl[20].bit[5] = 7; |
| 1474 | state->CH_Ctrl[20].val[5] = 0; |
| 1475 | state->CH_Ctrl[20].addr[6] = 108; |
| 1476 | state->CH_Ctrl[20].bit[6] = 0; |
| 1477 | state->CH_Ctrl[20].val[6] = 0; |
| 1478 | state->CH_Ctrl[20].addr[7] = 108; |
| 1479 | state->CH_Ctrl[20].bit[7] = 1; |
| 1480 | state->CH_Ctrl[20].val[7] = 0; |
| 1481 | state->CH_Ctrl[20].addr[8] = 108; |
| 1482 | state->CH_Ctrl[20].bit[8] = 2; |
| 1483 | state->CH_Ctrl[20].val[8] = 1; |
| 1484 | state->CH_Ctrl[20].addr[9] = 108; |
| 1485 | state->CH_Ctrl[20].bit[9] = 3; |
| 1486 | state->CH_Ctrl[20].val[9] = 1; |
| 1487 | state->CH_Ctrl[20].addr[10] = 108; |
| 1488 | state->CH_Ctrl[20].bit[10] = 4; |
| 1489 | state->CH_Ctrl[20].val[10] = 1; |
Steven Toth | 52c99bd | 2008-05-01 04:57:01 -0300 | [diff] [blame] | 1490 | |
Steven Toth | 3935c25 | 2008-05-01 05:45:44 -0300 | [diff] [blame] | 1491 | state->CH_Ctrl[21].Ctrl_Num = TG_VCO_BIAS ; |
| 1492 | state->CH_Ctrl[21].size = 6 ; |
| 1493 | state->CH_Ctrl[21].addr[0] = 106; |
| 1494 | state->CH_Ctrl[21].bit[0] = 2; |
| 1495 | state->CH_Ctrl[21].val[0] = 0; |
| 1496 | state->CH_Ctrl[21].addr[1] = 106; |
| 1497 | state->CH_Ctrl[21].bit[1] = 3; |
| 1498 | state->CH_Ctrl[21].val[1] = 0; |
| 1499 | state->CH_Ctrl[21].addr[2] = 106; |
| 1500 | state->CH_Ctrl[21].bit[2] = 4; |
| 1501 | state->CH_Ctrl[21].val[2] = 0; |
| 1502 | state->CH_Ctrl[21].addr[3] = 106; |
| 1503 | state->CH_Ctrl[21].bit[3] = 5; |
| 1504 | state->CH_Ctrl[21].val[3] = 0; |
| 1505 | state->CH_Ctrl[21].addr[4] = 106; |
| 1506 | state->CH_Ctrl[21].bit[4] = 6; |
| 1507 | state->CH_Ctrl[21].val[4] = 0; |
| 1508 | state->CH_Ctrl[21].addr[5] = 106; |
| 1509 | state->CH_Ctrl[21].bit[5] = 7; |
| 1510 | state->CH_Ctrl[21].val[5] = 1; |
Steven Toth | 52c99bd | 2008-05-01 04:57:01 -0300 | [diff] [blame] | 1511 | |
Steven Toth | 3935c25 | 2008-05-01 05:45:44 -0300 | [diff] [blame] | 1512 | state->CH_Ctrl[22].Ctrl_Num = SEQ_EXTPOWERUP ; |
| 1513 | state->CH_Ctrl[22].size = 1 ; |
| 1514 | state->CH_Ctrl[22].addr[0] = 138; |
| 1515 | state->CH_Ctrl[22].bit[0] = 4; |
| 1516 | state->CH_Ctrl[22].val[0] = 1; |
Steven Toth | 52c99bd | 2008-05-01 04:57:01 -0300 | [diff] [blame] | 1517 | |
Steven Toth | 3935c25 | 2008-05-01 05:45:44 -0300 | [diff] [blame] | 1518 | state->CH_Ctrl[23].Ctrl_Num = OVERRIDE_2 ; |
| 1519 | state->CH_Ctrl[23].size = 1 ; |
| 1520 | state->CH_Ctrl[23].addr[0] = 17; |
| 1521 | state->CH_Ctrl[23].bit[0] = 5; |
| 1522 | state->CH_Ctrl[23].val[0] = 0; |
Steven Toth | 52c99bd | 2008-05-01 04:57:01 -0300 | [diff] [blame] | 1523 | |
Steven Toth | 3935c25 | 2008-05-01 05:45:44 -0300 | [diff] [blame] | 1524 | state->CH_Ctrl[24].Ctrl_Num = OVERRIDE_3 ; |
| 1525 | state->CH_Ctrl[24].size = 1 ; |
| 1526 | state->CH_Ctrl[24].addr[0] = 111; |
| 1527 | state->CH_Ctrl[24].bit[0] = 3; |
| 1528 | state->CH_Ctrl[24].val[0] = 0; |
Steven Toth | 52c99bd | 2008-05-01 04:57:01 -0300 | [diff] [blame] | 1529 | |
Steven Toth | 3935c25 | 2008-05-01 05:45:44 -0300 | [diff] [blame] | 1530 | state->CH_Ctrl[25].Ctrl_Num = OVERRIDE_4 ; |
| 1531 | state->CH_Ctrl[25].size = 1 ; |
| 1532 | state->CH_Ctrl[25].addr[0] = 112; |
| 1533 | state->CH_Ctrl[25].bit[0] = 7; |
| 1534 | state->CH_Ctrl[25].val[0] = 0; |
Steven Toth | 52c99bd | 2008-05-01 04:57:01 -0300 | [diff] [blame] | 1535 | |
Steven Toth | 3935c25 | 2008-05-01 05:45:44 -0300 | [diff] [blame] | 1536 | state->CH_Ctrl[26].Ctrl_Num = SEQ_FSM_PULSE ; |
| 1537 | state->CH_Ctrl[26].size = 1 ; |
| 1538 | state->CH_Ctrl[26].addr[0] = 136; |
| 1539 | state->CH_Ctrl[26].bit[0] = 7; |
| 1540 | state->CH_Ctrl[26].val[0] = 0; |
Steven Toth | 52c99bd | 2008-05-01 04:57:01 -0300 | [diff] [blame] | 1541 | |
Steven Toth | 3935c25 | 2008-05-01 05:45:44 -0300 | [diff] [blame] | 1542 | state->CH_Ctrl[27].Ctrl_Num = GPIO_4B ; |
| 1543 | state->CH_Ctrl[27].size = 1 ; |
| 1544 | state->CH_Ctrl[27].addr[0] = 149; |
| 1545 | state->CH_Ctrl[27].bit[0] = 7; |
| 1546 | state->CH_Ctrl[27].val[0] = 0; |
Steven Toth | 52c99bd | 2008-05-01 04:57:01 -0300 | [diff] [blame] | 1547 | |
Steven Toth | 3935c25 | 2008-05-01 05:45:44 -0300 | [diff] [blame] | 1548 | state->CH_Ctrl[28].Ctrl_Num = GPIO_3B ; |
| 1549 | state->CH_Ctrl[28].size = 1 ; |
| 1550 | state->CH_Ctrl[28].addr[0] = 149; |
| 1551 | state->CH_Ctrl[28].bit[0] = 6; |
| 1552 | state->CH_Ctrl[28].val[0] = 0; |
Steven Toth | 52c99bd | 2008-05-01 04:57:01 -0300 | [diff] [blame] | 1553 | |
Steven Toth | 3935c25 | 2008-05-01 05:45:44 -0300 | [diff] [blame] | 1554 | state->CH_Ctrl[29].Ctrl_Num = GPIO_4 ; |
| 1555 | state->CH_Ctrl[29].size = 1 ; |
| 1556 | state->CH_Ctrl[29].addr[0] = 149; |
| 1557 | state->CH_Ctrl[29].bit[0] = 5; |
| 1558 | state->CH_Ctrl[29].val[0] = 1; |
Steven Toth | 52c99bd | 2008-05-01 04:57:01 -0300 | [diff] [blame] | 1559 | |
Steven Toth | 3935c25 | 2008-05-01 05:45:44 -0300 | [diff] [blame] | 1560 | state->CH_Ctrl[30].Ctrl_Num = GPIO_3 ; |
| 1561 | state->CH_Ctrl[30].size = 1 ; |
| 1562 | state->CH_Ctrl[30].addr[0] = 149; |
| 1563 | state->CH_Ctrl[30].bit[0] = 4; |
| 1564 | state->CH_Ctrl[30].val[0] = 1; |
Steven Toth | 52c99bd | 2008-05-01 04:57:01 -0300 | [diff] [blame] | 1565 | |
Steven Toth | 3935c25 | 2008-05-01 05:45:44 -0300 | [diff] [blame] | 1566 | state->CH_Ctrl[31].Ctrl_Num = GPIO_1B ; |
| 1567 | state->CH_Ctrl[31].size = 1 ; |
| 1568 | state->CH_Ctrl[31].addr[0] = 149; |
| 1569 | state->CH_Ctrl[31].bit[0] = 3; |
| 1570 | state->CH_Ctrl[31].val[0] = 0; |
Steven Toth | 52c99bd | 2008-05-01 04:57:01 -0300 | [diff] [blame] | 1571 | |
Steven Toth | 3935c25 | 2008-05-01 05:45:44 -0300 | [diff] [blame] | 1572 | state->CH_Ctrl[32].Ctrl_Num = DAC_A_ENABLE ; |
| 1573 | state->CH_Ctrl[32].size = 1 ; |
| 1574 | state->CH_Ctrl[32].addr[0] = 93; |
| 1575 | state->CH_Ctrl[32].bit[0] = 1; |
| 1576 | state->CH_Ctrl[32].val[0] = 0; |
Steven Toth | 52c99bd | 2008-05-01 04:57:01 -0300 | [diff] [blame] | 1577 | |
Steven Toth | 3935c25 | 2008-05-01 05:45:44 -0300 | [diff] [blame] | 1578 | state->CH_Ctrl[33].Ctrl_Num = DAC_B_ENABLE ; |
| 1579 | state->CH_Ctrl[33].size = 1 ; |
| 1580 | state->CH_Ctrl[33].addr[0] = 93; |
| 1581 | state->CH_Ctrl[33].bit[0] = 0; |
| 1582 | state->CH_Ctrl[33].val[0] = 0; |
Steven Toth | 52c99bd | 2008-05-01 04:57:01 -0300 | [diff] [blame] | 1583 | |
Steven Toth | 3935c25 | 2008-05-01 05:45:44 -0300 | [diff] [blame] | 1584 | state->CH_Ctrl[34].Ctrl_Num = DAC_DIN_A ; |
| 1585 | state->CH_Ctrl[34].size = 6 ; |
| 1586 | state->CH_Ctrl[34].addr[0] = 92; |
| 1587 | state->CH_Ctrl[34].bit[0] = 2; |
| 1588 | state->CH_Ctrl[34].val[0] = 0; |
| 1589 | state->CH_Ctrl[34].addr[1] = 92; |
| 1590 | state->CH_Ctrl[34].bit[1] = 3; |
| 1591 | state->CH_Ctrl[34].val[1] = 0; |
| 1592 | state->CH_Ctrl[34].addr[2] = 92; |
| 1593 | state->CH_Ctrl[34].bit[2] = 4; |
| 1594 | state->CH_Ctrl[34].val[2] = 0; |
| 1595 | state->CH_Ctrl[34].addr[3] = 92; |
| 1596 | state->CH_Ctrl[34].bit[3] = 5; |
| 1597 | state->CH_Ctrl[34].val[3] = 0; |
| 1598 | state->CH_Ctrl[34].addr[4] = 92; |
| 1599 | state->CH_Ctrl[34].bit[4] = 6; |
| 1600 | state->CH_Ctrl[34].val[4] = 0; |
| 1601 | state->CH_Ctrl[34].addr[5] = 92; |
| 1602 | state->CH_Ctrl[34].bit[5] = 7; |
| 1603 | state->CH_Ctrl[34].val[5] = 0; |
Steven Toth | 52c99bd | 2008-05-01 04:57:01 -0300 | [diff] [blame] | 1604 | |
Steven Toth | 3935c25 | 2008-05-01 05:45:44 -0300 | [diff] [blame] | 1605 | state->CH_Ctrl[35].Ctrl_Num = DAC_DIN_B ; |
| 1606 | state->CH_Ctrl[35].size = 6 ; |
| 1607 | state->CH_Ctrl[35].addr[0] = 93; |
| 1608 | state->CH_Ctrl[35].bit[0] = 2; |
| 1609 | state->CH_Ctrl[35].val[0] = 0; |
| 1610 | state->CH_Ctrl[35].addr[1] = 93; |
| 1611 | state->CH_Ctrl[35].bit[1] = 3; |
| 1612 | state->CH_Ctrl[35].val[1] = 0; |
| 1613 | state->CH_Ctrl[35].addr[2] = 93; |
| 1614 | state->CH_Ctrl[35].bit[2] = 4; |
| 1615 | state->CH_Ctrl[35].val[2] = 0; |
| 1616 | state->CH_Ctrl[35].addr[3] = 93; |
| 1617 | state->CH_Ctrl[35].bit[3] = 5; |
| 1618 | state->CH_Ctrl[35].val[3] = 0; |
| 1619 | state->CH_Ctrl[35].addr[4] = 93; |
| 1620 | state->CH_Ctrl[35].bit[4] = 6; |
| 1621 | state->CH_Ctrl[35].val[4] = 0; |
| 1622 | state->CH_Ctrl[35].addr[5] = 93; |
| 1623 | state->CH_Ctrl[35].bit[5] = 7; |
| 1624 | state->CH_Ctrl[35].val[5] = 0; |
Steven Toth | 52c99bd | 2008-05-01 04:57:01 -0300 | [diff] [blame] | 1625 | |
| 1626 | #ifdef _MXL_PRODUCTION |
Steven Toth | 3935c25 | 2008-05-01 05:45:44 -0300 | [diff] [blame] | 1627 | state->CH_Ctrl[36].Ctrl_Num = RFSYN_EN_DIV ; |
| 1628 | state->CH_Ctrl[36].size = 1 ; |
| 1629 | state->CH_Ctrl[36].addr[0] = 109; |
| 1630 | state->CH_Ctrl[36].bit[0] = 1; |
| 1631 | state->CH_Ctrl[36].val[0] = 1; |
Steven Toth | 52c99bd | 2008-05-01 04:57:01 -0300 | [diff] [blame] | 1632 | |
Steven Toth | 3935c25 | 2008-05-01 05:45:44 -0300 | [diff] [blame] | 1633 | state->CH_Ctrl[37].Ctrl_Num = RFSYN_DIVM ; |
| 1634 | state->CH_Ctrl[37].size = 2 ; |
| 1635 | state->CH_Ctrl[37].addr[0] = 112; |
| 1636 | state->CH_Ctrl[37].bit[0] = 5; |
| 1637 | state->CH_Ctrl[37].val[0] = 0; |
| 1638 | state->CH_Ctrl[37].addr[1] = 112; |
| 1639 | state->CH_Ctrl[37].bit[1] = 6; |
| 1640 | state->CH_Ctrl[37].val[1] = 0; |
Steven Toth | 52c99bd | 2008-05-01 04:57:01 -0300 | [diff] [blame] | 1641 | |
Steven Toth | 3935c25 | 2008-05-01 05:45:44 -0300 | [diff] [blame] | 1642 | state->CH_Ctrl[38].Ctrl_Num = DN_BYPASS_AGC_I2C ; |
| 1643 | state->CH_Ctrl[38].size = 1 ; |
| 1644 | state->CH_Ctrl[38].addr[0] = 65; |
| 1645 | state->CH_Ctrl[38].bit[0] = 1; |
| 1646 | state->CH_Ctrl[38].val[0] = 0; |
Steven Toth | 52c99bd | 2008-05-01 04:57:01 -0300 | [diff] [blame] | 1647 | #endif |
| 1648 | |
| 1649 | return 0 ; |
| 1650 | } |
| 1651 | |
Steven Toth | 52c99bd | 2008-05-01 04:57:01 -0300 | [diff] [blame] | 1652 | // MaxLinear source code - MXL5005_c.cpp |
Steven Toth | 52c99bd | 2008-05-01 04:57:01 -0300 | [diff] [blame] | 1653 | // MXL5005.cpp : Defines the initialization routines for the DLL. |
| 1654 | // 2.6.12 |
Steven Toth | 3935c25 | 2008-05-01 05:45:44 -0300 | [diff] [blame] | 1655 | void InitTunerControls(struct dvb_frontend *fe) |
Steven Toth | 52c99bd | 2008-05-01 04:57:01 -0300 | [diff] [blame] | 1656 | { |
Steven Toth | 3935c25 | 2008-05-01 05:45:44 -0300 | [diff] [blame] | 1657 | MXL5005_RegisterInit(fe); |
| 1658 | MXL5005_ControlInit(fe); |
Steven Toth | 52c99bd | 2008-05-01 04:57:01 -0300 | [diff] [blame] | 1659 | #ifdef _MXL_INTERNAL |
Steven Toth | 3935c25 | 2008-05-01 05:45:44 -0300 | [diff] [blame] | 1660 | MXL5005_MXLControlInit(fe); |
Steven Toth | 52c99bd | 2008-05-01 04:57:01 -0300 | [diff] [blame] | 1661 | #endif |
| 1662 | } |
| 1663 | |
Steven Toth | 52c99bd | 2008-05-01 04:57:01 -0300 | [diff] [blame] | 1664 | /////////////////////////////////////////////////////////////////////////////// |
| 1665 | // // |
| 1666 | // Function: MXL_ConfigTuner // |
| 1667 | // // |
| 1668 | // Description: Configure MXL5005Tuner structure for desired // |
| 1669 | // Channel Bandwidth/Channel Frequency // |
| 1670 | // // |
| 1671 | // // |
| 1672 | // Functions used: // |
Steven Toth | a8214d4 | 2008-05-01 05:02:58 -0300 | [diff] [blame] | 1673 | // MXL_SynthIFLO_Calc // |
Steven Toth | 52c99bd | 2008-05-01 04:57:01 -0300 | [diff] [blame] | 1674 | // // |
| 1675 | // Inputs: // |
| 1676 | // Tuner_struct: structure defined at higher level // |
| 1677 | // Mode: Tuner Mode (Analog/Digital) // |
| 1678 | // IF_Mode: IF Mode ( Zero/Low ) // |
Steven Toth | 3935c25 | 2008-05-01 05:45:44 -0300 | [diff] [blame] | 1679 | // Bandwidth: Filter Channel Bandwidth (in Hz) // |
Steven Toth | 52c99bd | 2008-05-01 04:57:01 -0300 | [diff] [blame] | 1680 | // IF_out: Desired IF out Frequency (in Hz) // |
| 1681 | // Fxtal: Crystal Frerquency (in Hz) // |
Steven Toth | 3935c25 | 2008-05-01 05:45:44 -0300 | [diff] [blame] | 1682 | // TOP: 0: Dual AGC; Value: take over point // |
| 1683 | // IF_OUT_LOAD: IF out load resistor (200/300 Ohms) // |
| 1684 | // CLOCK_OUT: 0: Turn off clock out; 1: turn on clock out // |
| 1685 | // DIV_OUT: 0: Div-1; 1: Div-4 // |
| 1686 | // CAPSELECT: 0: Disable On-chip pulling cap; 1: Enable // |
| 1687 | // EN_RSSI: 0: Disable RSSI; 1: Enable RSSI // |
Steven Toth | 52c99bd | 2008-05-01 04:57:01 -0300 | [diff] [blame] | 1688 | // // |
| 1689 | // Outputs: // |
| 1690 | // Tuner // |
| 1691 | // // |
| 1692 | // Return: // |
| 1693 | // 0 : Successful // |
| 1694 | // > 0 : Failed // |
| 1695 | // // |
| 1696 | /////////////////////////////////////////////////////////////////////////////// |
Steven Toth | 3935c25 | 2008-05-01 05:45:44 -0300 | [diff] [blame] | 1697 | u16 MXL5005_TunerConfig(struct dvb_frontend *fe, |
| 1698 | u8 Mode, /* 0: Analog Mode ; 1: Digital Mode */ |
| 1699 | u8 IF_mode, /* for Analog Mode, 0: zero IF; 1: low IF */ |
| 1700 | u32 Bandwidth, /* filter channel bandwidth (6, 7, 8) */ |
| 1701 | u32 IF_out, /* Desired IF Out Frequency */ |
| 1702 | u32 Fxtal, /* XTAL Frequency */ |
| 1703 | u8 AGC_Mode, /* AGC Mode - Dual AGC: 0, Single AGC: 1 */ |
| 1704 | u16 TOP, /* 0: Dual AGC; Value: take over point */ |
| 1705 | u16 IF_OUT_LOAD, /* IF Out Load Resistor (200 / 300 Ohms) */ |
| 1706 | u8 CLOCK_OUT, /* 0: turn off clock out; 1: turn on clock out */ |
| 1707 | u8 DIV_OUT, /* 0: Div-1; 1: Div-4 */ |
| 1708 | u8 CAPSELECT, /* 0: disable On-Chip pulling cap; 1: enable */ |
| 1709 | u8 EN_RSSI, /* 0: disable RSSI; 1: enable RSSI */ |
| 1710 | u8 Mod_Type, /* Modulation Type; */ |
| 1711 | /* 0 - Default; 1 - DVB-T; 2 - ATSC; 3 - QAM; 4 - Analog Cable */ |
| 1712 | u8 TF_Type /* Tracking Filter */ |
| 1713 | /* 0 - Default; 1 - Off; 2 - Type C; 3 - Type C-H */ |
Steven Toth | 52c99bd | 2008-05-01 04:57:01 -0300 | [diff] [blame] | 1714 | ) |
| 1715 | { |
Steven Toth | 85d220d | 2008-05-01 05:48:14 -0300 | [diff] [blame] | 1716 | struct mxl5005s_state *state = fe->tuner_priv; |
Steven Toth | 3935c25 | 2008-05-01 05:45:44 -0300 | [diff] [blame] | 1717 | u16 status = 0; |
Steven Toth | 52c99bd | 2008-05-01 04:57:01 -0300 | [diff] [blame] | 1718 | |
Steven Toth | 3935c25 | 2008-05-01 05:45:44 -0300 | [diff] [blame] | 1719 | state->Mode = Mode; |
| 1720 | state->IF_Mode = IF_mode; |
| 1721 | state->Chan_Bandwidth = Bandwidth; |
| 1722 | state->IF_OUT = IF_out; |
| 1723 | state->Fxtal = Fxtal; |
| 1724 | state->AGC_Mode = AGC_Mode; |
| 1725 | state->TOP = TOP; |
| 1726 | state->IF_OUT_LOAD = IF_OUT_LOAD; |
| 1727 | state->CLOCK_OUT = CLOCK_OUT; |
| 1728 | state->DIV_OUT = DIV_OUT; |
| 1729 | state->CAPSELECT = CAPSELECT; |
| 1730 | state->EN_RSSI = EN_RSSI; |
| 1731 | state->Mod_Type = Mod_Type; |
| 1732 | state->TF_Type = TF_Type; |
Steven Toth | 52c99bd | 2008-05-01 04:57:01 -0300 | [diff] [blame] | 1733 | |
Steven Toth | a8214d4 | 2008-05-01 05:02:58 -0300 | [diff] [blame] | 1734 | /* Initialize all the controls and registers */ |
Steven Toth | 3935c25 | 2008-05-01 05:45:44 -0300 | [diff] [blame] | 1735 | InitTunerControls(fe); |
Steven Toth | a8214d4 | 2008-05-01 05:02:58 -0300 | [diff] [blame] | 1736 | |
| 1737 | /* Synthesizer LO frequency calculation */ |
Steven Toth | 3935c25 | 2008-05-01 05:45:44 -0300 | [diff] [blame] | 1738 | MXL_SynthIFLO_Calc(fe); |
Steven Toth | 52c99bd | 2008-05-01 04:57:01 -0300 | [diff] [blame] | 1739 | |
Steven Toth | 3935c25 | 2008-05-01 05:45:44 -0300 | [diff] [blame] | 1740 | return status; |
Steven Toth | 52c99bd | 2008-05-01 04:57:01 -0300 | [diff] [blame] | 1741 | } |
| 1742 | |
| 1743 | /////////////////////////////////////////////////////////////////////////////// |
| 1744 | // // |
| 1745 | // Function: MXL_SynthIFLO_Calc // |
| 1746 | // // |
| 1747 | // Description: Calculate Internal IF-LO Frequency // |
| 1748 | // // |
| 1749 | // Globals: // |
| 1750 | // NONE // |
| 1751 | // // |
| 1752 | // Functions used: // |
| 1753 | // NONE // |
| 1754 | // // |
| 1755 | // Inputs: // |
| 1756 | // Tuner_struct: structure defined at higher level // |
| 1757 | // // |
| 1758 | // Outputs: // |
| 1759 | // Tuner // |
| 1760 | // // |
| 1761 | // Return: // |
| 1762 | // 0 : Successful // |
| 1763 | // > 0 : Failed // |
| 1764 | // // |
| 1765 | /////////////////////////////////////////////////////////////////////////////// |
Steven Toth | 3935c25 | 2008-05-01 05:45:44 -0300 | [diff] [blame] | 1766 | void MXL_SynthIFLO_Calc(struct dvb_frontend *fe) |
Steven Toth | 52c99bd | 2008-05-01 04:57:01 -0300 | [diff] [blame] | 1767 | { |
Steven Toth | 85d220d | 2008-05-01 05:48:14 -0300 | [diff] [blame] | 1768 | struct mxl5005s_state *state = fe->tuner_priv; |
| 1769 | if (state->Mode == 1) /* Digital Mode */ |
Steven Toth | 3935c25 | 2008-05-01 05:45:44 -0300 | [diff] [blame] | 1770 | state->IF_LO = state->IF_OUT; |
| 1771 | else /* Analog Mode */ |
Steven Toth | 52c99bd | 2008-05-01 04:57:01 -0300 | [diff] [blame] | 1772 | { |
Steven Toth | 3935c25 | 2008-05-01 05:45:44 -0300 | [diff] [blame] | 1773 | if(state->IF_Mode == 0) /* Analog Zero IF mode */ |
| 1774 | state->IF_LO = state->IF_OUT + 400000; |
| 1775 | else /* Analog Low IF mode */ |
| 1776 | state->IF_LO = state->IF_OUT + state->Chan_Bandwidth/2; |
Steven Toth | 52c99bd | 2008-05-01 04:57:01 -0300 | [diff] [blame] | 1777 | } |
| 1778 | } |
| 1779 | |
| 1780 | /////////////////////////////////////////////////////////////////////////////// |
| 1781 | // // |
| 1782 | // Function: MXL_SynthRFTGLO_Calc // |
| 1783 | // // |
| 1784 | // Description: Calculate Internal RF-LO frequency and // |
| 1785 | // internal Tone-Gen(TG)-LO frequency // |
| 1786 | // // |
| 1787 | // Globals: // |
| 1788 | // NONE // |
| 1789 | // // |
| 1790 | // Functions used: // |
| 1791 | // NONE // |
| 1792 | // // |
| 1793 | // Inputs: // |
| 1794 | // Tuner_struct: structure defined at higher level // |
| 1795 | // // |
| 1796 | // Outputs: // |
| 1797 | // Tuner // |
| 1798 | // // |
| 1799 | // Return: // |
| 1800 | // 0 : Successful // |
| 1801 | // > 0 : Failed // |
| 1802 | // // |
| 1803 | /////////////////////////////////////////////////////////////////////////////// |
Steven Toth | 3935c25 | 2008-05-01 05:45:44 -0300 | [diff] [blame] | 1804 | void MXL_SynthRFTGLO_Calc(struct dvb_frontend *fe) |
Steven Toth | 52c99bd | 2008-05-01 04:57:01 -0300 | [diff] [blame] | 1805 | { |
Steven Toth | 85d220d | 2008-05-01 05:48:14 -0300 | [diff] [blame] | 1806 | struct mxl5005s_state *state = fe->tuner_priv; |
Steven Toth | 3935c25 | 2008-05-01 05:45:44 -0300 | [diff] [blame] | 1807 | |
| 1808 | if (state->Mode == 1) /* Digital Mode */ { |
Steven Toth | 52c99bd | 2008-05-01 04:57:01 -0300 | [diff] [blame] | 1809 | //remove 20.48MHz setting for 2.6.10 |
Steven Toth | 3935c25 | 2008-05-01 05:45:44 -0300 | [diff] [blame] | 1810 | state->RF_LO = state->RF_IN; |
| 1811 | state->TG_LO = state->RF_IN - 750000; //change for 2.6.6 |
| 1812 | } else /* Analog Mode */ { |
| 1813 | if(state->IF_Mode == 0) /* Analog Zero IF mode */ { |
| 1814 | state->RF_LO = state->RF_IN - 400000; |
| 1815 | state->TG_LO = state->RF_IN - 1750000; |
| 1816 | } else /* Analog Low IF mode */ { |
| 1817 | state->RF_LO = state->RF_IN - state->Chan_Bandwidth/2; |
| 1818 | state->TG_LO = state->RF_IN - state->Chan_Bandwidth + 500000; |
Steven Toth | 52c99bd | 2008-05-01 04:57:01 -0300 | [diff] [blame] | 1819 | } |
| 1820 | } |
| 1821 | } |
| 1822 | |
| 1823 | /////////////////////////////////////////////////////////////////////////////// |
| 1824 | // // |
| 1825 | // Function: MXL_OverwriteICDefault // |
| 1826 | // // |
| 1827 | // Description: Overwrite the Default Register Setting // |
| 1828 | // // |
| 1829 | // // |
| 1830 | // Functions used: // |
| 1831 | // // |
| 1832 | // Inputs: // |
| 1833 | // Tuner_struct: structure defined at higher level // |
| 1834 | // Outputs: // |
| 1835 | // Tuner // |
| 1836 | // // |
| 1837 | // Return: // |
| 1838 | // 0 : Successful // |
| 1839 | // > 0 : Failed // |
| 1840 | // // |
| 1841 | /////////////////////////////////////////////////////////////////////////////// |
Steven Toth | 3935c25 | 2008-05-01 05:45:44 -0300 | [diff] [blame] | 1842 | u16 MXL_OverwriteICDefault(struct dvb_frontend *fe) |
Steven Toth | 52c99bd | 2008-05-01 04:57:01 -0300 | [diff] [blame] | 1843 | { |
Steven Toth | 3935c25 | 2008-05-01 05:45:44 -0300 | [diff] [blame] | 1844 | u16 status = 0; |
Steven Toth | 52c99bd | 2008-05-01 04:57:01 -0300 | [diff] [blame] | 1845 | |
Steven Toth | 3935c25 | 2008-05-01 05:45:44 -0300 | [diff] [blame] | 1846 | status += MXL_ControlWrite(fe, OVERRIDE_1, 1); |
| 1847 | status += MXL_ControlWrite(fe, OVERRIDE_2, 1); |
| 1848 | status += MXL_ControlWrite(fe, OVERRIDE_3, 1); |
| 1849 | status += MXL_ControlWrite(fe, OVERRIDE_4, 1); |
Steven Toth | 52c99bd | 2008-05-01 04:57:01 -0300 | [diff] [blame] | 1850 | |
Steven Toth | 3935c25 | 2008-05-01 05:45:44 -0300 | [diff] [blame] | 1851 | return status; |
Steven Toth | 52c99bd | 2008-05-01 04:57:01 -0300 | [diff] [blame] | 1852 | } |
| 1853 | |
| 1854 | /////////////////////////////////////////////////////////////////////////////// |
| 1855 | // // |
| 1856 | // Function: MXL_BlockInit // |
| 1857 | // // |
| 1858 | // Description: Tuner Initialization as a function of 'User Settings' // |
| 1859 | // * User settings in Tuner strcuture must be assigned // |
| 1860 | // first // |
| 1861 | // // |
| 1862 | // Globals: // |
| 1863 | // NONE // |
| 1864 | // // |
| 1865 | // Functions used: // |
| 1866 | // Tuner_struct: structure defined at higher level // |
| 1867 | // // |
| 1868 | // Inputs: // |
| 1869 | // Tuner : Tuner structure defined at higher level // |
| 1870 | // // |
| 1871 | // Outputs: // |
| 1872 | // Tuner // |
| 1873 | // // |
| 1874 | // Return: // |
| 1875 | // 0 : Successful // |
| 1876 | // > 0 : Failed // |
| 1877 | // // |
| 1878 | /////////////////////////////////////////////////////////////////////////////// |
Steven Toth | 3935c25 | 2008-05-01 05:45:44 -0300 | [diff] [blame] | 1879 | u16 MXL_BlockInit(struct dvb_frontend *fe) |
Steven Toth | 52c99bd | 2008-05-01 04:57:01 -0300 | [diff] [blame] | 1880 | { |
Steven Toth | 85d220d | 2008-05-01 05:48:14 -0300 | [diff] [blame] | 1881 | struct mxl5005s_state *state = fe->tuner_priv; |
Steven Toth | 3935c25 | 2008-05-01 05:45:44 -0300 | [diff] [blame] | 1882 | u16 status = 0; |
Steven Toth | 52c99bd | 2008-05-01 04:57:01 -0300 | [diff] [blame] | 1883 | |
Steven Toth | 3935c25 | 2008-05-01 05:45:44 -0300 | [diff] [blame] | 1884 | status += MXL_OverwriteICDefault(fe); |
Steven Toth | 52c99bd | 2008-05-01 04:57:01 -0300 | [diff] [blame] | 1885 | |
Steven Toth | 3935c25 | 2008-05-01 05:45:44 -0300 | [diff] [blame] | 1886 | /* Downconverter Control Dig Ana */ |
| 1887 | status += MXL_ControlWrite(fe, DN_IQTN_AMP_CUT, state->Mode ? 1 : 0); |
Steven Toth | 52c99bd | 2008-05-01 04:57:01 -0300 | [diff] [blame] | 1888 | |
Steven Toth | 3935c25 | 2008-05-01 05:45:44 -0300 | [diff] [blame] | 1889 | /* Filter Control Dig Ana */ |
| 1890 | status += MXL_ControlWrite(fe, BB_MODE, state->Mode ? 0 : 1); |
| 1891 | status += MXL_ControlWrite(fe, BB_BUF, state->Mode ? 3 : 2); |
| 1892 | status += MXL_ControlWrite(fe, BB_BUF_OA, state->Mode ? 1 : 0); |
| 1893 | status += MXL_ControlWrite(fe, BB_IQSWAP, state->Mode ? 0 : 1); |
| 1894 | status += MXL_ControlWrite(fe, BB_INITSTATE_DLPF_TUNE, 0); |
Steven Toth | 52c99bd | 2008-05-01 04:57:01 -0300 | [diff] [blame] | 1895 | |
Steven Toth | 3935c25 | 2008-05-01 05:45:44 -0300 | [diff] [blame] | 1896 | /* Initialize Low-Pass Filter */ |
| 1897 | if (state->Mode) { /* Digital Mode */ |
| 1898 | switch (state->Chan_Bandwidth) { |
Steven Toth | 52c99bd | 2008-05-01 04:57:01 -0300 | [diff] [blame] | 1899 | case 8000000: |
Steven Toth | 3935c25 | 2008-05-01 05:45:44 -0300 | [diff] [blame] | 1900 | status += MXL_ControlWrite(fe, BB_DLPF_BANDSEL, 0); |
| 1901 | break; |
Steven Toth | 52c99bd | 2008-05-01 04:57:01 -0300 | [diff] [blame] | 1902 | case 7000000: |
Steven Toth | 3935c25 | 2008-05-01 05:45:44 -0300 | [diff] [blame] | 1903 | status += MXL_ControlWrite(fe, BB_DLPF_BANDSEL, 2); |
| 1904 | break; |
Steven Toth | 52c99bd | 2008-05-01 04:57:01 -0300 | [diff] [blame] | 1905 | case 6000000: |
Steven Toth | 8c66a19 | 2008-05-01 06:35:48 -0300 | [diff] [blame] | 1906 | printk("%s() doing 6MHz digital\n", __func__); |
Steven Toth | 3935c25 | 2008-05-01 05:45:44 -0300 | [diff] [blame] | 1907 | status += MXL_ControlWrite(fe, BB_DLPF_BANDSEL, 3); |
| 1908 | break; |
Steven Toth | 52c99bd | 2008-05-01 04:57:01 -0300 | [diff] [blame] | 1909 | } |
Steven Toth | 3935c25 | 2008-05-01 05:45:44 -0300 | [diff] [blame] | 1910 | } else { /* Analog Mode */ |
| 1911 | switch (state->Chan_Bandwidth) { |
| 1912 | case 8000000: /* Low Zero */ |
| 1913 | status += MXL_ControlWrite(fe, BB_ALPF_BANDSELECT, (state->IF_Mode ? 0 : 3)); |
| 1914 | break; |
Steven Toth | 52c99bd | 2008-05-01 04:57:01 -0300 | [diff] [blame] | 1915 | case 7000000: |
Steven Toth | 3935c25 | 2008-05-01 05:45:44 -0300 | [diff] [blame] | 1916 | status += MXL_ControlWrite(fe, BB_ALPF_BANDSELECT, (state->IF_Mode ? 1 : 4)); |
| 1917 | break; |
Steven Toth | 52c99bd | 2008-05-01 04:57:01 -0300 | [diff] [blame] | 1918 | case 6000000: |
Steven Toth | 3935c25 | 2008-05-01 05:45:44 -0300 | [diff] [blame] | 1919 | status += MXL_ControlWrite(fe, BB_ALPF_BANDSELECT, (state->IF_Mode ? 2 : 5)); |
| 1920 | break; |
Steven Toth | 52c99bd | 2008-05-01 04:57:01 -0300 | [diff] [blame] | 1921 | } |
| 1922 | } |
| 1923 | |
Steven Toth | 3935c25 | 2008-05-01 05:45:44 -0300 | [diff] [blame] | 1924 | /* Charge Pump Control Dig Ana */ |
| 1925 | status += MXL_ControlWrite(fe, RFSYN_CHP_GAIN, state->Mode ? 5 : 8); |
| 1926 | status += MXL_ControlWrite(fe, RFSYN_EN_CHP_HIGAIN, state->Mode ? 1 : 1); |
| 1927 | status += MXL_ControlWrite(fe, EN_CHP_LIN_B, state->Mode ? 0 : 0); |
Steven Toth | 52c99bd | 2008-05-01 04:57:01 -0300 | [diff] [blame] | 1928 | |
Steven Toth | 3935c25 | 2008-05-01 05:45:44 -0300 | [diff] [blame] | 1929 | /* AGC TOP Control */ |
| 1930 | if (state->AGC_Mode == 0) /* Dual AGC */ { |
| 1931 | status += MXL_ControlWrite(fe, AGC_IF, 15); |
| 1932 | status += MXL_ControlWrite(fe, AGC_RF, 15); |
Steven Toth | 52c99bd | 2008-05-01 04:57:01 -0300 | [diff] [blame] | 1933 | } |
Steven Toth | 3935c25 | 2008-05-01 05:45:44 -0300 | [diff] [blame] | 1934 | else /* Single AGC Mode Dig Ana */ |
| 1935 | status += MXL_ControlWrite(fe, AGC_RF, state->Mode ? 15 : 12); |
Steven Toth | 52c99bd | 2008-05-01 04:57:01 -0300 | [diff] [blame] | 1936 | |
Steven Toth | 3935c25 | 2008-05-01 05:45:44 -0300 | [diff] [blame] | 1937 | if (state->TOP == 55) /* TOP == 5.5 */ |
| 1938 | status += MXL_ControlWrite(fe, AGC_IF, 0x0); |
Steven Toth | 52c99bd | 2008-05-01 04:57:01 -0300 | [diff] [blame] | 1939 | |
Steven Toth | 3935c25 | 2008-05-01 05:45:44 -0300 | [diff] [blame] | 1940 | if (state->TOP == 72) /* TOP == 7.2 */ |
| 1941 | status += MXL_ControlWrite(fe, AGC_IF, 0x1); |
Steven Toth | 52c99bd | 2008-05-01 04:57:01 -0300 | [diff] [blame] | 1942 | |
Steven Toth | 3935c25 | 2008-05-01 05:45:44 -0300 | [diff] [blame] | 1943 | if (state->TOP == 92) /* TOP == 9.2 */ |
| 1944 | status += MXL_ControlWrite(fe, AGC_IF, 0x2); |
Steven Toth | 52c99bd | 2008-05-01 04:57:01 -0300 | [diff] [blame] | 1945 | |
Steven Toth | 3935c25 | 2008-05-01 05:45:44 -0300 | [diff] [blame] | 1946 | if (state->TOP == 110) /* TOP == 11.0 */ |
| 1947 | status += MXL_ControlWrite(fe, AGC_IF, 0x3); |
Steven Toth | 52c99bd | 2008-05-01 04:57:01 -0300 | [diff] [blame] | 1948 | |
Steven Toth | 3935c25 | 2008-05-01 05:45:44 -0300 | [diff] [blame] | 1949 | if (state->TOP == 129) /* TOP == 12.9 */ |
| 1950 | status += MXL_ControlWrite(fe, AGC_IF, 0x4); |
Steven Toth | 52c99bd | 2008-05-01 04:57:01 -0300 | [diff] [blame] | 1951 | |
Steven Toth | 3935c25 | 2008-05-01 05:45:44 -0300 | [diff] [blame] | 1952 | if (state->TOP == 147) /* TOP == 14.7 */ |
| 1953 | status += MXL_ControlWrite(fe, AGC_IF, 0x5); |
Steven Toth | 52c99bd | 2008-05-01 04:57:01 -0300 | [diff] [blame] | 1954 | |
Steven Toth | 3935c25 | 2008-05-01 05:45:44 -0300 | [diff] [blame] | 1955 | if (state->TOP == 168) /* TOP == 16.8 */ |
| 1956 | status += MXL_ControlWrite(fe, AGC_IF, 0x6); |
Steven Toth | 52c99bd | 2008-05-01 04:57:01 -0300 | [diff] [blame] | 1957 | |
Steven Toth | 3935c25 | 2008-05-01 05:45:44 -0300 | [diff] [blame] | 1958 | if (state->TOP == 194) /* TOP == 19.4 */ |
| 1959 | status += MXL_ControlWrite(fe, AGC_IF, 0x7); |
Steven Toth | 52c99bd | 2008-05-01 04:57:01 -0300 | [diff] [blame] | 1960 | |
Steven Toth | 3935c25 | 2008-05-01 05:45:44 -0300 | [diff] [blame] | 1961 | if (state->TOP == 212) /* TOP == 21.2 */ |
| 1962 | status += MXL_ControlWrite(fe, AGC_IF, 0x9); |
Steven Toth | 52c99bd | 2008-05-01 04:57:01 -0300 | [diff] [blame] | 1963 | |
Steven Toth | 3935c25 | 2008-05-01 05:45:44 -0300 | [diff] [blame] | 1964 | if (state->TOP == 232) /* TOP == 23.2 */ |
| 1965 | status += MXL_ControlWrite(fe, AGC_IF, 0xA); |
Steven Toth | 52c99bd | 2008-05-01 04:57:01 -0300 | [diff] [blame] | 1966 | |
Steven Toth | 3935c25 | 2008-05-01 05:45:44 -0300 | [diff] [blame] | 1967 | if (state->TOP == 252) /* TOP == 25.2 */ |
| 1968 | status += MXL_ControlWrite(fe, AGC_IF, 0xB); |
Steven Toth | 52c99bd | 2008-05-01 04:57:01 -0300 | [diff] [blame] | 1969 | |
Steven Toth | 3935c25 | 2008-05-01 05:45:44 -0300 | [diff] [blame] | 1970 | if (state->TOP == 271) /* TOP == 27.1 */ |
| 1971 | status += MXL_ControlWrite(fe, AGC_IF, 0xC); |
Steven Toth | 52c99bd | 2008-05-01 04:57:01 -0300 | [diff] [blame] | 1972 | |
Steven Toth | 3935c25 | 2008-05-01 05:45:44 -0300 | [diff] [blame] | 1973 | if (state->TOP == 292) /* TOP == 29.2 */ |
| 1974 | status += MXL_ControlWrite(fe, AGC_IF, 0xD); |
Steven Toth | 52c99bd | 2008-05-01 04:57:01 -0300 | [diff] [blame] | 1975 | |
Steven Toth | 3935c25 | 2008-05-01 05:45:44 -0300 | [diff] [blame] | 1976 | if (state->TOP == 317) /* TOP == 31.7 */ |
| 1977 | status += MXL_ControlWrite(fe, AGC_IF, 0xE); |
Steven Toth | 52c99bd | 2008-05-01 04:57:01 -0300 | [diff] [blame] | 1978 | |
Steven Toth | 3935c25 | 2008-05-01 05:45:44 -0300 | [diff] [blame] | 1979 | if (state->TOP == 349) /* TOP == 34.9 */ |
| 1980 | status += MXL_ControlWrite(fe, AGC_IF, 0xF); |
Steven Toth | 52c99bd | 2008-05-01 04:57:01 -0300 | [diff] [blame] | 1981 | |
Steven Toth | 3935c25 | 2008-05-01 05:45:44 -0300 | [diff] [blame] | 1982 | /* IF Synthesizer Control */ |
| 1983 | status += MXL_IFSynthInit(fe); |
Steven Toth | 52c99bd | 2008-05-01 04:57:01 -0300 | [diff] [blame] | 1984 | |
Steven Toth | 3935c25 | 2008-05-01 05:45:44 -0300 | [diff] [blame] | 1985 | /* IF UpConverter Control */ |
| 1986 | if (state->IF_OUT_LOAD == 200) { |
| 1987 | status += MXL_ControlWrite(fe, DRV_RES_SEL, 6); |
| 1988 | status += MXL_ControlWrite(fe, I_DRIVER, 2); |
Steven Toth | 52c99bd | 2008-05-01 04:57:01 -0300 | [diff] [blame] | 1989 | } |
Steven Toth | 3935c25 | 2008-05-01 05:45:44 -0300 | [diff] [blame] | 1990 | if (state->IF_OUT_LOAD == 300) { |
| 1991 | status += MXL_ControlWrite(fe, DRV_RES_SEL, 4); |
| 1992 | status += MXL_ControlWrite(fe, I_DRIVER, 1); |
Steven Toth | 52c99bd | 2008-05-01 04:57:01 -0300 | [diff] [blame] | 1993 | } |
| 1994 | |
Steven Toth | 3935c25 | 2008-05-01 05:45:44 -0300 | [diff] [blame] | 1995 | /* Anti-Alias Filtering Control |
| 1996 | * initialise Anti-Aliasing Filter |
| 1997 | */ |
| 1998 | if (state->Mode) { /* Digital Mode */ |
| 1999 | if (state->IF_OUT >= 4000000UL && state->IF_OUT <= 6280000UL) { |
| 2000 | status += MXL_ControlWrite(fe, EN_AAF, 1); |
| 2001 | status += MXL_ControlWrite(fe, EN_3P, 1); |
| 2002 | status += MXL_ControlWrite(fe, EN_AUX_3P, 1); |
| 2003 | status += MXL_ControlWrite(fe, SEL_AAF_BAND, 0); |
Steven Toth | 52c99bd | 2008-05-01 04:57:01 -0300 | [diff] [blame] | 2004 | } |
Steven Toth | 3935c25 | 2008-05-01 05:45:44 -0300 | [diff] [blame] | 2005 | if ((state->IF_OUT == 36125000UL) || (state->IF_OUT == 36150000UL)) { |
| 2006 | status += MXL_ControlWrite(fe, EN_AAF, 1); |
| 2007 | status += MXL_ControlWrite(fe, EN_3P, 1); |
| 2008 | status += MXL_ControlWrite(fe, EN_AUX_3P, 1); |
| 2009 | status += MXL_ControlWrite(fe, SEL_AAF_BAND, 1); |
Steven Toth | 52c99bd | 2008-05-01 04:57:01 -0300 | [diff] [blame] | 2010 | } |
Steven Toth | 3935c25 | 2008-05-01 05:45:44 -0300 | [diff] [blame] | 2011 | if (state->IF_OUT > 36150000UL) { |
| 2012 | status += MXL_ControlWrite(fe, EN_AAF, 0); |
| 2013 | status += MXL_ControlWrite(fe, EN_3P, 1); |
| 2014 | status += MXL_ControlWrite(fe, EN_AUX_3P, 1); |
| 2015 | status += MXL_ControlWrite(fe, SEL_AAF_BAND, 1); |
Steven Toth | 52c99bd | 2008-05-01 04:57:01 -0300 | [diff] [blame] | 2016 | } |
Steven Toth | 3935c25 | 2008-05-01 05:45:44 -0300 | [diff] [blame] | 2017 | } else { /* Analog Mode */ |
| 2018 | if (state->IF_OUT >= 4000000UL && state->IF_OUT <= 5000000UL) |
Steven Toth | 52c99bd | 2008-05-01 04:57:01 -0300 | [diff] [blame] | 2019 | { |
Steven Toth | 3935c25 | 2008-05-01 05:45:44 -0300 | [diff] [blame] | 2020 | status += MXL_ControlWrite(fe, EN_AAF, 1); |
| 2021 | status += MXL_ControlWrite(fe, EN_3P, 1); |
| 2022 | status += MXL_ControlWrite(fe, EN_AUX_3P, 1); |
| 2023 | status += MXL_ControlWrite(fe, SEL_AAF_BAND, 0); |
Steven Toth | 52c99bd | 2008-05-01 04:57:01 -0300 | [diff] [blame] | 2024 | } |
Steven Toth | 3935c25 | 2008-05-01 05:45:44 -0300 | [diff] [blame] | 2025 | if (state->IF_OUT > 5000000UL) |
Steven Toth | 52c99bd | 2008-05-01 04:57:01 -0300 | [diff] [blame] | 2026 | { |
Steven Toth | 3935c25 | 2008-05-01 05:45:44 -0300 | [diff] [blame] | 2027 | status += MXL_ControlWrite(fe, EN_AAF, 0); |
| 2028 | status += MXL_ControlWrite(fe, EN_3P, 0); |
| 2029 | status += MXL_ControlWrite(fe, EN_AUX_3P, 0); |
| 2030 | status += MXL_ControlWrite(fe, SEL_AAF_BAND, 0); |
Steven Toth | 52c99bd | 2008-05-01 04:57:01 -0300 | [diff] [blame] | 2031 | } |
| 2032 | } |
| 2033 | |
Steven Toth | 3935c25 | 2008-05-01 05:45:44 -0300 | [diff] [blame] | 2034 | /* Demod Clock Out */ |
| 2035 | if (state->CLOCK_OUT) |
| 2036 | status += MXL_ControlWrite(fe, SEQ_ENCLK16_CLK_OUT, 1); |
Steven Toth | 52c99bd | 2008-05-01 04:57:01 -0300 | [diff] [blame] | 2037 | else |
Steven Toth | 3935c25 | 2008-05-01 05:45:44 -0300 | [diff] [blame] | 2038 | status += MXL_ControlWrite(fe, SEQ_ENCLK16_CLK_OUT, 0); |
Steven Toth | 52c99bd | 2008-05-01 04:57:01 -0300 | [diff] [blame] | 2039 | |
Steven Toth | 3935c25 | 2008-05-01 05:45:44 -0300 | [diff] [blame] | 2040 | if (state->DIV_OUT == 1) |
| 2041 | status += MXL_ControlWrite(fe, SEQ_SEL4_16B, 1); |
| 2042 | if (state->DIV_OUT == 0) |
| 2043 | status += MXL_ControlWrite(fe, SEQ_SEL4_16B, 0); |
Steven Toth | 52c99bd | 2008-05-01 04:57:01 -0300 | [diff] [blame] | 2044 | |
Steven Toth | 3935c25 | 2008-05-01 05:45:44 -0300 | [diff] [blame] | 2045 | /* Crystal Control */ |
| 2046 | if (state->CAPSELECT) |
| 2047 | status += MXL_ControlWrite(fe, XTAL_CAPSELECT, 1); |
Steven Toth | 52c99bd | 2008-05-01 04:57:01 -0300 | [diff] [blame] | 2048 | else |
Steven Toth | 3935c25 | 2008-05-01 05:45:44 -0300 | [diff] [blame] | 2049 | status += MXL_ControlWrite(fe, XTAL_CAPSELECT, 0); |
Steven Toth | 52c99bd | 2008-05-01 04:57:01 -0300 | [diff] [blame] | 2050 | |
Steven Toth | 3935c25 | 2008-05-01 05:45:44 -0300 | [diff] [blame] | 2051 | if (state->Fxtal >= 12000000UL && state->Fxtal <= 16000000UL) |
| 2052 | status += MXL_ControlWrite(fe, IF_SEL_DBL, 1); |
| 2053 | if (state->Fxtal > 16000000UL && state->Fxtal <= 32000000UL) |
| 2054 | status += MXL_ControlWrite(fe, IF_SEL_DBL, 0); |
Steven Toth | 52c99bd | 2008-05-01 04:57:01 -0300 | [diff] [blame] | 2055 | |
Steven Toth | 3935c25 | 2008-05-01 05:45:44 -0300 | [diff] [blame] | 2056 | if (state->Fxtal >= 12000000UL && state->Fxtal <= 22000000UL) |
| 2057 | status += MXL_ControlWrite(fe, RFSYN_R_DIV, 3); |
| 2058 | if (state->Fxtal > 22000000UL && state->Fxtal <= 32000000UL) |
| 2059 | status += MXL_ControlWrite(fe, RFSYN_R_DIV, 0); |
Steven Toth | 52c99bd | 2008-05-01 04:57:01 -0300 | [diff] [blame] | 2060 | |
Steven Toth | 3935c25 | 2008-05-01 05:45:44 -0300 | [diff] [blame] | 2061 | /* Misc Controls */ |
Steven Toth | 85d220d | 2008-05-01 05:48:14 -0300 | [diff] [blame] | 2062 | if (state->Mode == 0 && state->IF_Mode == 1) /* Analog LowIF mode */ |
Steven Toth | 3935c25 | 2008-05-01 05:45:44 -0300 | [diff] [blame] | 2063 | status += MXL_ControlWrite(fe, SEQ_EXTIQFSMPULSE, 0); |
Steven Toth | 52c99bd | 2008-05-01 04:57:01 -0300 | [diff] [blame] | 2064 | else |
Steven Toth | 3935c25 | 2008-05-01 05:45:44 -0300 | [diff] [blame] | 2065 | status += MXL_ControlWrite(fe, SEQ_EXTIQFSMPULSE, 1); |
Steven Toth | 52c99bd | 2008-05-01 04:57:01 -0300 | [diff] [blame] | 2066 | |
Steven Toth | 3935c25 | 2008-05-01 05:45:44 -0300 | [diff] [blame] | 2067 | /* status += MXL_ControlRead(fe, IF_DIVVAL, &IF_DIVVAL_Val); */ |
Steven Toth | 52c99bd | 2008-05-01 04:57:01 -0300 | [diff] [blame] | 2068 | |
Steven Toth | 3935c25 | 2008-05-01 05:45:44 -0300 | [diff] [blame] | 2069 | /* Set TG_R_DIV */ |
| 2070 | status += MXL_ControlWrite(fe, TG_R_DIV, MXL_Ceiling(state->Fxtal, 1000000)); |
Steven Toth | 52c99bd | 2008-05-01 04:57:01 -0300 | [diff] [blame] | 2071 | |
Steven Toth | 3935c25 | 2008-05-01 05:45:44 -0300 | [diff] [blame] | 2072 | /* Apply Default value to BB_INITSTATE_DLPF_TUNE */ |
Steven Toth | 52c99bd | 2008-05-01 04:57:01 -0300 | [diff] [blame] | 2073 | |
Steven Toth | 3935c25 | 2008-05-01 05:45:44 -0300 | [diff] [blame] | 2074 | /* RSSI Control */ |
| 2075 | if (state->EN_RSSI) |
Steven Toth | 52c99bd | 2008-05-01 04:57:01 -0300 | [diff] [blame] | 2076 | { |
Steven Toth | 3935c25 | 2008-05-01 05:45:44 -0300 | [diff] [blame] | 2077 | status += MXL_ControlWrite(fe, SEQ_EXTSYNTHCALIF, 1); |
| 2078 | status += MXL_ControlWrite(fe, SEQ_EXTDCCAL, 1); |
| 2079 | status += MXL_ControlWrite(fe, AGC_EN_RSSI, 1); |
| 2080 | status += MXL_ControlWrite(fe, RFA_ENCLKRFAGC, 1); |
| 2081 | |
| 2082 | /* RSSI reference point */ |
| 2083 | status += MXL_ControlWrite(fe, RFA_RSSI_REF, 2); |
| 2084 | status += MXL_ControlWrite(fe, RFA_RSSI_REFH, 3); |
| 2085 | status += MXL_ControlWrite(fe, RFA_RSSI_REFL, 1); |
| 2086 | |
| 2087 | /* TOP point */ |
| 2088 | status += MXL_ControlWrite(fe, RFA_FLR, 0); |
| 2089 | status += MXL_ControlWrite(fe, RFA_CEIL, 12); |
Steven Toth | 52c99bd | 2008-05-01 04:57:01 -0300 | [diff] [blame] | 2090 | } |
| 2091 | |
Steven Toth | 3935c25 | 2008-05-01 05:45:44 -0300 | [diff] [blame] | 2092 | /* Modulation type bit settings |
| 2093 | * Override the control values preset |
| 2094 | */ |
| 2095 | if (state->Mod_Type == MXL_DVBT) /* DVB-T Mode */ |
Steven Toth | 52c99bd | 2008-05-01 04:57:01 -0300 | [diff] [blame] | 2096 | { |
Steven Toth | 3935c25 | 2008-05-01 05:45:44 -0300 | [diff] [blame] | 2097 | state->AGC_Mode = 1; /* Single AGC Mode */ |
Steven Toth | 52c99bd | 2008-05-01 04:57:01 -0300 | [diff] [blame] | 2098 | |
Steven Toth | 3935c25 | 2008-05-01 05:45:44 -0300 | [diff] [blame] | 2099 | /* Enable RSSI */ |
| 2100 | status += MXL_ControlWrite(fe, SEQ_EXTSYNTHCALIF, 1); |
| 2101 | status += MXL_ControlWrite(fe, SEQ_EXTDCCAL, 1); |
| 2102 | status += MXL_ControlWrite(fe, AGC_EN_RSSI, 1); |
| 2103 | status += MXL_ControlWrite(fe, RFA_ENCLKRFAGC, 1); |
| 2104 | |
| 2105 | /* RSSI reference point */ |
| 2106 | status += MXL_ControlWrite(fe, RFA_RSSI_REF, 3); |
| 2107 | status += MXL_ControlWrite(fe, RFA_RSSI_REFH, 5); |
| 2108 | status += MXL_ControlWrite(fe, RFA_RSSI_REFL, 1); |
| 2109 | |
| 2110 | /* TOP point */ |
| 2111 | status += MXL_ControlWrite(fe, RFA_FLR, 2); |
| 2112 | status += MXL_ControlWrite(fe, RFA_CEIL, 13); |
| 2113 | if (state->IF_OUT <= 6280000UL) /* Low IF */ |
| 2114 | status += MXL_ControlWrite(fe, BB_IQSWAP, 0); |
| 2115 | else /* High IF */ |
| 2116 | status += MXL_ControlWrite(fe, BB_IQSWAP, 1); |
Steven Toth | 52c99bd | 2008-05-01 04:57:01 -0300 | [diff] [blame] | 2117 | |
| 2118 | } |
Steven Toth | 3935c25 | 2008-05-01 05:45:44 -0300 | [diff] [blame] | 2119 | if (state->Mod_Type == MXL_ATSC) /* ATSC Mode */ |
Steven Toth | 52c99bd | 2008-05-01 04:57:01 -0300 | [diff] [blame] | 2120 | { |
Steven Toth | 85d220d | 2008-05-01 05:48:14 -0300 | [diff] [blame] | 2121 | state->AGC_Mode = 1; /* Single AGC Mode */ |
Steven Toth | 52c99bd | 2008-05-01 04:57:01 -0300 | [diff] [blame] | 2122 | |
Steven Toth | 3935c25 | 2008-05-01 05:45:44 -0300 | [diff] [blame] | 2123 | /* Enable RSSI */ |
| 2124 | status += MXL_ControlWrite(fe, SEQ_EXTSYNTHCALIF, 1); |
| 2125 | status += MXL_ControlWrite(fe, SEQ_EXTDCCAL, 1); |
| 2126 | status += MXL_ControlWrite(fe, AGC_EN_RSSI, 1); |
| 2127 | status += MXL_ControlWrite(fe, RFA_ENCLKRFAGC, 1); |
Steven Toth | 52c99bd | 2008-05-01 04:57:01 -0300 | [diff] [blame] | 2128 | |
Steven Toth | 3935c25 | 2008-05-01 05:45:44 -0300 | [diff] [blame] | 2129 | /* RSSI reference point */ |
| 2130 | status += MXL_ControlWrite(fe, RFA_RSSI_REF, 2); |
| 2131 | status += MXL_ControlWrite(fe, RFA_RSSI_REFH, 4); |
| 2132 | status += MXL_ControlWrite(fe, RFA_RSSI_REFL, 1); |
| 2133 | |
| 2134 | /* TOP point */ |
| 2135 | status += MXL_ControlWrite(fe, RFA_FLR, 2); |
| 2136 | status += MXL_ControlWrite(fe, RFA_CEIL, 13); |
| 2137 | status += MXL_ControlWrite(fe, BB_INITSTATE_DLPF_TUNE, 1); |
| 2138 | status += MXL_ControlWrite(fe, RFSYN_CHP_GAIN, 5); /* Low Zero */ |
| 2139 | if (state->IF_OUT <= 6280000UL) /* Low IF */ |
| 2140 | status += MXL_ControlWrite(fe, BB_IQSWAP, 0); |
| 2141 | else /* High IF */ |
| 2142 | status += MXL_ControlWrite(fe, BB_IQSWAP, 1); |
Steven Toth | 52c99bd | 2008-05-01 04:57:01 -0300 | [diff] [blame] | 2143 | } |
Steven Toth | 3935c25 | 2008-05-01 05:45:44 -0300 | [diff] [blame] | 2144 | if (state->Mod_Type == MXL_QAM) /* QAM Mode */ |
Steven Toth | 52c99bd | 2008-05-01 04:57:01 -0300 | [diff] [blame] | 2145 | { |
Steven Toth | 3935c25 | 2008-05-01 05:45:44 -0300 | [diff] [blame] | 2146 | state->Mode = MXL_DIGITAL_MODE; |
Steven Toth | 52c99bd | 2008-05-01 04:57:01 -0300 | [diff] [blame] | 2147 | |
Steven Toth | 3935c25 | 2008-05-01 05:45:44 -0300 | [diff] [blame] | 2148 | /* state->AGC_Mode = 1; */ /* Single AGC Mode */ |
Steven Toth | 52c99bd | 2008-05-01 04:57:01 -0300 | [diff] [blame] | 2149 | |
Steven Toth | 3935c25 | 2008-05-01 05:45:44 -0300 | [diff] [blame] | 2150 | /* Disable RSSI */ /* change here for v2.6.5 */ |
| 2151 | status += MXL_ControlWrite(fe, SEQ_EXTSYNTHCALIF, 1); |
| 2152 | status += MXL_ControlWrite(fe, SEQ_EXTDCCAL, 1); |
| 2153 | status += MXL_ControlWrite(fe, AGC_EN_RSSI, 0); |
| 2154 | status += MXL_ControlWrite(fe, RFA_ENCLKRFAGC, 1); |
Steven Toth | 52c99bd | 2008-05-01 04:57:01 -0300 | [diff] [blame] | 2155 | |
Steven Toth | 3935c25 | 2008-05-01 05:45:44 -0300 | [diff] [blame] | 2156 | /* RSSI reference point */ |
| 2157 | status += MXL_ControlWrite(fe, RFA_RSSI_REFH, 5); |
| 2158 | status += MXL_ControlWrite(fe, RFA_RSSI_REF, 3); |
| 2159 | status += MXL_ControlWrite(fe, RFA_RSSI_REFL, 2); |
| 2160 | status += MXL_ControlWrite(fe, RFSYN_CHP_GAIN, 3); /* change here for v2.6.5 */ |
Steven Toth | 52c99bd | 2008-05-01 04:57:01 -0300 | [diff] [blame] | 2161 | |
Steven Toth | 3935c25 | 2008-05-01 05:45:44 -0300 | [diff] [blame] | 2162 | if (state->IF_OUT <= 6280000UL) /* Low IF */ |
| 2163 | status += MXL_ControlWrite(fe, BB_IQSWAP, 0); |
| 2164 | else /* High IF */ |
| 2165 | status += MXL_ControlWrite(fe, BB_IQSWAP, 1); |
Steven Toth | 8c66a19 | 2008-05-01 06:35:48 -0300 | [diff] [blame] | 2166 | status += MXL_ControlWrite(fe, RFSYN_CHP_GAIN, 2); |
| 2167 | |
Steven Toth | 52c99bd | 2008-05-01 04:57:01 -0300 | [diff] [blame] | 2168 | } |
Steven Toth | 3935c25 | 2008-05-01 05:45:44 -0300 | [diff] [blame] | 2169 | if (state->Mod_Type == MXL_ANALOG_CABLE) { |
| 2170 | /* Analog Cable Mode */ |
Steven Toth | 85d220d | 2008-05-01 05:48:14 -0300 | [diff] [blame] | 2171 | /* state->Mode = MXL_DIGITAL_MODE; */ |
Steven Toth | 52c99bd | 2008-05-01 04:57:01 -0300 | [diff] [blame] | 2172 | |
Steven Toth | 3935c25 | 2008-05-01 05:45:44 -0300 | [diff] [blame] | 2173 | state->AGC_Mode = 1; /* Single AGC Mode */ |
Steven Toth | 52c99bd | 2008-05-01 04:57:01 -0300 | [diff] [blame] | 2174 | |
Steven Toth | 3935c25 | 2008-05-01 05:45:44 -0300 | [diff] [blame] | 2175 | /* Disable RSSI */ |
| 2176 | status += MXL_ControlWrite(fe, SEQ_EXTSYNTHCALIF, 1); |
| 2177 | status += MXL_ControlWrite(fe, SEQ_EXTDCCAL, 1); |
| 2178 | status += MXL_ControlWrite(fe, AGC_EN_RSSI, 0); |
| 2179 | status += MXL_ControlWrite(fe, RFA_ENCLKRFAGC, 1); |
| 2180 | status += MXL_ControlWrite(fe, AGC_IF, 1); /* change for 2.6.3 */ |
| 2181 | status += MXL_ControlWrite(fe, AGC_RF, 15); |
| 2182 | status += MXL_ControlWrite(fe, BB_IQSWAP, 1); |
Steven Toth | 52c99bd | 2008-05-01 04:57:01 -0300 | [diff] [blame] | 2183 | } |
| 2184 | |
Steven Toth | 3935c25 | 2008-05-01 05:45:44 -0300 | [diff] [blame] | 2185 | if (state->Mod_Type == MXL_ANALOG_OTA) { |
| 2186 | /* Analog OTA Terrestrial mode add for 2.6.7 */ |
| 2187 | /* state->Mode = MXL_ANALOG_MODE; */ |
Steven Toth | 52c99bd | 2008-05-01 04:57:01 -0300 | [diff] [blame] | 2188 | |
Steven Toth | 3935c25 | 2008-05-01 05:45:44 -0300 | [diff] [blame] | 2189 | /* Enable RSSI */ |
| 2190 | status += MXL_ControlWrite(fe, SEQ_EXTSYNTHCALIF, 1); |
| 2191 | status += MXL_ControlWrite(fe, SEQ_EXTDCCAL, 1); |
| 2192 | status += MXL_ControlWrite(fe, AGC_EN_RSSI, 1); |
| 2193 | status += MXL_ControlWrite(fe, RFA_ENCLKRFAGC, 1); |
Steven Toth | 52c99bd | 2008-05-01 04:57:01 -0300 | [diff] [blame] | 2194 | |
Steven Toth | 3935c25 | 2008-05-01 05:45:44 -0300 | [diff] [blame] | 2195 | /* RSSI reference point */ |
| 2196 | status += MXL_ControlWrite(fe, RFA_RSSI_REFH, 5); |
| 2197 | status += MXL_ControlWrite(fe, RFA_RSSI_REF, 3); |
| 2198 | status += MXL_ControlWrite(fe, RFA_RSSI_REFL, 2); |
| 2199 | status += MXL_ControlWrite(fe, RFSYN_CHP_GAIN, 3); |
| 2200 | status += MXL_ControlWrite(fe, BB_IQSWAP, 1); |
Steven Toth | 52c99bd | 2008-05-01 04:57:01 -0300 | [diff] [blame] | 2201 | } |
| 2202 | |
Steven Toth | 3935c25 | 2008-05-01 05:45:44 -0300 | [diff] [blame] | 2203 | /* RSSI disable */ |
Steven Toth | 8c66a19 | 2008-05-01 06:35:48 -0300 | [diff] [blame] | 2204 | if(state->EN_RSSI == 0) { |
Steven Toth | 3935c25 | 2008-05-01 05:45:44 -0300 | [diff] [blame] | 2205 | status += MXL_ControlWrite(fe, SEQ_EXTSYNTHCALIF, 1); |
| 2206 | status += MXL_ControlWrite(fe, SEQ_EXTDCCAL, 1); |
| 2207 | status += MXL_ControlWrite(fe, AGC_EN_RSSI, 0); |
| 2208 | status += MXL_ControlWrite(fe, RFA_ENCLKRFAGC, 1); |
Steven Toth | 52c99bd | 2008-05-01 04:57:01 -0300 | [diff] [blame] | 2209 | } |
| 2210 | |
Steven Toth | 3935c25 | 2008-05-01 05:45:44 -0300 | [diff] [blame] | 2211 | return status; |
Steven Toth | 52c99bd | 2008-05-01 04:57:01 -0300 | [diff] [blame] | 2212 | } |
| 2213 | |
| 2214 | /////////////////////////////////////////////////////////////////////////////// |
| 2215 | // // |
| 2216 | // Function: MXL_IFSynthInit // |
| 2217 | // // |
| 2218 | // Description: Tuner IF Synthesizer related register initialization // |
| 2219 | // // |
| 2220 | // Globals: // |
| 2221 | // NONE // |
| 2222 | // // |
| 2223 | // Functions used: // |
| 2224 | // Tuner_struct: structure defined at higher level // |
| 2225 | // // |
| 2226 | // Inputs: // |
| 2227 | // Tuner : Tuner structure defined at higher level // |
| 2228 | // // |
| 2229 | // Outputs: // |
| 2230 | // Tuner // |
| 2231 | // // |
| 2232 | // Return: // |
| 2233 | // 0 : Successful // |
| 2234 | // > 0 : Failed // |
| 2235 | // // |
| 2236 | /////////////////////////////////////////////////////////////////////////////// |
Steven Toth | 85d220d | 2008-05-01 05:48:14 -0300 | [diff] [blame] | 2237 | u16 MXL_IFSynthInit(struct dvb_frontend *fe) |
Steven Toth | 52c99bd | 2008-05-01 04:57:01 -0300 | [diff] [blame] | 2238 | { |
Steven Toth | 85d220d | 2008-05-01 05:48:14 -0300 | [diff] [blame] | 2239 | struct mxl5005s_state *state = fe->tuner_priv; |
Steven Toth | a8214d4 | 2008-05-01 05:02:58 -0300 | [diff] [blame] | 2240 | u16 status = 0 ; |
Steven Toth | 52c99bd | 2008-05-01 04:57:01 -0300 | [diff] [blame] | 2241 | // Declare Local Variables |
Steven Toth | a8214d4 | 2008-05-01 05:02:58 -0300 | [diff] [blame] | 2242 | u32 Fref = 0 ; |
| 2243 | u32 Kdbl, intModVal ; |
| 2244 | u32 fracModVal ; |
Steven Toth | 52c99bd | 2008-05-01 04:57:01 -0300 | [diff] [blame] | 2245 | Kdbl = 2 ; |
| 2246 | |
Steven Toth | 3935c25 | 2008-05-01 05:45:44 -0300 | [diff] [blame] | 2247 | if (state->Fxtal >= 12000000UL && state->Fxtal <= 16000000UL) |
Steven Toth | 52c99bd | 2008-05-01 04:57:01 -0300 | [diff] [blame] | 2248 | Kdbl = 2 ; |
Steven Toth | 3935c25 | 2008-05-01 05:45:44 -0300 | [diff] [blame] | 2249 | if (state->Fxtal > 16000000UL && state->Fxtal <= 32000000UL) |
Steven Toth | 52c99bd | 2008-05-01 04:57:01 -0300 | [diff] [blame] | 2250 | Kdbl = 1 ; |
| 2251 | |
| 2252 | // |
| 2253 | // IF Synthesizer Control |
| 2254 | // |
Steven Toth | 85d220d | 2008-05-01 05:48:14 -0300 | [diff] [blame] | 2255 | if (state->Mode == 0 && state->IF_Mode == 1) // Analog Low IF mode |
Steven Toth | 52c99bd | 2008-05-01 04:57:01 -0300 | [diff] [blame] | 2256 | { |
Steven Toth | 85d220d | 2008-05-01 05:48:14 -0300 | [diff] [blame] | 2257 | if (state->IF_LO == 41000000UL) { |
Steven Toth | 3935c25 | 2008-05-01 05:45:44 -0300 | [diff] [blame] | 2258 | status += MXL_ControlWrite(fe, IF_DIVVAL, 0x08) ; |
| 2259 | status += MXL_ControlWrite(fe, IF_VCO_BIAS, 0x0C) ; |
Steven Toth | 52c99bd | 2008-05-01 04:57:01 -0300 | [diff] [blame] | 2260 | Fref = 328000000UL ; |
| 2261 | } |
Steven Toth | 85d220d | 2008-05-01 05:48:14 -0300 | [diff] [blame] | 2262 | if (state->IF_LO == 47000000UL) { |
Steven Toth | 3935c25 | 2008-05-01 05:45:44 -0300 | [diff] [blame] | 2263 | status += MXL_ControlWrite(fe, IF_DIVVAL, 0x08) ; |
| 2264 | status += MXL_ControlWrite(fe, IF_VCO_BIAS, 0x08) ; |
Steven Toth | 52c99bd | 2008-05-01 04:57:01 -0300 | [diff] [blame] | 2265 | Fref = 376000000UL ; |
| 2266 | } |
Steven Toth | 85d220d | 2008-05-01 05:48:14 -0300 | [diff] [blame] | 2267 | if (state->IF_LO == 54000000UL) { |
Steven Toth | 3935c25 | 2008-05-01 05:45:44 -0300 | [diff] [blame] | 2268 | status += MXL_ControlWrite(fe, IF_DIVVAL, 0x10) ; |
| 2269 | status += MXL_ControlWrite(fe, IF_VCO_BIAS, 0x0C) ; |
Steven Toth | 52c99bd | 2008-05-01 04:57:01 -0300 | [diff] [blame] | 2270 | Fref = 324000000UL ; |
| 2271 | } |
Steven Toth | 85d220d | 2008-05-01 05:48:14 -0300 | [diff] [blame] | 2272 | if (state->IF_LO == 60000000UL) { |
Steven Toth | 3935c25 | 2008-05-01 05:45:44 -0300 | [diff] [blame] | 2273 | status += MXL_ControlWrite(fe, IF_DIVVAL, 0x10) ; |
| 2274 | status += MXL_ControlWrite(fe, IF_VCO_BIAS, 0x08) ; |
Steven Toth | 52c99bd | 2008-05-01 04:57:01 -0300 | [diff] [blame] | 2275 | Fref = 360000000UL ; |
| 2276 | } |
Steven Toth | 85d220d | 2008-05-01 05:48:14 -0300 | [diff] [blame] | 2277 | if (state->IF_LO == 39250000UL) { |
Steven Toth | 3935c25 | 2008-05-01 05:45:44 -0300 | [diff] [blame] | 2278 | status += MXL_ControlWrite(fe, IF_DIVVAL, 0x08) ; |
| 2279 | status += MXL_ControlWrite(fe, IF_VCO_BIAS, 0x0C) ; |
Steven Toth | 52c99bd | 2008-05-01 04:57:01 -0300 | [diff] [blame] | 2280 | Fref = 314000000UL ; |
| 2281 | } |
Steven Toth | 85d220d | 2008-05-01 05:48:14 -0300 | [diff] [blame] | 2282 | if (state->IF_LO == 39650000UL) { |
Steven Toth | 3935c25 | 2008-05-01 05:45:44 -0300 | [diff] [blame] | 2283 | status += MXL_ControlWrite(fe, IF_DIVVAL, 0x08) ; |
| 2284 | status += MXL_ControlWrite(fe, IF_VCO_BIAS, 0x0C) ; |
Steven Toth | 52c99bd | 2008-05-01 04:57:01 -0300 | [diff] [blame] | 2285 | Fref = 317200000UL ; |
| 2286 | } |
Steven Toth | 85d220d | 2008-05-01 05:48:14 -0300 | [diff] [blame] | 2287 | if (state->IF_LO == 40150000UL) { |
Steven Toth | 3935c25 | 2008-05-01 05:45:44 -0300 | [diff] [blame] | 2288 | status += MXL_ControlWrite(fe, IF_DIVVAL, 0x08) ; |
| 2289 | status += MXL_ControlWrite(fe, IF_VCO_BIAS, 0x0C) ; |
Steven Toth | 52c99bd | 2008-05-01 04:57:01 -0300 | [diff] [blame] | 2290 | Fref = 321200000UL ; |
| 2291 | } |
Steven Toth | 85d220d | 2008-05-01 05:48:14 -0300 | [diff] [blame] | 2292 | if (state->IF_LO == 40650000UL) { |
Steven Toth | 3935c25 | 2008-05-01 05:45:44 -0300 | [diff] [blame] | 2293 | status += MXL_ControlWrite(fe, IF_DIVVAL, 0x08) ; |
| 2294 | status += MXL_ControlWrite(fe, IF_VCO_BIAS, 0x0C) ; |
Steven Toth | 52c99bd | 2008-05-01 04:57:01 -0300 | [diff] [blame] | 2295 | Fref = 325200000UL ; |
| 2296 | } |
| 2297 | } |
| 2298 | |
Steven Toth | 85d220d | 2008-05-01 05:48:14 -0300 | [diff] [blame] | 2299 | if (state->Mode || (state->Mode == 0 && state->IF_Mode == 0)) |
Steven Toth | 52c99bd | 2008-05-01 04:57:01 -0300 | [diff] [blame] | 2300 | { |
Steven Toth | 85d220d | 2008-05-01 05:48:14 -0300 | [diff] [blame] | 2301 | if (state->IF_LO == 57000000UL) { |
Steven Toth | 3935c25 | 2008-05-01 05:45:44 -0300 | [diff] [blame] | 2302 | status += MXL_ControlWrite(fe, IF_DIVVAL, 0x10) ; |
| 2303 | status += MXL_ControlWrite(fe, IF_VCO_BIAS, 0x08) ; |
Steven Toth | 52c99bd | 2008-05-01 04:57:01 -0300 | [diff] [blame] | 2304 | Fref = 342000000UL ; |
| 2305 | } |
Steven Toth | 85d220d | 2008-05-01 05:48:14 -0300 | [diff] [blame] | 2306 | if (state->IF_LO == 44000000UL) { |
Steven Toth | 3935c25 | 2008-05-01 05:45:44 -0300 | [diff] [blame] | 2307 | status += MXL_ControlWrite(fe, IF_DIVVAL, 0x08) ; |
| 2308 | status += MXL_ControlWrite(fe, IF_VCO_BIAS, 0x08) ; |
Steven Toth | 52c99bd | 2008-05-01 04:57:01 -0300 | [diff] [blame] | 2309 | Fref = 352000000UL ; |
| 2310 | } |
Steven Toth | 85d220d | 2008-05-01 05:48:14 -0300 | [diff] [blame] | 2311 | if (state->IF_LO == 43750000UL) { |
Steven Toth | 3935c25 | 2008-05-01 05:45:44 -0300 | [diff] [blame] | 2312 | status += MXL_ControlWrite(fe, IF_DIVVAL, 0x08) ; |
| 2313 | status += MXL_ControlWrite(fe, IF_VCO_BIAS, 0x08) ; |
Steven Toth | 52c99bd | 2008-05-01 04:57:01 -0300 | [diff] [blame] | 2314 | Fref = 350000000UL ; |
| 2315 | } |
Steven Toth | 85d220d | 2008-05-01 05:48:14 -0300 | [diff] [blame] | 2316 | if (state->IF_LO == 36650000UL) { |
Steven Toth | 3935c25 | 2008-05-01 05:45:44 -0300 | [diff] [blame] | 2317 | status += MXL_ControlWrite(fe, IF_DIVVAL, 0x04) ; |
| 2318 | status += MXL_ControlWrite(fe, IF_VCO_BIAS, 0x08) ; |
Steven Toth | 52c99bd | 2008-05-01 04:57:01 -0300 | [diff] [blame] | 2319 | Fref = 366500000UL ; |
| 2320 | } |
Steven Toth | 85d220d | 2008-05-01 05:48:14 -0300 | [diff] [blame] | 2321 | if (state->IF_LO == 36150000UL) { |
Steven Toth | 3935c25 | 2008-05-01 05:45:44 -0300 | [diff] [blame] | 2322 | status += MXL_ControlWrite(fe, IF_DIVVAL, 0x04) ; |
| 2323 | status += MXL_ControlWrite(fe, IF_VCO_BIAS, 0x08) ; |
Steven Toth | 52c99bd | 2008-05-01 04:57:01 -0300 | [diff] [blame] | 2324 | Fref = 361500000UL ; |
| 2325 | } |
Steven Toth | 85d220d | 2008-05-01 05:48:14 -0300 | [diff] [blame] | 2326 | if (state->IF_LO == 36000000UL) { |
Steven Toth | 3935c25 | 2008-05-01 05:45:44 -0300 | [diff] [blame] | 2327 | status += MXL_ControlWrite(fe, IF_DIVVAL, 0x04) ; |
| 2328 | status += MXL_ControlWrite(fe, IF_VCO_BIAS, 0x08) ; |
Steven Toth | 52c99bd | 2008-05-01 04:57:01 -0300 | [diff] [blame] | 2329 | Fref = 360000000UL ; |
| 2330 | } |
Steven Toth | 85d220d | 2008-05-01 05:48:14 -0300 | [diff] [blame] | 2331 | if (state->IF_LO == 35250000UL) { |
Steven Toth | 3935c25 | 2008-05-01 05:45:44 -0300 | [diff] [blame] | 2332 | status += MXL_ControlWrite(fe, IF_DIVVAL, 0x04) ; |
| 2333 | status += MXL_ControlWrite(fe, IF_VCO_BIAS, 0x08) ; |
Steven Toth | 52c99bd | 2008-05-01 04:57:01 -0300 | [diff] [blame] | 2334 | Fref = 352500000UL ; |
| 2335 | } |
Steven Toth | 85d220d | 2008-05-01 05:48:14 -0300 | [diff] [blame] | 2336 | if (state->IF_LO == 34750000UL) { |
Steven Toth | 3935c25 | 2008-05-01 05:45:44 -0300 | [diff] [blame] | 2337 | status += MXL_ControlWrite(fe, IF_DIVVAL, 0x04) ; |
| 2338 | status += MXL_ControlWrite(fe, IF_VCO_BIAS, 0x08) ; |
Steven Toth | 52c99bd | 2008-05-01 04:57:01 -0300 | [diff] [blame] | 2339 | Fref = 347500000UL ; |
| 2340 | } |
Steven Toth | 85d220d | 2008-05-01 05:48:14 -0300 | [diff] [blame] | 2341 | if (state->IF_LO == 6280000UL) { |
Steven Toth | 3935c25 | 2008-05-01 05:45:44 -0300 | [diff] [blame] | 2342 | status += MXL_ControlWrite(fe, IF_DIVVAL, 0x07) ; |
| 2343 | status += MXL_ControlWrite(fe, IF_VCO_BIAS, 0x08) ; |
Steven Toth | 52c99bd | 2008-05-01 04:57:01 -0300 | [diff] [blame] | 2344 | Fref = 376800000UL ; |
| 2345 | } |
Steven Toth | 85d220d | 2008-05-01 05:48:14 -0300 | [diff] [blame] | 2346 | if (state->IF_LO == 5000000UL) { |
Steven Toth | 3935c25 | 2008-05-01 05:45:44 -0300 | [diff] [blame] | 2347 | status += MXL_ControlWrite(fe, IF_DIVVAL, 0x09) ; |
| 2348 | status += MXL_ControlWrite(fe, IF_VCO_BIAS, 0x08) ; |
Steven Toth | 52c99bd | 2008-05-01 04:57:01 -0300 | [diff] [blame] | 2349 | Fref = 360000000UL ; |
| 2350 | } |
Steven Toth | 85d220d | 2008-05-01 05:48:14 -0300 | [diff] [blame] | 2351 | if (state->IF_LO == 4500000UL) { |
Steven Toth | 3935c25 | 2008-05-01 05:45:44 -0300 | [diff] [blame] | 2352 | status += MXL_ControlWrite(fe, IF_DIVVAL, 0x06) ; |
| 2353 | status += MXL_ControlWrite(fe, IF_VCO_BIAS, 0x08) ; |
Steven Toth | 52c99bd | 2008-05-01 04:57:01 -0300 | [diff] [blame] | 2354 | Fref = 360000000UL ; |
| 2355 | } |
Steven Toth | 85d220d | 2008-05-01 05:48:14 -0300 | [diff] [blame] | 2356 | if (state->IF_LO == 4570000UL) { |
Steven Toth | 3935c25 | 2008-05-01 05:45:44 -0300 | [diff] [blame] | 2357 | status += MXL_ControlWrite(fe, IF_DIVVAL, 0x06) ; |
| 2358 | status += MXL_ControlWrite(fe, IF_VCO_BIAS, 0x08) ; |
Steven Toth | 52c99bd | 2008-05-01 04:57:01 -0300 | [diff] [blame] | 2359 | Fref = 365600000UL ; |
| 2360 | } |
Steven Toth | 85d220d | 2008-05-01 05:48:14 -0300 | [diff] [blame] | 2361 | if (state->IF_LO == 4000000UL) { |
Steven Toth | 3935c25 | 2008-05-01 05:45:44 -0300 | [diff] [blame] | 2362 | status += MXL_ControlWrite(fe, IF_DIVVAL, 0x05) ; |
| 2363 | status += MXL_ControlWrite(fe, IF_VCO_BIAS, 0x08) ; |
Steven Toth | 52c99bd | 2008-05-01 04:57:01 -0300 | [diff] [blame] | 2364 | Fref = 360000000UL ; |
| 2365 | } |
Steven Toth | 85d220d | 2008-05-01 05:48:14 -0300 | [diff] [blame] | 2366 | if (state->IF_LO == 57400000UL) |
Steven Toth | 52c99bd | 2008-05-01 04:57:01 -0300 | [diff] [blame] | 2367 | { |
Steven Toth | 3935c25 | 2008-05-01 05:45:44 -0300 | [diff] [blame] | 2368 | status += MXL_ControlWrite(fe, IF_DIVVAL, 0x10) ; |
| 2369 | status += MXL_ControlWrite(fe, IF_VCO_BIAS, 0x08) ; |
Steven Toth | 52c99bd | 2008-05-01 04:57:01 -0300 | [diff] [blame] | 2370 | Fref = 344400000UL ; |
| 2371 | } |
Steven Toth | 85d220d | 2008-05-01 05:48:14 -0300 | [diff] [blame] | 2372 | if (state->IF_LO == 44400000UL) |
Steven Toth | 52c99bd | 2008-05-01 04:57:01 -0300 | [diff] [blame] | 2373 | { |
Steven Toth | 3935c25 | 2008-05-01 05:45:44 -0300 | [diff] [blame] | 2374 | status += MXL_ControlWrite(fe, IF_DIVVAL, 0x08) ; |
| 2375 | status += MXL_ControlWrite(fe, IF_VCO_BIAS, 0x08) ; |
Steven Toth | 52c99bd | 2008-05-01 04:57:01 -0300 | [diff] [blame] | 2376 | Fref = 355200000UL ; |
| 2377 | } |
Steven Toth | 85d220d | 2008-05-01 05:48:14 -0300 | [diff] [blame] | 2378 | if (state->IF_LO == 44150000UL) |
Steven Toth | 52c99bd | 2008-05-01 04:57:01 -0300 | [diff] [blame] | 2379 | { |
Steven Toth | 3935c25 | 2008-05-01 05:45:44 -0300 | [diff] [blame] | 2380 | status += MXL_ControlWrite(fe, IF_DIVVAL, 0x08) ; |
| 2381 | status += MXL_ControlWrite(fe, IF_VCO_BIAS, 0x08) ; |
Steven Toth | 52c99bd | 2008-05-01 04:57:01 -0300 | [diff] [blame] | 2382 | Fref = 353200000UL ; |
| 2383 | } |
Steven Toth | 85d220d | 2008-05-01 05:48:14 -0300 | [diff] [blame] | 2384 | if (state->IF_LO == 37050000UL) |
Steven Toth | 52c99bd | 2008-05-01 04:57:01 -0300 | [diff] [blame] | 2385 | { |
Steven Toth | 3935c25 | 2008-05-01 05:45:44 -0300 | [diff] [blame] | 2386 | status += MXL_ControlWrite(fe, IF_DIVVAL, 0x04) ; |
| 2387 | status += MXL_ControlWrite(fe, IF_VCO_BIAS, 0x08) ; |
Steven Toth | 52c99bd | 2008-05-01 04:57:01 -0300 | [diff] [blame] | 2388 | Fref = 370500000UL ; |
| 2389 | } |
Steven Toth | 85d220d | 2008-05-01 05:48:14 -0300 | [diff] [blame] | 2390 | if (state->IF_LO == 36550000UL) |
Steven Toth | 52c99bd | 2008-05-01 04:57:01 -0300 | [diff] [blame] | 2391 | { |
Steven Toth | 3935c25 | 2008-05-01 05:45:44 -0300 | [diff] [blame] | 2392 | status += MXL_ControlWrite(fe, IF_DIVVAL, 0x04) ; |
| 2393 | status += MXL_ControlWrite(fe, IF_VCO_BIAS, 0x08) ; |
Steven Toth | 52c99bd | 2008-05-01 04:57:01 -0300 | [diff] [blame] | 2394 | Fref = 365500000UL ; |
| 2395 | } |
Steven Toth | 85d220d | 2008-05-01 05:48:14 -0300 | [diff] [blame] | 2396 | if (state->IF_LO == 36125000UL) { |
Steven Toth | 3935c25 | 2008-05-01 05:45:44 -0300 | [diff] [blame] | 2397 | status += MXL_ControlWrite(fe, IF_DIVVAL, 0x04) ; |
| 2398 | status += MXL_ControlWrite(fe, IF_VCO_BIAS, 0x08) ; |
Steven Toth | 52c99bd | 2008-05-01 04:57:01 -0300 | [diff] [blame] | 2399 | Fref = 361250000UL ; |
| 2400 | } |
Steven Toth | 85d220d | 2008-05-01 05:48:14 -0300 | [diff] [blame] | 2401 | if (state->IF_LO == 6000000UL) { |
Steven Toth | 3935c25 | 2008-05-01 05:45:44 -0300 | [diff] [blame] | 2402 | status += MXL_ControlWrite(fe, IF_DIVVAL, 0x07) ; |
| 2403 | status += MXL_ControlWrite(fe, IF_VCO_BIAS, 0x08) ; |
Steven Toth | 52c99bd | 2008-05-01 04:57:01 -0300 | [diff] [blame] | 2404 | Fref = 360000000UL ; |
| 2405 | } |
Steven Toth | 85d220d | 2008-05-01 05:48:14 -0300 | [diff] [blame] | 2406 | if (state->IF_LO == 5400000UL) |
Steven Toth | 52c99bd | 2008-05-01 04:57:01 -0300 | [diff] [blame] | 2407 | { |
Steven Toth | 3935c25 | 2008-05-01 05:45:44 -0300 | [diff] [blame] | 2408 | status += MXL_ControlWrite(fe, IF_DIVVAL, 0x07) ; |
| 2409 | status += MXL_ControlWrite(fe, IF_VCO_BIAS, 0x0C) ; |
Steven Toth | 52c99bd | 2008-05-01 04:57:01 -0300 | [diff] [blame] | 2410 | Fref = 324000000UL ; |
| 2411 | } |
Steven Toth | 85d220d | 2008-05-01 05:48:14 -0300 | [diff] [blame] | 2412 | if (state->IF_LO == 5380000UL) { |
Steven Toth | 8c66a19 | 2008-05-01 06:35:48 -0300 | [diff] [blame] | 2413 | printk("%s() doing 5.38\n", __func__); |
Steven Toth | 3935c25 | 2008-05-01 05:45:44 -0300 | [diff] [blame] | 2414 | status += MXL_ControlWrite(fe, IF_DIVVAL, 0x07) ; |
| 2415 | status += MXL_ControlWrite(fe, IF_VCO_BIAS, 0x0C) ; |
Steven Toth | 52c99bd | 2008-05-01 04:57:01 -0300 | [diff] [blame] | 2416 | Fref = 322800000UL ; |
| 2417 | } |
Steven Toth | 85d220d | 2008-05-01 05:48:14 -0300 | [diff] [blame] | 2418 | if (state->IF_LO == 5200000UL) { |
Steven Toth | 3935c25 | 2008-05-01 05:45:44 -0300 | [diff] [blame] | 2419 | status += MXL_ControlWrite(fe, IF_DIVVAL, 0x09) ; |
| 2420 | status += MXL_ControlWrite(fe, IF_VCO_BIAS, 0x08) ; |
Steven Toth | 52c99bd | 2008-05-01 04:57:01 -0300 | [diff] [blame] | 2421 | Fref = 374400000UL ; |
| 2422 | } |
Steven Toth | 85d220d | 2008-05-01 05:48:14 -0300 | [diff] [blame] | 2423 | if (state->IF_LO == 4900000UL) |
Steven Toth | 52c99bd | 2008-05-01 04:57:01 -0300 | [diff] [blame] | 2424 | { |
Steven Toth | 3935c25 | 2008-05-01 05:45:44 -0300 | [diff] [blame] | 2425 | status += MXL_ControlWrite(fe, IF_DIVVAL, 0x09) ; |
| 2426 | status += MXL_ControlWrite(fe, IF_VCO_BIAS, 0x08) ; |
Steven Toth | 52c99bd | 2008-05-01 04:57:01 -0300 | [diff] [blame] | 2427 | Fref = 352800000UL ; |
| 2428 | } |
Steven Toth | 85d220d | 2008-05-01 05:48:14 -0300 | [diff] [blame] | 2429 | if (state->IF_LO == 4400000UL) |
Steven Toth | 52c99bd | 2008-05-01 04:57:01 -0300 | [diff] [blame] | 2430 | { |
Steven Toth | 3935c25 | 2008-05-01 05:45:44 -0300 | [diff] [blame] | 2431 | status += MXL_ControlWrite(fe, IF_DIVVAL, 0x06) ; |
| 2432 | status += MXL_ControlWrite(fe, IF_VCO_BIAS, 0x08) ; |
Steven Toth | 52c99bd | 2008-05-01 04:57:01 -0300 | [diff] [blame] | 2433 | Fref = 352000000UL ; |
| 2434 | } |
Steven Toth | 85d220d | 2008-05-01 05:48:14 -0300 | [diff] [blame] | 2435 | if (state->IF_LO == 4063000UL) //add for 2.6.8 |
Steven Toth | 52c99bd | 2008-05-01 04:57:01 -0300 | [diff] [blame] | 2436 | { |
Steven Toth | 3935c25 | 2008-05-01 05:45:44 -0300 | [diff] [blame] | 2437 | status += MXL_ControlWrite(fe, IF_DIVVAL, 0x05) ; |
| 2438 | status += MXL_ControlWrite(fe, IF_VCO_BIAS, 0x08) ; |
Steven Toth | 52c99bd | 2008-05-01 04:57:01 -0300 | [diff] [blame] | 2439 | Fref = 365670000UL ; |
| 2440 | } |
| 2441 | } |
| 2442 | // CHCAL_INT_MOD_IF |
| 2443 | // CHCAL_FRAC_MOD_IF |
Steven Toth | 3935c25 | 2008-05-01 05:45:44 -0300 | [diff] [blame] | 2444 | intModVal = Fref / (state->Fxtal * Kdbl/2) ; |
| 2445 | status += MXL_ControlWrite(fe, CHCAL_INT_MOD_IF, intModVal ) ; |
Steven Toth | 52c99bd | 2008-05-01 04:57:01 -0300 | [diff] [blame] | 2446 | |
Steven Toth | 3935c25 | 2008-05-01 05:45:44 -0300 | [diff] [blame] | 2447 | fracModVal = (2<<15)*(Fref/1000 - (state->Fxtal/1000 * Kdbl/2) * intModVal); |
| 2448 | fracModVal = fracModVal / ((state->Fxtal * Kdbl/2)/1000) ; |
| 2449 | status += MXL_ControlWrite(fe, CHCAL_FRAC_MOD_IF, fracModVal) ; |
Steven Toth | 52c99bd | 2008-05-01 04:57:01 -0300 | [diff] [blame] | 2450 | |
Steven Toth | 52c99bd | 2008-05-01 04:57:01 -0300 | [diff] [blame] | 2451 | return status ; |
| 2452 | } |
| 2453 | |
| 2454 | /////////////////////////////////////////////////////////////////////////////// |
| 2455 | // // |
| 2456 | // Function: MXL_GetXtalInt // |
| 2457 | // // |
Steven Toth | a8214d4 | 2008-05-01 05:02:58 -0300 | [diff] [blame] | 2458 | // Description: return the Crystal Integration Value for // |
| 2459 | // TG_VCO_BIAS calculation // |
Steven Toth | 52c99bd | 2008-05-01 04:57:01 -0300 | [diff] [blame] | 2460 | // // |
| 2461 | // Globals: // |
| 2462 | // NONE // |
| 2463 | // // |
| 2464 | // Functions used: // |
Steven Toth | a8214d4 | 2008-05-01 05:02:58 -0300 | [diff] [blame] | 2465 | // NONE // |
Steven Toth | 52c99bd | 2008-05-01 04:57:01 -0300 | [diff] [blame] | 2466 | // // |
| 2467 | // Inputs: // |
| 2468 | // Crystal Frequency Value in Hz // |
| 2469 | // // |
| 2470 | // Outputs: // |
| 2471 | // Calculated Crystal Frequency Integration Value // |
| 2472 | // // |
| 2473 | // Return: // |
| 2474 | // 0 : Successful // |
| 2475 | // > 0 : Failed // |
| 2476 | // // |
| 2477 | /////////////////////////////////////////////////////////////////////////////// |
Steven Toth | a8214d4 | 2008-05-01 05:02:58 -0300 | [diff] [blame] | 2478 | u32 MXL_GetXtalInt(u32 Xtal_Freq) |
Steven Toth | 52c99bd | 2008-05-01 04:57:01 -0300 | [diff] [blame] | 2479 | { |
| 2480 | if ((Xtal_Freq % 1000000) == 0) |
| 2481 | return (Xtal_Freq / 10000) ; |
| 2482 | else |
| 2483 | return (((Xtal_Freq / 1000000) + 1)*100) ; |
| 2484 | } |
| 2485 | |
| 2486 | /////////////////////////////////////////////////////////////////////////////// |
| 2487 | // // |
| 2488 | // Function: MXL5005_TuneRF // |
| 2489 | // // |
| 2490 | // Description: Set control names to tune to requested RF_IN frequency // |
| 2491 | // // |
| 2492 | // Globals: // |
| 2493 | // None // |
| 2494 | // // |
| 2495 | // Functions used: // |
| 2496 | // MXL_SynthRFTGLO_Calc // |
| 2497 | // MXL5005_ControlWrite // |
Steven Toth | 3935c25 | 2008-05-01 05:45:44 -0300 | [diff] [blame] | 2498 | // MXL_GetXtalInt // |
Steven Toth | 52c99bd | 2008-05-01 04:57:01 -0300 | [diff] [blame] | 2499 | // // |
| 2500 | // Inputs: // |
| 2501 | // Tuner : Tuner structure defined at higher level // |
| 2502 | // // |
| 2503 | // Outputs: // |
| 2504 | // Tuner // |
| 2505 | // // |
| 2506 | // Return: // |
| 2507 | // 0 : Successful // |
| 2508 | // 1 : Unsuccessful // |
| 2509 | /////////////////////////////////////////////////////////////////////////////// |
Steven Toth | 3935c25 | 2008-05-01 05:45:44 -0300 | [diff] [blame] | 2510 | u16 MXL_TuneRF(struct dvb_frontend *fe, u32 RF_Freq) |
Steven Toth | 52c99bd | 2008-05-01 04:57:01 -0300 | [diff] [blame] | 2511 | { |
Steven Toth | 85d220d | 2008-05-01 05:48:14 -0300 | [diff] [blame] | 2512 | struct mxl5005s_state *state = fe->tuner_priv; |
Steven Toth | 52c99bd | 2008-05-01 04:57:01 -0300 | [diff] [blame] | 2513 | // Declare Local Variables |
Steven Toth | 3935c25 | 2008-05-01 05:45:44 -0300 | [diff] [blame] | 2514 | u16 status = 0; |
| 2515 | u32 divider_val, E3, E4, E5, E5A; |
| 2516 | u32 Fmax, Fmin, FmaxBin, FminBin; |
Steven Toth | a8214d4 | 2008-05-01 05:02:58 -0300 | [diff] [blame] | 2517 | u32 Kdbl_RF = 2; |
Steven Toth | 3935c25 | 2008-05-01 05:45:44 -0300 | [diff] [blame] | 2518 | u32 tg_divval; |
| 2519 | u32 tg_lo; |
| 2520 | u32 Xtal_Int; |
Steven Toth | 52c99bd | 2008-05-01 04:57:01 -0300 | [diff] [blame] | 2521 | |
Steven Toth | a8214d4 | 2008-05-01 05:02:58 -0300 | [diff] [blame] | 2522 | u32 Fref_TG; |
| 2523 | u32 Fvco; |
| 2524 | // u32 temp; |
Steven Toth | 52c99bd | 2008-05-01 04:57:01 -0300 | [diff] [blame] | 2525 | |
| 2526 | |
Steven Toth | 3935c25 | 2008-05-01 05:45:44 -0300 | [diff] [blame] | 2527 | Xtal_Int = MXL_GetXtalInt(state->Fxtal); |
Steven Toth | 52c99bd | 2008-05-01 04:57:01 -0300 | [diff] [blame] | 2528 | |
Steven Toth | 3935c25 | 2008-05-01 05:45:44 -0300 | [diff] [blame] | 2529 | state->RF_IN = RF_Freq; |
Steven Toth | 52c99bd | 2008-05-01 04:57:01 -0300 | [diff] [blame] | 2530 | |
Steven Toth | 3935c25 | 2008-05-01 05:45:44 -0300 | [diff] [blame] | 2531 | MXL_SynthRFTGLO_Calc(fe); |
Steven Toth | 52c99bd | 2008-05-01 04:57:01 -0300 | [diff] [blame] | 2532 | |
Steven Toth | 3935c25 | 2008-05-01 05:45:44 -0300 | [diff] [blame] | 2533 | if (state->Fxtal >= 12000000UL && state->Fxtal <= 22000000UL) |
| 2534 | Kdbl_RF = 2; |
| 2535 | if (state->Fxtal > 22000000 && state->Fxtal <= 32000000) |
| 2536 | Kdbl_RF = 1; |
Steven Toth | 52c99bd | 2008-05-01 04:57:01 -0300 | [diff] [blame] | 2537 | |
| 2538 | // |
| 2539 | // Downconverter Controls |
| 2540 | // |
| 2541 | // Look-Up Table Implementation for: |
| 2542 | // DN_POLY |
| 2543 | // DN_RFGAIN |
| 2544 | // DN_CAP_RFLPF |
| 2545 | // DN_EN_VHFUHFBAR |
| 2546 | // DN_GAIN_ADJUST |
| 2547 | // Change the boundary reference from RF_IN to RF_LO |
Steven Toth | 3935c25 | 2008-05-01 05:45:44 -0300 | [diff] [blame] | 2548 | if (state->RF_LO < 40000000UL) { |
Steven Toth | 52c99bd | 2008-05-01 04:57:01 -0300 | [diff] [blame] | 2549 | return -1; |
| 2550 | } |
Steven Toth | 3935c25 | 2008-05-01 05:45:44 -0300 | [diff] [blame] | 2551 | if (state->RF_LO >= 40000000UL && state->RF_LO <= 75000000UL) { |
Steven Toth | 52c99bd | 2008-05-01 04:57:01 -0300 | [diff] [blame] | 2552 | // Look-Up Table implementation |
Steven Toth | 3935c25 | 2008-05-01 05:45:44 -0300 | [diff] [blame] | 2553 | status += MXL_ControlWrite(fe, DN_POLY, 2); |
| 2554 | status += MXL_ControlWrite(fe, DN_RFGAIN, 3); |
| 2555 | status += MXL_ControlWrite(fe, DN_CAP_RFLPF, 423); |
| 2556 | status += MXL_ControlWrite(fe, DN_EN_VHFUHFBAR, 1); |
| 2557 | status += MXL_ControlWrite(fe, DN_GAIN_ADJUST, 1); |
Steven Toth | 52c99bd | 2008-05-01 04:57:01 -0300 | [diff] [blame] | 2558 | } |
Steven Toth | 3935c25 | 2008-05-01 05:45:44 -0300 | [diff] [blame] | 2559 | if (state->RF_LO > 75000000UL && state->RF_LO <= 100000000UL) { |
Steven Toth | 52c99bd | 2008-05-01 04:57:01 -0300 | [diff] [blame] | 2560 | // Look-Up Table implementation |
Steven Toth | 3935c25 | 2008-05-01 05:45:44 -0300 | [diff] [blame] | 2561 | status += MXL_ControlWrite(fe, DN_POLY, 3); |
| 2562 | status += MXL_ControlWrite(fe, DN_RFGAIN, 3); |
| 2563 | status += MXL_ControlWrite(fe, DN_CAP_RFLPF, 222); |
| 2564 | status += MXL_ControlWrite(fe, DN_EN_VHFUHFBAR, 1); |
| 2565 | status += MXL_ControlWrite(fe, DN_GAIN_ADJUST, 1); |
Steven Toth | 52c99bd | 2008-05-01 04:57:01 -0300 | [diff] [blame] | 2566 | } |
Steven Toth | 3935c25 | 2008-05-01 05:45:44 -0300 | [diff] [blame] | 2567 | if (state->RF_LO > 100000000UL && state->RF_LO <= 150000000UL) { |
Steven Toth | 52c99bd | 2008-05-01 04:57:01 -0300 | [diff] [blame] | 2568 | // Look-Up Table implementation |
Steven Toth | 3935c25 | 2008-05-01 05:45:44 -0300 | [diff] [blame] | 2569 | status += MXL_ControlWrite(fe, DN_POLY, 3); |
| 2570 | status += MXL_ControlWrite(fe, DN_RFGAIN, 3); |
| 2571 | status += MXL_ControlWrite(fe, DN_CAP_RFLPF, 147); |
| 2572 | status += MXL_ControlWrite(fe, DN_EN_VHFUHFBAR, 1); |
| 2573 | status += MXL_ControlWrite(fe, DN_GAIN_ADJUST, 2); |
Steven Toth | 52c99bd | 2008-05-01 04:57:01 -0300 | [diff] [blame] | 2574 | } |
Steven Toth | 3935c25 | 2008-05-01 05:45:44 -0300 | [diff] [blame] | 2575 | if (state->RF_LO > 150000000UL && state->RF_LO <= 200000000UL) { |
Steven Toth | 52c99bd | 2008-05-01 04:57:01 -0300 | [diff] [blame] | 2576 | // Look-Up Table implementation |
Steven Toth | 3935c25 | 2008-05-01 05:45:44 -0300 | [diff] [blame] | 2577 | status += MXL_ControlWrite(fe, DN_POLY, 3); |
| 2578 | status += MXL_ControlWrite(fe, DN_RFGAIN, 3); |
| 2579 | status += MXL_ControlWrite(fe, DN_CAP_RFLPF, 9); |
| 2580 | status += MXL_ControlWrite(fe, DN_EN_VHFUHFBAR, 1); |
| 2581 | status += MXL_ControlWrite(fe, DN_GAIN_ADJUST, 2); |
Steven Toth | 52c99bd | 2008-05-01 04:57:01 -0300 | [diff] [blame] | 2582 | } |
Steven Toth | 3935c25 | 2008-05-01 05:45:44 -0300 | [diff] [blame] | 2583 | if (state->RF_LO > 200000000UL && state->RF_LO <= 300000000UL) { |
Steven Toth | 52c99bd | 2008-05-01 04:57:01 -0300 | [diff] [blame] | 2584 | // Look-Up Table implementation |
Steven Toth | 3935c25 | 2008-05-01 05:45:44 -0300 | [diff] [blame] | 2585 | status += MXL_ControlWrite(fe, DN_POLY, 3) ; |
| 2586 | status += MXL_ControlWrite(fe, DN_RFGAIN, 3) ; |
| 2587 | status += MXL_ControlWrite(fe, DN_CAP_RFLPF, 0) ; |
| 2588 | status += MXL_ControlWrite(fe, DN_EN_VHFUHFBAR, 1) ; |
| 2589 | status += MXL_ControlWrite(fe, DN_GAIN_ADJUST, 3) ; |
Steven Toth | 52c99bd | 2008-05-01 04:57:01 -0300 | [diff] [blame] | 2590 | } |
Steven Toth | 3935c25 | 2008-05-01 05:45:44 -0300 | [diff] [blame] | 2591 | if (state->RF_LO > 300000000UL && state->RF_LO <= 650000000UL) { |
Steven Toth | 52c99bd | 2008-05-01 04:57:01 -0300 | [diff] [blame] | 2592 | // Look-Up Table implementation |
Steven Toth | 3935c25 | 2008-05-01 05:45:44 -0300 | [diff] [blame] | 2593 | status += MXL_ControlWrite(fe, DN_POLY, 3) ; |
| 2594 | status += MXL_ControlWrite(fe, DN_RFGAIN, 1) ; |
| 2595 | status += MXL_ControlWrite(fe, DN_CAP_RFLPF, 0) ; |
| 2596 | status += MXL_ControlWrite(fe, DN_EN_VHFUHFBAR, 0) ; |
| 2597 | status += MXL_ControlWrite(fe, DN_GAIN_ADJUST, 3) ; |
Steven Toth | 52c99bd | 2008-05-01 04:57:01 -0300 | [diff] [blame] | 2598 | } |
Steven Toth | 3935c25 | 2008-05-01 05:45:44 -0300 | [diff] [blame] | 2599 | if (state->RF_LO > 650000000UL && state->RF_LO <= 900000000UL) { |
Steven Toth | 52c99bd | 2008-05-01 04:57:01 -0300 | [diff] [blame] | 2600 | // Look-Up Table implementation |
Steven Toth | 3935c25 | 2008-05-01 05:45:44 -0300 | [diff] [blame] | 2601 | status += MXL_ControlWrite(fe, DN_POLY, 3) ; |
| 2602 | status += MXL_ControlWrite(fe, DN_RFGAIN, 2) ; |
| 2603 | status += MXL_ControlWrite(fe, DN_CAP_RFLPF, 0) ; |
| 2604 | status += MXL_ControlWrite(fe, DN_EN_VHFUHFBAR, 0) ; |
| 2605 | status += MXL_ControlWrite(fe, DN_GAIN_ADJUST, 3) ; |
Steven Toth | 52c99bd | 2008-05-01 04:57:01 -0300 | [diff] [blame] | 2606 | } |
Steven Toth | 3935c25 | 2008-05-01 05:45:44 -0300 | [diff] [blame] | 2607 | if (state->RF_LO > 900000000UL) { |
Steven Toth | 52c99bd | 2008-05-01 04:57:01 -0300 | [diff] [blame] | 2608 | return -1; |
| 2609 | } |
| 2610 | // DN_IQTNBUF_AMP |
| 2611 | // DN_IQTNGNBFBIAS_BST |
Steven Toth | 3935c25 | 2008-05-01 05:45:44 -0300 | [diff] [blame] | 2612 | if (state->RF_LO >= 40000000UL && state->RF_LO <= 75000000UL) { |
| 2613 | status += MXL_ControlWrite(fe, DN_IQTNBUF_AMP, 1); |
| 2614 | status += MXL_ControlWrite(fe, DN_IQTNGNBFBIAS_BST, 0); |
Steven Toth | 52c99bd | 2008-05-01 04:57:01 -0300 | [diff] [blame] | 2615 | } |
Steven Toth | 3935c25 | 2008-05-01 05:45:44 -0300 | [diff] [blame] | 2616 | if (state->RF_LO > 75000000UL && state->RF_LO <= 100000000UL) { |
| 2617 | status += MXL_ControlWrite(fe, DN_IQTNBUF_AMP, 1); |
| 2618 | status += MXL_ControlWrite(fe, DN_IQTNGNBFBIAS_BST, 0); |
Steven Toth | 52c99bd | 2008-05-01 04:57:01 -0300 | [diff] [blame] | 2619 | } |
Steven Toth | 3935c25 | 2008-05-01 05:45:44 -0300 | [diff] [blame] | 2620 | if (state->RF_LO > 100000000UL && state->RF_LO <= 150000000UL) { |
| 2621 | status += MXL_ControlWrite(fe, DN_IQTNBUF_AMP, 1); |
| 2622 | status += MXL_ControlWrite(fe, DN_IQTNGNBFBIAS_BST, 0); |
Steven Toth | 52c99bd | 2008-05-01 04:57:01 -0300 | [diff] [blame] | 2623 | } |
Steven Toth | 3935c25 | 2008-05-01 05:45:44 -0300 | [diff] [blame] | 2624 | if (state->RF_LO > 150000000UL && state->RF_LO <= 200000000UL) { |
| 2625 | status += MXL_ControlWrite(fe, DN_IQTNBUF_AMP, 1); |
| 2626 | status += MXL_ControlWrite(fe, DN_IQTNGNBFBIAS_BST, 0); |
Steven Toth | 52c99bd | 2008-05-01 04:57:01 -0300 | [diff] [blame] | 2627 | } |
Steven Toth | 3935c25 | 2008-05-01 05:45:44 -0300 | [diff] [blame] | 2628 | if (state->RF_LO > 200000000UL && state->RF_LO <= 300000000UL) { |
| 2629 | status += MXL_ControlWrite(fe, DN_IQTNBUF_AMP, 1); |
| 2630 | status += MXL_ControlWrite(fe, DN_IQTNGNBFBIAS_BST, 0); |
Steven Toth | 52c99bd | 2008-05-01 04:57:01 -0300 | [diff] [blame] | 2631 | } |
Steven Toth | 3935c25 | 2008-05-01 05:45:44 -0300 | [diff] [blame] | 2632 | if (state->RF_LO > 300000000UL && state->RF_LO <= 400000000UL) { |
| 2633 | status += MXL_ControlWrite(fe, DN_IQTNBUF_AMP, 1); |
| 2634 | status += MXL_ControlWrite(fe, DN_IQTNGNBFBIAS_BST, 0); |
Steven Toth | 52c99bd | 2008-05-01 04:57:01 -0300 | [diff] [blame] | 2635 | } |
Steven Toth | 3935c25 | 2008-05-01 05:45:44 -0300 | [diff] [blame] | 2636 | if (state->RF_LO > 400000000UL && state->RF_LO <= 450000000UL) { |
| 2637 | status += MXL_ControlWrite(fe, DN_IQTNBUF_AMP, 1); |
| 2638 | status += MXL_ControlWrite(fe, DN_IQTNGNBFBIAS_BST, 0); |
Steven Toth | 52c99bd | 2008-05-01 04:57:01 -0300 | [diff] [blame] | 2639 | } |
Steven Toth | 3935c25 | 2008-05-01 05:45:44 -0300 | [diff] [blame] | 2640 | if (state->RF_LO > 450000000UL && state->RF_LO <= 500000000UL) { |
| 2641 | status += MXL_ControlWrite(fe, DN_IQTNBUF_AMP, 1); |
| 2642 | status += MXL_ControlWrite(fe, DN_IQTNGNBFBIAS_BST, 0); |
Steven Toth | 52c99bd | 2008-05-01 04:57:01 -0300 | [diff] [blame] | 2643 | } |
Steven Toth | 3935c25 | 2008-05-01 05:45:44 -0300 | [diff] [blame] | 2644 | if (state->RF_LO > 500000000UL && state->RF_LO <= 550000000UL) { |
| 2645 | status += MXL_ControlWrite(fe, DN_IQTNBUF_AMP, 1); |
| 2646 | status += MXL_ControlWrite(fe, DN_IQTNGNBFBIAS_BST, 0); |
Steven Toth | 52c99bd | 2008-05-01 04:57:01 -0300 | [diff] [blame] | 2647 | } |
Steven Toth | 3935c25 | 2008-05-01 05:45:44 -0300 | [diff] [blame] | 2648 | if (state->RF_LO > 550000000UL && state->RF_LO <= 600000000UL) { |
| 2649 | status += MXL_ControlWrite(fe, DN_IQTNBUF_AMP, 1); |
| 2650 | status += MXL_ControlWrite(fe, DN_IQTNGNBFBIAS_BST, 0); |
Steven Toth | 52c99bd | 2008-05-01 04:57:01 -0300 | [diff] [blame] | 2651 | } |
Steven Toth | 3935c25 | 2008-05-01 05:45:44 -0300 | [diff] [blame] | 2652 | if (state->RF_LO > 600000000UL && state->RF_LO <= 650000000UL) { |
| 2653 | status += MXL_ControlWrite(fe, DN_IQTNBUF_AMP, 1); |
| 2654 | status += MXL_ControlWrite(fe, DN_IQTNGNBFBIAS_BST, 0); |
Steven Toth | 52c99bd | 2008-05-01 04:57:01 -0300 | [diff] [blame] | 2655 | } |
Steven Toth | 3935c25 | 2008-05-01 05:45:44 -0300 | [diff] [blame] | 2656 | if (state->RF_LO > 650000000UL && state->RF_LO <= 700000000UL) { |
| 2657 | status += MXL_ControlWrite(fe, DN_IQTNBUF_AMP, 1); |
| 2658 | status += MXL_ControlWrite(fe, DN_IQTNGNBFBIAS_BST, 0); |
Steven Toth | 52c99bd | 2008-05-01 04:57:01 -0300 | [diff] [blame] | 2659 | } |
Steven Toth | 3935c25 | 2008-05-01 05:45:44 -0300 | [diff] [blame] | 2660 | if (state->RF_LO > 700000000UL && state->RF_LO <= 750000000UL) { |
| 2661 | status += MXL_ControlWrite(fe, DN_IQTNBUF_AMP, 1); |
| 2662 | status += MXL_ControlWrite(fe, DN_IQTNGNBFBIAS_BST, 0); |
Steven Toth | 52c99bd | 2008-05-01 04:57:01 -0300 | [diff] [blame] | 2663 | } |
Steven Toth | 3935c25 | 2008-05-01 05:45:44 -0300 | [diff] [blame] | 2664 | if (state->RF_LO > 750000000UL && state->RF_LO <= 800000000UL) { |
| 2665 | status += MXL_ControlWrite(fe, DN_IQTNBUF_AMP, 1); |
| 2666 | status += MXL_ControlWrite(fe, DN_IQTNGNBFBIAS_BST, 0); |
Steven Toth | 52c99bd | 2008-05-01 04:57:01 -0300 | [diff] [blame] | 2667 | } |
Steven Toth | 3935c25 | 2008-05-01 05:45:44 -0300 | [diff] [blame] | 2668 | if (state->RF_LO > 800000000UL && state->RF_LO <= 850000000UL) { |
| 2669 | status += MXL_ControlWrite(fe, DN_IQTNBUF_AMP, 10); |
| 2670 | status += MXL_ControlWrite(fe, DN_IQTNGNBFBIAS_BST, 1); |
Steven Toth | 52c99bd | 2008-05-01 04:57:01 -0300 | [diff] [blame] | 2671 | } |
Steven Toth | 3935c25 | 2008-05-01 05:45:44 -0300 | [diff] [blame] | 2672 | if (state->RF_LO > 850000000UL && state->RF_LO <= 900000000UL) { |
| 2673 | status += MXL_ControlWrite(fe, DN_IQTNBUF_AMP, 10); |
| 2674 | status += MXL_ControlWrite(fe, DN_IQTNGNBFBIAS_BST, 1); |
Steven Toth | 52c99bd | 2008-05-01 04:57:01 -0300 | [diff] [blame] | 2675 | } |
| 2676 | |
| 2677 | // |
| 2678 | // Set RF Synth and LO Path Control |
| 2679 | // |
| 2680 | // Look-Up table implementation for: |
| 2681 | // RFSYN_EN_OUTMUX |
| 2682 | // RFSYN_SEL_VCO_OUT |
| 2683 | // RFSYN_SEL_VCO_HI |
| 2684 | // RFSYN_SEL_DIVM |
| 2685 | // RFSYN_RF_DIV_BIAS |
| 2686 | // DN_SEL_FREQ |
| 2687 | // |
| 2688 | // Set divider_val, Fmax, Fmix to use in Equations |
| 2689 | FminBin = 28000000UL ; |
| 2690 | FmaxBin = 42500000UL ; |
Steven Toth | 3935c25 | 2008-05-01 05:45:44 -0300 | [diff] [blame] | 2691 | if (state->RF_LO >= 40000000UL && state->RF_LO <= FmaxBin) { |
| 2692 | status += MXL_ControlWrite(fe, RFSYN_EN_OUTMUX, 1); |
| 2693 | status += MXL_ControlWrite(fe, RFSYN_SEL_VCO_OUT, 0); |
| 2694 | status += MXL_ControlWrite(fe, RFSYN_SEL_VCO_HI, 0); |
| 2695 | status += MXL_ControlWrite(fe, RFSYN_SEL_DIVM, 0); |
| 2696 | status += MXL_ControlWrite(fe, RFSYN_RF_DIV_BIAS, 1); |
| 2697 | status += MXL_ControlWrite(fe, DN_SEL_FREQ, 1); |
Steven Toth | 52c99bd | 2008-05-01 04:57:01 -0300 | [diff] [blame] | 2698 | divider_val = 64 ; |
| 2699 | Fmax = FmaxBin ; |
| 2700 | Fmin = FminBin ; |
| 2701 | } |
| 2702 | FminBin = 42500000UL ; |
| 2703 | FmaxBin = 56000000UL ; |
Steven Toth | 3935c25 | 2008-05-01 05:45:44 -0300 | [diff] [blame] | 2704 | if (state->RF_LO > FminBin && state->RF_LO <= FmaxBin) { |
| 2705 | status += MXL_ControlWrite(fe, RFSYN_EN_OUTMUX, 1); |
| 2706 | status += MXL_ControlWrite(fe, RFSYN_SEL_VCO_OUT, 0); |
| 2707 | status += MXL_ControlWrite(fe, RFSYN_SEL_VCO_HI, 1); |
| 2708 | status += MXL_ControlWrite(fe, RFSYN_SEL_DIVM, 0); |
| 2709 | status += MXL_ControlWrite(fe, RFSYN_RF_DIV_BIAS, 1); |
| 2710 | status += MXL_ControlWrite(fe, DN_SEL_FREQ, 1); |
Steven Toth | 52c99bd | 2008-05-01 04:57:01 -0300 | [diff] [blame] | 2711 | divider_val = 64 ; |
| 2712 | Fmax = FmaxBin ; |
| 2713 | Fmin = FminBin ; |
| 2714 | } |
| 2715 | FminBin = 56000000UL ; |
| 2716 | FmaxBin = 85000000UL ; |
Steven Toth | 3935c25 | 2008-05-01 05:45:44 -0300 | [diff] [blame] | 2717 | if (state->RF_LO > FminBin && state->RF_LO <= FmaxBin) { |
| 2718 | status += MXL_ControlWrite(fe, RFSYN_EN_OUTMUX, 0) ; |
| 2719 | status += MXL_ControlWrite(fe, RFSYN_SEL_VCO_OUT, 1) ; |
| 2720 | status += MXL_ControlWrite(fe, RFSYN_SEL_VCO_HI, 0) ; |
| 2721 | status += MXL_ControlWrite(fe, RFSYN_SEL_DIVM, 0) ; |
| 2722 | status += MXL_ControlWrite(fe, RFSYN_RF_DIV_BIAS, 1) ; |
| 2723 | status += MXL_ControlWrite(fe, DN_SEL_FREQ, 1) ; |
Steven Toth | 52c99bd | 2008-05-01 04:57:01 -0300 | [diff] [blame] | 2724 | divider_val = 32 ; |
| 2725 | Fmax = FmaxBin ; |
| 2726 | Fmin = FminBin ; |
| 2727 | } |
| 2728 | FminBin = 85000000UL ; |
| 2729 | FmaxBin = 112000000UL ; |
Steven Toth | 3935c25 | 2008-05-01 05:45:44 -0300 | [diff] [blame] | 2730 | if (state->RF_LO > FminBin && state->RF_LO <= FmaxBin) { |
| 2731 | status += MXL_ControlWrite(fe, RFSYN_EN_OUTMUX, 0) ; |
| 2732 | status += MXL_ControlWrite(fe, RFSYN_SEL_VCO_OUT, 1) ; |
| 2733 | status += MXL_ControlWrite(fe, RFSYN_SEL_VCO_HI, 1) ; |
| 2734 | status += MXL_ControlWrite(fe, RFSYN_SEL_DIVM, 0) ; |
| 2735 | status += MXL_ControlWrite(fe, RFSYN_RF_DIV_BIAS, 1) ; |
| 2736 | status += MXL_ControlWrite(fe, DN_SEL_FREQ, 1) ; |
Steven Toth | 52c99bd | 2008-05-01 04:57:01 -0300 | [diff] [blame] | 2737 | divider_val = 32 ; |
| 2738 | Fmax = FmaxBin ; |
| 2739 | Fmin = FminBin ; |
| 2740 | } |
| 2741 | FminBin = 112000000UL ; |
| 2742 | FmaxBin = 170000000UL ; |
Steven Toth | 3935c25 | 2008-05-01 05:45:44 -0300 | [diff] [blame] | 2743 | if (state->RF_LO > FminBin && state->RF_LO <= FmaxBin) { |
| 2744 | status += MXL_ControlWrite(fe, RFSYN_EN_OUTMUX, 0) ; |
| 2745 | status += MXL_ControlWrite(fe, RFSYN_SEL_VCO_OUT, 1) ; |
| 2746 | status += MXL_ControlWrite(fe, RFSYN_SEL_VCO_HI, 0) ; |
| 2747 | status += MXL_ControlWrite(fe, RFSYN_SEL_DIVM, 0) ; |
| 2748 | status += MXL_ControlWrite(fe, RFSYN_RF_DIV_BIAS, 1) ; |
| 2749 | status += MXL_ControlWrite(fe, DN_SEL_FREQ, 2) ; |
Steven Toth | 52c99bd | 2008-05-01 04:57:01 -0300 | [diff] [blame] | 2750 | divider_val = 16 ; |
| 2751 | Fmax = FmaxBin ; |
| 2752 | Fmin = FminBin ; |
| 2753 | } |
| 2754 | FminBin = 170000000UL ; |
| 2755 | FmaxBin = 225000000UL ; |
Steven Toth | 3935c25 | 2008-05-01 05:45:44 -0300 | [diff] [blame] | 2756 | if (state->RF_LO > FminBin && state->RF_LO <= FmaxBin) { |
| 2757 | status += MXL_ControlWrite(fe, RFSYN_EN_OUTMUX, 0) ; |
| 2758 | status += MXL_ControlWrite(fe, RFSYN_SEL_VCO_OUT, 1) ; |
| 2759 | status += MXL_ControlWrite(fe, RFSYN_SEL_VCO_HI, 1) ; |
| 2760 | status += MXL_ControlWrite(fe, RFSYN_SEL_DIVM, 0) ; |
| 2761 | status += MXL_ControlWrite(fe, RFSYN_RF_DIV_BIAS, 1) ; |
| 2762 | status += MXL_ControlWrite(fe, DN_SEL_FREQ, 2) ; |
Steven Toth | 52c99bd | 2008-05-01 04:57:01 -0300 | [diff] [blame] | 2763 | divider_val = 16 ; |
| 2764 | Fmax = FmaxBin ; |
| 2765 | Fmin = FminBin ; |
| 2766 | } |
| 2767 | FminBin = 225000000UL ; |
| 2768 | FmaxBin = 300000000UL ; |
Steven Toth | 3935c25 | 2008-05-01 05:45:44 -0300 | [diff] [blame] | 2769 | if (state->RF_LO > FminBin && state->RF_LO <= FmaxBin) { |
| 2770 | status += MXL_ControlWrite(fe, RFSYN_EN_OUTMUX, 0) ; |
| 2771 | status += MXL_ControlWrite(fe, RFSYN_SEL_VCO_OUT, 1) ; |
| 2772 | status += MXL_ControlWrite(fe, RFSYN_SEL_VCO_HI, 0) ; |
| 2773 | status += MXL_ControlWrite(fe, RFSYN_SEL_DIVM, 0) ; |
| 2774 | status += MXL_ControlWrite(fe, RFSYN_RF_DIV_BIAS, 1) ; |
| 2775 | status += MXL_ControlWrite(fe, DN_SEL_FREQ, 4) ; |
Steven Toth | 52c99bd | 2008-05-01 04:57:01 -0300 | [diff] [blame] | 2776 | divider_val = 8 ; |
| 2777 | Fmax = 340000000UL ; |
| 2778 | Fmin = FminBin ; |
| 2779 | } |
| 2780 | FminBin = 300000000UL ; |
| 2781 | FmaxBin = 340000000UL ; |
Steven Toth | 3935c25 | 2008-05-01 05:45:44 -0300 | [diff] [blame] | 2782 | if (state->RF_LO > FminBin && state->RF_LO <= FmaxBin) { |
| 2783 | status += MXL_ControlWrite(fe, RFSYN_EN_OUTMUX, 1) ; |
| 2784 | status += MXL_ControlWrite(fe, RFSYN_SEL_VCO_OUT, 0) ; |
| 2785 | status += MXL_ControlWrite(fe, RFSYN_SEL_VCO_HI, 0) ; |
| 2786 | status += MXL_ControlWrite(fe, RFSYN_SEL_DIVM, 0) ; |
| 2787 | status += MXL_ControlWrite(fe, RFSYN_RF_DIV_BIAS, 1) ; |
| 2788 | status += MXL_ControlWrite(fe, DN_SEL_FREQ, 0) ; |
Steven Toth | 52c99bd | 2008-05-01 04:57:01 -0300 | [diff] [blame] | 2789 | divider_val = 8 ; |
| 2790 | Fmax = FmaxBin ; |
| 2791 | Fmin = 225000000UL ; |
| 2792 | } |
| 2793 | FminBin = 340000000UL ; |
| 2794 | FmaxBin = 450000000UL ; |
Steven Toth | 3935c25 | 2008-05-01 05:45:44 -0300 | [diff] [blame] | 2795 | if (state->RF_LO > FminBin && state->RF_LO <= FmaxBin) { |
| 2796 | status += MXL_ControlWrite(fe, RFSYN_EN_OUTMUX, 1) ; |
| 2797 | status += MXL_ControlWrite(fe, RFSYN_SEL_VCO_OUT, 0) ; |
| 2798 | status += MXL_ControlWrite(fe, RFSYN_SEL_VCO_HI, 1) ; |
| 2799 | status += MXL_ControlWrite(fe, RFSYN_SEL_DIVM, 0) ; |
| 2800 | status += MXL_ControlWrite(fe, RFSYN_RF_DIV_BIAS, 2) ; |
| 2801 | status += MXL_ControlWrite(fe, DN_SEL_FREQ, 0) ; |
Steven Toth | 52c99bd | 2008-05-01 04:57:01 -0300 | [diff] [blame] | 2802 | divider_val = 8 ; |
| 2803 | Fmax = FmaxBin ; |
| 2804 | Fmin = FminBin ; |
| 2805 | } |
| 2806 | FminBin = 450000000UL ; |
| 2807 | FmaxBin = 680000000UL ; |
Steven Toth | 3935c25 | 2008-05-01 05:45:44 -0300 | [diff] [blame] | 2808 | if (state->RF_LO > FminBin && state->RF_LO <= FmaxBin) { |
| 2809 | status += MXL_ControlWrite(fe, RFSYN_EN_OUTMUX, 0) ; |
| 2810 | status += MXL_ControlWrite(fe, RFSYN_SEL_VCO_OUT, 1) ; |
| 2811 | status += MXL_ControlWrite(fe, RFSYN_SEL_VCO_HI, 0) ; |
| 2812 | status += MXL_ControlWrite(fe, RFSYN_SEL_DIVM, 1) ; |
| 2813 | status += MXL_ControlWrite(fe, RFSYN_RF_DIV_BIAS, 1) ; |
| 2814 | status += MXL_ControlWrite(fe, DN_SEL_FREQ, 0) ; |
Steven Toth | 52c99bd | 2008-05-01 04:57:01 -0300 | [diff] [blame] | 2815 | divider_val = 4 ; |
| 2816 | Fmax = FmaxBin ; |
| 2817 | Fmin = FminBin ; |
| 2818 | } |
| 2819 | FminBin = 680000000UL ; |
| 2820 | FmaxBin = 900000000UL ; |
Steven Toth | 3935c25 | 2008-05-01 05:45:44 -0300 | [diff] [blame] | 2821 | if (state->RF_LO > FminBin && state->RF_LO <= FmaxBin) { |
| 2822 | status += MXL_ControlWrite(fe, RFSYN_EN_OUTMUX, 0) ; |
| 2823 | status += MXL_ControlWrite(fe, RFSYN_SEL_VCO_OUT, 1) ; |
| 2824 | status += MXL_ControlWrite(fe, RFSYN_SEL_VCO_HI, 1) ; |
| 2825 | status += MXL_ControlWrite(fe, RFSYN_SEL_DIVM, 1) ; |
| 2826 | status += MXL_ControlWrite(fe, RFSYN_RF_DIV_BIAS, 1) ; |
| 2827 | status += MXL_ControlWrite(fe, DN_SEL_FREQ, 0) ; |
Steven Toth | 52c99bd | 2008-05-01 04:57:01 -0300 | [diff] [blame] | 2828 | divider_val = 4 ; |
| 2829 | Fmax = FmaxBin ; |
| 2830 | Fmin = FminBin ; |
| 2831 | } |
| 2832 | |
| 2833 | // CHCAL_INT_MOD_RF |
| 2834 | // CHCAL_FRAC_MOD_RF |
| 2835 | // RFSYN_LPF_R |
| 2836 | // CHCAL_EN_INT_RF |
| 2837 | |
| 2838 | // Equation E3 |
| 2839 | // RFSYN_VCO_BIAS |
Steven Toth | 3935c25 | 2008-05-01 05:45:44 -0300 | [diff] [blame] | 2840 | E3 = (((Fmax-state->RF_LO)/1000)*32)/((Fmax-Fmin)/1000) + 8 ; |
| 2841 | status += MXL_ControlWrite(fe, RFSYN_VCO_BIAS, E3) ; |
Steven Toth | 52c99bd | 2008-05-01 04:57:01 -0300 | [diff] [blame] | 2842 | |
| 2843 | // Equation E4 |
| 2844 | // CHCAL_INT_MOD_RF |
Steven Toth | 3935c25 | 2008-05-01 05:45:44 -0300 | [diff] [blame] | 2845 | E4 = (state->RF_LO*divider_val/1000)/(2*state->Fxtal*Kdbl_RF/1000) ; |
| 2846 | MXL_ControlWrite(fe, CHCAL_INT_MOD_RF, E4) ; |
Steven Toth | 52c99bd | 2008-05-01 04:57:01 -0300 | [diff] [blame] | 2847 | |
| 2848 | // Equation E5 |
| 2849 | // CHCAL_FRAC_MOD_RF |
| 2850 | // CHCAL_EN_INT_RF |
Steven Toth | 3935c25 | 2008-05-01 05:45:44 -0300 | [diff] [blame] | 2851 | E5 = ((2<<17)*(state->RF_LO/10000*divider_val - (E4*(2*state->Fxtal*Kdbl_RF)/10000)))/(2*state->Fxtal*Kdbl_RF/10000) ; |
| 2852 | status += MXL_ControlWrite(fe, CHCAL_FRAC_MOD_RF, E5) ; |
Steven Toth | 52c99bd | 2008-05-01 04:57:01 -0300 | [diff] [blame] | 2853 | |
| 2854 | // Equation E5A |
| 2855 | // RFSYN_LPF_R |
Steven Toth | 3935c25 | 2008-05-01 05:45:44 -0300 | [diff] [blame] | 2856 | E5A = (((Fmax - state->RF_LO)/1000)*4/((Fmax-Fmin)/1000)) + 1 ; |
| 2857 | status += MXL_ControlWrite(fe, RFSYN_LPF_R, E5A) ; |
Steven Toth | 52c99bd | 2008-05-01 04:57:01 -0300 | [diff] [blame] | 2858 | |
| 2859 | // Euqation E5B |
| 2860 | // CHCAL_EN_INIT_RF |
Steven Toth | 3935c25 | 2008-05-01 05:45:44 -0300 | [diff] [blame] | 2861 | status += MXL_ControlWrite(fe, CHCAL_EN_INT_RF, ((E5 == 0) ? 1 : 0)); |
Steven Toth | 52c99bd | 2008-05-01 04:57:01 -0300 | [diff] [blame] | 2862 | //if (E5 == 0) |
Steven Toth | 3935c25 | 2008-05-01 05:45:44 -0300 | [diff] [blame] | 2863 | // status += MXL_ControlWrite(fe, CHCAL_EN_INT_RF, 1); |
Steven Toth | 52c99bd | 2008-05-01 04:57:01 -0300 | [diff] [blame] | 2864 | //else |
Steven Toth | 3935c25 | 2008-05-01 05:45:44 -0300 | [diff] [blame] | 2865 | // status += MXL_ControlWrite(fe, CHCAL_FRAC_MOD_RF, E5) ; |
Steven Toth | 52c99bd | 2008-05-01 04:57:01 -0300 | [diff] [blame] | 2866 | |
| 2867 | // |
| 2868 | // Set TG Synth |
| 2869 | // |
| 2870 | // Look-Up table implementation for: |
| 2871 | // TG_LO_DIVVAL |
| 2872 | // TG_LO_SELVAL |
| 2873 | // |
| 2874 | // Set divider_val, Fmax, Fmix to use in Equations |
Steven Toth | 3935c25 | 2008-05-01 05:45:44 -0300 | [diff] [blame] | 2875 | if (state->TG_LO < 33000000UL) { |
Steven Toth | 52c99bd | 2008-05-01 04:57:01 -0300 | [diff] [blame] | 2876 | return -1; |
| 2877 | } |
| 2878 | FminBin = 33000000UL ; |
| 2879 | FmaxBin = 50000000UL ; |
Steven Toth | 3935c25 | 2008-05-01 05:45:44 -0300 | [diff] [blame] | 2880 | if (state->TG_LO >= FminBin && state->TG_LO <= FmaxBin) { |
| 2881 | status += MXL_ControlWrite(fe, TG_LO_DIVVAL, 0x6) ; |
| 2882 | status += MXL_ControlWrite(fe, TG_LO_SELVAL, 0x0) ; |
Steven Toth | 52c99bd | 2008-05-01 04:57:01 -0300 | [diff] [blame] | 2883 | divider_val = 36 ; |
| 2884 | Fmax = FmaxBin ; |
| 2885 | Fmin = FminBin ; |
| 2886 | } |
| 2887 | FminBin = 50000000UL ; |
| 2888 | FmaxBin = 67000000UL ; |
Steven Toth | 3935c25 | 2008-05-01 05:45:44 -0300 | [diff] [blame] | 2889 | if (state->TG_LO > FminBin && state->TG_LO <= FmaxBin) { |
| 2890 | status += MXL_ControlWrite(fe, TG_LO_DIVVAL, 0x1) ; |
| 2891 | status += MXL_ControlWrite(fe, TG_LO_SELVAL, 0x0) ; |
Steven Toth | 52c99bd | 2008-05-01 04:57:01 -0300 | [diff] [blame] | 2892 | divider_val = 24 ; |
| 2893 | Fmax = FmaxBin ; |
| 2894 | Fmin = FminBin ; |
| 2895 | } |
| 2896 | FminBin = 67000000UL ; |
| 2897 | FmaxBin = 100000000UL ; |
Steven Toth | 3935c25 | 2008-05-01 05:45:44 -0300 | [diff] [blame] | 2898 | if (state->TG_LO > FminBin && state->TG_LO <= FmaxBin) { |
| 2899 | status += MXL_ControlWrite(fe, TG_LO_DIVVAL, 0xC) ; |
| 2900 | status += MXL_ControlWrite(fe, TG_LO_SELVAL, 0x2) ; |
Steven Toth | 52c99bd | 2008-05-01 04:57:01 -0300 | [diff] [blame] | 2901 | divider_val = 18 ; |
| 2902 | Fmax = FmaxBin ; |
| 2903 | Fmin = FminBin ; |
| 2904 | } |
| 2905 | FminBin = 100000000UL ; |
| 2906 | FmaxBin = 150000000UL ; |
Steven Toth | 3935c25 | 2008-05-01 05:45:44 -0300 | [diff] [blame] | 2907 | if (state->TG_LO > FminBin && state->TG_LO <= FmaxBin) { |
| 2908 | status += MXL_ControlWrite(fe, TG_LO_DIVVAL, 0x8) ; |
| 2909 | status += MXL_ControlWrite(fe, TG_LO_SELVAL, 0x2) ; |
Steven Toth | 52c99bd | 2008-05-01 04:57:01 -0300 | [diff] [blame] | 2910 | divider_val = 12 ; |
| 2911 | Fmax = FmaxBin ; |
| 2912 | Fmin = FminBin ; |
| 2913 | } |
| 2914 | FminBin = 150000000UL ; |
| 2915 | FmaxBin = 200000000UL ; |
Steven Toth | 3935c25 | 2008-05-01 05:45:44 -0300 | [diff] [blame] | 2916 | if (state->TG_LO > FminBin && state->TG_LO <= FmaxBin) { |
| 2917 | status += MXL_ControlWrite(fe, TG_LO_DIVVAL, 0x0) ; |
| 2918 | status += MXL_ControlWrite(fe, TG_LO_SELVAL, 0x2) ; |
Steven Toth | 52c99bd | 2008-05-01 04:57:01 -0300 | [diff] [blame] | 2919 | divider_val = 8 ; |
| 2920 | Fmax = FmaxBin ; |
| 2921 | Fmin = FminBin ; |
| 2922 | } |
| 2923 | FminBin = 200000000UL ; |
| 2924 | FmaxBin = 300000000UL ; |
Steven Toth | 3935c25 | 2008-05-01 05:45:44 -0300 | [diff] [blame] | 2925 | if (state->TG_LO > FminBin && state->TG_LO <= FmaxBin) { |
| 2926 | status += MXL_ControlWrite(fe, TG_LO_DIVVAL, 0x8) ; |
| 2927 | status += MXL_ControlWrite(fe, TG_LO_SELVAL, 0x3) ; |
Steven Toth | 52c99bd | 2008-05-01 04:57:01 -0300 | [diff] [blame] | 2928 | divider_val = 6 ; |
| 2929 | Fmax = FmaxBin ; |
| 2930 | Fmin = FminBin ; |
| 2931 | } |
| 2932 | FminBin = 300000000UL ; |
| 2933 | FmaxBin = 400000000UL ; |
Steven Toth | 3935c25 | 2008-05-01 05:45:44 -0300 | [diff] [blame] | 2934 | if (state->TG_LO > FminBin && state->TG_LO <= FmaxBin) { |
| 2935 | status += MXL_ControlWrite(fe, TG_LO_DIVVAL, 0x0) ; |
| 2936 | status += MXL_ControlWrite(fe, TG_LO_SELVAL, 0x3) ; |
Steven Toth | 52c99bd | 2008-05-01 04:57:01 -0300 | [diff] [blame] | 2937 | divider_val = 4 ; |
| 2938 | Fmax = FmaxBin ; |
| 2939 | Fmin = FminBin ; |
| 2940 | } |
| 2941 | FminBin = 400000000UL ; |
| 2942 | FmaxBin = 600000000UL ; |
Steven Toth | 3935c25 | 2008-05-01 05:45:44 -0300 | [diff] [blame] | 2943 | if (state->TG_LO > FminBin && state->TG_LO <= FmaxBin) { |
| 2944 | status += MXL_ControlWrite(fe, TG_LO_DIVVAL, 0x8) ; |
| 2945 | status += MXL_ControlWrite(fe, TG_LO_SELVAL, 0x7) ; |
Steven Toth | 52c99bd | 2008-05-01 04:57:01 -0300 | [diff] [blame] | 2946 | divider_val = 3 ; |
| 2947 | Fmax = FmaxBin ; |
| 2948 | Fmin = FminBin ; |
| 2949 | } |
| 2950 | FminBin = 600000000UL ; |
| 2951 | FmaxBin = 900000000UL ; |
Steven Toth | 3935c25 | 2008-05-01 05:45:44 -0300 | [diff] [blame] | 2952 | if (state->TG_LO > FminBin && state->TG_LO <= FmaxBin) { |
| 2953 | status += MXL_ControlWrite(fe, TG_LO_DIVVAL, 0x0) ; |
| 2954 | status += MXL_ControlWrite(fe, TG_LO_SELVAL, 0x7) ; |
Steven Toth | 52c99bd | 2008-05-01 04:57:01 -0300 | [diff] [blame] | 2955 | divider_val = 2 ; |
| 2956 | Fmax = FmaxBin ; |
| 2957 | Fmin = FminBin ; |
| 2958 | } |
| 2959 | |
| 2960 | // TG_DIV_VAL |
Steven Toth | 3935c25 | 2008-05-01 05:45:44 -0300 | [diff] [blame] | 2961 | tg_divval = (state->TG_LO*divider_val/100000) |
| 2962 | *(MXL_Ceiling(state->Fxtal,1000000) * 100) / (state->Fxtal/1000) ; |
| 2963 | status += MXL_ControlWrite(fe, TG_DIV_VAL, tg_divval) ; |
Steven Toth | 52c99bd | 2008-05-01 04:57:01 -0300 | [diff] [blame] | 2964 | |
Steven Toth | 3935c25 | 2008-05-01 05:45:44 -0300 | [diff] [blame] | 2965 | if (state->TG_LO > 600000000UL) |
| 2966 | status += MXL_ControlWrite(fe, TG_DIV_VAL, tg_divval + 1 ) ; |
Steven Toth | 52c99bd | 2008-05-01 04:57:01 -0300 | [diff] [blame] | 2967 | |
| 2968 | Fmax = 1800000000UL ; |
| 2969 | Fmin = 1200000000UL ; |
| 2970 | |
| 2971 | |
| 2972 | |
| 2973 | // to prevent overflow of 32 bit unsigned integer, use following equation. Edit for v2.6.4 |
Steven Toth | 3935c25 | 2008-05-01 05:45:44 -0300 | [diff] [blame] | 2974 | Fref_TG = (state->Fxtal/1000)/ MXL_Ceiling(state->Fxtal, 1000000) ; // Fref_TF = Fref_TG*1000 |
Steven Toth | 52c99bd | 2008-05-01 04:57:01 -0300 | [diff] [blame] | 2975 | |
Steven Toth | 3935c25 | 2008-05-01 05:45:44 -0300 | [diff] [blame] | 2976 | Fvco = (state->TG_LO/10000) * divider_val * Fref_TG; //Fvco = Fvco/10 |
Steven Toth | 52c99bd | 2008-05-01 04:57:01 -0300 | [diff] [blame] | 2977 | |
| 2978 | tg_lo = (((Fmax/10 - Fvco)/100)*32) / ((Fmax-Fmin)/1000)+8; |
| 2979 | |
| 2980 | //below equation is same as above but much harder to debug. |
Steven Toth | 3935c25 | 2008-05-01 05:45:44 -0300 | [diff] [blame] | 2981 | //tg_lo = ( ((Fmax/10000 * Xtal_Int)/100) - ((state->TG_LO/10000)*divider_val*(state->Fxtal/10000)/100) )*32/((Fmax-Fmin)/10000 * Xtal_Int/100) + 8 ; |
Steven Toth | 52c99bd | 2008-05-01 04:57:01 -0300 | [diff] [blame] | 2982 | |
| 2983 | |
Steven Toth | 3935c25 | 2008-05-01 05:45:44 -0300 | [diff] [blame] | 2984 | status += MXL_ControlWrite(fe, TG_VCO_BIAS , tg_lo) ; |
Steven Toth | 52c99bd | 2008-05-01 04:57:01 -0300 | [diff] [blame] | 2985 | |
| 2986 | |
| 2987 | |
| 2988 | //add for 2.6.5 |
| 2989 | //Special setting for QAM |
Steven Toth | 3935c25 | 2008-05-01 05:45:44 -0300 | [diff] [blame] | 2990 | if(state->Mod_Type == MXL_QAM) |
Steven Toth | 52c99bd | 2008-05-01 04:57:01 -0300 | [diff] [blame] | 2991 | { |
Steven Toth | 3935c25 | 2008-05-01 05:45:44 -0300 | [diff] [blame] | 2992 | if(state->RF_IN < 680000000) |
| 2993 | status += MXL_ControlWrite(fe, RFSYN_CHP_GAIN, 3) ; |
Steven Toth | 52c99bd | 2008-05-01 04:57:01 -0300 | [diff] [blame] | 2994 | else |
Steven Toth | 3935c25 | 2008-05-01 05:45:44 -0300 | [diff] [blame] | 2995 | status += MXL_ControlWrite(fe, RFSYN_CHP_GAIN, 2) ; |
Steven Toth | 52c99bd | 2008-05-01 04:57:01 -0300 | [diff] [blame] | 2996 | } |
| 2997 | |
| 2998 | |
| 2999 | //remove 20.48MHz setting for 2.6.10 |
| 3000 | |
| 3001 | // |
| 3002 | // Off Chip Tracking Filter Control |
| 3003 | // |
Steven Toth | 85d220d | 2008-05-01 05:48:14 -0300 | [diff] [blame] | 3004 | if (state->TF_Type == MXL_TF_OFF) // Tracking Filter Off State; turn off all the banks |
Steven Toth | 52c99bd | 2008-05-01 04:57:01 -0300 | [diff] [blame] | 3005 | { |
Steven Toth | 3935c25 | 2008-05-01 05:45:44 -0300 | [diff] [blame] | 3006 | status += MXL_ControlWrite(fe, DAC_A_ENABLE, 0) ; |
| 3007 | status += MXL_ControlWrite(fe, DAC_B_ENABLE, 0) ; |
Steven Toth | 52c99bd | 2008-05-01 04:57:01 -0300 | [diff] [blame] | 3008 | |
Steven Toth | 3935c25 | 2008-05-01 05:45:44 -0300 | [diff] [blame] | 3009 | status += MXL_SetGPIO(fe, 3, 1) ; // turn off Bank 1 |
| 3010 | status += MXL_SetGPIO(fe, 1, 1) ; // turn off Bank 2 |
| 3011 | status += MXL_SetGPIO(fe, 4, 1) ; // turn off Bank 3 |
Steven Toth | 52c99bd | 2008-05-01 04:57:01 -0300 | [diff] [blame] | 3012 | } |
| 3013 | |
Steven Toth | 85d220d | 2008-05-01 05:48:14 -0300 | [diff] [blame] | 3014 | if (state->TF_Type == MXL_TF_C) // Tracking Filter type C |
Steven Toth | 52c99bd | 2008-05-01 04:57:01 -0300 | [diff] [blame] | 3015 | { |
Steven Toth | 3935c25 | 2008-05-01 05:45:44 -0300 | [diff] [blame] | 3016 | status += MXL_ControlWrite(fe, DAC_B_ENABLE, 1) ; |
| 3017 | status += MXL_ControlWrite(fe, DAC_DIN_A, 0) ; |
Steven Toth | 52c99bd | 2008-05-01 04:57:01 -0300 | [diff] [blame] | 3018 | |
Steven Toth | 3935c25 | 2008-05-01 05:45:44 -0300 | [diff] [blame] | 3019 | if (state->RF_IN >= 43000000 && state->RF_IN < 150000000) |
Steven Toth | 52c99bd | 2008-05-01 04:57:01 -0300 | [diff] [blame] | 3020 | { |
| 3021 | |
Steven Toth | 3935c25 | 2008-05-01 05:45:44 -0300 | [diff] [blame] | 3022 | status += MXL_ControlWrite(fe, DAC_A_ENABLE, 0) ; // Bank4 Off |
| 3023 | status += MXL_ControlWrite(fe, DAC_DIN_B, 0) ; |
| 3024 | status += MXL_SetGPIO(fe, 3, 0) ; // Bank1 On |
| 3025 | status += MXL_SetGPIO(fe, 1, 1) ; // Bank2 Off |
| 3026 | status += MXL_SetGPIO(fe, 4, 1) ; // Bank3 Off |
Steven Toth | 52c99bd | 2008-05-01 04:57:01 -0300 | [diff] [blame] | 3027 | } |
Steven Toth | 3935c25 | 2008-05-01 05:45:44 -0300 | [diff] [blame] | 3028 | if (state->RF_IN >= 150000000 && state->RF_IN < 280000000) |
Steven Toth | 52c99bd | 2008-05-01 04:57:01 -0300 | [diff] [blame] | 3029 | { |
Steven Toth | 3935c25 | 2008-05-01 05:45:44 -0300 | [diff] [blame] | 3030 | status += MXL_ControlWrite(fe, DAC_A_ENABLE, 0) ; // Bank4 Off |
| 3031 | status += MXL_ControlWrite(fe, DAC_DIN_B, 0) ; |
| 3032 | status += MXL_SetGPIO(fe, 3, 1) ; // Bank1 Off |
| 3033 | status += MXL_SetGPIO(fe, 1, 0) ; // Bank2 On |
| 3034 | status += MXL_SetGPIO(fe, 4, 1) ; // Bank3 Off |
Steven Toth | 52c99bd | 2008-05-01 04:57:01 -0300 | [diff] [blame] | 3035 | } |
Steven Toth | 3935c25 | 2008-05-01 05:45:44 -0300 | [diff] [blame] | 3036 | if (state->RF_IN >= 280000000 && state->RF_IN < 360000000) |
Steven Toth | 52c99bd | 2008-05-01 04:57:01 -0300 | [diff] [blame] | 3037 | { |
Steven Toth | 3935c25 | 2008-05-01 05:45:44 -0300 | [diff] [blame] | 3038 | status += MXL_ControlWrite(fe, DAC_A_ENABLE, 0) ; // Bank4 Off |
| 3039 | status += MXL_ControlWrite(fe, DAC_DIN_B, 0) ; |
| 3040 | status += MXL_SetGPIO(fe, 3, 1) ; // Bank1 Off |
| 3041 | status += MXL_SetGPIO(fe, 1, 0) ; // Bank2 On |
| 3042 | status += MXL_SetGPIO(fe, 4, 0) ; // Bank3 On |
Steven Toth | 52c99bd | 2008-05-01 04:57:01 -0300 | [diff] [blame] | 3043 | } |
Steven Toth | 3935c25 | 2008-05-01 05:45:44 -0300 | [diff] [blame] | 3044 | if (state->RF_IN >= 360000000 && state->RF_IN < 560000000) |
Steven Toth | 52c99bd | 2008-05-01 04:57:01 -0300 | [diff] [blame] | 3045 | { |
Steven Toth | 3935c25 | 2008-05-01 05:45:44 -0300 | [diff] [blame] | 3046 | status += MXL_ControlWrite(fe, DAC_A_ENABLE, 0) ; // Bank4 Off |
| 3047 | status += MXL_ControlWrite(fe, DAC_DIN_B, 0) ; |
| 3048 | status += MXL_SetGPIO(fe, 3, 1) ; // Bank1 Off |
| 3049 | status += MXL_SetGPIO(fe, 1, 1) ; // Bank2 Off |
| 3050 | status += MXL_SetGPIO(fe, 4, 0) ; // Bank3 On |
Steven Toth | 52c99bd | 2008-05-01 04:57:01 -0300 | [diff] [blame] | 3051 | } |
Steven Toth | 3935c25 | 2008-05-01 05:45:44 -0300 | [diff] [blame] | 3052 | if (state->RF_IN >= 560000000 && state->RF_IN < 580000000) |
Steven Toth | 52c99bd | 2008-05-01 04:57:01 -0300 | [diff] [blame] | 3053 | { |
Steven Toth | 3935c25 | 2008-05-01 05:45:44 -0300 | [diff] [blame] | 3054 | status += MXL_ControlWrite(fe, DAC_A_ENABLE, 1) ; // Bank4 On |
| 3055 | status += MXL_ControlWrite(fe, DAC_DIN_B, 29) ; |
| 3056 | status += MXL_SetGPIO(fe, 3, 1) ; // Bank1 Off |
| 3057 | status += MXL_SetGPIO(fe, 1, 1) ; // Bank2 Off |
| 3058 | status += MXL_SetGPIO(fe, 4, 0) ; // Bank3 On |
Steven Toth | 52c99bd | 2008-05-01 04:57:01 -0300 | [diff] [blame] | 3059 | } |
Steven Toth | 3935c25 | 2008-05-01 05:45:44 -0300 | [diff] [blame] | 3060 | if (state->RF_IN >= 580000000 && state->RF_IN < 630000000) |
Steven Toth | 52c99bd | 2008-05-01 04:57:01 -0300 | [diff] [blame] | 3061 | { |
Steven Toth | 3935c25 | 2008-05-01 05:45:44 -0300 | [diff] [blame] | 3062 | status += MXL_ControlWrite(fe, DAC_A_ENABLE, 1) ; // Bank4 On |
| 3063 | status += MXL_ControlWrite(fe, DAC_DIN_B, 0) ; |
| 3064 | status += MXL_SetGPIO(fe, 3, 1) ; // Bank1 Off |
| 3065 | status += MXL_SetGPIO(fe, 1, 1) ; // Bank2 Off |
| 3066 | status += MXL_SetGPIO(fe, 4, 0) ; // Bank3 On |
Steven Toth | 52c99bd | 2008-05-01 04:57:01 -0300 | [diff] [blame] | 3067 | } |
Steven Toth | 3935c25 | 2008-05-01 05:45:44 -0300 | [diff] [blame] | 3068 | if (state->RF_IN >= 630000000 && state->RF_IN < 700000000) |
Steven Toth | 52c99bd | 2008-05-01 04:57:01 -0300 | [diff] [blame] | 3069 | { |
Steven Toth | 3935c25 | 2008-05-01 05:45:44 -0300 | [diff] [blame] | 3070 | status += MXL_ControlWrite(fe, DAC_A_ENABLE, 1) ; // Bank4 On |
| 3071 | status += MXL_ControlWrite(fe, DAC_DIN_B, 16) ; |
| 3072 | status += MXL_SetGPIO(fe, 3, 1) ; // Bank1 Off |
| 3073 | status += MXL_SetGPIO(fe, 1, 1) ; // Bank2 Off |
| 3074 | status += MXL_SetGPIO(fe, 4, 1) ; // Bank3 Off |
Steven Toth | 52c99bd | 2008-05-01 04:57:01 -0300 | [diff] [blame] | 3075 | } |
Steven Toth | 3935c25 | 2008-05-01 05:45:44 -0300 | [diff] [blame] | 3076 | if (state->RF_IN >= 700000000 && state->RF_IN < 760000000) |
Steven Toth | 52c99bd | 2008-05-01 04:57:01 -0300 | [diff] [blame] | 3077 | { |
Steven Toth | 3935c25 | 2008-05-01 05:45:44 -0300 | [diff] [blame] | 3078 | status += MXL_ControlWrite(fe, DAC_A_ENABLE, 1) ; // Bank4 On |
| 3079 | status += MXL_ControlWrite(fe, DAC_DIN_B, 7) ; |
| 3080 | status += MXL_SetGPIO(fe, 3, 1) ; // Bank1 Off |
| 3081 | status += MXL_SetGPIO(fe, 1, 1) ; // Bank2 Off |
| 3082 | status += MXL_SetGPIO(fe, 4, 1) ; // Bank3 Off |
Steven Toth | 52c99bd | 2008-05-01 04:57:01 -0300 | [diff] [blame] | 3083 | } |
Steven Toth | 3935c25 | 2008-05-01 05:45:44 -0300 | [diff] [blame] | 3084 | if (state->RF_IN >= 760000000 && state->RF_IN <= 900000000) |
Steven Toth | 52c99bd | 2008-05-01 04:57:01 -0300 | [diff] [blame] | 3085 | { |
Steven Toth | 3935c25 | 2008-05-01 05:45:44 -0300 | [diff] [blame] | 3086 | status += MXL_ControlWrite(fe, DAC_A_ENABLE, 1) ; // Bank4 On |
| 3087 | status += MXL_ControlWrite(fe, DAC_DIN_B, 0) ; |
| 3088 | status += MXL_SetGPIO(fe, 3, 1) ; // Bank1 Off |
| 3089 | status += MXL_SetGPIO(fe, 1, 1) ; // Bank2 Off |
| 3090 | status += MXL_SetGPIO(fe, 4, 1) ; // Bank3 Off |
Steven Toth | 52c99bd | 2008-05-01 04:57:01 -0300 | [diff] [blame] | 3091 | } |
| 3092 | } |
| 3093 | |
Steven Toth | 85d220d | 2008-05-01 05:48:14 -0300 | [diff] [blame] | 3094 | if (state->TF_Type == MXL_TF_C_H) // Tracking Filter type C-H for Hauppauge only |
Steven Toth | 52c99bd | 2008-05-01 04:57:01 -0300 | [diff] [blame] | 3095 | { |
Steven Toth | 8c66a19 | 2008-05-01 06:35:48 -0300 | [diff] [blame] | 3096 | printk("%s() CH filter\n", __func__); |
Steven Toth | 3935c25 | 2008-05-01 05:45:44 -0300 | [diff] [blame] | 3097 | status += MXL_ControlWrite(fe, DAC_DIN_A, 0) ; |
Steven Toth | 52c99bd | 2008-05-01 04:57:01 -0300 | [diff] [blame] | 3098 | |
Steven Toth | 3935c25 | 2008-05-01 05:45:44 -0300 | [diff] [blame] | 3099 | if (state->RF_IN >= 43000000 && state->RF_IN < 150000000) |
Steven Toth | 52c99bd | 2008-05-01 04:57:01 -0300 | [diff] [blame] | 3100 | { |
| 3101 | |
Steven Toth | 3935c25 | 2008-05-01 05:45:44 -0300 | [diff] [blame] | 3102 | status += MXL_ControlWrite(fe, DAC_A_ENABLE, 0) ; // Bank4 Off |
| 3103 | status += MXL_SetGPIO(fe, 4, 0) ; // Bank1 On |
| 3104 | status += MXL_SetGPIO(fe, 3, 1) ; // Bank2 Off |
| 3105 | status += MXL_SetGPIO(fe, 1, 1) ; // Bank3 Off |
Steven Toth | 52c99bd | 2008-05-01 04:57:01 -0300 | [diff] [blame] | 3106 | } |
Steven Toth | 3935c25 | 2008-05-01 05:45:44 -0300 | [diff] [blame] | 3107 | if (state->RF_IN >= 150000000 && state->RF_IN < 280000000) |
Steven Toth | 52c99bd | 2008-05-01 04:57:01 -0300 | [diff] [blame] | 3108 | { |
Steven Toth | 3935c25 | 2008-05-01 05:45:44 -0300 | [diff] [blame] | 3109 | status += MXL_ControlWrite(fe, DAC_A_ENABLE, 0) ; // Bank4 Off |
| 3110 | status += MXL_SetGPIO(fe, 4, 1) ; // Bank1 Off |
| 3111 | status += MXL_SetGPIO(fe, 3, 0) ; // Bank2 On |
| 3112 | status += MXL_SetGPIO(fe, 1, 1) ; // Bank3 Off |
Steven Toth | 52c99bd | 2008-05-01 04:57:01 -0300 | [diff] [blame] | 3113 | } |
Steven Toth | 3935c25 | 2008-05-01 05:45:44 -0300 | [diff] [blame] | 3114 | if (state->RF_IN >= 280000000 && state->RF_IN < 360000000) |
Steven Toth | 52c99bd | 2008-05-01 04:57:01 -0300 | [diff] [blame] | 3115 | { |
Steven Toth | 3935c25 | 2008-05-01 05:45:44 -0300 | [diff] [blame] | 3116 | status += MXL_ControlWrite(fe, DAC_A_ENABLE, 0) ; // Bank4 Off |
| 3117 | status += MXL_SetGPIO(fe, 4, 1) ; // Bank1 Off |
| 3118 | status += MXL_SetGPIO(fe, 3, 0) ; // Bank2 On |
| 3119 | status += MXL_SetGPIO(fe, 1, 0) ; // Bank3 On |
Steven Toth | 52c99bd | 2008-05-01 04:57:01 -0300 | [diff] [blame] | 3120 | } |
Steven Toth | 3935c25 | 2008-05-01 05:45:44 -0300 | [diff] [blame] | 3121 | if (state->RF_IN >= 360000000 && state->RF_IN < 560000000) |
Steven Toth | 52c99bd | 2008-05-01 04:57:01 -0300 | [diff] [blame] | 3122 | { |
Steven Toth | 3935c25 | 2008-05-01 05:45:44 -0300 | [diff] [blame] | 3123 | status += MXL_ControlWrite(fe, DAC_A_ENABLE, 0) ; // Bank4 Off |
| 3124 | status += MXL_SetGPIO(fe, 4, 1) ; // Bank1 Off |
| 3125 | status += MXL_SetGPIO(fe, 3, 1) ; // Bank2 Off |
| 3126 | status += MXL_SetGPIO(fe, 1, 0) ; // Bank3 On |
Steven Toth | 52c99bd | 2008-05-01 04:57:01 -0300 | [diff] [blame] | 3127 | } |
Steven Toth | 3935c25 | 2008-05-01 05:45:44 -0300 | [diff] [blame] | 3128 | if (state->RF_IN >= 560000000 && state->RF_IN < 580000000) |
Steven Toth | 52c99bd | 2008-05-01 04:57:01 -0300 | [diff] [blame] | 3129 | { |
Steven Toth | 3935c25 | 2008-05-01 05:45:44 -0300 | [diff] [blame] | 3130 | status += MXL_ControlWrite(fe, DAC_A_ENABLE, 1) ; // Bank4 On |
| 3131 | status += MXL_SetGPIO(fe, 4, 1) ; // Bank1 Off |
| 3132 | status += MXL_SetGPIO(fe, 3, 1) ; // Bank2 Off |
| 3133 | status += MXL_SetGPIO(fe, 1, 0) ; // Bank3 On |
Steven Toth | 52c99bd | 2008-05-01 04:57:01 -0300 | [diff] [blame] | 3134 | } |
Steven Toth | 3935c25 | 2008-05-01 05:45:44 -0300 | [diff] [blame] | 3135 | if (state->RF_IN >= 580000000 && state->RF_IN < 630000000) |
Steven Toth | 52c99bd | 2008-05-01 04:57:01 -0300 | [diff] [blame] | 3136 | { |
Steven Toth | 3935c25 | 2008-05-01 05:45:44 -0300 | [diff] [blame] | 3137 | status += MXL_ControlWrite(fe, DAC_A_ENABLE, 1) ; // Bank4 On |
| 3138 | status += MXL_SetGPIO(fe, 4, 1) ; // Bank1 Off |
| 3139 | status += MXL_SetGPIO(fe, 3, 1) ; // Bank2 Off |
| 3140 | status += MXL_SetGPIO(fe, 1, 0) ; // Bank3 On |
Steven Toth | 52c99bd | 2008-05-01 04:57:01 -0300 | [diff] [blame] | 3141 | } |
Steven Toth | 3935c25 | 2008-05-01 05:45:44 -0300 | [diff] [blame] | 3142 | if (state->RF_IN >= 630000000 && state->RF_IN < 700000000) |
Steven Toth | 52c99bd | 2008-05-01 04:57:01 -0300 | [diff] [blame] | 3143 | { |
Steven Toth | 3935c25 | 2008-05-01 05:45:44 -0300 | [diff] [blame] | 3144 | status += MXL_ControlWrite(fe, DAC_A_ENABLE, 1) ; // Bank4 On |
| 3145 | status += MXL_SetGPIO(fe, 4, 1) ; // Bank1 Off |
| 3146 | status += MXL_SetGPIO(fe, 3, 1) ; // Bank2 Off |
| 3147 | status += MXL_SetGPIO(fe, 1, 1) ; // Bank3 Off |
Steven Toth | 52c99bd | 2008-05-01 04:57:01 -0300 | [diff] [blame] | 3148 | } |
Steven Toth | 3935c25 | 2008-05-01 05:45:44 -0300 | [diff] [blame] | 3149 | if (state->RF_IN >= 700000000 && state->RF_IN < 760000000) |
Steven Toth | 52c99bd | 2008-05-01 04:57:01 -0300 | [diff] [blame] | 3150 | { |
Steven Toth | 3935c25 | 2008-05-01 05:45:44 -0300 | [diff] [blame] | 3151 | status += MXL_ControlWrite(fe, DAC_A_ENABLE, 1) ; // Bank4 On |
| 3152 | status += MXL_SetGPIO(fe, 4, 1) ; // Bank1 Off |
| 3153 | status += MXL_SetGPIO(fe, 3, 1) ; // Bank2 Off |
| 3154 | status += MXL_SetGPIO(fe, 1, 1) ; // Bank3 Off |
Steven Toth | 52c99bd | 2008-05-01 04:57:01 -0300 | [diff] [blame] | 3155 | } |
Steven Toth | 3935c25 | 2008-05-01 05:45:44 -0300 | [diff] [blame] | 3156 | if (state->RF_IN >= 760000000 && state->RF_IN <= 900000000) |
Steven Toth | 52c99bd | 2008-05-01 04:57:01 -0300 | [diff] [blame] | 3157 | { |
Steven Toth | 3935c25 | 2008-05-01 05:45:44 -0300 | [diff] [blame] | 3158 | status += MXL_ControlWrite(fe, DAC_A_ENABLE, 1) ; // Bank4 On |
| 3159 | status += MXL_SetGPIO(fe, 4, 1) ; // Bank1 Off |
| 3160 | status += MXL_SetGPIO(fe, 3, 1) ; // Bank2 Off |
| 3161 | status += MXL_SetGPIO(fe, 1, 1) ; // Bank3 Off |
Steven Toth | 52c99bd | 2008-05-01 04:57:01 -0300 | [diff] [blame] | 3162 | } |
| 3163 | } |
| 3164 | |
Steven Toth | 85d220d | 2008-05-01 05:48:14 -0300 | [diff] [blame] | 3165 | if (state->TF_Type == MXL_TF_D) // Tracking Filter type D |
Steven Toth | 52c99bd | 2008-05-01 04:57:01 -0300 | [diff] [blame] | 3166 | { |
Steven Toth | 3935c25 | 2008-05-01 05:45:44 -0300 | [diff] [blame] | 3167 | status += MXL_ControlWrite(fe, DAC_DIN_B, 0) ; |
Steven Toth | 52c99bd | 2008-05-01 04:57:01 -0300 | [diff] [blame] | 3168 | |
Steven Toth | 3935c25 | 2008-05-01 05:45:44 -0300 | [diff] [blame] | 3169 | if (state->RF_IN >= 43000000 && state->RF_IN < 174000000) |
Steven Toth | 52c99bd | 2008-05-01 04:57:01 -0300 | [diff] [blame] | 3170 | { |
| 3171 | |
Steven Toth | 3935c25 | 2008-05-01 05:45:44 -0300 | [diff] [blame] | 3172 | status += MXL_ControlWrite(fe, DAC_B_ENABLE, 0) ; // Bank4 Off |
| 3173 | status += MXL_SetGPIO(fe, 4, 0) ; // Bank1 On |
| 3174 | status += MXL_SetGPIO(fe, 1, 1) ; // Bank2 Off |
| 3175 | status += MXL_SetGPIO(fe, 3, 1) ; // Bank3 Off |
Steven Toth | 52c99bd | 2008-05-01 04:57:01 -0300 | [diff] [blame] | 3176 | } |
Steven Toth | 3935c25 | 2008-05-01 05:45:44 -0300 | [diff] [blame] | 3177 | if (state->RF_IN >= 174000000 && state->RF_IN < 250000000) |
Steven Toth | 52c99bd | 2008-05-01 04:57:01 -0300 | [diff] [blame] | 3178 | { |
Steven Toth | 3935c25 | 2008-05-01 05:45:44 -0300 | [diff] [blame] | 3179 | status += MXL_ControlWrite(fe, DAC_B_ENABLE, 0) ; // Bank4 Off |
| 3180 | status += MXL_SetGPIO(fe, 4, 0) ; // Bank1 On |
| 3181 | status += MXL_SetGPIO(fe, 1, 0) ; // Bank2 On |
| 3182 | status += MXL_SetGPIO(fe, 3, 1) ; // Bank3 Off |
Steven Toth | 52c99bd | 2008-05-01 04:57:01 -0300 | [diff] [blame] | 3183 | } |
Steven Toth | 3935c25 | 2008-05-01 05:45:44 -0300 | [diff] [blame] | 3184 | if (state->RF_IN >= 250000000 && state->RF_IN < 310000000) |
Steven Toth | 52c99bd | 2008-05-01 04:57:01 -0300 | [diff] [blame] | 3185 | { |
Steven Toth | 3935c25 | 2008-05-01 05:45:44 -0300 | [diff] [blame] | 3186 | status += MXL_ControlWrite(fe, DAC_B_ENABLE, 0) ; // Bank4 Off |
| 3187 | status += MXL_SetGPIO(fe, 4, 1) ; // Bank1 Off |
| 3188 | status += MXL_SetGPIO(fe, 1, 0) ; // Bank2 On |
| 3189 | status += MXL_SetGPIO(fe, 3, 1) ; // Bank3 Off |
Steven Toth | 52c99bd | 2008-05-01 04:57:01 -0300 | [diff] [blame] | 3190 | } |
Steven Toth | 3935c25 | 2008-05-01 05:45:44 -0300 | [diff] [blame] | 3191 | if (state->RF_IN >= 310000000 && state->RF_IN < 360000000) |
Steven Toth | 52c99bd | 2008-05-01 04:57:01 -0300 | [diff] [blame] | 3192 | { |
Steven Toth | 3935c25 | 2008-05-01 05:45:44 -0300 | [diff] [blame] | 3193 | status += MXL_ControlWrite(fe, DAC_B_ENABLE, 0) ; // Bank4 Off |
| 3194 | status += MXL_SetGPIO(fe, 4, 1) ; // Bank1 Off |
| 3195 | status += MXL_SetGPIO(fe, 1, 0) ; // Bank2 On |
| 3196 | status += MXL_SetGPIO(fe, 3, 0) ; // Bank3 On |
Steven Toth | 52c99bd | 2008-05-01 04:57:01 -0300 | [diff] [blame] | 3197 | } |
Steven Toth | 3935c25 | 2008-05-01 05:45:44 -0300 | [diff] [blame] | 3198 | if (state->RF_IN >= 360000000 && state->RF_IN < 470000000) |
Steven Toth | 52c99bd | 2008-05-01 04:57:01 -0300 | [diff] [blame] | 3199 | { |
Steven Toth | 3935c25 | 2008-05-01 05:45:44 -0300 | [diff] [blame] | 3200 | status += MXL_ControlWrite(fe, DAC_B_ENABLE, 0) ; // Bank4 Off |
| 3201 | status += MXL_SetGPIO(fe, 4, 1) ; // Bank1 Off |
| 3202 | status += MXL_SetGPIO(fe, 1, 1) ; // Bank2 Off |
| 3203 | status += MXL_SetGPIO(fe, 3, 0) ; // Bank3 On |
Steven Toth | 52c99bd | 2008-05-01 04:57:01 -0300 | [diff] [blame] | 3204 | } |
Steven Toth | 3935c25 | 2008-05-01 05:45:44 -0300 | [diff] [blame] | 3205 | if (state->RF_IN >= 470000000 && state->RF_IN < 640000000) |
Steven Toth | 52c99bd | 2008-05-01 04:57:01 -0300 | [diff] [blame] | 3206 | { |
Steven Toth | 3935c25 | 2008-05-01 05:45:44 -0300 | [diff] [blame] | 3207 | status += MXL_ControlWrite(fe, DAC_B_ENABLE, 1) ; // Bank4 On |
| 3208 | status += MXL_SetGPIO(fe, 4, 1) ; // Bank1 Off |
| 3209 | status += MXL_SetGPIO(fe, 1, 1) ; // Bank2 Off |
| 3210 | status += MXL_SetGPIO(fe, 3, 0) ; // Bank3 On |
Steven Toth | 52c99bd | 2008-05-01 04:57:01 -0300 | [diff] [blame] | 3211 | } |
Steven Toth | 3935c25 | 2008-05-01 05:45:44 -0300 | [diff] [blame] | 3212 | if (state->RF_IN >= 640000000 && state->RF_IN <= 900000000) |
Steven Toth | 52c99bd | 2008-05-01 04:57:01 -0300 | [diff] [blame] | 3213 | { |
Steven Toth | 3935c25 | 2008-05-01 05:45:44 -0300 | [diff] [blame] | 3214 | status += MXL_ControlWrite(fe, DAC_B_ENABLE, 1) ; // Bank4 On |
| 3215 | status += MXL_SetGPIO(fe, 4, 1) ; // Bank1 Off |
| 3216 | status += MXL_SetGPIO(fe, 1, 1) ; // Bank2 Off |
| 3217 | status += MXL_SetGPIO(fe, 3, 1) ; // Bank3 Off |
Steven Toth | 52c99bd | 2008-05-01 04:57:01 -0300 | [diff] [blame] | 3218 | } |
| 3219 | } |
| 3220 | |
| 3221 | |
Steven Toth | 85d220d | 2008-05-01 05:48:14 -0300 | [diff] [blame] | 3222 | if (state->TF_Type == MXL_TF_D_L) // Tracking Filter type D-L for Lumanate ONLY change for 2.6.3 |
Steven Toth | 52c99bd | 2008-05-01 04:57:01 -0300 | [diff] [blame] | 3223 | { |
Steven Toth | 3935c25 | 2008-05-01 05:45:44 -0300 | [diff] [blame] | 3224 | status += MXL_ControlWrite(fe, DAC_DIN_A, 0) ; |
Steven Toth | 52c99bd | 2008-05-01 04:57:01 -0300 | [diff] [blame] | 3225 | |
Steven Toth | a8214d4 | 2008-05-01 05:02:58 -0300 | [diff] [blame] | 3226 | // if UHF and terrestrial => Turn off Tracking Filter |
Steven Toth | 3935c25 | 2008-05-01 05:45:44 -0300 | [diff] [blame] | 3227 | if (state->RF_IN >= 471000000 && (state->RF_IN - 471000000)%6000000 != 0) |
Steven Toth | 52c99bd | 2008-05-01 04:57:01 -0300 | [diff] [blame] | 3228 | { |
| 3229 | // Turn off all the banks |
Steven Toth | 3935c25 | 2008-05-01 05:45:44 -0300 | [diff] [blame] | 3230 | status += MXL_SetGPIO(fe, 3, 1) ; |
| 3231 | status += MXL_SetGPIO(fe, 1, 1) ; |
| 3232 | status += MXL_SetGPIO(fe, 4, 1) ; |
| 3233 | status += MXL_ControlWrite(fe, DAC_A_ENABLE, 0) ; |
Steven Toth | 52c99bd | 2008-05-01 04:57:01 -0300 | [diff] [blame] | 3234 | |
Steven Toth | 3935c25 | 2008-05-01 05:45:44 -0300 | [diff] [blame] | 3235 | status += MXL_ControlWrite(fe, AGC_IF, 10) ; |
Steven Toth | 52c99bd | 2008-05-01 04:57:01 -0300 | [diff] [blame] | 3236 | } |
| 3237 | |
| 3238 | else // if VHF or cable => Turn on Tracking Filter |
| 3239 | { |
Steven Toth | 3935c25 | 2008-05-01 05:45:44 -0300 | [diff] [blame] | 3240 | if (state->RF_IN >= 43000000 && state->RF_IN < 140000000) |
Steven Toth | 52c99bd | 2008-05-01 04:57:01 -0300 | [diff] [blame] | 3241 | { |
| 3242 | |
Steven Toth | 3935c25 | 2008-05-01 05:45:44 -0300 | [diff] [blame] | 3243 | status += MXL_ControlWrite(fe, DAC_A_ENABLE, 0) ; // Bank4 Off |
| 3244 | status += MXL_SetGPIO(fe, 4, 1) ; // Bank1 On |
| 3245 | status += MXL_SetGPIO(fe, 1, 1) ; // Bank2 Off |
| 3246 | status += MXL_SetGPIO(fe, 3, 0) ; // Bank3 Off |
Steven Toth | 52c99bd | 2008-05-01 04:57:01 -0300 | [diff] [blame] | 3247 | } |
Steven Toth | 3935c25 | 2008-05-01 05:45:44 -0300 | [diff] [blame] | 3248 | if (state->RF_IN >= 140000000 && state->RF_IN < 240000000) |
Steven Toth | 52c99bd | 2008-05-01 04:57:01 -0300 | [diff] [blame] | 3249 | { |
Steven Toth | 3935c25 | 2008-05-01 05:45:44 -0300 | [diff] [blame] | 3250 | status += MXL_ControlWrite(fe, DAC_A_ENABLE, 0) ; // Bank4 Off |
| 3251 | status += MXL_SetGPIO(fe, 4, 1) ; // Bank1 On |
| 3252 | status += MXL_SetGPIO(fe, 1, 0) ; // Bank2 On |
| 3253 | status += MXL_SetGPIO(fe, 3, 0) ; // Bank3 Off |
Steven Toth | 52c99bd | 2008-05-01 04:57:01 -0300 | [diff] [blame] | 3254 | } |
Steven Toth | 3935c25 | 2008-05-01 05:45:44 -0300 | [diff] [blame] | 3255 | if (state->RF_IN >= 240000000 && state->RF_IN < 340000000) |
Steven Toth | 52c99bd | 2008-05-01 04:57:01 -0300 | [diff] [blame] | 3256 | { |
Steven Toth | 3935c25 | 2008-05-01 05:45:44 -0300 | [diff] [blame] | 3257 | status += MXL_ControlWrite(fe, DAC_A_ENABLE, 0) ; // Bank4 Off |
| 3258 | status += MXL_SetGPIO(fe, 4, 0) ; // Bank1 Off |
| 3259 | status += MXL_SetGPIO(fe, 1, 1) ; // Bank2 On |
| 3260 | status += MXL_SetGPIO(fe, 3, 0) ; // Bank3 Off |
Steven Toth | 52c99bd | 2008-05-01 04:57:01 -0300 | [diff] [blame] | 3261 | } |
Steven Toth | 3935c25 | 2008-05-01 05:45:44 -0300 | [diff] [blame] | 3262 | if (state->RF_IN >= 340000000 && state->RF_IN < 430000000) |
Steven Toth | 52c99bd | 2008-05-01 04:57:01 -0300 | [diff] [blame] | 3263 | { |
Steven Toth | 3935c25 | 2008-05-01 05:45:44 -0300 | [diff] [blame] | 3264 | status += MXL_ControlWrite(fe, DAC_A_ENABLE, 0) ; // Bank4 Off |
| 3265 | status += MXL_SetGPIO(fe, 4, 0) ; // Bank1 Off |
| 3266 | status += MXL_SetGPIO(fe, 1, 0) ; // Bank2 On |
| 3267 | status += MXL_SetGPIO(fe, 3, 1) ; // Bank3 On |
Steven Toth | 52c99bd | 2008-05-01 04:57:01 -0300 | [diff] [blame] | 3268 | } |
Steven Toth | 3935c25 | 2008-05-01 05:45:44 -0300 | [diff] [blame] | 3269 | if (state->RF_IN >= 430000000 && state->RF_IN < 470000000) |
Steven Toth | 52c99bd | 2008-05-01 04:57:01 -0300 | [diff] [blame] | 3270 | { |
Steven Toth | 3935c25 | 2008-05-01 05:45:44 -0300 | [diff] [blame] | 3271 | status += MXL_ControlWrite(fe, DAC_A_ENABLE, 1) ; // Bank4 Off |
| 3272 | status += MXL_SetGPIO(fe, 4, 1) ; // Bank1 Off |
| 3273 | status += MXL_SetGPIO(fe, 1, 0) ; // Bank2 Off |
| 3274 | status += MXL_SetGPIO(fe, 3, 1) ; // Bank3 On |
Steven Toth | 52c99bd | 2008-05-01 04:57:01 -0300 | [diff] [blame] | 3275 | } |
Steven Toth | 3935c25 | 2008-05-01 05:45:44 -0300 | [diff] [blame] | 3276 | if (state->RF_IN >= 470000000 && state->RF_IN < 570000000) |
Steven Toth | 52c99bd | 2008-05-01 04:57:01 -0300 | [diff] [blame] | 3277 | { |
Steven Toth | 3935c25 | 2008-05-01 05:45:44 -0300 | [diff] [blame] | 3278 | status += MXL_ControlWrite(fe, DAC_A_ENABLE, 1) ; // Bank4 On |
| 3279 | status += MXL_SetGPIO(fe, 4, 0) ; // Bank1 Off |
| 3280 | status += MXL_SetGPIO(fe, 1, 0) ; // Bank2 Off |
| 3281 | status += MXL_SetGPIO(fe, 3, 1) ; // Bank3 On |
Steven Toth | 52c99bd | 2008-05-01 04:57:01 -0300 | [diff] [blame] | 3282 | } |
Steven Toth | 3935c25 | 2008-05-01 05:45:44 -0300 | [diff] [blame] | 3283 | if (state->RF_IN >= 570000000 && state->RF_IN < 620000000) |
Steven Toth | 52c99bd | 2008-05-01 04:57:01 -0300 | [diff] [blame] | 3284 | { |
Steven Toth | 3935c25 | 2008-05-01 05:45:44 -0300 | [diff] [blame] | 3285 | status += MXL_ControlWrite(fe, DAC_A_ENABLE, 0) ; // Bank4 On |
| 3286 | status += MXL_SetGPIO(fe, 4, 0) ; // Bank1 Off |
| 3287 | status += MXL_SetGPIO(fe, 1, 1) ; // Bank2 Off |
| 3288 | status += MXL_SetGPIO(fe, 3, 1) ; // Bank3 Offq |
Steven Toth | 52c99bd | 2008-05-01 04:57:01 -0300 | [diff] [blame] | 3289 | } |
Steven Toth | 3935c25 | 2008-05-01 05:45:44 -0300 | [diff] [blame] | 3290 | if (state->RF_IN >= 620000000 && state->RF_IN < 760000000) |
Steven Toth | 52c99bd | 2008-05-01 04:57:01 -0300 | [diff] [blame] | 3291 | { |
Steven Toth | 3935c25 | 2008-05-01 05:45:44 -0300 | [diff] [blame] | 3292 | status += MXL_ControlWrite(fe, DAC_A_ENABLE, 1) ; // Bank4 On |
| 3293 | status += MXL_SetGPIO(fe, 4, 0) ; // Bank1 Off |
| 3294 | status += MXL_SetGPIO(fe, 1, 1) ; // Bank2 Off |
| 3295 | status += MXL_SetGPIO(fe, 3, 1) ; // Bank3 Off |
Steven Toth | 52c99bd | 2008-05-01 04:57:01 -0300 | [diff] [blame] | 3296 | } |
Steven Toth | 3935c25 | 2008-05-01 05:45:44 -0300 | [diff] [blame] | 3297 | if (state->RF_IN >= 760000000 && state->RF_IN <= 900000000) |
Steven Toth | 52c99bd | 2008-05-01 04:57:01 -0300 | [diff] [blame] | 3298 | { |
Steven Toth | 3935c25 | 2008-05-01 05:45:44 -0300 | [diff] [blame] | 3299 | status += MXL_ControlWrite(fe, DAC_A_ENABLE, 1) ; // Bank4 On |
| 3300 | status += MXL_SetGPIO(fe, 4, 1) ; // Bank1 Off |
| 3301 | status += MXL_SetGPIO(fe, 1, 1) ; // Bank2 Off |
| 3302 | status += MXL_SetGPIO(fe, 3, 1) ; // Bank3 Off |
Steven Toth | 52c99bd | 2008-05-01 04:57:01 -0300 | [diff] [blame] | 3303 | } |
| 3304 | } |
| 3305 | } |
| 3306 | |
Steven Toth | 85d220d | 2008-05-01 05:48:14 -0300 | [diff] [blame] | 3307 | if (state->TF_Type == MXL_TF_E) // Tracking Filter type E |
Steven Toth | 52c99bd | 2008-05-01 04:57:01 -0300 | [diff] [blame] | 3308 | { |
Steven Toth | 3935c25 | 2008-05-01 05:45:44 -0300 | [diff] [blame] | 3309 | status += MXL_ControlWrite(fe, DAC_DIN_B, 0) ; |
Steven Toth | 52c99bd | 2008-05-01 04:57:01 -0300 | [diff] [blame] | 3310 | |
Steven Toth | 3935c25 | 2008-05-01 05:45:44 -0300 | [diff] [blame] | 3311 | if (state->RF_IN >= 43000000 && state->RF_IN < 174000000) |
Steven Toth | 52c99bd | 2008-05-01 04:57:01 -0300 | [diff] [blame] | 3312 | { |
| 3313 | |
Steven Toth | 3935c25 | 2008-05-01 05:45:44 -0300 | [diff] [blame] | 3314 | status += MXL_ControlWrite(fe, DAC_B_ENABLE, 0) ; // Bank4 Off |
| 3315 | status += MXL_SetGPIO(fe, 4, 0) ; // Bank1 On |
| 3316 | status += MXL_SetGPIO(fe, 1, 1) ; // Bank2 Off |
| 3317 | status += MXL_SetGPIO(fe, 3, 1) ; // Bank3 Off |
Steven Toth | 52c99bd | 2008-05-01 04:57:01 -0300 | [diff] [blame] | 3318 | } |
Steven Toth | 3935c25 | 2008-05-01 05:45:44 -0300 | [diff] [blame] | 3319 | if (state->RF_IN >= 174000000 && state->RF_IN < 250000000) |
Steven Toth | 52c99bd | 2008-05-01 04:57:01 -0300 | [diff] [blame] | 3320 | { |
Steven Toth | 3935c25 | 2008-05-01 05:45:44 -0300 | [diff] [blame] | 3321 | status += MXL_ControlWrite(fe, DAC_B_ENABLE, 0) ; // Bank4 Off |
| 3322 | status += MXL_SetGPIO(fe, 4, 0) ; // Bank1 On |
| 3323 | status += MXL_SetGPIO(fe, 1, 0) ; // Bank2 On |
| 3324 | status += MXL_SetGPIO(fe, 3, 1) ; // Bank3 Off |
Steven Toth | 52c99bd | 2008-05-01 04:57:01 -0300 | [diff] [blame] | 3325 | } |
Steven Toth | 3935c25 | 2008-05-01 05:45:44 -0300 | [diff] [blame] | 3326 | if (state->RF_IN >= 250000000 && state->RF_IN < 310000000) |
Steven Toth | 52c99bd | 2008-05-01 04:57:01 -0300 | [diff] [blame] | 3327 | { |
Steven Toth | 3935c25 | 2008-05-01 05:45:44 -0300 | [diff] [blame] | 3328 | status += MXL_ControlWrite(fe, DAC_B_ENABLE, 0) ; // Bank4 Off |
| 3329 | status += MXL_SetGPIO(fe, 4, 1) ; // Bank1 Off |
| 3330 | status += MXL_SetGPIO(fe, 1, 0) ; // Bank2 On |
| 3331 | status += MXL_SetGPIO(fe, 3, 1) ; // Bank3 Off |
Steven Toth | 52c99bd | 2008-05-01 04:57:01 -0300 | [diff] [blame] | 3332 | } |
Steven Toth | 3935c25 | 2008-05-01 05:45:44 -0300 | [diff] [blame] | 3333 | if (state->RF_IN >= 310000000 && state->RF_IN < 360000000) |
Steven Toth | 52c99bd | 2008-05-01 04:57:01 -0300 | [diff] [blame] | 3334 | { |
Steven Toth | 3935c25 | 2008-05-01 05:45:44 -0300 | [diff] [blame] | 3335 | status += MXL_ControlWrite(fe, DAC_B_ENABLE, 0) ; // Bank4 Off |
| 3336 | status += MXL_SetGPIO(fe, 4, 1) ; // Bank1 Off |
| 3337 | status += MXL_SetGPIO(fe, 1, 0) ; // Bank2 On |
| 3338 | status += MXL_SetGPIO(fe, 3, 0) ; // Bank3 On |
Steven Toth | 52c99bd | 2008-05-01 04:57:01 -0300 | [diff] [blame] | 3339 | } |
Steven Toth | 3935c25 | 2008-05-01 05:45:44 -0300 | [diff] [blame] | 3340 | if (state->RF_IN >= 360000000 && state->RF_IN < 470000000) |
Steven Toth | 52c99bd | 2008-05-01 04:57:01 -0300 | [diff] [blame] | 3341 | { |
Steven Toth | 3935c25 | 2008-05-01 05:45:44 -0300 | [diff] [blame] | 3342 | status += MXL_ControlWrite(fe, DAC_B_ENABLE, 0) ; // Bank4 Off |
| 3343 | status += MXL_SetGPIO(fe, 4, 1) ; // Bank1 Off |
| 3344 | status += MXL_SetGPIO(fe, 1, 1) ; // Bank2 Off |
| 3345 | status += MXL_SetGPIO(fe, 3, 0) ; // Bank3 On |
Steven Toth | 52c99bd | 2008-05-01 04:57:01 -0300 | [diff] [blame] | 3346 | } |
Steven Toth | 3935c25 | 2008-05-01 05:45:44 -0300 | [diff] [blame] | 3347 | if (state->RF_IN >= 470000000 && state->RF_IN < 640000000) |
Steven Toth | 52c99bd | 2008-05-01 04:57:01 -0300 | [diff] [blame] | 3348 | { |
Steven Toth | 3935c25 | 2008-05-01 05:45:44 -0300 | [diff] [blame] | 3349 | status += MXL_ControlWrite(fe, DAC_B_ENABLE, 1) ; // Bank4 On |
| 3350 | status += MXL_SetGPIO(fe, 4, 1) ; // Bank1 Off |
| 3351 | status += MXL_SetGPIO(fe, 1, 1) ; // Bank2 Off |
| 3352 | status += MXL_SetGPIO(fe, 3, 0) ; // Bank3 On |
Steven Toth | 52c99bd | 2008-05-01 04:57:01 -0300 | [diff] [blame] | 3353 | } |
Steven Toth | 3935c25 | 2008-05-01 05:45:44 -0300 | [diff] [blame] | 3354 | if (state->RF_IN >= 640000000 && state->RF_IN <= 900000000) |
Steven Toth | 52c99bd | 2008-05-01 04:57:01 -0300 | [diff] [blame] | 3355 | { |
Steven Toth | 3935c25 | 2008-05-01 05:45:44 -0300 | [diff] [blame] | 3356 | status += MXL_ControlWrite(fe, DAC_B_ENABLE, 1) ; // Bank4 On |
| 3357 | status += MXL_SetGPIO(fe, 4, 1) ; // Bank1 Off |
| 3358 | status += MXL_SetGPIO(fe, 1, 1) ; // Bank2 Off |
| 3359 | status += MXL_SetGPIO(fe, 3, 1) ; // Bank3 Off |
Steven Toth | 52c99bd | 2008-05-01 04:57:01 -0300 | [diff] [blame] | 3360 | } |
| 3361 | } |
| 3362 | |
Steven Toth | 85d220d | 2008-05-01 05:48:14 -0300 | [diff] [blame] | 3363 | if (state->TF_Type == MXL_TF_F) // Tracking Filter type F |
Steven Toth | 52c99bd | 2008-05-01 04:57:01 -0300 | [diff] [blame] | 3364 | { |
Steven Toth | 3935c25 | 2008-05-01 05:45:44 -0300 | [diff] [blame] | 3365 | status += MXL_ControlWrite(fe, DAC_DIN_B, 0) ; |
Steven Toth | 52c99bd | 2008-05-01 04:57:01 -0300 | [diff] [blame] | 3366 | |
Steven Toth | 3935c25 | 2008-05-01 05:45:44 -0300 | [diff] [blame] | 3367 | if (state->RF_IN >= 43000000 && state->RF_IN < 160000000) |
Steven Toth | 52c99bd | 2008-05-01 04:57:01 -0300 | [diff] [blame] | 3368 | { |
| 3369 | |
Steven Toth | 3935c25 | 2008-05-01 05:45:44 -0300 | [diff] [blame] | 3370 | status += MXL_ControlWrite(fe, DAC_B_ENABLE, 0) ; // Bank4 Off |
| 3371 | status += MXL_SetGPIO(fe, 4, 0) ; // Bank1 On |
| 3372 | status += MXL_SetGPIO(fe, 1, 1) ; // Bank2 Off |
| 3373 | status += MXL_SetGPIO(fe, 3, 1) ; // Bank3 Off |
Steven Toth | 52c99bd | 2008-05-01 04:57:01 -0300 | [diff] [blame] | 3374 | } |
Steven Toth | 3935c25 | 2008-05-01 05:45:44 -0300 | [diff] [blame] | 3375 | if (state->RF_IN >= 160000000 && state->RF_IN < 210000000) |
Steven Toth | 52c99bd | 2008-05-01 04:57:01 -0300 | [diff] [blame] | 3376 | { |
Steven Toth | 3935c25 | 2008-05-01 05:45:44 -0300 | [diff] [blame] | 3377 | status += MXL_ControlWrite(fe, DAC_B_ENABLE, 0) ; // Bank4 Off |
| 3378 | status += MXL_SetGPIO(fe, 4, 0) ; // Bank1 On |
| 3379 | status += MXL_SetGPIO(fe, 1, 0) ; // Bank2 On |
| 3380 | status += MXL_SetGPIO(fe, 3, 1) ; // Bank3 Off |
Steven Toth | 52c99bd | 2008-05-01 04:57:01 -0300 | [diff] [blame] | 3381 | } |
Steven Toth | 3935c25 | 2008-05-01 05:45:44 -0300 | [diff] [blame] | 3382 | if (state->RF_IN >= 210000000 && state->RF_IN < 300000000) |
Steven Toth | 52c99bd | 2008-05-01 04:57:01 -0300 | [diff] [blame] | 3383 | { |
Steven Toth | 3935c25 | 2008-05-01 05:45:44 -0300 | [diff] [blame] | 3384 | status += MXL_ControlWrite(fe, DAC_B_ENABLE, 0) ; // Bank4 Off |
| 3385 | status += MXL_SetGPIO(fe, 4, 1) ; // Bank1 Off |
| 3386 | status += MXL_SetGPIO(fe, 1, 0) ; // Bank2 On |
| 3387 | status += MXL_SetGPIO(fe, 3, 1) ; // Bank3 Off |
Steven Toth | 52c99bd | 2008-05-01 04:57:01 -0300 | [diff] [blame] | 3388 | } |
Steven Toth | 3935c25 | 2008-05-01 05:45:44 -0300 | [diff] [blame] | 3389 | if (state->RF_IN >= 300000000 && state->RF_IN < 390000000) |
Steven Toth | 52c99bd | 2008-05-01 04:57:01 -0300 | [diff] [blame] | 3390 | { |
Steven Toth | 3935c25 | 2008-05-01 05:45:44 -0300 | [diff] [blame] | 3391 | status += MXL_ControlWrite(fe, DAC_B_ENABLE, 0) ; // Bank4 Off |
| 3392 | status += MXL_SetGPIO(fe, 4, 1) ; // Bank1 Off |
| 3393 | status += MXL_SetGPIO(fe, 1, 0) ; // Bank2 On |
| 3394 | status += MXL_SetGPIO(fe, 3, 0) ; // Bank3 On |
Steven Toth | 52c99bd | 2008-05-01 04:57:01 -0300 | [diff] [blame] | 3395 | } |
Steven Toth | 3935c25 | 2008-05-01 05:45:44 -0300 | [diff] [blame] | 3396 | if (state->RF_IN >= 390000000 && state->RF_IN < 515000000) |
Steven Toth | 52c99bd | 2008-05-01 04:57:01 -0300 | [diff] [blame] | 3397 | { |
Steven Toth | 3935c25 | 2008-05-01 05:45:44 -0300 | [diff] [blame] | 3398 | status += MXL_ControlWrite(fe, DAC_B_ENABLE, 0) ; // Bank4 Off |
| 3399 | status += MXL_SetGPIO(fe, 4, 1) ; // Bank1 Off |
| 3400 | status += MXL_SetGPIO(fe, 1, 1) ; // Bank2 Off |
| 3401 | status += MXL_SetGPIO(fe, 3, 0) ; // Bank3 On |
Steven Toth | 52c99bd | 2008-05-01 04:57:01 -0300 | [diff] [blame] | 3402 | } |
Steven Toth | 3935c25 | 2008-05-01 05:45:44 -0300 | [diff] [blame] | 3403 | if (state->RF_IN >= 515000000 && state->RF_IN < 650000000) |
Steven Toth | 52c99bd | 2008-05-01 04:57:01 -0300 | [diff] [blame] | 3404 | { |
Steven Toth | 3935c25 | 2008-05-01 05:45:44 -0300 | [diff] [blame] | 3405 | status += MXL_ControlWrite(fe, DAC_B_ENABLE, 1) ; // Bank4 On |
| 3406 | status += MXL_SetGPIO(fe, 4, 1) ; // Bank1 Off |
| 3407 | status += MXL_SetGPIO(fe, 1, 1) ; // Bank2 Off |
| 3408 | status += MXL_SetGPIO(fe, 3, 0) ; // Bank3 On |
Steven Toth | 52c99bd | 2008-05-01 04:57:01 -0300 | [diff] [blame] | 3409 | } |
Steven Toth | 3935c25 | 2008-05-01 05:45:44 -0300 | [diff] [blame] | 3410 | if (state->RF_IN >= 650000000 && state->RF_IN <= 900000000) |
Steven Toth | 52c99bd | 2008-05-01 04:57:01 -0300 | [diff] [blame] | 3411 | { |
Steven Toth | 3935c25 | 2008-05-01 05:45:44 -0300 | [diff] [blame] | 3412 | status += MXL_ControlWrite(fe, DAC_B_ENABLE, 1) ; // Bank4 On |
| 3413 | status += MXL_SetGPIO(fe, 4, 1) ; // Bank1 Off |
| 3414 | status += MXL_SetGPIO(fe, 1, 1) ; // Bank2 Off |
| 3415 | status += MXL_SetGPIO(fe, 3, 1) ; // Bank3 Off |
Steven Toth | 52c99bd | 2008-05-01 04:57:01 -0300 | [diff] [blame] | 3416 | } |
| 3417 | } |
| 3418 | |
Steven Toth | 85d220d | 2008-05-01 05:48:14 -0300 | [diff] [blame] | 3419 | if (state->TF_Type == MXL_TF_E_2) // Tracking Filter type E_2 |
Steven Toth | 52c99bd | 2008-05-01 04:57:01 -0300 | [diff] [blame] | 3420 | { |
Steven Toth | 3935c25 | 2008-05-01 05:45:44 -0300 | [diff] [blame] | 3421 | status += MXL_ControlWrite(fe, DAC_DIN_B, 0) ; |
Steven Toth | 52c99bd | 2008-05-01 04:57:01 -0300 | [diff] [blame] | 3422 | |
Steven Toth | 3935c25 | 2008-05-01 05:45:44 -0300 | [diff] [blame] | 3423 | if (state->RF_IN >= 43000000 && state->RF_IN < 174000000) |
Steven Toth | 52c99bd | 2008-05-01 04:57:01 -0300 | [diff] [blame] | 3424 | { |
| 3425 | |
Steven Toth | 3935c25 | 2008-05-01 05:45:44 -0300 | [diff] [blame] | 3426 | status += MXL_ControlWrite(fe, DAC_B_ENABLE, 0) ; // Bank4 Off |
| 3427 | status += MXL_SetGPIO(fe, 4, 0) ; // Bank1 On |
| 3428 | status += MXL_SetGPIO(fe, 1, 1) ; // Bank2 Off |
| 3429 | status += MXL_SetGPIO(fe, 3, 1) ; // Bank3 Off |
Steven Toth | 52c99bd | 2008-05-01 04:57:01 -0300 | [diff] [blame] | 3430 | } |
Steven Toth | 3935c25 | 2008-05-01 05:45:44 -0300 | [diff] [blame] | 3431 | if (state->RF_IN >= 174000000 && state->RF_IN < 250000000) |
Steven Toth | 52c99bd | 2008-05-01 04:57:01 -0300 | [diff] [blame] | 3432 | { |
Steven Toth | 3935c25 | 2008-05-01 05:45:44 -0300 | [diff] [blame] | 3433 | status += MXL_ControlWrite(fe, DAC_B_ENABLE, 0) ; // Bank4 Off |
| 3434 | status += MXL_SetGPIO(fe, 4, 0) ; // Bank1 On |
| 3435 | status += MXL_SetGPIO(fe, 1, 0) ; // Bank2 On |
| 3436 | status += MXL_SetGPIO(fe, 3, 1) ; // Bank3 Off |
Steven Toth | 52c99bd | 2008-05-01 04:57:01 -0300 | [diff] [blame] | 3437 | } |
Steven Toth | 3935c25 | 2008-05-01 05:45:44 -0300 | [diff] [blame] | 3438 | if (state->RF_IN >= 250000000 && state->RF_IN < 350000000) |
Steven Toth | 52c99bd | 2008-05-01 04:57:01 -0300 | [diff] [blame] | 3439 | { |
Steven Toth | 3935c25 | 2008-05-01 05:45:44 -0300 | [diff] [blame] | 3440 | status += MXL_ControlWrite(fe, DAC_B_ENABLE, 0) ; // Bank4 Off |
| 3441 | status += MXL_SetGPIO(fe, 4, 1) ; // Bank1 Off |
| 3442 | status += MXL_SetGPIO(fe, 1, 0) ; // Bank2 On |
| 3443 | status += MXL_SetGPIO(fe, 3, 1) ; // Bank3 Off |
Steven Toth | 52c99bd | 2008-05-01 04:57:01 -0300 | [diff] [blame] | 3444 | } |
Steven Toth | 3935c25 | 2008-05-01 05:45:44 -0300 | [diff] [blame] | 3445 | if (state->RF_IN >= 350000000 && state->RF_IN < 400000000) |
Steven Toth | 52c99bd | 2008-05-01 04:57:01 -0300 | [diff] [blame] | 3446 | { |
Steven Toth | 3935c25 | 2008-05-01 05:45:44 -0300 | [diff] [blame] | 3447 | status += MXL_ControlWrite(fe, DAC_B_ENABLE, 0) ; // Bank4 Off |
| 3448 | status += MXL_SetGPIO(fe, 4, 1) ; // Bank1 Off |
| 3449 | status += MXL_SetGPIO(fe, 1, 0) ; // Bank2 On |
| 3450 | status += MXL_SetGPIO(fe, 3, 0) ; // Bank3 On |
Steven Toth | 52c99bd | 2008-05-01 04:57:01 -0300 | [diff] [blame] | 3451 | } |
Steven Toth | 3935c25 | 2008-05-01 05:45:44 -0300 | [diff] [blame] | 3452 | if (state->RF_IN >= 400000000 && state->RF_IN < 570000000) |
Steven Toth | 52c99bd | 2008-05-01 04:57:01 -0300 | [diff] [blame] | 3453 | { |
Steven Toth | 3935c25 | 2008-05-01 05:45:44 -0300 | [diff] [blame] | 3454 | status += MXL_ControlWrite(fe, DAC_B_ENABLE, 0) ; // Bank4 Off |
| 3455 | status += MXL_SetGPIO(fe, 4, 1) ; // Bank1 Off |
| 3456 | status += MXL_SetGPIO(fe, 1, 1) ; // Bank2 Off |
| 3457 | status += MXL_SetGPIO(fe, 3, 0) ; // Bank3 On |
Steven Toth | 52c99bd | 2008-05-01 04:57:01 -0300 | [diff] [blame] | 3458 | } |
Steven Toth | 3935c25 | 2008-05-01 05:45:44 -0300 | [diff] [blame] | 3459 | if (state->RF_IN >= 570000000 && state->RF_IN < 770000000) |
Steven Toth | 52c99bd | 2008-05-01 04:57:01 -0300 | [diff] [blame] | 3460 | { |
Steven Toth | 3935c25 | 2008-05-01 05:45:44 -0300 | [diff] [blame] | 3461 | status += MXL_ControlWrite(fe, DAC_B_ENABLE, 1) ; // Bank4 On |
| 3462 | status += MXL_SetGPIO(fe, 4, 1) ; // Bank1 Off |
| 3463 | status += MXL_SetGPIO(fe, 1, 1) ; // Bank2 Off |
| 3464 | status += MXL_SetGPIO(fe, 3, 0) ; // Bank3 On |
Steven Toth | 52c99bd | 2008-05-01 04:57:01 -0300 | [diff] [blame] | 3465 | } |
Steven Toth | 3935c25 | 2008-05-01 05:45:44 -0300 | [diff] [blame] | 3466 | if (state->RF_IN >= 770000000 && state->RF_IN <= 900000000) |
Steven Toth | 52c99bd | 2008-05-01 04:57:01 -0300 | [diff] [blame] | 3467 | { |
Steven Toth | 3935c25 | 2008-05-01 05:45:44 -0300 | [diff] [blame] | 3468 | status += MXL_ControlWrite(fe, DAC_B_ENABLE, 1) ; // Bank4 On |
| 3469 | status += MXL_SetGPIO(fe, 4, 1) ; // Bank1 Off |
| 3470 | status += MXL_SetGPIO(fe, 1, 1) ; // Bank2 Off |
| 3471 | status += MXL_SetGPIO(fe, 3, 1) ; // Bank3 Off |
Steven Toth | 52c99bd | 2008-05-01 04:57:01 -0300 | [diff] [blame] | 3472 | } |
| 3473 | } |
| 3474 | |
Steven Toth | 85d220d | 2008-05-01 05:48:14 -0300 | [diff] [blame] | 3475 | if (state->TF_Type == MXL_TF_G) // Tracking Filter type G add for v2.6.8 |
Steven Toth | 52c99bd | 2008-05-01 04:57:01 -0300 | [diff] [blame] | 3476 | { |
Steven Toth | 3935c25 | 2008-05-01 05:45:44 -0300 | [diff] [blame] | 3477 | status += MXL_ControlWrite(fe, DAC_DIN_B, 0) ; |
Steven Toth | 52c99bd | 2008-05-01 04:57:01 -0300 | [diff] [blame] | 3478 | |
Steven Toth | 3935c25 | 2008-05-01 05:45:44 -0300 | [diff] [blame] | 3479 | if (state->RF_IN >= 50000000 && state->RF_IN < 190000000) |
Steven Toth | 52c99bd | 2008-05-01 04:57:01 -0300 | [diff] [blame] | 3480 | { |
| 3481 | |
Steven Toth | 3935c25 | 2008-05-01 05:45:44 -0300 | [diff] [blame] | 3482 | status += MXL_ControlWrite(fe, DAC_B_ENABLE, 0) ; // Bank4 Off |
| 3483 | status += MXL_SetGPIO(fe, 4, 0) ; // Bank1 On |
| 3484 | status += MXL_SetGPIO(fe, 1, 1) ; // Bank2 Off |
| 3485 | status += MXL_SetGPIO(fe, 3, 1) ; // Bank3 Off |
Steven Toth | 52c99bd | 2008-05-01 04:57:01 -0300 | [diff] [blame] | 3486 | } |
Steven Toth | 3935c25 | 2008-05-01 05:45:44 -0300 | [diff] [blame] | 3487 | if (state->RF_IN >= 190000000 && state->RF_IN < 280000000) |
Steven Toth | 52c99bd | 2008-05-01 04:57:01 -0300 | [diff] [blame] | 3488 | { |
Steven Toth | 3935c25 | 2008-05-01 05:45:44 -0300 | [diff] [blame] | 3489 | status += MXL_ControlWrite(fe, DAC_B_ENABLE, 0) ; // Bank4 Off |
| 3490 | status += MXL_SetGPIO(fe, 4, 0) ; // Bank1 On |
| 3491 | status += MXL_SetGPIO(fe, 1, 0) ; // Bank2 On |
| 3492 | status += MXL_SetGPIO(fe, 3, 1) ; // Bank3 Off |
Steven Toth | 52c99bd | 2008-05-01 04:57:01 -0300 | [diff] [blame] | 3493 | } |
Steven Toth | 3935c25 | 2008-05-01 05:45:44 -0300 | [diff] [blame] | 3494 | if (state->RF_IN >= 280000000 && state->RF_IN < 350000000) |
Steven Toth | 52c99bd | 2008-05-01 04:57:01 -0300 | [diff] [blame] | 3495 | { |
Steven Toth | 3935c25 | 2008-05-01 05:45:44 -0300 | [diff] [blame] | 3496 | status += MXL_ControlWrite(fe, DAC_B_ENABLE, 0) ; // Bank4 Off |
| 3497 | status += MXL_SetGPIO(fe, 4, 1) ; // Bank1 Off |
| 3498 | status += MXL_SetGPIO(fe, 1, 0) ; // Bank2 On |
| 3499 | status += MXL_SetGPIO(fe, 3, 1) ; // Bank3 Off |
Steven Toth | 52c99bd | 2008-05-01 04:57:01 -0300 | [diff] [blame] | 3500 | } |
Steven Toth | 3935c25 | 2008-05-01 05:45:44 -0300 | [diff] [blame] | 3501 | if (state->RF_IN >= 350000000 && state->RF_IN < 400000000) |
Steven Toth | 52c99bd | 2008-05-01 04:57:01 -0300 | [diff] [blame] | 3502 | { |
Steven Toth | 3935c25 | 2008-05-01 05:45:44 -0300 | [diff] [blame] | 3503 | status += MXL_ControlWrite(fe, DAC_B_ENABLE, 0) ; // Bank4 Off |
| 3504 | status += MXL_SetGPIO(fe, 4, 1) ; // Bank1 Off |
| 3505 | status += MXL_SetGPIO(fe, 1, 0) ; // Bank2 On |
| 3506 | status += MXL_SetGPIO(fe, 3, 0) ; // Bank3 On |
Steven Toth | 52c99bd | 2008-05-01 04:57:01 -0300 | [diff] [blame] | 3507 | } |
Steven Toth | 3935c25 | 2008-05-01 05:45:44 -0300 | [diff] [blame] | 3508 | if (state->RF_IN >= 400000000 && state->RF_IN < 470000000) //modified for 2.6.11 |
Steven Toth | 52c99bd | 2008-05-01 04:57:01 -0300 | [diff] [blame] | 3509 | { |
Steven Toth | 3935c25 | 2008-05-01 05:45:44 -0300 | [diff] [blame] | 3510 | status += MXL_ControlWrite(fe, DAC_B_ENABLE, 1) ; // Bank4 On |
| 3511 | status += MXL_SetGPIO(fe, 4, 1) ; // Bank1 On |
| 3512 | status += MXL_SetGPIO(fe, 1, 0) ; // Bank2 Off |
| 3513 | status += MXL_SetGPIO(fe, 3, 1) ; // Bank3 Off |
Steven Toth | 52c99bd | 2008-05-01 04:57:01 -0300 | [diff] [blame] | 3514 | } |
Steven Toth | 3935c25 | 2008-05-01 05:45:44 -0300 | [diff] [blame] | 3515 | if (state->RF_IN >= 470000000 && state->RF_IN < 640000000) |
Steven Toth | 52c99bd | 2008-05-01 04:57:01 -0300 | [diff] [blame] | 3516 | { |
Steven Toth | 3935c25 | 2008-05-01 05:45:44 -0300 | [diff] [blame] | 3517 | status += MXL_ControlWrite(fe, DAC_B_ENABLE, 0) ; // Bank4 Off |
| 3518 | status += MXL_SetGPIO(fe, 4, 1) ; // Bank1 Off |
| 3519 | status += MXL_SetGPIO(fe, 1, 1) ; // Bank2 Off |
| 3520 | status += MXL_SetGPIO(fe, 3, 0) ; // Bank3 On |
Steven Toth | 52c99bd | 2008-05-01 04:57:01 -0300 | [diff] [blame] | 3521 | } |
Steven Toth | 3935c25 | 2008-05-01 05:45:44 -0300 | [diff] [blame] | 3522 | if (state->RF_IN >= 640000000 && state->RF_IN < 820000000) |
Steven Toth | 52c99bd | 2008-05-01 04:57:01 -0300 | [diff] [blame] | 3523 | { |
Steven Toth | 3935c25 | 2008-05-01 05:45:44 -0300 | [diff] [blame] | 3524 | status += MXL_ControlWrite(fe, DAC_B_ENABLE, 1) ; // Bank4 On |
| 3525 | status += MXL_SetGPIO(fe, 4, 1) ; // Bank1 Off |
| 3526 | status += MXL_SetGPIO(fe, 1, 1) ; // Bank2 Off |
| 3527 | status += MXL_SetGPIO(fe, 3, 0) ; // Bank3 On |
Steven Toth | 52c99bd | 2008-05-01 04:57:01 -0300 | [diff] [blame] | 3528 | } |
Steven Toth | 3935c25 | 2008-05-01 05:45:44 -0300 | [diff] [blame] | 3529 | if (state->RF_IN >= 820000000 && state->RF_IN <= 900000000) |
Steven Toth | 52c99bd | 2008-05-01 04:57:01 -0300 | [diff] [blame] | 3530 | { |
Steven Toth | 3935c25 | 2008-05-01 05:45:44 -0300 | [diff] [blame] | 3531 | status += MXL_ControlWrite(fe, DAC_B_ENABLE, 1) ; // Bank4 On |
| 3532 | status += MXL_SetGPIO(fe, 4, 1) ; // Bank1 Off |
| 3533 | status += MXL_SetGPIO(fe, 1, 1) ; // Bank2 Off |
| 3534 | status += MXL_SetGPIO(fe, 3, 1) ; // Bank3 Off |
Steven Toth | 52c99bd | 2008-05-01 04:57:01 -0300 | [diff] [blame] | 3535 | } |
| 3536 | } |
| 3537 | |
Steven Toth | 85d220d | 2008-05-01 05:48:14 -0300 | [diff] [blame] | 3538 | if (state->TF_Type == MXL_TF_E_NA) // Tracking Filter type E-NA for Empia ONLY change for 2.6.8 |
Steven Toth | 52c99bd | 2008-05-01 04:57:01 -0300 | [diff] [blame] | 3539 | { |
Steven Toth | 3935c25 | 2008-05-01 05:45:44 -0300 | [diff] [blame] | 3540 | status += MXL_ControlWrite(fe, DAC_DIN_B, 0) ; |
Steven Toth | 52c99bd | 2008-05-01 04:57:01 -0300 | [diff] [blame] | 3541 | |
Steven Toth | a8214d4 | 2008-05-01 05:02:58 -0300 | [diff] [blame] | 3542 | // if UHF and terrestrial=> Turn off Tracking Filter |
Steven Toth | 3935c25 | 2008-05-01 05:45:44 -0300 | [diff] [blame] | 3543 | if (state->RF_IN >= 471000000 && (state->RF_IN - 471000000)%6000000 != 0) |
Steven Toth | 52c99bd | 2008-05-01 04:57:01 -0300 | [diff] [blame] | 3544 | { |
| 3545 | // Turn off all the banks |
Steven Toth | 3935c25 | 2008-05-01 05:45:44 -0300 | [diff] [blame] | 3546 | status += MXL_SetGPIO(fe, 3, 1) ; |
| 3547 | status += MXL_SetGPIO(fe, 1, 1) ; |
| 3548 | status += MXL_SetGPIO(fe, 4, 1) ; |
| 3549 | status += MXL_ControlWrite(fe, DAC_B_ENABLE, 0) ; |
Steven Toth | 52c99bd | 2008-05-01 04:57:01 -0300 | [diff] [blame] | 3550 | |
| 3551 | //2.6.12 |
| 3552 | //Turn on RSSI |
Steven Toth | 3935c25 | 2008-05-01 05:45:44 -0300 | [diff] [blame] | 3553 | status += MXL_ControlWrite(fe, SEQ_EXTSYNTHCALIF, 1) ; |
| 3554 | status += MXL_ControlWrite(fe, SEQ_EXTDCCAL, 1) ; |
| 3555 | status += MXL_ControlWrite(fe, AGC_EN_RSSI, 1) ; |
| 3556 | status += MXL_ControlWrite(fe, RFA_ENCLKRFAGC, 1) ; |
Steven Toth | 52c99bd | 2008-05-01 04:57:01 -0300 | [diff] [blame] | 3557 | |
| 3558 | // RSSI reference point |
Steven Toth | 3935c25 | 2008-05-01 05:45:44 -0300 | [diff] [blame] | 3559 | status += MXL_ControlWrite(fe, RFA_RSSI_REFH, 5) ; |
| 3560 | status += MXL_ControlWrite(fe, RFA_RSSI_REF, 3) ; |
| 3561 | status += MXL_ControlWrite(fe, RFA_RSSI_REFL, 2) ; |
Steven Toth | 52c99bd | 2008-05-01 04:57:01 -0300 | [diff] [blame] | 3562 | |
| 3563 | |
Steven Toth | 3935c25 | 2008-05-01 05:45:44 -0300 | [diff] [blame] | 3564 | //status += MXL_ControlWrite(fe, AGC_IF, 10) ; //doesn't matter since RSSI is turn on |
Steven Toth | 52c99bd | 2008-05-01 04:57:01 -0300 | [diff] [blame] | 3565 | |
| 3566 | //following parameter is from analog OTA mode, can be change to seek better performance |
Steven Toth | 3935c25 | 2008-05-01 05:45:44 -0300 | [diff] [blame] | 3567 | status += MXL_ControlWrite(fe, RFSYN_CHP_GAIN, 3) ; |
Steven Toth | 52c99bd | 2008-05-01 04:57:01 -0300 | [diff] [blame] | 3568 | } |
| 3569 | |
| 3570 | else //if VHF or Cable => Turn on Tracking Filter |
| 3571 | { |
| 3572 | //2.6.12 |
| 3573 | //Turn off RSSI |
Steven Toth | 3935c25 | 2008-05-01 05:45:44 -0300 | [diff] [blame] | 3574 | status += MXL_ControlWrite(fe, AGC_EN_RSSI, 0) ; |
Steven Toth | 52c99bd | 2008-05-01 04:57:01 -0300 | [diff] [blame] | 3575 | |
| 3576 | //change back from above condition |
Steven Toth | 3935c25 | 2008-05-01 05:45:44 -0300 | [diff] [blame] | 3577 | status += MXL_ControlWrite(fe, RFSYN_CHP_GAIN, 5) ; |
Steven Toth | 52c99bd | 2008-05-01 04:57:01 -0300 | [diff] [blame] | 3578 | |
| 3579 | |
Steven Toth | 3935c25 | 2008-05-01 05:45:44 -0300 | [diff] [blame] | 3580 | if (state->RF_IN >= 43000000 && state->RF_IN < 174000000) |
Steven Toth | 52c99bd | 2008-05-01 04:57:01 -0300 | [diff] [blame] | 3581 | { |
| 3582 | |
Steven Toth | 3935c25 | 2008-05-01 05:45:44 -0300 | [diff] [blame] | 3583 | status += MXL_ControlWrite(fe, DAC_B_ENABLE, 0) ; // Bank4 Off |
| 3584 | status += MXL_SetGPIO(fe, 4, 0) ; // Bank1 On |
| 3585 | status += MXL_SetGPIO(fe, 1, 1) ; // Bank2 Off |
| 3586 | status += MXL_SetGPIO(fe, 3, 1) ; // Bank3 Off |
Steven Toth | 52c99bd | 2008-05-01 04:57:01 -0300 | [diff] [blame] | 3587 | } |
Steven Toth | 3935c25 | 2008-05-01 05:45:44 -0300 | [diff] [blame] | 3588 | if (state->RF_IN >= 174000000 && state->RF_IN < 250000000) |
Steven Toth | 52c99bd | 2008-05-01 04:57:01 -0300 | [diff] [blame] | 3589 | { |
Steven Toth | 3935c25 | 2008-05-01 05:45:44 -0300 | [diff] [blame] | 3590 | status += MXL_ControlWrite(fe, DAC_B_ENABLE, 0) ; // Bank4 Off |
| 3591 | status += MXL_SetGPIO(fe, 4, 0) ; // Bank1 On |
| 3592 | status += MXL_SetGPIO(fe, 1, 0) ; // Bank2 On |
| 3593 | status += MXL_SetGPIO(fe, 3, 1) ; // Bank3 Off |
Steven Toth | 52c99bd | 2008-05-01 04:57:01 -0300 | [diff] [blame] | 3594 | } |
Steven Toth | 3935c25 | 2008-05-01 05:45:44 -0300 | [diff] [blame] | 3595 | if (state->RF_IN >= 250000000 && state->RF_IN < 350000000) |
Steven Toth | 52c99bd | 2008-05-01 04:57:01 -0300 | [diff] [blame] | 3596 | { |
Steven Toth | 3935c25 | 2008-05-01 05:45:44 -0300 | [diff] [blame] | 3597 | status += MXL_ControlWrite(fe, DAC_B_ENABLE, 0) ; // Bank4 Off |
| 3598 | status += MXL_SetGPIO(fe, 4, 1) ; // Bank1 Off |
| 3599 | status += MXL_SetGPIO(fe, 1, 0) ; // Bank2 On |
| 3600 | status += MXL_SetGPIO(fe, 3, 1) ; // Bank3 Off |
Steven Toth | 52c99bd | 2008-05-01 04:57:01 -0300 | [diff] [blame] | 3601 | } |
Steven Toth | 3935c25 | 2008-05-01 05:45:44 -0300 | [diff] [blame] | 3602 | if (state->RF_IN >= 350000000 && state->RF_IN < 400000000) |
Steven Toth | 52c99bd | 2008-05-01 04:57:01 -0300 | [diff] [blame] | 3603 | { |
Steven Toth | 3935c25 | 2008-05-01 05:45:44 -0300 | [diff] [blame] | 3604 | status += MXL_ControlWrite(fe, DAC_B_ENABLE, 0) ; // Bank4 Off |
| 3605 | status += MXL_SetGPIO(fe, 4, 1) ; // Bank1 Off |
| 3606 | status += MXL_SetGPIO(fe, 1, 0) ; // Bank2 On |
| 3607 | status += MXL_SetGPIO(fe, 3, 0) ; // Bank3 On |
Steven Toth | 52c99bd | 2008-05-01 04:57:01 -0300 | [diff] [blame] | 3608 | } |
Steven Toth | 3935c25 | 2008-05-01 05:45:44 -0300 | [diff] [blame] | 3609 | if (state->RF_IN >= 400000000 && state->RF_IN < 570000000) |
Steven Toth | 52c99bd | 2008-05-01 04:57:01 -0300 | [diff] [blame] | 3610 | { |
Steven Toth | 3935c25 | 2008-05-01 05:45:44 -0300 | [diff] [blame] | 3611 | status += MXL_ControlWrite(fe, DAC_B_ENABLE, 0) ; // Bank4 Off |
| 3612 | status += MXL_SetGPIO(fe, 4, 1) ; // Bank1 Off |
| 3613 | status += MXL_SetGPIO(fe, 1, 1) ; // Bank2 Off |
| 3614 | status += MXL_SetGPIO(fe, 3, 0) ; // Bank3 On |
Steven Toth | 52c99bd | 2008-05-01 04:57:01 -0300 | [diff] [blame] | 3615 | } |
Steven Toth | 3935c25 | 2008-05-01 05:45:44 -0300 | [diff] [blame] | 3616 | if (state->RF_IN >= 570000000 && state->RF_IN < 770000000) |
Steven Toth | 52c99bd | 2008-05-01 04:57:01 -0300 | [diff] [blame] | 3617 | { |
Steven Toth | 3935c25 | 2008-05-01 05:45:44 -0300 | [diff] [blame] | 3618 | status += MXL_ControlWrite(fe, DAC_B_ENABLE, 1) ; // Bank4 On |
| 3619 | status += MXL_SetGPIO(fe, 4, 1) ; // Bank1 Off |
| 3620 | status += MXL_SetGPIO(fe, 1, 1) ; // Bank2 Off |
| 3621 | status += MXL_SetGPIO(fe, 3, 0) ; // Bank3 On |
Steven Toth | 52c99bd | 2008-05-01 04:57:01 -0300 | [diff] [blame] | 3622 | } |
Steven Toth | 3935c25 | 2008-05-01 05:45:44 -0300 | [diff] [blame] | 3623 | if (state->RF_IN >= 770000000 && state->RF_IN <= 900000000) |
Steven Toth | 52c99bd | 2008-05-01 04:57:01 -0300 | [diff] [blame] | 3624 | { |
Steven Toth | 3935c25 | 2008-05-01 05:45:44 -0300 | [diff] [blame] | 3625 | status += MXL_ControlWrite(fe, DAC_B_ENABLE, 1) ; // Bank4 On |
| 3626 | status += MXL_SetGPIO(fe, 4, 1) ; // Bank1 Off |
| 3627 | status += MXL_SetGPIO(fe, 1, 1) ; // Bank2 Off |
| 3628 | status += MXL_SetGPIO(fe, 3, 1) ; // Bank3 Off |
Steven Toth | 52c99bd | 2008-05-01 04:57:01 -0300 | [diff] [blame] | 3629 | } |
| 3630 | } |
| 3631 | } |
| 3632 | return status ; |
| 3633 | } |
| 3634 | |
Steven Toth | 3935c25 | 2008-05-01 05:45:44 -0300 | [diff] [blame] | 3635 | u16 MXL_SetGPIO(struct dvb_frontend *fe, u8 GPIO_Num, u8 GPIO_Val) |
Steven Toth | 52c99bd | 2008-05-01 04:57:01 -0300 | [diff] [blame] | 3636 | { |
Steven Toth | 3935c25 | 2008-05-01 05:45:44 -0300 | [diff] [blame] | 3637 | u16 status = 0; |
Steven Toth | 52c99bd | 2008-05-01 04:57:01 -0300 | [diff] [blame] | 3638 | |
| 3639 | if (GPIO_Num == 1) |
Steven Toth | 3935c25 | 2008-05-01 05:45:44 -0300 | [diff] [blame] | 3640 | status += MXL_ControlWrite(fe, GPIO_1B, GPIO_Val ? 0 : 1); |
| 3641 | |
| 3642 | /* GPIO2 is not available */ |
| 3643 | |
| 3644 | if (GPIO_Num == 3) { |
Steven Toth | 52c99bd | 2008-05-01 04:57:01 -0300 | [diff] [blame] | 3645 | if (GPIO_Val == 1) { |
Steven Toth | 3935c25 | 2008-05-01 05:45:44 -0300 | [diff] [blame] | 3646 | status += MXL_ControlWrite(fe, GPIO_3, 0); |
| 3647 | status += MXL_ControlWrite(fe, GPIO_3B, 0); |
Steven Toth | 52c99bd | 2008-05-01 04:57:01 -0300 | [diff] [blame] | 3648 | } |
| 3649 | if (GPIO_Val == 0) { |
Steven Toth | 3935c25 | 2008-05-01 05:45:44 -0300 | [diff] [blame] | 3650 | status += MXL_ControlWrite(fe, GPIO_3, 1); |
| 3651 | status += MXL_ControlWrite(fe, GPIO_3B, 1); |
Steven Toth | 52c99bd | 2008-05-01 04:57:01 -0300 | [diff] [blame] | 3652 | } |
Steven Toth | 3935c25 | 2008-05-01 05:45:44 -0300 | [diff] [blame] | 3653 | if (GPIO_Val == 3) { /* tri-state */ |
| 3654 | status += MXL_ControlWrite(fe, GPIO_3, 0); |
| 3655 | status += MXL_ControlWrite(fe, GPIO_3B, 1); |
Steven Toth | 52c99bd | 2008-05-01 04:57:01 -0300 | [diff] [blame] | 3656 | } |
| 3657 | } |
Steven Toth | 3935c25 | 2008-05-01 05:45:44 -0300 | [diff] [blame] | 3658 | if (GPIO_Num == 4) { |
Steven Toth | 52c99bd | 2008-05-01 04:57:01 -0300 | [diff] [blame] | 3659 | if (GPIO_Val == 1) { |
Steven Toth | 3935c25 | 2008-05-01 05:45:44 -0300 | [diff] [blame] | 3660 | status += MXL_ControlWrite(fe, GPIO_4, 0); |
| 3661 | status += MXL_ControlWrite(fe, GPIO_4B, 0); |
Steven Toth | 52c99bd | 2008-05-01 04:57:01 -0300 | [diff] [blame] | 3662 | } |
| 3663 | if (GPIO_Val == 0) { |
Steven Toth | 3935c25 | 2008-05-01 05:45:44 -0300 | [diff] [blame] | 3664 | status += MXL_ControlWrite(fe, GPIO_4, 1); |
| 3665 | status += MXL_ControlWrite(fe, GPIO_4B, 1); |
Steven Toth | 52c99bd | 2008-05-01 04:57:01 -0300 | [diff] [blame] | 3666 | } |
Steven Toth | 3935c25 | 2008-05-01 05:45:44 -0300 | [diff] [blame] | 3667 | if (GPIO_Val == 3) { /* tri-state */ |
| 3668 | status += MXL_ControlWrite(fe, GPIO_4, 0); |
| 3669 | status += MXL_ControlWrite(fe, GPIO_4B, 1); |
Steven Toth | 52c99bd | 2008-05-01 04:57:01 -0300 | [diff] [blame] | 3670 | } |
| 3671 | } |
| 3672 | |
Steven Toth | 3935c25 | 2008-05-01 05:45:44 -0300 | [diff] [blame] | 3673 | return status; |
Steven Toth | 52c99bd | 2008-05-01 04:57:01 -0300 | [diff] [blame] | 3674 | } |
| 3675 | |
| 3676 | /////////////////////////////////////////////////////////////////////////////// |
| 3677 | // // |
| 3678 | // Function: MXL_ControlWrite // |
| 3679 | // // |
| 3680 | // Description: Update control name value // |
| 3681 | // // |
| 3682 | // Globals: // |
| 3683 | // NONE // |
| 3684 | // // |
| 3685 | // Functions used: // |
| 3686 | // MXL_ControlWrite( Tuner, controlName, value, Group ) // |
| 3687 | // // |
| 3688 | // Inputs: // |
| 3689 | // Tuner : Tuner structure // |
| 3690 | // ControlName : Control name to be updated // |
| 3691 | // value : Value to be written // |
| 3692 | // // |
| 3693 | // Outputs: // |
| 3694 | // Tuner : Tuner structure defined at higher level // |
| 3695 | // // |
| 3696 | // Return: // |
| 3697 | // 0 : Successful write // |
| 3698 | // >0 : Value exceed maximum allowed for control number // |
| 3699 | // // |
| 3700 | /////////////////////////////////////////////////////////////////////////////// |
Steven Toth | 3935c25 | 2008-05-01 05:45:44 -0300 | [diff] [blame] | 3701 | u16 MXL_ControlWrite(struct dvb_frontend *fe, u16 ControlNum, u32 value) |
Steven Toth | 52c99bd | 2008-05-01 04:57:01 -0300 | [diff] [blame] | 3702 | { |
Steven Toth | 3935c25 | 2008-05-01 05:45:44 -0300 | [diff] [blame] | 3703 | u16 status = 0; |
Steven Toth | 52c99bd | 2008-05-01 04:57:01 -0300 | [diff] [blame] | 3704 | |
Steven Toth | 3935c25 | 2008-05-01 05:45:44 -0300 | [diff] [blame] | 3705 | /* Will write ALL Matching Control Name */ |
Steven Toth | 85d220d | 2008-05-01 05:48:14 -0300 | [diff] [blame] | 3706 | status += MXL_ControlWrite_Group(fe, ControlNum, value, 1); /* Write Matching INIT Control */ |
| 3707 | status += MXL_ControlWrite_Group(fe, ControlNum, value, 2); /* Write Matching CH Control */ |
Steven Toth | 3935c25 | 2008-05-01 05:45:44 -0300 | [diff] [blame] | 3708 | #ifdef _MXL_INTERNAL |
Steven Toth | 85d220d | 2008-05-01 05:48:14 -0300 | [diff] [blame] | 3709 | status += MXL_ControlWrite_Group(fe, ControlNum, value, 3); /* Write Matching MXL Control */ |
Steven Toth | 3935c25 | 2008-05-01 05:45:44 -0300 | [diff] [blame] | 3710 | #endif |
| 3711 | return status; |
Steven Toth | 52c99bd | 2008-05-01 04:57:01 -0300 | [diff] [blame] | 3712 | } |
| 3713 | |
| 3714 | /////////////////////////////////////////////////////////////////////////////// |
| 3715 | // // |
| 3716 | // Function: MXL_ControlWrite // |
| 3717 | // // |
| 3718 | // Description: Update control name value // |
| 3719 | // // |
| 3720 | // Globals: // |
| 3721 | // NONE // |
| 3722 | // // |
| 3723 | // Functions used: // |
| 3724 | // strcmp // |
| 3725 | // // |
| 3726 | // Inputs: // |
| 3727 | // Tuner_struct: structure defined at higher level // |
| 3728 | // ControlName : Control Name // |
| 3729 | // value : Value Assigned to Control Name // |
| 3730 | // controlGroup : Control Register Group // |
| 3731 | // // |
| 3732 | // Outputs: // |
| 3733 | // NONE // |
| 3734 | // // |
| 3735 | // Return: // |
| 3736 | // 0 : Successful write // |
| 3737 | // 1 : Value exceed maximum allowed for control name // |
| 3738 | // 2 : Control name not found // |
| 3739 | // // |
| 3740 | /////////////////////////////////////////////////////////////////////////////// |
Steven Toth | 3935c25 | 2008-05-01 05:45:44 -0300 | [diff] [blame] | 3741 | u16 MXL_ControlWrite_Group(struct dvb_frontend *fe, u16 controlNum, u32 value, u16 controlGroup) |
Steven Toth | 52c99bd | 2008-05-01 04:57:01 -0300 | [diff] [blame] | 3742 | { |
Steven Toth | 85d220d | 2008-05-01 05:48:14 -0300 | [diff] [blame] | 3743 | struct mxl5005s_state *state = fe->tuner_priv; |
Steven Toth | 3935c25 | 2008-05-01 05:45:44 -0300 | [diff] [blame] | 3744 | u16 i, j, k; |
| 3745 | u32 highLimit; |
| 3746 | u32 ctrlVal; |
Steven Toth | 52c99bd | 2008-05-01 04:57:01 -0300 | [diff] [blame] | 3747 | |
Steven Toth | 3935c25 | 2008-05-01 05:45:44 -0300 | [diff] [blame] | 3748 | if (controlGroup == 1) /* Initial Control */ { |
| 3749 | |
| 3750 | for (i = 0; i < state->Init_Ctrl_Num; i++) { |
| 3751 | |
| 3752 | if (controlNum == state->Init_Ctrl[i].Ctrl_Num) { |
| 3753 | |
| 3754 | highLimit = 1 << state->Init_Ctrl[i].size; |
| 3755 | if (value < highLimit) { |
| 3756 | for (j = 0; j < state->Init_Ctrl[i].size; j++) { |
| 3757 | state->Init_Ctrl[i].val[j] = (u8)((value >> j) & 0x01); |
| 3758 | MXL_RegWriteBit(fe, (u8)(state->Init_Ctrl[i].addr[j]), |
| 3759 | (u8)(state->Init_Ctrl[i].bit[j]), |
| 3760 | (u8)((value>>j) & 0x01) ); |
Steven Toth | 52c99bd | 2008-05-01 04:57:01 -0300 | [diff] [blame] | 3761 | } |
Steven Toth | 3935c25 | 2008-05-01 05:45:44 -0300 | [diff] [blame] | 3762 | ctrlVal = 0; |
| 3763 | for (k = 0; k < state->Init_Ctrl[i].size; k++) |
| 3764 | ctrlVal += state->Init_Ctrl[i].val[k] * (1 << k); |
Steven Toth | 52c99bd | 2008-05-01 04:57:01 -0300 | [diff] [blame] | 3765 | } |
| 3766 | else |
Steven Toth | 3935c25 | 2008-05-01 05:45:44 -0300 | [diff] [blame] | 3767 | return -1; |
Steven Toth | 52c99bd | 2008-05-01 04:57:01 -0300 | [diff] [blame] | 3768 | } |
| 3769 | } |
| 3770 | } |
Steven Toth | 3935c25 | 2008-05-01 05:45:44 -0300 | [diff] [blame] | 3771 | if (controlGroup == 2) /* Chan change Control */ { |
| 3772 | |
| 3773 | for (i = 0; i < state->CH_Ctrl_Num; i++) { |
| 3774 | |
| 3775 | if (controlNum == state->CH_Ctrl[i].Ctrl_Num ) { |
| 3776 | |
| 3777 | highLimit = 1 << state->CH_Ctrl[i].size; |
| 3778 | if (value < highLimit) { |
| 3779 | for (j = 0; j < state->CH_Ctrl[i].size; j++) { |
| 3780 | state->CH_Ctrl[i].val[j] = (u8)((value >> j) & 0x01); |
| 3781 | MXL_RegWriteBit(fe, (u8)(state->CH_Ctrl[i].addr[j]), |
| 3782 | (u8)(state->CH_Ctrl[i].bit[j]), |
| 3783 | (u8)((value>>j) & 0x01) ); |
Steven Toth | 52c99bd | 2008-05-01 04:57:01 -0300 | [diff] [blame] | 3784 | } |
Steven Toth | 3935c25 | 2008-05-01 05:45:44 -0300 | [diff] [blame] | 3785 | ctrlVal = 0; |
| 3786 | for (k = 0; k < state->CH_Ctrl[i].size; k++) |
| 3787 | ctrlVal += state->CH_Ctrl[i].val[k] * (1 << k); |
Steven Toth | 52c99bd | 2008-05-01 04:57:01 -0300 | [diff] [blame] | 3788 | } |
| 3789 | else |
Steven Toth | 3935c25 | 2008-05-01 05:45:44 -0300 | [diff] [blame] | 3790 | return -1; |
Steven Toth | 52c99bd | 2008-05-01 04:57:01 -0300 | [diff] [blame] | 3791 | } |
| 3792 | } |
| 3793 | } |
| 3794 | #ifdef _MXL_INTERNAL |
Steven Toth | 3935c25 | 2008-05-01 05:45:44 -0300 | [diff] [blame] | 3795 | if (controlGroup == 3) /* Maxlinear Control */ { |
| 3796 | |
| 3797 | for (i = 0; i < state->MXL_Ctrl_Num; i++) { |
| 3798 | |
| 3799 | if (controlNum == state->MXL_Ctrl[i].Ctrl_Num ) { |
| 3800 | |
| 3801 | highLimit = (1 << state->MXL_Ctrl[i].size) ; |
| 3802 | if (value < highLimit) { |
| 3803 | for (j = 0; j < state->MXL_Ctrl[i].size; j++) { |
| 3804 | state->MXL_Ctrl[i].val[j] = (u8)((value >> j) & 0x01); |
| 3805 | MXL_RegWriteBit(fe, (u8)(state->MXL_Ctrl[i].addr[j]), |
| 3806 | (u8)(state->MXL_Ctrl[i].bit[j]), |
| 3807 | (u8)((value>>j) & 0x01) ); |
Steven Toth | 52c99bd | 2008-05-01 04:57:01 -0300 | [diff] [blame] | 3808 | } |
Steven Toth | 3935c25 | 2008-05-01 05:45:44 -0300 | [diff] [blame] | 3809 | ctrlVal = 0; |
| 3810 | for(k = 0; k < state->MXL_Ctrl[i].size; k++) |
| 3811 | ctrlVal += state->MXL_Ctrl[i].val[k] * (1 << k); |
Steven Toth | 52c99bd | 2008-05-01 04:57:01 -0300 | [diff] [blame] | 3812 | } |
| 3813 | else |
Steven Toth | 3935c25 | 2008-05-01 05:45:44 -0300 | [diff] [blame] | 3814 | return -1; |
Steven Toth | 52c99bd | 2008-05-01 04:57:01 -0300 | [diff] [blame] | 3815 | } |
| 3816 | } |
| 3817 | } |
| 3818 | #endif |
Steven Toth | 3935c25 | 2008-05-01 05:45:44 -0300 | [diff] [blame] | 3819 | return 0 ; /* successful return */ |
Steven Toth | 52c99bd | 2008-05-01 04:57:01 -0300 | [diff] [blame] | 3820 | } |
| 3821 | |
| 3822 | /////////////////////////////////////////////////////////////////////////////// |
| 3823 | // // |
| 3824 | // Function: MXL_RegWrite // |
| 3825 | // // |
| 3826 | // Description: Update tuner register value // |
| 3827 | // // |
| 3828 | // Globals: // |
| 3829 | // NONE // |
| 3830 | // // |
| 3831 | // Functions used: // |
| 3832 | // NONE // |
| 3833 | // // |
| 3834 | // Inputs: // |
| 3835 | // Tuner_struct: structure defined at higher level // |
| 3836 | // RegNum : Register address to be assigned a value // |
| 3837 | // RegVal : Register value to write // |
| 3838 | // // |
| 3839 | // Outputs: // |
| 3840 | // NONE // |
| 3841 | // // |
| 3842 | // Return: // |
| 3843 | // 0 : Successful write // |
| 3844 | // -1 : Invalid Register Address // |
| 3845 | // // |
| 3846 | /////////////////////////////////////////////////////////////////////////////// |
Steven Toth | 3935c25 | 2008-05-01 05:45:44 -0300 | [diff] [blame] | 3847 | u16 MXL_RegWrite(struct dvb_frontend *fe, u8 RegNum, u8 RegVal) |
Steven Toth | 52c99bd | 2008-05-01 04:57:01 -0300 | [diff] [blame] | 3848 | { |
Steven Toth | 85d220d | 2008-05-01 05:48:14 -0300 | [diff] [blame] | 3849 | struct mxl5005s_state *state = fe->tuner_priv; |
Steven Toth | 52c99bd | 2008-05-01 04:57:01 -0300 | [diff] [blame] | 3850 | int i ; |
| 3851 | |
Steven Toth | 3935c25 | 2008-05-01 05:45:44 -0300 | [diff] [blame] | 3852 | for (i = 0; i < 104; i++) { |
| 3853 | if (RegNum == state->TunerRegs[i].Reg_Num) { |
| 3854 | state->TunerRegs[i].Reg_Val = RegVal; |
| 3855 | return 0; |
Steven Toth | 52c99bd | 2008-05-01 04:57:01 -0300 | [diff] [blame] | 3856 | } |
| 3857 | } |
| 3858 | |
Steven Toth | 3935c25 | 2008-05-01 05:45:44 -0300 | [diff] [blame] | 3859 | return 1; |
Steven Toth | 52c99bd | 2008-05-01 04:57:01 -0300 | [diff] [blame] | 3860 | } |
| 3861 | |
| 3862 | /////////////////////////////////////////////////////////////////////////////// |
| 3863 | // // |
| 3864 | // Function: MXL_RegRead // |
| 3865 | // // |
| 3866 | // Description: Retrieve tuner register value // |
| 3867 | // // |
| 3868 | // Globals: // |
| 3869 | // NONE // |
| 3870 | // // |
| 3871 | // Functions used: // |
| 3872 | // NONE // |
| 3873 | // // |
| 3874 | // Inputs: // |
| 3875 | // Tuner_struct: structure defined at higher level // |
| 3876 | // RegNum : Register address to be assigned a value // |
| 3877 | // // |
| 3878 | // Outputs: // |
| 3879 | // RegVal : Retrieved register value // |
| 3880 | // // |
| 3881 | // Return: // |
| 3882 | // 0 : Successful read // |
| 3883 | // -1 : Invalid Register Address // |
| 3884 | // // |
| 3885 | /////////////////////////////////////////////////////////////////////////////// |
Steven Toth | 3935c25 | 2008-05-01 05:45:44 -0300 | [diff] [blame] | 3886 | u16 MXL_RegRead(struct dvb_frontend *fe, u8 RegNum, u8 *RegVal) |
Steven Toth | 52c99bd | 2008-05-01 04:57:01 -0300 | [diff] [blame] | 3887 | { |
Steven Toth | 85d220d | 2008-05-01 05:48:14 -0300 | [diff] [blame] | 3888 | struct mxl5005s_state *state = fe->tuner_priv; |
Steven Toth | 52c99bd | 2008-05-01 04:57:01 -0300 | [diff] [blame] | 3889 | int i ; |
| 3890 | |
Steven Toth | 3935c25 | 2008-05-01 05:45:44 -0300 | [diff] [blame] | 3891 | for (i = 0; i < 104; i++) { |
| 3892 | if (RegNum == state->TunerRegs[i].Reg_Num ) { |
| 3893 | *RegVal = (u8)(state->TunerRegs[i].Reg_Val); |
| 3894 | return 0; |
Steven Toth | 52c99bd | 2008-05-01 04:57:01 -0300 | [diff] [blame] | 3895 | } |
| 3896 | } |
| 3897 | |
Steven Toth | 3935c25 | 2008-05-01 05:45:44 -0300 | [diff] [blame] | 3898 | return 1; |
Steven Toth | 52c99bd | 2008-05-01 04:57:01 -0300 | [diff] [blame] | 3899 | } |
| 3900 | |
| 3901 | /////////////////////////////////////////////////////////////////////////////// |
| 3902 | // // |
| 3903 | // Function: MXL_ControlRead // |
| 3904 | // // |
| 3905 | // Description: Retrieve the control value based on the control name // |
| 3906 | // // |
| 3907 | // Globals: // |
| 3908 | // NONE // |
| 3909 | // // |
| 3910 | // Inputs: // |
| 3911 | // Tuner_struct : structure defined at higher level // |
| 3912 | // ControlName : Control Name // |
| 3913 | // // |
| 3914 | // Outputs: // |
| 3915 | // value : returned control value // |
| 3916 | // // |
| 3917 | // Return: // |
| 3918 | // 0 : Successful read // |
| 3919 | // -1 : Invalid control name // |
| 3920 | // // |
| 3921 | /////////////////////////////////////////////////////////////////////////////// |
Steven Toth | 85d220d | 2008-05-01 05:48:14 -0300 | [diff] [blame] | 3922 | u16 MXL_ControlRead(struct dvb_frontend *fe, u16 controlNum, u32 *value) |
Steven Toth | 52c99bd | 2008-05-01 04:57:01 -0300 | [diff] [blame] | 3923 | { |
Steven Toth | 85d220d | 2008-05-01 05:48:14 -0300 | [diff] [blame] | 3924 | struct mxl5005s_state *state = fe->tuner_priv; |
Steven Toth | a8214d4 | 2008-05-01 05:02:58 -0300 | [diff] [blame] | 3925 | u32 ctrlVal ; |
| 3926 | u16 i, k ; |
Steven Toth | 52c99bd | 2008-05-01 04:57:01 -0300 | [diff] [blame] | 3927 | |
Steven Toth | 3935c25 | 2008-05-01 05:45:44 -0300 | [diff] [blame] | 3928 | for (i = 0; i < state->Init_Ctrl_Num ; i++) { |
| 3929 | |
| 3930 | if (controlNum == state->Init_Ctrl[i].Ctrl_Num) { |
| 3931 | |
| 3932 | ctrlVal = 0; |
| 3933 | for (k = 0; k < state->Init_Ctrl[i].size; k++) |
| 3934 | ctrlVal += state->Init_Ctrl[i].val[k] * (1 << k); |
| 3935 | *value = ctrlVal; |
| 3936 | return 0; |
Steven Toth | 52c99bd | 2008-05-01 04:57:01 -0300 | [diff] [blame] | 3937 | } |
| 3938 | } |
Steven Toth | 3935c25 | 2008-05-01 05:45:44 -0300 | [diff] [blame] | 3939 | |
| 3940 | for (i = 0; i < state->CH_Ctrl_Num ; i++) { |
| 3941 | |
| 3942 | if (controlNum == state->CH_Ctrl[i].Ctrl_Num) { |
| 3943 | |
| 3944 | ctrlVal = 0; |
| 3945 | for (k = 0; k < state->CH_Ctrl[i].size; k++) |
| 3946 | ctrlVal += state->CH_Ctrl[i].val[k] * (1 << k); |
| 3947 | *value = ctrlVal; |
| 3948 | return 0; |
| 3949 | |
Steven Toth | 52c99bd | 2008-05-01 04:57:01 -0300 | [diff] [blame] | 3950 | } |
| 3951 | } |
| 3952 | |
| 3953 | #ifdef _MXL_INTERNAL |
Steven Toth | 3935c25 | 2008-05-01 05:45:44 -0300 | [diff] [blame] | 3954 | for (i = 0; i < state->MXL_Ctrl_Num ; i++) { |
| 3955 | |
| 3956 | if (controlNum == state->MXL_Ctrl[i].Ctrl_Num) { |
| 3957 | |
| 3958 | ctrlVal = 0; |
| 3959 | for (k = 0; k < state->MXL_Ctrl[i].size; k++) |
| 3960 | ctrlVal += state->MXL_Ctrl[i].val[k] * (1<<k); |
| 3961 | *value = ctrlVal; |
| 3962 | return 0; |
| 3963 | |
Steven Toth | 52c99bd | 2008-05-01 04:57:01 -0300 | [diff] [blame] | 3964 | } |
| 3965 | } |
| 3966 | #endif |
Steven Toth | 3935c25 | 2008-05-01 05:45:44 -0300 | [diff] [blame] | 3967 | return 1; |
Steven Toth | 52c99bd | 2008-05-01 04:57:01 -0300 | [diff] [blame] | 3968 | } |
| 3969 | |
| 3970 | /////////////////////////////////////////////////////////////////////////////// |
| 3971 | // // |
| 3972 | // Function: MXL_ControlRegRead // |
| 3973 | // // |
| 3974 | // Description: Retrieve the register addresses and count related to a // |
Steven Toth | a8214d4 | 2008-05-01 05:02:58 -0300 | [diff] [blame] | 3975 | // a specific control name // |
Steven Toth | 52c99bd | 2008-05-01 04:57:01 -0300 | [diff] [blame] | 3976 | // // |
| 3977 | // Globals: // |
| 3978 | // NONE // |
| 3979 | // // |
| 3980 | // Inputs: // |
| 3981 | // Tuner_struct : structure defined at higher level // |
| 3982 | // ControlName : Control Name // |
| 3983 | // // |
| 3984 | // Outputs: // |
| 3985 | // RegNum : returned register address array // |
Steven Toth | a8214d4 | 2008-05-01 05:02:58 -0300 | [diff] [blame] | 3986 | // count : returned register count related to a control // |
Steven Toth | 52c99bd | 2008-05-01 04:57:01 -0300 | [diff] [blame] | 3987 | // // |
| 3988 | // Return: // |
| 3989 | // 0 : Successful read // |
| 3990 | // -1 : Invalid control name // |
| 3991 | // // |
| 3992 | /////////////////////////////////////////////////////////////////////////////// |
Steven Toth | 3935c25 | 2008-05-01 05:45:44 -0300 | [diff] [blame] | 3993 | u16 MXL_ControlRegRead(struct dvb_frontend *fe, u16 controlNum, u8 *RegNum, int * count) |
Steven Toth | 52c99bd | 2008-05-01 04:57:01 -0300 | [diff] [blame] | 3994 | { |
Steven Toth | 85d220d | 2008-05-01 05:48:14 -0300 | [diff] [blame] | 3995 | struct mxl5005s_state *state = fe->tuner_priv; |
Steven Toth | a8214d4 | 2008-05-01 05:02:58 -0300 | [diff] [blame] | 3996 | u16 i, j, k ; |
| 3997 | u16 Count ; |
Steven Toth | 52c99bd | 2008-05-01 04:57:01 -0300 | [diff] [blame] | 3998 | |
Steven Toth | 3935c25 | 2008-05-01 05:45:44 -0300 | [diff] [blame] | 3999 | for (i = 0; i < state->Init_Ctrl_Num ; i++) { |
Steven Toth | 52c99bd | 2008-05-01 04:57:01 -0300 | [diff] [blame] | 4000 | |
Steven Toth | 3935c25 | 2008-05-01 05:45:44 -0300 | [diff] [blame] | 4001 | if ( controlNum == state->Init_Ctrl[i].Ctrl_Num ) { |
| 4002 | |
| 4003 | Count = 1; |
| 4004 | RegNum[0] = (u8)(state->Init_Ctrl[i].addr[0]); |
| 4005 | |
| 4006 | for (k = 1; k < state->Init_Ctrl[i].size; k++) { |
| 4007 | |
| 4008 | for (j = 0; j < Count; j++) { |
| 4009 | |
| 4010 | if (state->Init_Ctrl[i].addr[k] != RegNum[j]) { |
| 4011 | |
| 4012 | Count ++; |
| 4013 | RegNum[Count-1] = (u8)(state->Init_Ctrl[i].addr[k]); |
| 4014 | |
Steven Toth | 52c99bd | 2008-05-01 04:57:01 -0300 | [diff] [blame] | 4015 | } |
| 4016 | } |
| 4017 | |
| 4018 | } |
Steven Toth | 3935c25 | 2008-05-01 05:45:44 -0300 | [diff] [blame] | 4019 | *count = Count; |
| 4020 | return 0; |
Steven Toth | 52c99bd | 2008-05-01 04:57:01 -0300 | [diff] [blame] | 4021 | } |
| 4022 | } |
Steven Toth | 3935c25 | 2008-05-01 05:45:44 -0300 | [diff] [blame] | 4023 | for (i = 0; i < state->CH_Ctrl_Num ; i++) { |
Steven Toth | 52c99bd | 2008-05-01 04:57:01 -0300 | [diff] [blame] | 4024 | |
Steven Toth | 3935c25 | 2008-05-01 05:45:44 -0300 | [diff] [blame] | 4025 | if ( controlNum == state->CH_Ctrl[i].Ctrl_Num ) { |
| 4026 | |
| 4027 | Count = 1; |
| 4028 | RegNum[0] = (u8)(state->CH_Ctrl[i].addr[0]); |
| 4029 | |
| 4030 | for (k = 1; k < state->CH_Ctrl[i].size; k++) { |
| 4031 | |
| 4032 | for (j= 0; j<Count; j++) { |
| 4033 | |
| 4034 | if (state->CH_Ctrl[i].addr[k] != RegNum[j]) { |
| 4035 | |
| 4036 | Count ++; |
| 4037 | RegNum[Count-1] = (u8)(state->CH_Ctrl[i].addr[k]); |
| 4038 | |
Steven Toth | 52c99bd | 2008-05-01 04:57:01 -0300 | [diff] [blame] | 4039 | } |
| 4040 | } |
| 4041 | } |
Steven Toth | 3935c25 | 2008-05-01 05:45:44 -0300 | [diff] [blame] | 4042 | *count = Count; |
| 4043 | return 0; |
Steven Toth | 52c99bd | 2008-05-01 04:57:01 -0300 | [diff] [blame] | 4044 | } |
| 4045 | } |
| 4046 | #ifdef _MXL_INTERNAL |
Steven Toth | 3935c25 | 2008-05-01 05:45:44 -0300 | [diff] [blame] | 4047 | for (i = 0; i < state->MXL_Ctrl_Num ; i++) { |
Steven Toth | 52c99bd | 2008-05-01 04:57:01 -0300 | [diff] [blame] | 4048 | |
Steven Toth | 3935c25 | 2008-05-01 05:45:44 -0300 | [diff] [blame] | 4049 | if ( controlNum == state->MXL_Ctrl[i].Ctrl_Num ) { |
| 4050 | |
| 4051 | Count = 1; |
| 4052 | RegNum[0] = (u8)(state->MXL_Ctrl[i].addr[0]); |
| 4053 | |
| 4054 | for (k = 1; k < state->MXL_Ctrl[i].size; k++) { |
| 4055 | |
| 4056 | for (j = 0; j<Count; j++) { |
| 4057 | |
| 4058 | if (state->MXL_Ctrl[i].addr[k] != RegNum[j]) { |
| 4059 | |
| 4060 | Count ++; |
| 4061 | RegNum[Count-1] = (u8)state->MXL_Ctrl[i].addr[k]; |
| 4062 | |
Steven Toth | 52c99bd | 2008-05-01 04:57:01 -0300 | [diff] [blame] | 4063 | } |
| 4064 | } |
| 4065 | } |
Steven Toth | 3935c25 | 2008-05-01 05:45:44 -0300 | [diff] [blame] | 4066 | *count = Count; |
| 4067 | return 0; |
Steven Toth | 52c99bd | 2008-05-01 04:57:01 -0300 | [diff] [blame] | 4068 | } |
| 4069 | } |
| 4070 | #endif |
Steven Toth | 3935c25 | 2008-05-01 05:45:44 -0300 | [diff] [blame] | 4071 | *count = 0; |
| 4072 | return 1; |
Steven Toth | 52c99bd | 2008-05-01 04:57:01 -0300 | [diff] [blame] | 4073 | } |
| 4074 | |
| 4075 | /////////////////////////////////////////////////////////////////////////////// |
| 4076 | // // |
| 4077 | // Function: MXL_RegWriteBit // |
| 4078 | // // |
| 4079 | // Description: Write a register for specified register address, // |
| 4080 | // register bit and register bit value // |
| 4081 | // // |
| 4082 | // Globals: // |
| 4083 | // NONE // |
| 4084 | // // |
| 4085 | // Inputs: // |
| 4086 | // Tuner_struct : structure defined at higher level // |
| 4087 | // address : register address // |
Steven Toth | 3935c25 | 2008-05-01 05:45:44 -0300 | [diff] [blame] | 4088 | // bit : register bit number // |
Steven Toth | a8214d4 | 2008-05-01 05:02:58 -0300 | [diff] [blame] | 4089 | // bitVal : register bit value // |
Steven Toth | 52c99bd | 2008-05-01 04:57:01 -0300 | [diff] [blame] | 4090 | // // |
| 4091 | // Outputs: // |
| 4092 | // NONE // |
| 4093 | // // |
| 4094 | // Return: // |
| 4095 | // NONE // |
| 4096 | // // |
| 4097 | /////////////////////////////////////////////////////////////////////////////// |
Steven Toth | 3935c25 | 2008-05-01 05:45:44 -0300 | [diff] [blame] | 4098 | void MXL_RegWriteBit(struct dvb_frontend *fe, u8 address, u8 bit, u8 bitVal) |
Steven Toth | 52c99bd | 2008-05-01 04:57:01 -0300 | [diff] [blame] | 4099 | { |
Steven Toth | 85d220d | 2008-05-01 05:48:14 -0300 | [diff] [blame] | 4100 | struct mxl5005s_state *state = fe->tuner_priv; |
Steven Toth | 52c99bd | 2008-05-01 04:57:01 -0300 | [diff] [blame] | 4101 | int i ; |
| 4102 | |
Steven Toth | a8214d4 | 2008-05-01 05:02:58 -0300 | [diff] [blame] | 4103 | const u8 AND_MAP[8] = { |
Steven Toth | 52c99bd | 2008-05-01 04:57:01 -0300 | [diff] [blame] | 4104 | 0xFE, 0xFD, 0xFB, 0xF7, |
| 4105 | 0xEF, 0xDF, 0xBF, 0x7F } ; |
| 4106 | |
Steven Toth | a8214d4 | 2008-05-01 05:02:58 -0300 | [diff] [blame] | 4107 | const u8 OR_MAP[8] = { |
Steven Toth | 52c99bd | 2008-05-01 04:57:01 -0300 | [diff] [blame] | 4108 | 0x01, 0x02, 0x04, 0x08, |
| 4109 | 0x10, 0x20, 0x40, 0x80 } ; |
| 4110 | |
Steven Toth | 3935c25 | 2008-05-01 05:45:44 -0300 | [diff] [blame] | 4111 | for (i = 0; i < state->TunerRegs_Num; i++) { |
| 4112 | if (state->TunerRegs[i].Reg_Num == address) { |
Steven Toth | 52c99bd | 2008-05-01 04:57:01 -0300 | [diff] [blame] | 4113 | if (bitVal) |
Steven Toth | 3935c25 | 2008-05-01 05:45:44 -0300 | [diff] [blame] | 4114 | state->TunerRegs[i].Reg_Val |= OR_MAP[bit]; |
Steven Toth | 52c99bd | 2008-05-01 04:57:01 -0300 | [diff] [blame] | 4115 | else |
Steven Toth | 3935c25 | 2008-05-01 05:45:44 -0300 | [diff] [blame] | 4116 | state->TunerRegs[i].Reg_Val &= AND_MAP[bit]; |
Steven Toth | 52c99bd | 2008-05-01 04:57:01 -0300 | [diff] [blame] | 4117 | break ; |
| 4118 | } |
| 4119 | } |
Steven Toth | 3935c25 | 2008-05-01 05:45:44 -0300 | [diff] [blame] | 4120 | } |
Steven Toth | 52c99bd | 2008-05-01 04:57:01 -0300 | [diff] [blame] | 4121 | |
| 4122 | /////////////////////////////////////////////////////////////////////////////// |
| 4123 | // // |
| 4124 | // Function: MXL_Ceiling // |
| 4125 | // // |
| 4126 | // Description: Complete to closest increment of resolution // |
| 4127 | // // |
| 4128 | // Globals: // |
| 4129 | // NONE // |
| 4130 | // // |
| 4131 | // Functions used: // |
| 4132 | // NONE // |
| 4133 | // // |
| 4134 | // Inputs: // |
| 4135 | // value : Input number to compute // |
| 4136 | // resolution : Increment step // |
| 4137 | // // |
| 4138 | // Outputs: // |
| 4139 | // NONE // |
| 4140 | // // |
| 4141 | // Return: // |
| 4142 | // Computed value // |
| 4143 | // // |
| 4144 | /////////////////////////////////////////////////////////////////////////////// |
Steven Toth | 3935c25 | 2008-05-01 05:45:44 -0300 | [diff] [blame] | 4145 | u32 MXL_Ceiling(u32 value, u32 resolution) |
Steven Toth | 52c99bd | 2008-05-01 04:57:01 -0300 | [diff] [blame] | 4146 | { |
Steven Toth | 3935c25 | 2008-05-01 05:45:44 -0300 | [diff] [blame] | 4147 | return (value/resolution + (value % resolution > 0 ? 1 : 0)); |
| 4148 | } |
Steven Toth | 52c99bd | 2008-05-01 04:57:01 -0300 | [diff] [blame] | 4149 | |
| 4150 | // |
| 4151 | // Retrieve the Initialzation Registers |
| 4152 | // |
Steven Toth | 3935c25 | 2008-05-01 05:45:44 -0300 | [diff] [blame] | 4153 | u16 MXL_GetInitRegister(struct dvb_frontend *fe, u8 * RegNum, u8 *RegVal, int *count) |
Steven Toth | 52c99bd | 2008-05-01 04:57:01 -0300 | [diff] [blame] | 4154 | { |
Steven Toth | a8214d4 | 2008-05-01 05:02:58 -0300 | [diff] [blame] | 4155 | u16 status = 0; |
Steven Toth | 52c99bd | 2008-05-01 04:57:01 -0300 | [diff] [blame] | 4156 | int i ; |
| 4157 | |
Steven Toth | 3935c25 | 2008-05-01 05:45:44 -0300 | [diff] [blame] | 4158 | u8 RegAddr[] = { |
| 4159 | 11, 12, 13, 22, 32, 43, 44, 53, 56, 59, 73, |
| 4160 | 76, 77, 91, 134, 135, 137, 147, |
| 4161 | 156, 166, 167, 168, 25 }; |
Steven Toth | 52c99bd | 2008-05-01 04:57:01 -0300 | [diff] [blame] | 4162 | |
Steven Toth | 3935c25 | 2008-05-01 05:45:44 -0300 | [diff] [blame] | 4163 | *count = sizeof(RegAddr) / sizeof(u8); |
Steven Toth | 52c99bd | 2008-05-01 04:57:01 -0300 | [diff] [blame] | 4164 | |
Steven Toth | 3935c25 | 2008-05-01 05:45:44 -0300 | [diff] [blame] | 4165 | status += MXL_BlockInit(fe); |
| 4166 | |
| 4167 | for (i = 0 ; i < *count; i++) { |
| 4168 | RegNum[i] = RegAddr[i]; |
| 4169 | status += MXL_RegRead(fe, RegNum[i], &RegVal[i]); |
Steven Toth | 52c99bd | 2008-05-01 04:57:01 -0300 | [diff] [blame] | 4170 | } |
| 4171 | |
Steven Toth | 3935c25 | 2008-05-01 05:45:44 -0300 | [diff] [blame] | 4172 | return status; |
Steven Toth | 52c99bd | 2008-05-01 04:57:01 -0300 | [diff] [blame] | 4173 | } |
| 4174 | |
Steven Toth | 3935c25 | 2008-05-01 05:45:44 -0300 | [diff] [blame] | 4175 | u16 MXL_GetCHRegister(struct dvb_frontend *fe, u8 * RegNum, u8 *RegVal, int *count) |
Steven Toth | 52c99bd | 2008-05-01 04:57:01 -0300 | [diff] [blame] | 4176 | { |
Steven Toth | a8214d4 | 2008-05-01 05:02:58 -0300 | [diff] [blame] | 4177 | u16 status = 0; |
Steven Toth | 52c99bd | 2008-05-01 04:57:01 -0300 | [diff] [blame] | 4178 | int i ; |
| 4179 | |
| 4180 | //add 77, 166, 167, 168 register for 2.6.12 |
| 4181 | #ifdef _MXL_PRODUCTION |
Steven Toth | a8214d4 | 2008-05-01 05:02:58 -0300 | [diff] [blame] | 4182 | u8 RegAddr[] = {14, 15, 16, 17, 22, 43, 65, 68, 69, 70, 73, 92, 93, 106, |
| 4183 | 107, 108, 109, 110, 111, 112, 136, 138, 149, 77, 166, 167, 168 } ; |
Steven Toth | 52c99bd | 2008-05-01 04:57:01 -0300 | [diff] [blame] | 4184 | #else |
Steven Toth | a8214d4 | 2008-05-01 05:02:58 -0300 | [diff] [blame] | 4185 | u8 RegAddr[] = {14, 15, 16, 17, 22, 43, 68, 69, 70, 73, 92, 93, 106, |
| 4186 | 107, 108, 109, 110, 111, 112, 136, 138, 149, 77, 166, 167, 168 } ; |
| 4187 | //u8 RegAddr[171]; |
Steven Toth | 52c99bd | 2008-05-01 04:57:01 -0300 | [diff] [blame] | 4188 | //for (i=0; i<=170; i++) |
| 4189 | // RegAddr[i] = i; |
| 4190 | #endif |
| 4191 | |
Steven Toth | 3935c25 | 2008-05-01 05:45:44 -0300 | [diff] [blame] | 4192 | *count = sizeof(RegAddr) / sizeof(u8); |
Steven Toth | 52c99bd | 2008-05-01 04:57:01 -0300 | [diff] [blame] | 4193 | |
Steven Toth | 3935c25 | 2008-05-01 05:45:44 -0300 | [diff] [blame] | 4194 | for (i = 0 ; i < *count; i++) { |
| 4195 | RegNum[i] = RegAddr[i]; |
| 4196 | status += MXL_RegRead(fe, RegNum[i], &RegVal[i]); |
Steven Toth | 52c99bd | 2008-05-01 04:57:01 -0300 | [diff] [blame] | 4197 | } |
| 4198 | |
Steven Toth | 3935c25 | 2008-05-01 05:45:44 -0300 | [diff] [blame] | 4199 | return status; |
Steven Toth | 52c99bd | 2008-05-01 04:57:01 -0300 | [diff] [blame] | 4200 | } |
| 4201 | |
Steven Toth | 3935c25 | 2008-05-01 05:45:44 -0300 | [diff] [blame] | 4202 | u16 MXL_GetCHRegister_ZeroIF(struct dvb_frontend *fe, u8 * RegNum, u8 *RegVal, int *count) |
Steven Toth | 52c99bd | 2008-05-01 04:57:01 -0300 | [diff] [blame] | 4203 | { |
Steven Toth | 3935c25 | 2008-05-01 05:45:44 -0300 | [diff] [blame] | 4204 | u16 status = 0; |
| 4205 | int i; |
Steven Toth | 52c99bd | 2008-05-01 04:57:01 -0300 | [diff] [blame] | 4206 | |
Steven Toth | 3935c25 | 2008-05-01 05:45:44 -0300 | [diff] [blame] | 4207 | u8 RegAddr[] = {43, 136}; |
Steven Toth | 52c99bd | 2008-05-01 04:57:01 -0300 | [diff] [blame] | 4208 | |
Steven Toth | 3935c25 | 2008-05-01 05:45:44 -0300 | [diff] [blame] | 4209 | *count = sizeof(RegAddr) / sizeof(u8); |
Steven Toth | 52c99bd | 2008-05-01 04:57:01 -0300 | [diff] [blame] | 4210 | |
Steven Toth | 3935c25 | 2008-05-01 05:45:44 -0300 | [diff] [blame] | 4211 | for (i = 0; i < *count; i++) { |
| 4212 | RegNum[i] = RegAddr[i]; |
| 4213 | status += MXL_RegRead(fe, RegNum[i], &RegVal[i]); |
Steven Toth | 52c99bd | 2008-05-01 04:57:01 -0300 | [diff] [blame] | 4214 | } |
Steven Toth | 52c99bd | 2008-05-01 04:57:01 -0300 | [diff] [blame] | 4215 | |
Steven Toth | 3935c25 | 2008-05-01 05:45:44 -0300 | [diff] [blame] | 4216 | return status; |
Steven Toth | 52c99bd | 2008-05-01 04:57:01 -0300 | [diff] [blame] | 4217 | } |
| 4218 | |
Steven Toth | 3935c25 | 2008-05-01 05:45:44 -0300 | [diff] [blame] | 4219 | u16 MXL_GetCHRegister_LowIF(struct dvb_frontend *fe, u8 * RegNum, u8 *RegVal, int *count) |
Steven Toth | 52c99bd | 2008-05-01 04:57:01 -0300 | [diff] [blame] | 4220 | { |
Steven Toth | 3935c25 | 2008-05-01 05:45:44 -0300 | [diff] [blame] | 4221 | u16 status = 0; |
| 4222 | int i; |
Steven Toth | 52c99bd | 2008-05-01 04:57:01 -0300 | [diff] [blame] | 4223 | |
Steven Toth | 3935c25 | 2008-05-01 05:45:44 -0300 | [diff] [blame] | 4224 | u8 RegAddr[] = { 138 }; |
Steven Toth | 52c99bd | 2008-05-01 04:57:01 -0300 | [diff] [blame] | 4225 | |
Steven Toth | 3935c25 | 2008-05-01 05:45:44 -0300 | [diff] [blame] | 4226 | *count = sizeof(RegAddr) / sizeof(u8); |
Steven Toth | 52c99bd | 2008-05-01 04:57:01 -0300 | [diff] [blame] | 4227 | |
Steven Toth | 3935c25 | 2008-05-01 05:45:44 -0300 | [diff] [blame] | 4228 | for (i = 0; i < *count; i++) { |
| 4229 | RegNum[i] = RegAddr[i]; |
| 4230 | status += MXL_RegRead(fe, RegNum[i], &RegVal[i]); |
Steven Toth | 52c99bd | 2008-05-01 04:57:01 -0300 | [diff] [blame] | 4231 | } |
Steven Toth | 52c99bd | 2008-05-01 04:57:01 -0300 | [diff] [blame] | 4232 | |
Steven Toth | 3935c25 | 2008-05-01 05:45:44 -0300 | [diff] [blame] | 4233 | return status; |
Steven Toth | 52c99bd | 2008-05-01 04:57:01 -0300 | [diff] [blame] | 4234 | } |
| 4235 | |
Steven Toth | a8214d4 | 2008-05-01 05:02:58 -0300 | [diff] [blame] | 4236 | u16 MXL_GetMasterControl(u8 *MasterReg, int state) |
Steven Toth | 52c99bd | 2008-05-01 04:57:01 -0300 | [diff] [blame] | 4237 | { |
Steven Toth | 3935c25 | 2008-05-01 05:45:44 -0300 | [diff] [blame] | 4238 | if (state == 1) /* Load_Start */ |
| 4239 | *MasterReg = 0xF3; |
| 4240 | if (state == 2) /* Power_Down */ |
| 4241 | *MasterReg = 0x41; |
| 4242 | if (state == 3) /* Synth_Reset */ |
| 4243 | *MasterReg = 0xB1; |
| 4244 | if (state == 4) /* Seq_Off */ |
| 4245 | *MasterReg = 0xF1; |
Steven Toth | 52c99bd | 2008-05-01 04:57:01 -0300 | [diff] [blame] | 4246 | |
Steven Toth | 3935c25 | 2008-05-01 05:45:44 -0300 | [diff] [blame] | 4247 | return 0; |
Steven Toth | 52c99bd | 2008-05-01 04:57:01 -0300 | [diff] [blame] | 4248 | } |
| 4249 | |
| 4250 | #ifdef _MXL_PRODUCTION |
Steven Toth | 3935c25 | 2008-05-01 05:45:44 -0300 | [diff] [blame] | 4251 | u16 MXL_VCORange_Test(struct dvb_frontend *fe, int VCO_Range) |
Steven Toth | 52c99bd | 2008-05-01 04:57:01 -0300 | [diff] [blame] | 4252 | { |
Steven Toth | 85d220d | 2008-05-01 05:48:14 -0300 | [diff] [blame] | 4253 | struct mxl5005s_state *state = fe->tuner_priv; |
Steven Toth | a8214d4 | 2008-05-01 05:02:58 -0300 | [diff] [blame] | 4254 | u16 status = 0 ; |
Steven Toth | 52c99bd | 2008-05-01 04:57:01 -0300 | [diff] [blame] | 4255 | |
Steven Toth | a8214d4 | 2008-05-01 05:02:58 -0300 | [diff] [blame] | 4256 | if (VCO_Range == 1) { |
Steven Toth | 3935c25 | 2008-05-01 05:45:44 -0300 | [diff] [blame] | 4257 | status += MXL_ControlWrite(fe, RFSYN_EN_DIV, 1); |
| 4258 | status += MXL_ControlWrite(fe, RFSYN_EN_OUTMUX, 0); |
| 4259 | status += MXL_ControlWrite(fe, RFSYN_SEL_DIVM, 0); |
| 4260 | status += MXL_ControlWrite(fe, RFSYN_DIVM, 1); |
| 4261 | status += MXL_ControlWrite(fe, RFSYN_SEL_VCO_OUT, 1); |
| 4262 | status += MXL_ControlWrite(fe, RFSYN_RF_DIV_BIAS, 1); |
| 4263 | status += MXL_ControlWrite(fe, DN_SEL_FREQ, 0); |
| 4264 | if (state->Mode == 0 && state->IF_Mode == 1) /* Analog Low IF Mode */ { |
| 4265 | status += MXL_ControlWrite(fe, RFSYN_SEL_VCO_HI, 1); |
| 4266 | status += MXL_ControlWrite(fe, RFSYN_VCO_BIAS, 8); |
| 4267 | status += MXL_ControlWrite(fe, CHCAL_INT_MOD_RF, 56); |
| 4268 | status += MXL_ControlWrite(fe, CHCAL_FRAC_MOD_RF, 180224); |
Steven Toth | a8214d4 | 2008-05-01 05:02:58 -0300 | [diff] [blame] | 4269 | } |
Steven Toth | 3935c25 | 2008-05-01 05:45:44 -0300 | [diff] [blame] | 4270 | if (state->Mode == 0 && state->IF_Mode == 0) /* Analog Zero IF Mode */ { |
| 4271 | status += MXL_ControlWrite(fe, RFSYN_SEL_VCO_HI, 1); |
| 4272 | status += MXL_ControlWrite(fe, RFSYN_VCO_BIAS, 8); |
| 4273 | status += MXL_ControlWrite(fe, CHCAL_INT_MOD_RF, 56); |
| 4274 | status += MXL_ControlWrite(fe, CHCAL_FRAC_MOD_RF, 222822); |
Steven Toth | a8214d4 | 2008-05-01 05:02:58 -0300 | [diff] [blame] | 4275 | } |
Steven Toth | 3935c25 | 2008-05-01 05:45:44 -0300 | [diff] [blame] | 4276 | if (state->Mode == 1) /* Digital Mode */ { |
| 4277 | status += MXL_ControlWrite(fe, RFSYN_SEL_VCO_HI, 1); |
| 4278 | status += MXL_ControlWrite(fe, RFSYN_VCO_BIAS, 8); |
| 4279 | status += MXL_ControlWrite(fe, CHCAL_INT_MOD_RF, 56); |
| 4280 | status += MXL_ControlWrite(fe, CHCAL_FRAC_MOD_RF, 229376); |
Steven Toth | a8214d4 | 2008-05-01 05:02:58 -0300 | [diff] [blame] | 4281 | } |
| 4282 | } |
Steven Toth | 52c99bd | 2008-05-01 04:57:01 -0300 | [diff] [blame] | 4283 | |
Steven Toth | a8214d4 | 2008-05-01 05:02:58 -0300 | [diff] [blame] | 4284 | if (VCO_Range == 2) { |
Steven Toth | 3935c25 | 2008-05-01 05:45:44 -0300 | [diff] [blame] | 4285 | status += MXL_ControlWrite(fe, RFSYN_EN_DIV, 1); |
| 4286 | status += MXL_ControlWrite(fe, RFSYN_EN_OUTMUX, 0); |
| 4287 | status += MXL_ControlWrite(fe, RFSYN_SEL_DIVM, 0); |
| 4288 | status += MXL_ControlWrite(fe, RFSYN_DIVM, 1); |
| 4289 | status += MXL_ControlWrite(fe, RFSYN_SEL_VCO_OUT, 1); |
| 4290 | status += MXL_ControlWrite(fe, RFSYN_RF_DIV_BIAS, 1); |
| 4291 | status += MXL_ControlWrite(fe, DN_SEL_FREQ, 0); |
| 4292 | status += MXL_ControlWrite(fe, RFSYN_SEL_VCO_HI, 1); |
| 4293 | status += MXL_ControlWrite(fe, RFSYN_VCO_BIAS, 40); |
| 4294 | status += MXL_ControlWrite(fe, CHCAL_INT_MOD_RF, 41); |
| 4295 | if (state->Mode == 0 && state->IF_Mode == 1) /* Analog Low IF Mode */ { |
| 4296 | status += MXL_ControlWrite(fe, RFSYN_SEL_VCO_HI, 1); |
| 4297 | status += MXL_ControlWrite(fe, RFSYN_VCO_BIAS, 40); |
| 4298 | status += MXL_ControlWrite(fe, CHCAL_INT_MOD_RF, 42); |
| 4299 | status += MXL_ControlWrite(fe, CHCAL_FRAC_MOD_RF, 206438); |
Steven Toth | a8214d4 | 2008-05-01 05:02:58 -0300 | [diff] [blame] | 4300 | } |
Steven Toth | 3935c25 | 2008-05-01 05:45:44 -0300 | [diff] [blame] | 4301 | if (state->Mode == 0 && state->IF_Mode == 0) /* Analog Zero IF Mode */ { |
| 4302 | status += MXL_ControlWrite(fe, RFSYN_SEL_VCO_HI, 1); |
| 4303 | status += MXL_ControlWrite(fe, RFSYN_VCO_BIAS, 40); |
| 4304 | status += MXL_ControlWrite(fe, CHCAL_INT_MOD_RF, 42); |
| 4305 | status += MXL_ControlWrite(fe, CHCAL_FRAC_MOD_RF, 206438); |
Steven Toth | a8214d4 | 2008-05-01 05:02:58 -0300 | [diff] [blame] | 4306 | } |
Steven Toth | 3935c25 | 2008-05-01 05:45:44 -0300 | [diff] [blame] | 4307 | if (state->Mode == 1) /* Digital Mode */ { |
| 4308 | status += MXL_ControlWrite(fe, RFSYN_SEL_VCO_HI, 1); |
| 4309 | status += MXL_ControlWrite(fe, RFSYN_VCO_BIAS, 40); |
| 4310 | status += MXL_ControlWrite(fe, CHCAL_INT_MOD_RF, 41); |
| 4311 | status += MXL_ControlWrite(fe, CHCAL_FRAC_MOD_RF, 16384); |
Steven Toth | a8214d4 | 2008-05-01 05:02:58 -0300 | [diff] [blame] | 4312 | } |
| 4313 | } |
Steven Toth | 52c99bd | 2008-05-01 04:57:01 -0300 | [diff] [blame] | 4314 | |
Steven Toth | a8214d4 | 2008-05-01 05:02:58 -0300 | [diff] [blame] | 4315 | if (VCO_Range == 3) { |
Steven Toth | 3935c25 | 2008-05-01 05:45:44 -0300 | [diff] [blame] | 4316 | status += MXL_ControlWrite(fe, RFSYN_EN_DIV, 1); |
| 4317 | status += MXL_ControlWrite(fe, RFSYN_EN_OUTMUX, 0); |
| 4318 | status += MXL_ControlWrite(fe, RFSYN_SEL_DIVM, 0); |
| 4319 | status += MXL_ControlWrite(fe, RFSYN_DIVM, 1); |
| 4320 | status += MXL_ControlWrite(fe, RFSYN_SEL_VCO_OUT, 1); |
| 4321 | status += MXL_ControlWrite(fe, RFSYN_RF_DIV_BIAS, 1); |
| 4322 | status += MXL_ControlWrite(fe, DN_SEL_FREQ, 0); |
| 4323 | status += MXL_ControlWrite(fe, RFSYN_SEL_VCO_HI, 0); |
| 4324 | status += MXL_ControlWrite(fe, RFSYN_VCO_BIAS, 8); |
| 4325 | status += MXL_ControlWrite(fe, CHCAL_INT_MOD_RF, 42); |
| 4326 | if (state->Mode == 0 && state->IF_Mode == 1) /* Analog Low IF Mode */ { |
| 4327 | status += MXL_ControlWrite(fe, RFSYN_SEL_VCO_HI, 0); |
| 4328 | status += MXL_ControlWrite(fe, RFSYN_VCO_BIAS, 8); |
| 4329 | status += MXL_ControlWrite(fe, CHCAL_INT_MOD_RF, 44); |
| 4330 | status += MXL_ControlWrite(fe, CHCAL_FRAC_MOD_RF, 173670); |
Steven Toth | a8214d4 | 2008-05-01 05:02:58 -0300 | [diff] [blame] | 4331 | } |
Steven Toth | 3935c25 | 2008-05-01 05:45:44 -0300 | [diff] [blame] | 4332 | if (state->Mode == 0 && state->IF_Mode == 0) /* Analog Zero IF Mode */ { |
| 4333 | status += MXL_ControlWrite(fe, RFSYN_SEL_VCO_HI, 0); |
| 4334 | status += MXL_ControlWrite(fe, RFSYN_VCO_BIAS, 8); |
| 4335 | status += MXL_ControlWrite(fe, CHCAL_INT_MOD_RF, 44); |
| 4336 | status += MXL_ControlWrite(fe, CHCAL_FRAC_MOD_RF, 173670); |
Steven Toth | a8214d4 | 2008-05-01 05:02:58 -0300 | [diff] [blame] | 4337 | } |
Steven Toth | 3935c25 | 2008-05-01 05:45:44 -0300 | [diff] [blame] | 4338 | if (state->Mode == 1) /* Digital Mode */ { |
| 4339 | status += MXL_ControlWrite(fe, RFSYN_SEL_VCO_HI, 0); |
| 4340 | status += MXL_ControlWrite(fe, RFSYN_VCO_BIAS, 8); |
| 4341 | status += MXL_ControlWrite(fe, CHCAL_INT_MOD_RF, 42); |
| 4342 | status += MXL_ControlWrite(fe, CHCAL_FRAC_MOD_RF, 245760); |
Steven Toth | a8214d4 | 2008-05-01 05:02:58 -0300 | [diff] [blame] | 4343 | } |
| 4344 | } |
Steven Toth | 52c99bd | 2008-05-01 04:57:01 -0300 | [diff] [blame] | 4345 | |
Steven Toth | a8214d4 | 2008-05-01 05:02:58 -0300 | [diff] [blame] | 4346 | if (VCO_Range == 4) { |
Steven Toth | 3935c25 | 2008-05-01 05:45:44 -0300 | [diff] [blame] | 4347 | status += MXL_ControlWrite(fe, RFSYN_EN_DIV, 1); |
| 4348 | status += MXL_ControlWrite(fe, RFSYN_EN_OUTMUX, 0); |
| 4349 | status += MXL_ControlWrite(fe, RFSYN_SEL_DIVM, 0); |
| 4350 | status += MXL_ControlWrite(fe, RFSYN_DIVM, 1); |
| 4351 | status += MXL_ControlWrite(fe, RFSYN_SEL_VCO_OUT, 1); |
| 4352 | status += MXL_ControlWrite(fe, RFSYN_RF_DIV_BIAS, 1); |
| 4353 | status += MXL_ControlWrite(fe, DN_SEL_FREQ, 0); |
| 4354 | status += MXL_ControlWrite(fe, RFSYN_SEL_VCO_HI, 0); |
| 4355 | status += MXL_ControlWrite(fe, RFSYN_VCO_BIAS, 40); |
| 4356 | status += MXL_ControlWrite(fe, CHCAL_INT_MOD_RF, 27); |
| 4357 | if (state->Mode == 0 && state->IF_Mode == 1) /* Analog Low IF Mode */ { |
| 4358 | status += MXL_ControlWrite(fe, RFSYN_SEL_VCO_HI, 0); |
| 4359 | status += MXL_ControlWrite(fe, RFSYN_VCO_BIAS, 40); |
| 4360 | status += MXL_ControlWrite(fe, CHCAL_INT_MOD_RF, 27); |
| 4361 | status += MXL_ControlWrite(fe, CHCAL_FRAC_MOD_RF, 206438); |
Steven Toth | a8214d4 | 2008-05-01 05:02:58 -0300 | [diff] [blame] | 4362 | } |
Steven Toth | 3935c25 | 2008-05-01 05:45:44 -0300 | [diff] [blame] | 4363 | if (state->Mode == 0 && state->IF_Mode == 0) /* Analog Zero IF Mode */ { |
| 4364 | status += MXL_ControlWrite(fe, RFSYN_SEL_VCO_HI, 0); |
| 4365 | status += MXL_ControlWrite(fe, RFSYN_VCO_BIAS, 40); |
| 4366 | status += MXL_ControlWrite(fe, CHCAL_INT_MOD_RF, 27); |
| 4367 | status += MXL_ControlWrite(fe, CHCAL_FRAC_MOD_RF, 206438); |
Steven Toth | a8214d4 | 2008-05-01 05:02:58 -0300 | [diff] [blame] | 4368 | } |
Steven Toth | 3935c25 | 2008-05-01 05:45:44 -0300 | [diff] [blame] | 4369 | if (state->Mode == 1) /* Digital Mode */ { |
| 4370 | status += MXL_ControlWrite(fe, RFSYN_SEL_VCO_HI, 0); |
| 4371 | status += MXL_ControlWrite(fe, RFSYN_VCO_BIAS, 40); |
| 4372 | status += MXL_ControlWrite(fe, CHCAL_INT_MOD_RF, 27); |
| 4373 | status += MXL_ControlWrite(fe, CHCAL_FRAC_MOD_RF, 212992); |
Steven Toth | a8214d4 | 2008-05-01 05:02:58 -0300 | [diff] [blame] | 4374 | } |
| 4375 | } |
Steven Toth | 52c99bd | 2008-05-01 04:57:01 -0300 | [diff] [blame] | 4376 | |
Steven Toth | a8214d4 | 2008-05-01 05:02:58 -0300 | [diff] [blame] | 4377 | return status; |
Steven Toth | 52c99bd | 2008-05-01 04:57:01 -0300 | [diff] [blame] | 4378 | } |
| 4379 | |
Steven Toth | 3935c25 | 2008-05-01 05:45:44 -0300 | [diff] [blame] | 4380 | u16 MXL_Hystersis_Test(struct dvb_frontend *fe, int Hystersis) |
Steven Toth | 52c99bd | 2008-05-01 04:57:01 -0300 | [diff] [blame] | 4381 | { |
Steven Toth | 85d220d | 2008-05-01 05:48:14 -0300 | [diff] [blame] | 4382 | struct mxl5005s_state *state = fe->tuner_priv; |
Steven Toth | a8214d4 | 2008-05-01 05:02:58 -0300 | [diff] [blame] | 4383 | u16 status = 0; |
Steven Toth | 52c99bd | 2008-05-01 04:57:01 -0300 | [diff] [blame] | 4384 | |
| 4385 | if (Hystersis == 1) |
Steven Toth | 3935c25 | 2008-05-01 05:45:44 -0300 | [diff] [blame] | 4386 | status += MXL_ControlWrite(fe, DN_BYPASS_AGC_I2C, 1); |
Steven Toth | 52c99bd | 2008-05-01 04:57:01 -0300 | [diff] [blame] | 4387 | |
Steven Toth | a8214d4 | 2008-05-01 05:02:58 -0300 | [diff] [blame] | 4388 | return status; |
Steven Toth | 52c99bd | 2008-05-01 04:57:01 -0300 | [diff] [blame] | 4389 | } |
| 4390 | #endif |
Steven Toth | 7f5c3af | 2008-05-01 06:51:36 -0300 | [diff] [blame^] | 4391 | /* End: Reference driver code found in the Realtek driver that |
| 4392 | * is copyright MaxLinear */ |
Steven Toth | 52c99bd | 2008-05-01 04:57:01 -0300 | [diff] [blame] | 4393 | |
Steven Toth | 7f5c3af | 2008-05-01 06:51:36 -0300 | [diff] [blame^] | 4394 | /* ---------------------------------------------------------------- |
| 4395 | * Begin: Everything after here is new code to adapt the |
| 4396 | * proprietary Realtek driver into a Linux API tuner. |
| 4397 | * Copyright (C) 2008 Steven Toth <stoth@hauppauge.com> |
| 4398 | */ |
| 4399 | static int mxl5005s_reset(struct dvb_frontend *fe) |
| 4400 | { |
| 4401 | struct mxl5005s_state *state = fe->tuner_priv; |
| 4402 | int ret = 0; |
| 4403 | |
| 4404 | u8 buf[2] = { 0xff, 0x00 }; |
| 4405 | struct i2c_msg msg = { .addr = state->config->i2c_address, .flags = 0, |
| 4406 | .buf = buf, .len = 2 }; |
| 4407 | |
| 4408 | dprintk(2, "%s()\n", __func__); |
| 4409 | |
| 4410 | if (fe->ops.i2c_gate_ctrl) |
| 4411 | fe->ops.i2c_gate_ctrl(fe, 1); |
| 4412 | |
| 4413 | if (i2c_transfer(state->i2c, &msg, 1) != 1) { |
| 4414 | printk(KERN_WARNING "mxl5005s I2C reset failed\n"); |
| 4415 | ret = -EREMOTEIO; |
| 4416 | } |
| 4417 | |
| 4418 | if (fe->ops.i2c_gate_ctrl) |
| 4419 | fe->ops.i2c_gate_ctrl(fe, 0); |
| 4420 | |
| 4421 | return ret; |
| 4422 | } |
| 4423 | |
| 4424 | /* Write a single byte to a single reg, latch the value if required by |
| 4425 | * following the transaction with the latch byte. |
| 4426 | */ |
| 4427 | static int mxl5005s_writereg(struct dvb_frontend *fe, u8 reg, u8 val, int latch) |
| 4428 | { |
| 4429 | struct mxl5005s_state *state = fe->tuner_priv; |
| 4430 | u8 buf[3] = { reg, val, MXL5005S_LATCH_BYTE }; |
| 4431 | struct i2c_msg msg = { .addr = state->config->i2c_address, .flags = 0, |
| 4432 | .buf = buf, .len = 3 }; |
| 4433 | |
| 4434 | if (latch == 0) |
| 4435 | msg.len = 2; |
| 4436 | |
| 4437 | dprintk(2, "%s(reg = 0x%x val = 0x%x addr = 0x%x)\n", __func__, reg, val, msg.addr); |
| 4438 | |
| 4439 | if (i2c_transfer(state->i2c, &msg, 1) != 1) { |
| 4440 | printk(KERN_WARNING "mxl5005s I2C write failed\n"); |
| 4441 | return -EREMOTEIO; |
| 4442 | } |
| 4443 | return 0; |
| 4444 | } |
| 4445 | |
| 4446 | int mxl5005s_writeregs(struct dvb_frontend *fe, u8 *addrtable, u8 *datatable, u8 len) |
| 4447 | { |
| 4448 | int ret = 0, i; |
| 4449 | |
| 4450 | if (fe->ops.i2c_gate_ctrl) |
| 4451 | fe->ops.i2c_gate_ctrl(fe, 1); |
| 4452 | |
| 4453 | for (i = 0 ; i < len-1; i++) { |
| 4454 | ret = mxl5005s_writereg(fe, addrtable[i], datatable[i], 0); |
| 4455 | if (ret < 0) |
| 4456 | break; |
| 4457 | } |
| 4458 | |
| 4459 | ret = mxl5005s_writereg(fe, addrtable[i], datatable[i], 1); |
| 4460 | |
| 4461 | if (fe->ops.i2c_gate_ctrl) |
| 4462 | fe->ops.i2c_gate_ctrl(fe, 0); |
| 4463 | |
| 4464 | return ret; |
| 4465 | } |
| 4466 | |
Steven Toth | 85d220d | 2008-05-01 05:48:14 -0300 | [diff] [blame] | 4467 | |
Steven Toth | 8c66a19 | 2008-05-01 06:35:48 -0300 | [diff] [blame] | 4468 | int mxl5005s_init(struct dvb_frontend *fe) |
Steven Toth | 85d220d | 2008-05-01 05:48:14 -0300 | [diff] [blame] | 4469 | { |
Steven Toth | 7f5c3af | 2008-05-01 06:51:36 -0300 | [diff] [blame^] | 4470 | dprintk(1, "%s()\n", __func__); |
| 4471 | return mxl5005s_reconfigure(fe, MXL_QAM, MXL5005S_BANDWIDTH_6MHZ); |
| 4472 | } |
| 4473 | |
| 4474 | int mxl5005s_reconfigure(struct dvb_frontend *fe, u32 mod_type, u32 bandwidth) |
| 4475 | { |
Steven Toth | 8c66a19 | 2008-05-01 06:35:48 -0300 | [diff] [blame] | 4476 | struct mxl5005s_state *state = fe->tuner_priv; |
| 4477 | |
| 4478 | u8 AddrTable[MXL5005S_REG_WRITING_TABLE_LEN_MAX]; |
| 4479 | u8 ByteTable[MXL5005S_REG_WRITING_TABLE_LEN_MAX]; |
| 4480 | int TableLen; |
| 4481 | |
Steven Toth | 7f5c3af | 2008-05-01 06:51:36 -0300 | [diff] [blame^] | 4482 | dprintk(1, "%s(type=%d, bw=%d)\n", __func__, mod_type, bandwidth); |
Steven Toth | 8c66a19 | 2008-05-01 06:35:48 -0300 | [diff] [blame] | 4483 | |
| 4484 | mxl5005s_reset(fe); |
| 4485 | |
| 4486 | /* Tuner initialization stage 0 */ |
| 4487 | MXL_GetMasterControl(ByteTable, MC_SYNTH_RESET); |
| 4488 | AddrTable[0] = MASTER_CONTROL_ADDR; |
| 4489 | ByteTable[0] |= state->config->AgcMasterByte; |
| 4490 | |
Steven Toth | 7f5c3af | 2008-05-01 06:51:36 -0300 | [diff] [blame^] | 4491 | mxl5005s_writeregs(fe, AddrTable, ByteTable, 1); |
Steven Toth | 8c66a19 | 2008-05-01 06:35:48 -0300 | [diff] [blame] | 4492 | |
Steven Toth | 7f5c3af | 2008-05-01 06:51:36 -0300 | [diff] [blame^] | 4493 | mxl5005s_AssignTunerMode(fe, mod_type, bandwidth); |
Steven Toth | 8c66a19 | 2008-05-01 06:35:48 -0300 | [diff] [blame] | 4494 | |
| 4495 | /* Tuner initialization stage 1 */ |
| 4496 | MXL_GetInitRegister(fe, AddrTable, ByteTable, &TableLen); |
| 4497 | |
Steven Toth | 7f5c3af | 2008-05-01 06:51:36 -0300 | [diff] [blame^] | 4498 | mxl5005s_writeregs(fe, AddrTable, ByteTable, TableLen); |
Steven Toth | 8c66a19 | 2008-05-01 06:35:48 -0300 | [diff] [blame] | 4499 | |
| 4500 | return 0; |
| 4501 | } |
| 4502 | |
Steven Toth | 7f5c3af | 2008-05-01 06:51:36 -0300 | [diff] [blame^] | 4503 | int mxl5005s_AssignTunerMode(struct dvb_frontend *fe, u32 mod_type, u32 bandwidth) |
Steven Toth | 8c66a19 | 2008-05-01 06:35:48 -0300 | [diff] [blame] | 4504 | { |
| 4505 | struct mxl5005s_state *state = fe->tuner_priv; |
| 4506 | struct mxl5005s_config *c = state->config; |
| 4507 | |
| 4508 | InitTunerControls(fe); |
Steven Toth | 85d220d | 2008-05-01 05:48:14 -0300 | [diff] [blame] | 4509 | |
| 4510 | /* Set MxL5005S parameters. */ |
Steven Toth | 85d220d | 2008-05-01 05:48:14 -0300 | [diff] [blame] | 4511 | MXL5005_TunerConfig( |
| 4512 | fe, |
Steven Toth | 8c66a19 | 2008-05-01 06:35:48 -0300 | [diff] [blame] | 4513 | c->mod_mode, |
| 4514 | c->if_mode, |
Steven Toth | 7f5c3af | 2008-05-01 06:51:36 -0300 | [diff] [blame^] | 4515 | bandwidth, |
Steven Toth | 8c66a19 | 2008-05-01 06:35:48 -0300 | [diff] [blame] | 4516 | c->if_freq, |
| 4517 | c->xtal_freq, |
| 4518 | c->agc_mode, |
| 4519 | c->top, |
| 4520 | c->output_load, |
| 4521 | c->clock_out, |
| 4522 | c->div_out, |
| 4523 | c->cap_select, |
| 4524 | c->rssi_enable, |
Steven Toth | 7f5c3af | 2008-05-01 06:51:36 -0300 | [diff] [blame^] | 4525 | mod_type, |
Steven Toth | 8c66a19 | 2008-05-01 06:35:48 -0300 | [diff] [blame] | 4526 | c->tracking_filter); |
Steven Toth | 85d220d | 2008-05-01 05:48:14 -0300 | [diff] [blame] | 4527 | |
| 4528 | return 0; |
| 4529 | } |
| 4530 | |
| 4531 | static int mxl5005s_set_params(struct dvb_frontend *fe, |
| 4532 | struct dvb_frontend_parameters *params) |
| 4533 | { |
Steven Toth | 7f5c3af | 2008-05-01 06:51:36 -0300 | [diff] [blame^] | 4534 | struct mxl5005s_state *state = fe->tuner_priv; |
| 4535 | u32 req_mode, req_bw = 0; |
| 4536 | int ret; |
Steven Toth | 85d220d | 2008-05-01 05:48:14 -0300 | [diff] [blame] | 4537 | |
Steven Toth | 7f5c3af | 2008-05-01 06:51:36 -0300 | [diff] [blame^] | 4538 | dprintk(1, "%s()\n", __func__); |
Steven Toth | 85d220d | 2008-05-01 05:48:14 -0300 | [diff] [blame] | 4539 | |
Steven Toth | 7f5c3af | 2008-05-01 06:51:36 -0300 | [diff] [blame^] | 4540 | if (fe->ops.info.type == FE_ATSC) { |
| 4541 | switch (params->u.vsb.modulation) { |
| 4542 | case VSB_8: |
| 4543 | req_mode = MXL_ATSC; break; |
| 4544 | default: |
| 4545 | case QAM_64: |
| 4546 | case QAM_256: |
| 4547 | case QAM_AUTO: |
| 4548 | req_mode = MXL_QAM; break; |
| 4549 | } |
| 4550 | } |
| 4551 | else req_mode = MXL_DVBT; |
Steven Toth | 85d220d | 2008-05-01 05:48:14 -0300 | [diff] [blame] | 4552 | |
Steven Toth | 7f5c3af | 2008-05-01 06:51:36 -0300 | [diff] [blame^] | 4553 | /* Change tuner for new modulation type if reqd */ |
| 4554 | if (req_mode != state->current_mode) { |
| 4555 | switch (req_mode) { |
| 4556 | case VSB_8: |
| 4557 | case QAM_64: |
| 4558 | case QAM_256: |
| 4559 | case QAM_AUTO: |
| 4560 | req_bw = MXL5005S_BANDWIDTH_6MHZ; |
| 4561 | break; |
| 4562 | default: |
| 4563 | /* Assume DVB-T */ |
| 4564 | switch (params->u.ofdm.bandwidth) { |
| 4565 | case BANDWIDTH_6_MHZ: |
| 4566 | req_bw = MXL5005S_BANDWIDTH_6MHZ; |
| 4567 | break; |
| 4568 | case BANDWIDTH_7_MHZ: |
| 4569 | req_bw = MXL5005S_BANDWIDTH_7MHZ; |
| 4570 | break; |
| 4571 | case BANDWIDTH_AUTO: |
| 4572 | case BANDWIDTH_8_MHZ: |
| 4573 | req_bw = MXL5005S_BANDWIDTH_8MHZ; |
| 4574 | break; |
| 4575 | } |
| 4576 | } |
Steven Toth | 8c66a19 | 2008-05-01 06:35:48 -0300 | [diff] [blame] | 4577 | |
Steven Toth | 7f5c3af | 2008-05-01 06:51:36 -0300 | [diff] [blame^] | 4578 | state->current_mode = req_mode; |
| 4579 | ret = mxl5005s_reconfigure(fe, req_mode, req_bw); |
Steven Toth | 8c66a19 | 2008-05-01 06:35:48 -0300 | [diff] [blame] | 4580 | |
Steven Toth | 7f5c3af | 2008-05-01 06:51:36 -0300 | [diff] [blame^] | 4581 | } else |
| 4582 | ret = 0; |
| 4583 | |
| 4584 | if (ret == 0) { |
| 4585 | dprintk(1, "%s() freq=%d\n", __func__, params->frequency); |
| 4586 | ret = mxl5005s_SetRfFreqHz(fe, params->frequency); |
| 4587 | } |
| 4588 | |
| 4589 | return ret; |
Steven Toth | 85d220d | 2008-05-01 05:48:14 -0300 | [diff] [blame] | 4590 | } |
| 4591 | |
| 4592 | static int mxl5005s_get_frequency(struct dvb_frontend *fe, u32 *frequency) |
| 4593 | { |
| 4594 | struct mxl5005s_state *state = fe->tuner_priv; |
| 4595 | dprintk(1, "%s()\n", __func__); |
| 4596 | |
| 4597 | *frequency = state->RF_IN; |
| 4598 | |
| 4599 | return 0; |
| 4600 | } |
| 4601 | |
| 4602 | static int mxl5005s_get_bandwidth(struct dvb_frontend *fe, u32 *bandwidth) |
| 4603 | { |
| 4604 | struct mxl5005s_state *state = fe->tuner_priv; |
| 4605 | dprintk(1, "%s()\n", __func__); |
| 4606 | |
| 4607 | *bandwidth = state->Chan_Bandwidth; |
| 4608 | |
| 4609 | return 0; |
| 4610 | } |
| 4611 | |
Steven Toth | 85d220d | 2008-05-01 05:48:14 -0300 | [diff] [blame] | 4612 | static int mxl5005s_release(struct dvb_frontend *fe) |
| 4613 | { |
| 4614 | dprintk(1, "%s()\n", __func__); |
| 4615 | kfree(fe->tuner_priv); |
| 4616 | fe->tuner_priv = NULL; |
| 4617 | return 0; |
| 4618 | } |
| 4619 | |
| 4620 | static const struct dvb_tuner_ops mxl5005s_tuner_ops = { |
| 4621 | .info = { |
| 4622 | .name = "MaxLinear MXL5005S", |
| 4623 | .frequency_min = 48000000, |
| 4624 | .frequency_max = 860000000, |
| 4625 | .frequency_step = 50000, |
| 4626 | }, |
| 4627 | |
| 4628 | .release = mxl5005s_release, |
| 4629 | .init = mxl5005s_init, |
| 4630 | |
| 4631 | .set_params = mxl5005s_set_params, |
| 4632 | .get_frequency = mxl5005s_get_frequency, |
| 4633 | .get_bandwidth = mxl5005s_get_bandwidth, |
Steven Toth | 85d220d | 2008-05-01 05:48:14 -0300 | [diff] [blame] | 4634 | }; |
| 4635 | |
| 4636 | struct dvb_frontend *mxl5005s_attach(struct dvb_frontend *fe, |
| 4637 | struct i2c_adapter *i2c, |
| 4638 | struct mxl5005s_config *config) |
| 4639 | { |
| 4640 | struct mxl5005s_state *state = NULL; |
| 4641 | dprintk(1, "%s()\n", __func__); |
| 4642 | |
| 4643 | state = kzalloc(sizeof(struct mxl5005s_state), GFP_KERNEL); |
| 4644 | if (state == NULL) |
| 4645 | return NULL; |
| 4646 | |
| 4647 | state->frontend = fe; |
| 4648 | state->config = config; |
| 4649 | state->i2c = i2c; |
Steven Toth | 7f5c3af | 2008-05-01 06:51:36 -0300 | [diff] [blame^] | 4650 | state->current_mode = MXL_QAM; |
Steven Toth | 85d220d | 2008-05-01 05:48:14 -0300 | [diff] [blame] | 4651 | |
| 4652 | printk(KERN_INFO "MXL5005S: Attached at address 0x%02x\n", config->i2c_address); |
| 4653 | |
| 4654 | memcpy(&fe->ops.tuner_ops, &mxl5005s_tuner_ops, sizeof(struct dvb_tuner_ops)); |
| 4655 | |
| 4656 | fe->tuner_priv = state; |
| 4657 | return fe; |
| 4658 | } |
| 4659 | EXPORT_SYMBOL(mxl5005s_attach); |
| 4660 | |
| 4661 | MODULE_DESCRIPTION("MaxLinear MXL5005S silicon tuner driver"); |
Steven Toth | 85d220d | 2008-05-01 05:48:14 -0300 | [diff] [blame] | 4662 | MODULE_AUTHOR("Steven Toth"); |
| 4663 | MODULE_LICENSE("GPL"); |