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