diff options
author | Michael Krufky <mkrufky@linuxtv.org> | 2008-09-03 15:46:40 -0400 |
---|---|---|
committer | Mauro Carvalho Chehab <mchehab@redhat.com> | 2008-09-03 17:36:20 -0400 |
commit | df76de098de0118cdcf6ec0e60cb4063837f8def (patch) | |
tree | f82ce60ede175be290abe96fd9b631ca8936cc71 /drivers/media/dvb | |
parent | 8e8bd229eef385ab420d4fa51c611d4ddc7cb0c8 (diff) |
V4L/DVB (8598): au8522: clean up function au8522_set_if
re-write this function to make it simpler
Signed-off-by: Michael Krufky <mkrufky@linuxtv.org>
Signed-off-by: Mauro Carvalho Chehab <mchehab@infradead.org>
Diffstat (limited to 'drivers/media/dvb')
-rw-r--r-- | drivers/media/dvb/frontends/au8522.c | 65 |
1 files changed, 19 insertions, 46 deletions
diff --git a/drivers/media/dvb/frontends/au8522.c b/drivers/media/dvb/frontends/au8522.c index 5741bc930792..92c8fbe0d6ca 100644 --- a/drivers/media/dvb/frontends/au8522.c +++ b/drivers/media/dvb/frontends/au8522.c | |||
@@ -304,67 +304,40 @@ static int au8522_mse2snr_lookup(struct mse2snr_tab *tab, int sz, int mse, | |||
304 | return ret; | 304 | return ret; |
305 | } | 305 | } |
306 | 306 | ||
307 | /* 3.25 MHz IF Frequency table */ | ||
308 | static struct { | ||
309 | u16 reg; | ||
310 | u16 data; | ||
311 | } if_3_25_mhz_tab[] = { | ||
312 | { 0x80b5, 0x00 }, | ||
313 | { 0x80b6, 0x3d }, | ||
314 | { 0x80b7, 0xa0 }, | ||
315 | }; | ||
316 | |||
317 | /* 4.00 MHz IF Frequency table */ | ||
318 | static struct { | ||
319 | u16 reg; | ||
320 | u16 data; | ||
321 | } if_4_mhz_tab[] = { | ||
322 | { 0x80b5, 0x00 }, | ||
323 | { 0x80b6, 0x4b }, | ||
324 | { 0x80b7, 0xd9 }, | ||
325 | }; | ||
326 | |||
327 | /* 6.00 MHz IF Frequency table */ | ||
328 | static struct { | ||
329 | u16 reg; | ||
330 | u16 data; | ||
331 | } if_6_mhz_tab[] = { | ||
332 | { 0x80b5, 0xfb }, | ||
333 | { 0x80b6, 0x8e }, | ||
334 | { 0x80b7, 0x39 }, | ||
335 | }; | ||
336 | |||
337 | static int au8522_set_if(struct dvb_frontend *fe, enum au8522_if_freq if_freq) | 307 | static int au8522_set_if(struct dvb_frontend *fe, enum au8522_if_freq if_freq) |
338 | { | 308 | { |
339 | struct au8522_state *state = fe->demodulator_priv; | 309 | struct au8522_state *state = fe->demodulator_priv; |
340 | int i; | 310 | u8 r0b5, r0b6, r0b7; |
311 | char *ifmhz; | ||
341 | 312 | ||
342 | switch (if_freq) { | 313 | switch (if_freq) { |
343 | case AU8522_IF_3_25MHZ: | 314 | case AU8522_IF_3_25MHZ: |
344 | dprintk("%s() 3.25 MHz\n", __func__); | 315 | ifmhz = "3.25"; |
345 | for (i = 0; i < ARRAY_SIZE(if_3_25_mhz_tab); i++) | 316 | r0b5 = 0x00; |
346 | au8522_writereg(state, | 317 | r0b6 = 0x3d; |
347 | if_3_25_mhz_tab[i].reg, | 318 | r0b7 = 0xa0; |
348 | if_3_25_mhz_tab[i].data); | ||
349 | break; | 319 | break; |
350 | case AU8522_IF_4MHZ: | 320 | case AU8522_IF_4MHZ: |
351 | dprintk("%s() 4.00 MHz\n", __func__); | 321 | ifmhz = "4.00"; |
352 | for (i = 0; i < ARRAY_SIZE(if_4_mhz_tab); i++) | 322 | r0b5 = 0x00; |
353 | au8522_writereg(state, | 323 | r0b6 = 0x4b; |
354 | if_4_mhz_tab[i].reg, | 324 | r0b7 = 0xd9; |
355 | if_4_mhz_tab[i].data); | ||
356 | break; | 325 | break; |
357 | case AU8522_IF_6MHZ: | 326 | case AU8522_IF_6MHZ: |
358 | dprintk("%s() 6.00 MHz\n", __func__); | 327 | ifmhz = "6.00"; |
359 | for (i = 0; i < ARRAY_SIZE(if_6_mhz_tab); i++) | 328 | r0b5 = 0xfb; |
360 | au8522_writereg(state, | 329 | r0b6 = 0x8e; |
361 | if_6_mhz_tab[i].reg, | 330 | r0b7 = 0x39; |
362 | if_6_mhz_tab[i].data); | ||
363 | break; | 331 | break; |
364 | default: | 332 | default: |
365 | dprintk("%s() IF Frequency not supported\n", __func__); | 333 | dprintk("%s() IF Frequency not supported\n", __func__); |
366 | return -EINVAL; | 334 | return -EINVAL; |
367 | } | 335 | } |
336 | dprintk("%s() %s MHz\n", __func__, ifmhz); | ||
337 | au8522_writereg(state, 0x80b5, r0b5); | ||
338 | au8522_writereg(state, 0x80b6, r0b6); | ||
339 | au8522_writereg(state, 0x80b7, r0b7); | ||
340 | |||
368 | return 0; | 341 | return 0; |
369 | } | 342 | } |
370 | 343 | ||