1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22#ifndef __STV090x_H
23#define __STV090x_H
24
25enum stv090x_demodulator {
26 STV090x_DEMODULATOR_0 = 1,
27 STV090x_DEMODULATOR_1
28};
29
30enum stv090x_device {
31 STV0903 = 0,
32 STV0900,
33};
34
35enum stv090x_mode {
36 STV090x_DUAL = 0,
37 STV090x_SINGLE
38};
39
40enum stv090x_tsmode {
41 STV090x_TSMODE_SERIAL_PUNCTURED = 1,
42 STV090x_TSMODE_SERIAL_CONTINUOUS,
43 STV090x_TSMODE_PARALLEL_PUNCTURED,
44 STV090x_TSMODE_DVBCI
45};
46
47enum stv090x_clkmode {
48 STV090x_CLK_INT = 0,
49 STV090x_CLK_EXT = 2
50};
51
52enum stv090x_i2crpt {
53 STV090x_RPTLEVEL_256 = 0,
54 STV090x_RPTLEVEL_128 = 1,
55 STV090x_RPTLEVEL_64 = 2,
56 STV090x_RPTLEVEL_32 = 3,
57 STV090x_RPTLEVEL_16 = 4,
58 STV090x_RPTLEVEL_8 = 5,
59 STV090x_RPTLEVEL_4 = 6,
60 STV090x_RPTLEVEL_2 = 7,
61};
62
63enum stv090x_adc_range {
64 STV090x_ADC_2Vpp = 0,
65 STV090x_ADC_1Vpp = 1
66};
67
68struct stv090x_config {
69 enum stv090x_device device;
70 enum stv090x_mode demod_mode;
71 enum stv090x_clkmode clk_mode;
72
73 u32 xtal;
74 u8 address;
75
76 u8 ts1_mode;
77 u8 ts2_mode;
78 u32 ts1_clk;
79 u32 ts2_clk;
80
81 u8 ts1_tei : 1;
82 u8 ts2_tei : 1;
83
84 enum stv090x_i2crpt repeater_level;
85
86 u8 tuner_bbgain;
87 enum stv090x_adc_range adc1_range;
88 enum stv090x_adc_range adc2_range;
89
90 bool diseqc_envelope_mode;
91
92 int (*tuner_init) (struct dvb_frontend *fe);
93 int (*tuner_sleep) (struct dvb_frontend *fe);
94 int (*tuner_set_mode) (struct dvb_frontend *fe, enum tuner_mode mode);
95 int (*tuner_set_frequency) (struct dvb_frontend *fe, u32 frequency);
96 int (*tuner_get_frequency) (struct dvb_frontend *fe, u32 *frequency);
97 int (*tuner_set_bandwidth) (struct dvb_frontend *fe, u32 bandwidth);
98 int (*tuner_get_bandwidth) (struct dvb_frontend *fe, u32 *bandwidth);
99 int (*tuner_set_bbgain) (struct dvb_frontend *fe, u32 gain);
100 int (*tuner_get_bbgain) (struct dvb_frontend *fe, u32 *gain);
101 int (*tuner_set_refclk) (struct dvb_frontend *fe, u32 refclk);
102 int (*tuner_get_status) (struct dvb_frontend *fe, u32 *status);
103 void (*tuner_i2c_lock) (struct dvb_frontend *fe, int lock);
104};
105
106#if defined(CONFIG_DVB_STV090x) || (defined(CONFIG_DVB_STV090x_MODULE) && defined(MODULE))
107
108extern struct dvb_frontend *stv090x_attach(const struct stv090x_config *config,
109 struct i2c_adapter *i2c,
110 enum stv090x_demodulator demod);
111
112
113extern int stv090x_set_gpio(struct dvb_frontend *fe, u8 gpio,
114 u8 dir, u8 value, u8 xor_value);
115
116#else
117
118static inline struct dvb_frontend *stv090x_attach(const struct stv090x_config *config,
119 struct i2c_adapter *i2c,
120 enum stv090x_demodulator demod)
121{
122 printk(KERN_WARNING "%s: driver disabled by Kconfig\n", __func__);
123 return NULL;
124}
125
126static inline int stv090x_set_gpio(struct dvb_frontend *fe, u8 gpio,
127 u8 opd, u8 value, u8 xor_value)
128{
129 printk(KERN_WARNING "%s: driver disabled by Kconfig\n", __func__);
130 return -ENODEV;
131}
132#endif
133
134#endif
135