summaryrefslogtreecommitdiff
path: root/drivers/media/video/cx88/cx88-core.c
diff options
context:
space:
mode:
Diffstat (limited to 'drivers/media/video/cx88/cx88-core.c')
-rw-r--r--drivers/media/video/cx88/cx88-core.c85
1 files changed, 26 insertions, 59 deletions
diff --git a/drivers/media/video/cx88/cx88-core.c b/drivers/media/video/cx88/cx88-core.c
index 1ff79b5a8835..5e868f5cd0c0 100644
--- a/drivers/media/video/cx88/cx88-core.c
+++ b/drivers/media/video/cx88/cx88-core.c
@@ -1,5 +1,5 @@
/*
- * $Id: cx88-core.c,v 1.24 2005/01/19 12:01:55 kraxel Exp $
+ * $Id: cx88-core.c,v 1.33 2005/07/07 14:17:47 mchehab Exp $
*
* device driver for Conexant 2388x based TV cards
* driver core
@@ -51,12 +51,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 +432,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 +470,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 +532,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 +581,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 +700,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 +717,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;
}
@@ -940,12 +913,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 +965,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;
@@ -1164,8 +1121,20 @@ struct cx88_core* cx88_core_get(struct pci_dev *pci)
"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 +1175,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);