Merge tag 'acpica-4.2-rc1' of git://git.kernel.org/pub/scm/linux/kernel/git/rafael...
[firefly-linux-kernel-4.4.55.git] / drivers / media / dvb-frontends / tda10071.h
1 /*
2  * NXP TDA10071 + Conexant CX24118A DVB-S/S2 demodulator + tuner driver
3  *
4  * Copyright (C) 2011 Antti Palosaari <crope@iki.fi>
5  *
6  *    This program is free software; you can redistribute it and/or modify
7  *    it under the terms of the GNU General Public License as published by
8  *    the Free Software Foundation; either version 2 of the License, or
9  *    (at your option) any later version.
10  *
11  *    This program is distributed in the hope that it will be useful,
12  *    but WITHOUT ANY WARRANTY; without even the implied warranty of
13  *    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
14  *    GNU General Public License for more details.
15  *
16  *    You should have received a copy of the GNU General Public License along
17  *    with this program; if not, write to the Free Software Foundation, Inc.,
18  *    51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
19  */
20
21 #ifndef TDA10071_H
22 #define TDA10071_H
23
24 #include <linux/kconfig.h>
25 #include <linux/dvb/frontend.h>
26
27 /*
28  * I2C address
29  * 0x55,
30  */
31
32 /**
33  * struct tda10071_platform_data - Platform data for the tda10071 driver
34  * @clk: Clock frequency.
35  * @i2c_wr_max: Max bytes I2C adapter can write at once.
36  * @ts_mode: TS mode.
37  * @spec_inv: Input spectrum inversion.
38  * @pll_multiplier: PLL multiplier.
39  * @tuner_i2c_addr: CX24118A tuner I2C address (0x14, 0x54, ...).
40  * @get_dvb_frontend: Get DVB frontend.
41  */
42
43 struct tda10071_platform_data {
44         u32 clk;
45         u16 i2c_wr_max;
46 #define TDA10071_TS_SERIAL        0
47 #define TDA10071_TS_PARALLEL      1
48         u8 ts_mode;
49         bool spec_inv;
50         u8 pll_multiplier;
51         u8 tuner_i2c_addr;
52
53         struct dvb_frontend* (*get_dvb_frontend)(struct i2c_client *);
54 };
55
56 struct tda10071_config {
57         /* Demodulator I2C address.
58          * Default: none, must set
59          * Values: 0x55,
60          */
61         u8 demod_i2c_addr;
62
63         /* Tuner I2C address.
64          * Default: none, must set
65          * Values: 0x14, 0x54, ...
66          */
67         u8 tuner_i2c_addr;
68
69         /* Max bytes I2C provider can write at once.
70          * Note: Buffer is taken from the stack currently!
71          * Default: none, must set
72          * Values:
73          */
74         u16 i2c_wr_max;
75
76         /* TS output mode.
77          * Default: TDA10071_TS_SERIAL
78          * Values:
79          */
80 #define TDA10071_TS_SERIAL        0
81 #define TDA10071_TS_PARALLEL      1
82         u8 ts_mode;
83
84         /* Input spectrum inversion.
85          * Default: 0
86          * Values: 0, 1
87          */
88         bool spec_inv;
89
90         /* Xtal frequency Hz
91          * Default: none, must set
92          * Values:
93          */
94         u32 xtal;
95
96         /* PLL multiplier.
97          * Default: none, must set
98          * Values:
99          */
100         u8 pll_multiplier;
101 };
102
103
104 #if IS_REACHABLE(CONFIG_DVB_TDA10071)
105 extern struct dvb_frontend *tda10071_attach(
106         const struct tda10071_config *config, struct i2c_adapter *i2c);
107 #else
108 static inline struct dvb_frontend *tda10071_attach(
109         const struct tda10071_config *config, struct i2c_adapter *i2c)
110 {
111         dev_warn(&i2c->dev, "%s: driver disabled by Kconfig\n", __func__);
112         return NULL;
113 }
114 #endif
115
116 #endif /* TDA10071_H */