xref: /openbmc/linux/drivers/media/tuners/xc5000.h (revision e7bae9bb)
1 /* SPDX-License-Identifier: GPL-2.0-or-later */
2 /*
3  *  Driver for Xceive XC5000 "QAM/8VSB single chip tuner"
4  *
5  *  Copyright (c) 2007 Steven Toth <stoth@linuxtv.org>
6  */
7 
8 #ifndef __XC5000_H__
9 #define __XC5000_H__
10 
11 #include <linux/firmware.h>
12 
13 struct dvb_frontend;
14 struct i2c_adapter;
15 
16 #define XC5000A 1
17 #define XC5000C 2
18 
19 struct xc5000_config {
20 	u8   i2c_address;
21 	u32  if_khz;
22 	u8   radio_input;
23 	u16  xtal_khz;
24 	u16  output_amp;
25 
26 	int chip_id;
27 };
28 
29 /* xc5000 callback command */
30 #define XC5000_TUNER_RESET		0
31 
32 /* Possible Radio inputs */
33 #define XC5000_RADIO_NOT_CONFIGURED		0
34 #define XC5000_RADIO_FM1			1
35 #define XC5000_RADIO_FM2			2
36 #define XC5000_RADIO_FM1_MONO			3
37 
38 /* For each bridge framework, when it attaches either analog or digital,
39  * it has to store a reference back to its _core equivalent structure,
40  * so that it can service the hardware by steering gpio's etc.
41  * Each bridge implementation is different so cast devptr accordingly.
42  * The xc5000 driver cares not for this value, other than ensuring
43  * it's passed back to a bridge during tuner_callback().
44  */
45 
46 #if IS_REACHABLE(CONFIG_MEDIA_TUNER_XC5000)
47 extern struct dvb_frontend *xc5000_attach(struct dvb_frontend *fe,
48 					  struct i2c_adapter *i2c,
49 					  const struct xc5000_config *cfg);
50 #else
51 static inline struct dvb_frontend *xc5000_attach(struct dvb_frontend *fe,
52 						 struct i2c_adapter *i2c,
53 						 const struct xc5000_config *cfg)
54 {
55 	printk(KERN_WARNING "%s: driver disabled by Kconfig\n", __func__);
56 	return NULL;
57 }
58 #endif
59 
60 #endif
61