aboutsummaryrefslogtreecommitdiff
path: root/drivers/media/video/cx25840/cx25840-core.c
AgeCommit message (Collapse)Author
2010-02-26V4L/DVB: cx25840: Fix composite detectionKusanagi Kouichi
If CX25840_VIN1_CH1 and the like is used, input is not detected as composite. Their value is 0x800000XX and CX25840_COMPONENT_ON is 0x80000200. So 739 else if ((vid_input & CX25840_COMPONENT_ON) == 0) this condition never be true. Signed-off-by: Kusanagi Kouichi <slash@ac.auone-net.jp> 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-26V4L/DVB: cx25840, v4l2-subdev, ivtv, pvrusb2: Fix ivtv/cx25840 tinny audioAndy Walls
This change attempts to fix the ivtv tinny audio problem by keeping digitizer to encoder audio clocks running, while disabling the video clocks as needed to avoid unpredictable PCI bus hangs. To accomplish this, for the cx25840 module enabling of audio streaming had to be separated from enabling video streaming, requiring an additional v4l2_subdev_audio_op and calls to this new op in the pvrusb2 and ivtv drivers. The cx231xx and cx23885 driver use the cx25840 module for affecting only video on s_stream calls, so those drivers needed no change. The CX23418 hardware does not exhibit either the tinny audio problem nor the PCI bus hang, so the cx18 driver did not need corresponding changes. CX2341[56] based cards that are not using the CX2584x family of chips do not seem to be affected by the tinny audio problem, and this change should not affect how they are configured. It will delay their first capture by starting by another 300 msec though. Many thanks go to Argus <pthorn-ivtvd@styx2002.no-ip.org> and Martin Dauskardt <martin.dauskardt@gmx.de> whose persistent testing and investigation of this problem will hopefully fix this problem once and for all for many ivtv users. Reported-by: Martin Dauskardt <martin.dauskardt@gmx.de> Reported-by: Argus <pthorn-ivtvd@styx2002.no-ip.org> Signed-off-by: Andy Walls <awalls@radix.net> Signed-off-by: Mauro Carvalho Chehab <mchehab@redhat.com>
2009-12-05V4L/DVB (13232): cx25840 6.5MHz carrier detection fixesAleksandr V. Piskunov
cx25840: Disable 6.5MHz carrier autodetection for PAL, always assume its DK. Only try to autodetect 6.5MHz carrier for SECAM if user accepts both system DK and L. Signed-off-by: Aleksandr V. Piskunov <alexandr.v.piskunov@gmail.com> Reviewed-by: Andy Walls <awalls@radix.net> Signed-off-by: Mauro Carvalho Chehab <mchehab@redhat.com>
2009-12-05V4L/DVB (13206): cx25840: add component supportDavid T.L. Wong
Signed-off-by: David T.L. Wong <davidtlwong@gmail.com> Signed-off-by: Mauro Carvalho Chehab <mchehab@redhat.com>
2009-12-05V4L/DVB (13092): cx25840: Improvements to the cx23885/7/8 chip detection ↵Steven Toth
mechanism. The prior mechanism wasn't reliable with the cx23887. This new mechanism tests correctly against cx23885, 7 and 8 based products. Signed-off-by: Steven Toth <stoth@kernellabs.com> Signed-off-by: Mauro Carvalho Chehab <mchehab@redhat.com>
2009-12-05V4L/DVB (13090): cx25840: Init PLLs properly for CX2388[578] A/V coresAndy Walls
The SYS and AUX PLLs need to be initialized to different values based on the chip: CX23885, CX23887, CX23888, as each uses a different crystal frequency: 28.6363 MHz, 25.0 MHz, 50.0 MHz. Signed-off-by: Andy Walls <awalls@radix.net> Signed-off-by: Mauro Carvalho Chehab <mchehab@redhat.com>
2009-12-05V4L/DVB (13088): cx25840: Convert chip/core family checks to static inline ↵Andy Walls
functions Change logic to check for various chip or core families to inline functions. Checks for specific chips should be made against the state->id field now. This is in preparation for chip/core specific code for setting up PLLs for the CX2388[578] family of cores, that all run with different crystal frequencies. Signed-off-by: Andy Walls <awalls@radix.net> Signed-off-by: Mauro Carvalho Chehab <mchehab@redhat.com>
2009-12-05V4L/DVB (13087): cx25840: Improve detection of CX2388[578] A/V coresAndy Walls
Add improved logic to detect the exact CX2388[578] A/V core that is being probed. Also cleaned up detection and logging for CX2310[12], CX2583[67], and CX2584[0123] cores and chips. Also added code to identify a CX2388[578] A/V decoder core that is not responding properly. Typical symptoms include registers 0x00-0xff responding properly but all other registers returning the same value (0x13 and 0x5 have been observed). This state will cause proper detection of '885 vs. '887 vs. '888 to fail and the chip won't respond to get configured properly anyway. I have no method of reseting the core to a working state at this time; but I didn't try too hard to work one out either. The problem likely only occurs in development. I suspect configuring the SYS PLL VCO to oscillate too slowly (286.3 MHz?) before post divide may be the root cause, when encountered. Signed-off-by: Andy Walls <awalls@radix.net> Signed-off-by: Mauro Carvalho Chehab <mchehab@redhat.com>
2009-09-12V4L/DVB (12347): cx25840: Bugfix for no DVB-T on the Hauppauge HVR-1700Steven Toth
After the i2c subdev changes the ordering of initialization changed, causing a total loss of previous GPIO settings and a loss of DTV. The generic firmware loading routine has now changed to preserve GPIO values if the device is cx23885 based (safety) and I've moved the GPIO configuration from probe() into the cx23885 init func which is a little clearer and fixes the bug. Tested-by: Sohail Syyed <linuxtv@hubstar.net> Reviewed-by: Michael Krufky <mkrufky@kernellabs.com> Signed-off-by: Steven Toth <stoth@kernellabs.com> Signed-off-by: Mauro Carvalho Chehab <mchehab@redhat.com>
2009-04-06V4L/DVB (11380): v4l2-subdev: change s_routing prototypeHans Verkuil
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-06V4L/DVB (11370): v4l2-subdev: move s_std from tuner to core.Hans Verkuil
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-06V4L/DVB (11369): v4l2-subdev: add load_fw and use that instead of abusing ↵Hans Verkuil
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-06V4L/DVB (10989): cx25840: cx23885 detection was brokenHans Verkuil
An earlier commit accidentally broke the detection of the cx25837 part of the cx23885. Reinstated the commented out code. Signed-off-by: Hans Verkuil <hverkuil@xs4all.nl> Signed-off-by: Mauro Carvalho Chehab <mchehab@redhat.com>
2009-04-06V4L/DVB (10953): cx25840: Fix CodingStyle errors introduced by the last patchMauro Carvalho Chehab
Signed-off-by: Mauro Carvalho Chehab <mchehab@redhat.com>
2009-04-06V4L/DVB (10952): cx25840: prepare it to be used by cx231xx moduleSri Deevi
cx231xx has a cx25840 inside the chip. However, some different initializations are used for this variant. Signed-off-by: Srinivasa Deevi <srinivasa.deevi@conexant.com> Signed-off-by: Mauro Carvalho Chehab <mchehab@redhat.com>
2009-03-30V4L/DVB (11315): cx25840: fix 'unused variable' warning.Hans Verkuil
Signed-off-by: Hans Verkuil <hverkuil@xs4all.nl> Signed-off-by: Mauro Carvalho Chehab <mchehab@redhat.com>
2009-03-30V4L/DVB (11309): cx25840: cleanup: remove intermediate 'ioctl' stepHans Verkuil
The audio and vbi functions where still called through an ioctl-like interface, even though this is no longer needed with v4l2-subdev. Just change each 'case' into a proper function and call that directly. Signed-off-by: Hans Verkuil <hverkuil@xs4all.nl> Signed-off-by: Mauro Carvalho Chehab <mchehab@redhat.com>
2009-03-30V4L/DVB (11298): cx25840: remove legacy code for old-style i2c APIHans Verkuil
All drivers that use cx25840 are now converted to v4l2_subdev, so I can remove the support for the old-style i2c API. Signed-off-by: Hans Verkuil <hverkuil@xs4all.nl> Signed-off-by: Mauro Carvalho Chehab <mchehab@redhat.com>
2009-03-30V4L/DVB (10698): v4l2-common: remove v4l2_ctrl_query_fill_stdHans Verkuil
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-30V4L/DVB (10408): v4l2: fix incorrect hue range checkHans Verkuil
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-30V4L/DVB (10251): cx25840: add comments explaining what the init() does.Hans Verkuil
Signed-off-by: Hans Verkuil <hverkuil@xs4all.nl> Signed-off-by: Mauro Carvalho Chehab <mchehab@redhat.com>
2009-01-29V4L/DVB (10314): cx25840: ignore TUNER_SET_CONFIG in the command callback.Hans Verkuil
These days TUNER_SET_CONFIG is broadcast to the other i2c devices and that triggers a fw load on the cx25840. Ignore this command since cx25840 isn't a tuner and you really do not want to load the firmware that early. Signed-off-by: Hans Verkuil <hverkuil@xs4all.nl> Signed-off-by: Mauro Carvalho Chehab <mchehab@redhat.com>
2009-01-29V4L/DVB (10250): cx25840: fix regression: fw not loaded on first useHans Verkuil
With the conversion to v4l2_subdev one bit of code was accidentally dropped: on receiving the first command the driver has to load the fw. A new init() command was introduced to do that explicitly for bridge drivers that are converted to use v4l2_subdev, but old drivers that are not yet converted no longer worked. This patch fixes this regression for these old drivers. Signed-off-by: Hans Verkuil <hverkuil@xs4all.nl> Signed-off-by: Mauro Carvalho Chehab <mchehab@redhat.com>
2009-01-02V4L/DVB (10141): v4l2: debugging API changed to match against driver name ↵Hans Verkuil
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>
2008-12-30V4L/DVB (9823): cx25840: convert to v4l2_subdev.Hans Verkuil
Signed-off-by: Hans Verkuil <hverkuil@xs4all.nl> Signed-off-by: Mauro Carvalho Chehab <mchehab@redhat.com>
2008-09-03V4L/DVB (8805): Steven Toth email address changeSteven Toth
I need this so I can better isolate my linux email from my corporate email. Signed-off-by: Steven Toth <stoth@linuxtv.org> Signed-off-by: Mauro Carvalho Chehab <mchehab@redhat.com>
2008-07-26V4L/DVB (8494): make cx25840_debug staticAdrian Bunk
cx25840_debug can now become static. Signed-off-by: Adrian Bunk <bunk@kernel.org> Signed-off-by: Mauro Carvalho Chehab <mchehab@infradead.org>
2008-07-20V4L/DVB (8377): ivtv/cx18: ensure the default control values are correctHans Verkuil
For several MPEG controls and the volume control the default as returned by VIDIOC_QUERYCTRL was incorrect and did not match the actual initial value. This is now fixed for cx18 and ivtv. Signed-off-by: Hans Verkuil <hverkuil@xs4all.nl> Signed-off-by: Mauro Carvalho Chehab <mchehab@infradead.org>
2008-07-20V4L/DVB (8376): cx25840: move cx25840_vbi_setup to core.c and rename to ↵Hans Verkuil
cx25840_std_setup cx25840_vbi_setup has nothing to do with setting up VBI, but everything with setting up the standard. Move to cx25840-core.c and rename. Signed-off-by: Hans Verkuil <hverkuil@xs4all.nl> Signed-off-by: Mauro Carvalho Chehab <mchehab@infradead.org>
2008-07-20v4l-dvb: remove legacy checks to allow support for kernels < 2.6.10Hans Verkuil
Also remove some blank lines that were used to split compat code at -devel tree. Signed-off-by: Hans Verkuil <hverkuil@xs4all.nl> Signed-off-by: Mauro Carvalho Chehab <mchehab@infradead.org>
2008-06-26V4L/DVB (8007): cx18/cx25840: the S-Video LUMA input can use all In1-In8 inputsHans Verkuil
The S-Video LUMA input was restricted to the In1-In4 inputs, but it turns out that it can use the full range of In1-In8. Signed-off-by: Hans Verkuil <hverkuil@xs4all.nl> Signed-off-by: Mauro Carvalho Chehab <mchehab@infradead.org>
2008-05-18i2c: Convert remaining new-style drivers to use module aliasingJean Delvare
Update all the remaining new-style i2c drivers to use standard module aliasing instead of the old driver_name/type driver matching scheme. Note that the tuner driver is a bit quirky at the moment, as it overwrites i2c_client.name with arbitrary strings. We write "tuner" back on remove, to make sure that driver cycling will work properly, but there may still be troublesome corner cases. Signed-off-by: Jean Delvare <khali@linux-fr.org>
2008-04-29i2c: Add support for device alias namesJean Delvare
Based on earlier work by Jon Smirl and Jochen Friedrich. This patch allows new-style i2c chip drivers to have alias names using the official kernel aliasing system and MODULE_DEVICE_TABLE(). At this point, the old i2c driver binding scheme (driver_name/type) is still supported. Signed-off-by: Jean Delvare <khali@linux-fr.org> Cc: Jochen Friedrich <jochen@scram.de> Cc: Jon Smirl <jonsmirl@gmail.com> Cc: Kay Sievers <kay.sievers@vrfy.org>
2008-04-24V4L/DVB (7646): cx25840: Ensure GPIO2 is correctly set for cx23885/7/8 based ↵Steven Toth
products cx25840: Ensure GPIO2 is correctly set for cx23885/7/8 based products. Signed-off-by: Steven Toth <stoth@hauppauge.com> Signed-off-by: Mauro Carvalho Chehab <mchehab@infradead.org>
2008-04-24V4L/DVB (7344): cx25840: better PAL-M and NTSC-KR handlingHans Verkuil
Signed-off-by: Hans Verkuil <hverkuil@xs4all.nl> Signed-off-by: Mauro Carvalho Chehab <mchehab@infradead.org>
2008-01-25V4L/DVB (7002): cx25840: Add basic CX23885 AVCore supportSteven Toth
The cx23885/7/8 PCIe bridge has an internal AVCore modelled on the cx2584x family. Many of the registers positions are identical but some moved. The register values are also different because the different bridges run at different clock rates. Signed-off-by: Steven Toth <stoth@hauppauge.com> Signed-off-by: Mauro Carvalho Chehab <mchehab@infradead.org>
2008-01-25V4L/DVB (6743): cx25840: fix endianness inconsistencyHans Verkuil
cx25840_read4 reads a little-endian 32-bit value whereas cx25840_write4 writes the 32-bit value as big-endian. Convert write4 to use little-endian as well (that's the correct endianness). Signed-off-by: Hans Verkuil <hverkuil@xs4all.nl> Signed-off-by: Mauro Carvalho Chehab <mchehab@infradead.org>
2008-01-25V4L/DVB (6465): Use correct error codes when chip is not recognizedHans Verkuil
If the chip isn't recognized, then the correct errors should be returned. The v4l2_i2c_attach() utility function will return 0 for all errors except -ENOMEM to provide proper compatibility support for the old I2C probing function. Signed-off-by: Hans Verkuil <hverkuil@xs4all.nl> Signed-off-by: Mauro Carvalho Chehab <mchehab@infradead.org>
2008-01-25V4L/DVB (6459): cx25840: convert to bus-based I2C APIHans Verkuil
Signed-off-by: Hans Verkuil <hverkuil@xs4all.nl> Signed-off-by: Mauro Carvalho Chehab <mchehab@infradead.org>
2007-10-09V4L/DVB (6142): cx25840: fix build warningMichael Krufky
Fix the following build warning: CC [M] cx25840-core.o cx25840-core.c: In function 'init_dll1': cx25840-core.c:147: warning: implicit declaration of function 'udelay' Signed-off-by: Michael Krufky <mkrufky@linuxtv.org> Signed-off-by: Mauro Carvalho Chehab <mchehab@infradead.org>
2007-10-09V4L/DVB (6124): cx25840: add a few 10 microsecond delaysTyler Trafford
There were a couple of places in the cx25840 initialization where the datasheet called for a 10 microsecond delay, which we ignored because of the 10 usec I2C delay. Put them in anyway now that the I2C delay was decreased to 5 usec. Signed-off-by: Tyler Trafford <ttrafford@gmail.com> Signed-off-by: Hans Verkuil <hverkuil@xs4all.nl> Signed-off-by: Mauro Carvalho Chehab <mchehab@infradead.org>
2007-10-09V4L/DVB (6112): cx25840: use a workqueue to load the firmwareHans Verkuil
Loading the firmware using the i2c bit-banging code blocks the kernel. Move the firmware load code into a workqueue so that it plays well with other processes. Signed-off-by: Hans Verkuil <hverkuil@xs4all.nl> Signed-off-by: Mauro Carvalho Chehab <mchehab@infradead.org>
2007-10-09V4L/DVB (6051): cx25840: make proper use of SOFT_RESETHans Verkuil
Whenever the 0x80b register is used the microcontroller should be reset. Signed-off-by: Hans Verkuil <hverkuil@xs4all.nl> Signed-off-by: Mauro Carvalho Chehab <mchehab@infradead.org>
2007-10-09V4L/DVB (5999): cx25840: add radio support.Hans Verkuil
Signed-off-by: Hans Verkuil <hverkuil@xs4all.nl> Signed-off-by: Mauro Carvalho Chehab <mchehab@infradead.org>
2007-10-09V4L/DVB (5997): cx25840: fix audio mute handling and reportingHans Verkuil
Audio muting for the tuner input was implemented by stopping the audio microcontroller and restarting it on unmute. However, it appears that this method can actually crash the audio firmware. It's rare and seems to happen with NTSC only. It has been reimplemented by setting to volume to 0. In addition, the reporting of the mute state has been improved as well: it used to be impossible to detect whether the audio was muted by the user or if it was muted due to the microcontroller trying to detect the audio standard. This is now clearly stated. Signed-off-by: Hans Verkuil <hverkuil@xs4all.nl> Signed-off-by: Mauro Carvalho Chehab <mchehab@infradead.org>
2007-10-09V4L/DVB (5993): cx25840: resetting also requires reloading the firmwareHans Verkuil
Resetting without reloading the firmware is not enough. Sometimes the firmware is 'stuck' and needs to be reloaded. Signed-off-by: Hans Verkuil <hverkuil@xs4all.nl> Signed-off-by: Mauro Carvalho Chehab <mchehab@infradead.org>
2007-10-09V4L/DVB (5922): ivtv, cx25840: postpone fw load until first useHans Verkuil
The firmware is now loaded when the driver is actually used for the first time. This allows the driver to be compiled in-kernel instead of as a module. Signed-off-by: Hans Verkuil <hverkuil@xs4all.nl> Signed-off-by: Mauro Carvalho Chehab <mchehab@infradead.org>
2007-05-09V4L/DVB (5576): Improve / fix support for PAL-60 in cx25840Servaas Vandenberghe
This causes the cx25840 module to treat V4L2_STD_PAL_60 similar to other 60Hz timings, and it fixes a wrongly-named variable (timings are independant of color system). Acked-by: Hans Verkuil <hverkuil@xs4all.nl> Signed-off-by: Mike Isely <isely@pobox.com> Signed-off-by: Mauro Carvalho Chehab <mchehab@infradead.org>
2007-04-27V4L/DVB (5306): Add support for VIDIOC_G_CHIP_IDENTHans Verkuil
VIDIOC_G_CHIP_IDENT improves debugging of card problems: it can be used to detect which chips are on the board and based on that information selected register dumps can be made, making it easy to debug complicated media chips containing tens or hundreds of registers. This ioctl replaces the internal VIDIOC_INT_G_CHIP_IDENT ioctl. Signed-off-by: Hans Verkuil <hverkuil@xs4all.nl> Signed-off-by: Mauro Carvalho Chehab <mchehab@infradead.org>
2007-03-01V4L/DVB (5304): Improve chip matching in v4l2_registerHans Verkuil
The chip matching in struct v4l2_register for VIDIOC_DBG_G/S_REGISTER was rather primitive. It could not be extended to other busses besides i2c and it lacked a way to. Signed-off-by: Hans Verkuil <hverkuil@xs4all.nl> Signed-off-by: Mauro Carvalho Chehab <mchehab@infradead.org>