diff options
author | Antti Palosaari <crope@iki.fi> | 2015-04-21 16:13:39 -0400 |
---|---|---|
committer | Mauro Carvalho Chehab <mchehab@osg.samsung.com> | 2015-05-20 12:48:31 -0400 |
commit | f8b9b871f832a618f71be17fe7d90034e0862862 (patch) | |
tree | 38ece3926ed6283b8b3cee0c44170de5469e82e5 /drivers | |
parent | 0e3a71c3749fa451505a67a61d61e142a96ceb23 (diff) |
[media] e4000: various small changes
* Rename device state from 's' to 'dev'.
* Move single include to driver private header.
* Change error handling type of each function to one I tend use
nowadays.
* Remove dummy register write from init. Even Windows driver does this
multiple times remove it as I have never seen any I2C errors.
* Define I2C client pointer for each function and use it.
* Do not clean tuner ops during driver remove - not needed.
* Disable sysfs device bind / unbind. We are not allowed manually
bind / unbind device from the driver currently.
* Rename some other variables.
Signed-off-by: Antti Palosaari <crope@iki.fi>
Signed-off-by: Mauro Carvalho Chehab <mchehab@osg.samsung.com>
Diffstat (limited to 'drivers')
-rw-r--r-- | drivers/media/tuners/e4000.c | 358 | ||||
-rw-r--r-- | drivers/media/tuners/e4000.h | 1 | ||||
-rw-r--r-- | drivers/media/tuners/e4000_priv.h | 5 |
3 files changed, 178 insertions, 186 deletions
diff --git a/drivers/media/tuners/e4000.c b/drivers/media/tuners/e4000.c index cda8bcf164de..57bdca44a5bd 100644 --- a/drivers/media/tuners/e4000.c +++ b/drivers/media/tuners/e4000.c | |||
@@ -19,113 +19,112 @@ | |||
19 | */ | 19 | */ |
20 | 20 | ||
21 | #include "e4000_priv.h" | 21 | #include "e4000_priv.h" |
22 | #include <linux/math64.h> | ||
23 | 22 | ||
24 | static int e4000_init(struct dvb_frontend *fe) | 23 | static int e4000_init(struct dvb_frontend *fe) |
25 | { | 24 | { |
26 | struct e4000 *s = fe->tuner_priv; | 25 | struct e4000_dev *dev = fe->tuner_priv; |
26 | struct i2c_client *client = dev->client; | ||
27 | int ret; | 27 | int ret; |
28 | 28 | ||
29 | dev_dbg(&s->client->dev, "\n"); | 29 | dev_dbg(&client->dev, "\n"); |
30 | |||
31 | /* dummy I2C to ensure I2C wakes up */ | ||
32 | ret = regmap_write(s->regmap, 0x02, 0x40); | ||
33 | 30 | ||
34 | /* reset */ | 31 | /* reset */ |
35 | ret = regmap_write(s->regmap, 0x00, 0x01); | 32 | ret = regmap_write(dev->regmap, 0x00, 0x01); |
36 | if (ret) | 33 | if (ret) |
37 | goto err; | 34 | goto err; |
38 | 35 | ||
39 | /* disable output clock */ | 36 | /* disable output clock */ |
40 | ret = regmap_write(s->regmap, 0x06, 0x00); | 37 | ret = regmap_write(dev->regmap, 0x06, 0x00); |
41 | if (ret) | 38 | if (ret) |
42 | goto err; | 39 | goto err; |
43 | 40 | ||
44 | ret = regmap_write(s->regmap, 0x7a, 0x96); | 41 | ret = regmap_write(dev->regmap, 0x7a, 0x96); |
45 | if (ret) | 42 | if (ret) |
46 | goto err; | 43 | goto err; |
47 | 44 | ||
48 | /* configure gains */ | 45 | /* configure gains */ |
49 | ret = regmap_bulk_write(s->regmap, 0x7e, "\x01\xfe", 2); | 46 | ret = regmap_bulk_write(dev->regmap, 0x7e, "\x01\xfe", 2); |
50 | if (ret) | 47 | if (ret) |
51 | goto err; | 48 | goto err; |
52 | 49 | ||
53 | ret = regmap_write(s->regmap, 0x82, 0x00); | 50 | ret = regmap_write(dev->regmap, 0x82, 0x00); |
54 | if (ret) | 51 | if (ret) |
55 | goto err; | 52 | goto err; |
56 | 53 | ||
57 | ret = regmap_write(s->regmap, 0x24, 0x05); | 54 | ret = regmap_write(dev->regmap, 0x24, 0x05); |
58 | if (ret) | 55 | if (ret) |
59 | goto err; | 56 | goto err; |
60 | 57 | ||
61 | ret = regmap_bulk_write(s->regmap, 0x87, "\x20\x01", 2); | 58 | ret = regmap_bulk_write(dev->regmap, 0x87, "\x20\x01", 2); |
62 | if (ret) | 59 | if (ret) |
63 | goto err; | 60 | goto err; |
64 | 61 | ||
65 | ret = regmap_bulk_write(s->regmap, 0x9f, "\x7f\x07", 2); | 62 | ret = regmap_bulk_write(dev->regmap, 0x9f, "\x7f\x07", 2); |
66 | if (ret) | 63 | if (ret) |
67 | goto err; | 64 | goto err; |
68 | 65 | ||
69 | /* DC offset control */ | 66 | /* DC offset control */ |
70 | ret = regmap_write(s->regmap, 0x2d, 0x1f); | 67 | ret = regmap_write(dev->regmap, 0x2d, 0x1f); |
71 | if (ret) | 68 | if (ret) |
72 | goto err; | 69 | goto err; |
73 | 70 | ||
74 | ret = regmap_bulk_write(s->regmap, 0x70, "\x01\x01", 2); | 71 | ret = regmap_bulk_write(dev->regmap, 0x70, "\x01\x01", 2); |
75 | if (ret) | 72 | if (ret) |
76 | goto err; | 73 | goto err; |
77 | 74 | ||
78 | /* gain control */ | 75 | /* gain control */ |
79 | ret = regmap_write(s->regmap, 0x1a, 0x17); | 76 | ret = regmap_write(dev->regmap, 0x1a, 0x17); |
80 | if (ret) | 77 | if (ret) |
81 | goto err; | 78 | goto err; |
82 | 79 | ||
83 | ret = regmap_write(s->regmap, 0x1f, 0x1a); | 80 | ret = regmap_write(dev->regmap, 0x1f, 0x1a); |
84 | if (ret) | 81 | if (ret) |
85 | goto err; | 82 | goto err; |
86 | 83 | ||
87 | s->active = true; | 84 | dev->active = true; |
88 | err: | ||
89 | if (ret) | ||
90 | dev_dbg(&s->client->dev, "failed=%d\n", ret); | ||
91 | 85 | ||
86 | return 0; | ||
87 | err: | ||
88 | dev_dbg(&client->dev, "failed=%d\n", ret); | ||
92 | return ret; | 89 | return ret; |
93 | } | 90 | } |
94 | 91 | ||
95 | static int e4000_sleep(struct dvb_frontend *fe) | 92 | static int e4000_sleep(struct dvb_frontend *fe) |
96 | { | 93 | { |
97 | struct e4000 *s = fe->tuner_priv; | 94 | struct e4000_dev *dev = fe->tuner_priv; |
95 | struct i2c_client *client = dev->client; | ||
98 | int ret; | 96 | int ret; |
99 | 97 | ||
100 | dev_dbg(&s->client->dev, "\n"); | 98 | dev_dbg(&client->dev, "\n"); |
101 | 99 | ||
102 | s->active = false; | 100 | dev->active = false; |
103 | 101 | ||
104 | ret = regmap_write(s->regmap, 0x00, 0x00); | 102 | ret = regmap_write(dev->regmap, 0x00, 0x00); |
105 | if (ret) | 103 | if (ret) |
106 | goto err; | 104 | goto err; |
107 | err: | ||
108 | if (ret) | ||
109 | dev_dbg(&s->client->dev, "failed=%d\n", ret); | ||
110 | 105 | ||
106 | return 0; | ||
107 | err: | ||
108 | dev_dbg(&client->dev, "failed=%d\n", ret); | ||
111 | return ret; | 109 | return ret; |
112 | } | 110 | } |
113 | 111 | ||
114 | static int e4000_set_params(struct dvb_frontend *fe) | 112 | static int e4000_set_params(struct dvb_frontend *fe) |
115 | { | 113 | { |
116 | struct e4000 *s = fe->tuner_priv; | 114 | struct e4000_dev *dev = fe->tuner_priv; |
115 | struct i2c_client *client = dev->client; | ||
117 | struct dtv_frontend_properties *c = &fe->dtv_property_cache; | 116 | struct dtv_frontend_properties *c = &fe->dtv_property_cache; |
118 | int ret, i; | 117 | int ret, i; |
119 | unsigned int div_n, k, k_cw, div_out; | 118 | unsigned int div_n, k, k_cw, div_out; |
120 | u64 f_vco; | 119 | u64 f_vco; |
121 | u8 buf[5], i_data[4], q_data[4]; | 120 | u8 buf[5], i_data[4], q_data[4]; |
122 | 121 | ||
123 | dev_dbg(&s->client->dev, | 122 | dev_dbg(&client->dev, |
124 | "delivery_system=%d frequency=%u bandwidth_hz=%u\n", | 123 | "delivery_system=%d frequency=%u bandwidth_hz=%u\n", |
125 | c->delivery_system, c->frequency, c->bandwidth_hz); | 124 | c->delivery_system, c->frequency, c->bandwidth_hz); |
126 | 125 | ||
127 | /* gain control manual */ | 126 | /* gain control manual */ |
128 | ret = regmap_write(s->regmap, 0x1a, 0x00); | 127 | ret = regmap_write(dev->regmap, 0x1a, 0x00); |
129 | if (ret) | 128 | if (ret) |
130 | goto err; | 129 | goto err; |
131 | 130 | ||
@@ -148,20 +147,19 @@ static int e4000_set_params(struct dvb_frontend *fe) | |||
148 | if (c->frequency <= e4000_pll_lut[i].freq) | 147 | if (c->frequency <= e4000_pll_lut[i].freq) |
149 | break; | 148 | break; |
150 | } | 149 | } |
151 | |||
152 | if (i == ARRAY_SIZE(e4000_pll_lut)) { | 150 | if (i == ARRAY_SIZE(e4000_pll_lut)) { |
153 | ret = -EINVAL; | 151 | ret = -EINVAL; |
154 | goto err; | 152 | goto err; |
155 | } | 153 | } |
156 | 154 | ||
157 | #define F_REF s->clock | 155 | #define F_REF dev->clk |
158 | div_out = e4000_pll_lut[i].div_out; | 156 | div_out = e4000_pll_lut[i].div_out; |
159 | f_vco = (u64) c->frequency * div_out; | 157 | f_vco = (u64) c->frequency * div_out; |
160 | /* calculate PLL integer and fractional control word */ | 158 | /* calculate PLL integer and fractional control word */ |
161 | div_n = div_u64_rem(f_vco, F_REF, &k); | 159 | div_n = div_u64_rem(f_vco, F_REF, &k); |
162 | k_cw = div_u64((u64) k * 0x10000, F_REF); | 160 | k_cw = div_u64((u64) k * 0x10000, F_REF); |
163 | 161 | ||
164 | dev_dbg(&s->client->dev, | 162 | dev_dbg(&client->dev, |
165 | "frequency=%u f_vco=%llu F_REF=%u div_n=%u k=%u k_cw=%04x div_out=%u\n", | 163 | "frequency=%u f_vco=%llu F_REF=%u div_n=%u k=%u k_cw=%04x div_out=%u\n", |
166 | c->frequency, f_vco, F_REF, div_n, k, k_cw, div_out); | 164 | c->frequency, f_vco, F_REF, div_n, k, k_cw, div_out); |
167 | 165 | ||
@@ -170,7 +168,7 @@ static int e4000_set_params(struct dvb_frontend *fe) | |||
170 | buf[2] = (k_cw >> 8) & 0xff; | 168 | buf[2] = (k_cw >> 8) & 0xff; |
171 | buf[3] = 0x00; | 169 | buf[3] = 0x00; |
172 | buf[4] = e4000_pll_lut[i].div_out_reg; | 170 | buf[4] = e4000_pll_lut[i].div_out_reg; |
173 | ret = regmap_bulk_write(s->regmap, 0x09, buf, 5); | 171 | ret = regmap_bulk_write(dev->regmap, 0x09, buf, 5); |
174 | if (ret) | 172 | if (ret) |
175 | goto err; | 173 | goto err; |
176 | 174 | ||
@@ -179,13 +177,12 @@ static int e4000_set_params(struct dvb_frontend *fe) | |||
179 | if (c->frequency <= e400_lna_filter_lut[i].freq) | 177 | if (c->frequency <= e400_lna_filter_lut[i].freq) |
180 | break; | 178 | break; |
181 | } | 179 | } |
182 | |||
183 | if (i == ARRAY_SIZE(e400_lna_filter_lut)) { | 180 | if (i == ARRAY_SIZE(e400_lna_filter_lut)) { |
184 | ret = -EINVAL; | 181 | ret = -EINVAL; |
185 | goto err; | 182 | goto err; |
186 | } | 183 | } |
187 | 184 | ||
188 | ret = regmap_write(s->regmap, 0x10, e400_lna_filter_lut[i].val); | 185 | ret = regmap_write(dev->regmap, 0x10, e400_lna_filter_lut[i].val); |
189 | if (ret) | 186 | if (ret) |
190 | goto err; | 187 | goto err; |
191 | 188 | ||
@@ -194,7 +191,6 @@ static int e4000_set_params(struct dvb_frontend *fe) | |||
194 | if (c->bandwidth_hz <= e4000_if_filter_lut[i].freq) | 191 | if (c->bandwidth_hz <= e4000_if_filter_lut[i].freq) |
195 | break; | 192 | break; |
196 | } | 193 | } |
197 | |||
198 | if (i == ARRAY_SIZE(e4000_if_filter_lut)) { | 194 | if (i == ARRAY_SIZE(e4000_if_filter_lut)) { |
199 | ret = -EINVAL; | 195 | ret = -EINVAL; |
200 | goto err; | 196 | goto err; |
@@ -203,7 +199,7 @@ static int e4000_set_params(struct dvb_frontend *fe) | |||
203 | buf[0] = e4000_if_filter_lut[i].reg11_val; | 199 | buf[0] = e4000_if_filter_lut[i].reg11_val; |
204 | buf[1] = e4000_if_filter_lut[i].reg12_val; | 200 | buf[1] = e4000_if_filter_lut[i].reg12_val; |
205 | 201 | ||
206 | ret = regmap_bulk_write(s->regmap, 0x11, buf, 2); | 202 | ret = regmap_bulk_write(dev->regmap, 0x11, buf, 2); |
207 | if (ret) | 203 | if (ret) |
208 | goto err; | 204 | goto err; |
209 | 205 | ||
@@ -212,39 +208,38 @@ static int e4000_set_params(struct dvb_frontend *fe) | |||
212 | if (c->frequency <= e4000_band_lut[i].freq) | 208 | if (c->frequency <= e4000_band_lut[i].freq) |
213 | break; | 209 | break; |
214 | } | 210 | } |
215 | |||
216 | if (i == ARRAY_SIZE(e4000_band_lut)) { | 211 | if (i == ARRAY_SIZE(e4000_band_lut)) { |
217 | ret = -EINVAL; | 212 | ret = -EINVAL; |
218 | goto err; | 213 | goto err; |
219 | } | 214 | } |
220 | 215 | ||
221 | ret = regmap_write(s->regmap, 0x07, e4000_band_lut[i].reg07_val); | 216 | ret = regmap_write(dev->regmap, 0x07, e4000_band_lut[i].reg07_val); |
222 | if (ret) | 217 | if (ret) |
223 | goto err; | 218 | goto err; |
224 | 219 | ||
225 | ret = regmap_write(s->regmap, 0x78, e4000_band_lut[i].reg78_val); | 220 | ret = regmap_write(dev->regmap, 0x78, e4000_band_lut[i].reg78_val); |
226 | if (ret) | 221 | if (ret) |
227 | goto err; | 222 | goto err; |
228 | 223 | ||
229 | /* DC offset */ | 224 | /* DC offset */ |
230 | for (i = 0; i < 4; i++) { | 225 | for (i = 0; i < 4; i++) { |
231 | if (i == 0) | 226 | if (i == 0) |
232 | ret = regmap_bulk_write(s->regmap, 0x15, "\x00\x7e\x24", 3); | 227 | ret = regmap_bulk_write(dev->regmap, 0x15, "\x00\x7e\x24", 3); |
233 | else if (i == 1) | 228 | else if (i == 1) |
234 | ret = regmap_bulk_write(s->regmap, 0x15, "\x00\x7f", 2); | 229 | ret = regmap_bulk_write(dev->regmap, 0x15, "\x00\x7f", 2); |
235 | else if (i == 2) | 230 | else if (i == 2) |
236 | ret = regmap_bulk_write(s->regmap, 0x15, "\x01", 1); | 231 | ret = regmap_bulk_write(dev->regmap, 0x15, "\x01", 1); |
237 | else | 232 | else |
238 | ret = regmap_bulk_write(s->regmap, 0x16, "\x7e", 1); | 233 | ret = regmap_bulk_write(dev->regmap, 0x16, "\x7e", 1); |
239 | 234 | ||
240 | if (ret) | 235 | if (ret) |
241 | goto err; | 236 | goto err; |
242 | 237 | ||
243 | ret = regmap_write(s->regmap, 0x29, 0x01); | 238 | ret = regmap_write(dev->regmap, 0x29, 0x01); |
244 | if (ret) | 239 | if (ret) |
245 | goto err; | 240 | goto err; |
246 | 241 | ||
247 | ret = regmap_bulk_read(s->regmap, 0x2a, buf, 3); | 242 | ret = regmap_bulk_read(dev->regmap, 0x2a, buf, 3); |
248 | if (ret) | 243 | if (ret) |
249 | goto err; | 244 | goto err; |
250 | 245 | ||
@@ -255,30 +250,31 @@ static int e4000_set_params(struct dvb_frontend *fe) | |||
255 | swap(q_data[2], q_data[3]); | 250 | swap(q_data[2], q_data[3]); |
256 | swap(i_data[2], i_data[3]); | 251 | swap(i_data[2], i_data[3]); |
257 | 252 | ||
258 | ret = regmap_bulk_write(s->regmap, 0x50, q_data, 4); | 253 | ret = regmap_bulk_write(dev->regmap, 0x50, q_data, 4); |
259 | if (ret) | 254 | if (ret) |
260 | goto err; | 255 | goto err; |
261 | 256 | ||
262 | ret = regmap_bulk_write(s->regmap, 0x60, i_data, 4); | 257 | ret = regmap_bulk_write(dev->regmap, 0x60, i_data, 4); |
263 | if (ret) | 258 | if (ret) |
264 | goto err; | 259 | goto err; |
265 | 260 | ||
266 | /* gain control auto */ | 261 | /* gain control auto */ |
267 | ret = regmap_write(s->regmap, 0x1a, 0x17); | 262 | ret = regmap_write(dev->regmap, 0x1a, 0x17); |
268 | if (ret) | 263 | if (ret) |
269 | goto err; | 264 | goto err; |
270 | err: | ||
271 | if (ret) | ||
272 | dev_dbg(&s->client->dev, "failed=%d\n", ret); | ||
273 | 265 | ||
266 | return 0; | ||
267 | err: | ||
268 | dev_dbg(&client->dev, "failed=%d\n", ret); | ||
274 | return ret; | 269 | return ret; |
275 | } | 270 | } |
276 | 271 | ||
277 | static int e4000_get_if_frequency(struct dvb_frontend *fe, u32 *frequency) | 272 | static int e4000_get_if_frequency(struct dvb_frontend *fe, u32 *frequency) |
278 | { | 273 | { |
279 | struct e4000 *s = fe->tuner_priv; | 274 | struct e4000_dev *dev = fe->tuner_priv; |
275 | struct i2c_client *client = dev->client; | ||
280 | 276 | ||
281 | dev_dbg(&s->client->dev, "\n"); | 277 | dev_dbg(&client->dev, "\n"); |
282 | 278 | ||
283 | *frequency = 0; /* Zero-IF */ | 279 | *frequency = 0; /* Zero-IF */ |
284 | 280 | ||
@@ -288,141 +284,146 @@ static int e4000_get_if_frequency(struct dvb_frontend *fe, u32 *frequency) | |||
288 | #if IS_ENABLED(CONFIG_VIDEO_V4L2) | 284 | #if IS_ENABLED(CONFIG_VIDEO_V4L2) |
289 | static int e4000_set_lna_gain(struct dvb_frontend *fe) | 285 | static int e4000_set_lna_gain(struct dvb_frontend *fe) |
290 | { | 286 | { |
291 | struct e4000 *s = fe->tuner_priv; | 287 | struct e4000_dev *dev = fe->tuner_priv; |
288 | struct i2c_client *client = dev->client; | ||
292 | int ret; | 289 | int ret; |
293 | u8 u8tmp; | 290 | u8 u8tmp; |
294 | 291 | ||
295 | dev_dbg(&s->client->dev, "lna auto=%d->%d val=%d->%d\n", | 292 | dev_dbg(&client->dev, "lna auto=%d->%d val=%d->%d\n", |
296 | s->lna_gain_auto->cur.val, s->lna_gain_auto->val, | 293 | dev->lna_gain_auto->cur.val, dev->lna_gain_auto->val, |
297 | s->lna_gain->cur.val, s->lna_gain->val); | 294 | dev->lna_gain->cur.val, dev->lna_gain->val); |
298 | 295 | ||
299 | if (s->lna_gain_auto->val && s->if_gain_auto->cur.val) | 296 | if (dev->lna_gain_auto->val && dev->if_gain_auto->cur.val) |
300 | u8tmp = 0x17; | 297 | u8tmp = 0x17; |
301 | else if (s->lna_gain_auto->val) | 298 | else if (dev->lna_gain_auto->val) |
302 | u8tmp = 0x19; | 299 | u8tmp = 0x19; |
303 | else if (s->if_gain_auto->cur.val) | 300 | else if (dev->if_gain_auto->cur.val) |
304 | u8tmp = 0x16; | 301 | u8tmp = 0x16; |
305 | else | 302 | else |
306 | u8tmp = 0x10; | 303 | u8tmp = 0x10; |
307 | 304 | ||
308 | ret = regmap_write(s->regmap, 0x1a, u8tmp); | 305 | ret = regmap_write(dev->regmap, 0x1a, u8tmp); |
309 | if (ret) | 306 | if (ret) |
310 | goto err; | 307 | goto err; |
311 | 308 | ||
312 | if (s->lna_gain_auto->val == false) { | 309 | if (dev->lna_gain_auto->val == false) { |
313 | ret = regmap_write(s->regmap, 0x14, s->lna_gain->val); | 310 | ret = regmap_write(dev->regmap, 0x14, dev->lna_gain->val); |
314 | if (ret) | 311 | if (ret) |
315 | goto err; | 312 | goto err; |
316 | } | 313 | } |
317 | err: | ||
318 | if (ret) | ||
319 | dev_dbg(&s->client->dev, "failed=%d\n", ret); | ||
320 | 314 | ||
315 | return 0; | ||
316 | err: | ||
317 | dev_dbg(&client->dev, "failed=%d\n", ret); | ||
321 | return ret; | 318 | return ret; |
322 | } | 319 | } |
323 | 320 | ||
324 | static int e4000_set_mixer_gain(struct dvb_frontend *fe) | 321 | static int e4000_set_mixer_gain(struct dvb_frontend *fe) |
325 | { | 322 | { |
326 | struct e4000 *s = fe->tuner_priv; | 323 | struct e4000_dev *dev = fe->tuner_priv; |
324 | struct i2c_client *client = dev->client; | ||
327 | int ret; | 325 | int ret; |
328 | u8 u8tmp; | 326 | u8 u8tmp; |
329 | 327 | ||
330 | dev_dbg(&s->client->dev, "mixer auto=%d->%d val=%d->%d\n", | 328 | dev_dbg(&client->dev, "mixer auto=%d->%d val=%d->%d\n", |
331 | s->mixer_gain_auto->cur.val, s->mixer_gain_auto->val, | 329 | dev->mixer_gain_auto->cur.val, dev->mixer_gain_auto->val, |
332 | s->mixer_gain->cur.val, s->mixer_gain->val); | 330 | dev->mixer_gain->cur.val, dev->mixer_gain->val); |
333 | 331 | ||
334 | if (s->mixer_gain_auto->val) | 332 | if (dev->mixer_gain_auto->val) |
335 | u8tmp = 0x15; | 333 | u8tmp = 0x15; |
336 | else | 334 | else |
337 | u8tmp = 0x14; | 335 | u8tmp = 0x14; |
338 | 336 | ||
339 | ret = regmap_write(s->regmap, 0x20, u8tmp); | 337 | ret = regmap_write(dev->regmap, 0x20, u8tmp); |
340 | if (ret) | 338 | if (ret) |
341 | goto err; | 339 | goto err; |
342 | 340 | ||
343 | if (s->mixer_gain_auto->val == false) { | 341 | if (dev->mixer_gain_auto->val == false) { |
344 | ret = regmap_write(s->regmap, 0x15, s->mixer_gain->val); | 342 | ret = regmap_write(dev->regmap, 0x15, dev->mixer_gain->val); |
345 | if (ret) | 343 | if (ret) |
346 | goto err; | 344 | goto err; |
347 | } | 345 | } |
348 | err: | ||
349 | if (ret) | ||
350 | dev_dbg(&s->client->dev, "failed=%d\n", ret); | ||
351 | 346 | ||
347 | return 0; | ||
348 | err: | ||
349 | dev_dbg(&client->dev, "failed=%d\n", ret); | ||
352 | return ret; | 350 | return ret; |
353 | } | 351 | } |
354 | 352 | ||
355 | static int e4000_set_if_gain(struct dvb_frontend *fe) | 353 | static int e4000_set_if_gain(struct dvb_frontend *fe) |
356 | { | 354 | { |
357 | struct e4000 *s = fe->tuner_priv; | 355 | struct e4000_dev *dev = fe->tuner_priv; |
356 | struct i2c_client *client = dev->client; | ||
358 | int ret; | 357 | int ret; |
359 | u8 buf[2]; | 358 | u8 buf[2]; |
360 | u8 u8tmp; | 359 | u8 u8tmp; |
361 | 360 | ||
362 | dev_dbg(&s->client->dev, "if auto=%d->%d val=%d->%d\n", | 361 | dev_dbg(&client->dev, "if auto=%d->%d val=%d->%d\n", |
363 | s->if_gain_auto->cur.val, s->if_gain_auto->val, | 362 | dev->if_gain_auto->cur.val, dev->if_gain_auto->val, |
364 | s->if_gain->cur.val, s->if_gain->val); | 363 | dev->if_gain->cur.val, dev->if_gain->val); |
365 | 364 | ||
366 | if (s->if_gain_auto->val && s->lna_gain_auto->cur.val) | 365 | if (dev->if_gain_auto->val && dev->lna_gain_auto->cur.val) |
367 | u8tmp = 0x17; | 366 | u8tmp = 0x17; |
368 | else if (s->lna_gain_auto->cur.val) | 367 | else if (dev->lna_gain_auto->cur.val) |
369 | u8tmp = 0x19; | 368 | u8tmp = 0x19; |
370 | else if (s->if_gain_auto->val) | 369 | else if (dev->if_gain_auto->val) |
371 | u8tmp = 0x16; | 370 | u8tmp = 0x16; |
372 | else | 371 | else |
373 | u8tmp = 0x10; | 372 | u8tmp = 0x10; |
374 | 373 | ||
375 | ret = regmap_write(s->regmap, 0x1a, u8tmp); | 374 | ret = regmap_write(dev->regmap, 0x1a, u8tmp); |
376 | if (ret) | 375 | if (ret) |
377 | goto err; | 376 | goto err; |
378 | 377 | ||
379 | if (s->if_gain_auto->val == false) { | 378 | if (dev->if_gain_auto->val == false) { |
380 | buf[0] = e4000_if_gain_lut[s->if_gain->val].reg16_val; | 379 | buf[0] = e4000_if_gain_lut[dev->if_gain->val].reg16_val; |
381 | buf[1] = e4000_if_gain_lut[s->if_gain->val].reg17_val; | 380 | buf[1] = e4000_if_gain_lut[dev->if_gain->val].reg17_val; |
382 | ret = regmap_bulk_write(s->regmap, 0x16, buf, 2); | 381 | ret = regmap_bulk_write(dev->regmap, 0x16, buf, 2); |
383 | if (ret) | 382 | if (ret) |
384 | goto err; | 383 | goto err; |
385 | } | 384 | } |
386 | err: | ||
387 | if (ret) | ||
388 | dev_dbg(&s->client->dev, "failed=%d\n", ret); | ||
389 | 385 | ||
386 | return 0; | ||
387 | err: | ||
388 | dev_dbg(&client->dev, "failed=%d\n", ret); | ||
390 | return ret; | 389 | return ret; |
391 | } | 390 | } |
392 | 391 | ||
393 | static int e4000_pll_lock(struct dvb_frontend *fe) | 392 | static int e4000_pll_lock(struct dvb_frontend *fe) |
394 | { | 393 | { |
395 | struct e4000 *s = fe->tuner_priv; | 394 | struct e4000_dev *dev = fe->tuner_priv; |
395 | struct i2c_client *client = dev->client; | ||
396 | int ret; | 396 | int ret; |
397 | unsigned int utmp; | 397 | unsigned int uitmp; |
398 | 398 | ||
399 | ret = regmap_read(s->regmap, 0x07, &utmp); | 399 | ret = regmap_read(dev->regmap, 0x07, &uitmp); |
400 | if (ret) | 400 | if (ret) |
401 | goto err; | 401 | goto err; |
402 | 402 | ||
403 | s->pll_lock->val = (utmp & 0x01); | 403 | dev->pll_lock->val = (uitmp & 0x01); |
404 | err: | ||
405 | if (ret) | ||
406 | dev_dbg(&s->client->dev, "failed=%d\n", ret); | ||
407 | 404 | ||
405 | return 0; | ||
406 | err: | ||
407 | dev_dbg(&client->dev, "failed=%d\n", ret); | ||
408 | return ret; | 408 | return ret; |
409 | } | 409 | } |
410 | 410 | ||
411 | static int e4000_g_volatile_ctrl(struct v4l2_ctrl *ctrl) | 411 | static int e4000_g_volatile_ctrl(struct v4l2_ctrl *ctrl) |
412 | { | 412 | { |
413 | struct e4000 *s = container_of(ctrl->handler, struct e4000, hdl); | 413 | struct e4000_dev *dev = container_of(ctrl->handler, struct e4000_dev, hdl); |
414 | struct i2c_client *client = dev->client; | ||
414 | int ret; | 415 | int ret; |
415 | 416 | ||
416 | if (!s->active) | 417 | if (!dev->active) |
417 | return 0; | 418 | return 0; |
418 | 419 | ||
419 | switch (ctrl->id) { | 420 | switch (ctrl->id) { |
420 | case V4L2_CID_RF_TUNER_PLL_LOCK: | 421 | case V4L2_CID_RF_TUNER_PLL_LOCK: |
421 | ret = e4000_pll_lock(s->fe); | 422 | ret = e4000_pll_lock(dev->fe); |
422 | break; | 423 | break; |
423 | default: | 424 | default: |
424 | dev_dbg(&s->client->dev, "unknown ctrl: id=%d name=%s\n", | 425 | dev_dbg(&client->dev, "unknown ctrl: id=%d name=%s\n", |
425 | ctrl->id, ctrl->name); | 426 | ctrl->id, ctrl->name); |
426 | ret = -EINVAL; | 427 | ret = -EINVAL; |
427 | } | 428 | } |
428 | 429 | ||
@@ -431,35 +432,35 @@ static int e4000_g_volatile_ctrl(struct v4l2_ctrl *ctrl) | |||
431 | 432 | ||
432 | static int e4000_s_ctrl(struct v4l2_ctrl *ctrl) | 433 | static int e4000_s_ctrl(struct v4l2_ctrl *ctrl) |
433 | { | 434 | { |
434 | struct e4000 *s = container_of(ctrl->handler, struct e4000, hdl); | 435 | struct e4000_dev *dev = container_of(ctrl->handler, struct e4000_dev, hdl); |
435 | struct dvb_frontend *fe = s->fe; | 436 | struct i2c_client *client = dev->client; |
436 | struct dtv_frontend_properties *c = &fe->dtv_property_cache; | 437 | struct dtv_frontend_properties *c = &dev->fe->dtv_property_cache; |
437 | int ret; | 438 | int ret; |
438 | 439 | ||
439 | if (!s->active) | 440 | if (!dev->active) |
440 | return 0; | 441 | return 0; |
441 | 442 | ||
442 | switch (ctrl->id) { | 443 | switch (ctrl->id) { |
443 | case V4L2_CID_RF_TUNER_BANDWIDTH_AUTO: | 444 | case V4L2_CID_RF_TUNER_BANDWIDTH_AUTO: |
444 | case V4L2_CID_RF_TUNER_BANDWIDTH: | 445 | case V4L2_CID_RF_TUNER_BANDWIDTH: |
445 | c->bandwidth_hz = s->bandwidth->val; | 446 | c->bandwidth_hz = dev->bandwidth->val; |
446 | ret = e4000_set_params(s->fe); | 447 | ret = e4000_set_params(dev->fe); |
447 | break; | 448 | break; |
448 | case V4L2_CID_RF_TUNER_LNA_GAIN_AUTO: | 449 | case V4L2_CID_RF_TUNER_LNA_GAIN_AUTO: |
449 | case V4L2_CID_RF_TUNER_LNA_GAIN: | 450 | case V4L2_CID_RF_TUNER_LNA_GAIN: |
450 | ret = e4000_set_lna_gain(s->fe); | 451 | ret = e4000_set_lna_gain(dev->fe); |
451 | break; | 452 | break; |
452 | case V4L2_CID_RF_TUNER_MIXER_GAIN_AUTO: | 453 | case V4L2_CID_RF_TUNER_MIXER_GAIN_AUTO: |
453 | case V4L2_CID_RF_TUNER_MIXER_GAIN: | 454 | case V4L2_CID_RF_TUNER_MIXER_GAIN: |
454 | ret = e4000_set_mixer_gain(s->fe); | 455 | ret = e4000_set_mixer_gain(dev->fe); |
455 | break; | 456 | break; |
456 | case V4L2_CID_RF_TUNER_IF_GAIN_AUTO: | 457 | case V4L2_CID_RF_TUNER_IF_GAIN_AUTO: |
457 | case V4L2_CID_RF_TUNER_IF_GAIN: | 458 | case V4L2_CID_RF_TUNER_IF_GAIN: |
458 | ret = e4000_set_if_gain(s->fe); | 459 | ret = e4000_set_if_gain(dev->fe); |
459 | break; | 460 | break; |
460 | default: | 461 | default: |
461 | dev_dbg(&s->client->dev, "unknown ctrl: id=%d name=%s\n", | 462 | dev_dbg(&client->dev, "unknown ctrl: id=%d name=%s\n", |
462 | ctrl->id, ctrl->name); | 463 | ctrl->id, ctrl->name); |
463 | ret = -EINVAL; | 464 | ret = -EINVAL; |
464 | } | 465 | } |
465 | 466 | ||
@@ -491,138 +492,129 @@ static const struct dvb_tuner_ops e4000_tuner_ops = { | |||
491 | * subdev itself, just to avoid reinventing the wheel. | 492 | * subdev itself, just to avoid reinventing the wheel. |
492 | */ | 493 | */ |
493 | static int e4000_probe(struct i2c_client *client, | 494 | static int e4000_probe(struct i2c_client *client, |
494 | const struct i2c_device_id *id) | 495 | const struct i2c_device_id *id) |
495 | { | 496 | { |
497 | struct e4000_dev *dev; | ||
496 | struct e4000_config *cfg = client->dev.platform_data; | 498 | struct e4000_config *cfg = client->dev.platform_data; |
497 | struct dvb_frontend *fe = cfg->fe; | 499 | struct dvb_frontend *fe = cfg->fe; |
498 | struct e4000 *s; | ||
499 | int ret; | 500 | int ret; |
500 | unsigned int utmp; | 501 | unsigned int uitmp; |
501 | static const struct regmap_config regmap_config = { | 502 | static const struct regmap_config regmap_config = { |
502 | .reg_bits = 8, | 503 | .reg_bits = 8, |
503 | .val_bits = 8, | 504 | .val_bits = 8, |
504 | .max_register = 0xff, | ||
505 | }; | 505 | }; |
506 | 506 | ||
507 | s = kzalloc(sizeof(struct e4000), GFP_KERNEL); | 507 | dev = kzalloc(sizeof(*dev), GFP_KERNEL); |
508 | if (!s) { | 508 | if (!dev) { |
509 | ret = -ENOMEM; | 509 | ret = -ENOMEM; |
510 | dev_err(&client->dev, "kzalloc() failed\n"); | ||
511 | goto err; | 510 | goto err; |
512 | } | 511 | } |
513 | 512 | ||
514 | s->clock = cfg->clock; | 513 | dev->clk = cfg->clock; |
515 | s->client = client; | 514 | dev->client = client; |
516 | s->fe = cfg->fe; | 515 | dev->fe = cfg->fe; |
517 | s->regmap = devm_regmap_init_i2c(client, ®map_config); | 516 | dev->regmap = devm_regmap_init_i2c(client, ®map_config); |
518 | if (IS_ERR(s->regmap)) { | 517 | if (IS_ERR(dev->regmap)) { |
519 | ret = PTR_ERR(s->regmap); | 518 | ret = PTR_ERR(dev->regmap); |
520 | goto err; | 519 | goto err_kfree; |
521 | } | 520 | } |
522 | 521 | ||
523 | /* check if the tuner is there */ | 522 | /* check if the tuner is there */ |
524 | ret = regmap_read(s->regmap, 0x02, &utmp); | 523 | ret = regmap_read(dev->regmap, 0x02, &uitmp); |
525 | if (ret) | 524 | if (ret) |
526 | goto err; | 525 | goto err_kfree; |
527 | 526 | ||
528 | dev_dbg(&s->client->dev, "chip id=%02x\n", utmp); | 527 | dev_dbg(&client->dev, "chip id=%02x\n", uitmp); |
529 | 528 | ||
530 | if (utmp != 0x40) { | 529 | if (uitmp != 0x40) { |
531 | ret = -ENODEV; | 530 | ret = -ENODEV; |
532 | goto err; | 531 | goto err_kfree; |
533 | } | 532 | } |
534 | 533 | ||
535 | /* put sleep as chip seems to be in normal mode by default */ | 534 | /* put sleep as chip seems to be in normal mode by default */ |
536 | ret = regmap_write(s->regmap, 0x00, 0x00); | 535 | ret = regmap_write(dev->regmap, 0x00, 0x00); |
537 | if (ret) | 536 | if (ret) |
538 | goto err; | 537 | goto err_kfree; |
539 | 538 | ||
540 | #if IS_ENABLED(CONFIG_VIDEO_V4L2) | 539 | #if IS_ENABLED(CONFIG_VIDEO_V4L2) |
541 | /* Register controls */ | 540 | /* Register controls */ |
542 | v4l2_ctrl_handler_init(&s->hdl, 9); | 541 | v4l2_ctrl_handler_init(&dev->hdl, 9); |
543 | s->bandwidth_auto = v4l2_ctrl_new_std(&s->hdl, &e4000_ctrl_ops, | 542 | dev->bandwidth_auto = v4l2_ctrl_new_std(&dev->hdl, &e4000_ctrl_ops, |
544 | V4L2_CID_RF_TUNER_BANDWIDTH_AUTO, 0, 1, 1, 1); | 543 | V4L2_CID_RF_TUNER_BANDWIDTH_AUTO, 0, 1, 1, 1); |
545 | s->bandwidth = v4l2_ctrl_new_std(&s->hdl, &e4000_ctrl_ops, | 544 | dev->bandwidth = v4l2_ctrl_new_std(&dev->hdl, &e4000_ctrl_ops, |
546 | V4L2_CID_RF_TUNER_BANDWIDTH, 4300000, 11000000, 100000, 4300000); | 545 | V4L2_CID_RF_TUNER_BANDWIDTH, 4300000, 11000000, 100000, 4300000); |
547 | v4l2_ctrl_auto_cluster(2, &s->bandwidth_auto, 0, false); | 546 | v4l2_ctrl_auto_cluster(2, &dev->bandwidth_auto, 0, false); |
548 | s->lna_gain_auto = v4l2_ctrl_new_std(&s->hdl, &e4000_ctrl_ops, | 547 | dev->lna_gain_auto = v4l2_ctrl_new_std(&dev->hdl, &e4000_ctrl_ops, |
549 | V4L2_CID_RF_TUNER_LNA_GAIN_AUTO, 0, 1, 1, 1); | 548 | V4L2_CID_RF_TUNER_LNA_GAIN_AUTO, 0, 1, 1, 1); |
550 | s->lna_gain = v4l2_ctrl_new_std(&s->hdl, &e4000_ctrl_ops, | 549 | dev->lna_gain = v4l2_ctrl_new_std(&dev->hdl, &e4000_ctrl_ops, |
551 | V4L2_CID_RF_TUNER_LNA_GAIN, 0, 15, 1, 10); | 550 | V4L2_CID_RF_TUNER_LNA_GAIN, 0, 15, 1, 10); |
552 | v4l2_ctrl_auto_cluster(2, &s->lna_gain_auto, 0, false); | 551 | v4l2_ctrl_auto_cluster(2, &dev->lna_gain_auto, 0, false); |
553 | s->mixer_gain_auto = v4l2_ctrl_new_std(&s->hdl, &e4000_ctrl_ops, | 552 | dev->mixer_gain_auto = v4l2_ctrl_new_std(&dev->hdl, &e4000_ctrl_ops, |
554 | V4L2_CID_RF_TUNER_MIXER_GAIN_AUTO, 0, 1, 1, 1); | 553 | V4L2_CID_RF_TUNER_MIXER_GAIN_AUTO, 0, 1, 1, 1); |
555 | s->mixer_gain = v4l2_ctrl_new_std(&s->hdl, &e4000_ctrl_ops, | 554 | dev->mixer_gain = v4l2_ctrl_new_std(&dev->hdl, &e4000_ctrl_ops, |
556 | V4L2_CID_RF_TUNER_MIXER_GAIN, 0, 1, 1, 1); | 555 | V4L2_CID_RF_TUNER_MIXER_GAIN, 0, 1, 1, 1); |
557 | v4l2_ctrl_auto_cluster(2, &s->mixer_gain_auto, 0, false); | 556 | v4l2_ctrl_auto_cluster(2, &dev->mixer_gain_auto, 0, false); |
558 | s->if_gain_auto = v4l2_ctrl_new_std(&s->hdl, &e4000_ctrl_ops, | 557 | dev->if_gain_auto = v4l2_ctrl_new_std(&dev->hdl, &e4000_ctrl_ops, |
559 | V4L2_CID_RF_TUNER_IF_GAIN_AUTO, 0, 1, 1, 1); | 558 | V4L2_CID_RF_TUNER_IF_GAIN_AUTO, 0, 1, 1, 1); |
560 | s->if_gain = v4l2_ctrl_new_std(&s->hdl, &e4000_ctrl_ops, | 559 | dev->if_gain = v4l2_ctrl_new_std(&dev->hdl, &e4000_ctrl_ops, |
561 | V4L2_CID_RF_TUNER_IF_GAIN, 0, 54, 1, 0); | 560 | V4L2_CID_RF_TUNER_IF_GAIN, 0, 54, 1, 0); |
562 | v4l2_ctrl_auto_cluster(2, &s->if_gain_auto, 0, false); | 561 | v4l2_ctrl_auto_cluster(2, &dev->if_gain_auto, 0, false); |
563 | s->pll_lock = v4l2_ctrl_new_std(&s->hdl, &e4000_ctrl_ops, | 562 | dev->pll_lock = v4l2_ctrl_new_std(&dev->hdl, &e4000_ctrl_ops, |
564 | V4L2_CID_RF_TUNER_PLL_LOCK, 0, 1, 1, 0); | 563 | V4L2_CID_RF_TUNER_PLL_LOCK, 0, 1, 1, 0); |
565 | if (s->hdl.error) { | 564 | if (dev->hdl.error) { |
566 | ret = s->hdl.error; | 565 | ret = dev->hdl.error; |
567 | dev_err(&s->client->dev, "Could not initialize controls\n"); | 566 | dev_err(&client->dev, "Could not initialize controls\n"); |
568 | v4l2_ctrl_handler_free(&s->hdl); | 567 | v4l2_ctrl_handler_free(&dev->hdl); |
569 | goto err; | 568 | goto err_kfree; |
570 | } | 569 | } |
571 | 570 | ||
572 | s->sd.ctrl_handler = &s->hdl; | 571 | dev->sd.ctrl_handler = &dev->hdl; |
573 | #endif | 572 | #endif |
574 | 573 | fe->tuner_priv = dev; | |
575 | dev_info(&s->client->dev, "Elonics E4000 successfully identified\n"); | ||
576 | |||
577 | fe->tuner_priv = s; | ||
578 | memcpy(&fe->ops.tuner_ops, &e4000_tuner_ops, | 574 | memcpy(&fe->ops.tuner_ops, &e4000_tuner_ops, |
579 | sizeof(struct dvb_tuner_ops)); | 575 | sizeof(struct dvb_tuner_ops)); |
576 | v4l2_set_subdevdata(&dev->sd, client); | ||
577 | i2c_set_clientdata(client, &dev->sd); | ||
580 | 578 | ||
581 | v4l2_set_subdevdata(&s->sd, client); | 579 | dev_info(&client->dev, "Elonics E4000 successfully identified\n"); |
582 | i2c_set_clientdata(client, &s->sd); | ||
583 | |||
584 | return 0; | 580 | return 0; |
581 | err_kfree: | ||
582 | kfree(dev); | ||
585 | err: | 583 | err: |
586 | if (ret) { | 584 | dev_dbg(&client->dev, "failed=%d\n", ret); |
587 | dev_dbg(&client->dev, "failed=%d\n", ret); | ||
588 | kfree(s); | ||
589 | } | ||
590 | |||
591 | return ret; | 585 | return ret; |
592 | } | 586 | } |
593 | 587 | ||
594 | static int e4000_remove(struct i2c_client *client) | 588 | static int e4000_remove(struct i2c_client *client) |
595 | { | 589 | { |
596 | struct v4l2_subdev *sd = i2c_get_clientdata(client); | 590 | struct v4l2_subdev *sd = i2c_get_clientdata(client); |
597 | struct e4000 *s = container_of(sd, struct e4000, sd); | 591 | struct e4000_dev *dev = container_of(sd, struct e4000_dev, sd); |
598 | struct dvb_frontend *fe = s->fe; | ||
599 | 592 | ||
600 | dev_dbg(&client->dev, "\n"); | 593 | dev_dbg(&client->dev, "\n"); |
601 | 594 | ||
602 | #if IS_ENABLED(CONFIG_VIDEO_V4L2) | 595 | #if IS_ENABLED(CONFIG_VIDEO_V4L2) |
603 | v4l2_ctrl_handler_free(&s->hdl); | 596 | v4l2_ctrl_handler_free(&dev->hdl); |
604 | #endif | 597 | #endif |
605 | memset(&fe->ops.tuner_ops, 0, sizeof(struct dvb_tuner_ops)); | 598 | kfree(dev); |
606 | fe->tuner_priv = NULL; | ||
607 | kfree(s); | ||
608 | 599 | ||
609 | return 0; | 600 | return 0; |
610 | } | 601 | } |
611 | 602 | ||
612 | static const struct i2c_device_id e4000_id[] = { | 603 | static const struct i2c_device_id e4000_id_table[] = { |
613 | {"e4000", 0}, | 604 | {"e4000", 0}, |
614 | {} | 605 | {} |
615 | }; | 606 | }; |
616 | MODULE_DEVICE_TABLE(i2c, e4000_id); | 607 | MODULE_DEVICE_TABLE(i2c, e4000_id_table); |
617 | 608 | ||
618 | static struct i2c_driver e4000_driver = { | 609 | static struct i2c_driver e4000_driver = { |
619 | .driver = { | 610 | .driver = { |
620 | .owner = THIS_MODULE, | 611 | .owner = THIS_MODULE, |
621 | .name = "e4000", | 612 | .name = "e4000", |
613 | .suppress_bind_attrs = true, | ||
622 | }, | 614 | }, |
623 | .probe = e4000_probe, | 615 | .probe = e4000_probe, |
624 | .remove = e4000_remove, | 616 | .remove = e4000_remove, |
625 | .id_table = e4000_id, | 617 | .id_table = e4000_id_table, |
626 | }; | 618 | }; |
627 | 619 | ||
628 | module_i2c_driver(e4000_driver); | 620 | module_i2c_driver(e4000_driver); |
diff --git a/drivers/media/tuners/e4000.h b/drivers/media/tuners/e4000.h index e74b8b2f2fc3..aa9340c05b43 100644 --- a/drivers/media/tuners/e4000.h +++ b/drivers/media/tuners/e4000.h | |||
@@ -21,7 +21,6 @@ | |||
21 | #ifndef E4000_H | 21 | #ifndef E4000_H |
22 | #define E4000_H | 22 | #define E4000_H |
23 | 23 | ||
24 | #include <linux/kconfig.h> | ||
25 | #include "dvb_frontend.h" | 24 | #include "dvb_frontend.h" |
26 | 25 | ||
27 | /* | 26 | /* |
diff --git a/drivers/media/tuners/e4000_priv.h b/drivers/media/tuners/e4000_priv.h index 6214fc05bf70..8e991df9509e 100644 --- a/drivers/media/tuners/e4000_priv.h +++ b/drivers/media/tuners/e4000_priv.h | |||
@@ -22,14 +22,15 @@ | |||
22 | #define E4000_PRIV_H | 22 | #define E4000_PRIV_H |
23 | 23 | ||
24 | #include "e4000.h" | 24 | #include "e4000.h" |
25 | #include <linux/math64.h> | ||
25 | #include <media/v4l2-ctrls.h> | 26 | #include <media/v4l2-ctrls.h> |
26 | #include <media/v4l2-subdev.h> | 27 | #include <media/v4l2-subdev.h> |
27 | #include <linux/regmap.h> | 28 | #include <linux/regmap.h> |
28 | 29 | ||
29 | struct e4000 { | 30 | struct e4000_dev { |
30 | struct i2c_client *client; | 31 | struct i2c_client *client; |
31 | struct regmap *regmap; | 32 | struct regmap *regmap; |
32 | u32 clock; | 33 | u32 clk; |
33 | struct dvb_frontend *fe; | 34 | struct dvb_frontend *fe; |
34 | struct v4l2_subdev sd; | 35 | struct v4l2_subdev sd; |
35 | bool active; | 36 | bool active; |