Commit graph

550 commits

Author SHA1 Message Date
Frank Schaefer a062b291af [media] em28xx: remove some obsolete function declarations
Signed-off-by: Frank Schäfer <fschaefer.oss@googlemail.com>
Acked-by: Hans Verkuil <hans.verkuil@cisco.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab@redhat.com>
2013-03-04 14:51:50 -03:00
Frank Schaefer 8f8b113a03 [media] em28xx: add image quality bridge controls
Add the image quality bridge controls contrast, brightness, saturation,
blue balance, red balance and sharpness.
These controls are enabled only if no subdevice provides them.
Tested with the following devices:
"Terratec Cinergy 200 USB"
"Hauppauge HVR-900"
"SilverCrest 1.3MPix webcam"
"Hauppauge WinTV USB2"
"Speedlink VAD Laplace webcam"

Signed-off-by: Frank Schäfer <fschaefer.oss@googlemail.com>
Acked-by: Hans Verkuil <hans.verkuil@cisco.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab@redhat.com>
2013-03-04 14:51:30 -03:00
Frank Schaefer 43a5e08d00 [media] em28xx: introduce #defines for the image quality default settings
The image quality default values will be used in at least two different places
and by using #defines we make sure that they are always consistent.

Signed-off-by: Frank Schäfer <fschaefer.oss@googlemail.com>
Acked-by: Hans Verkuil <hans.verkuil@cisco.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab@redhat.com>
2013-03-04 14:50:31 -03:00
Frank Schaefer 7960205066 [media] em28xx: remove unused ac97 v4l2_ctrl_handler
Signed-off-by: Frank Schäfer <fschaefer.oss@googlemail.com>
Acked-by: Hans Verkuil <hans.verkuil@cisco.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab@redhat.com>
2013-03-04 14:49:56 -03:00
Frank Schaefer 511ffe920b [media] em28xx: remove unused image quality control functions
Signed-off-by: Frank Schäfer <fschaefer.oss@googlemail.com>
Acked-by: Hans Verkuil <hans.verkuil@cisco.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab@redhat.com>
2013-03-04 14:48:58 -03:00
Frank Schaefer 6c3598e641 [media] em28xx: VIDIOC_ENUM_FRAMESIZES: consider the scaler limits when calculating the minimum frame size
Output resolutions <=20% of the input resolution exceed the capabilities of the
scaler.

Signed-off-by: Frank Schäfer <fschaefer.oss@googlemail.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab@redhat.com>
2013-03-04 14:43:23 -03:00
Frank Schaefer b837413835 [media] em28xx: add function scale_to_size()
Signed-off-by: Frank Schäfer <fschaefer.oss@googlemail.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab@redhat.com>
2013-03-04 14:42:30 -03:00
Frank Schaefer 6b09a21cbc [media] em28xx: rename function get_scale() to size_to_scale()
Signed-off-by: Frank Schäfer <fschaefer.oss@googlemail.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab@redhat.com>
2013-03-04 14:41:23 -03:00
Frank Schaefer 8168532712 [media] em28xx: introduce #define for maximum supported scaling values (register 0x30-0x33)
The maximum supported scaling value for registers 0x30+0x31 (horizontal scaling)
and 0x32+0x33 (vertical scaling) is 0x3fff, which corresponds to 20% of the
input frame size.

Signed-off-by: Frank Schäfer <fschaefer.oss@googlemail.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab@redhat.com>
2013-03-04 14:30:18 -03:00
Frank Schaefer 84e902aa05 [media] em28xx: do not claim VBI support if the device is a camera
Avoids registering a VBI device and streaming in VBI-mode if the device is a
camera.

Signed-off-by: Frank Schäfer <fschaefer.oss@googlemail.com>
Acked-by: Hans Verkuil <hans.verkuil@cisco.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab@redhat.com>
2013-03-04 14:26:06 -03:00
Frank Schaefer fff459e36f [media] em28xx: make ioctl VIDIOC_DBG_G_CHIP_IDENT available for radio devices
Signed-off-by: Frank Schäfer <fschaefer.oss@googlemail.com>
Acked-by: Hans Verkuil <hans.verkuil@cisco.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab@redhat.com>
2013-03-04 14:25:10 -03:00
Frank Schaefer 35deba32e4 [media] em28xx: make ioctl VIDIOC_DBG_G_CHIP_IDENT available without CONFIG_VIDEO_ADV_DEBUG selected
VIDIOC_DBG_G_CHIP_IDENT is a "normal" and not an "advanced" debug functionality.

Signed-off-by: Frank Schäfer <fschaefer.oss@googlemail.com>
Acked-by: Hans Verkuil <hans.verkuil@cisco.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab@redhat.com>
2013-03-04 14:24:46 -03:00
Frank Schaefer eb17cee275 [media] em28xx: remove obsolete device state checks from the ioctl functions
v4l2_device_disconnect() is called when the device is disconnected, so that the
v4l2-core rejects all ioctl calls.

Signed-off-by: Frank Schäfer <fschaefer.oss@googlemail.com>
Acked-by: Hans Verkuil <hans.verkuil@cisco.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab@redhat.com>
2013-03-04 14:21:10 -03:00
Frank Schaefer 7a92de6a4c [media] em28xx: VIDIOC_G_TUNER: remove unneeded setting of tuner type
The tuner type is set by the v4l2-core based on the device type.

Signed-off-by: Frank Schäfer <fschaefer.oss@googlemail.com>
Acked-by: Hans Verkuil <hans.verkuil@cisco.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab@redhat.com>
2013-03-04 14:16:46 -03:00
Frank Schaefer aab3461876 [media] em28xx: get rid of duplicate function vidioc_s_fmt_vbi_cap()
vidioc_s_fmt_vbi_cap() is a 100% duplicate of vidioc_g_fmt_vbi_cap() and
therefore can be removed.

Signed-off-by: Frank Schäfer <fschaefer.oss@googlemail.com>
Acked-by: Hans Verkuil <hans.verkuil@cisco.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab@redhat.com>
2013-03-04 14:16:01 -03:00
Frank Schaefer 430101bd8b [media] em28xx: remove ioctl VIDIOC_CROPCAP
The em28xx driver doesn't support the VIDIOC_G_CROP and VIDIOC_S_CROP ioctls,
so VIDIOC_CROPCAP is useless and has the potential to confuse applications,
because it can be interpreted as indicator for cropping support.

Signed-off-by: Frank Schäfer <fschaefer.oss@googlemail.com>
Acked-by: Hans Verkuil <hans.verkuil@cisco.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab@redhat.com>
2013-03-04 14:01:34 -03:00
Frank Schaefer 1fe184a6ac [media] em28xx: make ioctls VIDIOC_G/S_PARM working for VBI devices
With the current code V4L2_BUF_TYPE_VIDEO_CAPTURE is accepted only, but for VBI
devices only buffer type V4L2_BUF_TYPE_VBI_CAPTURE is used/valid.

Signed-off-by: Frank Schäfer <fschaefer.oss@googlemail.com>
Acked-by: Hans Verkuil <hans.verkuil@cisco.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab@redhat.com>
2013-03-04 14:00:28 -03:00
Frank Schaefer 83c8bcce06 [media] em28xx: disable ioctl VIDIOC_S_PARM for VBI devices
VIDIOC_S_PARM doesn't make sense for VBI device nodes, because we don't support
selecting the number of read buffers to use.

Signed-off-by: Frank Schäfer <fschaefer.oss@googlemail.com>
Acked-by: Hans Verkuil <hans.verkuil@cisco.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab@redhat.com>
2013-03-04 13:40:09 -03:00
Frank Schaefer 3bc85cce36 [media] em28xx: use v4l2_disable_ioctl() to disable ioctl VIDIOC_S_PARM
Instead of checking the device type and returning -ENOTTY inside the ioctl
function, use v4l2_disable_ioctl() to disable the ioctl VIDIOC_S_PARM if the
device is not a camera.

Signed-off-by: Frank Schäfer <fschaefer.oss@googlemail.com>
Acked-by: Hans Verkuil <hans.verkuil@cisco.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab@redhat.com>
2013-03-04 13:39:47 -03:00
Frank Schaefer c2dcef835e [media] em28xx: use v4l2_disable_ioctl() to disable ioctls VIDIOC_G_AUDIO and VIDIOC_S_AUDIO
Instead of checking the device type and returning -EINVAL inside the ioctl
functions, use v4l2_disable_ioctl() to disable the ioctls VIDIOC_G_AUDIO and
VIDIOC_S_AUDIO if the device doesn't support audio.

Signed-off-by: Frank Schäfer <fschaefer.oss@googlemail.com>
Acked-by: Hans Verkuil <hans.verkuil@cisco.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab@redhat.com>
2013-03-04 13:39:11 -03:00
Frank Schaefer 66df67b764 [media] em28xx: disable tuner related ioctls for video and VBI devices without tuner
Disable the ioctls VIDIOC_G_TUNER, VIDIOC_S_TUNER, VIDIOC_G_FREQUENCY and
VIDIOC_S_FREQUENCY for video and VBI devices without tuner.

Signed-off-by: Frank Schäfer <fschaefer.oss@googlemail.com>
Acked-by: Hans Verkuil <hans.verkuil@cisco.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab@redhat.com>
2013-03-04 13:36:40 -03:00
Frank Schaefer 6e46daba56 [media] em28xx: use v4l2_disable_ioctl() to disable ioctls VIDIOC_QUERYSTD, VIDIOC_G/S_STD
Instead of checking the device type and returning -ENOTTY inside the ioctl
functions, use v4l2_disable_ioctl() to disable the ioctls VIDIOC_QUERYSTD,
VIDIOC_G_STD and VIDIOC_S_STD if the device is a camera.

Signed-off-by: Frank Schäfer <fschaefer.oss@googlemail.com>
Acked-by: Hans Verkuil <hans.verkuil@cisco.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab@redhat.com>
2013-03-04 13:36:02 -03:00
Linus Torvalds 21fbd5809a Merge branch 'v4l_for_linus' of git://git.kernel.org/pub/scm/linux/kernel/git/mchehab/linux-media
Pull media updates from Mauro Carvalho Chehab:

 - Some cleanups at V4L2 documentation

 - new drivers: ts2020 frontend, ov9650 sensor, s5c73m3 sensor,
   sh-mobile veu mem2mem driver, radio-ma901, davinci_vpfe staging
   driver

 - Lots of missing MAINTAINERS entries added

 - several em28xx driver improvements, including its conversion to
   videobuf2

 - several fixups on drivers to make them to better comply with the API

 - DVB core: add support for DVBv5 stats, allowing the implementation of
   statistics for new standards like ISDB

 - mb86a20s: add statistics to the driver

 - lots of new board additions, cleanups, and driver improvements.

* 'v4l_for_linus' of git://git.kernel.org/pub/scm/linux/kernel/git/mchehab/linux-media: (596 commits)
  [media] media: Add 0x3009 USB PID to ttusb2 driver (fixed diff)
  [media] rtl28xxu: Add USB IDs for Compro VideoMate U620F
  [media] em28xx: add usb id for terratec h5 rev. 3
  [media] media: rc: gpio-ir-recv: add support for device tree parsing
  [media] mceusb: move check earlier to make smatch happy
  [media] radio-si470x doc: add info about v4l2-ctl and sox+alsa
  [media] staging: media: Remove unnecessary OOM messages
  [media] sh_vou: Use vou_dev instead of vou_file wherever possible
  [media] sh_vou: Use video_drvdata()
  [media] drivers/media/platform/soc_camera/pxa_camera.c: use devm_ functions
  [media] mt9t112: mt9t111 format set up differs from mt9t112
  [media] sh-mobile-ceu-camera: fix SHARPNESS control default
  Revert "[media] fc0011: Return early, if the frequency is already tuned"
  [media] cx18/ivtv: fix regression: remove __init from a non-init function
  [media] em28xx: fix analog streaming with USB bulk transfers
  [media] stv0900: remove unnecessary null pointer check
  [media] fc0011: Return early, if the frequency is already tuned
  [media] fc0011: Add some sanity checks and cleanups
  [media] fc0011: Fix xin value clamping
  Revert "[media] [PATH,1/2] mxl5007 move reset to attach"
  ...
2013-02-24 17:35:10 -08:00
Christoph Nuscheler ed72d37a33 [media] media: Add 0x3009 USB PID to ttusb2 driver (fixed diff)
The "Technisat SkyStar USB plus" is a TT-connect S-2400 clone, which the
V4L-DVB drivers already support. However, some of these devices (like
mine) come with a different USB PID 0x3009 instead of 0x3006.

There have already been patches simply overwriting the USB PID in
dvb-usb-ids.h. Of course these patches were rejected because they would
have disabled the 0x3006 PID.

This new patch adds the 0x3009 PID to dvb-usb-ids.h, and adds references
to it within the ttusb2.c driver. PID 0x3006 devices will continue to work.

The only difference between the two hardware models seems to be the
EEPROM chip. In fact, Windows BDA driver names the 0x3009 device with a
"(8 kB EEPROM)" suffix. In spite of that, the 0x3009 device works
absolutely flawlessly using the existing ttusb2 driver.

Signed-off-by: Christoph Nuscheler <christoph.nuscheler@t-online.de>
Signed-off-by: Mauro Carvalho Chehab <mchehab@redhat.com>
2013-02-13 18:05:29 -02:00
Alistair Buxton b9e2afff1e [media] rtl28xxu: Add USB IDs for Compro VideoMate U620F
Signed-off-by: Alistair Buxton <a.j.buxton@gmail.com>
Acked-by: Antti Palosaari <crope@iki.fi>
Signed-off-by: Mauro Carvalho Chehab <mchehab@redhat.com>
2013-02-13 17:58:54 -02:00
Roland Scheidegger 676fa7d4c9 [media] em28xx: add usb id for terratec h5 rev. 3
Seems to work just the same as older revisions.

Signed-off-by: Roland Scheidegger <rscheidegger_lists@hispeed.ch>
Signed-off-by: Mauro Carvalho Chehab <mchehab@redhat.com>
2013-02-13 17:41:49 -02:00
Frank Schaefer 33f6984ece [media] em28xx: fix analog streaming with USB bulk transfers
With the conversion to videobuf2, some unnecessary calls of
em28xx_set_alternate() have been removed. It is now called at analog streaming
start only.
This has unveiled a bug that causes USB bulk transfers to fail with all urbs
having status -EVOERFLOW.
The reason is, that for bulk transfers usb_set_interface() needs to be called
even if the previous alt setting was the same (side note: bulk transfers seem
to work only with alt=0).
While it seems to be NOT necessary for isoc transfers, it's reasonable to just
call usb_set_interface() unconditionally in em28xx_set_alternate().
Also add a comment that explains the issue to prevent regressions in the future.

Cc: stable@vger.kernel.org # for 3.8
Signed-off-by: Frank Schäfer <fschaefer.oss@googlemail.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab@redhat.com>
2013-02-11 18:17:44 -02:00
Hans Verkuil 82f0efbcd3 [media] tm6000: fix an uninitialized variable
tm6000_poll could use an uninitialized buf pointer. Move the buf-handling
code inside the 'if' that initializes the buf pointer.

Signed-off-by: Hans Verkuil <hans.verkuil@cisco.com>
Reported-by: Dan Carpenter <dan.carpenter@oracle.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab@redhat.com>
2013-02-08 17:30:53 -02:00
Dan Carpenter bf5bbed15c [media] dvb-usb: check for invalid length in ttusb_process_muxpack()
This patch is driven by a static checker warning.
The ttusb_process_muxpack() function is only called from
ttusb_process_frame().  Before calling, it verifies that len >= 2.  The
problem is that len == 2 is not valid and would lead to an array
underflow.
Odd number values for len are also invalid and would lead to reading
past the end of the array.

Signed-off-by: Dan Carpenter <dan.carpenter@oracle.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab@redhat.com>
2013-02-08 17:29:52 -02:00
Hans Verkuil e6066dba44 [media] [REVIEW] em28xx: fix bytesperline calculation in TRY_FMT
The bytesperline calculation was incorrect: it used the old width instead of
the provided width. Fixed.

Signed-off-by: Hans Verkuil <hans.verkuil@cisco.com>
Acked-by: Frank Schäfer <fschaefer.oss@googlemail.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab@redhat.com>
2013-02-08 17:26:24 -02:00
Matti Kurkela da92c29340 [media] ttusb2: Kconfig patch to auto-select frontends for TechnoTrend CT-3650
The ttusb2 module is already updated to recognize the TechnoTrend CT-3650
CI DVB C/T USB2.0 receiver in addition to the Pinnacle 400e. But if
MEDIA_SUBDRV_AUTOSELECT is used, the required tuner and demodulator
modules are not automatically selected. Here's a patch to fix that and add a
note of the CT-3650 to the online help of the ttusb2 module.
This patch applies cleanly to 3.7.6 and other 3.7.x kernels.

Signed-off-by: Mauro Carvalho Chehab <mchehab@redhat.com>
2013-02-08 15:44:33 -02:00
Dan Carpenter 88b404c435 [media] tm6000: check an allocation for failure
This allocation had no error checking.  It didn't need to be under
the mutex so I moved it out form there. That makes the error handling
easier and is a potential speed up.

Signed-off-by: Dan Carpenter <dan.carpenter@oracle.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab@redhat.com>
2013-02-08 14:46:56 -02:00
Frank Schaefer ddf289f98b [media] em28xx: overhaul em28xx_capture_area_set()
- move the bit shifting of width+height values inside the function
- fix the debug message format and output values
- add comment about the size limit (e.g. EM277x supports >2MPix)
- make void, because error checking is incomplete and we never check the
  returned value (we would continue anyway)

Signed-off-by: Frank Schäfer <fschaefer.oss@googlemail.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab@redhat.com>
2013-02-06 14:20:12 -02:00
Laurent Pinchart 05c79d0d1d [media] uvcvideo: Implement videobuf2 .wait_prepare and .wait_finish operations
Those optional operations are used to release and reacquire the queue
lock when videobuf2 needs to perform operations that sleep for a long
time, such as waiting for a buffer to be complete. Implement them to
avoid blocking qbuf or streamoff calls when a dqbuf is in progress.

Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab@redhat.com>
2013-02-06 09:33:58 -02:00
Peter Senna Tschudin 6a29b8080b [media] [V2,23/24] usb/hdpvr/hdpvr-i2c.c: use IS_ENABLED() macro
replace:
 #if defined(CONFIG_I2C) || \
     defined(CONFIG_I2C_MODULE)
with:
 #if IS_ENABLED(CONFIG_I2C)
This change was made for: CONFIG_I2C

Reported-by: Mauro Carvalho Chehab <mchehab@redhat.com>
Signed-off-by: Peter Senna Tschudin <peter.senna@gmail.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab@redhat.com>
2013-02-06 09:20:41 -02:00
Peter Senna Tschudin 9ecf9b085a [media] [V2,22/24] usb/hdpvr/hdpvr-core.c: use IS_ENABLED() macro
replace:
 #if defined(CONFIG_I2C) || \
     defined(CONFIG_I2C_MODULE)
with:
 #if IS_ENABLED(CONFIG_I2C)
This change was made for: CONFIG_I2C

Reported-by: Mauro Carvalho Chehab <mchehab@redhat.com>
Signed-off-by: Peter Senna Tschudin <peter.senna@gmail.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab@redhat.com>
2013-02-06 09:20:24 -02:00
Mauro Carvalho Chehab f85ed0ceeb Revert "[media] drivers/media/usb/dvb-usb/dib0700_core.c: fix left shift"
On Wed, 6 Feb 2013 09:04:39 +0000
Olivier GRENIE <olivier.grenie@parrot.com> wrote:

> I do not agree with the patch. Let's take an example: adap->id = 0. Then:
> 	* 1 << ~(adap->id) = 1 << ~(0) = 0
> 	* ~(1 << adap->id) = ~(1 << 0) = 0xFE
>
> The correct change should be: st->channel_state |= 1 << (1 - adap->id); Indeed, the original source code was not correct.

Requested-by: Olivier GRENIE <olivier.grenie@parrot.com>
Cc: Patrick Boettcher <patrick.boettcher@dibcom.fr>
Cc: Nickolai Zeldovich <nickolai@csail.mit.edu>
Signed-off-by: Mauro Carvalho Chehab <mchehab@redhat.com>
2013-02-06 08:31:55 -02:00
Eddi De Pieri 09f9408dc3 [media] Support Digivox Mini HD (rtl2832)
Add support for Digivox Mini HD (rtl2832)
The tuner works, but with worst performance then realtek linux driver,
due to incomplete implementation of fc2580.c

Signed-off-by: Eddi De Pieri <eddi@depieri.net>
Tested-by: Lorenzo Dongarrà <lorenzo_64@katamail.com>
Acked-by: Antti Palosaari <crope@iki.fi>
Reviewed-by: Antti Palosaari <crope@iki.fi>
Signed-off-by: Mauro Carvalho Chehab <mchehab@redhat.com>
2013-02-06 08:16:08 -02:00
Frank Schaefer 9b4539bebb [media] em28xx: input: use common work_struct callback function for IR RC key polling
Remove em28xx_i2c_ir_work() and check the device type in the common callback
function em28xx_ir_work() instead. Simplifies em28xx_ir_start().
Reduces the code size with a minor performance drawback.

Signed-off-by: Frank Schäfer <fschaefer.oss@googlemail.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab@redhat.com>
2013-02-05 20:43:16 -02:00
Frank Schaefer 1d968cdaae [media] em28xx: i2c RC devices: minor code size and memory usage optimization
Set up the i2c_client locally in em28xx_i2c_ir_handle_key().

Signed-off-by: Frank Schäfer <fschaefer.oss@googlemail.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab@redhat.com>
2013-02-05 20:42:34 -02:00
Frank Schaefer 450c7dd65b [media] em28xx: fix a comment and a small coding style issue
Signed-off-by: Frank Schäfer <fschaefer.oss@googlemail.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab@redhat.com>
2013-02-05 20:40:02 -02:00
Frank Schaefer 146b7ee638 [media] em28xx: remove unused parameter ir_raw from i2c RC key polling functions
Signed-off-by: Frank Schäfer <fschaefer.oss@googlemail.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab@redhat.com>
2013-02-05 20:39:20 -02:00
Frank Schaefer 768da3dbcf [media] em28xx: get rid of the dependency on module ir-kbd-i2c
We already have the key polling functions and the polling infrastructure in
em28xx-input, so we can easily get rid of the dependency on module ir-kbd-i2c.
For maximum safety, do not touch the key reporting mechanism for those devices.
Code size could be improved further but would have minor peformance impacts.
Tested with device "Terratec Cinergy 200 USB" (EM2800_BOARD_TERRATEC_CINERGY_200)

[mchehab@redhat.com: Fix two checkpatch.pl warnings:
 ERROR: "foo * bar" should be "foo *bar" (line 465)
 WARNING: kfree(NULL) is safe this check is probably not required (line 725)]

Signed-off-by: Frank Schäfer <fschaefer.oss@googlemail.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab@redhat.com>
2013-02-05 20:38:50 -02:00
Frank Schaefer 62ec3f86ff [media] em28xx: remove i2cdprintk() messages
We don't report any key/scan codes or errors inside the key polling functions
for internal IR RC devices, just in the key handling fucntions.
Do the same for external devices.

Signed-off-by: Frank Schäfer <fschaefer.oss@googlemail.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab@redhat.com>
2013-02-05 20:38:48 -02:00
Frank Schaefer 59cf17d843 [media] em28xx-input: remove dead code line from em28xx_get_key_em_haup()
Field 'old' of struct IR_i2c is used nowhere in module ir-kbd-i2c.

Signed-off-by: Frank Schäfer <fschaefer.oss@googlemail.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab@redhat.com>
2013-02-05 20:38:47 -02:00
Frank Schaefer 0b3966e40c [media] em28xx: add missing IR RC slave address to the list of known i2c devices
Signed-off-by: Frank Schäfer <fschaefer.oss@googlemail.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab@redhat.com>
2013-02-05 20:25:23 -02:00
Dan Carpenter f62436a96a [media] cx231xx: add a missing break statement
My static checker complains about the fall through here.  From the
context it looks like we should add a break statement.

Signed-off-by: Dan Carpenter <dan.carpenter@oracle.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab@redhat.com>
2013-02-05 20:22:06 -02:00
Nickolai Zeldovich 7e20f6bfc4 [media] drivers/media/usb/dvb-usb/dib0700_core.c: fix left shift
Fix bug introduced in 7757ddda6f, where
instead of bit-negating the bitmask, the bit position was bit-negated
instead.

Signed-off-by: Nickolai Zeldovich <nickolai@csail.mit.edu>
Cc: Olivier Grenie <olivier.grenie@dibcom.fr>
Cc: Patrick Boettcher <patrick.boettcher@dibcom.fr>
Signed-off-by: Mauro Carvalho Chehab <mchehab@redhat.com>
2013-02-05 19:03:52 -02:00
Hans Verkuil ed57256f6f [media] tm6000: fix G/TRY_FMT
Two fixes:
- the priv field wasn't set to 0.
- only V4L2_FIELD_INTERLACED is supported.

Signed-off-by: Hans Verkuil <hans.verkuil@cisco.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab@redhat.com>
2013-02-05 18:33:27 -02:00
Hans Verkuil 52dec548d4 [media] tm6000: add poll op for radio device node
Signed-off-by: Hans Verkuil <hans.verkuil@cisco.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab@redhat.com>
2013-02-05 18:32:49 -02:00
Hans Verkuil e618578dd8 [media] tm6000: set colorspace field
Signed-off-by: Hans Verkuil <hans.verkuil@cisco.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab@redhat.com>
2013-02-05 18:32:22 -02:00
Hans Verkuil 770056c47f [media] tm6000: add support for control events and prio handling
Signed-off-by: Hans Verkuil <hans.verkuil@cisco.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab@redhat.com>
2013-02-05 18:31:33 -02:00
Hans Verkuil 9f7473592b [media] tm6000: convert to the control framework
Signed-off-by: Hans Verkuil <hans.verkuil@cisco.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab@redhat.com>
2013-02-05 18:30:43 -02:00
Hans Verkuil 2c2a053626 [media] tm6000: fix querycap and input/tuner compliance issues
- add device_caps support
- fix bus_info
- fix numerous tuner-related problems due to incorrect tests
  and setting v4l2_tuner fields to wrong values.
- remove (audio) input support from the radio: it doesn't belong
  there. This also fixed a nasty issue where opening the radio
  would set dev->input to 5 for no good reason. This was never
  set back to a valid TV input after closing the radio device,
  thus leaving it at 5 which is out of bounds of the vinput
  card array.

Signed-off-by: Hans Verkuil <hans.verkuil@cisco.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab@redhat.com>
2013-02-05 18:30:12 -02:00
Hans de Goede f192747955 [media] pwc: Don't return EINVAL when an unsupported pixelformat is requested
Instead chaneg the passed in format to the pwc default pixelformat.

Signed-off-by: Hans de Goede <hdegoede@redhat.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab@redhat.com>
2013-02-05 14:54:47 -02:00
Peter Senna Tschudin 78f968fa26 [media] usb/gspca/zc3xx.c: use IS_ENABLED() macro
replace:
 #if defined(CONFIG_INPUT) || \
     defined(CONFIG_INPUT_MODULE)
with:
 #if IS_ENABLED(CONFIG_INPUT)
This change was made for: CONFIG_INPUT

Reported-by: Mauro Carvalho Chehab <mchehab@redhat.com>
Signed-off-by: Peter Senna Tschudin <peter.senna@gmail.com>
Signed-off-by: Hans de Goede <hdegoede@redhat.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab@redhat.com>
2013-02-05 14:54:43 -02:00
Peter Senna Tschudin e32d6eb865 [media] usb/gspca/xirlink_cit.c: use IS_ENABLED() macro
replace:
 #if defined(CONFIG_INPUT) || \
     defined(CONFIG_INPUT_MODULE)
with:
 #if IS_ENABLED(CONFIG_INPUT)
This change was made for: CONFIG_INPUT

Reported-by: Mauro Carvalho Chehab <mchehab@redhat.com>
Signed-off-by: Peter Senna Tschudin <peter.senna@gmail.com>
Signed-off-by: Hans de Goede <hdegoede@redhat.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab@redhat.com>
2013-02-05 14:54:40 -02:00
Peter Senna Tschudin f8d2687963 [media] usb/gspca/t613.c: use IS_ENABLED() macro
replace:
 #if defined(CONFIG_INPUT) || \
     defined(CONFIG_INPUT_MODULE)
with:
 #if IS_ENABLED(CONFIG_INPUT)
This change was made for: CONFIG_INPUT

Reported-by: Mauro Carvalho Chehab <mchehab@redhat.com>
Signed-off-by: Peter Senna Tschudin <peter.senna@gmail.com>
Signed-off-by: Hans de Goede <hdegoede@redhat.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab@redhat.com>
2013-02-05 14:54:37 -02:00
Peter Senna Tschudin 00ddb70702 [media] usb/gspca/stv06xx/stv06xx.c: use IS_ENABLED() macro
replace:
 #if defined(CONFIG_INPUT) || \
     defined(CONFIG_INPUT_MODULE)
with:
 #if IS_ENABLED(CONFIG_INPUT)
This change was made for: CONFIG_INPUT

Reported-by: Mauro Carvalho Chehab <mchehab@redhat.com>
Signed-off-by: Peter Senna Tschudin <peter.senna@gmail.com>
Signed-off-by: Hans de Goede <hdegoede@redhat.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab@redhat.com>
2013-02-05 14:54:34 -02:00
Peter Senna Tschudin 60d2156378 [media] usb/gspca/spca561.c: use IS_ENABLED() macro
replace:
 #if defined(CONFIG_INPUT) || \
     defined(CONFIG_INPUT_MODULE)
with:
 #if IS_ENABLED(CONFIG_INPUT)
This change was made for: CONFIG_INPUT

Reported-by: Mauro Carvalho Chehab <mchehab@redhat.com>
Signed-off-by: Peter Senna Tschudin <peter.senna@gmail.com>
Signed-off-by: Hans de Goede <hdegoede@redhat.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab@redhat.com>
2013-02-05 14:54:31 -02:00
Peter Senna Tschudin f11ef42e31 [media] usb/gspca/sonixj.c: use IS_ENABLED() macro
replace:
 #if defined(CONFIG_INPUT) || \
     defined(CONFIG_INPUT_MODULE)
with:
 #if IS_ENABLED(CONFIG_INPUT)
This change was made for: CONFIG_INPUT

Reported-by: Mauro Carvalho Chehab <mchehab@redhat.com>
Signed-off-by: Peter Senna Tschudin <peter.senna@gmail.com>
Signed-off-by: Hans de Goede <hdegoede@redhat.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab@redhat.com>
2013-02-05 14:54:27 -02:00
Peter Senna Tschudin f5b6de9cf6 [media] usb/gspca/sonixb.c: use IS_ENABLED() macro
replace:
 #if defined(CONFIG_INPUT) || \
     defined(CONFIG_INPUT_MODULE)
with:
 #if IS_ENABLED(CONFIG_INPUT)
This change was made for: CONFIG_INPUT
Also replaced:
 #if !defined CONFIG_USB_SN9C102 && !defined CONFIG_USB_SN9C102_MODULE
with:
 #if !IS_ENABLED(CONFIG_USB_SN9C102)

Reported-by: Mauro Carvalho Chehab <mchehab@redhat.com>
Signed-off-by: Peter Senna Tschudin <peter.senna@gmail.com>
Signed-off-by: Hans de Goede <hdegoede@redhat.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab@redhat.com>
2013-02-05 14:54:24 -02:00
Peter Senna Tschudin 8099affaa6 [media] usb/gspca/sn9c20x.c: use IS_ENABLED() macro
replace:
 #if defined(CONFIG_INPUT) || \
     defined(CONFIG_INPUT_MODULE)
with:
 #if IS_ENABLED(CONFIG_INPUT)
This change was made for: CONFIG_INPUT

Reported-by: Mauro Carvalho Chehab <mchehab@redhat.com>
Signed-off-by: Peter Senna Tschudin <peter.senna@gmail.com>
Signed-off-by: Hans de Goede <hdegoede@redhat.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab@redhat.com>
2013-02-05 14:54:22 -02:00
Peter Senna Tschudin 5fd30838da [media] usb/gspca/se401.c: use IS_ENABLED() macro
replace:
 #if defined(CONFIG_INPUT) || \
     defined(CONFIG_INPUT_MODULE)
with:
 #if IS_ENABLED(CONFIG_INPUT)
This change was made for: CONFIG_INPUT

Reported-by: Mauro Carvalho Chehab <mchehab@redhat.com>
Signed-off-by: Peter Senna Tschudin <peter.senna@gmail.com>
Signed-off-by: Hans de Goede <hdegoede@redhat.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab@redhat.com>
2013-02-05 14:54:10 -02:00
Peter Senna Tschudin 2d622e9137 [media] usb/gspca/pac7311.c: use IS_ENABLED() macro
replace:
 #if defined(CONFIG_INPUT) || \
     defined(CONFIG_INPUT_MODULE)
with:
 #if IS_ENABLED(CONFIG_INPUT)
This change was made for: CONFIG_INPUT

Reported-by: Mauro Carvalho Chehab <mchehab@redhat.com>
Signed-off-by: Peter Senna Tschudin <peter.senna@gmail.com>
Signed-off-by: Hans de Goede <hdegoede@redhat.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab@redhat.com>
2013-02-05 14:54:07 -02:00
Peter Senna Tschudin ae814c0845 [media] gspca/pac7302.c: use IS_ENABLED() macro
replace:
 #if defined(CONFIG_INPUT) || \
     defined(CONFIG_INPUT_MODULE)
with:
 #if IS_ENABLED(CONFIG_INPUT)
This change was made for: CONFIG_INPUT

Reported-by: Mauro Carvalho Chehab <mchehab@redhat.com>
Signed-off-by: Peter Senna Tschudin <peter.senna@gmail.com>
Signed-off-by: Hans de Goede <hdegoede@redhat.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab@redhat.com>
2013-02-05 14:54:04 -02:00
Peter Senna Tschudin 4f4d178535 [media] usb/gspca/pac207.c: use IS_ENABLED() macro
replace:
 #if defined(CONFIG_INPUT) || \
     defined(CONFIG_INPUT_MODULE)
with:
 #if IS_ENABLED(CONFIG_INPUT)
This change was made for: CONFIG_INPUT

Reported-by: Mauro Carvalho Chehab <mchehab@redhat.com>
Signed-off-by: Peter Senna Tschudin <peter.senna@gmail.com>
Signed-off-by: Hans de Goede <hdegoede@redhat.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab@redhat.com>
2013-02-05 14:53:58 -02:00
Peter Senna Tschudin c4ea799a2b [media] usb/gspca/ov519.c: use IS_ENABLED() macro
replace:
 #if defined(CONFIG_INPUT) || \
     defined(CONFIG_INPUT_MODULE)
with:
 #if IS_ENABLED(CONFIG_INPUT)
This change was made for: CONFIG_INPUT

Reported-by: Mauro Carvalho Chehab <mchehab@redhat.com>
Signed-off-by: Peter Senna Tschudin <peter.senna@gmail.com>
Signed-off-by: Hans de Goede <hdegoede@redhat.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab@redhat.com>
2013-02-05 14:53:54 -02:00
Peter Senna Tschudin 9bc0446331 [media] usb/gspca/konica.c: use IS_ENABLED() macro
replace:
 #if defined(CONFIG_INPUT) || \
     defined(CONFIG_INPUT_MODULE)
with:
 #if IS_ENABLED(CONFIG_INPUT)
This change was made for: CONFIG_INPUT

Reported-by: Mauro Carvalho Chehab <mchehab@redhat.com>
Signed-off-by: Peter Senna Tschudin <peter.senna@gmail.com>
Signed-off-by: Hans de Goede <hdegoede@redhat.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab@redhat.com>
2013-02-05 14:53:48 -02:00
Peter Senna Tschudin 13a00fabe4 [media] usb/gspca: use IS_ENABLED() macro
replace:
 #if defined(CONFIG_INPUT) || \
     defined(CONFIG_INPUT_MODULE)
with:
 #if IS_ENABLED(CONFIG_INPUT)
This change was made for: CONFIG_INPUT

Reported-by: Mauro Carvalho Chehab <mchehab@redhat.com>
Signed-off-by: Peter Senna Tschudin <peter.senna@gmail.com>
Signed-off-by: Hans de Goede <hdegoede@redhat.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab@redhat.com>
2013-02-05 14:53:39 -02:00
Peter Senna Tschudin a3f6ce6345 [media] usb/gspca/cpia1.c: use IS_ENABLED() macro
replace:
 #if defined(CONFIG_INPUT) || \
     defined(CONFIG_INPUT_MODULE)
with:
 #if IS_ENABLED(CONFIG_INPUT)
This change was made for: CONFIG_INPUT

Reported-by: Mauro Carvalho Chehab <mchehab@redhat.com>
Signed-off-by: Peter Senna Tschudin <peter.senna@gmail.com>
Signed-off-by: Hans de Goede <hdegoede@redhat.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab@redhat.com>
2013-02-05 14:53:14 -02:00
Oliver Neukum a82a45f653 [media] uvcvideo: Fix race of open and suspend in error case
Ming Lei reported:
IMO, there is a minor fault in the error handling path of
uvc_status_start() inside uvc_v4l2_open(), and the 'users' count should
have been decreased before usb_autopm_put_interface(). In theory, a [URB
resubmission] warning can be triggered when the device is opened just
between usb_autopm_put_interface() and atomic_dec(&stream->dev->users).
The fix is trivial.

Reported-by: Ming Lei <tom.leiming@gmail.com>
Signed-off-by: Oliver Neukum <oneukum@suse.de>
Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab@redhat.com>
2013-02-05 14:32:21 -02:00
Ezequiel Garcia 8c0d44e250 [media] uvcvideo: Replace memcpy with struct assignment
This kind of memcpy() is error-prone. Its replacement with a struct
assignment is prefered because it's type-safe and much easier to read.

Signed-off-by: Peter Senna Tschudin <peter.senna@gmail.com>
Signed-off-by: Ezequiel Garcia <elezegarcia@gmail.com>
Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab@redhat.com>
2013-02-05 14:31:36 -02:00
Greg Kroah-Hartman 422d26b6ec Merge 3.8-rc5 into driver-core-next
This resolves a gpio driver merge issue pointed out in linux-next.

Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2013-01-25 21:06:30 -08:00
Mauro Carvalho Chehab a32f7d1ad3 Merge branch 'v4l_for_linus' into staging/for_v3.9
* v4l_for_linus: (464 commits)
  [media] uvcvideo: Set error_idx properly for S_EXT_CTRLS failures
  [media] uvcvideo: Cleanup leftovers of partial revert
  [media] uvcvideo: Return -EACCES when trying to set a read-only control
  Linux 3.8-rc3
  mm: reinstante dropped pmd_trans_splitting() check
  cred: Remove tgcred pointer from struct cred
  drm/ttm: fix fence locking in ttm_buffer_object_transfer
  ARM: clps711x: Fix bad merge of clockevents setup
  ARM: highbank: save and restore L2 cache and GIC on suspend
  ARM: highbank: add a power request clear
  ARM: highbank: fix secondary boot and hotplug
  ARM: highbank: fix typos with hignbank in power request functions
  ARM: dts: fix highbank cpu mpidr values
  ARM: dts: add device_type prop to cpu nodes on Calxeda platforms
  drm/prime: drop reference on imported dma-buf come from gem
  xen/netfront: improve truesize tracking
  ARM: mx5: Fix MX53 flexcan2 clock
  ARM: OMAP2+: am33xx-hwmod: Fix wrongly terminated am33xx_usbss_mpu_irqs array
  sctp: fix Kconfig bug in default cookie hmac selection
  EDAC: Cleanup device deregistering path
  ...

Conflicts:
	drivers/media/pci/dm1105/dm1105.c
	drivers/media/platform/soc_camera/mx2_camera.c
2013-01-24 18:49:18 -02:00
Kees Cook e141a48185 drivers/media: remove depends on CONFIG_EXPERIMENTAL
The CONFIG_EXPERIMENTAL config item has not carried much meaning for a
while now and is almost always enabled by default. As agreed during the
Linux kernel summit, remove it from any "depends on" lines in Kconfigs.

CC: Mauro Carvalho Chehab <mchehab@infradead.org>
Signed-off-by: Kees Cook <keescook@chromium.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2013-01-21 14:52:44 -08:00
Kees Cook ba48f1a183 drivers/media/video/pvrusb2: remove depends on CONFIG_EXPERIMENTAL
The CONFIG_EXPERIMENTAL config item has not carried much meaning for a
while now and is almost always enabled by default. As agreed during the
Linux kernel summit, remove it from any "depends on" lines in Kconfigs.

CC: Mike Isely <isely@pobox.com>
CC: Mauro Carvalho Chehab <mchehab@infradead.org>
Signed-off-by: Kees Cook <keescook@chromium.org>
Acked-by: Mauro Carvalho Chehab <mchehab@redhat.com>
Acked-By: Mike Isely <isely@pobox.com>
2013-01-11 11:38:06 -08:00
Laurent Pinchart 68d6f84ba0 [media] uvcvideo: Set error_idx properly for S_EXT_CTRLS failures
The uvc_set_ctrl() calls don't write to the hardware. A failure at that
point thus leaves the device in a clean state, with no control modified.
Set the error_idx field to the count value to reflect that, as per the
V4L2 specification.
TRY_EXT_CTRLS is unchanged and the error_idx field must always be set to
the failed control index in that case.

Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
Acked-by: Hans Verkuil <hans.verkuil@cisco.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab@redhat.com>
2013-01-11 13:30:27 -02:00
Laurent Pinchart 29005c09f4 [media] uvcvideo: Cleanup leftovers of partial revert
Commit ba68c8530a263dc4de440fa10bb20a1c5b9d4ff5 (Partly revert "[media]
uvcvideo: Set error_idx properly for extended controls API failures")
missed two modifications. Clean them up.

Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
Acked-by: Hans Verkuil <hans.verkuil@cisco.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab@redhat.com>
2013-01-11 13:30:14 -02:00
Laurent Pinchart 9bf42300e6 [media] uvcvideo: Return -EACCES when trying to set a read-only control
Commit ba68c8530a263dc4de440fa10bb20a1c5b9d4ff5 (Partly revert "[media]
uvcvideo: Set error_idx properly for extended controls API failures")
also reverted part of commit 30ecb936cb
("uvcvideo: Return -EACCES when trying to access a read/write-only
control") by mistake. Fix it.

Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
Acked-by: Hans Verkuil <hans.verkuil@cisco.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab@redhat.com>
2013-01-11 13:30:01 -02:00
Mauro Carvalho Chehab 734d1ece37 Linux 3.8-rc3
-----BEGIN PGP SIGNATURE-----
 Version: GnuPG v2.0.19 (GNU/Linux)
 
 iQEcBAABAgAGBQJQ7i67AAoJEHm+PkMAQRiGWb4H/jpPGtPKMRNodz3pD6EEvr11
 vUibqULkQk8ZZiFw/y19We2DqfIF8g578B/db55FzE22yQi3whnpxUE2O+x0zSDy
 SeKEDzujVU7TCXflBQ28qDB+P/1u7zLIHhnLltNrx3cqSmzNOmD+482W25UW8YBR
 FgIVDjVWxVc0ZANF0GozajafJvs9DPzxwZo5CRYnxJ/wgnYFMr8QwdILCYW1r75N
 aeojIRcp0s4PHe+SzL1grdTSNdNx/bi5bENmVCzTkOlrXMZbPkYluqJUHjzj8Yt3
 BuE1FPeK1AKudXkOCo4Vgu7W7Yw1jnal33bAXKLkoHuN1dT7HgyZvLZZdl0b3wE=
 =XdP/
 -----END PGP SIGNATURE-----

Merge tag 'v3.8-rc3' into v4l_for_linus

Linux 3.8-rc3

* tag 'v3.8-rc3': (11110 commits)
  Linux 3.8-rc3
  mm: reinstante dropped pmd_trans_splitting() check
  cred: Remove tgcred pointer from struct cred
  drm/ttm: fix fence locking in ttm_buffer_object_transfer
  ARM: clps711x: Fix bad merge of clockevents setup
  ARM: highbank: save and restore L2 cache and GIC on suspend
  ARM: highbank: add a power request clear
  ARM: highbank: fix secondary boot and hotplug
  ARM: highbank: fix typos with hignbank in power request functions
  ARM: dts: fix highbank cpu mpidr values
  ARM: dts: add device_type prop to cpu nodes on Calxeda platforms
  drm/prime: drop reference on imported dma-buf come from gem
  xen/netfront: improve truesize tracking
  ARM: mx5: Fix MX53 flexcan2 clock
  ARM: OMAP2+: am33xx-hwmod: Fix wrongly terminated am33xx_usbss_mpu_irqs array
  sctp: fix Kconfig bug in default cookie hmac selection
  EDAC: Cleanup device deregistering path
  EDAC: Fix EDAC Kconfig menu
  EDAC: Fix kernel panic on module unloading
  ALSA: hda - add mute LED for HP Pavilion 17 (Realtek codec)
  ...
2013-01-11 13:28:19 -02:00
Frank Schaefer 5e8d02bb34 [media] em28xx: fix audio input for TV mode of device Terratec Cinergy 250
Remy Blank reported that audio over USB can be made working for the television
input if .amux is changed from EM28XX_AMUX_LINE_IN to EM28XX_AMUX_VIDEO.
An examination of his devices shows, that it is indeed supplied with an EM202
AC97 audio IC. We also use this setting for the Cinergy 200.
Remy Blank also provided the original version of this patch (many thanks !).
Fixes bug 14126 (see bug report for further device details).

Signed-off-by: Frank Schäfer <fschaefer.oss@googlemail.com>
Signed-off-by: Remy Blank <remy.blank@pobox.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab@redhat.com>
2013-01-06 10:45:53 -02:00
Jiri Slaby a96fbe0429 [media] dib0700: do not lock interruptible on tear-down paths
When mutex_lock_interruptible is used on paths where a signal can be
pending, the device is not closed properly and cannot be reused.
This usually happens when you start tzap for example and send it a
TERM signal. The signal is pending while tear-down routines are
called. Hence streaming is not properly stopped in that case. And
the device stops working from that moment on.

Signed-off-by: Jiri Slaby <jslaby@suse.cz>
Signed-off-by: Mauro Carvalho Chehab <mchehab@redhat.com>
2013-01-06 10:42:33 -02:00
Antti Palosaari 9db15638e1 [media] rtl28xxu: correct some device names
Signed-off-by: Antti Palosaari <crope@iki.fi>
Signed-off-by: Mauro Carvalho Chehab <mchehab@redhat.com>
2013-01-06 10:26:31 -02:00
Alexander Inyukhin 78a5e70919 [media] rtl28xxu: add Gigabyte U7300 DVB-T Dongle
Device with ID 1b80:d393 is the Gigabyte U7300 DVB-T dongle.
It contains decoder Realtek RTL2832U and tuner Fitipower FC0012.

[crope@iki.fi: fix trivial merge conflict]
Signed-off-by: Alexander Inyukhin <shurick@sectorb.msk.ru>
Signed-off-by: Antti Palosaari <crope@iki.fi>

Signed-off-by: Mauro Carvalho Chehab <mchehab@redhat.com>
2013-01-06 10:26:15 -02:00
Antti Palosaari 3971e79a87 [media] rtl28xxu: [1b80:d3a8] ASUS My Cinema-U3100Mini Plus V2
RF-tuner is Fitipower FC0013

Reported-by: Renato Gallo <renatogallo@unixproducts.com>
Signed-off-by: Antti Palosaari <crope@iki.fi>
Signed-off-by: Mauro Carvalho Chehab <mchehab@redhat.com>
2013-01-06 10:25:43 -02:00
Antti Palosaari 37b44a0f04 [media] dvb_usb_v2: use IS_ENABLED() macro
replace:
 #if defined(CONFIG_RC_CORE) || defined(CONFIG_RC_CORE_MODULE)
with:
 #if IS_ENABLED(CONFIG_RC_CORE)

Reported-by: Fabio Estevam <festevam@gmail.com>
Signed-off-by: Antti Palosaari <crope@iki.fi>
Signed-off-by: Mauro Carvalho Chehab <mchehab@redhat.com>
2013-01-06 10:20:13 -02:00
Antti Palosaari ac1c86c857 [media] dvb_usb_v2: change rc polling active/deactive logic
Use own flag to mark when rc polling is active/deactive and make
decisions, like start/stop polling on suspend/resume, against that.

Signed-off-by: Antti Palosaari <crope@iki.fi>
Signed-off-by: Mauro Carvalho Chehab <mchehab@redhat.com>
2013-01-06 10:20:03 -02:00
Antti Palosaari ef3824029d [media] dvb_usb_v2: use dummy function defines instead stub functions
I think it is better (cheaper) to use dummy defines for functions
that has no meaning when remote controller is disabled by Kconfig.

Signed-off-by: Antti Palosaari <crope@iki.fi>
Signed-off-by: Mauro Carvalho Chehab <mchehab@redhat.com>
2013-01-06 10:19:55 -02:00
Antti Palosaari 21354c6de3 [media] dvb_usb_v2: remove rc-core stub implementations
Those are not needed anymore as all dvb-usb-v2 drivers has proper
dependency checks for RC-core.

Signed-off-by: Antti Palosaari <crope@iki.fi>
Signed-off-by: Mauro Carvalho Chehab <mchehab@redhat.com>
2013-01-06 10:18:24 -02:00
Antti Palosaari 21ca203036 [media] it913x: remove unused define and increase module version
Signed-off-by: Antti Palosaari <crope@iki.fi>
Acked-by: Malcolm Priestley <tvboxspy@gmail.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab@redhat.com>
2013-01-06 10:18:11 -02:00
Antti Palosaari b963c2083a [media] it913x: make remote controller optional
Do not compile remote controller when RC-core is disabled by Kconfig.

Signed-off-by: Antti Palosaari <crope@iki.fi>
Signed-off-by: Mauro Carvalho Chehab <mchehab@redhat.com>
2013-01-06 10:17:36 -02:00
Antti Palosaari 7b75322af1 [media] az6007: make remote controller optional
Do not compile remote controller when RC-core is disabled by Kconfig.

Signed-off-by: Antti Palosaari <crope@iki.fi>
Acked-by: Mauro Carvalho Chehab <mchehab@redhat.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab@redhat.com>
2013-01-06 10:17:26 -02:00
Antti Palosaari eed5670a31 [media] af9035: make remote controller optional
Do not compile remote controller when RC-core is disabled by Kconfig.

Signed-off-by: Antti Palosaari <crope@iki.fi>
Signed-off-by: Mauro Carvalho Chehab <mchehab@redhat.com>
2013-01-06 10:17:18 -02:00
Antti Palosaari b6215596b5 [media] af9015: make remote controller optional
Do not compile remote controller when RC-core is disabled by Kconfig.

Signed-off-by: Antti Palosaari <crope@iki.fi>
Signed-off-by: Mauro Carvalho Chehab <mchehab@redhat.com>
2013-01-06 10:16:59 -02:00
Antti Palosaari d5c6209068 [media] anysee: make remote controller optional
Do not compile remote controller when RC-core is disabled by Kconfig.

Signed-off-by: Antti Palosaari <crope@iki.fi>
Signed-off-by: Mauro Carvalho Chehab <mchehab@redhat.com>
2013-01-06 10:16:50 -02:00
Antti Palosaari cedda37015 [media] rtl28xxu: make remote controller optional
Do not compile remote controller when RC-core is disabled by Kconfig.

Signed-off-by: Antti Palosaari <crope@iki.fi>
Signed-off-by: Mauro Carvalho Chehab <mchehab@redhat.com>
2013-01-06 10:15:30 -02:00
Antti Palosaari 0c87c66aa3 [media] dvb_usb_v2: make remote controller optional
Make it possible to compile dvb_usb_v2 driver without the remote
controller (RC-core).

Signed-off-by: Antti Palosaari <crope@iki.fi>
Signed-off-by: Mauro Carvalho Chehab <mchehab@redhat.com>
2013-01-06 10:15:07 -02:00
Antti Palosaari ff4e3fe86f [media] af9035: print warning when firmware is bad
Signed-off-by: Antti Palosaari <crope@iki.fi>
Signed-off-by: Mauro Carvalho Chehab <mchehab@redhat.com>
2013-01-06 09:10:34 -02:00
Antti Palosaari 3a98477200 [media] fc0012: use config directly from the config struct
No need to copy config to the driver state. Those are coming from
the const struct and could be used directly.

Signed-off-by: Antti Palosaari <crope@iki.fi>
Acked-by: Hans-Frieder Vogt <hfvogt@gmx.net>
Signed-off-by: Mauro Carvalho Chehab <mchehab@redhat.com>
2013-01-06 09:07:28 -02:00
Antti Palosaari 0bb3d8ac87 [media] af9035: add support for fc0012 dual tuner configuration
That adds support for AF9035 dual devices having FC0012 tuners.

Signed-off-by: Antti Palosaari <crope@iki.fi>
Signed-off-by: Mauro Carvalho Chehab <mchehab@redhat.com>
2013-01-06 09:06:59 -02:00
Antti Palosaari ad3a758bb3 [media] fc0012: use struct for driver config
I need even more configuration options and overloading dvb_attach()
for all those sounds quite stupid. Due to that switch struct and make
room for new options.

Signed-off-by: Antti Palosaari <crope@iki.fi>
Acked-by: Hans-Frieder Vogt <hfvogt@gmx.net>
Signed-off-by: Mauro Carvalho Chehab <mchehab@redhat.com>
2013-01-06 09:04:57 -02:00
Antti Palosaari bf97b6373b [media] af9035: dual mode related changes
Various small changes and fixes releated to dual mode.

Signed-off-by: Antti Palosaari <crope@iki.fi>
Signed-off-by: Mauro Carvalho Chehab <mchehab@redhat.com>
2013-01-06 09:04:17 -02:00
Jose Alberto Reguero 9805992ffc [media] af9035: dual mode support
Adds initial support for af9035 dual mode designs.

Signed-off-by: Jose Alberto Reguero <jareguero@telefonica.net>
[crope@iki.fi: fix merge conflict]
Signed-off-by: Antti Palosaari <crope@iki.fi>

Signed-off-by: Mauro Carvalho Chehab <mchehab@redhat.com>
2013-01-06 09:03:00 -02:00
Antti Palosaari 7e0bc29603 [media] af9035: support for Fitipower FC0012 tuner devices
Signed-off-by: Antti Palosaari <crope@iki.fi>
Signed-off-by: Mauro Carvalho Chehab <mchehab@redhat.com>
2013-01-06 09:00:26 -02:00
Mauro Carvalho Chehab ef85cd9cd5 [media] em28xx: enable DMABUF
Now that it uses videobuf2, em28xx can support DMABUF.

Tested with an HVR-950 on analog mode and a 2gen i5core machine
with an i915 graphics adapter.

Signed-off-by: Mauro Carvalho Chehab <mchehab@redhat.com>
2013-01-06 00:34:22 -02:00
Mauro Carvalho Chehab 3a799c27b3 [media] em28xx: declare em28xx_stop_streaming as static
That fixes the following warning:
	drivers/media/usb/em28xx/em28xx-video.c:611:5: warning: no previous prototype for 'em28xx_stop_streaming' [-Wmissing-prototypes]

Signed-off-by: Mauro Carvalho Chehab <mchehab@redhat.com>
2013-01-05 01:32:18 -02:00
Frank Schaefer 90271964c9 [media] em28xx: consider the message length limitation of the i2c adapter when reading the eeprom
EEPROMs are currently read in blocks of 16 bytes, but the em2800 is limited
to 4 bytes per read. All other chip variants support reading of max. 64 bytes
at once (according to the em258x datasheet; also verified with em2710, em2882,
and em28174).
Since em2800_i2c_recv_bytes() has been fixed to return with -EOPNOTSUPP when
more than 4 bytes are requested, EEPROM reading with this chip is broken.
It was actually broken before that change, too, it just didn't throw an error
because the i2c adapter silently returned trash data (for all reads >1 byte !).

Signed-off-by: Frank Schäfer <fschaefer.oss@googlemail.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab@redhat.com>
2013-01-05 01:19:11 -02:00
Frank Schaefer 45f04e82d0 [media] em28xx: fix+improve+unify i2c error handling, debug messages and code comments
- do not pass USB specific error codes to userspace/i2c-subsystem
- unify the returned error codes and make them compliant with
  the i2c subsystem spec
- check number of actually transferred bytes (via USB) everywehere
- fix/improve debug messages
- improve code comments

Signed-off-by: Frank Schäfer <fschaefer.oss@googlemail.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab@redhat.com>
2013-01-05 01:18:25 -02:00
Frank Schaefer eaf33c404c [media] em28xx: fix the i2c adapter functionality flags
I2C_FUNC_SMBUS_EMUL includes flag I2C_FUNC_SMBUS_WRITE_BLOCK_DATA which signals
that up to 31 data bytes can be written to the ic2 client.
But the EM2800 supports only i2c messages with max. 4 data bytes.
I2C_FUNC_IC2 should be set if a master_xfer function pointer is provided in
struct i2c_algorithm.

Signed-off-by: Frank Schäfer <fschaefer.oss@googlemail.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab@redhat.com>
2013-01-05 01:16:54 -02:00
Frank Schaefer 2fcc82d883 [media] em28xx: fix two severe bugs in function em2800_i2c_recv_bytes()
Function em2800_i2c_recv_bytes() has 2 severe bugs:
1) It does not wait for the i2c read to complete before reading the received message content from the bridge registers.
2) Reading more than 1 byte doesn't work
The former can result in data corruption, the latter always does.
The rewritten code also superseds the content of function
em2800_i2c_check_for_device().
Tested with device "Terratec Cinergy 200 USB".

[mchehab@redhat.com: Fix CodingStyle issues]
Signed-off-by: Frank Schäfer <fschaefer.oss@googlemail.com>

Signed-off-by: Mauro Carvalho Chehab <mchehab@redhat.com>
2013-01-05 01:16:01 -02:00
Frank Schaefer f5ae371aca [media] em28xx: respect the message size constraints for i2c transfers
The em2800 can transfer up to 4 bytes per i2c message.
All other em25xx/em27xx/28xx chips can transfer at least 64 bytes per message.
I2C adapters should never split messages transferred via the I2C subsystem
into multiple message transfers, because the result will almost always NOT be
the same as when the whole data is transferred to the I2C client in a single
message.
If the message size exceeds the capabilities of the I2C adapter, -EOPNOTSUPP
should be returned.

Signed-off-by: Frank Schäfer <fschaefer.oss@googlemail.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab@redhat.com>
2013-01-05 01:13:29 -02:00
Frank Schaefer 6ea887efad [media] em28xx: IR RC: move assignment of get_key functions from *_change_protocol() functions to em28xx_ir_init()
The get_key functions are independent from the selected protocol, so assign
them once only at device initialization.

[mchehab@redhat.com: fix a merge conflict]
Signed-off-by: Frank Schäfer <fschaefer.oss@googlemail.com>

Signed-off-by: Mauro Carvalho Chehab <mchehab@redhat.com>
2013-01-05 01:12:11 -02:00
Frank Schaefer 05fe2175cf [media] em28xx: refactor the code in em28xx_usb_disconnect()
The main purpose of this patch is to move the call of em28xx_release_resources()
after the call of em28xx_close_extension().
This is necessary, because some resources might be needed/used by the extensions
fini() functions when they get closed.
Also mark the device as disconnected earlier in this function and unify the
em28xx_uninit_usb_xfer() calls for analog and digital mode.

Signed-off-by: Frank Schäfer <fschaefer.oss@googlemail.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab@redhat.com>
2013-01-05 01:10:13 -02:00
Frank Schaefer 2665c2995d [media] em28xx: simplify device state tracking
DEV_INITIALIZED of enum em28xx_dev_state state is used nowhere and there is no
need for DEV_MISCONFIGURED, so remove this enum and use a boolean field
'disconnected' in the device struct instead.

Signed-off-by: Frank Schäfer <fschaefer.oss@googlemail.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab@redhat.com>
2013-01-05 01:09:39 -02:00
Devin Heitmueller d3829fadc4 [media] em28xx: convert to videobuf2
This patch converts the em28xx driver over to videobuf2.  It is
likely that em28xx_fh can go away entirely, but that will come in
a separate patch.

[mchehab@redhat.com: fix a non-trivial merge conflict with some VBI
 patches; CodingStyle fixes]

Signed-off-by: Devin Heitmueller <dheitmueller@kernellabs.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab@redhat.com>
2013-01-05 01:03:38 -02:00
Hans Verkuil 2a221d34b6 [media] em28xx: zero vbi_format reserved array and add try_vbi_fmt
Signed-off-by: Hans Verkuil <hans.verkuil@cisco.com>
Signed-off-by: Devin Heitmueller <dheitmueller@kernellabs.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab@redhat.com>
2013-01-05 00:58:44 -02:00
Hans Verkuil 1d179eeedc [media] em28xx: remove sliced VBI support
The sliced VBI support in the tvp5150 is completely broken. And there is no
support for the saa7115 sliced VBI implementation in the em28xx driver. So
we remove the sliced VBI support completely.
It should be possible to get it to work with the tvp5150, but that will
require someone to really dig into that driver.

Signed-off-by: Hans Verkuil <hans.verkuil@cisco.com>
Signed-off-by: Devin Heitmueller <dheitmueller@kernellabs.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab@redhat.com>
2013-01-05 00:57:50 -02:00
Hans Verkuil d8c95c08ef [media] em28xx: std fixes: don't implement in webcam mode, and fix std changes
When in webcam mode the STD API shouldn't be implemented.
When changing the standard the resolution wasn't updated, and there was no
check against streaming-in-progress.

Signed-off-by: Hans Verkuil <hans.verkuil@cisco.com>
Signed-off-by: Devin Heitmueller <dheitmueller@kernellabs.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab@redhat.com>
2013-01-05 00:56:38 -02:00
Hans Verkuil 86ff7f1d4b [media] em28xx: fill in readbuffers and fix incorrect return code
g/s_parm should fill in readbuffers.
For non-webcams s_parm should return -ENOTTY instead of -EINVAL.

Signed-off-by: Hans Verkuil <hans.verkuil@cisco.com>
Signed-off-by: Devin Heitmueller <dheitmueller@kernellabs.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab@redhat.com>
2013-01-05 00:52:36 -02:00
Hans Verkuil 50fdf40f69 [media] em28xx: add support for control events
Signed-off-by: Hans Verkuil <hans.verkuil@cisco.com>
Signed-off-by: Devin Heitmueller <dheitmueller@kernellabs.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab@redhat.com>
2013-01-05 00:51:52 -02:00
Hans Verkuil 69a61642ac [media] em28xx: convert to v4l2_fh, fix priority handling
Signed-off-by: Hans Verkuil <hans.verkuil@cisco.com>
Signed-off-by: Devin Heitmueller <dheitmueller@kernellabs.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab@redhat.com>
2013-01-05 00:51:28 -02:00
Hans Verkuil 081b945ed7 [media] em28xx: convert to the control framework
Signed-off-by: Hans Verkuil <hans.verkuil@cisco.com>
Signed-off-by: Devin Heitmueller <dheitmueller@kernellabs.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab@redhat.com>
2013-01-05 00:51:05 -02:00
Hans Verkuil 20deebfe17 [media] em28xx: fix tuner/frequency handling
v4l2-compliance found problems with frequency clamping that wasn't
reported correctly and missing tuner index checks.
Also removed unnecessary tuner type checks (these are now done by the
v4l2 core).

Signed-off-by: Hans Verkuil <hans.verkuil@cisco.com>
Signed-off-by: Devin Heitmueller <dheitmueller@kernellabs.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab@redhat.com>
2013-01-05 00:47:41 -02:00
Hans Verkuil 319a55fbe4 [media] em28xx: fix VIDIOC_DBG_G_CHIP_IDENT compliance errors
Signed-off-by: Hans Verkuil <hans.verkuil@cisco.com>
Signed-off-by: Devin Heitmueller <dheitmueller@kernellabs.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab@redhat.com>
2013-01-05 00:47:10 -02:00
Hans Verkuil dd5a436322 [media] em28xx: remove bogus input/audio ioctls for the radio device
Radio devices should not implement those ioctls.

Signed-off-by: Hans Verkuil <hans.verkuil@cisco.com>
Signed-off-by: Devin Heitmueller <dheitmueller@kernellabs.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab@redhat.com>
2013-01-05 00:46:50 -02:00
Hans Verkuil a9d79fe581 [media] em28xx: fix querycap
Signed-off-by: Hans Verkuil <hans.verkuil@cisco.com>
Signed-off-by: Devin Heitmueller <dheitmueller@kernellabs.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab@redhat.com>
2013-01-05 00:45:43 -02:00
Mauro Carvalho Chehab 3ac693c40a [media] em28xx: tell ir-kbd-i2c that WinTV uses an RC5 protocol
Signed-off-by: Mauro Carvalho Chehab <mchehab@redhat.com>
2013-01-04 19:13:24 -02:00
Mauro Carvalho Chehab d40580e7c0 [media] em28xx: simplify IR names on I2C devices
The ir-i2c-kbd already adds I2C IR before the name. The way it is,
the devices are named as:
	"i2c IR (i2c IR (EM2840 Hauppaug"
With is ugly and incorrect. After this patch, it is now properly
displayed as:
	"i2c IR (WinTV USB2)"

Signed-off-by: Mauro Carvalho Chehab <mchehab@redhat.com>
2013-01-04 19:13:19 -02:00
Mauro Carvalho Chehab 728f9778e2 [media] em28xx: autoload em28xx-rc if the device has an I2C IR
If the device has an I2C IR, em28xx-rc should be loaded by default,
except if the user explicitly requested to not load, via modprobe
option.

Signed-off-by: Mauro Carvalho Chehab <mchehab@redhat.com>
2013-01-04 19:13:14 -02:00
Mauro Carvalho Chehab 8303dc9952 [media] em28xx: initialize button/I2C IR earlier
The em28xx-input is used by 3 different types of input devices:
	- devices with buttons (like cameras and grabber devices);
	- devices with I2C remotes;
	- em2860 or latter chips with RC support embedded.
When the device has an I2C remote, all it needs to do is to call
the proper I2C driver (ir-i2c-kbd), passing the proper data to
it, and just leave the code.
Also, button devices have its own init code that doesn't depend on
having an IR or not (as a general rule, they don't have).
So, move its init code to fix bugs introduced by earlier patches
that prevent them to work.

Signed-off-by: Mauro Carvalho Chehab <mchehab@redhat.com>
2013-01-04 19:13:07 -02:00
Greg Kroah-Hartman 4c62e9764a Drivers: media: remove __dev* attributes.
CONFIG_HOTPLUG is going away as an option.  As a result, the __dev*
markings need to be removed.

This change removes the use of __devinit, __devexit_p, __devinitdata,
__devinitconst, and __devexit from these drivers.

Based on patches originally written by Bill Pemberton, but redone by me
in order to handle some of the coding style issues better, by hand.

Cc: Bill Pemberton <wfp5p@virginia.edu>
Cc: Mauro Carvalho Chehab <mchehab@redhat.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2013-01-03 15:57:02 -08:00
Malcolm Priestley 71dc98becc [media] lmedm04: correct I2C values to 7 bit addressing
The separation the lmedm04 fails on the ts2020 portion because the correct
I2C addressing.
So, it's time to correct the addressing in the remainder of lmedm04.
Tested all tuners.

Signed-off-by: Malcolm Priestley <tvboxspy@gmail.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab@redhat.com>
2013-01-01 11:05:23 -02:00
Ezequiel Garcia e003ae399c [media] stk1160: Replace BUG_ON with WARN_ON
This situation is not even an error condition so it's stupid to BUG_ON.
Learn the lesson:
http://permalink.gmane.org/gmane.linux.kernel/1347333

Signed-off-by: Ezequiel Garcia <elezegarcia@gmail.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab@redhat.com>
2013-01-01 10:04:40 -02:00
Igor M. Liplianin b858c331cd [media] m88rs2000: make use ts2020
Tuner part of Montage rs2000 chip is similar to ts2020 tuner.
Patch to use ts2020 code.

[mchehab@redhat.com: a few CodingStyle fixes]
Signed-off-by: Igor M. Liplianin <liplianin@me.by>

Signed-off-by: Mauro Carvalho Chehab <mchehab@redhat.com>
2012-12-28 21:37:36 -02:00
Igor M. Liplianin 43385c8a64 [media] ds3000: lock led procedure added
TeVii s660 and others have LED for lock indication.
Let's use it in right order.

Signed-off-by: Igor M. Liplianin <liplianin@me.by>
Signed-off-by: Mauro Carvalho Chehab <mchehab@redhat.com>
2012-12-28 21:30:29 -02:00
Igor M. Liplianin a3e7ad256c [media] dw2102: autoselect DVB_M88RS2000
Patch to select rs2000 module to compile automatically for TeVii
S421 and S632 cards.

Signed-off-by: Igor M. Liplianin <liplianin@me.by>
Signed-off-by: Mauro Carvalho Chehab <mchehab@redhat.com>
2012-12-28 21:29:08 -02:00
Igor M. Liplianin 955d00ac7a [media] TeVii DVB-S s421 and s632 cards support
DVB-S chip is Montage m88rs2000, so initial patch is simple.

Signed-off-by: Igor M. Liplianin <liplianin@me.by>
Signed-off-by: Mauro Carvalho Chehab <mchehab@redhat.com>
2012-12-27 20:23:04 -02:00
Frank Schaefer 7e5d74ee11 [media] em28xx: rename module parameter prefer_bulk to usb_xfer_mode
Since we have now 3 modes (auto/isoc/bulk), usb_xfer_mode is more suitable than prefer_bulk.

Signed-off-by: Frank Schäfer <fschaefer.oss@googlemail.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab@redhat.com>
2012-12-27 19:40:38 -02:00
Konstantin Dimitrov 73f0af44a9 [media] make the other drivers take use of the new ts2020 driver
make the other drivers take use of the separate ts2020 driver

Signed-off-by: Konstantin Dimitrov <kosio.dimitrov@gmail.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab@redhat.com>
2012-12-27 19:27:15 -02:00
Eddi De Pieri 10a5c9148e [media] it913x: add support for Avermedia A835B
Add support for Avermedia A835B and variants.

Signed-off-by: Eddi De Pieri <eddi@depieri.net>
Cc: Malcolm Priestley <tvboxspy@gmail.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab@redhat.com>
2012-12-27 19:13:30 -02:00
Ezequiel Garcia f01e0ffd01 [media] au0828: Replace memcpy with struct assignment
This kind of memcpy() is error-prone. Its replacement with a struct
assignment is prefered because it's type-safe and much easier to read.
Found by coccinelle. Hand patched and reviewed.
Tested by compilation only.
A simplified version of the semantic match that finds this problem is as
follows: (http://coccinelle.lip6.fr/)
// <smpl>
@@
identifier struct_name;
struct struct_name to;
struct struct_name from;
expression E;
@@
-memcpy(&(to), &(from), E);
+to = from;
// </smpl>

Signed-off-by: Peter Senna Tschudin <peter.senna@gmail.com>
Signed-off-by: Ezequiel Garcia <elezegarcia@gmail.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab@redhat.com>
2012-12-27 18:49:44 -02:00
Ezequiel Garcia d3a9509184 [media] dvb-usb/friio-fe: Replace memcpy with struct assignment
This kind of memcpy() is error-prone. Its replacement with a struct
assignment is prefered because it's type-safe and much easier to read.
Found by coccinelle. Hand patched and reviewed.
Tested by compilation only.
A simplified version of the semantic match that finds this problem is as
follows: (http://coccinelle.lip6.fr/)
// <smpl>
@@
identifier struct_name;
struct struct_name to;
struct struct_name from;
expression E;
@@
-memcpy(&(to), &(from), E);
+to = from;
// </smpl>

Signed-off-by: Peter Senna Tschudin <peter.senna@gmail.com>
Signed-off-by: Ezequiel Garcia <elezegarcia@gmail.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab@redhat.com>
2012-12-27 18:48:52 -02:00
Ezequiel Garcia d486b94b26 [media] hdpvr: Replace memcpy with struct assignment
This kind of memcpy() is error-prone. Its replacement with a struct
assignment is prefered because it's type-safe and much easier to read.
Found by coccinelle. Hand patched and reviewed.
Tested by compilation only.
A simplified version of the semantic match that finds this problem is as
follows: (http://coccinelle.lip6.fr/)
// <smpl>
@@
identifier struct_name;
struct struct_name to;
struct struct_name from;
expression E;
@@
-memcpy(&(to), &(from), E);
+to = from;
// </smpl>

Signed-off-by: Peter Senna Tschudin <peter.senna@gmail.com>
Signed-off-by: Ezequiel Garcia <elezegarcia@gmail.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab@redhat.com>
2012-12-27 18:46:08 -02:00
Ezequiel Garcia 5338c16905 [media] pvrusb2: Replace memcpy with struct assignment
This kind of memcpy() is error-prone. Its replacement with a struct
assignment is prefered because it's type-safe and much easier to read.
Found by coccinelle. Hand patched and reviewed.
Tested by compilation only.
A simplified version of the semantic match that finds this problem is as
follows: (http://coccinelle.lip6.fr/)
// <smpl>
@@
identifier struct_name;
struct struct_name to;
struct struct_name from;
expression E;
@@
-memcpy(&(to), &(from), E);
+to = from;
// </smpl>

Signed-off-by: Peter Senna Tschudin <peter.senna@gmail.com>
Signed-off-by: Ezequiel Garcia <elezegarcia@gmail.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab@redhat.com>
2012-12-27 18:45:53 -02:00
Ezequiel Garcia 5c2edefed7 [media] pwc: Replace memcpy with struct assignment
This kind of memcpy() is error-prone. Its replacement with a struct
assignment is prefered because it's type-safe and much easier to read.
Found by coccinelle. Hand patched and reviewed.
Tested by compilation only.
A simplified version of the semantic match that finds this problem is as
follows: (http://coccinelle.lip6.fr/)
// <smpl>
@@
identifier struct_name;
struct struct_name to;
struct struct_name from;
expression E;
@@
-memcpy(&(to), &(from), E);
+to = from;
// </smpl>

Signed-off-by: Peter Senna Tschudin <peter.senna@gmail.com>
Signed-off-by: Ezequiel Garcia <elezegarcia@gmail.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab@redhat.com>
2012-12-27 18:45:04 -02:00
Ezequiel Garcia 5869bb39f8 [media] sn9c102: Replace memcpy with struct assignment
This kind of memcpy() is error-prone. Its replacement with a struct
assignment is prefered because it's type-safe and much easier to read.
Found by coccinelle. Hand patched and reviewed.
Tested by compilation only.
A simplified version of the semantic match that finds this problem is as
follows: (http://coccinelle.lip6.fr/)
// <smpl>
@@
identifier struct_name;
struct struct_name to;
struct struct_name from;
expression E;
@@
-memcpy(&(to), &(from), E);
+to = from;
// </smpl>

Signed-off-by: Peter Senna Tschudin <peter.senna@gmail.com>
Signed-off-by: Ezequiel Garcia <elezegarcia@gmail.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab@redhat.com>
2012-12-27 18:44:46 -02:00
Ezequiel Garcia 8fe392b8fd [media] usbvision: Replace memcpy with struct assignment
This kind of memcpy() is error-prone. Its replacement with a struct
assignment is prefered because it's type-safe and much easier to read.
Found by coccinelle. Hand patched and reviewed.
Tested by compilation only.
A simplified version of the semantic match that finds this problem is as
follows: (http://coccinelle.lip6.fr/)
// <smpl>
@@
identifier struct_name;
struct struct_name to;
struct struct_name from;
expression E;
@@
-memcpy(&(to), &(from), E);
+to = from;
// </smpl>

Signed-off-by: Peter Senna Tschudin <peter.senna@gmail.com>
Signed-off-by: Ezequiel Garcia <elezegarcia@gmail.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab@redhat.com>
2012-12-27 18:44:30 -02:00
Ezequiel Garcia 3724dde9c8 [media] cx231xx: Replace memcpy with struct assignment
This kind of memcpy() is error-prone. Its replacement with a struct
assignment is prefered because it's type-safe and much easier to read.
Found by coccinelle. Hand patched and reviewed.
Tested by compilation only.
A simplified version of the semantic match that finds this problem is as
follows: (http://coccinelle.lip6.fr/)
// <smpl>
@@
identifier struct_name;
struct struct_name to;
struct struct_name from;
expression E;
@@
-memcpy(&(to), &(from), E);
+to = from;
// </smpl>

Signed-off-by: Peter Senna Tschudin <peter.senna@gmail.com>
Signed-off-by: Ezequiel Garcia <elezegarcia@gmail.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab@redhat.com>
2012-12-27 18:44:11 -02:00
Antonio Ospite de8ed820fd [media] m920x: add support for the VP-7049 Twinhan DVB-T USB Stick
This device was originally made by Twinhan/Azurewave[1] and sometimes
named DTV-DVB UDTT7049, it could be also found in Italy under the name
of Digicom Digitune-S[2], or Think Xtra Hollywood DVB-T USB2.0[3].
Components:
  Usb bridge: ULi M9206
  Frontend: MT352CG
  Tuner: MT2060F
The firmware can be downloaded with:
$ ./Documentation/dvb/get_dvb_firmware vp7049
[1] http://www.azurewave.com/Support_Utility_Driver.asp
[2] http://www.digicom.it/digisit/driver_link.nsf/driverprodotto?openform&prodotto=DigiTuneS
[3] http://www.txitalia.it/prodotto.asp?prodotto=txhollywooddvttv

Signed-off-by: Antonio Ospite <ospite@studenti.unina.it>
Signed-off-by: Mauro Carvalho Chehab <mchehab@redhat.com>
2012-12-27 16:36:29 -02:00
Antonio Ospite 68511a7553 [media] m920x: send the RC init sequence also when rc.core is used
Signed-off-by: Antonio Ospite <ospite@studenti.unina.it>
Signed-off-by: Mauro Carvalho Chehab <mchehab@redhat.com>
2012-12-27 16:33:51 -02:00
Mauro Carvalho Chehab 9d5394c2a1 [media] m920x: Fix CodingStyle issues
Fix CodingStyle issues introduced by the last patch

Signed-off-by: Mauro Carvalho Chehab <mchehab@redhat.com>
2012-12-27 16:32:58 -02:00
Antonio Ospite b677757cef [media] m920x: introduce m920x_rc_core_query()
Add an m920x_rc_core_query() function for drivers which want to use the
linux RC core infrastructure.

Signed-off-by: Antonio Ospite <ospite@studenti.unina.it>
Signed-off-by: Mauro Carvalho Chehab <mchehab@redhat.com>
2012-12-27 16:30:48 -02:00
Antonio Ospite 7a7ef4657e [media] m920x: avoid repeating RC state parsing at each keycode
Parsing the RC press state is invariant wrt. the keycode, take it out of
the keycode scanning loop.

Signed-off-by: Antonio Ospite <ospite@studenti.unina.it>
Signed-off-by: Mauro Carvalho Chehab <mchehab@redhat.com>
2012-12-27 16:30:07 -02:00
Antonio Ospite f526e9e1dc [media] m920x: factor out a m920x_parse_rc_state() function
This is in preparation to using RC core infrastructure for some devices,
the RC button state parsing logic can be shared berween rc.legacy and
rc.core callbacks as it is independent from the mechanism used for RC
handling.

Signed-off-by: Antonio Ospite <ospite@studenti.unina.it>
Signed-off-by: Mauro Carvalho Chehab <mchehab@redhat.com>
2012-12-27 16:29:07 -02:00
Antonio Ospite 7543f344e9 [media] m920x: factor out a m920x_write_seq() function
This is in preparation for the vp7049 frontend attach function which is
going to set a sequence of registers as well.

Signed-off-by: Antonio Ospite <ospite@studenti.unina.it>
Signed-off-by: Mauro Carvalho Chehab <mchehab@redhat.com>
2012-12-27 16:28:15 -02:00
Antonio Ospite 9084983495 [media] m920x: fix a typo in a comment
Signed-off-by: Antonio Ospite <ospite@studenti.unina.it>
Signed-off-by: Mauro Carvalho Chehab <mchehab@redhat.com>
2012-12-27 16:27:13 -02:00
Antonio Ospite a214c55121 [media] dvb-usb: fix indentation of a for loop
Signed-off-by: Antonio Ospite <ospite@studenti.unina.it>
Signed-off-by: Mauro Carvalho Chehab <mchehab@redhat.com>
2012-12-27 16:26:13 -02:00
Alf Høgemark 68c97bf39a [media] cx231xx : Add support for Elgato Video Capture V2
This patch adds support for the Elgato Video Capture, version 2, device.
The device is added based on the code for CX231XX_BOARD_HAUPPAUGE_USBLIVE2,
it is simply a copy of the code for that board, with the proper USB device
info for the Elgato Video Capture V2 device.

Signed-off-by: Alf Høgemark <alf@i100.no>
Signed-off-by: Mauro Carvalho Chehab <mchehab@redhat.com>
2012-12-27 14:11:53 -02:00
Malcolm Priestley 341068fcf8 [media] it913x: fix correct endpoint size when pid filter on
I kept the count as the hardware default with dvb-usb-v2, with 5, users
can still run in to trouble with Video PIDs.
I have traced it to an incorrect endpoint size when the PID filter
is enabled. It also affected USB 2.0 with the filter on.

Reported-by: Antti Palosaari <crope@iki.fi>
Tested-by: Antti Palosaari <crope@iki.fi>
Signed-off-by: Malcolm Priestley <tvboxspy@gmail.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab@redhat.com>
2012-12-23 19:48:04 -02:00
Mauro Carvalho Chehab 8b2aea7878 [media] em28xx: prefer bulk mode on webcams
Using bulk mode allows more than one webcam, as the maximum fps
is low at 640x480 resolution. So, prefer it, if the device is
a webcam.

Tested with Silvercrest 1.3 Mpixel webcam (em2710) on both bulk and isoc
modes.

Tested analog with HVR-950 model 65201/A1C0 (em2883), where only ISOC
endpoints are available for both DVB and Analog.

Tested on Hauppauge WinTV USB 2 (em2840) on both bulk and isoc modes.

It should be noticed that enabling bulk mode by default with TV boards
is a bad idea; what happens is that, while with ISOC the USB logic will
prevent the concurrent usage of two devices that spends more than 100%
of the USB2 traffic, it doesn't care with bulk transfers.

On my tests, I started two streams, one with a WinTV at 640x480x30fps
and the other one with a Silvercrest webcam at 640x480, on a lower fps)
both on bulk mode. One of the streams always silently failed.

Signed-off-by: Mauro Carvalho Chehab <mchehab@redhat.com>
2012-12-23 17:24:30 -02:00
Mauro Carvalho Chehab a3efa1cc0e [media] em28xx: make the logs reflect the specific chip name
In order to make easier to analize the logs when multiple devices
are plugged, change the device name accordingly with the chip
version.

Signed-off-by: Mauro Carvalho Chehab <mchehab@redhat.com>
2012-12-23 16:54:34 -02:00
Rafael J. Wysocki 9c016d6109 Partly revert "[media] uvcvideo: Set error_idx properly for extended controls API failures"
Commit f0ed2ce840 ("[media] uvcvideo: Set error_idx properly for
extended controls API failures") causes user space to behave incorrectly
on one of my test machines (there is no sound under KDE 4.9.4 using
pulseaudio and there is a knotify4 process occupying one of the CPU
cores 100% of the time).  Reverting that commit entirely fixes the
problem for me.

However, commit f0ed2ce840 appears to do more than it follows from its
changelog, because the changelog only says about the changes related to
ctrls->error_idx, while the commit additionally changes error codes
returned by various functions in uvc_ctrl.c and uvc_v4l2.c.  It turns
out that the changes of the returned error codes confuse the user spce,
so it is sufficient to revert the part of commit f0ed2ce840 not
mentioned in its changelog to fix the problem.

[ 'ENOENT' is not a valid error return from an ioctl to begin with, and
  I don't understand how anybody ever even thought it would be.  - Linus ]

Signed-off-by: Rafael J. Wysocki <rafael.j.wysocki@intel.com>
Cc: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
Cc: Mauro Carvalho Chehab <mchehab@redhat.com>
Cc: Hans Verkuil <hans.verkuil@cisco.com>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
2012-12-23 09:39:14 -08:00
Mauro Carvalho Chehab aa51496b21 [media] em28xx: display the isoc/bulk mode
As both bulk and isoc modes can be available, display what it
was found for both DVB and analog.

While here, also displays if audio is provided via USB Audio
Class or via vendor's extension.

Signed-off-by: Mauro Carvalho Chehab <mchehab@redhat.com>
2012-12-23 14:35:25 -02:00
Mauro Carvalho Chehab b5cff595bd [media] em28xx: prefer_bulk parameter is read-only
As the bulk mode is set at device's probe, it is not possible
to change it later. So, change the parameter to be read only
after modprobing.

Signed-off-by: Mauro Carvalho Chehab <mchehab@redhat.com>
2012-12-23 13:14:20 -02:00
Frank Schaefer a6bad040da [media] em28xx: clean up the data type mess of the i2c transfer function parameters
Signed-off-by: Frank Schäfer <fschaefer.oss@googlemail.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab@redhat.com>
2012-12-22 21:48:29 -02:00
Frank Schaefer 36016a351d [media] em28xx: clean up and unify functions em28xx_copy_vbi() em28xx_copy_video()
The code in em28xx_vbi_copy can be simplified a lot.
Also rename some variables to something more meaningful and fix+add the
function descriptions.

Signed-off-by: Frank Schäfer <fschaefer.oss@googlemail.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab@redhat.com>
2012-12-22 21:09:45 -02:00
Frank Schaefer 227b7c9067 [media] em28xx: move the em2710/em2750/em28xx specific frame data processing code to a separate function
em28xx_urb_data_copy() actually consists of two parts:
USB urb processing (checks, data extraction) and frame data packet processing.
Move the latter to a separate function and call it from em28xx_urb_data_copy()
for each data packet.
The em25xx, em2760, em2765 (and likely em277x) chip variants are using a
different frame data format, for which support will be added later with
another function.
This reduces the size of em28xx_urb_data_copy() and makes the code much more
readable. While we're at it, clean up the code a bit (rename some variables to
something more meaningful, improve some comments etc.)

Signed-off-by: Frank Schäfer <fschaefer.oss@googlemail.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab@redhat.com>
2012-12-22 20:57:17 -02:00
Frank Schaefer e04c00d985 [media] em28xx: em28xx_urb_data_copy(): move duplicate code for capture_type=0 and capture_type=2 to a function
Reduce code duplication by moving the duplicate code for dev->capture_type=0
(vbi start) and dev->capture_type=2 (video start) to a function.
The same function will also be called by the (not yet existing) em25xx frame
data processing code.

Signed-off-by: Frank Schäfer <fschaefer.oss@googlemail.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab@redhat.com>
2012-12-22 20:55:48 -02:00
Frank Schaefer 4078d625c9 [media] em28xx: move caching of pointer to vmalloc memory in videobuf to struct em28xx_buffer
In the current code em28xx_urb_data_copy() caches the pointer to the vmalloc
memory in videobuf locally.
The alternative would be to call videobuf_to_vmalloc() for each processed USB
data packet (isoc USB transfers => 64 times per URB) in the em28xx_copy_*()
functions.
With the next commits, the data processing code will be split into functions
for serveral reasons:
- em28xx_urb_data_copy() is generally way to long, making it less readable
- there is code duplication between VBI and video data processing
- support for em25xx data processing (uses a different header and frame
  end signaling mechanism) will be added
This would require extensive usage of pointer-pointers, which usually makes the
code less readable and prone to bugs.
The better solution is to cache the pointer in struct em28xx_buffer.
This also improves consistency, because we already track the buffer fill count there.

Signed-off-by: Frank Schäfer <fschaefer.oss@googlemail.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab@redhat.com>
2012-12-22 20:55:01 -02:00
Frank Schaefer a48370158d [media] em28xx: refactor VBI data processing code in em28xx_urb_data_copy()
When a new frame header is detected in em28xx_urb_data_copy() and the data
packet contains both, VBI data and video data, the prevoius VBI buffer doesn't
get finished and is overwritten with the new VBI data.
This bug is not triggered with isochronous USB transfers, because the data
packetes are much smaller than the VBI data size.
But when using USB bulk transfers, the whole data of an URB is treated as
single packet, which is usually much larger then the VBI data size.
Refactor the VBI data processing code to fix this bug, but also to simplify the
code and make it similar to the video data processing code part (which allows
further code abstraction/unification in the future).
The changes have been tested with device "Hauppauge HVR-900".

Signed-off-by: Frank Schäfer <fschaefer.oss@googlemail.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab@redhat.com>
2012-12-22 20:53:43 -02:00
Frank Schaefer 8732533b32 [media] em28xx: move field 'pos' from struct em28xx_dmaqueue to struct em28xx_buffer
This field is used to keep track of the current memory position in the buffer,
not in the dma queue, so move it to right place.
This also allows us to get rid of the struct em28xx_dmaqueue pointer parameter
in functions em28xx_copy_video() and em28xx_copy_vbi().

Signed-off-by: Frank Schäfer <fschaefer.oss@googlemail.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab@redhat.com>
2012-12-22 20:52:28 -02:00
Frank Schaefer cbe7f8a030 [media] em28xx: remove obsolete field 'frame' from struct em28xx_buffer
Signed-off-by: Frank Schäfer <fschaefer.oss@googlemail.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab@redhat.com>
2012-12-22 20:51:19 -02:00
Frank Schaefer 948a49aa69 [media] em28xx: use common function for video and vbi buffer completion
Signed-off-by: Frank Schäfer <fschaefer.oss@googlemail.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab@redhat.com>
2012-12-22 20:50:59 -02:00
Frank Schaefer 24a6d8497f [media] em28xx: refactor get_next_buf() and use it for vbi data, too
get_next_buf() and vbi_get_next_buf() do exactly the same just with a
different dma queue and buffer. Saving the new buffer pointer back to the
device struct in em28xx_urb_data_copy() instead of doing this from inside
these functions makes it possible to get rid of one of them.
Also refactor the function parameters and return type:
- pass a pointer to struct em28xx as parameter (instead of obtaining the
  pointer from the dma queue pointer with the container_of macro) like we do
  it in all other functions
- instead of using a pointer-pointer, return the pointer to the new buffer
  as return value of the function

Signed-off-by: Frank Schäfer <fschaefer.oss@googlemail.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab@redhat.com>
2012-12-22 20:48:57 -02:00
Frank Schaefer 960da93ba5 [media] em28xx: use common urb data copying function for vbi and non-vbi data streams
em28xx_urb_data_copy_vbi() is actually an extended version of
em28xx_urb_data_copy(). With the preceding fixes and improvements, it works
fine with both, vbi and non-vbi data streams without performance impacts.
So rename em28xx_urb_data_copy_vbi() to em28xx_urb_data_copy(), delete the
the old implementation of em28xx_urb_data_copy() and change the code to use
this function for both data stream types.
Tested with "SilverCrest 1.3 MPix webcam" (progressive, non-vbi) and
"Hauppauge HVR-900 (65008/A1C0)" (interlaced, vbi enabled and disabled).

Signed-off-by: Frank Schäfer <fschaefer.oss@googlemail.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab@redhat.com>
2012-12-22 19:17:37 -02:00
Frank Schaefer 79ff8697e9 [media] em28xx: em28xx_urb_data_copy_vbi(): calculate vbi_size only if needed
Signed-off-by: Frank Schäfer <fschaefer.oss@googlemail.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab@redhat.com>
2012-12-22 19:17:18 -02:00
Frank Schaefer 0455eebfbd [media] em28xx: fix capture type setting in em28xx_urb_data_copy_vbi()
Set capture type to 1 (video start) when the video frame start header is
detected. This bug didn't cause any trouble, because this type of header is
never received in vbi mode.
Fix it, because we want to use this function with disabled vbi in the future.
Also start with capture type -1 to avoid processing of corrupted/incomplete
frame data which is usually received at streaming start (especially when
USB bulk transfers are used).

Signed-off-by: Frank Schäfer <fschaefer.oss@googlemail.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab@redhat.com>
2012-12-22 19:16:57 -02:00
Frank Schaefer 3610f58bb1 [media] em28xx: make sure the packet size is >= 4 before checking for headers in em28xx_urb_data_copy_vbi()
Signed-off-by: Frank Schäfer <fschaefer.oss@googlemail.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab@redhat.com>
2012-12-22 19:16:10 -02:00
Frank Schaefer b77e0c088f [media] em28xx: fix video data start position calculation in em28xx_urb_data_copy_vbi()
The header check/removal code at the end of function em28xx_urb_data_copy_vbi()
is obsolete, because this is already done earlier in this function.
In fact it is incomplete (doesn't check for vbi header) and causes trouble
when the first data bytes are the same as header bytes (which is fortunately
very unlikely).

Signed-off-by: Frank Schäfer <fschaefer.oss@googlemail.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab@redhat.com>
2012-12-22 19:02:32 -02:00
Frank Schaefer 454fe92f01 [media] em28xx: add module parameter for selection of the preferred USB transfer type
By default, isoc transfers are used if possible.
With the new module parameter, bulk can be selected as the
preferred USB transfer type.

Signed-off-by: Frank Schäfer <fschaefer.oss@googlemail.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab@redhat.com>
2012-12-22 18:20:03 -02:00
Frank Schaefer c647a91a25 [media] em28xx: improve USB endpoint logic, also use bulk transfers
The current enpoint logic ignores all bulk endpoints and uses
a fixed mapping between endpint addresses and the supported
data stream types (analog/audio/DVB):
  Ep 0x82, isoc	=> analog
  Ep 0x83, isoc	=> audio
  Ep 0x84, isoc	=> DVB
Now that the code can also do bulk transfers, the endpoint
logic has to be extended to also consider bulk endpoints.
The new logic preserves backwards compatibility and reflects
the endpoint configurations we have seen so far:
  Ep 0x82, isoc		=> analog
  Ep 0x82, bulk		=> analog
  Ep 0x83, isoc*	=> audio
  Ep 0x84, isoc		=> digital
  Ep 0x84, bulk		=> analog or digital**
 (*: audio should always be isoc)
 (**: analog, if ep 0x82 is isoc, otherwise digital)

[mchehab@redhat.com: Fix a CodingStyle issue: don't break strings
 into separate lines]

Signed-off-by: Frank Schäfer <fschaefer.oss@googlemail.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab@redhat.com>
2012-12-22 18:17:52 -02:00
Frank Schaefer c8e9d95b41 [media] em28xx: set USB alternate settings for analog video bulk transfers properly
Extend function em28xx_set_alternate:
- use alternate setting 0 for bulk transfers as default
- respect module parameter 'alt'=0 for bulk transfers
- set max_packet_size to 512 bytes for bulk transfers
[mchehab@redhat.com: Fix a CodingStyle issue: don't break strings
 into separate lines]
Signed-off-by: Frank Schäfer <fschaefer.oss@googlemail.com>

Signed-off-by: Mauro Carvalho Chehab <mchehab@redhat.com>
2012-12-22 18:13:11 -02:00
Frank Schaefer 7312f2c9fa [media] em28xx: add fields for analog and DVB USB transfer type selection to struct em28xx
Signed-off-by: Frank Schäfer <fschaefer.oss@googlemail.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab@redhat.com>
2012-12-22 18:11:42 -02:00
Frank Schaefer 0cf544a6cc [media] em28xx: rename some USB parameter fields in struct em28xx to clarify their role
Also improve the comments.

Signed-off-by: Frank Schäfer <fschaefer.oss@googlemail.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab@redhat.com>
2012-12-22 18:11:26 -02:00
Frank Schaefer a950e4a75e [media] em28xx: rename function em28xx_dvb_isoc_copy and extend for USB bulk transfers
The URB data processing for DVB bulk transfers is very similar to
what is done with isoc transfers, so create a common function that
works with both transfer types based on the existing isoc function.
Tested with device Hauppauge HVR-930c.

Signed-off-by: Frank Schäfer <fschaefer.oss@googlemail.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab@redhat.com>
2012-12-22 18:04:50 -02:00
Frank Schaefer 4601cc3977 [media] em28xx: rename function em28xx_isoc_copy_vbi and extend for USB bulk transfers
The URB data processing for bulk transfers is very similar to what
is done with isoc transfers, so create a common function that works
with both transfer types based on the existing isoc function.

[mchehab@redhat.com: Fix a CodingStyle issue: don't break strings
 into separate lines]

Signed-off-by: Frank Schäfer <fschaefer.oss@googlemail.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab@redhat.com>
2012-12-22 18:04:28 -02:00
Frank Schaefer 0fa4a40290 [media] em28xx: rename function em28xx_isoc_copy and extend for USB bulk transfers
The URB data processing for bulk transfers is very similar to what
is done with isoc transfers, so create a common function that works
with both transfer types based on the existing isoc function.

[mchehab@redhat.com: Fix a CodingStyle issue: don't break strings
 into separate lines]

Signed-off-by: Frank Schäfer <fschaefer.oss@googlemail.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab@redhat.com>
2012-12-22 18:02:48 -02:00
Frank Schaefer 1653cb0cb2 [media] em28xx: remove double checks for urb->status == -ENOENT in urb_data_copy functions
This check is already done in the URB handler
em28xx_irq_callback before calling these functions.

Signed-off-by: Frank Schäfer <fschaefer.oss@googlemail.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab@redhat.com>
2012-12-22 18:00:59 -02:00
Frank Schaefer 337fe8dad5 [media] em28xx: clear USB halt/stall condition in em28xx_init_usb_xfer when using bulk transfers
[mchehab@redhat.com: Fix a CodingStyle issue: don't break strings
 into separate lines]

Signed-off-by: Frank Schäfer <fschaefer.oss@googlemail.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab@redhat.com>
2012-12-22 18:00:30 -02:00
Frank Schaefer 057ca0da06 [media] em28xx: create a common function for isoc and bulk USB transfer initialization
- rename em28xx_init_isoc to em28xx_init_usb_xfer
- add parameter for isoc/bulk transfer selection which is passed to em28xx_alloc_urbs
- rename local variable isoc_buf to usb_bufs

Signed-off-by: Frank Schäfer <fschaefer.oss@googlemail.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab@redhat.com>
2012-12-22 17:58:14 -02:00
Frank Schaefer 6ddd89d0c9 [media] em28xx: create a common function for isoc and bulk URB allocation and setup
Rename the existing function for isoc transfers em28xx_init_isoc
to em28xx_init_usb_xfer and extend it.
URB allocation and setup is now done depending on the USB
transfer type, which is selected with a new function parameter.

Signed-off-by: Frank Schäfer <fschaefer.oss@googlemail.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab@redhat.com>
2012-12-22 17:58:00 -02:00
Frank Schaefer afb177e065 [media] em28xx: rename function em28xx_uninit_isoc to em28xx_uninit_usb_xfer
This function will be used to uninitialize USB bulk transfers, too.
Also rename the local variable isoc_bufs to usb_bufs.

Signed-off-by: Frank Schäfer <fschaefer.oss@googlemail.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab@redhat.com>
2012-12-22 17:57:41 -02:00
Frank Schaefer 836e93bf6a [media] em28xx: update description of em28xx_irq_callback
em28xx_irq_callback can be used for isoc and bulk transfers.

Signed-off-by: Frank Schäfer <fschaefer.oss@googlemail.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab@redhat.com>
2012-12-22 17:57:27 -02:00
Frank Schaefer 89f84b9c20 [media] em28xx: remove obsolete #define EM28XX_URB_TIMEOUT
It isn't used anymore and uses constants which no longer exist.

Signed-off-by: Frank Schäfer <fschaefer.oss@googlemail.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab@redhat.com>
2012-12-22 17:57:00 -02:00
Frank Schaefer 74209dc06a [media] em28xx: rename struct em28xx_usb_isoc_ctl to em28xx_usb_ctl
Also rename the corresponding field isoc_ctl in struct em28xx
to usb_ctl.
We will use this struct for USB bulk transfers, too.

Signed-off-by: Frank Schäfer <fschaefer.oss@googlemail.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab@redhat.com>
2012-12-22 17:56:49 -02:00
Frank Schaefer f0fa9936f5 [media] em28xx: rename struct em28xx_usb_isoc_bufs to em28xx_usb_bufs
It will be used for USB bulk transfers, too.

Signed-off-by: Frank Schäfer <fschaefer.oss@googlemail.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab@redhat.com>
2012-12-22 17:56:34 -02:00
Frank Schaefer 515688a898 [media] em28xx: rename isoc packet number constants and parameters
Rename EM28XX_NUM_PACKETS to EM28XX_NUM_ISOC_PACKETS and
EM28XX_DVB_MAX_PACKETS to EM28XX_DVB_NUM_ISOC_PACKETS to
clarify that these values are used only for isoc usb transfers.
Also use the term num_packets instead of max_packets, as this
is how these values are used and called in struct urb.

Signed-off-by: Frank Schäfer <fschaefer.oss@googlemail.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab@redhat.com>
2012-12-22 17:56:10 -02:00
Frank Schaefer 8c3015676f [media] em28xx: clarify meaning of field 'progressive' in struct em28xx
Signed-off-by: Frank Schäfer <fschaefer.oss@googlemail.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab@redhat.com>
2012-12-22 17:55:58 -02:00
Frank Schaefer c02ec71b01 [media] em28xx: fix wrong data offset for non-interlaced mode in em28xx_copy_video
em28xx_copy_video uses a wrong offset for the target buffer
when copying the data from an USB isoc packet. This happens
only for the second and all following lines in the packet.
The reason why this bug doesn't cause image corruption with
my test device (SilverCrest Webcam 1.3 MPix) is, that this
device never sends any packets that cross the end of a line.
I don't know if all devices behave like this, so this patch
should be considered for stable.
With the upcoming patches to add support for USB bulk transfers,
em28xx_copy_video will be called once per URB, which will
always trigger this bug.

Signed-off-by: Frank Schäfer <fschaefer.oss@googlemail.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab@redhat.com>
2012-12-22 17:55:34 -02:00