xref: /linux/drivers/media/dvb-frontends/rtl2830.h (revision c4ee0af3fa0dc65f690fc908f02b8355f9576ea0)
1 /*
2  * Realtek RTL2830 DVB-T demodulator driver
3  *
4  * Copyright (C) 2011 Antti Palosaari <crope@iki.fi>
5  *
6  *    This program is free software; you can redistribute it and/or modify
7  *    it under the terms of the GNU General Public License as published by
8  *    the Free Software Foundation; either version 2 of the License, or
9  *    (at your option) any later version.
10  *
11  *    This program is distributed in the hope that it will be useful,
12  *    but WITHOUT ANY WARRANTY; without even the implied warranty of
13  *    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
14  *    GNU General Public License for more details.
15  *
16  *    You should have received a copy of the GNU General Public License along
17  *    with this program; if not, write to the Free Software Foundation, Inc.,
18  *    51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
19  */
20 
21 #ifndef RTL2830_H
22 #define RTL2830_H
23 
24 #include <linux/kconfig.h>
25 #include <linux/dvb/frontend.h>
26 
27 struct rtl2830_config {
28 	/*
29 	 * Demodulator I2C address.
30 	 */
31 	u8 i2c_addr;
32 
33 	/*
34 	 * Xtal frequency.
35 	 * Hz
36 	 * 4000000, 16000000, 25000000, 28800000
37 	 */
38 	u32 xtal;
39 
40 	/*
41 	 * TS output mode.
42 	 */
43 	u8 ts_mode;
44 
45 	/*
46 	 * Spectrum inversion.
47 	 */
48 	bool spec_inv;
49 
50 	/*
51 	 */
52 	u8 vtop;
53 
54 	/*
55 	 */
56 	u8 krf;
57 
58 	/*
59 	 */
60 	u8 agc_targ_val;
61 };
62 
63 #if IS_ENABLED(CONFIG_DVB_RTL2830)
64 extern struct dvb_frontend *rtl2830_attach(
65 	const struct rtl2830_config *config,
66 	struct i2c_adapter *i2c
67 );
68 
69 extern struct i2c_adapter *rtl2830_get_tuner_i2c_adapter(
70 	struct dvb_frontend *fe
71 );
72 #else
73 static inline struct dvb_frontend *rtl2830_attach(
74 	const struct rtl2830_config *config,
75 	struct i2c_adapter *i2c
76 )
77 {
78 	pr_warn("%s: driver disabled by Kconfig\n", __func__);
79 	return NULL;
80 }
81 
82 static inline struct i2c_adapter *rtl2830_get_tuner_i2c_adapter(
83 	struct dvb_frontend *fe
84 )
85 {
86 	return NULL;
87 }
88 #endif
89 
90 #endif /* RTL2830_H */
91