V4L/DVB (8599): au8522: remove if frequency settings from vsb/qam modulation tables
[pandora-kernel.git] / drivers / media / dvb / frontends / au8522.c
index f7b7165..5a6cbb4 100644 (file)
@@ -304,6 +304,43 @@ static int au8522_mse2snr_lookup(struct mse2snr_tab *tab, int sz, int mse,
        return ret;
 }
 
+static int au8522_set_if(struct dvb_frontend *fe, enum au8522_if_freq if_freq)
+{
+       struct au8522_state *state = fe->demodulator_priv;
+       u8 r0b5, r0b6, r0b7;
+       char *ifmhz;
+
+       switch (if_freq) {
+       case AU8522_IF_3_25MHZ:
+               ifmhz = "3.25";
+               r0b5 = 0x00;
+               r0b6 = 0x3d;
+               r0b7 = 0xa0;
+               break;
+       case AU8522_IF_4MHZ:
+               ifmhz = "4.00";
+               r0b5 = 0x00;
+               r0b6 = 0x4b;
+               r0b7 = 0xd9;
+               break;
+       case AU8522_IF_6MHZ:
+               ifmhz = "6.00";
+               r0b5 = 0xfb;
+               r0b6 = 0x8e;
+               r0b7 = 0x39;
+               break;
+       default:
+               dprintk("%s() IF Frequency not supported\n", __func__);
+               return -EINVAL;
+       }
+       dprintk("%s() %s MHz\n", __func__, ifmhz);
+       au8522_writereg(state, 0x80b5, r0b5);
+       au8522_writereg(state, 0x80b6, r0b6);
+       au8522_writereg(state, 0x80b7, r0b7);
+
+       return 0;
+}
+
 /* VSB Modulation table */
 static struct {
        u16 reg;
@@ -334,9 +371,6 @@ static struct {
        { 0x80af, 0x66 },
        { 0x821b, 0xcc },
        { 0x821d, 0x80 },
-       { 0x80b5, 0xfb },
-       { 0x80b6, 0x8e },
-       { 0x80b7, 0x39 },
        { 0x80a4, 0xe8 },
        { 0x8231, 0x13 },
 };
@@ -350,9 +384,6 @@ static struct {
        { 0x80a4, 0x00 },
        { 0x8081, 0xc4 },
        { 0x80a5, 0x40 },
-       { 0x80b5, 0xfb },
-       { 0x80b6, 0x8e },
-       { 0x80b7, 0x39 },
        { 0x80aa, 0x77 },
        { 0x80ad, 0x77 },
        { 0x80a6, 0x67 },
@@ -438,6 +469,7 @@ static int au8522_enable_modulation(struct dvb_frontend *fe,
                        au8522_writereg(state,
                                VSB_mod_tab[i].reg,
                                VSB_mod_tab[i].data);
+               au8522_set_if(fe, state->config->vsb_if);
                break;
        case QAM_64:
        case QAM_256:
@@ -446,6 +478,7 @@ static int au8522_enable_modulation(struct dvb_frontend *fe,
                        au8522_writereg(state,
                                QAM_mod_tab[i].reg,
                                QAM_mod_tab[i].data);
+               au8522_set_if(fe, state->config->qam_if);
                break;
        default:
                dprintk("%s() Invalid modulation\n", __func__);