Commit graph

6941 commits

Author SHA1 Message Date
Mauro Carvalho Chehab
e350d44fed [media] tda18271: allow restricting max out to 4 bytes
By default, tda18271 tries to optimize I2C bus by updating all registers
at the same time. Unfortunately, some devices doesn't support it.

The current logic has a problem when small_i2c is equal to 8, since there
are some transfers using 11 + 1 bytes.

Fix the problem by enforcing the max size at the right place, and allows
reducing it to max = 3 + 1.

Acked-by: Michael Krufky <mkrufky@kernellabs.com>
Acked-by: Sri Deevi <Srinivasa.Deevi@conexant.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab@redhat.com>
2010-10-21 01:17:43 -02:00
Mauro Carvalho Chehab
78bb6df6f2 [media] cx231xx: Only change gpio direction when needed
Acked-by: Sri Deevi <Srinivasa.Deevi@conexant.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab@redhat.com>
2010-10-21 01:17:42 -02:00
Mauro Carvalho Chehab
a6f6fb9c86 [media] cx231xx: better handle the master port enable command
Improves the logic, for it to be clearer and to avoid having
board-dependent config there.

Acked-by: Sri Deevi <Srinivasa.Deevi@conexant.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab@redhat.com>
2010-10-21 01:17:41 -02:00
Mauro Carvalho Chehab
1a4aa920d0 [media] cx231xx: properly use the right tuner i2c address
The driver has a field to indicate what bus is used by tuner and
by demod. However, this field were never used. On Pixelview,
it uses I2C 2 for tuner, instead of I2C 1.

	drivers/media/video/cx231xx/cx231xx-cards.c

Acked-by: Sri Deevi <Srinivasa.Deevi@conexant.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab@redhat.com>
2010-10-21 01:17:40 -02:00
Mauro Carvalho Chehab
24c80b651b [media] cx231xx: properly implement URB control messages log
This allows usage of a tool at v4l-utils tree to parse URB messages
and display them to userspace. The tool is available at:

http://git.linuxtv.org/v4l-utils.git?a=blob;f=contrib/cx231xx/parse_cx231xx.pl;hb=HEAD

Acked-by: Sri Deevi <Srinivasa.Deevi@conexant.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab@redhat.com>
2010-10-21 01:17:39 -02:00
Mauro Carvalho Chehab
92fbb811a8 [media] cx231xx: fix Kconfig dependencies
ERROR: "cx2341x_mpeg_ctrls" [drivers/media/video/cx231xx/cx231xx.ko] undefined!
ERROR: "cx2341x_fill_defaults" [drivers/media/video/cx231xx/cx231xx.ko] undefined!
ERROR: "cx2341x_log_status" [drivers/media/video/cx231xx/cx231xx.ko] undefined!
ERROR: "cx2341x_ctrl_get_menu" [drivers/media/video/cx231xx/cx231xx.ko] undefined!
ERROR: "cx2341x_update" [drivers/media/video/cx231xx/cx231xx.ko] undefined!
ERROR: "cx2341x_ctrl_query" [drivers/media/video/cx231xx/cx231xx.ko] undefined!
ERROR: "cx2341x_ext_ctrls" [drivers/media/video/cx231xx/cx231xx.ko] undefined!

Acked-by: Sri Deevi <Srinivasa.Deevi@conexant.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab@redhat.com>
2010-10-21 01:17:38 -02:00
Mauro Carvalho Chehab
62c78c967f [media] cx231xx: remove a printk warning at -avcore and at -417
drivers/media/video/cx231xx/cx231xx-avcore.c:1608: warning: format ‘%d’ expects type ‘int’, but argument 3 has type ‘long unsigned int’
drivers/media/video/cx231xx/cx231xx-417.c:1047: warning: format ‘%d’ expects type ‘int’, but argument 3 has type ‘size_t’

Signed-off-by: Mauro Carvalho Chehab <mchehab@redhat.com>
2010-10-21 01:17:37 -02:00
Devin Heitmueller
6af8cc0b25 [media] cx231xx: Fix vblank/vactive line counts for PAL/SECAM
Adjust the vblank and vactive counts so that they don't throw an error in
cx25840's set_std call (we did an equivalent change for NTSC when we got the
scaler working).

Signed-off-by: Devin Heitmueller <dheitmueller@hauppauge.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab@redhat.com>
2010-10-21 01:17:36 -02:00
Devin Heitmueller
222c435205 [media] cx231xx: properly set active line count for PAL/SECAM
The cx231xx_do_mode_ctrl_overrides() function was not touching the vactive line
count for PAL/SECAM modes, which in some use cases results in it being left in
the chip default state of 480 (NTSC).

Explicitly set the values, as is already done for NTSC.

Signed-off-by: Devin Heitmueller <dheitmueller@hauppauge.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab@redhat.com>
2010-10-21 01:17:36 -02:00
Devin Heitmueller
2ded0fe140 [media] cx231xx: whitespace cleanup
Fix some indentation problems and remove an "if (1)" from the Colibri setup
function.

Signed-off-by: Devin Heitmueller <dheitmueller@hauppauge.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab@redhat.com>
2010-10-21 01:17:35 -02:00
Devin Heitmueller
b6cd9c4a1d [media] cx231xx: remove board specific check for Colibri configuration
The cx231xx_set_Colibri_For_LowIF() function is only ever called if the tuner
has a DIF (see vidioc_s_frequency() in cx231xx-video.c).  Hence, we do not
need to do a board specific check in this function.

Signed-off-by: Devin Heitmueller <dheitmueller@hauppauge.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab@redhat.com>
2010-10-21 01:17:34 -02:00
Devin Heitmueller
8aed3f479b [media] cx231xx: Make the DIF configuration based on the tuner not the board id
The current code was deciding whether a DIF was present based on the board
profile.  However, this is just another thing for someone to get wrong when
adding new boards.  Make the decision based on the tuner instead, so that a
developer adding new boards only needs to specify which tuner the device has.

Of course, the first time somebody adds a board with a tuner other than xc5000
or tda18271, he/she will need to add another line for that tuner.  But we
provide a friendly message in dmesg to let them know that.

Signed-off-by: Devin Heitmueller <dheitmueller@hauppauge.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab@redhat.com>
2010-10-21 01:17:33 -02:00
Devin Heitmueller
b522591a45 [media] cx231xx: remove i2c ir stubs
Nobody is ever going to implement an i2c based IR controller on a bridge that
has an onboard universal IR receiver.  This stuff was all copied from em28xx,
which has old enough versions of the chip that some didn't have onboard IR.

Remove the stubs related to i2c based IR (keeping the cx231xx-input code).

Signed-off-by: Devin Heitmueller <dheitmueller@hauppauge.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab@redhat.com>
2010-10-21 01:17:32 -02:00
Devin Heitmueller
2b43db320e [media] cx231xx: move printk() line related to 417 initialization
Move a printk() message which refers to enabling the cx23417 so that it only
shows up on a board that has the cx23417.

Signed-off-by: Devin Heitmueller <dheitmueller@hauppauge.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab@redhat.com>
2010-10-21 01:17:31 -02:00
Devin Heitmueller
9f51259f4a [media] cx231xx: fixup video grabber board profile
The video grabber reference design (Veyron) does not have a tuner input, so
do not have it defined in the board profile.

Signed-off-by: Devin Heitmueller <dheitmueller@hauppauge.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab@redhat.com>
2010-10-21 01:17:30 -02:00
Devin Heitmueller
888062188c [media] cx231xx: make output mode configurable via the board profile
Extend the board profile structure to allow configuration of the output mode.
Right now they are all doing VIP 1.1 format, but we have a board that needs
ITU656 format (which hasn't been checked in yet).

Signed-off-by: Devin Heitmueller <dheitmueller@hauppauge.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab@redhat.com>
2010-10-21 01:17:29 -02:00
Devin Heitmueller
4270c3cac4 [media] cx231xx: Add initial support for Hauppauge USB-Live2
Add initial support for the Hauppauge USBLive 2 (2040:c200).  Note that I
had to copy a bunch of the case statements used for the Conexant video grabber
reference design (which also doesn't have a tuner).  This will likely need to
be refactored out into the board profile.

Signed-off-by: Devin Heitmueller <dheitmueller@hauppauge.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab@redhat.com>
2010-10-21 01:17:28 -02:00
Devin Heitmueller
8d4c20c960 [media] cx231xx: set correct i2c port for Exeter tuner
The tuner is on i2c port 3 just like all the reference designs.  Having it
improperly set to port #1 causes the tuner initialization to fail when enabling
the device.

Signed-off-by: Devin Heitmueller <dheitmueller@hauppauge.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab@redhat.com>
2010-10-21 01:17:27 -02:00
Devin Heitmueller
c09d6695bd [media] cx231xx: set standard tune to last known frequency when switching inputs
If switching to a tuner input, reset the standard and tune to the last known
frequency.  We need to do this in particular for this bridge since the tuner
gets powered down when captuing on the composite or s-video inputs.

Signed-off-by: Devin Heitmueller <dheitmueller@hauppauge.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab@redhat.com>
2010-10-21 01:17:26 -02:00
Devin Heitmueller
66d7c4318a [media] cx231xx: Remove hack which puts device into bulk mode
Remove a hack which was jammed into s_input to force the device into bulk mode
at runtime (an abuse of the API).  If this sort of functionality is actually
needed (aside from the existing "transfer_mode" modprobe variable), a patch
can be submitted which makes use of a private control.

Signed-off-by: Devin Heitmueller <dheitmueller@hauppauge.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab@redhat.com>
2010-10-21 01:17:25 -02:00
Devin Heitmueller
b88ba6193d [media] cx231xx: Set the power mode instead of using the digital mux GPIOs
The Exeter hardware design does not use GPIOs to manage whether its in
digital mode or analog mode, but we need to setup the power control properly.

For that board, setup power control and remove the mux select call.  It is
highly likely that this change could be used by other boards as well, which
would make power management cleaner (fixing known issues transitioning between
analog and digital mode).

Signed-off-by: Devin Heitmueller <dheitmueller@hauppauge.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab@redhat.com>
2010-10-21 01:17:24 -02:00
Devin Heitmueller
6e6a2ba9cf [media] cx231xx: do not call video_mux as part of isoc setup
You cannot call the video_mux routine from within the isoc setup, because that
code is shared with the digital isoc handler.  This was causing the GPIOs and
power control to be put into the wrong state when starting up digital mode.

Signed-off-by: Devin Heitmueller <dheitmueller@hauppauge.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab@redhat.com>
2010-10-21 01:17:23 -02:00
Devin Heitmueller
cc355753e8 [media] cx231xx: Clear avmode bits before setting
We need to clear out the field before setting individual bits, or else we end
up with a union of whatever was there and what we are trying to set.  For
example, switching to digital mode ends up being 0x30 instead of 0x10 if we
were previously in analog tv mode.

Signed-off-by: Devin Heitmueller <dheitmueller@hauppauge.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab@redhat.com>
2010-10-21 01:17:22 -02:00
Devin Heitmueller
435b4f7897 [media] cx231xx: make video scaler work properly
Move the responsibility for setting up the horizontal and vertical scalers
entirely to the cx25840 driver.  The cx231xx-avcore was actually programming
garbage into the HSCALE_CTRL and VSCALE_CTRL registers (because of differences
in how the em28xx driver worked, which the cx231xx driver was derived from).

The net effect is that the scaler now works properly (tested with both PAL
and NTSC under mplayer and tvtime).

This patch also gets rid of cx25840 errors showing up in dmesg which say
"720x480 is not a valid size" (since we now properly setup the size of the
active video area).

Signed-off-by: Devin Heitmueller <dheitmueller@hauppauge.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab@redhat.com>
2010-10-21 01:17:21 -02:00
Devin Heitmueller
d5a1754d52 [media] cx231xx: reduce log severity for some debug events
Change the log level from info to debug for some log events that occur
frequently and should never need to be seen in normal operation.

Signed-off-by: Devin Heitmueller <dheitmueller@hauppauge.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab@redhat.com>
2010-10-21 01:17:20 -02:00
Devin Heitmueller
e3e0aaaafa [media] cx231xx: remove board specific initialization
There is no need for a switch statement here.  Use the contents of the board
profile to dictate the tuner driver and i2c address.  Eventually if a board
ever comes around which has a different i2c bus than #1, well that should be a
field in the board profile as well.

Signed-off-by: Devin Heitmueller <dheitmueller@hauppauge.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab@redhat.com>
2010-10-21 01:17:19 -02:00
Devin Heitmueller
99d35a0e4c [media] cx231xx: Ensure VBI fields are sent in the correct order
The current code was sending one videobuf per field (despite having specified
V4L2_FIELD_SEQ_TB during setup).  As a result, application which used the
read() interface would work, except they would sometimes have the fields
reversed (depending on the luck of which field the device was on when the
application started VBI capture).  The net effect was that CC decoding would
only work about 50% of the time.

Restructure the VBI code a bit so that works like all the other drivers, such
that both fields are delivered in a single videobuf buffer, which ensures that
they are always received in a predictable order.

Signed-off-by: Devin Heitmueller <dheitmueller@hauppauge.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab@redhat.com>
2010-10-21 01:17:18 -02:00
Devin Heitmueller
adc0356e9b [media] cx231xx: Fix VBI parameters for sampling rate and offset
The VBI sampling rate and offset were incorrectly specified, which resulted in
CC data not being rendered under zvbi or tvtime.

Set the fields correctly.

Signed-off-by: Devin Heitmueller <dheitmueller@hauppauge.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab@redhat.com>
2010-10-21 01:17:18 -02:00
Devin Heitmueller
dd067a8de7 [media] cx231xx: fix format string warning
Change a %x to a %p since the variable is a pointer

Signed-off-by: Devin Heitmueller <dheitmueller@hauppauge.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab@redhat.com>
2010-10-21 01:17:17 -02:00
Devin Heitmueller
2bfcc0611d [media] cx231xx-dvb: remove unused variable
Get rid of warning about unused variable

Signed-off-by: Devin Heitmueller <dheitmueller@hauppauge.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab@redhat.com>
2010-10-21 01:17:16 -02:00
Devin Heitmueller
9dfde5578d [media] Use smaller i2c transaction size with 18271 tuner
Configure the tda18271 to use a smaller transaction size by default, which
works around some sort of i2c bug in the Polaris driver (which needs to be
debugged).

This should be safe for other boards (being in tuner-core means it will be
enabled by default), although testing needs to be done.

Signed-off-by: Devin Heitmueller <dheitmueller@hauppauge.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab@redhat.com>
2010-10-21 01:17:14 -02:00
Devin Heitmueller
761f6cf642 [media] cx231xx: fix race condition in DVB initialization
Fix case where analog calls come in while the DVB side of the board is still
initializing.  This patch is actually just an exact port of the same patch
made by Mauro to em28xx in hg rev 14762.

Signed-off-by: Devin Heitmueller <dheitmueller@hauppauge.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab@redhat.com>
2010-10-21 01:17:13 -02:00
Devin Heitmueller
d78148fba4 [media] cx231xx: add USB ID Hauppauge model 111301
Add a USB ID for model 111301.

Signed-off-by: Devin Heitmueller <dheitmueller@hauppauge.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab@redhat.com>
2010-10-21 01:17:12 -02:00
Michael Krufky
1a50fddefd [media] cx231xx: add support for Hauppauge EXETER
Add support for various Hauppauge EXETER designs.

Note by DJH: fixed a few minor 'make checkpatch' warnings before commit.

Signed-off-by: Michael Krufky <mkrufky@kernellabs.com>
Signed-off-by: Devin Heitmueller <dheitmueller@hauppauge.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab@redhat.com>
2010-10-21 01:17:11 -02:00
Palash Bandyopadhyay
64fbf44455 [media] cx231xx: Added support for Carraera, Shelby, RDx_253S and VIDEO_GRABBER
Added support for new cx231xx boards - Carraera, Shelby, RDx_253S and
VIDEO_GRABBER.

[mchehab@redhat.com: Fix a merge conflict with BKL removal patches]
Signed-off-by: Palash Bandyopadhyay <palash.bandyopadhyay@conexant.com>
Signed-off-by: Devin Heitmueller <dheitmueller@hauppauge.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab@redhat.com>
2010-10-21 01:17:10 -02:00
Daniel Drake
96eb729a5b [media] cafe_ccic: Implement VIDIOC_ENUM_FRAMEINTERVALS and ENUM_FRAMESIZES
This allows GStreamer to pick appropriate framerates and resolutions
based on desired capture parameters.

Signed-off-by: Daniel Drake <dsd@laptop.org>
Acked-by: Jonathan Corbet <corbet@lwn.net>
Signed-off-by: Mauro Carvalho Chehab <mchehab@redhat.com>
2010-10-21 01:17:06 -02:00
Daniel Drake
b0326b7f8d [media] ov7670: implement VIDIOC_ENUM_FRAMESIZES
GStreamer uses this.

Signed-off-by: Daniel Drake <dsd@laptop.org>
Acked-by: Jonathan Corbet <corbet@lwn.net>
Signed-off-by: Mauro Carvalho Chehab <mchehab@redhat.com>
2010-10-21 01:17:06 -02:00
Jonathan Corbet
e99dfcf7f6 [media] ov7670: implement VIDIOC_ENUM_FRAMEINTERVALS
Inquiring minds (and gstreamer) want to know.

Signed-off-by: Jonathan Corbet <corbet@lwn.net>
Signed-off-by: Daniel Drake <dsd@laptop.org>
Signed-off-by: Mauro Carvalho Chehab <mchehab@redhat.com>
2010-10-21 01:17:05 -02:00
Daniel Drake
df2b9b0f9c [media] cafe_ccic: Fix hang in command write processing
This patch, which basically reverts 6d77444ac, fixes an occasional
on-boot or on-capture hang on the XO-1 laptop.

It seems like the cafe hardware is flakier than we thought and that in
some cases, the commands get executed but are never reported as completed
(even if we substantially increase the delays before reading registers).

Reintroduce the 1-second CAFE_SMBUS_TIMEOUT to catch and avoid this
strange hardware bug.

Signed-off-by: Daniel Drake <dsd@laptop.org>
Acked-by: Jonathan Corbet <corbet@lwn.net>
Signed-off-by: Mauro Carvalho Chehab <mchehab@redhat.com>
2010-10-21 01:17:04 -02:00
Mauro Carvalho Chehab
1bede7521d [media] videobuf-dma-sg: Use min_t(size_t, PAGE_SIZE ..)
As pointed by Laurent:

I think min_t(size_t, PAGE_SIZE, size) is the preferred way.

Thanks-to: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab@redhat.com>
2010-10-21 01:17:00 -02:00
Mauro Carvalho Chehab
7242063018 V4L/DVB: Fix a merge conflict that affects unlock_ioctl
Signed-off-by: Mauro Carvalho Chehab <mchehab@redhat.com>
2010-10-21 01:16:58 -02:00
Mauro Carvalho Chehab
d302548a9f V4L/DVB: saa7134-input can't be a module right now
There are some symbols at saa7134-input that are used on saa7134
and vice-versa. Due to that, module install fails.

So, partially revert commit 9f495cf7d691c99bf7bdcec9f35fcfdad2cf9ae9.

Signed-off-by: Mauro Carvalho Chehab <mchehab@redhat.com>
2010-10-21 01:16:52 -02:00
Mauro Carvalho Chehab
d026d82843 V4L/DVB: videobuf-dma-sg: Fix a warning due to the usage of min(PAGE_SIZE, arg)
drivers/media/video/videobuf-dma-sg.c: In function ‘videobuf_pages_to_sg’:
drivers/media/video/videobuf-dma-sg.c:119: warning: comparison of distinct pointer types lacks a cast
drivers/media/video/videobuf-dma-sg.c:120: warning: comparison of distinct pointer types lacks a cast

Signed-off-by: Mauro Carvalho Chehab <mchehab@redhat.com>
2010-10-21 01:06:21 -02:00
Jean-François Moine
266815e255 V4L/DVB: gspca - sonixj: Have 0c45:6130 handled by sonixj instead of sn9c102
The driver sn9c102 does not know about the sensor mi0360b.

Signed-off-by: Jean-François Moine <moinejf@free.fr>
Signed-off-by: Mauro Carvalho Chehab <mchehab@redhat.com>
2010-10-21 01:06:21 -02:00
Jean-François Moine
a95bd640e7 V4L/DVB: gspca - sonixj: Bad detection of the end of image
The 'end of image' block may be splitted between two ISOC packets.
This case was not tested, so, some images could be lost and concatenated
to previous one(s), raising 'frame overflow' errors.

Signed-off-by: Jean-François Moine <moinejf@free.fr>
Signed-off-by: Mauro Carvalho Chehab <mchehab@redhat.com>
2010-10-21 01:06:21 -02:00
Jean-François Moine
a067db8473 V4L/DVB: gspca - sonixj: Add sensor mi0360b
Signed-off-by: Jean-François Moine <moinejf@free.fr>
Signed-off-by: Mauro Carvalho Chehab <mchehab@redhat.com>
2010-10-21 01:06:21 -02:00
Jean-François Moine
294d8b4a96 V4L/DVB: gspca - mr97310a: Declare static the constant tables
Signed-off-by: Jean-François Moine <moinejf@free.fr>
Signed-off-by: Mauro Carvalho Chehab <mchehab@redhat.com>
2010-10-21 01:06:21 -02:00
Jean-François Moine
2856643e2e V4L/DVB: gspca - many subdrivers: Handle the buttons when CONFIG_INPUT=m
Signed-off-by: Jean-François Moine <moinejf@free.fr>
Signed-off-by: Mauro Carvalho Chehab <mchehab@redhat.com>
2010-10-21 01:06:20 -02:00
Matthew Garrett
3dae8b41dc V4L/DVB: uvc: Enable USB autosuspend by default on uvcvideo
We've been doing this for a while in Fedora without any complaints.

Signed-off-by: Matthew Garrett <mjg@redhat.com>
Acked-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab@redhat.com>
2010-10-21 01:06:20 -02:00
Hans Verkuil
3fd8e647ea V4L/DVB: v4l2-common: Move v4l2_find_nearest_format from videodev2.h to v4l2-common.h
This function is an internal API and belongs in v4l2-common.h, not
videodev.h. The return pointer and probe argument should be const as well.

Signed-off-by: Hans Verkuil <hverkuil@xs4all.nl>
Signed-off-by: Mauro Carvalho Chehab <mchehab@redhat.com>
2010-10-21 01:06:19 -02:00