The DVB API was originally defined using typedefs. This is against
Kernel CodingStyle, and there's no good usage here. While we can't
remove its usage on userspace, we can avoid its usage in Kernelspace.
So, let's do it.
This patch was generated by this shell script:
for j in $(grep typedef include/uapi/linux/dvb/frontend.h |cut -d' ' -f 3); do for i in $(find drivers/media -name '*.[ch]' -type f) $(find drivers/staging/media -name '*.[ch]' -type f); do sed "s,${j}_t,enum $j," <$i >a && mv a $i; done; done
While here, make CodingStyle fixes on the affected lines.
Signed-off-by: Mauro Carvalho Chehab <mchehab@osg.samsung.com> Acked-by: Stefan Richter <stefanr@s5r6.in-berlin.de> # for drivers/media/firewire/*
[media] DocBook: properly document the delivery systems
Use a table for the delivery systems. The table is organized
by the type (cable, satellite, terrestrial) and shows what
standards are not fully implemented.
[media] DocBook: add placeholders for ATSC M/H properties
The ATSC M/H specific properties are not properly documented.
This became crearer when converting the existing data into
tables and adding cross references.
For now, just add placeholders, as a further investigation
about the meaning of each parameter is required.
Cc: Michael Ira Krufky <mkrufky@linuxtv.org> Signed-off-by: Mauro Carvalho Chehab <mchehab@osg.samsung.com>
enum fe_caps is documented at FE_GET_INFO ioctl. Add xrefs
for each entry there. This makes the hyperlinks at frontend.h
to go directly to the right documentation.
Hans Verkuil [Sat, 6 Jun 2015 08:02:32 +0000 (05:02 -0300)]
[media] cx231xx: fix compiler warning
Fix this compiler warning by allocating a structure to read the eeprom instead
of doing it on the stack and worse: the eeprom array is static, so that can
cause problems if there are multiple cx231xx instances.
cx231xx-cards.c: In function 'cx231xx_card_setup':
cx231xx-cards.c:1110:1: warning: the frame size of 2064 bytes is larger than 2048 bytes [-Wframe-larger-than=]
}
^
I did consider removing the code altogether since the result is actually
not used at the moment, but I decided against it since it is used in other
drivers and someone might want to start using it in this driver as well. And
then it is useful that the code is already there.
Signed-off-by: Hans Verkuil <hans.verkuil@cisco.com> Signed-off-by: Mauro Carvalho Chehab <mchehab@osg.samsung.com>
Prashant Laddha [Fri, 22 May 2015 05:27:34 +0000 (02:27 -0300)]
[media] v4l2-dv-timings: add interlace support in detect cvt/gtf
Extend detect_cvt/gtf API to indicate the format type (interlaced
or progressive). In case of interlaced, the vertical front and back
porch and vsync values for both (odd,even) fields are considered to
derive image height. Populated vsync, vertical front, back porch
values in bt timing structure for even and odd fields and updated
the flags appropriately.
Also modified the functions calling the detect_cvt/gtf(). As of now
these functions are calling detect_cvt/gtf() with interlaced flag
set to false.
Hans Verkuil [Fri, 5 Jun 2015 08:30:02 +0000 (05:30 -0300)]
[media] v4l2-dv-timings: support interlaced in v4l2_print_dv_timings
The v4l2_print_dv_timings() didn't log the interlaced format correctly. The timings
for the bottom field weren't logged and the fields per second value was half of what
it should have been.
Signed-off-by: Hans Verkuil <hans.verkuil@cisco.com> Signed-off-by: Mauro Carvalho Chehab <mchehab@osg.samsung.com>
Prashant Laddha [Fri, 5 Jun 2015 08:13:31 +0000 (05:13 -0300)]
[media] v4l2-dv-timing: avoid rounding twice in gtf hblank calc
Currently, in gtf hblank calculations, the rounding is used twice,
one at intermediate division and one at final state where hblank
is rounded to nearest multiple of twice cell granularity. This
error got introduced in 'commit d7ed5a3ddaec ("[media]
v4l2-dv-timings: fix rounding in hblank and hsync calculation"),
where it missed combining the rounding step. Correcting the same
in this patch.
Hans Verkuil [Sun, 7 Jun 2015 10:32:32 +0000 (07:32 -0300)]
[media] adv7511: log the currently set infoframes
The adv7511 sets up InfoFrames that are used when transmitting video.
Log the contents of those InfoFrames so it is possible to see exactly what
the transmitter is sending.
Signed-off-by: Hans Verkuil <hans.verkuil@cisco.com> Signed-off-by: Mauro Carvalho Chehab <mchehab@osg.samsung.com>
According with the docs at docbook.org, no backward compatible
changes were done between 4.2 and 4.5 schemas. Some fixes were
added, together with new features. So, let's use the latest
4.x schema.
Hans Verkuil [Fri, 5 Jun 2015 14:28:51 +0000 (11:28 -0300)]
[media] v4l2-ioctl: log buffer type 0 correctly
If userspace passed the invalid buffer type 0 to the kernel, then the
kernel log would show 'type=(null)' since there was no string defined
for type 0. Fix this.
Signed-off-by: Hans Verkuil <hans.verkuil@cisco.com> Signed-off-by: Mauro Carvalho Chehab <mchehab@osg.samsung.com>
Fabio Estevam [Mon, 1 Jun 2015 17:14:07 +0000 (14:14 -0300)]
[media] radio-si470x-i2c: Pass the IRQF_ONESHOT flag
Since commit 1c6c69525b40 ("genirq: Reject bogus threaded irq requests")
threaded IRQs without a primary handler need to be requested with
IRQF_ONESHOT, otherwise the request will fail.
So pass the IRQF_ONESHOT flag in this case.
The semantic patch that makes this change is available
in scripts/coccinelle/misc/irqf_oneshot.cocci.
Hans Verkuil [Mon, 1 Jun 2015 10:15:53 +0000 (07:15 -0300)]
[media] vivid: move video loopback control to the capture device
This has been on my TODO list for some time now: the control that enables the video
loopback was part of the controls of the video output device instead of the video
capture device. In practice this was quite annoying since you expect it at the capture
side since that's where you want to make the decision whether to use the TPG or looped
video.
This patch moves the control from the output to the capture side.
Signed-off-by: Hans Verkuil <hans.verkuil@cisco.com> Signed-off-by: Mauro Carvalho Chehab <mchehab@osg.samsung.com>
Juergen Gier [Thu, 14 May 2015 11:55:04 +0000 (08:55 -0300)]
[media] saa7134: switch tuner FMD1216ME_MK3 to analog
The tuner FMD1216ME_MK3 suffers the same problem as FMD1216MEX_MK3,
as described in saa7134-cards.c (disabled IF, enabled DVB-T). The
card does work under MS Windows, after soft reboot into Linux it
continues to work, only then tda9887 is loaded as well.
I copied the relevant code from the BEHOLD_H6 section to MD7134.
The CTX946 TV card doesn't detect a signal after cold boot, seems
Signed-off-by: Juergen Gier <juergen.gier@gmx.de> Signed-off-by: Hans Verkuil <hans.verkuil@cisco.com> Signed-off-by: Mauro Carvalho Chehab <mchehab@osg.samsung.com>
[media] v4l: of: Correct pclk-sample for BT656 bus
Current v4l2_of_parse_parallel_bus function attempts to parse the
DT properties for the parallel bus as well as BT656 bus.
If the pclk-sample property is defined for the BT656 bus, it is still
marked as a parallel bus.
Fix this by parsing the pclk after the bus_type is selected.
Only when hsync or vsync properties are specified, the bus_type should
be set to V4L2_MBUS_PARALLEL.
This patch takes a different approach: four different functions are
created, one for each PRINTSTR version.
In order to avoid the 'the frame size of 1308 bytes is larger than 1024
bytes' warning I had to mark those functions with 'noinline'. For
whatever reason gcc seems to inline this aggressively and it is doing
weird things with the stack.
I tried to read the assembly code, but I couldn't see what exactly it
was doing on the stack.
Signed-off-by: Hans Verkuil <hans.verkuil@cisco.com> Signed-off-by: Mauro Carvalho Chehab <mchehab@osg.samsung.com>
Hans Verkuil [Sun, 31 May 2015 10:51:51 +0000 (07:51 -0300)]
[media] cobalt: simplify colorspace code
Simplify cobalt_g/try_fmt_vid_cap by not setting the colorspace fields in
pix again (since v4l2_fill_pix_format does that already), and by using
v4l2_fill_mbus_format in cobalt_s_fmt_vid_out which allows the get_fmt
call to be dropped as well.
Signed-off-by: Hans Verkuil <hans.verkuil@cisco.com> Signed-off-by: Mauro Carvalho Chehab <mchehab@osg.samsung.com>
Hans Verkuil [Tue, 28 Apr 2015 11:49:09 +0000 (08:49 -0300)]
[media] videodev2.h: add support for transfer functions
In the past the transfer function was implied by the colorspace. However,
it is an independent entity in its own right. Add support for explicitly
choosing the transfer function.
This change will allow us to represent linear RGB (as is used by openGL), and
it will make it easier to work with decoded video material since most codecs
store the transfer function as a separate property as well.
Signed-off-by: Hans Verkuil <hans.verkuil@cisco.com> Signed-off-by: Mauro Carvalho Chehab <mchehab@osg.samsung.com>
Instead of using a state machine and a switch with lots of
fall-trough, use gotos and cleanup the error handling loop.
That removes those two smatch warnings:
drivers/staging/media/lirc/lirc_imon.c:933 imon_probe() warn: possible memory leak of 'context'
drivers/staging/media/lirc/lirc_imon.c:933 imon_probe() warn: possible memory leak of 'driver'
Smatch reports a warning:
drivers/media/usb/tm6000/tm6000-video.c:646 tm6000_prepare_isoc() error: we previously assumed 'dev->urb_buffer' could be null (see line 624)
This is not really a problem, but it actually shows that the check
if urb_buffer is NULL is being done twice: at the if and at
tm6000_alloc_urb_buffers().
We don't need to do it twice. So, remove the extra check. The code
become cleaner, and, as a collateral effect, smatch becomes happy.
Smatch currently produces two warnings:
drivers/media/pci/ivtv/ivtv-fileops.c:901 ivtv_v4l2_close() warn: suspicious bitop condition
drivers/media/pci/ivtv/ivtv-fileops.c:1026 ivtv_open() warn: suspicious bitop condition
Those are false positives, but it is not hard to get rid of them by
using a different way to evaluate the macro, splitting the logical
boolean evaluation from the bitmap one.
As reported by smatch:
drivers/media/pci/bt8xx/dst_ca.c:323 ca_get_message() warn: this array is probably non-NULL. 'p_ca_message->msg'
drivers/media/pci/bt8xx/dst_ca.c:498 ca_send_message() warn: this array is probably non-NULL. 'p_ca_message->msg'
Those two checks are needless/useless, as the ca_msg struct is
declared as:
typedef struct ca_msg {
unsigned int index;
unsigned int type;
unsigned int length;
unsigned char msg[256];
} ca_msg_t;
So, if the p_ca_message pointer is not null, msg will also be
not null.
It seems that there's actually a bug here: the same var (idx) is used
as an index for vertical and horizontal scaling arrays. However,
there are 4 elements on the h arrays, and only 3 at the v ones.
On the first loop, it may select index 4 for the horizontal array.
In this case, if the second loop fails to select an index, the
code would keep using 4 for the vertical array, with is past of
the array sizes.
The intent here seems to use index 0, if the scale is not found.
[media] vivid: don't use more than 1024 bytes of stack
Remove the following compilation warnings:
drivers/media/platform/vivid/vivid-tpg.c: In function 'tpg_gen_text':
drivers/media/platform/vivid/vivid-tpg.c:1562:1: warning: the frame size of 1308 bytes is larger than 1024 bytes [-Wframe-larger-than=]
}
^
This seems to be due to some bad optimization done by gcc.
Moving the for() loop to happen inside the macro solves the
issue.
While here, fix CodingStyle at the switch().
Signed-off-by: Mauro Carvalho Chehab <mchehab@osg.samsung.com> Acked-by: Hans Verkuil <hans.verkuil@cisco.com>
Marek Szyprowski [Thu, 28 May 2015 11:11:47 +0000 (08:11 -0300)]
[media] media: s5p-mfc: fix sparse warnings
Commits a0f10c131cc49d7d84394beb7903e1f246331224 and 6c9fe765360efa97c63b89af685b620baf5e0012 ("media: s5p-mfc: fix broken
pointer cast on 64bit arch") fixed issue with lossy cast on 64-bit
architectures. However it also removed __iomem attribute from that cast.
This leads to sparse warnings. This patch fixes those warnings by adding
__iomem cast in case of v6+ code version and replacing readl/writel by
simple u32 load/store operations in case of v5 code (which is called on
system memory allocated by dma_alloc_coherent() instead of io registers).
Reported-by: Hans Verkuil <hverkuil@xs4all.nl> Signed-off-by: Marek Szyprowski <m.szyprowski@samsung.com> Signed-off-by: Hans Verkuil <hans.verkuil@cisco.com> Signed-off-by: Mauro Carvalho Chehab <mchehab@osg.samsung.com>
Lad, Prabhakar [Mon, 25 May 2015 15:34:27 +0000 (12:34 -0300)]
[media] media: davinci_vpfe: clear the output_specs
clear of the output_specs before passing it to the
configure_resizer_out_params(), so that no garbage values
are set.
This fixes following build warning:
drivers/staging/media/davinci_vpfe/dm365_resizer.c: In function 'resizer_set_stream':
drivers/staging/media/davinci_vpfe/dm365_resizer.c:190:46: warning: 'output_specs.vst_c'
may be used uninitialized in this function [-Wmaybe-uninitialized]
param->ext_mem_param[index].rsz_sdr_ptr_s_c = output->vst_c;
^
drivers/staging/media/davinci_vpfe/dm365_resizer.c:316:30: note: 'output_specs.vst_c' was declared here
struct vpfe_rsz_output_spec output_specs;
^
Antti Palosaari [Fri, 29 May 2015 19:42:33 +0000 (16:42 -0300)]
[media] si2168: Implement own I2C adapter locking
We need own I2C locking because of tuner I2C adapter/repeater.
Firmware command is executed using I2C send + reply message. Default
I2C adapter locking protects only single I2C operation, not whole
send + reply sequence as needed. Due to that, it was possible tuner
I2C message interrupts firmware command sequence.
Reported-by: Adam Baker <linux@baker-net.org.uk> Signed-off-by: Antti Palosaari <crope@iki.fi> Reviewed-by: Adam Baker <linux@baker-net.org.uk> Signed-off-by: Mauro Carvalho Chehab <mchehab@osg.samsung.com>
The changeset dc9ef7d11207 change the open() ioctl documentation to
match the V4L2 open(). However, some cut-and-pasted stuff doesn't
match what actually happens at the DVB core.
So, fix the documentation entry to be more accurate with the DVB
frontend open() specifics.
Laurent Pinchart [Sun, 24 May 2015 22:45:38 +0000 (19:45 -0300)]
[media] uvcvideo: Remove unneeded device disconnected flag
The UVC_DEV_DISCONNECTED flag is set when the USB device is
disconnected, and checked in the open() handler to refuse opening a
device that has been disconnected.
This is inherently racy, but the race condition is taken care of in the
V4L2 core, which also fails open() calls when the V4L2 device node has
been unregistered. As the uvcvideo USB disconnect handler unregisters
all its video device nodes, the UVC_DEV_DISCONNECTED flag doesn't serve
any purpose anymore and can be removed.
Laurent Pinchart [Tue, 12 May 2015 21:57:53 +0000 (18:57 -0300)]
[media] uvcvideo: Fix incorrect bandwidth with Chicony device 04f2:b50b
The "TOSHIBA Web Camera - 5M" Chicony device (04f2:b50b) seems to
compute the bandwidth on 16 bits and erroneously sign-extend it to
32 bits, resulting in a huge bandwidth value. Detect and fix that
condition by setting the 16 MSBs to 0 when they're all equal to 1.
Reported-by: Hans de Goede <hdegoede@redhat.com> Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com> Signed-off-by: Mauro Carvalho Chehab <mchehab@osg.samsung.com>