change physical layer scrambling API to DTV_PLS and support old API

mixed with DTV_STREAM_ID
This commit is contained in:
Ralph Metzler
2016-06-16 15:42:18 +02:00
parent 805a3ffeed
commit 2c8fcc1df5
5 changed files with 25 additions and 21 deletions

View File

@@ -1067,6 +1067,7 @@ static int firmware_download(struct mxl *state, u8 *mbin, u32 mbin_len)
status = read_register(state, HYDRA_PRCM_ROOT_CLK_REG, &regData);
if (status)
return status;
status = do_firmware_download(state, mbin, mbin_len);
if (status)
return status;

View File

@@ -865,7 +865,7 @@ static int init_search_param(struct stv *state)
write_reg(state, RSTV0910_P2_UPLCCST0 + state->regoff, 0xe0);
write_reg(state, RSTV0910_P2_ISIBITENA + state->regoff, 0x00);
read_reg(state, RSTV0910_P2_TSSTATEM + state->regoff, &tmp);
tmp &= ~0x01; // nosync = 0, in case next signal is standard TS
write_reg(state, RSTV0910_P2_TSSTATEM + state->regoff, tmp);
@@ -961,7 +961,7 @@ static int Start(struct stv *state, struct dtv_frontend_properties *p)
s32 Freq;
u8 regDMDCFGMD;
u16 symb;
u32 ScramblingCode;
u32 ScramblingCode = 1;
if (p->symbol_rate < 100000 || p->symbol_rate > 70000000)
return -EINVAL;
@@ -975,10 +975,18 @@ static int Start(struct stv *state, struct dtv_frontend_properties *p)
init_search_param(state);
if (p->scrambling_code != NO_SCRAMBLING_CODE)
ScramblingCode = p->scrambling_code;
else
ScramblingCode = 1;
if (p->stream_id != NO_STREAM_ID_FILTER) {
/* Backwards compatibility to "crazy" API.
PRBS X root cannot be 0, so this should always work.
*/
if (p->stream_id & 0xffffff00)
ScramblingCode = p->stream_id >> 8;
write_reg(state, RSTV0910_P2_ISIENTRY + state->regoff, p->stream_id & 0xff);
write_reg(state, RSTV0910_P2_ISIBITENA + state->regoff, 0xff);
}
if (p->pls != NO_SCRAMBLING_CODE)
ScramblingCode = p->pls;
if (ScramblingCode != state->CurScramblingCode) {
write_reg(state, RSTV0910_P2_PLROOT0 + state->regoff,
@@ -990,11 +998,6 @@ static int Start(struct stv *state, struct dtv_frontend_properties *p)
state->CurScramblingCode = ScramblingCode;
}
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);
}
if (p->symbol_rate <= 1000000) { /*SR <=1Msps*/
state->DemodTimeout = 3000;
state->FecTimeout = 2000;
@@ -1246,7 +1249,7 @@ static int get_frequency_offset(struct stv *state, s32 *off)
if (derot & (1<<23))
derot |= 0xFF000000;
*off = - (s32) (((s64) derot * (s64) state->base->mclk) >> 24);
pr_info("foff = %d\n", *off);
//pr_info("foff = %d\n", *off);
return 0;
}