V4L/DVB: saa7134: Fix IRQ2 bit names for the register map
authorMauro Carvalho Chehab <mchehab@redhat.com>
Sat, 3 Apr 2010 04:43:36 +0000 (01:43 -0300)
committerMauro Carvalho Chehab <mchehab@redhat.com>
Wed, 19 May 2010 15:56:52 +0000 (12:56 -0300)
There's an error at the IRQ2 bit map registers. Also, it doesn't
show what bits are needed for positive and for negative edge.

In the case of IR raw decoding, for some protocols, it is important
to detect both positive and negative edges. So, a latter patch
will need to use the other values.

Also, the code that detects problems on IRQ handling is incomplete,
as it disables only one of the IRQ bits for GPIO16 and GPIO18.

Signed-off-by: Mauro Carvalho Chehab <mchehab@redhat.com>
drivers/media/video/saa7134/saa7134-core.c
drivers/media/video/saa7134/saa7134-input.c
drivers/media/video/saa7134/saa7134-reg.h

index 68cda10e0783987c61837efd225c7cbff1b030ac..0612fffdd1fe8efb79f03e402bce4c19535a9520 100644 (file)
@@ -471,7 +471,7 @@ static char *irqbits[] = {
        "DONE_RA0", "DONE_RA1", "DONE_RA2", "DONE_RA3",
        "AR", "PE", "PWR_ON", "RDCAP", "INTL", "FIDT", "MMC",
        "TRIG_ERR", "CONF_ERR", "LOAD_ERR",
-       "GPIO16?", "GPIO18", "GPIO22", "GPIO23"
+       "GPIO16", "GPIO18", "GPIO22", "GPIO23"
 };
 #define IRQBITS ARRAY_SIZE(irqbits)
 
@@ -601,12 +601,14 @@ static irqreturn_t saa7134_irq(int irq, void *dev_id)
                        /* disable gpio16 IRQ */
                        printk(KERN_WARNING "%s/irq: looping -- "
                               "clearing GPIO16 enable bit\n",dev->name);
-                       saa_clearl(SAA7134_IRQ2, SAA7134_IRQ2_INTE_GPIO16);
+                       saa_clearl(SAA7134_IRQ2, SAA7134_IRQ2_INTE_GPIO16_P);
+                       saa_clearl(SAA7134_IRQ2, SAA7134_IRQ2_INTE_GPIO16_N);
                } else if (report & SAA7134_IRQ_REPORT_GPIO18) {
                        /* disable gpio18 IRQs */
                        printk(KERN_WARNING "%s/irq: looping -- "
                               "clearing GPIO18 enable bit\n",dev->name);
-                       saa_clearl(SAA7134_IRQ2, SAA7134_IRQ2_INTE_GPIO18);
+                       saa_clearl(SAA7134_IRQ2, SAA7134_IRQ2_INTE_GPIO18_P);
+                       saa_clearl(SAA7134_IRQ2, SAA7134_IRQ2_INTE_GPIO18_N);
                } else {
                        /* disable all irqs */
                        printk(KERN_WARNING "%s/irq: looping -- "
@@ -698,11 +700,11 @@ static int saa7134_hw_enable2(struct saa7134_dev *dev)
 
        if (dev->has_remote == SAA7134_REMOTE_GPIO && dev->remote) {
                if (dev->remote->mask_keydown & 0x10000)
-                       irq2_mask |= SAA7134_IRQ2_INTE_GPIO16;
+                       irq2_mask |= SAA7134_IRQ2_INTE_GPIO16_N;
                else if (dev->remote->mask_keydown & 0x40000)
-                       irq2_mask |= SAA7134_IRQ2_INTE_GPIO18;
+                       irq2_mask |= SAA7134_IRQ2_INTE_GPIO18_P;
                else if (dev->remote->mask_keyup & 0x40000)
-                       irq2_mask |= SAA7134_IRQ2_INTE_GPIO18A;
+                       irq2_mask |= SAA7134_IRQ2_INTE_GPIO18_N;
        }
 
        if (dev->has_remote == SAA7134_REMOTE_I2C) {
index f46dca3ccf79718a1387b5698474c7d259d8d658..a51ba83fb6c452dea369ffd743eeca884c736e21 100644 (file)
@@ -1188,14 +1188,14 @@ static void nec_task(unsigned long data)
        /* Keep repeating the last key */
        mod_timer(&ir->timer_keyup, jiffies + msecs_to_jiffies(150));
 
-       saa_setl(SAA7134_IRQ2, SAA7134_IRQ2_INTE_GPIO18);
+       saa_setl(SAA7134_IRQ2, SAA7134_IRQ2_INTE_GPIO18_P);
 }
 
 static int saa7134_nec_irq(struct saa7134_dev *dev)
 {
        struct card_ir *ir = dev->remote;
 
-       saa_clearl(SAA7134_IRQ2, SAA7134_IRQ2_INTE_GPIO18);
+       saa_clearl(SAA7134_IRQ2, SAA7134_IRQ2_INTE_GPIO18_P);
        tasklet_schedule(&ir->tlet);
 
        return 1;
index cf89d96d7295221c77189d8e24799f7555a4d232..e7e0af101fa7b8bed4e0916168148db84fd3a4d4 100644 (file)
 #define   SAA7134_IRQ1_INTE_RA0_0               (1 <<  0)
 
 #define SAA7134_IRQ2                            (0x2c8 >> 2)
-#define   SAA7134_IRQ2_INTE_GPIO23A             (1 << 17)
-#define   SAA7134_IRQ2_INTE_GPIO23              (1 << 16)
-#define   SAA7134_IRQ2_INTE_GPIO22A             (1 << 15)
-#define   SAA7134_IRQ2_INTE_GPIO22              (1 << 14)
-#define   SAA7134_IRQ2_INTE_GPIO18A             (1 << 13)
-#define   SAA7134_IRQ2_INTE_GPIO18              (1 << 12)
-#define   SAA7134_IRQ2_INTE_GPIO16              (1 << 11) /* not certain */
-#define   SAA7134_IRQ2_INTE_SC2                 (1 << 10)
-#define   SAA7134_IRQ2_INTE_SC1                 (1 <<  9)
-#define   SAA7134_IRQ2_INTE_SC0                 (1 <<  8)
-#define   SAA7134_IRQ2_INTE_DEC5                (1 <<  7)
+#define   SAA7134_IRQ2_INTE_GPIO23_N             (1 << 17)     /* negative edge */
+#define   SAA7134_IRQ2_INTE_GPIO23_P             (1 << 16)     /* positive edge */
+#define   SAA7134_IRQ2_INTE_GPIO22_N             (1 << 15)     /* negative edge */
+#define   SAA7134_IRQ2_INTE_GPIO22_P             (1 << 14)     /* positive edge */
+#define   SAA7134_IRQ2_INTE_GPIO18_N             (1 << 13)     /* negative edge */
+#define   SAA7134_IRQ2_INTE_GPIO18_P             (1 << 12)     /* positive edge */
+#define   SAA7134_IRQ2_INTE_GPIO16_N             (1 << 11)     /* negative edge */
+#define   SAA7134_IRQ2_INTE_GPIO16_P             (1 << 10)     /* positive edge */
+#define   SAA7134_IRQ2_INTE_SC2                 (1 <<  9)
+#define   SAA7134_IRQ2_INTE_SC1                 (1 <<  8)
+#define   SAA7134_IRQ2_INTE_SC0                 (1 <<  7)
 #define   SAA7134_IRQ2_INTE_DEC4                (1 <<  6)
 #define   SAA7134_IRQ2_INTE_DEC3                (1 <<  5)
 #define   SAA7134_IRQ2_INTE_DEC2                (1 <<  4)
 #define   SAA7134_IRQ_REPORT_GPIO23             (1 << 17)
 #define   SAA7134_IRQ_REPORT_GPIO22             (1 << 16)
 #define   SAA7134_IRQ_REPORT_GPIO18             (1 << 15)
-#define   SAA7134_IRQ_REPORT_GPIO16             (1 << 14) /* not certain */
+#define   SAA7134_IRQ_REPORT_GPIO16             (1 << 14)
 #define   SAA7134_IRQ_REPORT_LOAD_ERR           (1 << 13)
 #define   SAA7134_IRQ_REPORT_CONF_ERR           (1 << 12)
 #define   SAA7134_IRQ_REPORT_TRIG_ERR           (1 << 11)