Merge to kernel-2.6.20-1.2949.fc6.vs2.2.0.1
[linux-2.6.git] / drivers / media / video / sn9c102 / sn9c102_tas5110c1b.c
similarity index 87%
rename from drivers/usb/media/sn9c102_tas5110c1b.c
rename to drivers/media/video/sn9c102/sn9c102_tas5110c1b.c
index 32ddf23..294eb02 100644 (file)
@@ -44,8 +44,8 @@ static int tas5110c1b_init(struct sn9c102_device* cam)
 }
 
 
-static int tas5110c1b_set_ctrl(struct sn9c102_device* cam, 
-                               const struct v4l2_control* ctrl)
+static int tas5110c1b_set_ctrl(struct sn9c102_device* cam,
+                              const struct v4l2_control* ctrl)
 {
        int err = 0;
 
@@ -61,8 +61,8 @@ static int tas5110c1b_set_ctrl(struct sn9c102_device* cam,
 }
 
 
-static int tas5110c1b_set_crop(struct sn9c102_device* cam, 
-                               const struct v4l2_rect* rect)
+static int tas5110c1b_set_crop(struct sn9c102_device* cam,
+                              const struct v4l2_rect* rect)
 {
        struct sn9c102_sensor* s = &tas5110c1b;
        int err = 0;
@@ -81,8 +81,8 @@ static int tas5110c1b_set_crop(struct sn9c102_device* cam,
 }
 
 
-static int tas5110c1b_set_pix_format(struct sn9c102_device* cam, 
-                                     const struct v4l2_pix_format* pix)
+static int tas5110c1b_set_pix_format(struct sn9c102_device* cam,
+                                    const struct v4l2_pix_format* pix)
 {
        int err = 0;
 
@@ -142,14 +142,18 @@ static struct sn9c102_sensor tas5110c1b = {
 
 int sn9c102_probe_tas5110c1b(struct sn9c102_device* cam)
 {
-       /* This sensor has no identifiers, so let's attach it anyway */
-       sn9c102_attach_sensor(cam, &tas5110c1b);
+       const struct usb_device_id tas5110c1b_id_table[] = {
+               { USB_DEVICE(0x0c45, 0x6001), },
+               { USB_DEVICE(0x0c45, 0x6005), },
+               { USB_DEVICE(0x0c45, 0x60ab), },
+               { }
+       };
 
        /* Sensor detection is based on USB pid/vid */
-       if (le16_to_cpu(tas5110c1b.usbdev->descriptor.idProduct) != 0x6001 &&
-           le16_to_cpu(tas5110c1b.usbdev->descriptor.idProduct) != 0x6005 &&
-           le16_to_cpu(tas5110c1b.usbdev->descriptor.idProduct) != 0x60ab)
+       if (!sn9c102_match_id(cam, tas5110c1b_id_table))
                return -ENODEV;
 
+       sn9c102_attach_sensor(cam, &tas5110c1b);
+
        return 0;
 }