[media] DiB0090: misc improvements
[linux-2.6/linux-acpi-2.6/ibm-acpi-2.6.git] / drivers / media / dvb / frontends / dib0090.h
blob13d85244ec160048cec20fb9ee6ac16f0a3211ca
1 /*
2 * Linux-DVB Driver for DiBcom's DiB0090 base-band RF Tuner.
4 * Copyright (C) 2005-7 DiBcom (http://www.dibcom.fr/)
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
13 struct dvb_frontend;
14 struct i2c_adapter;
16 #define DEFAULT_DIB0090_I2C_ADDRESS 0x60
18 struct dib0090_io_config {
19 u32 clock_khz;
21 u8 pll_bypass:1;
22 u8 pll_range:1;
23 u8 pll_prediv:6;
24 u8 pll_loopdiv:6;
26 u8 adc_clock_ratio; /* valid is 8, 7 ,6 */
27 u16 pll_int_loop_filt;
30 struct 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;
39 struct dib0090_low_if_offset_table {
40 int std;
41 u32 RF_freq;
42 s32 offset_khz;
45 struct dib0090_config {
46 struct dib0090_io_config io;
47 int (*reset) (struct dvb_frontend *, int);
48 int (*sleep) (struct dvb_frontend *, int);
50 /* offset in kHz */
51 int freq_offset_khz_uhf;
52 int freq_offset_khz_vhf;
54 int (*get_adc_power) (struct dvb_frontend *);
56 u8 clkouttobamse:1; /* activate or deactivate clock output */
57 u8 analog_output;
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;
66 u8 ls_cfg_pad_drv;
67 u8 data_tx_drv;
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;
76 #if defined(CONFIG_DVB_TUNER_DIB0090) || (defined(CONFIG_DVB_TUNER_DIB0090_MODULE) && defined(MODULE))
77 extern struct dvb_frontend *dib0090_register(struct dvb_frontend *fe, struct i2c_adapter *i2c, const struct dib0090_config *config);
78 extern struct dvb_frontend *dib0090_fw_register(struct dvb_frontend *fe, struct i2c_adapter *i2c, const struct dib0090_config *config);
79 extern void dib0090_dcc_freq(struct dvb_frontend *fe, u8 fast);
80 extern void dib0090_pwm_gain_reset(struct dvb_frontend *fe);
81 extern u16 dib0090_get_wbd_offset(struct dvb_frontend *tuner);
82 extern int dib0090_gain_control(struct dvb_frontend *fe);
83 extern enum frontend_tune_state dib0090_get_tune_state(struct dvb_frontend *fe);
84 extern int dib0090_set_tune_state(struct dvb_frontend *fe, enum frontend_tune_state tune_state);
85 extern void dib0090_get_current_gain(struct dvb_frontend *fe, u16 * rf, u16 * bb, u16 * rf_gain_limit, u16 * rflt);
86 #else
87 static inline struct dvb_frontend *dib0090_register(struct dvb_frontend *fe, struct i2c_adapter *i2c, struct dib0090_config *config)
89 printk(KERN_WARNING "%s: driver disabled by Kconfig\n", __func__);
90 return NULL;
93 static inline struct dvb_frontend *dib0090_fw_register(struct dvb_frontend *fe, struct i2c_adapter *i2c, struct dib0090_config *config)
95 printk(KERN_WARNING "%s: driver disabled by Kconfig\n", __func__);
96 return NULL;
99 static inline void dib0090_dcc_freq(struct dvb_frontend *fe, u8 fast)
101 printk(KERN_WARNING "%s: driver disabled by Kconfig\n", __func__);
104 static inline void dib0090_pwm_gain_reset(struct dvb_frontend *fe)
106 printk(KERN_WARNING "%s: driver disabled by Kconfig\n", __func__);
109 static inline u16 dib0090_get_wbd_offset(struct dvb_frontend *tuner)
111 printk(KERN_WARNING "%s: driver disabled by Kconfig\n", __func__);
112 return 0;
115 static inline int dib0090_gain_control(struct dvb_frontend *fe)
117 printk(KERN_WARNING "%s: driver disabled by Kconfig\n", __func__);
118 return -ENODEV;
121 static inline enum frontend_tune_state dib0090_get_tune_state(struct dvb_frontend *fe)
123 printk(KERN_WARNING "%s: driver disabled by Kconfig\n", __func__);
124 return CT_DONE;
127 static inline int dib0090_set_tune_state(struct dvb_frontend *fe, enum frontend_tune_state tune_state)
129 printk(KERN_WARNING "%s: driver disabled by Kconfig\n", __func__);
130 return -ENODEV;
133 static inline void dib0090_get_current_gain(struct dvb_frontend *fe, u16 * rf, u16 * bb, u16 * rf_gain_limit, u16 * rflt)
135 printk(KERN_WARNING "%s: driver disabled by Kconfig\n", __func__);
137 #endif
139 #endif