18c2ecf20Sopenharmony_ci/* SPDX-License-Identifier: GPL-2.0-or-later */
28c2ecf20Sopenharmony_ci/*
38c2ecf20Sopenharmony_ci *  Driver for Xceive XC5000 "QAM/8VSB single chip tuner"
48c2ecf20Sopenharmony_ci *
58c2ecf20Sopenharmony_ci *  Copyright (c) 2007 Steven Toth <stoth@linuxtv.org>
68c2ecf20Sopenharmony_ci */
78c2ecf20Sopenharmony_ci
88c2ecf20Sopenharmony_ci#ifndef __XC5000_H__
98c2ecf20Sopenharmony_ci#define __XC5000_H__
108c2ecf20Sopenharmony_ci
118c2ecf20Sopenharmony_ci#include <linux/firmware.h>
128c2ecf20Sopenharmony_ci
138c2ecf20Sopenharmony_cistruct dvb_frontend;
148c2ecf20Sopenharmony_cistruct i2c_adapter;
158c2ecf20Sopenharmony_ci
168c2ecf20Sopenharmony_ci#define XC5000A 1
178c2ecf20Sopenharmony_ci#define XC5000C 2
188c2ecf20Sopenharmony_ci
198c2ecf20Sopenharmony_cistruct xc5000_config {
208c2ecf20Sopenharmony_ci	u8   i2c_address;
218c2ecf20Sopenharmony_ci	u32  if_khz;
228c2ecf20Sopenharmony_ci	u8   radio_input;
238c2ecf20Sopenharmony_ci	u16  xtal_khz;
248c2ecf20Sopenharmony_ci	u16  output_amp;
258c2ecf20Sopenharmony_ci
268c2ecf20Sopenharmony_ci	int chip_id;
278c2ecf20Sopenharmony_ci};
288c2ecf20Sopenharmony_ci
298c2ecf20Sopenharmony_ci/* xc5000 callback command */
308c2ecf20Sopenharmony_ci#define XC5000_TUNER_RESET		0
318c2ecf20Sopenharmony_ci
328c2ecf20Sopenharmony_ci/* Possible Radio inputs */
338c2ecf20Sopenharmony_ci#define XC5000_RADIO_NOT_CONFIGURED		0
348c2ecf20Sopenharmony_ci#define XC5000_RADIO_FM1			1
358c2ecf20Sopenharmony_ci#define XC5000_RADIO_FM2			2
368c2ecf20Sopenharmony_ci#define XC5000_RADIO_FM1_MONO			3
378c2ecf20Sopenharmony_ci
388c2ecf20Sopenharmony_ci/* For each bridge framework, when it attaches either analog or digital,
398c2ecf20Sopenharmony_ci * it has to store a reference back to its _core equivalent structure,
408c2ecf20Sopenharmony_ci * so that it can service the hardware by steering gpio's etc.
418c2ecf20Sopenharmony_ci * Each bridge implementation is different so cast devptr accordingly.
428c2ecf20Sopenharmony_ci * The xc5000 driver cares not for this value, other than ensuring
438c2ecf20Sopenharmony_ci * it's passed back to a bridge during tuner_callback().
448c2ecf20Sopenharmony_ci */
458c2ecf20Sopenharmony_ci
468c2ecf20Sopenharmony_ci#if IS_REACHABLE(CONFIG_MEDIA_TUNER_XC5000)
478c2ecf20Sopenharmony_ciextern struct dvb_frontend *xc5000_attach(struct dvb_frontend *fe,
488c2ecf20Sopenharmony_ci					  struct i2c_adapter *i2c,
498c2ecf20Sopenharmony_ci					  const struct xc5000_config *cfg);
508c2ecf20Sopenharmony_ci#else
518c2ecf20Sopenharmony_cistatic inline struct dvb_frontend *xc5000_attach(struct dvb_frontend *fe,
528c2ecf20Sopenharmony_ci						 struct i2c_adapter *i2c,
538c2ecf20Sopenharmony_ci						 const struct xc5000_config *cfg)
548c2ecf20Sopenharmony_ci{
558c2ecf20Sopenharmony_ci	printk(KERN_WARNING "%s: driver disabled by Kconfig\n", __func__);
568c2ecf20Sopenharmony_ci	return NULL;
578c2ecf20Sopenharmony_ci}
588c2ecf20Sopenharmony_ci#endif
598c2ecf20Sopenharmony_ci
608c2ecf20Sopenharmony_ci#endif
61