[media] saa7164: fix a warning at some printk's on i386
drivers/media/video/saa7164/saa7164-buffer.c: In function ‘saa7164_buffer_display’:
drivers/media/video/saa7164/saa7164-buffer.c:76: warning: cast to pointer from integer of different size
drivers/media/video/saa7164/saa7164-buffer.c:78: warning: cast to pointer from integer of different size
Steven Toth [Sat, 31 Jul 2010 19:08:52 +0000 (16:08 -0300)]
[media] saa7164: add firmware debug message collection and procfs changes
Check for PROCFS and dynamically adjust code.
Cache some PCIe values in the device context.
Provide a mechanism to collect the debug messages
coming from the firmware.
Signed-off-by: Steven Toth <stoth@kernellabs.com> Signed-off-by: Mauro Carvalho Chehab <mchehab@redhat.com>
Steven Toth [Sat, 31 Jul 2010 18:10:52 +0000 (15:10 -0300)]
[media] saa7164: measure via histograms various irq and queue latencies
saa7164: measure via histograms various irq and queue latencies
Attempting to determine where buffering issues under high load are due
to highly latent irq or work queue handling.
Signed-off-by: Steven Toth <stoth@kernellabs.com> Signed-off-by: Mauro Carvalho Chehab <mchehab@redhat.com>
Steven Toth [Sat, 31 Jul 2010 17:50:46 +0000 (14:50 -0300)]
[media] saa7164: generate a fixed kernel warning if the irq is 'late'
Now we start to see a number of patches applied that are related
to debugging the driver. This patch is removed in the coming patches
as you start to see the irq handler evolve as I worked through the
DMA data corruption issues.
Signed-off-by: Steven Toth <stoth@kernellabs.com> Signed-off-by: Mauro Carvalho Chehab <mchehab@redhat.com>
Jean Delvare [Wed, 13 Oct 2010 12:24:25 +0000 (09:24 -0300)]
[media] i2c: Stop using I2C_CLASS_TV_DIGITAL
Detection class I2C_CLASS_TV_DIGITAL is set by many adapters but no
I2C device driver is setting it anymore, which means it can be
dropped. I2C devices on digital TV adapters are instantiated
explicitly these days, which is much better.
Signed-off-by: Jean Delvare <khali@linux-fr.org> Signed-off-by: Mauro Carvalho Chehab <mchehab@redhat.com>
Jean Delvare [Wed, 13 Oct 2010 12:22:54 +0000 (09:22 -0300)]
[media] i2c: Stop using I2C_CLASS_TV_ANALOG
Detection class I2C_CLASS_TV_ANALOG is set by a few adapters but no
I2C device driver is setting it anymore, which means it can be
dropped. I2C devices on analog TV adapters are instantiated
explicitly these days, which is much better.
Signed-off-by: Jean Delvare <khali@linux-fr.org> Signed-off-by: Mauro Carvalho Chehab <mchehab@redhat.com>
Paul Walmsley [Sat, 9 Oct 2010 04:31:40 +0000 (01:31 -0300)]
[media] tvp5150: COMPOSITE0 input should not force-enable TV mode
When digitizing composite video from a analog videotape source using the
TVP5150's first composite input channel, the captured stream exhibits
tearing and synchronization problems[1].
It turns out that commit c0477ad9feca01bd8eff95d7482c33753d05c700 caused
"TV mode" (as opposed to "VCR mode" or "auto-detect") to be forcibly
enabled for both composite inputs. According to the chip
documentation[2], "TV mode" disables a "chrominance trap" input filter,
which appears to be necessary for high-quality video capture from an
analog videotape source. [ Commit c7c0b34c27bbf0671807e902fbfea6270c8f138d subsequently restricted the
problem to the first composite input, apparently inadvertently. ]
Since any type of composite signal source can be connected to the
TVP5150's first composite input, unconditionally forcing "TV mode" isn't
correct. There doesn't appear to be a good way for applications to tell
the driver what is connected. Fortunately, the TVP5150 has an operating
mode auto-detection feature, which, when enabled, should cause the TVP5150
to auto-detect whether it should use "VCR mode" or "TV mode". Enabling
operating mode auto-detection improved video capture quality
significantly[3].
Therefore, fix this bug by using operating mode auto-detection. (Also,
while here, fix a CodingStyle issue.)
For those users who may find this patch via a mailing list archive but who
are not able to upgrade to a kernel with a fixed driver: the TVP5150's
S-Video and second composite input sources have auto-detection enabled, so
you may wish to try using those -- if available on your device -- until
this fix makes it a downstream distribution near you.
1. Pre-patch tvtime snapshot using a Pinnacle PCTV HD Pro as the
capture device and a Sony EV-S2000 as a video source:
http://www.booyaka.com/~paul/tvp5150/1a.png
2. Section 3.21.3, "Operation Mode Control Register", _TVP5150AM1
Ultralow-Power NTSC/PAL/SECAM Video Decoder (Rev. D)_ [SLES209D],
downloaded 8 October 2010, available via
http://focus.ti.com/lit/ds/symlink/tvp5150am1.pdf
3. Post-patch tvtime snapshot (same signal chain as #1, above):
http://www.booyaka.com/~paul/tvp5150/1b.png
Signed-off-by: Paul Walmsley <paul@booyaka.com> Signed-off-by: Mauro Carvalho Chehab <mchehab@redhat.com>
Jarod Wilson [Fri, 15 Oct 2010 14:07:37 +0000 (11:07 -0300)]
[media] IR/nuvoton: address all checkpatch.pl issues
The driver was missing KERN_ facilities on a number of printks. The
register dump functions have been updated to use KERN_INFO, so that the
register dump gets logged in syslog (they only run on driver load, and
only when debug is enabled). The buffer dump routine now uses
KERN_DEBUG, as that spew will happen quite frequently (several times
every IR signal), and shouldn't need to be logged.
Also split up the small handful of lines that were just over 80
characaters, and fixed the ioctl.h include.
Signed-off-by: Jarod Wilson <jarod@redhat.com> Signed-off-by: Mauro Carvalho Chehab <mchehab@redhat.com>
[media] IR: make sure we register the input device when it is safe to do so
As soon as input device is registered, it might be accessed (and it is)
This can trigger a hardware interrupt that can access
not yet initialized ir->raw, (by sending a sample)
This can be reproduced by holding down a remote button and reloading the module.
And this always crashes the systems where hardware decides to send an interrupt
right at the moment it is enabled.
Unfortunelly (my fault) the kernel thread that now handles IR processing
has classical races in regard to wakeup and stop.
This patch hopefully closes them all.
Tested with module reload running in a loop, while receiver is blasted
with IR data for 10 minutes.
Dan Carpenter [Tue, 12 Oct 2010 13:42:08 +0000 (10:42 -0300)]
[media] IR/streamzap: fix usec to nsec conversion
There is an integer overflow here because 0x03000000 * 1000 is too large
for 31 bits.
rawir.duration should be in terms of nsecs.
IR_MAX_DURATION and 0x03000000 are already in terms of nsecs.
STREAMZAP_TIMEOUT and STREAMZAP_RESOLUTION are 255 and 256 respectively
and are in terms of usecs.
The original code had a deadline of 1.005 seconds and the new code has a
deadline of .065 seconds.
Signed-off-by: Dan Carpenter <error27@gmail.com> Signed-off-by: Jarod Wilson <jarod@redhat.com> Signed-off-by: Mauro Carvalho Chehab <mchehab@redhat.com>
Jarod Wilson [Sat, 9 Oct 2010 18:07:06 +0000 (15:07 -0300)]
[media] lirc: wire up .compat_ioctl to main ioctl handler
As pointed out (and tested) by Joris van Rantwijk, we do actually need
to wire up .compat_ioctl for 32-bit lirc userspace to work with 64-bit
lirc kernelspace. Do it. And add a check to make sure we get a valid
irctl in the ioctl handler.
Signed-off-by: Jarod Wilson <jarod@redhat.com> Signed-off-by: Mauro Carvalho Chehab <mchehab@redhat.com>
Jarod Wilson [Fri, 8 Oct 2010 20:24:21 +0000 (17:24 -0300)]
[media] IR/lirc: further ioctl portability fixups
>From Joris van Rantwijk <jorispubl@xs4all.nl>:
I tested lirc_serial and found that it works fine.
Except the LIRC ioctls do not work in my 64-bit-kernel/32-bit-user
setup. I added compat_ioctl entries in the drivers to fix this.
While doing so, I noticed inconsistencies in the argument type of
the LIRC ioctls. All ioctls are declared in lirc.h as having argument
type __u32, however there are a few places where the driver calls
get_user/put_user with an unsigned long argument.
The patch below changes lirc_dev and lirc_serial to use __u32 for all
ioctl arguments, and adds compat_ioctl entries.
It should probably also be done in the other low-level drivers,
but I don't have hardware to test those.
I've dropped the .compat_ioctl addition from Joris' original patch,
as I swear the non-compat definition should now work for both 32-bit
and 64-bit userspace. Technically, I think we still need/want a
in getting a reply to you).
Reported-by: Joris van Rantwijk <jorispubl@xs4all.nl> Signed-off-by: Jarod Wilson <jarod@redhat.com> Signed-off-by: Mauro Carvalho Chehab <mchehab@redhat.com>
Per discussion with Andy Walls on irc, rx fifo overruns are not all that
uncommon on a busy system, and the initial posting of the nuvoton-cir
driver doesn't handle them well enough. With this addition, we'll drain
the hw fifo, attempt to process any ir pulse trains completed with that
flush, then we'll issue a hw rx fifo clear and reset the raw ir sample
kfifo and start over collecting raw ir data.
Also slightly refactors the cir interrupt enabling so that we always get
consistent flags set and only have to modify them in one place, should
they need to be altered.
Signed-off-by: Jarod Wilson <jarod@redhat.com> Signed-off-by: Mauro Carvalho Chehab <mchehab@redhat.com>
Jarod Wilson [Thu, 7 Oct 2010 20:50:34 +0000 (17:50 -0300)]
[media] IR: add driver for Nuvoton w836x7hg integrated CIR
This is a new ir-core pnp driver for the Nuvoton w836x7hg integrated CIR
function. The chip is found on at least the ASRock ION 330HT boxes and
apparently, on a number of Intel DP55-series motherboards:
This driver was made possible by a hardware donation from Nuvoton, along
with sample code (in the form of an lirc driver) and datasheet, so huge
thanks to them for supporting this effort. Note that this driver
constitutes a massive rewrite, porting from the lirc interfaces to the
ir-core interfaces, and restructuring the driver to look more like Maxim
Levitsky's ene_ir driver (as well as generally making it look more like
kernel code).
There's some work left to be done on this driver, to fully support the
range of functionality possible, but receive and IR power-on/wake are
both functional (may require setting wake key under another OS atm). The
hardware I've got (one of the ASRock boxes) only supports RX, so TX is
completely untested as of yet. Certain RX parameters, like sample
resolution and RX IRQ sample length trigger level could possibly stand
to be made tweakable via modparams or sysfs nodes, but the current
values work well enough for me w/an MCE RC6A remote.
The original lirc driver carried support for the Windows MCE IR
keyboard/mouse device, which I plan to add back generically, in a way
that should be usable by any raw IR receiver (or at least by this driver
and the mceusb driver).
Suspend and resume have also been tested, the power button on my remote
can be used to wake the machine, and CIR functionality resumes just
fine. Module unload/reload has also been tested, though not extensively
or repetitively. Also tested to work with the lirc bridge plugin for
userspace decoding.
Signed-off-by: Jarod Wilson <jarod@redhat.com> Signed-off-by: Mauro Carvalho Chehab <mchehab@redhat.com>
[media] uvcvideo: Fix bogus XU controls information
XU control information is supposed to be entirely discoverable using
standard UVC queries. As some devices report bogus information (such as
reporting a read-only control as being read-write), add a fixup table
for XU controls.
This table can also be used to selectively disable requests supposed to
be supported by all XU controls (GET_MIN, GET_MAX, GET_DEF, GET_RES) but
not correctly (or at all) supported by the device.
The table currently disables GET_CUR on the Logitech motor control XU
pan/tilt controls.
[media] uvcvideo: Delay initialization of XU controls
XU controls initialization requires querying the device for control
information. As some buggy UVC devices will crash when queried
repeatedly in a tight loop, delay XU controls initialization until first
use.
Now that control information structures are not shared between control
instances, embed a uvc_control_info instance inside the uvc_control
structure instead of storing a pointer.
Martin Rubli [Wed, 8 Sep 2010 07:15:23 +0000 (04:15 -0300)]
[media] uvcvideo: Remove sysadmin requirements for UVCIOC_CTRL_MAP
This patch removes the sysadmin requirements for UVCIOC_CTRL_MAP (and the stub
implementation of UVCIOC_CTRL_ADD). This requirement no longer makes sense with
the new XU control access mechanisms since XU controls can be accessed without
adding control mappings first.
A maximum number (currently 1024) of control mappings per device is enforced to
avoid excess memory consumption caused by careless user space applications.
Signed-off-by: Martin Rubli <martin_rubli@logitech.com> Signed-off-by: Mauro Carvalho Chehab <mchehab@redhat.com>
[media] uvcvideo: Hardcode the index/selector relationship for XU controls
Devices advertise XU controls using a bitmask, in which each bit
corresponds to a control. The control selector, used to query the
control, isn't available in the USB descriptors.
All known UVC devices use control selectors equal to the control bit
index plus one. Hardcode that relationship in the driver, making the
UVCIOC_CTRL_ADD ioctl obsolete. All necessary information about XU
controls can be obtained by the driver at enumeration time.
The UVCIOC_CTRL_ADD ioctl is still supported for compatibility reasons,
but now always returns -EEXIST.
Finally, control mappings are now on a per-device basis and no longer
global.
As this changes the userspace interface, bump the driver version number
to 1.0.0 (it was about time).
[media] uvcvideo: Generate discontinuous sequence numbers when frames are lost
Increase the sequence number of the v4l2_buffer structure regardless of
any buffer states, so that discontinuous sequence numbers allow
applications to detect lost video frames.
[media] uvcvideo: Set bandwidth to at least 1024 with the FIX_BANDWIDTH quirk
The bandwidth estimate computed with the FIX_BANDIWDTH quirk is too low
for many cameras. Don't use maximum packet sizes lower than 1024 bytes
to try and work around the problem. According to measurements done on
two different camera models, the value is high enough to get most
resolutions working while not preventing two simultaneous VGA streams at
15 fps.
Hans Verkuil [Mon, 11 Oct 2010 15:36:37 +0000 (12:36 -0300)]
[media] radio-mr800: fix locking order
Don't hold the lock before unregistering the device, since when the
device is unregistered the datastruct containing the lock may be freed
(if the refcount went to 0).
Also fixed the framework documentation that erroneously suggested the
wrong locking order as well.
Reported-by: David Ellingsworth <david@identd.dyndns.org> Signed-off-by: Hans Verkuil <hverkuil@xs4all.nl> Acked-by: David Ellingsworth <david@identd.dyndns.org> Signed-off-by: Mauro Carvalho Chehab <mchehab@redhat.com>
Imported from af9015.h. Initial keytable was from
Jose Alberto Reguero <jareguero@telefonica.net> and
Felipe Morales Moreno <felipe.morales.moreno@gmail.com>
Signed-off-by: Antti Palosaari <crope@iki.fi> Signed-off-by: Mauro Carvalho Chehab <mchehab@redhat.com>