]> git.karo-electronics.de Git - linux-beck.git/commitdiff
[media] hdpvr: add two known to work firmware versions
authorJanne Grunau <j@jannau.net>
Tue, 27 Jul 2010 14:03:35 +0000 (11:03 -0300)
committerMauro Carvalho Chehab <mchehab@redhat.com>
Thu, 21 Oct 2010 09:56:03 +0000 (07:56 -0200)
refine the firmware version test and print the version only once

Signed-off-by: Janne Grunau <j@jannau.net>
Signed-off-by: Mauro Carvalho Chehab <mchehab@redhat.com>
drivers/media/video/hdpvr/hdpvr-core.c
drivers/media/video/hdpvr/hdpvr.h

index baddbcfd276fde4ba78d1f35f6d8737138f3c025..d75fe5582f2676d498bb0383fccc571673c2618d 100644 (file)
@@ -156,19 +156,22 @@ static int device_authorization(struct hdpvr_device *dev)
        v4l2_info(&dev->v4l2_dev, "firmware version 0x%x dated %s\n",
                          dev->usbc_buf[1], &dev->usbc_buf[2]);
 
-       if (dev->usbc_buf[1] == HDPVR_FIRMWARE_VERSION) {
+       switch (dev->usbc_buf[1]) {
+       case HDPVR_FIRMWARE_VERSION:
                dev->flags &= ~HDPVR_FLAG_AC3_CAP;
-       } else if (dev->usbc_buf[1] == HDPVR_FIRMWARE_VERSION_AC3) {
+               break;
+       case HDPVR_FIRMWARE_VERSION_AC3:
+       case HDPVR_FIRMWARE_VERSION_0X12:
+       case HDPVR_FIRMWARE_VERSION_0X15:
                dev->flags |= HDPVR_FLAG_AC3_CAP;
-       } else if (dev->usbc_buf[1] > HDPVR_FIRMWARE_VERSION_AC3) {
-               v4l2_info(&dev->v4l2_dev, "untested firmware version 0x%x, "
-                         "the driver might not work\n", dev->usbc_buf[1]);
-               dev->flags |= HDPVR_FLAG_AC3_CAP;
-       } else {
-               v4l2_err(&dev->v4l2_dev, "unknown firmware version 0x%x\n",
-                       dev->usbc_buf[1]);
-               ret = -EINVAL;
-               goto unlock;
+               break;
+       default:
+               v4l2_info(&dev->v4l2_dev, "untested firmware, the driver might"
+                         " not work.\n");
+               if (dev->usbc_buf[1] >= HDPVR_FIRMWARE_VERSION_AC3)
+                       dev->flags |= HDPVR_FLAG_AC3_CAP;
+               else
+                       dev->flags &= ~HDPVR_FLAG_AC3_CAP;
        }
 
        response = dev->usbc_buf+38;
index b0f046df3cd8d4bbb5a052ffe1ecd46aff12f7b7..3a4e4e116f54b844d865bb8148ba31683294f3a3 100644 (file)
 
 #define NUM_BUFFERS 64
 
-#define HDPVR_FIRMWARE_VERSION         0x8
-#define HDPVR_FIRMWARE_VERSION_AC3     0xd
+#define HDPVR_FIRMWARE_VERSION         0x08
+#define HDPVR_FIRMWARE_VERSION_AC3     0x0d
+#define HDPVR_FIRMWARE_VERSION_0X12    0x12
+#define HDPVR_FIRMWARE_VERSION_0X15    0x15
 
 /* #define HDPVR_DEBUG */