GitHub/moto-9609/android_kernel_motorola_exynos9610.git
8 years ago[media] cec: don't set fh to NULL in CEC_TRANSMIT
Hans Verkuil [Sat, 16 Jul 2016 12:59:18 +0000 (09:59 -0300)]
[media] cec: don't set fh to NULL in CEC_TRANSMIT

The filehandle was set to NULL when in non-blocking mode or when
no reply is needed.

This is wrong: the filehandle is needed in non-blocking mode to ensure
that the result of the transmit can be obtained through CEC_RECEIVE.

And the 'reply' check was also incorrect since it should have checked the
timeout field (the reply can be 0). In any case, when in blocking mode
there is no need to set the fh to NULL either.

Signed-off-by: Hans Verkuil <hans.verkuil@cisco.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab@s-opensource.com>
8 years ago[media] cec: clear all status fields before transmit and always fill in sequence
Hans Verkuil [Sat, 16 Jul 2016 12:44:13 +0000 (09:44 -0300)]
[media] cec: clear all status fields before transmit and always fill in sequence

Before transmitting a message clear all status fields and always fill
in the sequence number. Make sure the sequence number is never 0.

Signed-off-by: Hans Verkuil <hans.verkuil@cisco.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab@s-opensource.com>
8 years ago[media] cec: CEC_RECEIVE overwrote the timeout field
Hans Verkuil [Sat, 16 Jul 2016 10:58:31 +0000 (07:58 -0300)]
[media] cec: CEC_RECEIVE overwrote the timeout field

When CEC_RECEIVE returns a message the original timeout field
was overwritten. Restore the timeout field.

Signed-off-by: Hans Verkuil <hans.verkuil@cisco.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab@s-opensource.com>
8 years ago[media] cxd2841er: Reading SNR for DVB-C added
Abylay Ospan [Fri, 15 Jul 2016 20:04:17 +0000 (17:04 -0300)]
[media] cxd2841er: Reading SNR for DVB-C added

Now driver returns correct values for DVB-C:
 SNR (in dB)

[mchehab@s-opensource.com: fix a new function to be static]
Signed-off-by: Abylay Ospan <aospan@netup.ru>
Signed-off-by: Mauro Carvalho Chehab <mchehab@s-opensource.com>
8 years ago[media] cxd2841er: Reading BER and UCB for DVB-C added
Abylay Ospan [Fri, 15 Jul 2016 18:34:22 +0000 (15:34 -0300)]
[media] cxd2841er: Reading BER and UCB for DVB-C added

now driver returns correct values for DVB-C:
 BER (post_bit_count and post_bit_error values)
 UCB (count of uncorrected errors)
also, some code cleanup was done - checkpatch.pl now is happy

Signed-off-by: Abylay Ospan <aospan@netup.ru>
Signed-off-by: Mauro Carvalho Chehab <mchehab@s-opensource.com>
8 years ago[media] cxd2841er: fix switch-case for DVB-C
Abylay Ospan [Fri, 15 Jul 2016 17:59:37 +0000 (14:59 -0300)]
[media] cxd2841er: fix switch-case for DVB-C

DVB-C should use cxd2841er_read_agc_gain_c() to get the gain. The same
function is used for all DVB-C annex delivery systems.

Signed-off-by: Abylay Ospan <aospan@netup.ru>
Signed-off-by: Mauro Carvalho Chehab <mchehab@s-opensource.com>
8 years ago[media] cxd2841er: fix signal strength scale for ISDB-T
Mauro Carvalho Chehab [Fri, 1 Jul 2016 18:41:38 +0000 (15:41 -0300)]
[media] cxd2841er: fix signal strength scale for ISDB-T

The scale for ISDB-T was wrong too: it was inverted, and
on a relative scale.

Use a linear interpolation to make it look better.
The formula was empirically determined, using 3 frequencies
(175 MHz, 410 MHz and 800 MHz), measuring from -50dBm to
-12dBm in steps of 0.5dB.

Signed-off-by: Mauro Carvalho Chehab <mchehab@s-opensource.com>
8 years ago[media] cxd2841er: adjust the dB scale for DVB-C
Mauro Carvalho Chehab [Fri, 1 Jul 2016 14:03:16 +0000 (11:03 -0300)]
[media] cxd2841er: adjust the dB scale for DVB-C

Instead of using a relative frequency range, calibrate it to
show the results in dB. The callibration was done getting
samples with a signal generated from -50dBm to -12dBm,
incremented in steps of 0.5 dB, using 3 frequencies:
175 MHz, 410 MHz and 800 MHz. The modulated signal was
using QAM64, and it was used a linear interpolation of all
the results.

Signed-off-by: Mauro Carvalho Chehab <mchehab@s-opensource.com>
8 years ago[media] cxd2841er: provide signal strength for DVB-C
Mauro Carvalho Chehab [Fri, 1 Jul 2016 14:03:14 +0000 (11:03 -0300)]
[media] cxd2841er: provide signal strength for DVB-C

Currently, there's no stats for DVB-C. Let's at least return
signal strength. The scale is different than on DVB-T, so let's
use a relative scale, for now.

Signed-off-by: Mauro Carvalho Chehab <mchehab@s-opensource.com>
8 years ago[media] cxd2841er: fix BER report via DVBv5 stats API
Mauro Carvalho Chehab [Fri, 1 Jul 2016 14:03:15 +0000 (11:03 -0300)]
[media] cxd2841er: fix BER report via DVBv5 stats API

What userspace expects is to receive both bit_error and bit_count
counters. So, instead of doing the division at the Kernel,
return the counters for userspace to handle it the way it
wants.

Signed-off-by: Mauro Carvalho Chehab <mchehab@s-opensource.com>
8 years ago[media] mb86a20s: apply mask to val after checking for read failure
Colin Ian King [Fri, 15 Jul 2016 15:59:15 +0000 (12:59 -0300)]
[media] mb86a20s: apply mask to val after checking for read failure

Appling the mask 0x0f to the immediate return of the call to
mb86a20s_readreg will always result in a positive value, meaning that the
check of ret < 0 will never work.  Instead, check for a -ve return value
first, and then mask val with 0x0f.

Kudos to Mauro Carvalho Chehab for spotting the mistake in my original fix.

Signed-off-by: Colin Ian King <colin.king@canonical.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab@s-opensource.com>
8 years ago[media] airspy: fix error logic during device register
James Patrick-Evans [Fri, 15 Jul 2016 15:40:45 +0000 (12:40 -0300)]
[media] airspy: fix error logic during device register

This patch addresses CVE-2016-5400, a local DOS vulnerability caused by
a memory leak in the airspy usb device driver.

The vulnerability is triggered when more than 64 usb devices register
with v4l2 of type VFL_TYPE_SDR or VFL_TYPE_SUBDEV.A badusb device can
emulate 64 of these devices then through continual emulated
connect/disconnect of the 65th device, cause the kernel to run out of
RAM and crash the kernel.

The vulnerability exists in kernel versions from 3.17 to current 4.7.

The memory leak is caused by the probe function of the airspy driver
mishandeling errors and not freeing the corresponding control structures
when an error occours registering the device to v4l2 core.

Signed-off-by: James Patrick-Evans <james@jmp-e.com>
Cc: stable@vger.kernel.org # Up to Kernel 3.17
Signed-off-by: Mauro Carvalho Chehab <mchehab@s-opensource.com>
8 years ago[media] s5p-cec/TODO: add TODO item
Hans Verkuil [Fri, 15 Jul 2016 15:11:54 +0000 (12:11 -0300)]
[media] s5p-cec/TODO: add TODO item

Mention that the HDMI driver should pass on the physical address
to this driver, rather than requiring userspace to do this.

Signed-off-by: Hans Verkuil <hans.verkuil@cisco.com>
Cc: Kamil Debski <k.debski@samsung.com>
Cc: Marek Szyprowski <m.szyprowski@samsung.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab@s-opensource.com>
8 years ago[media] cec/TODO: drop comment about sphinx documentation
Hans Verkuil [Fri, 15 Jul 2016 15:11:11 +0000 (12:11 -0300)]
[media] cec/TODO: drop comment about sphinx documentation

The CEC documentation has been converted to sphinx, so this
TODO item can be dropped.

Signed-off-by: Hans Verkuil <hans.verkuil@cisco.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab@s-opensource.com>
8 years ago[media] cec: set timestamp for selfie transmits
Hans Verkuil [Fri, 15 Jul 2016 14:13:49 +0000 (11:13 -0300)]
[media] cec: set timestamp for selfie transmits

Attempts to send CEC messages to yourself are detected in the framework and
returned with a NACK error. However, the tx_ts was never filled in that case.
So just set it.

Signed-off-by: Hans Verkuil <hans.verkuil@cisco.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab@s-opensource.com>
8 years ago[media] vivid: fix typo causing incorrect CEC physical addresses
Hans Verkuil [Thu, 14 Jul 2016 09:31:32 +0000 (06:31 -0300)]
[media] vivid: fix typo causing incorrect CEC physical addresses

Fix typo in vivid that caused all HDMI outputs to have the same
physical address.

Signed-off-by: Hans Verkuil <hans.verkuil@cisco.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab@s-opensource.com>
8 years ago[media] mtk-vcodec: fix default OUTPUT buffer size
Tiffany Lin [Wed, 13 Jul 2016 08:05:23 +0000 (05:05 -0300)]
[media] mtk-vcodec: fix default OUTPUT buffer size

When calculate OUTPUT buffer size in vidioc_try_fmt, it will
add more size hw need in each plane.
But in mtk_vcodec_enc_set_default_params, it do not add
same size in each plane.
This makes v4l2-compliance test fail.
This patch fix the issue.

Signed-off-by: Tiffany Lin <tiffany.lin@mediatek.com>
Signed-off-by: Hans Verkuil <hans.verkuil@cisco.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab@s-opensource.com>
8 years ago[media] cec: don't zero reply and timeout on error
Hans Verkuil [Wed, 13 Jul 2016 07:33:58 +0000 (04:33 -0300)]
[media] cec: don't zero reply and timeout on error

There is really no reason to zero the reply and timeout fields if an
error occurs. This is a left-over from earlier versions where that
was used to signal errors, but this is now handled by the rx/tx_status
fields.

Signed-off-by: Hans Verkuil <hans.verkuil@cisco.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab@s-opensource.com>
8 years ago[media] mtk-vcodec: fix more type mismatches
Arnd Bergmann [Wed, 13 Jul 2016 08:47:40 +0000 (05:47 -0300)]
[media] mtk-vcodec: fix more type mismatches

The newly added mtk-vcodec driver produces a number of warnings in an
ARM allmodconfig build, mainly since it assumes that dma_addr_t is
32-bit wide:

mtk-vcodec/venc/venc_vp8_if.c: In function 'vp8_enc_alloc_work_buf':
mtk-vcodec/venc/venc_vp8_if.c:212:191: error: cast to pointer from integer of different size [-Werror=int-to-pointer-cast]
mtk-vcodec/venc/venc_h264_if.c: In function 'h264_enc_alloc_work_buf':
mtk-vcodec/venc/venc_h264_if.c:297:190: error: cast to pointer from integer of different size [-Werror=int-to-pointer-cast]

This rearranges the format strings and type casts to what they should
have been in order to avoid the warnings. e0f80d8d62f5 ("[media]
mtk-vcodec: fix two compiler warnings") fixed some of the problems that
were introduced at the same time, but missed two others.

Signed-off-by: Arnd Bergmann <arnd@arndb.de>
Signed-off-by: Mauro Carvalho Chehab <mchehab@s-opensource.com>
8 years ago[media] redrat3: make hardware timeout configurable
Sean Young [Sun, 10 Jul 2016 16:34:38 +0000 (13:34 -0300)]
[media] redrat3: make hardware timeout configurable

Instead of hardcoding a timeout, let userspace change it dynamically
by adding a s_timeout ops.

Signed-off-by: Sean Young <sean@mess.org>
Signed-off-by: Mauro Carvalho Chehab <mchehab@s-opensource.com>
8 years ago[media] redrat3: fix timeout handling
Sean Young [Sun, 10 Jul 2016 16:34:37 +0000 (13:34 -0300)]
[media] redrat3: fix timeout handling

The redrat3 sends an usb packet to the host either when the minimum pause
or the timeout occurs, so we can always add a trailing space in our
processing.

Signed-off-by: Sean Young <sean@mess.org>
Signed-off-by: Mauro Carvalho Chehab <mchehab@s-opensource.com>
8 years ago[media] rc: make s_tx_carrier consistent
Sean Young [Sun, 10 Jul 2016 16:34:33 +0000 (13:34 -0300)]
[media] rc: make s_tx_carrier consistent

LIRC_SET_SEND_CARRIER should return 0 on success or -errno.

Signed-off-by: Sean Young <sean@mess.org>
Signed-off-by: Mauro Carvalho Chehab <mchehab@s-opensource.com>
8 years ago[media] rc: make s_tx_mask consistent
Sean Young [Sun, 10 Jul 2016 16:34:32 +0000 (13:34 -0300)]
[media] rc: make s_tx_mask consistent

When s_tx_mask is given an invalid bitmask, the number of transmitters
should be returned. See the LIRC_SET_TRANSMITTER_MASK lirc ioctl
documentation.

Signed-off-by: Sean Young <sean@mess.org>
Signed-off-by: Mauro Carvalho Chehab <mchehab@s-opensource.com>
8 years ago[media] af9035: fix dual tuner detection with PCTV 79e
Stefan Pöschel [Mon, 11 Jul 2016 17:31:59 +0000 (14:31 -0300)]
[media] af9035: fix dual tuner detection with PCTV 79e

The value 5 of the EEPROM_TS_MODE register (meaning dual tuner presence) is
only valid for AF9035 devices. For IT9135 devices it is invalid and led to a
false positive dual tuner mode detection with PCTV 79e.
Therefore on non-AF9035 devices and with value 5 the driver now defaults to
single tuner mode and outputs a regarding info message to log.

This fixes Bugzilla bug #118561.

Reported-by: Marc Duponcheel <marc@offline.be>
Signed-off-by: Stefan Pöschel <basic.master@gmx.de>
Signed-off-by: Antti Palosaari <crope@iki.fi>
Signed-off-by: Mauro Carvalho Chehab <mchehab@s-opensource.com>
8 years ago[media] rc: nuvoton: fix hang if chip is configured for alternative EFM IO address
Heiner Kallweit [Thu, 7 Jul 2016 06:17:39 +0000 (03:17 -0300)]
[media] rc: nuvoton: fix hang if chip is configured for alternative EFM IO address

If a system configures the Nuvoton chip to use the alternative
EFM IO address (CR_EFIR2) then after probing the primary EFM IO
address (CR_EFIR) this region is not released.

If a driver for another function of the Nuvoton Super I/O
chip uses the same probing mechanism then it will hang if
loaded after the nuvoton-cir driver.
This was reported for the nct6775 hwmon driver.

Fix this by properly releasing the region after probing CR_EFIR.
This regression was introduced with kernel 4.6 so cc it to stable.

Reported-by: Antti Seppälä <a.seppala@gmail.com>
Signed-off-by: Heiner Kallweit <hkallweit1@gmail.com>
Tested-by: Antti Seppälä <a.seppala@gmail.com>
Cc: <stable@vger.kernel.org> # 4.6.x-
Signed-off-by: Mauro Carvalho Chehab <mchehab@s-opensource.com>
8 years ago[media] dvb-core/en50221: use kref to manage struct dvb_ca_private
Max Kellermann [Mon, 4 Jul 2016 12:08:45 +0000 (14:08 +0200)]
[media] dvb-core/en50221: use kref to manage struct dvb_ca_private

Don't free the object until the file handle has been closed.  Fixes
use-after-free bug which occurs when I disconnect my DVB-S received
while VDR is running.

This is a crash dump of such a use-after-free:

    general protection fault: 0000 [#1] SMP
    CPU: 0 PID: 2541 Comm: CI adapter on d Not tainted 4.7.0-rc1-hosting+ #49
    Hardware name: Bochs Bochs, BIOS Bochs 01/01/2011
    task: ffff880027d7ce00 ti: ffff88003d8f8000 task.ti: ffff88003d8f8000
    RIP: 0010:[<ffffffff812f3d1f>]  [<ffffffff812f3d1f>] dvb_ca_en50221_io_read_condition.isra.7+0x6f/0x150
    RSP: 0018:ffff88003d8fba98  EFLAGS: 00010206
    RAX: 0000000059534255 RBX: 000000753d470f90 RCX: ffff88003c74d181
    RDX: 00000001bea04ba9 RSI: ffff88003d8fbaf4 RDI: 3a3030a56d763fc0
    RBP: ffff88003d8fbae0 R08: ffff88003c74d180 R09: 0000000000000000
    R10: 0000000000000001 R11: 0000000000000000 R12: ffff88003c480e00
    R13: 00000000ffffffff R14: 0000000059534255 R15: 0000000000000000
    FS:  00007fb4209b4700(0000) GS:ffff88003fc00000(0000) knlGS:0000000000000000
    CS:  0010 DS: 0000 ES: 0000 CR0: 0000000080050033
    CR2: 00007f06445f4078 CR3: 000000003c55b000 CR4: 00000000000006b0
    Stack:
     ffff88003d8fbaf4 000000003c2170c0 0000000000004000 0000000000000000
     ffff88003c480e00 ffff88003d8fbc80 ffff88003c74d180 ffff88003d8fbb8c
     0000000000000000 ffff88003d8fbb10 ffffffff812f3e37 ffff88003d8fbb00
    Call Trace:
     [<ffffffff812f3e37>] dvb_ca_en50221_io_poll+0x37/0xa0
     [<ffffffff8113109b>] do_sys_poll+0x2db/0x520

This is a backtrace of the kernel attempting to lock a freed mutex:

    #0  0xffffffff81083d40 in rep_nop () at ./arch/x86/include/asm/processor.h:569
    #1  cpu_relax () at ./arch/x86/include/asm/processor.h:574
    #2  virt_spin_lock (lock=<optimized out>) at ./arch/x86/include/asm/qspinlock.h:57
    #3  native_queued_spin_lock_slowpath (lock=0xffff88003c480e90, val=761492029) at kernel/locking/qspinlock.c:304
    #4  0xffffffff810d1a06 in pv_queued_spin_lock_slowpath (val=<optimized out>, lock=<optimized out>) at ./arch/x86/include/asm/paravirt.h:669
    #5  queued_spin_lock_slowpath (val=<optimized out>, lock=<optimized out>) at ./arch/x86/include/asm/qspinlock.h:28
    #6  queued_spin_lock (lock=<optimized out>) at include/asm-generic/qspinlock.h:107
    #7  __mutex_lock_common (use_ww_ctx=<optimized out>, ww_ctx=<optimized out>, ip=<optimized out>, nest_lock=<optimized out>, subclass=<optimized out>,
        state=<optimized out>, lock=<optimized out>) at kernel/locking/mutex.c:526
    #8  mutex_lock_interruptible_nested (lock=0xffff88003c480e88, subclass=<optimized out>) at kernel/locking/mutex.c:647
    #9  0xffffffff812f49fe in dvb_ca_en50221_io_do_ioctl (file=<optimized out>, cmd=761492029, parg=0x1 <irq_stack_union+1>)
        at drivers/media/dvb-core/dvb_ca_en50221.c:1210
    #10 0xffffffff812ee660 in dvb_usercopy (file=<optimized out>, cmd=761492029, arg=<optimized out>, func=<optimized out>) at drivers/media/dvb-core/dvbdev.c:883
    #11 0xffffffff812f3410 in dvb_ca_en50221_io_ioctl (file=<optimized out>, cmd=<optimized out>, arg=<optimized out>) at drivers/media/dvb-core/dvb_ca_en50221.c:1284
    #12 0xffffffff8112eddd in vfs_ioctl (arg=<optimized out>, cmd=<optimized out>, filp=<optimized out>) at fs/ioctl.c:43
    #13 do_vfs_ioctl (filp=0xffff88003c480e90, fd=<optimized out>, cmd=<optimized out>, arg=<optimized out>) at fs/ioctl.c:674
    #14 0xffffffff8112f30c in SYSC_ioctl (arg=<optimized out>, cmd=<optimized out>, fd=<optimized out>) at fs/ioctl.c:689
    #15 SyS_ioctl (fd=6, cmd=2148298626, arg=140734533693696) at fs/ioctl.c:680
    #16 0xffffffff8103feb2 in entry_SYSCALL_64 () at arch/x86/entry/entry_64.S:207

Signed-off-by: Max Kellermann <max@duempel.org>
Signed-off-by: Mauro Carvalho Chehab <mchehab@s-opensource.com>
8 years ago[media] dvb_frontend: eliminate blocking wait in dvb_unregister_frontend()
Max Kellermann [Mon, 4 Jul 2016 12:08:51 +0000 (09:08 -0300)]
[media] dvb_frontend: eliminate blocking wait in dvb_unregister_frontend()

The wait_event() call in dvb_unregister_frontend() waits synchronously
for other tasks to free a file descriptor, but it does that while
holding several mutexes.  That alone is a bad idea, but if one user
process happens to keep a (defunct) file descriptor open indefinitely,
the kernel will correctly detect a hung task:

    INFO: task kworker/0:1:314 blocked for more than 30 seconds.
          Not tainted 4.7.0-rc1-hosting+ #50
    "echo 0 > /proc/sys/kernel/hung_task_timeout_secs" disables this message.
    kworker/0:1     D ffff88003daf7a50     0   314      2 0x00000000
    Workqueue: usb_hub_wq hub_event
     ffff88003daf7a50 0000000000000296 ffff88003daf7a30 ffff88003fc13f98
     ffff88003dadce00 ffff88003daf8000 ffff88003e3fc010 ffff88003d48d4f8
     ffff88003e3b5030 ffff88003e3f8898 ffff88003daf7a68 ffffffff810cf860
    Call Trace:
     [<ffffffff810cf860>] schedule+0x30/0x80
     [<ffffffff812f88d3>] dvb_unregister_frontend+0x93/0xc0
     [<ffffffff8107a000>] ? __wake_up_common+0x80/0x80
     [<ffffffff813019c7>] dvb_usb_adapter_frontend_exit+0x37/0x70
     [<ffffffff81300614>] dvb_usb_exit+0x34/0xb0
     [<ffffffff81300d4a>] dvb_usb_device_exit+0x3a/0x50
     [<ffffffff81302dc2>] pctv452e_usb_disconnect+0x52/0x60
     [<ffffffff81295a07>] usb_unbind_interface+0x67/0x1e0
     [<ffffffff810609f3>] ? __blocking_notifier_call_chain+0x53/0x70
     [<ffffffff8127ba67>] __device_release_driver+0x77/0x110
     [<ffffffff8127c2d3>] device_release_driver+0x23/0x30
     [<ffffffff8127ab5d>] bus_remove_device+0x10d/0x150
     [<ffffffff8127879b>] device_del+0x13b/0x260
     [<ffffffff81299dea>] ? usb_remove_ep_devs+0x1a/0x30
     [<ffffffff8129468e>] usb_disable_device+0x9e/0x1e0
     [<ffffffff8128bb09>] usb_disconnect+0x89/0x260
     [<ffffffff8128db8d>] hub_event+0x30d/0xfc0
     [<ffffffff81059475>] process_one_work+0x1c5/0x4a0
     [<ffffffff8105940c>] ? process_one_work+0x15c/0x4a0
     [<ffffffff81059799>] worker_thread+0x49/0x480
     [<ffffffff81059750>] ? process_one_work+0x4a0/0x4a0
     [<ffffffff81059750>] ? process_one_work+0x4a0/0x4a0
     [<ffffffff8105f65e>] kthread+0xee/0x110
     [<ffffffff810400bf>] ret_from_fork+0x1f/0x40
     [<ffffffff8105f570>] ? __kthread_unpark+0x70/0x70
    5 locks held by kworker/0:1/314:
     #0:  ("usb_hub_wq"){......}, at: [<ffffffff8105940c>] process_one_work+0x15c/0x4a0
     #1:  ((&hub->events)){......}, at: [<ffffffff8105940c>] process_one_work+0x15c/0x4a0
     #2:  (&dev->mutex){......}, at: [<ffffffff8128d8cb>] hub_event+0x4b/0xfc0
     #3:  (&dev->mutex){......}, at: [<ffffffff8128bad2>] usb_disconnect+0x52/0x260
     #4:  (&dev->mutex){......}, at: [<ffffffff8127c2cb>] device_release_driver+0x1b/0x30

This patch removes the blocking wait, and postpones the kfree() call
until all file handles have been closed by using struct kref.

Signed-off-by: Max Kellermann <max@duempel.org>
Signed-off-by: Mauro Carvalho Chehab <mchehab@s-opensource.com>
8 years ago[media] drivers: staging: media: lirc: lirc_parallel: Fix multiline comments by addin...
Aayush Gupta [Sat, 2 Jul 2016 12:58:53 +0000 (09:58 -0300)]
[media] drivers: staging: media: lirc: lirc_parallel: Fix multiline comments by adding trailing '*'

Signed-off-by: Aayush Gupta <aayustark007@gmail.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab@s-opensource.com>
8 years ago[media] lirc_dev: use LIRC_CAN_REC() define to check if the device can receive
Andi Shyti [Wed, 6 Jul 2016 09:01:27 +0000 (06:01 -0300)]
[media] lirc_dev: use LIRC_CAN_REC() define to check if the device can receive

The LIRC_CAN_REC() returns a boolean "flag & LIRC_CAN_REC_MASK"
to check whether the device can receive data.

Signed-off-by: Andi Shyti <andi.shyti@samsung.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab@s-opensource.com>
8 years ago[media] lirc_dev: fix potential segfault
Andi Shyti [Wed, 6 Jul 2016 09:01:26 +0000 (06:01 -0300)]
[media] lirc_dev: fix potential segfault

When opening or closing a lirc character device, the framework
provides to the user the possibility to keep track of opening or
closing of the device by calling two functions:

 - set_use_inc() when opening the device
 - set_use_dec() when closing the device

if those are not set by the lirc user, the system segfaults.
Check the pointer value before calling the above functions.

Signed-off-by: Andi Shyti <andi.shyti@samsung.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab@s-opensource.com>
8 years ago[media] lirc_dev: extremely trivial comment style fix
Andi Shyti [Wed, 6 Jul 2016 09:01:25 +0000 (06:01 -0300)]
[media] lirc_dev: extremely trivial comment style fix

Signed-off-by: Andi Shyti <andi.shyti@samsung.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab@s-opensource.com>
8 years ago[media] lirc_dev: fix error return value
Andi Shyti [Wed, 6 Jul 2016 09:01:24 +0000 (06:01 -0300)]
[media] lirc_dev: fix error return value

If ioctl is called, it cannot be a case of invalid system call
number (ENOSYS), that is a ENOTTY case which means that the
device doesn't support that specific ioctl command.

So, replace ENOSYS with ENOTTY.

Signed-off-by: Andi Shyti <andi.shyti@samsung.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab@s-opensource.com>
8 years ago[media] lirc_dev: fix variable constant comparisons
Andi Shyti [Wed, 6 Jul 2016 09:01:23 +0000 (06:01 -0300)]
[media] lirc_dev: fix variable constant comparisons

When comparing a variable with a constant, the comparison should
start from the variable and not from the constant. It's also
written in the human DNA.

Swap the terms of comparisons whenever the constant comes first
and fix the following checkpatch warning:

  WARNING: Comparisons should place the constant on the right side of the test

Signed-off-by: Andi Shyti <andi.shyti@samsung.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab@s-opensource.com>
8 years ago[media] lirc_dev: merge three if statements in only one
Andi Shyti [Wed, 6 Jul 2016 09:01:21 +0000 (06:01 -0300)]
[media] lirc_dev: merge three if statements in only one

The three if statements check the same thing, merge them in only
one statement.

Signed-off-by: Andi Shyti <andi.shyti@samsung.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab@s-opensource.com>
8 years ago[media] lirc_dev: remove double if ... else statement
Andi Shyti [Wed, 6 Jul 2016 09:01:20 +0000 (06:01 -0300)]
[media] lirc_dev: remove double if ... else statement

There are two if ... else which check the same thing in different
part of the code, they can be merged in a single check.

Signed-off-by: Andi Shyti <andi.shyti@samsung.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab@s-opensource.com>
8 years ago[media] lirc_dev: simplify if statement in lirc_add_to_buf
Andi Shyti [Wed, 6 Jul 2016 09:01:19 +0000 (06:01 -0300)]
[media] lirc_dev: simplify if statement in lirc_add_to_buf

The whole function is inside an 'if' statement
("if (ir->d.add_to_buf)").

Check the opposite of that statement at the beginning and exit,
this way we can have one level less of indentation.

Signed-off-by: Andi Shyti <andi.shyti@samsung.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab@s-opensource.com>
8 years ago[media] lirc_dev: do not use goto to create loops
Andi Shyti [Wed, 6 Jul 2016 09:01:18 +0000 (06:01 -0300)]
[media] lirc_dev: do not use goto to create loops

... use "do .. while" instead.

Signed-off-by: Andi Shyti <andi.shyti@samsung.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab@s-opensource.com>
8 years ago[media] lirc_dev: simplify goto paths
Andi Shyti [Wed, 6 Jul 2016 09:01:17 +0000 (06:01 -0300)]
[media] lirc_dev: simplify goto paths

The code can be rearranged so that some goto paths can be removed

Signed-off-by: Andi Shyti <andi.shyti@samsung.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab@s-opensource.com>
8 years ago[media] lirc_dev: replace printk with pr_* or dev_*
Andi Shyti [Wed, 6 Jul 2016 09:01:16 +0000 (06:01 -0300)]
[media] lirc_dev: replace printk with pr_* or dev_*

This patch mutes also all the checkpatch warnings related to
printk.

Reword all the printouts so that the string doesn't need to be
split, which fixes the following checkpatch warning:

  WARNING: quoted string split across lines

Signed-off-by: Andi Shyti <andi.shyti@samsung.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab@s-opensource.com>
8 years ago[media] lirc_dev: remove unnecessary debug prints
Andi Shyti [Wed, 6 Jul 2016 09:01:15 +0000 (06:01 -0300)]
[media] lirc_dev: remove unnecessary debug prints

Signed-off-by: Andi Shyti <andi.shyti@samsung.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab@s-opensource.com>
8 years ago[media] lirc_dev: allow bufferless driver registration
Andi Shyti [Wed, 6 Jul 2016 09:01:14 +0000 (06:01 -0300)]
[media] lirc_dev: allow bufferless driver registration

Transmitters don't necessarily need to have a FIFO managed buffer
for their transfers.

When registering the driver, before allocating the buffer, check
whether the device is a transmitter or receiver. Allocate the
buffer only for receivers.

Signed-off-by: Andi Shyti <andi.shyti@samsung.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab@s-opensource.com>
8 years ago[media] lirc_dev: place buffer allocation on separate function
Andi Shyti [Wed, 6 Jul 2016 09:01:13 +0000 (06:01 -0300)]
[media] lirc_dev: place buffer allocation on separate function

During the driver registration, move the buffer allocation on a
separate function.

Signed-off-by: Andi Shyti <andi.shyti@samsung.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab@s-opensource.com>
8 years ago[media] vsp1: clarify FCP dependency
Arnd Bergmann [Thu, 30 Jun 2016 12:23:03 +0000 (09:23 -0300)]
[media] vsp1: clarify FCP dependency

The newly added FCP support in the vsp1 driver causes a link error
when CONFIG_RENESAS_FCP=m, since it's not reachable by built-in code:

drivers/media/built-in.o: In function `vsp1_remove':
:(.text+0xdeca0): undefined reference to `rcar_fcp_put'
drivers/media/built-in.o: In function `vsp1_probe':
:(.text+0xdef44): undefined reference to `rcar_fcp_get'

We already have a conditional dependency on FCP that requires
it for ARM64, so for all others we just have to prevent setting
RENESAS_VSP1=y when RENESAS_FCP=m by extending the FCP dependency.

Fixes: 94fcdf829793 ("[media] v4l: vsp1: Add FCP support")

Signed-off-by: Arnd Bergmann <arnd@arndb.de>
Signed-off-by: Mauro Carvalho Chehab <mchehab@s-opensource.com>
8 years ago[media] vsp1: use __maybe_unused for PM handlers
Arnd Bergmann [Thu, 30 Jun 2016 12:23:02 +0000 (09:23 -0300)]
[media] vsp1: use __maybe_unused for PM handlers

Building without CONFIG_PM results in a harmless warning from
slightly incorrect #ifdef guards:

drivers/media/platform/vsp1/vsp1_drv.c:525:12: error: 'vsp1_pm_runtime_resume' defined but not used [-Werror=unused-function]
drivers/media/platform/vsp1/vsp1_drv.c:516:12: error: 'vsp1_pm_runtime_suspend' defined but not used [-Werror=unused-function]

This removes the existing #ifdef and instead marks all four
PM functions as __maybe_unused.

Fixes: 1e6af546ee66 ("[media] v4l: vsp1: Implement runtime PM support")

Signed-off-by: Arnd Bergmann <arnd@arndb.de>
Signed-off-by: Mauro Carvalho Chehab <mchehab@s-opensource.com>
8 years agoMerge branch 'topic/vsp1' into patchwork
Mauro Carvalho Chehab [Wed, 13 Jul 2016 16:43:48 +0000 (13:43 -0300)]
Merge branch 'topic/vsp1' into patchwork

* topic/vsp1: (36 commits)
  [media] v4l: vsp1: wpf: Add flipping support
  [media] v4l: vsp1: rwpf: Support runtime modification of controls
  [media] v4l: vsp1: Simplify alpha propagation
  [media] v4l: vsp1: clu: Support runtime modification of controls
  [media] v4l: vsp1: lut: Support runtime modification of controls
  [media] v4l: vsp1: Support runtime modification of controls
  [media] v4l: vsp1: Add Cubic Look Up Table (CLU) support
  [media] v4l: vsp1: lut: Expose configuration through a control
  [media] v4l: vsp1: lut: Initialize the mutex
  [media] v4l: vsp1: dl: Don't free fragments with interrupts disabled
  [media] v4l: vsp1: Set entities functions
  [media] v4l: vsp1: Don't create LIF entity when the userspace API is enabled
  [media] v4l: vsp1: Don't register media device when userspace API is disabled
  [media] v4l: vsp1: Base link creation on availability of entities
  [media] media: Add video statistics computation functions
  [media] media: Add video processing entity functions
  [media] v4l: vsp1: sru: Fix intensity control ID
  [media] v4l: vsp1: Stop the pipeline upon the first STREAMOFF
  [media] v4l: vsp1: Constify operation structures
  [media] v4l: vsp1: pipe: Fix typo in comment
  ...

8 years ago[media] tw686x: Support VIDIOC_{S,G}_PARM ioctls
Ezequiel Garcia [Wed, 29 Jun 2016 02:17:35 +0000 (23:17 -0300)]
[media] tw686x: Support VIDIOC_{S,G}_PARM ioctls

Now that the frame rate can be properly set, this commit adds support
for S_PARM and G_PARM.

Signed-off-by: Ezequiel Garcia <ezequiel@vanguardiasur.com.ar>
Signed-off-by: Mauro Carvalho Chehab <mchehab@s-opensource.com>
8 years ago[media] tw686x: use a formula instead of two tables for div
Mauro Carvalho Chehab [Wed, 29 Jun 2016 02:17:34 +0000 (23:17 -0300)]
[media] tw686x: use a formula instead of two tables for div

Instead of using two tables to estimate the temporal decimation
factor, use a formula. This allows to get the closest fps, which
sounds better than the current tables.

Also, the current code doesn't store the real framerate.

This patch fixes the above issues.

[Ezequiel:
  - introduce a TW686X_MAX_FPS macro for max_fps.
  - use hweight_long instead of open coding the set bits count.]

Signed-off-by: Mauro Carvalho Chehab <mchehab@osg.samsung.com>
Signed-off-by: Ezequiel Garcia <ezequiel@vanguardiasur.com.ar>
Signed-off-by: Mauro Carvalho Chehab <mchehab@s-opensource.com>
8 years ago[media] dvb-usb: silence an uninitialized variable warning
Dan Carpenter [Mon, 27 Jun 2016 14:29:46 +0000 (11:29 -0300)]
[media] dvb-usb: silence an uninitialized variable warning

My static checker complains that if adap->props.num_frontends is 0 then
"ret" is uninitialized.  I don't think that can happen.  But "ret" is
always zero here so we can just remove the condition.

This extra check was added in commit 0d3ab8410dcb ('[media] dvb core:
must check dvb_create_media_graph()').

Signed-off-by: Dan Carpenter <dan.carpenter@oracle.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab@s-opensource.com>
8 years ago[media] netup_unidvb: trivial fix of spelling mistake "initizalize" -> "initialize"
Colin Ian King [Fri, 24 Jun 2016 18:00:24 +0000 (15:00 -0300)]
[media] netup_unidvb: trivial fix of spelling mistake "initizalize" -> "initialize"

trivial fix to spelling mistake in dev_err message

Signed-off-by: Colin Ian King <colin.king@canonical.com>
Acked-by: Abylay Ospan <aospan@netup.ru>
Signed-off-by: Mauro Carvalho Chehab <mchehab@s-opensource.com>
8 years ago[media] dw2102: add USB ID for Terratec Cinergy S2 Rev.3
Olli Salonen [Mon, 13 Jun 2016 14:04:50 +0000 (11:04 -0300)]
[media] dw2102: add USB ID for Terratec Cinergy S2 Rev.3

Add the USB ID for Terratec Cinergy S2 Rev.3 (0ccd:0102).

Curiously dvb-usb-ids included already the USB ID for TERRATEC_CINERGY_S2_R3 even if the device was not supported.

Reported-by: Christian Knippel <namerp@googlemail.com>
Signed-off-by: Olli Salonen <olli.salonen@iki.fi>
Signed-off-by: Mauro Carvalho Chehab <mchehab@s-opensource.com>
8 years ago[media] ascot2e: Fix I2C message size check
Saso Slavicic [Wed, 13 Jul 2016 14:56:22 +0000 (11:56 -0300)]
[media] ascot2e: Fix I2C message size check

Tuning a card with Sony ASCOT2E produces the following error:

kernel: i2c i2c-9: wr reg=0006: len=11 is too big!

MAX_WRITE_REGSIZE is defined as 10, buf[MAX_WRITE_REGSIZE + 1] buffer is
used in ascot2e_write_regs().

The problem is that exactly 10 bytes are written in ascot2e_set_params():

/* Set BW_OFFSET (0x0F) value from parameter table */
data[9] = ascot2e_sett[tv_system].bw_offset;
ascot2e_write_regs(priv, 0x06, data, 10);

The test in write_regs is as follows:

if (len + 1 >= sizeof(buf))

10 + 1 = 11 and that would be exactly the size of buf. Since 10 bytes +
buf[0] = reg would seem to fit into buf[], this shouldn't be an error.

Signed-off-by: Mauro Carvalho Chehab <mchehab@s-opensource.com>
8 years ago[media] pulse8-cec: fix non static symbol warning
Wei Yongjun [Wed, 13 Jul 2016 12:45:00 +0000 (09:45 -0300)]
[media] pulse8-cec: fix non static symbol warning

Fixes the following sparse warning:

drivers/staging/media/pulse8-cec/pulse8-cec.c:427:27: warning:
 symbol 'pulse8_cec_adap_ops' was not declared. Should it be static?

Signed-off-by: Wei Yongjun <yongjun_wei@trendmicro.com.cn>
Signed-off-by: Mauro Carvalho Chehab <mchehab@s-opensource.com>
8 years ago[media] mtk-vcodec: remove redundant dev_err call in mtk_vcodec_probe()
Wei Yongjun [Tue, 12 Jul 2016 11:02:59 +0000 (08:02 -0300)]
[media] mtk-vcodec: remove redundant dev_err call in mtk_vcodec_probe()

There is a error message within devm_ioremap_resource
already, so remove the dev_err call to avoid redundant
error message.

Signed-off-by: Wei Yongjun <yongjun_wei@trendmicro.com.cn>
Reviewed-by: Tiffany Lin <tiffany.lin@mediatek.com>
Signed-off-by: Hans Verkuil <hans.verkuil@cisco.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab@s-opensource.com>
8 years ago[media] vcodec: mediatek: Fix return value check in mtk_vcodec_init_enc_pm()
Wei Yongjun [Tue, 12 Jul 2016 11:02:28 +0000 (08:02 -0300)]
[media] vcodec: mediatek: Fix return value check in mtk_vcodec_init_enc_pm()

In case of error, the function devm_clk_get() returns ERR_PTR()
and not 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: Hans Verkuil <hans.verkuil@cisco.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab@s-opensource.com>
8 years ago[media] VPU: mediatek: remove redundant dev_err call in mtk_vpu_probe()
Wei Yongjun [Tue, 12 Jul 2016 11:01:26 +0000 (08:01 -0300)]
[media] VPU: mediatek: remove redundant dev_err call in mtk_vpu_probe()

There is a error message within devm_ioremap_resource
already, so remove the dev_err call to avoid redundant
error message.

Signed-off-by: Wei Yongjun <yongjun_wei@trendmicro.com.cn>
Signed-off-by: Hans Verkuil <hans.verkuil@cisco.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab@s-opensource.com>
8 years ago[media] VPU: mediatek: fix return value check in mtk_vpu_probe()
Wei Yongjun [Tue, 12 Jul 2016 11:00:55 +0000 (08:00 -0300)]
[media] VPU: mediatek: fix return value check in mtk_vpu_probe()

In case of error, the function devm_clk_get() returns ERR_PTR()
and not 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: Hans Verkuil <hans.verkuil@cisco.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab@s-opensource.com>
8 years ago[media] cec: split the timestamp into an rx and tx timestamp
Hans Verkuil [Tue, 12 Jul 2016 14:10:42 +0000 (11:10 -0300)]
[media] cec: split the timestamp into an rx and tx timestamp

When transmitting a message and waiting for a reply it would be good
to know the time between when the message was transmitted and when
the reply arrived. With only one timestamp field it was set to when
the reply arrived and the original transmit time was overwritten.

Just taking the timestamp in userspace right before CEC_TRANSMIT is
called is not reliable, since the actual transmit can be delayed if
the CEC bus is busy. Only the driver can fill this in accurately.

So split up the ts field into an rx_ts and a tx_ts. Also move the
status fields to after the 'reply' field: they were placed in a
strange position and make much more sense when grouped with the
other status-related fields.

This patch also makes sure that the timestamp is taken as soon as
possible.

Signed-off-by: Hans Verkuil <hans.verkuil@cisco.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab@s-opensource.com>
8 years ago[media] cec: add sanity check for msg->len
Hans Verkuil [Tue, 12 Jul 2016 14:10:41 +0000 (11:10 -0300)]
[media] cec: add sanity check for msg->len

Check (and warn) if the msg->len is too long or if it is 0.

Should never happen, but just in case...

Signed-off-by: Hans Verkuil <hans.verkuil@cisco.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab@s-opensource.com>
8 years ago[media] Remove spurious blank lines in dw2101 kernel messages
Jonathan McDowell [Mon, 6 Jun 2016 13:23:59 +0000 (10:23 -0300)]
[media] Remove spurious blank lines in dw2101 kernel messages

The DW2102 DVB-S/S2 driver uses the info() logging function from
dvb-usb.h. This function already appends a newline to the provided log
message, causing the dmesg output from DW2102 to include blank lines.
Fix this by removing the newline in the calls to info().

Signed-off-by: Jonathan McDowell <noodles@earth.li>
Signed-off-by: Mauro Carvalho Chehab <mchehab@s-opensource.com>
8 years ago[media] c8sectpfe: fix memory leak
Sudip Mukherjee [Thu, 2 Jun 2016 13:32:55 +0000 (10:32 -0300)]
[media] c8sectpfe: fix memory leak

We have assigned memory while requesting the firmware but if the sanity
check fails then we are not releasing the firmware.

Signed-off-by: Sudip Mukherjee <sudip.mukherjee@codethink.co.uk>
Signed-off-by: Mauro Carvalho Chehab <mchehab@s-opensource.com>
8 years ago[media] cec-adap.c: work around gcc-4.4.4 anon union initializer bug
Andrew Morton [Tue, 12 Jul 2016 22:30:55 +0000 (15:30 -0700)]
[media] cec-adap.c: work around gcc-4.4.4 anon union initializer bug

drivers/staging/media/cec/cec-adap.c: In function 'cec_queue_msg_fh':
drivers/staging/media/cec/cec-adap.c:141: error: unknown field 'lost_msgs' specified in initializer

Fixes: 9881fe0ca187c21 ("[media] cec: add HDMI CEC framework (adapter)")
Cc: Hans Verkuil <hans.verkuil@cisco.com>
Cc: Kamil Debski <kamil@wypas.org>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Mauro Carvalho Chehab <mchehab@s-opensource.com>
8 years ago[media] pulse8-cec: declare function as static
Mauro Carvalho Chehab [Tue, 12 Jul 2016 16:46:20 +0000 (13:46 -0300)]
[media] pulse8-cec: declare function as static

drivers/staging/media/pulse8-cec/pulse8-cec.c:104:6: warning: no previous prototype for 'pulse8_irq_work_handler' [-Wmissing-prototypes]
 void pulse8_irq_work_handler(struct work_struct *work)
      ^~~~~~~~~~~~~~~~~~~~~~~

Signed-off-by: Mauro Carvalho Chehab <mchehab@s-opensource.com>
8 years ago[media] pulse8-cec: add TODO file
Hans Verkuil [Sun, 10 Jul 2016 10:14:24 +0000 (07:14 -0300)]
[media] pulse8-cec: add TODO file

Explain what needs to be done to move this driver out of staging.

Signed-off-by: Hans Verkuil <hans.verkuil@cisco.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab@s-opensource.com>
8 years ago[media] MAINTAINERS: add entry for the pulse8-cec driver
Hans Verkuil [Sun, 10 Jul 2016 10:13:34 +0000 (07:13 -0300)]
[media] MAINTAINERS: add entry for the pulse8-cec driver

Add entry for the pulse8-cec driver.

Signed-off-by: Hans Verkuil <hans.verkuil@cisco.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab@s-opensource.com>
8 years ago[media] pulse8-cec: new driver for the Pulse-Eight USB-CEC Adapter
Hans Verkuil [Sun, 10 Jul 2016 10:12:10 +0000 (07:12 -0300)]
[media] pulse8-cec: new driver for the Pulse-Eight USB-CEC Adapter

This supports the Pulse-Eight USB-CEC Adapter.

It has been tested with firmware versions 4 and 5, but it should
hopefully work fine with older firmwares as well.

Signed-off-by: Hans Verkuil <hans.verkuil@cisco.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab@s-opensource.com>
8 years ago[media] input: serio - add new protocol for the Pulse-Eight USB-CEC Adapter
Hans Verkuil [Sun, 10 Jul 2016 10:08:58 +0000 (07:08 -0300)]
[media] input: serio - add new protocol for the Pulse-Eight USB-CEC Adapter

This is for the new pulse8-cec staging driver.

Signed-off-by: Hans Verkuil <hans.verkuil@cisco.com>
Acked-by: Dmitry Torokhov <dmitry.torokhov@gmail.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab@s-opensource.com>
8 years ago[media] cec: CEC_RECEIVE is allowed in monitor mode
Hans Verkuil [Mon, 11 Jul 2016 08:48:10 +0000 (05:48 -0300)]
[media] cec: CEC_RECEIVE is allowed in monitor mode

When the device is in monitor mode, then you should always be able to
call CEC_RECEIVE, even it the device is unconfigured.

Signed-off-by: Hans Verkuil <hans.verkuil@cisco.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab@s-opensource.com>
8 years ago[media] cx23885: Add support for Hauppauge WinTV quadHD DVB version
Stephen Backway [Sat, 2 Jul 2016 09:46:23 +0000 (06:46 -0300)]
[media] cx23885: Add support for Hauppauge WinTV quadHD DVB version

Add support fo the Hauppauge WinTV quadHD DVB version.
IR support has not been provided, all 4 tuners, demodulators etc are working.
Further documentation can be found on Linux TV wiki.

Signed-off-by: Stephen Backway <stev391@gmail.com>
Signed-off-by: Hans Verkuil <hans.verkuil@cisco.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab@s-opensource.com>
8 years ago[media] cec: add check if adapter is unregistered
Hans Verkuil [Sun, 10 Jul 2016 13:11:17 +0000 (10:11 -0300)]
[media] cec: add check if adapter is unregistered

CEC USB dongles can be unplugged at any time, and at that point they will
be unregistered. Make sure that any attempt afterwards to set the physical
or logical addresses will be ignored.

Signed-off-by: Hans Verkuil <hans.verkuil@cisco.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab@s-opensource.com>
8 years ago[media] adv7511: the h/vsync polarities were always positive
Hans Verkuil [Tue, 5 Jul 2016 10:16:23 +0000 (07:16 -0300)]
[media] adv7511: the h/vsync polarities were always positive

Correctly set the h/vsync polarities instead of keeping to the
default (positive).

Signed-off-by: Hans Verkuil <hans.verkuil@cisco.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab@s-opensource.com>
8 years ago[media] v4l2-ioctl: zero the v4l2_bt_timings reserved field
Hans Verkuil [Mon, 4 Jul 2016 13:05:48 +0000 (10:05 -0300)]
[media] v4l2-ioctl: zero the v4l2_bt_timings reserved field

This field should be zeroed. Both for s_dv_timings and for enum_dv_timings.
In fact, for the latter anything after the pad field can be zeroed.

Signed-off-by: Hans Verkuil <hans.verkuil@cisco.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab@s-opensource.com>
8 years ago[media] adv7604/adv7842: drop unused op_656_range and alt_data_sat fields
Hans Verkuil [Tue, 28 Jun 2016 14:54:59 +0000 (11:54 -0300)]
[media] adv7604/adv7842: drop unused op_656_range and alt_data_sat fields

These platform_data fields are no longer needed, drop them.

Signed-off-by: Hans Verkuil <hans.verkuil@cisco.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab@s-opensource.com>
8 years ago[media] ezkit/cobalt: drop unused op_656_range setting
Hans Verkuil [Tue, 28 Jun 2016 14:52:42 +0000 (11:52 -0300)]
[media] ezkit/cobalt: drop unused op_656_range setting

The adv7604/adv7842 drivers now handle that register setting themselves
and need no input from platform data anymore.

This was a left-over from the time that the pixelport output format was
decided by the platform data.

Signed-off-by: Hans Verkuil <hans.verkuil@cisco.com>
Cc: Scott Jiang <scott.jiang.linux@gmail.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab@s-opensource.com>
8 years ago[media] adv7604/adv7842: fix quantization range handling
Hans Verkuil [Tue, 28 Jun 2016 14:43:01 +0000 (11:43 -0300)]
[media] adv7604/adv7842: fix quantization range handling

Fix a number of bugs that appeared when support for mediabus formats was
added:

- Support for V4L2_DV_RGB_RANGE_FULL/LIMITED should only be enabled
  for HDMI RGB formats, not for YCbCr formats. Since, as the name
  says, this setting is for RGB only. So read the InfoFrame to check
  the format.

- the quantization range for the pixelport depends on whether the
  mediabus code is RGB or not: if it is RGB, then produce full range
  RGB values, otherwise produce limited range YCbCr values.

  This means that the op_656_range and alt_data_sat fields of the
  platform data are no longer used and these will be removed in a
  following patch.

- when setting up a new format the RGB quantization range settings
  were never updated. Do so, since this depends on the format.

- fix the log_status output which was confusing and incorrect.

Signed-off-by: Hans Verkuil <hans.verkuil@cisco.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab@s-opensource.com>
8 years ago[media] adv7511: fix quantization range handling
Hans Verkuil [Tue, 28 Jun 2016 14:32:36 +0000 (11:32 -0300)]
[media] adv7511: fix quantization range handling

Commit 1fb69bfd29e4b2e5e93922105326dd6cbd5ef6eb (adv7511: improve
colorspace handling) introduced a number of bugs, specifically with
regards to YCbCr output and quantization range handling:

- if the output is not RGB, then disable the full-to-limited range
  CSC matrix since that is meant for RGB formats. YCbCr formats are
  always limited range, so there is nothing to convert. (OK, full
  range YCbCr is possible, but we don't support that right now).

- the mediabus code that was passed to adv7511_set_fmt was always cleared
  by the memset in adv7511_fill_format. This made it effectively impossible
  to select YCbCr output.

- adv7511_set_fmt never updated the rgb quantization range.

Signed-off-by: Hans Verkuil <hans.verkuil@cisco.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab@s-opensource.com>
8 years ago[media] adv7511: drop adv7511_set_IT_content_AVI_InfoFrame
Hans Verkuil [Tue, 28 Jun 2016 14:30:35 +0000 (11:30 -0300)]
[media] adv7511: drop adv7511_set_IT_content_AVI_InfoFrame

The IT Content bit has nothing to do with CE vs IT timings.
Delete this code. This will also fix a bug where this could
override the 'content type' control, which is actually the
correct place to set/clear the ITC bit.

Signed-off-by: Hans Verkuil <hans.verkuil@cisco.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab@s-opensource.com>
8 years ago[media] af9033: fix compiler warnings
Hans Verkuil [Mon, 11 Jul 2016 03:23:11 +0000 (00:23 -0300)]
[media] af9033: fix compiler warnings

Fix two warnings:

af9033.c: In function 'af9033_read_status':
af9033.c:883:25: warning: 'snr_lut' may be used uninitialized in this function [-Wmaybe-uninitialized]
   const struct val_snr *snr_lut;
                         ^
af9033.c:952:25: warning: 'tmp' may be used uninitialized in this function [-Wmaybe-uninitialized]
   c->cnr.stat[0].svalue = tmp;
                         ^

Signed-off-by: Hans Verkuil <hans.verkuil@cisco.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab@s-opensource.com>
8 years ago[media] media: solo6x10: increase FRAME_BUF_SIZE
Andrey Utkin [Sun, 10 Jul 2016 00:44:50 +0000 (21:44 -0300)]
[media] media: solo6x10: increase FRAME_BUF_SIZE

In practice, devices sometimes return frames larger than current buffer
size, leading to failure in solo_send_desc().
It is not clear which minimal increase in buffer size would be enough,
so this patch doubles it, this should be safely assumed as sufficient.

Signed-off-by: Andrey Utkin <andrey.utkin@corp.bluecherry.net>
Signed-off-by: Hans Verkuil <hans.verkuil@cisco.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab@s-opensource.com>
8 years ago[media] media: usbtv: prevent access to free'd resources
Matthew Leach [Fri, 8 Jul 2016 12:04:27 +0000 (09:04 -0300)]
[media] media: usbtv: prevent access to free'd resources

When disconnecting the usbtv device, the sound card is unregistered
from ALSA and the snd member of the usbtv struct is set to NULL.  If
the usbtv snd_trigger work is running, this can cause a race condition
where the kernel will attempt to access free'd resources, shown in
[1].

This patch fixes the disconnection code by cancelling any snd_trigger
work before unregistering the sound card from ALSA and checking that
the snd member still exists in the work function.

[1]:
 usb 3-1.2: USB disconnect, device number 6
 BUG: unable to handle kernel NULL pointer dereference at 0000000000000008
 IP: [<ffffffff81093850>] process_one_work+0x30/0x480
 PGD 405bbf067 PUD 405bbe067 PMD 0
 Call Trace:
  [<ffffffff81093ce8>] worker_thread+0x48/0x4e0
  [<ffffffff81093ca0>] ? process_one_work+0x480/0x480
  [<ffffffff81093ca0>] ? process_one_work+0x480/0x480
  [<ffffffff81099998>] kthread+0xd8/0xf0
  [<ffffffff815c73c2>] ret_from_fork+0x22/0x40
  [<ffffffff810998c0>] ? kthread_worker_fn+0x170/0x170
 ---[ end trace 0f3dac5c1a38e610 ]---

Signed-off-by: Matthew Leach <matthew@mattleach.net>
Tested-by: Peter Sutton <foxxy@foxdogstudios.com>
Cc: stable@vger.kernel.org
Signed-off-by: Hans Verkuil <hans.verkuil@cisco.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab@s-opensource.com>
8 years ago[media] vivid: set V4L2_CAP_TIMEPERFRAME
Hans Verkuil [Wed, 6 Jul 2016 07:36:39 +0000 (04:36 -0300)]
[media] vivid: set V4L2_CAP_TIMEPERFRAME

The vivid driver didn't set the V4L2_CAP_TIMEPERFRAME flag in s_parm for the
non-webcam inputs. This caused a v4l2-compliance fail.

Signed-off-by: Hans Verkuil <hans.verkuil@cisco.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab@s-opensource.com>
8 years ago[media] mtk-vcodec: fix sparse warning
Tiffany Lin [Wed, 11 May 2016 08:21:45 +0000 (05:21 -0300)]
[media] mtk-vcodec: fix sparse warning

This patch fix sparse warning when running with parameters:
C=2 CF="-D__CHECK_ENDIAN__"

Signed-off-by: Tiffany Lin <tiffany.lin@mediatek.com>
Signed-off-by: PoChun Lin <pochun.lin@mediatek.com>
Signed-off-by: Hans Verkuil <hans.verkuil@cisco.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab@s-opensource.com>
8 years ago[media] mtk-vcodec: fix platform_no_drv_owner.cocci warnings
Fengguang Wu [Fri, 8 Jul 2016 23:22:25 +0000 (20:22 -0300)]
[media] mtk-vcodec: fix platform_no_drv_owner.cocci warnings

drivers/media/platform/mtk-vcodec/mtk_vcodec_enc_drv.c:433:3-8: No need to set .owner here. The core will do it.

 Remove .owner field if calls are used which set it automatically

Generated by: scripts/coccinelle/api/platform_no_drv_owner.cocci

Signed-off-by: Fengguang Wu <fengguang.wu@intel.com>
Signed-off-by: Hans Verkuil <hans.verkuil@cisco.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab@s-opensource.com>
8 years ago[media] v4l2-subdev.h: remove the control subdev ops
Hans Verkuil [Sun, 3 Jul 2016 12:02:01 +0000 (09:02 -0300)]
[media] v4l2-subdev.h: remove the control subdev ops

These are no longer used (finally!), so remove them.

Signed-off-by: Hans Verkuil <hans.verkuil@cisco.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab@s-opensource.com>
8 years ago[media] media/i2c: drop the last users of the ctrl core ops
Hans Verkuil [Sun, 3 Jul 2016 12:01:22 +0000 (09:01 -0300)]
[media] media/i2c: drop the last users of the ctrl core ops

Nobody is using these ops anymore, so remove these callbacks from
the subdev drivers that still have them.

Signed-off-by: Hans Verkuil <hans.verkuil@cisco.com>
Cc: Andy Walls <awalls@md.metrocast.net>
Signed-off-by: Mauro Carvalho Chehab <mchehab@s-opensource.com>
8 years ago[media] ivtv: use v4l2_g/s_ctrl instead of the g/s_ctrl ops
Hans Verkuil [Sun, 3 Jul 2016 12:24:14 +0000 (09:24 -0300)]
[media] ivtv: use v4l2_g/s_ctrl instead of the g/s_ctrl ops

These ops are deprecated and should not be used anymore.

Signed-off-by: Hans Verkuil <hans.verkuil@cisco.com>
Cc: Andy Walls <awalls@md.metrocast.net>
Signed-off-by: Mauro Carvalho Chehab <mchehab@s-opensource.com>
8 years ago[media] cx18: use v4l2_g/s_ctrl instead of the g/s_ctrl ops
Hans Verkuil [Sun, 3 Jul 2016 12:23:47 +0000 (09:23 -0300)]
[media] cx18: use v4l2_g/s_ctrl instead of the g/s_ctrl ops

These ops are deprecated and should not be used anymore.

Signed-off-by: Hans Verkuil <hans.verkuil@cisco.com>
Cc: Andy Walls <awalls@md.metrocast.net>
Signed-off-by: Mauro Carvalho Chehab <mchehab@s-opensource.com>
8 years ago[media] v4l2-flash-led: remove unused ops
Hans Verkuil [Sun, 3 Jul 2016 12:20:46 +0000 (09:20 -0300)]
[media] v4l2-flash-led: remove unused ops

These ops are deprecated and should not be used anymore (and in fact
they are not used at all).

Signed-off-by: Hans Verkuil <hans.verkuil@cisco.com>
Cc: Sakari Ailus <sakari.ailus@linux.intel.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab@s-opensource.com>
8 years ago[media] cx88: use wm8775_s_ctrl instead of the s_ctrl op
Hans Verkuil [Sun, 3 Jul 2016 12:00:26 +0000 (09:00 -0300)]
[media] cx88: use wm8775_s_ctrl instead of the s_ctrl op

This op is deprecated and should not be used anymore.

Signed-off-by: Hans Verkuil <hans.verkuil@cisco.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab@s-opensource.com>
8 years ago[media] cx231xx: use v4l2_s_ctrl instead of the s_ctrl op
Hans Verkuil [Sun, 3 Jul 2016 11:59:33 +0000 (08:59 -0300)]
[media] cx231xx: use v4l2_s_ctrl instead of the s_ctrl op

This op is deprecated and should not be used anymore.

Signed-off-by: Hans Verkuil <hans.verkuil@cisco.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab@s-opensource.com>
8 years ago[media] via-camera: use v4l2_s_ctrl instead of the s_ctrl op
Hans Verkuil [Sun, 3 Jul 2016 12:13:04 +0000 (09:13 -0300)]
[media] via-camera: use v4l2_s_ctrl instead of the s_ctrl op

This op is deprecated and should not be used anymore.

Signed-off-by: Hans Verkuil <hans.verkuil@cisco.com>
Cc: Jonathan Corbet <corbet@lwn.net>
Signed-off-by: Mauro Carvalho Chehab <mchehab@s-opensource.com>
8 years ago[media] mcam-core: use v4l2_s_ctrl instead of the s_ctrl op
Hans Verkuil [Sun, 3 Jul 2016 11:58:55 +0000 (08:58 -0300)]
[media] mcam-core: use v4l2_s_ctrl instead of the s_ctrl op

This op is deprecated and should not be used anymore.

Signed-off-by: Hans Verkuil <hans.verkuil@cisco.com>
Cc: Jonathan Corbet <corbet@lwn.net>
Signed-off-by: Mauro Carvalho Chehab <mchehab@s-opensource.com>
8 years ago[media] usbvision: use v4l2_ctrl_g_ctrl instead of the g_ctrl op
Hans Verkuil [Sun, 3 Jul 2016 11:58:07 +0000 (08:58 -0300)]
[media] usbvision: use v4l2_ctrl_g_ctrl instead of the g_ctrl op

This op is deprecated and should not be used anymore.

Signed-off-by: Hans Verkuil <hans.verkuil@cisco.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab@s-opensource.com>
8 years ago[media] pvrusb2: use v4l2_s_ctrl instead of the s_ctrl op
Hans Verkuil [Sun, 3 Jul 2016 11:44:27 +0000 (08:44 -0300)]
[media] pvrusb2: use v4l2_s_ctrl instead of the s_ctrl op

This op is deprecated and should not be used anymore.

Signed-off-by: Hans Verkuil <hans.verkuil@cisco.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab@s-opensource.com>
8 years ago[media] davinci: drop unused control callbacks
Hans Verkuil [Sun, 3 Jul 2016 10:18:00 +0000 (07:18 -0300)]
[media] davinci: drop unused control callbacks

These callbacks are no longer used since the davinci drivers use the
control framework.

Signed-off-by: Hans Verkuil <hans.verkuil@cisco.com>
Cc: Prabhakar Lad <prabhakar.csengg@gmail.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab@s-opensource.com>
8 years ago[media] saa7164: drop unused saa7164_ctrl struct
Hans Verkuil [Sun, 3 Jul 2016 10:16:34 +0000 (07:16 -0300)]
[media] saa7164: drop unused saa7164_ctrl struct

No longer used, can be removed.

Signed-off-by: Hans Verkuil <hans.verkuil@cisco.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab@s-opensource.com>
8 years ago[media] omap_vout: use control framework
Hans Verkuil [Sun, 3 Jul 2016 10:33:33 +0000 (07:33 -0300)]
[media] omap_vout: use control framework

Replace the old control code with the control framework.

This is one of the few remaining drivers that was not using this
framework.

Signed-off-by: Hans Verkuil <hans.verkuil@cisco.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab@s-opensource.com>
8 years ago[media] Convert Wideview WT220 DVB USB driver to rc-core
Jonathan McDowell [Fri, 20 May 2016 15:08:35 +0000 (12:08 -0300)]
[media] Convert Wideview WT220 DVB USB driver to rc-core

Converts the dtt200u DVB USB driver over to the rc-core
infrastructure for its handling of IR remotes. This device can receive
generic NEC / NEC Extended signals and the switch to the newer core
enables the easy use of tools such as ir-keytable to modify the active
key map.

Signed-off-by: Jonathan McDowell <noodles@earth.li>
Signed-off-by: Mauro Carvalho Chehab <mchehab@s-opensource.com>
8 years ago[media] Fix RC5 decoding with Fintek CIR chipset
Jonathan McDowell [Sat, 14 May 2016 17:01:26 +0000 (14:01 -0300)]
[media] Fix RC5 decoding with Fintek CIR chipset

Fix RC5 decoding with Fintek CIR chipset

Commit e87b540be2dd02552fb9244d50ae8b4e4619a34b tightened up the RC5
decoding by adding a check for trailing silence to ensure a valid RC5
command had been received. Unfortunately the trailer length checked was
10 units and the Fintek CIR device does not want to provide details of a
space longer than 6350us. This meant that RC5 remotes working on a
Fintek setup on 3.16 failed on 3.17 and later. Fix this by shortening
the trailer check to 6 units (allowing for a previous space in the
received remote command).

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

Signed-off-by: Jonathan McDowell <noodles@earth.li>
Cc: stable@vger.kernel.org
Signed-off-by: David Härdeman <david@hardeman.nu>
Signed-off-by: Mauro Carvalho Chehab <mchehab@s-opensource.com>
8 years ago[media] media: dvb_ringbuffer: Add memory barriers
Soeren Moch [Wed, 11 May 2016 16:49:11 +0000 (13:49 -0300)]
[media] media: dvb_ringbuffer: Add memory barriers

Implement memory barriers according to Documentation/circular-buffers.txt:
- use smp_store_release() to update ringbuffer read/write pointers
- use smp_load_acquire() to load write pointer on reader side
- use ACCESS_ONCE() to load read pointer on writer side

This fixes data stream corruptions observed e.g. on an ARM Cortex-A9
quad core system with different types (PCI, USB) of DVB tuners.

Signed-off-by: Soeren Moch <smoch@web.de>
Cc: stable@vger.kernel.org # 3.14+
Signed-off-by: Mauro Carvalho Chehab <mchehab@s-opensource.com>
8 years ago[media] mtk-vcodec: fix compiler warning
Hans Verkuil [Sat, 9 Jul 2016 07:32:58 +0000 (04:32 -0300)]
[media] mtk-vcodec: fix compiler warning

mtk-vcodec/venc_vpu_if.c:40:30: warning: cast to pointer from integer of different size [-Wint-to-pointer-cast]
  struct venc_vpu_inst *vpu = (struct venc_vpu_inst *)msg->venc_inst;
                              ^

Note: venc_inst is u64.

Signed-off-by: Hans Verkuil <hans.verkuil@cisco.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab@s-opensource.com>