Merge head 'drm-3264' of master.kernel.org:/pub/scm/linux/kernel/git/airlied/drm-2.6
[deliverable/linux.git] / drivers / media / video / cx88 / cx88-core.c
index 1ff79b5a8835d0a96ecf870c1041273977f0616c..96cb0ff33bbde01111a2eadb5d0eb0f483e3f86f 100644 (file)
@@ -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.31 2005/06/22 22:58:04 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",
@@ -542,12 +545,14 @@ void cx88_sram_channel_dump(struct cx88_core *core,
               core->name,cx_read(ch->cnt2_reg));
 }
 
+/* Used only on cx88-core */
 static char *cx88_pci_irqs[32] = {
        "vid", "aud", "ts", "vip", "hst", "5", "6", "tm1",
        "src_dma", "dst_dma", "risc_rd_err", "risc_wr_err",
        "brdg_err", "src_dma_err", "dst_dma_err", "ipb_dma_err",
        "i2c", "i2c_rack", "ir_smp", "gpio0", "gpio1"
 };
+/* Used only on cx88-video */
 char *cx88_vid_irqs[32] = {
        "y_risci1", "u_risci1", "v_risci1", "vbi_risc1",
        "y_risci2", "u_risci2", "v_risci2", "vbi_risc2",
@@ -555,6 +560,7 @@ char *cx88_vid_irqs[32] = {
        "y_sync",   "u_sync",   "v_sync",   "vbi_sync",
        "opc_err",  "par_err",  "rip_err",  "pci_abort",
 };
+/* Used only on cx88-mpeg */
 char *cx88_mpeg_irqs[32] = {
        "ts_risci1", NULL, NULL, NULL,
        "ts_risci2", NULL, NULL, NULL,
@@ -736,6 +742,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 +759,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;
 }
 
@@ -994,21 +1009,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 +1165,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 */
This page took 0.028707 seconds and 5 git commands to generate.