Commit graph

22602 commits

Author SHA1 Message Date
Hans Verkuil 83505028d8 [media] vivid: support monitor all mode
Just pass the transmitted CEC message to all CEC adapters.
This implements the Monitor All mode for vivid.

Signed-off-by: Hans Verkuil <hans.verkuil@cisco.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab@s-opensource.com>
2016-07-19 13:26:33 -03:00
Abylay Ospan e05b1872f2 [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>
2016-07-16 07:01:31 -03:00
Abylay Ospan a6f330cbb3 [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>
2016-07-16 06:59:43 -03:00
Abylay Ospan 997bdc0c8e [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>
2016-07-16 06:58:59 -03:00
Mauro Carvalho Chehab 313a7dfb23 [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>
2016-07-16 06:56:28 -03:00
Mauro Carvalho Chehab d12b791e3d [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>
2016-07-16 06:56:03 -03:00
Mauro Carvalho Chehab 988bd281d3 [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>
2016-07-16 06:55:30 -03:00
Mauro Carvalho Chehab 4216be14be [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>
2016-07-16 06:53:46 -03:00
Colin Ian King eca2d34b9d [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>
2016-07-15 13:32:58 -03:00
James Patrick-Evans 785ef73dba [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>
2016-07-15 13:32:21 -03:00
Hans Verkuil 693596c3ac [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>
2016-07-15 13:20:28 -03:00
Tiffany Lin 8d4eb2acb6 [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>
2016-07-15 13:19:35 -03:00
Arnd Bergmann 19e476c7b0 [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. e0f80d8d62 ("[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>
2016-07-15 12:37:17 -03:00
Sean Young 4f253cecf8 [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>
2016-07-15 12:01:46 -03:00
Sean Young 25da661a14 [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>
2016-07-15 12:00:16 -03:00
Sean Young 14d8188aab [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>
2016-07-15 11:54:23 -03:00
Sean Young 20f5a827cf [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>
2016-07-15 11:46:55 -03:00
Stefan Pöschel 9e422f64fa [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>
2016-07-15 11:44:10 -03:00
Heiner Kallweit 5cac1f67ea [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>
2016-07-13 15:49:01 -03:00
Max Kellermann da677fe143 [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>
2016-07-13 15:45:29 -03:00
Max Kellermann fe35637b0a [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>
2016-07-13 15:43:31 -03:00
Andi Shyti 273b902a5b [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>
2016-07-13 15:29:03 -03:00
Andi Shyti 8e5fa4c67d [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>
2016-07-13 15:28:25 -03:00
Andi Shyti 62e92682c0 [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>
2016-07-13 15:27:16 -03:00
Andi Shyti b408809487 [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>
2016-07-13 15:26:52 -03:00
Andi Shyti 9675ee5a8e [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>
2016-07-13 15:25:41 -03:00
Andi Shyti 14db9fc2d4 [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>
2016-07-13 15:24:28 -03:00
Andi Shyti 6ab86d2aa0 [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>
2016-07-13 15:09:05 -03:00
Andi Shyti 19e565397c [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>
2016-07-13 15:06:29 -03:00
Andi Shyti 7fe579d29f [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>
2016-07-13 15:01:13 -03:00
Andi Shyti 54fcecafe5 [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>
2016-07-13 14:59:19 -03:00
Andi Shyti 3fac031460 [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>
2016-07-13 14:58:41 -03:00
Andi Shyti fe084c7eff [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>
2016-07-13 14:56:26 -03:00
Andi Shyti 70143984dd [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>
2016-07-13 14:54:58 -03:00
Andi Shyti 6fa99e1af1 [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>
2016-07-13 14:52:36 -03:00
Arnd Bergmann 199946731f [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: 94fcdf8297 ("[media] v4l: vsp1: Add FCP support")

Signed-off-by: Arnd Bergmann <arnd@arndb.de>
Signed-off-by: Mauro Carvalho Chehab <mchehab@s-opensource.com>
2016-07-13 13:46:34 -03:00
Arnd Bergmann af2e14bb3f [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: 1e6af546ee ("[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>
2016-07-13 13:46:12 -03:00
Mauro Carvalho Chehab c9a3429bcc 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
  ...
2016-07-13 13:43:48 -03:00
Ezequiel Garcia 85c30a7272 [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>
2016-07-13 13:34:52 -03:00
Mauro Carvalho Chehab fb66852d4c [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>
2016-07-13 13:34:11 -03:00
Dan Carpenter f91e5c0c5f [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 0d3ab8410d ('[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>
2016-07-13 13:13:22 -03:00
Colin Ian King e3e8d37e53 [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>
2016-07-13 13:11:51 -03:00
Olli Salonen 49438d97f9 [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>
2016-07-13 12:24:48 -03:00
Saso Slavicic cd82982179 [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>
2016-07-13 11:56:22 -03:00
Wei Yongjun 712440857e [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>
2016-07-13 08:01:20 -03:00
Wei Yongjun 2efeec2d03 [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>
2016-07-13 08:00:57 -03:00
Wei Yongjun 14ee452f3a [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>
2016-07-13 08:00:23 -03:00
Wei Yongjun ffe5703300 [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>
2016-07-13 07:59:52 -03:00
Jonathan McDowell 0385443fec [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>
2016-07-13 07:44:01 -03:00
Sudip Mukherjee 25f1ec2462 [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>
2016-07-12 20:14:38 -03:00