aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/input/touchscreen/sur40.c (follow)
AgeCommit message (Collapse)AuthorFilesLines
2019-07-23media: input/touchscreen/sur40: use COLORSPACE_RAWHans Verkuil1-2/+2
This driver set the colorspace to SRGB, but that makes no sense for a touchscreen. Use RAW instead. This also ensures consistency with the v4l_pix_format_touch() call that's used in v4l2-ioctl.c. Signed-off-by: Hans Verkuil <hverkuil-cisco@xs4all.nl> Acked-by: Florian Echtler <floe@butterbrot.org> Acked-by: Dmitry Torokhov <dmitry.torokhov@gmail.com> Signed-off-by: Mauro Carvalho Chehab <mchehab+samsung@kernel.org>
2019-06-12media: touchscreen/sur40: set device_caps in struct video_deviceHans Verkuil1-4/+2
Instead of filling in the struct v4l2_capability device_caps field, fill in the struct video_device device_caps field. That way the V4L2 core knows what the capabilities of the video device are. But this only really works if all drivers use this, so convert this touchscreen driver accordingly. Signed-off-by: Hans Verkuil <hverkuil-cisco@xs4all.nl> Acked-by: Florian Echtler <floe@butterbrot.org> Acked-by: Dmitry Torokhov <dmitry.torokhov@gmail.com> Signed-off-by: Mauro Carvalho Chehab <mchehab+samsung@kernel.org>
2019-05-30treewide: Replace GPLv2 boilerplate/reference with SPDX - rule 152Thomas Gleixner1-5/+1
Based on 1 normalized pattern(s): this program is free software you can redistribute it and or modify it under the terms of the gnu general public license as published by the free software foundation either version 2 of the license or at your option any later version extracted by the scancode license scanner the SPDX license identifier GPL-2.0-or-later has been chosen to replace the boilerplate/reference in 3029 file(s). Signed-off-by: Thomas Gleixner <tglx@linutronix.de> Reviewed-by: Allison Randal <allison@lohutok.net> Cc: linux-spdx@vger.kernel.org Link: https://lkml.kernel.org/r/20190527070032.746973796@linutronix.de Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2018-02-14media: add video control handlers using V4L2 control frameworkFlorian Echtler1-0/+64
This patch registers four standard control handlers using the corresponding V4L2 framework. Signed-off-by: Florian Echtler <floe@butterbrot.org> [hans.verkuil@cisco.com: lower-cased 0x0F and 0xF0] Signed-off-by: Hans Verkuil <hans.verkuil@cisco.com> Signed-off-by: Mauro Carvalho Chehab <mchehab@s-opensource.com>
2018-02-14media: add panel register access functionsFlorian Echtler1-0/+75
These functions provide write access to the internal LCD panel registers which also control the sensor. They can be used to disable the preprocessor, set the illumination brightness, and adjust gain/contrast (which are stored together in one register internally called "vsvideo"). Signed-off-by: Florian Echtler <floe@butterbrot.org> Signed-off-by: Hans Verkuil <hans.verkuil@cisco.com> Signed-off-by: Mauro Carvalho Chehab <mchehab@s-opensource.com>
2018-02-14media: add default settings and module parameters for video controlsFlorian Echtler1-0/+34
This patch adds parameter definitions and module parameters for the four userspace controls that the SUR40 can currently provide. Signed-off-by: Florian Echtler <floe@butterbrot.org> Signed-off-by: Hans Verkuil <hans.verkuil@cisco.com> Signed-off-by: Mauro Carvalho Chehab <mchehab@s-opensource.com>
2018-02-14media: add missing blob structure field for tag idFlorian Echtler1-1/+4
The SUR40 can recognize specific printed patterns directly in hardware; this information (i.e. the pattern id) is present but currently unused in the blob structure. Signed-off-by: Florian Echtler <floe@butterbrot.org> Signed-off-by: Hans Verkuil <hans.verkuil@cisco.com> Signed-off-by: Mauro Carvalho Chehab <mchehab@s-opensource.com>
2017-07-12Input: sur40 - skip all blobs that are not touchesFlorian Echtler1-9/+13
The SUR40 labels all reported blobs as touch, token, or generic blob. Previously, all blobs were reported as touch regardless of type, causing lots of false positives. Present patch fixes this. Signed-off-by: Martin Kaltenbrunner <modin@yuri.at> Signed-off-by: Florian Echtler <floe@butterbrot.org> Signed-off-by: Dmitry Torokhov <dmitry.torokhov@gmail.com>
2017-07-12Input: sur40 - silence unnecessary noisy debug outputFlorian Echtler1-2/+5
This information is unneccessary, even as debug output. Leave commented out as documentation of the packet ID quirk. Signed-off-by: Martin Kaltenbrunner <modin@yuri.at> Signed-off-by: Florian Echtler <floe@butterbrot.org> Signed-off-by: Dmitry Torokhov <dmitry.torokhov@gmail.com>
2017-07-12Input: sur40 - add additional reverse-engineered informationFlorian Echtler1-5/+12
Due to recent reverse engineering efforts, a lot more information is now available about the internals of the SUR40. We document this in the kernel driver for future use. Signed-off-by: Martin Kaltenbrunner <modin@yuri.at> Signed-off-by: Florian Echtler <floe@butterbrot.org> Signed-off-by: Dmitry Torokhov <dmitry.torokhov@gmail.com>
2017-04-05Input: sur40 - fix bad endianness handling in sur40_pollMartin Kepplinger1-1/+1
sparse says: sur40.c:372:40: warning: restricted __le32 degrades to integer the header's data is __le32 so we need to convert it before comparing. Signed-off-by: Martin Kepplinger <martink@posteo.de> Signed-off-by: Dmitry Torokhov <dmitry.torokhov@gmail.com>
2017-03-16Input: sur40 - validate number of endpoints before using themJohan Hovold1-0/+3
Make sure to check the number of endpoints to avoid dereferencing a NULL-pointer or accessing memory that lie beyond the end of the endpoint array should a malicious device lack the expected endpoints. Fixes: bdb5c57f209c ("Input: add sur40 driver for Samsung SUR40... ") Signed-off-by: Johan Hovold <johan@kernel.org> Cc: stable@vger.kernel.org # 3.13 Signed-off-by: Dmitry Torokhov <dmitry.torokhov@gmail.com>
2016-08-24[media] sur40: properly report a single frame rate of 60 FPSFlorian Echtler1-2/+18
The device hardware is always running at 60 FPS, so report this both via PARM_IOCTL and ENUM_FRAMEINTERVALS. [hans.verkuil@cisco.com: fix suspect indent checkpatch warning] [mchehab@s-opensource.com: fix a trivial merge conflict] Signed-off-by: Martin Kaltenbrunner <modin@yuri.at> Signed-off-by: Florian Echtler <floe@butterbrot.org> Signed-off-by: Hans Verkuil <hans.verkuil@cisco.com> Signed-off-by: Mauro Carvalho Chehab <mchehab@s-opensource.com>
2016-08-23[media] Input: sur40 - use new V4L2 touch input typeNick Dyer1-33/+91
Support both V4L2_TCH_FMT_TU08 and V4L2_PIX_FMT_GREY for backwards compatibility. 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>
2016-07-08[media] sur40: drop unnecessary format descriptionHans Verkuil1-1/+0
Don't fill in the format description. This is now done in the V4L2 core to ensure consistent descriptions. Signed-off-by: Hans Verkuil <hans.verkuil@cisco.com> Acked-by: Nick Dyer <nick.dyer@itdev.co.uk> Signed-off-by: Mauro Carvalho Chehab <mchehab@s-opensource.com>
2016-07-08[media] sur40: fix occasional oopses on device closeFlorian Echtler1-1/+2
Closing the V4L2 device sometimes triggers a kernel oops. Present patch fixes this. Signed-off-by: Martin Kaltenbrunner <modin@yuri.at> Signed-off-by: Florian Echtler <floe@butterbrot.org> Signed-off-by: Hans Verkuil <hans.verkuil@cisco.com> Cc: <stable@vger.kernel.org> # for v4.2 and up Signed-off-by: Mauro Carvalho Chehab <mchehab@s-opensource.com>
2016-07-08[media] sur40: lower poll interval to fix occasional FPS drops to ~56 FPSFlorian Echtler1-1/+1
The framerate sometimes drops below 60 Hz if the poll interval is too high. Lowering it to the minimum of 1 ms fixes this. Signed-off-by: Martin Kaltenbrunner <modin@yuri.at> Signed-off-by: Florian Echtler <floe@butterbrot.org> Signed-off-by: Hans Verkuil <hans.verkuil@cisco.com> Cc: <stable@vger.kernel.org> # for v4.2 and up Signed-off-by: Mauro Carvalho Chehab <mchehab@s-opensource.com>
2016-07-08[media] vb2: replace void *alloc_ctxs by struct device *alloc_devsHans Verkuil1-1/+1
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] sur40: set q->dev instead of allocating a contextHans Verkuil1-12/+1
Stop using alloc_ctx and just fill in the device pointer. Signed-off-by: Hans Verkuil <hans.verkuil@cisco.com> Cc: Florian Echtler <floe@butterbrot.org> Signed-off-by: Mauro Carvalho Chehab <mchehab@s-opensource.com>
2016-03-23Input: sur40 - fix DMA on stackOliver Neukum1-7/+14
During the initialisation the driver uses a buffer on the stack for DMA. That violates the cache coherency rules. The fix is to allocate the buffer with kmalloc(). Signed-off-by: Oliver Neukum <ONeukum@suse.com> Signed-off-by: Dmitry Torokhov <dmitry.torokhov@gmail.com>
2015-12-18[media] media: videobuf2: Move timestamp to vb2_bufferJunghak Sung1-1/+1
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] vb2: drop v4l2_format argument from queue_setupHans Verkuil1-6/+5
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-10-20[media] media: videobuf2: Change queue_setup argumentJunghak Sung1-1/+2
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 Sung1-8/+9
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-08-24Input: sur40 - fix error return codeJulia Lawall1-0/+1
Propagate error code on failure, or upper layers will be confused by returned 0 (success) code. Signed-off-by: Julia Lawall <Julia.Lawall@lip6.fr> Signed-off-by: Dmitry Torokhov <dmitry.torokhov@gmail.com>
2015-05-30[media] return BUF_STATE_ERROR if streaming stopped during acquisitionFlorian Echtler1-0/+5
When stop_streaming is called while a frame is currently being retrieved, the buffer being filled will still be returned with BUF_STATE_DONE. By resetting the sequence number and checking before returning the buffer, it can now correctly be returned with BUF_STATE_ERROR. Signed-off-by: Martin Kaltenbrunner <modin@yuri.at> Signed-off-by: Florian Echtler <floe@butterbrot.org> Signed-off-by: Hans Verkuil <hans.verkuil@cisco.com> Signed-off-by: Mauro Carvalho Chehab <mchehab@osg.samsung.com>
2015-05-30[media] add extra debug output, remove noisy warningFlorian Echtler1-1/+8
Add dev_dbg statements for easier future debugging; also change the warning about packet ID mismatches to debug output to avoid flooding the logs. This warning is only important in a very specific/rare use case when trying to correlate input events with video data. Signed-off-by: Martin Kaltenbrunner <modin@yuri.at> Signed-off-by: Florian Echtler <floe@butterbrot.org> Signed-off-by: Hans Verkuil <hans.verkuil@cisco.com> Signed-off-by: Mauro Carvalho Chehab <mchehab@osg.samsung.com>
2015-05-30[media] add frame size/frame rate query functionsFlorian Echtler1-0/+30
Add missing functions to query the single fixed frame size (960x540) and supported frame rates. Technically, the SUR40 supports any arbitrary frame rate up to 60 FPS, as it is polled and not interrupt-driven. For now, we just report 30 and 60 FPS, which is sufficient to make most V4L2 tools work. Signed-off-by: Martin Kaltenbrunner <modin@yuri.at> Signed-off-by: Florian Echtler <floe@butterbrot.org> Signed-off-by: Hans Verkuil <hans.verkuil@cisco.com> Signed-off-by: Mauro Carvalho Chehab <mchehab@osg.samsung.com>
2015-05-30[media] reduce poll interval to allow full 60 FPS framerateFlorian Echtler1-1/+1
The SUR40 hardware can deliver images at up to 60 FPS; at full USB2 bandwidth, one raw frame will take about 11 ms to transmit. If the poll interval is above 5 ms, fully handling one frame will take longer than 16 ms and the overall frame rate will drop below 60 FPS. To get the full frame rate without blocking all the time and still allowing for a bit of timing jitter, we reduce the poll interval to 4 ms. Signed-off-by: Martin Kaltenbrunner <modin@yuri.at> Signed-off-by: Florian Echtler <floe@butterbrot.org> Signed-off-by: Hans Verkuil <hans.verkuil@cisco.com> Signed-off-by: Mauro Carvalho Chehab <mchehab@osg.samsung.com>
2015-04-08[media] sur40: fix occasional hard freeze due to buffer queue underrunFlorian Echtler1-0/+5
This patch fixes a kernel panic which occurs when buf_list is empty. This can happen occasionally when user space is under heavy load (e.g. due to image processing on the CPU) and new buffers aren't re-queued fast enough. In that case, vb2_start_streaming_called can return true, but when the spinlock is taken and sur40_poll attempts to fetch the next buffer from buf_list, the list is in fact empty. This patch needs to be applied on top of the queued one adding V4L2 support to the sur40 driver. Signed-off-by: Florian Echtler <floe@butterbrot.org> Signed-off-by: Hans Verkuil <hans.verkuil@cisco.com> Signed-off-by: Mauro Carvalho Chehab <mchehab@osg.samsung.com>
2015-04-02[media] add raw video stream support for Samsung SUR40Florian Echtler1-12/+417
This patch adds raw video support for the Samsung SUR40 using vbuf2-dma-sg. All tests from v4l2-compliance pass. Support for VB2_USERPTR is currently disabled due to unexpected interference with dma-sg buffer sizes. Signed-off-by: Florian Echtler <floe@butterbrot.org> Signed-off-by: Hans Verkuil <hans.verkuil@cisco.com> [hans.verkuil@cisco.com: fix compile warning: %ld -> %zd] Signed-off-by: Mauro Carvalho Chehab <mchehab@osg.samsung.com>
2013-12-01Input: sur40 - suppress false uninitialized variable warningDmitry Torokhov1-2/+2
We will never use packet_id before initializing it as we start with "need_blobs == -1" and will set packet_id there. Also use le32_to_cpu when fetching header->packet_id. Signed-off-by: Dmitry Torokhov <dmitry.torokhov@gmail.com>
2013-11-20Input: add sur40 driver for Samsung SUR40 (aka MS Surface 2.0/Pixelsense)Florian Echtler1-0/+466
This patch adds support for the built-in multitouch sensor in the Samsung SUR40 touchscreen device, also known as Microsoft Surface 2.0 or Microsoft Pixelsense. Support for raw video output from the sensor as well as the accelerometer will be added in a later patch. Signed-off-by: Florian Echtler <floe@butterbrot.org> Reviewed-by: David Herrmann <dh.herrmann@gmail.com> Reviewed-by: Henrik Rydberg <rydberg@euromail.se> Signed-off-by: Dmitry Torokhov <dmitry.torokhov@gmail.com>