V4L/DVB (12165): cx23885: override set_frontend to allow rf input path switching...
authorMichael Krufky <mkrufky@kernellabs.com>
Sat, 9 May 2009 01:39:24 +0000 (22:39 -0300)
committerMauro Carvalho Chehab <mchehab@redhat.com>
Sun, 5 Jul 2009 17:30:01 +0000 (14:30 -0300)
Use separate RF input spigots for Antennae and Cable.

Reviewed-by: Steven Toth <stoth@kernellabs.com>
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 48a9751..a851a81 100644 (file)
@@ -463,6 +463,30 @@ static struct xc5000_config mygica_x8506_xc5000_config = {
        .if_khz = 5380,
 };
 
+static int cx23885_dvb_set_frontend(struct dvb_frontend *fe,
+                                   struct dvb_frontend_parameters *param)
+{
+       struct cx23885_tsport *port = fe->dvb->priv;
+       struct cx23885_dev *dev = port->dev;
+
+       switch (dev->board) {
+       case CX23885_BOARD_HAUPPAUGE_HVR1275:
+               switch (param->u.vsb.modulation) {
+               case VSB_8:
+                       cx23885_gpio_clear(dev, GPIO_5);
+                       break;
+               case QAM_64:
+               case QAM_256:
+               default:
+                       cx23885_gpio_set(dev, GPIO_5);
+                       break;
+               }
+               break;
+       }
+       return (port->set_frontend_save) ?
+               port->set_frontend_save(fe, param) : -ENODEV;
+}
+
 static int dvb_register(struct cx23885_tsport *port)
 {
        struct cx23885_dev *dev = port->dev;
@@ -502,6 +526,11 @@ static int dvb_register(struct cx23885_tsport *port)
                                   0x60, &dev->i2c_bus[1].i2c_adap,
                                   &hauppauge_hvr127x_config);
                }
+
+               /* 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];
index 1a2ac51..f4e22b0 100644 (file)
@@ -288,6 +288,8 @@ struct cx23885_tsport {
        /* Allow a single tsport to have multiple frontends */
        u32                        num_frontends;
        void                       *port_priv;
+       int (*set_frontend_save) (struct dvb_frontend *,
+                                 struct dvb_frontend_parameters *);
 };
 
 struct cx23885_dev {