]> git.karo-electronics.de Git - linux-beck.git/commitdiff
[media] mxl5007t: add mxl5007t_get_if_frequency
authorMichael Krufky <mkrufky@linuxtv.org>
Thu, 3 Nov 2011 12:12:04 +0000 (09:12 -0300)
committerMauro Carvalho Chehab <mchehab@redhat.com>
Tue, 8 Nov 2011 10:24:13 +0000 (08:24 -0200)
Reported-by: Antti Palosaari <crope@iki.fi>
Signed-off-by: Michael Krufky <mkrufky@linuxtv.org>
Signed-off-by: Mauro Carvalho Chehab <mchehab@redhat.com>
drivers/media/common/tuners/mxl5007t.c

index 7eb1bf75cd072ae634b816a8a496ccfd8a559127..2f0e550ad93545a5322ca744ff12e7865db025b5 100644 (file)
@@ -165,6 +165,8 @@ struct mxl5007t_state {
        struct reg_pair_t tab_init_cable[ARRAY_SIZE(init_tab_cable)];
        struct reg_pair_t tab_rftune[ARRAY_SIZE(reg_pair_rftune)];
 
+       enum mxl5007t_if_freq if_freq;
+
        u32 frequency;
        u32 bandwidth;
 };
@@ -286,6 +288,8 @@ static void mxl5007t_set_if_freq_bits(struct mxl5007t_state *state,
        /* set inverted IF or normal IF */
        set_reg_bits(state->tab_init, 0x02, 0x10, invert_if ? 0x10 : 0x00);
 
+       state->if_freq = if_freq;
+
        return;
 }
 
@@ -737,6 +741,50 @@ static int mxl5007t_get_bandwidth(struct dvb_frontend *fe, u32 *bandwidth)
        return 0;
 }
 
+static int mxl5007t_get_if_frequency(struct dvb_frontend *fe, u32 *frequency)
+{
+       struct mxl5007t_state *state = fe->tuner_priv;
+
+       *frequency = 0;
+
+       switch (state->if_freq) {
+       case MxL_IF_4_MHZ:
+               *frequency = 4000000;
+               break;
+       case MxL_IF_4_5_MHZ:
+               *frequency = 4500000;
+               break;
+       case MxL_IF_4_57_MHZ:
+               *frequency = 4570000;
+               break;
+       case MxL_IF_5_MHZ:
+               *frequency = 5000000;
+               break;
+       case MxL_IF_5_38_MHZ:
+               *frequency = 5380000;
+               break;
+       case MxL_IF_6_MHZ:
+               *frequency = 6000000;
+               break;
+       case MxL_IF_6_28_MHZ:
+               *frequency = 6280000;
+               break;
+       case MxL_IF_9_1915_MHZ:
+               *frequency = 9191500;
+               break;
+       case MxL_IF_35_25_MHZ:
+               *frequency = 35250000;
+               break;
+       case MxL_IF_36_15_MHZ:
+               *frequency = 36150000;
+               break;
+       case MxL_IF_44_MHZ:
+               *frequency = 44000000;
+               break;
+       }
+       return 0;
+}
+
 static int mxl5007t_release(struct dvb_frontend *fe)
 {
        struct mxl5007t_state *state = fe->tuner_priv;
@@ -766,6 +814,7 @@ static struct dvb_tuner_ops mxl5007t_tuner_ops = {
        .get_frequency     = mxl5007t_get_frequency,
        .get_bandwidth     = mxl5007t_get_bandwidth,
        .release           = mxl5007t_release,
+       .get_if_frequency  = mxl5007t_get_if_frequency,
 };
 
 static int mxl5007t_get_chip_id(struct mxl5007t_state *state)