diff options
Diffstat (limited to 'linux/drivers/media/video/em28xx/em28xx-dvb.c')
-rw-r--r-- | linux/drivers/media/video/em28xx/em28xx-dvb.c | 62 |
1 files changed, 35 insertions, 27 deletions
diff --git a/linux/drivers/media/video/em28xx/em28xx-dvb.c b/linux/drivers/media/video/em28xx/em28xx-dvb.c index a890b8a32..b8a5c61ce 100644 --- a/linux/drivers/media/video/em28xx/em28xx-dvb.c +++ b/linux/drivers/media/video/em28xx/em28xx-dvb.c @@ -5,6 +5,7 @@ (c) 2008 Devin Heitmueller <devin.heitmueller@gmail.com> - Fixes for the driver to properly work with HVR-950 + - Fixes for the driver to properly work with Pinnacle PCTV HD Pro Stick (c) 2008 Aidan Thornton <makosoft@googlemail.com> @@ -27,6 +28,9 @@ #include "lgdt330x.h" #include "zl10353.h" +#ifdef EM28XX_DRX397XD_SUPPORT +#include "drx397xD.h" +#endif MODULE_DESCRIPTION("driver for em28xx based DVB cards"); MODULE_AUTHOR("Mauro Carvalho Chehab <mchehab@infradead.org>"); @@ -59,11 +63,7 @@ struct em28xx_dvb { int nfeeds; /* general boilerplate stuff */ -#if (LINUX_VERSION_CODE >= KERNEL_VERSION(2, 6, 12)) struct dvb_adapter adapter; -#else - struct dvb_adapter *adapter; -#endif struct dvb_demux demux; struct dmxdev dmxdev; struct dmx_frontend fe_hw; @@ -236,6 +236,13 @@ static struct zl10353_config em28xx_zl10353_with_xc3028 = { .if2 = 45600, }; +#ifdef EM28XX_DRX397XD_SUPPORT +/* [TODO] djh - not sure yet what the device config needs to contain */ +static struct drx397xD_config em28xx_drx397xD_with_xc3028 = { + .demod_address = (0xe0 >> 1), +}; +#endif + /* ------------------------------------------------------------------ */ static int attach_xc3028(u8 addr, struct em28xx *dev) @@ -292,17 +299,10 @@ int register_dvb(struct em28xx_dvb *dvb, /* Ensure all frontends negotiate bus access */ dvb->frontend->ops.ts_bus_ctrl = em28xx_dvb_bus_ctrl; -#if (LINUX_VERSION_CODE >= KERNEL_VERSION(2, 6, 12)) dvb->adapter.priv = dev; /* register frontend */ result = dvb_register_frontend(&dvb->adapter, dvb->frontend); -#else - dvb->adapter->priv = dev; - - /* register frontend */ - result = dvb_register_frontend(dvb->adapter, dvb->frontend); -#endif if (result < 0) { printk(KERN_WARNING "%s: dvb_register_frontend failed (errno = %d)\n", dev->name, result); @@ -329,11 +329,7 @@ int register_dvb(struct em28xx_dvb *dvb, dvb->dmxdev.filternum = 256; dvb->dmxdev.demux = &dvb->demux.dmx; dvb->dmxdev.capabilities = 0; -#if (LINUX_VERSION_CODE >= KERNEL_VERSION(2, 6, 12)) result = dvb_dmxdev_init(&dvb->dmxdev, &dvb->adapter); -#else - result = dvb_dmxdev_init(&dvb->dmxdev, dvb->adapter); -#endif if (result < 0) { printk(KERN_WARNING "%s: dvb_dmxdev_init failed (errno = %d)\n", dev->name, result); @@ -364,11 +360,7 @@ int register_dvb(struct em28xx_dvb *dvb, } /* register network adapter */ -#if (LINUX_VERSION_CODE >= KERNEL_VERSION(2, 6, 12)) dvb_net_init(&dvb->adapter, &dvb->net, &dvb->demux.dmx); -#else - dvb_net_init(dvb->adapter, &dvb->net, &dvb->demux.dmx); -#endif return 0; fail_fe_conn: @@ -383,11 +375,7 @@ fail_dmx: dvb_unregister_frontend(dvb->frontend); fail_frontend: dvb_frontend_detach(dvb->frontend); -#if (LINUX_VERSION_CODE >= KERNEL_VERSION(2, 6, 12)) dvb_unregister_adapter(&dvb->adapter); -#else - dvb_unregister_adapter(dvb->adapter); -#endif fail_adapter: return result; } @@ -401,11 +389,7 @@ static void unregister_dvb(struct em28xx_dvb *dvb) dvb_dmx_release(&dvb->demux); dvb_unregister_frontend(dvb->frontend); dvb_frontend_detach(dvb->frontend); -#if (LINUX_VERSION_CODE >= KERNEL_VERSION(2, 6, 12)) dvb_unregister_adapter(&dvb->adapter); -#else - dvb_unregister_adapter(dvb->adapter); -#endif } @@ -414,6 +398,11 @@ static int dvb_init(struct em28xx *dev) int result = 0; struct em28xx_dvb *dvb; + if (!dev->has_dvb) { + /* This device does not support the extension */ + return 0; + } + dvb = kzalloc(sizeof(struct em28xx_dvb), GFP_KERNEL); if (dvb == NULL) { @@ -426,6 +415,7 @@ static int dvb_init(struct em28xx *dev) /* init frontend */ switch (dev->model) { case EM2880_BOARD_HAUPPAUGE_WINTV_HVR_950: + case EM2880_BOARD_PINNACLE_PCTV_HD_PRO: dvb->frontend = dvb_attach(lgdt330x_attach, &em2880_lgdt3303_dev, &dev->i2c_adap); @@ -443,6 +433,19 @@ static int dvb_init(struct em28xx *dev) goto out_free; } break; + case EM2880_BOARD_HAUPPAUGE_WINTV_HVR_900_R2: +#ifdef EM28XX_DRX397XD_SUPPORT + /* We don't have the config structure properly populated, so + this is commented out for now */ + dvb->frontend = dvb_attach(drx397xD_attach, + &em28xx_drx397xD_with_xc3028, + &dev->i2c_adap); + if (attach_xc3028(0x61, dev) < 0) { + result = -EINVAL; + goto out_free; + } + break; +#endif default: printk(KERN_ERR "%s/2: The frontend of your DVB/ATSC card" " isn't supported yet\n", @@ -476,6 +479,11 @@ out_free: static int dvb_fini(struct em28xx *dev) { + if (!dev->has_dvb) { + /* This device does not support the extension */ + return 0; + } + if (dev->dvb) { unregister_dvb(dev->dvb); dev->dvb = NULL; |