Commit graph

23591 commits

Author SHA1 Message Date
Marek Szyprowski
003611334d [media] s5p-mfc: Add support for MFC v8 available in Exynos 5433 SoCs
Exynos5433 SoC has MFC v8 hardware module, but it has more
complex clock hierarchy, so a new compatible is added.

Signed-off-by: Marek Szyprowski <m.szyprowski@samsung.com>
Signed-off-by: Sylwester Nawrocki <s.nawrocki@samsung.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab@s-opensource.com>
2016-11-30 09:22:07 -02:00
Marek Szyprowski
1bce6fb3ed [media] s5p-mfc: Rework clock handling
This patch changes the code for handling clocks. Now clocks are defined
per each device variant, what is a preparation for adding support for
Exynos 5433 MFC V8, which has more clocks than all previous versions.
Also use devm_clk_get() to simplify cleanup path.

Signed-off-by: Marek Szyprowski <m.szyprowski@samsung.com>
Signed-off-by: Sylwester Nawrocki <s.nawrocki@samsung.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab@s-opensource.com>
2016-11-30 09:21:30 -02:00
Marek Szyprowski
741f4331d0 [media] s5p-mfc: Don't keep clock prepared all the time
This patch moves preparation of clocks from s5p_mfc_init_pm()
(driver probe) to s5p_mfc_power_on() (start of device operation).
This change will allow to use runtime power usage optimization
on newer Samsung Exynos platforms (for example Exynos 5433).

Signed-off-by: Marek Szyprowski <m.szyprowski@samsung.com>
Signed-off-by: Sylwester Nawrocki <s.nawrocki@samsung.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab@s-opensource.com>
2016-11-30 09:20:39 -02:00
Marek Szyprowski
387e08e202 [media] s5p-mfc: Kill all IS_ERR_OR_NULL in clocks management code
After commit "s5p-mfc: Fix clock management in s5p_mfc_release function"
all clocks related functions are called only when MFC device is really
available, so there is no additional check needed for NULL
gate clocks. This patch simplifies the code and kills IS_ERR_OR_NULL
macro usage.

Signed-off-by: Marek Szyprowski <m.szyprowski@samsung.com>
Signed-off-by: Sylwester Nawrocki <s.nawrocki@samsung.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab@s-opensource.com>
2016-11-30 09:20:00 -02:00
Marek Szyprowski
7e55a016fa [media] s5p-mfc: Remove dead conditional code
CONFIG_PM is always enabled on Exynos platforms, so remove dead code
related to early development of MFC driver on platform without PM support.

Signed-off-by: Marek Szyprowski <m.szyprowski@samsung.com>
Signed-off-by: Sylwester Nawrocki <s.nawrocki@samsung.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab@s-opensource.com>
2016-11-30 09:19:17 -02:00
Marek Szyprowski
8accb8fdf6 [media] s5p-mfc: Ensure that clock is disabled before turning power off
Move clock disabling before turning power off.  This will enable later
to add calls to clk_prepare/unprepare in the s5p_mfc_power_off() function
to avoid keeping clocks prepared all the time when driver is bound.

Signed-off-by: Marek Szyprowski <m.szyprowski@samsung.com>
Signed-off-by: Sylwester Nawrocki <s.nawrocki@samsung.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab@s-opensource.com>
2016-11-30 09:17:18 -02:00
Marek Szyprowski
2e4e084465 [media] s5p-mfc: Remove special clock rate management
The maximum rate of special clock depends on SoC variant and should
be set in device tree via assigned-clock-rates property, so remove
the code which forces special clock to 200MHz.

Signed-off-by: Marek Szyprowski <m.szyprowski@samsung.com>
Signed-off-by: Sylwester Nawrocki <s.nawrocki@samsung.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab@s-opensource.com>
2016-11-30 09:16:54 -02:00
Marek Szyprowski
0a79ef333d [media] s5p-mfc: Use printk_ratelimited for reporting ioctl errors
Some applications don't check error codes from QBUF/DQBUF ioctls,
so don't spam kernel log with errors if they fall into endless loop
trying to queue next buffer after a failure.

Signed-off-by: Marek Szyprowski <m.szyprowski@samsung.com>
Signed-off-by: Sylwester Nawrocki <s.nawrocki@samsung.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab@s-opensource.com>
2016-11-30 09:16:23 -02:00
Douglas Anderson
3605163d98 [media] s5p-mfc: Set DMA_ATTR_ALLOC_SINGLE_PAGES
We do video allocation all the time and we need it to be fast.  Plus TLB
efficiency isn't terribly important for video.

That means we want to set DMA_ATTR_ALLOC_SINGLE_PAGES.

See also the previous change (commit 14d3ae2efe "ARM: dma-mapping: Use
DMA_ATTR_ALLOC_SINGLE_PAGES hint to optimize allocation").

[m.szyprowski: rebased patch onto v4.9-rc1 and adapted changes
 to latest videbuf2 changes, this simplifies code changes to
 only set proper dma attribute flag and comment the reason
 for it, added commit id of arch/arm/mm patch]

Signed-off-by: Douglas Anderson <dianders@chromium.org>
Signed-off-by: Marek Szyprowski <m.szyprowski@samsung.com>
Signed-off-by: Sylwester Nawrocki <s.nawrocki@samsung.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab@s-opensource.com>
2016-11-30 09:15:45 -02:00
Ricardo Ribalda
a000f0d399 [media] vivid: Set color_enc on HSV formats
HSV formats were missing the color encoding, which leads to an invalid
ycbcr_enc value during get_fmt and try_fmt.

Signed-off-by: Ricardo Ribalda Delgado <ricardo.ribalda@gmail.com>
Signed-off-by: Hans Verkuil <hans.verkuil@cisco.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab@s-opensource.com>
2016-11-29 12:12:32 -02:00
Ricardo Ribalda
94868d612f [media] v4l2-tpg: Init hv_enc field with a valid value
Zero is not a valid value for hsv_enc. Set the field to a valid
initial value.

This is not a problem for vivid, because it sets the field to 180 via
tpg_s_hsv_enc() on the control initialization, but it might be a source
of errors for other drivers that use this code.

Signed-off-by: Ricardo Ribalda Delgado <ricardo.ribalda@gmail.com>
Signed-off-by: Hans Verkuil <hans.verkuil@cisco.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab@s-opensource.com>
2016-11-29 12:12:13 -02:00
Hans Verkuil
f51e80804f [media] cec: pass parent device in register(), not allocate()
The cec_allocate_adapter function doesn't need the parent device, only the
cec_register_adapter function needs it.

Drop the cec_devnode parent field, since devnode.dev.parent can be used
instead.

This change makes the framework consistent with other frameworks where the
parent device is not used until the device is registered.

Signed-off-by: Hans Verkuil <hans.verkuil@cisco.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab@s-opensource.com>
2016-11-29 12:07:17 -02:00
Dan Carpenter
cf2113ca56 [media] uvcvideo: freeing an error pointer
A recent cleanup introduced a potential dereference of -EFAULT when we
call kfree(map->menu_info).

Fixes: 4cc5bed1ca ("[media] uvcvideo: Use memdup_user() rather than duplicating its implementation")

Signed-off-by: Dan Carpenter <dan.carpenter@oracle.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab@s-opensource.com>
2016-11-29 12:05:00 -02:00
Greg Kroah-Hartman
0edbf9e552 Merge 4.9-rc7 into usb-next
We want the USB fixes in here as well.

Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2016-11-28 08:34:10 +01:00
David S. Miller
0b42f25d2f Merge git://git.kernel.org/pub/scm/linux/kernel/git/davem/net
udplite conflict is resolved by taking what 'net-next' did
which removed the backlog receive method assignment, since
it is no longer necessary.

Two entries were added to the non-priv ethtool operations
switch statement, one in 'net' and one in 'net-next, so
simple overlapping changes.

Signed-off-by: David S. Miller <davem@davemloft.net>
2016-11-26 23:42:21 -05:00
Arnd Bergmann
d3d83ee20a [media] DaVinci-VPFE-Capture: fix error handling
A recent cleanup had the right idea to remove the initialization
of the error variable, but missed the actual benefit of that,
which is that we get warnings if there is a bug in it. Now
we get a warning about a bug that was introduced by this cleanup:

drivers/media/platform/davinci/vpfe_capture.c: In function 'vpfe_probe':
drivers/media/platform/davinci/vpfe_capture.c:1992:9: error: 'ret' may be used uninitialized in this function [-Werror=maybe-uninitialized]

This adds the missing initialization that the warning is about,
and another one that was preexisting and that we did not get
a warning for. That second bug has existed since the driver
was first added.

Fixes: efb74461f5 ("[media] DaVinci-VPFE-Capture: Delete an unnecessary variable initialisation in vpfe_probe()")
Fixes: 7da8a6cb3e ("V4L/DVB (12248): v4l: vpfe capture bridge driver for DM355 and DM6446")

[mchehab@s-opensource.com: fix a merge conflict]
Signed-off-by: Arnd Bergmann <arnd@arndb.de>

Signed-off-by: Mauro Carvalho Chehab <mchehab@s-opensource.com>
2016-11-25 07:57:07 -02:00
Mauro Carvalho Chehab
399426cadf [media] cx88: make checkpatch.pl happy
Usually, I don't like fixing coding style issues on non-staging
drivers, as it could be a mess pretty easy, and could become like
a snow ball. That's the case of recent changes on two changesets:
they disalign some statements. Yet, a care a lot with cx88 driver,
as it was the first driver I touched at the Kernel, and I've been
maintaining it since 2005. So, several of the coding style issues
were due to my code.

Per Andrey's suggestion, I ran checkpatch.pl in strict mode, with
fixed several other issues, did some function alinments, but broke
other alinments.

So, I had to manually apply another round of manual fixes to make
sure that everything is ok, and to make checkpatch happy with
this patch.

With this patch, checkpatch.pl is now happy when called with:
	./scripts/checkpatch.pl -f --max-line-length=998 --ignore PREFER_PR_LEVEL

Also, the 80-cols violations that made sense were fixed.

Checkpatch would be happier if we convert it to use dev_foo(),
but this is a more complex change.

NOTE: there are some places with msleep(1). As this driver was
written at the time that the default was to sleep at least 10ms
on such calls (e. g. CONFIG_HZ=100), I replaced those calls by
usleep_range(10000, 20000), with should be safe to avoid breakages.

Fixes: 65bc2fe86e ("[media] cx88: convert it to use pr_foo() macros")
Fixes: 7b61ba8ff8 ("[media] cx88: make checkpatch happier")

Suggested-by: Andrey Utkin <andrey_utkin@fastmail.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab@s-opensource.com>
Reviewed-by: Andrey Utkin <andrey_utkin@fastmail.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab@s-opensource.com>
2016-11-25 07:50:20 -02:00
Arnd Bergmann
1d38971438 [media] v4l: rcar_fdp1: add FCP dependency
Commit 4710b752e0 ("[media] v4l: Add Renesas R-Car FDP1 Driver") in the
v4l-dvb tree adds CONFIG_VIDEO_RENESAS_FDP1.

It calls into the FCP driver, but when there is no dependency, FCP might
be a module while FDP1 is built-in.

We have the same logic in VIDEO_RENESAS_VSP1, which also depends on
FCP not being a module when it is built-in itself.

drivers/media/platform/rcar_fdp1.o: In function `fdp1_pm_runtime_resume':
rcar_fdp1.c:(.text.fdp1_pm_runtime_resume+0x78): undefined reference to `rcar_fcp_enable'
drivers/media/platform/rcar_fdp1.o: In function `fdp1_pm_runtime_suspend':
rcar_fdp1.c:(.text.fdp1_pm_runtime_suspend+0x14): undefined reference to `rcar_fcp_disable'
drivers/media/platform/rcar_fdp1.o: In function `fdp1_probe':
rcar_fdp1.c:(.text.fdp1_probe+0x15c): undefined reference to `rcar_fcp_get'

Signed-off-by: Arnd Bergmann <arnd@arndb.de>
Signed-off-by: Mauro Carvalho Chehab <mchehab@s-opensource.com>
2016-11-25 07:47:17 -02:00
Arnd Bergmann
fa4a2fd17d [media] v4l: rcar_fdp1: mark PM functions as __maybe_unused
The new driver produces a warning when CONFIG_PM is disabled:

platform/rcar_fdp1.c:2408:12: error: 'fdp1_pm_runtime_resume' defined but not used [-Werror=unused-function]
platform/rcar_fdp1.c:2399:12: error: 'fdp1_pm_runtime_suspend' defined but not used [-Werror=unused-function]

This marks the two functions as __maybe_unused.

Fixes: 4710b752e0 ("[media] v4l: Add Renesas R-Car FDP1 Driver")

Signed-off-by: Arnd Bergmann <arnd@arndb.de>
Signed-off-by: Mauro Carvalho Chehab <mchehab@s-opensource.com>
2016-11-25 07:45:27 -02:00
Shuah Khan
8c2ebcf103 [media] media: remove obsolete Media Device Managed resource interfaces
Remove obsolete media_device_get_devres(), media_device_find_devres(),
and media_device_release_devres() interfaces. These interfaces are now
obsolete.

Signed-off-by: Shuah Khan <shuahkh@osg.samsung.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab@s-opensource.com>
2016-11-25 07:40:40 -02:00
Mauro Carvalho Chehab
8b0041db80 [media] dvb-net: split the logic at dvb_net_ule() into other functions
This function is too big and too complex, making really hard
to understand what's there.

Split it into sub-routines, in order to make it easier to be
understood, and to allow gcc to better parse it.

As a bonus, it gets rid of a goto in the middle of a routine.

Signed-off-by: Mauro Carvalho Chehab <mchehab@s-opensource.com>
2016-11-25 06:45:14 -02:00
Mauro Carvalho Chehab
efb9ab6725 [media] dvb_net: prepare to split a very complex function
The dvb_net code has a really complex function, meant to handle
DVB network packages: it is long, has several loops and ifs
inside, and even cause warnings with gcc5.

Prepare it to be split into smaller functions by storing all
arguments and internal vars inside a struct.

Signed-off-by: Mauro Carvalho Chehab <mchehab@s-opensource.com>
2016-11-25 06:44:36 -02:00
Takashi Iwai
22a1e7783e xc2028: Fix use-after-free bug properly
The commit 8dfbcc4351 ("[media] xc2028: avoid use after free") tried
to address the reported use-after-free by clearing the reference.

However, it's clearing the wrong pointer; it sets NULL to
priv->ctrl.fname, but it's anyway overwritten by the next line
memcpy(&priv->ctrl, p, sizeof(priv->ctrl)).

OTOH, the actual code accessing the freed string is the strcmp() call
with priv->fname:
	if (!firmware_name[0] && p->fname &&
	    priv->fname && strcmp(p->fname, priv->fname))
		free_firmware(priv);

where priv->fname points to the previous file name, and this was
already freed by kfree().

For fixing the bug properly, this patch does the following:

- Keep the copy of firmware file name in only priv->fname,
  priv->ctrl.fname isn't changed;
- The allocation is done only when the firmware gets loaded;
- The kfree() is called in free_firmware() commonly

Fixes: commit 8dfbcc4351 ('[media] xc2028: avoid use after free')
Cc: <stable@vger.kernel.org>
Signed-off-by: Takashi Iwai <tiwai@suse.de>
Signed-off-by: Mauro Carvalho Chehab <mchehab@s-opensource.com>
2016-11-23 21:04:26 -02:00
Markus Elfring
4cc5bed1ca [media] uvcvideo: Use memdup_user() rather than duplicating its implementation
Reuse existing functionality from memdup_user() instead of keeping
duplicate source code.

This issue was detected by using the Coccinelle software.

Signed-off-by: Markus Elfring <elfring@users.sourceforge.net>
Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab@s-opensource.com>
2016-11-23 20:06:41 -02:00
Edgar Thier
eb165a20df [media] uvcvideo: Add bayer 16-bit format patterns
Those formats are implemented by The DFK 23UP1300, DFK 23UX249 and
DFK 23UX250 USB 3.0 industrial cameras from The Imaging Source.

Signed-off-by: Edgar Thier <info@edgarthier.net>
Acked-by: Sakari Ailus <sakari.ailus@linux.intel.com>
Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab@s-opensource.com>
2016-11-23 20:06:18 -02:00
Laurent Pinchart
5b382290ff [media] v4l: Add description of the Y8I, Y12I and Z16 formats
The formats have been added without a description, fix that.

Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab@s-opensource.com>
2016-11-23 20:04:43 -02:00
Sakari Ailus
b9a4b13c77 [media] v4l: Add 16-bit raw bayer pixel formats
The formats added by this patch are:

	V4L2_PIX_FMT_SBGGR16
	V4L2_PIX_FMT_SGBRG16
	V4L2_PIX_FMT_SGRBG16

V4L2_PIX_FMT_SRGGB16 already existed before the patch. Rework the
documentation to match that of the other sample depths.

Also align the description of V4L2_PIX_FMT_SRGGB16 to match with other
similar formats.

Signed-off-by: Sakari Ailus <sakari.ailus@linux.intel.com>
Acked-by: Lad, Prabhakar <prabhakar.csengg@gmail.com>
Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab@s-opensource.com>
2016-11-23 20:04:22 -02:00
Andrey Utkin
59eba2d1ec [media] saa7146: Fix for while releasing video buffers
Fix this bug:
	"[BUG] process stuck when closing saa7146 [dvb_ttpci]"

Release queued DMA buffers when ending streaming, so that
videobuf_waiton() doesn't block forever.

As reported, this fixes avoids occasional lockup of process reading from
video device, which manifests in such log:

INFO: task ffmpeg:9864 blocked for more than 120 seconds.
      Tainted: P           O    4.6.7 #3
"echo 0 > /proc/sys/kernel/hung_task_timeout_secs" disables this message.
ffmpeg          D ffff880177cc7b00     0  9864      1 0x00000000
 ffff880177cc7b00 0000000000000202 0000000000000202 ffffffff8180b4c0
 ffff88019d79e4c0 ffffffff81064050 ffff880177cc7ae0 ffff880177cc8000
 ffff880177cc7b18 ffff8801fd41d648 ffff8802307acca0 ffff8802307acc70
Call Trace:
 [<ffffffff81064050>] ? preempt_count_add+0x89/0xab
 [<ffffffff81477215>] schedule+0x86/0x9e
 [<ffffffff81477215>] ? schedule+0x86/0x9e
 [<ffffffffa0fe1c96>] videobuf_waiton+0x131/0x15e [videobuf_core]
 [<ffffffff8107727b>] ? wait_woken+0x6d/0x6d
 [<ffffffffa1017be9>] saa7146_dma_free+0x39/0x5b [saa7146_vv]
 [<ffffffffa10186c4>] buffer_release+0x2a/0x3e [saa7146_vv]
 [<ffffffffa0fee4a8>] videobuf_vm_close+0xd8/0x103 [videobuf_dma_sg]
 [<ffffffff8112049e>] remove_vma+0x25/0x4d
 [<ffffffff81121a32>] exit_mmap+0xce/0xf7
 [<ffffffff8104381d>] mmput+0x4e/0xe2
 [<ffffffff810491fd>] do_exit+0x372/0x920
 [<ffffffff81049813>] do_group_exit+0x3c/0x98
 [<ffffffff810522ef>] get_signal+0x4e8/0x56e
 [<ffffffff810710a5>] ? task_dead_fair+0xd/0xf
 [<ffffffff81017020>] do_signal+0x23/0x521
 [<ffffffff81479e82>] ? _raw_spin_unlock_irqrestore+0x13/0x25
 [<ffffffff8109710d>] ? hrtimer_try_to_cancel+0xd7/0x104
 [<ffffffff8109b306>] ? ktime_get+0x4c/0xa1
 [<ffffffff81096ea6>] ? update_rmtp+0x46/0x5b
 [<ffffffff81097ce0>] ? hrtimer_nanosleep+0xe4/0x10e
 [<ffffffff81096e3c>] ? hrtimer_init+0xeb/0xeb
 [<ffffffff810014f8>] exit_to_usermode_loop+0x4f/0x93
 [<ffffffff810019fe>] syscall_return_slowpath+0x3b/0x46
 [<ffffffff8147a355>] entry_SYSCALL_64_fastpath+0x8d/0x8f

Reported-by: Philipp Matthias Hahn <pmhahn+video@pmhahn.de>
Tested-by: Philipp Matthias Hahn <pmhahn+video@pmhahn.de>
Signed-off-by: Andrey Utkin <andrey_utkin@fastmail.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab@s-opensource.com>
2016-11-23 19:52:12 -02:00
Sean Young
e1159cb357 [media] mceusb: remove pointless mce_flush_rx_buffer function
This function just submits the urb much like mceusb_dev_resume; removing
it simplifies mce_request_packet.

Also add missing usb_kill_urb to mce_dev_probe.

Signed-off-by: Sean Young <sean@mess.org>
Signed-off-by: Mauro Carvalho Chehab <mchehab@s-opensource.com>
2016-11-23 13:49:36 -02:00
Sean Young
d26cec2268 [media] mceusb: remove useless debug message
Such debug message has a logic to track the IR status,
but it doesn't provide much info. So, get rid of it.

Signed-off-by: Sean Young <sean@mess.org>
Signed-off-by: Mauro Carvalho Chehab <mchehab@s-opensource.com>
2016-11-23 13:49:02 -02:00
Буди Романто, AreMa Inc
90866b3a80 [media] Raise adapter number limit
The current limit is too low for latest cards with 8+ tuners on a single slot.
IMHO, the most appropriate minimum default is 16.

Signed-off-by: Буди Романто, AreMa Inc <knightrider@are.ma>
Signed-off-by: Mauro Carvalho Chehab <mchehab@s-opensource.com>
2016-11-23 13:28:43 -02:00
Arnd Bergmann
190b23b4eb [media] em28xx: only use mt9v011 if camera support is enabled
In randconfig builds that select VIDEO_EM28XX_V4L2 and
MEDIA_SUBDRV_AUTOSELECT, but not MEDIA_CAMERA_SUPPORT, we get
a Kconfig warning:

 warning: (VIDEO_EM28XX_V4L2) selects VIDEO_MT9V011 which has unmet direct dependencies (MEDIA_SUPPORT && I2C && VIDEO_V4L2 && MEDIA_CAMERA_SUPPORT)

This avoids the warning by making that 'select' conditional on
MEDIA_CAMERA_SUPPORT. Alternatively we could mark EM28XX as
'depends on MEDIA_CAMERA_SUPPORT', but it does not seem to
have any real dependency on that itself.

Signed-off-by: Arnd Bergmann <arnd@arndb.de>
Signed-off-by: Mauro Carvalho Chehab <mchehab@s-opensource.com>
2016-11-23 13:17:25 -02:00
Arnd Bergmann
fa6317eedd [media] go7007: add MEDIA_CAMERA_SUPPORT dependency
If MEDIA_SUBDRV_AUTOSELECT and VIDEO_GO7007 are both set, we
automatically select VIDEO_OV7640, but that depends on MEDIA_CAMERA_SUPPORT,
so we get a Kconfig warning if that is disabled:

warning: (VIDEO_GO7007) selects VIDEO_OV7640 which has unmet direct dependencies (MEDIA_SUPPORT && I2C && VIDEO_V4L2 && MEDIA_CAMERA_SUPPORT)

This adds another dependency so we don't accidentally select
it when it is unavailable.

Signed-off-by: Arnd Bergmann <arnd@arndb.de>
Signed-off-by: Mauro Carvalho Chehab <mchehab@s-opensource.com>
2016-11-23 13:15:02 -02:00
Arnd Bergmann
a19e160d10 [media] dvb: remove unused systime() function
The systime function uses struct timespec, which we want to stop
using in the kernel because it overflows in 2038. Fortunately,
this use in dibx000_common is in a function that is never called,
so we can just remove it.

Signed-off-by: Arnd Bergmann <arnd@arndb.de>
Signed-off-by: Mauro Carvalho Chehab <mchehab@s-opensource.com>
2016-11-23 12:58:10 -02:00
Joerg Riechardt
386701892b [media] stv090x: use lookup tables for carrier/noise ratio
The stv090x driver uses the lookup table for signal strength already,
with this patch we use the lookup tables for carrier/noise ratio as well.
This has the advantage, that values for DVB-S and DVB-S2 are now
corresponding, while before they were way off. The values are now
proportional to real carrier/noise ratio, while before they were
corresponding to register values. So now applications are able to give
the user real carrier/noise ratio.

Because the output has to be within 0x0000...0xFFFF the three negative
values for DVB-S2 are omitted. This is no significant loss, because
reception is lost at 7.5 dB already (TT S2-1600, Cine S2), so the
negative values are not really important, and also for DVB-S they don´t
exist.

Signed-off-by: Joerg Riechardt <j.riechardt@gmx.de>
Signed-off-by: Mauro Carvalho Chehab <mchehab@s-opensource.com>
2016-11-23 12:41:49 -02:00
Geliang Tang
8ccd22db92 [media] netup_unidvb: use module_pci_driver
Use module_pci_driver() helper to simplify the code.

Signed-off-by: Geliang Tang <geliangtang@gmail.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab@s-opensource.com>
2016-11-22 16:30:03 -02:00
Dan Carpenter
d08876f524 [media] stk-webcam: fix an endian bug in stk_camera_read_reg()
We pass an int pointer to stk_camera_read_reg() but only write to the
highest byte.  It's a bug on big endian systems and generally a nasty
thing to do and doesn't match the write function either.

Signed-off-by: Dan Carpenter <dan.carpenter@oracle.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab@s-opensource.com>
2016-11-22 16:29:01 -02:00
Ruqiang Ju
414e72c729 [media] ir-hix5hd2: make hisilicon,power-syscon property deprecated
The clock of IR can be provided by the clock provider and controlled
by common clock framework APIs.

Signed-off-by: Ruqiang Ju <juruqiang@huawei.com>
Signed-off-by: Jiancheng Xue <xuejiancheng@hisilicon.com>
Acked-by: Rob Herring <robh@kernel.org>
Signed-off-by: Mauro Carvalho Chehab <mchehab@s-opensource.com>
2016-11-22 16:20:31 -02:00
Antti Palosaari
69ace6ee3e [media] mn88473: refactor and fix statistics
Remove DVB-T2 BER as it does not work at all and I didn't find
how to fix.

Fix DVB-T and DVB-C BER. It seems to return new some realistic
looking values.

Use (1 << 24) base for CNR calculations to keep it in line with
dvb logarithm functions.

Move all statistic logic to mn88473_read_status() function.

Use regmap_bulk_read() for reading multiple registers as a one go.

Many more and less minor changes.

Cc: Martin Blumenstingl <martin.blumenstingl@googlemail.com>
Signed-off-by: Antti Palosaari <crope@iki.fi>
Signed-off-by: Mauro Carvalho Chehab <mchehab@s-opensource.com>
2016-11-22 16:04:30 -02:00
Martin Blumenstingl
61393b0732 [media] mn88473: add DVBv5 statistics support
Implement DVBv5 statistics support for DVB-T, DVB-T2 and DVB-C. All
information was taken from the LinuxTV wiki, where Benjamin Larsson has
documented all registers:
https://www.linuxtv.org/wiki/index.php/Panasonic_MN88472

Signed-off-by: Martin Blumenstingl <martin.blumenstingl@googlemail.com>
Signed-off-by: Antti Palosaari <crope@iki.fi>
Signed-off-by: Mauro Carvalho Chehab <mchehab@s-opensource.com>
2016-11-22 16:00:26 -02:00
Sean Young
2bfc04d64d [media] sanyo decoder: address was being truncated
The address is 13 bits but it was stuffed in an u8, so 5 bits are
missing from the scancode.

Signed-off-by: Sean Young <sean@mess.org>
Signed-off-by: Mauro Carvalho Chehab <mchehab@s-opensource.com>
2016-11-22 10:34:55 -02:00
Sakari Ailus
a56bc17159 [media] v4l: compat: Prevent allocating excessive amounts of memory
get_v4l2_ext_controls32() is used to convert the 32-bit compat struct into
native 64-bit representation. The function multiplies the array length by
the entry length before validating size. Perform the size validation
first.

Also use unsigned values for size computation.

Make similar changes to get_v4l2_buffer32() for multi-plane buffers.

Signed-off-by: Sakari Ailus <sakari.ailus@linux.intel.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab@s-opensource.com>
2016-11-22 10:31:23 -02:00
Mauro Carvalho Chehab
af93189d4e [media] ti-vpe: get rid of some smatch warnings
When compiled on i386, it produces several warnings:

	./arch/x86/include/asm/bitops.h:457:22: warning: asm output is not an lvalue
	./arch/x86/include/asm/bitops.h:457:22: warning: asm output is not an lvalue
	./arch/x86/include/asm/bitops.h:457:22: warning: asm output is not an lvalue
	./arch/x86/include/asm/bitops.h:457:22: warning: asm output is not an lvalue
	./arch/x86/include/asm/bitops.h:457:22: warning: asm output is not an lvalue
	./arch/x86/include/asm/bitops.h:457:22: warning: asm output is not an lvalue

I suspect that some gcc optimization could be causing the asm code to be
incorrectly generated. Splitting it into two macro calls fix the issues
and gets us rid of 6 smatch warnings, with is a good thing. As it should
not cause any troubles, as we're basically doing the same thing, let's
apply such change to vpe.c.

Cc: Benoit Parrot <bparrot@ti.com>
Cc: Hans Verkuil <hans.verkuil@cisco.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab@s-opensource.com>
2016-11-22 09:08:36 -02:00
Mauro Carvalho Chehab
427da406bc [media] vpdma: remove vpdma_enable_list_notify_irq()
Despite being exported, there's no prototype for it at the
headers, as warned by sparse:

Fixes this sparse warning:
	drivers/media/platform/ti-vpe/vpdma.c:1000:6: warning: no previous prototype for 'vpdma_enable_list_notify_irq' [-Wmissing-prototypes]
	 void vpdma_enable_list_notify_irq(struct vpdma_data *vpdma, int irq_num,
	      ^~~~~~~~~~~~~~~~~~~~~~~~~~~~

Worse than that, it is not even used, as making it static it
would produce:

	drivers/media/platform/ti-vpe/vpdma.c:1000:13: warning: 'vpdma_enable_list_notify_irq' defined but not used [-Wunused-function]
	 static void vpdma_enable_list_notify_irq(struct vpdma_data *vpdma, int irq_num,
	             ^~~~~~~~~~~~~~~~~~~~~~~~~~~~

So, let's just get rid of the dead code. If needed in the future,
someone could re-add it.

Cc: Benoit Parrot <bparrot@ti.com>
Cc: Hans Verkuil <hans.verkuil@cisco.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab@s-opensource.com>
2016-11-22 09:05:16 -02:00
Hans Verkuil
1827bdc7b1 [media] vpfe_capture: fix compiler warning
davinci/vpfe_capture.c: In function 'vpfe_probe':
davinci/vpfe_capture.c:1992:9: warning: 'ret' may be used uninitialized
in this function [-Wmaybe-uninitialized]
   return ret;
          ^~~

This is indeed correct, so if the kmalloc fails set ret to -ENOMEM.

Signed-off-by: Hans Verkuil <hans.verkuil@cisco.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab@s-opensource.com>
2016-11-22 08:13:24 -02:00
Benoit Parrot
ed1f47cc69 [media] media: ti-vpe: vpe: Add proper support single and multi-plane buffer
The VPE was restricting the number of plane per buffer based on
the fact that if a particular format had color separation it was
meant to need 2 planes.

However NV12/NV16 are color separate format which are meant to be
presented in a single contiguous buffer/plane.
It could also be presented in a multi-plane as well if need be.
So we must support both modes for more flexibility.

The number of plane requested by user space was previously ignored
and was therefore always overwritten.
The driver now use the requested num plane as hint to calculate needed
offset when required.

Signed-off-by: Benoit Parrot <bparrot@ti.com>
Signed-off-by: Hans Verkuil <hans.verkuil@cisco.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab@s-opensource.com>
2016-11-22 08:13:00 -02:00
Benoit Parrot
3ce0f30f8e [media] media: ti-vpe: csc: Add debug support for multi-instance
Since there might be more then one instance it is better to
show the base address when dumping registers to help
with debugging.

Signed-off-by: Benoit Parrot <bparrot@ti.com>
Signed-off-by: Hans Verkuil <hans.verkuil@cisco.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab@s-opensource.com>
2016-11-22 08:12:24 -02:00
Benoit Parrot
51b56c3941 [media] media: ti-vpe: Make colorspace converter library into its own module
In preparation to add colorspace conversion support to VIP,
we need to turn csc.c into its own kernel module.

Signed-off-by: Benoit Parrot <bparrot@ti.com>
Signed-off-by: Hans Verkuil <hans.verkuil@cisco.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab@s-opensource.com>
2016-11-22 08:11:25 -02:00
Benoit Parrot
ee1c02949d [media] media: ti-vpe: vpdma: Add RAW8 and RAW16 data types
Add RAW8 and RAW16 data type to VPDMA.
To handle RAW format we are re-using the YUV CBY422
vpdma data type so that we use the vpdma to re-order
the incoming bytes, as the VIP parser assumes that the
first byte presented on the bus is the MSB of a 2
bytes value.

RAW8 handles from 1 to 8 bits.
RAW16 handles from 9 to 16 bits.

Signed-off-by: Benoit Parrot <bparrot@ti.com>
Signed-off-by: Hans Verkuil <hans.verkuil@cisco.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab@s-opensource.com>
2016-11-22 08:10:49 -02:00
Benoit Parrot
35be6d865c [media] media: ti-vpe: vpe: Make sure frame size dont exceed scaler capacity
When scaler is to be used we need to make sure that the input and
output frame size do not exceed the maximum frame sizes that the
scaler h/w can handle otherwise streaming stall as the scaler
cannot proceed.

The scaler buffer is limited to 2047 pixels (i.e. 11 bits) when
attempting anything larger (2048 for example) the scaler stalls.

Realistically in an mem2mem device we can only check for this type
of issue when start_streaming is called. We can't do it during the
try_fmt/s_fmt because we do not have all of the info needed at that
point. So instead when start_streaming is called we need to check
that the input and output frames size do not exceed the scaler's
capability. The only time larger frame size are allowed is when
the input frame szie is the same as the output frame size.

Now in the case where we need to fail, start_streaming must return
all previously queued buffer back otherwise the vb2 framework
will issue kernel WARN messages.
In this case we also give an error message.

Signed-off-by: Benoit Parrot <bparrot@ti.com>
Signed-off-by: Hans Verkuil <hans.verkuil@cisco.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab@s-opensource.com>
2016-11-22 08:10:14 -02:00
Benoit Parrot
d6a6178773 [media] media: ti-vpe: scaler: Add debug support for multi-instance
Since there might be more then one instance it is better to
show the base address when dumping registers to help
with debugging.

Signed-off-by: Benoit Parrot <bparrot@ti.com>
Signed-off-by: Hans Verkuil <hans.verkuil@cisco.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab@s-opensource.com>
2016-11-22 08:09:33 -02:00
Benoit Parrot
1c6e81783c [media] media: ti-vpe: Make scaler library into its own module
In preparation to add scaler support into VIP we need to
turn sc.c into its own kernel module.

Add support for multiple SC memory block as VIP contains
2 scaler instances.
This is done by passing the resource name to sc_create() and
modify the vpe invocation accordingly.

Signed-off-by: Benoit Parrot <bparrot@ti.com>
Signed-off-by: Hans Verkuil <hans.verkuil@cisco.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab@s-opensource.com>
2016-11-22 08:09:10 -02:00
Benoit Parrot
b8b3ac44dd [media] media: ti-vpe: vpe: Enable DMABUF export
Allow VPE to be able to export DMA buffer.

Signed-off-by: Benoit Parrot <bparrot@ti.com>
Signed-off-by: Hans Verkuil <hans.verkuil@cisco.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab@s-opensource.com>
2016-11-22 08:08:37 -02:00
Nikhil Devshatwar
00db969964 [media] media: ti-vpe: vpe: Fix line stride for output motion vector
For deinterlacing operation, VPE hardware uses motion vectors.
MV calculated in the previous iteration are used for next interation.
Therefore driver allocates two motion vectors in ping-pong fashion.

For every transaction, one MV is DMAed in and one is DMAed out.
All the outbound DMAs (DMA to memory) use output parameters, but as
the motion vectors is generated purely out of input fields, it should
use the input parameters for DMA.

Fix the add_out_dtd to use source q_data for creating descriptor.
If the output size is greater than input stride, without this change,
MV DMA may overwrite the buffer causing memory corruption.

This CRITICAL fix ensures that the motion vector DMA descriptor is
created based on the attributes with which the buffer was allocated.

Signed-off-by: Nikhil Devshatwar <nikhil.nd@ti.com>
Signed-off-by: Ravikumar Kattekola <rk@ti.com>
Signed-off-by: Ravi Babu <ravibabu@ti.com>
Signed-off-by: Benoit Parrot <bparrot@ti.com>
Signed-off-by: Hans Verkuil <hans.verkuil@cisco.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab@s-opensource.com>
2016-11-22 08:08:17 -02:00
Nikhil Devshatwar
07e72eb072 [media] media: ti-vpe: vpdma: Use bidirectional cached buffers
VPDMA buffer will be used by CPU as well as by the VPDMA.
CPU will write/update the VPDMA descriptors containing data
about the video buffer DMA addresses.
VPDMA will write the "write descriptor" containing the
data about the DMA operation.

When mapping/unmapping the buffer, driver has to take care of
WriteBack and invalidation of the cache so that all the
coherency is maintained from both directions.

Use DMA_BIDIRECTIONAL to maintain coherency between CPU and VPDMA.

Signed-off-by: Nikhil Devshatwar <nikhil.nd@ti.com>
Signed-off-by: Benoit Parrot <bparrot@ti.com>
Signed-off-by: Hans Verkuil <hans.verkuil@cisco.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab@s-opensource.com>
2016-11-22 08:07:53 -02:00
Nikhil Devshatwar
c786595beb [media] media: ti-vpe: vpdma: Fix race condition for firmware loading
vpdma_create API is supposed to allocated the struct vpdma_data and
return it to the driver. Also, it would call the callback function
when the VPDMA firmware is loaded.

Typically, VPE driver have following function call:
    dev->vpdma = vpdma_create(pdev, firmware_load_callback);
And the callback implementation would continue the probe further.
Also, the dev->vpdma is accessed from the callback implementation.

This may lead to race condition between assignment of dev->vpdma
and the callback function being triggered.
This would lead to kernel crash because of NULL pointer access.

Fix this by passing a driver wrapped &vpdma_data instead of allocating
inside vpdma_create.
Change the vpdma_create prototype accordingly and fix return paths.

Also, update the VPE driver to use the updated API and
initialize the dev->vpdma before hand so that the race condition
is avoided.

Signed-off-by: Nikhil Devshatwar <nikhil.nd@ti.com>
Signed-off-by: Benoit Parrot <bparrot@ti.com>
Signed-off-by: Hans Verkuil <hans.verkuil@cisco.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab@s-opensource.com>
2016-11-22 08:07:28 -02:00
Benoit Parrot
dfe1349dc8 [media] media: ti-vpe: vpe: Fix vb2 buffer cleanup
When stop_streaming is called we need to cleanup the queued
vb2 buffers properly.
This was not previously being done which caused kernel
warning when the application using the resources was killed.
Kernel warnings were also generated on successful completion
of a de-interlacing case as well as upon aborting a
conversion.

Make sure every vb2 buffers is properly handled in all cases.

Signed-off-by: Benoit Parrot <bparrot@ti.com>
Signed-off-by: Hans Verkuil <hans.verkuil@cisco.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab@s-opensource.com>
2016-11-22 08:07:01 -02:00
Nikhil Devshatwar
bc809bfc17 [media] media: ti-vpe: sc: Fix incorrect optimization
Current scaler library implementation of sc_set_hs_coeffs and
sc_set_vs_coeffs tries to return immediately if the calculated
coefficient index is already being used.

As the same scaler block is going to be used for all the VPE contexts,
even if the calculated index is same, the parameters have to be
reconfigured for each of the context.

Because of this, when multiple contexts use the same coefficients,
all other contexts would have zero scaling coefficients.
Fix this and also remove the unnecessary hs_index and vs_index fields.

Signed-off-by: Nikhil Devshatwar <nikhil.nd@ti.com>
Signed-off-by: Benoit Parrot <bparrot@ti.com>
Signed-off-by: Hans Verkuil <hans.verkuil@cisco.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab@s-opensource.com>
2016-11-22 08:06:27 -02:00
Benoit Parrot
3d7e61f6e2 [media] media: ti-vpe: vpdma: RGB data type yield inverted data
The VPDMA RGB data type definition have been updated
to match with Errata i839.

But some of the ARGB definition appeared to be wrong
in the document also. As they would yield RGBA instead.
They have been corrected based on experimentation.

Signed-off-by: Benoit Parrot <bparrot@ti.com>
Signed-off-by: Hans Verkuil <hans.verkuil@cisco.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab@s-opensource.com>
2016-11-22 08:05:59 -02:00
Benoit Parrot
eaa6808d1d [media] media: ti-vpe: vpdma: Corrected YUV422 data type label
The YUV data type definition below are taken from
both the TRM and i839 Errata information.
Use the correct data type considering byte
reordering of components.

Added the 2 missing YUV422 variant.
Also since the single use of "C" in the 422 case
to mean "Cr" (i.e. V component). It was decided
to explicitly label them CR to remove any confusion.
Bear in mind that the type label refer to the memory
packed order (LSB - MSB).

Signed-off-by: Benoit Parrot <bparrot@ti.com>
Signed-off-by: Hans Verkuil <hans.verkuil@cisco.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab@s-opensource.com>
2016-11-22 08:05:26 -02:00
Benoit Parrot
e228467caa [media] media: ti-vpe: vpe: Added MODULE_DEVICE_TABLE hint
ti_vpe module currently does not get loaded automatically.
Added MODULE_DEVICE_TABLE hint to the driver to assist.

Signed-off-by: Benoit Parrot <bparrot@ti.com>
Reviewed-by: Javier Martinez Canillas <javier@osg.samsung.com>
Signed-off-by: Hans Verkuil <hans.verkuil@cisco.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab@s-opensource.com>
2016-11-22 08:02:42 -02:00
Nikhil Devshatwar
c1cd15ea42 [media] media: ti-vpe: vpdma: allocate and maintain hwlist
VPDMA block used in ti-vip and ti-vpe modules have support for
up to 8 hardware descriptor lists. A descriptor list can be
submitted to any of the 8 lists (as long as it's not busy).

When multiple clients want to transfer data in parallel, its easier
to allocate one list per client and let it use it. This way, the
list numbers need not be hard-coded into the driver.

Add support for allocating hwlist and maintain them with a priv data.

Signed-off-by: Nikhil Devshatwar <nikhil.nd@ti.com>
Signed-off-by: Benoit Parrot <bparrot@ti.com>
Signed-off-by: Hans Verkuil <hans.verkuil@cisco.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab@s-opensource.com>
2016-11-22 08:02:21 -02:00
Nikhil Devshatwar
b28b8f1d7f [media] media: ti-vpe: vpe: Add RGB565 and RGB5551 support
VPE hardware can generate output in RGB565 or in RGB5551 format.
Add these formats in the supported format list for CAPTURE stream.
Also, for RGB5551 format, the alpha component is not processed,
so the alpha value is taken from the default color.
Set the default color to make alpha component full when the dst
format is of RGB color space.

Signed-off-by: Nikhil Devshatwar <nikhil.nd@ti.com>
Signed-off-by: Benoit Parrot <bparrot@ti.com>
Signed-off-by: Hans Verkuil <hans.verkuil@cisco.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab@s-opensource.com>
2016-11-22 08:01:10 -02:00
Nikhil Devshatwar
5b6179570f [media] media: ti-vpe: vpe: Post next descriptor only for list complete IRQ
vpe_irq checks for the possible interrupt sources and prints the
errors for the DEI_ERROR and DS_UV interrupts. But it also post the
next descriptor list irrespective of whichever interrupt has occurred.

Because of this, driver may release the buffers even before DMA is
complete and also schedule next descriptor list.

Fix this by _actually_ handling the IRQ only when ListComplete IRQ
occurs.

Signed-off-by: Nikhil Devshatwar <nikhil.nd@ti.com>
Signed-off-by: Benoit Parrot <bparrot@ti.com>
Signed-off-by: Hans Verkuil <hans.verkuil@cisco.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab@s-opensource.com>
2016-11-22 08:00:30 -02:00
Nikhil Devshatwar
0f469c1acf [media] media: ti-vpe: vpe: Setup srcdst parameters in start_streaming
For deinterlacing operation, each operation needs 2 fields in the
history. This is achieved by holding three buffers in
ctx->src_vbs[0,1,2] (f,f-1,f-2)

This is achieved by using the ctx->sequence which gets reset via the
s_fmt ioctl.

These buffers are dequeued in stream OFF by calling free_vbs()
But the corresponding references aren't removed anywhere.

When application tries to stream ON and OFF continuously, s_fmt ioctl
won't be called and it won't setup the srcdst parameters.

Setting source/destination parameters in stream ON ioctl would make
sure that the context is re-initialized before it is being used by
the driver.

Signed-off-by: Nikhil Devshatwar <nikhil.nd@ti.com>
Signed-off-by: Benoit Parrot <bparrot@ti.com>
Signed-off-by: Hans Verkuil <hans.verkuil@cisco.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab@s-opensource.com>
2016-11-22 07:59:59 -02:00
Nikhil Devshatwar
655e465671 [media] media: ti-vpe: vpe: configure line mode separately
Current driver configures the line mode of the DEI clients
from the open function directly. Even if the newly created context
is not yet scheduled, it updates some of the VPDMA registers.
This causes a problem in multi instance use case where just opening
the m2m device second time causes the running job to stall. This
happens especially if the source buffers used are NV12.

While all other configuration is being written to context specific
shadow registers, only line mode configuration is happening directly.

As there is no shadow register for line mode configuration, it's better
to separate the config_mode setting and line_mode setting. Call the
new "set_line_modes" functions only when actually loading the mmrs.
This makes sure that no non-running job will write to the registers
directly.

Signed-off-by: Nikhil Devshatwar <nikhil.nd@ti.com>
Signed-off-by: Benoit Parrot <bparrot@ti.com>
Signed-off-by: Hans Verkuil <hans.verkuil@cisco.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab@s-opensource.com>
2016-11-22 07:56:02 -02:00
Nikhil Devshatwar
afbc0ae9a4 [media] media: ti-vpe: vpdma: Clear IRQs for individual lists
VPDMA IRQs are registered for multiple lists
When clearing an IRQ for a list interrupt, all the
IRQs for the individual lists are to be cleared separately.

Signed-off-by: Nikhil Devshatwar <nikhil.nd@ti.com>
Signed-off-by: Benoit Parrot <bparrot@ti.com>
Signed-off-by: Hans Verkuil <hans.verkuil@cisco.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab@s-opensource.com>
2016-11-22 07:49:55 -02:00
Nikhil Devshatwar
4e4676d250 [media] media: ti-vpe: vpdma: Make list post atomic operation
Writing to the "VPDMA list attribute" register is considered as a list
post. This informs the VPDMA firmware to load the list from the address
which should be taken from the "VPDMA list address" register.

As these two register writes are dependent, it is important that the two
writes happen in atomic manner. This ensures multiple slices (which share
same VPDMA) can post lists asynchronously and all of them point to the
correct addresses.

Slightly modified to implementation for the original patch to use
spin_lock instead of mutex as the list post is also called from
interrupt context.

Signed-off-by: Nikhil Devshatwar <nikhil.nd@ti.com>
Signed-off-by: Benoit Parrot <bparrot@ti.com>
Signed-off-by: Hans Verkuil <hans.verkuil@cisco.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab@s-opensource.com>
2016-11-22 07:49:16 -02:00
Nikhil Devshatwar
dc12b12435 [media] media: ti-vpe: vpdma: Add abort channel desc and cleanup APIs
Whenever VPDMA processes a data descriptor of a list, it processes it
and sets up the channel for the DMA transaction. List manager holds the
descriptor in the list until the DMA is complete. If sync_on_channel
descriptor, or another descriptor for the same channel is present in
the FIFO, list manager keeps them until the current channel is free.

When the capture stream is closed suddenly while there are pending
descriptors in the FIFO (streamON failed, application killed), it would
keep the VPDMA in a busy state. Any further list post would fail with
EBUSY.

To avoid this, drivers need to stop the current processing list and
cleanup all the resources VPDMA has taken and also clear the internal FSM
of list manager. The state machine is cleared by issuing channel specific
abort descriptor.

Therefore, the vpdma_list_cleanup accepts an array of channels for which
abort_channel descriptors should be posted. It is driver's responsibility
to post for all the channels or the channels which were used in the last
context.

Signed-off-by: Nikhil Devshatwar <nikhil.nd@ti.com>
Signed-off-by: Benoit Parrot <bparrot@ti.com>
Signed-off-by: Hans Verkuil <hans.verkuil@cisco.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab@s-opensource.com>
2016-11-22 07:20:08 -02:00
Nikhil Devshatwar
634271f8f6 [media] media: ti-vpe: vpdma: Add support for setting max width height
Add a helper function to be able to set the maximum
VPDMA transfer size to limit potential buffer overrun.

Added enums for max_width and max_height fields of the
outbound data descriptor.

Changed vpdma_add_out_dtd to accept two more arguments
for max width and height.

Make use of different max width & height sets for different
of capture module (i.e. slices).

Signed-off-by: Nikhil Devshatwar <nikhil.nd@ti.com>
Signed-off-by: Benoit Parrot <bparrot@ti.com>
Signed-off-by: Hans Verkuil <hans.verkuil@cisco.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab@s-opensource.com>
2016-11-22 07:10:49 -02:00
Harinarayan Bhatta
f43aa420a8 [media] media: ti-vpe: Free vpdma buffers in vpe_release
Free vpdma buffers in vpe_release. Otherwise it was generating random
backtrace.

Signed-off-by: Harinarayan Bhatta <harinarayan@ti.com>
Signed-off-by: Somnath Mukherjee <somnath@ti.com>
Signed-off-by: Nikhil Devshatwar <nikhil.nd@ti.com>
Signed-off-by: Benoit Parrot <bparrot@ti.com>
Signed-off-by: Hans Verkuil <hans.verkuil@cisco.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab@s-opensource.com>
2016-11-22 07:04:20 -02:00
Nikhil Devshatwar
072915b57a [media] media: ti-vpe: vpe: Return NULL for invalid buffer type
get_q_data can be called with different values for type
e.g. vpe_try_crop calls it with the buffer type which gets passed
from user space

Framework doesn't check wheather its correct type or not
If user space passes wrong type, kernel should not crash.
Return NULL when the passed type is invalid.

Signed-off-by: Nikhil Devshatwar <nikhil.nd@ti.com>
Signed-off-by: Benoit Parrot <bparrot@ti.com>
Signed-off-by: Hans Verkuil <hans.verkuil@cisco.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab@s-opensource.com>
2016-11-22 07:03:34 -02:00
Harinarayan Bhatta
8028bfed42 [media] media: ti-vpe: Increasing max buffer height and width
Increasing max buffer height and width to allow for padded buffers.

Signed-off-by: Harinarayan Bhatta <harinarayan@ti.com>
Signed-off-by: Nikhil Devshatwar <nikhil.nd@ti.com>
Signed-off-by: Benoit Parrot <bparrot@ti.com>
Signed-off-by: Hans Verkuil <hans.verkuil@cisco.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab@s-opensource.com>
2016-11-22 07:03:13 -02:00
Nikhil Devshatwar
823f4208b2 [media] media: ti-vpe: Add support for SEQ_TB buffers
The video source can generate the data in the SEQ_TB buffer format.
In the case of TI SoC, the IVA_HD can generate the interlaced content in
the SEQ_TB buffer format. This is the format where the top and bottom field
data can be contained in a single buffer. For example, for NV12, interlaced
format, the data in Y buffer will be arranged as Y-top followed by
Y-bottom. And likewise for UV plane.

Also, queuing one buffer of SEQ_TB is equivalent to queuing two different
buffers for top and bottom fields. Driver needs to take care of this when
handling source buffer lists.

Signed-off-by: Nikhil Devshatwar <nikhil.nd@ti.com>
Signed-off-by: Benoit Parrot <bparrot@ti.com>
Signed-off-by: Hans Verkuil <hans.verkuil@cisco.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab@s-opensource.com>
2016-11-22 07:02:43 -02:00
Nikhil Devshatwar
5dc07f20b6 [media] media: ti-vpe: vpe: Do not perform job transaction atomically
Current VPE driver does not start the job until all the buffers for
a transaction are queued. When running in multiple context, this might
increase the processing latency.

Alternate solution would be to try to continue the same context as long as
buffers for the transaction are ready; else switch the context. This may
increase number of context switches but it reduces latency significantly.

In this approach, the job_ready always succeeds as long as there are
buffers on the CAPTURE and OUTPUT stream. Processing may start immediately
as the first 2 iterations don't need extra source buffers. Shift all the
source buffers after each iteration and remove the oldest buffer.

Also, with this removes the constraint of pre buffering 3 buffers before
call to STREAMON in case of de-interlacing.

Signed-off-by: Nikhil Devshatwar <nikhil.nd@ti.com>
Signed-off-by: Benoit Parrot <bparrot@ti.com>
Signed-off-by: Hans Verkuil <hans.verkuil@cisco.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab@s-opensource.com>
2016-11-22 06:58:17 -02:00
Archit Taneja
15f632e665 [media] media: ti-vpe: Use line average de-interlacing for first 2 frames
The motion detection block requires 3 fields to create the motion vector
data. This means that using the default method the first progressive
frame is only generated after 3rd field is consumed.
Hence by default for N input field we would generate N - 2 progressive
frames.

In order to generate N progressive frames from N fields we use the
line averaging mode of the de-interlacer for the first 2 fields and then
revert back to the preferred Edge Directed Interpolation method (using
the motion vector).
Thus creating 2 line averaged frames + N - 2 motion based frames for a
total of N frames.

Signed-off-by: Archit Taneja <archit@ti.com>
Signed-off-by: Nikhil Devshatwar <nikhil.nd@ti.com>
Signed-off-by: Benoit Parrot <bparrot@ti.com>
Signed-off-by: Hans Verkuil <hans.verkuil@cisco.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab@s-opensource.com>
2016-11-22 06:53:26 -02:00
Benoit Parrot
4f36178188 [media] media: ti-vpe: vpdma: Fix bus error when vpdma is writing a descriptor
On DRA7 since l3_noc event are being reported it was found that
when the write descriptor was being written it was consistently
causing bus error events.

The write address was improperly programmed.

Signed-off-by: Benoit Parrot <bparrot@ti.com>
Signed-off-by: Hans Verkuil <hans.verkuil@cisco.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab@s-opensource.com>
2016-11-22 06:27:30 -02:00
Benoit Parrot
3f43554c0a [media] media: ti-vpe: vpdma: Add helper to set a background color
Add a helper to set the background color during vpdma transfer.
This is needed when VPDMA is generating 32 bits RGB format
to have the Alpha channel set to an appropriate value.

Signed-off-by: Benoit Parrot <bparrot@ti.com>
Signed-off-by: Hans Verkuil <hans.verkuil@cisco.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab@s-opensource.com>
2016-11-22 06:27:01 -02:00
Benoit Parrot
2f88703a0b [media] media: ti-vpe: vpdma: Add multi-instance and multi-client support
The VPDMA (Video Port DMA) as found in devices such as DRA7xx is
used for both the Video Processing Engine (VPE) and the Video Input
Port (VIP). Some devices may have multiple VIP instances each with
its own VPDMA engine. Within VIP two slices can use a single VPDMA
engine simultaneously. So support for multi instances and multiple
clients has been added to VPDMA. Needed modification to the existing
helper functions were then reflected to VPE.

Multi-clients registers offset have also been added in preparation.

Signed-off-by: Benoit Parrot <bparrot@ti.com>
Signed-off-by: Hans Verkuil <hans.verkuil@cisco.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab@s-opensource.com>
2016-11-22 06:25:51 -02:00
Benoit Parrot
e4e9aeaf8c [media] media: ti-vpe: vpdma: Make vpdma library into its own module
The VPDMA (Video Port DMA) as found in devices such as DRA7xx is
used for both the Video Processing Engine (VPE) and the Video Input
Port (VIP).

In preparation for this we need to turn vpdma into its own
kernel module.

Signed-off-by: Benoit Parrot <bparrot@ti.com>
Signed-off-by: Hans Verkuil <hans.verkuil@cisco.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab@s-opensource.com>
2016-11-22 06:24:25 -02:00
Mauro Carvalho Chehab
c60b408810 [media] serial_ir: fix reference to 8250 serial code
While checking why we need i386 checking, I noticed that
the serial code referred at the driver was moved to another
place. Update it to make clear from where such code came from.

Signed-off-by: Mauro Carvalho Chehab <mchehab@s-opensource.com>
2016-11-22 06:17:44 -02:00
Sean Young
fa5dc29c1f [media] lirc_serial: move out of staging and rename to serial_ir
Signed-off-by: Sean Young <sean@mess.org>
2016-11-22 06:11:46 -02:00
Hans Verkuil
3f98da9636 [media] cec: ignore messages that we initiated
Some CEC adapters will receive messages that they initiated. Add a
check that will ignore such messages.

Most hardware behaves correctly in this respect, but I have seen
adapters that don't, so just filter this out in the framework.

Signed-off-by: Hans Verkuil <hans.verkuil@cisco.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab@s-opensource.com>
2016-11-22 05:43:07 -02:00
Minghsiu Tsai
7febb418a3 [media] mtk-mdp: allocate video_device dynamically
It can fix known problems with embedded video_device structs.

Signed-off-by: Minghsiu Tsai <minghsiu.tsai@mediatek.com>
Signed-off-by: Hans Verkuil <hans.verkuil@cisco.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab@s-opensource.com>
2016-11-22 05:42:29 -02:00
Colin Ian King
4c0c596adf [media] zoran: fix spelling mistake in dprintk message
Trivial fix to spelling mistake "unnsupported" to "unsupported"
in debug message.

Signed-off-by: Colin Ian King <colin.king@canonical.com>
Signed-off-by: Hans Verkuil <hans.verkuil@cisco.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab@s-opensource.com>
2016-11-22 05:41:56 -02:00
Hans Verkuil
db9ee88bb2 [media] vivid: fix HDMI VSDB block in the EDID
The maximum 'Max TMDS Rate' in the HDMI VSDB block is 340 MHz, not 600.
Higher rates are advertised in the HDMI Forum VSDB block.

So lower the Max TMDS rate in the HDMI VSDB block that the vivid driver
uses to 300 MHz, which is typical of most HDMI 1.4b devices.

Signed-off-by: Hans Verkuil <hans.verkuil@cisco.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab@s-opensource.com>
2016-11-22 05:41:15 -02:00
Wei Yongjun
e04e581093 [media] atmel-isc: fix error return code in atmel_isc_probe()
Fix to return error code -ENODEV from the error handling
case instead of 0, as done elsewhere in this function.

Signed-off-by: Wei Yongjun <weiyongjun1@huawei.com>
Signed-off-by: Hans Verkuil <hans.verkuil@cisco.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab@s-opensource.com>
2016-11-22 05:40:52 -02:00
Paul Bolle
8c1d254f2d [media] dvb-usb: remove another redundant #include <linux/kconfig.h>
Kernel source files need not include <linux/kconfig.h> explicitly
because the top Makefile forces to include it with:

  -include $(srctree)/include/linux/kconfig.h

Remove another reduntdant include, that managed to sneak by commit
97139d4a6f ("treewide: remove redundant #include <linux/kconfig.h>").

Signed-off-by: Paul Bolle <pebolle@tiscali.nl>
Signed-off-by: Mauro Carvalho Chehab <mchehab@s-opensource.com>
2016-11-21 14:30:01 -02:00
Sean Young
c77d17c098 [media] lirc: use-after free while reading from device and unplugging
Many lirc drivers have their own receive buffers which are freed on
unplug (e.g. ir_lirc_unregister). This means that ir->buf->wait_poll
will be freed directly after unplug so do not remove yourself from the
wait queue.

Signed-off-by: Sean Young <sean@mess.org>
Signed-off-by: Mauro Carvalho Chehab <mchehab@s-opensource.com>
2016-11-21 13:28:11 -02:00
Sean Young
afbb110172 [media] lirc: prevent use-after free
If you unplug an lirc device while reading from it, you will get an
use after free as the cdev is freed while still in use.

Signed-off-by: Sean Young <sean@mess.org>
Signed-off-by: Mauro Carvalho Chehab <mchehab@s-opensource.com>
2016-11-21 13:19:56 -02:00
Sean Young
12accdcb92 [media] lirc: might sleep error in lirc_dev_fop_read
[  101.457944] ------------[ cut here ]------------
[  101.457954] WARNING: CPU: 3 PID: 1819 at kernel/sched/core.c:7708 __might_sleep+0x7e/0x80
[  101.457960] do not call blocking ops when !TASK_RUNNING; state=1 set at [<ffffffffc0364bc2>] lirc_dev_fop_read+0x292/0x4e0 [lirc_dev]

Signed-off-by: Sean Young <sean@mess.org>
Signed-off-by: Mauro Carvalho Chehab <mchehab@s-opensource.com>
2016-11-21 13:19:08 -02:00
Sean Young
a48c4bbdff [media] redrat3: increase set size for lengths to maximum
In learning mode, you can get much longer messages which can run out
of lengths. The usb message will slightly larger.

Signed-off-by: Sean Young <sean@mess.org>
Signed-off-by: Mauro Carvalho Chehab <mchehab@s-opensource.com>
2016-11-21 12:31:54 -02:00
Sean Young
c49fcdde38 [media] redrat3: enable carrier reports using wideband receiver
The wideband receiver is a little awkward on the redrat3. Data arrives
on a different endpoint, and the learning command must be reissued
every time data is learned.

Signed-off-by: Sean Young <sean@mess.org>
Signed-off-by: Mauro Carvalho Chehab <mchehab@s-opensource.com>
2016-11-21 12:31:24 -02:00
Sean Young
8a21ec9bb3 [media] redrat3: fix error paths in probe
If redrat3_delete() is called, ensure ep_in and udev members are set
up so we don't dereference null in the error path. Also ensure that
rc dev device exists before we enable the receiver and that the
led urb exists before we create the led device.

Signed-off-by: Sean Young <sean@mess.org>
Signed-off-by: Mauro Carvalho Chehab <mchehab@s-opensource.com>
2016-11-21 12:26:54 -02:00
Sean Young
d6aca6ea28 [media] redrat3: remove dead code and pointless messages
Cleanup the error logic, removing checks for things that
should be always initialized when the routines are called,
and remove some bogus messages.

[mchehab@s-opensource.com: fix some merge conflicts]
Signed-off-by: Sean Young <sean@mess.org>
Signed-off-by: Mauro Carvalho Chehab <mchehab@s-opensource.com>
2016-11-21 12:24:58 -02:00
Sean Young
da500033df [media] redrat3: don't include vendor/product id in name
No need to duplicate these in the rc name.

Signed-off-by: Sean Young <sean@mess.org>
Signed-off-by: Mauro Carvalho Chehab <mchehab@s-opensource.com>
2016-11-21 12:20:03 -02:00
Sean Young
6932234fbe [media] winbond-cir: use name without space for pnp driver
Rename the pnp driver in sysfs from /sys/bus/pnp/drivers/Winbond CIR
to /sys/bus/pnp/drivers/winbond-cir

Signed-off-by: Sean Young <sean@mess.org>
Signed-off-by: Mauro Carvalho Chehab <mchehab@s-opensource.com>
2016-11-21 12:18:29 -02:00
Wei Yongjun
21098562a4 [media] c8sectpfe: fix error return code in c8sectpfe_probe()
Fix to return error code -ENODEV from the error handling
case instead of 0, as done elsewhere in this function.

Signed-off-by: Wei Yongjun <weiyongjun1@huawei.com>
Acked-by: Patrice Chotard <patrice.chotard@st.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab@s-opensource.com>
2016-11-21 11:41:43 -02:00
Wei Yongjun
1f5ecaf985 [media] dibusb: fix possible memory leak in dibusb_rc_query()
'buf' is malloced in dibusb_rc_query() and should be freed before
leaving from the error handling cases, otherwise it will cause
memory leak.

Fixes: ff1c123545 ("[media] dibusb: handle error code on RC query")

Signed-off-by: Wei Yongjun <weiyongjun1@huawei.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab@s-opensource.com>
2016-11-21 11:40:45 -02:00
Arnd Bergmann
33e423c40c [media] media: mtk-mdp: mark PM functions as __maybe_unused
A previous patch tried to fix a build error, but introduced another
warning:

drivers/media/platform/mtk-mdp/mtk_mdp_core.c:71:13: error: ‘mtk_mdp_clock_off’ defined but not used [-Werror=unused-function]
drivers/media/platform/mtk-mdp/mtk_mdp_core.c:62:13: error: ‘mtk_mdp_clock_on’ defined but not used [-Werror=unused-function]

This marks all the PM functions as __maybe_unused and removes
the #ifdef around them, as that will always do the right thing.

Fixes: 1b06fcf56a ("[media] media: mtk-mdp: fix build error")

Signed-off-by: Arnd Bergmann <arnd@arndb.de>
Signed-off-by: Mauro Carvalho Chehab <mchehab@s-opensource.com>
2016-11-19 10:20:09 -02:00
Mauro Carvalho Chehab
f2709c206d Revert "[media] dvb_frontend: merge duplicate dvb_tuner_ops.release implementations"
While this patch sounded a good idea, unfortunately, it causes
bad dependencies, as drivers that would otherwise work without
the DVB core will now break:

ERROR: "dvb_tuner_simple_release" [drivers/media/tuners/tea5767.ko] undefined!
ERROR: "dvb_tuner_simple_release" [drivers/media/tuners/tea5761.ko] undefined!
ERROR: "dvb_tuner_simple_release" [drivers/media/tuners/tda827x.ko] undefined!
ERROR: "dvb_tuner_simple_release" [drivers/media/tuners/tda18218.ko] undefined!
ERROR: "dvb_tuner_simple_release" [drivers/media/tuners/qt1010.ko] undefined!
ERROR: "dvb_tuner_simple_release" [drivers/media/tuners/mt2266.ko] undefined!
ERROR: "dvb_tuner_simple_release" [drivers/media/tuners/mt20xx.ko] undefined!
ERROR: "dvb_tuner_simple_release" [drivers/media/tuners/mt2060.ko] undefined!
ERROR: "dvb_tuner_simple_release" [drivers/media/tuners/mc44s803.ko] undefined!
ERROR: "dvb_tuner_simple_release" [drivers/media/tuners/fc0013.ko] undefined!
ERROR: "dvb_tuner_simple_release" [drivers/media/tuners/fc0012.ko] undefined!
ERROR: "dvb_tuner_simple_release" [drivers/media/tuners/fc0011.ko] undefined!

So, we have to revert it.

Note: as the argument for the release ops changed from "int"
to "void", we needed to change it at the revert patch, to
avoid compilation issues like:
	drivers/media/tuners/tea5767.c:437:23: error: initialization from incompatible pointer type [-Werror=incompatible-pointer-types]
	  .release           = tea5767_release,
	                       ^~~~~~~~~~~~~~~

This reverts commit 22a613e898.

Signed-off-by: Mauro Carvalho Chehab <mchehab@s-opensource.com>
2016-11-18 20:44:33 -02:00
Mauro Carvalho Chehab
a4afb3ed43 [media] Kconfig: fix breakages when DVB_CORE is not selected
On some weird randconfigs, it is possible to select DVB
drivers, without having the DVB_CORE:

CONFIG_DVB_AU8522=m
CONFIG_DVB_AU8522_V4L=m
CONFIG_DVB_TUNER_DIB0090=m

This was never supposed to work, but changeset 22a613e898
("[media] dvb_frontend: merge duplicate dvb_tuner_ops.release implementations")
caused it to be exposed:

   drivers/built-in.o: In function `fc0011_attach':
   (.text+0x1598fb): undefined reference to `dvb_tuner_simple_release'
   drivers/built-in.o:(.rodata+0x55e58): undefined reference to `dvb_tuner_simple_release'
   drivers/built-in.o:(.rodata+0x57398): undefined reference to `dvb_tuner_simple_release'

Fixes: 22a613e898 ("[media] dvb_frontend: merge duplicate dvb_tuner_ops.release implementations")
Reported-by: kbuild test robot <fengguang.wu@intel.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab@s-opensource.com>
2016-11-18 17:59:17 -02:00
Heiner Kallweit
c044170fcf [media] media: rc: nuvoton: replace usage of spin_lock_irqsave in ISR
Kernel takes care that interrupts from one source are serialized.
So there's no need to use spinlock_irq_save.

Signed-off-by: Heiner Kallweit <hkallweit1@gmail.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab@s-opensource.com>
2016-11-18 17:08:15 -02:00
Heiner Kallweit
73d4576d8f [media] media: rc: nuvoton: rename spinlock nvt_lock
Spinlock nvt_lock is a member of struct nvt_dev and there's no need
to prefix it with nvt_. So remove this prefix.

[mchehab@s-opensource.org: change the prefix also at the open function,
 as the patch removing it were not applied (yet?)]
Signed-off-by: Heiner Kallweit <hkallweit1@gmail.com>

Signed-off-by: Mauro Carvalho Chehab <mchehab@s-opensource.com>
2016-11-18 17:07:07 -02:00
Heiner Kallweit
f7ceec4fa0 [media] media: rc: nuvoton: eliminate nvt->tx.lock
Using a separate spinlock to protect access to substruct tx of struct
nvt_dev doesn't provide any actual benefit. We can use spinlock
nvt_lock to protect all access to struct nvt_dev and get rid of
nvt->tx.lock.

Signed-off-by: Heiner Kallweit <hkallweit1@gmail.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab@s-opensource.com>
2016-11-18 17:04:41 -02:00
Heiner Kallweit
b24ccccaee [media] media: rc: nuvoton: eliminate member pdev from struct nvt_dev
Member pdev of struct nvt_dev is needed only to access &pdev->dev.
We can get rid of this it by using rdev->dev.parent instead
(both point to the same struct device).

Setting rdev->dev.parent can be removed from the probe function
as this is done by devm_rc_allocate_device now.

Signed-off-by: Heiner Kallweit <hkallweit1@gmail.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab@s-opensource.com>
2016-11-18 17:03:32 -02:00
Max Kellermann
e7cd17a29d [media] drivers/media/media-device: fix double free bug in _unregister()
While removing all interfaces in media_device_unregister(), all
media_interface pointers are freed.  This is illegal and results in
double kfree() if any media_interface is still linked at this point;
maybe because a userspace process still has a file handle.  Once the
process closes the file handle, dvb_media_device_free() gets called,
which frees the dvb_device.intf_devnode again.

This patch removes the unnecessary kfree() call, and documents who's
responsible for really freeing it.

Signed-off-by: Max Kellermann <max.kellermann@gmail.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab@s-opensource.com>
2016-11-18 15:29:27 -02:00
Max Kellermann
6753743e11 [media] media-entity: clear media_gobj.mdev in _destroy()
media_gobj_destroy() may be called twice on one instance - once by
media_device_unregister() and again by dvb_media_device_free().  The
function media_remove_intf_links() establishes and documents the
convention that mdev==NULL means that the object is not registered,
but nobody ever NULLs this variable.  So this patch really implements
this behavior, and adds another mdev==NULL check to
media_gobj_destroy() to protect against double removal.

Signed-off-by: Max Kellermann <max.kellermann@gmail.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab@s-opensource.com>
2016-11-18 15:19:16 -02:00
Max Kellermann
1f862a68df [media] dvb_frontend: move kref to struct dvb_frontend
This commit amends my old commit fe35637b0a ("[media] dvb_frontend:
eliminate blocking wait in dvb_unregister_frontend()"), which added
kref to struct dvb_frontend_private.  It turned out that there are
several use-after-free bugs left, which affect the struct
dvb_frontend.  Protecting it with kref also protects struct
dvb_frontend_private, so we can simply move it.

This is how the use-after-free looks like in KASAN:

    BUG: KASAN: use-after-free in string+0x60/0xb1 at addr ffff880033bd9fc0
    Read of size 1 by task kworker/0:2/617
    CPU: 0 PID: 617 Comm: kworker/0:2 Not tainted 4.8.0-rc1-hosting+ #60
    Hardware name: Bochs Bochs, BIOS Bochs 01/01/2011
    Workqueue: usb_hub_wq hub_event
     0000000000000000 ffff880033757218 ffffffff81394e50 ffff880033bd9fd0
     ffff880035c03b00 ffff880033757240 ffffffff811f271d ffff880033bd9fc0
     1ffff1000677b3f8 ffffed000677b3f8 ffff8800337572b8 ffffffff811f2afe
    Call Trace:
     [...]
     [<ffffffff813a2d2f>] vsnprintf+0x39d/0x7e9
     [<ffffffff813993f9>] add_uevent_var+0x10f/0x1dc
     [<ffffffff814fe5ca>] rc_dev_uevent+0x55/0x6f
     [<ffffffff814438f8>] dev_uevent+0x2e1/0x316
     [<ffffffff81399744>] kobject_uevent_env+0x27e/0x701
     [<ffffffff81399bd2>] kobject_uevent+0xb/0xd
     [<ffffffff81443445>] device_del+0x322/0x383
     [<ffffffff81500c0c>] rc_unregister_device+0x98/0xc3
     [<ffffffff81508fb4>] dvb_usb_remote_exit+0x7a/0x90
     [<ffffffff81506157>] dvb_usb_exit+0x1d/0xe5
     [<ffffffff81506e90>] dvb_usb_device_exit+0x69/0x7d
     [<ffffffff8150a181>] pctv452e_usb_disconnect+0x7b/0x80
     [...]
    Object at ffff880033bd9fc0, in cache kmalloc-16 size: 16
    Allocated:
     [...]
    Freed:
    PID = 617
     [...]
     [<ffffffff811f034c>] kfree+0xd9/0x166
     [<ffffffff814fe513>] ir_free_table+0x2f/0x51
     [<ffffffff81500bc1>] rc_unregister_device+0x4d/0xc3
     [<ffffffff81508fb4>] dvb_usb_remote_exit+0x7a/0x90
     [<ffffffff81506157>] dvb_usb_exit+0x1d/0xe5
     [<ffffffff81506e90>] dvb_usb_device_exit+0x69/0x7d
     [<ffffffff8150a181>] pctv452e_usb_disconnect+0x7b/0x80

Another one:

    BUG: KASAN: use-after-free in do_sys_poll+0x336/0x6b8 at addr ffff88003563fcc0
    Read of size 8 by task tuner on fronte/1042
    CPU: 1 PID: 1042 Comm: tuner on fronte Tainted: G    B           4.8.0-rc1-hosting+ #60
    Hardware name: Bochs Bochs, BIOS Bochs 01/01/2011
     0000000000000000 ffff88003353f910 ffffffff81394e50 ffff88003563fd80
     ffff880035c03200 ffff88003353f938 ffffffff811f271d ffff88003563fc80
     1ffff10006ac7f98 ffffed0006ac7f98 ffff88003353f9b0 ffffffff811f2afe
    Call Trace:
     [...]
     [<ffffffff812289b3>] do_sys_poll+0x336/0x6b8
     [...]
     [<ffffffff81228ed9>] SyS_poll+0xa9/0x194
     [...]
    Object at ffff88003563fc80, in cache kmalloc-256 size: 256
    Allocated:
     [...]
    Freed:
    PID = 617
     [...]
     [<ffffffff811f034c>] kfree+0xd9/0x166
     [<ffffffff814eb60d>] dvb_unregister_device+0xd6/0xe5
     [<ffffffff814fa4ed>] dvb_unregister_frontend+0x4b/0x66
     [<ffffffff8150810b>] dvb_usb_adapter_frontend_exit+0x69/0xac
     [<ffffffff8150617d>] dvb_usb_exit+0x43/0xe5
     [<ffffffff81506e90>] dvb_usb_device_exit+0x69/0x7d
     [<ffffffff8150a181>] pctv452e_usb_disconnect+0x7b/0x80

Signed-off-by: Max Kellermann <max.kellermann@gmail.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab@s-opensource.com>
2016-11-18 15:13:22 -02:00
Max Kellermann
f686c14364 [media] stb0899: move code to "detach" callback
Ensure that STB0899_POSTPROC_GPIO_POWER is set synchronously.

Signed-off-by: Max Kellermann <max.kellermann@gmail.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab@s-opensource.com>
2016-11-18 15:10:41 -02:00
Max Kellermann
d812b3caea [media] dvb_frontend: add "detach" callback
Prepare for making "release" asynchronous (via kref).  Some operations
may need to be run synchronously in dvb_frontend_detach(), and that's
why we need a "detach" callback.

Signed-off-by: Max Kellermann <max.kellermann@gmail.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab@s-opensource.com>
2016-11-18 15:09:41 -02:00
Max Kellermann
967d8e8f4c [media] dvb_frontend: merge the two dvb_frontend_detach() versions
This code duplication is confusing and error prone.  Let's merge them
by moving the release/dvb_detach call into one function with one

Signed-off-by: Max Kellermann <max.kellermann@gmail.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab@s-opensource.com>
2016-11-18 15:08:49 -02:00
Max Kellermann
194ced7a5a [media] dvb_frontend: tuner_ops.release returns void
It is not clear what this return value means.  All implemenations
return 0, and the one caller ignores the value.  Let's remove this
useless return value completely.

Signed-off-by: Max Kellermann <max.kellermann@gmail.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab@s-opensource.com>
2016-11-18 15:07:26 -02:00
Max Kellermann
22a613e898 [media] dvb_frontend: merge duplicate dvb_tuner_ops.release implementations
Most release callback functions are identical: free the "tuner_priv"
and clear it.  Let's eliminate some bloat by providing this simple
implementation in the dvb_frontend library.

Signed-off-by: Max Kellermann <max.kellermann@gmail.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab@s-opensource.com>
2016-11-18 15:05:44 -02:00
Max Kellermann
4d5030b69b [media] dvb-core/en50221: use dvb_remove_device()
Commit da677fe143 ("[media] dvb-core/en50221: use kref to manage
struct dvb_ca_private") moved the dvb_unregister_device() call to the
kref callback, but that left lots of stale device state visible to
userspace (e.g. in sysfs).  By using dvb_remove_device() and
dvb_free_device() instead of dvb_unregister_device(), we can avoid
that.

Signed-off-by: Max Kellermann <max.kellermann@gmail.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab@s-opensource.com>
2016-11-18 15:03:45 -02:00
Max Kellermann
1f4ed6cd58 [media] dvbdev: split dvb_unregister_device()
dvb_unregister_device() has a major problem: it combines unregistering
with memory disposal.  Sometimes, it is necessary to unregister a
device, but no memory can be freed yet, because a process still has a
(stale) file handle.  Therefore, we need to split
dvb_unregister_device().  This will allow sanitizing a few callers.

With my new design, dvb_unregister_device() appears misnamed, but to
reduce patch noise, I'm not renaming it just yet.

Signed-off-by: Max Kellermann <max.kellermann@gmail.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab@s-opensource.com>
2016-11-18 15:02:39 -02:00
Max Kellermann
bd336e6344 [media] dvb: make DVB frontend *_ops instances "const"
These are immutable.  Making them "const" allows the compiler to move
them to the "rodata" section.

Note that cxd2841er_t_c_ops cannot be made "const", because
cxd2841er_attach() modifies it.  Ouch!

[mchehab@s-opensource.com: fix merge conflicts]
Signed-off-by: Max Kellermann <max.kellermann@gmail.com>

Signed-off-by: Mauro Carvalho Chehab <mchehab@s-opensource.com>
2016-11-18 15:00:22 -02:00
Max Kellermann
c183d3584b [media] rc-main: clear rc_map.name in ir_free_table()
rc_unregister_device() will first call ir_free_table(), and later
device_del(); however, the latter causes a call to rc_dev_uevent(),
which prints rc_map.name, which at this point has already bee freed.

This fixes a use-after-free bug found with KASAN.

As reported by Shuah:

 "I am seeing the following when I do rmmod on au0828

  BUG: KASAN: use-after-free in string+0x170/0x1f0 at addr ffff8801bd513000
  Read of size 1 by task rmmod/1831
  CPU: 1 PID: 1831 Comm: rmmod Tainted: G        W       4.9.0-rc5 #5
  Hardware name: Hewlett-Packard HP ProBook 6475b/180F, BIOS 68TTU Ver. F.04 08/03/2012
  ffff8801aea2f680 ffffffff81b37ad3 ffff8801fa403b80 ffff8801bd513000
  ffff8801aea2f6a8 ffffffff8156c301 ffff8801aea2f738 ffff8801bd513000
  ffff8801fa403b80 ffff8801aea2f728 ffffffff8156c59a ffff8801aea2f770
  Call Trace:
  dump_stack+0x67/0x94
  [<ffffffff8156c301>] kasan_object_err+0x21/0x70
  [<ffffffff8156c59a>] kasan_report_error+0x1fa/0x4d0
  [<ffffffffa116f05f>] ? au0828_exit+0x10/0x21 [au0828]
  [<ffffffff8156c8b3>] __asan_report_load1_noabort+0x43/0x50
  [<ffffffff81b58b20>] ? string+0x170/0x1f0
  [<ffffffff81b58b20>] string+0x170/0x1f0
  [<ffffffff81b621c4>] vsnprintf+0x374/0x1c50
  [<ffffffff81b61e50>] ? pointer+0xa80/0xa80
  [<ffffffff8156b676>] ? save_stack+0x46/0xd0
  [<ffffffff81566faa>] ? __kmalloc+0x14a/0x2a0
  [<ffffffff81b3d70a>] ? kobject_get_path+0x9a/0x200
  [<ffffffff81b408c2>] ? kobject_uevent_env+0x282/0xca0
  [<ffffffff81b412eb>] ? kobject_uevent+0xb/0x10
  [<ffffffff81f10104>] ? device_del+0x434/0x6d0
  [<ffffffffa0fea717>] ? rc_unregister_device+0x177/0x240 [rc_core]
  [<ffffffffa116eeb0>] ? au0828_rc_unregister+0x60/0xb0 [au0828]

 The problem is fixed with this patch on Linux 4.9-rc4"

Signed-off-by: Max Kellermann <max.kellermann@gmail.com>
Tested-by: Shuah Khan <shuahkh@osg.samsung.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab@s-opensource.com>
2016-11-18 14:31:34 -02:00
Peter Chen
b68002db13 [media] media: platform: ti-vpe: call of_node_put on non-null pointer
It should call of_node_put on non-null poiner.

Cc: Mauro Carvalho Chehab <mchehab@kernel.org>
Signed-off-by: Peter Chen <peter.chen@nxp.com>
Acked-by: Benoit Parrot <bparrot@ti.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab@s-opensource.com>
2016-11-18 14:23:33 -02:00
Dan Carpenter
c9205e18b4 [media] blackfin: check devm_pinctrl_get() for errors
devm_pinctrl_get() can fail so we should check for that.

Fixes: 0a6824bc10 ('[media] v4l2: blackfin: select proper pinctrl state in ppi_set_params if CONFIG_PINCTRL is enabled')

Signed-off-by: Dan Carpenter <dan.carpenter@oracle.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab@s-opensource.com>
2016-11-18 14:22:27 -02:00
Andi Shyti
5911f62926 [media] lirc_dev: remove compat_ioctl assignment
There is no need to check for CONFIG_COMPAT and consequently
assign the compat_ioctl.

Signed-off-by: Andi Shyti <andi.shyti@samsung.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab@s-opensource.com>
2016-11-18 14:16:09 -02:00
Maciej S. Szmigiero
5a91206ff0 [media] saa7134: fix warm Medion 7134 EEPROM read
When saa7134 module driving a Medion 7134 card is reloaded reads of this
card EEPROM (required for automatic detection of tuner model) will be
corrupted due to I2C gate in DVB-T demod being left closed.
This sometimes also happens on first saa7134 module load after a warm
reboot.

Fix this by opening this I2C gate before doing EEPROM read during i2c
initialization.

Signed-off-by: Maciej S. Szmigiero <mail@maciej.szmigiero.name>
Signed-off-by: Mauro Carvalho Chehab <mchehab@s-opensource.com>
2016-11-18 14:04:53 -02:00
CrazyCat
5fa88151ec [media] dvb-usb-cxusb: Geniatech T230 - resync TS FIFO after lock
This patch fix streaming issue for Geniatech T230/PT360.

Signed-off-by: CrazyCat <crazycat69@narod.ru>
Signed-off-by: Mauro Carvalho Chehab <mchehab@s-opensource.com>
2016-11-18 13:46:28 -02:00
Peter Griffin
bfc303e7be [media] c8sectpfe: Remove clk_disable_unprepare hacks
Now that CLK_PROC_STFE is defined as a critical clock in
DT, we can remove the commented clk_disable_unprepare from
the c8sectpfe driver. This means we now have balanced
clk*enable/disable calls in the driver, but on STiH407
family the clock in reality will never actually be disabled.

This is due to a HW bug where once the IP has been configured
and the SLIM core is running, disabling the clock causes a
unrecoverable bus lockup.

Signed-off-by: Peter Griffin <peter.griffin@linaro.org>
Acked-by: Patrice Chotard <patrice.chotard@st.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab@s-opensource.com>
2016-11-18 13:40:33 -02:00
Greg Kroah-Hartman
ae4d814bf1 usb: patches for v4.10 merge window
One big merge this time with a total of 166 non-merge commits.
 
 Most of the work, by far, is on dwc2 this time (68.2%) with dwc3 a far
 second (22.5%). The remaining 9.3% are scattered on gadget drivers.
 
 The most important changes for dwc2 are the peripheral side DMA support
 implemented by Synopsys folks and support for the new IOT dwc2
 compatible core from Synopsys.
 
 In dwc3 land we have support for high-bandwidth, high-speed isochronous
 endpoints and some non-critical fixes for large scatter lists.
 
 Apart from these, we have our usual set of cleanups, non-critical fixes,
 etc.
 -----BEGIN PGP SIGNATURE-----
 
 iQJRBAABCAA7FiEElLzh7wn96CXwjh2IzL64meEamQYFAlgu7+gdHGZlbGlwZS5i
 YWxiaUBsaW51eC5pbnRlbC5jb20ACgkQzL64meEamQaDbxAAsgDPAp8QTx8D1d70
 hSGyPZ55rmqlzBNbUUOQyk/AeN5xM3XVbjZNOxWn4c386iaDrngcqOrxjCbBRsje
 b9yMESMiZsTPVlKXE45yXt//NHg1KUfpHON7rybaiFq0uqjUhnQf95DeYPgJVxit
 7F9B+05XcNMyxYRoz6bGkRTU+lcJ6g3/orgKfp4t/hs8WUNXH6+71keMF+IdLYNH
 mcPmJ8MXpfLzv8eweRwV0s/3flxCuFx1ksZ8cW6qHR5vX303X2sGTlinBmhfQapr
 t0a+OBtLpZdNmjw/yB2odc/1jjLNRHpYU5xGqwouMx9Ca2PocFT2xFbmUWR23xp1
 X0rkICRxcLPjZql2Uld5QHO9dPnF/FbX0Njuvxo+2r8ENE5/eG4C/RcYcRDmYPsu
 u8k2rKFs0+yCOAU91rD8mayJVBWBJ4trqZFT0TcocCGsMTk8fTYpF1Iskj9Z4FKz
 yo+lgyCCtp673ykGZ1ezsL6YWOmdrQv/PurKZqrXAmdhi6+mImLI/nAHtAdOZx0X
 zK9MwPnwDxrPiqhrZ46+Bm/EjZI50TM44M1ldmCwKi/6/Nvy54DHMtjPI5/9205R
 bjftW3DkVWAC//29RNcGEHtwiJFPEU/kdoRFOPhKGJ7ocCzFVSTFBgo02kDsC6De
 Wouv2QTFuZN9s17o29YVD3bGJZM=
 =5WN9
 -----END PGP SIGNATURE-----

Merge tag 'usb-for-v4.10' of git://git.kernel.org/pub/scm/linux/kernel/git/balbi/usb into usb-next

Felipe writes:

usb: patches for v4.10 merge window

One big merge this time with a total of 166 non-merge commits.

Most of the work, by far, is on dwc2 this time (68.2%) with dwc3 a far
second (22.5%). The remaining 9.3% are scattered on gadget drivers.

The most important changes for dwc2 are the peripheral side DMA support
implemented by Synopsys folks and support for the new IOT dwc2
compatible core from Synopsys.

In dwc3 land we have support for high-bandwidth, high-speed isochronous
endpoints and some non-critical fixes for large scatter lists.

Apart from these, we have our usual set of cleanups, non-critical fixes,
etc.
2016-11-18 16:02:15 +01:00
Markus Elfring
ce3aeaf22c [media] winbond-cir: Use kmalloc_array() in wbcir_tx()
A multiplication for the size determination of a memory allocation
indicated that an array data structure should be processed.
Thus use the corresponding function "kmalloc_array".

This issue was detected by using the Coccinelle software.

Signed-off-by: Markus Elfring <elfring@users.sourceforge.net>
Signed-off-by: David Härdeman <david@hardeman.nu>
Signed-off-by: Mauro Carvalho Chehab <mchehab@s-opensource.com>
2016-11-18 11:04:29 -02:00
Markus Elfring
3f81678d8e [media] RedRat3: Return directly after a failed rc_allocate_device() in redrat3_init_rc_dev()
Return directly after a call of the function "rc_allocate_device" failed
at the beginning.

Signed-off-by: Markus Elfring <elfring@users.sourceforge.net>
Signed-off-by: Mauro Carvalho Chehab <mchehab@s-opensource.com>
2016-11-18 10:55:59 -02:00
Markus Elfring
9d45d5fbeb [media] RedRat3: Delete an unnecessary variable initialisation in redrat3_init_rc_dev()
The local variable "ret" will be set to an appropriate value a bit later.
Thus omit the explicit initialisation at the beginning.

Signed-off-by: Markus Elfring <elfring@users.sourceforge.net>
Signed-off-by: Mauro Carvalho Chehab <mchehab@s-opensource.com>
2016-11-18 10:52:57 -02:00
Markus Elfring
7aa20afea6 [media] RedRat3: Delete an unnecessary variable initialisation in redrat3_get_firmware_rev()
The local variable "rc" will be set to an appropriate value a bit later.
Thus omit the explicit initialisation at the beginning.

Signed-off-by: Markus Elfring <elfring@users.sourceforge.net>
Signed-off-by: Mauro Carvalho Chehab <mchehab@s-opensource.com>
2016-11-18 10:50:46 -02:00
Markus Elfring
fac59136bc [media] RedRat3: Return directly after a failed kcalloc() in redrat3_transmit_ir()
* Return directly after a call of the function "kcalloc" failed
  at the beginning.

* Reorder two calls for the function "kfree" at the end.

Signed-off-by: Markus Elfring <elfring@users.sourceforge.net>
Signed-off-by: Mauro Carvalho Chehab <mchehab@s-opensource.com>
2016-11-18 10:50:19 -02:00
Markus Elfring
576df632f2 [media] RedRat3: Improve another size determination in redrat3_reset()
Replace the specification of a data type by a pointer dereference
as the parameter for the operator "sizeof" to make the corresponding size
determination a bit safer.

Signed-off-by: Markus Elfring <elfring@users.sourceforge.net>
Signed-off-by: Mauro Carvalho Chehab <mchehab@s-opensource.com>
2016-11-18 10:48:22 -02:00
Markus Elfring
559f64d4de [media] RedRat3: Delete six messages for a failed memory allocation
The script "checkpatch.pl" pointed information out like the following.

WARNING: Possible unnecessary 'out of memory' message

Thus remove such a logging statement in five functions.

Signed-off-by: Markus Elfring <elfring@users.sourceforge.net>
Signed-off-by: Mauro Carvalho Chehab <mchehab@s-opensource.com>
2016-11-18 10:40:27 -02:00
Markus Elfring
0bebaa5f01 [media] RedRat3: Use kcalloc() in two functions
* Multiplications for the size determination of memory allocations
  indicated that array data structures should be processed.
  Thus use the corresponding function "kcalloc".

  This issue was detected by using the Coccinelle software.

* Replace the specification of data types by pointer dereferences
  to make the corresponding size determination a bit safer according to
  the Linux coding style convention.

Signed-off-by: Markus Elfring <elfring@users.sourceforge.net>
Signed-off-by: Mauro Carvalho Chehab <mchehab@s-opensource.com>
2016-11-18 10:34:39 -02:00
Mauro Carvalho Chehab
6037b3ca28 [media] tveeprom: print log messages using pr_foo()
Unfortunately, the callers of tveeprom don't do the right
thing to initialize the device. So, it produces log messages
like:

[  267.533010]  (null): Hauppauge model 42012, rev C186, serial# 2819348
[  267.533012]  (null): tuner model is Philips FQ1236 MK3 (idx 86, type 43)
[  267.533013]  (null): TV standards NTSC(M) (eeprom 0x08)
[  267.533014]  (null): audio processor is MSP3445 (idx 12)
[  267.533015]  (null): has radio

So, replace it to pr_foo(), as it should work fine.

Signed-off-by: Mauro Carvalho Chehab <mchehab@s-opensource.com>
2016-11-18 10:13:11 -02:00
Mauro Carvalho Chehab
d3d96820d0 [media] rc-main: use pr_foo() macros
Instead of calling printk() directly, use pr_foo() macro.

That should make the rc_core messages be formatted with the
right prefix.

Signed-off-by: Mauro Carvalho Chehab <mchehab@s-opensource.com>
2016-11-18 10:11:37 -02:00
Mauro Carvalho Chehab
e513411489 [media] tvp5150: get rid of KERN_CONT
Unfortunately, KERN_CONT doesn't work with dev_foo(),
producing weird messages like:

	tvp5150 6-005c: tvp5150: read 0xf6 = 0xff
	ff

So, we need to get rid of it.

As we're always printing read/write in hexa when dumping
multiple register values, also remove the "0x" from the
read/write debug messages too.

Signed-off-by: Mauro Carvalho Chehab <mchehab@s-opensource.com>
2016-11-18 10:11:09 -02:00
Mauro Carvalho Chehab
ad0e374470 [media] tvp5150: Get rid of direct calls to printk()
When returning results via v4l2_subdev_core_ops.log_status,
use dev_foo() call, instead of just calling printk()
directly, without even specifying the log message level.

Signed-off-by: Mauro Carvalho Chehab <mchehab@s-opensource.com>
2016-11-18 10:10:43 -02:00
Mauro Carvalho Chehab
257e29f84e [media] tvp5150: convert it to use dev_foo() macros
Instead of using v4l_foo(), use the dev_foo() macros, as
most modern media drivers.

Signed-off-by: Mauro Carvalho Chehab <mchehab@s-opensource.com>
2016-11-18 10:10:07 -02:00
Mauro Carvalho Chehab
ce8591ff02 [media] em28xx: convert it from pr_foo() to dev_foo()
Instead of using pr_foo(), use dev_foo(), with provides a
better output. As this device is a multi-interface one,
we'll set the device name to show the chipset and the driver
used.

While here, get rid of printk continuation messages.

Signed-off-by: Mauro Carvalho Chehab <mchehab@s-opensource.com>
2016-11-18 10:08:15 -02:00
Mauro Carvalho Chehab
39ad799a85 [media] msp3400: convert it to use dev_foo() macros
Instead of using the v4l_foo() macros, just use the
kernel-wide dev_foo() macros, as there's no good reason
to use something else.

Signed-off-by: Mauro Carvalho Chehab <mchehab@s-opensource.com>
2016-11-18 10:07:18 -02:00
Mauro Carvalho Chehab
b68d75b955 [media] msp3400-driver: don't use KERN_CONT
Drivers using dev_foo() macro should not use KERN_CONT, as, internally,
those macros work as if all strings were terminated by a \n. So, doing:

	dev_info(&client->dev, "%s ", client->name);
	printk(KERN_CONT "supports radio, mode is autodetect and autoselect");

Would produce the following output:

	msp3400 6-0044: msp3400
	supports radio, mode is autodetect and autoselect

As there's no good reason to use KERN_CONT, let's rewrite the code
to avoid that, allowing this driver to be converted to dev_foo().

Signed-off-by: Mauro Carvalho Chehab <mchehab@s-opensource.com>
2016-11-18 10:06:49 -02:00
Mauro Carvalho Chehab
680d87c0a9 [media] tuner-core: use pr_foo, instead of internal printk macros
Tuner core uses its own printk internal macros, instead of the
standard debug ones, for no good reason.

Signed-off-by: Mauro Carvalho Chehab <mchehab@s-opensource.com>
2016-11-18 10:04:28 -02:00
Mauro Carvalho Chehab
cc8e7ff440 [media] af9005: remove a printk that would require a KERN_CONT
The dvb-usb system has its own macro to print hexa dumps
(debug_dump). Such macro doesn't support messages with
KERN_CONT after commit 563873318d ("Merge branch 'printk-cleanups'").
So, let's get rid of a printk() that would be assuming that
this would work.

Signed-off-by: Mauro Carvalho Chehab <mchehab@s-opensource.com>
2016-11-18 10:02:47 -02:00
Mauro Carvalho Chehab
0a6dc89ae4 [media] dibx000_common: use pr_foo() instead of printk()
The dprintk() macro relies on continuation lines. This is not
a good practice and will break after commit 563873318d
("Merge branch 'printk-cleanups'").

So, instead of directly calling printk(), use pr_foo() macros,
adding a \n leading char on each macro call.

Signed-off-by: Mauro Carvalho Chehab <mchehab@s-opensource.com>
2016-11-18 10:01:56 -02:00
Mauro Carvalho Chehab
3dd722622f [media] dib9000: use pr_foo() instead of printk()
The dprintk() macro relies on continuation lines. This is not
a good practice and will break after commit 563873318d
("Merge branch 'printk-cleanups'").

So, instead of directly calling printk(), use pr_foo() macros,
adding a\n leading char on each macro call.

Signed-off-by: Mauro Carvalho Chehab <mchehab@s-opensource.com>
2016-11-18 10:01:02 -02:00
Mauro Carvalho Chehab
8af16adfbb [media] dib8000: use pr_foo() instead of printk()
The dprintk() macro relies on continuation lines. This is not
a good practice and will break after commit 563873318d
("Merge branch 'printk-cleanups'").

So, instead of directly calling printk(), use pr_foo() macros,
adding a\n leading char on each macro call.

Signed-off-by: Mauro Carvalho Chehab <mchehab@s-opensource.com>
2016-11-18 09:59:38 -02:00
Mauro Carvalho Chehab
5a0e2a4e93 [media] dib7000p: use pr_foo() instead of printk()
The dprintk() macro relies on continuation lines. This is not
a good practice and will break after commit 563873318d
("Merge branch 'printk-cleanups'").

So, instead of directly calling printk(), use pr_foo() macros,
adding a \n leading char on each macro call.

Signed-off-by: Mauro Carvalho Chehab <mchehab@s-opensource.com>
2016-11-18 09:57:10 -02:00
Mauro Carvalho Chehab
7570227724 [media] dib7000m: use pr_foo() instead of printk()
The dprintk() macro relies on continuation lines. This is not
a good practice and will break after commit 563873318d
("Merge branch 'printk-cleanups'").

So, instead of directly calling printk(), use pr_foo() macros,
adding a \n leading char on each macro call.

Signed-off-by: Mauro Carvalho Chehab <mchehab@s-opensource.com>
2016-11-18 09:55:50 -02:00
Mauro Carvalho Chehab
441d54e343 [media] dib3000mc: use pr_foo() instead of printk()
The dprintk() macro relies on continuation lines. This is not
a good practice and will break after commit 563873318d
("Merge branch 'printk-cleanups'").

So, instead of directly calling printk(), use pr_foo() macros,
adding a \n leading char on each macro call.

Signed-off-by: Mauro Carvalho Chehab <mchehab@s-opensource.com>
2016-11-18 09:48:42 -02:00
Mauro Carvalho Chehab
585e3227ec [media] dib3000mb: use pr_foo() instead of printk()
The dprintk() macro relies on continuation lines. This is not
a good practice and will break after commit 563873318d
("Merge branch 'printk-cleanups'").

So, instead of directly calling printk(), use pr_foo() macros,
adding a \n leading char on each macro call.

The frontend settings also rely on continuation lines. Change
it to avoid the need of adding pr_cont() calls.

Signed-off-by: Mauro Carvalho Chehab <mchehab@s-opensource.com>
2016-11-18 09:47:48 -02:00
Mauro Carvalho Chehab
4bd1a8ddad [media] dib0090: use pr_foo() instead of printk()
The dprintk() macro relies on continuation lines. This is not
a good practice and will break after commit 563873318d
("Merge branch 'printk-cleanups").

So, instead of directly calling printk(), use pr_foo() macros,
adding a \n leading char on each macro call.

Signed-off-by: Mauro Carvalho Chehab <mchehab@s-opensource.com>
2016-11-18 09:44:48 -02:00
Mauro Carvalho Chehab
fb11cbd1a9 [media] dib0070: use pr_foo() instead of printk()
The dprintk() macro relies on continuation lines. This is not
a good practice and will break after commit 563873318d
("Merge branch 'printk-cleanups").

So, instead of directly calling printk(), use pr_foo() macros,
adding a \n leading char on each macro call.

Signed-off-by: Mauro Carvalho Chehab <mchehab@s-opensource.com>
2016-11-18 09:43:55 -02:00
Mauro Carvalho Chehab
a80e1d965c [media] ttpci: cleanup debug macros and remove dead code
Continuation lines without KERN_CONT won't work anymore.
However, the way dprintk() was defined leads to the usage
of continuation lines, with should be avoided when possible.

So, redefine those macros.

While hre, remove some dead code at av7110.c with also
relies on continuation lines.

Signed-off-by: Mauro Carvalho Chehab <mchehab@s-opensource.com>
2016-11-18 09:40:43 -02:00
Mauro Carvalho Chehab
61fc87498b [media] ttusb_dec: use KERNEL_CONT where needed
Some continuation messages are not using KERNEL_CONT.

Since commit 563873318d ("Merge branch 'printk-cleanups"),
this won't work as expected anymore. So, let's add KERN_CONT
to those lines.

Signed-off-by: Mauro Carvalho Chehab <mchehab@s-opensource.com>
2016-11-18 09:38:37 -02:00
Mauro Carvalho Chehab
6dc3a35563 [media] pvrusb2: use KERNEL_CONT where needed
Some continuation messages are not using KERNEL_CONT.

Since commit 563873318d ("Merge branch 'printk-cleanups"),
this won't work as expected anymore. So, let's add KERN_CONT
to those lines.

Signed-off-by: Mauro Carvalho Chehab <mchehab@s-opensource.com>
2016-11-18 09:37:49 -02:00
Mauro Carvalho Chehab
ac2ac8376e [media] wl128x: use KERNEL_CONT where needed
Some continuation messages are not using KERNEL_CONT.

Since commit 563873318d ("Merge branch 'printk-cleanups"),
this won't work as expected anymore. So, let's add KERN_CONT
to those lines.

Signed-off-by: Mauro Carvalho Chehab <mchehab@s-opensource.com>
2016-11-18 09:37:24 -02:00
Mauro Carvalho Chehab
623b2f4a67 [media] zoran: use KERN_CONT where needed
Some continuation messages are not using KERN_CONT.

Since commit 563873318d ("Merge branch 'printk-cleanups"),
this won't work as expected anymore. So, let's add KERN_CONT
to those lines.

Signed-off-by: Mauro Carvalho Chehab <mchehab@s-opensource.com>
2016-11-18 09:36:30 -02:00
Mauro Carvalho Chehab
7c66e12136 [media] pluto2: use KERN_CONT where needed
Some continuation messages are not using KERN_CONT.

Since commit 563873318d ("Merge branch 'printk-cleanups"),
this won't work as expected anymore. So, let's add KERN_CONT
to those lines.

Signed-off-by: Mauro Carvalho Chehab <mchehab@s-opensource.com>
2016-11-18 09:35:46 -02:00
Mauro Carvalho Chehab
7b61ba8ff8 [media] cx88: make checkpatch happier
This driver is old, and have lots of checkpatch violations.
As we're touching a lot on this driver due to the printk
conversions, let's run checkpatch --fix on it, in order to
solve some of those issues.

Also, do a few manual adjustments:
- remove the FSF address and use the usual coding style
  for the initial comments;
- use WARN_ON() instead of BUG_ON();
- remove an unused typedef;
- break a few long lines.

Signed-off-by: Mauro Carvalho Chehab <mchehab@s-opensource.com>
2016-11-18 08:44:51 -02:00
Mauro Carvalho Chehab
65bc2fe86e [media] cx88: convert it to use pr_foo() macros
Instead of calling printk() directly, use pr_foo()
macros, as suggested at the Kernel's coding style.

Please notice that a conversion to dev_foo() is not trivial,
as several parts on this driver uses pr_cont().

Signed-off-by: Mauro Carvalho Chehab <mchehab@osg.samsung.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab@s-opensource.com>
2016-11-18 08:14:27 -02:00
Mauro Carvalho Chehab
3b0cb24f96 [media] cx88: use KERN_CONT where needed
Some continuation messages are not using KERN_CONT.

Since commit 563873318d ("Merge branch 'printk-cleanups'"),
this won't work as expected anymore. So, let's add KERN_CONT
to those lines.

While here, add missing log level annotations.

Signed-off-by: Mauro Carvalho Chehab <mchehab@s-opensource.com>
2016-11-18 08:10:15 -02:00
Mauro Carvalho Chehab
e39682b5d9 [media] cx23885: convert it to use pr_foo() macros
Instead of calling printk() directly, use pr_foo()
macros, as suggested at the Kernel's coding style.

Please notice that a conversion to dev_foo() is not trivial,
as several parts on this driver uses pr_cont().

Signed-off-by: Mauro Carvalho Chehab <mchehab@osg.samsung.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab@s-opensource.com>
2016-11-18 08:09:36 -02:00
Mauro Carvalho Chehab
f1dc10b6e1 gp8psk-fe: add missing MODULE_foo() macros
This file was converted to a separate module at commit 7a0786c19d
("gp8psk: Fix DVB frontend attach"), because the DVB attach routines
require it to work.  However, I forgot to copy the MODULE_foo() macros
from the original module, causing this warning:

    WARNING: modpost: missing MODULE_LICENSE() in drivers/media/dvb-frontends/gp8psk-fe.o

Reported-by: Stephen Rothwell <sfr@canb.auug.org.au>
Fixes: 7a0786c19d ("gp8psk: Fix DVB frontend attach")
Signed-off-by: Mauro Carvalho Chehab <mchehab@s-opensource.com>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
2016-11-18 08:06:38 -02:00
Mauro Carvalho Chehab
09f8be263c [media] cx23885: use KERN_CONT where needed
Some continuation messages are not using KERN_CONT.

Since commit 563873318d ("Merge branch 'printk-cleanups'"),
this won't work as expected anymore. So, let's add KERN_CONT
to those lines.

While here, add missing log level annotations.

Signed-off-by: Mauro Carvalho Chehab <mchehab@s-opensource.com>
2016-11-18 08:05:40 -02:00
Mauro Carvalho Chehab
fa132a64e2 [media] bt8xx: use pr_foo() macros instead of printk()
Replace printk() macros by their pr_foo() counterparts, using
pr_cont() for continuation lines.

Signed-off-by: Mauro Carvalho Chehab <mchehab@s-opensource.com>
2016-11-18 08:02:20 -02:00
Mauro Carvalho Chehab
7c64691353 [media] bt8xx/dst: use a more standard way to print messages
This driver uses a weird, non-standard macro to print errors.
It allows hiding all messages, including error ones, with doesn't
seem a good idea.

Instead, replace it to pr_foo(), and, for error messages,
use pr_err().

The remaining messages were previouly classified as notice,
info or debug, but they all looked like debug messages.

So, add a dprintk() macro using the "verbose" modprobe
argument to select what will be displayed.

Signed-off-by: Mauro Carvalho Chehab <mchehab@s-opensource.com>
2016-11-18 08:01:29 -02:00
Mauro Carvalho Chehab
fed9d8f3cd [media] stv090x: get rid of continuation lines
This driver has printk continuation lines for debugging purposes.
Since commit 563873318d ("Merge branch 'printk-cleanups'")',
this won't work as expected anymore.

So, use %*ph and get rid of it.

Signed-off-by: Mauro Carvalho Chehab <mchehab@s-opensource.com>
2016-11-18 07:56:23 -02:00
Mauro Carvalho Chehab
a8cd47d360 [media] stb0899_drv: get rid of continuation lines
This driver has printk continuation lines for debugging purposes.
Since commit 563873318d ("Merge branch 'printk-cleanups'")',
this won't work as expected anymore.

So, use %*ph and get rid of it.

Signed-off-by: Mauro Carvalho Chehab <mchehab@s-opensource.com>
2016-11-18 07:55:38 -02:00
Mauro Carvalho Chehab
36f94a5cf0 Linux 4.9-rc5
-----BEGIN PGP SIGNATURE-----
 
 iQEcBAABAgAGBQJYKLHHAAoJEHm+PkMAQRiGOqoH/iTmywTeevTpx4jbEb8u3LAR
 Bi1ACuBjJKJgYemRPdnH9e1/6nHRkw8EhwUIb2Jv4pyRb+pV2ssxy5sRinY8k9qw
 9pRf+DS9158c5Mc5lZTc3wnRMs49+zowgGpzUjw2HIFoq3E3H0bYpsCl144e4Y8z
 0R6jDKL/YXa9tzVVDTjHG9aG/l0Anc2VzFnWSalNhX5W2PSKc2QtticR3+kTVnA3
 oP4q5UCymdwrZ33XLVldmHqE3n9m8wKGn+gBUMCoJwt5DVRSjqXeT+IkmLdESHEH
 2GyFBE120coYLxTN8CAB4Wa/Woyr0VG6OJvX+Lq3zbnehjteAGOXHzBwYrIOsGc=
 =EwHz
 -----END PGP SIGNATURE-----

Merge tag 'v4.9-rc5' into patchwork

Linux 4.9-rc5

* tag 'v4.9-rc5': (1102 commits)
  Linux 4.9-rc5
  gp8psk: Fix DVB frontend attach
  gp8psk: fix gp8psk_usb_in_op() logic
  dvb-usb: move data_mutex to struct dvb_usb_device
  iio: maxim_thermocouple: detect invalid storage size in read()
  aoe: fix crash in page count manipulation
  lightnvm: invalid offset calculation for lba_shift
  Kbuild: enable -Wmaybe-uninitialized warnings by default
  pcmcia: fix return value of soc_pcmcia_regulator_set
  infiniband: shut up a maybe-uninitialized warning
  crypto: aesni: shut up -Wmaybe-uninitialized warning
  rc: print correct variable for z8f0811
  dib0700: fix nec repeat handling
  s390: pci: don't print uninitialized data for debugging
  nios2: fix timer initcall return value
  x86: apm: avoid uninitialized data
  NFSv4.1: work around -Wmaybe-uninitialized warning
  Kbuild: enable -Wmaybe-uninitialized warning for "make W=1"
  lib/stackdepot: export save/fetch stack for drivers
  mm: kmemleak: scan .data.ro_after_init
  ...
2016-11-16 16:42:27 -02:00
Marek Szyprowski
c0026c7bfb [media] s5p-mfc: Fix clock management in s5p_mfc_release() function
Clock control indirectly requires access to MFC device, so call it only
if we are sure that the device exists in s5p_mfc_release function.
s5p_mfc_remove() calls s5p_mfc_final_pm(), which releases all PM related
resources, including clocks, so any call to clocks related functions
is not valid after s5p_mfc_final_pm().

Fixes: d695c12 ("[media] media: s5p-mfc fix invalid memory access from
s5p_mfc_release()")

Signed-off-by: Marek Szyprowski <m.szyprowski@samsung.com>
Signed-off-by: Sylwester Nawrocki <s.nawrocki@samsung.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab@s-opensource.com>
2016-11-16 16:40:39 -02:00
Marek Szyprowski
c5086f130a [media] s5p-mfc: Use clock gating only on MFC v5 hardware
Newer MFC hardware have internal clock gating feature, so additional
software-triggered clock gating sometimes causes misbehavior of the MFC
firmware and results in freeze or crash. This patch changes the driver
to use software-triggered clock gating only when working with v5 MFC
hardware, where it has been proven to work properly.

Signed-off-by: Marek Szyprowski <m.szyprowski@samsung.com>
Signed-off-by: Sylwester Nawrocki <s.nawrocki@samsung.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab@s-opensource.com>
2016-11-16 16:40:13 -02:00
Donghwa Lee
5d1ec73184 [media] s5p-mfc: Skip incomplete frame
Currently, when incomplete frame is received in the middle of
decoding, driver treats it as an error, so src/dst queue and
clock are cleaned. Although it is obviously error case, it is
needed to maintain video decoding in case of necessity. This
patch supports skip incomplete frame to next.

Signed-off-by: Donghwa Lee <dh09.lee@samsung.com>
Signed-off-by: Seung-Woo Kim <sw0312.kim@samsung.com>
Signed-off-by: Marek Szyprowski <m.szyprowski@samsung.com>
Signed-off-by: Sylwester Nawrocki <s.nawrocki@samsung.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab@s-opensource.com>
2016-11-16 16:39:35 -02:00
Ingi Kim
dd62b8f1a3 [media] s5p-mfc: Fix MFC context buffer size
When video file was decoded by H/W MFCv8. It occurred IOMMU page fault
because of accessing abnormal memory of mfc ctx buf.

So this patch supports buffer size of mfc context more.
Relevant page fault error is below.

[ 3524.617147] PAGE FAULT occurred at 0x10108000 by 11200000.sysmmu(Page table base: 0x6d86c000)
[ 3524.624192]  Lv1 entry: 0x6c27d001
[ 3524.627567]   Lv2 entry: 0x0
[ 3524.630482] ------------[ cut here ]------------
[ 3524.635020] kernel BUG at drivers/iommu/exynos-iommu.c:358!
[ 3524.640567] Internal error: Oops - BUG: 0 [#1] PREEMPT SMP ARM
[ 3524.646373] Modules linked in:
[ 3524.649410] CPU: 0 PID: 0 Comm: swapper/0 Not tainted 4.0.0-00001-g0ff9b87-dirty #18
[ 3524.657117] Hardware name: SAMSUNG EXYNOS (Flattened Device Tree)
[ 3524.663184] task: c0e4aff0 ti: c0e3c000 task.ti: c0e3c000
[ 3524.668566] PC is at exynos_sysmmu_irq+0x1b8/0x2c4
[ 3524.673330] LR is at vprintk_emit+0x2b8/0x58c
[ 3524.677657] pc : [<c037cc78>]    lr : [<c00704a4>]    psr: 600d0193
[ 3524.677657] sp : c0e3dd90  ip : 00000000  fp : c0e3ddcc
[ 3524.689092] r10: ee29a110  r9 : 00000000  r8 : ee29a128
[ 3524.694292] r7 : ed812810  r6 : 10108000  r5 : ed86c000  r4 : 00000000
[ 3524.700791] r3 : c0ec9bd8  r2 : 00000000  r1 : 00000000  r0 : ed82ff00
[ 3524.707292] Flags: nZCv  IRQs off  FIQs on  Mode SVC_32  ISA ARM  Segment kernel
[ 3524.714656] Control: 10c5387d  Table: 6b08c06a  DAC: 00000015
[ 3524.720375] Process swapper/0 (pid: 0, stack limit = 0xc0e3c210)
[ 3524.726354] Stack: (0xc0e3dd90 to 0xc0e3e000)
[ 3524.730689] dd80:                                     c0e3dd9c c0069d68 ee58c338 6d86c000
[ 3524.738836] dda0: ee58c338 ee298c40 ee2915a0 0000003b c0e64ef4 c0e3c000 00000000 00000000
[ 3524.746981] ddc0: c0e3de14 c0e3ddd0 c0071ef4 c037cacc ffffffff a00d0193 c0e3ddf4 ee291540
[ 3524.755126] dde0: c0ec793c c0ec7928 7fffffff ee291540 ee2915a0 ee298c40 c0e64ef4 ee004660
[ 3524.763272] de00: ee010800 c0e3df00 c0e3de34 c0e3de18 c0072138 c0071e9c 00020000 ee291540
[ 3524.771418] de20: ee2915a0 00000016 c0e3de4c c0e3de38 c0075130 c00720f8 0000003b ee028300
[ 3524.779563] de40: c0e3de64 c0e3de50 c0071450 c0075068 00000100 00000012 c0e3de8c c0e3de68
[ 3524.787708] de60: c030d240 c0071420 c030d19c 00000016 00000000 00000016 00000000 00000001
[ 3524.795854] de80: c0e3dea4 c0e3de90 c0071450 c030d1a8 00000092 c0e37a1c c0e3ded4 c0e3dea8
[ 3524.804000] dea0: c0071790 c0071420 c0e3df00 f000200c 00000016 c0e440a8 c0e3df00 f0002000
[ 3524.812145] dec0: c095bc8c 00000001 c0e3defc c0e3ded8 c0008730 c0071710 c0010d88 c0010d8c
[ 3524.820290] dee0: 600d0013 ffffffff c0e3df34 c0ec7eb4 c0e3df54 c0e3df00 c0014780 c00086fc
[ 3524.828436] df00: 00000001 00000000 00000000 c0020780 c0e3c000 c0e43530 00000000 00000000
[ 3524.836581] df20: c0ec7eb4 c095bc8c 00000001 c0e3df54 c0e3df58 c0e3df48 c0010d88 c0010d8c
[ 3524.844727] df40: 600d0013 ffffffff c0e3df94 c0e3df58 c0062690 c0010d50 c0ec75f0 00000001
[ 3524.852872] df60: c0e3df84 c0e4353c c0e39580 c0e43e84 c0e3c000 00000002 c0e3df58 c0e38b88
[ 3524.861018] df80: c0952b9c ffffffff c0e3dfac c0e3df98 c094d1b8 c00622d4 c0e3c000 c0e43e10
[ 3524.869163] dfa0: c0e3dff4 c0e3dfb0 c0d86d30 c094d130 ffffffff ffffffff c0d866f0 00000000
[ 3524.877309] dfc0: 00000000 c0df06d8 00000000 c0ee3f14 c0e434c0 c0df06d4 c0e4c20c 4000406a
[ 3524.885454] dfe0: 410fc073 00000000 00000000 c0e3dff8 40008074 c0d86970 00000000 00000000
[ 3524.893610] [<c037cc78>] (exynos_sysmmu_irq) from [<c0071ef4>] (handle_irq_event_percpu+0x64/0x25c)
[ 3524.902615] [<c0071ef4>] (handle_irq_event_percpu) from [<c0072138>] (handle_irq_event+0x4c/0x6c)
[ 3524.911454] [<c0072138>] (handle_irq_event) from [<c0075130>] (handle_level_irq+0xd4/0x14c)
[ 3524.919773] [<c0075130>] (handle_level_irq) from [<c0071450>] (generic_handle_irq+0x3c/0x4c)
[ 3524.928180] [<c0071450>] (generic_handle_irq) from [<c030d240>] (combiner_handle_cascade_irq+0xa4/0x110)
[ 3524.937624] [<c030d240>] (combiner_handle_cascade_irq) from [<c0071450>] (generic_handle_irq+0x3c/0x4c)
[ 3524.946981] [<c0071450>] (generic_handle_irq) from [<c0071790>] (__handle_domain_irq+0x8c/0xfc)
[ 3524.955646] [<c0071790>] (__handle_domain_irq) from [<c0008730>] (gic_handle_irq+0x40/0x78)
[ 3524.963966] [<c0008730>] (gic_handle_irq) from [<c0014780>] (__irq_svc+0x40/0x74)
[ 3524.971412] Exception stack(0xc0e3df00 to 0xc0e3df48)
[ 3524.976441] df00: 00000001 00000000 00000000 c0020780 c0e3c000 c0e43530 00000000 00000000
[ 3524.984586] df20: c0ec7eb4 c095bc8c 00000001 c0e3df54 c0e3df58 c0e3df48 c0010d88 c0010d8c
[ 3524.992729] df40: 600d0013 ffffffff
[ 3524.996205] [<c0014780>] (__irq_svc) from [<c0010d8c>] (arch_cpu_idle+0x48/0x4c)
[ 3525.003567] [<c0010d8c>] (arch_cpu_idle) from [<c0062690>] (cpu_startup_entry+0x3c8/0x4a4)
[ 3525.011805] [<c0062690>] (cpu_startup_entry) from [<c094d1b8>] (rest_init+0x94/0x98)
[ 3525.019516] [<c094d1b8>] (rest_init) from [<c0d86d30>] (start_kernel+0x3cc/0x3d8)
[ 3525.026963] Code: e34c30ec e5932004 e3520000 ca000018 (e7f001f2)
[ 3525.033028] ---[ end trace 71ed544f653b4d46 ]---

Signed-off-by: Ingi Kim <ingi2.kim@samsung.com>
Signed-off-by: Seung-Woo Kim <sw0312.kim@samsung.com>
Signed-off-by: Marek Szyprowski <m.szyprowski@samsung.com>
Signed-off-by: Sylwester Nawrocki <s.nawrocki@samsung.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab@s-opensource.com>
2016-11-16 16:39:07 -02:00
Andrzej Hajda
f662f1b7e5 [media] s5p-mfc: Correct scratch buffer size of H.263 decoder
Driver complains about too small scratch buffer size. After adjusting
it according to vendor code, decoding works.

[mszyprow: moved the change to the header file]

Signed-off-by: Andrzej Hajda <a.hajda@samsung.com>
Signed-off-by: Marek Szyprowski <m.szyprowski@samsung.com>
Signed-off-by: Sylwester Nawrocki <s.nawrocki@samsung.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab@s-opensource.com>
2016-11-16 16:37:56 -02:00
Marek Szyprowski
92955ea0ba [media] exynos-gsc: Add support for Exynos5433 specific version
This patch adds support for Exynos5433 specific version of the GScaler
module. The main difference between Exynos 5433 and earlier is addition
of new clocks that have to be controlled.

Signed-off-by: Marek Szyprowski <m.szyprowski@samsung.com>
Reviewed-by: Javier Martinez Canillas <javier@osg.samsung.com>
Tested-by: Javier Martinez Canillas <javier@osg.samsung.com>
Acked-by: Krzysztof Kozlowski <krzk@kernel.org>
Signed-off-by: Sylwester Nawrocki <s.nawrocki@samsung.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab@s-opensource.com>
2016-11-16 16:37:24 -02:00
Marek Szyprowski
6f99e1b85a [media] exynos-gsc: Enable driver on ARCH_EXYNOS
This driver can be also used on Exynos5433, which is ARM64-based
platform, which selects only ARCH_EXYNOS symbol.

Signed-off-by: Marek Szyprowski <m.szyprowski@samsung.com>
Reviewed-by: Javier Martinez Canillas <javier@osg.samsung.com>
Tested-by: Javier Martinez Canillas <javier@osg.samsung.com>
Acked-by: Krzysztof Kozlowski <krzk@kernel.org>
Signed-off-by: Sylwester Nawrocki <s.nawrocki@samsung.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab@s-opensource.com>
2016-11-16 16:36:38 -02:00
Marek Szyprowski
aa7929f595 [media] exynos-gsc: Use of_device_get_match_data() helper
Replace open-coded driver data extraction code with generic helper.

Signed-off-by: Marek Szyprowski <m.szyprowski@samsung.com>
Tested-by: Javier Martinez Canillas <javier@osg.samsung.com>
Signed-off-by: Sylwester Nawrocki <s.nawrocki@samsung.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab@s-opensource.com>
2016-11-16 16:36:10 -02:00
Marek Szyprowski
e0f013990e [media] exynos-gsc: Add missing newline char in debug messages
Fix missing newline char in debug messages.

Signed-off-by: Marek Szyprowski <m.szyprowski@samsung.com>
Tested-by: Javier Martinez Canillas <javier@osg.samsung.com>
Signed-off-by: Sylwester Nawrocki <s.nawrocki@samsung.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab@s-opensource.com>
2016-11-16 16:35:43 -02:00
Marek Szyprowski
d641cf2694 [media] exynos-gsc: Remove unused lclk_freqency entry
Remove dead, unused code.

Signed-off-by: Marek Szyprowski <m.szyprowski@samsung.com>
Tested-by: Javier Martinez Canillas <javier@osg.samsung.com>
Signed-off-by: Sylwester Nawrocki <s.nawrocki@samsung.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab@s-opensource.com>
2016-11-16 16:35:12 -02:00
Marek Szyprowski
8098f9ca94 [media] exynos-gsc: Simplify system PM even more
System PM callbacks only ensure that device is runtime suspended/resumed,
so remove them and use generic pm_runtime_force_suspend/resume helper.

Signed-off-by: Marek Szyprowski <m.szyprowski@samsung.com>
Reviewed-by: Ulf Hansson <ulf.hansson@linaro.org>
Tested-by: Javier Martinez Canillas <javier@osg.samsung.com>
Signed-off-by: Sylwester Nawrocki <s.nawrocki@samsung.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab@s-opensource.com>
2016-11-16 16:34:21 -02:00
Ulf Hansson
701a8de6ef [media] exynos-gsc: Simplify system PM
It's not needed to keep a local flag about the current system PM state.
Let's just remove that code and the corresponding debug print.

[mszyprow: rebased onto v4.9-rc4]

Signed-off-by: Ulf Hansson <ulf.hansson@linaro.org>
Signed-off-by: Marek Szyprowski <m.szyprowski@samsung.com>
Tested-by: Javier Martinez Canillas <javier@osg.samsung.com>
Signed-off-by: Sylwester Nawrocki <s.nawrocki@samsung.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab@s-opensource.com>
2016-11-16 16:33:52 -02:00
Ulf Hansson
7ebcb3e842 [media] exynos-gsc: Do full clock gating at runtime PM suspend
To potentially save more power in runtime PM suspend state, let's
also prepare/unprepare the clock from the runtime PM callbacks.

[mszyprow: rebased onto v4.9-rc4]

Signed-off-by: Ulf Hansson <ulf.hansson@linaro.org>
Signed-off-by: Marek Szyprowski <m.szyprowski@samsung.com>
Tested-by: Javier Martinez Canillas <javier@osg.samsung.com>
Signed-off-by: Sylwester Nawrocki <s.nawrocki@samsung.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab@s-opensource.com>
2016-11-16 16:33:09 -02:00
Ulf Hansson
a006c04e62 [media] exynos-gsc: Fixup clock management at ->remove()
To make sure the clock is fully gated in ->remove(), we first need to
to bring the device into full power by invoking pm_runtime_get_sync().

Then, let's both unprepare and disable the clock.

[mszyprow: rebased onto v4.9-rc4]

Signed-off-by: Ulf Hansson <ulf.hansson@linaro.org>
Signed-off-by: Marek Szyprowski <m.szyprowski@samsung.com>
Tested-by: Javier Martinez Canillas <javier@osg.samsung.com>
Signed-off-by: Sylwester Nawrocki <s.nawrocki@samsung.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab@s-opensource.com>
2016-11-16 16:32:17 -02:00
Ulf Hansson
81aa8d141f [media] exynos-gsc: Make PM callbacks available conditionally
There are no need to set up the PM callbacks (runtime and system) unless
they are being used. It also causes compiler warnings about unused
functions.

Silence the warnings by making them available for CONFIG_PM (runtime
callbacks) and CONFIG_PM_SLEEP (system sleep callbacks).

[mszyprow: squashed two patches into one to avoid potential build
break, changed patch subject and updated commit message]

Signed-off-by: Ulf Hansson <ulf.hansson@linaro.org>
Signed-off-by: Marek Szyprowski <m.szyprowski@samsung.com>
Signed-off-by: Sylwester Nawrocki <s.nawrocki@samsung.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab@s-opensource.com>
2016-11-16 16:31:54 -02:00
Ulf Hansson
15f90ab57a [media] exynos-gsc: Make driver functional when CONFIG_PM is unset
The driver depended on CONFIG_PM to be functional. Let's remove that
dependency, by enable the runtime PM resourses during ->probe() and
update the device's runtime PM status to reflect this.

[mszyprow: rebased onto v4.9-rc4]

Signed-off-by: Ulf Hansson <ulf.hansson@linaro.org>
Signed-off-by: Marek Szyprowski <m.szyprowski@samsung.com>
Tested-by: Javier Martinez Canillas <javier@osg.samsung.com>
Signed-off-by: Sylwester Nawrocki <s.nawrocki@samsung.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab@s-opensource.com>
2016-11-16 16:31:24 -02:00
Ulf Hansson
f9fd6ee6fb [media] exynos-gsc: Convert gsc_m2m_resume() from int to void
Since gsc_m2m_resume() always returns 0, convert it to a void instead.

[mszyprow: rebased onto v4.9-rc4]

Signed-off-by: Ulf Hansson <ulf.hansson@linaro.org>
Signed-off-by: Marek Szyprowski <m.szyprowski@samsung.com>
Tested-by: Javier Martinez Canillas <javier@osg.samsung.com>
Signed-off-by: Sylwester Nawrocki <s.nawrocki@samsung.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab@s-opensource.com>
2016-11-16 16:30:45 -02:00
Ulf Hansson
d83db90456 [media] exynos-gsc: Simplify clock management
Instead of having separate functions that fetches, prepares and
unprepares the clock, let's encapsulate this code into ->probe().

This makes error handling easier and decreases the lines of code.

[mszyprow: rebased onto v4.9-rc4]

Signed-off-by: Ulf Hansson <ulf.hansson@linaro.org>
Signed-off-by: Marek Szyprowski <m.szyprowski@samsung.com>
Tested-by: Javier Martinez Canillas <javier@osg.samsung.com>
Signed-off-by: Sylwester Nawrocki <s.nawrocki@samsung.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab@s-opensource.com>
2016-11-16 16:30:16 -02:00
Shuah Khan
43e6347f40 [media] s5p-mfc: include buffer size in error message
Include buffer size in s5p_mfc_alloc_priv_buf() the error message
when it fails to allocate the buffer.

Signed-off-by: Shuah Khan <shuahkh@osg.samsung.com>
Signed-off-by: Sylwester Nawrocki <s.nawrocki@samsung.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab@s-opensource.com>
2016-11-16 16:29:42 -02:00
Javier Martinez Canillas
76ca0824af [media] exynos-gsc: cleanup m2m src and dst vb2 queues on STREAMOFF
Media drivers that use the videobuf2 framework have to give back to vb2
all the buffers that received from vb2 using its .buf_queue callback.

But the exynos-gsc driver isn't doing a proper cleanup so vb2 complains
that the number of buffers enqueued and received are not balanced:

WARNING: CPU: 2 PID: 660 at drivers/media/v4l2-core/videobuf2-core.c:1654 __vb2_queue_cancel+0xec/0x150 [videobuf2_core]
Modules linked in: mwifiex_sdio mwifiex uvcvideo exynos_gsc videobuf2_vmalloc s5p_mfc s5p_jpeg
CPU: 2 PID: 660 Comm: lt-gst-validate Not tainted 4.8.0
Hardware name: SAMSUNG EXYNOS (Flattened Device Tree)
[<c010e24c>] (unwind_backtrace) from [<c010af30>] (show_stack+0x10/0x14)
[<c010af30>] (show_stack) from [<c03291a4>] (dump_stack+0x88/0x9c)
[<c03291a4>] (dump_stack) from [<c011a858>] (__warn+0xe8/0x100)
[<c011a858>] (__warn) from [<c011a920>] (warn_slowpath_null+0x20/0x28)
[<c011a920>] (warn_slowpath_null) from [<bf0b6ed0>] (__vb2_queue_cancel+0xec/0x150 [videobuf2_core])
[<bf0b6ed0>] (__vb2_queue_cancel [videobuf2_core]) from [<bf0b7464>] (vb2_core_streamoff+0x34/0x9c [videobuf2_core])
[<bf0b7464>] (vb2_core_streamoff [videobuf2_core]) from [<bf11b9e8>] (v4l2_m2m_streamoff+0x2c/0xe4 [v4l2_mem2mem])
[<bf11b9e8>] (v4l2_m2m_streamoff [v4l2_mem2mem]) from [<bf01b84c>] (__video_do_ioctl+0x298/0x30c [videodev])
[<bf01b84c>] (__video_do_ioctl [videodev]) from [<bf01b234>] (video_usercopy+0x174/0x4e8 [videodev])
[<bf01b234>] (video_usercopy [videodev]) from [<bf0165c8>] (v4l2_ioctl+0xc4/0xd8 [videodev])
[<bf0165c8>] (v4l2_ioctl [videodev]) from [<c01f291c>] (do_vfs_ioctl+0x9c/0x8f4)
[<c01f291c>] (do_vfs_ioctl) from [<c01f31a8>] (SyS_ioctl+0x34/0x5c)
[<c01f31a8>] (SyS_ioctl) from [<c01078c0>] (ret_fast_syscall+0x0/0x3c)

Fix this by passing back to vb2 all the received buffers that were not
processed.

Signed-off-by: Javier Martinez Canillas <javier@osg.samsung.com>
Signed-off-by: Sylwester Nawrocki <s.nawrocki@samsung.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab@s-opensource.com>
2016-11-16 16:29:17 -02:00
Javier Martinez Canillas
115a16ba3f [media] exynos-gsc: unregister video device node on driver removal
The driver doesn't unregister the video device node when the driver is
removed, this keeps video device nodes that makes the machine to crash
with a NULL pointer dereference when nodes are attempted to be opened:

[   36.530006] Unable to handle kernel paging request at virtual address bf1f8200
[   36.535985] pgd = edbbc000
[   36.538486] [bf1f8200] *pgd=6d99a811, *pte=00000000, *ppte=00000000
[   36.544727] Internal error: Oops: 7 [#1] PREEMPT SMP ARM
[   36.550016] Modules linked in: s5p_jpeg s5p_mfc v4l2_mem2mem videobuf2_dma_contig
[   36.566303] CPU: 6 PID: 533 Comm: v4l2-ctl Not tainted 4.8.0
[   36.574466] Hardware name: SAMSUNG EXYNOS (Flattened Device Tree)
[   36.580526] task: ee3cc600 task.stack: ed626000
[   36.585046] PC is at try_module_get+0x1c/0xac
[   36.589364] LR is at try_module_get+0x1c/0xac
[   36.593698] pc : [<c0187a60>]    lr : [<c0187a60>]    psr: 80070013
[   36.593698] sp : ed627de0  ip : a0070013  fp : 00000000
[   36.605156] r10: 00000002  r9 : ed627ed0  r8 : 00000000
[   36.610331] r7 : c01e5f14  r6 : ed57be00  r5 : bf1f8200  r4 : bf1f8200
[   36.616834] r3 : 00000002  r2 : 00000002  r1 : 01930192  r0 : 00000001
..
[   36.785004] [<c0187a60>] (try_module_get) from [<c01e5c10>] (cdev_get+0x1c/0x4c)
[   36.792362] [<c01e5c10>] (cdev_get) from [<c01e5f40>] (chrdev_open+0x2c/0x178)
[   36.799555] [<c01e5f40>] (chrdev_open) from [<c01df5d4>] (do_dentry_open+0x1e0/0x300)
[   36.807360] [<c01df5d4>] (do_dentry_open) from [<c01eecdc>] (path_openat+0x35c/0xf58)
[   36.815154] [<c01eecdc>] (path_openat) from [<c01f0668>] (do_filp_open+0x5c/0xc0)
[   36.822606] [<c01f0668>] (do_filp_open) from [<c01e09ac>] (do_sys_open+0x10c/0x1bc)
[   36.830235] [<c01e09ac>] (do_sys_open) from [<c01078c0>] (ret_fast_syscall+0x0/0x3c)
[   36.837942] Code: 0a00001c e1a04000 e3a00001 ebfec92d (e5943000)

Signed-off-by: Javier Martinez Canillas <javier@osg.samsung.com>
Signed-off-by: Sylwester Nawrocki <s.nawrocki@samsung.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab@s-opensource.com>
2016-11-16 16:28:48 -02:00
Javier Martinez Canillas
f4ca5030b3 [media] exynos-gsc: don't release a non-dynamically allocated video_device
The struct v4l2_device instance for the G-Scaler is not dyanmically
allocated but a member of the struct gsc_dev. In fact, the assigned
.release callback is video_device_release_empty().

But gsc_register_m2m_device() attempts to release the v4l2_device by
calling video_device_release() in its error path. This is wrong since
the v4l2_device wasn't allocated directly and will be freed once its
parent struct gsc_dev is freed.

While being there, rename the remaining goto label in the error path
to something that better explains the error path cleanup.

Signed-off-by: Javier Martinez Canillas <javier@osg.samsung.com>
Signed-off-by: Sylwester Nawrocki <s.nawrocki@samsung.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab@s-opensource.com>
2016-11-16 16:28:22 -02:00
Javier Martinez Canillas
652bb68018 [media] exynos-gsc: do proper bytesperline and sizeimage calculation
The driver don't take into account the differences between packed, semi
planar and multi planar formats when calculating the pixel format bytes
per lines and image size values. This makes GStreamer to fail when the
following formats are used NV12, NV21, NV16, NV61, YV12, I420 and Y42B:

"gst_video_frame_map_id: failed to map video frame plane 1"

Nicolas suggested to use the logic found in the Exynos FIMC v4l2 driver
since does this correctly. So this patch changes the bytes per line and
image size calculation according to what's done in this media driver.

After this patch most supported formats work correctly. There are still
issues with the NV21 and NV61 formats, but that seems to be a separate
problem since NV12 and NV16 work and these formats use the same values.

So this can be fixed as a follow-up and shouldn't be a blocker for this
change that improves the driver's support.

Suggested-by: Nicolas Dufresne <nicolas.dufresne@collabora.com>
Signed-off-by: Javier Martinez Canillas <javier@osg.samsung.com>
Signed-off-by: Sylwester Nawrocki <s.nawrocki@samsung.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab@s-opensource.com>
2016-11-16 16:27:52 -02:00
Javier Martinez Canillas
8a661745b7 [media] exynos-gsc: fix supported RGB pixel format
The driver exposes 32-bit A/XRGB 8-8-8-8 as supported format but testing
shows that using this format produces frames with wrong colors. The test
was done with the following GStreamer pipeline:

$ gst-launch-1.0 videotestsrc num-buffers=20 ! video/x-raw,format=UYVY \
! v4l2video3convert ! video/x-raw,format=xRGB ! videoconvert ! kmssink

The manual seems to state that the Pixel Format are in Little Endianness
so instead use the 32-bit BGRA/X 8-8-8-8 pixel format. This format works
correctly when using the following pipeline:

$ gst-launch-1.0 videotestsrc num-buffers=20 ! video/x-raw,format=UYVY \
! v4l2video3convert ! video/x-raw,format=BGRx ! kmssink

This change is similar to commit 7f2816e51e ("[media] s5p-fimc: Changed
RGB32 to BGR32") that fixed the same issue on a different Samsung driver.

Suggested-by: Nicolas Dufresne <nicolas.dufresne@collabora.com>
Signed-off-by: Javier Martinez Canillas <javier@osg.samsung.com>
Signed-off-by: Sylwester Nawrocki <s.nawrocki@samsung.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab@s-opensource.com>
2016-11-16 16:27:26 -02:00
Javier Martinez Canillas
daba4dfbd2 [media] exynos-gsc: don't clear format when freeing buffers with REQBUFS(0)
User-space applications can use the VIDIOC_REQBUFS ioctl to determine if a
memory mapped, user pointer or DMABUF based I/O is supported by a driver.

For example, GStreamer attempts to determine the I/O methods supported by
the driver by doing many VIDIOC_REQBUFS ioctl calls with different memory
types and count 0. And then the real VIDIOC_REQBUFS call with count == n
is be made to allocate the buffers. But for count 0, the driver not only
frees the buffers but also clears the format set before with VIDIOC_S_FMT.

This is a problem since STREAMON fails if a format isn't set but GStreamer
first sets a format and then tries to determine the supported I/O methods,
so the format will be cleared on REQBUFS(0), before the call to STREAMON.

To avoid this issue, only free the buffers on VIDIOC_REQBUFS(0) but don't
clear the format. Since is completely valid to set the format and then do
different calls to REQBUFS before a call to STREAMON.

Signed-off-by: Javier Martinez Canillas <javier@osg.samsung.com>
Signed-off-by: Sylwester Nawrocki <s.nawrocki@samsung.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab@s-opensource.com>
2016-11-16 16:26:35 -02:00
Javier Martinez Canillas
def2cc8c40 [media] exynos-gsc: change spamming try_fmt log message to debug
The driver try_fmt handler prints a message each time that the image
size has been changed due the maximum and minimum width and height.

Since user-space can try different format and sizes, this logs a lot
of unnecessary messages. Change the message log level to debug and
while being there, also add a new line to the message.

Signed-off-by: Javier Martinez Canillas <javier@osg.samsung.com>
Signed-off-by: Sylwester Nawrocki <s.nawrocki@samsung.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab@s-opensource.com>
2016-11-16 16:26:00 -02:00
Shuah Khan
0f7a55b4e0 [media] s5p-mfc: Collapse two error message into one
s5p_mfc_alloc_priv_buf() prints two message to report invalid memory
configuration error. Collapse them into a single message.

Signed-off-by: Shuah Khan <shuahkh@osg.samsung.com>
Signed-off-by: Sylwester Nawrocki <s.nawrocki@samsung.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab@s-opensource.com>
2016-11-16 16:25:37 -02:00
Nicolas Dufresne
90b4c9c65a [media] exynos4-is: fimc: Roundup imagesize to row size for tiled formats
For tiled format, we need to allocated a multiple of the row size. A
good example is for 1280x720, wich get adjusted to 1280x736. In tiles,
this mean Y plane is 20x23 and UV plane 20x12. Because of the rounding,
the previous code would only have enough space to fit half of the last
row.

[mchehab@s-opensource.com: fix coding style]
Signed-off-by: Nicolas Dufresne <nicolas.dufresne@collabora.com>
Signed-off-by: Sylwester Nawrocki <s.nawrocki@samsung.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab@s-opensource.com>
2016-11-16 16:24:53 -02:00
Kieran Bingham
4710b752e0 [media] v4l: Add Renesas R-Car FDP1 Driver
The FDP1 driver performs advanced de-interlacing on a memory 2 memory
based video stream, and supports conversion from YCbCr/YUV
to RGB pixel formats

Signed-off-by: Kieran Bingham <kieran+renesas@bingham.xyz>
Reviewed-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
Signed-off-by: Laurent Pinchart <laurent.pinchart+renesas@ideasonboard.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab@s-opensource.com>
2016-11-16 16:21:54 -02:00
Laurent Pinchart
446e412597 [media] v4l: ctrls: Add deinterlacing mode control
The menu control selects the operation mode of a video deinterlacer. The
menu entries are driver specific.

Signed-off-by: Laurent Pinchart <laurent.pinchart+renesas@ideasonboard.com>
Reviewed-by: Kieran Bingham <kieran@bingham.xyz>
Acked-by: Hans Verkuil <hans.verkuil@cisco.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab@s-opensource.com>
2016-11-16 16:16:08 -02:00
Peter Ujfalusi
a9943f6b6b [media] v4l: omap3isp: Use dma_request_chan_by_mask() to request the DMA channel
When requesting the DMA channel it was mandatory that we do not have DMA
resource nor valid DMA channel via DT. In this case the
dma_request_slave_channel_compat() would fall back and request any channel
with SW trigger.

The same can be achieved with the dma_request_chan_by_mask() without the
misleading use of the DMAengine API - implying that the omap3isp does
need to have DMA resource or valid dma binding in DT.

Signed-off-by: Peter Ujfalusi <peter.ujfalusi@ti.com>
Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab@s-opensource.com>
2016-11-16 16:14:20 -02:00