In the function cx88_audio_initdev, the value card has been created using
snd_card_new. The other error handling code in this function frees the
value using snd_card_free. I have thus changed the first error case to do
the same. On the other hand, it may be that card is not sufficiently
initialized at this point to use snd_card_free, in which case something
else should be done to free the memory in the error case.
In the function snd_cx88_create the call kfree(chip) in one error case
looks suspicious, both because it is not done in the other error code, and
because chip points into the middle of the memory allocated by
snd_card_new, ie it is not itself associated with a separate kmalloc.
Therefore I have removed it.
The semantic match that finds the first problem is as follows:
(http://www.emn.fr/x-info/coccinelle/)
// <smpl>
@r exists@
local idexpression x;
statement S,S1;
position p1,p2,p3;
expression E,E1;
type T,T1;
expression *ptr != NULL;
@@
(
if ((x@p1 = snd_card_new(...)) == NULL) S
|
x@p1 = snd_card_new(...);
)
... when != snd_card_free(...,(T)x,...)
when != if (...) { <+... snd_card_free(...,(T)x,...) ...+> }
when != true x == NULL || ...
when != x = E
when != E = (T)x
when any
(
if (x == NULL || ...) S1
|
if@p2 (...) {
... when != snd_card_free(...,(T1)x,...)
when != if (...) { <+... snd_card_free(...,(T1)x,...) ...+> }
when != x = E1
when != E1 = (T1)x
(
return \(0\|<+...x...+>\|ptr\);
|
return@p3 ...;
)
}
)
Robert Jarzmik [Mon, 1 Dec 2008 12:45:35 +0000 (09:45 -0300)]
V4L/DVB (9791): pxa-camera: pixel format negotiation
Use the new format-negotiation infrastructure, support all four YUV422
packed and the planar formats.
The new translation structure enables to build the format
list with buswidth, depth, host format and camera format
checked, so that it's not done anymore on try_fmt nor
set_fmt.
V4L/DVB (9790): soc-camera: pixel format negotiation - core support
Allocate and fill a list of formats, supported by this specific
camera-host combination. Use it for format enumeration. Take care to stay
backwards-compatible.
Camera hosts rely on sensor formats available, as well as
host specific translations. We add a structure so that hosts
can define a translation table and use it for format check
and setup.
We anyway don't follow the s_fmt_vid_cap / g_fmt_vid_cap / try_fmt_vid_cap
naming, and soc-camera is so far only about video capture, let's simplify
operation names a bit further. set_fmt_cap / try_fmt_cap wasn't a very good
choice too.
V4L/DVB (9787): soc-camera: let camera host drivers decide upon pixel format
Pixel format requested by the user is not necessarily the same, as what
a sensor driver provides. There are situations, when a camera host driver
provides the required format, but requires a different format from the
sensor. Further, the list of formats, supported by sensors is pretty static
and can be pretty good described with a constant list of structures. Whereas
decisions, made by camera host drivers to support requested formats can be
quite complex, therefore it is better to let the host driver do the work.
V4L/DVB (9785): soc-camera: merge .try_bus_param() into .try_fmt_cap()
.try_bus_param() method from struct soc_camera_host_ops is only called at one
location immediately before .try_fmt_cap(), there is no value in keeping these
two methods separate, merge them.
Andy Walls [Sun, 30 Nov 2008 13:01:21 +0000 (10:01 -0300)]
V4L/DVB (9778): cx18: cx18_writel_expect() should not declare success on a PCI read error
cx18: cx18_writel_expect() should not declare success on a PCI read error.
This removes the potential for cx18_write*_expect() calls to not
accomplish a PCI write successfully as expected. The CX18-AV core uses the
*expect() calls often and this may be the source of intermittent audio
problems and standands switching problems.
Signed-off-by: Andy Walls <awalls@radix.net> Signed-off-by: Mauro Carvalho Chehab <mchehab@redhat.com>
Andy Walls [Wed, 26 Nov 2008 00:43:05 +0000 (21:43 -0300)]
V4L/DVB (9776): cx18: Change to per CX23418 device work queues for deferrable work handling
cx18: Change to per CX23418 device work queues for deferrable work handling.
Needed to support 2.6.22 and earlier kernels that can't selectively cancel
work orders. Also will provide slightly better performance on SMP systems.
Signed-off-by: Andy Walls <awalls@radix.net> Signed-off-by: Mauro Carvalho Chehab <mchehab@redhat.com>
tda8290 were using some random video standard for FM. This results on random
errors. Instead, program tda8290 in expert mode, using a configuration near the
one specified on NXP datasheet for tda8295 (available on their site).
Also, properly display that the device is on radio mode.
Probably due to a removed code, tda827x were doing some wrong calculus at the
returned frequency. I suspect that the original idea were to return the
programmed divisor converted into frequency again.
However, the current code is sometimes multiplying the programmed frequency by
62500, and, on other cases, like radio, it dividing it by 1000.
Instead of doing such math, let's just store the frequency value as requested by
the caller module.
Cc: Michael Krufky <mkrufky@linuxtv.org> Signed-off-by: Mauro Carvalho Chehab <mchehab@redhat.com>
/home/mauro/v4l-dvb/v4l/tuner-xc2028.c: In function 'xc2028_sleep':
/home/mauro/v4l-dvb/v4l/tuner-xc2028.c:1111: warning: 'return' with no value, in function returning non-void
V4L/DVB (9770): em28xx: turn off tuner when not used
em28xx devices generally get hot when xc3028 tuner is powered on. This
patch solves this by turning power off when the device is not used, at the
expense of having a higher load time, when calling a TV application.
Since firmware load happens on 1 or 2 seconds on most devices, this is not a pain.
Also, it helps to save the planet by saving some power :)
V4L/DVB (9769): tuner-xc2028: powers device of when not used
Since the firmware load is now fast on most boards, better to keep the tuner
off by default. A modprobe parameter were added to keep the old behavior,
to be used by old devices.
Andy Walls [Sun, 23 Nov 2008 19:27:57 +0000 (16:27 -0300)]
V4L/DVB (9730): cx18: Quiet a sometimes common warning that often has benign consequences
cx18: Quiet a sometimes common warning that often has benign consequences.
No one probably cares that the firmware took forever to ack our command, as
they always seem to succeed whether or not the firmware acks it in a reasonable
amount of time.
Signed-off-by: Andy Walls <awalls@radix.net> Signed-off-by: Mauro Carvalho Chehab <mchehab@redhat.com>
cx18: Adjust outgoing mailbox timeouts and remove statistics logging.
This saves some wasted storage in struct cx18 for each card. Cutting
the outgoing mailbox timeouts in half from the previous value appears to
be safe with MythTV. Got rid of interrupted case code path after
a wait uninterruptable returns.
Signed-off-by: Andy Walls <awalls@radix.net> Signed-off-by: Mauro Carvalho Chehab <mchehab@redhat.com>
Andy Walls [Tue, 18 Nov 2008 01:48:46 +0000 (22:48 -0300)]
V4L/DVB (9725): cx18: Remove unnecessary MMIO accesses in time critical irq handling path
Remove unnecessary MMIO accesses in time critical irq handling path. Also
ensured that the mailbox ack field is read in last, so we know for sure if we
have a stale mailbox or not on receipt.
Signed-off-by: Andy Walls <awalls@radix.net> Signed-off-by: Mauro Carvalho Chehab <mchehab@redhat.com>
cx18: Streamline cx18-io[ch] wrappers and enforce MMIO retry strategy so that
write retries always occur and read retries never occur (as they never help).
Remove MMIO statistics logging to speed up MMIO accesses. Deprecate & ignore
retry_mmio and mmio_ndelay module parameters, to essentially force
retry_mmio=1 and mmio_ndelay=0.
Signed-off-by: Andy Walls <awalls@radix.net> Signed-off-by: Mauro Carvalho Chehab <mchehab@redhat.com>
Andy Walls [Mon, 17 Nov 2008 00:18:00 +0000 (21:18 -0300)]
V4L/DVB (9723): cx18: Propagate staleness of mailbox and mdl ack data to work handler
cx18: Propagate staleness of mailbox and mdl ack data to work handler to let
the work handler know that the data from the encoder may not be coherent.
Allows for smarter handling of buffers in future, to deal with MDLs that fall
out of rotation due to irq handler being late in collecting mailbox and mdl ack
info.
Signed-off-by: Andy Walls <awalls@radix.net> Signed-off-by: Mauro Carvalho Chehab <mchehab@redhat.com>
Andy Walls [Sun, 16 Nov 2008 23:18:05 +0000 (20:18 -0300)]
V4L/DVB (9722): cx18: Convert per stream queue spinlocks into mutexes
Convert the per stream queue spinlocks into mutexes. All queue
manipulation happens via the work queue or system calls into the driver, and
not in an interrupt context. This reduces the amout of time the cx18 driver
keeps interrupts disabled.
Signed-off-by: Andy Walls <awalls@radix.net> Signed-off-by: Mauro Carvalho Chehab <mchehab@redhat.com>
Andy Walls [Sun, 16 Nov 2008 20:15:01 +0000 (17:15 -0300)]
V4L/DVB (9721): cx18: Change to singlethreaded global work queue thread for deferable work
Change to singlethreaded global work queue thread for deferable work,
instead of the kernel default multithreaded work queue. This ensures
execution of deferable work is always in the proper order, so caputred buffers
don't get reordered.
Signed-off-by: Andy Walls <awalls@radix.net> Signed-off-by: Mauro Carvalho Chehab <mchehab@redhat.com>
Andy Walls [Sun, 16 Nov 2008 04:38:19 +0000 (01:38 -0300)]
V4L/DVB (9720): cx18: Major rewrite of interrupt handling for incoming mailbox processing
A major rewrite of interrupt handling for incoming mailbox processing, to split
the timing critical steps from the the deferrable steps as the sending XPU on
the CX23418 will time out and overwrite our incoming mailboxes rather quickly.
Setup a pool of work "order forms" for the irq handler to send jobs to the new
work handler routine which uses the kernel default work queue to do the
deferrable work. Started optimizing some of the cx18-io calls as they are now
the low hanging fruit for recoving microseconds back from the timeline.
Future optimizations will get rid of mmio read retries, mmio stats logging, and
combine smaller functions in the irq path into the larger ones to save ~2 us
each.
Signed-off-by: Andy Walls <awalls@radix.net> Signed-off-by: Mauro Carvalho Chehab <mchehab@redhat.com>
Alexey Klimov [Wed, 19 Nov 2008 03:36:29 +0000 (00:36 -0300)]
V4L/DVB (9655): radio-mr800: fix unplug
This patch fixes problems(kernel oopses) with unplug of device while
it's working.
Patch adds disconnect_lock mutex, changes usb_amradio_close and
usb_amradio_disconnect functions and adds a lot of safety checks.
Andy Walls [Sun, 9 Nov 2008 22:51:44 +0000 (19:51 -0300)]
V4L/DVB (9599): cx18: Fix unitialized variable problem upon APU firmware file read failure
If APU firmware file read failed, the jump vector to the APU was undefined and
the APU would be started executing garbage. Fix uninitialized variable to be
an infinite loop for the APU, but also bail out before even starting the APU.
Signed-off-by: Andy Walls <awalls@radix.net> Signed-off-by: Mauro Carvalho Chehab <mchehab@redhat.com>
Andy Walls [Sun, 9 Nov 2008 21:14:07 +0000 (18:14 -0300)]
V4L/DVB (9598): cx18: Prevent CX23418 from clearing it's outgoing ack interrupts to driver
When the CX23418 CPU unit sent out an ack interrupt to the linux driver, it
also received that interrupt and cleared the flag before the linux driver could
see what the interrupt was for. This fix prevents the CPU from receiving an
IRQ for it's own outgoing ack's to the linux driver. This fix is critical now
that the linux driver doesn't poll but relies on these ack interrupts.
Signed-off-by: Andy Walls <awalls@radix.net> Signed-off-by: Mauro Carvalho Chehab <mchehab@redhat.com>
Andy Walls [Sat, 8 Nov 2008 20:14:22 +0000 (17:14 -0300)]
V4L/DVB (9597): cx18: Minor fixes to APU firmware load process
Use the APU fw start address from rom file instead of a hardcoded entry vector.
Fixed cx18_setup_page() calls to use the correct APU image load addresses.
Signed-off-by: Andy Walls <awalls@radix.net> Signed-off-by: Mauro Carvalho Chehab <mchehab@redhat.com>
Andy Walls [Sat, 8 Nov 2008 17:19:37 +0000 (14:19 -0300)]
V4L/DVB (9596): cx18: Further changes to improve mailbox protocol integrity & performnce
All waits for cx18 mailbox API commands are now uninterruptable. Added
code to collect mailbox ack statistics. Tweaked timeouts based on collected
stats and video vertical frame and field rates.
Signed-off-by: Andy Walls <awalls@radix.net> Signed-off-by: Mauro Carvalho Chehab <mchehab@redhat.com>
Andy Walls [Sat, 8 Nov 2008 02:57:46 +0000 (23:57 -0300)]
V4L/DVB (9595): cx18: Improve handling of outgoing mailboxes detected to be busy
cx18: Improve handling of outgoing mailboxes detected to be busy. When
encountering a busy mailbox, sleep instead of polling, and wait for interrupt or
timeout. If the mailbox is still busy, force it free. When sending commands,
make sure we never create a situation where we mark the mailbox busy upon
sending, and ensure we always have a method to cleanly recover from a busy
mailbox.
Signed-off-by: Andy Walls <awalls@radix.net> Signed-off-by: Mauro Carvalho Chehab <mchehab@redhat.com>
Andy Walls [Thu, 6 Nov 2008 04:15:41 +0000 (01:15 -0300)]
V4L/DVB (9593): cx18: Add outgoing mailbox mutexes and check for ack via waitq vs poll
Add mutexes to ensure exclusive access for outgoing driver to CX23418 mailboxes.
Also wait on a waitq for mailbox acknowledgement from the CX23418 instead of
polling.
Signed-off-by: Andy Walls <awalls@radix.net> Signed-off-by: Mauro Carvalho Chehab <mchehab@redhat.com>
Andy Walls [Thu, 6 Nov 2008 00:19:15 +0000 (21:19 -0300)]
V4L/DVB (9592): cx18: Use default kernel work queue; fix streaming flag for work handler
cx18: Use default kernel work queue; fix streaming flag for work handler.
Eliminate cx18 specific work queue and use the kernel default work queue.
Fixed the F_STREAMING_FLAG for the TS stream so cx18_dvb_work_handler()
can know when it is not safe to send MDLs to the firmware.
Signed-off-by: Andy Walls <awalls@radix.net> Signed-off-by: Mauro Carvalho Chehab <mchehab@redhat.com>
Andy Walls [Sun, 2 Nov 2008 21:15:28 +0000 (18:15 -0300)]
V4L/DVB (9513): cx18: Reduce number of mmio read retries
cx18: Reduce number of mmio read retries to improve performance. Experiments
have shown 2 things: read retries never improve the result of a suspect mmio
read from the CX23418 (the result stays all 0xff's), and that most of the
suspected read failures are actually proper reads of values that should be
all 0xff's. This change reduces the number of read retries and keeps the
count separate from write retries.
Signed-off-by: Andy Walls <awalls@radix.net> Signed-off-by: Mauro Carvalho Chehab <mchehab@redhat.com>
Manu Abraham [Mon, 19 Nov 2007 19:44:47 +0000 (16:44 -0300)]
V4L/DVB (9442): Revert back previous change to 90MHz
Note:
* At High Symbol Rates we do not have enouph machine cycles to handle the
incoming symbols and hence might run into problems at the very end of the
specified definition
* Most of the equations have been calculated for a master clock of 99 MHz,
running at 90MHz, raises lot of issues such as the need to recalculate
all of them , which is eventually very painful.
Signed-off-by: Manu Abraham <manu@linuxtv.org> Signed-off-by: Mauro Carvalho Chehab <mchehab@redhat.com>
V4L/DVB (9764): em28xx: Add support for suspend the device when not used
Several chips may be turned off when the device is not used, like audio,
video and dvb demods. This patch adds a gpio callback at the core
structs to allow turning off such devices.
Before this patch, several devices without tuner were kept the value 0
for tuner_type. However, this means TUNER_TEMIC_PAL. Replace those
entries for the proper TUNER_ABSENT value.
V4L/DVB (9760): em28xx: move gpio lines into board table description
Instead of a large, ugly switch specifying the gpio tables for each
device, let's move it into the boards struct. This also helps to see
what boards have already the gpio's for DVB.
V4L/DVB (9753): em28xx: cleanup: saa7115 module auto-detects saa711x type
Since saa7115 has saa711x chip auto-detection, there's no need on differenciating
it at cards table. Just use the generic name for all boards that use a philips
saa711x decoder.
V4L/DVB (9747): em28xx: Properly handles XCLK and I2C speed
The previous patches removed XCLK and I2C magic. Now, we finally know
what those registers do. Also, only a very few cards need different
setups for those.
Instead of keeping the setups for those values inside the per-device
hack magic switch, move the uncommon values to the board-specific
struct, and have a common setup for all other boards.
So, almost 100 lines of hacking magic were removed.
A co-lateral effect of this patch is that it also fixes a bug at em28xx-core, where xclk
were set, without taking any care about not overriding a previous xclk setup.
Cleanup the calls to set the GPIOs and GPOs for various devices,
replacing the register number with the #define from em28xx-reg.h and
converting over to using em28xx_write_reg()
Antonio Ospite [Sat, 22 Nov 2008 08:23:39 +0000 (05:23 -0300)]
V4L/DVB (9712): gspca:Subdriver ov534 added.
The OmniVision OV534 is the USB bridge chip used in Sony Playstation EYE,
it is found also in other webcams like Hercules Blog Webcam and
Hercules Dualpix HD.
This driver is the port to gspca of a prototype driver by Mark Ferrell
based on vivi. The original code to initialize the camera and start the
capture is from Jim Paris on ps2dev.org, here integrated with the analysis
of the USB communications taken by the windows driver.
Erik Andrén [Sat, 1 Nov 2008 16:13:03 +0000 (13:13 -0300)]
V4L/DVB (9698): Add another vflip quirk for the s5k4aa
The msi gx7xx range of computers seem to be a strange lot with lots of different sys vendor names and differently oriented sensors. This commit adds another quirk for a range of them.
Signed-off-by: Erik Andrén <erik.andren@gmail.com> Signed-off-by: Mauro Carvalho Chehab <mchehab@redhat.com>
Hans de Goede [Mon, 17 Nov 2008 17:52:56 +0000 (14:52 -0300)]
V4L/DVB (9685): gspca: Correct restart of webcams in spca501.
Currently the spca501 driver only works the first time used, then the cam needs
to be unplugged or the driver reloaded, this is because currently the data
which should be send each time the stream is started is send only once.
Likewise currently the data to initialize the cam is send from the probe
function, and thus will not get send after a suspend/resume.
This patch fixes this by sending both at the right time.
Signed-off-by: Hans de Goede <hdegoede@redhat.com> Signed-off-by: Jean-Francois Moine <moinejf@free.fr> Signed-off-by: Mauro Carvalho Chehab <mchehab@redhat.com>
Dirk Heer [Fri, 21 Nov 2008 22:00:55 +0000 (19:00 -0300)]
V4L/DVB (9677): bttv: fix some entries on Phytec boards and add missing ones
This Patch does modify the bttv-cards.c and bttc.h so that the driver
supports VD-011, VD-012, VD-012-X1 and VD-012-X2 Framegrabber from
Phytec Messtechnik GmbH.