]> git.kernelconcepts.de Git - karo-tx-linux.git/commitdiff
V4L/DVB (6092): ivtv: more cleanups, merged ivtv-audio.c and ivtv-video.c into ivtv...
authorHans Verkuil <hverkuil@xs4all.nl>
Thu, 23 Aug 2007 09:32:46 +0000 (06:32 -0300)
committerMauro Carvalho Chehab <mchehab@infradead.org>
Wed, 10 Oct 2007 01:06:47 +0000 (22:06 -0300)
Signed-off-by: Hans Verkuil <hverkuil@xs4all.nl>
Signed-off-by: Mauro Carvalho Chehab <mchehab@infradead.org>
17 files changed:
drivers/media/video/ivtv/Makefile
drivers/media/video/ivtv/ivtv-audio.c [deleted file]
drivers/media/video/ivtv/ivtv-controls.c
drivers/media/video/ivtv/ivtv-driver.c
drivers/media/video/ivtv/ivtv-driver.h
drivers/media/video/ivtv/ivtv-fb.c
drivers/media/video/ivtv/ivtv-fileops.c
drivers/media/video/ivtv/ivtv-ioctl.c
drivers/media/video/ivtv/ivtv-irq.h
drivers/media/video/ivtv/ivtv-mailbox.h
drivers/media/video/ivtv/ivtv-routing.c [moved from drivers/media/video/ivtv/ivtv-video.c with 59% similarity]
drivers/media/video/ivtv/ivtv-routing.h [moved from drivers/media/video/ivtv/ivtv-audio.h with 77% similarity]
drivers/media/video/ivtv/ivtv-streams.c
drivers/media/video/ivtv/ivtv-vbi.c
drivers/media/video/ivtv/ivtv-video.h [deleted file]
drivers/media/video/ivtv/ivtv-yuv.c
drivers/media/video/ivtv/ivtv-yuv.h

index 90e2d127056152f41653d5782f90d79c4b9725c2..6998781e2b118b2a01d7372b112826a647500697 100644 (file)
@@ -1,8 +1,8 @@
-ivtv-objs      := ivtv-audio.o ivtv-cards.o ivtv-controls.o \
+ivtv-objs      := ivtv-routing.o ivtv-cards.o ivtv-controls.o \
                   ivtv-driver.o ivtv-fileops.o ivtv-firmware.o \
                   ivtv-gpio.o ivtv-i2c.o ivtv-ioctl.o ivtv-irq.o \
                   ivtv-mailbox.o ivtv-queue.o ivtv-streams.o ivtv-udma.o \
-                  ivtv-vbi.o ivtv-video.o ivtv-yuv.o
+                  ivtv-vbi.o ivtv-yuv.o
 
 obj-$(CONFIG_VIDEO_IVTV) += ivtv.o
 obj-$(CONFIG_VIDEO_IVTV_FB) += ivtv-fb.o
diff --git a/drivers/media/video/ivtv/ivtv-audio.c b/drivers/media/video/ivtv/ivtv-audio.c
deleted file mode 100644 (file)
index 6cb65d6..0000000
+++ /dev/null
@@ -1,71 +0,0 @@
-/*
-    Audio-related ivtv functions.
-    Copyright (C) 2003-2004  Kevin Thayer <nufan_wfk at yahoo.com>
-    Copyright (C) 2005-2007  Hans Verkuil <hverkuil@xs4all.nl>
-
-    This program is free software; you can redistribute it and/or modify
-    it under the terms of the GNU General Public License as published by
-    the Free Software Foundation; either version 2 of the License, or
-    (at your option) any later version.
-
-    This program is distributed in the hope that it will be useful,
-    but WITHOUT ANY WARRANTY; without even the implied warranty of
-    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
-    GNU General Public License for more details.
-
-    You should have received a copy of the GNU General Public License
-    along with this program; if not, write to the Free Software
-    Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
- */
-
-#include "ivtv-driver.h"
-#include "ivtv-i2c.h"
-#include "ivtv-cards.h"
-#include "ivtv-audio.h"
-#include <media/msp3400.h>
-
-/* Selects the audio input and output according to the current
-   settings. */
-int ivtv_audio_set_io(struct ivtv *itv)
-{
-       struct v4l2_routing route;
-       u32 audio_input;
-       int mux_input;
-
-       /* Determine which input to use */
-       if (test_bit(IVTV_F_I_RADIO_USER, &itv->i_flags)) {
-               audio_input = itv->card->radio_input.audio_input;
-               mux_input = itv->card->radio_input.muxer_input;
-       } else {
-               audio_input = itv->card->audio_inputs[itv->audio_input].audio_input;
-               mux_input = itv->card->audio_inputs[itv->audio_input].muxer_input;
-       }
-
-       /* handle muxer chips */
-       route.input = mux_input;
-       route.output = 0;
-       ivtv_i2c_hw(itv, itv->card->hw_muxer, VIDIOC_INT_S_AUDIO_ROUTING, &route);
-
-       route.input = audio_input;
-       if (itv->card->hw_audio & IVTV_HW_MSP34XX) {
-               route.output = MSP_OUTPUT(MSP_SC_IN_DSP_SCART1);
-       }
-       return ivtv_i2c_hw(itv, itv->card->hw_audio, VIDIOC_INT_S_AUDIO_ROUTING, &route);
-}
-
-void ivtv_audio_set_route(struct ivtv *itv, struct v4l2_routing *route)
-{
-       ivtv_i2c_hw(itv, itv->card->hw_audio, VIDIOC_INT_S_AUDIO_ROUTING, route);
-}
-
-void ivtv_audio_set_audio_clock_freq(struct ivtv *itv, u8 freq)
-{
-       static u32 freqs[3] = { 44100, 48000, 32000 };
-
-       /* The audio clock of the digitizer must match the codec sample
-          rate otherwise you get some very strange effects. */
-       if (freq > 2)
-               return;
-       ivtv_call_i2c_clients(itv, VIDIOC_INT_AUDIO_CLOCK_FREQ, &freqs[freq]);
-}
-
index 0005ea46f20890771d250ca96393bdabc4f5b6a6..8c02fa661591fd063611795c1dd5236aedede43e 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"
@@ -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, 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;
index 2ed9894672f4ea87078fe3a425cac8e647b33155..6a74e509c87def9b776d8cd0e8224b9ab578cb0e 100644 (file)
@@ -52,7 +52,7 @@
 #include "ivtv-ioctl.h"
 #include "ivtv-cards.h"
 #include "ivtv-vbi.h"
-#include "ivtv-audio.h"
+#include "ivtv-routing.h"
 #include "ivtv-gpio.h"
 #include "ivtv-yuv.h"
 
@@ -106,6 +106,18 @@ static char secam[] = "--";
 static char ntsc[] = "-";
 
 /* Buffers */
+
+/* DMA Buffers, Default size in MB allocated */
+#define IVTV_DEFAULT_ENC_MPG_BUFFERS 4
+#define IVTV_DEFAULT_ENC_YUV_BUFFERS 2
+#define IVTV_DEFAULT_ENC_VBI_BUFFERS 1
+/* Exception: size in kB for this stream (MB is overkill) */
+#define IVTV_DEFAULT_ENC_PCM_BUFFERS 320
+#define IVTV_DEFAULT_DEC_MPG_BUFFERS 1
+#define IVTV_DEFAULT_DEC_YUV_BUFFERS 1
+/* Exception: size in kB for this stream (MB is way overkill) */
+#define IVTV_DEFAULT_DEC_VBI_BUFFERS 64
+
 static int enc_mpg_buffers = IVTV_DEFAULT_ENC_MPG_BUFFERS;
 static int enc_yuv_buffers = IVTV_DEFAULT_ENC_YUV_BUFFERS;
 static int enc_vbi_buffers = IVTV_DEFAULT_ENC_VBI_BUFFERS;
index f7849f852e9d100af2ff9ef08ce6bfa12648fa1a..b9dfdab66362883460f77fe08d689623592939cb 100644 (file)
 #include <media/ivtv.h>
 
 
+/* Memory layout */
 #define IVTV_ENCODER_OFFSET    0x00000000
-#define IVTV_ENCODER_SIZE      0x00800000      /* Last half isn't needed 0x01000000 */
-
+#define IVTV_ENCODER_SIZE      0x00800000      /* Total size is 0x01000000, but only first half is used */
 #define IVTV_DECODER_OFFSET    0x01000000
-#define IVTV_DECODER_SIZE      0x00800000      /* Last half isn't needed 0x01000000 */
-
+#define IVTV_DECODER_SIZE      0x00800000      /* Total size is 0x01000000, but only first half is used */
 #define IVTV_REG_OFFSET        0x02000000
 #define IVTV_REG_SIZE          0x00010000
 
 #define IVTV_DEC_STREAM_TYPE_YUV  8
 #define IVTV_MAX_STREAMS         9
 
-#define IVTV_V4L2_DEC_MPG_OFFSET  16   /* offset from 0 to register decoder mpg v4l2 minors on */
-#define IVTV_V4L2_ENC_PCM_OFFSET  24   /* offset from 0 to register pcm v4l2 minors on */
-#define IVTV_V4L2_ENC_YUV_OFFSET  32   /* offset from 0 to register yuv v4l2 minors on */
-#define IVTV_V4L2_DEC_YUV_OFFSET  48   /* offset from 0 to register decoder yuv v4l2 minors on */
-#define IVTV_V4L2_DEC_VBI_OFFSET   8   /* offset from 0 to register decoder vbi input v4l2 minors on */
-#define IVTV_V4L2_DEC_VOUT_OFFSET 16   /* offset from 0 to register vbi output v4l2 minors on */
-
-#define IVTV_ENC_MEM_START 0x00000000
-#define IVTV_DEC_MEM_START 0x01000000
-
-/* Decoder Buffer hardware size on Chip */
-#define IVTV_DEC_MAX_BUF        0x00100000     /* max bytes in decoder buffer */
-#define IVTV_DEC_MIN_BUF        0x00010000     /* min bytes in dec buffer */
-
-/* ======================================================================== */
-/* ========================== START USER SETTABLE DMA VARIABLES =========== */
-/* ======================================================================== */
-
 #define IVTV_DMA_SG_OSD_ENT    (2883584/PAGE_SIZE)     /* sg entities */
 
-/* DMA Buffers, Default size in MB allocated */
-#define IVTV_DEFAULT_ENC_MPG_BUFFERS 4
-#define IVTV_DEFAULT_ENC_YUV_BUFFERS 2
-#define IVTV_DEFAULT_ENC_VBI_BUFFERS 1
-/* Exception: size in kB for this stream (MB is overkill) */
-#define IVTV_DEFAULT_ENC_PCM_BUFFERS 320
-#define IVTV_DEFAULT_DEC_MPG_BUFFERS 1
-#define IVTV_DEFAULT_DEC_YUV_BUFFERS 1
-/* Exception: size in kB for this stream (MB is way overkill) */
-#define IVTV_DEFAULT_DEC_VBI_BUFFERS 64
-
-/* ======================================================================== */
-/* ========================== END USER SETTABLE DMA VARIABLES ============= */
-/* ======================================================================== */
-
-/* Decoder Status Register */
-#define IVTV_DMA_ERR_LIST      0x00000010
-#define IVTV_DMA_ERR_WRITE     0x00000008
-#define IVTV_DMA_ERR_READ      0x00000004
-#define IVTV_DMA_SUCCESS_WRITE         0x00000002
-#define IVTV_DMA_SUCCESS_READ  0x00000001
-#define IVTV_DMA_READ_ERR      (IVTV_DMA_ERR_LIST | IVTV_DMA_ERR_READ)
-#define IVTV_DMA_WRITE_ERR     (IVTV_DMA_ERR_LIST | IVTV_DMA_ERR_WRITE)
-#define IVTV_DMA_ERR           (IVTV_DMA_ERR_LIST | IVTV_DMA_ERR_WRITE | IVTV_DMA_ERR_READ)
-
 /* DMA Registers */
 #define IVTV_REG_DMAXFER       (0x0000)
 #define IVTV_REG_DMASTATUS     (0x0004)
 #define IVTV_REG_VPU                   (0x9058)
 #define IVTV_REG_APU                   (0xA064)
 
-#define IVTV_IRQ_ENC_START_CAP         (0x1 << 31)
-#define IVTV_IRQ_ENC_EOS               (0x1 << 30)
-#define IVTV_IRQ_ENC_VBI_CAP           (0x1 << 29)
-#define IVTV_IRQ_ENC_VIM_RST           (0x1 << 28)
-#define IVTV_IRQ_ENC_DMA_COMPLETE      (0x1 << 27)
-#define IVTV_IRQ_ENC_PIO_COMPLETE      (0x1 << 25)
-#define IVTV_IRQ_DEC_AUD_MODE_CHG      (0x1 << 24)
-#define IVTV_IRQ_DEC_DATA_REQ          (0x1 << 22)
-#define IVTV_IRQ_DEC_DMA_COMPLETE      (0x1 << 20)
-#define IVTV_IRQ_DEC_VBI_RE_INSERT     (0x1 << 19)
-#define IVTV_IRQ_DMA_ERR               (0x1 << 18)
-#define IVTV_IRQ_DMA_WRITE             (0x1 << 17)
-#define IVTV_IRQ_DMA_READ              (0x1 << 16)
-#define IVTV_IRQ_DEC_VSYNC             (0x1 << 10)
-
-/* IRQ Masks */
-#define IVTV_IRQ_MASK_INIT (IVTV_IRQ_DMA_ERR|IVTV_IRQ_ENC_DMA_COMPLETE|\
-               IVTV_IRQ_DMA_READ|IVTV_IRQ_ENC_PIO_COMPLETE)
-
-#define IVTV_IRQ_MASK_CAPTURE (IVTV_IRQ_ENC_START_CAP | IVTV_IRQ_ENC_EOS)
-#define IVTV_IRQ_MASK_DECODE  (IVTV_IRQ_DEC_DATA_REQ|IVTV_IRQ_DEC_AUD_MODE_CHG)
-
 /* i2c stuff */
 #define I2C_CLIENTS_MAX 16
 
 /* debugging */
+extern int ivtv_debug;
 
 #define IVTV_DBGFLG_WARN    (1 << 0)
 #define IVTV_DBGFLG_INFO    (1 << 1)
 #define IVTV_WARN(fmt, args...)     printk(KERN_WARNING "ivtv%d: " fmt, itv->num , ## args)
 #define IVTV_INFO(fmt, args...)     printk(KERN_INFO "ivtv%d: " fmt, itv->num , ## args)
 
-/* Values for IVTV_API_DEC_PLAYBACK_SPEED mpeg_frame_type_mask parameter: */
-#define MPEG_FRAME_TYPE_IFRAME 1
-#define MPEG_FRAME_TYPE_IFRAME_PFRAME 3
-#define MPEG_FRAME_TYPE_ALL 7
-
 /* output modes (cx23415 only) */
 #define OUT_NONE        0
 #define OUT_MPG         1
 
 #define IVTV_MAX_PGM_INDEX (400)
 
-extern int ivtv_debug;
-
-
 struct ivtv_options {
        int kilobytes[IVTV_MAX_STREAMS]; /* Size in kilobytes of each stream */
        int cardtype;           /* force card type on load */
@@ -260,11 +187,6 @@ struct ivtv_options {
        int newi2c;             /* New I2C algorithm */
 };
 
-#define IVTV_MBOX_DMA_START 6
-#define IVTV_MBOX_DMA_END 8
-#define IVTV_MBOX_DMA 9
-#define IVTV_MBOX_FIELD_DISPLAYED 8
-
 /* ivtv-specific mailbox template */
 struct ivtv_mailbox {
        u32 flags;
@@ -450,31 +372,28 @@ struct ivtv_open_id {
        struct ivtv *itv;
 };
 
-#define IVTV_YUV_UPDATE_HORIZONTAL  0x01
-#define IVTV_YUV_UPDATE_VERTICAL    0x02
-
 struct yuv_frame_info
 {
        u32 update;
-       int src_x;
-       int src_y;
-       unsigned int src_w;
-       unsigned int src_h;
-       int dst_x;
-       int dst_y;
-       unsigned int dst_w;
-       unsigned int dst_h;
-       int pan_x;
-       int pan_y;
+       s32 src_x;
+       s32 src_y;
+       u32 src_w;
+       u32 src_h;
+       s32 dst_x;
+       s32 dst_y;
+       u32 dst_w;
+       u32 dst_h;
+       s32 pan_x;
+       s32 pan_y;
        u32 vis_w;
        u32 vis_h;
        u32 interlaced_y;
        u32 interlaced_uv;
-       int tru_x;
+       s32 tru_x;
        u32 tru_w;
        u32 tru_h;
        u32 offset_y;
-       int lace_mode;
+       s32 lace_mode;
 };
 
 #define IVTV_YUV_MODE_INTERLACED       0x00
index 7618cd47a35de05e85e15806572f05ea8a6f8f79..2c521d1bb05707f4461b81c6d245bdc8f7720d29 100644 (file)
@@ -382,7 +382,7 @@ static int ivtv_fb_prep_frame(struct ivtv *itv, int cmd, void __user *source,
        }
 
        /* OSD Address to send DMA to */
-       dest_offset += IVTV_DEC_MEM_START + oi->video_rbase;
+       dest_offset += IVTV_DECODER_OFFSET + oi->video_rbase;
 
        /* Fill Buffers */
        return ivtv_fb_prep_dec_dma_to_device(itv, dest_offset, source, count);
index 6449f5831e66aa7f8fe1d5e659f5a00ba370c8b6..170bef61aa6241fb65aa7ed2ccc83ad23d24a39d 100644 (file)
@@ -27,7 +27,7 @@
 #include "ivtv-irq.h"
 #include "ivtv-vbi.h"
 #include "ivtv-mailbox.h"
-#include "ivtv-audio.h"
+#include "ivtv-routing.h"
 #include "ivtv-streams.h"
 #include "ivtv-yuv.h"
 #include "ivtv-ioctl.h"
index bb59634419cc680eb8536967972280b39c545b49..f4f56a6e1f81be0f73a9693dd52e90c43f8e639f 100644 (file)
@@ -25,8 +25,7 @@
 #include "ivtv-queue.h"
 #include "ivtv-fileops.h"
 #include "ivtv-vbi.h"
-#include "ivtv-audio.h"
-#include "ivtv-video.h"
+#include "ivtv-routing.h"
 #include "ivtv-streams.h"
 #include "ivtv-yuv.h"
 #include "ivtv-ioctl.h"
@@ -675,7 +674,7 @@ static int ivtv_debug_ioctls(struct file *filp, unsigned int cmd, void *arg)
        case VIDIOC_INT_S_AUDIO_ROUTING: {
                struct v4l2_routing *route = arg;
 
-               ivtv_audio_set_route(itv, route);
+               ivtv_i2c_hw(itv, itv->card->hw_audio, VIDIOC_INT_S_AUDIO_ROUTING, route);
                break;
        }
 
index e180bd3489896ba3f2fd41f919fc6b4be0042ac5..f879a5822e7138ae8b374fa2f01ca86d40114951 100644 (file)
 #ifndef IVTV_IRQ_H
 #define IVTV_IRQ_H
 
+#define IVTV_IRQ_ENC_START_CAP         (0x1 << 31)
+#define IVTV_IRQ_ENC_EOS               (0x1 << 30)
+#define IVTV_IRQ_ENC_VBI_CAP           (0x1 << 29)
+#define IVTV_IRQ_ENC_VIM_RST           (0x1 << 28)
+#define IVTV_IRQ_ENC_DMA_COMPLETE      (0x1 << 27)
+#define IVTV_IRQ_ENC_PIO_COMPLETE      (0x1 << 25)
+#define IVTV_IRQ_DEC_AUD_MODE_CHG      (0x1 << 24)
+#define IVTV_IRQ_DEC_DATA_REQ          (0x1 << 22)
+#define IVTV_IRQ_DEC_DMA_COMPLETE      (0x1 << 20)
+#define IVTV_IRQ_DEC_VBI_RE_INSERT     (0x1 << 19)
+#define IVTV_IRQ_DMA_ERR               (0x1 << 18)
+#define IVTV_IRQ_DMA_WRITE             (0x1 << 17)
+#define IVTV_IRQ_DMA_READ              (0x1 << 16)
+#define IVTV_IRQ_DEC_VSYNC             (0x1 << 10)
+
+/* IRQ Masks */
+#define IVTV_IRQ_MASK_INIT (IVTV_IRQ_DMA_ERR|IVTV_IRQ_ENC_DMA_COMPLETE|\
+               IVTV_IRQ_DMA_READ|IVTV_IRQ_ENC_PIO_COMPLETE)
+
+#define IVTV_IRQ_MASK_CAPTURE (IVTV_IRQ_ENC_START_CAP | IVTV_IRQ_ENC_EOS)
+#define IVTV_IRQ_MASK_DECODE  (IVTV_IRQ_DEC_DATA_REQ|IVTV_IRQ_DEC_AUD_MODE_CHG)
+
 irqreturn_t ivtv_irq_handler(int irq, void *dev_id);
 
 void ivtv_irq_work_handler(struct work_struct *work);
index 90c871b8e23bd8d9ba016970e064d7f5c7c9e303..71a54eef8fc7ca8814f4ab5c6851b4b8f6e9abd1 100644 (file)
@@ -21,6 +21,9 @@
 #ifndef IVTV_MAILBOX_H
 #define IVTV_MAILBOX_H
 
+#define IVTV_MBOX_DMA_END         8
+#define IVTV_MBOX_DMA             9
+
 void ivtv_api_get_data(struct ivtv_mailbox_data *mbox, int mb, u32 data[]);
 int ivtv_api(struct ivtv *itv, int cmd, int args, u32 data[]);
 int ivtv_vapi_result(struct ivtv *itv, u32 data[CX2341X_MBOX_MAX_DATA], int cmd, int args, ...);
similarity index 59%
rename from drivers/media/video/ivtv/ivtv-video.c
rename to drivers/media/video/ivtv/ivtv-routing.c
index 5858b197d51050181fedc4eca72087e210ad79d9..398bd33033ed6f77ca5291b301f96da8ff4e9211 100644 (file)
@@ -1,6 +1,7 @@
 /*
-    saa7127 interface functions
-    Copyright (C) 2004-2007  Hans Verkuil <hverkuil@xs4all.nl>
+    Audio/video-routing-related ivtv functions.
+    Copyright (C) 2003-2004  Kevin Thayer <nufan_wfk at yahoo.com>
+    Copyright (C) 2005-2007  Hans Verkuil <hverkuil@xs4all.nl>
 
     This program is free software; you can redistribute it and/or modify
     it under the terms of the GNU General Public License as published by
  */
 
 #include "ivtv-driver.h"
-#include "ivtv-video.h"
 #include "ivtv-i2c.h"
-#include "ivtv-gpio.h"
 #include "ivtv-cards.h"
+#include "ivtv-gpio.h"
+#include "ivtv-routing.h"
+
+#include <media/msp3400.h>
 #include <media/upd64031a.h>
 #include <media/upd64083.h>
 
-void ivtv_set_vps(struct ivtv *itv, int enabled, u8 vps1, u8 vps2, u8 vps3,
-                 u8 vps4, u8 vps5)
+/* Selects the audio input and output according to the current
+   settings. */
+void ivtv_audio_set_io(struct ivtv *itv)
 {
-       struct v4l2_sliced_vbi_data data;
-
-       if (!(itv->v4l2_cap & V4L2_CAP_VIDEO_OUTPUT))
-               return;
-       data.id = V4L2_SLICED_VPS;
-       data.field = 0;
-       data.line = enabled ? 16 : 0;
-       data.data[4] = vps1;
-       data.data[10] = vps2;
-       data.data[11] = vps3;
-       data.data[12] = vps4;
-       data.data[13] = vps5;
-       ivtv_saa7127(itv, VIDIOC_INT_S_VBI_DATA, &data);
-}
+       struct v4l2_routing route;
+       u32 audio_input;
+       int mux_input;
 
-void ivtv_set_cc(struct ivtv *itv, int mode, u8 cc1, u8 cc2, u8 cc3, u8 cc4)
-{
-       struct v4l2_sliced_vbi_data data;
-
-       if (!(itv->v4l2_cap & V4L2_CAP_VIDEO_OUTPUT))
-               return;
-       data.id = V4L2_SLICED_CAPTION_525;
-       data.field = 0;
-       data.line = (mode & 1) ? 21 : 0;
-       data.data[0] = cc1;
-       data.data[1] = cc2;
-       ivtv_saa7127(itv, VIDIOC_INT_S_VBI_DATA, &data);
-       data.field = 1;
-       data.line = (mode & 2) ? 21 : 0;
-       data.data[0] = cc3;
-       data.data[1] = cc4;
-       ivtv_saa7127(itv, VIDIOC_INT_S_VBI_DATA, &data);
-}
+       /* Determine which input to use */
+       if (test_bit(IVTV_F_I_RADIO_USER, &itv->i_flags)) {
+               audio_input = itv->card->radio_input.audio_input;
+               mux_input = itv->card->radio_input.muxer_input;
+       } else {
+               audio_input = itv->card->audio_inputs[itv->audio_input].audio_input;
+               mux_input = itv->card->audio_inputs[itv->audio_input].muxer_input;
+       }
 
-void ivtv_set_wss(struct ivtv *itv, int enabled, int mode)
-{
-       struct v4l2_sliced_vbi_data data;
-
-       if (!(itv->v4l2_cap & V4L2_CAP_VIDEO_OUTPUT))
-               return;
-       /* When using a 50 Hz system, always turn on the
-          wide screen signal with 4x3 ratio as the default.
-          Turning this signal on and off can confuse certain
-          TVs. As far as I can tell there is no reason not to
-          transmit this signal. */
-       if ((itv->std & V4L2_STD_625_50) && !enabled) {
-               enabled = 1;
-               mode = 0x08;  /* 4x3 full format */
+       /* handle muxer chips */
+       route.input = mux_input;
+       route.output = 0;
+       ivtv_i2c_hw(itv, itv->card->hw_muxer, VIDIOC_INT_S_AUDIO_ROUTING, &route);
+
+       route.input = audio_input;
+       if (itv->card->hw_audio & IVTV_HW_MSP34XX) {
+               route.output = MSP_OUTPUT(MSP_SC_IN_DSP_SCART1);
        }
-       data.id = V4L2_SLICED_WSS_625;
-       data.field = 0;
-       data.line = enabled ? 23 : 0;
-       data.data[0] = mode & 0xff;
-       data.data[1] = (mode >> 8) & 0xff;
-       ivtv_saa7127(itv, VIDIOC_INT_S_VBI_DATA, &data);
+       ivtv_i2c_hw(itv, itv->card->hw_audio, VIDIOC_INT_S_AUDIO_ROUTING, &route);
 }
 
+/* Selects the video input and output according to the current
+   settings. */
 void ivtv_video_set_io(struct ivtv *itv)
 {
        struct v4l2_routing route;
similarity index 77%
rename from drivers/media/video/ivtv/ivtv-audio.h
rename to drivers/media/video/ivtv/ivtv-routing.h
index ebb90cc8f8619e7dd7afc9d7241d965dfcf21749..c72a9731ca01fd9d66f0a9a8f74c443b2464b98d 100644 (file)
@@ -1,5 +1,5 @@
 /*
-    Audio-related ivtv functions.
+    Audio/video-routing-related ivtv functions.
     Copyright (C) 2003-2004  Kevin Thayer <nufan_wfk at yahoo.com>
     Copyright (C) 2005-2007  Hans Verkuil <hverkuil@xs4all.nl>
 
     Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
  */
 
-#ifndef IVTV_AUDIO_H
-#define IVTV_AUDIO_H
+#ifndef IVTV_ROUTING_H
+#define IVTV_ROUTING_H
 
-int ivtv_audio_set_io(struct ivtv *itv);
-void ivtv_audio_set_route(struct ivtv *itv, struct v4l2_routing *route);
-void ivtv_audio_set_audio_clock_freq(struct ivtv *itv, u8 freq);
+void ivtv_audio_set_io(struct ivtv *itv);
+void ivtv_video_set_io(struct ivtv *itv);
 
 #endif
index fae151a31e85a76158692c053ccf9ecbdf0c8ba0..3939a804f04373d3d04131eade5070fda5799885 100644 (file)
@@ -38,6 +38,7 @@
 #include "ivtv-queue.h"
 #include "ivtv-mailbox.h"
 #include "ivtv-ioctl.h"
+#include "ivtv-irq.h"
 #include "ivtv-yuv.h"
 #include "ivtv-cards.h"
 #include "ivtv-streams.h"
@@ -62,6 +63,13 @@ static struct file_operations ivtv_v4l2_dec_fops = {
       .poll = ivtv_v4l2_dec_poll,
 };
 
+#define IVTV_V4L2_DEC_MPG_OFFSET  16   /* offset from 0 to register decoder mpg v4l2 minors on */
+#define IVTV_V4L2_ENC_PCM_OFFSET  24   /* offset from 0 to register pcm v4l2 minors on */
+#define IVTV_V4L2_ENC_YUV_OFFSET  32   /* offset from 0 to register yuv v4l2 minors on */
+#define IVTV_V4L2_DEC_YUV_OFFSET  48   /* offset from 0 to register decoder yuv v4l2 minors on */
+#define IVTV_V4L2_DEC_VBI_OFFSET   8   /* offset from 0 to register decoder vbi input v4l2 minors on */
+#define IVTV_V4L2_DEC_VOUT_OFFSET 16   /* offset from 0 to register vbi output v4l2 minors on */
+
 static struct {
        const char *name;
        int vfl_type;
@@ -658,10 +666,10 @@ int ivtv_start_v4l2_decode_stream(struct ivtv_stream *s, int gop_offset)
        clear_bit(IVTV_F_S_STREAMOFF, &s->s_flags);
 
        /* Zero out decoder counters */
-       writel(0, &itv->dec_mbox.mbox[IVTV_MBOX_FIELD_DISPLAYED].data[0]);
-       writel(0, &itv->dec_mbox.mbox[IVTV_MBOX_FIELD_DISPLAYED].data[1]);
-       writel(0, &itv->dec_mbox.mbox[IVTV_MBOX_FIELD_DISPLAYED].data[2]);
-       writel(0, &itv->dec_mbox.mbox[IVTV_MBOX_FIELD_DISPLAYED].data[3]);
+       writel(0, &itv->dec_mbox.mbox[IVTV_MBOX_DMA_END].data[0]);
+       writel(0, &itv->dec_mbox.mbox[IVTV_MBOX_DMA_END].data[1]);
+       writel(0, &itv->dec_mbox.mbox[IVTV_MBOX_DMA_END].data[2]);
+       writel(0, &itv->dec_mbox.mbox[IVTV_MBOX_DMA_END].data[3]);
        writel(0, &itv->dec_mbox.mbox[IVTV_MBOX_DMA].data[0]);
        writel(0, &itv->dec_mbox.mbox[IVTV_MBOX_DMA].data[1]);
        writel(0, &itv->dec_mbox.mbox[IVTV_MBOX_DMA].data[2]);
index a58c833c2b0405b1f5c600cc752bf63027bf9f6a..5d8a40f3d2b6b00f98d89fe4ace8186d25a59746 100644 (file)
  */
 
 #include "ivtv-driver.h"
-#include "ivtv-video.h"
-#include "ivtv-vbi.h"
+#include "ivtv-i2c.h"
 #include "ivtv-ioctl.h"
 #include "ivtv-queue.h"
+#include "ivtv-vbi.h"
+
+static void ivtv_set_vps(struct ivtv *itv, int enabled, u8 vps1, u8 vps2, u8 vps3,
+                 u8 vps4, u8 vps5)
+{
+       struct v4l2_sliced_vbi_data data;
+
+       if (!(itv->v4l2_cap & V4L2_CAP_VIDEO_OUTPUT))
+               return;
+       data.id = V4L2_SLICED_VPS;
+       data.field = 0;
+       data.line = enabled ? 16 : 0;
+       data.data[4] = vps1;
+       data.data[10] = vps2;
+       data.data[11] = vps3;
+       data.data[12] = vps4;
+       data.data[13] = vps5;
+       ivtv_saa7127(itv, VIDIOC_INT_S_VBI_DATA, &data);
+}
+
+static void ivtv_set_cc(struct ivtv *itv, int mode, u8 cc1, u8 cc2, u8 cc3, u8 cc4)
+{
+       struct v4l2_sliced_vbi_data data;
+
+       if (!(itv->v4l2_cap & V4L2_CAP_VIDEO_OUTPUT))
+               return;
+       data.id = V4L2_SLICED_CAPTION_525;
+       data.field = 0;
+       data.line = (mode & 1) ? 21 : 0;
+       data.data[0] = cc1;
+       data.data[1] = cc2;
+       ivtv_saa7127(itv, VIDIOC_INT_S_VBI_DATA, &data);
+       data.field = 1;
+       data.line = (mode & 2) ? 21 : 0;
+       data.data[0] = cc3;
+       data.data[1] = cc4;
+       ivtv_saa7127(itv, VIDIOC_INT_S_VBI_DATA, &data);
+}
+
+static void ivtv_set_wss(struct ivtv *itv, int enabled, int mode)
+{
+       struct v4l2_sliced_vbi_data data;
+
+       if (!(itv->v4l2_cap & V4L2_CAP_VIDEO_OUTPUT))
+               return;
+       /* When using a 50 Hz system, always turn on the
+          wide screen signal with 4x3 ratio as the default.
+          Turning this signal on and off can confuse certain
+          TVs. As far as I can tell there is no reason not to
+          transmit this signal. */
+       if ((itv->std & V4L2_STD_625_50) && !enabled) {
+               enabled = 1;
+               mode = 0x08;  /* 4x3 full format */
+       }
+       data.id = V4L2_SLICED_WSS_625;
+       data.field = 0;
+       data.line = enabled ? 23 : 0;
+       data.data[0] = mode & 0xff;
+       data.data[1] = (mode >> 8) & 0xff;
+       ivtv_saa7127(itv, VIDIOC_INT_S_VBI_DATA, &data);
+}
 
 static int odd_parity(u8 c)
 {
diff --git a/drivers/media/video/ivtv/ivtv-video.h b/drivers/media/video/ivtv/ivtv-video.h
deleted file mode 100644 (file)
index 498e9b6..0000000
+++ /dev/null
@@ -1,29 +0,0 @@
-/*
-    saa7127 interface functions
-    Copyright (C) 2004-2007  Hans Verkuil <hverkuil@xs4all.nl>
-
-    This program is free software; you can redistribute it and/or modify
-    it under the terms of the GNU General Public License as published by
-    the Free Software Foundation; either version 2 of the License, or
-    (at your option) any later version.
-
-    This program is distributed in the hope that it will be useful,
-    but WITHOUT ANY WARRANTY; without even the implied warranty of
-    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
-    GNU General Public License for more details.
-
-    You should have received a copy of the GNU General Public License
-    along with this program; if not, write to the Free Software
-    Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
- */
-
-#ifndef IVTV_VIDEO_H
-#define IVTV_VIDEO_H
-
-void ivtv_set_wss(struct ivtv *itv, int enabled, int mode);
-void ivtv_set_cc(struct ivtv *itv, int mode, u8 cc1, u8 cc2, u8 cc3, u8 cc4);
-void ivtv_set_vps(struct ivtv *itv, int enabled, u8 vps1, u8 vps2, u8 vps3,
-                 u8 vps4, u8 vps5);
-void ivtv_video_set_io(struct ivtv *itv);
-
-#endif
index bb2cbb206c14aadf035119ece57be3b42db569b9..e2288f224ab699b2a27688d0cb33d455d5ceb5ea 100644 (file)
@@ -42,7 +42,7 @@ static int ivtv_yuv_prep_user_dma(struct ivtv *itv, struct ivtv_user_dma *dma,
        int y_decode_height, uv_decode_height, y_size;
        int frame = atomic_read(&itv->yuv_info.next_fill_frame);
 
-       y_buffer_offset = IVTV_DEC_MEM_START + yuv_offset[frame];
+       y_buffer_offset = IVTV_DECODER_OFFSET + yuv_offset[frame];
        uv_buffer_offset = y_buffer_offset + IVTV_YUV_BUFFER_UV_OFFSET;
 
        y_decode_height = uv_decode_height = args->src.height + args->src.top;
@@ -106,7 +106,7 @@ static int ivtv_yuv_prep_user_dma(struct ivtv *itv, struct ivtv_user_dma *dma,
                if (itv->yuv_info.blanking_dmaptr) {
                        dma->SGarray[dma->SG_length].size = cpu_to_le32(720*16);
                        dma->SGarray[dma->SG_length].src = cpu_to_le32(itv->yuv_info.blanking_dmaptr);
-                       dma->SGarray[dma->SG_length].dst = cpu_to_le32(IVTV_DEC_MEM_START + yuv_offset[frame]);
+                       dma->SGarray[dma->SG_length].dst = cpu_to_le32(IVTV_DECODER_OFFSET + yuv_offset[frame]);
                        dma->SG_length++;
                }
        }
index 0824048ce3a2a73b934dcaadfd9383610f8d0e72..f7215eeca01829bfbab4dd0d79f56fde01944e34 100644 (file)
@@ -32,6 +32,9 @@
 #define IVTV_YUV_HORIZONTAL_FILTER_OFFSET 0x025d8
 #define IVTV_YUV_VERTICAL_FILTER_OFFSET 0x03358
 
+#define IVTV_YUV_UPDATE_HORIZONTAL  0x01
+#define IVTV_YUV_UPDATE_VERTICAL    0x02
+
 extern const u32 yuv_offset[4];
 
 int ivtv_yuv_filter_check(struct ivtv *itv);