From 9cc6544718b738bd7dd2c3c885814304bab2d253 Mon Sep 17 00:00:00 2001 From: Daniel Scheller Date: Sun, 15 Oct 2017 16:51:56 -0400 Subject: media: stv0910: read and update mod_cod in read_status() Add missing state->modcod update from upstream driver which needs to be done when manage_matype_info() sets is_vcm on certain S2 transponders. Signed-off-by: Daniel Scheller Signed-off-by: Mauro Carvalho Chehab --- drivers/media/dvb-frontends/stv0910.c | 13 +++++++++++++ 1 file changed, 13 insertions(+) (limited to 'drivers/media/dvb-frontends/stv0910.c') diff --git a/drivers/media/dvb-frontends/stv0910.c b/drivers/media/dvb-frontends/stv0910.c index 8bf855c301f5..73f6df0abbfe 100644 --- a/drivers/media/dvb-frontends/stv0910.c +++ b/drivers/media/dvb-frontends/stv0910.c @@ -1498,6 +1498,19 @@ static int read_status(struct dvb_frontend *fe, enum fe_status *status) enable_puncture_rate(state, state->puncture_rate); } + + /* Use highest signaled ModCod for quality */ + if (state->is_vcm) { + u8 tmp; + enum fe_stv0910_mod_cod mod_cod; + + read_reg(state, RSTV0910_P2_DMDMODCOD + state->regoff, + &tmp); + mod_cod = (enum fe_stv0910_mod_cod)((tmp & 0x7c) >> 2); + + if (mod_cod > state->mod_cod) + state->mod_cod = mod_cod; + } } /* read signal statistics */ -- cgit From aea16005f4081a745c2178e6e4e5825c01a6226e Mon Sep 17 00:00:00 2001 From: Daniel Scheller Date: Sun, 26 Nov 2017 08:00:04 -0500 Subject: media: dvb-frontends/stv0910: WARN_ON() on consecutive mutex_unlock() Stack dump when gate_ctrl() is called in a way that consecutive unlocks happen. This is a clear indication that other drivers interfacing with the stv0910 driver don't do things properly or don't check for failures, so dump stack so that those drivers can be identified and fixed. Signed-off-by: Daniel Scheller Tested-by: Richard Scobie Signed-off-by: Mauro Carvalho Chehab --- drivers/media/dvb-frontends/stv0910.c | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) (limited to 'drivers/media/dvb-frontends/stv0910.c') diff --git a/drivers/media/dvb-frontends/stv0910.c b/drivers/media/dvb-frontends/stv0910.c index 73f6df0abbfe..4b7e901220e4 100644 --- a/drivers/media/dvb-frontends/stv0910.c +++ b/drivers/media/dvb-frontends/stv0910.c @@ -1241,7 +1241,8 @@ static int gate_ctrl(struct dvb_frontend *fe, int enable) if (write_reg(state, state->nr ? RSTV0910_P2_I2CRPT : RSTV0910_P1_I2CRPT, i2crpt) < 0) { /* don't hold the I2C bus lock on failure */ - mutex_unlock(&state->base->i2c_lock); + if (!WARN_ON(!mutex_is_locked(&state->base->i2c_lock))) + mutex_unlock(&state->base->i2c_lock); dev_err(&state->base->i2c->dev, "%s() write_reg failure (enable=%d)\n", __func__, enable); @@ -1251,7 +1252,8 @@ static int gate_ctrl(struct dvb_frontend *fe, int enable) state->i2crpt = i2crpt; if (!enable) - mutex_unlock(&state->base->i2c_lock); + if (!WARN_ON(!mutex_is_locked(&state->base->i2c_lock))) + mutex_unlock(&state->base->i2c_lock); return 0; } -- cgit From 471dd695dcc04aca77aa1ad5b81a93fed8dbb7fd Mon Sep 17 00:00:00 2001 From: Daniel Scheller Date: Sun, 26 Nov 2017 08:00:06 -0500 Subject: media: dvb-frontends/stv0910: remove unneeded check/call to get_if_freq The result (if any) isn't used anywhere besides being assigned to a local variable (and the only current companion stv6111 doesn't even implement get_if_frequency()), thus remove the ptr check and the call, and also remove the now unused iffreq variable. Reported-by: Richard Scobie Cc: Ralph Metzler Signed-off-by: Daniel Scheller Tested-by: Richard Scobie Signed-off-by: Mauro Carvalho Chehab --- drivers/media/dvb-frontends/stv0910.c | 3 --- 1 file changed, 3 deletions(-) (limited to 'drivers/media/dvb-frontends/stv0910.c') diff --git a/drivers/media/dvb-frontends/stv0910.c b/drivers/media/dvb-frontends/stv0910.c index 4b7e901220e4..299dd3533720 100644 --- a/drivers/media/dvb-frontends/stv0910.c +++ b/drivers/media/dvb-frontends/stv0910.c @@ -1273,14 +1273,11 @@ static int set_parameters(struct dvb_frontend *fe) { int stat = 0; struct stv *state = fe->demodulator_priv; - u32 iffreq; struct dtv_frontend_properties *p = &fe->dtv_property_cache; stop(state); if (fe->ops.tuner_ops.set_params) fe->ops.tuner_ops.set_params(fe); - if (fe->ops.tuner_ops.get_if_frequency) - fe->ops.tuner_ops.get_if_frequency(fe, &iffreq); state->symbol_rate = p->symbol_rate; stat = start(state, p); return stat; -- cgit From 0b885ded9c6a9d991d217a8dacca45141cb46825 Mon Sep 17 00:00:00 2001 From: Daniel Scheller Date: Sun, 26 Nov 2017 08:00:07 -0500 Subject: media: dvb-frontends/stv0910: read symbolrate in get_frontend() Utilise get_cur_symbol_rate() in get_frontend() to update the dtv_frontend_properties with the current symbol rate as reported by the demodulator. Reported-by: Richard Scobie Cc: Ralph Metzler Signed-off-by: Daniel Scheller Tested-by: Richard Scobie Signed-off-by: Mauro Carvalho Chehab --- drivers/media/dvb-frontends/stv0910.c | 5 +++++ 1 file changed, 5 insertions(+) (limited to 'drivers/media/dvb-frontends/stv0910.c') diff --git a/drivers/media/dvb-frontends/stv0910.c b/drivers/media/dvb-frontends/stv0910.c index 299dd3533720..55cddd01f779 100644 --- a/drivers/media/dvb-frontends/stv0910.c +++ b/drivers/media/dvb-frontends/stv0910.c @@ -1539,6 +1539,7 @@ static int get_frontend(struct dvb_frontend *fe, { struct stv *state = fe->demodulator_priv; u8 tmp; + u32 symbolrate; if (state->receive_mode == RCVMODE_DVBS2) { u32 mc; @@ -1592,6 +1593,10 @@ static int get_frontend(struct dvb_frontend *fe, p->rolloff = ROLLOFF_35; } + if (state->receive_mode != RCVMODE_NONE) { + get_cur_symbol_rate(state, &symbolrate); + p->symbol_rate = symbolrate; + } return 0; } -- cgit From 5dd70f5a6a2dacf501d8b16f714455d3a35b1b11 Mon Sep 17 00:00:00 2001 From: Daniel Scheller Date: Sun, 26 Nov 2017 08:00:08 -0500 Subject: media: dvb-frontends/stv0910: remove unneeded symbol rate inquiry tracking_optimization() doesn't make use of the symbol rate reported by the demodulator, so remove the unneeded inquiry and the now unneeded variable. Reported-by: Richard Scobie Cc: Ralph Metzler Signed-off-by: Daniel Scheller Tested-by: Richard Scobie Signed-off-by: Mauro Carvalho Chehab --- drivers/media/dvb-frontends/stv0910.c | 2 -- 1 file changed, 2 deletions(-) (limited to 'drivers/media/dvb-frontends/stv0910.c') diff --git a/drivers/media/dvb-frontends/stv0910.c b/drivers/media/dvb-frontends/stv0910.c index 55cddd01f779..681349a5aea8 100644 --- a/drivers/media/dvb-frontends/stv0910.c +++ b/drivers/media/dvb-frontends/stv0910.c @@ -533,10 +533,8 @@ static int get_signal_parameters(struct stv *state) static int tracking_optimization(struct stv *state) { - u32 symbol_rate = 0; u8 tmp; - get_cur_symbol_rate(state, &symbol_rate); read_reg(state, RSTV0910_P2_DMDCFGMD + state->regoff, &tmp); tmp &= ~0xC0; -- cgit From 22f584c5c665461d6bb3d4e242084e4a5b87d5b6 Mon Sep 17 00:00:00 2001 From: Daniel Scheller Date: Sun, 26 Nov 2017 08:00:09 -0500 Subject: media: dvb-frontends/stv0910: remove unneeded dvb_math.h include Since nothing from dvb_math.h is used, remove the unneeded include. Signed-off-by: Daniel Scheller Signed-off-by: Mauro Carvalho Chehab --- drivers/media/dvb-frontends/stv0910.c | 1 - 1 file changed, 1 deletion(-) (limited to 'drivers/media/dvb-frontends/stv0910.c') diff --git a/drivers/media/dvb-frontends/stv0910.c b/drivers/media/dvb-frontends/stv0910.c index 681349a5aea8..a8c99f41478b 100644 --- a/drivers/media/dvb-frontends/stv0910.c +++ b/drivers/media/dvb-frontends/stv0910.c @@ -24,7 +24,6 @@ #include #include -#include "dvb_math.h" #include "dvb_frontend.h" #include "stv0910.h" #include "stv0910_regs.h" -- cgit From fada1935590f66dc6784981e0d557ca09013c847 Mon Sep 17 00:00:00 2001 From: Mauro Carvalho Chehab Date: Thu, 28 Dec 2017 13:03:51 -0500 Subject: media: move dvb kAPI headers to include/media Except for DVB, all media kAPI headers are at include/media. Move the headers to it. Signed-off-by: Mauro Carvalho Chehab --- drivers/media/dvb-frontends/stv0910.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'drivers/media/dvb-frontends/stv0910.c') diff --git a/drivers/media/dvb-frontends/stv0910.c b/drivers/media/dvb-frontends/stv0910.c index a8c99f41478b..946e55c74afa 100644 --- a/drivers/media/dvb-frontends/stv0910.c +++ b/drivers/media/dvb-frontends/stv0910.c @@ -24,7 +24,7 @@ #include #include -#include "dvb_frontend.h" +#include #include "stv0910.h" #include "stv0910_regs.h" -- cgit From 4b596bd70a396dfeb55f38b6bd1c21b8e77ebe77 Mon Sep 17 00:00:00 2001 From: Daniel Scheller Date: Tue, 26 Dec 2017 18:37:56 -0500 Subject: media: dvb-frontends/stv0910: deduplicate writes in enable_puncture_rate() For all code rates, the same write is performed, only with a differing value. Clean this up by putting that value into a variable instead and perform the write at the end with that value. Picked up from the dddvb upstream. Cc: Ralph Metzler Signed-off-by: Daniel Scheller Signed-off-by: Mauro Carvalho Chehab --- drivers/media/dvb-frontends/stv0910.c | 28 ++++++++++++++++------------ 1 file changed, 16 insertions(+), 12 deletions(-) (limited to 'drivers/media/dvb-frontends/stv0910.c') diff --git a/drivers/media/dvb-frontends/stv0910.c b/drivers/media/dvb-frontends/stv0910.c index 946e55c74afa..9f38ebeec853 100644 --- a/drivers/media/dvb-frontends/stv0910.c +++ b/drivers/media/dvb-frontends/stv0910.c @@ -908,27 +908,31 @@ static int init_search_param(struct stv *state) static int enable_puncture_rate(struct stv *state, enum fe_code_rate rate) { + u8 val; + switch (rate) { case FEC_1_2: - return write_reg(state, - RSTV0910_P2_PRVIT + state->regoff, 0x01); + val = 0x01; + break; case FEC_2_3: - return write_reg(state, - RSTV0910_P2_PRVIT + state->regoff, 0x02); + val = 0x02; + break; case FEC_3_4: - return write_reg(state, - RSTV0910_P2_PRVIT + state->regoff, 0x04); + val = 0x04; + break; case FEC_5_6: - return write_reg(state, - RSTV0910_P2_PRVIT + state->regoff, 0x08); + val = 0x08; + break; case FEC_7_8: - return write_reg(state, - RSTV0910_P2_PRVIT + state->regoff, 0x20); + val = 0x20; + break; case FEC_NONE: default: - return write_reg(state, - RSTV0910_P2_PRVIT + state->regoff, 0x2f); + val = 0x2f; + break; } + + return write_reg(state, RSTV0910_P2_PRVIT + state->regoff, val); } static int set_vth_default(struct stv *state) -- cgit From 8042e98c387b02fc4239eee0075d0f318efcf1d7 Mon Sep 17 00:00:00 2001 From: Daniel Scheller Date: Tue, 26 Dec 2017 18:37:57 -0500 Subject: media: dvb-frontends/stv0910: cleanup I2C access functions write_reg() and i2c_write_reg16() only act as a proxy to i2c_write(), which isn't called from anywhere else throughout the driver. Clean this up by moving the message setup and the i2c_transfer() into write_reg() so it becomes the only I2C write function. While touching those parts, fix the error codes from EREMOTEIO to EIO. The I2C cleanup is picked from the upstream dddvb. Cc: Ralph Metzler Signed-off-by: Daniel Scheller Signed-off-by: Mauro Carvalho Chehab --- drivers/media/dvb-frontends/stv0910.c | 28 ++++++++-------------------- 1 file changed, 8 insertions(+), 20 deletions(-) (limited to 'drivers/media/dvb-frontends/stv0910.c') diff --git a/drivers/media/dvb-frontends/stv0910.c b/drivers/media/dvb-frontends/stv0910.c index 9f38ebeec853..fa6bb7436b86 100644 --- a/drivers/media/dvb-frontends/stv0910.c +++ b/drivers/media/dvb-frontends/stv0910.c @@ -137,33 +137,21 @@ struct slookup { u32 reg_value; }; -static inline int i2c_write(struct i2c_adapter *adap, u8 adr, - u8 *data, int len) +static int write_reg(struct stv *state, u16 reg, u8 val) { - struct i2c_msg msg = {.addr = adr, .flags = 0, - .buf = data, .len = len}; + struct i2c_adapter *adap = state->base->i2c; + u8 data[3] = {reg >> 8, reg & 0xff, val}; + struct i2c_msg msg = {.addr = state->base->adr, .flags = 0, + .buf = data, .len = 3}; if (i2c_transfer(adap, &msg, 1) != 1) { dev_warn(&adap->dev, "i2c write error ([%02x] %04x: %02x)\n", - adr, (data[0] << 8) | data[1], - (len > 2 ? data[2] : 0)); - return -EREMOTEIO; + state->base->adr, reg, val); + return -EIO; } return 0; } -static int i2c_write_reg16(struct i2c_adapter *adap, u8 adr, u16 reg, u8 val) -{ - u8 msg[3] = {reg >> 8, reg & 0xff, val}; - - return i2c_write(adap, adr, msg, 3); -} - -static int write_reg(struct stv *state, u16 reg, u8 val) -{ - return i2c_write_reg16(state->base->i2c, state->base->adr, reg, val); -} - static inline int i2c_read_regs16(struct i2c_adapter *adapter, u8 adr, u16 reg, u8 *val, int count) { @@ -176,7 +164,7 @@ static inline int i2c_read_regs16(struct i2c_adapter *adapter, u8 adr, if (i2c_transfer(adapter, msgs, 2) != 2) { dev_warn(&adapter->dev, "i2c read error ([%02x] %04x)\n", adr, reg); - return -EREMOTEIO; + return -EIO; } return 0; } -- cgit From bdd7682b16988a0fac07f9cf630e4fddb73e161c Mon Sep 17 00:00:00 2001 From: Daniel Scheller Date: Tue, 26 Dec 2017 18:37:58 -0500 Subject: media: dvb-frontends/stv0910: field and register access helpers Add a write_field() function that acts as helper to update specific bits specified in the field defines (FSTV0910_*) in stv0910_regs.h, which was recently updated to carry the missing offset values. With that, add the SET_FIELD(), SET_REG() and GET_REG() macros that wrap the write_field(), write_reg() and read_reg() functions to allow for making all demod access code cleaner. The write_field() function is annotated with __maybe_unused temporarily to silence eventual compile warnings. Picked up from the dddvb upstream, with the macro names made uppercase so they are distinguishable as such. Cc: Ralph Metzler Signed-off-by: Daniel Scheller Signed-off-by: Mauro Carvalho Chehab --- drivers/media/dvb-frontends/stv0910.c | 28 ++++++++++++++++++++++++++++ 1 file changed, 28 insertions(+) (limited to 'drivers/media/dvb-frontends/stv0910.c') diff --git a/drivers/media/dvb-frontends/stv0910.c b/drivers/media/dvb-frontends/stv0910.c index fa6bb7436b86..1a3b65e43a85 100644 --- a/drivers/media/dvb-frontends/stv0910.c +++ b/drivers/media/dvb-frontends/stv0910.c @@ -194,6 +194,34 @@ static int write_shared_reg(struct stv *state, u16 reg, u8 mask, u8 val) return status; } +static int __maybe_unused write_field(struct stv *state, u32 field, u8 val) +{ + int status; + u8 shift, mask, old, new; + + status = read_reg(state, field >> 16, &old); + if (status) + return status; + mask = field & 0xff; + shift = (field >> 12) & 0xf; + new = ((val << shift) & mask) | (old & ~mask); + if (new == old) + return 0; + return write_reg(state, field >> 16, new); +} + +#define SET_FIELD(_reg, _val) \ + write_field(state, state->nr ? FSTV0910_P2_##_reg : \ + FSTV0910_P1_##_reg, _val) + +#define SET_REG(_reg, _val) \ + write_reg(state, state->nr ? RSTV0910_P2_##_reg : \ + RSTV0910_P1_##_reg, _val) + +#define GET_REG(_reg, _val) \ + read_reg(state, state->nr ? RSTV0910_P2_##_reg : \ + RSTV0910_P1_##_reg, _val) + static const struct slookup s1_sn_lookup[] = { { 0, 9242 }, /* C/N= 0dB */ { 5, 9105 }, /* C/N= 0.5dB */ -- cgit From 6392bc2e6cd9651f98abf55c4ccaa812d3e60c17 Mon Sep 17 00:00:00 2001 From: Daniel Scheller Date: Tue, 26 Dec 2017 18:37:59 -0500 Subject: media: dvb-frontends/stv0910: cleanup init_search_param() and enable PLS Cleanup the mess in init_search_param() by utilising the new register access macros and functions. And while at it, move the ISI and PLS setup into separate functions, and pass the new scrambling_sequence_index (aka. physical layer scrambling) value to set_pls. Picked up from the dddvb upstream, adapted to the different naming of the pls property (pls vs. scrambling_sequence_index). Cc: Ralph Metzler Signed-off-by: Daniel Scheller Signed-off-by: Mauro Carvalho Chehab --- drivers/media/dvb-frontends/stv0910.c | 113 ++++++++++++++++------------------ 1 file changed, 52 insertions(+), 61 deletions(-) (limited to 'drivers/media/dvb-frontends/stv0910.c') diff --git a/drivers/media/dvb-frontends/stv0910.c b/drivers/media/dvb-frontends/stv0910.c index 1a3b65e43a85..a2f7c0c1587f 100644 --- a/drivers/media/dvb-frontends/stv0910.c +++ b/drivers/media/dvb-frontends/stv0910.c @@ -194,7 +194,7 @@ static int write_shared_reg(struct stv *state, u16 reg, u8 mask, u8 val) return status; } -static int __maybe_unused write_field(struct stv *state, u32 field, u8 val) +static int write_field(struct stv *state, u32 field, u8 val) { int status; u8 shift, mask, old, new; @@ -880,45 +880,60 @@ static int stop(struct stv *state) return 0; } -static int init_search_param(struct stv *state) +static void set_pls(struct stv *state, u32 pls_code) { - u8 tmp; - - read_reg(state, RSTV0910_P2_PDELCTRL1 + state->regoff, &tmp); - tmp |= 0x20; /* Filter_en (no effect if SIS=non-MIS */ - write_reg(state, RSTV0910_P2_PDELCTRL1 + state->regoff, tmp); - - read_reg(state, RSTV0910_P2_PDELCTRL2 + state->regoff, &tmp); - tmp &= ~0x02; /* frame mode = 0 */ - write_reg(state, RSTV0910_P2_PDELCTRL2 + state->regoff, tmp); - - 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); - - read_reg(state, RSTV0910_P2_TSCFGL + state->regoff, &tmp); - tmp &= ~0x04; /* embindvb = 0 */ - write_reg(state, RSTV0910_P2_TSCFGL + state->regoff, tmp); - - read_reg(state, RSTV0910_P2_TSINSDELH + state->regoff, &tmp); - tmp &= ~0x80; /* syncbyte = 0 */ - write_reg(state, RSTV0910_P2_TSINSDELH + state->regoff, tmp); - - read_reg(state, RSTV0910_P2_TSINSDELM + state->regoff, &tmp); - tmp &= ~0x08; /* token = 0 */ - write_reg(state, RSTV0910_P2_TSINSDELM + state->regoff, tmp); + if (pls_code == state->cur_scrambling_code) + return; + + /* PLROOT2 bit 2 = gold code */ + write_reg(state, RSTV0910_P2_PLROOT0 + state->regoff, + pls_code & 0xff); + write_reg(state, RSTV0910_P2_PLROOT1 + state->regoff, + (pls_code >> 8) & 0xff); + write_reg(state, RSTV0910_P2_PLROOT2 + state->regoff, + 0x04 | ((pls_code >> 16) & 0x03)); + state->cur_scrambling_code = pls_code; +} - read_reg(state, RSTV0910_P2_TSDLYSET2 + state->regoff, &tmp); - tmp &= ~0x30; /* hysteresis threshold = 0 */ - write_reg(state, RSTV0910_P2_TSDLYSET2 + state->regoff, tmp); +static void set_isi(struct stv *state, u32 isi) +{ + if (isi == NO_STREAM_ID_FILTER) + return; + if (isi == 0x80000000) { + SET_FIELD(FORCE_CONTINUOUS, 1); + SET_FIELD(TSOUT_NOSYNC, 1); + } else { + SET_FIELD(FILTER_EN, 1); + write_reg(state, RSTV0910_P2_ISIENTRY + state->regoff, + isi & 0xff); + write_reg(state, RSTV0910_P2_ISIBITENA + state->regoff, 0xff); + } + SET_FIELD(ALGOSWRST, 1); + SET_FIELD(ALGOSWRST, 0); +} - read_reg(state, RSTV0910_P2_PDELCTRL0 + state->regoff, &tmp); - tmp = (tmp & ~0x30) | 0x10; /* isi obs mode = 1, observe min ISI */ - write_reg(state, RSTV0910_P2_PDELCTRL0 + state->regoff, tmp); +static void set_stream_modes(struct stv *state, + struct dtv_frontend_properties *p) +{ + set_isi(state, p->stream_id); + set_pls(state, p->scrambling_sequence_index); +} +static int init_search_param(struct stv *state, + struct dtv_frontend_properties *p) +{ + SET_FIELD(FORCE_CONTINUOUS, 0); + SET_FIELD(FRAME_MODE, 0); + SET_FIELD(FILTER_EN, 0); + SET_FIELD(TSOUT_NOSYNC, 0); + SET_FIELD(TSFIFO_EMBINDVB, 0); + SET_FIELD(TSDEL_SYNCBYTE, 0); + SET_REG(UPLCCST0, 0xe0); + SET_FIELD(TSINS_TOKEN, 0); + SET_FIELD(HYSTERESIS_THRESHOLD, 0); + SET_FIELD(ISIOBS_MODE, 1); + + set_stream_modes(state, p); return 0; } @@ -1005,7 +1020,6 @@ static int start(struct stv *state, struct dtv_frontend_properties *p) s32 freq; u8 reg_dmdcfgmd; u16 symb; - u32 scrambling_code = 1; if (p->symbol_rate < 100000 || p->symbol_rate > 70000000) return -EINVAL; @@ -1017,30 +1031,7 @@ static int start(struct stv *state, struct dtv_frontend_properties *p) if (state->started) write_reg(state, RSTV0910_P2_DMDISTATE + state->regoff, 0x5C); - init_search_param(state); - - 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) - scrambling_code = 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 (scrambling_code != state->cur_scrambling_code) { - write_reg(state, RSTV0910_P2_PLROOT0 + state->regoff, - scrambling_code & 0xff); - write_reg(state, RSTV0910_P2_PLROOT1 + state->regoff, - (scrambling_code >> 8) & 0xff); - write_reg(state, RSTV0910_P2_PLROOT2 + state->regoff, - (scrambling_code >> 16) & 0x0f); - state->cur_scrambling_code = scrambling_code; - } + init_search_param(state, p); if (p->symbol_rate <= 1000000) { /* SR <=1Msps */ state->demod_timeout = 3000; -- cgit