162306a36Sopenharmony_ci/* SPDX-License-Identifier: GPL-2.0-or-later */
262306a36Sopenharmony_ci/*
362306a36Sopenharmony_ci *  Driver for Xceive XC4000 "QAM/8VSB single chip tuner"
462306a36Sopenharmony_ci *
562306a36Sopenharmony_ci *  Copyright (c) 2007 Steven Toth <stoth@linuxtv.org>
662306a36Sopenharmony_ci */
762306a36Sopenharmony_ci
862306a36Sopenharmony_ci#ifndef __XC4000_H__
962306a36Sopenharmony_ci#define __XC4000_H__
1062306a36Sopenharmony_ci
1162306a36Sopenharmony_ci#include <linux/firmware.h>
1262306a36Sopenharmony_ci
1362306a36Sopenharmony_cistruct dvb_frontend;
1462306a36Sopenharmony_cistruct i2c_adapter;
1562306a36Sopenharmony_ci
1662306a36Sopenharmony_cistruct xc4000_config {
1762306a36Sopenharmony_ci	u8	i2c_address;
1862306a36Sopenharmony_ci	/* if non-zero, power management is enabled by default */
1962306a36Sopenharmony_ci	u8	default_pm;
2062306a36Sopenharmony_ci	/* value to be written to XREG_AMPLITUDE in DVB-T mode (0: no write) */
2162306a36Sopenharmony_ci	u8	dvb_amplitude;
2262306a36Sopenharmony_ci	/* if non-zero, register 0x0E is set to filter analog TV video output */
2362306a36Sopenharmony_ci	u8	set_smoothedcvbs;
2462306a36Sopenharmony_ci	/* IF for DVB-T */
2562306a36Sopenharmony_ci	u32	if_khz;
2662306a36Sopenharmony_ci};
2762306a36Sopenharmony_ci
2862306a36Sopenharmony_ci/* xc4000 callback command */
2962306a36Sopenharmony_ci#define XC4000_TUNER_RESET		0
3062306a36Sopenharmony_ci
3162306a36Sopenharmony_ci/* For each bridge framework, when it attaches either analog or digital,
3262306a36Sopenharmony_ci * it has to store a reference back to its _core equivalent structure,
3362306a36Sopenharmony_ci * so that it can service the hardware by steering gpio's etc.
3462306a36Sopenharmony_ci * Each bridge implementation is different so cast devptr accordingly.
3562306a36Sopenharmony_ci * The xc4000 driver cares not for this value, other than ensuring
3662306a36Sopenharmony_ci * it's passed back to a bridge during tuner_callback().
3762306a36Sopenharmony_ci */
3862306a36Sopenharmony_ci
3962306a36Sopenharmony_ci#if IS_REACHABLE(CONFIG_MEDIA_TUNER_XC4000)
4062306a36Sopenharmony_ciextern struct dvb_frontend *xc4000_attach(struct dvb_frontend *fe,
4162306a36Sopenharmony_ci					  struct i2c_adapter *i2c,
4262306a36Sopenharmony_ci					  struct xc4000_config *cfg);
4362306a36Sopenharmony_ci#else
4462306a36Sopenharmony_cistatic inline struct dvb_frontend *xc4000_attach(struct dvb_frontend *fe,
4562306a36Sopenharmony_ci						 struct i2c_adapter *i2c,
4662306a36Sopenharmony_ci						 struct xc4000_config *cfg)
4762306a36Sopenharmony_ci{
4862306a36Sopenharmony_ci	printk(KERN_WARNING "%s: driver disabled by Kconfig\n", __func__);
4962306a36Sopenharmony_ci	return NULL;
5062306a36Sopenharmony_ci}
5162306a36Sopenharmony_ci#endif
5262306a36Sopenharmony_ci
5362306a36Sopenharmony_ci#endif
54