summaryrefslogtreecommitdiff
path: root/drivers/media/v4l2-core/v4l2-ioctl.c
AgeCommit message (Collapse)Author
2018-01-30media: v4l2-ioctl.c: don't copy back the result for -ENOTTYHans Verkuil
If the ioctl returned -ENOTTY, then don't bother copying back the result as there is no point. Signed-off-by: Hans Verkuil <hans.verkuil@cisco.com> Acked-by: Sakari Ailus <sakari.ailus@linux.intel.com> Cc: <stable@vger.kernel.org> # for v4.15 and up Signed-off-by: Mauro Carvalho Chehab <mchehab@s-opensource.com>
2018-01-30media: v4l2-ioctl.c: use check_fmt for enum/g/s/try_fmtHans Verkuil
Don't duplicate the buffer type checks in enum/g/s/try_fmt. The check_fmt function does that already. It is hard to keep the checks in sync for all these functions and in fact the check for VBI was wrong in the _fmt functions as it allowed SDR types as well. This caused a v4l2-compliance failure for /dev/swradio0 using vivid. This simplifies the code and keeps the check in one place and fixes the SDR/VBI bug. Signed-off-by: Hans Verkuil <hans.verkuil@cisco.com> Acked-by: Sakari Ailus <sakari.ailus@linux.intel.com> Cc: <stable@vger.kernel.org> # for v4.15 and up Signed-off-by: Mauro Carvalho Chehab <mchehab@s-opensource.com>
2018-01-04media: replace all <spaces><tab> occurrencesMauro Carvalho Chehab
There are a lot of places where sequences of space/tabs are found. Get rid of all spaces before tabs. Signed-off-by: Mauro Carvalho Chehab <mchehab@s-opensource.com>
2018-01-04media: v4l: Add a UVC Metadata formatGuennadi Liakhovetski
Add a pixel format, used by the UVC driver to stream metadata. Signed-off-by: Guennadi Liakhovetski <guennadi.liakhovetski@intel.com> Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com> Signed-off-by: Mauro Carvalho Chehab <mchehab@s-opensource.com>
2017-12-29media: videodev2.h, v4l2-ioctl: add IPU3 raw10 color formatYong Zhi
Add IPU3 specific formats: V4L2_PIX_FMT_IPU3_SBGGR10 V4L2_PIX_FMT_IPU3_SGBRG10 V4L2_PIX_FMT_IPU3_SGRBG10 V4L2_PIX_FMT_IPU3_SRGGB10 Signed-off-by: Yong Zhi <yong.zhi@intel.com> Signed-off-by: Sakari Ailus <sakari.ailus@linux.intel.com> Signed-off-by: Mauro Carvalho Chehab <mchehab@s-opensource.com>
2017-09-23media: v4l-ioctl: Fix typo on v4l_print_frmsizeenumRicardo Ribalda
max_width and max_height are swap with step_width and step_height. Signed-off-by: Ricardo Ribalda Delgado <ricardo.ribalda@gmail.com> Signed-off-by: Hans Verkuil <hans.verkuil@cisco.com> Signed-off-by: Mauro Carvalho Chehab <mchehab@s-opensource.com>
2017-08-26media: v4l: Add packed Bayer raw12 pixel formatsSakari Ailus
These formats are compressed 12-bit raw bayer formats with four different pixel orders. They are similar to 10-bit variants. The formats added by this patch are V4L2_PIX_FMT_SBGGR12P V4L2_PIX_FMT_SGBRG12P V4L2_PIX_FMT_SGRBG12P V4L2_PIX_FMT_SRGGB12P Signed-off-by: Sakari Ailus <sakari.ailus@linux.intel.com> Signed-off-by: Hans Verkuil <hans.verkuil@cisco.com> Signed-off-by: Mauro Carvalho Chehab <mchehab@s-opensource.com>
2017-06-23[media] v4l2-ioctl/exynos: fix G/S_SELECTION's type handlingHans Verkuil
The type field in struct v4l2_selection is supposed to never use the _MPLANE variants. E.g. if the driver supports V4L2_BUF_TYPE_VIDEO_CAPTURE_MPLANE, then userspace should still pass V4L2_BUF_TYPE_VIDEO_CAPTURE. The reasons for this are lost in the mists of time, but it is really annoying. In addition, the exynos drivers didn't follow this rule and instead expected the _MPLANE type. To fix that code is added to the v4l2 core that maps the _MPLANE buffer types to their regular equivalents before calling the driver. Effectively this allows for userspace to use either _MPLANE or the regular buffer type. This keeps backwards compatibility while making things easier for userspace. Since drivers now never see the _MPLANE buffer types the exynos drivers had to be adapted as well. Signed-off-by: Hans Verkuil <hansverk@cisco.com> Acked-by: Sakari Ailus <sakari.ailus@linux.intel.com> Acked-by: Sylwester Nawrocki <s.nawrocki@samsung.com> Signed-off-by: Mauro Carvalho Chehab <mchehab@s-opensource.com>
2017-06-20[media] v4l2-core: Use kvmalloc() for potentially big allocationsTomasz Figa
There are multiple places where arrays or otherwise variable sized buffer are allocated through V4L2 core code, including things like controls, memory pages, staging buffers for ioctls and so on. Such allocations can potentially require an order > 0 allocation from the page allocator, which is not guaranteed to be fulfilled and is likely to fail on a system with severe memory fragmentation (e.g. a system with very long uptime). Since the memory being allocated is intended to be used by the CPU exclusively, we can consider using vmalloc() as a fallback and this is exactly what the recently merged kvmalloc() helpers do. A kmalloc() call is still attempted, even for order > 0 allocations, but it is done with __GFP_NORETRY and __GFP_NOWARN, with expectation of failing if requested memory is not available instantly. Only then the vmalloc() fallback is used. This should give us fast and more reliable allocations even on systems with higher memory pressure and/or more fragmentation, while still retaining the same performance level on systems not suffering from such conditions. While at it, replace explicit array size calculations on changed allocations with kvmalloc_array(). Purposedly not touching videobuf1, as it is deprecated, has only few users remaining and would rather be seen removed instead. Signed-off-by: Tomasz Figa <tfiga@chromium.org> Acked-by: Marek Szyprowski <m.szyprowski@samsung.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@s-opensource.com>
2017-06-20[media] media: Add new SDR formats PC16, PC18 & PC20Ramesh Shanmugasundaram
This patch adds support for the three new SDR formats. These formats were prefixed with "planar" indicating I & Q data are not interleaved as in other formats. Here, I & Q data constitutes the top half and bottom half of the received buffer respectively. V4L2_SDR_FMT_PCU16BE - 14-bit complex (I & Q) unsigned big-endian sample inside 16-bit. V4L2 FourCC: PC16 V4L2_SDR_FMT_PCU18BE - 16-bit complex (I & Q) unsigned big-endian sample inside 18-bit. V4L2 FourCC: PC18 V4L2_SDR_FMT_PCU20BE - 18-bit complex (I & Q) unsigned big-endian sample inside 20-bit. V4L2 FourCC: PC20 Signed-off-by: Ramesh Shanmugasundaram <ramesh.shanmugasundaram@bp.renesas.com> Signed-off-by: Hans Verkuil <hansverk@cisco.com> Signed-off-by: Mauro Carvalho Chehab <mchehab@s-opensource.com>
2017-06-06[media] v4l2-ioctl.c: always copy G/S_EDID resultHans Verkuil
The VIDIOC_G/S_EDID ioctls can return valid data even if an error is returned. Mark those ioctls accordingly. Rather than using an explicit 'if' to check for the ioctl (as was done until now for VIDIOC_QUERY_DV_TIMINGS) just set a new flag in the v4l2_ioctls array. Signed-off-by: Hans Verkuil <hans.verkuil@cisco.com> Acked-by: Sakari Ailus <sakari.ailus@linux.intel.com> Signed-off-by: Mauro Carvalho Chehab <mchehab@s-opensource.com>
2017-04-14[media] v4l: Define a pixel format for the R-Car VSP1 2-D histogram engineNiklas Söderlund
The format is used on the R-Car VSP1 video queues that carry 2-D histogram statistics data. Signed-off-by: Niklas Söderlund <niklas.soderlund+renesas@ragnatech.se> Reviewed-by: Laurent Pinchart <laurent.pinchart+renesas@ideasonboard.com> Signed-off-by: Laurent Pinchart <laurent.pinchart+renesas@ideasonboard.com> Signed-off-by: Mauro Carvalho Chehab <mchehab@s-opensource.com>
2017-04-14[media] v4l: Define a pixel format for the R-Car VSP1 1-D histogram engineLaurent Pinchart
The format is used on the R-Car VSP1 video queues that carry 1-D histogram statistics data. Signed-off-by: Laurent Pinchart <laurent.pinchart+renesas@ideasonboard.com> Acked-by: Sakari Ailus <sakari.ailus@linux.intel.com> Signed-off-by: Mauro Carvalho Chehab <mchehab@s-opensource.com>
2017-04-14[media] v4l: Add metadata buffer type and formatLaurent Pinchart
The metadata buffer type is used to transfer metadata between userspace and kernelspace through a V4L2 buffers queue. It comes with a new metadata capture capability and format description. Signed-off-by: Laurent Pinchart <laurent.pinchart+renesas@ideasonboard.com> Tested-by: Guennadi Liakhovetski <guennadi.liakhovetski@intel.com> Acked-by: Sakari Ailus <sakari.ailus@linux.intel.com> Acked-by: Hans Verkuil <hans.verkuil@cisco.com> [hans.verkuil@cisco.com: removed left-over 'experimental' note] [hans.verkuil@cisco.com: add newline after _v4l2-meta-format label] Signed-off-by: Mauro Carvalho Chehab <mchehab@s-opensource.com>
2017-04-10[media] Documentation: Intel SR300 Depth camera INZI formatEvgeni Raikhel
Provide the frame structure and data layout of V4L2-PIX-FMT-INZI format utilized by Intel SR300 Depth camera. Signed-off-by: Evgeni Raikhel <evgeni.raikhel@intel.com> Acked-by: Hans Verkuil <hans.verkuil@cisco.com> Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com> Signed-off-by: Mauro Carvalho Chehab <mchehab@s-opensource.com>
2016-11-23[media] v4l: Add description of the Y8I, Y12I and Z16 formatsLaurent Pinchart
The formats have been added without a description, fix that. Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com> Signed-off-by: Mauro Carvalho Chehab <mchehab@s-opensource.com>
2016-11-23[media] v4l: Add 16-bit raw bayer pixel formatsSakari Ailus
The formats added by this patch are: V4L2_PIX_FMT_SBGGR16 V4L2_PIX_FMT_SGBRG16 V4L2_PIX_FMT_SGRBG16 V4L2_PIX_FMT_SRGGB16 already existed before the patch. Rework the documentation to match that of the other sample depths. Also align the description of V4L2_PIX_FMT_SRGGB16 to match with other similar formats. Signed-off-by: Sakari Ailus <sakari.ailus@linux.intel.com> Acked-by: Lad, Prabhakar <prabhakar.csengg@gmail.com> Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com> Signed-off-by: Mauro Carvalho Chehab <mchehab@s-opensource.com>
2016-10-21[media] videodev2.h Add HSV formatsRicardo Ribalda Delgado
These formats store the color information of the image in a geometrical representation. The colors are mapped into a cylinder, where the angle is the HUE, the height is the VALUE and the distance to the center is the SATURATION. This is a very useful format for image segmentation algorithms. Signed-off-by: Ricardo Ribalda Delgado <ricardo.ribalda@gmail.com> Acked-by: Hans Verkuil <hans.verkuil@cisco.com> Signed-off-by: Mauro Carvalho Chehab <mchehab@s-opensource.com>
2016-10-21[media] v4l: add Mediatek compressed video block formatTiffany Lin
Add V4L2_PIX_FMT_MT21C format used on MT8173 driver. It is compressed format and need MT8173 MDP driver to transfer to other standard format. 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-10-21[media] v4l2-ioctl: add VP9 format descriptionWu-Cheng Li
VP9 is a video coding format and a successor to VP8. Signed-off-by: Wu-Cheng Li <wuchengli@chromium.org> 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-10-21[media] v4l2-core: 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-09[media] v4l: ioctl: Clear the v4l2_pix_format_mplane reserved fieldLaurent Pinchart
The S_FMT and TRY_FMT handlers in multiplane mode attempt at clearing the reserved fields of the v4l2_format structure after the pix_mp member. However, the reserved fields are inside pix_mp, not after it. Signed-off-by: Laurent Pinchart <laurent.pinchart+renesas@ideasonboard.com> Tested-by: Kieran Bingham <kieran@bingham.xyz> Acked-by: Sakari Ailus <sakari.ailus@linux.intel.com> Signed-off-by: Mauro Carvalho Chehab <mchehab@s-opensource.com>
2016-08-23[media] v4l2-core: Add support for touch devicesNick Dyer
Some touch controllers send out touch data in a similar way to a greyscale frame grabber. Add new device type VFL_TYPE_TOUCH: - This uses a new device prefix v4l-touch for these devices, to stop generic capture software from treating them as webcams. Otherwise, touch is treated similarly to video capture. - Add V4L2_INPUT_TYPE_TOUCH - Add MEDIA_INTF_T_V4L_TOUCH - Add V4L2_CAP_TOUCH to indicate device is a touch device Add formats: - V4L2_TCH_FMT_DELTA_TD16 for signed 16-bit touch deltas - V4L2_TCH_FMT_DELTA_TD08 for signed 16-bit touch deltas - V4L2_TCH_FMT_TU16 for unsigned 16-bit touch data - V4L2_TCH_FMT_TU08 for unsigned 8-bit touch data This support will be used by: - Atmel maXTouch (atmel_mxt_ts) - Synaptics RMI4. - sur40 Signed-off-by: Nick Dyer <nick@shmanahar.org> Tested-by: Chris Healy <cphealy@gmail.com> Signed-off-by: Hans Verkuil <hans.verkuil@cisco.com> Signed-off-by: Mauro Carvalho Chehab <mchehab@s-opensource.com> Acked-by: Dmitry Torokhov <dmitry.torokhov@gmail.com>
2016-07-26Merge tag 'media/v4.8-1' of ↵Linus Torvalds
git://git.kernel.org/pub/scm/linux/kernel/git/mchehab/linux-media Pull media updates from Mauro Carvalho Chehab: - new framework support for HDMI CEC and remote control support - new encoding codec driver for Mediatek SoC - new frontend driver: helene tuner - added support for NetUp almost universal devices, with supports DVB-C/S/S2/T/T2 and ISDB-T - the mn88472 frontend driver got promoted from staging - a new driver for RCar video input - some soc_camera legacy drivers got removed: timb, omap1, mx2, mx3 - lots of driver cleanups, improvements and fixups * tag 'media/v4.8-1' of git://git.kernel.org/pub/scm/linux/kernel/git/mchehab/linux-media: (377 commits) [media] cec: always check all_device_types and features [media] cec: poll should check if there is room in the tx queue [media] vivid: support monitor all mode [media] cec: fix test for unconfigured adapter in main message loop [media] cec: limit the size of the transmit queue [media] cec: zero unused msg part after msg->len [media] cec: don't set fh to NULL in CEC_TRANSMIT [media] cec: clear all status fields before transmit and always fill in sequence [media] cec: CEC_RECEIVE overwrote the timeout field [media] cxd2841er: Reading SNR for DVB-C added [media] cxd2841er: Reading BER and UCB for DVB-C added [media] cxd2841er: fix switch-case for DVB-C [media] cxd2841er: fix signal strength scale for ISDB-T [media] cxd2841er: adjust the dB scale for DVB-C [media] cxd2841er: provide signal strength for DVB-C [media] cxd2841er: fix BER report via DVBv5 stats API [media] mb86a20s: apply mask to val after checking for read failure [media] airspy: fix error logic during device register [media] s5p-cec/TODO: add TODO item [media] cec/TODO: drop comment about sphinx documentation ...
2016-07-12[media] v4l2-ioctl: zero the v4l2_bt_timings reserved fieldHans Verkuil
This field should be zeroed. Both for s_dv_timings and for enum_dv_timings. In fact, for the latter anything after the pad field can be zeroed. Signed-off-by: Hans Verkuil <hans.verkuil@cisco.com> Signed-off-by: Mauro Carvalho Chehab <mchehab@s-opensource.com>
2016-06-07[media] v4l2-ioctl: fix stupid mistake in cropcap conditionHans Verkuil
Fix duplicate tests in condition. The second test for vidioc_cropcap should have tested for vidioc_g_selection instead. Signed-off-by: Hans Verkuil <hans.verkuil@cisco.com> Reported-by: David Binderman <linuxdev.baldrick@gmail.com> Acked-by: Sakari Ailus <sakari.ailus@linux.intel.com> Signed-off-by: Mauro Carvalho Chehab <mchehab@osg.samsung.com>
2016-05-06[media] v4l2-ioctl.c: improve cropcap compatibility codeHans Verkuil
- Add a check for the case that both the cropcap and g_selection ops are NULL. This shouldn't happen, but I feel happier if the code guards against this. - If g_selection exists, then ignore ENOTTY and ENOIOCTLCMD error codes from cropcap. Just assume square pixelaspect ratio in that case. This situation can happen if the bridge driver's cropcap op calls the corresponding subdev's op. So the cropcap ioctl is set, but it might return ENOIOCTLCMD anyway. In the past this would just return an error which is wrong. - Call cropcap first and let g_selection overwrite the bounds and defrect. This safeguards against subdev cropcap implementations that set those rectangles as well. What g_selection returns has priority over what such cropcap implementations return. Signed-off-by: Hans Verkuil <hans.verkuil@cisco.com> Signed-off-by: Mauro Carvalho Chehab <mchehab@osg.samsung.com>
2016-04-13Revert "[media] v4l2-ioctl: simplify code"Mauro Carvalho Chehab
There are some issues rised on this patch during patch review. I ended by merging this one by mistake. So, let's revert it. This reverts commit 54ace1cfd4358fd11112f17cc711eea234d5ab9e. Cc: Hans Verkuil <hans.verkuil@cisco.com> Signed-off-by: Mauro Carvalho Chehab <mchehab@osg.samsung.com>
2016-04-13[media] v4l2-ioctl: simplify codeHans Verkuil
Instead of a big if at the beginning, just check if g_selection == NULL and call the cropcap op immediately and return the result. No functional changes in this patch. Signed-off-by: Hans Verkuil <hans.verkuil@cisco.com> Signed-off-by: Mauro Carvalho Chehab <mchehab@osg.samsung.com>
2016-04-13[media] v4l2: add device_caps to struct video_deviceHans Verkuil
Instead of letting drivers fill in device_caps at querycap time, let them fill it in when the video device is registered. This has the advantage that in the future the v4l2 core can access the video device's capabilities and take decisions based on that. Signed-off-by: Hans Verkuil <hans.verkuil@cisco.com> Signed-off-by: Laurent Pinchart <laurent.pinchart+renesas@ideasonboard.com> Signed-off-by: Mauro Carvalho Chehab <mchehab@osg.samsung.com>
2016-03-05[media] v4l2-ioctl: fix YUV422P pixel format descriptionPhilipp Zabel
The plane order is YUV, not YVU. Signed-off-by: Philipp Zabel <p.zabel@pengutronix.de> Signed-off-by: Mauro Carvalho Chehab <mchehab@osg.samsung.com>
2016-02-27[media] media: Change v4l-core to check if source is freeShuah Khan
Change s_input, s_fmt, s_tuner, s_frequency, querystd, s_hw_freq_seek, and vb2_core_streamon interfaces that alter the tuner configuration to check if it is free, by calling v4l_enable_media_source(). If source isn't free, return -EBUSY. v4l_disable_media_source() is called from v4l2_fh_exit() to release tuner (source). vb2_core_streamon() uses v4l_vb2q_enable_media_source(). Signed-off-by: Shuah Khan <shuahkh@osg.samsung.com> Signed-off-by: Mauro Carvalho Chehab <mchehab@osg.samsung.com>
2016-02-19[media] v4l: Add YUV 4:2:2 and YUV 4:4:4 tri-planar non-contiguous formatsLaurent Pinchart
The formats use three planes through the multiplanar API, allowing for non-contiguous planes in memory. Signed-off-by: Laurent Pinchart <laurent.pinchart+renesas@ideasonboard.com> Acked-by: Hans Verkuil <hans.verkuil@cisco.com> Signed-off-by: Mauro Carvalho Chehab <mchehab@osg.samsung.com>
2015-11-17[media] media/core: Replace ctrl_class with whichRicardo Ribalda
Replace the obsolete field ctrl_class with "which". Make sure it not used in future modules by commenting out the field with ifndef __KERNEL_ . The field cannot be simply removed because that would be change on the kenel API to the userspace (and we don't like that). Signed-off-by: Ricardo Ribalda Delgado <ricardo.ribalda@gmail.com> Signed-off-by: Hans Verkuil <hans.verkuil@cisco.com> Signed-off-by: Mauro Carvalho Chehab <mchehab@osg.samsung.com>
2015-10-20[media] v4l: add type field to v4l2_modulator structAntti Palosaari
Add type field to that struct like it counterpart v4l2_tuner already has. We need type field to distinguish different tuner types from each others for transmitter too. Signed-off-by: Antti Palosaari <crope@iki.fi> Signed-off-by: Hans Verkuil <hans.verkuil@cisco.com> Signed-off-by: Mauro Carvalho Chehab <mchehab@osg.samsung.com>
2015-10-20[media] v4l2: add support for SDR transmitterAntti Palosaari
New IOCTL ops: vidioc_enum_fmt_sdr_out vidioc_g_fmt_sdr_out vidioc_s_fmt_sdr_out vidioc_try_fmt_sdr_out New vb2 buffertype: V4L2_BUF_TYPE_SDR_OUTPUT New v4l2 capability: V4L2_CAP_SDR_OUTPUT Signed-off-by: Antti Palosaari <crope@iki.fi> Signed-off-by: Hans Verkuil <hans.verkuil@cisco.com> Signed-off-by: Mauro Carvalho Chehab <mchehab@osg.samsung.com>
2015-10-20[media] v4l2: rename V4L2_TUNER_ADC to V4L2_TUNER_SDRAntti Palosaari
SDR receiver has ADC (Analog-to-Digital Converter) and SDR transmitter has DAC (Digital-to-Analog Converter). Originally I though it could be good idea to have own type for receiver and transmitter, but now I feel one common type for SDR is enough. So lets rename it. Signed-off-by: Antti Palosaari <crope@iki.fi> Acked-by: Mauro Carvalho Chehab <mchehab@osg.samsung.com> Signed-off-by: Hans Verkuil <hans.verkuil@cisco.com> [hans.verkuil@cisco.com: this was added in 4.4, so update 4.2 to 4.4] 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-08-11[media] v4l2: move tracepoint generation into separate filePhilipp Zabel
To compile videobuf2-core as a module, the vb2_* tracepoints must be exported from the videodev module. Instead of exporting vb2 tracepoint symbols from v4l2-ioctl.c, move the tracepoint generation into a separate file. This patch fixes the following build error in the modpost stage, introduced by 2091f5181c66 ("[media] videobuf2: add trace events"): ERROR: "__tracepoint_vb2_buf_done" undefined! ERROR: "__tracepoint_vb2_dqbuf" undefined! ERROR: "__tracepoint_vb2_qbuf" undefined! ERROR: "__tracepoint_vb2_buf_queue" undefined! Suggested-by: Steven Rostedt <rostedt@goodmis.org> 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@osg.samsung.com>
2015-08-11[media] v4l2-ioctl: Give more information when device_caps are missingLaura Abbott
Currently, the warning for missing device_caps gives a backtrace like so: [<ffffffff8175c199>] dump_stack+0x45/0x57 [<ffffffff8109ad5a>] warn_slowpath_common+0x8a/0xc0 [<ffffffff8109ae8a>] warn_slowpath_null+0x1a/0x20 [<ffffffffa0237453>] v4l_querycap+0x43/0x80 [videodev] [<ffffffffa0237734>] __video_do_ioctl+0x2a4/0x320 [videodev] [<ffffffff812207e5>] ? do_last+0x195/0x1210 [<ffffffffa023a11e>] video_usercopy+0x22e/0x5b0 [videodev] [<ffffffffa0237490>] ? v4l_querycap+0x80/0x80 [videodev] [<ffffffffa023a4b5>] video_ioctl2+0x15/0x20 [videodev] [<ffffffffa0233733>] v4l2_ioctl+0x113/0x150 [videodev] [<ffffffff81225798>] do_vfs_ioctl+0x2f8/0x4f0 [<ffffffff8113b2d4>] ? __audit_syscall_entry+0xb4/0x110 [<ffffffff81022d7c>] ? do_audit_syscall_entry+0x6c/0x70 [<ffffffff81225a11>] SyS_ioctl+0x81/0xa0 [<ffffffff8113b526>] ? __audit_syscall_exit+0x1f6/0x2a0 [<ffffffff81763549>] system_call_fastpath+0x12/0x17 This indicates that device_caps are missing but doesn't give much of a clue which driver is actually at fault. Improve the warning output by showing the capabilities and the responsible driver. Signed-off-by: Laura Abbott <labbott@fedoraproject.org> Signed-off-by: Hans Verkuil <hans.verkuil@cisco.com> Signed-off-by: Mauro Carvalho Chehab <mchehab@osg.samsung.com>
2015-06-06[media] v4l2-ioctl: log buffer type 0 correctlyHans Verkuil
If userspace passed the invalid buffer type 0 to the kernel, then the kernel log would show 'type=(null)' since there was no string defined for type 0. Fix this. Signed-off-by: Hans Verkuil <hans.verkuil@cisco.com> Signed-off-by: Mauro Carvalho Chehab <mchehab@osg.samsung.com>
2015-06-06[media] v4l2-ioctl: clear the reserved field of v4l2_create_buffersHans Verkuil
This field was never cleared by the kernel making future extensions hard to implement. Clear it now. Signed-off-by: Hans Verkuil <hans.verkuil@cisco.com> Signed-off-by: Mauro Carvalho Chehab <mchehab@osg.samsung.com>
2015-06-05[media] videodev2.h: add support for transfer functionsHans Verkuil
In the past the transfer function was implied by the colorspace. However, it is an independent entity in its own right. Add support for explicitly choosing the transfer function. This change will allow us to represent linear RGB (as is used by openGL), and it will make it easier to work with decoded video material since most codecs store the transfer function as a separate property as well. Signed-off-by: Hans Verkuil <hans.verkuil@cisco.com> Signed-off-by: Mauro Carvalho Chehab <mchehab@osg.samsung.com>
2015-05-30[media] v4l2: correct two SDR format namesAntti Palosaari
U8 and U16LE format human readable names were translated with string containing emulated word. These strings were taken from msi2500 driver, where those formats were emulated (after module parameter is set). But on API correct names should be used, without any special case notes. Signed-off-by: Antti Palosaari <crope@iki.fi> Signed-off-by: Hans Verkuil <hans.verkuil@cisco.com> Signed-off-by: Mauro Carvalho Chehab <mchehab@osg.samsung.com>
2015-05-30[media] media/v4l2-core: Add support for V4L2_PIX_FMT_Y16_BERicardo Ribalda
16 bit greyscale format, structured in Big Endian. Such a format can be converted into a PMN image just by adding a header. Signed-off-by: Ricardo Ribalda Delgado <ricardo.ribalda@gmail.com> Signed-off-by: Hans Verkuil <hans.verkuil@cisco.com> Signed-off-by: Mauro Carvalho Chehab <mchehab@osg.samsung.com>
2015-05-01v4l2-ioctl: add a missing break at v4l_fill_fmtdesc()Mauro Carvalho Chehab
The changeset ba3002045f8022 added a logic at the core to fill the format description, however, a break is missing on one of the formats, as reported by smatch: drivers/media/v4l2-core/v4l2-ioctl.c:1211 v4l_fill_fmtdesc() warn: missing break? reassigning 'descr' Signed-off-by: Mauro Carvalho Chehab <mchehab@osg.samsung.com>
2015-05-01[media] v4l2-ioctl: fill in the description for VIDIOC_ENUM_FMTHans Verkuil
The descriptions used in drivers for the formats returned with ENUM_FMT are all over the place. So instead allow the core to fill them in if the driver didn't. This allows drivers to drop the description and flags. Based on an earlier patch from Philipp Zabel: http://comments.gmane.org/gmane.linux.drivers.video-input-infrastructure/81411 Signed-off-by: Hans Verkuil <hans.verkuil@cisco.com> Acked-by: Philipp Zabel <p.zabel@pengutronix.de> Acked-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com> Acked-by: Sakari Ailus <sakari.ailus@linux.intel.com> Signed-off-by: Mauro Carvalho Chehab <mchehab@osg.samsung.com>
2015-04-02[media] v4l2-ioctl: allow all controls if ctrl_class == 0Hans Verkuil
The check_ext_ctrls() function in v4l2-ioctl.c checks if all controls in the control array are from the same control class as c->ctrl_class. However, that check should only be done if c->ctrl_class != 0. A 0 value means that this restriction does not apply. So return 1 (OK) if c->ctrl_class == 0. Found by running v4l2-compliance on the uvc driver. Signed-off-by: Hans Verkuil <hans.verkuil@cisco.com> Acked-by: Sakari Ailus <sakari.ailus@linux.intel.com> Signed-off-by: Mauro Carvalho Chehab <mchehab@osg.samsung.com>
2015-04-02[media] v4l2-ioctl: tidy up debug messagesHans Verkuil
Make sure the format fields are reported consistently. Signed-off-by: Hans Verkuil <hans.verkuil@cisco.com> Acked-by: Sakari Ailus <sakari.ailus@linux.intel.com> Signed-off-by: Mauro Carvalho Chehab <mchehab@osg.samsung.com>
2015-03-02[media] v4l2-core: drop g/s_priority opsHans Verkuil
The handling of VIDIOC_G/S_PRIORITY is now entirely done by the V4L2 core, so we can drop the g/s_priority ioctl ops. We do have to make sure though that when S_PRIORITY is called we check that the driver used struct v4l2_fh. This check can be removed once all drivers are converted to that structure. Signed-off-by: Hans Verkuil <hans.verkuil@cisco.com> Signed-off-by: Mauro Carvalho Chehab <mchehab@osg.samsung.com>