Merge tag 'backlight-for-linus-3.18' of git://git.kernel.org/pub/scm/linux/kernel...
[cascardo/linux.git] / drivers / media / dvb-frontends / m88ds3103_priv.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_PRIV_H
18 #define M88DS3103_PRIV_H
19
20 #include "dvb_frontend.h"
21 #include "m88ds3103.h"
22 #include "dvb_math.h"
23 #include <linux/firmware.h>
24 #include <linux/i2c-mux.h>
25 #include <linux/math64.h>
26
27 #define M88DS3103_FIRMWARE "dvb-demod-m88ds3103.fw"
28 #define M88DS3103_MCLK_KHZ 96000
29
30 struct m88ds3103_priv {
31         struct i2c_adapter *i2c;
32         /* mutex needed due to own tuner I2C adapter */
33         struct mutex i2c_mutex;
34         const struct m88ds3103_config *cfg;
35         struct dvb_frontend fe;
36         fe_delivery_system_t delivery_system;
37         fe_status_t fe_status;
38         u32 ber;
39         bool warm; /* FW running */
40         struct i2c_adapter *i2c_adapter;
41 };
42
43 struct m88ds3103_reg_val {
44         u8 reg;
45         u8 val;
46 };
47
48 static const struct m88ds3103_reg_val m88ds3103_dvbs_init_reg_vals[] = {
49         {0x23, 0x07},
50         {0x08, 0x03},
51         {0x0c, 0x02},
52         {0x21, 0x54},
53         {0x25, 0x8a},
54         {0x27, 0x31},
55         {0x30, 0x08},
56         {0x31, 0x40},
57         {0x32, 0x32},
58         {0x35, 0xff},
59         {0x3a, 0x00},
60         {0x37, 0x10},
61         {0x38, 0x10},
62         {0x39, 0x02},
63         {0x42, 0x60},
64         {0x4a, 0x80},
65         {0x4b, 0x04},
66         {0x4d, 0x91},
67         {0x5d, 0xc8},
68         {0x50, 0x36},
69         {0x51, 0x36},
70         {0x52, 0x36},
71         {0x53, 0x36},
72         {0x56, 0x01},
73         {0x63, 0x0f},
74         {0x64, 0x30},
75         {0x65, 0x40},
76         {0x68, 0x26},
77         {0x69, 0x4c},
78         {0x70, 0x20},
79         {0x71, 0x70},
80         {0x72, 0x04},
81         {0x73, 0x00},
82         {0x70, 0x40},
83         {0x71, 0x70},
84         {0x72, 0x04},
85         {0x73, 0x00},
86         {0x70, 0x60},
87         {0x71, 0x70},
88         {0x72, 0x04},
89         {0x73, 0x00},
90         {0x70, 0x80},
91         {0x71, 0x70},
92         {0x72, 0x04},
93         {0x73, 0x00},
94         {0x70, 0xa0},
95         {0x71, 0x70},
96         {0x72, 0x04},
97         {0x73, 0x00},
98         {0x70, 0x1f},
99         {0x76, 0x38},
100         {0x77, 0xa6},
101         {0x78, 0x0c},
102         {0x79, 0x80},
103         {0x7f, 0x14},
104         {0x7c, 0x00},
105         {0xae, 0x82},
106         {0x80, 0x64},
107         {0x81, 0x66},
108         {0x82, 0x44},
109         {0x85, 0x04},
110         {0xcd, 0xf4},
111         {0x90, 0x33},
112         {0xa0, 0x44},
113         {0xc0, 0x08},
114         {0xc3, 0x10},
115         {0xc4, 0x08},
116         {0xc5, 0xf0},
117         {0xc6, 0xff},
118         {0xc7, 0x00},
119         {0xc8, 0x1a},
120         {0xc9, 0x80},
121         {0xe0, 0xf8},
122         {0xe6, 0x8b},
123         {0xd0, 0x40},
124         {0xf8, 0x20},
125         {0xfa, 0x0f},
126         {0x00, 0x00},
127         {0xbd, 0x01},
128         {0xb8, 0x00},
129 };
130
131 static const struct m88ds3103_reg_val m88ds3103_dvbs2_init_reg_vals[] = {
132         {0x23, 0x07},
133         {0x08, 0x07},
134         {0x0c, 0x02},
135         {0x21, 0x54},
136         {0x25, 0x8a},
137         {0x27, 0x31},
138         {0x30, 0x08},
139         {0x32, 0x32},
140         {0x35, 0xff},
141         {0x3a, 0x00},
142         {0x37, 0x10},
143         {0x38, 0x10},
144         {0x39, 0x02},
145         {0x42, 0x60},
146         {0x4a, 0x80},
147         {0x4b, 0x04},
148         {0x4d, 0x91},
149         {0x5d, 0xc8},
150         {0x50, 0x36},
151         {0x51, 0x36},
152         {0x52, 0x36},
153         {0x53, 0x36},
154         {0x56, 0x01},
155         {0x63, 0x0f},
156         {0x64, 0x10},
157         {0x65, 0x20},
158         {0x68, 0x46},
159         {0x69, 0xcd},
160         {0x70, 0x20},
161         {0x71, 0x70},
162         {0x72, 0x04},
163         {0x73, 0x00},
164         {0x70, 0x40},
165         {0x71, 0x70},
166         {0x72, 0x04},
167         {0x73, 0x00},
168         {0x70, 0x60},
169         {0x71, 0x70},
170         {0x72, 0x04},
171         {0x73, 0x00},
172         {0x70, 0x80},
173         {0x71, 0x70},
174         {0x72, 0x04},
175         {0x73, 0x00},
176         {0x70, 0xa0},
177         {0x71, 0x70},
178         {0x72, 0x04},
179         {0x73, 0x00},
180         {0x70, 0x1f},
181         {0x76, 0x38},
182         {0x77, 0xa6},
183         {0x78, 0x0c},
184         {0x79, 0x80},
185         {0x7f, 0x14},
186         {0x85, 0x08},
187         {0xcd, 0xf4},
188         {0x90, 0x33},
189         {0x86, 0x00},
190         {0x87, 0x0f},
191         {0x89, 0x00},
192         {0x8b, 0x44},
193         {0x8c, 0x66},
194         {0x9d, 0xc1},
195         {0x8a, 0x10},
196         {0xad, 0x40},
197         {0xa0, 0x44},
198         {0xc0, 0x08},
199         {0xc1, 0x10},
200         {0xc2, 0x08},
201         {0xc3, 0x10},
202         {0xc4, 0x08},
203         {0xc5, 0xf0},
204         {0xc6, 0xff},
205         {0xc7, 0x00},
206         {0xc8, 0x1a},
207         {0xc9, 0x80},
208         {0xca, 0x23},
209         {0xcb, 0x24},
210         {0xcc, 0xf4},
211         {0xce, 0x74},
212         {0x00, 0x00},
213         {0xbd, 0x01},
214         {0xb8, 0x00},
215 };
216
217 #endif