Back to home page

OSCL-LXR

 
 

    


0001 /* SPDX-License-Identifier: GPL-2.0-only */
0002 /*
0003  * Linux-DVB Driver for DiBcom's DiB0090 base-band RF Tuner.
0004  *
0005  * Copyright (C) 2005-7 DiBcom (http://www.dibcom.fr/)
0006  */
0007 #ifndef DIB0090_H
0008 #define DIB0090_H
0009 
0010 struct dvb_frontend;
0011 struct i2c_adapter;
0012 
0013 #define DEFAULT_DIB0090_I2C_ADDRESS 0x60
0014 
0015 struct dib0090_io_config {
0016     u32 clock_khz;
0017 
0018     u8 pll_bypass:1;
0019     u8 pll_range:1;
0020     u8 pll_prediv:6;
0021     u8 pll_loopdiv:6;
0022 
0023     u8 adc_clock_ratio; /* valid is 8, 7 ,6 */
0024     u16 pll_int_loop_filt;
0025 };
0026 
0027 struct dib0090_wbd_slope {
0028     u16 max_freq;       /* for every frequency less than or equal to that field: this information is correct */
0029     u16 slope_cold;
0030     u16 offset_cold;
0031     u16 slope_hot;
0032     u16 offset_hot;
0033     u8 wbd_gain;
0034 };
0035 
0036 struct dib0090_low_if_offset_table {
0037     int std;
0038     u32 RF_freq;
0039     s32 offset_khz;
0040 };
0041 
0042 struct dib0090_config {
0043     struct dib0090_io_config io;
0044     int (*reset) (struct dvb_frontend *, int);
0045     int (*sleep) (struct dvb_frontend *, int);
0046 
0047     /*  offset in kHz */
0048     int freq_offset_khz_uhf;
0049     int freq_offset_khz_vhf;
0050 
0051     int (*get_adc_power) (struct dvb_frontend *);
0052 
0053     u8 clkouttobamse:1; /* activate or deactivate clock output */
0054     u8 analog_output;
0055 
0056     u8 i2c_address;
0057     /* add drives and other things if necessary */
0058     u16 wbd_vhf_offset;
0059     u16 wbd_cband_offset;
0060     u8 use_pwm_agc;
0061     u8 clkoutdrive;
0062 
0063     u8 ls_cfg_pad_drv;
0064     u8 data_tx_drv;
0065 
0066     u8 in_soc;
0067     const struct dib0090_low_if_offset_table *low_if;
0068     u8 fref_clock_ratio;
0069     u16 force_cband_input;
0070     struct dib0090_wbd_slope *wbd;
0071     u8 is_dib7090e;
0072     u8 force_crystal_mode;
0073 };
0074 
0075 #if IS_REACHABLE(CONFIG_DVB_TUNER_DIB0090)
0076 extern struct dvb_frontend *dib0090_register(struct dvb_frontend *fe, struct i2c_adapter *i2c, const struct dib0090_config *config);
0077 extern struct dvb_frontend *dib0090_fw_register(struct dvb_frontend *fe, struct i2c_adapter *i2c, const struct dib0090_config *config);
0078 extern void dib0090_dcc_freq(struct dvb_frontend *fe, u8 fast);
0079 extern void dib0090_pwm_gain_reset(struct dvb_frontend *fe);
0080 extern u16 dib0090_get_wbd_target(struct dvb_frontend *tuner);
0081 extern u16 dib0090_get_wbd_offset(struct dvb_frontend *fe);
0082 extern int dib0090_gain_control(struct dvb_frontend *fe);
0083 extern enum frontend_tune_state dib0090_get_tune_state(struct dvb_frontend *fe);
0084 extern int dib0090_set_tune_state(struct dvb_frontend *fe, enum frontend_tune_state tune_state);
0085 extern void dib0090_get_current_gain(struct dvb_frontend *fe, u16 * rf, u16 * bb, u16 * rf_gain_limit, u16 * rflt);
0086 extern void dib0090_set_dc_servo(struct dvb_frontend *fe, u8 DC_servo_cutoff);
0087 extern int dib0090_set_switch(struct dvb_frontend *fe, u8 sw1, u8 sw2, u8 sw3);
0088 extern int dib0090_set_vga(struct dvb_frontend *fe, u8 onoff);
0089 extern int dib0090_update_rframp_7090(struct dvb_frontend *fe,
0090         u8 cfg_sensitivity);
0091 extern int dib0090_update_tuning_table_7090(struct dvb_frontend *fe,
0092         u8 cfg_sensitivity);
0093 #else
0094 static inline struct dvb_frontend *dib0090_register(struct dvb_frontend *fe, struct i2c_adapter *i2c, const struct dib0090_config *config)
0095 {
0096     printk(KERN_WARNING "%s: driver disabled by Kconfig\n", __func__);
0097     return NULL;
0098 }
0099 
0100 static inline struct dvb_frontend *dib0090_fw_register(struct dvb_frontend *fe, struct i2c_adapter *i2c, struct dib0090_config *config)
0101 {
0102     printk(KERN_WARNING "%s: driver disabled by Kconfig\n", __func__);
0103     return NULL;
0104 }
0105 
0106 static inline void dib0090_dcc_freq(struct dvb_frontend *fe, u8 fast)
0107 {
0108     printk(KERN_WARNING "%s: driver disabled by Kconfig\n", __func__);
0109 }
0110 
0111 static inline void dib0090_pwm_gain_reset(struct dvb_frontend *fe)
0112 {
0113     printk(KERN_WARNING "%s: driver disabled by Kconfig\n", __func__);
0114 }
0115 
0116 static inline u16 dib0090_get_wbd_target(struct dvb_frontend *tuner)
0117 {
0118     printk(KERN_WARNING "%s: driver disabled by Kconfig\n", __func__);
0119     return 0;
0120 }
0121 
0122 static inline u16 dib0090_get_wbd_offset(struct dvb_frontend *fe)
0123 {
0124     printk(KERN_WARNING "%s: driver disabled by Kconfig\n", __func__);
0125     return 0;
0126 }
0127 
0128 static inline int dib0090_gain_control(struct dvb_frontend *fe)
0129 {
0130     printk(KERN_WARNING "%s: driver disabled by Kconfig\n", __func__);
0131     return -ENODEV;
0132 }
0133 
0134 static inline enum frontend_tune_state dib0090_get_tune_state(struct dvb_frontend *fe)
0135 {
0136     printk(KERN_WARNING "%s: driver disabled by Kconfig\n", __func__);
0137     return CT_DONE;
0138 }
0139 
0140 static inline int dib0090_set_tune_state(struct dvb_frontend *fe, enum frontend_tune_state tune_state)
0141 {
0142     printk(KERN_WARNING "%s: driver disabled by Kconfig\n", __func__);
0143     return -ENODEV;
0144 }
0145 
0146 static inline void dib0090_get_current_gain(struct dvb_frontend *fe, u16 * rf, u16 * bb, u16 * rf_gain_limit, u16 * rflt)
0147 {
0148     printk(KERN_WARNING "%s: driver disabled by Kconfig\n", __func__);
0149 }
0150 
0151 static inline void dib0090_set_dc_servo(struct dvb_frontend *fe, u8 DC_servo_cutoff)
0152 {
0153     printk(KERN_WARNING "%s: driver disabled by Kconfig\n", __func__);
0154 }
0155 
0156 static inline int dib0090_set_switch(struct dvb_frontend *fe,
0157         u8 sw1, u8 sw2, u8 sw3)
0158 {
0159     printk(KERN_WARNING "%s: driver disabled by Kconfig\n", __func__);
0160     return -ENODEV;
0161 }
0162 
0163 static inline int dib0090_set_vga(struct dvb_frontend *fe, u8 onoff)
0164 {
0165     printk(KERN_WARNING "%s: driver disabled by Kconfig\n", __func__);
0166     return -ENODEV;
0167 }
0168 
0169 static inline int dib0090_update_rframp_7090(struct dvb_frontend *fe,
0170         u8 cfg_sensitivity)
0171 {
0172     printk(KERN_WARNING "%s: driver disabled by Kconfig\n", __func__);
0173     return -ENODEV;
0174 }
0175 
0176 static inline int dib0090_update_tuning_table_7090(struct dvb_frontend *fe,
0177         u8 cfg_sensitivity)
0178 {
0179     printk(KERN_WARNING "%s: driver disabled by Kconfig\n", __func__);
0180     return -ENODEV;
0181 }
0182 #endif
0183 
0184 #endif