]> git.karo-electronics.de Git - linux-beck.git/commitdiff
[media] mb86a20s: fix interleaving and FEC retrival
authorMauro Carvalho Chehab <mchehab@redhat.com>
Mon, 14 Jan 2013 15:31:13 +0000 (12:31 -0300)
committerMauro Carvalho Chehab <mchehab@redhat.com>
Tue, 22 Jan 2013 10:17:38 +0000 (08:17 -0200)
Get the proper bits from the TMCC table registers.

Signed-off-by: Mauro Carvalho Chehab <mchehab@redhat.com>
drivers/media/dvb-frontends/mb86a20s.c

index 40c61838c61de2fe06f41a9170cf884c534bb7b3..8f4fff1f0fa5372e391a7471fc5a695e2448612b 100644 (file)
@@ -413,7 +413,7 @@ static int mb86a20s_get_modulation(struct mb86a20s_state *state,
        rc = mb86a20s_readreg(state, 0x6e);
        if (rc < 0)
                return rc;
-       switch ((rc & 0x70) >> 4) {
+       switch ((rc >> 4) & 0x07) {
        case 0:
                return DQPSK;
        case 1:
@@ -446,7 +446,7 @@ static int mb86a20s_get_fec(struct mb86a20s_state *state,
        rc = mb86a20s_readreg(state, 0x6e);
        if (rc < 0)
                return rc;
-       switch (rc) {
+       switch ((rc >> 4) & 0x07) {
        case 0:
                return FEC_1_2;
        case 1:
@@ -481,9 +481,21 @@ static int mb86a20s_get_interleaving(struct mb86a20s_state *state,
        rc = mb86a20s_readreg(state, 0x6e);
        if (rc < 0)
                return rc;
-       if (rc > 3)
-               return -EINVAL; /* Not used */
-       return rc;
+
+       switch ((rc >> 4) & 0x07) {
+       case 1:
+               return GUARD_INTERVAL_1_4;
+       case 2:
+               return GUARD_INTERVAL_1_8;
+       case 3:
+               return GUARD_INTERVAL_1_16;
+       case 4:
+               return GUARD_INTERVAL_1_32;
+
+       default:
+       case 0:
+               return GUARD_INTERVAL_AUTO;
+       }
 }
 
 static int mb86a20s_get_segment_count(struct mb86a20s_state *state,