From 33532a9370a8af24bb2332219dedf45570e50531 Mon Sep 17 00:00:00 2001 From: Hans Verkuil Date: Sat, 23 Aug 2008 09:52:00 +0200 Subject: tea575x-tuner: replace video_exclusive_open/release From: Hans Verkuil Move the video_exclusive_open/release functionality into the driver itself. Priority: normal Signed-off-by: Hans Verkuil --- linux/include/sound/tea575x-tuner.h | 1 + 1 file changed, 1 insertion(+) (limited to 'linux/include') diff --git a/linux/include/sound/tea575x-tuner.h b/linux/include/sound/tea575x-tuner.h index c85aeca78..4076c6dfb 100644 --- a/linux/include/sound/tea575x-tuner.h +++ b/linux/include/sound/tea575x-tuner.h @@ -57,6 +57,7 @@ struct snd_tea575x { unsigned int freq_fixup; /* crystal onboard */ unsigned int val; /* hw value */ unsigned long freq; /* frequency */ + unsigned long in_use; /* set if the device is in use */ struct snd_tea575x_ops *ops; void *private_data; }; -- cgit v1.2.3 From b43528c7ba3da6f260cd3de6ca21c991a012fa6e Mon Sep 17 00:00:00 2001 From: Hans Verkuil Date: Sat, 23 Aug 2008 10:34:55 +0200 Subject: v4l2-dev: remove obsolete video_exclusive_open/release From: Hans Verkuil Priority: normal Signed-off-by: Hans Verkuil --- linux/include/media/v4l2-dev.h | 6 ------ 1 file changed, 6 deletions(-) (limited to 'linux/include') diff --git a/linux/include/media/v4l2-dev.h b/linux/include/media/v4l2-dev.h index 4e1511b0b..cee043d6a 100644 --- a/linux/include/media/v4l2-dev.h +++ b/linux/include/media/v4l2-dev.h @@ -81,10 +81,6 @@ struct video_device * Or use {pci|usb}_{get|set}_drvdata() directly. */ void *priv; #endif - - /* for videodev.c internal usage -- please don't touch */ - int users; /* video_exclusive_{open|close} ... */ - struct mutex lock; /* ... helper function uses these */ }; /* Class-dev to video-device */ @@ -115,8 +111,6 @@ static inline void video_set_drvdata(struct video_device *dev, void *data) /* Obsolete stuff - Still needed for radio devices and obsolete drivers */ extern struct video_device* video_devdata(struct file*); -extern int video_exclusive_open(struct inode *inode, struct file *file); -extern int video_exclusive_release(struct inode *inode, struct file *file); #endif #endif /* _V4L2_DEV_H */ -- cgit v1.2.3 From 79721c4957171ea0fdaf1fa6565e7699dad1b76e Mon Sep 17 00:00:00 2001 From: Hans Verkuil Date: Sat, 23 Aug 2008 10:47:41 +0200 Subject: v4l2-dev: add video_device_release_empty From: Hans Verkuil Add a second release function: video_device_release_empty It can be used by drivers that have statically allocated video_device structs. Its use usually, but not always, indicates laziness on the part of the driver programmer. Priority: normal Signed-off-by: Hans Verkuil --- linux/include/media/v4l2-dev.h | 5 +++++ 1 file changed, 5 insertions(+) (limited to 'linux/include') diff --git a/linux/include/media/v4l2-dev.h b/linux/include/media/v4l2-dev.h index cee043d6a..b6f00b933 100644 --- a/linux/include/media/v4l2-dev.h +++ b/linux/include/media/v4l2-dev.h @@ -95,7 +95,12 @@ void video_unregister_device(struct video_device *); /* helper functions to alloc / release struct video_device, the later can be used for video_device->release() */ struct video_device *video_device_alloc(void); +/* this release function frees the vfd pointer */ void video_device_release(struct video_device *vfd); +/* this release function does nothing, use when the video_device is a + static global struct. Note that having a static video_device is + a dubious construction at best. */ +void video_device_release_empty(struct video_device *vfd); #ifdef OBSOLETE_DEVDATA /* to be removed soon */ /* helper functions to access driver private data. */ -- cgit v1.2.3 From 60c4198b31349257aac0d357d2026f7a10b8a4e8 Mon Sep 17 00:00:00 2001 From: Hans Verkuil Date: Sat, 23 Aug 2008 11:38:11 +0200 Subject: v4l2: add __must_check to v4l2_dev.h From: Hans Verkuil Priority: normal Signed-off-by: Hans Verkuil --- linux/include/media/v4l2-dev.h | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) (limited to 'linux/include') diff --git a/linux/include/media/v4l2-dev.h b/linux/include/media/v4l2-dev.h index b6f00b933..67450f291 100644 --- a/linux/include/media/v4l2-dev.h +++ b/linux/include/media/v4l2-dev.h @@ -87,14 +87,14 @@ struct video_device #define to_video_device(cd) container_of(cd, struct video_device, dev) /* Version 2 functions */ -extern int video_register_device(struct video_device *vfd, int type, int nr); -int video_register_device_index(struct video_device *vfd, int type, int nr, +int __must_check video_register_device(struct video_device *vfd, int type, int nr); +int __must_check video_register_device_index(struct video_device *vfd, int type, int nr, int index); void video_unregister_device(struct video_device *); /* helper functions to alloc / release struct video_device, the later can be used for video_device->release() */ -struct video_device *video_device_alloc(void); +struct video_device * __must_check video_device_alloc(void); /* this release function frees the vfd pointer */ void video_device_release(struct video_device *vfd); /* this release function does nothing, use when the video_device is a -- cgit v1.2.3 From da4e1aee344454f87d08d5914da4ec98f9824bdc Mon Sep 17 00:00:00 2001 From: Hans Verkuil Date: Sat, 23 Aug 2008 12:24:07 +0200 Subject: v4l2: remove the priv field, use dev_get_drvdata instead From: Hans Verkuil Remove the priv field and let video_get/set_drvdata use dev_get_drvdata and dev_set_drvdata instead. Convert all drivers that still used priv directly. Priority: normal Signed-off-by: Hans Verkuil --- linux/include/media/v4l2-dev.h | 14 +++----------- 1 file changed, 3 insertions(+), 11 deletions(-) (limited to 'linux/include') diff --git a/linux/include/media/v4l2-dev.h b/linux/include/media/v4l2-dev.h index 67450f291..926d74551 100644 --- a/linux/include/media/v4l2-dev.h +++ b/linux/include/media/v4l2-dev.h @@ -73,14 +73,6 @@ struct video_device /* ioctl callbacks */ const struct v4l2_ioctl_ops *ioctl_ops; - -#ifdef OBSOLETE_DEVDATA /* to be removed soon */ - /* dev->driver_data will be used instead some day. - * Use the video_{get|set}_drvdata() helper functions, - * so the switch over will be transparent for you. - * Or use {pci|usb}_{get|set}_drvdata() directly. */ - void *priv; -#endif }; /* Class-dev to video-device */ @@ -102,18 +94,18 @@ void video_device_release(struct video_device *vfd); a dubious construction at best. */ void video_device_release_empty(struct video_device *vfd); -#ifdef OBSOLETE_DEVDATA /* to be removed soon */ /* helper functions to access driver private data. */ static inline void *video_get_drvdata(struct video_device *dev) { - return dev->priv; + return dev_get_drvdata(&dev->dev); } static inline void video_set_drvdata(struct video_device *dev, void *data) { - dev->priv = data; + dev_set_drvdata(&dev->dev, data); } +#ifdef OBSOLETE_DEVDATA /* to be removed soon */ /* Obsolete stuff - Still needed for radio devices and obsolete drivers */ extern struct video_device* video_devdata(struct file*); #endif -- cgit v1.2.3 From 7940e700c970556739f490ef6293d03612eb02a9 Mon Sep 17 00:00:00 2001 From: Hans Verkuil Date: Sat, 23 Aug 2008 12:48:38 +0200 Subject: v4l2-dev: cleanups and add video_drvdata helper function From: Hans Verkuil Cleanup v4l2-dev.[ch], add/improve comments and add a new helper function: video_drvdata() that can get the private driver data from a file struct. Priority: normal Signed-off-by: Hans Verkuil --- linux/include/media/v4l2-dev.h | 35 +++++++++++++++++++++-------------- 1 file changed, 21 insertions(+), 14 deletions(-) (limited to 'linux/include') diff --git a/linux/include/media/v4l2-dev.h b/linux/include/media/v4l2-dev.h index 926d74551..8252d36ec 100644 --- a/linux/include/media/v4l2-dev.h +++ b/linux/include/media/v4l2-dev.h @@ -9,16 +9,14 @@ #ifndef _V4L2_DEV_H #define _V4L2_DEV_H -#define OBSOLETE_DEVDATA 1 /* to be removed soon */ - #include #include #include #include -#include /* need __user */ #include #define VIDEO_MAJOR 81 + /* Minor device allocation */ #define MINOR_VFL_TYPE_GRABBER_MIN 0 #define MINOR_VFL_TYPE_GRABBER_MAX 63 @@ -75,20 +73,25 @@ struct video_device const struct v4l2_ioctl_ops *ioctl_ops; }; -/* Class-dev to video-device */ +/* dev to video-device */ #define to_video_device(cd) container_of(cd, struct video_device, dev) -/* Version 2 functions */ +/* Register and unregister devices. Note that if video_register_device fails, + the release() callback of the video_device structure is *not* called, so + the caller is responsible for freeing any data. Usually that means that + you call video_device_release() on failure. */ int __must_check video_register_device(struct video_device *vfd, int type, int nr); -int __must_check video_register_device_index(struct video_device *vfd, int type, int nr, - int index); -void video_unregister_device(struct video_device *); +int __must_check video_register_device_index(struct video_device *vfd, + int type, int nr, int index); +void video_unregister_device(struct video_device *vfd); -/* helper functions to alloc / release struct video_device, the - later can be used for video_device->release() */ +/* helper functions to alloc/release struct video_device, the + latter can also be used for video_device->release(). */ struct video_device * __must_check video_device_alloc(void); + /* this release function frees the vfd pointer */ void video_device_release(struct video_device *vfd); + /* this release function does nothing, use when the video_device is a static global struct. Note that having a static video_device is a dubious construction at best. */ @@ -105,9 +108,13 @@ static inline void video_set_drvdata(struct video_device *dev, void *data) dev_set_drvdata(&dev->dev, data); } -#ifdef OBSOLETE_DEVDATA /* to be removed soon */ -/* Obsolete stuff - Still needed for radio devices and obsolete drivers */ -extern struct video_device* video_devdata(struct file*); -#endif +struct video_device *video_devdata(struct file *file); + +/* Combine video_get_drvdata and video_devdata as this is + used very often. */ +static inline void *video_drvdata(struct file *file) +{ + return video_get_drvdata(video_devdata(file)); +} #endif /* _V4L2_DEV_H */ -- cgit v1.2.3 From 59a57f6b9ea53f0ff73ec4eafbab23f2dea7221e Mon Sep 17 00:00:00 2001 From: Hans Verkuil Date: Mon, 11 Aug 2008 03:39:09 +0200 Subject: v4l2-dev: video_get/set_drvdata needs to use class_get/set_devdata for < 2.6.19 From: Hans Verkuil Priority: normal Signed-off-by: Hans Verkuil --- linux/include/media/v4l2-dev.h | 8 ++++++++ 1 file changed, 8 insertions(+) (limited to 'linux/include') diff --git a/linux/include/media/v4l2-dev.h b/linux/include/media/v4l2-dev.h index 8252d36ec..ba05b8164 100644 --- a/linux/include/media/v4l2-dev.h +++ b/linux/include/media/v4l2-dev.h @@ -100,12 +100,20 @@ void video_device_release_empty(struct video_device *vfd); /* helper functions to access driver private data. */ static inline void *video_get_drvdata(struct video_device *dev) { +#if LINUX_VERSION_CODE < KERNEL_VERSION(2, 6, 19) + return class_get_devdata(&dev->dev); +#else return dev_get_drvdata(&dev->dev); +#endif } static inline void video_set_drvdata(struct video_device *dev, void *data) { +#if LINUX_VERSION_CODE < KERNEL_VERSION(2, 6, 19) + class_set_devdata(&dev->dev, data); +#else dev_set_drvdata(&dev->dev, data); +#endif } struct video_device *video_devdata(struct file *file); -- cgit v1.2.3 From 49b246f5997fab551b7b8b5122078b6977d082fc Mon Sep 17 00:00:00 2001 From: Jean-Francois Moine Date: Fri, 22 Aug 2008 19:22:54 +0200 Subject: gspca: Revert the previous patch (sensor upside down). From: Hans de Goede Priority: high Signed-off-by: Hans de Goede Signed-off-by: Jean-Francois Moine --- linux/include/linux/videodev2.h | 5 ----- 1 file changed, 5 deletions(-) (limited to 'linux/include') diff --git a/linux/include/linux/videodev2.h b/linux/include/linux/videodev2.h index 8ce0d35f0..f3ae9c88e 100644 --- a/linux/include/linux/videodev2.h +++ b/linux/include/linux/videodev2.h @@ -261,11 +261,6 @@ struct v4l2_capability { #define V4L2_CAP_ASYNCIO 0x02000000 /* async I/O */ #define V4L2_CAP_STREAMING 0x04000000 /* streaming I/O ioctls */ -/* This flags gets set if the "sensor" is known to be upside down and this can - *not* be fixed using v4l2 flipx/y controls. Note that absence of this flag - is not a guarantee for the image not being upside down. */ -#define V4L2_CAP_SENSOR_UPSIDE_DOWN 0x10000000 - /* * V I D E O I M A G E F O R M A T */ -- cgit v1.2.3 From a31639582f82355dc1e655076648e7726141fce9 Mon Sep 17 00:00:00 2001 From: Jean-Francois Moine Date: Thu, 28 Aug 2008 18:22:19 +0200 Subject: gspca: Bad pixelformat of vc0321 webcams. From: Jean-Francois Moine Priority: high Signed-off-by: Jean-Francois Moine --- linux/include/linux/videodev2.h | 1 + 1 file changed, 1 insertion(+) (limited to 'linux/include') diff --git a/linux/include/linux/videodev2.h b/linux/include/linux/videodev2.h index a79fc1584..63b2787e6 100644 --- a/linux/include/linux/videodev2.h +++ b/linux/include/linux/videodev2.h @@ -335,6 +335,7 @@ struct v4l2_pix_format { #define V4L2_PIX_FMT_SPCA561 v4l2_fourcc('S', '5', '6', '1') /* compressed GBRG bayer */ #define V4L2_PIX_FMT_PAC207 v4l2_fourcc('P', '2', '0', '7') /* compressed BGGR bayer */ #define V4L2_PIX_FMT_PJPG v4l2_fourcc('P', 'J', 'P', 'G') /* Pixart 73xx JPEG */ +#define V4L2_PIX_FMT_YVYU v4l2_fourcc('Y', 'V', 'Y', 'U') /* 16 YVU 4:2:2 */ /* * F O R M A T E N U M E R A T I O N -- cgit v1.2.3 From 937ba8f2a0dc3b8cdb98de9a48c256ad24427ac9 Mon Sep 17 00:00:00 2001 From: Hans Verkuil Date: Fri, 29 Aug 2008 22:31:35 +0200 Subject: v4l2: use register_chrdev_region instead of register_chrdev From: Hans Verkuil Replace the old register_chrdev with the more flexible register_chrdev_region. Ensure that the release() is called when the very last chardev usage was released, and not when the sysfs devices were removed. This should simplify hotpluggable drivers considerably. Tested-by: Mike Isely Tested-by: Laurent Pinchart Priority: normal Signed-off-by: Hans Verkuil Acked-by: David Ellingsworth Reviewed-by: Hans de Goede --- linux/include/media/v4l2-dev.h | 3 +++ 1 file changed, 3 insertions(+) (limited to 'linux/include') diff --git a/linux/include/media/v4l2-dev.h b/linux/include/media/v4l2-dev.h index ba05b8164..9158ad8b5 100644 --- a/linux/include/media/v4l2-dev.h +++ b/linux/include/media/v4l2-dev.h @@ -12,6 +12,7 @@ #include #include #include +#include #include #include @@ -51,6 +52,8 @@ struct video_device #else struct class_device dev; #endif + struct cdev cdev; /* character device */ + void (*cdev_release)(struct kobject *kobj); struct device *parent; /* device parent */ /* device info */ -- cgit v1.2.3 From 3480f0f25f38352a5357c25c8a0c8a93246e7542 Mon Sep 17 00:00:00 2001 From: Mauro Carvalho Chehab Date: Sat, 30 Aug 2008 11:13:25 -0300 Subject: Backport some other minor changes from kernel From: Mauro Carvalho Chehab kernel-sync: Signed-off-by: Mauro Carvalho Chehab --- linux/include/linux/i2c-id.h | 2 -- 1 file changed, 2 deletions(-) (limited to 'linux/include') diff --git a/linux/include/linux/i2c-id.h b/linux/include/linux/i2c-id.h index bc35aec9d..493435bcd 100644 --- a/linux/include/linux/i2c-id.h +++ b/linux/include/linux/i2c-id.h @@ -39,7 +39,6 @@ #define I2C_DRIVERID_SAA7111A 8 /* video input processor */ #define I2C_DRIVERID_SAA7185B 13 /* video encoder */ #define I2C_DRIVERID_SAA7110 22 /* video decoder */ -#define I2C_DRIVERID_MGATVO 23 /* Matrox TVOut */ #define I2C_DRIVERID_SAA5249 24 /* SAA5249 and compatibles */ #define I2C_DRIVERID_PCF8583 25 /* real time clock */ #define I2C_DRIVERID_TDA7432 27 /* Stereo sound processor */ @@ -94,7 +93,6 @@ #define I2C_HW_B_BT848 0x010005 /* BT848 video boards */ #define I2C_HW_B_VIA 0x010007 /* Via vt82c586b */ #define I2C_HW_B_HYDRA 0x010008 /* Apple Hydra Mac I/O */ -#define I2C_HW_B_G400 0x010009 /* Matrox G400 */ #define I2C_HW_B_I810 0x01000a /* Intel I810 */ #define I2C_HW_B_VOO 0x01000b /* 3dfx Voodoo 3 / Banshee */ #define I2C_HW_B_SCX200 0x01000e /* Nat'l Semi SCx200 I2C */ -- cgit v1.2.3