]> bbs.cooldavid.org Git - net-next-2.6.git/blobdiff - drivers/media/video/cx25840/cx25840-core.c
Merge git://git.kernel.org/pub/scm/linux/kernel/git/gregkh/staging-2.6
[net-next-2.6.git] / drivers / media / video / cx25840 / cx25840-core.c
index f5a3e74c3c7cc0e6e52ebec222b28604e7cf53ef..dfb198d0415bc200b0152c1be105d722261653c5 100644 (file)
@@ -42,7 +42,6 @@
 #include <linux/delay.h>
 #include <media/v4l2-common.h>
 #include <media/v4l2-chip-ident.h>
-#include <media/v4l2-i2c-drv.h>
 #include <media/cx25840.h>
 
 #include "cx25840-core.h"
@@ -871,6 +870,11 @@ static void input_change(struct i2c_client *client)
        }
        cx25840_and_or(client, 0x401, ~0x60, 0);
        cx25840_and_or(client, 0x401, ~0x60, 0x60);
+
+       /* Don't write into audio registers on cx2583x chips */
+       if (is_cx2583x(state))
+               return;
+
        cx25840_and_or(client, 0x810, ~0x01, 1);
 
        if (state->radio) {
@@ -1029,10 +1033,8 @@ static int set_input(struct i2c_client *client, enum cx25840_video_input vid_inp
 
        state->vid_input = vid_input;
        state->aud_input = aud_input;
-       if (!is_cx2583x(state)) {
-               cx25840_audio_set_path(client);
-               input_change(client);
-       }
+       cx25840_audio_set_path(client);
+       input_change(client);
 
        if (is_cx2388x(state)) {
                /* Audio channel 1 src : Parallel 1 */
@@ -1553,18 +1555,14 @@ static int cx25840_s_audio_routing(struct v4l2_subdev *sd,
        struct cx25840_state *state = to_state(sd);
        struct i2c_client *client = v4l2_get_subdevdata(sd);
 
-       if (is_cx2583x(state))
-               return -EINVAL;
        return set_input(client, state->vid_input, input);
 }
 
 static int cx25840_s_frequency(struct v4l2_subdev *sd, struct v4l2_frequency *freq)
 {
-       struct cx25840_state *state = to_state(sd);
        struct i2c_client *client = v4l2_get_subdevdata(sd);
 
-       if (!is_cx2583x(state))
-               input_change(client);
+       input_change(client);
        return 0;
 }
 
@@ -2043,9 +2041,25 @@ static const struct i2c_device_id cx25840_id[] = {
 };
 MODULE_DEVICE_TABLE(i2c, cx25840_id);
 
-static struct v4l2_i2c_driver_data v4l2_i2c_data = {
-       .name = "cx25840",
-       .probe = cx25840_probe,
-       .remove = cx25840_remove,
-       .id_table = cx25840_id,
+static struct i2c_driver cx25840_driver = {
+       .driver = {
+               .owner  = THIS_MODULE,
+               .name   = "cx25840",
+       },
+       .probe          = cx25840_probe,
+       .remove         = cx25840_remove,
+       .id_table       = cx25840_id,
 };
+
+static __init int init_cx25840(void)
+{
+       return i2c_add_driver(&cx25840_driver);
+}
+
+static __exit void exit_cx25840(void)
+{
+       i2c_del_driver(&cx25840_driver);
+}
+
+module_init(init_cx25840);
+module_exit(exit_cx25840);