summaryrefslogtreecommitdiff
path: root/drivers/media/video/v4l2-common.c
AgeCommit message (Collapse)Author
2011-07-27[media] v4l2-ctrls: add new bitmask control typeHans Verkuil
Signed-off-by: Hans Verkuil <hans.verkuil@cisco.com> Reviewed-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com> Acked-by: Sakari Ailus <sakari.ailus@iki.fi> Signed-off-by: Mauro Carvalho Chehab <mchehab@redhat.com>
2011-03-22[media] v4l2_prio: move from v4l2-common to v4l2-devHans Verkuil
We are going to move priority handling into the v4l2 core. As a consequence the v4l2_prio helper functions need to be moved into the core videodev module as well to prevent circular dependencies. Signed-off-by: Hans Verkuil <hverkuil@xs4all.nl> Signed-off-by: Mauro Carvalho Chehab <mchehab@redhat.com>
2011-03-21[media] v4l: removal of old, obsolete ioctlsHans Verkuil
Some ioctl's were defined wrong on 2.6.2 and 2.6.6, using the wrong type of R/W arguments. They were fixed, but the old ioctl names are still there, maintained to avoid breaking binary compatibility: There's no sense on preserving those forever, as it is very doubtful that someone would try to use a such old binary with a modern kernel. Removing them will allow us to remove some magic done at the V4L ioctl handler. Note that any application compiled with a videodev2.h from 2.6.7 or later will be using the correct ioctls. Signed-off-by: Hans Verkuil <hverkuil@xs4all.nl> Signed-off-by: Mauro Carvalho Chehab <mchehab@redhat.com>
2011-01-19[media] v4l2-subdev: remove core.s_config and v4l2_i2c_new_subdev_cfg()Hans Verkuil
The core.s_config op was meant for legacy drivers that needed to work with old pre-2.6.26 kernels. This is no longer relevant. Unfortunately, this op was incorrectly called from several drivers. Replace those occurences with proper i2c_board_info structs and call v4l2_i2c_new_subdev_board. After these changes v4l2_i2c_new_subdev_cfg() was no longer used, so remove that function as well. Signed-off-by: Hans Verkuil <hverkuil@xs4all.nl> Acked-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com> Signed-off-by: Mauro Carvalho Chehab <mchehab@redhat.com>
2010-12-30[media] v4l2-ctrls: use const char * const * for the menu arraysHans Verkuil
This prevents checkpatch warnings generated when defining 'static const char *foo[]' arrays. It makes sense to use const char * const * anyway since the pointers in the array are indeed const. Signed-off-by: Hans Verkuil <hverkuil@xs4all.nl> Signed-off-by: Mauro Carvalho Chehab <mchehab@redhat.com>
2010-11-22[media] v4l: Remove module_name argument to the v4l2_i2c_new_subdev* functionsLaurent Pinchart
The argument isn't used anymore by the functions, remove it. Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com> Signed-off-by: Mauro Carvalho Chehab <mchehab@redhat.com>
2010-10-22[media] v4l: Load I2C modules based on modaliasLaurent Pinchart
When creating a new sub-device, The V4L I2C subdev API has historically required drivers to pass the name of the module that implements support for the I2C device. I2C modules can be loaded based on modaliases instead of the module name. As the I2C device type name is already available to the v4l2_i2c_new_subdev* functions, make the module name argument optional and create a modalias based on the type name when no module name is provided. All in-tree drivers call those functions with a non-NULL module name argument, this change is thus harmless. Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com> Signed-off-by: Mauro Carvalho Chehab <mchehab@redhat.com>
2010-10-21V4L/DVB: v4l2-common: Move v4l2_find_nearest_format from videodev2.h to ↵Hans Verkuil
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-21V4L/DVB: V4L2: add a generic function to find the nearest discrete format to ↵Guennadi Liakhovetski
the required one Many video drivers implement a fixed set of frame formats and thus face a task of finding the best match for a user-requested format. Implementing this in a generic function has also an advantage, that different drivers with similar supported format sets will select the same format for the user, which improves consistency across drivers. Signed-off-by: Guennadi Liakhovetski <g.liakhovetski@gmx.de> Signed-off-by: Mauro Carvalho Chehab <mchehab@redhat.com>
2010-08-11i2c: Add support for custom probe functionJean Delvare
The probe method used by i2c_new_probed_device() may not be suitable for all cases. Let the caller provide its own, optional probe function. Signed-off-by: Jean Delvare <khali@linux-fr.org> Acked-by: Mauro Carvalho Chehab <mchehab@redhat.com>
2010-08-08V4L/DVB: v4l2: Add new control handling frameworkHans Verkuil
Add a new framework to handle controls which makes life for driver developers much easier. Note that this patch moves some of the control support that used to be in v4l2-common.c to v4l2-ctrls.c. The tables were copied unchanged. The body of v4l2_ctrl_query_fill() was copied to a new v4l2_ctrl_fill() function in v4l2-ctrls.c. This new function doesn't use the v4l2_queryctrl struct anymore, which makes it more general. The remainder of v4l2-ctrls.c is all new. Highlights include: - No need to implement VIDIOC_QUERYCTRL, QUERYMENU, S_CTRL, G_CTRL, S_EXT_CTRLS, G_EXT_CTRLS or TRY_EXT_CTRLS in either bridge drivers or subdevs. New wrapper functions are provided that can just be plugged in. Once everything has been converted these wrapper functions can be removed as well. - When subdevices are added their controls can be automatically merged with the bridge driver's controls. - Most drivers just need to implement s_ctrl to set the controls. The framework handles the locking and tries to be as 'atomic' as possible. - Ready for the subdev device nodes: the same mechanism applies to subdevs and their device nodes as well. Sub-device drivers can make controls local, preventing them from being merged with bridge drivers. - Takes care of backwards compatibility handling of VIDIOC_S_CTRL and VIDIOC_G_CTRL. Handling of V4L2_CID_PRIVATE_BASE is fully transparent. CTRL_CLASS controls are automatically added. Signed-off-by: Hans Verkuil <hverkuil@xs4all.nl> Reviewed-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com> Signed-off-by: Mauro Carvalho Chehab <mchehab@redhat.com>
2010-05-19V4L/DVB: v4l2-common: simplify prio utility functionsHans Verkuil
v4l2_prio_init/open/close returned an int when in fact they would always return 0. Make these void functions. v4l2_prio_close and v4l2_prio_check pass an enum v4l2_priority as a pointer for no good reason. Replace with a normal enum v4l2_priority argument. These changes will simplify the work of moving priority handling into the v4l core. Signed-off-by: Hans Verkuil <hverkuil@xs4all.nl> Signed-off-by: Mauro Carvalho Chehab <mchehab@redhat.com>
2010-05-19V4L/DVB: core: add support for more color effectsXiaolin Zhang
Add support for more color effects (negative, sketch, emboss, etc) by extending the v4l2_colorfx enum items. Signed-off-by: Xiaolin Zhang <xiaolin.zhang@intel.com> Signed-off-by: Mauro Carvalho Chehab <mchehab@redhat.com>
2010-05-18V4L/DVB: v4l: Add V4L2_CID_IRIS_ABSOLUTE and V4L2_CID_IRIS_RELATIVE controlsLaurent Pinchart
Those control, as their names imply, control the camera aperture settings. Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com> Signed-off-by: Mauro Carvalho Chehab <mchehab@redhat.com>
2010-05-18V4L/DVB: Add SPI support to V4L2Dmitri Belimov
Add support SPI bus to v4l2. Useful for control some device with SPI bus like hardware MPEG2 encoders and etc. Signed-off-by: Beholder Intl. Ltd. Dmitry Belimov <d.belimov@gmail.com> Signed-off-by: Hans Verkuil <hverkuil@xs4all.nl> Signed-off-by: Mauro Carvalho Chehab <mchehab@redhat.com>
2010-05-18V4L/DVB: v4l2-common: add ability to use v4l2_ctrl_query_fill for chroma gainDevin Heitmueller
Add the ability to use the v4l2_ctrl_query_fill() function for the newly introduced chroma gain control. Also, make use of the centralized function by the one caller. This work was sponsored by EyeMagnet Limited. Signed-off-by: Devin Heitmueller <dheitmueller@kernellabs.com> Signed-off-by: Mauro Carvalho Chehab <mchehab@redhat.com>
2010-05-18V4L/DVB: v4l2_ctrl_get_name(): add missing control names, and make title ↵Frank Schaefer
for V4L2_CID_BG_COLOR consistent v4l2_ctrl_get_name(): add missing control names, and make title for V4L2_CID_BG_COLOR consistent V4L2_CID_AUTOBRIGHTNESS was introduced with kernel 2.6.31 V4L2_CID_BAND_STOP_FILTER was introduced with kernel 2.6.32 Signed-off-by: Frank Schaefer <fschaefer.oss@googlemail.com> Signed-off-by: Mauro Carvalho Chehab <mchehab@redhat.com>
2009-12-16V4L/DVB (13618): v4l2: Adding helper function to get dv preset descriptionMuralidharan Karicheri
This patch adds a helper function to get description of a digital video preset added by the video timing API. This will be useful for drivers implementing the above API. Signed-off-by: Muralidharan Karicheri <m-karicheri2@ti.com> Signed-off-by: Hans Verkuil <hverkuil@xs4all.nl> Signed-off-by: Mauro Carvalho Chehab <mchehab@redhat.com>
2009-12-05V4L/DVB (13467): V4L2: Added CID's V4L2_CID_ROTATE/BG_COLORVaibhav Hiremath
Signed-off-by: Vaibhav Hiremath <hvaibhav@ti.com> Signed-off-by: Hans Verkuil <hverkuil@xs4all.nl> Signed-off-by: Mauro Carvalho Chehab <mchehab@redhat.com>
2009-09-19V4L/DVB (12540): v4l: simplify v4l2_i2c_new_subdev and friendsHans Verkuil
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-12V4L/DVB (12549): v4l2: video device: Add FM TX controls default configurationsEduardo Valentin
This patch adds basic configurations for FM TX extended controls. That includes controls names, menu strings, pointer identification, type classification and flags configuration. Signed-off-by: Eduardo Valentin <eduardo.valentin@nokia.com> Signed-off-by: Hans Verkuil <hverkuil@xs4all.nl> Signed-off-by: Mauro Carvalho Chehab <mchehab@redhat.com>
2009-09-12V4L/DVB (12543): v4l: introduce string control support.Hans Verkuil
The upcoming RDS encoder needs support for string controls. This patch implements the core implementation. Signed-off-by: Hans Verkuil <hverkuil@xs4all.nl> Signed-off-by: Mauro Carvalho Chehab <mchehab@redhat.com>
2009-06-23V4L/DVB (12003): v4l2: Move bounding code outside I2C ifdef blockTrent Piepho
On Fri, 12 Jun 2009, Randy Dunlap wrote: > From: Randy Dunlap <randy.dunlap@oracle.com> > > Move v4l_bound_align_image() outside of an #ifdef CONFIG_I2C block > so that it is always built. Fixes a build error: clamp_align() should be moved as well, since it's only used by v4l_bound_align_image(). I'm attaching an alternate version that fixes this. Labeled the endif too. Reported-by: Randy Dunlap <randy.dunlap@oracle.com> Signed-off-by: Trent Piepho <xyzzy@speakeasy.org> Signed-off-by: Mauro Carvalho Chehab <mchehab@redhat.com>
2009-06-23V4L/DVB (11901): v4l2: Create helper function for bounding and aligning imagesTrent Piepho
Most hardware has limits on minimum and maximum image dimensions and also requirements about alignment. For example, image width must be even or a multiple of four. Some hardware has requirements that the total image size (width * height) be a multiple of some power of two. v4l_bound_align_image() will enforce min and max width and height, power of two alignment on width and height, and power of two alignment on total image size. It uses an efficient algorithm that will try to find the "closest" image size that meets the requirements. Signed-off-by: Trent Piepho <xyzzy@speakeasy.org> Signed-off-by: Mauro Carvalho Chehab <mchehab@redhat.com>
2009-06-23V4L/DVB (12125): v4l2: add new s_config subdev ops and ↵Hans Verkuil
v4l2_i2c_new_subdev_cfg/board calls Add a new s_config core ops call: this is called with the irq and platform data to be used to initialize the subdev. Added new v4l2_i2c_new_subdev_cfg and v4l2_i2c_new_subdev_board calls that allows you to pass these new arguments. The existing v4l2_i2c_new_subdev functions were modified to also call s_config. In the future the existing v4l2_i2c_new_subdev functions will be replaced by a single v4l2_i2c_new_subdev function similar to v4l2_i2c_new_subdev_cfg but without the irq and platform_data arguments. Signed-off-by: Hans Verkuil <hverkuil@xs4all.nl> Signed-off-by: Mauro Carvalho Chehab <mchehab@redhat.com>
2009-06-16V4L/DVB (11673): v4l2-device: unregister i2c_clients when unregistering the ↵Hans Verkuil
v4l2_device. Until now I relied on i2c_del_adapter to unregister the i2c_clients for me, however, if the i2c bus is a platform bus then it is never deleted. So instead I need to unregister i2c clients when unregistering the v4l2_device. Signed-off-by: Hans Verkuil <hverkuil@xs4all.nl> Signed-off-by: Mauro Carvalho Chehab <mchehab@redhat.com>
2009-06-16V4L/DVB (11670): tuner: remove tuner_i2c_address_checkHans Verkuil
Support for tuners with i2c addresses >= 0x65 is dropped since no tuners with addresses in the range 0x65-0x6f have been found. This patch removes addresses 0x65-0x6f from the list of tuner probe addresses, it removes the kernel warning that warned if addresses in this range appeared, and it removed a hack for the cx88 that is no longer needed now that the tuner address range is reduced. Signed-off-by: Hans Verkuil <hverkuil@xs4all.nl> Signed-off-by: Mauro Carvalho Chehab <mchehab@redhat.com>
2009-04-06V4L/DVB (11373): v4l2-common: add explicit v4l2_device pointer as first arg ↵Hans Verkuil
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-06V4L/DVB (11374): v4l2-common: add v4l2_i2c_new_probed_subdev_addrHans Verkuil
Add utility function to probe for a single address, rather than a list of addresses. Signed-off-by: Hans Verkuil <hverkuil@xs4all.nl> Signed-off-by: Mauro Carvalho Chehab <mchehab@redhat.com>
2009-04-06V4L/DVB (11367): v4l2-common: remove legacy codeHans Verkuil
Now that all drivers are converted to v4l2_subdev we can remove legacy code in v4l2-common. Also move the documentation of the internal API to v4l2-subdev.h where it really belongs. Signed-off-by: Hans Verkuil <hverkuil@xs4all.nl> Signed-off-by: Mauro Carvalho Chehab <mchehab@redhat.com>
2009-03-30V4L/DVB (11098): v4l2-common: remove incorrect MODULE testHans Verkuil
v4l2-common doesn't have to be a module for it to call request_module(). Just remove that test. Thanks-to: Guennadi Liakhovetski <g.liakhovetski@gmx.de> Signed-off-by: Hans Verkuil <hverkuil@xs4all.nl> Signed-off-by: Mauro Carvalho Chehab <mchehab@redhat.com>
2009-03-30V4L/DVB (11095): adds V4L2_CID_SHARPNESS to v4l2_ctrl_query_fill()Janne Grunau
Signed-off-by: Janne Grunau <j@jannau.net> Signed-off-by: Mauro Carvalho Chehab <mchehab@redhat.com>
2009-03-30V4L/DVB (10983): v4l2-common: add missing i2c_unregister_device.Hans Verkuil
If the i2c sub-device cannot be found, then we must unregister the i2c_client. Otherwise this will prevent a possible probe for a different device on that same address. 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 (10691): v4l2-common: add v4l2_i2c_subdev_addr()Hans Verkuil
Add small function to retrieve the i2c address from a v4l2_subdev pointer. Signed-off-by: Hans Verkuil <hverkuil@xs4all.nl> Signed-off-by: Mauro Carvalho Chehab <mchehab@redhat.com>
2009-03-30V4L/DVB (10687): v4l2-common/v4l2-spec: support/document write-only and ↵Hans Verkuil
button controls The controls V4L2_CID_PAN_RESET and V4L2_CID_TILT_RESET changed their type to button controls (these are unused at the moment, so this is a safe change). The controls V4L2_CID_PAN_RELATIVE, V4L2_CID_TILT_RELATIVE, V4L2_CID_FOCUS_RELATIVE and V4L2_CID_ZOOM_RELATIVE are marked as write-only controls. Cc: Laurent Pinchart <laurent.pinchart@skynet.be> Signed-off-by: Hans Verkuil <hverkuil@xs4all.nl> Signed-off-by: Mauro Carvalho Chehab <mchehab@redhat.com>
2009-03-30V4L/DVB (10685): v4l2: add colorfx support to v4l2-common.c, and add to ↵Hans Verkuil
'Changes' in spec. Signed-off-by: Hans Verkuil <hverkuil@xs4all.nl> Signed-off-by: Mauro Carvalho Chehab <mchehab@redhat.com>
2009-03-30V4L/DVB (10544): v4l2-common: add comments warning that about the sort orderHans Verkuil
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-30V4L/DVB (10249): v4l2-common: added v4l2_i2c_tuner_addrs()Hans Verkuil
Add v4l2_i2c_tuner_addrs() to obtain the various I2C tuner addresses. This will be used in several drivers, so make this a common function as we do not want to have these I2C addresses all over the place. Signed-off-by: Hans Verkuil <hverkuil@xs4all.nl> Signed-off-by: Mauro Carvalho Chehab <mchehab@redhat.com>
2009-03-30V4L/DVB (10244): v4l2: replace a few snprintfs with strlcpyHans Verkuil
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 (9899): v4l2: Add missing control namesLaurent Pinchart
Update v4l2_ctrl_get_name() and v4l2_ctrl_get_menu() with missing control names and menu values. Signed-off-by: Laurent Pinchart <laurent.pinchart@skynet.be> Signed-off-by: Mauro Carvalho Chehab <mchehab@redhat.com>
2008-12-30V4L/DVB (9821): v4l2-common: add i2c helper functionsHans Verkuil
Add helper functions to load i2c sub-devices, integrating them into the v4l2-framework. Signed-off-by: Hans Verkuil <hverkuil@xs4all.nl> Signed-off-by: Mauro Carvalho Chehab <mchehab@redhat.com>
2008-12-29V4L/DVB (9491): rationalise addresses to one common oneAlan Cox
Signed-off-by: Alan Cox <alan@redhat.com> Signed-off-by: Mauro Carvalho Chehab <mchehab@redhat.com>
2008-10-17remove CONFIG_KMOD from driversJohannes Berg
Straight forward conversions to CONFIG_MODULE; many drivers include <linux/kmod.h> conditionally and then don't have any other conditional code so remove it from those. Signed-off-by: Johannes Berg <johannes@sipsolutions.net> Cc: video4linux-list@redhat.com Cc: David Woodhouse <dwmw2@infradead.org> Cc: linux-ppp@vger.kernel.org Cc: dm-devel@redhat.com Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
2008-10-12V4L/DVB (8649): v4l2: add AAC bitrate controlHans Verkuil
If you can select AAC as audio encoder, then you should also be able to set the bitrate. Add this missing control. Signed-off-by: Hans Verkuil <hverkuil@xs4all.nl> Signed-off-by: Mauro Carvalho Chehab <mchehab@redhat.com>
2008-10-12V4L/DVB (8639): saa6752hs: cleanup and add AC-3 supportHans Verkuil
Cleaned up the saa6752hs i2c driver. Add AC-3 support. Add VIDIOC_CHIP_IDENT support. Signed-off-by: Hans Verkuil <hverkuil@xs4all.nl> Signed-off-by: Mauro Carvalho Chehab <mchehab@redhat.com>
2008-10-12V4L/DVB (8637): v4l2: add v4l2_ctrl_query_menu_valid_items support functionHans Verkuil
v4l2_ctrl_query_menu_valid_items() makes it easy to handle control menus that have a lot of invalid 'holes'. For example, many MPEG encoders only support a limited subset of audio bitrates. In that case a driver can specify an array listing the set of valid bitrates and pass that to this function. Signed-off-by: Hans Verkuil <hverkuil@xs4all.nl> Signed-off-by: Mauro Carvalho Chehab <mchehab@redhat.com>
2008-10-12V4L/DVB (8636): v4l2: add v4l2_ctrl_get_name control support function.Hans Verkuil
Add function that returns the control name. Allows this to be used in places where the normal v4l2_ctrl_query_fill() function cannot be used (e.g. uvc). Signed-off-by: Hans Verkuil <hverkuil@xs4all.nl> Signed-off-by: Mauro Carvalho Chehab <mchehab@redhat.com>
2008-10-12V4L/DVB (8635): v4l: add AC-3 audio support to the MPEG Encoding APIHans Verkuil
Some models of the saa6752hs support AC-3. Extend the API with the necessary controls for AC-3. Signed-off-by: Hans Verkuil <hverkuil@xs4all.nl> Signed-off-by: Mauro Carvalho Chehab <mchehab@redhat.com>