Commit Graph

376 Commits

Author SHA1 Message Date
Devin Heitmueller 0f4cf67672 V4L/DVB: cx18: export more symbols required by cx18-alsa
Export a couple of more symbols required by the cx18-alsa module.

This work was sponsored by ONELAN Limited.

Signed-off-by: Devin Heitmueller <dheitmueller@kernellabs.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab@redhat.com>
2010-02-26 15:10:43 -03:00
Devin Heitmueller 700b8aecc9 V4L/DVB: cx18: add cx18-alsa module to Makefile
Add cx18-alsa to the Makefile and Kconfig

This work was sponsored by ONELAN Limited.

Signed-off-by: Devin Heitmueller <dheitmueller@kernellabs.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab@redhat.com>
2010-02-26 15:10:43 -03:00
Devin Heitmueller 9972de9042 V4L/DVB: cx18: overhaul ALSA PCM device handling so it works
Add code so that the PCM ALSA device actually works, and update the
cx18-streams mechanism so that it passes the data off to the cx18-alsa module.

This work was sponsored by ONELAN Limited.

Signed-off-by: Devin Heitmueller <dheitmueller@kernellabs.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab@redhat.com>
2010-02-26 15:10:43 -03:00
Devin Heitmueller 8ef22f794e V4L/DVB: cx18: export a couple of symbols so they can be shared with cx18-alsa
Expose a couple of symbols in the cx18 module so that locking of the PCM
stream can be shared with the cx18-alsa module.

This work was sponsored by ONELAN Limited.

Signed-off-by: Devin Heitmueller <dheitmueller@kernellabs.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab@redhat.com>
2010-02-26 15:10:42 -03:00
Devin Heitmueller 4cb565cc27 V4L/DVB: cx18: make it so cx18-alsa-main.c compiles
Fix some basic compilation issues with Andy's original code.  In particular,
temporarily #ifdef out the mixer code, add some additional exception handling,
fix a couple of typos, and add a copyright line.

This work was sponsored by ONELAN Limited.

Signed-off-by: Devin Heitmueller <dheitmueller@kernellabs.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab@redhat.com>
2010-02-26 15:10:42 -03:00
Devin Heitmueller 0d8e1d0637 V4L/DVB: cx18: rename cx18-alsa.c
Rename cx18-alsa.c to cx18-alsa-main.c so that we can call the final .ko file
cx18-alsa.ko

Signed-off-by: Devin Heitmueller <dheitmueller@kernellabs.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab@redhat.com>
2010-02-26 15:10:42 -03:00
Andy Walls f9b071c77a V4L/DVB: cx18-alsa: Add non-working cx18-alsa-pcm.[ch] files to avoid data loss
Signed-off-by: Andy Walls <awalls@radix.net>
Signed-off-by: Mauro Carvalho Chehab <mchehab@redhat.com>
2010-02-26 15:10:42 -03:00
Andy Walls 9722c8f95a V4L/DVB: cx18-alsa: Initial non-working cx18-alsa files
Initial cx18-alsa module files check-in to avoid losing work.

Signed-off-by: Andy Walls <awalls@radix.net>
Signed-off-by: Mauro Carvalho Chehab <mchehab@redhat.com>
2010-02-26 15:10:42 -03:00
Jiri Slaby e34d375aa6 V4L/DVB (13968): cx18, fix potential null dereference
Stanse found a potential null dereference in cx18_dvb_start_feed
and cx18_dvb_stop_feed. There is a check for stream being NULL,
but it is dereferenced earlier. Move the dereference after the
check.

Signed-off-by: Jiri Slaby <jslaby@suse.cz>
Reviewed-by: Andy Walls <awalls@radix.net>
Acked-by: Andy Walls <awalls@radix.net>
Signed-off-by: Mauro Carvalho Chehab <mchehab@redhat.com>
2010-02-26 15:10:35 -03:00
Sergey Bolshakov a8073119d6 V4L/DVB (13912): cx18: Fix tuner reset pin in card entry for the Leadtek PVR2100
Fix the "xceive_pin" setting from "15" to "1" for the PVR2100 -- the same as
the PVR3100H.  This properly resets the XC2028 tuner on the PVR2100.

Sergey's original email report:

Hi.
Seems cx18 module has incorrect .xceive_pin value for card,
as i see lots of i2c errors in dmesg from xc2028.
i'm using 2.6.32.2, my hardware is:

00:09.0 Multimedia video controller [0400]: Conexant Systems, Inc. CX23418
Single-Chip MPEG-2 Encoder with Integrated Analog Video/Broadcast Audio Decoder
[14f1:5b7a]
        Subsystem: LeadTek Research Inc. Device [107d:6f27]
        Flags: bus master, medium devsel, latency 64, IRQ 17
        Memory at f0000000 (32-bit, non-prefetchable) [size=64M]
        Capabilities: [44] Vital Product Data
        Capabilities: [4c] Power Management version 2
        Kernel driver in use: cx18
        Kernel modules: cx18

Following fixes this problem for me, the rest seems working:

Reported-by: Sergey Bolshakov <sbolshakov@altlinux.ru>
Tested-by: Sergey Bolshakov <sbolshakov@altlinux.ru>
Signed-off-by: Andy Walls <awalls@radix.net>
Signed-off-by: Mauro Carvalho Chehab <mchehab@redhat.com>
2010-02-26 15:10:30 -03:00
Andy Walls 5ada57732a V4L/DVB (13910): cx18: Fix set indextable command to properly select I/P/B index entries
The CX18_CPU_SET_INDEXTABLE command was being called with the wrong number
of arguments causing the index table frame type selection mask to be set wrong.
Now the IDX stream properly sends entries for I, P, and B frames.

Signed-off-by: Andy Walls <awalls@radix.net>
Signed-off-by: Mauro Carvalho Chehab <mchehab@redhat.com>
2010-02-26 15:10:30 -03:00
Andy Walls 9bff2d6171 V4L/DVB (13909): cx18: Clean up dead code from ivtv once used for IDX processing
Signed-off-by: Andy Walls <awalls@radix.net>
Signed-off-by: Mauro Carvalho Chehab <mchehab@redhat.com>
2010-02-26 15:10:30 -03:00
Andy Walls 82acdc84cc V4L/DVB (13908): cx18: Add initial working VIDIOC_G_ENC_INDEX ioctl() support
VIDIOC_G_ENC_INDEX support see the light of day.
Some notes:
1. With default capture parameters, the CX23418 seems to transfer 192 index
entries (4.5 kB worth) at 10 second intervals.

2. Index streams don't seem to be supported for MPEG 2 TS streams

3. The index entries seem to claim every frame is a B-Frame.  Possible
firmware bug.

4. The cx18 driver does not try to capture an index stream when inserting
sliced VBI into the MPEg stream as the offsets would need fixup.

Signed-off-by: Andy Walls <awalls@radix.net>
Signed-off-by: Mauro Carvalho Chehab <mchehab@redhat.com>
2010-02-26 15:10:30 -03:00
Andy Walls ef99179710 V4L/DVB (13907): cx18: Perform automatic rotation of very old, unread IDX buffers
According to the v4l2 spec, very old MPEG index entries needs to be discarded
in favor of newer index entries.  This change ensures the firmware always has
buffers for index entries at the expense of the oldest unread buffers.

Signed-off-by: Andy Walls <awalls@radix.net>
Signed-off-by: Mauro Carvalho Chehab <mchehab@redhat.com>
2010-02-26 15:10:30 -03:00
Andy Walls 79f3e96018 V4L/DVB (13906): cx18: Start IDX streams automatically as an internal associated stream
This change starts the IDX stream along with the MPG stream as an internal
use (only) stream much like the VBI stream can be started as an internal use
stream for inserting sliced VBI packets.

The IDX stream is not started automatically with an MPEG strem if the IDX
stream is disabled (no buffers allocated) or if sliced VBI insertion is being
performed by the cx18 driver.  The cx18 driver doing sliced VBI insertion
makes the offsets in the IDX stream inaccurate for the final MPEG stream
presented to user space.  Since fixing the IDX offsets ourselves is not easy
and we cannot easily do what ivtv does to fix the offsets, we'll make sliced
VBI insertion and MPEG Index capture mutually exclusive for now.

Signed-off-by: Andy Walls <awalls@radix.net>
Signed-off-by: Mauro Carvalho Chehab <mchehab@redhat.com>
2010-02-26 15:10:30 -03:00
Andy Walls e46c54a87e V4L/DVB (13905): cx18: Allow MPEG index streams to be started and stopped internally
This change allows the IDX stream to be started and stopped as any other
stream even though it has no associated device node.  This is needed for
cx18 driver internal use.

Also always tell the CX23418 to generate index entries when an analog capture
starts and the IDX stream has had buffers allocated (i.e. is enabled).

Signed-off-by: Andy Walls <awalls@radix.net>
Signed-off-by: Mauro Carvalho Chehab <mchehab@redhat.com>
2010-02-26 15:10:29 -03:00
Andy Walls 7b1dde0331 V4L/DVB (13904): cx18: Fix TS and IDX stream buffer memory leak on module unload
Fix a long standing memory leak of stream buffers for streams that did not
have a struct video_device allocated: namely the TS and IDX streams.

Signed-off-by: Andy Walls <awalls@radix.net>
Signed-off-by: Mauro Carvalho Chehab <mchehab@redhat.com>
2010-02-26 15:10:29 -03:00
Andy Walls 540bab93b7 V4L/DVB (13903): cx18: Encapsulate check for a stream being enabled into an inline function
Signed-off-by: Andy Walls <awalls@radix.net>
Signed-off-by: Mauro Carvalho Chehab <mchehab@redhat.com>
2010-02-26 15:10:29 -03:00
Andy Walls efc0b127b2 V4L/DVB (13902): cx18: Update MPEG Index stream buffers module option processing
Update the module options related to INDEX stream buffer allocation.  A single
CX2341[5678] index entry is only 24 bytes.  Large buffers for the IDX stream
will prevent the CX23418 from transferring index data over at all.  Buffers
of around 1.5 kB or 64 index entries seem to be just fine.  We'll default to
63 buffers/MDLs as that is the firmware limit per stream and IDX stream buffers
are not high rate.  There is no reason on earth to allocate the previous 1 MB
default of buffer space for the IDX stream.

This is in anticipation of implementing the G_ENC_INDEX ioctl() in the cx18
driver.

Signed-off-by: Andy Walls <awalls@radix.net>
Signed-off-by: Mauro Carvalho Chehab <mchehab@redhat.com>
2010-02-26 15:10:29 -03:00
Laurent Pinchart 50462eb065 V4L/DVB (13555): v4l: Use video_device_node_name() instead of the minor number
Instead of using the minor number in kernel log messages, use the device
node name as returned by the video_device_node_name() function. This
makes debug, informational and error messages easier to understand for
end users.

[mchehab.redhat.com: removed tm6000 changes as tm6000 is not ready yet for submission even on staging]

Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab@redhat.com>
2009-12-16 00:17:57 -02:00
Laurent Pinchart 38c7c03603 V4L/DVB (13550): v4l: Use the new video_device_node_name function
Fix all device drivers to use the new video_device_node_name function.

This also strips kernel log messages from the "/dev/" prefix, has the device
node location is a userspace policy decision unknown to the kernel.

Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab@redhat.com>
2009-12-16 00:17:55 -02:00
Linus Torvalds 3e74683137 Merge branch 'for_linus' of git://git.kernel.org/pub/scm/linux/kernel/git/mchehab/linux-2.6
* 'for_linus' of git://git.kernel.org/pub/scm/linux/kernel/git/mchehab/linux-2.6: (345 commits)
  V4L/DVB (13542): ir-keytable: Allow dynamic table change
  V4L/DVB (13541): atbm8830: replace 64-bit division and floating point usage
  V4L/DVB (13540): ir-common: Cleanup get key evdev code
  V4L/DVB (13539): ir-common: add __func__ for debug messages
  V4L/DVB (13538): ir-common: Use a dynamic keycode table
  V4L/DVB (13537): ir: Prepare the code for dynamic keycode table allocation
  V4L/DVB (13536): em28xx: Use the full RC5 code on HVR-950 Remote Controller
  V4L/DVB (13535): ir-common: Add a hauppauge new table with the complete RC5 code
  V4L/DVB (13534): ir-common: Remove some unused fields/structs
  V4L/DVB (13533): ir: use dynamic tables, instead of static ones
  V4L/DVB (13532): ir-common: Add infrastructure to use a dynamic keycode table
  V4L/DVB (13531): ir-common: rename the debug routine to allow exporting it
  V4L/DVB (13458): go7007: subdev conversion
  V4L/DVB (13457): s2250: subdev conversion
  V4L/DVB (13456): s2250: Change module structure
  V4L/DVB (13528): em28xx: add support for em2800 VC211A card
  em28xx: don't reduce scale to half size for em2800
  em28xx: don't load audio modules when AC97 is mis-detected
  em28xx: em2800 chips support max width of 640
  V4L/DVB (13523): dvb-bt8xx: fix compile warning
  ...

Fix up trivial conflicts due to spelling fixes from the trivial tree in
	Documentation/video4linux/gspca.txt
	drivers/media/video/cx18/cx18-mailbox.h
2009-12-09 19:50:49 -08:00
Hans Verkuil 7f3ea4debb V4L/DVB (13478): cx18: remove bogus init call.
The cx18 av core implemented an init call for no good reason. It's now
turned into an internal function.

Signed-off-by: Hans Verkuil <hverkuil@xs4all.nl>
Reviewed-by: Andy Walls <awalls@radix.net>
Signed-off-by: Mauro Carvalho Chehab <mchehab@redhat.com>
2009-12-05 18:42:05 -02:00
Andy Walls 8352619043 V4L/DVB (13445): cx18: Use per cx18 instance init data for ir-kbd-i2c instead of const data
This change creates per cx18 instances of IR_i2c_init_data for handing over
initialization data to ir-kbd-i2c, since that module wants non-const data
even though it never modifies the data.

Signed-off-by: Andy Walls <awalls@radix.net>
Signed-off-by: Mauro Carvalho Chehab <mchehab@redhat.com>
2009-12-05 18:41:57 -02:00
Andy Walls 543ae45a7f V4L/DVB (13434): cx18: Bump version number due to significant buffer handling changes.
Signed-off-by: Andy Walls <awalls@radix.net>
Signed-off-by: Mauro Carvalho Chehab <mchehab@redhat.com>
2009-12-05 18:41:54 -02:00
Andy Walls ad689d54f9 V4L/DVB (13433): cx18: Remove duplicate list traversal when processing incoming MDLs
Update the incoming MDL's buffers' bytesused and sync the buffers for the cpu
in one pass instead of two.

Signed-off-by: Andy Walls <awalls@radix.net>
Signed-off-by: Mauro Carvalho Chehab <mchehab@redhat.com>
2009-12-05 18:41:53 -02:00
Andy Walls 127ce5f0ad V4L/DVB (13432): cx18: Adjust encoder VBI MDL size to be exactly frame's worth of VBI data
Signed-off-by: Andy Walls <awalls@radix.net>
Signed-off-by: Mauro Carvalho Chehab <mchehab@redhat.com>
2009-12-05 18:41:53 -02:00
Andy Walls 1047a83844 V4L/DVB (13431): cx18: Adjust an MDL's final buffer size to force encoder transfer size
The encoder was not honoring the MDL size sent in DE_SET_MDL mailbox commands.
This change adjusts the size of the last buffer in an MDL, as reported to the
firmware, so that the encoder will send the exact amount of bytes we specify
per MDL transfer.  This eliminates tearing in YUV playback when using
non-default YUV buffer sizes.

Signed-off-by: Andy Walls <awalls@radix.net>
Signed-off-by: Mauro Carvalho Chehab <mchehab@redhat.com>
2009-12-05 18:41:52 -02:00
Andy Walls 22dce188ef V4L/DVB (13430): cx18: Fix YUV capture so that encoder passes a single frame per transfer
Fix YUV capture such that the encoder will pass one frame per transfer.  This
will allow the application to maintain frame alignment when a transfer from
the encoder is missed due to high system latency in service the CX23418 IRQ.

Also force YUV buffer sizes to be specified in multiples of 33.75 kB, the
smalled amount of buffer sizes need to store a complete set of HM12 4:2:0
macroblocks specifying 32 lines of the frame.  A full 60Hz/525 line
screen requires 15 * 33.75 kB per frame and a full 50Hz/625 line screen
requires 18 * 33.75 kB per frame so the default buffer size is 3 * 33.75 kB,
requiring exactly 5 or 6 buffers per MDL respectively.  The bytes needed per
frame and hence MDL need not be the bytes in an integer number of buffers.
However, if frame artifacts are seen with scaled screen sizes, the YUV buffer
size can be set 34 kB (33.75 kB) to get rid of the artifacts at the cost of more
copies between the kernel and userspace.

Signed-off-by: Andy Walls <awalls@radix.net>
Signed-off-by: Mauro Carvalho Chehab <mchehab@redhat.com>
2009-12-05 18:41:52 -02:00
Andy Walls 52fcb3ecc6 V4L/DVB (13429): cx18: Add Memory Descriptor List (MDL) layer to buffer handling
Add a Memory Descriptor List (MDL) layer to buffer handling to implement
scatter-gather I/O.  Currently there is still only 1 buffer per MDL.

Signed-off-by: Andy Walls <awalls@radix.net>
Signed-off-by: Mauro Carvalho Chehab <mchehab@redhat.com>
2009-12-05 18:41:51 -02:00
Andy Walls fa655dda5c V4L/DVB (13428): cx18: Rename mdl_offset to mdl_base_idx or free_mdl_idx as appropriate
Signed-off-by: Andy Walls <awalls@radix.net>
Signed-off-by: Mauro Carvalho Chehab <mchehab@redhat.com>
2009-12-05 18:41:51 -02:00
Andy Walls c37b11bf17 V4L/DVB (13427): cx18: Rename struct cx18_queue.buffers to struct cx18_queue.depth
Signed-off-by: Andy Walls <awalls@radix.net>
Signed-off-by: Mauro Carvalho Chehab <mchehab@redhat.com>
2009-12-05 18:41:51 -02:00
Andy Walls f0076e60b5 V4L/DVB (13426): cx18: Rename struct cx18_mdl to struct cx18_mdl_ent
Rename type in anticipation of implementing a struct cx18_mdl type that
actually keeps track of a memory descriptor list.

Signed-off-by: Andy Walls <awalls@radix.net>
Signed-off-by: Mauro Carvalho Chehab <mchehab@redhat.com>
2009-12-05 18:41:50 -02:00
Devin Heitmueller 48c511ed67 V4L/DVB (13331): mxl5005s: provide ability to override QAM gain for HVR-1600
The HVR-1600 doesn't use the standard mechanism for computing the gain when
in QAM mode, instead always forcing it to be 0x02.  Provide the ability to
override the algorithm on a per-board basis.

This change results in an improvement of 0.4-0.6 dB for QAM tuning.

This work was sponsored by ONELAN Limited.

Cc: Steven Toth <stoth@kernellabs.com>
Signed-off-by: Devin Heitmueller <dheitmueller@kernellabs.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab@redhat.com>
2009-12-05 18:41:23 -02:00
Devin Heitmueller af5c8e1523 V4L/DVB (13329): s5h1409: provide HVR-1600 specific optimizations
Perform some optimization of the register configuration based on a trace
of the HVR-1600 Windows i2c traffic (and consultation with Steven Toth).
Note that some of these values may be able to be moved into the common driver,
but I am holding off on that until they can be tested with other boards.

This work was sponsored by ONELAN Limited.

Cc: Steven Toth <stoth@kernellabs.com>
Signed-off-by: Devin Heitmueller <dheitmueller@kernellabs.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab@redhat.com>
2009-12-05 18:41:22 -02:00
Peter Huewe 9710e7a77a V4L/DVB (13288): adding __init/__exit macros to various drivers
Trivial patch which adds the __init/__exit macros to the module_init/
module_exit functions of the following drivers in media video:
    drivers/media/video/ivtv/ivtv-driver.c
    drivers/media/video/cx18/cx18-driver.c
    drivers/media/video/davinci/dm355_ccdc.c
    drivers/media/video/davinci/dm644x_ccdc.c
    drivers/media/video/saa7164/saa7164-core.c
    drivers/media/video/saa7134/saa7134-core.c
    drivers/media/video/cx23885/cx23885-core.c

Cc: Hermann Pitton <hermann-pitton@arcor.de>
Acked-by: Steven Toth <stoth@kernellabs.com>
Signed-off-by: Peter Huewe <peterhuewe@gmx.de>
Acked-by: Andy Walls <awalls@radix.net>
Acked-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
Acked-by: Muralidharan Karicheri <m-karicheri2@ti.com>
Signed-off-by: Douglas Schilling Landgraf <dougsland@redhat.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab@redhat.com>
2009-12-05 18:41:12 -02:00
Adam Buchbinder 6070d81eb5 tree-wide: fix misspelling of "definition" in comments
"Definition" is misspelled "defintion" in several comments; this
patch fixes them. No code changes.

Signed-off-by: Adam Buchbinder <adam.buchbinder@gmail.com>
Signed-off-by: Jiri Kosina <jkosina@suse.cz>
2009-12-04 23:41:47 +01:00
Peter Huewe 9d440a087b media/video: add __init/__exit macros to various drivers
Trivial patch which adds the __init/__exit macros to the module_init/
module_exit functions of the following drivers in media video:
    drivers/media/video/ivtv/ivtv-driver.c
    drivers/media/video/cx18/cx18-driver.c
    drivers/media/video/davinci/dm355_ccdc.c
    drivers/media/video/davinci/dm644x_ccdc.c
    drivers/media/video/saa7164/saa7164-core.c
    drivers/media/video/saa7134/saa7134-core.c
    drivers/media/video/cx23885/cx23885-core.c

Signed-off-by: Peter Huewe <peterhuewe@gmx.de>
Acked-by: Andy Walls <awalls@radix.net>
Acked-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
Acked-by: Muralidharan Karicheri <m-karicheri2@ti.com>
Acked-By: Steven Toth <stoth@kernellabs.com>
Signed-off-by: Jiri Kosina <jkosina@suse.cz>
2009-11-09 09:40:58 +01:00
Hans Verkuil 6b5270d212 V4L/DVB (12725): v4l: warn when desired devnodenr is in use & add _no_warn function
Warn when the desired device node number is already in use, except when
the new video_register_device_no_warn function is called since in some
use-cases that warning is not relevant.

Signed-off-by: Hans Verkuil <hverkuil@xs4all.nl>
Signed-off-by: Mauro Carvalho Chehab <mchehab@redhat.com>
2009-09-19 00:19:34 -03:00
Hans Verkuil 581644d9c9 V4L/DVB (12723): ivtv/cx18: replace 'kernel number' with 'device node number'.
Signed-off-by: Hans Verkuil <hverkuil@xs4all.nl>
Signed-off-by: Mauro Carvalho Chehab <mchehab@redhat.com>
2009-09-19 00:19:29 -03:00
Hans Verkuil 53dacb1570 V4L/DVB (12540): v4l: simplify v4l2_i2c_new_subdev and friends
Rewrite v4l2_i2c_new_subdev as a simplified version of v4l2_i2c_new_subdev_cfg
and remove v4l2_i2c_new_probed_subdev and v4l2_i2c_new_probed_subdev_addr.

This simplifies this API substantially.

Signed-off-by: Hans Verkuil <hverkuil@xs4all.nl>
Signed-off-by: Mauro Carvalho Chehab <mchehab@redhat.com>
2009-09-19 00:19:24 -03:00
Andy Walls 958411bc48 V4L/DVB (12884): cx18: Eliminate warning about discarding 'const' is assignment for IR init
i2c-kbd-i2c allows a bridge driver to pass information about IR configuration,
but uses a "void *" to pass along what is essentially constant data.  This
change casts a const * to a void * to remove the warning.

Signed-off-by: Andy Walls <awalls@radix.net>
Signed-off-by: Mauro Carvalho Chehab <mchehab@redhat.com>
2009-09-19 00:14:07 -03:00
Andy Walls 78f2e672b3 V4L/DVB (12699): cx18: ir-kbd-i2c initialization data should point to a persistent object
ir-kbd-i2c's ir_probe() function can be called much later (i.e. at ir-kbd-i2c
module load), than the lifetime of a struct IR_i2c_init_data allocated off of
the stack in cx18_i2c_new_ir() at registration time.  Make sure we pass
a pointer to a persistent IR_i2c_init_data object at i2c registration time.

Thanks to Brian Rogers for pointing out a solution, and Dustin Mitchell for
testing against a 2.6.30 kernel.

Reported-by: Dustin Mitchell <soxslayer@gmail.com>
Reported-by: Brian Rogers <brian@xyzw.org>
Tested-by: Dustin Mitchell <soxslayer@gmail.com>
Signed-off-by: Andy Walls <awalls@radix.net>
Signed-off-by: Mauro Carvalho Chehab <mchehab@redhat.com>
2009-09-12 12:20:15 -03:00
Mauro Carvalho Chehab 715a223323 V4L/DVB (12595): common/ir: use a struct for keycode tables
Currently, V4L uses a scancode table whose index is the scancode and
the value is the keycode. While this works, it has some drawbacks:

1) It requires that the scancode to be at the range 00-7f;

2) keycodes should be masked on 7 bits in order for it to work;

3) due to the 7 bits approach, sometimes it is not possible to replace
the default keyboard to another one with a different encoding rule;

4) it is different than what is done with dvb-usb approach;

5) it requires a typedef for it to work. This is not a recommended
Linux CodingStyle.

This patch is part of a larger series of IR changes. It basically
replaces the IR_KEYTAB_TYPE tables by a structured table:
struct ir_scancode {
       u16     scancode;
       u32     keycode;
};

This is very close to what dvb does. So, a further integration with DVB
code will be easy.

While we've changed the tables, for now, the IR keycode handling is still
based on the old approach.

The only notable effect is the redution of about 35% of the ir-common
module size:

   text    data     bss     dec     hex filename
   6721   29208       4   35933    8c5d old/ir-common.ko
   5756   18040       4   23800    5cf8 new/ir-common.ko

In thesis, we could be using above u8 for scancode, reducing even more the size
of the module, but defining it as u16 is more convenient, since, on dvb, each
scancode has up to 16 bits, and we currently have a few troubles with rc5, as their
scancodes are defined with more than 8 bits.

This patch itself shouldn't be doing any functional changes.

Signed-off-by: Mauro Carvalho Chehab <mchehab@redhat.com>
2009-09-12 12:19:47 -03:00
Andy Walls 8ca955689a V4L/DVB (12367): cx18: Add i2c initialization for Z8F0811/Hauppage IR transceivers
This patch add support to the cx18 driver for setting up the
Z8F0811/Hauppauge IR Tx/Rx chip with the i2c binding model in newer
kernels.

Signed-off-by: Andy Walls <awalls@radix.net>
Reviewed-by: Jean Delvare <khali@linux-fr.org>
Signed-off-by: Douglas Schilling Landgraf <dougsland@redhat.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab@redhat.com>
2009-09-12 12:18:25 -03:00
Jean Delvare e81516c58e V4L/DVB (12343): Stop defining I2C adapter IDs nobody uses
There is no point in defining I2C adapter IDs when no code is using
them. As this field might go away in the future, stop using it when
we don't need to.

Signed-off-by: Jean Delvare <khali@linux-fr.org>
Signed-off-by: Mauro Carvalho Chehab <mchehab@redhat.com>
2009-09-12 12:18:13 -03:00
Andy Walls 25a42e4d4a V4L/DVB (12207): cx18: Add an EEPROM dump routine for the Yuan MPC718 and future cards
Add a routine for dumping the EEPROM of the MPC718.  It is generic enough
to use for other cards in the future that may have an EEPROM.

Signed-off-by: Andy Walls <awalls@radix.net>
Signed-off-by: Mauro Carvalho Chehab <mchehab@redhat.com>
2009-09-12 12:17:26 -03:00
Roel Kluin de81c3c3f5 V4L/DVB (12199): remove redundant tests on unsigned
input, inp and i are unsigned. When negative they are wrapped and caught by the
other test.

Cc: Andy Walls <awalls@radix.net>
Signed-off-by: Roel Kluin <roel.kluin@gmail.com>
Signed-off-by: Douglas Schilling Landgraf <dougsland@redhat.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab@redhat.com>
2009-09-12 12:17:23 -03:00
Joe Perches 32a60955fb V4L/DVB (12196): cx18-fileops.c: Remove unnecessary semicolons
Signed-off-by: Joe Perches <joe@perches.com>
Acked-by: Andy Walls <awalls@radix.net>
Signed-off-by: Douglas Schilling Landgraf <dougsland@redhat.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab@redhat.com>
2009-09-12 12:17:22 -03:00
Andy Walls 225aeb1c58 V4L/DVB (12338): cx18: Read buffer overflow
This mistakenly tested against sizeof(freqs) instead of the array size. Due to
the mask the only illegal value possible was 3.

Reported-by: Roel Kluin <roel.kluin@gmail.com>
Signed-off-by: Andy Walls <awalls@radix.net>
Signed-off-by: Mauro Carvalho Chehab <mchehab@redhat.com>
2009-08-13 20:39:02 -03:00
Andy Walls ff861fb21e V4L/DVB (12182): cx18: Add DVB-T support for Yuan MPC-718 cards with an MT352 or ZL10353
Add DVB-T support for Yuan MPC-718 cards with an MT352 or ZL10353 demodulator.

There are apparently some units with a DiBcom demodulator which could be
supported by one of the dib7000 modules - but this is not implemented in the
cx18 driver (yet).

Due to lack of porgramming details for the MT352 and the mt352 module requiring
a "demod_init" function, a "firmware" must be obtained and loaded to get
DVB-T working for Yuan MPC-718 cards with an MT352.

Tested-by: Steve Firth <firth650@btinternet.com>
Signed-off-by: Andy Walls <awalls@radix.net>
Signed-off-by: Mauro Carvalho Chehab <mchehab@redhat.com>
2009-07-05 14:29:59 -03:00
Andy Walls 637fb3d70b V4L/DVB (12180): cx18: Update Yuan MPC-718 card entry with better information and guesses
Signed-off-by: Andy Walls <awalls@radix.net>
Signed-off-by: Mauro Carvalho Chehab <mchehab@redhat.com>
2009-07-05 14:29:58 -03:00
Hans Verkuil c6711c3e6d V4L/DVB (12104): ivtv/cx18: fix regression: class controls are no longer seen
A previous change (v4l2-common: remove v4l2_ctrl_query_fill_std) broke
the handling of class controls in VIDIOC_QUERYCTRL. The MPEG class control
was broken for all drivers that use the cx2341x module and the USER class
control was broken for ivtv and cx18.

This change adds back proper class control support.

Signed-off-by: Hans Verkuil <hverkuil@xs4all.nl>
Signed-off-by: Mauro Carvalho Chehab <mchehab@redhat.com>
2009-06-23 03:14:31 -03:00
Andy Walls 8bb09db375 V4L/DVB (11951): cx18: Add DVB-T support for the Leadtek WinFast DVR3100 H
This adds support for DVB-T on the Leadtek DVR3100 H and should also get analog
TV capture from the tuner working properly as well.

DVB-T 6 MHz and 8 MHz have been tested and verified to work by Terry Wu of
Leadtek.  DVB-T 7 MHz has also been verified working with a change developed by
Terry to the tuner-xc2028.c driver.

Special thanks go to Terry Wu <terrywu2009@gmail.com> of Leadtek who provided
the needed information and testing to get digital TV working for the Leadtek
DVR3100 H.

Reported-by: Terry Wu <terrywu2009@gmail.com>
Tested-by: Terry Wu <terrywu2009@gmail.com>
Signed-off-by: Andy Walls <awalls@radix.net>
Signed-off-by: Mauro Carvalho Chehab <mchehab@redhat.com>
2009-06-16 19:07:33 -03:00
Andy Walls 9d5af86292 V4L/DVB (11950): cx18: Split LeadTek PVR2100 and DVR3100 H into 2 separate card entries
Signed-off-by: Andy Walls <awalls@radix.net>
Signed-off-by: Mauro Carvalho Chehab <mchehab@redhat.com>
2009-06-16 19:07:33 -03:00
Andy Walls 9ad4c6551b V4L/DVB (11898): cx18: Perform 64 bit divide so it works for 32 bit systems
Thanks to David Ward and Mike Krufky for reporting the problem and
debugging this as an unresolved symbol due to a 64 bit divide on a 32 bit
system.  David Ward provided the content of this patch; Andy Walls only
performed some cosmetic edits.

Reported-by: David Ward <david.ward@gatech.edu>
Signed-off-by: David Ward <david.ward@gatech.edu>
Signed-off-by: Andy Walls <awalls@radix.net>
Signed-off-by: Mauro Carvalho Chehab <mchehab@redhat.com>
2009-06-16 18:21:16 -03:00
Andy Walls 86bc85b386 V4L/DVB (11865): cx18: Tweak color burst gate delay and initial color sub-carrier freq
Fix the burst gate delays to use a crystal value of 28636360 as assumed by
the rest of the driver.  Also have the initial color sub-carrier freq paramter
use the src decimation ratio per the documentation, instead of the actual
crystal/pixel clock ratio.  The tracking circuit will find the correct color
subcarrier in any case, as long as we're close.  Also fix up some debug print
statements.

Signed-off-by: Andy Walls <awalls@radix.net>
Signed-off-by: Mauro Carvalho Chehab <mchehab@redhat.com>
2009-06-16 18:21:14 -03:00
Andy Walls 929a3ad152 V4L/DVB (11864): cx18: Complete support for Sliced and Raw VBI for 625 line systems
Finish changes for sliced and raw VBI for 625 line systems.  Tested with VPS
and WSS being emitted by a PVR-350 in field 1 lines 16 and 23.

Signed-off-by: Andy Walls <awalls@radix.net>
Signed-off-by: Mauro Carvalho Chehab <mchehab@redhat.com>
2009-06-16 18:21:14 -03:00
Andy Walls 5ab740522f V4L/DVB (11863): cx18: Initial attempt to get sliced VBI working for 625 line systems
Initial changes to get sliced VBI for 625 line system working.  This is patch
is untested.

Signed-off-by: Andy Walls <awalls@radix.net>
Signed-off-by: Mauro Carvalho Chehab <mchehab@redhat.com>
2009-06-16 18:21:14 -03:00
Andy Walls 4442ee8bdd V4L/DVB (11752): cx18: Add missing newline to tuner detection error message
Signed-off-by: Andy Walls <awalls@radix.net>
Signed-off-by: Mauro Carvalho Chehab <mchehab@redhat.com>
2009-06-16 18:21:00 -03:00
Andy Walls f4672dffa1 V4L/DVB (11703): cx18: Have audio decoder drive SIF gain control, and rework AFE config
Ensure the variable gain amplifier gain for SIF is driven by the audio deocder
and not the video decoder.  This forced rework of the analog front end (AFE)
configuration to not rely on autoconfiguration, but instead set up the AFE mux,
AFE parameters, and ADC1 & ADC2 configurations explicitly.

Reported-by: Helen Buus <mythtv@hbuus.com>
Signed-off-by: Andy Walls <awalls@radix.net>
Signed-off-by: Mauro Carvalho Chehab <mchehab@redhat.com>
2009-06-16 18:20:54 -03:00
Andy Walls 33b55a0a7d V4L/DVB (11624): cx18: Toggle the AI1 mux when changing the CX18_AUDIO_ENABLE register
Toggle the AI1 mux when changing the CX18_AUDIO_ENABLE register.  It's hard to
reliably tell when we have written to this register successfully unless we
change some bits we know we can read back.  The AI mux bits always read back
what we wrote to them, so force them to toggle whenever we have to write to
the register, so we can tell we wrote to the register successfully.

This change was prompted by users experiencing broadcast audio decoding
problems after the cx18 module loads for the first time.

Signed-off-by: Andy Walls <awalls@radix.net>
Signed-off-by: Mauro Carvalho Chehab <mchehab@redhat.com>
2009-06-16 18:20:45 -03:00
Andy Walls 1bd8e15ac3 V4L/DVB (11623): cx18: Verify cx18-av-core digitizer firmware loads correctly
Add code to verify the cx18-av-core digitizer firmware loads correctly.  The
verification function reads back and compares the firmware bytes loaded
into the A/V core.  The result of the verification is only used to log a
message in the system log.

This change was prompted by users with multiple card setups that have problems
with broadcast audio decoding the first time the cx18 module is loaded.

Signed-off-by: Andy Walls <awalls@radix.net>
Signed-off-by: Mauro Carvalho Chehab <mchehab@redhat.com>
2009-06-16 18:20:45 -03:00
Andy Walls 0c62925229 V4L/DVB (11622): cx18: Allow IVTV format VBI insertion in MPEG-2 SVCD and DVD streams
Both the MPEG-2 SVCD stream format and the MPEG-2 DVD stream format should
use an MPEG-2 PS container.  This makes it safe to stuff IVTV Private Stream 1
VBI packets in these stream types using the existing cx18 driver routines.

Reported-by: Helen Buus <mythtv@hbuus.com>
Signed-off-by: Andy Walls <awalls@radix.net>
Signed-off-by: Mauro Carvalho Chehab <mchehab@redhat.com>
2009-06-16 18:20:45 -03:00
Andy Walls 9982be8a14 V4L/DVB (11620): cx18: Increment version due to significant buffer handling changes
Version bump from 1.1.0 to 1.2.0

Signed-off-by: Andy Walls <awalls@radix.net>
Signed-off-by: Mauro Carvalho Chehab <mchehab@redhat.com>
2009-06-16 18:20:45 -03:00
Andy Walls 21a278b85d V4L/DVB (11619): cx18: Simplify the work handler for outgoing mailbox commands
Simplify the way outgoing work handler gets scheduled to send empty buffers
back to the firmware for use.  Also reduced the memory required for scheduling
this outgoing work, by using a single, per stream work object.

Signed-off-by: Andy Walls <awalls@radix.net>
Signed-off-by: Mauro Carvalho Chehab <mchehab@redhat.com>
2009-06-16 18:20:44 -03:00
Andy Walls 40c5520f55 V4L/DVB (11618): cx18: Convert per stream mutex locks to per queue spin locks
To avoid sleeps in providing buffers to user space and in handling incoming
buffers from the capture unit, converted the per stream mutex for locking
queues to 3 spin locks.  There is now a spin lock per queue
to increase concurrency when moving buffers around.

Also simplified queue manipulations and buffer handling of incoming buffers
of data from the capture unit.

Signed-off-by: Andy Walls <awalls@radix.net>
Signed-off-by: Mauro Carvalho Chehab <mchehab@redhat.com>
2009-06-16 18:20:44 -03:00
Andy Walls 5f0a3cfcfd V4L/DVB (11617): cx18: Set up to wait for a one-shot response before sending a firmware cmd
When sending an outgoing firmware command, prepare to wait before we raise the
interrupt, so we don't miss the wake_up() on the acknowledgment.  When waiting
for the acknowledgement, there is no need to loop around schedule(), as there
will only be one interrupt, and hence one wake_up(), issued.

Signed-off-by: Andy Walls <awalls@radix.net>
Signed-off-by: Mauro Carvalho Chehab <mchehab@redhat.com>
2009-06-16 18:20:44 -03:00
Andy Walls 8711615951 V4L/DVB (11616): cx18: Add a work queue for deferring empty buffer handoffs to the firmware
This change defers sending all CX18_CPU_DE_SET_MDL commands, for a stream with
an ongoing capture, by adding a work queue to handle sending such commands when
needed.  This prevents any sleeps, caused by notifying the firmware of new
usable buffers, when a V4L2 application read() is being satisfied or when
an incoming buffer is processed by the cx18-NN-in work queue thread.

Signed-off-by: Andy Walls <awalls@radix.net>
Signed-off-by: Mauro Carvalho Chehab <mchehab@redhat.com>
2009-06-16 18:20:44 -03:00
Andy Walls deed75ed9f V4L/DVB (11615): cx18: Rename the work queue to "in_work_queue"
Rename the work queue to "in_work_queue" to indicate it is handling
incoming mailbox commands.  This is preparation for adding a work queue
for handling deferrable outgoing mailbox commands.

Signed-off-by: Andy Walls <awalls@radix.net>
Signed-off-by: Mauro Carvalho Chehab <mchehab@redhat.com>
2009-06-16 18:20:44 -03:00
Jean Delvare 272aa3966b V4L/DVB (11568): cx18: Fix the handling of i2c bus registration error
* Return actual error values as returned by the i2c subsystem, rather
  than 0 or 1.
* If the registration of the second bus fails, unregister the first one
  before exiting, otherwise we are leaking resources.

Signed-off-by: Jean Delvare <khali@linux-fr.org>
Acked-by: Andy Walls <awalls@radix.net>
Signed-off-by: Mauro Carvalho Chehab <mchehab@redhat.com>
2009-04-29 15:41:13 -03:00
Andy Walls 92ab9baee3 V4L/DVB (11494): cx18: Send correct input routing value to external audio multiplexers
A late v4l2_subdev framework change accidentally sent the audio input
routing value to the external multiplexer, instead of the muxer input routing
value to the external multiplexer.  This change corrects that error.

Signed-off-by: Andy Walls <awalls@radix.net>
Signed-off-by: Mauro Carvalho Chehab <mchehab@redhat.com>
2009-04-29 15:41:10 -03:00
Hans Verkuil 6c31e59836 V4L/DVB (11381): ivtv/cx18: remove VIDIOC_INT_S_AUDIO_ROUTING debug support.
Remove support for the debug call VIDIOC_INT_S_AUDIO_ROUTING from cx18
and ivtv. These internal ioctls shouldn't be exposed. These were only
used through the cx18-ctl and ivtv-ctl utilities, and only when testing
a new card variant.

This cleanup allows the removal of this ioctl from v4l2-common.h.

Cc: Andy Walls <awalls@radix.net>
Signed-off-by: Hans Verkuil <hverkuil@xs4all.nl>
Signed-off-by: Mauro Carvalho Chehab <mchehab@redhat.com>
2009-04-06 21:44:28 -03:00
Hans Verkuil 5325b4272a V4L/DVB (11380): v4l2-subdev: change s_routing prototype
It is no longer needed to use a struct pointer as argument, since v4l2_subdev
doesn't require that ioctl-like approach anymore. Instead just pass the input,
output and config (new!) arguments directly.

Signed-off-by: Hans Verkuil <hverkuil@xs4all.nl>
Signed-off-by: Mauro Carvalho Chehab <mchehab@redhat.com>
2009-04-06 21:44:27 -03:00
Hans Verkuil e6574f2fbe V4L/DVB (11373): v4l2-common: add explicit v4l2_device pointer as first arg to new_(probed)_subdev
The functions v4l2_i2c_new_subdev and v4l2_i2c_new_probed_subdev relied on
i2c_get_adapdata to return the v4l2_device. However, this is not always
possible on embedded platforms. So modify the API to pass the v4l2_device
pointer explicitly.

Signed-off-by: Hans Verkuil <hverkuil@xs4all.nl>
Signed-off-by: Mauro Carvalho Chehab <mchehab@redhat.com>
2009-04-06 21:44:24 -03:00
Hans Verkuil f41737ece4 V4L/DVB (11370): v4l2-subdev: move s_std from tuner to core.
s_std didn't belong in the tuner ops. Stricly speaking it should be part of
the video ops, but it is used by audio and tuner devices as well, so it is
more efficient to make it part of the core ops.

Signed-off-by: Hans Verkuil <hverkuil@xs4all.nl>
Signed-off-by: Mauro Carvalho Chehab <mchehab@redhat.com>
2009-04-06 21:44:22 -03:00
Hans Verkuil cc26b076cf V4L/DVB (11369): v4l2-subdev: add load_fw and use that instead of abusing core->init.
The init callback was used in several places to load firmware. Make a separate
load_fw callback for that. This makes the code a lot more understandable.

Signed-off-by: Hans Verkuil <hverkuil@xs4all.nl>
Signed-off-by: Mauro Carvalho Chehab <mchehab@redhat.com>
2009-04-06 21:44:21 -03:00
Hans Verkuil 41c129a870 V4L/DVB (11310): cx18: remove intermediate 'ioctl' step
The audio and vbi parts still used an 'ioctl'-like interface. Replace this
with normal functions.

Cc: Andy Walls <awalls@radix.net>
Signed-off-by: Hans Verkuil <hverkuil@xs4all.nl>
Signed-off-by: Mauro Carvalho Chehab <mchehab@redhat.com>
2009-03-30 12:43:49 -03:00
Mauro Carvalho Chehab 1398ae1fe6 V4L/DVB (11127): Kconfig: replace all occurrences of CUSTOMIZE to CUSTOMISE
There are several Kconfig items using CUSTOMIZE. Yet, most use the English
writing CUSTOMISE. This generates lots of trouble, because people sometimes type
the Kbuild item different.

Let's standardise every occurrence using the same syntax.

The changes were generated by this small shell script:

for i in `find linux -type f`; do sed s,CUSTOMIZE,CUSTOMISE,g $i >/tmp/a && mv /tmp/a $i; done

Signed-off-by: Mauro Carvalho Chehab <mchehab@redhat.com>
2009-03-30 12:43:31 -03:00
Andy Walls 4ab9b256b5 V4L/DVB (11092): cx18: Optimize processing of VBI buffers from the capture unit
Removed some unnecessary memcpy()'s by reworking the compress_*_vbi_buf()
functions.

Signed-off-by: Andy Walls <awalls@radix.net>
Signed-off-by: Mauro Carvalho Chehab <mchehab@redhat.com>
2009-03-30 12:43:28 -03:00
Andy Walls 6e1a637202 V4L/DVB (11091): cx18, ivtv: Ensure endianess for linemasks in VBI embedded in MPEG stream
The sliced VBI payloads that cx18 and ivtv would insert in the MPEG stream
did not have consistent endianess for the linemasks in the payload (a big
endian platform would write them out big endian).  This change ensures the
linemasks are always stored as little-endian in the MPEG stream to ensure
cross platform consistency in parsing the generated MPEG stream.

Signed-off-by: Andy Walls <awalls@radix.net>
Signed-off-by: Mauro Carvalho Chehab <mchehab@redhat.com>
2009-03-30 12:43:28 -03:00
Andy Walls 49a53750b2 V4L/DVB (10856): cx18: Add interlock so sliced VBI insertion only happens for an MPEG PS
The cx18 private packet insertion code only expects to operate on an MPEG PS
when inserting private packets of sliced VBI data.  This patch keeps the cx18
driver from corrupting the MPEG TS or other non-PS stream types, in case the
user enables sliced VBI insertion for these MPEG stream types.

Signed-off-by: Andy Walls <awalls@radix.net>
Signed-off-by: Mauro Carvalho Chehab <mchehab@redhat.com>
2009-03-30 12:43:09 -03:00
Andy Walls cb95a40e54 V4L/DVB (10855): cx18: Fix VPS service register codes
Based on a documentation clarification from Conexant, fix the register code
used for sliced VBI VPS service.

Signed-off-by: Andy Walls <awalls@radix.net>
Signed-off-by: Mauro Carvalho Chehab <mchehab@redhat.com>
2009-03-30 12:43:09 -03:00
Andy Walls af7c58b1f5 V4L/DVB (10854): cx18: Correct comments about vertical and horizontal blanking timings
This change only affects comments.

Signed-off-by: Andy Walls <awalls@radix.net>
Signed-off-by: Mauro Carvalho Chehab <mchehab@redhat.com>
2009-03-30 12:43:09 -03:00
Andy Walls 583803d135 V4L/DVB (10853): cx18: Fix s-parse warnings and a logic error about extracting the VBI PTS
My s-parse builds never griped about be32_to_cpu() casting to __be32, but Hans'
builds did.  This change explictly declares the pointer into the VBI buffer
header as __be32, which is the correct thing to do as the data is always
big endian when we go to fetch it.  Hopefully this will quiet s-parse warnings.
Also corrected a misplaced parenthesis logic error in checking for the VBI
header magic number.

Signed-off-by: Andy Walls <awalls@radix.net>
Signed-off-by: Mauro Carvalho Chehab <mchehab@redhat.com>
2009-03-30 12:43:09 -03:00
Andy Walls 386e439f0c V4L/DVB (10852): cx18: Include cx18-audio.h in cx18-audio.c to eliminate s-parse warning
Signed-off-by: Andy Walls <awalls@radix.net>
Signed-off-by: Mauro Carvalho Chehab <mchehab@redhat.com>
2009-03-30 12:43:09 -03:00
Andy Walls 72401b7a37 V4L/DVB (10851): cx18: Fix a video scaling check problem introduced by sliced VBI changes
Fix a scaling check that was failing, due to a magic number I missed fixing
during previous slice VBI changes.  Now

  $ v4l2-ctl -v width=480,height=480,pixelformat=MPEG

yields proper visual results again.

Signed-off-by: Andy Walls <awalls@radix.net>
Signed-off-by: Mauro Carvalho Chehab <mchehab@redhat.com>
2009-03-30 12:43:09 -03:00
Andy Walls 098003d8e2 V4L/DVB (10850): cx18: Use strlcpy() instead of strncpy() for temp eeprom i2c_client setup
Signed-off-by: Andy Walls <awalls@radix.net>
Signed-off-by: Mauro Carvalho Chehab <mchehab@redhat.com>
2009-03-30 12:43:09 -03:00
Andy Walls 006e717957 V4L/DVB (10764): cx18: Disable AC3 controls as the firmware doesn't support AC3
Signed-off-by: Andy Walls <awalls@radix.net>
Signed-off-by: Mauro Carvalho Chehab <mchehab@redhat.com>
2009-03-30 12:43:02 -03:00
Andy Walls f85953d324 V4L/DVB (10763): cx18: Increment version number due to significant changes for v4l2_subdevs
Driver is now at version 1.1.0.

Signed-off-by: Andy Walls <awalls@radix.net>
Signed-off-by: Mauro Carvalho Chehab <mchehab@redhat.com>
2009-03-30 12:43:02 -03:00
Andy Walls 8d037ed14d V4L/DVB (10762): cx18: Get rid of unused variables related to video output
Remove variables that were holdovers from ivtv for supporting the CX23415
MPEG decoder output.

Signed-off-by: Andy Walls <awalls@radix.net>
Signed-off-by: Mauro Carvalho Chehab <mchehab@redhat.com>
2009-03-30 12:43:02 -03:00
Andy Walls 6246d4e1b3 V4L/DVB (10761): cx18: Change log lines for internal subdevs and fix tveeprom reads
Give messages originating from internal subdevs a header using the subdev's
name.  Fixed an uninitialized variable problem with reading the EEPROM, noticed
from log output.  Got rid of the unused cx18_av_exit() function.

Signed-off-by: Andy Walls <awalls@radix.net>
Signed-off-by: Mauro Carvalho Chehab <mchehab@redhat.com>
2009-03-30 12:43:02 -03:00
Andy Walls 6da6bf5e43 V4L/DVB (10760): cx18: Fix a memory leak of buffers used for sliced VBI insertion
We leaked buffers every time a device was removed, if the user had enabled
sliced VBI insertion into the MPEG stream.  MythTV uses that.

Signed-off-by: Andy Walls <awalls@radix.net>
Signed-off-by: Mauro Carvalho Chehab <mchehab@redhat.com>
2009-03-30 12:43:01 -03:00
Andy Walls eefe1010a4 V4L/DVB (10759): cx18: Convert GPIO connected functions to act as v4l2_subdevices
Convert GPIO line functions, such a audio routing and device resets, to
v4l2_subdevices.  This essentially completes the conversion of cx18 to the
v4l2_device/v4l2_subdevice framework.  No regression testing has taken place as
of yet.  Also an ivtv legacy bug with GPIO mux routing and going to/from radio
mode was commented, but not fixed.

Signed-off-by: Andy Walls <awalls@radix.net>
Signed-off-by: Mauro Carvalho Chehab <mchehab@redhat.com>
2009-03-30 12:43:01 -03:00
Andy Walls ff2a200180 V4L/DVB (10758): cx18: Convert I2C devices to v4l2_subdevices
This is a major perturbation to cx18 I2C device handling to convert it to the
v4l2_device/subdeivce framework.  This change breaks GPIO audio multiplexer
control for the time being.  It will be fixed in a coming change.

Signed-off-by: Andy Walls <awalls@radix.net>
Signed-off-by: Mauro Carvalho Chehab <mchehab@redhat.com>
2009-03-30 12:43:01 -03:00
Andy Walls fa3e70360c V4L/DVB (10757): cx18, v4l2-chip-ident: Finish conversion of AV decoder core to v4l2_subdev
Added a new chip identifer to v4l2-chip-ident for the integrated A/V broadcast
decoder core internal to the CX23418.  Completed separation and encapsulation
of the A/V decoder core interface as a v4l2_subdevice.  The cx18 driver now
compiles and links again.

Signed-off-by: Andy Walls <awalls@radix.net>
Signed-off-by: Mauro Carvalho Chehab <mchehab@redhat.com>
2009-03-30 12:43:01 -03:00
Andy Walls 5811cf99df V4L/DVB (10756): cx18: Slim down instance handling, build names from v4l2_device.name
Convert card instance handling to a lighter weight mechanism like ivtv.
Also convert name strings and debug messages to use v4l2_device.name.

Signed-off-by: Andy Walls <awalls@radix.net>
Signed-off-by: Mauro Carvalho Chehab <mchehab@redhat.com>
2009-03-30 12:43:01 -03:00
Andy Walls 1a2670465e V4L/DVB (10755): cx18: Convert the integrated A/V decoder core interface to a v4l2_subdev
This is the next step in converting the cx18 driver to use the v4l2_device/
v4l2_subdevice framework.  This is a straightforward conversion of the
cx18_av_*[ch] files.  It compiles, but leaves the driver in an unlinkable
state at the moment.

Note, the cx18 integrated A/V digitizer will now make a host match at address 1,
as far as v4l2-dbg is concerned.  That means it identifies itself as a separate
"chip", and acts as an alias to the integrated A/V decoder registers that are
also available with the host match at address 0.

Signed-off-by: Andy Walls <awalls@radix.net>
[mchehab@redhat.com: fix merge conflicts due to the removal of v4l2_ctrl_query_fill_std()]
Signed-off-by: Mauro Carvalho Chehab <mchehab@redhat.com>
2009-03-30 12:43:01 -03:00
Hans Verkuil 10afbef15e V4L/DVB (10698): v4l2-common: remove v4l2_ctrl_query_fill_std
The v4l2_ctrl_query_fill_std() function wasn't one the best idea I ever had.
It doesn't add anything valuable that cannot be expressed equally well with
v4l2_ctrl_query_fill and only adds overhead.

Replace it with v4l2_ctrl_query_fill() everywhere it is used and remove it
from v4l2_common.c.

Signed-off-by: Hans Verkuil <hverkuil@xs4all.nl>
Signed-off-by: Mauro Carvalho Chehab <mchehab@redhat.com>
2009-03-30 12:42:54 -03:00
Hans Verkuil 2ba588942c V4L/DVB (10544): v4l2-common: add comments warning that about the sort order
Control arrays as are used with v4l2_ctrl_next must be sorted from
low to high. Add a comment at the top of all such arrays to warn
about this.

Signed-off-by: Hans Verkuil <hverkuil@xs4all.nl>
Signed-off-by: Mauro Carvalho Chehab <mchehab@redhat.com>
2009-03-30 12:42:46 -03:00
Hans Verkuil a4a787187b V4L/DVB (10486): ivtv/cx18: fix g_fmt and try_fmt for raw video
The raw video device didn't report the image size correctly.

When setting a new image the image height has to be a multiple of 32 lines.

Signed-off-by: Hans Verkuil <hverkuil@xs4all.nl>
Signed-off-by: Mauro Carvalho Chehab <mchehab@redhat.com>
2009-03-30 12:42:41 -03:00
Andy Walls 812b1f9d54 V4L/DVB (10446): cx18: Finally get sliced VBI working - for 525 line 60 Hz systems at least
Sliced VBI, in the manner that ivtv implements it as a separate data stream,
now works for 525 line 60 Hz systems like NTSC-M.  It may work for 625 line
50 Hz systems, but I have more engineering work to do, to verify it is operating
properly.  Sliced data insertion into the MPEG PS should be working, but is
untested.

Signed-off-by: Andy Walls <awalls@radix.net>
Signed-off-by: Mauro Carvalho Chehab <mchehab@redhat.com>
2009-03-30 12:42:39 -03:00
Andy Walls 466df46484 V4L/DVB (10445): cx18: Process Raw VBI on a whole frame basis; fix VBI buffer size
The cx23418 appears to send Raw VBI buffers with a PTS on a per frame
basis, not per field, so process Raw VBI on a whole frame basis and reduce
some complexity.  Fix VBI buffer size computation to handle a whole
frame of Raw VBI for a 625 line system, which is the worst case and will
work for 525 lines systems as well.

Signed-off-by: Andy Walls <awalls@radix.net>
Signed-off-by: Mauro Carvalho Chehab <mchehab@redhat.com>
2009-03-30 12:42:39 -03:00
Andy Walls 01cbc214cf V4L/DVB (10444): cx18: Fix sliced VBI PTS and fix artifacts in last raw line of field
Fixed an endianess problem with the collection of the PTS from
the VBI buffer given to us by the encoder.  Also extrapolated the
last 12 bytes of the last line of each field, to remove artifacts
created by removing the first 12 bytes of each field for raw VBI.

Signed-off-by: Andy Walls <awalls@radix.net>
Signed-off-by: Mauro Carvalho Chehab <mchehab@redhat.com>
2009-03-30 12:42:39 -03:00
Andy Walls f37aa51190 V4L/DVB (10443): cx18: Use correct line counts per field in firmware API call
The driver was incorrectly setting 0 line counts in a firmware
API call to set the maximum amount of lines per field.

Signed-off-by: Andy Walls <awalls@radix.net>
Signed-off-by: Mauro Carvalho Chehab <mchehab@redhat.com>
2009-03-30 12:42:39 -03:00
Andy Walls dcc0ef8820 V4L/DVB (10442): cx18: Fixes for enforcing when Encoder Raw VBI params can be set
The Encoder will only allow the Raw VBI parameters, along with a number of
other API parameters, to take effect when no analog captures are in
progress.  These parameters must be set before the first analog capture starts,
be it MPEG, VBI, YUV, etc., and cannot be changed until the last one stops.  It
is not obvious to me what capture channel API parameters are shared and which
ones must be set per capture channel, so set them all for every analog
capture channel start up.  This fixes the driver so that VBI capture can be
started up after the MPEG capture is going.

Signed-off-by: Andy Walls <awalls@radix.net>
Signed-off-by: Mauro Carvalho Chehab <mchehab@redhat.com>
2009-03-30 12:42:39 -03:00
Andy Walls c1994084d6 V4L/DVB (10441): cx18: Fix VBI ioctl() handling and Raw/Sliced VBI state management
More sliced VBI fixes to bring the cx18 driver closer to full V4L2 spec
compliance for VBI and to get sliced VBI working better.

Signed-off-by: Andy Walls <awalls@radix.net>
Signed-off-by: Mauro Carvalho Chehab <mchehab@redhat.com>
2009-03-30 12:42:38 -03:00
Andy Walls 776fa86988 V4L/DVB (10440): cx18: Fix presentation timestamp (PTS) for VBI buffers
The old code from ivtv used a CX23415/6 PTS, which was simply left at 0 in the
cx18 driver.  Since the CX23418 gives us what I think is a PTS (or some other
90 kHz clock count) with each VBI buffer, this change has the cx18 driver use
that as a PTS.

Signed-off-by: Andy Walls <awalls@radix.net>
Signed-off-by: Mauro Carvalho Chehab <mchehab@redhat.com>
2009-03-30 12:42:38 -03:00
Andy Walls 302df97021 V4L/DVB (10439): cx18: Clean-up and enable sliced VBI handling
Removed legacy ivtv state variables, added comments, and cleaned
up sliced VBI related code.  Enabled sliced VBI.

Signed-off-by: Andy Walls <awalls@radix.net>
Signed-off-by: Mauro Carvalho Chehab <mchehab@redhat.com>
2009-03-30 12:42:38 -03:00
Andy Walls 4325dff220 V4L/DVB (10437): cx18: Remove an unused spinlock
Signed-off-by: Andy Walls <awalls@radix.net>
Signed-off-by: Mauro Carvalho Chehab <mchehab@redhat.com>
2009-03-30 12:42:38 -03:00
Andy Walls 0b089742c7 V4L/DVB (10436): cx18: Fix coding style of a switch statement per checkpatch.pl
Signed-off-by: Andy Walls <awalls@radix.net>
Signed-off-by: Mauro Carvalho Chehab <mchehab@redhat.com>
2009-03-30 12:42:38 -03:00
Andy Walls d5c02f6b27 V4L/DVB (10435): cx18: Normalize APU after second APU firmware load
Signed-off-by: Andy Walls <awalls@radix.net>
Signed-off-by: Mauro Carvalho Chehab <mchehab@redhat.com>
2009-03-30 12:42:38 -03:00
Andy Walls 072e6183c2 V4L/DVB (10434): cx18: Smarter verification of CX18_AUDIO_ENABLE register writes
The CX18_AUDIO_ENABLE register usually never reads back what was just written
under normal circumstances.  Perform better checking that a write went to the
register as expected with a specification of what bits to verify.

Signed-off-by: Andy Walls <awalls@radix.net>
Signed-off-by: Mauro Carvalho Chehab <mchehab@redhat.com>
2009-03-30 12:42:38 -03:00
Andy Walls e474200d35 V4L/DVB (10433): cx18: Defer A/V core initialization until a valid cx18_av_cmd arrives
Signed-off-by: Andy Walls <awalls@radix.net>
Signed-off-by: Mauro Carvalho Chehab <mchehab@redhat.com>
2009-03-30 12:42:38 -03:00
Hans Verkuil de6476f5f6 V4L/DVB (10408): v4l2: fix incorrect hue range check
A hue of -128 was rejected due to an incorrect range check, which was
faithfully copy-and-pasted into four drivers...

Signed-off-by: Hans Verkuil <hverkuil@xs4all.nl>
Signed-off-by: Mauro Carvalho Chehab <mchehab@redhat.com>
2009-03-30 12:42:35 -03:00
Andy Walls 6ce9ee539c V4L/DVB (10284): cx18: Add initial entry for a Leadtek DVR3100 H hybrid card
Card report provided by Patryk on the ivtv-devel list:
http://ivtvdriver.org/pipermail/ivtv-devel/2009-January/005922.html

Reported-by: Pat <tatyrza@mm.pl>
Signed-off-by: Andy Walls <awalls@radix.net>
Signed-off-by: Mauro Carvalho Chehab <mchehab@redhat.com>
2009-03-30 12:42:25 -03:00
Andy Walls be411df610 V4L/DVB (10283): cx18: Call request_module() with proper argument types.
request_module() needs to be called with a string literal for a
format string or with 1 or more variable arguments to avoid
compiler warnings and possible exploits, if someone could cause
us to get a format string with a '%' code in the format string
when we make the call.

Reported-by: Brandon Jenkins <bcjenkins@tvwhere.com>
Signed-off-by: Andy Walls <awalls@radix.net>
Signed-off-by: Mauro Carvalho Chehab <mchehab@redhat.com>
2009-03-30 12:42:25 -03:00
Andy Walls 888cdb0774 V4L/DVB (10281): cx18: Conversion to new V4L2 framework: use v4l2_device object
First step in conversion to the new V4L2 framework.  Added per cx18 device
instance of the v4l2_device and its registration.

Signed-off-by: Andy Walls <awalls@radix.net>
Signed-off-by: Mauro Carvalho Chehab <mchehab@redhat.com>
2009-03-30 12:42:25 -03:00
Andy Walls 3d05913d89 V4L/DVB (10280): cx18: Rename structure members: dev to pci_dev and v4l2dev to video_dev
Renamed structure member name to be more specific to type in anticipation
of updating to the v4l2_device/v4l2_subdev framework.  Too many objects named
"dev" and /v4l2_\{0,1\}dev/ would be to confusing.

Signed-off-by: Andy Walls <awalls@radix.net>
Signed-off-by: Mauro Carvalho Chehab <mchehab@redhat.com>
2009-03-30 12:42:25 -03:00
Andy Walls e0f28b6a69 V4L/DVB (10279): cx18: Print driver version number when logging status
Make sure v4l2-ctl --log-status outputs the driver version.

Reported-by: David Dombroski <davedom@optonline.net>
Signed-off-by: Andy Walls <awalls@radix.net>
Signed-off-by: Mauro Carvalho Chehab <mchehab@redhat.com>
2009-03-30 12:42:25 -03:00
Andy Walls 350145a4f7 V4L/DVB (10278): cx18: Fix bad audio in first analog capture.
Normalize the APU state before the second firmware load so that audio
for the first analog capture is correct.

Many thanks to Conexant for supporting me in finding a solution for this
problem.

Signed-off-by: Andy Walls <awalls@radix.net>
Signed-off-by: Mauro Carvalho Chehab <mchehab@redhat.com>
2009-03-30 12:42:25 -03:00
Andy Walls 31230c5f6f V4L/DVB (10277): cx18, cx2341x: Fix bugs in cx18 AC3 control and comply with V4L2 spec
Fix bugs in the cx18 AC3 control implementation that would have affected
ivtv and other drivers via the cx2341x module.  Bring AC3 controls
behavior into comliance with V4L2 specification.  Thanks to Hans Verkuil
for reviewing the previous patch and pointing out the problems.

Reported-by: Hans Verkuil <hverkuil@xs4all.nl>
Signed-off-by: Andy Walls <awalls@radix.net>
Signed-off-by: Mauro Carvalho Chehab <mchehab@redhat.com>
2009-03-30 12:42:25 -03:00
Andy Walls 0d82fe801d V4L/DVB (10276): cx18, cx2341x, ivtv: Add AC-3 audio encoding control to cx18
Initial addition of controls to set AC-3 audio encoding for the CX23418 - it
does not work yet due to firmware or cx18 driver issues.  This change affects
the common cx2341x and ivtv modules due to shared structures and
common functions.

Signed-off-by: Andy Walls <awalls@radix.net>
Signed-off-by: Mauro Carvalho Chehab <mchehab@redhat.com>
2009-03-30 12:42:24 -03:00
Andy Walls 5029999418 V4L/DVB (10275): cx18: Additional debug to display outgoing mailbox parameters
Added debug display of outgoing mailbox arguments.  Fixed a minor problem
with display of stale incoming mailbox contents, when user was not looking for
debug warnings.

Signed-off-by: Andy Walls <awalls@radix.net>
Signed-off-by: Mauro Carvalho Chehab <mchehab@redhat.com>
2009-03-30 12:42:24 -03:00
Andy Walls 903bfeac50 V4L/DVB (10274): cx18: Fix a PLL divisor update for the I2S master clock
A redundant PLL divisior update for the I2S master clock after AV core
firmware load was missed in earlier PLL parameter changes.  This one really
doesn't matter because it's redundant and gets overwritten, but the driver
should be self consistent in the values used.

Signed-off-by: Andy Walls <awalls@radix.net>
Signed-off-by: Mauro Carvalho Chehab <mchehab@redhat.com>
2009-03-30 12:42:24 -03:00
Hans Verkuil aecde8b53b V4L/DVB (10141): v4l2: debugging API changed to match against driver name instead of ID.
Since the i2c driver ID will be removed in the near future we have to
modify the v4l2 debugging API to use the driver name instead of driver ID.

Note that this API is not used in applications other than v4l2-dbg.cpp
as it is for debugging and testing only.

Should anyone use the old VIDIOC_G_CHIP_IDENT, then this will be logged
with a warning that it is deprecated and will be removed in 2.6.30.

Signed-off-by: Hans Verkuil <hverkuil@xs4all.nl>
Signed-off-by: Mauro Carvalho Chehab <mchehab@redhat.com>
2009-01-02 17:11:52 -02:00
Hans Verkuil 069b747931 V4L/DVB (10138): v4l2-ioctl: change to long return type to match unlocked_ioctl.
Since internal to v4l2 the ioctl prototype is the same regardless of it
being called through .ioctl or .unlocked_ioctl, we need to convert it all
to the long return type of unlocked_ioctl.

Thanks to Jean-Francois Moine for posting an initial patch for this and
thus bringing it to our attention.

Cc: Jean-Francois Moine <moinejf@free.fr>
Signed-off-by: Hans Verkuil <hverkuil@xs4all.nl>
Signed-off-by: Mauro Carvalho Chehab <mchehab@redhat.com>
2009-01-02 17:11:34 -02:00
Hans Verkuil bec43661b1 V4L/DVB (10135): v4l2: introduce v4l2_file_operations.
Introduce a struct v4l2_file_operations for v4l2 drivers.

Remove the unnecessary inode argument.

Move compat32 handling (and llseek) into the v4l2-dev core: this is now
handled in the v4l2 core and no longer in the drivers themselves.

Note that this changeset reverts an earlier patch that changed the return
type of__video_ioctl2 from int to long. This change will be reinstated
later in a much improved version.

Signed-off-by: Hans Verkuil <hverkuil@xs4all.nl>
Signed-off-by: Mauro Carvalho Chehab <mchehab@redhat.com>
2009-01-02 17:11:12 -02:00
Andy Walls 55d81aa5c1 V4L/DVB (9937): cx18: Use a consistent crystal value for computing all PLL parameters
Use a consistent crystal value of 28.636360 MHz for computing all PLL
parameters so clocks don't have relative error due to assumed crystal
value mismatches.  Also aimed to have all PLLs run their VOCs at close to
400 MHz to minimze the error of these PLLs as frequency synthesizers. Also
set the VDCLK and AIMCLK PLLs to sane values before the APU and CPU firmware
are loaded.  Also fixed I2S Master clock dividers.

Many thanks to Mike Bradley and Jeff Campbell for reporting this problem and
suggesting the solution, researching and experimenting, and performing
extensive testing to support their suggested solution.

Reported-by: Jeff Campbell <jac1dlists@gmail.com>
Reported-by: Mike Bradley <mike.bradley@incanetworks.com>
Signed-off-by: Andy Walls <awalls@radix.net>
Signed-off-by: Mauro Carvalho Chehab <mchehab@redhat.com>
2008-12-30 09:39:24 -02:00
Andy Walls 57e24b629a V4L/DVB (9936): cx18: Disable locking of Video and Audio PLL for analog captures
Disable AV_LOCK, locking of audio PLL to video PLL in the cx18-av-core for
analog captures.  It seems to have adverse effects on captures from
SVideo and CVBS sources with current clock & crystal settings in the driver.

Many thanks to Jeff Campbell and Mike Bradley for reporting this problem,
and suggesting the solution and performing extensive testing to support their
suggestion.

Reported-by: Jeff Campbell <jac1dlists@gmail.com>
Reported-by: Mike Bradley <mike.bradley@incanetworks.com>
Signed-off-by: Andy Walls <awalls@radix.net>
Signed-off-by: Mauro Carvalho Chehab <mchehab@redhat.com>
2008-12-30 09:39:23 -02:00
Andy Walls fd6b9c978d V4L/DVB (9895): cx18: Refine the firmware load and firmware startup process
Refine the firmware load and firmware startup process.  Significant changes
are to ensure the SCB and IPC area are correct before starting up the firmware,
and letting the CPU firmware start up the APU firmware for us.

Signed-off-by: Andy Walls <awalls@radix.net>
Signed-off-by: Mauro Carvalho Chehab <mchehab@redhat.com>
2008-12-30 09:39:09 -02:00
Andy Walls 50b86bac6a V4L/DVB (9894): cx18: Use a known open task handle when setting stream CX2341x parameters
cx18: Use a known open task handle when setting stream CX2341x parameters
Sometimes, we might only have VBI or YUV stream open instead of an MPEG stream.
Let's make sure we use a valid task handle to perform the CX2341x control
settings.

Signed-off-by: Andy Walls <awalls@radix.net>
Signed-off-by: Mauro Carvalho Chehab <mchehab@redhat.com>
2008-12-30 09:39:08 -02:00
Andy Walls f6b181ac3b V4L/DVB (9893): cx18: Convert some list manipulations to emphasize entries not lists
Signed-off-by: Andy Walls <awalls@radix.net>
Signed-off-by: Mauro Carvalho Chehab <mchehab@redhat.com>
2008-12-30 09:39:08 -02:00
Andy Walls aafc77066f V4L/DVB (9892): cx18: VBI comment corrections and comments about VBI issues
VBI comment corrections to avoid future confusion about standards.
Comments on cx18 VBI implementation shortcomings that need resolution.

Signed-off-by: Andy Walls <awalls@radix.net>
Signed-off-by: Mauro Carvalho Chehab <mchehab@redhat.com>
2008-12-30 09:39:07 -02:00
Andy Walls 0ef0289264 V4L/DVB (9891): cx18 Replace magic number 63 with CX18_MAX_FW_MDLS_PER_STREAM
Removed magic number that referred to firmware limit on the number of
MDLs the firmware can maintain for any stream at any one time.

Signed-off-by: Andy Walls <awalls@radix.net>
Signed-off-by: Mauro Carvalho Chehab <mchehab@redhat.com>
2008-12-30 09:39:07 -02:00
Andy Walls af009cf635 V4L/DVB (9806): cx18: Enable raw VBI capture
A combined authorship patch from Hans Verkuil and Andy Walls.  Raw
VBI can now be captured but requires a video capture to be in progress as well.

Signed-off-by: Andy Walls <awalls@radix.net>
Signed-off-by: Hans Verkuil <hverkuil@xs4all.nl>
Signed-off-by: Mauro Carvalho Chehab <mchehab@redhat.com>
2008-12-30 09:38:33 -02:00
Andy Walls dd073434b5 V4L/DVB (9805): cx18: Port fix for raw/sliced VBI mixup from ivtv and cx25840
This is a port of the fixes Hans Verkuil made for ivtv/cx25840:
The service_set field was used to determine whether raw or sliced VBI was
desired. This is incorrect since it is perfectly valid to select sliced VBI
with a service_set of 0.

Instead the driver should check on VIDIOC_S_FMT whether the type
field matches the raw or sliced VBI type.

Updated the cx18 driver accordingly, including an additional check in
cx18_start_v4l2_encode_stream() that didn't exist in ivtv.

Signed-off-by: Andy Walls <awalls@radix.net>
Signed-off-by: Mauro Carvalho Chehab <mchehab@redhat.com>
2008-12-30 09:38:32 -02:00
Andy Walls abb096de82 V4L/DVB (9804): cx18: Avoid making firmware API calls with the queue lock held
cx18: Avoid making firmware API calls with the queue lock held.  The source
of MPEG strem corruption when not holding the queue lock was found to be that
the MPEG buffer could be retrieved by the user app before it was sync'ed for
the host cpu.  Incoming buffers are now sync'ed before being put on q_full and
releasing the queue lock.  We can thus avoid the sometimes lengthy call to
the firmware for CPU_DE_SET_MDL while holding the queue lock, so we can get
better performance.

Signed-off-by: Andy Walls <awalls@radix.net>
Signed-off-by: Mauro Carvalho Chehab <mchehab@redhat.com>
2008-12-30 09:38:32 -02:00
Andy Walls 765f6f612e V4L/DVB (9803): cx18: Increment version number due to siginificant buffering changes
cx18: Increment version number due to siginificant buffering changes.
Now version 1.0.4

Signed-off-by: Andy Walls <awalls@radix.net>
Signed-off-by: Mauro Carvalho Chehab <mchehab@redhat.com>
2008-12-30 09:38:30 -02:00
Andy Walls 6ecd86dcc8 V4L/DVB (9802): cx18: Add module parameters for finer control over buffer allocations
cx18: Add module parameters for finer control over buffer allocations.
User now has the option of setting smaller buffers to get lower
latency transfers from the encoder.  User can also now set the number
of buffers used for a stream explicitly.

Signed-off-by: Andy Walls <awalls@radix.net>
Signed-off-by: Mauro Carvalho Chehab <mchehab@redhat.com>
2008-12-30 09:38:29 -02:00
Andy Walls 66c2a6b0bc V4L/DVB (9801): cx18: Allow more than 63 capture buffers in rotation per stream
cx18: Allow more than 63 capture buffers in rotation per stream.  Implement
q_busy to hold buffers the firmware has for use.  q_free holds truly unused
buffers in a pool.  New buffers are given to the firmware as soon as the
firmware returns one, if there are any to give to the firmware.

Signed-off-by: Andy Walls <awalls@radix.net>
Signed-off-by: Mauro Carvalho Chehab <mchehab@redhat.com>
2008-12-30 09:38:29 -02:00
Andy Walls b80e1074c7 V4L/DVB (9800): cx18: Eliminate q_io from stream buffer handling
Eliminate q_io from stream buffer handling in anticipation of upcoming
changes in buffer handling.  q_io was a holdover from ivtv and it's function
in cx18 was trivial and not necessary.  We just push things back onto the
front of q_full now, instead of maintaining a 1 buffer q_io queue.

Signed-off-by: Andy Walls <awalls@radix.net>
Signed-off-by: Mauro Carvalho Chehab <mchehab@redhat.com>
2008-12-30 09:38:28 -02:00
Andy Walls daa1c164db 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>
2008-12-30 09:38:20 -02:00
Andy Walls 572bfea71b 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>
2008-12-30 09:38:19 -02:00
Andy Walls ec984f4378 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>
2008-12-30 09:38:13 -02:00
Andy Walls 20543ec414 V4L/DVB (9729): cx18: Update version due to significant irq handling changes
Update the version number due to significant changes in the way the
mailboxes and interrupts are handled.

Signed-off-by: Andy Walls <awalls@radix.net>
Signed-off-by: Mauro Carvalho Chehab <mchehab@redhat.com>
2008-12-30 09:38:12 -02:00
Andy Walls 1ed9dcc8ef V4L/DVB (9728): cx18: Copyright attribution update for files modified by awalls
Add copyright attribution for files modified by awalls in 2008

Signed-off-by: Andy Walls <awalls@radix.net>
Signed-off-by: Mauro Carvalho Chehab <mchehab@redhat.com>
2008-12-30 09:38:11 -02:00
Andy Walls 2bb49f1b9f V4L/DVB (9727): cx18: Adjust outgoing mailbox timeouts and remove statistics logging
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>
2008-12-30 09:38:11 -02:00
Andy Walls bca11a5721 V4L/DVB (9726): cx18: Restore buffers that have fallen out of the transfer rotation
Restore buffers that have fallen out of the transfer rotation, and check
for coherent mailbox data when processing a stale mailbox.

Signed-off-by: Andy Walls <awalls@radix.net>
Signed-off-by: Mauro Carvalho Chehab <mchehab@redhat.com>
2008-12-30 09:38:10 -02:00
Andy Walls d6c7e5f8fa 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>
2008-12-30 09:38:10 -02:00