V4L/DVB (13104): cx23885: define a dvb frontend ioctl override function
authorMichael Krufky <mkrufky@kernellabs.com>
Sat, 9 May 2009 01:39:24 +0000 (22:39 -0300)
committerMauro Carvalho Chehab <mchehab@redhat.com>
Sat, 5 Dec 2009 20:40:22 +0000 (18:40 -0200)
override set_frontend to allow rf input path switching on the HVR1275

Signed-off-by: Michael Krufky <mkrufky@kernellabs.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab@redhat.com>
drivers/media/video/cx23885/cx23885-dvb.c
drivers/media/video/cx23885/cx23885.h

index 0a03e02b119b85979d262d259575acf0b2b34297..875597640d74eacb70e9cb944d29aea6cc09ece8 100644 (file)
@@ -487,10 +487,34 @@ static int cx23885_dvb_set_frontend(struct dvb_frontend *fe,
                }
                break;
        }
-       return (port->set_frontend_save) ?
-               port->set_frontend_save(fe, param) : -ENODEV;
+       return 0;
 }
 
+static int cx23885_dvb_fe_ioctl_override(struct dvb_frontend *fe,
+                                        unsigned int cmd, void *parg,
+                                        unsigned int stage)
+{
+       int err = 0;
+
+       switch (stage) {
+       case DVB_FE_IOCTL_PRE:
+
+               switch (cmd) {
+               case FE_SET_FRONTEND:
+                       err = cx23885_dvb_set_frontend(fe,
+                               (struct dvb_frontend_parameters *) parg);
+                       break;
+               }
+               break;
+
+       case DVB_FE_IOCTL_POST:
+               /* no post-ioctl handling required */
+               break;
+       }
+       return err;
+};
+
+
 static struct lgs8gxx_config magicpro_prohdtve2_lgs8g75_config = {
        .prod = LGS8GXX_PROD_LGS8G75,
        .demod_address = 0x19,
@@ -550,12 +574,6 @@ static int dvb_register(struct cx23885_tsport *port)
                                   0x60, &dev->i2c_bus[1].i2c_adap,
                                   &hauppauge_hvr127x_config);
                }
-
-               /* FIXME: temporary hack */
-               /* define bridge override to set_frontend */
-               port->set_frontend_save = fe0->dvb.frontend->ops.set_frontend;
-               fe0->dvb.frontend->ops.set_frontend = cx23885_dvb_set_frontend;
-
                break;
        case CX23885_BOARD_HAUPPAUGE_HVR1255:
                i2c_bus = &dev->i2c_bus[0];
@@ -904,7 +922,8 @@ static int dvb_register(struct cx23885_tsport *port)
 
        /* register everything */
        ret = videobuf_dvb_register_bus(&port->frontends, THIS_MODULE, port,
-                                       &dev->pci->dev, adapter_nr, 0, NULL);
+                                       &dev->pci->dev, adapter_nr, 0,
+                                       cx23885_dvb_fe_ioctl_override);
 
        /* init CI & MAC */
        switch (dev->board) {
index 1e0e93548061216772fe3bf52ec858614fd2596e..d2fbc6807ce963e9b2c6f05bb41ce09828459722 100644 (file)
@@ -297,10 +297,6 @@ struct cx23885_tsport {
        /* Allow a single tsport to have multiple frontends */
        u32                        num_frontends;
        void                       *port_priv;
-
-       /* FIXME: temporary hack */
-       int (*set_frontend_save) (struct dvb_frontend *,
-                                 struct dvb_frontend_parameters *);
 };
 
 struct cx23885_dev {