V4L/DVB (11022): zoran/bt819: use new notify functionality.
[safe/jmp/linux-2.6] / drivers / media / video / bt819.c
index e0d8e2b..217294d 100644 (file)
 #include <linux/types.h>
 #include <linux/ioctl.h>
 #include <linux/delay.h>
-#include <asm/uaccess.h>
+#include <linux/uaccess.h>
 #include <linux/i2c.h>
 #include <linux/i2c-id.h>
 #include <linux/videodev2.h>
 #include <media/v4l2-device.h>
 #include <media/v4l2-chip-ident.h>
 #include <media/v4l2-i2c-drv.h>
+#include <media/bt819.h>
 
 MODULE_DESCRIPTION("Brooktree-819 video decoder driver");
 MODULE_AUTHOR("Mike Bernson & Dave Perks");
@@ -250,7 +251,11 @@ static int bt819_s_std(struct v4l2_subdev *sd, v4l2_std_id std)
 
        v4l2_dbg(1, debug, sd, "set norm %llx\n", (unsigned long long)std);
 
+       if (sd->v4l2_dev == NULL || sd->v4l2_dev->notify == NULL)
+               v4l2_err(sd, "no notify found!\n");
+
        if (std & V4L2_STD_NTSC) {
+               v4l2_subdev_notify(sd, BT819_FIFO_RESET_LOW, 0);
                bt819_setbit(decoder, 0x01, 0, 1);
                bt819_setbit(decoder, 0x01, 1, 0);
                bt819_setbit(decoder, 0x01, 5, 0);
@@ -259,6 +264,7 @@ static int bt819_s_std(struct v4l2_subdev *sd, v4l2_std_id std)
                /* bt819_setbit(decoder, 0x1a,  5, 1); */
                timing = &timing_data[1];
        } else if (std & V4L2_STD_PAL) {
+               v4l2_subdev_notify(sd, BT819_FIFO_RESET_LOW, 0);
                bt819_setbit(decoder, 0x01, 0, 1);
                bt819_setbit(decoder, 0x01, 1, 1);
                bt819_setbit(decoder, 0x01, 5, 1);
@@ -283,6 +289,7 @@ static int bt819_s_std(struct v4l2_subdev *sd, v4l2_std_id std)
        bt819_write(decoder, 0x08, (timing->hscale >> 8) & 0xff);
        bt819_write(decoder, 0x09, timing->hscale & 0xff);
        decoder->norm = std;
+       v4l2_subdev_notify(sd, BT819_FIFO_RESET_HIGH, 0);
        return 0;
 }
 
@@ -295,7 +302,11 @@ static int bt819_s_routing(struct v4l2_subdev *sd, const struct v4l2_routing *ro
        if (route->input < 0 || route->input > 7)
                return -EINVAL;
 
+       if (sd->v4l2_dev == NULL || sd->v4l2_dev->notify == NULL)
+               v4l2_err(sd, "no notify found!\n");
+
        if (decoder->input != route->input) {
+               v4l2_subdev_notify(sd, BT819_FIFO_RESET_LOW, 0);
                decoder->input = route->input;
                /* select mode */
                if (decoder->input == 0) {
@@ -305,6 +316,7 @@ static int bt819_s_routing(struct v4l2_subdev *sd, const struct v4l2_routing *ro
                        bt819_setbit(decoder, 0x0b, 6, 1);
                        bt819_setbit(decoder, 0x1a, 1, 0);
                }
+               v4l2_subdev_notify(sd, BT819_FIFO_RESET_HIGH, 0);
        }
        return 0;
 }