]> pilppa.org Git - linux-2.6-omap-h63xx.git/blobdiff - drivers/media/video/cs53l32a.c
Pull ec into release branch
[linux-2.6-omap-h63xx.git] / drivers / media / video / cs53l32a.c
index 8739c64785ef4a2c73092c9b4c12d64d3fc84305..a73e285af7305c5429c9f51898b7593ebeccdd67 100644 (file)
@@ -28,6 +28,7 @@
 #include <linux/i2c-id.h>
 #include <linux/videodev.h>
 #include <media/v4l2-common.h>
+#include <media/v4l2-chip-ident.h>
 
 MODULE_DESCRIPTION("i2c device driver for cs53l32a Audio ADC");
 MODULE_AUTHOR("Martin Vaughan");
@@ -59,25 +60,25 @@ static int cs53l32a_read(struct i2c_client *client, u8 reg)
 static int cs53l32a_command(struct i2c_client *client, unsigned int cmd,
                            void *arg)
 {
-       struct v4l2_audio *input = arg;
+       struct v4l2_routing *route = arg;
        struct v4l2_control *ctrl = arg;
 
        switch (cmd) {
-       case VIDIOC_S_AUDIO:
+       case VIDIOC_INT_G_AUDIO_ROUTING:
+               route->input = (cs53l32a_read(client, 0x01) >> 4) & 3;
+               route->output = 0;
+               break;
+
+       case VIDIOC_INT_S_AUDIO_ROUTING:
                /* There are 2 physical inputs, but the second input can be
                   placed in two modes, the first mode bypasses the PGA (gain),
                   the second goes through the PGA. Hence there are three
                   possible inputs to choose from. */
-               if (input->index > 2) {
-                       v4l_err(client, "Invalid input %d.\n", input->index);
+               if (route->input > 2) {
+                       v4l_err(client, "Invalid input %d.\n", route->input);
                        return -EINVAL;
                }
-               cs53l32a_write(client, 0x01, 0x01 + (input->index << 4));
-               break;
-
-       case VIDIOC_G_AUDIO:
-               memset(input, 0, sizeof(*input));
-               input->index = (cs53l32a_read(client, 0x01) >> 4) & 3;
+               cs53l32a_write(client, 0x01, 0x01 + (route->input << 4));
                break;
 
        case VIDIOC_G_CTRL:
@@ -103,6 +104,9 @@ static int cs53l32a_command(struct i2c_client *client, unsigned int cmd,
                cs53l32a_write(client, 0x05, (u8) ctrl->value);
                break;
 
+       case VIDIOC_G_CHIP_IDENT:
+               return v4l2_chip_ident_i2c_client(client, arg, V4L2_IDENT_CS53l32A, 0);
+
        case VIDIOC_LOG_STATUS:
                {
                        u8 v = cs53l32a_read(client, 0x01);