xref: /OK3568_Linux_fs/kernel/drivers/media/tuners/xc4000.h (revision 4882a59341e53eb6f0b4789bf948001014eff981)
1*4882a593Smuzhiyun /* SPDX-License-Identifier: GPL-2.0-or-later */
2*4882a593Smuzhiyun /*
3*4882a593Smuzhiyun  *  Driver for Xceive XC4000 "QAM/8VSB single chip tuner"
4*4882a593Smuzhiyun  *
5*4882a593Smuzhiyun  *  Copyright (c) 2007 Steven Toth <stoth@linuxtv.org>
6*4882a593Smuzhiyun  */
7*4882a593Smuzhiyun 
8*4882a593Smuzhiyun #ifndef __XC4000_H__
9*4882a593Smuzhiyun #define __XC4000_H__
10*4882a593Smuzhiyun 
11*4882a593Smuzhiyun #include <linux/firmware.h>
12*4882a593Smuzhiyun 
13*4882a593Smuzhiyun struct dvb_frontend;
14*4882a593Smuzhiyun struct i2c_adapter;
15*4882a593Smuzhiyun 
16*4882a593Smuzhiyun struct xc4000_config {
17*4882a593Smuzhiyun 	u8	i2c_address;
18*4882a593Smuzhiyun 	/* if non-zero, power management is enabled by default */
19*4882a593Smuzhiyun 	u8	default_pm;
20*4882a593Smuzhiyun 	/* value to be written to XREG_AMPLITUDE in DVB-T mode (0: no write) */
21*4882a593Smuzhiyun 	u8	dvb_amplitude;
22*4882a593Smuzhiyun 	/* if non-zero, register 0x0E is set to filter analog TV video output */
23*4882a593Smuzhiyun 	u8	set_smoothedcvbs;
24*4882a593Smuzhiyun 	/* IF for DVB-T */
25*4882a593Smuzhiyun 	u32	if_khz;
26*4882a593Smuzhiyun };
27*4882a593Smuzhiyun 
28*4882a593Smuzhiyun /* xc4000 callback command */
29*4882a593Smuzhiyun #define XC4000_TUNER_RESET		0
30*4882a593Smuzhiyun 
31*4882a593Smuzhiyun /* For each bridge framework, when it attaches either analog or digital,
32*4882a593Smuzhiyun  * it has to store a reference back to its _core equivalent structure,
33*4882a593Smuzhiyun  * so that it can service the hardware by steering gpio's etc.
34*4882a593Smuzhiyun  * Each bridge implementation is different so cast devptr accordingly.
35*4882a593Smuzhiyun  * The xc4000 driver cares not for this value, other than ensuring
36*4882a593Smuzhiyun  * it's passed back to a bridge during tuner_callback().
37*4882a593Smuzhiyun  */
38*4882a593Smuzhiyun 
39*4882a593Smuzhiyun #if IS_REACHABLE(CONFIG_MEDIA_TUNER_XC4000)
40*4882a593Smuzhiyun extern struct dvb_frontend *xc4000_attach(struct dvb_frontend *fe,
41*4882a593Smuzhiyun 					  struct i2c_adapter *i2c,
42*4882a593Smuzhiyun 					  struct xc4000_config *cfg);
43*4882a593Smuzhiyun #else
xc4000_attach(struct dvb_frontend * fe,struct i2c_adapter * i2c,struct xc4000_config * cfg)44*4882a593Smuzhiyun static inline struct dvb_frontend *xc4000_attach(struct dvb_frontend *fe,
45*4882a593Smuzhiyun 						 struct i2c_adapter *i2c,
46*4882a593Smuzhiyun 						 struct xc4000_config *cfg)
47*4882a593Smuzhiyun {
48*4882a593Smuzhiyun 	printk(KERN_WARNING "%s: driver disabled by Kconfig\n", __func__);
49*4882a593Smuzhiyun 	return NULL;
50*4882a593Smuzhiyun }
51*4882a593Smuzhiyun #endif
52*4882a593Smuzhiyun 
53*4882a593Smuzhiyun #endif
54