fedora core 6 1.2949 + vserver 2.2.0
[linux-2.6.git] / drivers / media / dvb / dvb-usb / vp702x-fe.c
index b6d95e1..3ecb2e0 100644 (file)
@@ -24,6 +24,8 @@ struct vp702x_fe_state {
        struct dvb_frontend fe;
        struct dvb_usb_device *d;
 
+       struct dvb_frontend_ops ops;
+
        fe_sec_voltage_t voltage;
        fe_sec_tone_mode_t tone_mode;
 
@@ -72,9 +74,6 @@ static int vp702x_fe_read_status(struct dvb_frontend* fe, fe_status_t *status)
        else
                *status = 0;
 
-       deb_fe("real state: %x\n",*status);
-       *status = 0x1f;
-
        if (*status & FE_HAS_LOCK)
                st->status_check_interval = 1000;
        else
@@ -147,8 +146,9 @@ static int vp702x_fe_set_frontend(struct dvb_frontend* fe,
        cmd[4] = (sr >> 4)  & 0xff;
        cmd[5] = (sr << 4)  & 0xf0;
 
-       deb_fe("setting frontend to: %u -> %u (%x) LNB-based GHz, symbolrate: %d -> %Lu (%Lx)\n",
-                       fep->frequency,freq,freq, fep->u.qpsk.symbol_rate, sr, sr);
+       deb_fe("setting frontend to: %u -> %u (%x) LNB-based GHz, symbolrate: %d -> %lu (%lx)\n",
+                       fep->frequency,freq,freq, fep->u.qpsk.symbol_rate,
+                       (unsigned long) sr, (unsigned long) sr);
 
 /*     if (fep->inversion == INVERSION_ON)
                cmd[6] |= 0x80; */
@@ -170,8 +170,6 @@ static int vp702x_fe_set_frontend(struct dvb_frontend* fe,
        st->status_check_interval = 250;
        st->next_status_check = jiffies;
 
-       vp702x_usb_in_op(st->d, RESET_TUNER, 0, 0, NULL, 0);
-       msleep(30);
        vp702x_usb_inout_op(st->d,cmd,8,ibuf,10,100);
 
        if (ibuf[2] == 0 && ibuf[3] == 0)
@@ -182,6 +180,20 @@ static int vp702x_fe_set_frontend(struct dvb_frontend* fe,
        return 0;
 }
 
+static int vp702x_fe_init(struct dvb_frontend *fe)
+{
+       struct vp702x_fe_state *st = fe->demodulator_priv;
+       deb_fe("%s\n",__FUNCTION__);
+       vp702x_usb_in_op(st->d, RESET_TUNER, 0, 0, NULL, 0);
+       return 0;
+}
+
+static int vp702x_fe_sleep(struct dvb_frontend *fe)
+{
+       deb_fe("%s\n",__FUNCTION__);
+       return 0;
+}
+
 static int vp702x_fe_get_frontend(struct dvb_frontend* fe,
                                  struct dvb_frontend_parameters *fep)
 {
@@ -192,8 +204,8 @@ static int vp702x_fe_get_frontend(struct dvb_frontend* fe,
 static int vp702x_fe_send_diseqc_msg (struct dvb_frontend* fe,
                                    struct dvb_diseqc_master_cmd *m)
 {
-       struct vp702x_fe_state *st = fe->demodulator_priv;
-       u8 cmd[8],ibuf[10];
+       //struct vp702x_fe_state *st = fe->demodulator_priv;
+       u8 cmd[8];//,ibuf[10];
        memset(cmd,0,8);
 
        deb_fe("%s\n",__FUNCTION__);
@@ -206,12 +218,12 @@ static int vp702x_fe_send_diseqc_msg (struct dvb_frontend* fe,
        memcpy(&cmd[3], m->msg, m->msg_len);
        cmd[7] = vp702x_chksum(cmd,0,7);
 
-       vp702x_usb_inout_op(st->d,cmd,8,ibuf,10,100);
+//     vp702x_usb_inout_op(st->d,cmd,8,ibuf,10,100);
 
-       if (ibuf[2] == 0 && ibuf[3] == 0)
-               deb_fe("diseqc cmd failed.\n");
-       else
-               deb_fe("diseqc cmd succeeded.\n");
+//     if (ibuf[2] == 0 && ibuf[3] == 0)
+//             deb_fe("diseqc cmd failed.\n");
+//     else
+//             deb_fe("diseqc cmd succeeded.\n");
 
        return 0;
 }
@@ -286,17 +298,16 @@ struct dvb_frontend * vp702x_fe_attach(struct dvb_usb_device *d)
                goto error;
 
        s->d = d;
-       s->fe.ops = &vp702x_fe_ops;
+
+       memcpy(&s->fe.ops,&vp702x_fe_ops,sizeof(struct dvb_frontend_ops));
        s->fe.demodulator_priv = s;
 
        s->lnb_buf[1] = SET_LNB_POWER;
        s->lnb_buf[3] = 0xff; /* 0=tone burst, 2=data burst, ff=off */
 
-       goto success;
+       return &s->fe;
 error:
        return NULL;
-success:
-       return &s->fe;
 }
 
 
@@ -318,8 +329,8 @@ static struct dvb_frontend_ops vp702x_fe_ops = {
        },
        .release = vp702x_fe_release,
 
-       .init = NULL,
-       .sleep = NULL,
+       .init  = vp702x_fe_init,
+       .sleep = vp702x_fe_sleep,
 
        .set_frontend = vp702x_fe_set_frontend,
        .get_frontend = vp702x_fe_get_frontend,