xref: /linux/drivers/media/dvb-frontends/lgdt3306a.h (revision 26fbb4c8c7c3ee9a4c3b4de555a8587b5a19154e)
1 /* SPDX-License-Identifier: GPL-2.0-or-later */
2 /*
3  *    Support for LGDT3306A - 8VSB/QAM-B
4  *
5  *    Copyright (C) 2013,2014 Fred Richter <frichter@hauppauge.com>
6  *      based on lgdt3305.[ch] by Michael Krufky
7  */
8 
9 #ifndef _LGDT3306A_H_
10 #define _LGDT3306A_H_
11 
12 #include <linux/i2c.h>
13 #include <media/dvb_frontend.h>
14 
15 
16 enum lgdt3306a_mpeg_mode {
17 	LGDT3306A_MPEG_PARALLEL = 0,
18 	LGDT3306A_MPEG_SERIAL = 1,
19 };
20 
21 enum lgdt3306a_tp_clock_edge {
22 	LGDT3306A_TPCLK_RISING_EDGE = 0,
23 	LGDT3306A_TPCLK_FALLING_EDGE = 1,
24 };
25 
26 enum lgdt3306a_tp_valid_polarity {
27 	LGDT3306A_TP_VALID_LOW = 0,
28 	LGDT3306A_TP_VALID_HIGH = 1,
29 };
30 
31 struct lgdt3306a_config {
32 	u8 i2c_addr;
33 
34 	/* user defined IF frequency in KHz */
35 	u16 qam_if_khz;
36 	u16 vsb_if_khz;
37 
38 	/* disable i2c repeater - 0:repeater enabled 1:repeater disabled */
39 	unsigned int deny_i2c_rptr:1;
40 
41 	/* spectral inversion - 0:disabled 1:enabled */
42 	unsigned int spectral_inversion:1;
43 
44 	enum lgdt3306a_mpeg_mode mpeg_mode;
45 	enum lgdt3306a_tp_clock_edge tpclk_edge;
46 	enum lgdt3306a_tp_valid_polarity tpvalid_polarity;
47 
48 	/* demod clock freq in MHz; 24 or 25 supported */
49 	int  xtalMHz;
50 
51 	/* returned by driver if using i2c bus multiplexing */
52 	struct dvb_frontend **fe;
53 	struct i2c_adapter **i2c_adapter;
54 };
55 
56 #if IS_REACHABLE(CONFIG_DVB_LGDT3306A)
57 struct dvb_frontend *lgdt3306a_attach(const struct lgdt3306a_config *config,
58 				      struct i2c_adapter *i2c_adap);
59 #else
60 static inline
61 struct dvb_frontend *lgdt3306a_attach(const struct lgdt3306a_config *config,
62 				      struct i2c_adapter *i2c_adap)
63 {
64 	printk(KERN_WARNING "%s: driver disabled by Kconfig\n", __func__);
65 	return NULL;
66 }
67 #endif /* CONFIG_DVB_LGDT3306A */
68 
69 #endif /* _LGDT3306A_H_ */
70