summaryrefslogtreecommitdiff
path: root/drivers/media/pci/solo6x10
AgeCommit message (Collapse)Author
2017-12-08media: solo6x10: use ktime_get_ts64() for time syncArnd Bergmann
solo6x10 correctly deals with time stamps and will never suffer from overflows, but it uses the deprecated 'struct timespec' type and 'ktime_get_ts()' interface to read the monotonic clock. This changes it to use ktime_get_ts64() instead, so we can eventually remove ktime_get_ts(). Signed-off-by: Arnd Bergmann <arnd@arndb.de> Signed-off-by: Ismael Luceno <ismael@iodev.co.uk> Signed-off-by: Hans Verkuil <hans.verkuil@cisco.com> Signed-off-by: Mauro Carvalho Chehab <mchehab@s-opensource.com>
2017-12-08media: solo6x10: hide unused variableArnd Bergmann
When building without CONFIG_GPIOLIB, we get a harmless warning about an unused variable: drivers/media/pci/solo6x10/solo6x10-gpio.c: In function 'solo_gpio_init': drivers/media/pci/solo6x10/solo6x10-gpio.c:165:6: error: unused variable 'ret' [-Werror=unused-variable] This adds another #ifdef around the declaration. Fixes: d3202d1981dc ("media: solo6x10: export hardware GPIO pins 8:31 to gpiolib interface") Signed-off-by: Arnd Bergmann <arnd@arndb.de> Signed-off-by: Ismael Luceno <ismael@iodev.co.uk> Acked-by: Anton Sviridenko <anton@corp.bluecherry.net> Signed-off-by: Hans Verkuil <hans.verkuil@cisco.com> Signed-off-by: Mauro Carvalho Chehab <mchehab@s-opensource.com>
2017-11-30media: drivers: remove "/**" from non-kernel-doc commentsMauro Carvalho Chehab
Several comments are wrongly tagged as kernel-doc, causing those warnings: drivers/media/rc/st_rc.c:98: warning: No description found for parameter 'irq' drivers/media/rc/st_rc.c:98: warning: No description found for parameter 'data' drivers/media/pci/solo6x10/solo6x10-enc.c:183: warning: No description found for parameter 'solo_dev' drivers/media/pci/solo6x10/solo6x10-enc.c:183: warning: No description found for parameter 'ch' drivers/media/pci/solo6x10/solo6x10-enc.c:183: warning: No description found for parameter 'qp' drivers/media/usb/pwc/pwc-dec23.c:652: warning: Cannot understand * on line 652 - I thought it was a doc line drivers/media/usb/dvb-usb/cinergyT2-fe.c:40: warning: No description found for parameter 'op' drivers/media/usb/dvb-usb/friio-fe.c:301: warning: Cannot understand * (reg, val) commad list to initialize this module. on line 301 - I thought it was a doc line drivers/media/rc/streamzap.c:201: warning: No description found for parameter 'urb' drivers/media/rc/streamzap.c:333: warning: No description found for parameter 'intf' drivers/media/rc/streamzap.c:333: warning: No description found for parameter 'id' drivers/media/rc/streamzap.c:464: warning: No description found for parameter 'interface' drivers/media/i2c/ov5647.c:432: warning: Cannot understand * @short Subdev core operations registration on line 432 - I thought it was a doc line drivers/media/usb/dvb-usb/friio.c:35: warning: No description found for parameter 'd' drivers/media/usb/dvb-usb/friio.c:35: warning: No description found for parameter 'addr' drivers/media/usb/dvb-usb/friio.c:35: warning: No description found for parameter 'wbuf' drivers/media/usb/dvb-usb/friio.c:35: warning: No description found for parameter 'wlen' drivers/media/usb/dvb-usb/friio.c:35: warning: No description found for parameter 'rbuf' drivers/media/usb/dvb-usb/friio.c:35: warning: No description found for parameter 'rlen' drivers/media/platform/vim2m.c:350: warning: No description found for parameter 'priv' drivers/media/dvb-frontends/tua6100.c:34: warning: cannot understand function prototype: 'struct tua6100_priv ' drivers/media/platform/sti/hva/hva-h264.c:140: warning: cannot understand function prototype: 'struct hva_h264_stereo_video_sei ' drivers/media/platform/sti/hva/hva-h264.c:150: warning: Cannot understand * @frame_width: width in pixels of the buffer containing the input frame on line 150 - I thought it was a doc line drivers/media/platform/sti/hva/hva-h264.c:356: warning: Cannot understand * @ slice_size: slice size on line 356 - I thought it was a doc line drivers/media/platform/sti/hva/hva-h264.c:369: warning: Cannot understand * @ bitstream_size: bitstream size on line 369 - I thought it was a doc line drivers/media/platform/sti/hva/hva-h264.c:395: warning: Cannot understand * @seq_info: sequence information buffer on line 395 - I thought it was a doc line drivers/media/dvb-frontends/sp887x.c:137: warning: No description found for parameter 'fe' drivers/media/dvb-frontends/sp887x.c:137: warning: No description found for parameter 'fw' drivers/media/dvb-frontends/sp887x.c:287: warning: No description found for parameter 'n' drivers/media/dvb-frontends/sp887x.c:287: warning: No description found for parameter 'd' drivers/media/dvb-frontends/sp887x.c:287: warning: No description found for parameter 'quotient_i' drivers/media/dvb-frontends/sp887x.c:287: warning: No description found for parameter 'quotient_f' drivers/media/usb/ttusb-budget/dvb-ttusb-budget.c:83: warning: cannot understand function prototype: 'struct ttusb ' drivers/media/platform/sh_veu.c:277: warning: No description found for parameter 'priv' drivers/media/dvb-frontends/zl10036.c:33: warning: cannot understand function prototype: 'int zl10036_debug; ' drivers/media/dvb-frontends/zl10036.c:179: warning: No description found for parameter 'state' drivers/media/dvb-frontends/zl10036.c:179: warning: No description found for parameter 'frequency' drivers/media/platform/rcar_fdp1.c:1139: warning: No description found for parameter 'priv' drivers/media/platform/ti-vpe/vpe.c:933: warning: No description found for parameter 'priv' drivers/media/usb/gspca/ov519.c:36: warning: No description found for parameter 'fmt' drivers/media/usb/dvb-usb/dib0700_devices.c:3367: warning: No description found for parameter 'adap' Signed-off-by: Mauro Carvalho Chehab <mchehab@s-opensource.com>
2017-08-27media: pci: make video_device constBhumika Goyal
Make these const as they are either used during a copy operation or passed to a const argument of the function cx88_vdev_init. Signed-off-by: Bhumika Goyal <bhumirks@gmail.com> Signed-off-by: Mauro Carvalho Chehab <mchehab@s-opensource.com>
2017-08-20media: solo6x10: make snd_kcontrol_new constBhumika Goyal
Make this const as it is only used during a copy operation. Done using Coccinelle. Signed-off-by: Bhumika Goyal <bhumirks@gmail.com> Signed-off-by: Hans Verkuil <hans.verkuil@cisco.com> Signed-off-by: Mauro Carvalho Chehab <mchehab@s-opensource.com>
2017-08-09media: solo6x10: export hardware GPIO pins 8:31 to gpiolib interfaceAnton Sviridenko
24 GPIO pins from 32 available on solo6x10 chips are exported to gpiolib. First 8 GPIOs are reserved for internal use on capture card boards, GPIOs in range 8:15 are configured as outputs to control relays, remaining 16:31 are configured as inputs to read sensor states. Now with this patch userspace DVR software can switch relays and read sensor states when GPIO extension cards are attached to Softlogic solo6x10 based video capture cards. Signed-off-by: Anton Sviridenko <anton@corp.bluecherry.net> Signed-off-by: Ismael Luceno <ismael@iodev.co.uk> Signed-off-by: Hans Verkuil <hans.verkuil@cisco.com> Signed-off-by: Mauro Carvalho Chehab <mchehab@s-opensource.com>
2017-07-20media: solo6x10: fix detection of TW2864B chipsAnton Sviridenko
This patch enables support for non-Bluecherry labeled solo6110 based PCI cards which have 3 x TW2864B chips and one TW2865. These cards are displayed by lspci -nn as "Softlogic Co., Ltd. SOLO6110 H.264 Video encoder/decoder [9413:6110]" Bluecherry cards have 4 x TW2864A. According to datasheet register 0xFF of TW2864B chips contains value 0x6A or 0x6B depending on revision which being shifted 3 bits right gives value 0x0d. Existing version of solo6x10 fails on these cards with [276582.344942] solo6x10 0000:07:00.0: Probing Softlogic 6110 [276582.402151] solo6x10 0000:07:00.0: Could not initialize any techwell chips [276582.402781] solo6x10: probe of 0000:07:00.0 failed with error -22 Signed-off-by: Anton Sviridenko <anton@corp.bluecherry.net> Acked-by: Andrey Utkin <andrey_utkin@fastmail.com> Signed-off-by: Hans Verkuil <hans.verkuil@cisco.com> Signed-off-by: Mauro Carvalho Chehab <mchehab@s-opensource.com>
2017-07-19media: solo6x10: make const array saa7128_regs_ntsc staticColin Ian King
Don't populate const array saa7128_regs_ntsc on the stack but insteaed make it static. Makes the object code smaller and saves nearly 840 bytes Before: text data bss dec hex filename 9218 360 0 9578 256a solo6x10-tw28.o After: text data bss dec hex filename 8237 504 0 8741 2225 solo6x10-tw28.o Signed-off-by: Colin Ian King <colin.king@canonical.com> Acked-by: Andrey Utkin <andrey_utkin@fastmail.com> Signed-off-by: Ismael Luceno <ismael@iodev.co.uk> Signed-off-by: Hans Verkuil <hans.verkuil@cisco.com> Signed-off-by: Mauro Carvalho Chehab <mchehab@s-opensource.com>
2017-07-06Merge tag 'media/v4.13-1' of ↵Linus Torvalds
git://git.kernel.org/pub/scm/linux/kernel/git/mchehab/linux-media Pull media updates from Mauro Carvalho Chehab: - addition of fwnode support at V4L2 core - addition of a few more SDR formats - new imx driver to support i.MX6 cameras - new driver for Qualcon venus codecs - new I2C sensor drivers: dw9714, max2175, ov13858, ov5640 - new CEC driver: stm32-cec - some improvements to DVB frontend documentation and a few fixups - several driver improvements and fixups * tag 'media/v4.13-1' of git://git.kernel.org/pub/scm/linux/kernel/git/mchehab/linux-media: (361 commits) [media] media: entity: Catch unbalanced media_pipeline_stop calls [media] media/uapi/v4l: clarify cropcap/crop/selection behavior [media] v4l2-ioctl/exynos: fix G/S_SELECTION's type handling [media] vimc: sen: Declare vimc_sen_video_ops as static [media] vimc: sca: Add scaler [media] vimc: deb: Add debayer filter [media] vimc: Subdevices as modules [media] vimc: cap: Support several image formats [media] vimc: sen: Support several image formats [media] vimc: common: Add vimc_colorimetry_clamp [media] vimc: common: Add vimc_link_validate [media] vimc: common: Add vimc_pipeline_s_stream helper [media] vimc: common: Add vimc_ent_sd_* helper [media] vimc: Move common code from the core [media] vimc: sen: Integrate the tpg on the sensor [media] media: i2c: ov772x: Force use of SCCB protocol [media] dvb uapi docs: enums are passed by value, not reference [media] dvb: don't use 'time_t' in event ioctl [media] media: venus: enable building with COMPILE_TEST [media] af9013: refactor power control ...
2017-06-02[media] solo6x10: Convert to the new PCM opsTakashi Iwai
Replace the copy and the silence ops with the new PCM ops. The device supports only 1 channel and 8bit sample, so it's always bytes=frames, and we need no conversion of unit in the callback. Also, it's a capture stream, thus no silence is needed. Acked-by: Hans Verkuil <hans.verkuil@cisco.com> Reviewed-by: Takashi Sakamoto <o-takashi@sakamocchi.jp> Signed-off-by: Takashi Iwai <tiwai@suse.de>
2017-05-19[media] media drivers: annotate fall-throughMauro Carvalho Chehab
Avoid warnings like those: drivers/media/pci/ddbridge/ddbridge-core.c: In function 'dvb_input_detach': drivers/media/pci/ddbridge/ddbridge-core.c:787:6: warning: this statement may fall through [-Wimplicit-fallthrough=] if (input->fe) { ^ drivers/media/pci/ddbridge/ddbridge-core.c:792:2: note: here case 4: ^~~~ ... On several cases, it is just that gcc 7.1 is not capable of understanding the comment, but on other places, we need an annotation. Signed-off-by: Mauro Carvalho Chehab <mchehab@s-opensource.com>
2017-03-22[media] solo6x10: release vb2 buffers in solo_stop_streaming()Anton Sviridenko
Fixes warning that appears in dmesg after closing V4L2 userspace application that plays video from the display device (first device from V4L2 device nodes provided by solo, usually /dev/video0 when no other V4L2 devices are present). Encoder device nodes are not affected. Can be reproduced by starting and closing ffplay -f video4linux2 /dev/video0 [ 8130.281251] ------------[ cut here ]------------ [ 8130.281256] WARNING: CPU: 1 PID: 20414 at drivers/media/v4l2-core/videobuf2-core.c:1651 __vb2_queue_cancel+0x14b/0x230 [ 8130.281257] Modules linked in: ipt_MASQUERADE nf_nat_masquerade_ipv4 iptable_nat solo6x10 x86_pkg_temp_thermal vboxpci(O) vboxnetadp(O) vboxnetflt(O) vboxdrv(O) [ 8130.281264] CPU: 1 PID: 20414 Comm: ffplay Tainted: G O 4.10.0-gentoo #1 [ 8130.281264] Hardware name: ASUS All Series/B85M-E, BIOS 2301 03/30/2015 [ 8130.281265] Call Trace: [ 8130.281267] dump_stack+0x4f/0x72 [ 8130.281270] __warn+0xc7/0xf0 [ 8130.281271] warn_slowpath_null+0x18/0x20 [ 8130.281272] __vb2_queue_cancel+0x14b/0x230 [ 8130.281273] vb2_core_streamoff+0x23/0x90 [ 8130.281275] vb2_streamoff+0x24/0x50 [ 8130.281276] vb2_ioctl_streamoff+0x3d/0x50 [ 8130.281278] v4l_streamoff+0x15/0x20 [ 8130.281279] __video_do_ioctl+0x25e/0x2f0 [ 8130.281280] video_usercopy+0x279/0x520 [ 8130.281282] ? v4l_enum_fmt+0x1330/0x1330 [ 8130.281285] ? unmap_region+0xdf/0x110 [ 8130.281285] video_ioctl2+0x10/0x20 [ 8130.281286] v4l2_ioctl+0xce/0xe0 [ 8130.281289] do_vfs_ioctl+0x8b/0x5b0 [ 8130.281290] ? __fget+0x72/0xa0 [ 8130.281291] SyS_ioctl+0x74/0x80 [ 8130.281294] entry_SYSCALL_64_fastpath+0x13/0x94 [ 8130.281295] RIP: 0033:0x7ff86fee6b27 [ 8130.281296] RSP: 002b:00007ffe467f6a08 EFLAGS: 00000246 ORIG_RAX: 0000000000000010 [ 8130.281297] RAX: ffffffffffffffda RBX: 00000000d1a4d788 RCX: 00007ff86fee6b27 [ 8130.281297] RDX: 00007ffe467f6a14 RSI: 0000000040045613 RDI: 0000000000000006 [ 8130.281298] RBP: 000000000373f8d0 R08: 00000000ffffffff R09: 00007ff860001140 [ 8130.281298] R10: 0000000000000243 R11: 0000000000000246 R12: 0000000000000000 [ 8130.281299] R13: 00000000000000a0 R14: 00007ffe467f6530 R15: 0000000001f32228 [ 8130.281300] ---[ end trace 00695dc96be646e7 ]--- Signed-off-by: Anton Sviridenko <anton@corp.bluecherry.net> Signed-off-by: Hans Verkuil <hans.verkuil@cisco.com> Signed-off-by: Mauro Carvalho Chehab <mchehab@s-opensource.com>
2017-03-22[media] solo6x10: improve subscribe event handlingGustavo Padovan
We already check for the V4L2_EVENT_CTRL inside v4l2_ctrl_subscribe_event() so just move the function to the default: branch of the switch and let it does the job for us. Signed-off-by: Gustavo Padovan <gustavo.padovan@collabora.com> Acked-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>
2017-03-02sched/headers: Prepare to move signal wakeup & sigpending methods from ↵Ingo Molnar
<linux/sched.h> into <linux/sched/signal.h> Fix up affected files that include this signal functionality via sched.h. Acked-by: Linus Torvalds <torvalds@linux-foundation.org> Cc: Mike Galbraith <efault@gmx.de> Cc: Peter Zijlstra <peterz@infradead.org> Cc: Thomas Gleixner <tglx@linutronix.de> Cc: linux-kernel@vger.kernel.org Signed-off-by: Ingo Molnar <mingo@kernel.org>
2017-01-31[media] solo6x10: use designated initializersKees Cook
Prepare to mark sensitive kernel structures for randomization by making sure they're using designated initializers. These were identified during allyesconfig builds of x86, arm, and arm64, with most initializer fixes extracted from grsecurity. Signed-off-by: Kees Cook <keescook@chromium.org> Signed-off-by: Hans Verkuil <hans.verkuil@cisco.com> Signed-off-by: Mauro Carvalho Chehab <mchehab@s-opensource.com>
2016-11-16[media] media: solo6x10: fix lockup by avoiding delayed register writeAndrey Utkin
This fixes a lockup at device probing which happens on some solo6010 hardware samples. This is a regression introduced by commit e1ceb25a1569 ("[media] SOLO6x10: remove unneeded register locking and barriers") The observed lockup happens in solo_set_motion_threshold() called from solo_motion_config(). This extra "flushing" is not fundamentally needed for every write, but apparently the code in driver assumes such behaviour at last in some places. Actual fix was proposed by Hans Verkuil. Fixes: e1ceb25a1569 ("[media] SOLO6x10: remove unneeded register locking and barriers") Cc: stable@vger.kernel.org # 4.3 and up 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>
2016-10-21[media] solo6x10: don't break long linesMauro Carvalho Chehab
Due to the 80-cols restrictions, and latter due to checkpatch warnings, several strings were broken into multiple lines. This is not considered a good practice anymore, as it makes harder to grep for strings at the source code. As we're right now fixing other drivers due to KERN_CONT, we need to be able to identify what printk strings don't end with a "\n". It is a way easier to detect those if we don't break long lines. So, join those continuation lines. The patch was generated via the script below, and manually adjusted if needed. </script> use Text::Tabs; while (<>) { if ($next ne "") { $c=$_; if ($c =~ /^\s+\"(.*)/) { $c2=$1; $next =~ s/\"\n$//; $n = expand($next); $funpos = index($n, '('); $pos = index($c2, '",'); if ($funpos && $pos > 0) { $s1 = substr $c2, 0, $pos + 2; $s2 = ' ' x ($funpos + 1) . substr $c2, $pos + 2; $s2 =~ s/^\s+//; $s2 = ' ' x ($funpos + 1) . $s2 if ($s2 ne ""); print unexpand("$next$s1\n"); print unexpand("$s2\n") if ($s2 ne ""); } else { print "$next$c2\n"; } $next=""; next; } else { print $next; } $next=""; } else { if (m/\"$/) { if (!m/\\n\"$/) { $next=$_; next; } } } print $_; } </script> Signed-off-by: Mauro Carvalho Chehab <mchehab@s-opensource.com>
2016-09-19[media] pci: constify vb2_ops structuresJulia Lawall
Check for vb2_ops structures that are only stored in the ops field of a vb2_queue structure. That field is declared const, so vb2_ops structures that have this property can be declared as const also. The semantic patch that makes this change is as follows: (http://coccinelle.lip6.fr/) // <smpl> @r disable optional_qualifier@ identifier i; position p; @@ static struct vb2_ops i@p = { ... }; @ok@ identifier r.i; struct vb2_queue e; position p; @@ e.ops = &i@p; @bad@ position p != {r.p,ok.p}; identifier r.i; struct vb2_ops e; @@ e@i@p @depends on !bad disable optional_qualifier@ identifier r.i; @@ static +const struct vb2_ops i = { ... }; // </smpl> Signed-off-by: Julia Lawall <Julia.Lawall@lip6.fr> Acked-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>
2016-09-19[media] pci: constify snd_pcm_ops structuresJulia Lawall
Check for snd_pcm_ops structures that are only stored in the ops field of a snd_soc_platform_driver structure or passed as the third argument to snd_pcm_set_ops. The corresponding field or parameter is declared const, so snd_pcm_ops structures that have this property can be declared as const also. The semantic patch that makes this change is as follows: (http://coccinelle.lip6.fr/) // <smpl> @r disable optional_qualifier@ identifier i; position p; @@ static struct snd_pcm_ops i@p = { ... }; @ok1@ identifier r.i; struct snd_soc_platform_driver e; position p; @@ e.ops = &i@p; @ok2@ identifier r.i; expression e1, e2; position p; @@ snd_pcm_set_ops(e1, e2, &i@p) @bad@ position p != {r.p,ok1.p,ok2.p}; identifier r.i; struct snd_pcm_ops e; @@ e@i@p @depends on !bad disable optional_qualifier@ identifier r.i; @@ static +const struct snd_pcm_ops i = { ... }; // </smpl> Signed-off-by: Julia Lawall <Julia.Lawall@lip6.fr> Acked-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>
2016-07-12[media] media: solo6x10: increase FRAME_BUF_SIZEAndrey Utkin
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>
2016-07-08[media] vb2: replace void *alloc_ctxs by struct device *alloc_devsHans Verkuil
Make this a proper typed array. Drop the old allocate context code since that is no longer used. Note that the memops functions now get a struct device pointer instead of the struct device ** that was there initially (actually a void pointer to a struct containing only a struct device pointer). This code is now a lot cleaner. Signed-off-by: Hans Verkuil <hans.verkuil@cisco.com> Reviewed-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com> Cc: Sakari Ailus <sakari.ailus@iki.fi> Signed-off-by: Mauro Carvalho Chehab <mchehab@s-opensource.com>
2016-07-08[media] media/pci: convert drivers to use the new vb2_queue dev fieldHans Verkuil
Stop using alloc_ctx and just fill in the device pointer. Signed-off-by: Hans Verkuil <hans.verkuil@cisco.com> Cc: Federico Vaga <federico.vaga@gmail.com> Signed-off-by: Mauro Carvalho Chehab <mchehab@s-opensource.com>
2016-06-28[media] solo6x10: Simplify solo_enum_ext_inputIsmael Luceno
Additionally, now it specifies which channels it's showing. Signed-off-by: Ismael Luceno <ismael@iodev.co.uk> Signed-off-by: Hans Verkuil <hans.verkuil@cisco.com> Signed-off-by: Mauro Carvalho Chehab <mchehab@s-opensource.com>
2015-12-18[media] media: videobuf2: Move timestamp to vb2_bufferJunghak Sung
Move timestamp from struct vb2_v4l2_buffer to struct vb2_buffer for common use, and change its type to u64 in order to handling y2038 problem. This patch also includes all device drivers' changes related to this restructuring. Signed-off-by: Junghak Sung <jh1009.sung@samsung.com> Signed-off-by: Geunyoung Kim <nenggun.kim@samsung.com> Acked-by: Seung-Woo Kim <sw0312.kim@samsung.com> Acked-by: Inki Dae <inki.dae@samsung.com> Signed-off-by: Hans Verkuil <hansverk@cisco.com> Signed-off-by: Mauro Carvalho Chehab <mchehab@osg.samsung.com>
2015-12-18[media] solo6x10: use v4l2_get_timestamp to fill in buffer timestampHans Verkuil
The timestamp of a v4l2_buffer was advertised as being CLOCK_MONOTONIC, but instead a timestamp from a header field was used. This is inconsistent and not what applications expect. Use v4l2_get_timestamp to properly set the timestamp. Signed-off-by: Hans Verkuil <hans.verkuil@cisco.com> Signed-off-by: Mauro Carvalho Chehab <mchehab@osg.samsung.com>
2015-12-18[media] vb2: drop v4l2_format argument from queue_setupHans Verkuil
The queue_setup callback has a void pointer that is just for V4L2 and is the pointer to the v4l2_format struct that was passed to VIDIOC_CREATE_BUFS. The idea was that drivers would use the information from that struct to buffers suitable for the requested format. After the vb2 split series this pointer is now a void pointer, which is ugly, and the reality is that all existing drivers will effectively just look at the sizeimage field of v4l2_format. To make this more generic the queue_setup callback is changed: the void pointer is dropped, instead if the *num_planes argument is 0, then use the current format size, if it is non-zero, then it contains the number of requested planes and the sizes array contains the requested sizes. If either is unsupported, then return -EINVAL, otherwise use the requested size(s). Signed-off-by: Hans Verkuil <hans.verkuil@cisco.com> Signed-off-by: Mauro Carvalho Chehab <mchehab@osg.samsung.com>
2015-11-06mm, page_alloc: distinguish between being unable to sleep, unwilling to ↵Mel Gorman
sleep and avoiding waking kswapd __GFP_WAIT has been used to identify atomic context in callers that hold spinlocks or are in interrupts. They are expected to be high priority and have access one of two watermarks lower than "min" which can be referred to as the "atomic reserve". __GFP_HIGH users get access to the first lower watermark and can be called the "high priority reserve". Over time, callers had a requirement to not block when fallback options were available. Some have abused __GFP_WAIT leading to a situation where an optimisitic allocation with a fallback option can access atomic reserves. This patch uses __GFP_ATOMIC to identify callers that are truely atomic, cannot sleep and have no alternative. High priority users continue to use __GFP_HIGH. __GFP_DIRECT_RECLAIM identifies callers that can sleep and are willing to enter direct reclaim. __GFP_KSWAPD_RECLAIM to identify callers that want to wake kswapd for background reclaim. __GFP_WAIT is redefined as a caller that is willing to enter direct reclaim and wake kswapd for background reclaim. This patch then converts a number of sites o __GFP_ATOMIC is used by callers that are high priority and have memory pools for those requests. GFP_ATOMIC uses this flag. o Callers that have a limited mempool to guarantee forward progress clear __GFP_DIRECT_RECLAIM but keep __GFP_KSWAPD_RECLAIM. bio allocations fall into this category where kswapd will still be woken but atomic reserves are not used as there is a one-entry mempool to guarantee progress. o Callers that are checking if they are non-blocking should use the helper gfpflags_allow_blocking() where possible. This is because checking for __GFP_WAIT as was done historically now can trigger false positives. Some exceptions like dm-crypt.c exist where the code intent is clearer if __GFP_DIRECT_RECLAIM is used instead of the helper due to flag manipulations. o Callers that built their own GFP flags instead of starting with GFP_KERNEL and friends now also need to specify __GFP_KSWAPD_RECLAIM. The first key hazard to watch out for is callers that removed __GFP_WAIT and was depending on access to atomic reserves for inconspicuous reasons. In some cases it may be appropriate for them to use __GFP_HIGH. The second key hazard is callers that assembled their own combination of GFP flags instead of starting with something like GFP_KERNEL. They may now wish to specify __GFP_KSWAPD_RECLAIM. It's almost certainly harmless if it's missed in most cases as other activity will wake kswapd. Signed-off-by: Mel Gorman <mgorman@techsingularity.net> Acked-by: Vlastimil Babka <vbabka@suse.cz> Acked-by: Michal Hocko <mhocko@suse.com> Acked-by: Johannes Weiner <hannes@cmpxchg.org> Cc: Christoph Lameter <cl@linux.com> Cc: David Rientjes <rientjes@google.com> Cc: Vitaly Wool <vitalywool@gmail.com> Cc: Rik van Riel <riel@redhat.com> Signed-off-by: Andrew Morton <akpm@linux-foundation.org> Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
2015-10-20[media] media: videobuf2: Change queue_setup argumentJunghak Sung
Replace struct v4l2_format * with void * to make queue_setup() for common use. And then, modify all device drivers related with this change. Signed-off-by: Junghak Sung <jh1009.sung@samsung.com> Signed-off-by: Geunyoung Kim <nenggun.kim@samsung.com> Acked-by: Seung-Woo Kim <sw0312.kim@samsung.com> Acked-by: Inki Dae <inki.dae@samsung.com> Signed-off-by: Hans Verkuil <hans.verkuil@cisco.com> [hans.verkuil@cisco.com: fix missing const in fimc-lite.c] Signed-off-by: Mauro Carvalho Chehab <mchehab@osg.samsung.com>
2015-10-01[media] media: videobuf2: Restructure vb2_bufferJunghak Sung
Remove v4l2 stuff - v4l2_buf, v4l2_plane - from struct vb2_buffer. Add new member variables - bytesused, length, offset, userptr, fd, data_offset - to struct vb2_plane in order to cover all information of v4l2_plane. struct vb2_plane { <snip> unsigned int bytesused; unsigned int length; union { unsigned int offset; unsigned long userptr; int fd; } m; unsigned int data_offset; } Replace v4l2_buf with new member variables - index, type, memory - which are common fields for buffer management. struct vb2_buffer { <snip> unsigned int index; unsigned int type; unsigned int memory; unsigned int num_planes; struct vb2_plane planes[VIDEO_MAX_PLANES]; <snip> }; v4l2 specific fields - flags, field, timestamp, timecode, sequence - are moved to vb2_v4l2_buffer in videobuf2-v4l2.c struct vb2_v4l2_buffer { struct vb2_buffer vb2_buf; __u32 flags; __u32 field; struct timeval timestamp; struct v4l2_timecode timecode; __u32 sequence; }; Signed-off-by: Junghak Sung <jh1009.sung@samsung.com> Signed-off-by: Geunyoung Kim <nenggun.kim@samsung.com> Acked-by: Seung-Woo Kim <sw0312.kim@samsung.com> Acked-by: Inki Dae <inki.dae@samsung.com> Signed-off-by: Hans Verkuil <hans.verkuil@cisco.com> Signed-off-by: Mauro Carvalho Chehab <mchehab@osg.samsung.com>
2015-10-01[media] media: videobuf2: Replace videobuf2-core with videobuf2-v4l2Junghak Sung
Make videobuf2-v4l2 as a wrapper of videobuf2-core for v4l2-use. And replace videobuf2-core.h with videobuf2-v4l2.h. This renaming change should be accompanied by the modifications of all device drivers that include videobuf2-core.h. It can be done with just running this shell script. replace() { str1=$1 str2=$2 dir=$3 for file in $(find $dir -name *.h -o -name *.c -o -name Makefile) do echo $file sed "s/$str1/$str2/g" $file > $file.out mv $file.out $file done } replace "videobuf2-core" "videobuf2-v4l2" "include/media/" replace "videobuf2-core" "videobuf2-v4l2" "drivers/media/" replace "videobuf2-core" "videobuf2-v4l2" "drivers/usb/gadget/" replace "videobuf2-core" "videobuf2-v4l2" "drivers/staging/media/" Signed-off-by: Junghak Sung <jh1009.sung@samsung.com> Signed-off-by: Geunyoung Kim <nenggun.kim@samsung.com> Acked-by: Seung-Woo Kim <sw0312.kim@samsung.com> Acked-by: Inki Dae <inki.dae@samsung.com> Signed-off-by: Hans Verkuil <hans.verkuil@cisco.com> Signed-off-by: Mauro Carvalho Chehab <mchehab@osg.samsung.com>
2015-07-06[media] SOLO6x10: Remove dead codeKrzysztof Hałasa
solo_dev and pdev cannot be NULL here. It doesn't matter if we initialized the PCI device or not. Signed-off-by: Krzysztof Ha?asa <khalasa@piap.pl> Signed-off-by: Hans Verkuil <hans.verkuil@cisco.com> Signed-off-by: Mauro Carvalho Chehab <mchehab@osg.samsung.com>
2015-07-06[media] SOLO6x10: remove unneeded register locking and barriersKrzysztof Hałasa
readl() and writel() are atomic, we don't need the spin lock. Also, flushing posted write buffer isn't required. Especially on read :-) Signed-off-by: Krzysztof Ha?asa <khalasa@piap.pl> Signed-off-by: Hans Verkuil <hans.verkuil@cisco.com> Signed-off-by: Mauro Carvalho Chehab <mchehab@osg.samsung.com>
2015-07-06[media] SOLO6x10: unmap registers only after free_irq()Krzysztof Hałasa
Fixes a panic on ARM. Diagnosis by Russell King. Signed-off-by: Krzysztof Ha?asa <khalasa@piap.pl> Signed-off-by: Hans Verkuil <hans.verkuil@cisco.com> Signed-off-by: Mauro Carvalho Chehab <mchehab@osg.samsung.com>
2015-07-06[media] SOLO6x10: Fix G.723 minimum audio period countKrzysztof Hałasa
The period count is fixed, don't confuse ALSA. Signed-off-by: Krzysztof Ha?asa <khalasa@piap.pl> Signed-off-by: Hans Verkuil <hans.verkuil@cisco.com> Signed-off-by: Mauro Carvalho Chehab <mchehab@osg.samsung.com>
2015-01-27[media] solo6x10: s/uint8_t/u8/Ismael Luceno
s/uint8_t/u8/ Signed-off-by: Ismael Luceno <ismael@iodev.co.uk> Signed-off-by: Hans Verkuil <hans.verkuil@cisco.com> Signed-off-by: Mauro Carvalho Chehab <mchehab@osg.samsung.com>
2015-01-27[media] solo6x10: Fix solo_eeprom_read retval typeIsmael Luceno
s/unsigned short/u16/ Signed-off-by: Ismael Luceno <ismael@iodev.co.uk> Signed-off-by: Hans Verkuil <hans.verkuil@cisco.com> Signed-off-by: Mauro Carvalho Chehab <mchehab@osg.samsung.com>
2015-01-27[media] solo6x10: Fix eeprom_* functions buffer's typeIsmael Luceno
s/unsigned short/u16/ Signed-off-by: Ismael Luceno <ismael@iodev.co.uk> Signed-off-by: Hans Verkuil <hans.verkuil@cisco.com> Signed-off-by: Mauro Carvalho Chehab <mchehab@osg.samsung.com>
2015-01-27[media] solo6x10: s/unsigned char/u8/Ismael Luceno
s/unsigned char/u8/ Signed-off-by: Ismael Luceno <ismael@iodev.co.uk> Signed-off-by: Hans Verkuil <hans.verkuil@cisco.com> Signed-off-by: Mauro Carvalho Chehab <mchehab@osg.samsung.com>
2014-12-23[media] solo6x10: just pass frame motion flag from hardware, drop additional ↵Andrey Utkin
handling as complicated and unstable Dropping code (introduced in 316d9e84a72069e04e483de0d5934c1d75f6a44c) which intends to make raising of motion events more "smooth"(?). It made motion event never appear in my installation. That code is complicated, so I couldn't figure out quickly how to fix it, so dropping it seems better to me. Another justification is that anyway application would implement "motion signal stabilization" if required, it is not necessarily kernel driver's job. 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@osg.samsung.com>
2014-12-11Merge tag 'media/v3.19-rc1' of ↵Linus Torvalds
git://git.kernel.org/pub/scm/linux/kernel/git/mchehab/linux-media Pull media updates from Mauro Carvalho Chehab: - Two new dvb frontend drivers: mn88472 and mn88473 - A new driver for some PCIe DVBSky cards - A new remote controller driver: meson-ir - One LIRC staging driver got rewritten and promoted to mainstream: igorplugusb - A new tuner driver (m88rs6000t) - The old omap2 media driver got removed from staging. This driver uses an old DMA API and it is likely broken on recent kernels. Nobody cared enough to fix it - Media bus format moved to a separate header, as DRM will also use the definitions there - mem2mem_testdev were renamed to vim2m, in order to use the same naming convention taken by the other virtual test driver (vivid) - Added a new driver for coda SoC (coda-jpeg) - The cx88 driver got converted to use videobuf2 core - Make DMABUF export buffer to work with DMA Scatter/Gather and Vmalloc cores - Lots of other fixes, improvements and cleanups on the drivers. * tag 'media/v3.19-rc1' of git://git.kernel.org/pub/scm/linux/kernel/git/mchehab/linux-media: (384 commits) [media] mn88473: One function call less in mn88473_init() after error [media] mn88473: Remove uneeded check before release_firmware() [media] lirc_zilog: Deletion of unnecessary checks before vfree() [media] MAINTAINERS: Add myself as img-ir maintainer [media] img-ir: Don't set driver's module owner [media] img-ir: Depend on METAG or MIPS or COMPILE_TEST [media] img-ir/hw: Drop [un]register_decoder declarations [media] img-ir/hw: Fix potential deadlock stopping timer [media] img-ir/hw: Always read data to clear buffer [media] redrat3: ensure dma is setup properly [media] ddbridge: remove unneeded check before dvb_unregister_device() [media] si2157: One function call less in si2157_init() after error [media] tuners: remove uneeded checks before release_firmware() [media] arm: omap2: rx51-peripherals: fix build warning [media] stv090x: add an extra protetion against buffer overflow [media] stv090x: Remove an unreachable code [media] stv090x: Some whitespace cleanups [media] em28xx: checkpatch cleanup: whitespaces/new lines cleanups [media] si2168: add support for firmware files in new format [media] si2168: debug printout for firmware version ...
2014-11-25[media] vb2-dma-sg: move dma_(un)map_sg hereHans Verkuil
This moves dma_(un)map_sg to the get_userptr/put_userptr and alloc/put memops of videobuf2-dma-sg.c and adds dma_sync_sg_for_device/cpu to the prepare/finish memops. Now that vb2-dma-sg will sync the buffers for you in the prepare/finish memops we can drop that from the drivers that use dma-sg. For the solo6x10 driver that was a bit more involved because it needs to copy JPEG or MPEG headers to the buffer before returning it to userspace, and that cannot be done in the old place since the buffer there is still setup for DMA access, not for CPU access. However, the buf_finish op is the ideal place to do this. By the time buf_finish is called the buffer is available for CPU access, so copying to the buffer is fine. [mchehab@osg.samsung.com: Fix a compilation breakage: drivers/media/v4l2-core/videobuf2-dma-sg.c:150:19: error: 'struct vb2_dma_sg_buf' has no member named 'dma_sgt'] Signed-off-by: Hans Verkuil <hans.verkuil@cisco.com> Acked-by: Pawel Osciak <pawel@osciak.com> Signed-off-by: Mauro Carvalho Chehab <mchehab@osg.samsung.com>
2014-11-25[media] vb2-dma-sg: add allocation context to dma-sgHans Verkuil
Require that dma-sg also uses an allocation context. This is in preparation for adding prepare/finish memops to sync the memory between DMA and CPU. Signed-off-by: Hans Verkuil <hans.verkuil@cisco.com> Acked-by: Pawel Osciak <pawel@osciak.com> Signed-off-by: Mauro Carvalho Chehab <mchehab@osg.samsung.com>
2014-11-21[media] solo6x10: fix a race in IRQ handlerKrzysztof Hałasa
The IRQs have to be acknowledged before they are serviced, otherwise some events may be skipped. Also, acknowledging IRQs just before returning from the handler doesn't leave enough time for the device to deassert the INTx line, and for bridges to propagate this change. This resulted in twice the IRQ rate on ARMv6 dual core CPU. Signed-off-by: Krzysztof Ha?asa <khalasa@piap.pl> Acked-by: Andrey Utkin <andrey.utkin@corp.bluecherry.net> Tested-by: Andrey Utkin <andrey.utkin@corp.bluecherry.net> Signed-off-by: Hans Verkuil <hans.verkuil@cisco.com> Signed-off-by: Mauro Carvalho Chehab <mchehab@osg.samsung.com>
2014-11-11[media] solo6x10: don't turn off/on encoder interrupt in processing loopAndrey Utkin
It makes no sense to block the SOLO_IRQ_ENCODER interrupt from being sent while processing an earlier interrupt. New interrupts will just kick the thread again once it is done processing. Signed-off-by: Andrey Utkin <andrey.krieger.utkin@gmail.com> [hans.verkuil@cisco.com: fix commit description] Signed-off-by: Hans Verkuil <hans.verkuil@cisco.com> Signed-off-by: Mauro Carvalho Chehab <mchehab@osg.samsung.com>
2014-11-11[media] solo6x10: bind start & stop of encoded frames processing thread to ↵Andrey Utkin
device (de)init Before, it was called from individual encoder (de)init procedures, which lead to spare threads running (which were actually lost, leaked). The current fix uses trivial approach, and the downside is that the processing thread is working always, even when there's no consumer. Signed-off-by: Andrey Utkin <andrey.krieger.utkin@gmail.com> Signed-off-by: Hans Verkuil <hans.verkuil@cisco.com> Signed-off-by: Mauro Carvalho Chehab <mchehab@osg.samsung.com>
2014-11-11[media] solo6x10: free DMA allocation when releasing encoderAndrey Utkin
Fixes this warning: [ 956.730136] ------------[ cut here ]------------ [ 956.730143] WARNING: CPU: 1 PID: 10134 at lib/dma-debug.c:963 dma_debug_device_change+0x191/0x1f0() [ 956.730146] pci 0000:07:05.0: DMA-API: device driver has pending DMA allocations while released from device [count=8] One of leaked entries details: [device address=0x00000000d3d57000] [size=512 bytes] [mapped with DMA_BIDIRECTIONAL] [mapped as coherent] [ 956.730147] Modules linked in: solo6x10(-) videobuf2_dma_contig videobuf2_dma_sg videobuf2_memops videobuf2_core ipt_MASQUERADE nf_nat_masquerade_ipv4 iptable_nat nf_nat_ipv4 nf_nat videobuf_vmalloc videobuf_core v4l2_common videodev rt2800usb rt2800lib rt2x00usb rt2x00lib mac80211 cfg80211 crc_ccitt usbkbd hid_a4tech hid_generic usbhid snd_hda_codec_hdmi snd_hda_codec_via snd_hda_codec_generic snd_hda_intel snd_hda_controller snd_hda_codec snd_hwdep snd_pcm x86_pkg_temp_thermal snd_timer snd soundcore [ 956.730172] CPU: 1 PID: 10134 Comm: rmmod Not tainted 3.18.0-rc1-next-20141023-zver-dirty #24 [ 956.730173] Hardware name: System manufacturer System Product Name/P8H77-V, BIOS 0501 02/28/2012 [ 956.730175] 0000000000000009 ffff8801df9e3c58 ffffffff817ffe6b 0000000000000001 [ 956.730177] ffff8801df9e3ca8 ffff8801df9e3c98 ffffffff81091ec7 0000000000000046 [ 956.730180] ffff880215457e90 0000000000000008 ffffffff81cbb10f ffff880215570098 [ 956.730183] Call Trace: [ 956.730188] [<ffffffff817ffe6b>] dump_stack+0x4f/0x7c [ 956.730192] [<ffffffff81091ec7>] warn_slowpath_common+0x87/0xb0 [ 956.730194] [<ffffffff81091f91>] warn_slowpath_fmt+0x41/0x50 [ 956.730197] [<ffffffff81412558>] ? dma_debug_device_change+0xb8/0x1f0 [ 956.730199] [<ffffffff81412631>] dma_debug_device_change+0x191/0x1f0 [ 956.730203] [<ffffffff810b14ad>] notifier_call_chain+0x4d/0x70 [ 956.730205] [<ffffffff810b15f9>] __blocking_notifier_call_chain+0x59/0x80 [ 956.730207] [<ffffffff810b1631>] blocking_notifier_call_chain+0x11/0x20 [ 956.730211] [<ffffffff815873af>] __device_release_driver+0xcf/0xf0 [ 956.730213] [<ffffffff81587ee8>] driver_detach+0xc8/0xd0 [ 956.730215] [<ffffffff81587147>] bus_remove_driver+0x57/0xd0 [ 956.730218] [<ffffffff815887e9>] driver_unregister+0x29/0x60 [ 956.730221] [<ffffffff81420131>] pci_unregister_driver+0x21/0x90 [ 956.730225] [<ffffffffa03219d7>] solo_pci_driver_exit+0x10/0x12 [solo6x10] [ 956.730228] [<ffffffff81112ee0>] SyS_delete_module+0x170/0x1f0 [ 956.730232] [<ffffffff813eb76e>] ? trace_hardirqs_on_thunk+0x3a/0x3f [ 956.730234] [<ffffffff8180abd2>] system_call_fastpath+0x12/0x17 [ 956.730235] ---[ end trace e730af02713a6c53 ]--- [ 956.730237] Mapped at: [ 956.730238] [<ffffffff8141186c>] debug_dma_alloc_coherent+0x3c/0xb0 [ 956.730240] [<ffffffffa03203f6>] solo_enc_v4l2_init+0x706/0xba0 [solo6x10] [ 956.730243] [<ffffffffa03165b3>] solo_pci_probe+0x503/0x700 [solo6x10] [ 956.730245] [<ffffffff81420459>] local_pci_probe+0x49/0xa0 [ 956.730248] [<ffffffff814207a1>] pci_device_probe+0xd1/0x120 Signed-off-by: Andrey Utkin <andrey.krieger.utkin@gmail.com> Signed-off-by: Hans Verkuil <hans.verkuil@cisco.com> Signed-off-by: Mauro Carvalho Chehab <mchehab@osg.samsung.com>
2014-11-11[media] solo6x10: clean up properly in stop_streamingAndrey Utkin
This fixes warning from drivers/media/v4l2-core/videobuf2-core.c, WARN_ON(atomic_read(&q->owned_by_drv_count)). Signed-off-by: Andrey Utkin <andrey.krieger.utkin@gmail.com> Signed-off-by: Hans Verkuil <hans.verkuil@cisco.com> Signed-off-by: Mauro Carvalho Chehab <mchehab@osg.samsung.com>
2014-09-03[media] solo6x10: fix sparse warningsHans Verkuil
drivers/media/pci/solo6x10/solo6x10-disp.c:184:24: warning: incorrect type in assignment (different base types) drivers/media/pci/solo6x10/solo6x10-disp.c:223:32: warning: incorrect type in assignment (different base types) Signed-off-by: Hans Verkuil <hans.verkuil@cisco.com> Signed-off-by: Mauro Carvalho Chehab <m.chehab@samsung.com>
2014-08-26[media] be sure that HAS_DMA is enabled for vb2-dma-contigMauro Carvalho Chehab
vb2-dma-contig depends on HAS_DMA, but the Kbuild doesn't take it into account at select. Signed-off-by: Mauro Carvalho Chehab <m.chehab@samsung.com>
2014-07-27[media] solo6x10: fix potential null dereferenceHans Verkuil
drivers/media/pci/solo6x10/solo6x10-disp.c:221 solo_set_motion_block() error: potential null dereference 'buf'. (kzalloc returns null) Also propagate this error up the chain. Signed-off-by: Hans Verkuil <hans.verkuil@cisco.com> Reported-by: kbuild test robot <fengguang.wu@intel.com> Signed-off-by: Mauro Carvalho Chehab <m.chehab@samsung.com>