V4L/DVB (13801): [MB86A16] Use the search callback
authorManu Abraham <abraham.manu@gmail.com>
Tue, 15 Dec 2009 09:15:27 +0000 (06:15 -0300)
committerMauro Carvalho Chehab <mchehab@redhat.com>
Sun, 17 Jan 2010 13:55:43 +0000 (11:55 -0200)
Signed-off-by: Manu Abraham <manu@linuxtv.org>
Signed-off-by: Mauro Carvalho Chehab <mchehab@redhat.com>
drivers/media/dvb/frontends/mb86a16.c

index eddb35baaf00b020659adb717785baa7cb5fcbb6..33387b78d85a065dfb025adf7ffc235bea74dc42 100644 (file)
@@ -1487,16 +1487,19 @@ static int mb86a16_set_fe(struct mb86a16_state *state)
                                } else {
                                        dprintk(verbose, MB86A16_INFO, 1, "NO  -- SYNC");
                                        SEQ_set(state, 1);
+                                       ret = -1;
                                }
                        }
                } else {
                        dprintk (verbose, MB86A16_INFO, 1, "NO  -- SIGNAL");
+                       ret = -1;
                }
 
                sync = sync_chk(state, &junk);
                if (sync) {
                        dprintk(verbose, MB86A16_INFO, 1, "******* SYNC *******");
                        freqerr_chk(state, state->frequency, state->srate, 1);
+                       ret = 0;
                        break;
                }
        }
@@ -1610,33 +1613,21 @@ err:
        return -EREMOTEIO;
 }
 
-#define MB86A16_FE_ALGO                1
-
-static int mb86a16_frontend_algo(struct dvb_frontend *fe)
-{
-       return MB86A16_FE_ALGO;
-}
-
-static int mb86a16_set_frontend(struct dvb_frontend *fe,
-                               struct dvb_frontend_parameters *p,
-                               unsigned int mode_flags,
-                               int *delay,
-                               fe_status_t *status)
+static enum dvbfe_search mb86a16_search(struct dvb_frontend *fe,
+                                       struct dvb_frontend_parameters *p)
 {
-       int ret = 0;
        struct mb86a16_state *state = fe->demodulator_priv;
 
-       if (p != NULL) {
-               state->frequency = p->frequency / 1000;
-               state->srate = p->u.qpsk.symbol_rate / 1000;
-               ret = mb86a16_set_fe(state);
-       }
-       if (!(mode_flags & FE_TUNE_MODE_ONESHOT))
-               mb86a16_read_status(fe, status);
+       state->frequency = p->frequency / 1000;
+       state->srate = p->u.qpsk.symbol_rate / 1000;
 
-       *delay = HZ/3000;
+       if (!mb86a16_set_fe(state)) {
+               dprintk(verbose, MB86A16_ERROR, 1, "Succesfully acquired LOCK");
+               return DVBFE_ALGO_SEARCH_SUCCESS;
+       }
 
-       return ret;
+       dprintk(verbose, MB86A16_ERROR, 1, "Lock acquisition failed!");
+       return DVBFE_ALGO_SEARCH_FAILED;
 }
 
 static void mb86a16_release(struct dvb_frontend *fe)
@@ -1809,6 +1800,11 @@ static int mb86a16_read_ucblocks(struct dvb_frontend *fe, u32 *ucblocks)
        return 0;
 }
 
+static enum dvbfe_algo mb86a16_frontend_algo(struct dvb_frontend *fe)
+{
+       return DVBFE_ALGO_CUSTOM;
+}
+
 static struct dvb_frontend_ops mb86a16_ops = {
        .info = {
                .name                   = "Fujitsu MB86A16 DVB-S",
@@ -1826,9 +1822,10 @@ static struct dvb_frontend_ops mb86a16_ops = {
                                          FE_CAN_FEC_AUTO
        },
        .release                        = mb86a16_release,
-       .tune                           = mb86a16_set_frontend,
-       .read_status                    = mb86a16_read_status,
+
        .get_frontend_algo              = mb86a16_frontend_algo,
+       .search                         = mb86a16_search,
+       .read_status                    = mb86a16_read_status,
        .init                           = mb86a16_init,
        .sleep                          = mb86a16_sleep,
        .read_status                    = mb86a16_read_status,