Markus Elfring [Mon, 1 Dec 2014 22:15:20 +0000 (19:15 -0300)]
[media] mn88473: One function call less in mn88473_init() after error
The release_firmware() function was called by the mn88473_init() function even
if a previous function call "request_firmware" failed.
This implementation detail could be improved by the introduction of another
jump label.
Signed-off-by: Markus Elfring <elfring@users.sourceforge.net> Signed-off-by: Mauro Carvalho Chehab <mchehab@osg.samsung.com>
James Hogan [Mon, 17 Nov 2014 12:17:47 +0000 (09:17 -0300)]
[media] img-ir: Depend on METAG or MIPS or COMPILE_TEST
The ImgTec Infrared decoder block which img-ir drives is only used in
IMGWorks SoCs so far, such as the TZ1090 (Meta based) and the upcoming
Pistachio (MIPS based). Therefore make the driver depend on METAG (for
TZ1090) or MIPS (for Pistachio) or COMPILE_TEST (so that it is included
in x86 allmodconfig builds), to avoid cluttering the Kconfig menu with
drivers for hardware that isn't yet available on other platforms.
Signed-off-by: James Hogan <james.hogan@imgtec.com> Signed-off-by: Mauro Carvalho Chehab <mchehab@osg.samsung.com>
James Hogan [Mon, 17 Nov 2014 12:17:46 +0000 (09:17 -0300)]
[media] img-ir/hw: Drop [un]register_decoder declarations
The img_ir_register_decoder() and img_ir_unregister_decoder() functions
were dropped prior to the img-ir driver being applied to simplify the
protocol decoder setup. However the declarations of these functions in
img-ir-hw.h were still included. Delete them since they're completely
unused.
Signed-off-by: James Hogan <james.hogan@imgtec.com> Signed-off-by: Mauro Carvalho Chehab <mchehab@osg.samsung.com>
The end timer is used for switching back from repeat code timings when
no repeat codes have been received for a certain amount of time. When
the protocol is changed, the end timer is deleted synchronously with
del_timer_sync(), however this takes place while holding the main spin
lock, and the timer handler also needs to acquire the spin lock.
This opens the possibility of a deadlock on an SMP system if the
protocol is changed just as the repeat timer is expiring. One CPU could
end up in img_ir_set_decoder() holding the lock and waiting for the end
timer to complete, while the other CPU is stuck in the timer handler
spinning on the lock held by the first CPU.
Lockdep also spots a possible lock inversion in the same code, since
img_ir_set_decoder() acquires the img-ir lock before the timer lock, but
the timer handler will try and acquire them the other way around:
=========================================================
[ INFO: possible irq lock inversion dependency detected ]
3.18.0-rc5+ #957 Not tainted
---------------------------------------------------------
swapper/0/0 just changed the state of lock:
(((&hw->end_timer))){+.-...}, at: [<4006ae5c>] _call_timer_fn+0x0/0xfc
but this lock was taken by another, HARDIRQ-safe lock in the past:
(&(&priv->lock)->rlock#2){-.....}
and interrupts could create inverse lock ordering between them.
other info that might help us debug this:
Possible interrupt unsafe locking scenario:
This is fixed by releasing the main spin lock while performing the
del_timer_sync() call. The timer is prevented from restarting before the
lock is reacquired by a new "stopping" flag which img_ir_handle_data()
checks before updating the timer.
---------------------------------------------------------
swapper/0/0 just changed the state of lock:
(((&hw->end_timer))){+.-...}, at: [<4006ae5c>] _call_timer_fn+0x0/0xfc
but this lock was taken by another, HARDIRQ-safe lock in the past:
(&(&priv->lock)->rlock#2){-.....}
and interrupts could create inverse lock ordering between them.
other info that might help us debug this:
Possible interrupt unsafe locking scenario:
CPU0 CPU1
---- ----
lock(((&hw->end_timer)));
local_irq_disable();
lock(&(&priv->lock)->rlock#2);
lock(((&hw->end_timer)));
<Interrupt>
lock(&(&priv->lock)->rlock#2);
*** DEADLOCK ***
This is fixed by releasing the main spin lock while performing the
del_timer_sync() call. The timer is prevented from restarting before the
lock is reacquired by a new "stopping" flag which img_ir_handle_data()
checks before updating the timer.
Dylan Rajaratnam [Mon, 17 Nov 2014 12:17:45 +0000 (09:17 -0300)]
[media] img-ir/hw: Always read data to clear buffer
A problem was found on Polaris where if the unit it booted via the power
button on the infrared remote then the next button press on the remote
would return the key code used to power on the unit.
The sequence is:
- The polaris powered off but with the powerdown controller (PDC) block
still powered.
- Press power key on remote, IR block receives the key.
- Kernel starts, IR code is in IMG_IR_DATA_x but neither IMG_IR_RXDVAL
or IMG_IR_RXDVALD2 are set.
- Wait any amount of time.
- Press any key.
- IMG_IR_RXDVAL or IMG_IR_RXDVALD2 is set but IMG_IR_DATA_x is
unchanged since the powerup key data was never read.
This is worked around by always reading the IMG_IR_DATA_x in
img_ir_set_decoder(), rather than only when the IMG_IR_RXDVAL or
IMG_IR_RXDVALD2 bit is set.
Sean Young [Mon, 1 Dec 2014 08:48:16 +0000 (05:48 -0300)]
[media] redrat3: ensure dma is setup properly
This fixes the driver on arm.
Reported-by: Steven Guitton <keltiek@gmail.com> Tested-by: Steven Guitton <keltiek@gmail.com> Signed-off-by: Sean Young <sean@mess.org> Signed-off-by: Mauro Carvalho Chehab <mchehab@osg.samsung.com>
Markus Elfring [Sun, 30 Nov 2014 19:48:24 +0000 (16:48 -0300)]
[media] si2157: One function call less in si2157_init() after error
The release_firmware() function was called in some cases by the si2157_init()
function during error handling even if the passed variable contained still
a null pointer. This implementation detail could be improved
by the introduction of another jump label.
Signed-off-by: Markus Elfring <elfring@users.sourceforge.net> Signed-off-by: Mauro Carvalho Chehab <mchehab@osg.samsung.com>
commit 68a3c0433077 ([media] ARM: OMAP2: RX-51: update
si4713 platform data) updated board-rx51-peripherals.c
so that si4713 could be easily used on DT boot, but
it ended up introducing a build warning whenever
si4713 isn't enabled.
This patches fixes that warning:
arch/arm/mach-omap2/board-rx51-peripherals.c:1000:36: warning: \
‘rx51_si4713_platform_data’ defined but not used [-Wunused-variable]
static struct si4713_platform_data rx51_si4713_platform_data = {
Cc: Sebastian Reichel <sre@kernel.org> Cc: Tony Lindgren <tony@atomide.com> Cc: Hans Verkuil <hans.verkuil@cisco.com> Signed-off-by: Felipe Balbi <balbi@ti.com> Signed-off-by: Mauro Carvalho Chehab <mchehab@osg.samsung.com>
The situation of a buffer overflow won't happen, in practice,
with the current values of car_loop table. Yet, the entire logic
that checks for those registration values is too complex. So,
better to add an explicit check, just in case someone changes
the car_loop tables causing a buffer overflow by mistake.
This also helps to remove several smatch warnings, with is good.
This patch is basically produced while testing a tool that
Joe Perches sent upstream sometime ago:
https://lkml.org/lkml/2014/7/11/794
I used it with those arguments:
$ reformat_with_checkpatch.sh drivers/media/usb/em28xx/em28xx*.[ch]
It actually produced 24 patches, with is too much, and showed
interesting things: gcc produced different codes on most of the
patches, even with just linespace changes. The total code data
remained the same on all cases I checked though.
Anyway, provided that we fold the resulting patches, this tool
seems useful.
Olli Salonen [Thu, 27 Nov 2014 19:42:23 +0000 (16:42 -0300)]
[media] si2168: add support for firmware files in new format
This patch adds support for new type of firmware versions of Si2168 chip.
Old type: n x 8 bytes (all data, first byte seems to be 04 or 05)
New type: n x 17 bytes (1 byte indicates len and max 16 bytes data)
New version of TechnoTrend CT2-4400 drivers
(http://www.tt-downloads.de/bda-treiber_4.3.0.0.zip) contains newer
firmware for Si2168-B40 that is in the new format. It can be extracted
with the following command:
[media] stv090x: remove export symbol for stv090x_set_gpio()
Drivers that use dvb_attach can have just one exported symbol,
or they will cause compilation breakages depending on the
selected frontends.
As Jim reported:
drivers/built-in.o: In function `technisat_usb2_set_voltage':
technisat-usb2.c:(.text+0x3b4919): undefined reference to `stv090x_set_gpio'
make: *** [vmlinux] Error 1
That happens because, on his configuration, the configuration
is:
CONFIG_DVB_USB=y
CONFIG_DVB_STV090x=m
Luis proposed ar way to fix, but that would just force the
STV090x to be selected, even if one wants to use a device
with a different frontend.
Instead, let's do the right thing: move set_gpio to the
configuration structure and fill it during dvb_attach().
This way, the driver can still call it, and dvb_attach()
will load stv090x module only if the device really needs it.
Reported by: Jim Davis <jim.epost@gmail.com>
Cc: Luis Rodriguez <mcgrof@suse.com> Signed-off-by: Mauro Carvalho Chehab <mchehab@osg.samsung.com>
Antti Palosaari [Wed, 3 Dec 2014 23:11:03 +0000 (20:11 -0300)]
[media] rtl2832_sdr: control ADC
Recent rtl28xxu patch I made moved demod ADC enable from power control
to frontend control (due to slave demod support). Because of that we
need call USB interface frontend control too in order to enable ADC.
Signed-off-by: Antti Palosaari <crope@iki.fi> Signed-off-by: Mauro Carvalho Chehab <mchehab@osg.samsung.com>
[media] v4l: vb2: Fix race condition in _vb2_fop_release
The function releases the queue if the file being released is the queue
owner. The check reads the queue->owner field without taking the queue
lock, creating a race condition with functions that set the queue owner,
such as vb2_ioctl_reqbufs() for instance.
Fix this by moving the queue->owner check within the mutex protected
section.
[media] v4l: vb2: Fix race condition in vb2_fop_poll
The vb2_fop_poll() implementation tries to be clever on whether it needs
to lock the queue mutex by checking whether polling might start fileio.
The test requires reading the q->num_buffer field, which is racy if we
don't hold the queue mutex in the first place.
Remove the extra cleverness and just lock the mutex.
Sakari Ailus [Thu, 6 Nov 2014 19:54:33 +0000 (16:54 -0300)]
[media] smiapp: Support V4L2_SEL_TGT_NATIVE_SIZE
Add support for selection target V4L2_SEL_TGT_NATIVE_SIZE. It is equivalent
of what V4L2_SEL_TGT_CROP_BOUNDS used to be. Support for
V4L2_SEL_TGT_CROP_BOUNDS is still supported by the driver as a compatibility
interface.
Signed-off-by: Sakari Ailus <sakari.ailus@iki.fi> Acked-by: Hans Verkuil <hans.verkuil@cisco.com> Signed-off-by: Mauro Carvalho Chehab <mchehab@osg.samsung.com>
Sakari Ailus [Wed, 15 Oct 2014 13:08:19 +0000 (10:08 -0300)]
[media] v4l: Clean up sub-device format documentation
The sub-device format documentation documented scaling configuration through
formats. Instead the compose selection rectangle is elsewhere documented to
be used for the purpose. Remove scaling related part of the documentation.
Signed-off-by: Sakari Ailus <sakari.ailus@iki.fi> Acked-by: Hans Verkuil <hans.verkuil@cisco.com> Acked-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com> Signed-off-by: Mauro Carvalho Chehab <mchehab@osg.samsung.com>
Hans Verkuil [Mon, 1 Dec 2014 11:32:54 +0000 (08:32 -0300)]
[media] omap_vout: fix compile warnings
When compiling under COMPILE_TEST on a x86_64 the following warnings
appear:
drivers/media/platform/omap/omap_vout.c: In function 'omap_vout_uservirt_to_phys':
drivers/media/platform/omap/omap_vout.c:209:23: warning: cast to pointer from integer of different size [-Wint-to-pointer-cast]
return virt_to_phys((void *) virtp);
^
drivers/media/platform/omap/omap_vout.c: In function 'omapvid_setup_overlay':
drivers/media/platform/omap/omap_vout.c:420:2: warning: format '%x' expects argument of type 'unsigned int', but argument 5 has type 'dma_addr_t' [-Wformat=]
v4l2_dbg(1, debug, &vout->vid_dev->v4l2_dev,
^
drivers/media/platform/omap/omap_vout.c: In function 'omap_vout_buffer_prepare':
drivers/media/platform/omap/omap_vout.c:794:34: warning: cast to pointer from integer of different size [-Wint-to-pointer-cast]
vout->queued_buf_addr[vb->i] = (u8 *)
^
In file included from arch/x86/include/asm/dma-mapping.h:44:0,
from include/linux/dma-mapping.h:82,
from drivers/media/platform/omap/omap_vout.c:40:
drivers/media/platform/omap/omap_vout.c:803:58: warning: cast to pointer from integer of different size [-Wint-to-pointer-cast]
dma_addr = dma_map_single(vout->vid_dev->v4l2_dev.dev, (void *) addr,
^
include/asm-generic/dma-mapping-common.h:174:60: note: in definition of macro 'dma_map_single'
#define dma_map_single(d, a, s, r) dma_map_single_attrs(d, a, s, r, NULL)
^
These are fixed by this patch.
Signed-off-by: Hans Verkuil <hans.verkuil@cisco.com> Signed-off-by: Mauro Carvalho Chehab <mchehab@osg.samsung.com>
Prabhakar Lad [Wed, 26 Nov 2014 22:42:31 +0000 (19:42 -0300)]
[media] media: blackfin: use vb2_ops_wait_prepare/finish helper
This patch drops driver specific wait_prepare() and
wait_finish() callbacks from vb2_ops and instead uses
the the helpers vb2_ops_wait_prepare/finish() provided
by the vb2 core, the lock member of the queue needs
to be initalized to a mutex so that vb2 helpers
vb2_ops_wait_prepare/finish() can make use of it.
Signed-off-by: Lad, Prabhakar <prabhakar.csengg@gmail.com> Acked-by: Scott Jiang <scott.jiang.linux@gmail.com> Signed-off-by: Hans Verkuil <hans.verkuil@cisco.com> Signed-off-by: Mauro Carvalho Chehab <mchehab@osg.samsung.com>
Prabhakar Lad [Wed, 26 Nov 2014 22:42:29 +0000 (19:42 -0300)]
[media] media: marvell-ccic: use vb2_ops_wait_prepare/finish helper
This patch drops driver specific wait_prepare() and
wait_finish() callbacks from vb2_ops and instead uses
the the helpers vb2_ops_wait_prepare/finish() provided
by the vb2 core, the lock member of the queue needs
to be initalized to a mutex so that vb2 helpers
vb2_ops_wait_prepare/finish() can make use of it.
Signed-off-by: Lad, Prabhakar <prabhakar.csengg@gmail.com> Cc: Jonathan Corbet <corbet@lwn.net> Signed-off-by: Hans Verkuil <hans.verkuil@cisco.com> Signed-off-by: Mauro Carvalho Chehab <mchehab@osg.samsung.com>
Hans Verkuil [Mon, 17 Nov 2014 13:21:19 +0000 (10:21 -0300)]
[media] vivid: add new colorspaces
Add AdobeRGB and BT.2020 support.
The colorspace control now orders the colorspaces according to how often
they are used. So rarely used colorspaces are moved to the end. This makes
it more logical when testing colorspace support.
Signed-off-by: Hans Verkuil <hans.verkuil@cisco.com> Signed-off-by: Mauro Carvalho Chehab <mchehab@osg.samsung.com>
Hans Verkuil [Mon, 17 Nov 2014 13:05:39 +0000 (10:05 -0300)]
[media] vivid-tpg-colors: add AdobeRGB and BT.2020 support
This extends the precalculated tpg_csc_colors matrix with AdobeRGB and BT.2020
colorspace support.
It also adds two precalculated tables that convert between linear RGB and non-linear
Rec.709 R'G'B' values, i.e. the Rec. 709 transfer function. This is needed to
efficiently handle the BT.2020 Constant Luminance Yc'CbcCrc encoding and decoding.
Signed-off-by: Hans Verkuil <hans.verkuil@cisco.com> Signed-off-by: Mauro Carvalho Chehab <mchehab@osg.samsung.com>
Hans Verkuil [Thu, 27 Nov 2014 13:16:08 +0000 (10:16 -0300)]
[media] DocBook media: rewrite the Colorspace chapter
The colorspace chapter in the V4L2 Specification was always poorly
written. This patch rewrites it, documenting the new Y'CbCr encoding
and quantization defines and going into much more detail with respect
to how colorspaces are used and what it all means.
Signed-off-by: Hans Verkuil <hans.verkuil@cisco.com> Signed-off-by: Mauro Carvalho Chehab <mchehab@osg.samsung.com>
Hans Verkuil [Mon, 17 Nov 2014 12:12:41 +0000 (09:12 -0300)]
[media] v4l2-ioctl.c: log the new ycbcr_enc and quantization fields
Log the new ycbcr_enc and quantization fields. Note that it now
also logs the flags field for the multiplanar buffer type. This was
forgotten when the flags field was added.
Signed-off-by: Hans Verkuil <hans.verkuil@cisco.com> Signed-off-by: Mauro Carvalho Chehab <mchehab@osg.samsung.com>
[media] media: rc: add driver for Amlogic Meson IR remote receiver
Amlogic Meson SoCs include a infrared remote control receiver that can
operate in two modes: "NEC" mode in which the hardware decodes frames
using the NEC IR protocol, and "general" mode in which the receiver
simply reports the duration of pulses and spaces for software
decoding.
This is a driver for the IR receiver that implements software decoding
of received frames.
Paul Bolle [Mon, 24 Nov 2014 12:07:45 +0000 (09:07 -0300)]
[media] omap: Fix typo "HAS_MMU"
Commit 38a073116525 ("[media] omap: be sure that MMU is there for
COMPILE_TEST") added a dependency on HAS_MMU. There's no Kconfig symbol
HAS_MMU. Use MMU instead.
Signed-off-by: Paul Bolle <pebolle@tiscali.nl> Signed-off-by: Mauro Carvalho Chehab <mchehab@osg.samsung.com>
Shuah Khan [Sat, 22 Nov 2014 00:17:08 +0000 (21:17 -0300)]
[media] media/au0828: Fix IR stop, poll to not access device during disconnect
au0828 IR stop and poll routines continue to access device
while usb disconnect is in progress. There is small window
between device disconnect and usb interface is set to null.
This results in filling the log with several of the following
error messages. Fix it to detect device disconnect condition
and avoid device access.
Nov 20 18:58:02 anduin kernel: [ 102.949819] au0828: au0828_usb_disconnect()
Nov 20 18:58:02 anduin kernel: [ 102.950046] au0828: send_control_msg() Failed sending control message, error -71.
Nov 20 18:58:02 anduin kernel: [ 102.950052] au0828: send_control_msg() Failed sending control message, error -19.
Nov 20 18:58:02 anduin kernel: [ 102.950056] au0828: send_control_msg() Failed sending control message, error -19.
Nov 20 18:58:02 anduin kernel: [ 102.950061] au0828: send_control_msg() Failed sending control message, error -19.
Nov 20 18:58:02 anduin kernel: [ 102.950065] au0828: recv_control_msg() Failed receiving control message, error -19.
Nov 20 18:58:02 anduin kernel: [ 102.950069] au0828: recv_control_msg() Failed receiving control message, error -19.
Nov 20 18:58:02 anduin kernel: [ 102.950072] au0828: recv_control_msg() Failed receiving control message, error -19.
Markus Elfring [Thu, 20 Nov 2014 12:26:36 +0000 (09:26 -0300)]
[media] USB: Deletion of unnecessary checks before three function calls
GIT_AUTHOR_DATE=1416486805
The functions pvr2_hdw_destroy(), rc_unregister_device() and vfree() perform
also input parameter validation. Thus the test around the call is not needed.
This issue was detected by using the Coccinelle software.
Signed-off-by: Markus Elfring <elfring@users.sourceforge.net> Signed-off-by: Mauro Carvalho Chehab <mchehab@osg.samsung.com>
Markus Elfring [Thu, 20 Nov 2014 10:44:20 +0000 (07:44 -0300)]
[media] platform: Deletion of unnecessary checks before two function calls
The functions i2c_put_adapter() and release_firmware() test whether their
argument is NULL and then return immediately. Thus the test around the call
is not needed.
This issue was detected by using the Coccinelle software.
Signed-off-by: Markus Elfring <elfring@users.sourceforge.net> Signed-off-by: Mauro Carvalho Chehab <mchehab@osg.samsung.com>
Markus Elfring [Thu, 20 Nov 2014 12:01:32 +0000 (09:01 -0300)]
[media] rc: Deletion of unnecessary checks before two function calls
The functions input_free_device() and rc_close() test whether their argument
is NULL and then return immediately. Thus the test around the call
is not needed.
This issue was detected by using the Coccinelle software.
Signed-off-by: Markus Elfring <elfring@users.sourceforge.net> Signed-off-by: Mauro Carvalho Chehab <mchehab@osg.samsung.com>
Nibble Max [Thu, 13 Nov 2014 08:10:41 +0000 (05:10 -0300)]
[media] dvb-usb-dvbsky: add T680CI dvb-t2/t/c usb ci box support
DVBSky T680CI dvb-t2/t/c usb ci box:
1>dvb frontend: SI2158A20(tuner), SI2168A30(demod)
2>usb controller: CY7C86013A
3>ci controller: CIMAX SP2 or its clone.
Signed-off-by: Nibble Max <nibble.max@gmail.com> Reviewed-by: Olli Salonen <olli.salonen@iki.fi> Signed-off-by: Mauro Carvalho Chehab <mchehab@osg.samsung.com>
Markus Elfring [Wed, 19 Nov 2014 22:23:15 +0000 (19:23 -0300)]
[media] si2168: One function call less in si2168_init() after error detection
GIT_AUTHOR_DATE=1416472767
The release_firmware() function was called in some cases by the
si2168_init() function during error handling even if the passed variable
contained still a null pointer. This implementation detail could be improved
by the introduction of another jump label.
Signed-off-by: Markus Elfring <elfring@users.sourceforge.net> Signed-off-by: Mauro Carvalho Chehab <mchehab@osg.samsung.com>
Markus Elfring [Wed, 19 Nov 2014 22:20:51 +0000 (19:20 -0300)]
[media] m88ds3103: One function call less in m88ds3103_init() after error detection
GIT_AUTHOR_DATE=1416472158
The release_firmware() function was called in some cases by the
m88ds3103_init() function during error handling even if the passed variable
contained still a null pointer. This implementation detail could be improved
by the introduction of another jump label.
Signed-off-by: Markus Elfring <elfring@users.sourceforge.net> Signed-off-by: Mauro Carvalho Chehab <mchehab@osg.samsung.com>
Markus Elfring [Wed, 19 Nov 2014 21:27:24 +0000 (18:27 -0300)]
[media] DVB-frontends: Deletion of unnecessary checks before the function call "release_firmware"
GIT_AUTHOR_DATE=1416472432
The release_firmware() function tests whether its argument is NULL
and then returns immediately. Thus the test around the call is not needed.
This issue was detected by using the Coccinelle software.
Signed-off-by: Markus Elfring <elfring@users.sourceforge.net> Signed-off-by: Mauro Carvalho Chehab <mchehab@osg.samsung.com>
I don't have the remote, so the RC_MAP is a best guess based on the pictures of
the remote controllers and other supported Terratec devices with a similar
remote.
[Antti: Resolved conflict caused by Leadtek VC100 patch]
Signed-off-by: Olli Salonen <olli.salonen@iki.fi> Signed-off-by: Antti Palosaari <crope@iki.fi> Signed-off-by: Mauro Carvalho Chehab <mchehab@osg.samsung.com>
Olli Salonen [Mon, 24 Nov 2014 06:57:33 +0000 (03:57 -0300)]
[media] si2157: Add support for Si2146-A10
The Silicon Labs Si2146 tuner seems to work with the same driver as the Si2157,
but there a few exceptions. The powerup command seems to be quite a bit
different. In addition there's a property 0207 that requires a different value.
Thus another entry is created in the si2157_id table to support also si2146 in
this driver.
The datasheet is available on manufacturer's website:
http://www.silabs.com/support%20documents/technicaldocs/Si2146-short.pdf
Signed-off-by: Olli Salonen <olli.salonen@iki.fi> Signed-off-by: Antti Palosaari <crope@iki.fi> Signed-off-by: Mauro Carvalho Chehab <mchehab@osg.samsung.com>
Hans Verkuil [Tue, 18 Nov 2014 12:51:08 +0000 (09:51 -0300)]
[media] vb2: use dma_map_sg_attrs to prevent unnecessary sync
By default dma_map_sg syncs the mapped buffer to the device. But
buf_prepare expects a buffer syncs for the cpu and the buffer
will be synced to the device in the prepare memop.
The reverse is true for dma_unmap_sg, buf_finish and the finish
memop.
To prevent unnecessary syncs we ask dma_(un)map_sg to skip the
sync.
Hans Verkuil [Mon, 24 Nov 2014 11:50:31 +0000 (08:50 -0300)]
[media] vb2-dma-sg: move dma_(un)map_sg here
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']
Laurent Pinchart [Tue, 21 Oct 2014 19:37:55 +0000 (16:37 -0300)]
[media] uvcvideo: Return all buffers to vb2 at stream stop and start failure
videobuf2 requires drivers to give back ownership of all queue buffers
in the stop_streaming operation, as well as in the start_streaming
operation in case of failure. Mark all queued buffers as done in the
error or queued state.
Laurent Pinchart [Tue, 21 Oct 2014 19:07:15 +0000 (16:07 -0300)]
[media] uvcvideo: Don't stop the stream twice at file handle release
When releasing the file handle the driver calls the vb2_queue_release
which turns the stream off. There's thus no need to turn the stream off
explicitly beforehand.