1ccae7af2SMauro Carvalho Chehab /* 2ccae7af2SMauro Carvalho Chehab MaxLinear MXL5005S VSB/QAM/DVBT tuner driver 3ccae7af2SMauro Carvalho Chehab 4ccae7af2SMauro Carvalho Chehab Copyright (C) 2008 MaxLinear 5ccae7af2SMauro Carvalho Chehab Copyright (C) 2008 Steven Toth <stoth@linuxtv.org> 6ccae7af2SMauro Carvalho Chehab 7ccae7af2SMauro Carvalho Chehab This program is free software; you can redistribute it and/or modify 8ccae7af2SMauro Carvalho Chehab it under the terms of the GNU General Public License as published by 9ccae7af2SMauro Carvalho Chehab the Free Software Foundation; either version 2 of the License, or 10ccae7af2SMauro Carvalho Chehab (at your option) any later version. 11ccae7af2SMauro Carvalho Chehab 12ccae7af2SMauro Carvalho Chehab This program is distributed in the hope that it will be useful, 13ccae7af2SMauro Carvalho Chehab but WITHOUT ANY WARRANTY; without even the implied warranty of 14ccae7af2SMauro Carvalho Chehab MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 15ccae7af2SMauro Carvalho Chehab GNU General Public License for more details. 16ccae7af2SMauro Carvalho Chehab 17ccae7af2SMauro Carvalho Chehab You should have received a copy of the GNU General Public License 18ccae7af2SMauro Carvalho Chehab along with this program; if not, write to the Free Software 19ccae7af2SMauro Carvalho Chehab Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. 20ccae7af2SMauro Carvalho Chehab 21ccae7af2SMauro Carvalho Chehab */ 22ccae7af2SMauro Carvalho Chehab 23ccae7af2SMauro Carvalho Chehab #ifndef __MXL5005S_H 24ccae7af2SMauro Carvalho Chehab #define __MXL5005S_H 25ccae7af2SMauro Carvalho Chehab 269dc353c6SMauro Carvalho Chehab #include <linux/kconfig.h> 279dc353c6SMauro Carvalho Chehab 28ccae7af2SMauro Carvalho Chehab #include <linux/i2c.h> 29ccae7af2SMauro Carvalho Chehab #include "dvb_frontend.h" 30ccae7af2SMauro Carvalho Chehab 31ccae7af2SMauro Carvalho Chehab struct mxl5005s_config { 32ccae7af2SMauro Carvalho Chehab 33ccae7af2SMauro Carvalho Chehab /* 7 bit i2c address */ 34ccae7af2SMauro Carvalho Chehab u8 i2c_address; 35ccae7af2SMauro Carvalho Chehab 36ccae7af2SMauro Carvalho Chehab #define IF_FREQ_4570000HZ 4570000 37ccae7af2SMauro Carvalho Chehab #define IF_FREQ_4571429HZ 4571429 38ccae7af2SMauro Carvalho Chehab #define IF_FREQ_5380000HZ 5380000 39ccae7af2SMauro Carvalho Chehab #define IF_FREQ_36000000HZ 36000000 40ccae7af2SMauro Carvalho Chehab #define IF_FREQ_36125000HZ 36125000 41ccae7af2SMauro Carvalho Chehab #define IF_FREQ_36166667HZ 36166667 42ccae7af2SMauro Carvalho Chehab #define IF_FREQ_44000000HZ 44000000 43ccae7af2SMauro Carvalho Chehab u32 if_freq; 44ccae7af2SMauro Carvalho Chehab 45ccae7af2SMauro Carvalho Chehab #define CRYSTAL_FREQ_4000000HZ 4000000 46ccae7af2SMauro Carvalho Chehab #define CRYSTAL_FREQ_16000000HZ 16000000 47ccae7af2SMauro Carvalho Chehab #define CRYSTAL_FREQ_25000000HZ 25000000 48ccae7af2SMauro Carvalho Chehab #define CRYSTAL_FREQ_28800000HZ 28800000 49ccae7af2SMauro Carvalho Chehab u32 xtal_freq; 50ccae7af2SMauro Carvalho Chehab 51ccae7af2SMauro Carvalho Chehab #define MXL_DUAL_AGC 0 52ccae7af2SMauro Carvalho Chehab #define MXL_SINGLE_AGC 1 53ccae7af2SMauro Carvalho Chehab u8 agc_mode; 54ccae7af2SMauro Carvalho Chehab 55ccae7af2SMauro Carvalho Chehab #define MXL_TF_DEFAULT 0 56ccae7af2SMauro Carvalho Chehab #define MXL_TF_OFF 1 57ccae7af2SMauro Carvalho Chehab #define MXL_TF_C 2 58ccae7af2SMauro Carvalho Chehab #define MXL_TF_C_H 3 59ccae7af2SMauro Carvalho Chehab #define MXL_TF_D 4 60ccae7af2SMauro Carvalho Chehab #define MXL_TF_D_L 5 61ccae7af2SMauro Carvalho Chehab #define MXL_TF_E 6 62ccae7af2SMauro Carvalho Chehab #define MXL_TF_F 7 63ccae7af2SMauro Carvalho Chehab #define MXL_TF_E_2 8 64ccae7af2SMauro Carvalho Chehab #define MXL_TF_E_NA 9 65ccae7af2SMauro Carvalho Chehab #define MXL_TF_G 10 66ccae7af2SMauro Carvalho Chehab u8 tracking_filter; 67ccae7af2SMauro Carvalho Chehab 68ccae7af2SMauro Carvalho Chehab #define MXL_RSSI_DISABLE 0 69ccae7af2SMauro Carvalho Chehab #define MXL_RSSI_ENABLE 1 70ccae7af2SMauro Carvalho Chehab u8 rssi_enable; 71ccae7af2SMauro Carvalho Chehab 72ccae7af2SMauro Carvalho Chehab #define MXL_CAP_SEL_DISABLE 0 73ccae7af2SMauro Carvalho Chehab #define MXL_CAP_SEL_ENABLE 1 74ccae7af2SMauro Carvalho Chehab u8 cap_select; 75ccae7af2SMauro Carvalho Chehab 76ccae7af2SMauro Carvalho Chehab #define MXL_DIV_OUT_1 0 77ccae7af2SMauro Carvalho Chehab #define MXL_DIV_OUT_4 1 78ccae7af2SMauro Carvalho Chehab u8 div_out; 79ccae7af2SMauro Carvalho Chehab 80ccae7af2SMauro Carvalho Chehab #define MXL_CLOCK_OUT_DISABLE 0 81ccae7af2SMauro Carvalho Chehab #define MXL_CLOCK_OUT_ENABLE 1 82ccae7af2SMauro Carvalho Chehab u8 clock_out; 83ccae7af2SMauro Carvalho Chehab 84ccae7af2SMauro Carvalho Chehab #define MXL5005S_IF_OUTPUT_LOAD_200_OHM 200 85ccae7af2SMauro Carvalho Chehab #define MXL5005S_IF_OUTPUT_LOAD_300_OHM 300 86ccae7af2SMauro Carvalho Chehab u32 output_load; 87ccae7af2SMauro Carvalho Chehab 88ccae7af2SMauro Carvalho Chehab #define MXL5005S_TOP_5P5 55 89ccae7af2SMauro Carvalho Chehab #define MXL5005S_TOP_7P2 72 90ccae7af2SMauro Carvalho Chehab #define MXL5005S_TOP_9P2 92 91ccae7af2SMauro Carvalho Chehab #define MXL5005S_TOP_11P0 110 92ccae7af2SMauro Carvalho Chehab #define MXL5005S_TOP_12P9 129 93ccae7af2SMauro Carvalho Chehab #define MXL5005S_TOP_14P7 147 94ccae7af2SMauro Carvalho Chehab #define MXL5005S_TOP_16P8 168 95ccae7af2SMauro Carvalho Chehab #define MXL5005S_TOP_19P4 194 96ccae7af2SMauro Carvalho Chehab #define MXL5005S_TOP_21P2 212 97ccae7af2SMauro Carvalho Chehab #define MXL5005S_TOP_23P2 232 98ccae7af2SMauro Carvalho Chehab #define MXL5005S_TOP_25P2 252 99ccae7af2SMauro Carvalho Chehab #define MXL5005S_TOP_27P1 271 100ccae7af2SMauro Carvalho Chehab #define MXL5005S_TOP_29P2 292 101ccae7af2SMauro Carvalho Chehab #define MXL5005S_TOP_31P7 317 102ccae7af2SMauro Carvalho Chehab #define MXL5005S_TOP_34P9 349 103ccae7af2SMauro Carvalho Chehab u32 top; 104ccae7af2SMauro Carvalho Chehab 105ccae7af2SMauro Carvalho Chehab #define MXL_ANALOG_MODE 0 106ccae7af2SMauro Carvalho Chehab #define MXL_DIGITAL_MODE 1 107ccae7af2SMauro Carvalho Chehab u8 mod_mode; 108ccae7af2SMauro Carvalho Chehab 109ccae7af2SMauro Carvalho Chehab #define MXL_ZERO_IF 0 110ccae7af2SMauro Carvalho Chehab #define MXL_LOW_IF 1 111ccae7af2SMauro Carvalho Chehab u8 if_mode; 112ccae7af2SMauro Carvalho Chehab 113ccae7af2SMauro Carvalho Chehab /* Some boards need to override the built-in logic for determining 114ccae7af2SMauro Carvalho Chehab the gain when in QAM mode (the HVR-1600 is one such case) */ 115ccae7af2SMauro Carvalho Chehab u8 qam_gain; 116ccae7af2SMauro Carvalho Chehab 117ccae7af2SMauro Carvalho Chehab /* Stuff I don't know what to do with */ 118ccae7af2SMauro Carvalho Chehab u8 AgcMasterByte; 119ccae7af2SMauro Carvalho Chehab }; 120ccae7af2SMauro Carvalho Chehab 121*9b174527SArnd Bergmann #if IS_REACHABLE(CONFIG_MEDIA_TUNER_MXL5005S) 122ccae7af2SMauro Carvalho Chehab extern struct dvb_frontend *mxl5005s_attach(struct dvb_frontend *fe, 123ccae7af2SMauro Carvalho Chehab struct i2c_adapter *i2c, 124ccae7af2SMauro Carvalho Chehab struct mxl5005s_config *config); 125ccae7af2SMauro Carvalho Chehab #else 126ccae7af2SMauro Carvalho Chehab static inline struct dvb_frontend *mxl5005s_attach(struct dvb_frontend *fe, 127ccae7af2SMauro Carvalho Chehab struct i2c_adapter *i2c, 128ccae7af2SMauro Carvalho Chehab struct mxl5005s_config *config) 129ccae7af2SMauro Carvalho Chehab { 130ccae7af2SMauro Carvalho Chehab printk(KERN_WARNING "%s: driver disabled by Kconfig\n", __func__); 131ccae7af2SMauro Carvalho Chehab return NULL; 132ccae7af2SMauro Carvalho Chehab } 133ccae7af2SMauro Carvalho Chehab #endif /* CONFIG_DVB_TUNER_MXL5005S */ 134ccae7af2SMauro Carvalho Chehab 135ccae7af2SMauro Carvalho Chehab #endif /* __MXL5005S_H */ 136ccae7af2SMauro Carvalho Chehab 137