aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorAntti Palosaari <crope@iki.fi>2014-02-10 20:52:51 -0500
committerMauro Carvalho Chehab <m.chehab@samsung.com>2014-03-14 04:38:39 -0400
commitc5f51b15829d5e5dc65a9628cf4fbdcfd97636bf (patch)
tree5b4c9e42582d8a0fcb602c9dc2229d727b0cbab0
parentbd428bbc7527d4ea195712598c1c252ebb4554ae (diff)
[media] e4000: rename some variables
Rename some variables. Change error status checks from (ret < 0) to (ret). No actual functionality changes. Signed-off-by: Antti Palosaari <crope@iki.fi> Signed-off-by: Mauro Carvalho Chehab <m.chehab@samsung.com>
-rw-r--r--drivers/media/tuners/e4000.c332
-rw-r--r--drivers/media/tuners/e4000_priv.h2
2 files changed, 167 insertions, 167 deletions
diff --git a/drivers/media/tuners/e4000.c b/drivers/media/tuners/e4000.c
index f382b90f98b7..3b5255062a0d 100644
--- a/drivers/media/tuners/e4000.c
+++ b/drivers/media/tuners/e4000.c
@@ -23,110 +23,110 @@
23 23
24static int e4000_init(struct dvb_frontend *fe) 24static int e4000_init(struct dvb_frontend *fe)
25{ 25{
26 struct e4000_priv *priv = fe->tuner_priv; 26 struct e4000 *s = fe->tuner_priv;
27 int ret; 27 int ret;
28 28
29 dev_dbg(&priv->client->dev, "%s:\n", __func__); 29 dev_dbg(&s->client->dev, "%s:\n", __func__);
30 30
31 /* dummy I2C to ensure I2C wakes up */ 31 /* dummy I2C to ensure I2C wakes up */
32 ret = regmap_write(priv->regmap, 0x02, 0x40); 32 ret = regmap_write(s->regmap, 0x02, 0x40);
33 33
34 /* reset */ 34 /* reset */
35 ret = regmap_write(priv->regmap, 0x00, 0x01); 35 ret = regmap_write(s->regmap, 0x00, 0x01);
36 if (ret < 0) 36 if (ret)
37 goto err; 37 goto err;
38 38
39 /* disable output clock */ 39 /* disable output clock */
40 ret = regmap_write(priv->regmap, 0x06, 0x00); 40 ret = regmap_write(s->regmap, 0x06, 0x00);
41 if (ret < 0) 41 if (ret)
42 goto err; 42 goto err;
43 43
44 ret = regmap_write(priv->regmap, 0x7a, 0x96); 44 ret = regmap_write(s->regmap, 0x7a, 0x96);
45 if (ret < 0) 45 if (ret)
46 goto err; 46 goto err;
47 47
48 /* configure gains */ 48 /* configure gains */
49 ret = regmap_bulk_write(priv->regmap, 0x7e, "\x01\xfe", 2); 49 ret = regmap_bulk_write(s->regmap, 0x7e, "\x01\xfe", 2);
50 if (ret < 0) 50 if (ret)
51 goto err; 51 goto err;
52 52
53 ret = regmap_write(priv->regmap, 0x82, 0x00); 53 ret = regmap_write(s->regmap, 0x82, 0x00);
54 if (ret < 0) 54 if (ret)
55 goto err; 55 goto err;
56 56
57 ret = regmap_write(priv->regmap, 0x24, 0x05); 57 ret = regmap_write(s->regmap, 0x24, 0x05);
58 if (ret < 0) 58 if (ret)
59 goto err; 59 goto err;
60 60
61 ret = regmap_bulk_write(priv->regmap, 0x87, "\x20\x01", 2); 61 ret = regmap_bulk_write(s->regmap, 0x87, "\x20\x01", 2);
62 if (ret < 0) 62 if (ret)
63 goto err; 63 goto err;
64 64
65 ret = regmap_bulk_write(priv->regmap, 0x9f, "\x7f\x07", 2); 65 ret = regmap_bulk_write(s->regmap, 0x9f, "\x7f\x07", 2);
66 if (ret < 0) 66 if (ret)
67 goto err; 67 goto err;
68 68
69 /* DC offset control */ 69 /* DC offset control */
70 ret = regmap_write(priv->regmap, 0x2d, 0x1f); 70 ret = regmap_write(s->regmap, 0x2d, 0x1f);
71 if (ret < 0) 71 if (ret)
72 goto err; 72 goto err;
73 73
74 ret = regmap_bulk_write(priv->regmap, 0x70, "\x01\x01", 2); 74 ret = regmap_bulk_write(s->regmap, 0x70, "\x01\x01", 2);
75 if (ret < 0) 75 if (ret)
76 goto err; 76 goto err;
77 77
78 /* gain control */ 78 /* gain control */
79 ret = regmap_write(priv->regmap, 0x1a, 0x17); 79 ret = regmap_write(s->regmap, 0x1a, 0x17);
80 if (ret < 0) 80 if (ret)
81 goto err; 81 goto err;
82 82
83 ret = regmap_write(priv->regmap, 0x1f, 0x1a); 83 ret = regmap_write(s->regmap, 0x1f, 0x1a);
84 if (ret < 0) 84 if (ret)
85 goto err; 85 goto err;
86 86
87 priv->active = true; 87 s->active = true;
88err: 88err:
89 if (ret) 89 if (ret)
90 dev_dbg(&priv->client->dev, "%s: failed=%d\n", __func__, ret); 90 dev_dbg(&s->client->dev, "%s: failed=%d\n", __func__, ret);
91 91
92 return ret; 92 return ret;
93} 93}
94 94
95static int e4000_sleep(struct dvb_frontend *fe) 95static int e4000_sleep(struct dvb_frontend *fe)
96{ 96{
97 struct e4000_priv *priv = fe->tuner_priv; 97 struct e4000 *s = fe->tuner_priv;
98 int ret; 98 int ret;
99 99
100 dev_dbg(&priv->client->dev, "%s:\n", __func__); 100 dev_dbg(&s->client->dev, "%s:\n", __func__);
101 101
102 priv->active = false; 102 s->active = false;
103 103
104 ret = regmap_write(priv->regmap, 0x00, 0x00); 104 ret = regmap_write(s->regmap, 0x00, 0x00);
105 if (ret < 0) 105 if (ret)
106 goto err; 106 goto err;
107err: 107err:
108 if (ret) 108 if (ret)
109 dev_dbg(&priv->client->dev, "%s: failed=%d\n", __func__, ret); 109 dev_dbg(&s->client->dev, "%s: failed=%d\n", __func__, ret);
110 110
111 return ret; 111 return ret;
112} 112}
113 113
114static int e4000_set_params(struct dvb_frontend *fe) 114static int e4000_set_params(struct dvb_frontend *fe)
115{ 115{
116 struct e4000_priv *priv = fe->tuner_priv; 116 struct e4000 *s = fe->tuner_priv;
117 struct dtv_frontend_properties *c = &fe->dtv_property_cache; 117 struct dtv_frontend_properties *c = &fe->dtv_property_cache;
118 int ret, i, sigma_delta; 118 int ret, i, sigma_delta;
119 u64 f_vco; 119 u64 f_vco;
120 u8 buf[5], i_data[4], q_data[4]; 120 u8 buf[5], i_data[4], q_data[4];
121 121
122 dev_dbg(&priv->client->dev, 122 dev_dbg(&s->client->dev,
123 "%s: delivery_system=%d frequency=%u bandwidth_hz=%u\n", 123 "%s: delivery_system=%d frequency=%u bandwidth_hz=%u\n",
124 __func__, c->delivery_system, c->frequency, 124 __func__, c->delivery_system, c->frequency,
125 c->bandwidth_hz); 125 c->bandwidth_hz);
126 126
127 /* gain control manual */ 127 /* gain control manual */
128 ret = regmap_write(priv->regmap, 0x1a, 0x00); 128 ret = regmap_write(s->regmap, 0x1a, 0x00);
129 if (ret < 0) 129 if (ret)
130 goto err; 130 goto err;
131 131
132 /* PLL */ 132 /* PLL */
@@ -141,19 +141,19 @@ static int e4000_set_params(struct dvb_frontend *fe)
141 } 141 }
142 142
143 f_vco = 1ull * c->frequency * e4000_pll_lut[i].mul; 143 f_vco = 1ull * c->frequency * e4000_pll_lut[i].mul;
144 sigma_delta = div_u64(0x10000ULL * (f_vco % priv->clock), priv->clock); 144 sigma_delta = div_u64(0x10000ULL * (f_vco % s->clock), s->clock);
145 buf[0] = div_u64(f_vco, priv->clock); 145 buf[0] = div_u64(f_vco, s->clock);
146 buf[1] = (sigma_delta >> 0) & 0xff; 146 buf[1] = (sigma_delta >> 0) & 0xff;
147 buf[2] = (sigma_delta >> 8) & 0xff; 147 buf[2] = (sigma_delta >> 8) & 0xff;
148 buf[3] = 0x00; 148 buf[3] = 0x00;
149 buf[4] = e4000_pll_lut[i].div; 149 buf[4] = e4000_pll_lut[i].div;
150 150
151 dev_dbg(&priv->client->dev, 151 dev_dbg(&s->client->dev,
152 "%s: f_vco=%llu pll div=%d sigma_delta=%04x\n", 152 "%s: f_vco=%llu pll div=%d sigma_delta=%04x\n",
153 __func__, f_vco, buf[0], sigma_delta); 153 __func__, f_vco, buf[0], sigma_delta);
154 154
155 ret = regmap_bulk_write(priv->regmap, 0x09, buf, 5); 155 ret = regmap_bulk_write(s->regmap, 0x09, buf, 5);
156 if (ret < 0) 156 if (ret)
157 goto err; 157 goto err;
158 158
159 /* LNA filter (RF filter) */ 159 /* LNA filter (RF filter) */
@@ -167,8 +167,8 @@ static int e4000_set_params(struct dvb_frontend *fe)
167 goto err; 167 goto err;
168 } 168 }
169 169
170 ret = regmap_write(priv->regmap, 0x10, e400_lna_filter_lut[i].val); 170 ret = regmap_write(s->regmap, 0x10, e400_lna_filter_lut[i].val);
171 if (ret < 0) 171 if (ret)
172 goto err; 172 goto err;
173 173
174 /* IF filters */ 174 /* IF filters */
@@ -185,8 +185,8 @@ static int e4000_set_params(struct dvb_frontend *fe)
185 buf[0] = e4000_if_filter_lut[i].reg11_val; 185 buf[0] = e4000_if_filter_lut[i].reg11_val;
186 buf[1] = e4000_if_filter_lut[i].reg12_val; 186 buf[1] = e4000_if_filter_lut[i].reg12_val;
187 187
188 ret = regmap_bulk_write(priv->regmap, 0x11, buf, 2); 188 ret = regmap_bulk_write(s->regmap, 0x11, buf, 2);
189 if (ret < 0) 189 if (ret)
190 goto err; 190 goto err;
191 191
192 /* frequency band */ 192 /* frequency band */
@@ -200,34 +200,34 @@ static int e4000_set_params(struct dvb_frontend *fe)
200 goto err; 200 goto err;
201 } 201 }
202 202
203 ret = regmap_write(priv->regmap, 0x07, e4000_band_lut[i].reg07_val); 203 ret = regmap_write(s->regmap, 0x07, e4000_band_lut[i].reg07_val);
204 if (ret < 0) 204 if (ret)
205 goto err; 205 goto err;
206 206
207 ret = regmap_write(priv->regmap, 0x78, e4000_band_lut[i].reg78_val); 207 ret = regmap_write(s->regmap, 0x78, e4000_band_lut[i].reg78_val);
208 if (ret < 0) 208 if (ret)
209 goto err; 209 goto err;
210 210
211 /* DC offset */ 211 /* DC offset */
212 for (i = 0; i < 4; i++) { 212 for (i = 0; i < 4; i++) {
213 if (i == 0) 213 if (i == 0)
214 ret = regmap_bulk_write(priv->regmap, 0x15, "\x00\x7e\x24", 3); 214 ret = regmap_bulk_write(s->regmap, 0x15, "\x00\x7e\x24", 3);
215 else if (i == 1) 215 else if (i == 1)
216 ret = regmap_bulk_write(priv->regmap, 0x15, "\x00\x7f", 2); 216 ret = regmap_bulk_write(s->regmap, 0x15, "\x00\x7f", 2);
217 else if (i == 2) 217 else if (i == 2)
218 ret = regmap_bulk_write(priv->regmap, 0x15, "\x01", 1); 218 ret = regmap_bulk_write(s->regmap, 0x15, "\x01", 1);
219 else 219 else
220 ret = regmap_bulk_write(priv->regmap, 0x16, "\x7e", 1); 220 ret = regmap_bulk_write(s->regmap, 0x16, "\x7e", 1);
221 221
222 if (ret < 0) 222 if (ret)
223 goto err; 223 goto err;
224 224
225 ret = regmap_write(priv->regmap, 0x29, 0x01); 225 ret = regmap_write(s->regmap, 0x29, 0x01);
226 if (ret < 0) 226 if (ret)
227 goto err; 227 goto err;
228 228
229 ret = regmap_bulk_read(priv->regmap, 0x2a, buf, 3); 229 ret = regmap_bulk_read(s->regmap, 0x2a, buf, 3);
230 if (ret < 0) 230 if (ret)
231 goto err; 231 goto err;
232 232
233 i_data[i] = (((buf[2] >> 0) & 0x3) << 6) | (buf[0] & 0x3f); 233 i_data[i] = (((buf[2] >> 0) & 0x3) << 6) | (buf[0] & 0x3f);
@@ -237,30 +237,30 @@ static int e4000_set_params(struct dvb_frontend *fe)
237 swap(q_data[2], q_data[3]); 237 swap(q_data[2], q_data[3]);
238 swap(i_data[2], i_data[3]); 238 swap(i_data[2], i_data[3]);
239 239
240 ret = regmap_bulk_write(priv->regmap, 0x50, q_data, 4); 240 ret = regmap_bulk_write(s->regmap, 0x50, q_data, 4);
241 if (ret < 0) 241 if (ret)
242 goto err; 242 goto err;
243 243
244 ret = regmap_bulk_write(priv->regmap, 0x60, i_data, 4); 244 ret = regmap_bulk_write(s->regmap, 0x60, i_data, 4);
245 if (ret < 0) 245 if (ret)
246 goto err; 246 goto err;
247 247
248 /* gain control auto */ 248 /* gain control auto */
249 ret = regmap_write(priv->regmap, 0x1a, 0x17); 249 ret = regmap_write(s->regmap, 0x1a, 0x17);
250 if (ret < 0) 250 if (ret)
251 goto err; 251 goto err;
252err: 252err:
253 if (ret) 253 if (ret)
254 dev_dbg(&priv->client->dev, "%s: failed=%d\n", __func__, ret); 254 dev_dbg(&s->client->dev, "%s: failed=%d\n", __func__, ret);
255 255
256 return ret; 256 return ret;
257} 257}
258 258
259static int e4000_get_if_frequency(struct dvb_frontend *fe, u32 *frequency) 259static int e4000_get_if_frequency(struct dvb_frontend *fe, u32 *frequency)
260{ 260{
261 struct e4000_priv *priv = fe->tuner_priv; 261 struct e4000 *s = fe->tuner_priv;
262 262
263 dev_dbg(&priv->client->dev, "%s:\n", __func__); 263 dev_dbg(&s->client->dev, "%s:\n", __func__);
264 264
265 *frequency = 0; /* Zero-IF */ 265 *frequency = 0; /* Zero-IF */
266 266
@@ -269,143 +269,143 @@ static int e4000_get_if_frequency(struct dvb_frontend *fe, u32 *frequency)
269 269
270static int e4000_set_lna_gain(struct dvb_frontend *fe) 270static int e4000_set_lna_gain(struct dvb_frontend *fe)
271{ 271{
272 struct e4000_priv *priv = fe->tuner_priv; 272 struct e4000 *s = fe->tuner_priv;
273 int ret; 273 int ret;
274 u8 u8tmp; 274 u8 u8tmp;
275 275
276 dev_dbg(&priv->client->dev, "%s: lna auto=%d->%d val=%d->%d\n", 276 dev_dbg(&s->client->dev, "%s: lna auto=%d->%d val=%d->%d\n",
277 __func__, priv->lna_gain_auto->cur.val, 277 __func__, s->lna_gain_auto->cur.val,
278 priv->lna_gain_auto->val, priv->lna_gain->cur.val, 278 s->lna_gain_auto->val, s->lna_gain->cur.val,
279 priv->lna_gain->val); 279 s->lna_gain->val);
280 280
281 if (priv->lna_gain_auto->val && priv->if_gain_auto->cur.val) 281 if (s->lna_gain_auto->val && s->if_gain_auto->cur.val)
282 u8tmp = 0x17; 282 u8tmp = 0x17;
283 else if (priv->lna_gain_auto->val) 283 else if (s->lna_gain_auto->val)
284 u8tmp = 0x19; 284 u8tmp = 0x19;
285 else if (priv->if_gain_auto->cur.val) 285 else if (s->if_gain_auto->cur.val)
286 u8tmp = 0x16; 286 u8tmp = 0x16;
287 else 287 else
288 u8tmp = 0x10; 288 u8tmp = 0x10;
289 289
290 ret = regmap_write(priv->regmap, 0x1a, u8tmp); 290 ret = regmap_write(s->regmap, 0x1a, u8tmp);
291 if (ret) 291 if (ret)
292 goto err; 292 goto err;
293 293
294 if (priv->lna_gain_auto->val == false) { 294 if (s->lna_gain_auto->val == false) {
295 ret = regmap_write(priv->regmap, 0x14, priv->lna_gain->val); 295 ret = regmap_write(s->regmap, 0x14, s->lna_gain->val);
296 if (ret) 296 if (ret)
297 goto err; 297 goto err;
298 } 298 }
299err: 299err:
300 if (ret) 300 if (ret)
301 dev_dbg(&priv->client->dev, "%s: failed=%d\n", __func__, ret); 301 dev_dbg(&s->client->dev, "%s: failed=%d\n", __func__, ret);
302 302
303 return ret; 303 return ret;
304} 304}
305 305
306static int e4000_set_mixer_gain(struct dvb_frontend *fe) 306static int e4000_set_mixer_gain(struct dvb_frontend *fe)
307{ 307{
308 struct e4000_priv *priv = fe->tuner_priv; 308 struct e4000 *s = fe->tuner_priv;
309 int ret; 309 int ret;
310 u8 u8tmp; 310 u8 u8tmp;
311 311
312 dev_dbg(&priv->client->dev, "%s: mixer auto=%d->%d val=%d->%d\n", 312 dev_dbg(&s->client->dev, "%s: mixer auto=%d->%d val=%d->%d\n",
313 __func__, priv->mixer_gain_auto->cur.val, 313 __func__, s->mixer_gain_auto->cur.val,
314 priv->mixer_gain_auto->val, priv->mixer_gain->cur.val, 314 s->mixer_gain_auto->val, s->mixer_gain->cur.val,
315 priv->mixer_gain->val); 315 s->mixer_gain->val);
316 316
317 if (priv->mixer_gain_auto->val) 317 if (s->mixer_gain_auto->val)
318 u8tmp = 0x15; 318 u8tmp = 0x15;
319 else 319 else
320 u8tmp = 0x14; 320 u8tmp = 0x14;
321 321
322 ret = regmap_write(priv->regmap, 0x20, u8tmp); 322 ret = regmap_write(s->regmap, 0x20, u8tmp);
323 if (ret) 323 if (ret)
324 goto err; 324 goto err;
325 325
326 if (priv->mixer_gain_auto->val == false) { 326 if (s->mixer_gain_auto->val == false) {
327 ret = regmap_write(priv->regmap, 0x15, priv->mixer_gain->val); 327 ret = regmap_write(s->regmap, 0x15, s->mixer_gain->val);
328 if (ret) 328 if (ret)
329 goto err; 329 goto err;
330 } 330 }
331err: 331err:
332 if (ret) 332 if (ret)
333 dev_dbg(&priv->client->dev, "%s: failed=%d\n", __func__, ret); 333 dev_dbg(&s->client->dev, "%s: failed=%d\n", __func__, ret);
334 334
335 return ret; 335 return ret;
336} 336}
337 337
338static int e4000_set_if_gain(struct dvb_frontend *fe) 338static int e4000_set_if_gain(struct dvb_frontend *fe)
339{ 339{
340 struct e4000_priv *priv = fe->tuner_priv; 340 struct e4000 *s = fe->tuner_priv;
341 int ret; 341 int ret;
342 u8 buf[2]; 342 u8 buf[2];
343 u8 u8tmp; 343 u8 u8tmp;
344 344
345 dev_dbg(&priv->client->dev, "%s: if auto=%d->%d val=%d->%d\n", 345 dev_dbg(&s->client->dev, "%s: if auto=%d->%d val=%d->%d\n",
346 __func__, priv->if_gain_auto->cur.val, 346 __func__, s->if_gain_auto->cur.val,
347 priv->if_gain_auto->val, priv->if_gain->cur.val, 347 s->if_gain_auto->val, s->if_gain->cur.val,
348 priv->if_gain->val); 348 s->if_gain->val);
349 349
350 if (priv->if_gain_auto->val && priv->lna_gain_auto->cur.val) 350 if (s->if_gain_auto->val && s->lna_gain_auto->cur.val)
351 u8tmp = 0x17; 351 u8tmp = 0x17;
352 else if (priv->lna_gain_auto->cur.val) 352 else if (s->lna_gain_auto->cur.val)
353 u8tmp = 0x19; 353 u8tmp = 0x19;
354 else if (priv->if_gain_auto->val) 354 else if (s->if_gain_auto->val)
355 u8tmp = 0x16; 355 u8tmp = 0x16;
356 else 356 else
357 u8tmp = 0x10; 357 u8tmp = 0x10;
358 358
359 ret = regmap_write(priv->regmap, 0x1a, u8tmp); 359 ret = regmap_write(s->regmap, 0x1a, u8tmp);
360 if (ret) 360 if (ret)
361 goto err; 361 goto err;
362 362
363 if (priv->if_gain_auto->val == false) { 363 if (s->if_gain_auto->val == false) {
364 buf[0] = e4000_if_gain_lut[priv->if_gain->val].reg16_val; 364 buf[0] = e4000_if_gain_lut[s->if_gain->val].reg16_val;
365 buf[1] = e4000_if_gain_lut[priv->if_gain->val].reg17_val; 365 buf[1] = e4000_if_gain_lut[s->if_gain->val].reg17_val;
366 ret = regmap_bulk_write(priv->regmap, 0x16, buf, 2); 366 ret = regmap_bulk_write(s->regmap, 0x16, buf, 2);
367 if (ret) 367 if (ret)
368 goto err; 368 goto err;
369 } 369 }
370err: 370err:
371 if (ret) 371 if (ret)
372 dev_dbg(&priv->client->dev, "%s: failed=%d\n", __func__, ret); 372 dev_dbg(&s->client->dev, "%s: failed=%d\n", __func__, ret);
373 373
374 return ret; 374 return ret;
375} 375}
376 376
377static int e4000_pll_lock(struct dvb_frontend *fe) 377static int e4000_pll_lock(struct dvb_frontend *fe)
378{ 378{
379 struct e4000_priv *priv = fe->tuner_priv; 379 struct e4000 *s = fe->tuner_priv;
380 int ret; 380 int ret;
381 unsigned int utmp; 381 unsigned int utmp;
382 382
383 ret = regmap_read(priv->regmap, 0x07, &utmp); 383 ret = regmap_read(s->regmap, 0x07, &utmp);
384 if (ret < 0) 384 if (ret)
385 goto err; 385 goto err;
386 386
387 priv->pll_lock->val = (utmp & 0x01); 387 s->pll_lock->val = (utmp & 0x01);
388err: 388err:
389 if (ret) 389 if (ret)
390 dev_dbg(&priv->client->dev, "%s: failed=%d\n", __func__, ret); 390 dev_dbg(&s->client->dev, "%s: failed=%d\n", __func__, ret);
391 391
392 return ret; 392 return ret;
393} 393}
394 394
395static int e4000_g_volatile_ctrl(struct v4l2_ctrl *ctrl) 395static int e4000_g_volatile_ctrl(struct v4l2_ctrl *ctrl)
396{ 396{
397 struct e4000_priv *priv = container_of(ctrl->handler, struct e4000_priv, hdl); 397 struct e4000 *s = container_of(ctrl->handler, struct e4000, hdl);
398 int ret; 398 int ret;
399 399
400 if (priv->active == false) 400 if (s->active == false)
401 return 0; 401 return 0;
402 402
403 switch (ctrl->id) { 403 switch (ctrl->id) {
404 case V4L2_CID_RF_TUNER_PLL_LOCK: 404 case V4L2_CID_RF_TUNER_PLL_LOCK:
405 ret = e4000_pll_lock(priv->fe); 405 ret = e4000_pll_lock(s->fe);
406 break; 406 break;
407 default: 407 default:
408 dev_dbg(&priv->client->dev, "%s: unknown ctrl: id=%d name=%s\n", 408 dev_dbg(&s->client->dev, "%s: unknown ctrl: id=%d name=%s\n",
409 __func__, ctrl->id, ctrl->name); 409 __func__, ctrl->id, ctrl->name);
410 ret = -EINVAL; 410 ret = -EINVAL;
411 } 411 }
@@ -415,34 +415,34 @@ static int e4000_g_volatile_ctrl(struct v4l2_ctrl *ctrl)
415 415
416static int e4000_s_ctrl(struct v4l2_ctrl *ctrl) 416static int e4000_s_ctrl(struct v4l2_ctrl *ctrl)
417{ 417{
418 struct e4000_priv *priv = container_of(ctrl->handler, struct e4000_priv, hdl); 418 struct e4000 *s = container_of(ctrl->handler, struct e4000, hdl);
419 struct dvb_frontend *fe = priv->fe; 419 struct dvb_frontend *fe = s->fe;
420 struct dtv_frontend_properties *c = &fe->dtv_property_cache; 420 struct dtv_frontend_properties *c = &fe->dtv_property_cache;
421 int ret; 421 int ret;
422 422
423 if (priv->active == false) 423 if (s->active == false)
424 return 0; 424 return 0;
425 425
426 switch (ctrl->id) { 426 switch (ctrl->id) {
427 case V4L2_CID_RF_TUNER_BANDWIDTH_AUTO: 427 case V4L2_CID_RF_TUNER_BANDWIDTH_AUTO:
428 case V4L2_CID_RF_TUNER_BANDWIDTH: 428 case V4L2_CID_RF_TUNER_BANDWIDTH:
429 c->bandwidth_hz = priv->bandwidth->val; 429 c->bandwidth_hz = s->bandwidth->val;
430 ret = e4000_set_params(priv->fe); 430 ret = e4000_set_params(s->fe);
431 break; 431 break;
432 case V4L2_CID_RF_TUNER_LNA_GAIN_AUTO: 432 case V4L2_CID_RF_TUNER_LNA_GAIN_AUTO:
433 case V4L2_CID_RF_TUNER_LNA_GAIN: 433 case V4L2_CID_RF_TUNER_LNA_GAIN:
434 ret = e4000_set_lna_gain(priv->fe); 434 ret = e4000_set_lna_gain(s->fe);
435 break; 435 break;
436 case V4L2_CID_RF_TUNER_MIXER_GAIN_AUTO: 436 case V4L2_CID_RF_TUNER_MIXER_GAIN_AUTO:
437 case V4L2_CID_RF_TUNER_MIXER_GAIN: 437 case V4L2_CID_RF_TUNER_MIXER_GAIN:
438 ret = e4000_set_mixer_gain(priv->fe); 438 ret = e4000_set_mixer_gain(s->fe);
439 break; 439 break;
440 case V4L2_CID_RF_TUNER_IF_GAIN_AUTO: 440 case V4L2_CID_RF_TUNER_IF_GAIN_AUTO:
441 case V4L2_CID_RF_TUNER_IF_GAIN: 441 case V4L2_CID_RF_TUNER_IF_GAIN:
442 ret = e4000_set_if_gain(priv->fe); 442 ret = e4000_set_if_gain(s->fe);
443 break; 443 break;
444 default: 444 default:
445 dev_dbg(&priv->client->dev, "%s: unknown ctrl: id=%d name=%s\n", 445 dev_dbg(&s->client->dev, "%s: unknown ctrl: id=%d name=%s\n",
446 __func__, ctrl->id, ctrl->name); 446 __func__, ctrl->id, ctrl->name);
447 ret = -EINVAL; 447 ret = -EINVAL;
448 } 448 }
@@ -478,7 +478,7 @@ static int e4000_probe(struct i2c_client *client,
478{ 478{
479 struct e4000_config *cfg = client->dev.platform_data; 479 struct e4000_config *cfg = client->dev.platform_data;
480 struct dvb_frontend *fe = cfg->fe; 480 struct dvb_frontend *fe = cfg->fe;
481 struct e4000_priv *priv; 481 struct e4000 *s;
482 int ret; 482 int ret;
483 unsigned int utmp; 483 unsigned int utmp;
484 static const struct regmap_config regmap_config = { 484 static const struct regmap_config regmap_config = {
@@ -487,28 +487,28 @@ static int e4000_probe(struct i2c_client *client,
487 .max_register = 0xff, 487 .max_register = 0xff,
488 }; 488 };
489 489
490 priv = kzalloc(sizeof(struct e4000_priv), GFP_KERNEL); 490 s = kzalloc(sizeof(struct e4000), GFP_KERNEL);
491 if (!priv) { 491 if (!s) {
492 ret = -ENOMEM; 492 ret = -ENOMEM;
493 dev_err(&client->dev, "%s: kzalloc() failed\n", KBUILD_MODNAME); 493 dev_err(&client->dev, "%s: kzalloc() failed\n", KBUILD_MODNAME);
494 goto err; 494 goto err;
495 } 495 }
496 496
497 priv->clock = cfg->clock; 497 s->clock = cfg->clock;
498 priv->client = client; 498 s->client = client;
499 priv->fe = cfg->fe; 499 s->fe = cfg->fe;
500 priv->regmap = devm_regmap_init_i2c(client, &regmap_config); 500 s->regmap = devm_regmap_init_i2c(client, &regmap_config);
501 if (IS_ERR(priv->regmap)) { 501 if (IS_ERR(s->regmap)) {
502 ret = PTR_ERR(priv->regmap); 502 ret = PTR_ERR(s->regmap);
503 goto err; 503 goto err;
504 } 504 }
505 505
506 /* check if the tuner is there */ 506 /* check if the tuner is there */
507 ret = regmap_read(priv->regmap, 0x02, &utmp); 507 ret = regmap_read(s->regmap, 0x02, &utmp);
508 if (ret < 0) 508 if (ret)
509 goto err; 509 goto err;
510 510
511 dev_dbg(&priv->client->dev, "%s: chip id=%02x\n", __func__, utmp); 511 dev_dbg(&s->client->dev, "%s: chip id=%02x\n", __func__, utmp);
512 512
513 if (utmp != 0x40) { 513 if (utmp != 0x40) {
514 ret = -ENODEV; 514 ret = -ENODEV;
@@ -516,59 +516,59 @@ static int e4000_probe(struct i2c_client *client,
516 } 516 }
517 517
518 /* put sleep as chip seems to be in normal mode by default */ 518 /* put sleep as chip seems to be in normal mode by default */
519 ret = regmap_write(priv->regmap, 0x00, 0x00); 519 ret = regmap_write(s->regmap, 0x00, 0x00);
520 if (ret < 0) 520 if (ret)
521 goto err; 521 goto err;
522 522
523 /* Register controls */ 523 /* Register controls */
524 v4l2_ctrl_handler_init(&priv->hdl, 9); 524 v4l2_ctrl_handler_init(&s->hdl, 9);
525 priv->bandwidth_auto = v4l2_ctrl_new_std(&priv->hdl, &e4000_ctrl_ops, 525 s->bandwidth_auto = v4l2_ctrl_new_std(&s->hdl, &e4000_ctrl_ops,
526 V4L2_CID_RF_TUNER_BANDWIDTH_AUTO, 0, 1, 1, 1); 526 V4L2_CID_RF_TUNER_BANDWIDTH_AUTO, 0, 1, 1, 1);
527 priv->bandwidth = v4l2_ctrl_new_std(&priv->hdl, &e4000_ctrl_ops, 527 s->bandwidth = v4l2_ctrl_new_std(&s->hdl, &e4000_ctrl_ops,
528 V4L2_CID_RF_TUNER_BANDWIDTH, 4300000, 11000000, 100000, 4300000); 528 V4L2_CID_RF_TUNER_BANDWIDTH, 4300000, 11000000, 100000, 4300000);
529 v4l2_ctrl_auto_cluster(2, &priv->bandwidth_auto, 0, false); 529 v4l2_ctrl_auto_cluster(2, &s->bandwidth_auto, 0, false);
530 priv->lna_gain_auto = v4l2_ctrl_new_std(&priv->hdl, &e4000_ctrl_ops, 530 s->lna_gain_auto = v4l2_ctrl_new_std(&s->hdl, &e4000_ctrl_ops,
531 V4L2_CID_RF_TUNER_LNA_GAIN_AUTO, 0, 1, 1, 1); 531 V4L2_CID_RF_TUNER_LNA_GAIN_AUTO, 0, 1, 1, 1);
532 priv->lna_gain = v4l2_ctrl_new_std(&priv->hdl, &e4000_ctrl_ops, 532 s->lna_gain = v4l2_ctrl_new_std(&s->hdl, &e4000_ctrl_ops,
533 V4L2_CID_RF_TUNER_LNA_GAIN, 0, 15, 1, 10); 533 V4L2_CID_RF_TUNER_LNA_GAIN, 0, 15, 1, 10);
534 v4l2_ctrl_auto_cluster(2, &priv->lna_gain_auto, 0, false); 534 v4l2_ctrl_auto_cluster(2, &s->lna_gain_auto, 0, false);
535 priv->mixer_gain_auto = v4l2_ctrl_new_std(&priv->hdl, &e4000_ctrl_ops, 535 s->mixer_gain_auto = v4l2_ctrl_new_std(&s->hdl, &e4000_ctrl_ops,
536 V4L2_CID_RF_TUNER_MIXER_GAIN_AUTO, 0, 1, 1, 1); 536 V4L2_CID_RF_TUNER_MIXER_GAIN_AUTO, 0, 1, 1, 1);
537 priv->mixer_gain = v4l2_ctrl_new_std(&priv->hdl, &e4000_ctrl_ops, 537 s->mixer_gain = v4l2_ctrl_new_std(&s->hdl, &e4000_ctrl_ops,
538 V4L2_CID_RF_TUNER_MIXER_GAIN, 0, 1, 1, 1); 538 V4L2_CID_RF_TUNER_MIXER_GAIN, 0, 1, 1, 1);
539 v4l2_ctrl_auto_cluster(2, &priv->mixer_gain_auto, 0, false); 539 v4l2_ctrl_auto_cluster(2, &s->mixer_gain_auto, 0, false);
540 priv->if_gain_auto = v4l2_ctrl_new_std(&priv->hdl, &e4000_ctrl_ops, 540 s->if_gain_auto = v4l2_ctrl_new_std(&s->hdl, &e4000_ctrl_ops,
541 V4L2_CID_RF_TUNER_IF_GAIN_AUTO, 0, 1, 1, 1); 541 V4L2_CID_RF_TUNER_IF_GAIN_AUTO, 0, 1, 1, 1);
542 priv->if_gain = v4l2_ctrl_new_std(&priv->hdl, &e4000_ctrl_ops, 542 s->if_gain = v4l2_ctrl_new_std(&s->hdl, &e4000_ctrl_ops,
543 V4L2_CID_RF_TUNER_IF_GAIN, 0, 54, 1, 0); 543 V4L2_CID_RF_TUNER_IF_GAIN, 0, 54, 1, 0);
544 v4l2_ctrl_auto_cluster(2, &priv->if_gain_auto, 0, false); 544 v4l2_ctrl_auto_cluster(2, &s->if_gain_auto, 0, false);
545 priv->pll_lock = v4l2_ctrl_new_std(&priv->hdl, &e4000_ctrl_ops, 545 s->pll_lock = v4l2_ctrl_new_std(&s->hdl, &e4000_ctrl_ops,
546 V4L2_CID_RF_TUNER_PLL_LOCK, 0, 1, 1, 0); 546 V4L2_CID_RF_TUNER_PLL_LOCK, 0, 1, 1, 0);
547 if (priv->hdl.error) { 547 if (s->hdl.error) {
548 ret = priv->hdl.error; 548 ret = s->hdl.error;
549 dev_err(&priv->client->dev, "Could not initialize controls\n"); 549 dev_err(&s->client->dev, "Could not initialize controls\n");
550 v4l2_ctrl_handler_free(&priv->hdl); 550 v4l2_ctrl_handler_free(&s->hdl);
551 goto err; 551 goto err;
552 } 552 }
553 553
554 priv->sd.ctrl_handler = &priv->hdl; 554 s->sd.ctrl_handler = &s->hdl;
555 555
556 dev_info(&priv->client->dev, 556 dev_info(&s->client->dev,
557 "%s: Elonics E4000 successfully identified\n", 557 "%s: Elonics E4000 successfully identified\n",
558 KBUILD_MODNAME); 558 KBUILD_MODNAME);
559 559
560 fe->tuner_priv = priv; 560 fe->tuner_priv = s;
561 memcpy(&fe->ops.tuner_ops, &e4000_tuner_ops, 561 memcpy(&fe->ops.tuner_ops, &e4000_tuner_ops,
562 sizeof(struct dvb_tuner_ops)); 562 sizeof(struct dvb_tuner_ops));
563 563
564 v4l2_set_subdevdata(&priv->sd, client); 564 v4l2_set_subdevdata(&s->sd, client);
565 i2c_set_clientdata(client, &priv->sd); 565 i2c_set_clientdata(client, &s->sd);
566 566
567 return 0; 567 return 0;
568err: 568err:
569 if (ret) { 569 if (ret) {
570 dev_dbg(&client->dev, "%s: failed=%d\n", __func__, ret); 570 dev_dbg(&client->dev, "%s: failed=%d\n", __func__, ret);
571 kfree(priv); 571 kfree(s);
572 } 572 }
573 573
574 return ret; 574 return ret;
@@ -577,15 +577,15 @@ err:
577static int e4000_remove(struct i2c_client *client) 577static int e4000_remove(struct i2c_client *client)
578{ 578{
579 struct v4l2_subdev *sd = i2c_get_clientdata(client); 579 struct v4l2_subdev *sd = i2c_get_clientdata(client);
580 struct e4000_priv *priv = container_of(sd, struct e4000_priv, sd); 580 struct e4000 *s = container_of(sd, struct e4000, sd);
581 struct dvb_frontend *fe = priv->fe; 581 struct dvb_frontend *fe = s->fe;
582 582
583 dev_dbg(&client->dev, "%s:\n", __func__); 583 dev_dbg(&client->dev, "%s:\n", __func__);
584 584
585 v4l2_ctrl_handler_free(&priv->hdl); 585 v4l2_ctrl_handler_free(&s->hdl);
586 memset(&fe->ops.tuner_ops, 0, sizeof(struct dvb_tuner_ops)); 586 memset(&fe->ops.tuner_ops, 0, sizeof(struct dvb_tuner_ops));
587 fe->tuner_priv = NULL; 587 fe->tuner_priv = NULL;
588 kfree(priv); 588 kfree(s);
589 589
590 return 0; 590 return 0;
591} 591}
diff --git a/drivers/media/tuners/e4000_priv.h b/drivers/media/tuners/e4000_priv.h
index e772b00cefb9..cb0070483e65 100644
--- a/drivers/media/tuners/e4000_priv.h
+++ b/drivers/media/tuners/e4000_priv.h
@@ -26,7 +26,7 @@
26#include <media/v4l2-subdev.h> 26#include <media/v4l2-subdev.h>
27#include <linux/regmap.h> 27#include <linux/regmap.h>
28 28
29struct e4000_priv { 29struct e4000 {
30 struct i2c_client *client; 30 struct i2c_client *client;
31 struct regmap *regmap; 31 struct regmap *regmap;
32 u32 clock; 32 u32 clock;