]> err.no Git - linux-2.6/blobdiff - drivers/media/video/ivtv/ivtv-controls.c
Merge branches 'at91', 'dyntick', 'ep93xx', 'iop', 'ixp', 'misc', 'orion', 'omap...
[linux-2.6] / drivers / media / video / ivtv / ivtv-controls.c
index 7a876c3e5b19e836b955ccf9948cec413dabe8f9..c7e449f6397bb9b3d6f91311ee82fbfa0289bdc9 100644 (file)
@@ -21,7 +21,7 @@
 #include "ivtv-driver.h"
 #include "ivtv-cards.h"
 #include "ivtv-ioctl.h"
-#include "ivtv-audio.h"
+#include "ivtv-routing.h"
 #include "ivtv-i2c.h"
 #include "ivtv-mailbox.h"
 #include "ivtv-controls.h"
@@ -181,12 +181,12 @@ static int ivtv_setup_vbi_fmt(struct ivtv *itv, enum v4l2_mpeg_stream_vbi_fmt fm
                return 0;
        }
        /* Need sliced data for mpeg insertion */
-       if (get_service_set(itv->vbi.sliced_in) == 0) {
+       if (ivtv_get_service_set(itv->vbi.sliced_in) == 0) {
                if (itv->is_60hz)
                        itv->vbi.sliced_in->service_set = V4L2_SLICED_CAPTION_525;
                else
                        itv->vbi.sliced_in->service_set = V4L2_SLICED_WSS_625;
-               expand_service_set(itv->vbi.sliced_in, itv->is_50hz);
+               ivtv_expand_service_set(itv->vbi.sliced_in, itv->is_50hz);
        }
        return 0;
 }
@@ -231,8 +231,10 @@ int ivtv_control_ioctls(struct ivtv *itv, unsigned int cmd, void *arg)
                }
                IVTV_DEBUG_IOCTL("VIDIOC_S_EXT_CTRLS\n");
                if (c->ctrl_class == V4L2_CTRL_CLASS_MPEG) {
+                       static u32 freqs[3] = { 44100, 48000, 32000 };
                        struct cx2341x_mpeg_params p = itv->params;
-                       int err = cx2341x_ext_ctrls(&p, arg, cmd);
+                       int err = cx2341x_ext_ctrls(&p, atomic_read(&itv->capturing), arg, cmd);
+                       unsigned idx;
 
                        if (err)
                                return err;
@@ -254,7 +256,11 @@ int ivtv_control_ioctls(struct ivtv *itv, unsigned int cmd, void *arg)
                        }
                        itv->params = p;
                        itv->dualwatch_stereo_mode = p.audio_properties & 0x0300;
-                       ivtv_audio_set_audio_clock_freq(itv, p.audio_properties & 0x03);
+                       idx = p.audio_properties & 0x03;
+                       /* The audio clock of the digitizer must match the codec sample
+                          rate otherwise you get some very strange effects. */
+                       if (idx < sizeof(freqs))
+                           ivtv_call_i2c_clients(itv, VIDIOC_INT_AUDIO_CLOCK_FREQ, &freqs[idx]);
                        return err;
                }
                return -EINVAL;
@@ -282,7 +288,7 @@ int ivtv_control_ioctls(struct ivtv *itv, unsigned int cmd, void *arg)
                }
                IVTV_DEBUG_IOCTL("VIDIOC_G_EXT_CTRLS\n");
                if (c->ctrl_class == V4L2_CTRL_CLASS_MPEG)
-                       return cx2341x_ext_ctrls(&itv->params, arg, cmd);
+                       return cx2341x_ext_ctrls(&itv->params, 0, arg, cmd);
                return -EINVAL;
        }
 
@@ -292,7 +298,7 @@ int ivtv_control_ioctls(struct ivtv *itv, unsigned int cmd, void *arg)
 
                IVTV_DEBUG_IOCTL("VIDIOC_TRY_EXT_CTRLS\n");
                if (c->ctrl_class == V4L2_CTRL_CLASS_MPEG)
-                       return cx2341x_ext_ctrls(&itv->params, arg, cmd);
+                       return cx2341x_ext_ctrls(&itv->params, atomic_read(&itv->capturing), arg, cmd);
                return -EINVAL;
        }