diff options
Diffstat (limited to 'drivers/media/dvb-frontends/mb86a20s.c')
-rw-r--r-- | drivers/media/dvb-frontends/mb86a20s.c | 35 |
1 files changed, 13 insertions, 22 deletions
diff --git a/drivers/media/dvb-frontends/mb86a20s.c b/drivers/media/dvb-frontends/mb86a20s.c index 2f458bb188c7..b931179c70a4 100644 --- a/drivers/media/dvb-frontends/mb86a20s.c +++ b/drivers/media/dvb-frontends/mb86a20s.c @@ -459,6 +459,9 @@ static int mb86a20s_get_interleaving(struct mb86a20s_state *state, unsigned layer) { int rc; + int interleaving[] = { + 0, 1, 2, 4, 8 + }; static unsigned char reg[] = { [0] = 0x88, /* Layer A */ @@ -475,20 +478,7 @@ static int mb86a20s_get_interleaving(struct mb86a20s_state *state, if (rc < 0) 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; - } + return interleaving[(rc >> 4) & 0x07]; } static int mb86a20s_get_segment_count(struct mb86a20s_state *state, @@ -566,7 +556,7 @@ static u32 isdbt_rate[3][5][4] = { static void mb86a20s_layer_bitrate(struct dvb_frontend *fe, u32 layer, u32 modulation, u32 forward_error_correction, - u32 interleaving, + u32 guard_interval, u32 segment) { struct mb86a20s_state *state = fe->demodulator_priv; @@ -574,7 +564,7 @@ static void mb86a20s_layer_bitrate(struct dvb_frontend *fe, u32 layer, int mod, fec, guard; /* - * If modulation/fec/interleaving is not detected, the default is + * If modulation/fec/guard is not detected, the default is * to consider the lowest bit rate, to avoid taking too long time * to get BER. */ @@ -612,7 +602,7 @@ static void mb86a20s_layer_bitrate(struct dvb_frontend *fe, u32 layer, break; } - switch (interleaving) { + switch (guard_interval) { default: case GUARD_INTERVAL_1_4: guard = 0; @@ -703,7 +693,7 @@ static int mb86a20s_get_frontend(struct dvb_frontend *fe) c->layer[layer].interleaving = rc; mb86a20s_layer_bitrate(fe, layer, c->layer[layer].modulation, c->layer[layer].fec, - c->layer[layer].interleaving, + c->guard_interval, c->layer[layer].segment_count); } @@ -721,11 +711,10 @@ static int mb86a20s_get_frontend(struct dvb_frontend *fe) rc = mb86a20s_readreg(state, 0x07); if (rc < 0) return rc; + c->transmission_mode = TRANSMISSION_MODE_AUTO; if ((rc & 0x60) == 0x20) { - switch (rc & 0x0c >> 2) { - case 0: - c->transmission_mode = TRANSMISSION_MODE_2K; - break; + /* Only modes 2 and 3 are supported */ + switch ((rc >> 2) & 0x03) { case 1: c->transmission_mode = TRANSMISSION_MODE_4K; break; @@ -734,7 +723,9 @@ static int mb86a20s_get_frontend(struct dvb_frontend *fe) break; } } + c->guard_interval = GUARD_INTERVAL_AUTO; if (!(rc & 0x10)) { + /* Guard interval 1/32 is not supported */ switch (rc & 0x3) { case 0: c->guard_interval = GUARD_INTERVAL_1_4; |