diff options
Diffstat (limited to 'linux/drivers')
-rw-r--r-- | linux/drivers/media/video/cx88/cx88-cards.c | 30 | ||||
-rw-r--r-- | linux/drivers/media/video/cx88/cx88-core.c | 28 | ||||
-rw-r--r-- | linux/drivers/media/video/cx88/cx88-dvb.c | 78 | ||||
-rw-r--r-- | linux/drivers/media/video/cx88/cx88-mpeg.c | 15 | ||||
-rw-r--r-- | linux/drivers/media/video/cx88/cx88-vbi.c | 4 | ||||
-rw-r--r-- | linux/drivers/media/video/cx88/cx88-video.c | 15 | ||||
-rw-r--r-- | linux/drivers/media/video/cx88/cx88.h | 18 |
7 files changed, 160 insertions, 28 deletions
diff --git a/linux/drivers/media/video/cx88/cx88-cards.c b/linux/drivers/media/video/cx88/cx88-cards.c index 2c2ecb7e1..3ad9c2c40 100644 --- a/linux/drivers/media/video/cx88/cx88-cards.c +++ b/linux/drivers/media/video/cx88/cx88-cards.c @@ -1,5 +1,5 @@ /* - * $Id: cx88-cards.c,v 1.50 2004/11/30 11:26:38 kraxel Exp $ + * $Id: cx88-cards.c,v 1.51 2004/11/30 17:00:13 kraxel Exp $ * * device driver for Conexant 2388x based TV cards * card-specific stuff. @@ -453,6 +453,22 @@ struct cx88_board cx88_boards[] = { }}, .dvb = 1, }, + [CX88_BOARD_DNTV_LIVE_DVB_T] = { + .name = "digitalnow DNTV Live! DVB-T", + .tuner_type = TUNER_ABSENT, + .input = {{ + .type = CX88_VMUX_COMPOSITE1, + .vmux = 1, + .gpio0 = 0x00000700, + .gpio2 = 0x00000101, + },{ + .type = CX88_VMUX_SVIDEO, + .vmux = 2, + .gpio0 = 0x00000700, + .gpio2 = 0x00000101, + }}, + .dvb = 1, + }, }; const unsigned int cx88_bcount = ARRAY_SIZE(cx88_boards); @@ -552,6 +568,10 @@ struct cx88_subid cx88_subids[] = { .subvendor = 0x7063, .subdevice = 0x3000, /* HD-3000 card */ .card = CX88_BOARD_PCHDTV_HD3000, + },{ + .subvendor = 0x17DE, + .subdevice = 0xA8A6, + .card = CX88_BOARD_DNTV_LIVE_DVB_T, } }; const unsigned int cx88_idcount = ARRAY_SIZE(cx88_subids); @@ -868,6 +888,14 @@ void cx88_card_setup(struct cx88_core *core) core->demod_addr = 0x43; break; #endif + case CX88_BOARD_DNTV_LIVE_DVB_T: + cx_set(MO_GP0_IO, 0x00000707); + cx_set(MO_GP2_IO, 0x00000101); + cx_clear(MO_GP2_IO, 0x00000001); + msleep(1); + cx_clear(MO_GP0_IO, 0x00000007); + cx_set(MO_GP2_IO, 0x00000101); + break; } if (cx88_boards[core->board].radio.type == CX88_RADIO) core->has_radio = 1; diff --git a/linux/drivers/media/video/cx88/cx88-core.c b/linux/drivers/media/video/cx88/cx88-core.c index 66c33af6b..9bf791d14 100644 --- a/linux/drivers/media/video/cx88/cx88-core.c +++ b/linux/drivers/media/video/cx88/cx88-core.c @@ -1,5 +1,5 @@ /* - * $Id: cx88-core.c,v 1.17 2004/11/23 17:29:09 kraxel Exp $ + * $Id: cx88-core.c,v 1.18 2004/11/30 17:00:13 kraxel Exp $ * * device driver for Conexant 2388x based TV cards * driver core @@ -587,10 +587,19 @@ void cx88_print_irqbits(char *name, char *tag, char **strings, /* ------------------------------------------------------------------ */ -void cx88_irq(struct cx88_core *core, u32 status, u32 mask) +int cx88_core_irq(struct cx88_core *core, u32 status) { - cx88_print_irqbits(core->name, "irq pci", - cx88_pci_irqs, status, mask); + int handled = 0; + + if (status & (1<<18)) { + cx88_ir_irq(core); + handled++; + } + if (!handled) + cx88_print_irqbits(core->name, "irq pci", + cx88_pci_irqs, status, + core->pci_irqmask); + return handled; } void cx88_wakeup(struct cx88_core *core, @@ -1090,6 +1099,9 @@ static int get_ressources(struct cx88_core *core, struct pci_dev *pci) return -EBUSY; } +//static int cx88_ir_attach(struct cx88_core *core, struct pci_dev *pci_dev); +//static int cx88_ir_detach(struct cx88_core *core); + struct cx88_core* cx88_core_get(struct pci_dev *pci) { struct cx88_core *core; @@ -1115,9 +1127,10 @@ struct cx88_core* cx88_core_get(struct pci_dev *pci) goto fail_unlock; memset(core,0,sizeof(*core)); + atomic_inc(&core->refcount); core->pci_bus = pci->bus->number; core->pci_slot = PCI_SLOT(pci->devfn); - atomic_inc(&core->refcount); + core->pci_irqmask = 0x00fc00; core->nr = cx88_devcount++; sprintf(core->name,"cx88[%d]",core->nr); @@ -1160,6 +1173,8 @@ struct cx88_core* cx88_core_get(struct pci_dev *pci) cx88_reset(core); cx88_i2c_init(core,pci); cx88_card_setup(core); + cx88_ir_init(core,pci); + cx_write(MO_PCI_INTMSK, core->pci_irqmask); up(&devlist); return core; @@ -1180,6 +1195,7 @@ void cx88_core_put(struct cx88_core *core, struct pci_dev *pci) return; down(&devlist); + cx88_ir_fini(core); if (0 == core->i2c_rc) i2c_bit_del_bus(&core->i2c_adap); list_del(&core->devlist); @@ -1197,7 +1213,7 @@ EXPORT_SYMBOL(cx88_vid_irqs); EXPORT_SYMBOL(cx88_mpeg_irqs); EXPORT_SYMBOL(cx88_print_irqbits); -EXPORT_SYMBOL(cx88_irq); +EXPORT_SYMBOL(cx88_core_irq); EXPORT_SYMBOL(cx88_wakeup); EXPORT_SYMBOL(cx88_reset); EXPORT_SYMBOL(cx88_shutdown); diff --git a/linux/drivers/media/video/cx88/cx88-dvb.c b/linux/drivers/media/video/cx88/cx88-dvb.c index 277a6d6e0..25632897c 100644 --- a/linux/drivers/media/video/cx88/cx88-dvb.c +++ b/linux/drivers/media/video/cx88/cx88-dvb.c @@ -1,5 +1,5 @@ /* - * $Id: cx88-dvb.c,v 1.19 2004/11/07 14:44:59 kraxel Exp $ + * $Id: cx88-dvb.c,v 1.20 2004/11/30 17:00:13 kraxel Exp $ * * device driver for Conexant 2388x based TV cards * MPEG Transport Stream (DVB) routines @@ -178,6 +178,74 @@ struct mt352_config dvico_fusionhdtv_dvbt_plus = { .pll_set = thomson_dtt7579_pll_set, }; +static int dntv_live_dvbt_demod_init(struct dvb_frontend* fe) +{ + static u8 clock_config [] = { 0x89, 0x38, 0x39 }; + static u8 reset [] = { 0x50, 0x80 }; + static u8 adc_ctl_1_cfg [] = { 0x8E, 0x40 }; + static u8 agc_cfg [] = { 0x67, 0x10, 0x23, 0x00, 0xFF, 0xFF, + 0x00, 0xFF, 0x00, 0x40, 0x40 }; + static u8 dntv_extra[] = { 0xB5, 0x7A }; + static u8 capt_range_cfg[] = { 0x75, 0x32 }; + + mt352_write(fe, clock_config, sizeof(clock_config)); + udelay(2000); + mt352_write(fe, reset, sizeof(reset)); + mt352_write(fe, adc_ctl_1_cfg, sizeof(adc_ctl_1_cfg)); + + mt352_write(fe, agc_cfg, sizeof(agc_cfg)); + udelay(2000); + mt352_write(fe, dntv_extra, sizeof(dntv_extra)); + mt352_write(fe, capt_range_cfg, sizeof(capt_range_cfg)); + + return 0; +} + +static int dntv_live_dvbt_pll_set(struct dvb_frontend* fe, + struct dvb_frontend_parameters* params, + u8* pllbuf) +{ + u32 div; + unsigned char bs = 0; + unsigned char cp = 0; + + div = (((params->frequency + 83333) * 3) / 500000) + IF_FREQUENCYx6; + + if (params->frequency < 150000000) cp = 0xB4; + else if (params->frequency < 173000000) cp = 0xBC; + else if (params->frequency < 250000000) cp = 0xB4; + else if (params->frequency < 400000000) cp = 0xBC; + else if (params->frequency < 420000000) cp = 0xF4; + else if (params->frequency < 470000000) cp = 0xFC; + else if (params->frequency < 600000000) cp = 0xBC; + else if (params->frequency < 730000000) cp = 0xF4; + else cp = 0xFC; + + if (params->frequency < 150000000) bs = 0x01; + else if (params->frequency < 173000000) bs = 0x01; + else if (params->frequency < 250000000) bs = 0x02; + else if (params->frequency < 400000000) bs = 0x02; + else if (params->frequency < 420000000) bs = 0x02; + else if (params->frequency < 470000000) bs = 0x02; + else if (params->frequency < 600000000) bs = 0x08; + else if (params->frequency < 730000000) bs = 0x08; + else bs = 0x08; + + pllbuf[0] = 0xc2; // Note: non-linux standard PLL i2c address + pllbuf[1] = div >> 8; + pllbuf[2] = div & 0xff; + pllbuf[3] = cp; + pllbuf[4] = bs; + + return 0; +} + +static struct mt352_config dntv_live_dvbt_config = { + .demod_address = 0x0f, + .demod_init = dntv_live_dvbt_demod_init, + .pll_set = dntv_live_dvbt_pll_set, +}; + static int dvb_register(struct cx8802_dev *dev) { /* init struct videobuf_dvb */ @@ -208,6 +276,14 @@ static int dvb_register(struct cx8802_dev *dev) dev->dvb.frontend->ops->info.frequency_max = 862000000; } break; + case CX88_BOARD_DNTV_LIVE_DVB_T: + dev->dvb.frontend = mt352_attach(&dntv_live_dvbt_config, + &dev->core->i2c_adap); + if (dev->dvb.frontend) { + dev->dvb.frontend->ops->info.frequency_min = 174000000; + dev->dvb.frontend->ops->info.frequency_max = 862000000; + } + break; default: printk("%s: FIXME: frontend handling not here yet ...\n", dev->core->name); diff --git a/linux/drivers/media/video/cx88/cx88-mpeg.c b/linux/drivers/media/video/cx88/cx88-mpeg.c index d2e9767e8..3ae413e8a 100644 --- a/linux/drivers/media/video/cx88/cx88-mpeg.c +++ b/linux/drivers/media/video/cx88/cx88-mpeg.c @@ -1,5 +1,5 @@ /* - * $Id: cx88-mpeg.c,v 1.14 2004/10/25 11:26:36 kraxel Exp $ + * $Id: cx88-mpeg.c,v 1.15 2004/11/30 17:00:13 kraxel Exp $ * * Support for the mpeg transport stream transfers * PCI function #2 of the cx2388x. @@ -93,7 +93,7 @@ static int cx8802_start_dma(struct cx8802_dev *dev, q->count = 1; /* enable irqs */ - cx_set(MO_PCI_INTMSK, 0x00fc04); + cx_set(MO_PCI_INTMSK, core->pci_irqmask | 0x04); cx_write(MO_TS_INTMSK, 0x1f0011); /* start dma */ @@ -292,19 +292,18 @@ static irqreturn_t cx8802_irq(int irq, void *dev_id, struct pt_regs *regs) { struct cx8802_dev *dev = dev_id; struct cx88_core *core = dev->core; - u32 status, mask; + u32 status; int loop, handled = 0; for (loop = 0; loop < 10; loop++) { - status = cx_read(MO_PCI_INTSTAT) & (~0x1f | 0x04); - mask = cx_read(MO_PCI_INTMSK); - if (0 == (status & mask)) + status = cx_read(MO_PCI_INTSTAT) & (core->pci_irqmask | 0x04); + if (0 == status) goto out; handled = 1; cx_write(MO_PCI_INTSTAT, status); - if (status & mask & ~0x1f) - cx88_irq(core,status,mask); + if (status & core->pci_irqmask) + cx88_core_irq(core,status); if (status & 0x04) cx8802_mpeg_irq(dev); }; diff --git a/linux/drivers/media/video/cx88/cx88-vbi.c b/linux/drivers/media/video/cx88/cx88-vbi.c index 672d1b456..078c5057f 100644 --- a/linux/drivers/media/video/cx88/cx88-vbi.c +++ b/linux/drivers/media/video/cx88/cx88-vbi.c @@ -1,5 +1,5 @@ /* - * $Id: cx88-vbi.c,v 1.14 2004/11/07 13:17:15 kraxel Exp $ + * $Id: cx88-vbi.c,v 1.15 2004/11/30 17:00:13 kraxel Exp $ */ #include <linux/kernel.h> #include <linux/module.h> @@ -64,7 +64,7 @@ int cx8800_start_vbi_dma(struct cx8800_dev *dev, q->count = 1; /* enable irqs */ - cx_set(MO_PCI_INTMSK, 0x00fc01); + cx_set(MO_PCI_INTMSK, core->pci_irqmask | 0x01); cx_set(MO_VID_INTMSK, 0x0f0088); /* enable capture */ diff --git a/linux/drivers/media/video/cx88/cx88-video.c b/linux/drivers/media/video/cx88/cx88-video.c index 45bccfeac..24a575543 100644 --- a/linux/drivers/media/video/cx88/cx88-video.c +++ b/linux/drivers/media/video/cx88/cx88-video.c @@ -1,5 +1,5 @@ /* - * $Id: cx88-video.c,v 1.47 2004/11/19 18:07:12 kraxel Exp $ + * $Id: cx88-video.c,v 1.48 2004/11/30 17:00:13 kraxel Exp $ * * device driver for Conexant 2388x based TV cards * video4linux video interface @@ -435,7 +435,7 @@ static int start_video_dma(struct cx8800_dev *dev, q->count = 1; /* enable irqs */ - cx_set(MO_PCI_INTMSK, 0x00fc01); + cx_set(MO_PCI_INTMSK, core->pci_irqmask | 0x01); cx_set(MO_VID_INTMSK, 0x0f0011); /* enable capture */ @@ -1887,19 +1887,18 @@ static irqreturn_t cx8800_irq(int irq, void *dev_id, struct pt_regs *regs) { struct cx8800_dev *dev = dev_id; struct cx88_core *core = dev->core; - u32 status, mask; + u32 status; int loop, handled = 0; for (loop = 0; loop < 10; loop++) { - status = cx_read(MO_PCI_INTSTAT) & (~0x1f | 0x01); - mask = cx_read(MO_PCI_INTMSK); - if (0 == (status & mask)) + status = cx_read(MO_PCI_INTSTAT) & (core->pci_irqmask | 0x01); + if (0 == status) goto out; cx_write(MO_PCI_INTSTAT, status); handled = 1; - if (status & mask & ~0x1f) - cx88_irq(core,status,mask); + if (status & core->pci_irqmask) + cx88_core_irq(core,status); if (status & 0x01) cx8800_vid_irq(dev); }; diff --git a/linux/drivers/media/video/cx88/cx88.h b/linux/drivers/media/video/cx88/cx88.h index 3d2b268d6..bede61423 100644 --- a/linux/drivers/media/video/cx88/cx88.h +++ b/linux/drivers/media/video/cx88/cx88.h @@ -1,5 +1,5 @@ /* - * $Id: cx88.h,v 1.42 2004/11/30 11:26:38 kraxel Exp $ + * $Id: cx88.h,v 1.43 2004/11/30 17:00:13 kraxel Exp $ * * v4l2 device driver for cx2388x based TV cards * @@ -158,6 +158,7 @@ extern struct sram_channel cx88_sram_channels[]; #define CX88_BOARD_PROVIDEO_PV259 20 #define CX88_BOARD_DVICO_FUSIONHDTV_DVB_T_PLUS 21 #define CX88_BOARD_PCHDTV_HD3000 22 +#define CX88_BOARD_DNTV_LIVE_DVB_T 23 enum cx88_itype { CX88_VMUX_COMPOSITE1 = 1, @@ -226,6 +227,8 @@ struct cx88_dmaqueue { u32 count; }; +struct cx88_IR; /* Private structure in cx88-ir-kbd-gpio.c */ + struct cx88_core { struct list_head devlist; atomic_t refcount; @@ -240,6 +243,7 @@ struct cx88_core { u32 __iomem *lmmio; u8 __iomem *bmmio; u32 shadow[SHADOW_MAX]; + int pci_irqmask; /* i2c i/o */ struct i2c_adapter i2c_adap; @@ -264,6 +268,9 @@ struct cx88_core { u32 tvaudio; u32 input; u32 astat; + + /* IR remote control state */ + struct cx88_IR *ir; }; struct cx8800_dev; @@ -419,7 +426,7 @@ extern void cx88_print_irqbits(char *name, char *tag, char **strings, u32 bits, u32 mask); extern void cx88_print_ioctl(char *name, unsigned int cmd); -extern void cx88_irq(struct cx88_core *core, u32 status, u32 mask); +extern int cx88_core_irq(struct cx88_core *core, u32 status); extern void cx88_wakeup(struct cx88_core *core, struct cx88_dmaqueue *q, u32 count); extern void cx88_shutdown(struct cx88_core *core); @@ -516,6 +523,13 @@ void cx88_set_stereo(struct cx88_core *core, u32 mode); int cx88_audio_thread(void *data); /* ----------------------------------------------------------- */ +/* cx88-input.c */ + +int cx88_ir_init(struct cx88_core *core, struct pci_dev *pci); +int cx88_ir_fini(struct cx88_core *core); +void cx88_ir_irq(struct cx88_core *core); + +/* ----------------------------------------------------------- */ /* cx88-mpeg.c */ int cx8802_buf_prepare(struct cx8802_dev *dev, struct cx88_buffer *buf); |