]> err.no Git - linux-2.6/commitdiff
V4L/DVB (7133): Fix Kconfig dependencies
authorMauro Carvalho Chehab <mchehab@infradead.org>
Sat, 2 Feb 2008 14:25:31 +0000 (11:25 -0300)
committerMauro Carvalho Chehab <mchehab@infradead.org>
Mon, 18 Feb 2008 14:14:53 +0000 (11:14 -0300)
As pointed by Adrian Bunk, with I2C=m and VIDEO_DEV=y, videodev brokes.

This patch moves the functions that videodev needs from v4l2-common. It also
fixes some Kconfig changes.

After this patch, I2C=m / VIDEO_DEV=y will make v4l2 core statically linked
into kernel. v4l2-common will be m, and all V4L drivers will also be m.

This approach is very conservative, since it is possible to have V4L drivers
that don't need I2C or v4l2-common. The better is to map what drivers really
need v4l2-common, making them to select v4l2-common, and allowing the others to
be 'y', 'm' and 'n'.

Signed-off-by: Mauro Carvalho Chehab <mchehab@infradead.org>
drivers/media/Kconfig
drivers/media/common/Kconfig
drivers/media/radio/Kconfig
drivers/media/video/Kconfig
drivers/media/video/v4l2-common.c
drivers/media/video/videodev.c
include/media/v4l2-common.h
include/media/v4l2-dev.h

index 707b20d7efb75b14df83a58c5e59f2e9130646ff..888dcadff710402baf23507145a2e20ac1a9039d 100644 (file)
@@ -32,9 +32,9 @@ config VIDEO_V4L2_COMMON
 
 config VIDEO_V4L1
        bool "Enable Video For Linux API 1 (DEPRECATED)"
-       depends on VIDEO_DEV
+       depends on VIDEO_DEV && VIDEO_V4L2_COMMON
+       default VIDEO_DEV && VIDEO_V4L2_COMMON
        select VIDEO_V4L1_COMPAT
-       default y
        ---help---
          Enables a compatibility API used by most V4L2 devices to allow
          its usage with legacy applications that supports only V4L1 api.
@@ -44,7 +44,7 @@ config VIDEO_V4L1
 config VIDEO_V4L1_COMPAT
        bool "Enable Video For Linux API 1 compatible Layer"
        depends on VIDEO_DEV
-       default y
+       default VIDEO_DEV
        ---help---
          This api were developed to be used at Kernel 2.2 and 2.4, but
          lacks support for several video standards. There are several
@@ -60,8 +60,8 @@ config VIDEO_V4L1_COMPAT
 
 config VIDEO_V4L2
        bool
-       depends on VIDEO_DEV
-       default y
+       depends on VIDEO_DEV && VIDEO_V4L2_COMMON
+       default VIDEO_DEV && VIDEO_V4L2_COMMON
 
 source "drivers/media/video/Kconfig"
 
@@ -185,7 +185,6 @@ config VIDEO_TVEEPROM
 
 config DAB
        boolean "DAB adapters"
-       default y
        ---help---
          Allow selecting support for for Digital Audio Broadcasting (DAB)
          Receiver adapters.
index 06ca75911b7f07aebb1bdeb362c04e6969f22bb6..769c6f8142d2cd750b9e520ecaaed6a24a525bfa 100644 (file)
@@ -4,6 +4,6 @@ config VIDEO_SAA7146
 
 config VIDEO_SAA7146_VV
        tristate
-       depends on VIDEO_DEV
+       depends on VIDEO_V4L2
        select VIDEOBUF_DMA_SG
        select VIDEO_SAA7146
index 8d5214f18cf0d488a36ec4fd66d80822d83466da..1b41b3f77cf95c2b6f28394cf1eb378a2fefe0ec 100644 (file)
@@ -4,12 +4,12 @@
 
 menuconfig RADIO_ADAPTERS
        bool "Radio Adapters"
-       depends on VIDEO_DEV
+       depends on VIDEO_V4L2
        default y
        ---help---
          Say Y here to enable selecting AM/FM radio adapters.
 
-if RADIO_ADAPTERS && VIDEO_DEV
+if RADIO_ADAPTERS && VIDEO_V4L2
 
 config RADIO_CADET
        tristate "ADS Cadet AM/FM Tuner"
index a2e8987a61954acfa1c4c654933e1193e7daf2ab..37072a21d8c9b5ac97ec9a566fc004d1e07eaea7 100644 (file)
@@ -4,14 +4,14 @@
 
 menuconfig VIDEO_CAPTURE_DRIVERS
        bool "Video capture adapters"
-       depends on VIDEO_DEV
+       depends on VIDEO_V4L2
        default y
        ---help---
          Say Y here to enable selecting the video adapters for
          webcams, analog TV, and hybrid analog/digital TV.
          Some of those devices also supports FM radio.
 
-if VIDEO_CAPTURE_DRIVERS && VIDEO_DEV
+if VIDEO_CAPTURE_DRIVERS && VIDEO_V4L2
 
 config VIDEO_ADV_DEBUG
        bool "Enable advanced debug functionality"
index 4a8fc170138bdcea79136f3aed6828950b8fc592..34deb68ae568fdb910f2d833b1e146a08cad9fdd 100644 (file)
@@ -56,7 +56,6 @@
 #include <asm/pgtable.h>
 #include <asm/io.h>
 #include <asm/div64.h>
-#include <linux/video_decoder.h>
 #define __OLD_VIDIOC_ /* To allow fixing old calls*/
 #include <media/v4l2-common.h>
 #include <media/v4l2-chip-ident.h>
@@ -81,107 +80,6 @@ MODULE_LICENSE("GPL");
  *  Video Standard Operations (contributed by Michael Schimek)
  */
 
-char *v4l2_norm_to_name(v4l2_std_id id)
-{
-       char *name;
-       u32 myid = id;
-
-       /* HACK: ppc32 architecture doesn't have __ucmpdi2 function to handle
-          64 bit comparations. So, on that architecture, with some gcc variants,
-          compilation fails. Currently, the max value is 30bit wide.
-        */
-       BUG_ON(myid != id);
-
-       switch (myid) {
-       case V4L2_STD_PAL:
-               name="PAL";             break;
-       case V4L2_STD_PAL_BG:
-               name="PAL-BG";          break;
-       case V4L2_STD_PAL_DK:
-               name="PAL-DK";          break;
-       case V4L2_STD_PAL_B:
-               name="PAL-B";           break;
-       case V4L2_STD_PAL_B1:
-               name="PAL-B1";          break;
-       case V4L2_STD_PAL_G:
-               name="PAL-G";           break;
-       case V4L2_STD_PAL_H:
-               name="PAL-H";           break;
-       case V4L2_STD_PAL_I:
-               name="PAL-I";           break;
-       case V4L2_STD_PAL_D:
-               name="PAL-D";           break;
-       case V4L2_STD_PAL_D1:
-               name="PAL-D1";          break;
-       case V4L2_STD_PAL_K:
-               name="PAL-K";           break;
-       case V4L2_STD_PAL_M:
-               name="PAL-M";           break;
-       case V4L2_STD_PAL_N:
-               name="PAL-N";           break;
-       case V4L2_STD_PAL_Nc:
-               name="PAL-Nc";          break;
-       case V4L2_STD_PAL_60:
-               name="PAL-60";          break;
-       case V4L2_STD_NTSC:
-               name="NTSC";            break;
-       case V4L2_STD_NTSC_M:
-               name="NTSC-M";          break;
-       case V4L2_STD_NTSC_M_JP:
-               name="NTSC-M-JP";       break;
-       case V4L2_STD_NTSC_443:
-               name="NTSC-443";        break;
-       case V4L2_STD_NTSC_M_KR:
-               name="NTSC-M-KR";       break;
-       case V4L2_STD_SECAM:
-               name="SECAM";           break;
-       case V4L2_STD_SECAM_DK:
-               name="SECAM-DK";        break;
-       case V4L2_STD_SECAM_B:
-               name="SECAM-B";         break;
-       case V4L2_STD_SECAM_D:
-               name="SECAM-D";         break;
-       case V4L2_STD_SECAM_G:
-               name="SECAM-G";         break;
-       case V4L2_STD_SECAM_H:
-               name="SECAM-H";         break;
-       case V4L2_STD_SECAM_K:
-               name="SECAM-K";         break;
-       case V4L2_STD_SECAM_K1:
-               name="SECAM-K1";        break;
-       case V4L2_STD_SECAM_L:
-               name="SECAM-L";         break;
-       case V4L2_STD_SECAM_LC:
-               name="SECAM-LC";        break;
-       default:
-               name="Unknown";         break;
-       }
-
-       return name;
-}
-
-/* Fill in the fields of a v4l2_standard structure according to the
-   'id' and 'transmission' parameters.  Returns negative on error.  */
-int v4l2_video_std_construct(struct v4l2_standard *vs,
-                            int id, char *name)
-{
-       u32 index = vs->index;
-
-       memset(vs, 0, sizeof(struct v4l2_standard));
-       vs->index = index;
-       vs->id    = id;
-       if (id & V4L2_STD_525_60) {
-               vs->frameperiod.numerator = 1001;
-               vs->frameperiod.denominator = 30000;
-               vs->framelines = 525;
-       } else {
-               vs->frameperiod.numerator = 1;
-               vs->frameperiod.denominator = 25;
-               vs->framelines = 625;
-       }
-       strlcpy(vs->name,name,sizeof(vs->name));
-       return 0;
-}
 
 /* ----------------------------------------------------------------- */
 /* priority handling                                                 */
@@ -195,6 +93,7 @@ int v4l2_prio_init(struct v4l2_prio_state *global)
        memset(global,0,sizeof(*global));
        return 0;
 }
+EXPORT_SYMBOL(v4l2_prio_init);
 
 int v4l2_prio_change(struct v4l2_prio_state *global, enum v4l2_priority *local,
                     enum v4l2_priority new)
@@ -210,11 +109,13 @@ int v4l2_prio_change(struct v4l2_prio_state *global, enum v4l2_priority *local,
        *local = new;
        return 0;
 }
+EXPORT_SYMBOL(v4l2_prio_change);
 
 int v4l2_prio_open(struct v4l2_prio_state *global, enum v4l2_priority *local)
 {
        return v4l2_prio_change(global,local,V4L2_PRIORITY_DEFAULT);
 }
+EXPORT_SYMBOL(v4l2_prio_open);
 
 int v4l2_prio_close(struct v4l2_prio_state *global, enum v4l2_priority *local)
 {
@@ -222,6 +123,7 @@ int v4l2_prio_close(struct v4l2_prio_state *global, enum v4l2_priority *local)
                atomic_dec(&global->prios[*local]);
        return 0;
 }
+EXPORT_SYMBOL(v4l2_prio_close);
 
 enum v4l2_priority v4l2_prio_max(struct v4l2_prio_state *global)
 {
@@ -233,6 +135,7 @@ enum v4l2_priority v4l2_prio_max(struct v4l2_prio_state *global)
                return V4L2_PRIORITY_BACKGROUND;
        return V4L2_PRIORITY_UNSET;
 }
+EXPORT_SYMBOL(v4l2_prio_max);
 
 int v4l2_prio_check(struct v4l2_prio_state *global, enum v4l2_priority *local)
 {
@@ -240,220 +143,7 @@ int v4l2_prio_check(struct v4l2_prio_state *global, enum v4l2_priority *local)
                return -EBUSY;
        return 0;
 }
-
-
-/* ----------------------------------------------------------------- */
-/* some arrays for pretty-printing debug messages of enum types      */
-
-char *v4l2_field_names[] = {
-       [V4L2_FIELD_ANY]        = "any",
-       [V4L2_FIELD_NONE]       = "none",
-       [V4L2_FIELD_TOP]        = "top",
-       [V4L2_FIELD_BOTTOM]     = "bottom",
-       [V4L2_FIELD_INTERLACED] = "interlaced",
-       [V4L2_FIELD_SEQ_TB]     = "seq-tb",
-       [V4L2_FIELD_SEQ_BT]     = "seq-bt",
-       [V4L2_FIELD_ALTERNATE]  = "alternate",
-       [V4L2_FIELD_INTERLACED_TB] = "interlaced-tb",
-       [V4L2_FIELD_INTERLACED_BT] = "interlaced-bt",
-};
-
-char *v4l2_type_names[] = {
-       [V4L2_BUF_TYPE_VIDEO_CAPTURE]      = "video-cap",
-       [V4L2_BUF_TYPE_VIDEO_OVERLAY]      = "video-over",
-       [V4L2_BUF_TYPE_VIDEO_OUTPUT]       = "video-out",
-       [V4L2_BUF_TYPE_VBI_CAPTURE]        = "vbi-cap",
-       [V4L2_BUF_TYPE_VBI_OUTPUT]         = "vbi-out",
-       [V4L2_BUF_TYPE_SLICED_VBI_CAPTURE] = "sliced-vbi-cap",
-       [V4L2_BUF_TYPE_SLICED_VBI_OUTPUT]  = "sliced-vbi-out",
-       [V4L2_BUF_TYPE_VIDEO_OUTPUT_OVERLAY] = "video-out-over",
-};
-
-/* ------------------------------------------------------------------ */
-/* debug help functions                                               */
-
-#ifdef CONFIG_VIDEO_V4L1_COMPAT
-static const char *v4l1_ioctls[] = {
-       [_IOC_NR(VIDIOCGCAP)]       = "VIDIOCGCAP",
-       [_IOC_NR(VIDIOCGCHAN)]      = "VIDIOCGCHAN",
-       [_IOC_NR(VIDIOCSCHAN)]      = "VIDIOCSCHAN",
-       [_IOC_NR(VIDIOCGTUNER)]     = "VIDIOCGTUNER",
-       [_IOC_NR(VIDIOCSTUNER)]     = "VIDIOCSTUNER",
-       [_IOC_NR(VIDIOCGPICT)]      = "VIDIOCGPICT",
-       [_IOC_NR(VIDIOCSPICT)]      = "VIDIOCSPICT",
-       [_IOC_NR(VIDIOCCAPTURE)]    = "VIDIOCCAPTURE",
-       [_IOC_NR(VIDIOCGWIN)]       = "VIDIOCGWIN",
-       [_IOC_NR(VIDIOCSWIN)]       = "VIDIOCSWIN",
-       [_IOC_NR(VIDIOCGFBUF)]      = "VIDIOCGFBUF",
-       [_IOC_NR(VIDIOCSFBUF)]      = "VIDIOCSFBUF",
-       [_IOC_NR(VIDIOCKEY)]        = "VIDIOCKEY",
-       [_IOC_NR(VIDIOCGFREQ)]      = "VIDIOCGFREQ",
-       [_IOC_NR(VIDIOCSFREQ)]      = "VIDIOCSFREQ",
-       [_IOC_NR(VIDIOCGAUDIO)]     = "VIDIOCGAUDIO",
-       [_IOC_NR(VIDIOCSAUDIO)]     = "VIDIOCSAUDIO",
-       [_IOC_NR(VIDIOCSYNC)]       = "VIDIOCSYNC",
-       [_IOC_NR(VIDIOCMCAPTURE)]   = "VIDIOCMCAPTURE",
-       [_IOC_NR(VIDIOCGMBUF)]      = "VIDIOCGMBUF",
-       [_IOC_NR(VIDIOCGUNIT)]      = "VIDIOCGUNIT",
-       [_IOC_NR(VIDIOCGCAPTURE)]   = "VIDIOCGCAPTURE",
-       [_IOC_NR(VIDIOCSCAPTURE)]   = "VIDIOCSCAPTURE",
-       [_IOC_NR(VIDIOCSPLAYMODE)]  = "VIDIOCSPLAYMODE",
-       [_IOC_NR(VIDIOCSWRITEMODE)] = "VIDIOCSWRITEMODE",
-       [_IOC_NR(VIDIOCGPLAYINFO)]  = "VIDIOCGPLAYINFO",
-       [_IOC_NR(VIDIOCSMICROCODE)] = "VIDIOCSMICROCODE",
-       [_IOC_NR(VIDIOCGVBIFMT)]    = "VIDIOCGVBIFMT",
-       [_IOC_NR(VIDIOCSVBIFMT)]    = "VIDIOCSVBIFMT"
-};
-#define V4L1_IOCTLS ARRAY_SIZE(v4l1_ioctls)
-#endif
-
-static const char *v4l2_ioctls[] = {
-       [_IOC_NR(VIDIOC_QUERYCAP)]         = "VIDIOC_QUERYCAP",
-       [_IOC_NR(VIDIOC_RESERVED)]         = "VIDIOC_RESERVED",
-       [_IOC_NR(VIDIOC_ENUM_FMT)]         = "VIDIOC_ENUM_FMT",
-       [_IOC_NR(VIDIOC_G_FMT)]            = "VIDIOC_G_FMT",
-       [_IOC_NR(VIDIOC_S_FMT)]            = "VIDIOC_S_FMT",
-       [_IOC_NR(VIDIOC_REQBUFS)]          = "VIDIOC_REQBUFS",
-       [_IOC_NR(VIDIOC_QUERYBUF)]         = "VIDIOC_QUERYBUF",
-       [_IOC_NR(VIDIOC_G_FBUF)]           = "VIDIOC_G_FBUF",
-       [_IOC_NR(VIDIOC_S_FBUF)]           = "VIDIOC_S_FBUF",
-       [_IOC_NR(VIDIOC_OVERLAY)]          = "VIDIOC_OVERLAY",
-       [_IOC_NR(VIDIOC_QBUF)]             = "VIDIOC_QBUF",
-       [_IOC_NR(VIDIOC_DQBUF)]            = "VIDIOC_DQBUF",
-       [_IOC_NR(VIDIOC_STREAMON)]         = "VIDIOC_STREAMON",
-       [_IOC_NR(VIDIOC_STREAMOFF)]        = "VIDIOC_STREAMOFF",
-       [_IOC_NR(VIDIOC_G_PARM)]           = "VIDIOC_G_PARM",
-       [_IOC_NR(VIDIOC_S_PARM)]           = "VIDIOC_S_PARM",
-       [_IOC_NR(VIDIOC_G_STD)]            = "VIDIOC_G_STD",
-       [_IOC_NR(VIDIOC_S_STD)]            = "VIDIOC_S_STD",
-       [_IOC_NR(VIDIOC_ENUMSTD)]          = "VIDIOC_ENUMSTD",
-       [_IOC_NR(VIDIOC_ENUMINPUT)]        = "VIDIOC_ENUMINPUT",
-       [_IOC_NR(VIDIOC_G_CTRL)]           = "VIDIOC_G_CTRL",
-       [_IOC_NR(VIDIOC_S_CTRL)]           = "VIDIOC_S_CTRL",
-       [_IOC_NR(VIDIOC_G_TUNER)]          = "VIDIOC_G_TUNER",
-       [_IOC_NR(VIDIOC_S_TUNER)]          = "VIDIOC_S_TUNER",
-       [_IOC_NR(VIDIOC_G_AUDIO)]          = "VIDIOC_G_AUDIO",
-       [_IOC_NR(VIDIOC_S_AUDIO)]          = "VIDIOC_S_AUDIO",
-       [_IOC_NR(VIDIOC_QUERYCTRL)]        = "VIDIOC_QUERYCTRL",
-       [_IOC_NR(VIDIOC_QUERYMENU)]        = "VIDIOC_QUERYMENU",
-       [_IOC_NR(VIDIOC_G_INPUT)]          = "VIDIOC_G_INPUT",
-       [_IOC_NR(VIDIOC_S_INPUT)]          = "VIDIOC_S_INPUT",
-       [_IOC_NR(VIDIOC_G_OUTPUT)]         = "VIDIOC_G_OUTPUT",
-       [_IOC_NR(VIDIOC_S_OUTPUT)]         = "VIDIOC_S_OUTPUT",
-       [_IOC_NR(VIDIOC_ENUMOUTPUT)]       = "VIDIOC_ENUMOUTPUT",
-       [_IOC_NR(VIDIOC_G_AUDOUT)]         = "VIDIOC_G_AUDOUT",
-       [_IOC_NR(VIDIOC_S_AUDOUT)]         = "VIDIOC_S_AUDOUT",
-       [_IOC_NR(VIDIOC_G_MODULATOR)]      = "VIDIOC_G_MODULATOR",
-       [_IOC_NR(VIDIOC_S_MODULATOR)]      = "VIDIOC_S_MODULATOR",
-       [_IOC_NR(VIDIOC_G_FREQUENCY)]      = "VIDIOC_G_FREQUENCY",
-       [_IOC_NR(VIDIOC_S_FREQUENCY)]      = "VIDIOC_S_FREQUENCY",
-       [_IOC_NR(VIDIOC_CROPCAP)]          = "VIDIOC_CROPCAP",
-       [_IOC_NR(VIDIOC_G_CROP)]           = "VIDIOC_G_CROP",
-       [_IOC_NR(VIDIOC_S_CROP)]           = "VIDIOC_S_CROP",
-       [_IOC_NR(VIDIOC_G_JPEGCOMP)]       = "VIDIOC_G_JPEGCOMP",
-       [_IOC_NR(VIDIOC_S_JPEGCOMP)]       = "VIDIOC_S_JPEGCOMP",
-       [_IOC_NR(VIDIOC_QUERYSTD)]         = "VIDIOC_QUERYSTD",
-       [_IOC_NR(VIDIOC_TRY_FMT)]          = "VIDIOC_TRY_FMT",
-       [_IOC_NR(VIDIOC_ENUMAUDIO)]        = "VIDIOC_ENUMAUDIO",
-       [_IOC_NR(VIDIOC_ENUMAUDOUT)]       = "VIDIOC_ENUMAUDOUT",
-       [_IOC_NR(VIDIOC_G_PRIORITY)]       = "VIDIOC_G_PRIORITY",
-       [_IOC_NR(VIDIOC_S_PRIORITY)]       = "VIDIOC_S_PRIORITY",
-       [_IOC_NR(VIDIOC_G_SLICED_VBI_CAP)] = "VIDIOC_G_SLICED_VBI_CAP",
-       [_IOC_NR(VIDIOC_LOG_STATUS)]       = "VIDIOC_LOG_STATUS",
-       [_IOC_NR(VIDIOC_G_EXT_CTRLS)]      = "VIDIOC_G_EXT_CTRLS",
-       [_IOC_NR(VIDIOC_S_EXT_CTRLS)]      = "VIDIOC_S_EXT_CTRLS",
-       [_IOC_NR(VIDIOC_TRY_EXT_CTRLS)]    = "VIDIOC_TRY_EXT_CTRLS",
-#if 1
-       [_IOC_NR(VIDIOC_ENUM_FRAMESIZES)]  = "VIDIOC_ENUM_FRAMESIZES",
-       [_IOC_NR(VIDIOC_ENUM_FRAMEINTERVALS)] = "VIDIOC_ENUM_FRAMEINTERVALS",
-       [_IOC_NR(VIDIOC_G_ENC_INDEX)]      = "VIDIOC_G_ENC_INDEX",
-       [_IOC_NR(VIDIOC_ENCODER_CMD)]      = "VIDIOC_ENCODER_CMD",
-       [_IOC_NR(VIDIOC_TRY_ENCODER_CMD)]  = "VIDIOC_TRY_ENCODER_CMD",
-
-       [_IOC_NR(VIDIOC_DBG_S_REGISTER)]   = "VIDIOC_DBG_S_REGISTER",
-       [_IOC_NR(VIDIOC_DBG_G_REGISTER)]   = "VIDIOC_DBG_G_REGISTER",
-
-       [_IOC_NR(VIDIOC_G_CHIP_IDENT)]     = "VIDIOC_G_CHIP_IDENT",
-#endif
-};
-#define V4L2_IOCTLS ARRAY_SIZE(v4l2_ioctls)
-
-static const char *v4l2_int_ioctls[] = {
-#ifdef CONFIG_VIDEO_V4L1_COMPAT
-       [_IOC_NR(DECODER_GET_CAPABILITIES)]    = "DECODER_GET_CAPABILITIES",
-       [_IOC_NR(DECODER_GET_STATUS)]          = "DECODER_GET_STATUS",
-       [_IOC_NR(DECODER_SET_NORM)]            = "DECODER_SET_NORM",
-       [_IOC_NR(DECODER_SET_INPUT)]           = "DECODER_SET_INPUT",
-       [_IOC_NR(DECODER_SET_OUTPUT)]          = "DECODER_SET_OUTPUT",
-       [_IOC_NR(DECODER_ENABLE_OUTPUT)]       = "DECODER_ENABLE_OUTPUT",
-       [_IOC_NR(DECODER_SET_PICTURE)]         = "DECODER_SET_PICTURE",
-       [_IOC_NR(DECODER_SET_GPIO)]            = "DECODER_SET_GPIO",
-       [_IOC_NR(DECODER_INIT)]                = "DECODER_INIT",
-       [_IOC_NR(DECODER_SET_VBI_BYPASS)]      = "DECODER_SET_VBI_BYPASS",
-       [_IOC_NR(DECODER_DUMP)]                = "DECODER_DUMP",
-#endif
-       [_IOC_NR(AUDC_SET_RADIO)]              = "AUDC_SET_RADIO",
-
-       [_IOC_NR(TUNER_SET_TYPE_ADDR)]         = "TUNER_SET_TYPE_ADDR",
-       [_IOC_NR(TUNER_SET_STANDBY)]           = "TUNER_SET_STANDBY",
-       [_IOC_NR(TUNER_SET_CONFIG)]            = "TUNER_SET_CONFIG",
-
-       [_IOC_NR(VIDIOC_INT_S_TUNER_MODE)]     = "VIDIOC_INT_S_TUNER_MODE",
-       [_IOC_NR(VIDIOC_INT_RESET)]            = "VIDIOC_INT_RESET",
-       [_IOC_NR(VIDIOC_INT_AUDIO_CLOCK_FREQ)] = "VIDIOC_INT_AUDIO_CLOCK_FREQ",
-       [_IOC_NR(VIDIOC_INT_DECODE_VBI_LINE)]  = "VIDIOC_INT_DECODE_VBI_LINE",
-       [_IOC_NR(VIDIOC_INT_S_VBI_DATA)]       = "VIDIOC_INT_S_VBI_DATA",
-       [_IOC_NR(VIDIOC_INT_G_VBI_DATA)]       = "VIDIOC_INT_G_VBI_DATA",
-       [_IOC_NR(VIDIOC_INT_I2S_CLOCK_FREQ)]   = "VIDIOC_INT_I2S_CLOCK_FREQ",
-       [_IOC_NR(VIDIOC_INT_S_STANDBY)]        = "VIDIOC_INT_S_STANDBY",
-       [_IOC_NR(VIDIOC_INT_S_AUDIO_ROUTING)]  = "VIDIOC_INT_S_AUDIO_ROUTING",
-       [_IOC_NR(VIDIOC_INT_G_AUDIO_ROUTING)]  = "VIDIOC_INT_G_AUDIO_ROUTING",
-       [_IOC_NR(VIDIOC_INT_S_VIDEO_ROUTING)]  = "VIDIOC_INT_S_VIDEO_ROUTING",
-       [_IOC_NR(VIDIOC_INT_G_VIDEO_ROUTING)]  = "VIDIOC_INT_G_VIDEO_ROUTING",
-       [_IOC_NR(VIDIOC_INT_S_CRYSTAL_FREQ)]   = "VIDIOC_INT_S_CRYSTAL_FREQ",
-       [_IOC_NR(VIDIOC_INT_INIT)]             = "VIDIOC_INT_INIT",
-       [_IOC_NR(VIDIOC_INT_G_STD_OUTPUT)]     = "VIDIOC_INT_G_STD_OUTPUT",
-       [_IOC_NR(VIDIOC_INT_S_STD_OUTPUT)]     = "VIDIOC_INT_S_STD_OUTPUT",
-};
-#define V4L2_INT_IOCTLS ARRAY_SIZE(v4l2_int_ioctls)
-
-/* Common ioctl debug function. This function can be used by
-   external ioctl messages as well as internal V4L ioctl */
-void v4l_printk_ioctl(unsigned int cmd)
-{
-       char *dir;
-
-       switch (_IOC_DIR(cmd)) {
-       case _IOC_NONE:              dir = "--"; break;
-       case _IOC_READ:              dir = "r-"; break;
-       case _IOC_WRITE:             dir = "-w"; break;
-       case _IOC_READ | _IOC_WRITE: dir = "rw"; break;
-       default:                     dir = "*ERR*"; break;
-       }
-       switch (_IOC_TYPE(cmd)) {
-       case 'd':
-               printk("v4l2_int ioctl %s, dir=%s (0x%08x)\n",
-                      (_IOC_NR(cmd) < V4L2_INT_IOCTLS) ?
-                      v4l2_int_ioctls[_IOC_NR(cmd)] : "UNKNOWN", dir, cmd);
-               break;
-#ifdef CONFIG_VIDEO_V4L1_COMPAT
-       case 'v':
-               printk("v4l1 ioctl %s, dir=%s (0x%08x)\n",
-                      (_IOC_NR(cmd) < V4L1_IOCTLS) ?
-                      v4l1_ioctls[_IOC_NR(cmd)] : "UNKNOWN", dir, cmd);
-               break;
-#endif
-       case 'V':
-               printk("v4l2 ioctl %s, dir=%s (0x%08x)\n",
-                      (_IOC_NR(cmd) < V4L2_IOCTLS) ?
-                      v4l2_ioctls[_IOC_NR(cmd)] : "UNKNOWN", dir, cmd);
-               break;
-
-       default:
-               printk("unknown ioctl '%c', dir=%s, #%d (0x%08x)\n",
-                      _IOC_TYPE(cmd), dir, _IOC_NR(cmd), cmd);
-       }
-}
+EXPORT_SYMBOL(v4l2_prio_check);
 
 /* ----------------------------------------------------------------- */
 
@@ -482,6 +172,7 @@ int v4l2_ctrl_check(struct v4l2_ext_control *ctrl, struct v4l2_queryctrl *qctrl,
        }
        return 0;
 }
+EXPORT_SYMBOL(v4l2_ctrl_check);
 
 /* Returns NULL or a character pointer array containing the menu for
    the given control ID. The pointer array ends with a NULL pointer.
@@ -642,6 +333,7 @@ const char **v4l2_ctrl_get_menu(u32 id)
                        return NULL;
        }
 }
+EXPORT_SYMBOL(v4l2_ctrl_get_menu);
 
 /* Fill in a struct v4l2_queryctrl */
 int v4l2_ctrl_query_fill(struct v4l2_queryctrl *qctrl, s32 min, s32 max, s32 step, s32 def)
@@ -764,6 +456,7 @@ int v4l2_ctrl_query_fill(struct v4l2_queryctrl *qctrl, s32 min, s32 max, s32 ste
        snprintf(qctrl->name, sizeof(qctrl->name), name);
        return 0;
 }
+EXPORT_SYMBOL(v4l2_ctrl_query_fill);
 
 /* Fill in a struct v4l2_queryctrl with standard values based on
    the control ID. */
@@ -898,6 +591,7 @@ int v4l2_ctrl_query_fill_std(struct v4l2_queryctrl *qctrl)
                return -EINVAL;
        }
 }
+EXPORT_SYMBOL(v4l2_ctrl_query_fill_std);
 
 /* Fill in a struct v4l2_querymenu based on the struct v4l2_queryctrl and
    the menu. The qctrl pointer may be NULL, in which case it is ignored. */
@@ -916,6 +610,7 @@ int v4l2_ctrl_query_menu(struct v4l2_querymenu *qmenu, struct v4l2_queryctrl *qc
        qmenu->reserved = 0;
        return 0;
 }
+EXPORT_SYMBOL(v4l2_ctrl_query_menu);
 
 /* ctrl_classes points to an array of u32 pointers, the last element is
    a NULL pointer. Each u32 array is a 0-terminated array of control IDs.
@@ -966,6 +661,7 @@ u32 v4l2_ctrl_next(const u32 * const * ctrl_classes, u32 id)
                return 0;
        return **ctrl_classes;
 }
+EXPORT_SYMBOL(v4l2_ctrl_next);
 
 int v4l2_chip_match_host(u32 match_type, u32 match_chip)
 {
@@ -1038,26 +734,3 @@ int v4l2_i2c_attach(struct i2c_adapter *adapter, int address, struct i2c_driver
 }
 EXPORT_SYMBOL(v4l2_i2c_attach);
 #endif
-
-/* ----------------------------------------------------------------- */
-
-EXPORT_SYMBOL(v4l2_norm_to_name);
-EXPORT_SYMBOL(v4l2_video_std_construct);
-
-EXPORT_SYMBOL(v4l2_prio_init);
-EXPORT_SYMBOL(v4l2_prio_change);
-EXPORT_SYMBOL(v4l2_prio_open);
-EXPORT_SYMBOL(v4l2_prio_close);
-EXPORT_SYMBOL(v4l2_prio_max);
-EXPORT_SYMBOL(v4l2_prio_check);
-
-EXPORT_SYMBOL(v4l2_field_names);
-EXPORT_SYMBOL(v4l2_type_names);
-EXPORT_SYMBOL(v4l_printk_ioctl);
-
-EXPORT_SYMBOL(v4l2_ctrl_next);
-EXPORT_SYMBOL(v4l2_ctrl_check);
-EXPORT_SYMBOL(v4l2_ctrl_get_menu);
-EXPORT_SYMBOL(v4l2_ctrl_query_menu);
-EXPORT_SYMBOL(v4l2_ctrl_query_fill);
-EXPORT_SYMBOL(v4l2_ctrl_query_fill_std);
index 28655f8983c6949386d6bdc6465613256e369423..0d9b63762a48fd42aaaad60054d2a961dd1e83af 100644 (file)
 #include <linux/videodev.h>
 #endif
 #include <media/v4l2-common.h>
+#include <linux/video_decoder.h>
 
 #define VIDEO_NUM_DEVICES      256
 #define VIDEO_NAME              "video4linux"
 
+/* video4linux standard ID conversion to standard name
+ */
+char *v4l2_norm_to_name(v4l2_std_id id)
+{
+       char *name;
+       u32 myid = id;
+
+       /* HACK: ppc32 architecture doesn't have __ucmpdi2 function to handle
+          64 bit comparations. So, on that architecture, with some gcc
+          variants, compilation fails. Currently, the max value is 30bit wide.
+        */
+       BUG_ON(myid != id);
+
+       switch (myid) {
+       case V4L2_STD_PAL:
+               name = "PAL";
+               break;
+       case V4L2_STD_PAL_BG:
+               name = "PAL-BG";
+               break;
+       case V4L2_STD_PAL_DK:
+               name = "PAL-DK";
+               break;
+       case V4L2_STD_PAL_B:
+               name = "PAL-B";
+               break;
+       case V4L2_STD_PAL_B1:
+               name = "PAL-B1";
+               break;
+       case V4L2_STD_PAL_G:
+               name = "PAL-G";
+               break;
+       case V4L2_STD_PAL_H:
+               name = "PAL-H";
+               break;
+       case V4L2_STD_PAL_I:
+               name = "PAL-I";
+               break;
+       case V4L2_STD_PAL_D:
+               name = "PAL-D";
+               break;
+       case V4L2_STD_PAL_D1:
+               name = "PAL-D1";
+               break;
+       case V4L2_STD_PAL_K:
+               name = "PAL-K";
+               break;
+       case V4L2_STD_PAL_M:
+               name = "PAL-M";
+               break;
+       case V4L2_STD_PAL_N:
+               name = "PAL-N";
+               break;
+       case V4L2_STD_PAL_Nc:
+               name = "PAL-Nc";
+               break;
+       case V4L2_STD_PAL_60:
+               name = "PAL-60";
+               break;
+       case V4L2_STD_NTSC:
+               name = "NTSC";
+               break;
+       case V4L2_STD_NTSC_M:
+               name = "NTSC-M";
+               break;
+       case V4L2_STD_NTSC_M_JP:
+               name = "NTSC-M-JP";
+               break;
+       case V4L2_STD_NTSC_443:
+               name = "NTSC-443";
+               break;
+       case V4L2_STD_NTSC_M_KR:
+               name = "NTSC-M-KR";
+               break;
+       case V4L2_STD_SECAM:
+               name = "SECAM";
+               break;
+       case V4L2_STD_SECAM_DK:
+               name = "SECAM-DK";
+               break;
+       case V4L2_STD_SECAM_B:
+               name = "SECAM-B";
+               break;
+       case V4L2_STD_SECAM_D:
+               name = "SECAM-D";
+               break;
+       case V4L2_STD_SECAM_G:
+               name = "SECAM-G";
+               break;
+       case V4L2_STD_SECAM_H:
+               name = "SECAM-H";
+               break;
+       case V4L2_STD_SECAM_K:
+               name = "SECAM-K";
+               break;
+       case V4L2_STD_SECAM_K1:
+               name = "SECAM-K1";
+               break;
+       case V4L2_STD_SECAM_L:
+               name = "SECAM-L";
+               break;
+       case V4L2_STD_SECAM_LC:
+               name = "SECAM-LC";
+               break;
+       default:
+               name = "Unknown";
+               break;
+       }
+
+       return name;
+}
+EXPORT_SYMBOL(v4l2_norm_to_name);
+
+/* Fill in the fields of a v4l2_standard structure according to the
+   'id' and 'transmission' parameters.  Returns negative on error.  */
+int v4l2_video_std_construct(struct v4l2_standard *vs,
+                            int id, char *name)
+{
+       u32 index = vs->index;
+
+       memset(vs, 0, sizeof(struct v4l2_standard));
+       vs->index = index;
+       vs->id    = id;
+       if (id & V4L2_STD_525_60) {
+               vs->frameperiod.numerator = 1001;
+               vs->frameperiod.denominator = 30000;
+               vs->framelines = 525;
+       } else {
+               vs->frameperiod.numerator = 1;
+               vs->frameperiod.denominator = 25;
+               vs->framelines = 625;
+       }
+       strlcpy(vs->name, name, sizeof(vs->name));
+       return 0;
+}
+EXPORT_SYMBOL(v4l2_video_std_construct);
+
+/* ----------------------------------------------------------------- */
+/* some arrays for pretty-printing debug messages of enum types      */
+
+char *v4l2_field_names[] = {
+       [V4L2_FIELD_ANY]        = "any",
+       [V4L2_FIELD_NONE]       = "none",
+       [V4L2_FIELD_TOP]        = "top",
+       [V4L2_FIELD_BOTTOM]     = "bottom",
+       [V4L2_FIELD_INTERLACED] = "interlaced",
+       [V4L2_FIELD_SEQ_TB]     = "seq-tb",
+       [V4L2_FIELD_SEQ_BT]     = "seq-bt",
+       [V4L2_FIELD_ALTERNATE]  = "alternate",
+       [V4L2_FIELD_INTERLACED_TB] = "interlaced-tb",
+       [V4L2_FIELD_INTERLACED_BT] = "interlaced-bt",
+};
+EXPORT_SYMBOL(v4l2_field_names);
+
+char *v4l2_type_names[] = {
+       [V4L2_BUF_TYPE_VIDEO_CAPTURE]      = "video-cap",
+       [V4L2_BUF_TYPE_VIDEO_OVERLAY]      = "video-over",
+       [V4L2_BUF_TYPE_VIDEO_OUTPUT]       = "video-out",
+       [V4L2_BUF_TYPE_VBI_CAPTURE]        = "vbi-cap",
+       [V4L2_BUF_TYPE_VBI_OUTPUT]         = "vbi-out",
+       [V4L2_BUF_TYPE_SLICED_VBI_CAPTURE] = "sliced-vbi-cap",
+       [V4L2_BUF_TYPE_SLICED_VBI_OUTPUT]  = "sliced-vbi-out",
+       [V4L2_BUF_TYPE_VIDEO_OUTPUT_OVERLAY] = "video-out-over",
+};
+EXPORT_SYMBOL(v4l2_type_names);
+
+static char *v4l2_memory_names[] = {
+       [V4L2_MEMORY_MMAP]    = "mmap",
+       [V4L2_MEMORY_USERPTR] = "userptr",
+       [V4L2_MEMORY_OVERLAY] = "overlay",
+};
+
+#define prt_names(a, arr) ((((a) >= 0) && ((a) < ARRAY_SIZE(arr))) ? \
+                          arr[a] : "unknown")
+
+/* ------------------------------------------------------------------ */
+/* debug help functions                                               */
+
+#ifdef CONFIG_VIDEO_V4L1_COMPAT
+static const char *v4l1_ioctls[] = {
+       [_IOC_NR(VIDIOCGCAP)]       = "VIDIOCGCAP",
+       [_IOC_NR(VIDIOCGCHAN)]      = "VIDIOCGCHAN",
+       [_IOC_NR(VIDIOCSCHAN)]      = "VIDIOCSCHAN",
+       [_IOC_NR(VIDIOCGTUNER)]     = "VIDIOCGTUNER",
+       [_IOC_NR(VIDIOCSTUNER)]     = "VIDIOCSTUNER",
+       [_IOC_NR(VIDIOCGPICT)]      = "VIDIOCGPICT",
+       [_IOC_NR(VIDIOCSPICT)]      = "VIDIOCSPICT",
+       [_IOC_NR(VIDIOCCAPTURE)]    = "VIDIOCCAPTURE",
+       [_IOC_NR(VIDIOCGWIN)]       = "VIDIOCGWIN",
+       [_IOC_NR(VIDIOCSWIN)]       = "VIDIOCSWIN",
+       [_IOC_NR(VIDIOCGFBUF)]      = "VIDIOCGFBUF",
+       [_IOC_NR(VIDIOCSFBUF)]      = "VIDIOCSFBUF",
+       [_IOC_NR(VIDIOCKEY)]        = "VIDIOCKEY",
+       [_IOC_NR(VIDIOCGFREQ)]      = "VIDIOCGFREQ",
+       [_IOC_NR(VIDIOCSFREQ)]      = "VIDIOCSFREQ",
+       [_IOC_NR(VIDIOCGAUDIO)]     = "VIDIOCGAUDIO",
+       [_IOC_NR(VIDIOCSAUDIO)]     = "VIDIOCSAUDIO",
+       [_IOC_NR(VIDIOCSYNC)]       = "VIDIOCSYNC",
+       [_IOC_NR(VIDIOCMCAPTURE)]   = "VIDIOCMCAPTURE",
+       [_IOC_NR(VIDIOCGMBUF)]      = "VIDIOCGMBUF",
+       [_IOC_NR(VIDIOCGUNIT)]      = "VIDIOCGUNIT",
+       [_IOC_NR(VIDIOCGCAPTURE)]   = "VIDIOCGCAPTURE",
+       [_IOC_NR(VIDIOCSCAPTURE)]   = "VIDIOCSCAPTURE",
+       [_IOC_NR(VIDIOCSPLAYMODE)]  = "VIDIOCSPLAYMODE",
+       [_IOC_NR(VIDIOCSWRITEMODE)] = "VIDIOCSWRITEMODE",
+       [_IOC_NR(VIDIOCGPLAYINFO)]  = "VIDIOCGPLAYINFO",
+       [_IOC_NR(VIDIOCSMICROCODE)] = "VIDIOCSMICROCODE",
+       [_IOC_NR(VIDIOCGVBIFMT)]    = "VIDIOCGVBIFMT",
+       [_IOC_NR(VIDIOCSVBIFMT)]    = "VIDIOCSVBIFMT"
+};
+#define V4L1_IOCTLS ARRAY_SIZE(v4l1_ioctls)
+#endif
+
+static const char *v4l2_ioctls[] = {
+       [_IOC_NR(VIDIOC_QUERYCAP)]         = "VIDIOC_QUERYCAP",
+       [_IOC_NR(VIDIOC_RESERVED)]         = "VIDIOC_RESERVED",
+       [_IOC_NR(VIDIOC_ENUM_FMT)]         = "VIDIOC_ENUM_FMT",
+       [_IOC_NR(VIDIOC_G_FMT)]            = "VIDIOC_G_FMT",
+       [_IOC_NR(VIDIOC_S_FMT)]            = "VIDIOC_S_FMT",
+       [_IOC_NR(VIDIOC_REQBUFS)]          = "VIDIOC_REQBUFS",
+       [_IOC_NR(VIDIOC_QUERYBUF)]         = "VIDIOC_QUERYBUF",
+       [_IOC_NR(VIDIOC_G_FBUF)]           = "VIDIOC_G_FBUF",
+       [_IOC_NR(VIDIOC_S_FBUF)]           = "VIDIOC_S_FBUF",
+       [_IOC_NR(VIDIOC_OVERLAY)]          = "VIDIOC_OVERLAY",
+       [_IOC_NR(VIDIOC_QBUF)]             = "VIDIOC_QBUF",
+       [_IOC_NR(VIDIOC_DQBUF)]            = "VIDIOC_DQBUF",
+       [_IOC_NR(VIDIOC_STREAMON)]         = "VIDIOC_STREAMON",
+       [_IOC_NR(VIDIOC_STREAMOFF)]        = "VIDIOC_STREAMOFF",
+       [_IOC_NR(VIDIOC_G_PARM)]           = "VIDIOC_G_PARM",
+       [_IOC_NR(VIDIOC_S_PARM)]           = "VIDIOC_S_PARM",
+       [_IOC_NR(VIDIOC_G_STD)]            = "VIDIOC_G_STD",
+       [_IOC_NR(VIDIOC_S_STD)]            = "VIDIOC_S_STD",
+       [_IOC_NR(VIDIOC_ENUMSTD)]          = "VIDIOC_ENUMSTD",
+       [_IOC_NR(VIDIOC_ENUMINPUT)]        = "VIDIOC_ENUMINPUT",
+       [_IOC_NR(VIDIOC_G_CTRL)]           = "VIDIOC_G_CTRL",
+       [_IOC_NR(VIDIOC_S_CTRL)]           = "VIDIOC_S_CTRL",
+       [_IOC_NR(VIDIOC_G_TUNER)]          = "VIDIOC_G_TUNER",
+       [_IOC_NR(VIDIOC_S_TUNER)]          = "VIDIOC_S_TUNER",
+       [_IOC_NR(VIDIOC_G_AUDIO)]          = "VIDIOC_G_AUDIO",
+       [_IOC_NR(VIDIOC_S_AUDIO)]          = "VIDIOC_S_AUDIO",
+       [_IOC_NR(VIDIOC_QUERYCTRL)]        = "VIDIOC_QUERYCTRL",
+       [_IOC_NR(VIDIOC_QUERYMENU)]        = "VIDIOC_QUERYMENU",
+       [_IOC_NR(VIDIOC_G_INPUT)]          = "VIDIOC_G_INPUT",
+       [_IOC_NR(VIDIOC_S_INPUT)]          = "VIDIOC_S_INPUT",
+       [_IOC_NR(VIDIOC_G_OUTPUT)]         = "VIDIOC_G_OUTPUT",
+       [_IOC_NR(VIDIOC_S_OUTPUT)]         = "VIDIOC_S_OUTPUT",
+       [_IOC_NR(VIDIOC_ENUMOUTPUT)]       = "VIDIOC_ENUMOUTPUT",
+       [_IOC_NR(VIDIOC_G_AUDOUT)]         = "VIDIOC_G_AUDOUT",
+       [_IOC_NR(VIDIOC_S_AUDOUT)]         = "VIDIOC_S_AUDOUT",
+       [_IOC_NR(VIDIOC_G_MODULATOR)]      = "VIDIOC_G_MODULATOR",
+       [_IOC_NR(VIDIOC_S_MODULATOR)]      = "VIDIOC_S_MODULATOR",
+       [_IOC_NR(VIDIOC_G_FREQUENCY)]      = "VIDIOC_G_FREQUENCY",
+       [_IOC_NR(VIDIOC_S_FREQUENCY)]      = "VIDIOC_S_FREQUENCY",
+       [_IOC_NR(VIDIOC_CROPCAP)]          = "VIDIOC_CROPCAP",
+       [_IOC_NR(VIDIOC_G_CROP)]           = "VIDIOC_G_CROP",
+       [_IOC_NR(VIDIOC_S_CROP)]           = "VIDIOC_S_CROP",
+       [_IOC_NR(VIDIOC_G_JPEGCOMP)]       = "VIDIOC_G_JPEGCOMP",
+       [_IOC_NR(VIDIOC_S_JPEGCOMP)]       = "VIDIOC_S_JPEGCOMP",
+       [_IOC_NR(VIDIOC_QUERYSTD)]         = "VIDIOC_QUERYSTD",
+       [_IOC_NR(VIDIOC_TRY_FMT)]          = "VIDIOC_TRY_FMT",
+       [_IOC_NR(VIDIOC_ENUMAUDIO)]        = "VIDIOC_ENUMAUDIO",
+       [_IOC_NR(VIDIOC_ENUMAUDOUT)]       = "VIDIOC_ENUMAUDOUT",
+       [_IOC_NR(VIDIOC_G_PRIORITY)]       = "VIDIOC_G_PRIORITY",
+       [_IOC_NR(VIDIOC_S_PRIORITY)]       = "VIDIOC_S_PRIORITY",
+       [_IOC_NR(VIDIOC_G_SLICED_VBI_CAP)] = "VIDIOC_G_SLICED_VBI_CAP",
+       [_IOC_NR(VIDIOC_LOG_STATUS)]       = "VIDIOC_LOG_STATUS",
+       [_IOC_NR(VIDIOC_G_EXT_CTRLS)]      = "VIDIOC_G_EXT_CTRLS",
+       [_IOC_NR(VIDIOC_S_EXT_CTRLS)]      = "VIDIOC_S_EXT_CTRLS",
+       [_IOC_NR(VIDIOC_TRY_EXT_CTRLS)]    = "VIDIOC_TRY_EXT_CTRLS",
+#if 1
+       [_IOC_NR(VIDIOC_ENUM_FRAMESIZES)]  = "VIDIOC_ENUM_FRAMESIZES",
+       [_IOC_NR(VIDIOC_ENUM_FRAMEINTERVALS)] = "VIDIOC_ENUM_FRAMEINTERVALS",
+       [_IOC_NR(VIDIOC_G_ENC_INDEX)]      = "VIDIOC_G_ENC_INDEX",
+       [_IOC_NR(VIDIOC_ENCODER_CMD)]      = "VIDIOC_ENCODER_CMD",
+       [_IOC_NR(VIDIOC_TRY_ENCODER_CMD)]  = "VIDIOC_TRY_ENCODER_CMD",
+
+       [_IOC_NR(VIDIOC_DBG_S_REGISTER)]   = "VIDIOC_DBG_S_REGISTER",
+       [_IOC_NR(VIDIOC_DBG_G_REGISTER)]   = "VIDIOC_DBG_G_REGISTER",
+
+       [_IOC_NR(VIDIOC_G_CHIP_IDENT)]     = "VIDIOC_G_CHIP_IDENT",
+#endif
+};
+#define V4L2_IOCTLS ARRAY_SIZE(v4l2_ioctls)
+
+static const char *v4l2_int_ioctls[] = {
+#ifdef CONFIG_VIDEO_V4L1_COMPAT
+       [_IOC_NR(DECODER_GET_CAPABILITIES)]    = "DECODER_GET_CAPABILITIES",
+       [_IOC_NR(DECODER_GET_STATUS)]          = "DECODER_GET_STATUS",
+       [_IOC_NR(DECODER_SET_NORM)]            = "DECODER_SET_NORM",
+       [_IOC_NR(DECODER_SET_INPUT)]           = "DECODER_SET_INPUT",
+       [_IOC_NR(DECODER_SET_OUTPUT)]          = "DECODER_SET_OUTPUT",
+       [_IOC_NR(DECODER_ENABLE_OUTPUT)]       = "DECODER_ENABLE_OUTPUT",
+       [_IOC_NR(DECODER_SET_PICTURE)]         = "DECODER_SET_PICTURE",
+       [_IOC_NR(DECODER_SET_GPIO)]            = "DECODER_SET_GPIO",
+       [_IOC_NR(DECODER_INIT)]                = "DECODER_INIT",
+       [_IOC_NR(DECODER_SET_VBI_BYPASS)]      = "DECODER_SET_VBI_BYPASS",
+       [_IOC_NR(DECODER_DUMP)]                = "DECODER_DUMP",
+#endif
+       [_IOC_NR(AUDC_SET_RADIO)]              = "AUDC_SET_RADIO",
+
+       [_IOC_NR(TUNER_SET_TYPE_ADDR)]         = "TUNER_SET_TYPE_ADDR",
+       [_IOC_NR(TUNER_SET_STANDBY)]           = "TUNER_SET_STANDBY",
+       [_IOC_NR(TUNER_SET_CONFIG)]            = "TUNER_SET_CONFIG",
+
+       [_IOC_NR(VIDIOC_INT_S_TUNER_MODE)]     = "VIDIOC_INT_S_TUNER_MODE",
+       [_IOC_NR(VIDIOC_INT_RESET)]            = "VIDIOC_INT_RESET",
+       [_IOC_NR(VIDIOC_INT_AUDIO_CLOCK_FREQ)] = "VIDIOC_INT_AUDIO_CLOCK_FREQ",
+       [_IOC_NR(VIDIOC_INT_DECODE_VBI_LINE)]  = "VIDIOC_INT_DECODE_VBI_LINE",
+       [_IOC_NR(VIDIOC_INT_S_VBI_DATA)]       = "VIDIOC_INT_S_VBI_DATA",
+       [_IOC_NR(VIDIOC_INT_G_VBI_DATA)]       = "VIDIOC_INT_G_VBI_DATA",
+       [_IOC_NR(VIDIOC_INT_I2S_CLOCK_FREQ)]   = "VIDIOC_INT_I2S_CLOCK_FREQ",
+       [_IOC_NR(VIDIOC_INT_S_STANDBY)]        = "VIDIOC_INT_S_STANDBY",
+       [_IOC_NR(VIDIOC_INT_S_AUDIO_ROUTING)]  = "VIDIOC_INT_S_AUDIO_ROUTING",
+       [_IOC_NR(VIDIOC_INT_G_AUDIO_ROUTING)]  = "VIDIOC_INT_G_AUDIO_ROUTING",
+       [_IOC_NR(VIDIOC_INT_S_VIDEO_ROUTING)]  = "VIDIOC_INT_S_VIDEO_ROUTING",
+       [_IOC_NR(VIDIOC_INT_G_VIDEO_ROUTING)]  = "VIDIOC_INT_G_VIDEO_ROUTING",
+       [_IOC_NR(VIDIOC_INT_S_CRYSTAL_FREQ)]   = "VIDIOC_INT_S_CRYSTAL_FREQ",
+       [_IOC_NR(VIDIOC_INT_INIT)]             = "VIDIOC_INT_INIT",
+       [_IOC_NR(VIDIOC_INT_G_STD_OUTPUT)]     = "VIDIOC_INT_G_STD_OUTPUT",
+       [_IOC_NR(VIDIOC_INT_S_STD_OUTPUT)]     = "VIDIOC_INT_S_STD_OUTPUT",
+};
+#define V4L2_INT_IOCTLS ARRAY_SIZE(v4l2_int_ioctls)
+
+/* Common ioctl debug function. This function can be used by
+   external ioctl messages as well as internal V4L ioctl */
+void v4l_printk_ioctl(unsigned int cmd)
+{
+       char *dir;
+
+       switch (_IOC_DIR(cmd)) {
+       case _IOC_NONE:              dir = "--"; break;
+       case _IOC_READ:              dir = "r-"; break;
+       case _IOC_WRITE:             dir = "-w"; break;
+       case _IOC_READ | _IOC_WRITE: dir = "rw"; break;
+       default:                     dir = "*ERR*"; break;
+       }
+       switch (_IOC_TYPE(cmd)) {
+       case 'd':
+               printk("v4l2_int ioctl %s, dir=%s (0x%08x)\n",
+                      (_IOC_NR(cmd) < V4L2_INT_IOCTLS) ?
+                      v4l2_int_ioctls[_IOC_NR(cmd)] : "UNKNOWN", dir, cmd);
+               break;
+#ifdef CONFIG_VIDEO_V4L1_COMPAT
+       case 'v':
+               printk("v4l1 ioctl %s, dir=%s (0x%08x)\n",
+                      (_IOC_NR(cmd) < V4L1_IOCTLS) ?
+                      v4l1_ioctls[_IOC_NR(cmd)] : "UNKNOWN", dir, cmd);
+               break;
+#endif
+       case 'V':
+               printk("v4l2 ioctl %s, dir=%s (0x%08x)\n",
+                      (_IOC_NR(cmd) < V4L2_IOCTLS) ?
+                      v4l2_ioctls[_IOC_NR(cmd)] : "UNKNOWN", dir, cmd);
+               break;
+
+       default:
+               printk("unknown ioctl '%c', dir=%s, #%d (0x%08x)\n",
+                      _IOC_TYPE(cmd), dir, _IOC_NR(cmd), cmd);
+       }
+}
+EXPORT_SYMBOL(v4l_printk_ioctl);
+
 /*
  *     sysfs stuff
  */
@@ -69,11 +432,13 @@ struct video_device *video_device_alloc(void)
        vfd = kzalloc(sizeof(*vfd),GFP_KERNEL);
        return vfd;
 }
+EXPORT_SYMBOL(video_device_alloc);
 
 void video_device_release(struct video_device *vfd)
 {
        kfree(vfd);
 }
+EXPORT_SYMBOL(video_device_release);
 
 static void video_release(struct device *cd)
 {
@@ -110,6 +475,7 @@ struct video_device* video_devdata(struct file *file)
 {
        return video_device[iminor(file->f_path.dentry->d_inode)];
 }
+EXPORT_SYMBOL(video_devdata);
 
 /*
  *     Open a video device - FIXME: Obsoleted
@@ -278,6 +644,7 @@ out:
        kfree(mbuf);
        return err;
 }
+EXPORT_SYMBOL(video_usercopy);
 
 /*
  * open/release helper functions -- handle exclusive opens
@@ -297,6 +664,7 @@ int video_exclusive_open(struct inode *inode, struct file *file)
        mutex_unlock(&vfl->lock);
        return retval;
 }
+EXPORT_SYMBOL(video_exclusive_open);
 
 int video_exclusive_release(struct inode *inode, struct file *file)
 {
@@ -305,41 +673,7 @@ int video_exclusive_release(struct inode *inode, struct file *file)
        vfl->users--;
        return 0;
 }
-
-static char *v4l2_memory_names[] = {
-       [V4L2_MEMORY_MMAP]    = "mmap",
-       [V4L2_MEMORY_USERPTR] = "userptr",
-       [V4L2_MEMORY_OVERLAY] = "overlay",
-};
-
-
-/* FIXME: Those stuff are replicated also on v4l2-common.c */
-static char *v4l2_type_names_FIXME[] = {
-       [V4L2_BUF_TYPE_VIDEO_CAPTURE]      = "video-cap",
-       [V4L2_BUF_TYPE_VIDEO_OVERLAY]      = "video-over",
-       [V4L2_BUF_TYPE_VIDEO_OUTPUT]       = "video-out",
-       [V4L2_BUF_TYPE_VBI_CAPTURE]        = "vbi-cap",
-       [V4L2_BUF_TYPE_VBI_OUTPUT]         = "vbi-out",
-       [V4L2_BUF_TYPE_SLICED_VBI_OUTPUT]  = "sliced-vbi-out",
-       [V4L2_BUF_TYPE_SLICED_VBI_CAPTURE] = "sliced-vbi-capture",
-       [V4L2_BUF_TYPE_VIDEO_OUTPUT_OVERLAY] = "video-out-over",
-       [V4L2_BUF_TYPE_PRIVATE]            = "private",
-};
-
-static char *v4l2_field_names_FIXME[] = {
-       [V4L2_FIELD_ANY]        = "any",
-       [V4L2_FIELD_NONE]       = "none",
-       [V4L2_FIELD_TOP]        = "top",
-       [V4L2_FIELD_BOTTOM]     = "bottom",
-       [V4L2_FIELD_INTERLACED] = "interlaced",
-       [V4L2_FIELD_SEQ_TB]     = "seq-tb",
-       [V4L2_FIELD_SEQ_BT]     = "seq-bt",
-       [V4L2_FIELD_ALTERNATE]  = "alternate",
-       [V4L2_FIELD_INTERLACED_TB] = "interlaced-tb",
-       [V4L2_FIELD_INTERLACED_BT] = "interlaced-bt",
-};
-
-#define prt_names(a,arr) (((a)>=0)&&((a)<ARRAY_SIZE(arr)))?arr[a]:"unknown"
+EXPORT_SYMBOL(video_exclusive_release);
 
 static void dbgbuf(unsigned int cmd, struct video_device *vfd,
                                        struct v4l2_buffer *p)
@@ -354,10 +688,10 @@ static void dbgbuf(unsigned int cmd, struct video_device *vfd,
                        (int)(p->timestamp.tv_sec%60),
                        p->timestamp.tv_usec,
                        p->index,
-                       prt_names(p->type,v4l2_type_names_FIXME),
-                       p->bytesused,p->flags,
-                       p->field,p->sequence,
-                       prt_names(p->memory,v4l2_memory_names),
+                       prt_names(p->type, v4l2_type_names),
+                       p->bytesused, p->flags,
+                       p->field, p->sequence,
+                       prt_names(p->memory, v4l2_memory_names),
                        p->m.userptr, p->length);
        dbgarg2 ("timecode= %02d:%02d:%02d type=%d, "
                "flags=0x%08d, frames=%d, userbits=0x%08x\n",
@@ -382,8 +716,8 @@ static inline void v4l_print_pix_fmt (struct video_device *vfd,
                (fmt->pixelformat >>  8) & 0xff,
                (fmt->pixelformat >> 16) & 0xff,
                (fmt->pixelformat >> 24) & 0xff,
-               prt_names(fmt->field,v4l2_field_names_FIXME),
-               fmt->bytesperline,fmt->sizeimage,fmt->colorspace);
+               prt_names(fmt->field, v4l2_field_names),
+               fmt->bytesperline, fmt->sizeimage, fmt->colorspace);
 };
 
 
@@ -597,7 +931,7 @@ static int __video_do_ioctl(struct inode *inode, struct file *file,
 
                /* FIXME: Should be one dump per type */
                dbgarg (cmd, "type=%s\n", prt_names(type,
-                                       v4l2_type_names_FIXME));
+                                       v4l2_type_names));
 
                switch (type) {
                case V4L2_BUF_TYPE_VIDEO_CAPTURE:
@@ -650,7 +984,7 @@ static int __video_do_ioctl(struct inode *inode, struct file *file,
 
                /* FIXME: Should be one dump per type */
                dbgarg (cmd, "type=%s\n", prt_names(f->type,
-                                       v4l2_type_names_FIXME));
+                                       v4l2_type_names));
 
                switch (f->type) {
                case V4L2_BUF_TYPE_VIDEO_CAPTURE:
@@ -702,7 +1036,7 @@ static int __video_do_ioctl(struct inode *inode, struct file *file,
 
                /* FIXME: Should be one dump per type */
                dbgarg (cmd, "type=%s\n", prt_names(f->type,
-                                               v4l2_type_names_FIXME));
+                                               v4l2_type_names));
                switch (f->type) {
                case V4L2_BUF_TYPE_VIDEO_CAPTURE:
                        if (vfd->vidioc_try_fmt_cap)
@@ -768,8 +1102,8 @@ static int __video_do_ioctl(struct inode *inode, struct file *file,
                ret=vfd->vidioc_reqbufs(file, fh, p);
                dbgarg (cmd, "count=%d, type=%s, memory=%s\n",
                                p->count,
-                               prt_names(p->type,v4l2_type_names_FIXME),
-                               prt_names(p->memory,v4l2_memory_names));
+                               prt_names(p->type, v4l2_type_names),
+                               prt_names(p->memory, v4l2_memory_names));
                break;
        }
        case VIDIOC_QUERYBUF:
@@ -858,7 +1192,7 @@ static int __video_do_ioctl(struct inode *inode, struct file *file,
                enum v4l2_buf_type i = *(int *)arg;
                if (!vfd->vidioc_streamon)
                        break;
-               dbgarg (cmd, "type=%s\n", prt_names(i,v4l2_type_names_FIXME));
+               dbgarg(cmd, "type=%s\n", prt_names(i, v4l2_type_names));
                ret=vfd->vidioc_streamon(file, fh,i);
                break;
        }
@@ -868,7 +1202,7 @@ static int __video_do_ioctl(struct inode *inode, struct file *file,
 
                if (!vfd->vidioc_streamoff)
                        break;
-               dbgarg (cmd, "type=%s\n", prt_names(i,v4l2_type_names_FIXME));
+               dbgarg(cmd, "type=%s\n", prt_names(i, v4l2_type_names));
                ret=vfd->vidioc_streamoff(file, fh, i);
                break;
        }
@@ -1624,7 +1958,7 @@ out:
        kfree(mbuf);
        return err;
 }
-
+EXPORT_SYMBOL(video_ioctl2);
 
 static const struct file_operations video_fops;
 
@@ -1743,6 +2077,7 @@ fail_minor:
        mutex_unlock(&videodev_lock);
        return ret;
 }
+EXPORT_SYMBOL(video_register_device);
 
 /**
  *     video_unregister_device - unregister a video4linux device
@@ -1762,6 +2097,7 @@ void video_unregister_device(struct video_device *vfd)
        device_unregister(&vfd->class_dev);
        mutex_unlock(&videodev_lock);
 }
+EXPORT_SYMBOL(video_unregister_device);
 
 /*
  * Video fs operations
@@ -1806,16 +2142,6 @@ static void __exit videodev_exit(void)
 module_init(videodev_init)
 module_exit(videodev_exit)
 
-EXPORT_SYMBOL(video_register_device);
-EXPORT_SYMBOL(video_unregister_device);
-EXPORT_SYMBOL(video_devdata);
-EXPORT_SYMBOL(video_usercopy);
-EXPORT_SYMBOL(video_exclusive_open);
-EXPORT_SYMBOL(video_exclusive_release);
-EXPORT_SYMBOL(video_ioctl2);
-EXPORT_SYMBOL(video_device_alloc);
-EXPORT_SYMBOL(video_device_release);
-
 MODULE_AUTHOR("Alan Cox, Mauro Carvalho Chehab <mchehab@infradead.org>");
 MODULE_DESCRIPTION("Device registrar for Video4Linux drivers v2");
 MODULE_LICENSE("GPL");
index 475d0d8275e001ecb573e5d5e6a1b638db4b400d..316a58453134df7db59ff22d74253b73c2747f83 100644 (file)
@@ -61,8 +61,6 @@
                        v4l_client_printk(KERN_DEBUG, client, fmt , ## arg); \
        } while (0)
 
-/* Prints the ioctl in a human-readable format */
-extern void v4l_printk_ioctl(unsigned int cmd);
 
 /* Use this macro for non-I2C drivers. Pass the driver name as the first arg. */
 #define v4l_print_ioctl(name, cmd)              \
index c544c6f90893085ad4f73e664dcafdce269653da..f2114459995d94826b9530e3a4f9c6feea1e5b00 100644 (file)
@@ -44,6 +44,8 @@ extern unsigned int v4l2_video_std_fps(struct v4l2_standard *vs);
 extern char *v4l2_norm_to_name(v4l2_std_id id);
 extern int v4l2_video_std_construct(struct v4l2_standard *vs,
                                    int id, char *name);
+/* Prints the ioctl in a human-readable format */
+extern void v4l_printk_ioctl(unsigned int cmd);
 
 /* prority handling */
 struct v4l2_prio_state {