add support for DVB-S2 scrambling code and ISI

This commit is contained in:
Ralph Metzler 2016-06-08 12:13:16 +02:00
parent 421adf6872
commit 8908df8098
7 changed files with 38 additions and 23 deletions

View File

@ -955,6 +955,7 @@ static int dvb_frontend_clear_cache(struct dvb_frontend *fe)
}
c->stream_id = NO_STREAM_ID_FILTER;
c->scrambling_code = NO_SCRAMBLING_CODE;
switch (c->delivery_system) {
case SYS_DVBS:
@ -1031,6 +1032,7 @@ static struct dtv_cmds_h dtv_cmds[DTV_MAX_COMMAND + 1] = {
_DTV_CMD(DTV_DVBT2_PLP_ID_LEGACY, 1, 0),
_DTV_CMD(DTV_LNA, 1, 0),
_DTV_CMD(DTV_INPUT, 1, 0),
_DTV_CMD(DTV_SCRAMBLING_CODE, 1, 0),
/* Get */
_DTV_CMD(DTV_DISEQC_SLAVE_REPLY, 0, 1),
@ -1462,6 +1464,10 @@ static int dtv_property_process_get(struct dvb_frontend *fe,
tvp->u.buffer.len = 4;
break;
case DTV_SCRAMBLING_CODE:
tvp->u.data = c->scrambling_code;
break;
/* Fill quality measures */
case DTV_STAT_SIGNAL_STRENGTH:
tvp->u.st = c->strength;
@ -1901,6 +1907,10 @@ static int dtv_property_process_set(struct dvb_frontend *fe,
r = fe->ops.set_input(fe, c->input);
break;
case DTV_SCRAMBLING_CODE:
c->scrambling_code = tvp->u.data;
break;
default:
return -EINVAL;
}

View File

@ -397,6 +397,7 @@ struct dtv_frontend_properties {
u32 lna;
s32 input;
u32 scrambling_code;
/* statistics data */
struct dtv_fe_stats strength;

View File

@ -1234,7 +1234,7 @@ static int set_parameters(struct dvb_frontend *fe)
fe->ops.tuner_ops.set_params(fe);
state->bandwidth = fe->dtv_property_cache.bandwidth_hz;
state->bw = (fe->dtv_property_cache.bandwidth_hz + 999999) / 1000000;
if (fe->dtv_property_cache.stream_id == 0xffffffff) {
if (fe->dtv_property_cache.stream_id == NO_STREAM_ID_FILTER) {
state->DataSliceID = 0xffffffff;
state->plp = 0xffffffff;
} else {
@ -1912,7 +1912,7 @@ static int get_fe_t2(struct cxd_state *state)
freeze_regst(state);
readregst_unlocked(state, 0x20, 0x5c, ofdm, 5);
readregst_unlocked(state, 0x22, 0x5b, &modcod, 2);
readregst_unlocked(state, 0x22, 0x5b, modcod, 2);
unfreeze_regst(state);
switch (modcod[0] & 0x07) {

View File

@ -128,9 +128,7 @@ struct stv {
int isVCM;
u32 CurScramblingCode;
u32 ForceScramblingCode;
u32 ScramblingCode;
u32 DefaultInputStreamID;
u32 LastBERNumerator;
u32 LastBERDenominator;
@ -964,7 +962,6 @@ static int Start(struct stv *state, struct dtv_frontend_properties *p)
u8 regDMDCFGMD;
u16 symb;
u32 ScramblingCode;
u32 InputStreamID;
if (p->symbol_rate < 100000 || p->symbol_rate > 70000000)
return -EINVAL;
@ -978,24 +975,26 @@ static int Start(struct stv *state, struct dtv_frontend_properties *p)
init_search_param(state);
#if 0
if (state->ForceScramblingCode != (u32) (-1) )
state->ScramblingCode = state->ForceScramblingCode;
ScramblingCode = (state->ScramblingCode & 0xFF800000 ) ? DD_PLS_DEFAULT_ROOT : state->ScramblingCode;
if (p->scrambling_code != NO_SCRAMBLING_CODE)
ScramblingCode = p->scrambling_code;
else
ScramblingCode = 1;
if (ScramblingCode != state->CurScramblingCode) {
write_reg(state, RSTV0910_P2_PLROOT0 + state->regoff, ScramblingCode & 0xff);
write_reg(state, RSTV0910_P2_PLROOT1 + state->regoff, (ScramblingCode >> 8) & 0xff);
write_reg(state, RSTV0910_P2_PLROOT2 + state->regoff, (ScramblingCode >> 16) & 0xff);
write_reg(state, RSTV0910_P2_PLROOT0 + state->regoff,
ScramblingCode & 0xff);
write_reg(state, RSTV0910_P2_PLROOT1 + state->regoff,
(ScramblingCode >> 8) & 0xff);
write_reg(state, RSTV0910_P2_PLROOT2 + state->regoff,
(ScramblingCode >> 16) & 0x07);
state->CurScramblingCode = ScramblingCode;
}
InputStreamID = (p->stream_id != (u32) -1) ? p->stream_id : state->DefaultInputStreamID;
if (InputStreamID != (u32) -1) {
write_reg(state, RSTV0910_P2_ISIENTRY + state->regoff, InputStreamID & 0xff);
if (p->stream_id != NO_STREAM_ID_FILTER) {
write_reg(state, RSTV0910_P2_ISIENTRY + state->regoff, p->stream_id & 0xff);
write_reg(state, RSTV0910_P2_ISIBITENA + state->regoff, 0xff);
}
#endif
if (p->symbol_rate <= 1000000) { /*SR <=1Msps*/
state->DemodTimeout = 3000;
state->FecTimeout = 2000;
@ -1346,7 +1345,6 @@ static int read_ber(struct dvb_frontend *fe, u32 *ber);
static int read_status(struct dvb_frontend *fe, fe_status_t *status)
{
struct stv *state = fe->demodulator_priv;
struct dtv_frontend_properties *p = &fe->dtv_property_cache;
u8 DmdState = 0;
u8 DStatus = 0;
enum ReceiveMode CurReceiveMode = Mode_None;
@ -1822,9 +1820,7 @@ struct dvb_frontend *stv0910_attach(struct i2c_adapter *i2c,
state->SearchRange = 16000000;
state->DEMOD = 0x10; /* Inversion : Auto with reset to 0 */
state->ReceiveMode = Mode_None;
state->CurScramblingCode = (u32) -1;
state->ForceScramblingCode = (u32) -1;
state->DefaultInputStreamID = (u32) -1;
state->CurScramblingCode = NO_SCRAMBLING_CODE;
base = match_base(i2c, cfg->adr);
if (base) {

View File

@ -618,7 +618,6 @@ static struct SLookup Gain_Channel_AGC_IIP3_LookUp[] = {
{ 1325 , 0xFF00 },
};
#define ARRAY_SIZE(x) (sizeof(x) / sizeof((x)[0]))
static s32 TableLookup(struct SLookup *Table, int TableSize, u16 RegValue)
{

View File

@ -379,8 +379,9 @@ struct dvb_frontend_event {
#define DTV_STAT_TOTAL_BLOCK_COUNT 69
#define DTV_INPUT 70
#define DTV_SCRAMBLING_CODE 71
#define DTV_MAX_COMMAND DTV_INPUT
#define DTV_MAX_COMMAND DTV_SCRAMBLING_CODE
typedef enum fe_pilot {
PILOT_ON,
@ -455,6 +456,7 @@ enum atscmh_rs_code_mode {
};
#define NO_STREAM_ID_FILTER (~0U)
#define NO_SCRAMBLING_CODE (~0U)
#define LNA_AUTO (~0U)
struct dtv_cmds_h {

View File

@ -50,6 +50,11 @@ struct dvb_nsd_ts {
__u16 section_id;
};
struct dvb_ns_cap {
__u8 streams_max;
__u8 reserved[127];
};
#define NS_SET_NET _IOW('o', 192, struct dvb_ns_params)
#define NS_START _IO('o', 193)
#define NS_STOP _IO('o', 194)
@ -66,4 +71,6 @@ struct dvb_nsd_ts {
#define NS_INSERT_PACKETS _IOW('o', 203, __u8)
#define NS_SET_CI _IOW('o', 204, __u8)
#define NS_GET_CAP _IOR('o', 204, struct dvb_ns_cap))
#endif /*_UAPI_DVBNS_H_*/