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