Hans Verkuil [Wed, 30 Aug 2017 08:39:00 +0000 (04:39 -0400)]
media: atomisp: fix small Kconfig issues
The help text should be indented by at least two spaces after the
'help' separator. This is both good practice and the media_build system
for building media drivers makes this assumption.
Fix this for the atomisp/i2c/Kconfig and fix the atomisp/pci/Kconfig
that didn't align the help separator with the preceding keywords.
Signed-off-by: Hans Verkuil <hans.verkuil@cisco.com> Signed-off-by: Sakari Ailus <sakari.ailus@linux.intel.com> Signed-off-by: Mauro Carvalho Chehab <mchehab@s-opensource.com>
driver_attribute are not supposed to change at runtime.
Functions driver_create_file/driver_remove_file are working with
const driver_attribute. So mark the non-const structs as const.
Hans Verkuil [Wed, 30 Aug 2017 08:47:21 +0000 (04:47 -0400)]
media: fix media Kconfig help syntax issues
The help text should be indented by at least two spaces after the
'help' separator. This is both good practice and the media_build system
for building media drivers makes this assumption.
I went through all Kconfigs under drivers/media and fixed any bad help
sections. This makes it conform to the common practice and should fix
problems with 'make menuconfig' when using media_build. This is due to
a "WARNING" message that media_build can insert in the Kconfig and that
assumes the help text is indented by at least two spaces. If not, then the
Kconfig becomes invalid and 'make menuconfig' fails.
Signed-off-by: Hans Verkuil <hans.verkuil@cisco.com> Reported-by: Thomas Kaiser <linux-dvb@kaiser-linux.li> Signed-off-by: Mauro Carvalho Chehab <mchehab@s-opensource.com>
Hans Verkuil [Mon, 28 Aug 2017 08:45:58 +0000 (04:45 -0400)]
media: cobalt: do not register subdev nodes
In the distant past the adv7604 driver used private controls. In order
to access them the v4l-subdevX nodes were needed. Later the is_private
tag was removed in the adv7604 driver and the need for v4l-subdevX
device nodes disappeared.
Remove the creation of those device nodes from this driver.
Note: the cobalt card is only used inside Cisco and we never actually
used the v4l-subdevX nodes for anything. So this API change can be done
safely without breaking anything.
Signed-off-by: Hans Verkuil <hans.verkuil@cisco.com> Acked-by: Sakari Ailus <sakari.ailus@linux.intel.com> Signed-off-by: Mauro Carvalho Chehab <mchehab@s-opensource.com>
Markus Elfring [Thu, 7 Sep 2017 20:37:16 +0000 (16:37 -0400)]
media: davinci: do a couple of checkpatch cleanups
- Delete an error message for a failed memory allocation
in init_vpbe_layer();
- Replace the specification of data structures by pointer dereferences
as the parameter for the operator "sizeof" to make the corresponding
size determination a bit safer according to the Linux coding style
convention;
- media: DaVinci-VPBE-Display: Improve a size determination in two
functions
- Adjust 12 checks for null pointers
Those issues were pointed by checkpatch.pl and Coccinelle.
[mchehab@s-opensource.com: fold three cleanup patches into one] Signed-off-by: Markus Elfring <elfring@users.sourceforge.net> Acked-by: Lad, Prabhakar <prabhakar.csengg@gmail.com> Signed-off-by: Hans Verkuil <hans.verkuil@cisco.com> Signed-off-by: Mauro Carvalho Chehab <mchehab@s-opensource.com>
Don't populate the array buf on the stack, instead make it static.
Makes the object code smaller by over 240 bytes:
Before:
text data bss dec hex filename
21689 22992 416 45097 b029 cx23885-cards.o
After:
text data bss dec hex filename
21348 23088 416 44852 af34 cx23885-cards.o
Signed-off-by: Colin Ian King <colin.king@canonical.com> Signed-off-by: Hans Verkuil <hansverk@cisco.com> Signed-off-by: Mauro Carvalho Chehab <mchehab@s-opensource.com>
Don't populate the arrays res_x and resy_y on the stack, instead make them
static const. Makes the object code smaller by over 160 bytes:
Before:
text data bss dec hex filename
10509 2800 64 13373 343d ov9640.o
After:
text data bss dec hex filename
10184 2960 64 13208 3398 ov9640.o
Signed-off-by: Colin Ian King <colin.king@canonical.com> Signed-off-by: Hans Verkuil <hansverk@cisco.com> Signed-off-by: Mauro Carvalho Chehab <mchehab@s-opensource.com>
Colin Ian King [Tue, 5 Sep 2017 15:19:44 +0000 (11:19 -0400)]
media: cobalt: remove redundant zero check on retval
The error handling paths all end up with retval being non-zero,
so the check for retval being zero is always false and hence
is redundant. Remove it.
Detected by CoverityScan CID#1309479 ("Logically dead code")
Signed-off-by: Colin Ian King <colin.king@canonical.com> Signed-off-by: Hans Verkuil <hansverk@cisco.com> Signed-off-by: Mauro Carvalho Chehab <mchehab@s-opensource.com>
Don't populate the array syds on the stack, instead make it static const.
Makes the object code smaller by over 280 bytes:
Before:
text data bss dec hex filename
81451 12784 704 94939 172db cx25840-core.o
text data bss dec hex filename
81070 12880 704 94654 171be cx25840-core.o
Signed-off-by: Colin Ian King <colin.king@canonical.com> Signed-off-by: Hans Verkuil <hansverk@cisco.com> Signed-off-by: Mauro Carvalho Chehab <mchehab@s-opensource.com>
Thomas Meyer [Sun, 3 Sep 2017 12:19:31 +0000 (08:19 -0400)]
media: lgdt3306a: Use ARRAY_SIZE macro
Use ARRAY_SIZE macro, rather than explicitly coding some variant of it
yourself.
Found with: find -type f -name "*.c" -o -name "*.h" | xargs perl -p -i -e
's/\bsizeof\s*\(\s*(\w+)\s*\)\s*\ /\s*sizeof\s*\(\s*\1\s*\[\s*0\s*\]\s*\)
/ARRAY_SIZE(\1)/g' and manual check/verification.
Signed-off-by: Thomas Meyer <thomas@m3y3r.de> Signed-off-by: Hans Verkuil <hansverk@cisco.com> Signed-off-by: Mauro Carvalho Chehab <mchehab@s-opensource.com>
Colin Ian King [Fri, 1 Sep 2017 15:35:08 +0000 (11:35 -0400)]
media: rtl28xxu: make array rc_nec_tab static const
Don't populate the array rc_nec_tab on the stack, instead make it
static const. Makes the object code smaller by over 620 bytes:
Before:
text data bss dec hex filename
49511 17040 64 66615 10437 rtl28xxu.o
After:
text data bss dec hex filename
48825 17104 64 65993 101c9 rtl28xxu.o
Signed-off-by: Colin Ian King <colin.king@canonical.com> Signed-off-by: Hans Verkuil <hansverk@cisco.com> Signed-off-by: Mauro Carvalho Chehab <mchehab@s-opensource.com>
Markus Elfring [Mon, 28 Aug 2017 09:55:16 +0000 (05:55 -0400)]
media: drivers: improve a size determination
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 according to the Linux coding style convention.
This issue was detected by using the Coccinelle software.
[mchehab@s-opensoure.com: merge similar patches into one]
Signed-off-by: Markus Elfring <elfring@users.sourceforge.net> Signed-off-by: Hans Verkuil <hansverk@cisco.com>
Hans Verkuil [Wed, 28 Jun 2017 08:14:28 +0000 (04:14 -0400)]
media: cec-gpio: add HDMI CEC GPIO driver
Add a simple HDMI CEC GPIO driver that sits on top of the cec-pin framework.
While I have heard of SoCs that use the GPIO pin for CEC (apparently an
early RockChip SoC used that), the main use-case of this driver is to
function as a debugging tool.
By connecting the CEC line to a GPIO pin on a Raspberry Pi 3 for example
it turns it into a CEC debugger and protocol analyzer.
With 'cec-ctl --monitor-pin' the CEC traffic can be analyzed.
But of course it can also be used with any hardware project where the
HDMI CEC line is hooked up to a pull-up gpio line.
In addition this has (optional) support for tracing HPD changes if the
HPD is connected to a GPIO.
Hans Verkuil [Tue, 15 Aug 2017 14:07:25 +0000 (10:07 -0400)]
media: cec: add CEC_EVENT_PIN_HPD_LOW/HIGH events
Add support for two new low-level events: PIN_HPD_LOW and PIN_HPD_HIGH.
This is specifically meant for use with the upcoming cec-gpio driver
and makes it possible to trace when the HPD pin changes. Some HDMI
sinks do strange things with the HPD and this makes it easy to debug
this.
Note that this also moves the initialization of a devnode mutex and
list to the allocate_adapter function: if the HPD is high, then as
soon as the HPD interrupt is created an interrupt occurs and
cec_queue_pin_hpd_event() is called which requires that the devnode
mutex and list are initialized.
Signed-off-by: Hans Verkuil <hans.verkuil@cisco.com> Signed-off-by: Mauro Carvalho Chehab <mchehab@s-opensource.com>
Jose Abreu [Thu, 14 Sep 2017 15:23:38 +0000 (11:23 -0400)]
media: cec: Respond to unregistered initiators, when applicable
Running CEC 1.4 compliance test we get the following error on test
11.1.6.2: "ERROR: The DUT did not broadcast a
<Report Physical Address> message to the unregistered device."
Fix this by letting GIVE_PHYSICAL_ADDR message respond to unregistered
device. Also, GIVE_DEVICE_VENDOR_ID and GIVE_FEATURES fall in the
same category so, respond also to these messages.
With this fix we pass CEC 1.4 official compliance.
Signed-off-by: Jose Abreu <joabreu@synopsys.com> Cc: Joao Pinto <jpinto@synopsys.com> Signed-off-by: Hans Verkuil <hans.verkuil@cisco.com> Cc: <stable@vger.kernel.org> # for v4.10 and up Signed-off-by: Mauro Carvalho Chehab <mchehab@s-opensource.com>
Hans Verkuil [Thu, 31 Aug 2017 16:56:10 +0000 (12:56 -0400)]
media: s5p-cec: add NACK detection support
The s5p-cec driver returned CEC_TX_STATUS_ERROR for the NACK condition.
Some digging into the datasheet uncovered the S5P_CEC_TX_STAT1 register where
bit 0 indicates if the transmit was nacked or not.
Use this to return the correct CEC_TX_STATUS_NACK status to userspace.
This was the only driver that couldn't tell a NACK from another error, and
that was very unusual. And a potential problem for applications as well.
Tested with my Odroid-U3.
Signed-off-by: Hans Verkuil <hans.verkuil@cisco.com> Acked-by: Sylwester Nawrocki <s.nawrocki@samsung.com> Cc: <stable@vger.kernel.org> # for v4.12 and up Signed-off-by: Mauro Carvalho Chehab <mchehab@s-opensource.com>
Colin Ian King [Tue, 29 Aug 2017 10:21:10 +0000 (06:21 -0400)]
media: qcom: camss: Make function vfe_set_selection static
The function vfe_set_selection is local to the source and does
not need to be in global scope, so make it static.
Cleans up sparse warning:
warning: symbol 'vfe_set_selection' was not declared. Should it be static?
Signed-off-by: Colin Ian King <colin.king@canonical.com> Acked-by: Todor Tomov <todor.tomov@linaro.org> Signed-off-by: Hans Verkuil <hansverk@cisco.com> Signed-off-by: Mauro Carvalho Chehab <mchehab@s-opensource.com>
Add missing init_list_head for the registered buffer list.
Absence of the init could lead to a unhandled kernel paging
request as below, when streamon/streamoff are called in row.
Sean Young [Sat, 2 Sep 2017 11:42:42 +0000 (07:42 -0400)]
media: dvb: i2c transfers over usb cannot be done from stack
Since commit 29d2fef8be11 ("usb: catch attempts to submit urbs
with a vmalloc'd transfer buffer"), the AverMedia AverTV DVB-T
USB 2.0 (a800) fails to probe.
Cc: stable@vger.kernel.org Signed-off-by: Sean Young <sean@mess.org> Signed-off-by: Mauro Carvalho Chehab <mchehab@s-opensource.com>
We get a link error when V4L2_FLASH_LED_CLASS=m and AS3645A is built-in:
drivers/leds/leds-as3645a.o: In function `as3645a_v4l2_setup':
leds-as3645a.c:(.text+0x258): undefined reference to `v4l2_flash_init'
leds-as3645a.c:(.text+0x284): undefined reference to `v4l2_flash_indicator_init'
leds-as3645a.c:(.text+0x2a4): undefined reference to `v4l2_flash_release'
drivers/leds/leds-as3645a.o: In function `as3645a_remove':
leds-as3645a.c:(.text+0x784): undefined reference to `v4l2_flash_release'
This adds the same Kconfig dependency that the other V4L2 flash
drivers in drivers/leds use, to avoid that broken configuration.
Fixes: a56ba8fbcb55 ("media: leds: as3645a: Add LED flash class driver") Signed-off-by: Arnd Bergmann <arnd@arndb.de> Acked-by: Jacek Anaszewski <jacek.anaszewski@gmail.com> Signed-off-by: Sakari Ailus <sakari.ailus@linux.intel.com> Signed-off-by: Mauro Carvalho Chehab <mchehab@s-opensource.com>
The commit was flawed in that if the device_node pointers are different,
then in fact a different device is present and the device node could be
different in ways other than full_name.
As Frank Rowand explained:
"When an overlay (1) is removed, all uses and references to the nodes and
properties in that overlay are no longer valid. Any driver that uses any
information from the overlay _must_ stop using any data from the overlay.
Any driver that is bound to a new node in the overlay _must_ unbind. Any
driver that became bound to a pre-existing node that was modified by the
overlay (became bound after the overlay was applied) _must_ adjust itself
to account for any changes to that node when the overlay is removed. One
way to do this is to unbind when notified that the overlay is about to
be removed, then to re-bind after the overlay is completely removed.
If an overlay (2) is subsequently applied, a node with the same
full_name as from overlay (1) may exist. There is no guarantee
that overlay (1) and overlay (2) are the same overlay, even if
that node has the same full_name in both cases."
Also, there's not sufficient overlay support in mainline to actually
remove and re-apply an overlay to hit this condition as overlays can
only be applied from in kernel APIs.
Fixes: d2180e0cf77d ("[media] v4l: async: make v4l2 coexist with devicetree nodes in a dt overlay") Cc: Javier Martinez Canillas <javier@osg.samsung.com> Cc: Sylwester Nawrocki <s.nawrocki@samsung.com> Cc: Frank Rowand <frowand.list@gmail.com> Signed-off-by: Rob Herring <robh@kernel.org> Acked-by: Javi Merino <javi.merino@kernel.org> Signed-off-by: Sakari Ailus <sakari.ailus@linux.intel.com> Signed-off-by: Mauro Carvalho Chehab <mchehab@s-opensource.com>
Only when the lirc device is freed, should we drop our reference to
rc_dev, else we the rc_dev is freed to early. If userspace has
a file descriptor open during unplug, it goes bang.
==================================================================
BUG: KASAN: use-after-free in __lock_acquire+0x7bb/0x1e10
Read of size 8 at addr ffff8801d7d61ed0 by task ir-rec/2609
Adjust dvb ca.h, dmx.h and frontend.h in order to make
checkpatch happier. Now, it only complains about the typedefs,
and those are there just to provide backward userspace
compatibility.
Sakari Ailus [Sun, 3 Sep 2017 20:12:33 +0000 (16:12 -0400)]
media: docs-rst: media: Don't use \small for V4L2_PIX_FMT_SRGGB10 documentation
There appears to be an issue in using \small in certain cases on Sphinx
1.4 and 1.5. Other format documents don't use \small either, remove it
from here as well.
Signed-off-by: Sakari Ailus <sakari.ailus@linux.intel.com>
[mchehab@s-opensource.com: kept tabularcolumns - readjusted - and
add a few blank lines for it to display better] Acked-by: Sakari Ailus <sakari.ailus@linux.intel.com> Signed-off-by: Mauro Carvalho Chehab <mchehab@s-opensource.com>
media: index.rst: don't write "Contents:" on PDF output
Right now, Sphinx unconditionally creates a blank page with
just "Contents:" on it, on PDF output. While this makes sense
for html, it doesn't o PDF, as LaTeX does what's required
automatically.
While doing a visual inspection with Sphinx 1.5, I noticed that
one of the columns was smaller than the text written there.
As this is the only thing I noticed with Sphinx 1.5, I suspect
that this was also a problem with Sphinx 1.4. Yet, I opted to
touch it in a way that wouldn't cause backward issues.
media: vivid.rst: add a blank line to correct ReST format
On all vivid parameters, there's an space after the parameter,
except for "DV Timings Signal Mode". That makes this single one
to be written in bold, and, at PDF output, at the same line as
its description.
Use the same convention as the other parameters, in order to
adjust its output.
media: v4l2 uapi book: get rid of driver programming's chapter
It doesn't make any sense having a driver programming's chapter
at the uAPI book, as this is related to kernel API. Also,
we now have such kAPI book where V4L2 driver programming is covered.
media: docs-rst: cardlists: change their format to flat-tables
Most tables there don't fit on 80 columns. Some are very big.
While those tables are actually generated via scripts, every
time a new board is added, the entire table could be reformatted.
>From the diffstat PoV, that's bad, as it is hard to see what
happened.
One such example is at changeset 4868f6e1fce6 ("media:
em28xx-cardlist.rst: update to reflect last changes"):
The USB ID for "Plextor ConvertX PX-AV100U" was added to card
number 9, with caused the entire table to be reformatted.
So, instead, use flat-tables. While here, fix PDF output,
by adding tablecolumns to the tables that need it.
A literal box provides a better visual when pdf and html output
is generated for things like the output of a sysfs devnode.
It alsod matches other conventions used within the media book.
Commit 70b074df4ed1 ("media: fix pdf build with Spinx 1.6") caused
a regression at Sphinx 1.4 PDF build: although it produces a full
document in batch mode, it returns errors on interactive mode:
[63]
Runaway argument?
{\relax
! Paragraph ended before \multicolumn was complete.
<to be read again>
\par
l.7703 \hline\end{tabulary}
The error seems to be due to some bug at Sphinx PDF output:
when multicolumns is used, it doesn't accept an empty string.
Just removing the :cpan:`1` and replacing by two empty
columns fix the issue.
Fixes: 70b074df4ed1 ("media: fix pdf build with Spinx 1.6") Signed-off-by: Mauro Carvalho Chehab <mchehab@s-opensource.com>
media: v4l uAPI docs: adjust some tables for PDF output
On tests with Spinx 1.4, some tables are still writing text
outside cells. Adjust those tables.
PS.: As this was revisited several times, I suspect that this
will only be fully fixed if we add tabularcolumns to all tables
at the V4L2 part of the book.
media: vidioc-g-tuner.rst: Fix table number of cols
The Tuner Audio Matrix table is broken: the first row has 7
columns instead of 6, causing it to be parsed wrong and displayed
very badly on PDF output.
Fix it and adjust the table to look nice at PDF output
media: vidioc-querycap: use a more realistic value for KERNEL_VERSION
In the past, V4L2 versions were 0.x.y, but that changed years
ago. Since Kernel 3.1, however, the numbering schema was changed
to match the Kernel version.
However, the presented example still uses the old numerating
schema, with is a misleading information.
media: v4l uAPI: add descriptions for arguments to all ioctls
Several ioctls are missing descriptions for the third argument
of the ioctl() command. They should have a description, as
otherwise the output won't be ok, and will sound like something
is missing.
media: ca.h: document ca_msg and the corresponding ioctls
Usually, CA messages are sent/received via reading/writing at
the CA device node. However, two drivers (dst_ca and firedtv-ci)
also implement it via ioctls.
Apparently, on both cases, the net result is the same.
media: intro.rst: don't assume audio and video codecs to be MPEG2
Originally, when DVB was introduced, all codecs would be part of
MPEG2 standard. That's not true anymore, as there are a large
number of codec standards used on digital TV nowadays.
Do minor editorial changes to improve documentation readability:
- mark literals as such;
- add table markups to hint sizes;
- define what PES means;
- instead of hardcoding devnode numbers to zero (like adapter0/) use a
question mark, to indicate that multiple devnodes may exist;
- add cross-references where useful.
media: dmx-fread.rst: specify how DMX_CHECK_CRC works
In the past, the documentation used to say that, if a CRC error
was found, a "-ECRC" error would be returned. That's not true:
the DVB core will just silently ignore such errors.
media: dvb uAPI docs: Prefer use "Digital TV instead of "DVB"
The usage of the term "DVB" at the dvb API docs is confusing,
as, right now, it can refer to either the European digital TV
standard or to the subsystem.
So, prefer calling it as "Digital TV" on most places, to avoid
ambiguity.
media: dvb uAPI docs: adjust return value ioctl descriptions
There are several issues on the return value for ioctls:
- Text is confusing;
- Some error codes don't exist;
- The non-generic error codes should come before the text
that points to the generic error codes;
- Tables don't contain column size hints;
- Some references are not marked as such.
This ioctl is not implemented at dst_ca driver. There's just
a boilerplate code there. Remove it, as it is unlikely that
anyone would implement it those days.
media: ca-reset.rst: add some description to this ioctl
While we don't have any documentation for it, based on what's
there at Kaffeine and VDR, it seems that this command should
be issued before start using CA. So, document it as such.