xref: /linux/drivers/media/dvb-frontends/af9013.h (revision 9a0bf528b4d66b605f02634236da085595c22101)
1*9a0bf528SMauro Carvalho Chehab /*
2*9a0bf528SMauro Carvalho Chehab  * Afatech AF9013 demodulator driver
3*9a0bf528SMauro Carvalho Chehab  *
4*9a0bf528SMauro Carvalho Chehab  * Copyright (C) 2007 Antti Palosaari <crope@iki.fi>
5*9a0bf528SMauro Carvalho Chehab  * Copyright (C) 2011 Antti Palosaari <crope@iki.fi>
6*9a0bf528SMauro Carvalho Chehab  *
7*9a0bf528SMauro Carvalho Chehab  * Thanks to Afatech who kindly provided information.
8*9a0bf528SMauro Carvalho Chehab  *
9*9a0bf528SMauro Carvalho Chehab  *    This program is free software; you can redistribute it and/or modify
10*9a0bf528SMauro Carvalho Chehab  *    it under the terms of the GNU General Public License as published by
11*9a0bf528SMauro Carvalho Chehab  *    the Free Software Foundation; either version 2 of the License, or
12*9a0bf528SMauro Carvalho Chehab  *    (at your option) any later version.
13*9a0bf528SMauro Carvalho Chehab  *
14*9a0bf528SMauro Carvalho Chehab  *    This program is distributed in the hope that it will be useful,
15*9a0bf528SMauro Carvalho Chehab  *    but WITHOUT ANY WARRANTY; without even the implied warranty of
16*9a0bf528SMauro Carvalho Chehab  *    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
17*9a0bf528SMauro Carvalho Chehab  *    GNU General Public License for more details.
18*9a0bf528SMauro Carvalho Chehab  *
19*9a0bf528SMauro Carvalho Chehab  *    You should have received a copy of the GNU General Public License
20*9a0bf528SMauro Carvalho Chehab  *    along with this program; if not, write to the Free Software
21*9a0bf528SMauro Carvalho Chehab  *    Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
22*9a0bf528SMauro Carvalho Chehab  *
23*9a0bf528SMauro Carvalho Chehab  */
24*9a0bf528SMauro Carvalho Chehab 
25*9a0bf528SMauro Carvalho Chehab #ifndef AF9013_H
26*9a0bf528SMauro Carvalho Chehab #define AF9013_H
27*9a0bf528SMauro Carvalho Chehab 
28*9a0bf528SMauro Carvalho Chehab #include <linux/dvb/frontend.h>
29*9a0bf528SMauro Carvalho Chehab 
30*9a0bf528SMauro Carvalho Chehab /* AF9013/5 GPIOs (mostly guessed)
31*9a0bf528SMauro Carvalho Chehab    demod#1-gpio#0 - set demod#2 i2c-addr for dual devices
32*9a0bf528SMauro Carvalho Chehab    demod#1-gpio#1 - xtal setting (?)
33*9a0bf528SMauro Carvalho Chehab    demod#1-gpio#3 - tuner#1
34*9a0bf528SMauro Carvalho Chehab    demod#2-gpio#0 - tuner#2
35*9a0bf528SMauro Carvalho Chehab    demod#2-gpio#1 - xtal setting (?)
36*9a0bf528SMauro Carvalho Chehab */
37*9a0bf528SMauro Carvalho Chehab 
38*9a0bf528SMauro Carvalho Chehab struct af9013_config {
39*9a0bf528SMauro Carvalho Chehab 	/*
40*9a0bf528SMauro Carvalho Chehab 	 * I2C address
41*9a0bf528SMauro Carvalho Chehab 	 */
42*9a0bf528SMauro Carvalho Chehab 	u8 i2c_addr;
43*9a0bf528SMauro Carvalho Chehab 
44*9a0bf528SMauro Carvalho Chehab 	/*
45*9a0bf528SMauro Carvalho Chehab 	 * clock
46*9a0bf528SMauro Carvalho Chehab 	 * 20480000, 25000000, 28000000, 28800000
47*9a0bf528SMauro Carvalho Chehab 	 */
48*9a0bf528SMauro Carvalho Chehab 	u32 clock;
49*9a0bf528SMauro Carvalho Chehab 
50*9a0bf528SMauro Carvalho Chehab 	/*
51*9a0bf528SMauro Carvalho Chehab 	 * tuner
52*9a0bf528SMauro Carvalho Chehab 	 */
53*9a0bf528SMauro Carvalho Chehab #define AF9013_TUNER_MXL5003D      3 /* MaxLinear */
54*9a0bf528SMauro Carvalho Chehab #define AF9013_TUNER_MXL5005D     13 /* MaxLinear */
55*9a0bf528SMauro Carvalho Chehab #define AF9013_TUNER_MXL5005R     30 /* MaxLinear */
56*9a0bf528SMauro Carvalho Chehab #define AF9013_TUNER_ENV77H11D5  129 /* Panasonic */
57*9a0bf528SMauro Carvalho Chehab #define AF9013_TUNER_MT2060      130 /* Microtune */
58*9a0bf528SMauro Carvalho Chehab #define AF9013_TUNER_MC44S803    133 /* Freescale */
59*9a0bf528SMauro Carvalho Chehab #define AF9013_TUNER_QT1010      134 /* Quantek */
60*9a0bf528SMauro Carvalho Chehab #define AF9013_TUNER_UNKNOWN     140 /* for can tuners ? */
61*9a0bf528SMauro Carvalho Chehab #define AF9013_TUNER_MT2060_2    147 /* Microtune */
62*9a0bf528SMauro Carvalho Chehab #define AF9013_TUNER_TDA18271    156 /* NXP */
63*9a0bf528SMauro Carvalho Chehab #define AF9013_TUNER_QT1010A     162 /* Quantek */
64*9a0bf528SMauro Carvalho Chehab #define AF9013_TUNER_MXL5007T    177 /* MaxLinear */
65*9a0bf528SMauro Carvalho Chehab #define AF9013_TUNER_TDA18218    179 /* NXP */
66*9a0bf528SMauro Carvalho Chehab 	u8 tuner;
67*9a0bf528SMauro Carvalho Chehab 
68*9a0bf528SMauro Carvalho Chehab 	/*
69*9a0bf528SMauro Carvalho Chehab 	 * IF frequency
70*9a0bf528SMauro Carvalho Chehab 	 */
71*9a0bf528SMauro Carvalho Chehab 	u32 if_frequency;
72*9a0bf528SMauro Carvalho Chehab 
73*9a0bf528SMauro Carvalho Chehab 	/*
74*9a0bf528SMauro Carvalho Chehab 	 * TS settings
75*9a0bf528SMauro Carvalho Chehab 	 */
76*9a0bf528SMauro Carvalho Chehab #define AF9013_TS_USB       0
77*9a0bf528SMauro Carvalho Chehab #define AF9013_TS_PARALLEL  1
78*9a0bf528SMauro Carvalho Chehab #define AF9013_TS_SERIAL    2
79*9a0bf528SMauro Carvalho Chehab 	u8 ts_mode:2;
80*9a0bf528SMauro Carvalho Chehab 
81*9a0bf528SMauro Carvalho Chehab 	/*
82*9a0bf528SMauro Carvalho Chehab 	 * input spectrum inversion
83*9a0bf528SMauro Carvalho Chehab 	 */
84*9a0bf528SMauro Carvalho Chehab 	bool spec_inv;
85*9a0bf528SMauro Carvalho Chehab 
86*9a0bf528SMauro Carvalho Chehab 	/*
87*9a0bf528SMauro Carvalho Chehab 	 * firmware API version
88*9a0bf528SMauro Carvalho Chehab 	 */
89*9a0bf528SMauro Carvalho Chehab 	u8 api_version[4];
90*9a0bf528SMauro Carvalho Chehab 
91*9a0bf528SMauro Carvalho Chehab 	/*
92*9a0bf528SMauro Carvalho Chehab 	 * GPIOs
93*9a0bf528SMauro Carvalho Chehab 	 */
94*9a0bf528SMauro Carvalho Chehab #define AF9013_GPIO_ON (1 << 0)
95*9a0bf528SMauro Carvalho Chehab #define AF9013_GPIO_EN (1 << 1)
96*9a0bf528SMauro Carvalho Chehab #define AF9013_GPIO_O  (1 << 2)
97*9a0bf528SMauro Carvalho Chehab #define AF9013_GPIO_I  (1 << 3)
98*9a0bf528SMauro Carvalho Chehab #define AF9013_GPIO_LO (AF9013_GPIO_ON|AF9013_GPIO_EN)
99*9a0bf528SMauro Carvalho Chehab #define AF9013_GPIO_HI (AF9013_GPIO_ON|AF9013_GPIO_EN|AF9013_GPIO_O)
100*9a0bf528SMauro Carvalho Chehab #define AF9013_GPIO_TUNER_ON  (AF9013_GPIO_ON|AF9013_GPIO_EN)
101*9a0bf528SMauro Carvalho Chehab #define AF9013_GPIO_TUNER_OFF (AF9013_GPIO_ON|AF9013_GPIO_EN|AF9013_GPIO_O)
102*9a0bf528SMauro Carvalho Chehab 	u8 gpio[4];
103*9a0bf528SMauro Carvalho Chehab };
104*9a0bf528SMauro Carvalho Chehab 
105*9a0bf528SMauro Carvalho Chehab #if defined(CONFIG_DVB_AF9013) || \
106*9a0bf528SMauro Carvalho Chehab 	(defined(CONFIG_DVB_AF9013_MODULE) && defined(MODULE))
107*9a0bf528SMauro Carvalho Chehab extern struct dvb_frontend *af9013_attach(const struct af9013_config *config,
108*9a0bf528SMauro Carvalho Chehab 	struct i2c_adapter *i2c);
109*9a0bf528SMauro Carvalho Chehab #else
110*9a0bf528SMauro Carvalho Chehab static inline struct dvb_frontend *af9013_attach(
111*9a0bf528SMauro Carvalho Chehab const struct af9013_config *config, struct i2c_adapter *i2c)
112*9a0bf528SMauro Carvalho Chehab {
113*9a0bf528SMauro Carvalho Chehab 	printk(KERN_WARNING "%s: driver disabled by Kconfig\n", __func__);
114*9a0bf528SMauro Carvalho Chehab 	return NULL;
115*9a0bf528SMauro Carvalho Chehab }
116*9a0bf528SMauro Carvalho Chehab #endif /* CONFIG_DVB_AF9013 */
117*9a0bf528SMauro Carvalho Chehab 
118*9a0bf528SMauro Carvalho Chehab #endif /* AF9013_H */
119