summaryrefslogtreecommitdiffstats
path: root/drivers
AgeCommit message (Collapse)AuthorFilesLines
2018-05-14media: mceusb: MCE_CMD_SETIRTIMEOUT cause strange behaviour on deviceSean Young1-3/+19
If the IR timeout is set on vid 1784 pid 0011, the device starts behaving strangely. Reported-by: Matthias Reichl <hias@horus.com> Signed-off-by: Sean Young <sean@mess.org> Signed-off-by: Mauro Carvalho Chehab <mchehab+samsung@kernel.org>
2018-05-11media: dvb_frontend: cleanup some coding style errorsMauro Carvalho Chehab1-99/+101
This is a core media file... it shoudn't have so many coding style issues! The last patch ended by being submitted with an error like that, very likely due to some cut and paste issue. Maybe it is time to clean it up. Do it with the auto fix logic: ./scripts/checkpatch.pl -f drivers/media/dvb-core/dvb_frontend.c --strict --fix-inplace Then manually fix the errors introduced by it. Signed-off-by: Mauro Carvalho Chehab <mchehab+samsung@kernel.org>
2018-05-11media: dvbdev: add a mutex protecting the "mdev" pointerMax Kellermann3-0/+15
During destruction, a race condition in dvb_media_controller_disable_source() can cause a kernel crash, because the "mdev" pointer has been read successfully while another task executes dvb_usb_media_device_unregister(), which destroys the object. Example for such a crash: general protection fault: 0000 [#1] SMP CPU: 1 PID: 301 Comm: vdr Not tainted 4.8.1-nuc+ #102 [142B blob data] task: ffff8802301f2040 task.stack: ffff880233728000 RIP: 0010:[<ffffffff816c296b>] [<ffffffff816c296b>] dvb_frontend_release+0xcb/0x120 RSP: 0018:ffff88023372bdd8 EFLAGS: 00010202 RAX: 001fd55c000000da RBX: ffff880236bad810 RCX: 0000000000000000 RDX: ffff880235bd81f0 RSI: 0000000000000246 RDI: ffff880235bd81e8 RBP: ffff88023372be00 R08: 0000000000000000 R09: 0000000000000000 R10: 0000000000000000 R11: ffff88022f009910 R12: 0000000000000000 R13: ffff880235a21a80 R14: ffff880235bd8000 R15: ffff880235bb8a78 FS: 0000000000000000(0000) GS:ffff88023fd00000(0000) knlGS:0000000000000000 CS: 0010 DS: 0000 ES: 0000 CR0: 0000000080050033 CR2: 00007f96edd69818 CR3: 0000000002406000 CR4: 00000000001006e0 Stack: ffff88022f009900 0000000000000008 ffff880235bb8a78 ffff8802344fbb20 ffff880236437b40 ffff88023372be48 ffffffff8117a81e ffff880235bb8a78 ffff88022f009910 ffff8802335a7400 ffff8802301f2040 ffff88022f009900 Call Trace: [<ffffffff8117a81e>] __fput+0xde/0x1d0 [<ffffffff8117a949>] ____fput+0x9/0x10 [<ffffffff810a9fce>] task_work_run+0x7e/0xa0 [<ffffffff81094bab>] do_exit+0x27b/0xa50 [<ffffffff810407e3>] ? __do_page_fault+0x1c3/0x430 [<ffffffff81095402>] do_group_exit+0x42/0xb0 [<ffffffff8109547f>] SyS_exit_group+0xf/0x10 [<ffffffff8108bedb>] entry_SYSCALL_64_fastpath+0x13/0x8f Code: 31 c9 49 8d be e8 01 00 00 ba 01 00 00 00 be 03 00 00 00 e8 68 2d a0 ff 48 8b 83 10 03 00 00 48 8b 80 88 00 00 00 48 85 c0 74 12 <48> 8b 80 88 02 00 00 48 85 c0 74 06 49 8b 7d RIP [<ffffffff816c296b>] dvb_frontend_release+0xcb/0x120 [mchehab+samsung@kernel.org: fix a Coding Style issue] Signed-off-by: Max Kellermann <max.kellermann@gmail.com> Signed-off-by: Mauro Carvalho Chehab <mchehab+samsung@kernel.org>
2018-05-11media: lgdt330x.h: fix compiler warningHans Verkuil1-1/+1
Add missing 'inline' to fix this compiler warning: In file included from drivers/media/common/b2c2/flexcop-fe-tuner.c:21:0: drivers/media/dvb-frontends/lgdt330x.h:61:22: warning: 'lgdt330x_attach' defined but not used [-Wunused-function] struct dvb_frontend *lgdt330x_attach(const struct lgdt330x_config *config, ^~~~~~~~~~~~~~~ Signed-off-by: Hans Verkuil <hansverk@cisco.com> Suggested-by: Mauro Carvalho Chehab <mchehab+samsung@kernel.org> Signed-off-by: Mauro Carvalho Chehab <mchehab+samsung@kernel.org>
2018-05-11media: rcar-vin: fix crop and compose handling for Gen3Niklas Söderlund1-0/+6
When refactoring the Gen3 enablement series crop and compose handling where broken. This went unnoticed but can result in writing out side the capture buffer. Fix this by restoring the crop and compose to reflect the format dimensions as we have not yet enabled the scaler for Gen3. Fixes: 5e7c623632fcf8f5 ("media: rcar-vin: use different v4l2 operations in media controller mode") Reported-by: Jacopo Mondi <jacopo+renesas@jmondi.org> Signed-off-by: Niklas Söderlund <niklas.soderlund+renesas@ragnatech.se> Signed-off-by: Hans Verkuil <hansverk@cisco.com> Signed-off-by: Mauro Carvalho Chehab <mchehab+samsung@kernel.org>
2018-05-11media: Revert "media: rcar-vin: enable field toggle after a set number of ↵Niklas Söderlund1-15/+5
lines for Gen3" The offending commit was an attempt to fix the issue of writing outside the capture buffer for VIN Gen3. Unfortunately it only fixed the symptom of the problem to such a degree I could no longer reproduce it. Revert the offending commit before a proper fix can be added in a follow-up patch. This reverts commit 015060cb7795eac34454696cc9c9f8b76926a401. Signed-off-by: Niklas Söderlund <niklas.soderlund+renesas@ragnatech.se> Signed-off-by: Hans Verkuil <hansverk@cisco.com> Signed-off-by: Mauro Carvalho Chehab <mchehab+samsung@kernel.org>
2018-05-11media: dvb_frontends: fix spelling mistake: "unexpcted" -> "unexpected"Colin Ian King1-2/+2
Trivial fix to spelling mistake in dprintk message text Signed-off-by: Colin Ian King <colin.king@canonical.com> Signed-off-by: Hans Verkuil <hansverk@cisco.com> Signed-off-by: Mauro Carvalho Chehab <mchehab+samsung@kernel.org>
2018-05-11media: usb: cx231xx-417: include linux/slab.h headerAnders Roxell1-0/+1
cx231-417 uses kmalloc/kfree functions, so slab header needs to be included in order to fix the following build errors: drivers/media/usb/cx231xx/cx231xx-417.c: In function ‘cx231xx_bulk_copy’: CC drivers/media/platform/qcom/venus/firmware.o drivers/media/usb/cx231xx/cx231xx-417.c:1389:11: error: implicit declaration of function ‘kmalloc’; did you mean ‘vmalloc’? [-Werror=implicit-function-declaration] buffer = kmalloc(buffer_size, GFP_ATOMIC); ^~~~~~~ vmalloc drivers/media/usb/cx231xx/cx231xx-417.c:1389:9: warning: assignment makes pointer from integer without a cast [-Wint-conversion] buffer = kmalloc(buffer_size, GFP_ATOMIC); ^ drivers/media/usb/cx231xx/cx231xx-417.c:1400:2: error: implicit declaration of function ‘kfree’; did you mean ‘vfree’? [-Werror=implicit-function-declaration] kfree(buffer); ^~~~~ vfree drivers/media/usb/cx231xx/cx231xx-417.c: In function ‘mpeg_open’: drivers/media/usb/cx231xx/cx231xx-417.c:1713:7: error: implicit declaration of function ‘kzalloc’; did you mean ‘vzalloc’? [-Werror=implicit-function-declaration] fh = kzalloc(sizeof(*fh), GFP_KERNEL); ^~~~~~~ vzalloc drivers/media/usb/cx231xx/cx231xx-417.c:1713:5: warning: assignment makes pointer from integer without a cast [-Wint-conversion] fh = kzalloc(sizeof(*fh), GFP_KERNEL); ^ Signed-off-by: Anders Roxell <anders.roxell@linaro.org> Signed-off-by: Hans Verkuil <hansverk@cisco.com> Signed-off-by: Mauro Carvalho Chehab <mchehab+samsung@kernel.org>
2018-05-11media: i2c: tda1997: Fix an error handling path 'tda1997x_probe()'Christophe JAILLET1-1/+1
If 'media_entity_pads_init()' fails, we must free the resources allocated by 'v4l2_ctrl_handler_init()', as already done in the previous error handling path. 'goto' the right label to fix it. Fixes: 9ac0038db9a7 ("media: i2c: Add TDA1997x HDMI receiver driver") Signed-off-by: Christophe JAILLET <christophe.jaillet@wanadoo.fr> Signed-off-by: Hans Verkuil <hansverk@cisco.com> Signed-off-by: Mauro Carvalho Chehab <mchehab+samsung@kernel.org>
2018-05-11media: saa7146: fix error return from master_xferPeter Rosin1-2/+2
Returning -1 (-EPERM) is not appropriate here, go with -EIO. Signed-off-by: Peter Rosin <peda@axentia.se> Signed-off-by: Hans Verkuil <hansverk@cisco.com> Signed-off-by: Mauro Carvalho Chehab <mchehab+samsung@kernel.org>
2018-05-11media: em28xx: Demote several dev_err to dev_infoBrad Love1-2/+2
These two statements are not errors, reduce to appropriate level. Signed-off-by: Brad Love <brad@nextdimension.cc> Signed-off-by: Hans Verkuil <hansverk@cisco.com> Signed-off-by: Mauro Carvalho Chehab <mchehab+samsung@kernel.org>
2018-05-11media: cx231xx: Fix spelling mistake: "senario" -> "scenario"Colin Ian King1-1/+1
Trivial fix to spelling mistake in dev_err message. Signed-off-by: Colin Ian King <colin.king@canonical.com> Signed-off-by: Hans Verkuil <hansverk@cisco.com> Signed-off-by: Mauro Carvalho Chehab <mchehab+samsung@kernel.org>
2018-05-11media: cx23885: Add some missing register documentationBrad Love1-1/+8
Document what these two register calls are doing. Signed-off-by: Brad Love <brad@nextdimension.cc> Signed-off-by: Hans Verkuil <hansverk@cisco.com> Signed-off-by: Mauro Carvalho Chehab <mchehab+samsung@kernel.org>
2018-05-11media: cx23885: Expand registers in dma tsport reg dumpBrad Love1-0/+12
Include some additional useful registers in the output. Signed-off-by: Brad Love <brad@nextdimension.cc> Signed-off-by: Hans Verkuil <hansverk@cisco.com> Signed-off-by: Mauro Carvalho Chehab <mchehab+samsung@kernel.org>
2018-05-11media: cx23885: Ryzen DMA related RiSC engine stall fixesBrad Love2-2/+74
This bug affects all of Hauppauge QuadHD boards when used on all Ryzen platforms and some XEON platforms. On these platforms it is possible to error out the RiSC engine and cause it to stall, whereafter the only way to reset the board to a working state is to reboot. This is the fatal condition with current driver: [ 255.663598] cx23885: cx23885[0]: mpeg risc op code error [ 255.663607] cx23885: cx23885[0]: TS1 B - dma channel status dump [ 255.663612] cx23885: cx23885[0]: cmds: init risc lo : 0xffe54000 [ 255.663615] cx23885: cx23885[0]: cmds: init risc hi : 0x00000000 [ 255.663619] cx23885: cx23885[0]: cmds: cdt base : 0x00010870 [ 255.663622] cx23885: cx23885[0]: cmds: cdt size : 0x0000000a [ 255.663625] cx23885: cx23885[0]: cmds: iq base : 0x00010630 [ 255.663629] cx23885: cx23885[0]: cmds: iq size : 0x00000010 [ 255.663632] cx23885: cx23885[0]: cmds: risc pc lo : 0xffe54018 [ 255.663636] cx23885: cx23885[0]: cmds: risc pc hi : 0x00000000 [ 255.663639] cx23885: cx23885[0]: cmds: iq wr ptr : 0x00004192 [ 255.663642] cx23885: cx23885[0]: cmds: iq rd ptr : 0x0000418c [ 255.663645] cx23885: cx23885[0]: cmds: cdt current : 0x00010898 [ 255.663649] cx23885: cx23885[0]: cmds: pci target lo : 0xf85ca340 [ 255.663652] cx23885: cx23885[0]: cmds: pci target hi : 0x00000000 [ 255.663655] cx23885: cx23885[0]: cmds: line / byte : 0x000c0000 [ 255.663659] cx23885: cx23885[0]: risc0: [ 255.663661] 0x1c0002f0 [ write sol eol count=752 ] [ 255.663666] cx23885: cx23885[0]: risc1: [ 255.663667] 0xf85ca050 [ INVALID sol 22 20 19 18 resync 13 count=80 ] [ 255.663674] cx23885: cx23885[0]: risc2: [ 255.663674] 0x00000000 [ INVALID count=0 ] [ 255.663678] cx23885: cx23885[0]: risc3: [ 255.663679] 0x1c0002f0 [ write sol eol count=752 ] [ 255.663684] cx23885: cx23885[0]: (0x00010630) iq 0: [ 255.663685] 0x1c0002f0 [ write sol eol count=752 ] [ 255.663690] cx23885: cx23885[0]: iq 1: 0xf85ca630 [ arg #1 ] [ 255.663693] cx23885: cx23885[0]: iq 2: 0x00000000 [ arg #2 ] [ 255.663696] cx23885: cx23885[0]: (0x0001063c) iq 3: [ 255.663697] 0x1c0002f0 [ write sol eol count=752 ] [ 255.663702] cx23885: cx23885[0]: iq 4: 0xf85ca920 [ arg #1 ] [ 255.663705] cx23885: cx23885[0]: iq 5: 0x00000000 [ arg #2 ] [ 255.663709] cx23885: cx23885[0]: (0x00010648) iq 6: [ 255.663709] 0xf85ca340 [ INVALID sol 22 20 19 18 resync 13 count=832 ] [ 255.663716] cx23885: cx23885[0]: (0x0001064c) iq 7: [ 255.663717] 0x00000000 [ INVALID count=0 ] [ 255.663721] cx23885: cx23885[0]: (0x00010650) iq 8: [ 255.663721] 0x00000000 [ INVALID count=0 ] [ 255.663725] cx23885: cx23885[0]: (0x00010654) iq 9: [ 255.663726] 0x1c0002f0 [ write sol eol count=752 ] [ 255.663731] cx23885: cx23885[0]: iq a: 0xf85c9780 [ arg #1 ] [ 255.663734] cx23885: cx23885[0]: iq b: 0x00000000 [ arg #2 ] [ 255.663737] cx23885: cx23885[0]: (0x00010660) iq c: [ 255.663738] 0x1c0002f0 [ write sol eol count=752 ] [ 255.663743] cx23885: cx23885[0]: iq d: 0xf85c9a70 [ arg #1 ] [ 255.663746] cx23885: cx23885[0]: iq e: 0x00000000 [ arg #2 ] [ 255.663749] cx23885: cx23885[0]: (0x0001066c) iq f: [ 255.663750] 0x1c0002f0 [ write sol eol count=752 ] [ 255.663755] cx23885: cx23885[0]: iq 10: 0xf4fa2920 [ arg #1 ] [ 255.663758] cx23885: cx23885[0]: iq 11: 0x00000000 [ arg #2 ] [ 255.663759] cx23885: cx23885[0]: fifo: 0x00005000 -> 0x6000 [ 255.663760] cx23885: cx23885[0]: ctrl: 0x00010630 -> 0x10690 [ 255.663764] cx23885: cx23885[0]: ptr1_reg: 0x00005980 [ 255.663767] cx23885: cx23885[0]: ptr2_reg: 0x000108a8 [ 255.663770] cx23885: cx23885[0]: cnt1_reg: 0x0000000b [ 255.663773] cx23885: cx23885[0]: cnt2_reg: 0x00000003 Included is checks of the TC_REQ and TC_REQ_SET registers during states of board initialization, reset, DMA start, and DMA stop. If both registers are set, this indicates a stall in the RiSC engine, at which point the bridge error is cleared. A small delay is introduced in stop_dma as well, to allow transfers in progress to finish. After application all models work on Ryzen, occasionally yielding: cx23885_clear_bridge_error: dma in progress detected 0x00000001 0x00000001, clearing Signed-off-by: Brad Love <brad@nextdimension.cc> Signed-off-by: Hans Verkuil <hansverk@cisco.com> [hansverk@cisco.com: fix compiler warning of unused 'reg' variable] Signed-off-by: Mauro Carvalho Chehab <mchehab+samsung@kernel.org>
2018-05-11media: cx23885: Use PCI and TS masks in irq functionsBrad Love1-2/+10
Currently mask is read for pci_status/ts1_status/ts2_status, but otherwise ignored. The masks are now used to determine whether action is warranted. Signed-off-by: Brad Love <brad@nextdimension.cc> Signed-off-by: Hans Verkuil <hansverk@cisco.com> Signed-off-by: Mauro Carvalho Chehab <mchehab+samsung@kernel.org>
2018-05-11media: cx23885: Handle additional bufs on interruptBrad Love1-13/+24
On Ryzen systems interrupts are occasionally missed: cx23885: cx23885_wakeup: [ffff99b384b83c00/28] wakeup reg=5406 buf=5405 cx23885: cx23885_wakeup: [ffff99b40bf79400/31] wakeup reg=9537 buf=9536 This patch loops up to five times on wakeup, marking any buffers found done. Since the count register is u16, but the vb2 counter is u32, some modulo arithmetic is used to accommodate wraparound and ensure current active buffer is the buffer expected. Signed-off-by: Brad Love <brad@nextdimension.cc> Signed-off-by: Hans Verkuil <hansverk@cisco.com> Signed-off-by: Mauro Carvalho Chehab <mchehab+samsung@kernel.org>
2018-05-11media: v4l2-ioctl: replace IOCTL_INFO_STD with stub functionsSami Tolvanen1-115/+130
This change removes IOCTL_INFO_STD and adds stub functions where needed using the DEFINE_V4L_STUB_FUNC macro. This fixes indirect call mismatches with Control-Flow Integrity, caused by calling standard ioctls using a function pointer that doesn't match the function type. Signed-off-by: Sami Tolvanen <samitolvanen@google.com> Signed-off-by: Hans Verkuil <hansverk@cisco.com> Signed-off-by: Mauro Carvalho Chehab <mchehab+samsung@kernel.org>
2018-05-11media: hackrf: group device capabilitiesGustavo Padovan1-7/+4
Instead of putting V4L2_CAP_STREAMING and V4L2_CAP_READWRITE everywhere, set device_caps earlier with these values. Signed-off-by: Gustavo Padovan <gustavo.padovan@collabora.com> Signed-off-by: Hans Verkuil <hansverk@cisco.com> Signed-off-by: Mauro Carvalho Chehab <mchehab+samsung@kernel.org>
2018-05-11media: xilinx: regroup caps on querycapGustavo Padovan1-4/+6
To better organize the code we concentrate the setting of V4L2_CAP_STREAMING in one place. Signed-off-by: Gustavo Padovan <gustavo.padovan@collabora.com> Signed-off-by: Hans Verkuil <hansverk@cisco.com> Signed-off-by: Mauro Carvalho Chehab <mchehab+samsung@kernel.org>
2018-05-11media: staging: media: use relevant lockJulia Lawall1-1/+1
The data protected is video_out2 and the lock that is released is &video_out2->dma_queue_lock, so it seems that that lock should be taken as well. Signed-off-by: Julia Lawall <Julia.Lawall@lip6.fr> Reviewed-by: Kieran Bingham <kieran.bingham+renesas@ideasonboard.com> Signed-off-by: Hans Verkuil <hansverk@cisco.com> Signed-off-by: Mauro Carvalho Chehab <mchehab+samsung@kernel.org>
2018-05-11media: rcar_jpu: Add missing clk_disable_unprepare() on error in jpu_open()Wei Yongjun1-1/+3
Add the missing clk_disable_unprepare() before return from jpu_open() in the software reset error handling case. Signed-off-by: Wei Yongjun <yongjun_wei@trendmicro.com.cn> Acked-by: Mikhail Ulyanov <mikhail.ulyanov@cogentembedded.com> Reviewed-by: Kieran Bingham <kieran.bingham+renesas@ideasonboard.com> Signed-off-by: Hans Verkuil <hansverk@cisco.com> Signed-off-by: Mauro Carvalho Chehab <mchehab+samsung@kernel.org>
2018-05-11media: dt-bindings: media: renesas-ceu: Add R-Mobile R8A7740Jacopo Mondi1-0/+1
Add R-Mobile A1 R8A7740 SoC to the list of compatible values for the CEU unit. Signed-off-by: Jacopo Mondi <jacopo+renesas@jmondi.org> Reviewed-by: Rob Herring <robh@kernel.org> Reviewed-by: Simon Horman <horms+renesas@verge.net.au> Signed-off-by: Mauro Carvalho Chehab <mchehab+samsung@kernel.org>
2018-05-10media: update/fix my e-mail on some placesMauro Carvalho Chehab2-2/+2
There are two places pointing to an unexisting "m.chehab@kernel.org" email. I never had such email, so, I'm unsure how it ends there. Anyway, it is plain wrong. While here, use my canonical e-mail on a bunch of places that are pointing to another e-mail. The idea is that, from now on, all places will be pointing to the same SMTP server. Signed-off-by: Mauro Carvalho Chehab <mchehab+samsung@kernel.org>
2018-05-10Merge tag 'v4.17-rc4' into patchworkMauro Carvalho Chehab423-2544/+4743
Linux 4.17-rc4 * tag 'v4.17-rc4': (920 commits) Linux 4.17-rc4 KVM: x86: remove APIC Timer periodic/oneshot spikes genksyms: fix typo in parse.tab.{c,h} generation rules kbuild: replace hardcoded bison in cmd_bison_h with $(YACC) gcc-plugins: fix build condition of SANCOV plugin MAINTAINERS: Update Kbuild entry with a few paths Revert "usb: host: ehci: Use dma_pool_zalloc()" platform/x86: Kconfig: Fix dell-laptop dependency chain. platform/x86: asus-wireless: Fix NULL pointer dereference arm64: vgic-v2: Fix proxying of cpuif access KVM: arm/arm64: vgic_init: Cleanup reference to process_maintenance KVM: arm64: Fix order of vcpu_write_sys_reg() arguments MAINTAINERS & files: Canonize the e-mails I use at files media: imx-media-csi: Fix inconsistent IS_ERR and PTR_ERR tools: power/acpi, revert to LD = gcc bdi: Fix oops in wb_workfn() RDMA/cma: Do not query GID during QP state transition to RTR IB/mlx4: Fix integer overflow when calculating optimal MTT size IB/hfi1: Fix memory leak in exception path in get_irq_affinity() IB/{hfi1, rdmavt}: Fix memory leak in hfi1_alloc_devdata() upon failure ...
2018-05-10media: dvbsky: use just one mutex for serializing device R/W opsMauro Carvalho Chehab1-10/+6
Right now, there are two mutexes serializing r/w ops: one "generic" and another one specifically for stream on/off. Clean it a little bit, getting rid of one of the mutexes. Signed-off-by: Mauro Carvalho Chehab <mchehab+samsung@kernel.org>
2018-05-10qm1d1b0004: fix a warning about an unused default_cfg varMauro Carvalho Chehab1-0/+2
As warned by gcc: drivers/media/tuners/qm1d1b0004.c:62:39: warning: 'default_cfg' defined but not used [-Wunused-const-variable=] static const struct qm1d1b0004_config default_cfg = { ^~~~~~~~~~~ This var is currently unused. So, comment it out. Signed-off-by: Mauro Carvalho Chehab <mchehab+samsung@kernel.org>
2018-05-09media: omap3isp: Don't use GFP_DMASakari Ailus1-1/+1
The isp stat driver allocates memory for DMA and uses GFP_DMA flag for dev_alloc_coherent. The flag is no longer needed as the DMA mask is used for the purpose. Remove it. Reported-by: Mauro Carvalho Chehab <mchehab+samsung@kernel.org> Reviewed-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com> Signed-off-by: Sakari Ailus <sakari.ailus@linux.intel.com> Signed-off-by: Mauro Carvalho Chehab <mchehab+samsung@kernel.org>
2018-05-09media: omap3isp: Remove useless NULL check in omap3isp_stat_configSakari Ailus1-6/+0
The omap3isp driver checked whether the second argument (the new configuration) to the ISP statistics is NULL. This is the pointer to the user-given argument and is never NULL. Remove the check. Reported-by: "Gustavo A. R. Silva" <gustavo@embeddedor.com> Suggested-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com> Reviewed-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com> Signed-off-by: Sakari Ailus <sakari.ailus@linux.intel.com> Signed-off-by: Mauro Carvalho Chehab <mchehab+samsung@kernel.org>
2018-05-09media: omap3isp: support 64-bit version of omap3isp_stat_dataArnd Bergmann5-3/+30
C libraries with 64-bit time_t use an incompatible format for struct omap3isp_stat_data. This changes the kernel code to support either version, by moving over the normal handling to the 64-bit variant, and adding compatiblity code to handle the old binary format with the existing ioctl command code. Fortunately, the command code includes the size of the structure, so the difference gets handled automatically. In the process of eliminating the references to 'struct timeval' from the kernel, I also change the way the timestamp is generated internally, basically by open-coding the v4l2_get_timestamp() call. [Sakari Ailus: Alphabetical order of headers, clean up compat code] Cc: Sakari Ailus <sakari.ailus@iki.fi> Signed-off-by: Arnd Bergmann <arnd@arndb.de> Reviewed-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com> Signed-off-by: Sakari Ailus <sakari.ailus@linux.intel.com> Signed-off-by: Mauro Carvalho Chehab <mchehab+samsung@kernel.org>
2018-05-09media: media-device: fix ioctl function typesSami Tolvanen1-10/+11
This change fixes function types for media device ioctls to avoid indirect call mismatches with Control-Flow Integrity checking. Signed-off-by: Sami Tolvanen <samitolvanen@google.com> Acked-by: Sakari Ailus <sakari.ailus@linux.intel.com> Signed-off-by: Hans Verkuil <hans.verkuil@cisco.com> Signed-off-by: Mauro Carvalho Chehab <mchehab+samsung@kernel.org>
2018-05-09media: imx-csi: fix burst size for 16 bitJan Luebbe1-1/+1
A burst_size of 4 does not work for the 16 bit passthrough formats, so we use 8 instead. Signed-off-by: Jan Luebbe <jlu@pengutronix.de> Acked-by: Philipp Zabel <p.zabel@pengutronix.de> Acked-by: Steve Longerbeam <steve_longerbeam@mentor.com> Signed-off-by: Hans Verkuil <hans.verkuil@cisco.com> Signed-off-by: Mauro Carvalho Chehab <mchehab+samsung@kernel.org>
2018-05-09media: imx: add 16-bit grayscale supportPhilipp Zabel2-0/+10
Since commit 50b0f0aee839 ("gpu: ipu-csi: add 10/12-bit grayscale support to mbus_code_to_bus_cfg") the IPU CSI can be configured to capture 10-bit and 12-bit grayscale formats, expanded to 16-bit grayscale, in bayer/generic data mode. This patch adds support for V4L2_PIX_FMT_Y16 captured from sensors that provide MEDIA_BUS_FMT_Y10_1X10 or MEDIA_BUS_FMT_Y12_1X12 data. Cc: Jan Luebbe <jlu@pengutronix.de> Signed-off-by: Philipp Zabel <p.zabel@pengutronix.de> Acked-by: Steve Longerbeam <steve_longerbeam@mentor.com> Signed-off-by: Hans Verkuil <hans.verkuil@cisco.com> Signed-off-by: Mauro Carvalho Chehab <mchehab+samsung@kernel.org>
2018-05-09media: Revert cleanup ktime_set() usageJasmin Jessich3-4/+6
This reverts 8b0e195314fa, because media-tree drivers should use the API functions to initialize variables of type ktime_t. Cc: Thomas Gleixner <tglx@linutronix.de> Signed-off-by: Jasmin Jessich <jasmin@anw.at> Signed-off-by: Hans Verkuil <hans.verkuil@cisco.com> Signed-off-by: Mauro Carvalho Chehab <mchehab+samsung@kernel.org>
2018-05-09media: Use ktime_set() in pt1.cJasmin Jessich1-1/+1
In commit 20a63349b142 a new variable ktime_t delay has been added. We decided to use the API functions to initialize ktime_t variables within media-tree. Thus variable delay needs to be initialized with ktime_set() instead of setting it directly. Signed-off-by: Jasmin Jessich <jasmin@anw.at> Signed-off-by: Hans Verkuil <hans.verkuil@cisco.com> Signed-off-by: Mauro Carvalho Chehab <mchehab+samsung@kernel.org>
2018-05-09media: pvrusb2: delete unneeded includeJulia Lawall1-1/+0
pvrusb2-video-v4l.h only declares pvr2_saa7115_subdev_update and includes pvrusb2-hdw-internal.h. pvrusb2-cx2584x-v4l.c does not use pvr2_saa7115_subdev_update and it explicitly includes pvrusb2-hdw-internal.h. 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+samsung@kernel.org>
2018-05-09media: saa7164: Fix driver name in debug outputBrad Love1-1/+2
This issue was reported by a user who downloaded a corrupt saa7164 firmware, then went looking for a valid xc5000 firmware to fix the error displayed...but the device in question has no xc5000, thus after much effort, the wild goose chase eventually led to a support call. The xc5000 has nothing to do with saa7164 (as far as I can tell), so replace the string with saa7164 as well as give a meaningful hint on the firmware mismatch. Signed-off-by: Brad Love <brad@nextdimension.cc> Signed-off-by: Hans Verkuil <hans.verkuil@cisco.com> Signed-off-by: Mauro Carvalho Chehab <mchehab+samsung@kernel.org>
2018-05-09media: renesas-ceu: Set mbus_fmt on subdev operationsJacopo Mondi1-5/+15
The renesas-ceu driver intializes the desired mbus_format at 'complete' time, inspecting the supported subdevice ones, and tuning some parameters to produce the requested memory format from what the sensor can produce. Although, the initially selected mbus_format was not provided to the subdevice during set_fmt and try_fmt operations, providing instead a '0' mbus format code. As long as the sensor defaults to a compatible mbus_format when an invalid code as '0' is provided, capture operations work correctly. If the subdevice defaults to an unsupported format (eg. some RGB permutations) capture does not work properly due to a mismatch on the expected and received image format on the wire. Fix that by re-using the initially selected mbus_format code during set_fmt and try_fmt subdevice operation calls. Tested by printing out the format selection procedure with ov7670 sensor. Before this patch: [ 0.866001] ov7670_try_fmt_internal -- Looking for mbus_code 0x0000 [ 0.870882] ov7670_try_fmt_internal -- Try mbus_code 0x2008 [ 0.876336] ov7670_try_fmt_internal -- Try mbus_code 0x1002 [ 0.881387] ov7670_try_fmt_internal -- Try mbus_code 0x1008 [ 0.886537] ov7670_try_fmt_internal -- Try mbus_code 0x3001 [ 0.891584] ov7670_try_fmt_internal -- mbus_code defaulted to 0x2008 With this patch applied: [ 0.867015] ov7670_try_fmt_internal -- Looking for mbus_code 0x2008 [ 0.873205] ov7670_try_fmt_internal -- Try mbus_code 0x2008: match Signed-off-by: Jacopo Mondi <jacopo+renesas@jmondi.org> Signed-off-by: Hans Verkuil <hans.verkuil@cisco.com> Signed-off-by: Mauro Carvalho Chehab <mchehab+samsung@kernel.org>
2018-05-09media: cec: Kconfig coding style issueBrad Love1-6/+6
Use tabs instead of spaces and help is two-spaced after single tab. The incorrect spacing breaks menuconfig on older kernels. Signed-off-by: Brad Love <brad@nextdimension.cc> Acked-by: Sakari Ailus <sakari.ailus@linux.intel.com> Signed-off-by: Hans Verkuil <hans.verkuil@cisco.com> Signed-off-by: Mauro Carvalho Chehab <mchehab+samsung@kernel.org>
2018-05-09media: intel-ipu3: Kconfig coding style issueBrad Love1-6/+6
Kconfig Help statements are two-spaced after a single tab. The incorrect spacing breaks menuconfig on older kernels. Signed-off-by: Brad Love <brad@nextdimension.cc> Acked-by: Sakari Ailus <sakari.ailus@linux.intel.com> Signed-off-by: Hans Verkuil <hans.verkuil@cisco.com> Signed-off-by: Mauro Carvalho Chehab <mchehab+samsung@kernel.org>
2018-05-09media: em28xx: Fix DualHD broken second tunerBrad Love1-1/+1
The use of a hard coded i2c address breaks the creation of the second tuner in DualHD 01595 models. The issue is compounded by lack of any error message stating that a driver failed initialization. Use addr, which contains the correct address for each tuner. Fixes: ad32495b1513 ("media: em28xx-dvb: simplify DVB module probing logic") Signed-off-by: Brad Love <brad@nextdimension.cc> Signed-off-by: Hans Verkuil <hans.verkuil@cisco.com> Signed-off-by: Mauro Carvalho Chehab <mchehab+samsung@kernel.org>
2018-05-09media: videobuf-dma-sg: Fix dma_{sync,unmap}_sg() callsRobin Murphy1-2/+2
This reverts commit fc7f8fd42c2b934ac348995e0c530c917fc277d5. Whilst the rationale for the above commit was in general correct, i.e. that users *consuming* the DMA addresses should rely on sglen rather than num_pages, it has always been the case that the DMA API itself still requires that dma_{sync,unmap}_sg() are called with the original number of entries as passed to dma_map_sg(), not the number of mapped entries it returned. Thus the particular changes made in that patch were erroneous. At worst this might lead to data loss at the tail end of mapped buffers on non-coherent hardware, while at best it's an example of incorrect DMA API usage which has proven to mislead readers. Signed-off-by: Robin Murphy <robin.murphy@arm.com> Signed-off-by: Hans Verkuil <hans.verkuil@cisco.com> Signed-off-by: Mauro Carvalho Chehab <mchehab+samsung@kernel.org>
2018-05-09media: media/usbvision: fix spelling mistake: "compresion" -> "compression"Colin Ian King1-1/+1
Trivial fix to spelling mistake in proc text string Signed-off-by: Colin Ian King <colin.king@canonical.com> Signed-off-by: Hans Verkuil <hans.verkuil@cisco.com> Signed-off-by: Mauro Carvalho Chehab <mchehab+samsung@kernel.org>
2018-05-09media: coda: set colorimetry on coded queuePhilipp Zabel1-1/+16
Do not set context colorimetry on the raw (OUTPUT) queue for encoders. Always set colorimetry on the coded queue (CAPTURE for encoders, OUTPUT for decoders). This also skips propagation of capture queue format and selection rectangle on S_FMT(OUTPUT) to the CAPTURE queue for encoders. Signed-off-by: Philipp Zabel <p.zabel@pengutronix.de> Signed-off-by: Hans Verkuil <hans.verkuil@cisco.com> Signed-off-by: Mauro Carvalho Chehab <mchehab+samsung@kernel.org>
2018-05-09media: coda: do not try to propagate format if capture queue busyPhilipp Zabel1-0/+14
The driver helpfully resets the capture queue format and selection rectangle whenever output format is changed. This only works while the capture queue is not busy. Signed-off-by: Philipp Zabel <p.zabel@pengutronix.de> Signed-off-by: Hans Verkuil <hans.verkuil@cisco.com> Signed-off-by: Mauro Carvalho Chehab <mchehab+samsung@kernel.org>
2018-05-09media: coda: reuse coda_s_fmt_vid_cap to propagate format in coda_s_fmt_vid_outPhilipp Zabel1-13/+1
Instead of duplicating the same code, call into coda_s_fmt_vid_out to propagate the output format to the capture queue. Signed-off-by: Philipp Zabel <p.zabel@pengutronix.de> Signed-off-by: Hans Verkuil <hans.verkuil@cisco.com> Signed-off-by: Mauro Carvalho Chehab <mchehab+samsung@kernel.org>
2018-05-09media: sta2x11: Use gpio_is_valid() and remove unnecessary checkArvind Yadav1-16/+15
Replace the manual validity checks for the GPIO with the gpio_is_valid(). In vip_gpio_reserve(), Error checking for gpio pin is not correct. If pwr_pin = -1, It will return 0. This should be return an error. In sta2x11_vip_init_one(), Error checking for gpio 'reset_pin' is unnecessary. Because vip_gpio_reserve() is also checking for valid gpio pin. So removed extra error checking for gpio 'reset_pin'. Signed-off-by: Arvind Yadav <arvind.yadav.cs@gmail.com> Signed-off-by: Hans Verkuil <hans.verkuil@cisco.com> Signed-off-by: Mauro Carvalho Chehab <mchehab+samsung@kernel.org>
2018-05-09media: platform: Use gpio_is_valid()Arvind Yadav1-1/+1
Replace the manual validity checks for the GPIO with the gpio_is_valid(). Signed-off-by: Arvind Yadav <arvind.yadav.cs@gmail.com> Signed-off-by: Hans Verkuil <hans.verkuil@cisco.com> Signed-off-by: Mauro Carvalho Chehab <mchehab+samsung@kernel.org>
2018-05-09media: vpbe_venc: potential uninitialized variable in ven_sub_dev_init()Dan Carpenter1-1/+1
Smatch complains that "venc" could be uninitialized. There are a couple of error paths where it looks like maybe that could happen. I don't know if it's really a bug, but it's reasonable to set "venc" to NULL and silence the warning. Signed-off-by: Dan Carpenter <dan.carpenter@oracle.com> Signed-off-by: Hans Verkuil <hans.verkuil@cisco.com> Signed-off-by: Mauro Carvalho Chehab <mchehab+samsung@kernel.org>
2018-05-09media: cec-gpio: use GPIOD_OUT_HIGH_OPEN_DRAINHans Verkuil1-1/+1
This driver needs a pull up output GPIO, but devm_gpiod_get() is called with GPIOD_IN. This apparently works fine for the RPi3 where the DT correctly specifies a pull up GPIO, but on the i.MX6 it also needs to be specified with devm_gpiod_get(). Reported-by: Henrik Mau <Henrik.Mau@linn.co.uk> Signed-off-by: Hans Verkuil <hans.verkuil@cisco.com> Signed-off-by: Mauro Carvalho Chehab <mchehab+samsung@kernel.org>