xref: /linux/drivers/media/dvb-frontends/mt352.h (revision c532de5a67a70f8533d495f8f2aaa9a0491c3ad0)
1 /* SPDX-License-Identifier: GPL-2.0-or-later */
2 /*
3  *  Driver for Zarlink DVB-T MT352 demodulator
4  *
5  *  Written by Holger Waechtler <holger@qanu.de>
6  *	 and Daniel Mack <daniel@qanu.de>
7  *
8  *  AVerMedia AVerTV DVB-T 771 support by
9  *       Wolfram Joost <dbox2@frokaschwei.de>
10  *
11  *  Support for Samsung TDTC9251DH01C(M) tuner
12  *  Copyright (C) 2004 Antonio Mancuso <antonio.mancuso@digitaltelevision.it>
13  *                     Amauri  Celani  <acelani@essegi.net>
14  *
15  *  DVICO FusionHDTV DVB-T1 and DVICO FusionHDTV DVB-T Lite support by
16  *       Christopher Pascoe <c.pascoe@itee.uq.edu.au>
17  */
18 
19 #ifndef MT352_H
20 #define MT352_H
21 
22 #include <linux/dvb/frontend.h>
23 
24 struct mt352_config
25 {
26 	/* the demodulator's i2c address */
27 	u8 demod_address;
28 
29 	/* frequencies in kHz */
30 	int adc_clock;  // default: 20480
31 	int if2;        // default: 36166
32 
33 	/* set if no pll is connected to the secondary i2c bus */
34 	int no_tuner;
35 
36 	/* Initialise the demodulator and PLL. Cannot be NULL */
37 	int (*demod_init)(struct dvb_frontend* fe);
38 };
39 
40 #if IS_REACHABLE(CONFIG_DVB_MT352)
41 extern struct dvb_frontend* mt352_attach(const struct mt352_config* config,
42 					 struct i2c_adapter* i2c);
43 #else
44 static inline struct dvb_frontend* mt352_attach(const struct mt352_config* config,
45 					 struct i2c_adapter* i2c)
46 {
47 	printk(KERN_WARNING "%s: driver disabled by Kconfig\n", __func__);
48 	return NULL;
49 }
50 #endif // CONFIG_DVB_MT352
51 
52 static inline int mt352_write(struct dvb_frontend *fe, const u8 buf[], int len) {
53 	int r = 0;
54 	if (fe->ops.write)
55 		r = fe->ops.write(fe, buf, len);
56 	return r;
57 }
58 
59 #endif // MT352_H
60