[media] af9033: feed clock to RF tuner
[cascardo/linux.git] / drivers / media / dvb-frontends / m88ds3103.h
1 /*
2  * Montage M88DS3103 demodulator driver
3  *
4  * Copyright (C) 2013 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
17 #ifndef M88DS3103_H
18 #define M88DS3103_H
19
20 #include <linux/dvb/frontend.h>
21
22 struct m88ds3103_config {
23         /*
24          * I2C address
25          * Default: none, must set
26          * 0x68, ...
27          */
28         u8 i2c_addr;
29
30         /*
31          * clock
32          * Default: none, must set
33          * 27000000
34          */
35         u32 clock;
36
37         /*
38          * max bytes I2C provider is asked to write at once
39          * Default: none, must set
40          * 33, 65, ...
41          */
42         u16 i2c_wr_max;
43
44         /*
45          * TS output mode
46          * Default: M88DS3103_TS_SERIAL
47          */
48 #define M88DS3103_TS_SERIAL             0 /* TS output pin D0, normal */
49 #define M88DS3103_TS_SERIAL_D7          1 /* TS output pin D7 */
50 #define M88DS3103_TS_PARALLEL           2 /* 24 MHz, normal */
51 #define M88DS3103_TS_PARALLEL_12        3 /* 12 MHz */
52 #define M88DS3103_TS_PARALLEL_16        4 /* 16 MHz */
53 #define M88DS3103_TS_PARALLEL_19_2      5 /* 19.2 MHz */
54 #define M88DS3103_TS_CI                 6 /* 6 MHz */
55         u8 ts_mode;
56
57         /*
58          * spectrum inversion
59          * Default: 0
60          */
61         u8 spec_inv:1;
62
63         /*
64          * AGC polarity
65          * Default: 0
66          */
67         u8 agc_inv:1;
68
69         /*
70          * clock output
71          * Default: M88DS3103_CLOCK_OUT_DISABLED
72          */
73 #define M88DS3103_CLOCK_OUT_DISABLED        0
74 #define M88DS3103_CLOCK_OUT_ENABLED         1
75 #define M88DS3103_CLOCK_OUT_ENABLED_DIV2    2
76         u8 clock_out;
77
78         /*
79          * DiSEqC envelope mode
80          * Default: 0
81          */
82         u8 envelope_mode:1;
83
84         /*
85          * AGC configuration
86          * Default: none, must set
87          */
88         u8 agc;
89 };
90
91 /*
92  * Driver implements own I2C-adapter for tuner I2C access. That's since chip
93  * has I2C-gate control which closes gate automatically after I2C transfer.
94  * Using own I2C adapter we can workaround that.
95  */
96
97 #if defined(CONFIG_DVB_M88DS3103) || \
98                 (defined(CONFIG_DVB_M88DS3103_MODULE) && defined(MODULE))
99 extern struct dvb_frontend *m88ds3103_attach(
100                 const struct m88ds3103_config *config,
101                 struct i2c_adapter *i2c,
102                 struct i2c_adapter **tuner_i2c);
103 #else
104 static inline struct dvb_frontend *m88ds3103_attach(
105                 const struct m88ds3103_config *config,
106                 struct i2c_adapter *i2c,
107                 struct i2c_adapter **tuner_i2c)
108 {
109         pr_warn("%s: driver disabled by Kconfig\n", __func__);
110         return NULL;
111 }
112 #endif
113
114 #endif