xref: /linux/drivers/media/tuners/xc2028.h (revision 24bce201d79807b668bf9d9e0aca801c5c0d5f78)
1 /* SPDX-License-Identifier: GPL-2.0 */
2 /*
3  * xc2028
4  *
5  * Copyright (c) 2007-2008 Mauro Carvalho Chehab <mchehab@kernel.org>
6  */
7 
8 #ifndef __TUNER_XC2028_H__
9 #define __TUNER_XC2028_H__
10 
11 #include <media/dvb_frontend.h>
12 
13 #define XC2028_DEFAULT_FIRMWARE "xc3028-v27.fw"
14 #define XC3028L_DEFAULT_FIRMWARE "xc3028L-v36.fw"
15 
16 /*      Dmoduler		IF (kHz) */
17 #define	XC3028_FE_DEFAULT	0		/* Don't load SCODE */
18 #define XC3028_FE_LG60		6000
19 #define	XC3028_FE_ATI638	6380
20 #define	XC3028_FE_OREN538	5380
21 #define	XC3028_FE_OREN36	3600
22 #define	XC3028_FE_TOYOTA388	3880
23 #define	XC3028_FE_TOYOTA794	7940
24 #define	XC3028_FE_DIBCOM52	5200
25 #define	XC3028_FE_ZARLINK456	4560
26 #define	XC3028_FE_CHINA		5200
27 
28 enum firmware_type {
29 	XC2028_AUTO = 0,        /* By default, auto-detects */
30 	XC2028_D2633,
31 	XC2028_D2620,
32 };
33 
34 struct xc2028_ctrl {
35 	char			*fname;
36 	int			max_len;
37 	int			msleep;
38 	unsigned int		scode_table;
39 	unsigned int		mts   :1;
40 	unsigned int		input1:1;
41 	unsigned int		vhfbw7:1;
42 	unsigned int		uhfbw8:1;
43 	unsigned int		disable_power_mgmt:1;
44 	unsigned int            read_not_reliable:1;
45 	unsigned int		demod;
46 	enum firmware_type	type:2;
47 };
48 
49 struct xc2028_config {
50 	struct i2c_adapter *i2c_adap;
51 	u8		   i2c_addr;
52 	struct xc2028_ctrl *ctrl;
53 };
54 
55 /* xc2028 commands for callback */
56 #define XC2028_TUNER_RESET	0
57 #define XC2028_RESET_CLK	1
58 #define XC2028_I2C_FLUSH	2
59 
60 #if IS_REACHABLE(CONFIG_MEDIA_TUNER_XC2028)
61 extern struct dvb_frontend *xc2028_attach(struct dvb_frontend *fe,
62 					  struct xc2028_config *cfg);
63 #else
64 static inline struct dvb_frontend *xc2028_attach(struct dvb_frontend *fe,
65 						 struct xc2028_config *cfg)
66 {
67 	printk(KERN_INFO "%s: not probed - driver disabled by Kconfig\n",
68 	       __func__);
69 	return NULL;
70 }
71 #endif
72 
73 #endif /* __TUNER_XC2028_H__ */
74