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