summaryrefslogtreecommitdiffstats
path: root/drivers
AgeCommit message (Collapse)AuthorFilesLines
2014-07-17[media] v4l: vsp1: Setup control handler automatically at stream on timeLaurent Pinchart2-0/+46
When setting a control directly on a subdev node the VSP1 driver doesn't guarantee that the device is powered on. This leads to crashes when the control handlers writes to hardware registers. One easy way to fix this is to ensure that the device gets powered on when a subdev node is opened. However, this consumes power unnecessarily, as there's no need to power the device on when setting formats on the pipeline. Furthermore, control handler setup at entity init time suffers from the same problem as the device isn't powered on easier. Fix this by extend the entity base object to setup the control handler automatically when starting the stream. Entities must then skip writing to registers in the set control handler when not streaming, which can be tested with the new vsp1_entity_is_streaming() helper function. Signed-off-by: Laurent Pinchart <laurent.pinchart+renesas@ideasonboard.com> Signed-off-by: Mauro Carvalho Chehab <m.chehab@samsung.com>
2014-07-17[media] v4l: vsp1: Propagate vsp1_device_get errors to the callersLaurent Pinchart3-13/+9
Modify the vsp1_device_get() function to return an error code instead of a pointer to the VSP1 device, and use the return value in the callers. Signed-off-by: Laurent Pinchart <laurent.pinchart+renesas@ideasonboard.com> Signed-off-by: Mauro Carvalho Chehab <m.chehab@samsung.com>
2014-07-17[media] v4l: vsp1: Cleanup video nodes at removal timeLaurent Pinchart4-12/+18
Video nodes created and initialized in the RPF and WPF init code paths are never unregistered, and the related resources (videobuf alloc context and media entity) never released. Fix this by storing a pointer to the vsp1_video object in vsp1_entity and calling vsp1_video_cleanup() from vsp1_entity_destroy(). This also allows simplifying the init error code paths. Signed-off-by: Laurent Pinchart <laurent.pinchart+renesas@ideasonboard.com> Signed-off-by: Mauro Carvalho Chehab <m.chehab@samsung.com>
2014-07-17[media] v4l: vsp1: Fix typosLaurent Pinchart3-10/+10
Several macros were mistakenly prefixed with VPS1 instead of VSP1. Fix them. Signed-off-by: Laurent Pinchart <laurent.pinchart+renesas@ideasonboard.com> Signed-off-by: Mauro Carvalho Chehab <m.chehab@samsung.com>
2014-07-17[media] v4l: vsp1: Fix pipeline stop timeoutLaurent Pinchart1-3/+7
If the pipeline was already stopped when stopping the stream, no frame end interrupt will be generated and the driver will time out waiting for the pipeline to stop. Fix this by setting the pipeline state to STOPPED when the pipeline is idle waiting for frames to process, and to STOPPING at stream stop time only when the pipeline is currently RUNNING. Signed-off-by: Laurent Pinchart <laurent.pinchart+renesas@ideasonboard.com> Signed-off-by: Mauro Carvalho Chehab <m.chehab@samsung.com>
2014-07-17[media] v4l: vsp1: Release buffers at stream stopLaurent Pinchart1-0/+3
videobuf2 expects no buffer to be owned by the driver when the stop_stream queue operation returns. As the vsp1 driver fails to do so, a warning is generated at stream top time. Fix this by releasing all buffers queued on the IRQ queue in the stop_stream operation handler and marking them as erroneous. Signed-off-by: Laurent Pinchart <laurent.pinchart+renesas@ideasonboard.com> Signed-off-by: Mauro Carvalho Chehab <m.chehab@samsung.com>
2014-07-17[media] v4l: vsp1: Fix routing cleanup when stopping the streamLaurent Pinchart1-1/+1
Commit d9b45ed3d8b75e8cf38c8cd1563c29217eecba27 ("v4l: vsp1: Support multi-input entities") reworked pipeline routing configuration and introduced a bug by writing to the entities routing registers without first checking whether the entity had a routing register. This results in overwriting the value at offset 0 of the device register space when stopping the stream. Fix this by skipping routing register write for entities without a routing register. Signed-off-by: Laurent Pinchart <laurent.pinchart+renesas@ideasonboard.com> Signed-off-by: Mauro Carvalho Chehab <m.chehab@samsung.com>
2014-07-17[media] v4l: vb2: Fix stream start and buffer completion raceLaurent Pinchart1-1/+3
videobuf2 stores the driver streaming state internally in the queue in the start_streaming_called variable. The state is set right after the driver start_stream operation returns, and checked in the vb2_buffer_done() function, typically called from the frame completion interrupt handler. A race condition exists if the hardware finishes processing the first frame before the start_stream operation returns. Fix this by setting start_streaming_called to 1 before calling the start_stream operation, and resetting it to 0 if the operation fails. Cc: stable@vger.kernel.org # for v3.15 and up Signed-off-by: Laurent Pinchart <laurent.pinchart+renesas@ideasonboard.com> Reviewed-by: Hans Verkuil <hans.verkuil@cisco.com> Signed-off-by: Mauro Carvalho Chehab <m.chehab@samsung.com>
2014-07-17[media] v4l: Add premultiplied alpha flag for pixel formatsLaurent Pinchart1-2/+3
When set, the new V4L2_PIX_FMT_FLAG_PREMUL_ALPHA flag indicates that the pixel values are premultiplied by the alpha channel value. Signed-off-by: Laurent Pinchart <laurent.pinchart+renesas@ideasonboard.com> Signed-off-by: Mauro Carvalho Chehab <m.chehab@samsung.com>
2014-07-17[media] v4l: Support extending the v4l2_pix_format structureLaurent Pinchart25-57/+79
The v4l2_pix_format structure has no reserved field. It is embedded in the v4l2_framebuffer structure which has no reserved fields either, and in the v4l2_format structure which has reserved fields that were not previously required to be zeroed out by applications. To allow extending v4l2_pix_format, inline it in the v4l2_framebuffer structure, and use the priv field as a magic value to indicate that the application has set all v4l2_pix_format extended fields and zeroed all reserved fields following the v4l2_pix_format field in the v4l2_format structure. The availability of this API extension is reported to userspace through the new V4L2_CAP_EXT_PIX_FORMAT capability flag. Just checking that the priv field is still set to the magic value at [GS]_FMT return wouldn't be enough, as older kernels don't zero the priv field on return. To simplify the internal API towards drivers zero the extended fields and set the priv field to the magic value for applications not aware of the extensions. Signed-off-by: Laurent Pinchart <laurent.pinchart+renesas@ideasonboard.com> Signed-off-by: Mauro Carvalho Chehab <m.chehab@samsung.com>
2014-07-17[media] Fix 64-bit division fall-out from 64-bit control rangesHans Verkuil8-19/+31
Commit 0ba2aeb6dab80920edd9cf5b93b1ea4d6913b8f3 increased the internal control ranges to 64 bit, but that caused problems in drivers that use the minimum/maximum/step/default_value control values in a division or modulus operations since not all architectures support those natively. Luckily, in almost all cases it is possible to just cast to 32 bits (the control value is known to be 32 bits, so it is safe to cast). Only in v4l2-ctrls.c was it necessary to use do_div in one function. Signed-off-by: Hans Verkuil <hans.verkuil@cisco.com> Signed-off-by: Mauro Carvalho Chehab <m.chehab@samsung.com>
2014-07-17[media] go7007: add motion detection supportHans Verkuil6-184/+345
This patch adds motion detection support to the go7007 driver using the new motion detection controls, events. The global motion detection works fine, but the regional motion detection support probably needs more work. There seems to be some interaction between regions that makes setting correct thresholds difficult. The exact meaning of the thresholds isn't entirely clear either. I do not have any documentation, the only information I have is the custom code in the driver and a modet.c application. Signed-off-by: Hans Verkuil <hans.verkuil@cisco.com> Signed-off-by: Mauro Carvalho Chehab <m.chehab@samsung.com>
2014-07-17[media] solo6x10: check dma_map_sg() return valueHans Verkuil1-4/+6
The dma_map_sg() function can fail, so check for the return value. Signed-off-by: Hans Verkuil <hans.verkuil@cisco.com> Signed-off-by: Mauro Carvalho Chehab <m.chehab@samsung.com>
2014-07-17[media] solo6x10: fix 'dma from stack' warningHans Verkuil1-4/+6
Signed-off-by: Hans Verkuil <hans.verkuil@cisco.com> Signed-off-by: Mauro Carvalho Chehab <m.chehab@samsung.com>
2014-07-17[media] solo6x10: implement the motion detection eventHans Verkuil2-15/+60
Use the new motion detection event. Signed-off-by: Hans Verkuil <hans.verkuil@cisco.com> Signed-off-by: Mauro Carvalho Chehab <m.chehab@samsung.com>
2014-07-17[media] solo6x10: implement the new motion detection controlsHans Verkuil3-87/+39
Replace the custom ioctls to set motion detection thresholds by standard matrix controls. Signed-off-by: Hans Verkuil <hans.verkuil@cisco.com> Signed-off-by: Mauro Carvalho Chehab <m.chehab@samsung.com>
2014-07-17[media] v4l2-ctrls/v4l2-controls.h: add MD controlsHans Verkuil1-0/+27
Add the 'Detect' control class and the new motion detection controls. Those controls will be used by the solo6x10 and go7007 drivers. Signed-off-by: Hans Verkuil <hans.verkuil@cisco.com> Signed-off-by: Mauro Carvalho Chehab <m.chehab@samsung.com>
2014-07-17[media] v4l2-ctrls: fix commentsHans Verkuil1-5/+9
Various comments referred to videodev2.h, but the control definitions have been moved to v4l2-controls.h. Also add the same reminder message to each class of controls. Signed-off-by: Hans Verkuil <hans.verkuil@cisco.com> Signed-off-by: Mauro Carvalho Chehab <m.chehab@samsung.com>
2014-07-17[media] v4l2-ctrls/videodev2.h: add u8 and u16 typesHans Verkuil1-4/+41
These are needed by the upcoming patches for the motion detection matrices. Signed-off-by: Hans Verkuil <hans.verkuil@cisco.com> Signed-off-by: Mauro Carvalho Chehab <m.chehab@samsung.com>
2014-07-17[media] v4l2-ctrl: fix error return of copy_to/from_userHans Verkuil1-5/+6
copy_to/from_user returns the number of bytes not copied, it does not return a 'normal' linux error code. Signed-off-by: Hans Verkuil <hans.verkuil@cisco.com> Signed-off-by: Mauro Carvalho Chehab <m.chehab@samsung.com>
2014-07-17[media] v4l2-ctrls: return elem_size instead of strlenHans Verkuil1-1/+1
When getting a string and the size given by the application is too short return the max length the string can have (elem_size) instead of the string length + 1. That makes more sense. Signed-off-by: Hans Verkuil <hans.verkuil@cisco.com> Reviewed-by: Sylwester Nawrocki <s.nawrocki@samsung.com> Signed-off-by: Mauro Carvalho Chehab <m.chehab@samsung.com>
2014-07-17[media] v4l2-ctrls: add array supportHans Verkuil1-46/+63
Finish the userspace-facing array support. Signed-off-by: Hans Verkuil <hans.verkuil@cisco.com> Signed-off-by: Mauro Carvalho Chehab <m.chehab@samsung.com>
2014-07-17[media] v4l2-ctrls: type_ops can handle array elementsHans Verkuil1-18/+22
Extend the control type operations to handle N-dimensional array elements. Signed-off-by: Hans Verkuil <hans.verkuil@cisco.com> Signed-off-by: Mauro Carvalho Chehab <m.chehab@samsung.com>
2014-07-17[media] v4l2-ctrls: prepare for array supportHans Verkuil1-19/+39
Add core support for N-dimensional arrays. Signed-off-by: Hans Verkuil <hans.verkuil@cisco.com> Signed-off-by: Mauro Carvalho Chehab <m.chehab@samsung.com>
2014-07-17[media] v4l2-ctrls: prepare for array supportHans Verkuil1-9/+24
Add dims, nr_of_dims and elems fields to the core control structures in preparation for N-dimensional array support. Signed-off-by: Hans Verkuil <hans.verkuil@cisco.com> Signed-off-by: Mauro Carvalho Chehab <m.chehab@samsung.com>
2014-07-17[media] v4l2-ctrls: use ptrs for all but the s32 typeHans Verkuil7-17/+19
Rather than having two unions for all types just keep 'val' and 'cur.val' and use the p_cur and p_new unions to access all others. The only reason for keeping 'val' and 'cur.val' is that it is used all over, so converting this as well would be a huge job. Signed-off-by: Hans Verkuil <hans.verkuil@cisco.com> Signed-off-by: Mauro Carvalho Chehab <m.chehab@samsung.com>
2014-07-17[media] v4l2-ctrls: compare values only onceHans Verkuil1-6/+11
When setting a control the control's new value is compared to the current value twice: once by new_to_cur(), once by cluster_changed(). Not a big deal when dealing with simple values, but it can be a problem when dealing with compound types or arrays. So fix this: cluster_changed() sets the has_changed flag, which is used by new_to_cur() instead of having to do another compare. Signed-off-by: Hans Verkuil <hans.verkuil@cisco.com> Reviewed-by: Sylwester Nawrocki <s.nawrocki@samsung.com> Signed-off-by: Mauro Carvalho Chehab <m.chehab@samsung.com>
2014-07-17[media] v4l2-ctrls: rewrite copy routines to operate on union v4l2_ctrl_ptrHans Verkuil1-73/+56
In order to implement array support and (for the future) configuration stores we need to have more generic copy routines that all operate on the v4l2_ctrl_ptr union. So instead of e.g. using ctrl->cur.string it uses ptr.p_char. This makes e.g. cur_to_user generic so it can be used to copy any v4l2_ctrl_ptr value to userspace, not just the (hardcoded) current value. Signed-off-by: Hans Verkuil <hans.verkuil@cisco.com> Signed-off-by: Mauro Carvalho Chehab <m.chehab@samsung.com>
2014-07-17[media] v4l2-ctrls: create type_opsHans Verkuil2-103/+175
Since compound controls can have non-standard types we need to be able to do type-specific checks etc. In order to make that easy type operations are added. There are four operations: - equal: check if two values are equal - init: initialize a value - log: log the value - validate: validate a new value The v4l2_ctrl struct adds p_new and p_cur unions at the end of the struct. This union provides a standard way of accessing control types through a pointer, which greatly simplifies internal control processing. Signed-off-by: Hans Verkuil <hans.verkuil@cisco.com> Signed-off-by: Mauro Carvalho Chehab <m.chehab@samsung.com>
2014-07-17[media] v4l2: integrate support for VIDIOC_QUERY_EXT_CTRLHans Verkuil3-0/+38
Add the v4l2 core plumbing for the new VIDIOC_QUERY_EXT_CTRL ioctl. Signed-off-by: Hans Verkuil <hans.verkuil@cisco.com> Reviewed-by: Sylwester Nawrocki <s.nawrocki@samsung.com> Signed-off-by: Mauro Carvalho Chehab <m.chehab@samsung.com>
2014-07-17[media] v4l2-ctrls: add support for compound typesHans Verkuil1-56/+168
This patch implements initial support for compound types. The changes are fairly obvious: basic support for is_ptr types, the type_is_int function is replaced by a is_int bitfield, and v4l2_query_ext_ctrl is added. Note that this patch does not yet add support for N-dimensional arrays, that comes later. So v4l2_query_ext_ctrl just sets elems to 1 and nr_of_dims and dims[] are all zero. Signed-off-by: Hans Verkuil <hans.verkuil@cisco.com> Signed-off-by: Mauro Carvalho Chehab <m.chehab@samsung.com>
2014-07-17[media] v4l2-ctrls: use pr_info/cont instead of printkHans Verkuil1-13/+13
Codingstyle fix. Signed-off-by: Hans Verkuil <hans.verkuil@cisco.com> Reviewed-by: Sylwester Nawrocki <s.nawrocki@samsung.com> Signed-off-by: Mauro Carvalho Chehab <m.chehab@samsung.com>
2014-07-17Merge tag 'v3.16-rc5' into HEADMauro Carvalho Chehab410-2464/+5552
Docbook creation was broken. We need to move after v3.16-rc1-3-ga981296f048b in order to get commit a981296f048b99b0d5bb4d87c732a6cfb35a1c66. Linux 3.16-rc5 * tag 'v3.16-rc5': (985 commits) Linux 3.16-rc5 clk: spear3xx: Set proper clock parent of uart1/2 clk: spear3xx: Use proper control register offset parisc: drop unused defines and header includes parisc: fix fanotify_mark() syscall on 32bit compat kernel parisc: add serial ports of C8000/1GHz machine to hardware database ext4: fix potential null pointer dereference in ext4_free_inode ext4: fix a potential deadlock in __ext4_es_shrink() Documenation/laptops: rename and update hpfall.c DocBook: fix various typos DocBook: fix mtdnand typos scripts/kernel-doc: handle object-like macros Documentation/Changes: clean up mcelog paragraph ARM: at91: at91sam9x5: add clocks for usb device phy: omap-usb2: Balance pm_runtime_enable() on probe failure and remove phy: core: Fix error path in phy_create() drivers: phy: phy-samsung-usb2.c: Add missing MODULE_DEVICE_TABLE phy: omap-usb2: fix devm_ioremap_resource error detection code phy: sun4i: depend on RESET_CONTROLLER USB: serial: ftdi_sio: Add Infineon Triboard ...
2014-07-17[media] v4l2-ctrls: increase internal min/max/step/def to 64 bitHans Verkuil7-45/+73
While VIDIOC_QUERYCTRL is limited to 32 bit min/max/step/def values for controls, the upcoming VIDIOC_QUERY_EXT_CTRL isn't. So increase the internal representation to 64 bits in preparation. Because of these changes the msi3101 driver has been modified slightly to fix a formatting issue (%d becomes %lld), vivi had to be modified as well to cope with the new 64-bit min/max values and the PIXEL_RATE control in a few sensor drivers required proper min/max/def values. Signed-off-by: Hans Verkuil <hans.verkuil@cisco.com> Reviewed-by: Sylwester Nawrocki <s.nawrocki@samsung.com> Signed-off-by: Mauro Carvalho Chehab <m.chehab@samsung.com>
2014-07-14[media] si2157: rework firmware download logic a little bitAntti Palosaari1-50/+58
Rework firmware selection / chip detection logic a little bit. Add missing release_firmware() to error path. Signed-off-by: Antti Palosaari <crope@iki.fi> Tested-by: Olli Salonen <olli.salonen@iki.fi> Signed-off-by: Mauro Carvalho Chehab <m.chehab@samsung.com>
2014-07-14[media] si2168: few firmware download changesAntti Palosaari1-14/+27
Rework firmware selection logic a little bit. Print notice asking user update firmware when old Si2168 B40 firmware is used. Signed-off-by: Antti Palosaari <crope@iki.fi> Tested-by: Olli Salonen <olli.salonen@iki.fi> Signed-off-by: Mauro Carvalho Chehab <m.chehab@samsung.com>
2014-07-14[media] si2157: advertise Si2158 A20 firmwareAntti Palosaari1-0/+1
Driver uses that firmware. Add it module firmware list. Signed-off-by: Antti Palosaari <crope@iki.fi> Tested-by: Olli Salonen <olli.salonen@iki.fi> Signed-off-by: Mauro Carvalho Chehab <m.chehab@samsung.com>
2014-07-14[media] si2168: advertise Si2168 A30 firmwareAntti Palosaari1-0/+1
Driver uses that new firmware too, so advertise it. Signed-off-by: Antti Palosaari <crope@iki.fi> Tested-by: Olli Salonen <olli.salonen@iki.fi> Signed-off-by: Mauro Carvalho Chehab <m.chehab@samsung.com>
2014-07-14[media] cxusb: TechnoTrend CT2-4400 USB DVB-T2/C tuner supportOlli Salonen4-1/+196
USB ID 0b48:3014. USB interface: Cypress CY7C68013A-56LTXC Demodulator: Silicon Labs Si2168-30 Tuner: Silicon Labs Si2158-20 Cc: Michael Krufky <mkrufky@linuxtv.org> Signed-off-by: Olli Salonen <olli.salonen@iki.fi> Reviewed-by: Antti Palosaari <crope@iki.fi> Signed-off-by: Antti Palosaari <crope@iki.fi> Reviewed-by: Michael Ira Krufky <mkrufky@linuxtv.org> Signed-off-by: Mauro Carvalho Chehab <m.chehab@samsung.com>
2014-07-14[media] si2157: Set delivery system and bandwidth before tuningOlli Salonen1-0/+31
Tell used TV standard and bandwidth for tuner firmware. Signed-off-by: Olli Salonen <olli.salonen@iki.fi> Reviewed-by: Antti Palosaari <crope@iki.fi> Signed-off-by: Antti Palosaari <crope@iki.fi> Signed-off-by: Mauro Carvalho Chehab <m.chehab@samsung.com>
2014-07-14[media] si2157: Add support for Si2158 chipOlli Salonen3-7/+73
Add support for Si2158 A20 chip. Signed-off-by: Olli Salonen <olli.salonen@iki.fi> Reviewed-by: Antti Palosaari <crope@iki.fi> Signed-off-by: Antti Palosaari <crope@iki.fi> Signed-off-by: Mauro Carvalho Chehab <m.chehab@samsung.com>
2014-07-14[media] si2157: Move chip initialization to si2157_initOlli Salonen1-41/+30
Move chip initialization related code from si2157_set_params to si2157_init. Signed-off-by: Olli Salonen <olli.salonen@iki.fi> Reviewed-by: Antti Palosaari <crope@iki.fi> Signed-off-by: Antti Palosaari <crope@iki.fi> Signed-off-by: Mauro Carvalho Chehab <m.chehab@samsung.com>
2014-07-14[media] si2168: Add support for chip revision Si2168 A30Olli Salonen2-6/+32
Add handling for different chip revisions and firmwares. Signed-off-by: Olli Salonen <olli.salonen@iki.fi> Reviewed-by: Antti Palosaari <crope@iki.fi> Signed-off-by: Antti Palosaari <crope@iki.fi> Signed-off-by: Mauro Carvalho Chehab <m.chehab@samsung.com>
2014-07-14[media] si2168: Small typo fix (SI2157 -> SI2168)Olli Salonen1-2/+2
Signed-off-by: Olli Salonen <olli.salonen@iki.fi> Reviewed-by: Antti Palosaari <crope@iki.fi> Signed-off-by: Antti Palosaari <crope@iki.fi> Signed-off-by: Mauro Carvalho Chehab <m.chehab@samsung.com>
2014-07-14[media] si2168: receive 4 bytes reply from cmd 0x14Antti Palosaari1-9/+9
Command 0x14 returns 4 bytes as a reply. It is used for setting key/value pairs to firmware and it returns 4 bytes back including old value. Signed-off-by: Antti Palosaari <crope@iki.fi> Signed-off-by: Mauro Carvalho Chehab <m.chehab@samsung.com>
2014-07-14[media] si2168: do not set values which are already on defaultAntti Palosaari1-98/+0
No need to set explicitly value that are already defaulted same. Setting new value returns old value. Firmware default values can be found just looking returned value. Signed-off-by: Antti Palosaari <crope@iki.fi> Signed-off-by: Mauro Carvalho Chehab <m.chehab@samsung.com>
2014-07-14[media] si2168: remove duplicate commandAntti Palosaari1-8/+1
Same command was executed twice, but different value. Remove redundant command. Signed-off-by: Antti Palosaari <crope@iki.fi> Signed-off-by: Mauro Carvalho Chehab <m.chehab@samsung.com>
2014-07-14[media] si2157: add read data support for fw cmd funcAntti Palosaari2-34/+43
We want also read data from firmware. Add support for it. Copied from si2168 driver. Signed-off-by: Antti Palosaari <crope@iki.fi> Signed-off-by: Mauro Carvalho Chehab <m.chehab@samsung.com>
2014-07-14[media] si2168: implement CNR statisticAntti Palosaari1-0/+9
Implement CNR statistic. Signed-off-by: Antti Palosaari <crope@iki.fi> Signed-off-by: Mauro Carvalho Chehab <m.chehab@samsung.com>
2014-07-14[media] si2168: set cmd args using memcpyAntti Palosaari1-31/+8
Use memcpy for set cmd buffer in order to keep style in line with rest of file. Signed-off-by: Antti Palosaari <crope@iki.fi> Signed-off-by: Mauro Carvalho Chehab <m.chehab@samsung.com>