platform/kernel/linux-rpi.git
7 years ago[media] cec: zero counters in cec_received_msg()
Hans Verkuil [Wed, 9 Nov 2016 14:10:59 +0000 (12:10 -0200)]
[media] cec: zero counters in cec_received_msg()

Make sure the TX counters are zeroed in the cec_msg struct.
Non-zero TX counters make no sense when a message is received,
and applications should not see non-zero values here.

Signed-off-by: Hans Verkuil <hansverk@cisco.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab@s-opensource.com>
7 years ago[media] MAINTAINERS: update paths
Hans Verkuil [Wed, 2 Nov 2016 10:47:16 +0000 (08:47 -0200)]
[media] MAINTAINERS: update paths

The cec framework and the pulse8-cec driver have been moved out
of staging, so update the MAINTAINERS paths.

Signed-off-by: Hans Verkuil <hans.verkuil@cisco.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab@s-opensource.com>
7 years ago[media] s5p-cec/st-cec: update TODOs
Hans Verkuil [Wed, 2 Nov 2016 10:37:15 +0000 (08:37 -0200)]
[media] s5p-cec/st-cec: update TODOs

Update the TODOs explaining why these two drivers remain in
staging. The reason is that these drivers rely on userspace to
set the physical address, but that should come from the HDMI
output driver. This in turn needs the upcoming HDMI notifier
framework.

Signed-off-by: Hans Verkuil <hans.verkuil@cisco.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab@s-opensource.com>
7 years ago[media] pulse8-cec: move out of staging
Hans Verkuil [Wed, 2 Nov 2016 10:34:53 +0000 (08:34 -0200)]
[media] pulse8-cec: move out of staging

Now that the CEC framework has been moved out of staging and into the
mainline kernel we can do the same for the pulse8-cec driver.

Signed-off-by: Hans Verkuil <hans.verkuil@cisco.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab@s-opensource.com>
7 years ago[media] cec: an inner loop clobbered the outer loop variable
Hans Verkuil [Fri, 4 Nov 2016 12:52:10 +0000 (10:52 -0200)]
[media] cec: an inner loop clobbered the outer loop variable

An inner for-loop reused the outer loop variable. This was
only noticeable with CEC adapters supporting more than one
logical address.

Signed-off-by: Hans Verkuil <hansverk@cisco.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab@s-opensource.com>
7 years ago[media] cec.h/cec-funcs.h: don't use bool in public headers
Hans Verkuil [Fri, 4 Nov 2016 10:23:27 +0000 (08:23 -0200)]
[media] cec.h/cec-funcs.h: don't use bool in public headers

Replace bool by int or __u8 (when used in a struct).

Signed-off-by: Hans Verkuil <hans.verkuil@cisco.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab@s-opensource.com>
7 years ago[media] cec: sanitize msg.flags
Hans Verkuil [Fri, 4 Nov 2016 09:52:11 +0000 (07:52 -0200)]
[media] cec: sanitize msg.flags

The CEC_MSG_FL_REPLY_TO_FOLLOWERS message flag only makes sense for transmitted
messages where you want to wait for the reply.

Clear the flag in all other cases.

Signed-off-by: Hans Verkuil <hans.verkuil@cisco.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab@s-opensource.com>
7 years ago[media] cec: move the CEC framework out of staging and to media
Hans Verkuil [Wed, 2 Nov 2016 10:25:28 +0000 (08:25 -0200)]
[media] cec: move the CEC framework out of staging and to media

The last open issues have been addressed, so it is time to move
this out of staging and into the mainline and to move the public
cec headers to include/uapi/linux.

Signed-off-by: Hans Verkuil <hans.verkuil@cisco.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab@s-opensource.com>
7 years ago[media] cec: add proper support for CDC-Only CEC devices
Hans Verkuil [Wed, 2 Nov 2016 09:41:41 +0000 (07:41 -0200)]
[media] cec: add proper support for CDC-Only CEC devices

CDC-Only CEC devices are CEC devices that can only handle CDC messages,
all other messages are ignored.

Add a flag to signal that this is a CDC-Only device and act accordingly.

Also add helper functions to identify if a CEC device is configured as a
CDC-Only device, a second TV, a switch or a processor, since these variations
cannot be determined by the logical address alone.

Signed-off-by: Hans Verkuil <hans.verkuil@cisco.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab@s-opensource.com>
7 years ago[media] cec: accept two replies for CEC_MSG_INITIATE_ARC
Hans Verkuil [Tue, 1 Nov 2016 13:07:17 +0000 (11:07 -0200)]
[media] cec: accept two replies for CEC_MSG_INITIATE_ARC

The CEC_MSG_INITIATE_ARC message is special since it is the ONLY
CEC message that accepts two possible valid replies:

CEC_MSG_REPORT_ARC_INITIATED and CEC_MSG_REPORT_ARC_TERMINATED.

So if the transmitted message is CEC_MSG_INITIATE_ARC and the remote
side replied with CEC_MSG_REPORT_ARC_INITIATED or CEC_MSG_REPORT_ARC_TERMINATED,
then a msg->reply value of CEC_MSG_REPORT_ARC_INITIATED or
CEC_MSG_REPORT_ARC_TERMINATED will match either reply.

I thought about either adding a second reply2 field, but that's ugly
for all other messages that have only one reply, and what if in the
future a new message is added that can have three replies?

Another option would be to add a cec_msg flag, but really, the combination
of CEC_MSG_REPORT_ARC_INITIATED and a reply value of one of the two
possible replies already functions as a flag.

Another advantage of this approach is that it is safe to re-use a
cec_msg struct. No need to zero a flags field or a reply2 field.

So since this really is an exception in the CEC specification, I
decided to implement it as an exception as well.

Signed-off-by: Hans Verkuil <hans.verkuil@cisco.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab@s-opensource.com>
7 years ago[media] cec: filter invalid messages
Hans Verkuil [Tue, 1 Nov 2016 12:48:22 +0000 (10:48 -0200)]
[media] cec: filter invalid messages

As per the CEC specification:

- CEC messages with a too-small payload should be ignored.
- Broadcast messages that are only allowed as directed messages
  should be ignored.
- Directed messages that are only allowed as broadcast messages
  should be ignored.

Implement this in the core CEC framework.

Signed-off-by: Hans Verkuil <hans.verkuil@cisco.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab@s-opensource.com>
7 years ago[media] cec: add CEC_MSG_FL_REPLY_TO_FOLLOWERS
Hans Verkuil [Tue, 1 Nov 2016 10:55:05 +0000 (08:55 -0200)]
[media] cec: add CEC_MSG_FL_REPLY_TO_FOLLOWERS

Give the caller more control over how replies to a transmit are
handled. By default the reply will only go to the filehandle that
called CEC_TRANSMIT. If this new flag is set, then the reply will
also go to all followers.

Signed-off-by: Hans Verkuil <hans.verkuil@cisco.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab@s-opensource.com>
7 years ago[media] cec: add flag to cec_log_addrs to enable RC passthrough
Hans Verkuil [Tue, 1 Nov 2016 09:59:34 +0000 (07:59 -0200)]
[media] cec: add flag to cec_log_addrs to enable RC passthrough

By default the CEC_MSG_USER_CONTROL_PRESSED/RELEASED messages
are passed on to the follower(s) only. If the new
CEC_LOG_ADDRS_FL_ALLOW_RC_PASSTHRU flag is set in the
flags field of struct cec_log_addrs then these messages are also
passed on to the remote control input subsystem and they will appear
as keystrokes.

This used to be the default behavior, but now you have to explicitly
enable it. This is done to force the caller to think about possible
security issues (e.g. if these messages are used to enter passwords).

Signed-off-by: Hans Verkuil <hans.verkuil@cisco.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab@s-opensource.com>
7 years ago[media] cec rst: convert tables and drop the 'row' comments
Hans Verkuil [Tue, 1 Nov 2016 09:41:17 +0000 (07:41 -0200)]
[media] cec rst: convert tables and drop the 'row' comments

This uses Laurent's python script to convert all tables, dropping
the useless 'row' comments.

See commit c2b66cafdf02 ("[media] v4l: doc: Remove row numbers from tables")
for the script that was used.

Signed-off-by: Hans Verkuil <hans.verkuil@cisco.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab@s-opensource.com>
7 years ago[media] pulse8-cec: set all_device_types when restoring config
Hans Verkuil [Tue, 1 Nov 2016 08:47:10 +0000 (06:47 -0200)]
[media] pulse8-cec: set all_device_types when restoring config

When the persistent state is restored, the all_device_types field
was never filled in. Fix this.

Signed-off-by: Hans Verkuil <hans.verkuil@cisco.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab@s-opensource.com>
7 years ago[media] cobalt: fix copy-and-paste error
Hans Verkuil [Fri, 11 Nov 2016 10:33:05 +0000 (08:33 -0200)]
[media] cobalt: fix copy-and-paste error

The vmr_stat variable was filled with the contents of the control register,
not the status register. Classic copy-and-paste error.

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: add index check in decoder vidioc_qbuf
Wu-Cheng Li [Thu, 10 Nov 2016 05:24:05 +0000 (03:24 -0200)]
[media] mtk-vcodec: add index check in decoder vidioc_qbuf

vb2_qbuf will check the buffer index. If a driver overrides
vidioc_qbuf and use the buffer index, the driver needs to check
the index.

Signed-off-by: Wu-Cheng Li <wuchengli@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] control.rst: improve the queryctrl code examples
Hans Verkuil [Wed, 9 Nov 2016 08:31:10 +0000 (06:31 -0200)]
[media] control.rst: improve the queryctrl code examples

The code examples on how to enumerate controls were really long in the
tooth. Update them.

Using FLAG_NEXT_CTRL is preferred these days, so give that example first.

Signed-off-by: Hans Verkuil <hans.verkuil@cisco.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab@s-opensource.com>
7 years ago[media] cec-core.rst: improve documentation
Hans Verkuil [Wed, 9 Nov 2016 08:00:53 +0000 (06:00 -0200)]
[media] cec-core.rst: improve documentation

Improve the internal CEC documentation. In particular add a section
that specifies that transmit-related interrupts should be processed
before receive interrupts.

Signed-off-by: Hans Verkuil <hans.verkuil@cisco.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab@s-opensource.com>
7 years ago[media] DaVinci-VPFE-Capture: Replace a memcpy() call by an assignment in vpfe_enum_i...
Markus Elfring [Sun, 6 Nov 2016 20:54:38 +0000 (18:54 -0200)]
[media] DaVinci-VPFE-Capture: Replace a memcpy() call by an assignment in vpfe_enum_input()

Use a direct assignment for an array element which can be set over the
pointer variable "inp" instead of calling the function "memcpy" here.

Suggested-by: Hans Verkuil <hverkuil@xs4all.nl>
Signed-off-by: Markus Elfring <elfring@users.sourceforge.net>
Signed-off-by: Hans Verkuil <hans.verkuil@cisco.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab@s-opensource.com>
7 years ago[media] DaVinci-VPBE: Check return value of a setup_if_config() call in vpbe_set_output()
Markus Elfring [Sun, 6 Nov 2016 19:40:20 +0000 (17:40 -0200)]
[media] DaVinci-VPBE: Check return value of a setup_if_config() call in vpbe_set_output()

* A function was called over the pointer "setup_if_config" in the data
  structure "venc_platform_data". But the return value was not used so far.
  Thus assign it to the local variable "ret" which will be checked with
  the next statement.

  Fixes: 9a7f95ad1c946efdd7a7a72df27db738260a0fd8 ("[media] davinci vpbe: add dm365 VPBE display driver changes")

* Pass a value to this function call without storing it in an intermediate
  variable before.

* Delete the local variable "if_params" which became unnecessary with
  this refactoring.

Acked-by: Lad, Prabhakar <prabhakar.csengg@gmail.com>
Signed-off-by: Markus Elfring <elfring@users.sourceforge.net>
Signed-off-by: Hans Verkuil <hans.verkuil@cisco.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab@s-opensource.com>
7 years ago[media] staging: st-cec: add parentheses around complex macros
Maninder Singh [Fri, 4 Nov 2016 07:58:31 +0000 (05:58 -0200)]
[media] staging: st-cec: add parentheses around complex macros

This patch fixes the following checkpatch.pl error:
ERROR: Macros with complex values should be enclosed in parentheses

Signed-off-by: Maninder Singh <maninder.s2@samsung.com>
Acked-by: Benjamin Gaignard <benjamin.gaignard@linaro.org>
Signed-off-by: Hans Verkuil <hans.verkuil@cisco.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab@s-opensource.com>
7 years ago[media] adv7604: add vic detect
Hans Verkuil [Thu, 14 Jul 2016 14:53:47 +0000 (11:53 -0300)]
[media] adv7604: add vic detect

Obtain the correct timings based on the VIC code from the AVI InfoFrame.

It does a sanity check to see if at least the measured width and height
are in line with what the VIC code reports. If not, then use the timings
instead of the VIC code (as per the CEA-861 spec).

Signed-off-by: Hans Verkuil <hans.verkuil@cisco.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab@s-opensource.com>
7 years ago[media] cobalt: add cropcap support
Hans Verkuil [Sun, 17 Jul 2016 08:42:07 +0000 (05:42 -0300)]
[media] cobalt: add cropcap support

Now that the timings contain picture aspect ratio information,
we can support cropcap to return the pixel aspect ratio.

Signed-off-by: Hans Verkuil <hans.verkuil@cisco.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab@s-opensource.com>
7 years ago[media] v4l2-dv-timings: add helpers for vic and pixelaspect ratio
Hans Verkuil [Thu, 14 Jul 2016 10:59:12 +0000 (07:59 -0300)]
[media] v4l2-dv-timings: add helpers for vic and pixelaspect ratio

Add a helper to find timings based on the CEA-861 VIC code. Also,
add a helper that returns the pixel aspect ratio based on the
v4l2_dv_timings struct.

[mchehab@s-opensource.com: fix coding style]
Signed-off-by: Hans Verkuil <hans.verkuil@cisco.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab@s-opensource.com>
7 years ago[media] v4l2-dv-timings: add VICs and picture aspect ratio
Hans Verkuil [Thu, 14 Jul 2016 10:59:01 +0000 (07:59 -0300)]
[media] v4l2-dv-timings: add VICs and picture aspect ratio

Add the CEA-861 VIC, the HDMI VIC and the picture aspect ratio information
where applicable.

Signed-off-by: Hans Verkuil <hans.verkuil@cisco.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab@s-opensource.com>
7 years ago[media] vidioc-g-dv-timings.rst: document the new dv_timings flags
Hans Verkuil [Fri, 16 Sep 2016 10:38:04 +0000 (07:38 -0300)]
[media] vidioc-g-dv-timings.rst: document the new dv_timings flags

Document the new flags.

Signed-off-by: Hans Verkuil <hans.verkuil@cisco.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab@s-opensource.com>
7 years ago[media] videodev2.h: add VICs and picture aspect ratio
Hans Verkuil [Thu, 14 Jul 2016 10:58:35 +0000 (07:58 -0300)]
[media] videodev2.h: add VICs and picture aspect ratio

Add picture aspect ratio information, the CEA-861 VIC (Video Identification
Code) and the HDMI VIC to struct v4l2_bt_timings.

The picture aspect was chosen rather than the pixel aspect since 1) the
CEA-861 standard uses picture aspect, and 2) pixel aspect ratio can become
tricky when dealing with pixel repeat timings. While we don't support those
yet at the moment, this might become necessary. And in that case using
picture aspect ratio makes more sense. And converting picture aspect ratio
to pixel aspect ratio is easy enough.

Signed-off-by: Hans Verkuil <hans.verkuil@cisco.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab@s-opensource.com>
7 years ago[media] videodev2.h: checkpatch cleanup
Hans Verkuil [Fri, 16 Sep 2016 10:47:08 +0000 (07:47 -0300)]
[media] videodev2.h: checkpatch cleanup

Format comments according to what checkpatch wants.

No other changes.

Signed-off-by: Hans Verkuil <hans.verkuil@cisco.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab@s-opensource.com>
7 years ago[media] hdpvr: fix interrupted recording
Jonathan Sims [Sun, 23 Oct 2016 18:19:07 +0000 (16:19 -0200)]
[media] hdpvr: fix interrupted recording

This is a reworking of a patch originally submitted by Ryley Angus,
modified by Hans Verkuil and then seemingly forgotten before changes
suggested by Keith Pyle here:

http://www.mail-archive.com/linux-media@vger.kernel.org/msg75163.html

were made and tested.

I have implemented the suggested changes and have been testing for the
last 2 months. I am no longer experiencing lockups while recording
(with blue light on, requiring power cycling) which had been a long
standing problem with the HD-PVR. I have not noticed any other problems
since applying the patch.

Signed-off-by: Jonathan Sims <jonathan.625266@earthlink.net>
Reported-by: Ryley Angus <ryleyjangus@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] v4l: Document that m2m devices have a file handle specific context
Sakari Ailus [Tue, 18 Oct 2016 13:15:32 +0000 (11:15 -0200)]
[media] v4l: Document that m2m devices have a file handle specific context

Memory-to-memory V4L2 devices all have file handle specific context.
Say this in the API documentation so that the user space may rely on it
being the case.

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] st-hva: fix a copy-and-paste variable name error
Colin Ian King [Mon, 19 Sep 2016 06:19:28 +0000 (03:19 -0300)]
[media] st-hva: fix a copy-and-paste variable name error

The second check for an error on hva->lmi_err_reg appears
to be a copy-and-paste error, it should be hva->emi_err_reg
instead.

Signed-off-by: Colin Ian King <colin.king@canonical.com>
Acked-by: Jean-Christophe Trotin <jean-christophe.trotin@st.com>
Signed-off-by: Hans Verkuil <hans.verkuil@cisco.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab@s-opensource.com>
7 years ago[media] squash lines for simple wrapper functions
Masahiro Yamada [Tue, 6 Sep 2016 22:52:24 +0000 (19:52 -0300)]
[media] squash lines for simple wrapper functions

Remove unneeded variables and assignments.

Signed-off-by: Masahiro Yamada <yamada.masahiro@socionext.com>
Signed-off-by: Hans Verkuil <hans.verkuil@cisco.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab@s-opensource.com>
7 years ago[media] s5p-cec: remove unused including <linux/version.h>
Wei Yongjun [Sat, 29 Oct 2016 16:17:55 +0000 (14:17 -0200)]
[media] s5p-cec: remove unused including <linux/version.h>

Remove including <linux/version.h> that don't need it.

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>
7 years ago[media] media: fix platform_no_drv_owner.cocci warnings
Fengguang Wu [Thu, 27 Oct 2016 22:34:37 +0000 (20:34 -0200)]
[media] media: fix platform_no_drv_owner.cocci warnings

drivers/media/platform/mtk-mdp/mtk_mdp_core.c:284:3-8: No need to set .owner here. The core will do it.

 Remove .owner field if calls are used which set it automatically

Generated by: scripts/coccinelle/api/platform_no_drv_owner.cocci

CC: Minghsiu Tsai <minghsiu.tsai@mediatek.com>
Signed-off-by: Fengguang Wu <fengguang.wu@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] media: mtk-mdp: NULL-terminate mtk_mdp_comp_dt_ids
Vincent Stehlé [Thu, 27 Oct 2016 20:23:25 +0000 (18:23 -0200)]
[media] media: mtk-mdp: NULL-terminate mtk_mdp_comp_dt_ids

The mtk_mdp_comp_dt_ids[] array should be NULL-terminated; add therefore an
empty entry in the end.

Fixes: c8eb2d7e8202fd9c ("[media] media: Add Mediatek MDP Driver")

Signed-off-by: Vincent Stehlé <vincent.stehle@laposte.net>
Cc: Minghsiu Tsai <minghsiu.tsai@mediatek.com>
Cc: Mauro Carvalho Chehab <mchehab@s-opensource.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: solo6x10: fix lockup by avoiding delayed register write
Andrey Utkin [Sat, 22 Oct 2016 15:34:36 +0000 (13:34 -0200)]
[media] media: solo6x10: fix lockup by avoiding delayed register write

This fixes a lockup at device probing which happens on some solo6010
hardware samples. This is a regression introduced by commit e1ceb25a1569
("[media] SOLO6x10: remove unneeded register locking and barriers")

The observed lockup happens in solo_set_motion_threshold() called from
solo_motion_config().

This extra "flushing" is not fundamentally needed for every write, but
apparently the code in driver assumes such behaviour at last in some
places.

Actual fix was proposed by Hans Verkuil.

Fixes: e1ceb25a1569 ("[media] SOLO6x10: remove unneeded register locking and barriers")

Cc: stable@vger.kernel.org # 4.3 and up
Signed-off-by: Andrey Utkin <andrey.utkin@corp.bluecherry.net>
Signed-off-by: Hans Verkuil <hans.verkuil@cisco.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab@s-opensource.com>
7 years ago[media] v4l: doc: Fix typo in vidioc-g-tuner.rst
Masanari Iida [Sat, 22 Oct 2016 07:26:37 +0000 (05:26 -0200)]
[media] v4l: doc: Fix typo in vidioc-g-tuner.rst

This patch fix spelling typos found in vidioc-g-tuner.rst

Signed-off-by: Masanari Iida <standby24x7@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] st-cec: Fix module autoload
Javier Martinez Canillas [Mon, 17 Oct 2016 15:44:12 +0000 (13:44 -0200)]
[media] st-cec: Fix module autoload

If the driver is built as a module, autoload won't work because the module
alias information is not filled. So user-space can't match the registered
device with the corresponding module.

Export the module alias information using the MODULE_DEVICE_TABLE() macro.

Before this patch:

$ modinfo drivers/staging/media//st-cec/stih-cec.ko | grep alias
$

After this patch:

$ modinfo drivers/staging/media//st-cec/stih-cec.ko | grep alias
alias:          of:N*T*Cst,stih-cecC*
alias:          of:N*T*Cst,stih-cec

Signed-off-by: Javier Martinez Canillas <javier@osg.samsung.com>
Acked-by: Benjamin Gaignard <benjamin.gaignard@linaro.org>
Signed-off-by: Hans Verkuil <hans.verkuil@cisco.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab@s-opensource.com>
7 years ago[media] s5p-cec: Fix module autoload
Javier Martinez Canillas [Mon, 17 Oct 2016 15:44:11 +0000 (13:44 -0200)]
[media] s5p-cec: Fix module autoload

If the driver is built as a module, autoload won't work because the module
alias information is not filled. So user-space can't match the registered
device with the corresponding module.

Export the module alias information using the MODULE_DEVICE_TABLE() macro.

Before this patch:

$ modinfo drivers/staging/media/s5p-cec/s5p-cec.ko | grep alias
$

After this patch:

$ modinfo drivers/staging/media/s5p-cec/s5p-cec.ko | grep alias
alias:          of:N*T*Csamsung,s5p-cecC*
alias:          of:N*T*Csamsung,s5p-cec

Signed-off-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>
7 years ago[media] rc: meson-ir: Fix module autoload
Javier Martinez Canillas [Mon, 17 Oct 2016 15:44:10 +0000 (13:44 -0200)]
[media] rc: meson-ir: Fix module autoload

If the driver is built as a module, autoload won't work because the module
alias information is not filled. So user-space can't match the registered
device with the corresponding module.

Export the module alias information using the MODULE_DEVICE_TABLE() macro.

Before this patch:

$ modinfo drivers/media/rc/meson-ir.ko | grep alias
$

After this patch:

$ modinfo drivers/media/rc/meson-ir.ko | grep alias
alias:          of:N*T*Camlogic,meson-gxbb-irC*
alias:          of:N*T*Camlogic,meson-gxbb-ir
alias:          of:N*T*Camlogic,meson8b-irC*
alias:          of:N*T*Camlogic,meson8b-ir
alias:          of:N*T*Camlogic,meson6-irC*
alias:          of:N*T*Camlogic,meson6-ir

Signed-off-by: Javier Martinez Canillas <javier@osg.samsung.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] v4l: rcar-fcp: Fix module autoload for OF registration
Javier Martinez Canillas [Mon, 17 Oct 2016 15:44:09 +0000 (13:44 -0200)]
[media] v4l: rcar-fcp: Fix module autoload for OF registration

If the driver is built as a module, autoload won't work because the module
alias information is not filled. So user-space can't match the registered
device with the corresponding module.

Export the module alias information using the MODULE_DEVICE_TABLE() macro.

Before this patch:

$ modinfo drivers/media/platform/rcar-fcp.ko | grep alias
alias:          rcar-fcp

After this patch:

$ modinfo drivers/media/platform/rcar-fcp.ko | grep alias
alias:          rcar-fcp
alias:          of:N*T*Crenesas,fcpvC*
alias:          of:N*T*Crenesas,fcpv
alias:          of:N*T*Crenesas,fcpfC*
alias:          of:N*T*Crenesas,fcpf

Signed-off-by: Javier Martinez Canillas <javier@osg.samsung.com>
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: vsp1: Fix module autoload for OF registration
Javier Martinez Canillas [Mon, 17 Oct 2016 15:44:08 +0000 (13:44 -0200)]
[media] v4l: vsp1: Fix module autoload for OF registration

If the driver is built as a module, autoload won't work because the module
alias information is not filled. So user-space can't match the registered
device with the corresponding module.

Export the module alias information using the MODULE_DEVICE_TABLE() macro.

Before this patch:

$ modinfo drivers/media/platform/vsp1/vsp1.ko | grep alias
alias:          vsp1

After this patch:

$ modinfo drivers/media/platform/vsp1/vsp1.ko | grep alias
alias:          vsp1
alias:          of:N*T*Crenesas,vsp2C*
alias:          of:N*T*Crenesas,vsp2
alias:          of:N*T*Crenesas,vsp1C*
alias:          of:N*T*Crenesas,vsp1

Signed-off-by: Javier Martinez Canillas <javier@osg.samsung.com>
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] usbtv: don't do DMA on stack
Mauro Carvalho Chehab [Wed, 16 Nov 2016 15:13:02 +0000 (13:13 -0200)]
[media] usbtv: don't do DMA on stack

As reported by smatch:
drivers/media/usb/usbtv/usbtv-video.c:716 usbtv_s_ctrl() error: doing dma on the stack (data)
drivers/media/usb/usbtv/usbtv-video.c:758 usbtv_s_ctrl() error: doing dma on the stack (data)

We should not do it, as it won't work on Kernels 4.9 and upper.
So, alloc a buffer for it.

Fixes: c53a846c48f2 ("[media] usbtv: add video controls")
Signed-off-by: Mauro Carvalho Chehab <mchehab@s-opensource.com>
7 years ago[media] usbtv: add video controls
Lubomir Rintel [Sun, 16 Oct 2016 09:38:22 +0000 (07:38 -0200)]
[media] usbtv: add video controls

Brightness, Contrast, Hue and Color Saturation are supported.

Signed-off-by: Lubomir Rintel <lkundrak@v3.sk>
Signed-off-by: Hans Verkuil <hans.verkuil@cisco.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab@s-opensource.com>
7 years ago[media] st-hva: fix some error handling in hva_hw_probe()
Dan Carpenter [Fri, 14 Oct 2016 07:32:24 +0000 (04:32 -0300)]
[media] st-hva: fix some error handling in hva_hw_probe()

The devm_ioremap_resource() returns error pointers, never NULL.  The
platform_get_resource() returns NULL on error, never error pointers.
The error code needs to be set, as well.  The current code returns
PTR_ERR(NULL) which is success.

Fixes: 57b2c0628b60 ("[media] st-hva: multi-format video encoder V4L2 driver")

Signed-off-by: Dan Carpenter <dan.carpenter@oracle.com>
Acked-by: Jean-Christophe Trotin <jean-christophe.trotin@st.com>
Signed-off-by: Hans Verkuil <hans.verkuil@cisco.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab@s-opensource.com>
7 years ago[media] s5p-cec: mark PM functions as __maybe_unused again
Arnd Bergmann [Thu, 13 Oct 2016 14:39:04 +0000 (11:39 -0300)]
[media] s5p-cec: mark PM functions as __maybe_unused again

A bugfix removed the two callers of s5p_cec_runtime_suspend
and s5p_cec_runtime_resume, leading to the return of a harmless
warning that I had previously fixed in commit aee8937089b1
("[media] s5p_cec: mark suspend/resume as __maybe_unused"):

staging/media/s5p-cec/s5p_cec.c:234:12: error: â€˜s5p_cec_runtime_suspend’ defined but not used [-Werror=unused-function]
staging/media/s5p-cec/s5p_cec.c:242:12: error: â€˜s5p_cec_runtime_resume’ defined but not used [-Werror=unused-function]

This adds the __maybe_unused annotations to the function that
were not removed and that are now unused when CONFIG_PM
is disabled.

Fixes: 57b978ada073 ("[media] s5p-cec: fix system and runtime PM integration")

Signed-off-by: Arnd Bergmann <arnd@arndb.de>
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-Display: Delete an unnecessary variable initialisation in proces...
Markus Elfring [Wed, 12 Oct 2016 13:45:03 +0000 (10:45 -0300)]
[media] DaVinci-VPIF-Display: Delete an unnecessary variable initialisation in process_progressive_mode()

The local variable "addr" 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: Hans Verkuil <hans.verkuil@cisco.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab@s-opensource.com>
7 years ago[media] DaVinci-VPIF-Display: Delete an unnecessary variable initialisation in vpif_c...
Markus Elfring [Wed, 12 Oct 2016 13:43:12 +0000 (10:43 -0300)]
[media] DaVinci-VPIF-Display: Delete an unnecessary variable initialisation in vpif_channel_isr()

The local variable "channel_id" will be reassigned with the following
statement at the beginning. Thus omit the explicit initialisation.

Signed-off-by: Markus Elfring <elfring@users.sourceforge.net>
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-Display: Adjust 11 checks for null pointers
Markus Elfring [Wed, 12 Oct 2016 13:40:32 +0000 (10:40 -0300)]
[media] DaVinci-VPIF-Display: Adjust 11 checks for null pointers

The script "checkpatch.pl" pointed information out like the following.

Comparison to NULL could be written...

Thus fix the affected source code places.

Signed-off-by: Markus Elfring <elfring@users.sourceforge.net>
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-Display: Delete an error message for a failed memory allocation
Markus Elfring [Wed, 12 Oct 2016 13:38:41 +0000 (10:38 -0300)]
[media] DaVinci-VPIF-Display: Delete an error message for a failed memory allocation

Omit an extra message for a memory allocation failure in this function.

Link: http://events.linuxfoundation.org/sites/events/files/slides/LCJ16-Refactor_Strings-WSang_0.pdf
Signed-off-by: Markus Elfring <elfring@users.sourceforge.net>
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-Display: Use kcalloc() in vpif_probe()
Markus Elfring [Wed, 12 Oct 2016 13:30:44 +0000 (10:30 -0300)]
[media] DaVinci-VPIF-Display: Use kcalloc() in vpif_probe()

* A multiplication for the size determination of a memory allocation
  indicated that an array data structure should be processed.
  Thus use the corresponding function "kcalloc".

  This issue was detected by using the Coccinelle software.

* Replace the specification of a data type by a pointer dereference
  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: Hans Verkuil <hans.verkuil@cisco.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab@s-opensource.com>
7 years ago[media] DaVinci-VPIF-Capture: Delete an unnecessary variable initialisation in vpif_c...
Markus Elfring [Wed, 12 Oct 2016 13:25:08 +0000 (10:25 -0300)]
[media] DaVinci-VPIF-Capture: Delete an unnecessary variable initialisation in vpif_channel_isr()

The local variable "channel_id" 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: Hans Verkuil <hans.verkuil@cisco.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab@s-opensource.com>
7 years ago[media] DaVinci-VPIF-Capture: Delete an unnecessary variable initialisation in vpif_q...
Markus Elfring [Wed, 12 Oct 2016 13:22:45 +0000 (10:22 -0300)]
[media] DaVinci-VPIF-Capture: Delete an unnecessary variable initialisation in vpif_querystd()

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: Hans Verkuil <hans.verkuil@cisco.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab@s-opensource.com>
7 years ago[media] DaVinci-VPIF-Capture: Adjust ten checks for null pointers
Markus Elfring [Wed, 12 Oct 2016 13:20:34 +0000 (10:20 -0300)]
[media] DaVinci-VPIF-Capture: Adjust ten checks for null pointers

The script "checkpatch.pl" pointed information out like the following.

Comparison to NULL could be written ...

Thus fix the affected source code places.

Signed-off-by: Markus Elfring <elfring@users.sourceforge.net>
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: Delete an error message for a failed memory allocation
Markus Elfring [Wed, 12 Oct 2016 13:18:45 +0000 (10:18 -0300)]
[media] DaVinci-VPIF-Capture: Delete an error message for a failed memory allocation

Omit an extra message for a memory allocation failure in this function.

Link: http://events.linuxfoundation.org/sites/events/files/slides/LCJ16-Refactor_Strings-WSang_0.pdf
Signed-off-by: Markus Elfring <elfring@users.sourceforge.net>
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: Use kcalloc() in vpif_probe()
Markus Elfring [Wed, 12 Oct 2016 13:15:34 +0000 (10:15 -0300)]
[media] DaVinci-VPIF-Capture: Use kcalloc() in vpif_probe()

* A multiplication for the size determination of a memory allocation
  indicated that an array data structure should be processed.
  Thus use the corresponding function "kcalloc".

  This issue was detected by using the Coccinelle software.

* Replace the specification of a data type by a pointer dereference
  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: Hans Verkuil <hans.verkuil@cisco.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab@s-opensource.com>
7 years ago[media] DaVinci-VPFE-Capture: Delete an unnecessary return statement in vpfe_unregist...
Markus Elfring [Wed, 12 Oct 2016 13:10:54 +0000 (10:10 -0300)]
[media] DaVinci-VPFE-Capture: Delete an unnecessary return statement in vpfe_unregister_ccdc_device()

The script "checkpatch.pl" pointed information out like the following.

WARNING: void function return statements are not generally useful

Thus remove such a statement here.

Signed-off-by: Markus Elfring <elfring@users.sourceforge.net>
Signed-off-by: Hans Verkuil <hans.verkuil@cisco.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab@s-opensource.com>
7 years ago[media] DaVinci-VPFE-Capture: Delete unnecessary braces in vpfe_isr()
Markus Elfring [Wed, 12 Oct 2016 12:54:21 +0000 (09:54 -0300)]
[media] DaVinci-VPFE-Capture: Delete unnecessary braces in vpfe_isr()

Do not use curly brackets at one source code place
where a single statement should be sufficient.

Signed-off-by: Markus Elfring <elfring@users.sourceforge.net>
Signed-off-by: Hans Verkuil <hans.verkuil@cisco.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab@s-opensource.com>
7 years ago[media] DaVinci-VPFE-Capture: Move two assignments in vpfe_s_input()
Markus Elfring [Wed, 12 Oct 2016 09:22:23 +0000 (06:22 -0300)]
[media] DaVinci-VPFE-Capture: Move two assignments in vpfe_s_input()

Move assignments for two local variables into an else branch so that
their setting will only be performed after corresponding data processing
succeeded by this function.

Signed-off-by: Markus Elfring <elfring@users.sourceforge.net>
Signed-off-by: Hans Verkuil <hans.verkuil@cisco.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab@s-opensource.com>
7 years ago[media] DaVinci-VPFE-Capture: Delete an unnecessary variable initialisation in 11...
Markus Elfring [Wed, 12 Oct 2016 08:50:54 +0000 (05:50 -0300)]
[media] DaVinci-VPFE-Capture: Delete an unnecessary variable initialisation in 11 functions

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: Hans Verkuil <hans.verkuil@cisco.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab@s-opensource.com>
7 years ago[media] DaVinci-VPFE-Capture: Adjust 13 checks for null pointers
Markus Elfring [Wed, 12 Oct 2016 08:46:28 +0000 (05:46 -0300)]
[media] DaVinci-VPFE-Capture: Adjust 13 checks for null pointers

Convert comparisons with the preprocessor symbol "NULL" to condition checks
without it.

Signed-off-by: Markus Elfring <elfring@users.sourceforge.net>
Signed-off-by: Hans Verkuil <hans.verkuil@cisco.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab@s-opensource.com>
7 years ago[media] DaVinci-VPFE-Capture: Improve another size determination in vpfe_open()
Markus Elfring [Wed, 12 Oct 2016 08:44:05 +0000 (05:44 -0300)]
[media] DaVinci-VPFE-Capture: Improve another size determination in vpfe_open()

Replace the specification of a data structure 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: Hans Verkuil <hans.verkuil@cisco.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab@s-opensource.com>
7 years ago[media] DaVinci-VPFE-Capture: Delete an unnecessary variable initialisation in vpfe_p...
Markus Elfring [Wed, 12 Oct 2016 08:30:28 +0000 (05:30 -0300)]
[media] DaVinci-VPFE-Capture: Delete an unnecessary variable initialisation in vpfe_probe()

* Return an error code as a constant after a failed call of
  the function "vpfe_initialize".

* The local variable "ret" will be set then 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: Hans Verkuil <hans.verkuil@cisco.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab@s-opensource.com>
7 years ago[media] DaVinci-VPFE-Capture: Improve another size determination in vpfe_probe()
Markus Elfring [Wed, 12 Oct 2016 08:24:57 +0000 (05:24 -0300)]
[media] DaVinci-VPFE-Capture: Improve another size determination in vpfe_probe()

Replace the specification of a data structure 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: Hans Verkuil <hans.verkuil@cisco.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab@s-opensource.com>
7 years ago[media] DaVinci-VPFE-Capture: Delete three error messages for a failed memory allocation
Markus Elfring [Wed, 12 Oct 2016 08:22:47 +0000 (05:22 -0300)]
[media] DaVinci-VPFE-Capture: Delete three error 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 two functions.

Link: http://events.linuxfoundation.org/sites/events/files/slides/LCJ16-Refactor_Strings-WSang_0.pdf
Signed-off-by: Markus Elfring <elfring@users.sourceforge.net>
Signed-off-by: Hans Verkuil <hans.verkuil@cisco.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab@s-opensource.com>
7 years ago[media] DaVinci-VPFE-Capture: Use kmalloc_array() in vpfe_probe()
Markus Elfring [Wed, 12 Oct 2016 08:20:02 +0000 (05:20 -0300)]
[media] DaVinci-VPFE-Capture: Use kmalloc_array() in vpfe_probe()

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

* Replace the specification of a data type by a pointer dereference
  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: Hans Verkuil <hans.verkuil@cisco.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab@s-opensource.com>
7 years ago[media] DaVinci-VPBE: Delete an unnecessary variable initialisation in vpbe_set_output()
Markus Elfring [Wed, 12 Oct 2016 08:16:23 +0000 (05:16 -0300)]
[media] DaVinci-VPBE: Delete an unnecessary variable initialisation in vpbe_set_output()

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: Hans Verkuil <hans.verkuil@cisco.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab@s-opensource.com>
7 years ago[media] DaVinci-VPBE: Rename a jump label in vpbe_set_output()
Markus Elfring [Wed, 12 Oct 2016 08:10:19 +0000 (05:10 -0300)]
[media] DaVinci-VPBE: Rename a jump label in vpbe_set_output()

Adjust jump labels according to the Linux coding style convention.

Signed-off-by: Markus Elfring <elfring@users.sourceforge.net>
Signed-off-by: Hans Verkuil <hans.verkuil@cisco.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab@s-opensource.com>
7 years ago[media] DaVinci-VPBE: Reduce the scope for a variable in vpbe_set_default_output()
Markus Elfring [Wed, 12 Oct 2016 07:54:26 +0000 (04:54 -0300)]
[media] DaVinci-VPBE: Reduce the scope for a variable in vpbe_set_default_output()

* Move the definition for the variable "ret" into an if branch
  so that an extra initialisation can be avoided at the beginning
  by this refactoring.

* Return a success code as a constant at the end.

Signed-off-by: Markus Elfring <elfring@users.sourceforge.net>
Signed-off-by: Hans Verkuil <hans.verkuil@cisco.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab@s-opensource.com>
7 years ago[media] DaVinci-VPBE: Return the success indication only as a constant in vpbe_set_mode()
Markus Elfring [Wed, 12 Oct 2016 07:51:29 +0000 (04:51 -0300)]
[media] DaVinci-VPBE: Return the success indication only as a constant in vpbe_set_mode()

* Return a success code without storing it in an intermediate variable.

* Delete the local variable "ret" which became unnecessary with
  this refactoring.

Signed-off-by: Markus Elfring <elfring@users.sourceforge.net>
Signed-off-by: Hans Verkuil <hans.verkuil@cisco.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab@s-opensource.com>
7 years ago[media] DaVinci-VPBE: Return an error code only as a constant in vpbe_probe()
Markus Elfring [Tue, 11 Oct 2016 11:43:25 +0000 (08:43 -0300)]
[media] DaVinci-VPBE: Return an error code only as a constant in vpbe_probe()

* Return an error code without storing it in an intermediate variable.

* Delete the local variable "ret" which became unnecessary with
  this refactoring.

Signed-off-by: Markus Elfring <elfring@users.sourceforge.net>
Signed-off-by: Hans Verkuil <hans.verkuil@cisco.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab@s-opensource.com>
7 years ago[media] DaVinci-VPBE: Adjust 16 checks for null pointers
Markus Elfring [Tue, 11 Oct 2016 11:37:10 +0000 (08:37 -0300)]
[media] DaVinci-VPBE: Adjust 16 checks for null pointers

The script "checkpatch.pl" pointed information out like the following.

Comparison to NULL could be written ...

Thus fix the affected source code places.

Signed-off-by: Markus Elfring <elfring@users.sourceforge.net>
Signed-off-by: Hans Verkuil <hans.verkuil@cisco.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab@s-opensource.com>
7 years ago[media] DaVinci-VPBE: Delete two error messages for a failed memory allocation
Markus Elfring [Tue, 11 Oct 2016 07:56:13 +0000 (04:56 -0300)]
[media] DaVinci-VPBE: Delete two error 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 two functions.

Link: http://events.linuxfoundation.org/sites/events/files/slides/LCJ16-Refactor_Strings-WSang_0.pdf
Signed-off-by: Markus Elfring <elfring@users.sourceforge.net>
Signed-off-by: Hans Verkuil <hans.verkuil@cisco.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab@s-opensource.com>
7 years ago[media] DaVinci-VPBE: Use kmalloc_array() in vpbe_initialize()
Markus Elfring [Tue, 11 Oct 2016 07:40:41 +0000 (04:40 -0300)]
[media] DaVinci-VPBE: Use kmalloc_array() in vpbe_initialize()

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

* Replace the specification of a data type by a pointer dereference
  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: Hans Verkuil <hans.verkuil@cisco.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab@s-opensource.com>
7 years ago[media] blackfin-capture: Delete an error message for a failed memory allocation
Markus Elfring [Sun, 9 Oct 2016 19:30:18 +0000 (16:30 -0300)]
[media] blackfin-capture: Delete an error message 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 statement here.

Link: http://events.linuxfoundation.org/sites/events/files/slides/LCJ16-Refactor_Strings-WSang_0.pdf
Signed-off-by: Markus Elfring <elfring@users.sourceforge.net>
Signed-off-by: Hans Verkuil <hans.verkuil@cisco.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab@s-opensource.com>
7 years ago[media] blackfin-capture: Use kcalloc() in bcap_init_sensor_formats()
Markus Elfring [Sun, 9 Oct 2016 19:12:13 +0000 (16:12 -0300)]
[media] blackfin-capture: Use kcalloc() in bcap_init_sensor_formats()

A multiplication for the size determination of a memory allocation
indicated that an array data structure should be processed.
Thus reuse the corresponding function "kcalloc".

This issue was detected by using the Coccinelle software.

Signed-off-by: Markus Elfring <elfring@users.sourceforge.net>
Signed-off-by: Hans Verkuil <hans.verkuil@cisco.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab@s-opensource.com>
7 years ago[media] cx88-dsp: Add some spaces for better code readability
Markus Elfring [Fri, 7 Oct 2016 20:30:40 +0000 (17:30 -0300)]
[media] cx88-dsp: Add some spaces for better code readability

Use space characters at some source code places according to
the Linux coding style convention.

Signed-off-by: Markus Elfring <elfring@users.sourceforge.net>
Signed-off-by: Hans Verkuil <hans.verkuil@cisco.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab@s-opensource.com>
7 years ago[media] cx88-dsp: Use kmalloc_array() in read_rds_samples()
Markus Elfring [Fri, 7 Oct 2016 20:07:27 +0000 (17:07 -0300)]
[media] cx88-dsp: Use kmalloc_array() in read_rds_samples()

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

* Replace the specification of a data type by a pointer dereference
  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: Hans Verkuil <hans.verkuil@cisco.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab@s-opensource.com>
7 years ago[media] dvb-tc90522: Rename a jump label in tc90522_probe()
Markus Elfring [Fri, 7 Oct 2016 19:13:57 +0000 (16:13 -0300)]
[media] dvb-tc90522: Rename a jump label in tc90522_probe()

Adjust a jump label according to the Linux coding style convention.

Signed-off-by: Markus Elfring <elfring@users.sourceforge.net>
Signed-off-by: Hans Verkuil <hans.verkuil@cisco.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab@s-opensource.com>
7 years ago[media] dvb-tc90522: Use kmalloc_array() in tc90522_master_xfer()
Markus Elfring [Fri, 7 Oct 2016 19:07:43 +0000 (16:07 -0300)]
[media] dvb-tc90522: Use kmalloc_array() in tc90522_master_xfer()

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: Hans Verkuil <hans.verkuil@cisco.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab@s-opensource.com>
7 years ago[media] v4l2-flash-led-class: remove a now unused var
Mauro Carvalho Chehab [Mon, 24 Oct 2016 20:42:30 +0000 (18:42 -0200)]
[media] v4l2-flash-led-class: remove a now unused var

commit 079933dbcb02 ("[media] v4l: flash led class: Fix of_node release
in probe() error path") removed the need of an ancillary var at
the release function, as reported by smatch:

drivers/media/v4l2-core/v4l2-flash-led-class.c: In function 'v4l2_flash_release':
drivers/media/v4l2-core/v4l2-flash-led-class.c:678:23: warning: variable 'led_cdev' set but not used [-Wunused-but-set-variable]
  struct led_classdev *led_cdev;
                       ^~~~~~~~

Get rid of it.

Fixes: commit 079933dbcb02 ("[media] v4l: flash led class: Fix of_node release in probe() error path")
Signed-off-by: Mauro Carvalho Chehab <mchehab@s-opensource.com>
7 years ago[media] v4l: flash led class: Fix of_node release in probe() error path
Sakari Ailus [Wed, 5 Oct 2016 07:13:10 +0000 (04:13 -0300)]
[media] v4l: flash led class: Fix of_node release in probe() error path

The sub-device's OF node was used (of_node_get()) if it was set, but
device's OF node was always put. Fix this.

Signed-off-by: Sakari Ailus <sakari.ailus@linux.intel.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab@s-opensource.com>
7 years ago[media] coda: fix the error path in coda_probe()
Fabio Estevam [Tue, 4 Oct 2016 15:41:37 +0000 (12:41 -0300)]
[media] coda: fix the error path in coda_probe()

In the case of coda_firmware_request() failure, we should release the
prevously acquired resources.

Signed-off-by: Fabio Estevam <fabio.estevam@nxp.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab@s-opensource.com>
7 years ago[media] Add Cinergy S2 rev.4 support
Enrico Mioso [Tue, 4 Oct 2016 11:13:27 +0000 (08:13 -0300)]
[media] Add Cinergy S2 rev.4 support

This patch derives from previous one(s) by CrazyCat. I used the commit adding rev.3 to mainline Linux kernel as an example, so credits go to its author(s).
The hardware seems to scan and tune OK.

Signed-off-by: Enrico Mioso <mrkiko.rs@gmail.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab@s-opensource.com>
7 years ago[media] bcm2048: Remove FSF mailing address
Wayne Porter [Sun, 2 Oct 2016 00:06:27 +0000 (21:06 -0300)]
[media] bcm2048: Remove FSF mailing address

FSF address changes, checkpatch recommends removing it

Signed-off-by: Wayne Porter <wporter82@gmail.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab@s-opensource.com>
7 years ago[media] rc: nuvoton: use managed versions of rc_allocate_device and rc_register_device
Heiner Kallweit [Fri, 30 Sep 2016 20:42:17 +0000 (17:42 -0300)]
[media] rc: nuvoton: use managed versions of rc_allocate_device and rc_register_device

Simplify the remove function and the error path in the probe function by
using the managed versions of rc_allocate_device and rc_register_device.

Signed-off-by: Heiner Kallweit <hkallweit1@gmail.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab@s-opensource.com>
7 years ago[media] rc: core: add managed versions of rc_allocate_device and rc_register_device
Heiner Kallweit [Fri, 30 Sep 2016 20:42:07 +0000 (17:42 -0300)]
[media] rc: core: add managed versions of rc_allocate_device and rc_register_device

Introduce managed versions of both functions.
They allows to simplify the error path in the probe function of
rc drivers, and usually also to simplify the remove function.

New element managed_alloc in struct rc_dev is needed to correctly
handle mixed use, e.g. managed version of rc_register_device and
normal version of rc_allocate_device.

In addition devm_rc_allocate_device sets rc->dev.parent as having a
reference to the parent device might be useful for future extensions.

Signed-off-by: Heiner Kallweit <hkallweit1@gmail.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab@s-opensource.com>
7 years ago[media] stih-cec: remove unused including <linux/version.h>
Wei Yongjun [Wed, 28 Sep 2016 15:13:13 +0000 (12:13 -0300)]
[media] stih-cec: remove unused including <linux/version.h>

Remove including <linux/version.h> that don't need it.

Signed-off-by: Wei Yongjun <weiyongjun1@huawei.com>
Acked-by: Benjamin Gaignard <benjamin.gaignard@linaro.org>
Signed-off-by: Mauro Carvalho Chehab <mchehab@s-opensource.com>
7 years ago[media] atmel-isc: start dma in some scenario
Songjun Wu [Wed, 28 Sep 2016 05:28:57 +0000 (02:28 -0300)]
[media] atmel-isc: start dma in some scenario

If a new vb buf is added to vb queue, the queue is
empty and steaming, dma should be started.

Signed-off-by: Songjun Wu <songjun.wu@microchip.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab@s-opensource.com>
7 years ago[media] rc: ir-raw: change type of available_protocols to atomic64_t
Heiner Kallweit [Tue, 27 Sep 2016 19:48:47 +0000 (16:48 -0300)]
[media] rc: ir-raw: change type of available_protocols to atomic64_t

Changing available_protocols to atomic64_t allows to get rid of the
mutex protecting access to the variable. This helps to simplify
the code.

Signed-off-by: Heiner Kallweit <hkallweit1@gmail.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab@s-opensource.com>
7 years ago[media] VPU: mediatek: Fix return value in case of error
Christophe JAILLET [Fri, 23 Sep 2016 21:19:01 +0000 (18:19 -0300)]
[media] VPU: mediatek: Fix return value in case of error

If 'dma_alloc_coherent()' returns NULL, 'vpu_alloc_ext_mem()' will
return 0 which means success.
Return -ENOMEM instead.

Signed-off-by: Christophe JAILLET <christophe.jaillet@wanadoo.fr>
Signed-off-by: Mauro Carvalho Chehab <mchehab@s-opensource.com>
7 years ago[media] media: platform: pxa_camera: add missing sensor power on
Robert Jarzmik [Fri, 23 Sep 2016 18:41:39 +0000 (15:41 -0300)]
[media] media: platform: pxa_camera: add missing sensor power on

During sensors binding, there is a window where the sensor is switched
off, while there is a call it to set a new format, which can end up in
an access to the sensor, especially an I2C based sensor.

Remove this window by activating the sensor.

Signed-off-by: Robert Jarzmik <robert.jarzmik@free.fr>
Signed-off-by: Mauro Carvalho Chehab <mchehab@s-opensource.com>
7 years ago[media] tw5864: crop picture width to 704
Andrey Utkin [Thu, 22 Sep 2016 00:04:20 +0000 (21:04 -0300)]
[media] tw5864: crop picture width to 704

Previously, width of 720 was used, but it gives 16-pixel wide black bar
at right side of encoded picture.

Signed-off-by: Andrey Utkin <andrey.utkin@corp.bluecherry.net>
Signed-off-by: Mauro Carvalho Chehab <mchehab@s-opensource.com>
7 years ago[media] cx88: fix error return code in cx8802_dvb_probe()
Wei Yongjun [Wed, 21 Sep 2016 15:12:58 +0000 (12:12 -0300)]
[media] cx88: fix error return code in cx8802_dvb_probe()

Fix to return error code -ENODEV from the error handling case
instead of 0(err maybe overwrited to 0 in the for loop), as
done elsewhere in this function.

[mchehab@s-opensource.com: remove a now uneeded set for err = -ENODEV]

Signed-off-by: Wei Yongjun <weiyongjun1@huawei.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab@s-opensource.com>
7 years ago[media] bdisp: fix error return code in bdisp_probe()
Wei Yongjun [Wed, 21 Sep 2016 15:09:38 +0000 (12:09 -0300)]
[media] bdisp: fix error return code in bdisp_probe()

Fix to return error code -EINVAL from the platform_get_resource() error
handling case instead of 0, as done elsewhere in this function.

Signed-off-by: Wei Yongjun <weiyongjun1@huawei.com>
Reviewed-by: Fabien Dessenne <fabien.dessenne@st.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab@s-opensource.com>
7 years ago[media] gs1662: drop kfree for memory allocated with devm_kzalloc
Wei Yongjun [Wed, 21 Sep 2016 13:09:39 +0000 (10:09 -0300)]
[media] gs1662: drop kfree for memory allocated with devm_kzalloc

It's not necessary to free memory allocated with devm_kzalloc
and using kfree leads to a double free.

Fixes: 7aae6e2df127 ("[media] Add GS1662 driver, a video serializer")

Signed-off-by: Wei Yongjun <weiyongjun1@huawei.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab@s-opensource.com>
7 years ago[media] gs1662: remove .owner field for driver
Wei Yongjun [Wed, 21 Sep 2016 13:09:23 +0000 (10:09 -0300)]
[media] gs1662: remove .owner field for driver

Remove .owner field if calls are used which set it automatically.

Generated by: scripts/coccinelle/api/platform_no_drv_owner.cocci

Signed-off-by: Wei Yongjun <weiyongjun1@huawei.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab@s-opensource.com>
7 years ago[media] platform: pxa_camera: add VIDEO_V4L2 dependency
Arnd Bergmann [Mon, 19 Sep 2016 12:46:30 +0000 (09:46 -0300)]
[media] platform: pxa_camera: add VIDEO_V4L2 dependency

Moving the pxa_camera driver from soc_camera lots the implied
VIDEO_V4L2 Kconfig dependency, and building the driver without
V4L2 results in a kernel that cannot link:

drivers/media/platform/pxa_camera.o: In function `pxa_camera_remove':
pxa_camera.c:(.text.pxa_camera_remove+0x10): undefined reference to `v4l2_clk_unregister'
pxa_camera.c:(.text.pxa_camera_remove+0x18): undefined reference to `v4l2_device_unregister'
drivers/media/platform/pxa_camera.o: In function `pxa_camera_probe':
pxa_camera.c:(.text.pxa_camera_probe+0x458): undefined reference to `v4l2_of_parse_endpoint'
drivers/media/v4l2-core/videobuf2-core.o: In function `__enqueue_in_driver':
drivers/media/v4l2-core/videobuf2-core.o: In function `vb2_core_streamon':
videobuf2-core.c:(.text.vb2_core_streamon+0x1b4): undefined reference to `v4l_vb2q_enable_media_source'
drivers/media/v4l2-core/videobuf2-v4l2.o: In function `vb2_ioctl_reqbufs':
videobuf2-v4l2.c:(.text.vb2_ioctl_reqbufs+0xc): undefined reference to `video_devdata'

This adds back an explicit dependency.

Fixes: 3050b9985024 ("[media] media: platform: pxa_camera: move pxa_camera out of soc_camera")

Signed-off-by: Arnd Bergmann <arnd@arndb.de>
Acked-by: Robert Jarzmik <robert.jarzmik@free.fr>
Signed-off-by: Mauro Carvalho Chehab <mchehab@s-opensource.com>
7 years ago[media] lirc_imon: use complete() instead complete_all()
Daniel Wagner [Fri, 16 Sep 2016 11:18:22 +0000 (08:18 -0300)]
[media] lirc_imon: use complete() instead complete_all()

There is only one waiter for the completion, therefore there
is no need to use complete_all(). Let's make that clear by
using complete() instead of complete_all().

While we are at it, we do a small optimization with the
reinitialization of the completion before we use it.

The usage pattern of the completion is:

waiter context                          waker context

send_packet()
  reinit_completion()
  usb_sumbit_urb()
  wait_for_completion_interruptible()

                                        usb_tx_callback()
                                          complete()

                                        imon_disconnect()
                                          complete()

Signed-off-by: Daniel Wagner <daniel.wagner@bmw-carit.de>
Signed-off-by: Mauro Carvalho Chehab <mchehab@s-opensource.com>