18c2ecf20Sopenharmony_ci/* SPDX-License-Identifier: GPL-2.0-or-later */
28c2ecf20Sopenharmony_ci/*
38c2ecf20Sopenharmony_ci *  Driver for Zarlink DVB-T MT352 demodulator
48c2ecf20Sopenharmony_ci *
58c2ecf20Sopenharmony_ci *  Written by Holger Waechtler <holger@qanu.de>
68c2ecf20Sopenharmony_ci *	 and Daniel Mack <daniel@qanu.de>
78c2ecf20Sopenharmony_ci *
88c2ecf20Sopenharmony_ci *  AVerMedia AVerTV DVB-T 771 support by
98c2ecf20Sopenharmony_ci *       Wolfram Joost <dbox2@frokaschwei.de>
108c2ecf20Sopenharmony_ci *
118c2ecf20Sopenharmony_ci *  Support for Samsung TDTC9251DH01C(M) tuner
128c2ecf20Sopenharmony_ci *  Copyright (C) 2004 Antonio Mancuso <antonio.mancuso@digitaltelevision.it>
138c2ecf20Sopenharmony_ci *                     Amauri  Celani  <acelani@essegi.net>
148c2ecf20Sopenharmony_ci *
158c2ecf20Sopenharmony_ci *  DVICO FusionHDTV DVB-T1 and DVICO FusionHDTV DVB-T Lite support by
168c2ecf20Sopenharmony_ci *       Christopher Pascoe <c.pascoe@itee.uq.edu.au>
178c2ecf20Sopenharmony_ci */
188c2ecf20Sopenharmony_ci
198c2ecf20Sopenharmony_ci#ifndef MT352_H
208c2ecf20Sopenharmony_ci#define MT352_H
218c2ecf20Sopenharmony_ci
228c2ecf20Sopenharmony_ci#include <linux/dvb/frontend.h>
238c2ecf20Sopenharmony_ci
248c2ecf20Sopenharmony_cistruct mt352_config
258c2ecf20Sopenharmony_ci{
268c2ecf20Sopenharmony_ci	/* the demodulator's i2c address */
278c2ecf20Sopenharmony_ci	u8 demod_address;
288c2ecf20Sopenharmony_ci
298c2ecf20Sopenharmony_ci	/* frequencies in kHz */
308c2ecf20Sopenharmony_ci	int adc_clock;  // default: 20480
318c2ecf20Sopenharmony_ci	int if2;        // default: 36166
328c2ecf20Sopenharmony_ci
338c2ecf20Sopenharmony_ci	/* set if no pll is connected to the secondary i2c bus */
348c2ecf20Sopenharmony_ci	int no_tuner;
358c2ecf20Sopenharmony_ci
368c2ecf20Sopenharmony_ci	/* Initialise the demodulator and PLL. Cannot be NULL */
378c2ecf20Sopenharmony_ci	int (*demod_init)(struct dvb_frontend* fe);
388c2ecf20Sopenharmony_ci};
398c2ecf20Sopenharmony_ci
408c2ecf20Sopenharmony_ci#if IS_REACHABLE(CONFIG_DVB_MT352)
418c2ecf20Sopenharmony_ciextern struct dvb_frontend* mt352_attach(const struct mt352_config* config,
428c2ecf20Sopenharmony_ci					 struct i2c_adapter* i2c);
438c2ecf20Sopenharmony_ci#else
448c2ecf20Sopenharmony_cistatic inline struct dvb_frontend* mt352_attach(const struct mt352_config* config,
458c2ecf20Sopenharmony_ci					 struct i2c_adapter* i2c)
468c2ecf20Sopenharmony_ci{
478c2ecf20Sopenharmony_ci	printk(KERN_WARNING "%s: driver disabled by Kconfig\n", __func__);
488c2ecf20Sopenharmony_ci	return NULL;
498c2ecf20Sopenharmony_ci}
508c2ecf20Sopenharmony_ci#endif // CONFIG_DVB_MT352
518c2ecf20Sopenharmony_ci
528c2ecf20Sopenharmony_cistatic inline int mt352_write(struct dvb_frontend *fe, const u8 buf[], int len) {
538c2ecf20Sopenharmony_ci	int r = 0;
548c2ecf20Sopenharmony_ci	if (fe->ops.write)
558c2ecf20Sopenharmony_ci		r = fe->ops.write(fe, buf, len);
568c2ecf20Sopenharmony_ci	return r;
578c2ecf20Sopenharmony_ci}
588c2ecf20Sopenharmony_ci
598c2ecf20Sopenharmony_ci#endif // MT352_H
60