18c2ecf20Sopenharmony_ci/* SPDX-License-Identifier: GPL-2.0-or-later */
28c2ecf20Sopenharmony_ci/*
38c2ecf20Sopenharmony_ci *  Driver for Xceive XC4000 "QAM/8VSB single chip tuner"
48c2ecf20Sopenharmony_ci *
58c2ecf20Sopenharmony_ci *  Copyright (c) 2007 Steven Toth <stoth@linuxtv.org>
68c2ecf20Sopenharmony_ci */
78c2ecf20Sopenharmony_ci
88c2ecf20Sopenharmony_ci#ifndef __XC4000_H__
98c2ecf20Sopenharmony_ci#define __XC4000_H__
108c2ecf20Sopenharmony_ci
118c2ecf20Sopenharmony_ci#include <linux/firmware.h>
128c2ecf20Sopenharmony_ci
138c2ecf20Sopenharmony_cistruct dvb_frontend;
148c2ecf20Sopenharmony_cistruct i2c_adapter;
158c2ecf20Sopenharmony_ci
168c2ecf20Sopenharmony_cistruct xc4000_config {
178c2ecf20Sopenharmony_ci	u8	i2c_address;
188c2ecf20Sopenharmony_ci	/* if non-zero, power management is enabled by default */
198c2ecf20Sopenharmony_ci	u8	default_pm;
208c2ecf20Sopenharmony_ci	/* value to be written to XREG_AMPLITUDE in DVB-T mode (0: no write) */
218c2ecf20Sopenharmony_ci	u8	dvb_amplitude;
228c2ecf20Sopenharmony_ci	/* if non-zero, register 0x0E is set to filter analog TV video output */
238c2ecf20Sopenharmony_ci	u8	set_smoothedcvbs;
248c2ecf20Sopenharmony_ci	/* IF for DVB-T */
258c2ecf20Sopenharmony_ci	u32	if_khz;
268c2ecf20Sopenharmony_ci};
278c2ecf20Sopenharmony_ci
288c2ecf20Sopenharmony_ci/* xc4000 callback command */
298c2ecf20Sopenharmony_ci#define XC4000_TUNER_RESET		0
308c2ecf20Sopenharmony_ci
318c2ecf20Sopenharmony_ci/* For each bridge framework, when it attaches either analog or digital,
328c2ecf20Sopenharmony_ci * it has to store a reference back to its _core equivalent structure,
338c2ecf20Sopenharmony_ci * so that it can service the hardware by steering gpio's etc.
348c2ecf20Sopenharmony_ci * Each bridge implementation is different so cast devptr accordingly.
358c2ecf20Sopenharmony_ci * The xc4000 driver cares not for this value, other than ensuring
368c2ecf20Sopenharmony_ci * it's passed back to a bridge during tuner_callback().
378c2ecf20Sopenharmony_ci */
388c2ecf20Sopenharmony_ci
398c2ecf20Sopenharmony_ci#if IS_REACHABLE(CONFIG_MEDIA_TUNER_XC4000)
408c2ecf20Sopenharmony_ciextern struct dvb_frontend *xc4000_attach(struct dvb_frontend *fe,
418c2ecf20Sopenharmony_ci					  struct i2c_adapter *i2c,
428c2ecf20Sopenharmony_ci					  struct xc4000_config *cfg);
438c2ecf20Sopenharmony_ci#else
448c2ecf20Sopenharmony_cistatic inline struct dvb_frontend *xc4000_attach(struct dvb_frontend *fe,
458c2ecf20Sopenharmony_ci						 struct i2c_adapter *i2c,
468c2ecf20Sopenharmony_ci						 struct xc4000_config *cfg)
478c2ecf20Sopenharmony_ci{
488c2ecf20Sopenharmony_ci	printk(KERN_WARNING "%s: driver disabled by Kconfig\n", __func__);
498c2ecf20Sopenharmony_ci	return NULL;
508c2ecf20Sopenharmony_ci}
518c2ecf20Sopenharmony_ci#endif
528c2ecf20Sopenharmony_ci
538c2ecf20Sopenharmony_ci#endif
54