--- zzzz-none-000/linux-3.10.107/drivers/media/dvb-frontends/mb86a20s.c 2017-06-27 09:49:32.000000000 +0000 +++ scorpion-7490-727/linux-3.10.107/drivers/media/dvb-frontends/mb86a20s.c 2021-02-04 17:41:59.000000000 +0000 @@ -1,7 +1,7 @@ /* * Fujitu mb86a20s ISDB-T/ISDB-Tsb Module driver * - * Copyright (C) 2010-2013 Mauro Carvalho Chehab + * Copyright (C) 2010-2013 Mauro Carvalho Chehab * Copyright (C) 2009-2010 Douglas Landgraf * * This program is free software; you can redistribute it and/or @@ -22,10 +22,6 @@ #define NUM_LAYERS 3 -static int debug = 1; -module_param(debug, int, 0644); -MODULE_PARM_DESC(debug, "Activates frontend debugging (default:0)"); - enum mb86a20s_bandwidth { MB86A20S_13SEG = 0, MB86A20S_13SEG_PARTIAL = 1, @@ -33,7 +29,7 @@ MB86A20S_3SEG = 3, }; -u8 mb86a20s_subchannel[] = { +static u8 mb86a20s_subchannel[] = { 0xb0, 0xc0, 0xd0, 0xe0, 0xf0, 0x00, 0x10, 0x20, }; @@ -290,7 +286,7 @@ * The functions below assume that gateway lock has already obtained */ -static int mb86a20s_read_status(struct dvb_frontend *fe, fe_status_t *status) +static int mb86a20s_read_status(struct dvb_frontend *fe, enum fe_status *status) { struct mb86a20s_state *state = fe->demodulator_priv; int val; @@ -455,6 +451,9 @@ unsigned layer) { int rc; + int interleaving[] = { + 0, 1, 2, 4, 8 + }; static unsigned char reg[] = { [0] = 0x88, /* Layer A */ @@ -471,20 +470,7 @@ 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, @@ -562,7 +548,7 @@ 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; @@ -570,7 +556,7 @@ 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. */ @@ -608,7 +594,7 @@ break; } - switch (interleaving) { + switch (guard_interval) { default: case GUARD_INTERVAL_1_4: guard = 0; @@ -699,7 +685,7 @@ 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); } @@ -717,11 +703,10 @@ 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; @@ -730,7 +715,9 @@ 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; @@ -1233,7 +1220,7 @@ * All tables below return a dB/1000 measurement */ -static struct linear_segments cnr_to_db_table[] = { +static const struct linear_segments cnr_to_db_table[] = { { 19648, 0}, { 18187, 1000}, { 16534, 2000}, @@ -1267,7 +1254,7 @@ { 788, 30000}, }; -static struct linear_segments cnr_64qam_table[] = { +static const struct linear_segments cnr_64qam_table[] = { { 3922688, 0}, { 3920384, 1000}, { 3902720, 2000}, @@ -1301,7 +1288,7 @@ { 388864, 30000}, }; -static struct linear_segments cnr_16qam_table[] = { +static const struct linear_segments cnr_16qam_table[] = { { 5314816, 0}, { 5219072, 1000}, { 5118720, 2000}, @@ -1335,7 +1322,7 @@ { 95744, 30000}, }; -struct linear_segments cnr_qpsk_table[] = { +static const struct linear_segments cnr_qpsk_table[] = { { 2834176, 0}, { 2683648, 1000}, { 2536960, 2000}, @@ -1369,7 +1356,7 @@ { 11520, 30000}, }; -static u32 interpolate_value(u32 value, struct linear_segments *segments, +static u32 interpolate_value(u32 value, const struct linear_segments *segments, unsigned len) { u64 tmp64; @@ -1453,7 +1440,7 @@ struct dtv_frontend_properties *c = &fe->dtv_property_cache; u32 mer, cnr; int rc, val, layer; - struct linear_segments *segs; + const struct linear_segments *segs; unsigned segs_len; dev_dbg(&state->i2c->dev, "%s called.\n", __func__); @@ -1960,7 +1947,7 @@ } static int mb86a20s_read_status_and_stats(struct dvb_frontend *fe, - fe_status_t *status) + enum fe_status *status) { struct mb86a20s_state *state = fe->demodulator_priv; int rc, status_nr; @@ -2051,7 +2038,7 @@ bool re_tune, unsigned int mode_flags, unsigned int *delay, - fe_status_t *status) + enum fe_status *status) { struct mb86a20s_state *state = fe->demodulator_priv; int rc = 0; @@ -2158,5 +2145,5 @@ }; MODULE_DESCRIPTION("DVB Frontend module for Fujitsu mb86A20s hardware"); -MODULE_AUTHOR("Mauro Carvalho Chehab "); +MODULE_AUTHOR("Mauro Carvalho Chehab"); MODULE_LICENSE("GPL");