]> git.karo-electronics.de Git - linux-beck.git/commitdiff
[media] stb0899: store successful inversion for next run
authorReinhard Nißl <rnissl@gmx.de>
Sun, 2 Jun 2013 17:59:00 +0000 (14:59 -0300)
committerMauro Carvalho Chehab <mchehab@redhat.com>
Sat, 8 Jun 2013 23:14:17 +0000 (20:14 -0300)
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>
drivers/media/dvb-frontends/stb0899_algo.c
drivers/media/dvb-frontends/stb0899_drv.c

index e0d31a2ea5782e4fa038d1f594845e0913d1d9d9..4b49efb679316ab94593df2be00f897fbc4cdd4d 100644 (file)
@@ -1488,9 +1488,15 @@ enum stb0899_status stb0899_dvbs2_algo(struct stb0899_state *state)
 
                offsetfreq = offsetfreq / ((1 << 30) / 1000);
                offsetfreq *= (internal->master_clk / 1000000);
+
+               /* store current inversion for next run */
                reg = STB0899_READ_S2REG(STB0899_S2DEMOD, DMD_CNTRL2);
                if (STB0899_GETFIELD(SPECTRUM_INVERT, reg))
-                       offsetfreq *= -1;
+                       internal->inversion = IQ_SWAP_ON;
+               else
+                       internal->inversion = IQ_SWAP_OFF;
+
+               offsetfreq *= internal->inversion;
 
                internal->freq = internal->freq - offsetfreq;
                internal->srate = stb0899_dvbs2_get_srate(state);
index b3ccd3dbbda16177a5904fea4eda55e91f9bc5a5..82391feb683997f6eaecb87ed978b6f8fe3b1f80 100644 (file)
@@ -1618,19 +1618,18 @@ static struct dvb_frontend_ops stb0899_ops = {
 struct dvb_frontend *stb0899_attach(struct stb0899_config *config, struct i2c_adapter *i2c)
 {
        struct stb0899_state *state = NULL;
-       enum stb0899_inversion inversion;
 
        state = kzalloc(sizeof (struct stb0899_state), GFP_KERNEL);
        if (state == NULL)
                goto error;
 
-       inversion                               = config->inversion;
        state->verbose                          = &verbose;
        state->config                           = config;
        state->i2c                              = i2c;
        state->frontend.ops                     = stb0899_ops;
        state->frontend.demodulator_priv        = state;
-       state->internal.inversion               = inversion;
+       /* use configured inversion as default -- we'll later autodetect inversion */
+       state->internal.inversion               = config->inversion;
 
        stb0899_wakeup(&state->frontend);
        if (stb0899_get_dev_id(state) == -ENODEV) {