diff options
author | Reinhard Nißl <rnissl@gmx.de> | 2013-06-02 13:59:00 -0400 |
---|---|---|
committer | Mauro Carvalho Chehab <mchehab@redhat.com> | 2013-06-08 19:14:17 -0400 |
commit | 0c1d2b14d09b862ccd6300d774eb579161635710 (patch) | |
tree | ca80497dfd440f79d65a9a5c45e5d744f82ee581 /drivers/media/dvb-frontends | |
parent | 55b3318b3a49488a14ccfceffde668d548c4e427 (diff) |
[media] stb0899: store successful inversion for next run
Usually, inversion doesn't change in a system. Storing the last
successful inversion value speeds up tuning of DVB-S2 transponders.
Signed-off-by: Reinhard Nißl <rnissl@gmx.de>
Signed-off-by: Michael Krufky <mkrufky@linuxtv.org>
Signed-off-by: Mauro Carvalho Chehab <mchehab@redhat.com>
Diffstat (limited to 'drivers/media/dvb-frontends')
-rw-r--r-- | drivers/media/dvb-frontends/stb0899_algo.c | 8 | ||||
-rw-r--r-- | drivers/media/dvb-frontends/stb0899_drv.c | 5 |
2 files changed, 9 insertions, 4 deletions
diff --git a/drivers/media/dvb-frontends/stb0899_algo.c b/drivers/media/dvb-frontends/stb0899_algo.c index e0d31a2ea578..4b49efb67931 100644 --- a/drivers/media/dvb-frontends/stb0899_algo.c +++ b/drivers/media/dvb-frontends/stb0899_algo.c | |||
@@ -1488,9 +1488,15 @@ enum stb0899_status stb0899_dvbs2_algo(struct stb0899_state *state) | |||
1488 | 1488 | ||
1489 | offsetfreq = offsetfreq / ((1 << 30) / 1000); | 1489 | offsetfreq = offsetfreq / ((1 << 30) / 1000); |
1490 | offsetfreq *= (internal->master_clk / 1000000); | 1490 | offsetfreq *= (internal->master_clk / 1000000); |
1491 | |||
1492 | /* store current inversion for next run */ | ||
1491 | reg = STB0899_READ_S2REG(STB0899_S2DEMOD, DMD_CNTRL2); | 1493 | reg = STB0899_READ_S2REG(STB0899_S2DEMOD, DMD_CNTRL2); |
1492 | if (STB0899_GETFIELD(SPECTRUM_INVERT, reg)) | 1494 | if (STB0899_GETFIELD(SPECTRUM_INVERT, reg)) |
1493 | offsetfreq *= -1; | 1495 | internal->inversion = IQ_SWAP_ON; |
1496 | else | ||
1497 | internal->inversion = IQ_SWAP_OFF; | ||
1498 | |||
1499 | offsetfreq *= internal->inversion; | ||
1494 | 1500 | ||
1495 | internal->freq = internal->freq - offsetfreq; | 1501 | internal->freq = internal->freq - offsetfreq; |
1496 | internal->srate = stb0899_dvbs2_get_srate(state); | 1502 | internal->srate = stb0899_dvbs2_get_srate(state); |
diff --git a/drivers/media/dvb-frontends/stb0899_drv.c b/drivers/media/dvb-frontends/stb0899_drv.c index b3ccd3dbbda1..82391feb6839 100644 --- a/drivers/media/dvb-frontends/stb0899_drv.c +++ b/drivers/media/dvb-frontends/stb0899_drv.c | |||
@@ -1618,19 +1618,18 @@ static struct dvb_frontend_ops stb0899_ops = { | |||
1618 | struct dvb_frontend *stb0899_attach(struct stb0899_config *config, struct i2c_adapter *i2c) | 1618 | struct dvb_frontend *stb0899_attach(struct stb0899_config *config, struct i2c_adapter *i2c) |
1619 | { | 1619 | { |
1620 | struct stb0899_state *state = NULL; | 1620 | struct stb0899_state *state = NULL; |
1621 | enum stb0899_inversion inversion; | ||
1622 | 1621 | ||
1623 | state = kzalloc(sizeof (struct stb0899_state), GFP_KERNEL); | 1622 | state = kzalloc(sizeof (struct stb0899_state), GFP_KERNEL); |
1624 | if (state == NULL) | 1623 | if (state == NULL) |
1625 | goto error; | 1624 | goto error; |
1626 | 1625 | ||
1627 | inversion = config->inversion; | ||
1628 | state->verbose = &verbose; | 1626 | state->verbose = &verbose; |
1629 | state->config = config; | 1627 | state->config = config; |
1630 | state->i2c = i2c; | 1628 | state->i2c = i2c; |
1631 | state->frontend.ops = stb0899_ops; | 1629 | state->frontend.ops = stb0899_ops; |
1632 | state->frontend.demodulator_priv = state; | 1630 | state->frontend.demodulator_priv = state; |
1633 | state->internal.inversion = inversion; | 1631 | /* use configured inversion as default -- we'll later autodetect inversion */ |
1632 | state->internal.inversion = config->inversion; | ||
1634 | 1633 | ||
1635 | stb0899_wakeup(&state->frontend); | 1634 | stb0899_wakeup(&state->frontend); |
1636 | if (stb0899_get_dev_id(state) == -ENODEV) { | 1635 | if (stb0899_get_dev_id(state) == -ENODEV) { |