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>
Antti Palosaari [Thu, 16 Apr 2015 23:04:55 +0000 (20:04 -0300)]
[media] m88ds3103: add I2C client binding
Implement I2C client device binding.
Wrap media attach to driver I2C probe.
Add wrapper from m88ds3103_attach() to m88ds3103_probe() via driver
core in order to provide proper I2C client for legacy media attach
binding.
Signed-off-by: Antti Palosaari <crope@iki.fi> Signed-off-by: Mauro Carvalho Chehab <mchehab@osg.samsung.com>
Antti Palosaari [Tue, 14 Apr 2015 00:00:09 +0000 (21:00 -0300)]
[media] m88ds3103: do not return error from get_frontend() when not ready
Do not return error from get_frontend() when status is queried, but
the frontend didn't lock yet. The proper behavior is to only update the
cache after having a lock.
[mchehab@osg.samsung.com: fix the patch description] Signed-off-by: Antti Palosaari <crope@iki.fi> Signed-off-by: Mauro Carvalho Chehab <mchehab@osg.samsung.com>
[media] gspca: sn9c2028: Add gain and autogain controls Genius Videocam Live v2
Autogain algorithm is very simple, if average luminance is low - increase gain,
if it's high - decrease gain. Gain granularity is low enough for this algo to
stabilize quickly.
Signed-off-by: Vasily Khoruzhick <anarsoul@gmail.com> Signed-off-by: Hans de Goede <hdegoede@redhat.com> Signed-off-by: Mauro Carvalho Chehab <mchehab@osg.samsung.com>
[media] gspca: sn9c2028: Add support for Genius Videocam Live v2
This cam seems to return different values on long commands, so make status check
in sn9c2028_long_command() more tolerant. Anyway, read value isn't used anywhere
later.
Signed-off-by: Vasily Khoruzhick <anarsoul@gmail.com> Signed-off-by: Hans de Goede <hdegoede@redhat.com> Signed-off-by: Mauro Carvalho Chehab <mchehab@osg.samsung.com>
[media] wl128x: Allow compile test of GPIO consumers if !GPIOLIB
The GPIO subsystem provides dummy GPIO consumer functions if GPIOLIB is
not enabled. Hence drivers that depend on GPIOLIB, but use GPIO consumer
functionality only, can still be compiled if GPIOLIB is not enabled.
Relax the dependency on GPIOLIB if COMPILE_TEST is enabled, where
appropriate.
Florian Echtler [Mon, 25 May 2015 12:04:16 +0000 (09:04 -0300)]
[media] return BUF_STATE_ERROR if streaming stopped during acquisition
When stop_streaming is called while a frame is currently being retrieved, the
buffer being filled will still be returned with BUF_STATE_DONE. By resetting
the sequence number and checking before returning the buffer, it can now
correctly be returned with BUF_STATE_ERROR.
Signed-off-by: Martin Kaltenbrunner <modin@yuri.at> Signed-off-by: Florian Echtler <floe@butterbrot.org> Signed-off-by: Hans Verkuil <hans.verkuil@cisco.com> Signed-off-by: Mauro Carvalho Chehab <mchehab@osg.samsung.com>
Florian Echtler [Mon, 25 May 2015 12:04:15 +0000 (09:04 -0300)]
[media] add extra debug output, remove noisy warning
Add dev_dbg statements for easier future debugging; also change the warning
about packet ID mismatches to debug output to avoid flooding the logs. This
warning is only important in a very specific/rare use case when trying to
correlate input events with video data.
Signed-off-by: Martin Kaltenbrunner <modin@yuri.at> Signed-off-by: Florian Echtler <floe@butterbrot.org> Signed-off-by: Hans Verkuil <hans.verkuil@cisco.com> Signed-off-by: Mauro Carvalho Chehab <mchehab@osg.samsung.com>
Florian Echtler [Mon, 25 May 2015 12:04:14 +0000 (09:04 -0300)]
[media] add frame size/frame rate query functions
Add missing functions to query the single fixed frame size (960x540) and
supported frame rates. Technically, the SUR40 supports any arbitrary frame
rate up to 60 FPS, as it is polled and not interrupt-driven. For now, we
just report 30 and 60 FPS, which is sufficient to make most V4L2 tools work.
Signed-off-by: Martin Kaltenbrunner <modin@yuri.at> Signed-off-by: Florian Echtler <floe@butterbrot.org> Signed-off-by: Hans Verkuil <hans.verkuil@cisco.com> Signed-off-by: Mauro Carvalho Chehab <mchehab@osg.samsung.com>
Florian Echtler [Mon, 25 May 2015 12:04:13 +0000 (09:04 -0300)]
[media] reduce poll interval to allow full 60 FPS framerate
The SUR40 hardware can deliver images at up to 60 FPS; at full USB2 bandwidth,
one raw frame will take about 11 ms to transmit. If the poll interval is above
5 ms, fully handling one frame will take longer than 16 ms and the overall
frame rate will drop below 60 FPS. To get the full frame rate without blocking
all the time and still allowing for a bit of timing jitter, we reduce the poll
interval to 4 ms.
Signed-off-by: Martin Kaltenbrunner <modin@yuri.at> Signed-off-by: Florian Echtler <floe@butterbrot.org> Signed-off-by: Hans Verkuil <hans.verkuil@cisco.com> Signed-off-by: Mauro Carvalho Chehab <mchehab@osg.samsung.com>
Antti Palosaari [Sun, 17 May 2015 11:38:04 +0000 (08:38 -0300)]
[media] v4l2: correct two SDR format names
U8 and U16LE format human readable names were translated with string
containing emulated word. These strings were taken from msi2500 driver,
where those formats were emulated (after module parameter is set). But
on API correct names should be used, without any special case notes.
Signed-off-by: Antti Palosaari <crope@iki.fi> Signed-off-by: Hans Verkuil <hans.verkuil@cisco.com> Signed-off-by: Mauro Carvalho Chehab <mchehab@osg.samsung.com>
Hans Verkuil [Fri, 15 May 2015 12:29:09 +0000 (09:29 -0300)]
[media] videodev2.h: add macros to map colorspace defaults
The mapping of COLORSPACE_DEFAULT, YCBCR_ENC_DEFAULT or QUANTIZATION_DEFAULT
to proper non-default values is fairly complex, and it is something that
needs to be done both in the kernel and in userspace.
So add macros that can do this conversion, making this available to both
kernel and userspace.
Signed-off-by: Hans Verkuil <hans.verkuil@cisco.com> Signed-off-by: Mauro Carvalho Chehab <mchehab@osg.samsung.com>
Hans Verkuil [Fri, 15 May 2015 12:29:05 +0000 (09:29 -0300)]
[media] videodev2.h: add COLORSPACE_DEFAULT
V4L2_COLORSPACE_DEFAULT is added so we have a specific define for
the default case where applications do not set it but leave it to 0.
In that case the driver will set the colorspace based on what it
captures.
This is already used, but we never had a define for the value 0.
Signed-off-by: Hans Verkuil <hans.verkuil@cisco.com> Signed-off-by: Mauro Carvalho Chehab <mchehab@osg.samsung.com>
Hans Verkuil [Mon, 18 May 2015 13:29:17 +0000 (10:29 -0300)]
[media] ivtv: fix incorrect audio mode report in log_status
The log_status ioctl should report if the audio input has mode Bilingual. However, the
check against the itv->dualwatch_stereo_mode is completely wrong and is a left-over from
the distant past. Not only is the bitmask obviously wrong, the test itself is broken too
since itv->dualwatch_stereo_mode is no longer a bitmask at all.
Fix this code properly.
Signed-off-by: Hans Verkuil <hans.verkuil@cisco.com> Reported-by: Dan Carpenter <dan.carpenter@oracle.com> Signed-off-by: Mauro Carvalho Chehab <mchehab@osg.samsung.com>
[media] media/videobuf2-dma-vmalloc: Save output from dma_map_sg
dma_map_sg returns the number of areas mapped by the hardware,
which could be different than the areas given as an input.
The output must be saved to nent.
Signed-off-by: Ricardo Ribalda Delgado <ricardo.ribalda@gmail.com> Reviewed-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>
[media] media/videobuf2-dma-contig: Save output from dma_map_sg
dma_map_sg returns the number of areas mapped by the hardware,
which could be different than the areas given as an input.
The output must be saved to nent.
Signed-off-by: Ricardo Ribalda Delgado <ricardo.ribalda@gmail.com> Reviewed-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>
[media] media/videobuf2-dma-sg: Fix handling of sg_table structure
When sg_alloc_table_from_pages() does not fail it returns a sg_table
structure with nents and nents_orig initialized to the same value.
dma_map_sg returns the number of areas mapped by the hardware,
which could be different than the areas given as an input.
The output must be saved to nent.
The output of dma_map, should be used to transverse the scatter list.
dma_unmap_sg needs the value passed to dma_map_sg (nents_orig).
sg_free_tables uses also orig_nent.
This patch fix the file to follow this paradigm.
Signed-off-by: Ricardo Ribalda Delgado <ricardo.ribalda@gmail.com> Reviewed-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>
Hans Verkuil [Fri, 22 May 2015 08:30:02 +0000 (05:30 -0300)]
[media] cobalt: fix sparse warnings
drivers/media/pci/cobalt/cobalt-flash.c:101:5: warning: symbol 'cobalt_flash_probe' was not declared. Should it be static?
drivers/media/pci/cobalt/cobalt-flash.c:126:6: warning: symbol 'cobalt_flash_remove' was not declared. Should it be static?
drivers/media/pci/cobalt/cobalt-cpld.c:101:6: warning: symbol 'cobalt_cpld_status' was not declared. Should it be static?
drivers/media/pci/cobalt/cobalt-cpld.c:240:6: warning: symbol 'cobalt_cpld_set_freq' was not declared. Should it be static?
Signed-off-by: Hans Verkuil <hans.verkuil@cisco.com> Signed-off-by: Mauro Carvalho Chehab <mchehab@osg.samsung.com>
Hans Verkuil [Fri, 22 May 2015 08:31:46 +0000 (05:31 -0300)]
[media] cobalt: fix sparse warnings
drivers/media/pci/cobalt/cobalt-flash.c:39:36: warning: incorrect type in initializer (different address spaces)
drivers/media/pci/cobalt/cobalt-flash.c:54:36: warning: incorrect type in initializer (different address spaces)
drivers/media/pci/cobalt/cobalt-flash.c:63:36: warning: incorrect type in initializer (different address spaces)
drivers/media/pci/cobalt/cobalt-flash.c:82:36: warning: incorrect type in initializer (different address spaces)
drivers/media/pci/cobalt/cobalt-flash.c:107:19: warning: incorrect type in assignment (different address spaces)
Signed-off-by: Hans Verkuil <hans.verkuil@cisco.com> Signed-off-by: Mauro Carvalho Chehab <mchehab@osg.samsung.com>
Hans Verkuil [Fri, 22 May 2015 07:37:27 +0000 (04:37 -0300)]
[media] cobalt: fix compiler warnings on 32 bit OSes
Fixes these warnings:
drivers/media/pci/cobalt/cobalt-omnitek.c: In function 'omni_sg_dma_start':
drivers/media/pci/cobalt/cobalt-omnitek.c:112:28: warning: right shift count >= width of type [-Wshift-count-overflow]
iowrite32((u32)(desc->bus >> 32), DESCRIPTOR(s->dma_channel) + 4);
^
drivers/media/pci/cobalt/cobalt-omnitek.c: In function 'descriptor_list_create':
drivers/media/pci/cobalt/cobalt-omnitek.c:222:28: warning: right shift count >= width of type [-Wshift-count-overflow]
d->next_h = (u32)(next >> 32);
^
drivers/media/pci/cobalt/cobalt-omnitek.c:268:32: warning: right shift count >= width of type [-Wshift-count-overflow]
d->next_h = (u32)(desc->bus >> 32);
^
drivers/media/pci/cobalt/cobalt-omnitek.c:275:27: warning: right shift count >= width of type [-Wshift-count-overflow]
d->next_h = (u32)(next >> 32);
^
drivers/media/pci/cobalt/cobalt-omnitek.c: In function 'descriptor_list_chain':
drivers/media/pci/cobalt/cobalt-omnitek.c:293:31: warning: right shift count >= width of type [-Wshift-count-overflow]
d->next_h = (u32)(next->bus >> 32);
^
drivers/media/pci/cobalt/cobalt-omnitek.c: In function 'descriptor_list_loopback':
drivers/media/pci/cobalt/cobalt-omnitek.c:332:30: warning: right shift count >= width of type [-Wshift-count-overflow]
d->next_h = (u32)(desc->bus >> 32);
^
Signed-off-by: Hans Verkuil <hans.verkuil@cisco.com> Signed-off-by: Mauro Carvalho Chehab <mchehab@osg.samsung.com>
Hans Verkuil [Thu, 21 May 2015 09:19:28 +0000 (06:19 -0300)]
[media] cobalt: fix irqs used for the adv7511 transmitter
The interrupt bit assignments use for the adv7511 were off by one.
This means that the current scheme (bit << (4 * stream_index)) can
no longer be used.
Fix this by precalculating and storing the correct masks in the
cobalt_stream struct.
This wasn't noticed before because the adv7511 interrupts are very
rare. But for CEC support these interrupts are essential, so this made
me realize that it wasn't working correctly.
Signed-off-by: Hans Verkuil <hans.verkuil@cisco.com> Signed-off-by: Mauro Carvalho Chehab <mchehab@osg.samsung.com>
[media] DocBook: Update DocBook version and fix a few legacy things
The DVB part of the media API documentation has several
legacy things on it:
- Examples that don't work;
- APIs unused and deprecated;
- places mentioning the wrong API version.
Fix them and bump the documentation version, in order to
reflect the cleanup efforts to make it more consistent with
the current status of the API.
[media] DocBook: cleaup the notes about DTV properties
The notes there are somewhat confusing and assumes that the
reader would have read the DVBv3 way. This is not true anymore,
as the DVBv3 is now on a separate section that is marked as
deprecated.
So, cleanup the notes.
While here, add a note about using libdvbv5, instead of using
the DVBv5 API directly.
[media] DocBook: Add an example for using FE_SET_PROPERTY
In order to make it clearer about how to use the DVBv5 calls,
add an example of its usage. That should make it clearer about
what's actually required for the DVBv5 calls to work.
[media] DocBook: cross-reference enum fe_modulation where needed
At frontend legacy API description, there are three places
where fe_modulation_t is defined. Cross-reference it to point
to the right place at the documentation.
[media] DocBook: add a proper description for dvb_frontend_info.fe_type
The fe_type is deprecated at the DVB API. However, it may still
be used by legacy DVBv3 applications. While this works with old
devices, modern devices may support more than one delivery
system.
Add an explanation about that and a point to what should be
used, instead, in order for legacy apps to support newer hardware.
What's written there about the arguments for this ioctl
is bogus: it doesn't return an enum (or a typedef)
for enum fe_status. Instead, it returns a bitmask with the
values defined by enum fe_status.
Also, the size of the integer returned is not 16 bits, but,
instead, sizeof(fe_status_t), e. g. sizeof(enum), with is
arch-dependent.
This should of course be fixed, but this should be done on
a separate patch.
[media] DocBook: better organize the function descriptions for frontend
Move the function ioctl definitions to the end of the chapter,
at their importance. That makes the document better organized,
as the DVB frontend system call index will look like:
open()
close()
ioctl FE_GET_INFO — Query DVB frontend capabilities and returns information about the front-end. This call only requires read-only access to the device
ioctl FE_READ_STATUS — Returns status information about the front-end. This call only requires read-only access to the device
ioctl FE_SET_PROPERTY, FE_GET_PROPERTY — FE_SET_PROPERTY sets one or more frontend properties. FE_GET_PROPERTY returns one or more frontend properties.
ioctl FE_DISEQC_RESET_OVERLOAD — Restores the power to the antenna subsystem, if it was powered off due to power overload.
ioctl FE_DISEQC_SEND_MASTER_CMD — Sends a DiSEqC command
ioctl FE_DISEQC_RECV_SLAVE_REPLY — Receives reply from a DiSEqC 2.0 command
ioctl FE_DISEQC_SEND_BURST — Sends a 22KHz tone burst for 2x1 mini DiSEqC satellite selection.
ioctl FE_SET_TONE — Sets/resets the generation of the continuous 22kHz tone.
ioctl FE_SET_VOLTAGE — Allow setting the DC level sent to the antenna subsystem.
ioctl FE_ENABLE_HIGH_LNB_VOLTAGE — Select output DC level between normal LNBf voltages or higher LNBf voltages.
ioctl FE_SET_FRONTEND_TUNE_MODE — Allow setting tuner mode flags to the frontend.
Use the proper format for FE_SET_VOLTAGE documentation and fix
the documentation. The description for the enum is not 100%,
and it is missing the voltage off value.
Also, it is better to keep the enum description together with
the ioctl, as both are used together.
[media] DocBook: move FE_GET_PROPERTY to its own xml file
That helps the xref logic at the Makefile to point to the
right place. Also, it becomes more organized and easier to
maintain if each ioctl have its own xml file.
[media] DocBook: Improve xref check for undocumented ioctls
There are several badly documented undocumented ioctls.
Currently, it just generates an empty link. Instead of doing that,
only add references to the ones that exists, and add a warning
for all references that weren't found.
[media] DocBook: move DVB properties to happen earlier at the document
The DVBv5 API uses DVB properties as the main way to set the frontend
and collect statistics. Move the definition to happen earlier, in
order to reflect its importance.
[media] DocBook: move FE_GET_INFO to a separate xml file
Keeping everything altogether makes harder to reorganize the
DocBook. So, move the FE_GET_INFO ioctl and the associated structures
into a separate file.
The DVB part of the docbook has a completely different format
than the V4L2 part, as it was written as a separate document.
As the V4L2 documentation is on better shape, and its format
allows adding more information, let's use it for FE_GET_INFO
and gradually update the non-legacy DVB ioctls using the new
format.
[media] dvb: split enum from typedefs at frontend.h
Using typedefs is already bad enough, but doing it together
with enum declaration is even worse.
Also, it breaks the scripts at DocBook that would be generating
reference pointers for the enums.
Well, we can't get rid of typedef right now, but let's at least
declare it on a separate line, and let the scripts to generate
the cross-reference, as this is needed for the next DocBook
patches.
[media] DocBook: add drawing with a typical media device
An illustration of what's considered a typical media device
may help people to better understand the contents of the media
infrastructure API docbook. So, add it.
The Docbook mistakenly makes to believe that all needed APIs for
media devices are there. Add a note there pointing that some
sub-devices are actually be controlled via ALSA API.
[media] DocBook: Update DVB supported standards at introduction
The list of standards at the media docbook is incomplete, and it
is mentioning that the DVB-S2 & friends is "currently being updated".
That's wrong, as such update occurred back in 2008.
So, provide a more complete list of supported standards and add
a reference to the actual list.
drivers/media/tuners/e4000.c:287:32: warning: constant 2208000000 is so big it is long long
drivers/media/tuners/e4000.c:287:32: warning: decimal constant 2208000000 is between LONG_MAX and ULONG_MAX. For C99 that means long long, C90 compilers are very likely to produce unsigned long (and a warning) here
drivers/media/tuners/e4000.c:287:3: warning: this decimal constant is unsigned only in ISO C90
.rangehigh = 2208000000,
^
Cc: Antti Palosaari <crope@iki.fi> Signed-off-by: Mauro Carvalho Chehab <mchehab@osg.samsung.com>
Antti Palosaari [Tue, 21 Apr 2015 20:13:39 +0000 (17:13 -0300)]
[media] e4000: various small changes
* Rename device state from 's' to 'dev'.
* Move single include to driver private header.
* Change error handling type of each function to one I tend use
nowadays.
* Remove dummy register write from init. Even Windows driver does this
multiple times remove it as I have never seen any I2C errors.
* Define I2C client pointer for each function and use it.
* Do not clean tuner ops during driver remove - not needed.
* Disable sysfs device bind / unbind. We are not allowed manually
bind / unbind device from the driver currently.
* Rename some other variables.
Signed-off-by: Antti Palosaari <crope@iki.fi> Signed-off-by: Mauro Carvalho Chehab <mchehab@osg.samsung.com>
Antti Palosaari [Wed, 22 Apr 2015 00:18:45 +0000 (21:18 -0300)]
[media] e4000: revise synthesizer calculation
Update synthesizer calculation to model I prefer nowadays. It is
mostly just renaming some variables to ones I think are most standard.
Also add 'schematic' of synthesizer following my current understanding.
Signed-off-by: Antti Palosaari <crope@iki.fi> Signed-off-by: Mauro Carvalho Chehab <mchehab@osg.samsung.com>
Dan Carpenter [Thu, 14 May 2015 08:39:17 +0000 (05:39 -0300)]
[media] rtl2832_sdr: cleanup some set_bit() calls
This code works fine but static checkers complain. The test_bit()
function takes the bit number and not a mask. Then the other issue is
that we were using USB_STATE_URB_BUF which is BIT(0) instead of URB_BUF.
Also we were open coding that instead of using the test/clear/set_bit()
functions.
Signed-off-by: Dan Carpenter <dan.carpenter@oracle.com> Signed-off-by: Antti Palosaari <crope@iki.fi> Signed-off-by: Mauro Carvalho Chehab <mchehab@osg.samsung.com>
Hans Verkuil [Tue, 12 May 2015 11:52:21 +0000 (08:52 -0300)]
[media] cobalt: add new driver
The cobalt device is a PCIe card with 4 HDMI inputs (adv7604) and a
connector that can be used to hook up an adv7511 transmitter or an
adv7842 receiver daughterboard.
This device is used within Cisco but is sadly not available outside
of Cisco. Nevertheless it is a very interesting driver that can serve
as an example of how to support HDMI hardware and how to use the popular
adv devices.
Signed-off-by: Hans Verkuil <hans.verkuil@cisco.com> Signed-off-by: Mauro Carvalho Chehab <mchehab@osg.samsung.com>