Merge branch 'v4l_for_linus' of git://git.kernel.org/pub/scm/linux/kernel/git/mchehab...
Linus Torvalds [Thu, 24 Mar 2011 16:50:13 +0000 (09:50 -0700)]
* 'v4l_for_linus' of git://git.kernel.org/pub/scm/linux/kernel/git/mchehab/linux-2.6: (442 commits)
  [media] videobuf2-dma-contig: make cookie() return a pointer to dma_addr_t
  [media] sh_mobile_ceu_camera: Do not call vb2's mem_ops directly
  [media] V4L: soc-camera: explicitly require V4L2_BUF_TYPE_VIDEO_CAPTURE
  [media] v4l: soc-camera: Store negotiated buffer settings
  [media] rc: interim support for 32-bit NEC-ish scancodes
  [media] mceusb: topseed 0x0011 needs gen3 init for tx to work
  [media] lirc_zilog: error out if buffer read bytes != chunk size
  [media] lirc: silence some compile warnings
  [media] hdpvr: use same polling interval as other OS
  [media] ir-kbd-i2c: pass device code w/key in hauppauge case
  [media] rc/keymaps: Remove the obsolete rc-rc5-tv keymap
  [media] remove the old RC_MAP_HAUPPAUGE_NEW RC map
  [media] rc/keymaps: Rename Hauppauge table as rc-hauppauge
  [media] rc-rc5-hauppauge-new: Fix Hauppauge Grey mapping
  [media] rc-rc5-hauppauge-new: Add support for the old Black RC
  [media] rc-rc5-hauppauge-new: Add the old control to the table
  [media] rc-winfast: Fix the keycode tables
  [media] a800: Fix a few wrong IR key assignments
  [media] opera1: Use multimedia keys instead of an app-specific mapping
  [media] dw2102: Use multimedia keys instead of an app-specific mapping
  ...

Fix up trivial conflicts (remove/modify and some real conflicts) in:
arch/arm/mach-omap2/devices.c
drivers/staging/Kconfig
drivers/staging/Makefile
drivers/staging/dabusb/dabusb.c
drivers/staging/dabusb/dabusb.h
drivers/staging/easycap/easycap_ioctl.c
drivers/staging/usbvideo/usbvideo.c
drivers/staging/usbvideo/vicam.c

14 files changed:
1  2 
Documentation/feature-removal-schedule.txt
Documentation/ioctl/ioctl-number.txt
MAINTAINERS
arch/arm/mach-omap2/devices.c
drivers/media/dvb/dvb-usb/dvb-usb-remote.c
drivers/media/radio/radio-wl1273.c
drivers/mfd/Kconfig
drivers/mfd/wl1273-core.c
drivers/staging/Kconfig
drivers/staging/Makefile
drivers/staging/easycap/easycap_ioctl.c
drivers/video/matrox/matroxfb_base.c
sound/soc/codecs/Kconfig
sound/soc/codecs/wl1273.c

Simple merge
diff --cc MAINTAINERS
Simple merge
  
  #include "mux.h"
  #include "control.h"
 -
+ #include "devices.h"
  
 +#define L3_MODULES_MAX_LEN 12
 +#define L3_MODULES 3
 +
 +static int __init omap3_l3_init(void)
 +{
 +      int l;
 +      struct omap_hwmod *oh;
 +      struct omap_device *od;
 +      char oh_name[L3_MODULES_MAX_LEN];
 +
 +      /*
 +       * To avoid code running on other OMAPs in
 +       * multi-omap builds
 +       */
 +      if (!(cpu_is_omap34xx()))
 +              return -ENODEV;
 +
 +      l = snprintf(oh_name, L3_MODULES_MAX_LEN, "l3_main");
 +
 +      oh = omap_hwmod_lookup(oh_name);
 +
 +      if (!oh)
 +              pr_err("could not look up %s\n", oh_name);
 +
 +      od = omap_device_build("omap_l3_smx", 0, oh, NULL, 0,
 +                                                         NULL, 0, 0);
 +
 +      WARN(IS_ERR(od), "could not build omap_device for %s\n", oh_name);
 +
 +      return PTR_ERR(od);
 +}
 +postcore_initcall(omap3_l3_init);
 +
 +static int __init omap4_l3_init(void)
 +{
 +      int l, i;
 +      struct omap_hwmod *oh[3];
 +      struct omap_device *od;
 +      char oh_name[L3_MODULES_MAX_LEN];
 +
 +      /*
 +       * To avoid code running on other OMAPs in
 +       * multi-omap builds
 +       */
 +      if (!(cpu_is_omap44xx()))
 +              return -ENODEV;
 +
 +      for (i = 0; i < L3_MODULES; i++) {
 +              l = snprintf(oh_name, L3_MODULES_MAX_LEN, "l3_main_%d", i+1);
 +
 +              oh[i] = omap_hwmod_lookup(oh_name);
 +              if (!(oh[i]))
 +                      pr_err("could not look up %s\n", oh_name);
 +      }
 +
 +      od = omap_device_build_ss("omap_l3_noc", 0, oh, 3, NULL,
 +                                                   0, NULL, 0, 0);
 +
 +      WARN(IS_ERR(od), "could not build omap_device for %s\n", oh_name);
 +
 +      return PTR_ERR(od);
 +}
 +postcore_initcall(omap4_l3_init);
 +
  #if defined(CONFIG_VIDEO_OMAP2) || defined(CONFIG_VIDEO_OMAP2_MODULE)
  
- static struct resource cam_resources[] = {
+ static struct resource omap2cam_resources[] = {
        {
                .start          = OMAP24XX_CAMERA_BASE,
                .end            = OMAP24XX_CAMERA_BASE + 0xfff,
@@@ -197,63 -142,92 +207,67 @@@ static struct platform_device omap3isp_
        .resource       = omap3isp_resources,
  };
  
- static inline void omap_init_camera(void)
+ int omap3_init_camera(struct isp_platform_data *pdata)
  {
-       platform_device_register(&omap3isp_device);
+       omap3isp_device.dev.platform_data = pdata;
+       return platform_device_register(&omap3isp_device);
  }
- #else
  static inline void omap_init_camera(void)
  {
- }
+ #if defined(CONFIG_VIDEO_OMAP2) || defined(CONFIG_VIDEO_OMAP2_MODULE)
+       if (cpu_is_omap24xx())
+               platform_device_register(&omap2cam_device);
  #endif
+ }
  
 -#if defined(CONFIG_OMAP_MBOX_FWK) || defined(CONFIG_OMAP_MBOX_FWK_MODULE)
 -
 -#define MBOX_REG_SIZE   0x120
 -
 -#ifdef CONFIG_ARCH_OMAP2
 -static struct resource omap2_mbox_resources[] = {
 -      {
 -              .start          = OMAP24XX_MAILBOX_BASE,
 -              .end            = OMAP24XX_MAILBOX_BASE + MBOX_REG_SIZE - 1,
 -              .flags          = IORESOURCE_MEM,
 -      },
 +struct omap_device_pm_latency omap_keyboard_latency[] = {
        {
 -              .start          = INT_24XX_MAIL_U0_MPU,
 -              .flags          = IORESOURCE_IRQ,
 -              .name           = "dsp",
 -      },
 -      {
 -              .start          = INT_24XX_MAIL_U3_MPU,
 -              .flags          = IORESOURCE_IRQ,
 -              .name           = "iva",
 +              .deactivate_func = omap_device_idle_hwmods,
 +              .activate_func   = omap_device_enable_hwmods,
 +              .flags = OMAP_DEVICE_LATENCY_AUTO_ADJUST,
        },
  };
 -static int omap2_mbox_resources_sz = ARRAY_SIZE(omap2_mbox_resources);
 -#else
 -#define omap2_mbox_resources          NULL
 -#define omap2_mbox_resources_sz               0
 -#endif
  
 -#ifdef CONFIG_ARCH_OMAP3
 -static struct resource omap3_mbox_resources[] = {
 -      {
 -              .start          = OMAP34XX_MAILBOX_BASE,
 -              .end            = OMAP34XX_MAILBOX_BASE + MBOX_REG_SIZE - 1,
 -              .flags          = IORESOURCE_MEM,
 -      },
 -      {
 -              .start          = INT_24XX_MAIL_U0_MPU,
 -              .flags          = IORESOURCE_IRQ,
 -              .name           = "dsp",
 -      },
 -};
 -static int omap3_mbox_resources_sz = ARRAY_SIZE(omap3_mbox_resources);
 -#else
 -#define omap3_mbox_resources          NULL
 -#define omap3_mbox_resources_sz               0
 -#endif
 +int __init omap4_keyboard_init(struct omap4_keypad_platform_data
 +                                              *sdp4430_keypad_data)
 +{
 +      struct omap_device *od;
 +      struct omap_hwmod *oh;
 +      struct omap4_keypad_platform_data *keypad_data;
 +      unsigned int id = -1;
 +      char *oh_name = "kbd";
 +      char *name = "omap4-keypad";
 +
 +      oh = omap_hwmod_lookup(oh_name);
 +      if (!oh) {
 +              pr_err("Could not look up %s\n", oh_name);
 +              return -ENODEV;
 +      }
  
 -#ifdef CONFIG_ARCH_OMAP4
 +      keypad_data = sdp4430_keypad_data;
  
 -#define OMAP4_MBOX_REG_SIZE   0x130
 -static struct resource omap4_mbox_resources[] = {
 -      {
 -              .start          = OMAP44XX_MAILBOX_BASE,
 -              .end            = OMAP44XX_MAILBOX_BASE +
 -                                      OMAP4_MBOX_REG_SIZE - 1,
 -              .flags          = IORESOURCE_MEM,
 -      },
 -      {
 -              .start          = OMAP44XX_IRQ_MAIL_U0,
 -              .flags          = IORESOURCE_IRQ,
 -              .name           = "mbox",
 -      },
 -};
 -static int omap4_mbox_resources_sz = ARRAY_SIZE(omap4_mbox_resources);
 -#else
 -#define omap4_mbox_resources          NULL
 -#define omap4_mbox_resources_sz               0
 -#endif
 +      od = omap_device_build(name, id, oh, keypad_data,
 +                      sizeof(struct omap4_keypad_platform_data),
 +                      omap_keyboard_latency,
 +                      ARRAY_SIZE(omap_keyboard_latency), 0);
  
 -static struct platform_device mbox_device = {
 -      .name           = "omap-mailbox",
 -      .id             = -1,
 +      if (IS_ERR(od)) {
 +              WARN(1, "Cant build omap_device for %s:%s.\n",
 +                                              name, oh->name);
 +              return PTR_ERR(od);
 +      }
 +
 +      return 0;
 +}
 +
 +#if defined(CONFIG_OMAP_MBOX_FWK) || defined(CONFIG_OMAP_MBOX_FWK_MODULE)
 +static struct omap_device_pm_latency mbox_latencies[] = {
 +      [0] = {
 +              .activate_func = omap_device_enable_hwmods,
 +              .deactivate_func = omap_device_idle_hwmods,
 +              .flags = OMAP_DEVICE_LATENCY_AUTO_ADJUST,
 +      },
  };
  
  static inline void omap_init_mbox(void)
Simple merge
Simple merge
@@@ -78,9 -217,16 +217,15 @@@ static int __devinit wl1273_core_probe(
  
        cell = &core->cells[children];
        cell->name = "wl1273_fm_radio";
 -      cell->platform_data = &core;
 -      cell->data_size = sizeof(core);
 +      cell->mfd_data = &core;
        children++;
  
+       core->read = wl1273_fm_read_reg;
+       core->write = wl1273_fm_write_cmd;
+       core->write_data = wl1273_fm_write_data;
+       core->set_audio = wl1273_fm_set_audio;
+       core->set_volume = wl1273_fm_set_volume;
        if (pdata->children & WL1273_CODEC_CHILD) {
                cell = &core->cells[children];
  
@@@ -181,7 -175,7 +177,9 @@@ source "drivers/staging/cptm1217/Kconfi
  
  source "drivers/staging/ste_rmi4/Kconfig"
  
 +source "drivers/staging/gma500/Kconfig"
 +
+ source "drivers/staging/altera-stapl/Kconfig"
  endif # !STAGING_EXCLUDE_BUILD
  endif # STAGING
@@@ -63,13 -59,13 +61,14 @@@ obj-$(CONFIG_SOLO6X10)             += solo6x10
  obj-$(CONFIG_TIDSPBRIDGE)     += tidspbridge/
  obj-$(CONFIG_ACPI_QUICKSTART) += quickstart/
  obj-$(CONFIG_WESTBRIDGE_ASTORIA)      += westbridge/astoria/
 -obj-$(CONFIG_SBE_2T3E3)       += sbe-2t3e3/
 +obj-$(CONFIG_SBE_2T3E3)               += sbe-2t3e3/
  obj-$(CONFIG_ATH6K_LEGACY)    += ath6kl/
  obj-$(CONFIG_USB_ENESTORAGE)  += keucr/
 -obj-$(CONFIG_BCM_WIMAX)       += bcm/
 +obj-$(CONFIG_BCM_WIMAX)               += bcm/
  obj-$(CONFIG_FT1000)          += ft1000/
 -obj-$(CONFIG_SND_INTEL_SST)           += intel_sst/
 -obj-$(CONFIG_SPEAKUP) += speakup/
 +obj-$(CONFIG_SND_INTEL_SST)   += intel_sst/
 +obj-$(CONFIG_SPEAKUP)         += speakup/
+ obj-$(CONFIG_ALTERA_STAPL)    +=altera-stapl/
  obj-$(CONFIG_TOUCHSCREEN_CLEARPAD_TM1217)     += cptm1217/
  obj-$(CONFIG_TOUCHSCREEN_SYNAPTICS_I2C_RMI4)  += ste_rmi4/
 +obj-$(CONFIG_DRM_PSB)         += gma500/
@@@ -1019,432 -1032,581 +1019,431 @@@ long easycap_unlocked_ioctl(struct fil
  /*
   *  IF easycap_usb_disconnect() HAS ALREADY FREED POINTER peasycap BEFORE THE
   *  ATTEMPT TO ACQUIRE THE SEMAPHORE, isdongle() WILL HAVE FAILED.  BAIL OUT.
 -*/
 -/*---------------------------------------------------------------------------*/
 -      return -ERESTARTSYS;
 -}
 + */
  /*---------------------------------------------------------------------------*/
 -switch (cmd) {
 -case VIDIOC_QUERYCAP: {
 -      struct v4l2_capability v4l2_capability;
 -      char version[16], *p1, *p2;
 -      int i, rc, k[3];
 -      long lng;
 -
 -      JOM(8, "VIDIOC_QUERYCAP\n");
 -
 -      if (16 <= strlen(EASYCAP_DRIVER_VERSION)) {
 -              SAM("ERROR: bad driver version string\n");
 -              mutex_unlock(&easycap_dongle[kd].mutex_video);
 -              return -EINVAL;
 +              return -ERESTARTSYS;
        }
 -      strcpy(&version[0], EASYCAP_DRIVER_VERSION);
 -      for (i = 0; i < 3; i++)
 -              k[i] = 0;
 -      p2 = &version[0];  i = 0;
 -      while (*p2) {
 -              p1 = p2;
 -              while (*p2 && ('.' != *p2))
 -                      p2++;
 -              if (*p2)
 -                      *p2++ = 0;
 -              if (3 > i) {
 -                      rc = (int) strict_strtol(p1, 10, &lng);
 -                      if (0 != rc) {
 -                              SAM("ERROR: %i=strict_strtol(%s,.,,)\n", \
 -                                                              rc, p1);
 -                              mutex_unlock(&easycap_dongle[kd].mutex_video);
 -                              return -EINVAL;
 +/*---------------------------------------------------------------------------*/
 +      switch (cmd) {
 +      case VIDIOC_QUERYCAP: {
 +              struct v4l2_capability v4l2_capability;
 +              char version[16], *p1, *p2;
 +              int i, rc, k[3];
 +              long lng;
 +
 +              JOM(8, "VIDIOC_QUERYCAP\n");
 +
 +              if (16 <= strlen(EASYCAP_DRIVER_VERSION)) {
 +                      SAM("ERROR: bad driver version string\n");
 +                      mutex_unlock(&easycapdc60_dongle[kd].mutex_video);
 +                      return -EINVAL;
 +              }
 +              strcpy(&version[0], EASYCAP_DRIVER_VERSION);
 +              for (i = 0; i < 3; i++)
 +                      k[i] = 0;
 +              p2 = &version[0];
 +              i = 0;
 +              while (*p2) {
 +                      p1 = p2;
 +                      while (*p2 && ('.' != *p2))
 +                              p2++;
 +                      if (*p2)
 +                              *p2++ = 0;
 +                      if (3 > i) {
 +                              rc = (int) strict_strtol(p1, 10, &lng);
 +                              if (rc) {
 +                                      SAM("ERROR: %i=strict_strtol(%s,.,,)\n",
 +                                          rc, p1);
 +                                      mutex_unlock(&easycapdc60_dongle[kd].mutex_video);
 +                                      return -EINVAL;
 +                              }
 +                              k[i] = (int)lng;
                        }
 -                      k[i] = (int)lng;
 +                      i++;
                }
 -              i++;
 -      }
  
 -      memset(&v4l2_capability, 0, sizeof(struct v4l2_capability));
 -      strlcpy(&v4l2_capability.driver[0], "easycap", \
 -                                      sizeof(v4l2_capability.driver));
 +              memset(&v4l2_capability, 0, sizeof(struct v4l2_capability));
 +              strlcpy(&v4l2_capability.driver[0],
 +                      "easycap", sizeof(v4l2_capability.driver));
  
 -      v4l2_capability.capabilities = \
 -                              V4L2_CAP_VIDEO_CAPTURE | V4L2_CAP_STREAMING | \
 -                              V4L2_CAP_AUDIO         | V4L2_CAP_READWRITE;
 +              v4l2_capability.capabilities = V4L2_CAP_VIDEO_CAPTURE |
 +                                              V4L2_CAP_STREAMING |
 +                                              V4L2_CAP_AUDIO |
 +                                              V4L2_CAP_READWRITE;
  
 -      v4l2_capability.version = KERNEL_VERSION(k[0], k[1], k[2]);
 -      JOM(8, "v4l2_capability.version=(%i,%i,%i)\n", k[0], k[1], k[2]);
 +              v4l2_capability.version = KERNEL_VERSION(k[0], k[1], k[2]);
 +              JOM(8, "v4l2_capability.version=(%i,%i,%i)\n", k[0], k[1], k[2]);
  
 -      strlcpy(&v4l2_capability.card[0], "EasyCAP DC60", \
 -              sizeof(v4l2_capability.card));
 +              strlcpy(&v4l2_capability.card[0],
 +                      "EasyCAP DC60", sizeof(v4l2_capability.card));
  
 -      if (usb_make_path(peasycap->pusb_device, &v4l2_capability.bus_info[0],\
 +              if (usb_make_path(peasycap->pusb_device,
 +                              &v4l2_capability.bus_info[0],
                                sizeof(v4l2_capability.bus_info)) < 0) {
 -              strlcpy(&v4l2_capability.bus_info[0], "EasyCAP bus_info", \
 -                                      sizeof(v4l2_capability.bus_info));
 -              JOM(8, "%s=v4l2_capability.bus_info\n", \
 -                                      &v4l2_capability.bus_info[0]);
 -      }
 -      if (0 != copy_to_user((void __user *)arg, &v4l2_capability, \
 -                                      sizeof(struct v4l2_capability))) {
 -              mutex_unlock(&easycap_dongle[kd].mutex_video);
 -              return -EFAULT;
 +
 +                      strlcpy(&v4l2_capability.bus_info[0], "EasyCAP bus_info",
 +                              sizeof(v4l2_capability.bus_info));
 +                      JOM(8, "%s=v4l2_capability.bus_info\n",
 +                              &v4l2_capability.bus_info[0]);
 +              }
 +              if (copy_to_user((void __user *)arg, &v4l2_capability,
 +                              sizeof(struct v4l2_capability))) {
 +                      mutex_unlock(&easycapdc60_dongle[kd].mutex_video);
 +                      return -EFAULT;
 +              }
 +              break;
        }
 -      break;
 -}
  /* - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - */
 -case VIDIOC_ENUMINPUT: {
 -      struct v4l2_input v4l2_input;
 -      __u32 index;
 +      case VIDIOC_ENUMINPUT: {
 +              struct v4l2_input v4l2_input;
 +              u32 index;
  
 -      JOM(8, "VIDIOC_ENUMINPUT\n");
 +              JOM(8, "VIDIOC_ENUMINPUT\n");
  
 -      if (0 != copy_from_user(&v4l2_input, (void __user *)arg, \
 +              if (copy_from_user(&v4l2_input, (void __user *)arg,
                                        sizeof(struct v4l2_input))) {
 -              mutex_unlock(&easycap_dongle[kd].mutex_video);
 -              return -EFAULT;
 -      }
 +                      mutex_unlock(&easycapdc60_dongle[kd].mutex_video);
 +                      return -EFAULT;
 +              }
  
 -      index = v4l2_input.index;
 -      memset(&v4l2_input, 0, sizeof(struct v4l2_input));
 -
 -      switch (index) {
 -      case 0: {
 -              v4l2_input.index = index;
 -              strcpy(&v4l2_input.name[0], "CVBS0");
 -              v4l2_input.type = V4L2_INPUT_TYPE_CAMERA;
 -              v4l2_input.audioset = 0x01;
 -              v4l2_input.tuner = 0;
 -              v4l2_input.std = V4L2_STD_PAL | V4L2_STD_SECAM | \
 -                              V4L2_STD_NTSC ;
 -              v4l2_input.status = 0;
 -              JOM(8, "%i=index: %s\n", index, &v4l2_input.name[0]);
 -              break;
 -      }
 -      case 1: {
 -              v4l2_input.index = index;
 -              strcpy(&v4l2_input.name[0], "CVBS1");
 -              v4l2_input.type = V4L2_INPUT_TYPE_CAMERA;
 -              v4l2_input.audioset = 0x01;
 -              v4l2_input.tuner = 0;
 -              v4l2_input.std = V4L2_STD_PAL | V4L2_STD_SECAM | \
 -                              V4L2_STD_NTSC ;
 -              v4l2_input.status = 0;
 -              JOM(8, "%i=index: %s\n", index, &v4l2_input.name[0]);
 -              break;
 -      }
 -      case 2: {
 -              v4l2_input.index = index;
 -              strcpy(&v4l2_input.name[0], "CVBS2");
 -              v4l2_input.type = V4L2_INPUT_TYPE_CAMERA;
 -              v4l2_input.audioset = 0x01;
 -              v4l2_input.tuner = 0;
 -              v4l2_input.std = V4L2_STD_PAL | V4L2_STD_SECAM | \
 -                              V4L2_STD_NTSC ;
 -              v4l2_input.status = 0;
 -              JOM(8, "%i=index: %s\n", index, &v4l2_input.name[0]);
 -              break;
 -      }
 -      case 3: {
 -              v4l2_input.index = index;
 -              strcpy(&v4l2_input.name[0], "CVBS3");
 -              v4l2_input.type = V4L2_INPUT_TYPE_CAMERA;
 -              v4l2_input.audioset = 0x01;
 -              v4l2_input.tuner = 0;
 -              v4l2_input.std = V4L2_STD_PAL | V4L2_STD_SECAM | \
 -                              V4L2_STD_NTSC ;
 -              v4l2_input.status = 0;
 -              JOM(8, "%i=index: %s\n", index, &v4l2_input.name[0]);
 -              break;
 -      }
 -      case 4: {
 -              v4l2_input.index = index;
 -              strcpy(&v4l2_input.name[0], "CVBS4");
 -              v4l2_input.type = V4L2_INPUT_TYPE_CAMERA;
 -              v4l2_input.audioset = 0x01;
 -              v4l2_input.tuner = 0;
 -              v4l2_input.std = V4L2_STD_PAL | V4L2_STD_SECAM | \
 -                              V4L2_STD_NTSC ;
 -              v4l2_input.status = 0;
 -              JOM(8, "%i=index: %s\n", index, &v4l2_input.name[0]);
 -              break;
 -      }
 -      case 5: {
 -              v4l2_input.index = index;
 -              strcpy(&v4l2_input.name[0], "S-VIDEO");
 -              v4l2_input.type = V4L2_INPUT_TYPE_CAMERA;
 -              v4l2_input.audioset = 0x01;
 -              v4l2_input.tuner = 0;
 -              v4l2_input.std = V4L2_STD_PAL | V4L2_STD_SECAM | \
 -                              V4L2_STD_NTSC ;
 -              v4l2_input.status = 0;
 -              JOM(8, "%i=index: %s\n", index, &v4l2_input.name[0]);
 -              break;
 -      }
 -      default: {
 -              JOM(8, "%i=index: exhausts inputs\n", index);
 -              mutex_unlock(&easycap_dongle[kd].mutex_video);
 -              return -EINVAL;
 -      }
 -      }
 +              index = v4l2_input.index;
 +              memset(&v4l2_input, 0, sizeof(struct v4l2_input));
  
 -      if (0 != copy_to_user((void __user *)arg, &v4l2_input, \
 -                                              sizeof(struct v4l2_input))) {
 -              mutex_unlock(&easycap_dongle[kd].mutex_video);
 -              return -EFAULT;
 +              switch (index) {
 +              case 0: {
 +                      v4l2_input.index = index;
 +                      strcpy(&v4l2_input.name[0], "CVBS0");
 +                      v4l2_input.type = V4L2_INPUT_TYPE_CAMERA;
 +                      v4l2_input.audioset = 0x01;
 +                      v4l2_input.tuner = 0;
 +                      v4l2_input.std = V4L2_STD_PAL |
 +                                      V4L2_STD_SECAM |
 +                                      V4L2_STD_NTSC ;
 +                      v4l2_input.status = 0;
 +                      JOM(8, "%i=index: %s\n", index, &v4l2_input.name[0]);
 +                      break;
 +              }
 +              case 1: {
 +                      v4l2_input.index = index;
 +                      strcpy(&v4l2_input.name[0], "CVBS1");
 +                      v4l2_input.type = V4L2_INPUT_TYPE_CAMERA;
 +                      v4l2_input.audioset = 0x01;
 +                      v4l2_input.tuner = 0;
 +                      v4l2_input.std = V4L2_STD_PAL | V4L2_STD_SECAM |
 +                                      V4L2_STD_NTSC;
 +                      v4l2_input.status = 0;
 +                      JOM(8, "%i=index: %s\n", index, &v4l2_input.name[0]);
 +                      break;
 +              }
 +              case 2: {
 +                      v4l2_input.index = index;
 +                      strcpy(&v4l2_input.name[0], "CVBS2");
 +                      v4l2_input.type = V4L2_INPUT_TYPE_CAMERA;
 +                      v4l2_input.audioset = 0x01;
 +                      v4l2_input.tuner = 0;
 +                      v4l2_input.std = V4L2_STD_PAL | V4L2_STD_SECAM |
 +                                      V4L2_STD_NTSC ;
 +                      v4l2_input.status = 0;
 +                      JOM(8, "%i=index: %s\n", index, &v4l2_input.name[0]);
 +                      break;
 +              }
 +              case 3: {
 +                      v4l2_input.index = index;
 +                      strcpy(&v4l2_input.name[0], "CVBS3");
 +                      v4l2_input.type = V4L2_INPUT_TYPE_CAMERA;
 +                      v4l2_input.audioset = 0x01;
 +                      v4l2_input.tuner = 0;
 +                      v4l2_input.std = V4L2_STD_PAL | V4L2_STD_SECAM |
 +                                      V4L2_STD_NTSC ;
 +                      v4l2_input.status = 0;
 +                      JOM(8, "%i=index: %s\n", index, &v4l2_input.name[0]);
 +                      break;
 +              }
 +              case 4: {
 +                      v4l2_input.index = index;
 +                      strcpy(&v4l2_input.name[0], "CVBS4");
 +                      v4l2_input.type = V4L2_INPUT_TYPE_CAMERA;
 +                      v4l2_input.audioset = 0x01;
 +                      v4l2_input.tuner = 0;
 +                      v4l2_input.std = V4L2_STD_PAL | V4L2_STD_SECAM |
 +                                      V4L2_STD_NTSC ;
 +                      v4l2_input.status = 0;
 +                      JOM(8, "%i=index: %s\n", index, &v4l2_input.name[0]);
 +                      break;
 +              }
 +              case 5: {
 +                      v4l2_input.index = index;
 +                      strcpy(&v4l2_input.name[0], "S-VIDEO");
 +                      v4l2_input.type = V4L2_INPUT_TYPE_CAMERA;
 +                      v4l2_input.audioset = 0x01;
 +                      v4l2_input.tuner = 0;
 +                      v4l2_input.std = V4L2_STD_PAL | V4L2_STD_SECAM |
 +                                      V4L2_STD_NTSC ;
 +                      v4l2_input.status = 0;
 +                      JOM(8, "%i=index: %s\n", index, &v4l2_input.name[0]);
 +                      break;
 +              }
 +              default: {
 +                      JOM(8, "%i=index: exhausts inputs\n", index);
 +                      mutex_unlock(&easycapdc60_dongle[kd].mutex_video);
 +                      return -EINVAL;
 +              }
 +              }
 +
 +              if (copy_to_user((void __user *)arg, &v4l2_input,
 +                              sizeof(struct v4l2_input))) {
 +                      mutex_unlock(&easycapdc60_dongle[kd].mutex_video);
 +                      return -EFAULT;
 +              }
 +              break;
        }
 -      break;
 -}
  /* - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - */
 -case VIDIOC_G_INPUT: {
 -      __u32 index;
 -
 -      JOM(8, "VIDIOC_G_INPUT\n");
 -      index = (__u32)peasycap->input;
 -      JOM(8, "user is told: %i\n", index);
 -      if (0 != copy_to_user((void __user *)arg, &index, sizeof(__u32))) {
 -              mutex_unlock(&easycap_dongle[kd].mutex_video);
 -              return -EFAULT;
 +      case VIDIOC_G_INPUT: {
 +              u32 index;
 +
 +              JOM(8, "VIDIOC_G_INPUT\n");
 +              index = (u32)peasycap->input;
 +              JOM(8, "user is told: %i\n", index);
 +              if (copy_to_user((void __user *)arg, &index, sizeof(u32))) {
 +                      mutex_unlock(&easycapdc60_dongle[kd].mutex_video);
 +                      return -EFAULT;
 +              }
 +              break;
        }
 -      break;
 -}
  /* - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - */
 -case VIDIOC_S_INPUT:
 +      case VIDIOC_S_INPUT:
        {
 -      __u32 index;
 -      int rc;
 +              u32 index;
 +              int rc;
  
 -      JOM(8, "VIDIOC_S_INPUT\n");
 +              JOM(8, "VIDIOC_S_INPUT\n");
  
 -      if (0 != copy_from_user(&index, (void __user *)arg, sizeof(__u32))) {
 -              mutex_unlock(&easycap_dongle[kd].mutex_video);
 -              return -EFAULT;
 -      }
 +              if (0 != copy_from_user(&index, (void __user *)arg, sizeof(u32))) {
 +                      mutex_unlock(&easycapdc60_dongle[kd].mutex_video);
 +                      return -EFAULT;
 +              }
  
 -      JOM(8, "user requests input %i\n", index);
 +              JOM(8, "user requests input %i\n", index);
  
 -      if ((int)index == peasycap->input) {
 -              SAM("requested input already in effect\n");
 -              break;
 -      }
 +              if ((int)index == peasycap->input) {
 +                      SAM("requested input already in effect\n");
 +                      break;
 +              }
  
 -      if ((0 > index) || (INPUT_MANY <= index)) {
 -              JOM(8, "ERROR:  bad requested input: %i\n", index);
 -              mutex_unlock(&easycap_dongle[kd].mutex_video);
 -              return -EINVAL;
 -      }
 +              if ((0 > index) || (INPUT_MANY <= index)) {
 +                      JOM(8, "ERROR:  bad requested input: %i\n", index);
 +                      mutex_unlock(&easycapdc60_dongle[kd].mutex_video);
 +                      return -EINVAL;
 +              }
  
 -      rc = newinput(peasycap, (int)index);
 -      if (0 == rc) {
 -              JOM(8, "newinput(.,%i) OK\n", (int)index);
 -      } else {
 -              SAM("ERROR: newinput(.,%i) returned %i\n", (int)index, rc);
 -              mutex_unlock(&easycap_dongle[kd].mutex_video);
 -              return -EFAULT;
 +              rc = newinput(peasycap, (int)index);
 +              if (0 == rc) {
 +                      JOM(8, "newinput(.,%i) OK\n", (int)index);
 +              } else {
 +                      SAM("ERROR: newinput(.,%i) returned %i\n", (int)index, rc);
 +                      mutex_unlock(&easycapdc60_dongle[kd].mutex_video);
 +                      return -EFAULT;
 +              }
 +              break;
        }
 -      break;
 -}
  /* - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - */
 -case VIDIOC_ENUMAUDIO: {
 -      JOM(8, "VIDIOC_ENUMAUDIO\n");
 -      mutex_unlock(&easycap_dongle[kd].mutex_video);
 -      return -EINVAL;
 -}
 -/* - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - */
 -case VIDIOC_ENUMAUDOUT: {
 -      struct v4l2_audioout v4l2_audioout;
 -
 -      JOM(8, "VIDIOC_ENUMAUDOUT\n");
 -
 -      if (0 != copy_from_user(&v4l2_audioout, (void __user *)arg, \
 -                                      sizeof(struct v4l2_audioout))) {
 -              mutex_unlock(&easycap_dongle[kd].mutex_video);
 -              return -EFAULT;
 -      }
 -
 -      if (0 != v4l2_audioout.index) {
 -              mutex_unlock(&easycap_dongle[kd].mutex_video);
 +      case VIDIOC_ENUMAUDIO: {
 +              JOM(8, "VIDIOC_ENUMAUDIO\n");
 +              mutex_unlock(&easycapdc60_dongle[kd].mutex_video);
                return -EINVAL;
        }
 -      memset(&v4l2_audioout, 0, sizeof(struct v4l2_audioout));
 -      v4l2_audioout.index = 0;
 -      strcpy(&v4l2_audioout.name[0], "Soundtrack");
 -
 -      if (0 != copy_to_user((void __user *)arg, &v4l2_audioout, \
 -                                      sizeof(struct v4l2_audioout))) {
 -              mutex_unlock(&easycap_dongle[kd].mutex_video);
 -              return -EFAULT;
 -      }
 -      break;
 -}
  /* - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - */
 -case VIDIOC_QUERYCTRL: {
 -      int i1;
 -      struct v4l2_queryctrl v4l2_queryctrl;
 +      case VIDIOC_ENUMAUDOUT: {
 +              struct v4l2_audioout v4l2_audioout;
  
 -      JOM(8, "VIDIOC_QUERYCTRL\n");
 +              JOM(8, "VIDIOC_ENUMAUDOUT\n");
  
 -      if (0 != copy_from_user(&v4l2_queryctrl, (void __user *)arg, \
 -                                      sizeof(struct v4l2_queryctrl))) {
 -              mutex_unlock(&easycap_dongle[kd].mutex_video);
 -              return -EFAULT;
 -      }
 +              if (copy_from_user(&v4l2_audioout, (void __user *)arg,
 +                                      sizeof(struct v4l2_audioout))) {
 +                      mutex_unlock(&easycapdc60_dongle[kd].mutex_video);
 +                      return -EFAULT;
 +              }
  
 -      i1 = 0;
 -      while (0xFFFFFFFF != easycap_control[i1].id) {
 -              if (easycap_control[i1].id == v4l2_queryctrl.id) {
 -                      JOM(8, "VIDIOC_QUERYCTRL  %s=easycap_control[%i]" \
 -                              ".name\n", &easycap_control[i1].name[0], i1);
 -                      memcpy(&v4l2_queryctrl, &easycap_control[i1], \
 -                                              sizeof(struct v4l2_queryctrl));
 -                      break;
 +              if (0 != v4l2_audioout.index) {
 +                      mutex_unlock(&easycapdc60_dongle[kd].mutex_video);
 +                      return -EINVAL;
                }
 -              i1++;
 -      }
 -      if (0xFFFFFFFF == easycap_control[i1].id) {
 -              JOM(8, "%i=index: exhausts controls\n", i1);
 -              mutex_unlock(&easycap_dongle[kd].mutex_video);
 -              return -EINVAL;
 -      }
 -      if (0 != copy_to_user((void __user *)arg, &v4l2_queryctrl, \
 -                                      sizeof(struct v4l2_queryctrl))) {
 -              mutex_unlock(&easycap_dongle[kd].mutex_video);
 -              return -EFAULT;
 -      }
 -      break;
 -}
 -/* - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - */
 -case VIDIOC_QUERYMENU: {
 -      JOM(8, "VIDIOC_QUERYMENU unsupported\n");
 -      mutex_unlock(&easycap_dongle[kd].mutex_video);
 -      return -EINVAL;
 -}
 -/* - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - */
 -case VIDIOC_G_CTRL: {
 -      struct v4l2_control *pv4l2_control;
 -
 -      JOM(8, "VIDIOC_G_CTRL\n");
 -      pv4l2_control = kzalloc(sizeof(struct v4l2_control), GFP_KERNEL);
 -      if (!pv4l2_control) {
 -              SAM("ERROR: out of memory\n");
 -              mutex_unlock(&easycap_dongle[kd].mutex_video);
 -              return -ENOMEM;
 -      }
 -      if (0 != copy_from_user(pv4l2_control, (void __user *)arg, \
 -                                      sizeof(struct v4l2_control))) {
 -              kfree(pv4l2_control);
 -              mutex_unlock(&easycap_dongle[kd].mutex_video);
 -              return -EFAULT;
 -      }
 +              memset(&v4l2_audioout, 0, sizeof(struct v4l2_audioout));
 +              v4l2_audioout.index = 0;
 +              strcpy(&v4l2_audioout.name[0], "Soundtrack");
  
 -      switch (pv4l2_control->id) {
 -      case V4L2_CID_BRIGHTNESS: {
 -              pv4l2_control->value = peasycap->brightness;
 -              JOM(8, "user enquires brightness: %i\n", pv4l2_control->value);
 -              break;
 -      }
 -      case V4L2_CID_CONTRAST: {
 -              pv4l2_control->value = peasycap->contrast;
 -              JOM(8, "user enquires contrast: %i\n", pv4l2_control->value);
 -              break;
 -      }
 -      case V4L2_CID_SATURATION: {
 -              pv4l2_control->value = peasycap->saturation;
 -              JOM(8, "user enquires saturation: %i\n", pv4l2_control->value);
 -              break;
 -      }
 -      case V4L2_CID_HUE: {
 -              pv4l2_control->value = peasycap->hue;
 -              JOM(8, "user enquires hue: %i\n", pv4l2_control->value);
 -              break;
 -      }
 -      case V4L2_CID_AUDIO_VOLUME: {
 -              pv4l2_control->value = peasycap->volume;
 -              JOM(8, "user enquires volume: %i\n", pv4l2_control->value);
 -              break;
 -      }
 -      case V4L2_CID_AUDIO_MUTE: {
 -              if (1 == peasycap->mute)
 -                      pv4l2_control->value = true;
 -              else
 -                      pv4l2_control->value = false;
 -              JOM(8, "user enquires mute: %i\n", pv4l2_control->value);
 +              if (copy_to_user((void __user *)arg, &v4l2_audioout,
 +                              sizeof(struct v4l2_audioout))) {
 +                      mutex_unlock(&easycapdc60_dongle[kd].mutex_video);
 +                      return -EFAULT;
 +              }
                break;
        }
 -      default: {
 -              SAM("ERROR: unknown V4L2 control: 0x%08X=id\n", \
 -                                                      pv4l2_control->id);
 -              kfree(pv4l2_control);
 -              mutex_unlock(&easycap_dongle[kd].mutex_video);
 -              return -EINVAL;
 -      }
 -      }
 -      if (0 != copy_to_user((void __user *)arg, pv4l2_control, \
 -                                      sizeof(struct v4l2_control))) {
 -              kfree(pv4l2_control);
 -              mutex_unlock(&easycap_dongle[kd].mutex_video);
 -              return -EFAULT;
 -      }
 -      kfree(pv4l2_control);
 -      break;
 -}
  /* - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - */
 -case VIDIOC_S_CTRL:
 -      {
 -      struct v4l2_control v4l2_control;
 -
 -      JOM(8, "VIDIOC_S_CTRL\n");
 +      case VIDIOC_QUERYCTRL: {
 +              int i1;
 +              struct v4l2_queryctrl v4l2_queryctrl;
  
 -      if (0 != copy_from_user(&v4l2_control, (void __user *)arg, \
 -                                      sizeof(struct v4l2_control))) {
 -              mutex_unlock(&easycap_dongle[kd].mutex_video);
 -              return -EFAULT;
 -      }
 -
 -      switch (v4l2_control.id) {
 -      case V4L2_CID_BRIGHTNESS: {
 -              JOM(8, "user requests brightness %i\n", v4l2_control.value);
 -              if (0 != adjust_brightness(peasycap, v4l2_control.value))
 -                      ;
 -              break;
 -      }
 -      case V4L2_CID_CONTRAST: {
 -              JOM(8, "user requests contrast %i\n", v4l2_control.value);
 -              if (0 != adjust_contrast(peasycap, v4l2_control.value))
 -                      ;
 -              break;
 -      }
 -      case V4L2_CID_SATURATION: {
 -              JOM(8, "user requests saturation %i\n", v4l2_control.value);
 -              if (0 != adjust_saturation(peasycap, v4l2_control.value))
 -                      ;
 -              break;
 -      }
 -      case V4L2_CID_HUE: {
 -              JOM(8, "user requests hue %i\n", v4l2_control.value);
 -              if (0 != adjust_hue(peasycap, v4l2_control.value))
 -                      ;
 -              break;
 -      }
 -      case V4L2_CID_AUDIO_VOLUME: {
 -              JOM(8, "user requests volume %i\n", v4l2_control.value);
 -              if (0 != adjust_volume(peasycap, v4l2_control.value))
 -                      ;
 -              break;
 -      }
 -      case V4L2_CID_AUDIO_MUTE: {
 -              int mute;
 +              JOM(8, "VIDIOC_QUERYCTRL\n");
  
 -              JOM(8, "user requests mute %i\n", v4l2_control.value);
 -              if (true == v4l2_control.value)
 -                      mute = 1;
 -              else
 -                      mute = 0;
 +              if (0 != copy_from_user(&v4l2_queryctrl, (void __user *)arg,
 +                              sizeof(struct v4l2_queryctrl))) {
 +                      mutex_unlock(&easycapdc60_dongle[kd].mutex_video);
 +                      return -EFAULT;
 +              }
  
 -              if (0 != adjust_mute(peasycap, mute))
 -                      SAM("WARNING: failed to adjust mute to %i\n", mute);
 +              i1 = 0;
 +              while (0xFFFFFFFF != easycap_control[i1].id) {
 +                      if (easycap_control[i1].id == v4l2_queryctrl.id) {
 +                              JOM(8, "VIDIOC_QUERYCTRL  %s=easycap_control[%i]"
 +                                  ".name\n", &easycap_control[i1].name[0], i1);
 +                              memcpy(&v4l2_queryctrl, &easycap_control[i1],
 +                                     sizeof(struct v4l2_queryctrl));
 +                              break;
 +                      }
 +                      i1++;
 +              }
 +              if (0xFFFFFFFF == easycap_control[i1].id) {
 +                      JOM(8, "%i=index: exhausts controls\n", i1);
 +                      mutex_unlock(&easycapdc60_dongle[kd].mutex_video);
 +                      return -EINVAL;
 +              }
 +              if (copy_to_user((void __user *)arg, &v4l2_queryctrl,
 +                              sizeof(struct v4l2_queryctrl))) {
 +                      mutex_unlock(&easycapdc60_dongle[kd].mutex_video);
 +                      return -EFAULT;
 +              }
                break;
        }
 -      default: {
 -              SAM("ERROR: unknown V4L2 control: 0x%08X=id\n", \
 -                                                      v4l2_control.id);
 -              mutex_unlock(&easycap_dongle[kd].mutex_video);
 +/* - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - */
 +      case VIDIOC_QUERYMENU: {
 +              JOM(8, "VIDIOC_QUERYMENU unsupported\n");
 +              mutex_unlock(&easycapdc60_dongle[kd].mutex_video);
                return -EINVAL;
        }
 -      }
 -      break;
 -}
 -/* - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - */
 -case VIDIOC_S_EXT_CTRLS: {
 -      JOM(8, "VIDIOC_S_EXT_CTRLS unsupported\n");
 -      mutex_unlock(&easycap_dongle[kd].mutex_video);
 -      return -EINVAL;
 -}
  /* - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - */
 -case VIDIOC_ENUM_FMT: {
 -      __u32 index;
 -      struct v4l2_fmtdesc v4l2_fmtdesc;
 -
 -      JOM(8, "VIDIOC_ENUM_FMT\n");
 -
 -      if (0 != copy_from_user(&v4l2_fmtdesc, (void __user *)arg, \
 -                                      sizeof(struct v4l2_fmtdesc))) {
 -              mutex_unlock(&easycap_dongle[kd].mutex_video);
 -              return -EFAULT;
 -      }
 -
 -      index = v4l2_fmtdesc.index;
 -      memset(&v4l2_fmtdesc, 0, sizeof(struct v4l2_fmtdesc));
 -
 -      v4l2_fmtdesc.index = index;
 -      v4l2_fmtdesc.type = V4L2_BUF_TYPE_VIDEO_CAPTURE;
 +      case VIDIOC_G_CTRL: {
 +              struct v4l2_control *pv4l2_control;
 +
 +              JOM(8, "VIDIOC_G_CTRL\n");
 +              pv4l2_control = kzalloc(sizeof(struct v4l2_control), GFP_KERNEL);
 +              if (!pv4l2_control) {
 +                      SAM("ERROR: out of memory\n");
 +                      mutex_unlock(&easycapdc60_dongle[kd].mutex_video);
 +                      return -ENOMEM;
 +              }
 +              if (0 != copy_from_user(pv4l2_control, (void __user *)arg,
 +                              sizeof(struct v4l2_control))) {
 +                      kfree(pv4l2_control);
 +                      mutex_unlock(&easycapdc60_dongle[kd].mutex_video);
 +                      return -EFAULT;
 +              }
  
 -      switch (index) {
 -      case 0: {
 -              v4l2_fmtdesc.flags = 0;
 -              strcpy(&v4l2_fmtdesc.description[0], "uyvy");
 -              v4l2_fmtdesc.pixelformat = V4L2_PIX_FMT_UYVY;
 -              JOM(8, "%i=index: %s\n", index, &v4l2_fmtdesc.description[0]);
 -              break;
 -      }
 -      case 1: {
 -              v4l2_fmtdesc.flags = 0;
 -              strcpy(&v4l2_fmtdesc.description[0], "yuy2");
 -              v4l2_fmtdesc.pixelformat = V4L2_PIX_FMT_YUYV;
 -              JOM(8, "%i=index: %s\n", index, &v4l2_fmtdesc.description[0]);
 -              break;
 -      }
 -      case 2: {
 -              v4l2_fmtdesc.flags = 0;
 -              strcpy(&v4l2_fmtdesc.description[0], "rgb24");
 -              v4l2_fmtdesc.pixelformat = V4L2_PIX_FMT_RGB24;
 -              JOM(8, "%i=index: %s\n", index, &v4l2_fmtdesc.description[0]);
 -              break;
 -      }
 -      case 3: {
 -              v4l2_fmtdesc.flags = 0;
 -              strcpy(&v4l2_fmtdesc.description[0], "rgb32");
 -              v4l2_fmtdesc.pixelformat = V4L2_PIX_FMT_RGB32;
 -              JOM(8, "%i=index: %s\n", index, &v4l2_fmtdesc.description[0]);
 -              break;
 -      }
 -      case 4: {
 -              v4l2_fmtdesc.flags = 0;
 -              strcpy(&v4l2_fmtdesc.description[0], "bgr24");
 -              v4l2_fmtdesc.pixelformat = V4L2_PIX_FMT_BGR24;
 -              JOM(8, "%i=index: %s\n", index, &v4l2_fmtdesc.description[0]);
 -              break;
 -      }
 -      case 5: {
 -              v4l2_fmtdesc.flags = 0;
 -              strcpy(&v4l2_fmtdesc.description[0], "bgr32");
 -              v4l2_fmtdesc.pixelformat = V4L2_PIX_FMT_BGR32;
 -              JOM(8, "%i=index: %s\n", index, &v4l2_fmtdesc.description[0]);
 +              switch (pv4l2_control->id) {
 +              case V4L2_CID_BRIGHTNESS: {
 +                      pv4l2_control->value = peasycap->brightness;
 +                      JOM(8, "user enquires brightness: %i\n", pv4l2_control->value);
 +                      break;
 +              }
 +              case V4L2_CID_CONTRAST: {
 +                      pv4l2_control->value = peasycap->contrast;
 +                      JOM(8, "user enquires contrast: %i\n", pv4l2_control->value);
 +                      break;
 +              }
 +              case V4L2_CID_SATURATION: {
 +                      pv4l2_control->value = peasycap->saturation;
 +                      JOM(8, "user enquires saturation: %i\n", pv4l2_control->value);
 +                      break;
 +              }
 +              case V4L2_CID_HUE: {
 +                      pv4l2_control->value = peasycap->hue;
 +                      JOM(8, "user enquires hue: %i\n", pv4l2_control->value);
 +                      break;
 +              }
 +              case V4L2_CID_AUDIO_VOLUME: {
 +                      pv4l2_control->value = peasycap->volume;
 +                      JOM(8, "user enquires volume: %i\n", pv4l2_control->value);
 +                      break;
 +              }
 +              case V4L2_CID_AUDIO_MUTE: {
 +                      if (1 == peasycap->mute)
 +                              pv4l2_control->value = true;
 +                      else
 +                              pv4l2_control->value = false;
 +                      JOM(8, "user enquires mute: %i\n", pv4l2_control->value);
 +                      break;
 +              }
 +              default: {
 +                      SAM("ERROR: unknown V4L2 control: 0x%08X=id\n",
 +                          pv4l2_control->id);
 +                      kfree(pv4l2_control);
 +                      mutex_unlock(&easycapdc60_dongle[kd].mutex_video);
 +                      return -EINVAL;
 +              }
 +              }
 +              if (copy_to_user((void __user *)arg, pv4l2_control,
 +                              sizeof(struct v4l2_control))) {
 +                      kfree(pv4l2_control);
 +                      mutex_unlock(&easycapdc60_dongle[kd].mutex_video);
 +                      return -EFAULT;
 +              }
 +              kfree(pv4l2_control);
                break;
        }
 -      default: {
 -              JOM(8, "%i=index: exhausts formats\n", index);
 -              mutex_unlock(&easycap_dongle[kd].mutex_video);
 -              return -EINVAL;
 -      }
 -      }
 -      if (0 != copy_to_user((void __user *)arg, &v4l2_fmtdesc, \
 -                                      sizeof(struct v4l2_fmtdesc))) {
 -              mutex_unlock(&easycap_dongle[kd].mutex_video);
 -              return -EFAULT;
 -      }
 -      break;
 -}
 -/* - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - */
 -/*
 - *  THE RESPONSE TO VIDIOC_ENUM_FRAMESIZES MUST BE CONDITIONED ON THE
 - *  THE CURRENT STANDARD, BECAUSE THAT IS WHAT gstreamer EXPECTS.  BEWARE.
 -*/
  /* - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - */
-       case VIDIOC_S_CTRL:
-       {
 -case VIDIOC_ENUM_FRAMESIZES: {
 -      __u32 index;
 -      struct v4l2_frmsizeenum v4l2_frmsizeenum;
 -
 -      JOM(8, "VIDIOC_ENUM_FRAMESIZES\n");
 -
 -      if (0 != copy_from_user(&v4l2_frmsizeenum, (void __user *)arg, \
 -                                      sizeof(struct v4l2_frmsizeenum))) {
 -              mutex_unlock(&easycap_dongle[kd].mutex_video);
 -              return -EFAULT;
 -      }
++      case VIDIOC_S_CTRL: {
 +              struct v4l2_control v4l2_control;
  
 -      index = v4l2_frmsizeenum.index;
 +              JOM(8, "VIDIOC_S_CTRL\n");
  
 -      v4l2_frmsizeenum.type = (__u32) V4L2_FRMSIZE_TYPE_DISCRETE;
 +              if (0 != copy_from_user(&v4l2_control, (void __user *)arg,
 +                              sizeof(struct v4l2_control))) {
 +                      mutex_unlock(&easycapdc60_dongle[kd].mutex_video);
 +                      return -EFAULT;
 +              }
  
 -      if (true == peasycap->ntsc) {
 -              switch (index) {
 -              case 0: {
 -                      v4l2_frmsizeenum.discrete.width = 640;
 -                      v4l2_frmsizeenum.discrete.height = 480;
 -                      JOM(8, "%i=index: %ix%i\n", index, \
 -                                      (int)(v4l2_frmsizeenum.\
 -                                               discrete.width), \
 -                                      (int)(v4l2_frmsizeenum.\
 -                                              discrete.height));
 +              switch (v4l2_control.id) {
 +              case V4L2_CID_BRIGHTNESS: {
 +                      JOM(8, "user requests brightness %i\n", v4l2_control.value);
 +                      if (0 != adjust_brightness(peasycap, v4l2_control.value))
 +                              ;
                        break;
                }
 -              case 1: {
 -                      v4l2_frmsizeenum.discrete.width = 320;
 -                      v4l2_frmsizeenum.discrete.height = 240;
 -                      JOM(8, "%i=index: %ix%i\n", index, \
 -                                      (int)(v4l2_frmsizeenum.\
 -                                              discrete.width), \
 -                                      (int)(v4l2_frmsizeenum.\
 -                                              discrete.height));
 +              case V4L2_CID_CONTRAST: {
 +                      JOM(8, "user requests contrast %i\n", v4l2_control.value);
 +                      if (0 != adjust_contrast(peasycap, v4l2_control.value))
 +                              ;
                        break;
                }
 -              case 2: {
 -                      v4l2_frmsizeenum.discrete.width = 720;
 -                      v4l2_frmsizeenum.discrete.height = 480;
 -                      JOM(8, "%i=index: %ix%i\n", index, \
 -                                      (int)(v4l2_frmsizeenum.\
 -                                              discrete.width), \
 -                                      (int)(v4l2_frmsizeenum.\
 -                                              discrete.height));
 +              case V4L2_CID_SATURATION: {
 +                      JOM(8, "user requests saturation %i\n", v4l2_control.value);
 +                      if (0 != adjust_saturation(peasycap, v4l2_control.value))
 +                              ;
                        break;
                }
 -              case 3: {
 -                      v4l2_frmsizeenum.discrete.width = 360;
 -                      v4l2_frmsizeenum.discrete.height = 240;
 -                      JOM(8, "%i=index: %ix%i\n", index, \
 -                                      (int)(v4l2_frmsizeenum.\
 -                                              discrete.width), \
 -                                      (int)(v4l2_frmsizeenum.\
 -                                              discrete.height));
 +              case V4L2_CID_HUE: {
 +                      JOM(8, "user requests hue %i\n", v4l2_control.value);
 +                      if (0 != adjust_hue(peasycap, v4l2_control.value))
 +                              ;
 +                      break;
 +              }
 +              case V4L2_CID_AUDIO_VOLUME: {
 +                      JOM(8, "user requests volume %i\n", v4l2_control.value);
 +                      if (0 != adjust_volume(peasycap, v4l2_control.value))
 +                              ;
 +                      break;
 +              }
 +              case V4L2_CID_AUDIO_MUTE: {
 +                      int mute;
 +
 +                      JOM(8, "user requests mute %i\n", v4l2_control.value);
 +                      if (v4l2_control.value)
 +                              mute = 1;
 +                      else
 +                              mute = 0;
 +
 +                      if (0 != adjust_mute(peasycap, mute))
 +                              SAM("WARNING: failed to adjust mute to %i\n", mute);
                        break;
                }
                default: {
Simple merge
Simple merge
Simple merge