X-Git-Url: http://git.samba.org/samba.git/?p=sfrench%2Fcifs-2.6.git;a=blobdiff_plain;f=drivers%2Fmedia%2Fvideo%2Fcx88%2Fcx88-core.c;h=dc5c5c1f3461125234d021ed4fdbd79ae72bc2af;hp=1ff79b5a8835d0a96ecf870c1041273977f0616c;hb=d58dde0f552a5c5c4485b962d8b6e9dd54fefb30;hpb=07342d623b8e1ac9501a36a0da55cbce1117aeaf diff --git a/drivers/media/video/cx88/cx88-core.c b/drivers/media/video/cx88/cx88-core.c index 1ff79b5a8835..dc5c5c1f3461 100644 --- a/drivers/media/video/cx88/cx88-core.c +++ b/drivers/media/video/cx88/cx88-core.c @@ -1,5 +1,4 @@ /* - * $Id: cx88-core.c,v 1.24 2005/01/19 12:01:55 kraxel Exp $ * * device driver for Conexant 2388x based TV cards * driver core @@ -51,12 +50,15 @@ module_param(latency,int,0444); MODULE_PARM_DESC(latency,"pci latency timer"); static unsigned int tuner[] = {[0 ... (CX88_MAXBOARDS - 1)] = UNSET }; +static unsigned int radio[] = {[0 ... (CX88_MAXBOARDS - 1)] = UNSET }; static unsigned int card[] = {[0 ... (CX88_MAXBOARDS - 1)] = UNSET }; module_param_array(tuner, int, NULL, 0444); +module_param_array(radio, int, NULL, 0444); module_param_array(card, int, NULL, 0444); MODULE_PARM_DESC(tuner,"tuner type"); +MODULE_PARM_DESC(radio,"radio tuner type"); MODULE_PARM_DESC(card,"card type"); static unsigned int nicam = 0; @@ -429,7 +431,7 @@ int cx88_sram_channel_setup(struct cx88_core *core, /* ------------------------------------------------------------------ */ /* debug helper code */ -static int cx88_risc_decode(u32 risc) +int cx88_risc_decode(u32 risc) { static char *instr[16] = { [ RISC_SYNC >> 28 ] = "sync", @@ -467,25 +469,6 @@ static int cx88_risc_decode(u32 risc) return incr[risc >> 28] ? incr[risc >> 28] : 1; } -#if 0 /* currently unused, but useful for debugging */ -void cx88_risc_disasm(struct cx88_core *core, - struct btcx_riscmem *risc) -{ - unsigned int i,j,n; - - printk("%s: risc disasm: %p [dma=0x%08lx]\n", - core->name, risc->cpu, (unsigned long)risc->dma); - for (i = 0; i < (risc->size >> 2); i += n) { - printk("%s: %04d: ", core->name, i); - n = cx88_risc_decode(risc->cpu[i]); - for (j = 1; j < n; j++) - printk("%s: %04d: 0x%08x [ arg #%d ]\n", - core->name, i+j, risc->cpu[i+j], j); - if (risc->cpu[i] == RISC_JUMP) - break; - } -} -#endif void cx88_sram_channel_dump(struct cx88_core *core, struct sram_channel *ch) @@ -548,21 +531,6 @@ static char *cx88_pci_irqs[32] = { "brdg_err", "src_dma_err", "dst_dma_err", "ipb_dma_err", "i2c", "i2c_rack", "ir_smp", "gpio0", "gpio1" }; -char *cx88_vid_irqs[32] = { - "y_risci1", "u_risci1", "v_risci1", "vbi_risc1", - "y_risci2", "u_risci2", "v_risci2", "vbi_risc2", - "y_oflow", "u_oflow", "v_oflow", "vbi_oflow", - "y_sync", "u_sync", "v_sync", "vbi_sync", - "opc_err", "par_err", "rip_err", "pci_abort", -}; -char *cx88_mpeg_irqs[32] = { - "ts_risci1", NULL, NULL, NULL, - "ts_risci2", NULL, NULL, NULL, - "ts_oflow", NULL, NULL, NULL, - "ts_sync", NULL, NULL, NULL, - "opc_err", "par_err", "rip_err", "pci_abort", - "ts_err?", -}; void cx88_print_irqbits(char *name, char *tag, char **strings, u32 bits, u32 mask) @@ -612,16 +580,11 @@ void cx88_wakeup(struct cx88_core *core, break; buf = list_entry(q->active.next, struct cx88_buffer, vb.queue); -#if 0 - if (buf->count > count) - break; -#else /* count comes from the hw and is is 16bit wide -- * this trick handles wrap-arounds correctly for * up to 32767 buffers in flight... */ if ((s16) (count - buf->count) < 0) break; -#endif do_gettimeofday(&buf->vb.ts); dprintk(2,"[%p/%d] wakeup reg=%d buf=%d\n",buf,buf->vb.i, count, buf->count); @@ -736,6 +699,10 @@ static unsigned int inline norm_fsc8(struct cx88_tvnorm *norm) { static const unsigned int ntsc = 28636360; static const unsigned int pal = 35468950; + static const unsigned int palm = 28604892; + + if (norm->id & V4L2_STD_PAL_M) + return palm; return (norm->id & V4L2_STD_625_50) ? pal : ntsc; } @@ -749,6 +716,11 @@ static unsigned int inline norm_notchfilter(struct cx88_tvnorm *norm) static unsigned int inline norm_htotal(struct cx88_tvnorm *norm) { + /* Should always be Line Draw Time / (4*FSC) */ + + if (norm->id & V4L2_STD_PAL_M) + return 909; + return (norm->id & V4L2_STD_625_50) ? 1135 : 910; } @@ -903,7 +875,7 @@ static int set_tvaudio(struct cx88_core *core) cx_andor(MO_AFECFG_IO, 0x1f, 0x0); cx88_set_tvaudio(core); - // cx88_set_stereo(dev,V4L2_TUNER_MODE_STEREO); + /* cx88_set_stereo(dev,V4L2_TUNER_MODE_STEREO); */ cx_write(MO_AUDD_LNGTH, 128); /* fifo size */ cx_write(MO_AUDR_LNGTH, 128); /* fifo size */ @@ -940,12 +912,10 @@ int cx88_set_tvnorm(struct cx88_core *core, struct cx88_tvnorm *norm) norm->cxiformat, cx_read(MO_INPUT_FORMAT) & 0x0f); cx_andor(MO_INPUT_FORMAT, 0xf, norm->cxiformat); -#if 1 // FIXME: as-is from DScaler dprintk(1,"set_tvnorm: MO_OUTPUT_FORMAT 0x%08x [old=0x%08x]\n", norm->cxoformat, cx_read(MO_OUTPUT_FORMAT)); cx_write(MO_OUTPUT_FORMAT, norm->cxoformat); -#endif // MO_SCONV_REG = adc clock / video dec clock * 2^17 tmp64 = adc_clock * (u64)(1 << 17); @@ -994,21 +964,7 @@ int cx88_set_tvnorm(struct cx88_core *core, struct cx88_tvnorm *norm) set_tvaudio(core); // tell i2c chips -#ifdef V4L2_I2C_CLIENTS cx88_call_i2c_clients(core,VIDIOC_S_STD,&norm->id); -#else - { - struct video_channel c; - memset(&c,0,sizeof(c)); - c.channel = core->input; - c.norm = VIDEO_MODE_PAL; - if ((norm->id & (V4L2_STD_NTSC_M|V4L2_STD_NTSC_M_JP))) - c.norm = VIDEO_MODE_NTSC; - if (norm->id & V4L2_STD_SECAM) - c.norm = VIDEO_MODE_SECAM; - cx88_call_i2c_clients(core,VIDIOCSCHAN,&c); - } -#endif // done return 0; @@ -1130,10 +1086,17 @@ struct cx88_core* cx88_core_get(struct pci_dev *pci) core->pci_bus = pci->bus->number; core->pci_slot = PCI_SLOT(pci->devfn); core->pci_irqmask = 0x00fc00; + init_MUTEX(&core->lock); core->nr = cx88_devcount++; sprintf(core->name,"cx88[%d]",core->nr); if (0 != get_ressources(core,pci)) { + printk(KERN_ERR "CORE %s No more PCI ressources for " + "subsystem: %04x:%04x, board: %s\n", + core->name,pci->subsystem_vendor, + pci->subsystem_device, + cx88_boards[core->board].name); + cx88_devcount--; goto fail_free; } @@ -1157,15 +1120,27 @@ struct cx88_core* cx88_core_get(struct pci_dev *pci) core->board = CX88_BOARD_UNKNOWN; cx88_card_list(core,pci); } - printk(KERN_INFO "%s: subsystem: %04x:%04x, board: %s [card=%d,%s]\n", - core->name,pci->subsystem_vendor, - pci->subsystem_device,cx88_boards[core->board].name, - core->board, card[core->nr] == core->board ? - "insmod option" : "autodetected"); + printk(KERN_INFO "CORE %s: subsystem: %04x:%04x, board: %s [card=%d,%s]\n", + core->name,pci->subsystem_vendor, + pci->subsystem_device,cx88_boards[core->board].name, + core->board, card[core->nr] == core->board ? + "insmod option" : "autodetected"); core->tuner_type = tuner[core->nr]; + core->radio_type = radio[core->nr]; if (UNSET == core->tuner_type) core->tuner_type = cx88_boards[core->board].tuner_type; + if (UNSET == core->radio_type) + core->radio_type = cx88_boards[core->board].radio_type; + if (!core->tuner_addr) + core->tuner_addr = cx88_boards[core->board].tuner_addr; + if (!core->radio_addr) + core->radio_addr = cx88_boards[core->board].radio_addr; + + printk(KERN_INFO "TV tuner %d at 0x%02x, Radio tuner %d at 0x%02x\n", + core->tuner_type, core->tuner_addr<<1, + core->radio_type, core->radio_addr<<1); + core->tda9887_conf = cx88_boards[core->board].tda9887_conf; /* init hardware */ @@ -1206,8 +1181,6 @@ void cx88_core_put(struct cx88_core *core, struct pci_dev *pci) /* ------------------------------------------------------------------ */ EXPORT_SYMBOL(cx88_print_ioctl); -EXPORT_SYMBOL(cx88_vid_irqs); -EXPORT_SYMBOL(cx88_mpeg_irqs); EXPORT_SYMBOL(cx88_print_irqbits); EXPORT_SYMBOL(cx88_core_irq); @@ -1235,4 +1208,5 @@ EXPORT_SYMBOL(cx88_core_put); * Local variables: * c-basic-offset: 8 * End: + * kate: eol "unix"; indent-width 3; remove-trailing-space on; replace-trailing-space-save on; tab-width 8; replace-tabs off; space-indent off; mixed-indent off */