GitHub/LineageOS/G12/android_kernel_amlogic_linux-4.9.git
9 years ago[media] mn88473: Remove uneeded check before release_firmware()
Markus Elfring [Mon, 1 Dec 2014 21:55:29 +0000 (18:55 -0300)]
[media] mn88473: Remove uneeded check before release_firmware()

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>
9 years ago[media] lirc_zilog: Deletion of unnecessary checks before vfree()
Markus Elfring [Mon, 1 Dec 2014 18:49:39 +0000 (15:49 -0300)]
[media] lirc_zilog: Deletion of unnecessary checks before vfree()

The vfree() function performs 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>
9 years ago[media] MAINTAINERS: Add myself as img-ir maintainer
James Hogan [Mon, 17 Nov 2014 12:17:49 +0000 (09:17 -0300)]
[media] MAINTAINERS: Add myself as img-ir maintainer

Add myself as the maintainer for the Imagination Technologies Infrared
Decoder driver.

Signed-off-by: James Hogan <james.hogan@imgtec.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab@osg.samsung.com>
9 years ago[media] img-ir: Don't set driver's module owner
James Hogan [Mon, 17 Nov 2014 12:17:48 +0000 (09:17 -0300)]
[media] img-ir: Don't set driver's module owner

Don't bother setting .owner = THIS_MODULE, since it's already handled by
the platform_driver_register macro.

Signed-off-by: James Hogan <james.hogan@imgtec.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab@osg.samsung.com>
9 years ago[media] img-ir: Depend on METAG or MIPS or COMPILE_TEST
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>
9 years ago[media] img-ir/hw: Drop [un]register_decoder declarations
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>
9 years ago[media] img-ir/hw: Fix potential deadlock stopping timer
James Hogan [Mon, 1 Dec 2014 12:55:10 +0000 (09:55 -0300)]
[media] img-ir/hw: Fix potential deadlock stopping timer

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:

       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.

---------------------------------------------------------
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.

Signed-off-by: James Hogan <james.hogan@imgtec.com>
Cc: Sifan Naeem <sifan.naeem@imgtec.com>
Cc: <stable@vger.kernel.org> # v3.15+
Signed-off-by: Mauro Carvalho Chehab <mchehab@osg.samsung.com>
9 years ago[media] img-ir/hw: Always read data to clear buffer
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.

Signed-off-by: Dylan Rajaratnam <dylan.rajaratnam@imgtec.com>
Signed-off-by: James Hogan <james.hogan@imgtec.com>
Cc: <stable@vger.kernel.org> # v3.15+
Signed-off-by: Mauro Carvalho Chehab <mchehab@osg.samsung.com>
9 years ago[media] redrat3: ensure dma is setup properly
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>
9 years ago[media] ddbridge: remove unneeded check before dvb_unregister_device()
Markus Elfring [Sun, 30 Nov 2014 21:50:20 +0000 (18:50 -0300)]
[media] ddbridge: remove unneeded check before dvb_unregister_device()

The dvb_unregister_device() 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>
9 years ago[media] si2157: One function call less in si2157_init() after error
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>
9 years ago[media] tuners: remove uneeded checks before release_firmware()
Markus Elfring [Sun, 30 Nov 2014 18:05:48 +0000 (15:05 -0300)]
[media] tuners: remove uneeded checks before release_firmware()

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>
9 years ago[media] arm: omap2: rx51-peripherals: fix build warning
Felipe Balbi [Wed, 26 Nov 2014 20:27:35 +0000 (17:27 -0300)]
[media] arm: omap2: rx51-peripherals: fix build warning

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>
9 years ago[media] stv090x: add an extra protetion against buffer overflow
Mauro Carvalho Chehab [Thu, 4 Dec 2014 16:48:42 +0000 (14:48 -0200)]
[media] stv090x: add an extra protetion against buffer overflow

As pointed by smatch:
drivers/media/dvb-frontends/stv090x.c:2787 stv090x_optimize_carloop() error: buffer overflow 'car_loop_apsk_low' 11 <= 13
drivers/media/dvb-frontends/stv090x.c:2789 stv090x_optimize_carloop() error: buffer overflow 'car_loop_apsk_low' 11 <= 13
drivers/media/dvb-frontends/stv090x.c:2791 stv090x_optimize_carloop() error: buffer overflow 'car_loop_apsk_low' 11 <= 13
drivers/media/dvb-frontends/stv090x.c:2793 stv090x_optimize_carloop() error: buffer overflow 'car_loop_apsk_low' 11 <= 13
drivers/media/dvb-frontends/stv090x.c:2795 stv090x_optimize_carloop() error: buffer overflow 'car_loop_apsk_low' 11 <= 13

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.

Signed-off-by: Mauro Carvalho Chehab <mchehab@osg.samsung.com>
9 years ago[media] stv090x: Remove an unreachable code
Mauro Carvalho Chehab [Thu, 4 Dec 2014 16:21:42 +0000 (14:21 -0200)]
[media] stv090x: Remove an unreachable code

if STV090x_RANGEOK is not returned, then STV090x_OUTOFRANGE
is returned. However, that part of the code is never reached,
as pointed by smatch:

drivers/media/dvb-frontends/stv090x.c:2673 stv090x_get_sig_params() info: ignoring unreachable code.

So, remove the two uneeded elses, with makes the code a little bit
cleaner.

No functional changes, and one less smatch warning.

Signed-off-by: Mauro Carvalho Chehab <mchehab@osg.samsung.com>
9 years ago[media] stv090x: Some whitespace cleanups
Mauro Carvalho Chehab [Thu, 4 Dec 2014 16:13:33 +0000 (14:13 -0200)]
[media] stv090x: Some whitespace cleanups

While writing changeset fdf1bc9fa2cf, I noticed some checkpatch
complains about the CodingStyle for function parameters. So,
clean them.

While here, also removes uneeded "extern" from function prototype.

No functional changes.

Signed-off-by: Mauro Carvalho Chehab <mchehab@osg.samsung.com>
9 years ago[media] em28xx: checkpatch cleanup: whitespaces/new lines cleanups
Mauro Carvalho Chehab [Fri, 28 Nov 2014 11:34:15 +0000 (08:34 -0300)]
[media] em28xx: checkpatch cleanup: whitespaces/new lines cleanups

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.

Signed-off-by: Mauro Carvalho Chehab <mchehab@osg.samsung.com>
9 years ago[media] si2168: add support for firmware files in new format
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:

dd if=ttTVStick4400_64.sys ibs=1 skip=323872 count=6919 of=dvb-demod-si2168-b40-01.fw

Signed-off-by: Olli Salonen <olli.salonen@iki.fi>
Reviewed-by: Antti Palosaari <crope@iki.fi>
Signed-off-by: Mauro Carvalho Chehab <mchehab@osg.samsung.com>
9 years ago[media] si2168: debug printout for firmware version
Olli Salonen [Thu, 27 Nov 2014 19:42:22 +0000 (16:42 -0300)]
[media] si2168: debug printout for firmware version

A debug printout for firmware version.

Signed-off-by: Olli Salonen <olli.salonen@iki.fi>
Reviewed-by: Antti Palosaari <crope@iki.fi>
Signed-off-by: Mauro Carvalho Chehab <mchehab@osg.samsung.com>
9 years ago[media] cx24117: Grammar s/if ... if/if ... is/
Geert Uytterhoeven [Thu, 27 Nov 2014 11:05:44 +0000 (08:05 -0300)]
[media] cx24117: Grammar s/if ... if/if ... is/

Signed-off-by: Geert Uytterhoeven <geert+renesas@glider.be>
Signed-off-by: Mauro Carvalho Chehab <mchehab@osg.samsung.com>
9 years ago[media] media: v4l2-image-sizes.h: correct the SVGA height definition
Josh Wu [Thu, 27 Nov 2014 03:15:01 +0000 (00:15 -0300)]
[media] media: v4l2-image-sizes.h: correct the SVGA height definition

SVGA height should be 600 not 680.

Reported-by: Sylwester Nawrocki <s.nawrocki@samsung.com>
Signed-off-by: Josh Wu <josh.wu@atmel.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab@osg.samsung.com>
9 years ago[media] tda18271: Fix identation
Mauro Carvalho Chehab [Wed, 26 Nov 2014 15:26:09 +0000 (12:26 -0300)]
[media] tda18271: Fix identation

As reported by smatch:
drivers/media/tuners/tda18271-common.c:176 tda18271_read_extended() warn: if statement not indented

Signed-off-by: Mauro Carvalho Chehab <mchehab@osg.samsung.com>
9 years ago[media] stv090x: remove export symbol for stv090x_set_gpio()
Mauro Carvalho Chehab [Wed, 26 Nov 2014 13:07:41 +0000 (10:07 -0300)]
[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>
9 years ago[media] dvb-usb-dvbsky: add TechnoTrend CT2-4400 and CT2-4650 devices support
Nibble Max [Wed, 26 Nov 2014 12:35:28 +0000 (09:35 -0300)]
[media] dvb-usb-dvbsky: add TechnoTrend CT2-4400 and CT2-4650 devices support

Signed-off-by: Nibble Max <nibble.max@gmail.com>
Reviewed-by: Olli Salonen <olli.salonen@iki.fi>
Tested-by: Olli Salonen <olli.salonen@iki.fi>
Reviewed-by: Antti Palosaari <crope@iki.fi>
Signed-off-by: Mauro Carvalho Chehab <mchehab@osg.samsung.com>
9 years ago[media] cxusb: remove TechnoTrend CT2-4400 and CT2-4650 devices
Nibble Max [Wed, 26 Nov 2014 12:35:14 +0000 (09:35 -0300)]
[media] cxusb: remove TechnoTrend CT2-4400 and CT2-4650 devices

Remove TechnoTrend CT2-4400 and CT2-4650 devices from cxusb.
They are supported by dvb-usb-dvbsky driver in PATCH 3/3.

Signed-off-by: Nibble Max <nibble.max@gmail.com>
Reviewed-by: Olli Salonen <olli.salonen@iki.fi>
Reviewed-by: Antti Palosaari <crope@iki.fi>
Signed-off-by: Mauro Carvalho Chehab <mchehab@osg.samsung.com>
9 years ago[media] dvb-usb-dvbsky: add T330 dvb-t2/t/c usb stick support
Nibble Max [Wed, 26 Nov 2014 12:34:46 +0000 (09:34 -0300)]
[media] dvb-usb-dvbsky: add T330 dvb-t2/t/c usb stick support

DVBSky T330 dvb-t2/t/c usb stick:
1>dvb frontend: SI2157A30(tuner), SI2168B40(demod)
2>usb controller: CY7C68013A

Signed-off-by: Nibble Max <nibble.max@gmail.com>
Reviewed-by: Olli Salonen <olli.salonen@iki.fi>
Reviewed-by: Antti Palosaari <crope@iki.fi>
Signed-off-by: Mauro Carvalho Chehab <mchehab@osg.samsung.com>
9 years ago[media] media: exynos-gsc: fix build warning
Mauro Carvalho Chehab [Tue, 25 Nov 2014 15:04:16 +0000 (12:04 -0300)]
[media] media: exynos-gsc: fix build warning

Fixes following build warnings:

gsc-core.c:350:17: warning: 'low_plane' may be used uninitialized
gsc-core.c:371:31: warning: 'high_plane' may be used uninitialized

Reported-by: Prabhakar Lad <prabhakar.csengg@gmail.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab@osg.samsung.com>
Acked-by: Lad, Prabhakar <prabhakar.csengg@gmail.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab@osg.samsung.com>
9 years ago[media] rtl2832_sdr: control ADC
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>
9 years ago[media] v4l: vb2: Fix race condition in _vb2_fop_release
Laurent Pinchart [Sat, 1 Nov 2014 13:32:28 +0000 (10:32 -0300)]
[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.

Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
Acked-by: Hans Verkuil <hans.verkuil@cisco.com>
Acked-by: Sylwester Nawrocki <s.nawrocki@samsung.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab@osg.samsung.com>
9 years ago[media] v4l: vb2: Fix race condition in vb2_fop_poll
Laurent Pinchart [Sat, 1 Nov 2014 13:32:28 +0000 (10:32 -0300)]
[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.

Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
Acked-by: Hans Verkuil <hans.verkuil@cisco.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab@osg.samsung.com>
9 years ago[media] smiapp: Support V4L2_SEL_TGT_NATIVE_SIZE
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>
9 years ago[media] smiapp: Set left and top to zero for crop bounds selection
Sakari Ailus [Sun, 16 Nov 2014 14:48:31 +0000 (11:48 -0300)]
[media] smiapp: Set left and top to zero for crop bounds selection

The fields were previously uninitialised, leaving the returned values to
where the user had set them. This was never the intention.

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>
9 years ago[media] v4l: Add input and output capability flags for native size setting
Sakari Ailus [Tue, 18 Nov 2014 05:27:00 +0000 (02:27 -0300)]
[media] v4l: Add input and output capability flags for native size setting

Add input and output capability flags for setting native size of the device,
and document them.

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>
9 years ago[media] v4l: Add V4L2_SEL_TGT_NATIVE_SIZE selection target
Sakari Ailus [Wed, 15 Oct 2014 16:38:15 +0000 (13:38 -0300)]
[media] v4l: Add V4L2_SEL_TGT_NATIVE_SIZE selection target

The V4L2_SEL_TGT_NATIVE_SIZE target is used to denote e.g. the size of a
sensor's pixel array.

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>
9 years ago[media] v4l: Clean up sub-device format documentation
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>
9 years ago[media] omap_vout: fix compile warnings
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>
9 years ago[media] media: davinci: vpif_capture: use vb2_ops_wait_prepare/finish helper
Prabhakar Lad [Wed, 26 Nov 2014 22:42:33 +0000 (19:42 -0300)]
[media] media: davinci: vpif_capture: use vb2_ops_wait_prepare/finish helper

This patch adds support in the capture driver for using
vb2_ops_wait_prepare/finish()  helpers provided by the
vb2 core.

Signed-off-by: Lad, Prabhakar <prabhakar.csengg@gmail.com>
Signed-off-by: Hans Verkuil <hans.verkuil@cisco.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab@osg.samsung.com>
9 years ago[media] media: blackfin: use vb2_ops_wait_prepare/finish helper
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>
9 years ago[media] media: marvell-ccic: use vb2_ops_wait_prepare/finish helper
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>
9 years ago[media] V4L2: Deletion of an unnecessary check before the function call "vb2_put_vma"
Markus Elfring [Sun, 30 Nov 2014 22:10:51 +0000 (19:10 -0300)]
[media] V4L2: Deletion of an unnecessary check before the function call "vb2_put_vma"

The vb2_put_vma() 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>
Acked-by: Marek Szyprowski <m.szyprowski@samsung.com>
Signed-off-by: Hans Verkuil <hans.verkuil@cisco.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab@osg.samsung.com>
9 years ago[media] media/platform: fix querycap
Hans Verkuil [Mon, 24 Nov 2014 09:37:26 +0000 (06:37 -0300)]
[media] media/platform: fix querycap

Querycap shouldn't set the version field (the core does that for you),
but it should set the device_caps field.

In addition, remove the CAPTURE and OUTPUT caps for M2M devices. These
were already slated for removal, so it's time to do so.

Signed-off-by: Hans Verkuil <hans.verkuil@cisco.com>
Acked-by: Kamil Debski <k.debski@samsung.com>
Acked-by: Lad, Prabhakar <prabhakar.csengg@gmail.com>
Acked-by: Jacek Anaszewski <j.anaszewski@samsung.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab@osg.samsung.com>
9 years ago[media] media/platform: fix querycap
Hans Verkuil [Mon, 24 Nov 2014 09:37:25 +0000 (06:37 -0300)]
[media] media/platform: fix querycap

Querycap shouldn't set the version field (the core does that for you),
but it should set the device_caps field.

Signed-off-by: Hans Verkuil <hans.verkuil@cisco.com>
Cc: Scott Jiang <scott.jiang.linux@gmail.com>
Cc: Gerhard Sittig <gsi@denx.de>
Cc: Jonathan Corbet <corbet@lwn.net>
Cc: Guennadi Liakhovetski <g.liakhovetski@gmx.de>
Signed-off-by: Mauro Carvalho Chehab <mchehab@osg.samsung.com>
9 years ago[media] media/radio: fix querycap
Hans Verkuil [Mon, 24 Nov 2014 09:37:24 +0000 (06:37 -0300)]
[media] media/radio: fix querycap

Querycap should set the device_caps field.

Signed-off-by: Hans Verkuil <hans.verkuil@cisco.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab@osg.samsung.com>
9 years ago[media] media/usb,pci: fix querycap
Hans Verkuil [Mon, 24 Nov 2014 09:37:23 +0000 (06:37 -0300)]
[media] media/usb,pci: fix querycap

Querycap shouldn't set the version field (the core does that for you),
but it should set the device_caps field.

Signed-off-by: Hans Verkuil <hans.verkuil@cisco.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab@osg.samsung.com>
9 years ago[media] staging/media: fix querycap
Hans Verkuil [Mon, 24 Nov 2014 09:37:22 +0000 (06:37 -0300)]
[media] staging/media: fix querycap

Querycap shouldn't set the version field (the core does that for you),
but it should set the device_caps field.

Signed-off-by: Hans Verkuil <hans.verkuil@cisco.com>
Acked-by: Lad, Prabhakar <prabhakar.csengg@gmail.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab@osg.samsung.com>
9 years ago[media] cx18: add device_caps support
Hans Verkuil [Mon, 24 Nov 2014 09:37:21 +0000 (06:37 -0300)]
[media] cx18: add device_caps support

This was missing in this driver, so add this functionality.

Signed-off-by: Hans Verkuil <hans.verkuil@cisco.com>
Cc: Andy Walls <awalls@md.metrocast.net>
Signed-off-by: Mauro Carvalho Chehab <mchehab@osg.samsung.com>
9 years ago[media] adv7511: improve colorspace handling
Hans Verkuil [Thu, 27 Nov 2014 13:07:38 +0000 (10:07 -0300)]
[media] adv7511: improve colorspace handling

Add support for YCbCr output and support setting colorspace,
YCbCr encoding and quantization for the AVI InfoFrame.

Signed-off-by: Hans Verkuil <hans.verkuil@cisco.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab@osg.samsung.com>
9 years ago[media] vivid: add support for YCbCr encoding and quantization
Hans Verkuil [Mon, 17 Nov 2014 13:26:01 +0000 (10:26 -0300)]
[media] vivid: add support for YCbCr encoding and quantization

Implement controls to set the YCbCr encoding and the quantization
range for the colorspace.

Signed-off-by: Hans Verkuil <hans.verkuil@cisco.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab@osg.samsung.com>
9 years ago[media] vivid: add new colorspaces
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>
9 years ago[media] vivid-tpg: improve colorspace support
Hans Verkuil [Mon, 17 Nov 2014 13:14:32 +0000 (10:14 -0300)]
[media] vivid-tpg: improve colorspace support

Add support for the new AdobeRGB and BT.2020 colorspaces. Also support
explicit Y'CbCr and quantization settings.

Signed-off-by: Hans Verkuil <hans.verkuil@cisco.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab@osg.samsung.com>
9 years ago[media] vivid-tpg-colors: add AdobeRGB and BT.2020 support
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>
9 years ago[media] DocBook media: rewrite the Colorspace chapter
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>
9 years ago[media] v4l2-ioctl.c: log the new ycbcr_enc and quantization fields
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>
9 years ago[media] v4l2-mediabus: improve colorspace support
Hans Verkuil [Mon, 17 Nov 2014 12:10:33 +0000 (09:10 -0300)]
[media] v4l2-mediabus: improve colorspace support

Add and copy the new ycbcr_enc and quantization fields.

Signed-off-by: Hans Verkuil <hans.verkuil@cisco.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab@osg.samsung.com>
9 years ago[media] videodev2.h: improve colorspace support
Hans Verkuil [Mon, 17 Nov 2014 12:06:42 +0000 (09:06 -0300)]
[media] videodev2.h: improve colorspace support

Add support for the new AdobeRGB and BT.2020 colorspaces as needed for
HDMI 2.0.

Add support to specify the Y'CbCr encoding and quantization range explicitly.

Signed-off-by: Hans Verkuil <hans.verkuil@cisco.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab@osg.samsung.com>
9 years ago[media] ARM: dts: meson: add IR receiver node
Beniamino Galvani [Tue, 18 Nov 2014 20:22:35 +0000 (17:22 -0300)]
[media] ARM: dts: meson: add IR receiver node

This adds a node for the IR remote control receiver to the Amlogic
Meson DTS.

Signed-off-by: Beniamino Galvani <b.galvani@gmail.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab@osg.samsung.com>
9 years ago[media] media: rc: add driver for Amlogic Meson IR remote receiver
Beniamino Galvani [Tue, 18 Nov 2014 20:22:34 +0000 (17:22 -0300)]
[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.

Signed-off-by: Beniamino Galvani <b.galvani@gmail.com>
Acked-by: Carlo Caione <carlo@caione.org>
Signed-off-by: Mauro Carvalho Chehab <mchehab@osg.samsung.com>
9 years ago[media] media: rc: meson: document device tree bindings
Beniamino Galvani [Tue, 18 Nov 2014 20:22:33 +0000 (17:22 -0300)]
[media] media: rc: meson: document device tree bindings

This adds binding documentation for the infrared remote control
receiver available in Amlogic Meson SoCs.

Signed-off-by: Beniamino Galvani <b.galvani@gmail.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab@osg.samsung.com>
9 years ago[media] omap: disable COMPILE_TEST
Mauro Carvalho Chehab [Wed, 26 Nov 2014 01:41:09 +0000 (23:41 -0200)]
[media] omap: disable COMPILE_TEST

This causes lots of errors, because of sub-arch specific dependencies:

All error/warnings:

>> ERROR: "omapdss_compat_init" [drivers/media/platform/omap/omap-vout.ko] undefined!
>> ERROR: "omap_dss_get_overlay_manager" [drivers/media/platform/omap/omap-vout.ko] undefined!
>> ERROR: "omap_dss_get_num_overlay_managers" [drivers/media/platform/omap/omap-vout.ko] undefined!
>> ERROR: "omap_dss_get_overlay" [drivers/media/platform/omap/omap-vout.ko] undefined!
>> ERROR: "omapdss_is_initialized" [drivers/media/platform/omap/omap-vout.ko] undefined!
>> ERROR: "omap_dispc_register_isr" [drivers/media/platform/omap/omap-vout.ko] undefined!
>> ERROR: "omapdss_get_version" [drivers/media/platform/omap/omap-vout.ko] undefined!
>> ERROR: "omap_dss_put_device" [drivers/media/platform/omap/omap-vout.ko] undefined!
>> ERROR: "omap_dss_get_next_device" [drivers/media/platform/omap/omap-vout.ko] undefined!
>> ERROR: "omap_dispc_unregister_isr" [drivers/media/platform/omap/omap-vout.ko] undefined!
>> ERROR: "omapdss_compat_uninit" [drivers/media/platform/omap/omap-vout.ko] undefined!
>> ERROR: "omap_dss_get_device" [drivers/media/platform/omap/omap-vout.ko] undefined!
>> ERROR: "omap_dss_get_num_overlays" [drivers/media/platform/omap/omap-vout.ko] undefined!

Signed-off-by: Mauro Carvalho Chehab <mchehab@osg.samsung.com>
9 years agoRevert "[media] lmed04: add missing breaks"
Mauro Carvalho Chehab [Tue, 25 Nov 2014 17:46:13 +0000 (15:46 -0200)]
Revert "[media] lmed04: add missing breaks"

According with Malcolm, the missing breaks are intentional.

So, let's revert commit d442b15fb4deb2b5d516e2dae1f569b1d5472399,
add some comments to document it and fix the two smatch warnings:

drivers/media/usb/dvb-usb-v2/lmedm04.c:828 lme_firmware_switch() warn: missing break? reassigning 'st->dvb_usb_lme2510_firmware'
drivers/media/usb/dvb-usb-v2/lmedm04.c:850 lme_firmware_switch() warn: missing break? reassigning 'st->dvb_usb_lme2510_firmware'

using a different strategy to avoid reassign values to
st->dvb_usb_lme2510_firmware.

Acked-by: Malcolm Priestley <tvboxspy@gmail.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab@osg.samsung.com>
9 years ago[media] siano: unnecessary check before rc_unregister_device()
Markus Elfring [Mon, 24 Nov 2014 21:32:30 +0000 (18:32 -0300)]
[media] siano: unnecessary check before rc_unregister_device()

The rc_unregister_device() 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>
9 years ago[media] media: v4l2-image-sizes.h: add SVGA, XGA and UXGA size definitions
Josh Wu [Tue, 25 Nov 2014 08:54:27 +0000 (05:54 -0300)]
[media] media: v4l2-image-sizes.h: add SVGA, XGA and UXGA size definitions

Add SVGA, UXGA and XGA size definitions to v4l2-image-sizes.h.
The definitions are sorted by alphabet order.

Signed-off-by: Josh Wu <josh.wu@atmel.com>
Acked-by: Sylwester Nawrocki <s.nawrocki@samsung.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab@osg.samsung.com>
9 years ago[media] omap: Fix typo "HAS_MMU"
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>
9 years ago[media] media/au0828: Fix IR stop, poll to not access device during disconnect
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.

Signed-off-by: Shuah Khan <shuahkh@osg.samsung.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab@osg.samsung.com>
9 years ago[media] USB: Deletion of unnecessary checks before three function calls
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>
9 years ago[media] platform: Deletion of unnecessary checks before two function calls
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>
9 years ago[media] rc: Deletion of unnecessary checks before two function calls
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>
9 years ago[media] i2c: Deletion of an unnecessary check before the function call "rc_unregister...
Markus Elfring [Thu, 20 Nov 2014 10:13:16 +0000 (07:13 -0300)]
[media] i2c: Deletion of an unnecessary check before the function call "rc_unregister_device"

The rc_unregister_device() 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>
9 years ago[media] firewire: Deletion of an unnecessary check before the function call "dvb_unre...
Markus Elfring [Thu, 20 Nov 2014 09:49:07 +0000 (06:49 -0300)]
[media] firewire: Deletion of an unnecessary check before the function call "dvb_unregister_device"

The dvb_unregister_device() 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>
Reviewed-by: Stefan Richter <stefanr@s5r6.in-berlin.de>
Signed-off-by: Mauro Carvalho Chehab <mchehab@osg.samsung.com>
9 years ago[media] exynos4-is: fix error handling of irq_of_parse_and_map
Dmitry Torokhov [Fri, 14 Nov 2014 22:09:50 +0000 (19:09 -0300)]
[media] exynos4-is: fix error handling of irq_of_parse_and_map

Return value of irq_of_parse_and_map() is unsigned int, with 0
indicating failure, so testing for negative result never works.

Signed-off-by: Dmitry Torokhov <dtor@chromium.org>
Signed-off-by: Mauro Carvalho Chehab <mchehab@osg.samsung.com>
9 years ago[media] smipcie: add DVBSky T9580 V3 support
Nibble Max [Sat, 8 Nov 2014 11:35:20 +0000 (08:35 -0300)]
[media] smipcie: add DVBSky T9580 V3 support

v2:
- Update Kconfig file.

DVBSky T9580 V3 card is the dual tuner card, which supports S/S2 and T2/T/C.
1>DVB-S/S2 frontend: M88DS3103/M88TS2022
2>DVB-T2/T/C frontend: SI2168B40/SI2157A30
2>PCIe bridge: SMI PCIe

Signed-off-by: Nibble Max <nibble.max@gmail.com>
Reviewed-by: Antti Palosaari <crope@iki.fi>
Signed-off-by: Mauro Carvalho Chehab <mchehab@osg.samsung.com>
9 years ago[media] smipcie: use add_i2c_client and del_i2c_client functions
Nibble Max [Sat, 8 Nov 2014 11:35:08 +0000 (08:35 -0300)]
[media] smipcie: use add_i2c_client and del_i2c_client functions

v2:
-no change, just resend with other patches.

"add_i2c_client" and "del_i2c_client" functions make code shorter and easy to maintain.

Signed-off-by: Nibble Max <nibble.max@gmail.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab@osg.samsung.com>
9 years ago[media] dvb-usb-dvbsky: add T680CI dvb-t2/t/c usb ci box support
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>
9 years ago[media] si2168: One function call less in si2168_init() after error detection
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>
9 years ago[media] m88ds3103: One function call less in m88ds3103_init() after error detection
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>
9 years ago[media] DVB-frontends: Deletion of unnecessary checks before the function call "relea...
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>
9 years ago[media] lmed04: add missing breaks
Mauro Carvalho Chehab [Tue, 25 Nov 2014 11:17:13 +0000 (09:17 -0200)]
[media] lmed04: add missing breaks

drivers/media/usb/dvb-usb-v2/lmedm04.c:828 lme_firmware_switch() warn: missing break? reassigning 'st->dvb_usb_lme2510_firmware'
drivers/media/usb/dvb-usb-v2/lmedm04.c:849 lme_firmware_switch() warn: missing break? reassigning 'st->dvb_usb_lme2510_firmware'

Signed-off-by: Mauro Carvalho Chehab <mchehab@osg.samsung.com>
9 years ago[media] cxusb: Geniatech T230 support
CrazyCat [Fri, 14 Nov 2014 21:24:28 +0000 (18:24 -0300)]
[media] cxusb: Geniatech T230 support

Geniatech Mygica T230 DVB-T/T2/C USB stick support.

Signed-off-by: Evgeny Plehov <EvgenyPlehov@ukr.net>
Reviewed-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>
9 years ago[media] si2168: TS clock inversion control
CrazyCat [Fri, 14 Nov 2014 21:22:10 +0000 (18:22 -0300)]
[media] si2168: TS clock inversion control

TS clock polarity control implemented.

[Antti: Resolved simple conflict]

Signed-off-by: Evgeny Plehov <EvgenyPlehov@ukr.net>
Reviewed-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>
9 years ago[media] si2157: Si2148 support
CrazyCat [Fri, 14 Nov 2014 21:19:37 +0000 (18:19 -0300)]
[media] si2157: Si2148 support

Si2148-A20 silicon tuner support.

[Antti: Resolved conflict]

Signed-off-by: Evgeny Plehov <EvgenyPlehov@ukr.net>
Signed-off-by: Antti Palosaari <crope@iki.fi>
Signed-off-by: Mauro Carvalho Chehab <mchehab@osg.samsung.com>
9 years ago[media] si2157: make checkpatch.pl happy (remove break after goto)
Olli Salonen [Mon, 24 Nov 2014 06:57:35 +0000 (03:57 -0300)]
[media] si2157: make checkpatch.pl happy (remove break after goto)

Break after goto is unnecessary.

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>
9 years ago[media] em28xx: Add support for Terratec Cinergy T2 Stick HD
Olli Salonen [Mon, 24 Nov 2014 06:57:34 +0000 (03:57 -0300)]
[media] em28xx: Add support for Terratec Cinergy T2 Stick HD

Terratec Cinergy T2 Stick HD [eb1a:8179] is a USB DVB-T/T2/C tuner that
contains following components:

* Empia EM28178 USB bridge
* Silicon Labs Si2168-A30 demodulator
* Silicon Labs Si2146-A10 tuner

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>
9 years ago[media] si2157: Add support for Si2146-A10
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>
9 years ago[media] vb2: use dma_map_sg_attrs to prevent unnecessary sync
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.

Signed-off-by: Hans Verkuil <hans.verkuil@cisco.com>
Acked-by: Pawel Osciak <pawel@osciak.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab@osg.samsung.com>
9 years ago[media] vim2m: support expbuf
Hans Verkuil [Tue, 18 Nov 2014 12:51:07 +0000 (09:51 -0300)]
[media] vim2m: support expbuf

Signed-off-by: Hans Verkuil <hans.verkuil@cisco.com>
Reviewed-by: Pawel Osciak <pawel@osciak.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab@osg.samsung.com>
9 years ago[media] vivid: enable vb2_expbuf support
Hans Verkuil [Tue, 18 Nov 2014 12:51:06 +0000 (09:51 -0300)]
[media] vivid: enable vb2_expbuf support

Now that vb2 supports DMABUF export for dma-sg and vmalloc memory
modes, we can enable the vb2_expbuf support in vivid.

Signed-off-by: Hans Verkuil <hans.verkuil@cisco.com>
Reviewed-by: Pawel Osciak <pawel@osciak.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab@osg.samsung.com>
9 years ago[media] vb2-vmalloc: add support for dmabuf exports
Hans Verkuil [Tue, 18 Nov 2014 12:51:05 +0000 (09:51 -0300)]
[media] vb2-vmalloc: add support for dmabuf exports

Add support for DMABUF exporting to the vb2-vmalloc implementation.

All memory models now have support for both importing and exporting of DMABUFs.

Signed-off-by: Hans Verkuil <hansverk@cisco.com>
Acked-by: Pawel Osciak <pawel@osciak.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab@osg.samsung.com>
9 years ago[media] vb2-dma-sg: add support for dmabuf exports
Hans Verkuil [Tue, 18 Nov 2014 12:51:04 +0000 (09:51 -0300)]
[media] vb2-dma-sg: add support for dmabuf exports

Add DMABUF export support to vb2-dma-sg.

Signed-off-by: Hans Verkuil <hansverk@cisco.com>
Acked-by: Pawel Osciak <pawel@osciak.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab@osg.samsung.com>
9 years ago[media] vb2-dma-sg: add dmabuf import support
Hans Verkuil [Tue, 18 Nov 2014 12:51:03 +0000 (09:51 -0300)]
[media] vb2-dma-sg: add dmabuf import support

Add support for importing dmabuf to videobuf2-dma-sg.

Signed-off-by: Hans Verkuil <hans.verkuil@cisco.com>
Acked-by: Pawel Osciak <pawel@osciak.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab@osg.samsung.com>
9 years ago[media] vb2-dma-sg: move dma_(un)map_sg here
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']

Signed-off-by: Hans Verkuil <hans.verkuil@cisco.com>
Acked-by: Pawel Osciak <pawel@osciak.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab@osg.samsung.com>
9 years ago[media] vb2-dma-sg: add allocation context to dma-sg
Hans Verkuil [Tue, 18 Nov 2014 12:51:01 +0000 (09:51 -0300)]
[media] vb2-dma-sg: add allocation context to dma-sg

Require that dma-sg also uses an allocation context. This is in preparation
for adding prepare/finish memops to sync the memory between DMA and CPU.

Signed-off-by: Hans Verkuil <hans.verkuil@cisco.com>
Acked-by: Pawel Osciak <pawel@osciak.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab@osg.samsung.com>
9 years ago[media] vb2: don't free alloc context if it is ERR_PTR
Hans Verkuil [Tue, 18 Nov 2014 12:51:00 +0000 (09:51 -0300)]
[media] vb2: don't free alloc context if it is ERR_PTR

Don't try to free a pointer containing an ERR_PTR().

Signed-off-by: Hans Verkuil <hans.verkuil@cisco.com>
Acked-by: Pawel Osciak <pawel@osciak.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab@osg.samsung.com>
9 years ago[media] vb2: add dma_dir to the alloc memop
Hans Verkuil [Tue, 18 Nov 2014 12:50:59 +0000 (09:50 -0300)]
[media] vb2: add dma_dir to the alloc memop

This is needed for the next patch where the dma-sg alloc memop needs
to know the dma_dir.

Signed-off-by: Hans Verkuil <hans.verkuil@cisco.com>
Acked-by: Pawel Osciak <pawel@osciak.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab@osg.samsung.com>
9 years ago[media] vb2: replace 'write' by 'dma_dir'
Hans Verkuil [Tue, 18 Nov 2014 12:50:58 +0000 (09:50 -0300)]
[media] vb2: replace 'write' by 'dma_dir'

The 'write' argument is very ambiguous. I first assumed that if it is 1,
then we're doing video output but instead it meant the reverse.

Since it is used to setup the dma_dir value anyway it is now replaced by
the correct dma_dir value which is unambiguous.

Signed-off-by: Hans Verkuil <hans.verkuil@cisco.com>
Acked-by: Pawel Osciak <pawel@osciak.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab@osg.samsung.com>
9 years ago[media] videobuf2-core.h: improve documentation
Hans Verkuil [Tue, 18 Nov 2014 12:50:57 +0000 (09:50 -0300)]
[media] videobuf2-core.h: improve documentation

Document that drivers can access/modify the buffer contents in buf_prepare
and buf_finish. That was not clearly stated before.

Signed-off-by: Hans Verkuil <hans.verkuil@cisco.com>
Acked-by: Pawel Osciak <pawel@osciak.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab@osg.samsung.com>
9 years ago[media] uvcvideo: Return all buffers to vb2 at stream stop and start failure
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.

Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab@osg.samsung.com>
9 years ago[media] uvcvideo: Rename and split uvc_queue_enable to uvc_queue_stream(on|off)
Laurent Pinchart [Tue, 21 Oct 2014 19:19:04 +0000 (16:19 -0300)]
[media] uvcvideo: Rename and split uvc_queue_enable to uvc_queue_stream(on|off)

This brings the function name in line with the V4L2 API terminology and
allows removing the duplicate queue type check.

Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab@osg.samsung.com>
9 years ago[media] uvcvideo: Rename uvc_alloc_buffers to uvc_request_buffers
Laurent Pinchart [Tue, 21 Oct 2014 19:02:00 +0000 (16:02 -0300)]
[media] uvcvideo: Rename uvc_alloc_buffers to uvc_request_buffers

This brings the function name in line with the V4L2 API terminology.

Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab@osg.samsung.com>
9 years ago[media] uvcvideo: Don't stop the stream twice at file handle release
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.

Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab@osg.samsung.com>
9 years ago[media] uvcvideo: Implement vb2 queue start and stop stream operations
Laurent Pinchart [Tue, 21 Oct 2014 16:03:08 +0000 (13:03 -0300)]
[media] uvcvideo: Implement vb2 queue start and stop stream operations

To work propertly the videobuf2 core code needs to be in charge of
stream start/stop control. Implement the start_streaming and
stop_streaming vb2 operations and move video enable/disable code to
them.

Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab@osg.samsung.com>