Hans Verkuil [Thu, 21 Jul 2016 12:14:03 +0000 (09:14 -0300)]
[media] vb2: add WARN_ONs checking if a valid struct device was passed
The dma-contig and dma-sg memops require a valid struct device for
the DMA to be handled correctly.
Call WARN_ON and return ERR_PTR(-EINVAL) if it was NULL.
Setting the correct device pointer was forgotten in several new driver
submissions. This was caught during code review, but it really should be
caught in the code.
Signed-off-by: Hans Verkuil <hans.verkuil@cisco.com> Signed-off-by: Mauro Carvalho Chehab <mchehab@s-opensource.com>
[media] vb2: remove TODO comment for dma-buf in QBUF
There is a TODO comment about the dma-buf being mapped in VIDIOC_QBUF
instead of doing it closer to when the actual DMA is going to happen
when the buffers are queued in the driver (i.e: __enqueue_in_driver).
But there is a reason to do it earlier in QBUF, and is that userspace
has no way to know if a exported dma-buf can be imported successfully
and so relies on QBUF succeeding as indication that the dma-buf mapped.
If QBUF fails, the application can fallback to another streaming I/O
method. But moving the dma-buf mapping later when queueing the buffers
can be too late for userspace to recover, since it may had dropped the
buffer(s) already when it knows that the dma-buf mapping failed.
So remove the TODO instead and change the comment to explain this.
Suggested-by: Hans Verkuil <hverkuil@xs4all.nl> Signed-off-by: Javier Martinez Canillas <javier@osg.samsung.com> Signed-off-by: Hans Verkuil <hans.verkuil@cisco.com> Signed-off-by: Mauro Carvalho Chehab <mchehab@s-opensource.com>
Hans Verkuil [Wed, 20 Jul 2016 12:31:25 +0000 (09:31 -0300)]
[media] vivid: return -ENODATA if the current input doesn't support g/s_selection
Returning -EINVAL indicates wrong arguments, but that's not the case
here.
Returning -ENOTTY is also no option, since the ioctl is implemented, but
it just is not valid for this input.
So use -ENODATA instead. This is also used elsewhere when an ioctl isn't
valid for a specific input.
In this case G/S_SELECTION returned -EINVAL for the webcam input. That
input doesn't support cropping, instead it uses ENUM_FRAMESIZES to
enumerate a list of discrete frame sizes.
Signed-off-by: Hans Verkuil <hans.verkuil@cisco.com> Signed-off-by: Mauro Carvalho Chehab <mchehab@s-opensource.com>
The workqueue work_queue is involved in EDID (Extended Display
Identification Data) handling.
It has a single work item(&state->edid_handler) and hence
doesn't require ordering. It is not being used on a memory reclaim path.
Hence, the singlethreaded workqueue has been replaced with
the use of system_wq.
&state->edid_handler is a self requeueing work item and it has been
been sync cancelled in ad9389b_remove() to ensure that nothing is
pending when the driver is disconnected.
The workqueue "work_thread" is involved in streaming the camera data.
It has a single work item(&dev->work_struct) and hence doesn't require
ordering. Also, it is not being used on a memory reclaim path.
Hence, the singlethreaded workqueue has been replaced with the use of
system_wq.
System workqueues have been able to handle high level of concurrency
for a long time now and hence it's not required to have a singlethreaded
workqueue just to gain concurrency. Unlike a dedicated per-cpu workqueue
created with create_singlethread_workqueue(), system_wq allows multiple
work items to overlap executions even on the same CPU; however, a
per-cpu workqueue doesn't have any CPU locality or global ordering
guarantee unless the target CPU is explicitly specified and thus the
increase of local concurrency shouldn't make any difference.
Work item has been flushed in sd_stop0() to ensure that there are no
pending tasks while disconnecting the driver.
The workqueue "work_thread" is involved in streaming the camera data.
It has a single work item(&sd->work_struct) and hence doesn't require
ordering. Also, it is not being used on a memory reclaim path.
Hence, the singlethreaded workqueue has been replaced with the use of
system_wq.
System workqueues have been able to handle high level of concurrency
for a long time now and hence it's not required to have a singlethreaded
workqueue just to gain concurrency. Unlike a dedicated per-cpu workqueue
created with create_singlethread_workqueue(), system_wq allows multiple
work items to overlap executions even on the same CPU; however, a
per-cpu workqueue doesn't have any CPU locality or global ordering
guarantee unless the target CPU is explicitly specified and thus the
increase of local concurrency shouldn't make any difference.
Work item has been flushed in sd_stop0() to ensure that there are no
pending tasks while disconnecting the driver.
The workqueue "work_thread" is involved in streaming the camera data.
It has a single work item(&sd->work_struct) and hence doesn't require
ordering. Also, it is not being used on a memory reclaim path.
Hence, the singlethreaded workqueue has been replaced with the use of
system_wq.
System workqueues have been able to handle high level of concurrency
for a long time now and hence it's not required to have a singlethreaded
workqueue just to gain concurrency. Unlike a dedicated per-cpu workqueue
created with create_singlethread_workqueue(), system_wq allows multiple
work items to overlap executions even on the same CPU; however, a
per-cpu workqueue doesn't have any CPU locality or global ordering
guarantee unless the target CPU is explicitly specified and thus the
increase of local concurrency shouldn't make any difference.
Work item has been flushed in sd_stop0() to ensure that there are no
pending tasks while disconnecting the driver.
The workqueue "work_thread" is involved in updating the JPEG quality
of the gspca_dev. It has a single work item(&sd->work) and hence doesn't
require ordering. Also, it is not being used on a memory reclaim path.
Hence, the singlethreaded workqueue has been replaced with the use of
system_wq.
System workqueues have been able to handle high level of concurrency
for a long time now and hence it's not required to have a singlethreaded
workqueue just to gain concurrency. Unlike a dedicated per-cpu workqueue
created with create_singlethread_workqueue(), system_wq allows multiple
work items to overlap executions even on the same CPU; however, a
per-cpu workqueue doesn't have any CPU locality or global ordering
guarantee unless the target CPU is explicitly specified and thus the
increase of local concurrency shouldn't make any difference.
Work item has been flushed in sd_stop0() to ensure that there are no
pending tasks while disconnecting the driver.
The workqueue "workqueue" is involved in polling the pvrusb2 hardware
(pvr2_hdw).
It has a single work item(&hdw->workpoll) and hence doesn't require
ordering. Also, it is not being used on a memory reclaim path.
Hence, the singlethreaded workqueue has been replaced with the use of
system_wq.
System workqueues have been able to handle high level of concurrency
for a long time now and hence it's not required to have a singlethreaded
workqueue just to gain concurrency. Unlike a dedicated per-cpu workqueue
created with create_singlethread_workqueue(), system_wq allows multiple
work items to overlap executions even on the same CPU; however, a
per-cpu workqueue doesn't have any CPU locality or global ordering
guarantee unless the target CPU is explicitly specified and thus the
increase of local concurrency shouldn't make any difference.
Work item has been flushed in pvr2_hdw_destroy to ensure that there are no
pending tasks while disconnecting the driver.
Currently, the hardware is not given a complete initial
configuration.
In order to fix this, this rather large commit reworks
standard, frame format and input configuration. While
at it, we introduce proper functions to configure
each parameter, and as a result the code is a bit cleaner.
Reported-by: Hans Verkuil <hans.verkuil@cisco.com> Signed-off-by: Ezequiel Garcia <ezequiel@vanguardiasur.com.ar> Signed-off-by: Hans Verkuil <hans.verkuil@cisco.com> Signed-off-by: Mauro Carvalho Chehab <mchehab@s-opensource.com>
Hans Verkuil [Thu, 4 Aug 2016 09:01:48 +0000 (06:01 -0300)]
[media] videodev2.h: put V4L2_YCBCR_ENC_SYCC under #ifndef __KERNEL__
This define is a duplicate of V4L2_YCBCR_ENC_601. So mark it as
'should not be used' and put it under #ifndef __KERNEL__ to
prevent drivers from referring to it.
Signed-off-by: Hans Verkuil <hans.verkuil@cisco.com> Signed-off-by: Mauro Carvalho Chehab <mchehab@s-opensource.com>
Hans Verkuil [Thu, 4 Aug 2016 08:59:47 +0000 (05:59 -0300)]
[media] v4l2-tpg-core: drop SYCC, use higher precision 601 conversion matrix
The SYCC Y'CbCr encoding is identical to the 601 encoding. Since the
SYCC define is about to be removed for use in the kernel we need to
drop it in the TPG code as well.
This patch also adds a 4th decimal to the 601 conversion matrix.
That was specified by the sYCC spec and it makes sense to use this
across the board.
[mchehab@s-opensource.com: fix conflicts with LaTeX math expression patch] Signed-off-by: Hans Verkuil <hans.verkuil@cisco.com> Signed-off-by: Mauro Carvalho Chehab <mchehab@s-opensource.com>
Hans Verkuil [Thu, 4 Aug 2016 08:57:45 +0000 (05:57 -0300)]
[media] vivid: don't mention the obsolete sYCC Y'CbCr encoding
This encoding is identical to the 601 encoding. The old duplicate
SYCC define is about to be removed for use in the kernel, so remove
its use in vivid first.
Signed-off-by: Hans Verkuil <hans.verkuil@cisco.com> Signed-off-by: Mauro Carvalho Chehab <mchehab@s-opensource.com>
Hans Verkuil [Thu, 4 Aug 2016 08:51:12 +0000 (05:51 -0300)]
[media] videodev2.h: fix sYCC/AdobeYCC default quantization range
The default quantization range of the Y'CbCr encodings of sRGB
and AdobeRGB are full range instead of limited range according to
the corresponding standards.
Fix this in the V4L2_MAP_QUANTIZATION_DEFAULT macro.
Signed-off-by: Hans Verkuil <hans.verkuil@cisco.com> Signed-off-by: Mauro Carvalho Chehab <mchehab@s-opensource.com>
Hans Verkuil [Fri, 5 Aug 2016 13:38:32 +0000 (10:38 -0300)]
[media] s5p-tv: remove obsolete driver
The s5p-tv driver has been replaced by the exynos drm driver for quite a
long time now. Remove this driver to avoid having duplicate drivers,
of which this one is considered dead code by Samsung.
Signed-off-by: Hans Verkuil <hans.verkuil@cisco.com> Acked-by: Sylwester Nawrocki <s.nawrocki@samsung.com> Acked-by: Krzysztof Kozlowski <k.kozlowski@samsung.com> Signed-off-by: Mauro Carvalho Chehab <mchehab@s-opensource.com>
Nick Dyer [Sun, 14 Aug 2016 19:57:29 +0000 (16:57 -0300)]
[media] Documentation: add support for V4L touch devices
Document the new touch API.
Signed-off-by: Nick Dyer <nick@shmanahar.org> Signed-off-by: Hans Verkuil <hans.verkuil@cisco.com>
[hans.verkuil@cisco.com: fix up videodev2.h.rst.exceptions]
Nick Dyer [Mon, 18 Jul 2016 21:10:31 +0000 (18:10 -0300)]
[media] Input: atmel_mxt_ts - add support for T37 diagnostic data
Atmel maXTouch devices have a T37 object which can be used to read raw
touch deltas from the device. This consists of an array of 16-bit
integers, one for each node on the touchscreen matrix.
Signed-off-by: Nick Dyer <nick@shmanahar.org> 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>
Nick Dyer [Mon, 18 Jul 2016 21:10:30 +0000 (18:10 -0300)]
[media] v4l2-core: Add support for touch devices
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>
I'm leaving ITDev, so change to my personal email. My understanding is
that someone at Atmel will take this on once their takeover by Microchip
has settled down.
Signed-off-by: Nick Dyer <nick@shmanahar.org> 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>
Niklas Söderlund [Mon, 15 Aug 2016 15:06:35 +0000 (12:06 -0300)]
[media] rcar-vin: move media bus information to struct rvin_graph_entity
The primary reason for this change is to prepare for Gen3 support where
there will be more then one possible video source. Each source will have
its own media bus format and code, so it needs to be moved from the per
device structure to a structure used to represent an individual
connection to a video source.
Niklas Söderlund [Mon, 15 Aug 2016 15:06:34 +0000 (12:06 -0300)]
[media] rcar-vin: rework how subdevice is found and bound
The original drivers code to find a subdevice by looking in the DT grpah
and how the callbacks to the v4l2 async bind framework where poorly
written. The most obvious example of badness was the duplication of data
in the struct rvin_graph_entity.
This patch removes the data duplication, simplifies the parsing of the
DT graph and add checks to the v4l2 callbacks.
Niklas Söderlund [Mon, 15 Aug 2016 15:06:33 +0000 (12:06 -0300)]
[media] rcar-vin: move chip check for pixelformat support
The check for if the specific pixelformat is supported on the current
chip should happen in VIDIOC_S_FMT and VIDIOC_TRY_FMT and not when we
try to setup the hardware for streaming.
Niklas Söderlund [Mon, 15 Aug 2016 15:06:31 +0000 (12:06 -0300)]
[media] rcar-vin: do not use v4l2_device_call_until_err()
Fix a error from the original driver where v4l2_device_call_until_err()
where used for the pad specific v4l2 operation set_fmt. Also fix up the
error path from this fix so if there is an error it will be propagated
to the caller.
The error path label have also been renamed as a result from a
nitpicking review comment since we are fixing other issues here.
Niklas Söderlund [Mon, 15 Aug 2016 15:06:29 +0000 (12:06 -0300)]
[media] rcar-vin: rename entity to digital
When Gen3 support is added to the driver more then one possible video
source entity will be possible. Knowing that the name entity is a bad
one, rename it to digital since it will deal with the digital input
source.