diff options
author | Michael Krufky <mkrufky@linuxtv.org> | 2011-11-03 07:39:12 -0400 |
---|---|---|
committer | Mauro Carvalho Chehab <mchehab@redhat.com> | 2011-11-08 05:23:22 -0500 |
commit | f7901f9b4ae06d65537ff3db8605e657f6d4afce (patch) | |
tree | 15c5c3971eb4388a9d9b631ff14f29c21559ecf6 /drivers/media/dvb/dvb-usb | |
parent | ff17999184ed13829bc14c3be412d980173dff40 (diff) |
[media] mxl111sf: add mxl111sf_tuner_get_if_frequency
Reported-by: Antti Palosaari <crope@iki.fi>
Signed-off-by: Michael Krufky <mkrufky@linuxtv.org>
Signed-off-by: Mauro Carvalho Chehab <mchehab@redhat.com>
Diffstat (limited to 'drivers/media/dvb/dvb-usb')
-rw-r--r-- | drivers/media/dvb/dvb-usb/mxl111sf-tuner.c | 56 |
1 files changed, 55 insertions, 1 deletions
diff --git a/drivers/media/dvb/dvb-usb/mxl111sf-tuner.c b/drivers/media/dvb/dvb-usb/mxl111sf-tuner.c index a6341058c4e7..3bfc6d8368a8 100644 --- a/drivers/media/dvb/dvb-usb/mxl111sf-tuner.c +++ b/drivers/media/dvb/dvb-usb/mxl111sf-tuner.c | |||
@@ -38,6 +38,8 @@ struct mxl111sf_tuner_state { | |||
38 | 38 | ||
39 | struct mxl111sf_tuner_config *cfg; | 39 | struct mxl111sf_tuner_config *cfg; |
40 | 40 | ||
41 | enum mxl_if_freq if_freq; | ||
42 | |||
41 | u32 frequency; | 43 | u32 frequency; |
42 | u32 bandwidth; | 44 | u32 bandwidth; |
43 | }; | 45 | }; |
@@ -186,7 +188,10 @@ static int mxl1x1sf_tuner_set_if_output_freq(struct mxl111sf_tuner_state *state) | |||
186 | ctrl = iffcw & 0x00ff; | 188 | ctrl = iffcw & 0x00ff; |
187 | #endif | 189 | #endif |
188 | ret = mxl111sf_tuner_write_reg(state, V6_TUNER_IF_FCW_REG, ctrl); | 190 | ret = mxl111sf_tuner_write_reg(state, V6_TUNER_IF_FCW_REG, ctrl); |
189 | mxl_fail(ret); | 191 | if (mxl_fail(ret)) |
192 | goto fail; | ||
193 | |||
194 | state->if_freq = state->cfg->if_freq; | ||
190 | fail: | 195 | fail: |
191 | return ret; | 196 | return ret; |
192 | } | 197 | } |
@@ -407,6 +412,54 @@ static int mxl111sf_tuner_get_bandwidth(struct dvb_frontend *fe, u32 *bandwidth) | |||
407 | return 0; | 412 | return 0; |
408 | } | 413 | } |
409 | 414 | ||
415 | static int mxl111sf_tuner_get_if_frequency(struct dvb_frontend *fe, | ||
416 | u32 *frequency) | ||
417 | { | ||
418 | struct mxl111sf_tuner_state *state = fe->tuner_priv; | ||
419 | |||
420 | *frequency = 0; | ||
421 | |||
422 | switch (state->if_freq) { | ||
423 | case MXL_IF_4_0: /* 4.0 MHz */ | ||
424 | *frequency = 4000000; | ||
425 | break; | ||
426 | case MXL_IF_4_5: /* 4.5 MHz */ | ||
427 | *frequency = 4500000; | ||
428 | break; | ||
429 | case MXL_IF_4_57: /* 4.57 MHz */ | ||
430 | *frequency = 4570000; | ||
431 | break; | ||
432 | case MXL_IF_5_0: /* 5.0 MHz */ | ||
433 | *frequency = 5000000; | ||
434 | break; | ||
435 | case MXL_IF_5_38: /* 5.38 MHz */ | ||
436 | *frequency = 5380000; | ||
437 | break; | ||
438 | case MXL_IF_6_0: /* 6.0 MHz */ | ||
439 | *frequency = 6000000; | ||
440 | break; | ||
441 | case MXL_IF_6_28: /* 6.28 MHz */ | ||
442 | *frequency = 6280000; | ||
443 | break; | ||
444 | case MXL_IF_7_2: /* 7.2 MHz */ | ||
445 | *frequency = 7200000; | ||
446 | break; | ||
447 | case MXL_IF_35_25: /* 35.25 MHz */ | ||
448 | *frequency = 35250000; | ||
449 | break; | ||
450 | case MXL_IF_36: /* 36 MHz */ | ||
451 | *frequency = 36000000; | ||
452 | break; | ||
453 | case MXL_IF_36_15: /* 36.15 MHz */ | ||
454 | *frequency = 36150000; | ||
455 | break; | ||
456 | case MXL_IF_44: /* 44 MHz */ | ||
457 | *frequency = 44000000; | ||
458 | break; | ||
459 | } | ||
460 | return 0; | ||
461 | } | ||
462 | |||
410 | static int mxl111sf_tuner_release(struct dvb_frontend *fe) | 463 | static int mxl111sf_tuner_release(struct dvb_frontend *fe) |
411 | { | 464 | { |
412 | struct mxl111sf_tuner_state *state = fe->tuner_priv; | 465 | struct mxl111sf_tuner_state *state = fe->tuner_priv; |
@@ -436,6 +489,7 @@ static struct dvb_tuner_ops mxl111sf_tuner_tuner_ops = { | |||
436 | .get_rf_strength = mxl111sf_get_rf_strength, | 489 | .get_rf_strength = mxl111sf_get_rf_strength, |
437 | .get_frequency = mxl111sf_tuner_get_frequency, | 490 | .get_frequency = mxl111sf_tuner_get_frequency, |
438 | .get_bandwidth = mxl111sf_tuner_get_bandwidth, | 491 | .get_bandwidth = mxl111sf_tuner_get_bandwidth, |
492 | .get_if_frequency = mxl111sf_tuner_get_if_frequency, | ||
439 | .release = mxl111sf_tuner_release, | 493 | .release = mxl111sf_tuner_release, |
440 | }; | 494 | }; |
441 | 495 | ||