[media] DocBook: document typedef dmx_ts_cb at demux.h
The dvb/kdapi.tmpl has already an extensive documentation about
this callback. Now that we've added function typedefs at kernel-doc,
add such documentation at demux.h, for it to appear at device-drivers
DocBook.
A typedef function looks more likely a function and not a
normal typedef. Change the code to use the output_function_*,
in order to properly parse the function prototype parameters.
There are lots of CodingStyle violations here. Now that we're
touching a log on this header files, adding the documentation
here, make sure that this will follow the Kernel CodingStyle.
[media] dvb: Remove unused frontend sources at demux.h and sync doc
The DVB core has a provision for other frontend sources, but no
drivers use it. The kdapi.xml contains provision for some other
frontend source types, but it is not in sync with the code.
There are two callbacks still not documented:
.//drivers/media/dvb-core/demux.h:422: warning: No description found for parameter 'get_pes_pids'
.//drivers/media/dvb-core/demux.h:422: warning: No description found for parameter 'get_stc'
The purpose of first one is clear. The second one is used only
on the obsolete av7110 driver, and its purpose is not clear,
as it just returns a 64-bit word from the firmware to userspace.
Let's document get_pes_pids and mark get_stc as private, adding
a comment to not use it, while this is not documented.
[media] DocBook: Move struct dmx_demux kABI doc to demux.h
The DocBook/media/dvb/kdapi.xml contains the description of
the kABI for DVB. The problem is that, by being maintained
on a separate file and not being updated for years, it got
outdated. So, for example, some callback parameters were
changed, but the DocBook were still using the old stuff.
As a first step to fix it, let's move the documentation of
struct dmx_demux into demux.h and fix the parameters used
there.
For now, don't document any other field nor touch the
descriptions that got moved, letting this job to other
patches. That makes easier to review the patch.
PS.: Please notice that an additional patch will be needed
in order to fix the return values (some uses non-existent
return codes) and to the functions and callbacks mentioned at
the descriptions.
[media] dvb_ca_en50221.h: Make checkpatch.pl happy
There are several CodingStyle violations at the DVB code. While
we won't be fixing them as a hole, let's fix at least the
headers, as we're touching on them already in order to properly
document them.
[media] DocBook: Convert struct lirc_driver to doc-nano format
The struct lirc_driver is already documented, but on some
internal format. Convert it to Kernel doc-nano format and
add documentation for some additional parameters that are
also present at the structure.
This header declares the code and structures used to parse
Hauppauge eeproms. As this is part of the V4L2 common, and
used by several drivers, let's properly document it.
[media] DocBook: add documentation for tuner-types.h
The tuner-types.h is part of the V4L2 core and should be
touched for every new tuner added. So, it deserves to be
documented at the device-drivers DocBook.
Add it to device-drivers.tmpl and add descriptions for
enum param_type and struct tuner_range.
[media] DocBook: convert struct tuner_parms to doc-nano format
The struct tuner_params is almost fully documented, but
using a non-standard way. Convert it to doc-nano format,
and add descriptions for the parameters that aren't
documented yet.
[media] DocBook: Fix remaining issues with VB2 core documentation
Right now, "private:" tag should be lower-case, otherwise the
scripts/kernel-doc won't do the right thing.
Also, no fields after "private:" should be documented. As we don't
want to strip the documentation, let's untag. This way, it will
be seen only at the file, and not at the DocBooks.
[media] vivid: Add an option to configure the maximum number of devices
The vivid driver currently has a hard-coded limit of 64 devices,
however there's nothing that prevents the creation of even more devices.
This commit adds a new driver option (which defaults to 64) to
allow this maximum number to be configurable.
[media] vivid: Fix iteration in driver removal path
When the diver is removed and all the resources are deallocated,
we should be iterating through the created devices only.
Currently, the iteration ends when vivid_devs[i] is NULL. Since
the array contains VIVID_MAX_DEVS elements, it will oops if
n_devs=VIVID_MAX_DEVS because in that case, no element is NULL.
This resolves the following checkpatch problem:
ERROR: code indent should use tabs where possible
[mchehab@osg.samsung.com: remove a hunk already applyed by some other patch] Signed-off-by: Maciek Borzecki <maciek.borzecki@gmail.com> Signed-off-by: Mauro Carvalho Chehab <mchehab@osg.samsung.com>
[media] VIDEO_RENESAS_JPU should depend on HAS_DMA
If NO_DMA=y:
warning: (VIDEO_STI_BDISP && VIDEO_RENESAS_JPU && VIDEO_DM365_VPFE && VIDEO_OMAP4) selects VIDEOBUF2_DMA_CONTIG which has unmet direct dependencies (MEDIA_SUPPORT && HAS_DMA)
drivers/media/v4l2-core/videobuf2-dma-contig.c: In function ‘vb2_dc_mmap’:
drivers/media/v4l2-core/videobuf2-dma-contig.c:207: error: implicit declaration of function ‘dma_mmap_coherent’
drivers/media/v4l2-core/videobuf2-dma-contig.c: In function ‘vb2_dc_get_base_sgt’:
drivers/media/v4l2-core/videobuf2-dma-contig.c:390: error: implicit declaration of function ‘dma_get_sgtable’
VIDEO_RENESAS_JPU selects VIDEOBUF2_DMA_CONTIG, which bypasses its
dependency on HAS_DMA. Make VIDEO_RENESAS_JPU depend on HAS_DMA to fix
this.
[media] staging: lirc: lirc_serial: use dynamic debugs
Replace custom debug macro dprintk() with pr_debug() or
dev_dbg(). Remove unused module param `debug`.
This removes the following checkpatch warning:
WARNING: Prefer [subsystem eg: netdev]_dbg([subsystem]dev, ... then dev_dbg(dev, ... then pr_debug(... to printk(KERN_DEBUG ...
+ printk(KERN_DEBUG LIRC_DRIVER_NAME ": " \
[media] DocBook: Remove a warning at videobuf2-v4l2.h
There's no need to document to_foo() macros, and the macro is
badly documented anyway. That removes this warning:
include/media/videobuf2-v4l2.h:43: warning: No description found for parameter 'vb'
While here, remove the parenthesis for container_of(). The
countainer_of() already have parenthesis inside it.
[media] DocBook: fix most of warnings at videobuf2-core.h
include/media/videobuf2-core.h:112: warning: No description found for parameter 'get_dmabuf'
include/media/videobuf2-core.h:146: warning: No description found for parameter 'm'
include/media/videobuf2-core.h:146: warning: Excess struct/union/enum/typedef member 'mem_offset' description in 'vb2_plane'
There are still several warnings, but those are hard to fix,
as they're actually a bug at DocBook. Those should be fixed on
separate patches.
Those two came from dvb_register_adapter cut-and-paste:
.//drivers/media/dvb-core/dvbdev.h:199: warning: Excess function parameter 'device' description in 'dvb_register_device'
.//drivers/media/dvb-core/dvbdev.h:199: warning: Excess function parameter 'adapter_nums' description in 'dvb_register_device'
changeset 6c96dbbc2aa9 added a new function that seems to be
a modified version of an existing function. That's ok, but
it was adding a "word" var from the previous code that it is
not used on the new function. So, remove this left-over.
Remove v4l2 stuff - v4l2_buf, v4l2_plane - from struct vb2_buffer.
Add new member variables - bytesused, length, offset, userptr, fd,
data_offset - to struct vb2_plane in order to cover all information
of v4l2_plane.
struct vb2_plane {
<snip>
unsigned int bytesused;
unsigned int length;
union {
unsigned int offset;
unsigned long userptr;
int fd;
} m;
unsigned int data_offset;
}
Replace v4l2_buf with new member variables - index, type, memory - which
are common fields for buffer management.
struct vb2_buffer {
<snip>
unsigned int index;
unsigned int type;
unsigned int memory;
unsigned int num_planes;
struct vb2_plane planes[VIDEO_MAX_PLANES];
<snip>
};
v4l2 specific fields - flags, field, timestamp, timecode,
sequence - are moved to vb2_v4l2_buffer in videobuf2-v4l2.c
struct vb2_v4l2_buffer {
struct vb2_buffer vb2_buf;
[media] media: videobuf2: Replace videobuf2-core with videobuf2-v4l2
Make videobuf2-v4l2 as a wrapper of videobuf2-core for v4l2-use.
And replace videobuf2-core.h with videobuf2-v4l2.h.
This renaming change should be accompanied by the modifications
of all device drivers that include videobuf2-core.h.
It can be done with just running this shell script.
replace()
{
str1=$1
str2=$2
dir=$3
for file in $(find $dir -name *.h -o -name *.c -o -name Makefile)
do
echo $file
sed "s/$str1/$str2/g" $file > $file.out
mv $file.out $file
done
}
[media] media: v4l2-ctrls: Fix 64bit support in get_ctrl()
When trying to use v4l2_ctrl_g_ctrl_int64() to retrieve a
V4L2_CTRL_TYPE_INTEGER64 type value the internal helper function
get_ctrl() would prematurely exit because for this control type
the 'is_int' flag is not set. This would result in v4l2_ctrl_g_ctrl_int64
always returning 0.
Also v4l2_ctrl_g_ctrl_int64() is reading and returning the 32bit value
member instead of the 64bit version, so fixing that as well.
This patch extends the condition check to allow the V4L2_CTRL_TYPE_INTEGER64
type to continue processing instead of exiting.
Signed-off-by: Benoit Parrot <bparrot@ti.com> Signed-off-by: Hans Verkuil <hans.verkuil@cisco.com> Cc: <stable@vger.kernel.org> # for v3.17 and up Signed-off-by: Mauro Carvalho Chehab <mchehab@osg.samsung.com>
[media] cx25821, cx88, tm6000: use SNDRV_DEFAULT_ENABLE_PNP
Instead of manually initializing the bool array enable, use the
SNDRV_DEFAULT_ENABLE_PNP macro. As most drivers do.
Signed-off-by: Luis de Bethencourt <luisbg@osg.samsung.com> Signed-off-by: Hans Verkuil <hans.verkuil@cisco.com> Signed-off-by: Mauro Carvalho Chehab <mchehab@osg.samsung.com>
drivers/media/i2c/adv7604.c: In function 'adv76xx_get_format':
>> drivers/media/i2c/adv7604.c:1853:9: error: implicit declaration of function 'v4l2_subdev_get_try_format' [-Werror=implicit-function-declaration]
fmt = v4l2_subdev_get_try_format(sd, cfg, format->pad);
^
drivers/media/i2c/adv7604.c:1853:7: warning: assignment makes pointer from integer without a cast [-Wint-conversion]
fmt = v4l2_subdev_get_try_format(sd, cfg, format->pad);
^
drivers/media/i2c/adv7604.c: In function 'adv76xx_set_format':
drivers/media/i2c/adv7604.c:1882:7: warning: assignment makes pointer from integer without a cast [-Wint-conversion]
fmt = v4l2_subdev_get_try_format(sd, cfg, format->pad);
^
cc1: some warnings being treated as errors
Signed-off-by: Hans Verkuil <hans.verkuil@cisco.com> Signed-off-by: Mauro Carvalho Chehab <mchehab@osg.samsung.com>
JPEG IP found in Exynos5433 is similar to what is in Exynos4, but
there are some subtle differences which this patch takes into account.
The most important difference is in what is processed by the JPEG IP and
what has to be provided to it. In case of 5433 the IP does not parse
Huffman and quantisation tables, so this has to be performed with the CPU
and the majority of the code in this patch does that.
A small but important difference is in what address is passed to the JPEG
IP. In case of 5433 it is the SOS (start of scan) position, which is
natural, because the headers must be parsed elsewhere.
There is also a difference in how the hardware is put to work in
device_run.
Data structures are extended as appropriate to accommodate the above
changes.
Signed-off-by: Andrzej Pietrasiewicz <andrzej.p@samsung.com> Reviewed-by: Jacek Anaszewski <j.anaszewski@samsung.com> Signed-off-by: Hans Verkuil <hans.verkuil@cisco.com> Signed-off-by: Mauro Carvalho Chehab <mchehab@osg.samsung.com>
Marek Szyprowski [Fri, 18 Sep 2015 14:20:57 +0000 (11:20 -0300)]
[media] s5p-jpeg: generalize clocks handling
Allow jpeg codec variants declare clocks they need.
Before this patch is applied jpeg-core gets jpeg->sclk
"speculatively": if it is not there, we assume no problem.
This patch eliminates this by explicitly declaring
what clocks are needed for each variant.
This is a preparation for adding Exynos 5433 variant support, which
needs 4 clocks of names not compatible with any previous version of
jpeg hw module.
[Rebase and commit message]
Signed-off-by: Marek Szyprowski <m.szyprowski@samsung.com> Signed-off-by: Andrzej Pietrasiewicz <andrzej.p@samsung.com> Reviewed-by: Jacek Anaszewski <j.anaszewski@samsung.com> Signed-off-by: Hans Verkuil <hans.verkuil@cisco.com> Signed-off-by: Mauro Carvalho Chehab <mchehab@osg.samsung.com>
[media] go7007: Fix returned errno code in gen_mjpeghdr_to_package()
The driver is using -1 instead of the -ENOMEM defined macro to specify
that a buffer allocation failed. Since the error number is propagated,
the caller will get a -EPERM which is the wrong error condition.
Also, the smatch tool complains with the following warning:
gen_mjpeghdr_to_package() warn: returning -1 instead of -ENOMEM is sloppy
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@osg.samsung.com>
[media] s5c73m3: Export OF module alias information
The SPI core always reports the MODALIAS uevent as "spi:<modalias>"
regardless of the mechanism that was used to register the device
(i.e: OF or board code) and the table that is used later to match
the driver with the device (i.e: SPI id table or OF match table).
So drivers needs to export the SPI id table and this be built into
the module or udev won't have the necessary information to autoload
the needed driver module when the device is added.
But this means that OF-only drivers needs to have both OF and SPI id
tables that have to be kept in sync and also the dev node compatible
manufacturer prefix is stripped when reporting the MODALIAS. Which can
lead to issues if two vendors use the same SPI device name for example.
To avoid the above, the SPI core behavior may be changed in the future
to not require an SPI device table for OF-only drivers and report the
OF module alias. So, it's better to also export the OF table even when
is unused now to prevent breaking module loading when the core changes.
Signed-off-by: Javier Martinez Canillas <javier@osg.samsung.com> Reviewed-by: Andrzej Hajda <a.hajda@samsung.com> Signed-off-by: Hans Verkuil <hans.verkuil@cisco.com> Signed-off-by: Mauro Carvalho Chehab <mchehab@osg.samsung.com>
Hans Verkuil [Mon, 21 Sep 2015 09:21:55 +0000 (06:21 -0300)]
[media] DocBook/media: clarify control documentation
- Add missing V4L2_CTRL_TYPE_U32 documentation
- Remove 'which are actually different on the hardware' sentence which
is confusing. I think the idea was to let the user know that the step can
be different for different hardware, but that's obvious because otherwise
you wouldn't need to specify the step value.
- Clarify that V4L2_CTRL_COMPOUND_TYPES also applies to arrays.
Signed-off-by: Hans Verkuil <hans.verkuil@cisco.com> Signed-off-by: Mauro Carvalho Chehab <mchehab@osg.samsung.com>
Hans Verkuil [Mon, 21 Sep 2015 09:14:16 +0000 (06:14 -0300)]
[media] v4l2-ctrls: arrays are also considered compound controls
Array controls weren't skipped when only V4L2_CTRL_FLAG_NEXT_CTRL was
provided (so no V4L2_CTRL_FLAG_NEXT_COMPOUND was set). This is wrong
since arrays are also considered compound controls (i.e. with more than
one value), and applications that do not know about arrays will not
be able to handle such controls.
Fix the test to include arrays.
Signed-off-by: Hans Verkuil <hans.verkuil@cisco.com> Reported-by: Ricardo Ribalda Delgado <ricardo.ribalda@gmail.com> Cc: <stable@vger.kernel.org> # for v3.17 and up Signed-off-by: Mauro Carvalho Chehab <mchehab@osg.samsung.com>
This is a preparation for a change to the type of v4l2 timestamps.
v4l2_get_timestamp() is a helper function that reads the monotonic
time and stores it into a 'struct timeval'. Multiple drivers implement
the same thing themselves for historic reasons.
Changing them all to use v4l2_get_timestamp() is more consistent
and reduces the amount of code duplication, and most importantly
simplifies the following changes.
Signed-off-by: Arnd Bergmann <arnd@arndb.de> Acked-by: Sylwester Nawrocki <s.nawrocki@samsung.com>
[hans.verkuil@cisco.com: dropped the v4l2-dev.c patch that didn't belong here] Signed-off-by: Hans Verkuil <hans.verkuil@cisco.com> Signed-off-by: Mauro Carvalho Chehab <mchehab@osg.samsung.com>
[media] exynos4-is: use monotonic timestamps as advertized
The exynos4 fimc capture driver claims to use monotonic
timestamps but calls ktime_get_real_ts(). This is both
an incorrect API use, and a bad idea because of the y2038
problem and the fact that the wall clock time is not reliable
for timestamps across suspend or settimeofday().
This changes the driver to use the normal v4l2_get_timestamp()
function like all other drivers.
Hans Verkuil [Fri, 28 Aug 2015 11:48:32 +0000 (08:48 -0300)]
[media] saa7164: fix input and tuner compliance problems
- the frequency range was never set
- there was no initial frequency
- missing index/tuner checks
- inconsistent standard reporting
- removed unnecessary tuner type checks (the core handles that)
- clamp frequency to the valid frequency range as per the V4L2 spec
Signed-off-by: Hans Verkuil <hans.verkuil@cisco.com> Signed-off-by: Mauro Carvalho Chehab <mchehab@osg.samsung.com>
Hans Verkuil [Fri, 28 Aug 2015 11:48:30 +0000 (08:48 -0300)]
[media] saa7164: fix format ioctls
Fix various v4l2-compliance issues in the formatting ioctls:
- the vbi device implemented video format ioctls which make no senses
for a vbi device, remove them.
- remove the unused ts_packet_size and ts_packet_count fields.
- fill in colorspace and field.
- fill in sizeimage with a default value.
- for the video node the get, set and try format functions all do the
same thing, so combine into a single function.
Signed-off-by: Hans Verkuil <hans.verkuil@cisco.com> Signed-off-by: Mauro Carvalho Chehab <mchehab@osg.samsung.com>
Hans Verkuil [Fri, 28 Aug 2015 11:48:28 +0000 (08:48 -0300)]
[media] saa7164: fix poll bugs
- poll doesn't return negative values, so you can't return -EINVAL.
Instead return POLLERR.
- poll can't be called if !video_is_registered(), so this test can
be dropped.
- poll can never do a blocking wait, so remove that check.
- poll shouldn't attempt to start streaming if the caller isn't interested
in read events.
Signed-off-by: Hans Verkuil <hans.verkuil@cisco.com> Signed-off-by: Mauro Carvalho Chehab <mchehab@osg.samsung.com>
[media] media: fix kernel-doc warnings in v4l2-dv-timings.h
Fix the following 'make htmldocs' warnings:
.//include/media/v4l2-dv-timings.h:147: warning: No description found for parameter 'frame_height'
.//include/media/v4l2-dv-timings.h:147: warning: No description found for parameter 'hfreq'
.//include/media/v4l2-dv-timings.h:147: warning: No description found for parameter 'vsync'
.//include/media/v4l2-dv-timings.h:147: warning: No description found for parameter 'active_width'
.//include/media/v4l2-dv-timings.h:147: warning: No description found for parameter 'polarities'
.//include/media/v4l2-dv-timings.h:147: warning: No description found for parameter 'interlaced'
.//include/media/v4l2-dv-timings.h:147: warning: No description found for parameter 'fmt'
.//include/media/v4l2-dv-timings.h:171: warning: No description found for parameter 'frame_height'
.//include/media/v4l2-dv-timings.h:171: warning: No description found for parameter 'hfreq'
.//include/media/v4l2-dv-timings.h:171: warning: No description found for parameter 'vsync'
.//include/media/v4l2-dv-timings.h:171: warning: No description found for parameter 'polarities'
.//include/media/v4l2-dv-timings.h:171: warning: No description found for parameter 'interlaced'
.//include/media/v4l2-dv-timings.h:171: warning: No description found for parameter 'aspect'
.//include/media/v4l2-dv-timings.h:171: warning: No description found for parameter 'fmt'
.//include/media/v4l2-dv-timings.h:184: warning: No description found for parameter 'hor_landscape'
.//include/media/v4l2-dv-timings.h:184: warning: No description found for parameter 'vert_portrait'
Hans Verkuil [Sun, 13 Sep 2015 16:41:28 +0000 (13:41 -0300)]
[media] vivid: use Bradford method when converting Rec. 709 to NTSC 1953
The V4L2_COLORSPACE_470_SYSTEM_M (aka NTSC 1953) colorspace has a different
whitepoint (C) compared to Rec. 709 (D65). The Bradford method is the
recommended method to compensate for that when converting a Rec. 709 color
to an NTSC 1953 color.
See http://www.brucelindbloom.com/index.html?Eqn_ChromAdapt.html for more
details on the Bradford method.
This patch updates the Rec. 709 to NTSC 1953 matrix so that it includes the
chromatic adaptation as calculated by the Bradford method, and it recalculates
the tpg_csc_colors table accordingly.
Signed-off-by: Hans Verkuil <hans.verkuil@cisco.com> Signed-off-by: Mauro Carvalho Chehab <mchehab@osg.samsung.com>
Hans Verkuil [Wed, 9 Sep 2015 06:40:39 +0000 (03:40 -0300)]
[media] v4l2-compat-ioctl32: replace pr_warn by pr_debug
Every time compat32 encounters an unknown ioctl it will call pr_warn.
However, that's very irritating since it is perfectly normal that this
happens. For example, applications often try to call an ioctl to see if
it exists, and if that's used with an older kernel where compat32 doesn't
support that ioctl yet, then it starts spamming the kernel log.
So replace pr_warn by pr_debug.
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@osg.samsung.com>
[media] atmel-isi: add sanity check for supported formats in try/set_fmt()
After adding the format check in try_fmt()/set_fmt(), we don't need any
format check in configure_geometry(). So make configure_geometry() as
void type.
[media] atmel-isi: Protect PM-only functions to kill warning
If CONFIG_PM=n:
drivers/media/platform/soc_camera/atmel-isi.c:1044: warning: 'atmel_isi_runtime_suspend' defined but not used
drivers/media/platform/soc_camera/atmel-isi.c:1054: warning: 'atmel_isi_runtime_resume' defined but not used
Protect the unused functions by #ifdef CONFIG_PM to fix this.
Sergei Shtylyov [Thu, 3 Sep 2015 23:18:05 +0000 (20:18 -0300)]
[media] rcar_vin: call g_std() instead of querystd()
Hans Verkuil says: "The only place querystd can be called is in the QUERYSTD
ioctl, all other ioctls should use the last set standard." So call the g_std()
subdevice method instead of querystd() in the driver's set_fmt() method.
Reported-by: Hans Verkuil <hverkuil@xs4all.nl> Signed-off-by: Sergei Shtylyov <sergei.shtylyov@cogentembedded.com> Acked-by: Hans Verkuil <hans.verkuil@cisco.com> Signed-off-by: Guennadi Liakhovetski <g.liakhovetski@gmx.de> Signed-off-by: Mauro Carvalho Chehab <mchehab@osg.samsung.com>