1 /* SPDX-License-Identifier: GPL-2.0-or-later */
2 /*
3  *    Support for Legend Silicon GB20600 (a.k.a DMB-TH) demodulator
4  *    LGS8913, LGS8GL5, LGS8G75
5  *    experimental support LGS8G42, LGS8G52
6  *
7  *    Copyright (C) 2007-2009 David T.L. Wong <davidtlwong@gmail.com>
8  *    Copyright (C) 2008 Sirius International (Hong Kong) Limited
9  *    Timothy Lee <timothy.lee@siriushk.com> (for initial work on LGS8GL5)
10  */
11 
12 #ifndef __LGS8GXX_H__
13 #define __LGS8GXX_H__
14 
15 #include <linux/dvb/frontend.h>
16 #include <linux/i2c.h>
17 
18 #define LGS8GXX_PROD_LGS8913 0
19 #define LGS8GXX_PROD_LGS8GL5 1
20 #define LGS8GXX_PROD_LGS8G42 3
21 #define LGS8GXX_PROD_LGS8G52 4
22 #define LGS8GXX_PROD_LGS8G54 5
23 #define LGS8GXX_PROD_LGS8G75 6
24 
25 struct lgs8gxx_config {
26 
27 	/* product type */
28 	u8 prod;
29 
30 	/* the demodulator's i2c address */
31 	u8 demod_address;
32 
33 	/* parallel or serial transport stream */
34 	u8 serial_ts;
35 
36 	/* transport stream polarity*/
37 	u8 ts_clk_pol;
38 
39 	/* transport stream clock gated by ts_valid */
40 	u8 ts_clk_gated;
41 
42 	/* A/D Clock frequency */
43 	u32 if_clk_freq; /* in kHz */
44 
45 	/* IF frequency */
46 	u32 if_freq; /* in kHz */
47 
48 	/*Use External ADC*/
49 	u8 ext_adc;
50 
51 	/*External ADC output two's complement*/
52 	u8 adc_signed;
53 
54 	/*Sample IF data at falling edge of IF_CLK*/
55 	u8 if_neg_edge;
56 
57 	/*IF use Negative center frequency*/
58 	u8 if_neg_center;
59 
60 	/*8G75 internal ADC input range selection*/
61 	/*0: 0.8Vpp, 1: 1.0Vpp, 2: 1.6Vpp, 3: 2.0Vpp*/
62 	u8 adc_vpp;
63 
64 	/* slave address and configuration of the tuner */
65 	u8 tuner_address;
66 };
67 
68 #if IS_REACHABLE(CONFIG_DVB_LGS8GXX)
69 extern struct dvb_frontend *lgs8gxx_attach(const struct lgs8gxx_config *config,
70 					   struct i2c_adapter *i2c);
71 #else
72 static inline
lgs8gxx_attach(const struct lgs8gxx_config * config,struct i2c_adapter * i2c)73 struct dvb_frontend *lgs8gxx_attach(const struct lgs8gxx_config *config,
74 				    struct i2c_adapter *i2c) {
75 	printk(KERN_WARNING "%s: driver disabled by Kconfig\n", __func__);
76 	return NULL;
77 }
78 #endif /* CONFIG_DVB_LGS8GXX */
79 
80 #endif /* __LGS8GXX_H__ */
81