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