From 4f136e5659971bf1293631f0e748ab45250b3455 Mon Sep 17 00:00:00 2001 From: Ralph Metzler Date: Tue, 16 Jan 2018 23:50:40 +0100 Subject: [PATCH] change pls to official scrambling_sequence_index --- ddbridge/ddbridge-mci.c | 11 +++++++---- dvb-core/dvb_frontend.c | 16 +++++++++------- dvb-core/dvb_frontend.h | 6 +++++- frontends/mxl5xx.c | 7 ++----- frontends/stv090x.c | 4 ++-- frontends/stv0910.c | 7 +++---- include/linux/dvb/frontend.h | 8 ++++---- include/linux/dvb/version.h | 2 +- 8 files changed, 33 insertions(+), 28 deletions(-) diff --git a/ddbridge/ddbridge-mci.c b/ddbridge/ddbridge-mci.c index 94241c6..9ea85c3 100644 --- a/ddbridge/ddbridge-mci.c +++ b/ddbridge/ddbridge-mci.c @@ -383,20 +383,23 @@ unlock: mci_cmd(state, &cmd, NULL); mci_config(state, ts_config); } + if (p->stream_id != NO_STREAM_ID_FILTER && p->stream_id != 0x80000000) + flags |= 0x80; printk("frontend %u: tuner=%u demod=%u\n", state->nr, state->tuner, state->demod); cmd.command = MCI_CMD_SEARCH_DVBS; cmd.dvbs2_search.flags = flags; cmd.dvbs2_search.s2_modulation_mask = modmask & ((1 << (bits_per_symbol - 1)) - 1); - cmd.dvbs2_search.retry = 255; /* forever */ + cmd.dvbs2_search.retry = 2; cmd.dvbs2_search.frequency = p->frequency * 1000; cmd.dvbs2_search.symbol_rate = p->symbol_rate; cmd.dvbs2_search.scrambling_sequence_index = - (p->pls != NO_SCRAMBLING_CODE) ? p->pls : 0; - cmd.dvbs2_search.input_stream_id = - (p->stream_id != NO_STREAM_ID_FILTER) ? p->stream_id : 0; + p->scrambling_sequence_index; + cmd.dvbs2_search.input_stream_id = p->stream_id; cmd.tuner = state->tuner; cmd.demod = state->demod; cmd.output = state->nr; + if (p->stream_id == 0x80000000) + cmd.output |= 0x80; stat = mci_cmd(state, &cmd, NULL); if (stat) stop(fe); diff --git a/dvb-core/dvb_frontend.c b/dvb-core/dvb_frontend.c index 8131125..47bb622 100644 --- a/dvb-core/dvb_frontend.c +++ b/dvb-core/dvb_frontend.c @@ -972,7 +972,7 @@ static int dvb_frontend_clear_cache(struct dvb_frontend *fe) } c->stream_id = NO_STREAM_ID_FILTER; - c->pls = NO_SCRAMBLING_CODE; + c->scrambling_sequence_index = 0;/* default sequence */ c->input = NO_INPUT; switch (c->delivery_system) { @@ -1064,9 +1064,9 @@ static struct dtv_cmds_h dtv_cmds[DTV_MAX_COMMAND + 1] = { _DTV_CMD(DTV_STREAM_ID, 1, 0), _DTV_CMD(DTV_DVBT2_PLP_ID_LEGACY, 1, 0), + _DTV_CMD(DTV_SCRAMBLING_SEQUENCE_INDEX, 1, 0), _DTV_CMD(DTV_LNA, 1, 0), _DTV_CMD(DTV_INPUT, 1, 0), - _DTV_CMD(DTV_PLS, 1, 0), /* Get */ _DTV_CMD(DTV_DISEQC_SLAVE_REPLY, 0, 1), @@ -1505,8 +1505,9 @@ static int dtv_property_process_get(struct dvb_frontend *fe, tvp->u.buffer.len = 4; break; - case DTV_PLS: - tvp->u.data = c->pls; + /* Physical layer scrambling support */ + case DTV_SCRAMBLING_SEQUENCE_INDEX: + tvp->u.data = c->scrambling_sequence_index; break; /* Fill quality measures */ @@ -1946,10 +1947,11 @@ static int dtv_property_process_set(struct dvb_frontend *fe, r = fe->ops.set_input(fe, c->input); break; - case DTV_PLS: - c->pls = tvp->u.data; + /* Physical layer scrambling support */ + case DTV_SCRAMBLING_SEQUENCE_INDEX: + c->scrambling_sequence_index = tvp->u.data; break; - + default: return -EINVAL; } diff --git a/dvb-core/dvb_frontend.h b/dvb-core/dvb_frontend.h index 320adb7..7c2bffc 100644 --- a/dvb-core/dvb_frontend.h +++ b/dvb-core/dvb_frontend.h @@ -529,6 +529,8 @@ struct dvb_fe_events { * @layer.interleaving: per layer interleaving. * @stream_id: If different than zero, enable substream filtering, if * hardware supports (DVB-S2 and DVB-T2). + * @scrambling_sequence_index: Carries the index of the DVB-S2 physical layer + * scrambling sequence. * @atscmh_fic_ver: Version number of the FIC (Fast Information Channel) * signaling data (only ATSC-M/H) * @atscmh_parade_id: Parade identification number (only ATSC-M/H) @@ -607,6 +609,9 @@ struct dtv_frontend_properties { /* Multistream specifics */ u32 stream_id; + /* Physical Layer Scrambling specifics */ + u32 scrambling_sequence_index; + /* ATSC-MH specifics */ u8 atscmh_fic_ver; u8 atscmh_parade_id; @@ -627,7 +632,6 @@ struct dtv_frontend_properties { u32 lna; s32 input; - u32 pls; /* statistics data */ struct dtv_fe_stats strength; diff --git a/frontends/mxl5xx.c b/frontends/mxl5xx.c index 20de1ab..0ac1674 100644 --- a/frontends/mxl5xx.c +++ b/frontends/mxl5xx.c @@ -448,10 +448,7 @@ static int cfg_scrambler(struct mxl *state, u32 gold) 0, 0, 0, 0, 1, 0, 0, 0, }; - if (gold != NO_SCRAMBLING_CODE) - root = gold2root(gold); - else - root = 1; + root = gold2root(gold); buf[25] = (root >> 24) & 0xff; buf[24] = (root >> 16) & 0xff; buf[23] = (root >> 8) & 0xff; @@ -530,7 +527,7 @@ static int set_parameters(struct dvb_frontend *fe) demodChanCfg.rollOff = MXL_HYDRA_ROLLOFF_AUTO; demodChanCfg.modulationScheme = MXL_HYDRA_MOD_AUTO; demodChanCfg.pilots = MXL_HYDRA_PILOTS_AUTO; - cfg_scrambler(state, p->pls); + cfg_scrambler(state, p->scrambling_sequence_index); break; default: return -EINVAL; diff --git a/frontends/stv090x.c b/frontends/stv090x.c index 36e74c9..fbe0169 100644 --- a/frontends/stv090x.c +++ b/frontends/stv090x.c @@ -3537,8 +3537,8 @@ static enum dvbfe_search stv090x_search(struct dvb_frontend *fe, struct dvb_fron if ((props->stream_id != NO_STREAM_ID_FILTER) && (props->stream_id & 0xffffff00)) pls = props->stream_id >> 8; - if (props->pls != NO_SCRAMBLING_CODE) - pls = props->pls | 0x40000; /* props->pls is always gold code */ + /* props->scrambling_sequence_index is always gold code */ + pls = props->scrambling_sequence_index | 0x40000; stv090x_set_pls(state, (pls >> 18) & 3, pls & 0x3ffff); stv090x_set_mis(state, props->stream_id); diff --git a/frontends/stv0910.c b/frontends/stv0910.c index 9d4bbf1..e4908f5 100644 --- a/frontends/stv0910.c +++ b/frontends/stv0910.c @@ -893,9 +893,8 @@ static void set_stream_modes(struct stv *state, struct dtv_frontend_properties * if ((p->stream_id != NO_STREAM_ID_FILTER) && (p->stream_id & 0xfffff00)) scrambling_code = 0xfffff & (p->stream_id >> 8); - /* p->pls is always gold code ! */ - if (p->pls != NO_SCRAMBLING_CODE) - scrambling_code = p->pls | 0x40000; + /* p->scrambling_sequence_index is always gold code ! */ + scrambling_code = p->scrambling_sequence_index | 0x40000; set_pls(state, scrambling_code); } @@ -1850,7 +1849,7 @@ struct dvb_frontend *stv0910_attach(struct i2c_adapter *i2c, state->search_range = 16000000; state->demod = 0x10; /* Inversion : Auto with reset to 0 */ state->receive_mode = RCVMODE_NONE; - state->cur_scrambling_code = NO_SCRAMBLING_CODE; + state->cur_scrambling_code = 0xffffffff; state->single = cfg->single ? 1 : 0; base = match_base(i2c, cfg->adr); diff --git a/include/linux/dvb/frontend.h b/include/linux/dvb/frontend.h index 3ee6850..f41b9ed 100644 --- a/include/linux/dvb/frontend.h +++ b/include/linux/dvb/frontend.h @@ -551,10 +551,11 @@ enum fe_interleaving { #define DTV_STAT_ERROR_BLOCK_COUNT 68 #define DTV_STAT_TOTAL_BLOCK_COUNT 69 -#define DTV_INPUT 70 -#define DTV_PLS 71 +/* Physical layer scrambling */ +#define DTV_SCRAMBLING_SEQUENCE_INDEX 70 +#define DTV_INPUT 71 -#define DTV_MAX_COMMAND DTV_PLS +#define DTV_MAX_COMMAND DTV_INPUT /** * enum fe_pilot - Type of pilot tone @@ -739,7 +740,6 @@ enum atscmh_rs_code_mode { }; #define NO_STREAM_ID_FILTER (~0U) -#define NO_SCRAMBLING_CODE (~0U) #define LNA_AUTO (~0U) #define NO_INPUT (~0U) diff --git a/include/linux/dvb/version.h b/include/linux/dvb/version.h index e53e2ad..f2ff76d 100644 --- a/include/linux/dvb/version.h +++ b/include/linux/dvb/version.h @@ -24,6 +24,6 @@ #define _DVBVERSION_H_ #define DVB_API_VERSION 5 -#define DVB_API_VERSION_MINOR 10 +#define DVB_API_VERSION_MINOR 11 #endif /*_DVBVERSION_H_*/