blob: ad74bc823f08c469fd517dc9bb7f857be88bf589 [file] [log] [blame]
Olivier Grenie03245a52009-12-04 13:27:57 -03001/*
2 * Linux-DVB Driver for DiBcom's DiB0090 base-band RF Tuner.
3 *
4 * Copyright (C) 2005-7 DiBcom (http://www.dibcom.fr/)
5 *
6 * This program is free software; you can redistribute it and/or
7 * modify it under the terms of the GNU General Public License as
8 * published by the Free Software Foundation, version 2.
9 */
10#ifndef DIB0090_H
11#define DIB0090_H
12
13struct dvb_frontend;
14struct i2c_adapter;
15
16#define DEFAULT_DIB0090_I2C_ADDRESS 0x60
17
18struct dib0090_io_config {
19 u32 clock_khz;
20
21 u8 pll_bypass:1;
22 u8 pll_range:1;
23 u8 pll_prediv:6;
24 u8 pll_loopdiv:6;
25
26 u8 adc_clock_ratio; /* valid is 8, 7 ,6 */
Olivier Grenie9c783032009-12-07 07:49:40 -030027 u16 pll_int_loop_filt;
Olivier Grenie03245a52009-12-04 13:27:57 -030028};
29
Olivier Grenie28fafca2011-01-04 04:27:11 -030030struct dib0090_wbd_slope {
31 u16 max_freq; /* for every frequency less than or equal to that field: this information is correct */
32 u16 slope_cold;
33 u16 offset_cold;
34 u16 slope_hot;
35 u16 offset_hot;
36 u8 wbd_gain;
37};
38
39struct dib0090_low_if_offset_table {
40 int std;
41 u32 RF_freq;
42 s32 offset_khz;
43};
44
Olivier Grenie03245a52009-12-04 13:27:57 -030045struct dib0090_config {
46 struct dib0090_io_config io;
47 int (*reset) (struct dvb_frontend *, int);
48 int (*sleep) (struct dvb_frontend *, int);
49
50 /* offset in kHz */
51 int freq_offset_khz_uhf;
52 int freq_offset_khz_vhf;
53
54 int (*get_adc_power) (struct dvb_frontend *);
55
56 u8 clkouttobamse:1; /* activate or deactivate clock output */
57 u8 analog_output;
58
59 u8 i2c_address;
60 /* add drives and other things if necessary */
61 u16 wbd_vhf_offset;
62 u16 wbd_cband_offset;
63 u8 use_pwm_agc;
64 u8 clkoutdrive;
Olivier Grenie28fafca2011-01-04 04:27:11 -030065
66 u8 ls_cfg_pad_drv;
67 u8 data_tx_drv;
68
69 u8 in_soc;
70 const struct dib0090_low_if_offset_table *low_if;
71 u8 fref_clock_ratio;
72 u16 force_cband_input;
73 struct dib0090_wbd_slope *wbd;
Olivier Grenie2e802862011-08-05 10:39:15 -030074 u8 is_dib7090e;
75 u8 force_crystal_mode;
Olivier Grenie03245a52009-12-04 13:27:57 -030076};
77
Arnd Bergmann9b174522015-02-18 14:12:42 -030078#if IS_REACHABLE(CONFIG_DVB_TUNER_DIB0090)
Olivier Grenie03245a52009-12-04 13:27:57 -030079extern struct dvb_frontend *dib0090_register(struct dvb_frontend *fe, struct i2c_adapter *i2c, const struct dib0090_config *config);
Olivier Grenie28fafca2011-01-04 04:27:11 -030080extern struct dvb_frontend *dib0090_fw_register(struct dvb_frontend *fe, struct i2c_adapter *i2c, const struct dib0090_config *config);
Olivier Grenie03245a52009-12-04 13:27:57 -030081extern void dib0090_dcc_freq(struct dvb_frontend *fe, u8 fast);
82extern void dib0090_pwm_gain_reset(struct dvb_frontend *fe);
Olivier Grenie6724a2f2011-08-05 13:49:33 -030083extern u16 dib0090_get_wbd_target(struct dvb_frontend *tuner);
84extern u16 dib0090_get_wbd_offset(struct dvb_frontend *fe);
Olivier Grenie03245a52009-12-04 13:27:57 -030085extern int dib0090_gain_control(struct dvb_frontend *fe);
86extern enum frontend_tune_state dib0090_get_tune_state(struct dvb_frontend *fe);
87extern int dib0090_set_tune_state(struct dvb_frontend *fe, enum frontend_tune_state tune_state);
Olivier Grenie03245a52009-12-04 13:27:57 -030088extern void dib0090_get_current_gain(struct dvb_frontend *fe, u16 * rf, u16 * bb, u16 * rf_gain_limit, u16 * rflt);
Olivier Grenie2e802862011-08-05 10:39:15 -030089extern void dib0090_set_dc_servo(struct dvb_frontend *fe, u8 DC_servo_cutoff);
Olivier Grenie6724a2f2011-08-05 13:49:33 -030090extern int dib0090_set_switch(struct dvb_frontend *fe, u8 sw1, u8 sw2, u8 sw3);
91extern int dib0090_set_vga(struct dvb_frontend *fe, u8 onoff);
92extern int dib0090_update_rframp_7090(struct dvb_frontend *fe,
93 u8 cfg_sensitivity);
94extern int dib0090_update_tuning_table_7090(struct dvb_frontend *fe,
95 u8 cfg_sensitivity);
Olivier Grenie03245a52009-12-04 13:27:57 -030096#else
Olivier Grenie6724a2f2011-08-05 13:49:33 -030097static inline struct dvb_frontend *dib0090_register(struct dvb_frontend *fe, struct i2c_adapter *i2c, const struct dib0090_config *config)
Olivier Grenie03245a52009-12-04 13:27:57 -030098{
99 printk(KERN_WARNING "%s: driver disabled by Kconfig\n", __func__);
100 return NULL;
101}
102
Olivier Grenie28fafca2011-01-04 04:27:11 -0300103static inline struct dvb_frontend *dib0090_fw_register(struct dvb_frontend *fe, struct i2c_adapter *i2c, struct dib0090_config *config)
104{
105 printk(KERN_WARNING "%s: driver disabled by Kconfig\n", __func__);
106 return NULL;
107}
108
Olivier Grenie03245a52009-12-04 13:27:57 -0300109static inline void dib0090_dcc_freq(struct dvb_frontend *fe, u8 fast)
110{
111 printk(KERN_WARNING "%s: driver disabled by Kconfig\n", __func__);
112}
113
114static inline void dib0090_pwm_gain_reset(struct dvb_frontend *fe)
115{
116 printk(KERN_WARNING "%s: driver disabled by Kconfig\n", __func__);
117}
118
Olivier Grenie6724a2f2011-08-05 13:49:33 -0300119static inline u16 dib0090_get_wbd_target(struct dvb_frontend *tuner)
120{
121 printk(KERN_WARNING "%s: driver disabled by Kconfig\n", __func__);
122 return 0;
123}
124
125static inline u16 dib0090_get_wbd_offset(struct dvb_frontend *fe)
Olivier Grenie03245a52009-12-04 13:27:57 -0300126{
127 printk(KERN_WARNING "%s: driver disabled by Kconfig\n", __func__);
128 return 0;
129}
130
131static inline int dib0090_gain_control(struct dvb_frontend *fe)
132{
133 printk(KERN_WARNING "%s: driver disabled by Kconfig\n", __func__);
134 return -ENODEV;
135}
136
137static inline enum frontend_tune_state dib0090_get_tune_state(struct dvb_frontend *fe)
138{
139 printk(KERN_WARNING "%s: driver disabled by Kconfig\n", __func__);
140 return CT_DONE;
141}
142
143static inline int dib0090_set_tune_state(struct dvb_frontend *fe, enum frontend_tune_state tune_state)
144{
145 printk(KERN_WARNING "%s: driver disabled by Kconfig\n", __func__);
146 return -ENODEV;
147}
148
Olivier Grenie03245a52009-12-04 13:27:57 -0300149static inline void dib0090_get_current_gain(struct dvb_frontend *fe, u16 * rf, u16 * bb, u16 * rf_gain_limit, u16 * rflt)
150{
151 printk(KERN_WARNING "%s: driver disabled by Kconfig\n", __func__);
152}
Olivier Grenie2e802862011-08-05 10:39:15 -0300153
154static inline void dib0090_set_dc_servo(struct dvb_frontend *fe, u8 DC_servo_cutoff)
155{
156 printk(KERN_WARNING "%s: driver disabled by Kconfig\n", __func__);
157}
Olivier Grenie6724a2f2011-08-05 13:49:33 -0300158
159static inline int dib0090_set_switch(struct dvb_frontend *fe,
160 u8 sw1, u8 sw2, u8 sw3)
161{
162 printk(KERN_WARNING "%s: driver disabled by Kconfig\n", __func__);
163 return -ENODEV;
164}
165
166static inline int dib0090_set_vga(struct dvb_frontend *fe, u8 onoff)
167{
168 printk(KERN_WARNING "%s: driver disabled by Kconfig\n", __func__);
169 return -ENODEV;
170}
171
172static inline int dib0090_update_rframp_7090(struct dvb_frontend *fe,
173 u8 cfg_sensitivity)
174{
175 printk(KERN_WARNING "%s: driver disabled by Kconfig\n", __func__);
176 return -ENODEV;
177}
178
179static inline int dib0090_update_tuning_table_7090(struct dvb_frontend *fe,
180 u8 cfg_sensitivity)
181{
182 printk(KERN_WARNING "%s: driver disabled by Kconfig\n", __func__);
183 return -ENODEV;
184}
Olivier Grenie03245a52009-12-04 13:27:57 -0300185#endif
186
187#endif