summaryrefslogtreecommitdiff
path: root/linux/drivers/media/video/v4l2-common.c
AgeCommit message (Collapse)Author
2007-11-02backport changeset 96de0e252cedffad61b3cb5e05662c591898e69aMauro Carvalho Chehab
From: Mauro Carvalho Chehab <mchehab@infradead.org> kernel-sync: Author: Jan Engelhardt <jengelh@gmx.de> Date: Fri Oct 19 23:21:04 2007 +0200 Convert files to UTF-8 and some cleanups * Convert files to UTF-8. * Also correct some people's names (one example is Eißfeldt, which was found in a source file. Given that the author used an ß at all in a source file indicates that the real name has in fact a 'ß' and not an 'ss', which is commonly used as a substitute for 'ß' when limited to 7bit.) * Correct town names (Goettingen -> Göttingen) * Update Eberhard Mönkeberg's address (http://lkml.org/lkml/2007/1/8/313) Signed-off-by: Mauro Carvalho Chehab <mchehab@infradead.org>
2007-09-18v4l2-common: minor cleanups.Hans Verkuil
From: Hans Verkuil <hverkuil@xs4all.nl> Signed-off-by: Hans Verkuil <hverkuil@xs4all.nl> Signed-off-by: Mauro Carvalho Chehab <mchehab@infradead.org> --- linux/drivers/media/video/v4l2-common.c | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-)
2007-09-16Use correct error codes when chip is not recognized.Hans Verkuil
From: Hans Verkuil <hverkuil@xs4all.nl> 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> --- linux/drivers/media/video/cs53l32a.c | 2 +- linux/drivers/media/video/cx25840/cx25840-core.c | 6 +++++- linux/drivers/media/video/msp3400-driver.c | 4 ++-- linux/drivers/media/video/saa7115.c | 4 ++-- linux/drivers/media/video/saa7127.c | 6 +++--- linux/drivers/media/video/tlv320aic23b.c | 2 +- linux/drivers/media/video/upd64031a.c | 2 +- linux/drivers/media/video/upd64083.c | 2 +- linux/drivers/media/video/v4l2-common.c | 2 +- linux/drivers/media/video/vp27smpx.c | 2 +- linux/drivers/media/video/wm8739.c | 4 ++++ 11 files changed, 22 insertions(+), 14 deletions(-)
2007-09-12v4l2: add support for bus-based I2C driversHans Verkuil
From: Hans Verkuil <hverkuil@xs4all.nl> Two new headers were added: one for I2C drivers that are only used by V4L2 drivers converted to the new bus-based I2C API, and one that can be used by both converted and unconverted drivers (at the expense of some additional overhead). To support the legacy I2C API a helper function was added to v4l2-common.c. These headers take care of all the 'boilerplate' code that all V4L2 I2C drivers have in common and will automatically support the bus-based I2C API introduced in kernel 2.6.22. Signed-off-by: Hans Verkuil <hverkuil@xs4all.nl> Signed-off-by: Mauro Carvalho Chehab <mchehab@infradead.org> --- linux/drivers/media/video/v4l2-common.c | 37 +++++ linux/include/media/v4l2-common.h | 11 + linux/include/media/v4l2-i2c-drv-legacy.h | 207 ++++++++++++++++++++++++++++++ linux/include/media/v4l2-i2c-drv.h | 199 ++++++++++++++++++++++++++++ 4 files changed, 454 insertions(+)
2007-10-18Replace TDA9887_SET_CONFIG by TUNER_SET_CONFIGMauro Carvalho Chehab
From: Mauro Carvalho Chehab <mchehab@infradead.org> Currently, the only tuner-specific device that allows special configurations is tda9887. However, tea5767 also may require some special configurations (for example, to specify a different Xtal freq). This patch replaces TDA9887_SET_CONFIG by a more generic internal ioctl (TUNER_SET_CONFIG). The newer one allows specifying what tuner is appliable to a configuration set, and allows an arbitrary configuration struct. Signed-off-by: Mauro Carvalho Chehab <mchehab@infradead.org>
2007-10-11Remove obsolete VIDIOC_S/G_MPEGCOMP ioctlsHans Verkuil
From: Hans Verkuil <hverkuil@xs4all.nl> Remove the obsolete VIDIOC_G_MPEGCOMP and VIDIOC_S_MPEGCOMP ioctls from the V4L2 API as per the removal schedule (October 2007). Signed-off-by: Hans Verkuil <hverkuil@xs4all.nl>
2007-10-08Remove reference to dead CONFIG_UST and ust.h header.Mauro Carvalho Chehab
From: "Robert P. J. Day" <rpjday@mindspring.com> Signed-off-by: Robert P. J. Day <rpjday@mindspring.com> Signed-off-by: Mauro Carvalho Chehab <mchehab@infradead.org>
2007-10-08compat: remove strlcpyMauro Carvalho Chehab
From: Mauro Carvalho Chehab <mchehab@infradead.org> This is already defined on compat.h Signed-off-by: Mauro Carvalho Chehab <mchehab@infradead.org>
2007-08-21cx2341x: some controls should not be changed while the device is busy.Hans Verkuil
From: Hans Verkuil <hverkuil@xs4all.nl> The driver should now pass the 'busy' state of the device to the cx2341x module whenever controls are set or tried. -EBUSY will be returned if the device is busy and the user attempts to modify certain 'dangerous' controls. It concerns controls that change the audio or video compression mode and bitrates. The cx88-blackbird and pvrusb2 drivers currently always pass '0' (not busy) to the cx2341x, effectively keeping the old behavior for now. Signed-off-by: Hans Verkuil <hverkuil@xs4all.nl>
2007-07-19Add check for valid control ID to v4l2_ctrl_next.Hans Verkuil
From: Hans Verkuil <hverkuil@xs4all.nl> If v4l2_ctrl_next is called without the V4L2_CTRL_FLAG_NEXT_CTRL then it should check whether the passed control ID is valid and return 0 if it isn't. Otherwise a for-loop over the control IDs will never end. Signed-off-by: Hans Verkuil <hverkuil@xs4all.nl>
2007-07-05v4l2: Update v4l_printk_ioctl_argTrent Piepho
From: Trent Piepho <xyzzy@speakeasy.org> v4l_printk_ioctl_arg() is a debug printing function that is normally disabled. It was out of date with one ioctl and had a couple bugs in it elsewhere. This patch gets it in a state where it will work correctly, if it was enabled and used. Signed-off-by: Trent Piepho <xyzzy@speakeasy.org>
2007-05-13Backport kernel changeset e63340ae6b6205fef26b40a75673d1c9c0c8bb90Mauro Carvalho Chehab
From: Mauro Carvalho Chehab kernel-sync: The original patch description, from Randy Dunlap <randy.dunlap@oracle.com>: header cleaning: don't include smp_lock.h when not used Remove includes of <linux/smp_lock.h> where it is not used/needed. Suggested by Al Viro. Builds cleanly on x86_64, i386, alpha, ia64, powerpc, sparc, sparc64, and arm (all 59 defconfigs). Signed-off-by: Mauro Carvalho Chehab <mchehab@infradead.org>
2007-02-27Improve VIDIOC_G_CHIP_IDENT (better diagnostics)Hans Verkuil
From: Hans Verkuil <hverkuil@xs4all.nl> Simplify the VIDIOC_G_CHIP_IDENT implementation by adding a single common function. The ident can now also return NONE: not found, UNKNOWN: found, but we don't know what chip it is, and AMBIGUOUS: multiple chips were matched so the match values were too general. Signed-off-by: Hans Verkuil <hverkuil@xs4all.nl>
2007-02-25Remove V4L2_CHIP_MATCH_ALWAYS.Hans Verkuil
From: Hans Verkuil <hverkuil@xs4all.nl> V4L2_CHIP_MATCH_ALWAYS turned out to be confusing and also unnecessary. It's now removed. Signed-off-by: Hans Verkuil <hverkuil@xs4all.nl>
2007-02-24Add support for VIDIOC_G_CHIP_IDENTHans Verkuil
From: Hans Verkuil <hverkuil@xs4all.nl> 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> CC: Jonathan Corbet <corbet@lwn.net>
2007-02-24Mark VIDIOC_DBG_S/G_REGISTER as experimental, but no longer internalHans Verkuil
From: Hans Verkuil <hverkuil@xs4all.nl> Move VIDIOC_DBG_S/G_REGISTER from the internal ioctl list to the public ioctls, but mark it as experimental for now. Signed-off-by: Hans Verkuil <hverkuil@xs4all.nl> CC: Trent Piepho <xyzzy@speakeasy.org>
2007-02-24Improve chip matching in v4l2_register for VIDIOC_DBG_G/S_REGISTERHans Verkuil
From: Hans Verkuil <hverkuil@xs4all.nl> The chip matching in struct v4l2_register was rather primitive. It could not be extended to other busses besides i2c and it lacked a way to differentiate between two i2c chips driven by the same driver on one board (e.g. a PVR500 with two tuner chips, one for analog TV and one for radio). It has now been improved making it much more powerful. Signed-off-by: Hans Verkuil <hverkuil@xs4all.nl> CC: Mike Isely <isely@isely.net> CC: Trent Piepho <xyzzy@speakeasy.org>
2007-02-21Add support for VIDIOC_INT_G/S_STD_OUTPUTHans Verkuil
From: Hans Verkuil <hverkuil@xs4all.nl> Added VIDIOC_INT_G_STD_OUTPUT and VIDIOC_INT_S_STD_OUTPUT to allow drivers to set the TV standard for video output separately from the video capture. This is needed for cx23415 support where the decoder is separate from the encoder and can have a different TV standard. Modified the saa7127 module to listen to VIDIOC_INT_G/S_STD_OUTPUT instead of VIDIOC_G/S_STD. Signed-off-by: Hans Verkuil <hverkuil@xs4all.nl>
2007-02-21Add support for video output overlays.Hans Verkuil
From: Hans Verkuil <hverkuil@xs4all.nl> Add V4L2_BUF_TYPE_VIDEO_OUTPUT_OVERLAY support. Also add support for local and global alpha overlays. Add new field enums V4L2_FIELD_INTERLACED_TB and V4L2_FIELD_INTERLACED_BT. These changes are needed to support the ivtv On Screen Display features. Signed-off-by: Hans Verkuil <hverkuil@xs4all.nl>
2007-02-21Backport of git changeset cd354f1ae75e6466a7e31b727faede57a1f89ca5Mauro Carvalho Chehab
From: Mauro Carvalho Chehab <mchehab@infradead.org> Backport a changeset from Schmielau <tim@physik3.uni-rostock.de> that removes uneeded includes for linux/sched.h Signed-off-by: Mauro Carvalho Chehab <mchehab@infradead.org>
2007-02-21merge: http://linuxtv.org/hg/~hverkuil/v4l-dvbMauro Carvalho Chehab
From: Mauro Carvalho Chehab <mchehab@infradead.org> Signed-off-by: Mauro Carvalho Chehab <mchehab@infradead.org>
2007-02-20Split VIDEO_MUTE into MUTE and MUTE_YUVHans Verkuil
From: Hans Verkuil <hverkuil@xs4all.nl> It is bad practice to basically combine two functions (mute on/off and precise video mute YUV value) in one control. Split them. Also ensure that the default mute value is black. Signed-off-by: Hans Verkuil <hverkuil@xs4all.nl>
2007-02-19compat: Add -include linux/version.h to cflagsTrent Piepho
From: Trent Piepho <xyzzy@speakeasy.org> Add -include linux/version.h to the cflags. Now code can have backward compatibility test without including compat.h first. Linux headers included from compat.h are removed, so that code will get the same headers when compiling in v4l-dvb as it does in the kernel. Many drivers have compat.h moved to the end of their include list, as this lets compat.h do things it can't do at the beginning. Such as test of something is defined to include compat code, or to put a wrapper around a function without changing the function's name. Signed-off-by: Trent Piepho <xyzzy@speakeasy.org>
2007-02-18Add VIDIOC_TRY_ENCODER_CMD and VIDIOC_ENCODER_CMD ioctls.Hans Verkuil
From: Hans Verkuil <hverkuil@xs4all.nl> Add support for starting, stopping, pausing and resuming an MPEG (or similar compressed stream) encoder. Signed-off-by: Hans Verkuil <hverkuil@xs4all.nl>
2007-02-18Add VIDIOC_G_ENC_INDEX ioctlHans Verkuil
From: Hans Verkuil <hverkuil@xs4all.nl> The VIDIOC_G_ENC_INDEX ioctl can obtain the MPEG index from an MPEG encoder. Signed-off-by: Hans Verkuil <hverkuil@xs4all.nl>
2007-02-18Add support for three new MPEG controls.Hans Verkuil
From: Hans Verkuil <hverkuil@xs4all.nl> Added V4L2_CID_MPEG_AUDIO_MUTE, V4L2_CID_MPEG_VIDEO_MUTE and V4L2_CID_MPEG_CX2341X_STREAM_INSERT_NAV_PACKETS controls together with their implementation in the cx2341x module. Signed-off-by: Hans Verkuil <hverkuil@xs4all.nl>
2007-02-06From: Adrian Bunk <bunk@stusta.de>Mauro Carvalho Chehab
v4l_printk_ioctl_arg() is no longer used. Signed-off-by: Adrian Bunk <bunk@stusta.de> Signed-off-by: Andrew Morton <akpm@linux-foundation.org> Signed-off-by: Mauro Carvalho Chehab <mchehab@infradead.org>
2007-01-30Change VIDIOC_DBG_[SG]_REGISTER ioctls' register address to 64 bitsTrent Piepho
From: Trent Piepho <xyzzy@speakeasy.org> Maybe someday there will be a device with a register address space > 32-bits, or maybe an i2c device which uses a protocol > 4 bytes long to address its registers. Signed-off-by: Trent Piepho <xyzzy@speakeasy.org>
2007-01-23Make VIDIOC_INT_[SG]_REGISTER ioctls no longer internal onlyTrent Piepho
From: Trent Piepho <xyzzy@speakeasy.org> The direct register access ioctls were defined as kernel internal only, but they are very useful for debugging hardware from userspace and are used as such. Officially export them. VIDIOC_INT_[SG]_REGISTER is renamed to VIDIOC_DBG_[SG]_REGISTER Definition of ioctl and struct v4l2_register is moved from v4l2-common.h to videodev2.h. Types used in struct v4l2_register are changed to the userspace exportable versions (u32 -> __u32, etc). Use of VIDIOC_DBG_S_REGISTER requires CAP_SYS_ADMIN permission, so move the check into the video_ioctl2() dispatcher so it doesn't need to be duplicated in each driver's call-back function. CAP_SYS_ADMIN check is added to pvrusb2 (which doesn't use video_ioctl2). Signed-off-by: Trent Piepho <xyzzy@speakeasy.org>
2007-01-09Fix authorship referencesMauro Carvalho Chehab
From: Mauro Carvalho Chehab <mchehab@infradead.org> Bill Dirks asked me to update his entries at kernel files, since he change his e-mail. I've also updated a few web broken links or obsolete info to the curent sites where V4L drivers and API are being discussed currently. CC: Bill Dirks <bill@thedirks.org> Signed-off-by: Mauro Carvalho Chehab <mchehab@infradead.org>
2007-01-07Fix compilation on ppc32 architectureMauro Carvalho Chehab
From: Mauro Carvalho Chehab <mchehab@infradead.org> There's a problem, pointed by Meelis Roos <mroos@linux.ee>, that, on ppc32 arch, with some gcc versions (noticed with prerelease 4.1.2 20061115), compilation fails, due the lack of __ucmpdi2 to do the required 64-bit comparision. This patch takes some sugestions made by Andrew Morton <akpm@osdl.org>, Stelian Pop <stelian@popies.net> and Segher Boessenkool <segher@kernel.crashing.org> Signed-off-by: Mauro Carvalho Chehab <mchehab@infradead.org>
2006-11-20Remove the need of a STD array for drivers using video_ioctl2Mauro Carvalho Chehab
From: Mauro Carvalho Chehab <mchehab@infradead.org> CC: Jonathan Corbet <corbet@lwn.net> video_ioctl2 will auto-generate standard entries at ENUM_FMT. Also, now, a driver may return a subset of the video array at the return, to be stored as the current_norm. For example, a driver may ask for V4L2_STD_PAL. At return, driver may change it to V4L2_STD_PAL_B. This way, a futher call to G_STD will return the exact detected video std. Signed-off-by: Mauro Carvalho Chehab <mchehab@infradead.org>
2006-11-16Start adding v4l2_mmap_bufs to prepare for streamMauro Carvalho Chehab
From: Mauro Carvalho Chehab <mchehab@infradead.org> This method requests buffers and maps it into a mmaped memory. Still under testing. Still need other stuff to make stream to work. Signed-off-by: Mauro Carvalho Chehab <mchehab@infradead.org>
2006-08-26Add u32 argument to VIDIOC_INT_RESET.Hans Verkuil
From: Hans Verkuil <hverkuil@xs4all.nl> The extra argument makes it possible to reset subsystems of a chip if that is supported. Signed-off-by: Hans Verkuil <hverkuil@xs4all.nl>
2006-07-30Fix a typo that caused some compat stuff to not workMauro Carvalho Chehab
From: Mauro Carvalho Chehab <mchehab@infradead.org> Config option typo: -#ifdef CONFIG_V4L1_COMPAT +#ifdef CONFIG_VIDEO_V4L1_COMPAT Signed-off-by: Mauro Carvalho Chehab <mchehab@infradead.org>
2006-07-23Fix for compilation without V4L1 or V4L1_COMPATMauro Carvalho Chehab
From: Mauro Carvalho Chehab <mchehab@infradead.org> Removed usage of HAVE_V4L1 Including videodev.h will just include videodev2.h if V4L1 is not supported V4L1 code at core drivers will honor CONFIG_V4L1_COMPAT stuff Signed-off-by: Mauro Carvalho Chehab <mchehab@infradead.org>
2006-07-19Several other backports from kernel to v4l/dvb treeMauro Carvalho Chehab
From: Mauro Carvalho Chehab <mchehab@infradead.org> kernel-sync: Signed-off-by: Mauro Carvalho Chehab <mchehab@infradead.org>
2006-06-25IVTV VBI format description too long.Hans Verkuil
From: Hans Verkuil <hverkuil@xs4all.nl> Format description was cut off. It's been shortened. Signed-off-by: Hans Verkuil <hverkuil@xs4all.nl>
2006-06-24Add V4L2_CID_MPEG_STREAM_VBI_FMT controlHans Verkuil
From: Hans Verkuil <hverkuil@xs4all.nl> V4L2_CID_MPEG_STREAM_VBI_FMT controls if and how VBI data is embedded in an MPEG stream. Currently only one format is supported: the format designed for the ivtv driver. This should be extended with new standard formats (such as defined for DVB) in the future. Signed-off-by: Hans Verkuil <hverkuil@xs4all.nl>
2006-06-23merge: http://linuxtv.org/hg/~hverkuil/mpeg-apiMauro Carvalho Chehab
From: Mauro Carvalho Chehab <mchehab@infradead.org> Signed-off-by: Mauro Carvalho Chehab <mchehab@infradead.org>
2006-06-23fix userbits debug printsMauro Carvalho Chehab
From: Mauro Carvalho Chehab <mchehab@infradead.org> Previously, it were showing the pointer value, instead of the setted bits. Signed-off-by: Mauro Carvalho Chehab <mchehab@infradead.org>
2006-06-18Add helper functions for control processing to v4l2-common.Hans Verkuil
From: Hans Verkuil <hverkuil@xs4all.nl> Control processing is often duplicated in the various drivers. Unfortunately, simple things like the names of controls are often different between drivers, even though it is the same controls. Adding in the new extended controls and the need for having control helper functions became apparent. Several functions have now been added to v4l2-common to do things like filling the v4l2_queryctrl and v4l2_querymenu structs, to check for valid control input and to move to the next control when enumerating over all controls. Signed-off-by: Hans Verkuil <hverkuil@xs4all.nl>
2006-06-04Several improvements at videodev.cMauro Carvalho Chehab
From: Mauro Carvalho Chehab <mchehab@infradead.org> Videodev now is capable of better handling V4L2 api, by processing V4L2 ioctls and using callbacks to the driver. The drivers should be migrated to the newer way and the older one will be obsoleted soon. Signed-off-by: Mauro Carvalho Chehab <mchehab@infradead.org>
2006-04-02Add support for VIDIOC_INT_S_CRYSTAL_FREQ internal command.Hans Verkuil
From: Hans Verkuil <hverkuil@xs4all.nl> Some saa7115-based cards use a different crystal frequency and a different audio clock generation. Add a new VIDIOC_INT_S_CRYSTAL_FREQ command to be able to set these values. Also change the default APLL setting to 0. It makes no sense to have the audio clock independent from the video clock, this can lead to audio/video synchronization problems. Setting this to 0 is also consistent with the old saa7114.c source and the way the Hauppauge Windows driver sets it. Signed-off-by: Hans Verkuil <hverkuil@xs4all.nl>
2006-04-01More msp3400 and bttv fixesHans Verkuil
From: Hans Verkuil <hverkuil@xs4all.nl> - remove obsolete VIDIOC_S_INPUT i2c call in bttv - translate VIDIOCSFREQ to VIDIOC_S_FREQUENCY in i2c call - improve muting during carrier scan in msp3400 - don't start scan unless really needed. - no longer reset chip for msp3400c/d. - remove v4l2 check in tuner-core (radio stops after using the TV) - add missing VIDIOC_INT_ strings in v4l2-common.c Signed-off-by: Hans Verkuil <hverkuil@xs4all.nl>
2006-03-25V4l printk fixMauro Carvalho Chehab
From: Andrew Morton <akpm@osdl.org> drivers/media/video/v4l2-common.c: In function `v4l_printk_ioctl_arg': drivers/media/video/v4l2-common.c:477: warning: `0' flag used with `%p' printf format Someone went and "improved" my patch ;) Signed-off-by: Andrew Morton <akpm@osdl.org> Signed-off-by: Mauro Carvalho Chehab <mchehab@infradead.org>
2006-03-24Fixes weird characters and printkMauro Carvalho Chehab
From: Mauro Carvalho Chehab <mchehab@infradead.org> kernel-sync Signed-off-by: Mauro Carvalho Chehab <mchehab@infradead.org>
2006-03-23Merge from hverkuil routing treeMauro Carvalho Chehab
From: Mauro Carvalho Chehab <mchehab@infradead.org> merge: Signed-off-by: Mauro Carvalho Chehab <mchehab@infradead.org>
2006-03-22Printk warning fixesMauro Carvalho Chehab
From: Andrew Morton <akpm@osdl.org> On ppc64, u64 is `unsigned long' drivers/media/video/v4l2-common.c: In function `v4l_printk_ioctl_arg': drivers/media/video/v4l2-common.c:486: warning: cast from pointer to integer of different size drivers/media/video/v4l2-common.c:580: warning: long long int format, v4l2_std_id arg (arg 8) drivers/media/video/v4l2-common.c:625: warning: long long int format, v4l2_std_id arg (arg 8) drivers/media/video/v4l2-common.c:693: warning: long long int format, v4l2_std_id arg (arg 4) drivers/media/video/v4l2-common.c:910: warning: long long unsigned int format, long unsigned int a$ Signed-off-by: Andrew Morton <akpm@osdl.org> Signed-off-by: Mauro Carvalho Chehab <mchehab@infradead.org>
2006-03-19Implement correct msp3400 input/output routingHans Verkuil
From: Hans Verkuil <hverkuil@xs4all.nl> - implement VIDIOC_INT_S_AUDIO_ROUTING for msp3400 and tvaudio - use the new command in bttv, pvrusb2 and em28xx. - remove the now obsolete MSP_SET_MATRIX from msp3400 (yeah!) - remove the obsolete VIDIOC_S_AUDIO from msp3400. Signed-off-by: Hans Verkuil <hverkuil@xs4all.nl>