]> git.karo-electronics.de Git - karo-tx-linux.git/blob - drivers/media/dvb-frontends/cxd2820r.h
Merge tag 'media/v4.9-3' of git://git.kernel.org/pub/scm/linux/kernel/git/mchehab...
[karo-tx-linux.git] / drivers / media / dvb-frontends / cxd2820r.h
1 /*
2  * Sony CXD2820R demodulator driver
3  *
4  * Copyright (C) 2010 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
22 #ifndef CXD2820R_H
23 #define CXD2820R_H
24
25 #include <linux/kconfig.h>
26 #include <linux/dvb/frontend.h>
27
28 #define CXD2820R_GPIO_D (0 << 0) /* disable */
29 #define CXD2820R_GPIO_E (1 << 0) /* enable */
30 #define CXD2820R_GPIO_O (0 << 1) /* output */
31 #define CXD2820R_GPIO_I (1 << 1) /* input */
32 #define CXD2820R_GPIO_L (0 << 2) /* output low */
33 #define CXD2820R_GPIO_H (1 << 2) /* output high */
34
35 #define CXD2820R_TS_SERIAL        0x08
36 #define CXD2820R_TS_SERIAL_MSB    0x28
37 #define CXD2820R_TS_PARALLEL      0x30
38 #define CXD2820R_TS_PARALLEL_MSB  0x70
39
40 /*
41  * I2C address: 0x6c, 0x6d
42  */
43
44 /**
45  * struct cxd2820r_platform_data - Platform data for the cxd2820r driver
46  * @ts_mode: TS mode.
47  * @ts_clk_inv: TS clock inverted.
48  * @if_agc_polarity: IF AGC polarity.
49  * @spec_inv: Input spectrum inverted.
50  * @gpio_chip_base: GPIO.
51  * @get_dvb_frontend: Get DVB frontend.
52  */
53
54 struct cxd2820r_platform_data {
55         u8 ts_mode;
56         bool ts_clk_inv;
57         bool if_agc_polarity;
58         bool spec_inv;
59         int **gpio_chip_base;
60
61         struct dvb_frontend* (*get_dvb_frontend)(struct i2c_client *);
62 /* private: For legacy media attach wrapper. Do not set value. */
63         bool attach_in_use;
64 };
65
66 struct cxd2820r_config {
67         /* Demodulator I2C address.
68          * Driver determines DVB-C slave I2C address automatically from master
69          * address.
70          * Default: none, must set
71          * Values: 0x6c, 0x6d
72          */
73         u8 i2c_address;
74
75         /* TS output mode.
76          * Default: none, must set.
77          * Values:
78          */
79         u8 ts_mode;
80
81         /* TS clock inverted.
82          * Default: 0
83          * Values: 0, 1
84          */
85         bool ts_clock_inv;
86
87         /* IF AGC polarity.
88          * Default: 0
89          * Values: 0, 1
90          */
91         bool if_agc_polarity;
92
93         /* Spectrum inversion.
94          * Default: 0
95          * Values: 0, 1
96          */
97         bool spec_inv;
98 };
99
100
101 #if IS_REACHABLE(CONFIG_DVB_CXD2820R)
102 extern struct dvb_frontend *cxd2820r_attach(
103         const struct cxd2820r_config *config,
104         struct i2c_adapter *i2c,
105         int *gpio_chip_base
106 );
107 #else
108 static inline struct dvb_frontend *cxd2820r_attach(
109         const struct cxd2820r_config *config,
110         struct i2c_adapter *i2c,
111         int *gpio_chip_base
112 )
113 {
114         printk(KERN_WARNING "%s: driver disabled by Kconfig\n", __func__);
115         return NULL;
116 }
117
118 #endif
119
120 #endif /* CXD2820R_H */