]> git.karo-electronics.de Git - karo-tx-linux.git/log
karo-tx-linux.git
7 years ago[media] platform/Makefile: don't depend on arch to include dirs
Mauro Carvalho Chehab [Thu, 8 Jun 2017 15:14:09 +0000 (12:14 -0300)]
[media] platform/Makefile: don't depend on arch to include dirs

Depending on arch configs to include dirs is evil, and makes
harder to change drivers to work with COMPILE_TEST.

Replace them by obj-y.

Signed-off-by: Mauro Carvalho Chehab <mchehab@s-opensource.com>
7 years ago[media] davinci: Switch from V4L2 OF to V4L2 fwnode
Sakari Ailus [Thu, 8 Jun 2017 15:04:07 +0000 (12:04 -0300)]
[media] davinci: Switch from V4L2 OF to V4L2 fwnode

The DaVinci VPIF capture driver V4L2 OF support was added after the V4L2
OF framework got removed. Switch VPIF capture driver to V4L2 fwnode.

Signed-off-by: Sakari Ailus <sakari.ailus@linux.intel.com>
7 years ago[media] pvrusb2: remove redundant check on cnt > 8
Colin Ian King [Sun, 7 May 2017 18:33:05 +0000 (15:33 -0300)]
[media] pvrusb2: remove redundant check on cnt > 8

The 2nd check of cnt > 8 is redundant as cnt is already checked
and thresholded to a maximum of 8 a few statements earlier.
Remove this redundant 2nd check.

Detected by CoverityScan, CID#114281 ("Logically dead code")

Signed-off-by: Colin Ian King <colin.king@canonical.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab@s-opensource.com>
7 years ago[media] dvb_ca_en50221: Fix wrong EXPORT_SYMBOL order
Jasmin Jessich [Sun, 7 May 2017 21:23:34 +0000 (18:23 -0300)]
[media] dvb_ca_en50221: Fix wrong EXPORT_SYMBOL order

Some EXPORT_SYMBOL() on this file don't match the name of functions
that preceeds them.

Also, some kernel-doc markups also have a wrong name. Fix it.

Signed-off-by: Jasmin Jessich <jasmin@anw.at>
Signed-off-by: Mauro Carvalho Chehab <mchehab@s-opensource.com>
7 years ago[media] dvb_ca_en50221: use foo *bar, instead of foo * bar
Jasmin Jessich [Sun, 7 May 2017 21:23:28 +0000 (18:23 -0300)]
[media] dvb_ca_en50221: use foo *bar, instead of foo * bar

Make checkpatch happier by fixing this warning:
  ERROR: "foo * bar" should be "foo *bar"

Signed-off-by: Jasmin Jessich <jasmin@anw.at>
Signed-off-by: Mauro Carvalho Chehab <mchehab@s-opensource.com>
7 years ago[media] staging: atomisp: Fix endless recursion in hmm_init
Hans de Goede [Fri, 2 Jun 2017 20:04:23 +0000 (17:04 -0300)]
[media] staging: atomisp: Fix endless recursion in hmm_init

hmm_init calls hmm_alloc to set dummy_ptr, hmm_alloc calls
hmm_init when dummy_ptr is not yet set, which is the case in
the call from hmm_init, so it calls hmm_init again, this continues
until we have a stack overflow due to the recursion.

This commit fixes this by adding a separate flag for tracking if
hmm_init has been called. Not pretty, but it gets the job done,
eventually we should be able to remove the hmm_init call from
hmm_alloc.

Signed-off-by: Hans de Goede <hdegoede@redhat.com>
Signed-off-by: Hans Verkuil <hans.verkuil@cisco.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab@s-opensource.com>
7 years ago[media] staging: atomisp: lm3554: fix sparse warnings(was not declared. Should it...
Chen Guanqiao [Sun, 28 May 2017 18:06:41 +0000 (15:06 -0300)]
[media] staging: atomisp: lm3554: fix sparse warnings(was not declared. Should it be static?)

Fix "symbol 'xxxxxxx' was not declared. Should it be static?" sparse warnings.

Signed-off-by: Chen Guanqiao <chen.chenchacha@foxmail.com>
Reviewed-by: Alan Cox <alan@linux.intel.com>
Signed-off-by: Hans Verkuil <hans.verkuil@cisco.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab@s-opensource.com>
7 years ago[media] staging: atomisp: Make ov2680 driver less chatty
Hans de Goede [Sun, 28 May 2017 12:31:53 +0000 (09:31 -0300)]
[media] staging: atomisp: Make ov2680 driver less chatty

There is no reason for all this printk spamming and certainly
not at an error log level.

Signed-off-by: Hans de Goede <hdegoede@redhat.com>
Signed-off-by: Hans Verkuil <hans.verkuil@cisco.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab@s-opensource.com>
7 years ago[media] staging: atomisp: Ignore errors from second gpio in ov2680 driver
Hans de Goede [Sun, 28 May 2017 12:31:52 +0000 (09:31 -0300)]
[media] staging: atomisp: Ignore errors from second gpio in ov2680 driver

As the existing comment in the driver indicates the sensor has only 1 pin,
but some boards may have 2 gpios defined and we toggle both as we we don't
know which one is the right one. However if the ACPI resources table
defines only 1 gpio (as expected) the gpio1_ctrl call will always fail,
causing the probing of the driver to file.

This commit ignore the return value of the gpio1_ctrl call, fixing this.

Signed-off-by: Hans de Goede <hdegoede@redhat.com>
Signed-off-by: Hans Verkuil <hans.verkuil@cisco.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab@s-opensource.com>
7 years ago[media] staging: atomisp: Add OVTI2680 ACPI id to ov2680 driver
Hans de Goede [Sun, 28 May 2017 12:31:51 +0000 (09:31 -0300)]
[media] staging: atomisp: Add OVTI2680 ACPI id to ov2680 driver

Add OVTI2680 ACPI id to ov2680 driver

Signed-off-by: Hans de Goede <hdegoede@redhat.com>
Signed-off-by: Hans Verkuil <hans.verkuil@cisco.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab@s-opensource.com>
7 years ago[media] staging: atomisp: Add INT0310 ACPI id to gc0310 driver
Hans de Goede [Sun, 28 May 2017 12:31:50 +0000 (09:31 -0300)]
[media] staging: atomisp: Add INT0310 ACPI id to gc0310 driver

Add INT0310 ACPI id to gc0310 driver

Signed-off-by: Hans de Goede <hdegoede@redhat.com>
Signed-off-by: Hans Verkuil <hans.verkuil@cisco.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab@s-opensource.com>
7 years ago[media] staging: atomisp: Set step to 0 for mt9m114 menu control
Hans de Goede [Sun, 28 May 2017 12:31:49 +0000 (09:31 -0300)]
[media] staging: atomisp: Set step to 0 for mt9m114 menu control

menu controls are not allowed to have a step size, set step to 0 to
fix an oops from the WARN_ON in v4l2_ctrl_new_custom() triggering
because of this.

Signed-off-by: Hans de Goede <hdegoede@redhat.com>
Signed-off-by: Hans Verkuil <hans.verkuil@cisco.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab@s-opensource.com>
7 years ago[media] staging: atomisp: Do not call dev_warn with a NULL device
Hans de Goede [Sun, 28 May 2017 12:31:48 +0000 (09:31 -0300)]
[media] staging: atomisp: Do not call dev_warn with a NULL device

Do not call dev_warn with a NULL device, this silence the following 2
warnings:

[   14.392194] (NULL device *): Failed to find gmin variable gmin_V2P8GPIO
[   14.392257] (NULL device *): Failed to find gmin variable gmin_V1P8GPIO

We could switch to using pr_warn for dev == NULL instead, but as comments
in the source indicate, the check for these 2 special gmin variables with
a NULL device is a workaround for 2 specific evaluation boards, so
completely silencing the missing warning for these actually is a good
thing.

Signed-off-by: Hans de Goede <hdegoede@redhat.com>
Signed-off-by: Hans Verkuil <hans.verkuil@cisco.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab@s-opensource.com>
7 years ago[media] staging: atomisp: Fix calling efivar_entry_get() with unaligned arguments
Hans de Goede [Sun, 28 May 2017 12:31:47 +0000 (09:31 -0300)]
[media] staging: atomisp: Fix calling efivar_entry_get() with unaligned arguments

efivar_entry_get has certain alignment requirements and the atomisp
platform code was not honoring these, causing an oops by triggering the
WARN_ON in arch/x86/platform/efi/efi_64.c: virt_to_phys_or_null_size().

This commit fixes this by using the members of the efivar struct embedded
in the efivar_entry struct we kzalloc as arguments to efivar_entry_get(),
which is how all the other callers of efivar_entry_get() do this.

Signed-off-by: Hans de Goede <hdegoede@redhat.com>
Signed-off-by: Hans Verkuil <hans.verkuil@cisco.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab@s-opensource.com>
7 years ago[media] atomisp: de-duplicate sh_css_mmu_set_page_table_base_index
Alan Cox [Fri, 26 May 2017 15:29:48 +0000 (12:29 -0300)]
[media] atomisp: de-duplicate sh_css_mmu_set_page_table_base_index

Between the ISP2400 and ISP2401 code base this function moved file. The merge
of the drivers left us with two version in ifdefs. Resolve this down to a
single copy.

Signed-off-by: Alan Cox <alan@linux.intel.com>
Signed-off-by: Hans Verkuil <hans.verkuil@cisco.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab@s-opensource.com>
7 years ago[media] atomisp: remove sh_css_irq - it contains nothing
Alan Cox [Fri, 26 May 2017 15:29:36 +0000 (12:29 -0300)]
[media] atomisp: remove sh_css_irq - it contains nothing

We won't be adding abstractions or moving them here so kill it.

Signed-off-by: Alan Cox <alan@linux.intel.com>
Signed-off-by: Hans Verkuil <hans.verkuil@cisco.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab@s-opensource.com>
7 years ago[media] atomisp: Unify lut free logic
Alan Cox [Fri, 26 May 2017 15:29:25 +0000 (12:29 -0300)]
[media] atomisp: Unify lut free logic

ISP2401 introduced a helper for this which we can use just as well on the
ISP2400 and remove some more noise differences.

Signed-off-by: Alan Cox <alan@linux.intel.com>
Signed-off-by: Hans Verkuil <hans.verkuil@cisco.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab@s-opensource.com>
7 years ago[media] atomisp: Unify load_preview_binaries for the most part
Alan Cox [Fri, 26 May 2017 15:29:15 +0000 (12:29 -0300)]
[media] atomisp: Unify load_preview_binaries for the most part

ISP2401 introduced a rather sensible change to cut through the structure
spaghetti. Adopt that for the ISP2400 as well. It makes no difference to the
actual code other than readability.

Signed-off-by: Alan Cox <alan@linux.intel.com>
Signed-off-by: Hans Verkuil <hans.verkuil@cisco.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab@s-opensource.com>
7 years ago[media] atomisp: unify sh_css_hmm_buffer_record_acquire
Alan Cox [Fri, 26 May 2017 15:28:55 +0000 (12:28 -0300)]
[media] atomisp: unify sh_css_hmm_buffer_record_acquire

The ISP2401 version of this function returns a pointer to the buffer, whilst
the ISP2400 version returns a boolean if a slot is found. We can trivially
unify the code to use the ISP2401 version.

Signed-off-by: Alan Cox <alan@linux.intel.com>
Signed-off-by: Hans Verkuil <hans.verkuil@cisco.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab@s-opensource.com>
7 years ago[media] atomisp: eliminate dead code under HAS_RES_MGR
Alan Cox [Fri, 26 May 2017 15:28:41 +0000 (12:28 -0300)]
[media] atomisp: eliminate dead code under HAS_RES_MGR

This define is never set and these code paths are never used so they can go
away.

Signed-off-by: Alan Cox <alan@linux.intel.com>
Signed-off-by: Hans Verkuil <hans.verkuil@cisco.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab@s-opensource.com>
7 years ago[media] atomisp2: off by one in atomisp_s_input()
Dan Carpenter [Fri, 26 May 2017 15:28:05 +0000 (12:28 -0300)]
[media] atomisp2: off by one in atomisp_s_input()

The isp->inputs[] array has isp->input_cnt elements which have been
initialized so this > should be >=.

This bug is harmless.  The check against ATOM_ISP_MAX_INPUTS prevents us
from reading beyond the end of the array.  The uninitialized elements
are zeroed out so we will end up returning -EINVAL a few lines later
because the .camera pointer is NULL.

Signed-off-by: Dan Carpenter <dan.carpenter@oracle.com>
Signed-off-by: Alan Cox <alan@linux.intel.com>
Signed-off-by: Hans Verkuil <hans.verkuil@cisco.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab@s-opensource.com>
7 years ago[media] atomisp2: tidy up confused ifdefs
Alan Cox [Fri, 26 May 2017 15:27:54 +0000 (12:27 -0300)]
[media] atomisp2: tidy up confused ifdefs

The two drivers were machine merged and in this case the machine output was to
say the least not optimal.

Signed-off-by: Alan Cox <alan@linux.intel.com>
Signed-off-by: Hans Verkuil <hans.verkuil@cisco.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab@s-opensource.com>
7 years ago[media] atomisp2: remove HRT_UNSCHED
Alan Cox [Fri, 26 May 2017 15:27:40 +0000 (12:27 -0300)]
[media] atomisp2: remove HRT_UNSCHED

HRT_UNSCHED is never defined or set in the driver, so this is dead code that
can be retired, simplifying the code a bit further.

Signed-off-by: Alan Cox <alan@linux.intel.com>
Signed-off-by: Hans Verkuil <hans.verkuil@cisco.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab@s-opensource.com>
7 years ago[media] atomisp: remove NUM_OF_BLS
Alan Cox [Fri, 26 May 2017 15:27:29 +0000 (12:27 -0300)]
[media] atomisp: remove NUM_OF_BLS

With the removal of the HAS_BL bootloader code the value of NUM_OF_BLS is an
invariant zero. So let's get rid of it.

Signed-off-by: Alan Cox <alan@linux.intel.com>
Signed-off-by: Hans Verkuil <hans.verkuil@cisco.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab@s-opensource.com>
7 years ago[media] atompisp: HAS_BL is never defined so lose it
Alan Cox [Fri, 26 May 2017 15:27:18 +0000 (12:27 -0300)]
[media] atompisp: HAS_BL is never defined so lose it

Kill off the HAS_BL define and the code and includes it brackets. We never
define HAS_BL or use that functionality.

Signed-off-by: Alan Cox <alan@linux.intel.com>
Signed-off-by: Hans Verkuil <hans.verkuil@cisco.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab@s-opensource.com>
7 years ago[media] staging: media: atomisp: fix non static symbol warnings
Juan Antonio Pedreira Martos [Wed, 24 May 2017 00:27:11 +0000 (21:27 -0300)]
[media] staging: media: atomisp: fix non static symbol warnings

Fix a couple of sparse warnings:
drivers/staging/media/atomisp/pci/atomisp2/atomisp_v4l2.c:59:14: warning: symbol 'repool_pgnr' was not declared. Should it be static?
drivers/staging/media/atomisp/pci/atomisp2/atomisp_v4l2.c:387:6: warning: symbol 'punit_ddr_dvfs_enable' was not declared. Should it be static?

Mark these symbols as static, so they are no longer incorrectly exported.

Signed-off-by: Juan Antonio Pedreira Martos <juanpm1@gmail.com>
Signed-off-by: Hans Verkuil <hans.verkuil@cisco.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab@s-opensource.com>
7 years ago[media] atomisp: use NULL instead of 0 for pointers
Paolo Cretaro [Mon, 22 May 2017 21:04:46 +0000 (18:04 -0300)]
[media] atomisp: use NULL instead of 0 for pointers

Fix warning issued by sparse: Using plain integer as NULL pointer

Signed-off-by: Paolo Cretaro <melko@frugalware.org>
Signed-off-by: Hans Verkuil <hans.verkuil@cisco.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab@s-opensource.com>
7 years ago[media] staging: media: cxd2099: Fix checkpatch issues
Christoph Fanelsa [Tue, 16 May 2017 20:07:40 +0000 (17:07 -0300)]
[media] staging: media: cxd2099: Fix checkpatch issues

Fix checkpatch warnings of prefered using '%s..", __func__' as function
name in a string

Signed-off-by: Christoph Fanelsa <eddi1983@gmx.net>
Signed-off-by: Hans Verkuil <hans.verkuil@cisco.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab@s-opensource.com>
7 years ago[media] mtk-vcodec: Show mtk driver error without DEBUG definition
Hirokazu Honda [Tue, 30 May 2017 09:53:58 +0000 (06:53 -0300)]
[media] mtk-vcodec: Show mtk driver error without DEBUG definition

A driver error message is shown without DEBUG definition
to find an error and debug easily.

Signed-off-by: Hirokazu Honda <hiroh@chromium.org>
Signed-off-by: Hans Verkuil <hans.verkuil@cisco.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab@s-opensource.com>
7 years ago[media] media: mtk-mdp: Fix mdp device tree
Daniel Kurtz [Tue, 23 May 2017 03:24:11 +0000 (00:24 -0300)]
[media] media: mtk-mdp: Fix mdp device tree

If the mdp_* nodes are under an mdp sub-node, their corresponding
platform device does not automatically get its iommu assigned properly.

Fix this by moving the mdp component nodes up a level such that they are
siblings of mdp and all other SoC subsystems.  This also simplifies the
device tree.

Although it fixes iommu assignment issue, it also break compatibility
with old device tree. So, the patch in driver is needed to iterate over
sibling mdp device nodes, not child ones, to keep driver work properly.

Signed-off-by: Daniel Kurtz <djkurtz@chromium.org>
Signed-off-by: Minghsiu Tsai <minghsiu.tsai@mediatek.com>
Signed-off-by: Matthias Brugger <matthias.bgg@gmail.com>
Signed-off-by: Hans Verkuil <hans.verkuil@cisco.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab@s-opensource.com>
7 years ago[media] dt-bindings: mt8173: Fix mdp device tree
Minghsiu Tsai [Tue, 23 May 2017 03:24:09 +0000 (00:24 -0300)]
[media] dt-bindings: mt8173: Fix mdp device tree

If the mdp_* nodes are under an mdp sub-node, their corresponding
platform device does not automatically get its iommu assigned properly.

Fix this by moving the mdp component nodes up a level such that they are
siblings of mdp and all other SoC subsystems.  This also simplifies the
device tree.

Although it fixes iommu assignment issue, it also break compatibility
with old device tree. So, the patch in driver is needed to iterate over
sibling mdp device nodes, not child ones, to keep driver work properly.

Signed-off-by: Minghsiu Tsai <minghsiu.tsai@mediatek.com>
Acked-by: Rob Herring <robh@kernel.org>
Signed-off-by: Hans Verkuil <hans.verkuil@cisco.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab@s-opensource.com>
7 years ago[media] coda: copy headers in front of every I-frame
Philipp Zabel [Tue, 6 Jun 2017 15:59:02 +0000 (12:59 -0300)]
[media] coda: copy headers in front of every I-frame

That way we don't have to rely on userspace to inject the headers on IDR
requests, and there is always enough information to start decoding at an
I-frame.

Signed-off-by: Philipp Zabel <p.zabel@pengutronix.de>
Signed-off-by: Hans Verkuil <hans.verkuil@cisco.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab@s-opensource.com>
7 years ago[media] coda: implement forced key frames
Philipp Zabel [Tue, 6 Jun 2017 15:59:01 +0000 (12:59 -0300)]
[media] coda: implement forced key frames

Implement the V4L2_CID_MPEG_VIDEO_FORCE_KEY_FRAME control to force IDR
frames. This is useful to implement VFU (Video Fast Update) on RTP
transmissions.
We already force an IDR frame at the beginning of each GOP to work
around a firmware bug on i.MX27, use the same mechanism to service IDR
requests from userspace.

Signed-off-by: Philipp Zabel <p.zabel@pengutronix.de>
Signed-off-by: Hans Verkuil <hans.verkuil@cisco.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab@s-opensource.com>
7 years ago[media] cx18: Fix a sleep-in-atomic bug in snd_cx18_pcm_hw_free
Jia-Ju Bai [Thu, 1 Jun 2017 07:17:51 +0000 (04:17 -0300)]
[media] cx18: Fix a sleep-in-atomic bug in snd_cx18_pcm_hw_free

The driver may sleep under a spin lock, and the function call path is:
snd_cx18_pcm_hw_free (acquire the lock by spin_lock_irqsave)
  vfree --> may sleep

To fix it, the "substream->runtime->dma_area" is passed to a temporary
value, and mark it NULL when holding the lock. The memory is freed by
vfree through the temporary value outside the lock holding.

Signed-off-by: Jia-Ju Bai <baijiaju1990@163.com>
[hans.verkuil@cisco.com: removed unnecessary 'if (dma_area)']
Signed-off-by: Hans Verkuil <hans.verkuil@cisco.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab@s-opensource.com>
7 years ago[media] ivtv: Fix a sleep-in-atomic bug in snd_ivtv_pcm_hw_free
Jia-Ju Bai [Thu, 1 Jun 2017 07:13:54 +0000 (04:13 -0300)]
[media] ivtv: Fix a sleep-in-atomic bug in snd_ivtv_pcm_hw_free

The driver may sleep under a spin lock, and the function call path is:
snd_ivtv_pcm_hw_free (acquire the lock by spin_lock_irqsave)
  vfree --> may sleep

To fix it, the "substream->runtime->dma_area" is passed to a temporary
value, and mark it NULL when holding the lock. The memory is freed by
vfree through the temporary value outside the lock holding.

Signed-off-by: Jia-Ju Bai <baijiaju1990@163.com>
[hans.verkuil@cisco.com: removed unnecessary 'if (dma_area)']
Signed-off-by: Hans Verkuil <hans.verkuil@cisco.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab@s-opensource.com>
7 years ago[media] davinci: vpif_capture: cleanup raw camera support
Kevin Hilman [Tue, 6 Jun 2017 23:37:40 +0000 (20:37 -0300)]
[media] davinci: vpif_capture: cleanup raw camera support

The current driver has a handful of hard-coded assumptions based on its
primary use for capture of video signals.  Cleanup those assumptions,
and also query the subdev for format information and use that if
available.

Tested with 10-bit raw bayer input (SGRBG10) using the aptina,mt9v032
sensor, and also tested that composite video input still works from
ti,tvp514x decoder.  Both tests done on the da850-evm board with the
add-on UI board.

NOTE: Will need further testing for other sensors with different bus
formats.

Signed-off-by: Kevin Hilman <khilman@baylibre.com>
Signed-off-by: Hans Verkuil <hans.verkuil@cisco.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab@s-opensource.com>
7 years ago[media] davinci: vpif_capture: get subdevs from DT when available
Kevin Hilman [Tue, 6 Jun 2017 23:37:39 +0000 (20:37 -0300)]
[media] davinci: vpif_capture: get subdevs from DT when available

Enable  getting of subdevs from DT ports and endpoints.

The _get_pdata() function was larely inspired by (i.e. stolen from)
am437x-vpfe.c

Signed-off-by: Kevin Hilman <khilman@baylibre.com>
Signed-off-by: Hans Verkuil <hans.verkuil@cisco.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab@s-opensource.com>
7 years ago[media] davinci: vpif_capture: drop compliance hack
Kevin Hilman [Tue, 6 Jun 2017 23:37:38 +0000 (20:37 -0300)]
[media] davinci: vpif_capture: drop compliance hack

Capture driver silently overrides pixel format with a hack (according to
the comments) to pass v4l2 compliance tests.  This isn't needed for
normal functionality, and works for composite video and raw camera capture
without.

In addition, the hack assumes that it only supports raw capture with a
single format (SBGGR8) which isn't true.  VPIF can also capture 10- and
12-bit raw formats as well.  Forthcoming patches will enable VPIF
input with raw-camera support and has been tested with 10-bit format
from the aptina,mt9v032 sensor.

Any compliance failures should be fixed with a real fix.

Signed-off-by: Kevin Hilman <khilman@baylibre.com>
Signed-off-by: Hans Verkuil <hans.verkuil@cisco.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab@s-opensource.com>
7 years ago[media] ir-spi: Fix issues with lirc API
Anton Blanchard [Sun, 7 May 2017 01:00:11 +0000 (22:00 -0300)]
[media] ir-spi: Fix issues with lirc API

The ir-spi driver has 2 issues which prevents it from working with
lirc:

1. The ir-spi driver uses 16 bits of SPI data to create one cycle of
the waveform. As such our SPI clock needs to be 16x faster than the
carrier frequency.

The driver is inconsistent in how it currently handles this. It
initializes it to the carrier frequency:

But the commit message has some example code which initialises it
to 16x the carrier frequency:

val = 608000;
ret = ioctl(fd, LIRC_SET_SEND_CARRIER, &val);

To maintain compatibility with lirc, always do the frequency adjustment
in the driver.

2. lirc presents pulses in microseconds, but the ir-spi driver treats
them as cycles of the carrier. Similar to other lirc drivers, do the
conversion with DIV_ROUND_CLOSEST().

Fixes: fe052da49201 ("[media] rc: add support for IR LEDs driven through SPI")
Cc: stable@vger.kernel.org
Signed-off-by: Anton Blanchard <anton@samba.org>
Signed-off-by: Sean Young <sean@mess.org>
Signed-off-by: Mauro Carvalho Chehab <mchehab@s-opensource.com>
7 years ago[media] mceusb: drop redundant urb reinitialisation
Johan Hovold [Thu, 1 Jun 2017 07:46:00 +0000 (04:46 -0300)]
[media] mceusb: drop redundant urb reinitialisation

Drop a since commit e1159cb35712 ("[media] mceusb: remove pointless
mce_flush_rx_buffer function") redundant reinitialisation of two urb
fields immediately after they have been initialised.

Signed-off-by: Johan Hovold <johan@kernel.org>
Signed-off-by: Sean Young <sean@mess.org>
Signed-off-by: Mauro Carvalho Chehab <mchehab@s-opensource.com>
7 years ago[media] mceusb: fix memory leaks in error path
Johan Hovold [Thu, 1 Jun 2017 07:45:59 +0000 (04:45 -0300)]
[media] mceusb: fix memory leaks in error path

Fix urb and transfer-buffer leaks in an urb-submission error path which
may be hit when a device is disconnected.

Fixes: 66e89522aff7 ("V4L/DVB: IR: add mceusb IR receiver driver")
Cc: stable <stable@vger.kernel.org> # 2.6.36
Cc: Jarod Wilson <jarod@redhat.com>
Signed-off-by: Johan Hovold <johan@kernel.org>
Signed-off-by: Sean Young <sean@mess.org>
Signed-off-by: Mauro Carvalho Chehab <mchehab@s-opensource.com>
7 years ago[media] tc358743: Add support for platforms without IRQ line
Dave Stevenson [Fri, 2 Jun 2017 12:18:14 +0000 (09:18 -0300)]
[media] tc358743: Add support for platforms without IRQ line

interrupts is listed as an optional property in the DT
binding, but in reality the driver didn't work without it.
The existing driver relied on having the interrupt line
connected to the SoC to trigger handling various events.

Add the option to poll the interrupt status register via
a timer if no interrupt source is defined.

Signed-off-by: Dave Stevenson <dave.stevenson@raspberrypi.org>
Signed-off-by: Hans Verkuil <hans.verkuil@cisco.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab@s-opensource.com>
7 years ago[media] tc358743: Setup default mbus_fmt before registering
Dave Stevenson [Fri, 2 Jun 2017 12:18:13 +0000 (09:18 -0300)]
[media] tc358743: Setup default mbus_fmt before registering

Previously the mbus_fmt_code was set after the device was
registered. If a connected sub-device called tc358743_get_fmt
prior to that point it would get an invalid code back.

Signed-off-by: Dave Stevenson <dave.stevenson@raspberrypi.org>
Signed-off-by: Hans Verkuil <hans.verkuil@cisco.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab@s-opensource.com>
7 years ago[media] tc358743: Add enum_mbus_code
Dave Stevenson [Fri, 2 Jun 2017 12:18:12 +0000 (09:18 -0300)]
[media] tc358743: Add enum_mbus_code

There was no way to query the supported mbus formats from this
driver. enum_mbus_code is the function to expose that, so
implement it.

Signed-off-by: Dave Stevenson <dave.stevenson@raspberrypi.org>
Signed-off-by: Hans Verkuil <hans.verkuil@cisco.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab@s-opensource.com>
7 years ago[media] cec: improve debug messages
Hans Verkuil [Wed, 31 May 2017 09:50:26 +0000 (06:50 -0300)]
[media] cec: improve debug messages

- use __func__ instead of writing the full function name
- drop debug message in cec_config_log_addr since the same information
  will be reported later
- use debug level 1 for errors and infrequent events, use level 2 for
  debugging CEC message traffic
- log when a transmit is retried, very useful to know when debugging
- debug messages now all start with lower case

Signed-off-by: Hans Verkuil <hans.verkuil@cisco.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab@s-opensource.com>
7 years ago[media] tc358743: Handle return value of clk_prepare_enable
Arvind Yadav [Wed, 31 May 2017 09:31:54 +0000 (06:31 -0300)]
[media] tc358743: Handle return value of clk_prepare_enable

clk_prepare_enable() can fail here and we must check its return value.

Signed-off-by: Arvind Yadav <arvind.yadav.cs@gmail.com>
Signed-off-by: Hans Verkuil <hans.verkuil@cisco.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab@s-opensource.com>
7 years ago[media] v4l2-ctrls: Correctly destroy mutex in v4l2_ctrl_handler_free()
Sakari Ailus [Mon, 29 May 2017 14:45:43 +0000 (11:45 -0300)]
[media] v4l2-ctrls: Correctly destroy mutex in v4l2_ctrl_handler_free()

The mutex that was initialised in v4l2_ctrl_handler_init_class() was not
destroyed in v4l2_ctrl_handler_free(). Do that.

Additionally, explicitly refer to the ctrl handler's mutex in mutex
initialisation for clarity.

Signed-off-by: Sakari Ailus <sakari.ailus@linux.intel.com>
Signed-off-by: Hans Verkuil <hans.verkuil@cisco.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab@s-opensource.com>
7 years ago[media] v4l2-ctrls.c: Implement unlocked variant of v4l2_ctrl_handler_setup()
Sakari Ailus [Fri, 26 May 2017 08:21:37 +0000 (05:21 -0300)]
[media] v4l2-ctrls.c: Implement unlocked variant of v4l2_ctrl_handler_setup()

Sometimes the caller is already holding the control handler mutex and
using it to serialise something. Provide an unlocked variant of the same
function to be used in those cases.

Signed-off-by: Sakari Ailus <sakari.ailus@linux.intel.com>
Signed-off-by: Hans Verkuil <hans.verkuil@cisco.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab@s-opensource.com>
7 years ago[media] atmel-isi: code cleanup
Hugues Fruchet [Fri, 19 May 2017 10:04:52 +0000 (07:04 -0300)]
[media] atmel-isi: code cleanup

Ensure that ISI is clocked before starting sensor sub device.
Remove un-needed type check in try_fmt().
Use clamp() macro for hardware capabilities.
Fix wrong tabulation to space.

Signed-off-by: Hugues Fruchet <hugues.fruchet@st.com>
Signed-off-by: Hans Verkuil <hans.verkuil@cisco.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab@s-opensource.com>
7 years agoMerge tag 'media/v4.12-2' into patchwork
Mauro Carvalho Chehab [Wed, 7 Jun 2017 10:50:43 +0000 (07:50 -0300)]
Merge tag 'media/v4.12-2' into patchwork

media fixes for v4.12-rc4

* tag 'media/v4.12-2': (598 commits)
  [media] rc-core: race condition during ir_raw_event_register()
  [media] cec: drop MEDIA_CEC_DEBUG
  [media] cec: rename MEDIA_CEC_NOTIFIER to CEC_NOTIFIER
  [media] cec: select CEC_CORE instead of depend on it
  [media] rainshadow-cec: ensure exit_loop is intialized
  [media] atomisp: don't treat warnings as errors
  Linux 4.12-rc3
  x86/ftrace: Make sure that ftrace trampolines are not RWX
  x86/mm/ftrace: Do not bug in early boot on irqs_disabled in cpu_flush_range()
  selftests/ftrace: Add a testcase for many kprobe events
  kprobes/x86: Fix to set RWX bits correctly before releasing trampoline
  ftrace: Fix memory leak in ftrace_graph_release()
  ipv4: add reference counting to metrics
  net: ethernet: ax88796: don't call free_irq without request_irq first
  ip6_tunnel, ip6_gre: fix setting of DSCP on encapsulated packets
  sctp: fix ICMP processing if skb is non-linear
  net: llc: add lock_sock in llc_ui_bind to avoid a race condition
  PCI/msi: fix the pci_alloc_irq_vectors_affinity stub
  blk-mq: Only register debugfs attributes for blk-mq queues
  x86/timers: Move simple_udelay_calibration past init_hypervisor_platform
  ...

Signed-off-by: Mauro Carvalho Chehab <mchehab@s-opensource.com>
7 years ago[media] saa7164: fix double fetch PCIe access condition
Steven Toth [Tue, 6 Jun 2017 12:30:27 +0000 (09:30 -0300)]
[media] saa7164: fix double fetch PCIe access condition

Avoid a double fetch by reusing the values from the prior transfer.

Originally reported via https://bugzilla.kernel.org/show_bug.cgi?id=195559

Thanks to Pengfei Wang <wpengfeinudt@gmail.com> for reporting.

Signed-off-by: Steven Toth <stoth@kernellabs.com>
Reported-by: Pengfei Wang <wpengfeinudt@gmail.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab@s-opensource.com>
7 years ago[media] Doc*/media/uapi: fix control name
Pavel Machek [Sat, 27 May 2017 08:12:40 +0000 (05:12 -0300)]
[media] Doc*/media/uapi: fix control name

V4L2_CID_EXPOSURE_BIAS does not exist, fix documentation.

Signed-off-by: Pavel Machek <pavel@ucw.cz>
Acked-by: Sakari Ailus <sakari.ailus@linux.intel.com>
Signed-off-by: Hans Verkuil <hans.verkuil@cisco.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab@s-opensource.com>
7 years ago[media] davinci: vpif_capture: fix default pixel format for BT.656/BT.1120 video
Nori, Sekhar [Fri, 26 May 2017 10:55:27 +0000 (07:55 -0300)]
[media] davinci: vpif_capture: fix default pixel format for BT.656/BT.1120 video

For both BT.656 and BT.1120 video, the pixel format
used by VPIF is Y/CbCr 4:2:2 in semi-planar format
(Luma in one plane and Chroma in another). This
corresponds to NV16 pixel format.

This is documented in section 36.2.3 of OMAP-L138
Technical Reference Manual, SPRUH77A.

The VPIF driver incorrectly sets the default format
to V4L2_PIX_FMT_YUV422P. Fix it.

Reported-by: Alejandro Hernandez <ajhernandez@ti.com>
Signed-off-by: Sekhar Nori <nsekhar@ti.com>
Acked-by: Kevin Hilman <khilman@baylibre.com>
Signed-off-by: Hans Verkuil <hans.verkuil@cisco.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab@s-opensource.com>
7 years ago[media] coda: improve colorimetry handling
Philipp Zabel [Mon, 22 May 2017 16:34:48 +0000 (13:34 -0300)]
[media] coda: improve colorimetry handling

The hardware codec is not colorspace aware. We should trust userspace to
set the correct colorimetry information on the OUTPUT queue and mirror
the exact same setting on the CAPTURE queue.

There is no reason to restrict colorspace to JPEG or REC709 only. Also,
set the default colorspace, as returned by calling VIDIOC_TRY/S_FMT with
V4L2_COLORSPACE_DEFAULT, initially.

Signed-off-by: Philipp Zabel <p.zabel@pengutronix.de>
Signed-off-by: Hans Verkuil <hans.verkuil@cisco.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab@s-opensource.com>
7 years ago[media] media: adv7180: add adv7180cp, adv7180st compatible strings
Ulrich Hecht [Fri, 19 May 2017 13:07:02 +0000 (10:07 -0300)]
[media] media: adv7180: add adv7180cp, adv7180st compatible strings

Used to differentiate between models with 3 and 6 inputs.

Signed-off-by: Ulrich Hecht <ulrich.hecht+renesas@gmail.com>
Signed-off-by: Hans Verkuil <hans.verkuil@cisco.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab@s-opensource.com>
7 years ago[media] media: adv7180: Add adv7180cp, adv7180st bindings
Ulrich Hecht [Fri, 19 May 2017 13:07:03 +0000 (10:07 -0300)]
[media] media: adv7180: Add adv7180cp, adv7180st bindings

To differentiate between two classes of chip packages that have
different numbers of input ports.

Signed-off-by: Ulrich Hecht <ulrich.hecht+renesas@gmail.com>
Acked-by: Rob Herring <robh@kernel.org>
Signed-off-by: Hans Verkuil <hans.verkuil@cisco.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab@s-opensource.com>
7 years ago[media] rcar-vin: fix bug in pixelformat selection
Niklas Söderlund [Wed, 24 May 2017 00:15:40 +0000 (21:15 -0300)]
[media] rcar-vin: fix bug in pixelformat selection

If the requested pixelformat is not supported fallback to the default
format, do not revert the entire format.

Signed-off-by: Niklas Söderlund <niklas.soderlund+renesas@ragnatech.se>
Signed-off-by: Hans Verkuil <hans.verkuil@cisco.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab@s-opensource.com>
7 years ago[media] rcar-vin: add missing error check to propagate error
Niklas Söderlund [Wed, 24 May 2017 00:15:39 +0000 (21:15 -0300)]
[media] rcar-vin: add missing error check to propagate error

The return value of __rvin_try_format_source is not checked, add a check
and propagate the error.

Signed-off-by: Niklas Söderlund <niklas.soderlund+renesas@ragnatech.se>
Reviewed-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
Signed-off-by: Hans Verkuil <hans.verkuil@cisco.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab@s-opensource.com>
7 years ago[media] rcar-vin: remove subdevice matching from bind and unbind callbacks
Niklas Söderlund [Wed, 24 May 2017 00:15:37 +0000 (21:15 -0300)]
[media] rcar-vin: remove subdevice matching from bind and unbind callbacks

There is only one subdevice registered with the async framework so there
is no need for the driver to check which subdevice is bound or unbound.
Remove these checks since the async framework preforms this.

Signed-off-by: Niklas Söderlund <niklas.soderlund+renesas@ragnatech.se>
[hans.verkuil@cisco.com: fix typo: surce -> source]
Signed-off-by: Hans Verkuil <hans.verkuil@cisco.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab@s-opensource.com>
7 years ago[media] rcar-vin: refactor and fold in function after stall handling rework
Niklas Söderlund [Wed, 24 May 2017 00:15:36 +0000 (21:15 -0300)]
[media] rcar-vin: refactor and fold in function after stall handling rework

With the driver stopping and starting the stream each time the driver is
stalled rvin_capture_off() can be folded in to the only caller.

Signed-off-by: Niklas Söderlund <niklas.soderlund+renesas@ragnatech.se>
Reviewed-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
Signed-off-by: Hans Verkuil <hans.verkuil@cisco.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab@s-opensource.com>
7 years ago[media] rcar-vin: allow switch between capturing modes when stalling
Niklas Söderlund [Wed, 24 May 2017 00:15:35 +0000 (21:15 -0300)]
[media] rcar-vin: allow switch between capturing modes when stalling

If userspace can't feed the driver with buffers as fast as the driver
consumes them the driver will stop video capturing and wait for more
buffers from userspace, the driver is stalled. Once it have been feed
one or more free buffers it will recover from the stall and resume
capturing.

Instead of continue to capture using the same capture mode as before the
stall allow the driver to choose between single and continuous mode
based on free buffer availability. Do this by stopping capturing when
the driver becomes stalled and restart capturing once it continues. By
doing
this the capture mode will be evaluated each time the driver is
recovering from a stall.

This behavior is needed to fix a bug where continuous capturing mode is
used, userspace is about to stop the stream and is waiting for the last
buffers to be returned from the driver and is not queuing any new
buffers. In this case the driver becomes stalled when there are only 3
buffers remaining streaming will never resume since the driver is
waiting for userspace to feed it more buffers before it can continue
streaming.  With this fix the driver will then switch to single capture
mode for the last 3 buffers and a deadlock is avoided. The issue can be
demonstrated using yavta.

$ yavta -f RGB565 -s 640x480 -n 4 --capture=10  /dev/video22
Device /dev/video22 opened.
Device `R_Car_VIN' on `platform:e6ef1000.video' (driver 'rcar_vin') supports video, capture, without mplanes.
Video format set: RGB565 (50424752) 640x480 (stride 1280) field interlaced buffer size 614400
Video format: RGB565 (50424752) 640x480 (stride 1280) field interlaced buffer size 614400
4 buffers requested.
length: 614400 offset: 0 timestamp type/source: mono/EoF
Buffer 0/0 mapped at address 0xb6cc7000.
length: 614400 offset: 614400 timestamp type/source: mono/EoF
Buffer 1/0 mapped at address 0xb6c31000.
length: 614400 offset: 1228800 timestamp type/source: mono/EoF
Buffer 2/0 mapped at address 0xb6b9b000.
length: 614400 offset: 1843200 timestamp type/source: mono/EoF
Buffer 3/0 mapped at address 0xb6b05000.
0 (0) [-] interlaced 0 614400 B 38.240285 38.240303 12.421 fps ts mono/EoF
1 (1) [-] interlaced 1 614400 B 38.282329 38.282346 23.785 fps ts mono/EoF
2 (2) [-] interlaced 2 614400 B 38.322324 38.322338 25.003 fps ts mono/EoF
3 (3) [-] interlaced 3 614400 B 38.362318 38.362333 25.004 fps ts mono/EoF
4 (0) [-] interlaced 4 614400 B 38.402313 38.402328 25.003 fps ts mono/EoF
5 (1) [-] interlaced 5 614400 B 38.442307 38.442321 25.004 fps ts mono/EoF
6 (2) [-] interlaced 6 614400 B 38.482301 38.482316 25.004 fps ts mono/EoF
7 (3) [-] interlaced 7 614400 B 38.522295 38.522312 25.004 fps ts mono/EoF
8 (0) [-] interlaced 8 614400 B 38.562290 38.562306 25.003 fps ts mono/EoF
<blocks forever, waiting for the last buffer>

This fix also allow the driver to switch to single capture mode if
userspace doesn't feed it buffers fast enough. Or the other way around,
if userspace suddenly feeds the driver buffers faster it can switch to
continues capturing mode.

Signed-off-by: Niklas Söderlund <niklas.soderlund+renesas@ragnatech.se>
Reviewed-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
Signed-off-by: Hans Verkuil <hans.verkuil@cisco.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab@s-opensource.com>
7 years ago[media] rcar-vin: select capture mode based on free buffers
Niklas Söderlund [Wed, 24 May 2017 00:15:34 +0000 (21:15 -0300)]
[media] rcar-vin: select capture mode based on free buffers

Instead of selecting single or continuous capture mode based on how many
buffers userspace intends to give us select capture mode based on number
of free buffers we can allocate to hardware when the stream is started.

This change is a prerequisite to enable the driver to switch from
continuous to single capture mode (or the other way around) when the
driver is stalled by userspace not feeding it buffers as fast as it
consumes it.

Signed-off-by: Niklas Söderlund <niklas.soderlund+renesas@ragnatech.se>
Reviewed-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
Signed-off-by: Hans Verkuil <hans.verkuil@cisco.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab@s-opensource.com>
7 years ago[media] rcar-vin: move functions which acts on hardware
Niklas Söderlund [Wed, 24 May 2017 00:15:33 +0000 (21:15 -0300)]
[media] rcar-vin: move functions which acts on hardware

This only moves whole structs, defines and functions around, no code is
changed inside any function. The reason for moving this code around is
to prepare for refactoring and fixing of a start/stop stream bug without
having to use forward declarations.

Signed-off-by: Niklas Söderlund <niklas.soderlund+renesas@ragnatech.se>
Reviewed-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
Signed-off-by: Hans Verkuil <hans.verkuil@cisco.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab@s-opensource.com>
7 years ago[media] rcar-vin: decrease buffers needed to capture
Niklas Söderlund [Wed, 24 May 2017 00:15:32 +0000 (21:15 -0300)]
[media] rcar-vin: decrease buffers needed to capture

It's possible to grab frames using only one buffer, this should never
have been set to anything else then 1.

Signed-off-by: Niklas Söderlund <niklas.soderlund+renesas@ragnatech.se>
Reviewed-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
Signed-off-by: Hans Verkuil <hans.verkuil@cisco.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab@s-opensource.com>
7 years ago[media] rcar-vin: use pad information when verifying media bus format
Niklas Söderlund [Wed, 24 May 2017 00:15:31 +0000 (21:15 -0300)]
[media] rcar-vin: use pad information when verifying media bus format

Use information about pad index when enumerating mbus codes.

Signed-off-by: Niklas Söderlund <niklas.soderlund+renesas@ragnatech.se>
Reviewed-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
Signed-off-by: Hans Verkuil <hans.verkuil@cisco.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab@s-opensource.com>
7 years ago[media] rcar-vin: move pad lookup to async bound handler
Niklas Söderlund [Wed, 24 May 2017 00:15:30 +0000 (21:15 -0300)]
[media] rcar-vin: move pad lookup to async bound handler

Information about pads will be needed when enumerating the media bus
codes in the async complete handler which is run before
rvin_v4l2_probe(). Move the pad lookup to the async bound handler so
they are available when needed.

Signed-off-by: Niklas Söderlund <niklas.soderlund+renesas@ragnatech.se>
[hans.verkuil@cisco.com: fix typo: surce -> source]
Signed-off-by: Hans Verkuil <hans.verkuil@cisco.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab@s-opensource.com>
7 years ago[media] rcar-vin: refactor pad lookup code
Niklas Söderlund [Wed, 24 May 2017 00:15:29 +0000 (21:15 -0300)]
[media] rcar-vin: refactor pad lookup code

The pad lookup code can be broken out to increase readability and to
reduce code duplication.

Signed-off-by: Niklas Söderlund <niklas.soderlund+renesas@ragnatech.se>
Signed-off-by: Hans Verkuil <hans.verkuil@cisco.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab@s-opensource.com>
7 years ago[media] rcar-vin: move subdev source and sink pad index to rvin_graph_entity
Niklas Söderlund [Wed, 24 May 2017 00:15:28 +0000 (21:15 -0300)]
[media] rcar-vin: move subdev source and sink pad index to rvin_graph_entity

It makes more sense to store the sink and source pads in struct
rvin_graph_entity since that contains other subdevice related
information.

The data type to store pad information in is unsigned int and not int,
change this. While we are at it drop the _idx suffix from the names,
this never made sense.

Signed-off-by: Niklas Söderlund <niklas.soderlund+renesas@ragnatech.se>
Reviewed-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
Signed-off-by: Hans Verkuil <hans.verkuil@cisco.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab@s-opensource.com>
7 years ago[media] rcar-vin: fix standard in input enumeration
Niklas Söderlund [Wed, 24 May 2017 00:15:27 +0000 (21:15 -0300)]
[media] rcar-vin: fix standard in input enumeration

The driver supports a single input only, which can be either analog or
digital. If the subdevice supports dv_timings_cap the input is digital
and the driver should not fill in the standard.

Signed-off-by: Niklas Söderlund <niklas.soderlund+renesas@ragnatech.se>
Reviewed-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
Signed-off-by: Hans Verkuil <hans.verkuil@cisco.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab@s-opensource.com>
7 years ago[media] rcar-vin: fix how pads are handled for v4l2 subdevice operations
Niklas Söderlund [Wed, 24 May 2017 00:15:26 +0000 (21:15 -0300)]
[media] rcar-vin: fix how pads are handled for v4l2 subdevice operations

The rcar-vin driver only uses one pad, pad number 0.

- All v4l2 operations that did not check that the requested operation
  was for pad 0 have been updated with a check to enforce this.

- All v4l2 operations that stored (and later restored) the requested pad
  before substituting it for the subdevice pad number have been updated
  to not store the incoming pad and simply restore it to 0 after the
  subdevice operation is complete.

Signed-off-by: Niklas Söderlund <niklas.soderlund+renesas@ragnatech.se>
Reviewed-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
Signed-off-by: Hans Verkuil <hans.verkuil@cisco.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab@s-opensource.com>
7 years ago[media] rcar-vin: use rvin_reset_format() in S_DV_TIMINGS
Niklas Söderlund [Wed, 24 May 2017 00:15:25 +0000 (21:15 -0300)]
[media] rcar-vin: use rvin_reset_format() in S_DV_TIMINGS

Use rvin_reset_format() in rvin_s_dv_timings() instead of just resetting
a few fields. This fixes an issue where the field format was not
properly set after S_DV_TIMINGS.

Signed-off-by: Niklas Söderlund <niklas.soderlund+renesas@ragnatech.se>
Signed-off-by: Hans Verkuil <hans.verkuil@cisco.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab@s-opensource.com>
7 years ago[media] rcar-vin: reset bytesperline and sizeimage when resetting format
Niklas Söderlund [Wed, 24 May 2017 00:15:24 +0000 (21:15 -0300)]
[media] rcar-vin: reset bytesperline and sizeimage when resetting format

These two were forgotten when refactoring the format reset code. If
they are not also reset at the same time as width and height the format
returned from G_FMT will not match reality.

Signed-off-by: Niklas Söderlund <niklas.soderlund+renesas@ragnatech.se>
Reviewed-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
Signed-off-by: Hans Verkuil <hans.verkuil@cisco.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab@s-opensource.com>
7 years ago[media] v4l: Remove V4L2 OF framework in favour of V4L2 fwnode framework
Sakari Ailus [Wed, 11 Jan 2017 10:37:32 +0000 (08:37 -0200)]
[media] v4l: Remove V4L2 OF framework in favour of V4L2 fwnode framework

All drivers have been converted from V4L2 OF to V4L2 fwnode. The V4L2 OF
framework is now unused. Remove it.

Signed-off-by: Sakari Ailus <sakari.ailus@linux.intel.com>
Reviewed-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
Tested-by: Hans Verkuil <hans.verkuil@cisco.com>
Tested-by: Philipp Zabel <p.zabel@pengutronix.de>
Signed-off-by: Mauro Carvalho Chehab <mchehab@s-opensource.com>
7 years ago[media] docs-rst: media: Switch documentation to V4L2 fwnode API
Sakari Ailus [Thu, 9 Mar 2017 11:21:46 +0000 (08:21 -0300)]
[media] docs-rst: media: Switch documentation to V4L2 fwnode API

Instead of including the V4L2 OF header in ReST documentation, use the
V4L2 fwnode header instead.

Signed-off-by: Sakari Ailus <sakari.ailus@linux.intel.com>
Reviewed-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
Tested-by: Hans Verkuil <hans.verkuil@cisco.com>
Tested-by: Philipp Zabel <p.zabel@pengutronix.de>
Signed-off-by: Mauro Carvalho Chehab <mchehab@s-opensource.com>
7 years ago[media] v4l: Switch from V4L2 OF not V4L2 fwnode API
Sakari Ailus [Fri, 26 Aug 2016 23:17:25 +0000 (20:17 -0300)]
[media] v4l: Switch from V4L2 OF not V4L2 fwnode API

Switch users of the v4l2_of_ APIs to the more generic v4l2_fwnode_ APIs.
Async OF matching is replaced by fwnode matching and OF matching support
is removed.

Signed-off-by: Sakari Ailus <sakari.ailus@linux.intel.com>
Acked-by: Benoit Parrot <bparrot@ti.com> # i2c/ov2569.c, am437x/am437x-vpfe.c and ti-vpe/cal.c
Tested-by: Hans Verkuil <hans.verkuil@cisco.com> # Atmel sama5d3 board + ov2640 sensor
Tested-by: Philipp Zabel <p.zabel@pengutronix.de>
Signed-off-by: Mauro Carvalho Chehab <mchehab@s-opensource.com>
7 years ago[media] v4l: flash led class: Use fwnode_handle instead of device_node in init
Sakari Ailus [Wed, 31 Aug 2016 07:28:46 +0000 (04:28 -0300)]
[media] v4l: flash led class: Use fwnode_handle instead of device_node in init

Pass the more generic fwnode_handle to the init function than the
device_node.

Signed-off-by: Sakari Ailus <sakari.ailus@linux.intel.com>
Tested-by: Hans Verkuil <hans.verkuil@cisco.com>
Tested-by: Philipp Zabel <p.zabel@pengutronix.de>
Signed-off-by: Mauro Carvalho Chehab <mchehab@s-opensource.com>
7 years ago[media] v4l: async: Add fwnode match support
Sakari Ailus [Tue, 16 Aug 2016 09:54:59 +0000 (06:54 -0300)]
[media] v4l: async: Add fwnode match support

Add fwnode matching to complement OF node matching. And fwnode may also be
an OF node.

Do not enable fwnode matching yet. It will replace OF matching soon.

Signed-off-by: Sakari Ailus <sakari.ailus@linux.intel.com>
Tested-by: Hans Verkuil <hans.verkuil@cisco.com>
Tested-by: Philipp Zabel <p.zabel@pengutronix.de>
Signed-off-by: Mauro Carvalho Chehab <mchehab@s-opensource.com>
7 years ago[media] v4l: fwnode: Support generic fwnode for parsing standardised properties
Sakari Ailus [Fri, 12 Aug 2016 11:05:51 +0000 (08:05 -0300)]
[media] v4l: fwnode: Support generic fwnode for parsing standardised properties

The fwnode_handle is a more generic way than OF device_node to describe
firmware nodes. Instead of the OF API, use more generic fwnode API to
obtain the same information.

As the V4L2 fwnode support will be required by a small minority of e.g.
ACPI based systems (the same might actually go for OF), make this a module
instead of embedding it in the videodev module.

The origins of the V4L2 fwnode framework is in the V4L2 OF framework.

Signed-off-by: Sakari Ailus <sakari.ailus@linux.intel.com>
Tested-by: Hans Verkuil <hans.verkuil@cisco.com>
Tested-by: Philipp Zabel <p.zabel@pengutronix.de>
Signed-off-by: Mauro Carvalho Chehab <mchehab@s-opensource.com>
7 years ago[media] staging: remove todo and replace with lirc_zilog todo
Sean Young [Wed, 17 May 2017 17:32:54 +0000 (14:32 -0300)]
[media] staging: remove todo and replace with lirc_zilog todo

The lirc_zilog driver is the last remaining lirc driver, so the existing
todo is no longer relevant.

Signed-off-by: Sean Young <sean@mess.org>
Signed-off-by: Mauro Carvalho Chehab <mchehab@s-opensource.com>
7 years ago[media] sir_ir: remove init_chrdev and init_sir_ir functions
Sean Young [Wed, 17 May 2017 17:32:53 +0000 (14:32 -0300)]
[media] sir_ir: remove init_chrdev and init_sir_ir functions

Inlining these functions into the probe function makes it much
more readable.

Signed-off-by: Sean Young <sean@mess.org>
Signed-off-by: Mauro Carvalho Chehab <mchehab@s-opensource.com>
7 years ago[media] sir_ir: remove init_port and drop_port functions
Sean Young [Wed, 17 May 2017 17:32:52 +0000 (14:32 -0300)]
[media] sir_ir: remove init_port and drop_port functions

These functions are too short and removing them makes the code more
readable.

Signed-off-by: Sean Young <sean@mess.org>
Signed-off-by: Mauro Carvalho Chehab <mchehab@s-opensource.com>
7 years ago[media] sir_ir: use dev managed resources
Sean Young [Wed, 17 May 2017 17:32:51 +0000 (14:32 -0300)]
[media] sir_ir: use dev managed resources

Several error paths do not free up resources. This simplifies the code
and fixes this.

Signed-off-by: Sean Young <sean@mess.org>
Signed-off-by: Mauro Carvalho Chehab <mchehab@s-opensource.com>
7 years ago[media] sir_ir: attempt to free already free_irq
Sean Young [Wed, 17 May 2017 17:32:50 +0000 (14:32 -0300)]
[media] sir_ir: attempt to free already free_irq

If the probe fails (e.g. port already in use), rmmod causes null deref.

Signed-off-by: Sean Young <sean@mess.org>
Signed-off-by: Mauro Carvalho Chehab <mchehab@s-opensource.com>
7 years ago[media] lirc_zilog: Fix unbalanced braces around if/else
Ricardo Silva [Mon, 15 May 2017 19:40:16 +0000 (16:40 -0300)]
[media] lirc_zilog: Fix unbalanced braces around if/else

Fix all checkpatch reported issues for:

 * CHECK: "braces {} should be used on all arms of this statement".
 * CHECK: "Unbalanced braces around else statement".

Make sure all if/else statements are balanced in terms of braces. Most
cases in code are, but a few were left unbalanced, so put them all
consistent with the recommended style.

Signed-off-by: Ricardo Silva <rjpdasilva@gmail.com>
Signed-off-by: Sean Young <sean@mess.org>
Signed-off-by: Mauro Carvalho Chehab <mchehab@s-opensource.com>
7 years ago[media] lirc_zilog: Use sizeof(*p) instead of sizeof(struct P)
Ricardo Silva [Mon, 15 May 2017 19:40:15 +0000 (16:40 -0300)]
[media] lirc_zilog: Use sizeof(*p) instead of sizeof(struct P)

Fix all checkpatch reported issues for "CHECK: Prefer
kzalloc(sizeof(*<p>)...) over kzalloc(sizeof(struct <P>)...)".

Other similar case in the code already using recommended style, so make
it all consistent with the recommended practice.

Signed-off-by: Ricardo Silva <rjpdasilva@gmail.com>
Signed-off-by: Sean Young <sean@mess.org>
Signed-off-by: Mauro Carvalho Chehab <mchehab@s-opensource.com>
7 years ago[media] lirc_zilog: Use __func__ for logging function name
Ricardo Silva [Mon, 15 May 2017 19:40:14 +0000 (16:40 -0300)]
[media] lirc_zilog: Use __func__ for logging function name

Fix all checkpatch reported issues for "CHECK: Prefer using '"%s...",
__func__' to using '<func_name>', ..."

Use recommended style. Additionally, __func__ was already used in
similar cases throughout the code, so make it all consistent.

Signed-off-by: Ricardo Silva <rjpdasilva@gmail.com>
Signed-off-by: Sean Young <sean@mess.org>
Signed-off-by: Mauro Carvalho Chehab <mchehab@s-opensource.com>
7 years ago[media] lirc_zilog: Fix NULL comparisons style
Ricardo Silva [Mon, 15 May 2017 19:40:13 +0000 (16:40 -0300)]
[media] lirc_zilog: Fix NULL comparisons style

Fix all checkpatch reported issues for "CHECK: Comparison to NULL could
be written...".

Do these comparisons using the recommended coding style and consistent
with other similar cases in the file, which already used the recommended
way.

Signed-off-by: Ricardo Silva <rjpdasilva@gmail.com>
Signed-off-by: Sean Young <sean@mess.org>
Signed-off-by: Mauro Carvalho Chehab <mchehab@s-opensource.com>
7 years ago[media] lirc_zilog: Fix whitespace style checks
Ricardo Silva [Mon, 15 May 2017 19:40:12 +0000 (16:40 -0300)]
[media] lirc_zilog: Fix whitespace style checks

Fix style issues reported by checkpatch, affecting whitespace only:

 * CHECK: "Please don't use multiple blank lines".
   Two of these still triggering and left untouched because used for
   separating logical blocks (vars from functions, etc.).

 * CHECK: "spaces preferred around that '<operator>'".
   All fixed.

 * CHECK: "Alignment should match open parenthesis".
   All fixed except one on line 1161, left untouched for readability.

Move towards recommended coding style without compromising readability.

Signed-off-by: Ricardo Silva <rjpdasilva@gmail.com>
Signed-off-by: Sean Young <sean@mess.org>
Signed-off-by: Mauro Carvalho Chehab <mchehab@s-opensource.com>
7 years ago[media] tm6000: key_addr is unused
David Härdeman [Mon, 1 May 2017 16:10:27 +0000 (13:10 -0300)]
[media] tm6000: key_addr is unused

The key_addr member is only assigned, never used. So, remove it.

Signed-off-by: David Härdeman <david@hardeman.nu>
Signed-off-by: Sean Young <sean@mess.org>
Signed-off-by: Mauro Carvalho Chehab <mchehab@s-opensource.com>
7 years ago[media] rc-core: cx231xx - leave the internals of rc_dev alone
David Härdeman [Mon, 1 May 2017 16:10:22 +0000 (13:10 -0300)]
[media] rc-core: cx231xx - leave the internals of rc_dev alone

Just some debug statements to change.

Signed-off-by: David Härdeman <david@hardeman.nu>
Signed-off-by: Sean Young <sean@mess.org>
Signed-off-by: Mauro Carvalho Chehab <mchehab@s-opensource.com>
7 years ago[media] rc-core: img-ir - leave the internals of rc_dev alone
David Härdeman [Mon, 1 May 2017 16:10:01 +0000 (13:10 -0300)]
[media] rc-core: img-ir - leave the internals of rc_dev alone

Changing the protocol does not imply that the keymap changes.

Signed-off-by: David Härdeman <david@hardeman.nu>
Signed-off-by: Sean Young <sean@mess.org>
Signed-off-by: Mauro Carvalho Chehab <mchehab@s-opensource.com>
7 years ago[media] rc-core: ati_remote - leave the internals of rc_dev alone
David Härdeman [Mon, 1 May 2017 16:09:56 +0000 (13:09 -0300)]
[media] rc-core: ati_remote - leave the internals of rc_dev alone

The REP_DELAY setting on the input device is independent of hardware.
This change should not change how to driver works (as it does a
keydown/keyup and has no real repeat handling).

Signed-off-by: David Härdeman <david@hardeman.nu>
Signed-off-by: Sean Young <sean@mess.org>
Signed-off-by: Mauro Carvalho Chehab <mchehab@s-opensource.com>
7 years ago[media] lirc_dev: cleanup header
David Härdeman [Mon, 1 May 2017 16:04:57 +0000 (13:04 -0300)]
[media] lirc_dev: cleanup header

Remove some stuff from lirc_dev.h which is not used anywhere.

Signed-off-by: David Härdeman <david@hardeman.nu>
Signed-off-by: Sean Young <sean@mess.org>
Signed-off-by: Mauro Carvalho Chehab <mchehab@s-opensource.com>
7 years ago[media] lirc_dev: cleanup includes
David Härdeman [Mon, 1 May 2017 16:04:47 +0000 (13:04 -0300)]
[media] lirc_dev: cleanup includes

Remove superfluous includes and defines.

Signed-off-by: David Härdeman <david@hardeman.nu>
Signed-off-by: Sean Young <sean@mess.org>
Signed-off-by: Mauro Carvalho Chehab <mchehab@s-opensource.com>
7 years ago[media] lirc_dev: return POLLHUP and POLLERR when device is gone
David Härdeman [Mon, 1 May 2017 16:04:37 +0000 (13:04 -0300)]
[media] lirc_dev: return POLLHUP and POLLERR when device is gone

Most drivers return both values when the device is gone.

Signed-off-by: David Härdeman <david@hardeman.nu>
Signed-off-by: Sean Young <sean@mess.org>
Signed-off-by: Mauro Carvalho Chehab <mchehab@s-opensource.com>
7 years ago[media] lirc_dev: remove unused module parameter
David Härdeman [Mon, 1 May 2017 16:04:31 +0000 (13:04 -0300)]
[media] lirc_dev: remove unused module parameter

The "debug" parameter isn't actually used anywhere.

Signed-off-by: David Härdeman <david@hardeman.nu>
Signed-off-by: Sean Young <sean@mess.org>
Signed-off-by: Mauro Carvalho Chehab <mchehab@s-opensource.com>
7 years ago[media] lirc_dev: remove superfluous get/put_device() calls
David Härdeman [Mon, 1 May 2017 16:04:26 +0000 (13:04 -0300)]
[media] lirc_dev: remove superfluous get/put_device() calls

device_add() and friends already manage the references to the parent
device so these calls aren't necessary.

Signed-off-by: David Härdeman <david@hardeman.nu>
Signed-off-by: Sean Young <sean@mess.org>
Signed-off-by: Mauro Carvalho Chehab <mchehab@s-opensource.com>
7 years ago[media] lirc_dev: remove lirc_irctl_init() and lirc_cdev_add()
David Härdeman [Mon, 1 May 2017 16:04:21 +0000 (13:04 -0300)]
[media] lirc_dev: remove lirc_irctl_init() and lirc_cdev_add()

These two functions only make the logic in lirc_register_driver()
harder to follow.

(Note that almost no other driver calls kobject_set_name() on their cdev
so I simply removed that part).

Signed-off-by: David Härdeman <david@hardeman.nu>
Signed-off-by: Sean Young <sean@mess.org>
Signed-off-by: Mauro Carvalho Chehab <mchehab@s-opensource.com>
7 years ago[media] lirc_zilog: remove module parameter minor
David Härdeman [Mon, 1 May 2017 16:04:16 +0000 (13:04 -0300)]
[media] lirc_zilog: remove module parameter minor

Always let the kernel decide what minor the lirc chardev gets.

Signed-off-by: David Härdeman <david@hardeman.nu>
Signed-off-by: Sean Young <sean@mess.org>
Signed-off-by: Mauro Carvalho Chehab <mchehab@s-opensource.com>
7 years ago[media] lirc_dev: merge lirc_register_driver() and lirc_allocate_driver()
David Härdeman [Mon, 1 May 2017 16:04:11 +0000 (13:04 -0300)]
[media] lirc_dev: merge lirc_register_driver() and lirc_allocate_driver()

Merging the two means that lirc_allocate_buffer() is called before
device_add() and cdev_add() which makes more sense. This also
simplifies the locking slightly because lirc_allocate_buffer() will
always be called with lirc_dev_lock held.

Signed-off-by: David Härdeman <david@hardeman.nu>
Signed-off-by: Sean Young <sean@mess.org>
Signed-off-by: Mauro Carvalho Chehab <mchehab@s-opensource.com>