1
0
Fork 0
Commit Graph

1607 Commits (16a8a49be1b878ef6dd5d1663d456e254e54ae3d)

Author SHA1 Message Date
Oliver Neukum 588afcc1c0 [media] usbvision fix overflow of interfaces array
This fixes the crash reported in:
http://seclists.org/bugtraq/2015/Oct/35
The interface number needs a sanity check.

Signed-off-by: Oliver Neukum <oneukum@suse.com>
Cc: Vladis Dronov <vdronov@redhat.com>
Signed-off-by: Hans Verkuil <hans.verkuil@cisco.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab@osg.samsung.com>
2015-11-17 14:56:31 -02:00
Kosuke Tatsukawa 5063452ecb [media] media: fix waitqueue_active without memory barrier in cpia2 driver
cpia2_usb_disconnect() seems to be missing a memory barrier which might
cause the waker to not notice the waiter and miss sending a wake_up as
in the following figure.

	cpia2_usb_disconnect			sync
------------------------------------------------------------------------
					mutex_unlock(&cam->v4l2_lock);
if (waitqueue_active(&cam->wq_stream))
/* The CPU might reorder the test for
   the waitqueue up here, before
   prior writes complete */
					/* wait_event_interruptible */
					 /* __wait_event_interruptible */
					  /* ___wait_event */
					  long __int = prepare_to_wait_event(
					    &wq, &__wait, state);
					  if (!cam->streaming ||
					    frame->status == FRAME_READY)
cam->curbuff->status = FRAME_READY;
cam->curbuff->length = 0;
					  schedule()
------------------------------------------------------------------------

The attached patch removes the call to waitqueue_active() leaving just
wake_up() behind.  This fixes the problem because the call to
spin_lock_irqsave() in wake_up() will be an ACQUIRE operation.

I found this issue when I was looking through the linux source code
for places calling waitqueue_active() before wake_up*(), but without
preceding memory barriers, after sending a patch to fix a similar
issue in drivers/tty/n_tty.c  (Details about the original issue can be
found here: https://lkml.org/lkml/2015/9/28/849).

Signed-off-by: Kosuke Tatsukawa <tatsu@ab.jp.nec.com>
Signed-off-by: Hans Verkuil <hans.verkuil@cisco.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab@osg.samsung.com>
2015-11-17 14:55:06 -02:00
Antonio Ospite dcc7fdbec5 [media] gspca: ov534/topro: prevent a division by 0
v4l2-compliance sends a zeroed struct v4l2_streamparm in
v4l2-test-formats.cpp::testParmType(), and this results in a division by
0 in some gspca subdrivers:

  divide error: 0000 [#1] SMP
  Modules linked in: gspca_ov534 gspca_main ...
  CPU: 0 PID: 17201 Comm: v4l2-compliance Not tainted 4.3.0-rc2-ao2 #1
  Hardware name: System manufacturer System Product Name/M2N-E SLI, BIOS
    ASUS M2N-E SLI ACPI BIOS Revision 1301 09/16/2010
  task: ffff8800818306c0 ti: ffff880095c4c000 task.ti: ffff880095c4c000
  RIP: 0010:[<ffffffffa079bd62>]  [<ffffffffa079bd62>] sd_set_streamparm+0x12/0x60 [gspca_ov534]
  RSP: 0018:ffff880095c4fce8  EFLAGS: 00010296
  RAX: 0000000000000000 RBX: ffff8800c9522000 RCX: ffffffffa077a140
  RDX: 0000000000000000 RSI: ffff880095e0c100 RDI: ffff8800c9522000
  RBP: ffff880095e0c100 R08: ffffffffa077a100 R09: 00000000000000cc
  R10: ffff880067ec7740 R11: 0000000000000016 R12: ffffffffa07bb400
  R13: 0000000000000000 R14: ffff880081b6a800 R15: 0000000000000000
  FS:  00007fda0de78740(0000) GS:ffff88012fc00000(0000) knlGS:0000000000000000
  CS:  0010 DS: 0000 ES: 0000 CR0: 0000000080050033
  CR2: 00000000014630f8 CR3: 00000000cf349000 CR4: 00000000000006f0
  Stack:
   ffffffffa07a6431 ffff8800c9522000 ffffffffa077656e 00000000c0cc5616
   ffff8800c9522000 ffffffffa07a5e20 ffff880095e0c100 0000000000000000
   ffff880067ec7740 ffffffffa077a140 ffff880067ec7740 0000000000000016
  Call Trace:
   [<ffffffffa07a6431>] ? v4l_s_parm+0x21/0x50 [videodev]
   [<ffffffffa077656e>] ? vidioc_s_parm+0x4e/0x60 [gspca_main]
   [<ffffffffa07a5e20>] ? __video_do_ioctl+0x280/0x2f0 [videodev]
   [<ffffffffa07a5ba0>] ? video_ioctl2+0x20/0x20 [videodev]
   [<ffffffffa07a59b9>] ? video_usercopy+0x319/0x4e0 [videodev]
   [<ffffffff81182dc1>] ? page_add_new_anon_rmap+0x71/0xa0
   [<ffffffff811afb92>] ? mem_cgroup_commit_charge+0x52/0x90
   [<ffffffff81179b18>] ? handle_mm_fault+0xc18/0x1680
   [<ffffffffa07a15cc>] ? v4l2_ioctl+0xac/0xd0 [videodev]
   [<ffffffff811c846f>] ? do_vfs_ioctl+0x28f/0x480
   [<ffffffff811c86d4>] ? SyS_ioctl+0x74/0x80
   [<ffffffff8154a8b6>] ? entry_SYSCALL_64_fastpath+0x16/0x75
  Code: c7 93 d9 79 a0 5b 5d e9 f1 f3 9a e0 0f 1f 00 66 2e 0f 1f 84 00
    00 00 00 00 66 66 66 66 90 53 31 d2 48 89 fb 48 83 ec 08 8b 46 10 <f7>
    76 0c 80 bf ac 0c 00 00 00 88 87 4e 0e 00 00 74 09 80 bf 4f
  RIP  [<ffffffffa079bd62>] sd_set_streamparm+0x12/0x60 [gspca_ov534]
   RSP <ffff880095c4fce8>
  ---[ end trace 279710c2c6c72080 ]---

Following what the doc says about a zeroed timeperframe (see
http://www.linuxtv.org/downloads/v4l-dvb-apis/vidioc-g-parm.html):

  ...
  To reset manually applications can just set this field to zero.

fix the issue by resetting the frame rate to a default value in case of
an unusable timeperframe.

The fix is done in the subdrivers instead of gspca.c because only the
subdrivers have notion of a default frame rate to reset the camera to.

Signed-off-by: Antonio Ospite <ao2@ao2.it>
Cc: stable@vger.kernel.org
Reviewed-by: Hans de Goede <hdegoede@redhat.com>
Signed-off-by: Hans Verkuil <hans.verkuil@cisco.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab@osg.samsung.com>
2015-11-17 14:54:25 -02:00
Terry Heo ce3556bde3 [media] cx231xx: fix bulk transfer mode
The current cx231xx driver doesn't work with bulk transfer mode.
This patch makes it possible to use bulk transfer mode.

Signed-off-by: Terry Heo <terryheo@google.com>
Signed-off-by: Hans Verkuil <hans.verkuil@cisco.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab@osg.samsung.com>
2015-11-17 14:53:41 -02:00
Ricardo Ribalda 082afb7c4e [media] media/usb/pvrusb2: Support for V4L2_CTRL_WHICH_DEF_VAL
This driver does not use the control infrastructure.
Add support for the new field which on structure
 v4l2_ext_controls

Acked-by: Mike Isely <isely@pobox.com>
Signed-off-by: Ricardo Ribalda Delgado <ricardo.ribalda@gmail.com>
Signed-off-by: Hans Verkuil <hans.verkuil@cisco.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab@osg.samsung.com>
2015-11-17 14:46:44 -02:00
Ricardo Ribalda 91739838a5 [media] usb/uvc: Support for V4L2_CTRL_WHICH_DEF_VAL
This driver does not use the control infrastructure.
Add support for the new field which on structure
 v4l2_ext_controls

Signed-off-by: Ricardo Ribalda Delgado <ricardo.ribalda@gmail.com>
Acked-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
Signed-off-by: Hans Verkuil <hans.verkuil@cisco.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab@osg.samsung.com>
2015-11-17 14:46:21 -02:00
Hans Verkuil ba463988a0 [media] go7007: fix broken test
The wrong flags field was tested for the GO7007_BOARD_HAS_AUDIO flag: that
flag is in board->main_info.flags, not in board->flags.

Reported-by: Dan Carpenter <dan.carpenter@oracle.com>
Signed-off-by: Hans Verkuil <hans.verkuil@cisco.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab@osg.samsung.com>
2015-11-17 14:33:41 -02:00
Mauro Carvalho Chehab d647f0b70c [media] include/media: move driver interface headers to a separate dir
Let's not mix headers used by the core with those headers that
are needed by some driver-specific interface header.

The headers used on drivers were manually moved using:
    mkdir include/media/drv-intf/
    git mv include/media/cx2341x.h include/media/cx25840.h \
	include/media/exynos-fimc.h include/media/msp3400.h \
	include/media/s3c_camif.h include/media/saa7146.h \
	include/media/saa7146_vv.h  include/media/sh_mobile_ceu.h \
	include/media/sh_mobile_csi2.h include/media/sh_vou.h \
	include/media/si476x.h include/media/soc_mediabus.h \
	include/media/tea575x.h include/media/drv-intf/

And the references for those headers were corrected using:

    MAIN_DIR="media/"
    PREV_DIR="media/"
    DIRS="drv-intf/"

    echo "Checking affected files" >&2
    for i in $DIRS; do
	for j in $(find include/$MAIN_DIR/$i -type f -name '*.h'); do
		 n=`basename $j`
		git grep -l $n
	done
    done|sort|uniq >files && (
	echo "Handling files..." >&2;
	echo "for i in \$(cat files|grep -v Documentation); do cat \$i | \\";
	(
		cd include/$MAIN_DIR;
		for j in $DIRS; do
			for i in $(ls $j); do
				echo "perl -ne 's,(include [\\\"\\<])$PREV_DIR($i)([\\\"\\>]),\1$MAIN_DIR$j\2\3,; print \$_' |\\";
			done;
		done;
		echo "cat > a && mv a \$i; done";
	);
	echo "Handling documentation..." >&2;
	echo "for i in MAINTAINERS \$(cat files); do cat \$i | \\";
	(
		cd include/$MAIN_DIR;
		for j in $DIRS; do
			for i in $(ls $j); do
				echo "  perl -ne 's,include/$PREV_DIR($i)\b,include/$MAIN_DIR$j\1,; print \$_' |\\";
			done;
		done;
		echo "cat > a && mv a \$i; done"
	);
    ) >script && . ./script

Signed-off-by: Mauro Carvalho Chehab <mchehab@osg.samsung.com>
Acked-by: Arnd Bergmann <arnd@arndb.de>
2015-11-17 06:57:29 -02:00
Mauro Carvalho Chehab b5dcee225c [media] include/media: split I2C headers from V4L2 core
Currently, include/media is messy, as it contains both the V4L2 core
headers and some driver-specific headers on the same place. That makes
harder to identify what core headers should be documented and what
headers belong to I2C drivers that are included only by bridge/main
drivers that would require the functions provided by them.

Let's move those i2c specific files to its own subdirectory.

The files to move were produced via the following script:
	mkdir include/media/i2c
	(cd include/media; for i in *.h; do n=`echo $i|sed s/.h$/.c/`; if [ -e ../../drivers/media/i2c/$n ]; then echo $i; git mv $i i2c/; fi; done)
	(cd include/media; for i in *.h; do n=`echo $i|sed s/.h$/.c/`; if [ -e ../../drivers/media/*/i2c/$n ]; then echo $i; git mv $i i2c/; fi; done)
	for i in include/media/*.h; do n=`basename $i`;  (for j in $(git grep -l $n); do dirname $j; done)|sort|uniq|grep -ve '^.$' > list; num=$(wc -l list|cut -d' ' -f1); if [ $num == 1 ]; then if [ "`grep i2c list`" != "" ]; then git mv $i include/media/i2c; fi; fi; done

And the references corrected via this script:
    MAIN_DIR="media/"
    PREV_DIR="media/"
    DIRS="i2c/"

    echo "Checking affected files" >&2
    for i in $DIRS; do
	for j in $(find include/$MAIN_DIR/$i -type f -name '*.h'); do
		 n=`basename $j`
		git grep -l $n
	done
    done|sort|uniq >files && (
	echo "Handling files..." >&2;
	echo "for i in \$(cat files|grep -v Documentation); do cat \$i | \\";
	(
		cd include/$MAIN_DIR;
		for j in $DIRS; do
			for i in $(ls $j); do
				echo "perl -ne 's,(include [\\\"\\<])$PREV_DIR($i)([\\\"\\>]),\1$MAIN_DIR$j\2\3,; print \$_' |\\";
			done;
		done;
		echo "cat > a && mv a \$i; done";
	);
	echo "Handling documentation..." >&2;
	echo "for i in MAINTAINERS \$(cat files); do cat \$i | \\";
	(
		cd include/$MAIN_DIR;
		for j in $DIRS; do
			for i in $(ls $j); do
				echo "  perl -ne 's,include/$PREV_DIR($i)\b,include/$MAIN_DIR$j\1,; print \$_' |\\";
			done;
		done;
		echo "cat > a && mv a \$i; done"
	);
    ) >script && . ./script

Merged Sakari Ailus patch that moves smiapp.h to include/media/i2c.

Signed-off-by: Mauro Carvalho Chehab <mchehab@osg.samsung.com>
Acked-by: Arnd Bergmann <arnd@arndb.de>
2015-11-17 06:57:11 -02:00
Linus Torvalds b037865754 media updates for v4.4-rc1
-----BEGIN PGP SIGNATURE-----
 Version: GnuPG v1
 
 iQIcBAABAgAGBQJWOJZoAAoJEAhfPr2O5OEVmjYP/0RnfVjvRDtx0RxHDmvsowlt
 sHyrm5C7VME06b4J3O9qpC7PbMCAalvSkYp+bbxF+b//9EfwjvRER+NR8ebgn1Mw
 1NQKMtCusWRf4RzI+9osB3pFYgg/cYG2nKl0QVCXHL6xZszEQ9dBrFHEEHfVe8db
 JU1fGuF6TQNJdYgsVNMN9rStRB0vj3urfehLjB+E138VzDAnzPNA7I7Z4xsWWJw3
 V+J7CWLN1xW9IT59LXtRjbD/aCF9KrAmGigS0nCtDz7XVRPh+ZoXQLD073uLP2L3
 uYxOmadvc5+5iVwUP4zSsJ6+vw9kLr6Q30sNtLP7V+VkCSlCQNTOePLavB5T8qVY
 M2qALvwWjujtoSEjZHr7TqrlEpio98OSy1dNJ8GmuOb3UUAKocNN8sGG8h2nR/BR
 wv2OL/XPNcyB2LV6HeHZz9JiXB+rTbyXEN8CP2cD8ruGhNM5haak3d2l4FYszRXr
 /a/5JlYAcNrJii6PAXHyBtm6l0C4GPiAk3HQhII2fTErRr8fpln/G5AfaKjun5H8
 1Rbxx5JP+5qSHozmz2hNb4w92qqtPugj7qqu7sHCbwKLhh2Aspwo12GkN9acOIsI
 Kn1U/DWMRrkyptJAxBihsrEX3BXeQdNOPydKfMYEM7qE8EfTDM0uaIFQ+KVWCmNA
 Qh2TXAp6CZiuBvaqKzyl
 =sR0p
 -----END PGP SIGNATURE-----

Merge tag 'media/v4.4-1' of git://git.kernel.org/pub/scm/linux/kernel/git/mchehab/linux-media

Pull media updates from Mauro Carvalho Chehab:
 "Media updates, including:

   - Lots of improvements at the kABI documentation
   - Split of Videobuf2 into a common part and a V4L2 specific one
   - Split of the VB2 tracing events into a separate header file
   - s5p-mfc got support for Exynos 5433
   - v4l2 fixes for 64-bits alignment when running 32 bits userspace
     on ARM
   - Added support for SDR radio transmitter at core, vivid and hackrf
     drivers
   - Some y2038 fixups
   - Some improvements at V4L2 colorspace support
   - saa7164 converted to use the V4L2 core control framework
   - several new boards additions, cleanups and fixups

  PS: There are two patches for scripts/kernel-doc that are needed by
  the documentation patches on Media.  Jon is OK on merging those via
  my tree"

* tag 'media/v4.4-1' of git://git.kernel.org/pub/scm/linux/kernel/git/mchehab/linux-media: (146 commits)
  [media] c8sectpfe: Remove select on CONFIG_FW_LOADER_USER_HELPER_FALLBACK
  [media] DocBook media: update copyright/version numbers
  [media] ivtv: Convert to get_user_pages_unlocked()
  [media] media/v4l2-ctrls: fix setting autocluster to manual with VIDIOC_S_CTRL
  [media] DocBook media: Fix a typo in encoder cmd
  [media] DocBook: add SDR specific info to G_MODULATOR / S_MODULATOR
  [media] DocBook: add SDR specific info to G_TUNER / S_TUNER
  [media] hackrf: do not set human readable name for formats
  [media] hackrf: add support for transmitter
  [media] hackrf: switch to single function which configures everything
  [media] hackrf: add control for RF amplifier
  [media] DocBook: add modulator type field
  [media] v4l: add type field to v4l2_modulator struct
  [media] DocBook: document SDR transmitter
  [media] v4l2: add support for SDR transmitter
  [media] DocBook: document tuner RF gain control
  [media] v4l2: add RF gain control
  [media] v4l2: rename V4L2_TUNER_ADC to V4L2_TUNER_SDR
  [media] media/vivid-osd: fix info leak in ioctl
  [media] media: videobuf2: Move v4l2-specific stuff to videobuf2-v4l2
  ...
2015-11-05 12:05:15 -08:00
Antti Palosaari d18ca5b7ce [media] rtl28xxu: fix control message flaws
Add lock to prevent concurrent access for control message as control
message function uses shared buffer. Without the lock there may be
remote control polling which messes the buffer causing IO errors.
Increase buffer size and add check for maximum supported message
length.

Link: https://bugzilla.kernel.org/show_bug.cgi?id=103391
Fixes: c56222a6b2 ("[media] rtl28xxu: move usb buffers to state")

Cc: <stable@vger.kernel.org> # 4.0+
Signed-off-by: Antti Palosaari <crope@iki.fi>
2015-10-22 15:48:27 -02:00
Antti Palosaari 36c6326c5c [media] hackrf: do not set human readable name for formats
Format names are set by core nowadays. Remove name from driver.

Signed-off-by: Antti Palosaari <crope@iki.fi>
Signed-off-by: Hans Verkuil <hans.verkuil@cisco.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab@osg.samsung.com>
2015-10-20 15:55:28 -02:00
Antti Palosaari 8bc4a9ed85 [media] hackrf: add support for transmitter
HackRF SDR device has both receiver and transmitter. There is limitation
that receiver and transmitter cannot be used at the same time
(half-duplex operation). That patch implements transmitter support to
existing receiver only driver.

Signed-off-by: Antti Palosaari <crope@iki.fi>
[hans.verkuil@cisco.com: fix krobot unused variable warning]
[hans.verkuil@cisco.com: add back s_modulator from PATCHv4]
Signed-off-by: Hans Verkuil <hans.verkuil@cisco.com>

Signed-off-by: Mauro Carvalho Chehab <mchehab@osg.samsung.com>
2015-10-20 15:55:03 -02:00
Antti Palosaari eec20f0654 [media] hackrf: switch to single function which configures everything
Implement single funtion, hackrf_set_params(), which handles all
needed settings. Controls and other IOCTLs are just wrappers to that
function. That way we can get easily better control what we could do
on different device states - sleeping, receiving, transmitting.

Signed-off-by: Antti Palosaari <crope@iki.fi>
Signed-off-by: Hans Verkuil <hans.verkuil@cisco.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab@osg.samsung.com>
2015-10-20 15:53:49 -02:00
Antti Palosaari b3ae29667e [media] hackrf: add control for RF amplifier
There is Avago MGA-81563 amplifier just right after antenna connector.
It could be turned on/off and its gain is around 12dB.

Signed-off-by: Antti Palosaari <crope@iki.fi>
Signed-off-by: Hans Verkuil <hans.verkuil@cisco.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab@osg.samsung.com>
2015-10-20 15:52:26 -02:00
Junghak Sung 33119e80c3 [media] media: videobuf2: Change queue_setup argument
Replace struct v4l2_format * with void * to make queue_setup()
for common use.
And then, modify all device drivers related with this change.

Signed-off-by: Junghak Sung <jh1009.sung@samsung.com>
Signed-off-by: Geunyoung Kim <nenggun.kim@samsung.com>
Acked-by: Seung-Woo Kim <sw0312.kim@samsung.com>
Acked-by: Inki Dae <inki.dae@samsung.com>
Signed-off-by: Hans Verkuil <hans.verkuil@cisco.com>
[hans.verkuil@cisco.com: fix missing const in fimc-lite.c]

Signed-off-by: Mauro Carvalho Chehab <mchehab@osg.samsung.com>
2015-10-20 14:48:39 -02:00
Mauro Carvalho Chehab 2f684b239c [media] dvb: get rid of enum dmx_success
This enum is not actually used anymore. The only value used from
the enum is DMX_OK, passed as a parameter on two callbacks.

Yet, this value is not used anywhere. So, just remove it.

Signed-off-by: Mauro Carvalho Chehab <mchehab@osg.samsung.com>
2015-10-06 19:53:02 -03:00
Andrzej Hajda e54560d963 [media] cx231xx: fix handling cx231xx_read_i2c_data result
The function can return negative value.

The problem has been detected using proposed semantic patch
scripts/coccinelle/tests/assign_signed_to_unsigned.cocci [1].

[1]: http://permalink.gmane.org/gmane.linux.kernel/2046107

Signed-off-by: Andrzej Hajda <a.hajda@samsung.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab@osg.samsung.com>
2015-10-03 11:32:32 -03:00
Erik Andresen 2788052a8a [media] Add Terratec H7 Revision 4 to DVBSky driver
Adds Terratec H7 Rev. 4 with USB id 0ccd:10a5 to DVBSky driver.

Signed-off-by: Erik Andresen <erik@vontaene.de>
Signed-off-by: Mauro Carvalho Chehab <mchehab@osg.samsung.com>
2015-10-03 11:08:12 -03:00
Graham Eccleston 702c287082 [media] Compro U650F support
Added Compro U650F to the rtl28xxu devices.

Signed-off-by: Graham Eccleston <grahameccleston_@hotmail.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab@osg.samsung.com>
2015-10-03 09:36:55 -03:00
Junghak Sung 2d7007153f [media] media: videobuf2: Restructure vb2_buffer
Remove v4l2 stuff - v4l2_buf, v4l2_plane - from struct vb2_buffer.

Add new member variables - bytesused, length, offset, userptr, fd,
data_offset - to struct vb2_plane in order to cover all information
of v4l2_plane.
struct vb2_plane {
        <snip>
        unsigned int            bytesused;
        unsigned int            length;
        union {
                unsigned int    offset;
                unsigned long   userptr;
                int             fd;
        } m;
        unsigned int            data_offset;
}

Replace v4l2_buf with new member variables - index, type, memory - which
are common fields for buffer management.
struct vb2_buffer {
        <snip>
        unsigned int            index;
        unsigned int            type;
        unsigned int            memory;
        unsigned int            num_planes;
        struct vb2_plane        planes[VIDEO_MAX_PLANES];
        <snip>
};

v4l2 specific fields - flags, field, timestamp, timecode,
sequence - are moved to vb2_v4l2_buffer in videobuf2-v4l2.c
struct vb2_v4l2_buffer {
        struct vb2_buffer       vb2_buf;

        __u32                   flags;
        __u32                   field;
        struct timeval          timestamp;
        struct v4l2_timecode    timecode;
        __u32                   sequence;
};

Signed-off-by: Junghak Sung <jh1009.sung@samsung.com>
Signed-off-by: Geunyoung Kim <nenggun.kim@samsung.com>
Acked-by: Seung-Woo Kim <sw0312.kim@samsung.com>
Acked-by: Inki Dae <inki.dae@samsung.com>
Signed-off-by: Hans Verkuil <hans.verkuil@cisco.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab@osg.samsung.com>
2015-10-01 09:04:43 -03:00
Junghak Sung c139990e84 [media] media: videobuf2: Replace videobuf2-core with videobuf2-v4l2
Make videobuf2-v4l2 as a wrapper of videobuf2-core for v4l2-use.
And replace videobuf2-core.h with videobuf2-v4l2.h.
This renaming change should be accompanied by the modifications
of all device drivers that include videobuf2-core.h.
It can be done with just running this shell script.

replace()
{
str1=$1
str2=$2
dir=$3
for file in $(find $dir -name *.h -o -name *.c -o -name Makefile)
do
    echo $file
    sed "s/$str1/$str2/g" $file > $file.out
    mv $file.out $file
done
}

replace "videobuf2-core" "videobuf2-v4l2" "include/media/"
replace "videobuf2-core" "videobuf2-v4l2" "drivers/media/"
replace "videobuf2-core" "videobuf2-v4l2" "drivers/usb/gadget/"
replace "videobuf2-core" "videobuf2-v4l2" "drivers/staging/media/"

Signed-off-by: Junghak Sung <jh1009.sung@samsung.com>
Signed-off-by: Geunyoung Kim <nenggun.kim@samsung.com>
Acked-by: Seung-Woo Kim <sw0312.kim@samsung.com>
Acked-by: Inki Dae <inki.dae@samsung.com>
Signed-off-by: Hans Verkuil <hans.verkuil@cisco.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab@osg.samsung.com>
2015-10-01 08:48:18 -03:00
Luis de Bethencourt d275d93590 [media] cx25821, cx88, tm6000: use SNDRV_DEFAULT_ENABLE_PNP
Instead of manually initializing the bool array enable, use the
SNDRV_DEFAULT_ENABLE_PNP macro. As most drivers do.

Signed-off-by: Luis de Bethencourt <luisbg@osg.samsung.com>
Signed-off-by: Hans Verkuil <hans.verkuil@cisco.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab@osg.samsung.com>
2015-10-01 08:42:52 -03:00
Javier Martinez Canillas 5bcc0dd790 [media] go7007: Fix returned errno code in gen_mjpeghdr_to_package()
The driver is using -1 instead of the -ENOMEM defined macro to specify
that a buffer allocation failed. Since the error number is propagated,
the caller will get a -EPERM which is the wrong error condition.

Also, the smatch tool complains with the following warning:

gen_mjpeghdr_to_package() warn: returning -1 instead of -ENOMEM is sloppy

Signed-off-by: Javier Martinez Canillas <javier@osg.samsung.com>
Signed-off-by: Hans Verkuil <hans.verkuil@cisco.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab@osg.samsung.com>
2015-10-01 08:32:52 -03:00
Arnd Bergmann 5ba0e2c3ad [media] use v4l2_get_timestamp where possible
This is a preparation for a change to the type of v4l2 timestamps.
v4l2_get_timestamp() is a helper function that reads the monotonic
time and stores it into a 'struct timeval'. Multiple drivers implement
the same thing themselves for historic reasons.

Changing them all to use v4l2_get_timestamp() is more consistent
and reduces the amount of code duplication, and most importantly
simplifies the following changes.

Signed-off-by: Arnd Bergmann <arnd@arndb.de>
Acked-by: Sylwester Nawrocki <s.nawrocki@samsung.com>
[hans.verkuil@cisco.com: dropped the v4l2-dev.c patch that didn't belong here]
Signed-off-by: Hans Verkuil <hans.verkuil@cisco.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab@osg.samsung.com>
2015-10-01 08:29:23 -03:00
Laurent Pinchart 5d0fd3c806 [media] uvcvideo: Disable hardware timestamps by default
The hardware timestamping implementation has been reported as not
working correctly on at least the Logitech C920. Until this can be
fixed, disable it by default.

Reported-by: Peter Rabbitson <rabbit@rabbit.us>
Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab@osg.samsung.com>
2015-09-25 17:23:26 -03:00
Steven Rostedt 543409a247 [media] cx231xx: Use wake_up_interruptible() instead of wake_up_interruptible_nr()
While looking at use cases of the wake queues in order to add support
for simple wait queues, I noticed that there was only a single user of
wake_up_interruptible_nr(), and that use was doing a single task wake
up. Have that user use the proper wake_up_interruptible() instead, and
perhaps we can even remove the function wake_up_interruptible_nr().

Signed-off-by: Steven Rostedt <rostedt@goodmis.org>
Signed-off-by: Mauro Carvalho Chehab <mchehab@osg.samsung.com>
2015-09-03 13:50:52 -03:00
Christian Löpke 3139f43f8e [media] Technisat SkyStar USB HD,(DVB-S/S2) too much URBs for arm devices
Using 8 URBs results in a consecutive buffer allocation of too much
memory for some arm devices.
As we use isochronuous transfers the number of URBs can be reduced
without risking data-loss.

Signed-off-by: Christian Loepke <loepke@edfritsch.de>
Signed-off-by: Mauro Carvalho Chehab <mchehab@osg.samsung.com>
2015-08-11 14:43:23 -03:00
Krzysztof Kozlowski ebf8dce56a [media] Drop owner assignment from i2c_driver
i2c_driver does not need to set an owner because i2c_register_driver()
will set it.

Signed-off-by: Krzysztof Kozlowski <k.kozlowski@samsung.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab@osg.samsung.com>
2015-08-11 13:01:57 -03:00
Vaishali Thakkar 38dcdca387 [media] pctv452e: Replace memset with eth_zero_addr
Use eth_zero_addr to assign the zero address to the given address
array instead of memset when second argument is address of zero.
Note that the 6 in the third argument of memset appears to represent
an ethernet address size (ETH_ALEN).

The Coccinelle semantic patch that makes this change is as follows:

// <smpl>
@eth_zero_addr@
expression e;
@@

-memset(e,0x00,6);
+eth_zero_addr(e);
// </smpl>

Signed-off-by: Vaishali Thakkar <vthakkar1994@gmail.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab@osg.samsung.com>
2015-08-11 12:57:01 -03:00
Maninder Singh a73df85892 [media] usb/airspy: removing unneeded goto
This patch removes unneded goto,
reported by coccinelle.

Signed-off-by: Maninder Singh <maninder1.s@samsung.com>
Reviewed-by: Akhilesh Kumar <akhilesh.k@samsung.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab@osg.samsung.com>
2015-08-11 12:50:18 -03:00
Antti Palosaari d029419dc6 [media] em28xx: remove unused a8293 SEC config
Devices that were using a8293 SEC are converted to I2C platform data
thus that old config structure is left unused.

Signed-off-by: Antti Palosaari <crope@iki.fi>
Signed-off-by: Mauro Carvalho Chehab <mchehab@osg.samsung.com>
2015-08-11 07:08:01 -03:00
Hans Verkuil df3cfa6d92 [media] usbvision: move init code to probe()
These things are only initialized if you start streaming video, but
they are also used in the disconnect function. So just init them
always during probe time.

Signed-off-by: Hans Verkuil <hans.verkuil@cisco.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab@osg.samsung.com>
2015-08-11 06:55:26 -03:00
Hans Verkuil 94384014f6 [media] usbvision: fix standards for S-Video/Composite inputs
The standards supported by S-Video and Composite inputs are not
limited by PAL, so make it more generic.

Signed-off-by: Hans Verkuil <hans.verkuil@cisco.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab@osg.samsung.com>
2015-08-11 06:55:00 -03:00
Hans Verkuil 8926e84534 [media] usbvision: fix DMA from stack warnings
In various places the stack was used to provide buffers for USB data, but
this should be allocated memory.

Signed-off-by: Hans Verkuil <hans.verkuil@cisco.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab@osg.samsung.com>
2015-08-11 06:54:22 -03:00
Hans Verkuil e2c84ccb0f [media] usbvision: fix locking error
If remove_pending is non-zero, then the v4l2_lock is never unlocked.

Signed-off-by: Hans Verkuil <hans.verkuil@cisco.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab@osg.samsung.com>
2015-08-11 06:53:21 -03:00
Hans Verkuil 4eeda6faae [media] usbvision: set field and colorspace
Set the colorspace and field in vidioc_try_fmt_vid_cap().

Signed-off-by: Hans Verkuil <hans.verkuil@cisco.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab@osg.samsung.com>
2015-08-11 06:53:01 -03:00
Hans Verkuil 64d416ec96 [media] usbvision: frequency fixes
- setup initial radio and tv frequencies.
- set/get the correct frequency (radio vs tv).
- disable tuner/freq ioctls if there is no tuner.
- fix some tuner index checks.

Signed-off-by: Hans Verkuil <hans.verkuil@cisco.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab@osg.samsung.com>
2015-08-11 06:52:31 -03:00
Hans Verkuil cbe12cc66e [media] usbvision: the radio device node has wrong caps
The radio device node had the same caps as the video node. Fix this.

Signed-off-by: Hans Verkuil <hans.verkuil@cisco.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab@osg.samsung.com>
2015-08-11 06:51:00 -03:00
Hans Verkuil 601ecab34b [media] usbvision: remove g/s_audio and for radio remove enum/g/s_input
The g/s_audio ioctls didn't do anything, so remove them all for both
video and radio nodes and remove V4L2_CAP_AUDIO.

The enum/g/s_input ioctls are invalid for radio nodes, so remove them
from the radio ioctl_ops.

Signed-off-by: Hans Verkuil <hans.verkuil@cisco.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab@osg.samsung.com>
2015-08-11 06:50:39 -03:00
Hans Verkuil 2b43665ffb [media] usbvision: return valid error in usbvision_register_video()
Don't return -1, return a proper error code.

Signed-off-by: Hans Verkuil <hans.verkuil@cisco.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab@osg.samsung.com>
2015-08-11 06:50:08 -03:00
Hans Verkuil fd95870d1b [media] usbvision: convert to the control framework
Convert this driver to the control framework and struct v4l2_fh
(needed for handling control events).

Signed-off-by: Hans Verkuil <hans.verkuil@cisco.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab@osg.samsung.com>
2015-08-11 06:49:49 -03:00
Hans Verkuil 62e259493d [media] usbvision: remove power_on_at_open and timed power off
This causes lots of problems and is *very* slow as well.

One of the main problems is that this prohibits the use of the control
framework since subdevs will be unloaded on power off which is not allowed
as long as they are used by a usb device.

Apparently the reason for doing this is to turn off a noisy tuner. My hardware
has no problem with that, and I wonder whether the hardware with that noisy
tuner wasn't just functioning improperly as I have never heard of noisy tuners.

Contact me if you have one of those devices and I can take a look whether the
tuner can't be powered off if necessary by letting the tuner subdevice go
into standby mode. Unloading the tuner module is just evil and is not the
right approach.

Signed-off-by: Hans Verkuil <hans.verkuil@cisco.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab@osg.samsung.com>
2015-08-11 06:49:17 -03:00
Ezequiel Garcia d3194520e2 [media] stk1160: Add frame scaling support
This commit implements frame decimation for stk1160, which allows
to support format changes instead of a static frame size.

The stk1160 supports independent row and column decimation, in two
different modes:
 * set a number of rows/columns units to skip for each unit sent.
 * set a number of rows/columns units to send for each unit skipped.

This effectively allows to achieve different frame scaling ratios.

The unit number can be set to either two row/columns sent/skipped,
or four row/columns sent/skipped. Since the video format (UYVY)
has 4-bytes, using a unit number of two row/columns results
in frame color 'shifting', so set to four row/columns sent/skipped.

Signed-off-by: Michael Stegemann <michael@stegemann.it>
Signed-off-by: Dale Hamel <dale.hamel@srvthe.net>
Signed-off-by: Ezequiel Garcia <ezequiel@vanguardiasur.com.ar>
Signed-off-by: Hans Verkuil <hans.verkuil@cisco.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab@osg.samsung.com>
2015-07-17 09:52:31 -03:00
Ezequiel Garcia 890024ad14 [media] stk1160: Reduce driver verbosity
These messages are not really informational, and just makes the driver's
output too verbose. This commit changes some messages to a debug level,
removes a really useless "driver loaded" message and finally undefines
the DEBUG macro.

Signed-off-by: Ezequiel Garcia <ezequiel@vanguardiasur.com.ar>
Signed-off-by: Hans Verkuil <hans.verkuil@cisco.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab@osg.samsung.com>
2015-07-17 09:51:15 -03:00
Fabian Frederick 41cc14ba11 [media] ttusb-dec: use swap() in swap_bytes()
Use kernel.h macro definition.

Thanks to Julia Lawall for Coccinelle scripting support.

Signed-off-by: Fabian Frederick <fabf@skynet.be>
Signed-off-by: Mauro Carvalho Chehab <mchehab@osg.samsung.com>
2015-07-17 09:02:48 -03:00
David Härdeman f459aec2bc [media] lmedm04: NEC scancode cleanup
This changes the keymap back to the state before commit 616a4b83
and changes the driver to use full NEC32 scancodes following the
instructions provided by Malcolm Priestley <tvboxspy@gmail.com>.

Signed-off-by: David Härdeman <david@hardeman.nu>
Signed-off-by: Mauro Carvalho Chehab <mchehab@osg.samsung.com>
2015-07-06 08:26:15 -03:00
Nicholas Mc Guire 63f2f41752 [media] gscpa_m5602: use msecs_to_jiffies for conversions
API compliance scanning with coccinelle flagged:
./drivers/media/usb/gspca/m5602/m5602_s5k83a.c:180:9-25:
	 WARNING: timeout (100) seems HZ dependent

Numeric constants passed to schedule_timeout() make the effective
timeout HZ dependent which makes little sense in a polling loop for
the cameras rotation state.
Fixed up by converting the constant to jiffies with msecs_to_jiffies()

Signed-off-by: Nicholas Mc Guire <hofrat@osadl.org>
Signed-off-by: Hans de Goede <hdegoede@redhat.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab@osg.samsung.com>
2015-07-06 08:26:06 -03:00
Dan Carpenter 0a2a89c4ac [media] gspca: sn9c2028: remove an unneeded condition
We already know status is negative because of the earlier check so there
is no need to check again.

Signed-off-by: Dan Carpenter <dan.carpenter@oracle.com>
Signed-off-by: Hans de Goede <hdegoede@redhat.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab@osg.samsung.com>
2015-07-06 08:26:06 -03:00
Hans Verkuil e3e30f6338 [media] stk1160: fix sequence handling
Fix the sequence counter: we're counting frames, not fields.

Also remove the unused 'field' field. That would only be needed if this driver
would support V4L2_FIELD_ALTERNATE.

Signed-off-by: Hans Verkuil <hans.verkuil@cisco.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab@osg.samsung.com>
2015-07-06 08:25:46 -03:00
Mauro Carvalho Chehab faebbd8f13 [media] lmedm04: fix the range for relative measurements
Relative measurements are typically between 0 and 0xffff. However,
for some tuners (TUNER_S7395 and TUNER_S0194), the range were from
0 to 0xff00, with means that 100% is never archived.
Also, TUNER_RS2000 uses a more complex math.

So, create a macro that does the conversion using bit operations
and use it for all conversions.

The code is also easier to read with is a bonus.

While here, remove a bogus comment.

Signed-off-by: Mauro Carvalho Chehab <mchehab@osg.samsung.com>
2015-06-24 08:38:30 -03:00
Mauro Carvalho Chehab 5ae65db547 [media] lmedm04: use u32 instead of u64 for relative stats
Cleanup this sparse warning:
	drivers/media/usb/dvb-usb-v2/lmedm04.c:302 lme2510_update_stats() warn: should '((255 - st->signal_sn - 161) * 3) << 8' be a 64 bit type?

Both c_tmp and s_tmp actually stores a u16 stat. Using a u64 data
there is a waste, specially on u32 archs, as 64 ints there are more
expensive.

So, change the types to u32 and do the typecast only when storing
the result.

Signed-off-by: Mauro Carvalho Chehab <mchehab@osg.samsung.com>
2015-06-24 08:38:30 -03:00
Rafael Lourenço de Lima Chehab e42c8c6eb4 [media] au0828: move dev->boards atribuition to happen earlier
The attribution of dev->boards occured too late, which
would couse an OOPS in media controller registration.

Signed-off-by: Rafael Lourenço de Lima Chehab <chehabrafael@gmail.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab@osg.samsung.com>
2015-06-10 12:39:35 -03:00
Malcolm Priestley 48c91aadc5 [media] lmedm04: implement dvb v5 statistics
Indroduce function lme2510_update_stats to update
statistics directly from usb interrupt.

Provide signal and snr wrap rounds for dvb v3 functions.

Block and post bit are not available.

When i2c_talk_onoff is on no statistics are available,
with possible future hand over to the relevant frontend/tuner.

Signed-off-by: Malcolm Priestley <tvboxspy@gmail.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab@osg.samsung.com>
2015-06-10 12:37:54 -03:00
Malcolm Priestley 9e8715c91d [media] lmedm04: Enable dont_poll for TS2020 tuner
Following a change made to TS2020 tuner in patches
ts2020: Provide DVBv5 API signal strength
ts2020: Allow stats polling to be suppressed

Polling on the driver must be suppressed because
the demuxer is stopped by I2C messages.

Signed-off-by: Malcolm Priestley <tvboxspy@gmail.com>
Signed-off-by: Antti Palosaari <crope@iki.fi>
Signed-off-by: Mauro Carvalho Chehab <mchehab@osg.samsung.com>
2015-06-10 11:12:42 -03:00
David Howells 0f91c9d6ba [media] TS2020: Calculate tuner gain correctly
The TS2020 and TS2022 tuners take an input from the demodulator indicating the
AGC setting on that component that is then used to influence the tuner's own
gain.  This should be taken into account when calculating the gain and signal
strength.

Further, the existing TS2020 driver miscalculates the signal strength as the
result of its calculations can exceed the storage capacity of the 16-bit word
used to return it to userspace.

To this end:

 (1) Add a callback function (->get_agc_pwm()) in the ts2020_config struct that
     the tuner can call to get the AGC PWM value from the demodulator.

 (2) Modify the TS2020 driver to calculate the gain according to Montage's
     specification with the adjustment that we produce a negative value and
     scale it to 0.001dB units (which is what the DVBv5 API will require):

     (a) Callback to the demodulator to retrieve the AGC PWM value and then
     	 turn that into Vagc for incorporation in the calculations.  If the
     	 callback is unset, assume a Vagc of 0.

     (b) Calculate the tuner gain from a combination of Vagc and the tuner's RF
     	 gain and baseband gain settings.

 (3) Turn this into a percentage signal strength as per Montage's
     specification for return to userspace with the DVBv3 API.

 (4) Provide a function in the M88DS3103 demodulator driver that can be used to
     get the AGC PWM value on behalf of the tuner.

 (5) The ts2020_config.get_agc_pwm function should be set by the code that
     stitches together the drivers for each card.

     For the DVBSky cards that use the M88DS3103 with the TS2020 or the TS2022,
     set the get_agc_pwm function to point to m88ds3103_get_agc_pwm.

I have tested this with a DVBSky S952 card which has an M88DS3103 and a TS2022.

Thanks to Montage for providing access to information about the workings of
these parts.

Signed-off-by: David Howells <dhowells@redhat.com>
Signed-off-by: Antti Palosaari <crope@iki.fi>
Signed-off-by: Mauro Carvalho Chehab <mchehab@osg.samsung.com>
2015-06-10 11:10:27 -03:00
Antti Palosaari 76b91be3d3 [media] em28xx: PCTV 461e use I2C client for demod and SEC
Use I2C client binding for demod and SEC.

Signed-off-by: Antti Palosaari <crope@iki.fi>
Signed-off-by: Mauro Carvalho Chehab <mchehab@osg.samsung.com>
2015-06-10 11:09:20 -03:00
Tommi Rantala eee1d06dc2 [media] cx231xx: Add support for Terratec Grabby
Add support for the Terratec Grabby with USB ID 0ccd:00a6.

Signed-off-by: Tommi Rantala <tt.rantala@gmail.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab@osg.samsung.com>
2015-06-09 18:37:08 -03:00
Mauro Carvalho Chehab 09f2082e23 [media] usb drivers: use BUG_ON() instead of if () BUG
Some USB drivers have a logic at the VB buffer handling like:
	if (in_interrupt())
		BUG();
Use, instead:
	BUG_ON(in_interrupt());

Btw, this logic looks weird on my eyes. We should convert them
to use VB2, in order to avoid those crappy things.

Signed-off-by: Mauro Carvalho Chehab <mchehab@osg.samsung.com>
Acked-by: Lad, Prabhakar <prabhakar.csengg@gmail.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab@osg.samsung.com>
2015-06-09 18:30:09 -03:00
Mauro Carvalho Chehab 0df289a209 [media] dvb: Get rid of typedev usage for enums
The DVB API was originally defined using typedefs. This is against
Kernel CodingStyle, and there's no good usage here. While we can't
remove its usage on userspace, we can avoid its usage in Kernelspace.

So, let's do it.

This patch was generated by this shell script:

	for j in $(grep typedef include/uapi/linux/dvb/frontend.h |cut -d' ' -f 3); do for i in $(find drivers/media -name '*.[ch]' -type f) $(find drivers/staging/media -name '*.[ch]' -type f); do sed "s,${j}_t,enum $j," <$i >a && mv a $i; done; done

While here, make CodingStyle fixes on the affected lines.

Signed-off-by: Mauro Carvalho Chehab <mchehab@osg.samsung.com>
Acked-by: Stefan Richter <stefanr@s5r6.in-berlin.de> # for drivers/media/firewire/*
2015-06-09 17:47:35 -03:00
Hans Verkuil 7f3c2e1d1d [media] cx231xx: fix compiler warning
Fix this compiler warning by allocating a structure to read the eeprom instead
of doing it on the stack and worse: the eeprom array is static, so that can
cause problems if there are multiple cx231xx instances.

cx231xx-cards.c: In function 'cx231xx_card_setup':
cx231xx-cards.c:1110:1: warning: the frame size of 2064 bytes is larger than 2048 bytes [-Wframe-larger-than=]
 }
 ^

I did consider removing the code altogether since the result is actually
not used at the moment, but I decided against it since it is used in other
drivers and someone might want to start using it in this driver as well. And
then it is useful that the code is already there.

Signed-off-by: Hans Verkuil <hans.verkuil@cisco.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab@osg.samsung.com>
2015-06-09 17:46:24 -03:00
Hans Verkuil ebbb563755 [media] stk1160: add DMABUF support
Implement DMABUF exporting and importing.

Signed-off-by: Hans Verkuil <hans.verkuil@cisco.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab@osg.samsung.com>
2015-06-06 07:33:36 -03:00
Antti Palosaari 8022f9afcd [media] em28xx: bind PCTV 460e using I2C client
Load PCTV 460e tda10071 demod and a8293 SEC using I2C client bindings.
Remove old unused tda10071 config struct. We are using I2C platform
data now.

Signed-off-by: Antti Palosaari <crope@iki.fi>
Signed-off-by: Mauro Carvalho Chehab <mchehab@osg.samsung.com>
2015-06-06 07:22:52 -03:00
Antti Palosaari 7098f582e0 [media] em28xx: add support for DVB SEC I2C client
Add support for DVB SEC (satellite equipment controller) I2C client.

Signed-off-by: Antti Palosaari <crope@iki.fi>
Signed-off-by: Mauro Carvalho Chehab <mchehab@osg.samsung.com>
2015-06-06 07:22:00 -03:00
Mauro Carvalho Chehab b295e5c7d8 [media] usbvision: cleanup the code
There's a dead code on usbvision that makes it harder to read
and produces a smatch warning about bad identation.

Improve the code readability and add a FIXME to warn about
the current hack there.

Signed-off-by: Mauro Carvalho Chehab <mchehab@osg.samsung.com>
2015-06-05 11:26:47 -03:00
Mauro Carvalho Chehab 485bdbb6b8 [media] tm6000: remove needless check
Smatch reports a warning:
	drivers/media/usb/tm6000/tm6000-video.c:646 tm6000_prepare_isoc() error: we previously assumed 'dev->urb_buffer' could be null (see line 624)

This is not really a problem, but it actually shows that the check
if urb_buffer is NULL is being done twice: at the if and at
tm6000_alloc_urb_buffers().

We don't need to do it twice. So, remove the extra check. The code
become cleaner, and, as a collateral effect, smatch becomes happy.

Signed-off-by: Mauro Carvalho Chehab <mchehab@osg.samsung.com>
2015-06-05 11:26:37 -03:00
Mauro Carvalho Chehab 7fdc5561ca [media] em28xx: remove dead code
As reported by smatch:
	drivers/media/usb/em28xx/em28xx-video.c:842 get_ressource() info: ignoring unreachable code.

Signed-off-by: Mauro Carvalho Chehab <mchehab@osg.samsung.com>
2015-06-05 08:03:01 -03:00
Laurent Pinchart d511eb7d64 [media] uvcvideo: Remove unneeded device disconnected flag
The UVC_DEV_DISCONNECTED flag is set when the USB device is
disconnected, and checked in the open() handler to refuse opening a
device that has been disconnected.

This is inherently racy, but the race condition is taken care of in the
V4L2 core, which also fails open() calls when the V4L2 device node has
been unregistered. As the uvcvideo USB disconnect handler unregisters
all its video device nodes, the UVC_DEV_DISCONNECTED flag doesn't serve
any purpose anymore and can be removed.

Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab@osg.samsung.com>
2015-05-30 12:12:58 -03:00
Laurent Pinchart 37f85b276a [media] uvcvideo: Fix incorrect bandwidth with Chicony device 04f2:b50b
The "TOSHIBA Web Camera - 5M" Chicony device (04f2:b50b) seems to
compute the bandwidth on 16 bits and erroneously sign-extend it to
32 bits, resulting in a huge bandwidth value. Detect and fix that
condition by setting the 16 MSBs to 0 when they're all equal to 1.

Reported-by: Hans de Goede <hdegoede@redhat.com>
Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab@osg.samsung.com>
2015-05-30 12:12:15 -03:00
Laurent Pinchart 7195f61b80 [media] uvcvideo: Implement DMABUF exporter role
Now that videobuf2-vmalloc supports exporting buffers, add support for
the DMABUF exporter role by plugging in the videobuf2 ioctl helper.

Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab@osg.samsung.com>
2015-05-30 12:11:40 -03:00
Antti Palosaari baf06b5190 [media] af9035: add USB ID 07ca:0337 AVerMedia HD Volar (A867)
It is AF9035 + MxL5007T.
Driver reports:
prechip_version=00 chip_version=03 chip_type=3802

Not sure if that USB ID is reserved only for HP brand or if it is
common, but the stick I have is branded as HP part no. 580715-001
rmn A867.

Signed-off-by: Antti Palosaari <crope@iki.fi>
Signed-off-by: Mauro Carvalho Chehab <mchehab@osg.samsung.com>
2015-05-30 12:08:50 -03:00
Vasily Khoruzhick d8fd9f5625 [media] gspca: sn9c2028: Add gain and autogain controls Genius Videocam Live v2
Autogain algorithm is very simple, if average luminance is low - increase gain,
if it's high - decrease gain. Gain granularity is low enough for this algo to
stabilize quickly.

Signed-off-by: Vasily Khoruzhick <anarsoul@gmail.com>
Signed-off-by: Hans de Goede <hdegoede@redhat.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab@osg.samsung.com>
2015-05-30 11:48:09 -03:00
Vasily Khoruzhick 48c291eda7 [media] gspca: sn9c2028: Add support for Genius Videocam Live v2
This cam seems to return different values on long commands, so make status check
in sn9c2028_long_command() more tolerant. Anyway, read value isn't used anywhere
later.

Signed-off-by: Vasily Khoruzhick <anarsoul@gmail.com>
Signed-off-by: Hans de Goede <hdegoede@redhat.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab@osg.samsung.com>
2015-05-30 11:47:29 -03:00
Antti Palosaari 9ea964f369 [media] rtl28xxu: load SDR module for fc2580 based devices
Load rtl2832_sdr driver for devices having fc2580 tuner.

Signed-off-by: Antti Palosaari <crope@iki.fi>
Signed-off-by: Mauro Carvalho Chehab <mchehab@osg.samsung.com>
2015-05-18 15:59:35 -03:00
Antti Palosaari 7e33f8a282 [media] rtl28xxu: set correct FC2580 tuner for RTL2832 demod
rtl2832 demod driver has support for FC2580 tuner config, no need to
abuse FC0012 settings anymore.

Signed-off-by: Antti Palosaari <crope@iki.fi>
Signed-off-by: Mauro Carvalho Chehab <mchehab@osg.samsung.com>
2015-05-18 15:56:19 -03:00
Antti Palosaari 88ffe55ae3 [media] rtl28xxu: bind tua9001 using I2C binding
Change tua9001 driver from media binding to I2C client binding.

Signed-off-by: Antti Palosaari <crope@iki.fi>
Signed-off-by: Mauro Carvalho Chehab <mchehab@osg.samsung.com>
2015-05-18 15:52:36 -03:00
Antti Palosaari b6c5fe70a7 [media] af9035: bind tua9001 using I2C binding
Change tua9001 driver from media binding to I2C client binding.

Signed-off-by: Antti Palosaari <crope@iki.fi>
Signed-off-by: Mauro Carvalho Chehab <mchehab@osg.samsung.com>
2015-05-18 15:52:14 -03:00
Antti Palosaari b3f02270b2 [media] af9035: fix device order in ID list
Driver supports multiple chipset versions. Devices are ordered to
ID table per used chipset type. "ITE 9303 Generic" device uses IT9303
chipset and was added mistakenly between IT9135 IDs.

Signed-off-by: Antti Palosaari <crope@iki.fi>
Signed-off-by: Mauro Carvalho Chehab <mchehab@osg.samsung.com>
2015-05-18 15:51:02 -03:00
Antti Palosaari 7a893ba9c8 [media] af9035: bind fc2580 using I2C binding
Change fc2580 driver from media binding to I2C client binding.

Signed-off-by: Antti Palosaari <crope@iki.fi>
Signed-off-by: Mauro Carvalho Chehab <mchehab@osg.samsung.com>
2015-05-18 15:46:16 -03:00
Antti Palosaari 35fc0e0fcb [media] rtl28xxu: bind fc2580 using I2C binding
Change fc2580 driver from media binding to I2C client binding.

Signed-off-by: Antti Palosaari <crope@iki.fi>
Signed-off-by: Mauro Carvalho Chehab <mchehab@osg.samsung.com>
2015-05-18 15:45:55 -03:00
Mauro Carvalho Chehab 0fae1997f0 [media] dib0700: avoid the risk of forgetting to add the adapter's size
For every frontend entry, we need to add the adapter's size. There
are already two patches fixing it. So, it doesn't seem trivial to
keep it there at the right place.

Also, currently, the indentation is wrong on all places.

So, it seems that keeping it right is not too trivial.

Better to use a macro that would do it for us, at least while
this is not converted to dvb-usb-v2.

Compile-tested only.

Signed-off-by: Mauro Carvalho Chehab <mchehab@osg.samsung.com>
2015-05-14 19:31:34 -03:00
Antti Palosaari f7e5a65596 [media] msi2500: cleanups
Rename state to dev.
Correct some indentations.
Remove FSF address.
Fix some style issues reported by checkpatch.pl.
Correct some style issues I liked.

Signed-off-by: Antti Palosaari <crope@iki.fi>
Signed-off-by: Mauro Carvalho Chehab <mchehab@osg.samsung.com>
2015-05-14 08:27:23 -03:00
Antti Palosaari faf22b13ee [media] msi2500: revise synthesizer calculation
Update synthesizer calculation to model I prefer nowadays. It is mostly
just renaming some variables, but also minor functionality change how
integer and fractional part are divided (using div_u64_rem()). Also, add
'schematic' of synthesizer following my current understanding.

Signed-off-by: Antti Palosaari <crope@iki.fi>
Signed-off-by: Mauro Carvalho Chehab <mchehab@osg.samsung.com>
2015-05-14 07:57:41 -03:00
Thomas Reitmayr e989a73ebd [media] media: Fix regression in some more dib0700 based devices
Fix an oops during device initialization by correctly setting size_of_priv
instead of leaving it 0.
The regression was introduced by 8abe4a0a3f ("[media] dib7000:
export just one symbol") and only fixed for one type of dib0700 based
devices in 9e334c7564 ("[media] Fix regression in some dib0700
based devices").

Bugzilla: https://bugzilla.kernel.org/show_bug.cgi?id=92301

Fixes: 8abe4a0a3f ("[media] dib7000: export just one symbol")

Cc: stable@vger.kernel.org # for version 3.17+
Signed-off-by: Thomas Reitmayr <treitmayr@devbase.at>
Signed-off-by: Mauro Carvalho Chehab <mchehab@osg.samsung.com>
2015-05-13 18:18:39 -03:00
Olli Salonen 356484cabe [media] dw2102: resync fifo when demod locks
If the streaming_ctrl is called to enable TS before demod has locked
the TS will be empty. Copied the solution from the dvbsky driver for the
TechnoTrend S2-4600 device: when the state changes from unlock to
lock, call su3000_streaming_ctrl again.

Signed-off-by: Olli Salonen <olli.salonen@iki.fi>
Signed-off-by: Mauro Carvalho Chehab <mchehab@osg.samsung.com>
2015-05-13 17:12:42 -03:00
Olli Salonen c636bd0bce [media] dw2102: remove unnecessary printing of MAC address
While reading the MAC address for SU3000-based devices the system was
printing excessive debug information in the logs:

Output before the patch:

[ 1515.780692] bc 00 00 00 00 00
[ 1515.781440] bc ea 00 00 00 00
[ 1515.782251] bc ea 2b 00 00 00
[ 1515.783094] bc ea 2b 46 00 00
[ 1515.783816] bc ea 2b 46 12 00
[ 1515.784565] bc ea 2b 46 12 92
[ 1515.784571] dvb-usb: MAC address: bc:ea:2b:46:12:92

Output after the patch:

[ 3803.495706] dvb-usb: MAC address: bc:ea:2b:46:12:92

Signed-off-by: Olli Salonen <olli.salonen@iki.fi>
Signed-off-by: Mauro Carvalho Chehab <mchehab@osg.samsung.com>
2015-05-13 17:12:02 -03:00
David Härdeman 4d298b8539 [media] rc-core: fix dib0700 scancode generation for RC5
commit af3a4a9bbe ("[media] dib0700: NEC scancode cleanup") cleaned
up the NEC scancode logic but overlooked the RC5 case.

This patch brings the RC5 case in line with the NEC code and makes
the struct self-documenting.

Signed-off-by: David Härdeman <david@hardeman.nu>
Reported-by: David Cimbůrek <david.cimburek@gmail.com>
Cc: stable@vger.kernel.org
Signed-off-by: Mauro Carvalho Chehab <mchehab@osg.samsung.com>
2015-05-12 18:27:25 -03:00
Wei Yongjun 250d2ff016 [media] rtl28xxu: fix return value check in rtl2832u_tuner_attach()
In case of error, the function platform_device_register_data() returns
ERR_PTR() and never returns NULL. The NULL test in the return value check
should be replaced with IS_ERR().

Signed-off-by: Wei Yongjun <yongjun_wei@trendmicro.com.cn>
Signed-off-by: Antti Palosaari <crope@iki.fi>
Signed-off-by: Mauro Carvalho Chehab <mchehab@osg.samsung.com>
2015-05-12 13:27:22 -03:00
Olli Salonen 699dcffc52 [media] rtl2832: add support for GoTView MasterHD 3 USB tuner
GoTView MasterHD 3 is a DVB-T2/C USB 2.0 tuner.

It's based on the following components:
- USB bridge: RTL2832P (contains also DVB-T demodulator)
- Demodulator: Si2168-A30
- Tuner: Si2148-A20

The demodulator and the tuner will need firmwares. The Si2148 uses Si2158
firmware. Antti has the firmwares available for download:
http://palosaari.fi/linux/v4l-dvb/firmware/

Do note that for DVB-T either of the demodulators can be used. DVB-C and
DVB-T2 are only supported by the Si2168 demodulator. The driver will
register 2 frontends for the same adapter. Frontend 0 will be the RTL2832
demodulator and frontend 1 will be the Si2168 demodulator. The same
tuner is used for both.

As a consequence of the above, it's recommended to use application that
does implement proper DVBv5 support.

For some reason, the old I2C write method sporadically fails. Thus the
need for an option to only use the new I2C write method supported by the
RTL2832.

Signed-off-by: Olli Salonen <olli.salonen@iki.fi>
Signed-off-by: Antti Palosaari <crope@iki.fi>
Signed-off-by: Mauro Carvalho Chehab <mchehab@osg.samsung.com>
2015-05-12 13:25:35 -03:00
Olli Salonen d744a0cb8a [media] rtl28xxu: add I2C read without write
Add support for I2C read operation without a preceeding write.

While here, change the error code to EOPNOTSUPP in case an
unsupported I2C operation is attempted.

Signed-off-by: Olli Salonen <olli.salonen@iki.fi>
Signed-off-by: Antti Palosaari <crope@iki.fi>
Signed-off-by: Mauro Carvalho Chehab <mchehab@osg.samsung.com>
2015-05-12 13:21:29 -03:00
Olli Salonen ee3c3e4688 [media] si2157: support selection of IF interface
The chips supported by the si2157 driver have two IF outputs (either
pins 12+13 or pins 9+11). Instead of hardcoding the output to be used
add an option to choose which output shall be used.

As this patch changes the default behaviour, the IF interface is
specified in each driver currently using si2157 driver. This is to
keep bisectability.

Signed-off-by: Olli Salonen <olli.salonen@iki.fi>
Signed-off-by: Antti Palosaari <crope@iki.fi>
Signed-off-by: Mauro Carvalho Chehab <mchehab@osg.samsung.com>
2015-05-12 13:20:55 -03:00
Olli Salonen c060f9329f [media] dvbsky: use si2168 config option ts_clock_gapped
Change the dvbsky driver to support gapped clock instead of the current
hack.

Signed-off-by: Olli Salonen <olli.salonen@iki.fi>
Signed-off-by: Antti Palosaari <crope@iki.fi>
Signed-off-by: Mauro Carvalho Chehab <mchehab@osg.samsung.com>
2015-05-12 13:17:19 -03:00
Olli Salonen 44767fc418 [media] dw2102: TeVii S482 support
TeVii S482 is a PCIe device with two tuners that actually contains two
USB devices. The devices are visible in the lsusb printout.

Bus 006 Device 002: ID 9022:d483 TeVii Technology Ltd.
Bus 007 Device 002: ID 9022:d484 TeVii Technology Ltd.

The device itself works exactly with the same settings as TechnoTrend
TT-connect S2-4600. Firmware for DS3103 demodulator is required:
http://palosaari.fi/linux/v4l-dvb/firmware/M88DS3103/

This patch should be applied on top of the TT S2-4600 patch:
https://patchwork.linuxtv.org/patch/28818/

Signed-off-by: Olli Salonen <olli.salonen@iki.fi>
Signed-off-by: Mauro Carvalho Chehab <mchehab@osg.samsung.com>
2015-05-12 08:02:41 -03:00
Hans Verkuil ebf984bb15 [media] v4l2: replace s_mbus_fmt by set_fmt in bridge drivers
Replace all calls to s_mbus_fmt in bridge drivers by calls to the
set_fmt pad op.

Remove the old try/s_mbus_fmt video ops since they are now no longer used.

Signed-off-by: Hans Verkuil <hans.verkuil@cisco.com>
Cc: Guennadi Liakhovetski <g.liakhovetski@gmx.de>
Acked-by: Prabhakar Lad <prabhakar.csengg@gmail.com>
Acked-by: Scott Jiang <scott.jiang.linux@gmail.com>
Cc: Jonathan Corbet <corbet@lwn.net>
Signed-off-by: Mauro Carvalho Chehab <mchehab@osg.samsung.com>
2015-05-01 09:01:16 -03:00
Hans Verkuil 6e80c4738a [media] v4l2: replace s_mbus_fmt by set_fmt
The s_mbus_fmt video op is a duplicate of the pad op. Replace all uses
in sub-devices by the set_fmt() pad op.

Signed-off-by: Hans Verkuil <hans.verkuil@cisco.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab@osg.samsung.com>
2015-05-01 08:52:34 -03:00
Hans Verkuil a988410ad1 [media] usbtv: fix v4l2-compliance issues
Running v4l2-compliance on my usbtv stick revealed two failures:

1) Correct handling of CREATE_BUFS in usbtv_queue_setup was missing. Added this.
2) The sequence counter wasn't reset to 0 when starting streaming.

Signed-off-by: Hans Verkuil <hans.verkuil@cisco.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab@osg.samsung.com>
2015-05-01 07:35:24 -03:00
Julia Lawall bfe40b79e9 [media] as102: fix error return code
Return a negative error code on failure.

A simplified version of the semantic match that finds this problem is as
follows: (http://coccinelle.lip6.fr/)

// <smpl>
@@
identifier ret; expression e1,e2;
@@
(
if (\(ret < 0\|ret != 0\))
 { ... return ret; }
|
ret = 0
)
... when != ret = e1
    when != &ret
*if(...)
{
  ... when != ret = e2
      when forall
 return ret;
}
// </smpl>

Signed-off-by: Julia Lawall <Julia.Lawall@lip6.fr>
Signed-off-by: Hans Verkuil <hans.verkuil@cisco.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab@osg.samsung.com>
2015-05-01 07:00:51 -03:00
Mauro Carvalho Chehab cd65d24e03 [media] xirlink_cit: comment unreachable code
drivers/media/usb/gspca/xirlink_cit.c:1776 cit_start_model2() info: ignoring unreachable code.
drivers/media/usb/gspca/xirlink_cit.c:1858 cit_start_model2() info: ignoring unreachable code.
drivers/media/usb/gspca/xirlink_cit.c:1910 cit_start_model2() info: ignoring unreachable code.

Signed-off-by: Mauro Carvalho Chehab <mchehab@osg.samsung.com>
2015-05-01 06:27:08 -03:00
Mauro Carvalho Chehab 48902bc7d0 [media] dw2102: fix bad indenting
drivers/media/usb/dvb-usb/dw2102.c:440 dw2104_i2c_transfer() warn: inconsistent indenting

Signed-off-by: Mauro Carvalho Chehab <mchehab@osg.samsung.com>
2015-05-01 06:26:47 -03:00
Mauro Carvalho Chehab ab4bc55ebd [media] af9005: fix bad indenting
drivers/media/usb/dvb-usb/af9005-fe.c:484 af9005_fe_read_status() warn: inconsistent indenting

Signed-off-by: Mauro Carvalho Chehab <mchehab@osg.samsung.com>
2015-05-01 06:26:31 -03:00