1 /*
2  *    Support for AltoBeam GB20600 (a.k.a DMB-TH) demodulator
3  *    ATBM8830, ATBM8831
4  *
5  *    Copyright (C) 2009 David T.L. Wong <davidtlwong@gmail.com>
6  *
7  *    This program is free software; you can redistribute it and/or modify
8  *    it under the terms of the GNU General Public License as published by
9  *    the Free Software Foundation; either version 2 of the License, or
10  *    (at your option) any later version.
11  *
12  *    This program is distributed in the hope that it will be useful,
13  *    but WITHOUT ANY WARRANTY; without even the implied warranty of
14  *    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
15  *    GNU General Public License for more details.
16  */
17 
18 #ifndef __ATBM8830_H__
19 #define __ATBM8830_H__
20 
21 #include <linux/dvb/frontend.h>
22 #include <linux/i2c.h>
23 
24 #define ATBM8830_PROD_8830 0
25 #define ATBM8830_PROD_8831 1
26 
27 struct atbm8830_config {
28 
29 	/* product type */
30 	u8 prod;
31 
32 	/* the demodulator's i2c address */
33 	u8 demod_address;
34 
35 	/* parallel or serial transport stream */
36 	u8 serial_ts;
37 
38 	/* transport stream clock output only when receiving valid stream */
39 	u8 ts_clk_gated;
40 
41 	/* Decoder sample TS data at rising edge of clock */
42 	u8 ts_sampling_edge;
43 
44 	/* Oscillator clock frequency */
45 	u32 osc_clk_freq; /* in kHz */
46 
47 	/* IF frequency */
48 	u32 if_freq; /* in kHz */
49 
50 	/* Swap I/Q for zero IF */
51 	u8 zif_swap_iq;
52 
53 	/* Tuner AGC settings */
54 	u8 agc_min;
55 	u8 agc_max;
56 	u8 agc_hold_loop;
57 };
58 
59 #if IS_REACHABLE(CONFIG_DVB_ATBM8830)
60 extern struct dvb_frontend *atbm8830_attach(const struct atbm8830_config *config,
61 		struct i2c_adapter *i2c);
62 #else
63 static inline
64 struct dvb_frontend *atbm8830_attach(const struct atbm8830_config *config,
65 		struct i2c_adapter *i2c) {
66 	printk(KERN_WARNING "%s: driver disabled by Kconfig\n", __func__);
67 	return NULL;
68 }
69 #endif /* CONFIG_DVB_ATBM8830 */
70 
71 #endif /* __ATBM8830_H__ */
72