summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--README.patches6
-rw-r--r--linux/Documentation/video4linux/gspca.txt1
-rw-r--r--linux/drivers/media/common/tuners/mt20xx.c3
-rw-r--r--linux/drivers/media/common/tuners/tda8290.c3
-rw-r--r--linux/drivers/media/common/tuners/tda9887.c10
-rw-r--r--linux/drivers/media/common/tuners/tea5767.c3
-rw-r--r--linux/drivers/media/common/tuners/tuner-simple.c7
-rw-r--r--linux/drivers/media/common/tuners/tuner-xc2028.c3
-rw-r--r--linux/drivers/media/dvb/cinergyT2/cinergyT2.c6
-rw-r--r--linux/drivers/media/dvb/dvb-core/dvbdev.c4
-rw-r--r--linux/drivers/media/dvb/dvb-usb/Kconfig1
-rw-r--r--linux/drivers/media/dvb/dvb-usb/dib0700_devices.c7
-rw-r--r--linux/drivers/media/dvb/dvb-usb/dvb-usb-i2c.c4
-rw-r--r--linux/drivers/media/dvb/dvb-usb/dvb-usb-ids.h1
-rw-r--r--linux/drivers/media/dvb/dvb-usb/dvb-usb-remote.c2
-rw-r--r--linux/drivers/media/dvb/ttpci/av7110.c4
-rw-r--r--linux/drivers/media/dvb/ttpci/av7110_ir.c2
-rw-r--r--linux/drivers/media/dvb/ttpci/budget-ci.c2
-rw-r--r--linux/drivers/media/dvb/ttpci/budget-core.c4
-rw-r--r--linux/drivers/media/dvb/ttusb-budget/dvb-ttusb-budget.c4
-rw-r--r--linux/drivers/media/video/au0828/au0828-dvb.c23
-rw-r--r--linux/drivers/media/video/au0828/au0828-i2c.c2
-rw-r--r--linux/drivers/media/video/bt8xx/bt832.c29
-rw-r--r--linux/drivers/media/video/bt8xx/bttv-cards.c23
-rw-r--r--linux/drivers/media/video/bt8xx/bttv-driver.c51
-rw-r--r--linux/drivers/media/video/bt8xx/bttv-i2c.c8
-rw-r--r--linux/drivers/media/video/bt8xx/bttv-input.c2
-rw-r--r--linux/drivers/media/video/bt8xx/bttv.h10
-rw-r--r--linux/drivers/media/video/bt8xx/bttvp.h13
-rw-r--r--linux/drivers/media/video/compat_ioctl32.c2
-rw-r--r--linux/drivers/media/video/cs5345.c12
-rw-r--r--linux/drivers/media/video/cs53l32a.c16
-rw-r--r--linux/drivers/media/video/cx18/cx18-cards.c4
-rw-r--r--linux/drivers/media/video/cx18/cx18-i2c.c9
-rw-r--r--linux/drivers/media/video/cx18/cx18-streams.c2
-rw-r--r--linux/drivers/media/video/cx2341x.c3
-rw-r--r--linux/drivers/media/video/cx23885/cx23885-i2c.c2
-rw-r--r--linux/drivers/media/video/cx23885/cx23885-video.c21
-rw-r--r--linux/drivers/media/video/cx25840/cx25840-audio.c3
-rw-r--r--linux/drivers/media/video/cx25840/cx25840-core.c11
-rw-r--r--linux/drivers/media/video/cx25840/cx25840-firmware.c8
-rw-r--r--linux/drivers/media/video/cx88/cx88-alsa.c13
-rw-r--r--linux/drivers/media/video/cx88/cx88-blackbird.c7
-rw-r--r--linux/drivers/media/video/cx88/cx88-cards.c13
-rw-r--r--linux/drivers/media/video/cx88/cx88-core.c2
-rw-r--r--linux/drivers/media/video/cx88/cx88-i2c.c11
-rw-r--r--linux/drivers/media/video/cx88/cx88-input.c4
-rw-r--r--linux/drivers/media/video/cx88/cx88-mpeg.c18
-rw-r--r--linux/drivers/media/video/cx88/cx88-tvaudio.c2
-rw-r--r--linux/drivers/media/video/cx88/cx88-video.c35
-rw-r--r--linux/drivers/media/video/cx88/cx88-vp3054-i2c.c10
-rw-r--r--linux/drivers/media/video/cx88/cx88.h6
-rw-r--r--linux/drivers/media/video/em28xx/em28xx-dvb.c27
-rw-r--r--linux/drivers/media/video/em28xx/em28xx-i2c.c19
-rw-r--r--linux/drivers/media/video/em28xx/em28xx-video.c28
-rw-r--r--linux/drivers/media/video/gspca/conex.c185
-rw-r--r--linux/drivers/media/video/gspca/etoms.c609
-rw-r--r--linux/drivers/media/video/gspca/gspca.c165
-rw-r--r--linux/drivers/media/video/gspca/gspca.h39
-rw-r--r--linux/drivers/media/video/gspca/mars.c75
-rw-r--r--linux/drivers/media/video/gspca/ov519.c88
-rw-r--r--linux/drivers/media/video/gspca/pac207.c380
-rw-r--r--linux/drivers/media/video/gspca/pac7311.c119
-rw-r--r--linux/drivers/media/video/gspca/sonixb.c86
-rw-r--r--linux/drivers/media/video/gspca/sonixj.c182
-rw-r--r--linux/drivers/media/video/gspca/spca500.c337
-rw-r--r--linux/drivers/media/video/gspca/spca501.c51
-rw-r--r--linux/drivers/media/video/gspca/spca505.c60
-rw-r--r--linux/drivers/media/video/gspca/spca506.c52
-rw-r--r--linux/drivers/media/video/gspca/spca508.c96
-rw-r--r--linux/drivers/media/video/gspca/spca561.c60
-rw-r--r--linux/drivers/media/video/gspca/stk014.c50
-rw-r--r--linux/drivers/media/video/gspca/sunplus.c86
-rw-r--r--linux/drivers/media/video/gspca/t613.c253
-rw-r--r--linux/drivers/media/video/gspca/tv8532.c53
-rw-r--r--linux/drivers/media/video/gspca/vc032x.c116
-rw-r--r--linux/drivers/media/video/gspca/zc3xx.c314
-rw-r--r--linux/drivers/media/video/ir-kbd-i2c.c4
-rw-r--r--linux/drivers/media/video/ivtv/ivtv-i2c.c12
-rw-r--r--linux/drivers/media/video/ivtv/ivtv-streams.c4
-rw-r--r--linux/drivers/media/video/m52790.c12
-rw-r--r--linux/drivers/media/video/msp3400-driver.c67
-rw-r--r--linux/drivers/media/video/msp3400-driver.h4
-rw-r--r--linux/drivers/media/video/msp3400-kthreads.c45
-rw-r--r--linux/drivers/media/video/pvrusb2/pvrusb2-hdw.c6
-rw-r--r--linux/drivers/media/video/pvrusb2/pvrusb2-i2c-core.c6
-rw-r--r--linux/drivers/media/video/pwc/pwc-ctrl.c21
-rw-r--r--linux/drivers/media/video/pwc/pwc-if.c28
-rw-r--r--linux/drivers/media/video/pwc/pwc-ioctl.h5
-rw-r--r--linux/drivers/media/video/saa5246a.c4
-rw-r--r--linux/drivers/media/video/saa5249.c4
-rw-r--r--linux/drivers/media/video/saa6588.c30
-rw-r--r--linux/drivers/media/video/saa7115.c17
-rw-r--r--linux/drivers/media/video/saa7127.c16
-rw-r--r--linux/drivers/media/video/saa7134/saa6752hs.c24
-rw-r--r--linux/drivers/media/video/saa7134/saa7134-alsa.c15
-rw-r--r--linux/drivers/media/video/saa7134/saa7134-core.c34
-rw-r--r--linux/drivers/media/video/saa7134/saa7134-empress.c11
-rw-r--r--linux/drivers/media/video/saa7134/saa7134-i2c.c6
-rw-r--r--linux/drivers/media/video/saa7134/saa7134-input.c2
-rw-r--r--linux/drivers/media/video/saa7134/saa7134-tvaudio.c16
-rw-r--r--linux/drivers/media/video/saa7134/saa7134-video.c4
-rw-r--r--linux/drivers/media/video/saa7134/saa7134.h6
-rw-r--r--linux/drivers/media/video/saa717x.c12
-rw-r--r--linux/drivers/media/video/tda7432.c28
-rw-r--r--linux/drivers/media/video/tda9840.c7
-rw-r--r--linux/drivers/media/video/tda9875.c29
-rw-r--r--linux/drivers/media/video/tea6415c.c7
-rw-r--r--linux/drivers/media/video/tea6420.c7
-rw-r--r--linux/drivers/media/video/tlv320aic23b.c11
-rw-r--r--linux/drivers/media/video/tuner-core.c32
-rw-r--r--linux/drivers/media/video/tvaudio.c20
-rw-r--r--linux/drivers/media/video/tveeprom.c3
-rw-r--r--linux/drivers/media/video/tvmixer.c50
-rw-r--r--linux/drivers/media/video/tvp5150.c21
-rw-r--r--linux/drivers/media/video/upd64031a.c11
-rw-r--r--linux/drivers/media/video/upd64083.c11
-rw-r--r--linux/drivers/media/video/usbvideo/konicawc.c4
-rw-r--r--linux/drivers/media/video/usbvideo/quickcam_messenger.c2
-rw-r--r--linux/drivers/media/video/usbvision/usbvision-core.c110
-rw-r--r--linux/drivers/media/video/usbvision/usbvision-i2c.c36
-rw-r--r--linux/drivers/media/video/usbvision/usbvision-video.c183
-rw-r--r--linux/drivers/media/video/usbvision/usbvision.h4
-rw-r--r--linux/drivers/media/video/uvc/uvc_driver.c3
-rw-r--r--linux/drivers/media/video/uvc/uvc_status.c2
-rw-r--r--linux/drivers/media/video/uvc/uvc_video.c116
-rw-r--r--linux/drivers/media/video/uvc/uvcvideo.h2
-rw-r--r--linux/drivers/media/video/v4l2-common.c3
-rw-r--r--linux/drivers/media/video/videobuf-dma-sg.c15
-rw-r--r--linux/drivers/media/video/videobuf-dvb.c27
-rw-r--r--linux/drivers/media/video/videodev.c59
-rw-r--r--linux/drivers/media/video/vivi.c65
-rw-r--r--linux/drivers/media/video/vp27smpx.c15
-rw-r--r--linux/drivers/media/video/wm8739.c19
-rw-r--r--linux/drivers/media/video/wm8775.c12
-rw-r--r--linux/include/linux/videodev2.h4
-rw-r--r--linux/include/media/pwc-ioctl.h7
-rw-r--r--linux/include/media/v4l2-dev.h15
-rw-r--r--linux/include/media/v4l2-i2c-drv-legacy.h28
-rw-r--r--linux/include/media/v4l2-i2c-drv.h28
-rw-r--r--linux/include/media/videobuf-dvb.h4
-rw-r--r--linux/sound/pci/bt87x.c4
-rw-r--r--v4l/compat.h313
-rwxr-xr-xv4l/scripts/release.sh2
-rw-r--r--v4l_experimental/dpl3518.c16
-rw-r--r--v4l_experimental/v3tv/v3tv.c53
-rw-r--r--v4l_experimental/v3tv/vpx3224.c44
147 files changed, 1793 insertions, 4036 deletions
diff --git a/README.patches b/README.patches
index 53b5c8a8a..882482223 100644
--- a/README.patches
+++ b/README.patches
@@ -281,8 +281,10 @@ j) Sometimes it is necessary to introduce some testing code inside a
To allow compatibility tests, linux/version.h is automatically
included by the building system. This allows adding tests like:
- #if LINUX_VERSION_CODE >= KERNEL_VERSION(2,5,0)
- #include <linux/kthread.h>
+ #if LINUX_VERSION_CODE >= KERNEL_VERSION(2, 6, 16)
+ #include <linux/mutex.h>
+ #else
+ #include <asm/semaphore.h>
#endif
It should be noticed, however, that an explicit inclusion of
diff --git a/linux/Documentation/video4linux/gspca.txt b/linux/Documentation/video4linux/gspca.txt
index 37996e59d..6e68cdeb2 100644
--- a/linux/Documentation/video4linux/gspca.txt
+++ b/linux/Documentation/video4linux/gspca.txt
@@ -144,6 +144,7 @@ spca500 06be:0800 Optimedia
sunplus 06d6:0031 Trust 610 LCD PowerC@m Zoom
spca506 06e1:a190 ADS Instant VCD
spca508 0733:0110 ViewQuest VQ110
+spca508 0130:0130 Clone Digital Webcam 11043
spca501 0733:0401 Intel Create and Share
spca501 0733:0402 ViewQuest M318B
spca505 0733:0430 Intel PC Camera Pro
diff --git a/linux/drivers/media/common/tuners/mt20xx.c b/linux/drivers/media/common/tuners/mt20xx.c
index d2c281aeb..9d9f1cf11 100644
--- a/linux/drivers/media/common/tuners/mt20xx.c
+++ b/linux/drivers/media/common/tuners/mt20xx.c
@@ -10,9 +10,6 @@
#include <linux/videodev.h>
#include "tuner-i2c.h"
#include "mt20xx.h"
-#if LINUX_VERSION_CODE < KERNEL_VERSION(2,5,0)
-#include "i2c-compat.h"
-#endif
static int debug;
module_param(debug, int, 0644);
diff --git a/linux/drivers/media/common/tuners/tda8290.c b/linux/drivers/media/common/tuners/tda8290.c
index 9bda53be5..751845554 100644
--- a/linux/drivers/media/common/tuners/tda8290.c
+++ b/linux/drivers/media/common/tuners/tda8290.c
@@ -28,9 +28,6 @@
#include "tda8290.h"
#include "tda827x.h"
#include "tda18271.h"
-#if LINUX_VERSION_CODE < KERNEL_VERSION(2,5,0)
-#include "i2c-compat.h"
-#endif
static int debug;
module_param(debug, int, 0644);
diff --git a/linux/drivers/media/common/tuners/tda9887.c b/linux/drivers/media/common/tuners/tda9887.c
index e98de7d40..61a56026d 100644
--- a/linux/drivers/media/common/tuners/tda9887.c
+++ b/linux/drivers/media/common/tuners/tda9887.c
@@ -8,9 +8,6 @@
#include <linux/delay.h>
#include "compat.h"
#include <linux/videodev.h>
-#if LINUX_VERSION_CODE < KERNEL_VERSION(2,5,0)
-#include "i2c-compat.h"
-#endif
#include <media/v4l2-common.h>
#include <media/tuner.h>
#include "tuner-i2c.h"
@@ -438,17 +435,10 @@ static unsigned int port2 = UNSET;
static unsigned int qss = UNSET;
static unsigned int adjust = UNSET;
-#if LINUX_VERSION_CODE < KERNEL_VERSION(2,5,0)
-MODULE_PARM(port1, "i");
-MODULE_PARM(port2, "i");
-MODULE_PARM(qss, "i");
-MODULE_PARM(adjust, "i");
-#else
module_param(port1, int, 0644);
module_param(port2, int, 0644);
module_param(qss, int, 0644);
module_param(adjust, int, 0644);
-#endif
static int tda9887_set_insmod(struct dvb_frontend *fe)
{
diff --git a/linux/drivers/media/common/tuners/tea5767.c b/linux/drivers/media/common/tuners/tea5767.c
index 5990a63ef..c56ff2dc1 100644
--- a/linux/drivers/media/common/tuners/tea5767.c
+++ b/linux/drivers/media/common/tuners/tea5767.c
@@ -16,9 +16,6 @@
#include <linux/videodev.h>
#include "tuner-i2c.h"
#include "tea5767.h"
-#if LINUX_VERSION_CODE < KERNEL_VERSION(2,5,0)
-#include "i2c-compat.h"
-#endif
static int debug;
module_param(debug, int, 0644);
diff --git a/linux/drivers/media/common/tuners/tuner-simple.c b/linux/drivers/media/common/tuners/tuner-simple.c
index c9d70e4b2..a029cf8f5 100644
--- a/linux/drivers/media/common/tuners/tuner-simple.c
+++ b/linux/drivers/media/common/tuners/tuner-simple.c
@@ -11,9 +11,6 @@
#include <media/tuner.h>
#include <media/v4l2-common.h>
#include <media/tuner-types.h>
-#if LINUX_VERSION_CODE < KERNEL_VERSION(2,5,0)
-#include "i2c-compat.h"
-#endif
#include "tuner-i2c.h"
#include "tuner-simple.h"
@@ -25,11 +22,7 @@ MODULE_PARM_DESC(debug, "enable verbose debug messages");
static unsigned int simple_devcount;
static int offset;
-#if LINUX_VERSION_CODE < KERNEL_VERSION(2,5,0)
-MODULE_PARM(offset, "i");
-#else
module_param(offset, int, 0664);
-#endif
MODULE_PARM_DESC(offset, "Allows to specify an offset for tuner");
static unsigned int atv_input[TUNER_SIMPLE_MAX] = \
diff --git a/linux/drivers/media/common/tuners/tuner-xc2028.c b/linux/drivers/media/common/tuners/tuner-xc2028.c
index c51a7b4c8..9d3f397e3 100644
--- a/linux/drivers/media/common/tuners/tuner-xc2028.c
+++ b/linux/drivers/media/common/tuners/tuner-xc2028.c
@@ -22,9 +22,6 @@
#include "compat.h"
#include <asm/unaligned.h>
#include "tuner-i2c.h"
-#if LINUX_VERSION_CODE < KERNEL_VERSION(2, 5, 0)
-#include "i2c-compat.h"
-#endif
#include "tuner-xc2028.h"
#include "tuner-xc2028-types.h"
diff --git a/linux/drivers/media/dvb/cinergyT2/cinergyT2.c b/linux/drivers/media/dvb/cinergyT2/cinergyT2.c
index 651df056e..e1d76b111 100644
--- a/linux/drivers/media/dvb/cinergyT2/cinergyT2.c
+++ b/linux/drivers/media/dvb/cinergyT2/cinergyT2.c
@@ -1086,12 +1086,6 @@ static int cinergyt2_suspend (struct usb_interface *intf, pm_message_t state)
if (mutex_lock_interruptible(&cinergyt2->wq_sem))
return -ERESTARTSYS;
-#if LINUX_VERSION_CODE < KERNEL_VERSION(2,6,14)
- if (state <= 0) {
- mutex_unlock(&cinergyt2->wq_sem);
- return 0;
- }
-#endif
cinergyt2_suspend_rc(cinergyt2);
cancel_rearming_delayed_work(&cinergyt2->query_work);
diff --git a/linux/drivers/media/dvb/dvb-core/dvbdev.c b/linux/drivers/media/dvb/dvb-core/dvbdev.c
index 3439ccec6..2da27de38 100644
--- a/linux/drivers/media/dvb/dvb-core/dvbdev.c
+++ b/linux/drivers/media/dvb/dvb-core/dvbdev.c
@@ -56,11 +56,7 @@ static const char * const dnames[] = {
#define nums2minor(num,type,id) ((num << 6) | (id << 4) | type)
#define MAX_DVB_MINORS (DVB_MAX_ADAPTERS*64)
-#if LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,13)
static struct class *dvb_class;
-#else
-static struct class_simple *dvb_class;
-#endif
static struct dvb_device* dvbdev_find_device (int minor)
{
diff --git a/linux/drivers/media/dvb/dvb-usb/Kconfig b/linux/drivers/media/dvb/dvb-usb/Kconfig
index 7847a8320..a577c0f89 100644
--- a/linux/drivers/media/dvb/dvb-usb/Kconfig
+++ b/linux/drivers/media/dvb/dvb-usb/Kconfig
@@ -109,6 +109,7 @@ config DVB_USB_CXUSB
select DVB_ZL10353 if !DVB_FE_CUSTOMISE
select MEDIA_TUNER_SIMPLE if !DVB_FE_CUSTOMISE
select MEDIA_TUNER_XC2028 if !DVB_FE_CUSTOMISE
+ select MEDIA_TUNER_MXL5005S if !DVB_FE_CUSTOMISE
help
Say Y here to support the Conexant USB2.0 hybrid reference design.
Currently, only DVB and ATSC modes are supported, analog mode
diff --git a/linux/drivers/media/dvb/dvb-usb/dib0700_devices.c b/linux/drivers/media/dvb/dvb-usb/dib0700_devices.c
index c4d40fe01..3dd20bfbe 100644
--- a/linux/drivers/media/dvb/dvb-usb/dib0700_devices.c
+++ b/linux/drivers/media/dvb/dvb-usb/dib0700_devices.c
@@ -1117,6 +1117,7 @@ struct usb_device_id dib0700_usb_id_table[] = {
{ USB_DEVICE(USB_VID_TERRATEC, USB_PID_TERRATEC_CINERGY_HT_EXPRESS) },
{ USB_DEVICE(USB_VID_TERRATEC, USB_PID_TERRATEC_CINERGY_T_XXS) },
{ USB_DEVICE(USB_VID_LEADTEK, USB_PID_WINFAST_DTV_DONGLE_STK7700P_2) },
+ { USB_DEVICE(USB_VID_HAUPPAUGE, USB_PID_HAUPPAUGE_NOVA_TD_STICK_52009) },
{ 0 } /* Terminating entry */
};
MODULE_DEVICE_TABLE(usb, dib0700_usb_id_table);
@@ -1372,7 +1373,7 @@ struct dvb_usb_device_properties dib0700_devices[] = {
}
},
- .num_device_descs = 2,
+ .num_device_descs = 3,
.devices = {
{ "DiBcom STK7070PD reference design",
{ &dib0700_usb_id_table[17], NULL },
@@ -1381,6 +1382,10 @@ struct dvb_usb_device_properties dib0700_devices[] = {
{ "Pinnacle PCTV Dual DVB-T Diversity Stick",
{ &dib0700_usb_id_table[18], NULL },
{ NULL },
+ },
+ { "Hauppauge Nova-TD Stick (52009)",
+ { &dib0700_usb_id_table[35], NULL },
+ { NULL },
}
}
}, { DIB0700_DEFAULT_DEVICE_PROPERTIES,
diff --git a/linux/drivers/media/dvb/dvb-usb/dvb-usb-i2c.c b/linux/drivers/media/dvb/dvb-usb/dvb-usb-i2c.c
index 23428cd30..326f76089 100644
--- a/linux/drivers/media/dvb/dvb-usb/dvb-usb-i2c.c
+++ b/linux/drivers/media/dvb/dvb-usb/dvb-usb-i2c.c
@@ -20,11 +20,7 @@ int dvb_usb_i2c_init(struct dvb_usb_device *d)
}
strncpy(d->i2c_adap.name, d->desc->name, sizeof(d->i2c_adap.name));
-#ifdef I2C_ADAP_CLASS_TV_DIGITAL
- d->i2c_adap.class = I2C_ADAP_CLASS_TV_DIGITAL,
-#else
d->i2c_adap.class = I2C_CLASS_TV_DIGITAL,
-#endif
d->i2c_adap.algo = d->props.i2c_algo;
d->i2c_adap.algo_data = NULL;
d->i2c_adap.dev.parent = &d->udev->dev;
diff --git a/linux/drivers/media/dvb/dvb-usb/dvb-usb-ids.h b/linux/drivers/media/dvb/dvb-usb/dvb-usb-ids.h
index 75ec9caa1..e5238b31e 100644
--- a/linux/drivers/media/dvb/dvb-usb/dvb-usb-ids.h
+++ b/linux/drivers/media/dvb/dvb-usb/dvb-usb-ids.h
@@ -134,6 +134,7 @@
#define USB_PID_HAUPPAUGE_NOVA_T_STICK_3 0x7070
#define USB_PID_HAUPPAUGE_MYTV_T 0x7080
#define USB_PID_HAUPPAUGE_NOVA_TD_STICK 0x9580
+#define USB_PID_HAUPPAUGE_NOVA_TD_STICK_52009 0x5200
#define USB_PID_AVERMEDIA_EXPRESS 0xb568
#define USB_PID_AVERMEDIA_VOLAR 0xa807
#define USB_PID_AVERMEDIA_VOLAR_2 0xb808
diff --git a/linux/drivers/media/dvb/dvb-usb/dvb-usb-remote.c b/linux/drivers/media/dvb/dvb-usb/dvb-usb-remote.c
index b47427ea6..b2fae925a 100644
--- a/linux/drivers/media/dvb/dvb-usb/dvb-usb-remote.c
+++ b/linux/drivers/media/dvb/dvb-usb/dvb-usb-remote.c
@@ -9,10 +9,8 @@
#if LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,18)
#include <linux/usb/input.h>
#else
-#if LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,13)
#include <linux/usb_input.h>
#endif
-#endif
/* Remote-control poll function - called every dib->rc_query_interval ms to see
* whether the remote control has received anything.
diff --git a/linux/drivers/media/dvb/ttpci/av7110.c b/linux/drivers/media/dvb/ttpci/av7110.c
index 04e1bcd6a..0909eb861 100644
--- a/linux/drivers/media/dvb/ttpci/av7110.c
+++ b/linux/drivers/media/dvb/ttpci/av7110.c
@@ -2471,11 +2471,7 @@ static int __devinit av7110_attach(struct saa7146_dev* dev,
get recognized before the main driver is fully loaded */
saa7146_write(dev, GPIO_CTRL, 0x500000);
-#ifdef I2C_ADAP_CLASS_TV_DIGITAL
- av7110->i2c_adap.class = I2C_ADAP_CLASS_TV_DIGITAL;
-#else
av7110->i2c_adap.class = I2C_CLASS_TV_DIGITAL;
-#endif
strlcpy(av7110->i2c_adap.name, pci_ext->ext_priv, sizeof(av7110->i2c_adap.name));
saa7146_i2c_adapter_prepare(dev, &av7110->i2c_adap, SAA7146_I2C_BUS_BIT_RATE_120); /* 275 kHz */
diff --git a/linux/drivers/media/dvb/ttpci/av7110_ir.c b/linux/drivers/media/dvb/ttpci/av7110_ir.c
index 18171c051..084164147 100644
--- a/linux/drivers/media/dvb/ttpci/av7110_ir.c
+++ b/linux/drivers/media/dvb/ttpci/av7110_ir.c
@@ -345,7 +345,6 @@ int __devinit av7110_ir_init(struct av7110 *av7110)
input_dev->name = "DVB on-card IR receiver";
-#if LINUX_VERSION_CODE >= KERNEL_VERSION(2,5,0)
input_dev->phys = av7110->ir.input_phys;
input_dev->id.bustype = BUS_PCI;
input_dev->id.version = 2;
@@ -365,7 +364,6 @@ int __devinit av7110_ir_init(struct av7110 *av7110)
input_dev->dev = &av7110->dev->pci->dev;
#endif
#endif
-#endif
/* initial keymap */
memcpy(av7110->ir.key_map, default_key_map, sizeof av7110->ir.key_map);
input_register_keys(&av7110->ir);
diff --git a/linux/drivers/media/dvb/ttpci/budget-ci.c b/linux/drivers/media/dvb/ttpci/budget-ci.c
index c254ff242..8234c397c 100644
--- a/linux/drivers/media/dvb/ttpci/budget-ci.c
+++ b/linux/drivers/media/dvb/ttpci/budget-ci.c
@@ -198,7 +198,6 @@ static int msp430_ir_init(struct budget_ci *budget_ci)
input_dev->name = budget_ci->ir.name;
-#if LINUX_VERSION_CODE >= KERNEL_VERSION(2,5,0)
input_dev->phys = budget_ci->ir.phys;
input_dev->id.bustype = BUS_PCI;
input_dev->id.version = 1;
@@ -218,7 +217,6 @@ static int msp430_ir_init(struct budget_ci *budget_ci)
input_dev->dev = &saa->pci->dev;
#endif
#endif
-#endif
/* Select keymap and address */
switch (budget_ci->budget.dev->pci->subsystem_device) {
diff --git a/linux/drivers/media/dvb/ttpci/budget-core.c b/linux/drivers/media/dvb/ttpci/budget-core.c
index 18cac4b12..6f4ddb643 100644
--- a/linux/drivers/media/dvb/ttpci/budget-core.c
+++ b/linux/drivers/media/dvb/ttpci/budget-core.c
@@ -497,11 +497,7 @@ int ttpci_budget_init(struct budget *budget, struct saa7146_dev *dev,
if (bi->type != BUDGET_FS_ACTIVY)
saa7146_write(dev, GPIO_CTRL, 0x500000); /* GPIO 3 = 1 */
-#ifdef I2C_ADAP_CLASS_TV_DIGITAL
- budget->i2c_adap.class = I2C_ADAP_CLASS_TV_DIGITAL;
-#else
budget->i2c_adap.class = I2C_CLASS_TV_DIGITAL;
-#endif
strlcpy(budget->i2c_adap.name, budget->card->name, sizeof(budget->i2c_adap.name));
diff --git a/linux/drivers/media/dvb/ttusb-budget/dvb-ttusb-budget.c b/linux/drivers/media/dvb/ttusb-budget/dvb-ttusb-budget.c
index df7add8a9..fa84a6b49 100644
--- a/linux/drivers/media/dvb/ttusb-budget/dvb-ttusb-budget.c
+++ b/linux/drivers/media/dvb/ttusb-budget/dvb-ttusb-budget.c
@@ -1698,11 +1698,7 @@ static int ttusb_probe(struct usb_interface *intf, const struct usb_device_id *i
i2c_set_adapdata(&ttusb->i2c_adap, ttusb);
-#ifdef I2C_ADAP_CLASS_TV_DIGITAL
- ttusb->i2c_adap.class = I2C_ADAP_CLASS_TV_DIGITAL;
-#else
ttusb->i2c_adap.class = I2C_CLASS_TV_DIGITAL;
-#endif
ttusb->i2c_adap.algo = &ttusb_dec_algo;
ttusb->i2c_adap.algo_data = NULL;
ttusb->i2c_adap.dev.parent = &udev->dev;
diff --git a/linux/drivers/media/video/au0828/au0828-dvb.c b/linux/drivers/media/video/au0828/au0828-dvb.c
index 709a703fe..0a835354f 100644
--- a/linux/drivers/media/video/au0828/au0828-dvb.c
+++ b/linux/drivers/media/video/au0828/au0828-dvb.c
@@ -224,17 +224,10 @@ static int dvb_register(struct au0828_dev *dev)
"(errno = %d)\n", DRIVER_NAME, result);
goto fail_adapter;
}
-#if (LINUX_VERSION_CODE >= KERNEL_VERSION(2, 6, 12))
dvb->adapter.priv = dev;
/* register frontend */
result = dvb_register_frontend(&dvb->adapter, dvb->frontend);
-#else
- dvb->adapter->priv = dev;
-
- /* register frontend */
- result = dvb_register_frontend(dvb->adapter, dvb->frontend);
-#endif
if (result < 0) {
printk(KERN_ERR "%s: dvb_register_frontend failed "
"(errno = %d)\n", DRIVER_NAME, result);
@@ -260,11 +253,7 @@ static int dvb_register(struct au0828_dev *dev)
dvb->dmxdev.filternum = 256;
dvb->dmxdev.demux = &dvb->demux.dmx;
dvb->dmxdev.capabilities = 0;
-#if (LINUX_VERSION_CODE >= KERNEL_VERSION(2, 6, 12))
result = dvb_dmxdev_init(&dvb->dmxdev, &dvb->adapter);
-#else
- result = dvb_dmxdev_init(&dvb->dmxdev, dvb->adapter);
-#endif
if (result < 0) {
printk(KERN_ERR "%s: dvb_dmxdev_init failed (errno = %d)\n",
DRIVER_NAME, result);
@@ -295,11 +284,7 @@ static int dvb_register(struct au0828_dev *dev)
}
/* register network adapter */
-#if (LINUX_VERSION_CODE >= KERNEL_VERSION(2, 6, 12))
dvb_net_init(&dvb->adapter, &dvb->net, &dvb->demux.dmx);
-#else
- dvb_net_init(dvb->adapter, &dvb->net, &dvb->demux.dmx);
-#endif
return 0;
fail_fe_conn:
@@ -314,11 +299,7 @@ fail_dmx:
dvb_unregister_frontend(dvb->frontend);
fail_frontend:
dvb_frontend_detach(dvb->frontend);
-#if (LINUX_VERSION_CODE >= KERNEL_VERSION(2, 6, 12))
dvb_unregister_adapter(&dvb->adapter);
-#else
- dvb_unregister_adapter(dvb->adapter);
-#endif
fail_adapter:
return result;
}
@@ -339,11 +320,7 @@ void au0828_dvb_unregister(struct au0828_dev *dev)
dvb_dmx_release(&dvb->demux);
dvb_unregister_frontend(dvb->frontend);
dvb_frontend_detach(dvb->frontend);
-#if (LINUX_VERSION_CODE >= KERNEL_VERSION(2, 6, 12))
dvb_unregister_adapter(&dvb->adapter);
-#else
- dvb_unregister_adapter(dvb->adapter);
-#endif
}
/* All the DVB attach calls go here, this function get's modified
diff --git a/linux/drivers/media/video/au0828/au0828-i2c.c b/linux/drivers/media/video/au0828/au0828-i2c.c
index b40a086e4..32858dceb 100644
--- a/linux/drivers/media/video/au0828/au0828-i2c.c
+++ b/linux/drivers/media/video/au0828/au0828-i2c.c
@@ -307,9 +307,7 @@ static struct i2c_algorithm au0828_i2c_algo_template = {
static struct i2c_adapter au0828_i2c_adap_template = {
.name = DRIVER_NAME,
-#if LINUX_VERSION_CODE >= KERNEL_VERSION(2, 6, 0)
.owner = THIS_MODULE,
-#endif
.id = I2C_HW_B_AU0828,
.algo = &au0828_i2c_algo_template,
.class = I2C_CLASS_TV_ANALOG,
diff --git a/linux/drivers/media/video/bt8xx/bt832.c b/linux/drivers/media/video/bt8xx/bt832.c
index 4eefaba8f..e860f7725 100644
--- a/linux/drivers/media/video/bt8xx/bt832.c
+++ b/linux/drivers/media/video/bt8xx/bt832.c
@@ -33,9 +33,6 @@
#include <linux/slab.h>
#include <media/v4l2-common.h>
-#if LINUX_VERSION_CODE < KERNEL_VERSION(2,5,0)
-#include "i2c-compat.h"
-#endif
#include "bttv.h"
#include "bt832.h"
@@ -44,17 +41,10 @@ MODULE_LICENSE("GPL");
/* Addresses to scan */
static unsigned short normal_i2c[] = { I2C_ADDR_BT832_ALT1>>1, I2C_ADDR_BT832_ALT2>>1,
I2C_CLIENT_END };
-#if LINUX_VERSION_CODE < KERNEL_VERSION(2,6,13)
-static unsigned short normal_i2c_range[] = { I2C_CLIENT_END };
-#endif
I2C_CLIENT_INSMOD;
int debug; /* debug output */
-#if LINUX_VERSION_CODE >= KERNEL_VERSION(2, 6, 0)
module_param(debug, int, 0644);
-#else
-MODULE_PARM(debug, "i");
-#endif
/* ---------------------------------------------------------------------- */
@@ -187,12 +177,7 @@ int bt832_init(struct i2c_client *i2c_client_s)
-#if LINUX_VERSION_CODE >= KERNEL_VERSION(2,5,0)
static int bt832_attach(struct i2c_adapter *adap, int addr, int kind)
-#else
-static int bt832_attach(struct i2c_adapter *adap, int addr,
- unsigned short flags, int kind)
-#endif
{
struct bt832 *t;
@@ -207,10 +192,6 @@ static int bt832_attach(struct i2c_adapter *adap, int addr,
v4l_info(&t->client,"chip found @ 0x%x\n", addr<<1);
-
-#if LINUX_VERSION_CODE < KERNEL_VERSION(2,5,0)
- MOD_INC_USE_COUNT;
-#endif
if(! bt832_init(&t->client)) {
bt832_detach(&t->client);
return -1;
@@ -221,13 +202,8 @@ static int bt832_attach(struct i2c_adapter *adap, int addr,
static int bt832_probe(struct i2c_adapter *adap)
{
-#ifdef I2C_CLASS_TV_ANALOG
if (adap->class & I2C_CLASS_TV_ANALOG)
return i2c_probe(adap, &addr_data, bt832_attach);
-#else
- if (adap->id == I2C_HW_B_BT848)
- return i2c_probe(adap, &addr_data, bt832_attach);
-#endif
return 0;
}
@@ -238,9 +214,6 @@ static int bt832_detach(struct i2c_client *client)
v4l_info(&t->client,"dettach\n");
i2c_detach_client(client);
kfree(t);
-#if LINUX_VERSION_CODE < KERNEL_VERSION(2,5,0)
- MOD_DEC_USE_COUNT;
-#endif
return 0;
}
@@ -277,7 +250,7 @@ bt832_command(struct i2c_client *client, unsigned int cmd, void *arg)
/* ----------------------------------------------------------------------- */
static struct i2c_driver driver = {
-#if (LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,0))&&(LINUX_VERSION_CODE <= KERNEL_VERSION(2,6,15))
+#if LINUX_VERSION_CODE <= KERNEL_VERSION(2,6,15)
.owner = THIS_MODULE,
#endif
#if LINUX_VERSION_CODE <= KERNEL_VERSION(2,6,15)
diff --git a/linux/drivers/media/video/bt8xx/bttv-cards.c b/linux/drivers/media/video/bt8xx/bttv-cards.c
index 0e6771643..4d283be22 100644
--- a/linux/drivers/media/video/bt8xx/bttv-cards.c
+++ b/linux/drivers/media/video/bt8xx/bttv-cards.c
@@ -115,31 +115,12 @@ module_param(gpiomask, int, 0444);
module_param(audioall, int, 0444);
module_param(autoload, int, 0444);
-#if LINUX_VERSION_CODE < KERNEL_VERSION(2,5,0)
-MODULE_PARM(card,"1-" __stringify(BTTV_MAX) "i");
-MODULE_PARM(pll,"1-" __stringify(BTTV_MAX) "i");
-MODULE_PARM(tuner,"1-" __stringify(BTTV_MAX) "i");
-MODULE_PARM(svhs,"1-" __stringify(BTTV_MAX) "i");
-MODULE_PARM(remote,"1-" __stringify(BTTV_MAX) "i");
-MODULE_PARM(audiomux,"1-" __stringify(BTTV_MAX) "i");
-#else
-#if LINUX_VERSION_CODE < KERNEL_VERSION(2,6,10)
-static int dummy;
-module_param_array(card, int, dummy, 0444);
-module_param_array(pll, int, dummy, 0444);
-module_param_array(tuner, int, dummy, 0444);
-module_param_array(svhs, int, dummy, 0444);
-module_param_array(remote, int, dummy, 0444);
-module_param_array(audiomux, int, dummy, 0444);
-#else
module_param_array(card, int, NULL, 0444);
module_param_array(pll, int, NULL, 0444);
module_param_array(tuner, int, NULL, 0444);
module_param_array(svhs, int, NULL, 0444);
module_param_array(remote, int, NULL, 0444);
module_param_array(audiomux, int, NULL, 0444);
-#endif
-#endif
MODULE_PARM_DESC(triton1,"set ETBF pci config bit "
"[enable bug compatibility for triton1 + others]");
@@ -3870,11 +3851,7 @@ static int __devinit pvr_boot(struct bttv *btv)
const struct firmware *fw_entry;
int rc;
-#if LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,0)
rc = request_firmware(&fw_entry, "hcwamc.rbf", &btv->c.pci->dev);
-#else
- rc = request_firmware(&fw_entry, "hcwamc.rbf", pci_name(btv->c.pci));
-#endif
if (rc != 0) {
printk(KERN_WARNING "bttv%d: no altera firmware [via hotplug]\n",
btv->c.nr);
diff --git a/linux/drivers/media/video/bt8xx/bttv-driver.c b/linux/drivers/media/video/bt8xx/bttv-driver.c
index 15f10b88a..36efd08f8 100644
--- a/linux/drivers/media/video/bt8xx/bttv-driver.c
+++ b/linux/drivers/media/video/bt8xx/bttv-driver.c
@@ -48,9 +48,7 @@
#include <media/tvaudio.h>
#include <media/msp3400.h>
-#if LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,0)
#include <linux/dma-mapping.h>
-#endif
#include <asm/io.h>
#include <asm/byteorder.h>
@@ -132,16 +130,7 @@ module_param(uv_ratio, int, 0444);
module_param(full_luma_range, int, 0444);
module_param(coring, int, 0444);
-#if LINUX_VERSION_CODE < KERNEL_VERSION(2,5,0)
-MODULE_PARM(radio,"1-" __stringify(BTTV_MAX) "i");
-#else
-#if LINUX_VERSION_CODE < KERNEL_VERSION(2,6,10)
-static int dummy;
-module_param_array(radio, int, dummy, 0444);
-#else
module_param_array(radio, int, NULL, 0444);
-#endif
-#endif
MODULE_PARM_DESC(radio,"The TV card supports radio, default is 0 (no)");
MODULE_PARM_DESC(bigendian,"byte order of the framebuffer, default is native endian");
@@ -171,20 +160,14 @@ MODULE_LICENSE("GPL");
/* ----------------------------------------------------------------------- */
/* sysfs */
-#if LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,0)
-#if LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,13)
static ssize_t show_card(struct device *cd,
struct device_attribute *attr, char *buf)
-#else
-static ssize_t show_card(struct class_device *cd, char *buf)
-#endif
{
struct video_device *vfd = container_of(cd, struct video_device, class_dev);
struct bttv *btv = dev_get_drvdata(vfd->dev);
return sprintf(buf, "%d\n", btv ? btv->c.type : UNSET);
}
static DEVICE_ATTR(card, S_IRUGO, show_card, NULL);
-#endif
/* ----------------------------------------------------------------------- */
/* dvb auto-load setup */
@@ -198,9 +181,6 @@ static void request_module_async(struct work_struct *work)
request_module("dvb-bt8xx");
}
-#if LINUX_VERSION_CODE < KERNEL_VERSION(2,5,0)
-#define request_modules(dev)
-#else
static void request_modules(struct bttv *dev)
{
#if LINUX_VERSION_CODE < KERNEL_VERSION(2,6,20)
@@ -210,7 +190,6 @@ static void request_modules(struct bttv *dev)
#endif
schedule_work(&dev->request_module_wk);
}
-#endif
#else
#define request_modules(dev)
#endif /* CONFIG_MODULES */
@@ -3391,9 +3370,7 @@ static const struct file_operations bttv_fops =
.open = bttv_open,
.release = bttv_release,
.ioctl = video_ioctl2,
-#if LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,11)
.compat_ioctl = v4l_compat_ioctl32,
-#endif
.llseek = no_llseek,
.read = bttv_read,
.mmap = bttv_mmap,
@@ -3672,9 +3649,7 @@ static const struct file_operations radio_fops =
.open = radio_open,
.read = radio_read,
.release = radio_release,
-#if LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,11)
.compat_ioctl = v4l_compat_ioctl32,
-#endif
.ioctl = video_ioctl2,
.llseek = no_llseek,
.poll = radio_poll,
@@ -4115,10 +4090,8 @@ static irqreturn_t bttv_irq(int irq, void *dev_id)
btv=(struct bttv *)dev_id;
-#if LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,0)
if (btv->custom_irq)
handled = btv->custom_irq(btv);
-#endif
count=0;
while (1) {
@@ -4156,9 +4129,7 @@ static irqreturn_t bttv_irq(int irq, void *dev_id)
if ((astat & BT848_INT_GPINT) && btv->remote) {
wake_up(&btv->gpioq);
-#if LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,0)
bttv_input_irq(btv);
-#endif
}
if (astat & BT848_INT_I2CDONE) {
@@ -4238,10 +4209,8 @@ static struct video_device *vdev_init(struct bttv *btv,
return NULL;
*vfd = *template;
vfd->minor = -1;
-#if LINUX_VERSION_CODE > KERNEL_VERSION(2,5,0)
vfd->dev = &btv->c.pci->dev;
vfd->release = video_device_release;
-#endif
vfd->type = type;
vfd->debug = bttv_debug;
snprintf(vfd->name, sizeof(vfd->name), "BT%d%s %s (%s)",
@@ -4394,11 +4363,7 @@ static int __devinit bttv_probe(struct pci_dev *dev,
btv->c.nr);
return -EIO;
}
-#if LINUX_VERSION_CODE <= KERNEL_VERSION(2,6,7)
- if (pci_set_dma_mask(dev, 0xffffffff)) {
-#else
if (pci_set_dma_mask(dev, DMA_32BIT_MASK)) {
-#endif
printk(KERN_WARNING "bttv%d: No suitable DMA available.\n",
btv->c.nr);
return -EIO;
@@ -4509,13 +4474,11 @@ static int __devinit bttv_probe(struct pci_dev *dev,
disclaim_video_lines(btv);
}
-#if LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,0)
/* add subdevices and autoload dvb-bt8xx if needed */
if (bttv_tvcards[btv->c.type].has_dvb) {
bttv_sub_add_device(&btv->c, "dvb");
request_modules(btv);
}
-#endif
bttv_input_init(btv);
@@ -4554,9 +4517,7 @@ static void __devexit bttv_remove(struct pci_dev *pci_dev)
btv->shutdown=1;
wake_up(&btv->gpioq);
bttv_input_fini(btv);
-#if LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,0)
bttv_sub_del_devices(&btv->c);
-#endif
/* unregister i2c_bus + input */
fini_bttv_i2c(btv);
@@ -4609,11 +4570,7 @@ static int bttv_suspend(struct pci_dev *pci_dev, pm_message_t state)
btv->state.gpio_data = gpio_read();
/* save pci state */
-#if LINUX_VERSION_CODE < KERNEL_VERSION(2,6,10)
- pci_save_state(pci_dev, btv->state.pci_cfg);
-#else
pci_save_state(pci_dev);
-#endif
if (0 != pci_set_power_state(pci_dev, pci_choose_state(pci_dev, state))) {
pci_disable_device(pci_dev);
btv->state.disabled = 1;
@@ -4648,11 +4605,7 @@ static int bttv_resume(struct pci_dev *pci_dev)
return err;
}
-#if LINUX_VERSION_CODE < KERNEL_VERSION(2,6,10)
- pci_restore_state(pci_dev, btv->state.pci_cfg);
-#else
pci_restore_state(pci_dev);
-#endif
/* restore bt878 state */
bttv_reinit_bt848(btv);
@@ -4722,13 +4675,11 @@ static int __init bttv_init_module(void)
bttv_check_chipset();
-#if LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,0)
ret = bus_register(&bttv_sub_bus_type);
if (ret < 0) {
printk(KERN_WARNING "bttv: bus_register error: %d\n", ret);
return ret;
}
-#endif
ret = pci_register_driver(&bttv_pci_driver);
if (ret < 0)
bus_unregister(&bttv_sub_bus_type);
@@ -4739,9 +4690,7 @@ static int __init bttv_init_module(void)
static void __exit bttv_cleanup_module(void)
{
pci_unregister_driver(&bttv_pci_driver);
-#if LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,0)
bus_unregister(&bttv_sub_bus_type);
-#endif
}
module_init(bttv_init_module);
diff --git a/linux/drivers/media/video/bt8xx/bttv-i2c.c b/linux/drivers/media/video/bt8xx/bttv-i2c.c
index 746b9dd77..4f48dfb26 100644
--- a/linux/drivers/media/video/bt8xx/bttv-i2c.c
+++ b/linux/drivers/media/video/bt8xx/bttv-i2c.c
@@ -33,9 +33,7 @@
#include "bttvp.h"
#include <media/v4l2-common.h>
-#if LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,0)
#include <linux/jiffies.h>
-#endif
#include <asm/io.h>
static int attach_inform(struct i2c_client *client);
@@ -423,14 +421,10 @@ int __devinit init_bttv_i2c(struct bttv *btv)
btv->c.i2c_adap.algo_data = &btv->i2c_algo;
}
btv->c.i2c_adap.owner = THIS_MODULE;
-#ifdef I2C_CLASS_TV_ANALOG
btv->c.i2c_adap.class = I2C_CLASS_TV_ANALOG;
-#endif
btv->c.i2c_adap.client_register = attach_inform;
-#if LINUX_VERSION_CODE >= KERNEL_VERSION(2,5,66)
btv->c.i2c_adap.dev.parent = &btv->c.pci->dev;
-#endif
snprintf(btv->c.i2c_adap.name, sizeof(btv->c.i2c_adap.name),
"bt%d #%d [%s]", btv->id, btv->c.nr,
btv->use_i2c_hw ? "hw" : "sw");
@@ -438,12 +432,10 @@ int __devinit init_bttv_i2c(struct bttv *btv)
i2c_set_adapdata(&btv->c.i2c_adap, btv);
btv->i2c_client.adapter = &btv->c.i2c_adap;
-#ifdef I2C_CLASS_TV_ANALOG
if (bttv_tvcards[btv->c.type].no_video)
btv->c.i2c_adap.class &= ~I2C_CLASS_TV_ANALOG;
if (bttv_tvcards[btv->c.type].has_dvb)
btv->c.i2c_adap.class |= I2C_CLASS_TV_DIGITAL;
-#endif
if (btv->use_i2c_hw) {
btv->i2c_rc = i2c_add_adapter(&btv->c.i2c_adap);
diff --git a/linux/drivers/media/video/bt8xx/bttv-input.c b/linux/drivers/media/video/bt8xx/bttv-input.c
index f82213990..ada104826 100644
--- a/linux/drivers/media/video/bt8xx/bttv-input.c
+++ b/linux/drivers/media/video/bt8xx/bttv-input.c
@@ -313,7 +313,6 @@ int bttv_input_init(struct bttv *btv)
ir_input_init(input_dev, &ir->ir, ir_type, ir_codes);
input_dev->name = ir->name;
-#if LINUX_VERSION_CODE > KERNEL_VERSION(2,5,0)
input_dev->phys = ir->phys;
input_dev->id.bustype = BUS_PCI;
input_dev->id.version = 1;
@@ -333,7 +332,6 @@ int bttv_input_init(struct bttv *btv)
input_dev->dev = &btv->c.pci->dev;
#endif
#endif
-#endif
btv->remote = ir;
bttv_ir_start(btv, ir);
diff --git a/linux/drivers/media/video/bt8xx/bttv.h b/linux/drivers/media/video/bt8xx/bttv.h
index 4c73aacdb..dab61e62e 100644
--- a/linux/drivers/media/video/bt8xx/bttv.h
+++ b/linux/drivers/media/video/bt8xx/bttv.h
@@ -302,8 +302,6 @@ extern int bttv_write_gpio(unsigned int card,
/* ---------------------------------------------------------- */
/* sysfs/driver-moded based gpio access interface */
-#if LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,0)
-
struct bttv_sub_device {
struct device dev;
struct bttv_core *core;
@@ -335,14 +333,6 @@ void bttv_gpio_bits(struct bttv_core *core, u32 mask, u32 bits);
#define gpio_write(value) bttv_gpio_write(&btv->c, value)
#define gpio_bits(mask,bits) bttv_gpio_bits(&btv->c, mask, bits)
-#else
-
-#define gpio_inout(mask,bits) btaor((mask)&(bits),~(mask),BT848_GPIO_OUT_EN)
-#define gpio_read() btread(BT848_GPIO_DATA)
-#define gpio_write(value) btwrite((value),BT848_GPIO_DATA)
-#define gpio_bits(mask,bits) btaor((mask)&(bits),~(mask),BT848_GPIO_DATA)
-
-#endif
/* ---------------------------------------------------------- */
/* i2c */
diff --git a/linux/drivers/media/video/bt8xx/bttvp.h b/linux/drivers/media/video/bt8xx/bttvp.h
index 9fd8eeddf..c3d1703ac 100644
--- a/linux/drivers/media/video/bt8xx/bttvp.h
+++ b/linux/drivers/media/video/bt8xx/bttvp.h
@@ -42,13 +42,7 @@
#include <asm/io.h>
#include "compat.h"
#include <media/v4l2-common.h>
-
-#if LINUX_VERSION_CODE < KERNEL_VERSION(2,5,0)
-#include "i2c-compat.h"
-#define strlcpy(dest,src,len) strncpy(dest,src,(len)-1)
-#else
#include <linux/device.h>
-#endif
#include <media/videobuf-dma-sg.h>
#include <media/tveeprom.h>
#include <media/ir-common.h>
@@ -272,14 +266,10 @@ extern struct videobuf_queue_ops bttv_vbi_qops;
/* ---------------------------------------------------------- */
/* bttv-gpio.c */
-#if LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,0)
-
extern struct bus_type bttv_sub_bus_type;
int bttv_sub_add_device(struct bttv_core *core, char *name);
int bttv_sub_del_devices(struct bttv_core *core);
-#endif
-
/* ---------------------------------------------------------- */
/* bttv-driver.c */
@@ -318,9 +308,6 @@ struct bttv_input {
};
struct bttv_suspend_state {
-#if LINUX_VERSION_CODE < KERNEL_VERSION(2,6,10)
- u32 pci_cfg[64 / sizeof(u32)];
-#endif
u32 gpio_enable;
u32 gpio_data;
int disabled;
diff --git a/linux/drivers/media/video/compat_ioctl32.c b/linux/drivers/media/video/compat_ioctl32.c
index 6b405e75c..017c2a8d4 100644
--- a/linux/drivers/media/video/compat_ioctl32.c
+++ b/linux/drivers/media/video/compat_ioctl32.c
@@ -12,7 +12,6 @@
* ioctls.
*/
-#if LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,11)
#include <linux/compat.h>
#include <linux/videodev.h>
#include <linux/videodev2.h>
@@ -996,4 +995,3 @@ long v4l_compat_ioctl32(struct file *file, unsigned int cmd, unsigned long arg)
EXPORT_SYMBOL_GPL(v4l_compat_ioctl32);
MODULE_LICENSE("GPL");
-#endif
diff --git a/linux/drivers/media/video/cs5345.c b/linux/drivers/media/video/cs5345.c
index d0bdc009d..e2f0b0278 100644
--- a/linux/drivers/media/video/cs5345.c
+++ b/linux/drivers/media/video/cs5345.c
@@ -34,21 +34,13 @@ MODULE_LICENSE("GPL");
static int debug;
-#if LINUX_VERSION_CODE >= KERNEL_VERSION(2, 6, 0)
module_param(debug, bool, 0644);
-#else
-MODULE_PARM(debug, "i");
-#endif
MODULE_PARM_DESC(debug, "Debugging messages\n\t\t\t0=Off (default), 1=On");
#if LINUX_VERSION_CODE < KERNEL_VERSION(2, 6, 22)
static unsigned short normal_i2c[] = { 0x98 >> 1, I2C_CLIENT_END };
-#if LINUX_VERSION_CODE < KERNEL_VERSION(2, 6, 13)
-static unsigned short normal_i2c_range[] = { I2C_CLIENT_END };
-#endif
-
I2C_CLIENT_INSMOD;
#endif
@@ -191,7 +183,3 @@ static struct v4l2_i2c_driver_data v4l2_i2c_data = {
.id_table = cs5345_id,
#endif
};
-
-#if LINUX_VERSION_CODE < KERNEL_VERSION(2, 5, 0)
-EXPORT_NO_SYMBOLS;
-#endif
diff --git a/linux/drivers/media/video/cs53l32a.c b/linux/drivers/media/video/cs53l32a.c
index 7c0761e21..bef0950e5 100644
--- a/linux/drivers/media/video/cs53l32a.c
+++ b/linux/drivers/media/video/cs53l32a.c
@@ -30,10 +30,6 @@
#include <media/v4l2-common.h>
#include <media/v4l2-chip-ident.h>
#include <media/v4l2-i2c-drv-legacy.h>
-#if LINUX_VERSION_CODE < KERNEL_VERSION(2, 5, 0)
-#include "i2c-compat.h"
-#include <linux/slab.h>
-#endif
#include "compat.h"
MODULE_DESCRIPTION("i2c device driver for cs53l32a Audio ADC");
@@ -42,20 +38,12 @@ MODULE_LICENSE("GPL");
static int debug;
-#if LINUX_VERSION_CODE >= KERNEL_VERSION(2, 6, 0)
module_param(debug, bool, 0644);
-#else
-MODULE_PARM(debug, "i");
-#endif
MODULE_PARM_DESC(debug, "Debugging messages\n\t\t\t0=Off (default), 1=On");
static unsigned short normal_i2c[] = { 0x22 >> 1, I2C_CLIENT_END };
-#if LINUX_VERSION_CODE < KERNEL_VERSION(2, 6, 13)
-static unsigned short normal_i2c_range[] = { I2C_CLIENT_END };
-#endif
-
I2C_CLIENT_INSMOD;
/* ----------------------------------------------------------------------- */
@@ -209,7 +197,3 @@ static struct v4l2_i2c_driver_data v4l2_i2c_data = {
.id_table = cs53l32a_id,
#endif
};
-
-#if LINUX_VERSION_CODE < KERNEL_VERSION(2, 5, 0)
-EXPORT_NO_SYMBOLS;
-#endif
diff --git a/linux/drivers/media/video/cx18/cx18-cards.c b/linux/drivers/media/video/cx18/cx18-cards.c
index bb45bcf68..0caae1a5e 100644
--- a/linux/drivers/media/video/cx18/cx18-cards.c
+++ b/linux/drivers/media/video/cx18/cx18-cards.c
@@ -196,7 +196,7 @@ static const struct cx18_card_pci_info cx18_pci_mpc718[] = {
static const struct cx18_card cx18_card_mpc718 = {
.type = CX18_CARD_YUAN_MPC718,
.name = "Yuan MPC718",
- .comment = "Some Composite and S-Video inputs are currently working.\n",
+ .comment = "Analog video capture works; some audio line in may not.\n",
.v4l2_capabilities = CX18_CAP_ENCODER,
.hw_audio_ctrl = CX18_HW_CX23418,
.hw_all = CX18_HW_TUNER,
@@ -229,7 +229,7 @@ static const struct cx18_card cx18_card_mpc718 = {
.tune_lane = 0,
.initial_emrs = 2,
},
- .xceive_pin = 15,
+ .xceive_pin = 0,
.pci_list = cx18_pci_mpc718,
.i2c = &cx18_i2c_std,
};
diff --git a/linux/drivers/media/video/cx18/cx18-i2c.c b/linux/drivers/media/video/cx18/cx18-i2c.c
index 5b8550e0e..64a259405 100644
--- a/linux/drivers/media/video/cx18/cx18-i2c.c
+++ b/linux/drivers/media/video/cx18/cx18-i2c.c
@@ -39,10 +39,6 @@
#define GETSCL_BIT 0x0004
#define GETSDL_BIT 0x0008
-#ifndef I2C_ADAP_CLASS_TV_ANALOG
-#define I2C_ADAP_CLASS_TV_ANALOG I2C_CLASS_TV_ANALOG
-#endif
-
#define CX18_CS5345_I2C_ADDR 0x4c
/* This array should match the CX18_HW_ defines */
@@ -234,9 +230,7 @@ static struct i2c_adapter cx18_i2c_adap_template = {
.client_unregister = detach_inform,
.owner = THIS_MODULE,
#if LINUX_VERSION_CODE < KERNEL_VERSION(2, 6, 22)
-#ifdef I2C_ADAP_CLASS_TV_ANALOG
- .class = I2C_ADAP_CLASS_TV_ANALOG,
-#endif
+ .class = I2C_CLASS_TV_ANALOG,
#endif
};
@@ -439,6 +433,7 @@ int init_cx18_i2c(struct cx18 *cx)
write_reg_sync(0x00c000c0, 0xc7001c);
mdelay(10);
write_reg_sync(0x00c00000, 0xc7001c);
+ mdelay(10);
write_reg_sync(0x00c00000, 0xc730c8); /* Set to edge-triggered intrs. */
write_reg_sync(0x00c00000, 0xc730c4); /* Clear any stale intrs */
diff --git a/linux/drivers/media/video/cx18/cx18-streams.c b/linux/drivers/media/video/cx18/cx18-streams.c
index deacdb836..df99070e6 100644
--- a/linux/drivers/media/video/cx18/cx18-streams.c
+++ b/linux/drivers/media/video/cx18/cx18-streams.c
@@ -41,9 +41,7 @@ static struct file_operations cx18_v4l2_enc_fops = {
.open = cx18_v4l2_open,
/* FIXME change to video_ioctl2 if serialization lock can be removed */
.ioctl = cx18_v4l2_ioctl,
-#if LINUX_VERSION_CODE >= KERNEL_VERSION(2, 6, 11)
.compat_ioctl = v4l_compat_ioctl32,
-#endif
.release = cx18_v4l2_close,
.poll = cx18_v4l2_enc_poll,
};
diff --git a/linux/drivers/media/video/cx2341x.c b/linux/drivers/media/video/cx2341x.c
index 76b2f8c62..3f2191162 100644
--- a/linux/drivers/media/video/cx2341x.c
+++ b/linux/drivers/media/video/cx2341x.c
@@ -25,9 +25,6 @@
#include <linux/init.h>
#include <linux/types.h>
#include <linux/videodev2.h>
-#if LINUX_VERSION_CODE < KERNEL_VERSION(2, 5, 0)
-#include <linux/slab.h>
-#endif
#include <media/tuner.h>
#include <media/cx2341x.h>
diff --git a/linux/drivers/media/video/cx23885/cx23885-i2c.c b/linux/drivers/media/video/cx23885/cx23885-i2c.c
index ba8e27ca9..f0ee47256 100644
--- a/linux/drivers/media/video/cx23885/cx23885-i2c.c
+++ b/linux/drivers/media/video/cx23885/cx23885-i2c.c
@@ -359,9 +359,7 @@ static struct i2c_algorithm cx23885_i2c_algo_template = {
static struct i2c_adapter cx23885_i2c_adap_template = {
.name = "cx23885",
-#if LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,0)
.owner = THIS_MODULE,
-#endif
.id = I2C_HW_B_CX23885,
.algo = &cx23885_i2c_algo_template,
.class = I2C_CLASS_TV_ANALOG,
diff --git a/linux/drivers/media/video/cx23885/cx23885-video.c b/linux/drivers/media/video/cx23885/cx23885-video.c
index fdbcd53ab..6d0345935 100644
--- a/linux/drivers/media/video/cx23885/cx23885-video.c
+++ b/linux/drivers/media/video/cx23885/cx23885-video.c
@@ -29,9 +29,7 @@
#include <linux/interrupt.h>
#include <linux/delay.h>
#include "compat.h"
-#if LINUX_VERSION_CODE >= KERNEL_VERSION(2, 5, 0)
#include <linux/kthread.h>
-#endif
#include <asm/div64.h>
#include "cx23885.h"
@@ -52,22 +50,9 @@ static unsigned int video_nr[] = {[0 ... (CX23885_MAXBOARDS - 1)] = UNSET };
static unsigned int vbi_nr[] = {[0 ... (CX23885_MAXBOARDS - 1)] = UNSET };
static unsigned int radio_nr[] = {[0 ... (CX23885_MAXBOARDS - 1)] = UNSET };
-#if LINUX_VERSION_CODE < KERNEL_VERSION(2, 5, 0)
-MODULE_PARM(video_nr, "1-" __stringify(CX23885_MAXBOARDS) "i");
-MODULE_PARM(vbi_nr, "1-" __stringify(CX23885_MAXBOARDS) "i");
-MODULE_PARM(radio_nr, "1-" __stringify(CX23885_MAXBOARDS) "i");
-#else
-#if LINUX_VERSION_CODE < KERNEL_VERSION(2, 6, 10)
-static unsigned int dummy;
-module_param_array(video_nr, int, dummy, 0444);
-module_param_array(vbi_nr, int, dummy, 0444);
-module_param_array(radio_nr, int, dummy, 0444);
-#else
module_param_array(video_nr, int, NULL, 0444);
module_param_array(vbi_nr, int, NULL, 0444);
module_param_array(radio_nr, int, NULL, 0444);
-#endif
-#endif
MODULE_PARM_DESC(video_nr, "video device numbers");
MODULE_PARM_DESC(vbi_nr, "vbi device numbers");
@@ -376,10 +361,8 @@ struct video_device *cx23885_vdev_init(struct cx23885_dev *dev,
return NULL;
*vfd = *template;
vfd->minor = -1;
-#if LINUX_VERSION_CODE > KERNEL_VERSION(2, 5, 0)
vfd->dev = &pci->dev;
vfd->release = video_device_release;
-#endif
snprintf(vfd->name, sizeof(vfd->name), "%s %s (%s)",
dev->name, type, cx23885_boards[dev->board].name);
return vfd;
@@ -1654,9 +1637,7 @@ static const struct file_operations video_fops = {
.poll = video_poll,
.mmap = video_mmap,
.ioctl = video_ioctl2,
-#if LINUX_VERSION_CODE >= KERNEL_VERSION(2, 6, 11)
.compat_ioctl = v4l_compat_ioctl32,
-#endif
.llseek = no_llseek,
};
@@ -1707,9 +1688,7 @@ static const struct file_operations radio_fops = {
.open = video_open,
.release = video_release,
.ioctl = video_ioctl2,
-#if LINUX_VERSION_CODE >= KERNEL_VERSION(2, 6, 11)
.compat_ioctl = v4l_compat_ioctl32,
-#endif
.llseek = no_llseek,
};
diff --git a/linux/drivers/media/video/cx25840/cx25840-audio.c b/linux/drivers/media/video/cx25840/cx25840-audio.c
index eda48b596..8e134312c 100644
--- a/linux/drivers/media/video/cx25840/cx25840-audio.c
+++ b/linux/drivers/media/video/cx25840/cx25840-audio.c
@@ -21,9 +21,6 @@
#include <media/v4l2-common.h>
#include <media/cx25840.h>
#include "compat.h"
-#if LINUX_VERSION_CODE < KERNEL_VERSION(2,5,0)
-#include "i2c-compat.h"
-#endif
#include "cx25840-core.h"
diff --git a/linux/drivers/media/video/cx25840/cx25840-core.c b/linux/drivers/media/video/cx25840/cx25840-core.c
index ca5cc0f51..a43ed390a 100644
--- a/linux/drivers/media/video/cx25840/cx25840-core.c
+++ b/linux/drivers/media/video/cx25840/cx25840-core.c
@@ -42,9 +42,6 @@
#include <media/v4l2-i2c-drv-legacy.h>
#include <media/cx25840.h>
#include "compat.h"
-#if LINUX_VERSION_CODE < KERNEL_VERSION(2,5,0)
-#include "i2c-compat.h"
-#endif
#include "cx25840-core.h"
@@ -54,17 +51,9 @@ MODULE_LICENSE("GPL");
static unsigned short normal_i2c[] = { 0x88 >> 1, I2C_CLIENT_END };
-#if LINUX_VERSION_CODE < KERNEL_VERSION(2,6,13)
-static unsigned short normal_i2c_range[] = { I2C_CLIENT_END };
-#endif
-
int cx25840_debug;
-#if LINUX_VERSION_CODE > KERNEL_VERSION(2,5,0)
module_param_named(debug,cx25840_debug, int, 0644);
-#else
-MODULE_PARM(cx25840_debug, "i");
-#endif
MODULE_PARM_DESC(debug, "Debugging messages [0=Off (default) 1=On]");
diff --git a/linux/drivers/media/video/cx25840/cx25840-firmware.c b/linux/drivers/media/video/cx25840/cx25840-firmware.c
index d283ef2d1..95b84ce21 100644
--- a/linux/drivers/media/video/cx25840/cx25840-firmware.c
+++ b/linux/drivers/media/video/cx25840/cx25840-firmware.c
@@ -38,19 +38,11 @@
*/
#define FWSEND 48
-#if LINUX_VERSION_CODE > KERNEL_VERSION(2,5,0)
#define FWDEV(x) &((x)->dev)
-#else
-#define FWDEV(x) (x)->name
-#endif
static char *firmware = FWFILE;
-#if LINUX_VERSION_CODE > KERNEL_VERSION(2,5,0)
module_param(firmware, charp, 0444);
-#else
-MODULE_PARM(firmware, "s");
-#endif
MODULE_PARM_DESC(firmware, "Firmware image [default: " FWFILE "]");
diff --git a/linux/drivers/media/video/cx88/cx88-alsa.c b/linux/drivers/media/video/cx88/cx88-alsa.c
index a8e985b6f..c675cbeae 100644
--- a/linux/drivers/media/video/cx88/cx88-alsa.c
+++ b/linux/drivers/media/video/cx88/cx88-alsa.c
@@ -98,10 +98,6 @@ struct cx88_audio_dev {
typedef struct cx88_audio_dev snd_cx88_card_t;
-#if LINUX_VERSION_CODE <= KERNEL_VERSION(2,6,8)
-#define chip_t snd_cx88_card_t
-#endif
-
#ifdef COMPAT_SND_CTL_BOOLEAN_MONO
static int snd_ctl_boolean_mono_info(struct snd_kcontrol *kcontrol,
struct snd_ctl_elem_info *uinfo)
@@ -122,19 +118,10 @@ static int index[SNDRV_CARDS] = SNDRV_DEFAULT_IDX; /* Index 0-MAX */
static char *id[SNDRV_CARDS] = SNDRV_DEFAULT_STR; /* ID for this card */
static int enable[SNDRV_CARDS] = {1, [1 ... (SNDRV_CARDS - 1)] = 1};
-#if LINUX_VERSION_CODE < KERNEL_VERSION(2,6,10)
-static unsigned int dummy;
-module_param_array(enable, bool, dummy, 0444);
-#else
module_param_array(enable, bool, NULL, 0444);
-#endif
MODULE_PARM_DESC(enable, "Enable cx88x soundcard. default enabled.");
-#if LINUX_VERSION_CODE < KERNEL_VERSION(2,6,10)
-module_param_array(index, int, dummy, 0444);
-#else
module_param_array(index, int, NULL, 0444);
-#endif
MODULE_PARM_DESC(index, "Index value for cx88x capture interface(s).");
diff --git a/linux/drivers/media/video/cx88/cx88-blackbird.c b/linux/drivers/media/video/cx88/cx88-blackbird.c
index a642d3dc8..83638557d 100644
--- a/linux/drivers/media/video/cx88/cx88-blackbird.c
+++ b/linux/drivers/media/video/cx88/cx88-blackbird.c
@@ -30,9 +30,7 @@
#include <linux/init.h>
#include <linux/fs.h>
#include <linux/delay.h>
-#if LINUX_VERSION_CODE >= KERNEL_VERSION(2,5,0)
#include <linux/device.h>
-#endif
#include <linux/firmware.h>
#include <media/v4l2-common.h>
#include <media/cx2341x.h>
@@ -444,13 +442,8 @@ static int blackbird_load_firmware(struct cx8802_dev *dev)
if (retval < 0)
dprintk(0, "Error with register_write\n");
-#if LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,0)
retval = request_firmware(&firmware, CX2341X_FIRM_ENC_FILENAME,
&dev->pci->dev);
-#else
- retval = request_firmware(&firmware, CX2341X_FIRM_ENC_FILENAME,
- pci_name(dev->pci));
-#endif
if (retval != 0) {
diff --git a/linux/drivers/media/video/cx88/cx88-cards.c b/linux/drivers/media/video/cx88/cx88-cards.c
index 1fb39e08e..9329dbf6a 100644
--- a/linux/drivers/media/video/cx88/cx88-cards.c
+++ b/linux/drivers/media/video/cx88/cx88-cards.c
@@ -33,22 +33,9 @@ static unsigned int tuner[] = {[0 ... (CX88_MAXBOARDS - 1)] = UNSET };
static unsigned int radio[] = {[0 ... (CX88_MAXBOARDS - 1)] = UNSET };
static unsigned int card[] = {[0 ... (CX88_MAXBOARDS - 1)] = UNSET };
-#if LINUX_VERSION_CODE < KERNEL_VERSION(2,5,0)
-MODULE_PARM(tuner,"1-" __stringify(CX88_MAXBOARDS) "i");
-MODULE_PARM(radiox,"1-" __stringify(CX88_MAXBOARDS) "i");
-MODULE_PARM(card,"1-" __stringify(CX88_MAXBOARDS) "i");
-#else
-#if LINUX_VERSION_CODE < KERNEL_VERSION(2,6,10)
-static int dummy;
-module_param_array(tuner, int, dummy, 0444);
-module_param_array(radio, int, dummy, 0444);
-module_param_array(card, int, dummy, 0444);
-#else
module_param_array(tuner, int, NULL, 0444);
module_param_array(radio, int, NULL, 0444);
module_param_array(card, int, NULL, 0444);
-#endif
-#endif
MODULE_PARM_DESC(tuner,"tuner type");
MODULE_PARM_DESC(radio,"radio tuner type");
diff --git a/linux/drivers/media/video/cx88/cx88-core.c b/linux/drivers/media/video/cx88/cx88-core.c
index 5d6265c1d..6efb1c61a 100644
--- a/linux/drivers/media/video/cx88/cx88-core.c
+++ b/linux/drivers/media/video/cx88/cx88-core.c
@@ -1037,10 +1037,8 @@ struct video_device *cx88_vdev_init(struct cx88_core *core,
return NULL;
*vfd = *template;
vfd->minor = -1;
-#if LINUX_VERSION_CODE > KERNEL_VERSION(2,5,0)
vfd->dev = &pci->dev;
vfd->release = video_device_release;
-#endif
snprintf(vfd->name, sizeof(vfd->name), "%s %s (%s)",
core->name, type, core->board.name);
return vfd;
diff --git a/linux/drivers/media/video/cx88/cx88-i2c.c b/linux/drivers/media/video/cx88/cx88-i2c.c
index 800ea0d64..df615f19a 100644
--- a/linux/drivers/media/video/cx88/cx88-i2c.c
+++ b/linux/drivers/media/video/cx88/cx88-i2c.c
@@ -34,9 +34,6 @@
#include "cx88.h"
#include <media/v4l2-common.h>
-#if LINUX_VERSION_CODE < KERNEL_VERSION(2,5,0)
-#include "i2c-compat.h"
-#endif
static unsigned int i2c_debug;
module_param(i2c_debug, int, 0644);
@@ -187,22 +184,14 @@ int cx88_i2c_init(struct cx88_core *core, struct pci_dev *pci)
memcpy(&core->i2c_algo, &cx8800_i2c_algo_template,
sizeof(core->i2c_algo));
-#ifdef I2C_CLASS_TV_ANALOG
if (core->board.tuner_type != TUNER_ABSENT)
core->i2c_adap.class |= I2C_CLASS_TV_ANALOG;
-#endif
-#ifdef I2C_CLASS_TV_DIGITAL
if (core->board.mpeg & CX88_MPEG_DVB)
core->i2c_adap.class |= I2C_CLASS_TV_DIGITAL;
-#endif
-#if LINUX_VERSION_CODE >= KERNEL_VERSION(2,5,66)
core->i2c_adap.dev.parent = &pci->dev;
-#endif
strlcpy(core->i2c_adap.name,core->name,sizeof(core->i2c_adap.name));
-#if LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,0)
core->i2c_adap.owner = THIS_MODULE;
-#endif
core->i2c_adap.id = I2C_HW_B_CX2388x;
core->i2c_adap.client_register = attach_inform;
core->i2c_adap.client_unregister = detach_inform;
diff --git a/linux/drivers/media/video/cx88/cx88-input.c b/linux/drivers/media/video/cx88/cx88-input.c
index e334bd20a..4796e3ba1 100644
--- a/linux/drivers/media/video/cx88/cx88-input.c
+++ b/linux/drivers/media/video/cx88/cx88-input.c
@@ -349,7 +349,6 @@ int cx88_ir_init(struct cx88_core *core, struct pci_dev *pci)
ir_input_init(input_dev, &ir->ir, ir_type, ir_codes);
input_dev->name = ir->name;
-#if LINUX_VERSION_CODE >= KERNEL_VERSION(2,5,0)
input_dev->phys = ir->phys;
input_dev->id.bustype = BUS_PCI;
input_dev->id.version = 1;
@@ -369,7 +368,6 @@ int cx88_ir_init(struct cx88_core *core, struct pci_dev *pci)
input_dev->dev = &pci->dev;
#endif
#endif
-#endif
/* record handles to ourself */
ir->core = core;
core->ir = ir;
@@ -500,11 +498,9 @@ void cx88_ir_irq(struct cx88_core *core)
/* ---------------------------------------------------------------------- */
-#if LINUX_VERSION_CODE >= KERNEL_VERSION(2,5,0)
MODULE_AUTHOR("Gerd Knorr, Pavel Machek, Chris Pascoe");
MODULE_DESCRIPTION("input driver for cx88 GPIO-based IR remote controls");
MODULE_LICENSE("GPL");
-#endif
/*
* Local variables:
* c-basic-offset: 8
diff --git a/linux/drivers/media/video/cx88/cx88-mpeg.c b/linux/drivers/media/video/cx88/cx88-mpeg.c
index c8dba3dfa..4af6604ec 100644
--- a/linux/drivers/media/video/cx88/cx88-mpeg.c
+++ b/linux/drivers/media/video/cx88/cx88-mpeg.c
@@ -24,9 +24,7 @@
#include <linux/module.h>
#include <linux/init.h>
-#if LINUX_VERSION_CODE > KERNEL_VERSION(2,5,0)
#include <linux/device.h>
-#endif
#include <linux/dma-mapping.h>
#include <linux/interrupt.h>
#include <asm/delay.h>
@@ -36,13 +34,9 @@
/* ------------------------------------------------------------------ */
MODULE_DESCRIPTION("mpeg driver for cx2388x based TV cards");
-#if LINUX_VERSION_CODE > KERNEL_VERSION(2,5,0)
MODULE_AUTHOR("Jelle Foks <jelle@foks.8m.com>");
MODULE_AUTHOR("Chris Pascoe <c.pascoe@itee.uq.edu.au>");
MODULE_AUTHOR("Gerd Knorr <kraxel@bytesex.org> [SuSE Labs]");
-#else
-MODULE_AUTHOR("Jelle Foks <jelle@foks.8m.com>,Chris Pascoe <c.pascoe@itee.uq.edu.au>,Gerd Knorr <kraxel@bytesex.org> [SuSE Labs]");
-#endif
MODULE_LICENSE("GPL");
static unsigned int debug;
@@ -72,9 +66,6 @@ static void request_module_async(struct work_struct *work)
request_module("cx88-blackbird");
}
-#if LINUX_VERSION_CODE < KERNEL_VERSION(2,5,0)
-#define request_modules(dev)
-#else
static void request_modules(struct cx8802_dev *dev)
{
#if LINUX_VERSION_CODE < KERNEL_VERSION(2,6,20)
@@ -84,7 +75,6 @@ static void request_modules(struct cx8802_dev *dev)
#endif
schedule_work(&dev->request_module_wk);
}
-#endif
#else
#define request_modules(dev)
#endif /* CONFIG_MODULES */
@@ -576,11 +566,7 @@ static int cx8802_suspend_common(struct pci_dev *pci_dev, pm_message_t state)
cx88_shutdown(dev->core);
#endif
-#if LINUX_VERSION_CODE < KERNEL_VERSION(2,6,10)
- pci_save_state(pci_dev, dev->state.pci_cfg);
-#else
pci_save_state(pci_dev);
-#endif
if (0 != pci_set_power_state(pci_dev, pci_choose_state(pci_dev, state))) {
pci_disable_device(pci_dev);
dev->state.disabled = 1;
@@ -612,11 +598,7 @@ static int cx8802_resume_common(struct pci_dev *pci_dev)
return err;
}
-#if LINUX_VERSION_CODE < KERNEL_VERSION(2,6,10)
- pci_restore_state(pci_dev, dev->state.pci_cfg);
-#else
pci_restore_state(pci_dev);
-#endif
#if 1
/* FIXME: re-initialize hardware */
diff --git a/linux/drivers/media/video/cx88/cx88-tvaudio.c b/linux/drivers/media/video/cx88/cx88-tvaudio.c
index b4dab2647..5eb95dbbe 100644
--- a/linux/drivers/media/video/cx88/cx88-tvaudio.c
+++ b/linux/drivers/media/video/cx88/cx88-tvaudio.c
@@ -53,9 +53,7 @@
#include <linux/vmalloc.h>
#include <linux/init.h>
#include <linux/delay.h>
-#if LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,0)
#include <linux/kthread.h>
-#endif
#include "cx88.h"
diff --git a/linux/drivers/media/video/cx88/cx88-video.c b/linux/drivers/media/video/cx88/cx88-video.c
index c9f7d0048..63521066d 100644
--- a/linux/drivers/media/video/cx88/cx88-video.c
+++ b/linux/drivers/media/video/cx88/cx88-video.c
@@ -35,9 +35,7 @@
#include <linux/dma-mapping.h>
#include <linux/delay.h>
#include "compat.h"
-#if LINUX_VERSION_CODE >= KERNEL_VERSION(2,5,0)
#include <linux/kthread.h>
-#endif
#include <asm/div64.h>
#include "cx88.h"
@@ -58,22 +56,9 @@ static unsigned int video_nr[] = {[0 ... (CX88_MAXBOARDS - 1)] = UNSET };
static unsigned int vbi_nr[] = {[0 ... (CX88_MAXBOARDS - 1)] = UNSET };
static unsigned int radio_nr[] = {[0 ... (CX88_MAXBOARDS - 1)] = UNSET };
-#if LINUX_VERSION_CODE < KERNEL_VERSION(2,5,0)
-MODULE_PARM(video_nr,"1-" __stringify(CX88_MAXBOARDS) "i");
-MODULE_PARM(vbi_nr,"1-" __stringify(CX88_MAXBOARDS) "i");
-MODULE_PARM(radio_nr,"1-" __stringify(CX88_MAXBOARDS) "i");
-#else
-#if LINUX_VERSION_CODE < KERNEL_VERSION(2,6,10)
-static unsigned int dummy;
-module_param_array(video_nr, int, dummy, 0444);
-module_param_array(vbi_nr, int, dummy, 0444);
-module_param_array(radio_nr, int, dummy, 0444);
-#else
module_param_array(video_nr, int, NULL, 0444);
module_param_array(vbi_nr, int, NULL, 0444);
module_param_array(radio_nr, int, NULL, 0444);
-#endif
-#endif
MODULE_PARM_DESC(video_nr,"video device numbers");
MODULE_PARM_DESC(vbi_nr,"vbi device numbers");
@@ -1963,9 +1948,7 @@ static const struct file_operations video_fops =
.poll = video_poll,
.mmap = video_mmap,
.ioctl = video_ioctl2,
-#if LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,11)
.compat_ioctl = v4l_compat_ioctl32,
-#endif
.llseek = no_llseek,
};
@@ -2018,9 +2001,7 @@ static const struct file_operations radio_fops =
.open = video_open,
.release = video_release,
.ioctl = video_ioctl2,
-#if LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,11)
.compat_ioctl = v4l_compat_ioctl32,
-#endif
.llseek = no_llseek,
};
@@ -2221,7 +2202,6 @@ static int __devinit cx8800_initdev(struct pci_dev *pci_dev,
mutex_unlock(&core->lock);
/* start tvaudio thread */
-#if LINUX_VERSION_CODE >= KERNEL_VERSION(2,5,0)
if (core->board.tuner_type != TUNER_ABSENT) {
core->kthread = kthread_run(cx88_audio_thread, core, "cx88 tvaudio");
if (IS_ERR(core->kthread)) {
@@ -2230,13 +2210,6 @@ static int __devinit cx8800_initdev(struct pci_dev *pci_dev,
core->name, err);
}
}
-#else
- /*FIXME: Not sure if this will work */
- if (core->board.tuner_type != TUNER_ABSENT)
- kernel_thread (cx88_audio_thread, core, 0);
-
- core->kthread = NULL;
-#endif
return 0;
fail_unreg:
@@ -2306,11 +2279,7 @@ static int cx8800_suspend(struct pci_dev *pci_dev, pm_message_t state)
cx88_shutdown(core);
#endif
-#if LINUX_VERSION_CODE < KERNEL_VERSION(2,6,10)
- pci_save_state(pci_dev, dev->state.pci_cfg);
-#else
pci_save_state(pci_dev);
-#endif
if (0 != pci_set_power_state(pci_dev, pci_choose_state(pci_dev, state))) {
pci_disable_device(pci_dev);
dev->state.disabled = 1;
@@ -2342,11 +2311,7 @@ static int cx8800_resume(struct pci_dev *pci_dev)
return err;
}
-#if LINUX_VERSION_CODE < KERNEL_VERSION(2,6,10)
- pci_restore_state(pci_dev, dev->state.pci_cfg);
-#else
pci_restore_state(pci_dev);
-#endif
#if 1
/* FIXME: re-initialize hardware */
diff --git a/linux/drivers/media/video/cx88/cx88-vp3054-i2c.c b/linux/drivers/media/video/cx88/cx88-vp3054-i2c.c
index 84bb59175..20800425c 100644
--- a/linux/drivers/media/video/cx88/cx88-vp3054-i2c.c
+++ b/linux/drivers/media/video/cx88/cx88-vp3054-i2c.c
@@ -30,10 +30,6 @@
#include "cx88.h"
#include "cx88-vp3054-i2c.h"
-#if LINUX_VERSION_CODE < KERNEL_VERSION(2,5,0)
-#include "i2c-compat.h"
-#endif
-
MODULE_DESCRIPTION("driver for cx2388x VP3054 design");
MODULE_AUTHOR("Chris Pascoe <c.pascoe@itee.uq.edu.au>");
MODULE_LICENSE("GPL");
@@ -124,18 +120,12 @@ int vp3054_i2c_probe(struct cx8802_dev *dev)
memcpy(&vp3054_i2c->algo, &vp3054_i2c_algo_template,
sizeof(vp3054_i2c->algo));
-#ifdef I2C_CLASS_TV_DIGITAL
vp3054_i2c->adap.class |= I2C_CLASS_TV_DIGITAL;
-#endif
-#if LINUX_VERSION_CODE >= KERNEL_VERSION(2,5,66)
vp3054_i2c->adap.dev.parent = &dev->pci->dev;
-#endif
strlcpy(vp3054_i2c->adap.name, core->name,
sizeof(vp3054_i2c->adap.name));
-#if LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,0)
vp3054_i2c->adap.owner = THIS_MODULE;
-#endif
vp3054_i2c->adap.id = I2C_HW_B_CX2388x;
vp3054_i2c->algo.data = dev;
i2c_set_adapdata(&vp3054_i2c->adap, dev);
diff --git a/linux/drivers/media/video/cx88/cx88.h b/linux/drivers/media/video/cx88/cx88.h
index 4222f919e..161b3cc13 100644
--- a/linux/drivers/media/video/cx88/cx88.h
+++ b/linux/drivers/media/video/cx88/cx88.h
@@ -386,9 +386,6 @@ struct cx8800_fh {
};
struct cx8800_suspend_state {
-#if LINUX_VERSION_CODE < KERNEL_VERSION(2,6,10)
- u32 pci_cfg[64 / sizeof(u32)];
-#endif
int disabled;
};
@@ -445,9 +442,6 @@ struct cx8802_fh {
};
struct cx8802_suspend_state {
-#if LINUX_VERSION_CODE < KERNEL_VERSION(2,6,10)
- u32 pci_cfg[64 / sizeof(u32)];
-#endif
int disabled;
};
diff --git a/linux/drivers/media/video/em28xx/em28xx-dvb.c b/linux/drivers/media/video/em28xx/em28xx-dvb.c
index c04e62739..b8a5c61ce 100644
--- a/linux/drivers/media/video/em28xx/em28xx-dvb.c
+++ b/linux/drivers/media/video/em28xx/em28xx-dvb.c
@@ -63,11 +63,7 @@ struct em28xx_dvb {
int nfeeds;
/* general boilerplate stuff */
-#if (LINUX_VERSION_CODE >= KERNEL_VERSION(2, 6, 12))
struct dvb_adapter adapter;
-#else
- struct dvb_adapter *adapter;
-#endif
struct dvb_demux demux;
struct dmxdev dmxdev;
struct dmx_frontend fe_hw;
@@ -303,17 +299,10 @@ int register_dvb(struct em28xx_dvb *dvb,
/* Ensure all frontends negotiate bus access */
dvb->frontend->ops.ts_bus_ctrl = em28xx_dvb_bus_ctrl;
-#if (LINUX_VERSION_CODE >= KERNEL_VERSION(2, 6, 12))
dvb->adapter.priv = dev;
/* register frontend */
result = dvb_register_frontend(&dvb->adapter, dvb->frontend);
-#else
- dvb->adapter->priv = dev;
-
- /* register frontend */
- result = dvb_register_frontend(dvb->adapter, dvb->frontend);
-#endif
if (result < 0) {
printk(KERN_WARNING "%s: dvb_register_frontend failed (errno = %d)\n",
dev->name, result);
@@ -340,11 +329,7 @@ int register_dvb(struct em28xx_dvb *dvb,
dvb->dmxdev.filternum = 256;
dvb->dmxdev.demux = &dvb->demux.dmx;
dvb->dmxdev.capabilities = 0;
-#if (LINUX_VERSION_CODE >= KERNEL_VERSION(2, 6, 12))
result = dvb_dmxdev_init(&dvb->dmxdev, &dvb->adapter);
-#else
- result = dvb_dmxdev_init(&dvb->dmxdev, dvb->adapter);
-#endif
if (result < 0) {
printk(KERN_WARNING "%s: dvb_dmxdev_init failed (errno = %d)\n",
dev->name, result);
@@ -375,11 +360,7 @@ int register_dvb(struct em28xx_dvb *dvb,
}
/* register network adapter */
-#if (LINUX_VERSION_CODE >= KERNEL_VERSION(2, 6, 12))
dvb_net_init(&dvb->adapter, &dvb->net, &dvb->demux.dmx);
-#else
- dvb_net_init(dvb->adapter, &dvb->net, &dvb->demux.dmx);
-#endif
return 0;
fail_fe_conn:
@@ -394,11 +375,7 @@ fail_dmx:
dvb_unregister_frontend(dvb->frontend);
fail_frontend:
dvb_frontend_detach(dvb->frontend);
-#if (LINUX_VERSION_CODE >= KERNEL_VERSION(2, 6, 12))
dvb_unregister_adapter(&dvb->adapter);
-#else
- dvb_unregister_adapter(dvb->adapter);
-#endif
fail_adapter:
return result;
}
@@ -412,11 +389,7 @@ static void unregister_dvb(struct em28xx_dvb *dvb)
dvb_dmx_release(&dvb->demux);
dvb_unregister_frontend(dvb->frontend);
dvb_frontend_detach(dvb->frontend);
-#if (LINUX_VERSION_CODE >= KERNEL_VERSION(2, 6, 12))
dvb_unregister_adapter(&dvb->adapter);
-#else
- dvb_unregister_adapter(dvb->adapter);
-#endif
}
diff --git a/linux/drivers/media/video/em28xx/em28xx-i2c.c b/linux/drivers/media/video/em28xx/em28xx-i2c.c
index c22e73019..4d6f650da 100644
--- a/linux/drivers/media/video/em28xx/em28xx-i2c.c
+++ b/linux/drivers/media/video/em28xx/em28xx-i2c.c
@@ -432,18 +432,6 @@ static u32 functionality(struct i2c_adapter *adap)
return I2C_FUNC_SMBUS_EMUL;
}
-#ifndef I2C_PEC
-static void inc_use(struct i2c_adapter *adap)
-{
- MOD_INC_USE_COUNT;
-}
-
-static void dec_use(struct i2c_adapter *adap)
-{
- MOD_DEC_USE_COUNT;
-}
-#endif
-
/*
* attach_inform()
* gets called when a device attaches to the i2c bus
@@ -521,15 +509,8 @@ static struct i2c_algorithm em28xx_algo = {
};
static struct i2c_adapter em28xx_adap_template = {
-#ifdef I2C_PEC
.owner = THIS_MODULE,
-#else
- .inc_use = inc_use,
- .dec_use = dec_use,
-#endif
-#ifdef I2C_CLASS_TV_ANALOG
.class = I2C_CLASS_TV_ANALOG,
-#endif
.name = "em28xx",
.id = I2C_HW_B_EM28XX,
.algo = &em28xx_algo,
diff --git a/linux/drivers/media/video/em28xx/em28xx-video.c b/linux/drivers/media/video/em28xx/em28xx-video.c
index f4479aeca..5929d0860 100644
--- a/linux/drivers/media/video/em28xx/em28xx-video.c
+++ b/linux/drivers/media/video/em28xx/em28xx-video.c
@@ -42,9 +42,6 @@
#include <media/v4l2-common.h>
#include <media/msp3400.h>
#include <media/tuner.h>
-#if LINUX_VERSION_CODE < KERNEL_VERSION(2, 5, 0)
-#include "i2c-compat.h"
-#endif
#define DRIVER_AUTHOR "Ludovico Cavedon <cavedon@sssup.it>, " \
"Markus Rechberger <mrechberger@gmail.com>, " \
@@ -83,25 +80,10 @@ static unsigned int video_nr[] = {[0 ... (EM28XX_MAXBOARDS - 1)] = UNSET };
static unsigned int vbi_nr[] = {[0 ... (EM28XX_MAXBOARDS - 1)] = UNSET };
static unsigned int radio_nr[] = {[0 ... (EM28XX_MAXBOARDS - 1)] = UNSET };
-#if LINUX_VERSION_CODE < KERNEL_VERSION(2, 5, 0)
-MODULE_PARM(card, "1-" __stringify(EM28XX_MAXBOARDS) "i");
-MODULE_PARM(video_nr, "1-" __stringify(EM28XX_MAXBOARDS) "i");
-MODULE_PARM(vbi_nr, "1-" __stringify(EM28XX_MAXBOARDS) "i");
-MODULE_PARM(radio_nr, "1-" __stringify(EM28XX_MAXBOARDS) "i");
-#else
-#if LINUX_VERSION_CODE < KERNEL_VERSION(2, 6, 10)
-static int dummy;
-module_param_array(card, int, dummy, 0444);
-module_param_array(video_nr, int, dummy, 0444);
-module_param_array(vbi_nr, int, dummy, 0444);
-module_param_array(radio_nr, int, dummy, 0444);
-#else
module_param_array(card, int, NULL, 0444);
module_param_array(video_nr, int, NULL, 0444);
module_param_array(vbi_nr, int, NULL, 0444);
module_param_array(radio_nr, int, NULL, 0444);
-#endif
-#endif
MODULE_PARM_DESC(card, "card type");
MODULE_PARM_DESC(video_nr, "video device numbers");
MODULE_PARM_DESC(vbi_nr, "vbi device numbers");
@@ -1837,9 +1819,7 @@ static const struct file_operations em28xx_v4l_fops = {
.mmap = em28xx_v4l2_mmap,
.ioctl = video_ioctl2,
.llseek = no_llseek,
-#if LINUX_VERSION_CODE >= KERNEL_VERSION(2, 6, 11)
.compat_ioctl = v4l_compat_ioctl32,
-#endif
};
static const struct file_operations radio_fops = {
@@ -1847,9 +1827,7 @@ static const struct file_operations radio_fops = {
.open = em28xx_v4l2_open,
.release = em28xx_v4l2_close,
.ioctl = video_ioctl2,
-#if LINUX_VERSION_CODE >= KERNEL_VERSION(2, 6, 11)
.compat_ioctl = v4l_compat_ioctl32,
-#endif
.llseek = no_llseek,
};
@@ -1978,10 +1956,8 @@ static struct video_device *em28xx_vdev_init(struct em28xx *dev,
return NULL;
*vfd = *template;
vfd->minor = -1;
-#if LINUX_VERSION_CODE > KERNEL_VERSION(2, 5, 0)
vfd->dev = &dev->udev->dev;
vfd->release = video_device_release;
-#endif
vfd->type = type;
vfd->debug = video_debug;
@@ -2167,9 +2143,6 @@ static void request_module_async(struct work_struct *work)
request_module("em28xx-dvb");
}
-#if LINUX_VERSION_CODE < KERNEL_VERSION(2, 5, 0)
-#define request_modules(dev)
-#else
static void request_modules(struct em28xx *dev)
{
#if LINUX_VERSION_CODE < KERNEL_VERSION(2, 6, 20)
@@ -2180,7 +2153,6 @@ static void request_modules(struct em28xx *dev)
#endif
schedule_work(&dev->request_module_wk);
}
-#endif
#else
#define request_modules(dev)
#endif /* CONFIG_MODULES */
diff --git a/linux/drivers/media/video/gspca/conex.c b/linux/drivers/media/video/gspca/conex.c
index b0294c927..b5481017d 100644
--- a/linux/drivers/media/video/gspca/conex.c
+++ b/linux/drivers/media/video/gspca/conex.c
@@ -25,8 +25,8 @@
#define CONEX_CAM 1 /* special JPEG header */
#include "jpeg.h"
-#define DRIVER_VERSION_NUMBER KERNEL_VERSION(2, 1, 0)
-static const char version[] = "2.1.0";
+#define DRIVER_VERSION_NUMBER KERNEL_VERSION(2, 1, 5)
+static const char version[] = "2.1.5";
MODULE_AUTHOR("Michel Xhaard <mxhaard@users.sourceforge.net>");
MODULE_DESCRIPTION("GSPCA USB Conexant Camera Driver");
@@ -52,7 +52,6 @@ static int sd_setcolors(struct gspca_dev *gspca_dev, __s32 val);
static int sd_getcolors(struct gspca_dev *gspca_dev, __s32 *val);
static struct ctrl sd_ctrls[] = {
-#define SD_BRIGHTNESS 0
{
{
.id = V4L2_CID_BRIGHTNESS,
@@ -61,12 +60,12 @@ static struct ctrl sd_ctrls[] = {
.minimum = 0,
.maximum = 255,
.step = 1,
- .default_value = 0xd4,
+#define BRIGHTNESS_DEF 0xd4
+ .default_value = BRIGHTNESS_DEF,
},
.set = sd_setbrightness,
.get = sd_getbrightness,
},
-#define SD_CONTRAST 1
{
{
.id = V4L2_CID_CONTRAST,
@@ -75,12 +74,12 @@ static struct ctrl sd_ctrls[] = {
.minimum = 0x0a,
.maximum = 0x1f,
.step = 1,
- .default_value = 0x0c,
+#define CONTRAST_DEF 0x0c
+ .default_value = CONTRAST_DEF,
},
.set = sd_setcontrast,
.get = sd_getcontrast,
},
-#define SD_COLOR 2
{
{
.id = V4L2_CID_SATURATION,
@@ -89,18 +88,35 @@ static struct ctrl sd_ctrls[] = {
.minimum = 0,
.maximum = 7,
.step = 1,
- .default_value = 3,
+#define COLOR_DEF 3
+ .default_value = COLOR_DEF,
},
.set = sd_setcolors,
.get = sd_getcolors,
},
};
-static struct cam_mode vga_mode[] = {
- {V4L2_PIX_FMT_JPEG, 176, 144, 3},
- {V4L2_PIX_FMT_JPEG, 320, 240, 2},
- {V4L2_PIX_FMT_JPEG, 352, 288, 1},
- {V4L2_PIX_FMT_JPEG, 640, 480, 0},
+static struct v4l2_pix_format vga_mode[] = {
+ {176, 144, V4L2_PIX_FMT_JPEG, V4L2_FIELD_NONE,
+ .bytesperline = 176,
+ .sizeimage = 176 * 144 * 3 / 8 + 590,
+ .colorspace = V4L2_COLORSPACE_JPEG,
+ .priv = 3},
+ {320, 240, V4L2_PIX_FMT_JPEG, V4L2_FIELD_NONE,
+ .bytesperline = 320,
+ .sizeimage = 320 * 240 * 3 / 8 + 590,
+ .colorspace = V4L2_COLORSPACE_JPEG,
+ .priv = 2},
+ {352, 288, V4L2_PIX_FMT_JPEG, V4L2_FIELD_NONE,
+ .bytesperline = 352,
+ .sizeimage = 352 * 288 * 3 / 8 + 590,
+ .colorspace = V4L2_COLORSPACE_JPEG,
+ .priv = 1},
+ {640, 480, V4L2_PIX_FMT_JPEG, V4L2_FIELD_NONE,
+ .bytesperline = 640,
+ .sizeimage = 640 * 480 * 3 / 8 + 590,
+ .colorspace = V4L2_COLORSPACE_JPEG,
+ .priv = 0},
};
static void reg_r(struct usb_device *dev,
@@ -114,21 +130,29 @@ static void reg_r(struct usb_device *dev,
0,
index, buffer, length,
500);
- PDEBUG(D_USBI, "reg read i:%02x -> %02x", index, *buffer);
+ PDEBUG(D_USBI, "reg read [%02x] -> %02x ..", index, *buffer);
}
static void reg_w(struct usb_device *dev,
__u16 index,
- const __u8 *buffer, __u16 length)
+ const __u8 *buffer, __u16 len)
{
- PDEBUG(D_USBO, "reg write i:%02x = %02x", index, *buffer);
+ __u8 tmpbuf[8];
+
+#ifdef CONFIG_VIDEO_ADV_DEBUG
+ if (len > sizeof tmpbuf) {
+ PDEBUG(D_ERR|D_PACK, "reg_w: buffer overflow");
+ return;
+ }
+ PDEBUG(D_USBO, "reg write [%02x] = %02x..", index, *buffer);
+#endif
+ memcpy(tmpbuf, buffer, len);
usb_control_msg(dev,
usb_sndctrlpipe(dev, 0),
0,
USB_DIR_OUT | USB_TYPE_VENDOR | USB_RECIP_DEVICE,
0,
- index, (__u8 *) buffer, length,
- 500);
+ index, tmpbuf, len, 500);
}
static const __u8 cx_sensor_init[][4] = {
@@ -221,7 +245,7 @@ static void cx11646_fw(struct gspca_dev*gspca_dev)
reg_w(gspca_dev->dev, 0x006a, &val, 1);
}
-static __u8 cxsensor[] = {
+static const __u8 cxsensor[] = {
0x88, 0x12, 0x70, 0x01,
0x88, 0x0d, 0x02, 0x01,
0x88, 0x0f, 0x00, 0x01,
@@ -236,24 +260,24 @@ static __u8 cxsensor[] = {
0x00
};
-static __u8 reg20[] = { 0x10, 0x42, 0x81, 0x19, 0xd3, 0xff, 0xa7, 0xff };
-static __u8 reg28[] = { 0x87, 0x00, 0x87, 0x00, 0x8f, 0xff, 0xea, 0xff };
-static __u8 reg10[] = { 0xb1, 0xb1 };
-static __u8 reg71a[] = { 0x08, 0x18, 0x0a, 0x1e }; /* 640 */
-static __u8 reg71b[] = { 0x04, 0x0c, 0x05, 0x0f };
+static const __u8 reg20[] = { 0x10, 0x42, 0x81, 0x19, 0xd3, 0xff, 0xa7, 0xff };
+static const __u8 reg28[] = { 0x87, 0x00, 0x87, 0x00, 0x8f, 0xff, 0xea, 0xff };
+static const __u8 reg10[] = { 0xb1, 0xb1 };
+static const __u8 reg71a[] = { 0x08, 0x18, 0x0a, 0x1e }; /* 640 */
+static const __u8 reg71b[] = { 0x04, 0x0c, 0x05, 0x0f };
/* 352{0x04,0x0a,0x06,0x12}; //352{0x05,0x0e,0x06,0x11}; //352 */
-static __u8 reg71c[] = { 0x02, 0x07, 0x03, 0x09 };
+static const __u8 reg71c[] = { 0x02, 0x07, 0x03, 0x09 };
/* 320{0x04,0x0c,0x05,0x0f}; //320 */
-static __u8 reg71d[] = { 0x02, 0x07, 0x03, 0x09 }; /* 176 */
-static __u8 reg7b[] = { 0x00, 0xff, 0x00, 0xff, 0x00, 0xff };
+static const __u8 reg71d[] = { 0x02, 0x07, 0x03, 0x09 }; /* 176 */
+static const __u8 reg7b[] = { 0x00, 0xff, 0x00, 0xff, 0x00, 0xff };
static void cx_sensor(struct gspca_dev*gspca_dev)
{
- __u8 val = 0;
+ __u8 val;
int i = 0;
__u8 bufread[] = { 0, 0, 0, 0, 0, 0, 0, 0 };
- int length = 0;
- __u8 *ptsensor = cxsensor;
+ int length;
+ const __u8 *ptsensor = cxsensor;
reg_w(gspca_dev->dev, 0x0020, reg20, 8);
reg_w(gspca_dev->dev, 0x0028, reg28, 8);
@@ -261,7 +285,7 @@ static void cx_sensor(struct gspca_dev*gspca_dev)
val = 0x03;
reg_w(gspca_dev->dev, 0x0092, &val, 1);
- switch (gspca_dev->cam.cam_mode[(int) gspca_dev->curr_mode].mode) {
+ switch (gspca_dev->cam.cam_mode[(int) gspca_dev->curr_mode].priv) {
case 0:
reg_w(gspca_dev->dev, 0x0071, reg71a, 4);
break;
@@ -269,7 +293,7 @@ static void cx_sensor(struct gspca_dev*gspca_dev)
reg_w(gspca_dev->dev, 0x0071, reg71b, 4);
break;
default:
-/* case 2: */
+/* case 2: */
reg_w(gspca_dev->dev, 0x0071, reg71c, 4);
break;
case 3:
@@ -297,7 +321,7 @@ static void cx_sensor(struct gspca_dev*gspca_dev)
reg_r(gspca_dev->dev, 0x00e7, bufread, 8);
}
-static __u8 cx_inits_176[] = {
+static const __u8 cx_inits_176[] = {
0x33, 0x81, 0xB0, 0x00, 0x90, 0x00, 0x0A, 0x03, /* 176x144 */
0x00, 0x03, 0x03, 0x03, 0x1B, 0x05, 0x30, 0x03,
0x65, 0x15, 0x18, 0x25, 0x03, 0x25, 0x08, 0x30,
@@ -306,7 +330,7 @@ static __u8 cx_inits_176[] = {
0xF7, 0xFF, 0x88, 0xFF, 0x66, 0x02, 0x28, 0x02,
0x1E, 0x03, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00
};
-static __u8 cx_inits_320[] = {
+static const __u8 cx_inits_320[] = {
0x7f, 0x7f, 0x40, 0x01, 0xf0, 0x00, 0x02, 0x01,
0x00, 0x01, 0x01, 0x01, 0x10, 0x00, 0x02, 0x01,
0x65, 0x45, 0xfa, 0x4c, 0x2c, 0xdf, 0xb9, 0x81,
@@ -315,7 +339,7 @@ static __u8 cx_inits_320[] = {
0xf5, 0xff, 0x6d, 0xff, 0xf6, 0x01, 0x43, 0x02,
0xd3, 0x03, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00
};
-static __u8 cx_inits_352[] = {
+static const __u8 cx_inits_352[] = {
0x2e, 0x7c, 0x60, 0x01, 0x20, 0x01, 0x05, 0x03,
0x00, 0x06, 0x03, 0x06, 0x1b, 0x10, 0x05, 0x3b,
0x30, 0x25, 0x18, 0x25, 0x08, 0x30, 0x03, 0x25,
@@ -324,7 +348,7 @@ static __u8 cx_inits_352[] = {
0xf5, 0xff, 0x6b, 0xff, 0xee, 0x01, 0x43, 0x02,
0xe4, 0x03, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00
};
-static __u8 cx_inits_640[] = {
+static const __u8 cx_inits_640[] = {
0x7e, 0x7e, 0x80, 0x02, 0xe0, 0x01, 0x01, 0x01,
0x00, 0x02, 0x01, 0x02, 0x10, 0x30, 0x01, 0x01,
0x65, 0x45, 0xf7, 0x52, 0x2c, 0xdf, 0xb9, 0x81,
@@ -336,13 +360,13 @@ static __u8 cx_inits_640[] = {
static int cx11646_initsize(struct gspca_dev *gspca_dev)
{
- __u8 *cxinit;
+ const __u8 *cxinit;
__u8 val;
static const __u8 reg12[] = { 0x08, 0x05, 0x07, 0x04, 0x24 };
static const __u8 reg17[] =
{ 0x0a, 0x00, 0xf2, 0x01, 0x0f, 0x00, 0x97, 0x02 };
- switch (gspca_dev->cam.cam_mode[(int) gspca_dev->curr_mode].mode) {
+ switch (gspca_dev->cam.cam_mode[(int) gspca_dev->curr_mode].priv) {
case 0:
cxinit = cx_inits_640;
break;
@@ -388,7 +412,7 @@ static int cx11646_initsize(struct gspca_dev *gspca_dev)
return val;
}
-static __u8 cx_jpeg_init[][8] = {
+static const __u8 cx_jpeg_init[][8] = {
{0xff, 0xd8, 0xff, 0xdb, 0x00, 0x84, 0x00, 0x15}, /* 1 */
{0x0f, 0x10, 0x12, 0x10, 0x0d, 0x15, 0x12, 0x11},
{0x12, 0x18, 0x16, 0x15, 0x19, 0x20, 0x35, 0x22},
@@ -471,7 +495,7 @@ static __u8 cx_jpeg_init[][8] = {
};
-static __u8 cxjpeg_640[][8] = {
+static const __u8 cxjpeg_640[][8] = {
{0xff, 0xd8, 0xff, 0xdb, 0x00, 0x84, 0x00, 0x10}, /* 1 */
{0x0b, 0x0c, 0x0e, 0x0c, 0x0a, 0x10, 0x0e, 0x0d},
{0x0e, 0x12, 0x11, 0x10, 0x13, 0x18, 0x28, 0x1a},
@@ -500,7 +524,7 @@ static __u8 cxjpeg_640[][8] = {
{0x00, 0x01, 0x11, 0x02, 0x11, 0x00, 0x3F, 0x00},
{0xFF, 0xD9, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00} /* 27 */
};
-static __u8 cxjpeg_352[][8] = {
+static const __u8 cxjpeg_352[][8] = {
{0xff, 0xd8, 0xff, 0xdb, 0x00, 0x84, 0x00, 0x0d},
{0x09, 0x09, 0x0b, 0x09, 0x08, 0x0D, 0x0b, 0x0a},
{0x0b, 0x0e, 0x0d, 0x0d, 0x0f, 0x13, 0x1f, 0x14},
@@ -529,7 +553,7 @@ static __u8 cxjpeg_352[][8] = {
{0x00, 0x01, 0x11, 0x02, 0x11, 0x00, 0x3F, 0x00},
{0xFF, 0xD9, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00}
};
-static __u8 cxjpeg_320[][8] = {
+static const __u8 cxjpeg_320[][8] = {
{0xff, 0xd8, 0xff, 0xdb, 0x00, 0x84, 0x00, 0x05},
{0x03, 0x04, 0x04, 0x04, 0x03, 0x05, 0x04, 0x04},
{0x04, 0x05, 0x05, 0x05, 0x06, 0x07, 0x0c, 0x08},
@@ -558,7 +582,7 @@ static __u8 cxjpeg_320[][8] = {
{0x00, 0x01, 0x11, 0x02, 0x11, 0x00, 0x3F, 0x00},
{0xFF, 0xD9, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00} /* 27 */
};
-static __u8 cxjpeg_176[][8] = {
+static const __u8 cxjpeg_176[][8] = {
{0xff, 0xd8, 0xff, 0xdb, 0x00, 0x84, 0x00, 0x0d},
{0x09, 0x09, 0x0B, 0x09, 0x08, 0x0D, 0x0B, 0x0A},
{0x0B, 0x0E, 0x0D, 0x0D, 0x0F, 0x13, 0x1F, 0x14},
@@ -587,7 +611,8 @@ static __u8 cxjpeg_176[][8] = {
{0x00, 0x01, 0x11, 0x02, 0x11, 0x00, 0x3F, 0x00},
{0xFF, 0xD9, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00}
};
-static __u8 cxjpeg_qtable[][8] = { /* 640 take with the zcx30x part */
+/* 640 take with the zcx30x part */
+static const __u8 cxjpeg_qtable[][8] = {
{0xff, 0xd8, 0xff, 0xdb, 0x00, 0x84, 0x00, 0x08},
{0x06, 0x06, 0x07, 0x06, 0x05, 0x08, 0x07, 0x07},
{0x07, 0x09, 0x09, 0x08, 0x0a, 0x0c, 0x14, 0x0a},
@@ -633,22 +658,23 @@ static void cx11646_jpegInit(struct gspca_dev*gspca_dev)
reg_w(gspca_dev->dev, 0x0055, &val, 1);
}
-static __u8 reg12[] = { 0x0a, 0x05, 0x07, 0x04, 0x19 };
-static __u8 regE5_8[] = { 0x88, 0x00, 0xd4, 0x01, 0x88, 0x01, 0x01, 0x01 };
-static __u8 regE5a[] = { 0x88, 0x0a, 0x0c, 0x01 };
-static __u8 regE5b[] = { 0x88, 0x0b, 0x12, 0x01 };
-static __u8 regE5c[] = { 0x88, 0x05, 0x01, 0x01 };
-static __u8 reg51[] = { 0x77, 0x03 };
-static __u8 reg70 = 0x03;
+static const __u8 reg12[] = { 0x0a, 0x05, 0x07, 0x04, 0x19 };
+static const __u8 regE5_8[] =
+ { 0x88, 0x00, 0xd4, 0x01, 0x88, 0x01, 0x01, 0x01 };
+static const __u8 regE5a[] = { 0x88, 0x0a, 0x0c, 0x01 };
+static const __u8 regE5b[] = { 0x88, 0x0b, 0x12, 0x01 };
+static const __u8 regE5c[] = { 0x88, 0x05, 0x01, 0x01 };
+static const __u8 reg51[] = { 0x77, 0x03 };
+static const __u8 reg70 = 0x03;
static void cx11646_jpeg(struct gspca_dev*gspca_dev)
{
__u8 val;
int i;
- int length = 8;
- __u8 Reg55 = 0x14;
- __u8 bufread[8] = { 0, 0, 0, 0, 0, 0, 0, 0 };
- int retry = 50;
+ int length;
+ __u8 Reg55;
+ __u8 bufread[8];
+ int retry;
val = 0x01;
reg_w(gspca_dev->dev, 0x00c0, &val, 1);
@@ -657,13 +683,13 @@ static void cx11646_jpeg(struct gspca_dev*gspca_dev)
val = 0x00;
reg_w(gspca_dev->dev, 0x00c0, &val, 1);
reg_r(gspca_dev->dev, 0x0001, &val, 1);
- switch (gspca_dev->cam.cam_mode[(int) gspca_dev->curr_mode].mode) {
+ length = 8;
+ switch (gspca_dev->cam.cam_mode[(int) gspca_dev->curr_mode].priv) {
case 0:
for (i = 0; i < 27; i++) {
if (i == 26)
length = 2;
- reg_w(gspca_dev->dev, 0x0008,
- cxjpeg_640[i], length);
+ reg_w(gspca_dev->dev, 0x0008, cxjpeg_640[i], length);
}
Reg55 = 0x28;
break;
@@ -671,8 +697,7 @@ static void cx11646_jpeg(struct gspca_dev*gspca_dev)
for (i = 0; i < 27; i++) {
if (i == 26)
length = 2;
- reg_w(gspca_dev->dev, 0x0008,
- cxjpeg_352[i], length);
+ reg_w(gspca_dev->dev, 0x0008, cxjpeg_352[i], length);
}
Reg55 = 0x16;
break;
@@ -681,8 +706,7 @@ static void cx11646_jpeg(struct gspca_dev*gspca_dev)
for (i = 0; i < 27; i++) {
if (i == 26)
length = 2;
- reg_w(gspca_dev->dev, 0x0008,
- cxjpeg_320[i], length);
+ reg_w(gspca_dev->dev, 0x0008, cxjpeg_320[i], length);
}
Reg55 = 0x14;
break;
@@ -690,8 +714,7 @@ static void cx11646_jpeg(struct gspca_dev*gspca_dev)
for (i = 0; i < 27; i++) {
if (i == 26)
length = 2;
- reg_w(gspca_dev->dev, 0x0008,
- cxjpeg_176[i], length);
+ reg_w(gspca_dev->dev, 0x0008, cxjpeg_176[i], length);
}
Reg55 = 0x0B;
break;
@@ -715,6 +738,7 @@ static void cx11646_jpeg(struct gspca_dev*gspca_dev)
val = 0x00;
reg_w(gspca_dev->dev, 0x0000, &val, 1);
/* wait for completion */
+ retry = 50;
while (retry--) {
reg_r(gspca_dev->dev, 0x0002, &val, 1);
/* 0x07 until 0x00 */
@@ -731,8 +755,7 @@ static void cx11646_jpeg(struct gspca_dev*gspca_dev)
for (i = 0; i < 18; i++) {
if (i == 17)
length = 2;
- reg_w(gspca_dev->dev, 0x0008,
- cxjpeg_qtable[i], length);
+ reg_w(gspca_dev->dev, 0x0008, cxjpeg_qtable[i], length);
}
reg_r(gspca_dev->dev, 0x0002, &val, 1); /* 0x00 */
@@ -793,8 +816,8 @@ static void cx11646_init1(struct gspca_dev *gspca_dev)
reg_w(gspca_dev->dev, 0x003f, &val, 1);
val = 0x40;
reg_w(gspca_dev->dev, 0x003d, &val, 1);
-/* val= 0x60; */
-/* reg_w(gspca_dev->dev,0x00,0x00,0x003d,&val,1); */
+/* val= 0x60; */
+/* reg_w(gspca_dev->dev, 0x00, 0x00, 0x003d, &val, 1); */
reg_r(gspca_dev->dev, 0x0099, &val, 1); /* ->0x07 */
while (cx_sensor_init[i][0]) {
@@ -824,10 +847,10 @@ static int sd_config(struct gspca_dev *gspca_dev,
cam->cam_mode = vga_mode;
cam->nmodes = sizeof vga_mode / sizeof vga_mode[0];
- sd->qindex = 0; /* set the quantization table */
- sd->brightness = sd_ctrls[SD_BRIGHTNESS].qctrl.default_value;
- sd->contrast = sd_ctrls[SD_CONTRAST].qctrl.default_value;
- sd->colors = sd_ctrls[SD_COLOR].qctrl.default_value;
+ sd->qindex = 0; /* set the quantization */
+ sd->brightness = BRIGHTNESS_DEF;
+ sd->contrast = CONTRAST_DEF;
+ sd->colors = COLOR_DEF;
return 0;
}
@@ -866,7 +889,7 @@ static void sd_stop0(struct gspca_dev *gspca_dev)
reg_w(gspca_dev->dev, 0x0053, &val, 1);
while (retry--) {
-/* reg_r (gspca_dev->dev,0x00,0x00,0x0002,&val,1);*/
+/* reg_r(gspca_dev->dev, 0x0002, &val, 1);*/
reg_r(gspca_dev->dev, 0x0053, &val, 1);
if (val == 0)
break;
@@ -888,7 +911,7 @@ static void sd_close(struct gspca_dev *gspca_dev)
static void sd_pkt_scan(struct gspca_dev *gspca_dev,
struct gspca_frame *frame, /* target */
- unsigned char *data, /* isoc packet */
+ __u8 *data, /* isoc packet */
int len) /* iso packet length */
{
if (data[0] == 0xff && data[1] == 0xd8) {
@@ -911,21 +934,22 @@ static void setbrightness(struct gspca_dev*gspca_dev)
{
struct sd *sd = (struct sd *) gspca_dev;
__u8 regE5cbx[] = { 0x88, 0x00, 0xd4, 0x01, 0x88, 0x01, 0x01, 0x01 };
- __u8 reg51c[] = { 0x77, 0x03 };
+ __u8 reg51c[2];
__u8 bright;
__u8 colors;
__u8 val;
__u8 bufread[8];
bright = sd->brightness;
- colors = sd->colors;
regE5cbx[2] = bright;
- reg51c[1] = colors;
reg_w(gspca_dev->dev, 0x00e5, regE5cbx, 8);
reg_r(gspca_dev->dev, 0x00e8, bufread, 8);
reg_w(gspca_dev->dev, 0x00e5, regE5c, 4);
reg_r(gspca_dev->dev, 0x00e8, &val, 1); /* 0x00 */
+ colors = sd->colors;
+ reg51c[0] = 0x77;
+ reg51c[1] = colors;
reg_w(gspca_dev->dev, 0x0051, reg51c, 2);
reg_w(gspca_dev->dev, 0x0010, reg10, 2);
reg_w(gspca_dev->dev, 0x0070, &reg70, 1);
@@ -935,14 +959,15 @@ static void setcontrast(struct gspca_dev*gspca_dev)
{
struct sd *sd = (struct sd *) gspca_dev;
__u8 regE5acx[] = { 0x88, 0x0a, 0x0c, 0x01 }; /* seem MSB */
- /* __u8 regE5bcx[]={0x88,0x0b,0x12,0x01}; // LSB */
- __u8 reg51c[] = { 0x77, 0x03 };
+/* __u8 regE5bcx[] = { 0x88, 0x0b, 0x12, 0x01}; * LSB */
+ __u8 reg51c[2];
__u8 val;
- reg51c[1] = sd->colors;
regE5acx[2] = sd->contrast;
reg_w(gspca_dev->dev, 0x00e5, regE5acx, 4);
reg_r(gspca_dev->dev, 0x00e8, &val, 1); /* 0x00 */
+ reg51c[0] = 0x77;
+ reg51c[1] = sd->colors;
reg_w(gspca_dev->dev, 0x0051, reg51c, 2);
reg_w(gspca_dev->dev, 0x0010, reg10, 2);
reg_w(gspca_dev->dev, 0x0070, &reg70, 1);
diff --git a/linux/drivers/media/video/gspca/etoms.c b/linux/drivers/media/video/gspca/etoms.c
index f3320584a..fe34ee8d6 100644
--- a/linux/drivers/media/video/gspca/etoms.c
+++ b/linux/drivers/media/video/gspca/etoms.c
@@ -22,8 +22,8 @@
#include "gspca.h"
-#define DRIVER_VERSION_NUMBER KERNEL_VERSION(2, 1, 0)
-static const char version[] = "2.1.0";
+#define DRIVER_VERSION_NUMBER KERNEL_VERSION(2, 1, 5)
+static const char version[] = "2.1.5";
MODULE_AUTHOR("Michel Xhaard <mxhaard@users.sourceforge.net>");
MODULE_DESCRIPTION("Etoms USB Camera Driver");
@@ -56,7 +56,6 @@ static int sd_setautogain(struct gspca_dev *gspca_dev, __s32 val);
static int sd_getautogain(struct gspca_dev *gspca_dev, __s32 *val);
static struct ctrl sd_ctrls[] = {
-#define SD_BRIGHTNESS 0
{
{
.id = V4L2_CID_BRIGHTNESS,
@@ -65,12 +64,12 @@ static struct ctrl sd_ctrls[] = {
.minimum = 1,
.maximum = 127,
.step = 1,
- .default_value = 63,
+#define BRIGHTNESS_DEF 63
+ .default_value = BRIGHTNESS_DEF,
},
.set = sd_setbrightness,
.get = sd_getbrightness,
},
-#define SD_CONTRAST 1
{
{
.id = V4L2_CID_CONTRAST,
@@ -79,12 +78,12 @@ static struct ctrl sd_ctrls[] = {
.minimum = 0,
.maximum = 255,
.step = 1,
- .default_value = 127,
+#define CONTRAST_DEF 127
+ .default_value = CONTRAST_DEF,
},
.set = sd_setcontrast,
.get = sd_getcontrast,
},
-#define SD_COLOR 2
{
{
.id = V4L2_CID_SATURATION,
@@ -93,12 +92,12 @@ static struct ctrl sd_ctrls[] = {
.minimum = 0,
.maximum = 15,
.step = 1,
- .default_value = 7,
+#define COLOR_DEF 7
+ .default_value = COLOR_DEF,
},
.set = sd_setcolors,
.get = sd_getcolors,
},
-#define SD_AUTOGAIN 3
{
{
.id = V4L2_CID_AUTOGAIN,
@@ -107,21 +106,38 @@ static struct ctrl sd_ctrls[] = {
.minimum = 0,
.maximum = 1,
.step = 1,
- .default_value = 1,
+#define AUTOGAIN_DEF 1
+ .default_value = AUTOGAIN_DEF,
},
.set = sd_setautogain,
.get = sd_getautogain,
},
};
-static struct cam_mode vga_mode[] = {
- {V4L2_PIX_FMT_SBGGR8, 320, 240, 1},
-/* {V4L2_PIX_FMT_SBGGR8, 640, 480, 0}, */
+static struct v4l2_pix_format vga_mode[] = {
+ {320, 240, V4L2_PIX_FMT_SBGGR8, V4L2_FIELD_NONE,
+ .bytesperline = 320,
+ .sizeimage = 320 * 240,
+ .colorspace = V4L2_COLORSPACE_SRGB,
+ .priv = 1},
+/* {640, 480, V4L2_PIX_FMT_SBGGR8, V4L2_FIELD_NONE,
+ .bytesperline = 640,
+ .sizeimage = 640 * 480,
+ .colorspace = V4L2_COLORSPACE_SRGB,
+ .priv = 0}, */
};
-static struct cam_mode sif_mode[] = {
- {V4L2_PIX_FMT_SBGGR8, 176, 144, 1},
- {V4L2_PIX_FMT_SBGGR8, 352, 288, 0},
+static struct v4l2_pix_format sif_mode[] = {
+ {176, 144, V4L2_PIX_FMT_SBGGR8, V4L2_FIELD_NONE,
+ .bytesperline = 176,
+ .sizeimage = 176 * 144,
+ .colorspace = V4L2_COLORSPACE_SRGB,
+ .priv = 1},
+ {352, 288, V4L2_PIX_FMT_SBGGR8, V4L2_FIELD_NONE,
+ .bytesperline = 352,
+ .sizeimage = 352 * 288,
+ .colorspace = V4L2_COLORSPACE_SRGB,
+ .priv = 0},
};
#define ETOMS_ALT_SIZE_1000 12
@@ -205,15 +221,15 @@ static struct cam_mode sif_mode[] = {
#define PAS106_REG0e 0x0e /* global gain [4..0](default 0x0e) */
#define PAS106_REG13 0x13 /* end i2c write */
-static __u8 GainRGBG[] = { 0x80, 0x80, 0x80, 0x80, 0x00, 0x00 };
+static const __u8 GainRGBG[] = { 0x80, 0x80, 0x80, 0x80, 0x00, 0x00 };
-static __u8 I2c2[] = { 0x08, 0x08, 0x08, 0x08, 0x0d };
+static const __u8 I2c2[] = { 0x08, 0x08, 0x08, 0x08, 0x0d };
-static __u8 I2c3[] = { 0x12, 0x05 };
+static const __u8 I2c3[] = { 0x12, 0x05 };
-static __u8 I2c4[] = { 0x41, 0x08 };
+static const __u8 I2c4[] = { 0x41, 0x08 };
-static void Et_RegRead(struct usb_device *dev,
+static void reg_r(struct usb_device *dev,
__u16 index, __u8 *buffer, int len)
{
usb_control_msg(dev,
@@ -223,61 +239,71 @@ static void Et_RegRead(struct usb_device *dev,
0, index, buffer, len, 500);
}
-static void Et_RegWrite(struct usb_device *dev,
- __u16 index, __u8 *buffer, __u16 len)
+static void reg_w_val(struct usb_device *dev,
+ __u16 index, __u8 val)
{
+ __u8 data;
+
+ data = val;
usb_control_msg(dev,
usb_sndctrlpipe(dev, 0),
0,
USB_DIR_OUT | USB_TYPE_VENDOR | USB_RECIP_INTERFACE,
- 0, index, buffer, len, 500);
+ 0, index, &data, 1, 500);
}
-static int Et_i2cwrite(struct usb_device *dev, __u8 reg, __u8 *buffer,
- __u16 length, __u8 mode)
+static void reg_w(struct usb_device *dev,
+ __u16 index, const __u8 *buffer, __u16 len)
{
-/* buffer should be [D0..D7] */
- int i, j;
- __u8 base = 0x40; /* sensor base for the pas106 */
- __u8 ptchcount = 0;
-
- ptchcount = (((length & 0x07) << 4) | (mode & 0x03));
-/* set the base address */
- Et_RegWrite(dev, ET_I2C_BASE, &base, 1);
-/* set count and prefetch */
- Et_RegWrite(dev, ET_I2C_COUNT, &ptchcount, 1);
-/* set the register base */
- Et_RegWrite(dev, ET_I2C_REG, &reg, 1);
- j = length - 1;
- for (i = 0; i < length; i++) {
- Et_RegWrite(dev, (ET_I2C_DATA0 + j), &buffer[j], 1);
- j--;
- }
+ __u8 tmpbuf[8];
+
+ memcpy(tmpbuf, buffer, len);
+ usb_control_msg(dev,
+ usb_sndctrlpipe(dev, 0),
+ 0,
+ USB_DIR_OUT | USB_TYPE_VENDOR | USB_RECIP_INTERFACE,
+ 0, index, tmpbuf, len, 500);
+}
+
+static int Et_i2cwrite(struct usb_device *dev, __u8 reg,
+ const __u8 *buffer,
+ __u16 len, __u8 mode)
+{
+ /* buffer should be [D0..D7] */
+ __u8 ptchcount;
+
+ /* set the base address */
+ reg_w_val(dev, ET_I2C_BASE, 0x40); /* sensor base for the pas106 */
+ /* set count and prefetch */
+ ptchcount = ((len & 0x07) << 4) | (mode & 0x03);
+ reg_w_val(dev, ET_I2C_COUNT, ptchcount);
+ /* set the register base */
+ reg_w_val(dev, ET_I2C_REG, reg);
+ while (--len >= 0)
+ reg_w_val(dev, ET_I2C_DATA0 + len, buffer[len]);
return 0;
}
-static int Et_i2cread(struct usb_device *dev, __u8 reg, __u8 *buffer,
- __u16 length, __u8 mode)
+static int Et_i2cread(struct usb_device *dev, __u8 reg,
+ __u8 *buffer,
+ __u16 length, __u8 mode)
{
-/* buffer should be [D0..D7] */
+ /* buffer should be [D0..D7] */
int i, j;
- __u8 base = 0x40; /* sensor base for the pas106 */
__u8 ptchcount;
- __u8 prefetch = 0x02;
-
- ptchcount = (((length & 0x07) << 4) | (mode & 0x03));
-/* set the base address */
- Et_RegWrite(dev, ET_I2C_BASE, &base, 1);
-/* set count and prefetch */
- Et_RegWrite(dev, ET_I2C_COUNT, &ptchcount, 1);
-/* set the register base */
- Et_RegWrite(dev, ET_I2C_REG, &reg, 1);
- Et_RegWrite(dev, ET_I2C_PREFETCH, &prefetch, 1);
- prefetch = 0x00;
- Et_RegWrite(dev, ET_I2C_PREFETCH, &prefetch, 1);
+
+ /* set the base address */
+ reg_w_val(dev, ET_I2C_BASE, 0x40); /* sensor base for the pas106 */
+ /* set count and prefetch */
+ ptchcount = ((length & 0x07) << 4) | (mode & 0x03);
+ reg_w_val(dev, ET_I2C_COUNT, ptchcount);
+ /* set the register base */
+ reg_w_val(dev, ET_I2C_REG, reg);
+ reg_w_val(dev, ET_I2C_PREFETCH, 0x02); /* prefetch */
+ reg_w_val(dev, ET_I2C_PREFETCH, 0);
j = length - 1;
for (i = 0; i < length; i++) {
- Et_RegRead(dev, (ET_I2C_DATA0 + j), &buffer[j], 1);
+ reg_r(dev, (ET_I2C_DATA0 + j), &buffer[j], 1);
j--;
}
return 0;
@@ -289,229 +315,146 @@ static int Et_WaitStatus(struct usb_device *dev)
int retry = 10;
while (retry--) {
- Et_RegRead(dev, ET_ClCK, &bytereceived, 1);
+ reg_r(dev, ET_ClCK, &bytereceived, 1);
if (bytereceived != 0)
return 1;
}
return 0;
}
-static int Et_videoOff(struct usb_device *dev)
+static int et_video(struct usb_device *dev, int on)
{
int err;
- __u8 stopvideo = 0;
- Et_RegWrite(dev, ET_GPIO_OUT, &stopvideo, 1);
+ reg_w_val(dev, ET_GPIO_OUT, on
+ ? 0x10 /* startvideo - set Bit5 */
+ : 0); /* stopvideo */
err = Et_WaitStatus(dev);
if (!err)
- PDEBUG(D_ERR, "timeout Et_waitStatus VideoON");
- return err;
-}
-
-static int Et_videoOn(struct usb_device *dev)
-{
- int err;
- __u8 startvideo = 0x10; /* set Bit5 */
-
- Et_RegWrite(dev, ET_GPIO_OUT, &startvideo, 1);
- err = Et_WaitStatus(dev);
- if (!err)
- PDEBUG(D_ERR, "timeout Et_waitStatus VideoOFF");
+ PDEBUG(D_ERR, "timeout video on/off");
return err;
}
static void Et_init2(struct gspca_dev *gspca_dev)
{
struct usb_device *dev = gspca_dev->dev;
- __u8 value = 0x00;
- __u8 received = 0x00;
- __u8 FormLine[] = { 0x84, 0x03, 0x14, 0xf4, 0x01, 0x05 };
+ __u8 value;
+ __u8 received;
+ static const __u8 FormLine[] = { 0x84, 0x03, 0x14, 0xf4, 0x01, 0x05 };
PDEBUG(D_STREAM, "Open Init2 ET");
- value = 0x2f;
- Et_RegWrite(dev, ET_GPIO_DIR_CTRL, &value, 1);
- value = 0x10;
- Et_RegWrite(dev, ET_GPIO_OUT, &value, 1);
- Et_RegRead(dev, ET_GPIO_IN, &received, 1);
- value = 0x14; /* 0x14 // 0x16 enabled pattern */
- Et_RegWrite(dev, ET_ClCK, &value, 1);
- value = 0x1b;
- Et_RegWrite(dev, ET_CTRL, &value, 1);
+ reg_w_val(dev, ET_GPIO_DIR_CTRL, 0x2f);
+ reg_w_val(dev, ET_GPIO_OUT, 0x10);
+ reg_r(dev, ET_GPIO_IN, &received, 1);
+ reg_w_val(dev, ET_ClCK, 0x14); /* 0x14 // 0x16 enabled pattern */
+ reg_w_val(dev, ET_CTRL, 0x1b);
/* compression et subsampling */
- if (gspca_dev->cam.cam_mode[(int) gspca_dev->curr_mode].mode)
+ if (gspca_dev->cam.cam_mode[(int) gspca_dev->curr_mode].priv)
value = ET_COMP_VAL1; /* 320 */
else
value = ET_COMP_VAL0; /* 640 */
- Et_RegWrite(dev, ET_COMP, &value, 1);
- value = 0x1f;
- Et_RegWrite(dev, ET_MAXQt, &value, 1);
- value = 0x04;
- Et_RegWrite(dev, ET_MINQt, &value, 1);
+ reg_w_val(dev, ET_COMP, value);
+ reg_w_val(dev, ET_MAXQt, 0x1f);
+ reg_w_val(dev, ET_MINQt, 0x04);
/* undocumented registers */
- value = 0xff;
- Et_RegWrite(dev, ET_REG1d, &value, 1);
- value = 0xff;
- Et_RegWrite(dev, ET_REG1e, &value, 1);
- value = 0xff;
- Et_RegWrite(dev, ET_REG1f, &value, 1);
- value = 0x35;
- Et_RegWrite(dev, ET_REG20, &value, 1);
- value = 0x01;
- Et_RegWrite(dev, ET_REG21, &value, 1);
- value = 0x00;
- Et_RegWrite(dev, ET_REG22, &value, 1);
- value = 0xff;
- Et_RegWrite(dev, ET_REG23, &value, 1);
- value = 0xff;
- Et_RegWrite(dev, ET_REG24, &value, 1);
- value = 0x0f;
- Et_RegWrite(dev, ET_REG25, &value, 1);
+ reg_w_val(dev, ET_REG1d, 0xff);
+ reg_w_val(dev, ET_REG1e, 0xff);
+ reg_w_val(dev, ET_REG1f, 0xff);
+ reg_w_val(dev, ET_REG20, 0x35);
+ reg_w_val(dev, ET_REG21, 0x01);
+ reg_w_val(dev, ET_REG22, 0x00);
+ reg_w_val(dev, ET_REG23, 0xff);
+ reg_w_val(dev, ET_REG24, 0xff);
+ reg_w_val(dev, ET_REG25, 0x0f);
/* colors setting */
- value = 0x11;
- Et_RegWrite(dev, 0x30, &value, 1); /* 0x30 */
- value = 0x40;
- Et_RegWrite(dev, 0x31, &value, 1);
- value = 0x00;
- Et_RegWrite(dev, 0x32, &value, 1);
- value = 0x00;
- Et_RegWrite(dev, ET_O_RED, &value, 1); /* 0x34 */
- value = 0x00;
- Et_RegWrite(dev, ET_O_GREEN1, &value, 1);
- value = 0x00;
- Et_RegWrite(dev, ET_O_BLUE, &value, 1);
- value = 0x00;
- Et_RegWrite(dev, ET_O_GREEN2, &value, 1);
+ reg_w_val(dev, 0x30, 0x11); /* 0x30 */
+ reg_w_val(dev, 0x31, 0x40);
+ reg_w_val(dev, 0x32, 0x00);
+ reg_w_val(dev, ET_O_RED, 0x00); /* 0x34 */
+ reg_w_val(dev, ET_O_GREEN1, 0x00);
+ reg_w_val(dev, ET_O_BLUE, 0x00);
+ reg_w_val(dev, ET_O_GREEN2, 0x00);
/*************/
- value = 0x80;
- Et_RegWrite(dev, ET_G_RED, &value, 1); /* 0x4d */
- value = 0x80;
- Et_RegWrite(dev, ET_G_GREEN1, &value, 1);
- value = 0x80;
- Et_RegWrite(dev, ET_G_BLUE, &value, 1);
- value = 0x80;
- Et_RegWrite(dev, ET_G_GREEN2, &value, 1);
- value = 0x00;
- Et_RegWrite(dev, ET_G_GR_H, &value, 1);
- value = 0x00;
- Et_RegWrite(dev, ET_G_GB_H, &value, 1); /* 0x52 */
+ reg_w_val(dev, ET_G_RED, 0x80); /* 0x4d */
+ reg_w_val(dev, ET_G_GREEN1, 0x80);
+ reg_w_val(dev, ET_G_BLUE, 0x80);
+ reg_w_val(dev, ET_G_GREEN2, 0x80);
+ reg_w_val(dev, ET_G_GR_H, 0x00);
+ reg_w_val(dev, ET_G_GB_H, 0x00); /* 0x52 */
/* Window control registers */
-
- value = 0x80; /* use cmc_out */
- Et_RegWrite(dev, 0x61, &value, 1);
-
- value = 0x02;
- Et_RegWrite(dev, 0x62, &value, 1);
- value = 0x03;
- Et_RegWrite(dev, 0x63, &value, 1);
- value = 0x14;
- Et_RegWrite(dev, 0x64, &value, 1);
- value = 0x0e;
- Et_RegWrite(dev, 0x65, &value, 1);
- value = 0x02;
- Et_RegWrite(dev, 0x66, &value, 1);
- value = 0x02;
- Et_RegWrite(dev, 0x67, &value, 1);
+ reg_w_val(dev, 0x61, 0x80); /* use cmc_out */
+ reg_w_val(dev, 0x62, 0x02);
+ reg_w_val(dev, 0x63, 0x03);
+ reg_w_val(dev, 0x64, 0x14);
+ reg_w_val(dev, 0x65, 0x0e);
+ reg_w_val(dev, 0x66, 0x02);
+ reg_w_val(dev, 0x67, 0x02);
/**************************************/
- value = 0x8f;
- Et_RegWrite(dev, ET_SYNCHRO, &value, 1); /* 0x68 */
- value = 0x69; /* 0x6a //0x69 */
- Et_RegWrite(dev, ET_STARTX, &value, 1);
- value = 0x0d; /* 0x0d //0x0c */
- Et_RegWrite(dev, ET_STARTY, &value, 1);
- value = 0x80;
- Et_RegWrite(dev, ET_WIDTH_LOW, &value, 1);
- value = 0xe0;
- Et_RegWrite(dev, ET_HEIGTH_LOW, &value, 1);
- value = 0x60;
- Et_RegWrite(dev, ET_W_H_HEIGTH, &value, 1); /* 6d */
- value = 0x86;
- Et_RegWrite(dev, ET_REG6e, &value, 1);
- value = 0x01;
- Et_RegWrite(dev, ET_REG6f, &value, 1);
- value = 0x26;
- Et_RegWrite(dev, ET_REG70, &value, 1);
- value = 0x7a;
- Et_RegWrite(dev, ET_REG71, &value, 1);
- value = 0x01;
- Et_RegWrite(dev, ET_REG72, &value, 1);
+ reg_w_val(dev, ET_SYNCHRO, 0x8f); /* 0x68 */
+ reg_w_val(dev, ET_STARTX, 0x69); /* 0x6a //0x69 */
+ reg_w_val(dev, ET_STARTY, 0x0d); /* 0x0d //0x0c */
+ reg_w_val(dev, ET_WIDTH_LOW, 0x80);
+ reg_w_val(dev, ET_HEIGTH_LOW, 0xe0);
+ reg_w_val(dev, ET_W_H_HEIGTH, 0x60); /* 6d */
+ reg_w_val(dev, ET_REG6e, 0x86);
+ reg_w_val(dev, ET_REG6f, 0x01);
+ reg_w_val(dev, ET_REG70, 0x26);
+ reg_w_val(dev, ET_REG71, 0x7a);
+ reg_w_val(dev, ET_REG72, 0x01);
/* Clock Pattern registers ***************** */
- value = 0x00;
- Et_RegWrite(dev, ET_REG73, &value, 1);
- value = 0x18; /* 0x28 */
- Et_RegWrite(dev, ET_REG74, &value, 1);
- value = 0x0f; /* 0x01 */
- Et_RegWrite(dev, ET_REG75, &value, 1);
+ reg_w_val(dev, ET_REG73, 0x00);
+ reg_w_val(dev, ET_REG74, 0x18); /* 0x28 */
+ reg_w_val(dev, ET_REG75, 0x0f); /* 0x01 */
/**********************************************/
- value = 0x20;
- Et_RegWrite(dev, 0x8a, &value, 1);
- value = 0x0f;
- Et_RegWrite(dev, 0x8d, &value, 1);
- value = 0x08;
- Et_RegWrite(dev, 0x8e, &value, 1);
+ reg_w_val(dev, 0x8a, 0x20);
+ reg_w_val(dev, 0x8d, 0x0f);
+ reg_w_val(dev, 0x8e, 0x08);
/**************************************/
- value = 0x08;
- Et_RegWrite(dev, 0x03, &value, 1);
- value = 0x03;
- Et_RegWrite(dev, ET_PXL_CLK, &value, 1);
- value = 0xff;
- Et_RegWrite(dev, 0x81, &value, 1);
- value = 0x00;
- Et_RegWrite(dev, 0x80, &value, 1);
- value = 0xff;
- Et_RegWrite(dev, 0x81, &value, 1);
- value = 0x20;
- Et_RegWrite(dev, 0x80, &value, 1);
- value = 0x01;
- Et_RegWrite(dev, 0x03, &value, 1);
- value = 0x00;
- Et_RegWrite(dev, 0x03, &value, 1);
- value = 0x08;
- Et_RegWrite(dev, 0x03, &value, 1);
+ reg_w_val(dev, 0x03, 0x08);
+ reg_w_val(dev, ET_PXL_CLK, 0x03);
+ reg_w_val(dev, 0x81, 0xff);
+ reg_w_val(dev, 0x80, 0x00);
+ reg_w_val(dev, 0x81, 0xff);
+ reg_w_val(dev, 0x80, 0x20);
+ reg_w_val(dev, 0x03, 0x01);
+ reg_w_val(dev, 0x03, 0x00);
+ reg_w_val(dev, 0x03, 0x08);
/********************************************/
- /* Et_RegRead(dev,0x0,ET_I2C_BASE,&received,1);
+/* reg_r(dev, ET_I2C_BASE, &received, 1);
always 0x40 as the pas106 ??? */
/* set the sensor */
- if (gspca_dev->cam.cam_mode[(int) gspca_dev->curr_mode].mode) {
- value = 0x04; /* 320 */
- Et_RegWrite(dev, ET_PXL_CLK, &value, 1);
- /* now set by fifo the FormatLine setting */
- Et_RegWrite(dev, 0x62, FormLine, 6);
- } else { /* 640 */
- /* setting PixelClock
- 0x03 mean 24/(3+1) = 6 Mhz
- 0x05 -> 24/(5+1) = 4 Mhz
- 0x0b -> 24/(11+1) = 2 Mhz
- 0x17 -> 24/(23+1) = 1 Mhz
- */
- value = 0x1e; /* 0x17 */
- Et_RegWrite(dev, ET_PXL_CLK, &value, 1);
- /* now set by fifo the FormatLine setting */
- Et_RegWrite(dev, 0x62, FormLine, 6);
- }
+ if (gspca_dev->cam.cam_mode[(int) gspca_dev->curr_mode].priv)
+ value = 0x04; /* 320 */
+ else /* 640 */
+ value = 0x1e; /* 0x17 * setting PixelClock
+ * 0x03 mean 24/(3+1) = 6 Mhz
+ * 0x05 -> 24/(5+1) = 4 Mhz
+ * 0x0b -> 24/(11+1) = 2 Mhz
+ * 0x17 -> 24/(23+1) = 1 Mhz
+ */
+ reg_w_val(dev, ET_PXL_CLK, value);
+ /* now set by fifo the FormatLine setting */
+ reg_w(dev, 0x62, FormLine, 6);
/* set exposure times [ 0..0x78] 0->longvalue 0x78->shortvalue */
- value = 0x47; /* 0x47; */
- Et_RegWrite(dev, 0x81, &value, 1);
- value = 0x40; /* 0x40; */
- Et_RegWrite(dev, 0x80, &value, 1);
+ reg_w_val(dev, 0x81, 0x47); /* 0x47; */
+ reg_w_val(dev, 0x80, 0x40); /* 0x40; */
/* Pedro change */
/* Brightness change Brith+ decrease value */
/* Brigth- increase value */
/* original value = 0x70; */
- value = 0x30; /* 0x20; */
- Et_RegWrite(dev, 0x81, &value, 1); /* set brightness */
- value = 0x20; /* 0x20; */
- Et_RegWrite(dev, 0x80, &value, 1);
+ reg_w_val(dev, 0x81, 0x30); /* 0x20; - set brightness */
+ reg_w_val(dev, 0x80, 0x20); /* 0x20; */
}
static void setcolors(struct gspca_dev *gspca_dev)
{
struct sd *sd = (struct sd *) gspca_dev;
struct usb_device *dev = gspca_dev->dev;
- static __u8 I2cc[] = { 0x05, 0x02, 0x02, 0x05, 0x0d };
+ __u8 I2cc[] = { 0x05, 0x02, 0x02, 0x05, 0x0d };
__u8 i2cflags = 0x01;
/* __u8 green = 0; */
__u8 colors = sd->colors;
@@ -522,7 +465,7 @@ static void setcolors(struct gspca_dev *gspca_dev)
/* I2cc[1] = I2cc[2] = green; */
if (sd->sensor == SENSOR_PAS106) {
Et_i2cwrite(dev, PAS106_REG13, &i2cflags, 1, 3);
- Et_i2cwrite(dev, PAS106_REG9, I2cc, sizeof(I2cc), 1);
+ Et_i2cwrite(dev, PAS106_REG9, I2cc, sizeof I2cc, 1);
}
/* PDEBUG(D_CONF , "Etoms red %d blue %d green %d",
I2cc[3], I2cc[0], green); */
@@ -531,11 +474,11 @@ static void setcolors(struct gspca_dev *gspca_dev)
static void getcolors(struct gspca_dev *gspca_dev)
{
struct sd *sd = (struct sd *) gspca_dev;
- /* __u8 valblue = 0; */
+/* __u8 valblue; */
__u8 valred;
if (sd->sensor == SENSOR_PAS106) {
- /* Et_i2cread(gspca_dev->dev,PAS106_REG9,&valblue,1,1); */
+/* Et_i2cread(gspca_dev->dev, PAS106_REG9, &valblue, 1, 1); */
Et_i2cread(gspca_dev->dev, PAS106_REG9 + 3, &valred, 1, 1);
sd->colors = valred & 0x0f;
}
@@ -544,126 +487,87 @@ static void getcolors(struct gspca_dev *gspca_dev)
static void Et_init1(struct gspca_dev *gspca_dev)
{
struct usb_device *dev = gspca_dev->dev;
- __u8 value = 0x00;
- __u8 received = 0x00;
-/* __u8 I2c0 [] ={0x0a,0x12,0x05,0x22,0xac,0x00,0x01,0x00}; */
+ __u8 value;
+ __u8 received;
+/* __u8 I2c0 [] = {0x0a, 0x12, 0x05, 0x22, 0xac, 0x00, 0x01, 0x00}; */
__u8 I2c0[] = { 0x0a, 0x12, 0x05, 0x6d, 0xcd, 0x00, 0x01, 0x00 };
/* try 1/120 0x6d 0xcd 0x40 */
-/* __u8 I2c0 [] ={0x0a,0x12,0x05,0xfe,0xfe,0xc0,0x01,0x00};
+/* __u8 I2c0 [] = {0x0a, 0x12, 0x05, 0xfe, 0xfe, 0xc0, 0x01, 0x00};
* 1/60000 hmm ?? */
PDEBUG(D_STREAM, "Open Init1 ET");
- value = 7;
- Et_RegWrite(dev, ET_GPIO_DIR_CTRL, &value, 1);
- Et_RegRead(dev, ET_GPIO_IN, &received, 1);
- value = 1;
- Et_RegWrite(dev, ET_RESET_ALL, &value, 1);
- value = 0;
- Et_RegWrite(dev, ET_RESET_ALL, &value, 1);
- value = 0x10;
- Et_RegWrite(dev, ET_ClCK, &value, 1);
- value = 0x19;
- Et_RegWrite(dev, ET_CTRL, &value, 1);
+ reg_w_val(dev, ET_GPIO_DIR_CTRL, 7);
+ reg_r(dev, ET_GPIO_IN, &received, 1);
+ reg_w_val(dev, ET_RESET_ALL, 1);
+ reg_w_val(dev, ET_RESET_ALL, 0);
+ reg_w_val(dev, ET_ClCK, 0x10);
+ reg_w_val(dev, ET_CTRL, 0x19);
/* compression et subsampling */
- if (gspca_dev->cam.cam_mode[(int) gspca_dev->curr_mode].mode)
+ if (gspca_dev->cam.cam_mode[(int) gspca_dev->curr_mode].priv)
value = ET_COMP_VAL1;
else
value = ET_COMP_VAL0;
-
PDEBUG(D_STREAM, "Open mode %d Compression %d",
- gspca_dev->cam.cam_mode[(int) gspca_dev->curr_mode].mode,
+ gspca_dev->cam.cam_mode[(int) gspca_dev->curr_mode].priv,
value);
- Et_RegWrite(dev, ET_COMP, &value, 1);
- value = 0x1d;
- Et_RegWrite(dev, ET_MAXQt, &value, 1);
- value = 0x02;
- Et_RegWrite(dev, ET_MINQt, &value, 1);
+ reg_w_val(dev, ET_COMP, value);
+ reg_w_val(dev, ET_MAXQt, 0x1d);
+ reg_w_val(dev, ET_MINQt, 0x02);
/* undocumented registers */
- value = 0xff;
- Et_RegWrite(dev, ET_REG1d, &value, 1);
- value = 0xff;
- Et_RegWrite(dev, ET_REG1e, &value, 1);
- value = 0xff;
- Et_RegWrite(dev, ET_REG1f, &value, 1);
- value = 0x35;
- Et_RegWrite(dev, ET_REG20, &value, 1);
- value = 0x01;
- Et_RegWrite(dev, ET_REG21, &value, 1);
- value = 0x00;
- Et_RegWrite(dev, ET_REG22, &value, 1);
- value = 0xf7;
- Et_RegWrite(dev, ET_REG23, &value, 1);
- value = 0xff;
- Et_RegWrite(dev, ET_REG24, &value, 1);
- value = 0x07;
- Et_RegWrite(dev, ET_REG25, &value, 1);
+ reg_w_val(dev, ET_REG1d, 0xff);
+ reg_w_val(dev, ET_REG1e, 0xff);
+ reg_w_val(dev, ET_REG1f, 0xff);
+ reg_w_val(dev, ET_REG20, 0x35);
+ reg_w_val(dev, ET_REG21, 0x01);
+ reg_w_val(dev, ET_REG22, 0x00);
+ reg_w_val(dev, ET_REG23, 0xf7);
+ reg_w_val(dev, ET_REG24, 0xff);
+ reg_w_val(dev, ET_REG25, 0x07);
/* colors setting */
- value = 0x80;
- Et_RegWrite(dev, ET_G_RED, &value, 1);
- value = 0x80;
- Et_RegWrite(dev, ET_G_GREEN1, &value, 1);
- value = 0x80;
- Et_RegWrite(dev, ET_G_BLUE, &value, 1);
- value = 0x80;
- Et_RegWrite(dev, ET_G_GREEN2, &value, 1);
- value = 0x00;
- Et_RegWrite(dev, ET_G_GR_H, &value, 1);
- value = 0x00;
- Et_RegWrite(dev, ET_G_GB_H, &value, 1);
+ reg_w_val(dev, ET_G_RED, 0x80);
+ reg_w_val(dev, ET_G_GREEN1, 0x80);
+ reg_w_val(dev, ET_G_BLUE, 0x80);
+ reg_w_val(dev, ET_G_GREEN2, 0x80);
+ reg_w_val(dev, ET_G_GR_H, 0x00);
+ reg_w_val(dev, ET_G_GB_H, 0x00);
/* Window control registers */
- value = 0xf0;
- Et_RegWrite(dev, ET_SYNCHRO, &value, 1);
- value = 0x56; /* 0x56 */
- Et_RegWrite(dev, ET_STARTX, &value, 1);
- value = 0x05; /* 0x04 */
- Et_RegWrite(dev, ET_STARTY, &value, 1);
- value = 0x60;
- Et_RegWrite(dev, ET_WIDTH_LOW, &value, 1);
- value = 0x20;
- Et_RegWrite(dev, ET_HEIGTH_LOW, &value, 1);
- value = 0x50;
- Et_RegWrite(dev, ET_W_H_HEIGTH, &value, 1);
- value = 0x86;
- Et_RegWrite(dev, ET_REG6e, &value, 1);
- value = 0x01;
- Et_RegWrite(dev, ET_REG6f, &value, 1);
- value = 0x86;
- Et_RegWrite(dev, ET_REG70, &value, 1);
- value = 0x14;
- Et_RegWrite(dev, ET_REG71, &value, 1);
- value = 0x00;
- Et_RegWrite(dev, ET_REG72, &value, 1);
+ reg_w_val(dev, ET_SYNCHRO, 0xf0);
+ reg_w_val(dev, ET_STARTX, 0x56); /* 0x56 */
+ reg_w_val(dev, ET_STARTY, 0x05); /* 0x04 */
+ reg_w_val(dev, ET_WIDTH_LOW, 0x60);
+ reg_w_val(dev, ET_HEIGTH_LOW, 0x20);
+ reg_w_val(dev, ET_W_H_HEIGTH, 0x50);
+ reg_w_val(dev, ET_REG6e, 0x86);
+ reg_w_val(dev, ET_REG6f, 0x01);
+ reg_w_val(dev, ET_REG70, 0x86);
+ reg_w_val(dev, ET_REG71, 0x14);
+ reg_w_val(dev, ET_REG72, 0x00);
/* Clock Pattern registers */
- value = 0x00;
- Et_RegWrite(dev, ET_REG73, &value, 1);
- value = 0x00;
- Et_RegWrite(dev, ET_REG74, &value, 1);
- value = 0x0a;
- Et_RegWrite(dev, ET_REG75, &value, 1);
- value = 0x04;
- Et_RegWrite(dev, ET_I2C_CLK, &value, 1);
- value = 0x01;
- Et_RegWrite(dev, ET_PXL_CLK, &value, 1);
+ reg_w_val(dev, ET_REG73, 0x00);
+ reg_w_val(dev, ET_REG74, 0x00);
+ reg_w_val(dev, ET_REG75, 0x0a);
+ reg_w_val(dev, ET_I2C_CLK, 0x04);
+ reg_w_val(dev, ET_PXL_CLK, 0x01);
/* set the sensor */
- if (gspca_dev->cam.cam_mode[(int) gspca_dev->curr_mode].mode) {
+ if (gspca_dev->cam.cam_mode[(int) gspca_dev->curr_mode].priv) {
I2c0[0] = 0x06;
- Et_i2cwrite(dev, PAS106_REG2, I2c0, sizeof(I2c0), 1);
- Et_i2cwrite(dev, PAS106_REG9, I2c2, sizeof(I2c2), 1);
+ Et_i2cwrite(dev, PAS106_REG2, I2c0, sizeof I2c0, 1);
+ Et_i2cwrite(dev, PAS106_REG9, I2c2, sizeof I2c2, 1);
value = 0x06;
Et_i2cwrite(dev, PAS106_REG2, &value, 1, 1);
- Et_i2cwrite(dev, PAS106_REG3, I2c3, sizeof(I2c3), 1);
+ Et_i2cwrite(dev, PAS106_REG3, I2c3, sizeof I2c3, 1);
/* value = 0x1f; */
value = 0x04;
Et_i2cwrite(dev, PAS106_REG0e, &value, 1, 1);
} else {
I2c0[0] = 0x0a;
- Et_i2cwrite(dev, PAS106_REG2, I2c0, sizeof(I2c0), 1);
- Et_i2cwrite(dev, PAS106_REG9, I2c2, sizeof(I2c2), 1);
+ Et_i2cwrite(dev, PAS106_REG2, I2c0, sizeof I2c0, 1);
+ Et_i2cwrite(dev, PAS106_REG9, I2c2, sizeof I2c2, 1);
value = 0x0a;
Et_i2cwrite(dev, PAS106_REG2, &value, 1, 1);
- Et_i2cwrite(dev, PAS106_REG3, I2c3, sizeof(I2c3), 1);
+ Et_i2cwrite(dev, PAS106_REG3, I2c3, sizeof I2c3, 1);
value = 0x04;
/* value = 0x10; */
Et_i2cwrite(dev, PAS106_REG0e, &value, 1, 1);
@@ -679,7 +583,7 @@ static void Et_init1(struct gspca_dev *gspca_dev)
/* magnetude and sign bit for DAC */
Et_i2cwrite(dev, PAS106_REG7, I2c4, sizeof I2c4, 1);
/* now set by fifo the whole colors setting */
- Et_RegWrite(dev, ET_G_RED, GainRGBG, 6);
+ reg_w(dev, ET_G_RED, GainRGBG, 6);
getcolors(gspca_dev);
setcolors(gspca_dev);
}
@@ -717,10 +621,10 @@ static int sd_config(struct gspca_dev *gspca_dev,
cam->cam_mode = vga_mode;
cam->nmodes = sizeof vga_mode / sizeof vga_mode[0];
}
- sd->brightness = sd_ctrls[SD_BRIGHTNESS].qctrl.default_value;
- sd->contrast = sd_ctrls[SD_CONTRAST].qctrl.default_value;
- sd->colors = sd_ctrls[SD_COLOR].qctrl.default_value;
- sd->autogain = sd_ctrls[SD_AUTOGAIN].qctrl.default_value;
+ sd->brightness = BRIGHTNESS_DEF;
+ sd->contrast = CONTRAST_DEF;
+ sd->colors = COLOR_DEF;
+ sd->autogain = AUTOGAIN_DEF;
return 0;
}
@@ -729,18 +633,13 @@ static int sd_open(struct gspca_dev *gspca_dev)
{
struct sd *sd = (struct sd *) gspca_dev;
struct usb_device *dev = gspca_dev->dev;
- int err;
- __u8 value;
- PDEBUG(D_STREAM, "Initialize ET1");
if (sd->sensor == SENSOR_PAS106)
Et_init1(gspca_dev);
else
Et_init2(gspca_dev);
- value = 0x08;
- Et_RegWrite(dev, ET_RESET_ALL, &value, 1);
- err = Et_videoOff(dev);
- PDEBUG(D_STREAM, "Et_Init_VideoOff %d", err);
+ reg_w_val(dev, ET_RESET_ALL, 0x08);
+ et_video(dev, 0); /* video off */
return 0;
}
@@ -749,27 +648,19 @@ static void sd_start(struct gspca_dev *gspca_dev)
{
struct sd *sd = (struct sd *) gspca_dev;
struct usb_device *dev = gspca_dev->dev;
- int err;
- __u8 value;
if (sd->sensor == SENSOR_PAS106)
Et_init1(gspca_dev);
else
Et_init2(gspca_dev);
- value = 0x08;
- Et_RegWrite(dev, ET_RESET_ALL, &value, 1);
- err = Et_videoOn(dev);
- PDEBUG(D_STREAM, "Et_VideoOn %d", err);
+ reg_w_val(dev, ET_RESET_ALL, 0x08);
+ et_video(dev, 1); /* video on */
}
static void sd_stopN(struct gspca_dev *gspca_dev)
{
- int err;
-
- err = Et_videoOff(gspca_dev->dev);
- PDEBUG(D_STREAM, "Et_VideoOff %d", err);
-
+ et_video(gspca_dev->dev, 0); /* video off */
}
static void sd_stop0(struct gspca_dev *gspca_dev)
@@ -787,7 +678,7 @@ static void setbrightness(struct gspca_dev *gspca_dev)
__u8 brightness = sd->brightness;
for (i = 0; i < 4; i++)
- Et_RegWrite(gspca_dev->dev, (ET_O_RED + i), &brightness, 1);
+ reg_w_val(gspca_dev->dev, (ET_O_RED + i), brightness);
}
static void getbrightness(struct gspca_dev *gspca_dev)
@@ -795,10 +686,10 @@ static void getbrightness(struct gspca_dev *gspca_dev)
struct sd *sd = (struct sd *) gspca_dev;
int i;
int brightness = 0;
- __u8 value = 0;
+ __u8 value;
for (i = 0; i < 4; i++) {
- Et_RegRead(gspca_dev->dev, (ET_O_RED + i), &value, 1);
+ reg_r(gspca_dev->dev, (ET_O_RED + i), &value, 1);
brightness += value;
}
sd->brightness = brightness >> 3;
@@ -811,7 +702,7 @@ static void setcontrast(struct gspca_dev *gspca_dev)
__u8 contrast = sd->contrast;
memset(RGBG, contrast, sizeof RGBG - 2);
- Et_RegWrite(gspca_dev->dev, ET_G_RED, RGBG, 6);
+ reg_w(gspca_dev->dev, ET_G_RED, RGBG, 6);
}
static void getcontrast(struct gspca_dev *gspca_dev)
@@ -822,7 +713,7 @@ static void getcontrast(struct gspca_dev *gspca_dev)
__u8 value = 0;
for (i = 0; i < 4; i++) {
- Et_RegRead(gspca_dev->dev, (ET_G_RED + i), &value, 1);
+ reg_r(gspca_dev->dev, (ET_G_RED + i), &value, 1);
contrast += value;
}
sd->contrast = contrast >> 2;
@@ -876,7 +767,7 @@ static void setautogain(struct gspca_dev *gspca_dev)
__u8 r, g, b;
Gbright = Et_getgainG(gspca_dev);
- Et_RegRead(dev, ET_LUMA_CENTER, GRBG, 4);
+ reg_r(dev, ET_LUMA_CENTER, GRBG, 4);
g = (GRBG[0] + GRBG[3]) >> 1;
r = GRBG[1];
b = GRBG[2];
@@ -898,7 +789,7 @@ static void setautogain(struct gspca_dev *gspca_dev)
static void sd_pkt_scan(struct gspca_dev *gspca_dev,
struct gspca_frame *frame, /* target */
- unsigned char *data, /* isoc packet */
+ __u8 *data, /* isoc packet */
int len) /* iso packet length */
{
struct sd *sd;
diff --git a/linux/drivers/media/video/gspca/gspca.c b/linux/drivers/media/video/gspca/gspca.c
index 3fecf3dbb..5a0d60cb6 100644
--- a/linux/drivers/media/video/gspca/gspca.c
+++ b/linux/drivers/media/video/gspca/gspca.c
@@ -43,14 +43,12 @@ MODULE_AUTHOR("Jean-Francois Moine <http://moinejf.free.fr>");
MODULE_DESCRIPTION("GSPCA USB Camera Driver");
MODULE_LICENSE("GPL");
-#define DRIVER_VERSION_NUMBER KERNEL_VERSION(2, 1, 2)
-static const char version[] = "2.1.2";
+#define DRIVER_VERSION_NUMBER KERNEL_VERSION(2, 1, 5)
+static const char version[] = "2.1.5";
static int video_nr = -1;
-static int comp_fac = 30; /* Buffer size ratio when compressed in % */
-
-#ifdef VIDEO_ADV_DEBUG
+#ifdef CONFIG_VIDEO_ADV_DEBUG
int gspca_debug = D_ERR | D_PROBE;
EXPORT_SYMBOL(gspca_debug);
@@ -253,7 +251,7 @@ static void isoc_transfer(struct gspca_dev *gspca_dev)
struct gspca_frame *gspca_frame_add(struct gspca_dev *gspca_dev,
int packet_type,
struct gspca_frame *frame,
- __u8 *data,
+ const __u8 *data,
int len)
{
int i, j;
@@ -327,6 +325,7 @@ static int gspca_is_compressed(__u32 format)
case V4L2_PIX_FMT_MJPEG:
case V4L2_PIX_FMT_JPEG:
case V4L2_PIX_FMT_SPCA561:
+ case V4L2_PIX_FMT_PAC207:
return 1;
}
return 0;
@@ -339,7 +338,7 @@ static void *rvmalloc(unsigned long size)
/* size = PAGE_ALIGN(size); (already done) */
mem = vmalloc_32(size);
- if (mem != 0) {
+ if (mem != NULL) {
memset(mem, 0, size);
adr = (unsigned long) mem;
while ((long) size > 0) {
@@ -366,48 +365,6 @@ static void rvfree(void *mem, unsigned long size)
vfree(mem);
}
-static __u32 get_v4l2_depth(__u32 pixfmt)
-{
- switch (pixfmt) {
-/* case V4L2_PIX_FMT_BGR32:
- case V4L2_PIX_FMT_RGB32:
- return 32; */
- case V4L2_PIX_FMT_RGB24: /* 'RGB3' */
- case V4L2_PIX_FMT_BGR24:
- return 24;
-/* case V4L2_PIX_FMT_RGB565: * 'RGBP' */
- case V4L2_PIX_FMT_YUYV: /* 'YUYV' packed 4.2.2 */
- case V4L2_PIX_FMT_YYUV: /* 'YYUV' */
- return 16;
- case V4L2_PIX_FMT_YUV420: /* 'YU12' planar 4.2.0 */
- case V4L2_PIX_FMT_SPCA501: /* 'S501' YUYV per line */
- return 12;
- case V4L2_PIX_FMT_MJPEG:
- case V4L2_PIX_FMT_JPEG:
- case V4L2_PIX_FMT_SBGGR8: /* 'BA81' Bayer */
- case V4L2_PIX_FMT_SN9C10X: /* 'S910' SN9C10x compression */
- case V4L2_PIX_FMT_SPCA561: /* 'S561' compressed BGGR bayer */
- return 8;
- }
- PDEBUG(D_ERR|D_CONF, "Unknown pixel format %c%c%c%c",
- pixfmt & 0xff,
- (pixfmt >> 8) & 0xff,
- (pixfmt >> 16) & 0xff,
- pixfmt >> 24);
- return 24;
-}
-
-static int gspca_get_buff_size(struct gspca_dev *gspca_dev)
-{
- unsigned int size;
-
- size = gspca_dev->width * gspca_dev->height
- * get_v4l2_depth(gspca_dev->pixfmt) / 8;
- if (!size)
- return -ENOMEM;
- return size;
-}
-
static int frame_alloc(struct gspca_dev *gspca_dev,
unsigned int count)
{
@@ -415,18 +372,14 @@ static int frame_alloc(struct gspca_dev *gspca_dev,
unsigned int frsz;
int i;
- frsz = gspca_get_buff_size(gspca_dev);
- if (frsz < 0)
- return frsz;
+ i = gspca_dev->curr_mode;
+ frsz = gspca_dev->cam.cam_mode[i].sizeimage;
PDEBUG(D_STREAM, "frame alloc frsz: %d", frsz);
- if (count > GSPCA_MAX_FRAMES)
- count = GSPCA_MAX_FRAMES;
- /* if compressed (JPEG), reduce the buffer size */
- if (gspca_is_compressed(gspca_dev->pixfmt))
- frsz = (frsz * comp_fac) / 100 + 600; /* (+ JPEG header sz) */
frsz = PAGE_ALIGN(frsz);
PDEBUG(D_STREAM, "new fr_sz: %d", frsz);
gspca_dev->frsz = frsz;
+ if (count > GSPCA_MAX_FRAMES)
+ count = GSPCA_MAX_FRAMES;
if (gspca_dev->memory == V4L2_MEMORY_MMAP) {
gspca_dev->frbuf = rvmalloc(frsz * count);
if (!gspca_dev->frbuf) {
@@ -462,7 +415,7 @@ static void frame_free(struct gspca_dev *gspca_dev)
int i;
PDEBUG(D_STREAM, "frame free");
- if (gspca_dev->frbuf != 0) {
+ if (gspca_dev->frbuf != NULL) {
rvfree(gspca_dev->frbuf,
gspca_dev->nframes * gspca_dev->frsz);
gspca_dev->frbuf = NULL;
@@ -485,7 +438,7 @@ static void destroy_urbs(struct gspca_dev *gspca_dev)
gspca_dev->urb[i] = NULL;
usb_kill_urb(urb);
- if (urb->transfer_buffer != 0)
+ if (urb->transfer_buffer != NULL)
usb_buffer_free(gspca_dev->dev,
urb->transfer_buffer_length,
urb->transfer_buffer,
@@ -709,7 +662,7 @@ static void gspca_set_default_mode(struct gspca_dev *gspca_dev)
gspca_dev->curr_mode = i;
gspca_dev->width = gspca_dev->cam.cam_mode[i].width;
gspca_dev->height = gspca_dev->cam.cam_mode[i].height;
- gspca_dev->pixfmt = gspca_dev->cam.cam_mode[i].pixfmt;
+ gspca_dev->pixfmt = gspca_dev->cam.cam_mode[i].pixelformat;
}
static int wxh_to_mode(struct gspca_dev *gspca_dev,
@@ -737,11 +690,13 @@ static int gspca_get_mode(struct gspca_dev *gspca_dev,
modeU = modeD = mode;
while ((modeU < gspca_dev->cam.nmodes) || modeD >= 0) {
if (--modeD >= 0) {
- if (gspca_dev->cam.cam_mode[modeD].pixfmt == pixfmt)
+ if (gspca_dev->cam.cam_mode[modeD].pixelformat
+ == pixfmt)
return modeD;
}
if (++modeU < gspca_dev->cam.nmodes) {
- if (gspca_dev->cam.cam_mode[modeU].pixfmt == pixfmt)
+ if (gspca_dev->cam.cam_mode[modeU].pixelformat
+ == pixfmt)
return modeU;
}
}
@@ -759,7 +714,7 @@ static int vidioc_enum_fmt_vid_cap(struct file *file, void *priv,
index = 0;
j = 0;
for (i = gspca_dev->cam.nmodes; --i >= 0; ) {
- fmt_tb[index] = gspca_dev->cam.cam_mode[i].pixfmt;
+ fmt_tb[index] = gspca_dev->cam.cam_mode[i].pixelformat;
j = 0;
for (;;) {
if (fmt_tb[j] == fmt_tb[index])
@@ -793,27 +748,20 @@ static int vidioc_g_fmt_vid_cap(struct file *file, void *priv,
struct v4l2_format *fmt)
{
struct gspca_dev *gspca_dev = priv;
+ int mode;
if (fmt->type != V4L2_BUF_TYPE_VIDEO_CAPTURE)
return -EINVAL;
- fmt->fmt.pix.width = gspca_dev->width;
- fmt->fmt.pix.height = gspca_dev->height;
- fmt->fmt.pix.pixelformat = gspca_dev->pixfmt;
- fmt->fmt.pix.field = V4L2_FIELD_NONE;
- fmt->fmt.pix.bytesperline = get_v4l2_depth(fmt->fmt.pix.pixelformat)
- * fmt->fmt.pix.width / 8;
- fmt->fmt.pix.sizeimage = fmt->fmt.pix.bytesperline
- * fmt->fmt.pix.height;
-/* (should be in the subdriver) */
- fmt->fmt.pix.colorspace = V4L2_COLORSPACE_SRGB;
- fmt->fmt.pix.priv = 0;
+ mode = gspca_dev->curr_mode;
+ memcpy(&fmt->fmt.pix, &gspca_dev->cam.cam_mode[mode],
+ sizeof fmt->fmt.pix);
return 0;
}
static int try_fmt_vid_cap(struct gspca_dev *gspca_dev,
struct v4l2_format *fmt)
{
- int w, h, mode, mode2, frsz;
+ int w, h, mode, mode2;
if (fmt->type != V4L2_BUF_TYPE_VIDEO_CAPTURE)
return -EINVAL;
@@ -823,7 +771,7 @@ static int try_fmt_vid_cap(struct gspca_dev *gspca_dev,
/* (luvcview problem) */
if (fmt->fmt.pix.pixelformat == V4L2_PIX_FMT_MJPEG)
fmt->fmt.pix.pixelformat = V4L2_PIX_FMT_JPEG;
-#ifdef VIDEO_ADV_DEBUG
+#ifdef CONFIG_VIDEO_ADV_DEBUG
if (gspca_debug & D_CONF)
PDEBUG_MODE("try fmt cap", fmt->fmt.pix.pixelformat, w, h);
#endif
@@ -831,36 +779,19 @@ static int try_fmt_vid_cap(struct gspca_dev *gspca_dev,
mode = wxh_to_mode(gspca_dev, w, h);
/* OK if right palette */
- if (gspca_dev->cam.cam_mode[mode].pixfmt != fmt->fmt.pix.pixelformat) {
+ if (gspca_dev->cam.cam_mode[mode].pixelformat
+ != fmt->fmt.pix.pixelformat) {
/* else, search the closest mode with the same pixel format */
mode2 = gspca_get_mode(gspca_dev, mode,
fmt->fmt.pix.pixelformat);
- if (mode2 >= 0) {
+ if (mode2 >= 0)
mode = mode2;
- } else {
-
- /* no chance, return this mode */
- fmt->fmt.pix.pixelformat =
- gspca_dev->cam.cam_mode[mode].pixfmt;
-#ifdef VIDEO_ADV_DEBUG
- if (gspca_debug & D_CONF) {
- PDEBUG_MODE("new format",
- fmt->fmt.pix.pixelformat,
- gspca_dev->cam.cam_mode[mode].width,
- gspca_dev->cam.cam_mode[mode].height);
- }
-#endif
- }
+/* else
+ ; * no chance, return this mode */
}
- fmt->fmt.pix.width = gspca_dev->cam.cam_mode[mode].width;
- fmt->fmt.pix.height = gspca_dev->cam.cam_mode[mode].height;
- fmt->fmt.pix.bytesperline = get_v4l2_depth(fmt->fmt.pix.pixelformat)
- * fmt->fmt.pix.width / 8;
- frsz = fmt->fmt.pix.bytesperline * fmt->fmt.pix.height;
- if (gspca_is_compressed(fmt->fmt.pix.pixelformat))
- frsz = (frsz * comp_fac) / 100;
- fmt->fmt.pix.sizeimage = frsz;
+ memcpy(&fmt->fmt.pix, &gspca_dev->cam.cam_mode[mode],
+ sizeof fmt->fmt.pix);
return mode; /* used when s_fmt */
}
@@ -883,16 +814,6 @@ static int vidioc_s_fmt_vid_cap(struct file *file, void *priv,
struct gspca_dev *gspca_dev = priv;
int ret;
-#ifdef CONFIG_VIDEO_V4L1_COMPAT
- /* if v4l1 got JPEG */
- if (fmt->fmt.pix.pixelformat == 0
- && gspca_dev->streaming) {
- fmt->fmt.pix.width = gspca_dev->width;
- fmt->fmt.pix.height = gspca_dev->height;
- fmt->fmt.pix.pixelformat = gspca_dev->pixfmt;
- return 0;
- }
-#endif
if (mutex_lock_interruptible(&gspca_dev->queue_lock))
return -ERESTARTSYS;
@@ -958,7 +879,7 @@ static int dev_open(struct inode *inode, struct file *file)
}
gspca_dev->users++;
file->private_data = gspca_dev;
-#ifdef VIDEO_ADV_DEBUG
+#ifdef CONFIG_VIDEO_ADV_DEBUG
/* activate the v4l2 debug */
if (gspca_debug & D_V4L2)
gspca_dev->vdev.debug |= 3;
@@ -991,7 +912,7 @@ static int dev_close(struct inode *inode, struct file *file)
gspca_dev->sd_desc->close(gspca_dev);
mutex_unlock(&gspca_dev->usb_lock);
frame_free(gspca_dev);
- gspca_dev->capt_file = 0;
+ gspca_dev->capt_file = NULL;
gspca_dev->memory = GSPCA_MEMORY_NO;
}
file->private_data = NULL;
@@ -1059,7 +980,7 @@ static int vidioc_s_ctrl(struct file *file, void *priv,
struct v4l2_control *ctrl)
{
struct gspca_dev *gspca_dev = priv;
- struct ctrl *ctrls;
+ const struct ctrl *ctrls;
int i, ret;
for (i = 0, ctrls = gspca_dev->sd_desc->ctrls;
@@ -1085,7 +1006,7 @@ static int vidioc_g_ctrl(struct file *file, void *priv,
{
struct gspca_dev *gspca_dev = priv;
- struct ctrl *ctrls;
+ const struct ctrl *ctrls;
int i, ret;
for (i = 0, ctrls = gspca_dev->sd_desc->ctrls;
@@ -1165,7 +1086,7 @@ static int vidioc_reqbufs(struct file *file, void *priv,
}
/* only one file may do capture */
- if ((gspca_dev->capt_file != 0 && gspca_dev->capt_file != file)
+ if ((gspca_dev->capt_file != NULL && gspca_dev->capt_file != file)
|| gspca_dev->streaming) {
ret = -EBUSY;
goto out;
@@ -1173,7 +1094,7 @@ static int vidioc_reqbufs(struct file *file, void *priv,
if (rb->count == 0) { /* unrequest? */
frame_free(gspca_dev);
- gspca_dev->capt_file = 0;
+ gspca_dev->capt_file = NULL;
} else {
gspca_dev->memory = rb->memory;
ret = frame_alloc(gspca_dev, rb->count);
@@ -1231,7 +1152,7 @@ static int vidioc_streamon(struct file *file, void *priv,
if (ret < 0)
goto out;
}
-#ifdef VIDEO_ADV_DEBUG
+#ifdef CONFIG_VIDEO_ADV_DEBUG
if (gspca_debug & D_STREAM) {
PDEBUG_MODE("stream on OK",
gspca_dev->pixfmt,
@@ -1382,7 +1303,7 @@ static int vidiocgmbuf(struct file *file, void *priv,
static int dev_mmap(struct file *file, struct vm_area_struct *vma)
{
struct gspca_dev *gspca_dev = file->private_data;
- struct gspca_frame *frame = 0;
+ struct gspca_frame *frame;
struct page *page;
unsigned long addr, start, size;
int i, ret;
@@ -1405,6 +1326,7 @@ static int dev_mmap(struct file *file, struct vm_area_struct *vma)
goto out;
}
+ frame = NULL;
for (i = 0; i < gspca_dev->nframes; ++i) {
if (gspca_dev->frame[i].v4l2_buf.memory != V4L2_MEMORY_MMAP) {
PDEBUG(D_STREAM, "mmap bad memory type");
@@ -1416,7 +1338,7 @@ static int dev_mmap(struct file *file, struct vm_area_struct *vma)
break;
}
}
- if (frame == 0) {
+ if (frame == NULL) {
PDEBUG(D_STREAM, "mmap no frame buffer found");
ret = -EINVAL;
goto out;
@@ -1986,13 +1908,10 @@ static void __exit gspca_exit(void)
module_init(gspca_init);
module_exit(gspca_exit);
-#ifdef VIDEO_ADV_DEBUG
+#ifdef CONFIG_VIDEO_ADV_DEBUG
module_param_named(debug, gspca_debug, int, 0644);
MODULE_PARM_DESC(debug,
"Debug (bit) 0x01:error 0x02:probe 0x04:config"
" 0x08:stream 0x10:frame 0x20:packet 0x40:USBin 0x80:USBout"
" 0x0100: v4l2");
#endif
-module_param(comp_fac, int, 0644);
-MODULE_PARM_DESC(comp_fac,
- "Buffer size ratio when compressed in percent");
diff --git a/linux/drivers/media/video/gspca/gspca.h b/linux/drivers/media/video/gspca/gspca.h
index 1581fa808..945f1ab4c 100644
--- a/linux/drivers/media/video/gspca/gspca.h
+++ b/linux/drivers/media/video/gspca/gspca.h
@@ -9,26 +9,7 @@
#include <media/v4l2-common.h>
#include <linux/mutex.h>
-/* values in 2.6.27 */
-#ifndef V4L2_PIX_FMT_SPCA501
-#define V4L2_PIX_FMT_SPCA501 v4l2_fourcc('S', '5', '0', '1')
-#endif
-#ifndef V4L2_PIX_FMT_SPCA561
-#define V4L2_PIX_FMT_SPCA561 v4l2_fourcc('S', '5', '6', '1')
-#endif
-
-/* values in 2.6.26 */
-#ifndef V4L2_CID_POWER_LINE_FREQUENCY
-#define V4L2_CID_POWER_LINE_FREQUENCY (V4L2_CID_BASE+24)
-#endif
-#ifndef V4L2_CID_WHITE_BALANCE_TEMPERATURE
-#define V4L2_CID_WHITE_BALANCE_TEMPERATURE (V4L2_CID_BASE + 26)
-#endif
-#ifndef V4L2_CID_SHARPNESS
-#define V4L2_CID_SHARPNESS (V4L2_CID_BASE+27)
-#endif
-
-#ifdef VIDEO_ADV_DEBUG
+#ifdef CONFIG_VIDEO_ADV_DEBUG
/* GSPCA our debug messages */
extern int gspca_debug;
#define PDEBUG(level, fmt, args...) \
@@ -71,16 +52,9 @@ extern int gspca_debug;
#define ISO_MAX_SIZE 0x8000 /* max size of one URB buffer (32 Kb) */
/* device information - set at probe time */
-struct cam_mode {
- __u32 pixfmt;
- short width;
- short height;
- short mode; /* subdriver value */
- short reserved; /* subdriver value */
-};
struct cam {
char *dev_name;
- struct cam_mode *cam_mode; /* size nmodes */
+ struct v4l2_pix_format *cam_mode; /* size nmodes */
char nmodes;
__u8 epaddr;
};
@@ -110,9 +84,9 @@ struct ctrl {
/* subdriver description */
struct sd_desc {
/* information */
- char *name; /* sub-driver name */
+ const char *name; /* sub-driver name */
/* controls */
- struct ctrl *ctrls;
+ const struct ctrl *ctrls;
int nctrls;
/* operations */
cam_cf_op config; /* called on probe */
@@ -121,8 +95,9 @@ struct sd_desc {
cam_v_op stopN; /* called on stream off - main alt */
cam_v_op stop0; /* called on stream off - alt 0 */
cam_v_op close; /* called on close */
- cam_v_op dq_callback; /* called when a frame has been dequeued */
cam_pkt_op pkt_scan;
+/* optional operations */
+ cam_v_op dq_callback; /* called when a frame has been dequeued */
cam_jpg_op get_jcomp;
cam_jpg_op set_jcomp;
cam_qmnu_op querymenu;
@@ -195,6 +170,6 @@ void gspca_disconnect(struct usb_interface *intf);
struct gspca_frame *gspca_frame_add(struct gspca_dev *gspca_dev,
int packet_type,
struct gspca_frame *frame,
- __u8 *data,
+ const __u8 *data,
int len);
#endif /* GSPCAV2_H */
diff --git a/linux/drivers/media/video/gspca/mars.c b/linux/drivers/media/video/gspca/mars.c
index d8cd2148f..23f3dba80 100644
--- a/linux/drivers/media/video/gspca/mars.c
+++ b/linux/drivers/media/video/gspca/mars.c
@@ -24,8 +24,8 @@
#include "gspca.h"
#include "jpeg.h"
-#define DRIVER_VERSION_NUMBER KERNEL_VERSION(2, 1, 0)
-static const char version[] = "2.1.0";
+#define DRIVER_VERSION_NUMBER KERNEL_VERSION(2, 1, 5)
+static const char version[] = "2.1.5";
MODULE_AUTHOR("Michel Xhaard <mxhaard@users.sourceforge.net>");
MODULE_DESCRIPTION("GSPCA/Mars USB Camera Driver");
@@ -42,9 +42,17 @@ struct sd {
static struct ctrl sd_ctrls[] = {
};
-static struct cam_mode vga_mode[] = {
- {V4L2_PIX_FMT_JPEG, 320, 240, 2},
- {V4L2_PIX_FMT_JPEG, 640, 480, 1},
+static struct v4l2_pix_format vga_mode[] = {
+ {320, 240, V4L2_PIX_FMT_JPEG, V4L2_FIELD_NONE,
+ .bytesperline = 320,
+ .sizeimage = 320 * 240 * 3 / 8 + 589,
+ .colorspace = V4L2_COLORSPACE_JPEG,
+ .priv = 2},
+ {640, 480, V4L2_PIX_FMT_JPEG, V4L2_FIELD_NONE,
+ .bytesperline = 640,
+ .sizeimage = 640 * 480 * 3 / 8 + 590,
+ .colorspace = V4L2_COLORSPACE_JPEG,
+ .priv = 1},
};
/* MI Register table //elvis */
@@ -79,49 +87,35 @@ enum {
};
static int pcam_reg_write(struct usb_device *dev,
- __u16 index, unsigned char *value, int length)
+ __u16 index, __u8 *value, int len)
{
int rc;
rc = usb_control_msg(dev,
usb_sndbulkpipe(dev, 4),
0x12,
-/* ?? 0xc8 = USB_DIR_IN | USB_TYPE_VENDOR | USB_RECIP_??? !? */
+/* ?? 0xc8 = USB_DIR_OUT | USB_TYPE_VENDOR | USB_RECIP_??? !? */
0xc8,
0, /* value */
- index, value, length, 500);
- PDEBUG(D_USBO, "reg write: 0x%02X , result = 0x%x", index, rc);
-
+ index, value, len, 500);
if (rc < 0)
- PDEBUG(D_ERR, "reg write: error %d", rc);
+ PDEBUG(D_ERR, "reg write [%02x] error %d", index, rc);
return rc;
}
-static void MISensor_BulkWrite(struct usb_device *dev, unsigned short *pch,
- char Address)
+static void MISensor_BulkWrite(struct usb_device *dev,
+ unsigned short *pch,
+ char Address)
{
- int result;
- unsigned char data[6];
+ __u8 data[6];
data[0] = 0x1f;
- data[1] = 0;
+ data[1] = 0; /* control byte */
data[2] = Address;
data[3] = *pch >> 8; /* high byte */
data[4] = *pch; /* low byte */
- data[5] = 0;
-
- result = usb_control_msg(dev,
- usb_sndbulkpipe(dev, 4),
- 0x12,
-/* ?? 0xc8 = USB_DIR_IN | USB_TYPE_VENDOR | USB_RECIP_??? !? */
- 0xc8,
- 0, /* value */
- Address, /* index */
- data, 5, 500);
- PDEBUG(D_USBO, "bulk write 0x%02x = 0x%04x", Address, *pch);
- if (result < 0)
- PDEBUG(D_ERR, "reg write: error %d", result);
+ pcam_reg_write(dev, Address, data, 5);
}
/* this function is called at probe time */
@@ -154,7 +148,8 @@ static void sd_start(struct gspca_dev *gspca_dev)
__u16 MI_buf[242];
int h_size, v_size;
int intpipe;
- /* struct usb_device *dev = pcam->dev; */
+/* struct usb_device *dev = pcam->dev; */
+
memset(data, 0, sizeof data);
memset(MI_buf, 0, sizeof MI_buf);
@@ -167,7 +162,7 @@ static void sd_start(struct gspca_dev *gspca_dev)
data[0] = 0x01; /* address */
data[1] = 0x01;
- err_code = pcam_reg_write(dev, data[0], data, 0x02);
+ err_code = pcam_reg_write(dev, data[0], data, 2);
if (err_code < 0)
return;
@@ -193,14 +188,14 @@ static void sd_start(struct gspca_dev *gspca_dev)
data[10] = 0x5d; /* reg 9, I2C device address
* [for PAS5101 (0x40)] [for MI (0x5d)] */
- err_code = pcam_reg_write(dev, data[0], data, 0x0b);
+ err_code = pcam_reg_write(dev, data[0], data, 11);
if (err_code < 0)
return;
data[0] = 0x23; /* address */
data[1] = 0x09; /* reg 35, append frame header */
- err_code = pcam_reg_write(dev, data[0], data, 0x02);
+ err_code = pcam_reg_write(dev, data[0], data, 2);
if (err_code < 0) {
PDEBUG(D_ERR, "Register write failed");
return;
@@ -213,7 +208,7 @@ static void sd_start(struct gspca_dev *gspca_dev)
/* else */
data[1] = 50; /* 50 reg 60, pc-cam frame size
* (unit: 4KB) 200KB */
- err_code = pcam_reg_write(dev, data[0], data, 0x02);
+ err_code = pcam_reg_write(dev, data[0], data, 2);
if (err_code < 0)
return;
@@ -255,13 +250,13 @@ static void sd_start(struct gspca_dev *gspca_dev)
/* auto dark-gain */
data[0] = 0x5e; /* address */
- err_code = pcam_reg_write(dev, data[0], data, 0x06);
+ err_code = pcam_reg_write(dev, data[0], data, 6);
if (err_code < 0)
return;
data[0] = 0x67;
data[1] = 0x13; /* reg 103, first pixel B, disable sharpness */
- err_code = pcam_reg_write(dev, data[0], data, 0x02);
+ err_code = pcam_reg_write(dev, data[0], data, 2);
if (err_code < 0)
return;
@@ -340,7 +335,7 @@ static void sd_start(struct gspca_dev *gspca_dev)
data[0] = 0x00;
data[1] = 0x4d; /* ISOC transfering enable... */
- pcam_reg_write(dev, data[0], data, 0x02);
+ pcam_reg_write(dev, data[0], data, 2);
}
static void sd_stopN(struct gspca_dev *gspca_dev)
@@ -365,7 +360,7 @@ static void sd_close(struct gspca_dev *gspca_dev)
static void sd_pkt_scan(struct gspca_dev *gspca_dev,
struct gspca_frame *frame, /* target */
- unsigned char *data, /* isoc packet */
+ __u8 *data, /* isoc packet */
int len) /* iso packet length */
{
struct sd *sd = (struct sd *) gspca_dev;
@@ -403,7 +398,7 @@ static void sd_pkt_scan(struct gspca_dev *gspca_dev,
}
/* sub-driver description */
-static struct sd_desc sd_desc = {
+static const struct sd_desc sd_desc = {
.name = MODULE_NAME,
.ctrls = sd_ctrls,
.nctrls = ARRAY_SIZE(sd_ctrls),
@@ -418,7 +413,7 @@ static struct sd_desc sd_desc = {
/* -- module initialisation -- */
#define DVNM(name) .driver_info = (kernel_ulong_t) name
-static __devinitdata struct usb_device_id device_table[] = {
+static const __devinitdata struct usb_device_id device_table[] = {
{USB_DEVICE(0x093a, 0x050f), DVNM("Mars-Semi Pc-Camera")},
{}
};
diff --git a/linux/drivers/media/video/gspca/ov519.c b/linux/drivers/media/video/gspca/ov519.c
index b6564d18b..402b3ed12 100644
--- a/linux/drivers/media/video/gspca/ov519.c
+++ b/linux/drivers/media/video/gspca/ov519.c
@@ -24,8 +24,8 @@
#include "gspca.h"
-#define DRIVER_VERSION_NUMBER KERNEL_VERSION(2, 1, 0)
-static const char version[] = "2.1.0";
+#define DRIVER_VERSION_NUMBER KERNEL_VERSION(2, 1, 5)
+static const char version[] = "2.1.5";
MODULE_AUTHOR("Jean-Francois Moine <http://moinejf.free.fr>");
MODULE_DESCRIPTION("OV519 USB Camera Driver");
@@ -126,13 +126,29 @@ static struct ctrl sd_ctrls[] = {
},
};
-static struct cam_mode vga_mode[] = {
- {V4L2_PIX_FMT_JPEG, 320, 240},
- {V4L2_PIX_FMT_JPEG, 640, 480},
+static struct v4l2_pix_format vga_mode[] = {
+ {320, 240, V4L2_PIX_FMT_JPEG, V4L2_FIELD_NONE,
+ .bytesperline = 320,
+ .sizeimage = 320 * 240 * 3 / 8 + 589,
+ .colorspace = V4L2_COLORSPACE_JPEG,
+ .priv = 1},
+ {640, 480, V4L2_PIX_FMT_JPEG, V4L2_FIELD_NONE,
+ .bytesperline = 640,
+ .sizeimage = 640 * 480 * 3 / 8 + 590,
+ .colorspace = V4L2_COLORSPACE_JPEG,
+ .priv = 0},
};
-static struct cam_mode sif_mode[] = {
- {V4L2_PIX_FMT_JPEG, 176, 144},
- {V4L2_PIX_FMT_JPEG, 352, 288},
+static struct v4l2_pix_format sif_mode[] = {
+ {176, 144, V4L2_PIX_FMT_JPEG, V4L2_FIELD_NONE,
+ .bytesperline = 176,
+ .sizeimage = 176 * 144 * 3 / 8 + 589,
+ .colorspace = V4L2_COLORSPACE_JPEG,
+ .priv = 1},
+ {352, 288, V4L2_PIX_FMT_JPEG, V4L2_FIELD_NONE,
+ .bytesperline = 352,
+ .sizeimage = 352 * 288 * 3 / 8 + 589,
+ .colorspace = V4L2_COLORSPACE_JPEG,
+ .priv = 0},
};
/* OV519 Camera interface register numbers */
@@ -266,15 +282,15 @@ static unsigned char ov7670_abs_to_sm(unsigned char v)
static int reg_w(struct sd *sd, __u16 index, __u8 value)
{
int ret;
- __u8 buf[4];
+ __u8 data;
- buf[0] = value;
+ data = value;
ret = usb_control_msg(sd->gspca_dev.dev,
usb_sndctrlpipe(sd->gspca_dev.dev, 0),
1, /* REQ_IO (ov518/519) */
USB_DIR_OUT | USB_TYPE_VENDOR | USB_RECIP_DEVICE,
0, index,
- &buf[0], 1, 500);
+ &data, 1, 500);
if (ret < 0)
PDEBUG(D_ERR, "Write reg [%02x] %02x failed", index, value);
return ret;
@@ -285,16 +301,16 @@ static int reg_w(struct sd *sd, __u16 index, __u8 value)
static int reg_r(struct sd *sd, __u16 index)
{
int ret;
- __u8 buf[4];
+ __u8 data;
ret = usb_control_msg(sd->gspca_dev.dev,
usb_rcvctrlpipe(sd->gspca_dev.dev, 0),
1, /* REQ_IO */
USB_DIR_IN | USB_TYPE_VENDOR | USB_RECIP_DEVICE,
- 0, index, &buf[0], 1, 500);
+ 0, index, &data, 1, 500);
if (ret >= 0)
- ret = buf[0];
+ ret = data;
else
PDEBUG(D_ERR, "Read reg [0x%02x] failed", index);
return ret;
@@ -302,7 +318,7 @@ static int reg_r(struct sd *sd, __u16 index)
/* Read 8 values from a OV519 register */
static int reg_r8(struct sd *sd,
- __u16 index)
+ __u16 index)
{
int ret;
__u8 buf[8];
@@ -528,7 +544,7 @@ struct ov_i2c_regvals {
};
static int write_regvals(struct sd *sd,
- struct ov_regvals *regvals,
+ const struct ov_regvals *regvals,
int n)
{
int rc;
@@ -543,7 +559,7 @@ static int write_regvals(struct sd *sd,
}
static int write_i2c_regvals(struct sd *sd,
- struct ov_i2c_regvals *regvals,
+ const struct ov_i2c_regvals *regvals,
int n)
{
int rc;
@@ -569,7 +585,7 @@ static int write_i2c_regvals(struct sd *sd,
static int ov8xx0_configure(struct sd *sd)
{
int rc;
- static struct ov_i2c_regvals norm_8610[] = {
+ static const struct ov_i2c_regvals norm_8610[] = {
{ 0x12, 0x80 },
{ 0x00, 0x00 },
{ 0x01, 0x80 },
@@ -707,7 +723,7 @@ static int ov7xx0_configure(struct sd *sd)
* 0x05 (old driver setting): very overexposed, too much
* contrast
*/
- static struct ov_i2c_regvals norm_7610[] = {
+ static const struct ov_i2c_regvals norm_7610[] = {
{ 0x10, 0xff },
{ 0x16, 0x06 },
{ 0x28, 0x24 },
@@ -737,7 +753,7 @@ static int ov7xx0_configure(struct sd *sd)
{ 0x0d, 0x24 },
};
- static struct ov_i2c_regvals norm_7620[] = {
+ static const struct ov_i2c_regvals norm_7620[] = {
{ 0x00, 0x00 }, /* gain */
{ 0x01, 0x80 }, /* blue gain */
{ 0x02, 0x80 }, /* red gain */
@@ -804,14 +820,14 @@ static int ov7xx0_configure(struct sd *sd)
};
/* 7640 and 7648. The defaults should be OK for most registers. */
- static struct ov_i2c_regvals norm_7640[] = {
+ static const struct ov_i2c_regvals norm_7640[] = {
{ 0x12, 0x80 },
{ 0x12, 0x14 },
};
/* 7670. Defaults taken from OmniVision provided data,
* as provided by Jonathan Corbet of OLPC */
- static struct ov_i2c_regvals norm_7670[] = {
+ static const struct ov_i2c_regvals norm_7670[] = {
{ OV7670_REG_COM7, OV7670_COM7_RESET },
{ OV7670_REG_TSLB, 0x04 }, /* OV */
{ OV7670_REG_COM7, OV7670_COM7_FMT_VGA }, /* VGA */
@@ -1075,7 +1091,7 @@ static int ov7xx0_configure(struct sd *sd)
static int ov6xx0_configure(struct sd *sd)
{
int rc;
- static struct ov_i2c_regvals norm_6x20[] = {
+ static const struct ov_i2c_regvals norm_6x20[] = {
{ 0x12, 0x80 }, /* reset */
{ 0x11, 0x01 },
{ 0x03, 0x60 },
@@ -1118,7 +1134,7 @@ static int ov6xx0_configure(struct sd *sd)
/* Toggle 0x12[2] off and on here? */
};
- static struct ov_i2c_regvals norm_6x30[] = {
+ static const struct ov_i2c_regvals norm_6x30[] = {
{ 0x12, 0x80 }, /* Reset */
{ 0x00, 0x1f }, /* Gain */
{ 0x01, 0x99 }, /* Blue gain */
@@ -1284,7 +1300,7 @@ static int sd_config(struct gspca_dev *gspca_dev,
struct cam *cam;
/* (from ov519_configure) */
- static struct ov_regvals init_519[] = {
+ static const struct ov_regvals init_519[] = {
{ 0x5a, 0x6d }, /* EnableSystem */
/* jfm trace usbsnoop3-1.txt */
/* jfm 53 = fb */
@@ -1302,8 +1318,7 @@ static int sd_config(struct gspca_dev *gspca_dev,
/* windows reads 0x55 at this point*/
};
- if (write_regvals(sd, init_519,
- sizeof init_519 / sizeof init_519[0]))
+ if (write_regvals(sd, init_519, ARRAY_SIZE(init_519)))
goto error;
/* jfm: not seen in windows trace */
if (ov519_init_compression(sd))
@@ -1389,7 +1404,7 @@ static int sd_open(struct gspca_dev *gspca_dev)
static int ov519_mode_init_regs(struct sd *sd,
int width, int height)
{
- static struct ov_regvals mode_init_519_ov7670[] = {
+ static const struct ov_regvals mode_init_519_ov7670[] = {
{ 0x5d, 0x03 }, /* Turn off suspend mode */
{ 0x53, 0x9f }, /* was 9b in 1.65-1.08 */
{ 0x54, 0x0f }, /* bit2 (jpeg enable) */
@@ -1412,7 +1427,7 @@ static int ov519_mode_init_regs(struct sd *sd,
/* windows reads 0x55 at this point, why? */
};
- static struct ov_regvals mode_init_519[] = {
+ static const struct ov_regvals mode_init_519[] = {
{ 0x5d, 0x03 }, /* Turn off suspend mode */
{ 0x53, 0x9f }, /* was 9b in 1.65-1.08 */
{ 0x54, 0x0f }, /* bit2 (jpeg enable) */
@@ -1448,12 +1463,11 @@ static int ov519_mode_init_regs(struct sd *sd,
/******** Set the mode ********/
if (sd->sensor != SEN_OV7670) {
if (write_regvals(sd, mode_init_519,
- sizeof mode_init_519 / sizeof mode_init_519[0]))
+ ARRAY_SIZE(mode_init_519)))
return -EIO;
} else {
if (write_regvals(sd, mode_init_519_ov7670,
- sizeof mode_init_519_ov7670
- / sizeof mode_init_519_ov7670[0]))
+ ARRAY_SIZE(mode_init_519_ov7670)))
return -EIO;
}
@@ -1936,7 +1950,7 @@ static void sd_close(struct gspca_dev *gspca_dev)
static void sd_pkt_scan(struct gspca_dev *gspca_dev,
struct gspca_frame *frame, /* target */
- unsigned char *data, /* isoc packet */
+ __u8 *data, /* isoc packet */
int len) /* iso packet length */
{
/* Header of ov519 is 16 bytes:
@@ -2035,7 +2049,7 @@ static void setcontrast(struct gspca_dev *gspca_dev)
case SEN_OV6630:
i2c_w_mask(sd, OV7610_REG_CNT, val >> 4, 0x0f);
case SEN_OV8610: {
- static __u8 ctab[] = {
+ static const __u8 ctab[] = {
0x03, 0x09, 0x0b, 0x0f, 0x53, 0x6f, 0x35, 0x7f
};
@@ -2044,7 +2058,7 @@ static void setcontrast(struct gspca_dev *gspca_dev)
break;
}
case SEN_OV7620: {
- static __u8 ctab[] = {
+ static const __u8 ctab[] = {
0x01, 0x05, 0x09, 0x11, 0x15, 0x35, 0x37, 0x57,
0x5b, 0xa5, 0xa7, 0xc7, 0xc9, 0xcf, 0xef, 0xff
};
@@ -2157,7 +2171,7 @@ static int sd_getcolors(struct gspca_dev *gspca_dev, __s32 *val)
}
/* sub-driver description */
-static struct sd_desc sd_desc = {
+static const struct sd_desc sd_desc = {
.name = MODULE_NAME,
.ctrls = sd_ctrls,
.nctrls = ARRAY_SIZE(sd_ctrls),
@@ -2172,7 +2186,7 @@ static struct sd_desc sd_desc = {
/* -- module initialisation -- */
#define DVNM(name) .driver_info = (kernel_ulong_t) name
-static __devinitdata struct usb_device_id device_table[] = {
+static const __devinitdata struct usb_device_id device_table[] = {
{USB_DEVICE(0x041e, 0x4052), DVNM("Creative Live! VISTA IM")},
{USB_DEVICE(0x041e, 0x405f), DVNM("Creative Live! VISTA VF0330")},
{USB_DEVICE(0x041e, 0x4060), DVNM("Creative Live! VISTA VF0350")},
diff --git a/linux/drivers/media/video/gspca/pac207.c b/linux/drivers/media/video/gspca/pac207.c
index 84986684c..4f197c1f4 100644
--- a/linux/drivers/media/video/gspca/pac207.c
+++ b/linux/drivers/media/video/gspca/pac207.c
@@ -27,8 +27,8 @@
#include "gspca.h"
-#define DRIVER_VERSION_NUMBER KERNEL_VERSION(2, 1, 0)
-static const char version[] = "2.1.0";
+#define DRIVER_VERSION_NUMBER KERNEL_VERSION(2, 1, 5)
+static const char version[] = "2.1.5";
MODULE_AUTHOR("Hans de Goede <j.w.r.degoede@hhs.nl>");
MODULE_DESCRIPTION("Pixart PAC207");
@@ -40,9 +40,17 @@ MODULE_LICENSE("GPL");
#define PAC207_BRIGHTNESS_MAX 255
#define PAC207_BRIGHTNESS_DEFAULT 4 /* power on default: 4 */
-#define PAC207_EXPOSURE_MIN 4
+/* An exposure value of 4 also works (3 does not) but then we need to lower
+ the compression balance setting when in 352x288 mode, otherwise the usb
+ bandwidth is not enough and packets get dropped resulting in corrupt
+ frames. The problem with this is that when the compression balance gets
+ lowered below 0x80, the pac207 starts using a different compression
+ algorithm for some lines, these lines get prefixed with a 0x2dd2 prefix
+ and currently we do not know how to decompress these lines, so for now
+ we use a minimum exposure value of 5 */
+#define PAC207_EXPOSURE_MIN 5
#define PAC207_EXPOSURE_MAX 26
-#define PAC207_EXPOSURE_DEFAULT 4 /* power on default: 3 ?? */
+#define PAC207_EXPOSURE_DEFAULT 5 /* power on default: 3 ?? */
#define PAC207_EXPOSURE_KNEE 11 /* 4 = 30 fps, 11 = 8, 15 = 6 */
#define PAC207_GAIN_MIN 0
@@ -58,34 +66,10 @@ MODULE_LICENSE("GPL");
before doing any other adjustments */
#define PAC207_AUTOGAIN_IGNORE_FRAMES 3
-enum pac207_line_state {
- LINE_HEADER1,
- LINE_HEADER2,
- LINE_UNCOMPRESSED,
- LINE_COMPRESSED,
-};
-
-struct pac207_decoder_state {
- /* generic state */
- u16 line_read;
- u16 line_marker;
- u8 line_state;
- u8 header_read;
- /* compression state */
- u16 processed_bytes;
- u8 remaining_bits;
- s8 no_remaining_bits;
- u8 get_abs;
- u8 discard_byte;
- u8 line_decode_buf[352];
-};
-
/* specific webcam descriptor */
struct sd {
struct gspca_dev gspca_dev; /* !! must be the first item */
- struct pac207_decoder_state decoder_state;
-
u8 mode;
u8 brightness;
@@ -94,6 +78,7 @@ struct sd {
u8 gain;
u8 sof_read;
+ u8 header_read;
u8 autogain_ignore_frames;
atomic_t avg_lum;
@@ -172,9 +157,20 @@ static struct ctrl sd_ctrls[] = {
},
};
-static struct cam_mode sif_mode[] = {
- {V4L2_PIX_FMT_SBGGR8, 176, 144, 1},
- {V4L2_PIX_FMT_SBGGR8, 352, 288, 0},
+static struct v4l2_pix_format sif_mode[] = {
+ {176, 144, V4L2_PIX_FMT_PAC207, V4L2_FIELD_NONE,
+ .bytesperline = 176,
+ .sizeimage = (176 + 2) * 144,
+ /* uncompressed, add 2 bytes / line for line header */
+ .colorspace = V4L2_COLORSPACE_SRGB,
+ .priv = 1},
+ {352, 288, V4L2_PIX_FMT_PAC207, V4L2_FIELD_NONE,
+ .bytesperline = 352,
+ /* compressed, but only when needed (not compressed
+ when the framerate is low) */
+ .sizeimage = (352 + 2) * 288,
+ .colorspace = V4L2_COLORSPACE_SRGB,
+ .priv = 0},
};
static const __u8 pac207_sensor_init[][8] = {
@@ -361,70 +357,6 @@ static void sd_close(struct gspca_dev *gspca_dev)
{
}
-/* -- convert pixart frames to Bayer -- */
-/* Sonix decompressor struct B.S.(2004) */
-static struct {
- u8 is_abs;
- u8 len;
- s8 val;
-} table[256];
-
-void init_pixart_decoder(void)
-{
- int i, is_abs, val, len;
-
- for (i = 0; i < 256; i++) {
- is_abs = 0;
- val = 0;
- len = 0;
- if ((i & 0xC0) == 0) {
- /* code 00 */
- val = 0;
- len = 2;
- } else if ((i & 0xC0) == 0x40) {
- /* code 01 */
- val = -5;
- len = 2;
- } else if ((i & 0xC0) == 0x80) {
- /* code 10 */
- val = 5;
- len = 2;
- } else if ((i & 0xF0) == 0xC0) {
- /* code 1100 */
- val = -10;
- len = 4;
- } else if ((i & 0xF0) == 0xD0) {
- /* code 1101 */
- val = 10;
- len = 4;
- } else if ((i & 0xF8) == 0xE0) {
- /* code 11100 */
- val = -15;
- len = 5;
- } else if ((i & 0xF8) == 0xE8) {
- /* code 11101 */
- val = 15;
- len = 5;
- } else if ((i & 0xFC) == 0xF0) {
- /* code 111100 */
- val = -20;
- len = 6;
- } else if ((i & 0xFC) == 0xF4) {
- /* code 111101 */
- val = 20;
- len = 6;
- } else if ((i & 0xF8) == 0xF8) {
- /* code 11111xxxxxx */
- is_abs = 1;
- val = 0;
- len = 5;
- }
- table[i].is_abs = is_abs;
- table[i].val = val;
- table[i].len = len;
- }
-}
-
/* auto gain and exposure algorithm based on the knee algorithm described here:
* <http://ytse.tricolour.net/docs/LowLightOptimization.html> */
static void pac207_do_auto_gain(struct gspca_dev *gspca_dev)
@@ -517,245 +449,52 @@ static unsigned char *pac207_find_sof(struct gspca_dev *gspca_dev,
return NULL;
}
-static int pac207_decompress_row(struct gspca_dev *gspca_dev,
- struct gspca_frame *f,
- __u8 *cdata,
- int len)
+static void sd_pkt_scan(struct gspca_dev *gspca_dev,
+ struct gspca_frame *frame,
+ __u8 *data,
+ int len)
{
struct sd *sd = (struct sd *) gspca_dev;
- struct pac207_decoder_state *decoder_state = &sd->decoder_state;
- unsigned char *outp = decoder_state->line_decode_buf +
- decoder_state->line_read;
- int val, bitlen, bitpos = -decoder_state->no_remaining_bits;
- u8 code;
-
- /* first two pixels are stored as raw 8-bit */
- while (decoder_state->line_read < 2) {
- *outp++ = *cdata++;
- decoder_state->line_read++;
- len--;
- if (len == 0)
- return 0;
- }
-
- while (decoder_state->line_read < gspca_dev->width) {
- if (bitpos < 0) {
- code = decoder_state->remaining_bits << (8 + bitpos) |
- cdata[0] >> -bitpos;
- } else {
- u8 *addr = cdata + bitpos / 8;
- code = addr[0] << (bitpos & 7) |
- addr[1] >> (8 - (bitpos & 7));
- }
-
- bitlen = decoder_state->get_abs ?
- 6 : table[code].len;
-
- /* Stop decompressing if we're out of input data */
- if ((bitpos + bitlen) > (len * 8))
- break;
-
- if (decoder_state->get_abs) {
- *outp++ = code & 0xFC;
- decoder_state->line_read++;
- decoder_state->get_abs = 0;
- } else {
- if (table[code].is_abs) {
- decoder_state->get_abs = 1;
- } else {
- /* relative to left pixel */
- val = outp[-2] +
- table[code].val;
- if (val > 0xff)
- val = 0xff;
- else if (val < 0)
- val = 0;
- *outp++ = val;
- decoder_state->line_read++;
- }
- }
- bitpos += bitlen;
- }
-
- if (decoder_state->line_read == gspca_dev->width) {
- int compressed_line_len;
-
- gspca_frame_add(gspca_dev, INTER_PACKET, f,
- decoder_state->line_decode_buf,
- gspca_dev->width);
+ unsigned char *sof;
- /* completely decompressed line, round pos to nearest word */
- compressed_line_len = ((decoder_state->processed_bytes * 8 +
- bitpos + 15) / 16) * 2;
+ sof = pac207_find_sof(gspca_dev, data, len);
+ if (sof) {
+ int n;
- len -= compressed_line_len - decoder_state->processed_bytes;
- if (len < 0) {
- decoder_state->discard_byte = 1;
- len = 0;
- }
- } else {
- decoder_state->processed_bytes += len;
- decoder_state->remaining_bits = cdata[bitpos/8];
- decoder_state->no_remaining_bits = (8 - bitpos) & 7;
- len = 0;
+ /* finish decoding current frame */
+ n = sof - data;
+ if (n > sizeof pac207_sof_marker)
+ n -= sizeof pac207_sof_marker;
+ else
+ n = 0;
+ frame = gspca_frame_add(gspca_dev, LAST_PACKET, frame,
+ data, n);
+ sd->header_read = 0;
+ gspca_frame_add(gspca_dev, FIRST_PACKET, frame, NULL, 0);
+ len -= sof - data;
+ data = sof;
}
+ if (sd->header_read < 11) {
+ int needed;
- return len;
-}
-
-static void pac207_decode_line_init(struct gspca_dev *gspca_dev)
-{
- struct sd *sd = (struct sd *) gspca_dev;
- struct pac207_decoder_state *decoder_state = &sd->decoder_state;
-
- decoder_state->line_read = 0;
- decoder_state->line_state = LINE_HEADER1;
- decoder_state->processed_bytes = 0;
- decoder_state->no_remaining_bits = 0;
- decoder_state->get_abs = 0;
-}
-
-static void pac207_decode_frame_init(struct gspca_dev *gspca_dev)
-{
- struct sd *sd = (struct sd *) gspca_dev;
- struct pac207_decoder_state *decoder_state = &sd->decoder_state;
-
- decoder_state->header_read = 0;
- decoder_state->discard_byte = 0;
-
- pac207_decode_line_init(gspca_dev);
-}
-
-static int pac207_decode_frame_data(struct gspca_dev *gspca_dev,
- struct gspca_frame *f, unsigned char *data, int len)
-{
- struct sd *sd = (struct sd *) gspca_dev;
- struct pac207_decoder_state *decoder_state = &sd->decoder_state;
- int needed = 0;
-
- /* first 11 bytes after sof marker: frame header */
- if (decoder_state->header_read < 11) {
/* get average lumination from frame header (byte 5) */
- if (decoder_state->header_read < 5) {
- needed = 5 - decoder_state->header_read;
+ if (sd->header_read < 5) {
+ needed = 5 - sd->header_read;
if (len >= needed)
- atomic_set(&sd->avg_lum, data[needed-1]);
+ atomic_set(&sd->avg_lum, data[needed - 1]);
}
/* skip the rest of the header */
- needed = 11 - decoder_state->header_read;
+ needed = 11 - sd->header_read;
if (len <= needed) {
- decoder_state->header_read += len;
- return 0;
+ sd->header_read += len;
+ return;
}
data += needed;
len -= needed;
- decoder_state->header_read = 11;
+ sd->header_read = 11;
}
- while (len) {
- if (decoder_state->discard_byte) {
- data++;
- len--;
- decoder_state->discard_byte = 0;
- continue;
- }
-
- switch (decoder_state->line_state) {
- case LINE_HEADER1:
- decoder_state->line_marker = data[0] << 8;
- decoder_state->line_state = LINE_HEADER2;
- needed = 1;
- break;
- case LINE_HEADER2:
- decoder_state->line_marker |= data[0];
- switch (decoder_state->line_marker) {
- case 0x0ff0:
- decoder_state->line_state = LINE_UNCOMPRESSED;
- break;
- case 0x1ee1:
- decoder_state->line_state = LINE_COMPRESSED;
- break;
- default:
- PDEBUG(D_STREAM,
- "Error unknown line-header %04X",
- (int) decoder_state->line_marker);
- gspca_dev->last_packet_type = DISCARD_PACKET;
- return 0;
- }
- needed = 1;
- break;
- case LINE_UNCOMPRESSED:
- needed = gspca_dev->width - decoder_state->line_read;
- if (needed > len)
- needed = len;
- gspca_frame_add(gspca_dev, INTER_PACKET, f, data,
- needed);
- decoder_state->line_read += needed;
- break;
- case LINE_COMPRESSED:
- needed = len -
- pac207_decompress_row(gspca_dev, f, data, len);
- break;
- }
-
- data += needed;
- len -= needed;
-
- if (decoder_state->line_read == gspca_dev->width) {
- if ((f->data_end - f->data) ==
- (gspca_dev->width * gspca_dev->height)) {
- /* eureka we've got a frame */
- return 1;
- }
- pac207_decode_line_init(gspca_dev);
- }
- }
-
- return 0;
-}
-
-static void sd_pkt_scan(struct gspca_dev *gspca_dev,
- struct gspca_frame *frame,
- unsigned char *data,
- int len)
-{
- unsigned char *sof;
- int n;
-
- sof = pac207_find_sof(gspca_dev, data, len);
-
- if (sof) {
- /* finish decoding current frame */
- if (gspca_dev->last_packet_type == INTER_PACKET) {
- n = sof - data;
- if (n > sizeof(pac207_sof_marker))
- n -= sizeof(pac207_sof_marker);
- else
- n = 0;
- n = pac207_decode_frame_data(gspca_dev, frame,
- data, n);
- if (n)
- frame = gspca_frame_add(gspca_dev,
- LAST_PACKET,
- frame,
- NULL,
- 0);
- else
- PDEBUG(D_STREAM, "Incomplete frame");
- }
- pac207_decode_frame_init(gspca_dev);
- gspca_frame_add(gspca_dev, FIRST_PACKET, frame, NULL, 0);
- len -= sof - data;
- data = sof;
- }
-
- if (gspca_dev->last_packet_type == DISCARD_PACKET)
- return;
-
- n = pac207_decode_frame_data(gspca_dev, frame, data, len);
- if (n)
- frame = gspca_frame_add(gspca_dev, LAST_PACKET,
- frame, NULL, 0);
+ gspca_frame_add(gspca_dev, INTER_PACKET, frame, data, len);
}
static void setbrightness(struct gspca_dev *gspca_dev)
@@ -879,7 +618,7 @@ static int sd_getautogain(struct gspca_dev *gspca_dev, __s32 *val)
}
/* sub-driver description */
-static struct sd_desc sd_desc = {
+static const struct sd_desc sd_desc = {
.name = MODULE_NAME,
.ctrls = sd_ctrls,
.nctrls = ARRAY_SIZE(sd_ctrls),
@@ -895,7 +634,7 @@ static struct sd_desc sd_desc = {
/* -- module initialisation -- */
#define DVNM(name) .driver_info = (kernel_ulong_t) name
-static __devinitdata struct usb_device_id device_table[] = {
+static const __devinitdata struct usb_device_id device_table[] = {
{USB_DEVICE(0x041e, 0x4028), DVNM("Creative Webcam Vista Plus")},
{USB_DEVICE(0x093a, 0x2460), DVNM("Q-Tec Webcam 100")},
{USB_DEVICE(0x093a, 0x2463), DVNM("Philips spc200nc pac207")},
@@ -927,7 +666,6 @@ static struct usb_driver sd_driver = {
/* -- module insert / remove -- */
static int __init sd_mod_init(void)
{
- init_pixart_decoder();
if (usb_register(&sd_driver) < 0)
return -1;
PDEBUG(D_PROBE, "v%s registered", version);
diff --git a/linux/drivers/media/video/gspca/pac7311.c b/linux/drivers/media/video/gspca/pac7311.c
index 793d39ab9..5519c2f70 100644
--- a/linux/drivers/media/video/gspca/pac7311.c
+++ b/linux/drivers/media/video/gspca/pac7311.c
@@ -23,8 +23,8 @@
#include "gspca.h"
-#define DRIVER_VERSION_NUMBER KERNEL_VERSION(2, 1, 0)
-static const char version[] = "2.1.0";
+#define DRIVER_VERSION_NUMBER KERNEL_VERSION(2, 1, 5)
+static const char version[] = "2.1.5";
MODULE_AUTHOR("Thomas Kaiser thomas@kaiser-linux.li");
MODULE_DESCRIPTION("Pixart PAC7311");
@@ -37,7 +37,6 @@ struct sd {
int avg_lum;
unsigned char brightness;
-#define BRIGHTNESS_MAX 0x20
unsigned char contrast;
unsigned char colors;
unsigned char autogain;
@@ -58,21 +57,21 @@ static int sd_setautogain(struct gspca_dev *gspca_dev, __s32 val);
static int sd_getautogain(struct gspca_dev *gspca_dev, __s32 *val);
static struct ctrl sd_ctrls[] = {
-#define SD_BRIGHTNESS 0
{
{
.id = V4L2_CID_BRIGHTNESS,
.type = V4L2_CTRL_TYPE_INTEGER,
.name = "Brightness",
.minimum = 0,
+#define BRIGHTNESS_MAX 0x20
.maximum = BRIGHTNESS_MAX,
.step = 1,
- .default_value = 0x10,
+#define BRIGHTNESS_DEF 0x10
+ .default_value = BRIGHTNESS_DEF,
},
.set = sd_setbrightness,
.get = sd_getbrightness,
},
-#define SD_CONTRAST 1
{
{
.id = V4L2_CID_CONTRAST,
@@ -81,12 +80,12 @@ static struct ctrl sd_ctrls[] = {
.minimum = 0,
.maximum = 255,
.step = 1,
- .default_value = 127,
+#define CONTRAST_DEF 127
+ .default_value = CONTRAST_DEF,
},
.set = sd_setcontrast,
.get = sd_getcontrast,
},
-#define SD_COLOR 2
{
{
.id = V4L2_CID_SATURATION,
@@ -95,12 +94,12 @@ static struct ctrl sd_ctrls[] = {
.minimum = 0,
.maximum = 255,
.step = 1,
- .default_value = 127,
+#define COLOR_DEF 127
+ .default_value = COLOR_DEF,
},
.set = sd_setcolors,
.get = sd_getcolors,
},
-#define SD_AUTOGAIN 3
{
{
.id = V4L2_CID_AUTOGAIN,
@@ -109,22 +108,35 @@ static struct ctrl sd_ctrls[] = {
.minimum = 0,
.maximum = 1,
.step = 1,
- .default_value = 1,
+#define AUTOGAIN_DEF 1
+ .default_value = AUTOGAIN_DEF,
},
.set = sd_setautogain,
.get = sd_getautogain,
},
};
-static struct cam_mode vga_mode[] = {
- {V4L2_PIX_FMT_JPEG, 160, 120, 2},
- {V4L2_PIX_FMT_JPEG, 320, 240, 1},
- {V4L2_PIX_FMT_JPEG, 640, 480, 0},
+static struct v4l2_pix_format vga_mode[] = {
+ {160, 120, V4L2_PIX_FMT_JPEG, V4L2_FIELD_NONE,
+ .bytesperline = 160,
+ .sizeimage = 160 * 120 * 3 / 8 + 590,
+ .colorspace = V4L2_COLORSPACE_JPEG,
+ .priv = 2},
+ {320, 240, V4L2_PIX_FMT_JPEG, V4L2_FIELD_NONE,
+ .bytesperline = 320,
+ .sizeimage = 320 * 240 * 3 / 8 + 590,
+ .colorspace = V4L2_COLORSPACE_JPEG,
+ .priv = 1},
+ {640, 480, V4L2_PIX_FMT_JPEG, V4L2_FIELD_NONE,
+ .bytesperline = 640,
+ .sizeimage = 640 * 480 * 3 / 8 + 590,
+ .colorspace = V4L2_COLORSPACE_JPEG,
+ .priv = 0},
};
#define PAC7311_JPEG_HEADER_SIZE (sizeof pac7311_jpeg_header) /* (594) */
-const unsigned char pac7311_jpeg_header[] = {
+static const __u8 pac7311_jpeg_header[] = {
0xff, 0xd8,
0xff, 0xe0, 0x00, 0x03, 0x20,
0xff, 0xc0, 0x00, 0x11, 0x08,
@@ -195,16 +207,18 @@ const unsigned char pac7311_jpeg_header[] = {
};
static void reg_w(struct usb_device *dev,
- __u16 req,
- __u16 value,
- __u16 index,
- __u8 *buffer, __u16 length)
+ __u16 index,
+ const char *buffer, __u16 len)
{
+ __u8 tmpbuf[8];
+
+ memcpy(tmpbuf, buffer, len);
usb_control_msg(dev,
usb_sndctrlpipe(dev, 0),
- req,
+ 1, /* request */
USB_DIR_OUT | USB_TYPE_VENDOR | USB_RECIP_DEVICE,
- value, index, buffer, length,
+ 0, /* value */
+ index, tmpbuf, len,
500);
}
@@ -227,7 +241,12 @@ static void pac7311_reg_write(struct usb_device *dev,
__u8 buf;
buf = value;
- reg_w(dev, 0x00, value, index, &buf, 1);
+ usb_control_msg(dev,
+ usb_sndctrlpipe(dev, 0),
+ 0, /* request */
+ USB_DIR_OUT | USB_TYPE_VENDOR | USB_RECIP_DEVICE,
+ value, index, &buf, 1,
+ 500);
}
/* this function is called at probe time */
@@ -256,10 +275,10 @@ static int sd_config(struct gspca_dev *gspca_dev,
cam->cam_mode = vga_mode;
cam->nmodes = ARRAY_SIZE(vga_mode);
- sd->brightness = sd_ctrls[SD_BRIGHTNESS].qctrl.default_value;
- sd->contrast = sd_ctrls[SD_CONTRAST].qctrl.default_value;
- sd->colors = sd_ctrls[SD_COLOR].qctrl.default_value;
- sd->autogain = sd_ctrls[SD_AUTOGAIN].qctrl.default_value;
+ sd->brightness = BRIGHTNESS_DEF;
+ sd->contrast = CONTRAST_DEF;
+ sd->colors = COLOR_DEF;
+ sd->autogain = AUTOGAIN_DEF;
return 0;
}
@@ -271,7 +290,7 @@ static void setbrightness(struct gspca_dev *gspca_dev)
/*jfm: inverted?*/
brightness = BRIGHTNESS_MAX - sd->brightness;
pac7311_reg_write(gspca_dev->dev, 0xff, 0x04);
- /* pac7311_reg_write(gspca_dev->dev, 0x0e, 0x00); */
+/* pac7311_reg_write(gspca_dev->dev, 0x0e, 0x00); */
pac7311_reg_write(gspca_dev->dev, 0x0f, brightness);
/* load registers to sensor (Bit 0, auto clear) */
pac7311_reg_write(gspca_dev->dev, 0x11, 0x01);
@@ -313,26 +332,26 @@ static void sd_start(struct gspca_dev *gspca_dev)
struct sd *sd = (struct sd *) gspca_dev;
pac7311_reg_write(dev, 0xff, 0x01);
- reg_w(dev, 0x01, 0, 0x0002, "\x48\x0a\x40\x08\x00\x00\x08\x00", 8);
- reg_w(dev, 0x01, 0, 0x000a, "\x06\xff\x11\xff\x5a\x30\x90\x4c", 8);
- reg_w(dev, 0x01, 0, 0x0012, "\x00\x07\x00\x0a\x10\x00\xa0\x10", 8);
- reg_w(dev, 0x01, 0, 0x001a, "\x02\x00\x00\x00\x00\x0b\x01\x00", 8);
- reg_w(dev, 0x01, 0, 0x0022, "\x00\x00\x00\x00\x00\x00\x00\x00", 8);
- reg_w(dev, 0x01, 0, 0x002a, "\x00\x00\x00", 3);
- reg_w(dev, 0x01, 0, 0x003e, "\x00\x00\x78\x52\x4a\x52\x78\x6e", 8);
- reg_w(dev, 0x01, 0, 0x0046, "\x48\x46\x48\x6e\x5f\x49\x42\x49", 8);
- reg_w(dev, 0x01, 0, 0x004e, "\x5f\x5f\x49\x42\x49\x5f\x6e\x48", 8);
- reg_w(dev, 0x01, 0, 0x0056, "\x46\x48\x6e\x78\x52\x4a\x52\x78", 8);
- reg_w(dev, 0x01, 0, 0x005e, "\x00\x00\x09\x1b\x34\x49\x5c\x9b", 8);
- reg_w(dev, 0x01, 0, 0x0066, "\xd0\xff", 2);
- reg_w(dev, 0x01, 0, 0x0078, "\x44\x00\xf2\x01\x01\x80", 6);
- reg_w(dev, 0x01, 0, 0x007f, "\x2a\x1c\x00\xc8\x02\x58\x03\x84", 8);
- reg_w(dev, 0x01, 0, 0x0087, "\x12\x00\x1a\x04\x08\x0c\x10\x14", 8);
- reg_w(dev, 0x01, 0, 0x008f, "\x18\x20", 2);
- reg_w(dev, 0x01, 0, 0x0096, "\x01\x08\x04", 3);
- reg_w(dev, 0x01, 0, 0x00a0, "\x44\x44\x44\x04", 4);
- reg_w(dev, 0x01, 0, 0x00f0, "\x01\x00\x00\x00\x22\x00\x20\x00", 8);
- reg_w(dev, 0x01, 0, 0x00f8, "\x3f\x00\x0a\x01\x00", 5);
+ reg_w(dev, 0x0002, "\x48\x0a\x40\x08\x00\x00\x08\x00", 8);
+ reg_w(dev, 0x000a, "\x06\xff\x11\xff\x5a\x30\x90\x4c", 8);
+ reg_w(dev, 0x0012, "\x00\x07\x00\x0a\x10\x00\xa0\x10", 8);
+ reg_w(dev, 0x001a, "\x02\x00\x00\x00\x00\x0b\x01\x00", 8);
+ reg_w(dev, 0x0022, "\x00\x00\x00\x00\x00\x00\x00\x00", 8);
+ reg_w(dev, 0x002a, "\x00\x00\x00", 3);
+ reg_w(dev, 0x003e, "\x00\x00\x78\x52\x4a\x52\x78\x6e", 8);
+ reg_w(dev, 0x0046, "\x48\x46\x48\x6e\x5f\x49\x42\x49", 8);
+ reg_w(dev, 0x004e, "\x5f\x5f\x49\x42\x49\x5f\x6e\x48", 8);
+ reg_w(dev, 0x0056, "\x46\x48\x6e\x78\x52\x4a\x52\x78", 8);
+ reg_w(dev, 0x005e, "\x00\x00\x09\x1b\x34\x49\x5c\x9b", 8);
+ reg_w(dev, 0x0066, "\xd0\xff", 2);
+ reg_w(dev, 0x0078, "\x44\x00\xf2\x01\x01\x80", 6);
+ reg_w(dev, 0x007f, "\x2a\x1c\x00\xc8\x02\x58\x03\x84", 8);
+ reg_w(dev, 0x0087, "\x12\x00\x1a\x04\x08\x0c\x10\x14", 8);
+ reg_w(dev, 0x008f, "\x18\x20", 2);
+ reg_w(dev, 0x0096, "\x01\x08\x04", 3);
+ reg_w(dev, 0x00a0, "\x44\x44\x44\x04", 4);
+ reg_w(dev, 0x00f0, "\x01\x00\x00\x00\x22\x00\x20\x00", 8);
+ reg_w(dev, 0x00f8, "\x3f\x00\x0a\x01\x00", 5);
pac7311_reg_write(dev, 0xff, 0x04);
pac7311_reg_write(dev, 0x02, 0x04);
@@ -386,7 +405,7 @@ static void sd_start(struct gspca_dev *gspca_dev)
setcolors(gspca_dev);
/* set correct resolution */
- switch (gspca_dev->cam.cam_mode[(int) gspca_dev->curr_mode].mode) {
+ switch (gspca_dev->cam.cam_mode[(int) gspca_dev->curr_mode].priv) {
case 2: /* 160x120 */
pac7311_reg_write(dev, 0xff, 0x04);
pac7311_reg_write(dev, 0x02, 0x03);
@@ -495,7 +514,7 @@ static void setautogain(struct gspca_dev *gspca_dev, int luma)
static void sd_pkt_scan(struct gspca_dev *gspca_dev,
struct gspca_frame *frame, /* target */
- unsigned char *data, /* isoc packet */
+ __u8 *data, /* isoc packet */
int len) /* iso packet length */
{
struct sd *sd = (struct sd *) gspca_dev;
diff --git a/linux/drivers/media/video/gspca/sonixb.c b/linux/drivers/media/video/gspca/sonixb.c
index c8dac5f7b..3272593c5 100644
--- a/linux/drivers/media/video/gspca/sonixb.c
+++ b/linux/drivers/media/video/gspca/sonixb.c
@@ -24,8 +24,8 @@
#include "gspca.h"
-#define DRIVER_VERSION_NUMBER KERNEL_VERSION(2, 1, 0)
-static const char version[] = "2.1.0";
+#define DRIVER_VERSION_NUMBER KERNEL_VERSION(2, 1, 5)
+static const char version[] = "2.1.5";
MODULE_AUTHOR("Michel Xhaard <mxhaard@users.sourceforge.net>");
MODULE_DESCRIPTION("GSPCA/SN9C102 USB Camera Driver");
@@ -38,6 +38,7 @@ struct sd {
unsigned char brightness;
unsigned char contrast;
+ unsigned char fr_h_sz; /* size of frame header */
char sensor; /* Type of image sensor chip */
#define SENSOR_HV7131R 0
#define SENSOR_OV6650 1
@@ -95,15 +96,34 @@ static struct ctrl sd_ctrls[] = {
},
};
-/* fixme: should have V4L2_PIX_FMT_SN9C10X */
-static struct cam_mode vga_mode[] = {
- {V4L2_PIX_FMT_SN9C10X, 160, 120, 2},
- {V4L2_PIX_FMT_SN9C10X, 320, 240, 1},
- {V4L2_PIX_FMT_SN9C10X, 640, 480, 0},
+static struct v4l2_pix_format vga_mode[] = {
+ {160, 120, V4L2_PIX_FMT_SN9C10X, V4L2_FIELD_NONE,
+ .bytesperline = 160,
+ .sizeimage = 160 * 120,
+ .colorspace = V4L2_COLORSPACE_SRGB,
+ .priv = 2},
+ {320, 240, V4L2_PIX_FMT_SN9C10X, V4L2_FIELD_NONE,
+ .bytesperline = 320,
+ .sizeimage = 320 * 240,
+ .colorspace = V4L2_COLORSPACE_SRGB,
+ .priv = 1},
+ {640, 480, V4L2_PIX_FMT_SN9C10X, V4L2_FIELD_NONE,
+ .bytesperline = 640,
+ .sizeimage = 640 * 480,
+ .colorspace = V4L2_COLORSPACE_SRGB,
+ .priv = 0},
};
-static struct cam_mode sif_mode[] = {
- {V4L2_PIX_FMT_SN9C10X, 176, 144, 1},
- {V4L2_PIX_FMT_SN9C10X, 352, 288, 0},
+static struct v4l2_pix_format sif_mode[] = {
+ {176, 144, V4L2_PIX_FMT_SN9C10X, V4L2_FIELD_NONE,
+ .bytesperline = 176,
+ .sizeimage = 176 * 144,
+ .colorspace = V4L2_COLORSPACE_SRGB,
+ .priv = 1},
+ {352, 288, V4L2_PIX_FMT_SN9C10X, V4L2_FIELD_NONE,
+ .bytesperline = 352,
+ .sizeimage = 352 * 288,
+ .colorspace = V4L2_COLORSPACE_SRGB,
+ .priv = 0},
};
static const __u8 probe_ov7630[] = {0x08, 0x44};
@@ -342,15 +362,24 @@ static void reg_r(struct usb_device *dev,
static void reg_w(struct usb_device *dev,
__u16 value,
const __u8 *buffer,
- __u16 len)
+ int len)
{
+ __u8 tmpbuf[32];
+
+#ifdef CONFIG_VIDEO_ADV_DEBUG
+ if (len > sizeof tmpbuf) {
+ PDEBUG(D_ERR|D_PACK, "reg_w: buffer overflow");
+ return;
+ }
+#endif
+ memcpy(tmpbuf, buffer, len);
usb_control_msg(dev,
usb_sndctrlpipe(dev, 0),
0x08, /* request */
USB_DIR_OUT | USB_TYPE_VENDOR | USB_RECIP_INTERFACE,
value,
0, /* index */
- (__u8 *) buffer, len,
+ tmpbuf, len,
500);
}
@@ -490,6 +519,7 @@ static int sd_config(struct gspca_dev *gspca_dev,
__u16 product;
int sif = 0;
+ sd->fr_h_sz = 12; /* default size of the frame header */
/* vendor = id->idVendor; */
product = id->idProduct;
/* switch (vendor) { */
@@ -518,6 +548,7 @@ static int sd_config(struct gspca_dev *gspca_dev,
break;
case 0x60b0: /* SN9C103 */
sd->sensor = SENSOR_OV7630_3;
+ sd->fr_h_sz = 18; /* size of frame header */
break;
case 0x6024: /* SN9C102 */
case 0x6025: /* SN9C102 */
@@ -531,6 +562,7 @@ static int sd_config(struct gspca_dev *gspca_dev,
break;
case 0x60af: /* SN9C103 */
sd->sensor = SENSOR_PAS202;
+ sd->fr_h_sz = 18; /* size of frame header (?) */
break;
}
/* break; */
@@ -591,7 +623,7 @@ static void sd_start(struct gspca_dev *gspca_dev)
__u8 reg01, reg17;
__u8 reg17_19[3];
- mode = gspca_dev->cam.cam_mode[(int) gspca_dev->curr_mode].mode;
+ mode = gspca_dev->cam.cam_mode[(int) gspca_dev->curr_mode].priv;
switch (sd->sensor) {
case SENSOR_HV7131R:
sn9c10x = initHv7131;
@@ -755,22 +787,22 @@ static void sd_pkt_scan(struct gspca_dev *gspca_dev,
unsigned char *data, /* isoc packet */
int len) /* iso packet length */
{
- int p;
+ struct sd *sd;
+ int i;
if (len > 6 && len < 24) {
- for (p = 0; p < len - 6; p++) {
- if (data[0 + p] == 0xff
- && data[1 + p] == 0xff
- && data[2 + p] == 0x00
- && data[3 + p] == 0xc4
- && data[4 + p] == 0xc4
- && data[5 + p] == 0x96) { /* start of frame */
- frame = gspca_frame_add(gspca_dev,
- LAST_PACKET,
- frame,
- data, 0);
- data += 12;
- len -= 12;
+ for (i = 0; i < len - 6; i++) {
+ if (data[0 + i] == 0xff
+ && data[1 + i] == 0xff
+ && data[2 + i] == 0x00
+ && data[3 + i] == 0xc4
+ && data[4 + i] == 0xc4
+ && data[5 + i] == 0x96) { /* start of frame */
+ frame = gspca_frame_add(gspca_dev, LAST_PACKET,
+ frame, data, 0);
+ sd = (struct sd *) gspca_dev;
+ data += i + sd->fr_h_sz;
+ len -= i + sd->fr_h_sz;
gspca_frame_add(gspca_dev, FIRST_PACKET,
frame, data, len);
return;
diff --git a/linux/drivers/media/video/gspca/sonixj.c b/linux/drivers/media/video/gspca/sonixj.c
index 849f69e65..debbef092 100644
--- a/linux/drivers/media/video/gspca/sonixj.c
+++ b/linux/drivers/media/video/gspca/sonixj.c
@@ -24,8 +24,8 @@
#include "gspca.h"
#include "jpeg.h"
-#define DRIVER_VERSION_NUMBER KERNEL_VERSION(2, 1, 0)
-static const char version[] = "2.1.0";
+#define DRIVER_VERSION_NUMBER KERNEL_VERSION(2, 1, 5)
+static const char version[] = "2.1.5";
MODULE_AUTHOR("Michel Xhaard <mxhaard@users.sourceforge.net>");
MODULE_DESCRIPTION("GSPCA/SONIX JPEG USB Camera Driver");
@@ -74,7 +74,6 @@ static int sd_setautogain(struct gspca_dev *gspca_dev, __s32 val);
static int sd_getautogain(struct gspca_dev *gspca_dev, __s32 *val);
static struct ctrl sd_ctrls[] = {
-#define SD_BRIGHTNESS 0
{
{
.id = V4L2_CID_BRIGHTNESS,
@@ -83,12 +82,12 @@ static struct ctrl sd_ctrls[] = {
.minimum = 0,
.maximum = 0xffff,
.step = 1,
- .default_value = 0x7fff,
+#define BRIGHTNESS_DEF 0x7fff
+ .default_value = BRIGHTNESS_DEF,
},
.set = sd_setbrightness,
.get = sd_getbrightness,
},
-#define SD_CONTRAST 1
{
{
.id = V4L2_CID_CONTRAST,
@@ -97,12 +96,12 @@ static struct ctrl sd_ctrls[] = {
.minimum = 0,
.maximum = 127,
.step = 1,
- .default_value = 63,
+#define CONTRAST_DEF 63
+ .default_value = CONTRAST_DEF,
},
.set = sd_setcontrast,
.get = sd_getcontrast,
},
-#define SD_COLOR 2
{
{
.id = V4L2_CID_SATURATION,
@@ -111,12 +110,12 @@ static struct ctrl sd_ctrls[] = {
.minimum = 0,
.maximum = 255,
.step = 1,
- .default_value = 127,
+#define COLOR_DEF 127
+ .default_value = COLOR_DEF,
},
.set = sd_setcolors,
.get = sd_getcolors,
},
-#define SD_AUTOGAIN 3
{
{
.id = V4L2_CID_AUTOGAIN,
@@ -125,21 +124,34 @@ static struct ctrl sd_ctrls[] = {
.minimum = 0,
.maximum = 1,
.step = 1,
- .default_value = 1,
+#define AUTOGAIN_DEF 1
+ .default_value = AUTOGAIN_DEF,
},
.set = sd_setautogain,
.get = sd_getautogain,
},
};
-static struct cam_mode vga_mode[] = {
- {V4L2_PIX_FMT_JPEG, 160, 120, 2},
- {V4L2_PIX_FMT_JPEG, 320, 240, 1},
- {V4L2_PIX_FMT_JPEG, 640, 480, 0},
+static struct v4l2_pix_format vga_mode[] = {
+ {160, 120, V4L2_PIX_FMT_JPEG, V4L2_FIELD_NONE,
+ .bytesperline = 160,
+ .sizeimage = 160 * 120 * 3 / 8 + 590,
+ .colorspace = V4L2_COLORSPACE_JPEG,
+ .priv = 2},
+ {320, 240, V4L2_PIX_FMT_JPEG, V4L2_FIELD_NONE,
+ .bytesperline = 320,
+ .sizeimage = 320 * 240 * 3 / 8 + 590,
+ .colorspace = V4L2_COLORSPACE_JPEG,
+ .priv = 1},
+ {640, 480, V4L2_PIX_FMT_JPEG, V4L2_FIELD_NONE,
+ .bytesperline = 640,
+ .sizeimage = 640 * 480 * 3 / 8 + 590,
+ .colorspace = V4L2_COLORSPACE_JPEG,
+ .priv = 0},
};
/*Data from sn9c102p+hv71331r */
-static __u8 sn_hv7131[] = {
+static const __u8 sn_hv7131[] = {
0x00, 0x03, 0x64, 0x00, 0x1A, 0x20, 0x20, 0x20, 0xA1, 0x11,
/* reg0 reg1 reg2 reg3 reg4 reg5 reg6 reg7 reg8 reg9 */
0x02, 0x09, 0x00, 0x00, 0x00, 0x10, 0x03, 0x00, /* 00 */
@@ -150,7 +162,7 @@ static __u8 sn_hv7131[] = {
/* reg1c reg1d reg1e reg1f reg20 reg21 reg22 reg23 */
};
-static __u8 sn_mi0360[] = {
+static const __u8 sn_mi0360[] = {
0x00, 0x61, 0x44, 0x00, 0x1a, 0x20, 0x20, 0x20, 0xb1, 0x5d,
/* reg0 reg1 reg2 reg3 reg4 reg5 reg6 reg7 reg8 reg9 */
0x07, 0x00, 0x00, 0x00, 0x00, 0x10, 0x03, 0x00,
@@ -161,7 +173,7 @@ static __u8 sn_mi0360[] = {
/* reg1c reg1d reg1e reg1f reg20 reg21 reg22 reg23 */
};
-static __u8 sn_mo4000[] = {
+static const __u8 sn_mo4000[] = {
0x12, 0x23, 0x60, 0x00, 0x1A, 0x00, 0x20, 0x18, 0x81,
/* reg0 reg1 reg2 reg3 reg4 reg5 reg6 reg7 reg8 */
0x21, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x03, 0x00,
@@ -174,13 +186,13 @@ static __u8 sn_mo4000[] = {
0xd3, 0xdf, 0xea, 0xf5
};
-static __u8 sn_ov7648[] = {
+static const __u8 sn_ov7648[] = {
0x00, 0x21, 0x62, 0x00, 0x1a, 0x20, 0x20, 0x20, 0xA1, 0x6E, 0x18, 0x65,
0x00, 0x00, 0x00, 0x10, 0x03, 0x00, 0x00, 0x06, 0x06, 0x28, 0x1E, 0x82,
0x07, 0x00, 0x00, 0x00, 0x00, 0x00
};
-static __u8 sn_ov7660[] = {
+static const __u8 sn_ov7660[] = {
# if 1 /*jfm: from win trace */
/* reg0 reg1 reg2 reg3 reg4 reg5 reg6 reg7 reg8 */
0x00, 0x61, 0x40, 0x00, 0x1a, 0x00, 0x00, 0x00, 0x81,
@@ -203,7 +215,7 @@ static __u8 sn_ov7660[] = {
};
/* sequence specific to the sensors - !! index = SENSOR_xxx */
-static __u8 *sn_tb[] = {
+static const __u8 *sn_tb[] = {
sn_hv7131,
sn_mi0360,
sn_mo4000,
@@ -211,28 +223,28 @@ static __u8 *sn_tb[] = {
sn_ov7660
};
-static __u8 regsn20[] = {
+static const __u8 regsn20[] = {
0x00, 0x2d, 0x46, 0x5a, 0x6c, 0x7c, 0x8b, 0x99,
0xa6, 0xb2, 0xbf, 0xca, 0xd5, 0xe0, 0xeb, 0xf5, 0xff
};
-static __u8 regsn20_sn9c325[] = {
+static const __u8 regsn20_sn9c325[] = {
0x0a, 0x3a, 0x56, 0x6c, 0x7e, 0x8d, 0x9a, 0xa4,
0xaf, 0xbb, 0xc5, 0xcd, 0xd5, 0xde, 0xe8, 0xed, 0xf5
};
-static __u8 reg84[] = {
+static const __u8 reg84[] = {
0x14, 0x00, 0x27, 0x00, 0x07, 0x00, 0xe5, 0x0f,
0xe4, 0x0f, 0x38, 0x00, 0x3e, 0x00, 0xc3, 0x0f,
/* 0x00, 0x00, 0x00, 0x00, 0x00 */
0xf7, 0x0f, 0x0a, 0x00, 0x00
};
-static __u8 reg84_sn9c325[] = {
+static const __u8 reg84_sn9c325[] = {
0x14, 0x00, 0x27, 0x00, 0x07, 0x00, 0xe4, 0x0f,
0xd3, 0x0f, 0x4b, 0x00, 0x48, 0x00, 0xc0, 0x0f,
0xf8, 0x0f, 0x00, 0x00, 0x00
};
-static __u8 hv7131r_sensor_init[][8] = {
+static const __u8 hv7131r_sensor_init[][8] = {
{0xC1, 0x11, 0x01, 0x08, 0x01, 0x00, 0x00, 0x10},
{0xB1, 0x11, 0x34, 0x17, 0x7F, 0x00, 0x00, 0x10},
{0xD1, 0x11, 0x40, 0xFF, 0x7F, 0x7F, 0x7F, 0x10},
@@ -261,9 +273,9 @@ static __u8 hv7131r_sensor_init[][8] = {
{0xA1, 0x11, 0x21, 0xD0, 0x00, 0x00, 0x00, 0x10},
{0xA1, 0x11, 0x22, 0x00, 0x00, 0x00, 0x00, 0x10},
{0xA1, 0x11, 0x23, 0x10, 0x00, 0x00, 0x00, 0x10},
- {0, 0, 0, 0, 0, 0, 0, 0}
+ {}
};
-static __u8 mi0360_sensor_init[][8] = {
+static const __u8 mi0360_sensor_init[][8] = {
{0xB1, 0x5D, 0x07, 0x00, 0x02, 0x00, 0x00, 0x10},
{0xB1, 0x5D, 0x0D, 0x00, 0x01, 0x00, 0x00, 0x10},
{0xB1, 0x5D, 0x0D, 0x00, 0x00, 0x00, 0x00, 0x10},
@@ -315,9 +327,9 @@ static __u8 mi0360_sensor_init[][8] = {
/* {0xB1, 0x5D, 0x35, 0x00, 0x20, 0x00, 0x00, 0x10}, * gain */
{0xB1, 0x5D, 0x07, 0x00, 0x03, 0x00, 0x00, 0x10}, /* update */
{0xB1, 0x5D, 0x07, 0x00, 0x02, 0x00, 0x00, 0x10}, /* sensor on */
- {0, 0, 0, 0, 0, 0, 0, 0}
+ {}
};
-static __u8 mo4000_sensor_init[][8] = {
+static const __u8 mo4000_sensor_init[][8] = {
{0xa1, 0x21, 0x01, 0x02, 0x00, 0x00, 0x00, 0x10},
{0xa1, 0x21, 0x02, 0x00, 0x00, 0x00, 0x00, 0x10},
{0xa1, 0x21, 0x03, 0x00, 0x00, 0x00, 0x00, 0x10},
@@ -338,9 +350,9 @@ static __u8 mo4000_sensor_init[][8] = {
{0xa1, 0x21, 0x10, 0x20, 0x00, 0x00, 0x00, 0x10},
{0xa1, 0x21, 0x00, 0x00, 0x00, 0x00, 0x00, 0x10},
{0xa1, 0x21, 0x11, 0x38, 0x00, 0x00, 0x00, 0x10},
- {0, 0, 0, 0, 0, 0, 0, 0}
+ {}
};
-static __u8 ov7660_sensor_init[][8] = {
+static const __u8 ov7660_sensor_init[][8] = {
{0xa1, 0x21, 0x12, 0x80, 0x00, 0x00, 0x00, 0x10}, /* reset SCCB */
{0xa1, 0x21, 0x12, 0x05, 0x00, 0x00, 0x00, 0x10},
/* Outformat ?? rawRGB */
@@ -431,12 +443,12 @@ static __u8 ov7660_sensor_init[][8] = {
{0xa1, 0x21, 0x2a, 0x00, 0x00, 0x00, 0x00, 0x10},
{0xa1, 0x21, 0x2b, 0xc3, 0x00, 0x00, 0x00, 0x10},
/* here may start the isoc exchanges */
- {0, 0, 0, 0, 0, 0, 0, 0}
+ {}
};
/* reg0x04 reg0x07 reg 0x10 */
/* expo = (COM1 & 0x02) | (AECHH & 0x2f <<10) [ (AECh << 2) */
-static __u8 ov7648_sensor_init[][8] = {
+static const __u8 ov7648_sensor_init[][8] = {
{0xC1, 0x00, 0x01, 0x00, 0x00, 0x00, 0x01, 0x00},
{0xC1, 0x00, 0x00, 0x00, 0x00, 0x00, 0x01, 0x00},
{0xC1, 0x00, 0x01, 0x00, 0x00, 0x00, 0x01, 0x00},
@@ -489,10 +501,10 @@ static __u8 ov7648_sensor_init[][8] = {
{0xA1, 0x6E, 0x07, 0x66, 0x00, 0x00, 0x00, 0x10}, /* B.. */
{0xC1, 0x6E, 0x1A, 0x03, 0x65, 0x90, 0x00, 0x10}, /* Bright/Witen....*/
/* {0xC1, 0x6E, 0x16, 0x45, 0x40, 0x60, 0x00, 0x10}, * Bright/Witene */
- {0, 0, 0, 0, 0, 0, 0, 0}
+ {}
};
-static __u8 qtable4[] = {
+static const __u8 qtable4[] = {
0x06, 0x04, 0x04, 0x06, 0x04, 0x04, 0x06, 0x06, 0x06, 0x06, 0x08, 0x06,
0x06, 0x08, 0x0A, 0x11,
0x0A, 0x0A, 0x08, 0x08, 0x0A, 0x15, 0x0F, 0x0F, 0x0C, 0x11, 0x19, 0x15,
@@ -526,21 +538,39 @@ static void reg_r(struct usb_device *dev,
static void reg_w(struct usb_device *dev,
__u16 value,
- __u8 *buffer,
+ const __u8 *buffer,
int len)
{
- usb_control_msg(dev,
- usb_sndctrlpipe(dev, 0),
- 0x08,
- USB_DIR_OUT | USB_TYPE_VENDOR | USB_RECIP_INTERFACE,
- value, 0,
- buffer, len,
- 500);
+ if (len < 16) {
+ __u8 tmpbuf[16];
+
+ memcpy(tmpbuf, buffer, len);
+ usb_control_msg(dev,
+ usb_sndctrlpipe(dev, 0),
+ 0x08,
+ USB_DIR_OUT | USB_TYPE_VENDOR | USB_RECIP_INTERFACE,
+ value, 0,
+ tmpbuf, len,
+ 500);
+ } else {
+ __u8 *tmpbuf;
+
+ tmpbuf = kmalloc(len, GFP_KERNEL);
+ memcpy(tmpbuf, buffer, len);
+ usb_control_msg(dev,
+ usb_sndctrlpipe(dev, 0),
+ 0x08,
+ USB_DIR_OUT | USB_TYPE_VENDOR | USB_RECIP_INTERFACE,
+ value, 0,
+ tmpbuf, len,
+ 500);
+ kfree(tmpbuf);
+ }
}
/* write 2 bytes */
static void i2c_w2(struct gspca_dev *gspca_dev,
- __u8 *buffer)
+ const __u8 *buffer)
{
struct sd *sd = (struct sd *) gspca_dev;
struct usb_device *dev = gspca_dev->dev;
@@ -559,7 +589,7 @@ static void i2c_w2(struct gspca_dev *gspca_dev,
}
/* write 8 bytes */
-static void i2c_w8(struct usb_device *dev, __u8 *buffer)
+static void i2c_w8(struct usb_device *dev, const __u8 *buffer)
{
reg_w(dev, 0x08, buffer, 8);
msleep(1);
@@ -567,7 +597,7 @@ static void i2c_w8(struct usb_device *dev, __u8 *buffer)
/* read 5 bytes */
static void i2c_r5(struct gspca_dev *gspca_dev, __u8 reg,
- __u8 *buffer)
+ __u8 *buffer)
{
struct sd *sd = (struct sd *) gspca_dev;
struct usb_device *dev = gspca_dev->dev;
@@ -593,7 +623,7 @@ static int probesensor(struct gspca_dev *gspca_dev)
struct sd *sd = (struct sd *) gspca_dev;
struct usb_device *dev = gspca_dev->dev;
__u8 reg02;
- static __u8 datasend[] = { 2, 0 };
+ static const __u8 datasend[] = { 2, 0 };
/* reg val1 val2 val3 val4 */
__u8 datarecd[6];
@@ -620,18 +650,18 @@ static int probesensor(struct gspca_dev *gspca_dev)
}
static int configure_gpio(struct gspca_dev *gspca_dev,
- __u8 *sn9c1xx)
+ const __u8 *sn9c1xx)
{
struct sd *sd = (struct sd *) gspca_dev;
struct usb_device *dev = gspca_dev->dev;
__u8 data;
__u8 regF1;
- __u8 *reg9a;
- static __u8 reg9a_def[] =
+ const __u8 *reg9a;
+ static const __u8 reg9a_def[] =
{0x08, 0x40, 0x20, 0x10, 0x00, 0x04};
- static __u8 reg9a_sn9c120[] = /* from win trace */
+ static const __u8 reg9a_sn9c120[] = /* from win trace */
{0x00, 0x40, 0x38, 0x30, 0x00, 0x20};
- static __u8 reg9a_sn9c325[] =
+ static const __u8 reg9a_sn9c325[] =
{0x0a, 0x40, 0x38, 0x30, 0x00, 0x20};
@@ -699,7 +729,7 @@ static void hv7131R_InitSensor(struct gspca_dev *gspca_dev)
{
int i = 0;
struct usb_device *dev = gspca_dev->dev;
- static __u8 SetSensorClk[] = /* 0x08 Mclk */
+ static const __u8 SetSensorClk[] = /* 0x08 Mclk */
{ 0xa1, 0x11, 0x01, 0x18, 0x00, 0x00, 0x00, 0x10 };
while (hv7131r_sensor_init[i][0]) {
@@ -973,11 +1003,12 @@ static int sd_config(struct gspca_dev *gspca_dev,
cam->epaddr = 0x01;
cam->cam_mode = vga_mode;
cam->nmodes = ARRAY_SIZE(vga_mode);
+
sd->qindex = 4; /* set the quantization table */
- sd->brightness = sd_ctrls[SD_BRIGHTNESS].qctrl.default_value;
- sd->contrast = sd_ctrls[SD_CONTRAST].qctrl.default_value;
- sd->colors = sd_ctrls[SD_COLOR].qctrl.default_value;
- sd->autogain = sd_ctrls[SD_AUTOGAIN].qctrl.default_value;
+ sd->brightness = BRIGHTNESS_DEF;
+ sd->contrast = CONTRAST_DEF;
+ sd->colors = COLOR_DEF;
+ sd->autogain = AUTOGAIN_DEF;
return 0;
}
@@ -986,7 +1017,7 @@ static int sd_open(struct gspca_dev *gspca_dev)
{
struct sd *sd = (struct sd *) gspca_dev;
struct usb_device *dev = gspca_dev->dev;
-/* __u8 *sn9c1xx; */
+/* const __u8 *sn9c1xx; */
__u8 regF1;
__u8 regGpio[] = { 0x29, 0x74 };
@@ -1043,11 +1074,11 @@ static unsigned int setexposure(struct gspca_dev *gspca_dev,
unsigned int expo)
{
struct sd *sd = (struct sd *) gspca_dev;
- static __u8 doit[] = /* update sensor */
+ static const __u8 doit[] = /* update sensor */
{ 0xb1, 0x5d, 0x07, 0x00, 0x03, 0x00, 0x00, 0x10 };
- static __u8 sensorgo[] = /* sensor on */
+ static const __u8 sensorgo[] = /* sensor on */
{ 0xb1, 0x5d, 0x07, 0x00, 0x02, 0x00, 0x00, 0x10 };
- static __u8 gainMo[] =
+ static const __u8 gainMo[] =
{ 0xa1, 0x21, 0x00, 0x10, 0x00, 0x00, 0x00, 0x1d };
switch (sd->sensor) {
@@ -1171,14 +1202,15 @@ static void sd_start(struct gspca_dev *gspca_dev)
__u8 data;
__u8 reg1;
__u8 reg17;
- __u8 *sn9c1xx;
+ const __u8 *sn9c1xx;
int mode;
- static __u8 DC29[] = { 0x6a, 0x50, 0x00, 0x00, 0x50, 0x3c };
- static __u8 C0[] = { 0x2d, 0x2d, 0x3a, 0x05, 0x04, 0x3f };
- static __u8 CA[] = { 0x28, 0xd8, 0x14, 0xec };
- static __u8 CA_sn9c120[] = { 0x14, 0xec, 0x0a, 0xf6 }; /* SN9C120 */
- static __u8 CE[] = { 0x32, 0xdd, 0x2d, 0xdd }; /* MI0360 */
- static __u8 CE_sn9c325[] =
+ static const __u8 DC29[] = { 0x6a, 0x50, 0x00, 0x00, 0x50, 0x3c };
+ static const __u8 C0[] = { 0x2d, 0x2d, 0x3a, 0x05, 0x04, 0x3f };
+ static const __u8 CA[] = { 0x28, 0xd8, 0x14, 0xec };
+ static const __u8 CA_sn9c120[] =
+ { 0x14, 0xec, 0x0a, 0xf6 }; /* SN9C120 */
+ static const __u8 CE[] = { 0x32, 0xdd, 0x2d, 0xdd }; /* MI0360 */
+ static const __u8 CE_sn9c325[] =
{ 0x32, 0xdd, 0x32, 0xdd }; /* OV7648 - SN9C325 */
sn9c1xx = sn_tb[(int) sd->sensor];
@@ -1228,7 +1260,7 @@ static void sd_start(struct gspca_dev *gspca_dev)
reg_w(dev, 0x99, &data, 1);
}
- mode = gspca_dev->cam.cam_mode[(int) gspca_dev->curr_mode].mode;
+ mode = gspca_dev->cam.cam_mode[(int) gspca_dev->curr_mode].priv;
reg1 = 0x02;
reg17 = 0x61;
switch (sd->sensor) {
@@ -1323,13 +1355,13 @@ static void sd_stopN(struct gspca_dev *gspca_dev)
{
struct sd *sd = (struct sd *) gspca_dev;
struct usb_device *dev = gspca_dev->dev;
- static __u8 stophv7131[] =
+ static const __u8 stophv7131[] =
{ 0xa1, 0x11, 0x02, 0x09, 0x00, 0x00, 0x00, 0x10 };
- static __u8 stopmi0360[] =
+ static const __u8 stopmi0360[] =
{ 0xb1, 0x5d, 0x07, 0x00, 0x00, 0x00, 0x00, 0x10 };
__u8 regF1;
__u8 data;
- __u8 *sn9c1xx;
+ const __u8 *sn9c1xx;
data = 0x0b;
switch (sd->sensor) {
@@ -1404,7 +1436,7 @@ static void setautogain(struct gspca_dev *gspca_dev)
static void sd_pkt_scan(struct gspca_dev *gspca_dev,
struct gspca_frame *frame, /* target */
- unsigned char *data, /* isoc packet */
+ __u8 *data, /* isoc packet */
int len) /* iso packet length */
{
struct sd *sd = (struct sd *) gspca_dev;
@@ -1579,7 +1611,7 @@ static int sd_getautogain(struct gspca_dev *gspca_dev, __s32 *val)
}
/* sub-driver description */
-static struct sd_desc sd_desc = {
+static const struct sd_desc sd_desc = {
.name = MODULE_NAME,
.ctrls = sd_ctrls,
.nctrls = ARRAY_SIZE(sd_ctrls),
@@ -1594,7 +1626,7 @@ static struct sd_desc sd_desc = {
/* -- module initialisation -- */
#define DVNM(name) .driver_info = (kernel_ulong_t) name
-static __devinitdata struct usb_device_id device_table[] = {
+static const __devinitdata struct usb_device_id device_table[] = {
{USB_DEVICE(0x0458, 0x7025), DVNM("Genius Eye 311Q")},
{USB_DEVICE(0x045e, 0x00f5), DVNM("MicroSoft VX3000")},
{USB_DEVICE(0x045e, 0x00f7), DVNM("MicroSoft VX1000")},
diff --git a/linux/drivers/media/video/gspca/spca500.c b/linux/drivers/media/video/gspca/spca500.c
index d35bfabf8..1860fc7f5 100644
--- a/linux/drivers/media/video/gspca/spca500.c
+++ b/linux/drivers/media/video/gspca/spca500.c
@@ -24,8 +24,8 @@
#include "gspca.h"
#include "jpeg.h"
-#define DRIVER_VERSION_NUMBER KERNEL_VERSION(2, 1, 0)
-static const char version[] = "2.1.0";
+#define DRIVER_VERSION_NUMBER KERNEL_VERSION(2, 1, 5)
+static const char version[] = "2.1.5";
MODULE_AUTHOR("Michel Xhaard <mxhaard@users.sourceforge.net>");
MODULE_DESCRIPTION("GSPCA/SPCA500 USB Camera Driver");
@@ -35,7 +35,7 @@ MODULE_LICENSE("GPL");
struct sd {
struct gspca_dev gspca_dev; /* !! must be the first item */
- unsigned char packet[ISO_MAX_SIZE + 128];
+ __u8 packet[ISO_MAX_SIZE + 128];
/* !! no more than 128 ff in an ISO packet */
unsigned char brightness;
@@ -70,58 +70,74 @@ static int sd_setcolors(struct gspca_dev *gspca_dev, __s32 val);
static int sd_getcolors(struct gspca_dev *gspca_dev, __s32 *val);
static struct ctrl sd_ctrls[] = {
-#define SD_BRIGHTNESS 0
{
{
.id = V4L2_CID_BRIGHTNESS,
.type = V4L2_CTRL_TYPE_INTEGER,
.name = "Brightness",
.minimum = 0,
- .maximum = 0xff,
+ .maximum = 255,
.step = 1,
- .default_value = 0x7f,
+#define BRIGHTNESS_DEF 127
+ .default_value = BRIGHTNESS_DEF,
},
.set = sd_setbrightness,
.get = sd_getbrightness,
},
-#define SD_CONTRAST 1
{
{
.id = V4L2_CID_CONTRAST,
.type = V4L2_CTRL_TYPE_INTEGER,
.name = "Contrast",
.minimum = 0,
- .maximum = 255,
+ .maximum = 63,
.step = 1,
- .default_value = 127,
+#define CONTRAST_DEF 31
+ .default_value = CONTRAST_DEF,
},
.set = sd_setcontrast,
.get = sd_getcontrast,
},
-#define SD_COLOR 2
{
{
.id = V4L2_CID_SATURATION,
.type = V4L2_CTRL_TYPE_INTEGER,
.name = "Color",
.minimum = 0,
- .maximum = 255,
+ .maximum = 63,
.step = 1,
- .default_value = 127,
+#define COLOR_DEF 31
+ .default_value = COLOR_DEF,
},
.set = sd_setcolors,
.get = sd_getcolors,
},
};
-static struct cam_mode vga_mode[] = {
- {V4L2_PIX_FMT_JPEG, 320, 240, 1},
- {V4L2_PIX_FMT_JPEG, 640, 480, 0},
+static struct v4l2_pix_format vga_mode[] = {
+ {320, 240, V4L2_PIX_FMT_JPEG, V4L2_FIELD_NONE,
+ .bytesperline = 320,
+ .sizeimage = 320 * 240 * 3 / 8 + 590,
+ .colorspace = V4L2_COLORSPACE_JPEG,
+ .priv = 1},
+ {640, 480, V4L2_PIX_FMT_JPEG, V4L2_FIELD_NONE,
+ .bytesperline = 640,
+ .sizeimage = 640 * 480 * 3 / 8 + 590,
+ .colorspace = V4L2_COLORSPACE_JPEG,
+ .priv = 0},
};
-static struct cam_mode sif_mode[] = {
- {V4L2_PIX_FMT_JPEG, 176, 144, 1},
- {V4L2_PIX_FMT_JPEG, 352, 288, 0},
+static struct v4l2_pix_format sif_mode[] = {
+ {176, 144, V4L2_PIX_FMT_JPEG, V4L2_FIELD_NONE,
+ .bytesperline = 176,
+ .sizeimage = 176 * 144 * 3 / 8 + 590,
+ .colorspace = V4L2_COLORSPACE_JPEG,
+ .priv = 1},
+ {352, 288, V4L2_PIX_FMT_JPEG, V4L2_FIELD_NONE,
+ .bytesperline = 352,
+ .sizeimage = 352 * 288 * 3 / 8 + 590,
+ .colorspace = V4L2_COLORSPACE_JPEG,
+ .priv = 0},
};
/* Frame packet header offsets for the spca500 */
@@ -139,7 +155,7 @@ static struct cam_mode sif_mode[] = {
#define SPCA500_OFFSET_DATA 16
#if 0
-static __u16 spca500_read_stats[][3] = {
+static const __u16 spca500_read_stats[][3] = {
{0x0c, 0x0000, 0x0000},
{0x30, 0x03fd, 0x0001},
/* possible values for following call: 0x01b3, 0x01e6, 0x01f7, 0x0218 */
@@ -152,11 +168,11 @@ static __u16 spca500_read_stats[][3] = {
{0x30, 0x0001, 0x0006},
{0x30, 0x0080, 0x0007},
{0x30, 0x0004, 0x0000},
- {0, 0, 0}
+ {}
};
#endif
-static __u16 spca500_visual_defaults[][3] = {
+static const __u16 spca500_visual_defaults[][3] = {
{0x00, 0x0003, 0x816b}, /* SSI not active sync with vsync,
* hue (H byte) = 0,
* saturation/hue enable,
@@ -178,10 +194,9 @@ static __u16 spca500_visual_defaults[][3] = {
{0x00, 0x0001, 0x8202}, /* clock rate compensation = 1/25 sec/frame */
{0x0c, 0x0004, 0x0000},
/* set interface */
-
- {0, 0, 0}
+ {}
};
-static __u16 Clicksmart510_defaults[][3] = {
+static const __u16 Clicksmart510_defaults[][3] = {
{0x00, 0x00, 0x8211},
{0x00, 0x01, 0x82c0},
{0x00, 0x10, 0x82cb},
@@ -310,7 +325,7 @@ static __u16 Clicksmart510_defaults[][3] = {
{}
};
-static unsigned char qtable_creative_pccam[2][64] = {
+static const __u8 qtable_creative_pccam[2][64] = {
{ /* Q-table Y-components */
0x05, 0x03, 0x03, 0x05, 0x07, 0x0c, 0x0f, 0x12,
0x04, 0x04, 0x04, 0x06, 0x08, 0x11, 0x12, 0x11,
@@ -331,7 +346,7 @@ static unsigned char qtable_creative_pccam[2][64] = {
0x1e, 0x1e, 0x1e, 0x1e, 0x1e, 0x1e, 0x1e, 0x1e}
};
-static unsigned char qtable_kodak_ez200[2][64] = {
+static const __u8 qtable_kodak_ez200[2][64] = {
{ /* Q-table Y-components */
0x02, 0x01, 0x01, 0x02, 0x02, 0x04, 0x05, 0x06,
0x01, 0x01, 0x01, 0x02, 0x03, 0x06, 0x06, 0x06,
@@ -352,7 +367,7 @@ static unsigned char qtable_kodak_ez200[2][64] = {
0x0a, 0x0a, 0x0a, 0x0a, 0x0a, 0x0a, 0x0a, 0x0a}
};
-static unsigned char qtable_pocketdv[2][64] = {
+static const __u8 qtable_pocketdv[2][64] = {
{ /* Q-table Y-components start registers 0x8800 */
0x06, 0x04, 0x04, 0x06, 0x0a, 0x10, 0x14, 0x18,
0x05, 0x05, 0x06, 0x08, 0x0a, 0x17, 0x18, 0x16,
@@ -374,7 +389,7 @@ static unsigned char qtable_pocketdv[2][64] = {
0x28, 0x28, 0x28, 0x28, 0x28, 0x28, 0x28, 0x28}
};
-static void spca5xxRegRead(struct usb_device *dev,
+static void reg_r(struct usb_device *dev,
__u16 index,
__u8 *buffer, __u16 length)
{
@@ -386,25 +401,24 @@ static void spca5xxRegRead(struct usb_device *dev,
index, buffer, length, 500);
}
-static int reg_write(struct usb_device *dev,
+static int reg_w(struct usb_device *dev,
__u16 req, __u16 index, __u16 value)
{
int ret;
+ PDEBUG(D_USBO, "reg write: [0x%02x] = 0x%02x", index, value);
ret = usb_control_msg(dev,
usb_sndctrlpipe(dev, 0),
req,
- USB_TYPE_VENDOR | USB_RECIP_DEVICE,
+ USB_DIR_OUT | USB_TYPE_VENDOR | USB_RECIP_DEVICE,
value, index, NULL, 0, 500);
- PDEBUG(D_USBO, "reg write: [0x%02x] = 0x%02x, 0x%x",
- index, value, ret);
if (ret < 0)
PDEBUG(D_ERR, "reg write: error %d", ret);
return ret;
}
/* returns: negative is error, pos or zero is data */
-static int reg_read(struct usb_device *dev,
+static int reg_r_12(struct usb_device *dev,
__u16 req, /* bRequest */
__u16 index, /* wIndex */
__u16 length) /* wLength (1 or 2 only) */
@@ -422,7 +436,7 @@ static int reg_read(struct usb_device *dev,
buf, length,
500); /* timeout */
if (ret < 0) {
- PDEBUG(D_ERR, "reg_read err %d", ret);
+ PDEBUG(D_ERR, "reg_r_12 err %d", ret);
return -1;
}
return (buf[1] << 8) + buf[0];
@@ -433,13 +447,13 @@ static int reg_read(struct usb_device *dev,
* a reg_read call.
* Returns: negative is error or timeout, zero is success.
*/
-static int reg_readwait(struct usb_device *dev,
+static int reg_r_wait(struct usb_device *dev,
__u16 reg, __u16 index, __u16 value)
{
int ret, cnt = 20;
while (--cnt > 0) {
- ret = reg_read(dev, reg, index, 1);
+ ret = reg_r_12(dev, reg, index, 1);
if (ret == value)
return 0;
msleep(50);
@@ -448,13 +462,13 @@ static int reg_readwait(struct usb_device *dev,
}
static int write_vector(struct gspca_dev *gspca_dev,
- __u16 data[][3])
+ const __u16 data[][3])
{
struct usb_device *dev = gspca_dev->dev;
int ret, i = 0;
while (data[i][0] != 0 || data[i][1] != 0 || data[i][2] != 0) {
- ret = reg_write(dev, data[i][0], data[i][2], data[i][1]);
+ ret = reg_w(dev, data[i][0], data[i][2], data[i][1]);
if (ret < 0)
return ret;
i++;
@@ -466,21 +480,21 @@ static int spca50x_setup_qtable(struct gspca_dev *gspca_dev,
unsigned int request,
unsigned int ybase,
unsigned int cbase,
- unsigned char qtable[2][64])
+ const __u8 qtable[2][64])
{
struct usb_device *dev = gspca_dev->dev;
int i, err;
/* loop over y components */
for (i = 0; i < 64; i++) {
- err = reg_write(dev, request, ybase + i, qtable[0][i]);
+ err = reg_w(dev, request, ybase + i, qtable[0][i]);
if (err < 0)
return err;
}
/* loop over c components */
for (i = 0; i < 64; i++) {
- err = reg_write(dev, request, cbase + i, qtable[1][i]);
+ err = reg_w(dev, request, cbase + i, qtable[1][i]);
if (err < 0)
return err;
}
@@ -491,8 +505,8 @@ static void spca500_ping310(struct gspca_dev *gspca_dev)
{
__u8 Data[2];
- spca5xxRegRead(gspca_dev->dev, 0x0d04, Data, 2);
- PDEBUG(D_PACK, "ClickSmart310 ping 0x0d04 0x%02x 0x%02x",
+ reg_r(gspca_dev->dev, 0x0d04, Data, 2);
+ PDEBUG(D_STREAM, "ClickSmart310 ping 0x0d04 0x%02x 0x%02x",
Data[0], Data[1]);
}
@@ -500,26 +514,26 @@ static void spca500_clksmart310_init(struct gspca_dev *gspca_dev)
{
__u8 Data[2];
- spca5xxRegRead(gspca_dev->dev, 0x0d05, Data, 2);
- PDEBUG(D_PACK, "ClickSmart310 init 0x0d05 0x%02x 0x%02x", Data[0],
- Data[1]);
- reg_write(gspca_dev->dev, 0x00, 0x8167, 0x5a);
+ reg_r(gspca_dev->dev, 0x0d05, Data, 2);
+ PDEBUG(D_STREAM, "ClickSmart310 init 0x0d05 0x%02x 0x%02x",
+ Data[0], Data[1]);
+ reg_w(gspca_dev->dev, 0x00, 0x8167, 0x5a);
spca500_ping310(gspca_dev);
- reg_write(gspca_dev->dev, 0x00, 0x8168, 0x22);
- reg_write(gspca_dev->dev, 0x00, 0x816a, 0xc0);
- reg_write(gspca_dev->dev, 0x00, 0x816b, 0x0b);
- reg_write(gspca_dev->dev, 0x00, 0x8169, 0x25);
- reg_write(gspca_dev->dev, 0x00, 0x8157, 0x5b);
- reg_write(gspca_dev->dev, 0x00, 0x8158, 0x5b);
- reg_write(gspca_dev->dev, 0x00, 0x813f, 0x03);
- reg_write(gspca_dev->dev, 0x00, 0x8151, 0x4a);
- reg_write(gspca_dev->dev, 0x00, 0x8153, 0x78);
- reg_write(gspca_dev->dev, 0x00, 0x0d01, 0x04);
+ reg_w(gspca_dev->dev, 0x00, 0x8168, 0x22);
+ reg_w(gspca_dev->dev, 0x00, 0x816a, 0xc0);
+ reg_w(gspca_dev->dev, 0x00, 0x816b, 0x0b);
+ reg_w(gspca_dev->dev, 0x00, 0x8169, 0x25);
+ reg_w(gspca_dev->dev, 0x00, 0x8157, 0x5b);
+ reg_w(gspca_dev->dev, 0x00, 0x8158, 0x5b);
+ reg_w(gspca_dev->dev, 0x00, 0x813f, 0x03);
+ reg_w(gspca_dev->dev, 0x00, 0x8151, 0x4a);
+ reg_w(gspca_dev->dev, 0x00, 0x8153, 0x78);
+ reg_w(gspca_dev->dev, 0x00, 0x0d01, 0x04);
/* 00 for adjust shutter */
- reg_write(gspca_dev->dev, 0x00, 0x0d02, 0x01);
- reg_write(gspca_dev->dev, 0x00, 0x8169, 0x25);
- reg_write(gspca_dev->dev, 0x00, 0x0d01, 0x02);
+ reg_w(gspca_dev->dev, 0x00, 0x0d02, 0x01);
+ reg_w(gspca_dev->dev, 0x00, 0x8169, 0x25);
+ reg_w(gspca_dev->dev, 0x00, 0x0d01, 0x02);
}
static void spca500_setmode(struct gspca_dev *gspca_dev,
@@ -528,14 +542,14 @@ static void spca500_setmode(struct gspca_dev *gspca_dev,
int mode;
/* set x multiplier */
- reg_write(gspca_dev->dev, 0, 0x8001, xmult);
+ reg_w(gspca_dev->dev, 0, 0x8001, xmult);
/* set y multiplier */
- reg_write(gspca_dev->dev, 0, 0x8002, ymult);
+ reg_w(gspca_dev->dev, 0, 0x8002, ymult);
/* use compressed mode, VGA, with mode specific subsample */
- mode = gspca_dev->cam.cam_mode[(int) gspca_dev->curr_mode].mode;
- reg_write(gspca_dev->dev, 0, 0x8003, mode << 4);
+ mode = gspca_dev->cam.cam_mode[(int) gspca_dev->curr_mode].priv;
+ reg_w(gspca_dev->dev, 0, 0x8003, mode << 4);
}
static int spca500_full_reset(struct gspca_dev *gspca_dev)
@@ -543,20 +557,20 @@ static int spca500_full_reset(struct gspca_dev *gspca_dev)
int err;
/* send the reset command */
- err = reg_write(gspca_dev->dev, 0xe0, 0x0001, 0x0000);
+ err = reg_w(gspca_dev->dev, 0xe0, 0x0001, 0x0000);
if (err < 0)
return err;
/* wait for the reset to complete */
- err = reg_readwait(gspca_dev->dev, 0x06, 0x0000, 0x0000);
+ err = reg_r_wait(gspca_dev->dev, 0x06, 0x0000, 0x0000);
if (err < 0)
return err;
- err = reg_write(gspca_dev->dev, 0xe0, 0x0000, 0x0000);
+ err = reg_w(gspca_dev->dev, 0xe0, 0x0000, 0x0000);
if (err < 0)
return err;
- err = reg_readwait(gspca_dev->dev, 0x06, 0, 0);
+ err = reg_r_wait(gspca_dev->dev, 0x06, 0, 0);
if (err < 0) {
- PDEBUG(D_ERR, "reg_readwait() failed");
+ PDEBUG(D_ERR, "reg_r_wait() failed");
return err;
}
/* all ok */
@@ -579,7 +593,7 @@ static int spca500_synch310(struct gspca_dev *gspca_dev)
}
spca500_ping310(gspca_dev);
- spca5xxRegRead(gspca_dev->dev, 0x0d00, &Data, 1);
+ reg_r(gspca_dev->dev, 0x0d00, &Data, 1);
/* need alt setting here */
PDEBUG(D_PACK, "ClickSmart310 sync alt: %d", gspca_dev->alt);
@@ -603,12 +617,12 @@ static void spca500_reinit(struct gspca_dev *gspca_dev)
/* some unknow command from Aiptek pocket dv and family300 */
- reg_write(gspca_dev->dev, 0x00, 0x0d01, 0x01);
- reg_write(gspca_dev->dev, 0x00, 0x0d03, 0x00);
- reg_write(gspca_dev->dev, 0x00, 0x0d02, 0x01);
+ reg_w(gspca_dev->dev, 0x00, 0x0d01, 0x01);
+ reg_w(gspca_dev->dev, 0x00, 0x0d03, 0x00);
+ reg_w(gspca_dev->dev, 0x00, 0x0d02, 0x01);
/* enable drop packet */
- reg_write(gspca_dev->dev, 0x00, 0x850a, 0x0001);
+ reg_w(gspca_dev->dev, 0x00, 0x850a, 0x0001);
err = spca50x_setup_qtable(gspca_dev, 0x00, 0x8800, 0x8840,
qtable_pocketdv);
@@ -616,22 +630,22 @@ static void spca500_reinit(struct gspca_dev *gspca_dev)
PDEBUG(D_ERR|D_STREAM, "spca50x_setup_qtable failed on init");
/* set qtable index */
- reg_write(gspca_dev->dev, 0x00, 0x8880, 2);
+ reg_w(gspca_dev->dev, 0x00, 0x8880, 2);
/* family cam Quicksmart stuff */
- reg_write(gspca_dev->dev, 0x00, 0x800a, 0x00);
+ reg_w(gspca_dev->dev, 0x00, 0x800a, 0x00);
/* Set agc transfer: synced inbetween frames */
- reg_write(gspca_dev->dev, 0x00, 0x820f, 0x01);
+ reg_w(gspca_dev->dev, 0x00, 0x820f, 0x01);
/* Init SDRAM - needed for SDRAM access */
- reg_write(gspca_dev->dev, 0x00, 0x870a, 0x04);
+ reg_w(gspca_dev->dev, 0x00, 0x870a, 0x04);
/*Start init sequence or stream */
- reg_write(gspca_dev->dev, 0, 0x8003, 0x00);
+ reg_w(gspca_dev->dev, 0, 0x8003, 0x00);
/* switch to video camera mode */
- reg_write(gspca_dev->dev, 0x00, 0x8000, 0x0004);
+ reg_w(gspca_dev->dev, 0x00, 0x8000, 0x0004);
msleep(2000);
- if (reg_readwait(gspca_dev->dev, 0, 0x8000, 0x44) != 0)
- spca5xxRegRead(gspca_dev->dev, 0x816b, &Data, 1);
- reg_write(gspca_dev->dev, 0x00, 0x816b, Data);
+ if (reg_r_wait(gspca_dev->dev, 0, 0x8000, 0x44) != 0)
+ reg_r(gspca_dev->dev, 0x816b, &Data, 1);
+ reg_w(gspca_dev->dev, 0x00, 0x816b, Data);
}
/* this function is called at probe time */
@@ -751,9 +765,9 @@ static int sd_config(struct gspca_dev *gspca_dev,
cam->nmodes = sizeof sif_mode / sizeof sif_mode[0];
}
sd->qindex = 5;
- sd->brightness = sd_ctrls[SD_BRIGHTNESS].qctrl.default_value;
- sd->contrast = sd_ctrls[SD_CONTRAST].qctrl.default_value;
- sd->colors = sd_ctrls[SD_COLOR].qctrl.default_value;
+ sd->brightness = BRIGHTNESS_DEF;
+ sd->contrast = CONTRAST_DEF;
+ sd->colors = COLOR_DEF;
return 0;
}
@@ -788,7 +802,7 @@ static void sd_start(struct gspca_dev *gspca_dev)
}
/* is there a sensor here ? */
- spca5xxRegRead(gspca_dev->dev, 0x8a04, &Data, 1);
+ reg_r(gspca_dev->dev, 0x8a04, &Data, 1);
PDEBUG(D_STREAM, "Spca500 Sensor Address 0x%02X", Data);
PDEBUG(D_STREAM, "Spca500 curr_mode: %d Xmult: 0x%02X, Ymult: 0x%02X",
gspca_dev->curr_mode, xmult, ymult);
@@ -799,33 +813,33 @@ static void sd_start(struct gspca_dev *gspca_dev)
spca500_setmode(gspca_dev, xmult, ymult);
/* enable drop packet */
- reg_write(gspca_dev->dev, 0x00, 0x850a, 0x0001);
- reg_write(gspca_dev->dev, 0x00, 0x8880, 3);
+ reg_w(gspca_dev->dev, 0x00, 0x850a, 0x0001);
+ reg_w(gspca_dev->dev, 0x00, 0x8880, 3);
err = spca50x_setup_qtable(gspca_dev,
0x00, 0x8800, 0x8840,
qtable_creative_pccam);
if (err < 0)
PDEBUG(D_ERR, "spca50x_setup_qtable failed");
/* Init SDRAM - needed for SDRAM access */
- reg_write(gspca_dev->dev, 0x00, 0x870a, 0x04);
+ reg_w(gspca_dev->dev, 0x00, 0x870a, 0x04);
/* switch to video camera mode */
- reg_write(gspca_dev->dev, 0x00, 0x8000, 0x0004);
+ reg_w(gspca_dev->dev, 0x00, 0x8000, 0x0004);
msleep(500);
- if (reg_readwait(gspca_dev->dev, 0, 0x8000, 0x44) != 0)
- PDEBUG(D_ERR, "reg_readwait() failed");
+ if (reg_r_wait(gspca_dev->dev, 0, 0x8000, 0x44) != 0)
+ PDEBUG(D_ERR, "reg_r_wait() failed");
- spca5xxRegRead(gspca_dev->dev, 0x816b, &Data, 1);
- reg_write(gspca_dev->dev, 0x00, 0x816b, Data);
+ reg_r(gspca_dev->dev, 0x816b, &Data, 1);
+ reg_w(gspca_dev->dev, 0x00, 0x816b, Data);
spca500_synch310(gspca_dev);
write_vector(gspca_dev, spca500_visual_defaults);
spca500_setmode(gspca_dev, xmult, ymult);
/* enable drop packet */
- reg_write(gspca_dev->dev, 0x00, 0x850a, 0x0001);
+ reg_w(gspca_dev->dev, 0x00, 0x850a, 0x0001);
PDEBUG(D_ERR, "failed to enable drop packet");
- reg_write(gspca_dev->dev, 0x00, 0x8880, 3);
+ reg_w(gspca_dev->dev, 0x00, 0x8880, 3);
err = spca50x_setup_qtable(gspca_dev,
0x00, 0x8800, 0x8840,
qtable_creative_pccam);
@@ -833,16 +847,16 @@ static void sd_start(struct gspca_dev *gspca_dev)
PDEBUG(D_ERR, "spca50x_setup_qtable failed");
/* Init SDRAM - needed for SDRAM access */
- reg_write(gspca_dev->dev, 0x00, 0x870a, 0x04);
+ reg_w(gspca_dev->dev, 0x00, 0x870a, 0x04);
/* switch to video camera mode */
- reg_write(gspca_dev->dev, 0x00, 0x8000, 0x0004);
+ reg_w(gspca_dev->dev, 0x00, 0x8000, 0x0004);
- if (reg_readwait(gspca_dev->dev, 0, 0x8000, 0x44) != 0)
- PDEBUG(D_ERR, "reg_readwait() failed");
+ if (reg_r_wait(gspca_dev->dev, 0, 0x8000, 0x44) != 0)
+ PDEBUG(D_ERR, "reg_r_wait() failed");
- spca5xxRegRead(gspca_dev->dev, 0x816b, &Data, 1);
- reg_write(gspca_dev->dev, 0x00, 0x816b, Data);
+ reg_r(gspca_dev->dev, 0x816b, &Data, 1);
+ reg_w(gspca_dev->dev, 0x00, 0x816b, Data);
break;
case CreativePCCam300: /* Creative PC-CAM 300 640x480 CCD */
case IntelPocketPCCamera: /* FIXME: Temporary fix for
@@ -855,10 +869,10 @@ static void sd_start(struct gspca_dev *gspca_dev)
PDEBUG(D_ERR, "spca500_full_reset failed");
/* enable drop packet */
- err = reg_write(gspca_dev->dev, 0x00, 0x850a, 0x0001);
+ err = reg_w(gspca_dev->dev, 0x00, 0x850a, 0x0001);
if (err < 0)
PDEBUG(D_ERR, "failed to enable drop packet");
- reg_write(gspca_dev->dev, 0x00, 0x8880, 3);
+ reg_w(gspca_dev->dev, 0x00, 0x8880, 3);
err = spca50x_setup_qtable(gspca_dev,
0x00, 0x8800, 0x8840,
qtable_creative_pccam);
@@ -866,18 +880,18 @@ static void sd_start(struct gspca_dev *gspca_dev)
PDEBUG(D_ERR, "spca50x_setup_qtable failed");
spca500_setmode(gspca_dev, xmult, ymult);
- reg_write(gspca_dev->dev, 0x20, 0x0001, 0x0004);
+ reg_w(gspca_dev->dev, 0x20, 0x0001, 0x0004);
/* switch to video camera mode */
- reg_write(gspca_dev->dev, 0x00, 0x8000, 0x0004);
+ reg_w(gspca_dev->dev, 0x00, 0x8000, 0x0004);
- if (reg_readwait(gspca_dev->dev, 0, 0x8000, 0x44) != 0)
- PDEBUG(D_ERR, "reg_readwait() failed");
+ if (reg_r_wait(gspca_dev->dev, 0, 0x8000, 0x44) != 0)
+ PDEBUG(D_ERR, "reg_r_wait() failed");
- spca5xxRegRead(gspca_dev->dev, 0x816b, &Data, 1);
- reg_write(gspca_dev->dev, 0x00, 0x816b, Data);
+ reg_r(gspca_dev->dev, 0x816b, &Data, 1);
+ reg_w(gspca_dev->dev, 0x00, 0x816b, Data);
- /* write_vector(gspca_dev, spca500_visual_defaults); */
+/* write_vector(gspca_dev, spca500_visual_defaults); */
break;
case KodakEZ200: /* Kodak EZ200 */
@@ -886,8 +900,8 @@ static void sd_start(struct gspca_dev *gspca_dev)
if (err < 0)
PDEBUG(D_ERR, "spca500_full_reset failed");
/* enable drop packet */
- reg_write(gspca_dev->dev, 0x00, 0x850a, 0x0001);
- reg_write(gspca_dev->dev, 0x00, 0x8880, 0);
+ reg_w(gspca_dev->dev, 0x00, 0x850a, 0x0001);
+ reg_w(gspca_dev->dev, 0x00, 0x8880, 0);
err = spca50x_setup_qtable(gspca_dev,
0x00, 0x8800, 0x8840,
qtable_kodak_ez200);
@@ -895,18 +909,18 @@ static void sd_start(struct gspca_dev *gspca_dev)
PDEBUG(D_ERR, "spca50x_setup_qtable failed");
spca500_setmode(gspca_dev, xmult, ymult);
- reg_write(gspca_dev->dev, 0x20, 0x0001, 0x0004);
+ reg_w(gspca_dev->dev, 0x20, 0x0001, 0x0004);
/* switch to video camera mode */
- reg_write(gspca_dev->dev, 0x00, 0x8000, 0x0004);
+ reg_w(gspca_dev->dev, 0x00, 0x8000, 0x0004);
- if (reg_readwait(gspca_dev->dev, 0, 0x8000, 0x44) != 0)
- PDEBUG(D_ERR, "reg_readwait() failed");
+ if (reg_r_wait(gspca_dev->dev, 0, 0x8000, 0x44) != 0)
+ PDEBUG(D_ERR, "reg_r_wait() failed");
- spca5xxRegRead(gspca_dev->dev, 0x816b, &Data, 1);
- reg_write(gspca_dev->dev, 0x00, 0x816b, Data);
+ reg_r(gspca_dev->dev, 0x816b, &Data, 1);
+ reg_w(gspca_dev->dev, 0x00, 0x816b, Data);
- /* write_vector(gspca_dev, spca500_visual_defaults); */
+/* write_vector(gspca_dev, spca500_visual_defaults); */
break;
case BenqDC1016:
@@ -919,56 +933,56 @@ static void sd_start(struct gspca_dev *gspca_dev)
case ToptroIndus:
case AgfaCl20:
spca500_reinit(gspca_dev);
- reg_write(gspca_dev->dev, 0x00, 0x0d01, 0x01);
+ reg_w(gspca_dev->dev, 0x00, 0x0d01, 0x01);
/* enable drop packet */
- reg_write(gspca_dev->dev, 0x00, 0x850a, 0x0001);
+ reg_w(gspca_dev->dev, 0x00, 0x850a, 0x0001);
err = spca50x_setup_qtable(gspca_dev,
0x00, 0x8800, 0x8840, qtable_pocketdv);
if (err < 0)
PDEBUG(D_ERR, "spca50x_setup_qtable failed");
- reg_write(gspca_dev->dev, 0x00, 0x8880, 2);
+ reg_w(gspca_dev->dev, 0x00, 0x8880, 2);
/* familycam Quicksmart pocketDV stuff */
- reg_write(gspca_dev->dev, 0x00, 0x800a, 0x00);
+ reg_w(gspca_dev->dev, 0x00, 0x800a, 0x00);
/* Set agc transfer: synced inbetween frames */
- reg_write(gspca_dev->dev, 0x00, 0x820f, 0x01);
+ reg_w(gspca_dev->dev, 0x00, 0x820f, 0x01);
/* Init SDRAM - needed for SDRAM access */
- reg_write(gspca_dev->dev, 0x00, 0x870a, 0x04);
+ reg_w(gspca_dev->dev, 0x00, 0x870a, 0x04);
spca500_setmode(gspca_dev, xmult, ymult);
/* switch to video camera mode */
- reg_write(gspca_dev->dev, 0x00, 0x8000, 0x0004);
+ reg_w(gspca_dev->dev, 0x00, 0x8000, 0x0004);
- reg_readwait(gspca_dev->dev, 0, 0x8000, 0x44);
+ reg_r_wait(gspca_dev->dev, 0, 0x8000, 0x44);
- spca5xxRegRead(gspca_dev->dev, 0x816b, &Data, 1);
- reg_write(gspca_dev->dev, 0x00, 0x816b, Data);
+ reg_r(gspca_dev->dev, 0x816b, &Data, 1);
+ reg_w(gspca_dev->dev, 0x00, 0x816b, Data);
break;
case LogitechTraveler:
case LogitechClickSmart510:
- reg_write(gspca_dev->dev, 0x02, 0x00, 0x00);
+ reg_w(gspca_dev->dev, 0x02, 0x00, 0x00);
/* enable drop packet */
- reg_write(gspca_dev->dev, 0x00, 0x850a, 0x0001);
+ reg_w(gspca_dev->dev, 0x00, 0x850a, 0x0001);
err = spca50x_setup_qtable(gspca_dev,
0x00, 0x8800,
0x8840, qtable_creative_pccam);
if (err < 0)
PDEBUG(D_ERR, "spca50x_setup_qtable failed");
- reg_write(gspca_dev->dev, 0x00, 0x8880, 3);
- reg_write(gspca_dev->dev, 0x00, 0x800a, 0x00);
+ reg_w(gspca_dev->dev, 0x00, 0x8880, 3);
+ reg_w(gspca_dev->dev, 0x00, 0x800a, 0x00);
/* Init SDRAM - needed for SDRAM access */
- reg_write(gspca_dev->dev, 0x00, 0x870a, 0x04);
+ reg_w(gspca_dev->dev, 0x00, 0x870a, 0x04);
spca500_setmode(gspca_dev, xmult, ymult);
/* switch to video camera mode */
- reg_write(gspca_dev->dev, 0x00, 0x8000, 0x0004);
- reg_readwait(gspca_dev->dev, 0, 0x8000, 0x44);
+ reg_w(gspca_dev->dev, 0x00, 0x8000, 0x0004);
+ reg_r_wait(gspca_dev->dev, 0, 0x8000, 0x44);
- spca5xxRegRead(gspca_dev->dev, 0x816b, &Data, 1);
- reg_write(gspca_dev->dev, 0x00, 0x816b, Data);
+ reg_r(gspca_dev->dev, 0x816b, &Data, 1);
+ reg_w(gspca_dev->dev, 0x00, 0x816b, Data);
write_vector(gspca_dev, Clicksmart510_defaults);
break;
}
@@ -976,13 +990,13 @@ static void sd_start(struct gspca_dev *gspca_dev)
static void sd_stopN(struct gspca_dev *gspca_dev)
{
- __u8 data = 0;
+ __u8 data;
- reg_write(gspca_dev->dev, 0, 0x8003, 0x00);
+ reg_w(gspca_dev->dev, 0, 0x8003, 0x00);
/* switch to video camera mode */
- reg_write(gspca_dev->dev, 0x00, 0x8000, 0x0004);
- spca5xxRegRead(gspca_dev->dev, 0x8000, &data, 1);
+ reg_w(gspca_dev->dev, 0x00, 0x8000, 0x0004);
+ reg_r(gspca_dev->dev, 0x8000, &data, 1);
PDEBUG(D_STREAM, "stop SPCA500 done reg8000: 0x%2x", data);
}
@@ -996,13 +1010,13 @@ static void sd_close(struct gspca_dev *gspca_dev)
static void sd_pkt_scan(struct gspca_dev *gspca_dev,
struct gspca_frame *frame, /* target */
- unsigned char *data, /* isoc packet */
+ __u8 *data, /* isoc packet */
int len) /* iso packet length */
{
struct sd *sd = (struct sd *) gspca_dev;
int i;
- unsigned char *s, *d;
- static unsigned char ffd9[] = {0xff, 0xd9};
+ __u8 *s, *d;
+ static __u8 ffd9[] = {0xff, 0xd9};
/* frames are jpeg 4.1.1 without 0xff escape */
if (data[0] == 0xff) {
@@ -1014,9 +1028,7 @@ static void sd_pkt_scan(struct gspca_dev *gspca_dev,
ffd9, 2);
/* put the JPEG header in the new frame */
- jpeg_put_header(gspca_dev, frame,
- ((struct sd *) gspca_dev)->qindex,
- 0x22);
+ jpeg_put_header(gspca_dev, frame, sd->qindex, 0x22);
data += SPCA500_OFFSET_DATA;
len -= SPCA500_OFFSET_DATA;
@@ -1048,43 +1060,52 @@ static void setbrightness(struct gspca_dev *gspca_dev)
{
struct sd *sd = (struct sd *) gspca_dev;
- reg_write(gspca_dev->dev, 0x00, 0x8167,
+ reg_w(gspca_dev->dev, 0x00, 0x8167,
(__u8) (sd->brightness - 128));
}
static void getbrightness(struct gspca_dev *gspca_dev)
{
struct sd *sd = (struct sd *) gspca_dev;
+ int ret;
- sd->brightness = reg_read(gspca_dev->dev, 0x00, 0x8167, 1) + 128;
+ ret = reg_r_12(gspca_dev->dev, 0x00, 0x8167, 1);
+ if (ret >= 0)
+ sd->brightness = ret + 128;
}
static void setcontrast(struct gspca_dev *gspca_dev)
{
struct sd *sd = (struct sd *) gspca_dev;
- reg_write(gspca_dev->dev, 0x00, 0x8168, sd->contrast >> 2);
+ reg_w(gspca_dev->dev, 0x00, 0x8168, sd->contrast);
}
static void getcontrast(struct gspca_dev *gspca_dev)
{
struct sd *sd = (struct sd *) gspca_dev;
+ int ret;
- sd->contrast = reg_read(gspca_dev->dev, 0x0, 0x8168, 1) << 2;
+ ret = reg_r_12(gspca_dev->dev, 0x0, 0x8168, 1);
+ if (ret >= 0)
+ sd->contrast = ret;
}
static void setcolors(struct gspca_dev *gspca_dev)
{
struct sd *sd = (struct sd *) gspca_dev;
- reg_write(gspca_dev->dev, 0x00, 0x8169, sd->colors >> 2);
+ reg_w(gspca_dev->dev, 0x00, 0x8169, sd->colors);
}
static void getcolors(struct gspca_dev *gspca_dev)
{
struct sd *sd = (struct sd *) gspca_dev;
+ int ret;
- sd->colors = reg_read(gspca_dev->dev, 0x0, 0x8169, 1) << 2;
+ ret = reg_r_12(gspca_dev->dev, 0x0, 0x8169, 1);
+ if (ret >= 0)
+ sd->colors = ret;
}
static int sd_setbrightness(struct gspca_dev *gspca_dev, __s32 val)
@@ -1148,7 +1169,7 @@ static int sd_getcolors(struct gspca_dev *gspca_dev, __s32 *val)
static struct sd_desc sd_desc = {
.name = MODULE_NAME,
.ctrls = sd_ctrls,
- .nctrls = sizeof sd_ctrls / sizeof sd_ctrls[0],
+ .nctrls = ARRAY_SIZE(sd_ctrls),
.config = sd_config,
.open = sd_open,
.start = sd_start,
@@ -1160,7 +1181,7 @@ static struct sd_desc sd_desc = {
/* -- module initialisation -- */
#define DVNM(name) .driver_info = (kernel_ulong_t) name
-static __devinitdata struct usb_device_id device_table[] = {
+static const __devinitdata struct usb_device_id device_table[] = {
{USB_DEVICE(0x040a, 0x0300), DVNM("Kodak EZ200")},
{USB_DEVICE(0x041e, 0x400a), DVNM("Creative PC-CAM 300")},
{USB_DEVICE(0x046d, 0x0890), DVNM("Logitech QuickCam traveler")},
diff --git a/linux/drivers/media/video/gspca/spca501.c b/linux/drivers/media/video/gspca/spca501.c
index f4f5254c5..762e8ae97 100644
--- a/linux/drivers/media/video/gspca/spca501.c
+++ b/linux/drivers/media/video/gspca/spca501.c
@@ -23,8 +23,8 @@
#include "gspca.h"
-#define DRIVER_VERSION_NUMBER KERNEL_VERSION(2, 1, 0)
-static const char version[] = "2.1.0";
+#define DRIVER_VERSION_NUMBER KERNEL_VERSION(2, 1, 5)
+static const char version[] = "2.1.5";
MODULE_AUTHOR("Michel Xhaard <mxhaard@users.sourceforge.net>");
MODULE_DESCRIPTION("GSPCA/SPCA501 USB Camera Driver");
@@ -101,10 +101,22 @@ static struct ctrl sd_ctrls[] = {
},
};
-static struct cam_mode vga_mode[] = {
- {V4L2_PIX_FMT_SPCA501, 160, 120, 2},
- {V4L2_PIX_FMT_SPCA501, 320, 240, 1},
- {V4L2_PIX_FMT_SPCA501, 640, 480, 0},
+static struct v4l2_pix_format vga_mode[] = {
+ {160, 120, V4L2_PIX_FMT_SPCA501, V4L2_FIELD_NONE,
+ .bytesperline = 160,
+ .sizeimage = 160 * 120 * 3 / 8,
+ .colorspace = V4L2_COLORSPACE_SRGB,
+ .priv = 2},
+ {320, 240, V4L2_PIX_FMT_SPCA501, V4L2_FIELD_NONE,
+ .bytesperline = 320,
+ .sizeimage = 320 * 240 * 3 / 8,
+ .colorspace = V4L2_COLORSPACE_SRGB,
+ .priv = 1},
+ {640, 480, V4L2_PIX_FMT_SPCA501, V4L2_FIELD_NONE,
+ .bytesperline = 640,
+ .sizeimage = 640 * 480 * 3 / 8,
+ .colorspace = V4L2_COLORSPACE_SRGB,
+ .priv = 0},
};
#define SPCA50X_REG_USB 0x2 /* spca505 501 */
@@ -151,7 +163,7 @@ static struct cam_mode vga_mode[] = {
#define SPCA501_A33 0x10
/* Data for video camera initialization before capturing */
-static __u16 spca501_open_data[][3] = {
+static const __u16 spca501_open_data[][3] = {
/* bmRequest,value,index */
{0x2, 0x50, 0x00}, /* C/S enable soft reset */
@@ -257,7 +269,7 @@ static __u16 spca501_open_data[][3] = {
*/
/* Data for chip initialization (set default values) */
-static __u16 spca501_init_data[][3] = {
+static const __u16 spca501_init_data[][3] = {
/* Set all the values to powerup defaults */
/* bmRequest,value,index */
{0x0, 0xAA, 0x00},
@@ -544,7 +556,7 @@ static __u16 spca501_init_data[][3] = {
* Capture and decoding by Colin Peart.
* This is is for the 3com HomeConnect Lite which is spca501a based.
*/
-static __u16 spca501_3com_open_data[][3] = {
+static const __u16 spca501_3com_open_data[][3] = {
/* bmRequest,value,index */
{0x2, 0x0050, 0x0000}, /* C/S Enable TG soft reset, timing mode=010 */
{0x2, 0x0043, 0x0000}, /* C/S Disable TG soft reset, timing mode=010 */
@@ -639,7 +651,7 @@ static __u16 spca501_3com_open_data[][3] = {
* 2) Understand why some values seem to appear more than once
* 3) Write a small comment for each line of the following arrays.
*/
-static __u16 spca501c_arowana_open_data[][3] = {
+static const __u16 spca501c_arowana_open_data[][3] = {
/* bmRequest,value,index */
{0x02, 0x0007, 0x0005},
{0x02, 0xa048, 0x0000},
@@ -661,7 +673,7 @@ static __u16 spca501c_arowana_open_data[][3] = {
{}
};
-static __u16 spca501c_arowana_init_data[][3] = {
+static const __u16 spca501c_arowana_init_data[][3] = {
/* bmRequest,value,index */
{0x02, 0x0007, 0x0005},
{0x02, 0xa048, 0x0000},
@@ -1595,7 +1607,7 @@ static __u16 spca501c_arowana_init_data[][3] = {
/* Unknow camera from Ori Usbid 0x0000:0x0000 */
/* Based on snoops from Ori Cohen */
-static __u16 spca501c_mysterious_open_data[][3] = {
+static const __u16 spca501c_mysterious_open_data[][3] = {
{0x02, 0x000f, 0x0005},
{0x02, 0xa048, 0x0000},
{0x05, 0x0022, 0x0004},
@@ -1646,7 +1658,7 @@ static __u16 spca501c_mysterious_open_data[][3] = {
};
/* Based on snoops from Ori Cohen */
-static __u16 spca501c_mysterious_init_data[][3] = {
+static const __u16 spca501c_mysterious_init_data[][3] = {
/* Part 3 */
/* TG registers */
/* {0x00, 0x0000, 0x0000}, */
@@ -1839,7 +1851,7 @@ static int reg_read(struct usb_device *dev,
}
static int write_vector(struct gspca_dev *gspca_dev,
- __u16 data[][3])
+ const __u16 data[][3])
{
struct usb_device *dev = gspca_dev->dev;
int ret, i = 0;
@@ -1893,7 +1905,7 @@ static void getcontrast(struct gspca_dev *gspca_dev)
0x00,
0x00,
1) & 0xff) << 8;
- spca50x->contrast = byte | (reg_read(gspca_dev->dev,
+ ss->contrast = byte | (reg_read(gspca_dev->dev,
0x00,
0x01,
1) & 0xff);
@@ -2012,7 +2024,6 @@ static int sd_open(struct gspca_dev *gspca_dev)
{
struct sd *sd = (struct sd *) gspca_dev;
- PDEBUG(D_STREAM, "SPCA501 init");
switch (sd->subtype) {
case ThreeComHomeConnectLite:
/* Special handling for 3com data */
@@ -2041,7 +2052,7 @@ static void sd_start(struct gspca_dev *gspca_dev)
int mode;
/* memorize the wanted pixel format */
- mode = gspca_dev->cam.cam_mode[(int) gspca_dev->curr_mode].mode;
+ mode = gspca_dev->cam.cam_mode[(int) gspca_dev->curr_mode].priv;
/* Enable ISO packet machine CTRL reg=2,
* index=1 bitmask=0x2 (bit ordinal 1) */
@@ -2061,7 +2072,7 @@ static void sd_start(struct gspca_dev *gspca_dev)
reg_write(dev, SPCA501_REG_CTLRL, 0x01, 0x02);
/* HDG atleast the Intel CreateAndShare needs to have one of its
- * brightness / contrast / color set otherwise it assumes wath seems
+ * brightness / contrast / color set otherwise it assumes what seems
* max contrast. Note that strange enough setting any of these is
* enough to fix the max contrast problem, to be sure we set all 3 */
setbrightness(gspca_dev);
@@ -2170,7 +2181,7 @@ static int sd_getcolors(struct gspca_dev *gspca_dev, __s32 *val)
}
/* sub-driver description */
-static struct sd_desc sd_desc = {
+static const struct sd_desc sd_desc = {
.name = MODULE_NAME,
.ctrls = sd_ctrls,
.nctrls = ARRAY_SIZE(sd_ctrls),
@@ -2185,7 +2196,7 @@ static struct sd_desc sd_desc = {
/* -- module initialisation -- */
#define DVNM(name) .driver_info = (kernel_ulong_t) name
-static __devinitdata struct usb_device_id device_table[] = {
+static const __devinitdata struct usb_device_id device_table[] = {
{USB_DEVICE(0x040a, 0x0002), DVNM("Kodak DVC-325")},
{USB_DEVICE(0x0497, 0xc001), DVNM("Smile International")},
{USB_DEVICE(0x0506, 0x00df), DVNM("3Com HomeConnect Lite")},
diff --git a/linux/drivers/media/video/gspca/spca505.c b/linux/drivers/media/video/gspca/spca505.c
index 840785cec..cecbc4362 100644
--- a/linux/drivers/media/video/gspca/spca505.c
+++ b/linux/drivers/media/video/gspca/spca505.c
@@ -23,8 +23,8 @@
#include "gspca.h"
-#define DRIVER_VERSION_NUMBER KERNEL_VERSION(2, 1, 0)
-static const char version[] = "2.1.0";
+#define DRIVER_VERSION_NUMBER KERNEL_VERSION(2, 1, 5)
+static const char version[] = "2.1.5";
MODULE_AUTHOR("Michel Xhaard <mxhaard@users.sourceforge.net>");
MODULE_DESCRIPTION("GSPCA/SPCA505 USB Camera Driver");
@@ -66,12 +66,32 @@ static struct ctrl sd_ctrls[] = {
},
};
-static struct cam_mode vga_mode[] = {
- {V4L2_PIX_FMT_YUYV, 160, 120, 5},
- {V4L2_PIX_FMT_YUYV, 176, 144, 4},
- {V4L2_PIX_FMT_YUYV, 320, 240, 2},
- {V4L2_PIX_FMT_YUYV, 352, 288, 1},
- {V4L2_PIX_FMT_YUYV, 640, 480, 0},
+static struct v4l2_pix_format vga_mode[] = {
+ {160, 120, V4L2_PIX_FMT_YUYV, V4L2_FIELD_NONE,
+ .bytesperline = 160 * 2,
+ .sizeimage = 160 * 120 * 2,
+ .colorspace = V4L2_COLORSPACE_SRGB,
+ .priv = 5},
+ {176, 144, V4L2_PIX_FMT_YUYV, V4L2_FIELD_NONE,
+ .bytesperline = 176 * 2,
+ .sizeimage = 176 * 144 * 2,
+ .colorspace = V4L2_COLORSPACE_SRGB,
+ .priv = 4},
+ {320, 240, V4L2_PIX_FMT_YUYV, V4L2_FIELD_NONE,
+ .bytesperline = 320 * 2,
+ .sizeimage = 320 * 240 * 2,
+ .colorspace = V4L2_COLORSPACE_SRGB,
+ .priv = 2},
+ {352, 288, V4L2_PIX_FMT_YUYV, V4L2_FIELD_NONE,
+ .bytesperline = 352 * 2,
+ .sizeimage = 352 * 288 * 2,
+ .colorspace = V4L2_COLORSPACE_SRGB,
+ .priv = 1},
+ {640, 480, V4L2_PIX_FMT_YUYV, V4L2_FIELD_NONE,
+ .bytesperline = 640 * 2,
+ .sizeimage = 640 * 480 * 2,
+ .colorspace = V4L2_COLORSPACE_SRGB,
+ .priv = 0},
};
#define SPCA50X_OFFSET_DATA 10
@@ -91,7 +111,7 @@ static struct cam_mode vga_mode[] = {
/*
* Data to initialize a SPCA505. Common to the CCD and external modes
*/
-static __u16 spca505_init_data[][3] = {
+static const __u16 spca505_init_data[][3] = {
/* line bmRequest,value,index */
/* 1819 */
{SPCA50X_REG_GLOBAL, SPCA50X_GMISC3_SAA7113RST, SPCA50X_GLOBAL_MISC3},
@@ -130,7 +150,7 @@ static __u16 spca505_init_data[][3] = {
/*
* Data to initialize the camera using the internal CCD
*/
-static __u16 spca505_open_data_ccd[][3] = {
+static const __u16 spca505_open_data_ccd[][3] = {
/* line bmRequest,value,index */
/* Internal CCD data set */
/* 1891 */ {0x3, 0x04, 0x01},
@@ -312,7 +332,7 @@ static __u16 spca505_open_data_ccd[][3] = {
/*
* Data to initialize the camera in external video mode
*/
-static __u16 spca505_open_data_ext[][3] = {
+static const __u16 spca505_open_data_ext[][3] = {
/* line bmRequest,value,index */
/* External video input dataset */
/* 0808 */ {0x3, 0x04, 0x01},
@@ -350,7 +370,7 @@ static __u16 spca505_open_data_ext[][3] = {
/*
* Additional data needed to initialze the camera in external mode
*/
-static __u16 spca505_open_data2[][3] = {
+static const __u16 spca505_open_data2[][3] = {
/* line bmRequest,value,index */
/* 1384 */ {0x3, 0x68, 0x03},
/* 1385 */ {0x3, 0x10, 0x01},
@@ -388,7 +408,7 @@ static __u16 spca505_open_data2[][3] = {
/*
* Data to initialize a SPCA505. Common to the CCD and external modes
*/
-static __u16 spca505b_init_data[][3] = {
+static const __u16 spca505b_init_data[][3] = {
/* start */
{0x02, 0x00, 0x00}, /* init */
{0x02, 0x00, 0x01},
@@ -452,7 +472,7 @@ static __u16 spca505b_init_data[][3] = {
/*
* Data to initialize the camera using the internal CCD
*/
-static __u16 spca505b_open_data_ccd[][3] = {
+static const __u16 spca505b_open_data_ccd[][3] = {
/* {0x02,0x00,0x00}, */
{0x03, 0x04, 0x01}, /* rst */
@@ -648,7 +668,7 @@ static int reg_read(struct usb_device *dev,
__u16 length) /* wLength (1 or 2 only) */
{
int ret;
- unsigned char buf[4];
+ __u8 buf[4];
buf[1] = 0;
ret = usb_control_msg(dev,
@@ -668,7 +688,7 @@ static int reg_read(struct usb_device *dev,
}
static int write_vector(struct gspca_dev *gspca_dev,
- __u16 data[][3])
+ const __u16 data[][3])
{
struct usb_device *dev = gspca_dev->dev;
int ret, i = 0;
@@ -777,7 +797,7 @@ static void sd_start(struct gspca_dev *gspca_dev)
* only once after loading module */
/* stopping usb registers Tomasz change */
reg_write(dev, 0x02, 0x0, 0x0);
- switch (gspca_dev->cam.cam_mode[(int) gspca_dev->curr_mode].mode) {
+ switch (gspca_dev->cam.cam_mode[(int) gspca_dev->curr_mode].priv) {
case 0:
reg_write(dev, 0x04, 0x00, 0x00);
reg_write(dev, 0x04, 0x06, 0x10);
@@ -870,7 +890,7 @@ static void yyuv_decode(unsigned char *out,
static void sd_pkt_scan(struct gspca_dev *gspca_dev,
struct gspca_frame *frame, /* target */
- unsigned char *data, /* isoc packet */
+ __u8 *data, /* isoc packet */
int len) /* iso packet length */
{
struct sd *sd = (struct sd *) gspca_dev;
@@ -947,7 +967,7 @@ static int sd_getbrightness(struct gspca_dev *gspca_dev, __s32 *val)
}
/* sub-driver description */
-static struct sd_desc sd_desc = {
+static const struct sd_desc sd_desc = {
.name = MODULE_NAME,
.ctrls = sd_ctrls,
.nctrls = ARRAY_SIZE(sd_ctrls),
@@ -962,7 +982,7 @@ static struct sd_desc sd_desc = {
/* -- module initialisation -- */
#define DVNM(name) .driver_info = (kernel_ulong_t) name
-static __devinitdata struct usb_device_id device_table[] = {
+static const __devinitdata struct usb_device_id device_table[] = {
{USB_DEVICE(0x041e, 0x401d), DVNM("Creative Webcam NX ULTRA")},
{USB_DEVICE(0x0733, 0x0430), DVNM("Intel PC Camera Pro")},
{}
diff --git a/linux/drivers/media/video/gspca/spca506.c b/linux/drivers/media/video/gspca/spca506.c
index 614fb3ad7..2d249b00b 100644
--- a/linux/drivers/media/video/gspca/spca506.c
+++ b/linux/drivers/media/video/gspca/spca506.c
@@ -25,8 +25,8 @@
#include "gspca.h"
-#define DRIVER_VERSION_NUMBER KERNEL_VERSION(2, 1, 0)
-static const char version[] = "2.1.0";
+#define DRIVER_VERSION_NUMBER KERNEL_VERSION(2, 1, 5)
+static const char version[] = "2.1.5";
MODULE_AUTHOR("Michel Xhaard <mxhaard@users.sourceforge.net>");
MODULE_DESCRIPTION("GSPCA/SPCA506 USB Camera Driver");
@@ -34,11 +34,11 @@ MODULE_LICENSE("GPL");
/* specific webcam descriptor */
struct sd {
- struct gspca_dev gspca_dev; /* !! must be the first item */
+ struct gspca_dev gspca_dev; /* !! must be the first item */
int buflen;
- unsigned char tmpbuf[640 * 480 * 3]; /* YYUV per line */
- unsigned char tmpbuf2[640 * 480 * 2]; /* YUYV */
+ __u8 tmpbuf[640 * 480 * 3]; /* YYUV per line */
+ __u8 tmpbuf2[640 * 480 * 2]; /* YUYV */
unsigned char brightness;
unsigned char contrast;
@@ -117,12 +117,32 @@ static struct ctrl sd_ctrls[] = {
},
};
-static struct cam_mode vga_mode[] = {
- {V4L2_PIX_FMT_YUYV, 160, 120, 5},
- {V4L2_PIX_FMT_YUYV, 176, 144, 4},
- {V4L2_PIX_FMT_YUYV, 320, 240, 2},
- {V4L2_PIX_FMT_YUYV, 352, 288, 1},
- {V4L2_PIX_FMT_YUYV, 640, 480, 0},
+static struct v4l2_pix_format vga_mode[] = {
+ {160, 120, V4L2_PIX_FMT_YUYV, V4L2_FIELD_NONE,
+ .bytesperline = 160 * 2,
+ .sizeimage = 160 * 120 * 2,
+ .colorspace = V4L2_COLORSPACE_SRGB,
+ .priv = 5},
+ {176, 144, V4L2_PIX_FMT_YUYV, V4L2_FIELD_NONE,
+ .bytesperline = 176 * 2,
+ .sizeimage = 176 * 144 * 2,
+ .colorspace = V4L2_COLORSPACE_SRGB,
+ .priv = 4},
+ {320, 240, V4L2_PIX_FMT_YUYV, V4L2_FIELD_NONE,
+ .bytesperline = 320 * 2,
+ .sizeimage = 320 * 240 * 2,
+ .colorspace = V4L2_COLORSPACE_SRGB,
+ .priv = 2},
+ {352, 288, V4L2_PIX_FMT_YUYV, V4L2_FIELD_NONE,
+ .bytesperline = 352 * 2,
+ .sizeimage = 352 * 288 * 2,
+ .colorspace = V4L2_COLORSPACE_SRGB,
+ .priv = 1},
+ {640, 480, V4L2_PIX_FMT_YUYV, V4L2_FIELD_NONE,
+ .bytesperline = 640 * 2,
+ .sizeimage = 640 * 480 * 2,
+ .colorspace = V4L2_COLORSPACE_SRGB,
+ .priv = 0},
};
#define SPCA50X_OFFSET_DATA 10
@@ -169,7 +189,7 @@ static void spca506_WriteI2c(struct gspca_dev *gspca_dev, __u16 valeur,
__u16 reg)
{
int retry = 60;
- unsigned char Data[2];
+ __u8 Data[2];
reg_w(gspca_dev->dev, 0x07, reg, 0x0001);
reg_w(gspca_dev->dev, 0x07, valeur, 0x0000);
@@ -183,8 +203,8 @@ static void spca506_WriteI2c(struct gspca_dev *gspca_dev, __u16 valeur,
static int spca506_ReadI2c(struct gspca_dev *gspca_dev, __u16 reg)
{
int retry = 60;
- unsigned char Data[2];
- unsigned char value;
+ __u8 Data[2];
+ __u8 value;
reg_w(gspca_dev->dev, 0x07, SAA7113_I2C_BASE_WRITE, 0x0004);
reg_w(gspca_dev->dev, 0x07, reg, 0x0001);
@@ -513,7 +533,7 @@ static void sd_start(struct gspca_dev *gspca_dev)
reg_w(dev, 0x05, 0x00, 0x0004);
reg_w(dev, 0x03, 0x10, 0x0001);
reg_w(dev, 0x03, 0x78, 0x0000);
- switch (gspca_dev->cam.cam_mode[(int) gspca_dev->curr_mode].mode) {
+ switch (gspca_dev->cam.cam_mode[(int) gspca_dev->curr_mode].priv) {
case 0:
spca506_Setsize(gspca_dev, 0, 0x10, 0x10);
break;
@@ -593,7 +613,7 @@ static void yyuv_decode(unsigned char *out,
static void sd_pkt_scan(struct gspca_dev *gspca_dev,
struct gspca_frame *frame, /* target */
- unsigned char *data, /* isoc packet */
+ __u8 *data, /* isoc packet */
int len) /* iso packet length */
{
struct sd *sd = (struct sd *) gspca_dev;
diff --git a/linux/drivers/media/video/gspca/spca508.c b/linux/drivers/media/video/gspca/spca508.c
index 0b8190ef6..a70d51117 100644
--- a/linux/drivers/media/video/gspca/spca508.c
+++ b/linux/drivers/media/video/gspca/spca508.c
@@ -22,8 +22,8 @@
#include "gspca.h"
-#define DRIVER_VERSION_NUMBER KERNEL_VERSION(2, 1, 0)
-static const char version[] = "2.1.0";
+#define DRIVER_VERSION_NUMBER KERNEL_VERSION(2, 1, 5)
+static const char version[] = "2.1.5";
MODULE_AUTHOR("Michel Xhaard <mxhaard@users.sourceforge.net>");
MODULE_DESCRIPTION("GSPCA/SPCA508 USB Camera Driver");
@@ -53,27 +53,43 @@ static int sd_setbrightness(struct gspca_dev *gspca_dev, __s32 val);
static int sd_getbrightness(struct gspca_dev *gspca_dev, __s32 *val);
static struct ctrl sd_ctrls[] = {
-#define SD_BRIGHTNESS 0
{
{
.id = V4L2_CID_BRIGHTNESS,
.type = V4L2_CTRL_TYPE_INTEGER,
.name = "Brightness",
.minimum = 0,
- .maximum = 0xff,
+ .maximum = 255,
.step = 1,
- .default_value = 0x80,
+#define BRIGHTNESS_DEF 128
+ .default_value = BRIGHTNESS_DEF,
},
.set = sd_setbrightness,
.get = sd_getbrightness,
},
};
-static struct cam_mode sif_mode[] = {
- {V4L2_PIX_FMT_YUYV, 160, 120, 3},
- {V4L2_PIX_FMT_YUYV, 176, 144, 2},
- {V4L2_PIX_FMT_YUYV, 320, 240, 1},
- {V4L2_PIX_FMT_YUYV, 352, 288, 0},
+static struct v4l2_pix_format sif_mode[] = {
+ {160, 120, V4L2_PIX_FMT_YUYV, V4L2_FIELD_NONE,
+ .bytesperline = 160 * 2,
+ .sizeimage = 160 * 120 * 2,
+ .colorspace = V4L2_COLORSPACE_SRGB,
+ .priv = 3},
+ {176, 144, V4L2_PIX_FMT_YUYV, V4L2_FIELD_NONE,
+ .bytesperline = 176 * 2,
+ .sizeimage = 176 * 144 * 2,
+ .colorspace = V4L2_COLORSPACE_SRGB,
+ .priv = 2},
+ {320, 240, V4L2_PIX_FMT_YUYV, V4L2_FIELD_NONE,
+ .bytesperline = 320 * 2,
+ .sizeimage = 320 * 240 * 2,
+ .colorspace = V4L2_COLORSPACE_SRGB,
+ .priv = 1},
+ {352, 288, V4L2_PIX_FMT_YUYV, V4L2_FIELD_NONE,
+ .bytesperline = 352 * 2,
+ .sizeimage = 352 * 288 * 2,
+ .colorspace = V4L2_COLORSPACE_SRGB,
+ .priv = 0},
};
/* Frame packet header offsets for the spca508 */
@@ -92,7 +108,7 @@ static struct cam_mode sif_mode[] = {
* Initialization data: this is the first set-up data written to the
* device (before the open data).
*/
-static __u16 spca508_init_data[][3] =
+static const __u16 spca508_init_data[][3] =
#define IGN(x) /* nothing */
{
/* line URB value, index */
@@ -604,23 +620,23 @@ static __u16 spca508_init_data[][3] =
/* Video drop enable, ISO streaming disable */
/* 53252 2165 */
/* UNKNOWN DIRECTION (URB_FUNCTION_SELECT_INTERFACE: (ALT=0) ) */
- {0, 0}
+ {}
};
#if 0
/*
* Data to initialize the camera using the internal CCD
*/
-static __u16 spca508_open_data[][3] = {
+static const __u16 spca508_open_data[][3] = {
/* line bmRequest,value,index */
- {0, 0}
+ {}
};
#endif
/*
* Initialization data for Intel EasyPC Camera CS110
*/
-static __u16 spca508cs110_init_data[][3] = {
+static const __u16 spca508cs110_init_data[][3] = {
{0x0000, 0x870b}, /* Reset CTL3 */
{0x0003, 0x8111}, /* Soft Reset compression, memory, TG & CDSP */
{0x0000, 0x8111}, /* Normal operation on reset */
@@ -704,7 +720,7 @@ static __u16 spca508cs110_init_data[][3] = {
{}
};
-static __u16 spca508_sightcam_init_data[][3] = {
+static const __u16 spca508_sightcam_init_data[][3] = {
/* This line seems to setup the frame/canvas */
/*368 */ {0x000f, 0x8402},
@@ -784,11 +800,10 @@ static __u16 spca508_sightcam_init_data[][3] = {
/*542 */ {0x0040, 0x8652},
/*543 */ {0x004c, 0x8653},
/*544 */ {0x0040, 0x8654},
-
- {0, 0}
+ {}
};
-static __u16 spca508_sightcam2_init_data[][3] = {
+static const __u16 spca508_sightcam2_init_data[][3] = {
#if 1
/* 35 */ {0x0020, 0x8112},
@@ -1137,7 +1152,7 @@ static __u16 spca508_sightcam2_init_data[][3] = {
/*
* Initialization data for Creative Webcam Vista
*/
-static __u16 spca508_vista_init_data[][3] = {
+static const __u16 spca508_vista_init_data[][3] = {
{0x0008, 0x8200}, /* Clear register */
{0x0000, 0x870b}, /* Reset CTL3 */
{0x0020, 0x8112}, /* Video Drop packet enable */
@@ -1479,7 +1494,7 @@ static int reg_read(struct usb_device *dev,
}
static int write_vector(struct gspca_dev *gspca_dev,
- __u16 data[][3])
+ const __u16 data[][3])
{
struct usb_device *dev = gspca_dev->dev;
int ret, i = 0;
@@ -1507,6 +1522,13 @@ static int sd_config(struct gspca_dev *gspca_dev,
vendor = id->idVendor;
product = id->idProduct;
switch (vendor) {
+ case 0x0130: /* Clone webcam */
+/* switch (product) { */
+/* case 0x0130: */
+ sd->subtype = HamaUSBSightcam; /* same as Hama 0010 */
+/* break; */
+/* } */
+ break;
case 0x041e: /* Creative cameras */
/* switch (product) { */
/* case 0x4018: */
@@ -1547,30 +1569,27 @@ static int sd_config(struct gspca_dev *gspca_dev,
break;
}
- /* Read from global register the USB product and vendor IDs, just to */
- /* prove that we can communicate with the device. This works, which */
- /* confirms at we are communicating properly and that the device */
- /* is a 508. */
+ /* Read from global register the USB product and vendor IDs, just to
+ * prove that we can communicate with the device. This works, which
+ * confirms at we are communicating properly and that the device
+ * is a 508. */
data1 = reg_read(dev, 0x8104);
data2 = reg_read(dev, 0x8105);
- PDEBUG(D_PROBE,
- "Read from GLOBAL: USB Vendor ID 0x%02x%02x", data2, data1);
+ PDEBUG(D_PROBE, "Webcam Vendor ID: 0x%02x%02x", data2, data1);
data1 = reg_read(dev, 0x8106);
data2 = reg_read(dev, 0x8107);
- PDEBUG(D_PROBE,
- "Read from GLOBAL: USB Product ID 0x%02x%02x", data2, data1);
+ PDEBUG(D_PROBE, "Webcam Product ID: 0x%02x%02x", data2, data1);
data1 = reg_read(dev, 0x8621);
- PDEBUG(D_PROBE,
- "Read from GLOBAL: Window 1 average luminance %d", data1);
+ PDEBUG(D_PROBE, "Window 1 average luminance: %d", data1);
cam = &gspca_dev->cam;
cam->dev_name = (char *) id->driver_info;
cam->epaddr = 0x01;
cam->cam_mode = sif_mode;
- cam->nmodes = sizeof sif_mode / sizeof sif_mode[0];
- sd->brightness = sd_ctrls[SD_BRIGHTNESS].qctrl.default_value;
+ cam->nmodes = ARRAY_SIZE(sif_mode);
+ sd->brightness = BRIGHTNESS_DEF;
switch (sd->subtype) {
case ViewQuestVQ110:
@@ -1610,7 +1629,7 @@ static void sd_start(struct gspca_dev *gspca_dev)
{
int mode;
- mode = gspca_dev->cam.cam_mode[(int) gspca_dev->curr_mode].mode;
+ mode = gspca_dev->cam.cam_mode[(int) gspca_dev->curr_mode].priv;
reg_write(gspca_dev->dev, 0x8500, mode);
switch (mode) {
case 0:
@@ -1675,7 +1694,7 @@ static void yuvy_decode(unsigned char *out,
static void sd_pkt_scan(struct gspca_dev *gspca_dev,
struct gspca_frame *frame, /* target */
- unsigned char *data, /* isoc packet */
+ __u8 *data, /* isoc packet */
int len) /* iso packet length */
{
struct sd *sd = (struct sd *) gspca_dev;
@@ -1719,7 +1738,7 @@ static void setbrightness(struct gspca_dev *gspca_dev)
struct sd *sd = (struct sd *) gspca_dev;
__u8 brightness = sd->brightness;
-/* MX seem contrast */
+ /* MX seem contrast */
reg_write(gspca_dev->dev, 0x8651, brightness);
reg_write(gspca_dev->dev, 0x8652, brightness);
reg_write(gspca_dev->dev, 0x8653, brightness);
@@ -1753,7 +1772,7 @@ static int sd_getbrightness(struct gspca_dev *gspca_dev, __s32 *val)
}
/* sub-driver description */
-static struct sd_desc sd_desc = {
+static const struct sd_desc sd_desc = {
.name = MODULE_NAME,
.ctrls = sd_ctrls,
.nctrls = ARRAY_SIZE(sd_ctrls),
@@ -1768,7 +1787,8 @@ static struct sd_desc sd_desc = {
/* -- module initialisation -- */
#define DVNM(name) .driver_info = (kernel_ulong_t) name
-static __devinitdata struct usb_device_id device_table[] = {
+static const __devinitdata struct usb_device_id device_table[] = {
+ {USB_DEVICE(0x0130, 0x0130), DVNM("Clone Digital Webcam 11043")},
{USB_DEVICE(0x041e, 0x4018), DVNM("Creative Webcam Vista (PD1100)")},
{USB_DEVICE(0x0461, 0x0815), DVNM("Micro Innovation IC200")},
{USB_DEVICE(0x0733, 0x0110), DVNM("ViewQuest VQ110")},
diff --git a/linux/drivers/media/video/gspca/spca561.c b/linux/drivers/media/video/gspca/spca561.c
index a94e62701..f0770ee59 100644
--- a/linux/drivers/media/video/gspca/spca561.c
+++ b/linux/drivers/media/video/gspca/spca561.c
@@ -24,8 +24,8 @@
#include "gspca.h"
-#define DRIVER_VERSION_NUMBER KERNEL_VERSION(2, 1, 0)
-static const char version[] = "2.1.0";
+#define DRIVER_VERSION_NUMBER KERNEL_VERSION(2, 1, 5)
+static const char version[] = "2.1.5";
MODULE_AUTHOR("Michel Xhaard <mxhaard@users.sourceforge.net>");
MODULE_DESCRIPTION("GSPCA/SPCA561 USB Camera Driver");
@@ -97,11 +97,27 @@ static struct ctrl sd_ctrls[] = {
},
};
-static struct cam_mode sif_mode[] = {
- {V4L2_PIX_FMT_SPCA561, 160, 120, 3},
- {V4L2_PIX_FMT_SPCA561, 176, 144, 2},
- {V4L2_PIX_FMT_SPCA561, 320, 240, 1},
- {V4L2_PIX_FMT_SPCA561, 352, 288, 0},
+static struct v4l2_pix_format sif_mode[] = {
+ {160, 120, V4L2_PIX_FMT_SGBRG8, V4L2_FIELD_NONE,
+ .bytesperline = 160,
+ .sizeimage = 160 * 120,
+ .colorspace = V4L2_COLORSPACE_SRGB,
+ .priv = 3},
+ {176, 144, V4L2_PIX_FMT_SGBRG8, V4L2_FIELD_NONE,
+ .bytesperline = 176,
+ .sizeimage = 176 * 144,
+ .colorspace = V4L2_COLORSPACE_SRGB,
+ .priv = 2},
+ {320, 240, V4L2_PIX_FMT_SPCA561, V4L2_FIELD_NONE,
+ .bytesperline = 320,
+ .sizeimage = 320 * 240 * 4 / 8,
+ .colorspace = V4L2_COLORSPACE_SRGB,
+ .priv = 1},
+ {352, 288, V4L2_PIX_FMT_SPCA561, V4L2_FIELD_NONE,
+ .bytesperline = 352,
+ .sizeimage = 352 * 288 * 4 / 8,
+ .colorspace = V4L2_COLORSPACE_SRGB,
+ .priv = 0},
};
/*
@@ -148,7 +164,8 @@ static void reg_w_val(struct usb_device *dev, __u16 index, __u16 value)
PDEBUG(D_ERR, "reg write: error %d", ret);
}
-static void write_vector(struct gspca_dev *gspca_dev, __u16 data[][2])
+static void write_vector(struct gspca_dev *gspca_dev,
+ const __u16 data[][2])
{
struct usb_device *dev = gspca_dev->dev;
int i;
@@ -171,13 +188,16 @@ static void reg_r(struct usb_device *dev,
}
static void reg_w_buf(struct usb_device *dev,
- __u16 index, __u8 *buffer, __u16 length)
+ __u16 index, const __u8 *buffer, __u16 len)
{
+ __u8 tmpbuf[8];
+
+ memcpy(tmpbuf, buffer, len);
usb_control_msg(dev, usb_sndctrlpipe(dev, 0),
0, /* request */
USB_DIR_OUT | USB_TYPE_VENDOR | USB_RECIP_DEVICE,
0, /* value */
- index, buffer, length, 500);
+ index, tmpbuf, len, 500);
}
static void i2c_init(struct gspca_dev *gspca_dev, __u8 mode)
@@ -227,7 +247,7 @@ static int i2c_read(struct gspca_dev *gspca_dev, __u16 reg, __u8 mode)
return ((int) value << 8) | vallsb;
}
-static __u16 spca561_init_data[][2] = {
+static const __u16 spca561_init_data[][2] = {
{0x0000, 0x8114}, /* Software GPIO output data */
{0x0001, 0x8114}, /* Software GPIO output data */
{0x0000, 0x8112}, /* Some kind of reset */
@@ -437,7 +457,7 @@ static void sensor_reset(struct gspca_dev *gspca_dev)
}
/******************** QC Express etch2 stuff ********************/
-static __u16 Pb100_1map8300[][2] = {
+static const __u16 Pb100_1map8300[][2] = {
/* reg, value */
{0x8320, 0x3304},
@@ -452,14 +472,14 @@ static __u16 Pb100_1map8300[][2] = {
{0x8302, 0x000e},
{}
};
-static __u16 Pb100_2map8300[][2] = {
+static const __u16 Pb100_2map8300[][2] = {
/* reg, value */
{0x8339, 0x0000},
{0x8307, 0x00aa},
{}
};
-static __u16 spca561_161rev12A_data1[][2] = {
+static const __u16 spca561_161rev12A_data1[][2] = {
{0x21, 0x8118},
{0x01, 0x8114},
{0x00, 0x8112},
@@ -467,7 +487,7 @@ static __u16 spca561_161rev12A_data1[][2] = {
{0x04, 0x8802}, /* windows uses 08 */
{}
};
-static __u16 spca561_161rev12A_data2[][2] = {
+static const __u16 spca561_161rev12A_data2[][2] = {
{0x21, 0x8118},
{0x10, 0x8500},
{0x07, 0x8601},
@@ -513,7 +533,7 @@ static __u16 spca561_161rev12A_data2[][2] = {
};
static void sensor_mapwrite(struct gspca_dev *gspca_dev,
- __u16 sensormap[][2])
+ const __u16 sensormap[][2])
{
int i = 0;
__u8 usbval[2];
@@ -651,7 +671,7 @@ static void sd_start(struct gspca_dev *gspca_dev)
__u8 Reg8307[] = { 0xaa, 0x00 };
int mode;
- mode = gspca_dev->cam.cam_mode[(int) gspca_dev->curr_mode].mode;
+ mode = gspca_dev->cam.cam_mode[(int) gspca_dev->curr_mode].priv;
switch (sd->chip_revision) {
case Rev072A:
switch (mode) {
@@ -808,7 +828,7 @@ static void sd_pkt_scan(struct gspca_dev *gspca_dev,
gspca_frame_add(gspca_dev, FIRST_PACKET,
frame, data, len);
} else {
- /*fixme: which format?*/
+ /* raw bayer (with a header, which we skip) */
data += 20;
len -= 20;
gspca_frame_add(gspca_dev, FIRST_PACKET,
@@ -956,7 +976,7 @@ static int sd_getautogain(struct gspca_dev *gspca_dev, __s32 *val)
}
/* sub-driver description */
-static struct sd_desc sd_desc = {
+static const struct sd_desc sd_desc = {
.name = MODULE_NAME,
.ctrls = sd_ctrls,
.nctrls = ARRAY_SIZE(sd_ctrls),
@@ -971,7 +991,7 @@ static struct sd_desc sd_desc = {
/* -- module initialisation -- */
#define DVNM(name) .driver_info = (kernel_ulong_t) name
-static __devinitdata struct usb_device_id device_table[] = {
+static const __devinitdata struct usb_device_id device_table[] = {
{USB_DEVICE(0x041e, 0x401a), DVNM("Creative Webcam Vista (PD1100)")},
{USB_DEVICE(0x041e, 0x403b), DVNM("Creative Webcam Vista (VF0010)")},
{USB_DEVICE(0x0458, 0x7004), DVNM("Genius VideoCAM Express V2")},
diff --git a/linux/drivers/media/video/gspca/stk014.c b/linux/drivers/media/video/gspca/stk014.c
index 6832fe0f3..d676cd16a 100644
--- a/linux/drivers/media/video/gspca/stk014.c
+++ b/linux/drivers/media/video/gspca/stk014.c
@@ -23,8 +23,8 @@
#include "gspca.h"
#include "jpeg.h"
-#define DRIVER_VERSION_NUMBER KERNEL_VERSION(2, 1, 0)
-static const char version[] = "2.1.0";
+#define DRIVER_VERSION_NUMBER KERNEL_VERSION(2, 1, 5)
+static const char version[] = "2.1.5";
MODULE_AUTHOR("Jean-Francois Moine <http://moinejf.free.fr>");
MODULE_DESCRIPTION("Syntek DV4000 (STK014) USB Camera Driver");
@@ -54,7 +54,6 @@ static int sd_setfreq(struct gspca_dev *gspca_dev, __s32 val);
static int sd_getfreq(struct gspca_dev *gspca_dev, __s32 *val);
static struct ctrl sd_ctrls[] = {
-#define SD_BRIGHTNESS 0
{
{
.id = V4L2_CID_BRIGHTNESS,
@@ -63,12 +62,12 @@ static struct ctrl sd_ctrls[] = {
.minimum = 0,
.maximum = 255,
.step = 1,
- .default_value = 127,
+#define BRIGHTNESS_DEF 127
+ .default_value = BRIGHTNESS_DEF,
},
.set = sd_setbrightness,
.get = sd_getbrightness,
},
-#define SD_CONTRAST 1
{
{
.id = V4L2_CID_CONTRAST,
@@ -77,26 +76,26 @@ static struct ctrl sd_ctrls[] = {
.minimum = 0,
.maximum = 255,
.step = 1,
- .default_value = 127,
+#define CONTRAST_DEF 127
+ .default_value = CONTRAST_DEF,
},
.set = sd_setcontrast,
.get = sd_getcontrast,
},
-#define SD_COLOR 2
{
{
.id = V4L2_CID_SATURATION,
.type = V4L2_CTRL_TYPE_INTEGER,
- .name = "Saturation",
+ .name = "Color",
.minimum = 0,
.maximum = 255,
.step = 1,
- .default_value = 127,
+#define COLOR_DEF 127
+ .default_value = COLOR_DEF,
},
.set = sd_setcolors,
.get = sd_getcolors,
},
-#define SD_FREQ 3
{
{
.id = V4L2_CID_POWER_LINE_FREQUENCY,
@@ -105,16 +104,25 @@ static struct ctrl sd_ctrls[] = {
.minimum = 1,
.maximum = 2, /* 0: 0, 1: 50Hz, 2:60Hz */
.step = 1,
- .default_value = 1,
+#define FREQ_DEF 1
+ .default_value = FREQ_DEF,
},
.set = sd_setfreq,
.get = sd_getfreq,
},
};
-static struct cam_mode vga_mode[] = {
- {V4L2_PIX_FMT_JPEG, 320, 240},
- {V4L2_PIX_FMT_JPEG, 640, 480},
+static struct v4l2_pix_format vga_mode[] = {
+ {320, 240, V4L2_PIX_FMT_JPEG, V4L2_FIELD_NONE,
+ .bytesperline = 320,
+ .sizeimage = 320 * 240 * 3 / 8 + 590,
+ .colorspace = V4L2_COLORSPACE_JPEG,
+ .priv = 1},
+ {640, 480, V4L2_PIX_FMT_JPEG, V4L2_FIELD_NONE,
+ .bytesperline = 640,
+ .sizeimage = 640 * 480 * 3 / 8 + 590,
+ .colorspace = V4L2_COLORSPACE_JPEG,
+ .priv = 0},
};
/* -- read a register -- */
@@ -296,10 +304,10 @@ static int sd_config(struct gspca_dev *gspca_dev,
cam->epaddr = 0x02;
gspca_dev->cam.cam_mode = vga_mode;
gspca_dev->cam.nmodes = sizeof vga_mode / sizeof vga_mode[0];
- sd->brightness = sd_ctrls[SD_BRIGHTNESS].qctrl.default_value;
- sd->contrast = sd_ctrls[SD_CONTRAST].qctrl.default_value;
- sd->colors = sd_ctrls[SD_COLOR].qctrl.default_value;
- sd->lightfreq = sd_ctrls[SD_FREQ].qctrl.default_value;
+ sd->brightness = BRIGHTNESS_DEF;
+ sd->contrast = CONTRAST_DEF;
+ sd->colors = COLOR_DEF;
+ sd->lightfreq = FREQ_DEF;
return 0;
}
@@ -408,7 +416,7 @@ static void sd_close(struct gspca_dev *gspca_dev)
static void sd_pkt_scan(struct gspca_dev *gspca_dev,
struct gspca_frame *frame, /* target */
- unsigned char *data, /* isoc packet */
+ __u8 *data, /* isoc packet */
int len) /* iso packet length */
{
static unsigned char ffd9[] = {0xff, 0xd9};
@@ -518,10 +526,10 @@ static int sd_querymenu(struct gspca_dev *gspca_dev,
case V4L2_CID_POWER_LINE_FREQUENCY:
switch (menu->index) {
case 1: /* V4L2_CID_POWER_LINE_FREQUENCY_50HZ */
- strcpy(menu->name, "50 Hz");
+ strcpy((char *) menu->name, "50 Hz");
return 0;
case 2: /* V4L2_CID_POWER_LINE_FREQUENCY_60HZ */
- strcpy(menu->name, "60 Hz");
+ strcpy((char *) menu->name, "60 Hz");
return 0;
}
break;
diff --git a/linux/drivers/media/video/gspca/sunplus.c b/linux/drivers/media/video/gspca/sunplus.c
index fff75a914..6e02726ee 100644
--- a/linux/drivers/media/video/gspca/sunplus.c
+++ b/linux/drivers/media/video/gspca/sunplus.c
@@ -24,8 +24,8 @@
#include "gspca.h"
#include "jpeg.h"
-#define DRIVER_VERSION_NUMBER KERNEL_VERSION(2, 1, 1)
-static const char version[] = "2.1.1";
+#define DRIVER_VERSION_NUMBER KERNEL_VERSION(2, 1, 5)
+static const char version[] = "2.1.5";
MODULE_AUTHOR("Michel Xhaard <mxhaard@users.sourceforge.net>");
MODULE_DESCRIPTION("GSPCA/SPCA5xx USB Camera Driver");
@@ -35,7 +35,7 @@ MODULE_LICENSE("GPL");
struct sd {
struct gspca_dev gspca_dev; /* !! must be the first item */
- unsigned char packet[ISO_MAX_SIZE + 128];
+ __u8 packet[ISO_MAX_SIZE + 128];
/* !! no more than 128 ff in an ISO packet */
unsigned char brightness;
@@ -126,21 +126,53 @@ static struct ctrl sd_ctrls[] = {
},
};
-static struct cam_mode vga_mode[] = {
- {V4L2_PIX_FMT_JPEG, 320, 240, 2},
- {V4L2_PIX_FMT_JPEG, 640, 480, 1},
+static struct v4l2_pix_format vga_mode[] = {
+ {320, 240, V4L2_PIX_FMT_JPEG, V4L2_FIELD_NONE,
+ .bytesperline = 320,
+ .sizeimage = 320 * 240 * 3 / 8 + 590,
+ .colorspace = V4L2_COLORSPACE_JPEG,
+ .priv = 2},
+ {640, 480, V4L2_PIX_FMT_JPEG, V4L2_FIELD_NONE,
+ .bytesperline = 640,
+ .sizeimage = 640 * 480 * 3 / 8 + 590,
+ .colorspace = V4L2_COLORSPACE_JPEG,
+ .priv = 1},
};
-static struct cam_mode custom_mode[] = {
- {V4L2_PIX_FMT_JPEG, 320, 240, 2},
- {V4L2_PIX_FMT_JPEG, 464, 480, 1},
+static struct v4l2_pix_format custom_mode[] = {
+ {320, 240, V4L2_PIX_FMT_JPEG, V4L2_FIELD_NONE,
+ .bytesperline = 320,
+ .sizeimage = 320 * 240 * 3 / 8 + 590,
+ .colorspace = V4L2_COLORSPACE_JPEG,
+ .priv = 2},
+ {464, 480, V4L2_PIX_FMT_JPEG, V4L2_FIELD_NONE,
+ .bytesperline = 464,
+ .sizeimage = 464 * 480 * 3 / 8 + 590,
+ .colorspace = V4L2_COLORSPACE_JPEG,
+ .priv = 1},
};
-static struct cam_mode vga_mode2[] = {
- {V4L2_PIX_FMT_JPEG, 176, 144, 4},
- {V4L2_PIX_FMT_JPEG, 320, 240, 3},
- {V4L2_PIX_FMT_JPEG, 352, 288, 2},
- {V4L2_PIX_FMT_JPEG, 640, 480, 1},
+static struct v4l2_pix_format vga_mode2[] = {
+ {176, 144, V4L2_PIX_FMT_JPEG, V4L2_FIELD_NONE,
+ .bytesperline = 176,
+ .sizeimage = 176 * 144 * 3 / 8 + 590,
+ .colorspace = V4L2_COLORSPACE_JPEG,
+ .priv = 4},
+ {320, 240, V4L2_PIX_FMT_JPEG, V4L2_FIELD_NONE,
+ .bytesperline = 320,
+ .sizeimage = 320 * 240 * 3 / 8 + 590,
+ .colorspace = V4L2_COLORSPACE_JPEG,
+ .priv = 3},
+ {352, 288, V4L2_PIX_FMT_JPEG, V4L2_FIELD_NONE,
+ .bytesperline = 352,
+ .sizeimage = 352 * 288 * 3 / 8 + 590,
+ .colorspace = V4L2_COLORSPACE_JPEG,
+ .priv = 2},
+ {640, 480, V4L2_PIX_FMT_JPEG, V4L2_FIELD_NONE,
+ .bytesperline = 640,
+ .sizeimage = 640 * 480 * 3 / 8 + 590,
+ .colorspace = V4L2_COLORSPACE_JPEG,
+ .priv = 1},
};
#define SPCA50X_OFFSET_DATA 10
@@ -156,7 +188,7 @@ static struct cam_mode vga_mode2[] = {
#define SPCA536_OFFSET_FRAMSEQ 1
/* Initialisation data for the Creative PC-CAM 600 */
-static __u16 spca504_pccam600_init_data[][3] = {
+static const __u16 spca504_pccam600_init_data[][3] = {
/* {0xa0, 0x0000, 0x0503}, * capture mode */
{0x00, 0x0000, 0x2000},
{0x00, 0x0013, 0x2301},
@@ -193,7 +225,7 @@ static __u16 spca504_pccam600_init_data[][3] = {
/* Creative PC-CAM 600 specific open data, sent before using the
* generic initialisation data from spca504_open_data.
*/
-static __u16 spca504_pccam600_open_data[][3] = {
+static const __u16 spca504_pccam600_open_data[][3] = {
{0x00, 0x0001, 0x2501},
{0x20, 0x0500, 0x0001}, /* snapshot mode */
{0x00, 0x0003, 0x2880},
@@ -202,7 +234,7 @@ static __u16 spca504_pccam600_open_data[][3] = {
};
/* Initialisation data for the logitech clicksmart 420 */
-static __u16 spca504A_clicksmart420_init_data[][3] = {
+static const __u16 spca504A_clicksmart420_init_data[][3] = {
/* {0xa0, 0x0000, 0x0503}, * capture mode */
{0x00, 0x0000, 0x2000},
{0x00, 0x0013, 0x2301},
@@ -257,7 +289,7 @@ static __u16 spca504A_clicksmart420_init_data[][3] = {
};
/* clicksmart 420 open data ? */
-static __u16 spca504A_clicksmart420_open_data[][3] = {
+static const __u16 spca504A_clicksmart420_open_data[][3] = {
{0x00, 0x0001, 0x2501},
{0x20, 0x0502, 0x0000},
{0x06, 0x0000, 0x0000},
@@ -404,7 +436,7 @@ static __u16 spca504A_clicksmart420_open_data[][3] = {
{}
};
-static unsigned char qtable_creative_pccam[2][64] = {
+static const __u8 qtable_creative_pccam[2][64] = {
{ /* Q-table Y-components */
0x05, 0x03, 0x03, 0x05, 0x07, 0x0c, 0x0f, 0x12,
0x04, 0x04, 0x04, 0x06, 0x08, 0x11, 0x12, 0x11,
@@ -429,7 +461,7 @@ static unsigned char qtable_creative_pccam[2][64] = {
* except for one byte. Possibly a typo?
* NWG: 18/05/2003.
*/
-static unsigned char qtable_spca504_default[2][64] = {
+static const __u8 qtable_spca504_default[2][64] = {
{ /* Q-table Y-components */
0x05, 0x03, 0x03, 0x05, 0x07, 0x0c, 0x0f, 0x12,
0x04, 0x04, 0x04, 0x06, 0x08, 0x11, 0x12, 0x11,
@@ -487,7 +519,7 @@ static int reg_write(struct usb_device *dev,
ret = usb_control_msg(dev,
usb_sndctrlpipe(dev, 0),
req,
- USB_TYPE_VENDOR | USB_RECIP_DEVICE,
+ USB_DIR_OUT | USB_TYPE_VENDOR | USB_RECIP_DEVICE,
value, index, NULL, 0, 500);
PDEBUG(D_PACK, "reg write: 0x%02x,0x%02x:0x%02x, 0x%x",
req, index, value, ret);
@@ -543,7 +575,7 @@ static int reg_read(struct usb_device *dev,
}
static int write_vector(struct gspca_dev *gspca_dev,
- __u16 data[][3])
+ const __u16 data[][3])
{
struct usb_device *dev = gspca_dev->dev;
int ret, i = 0;
@@ -565,7 +597,7 @@ static int spca50x_setup_qtable(struct gspca_dev *gspca_dev,
unsigned int request,
unsigned int ybase,
unsigned int cbase,
- unsigned char qtable[2][64])
+ const __u8 qtable[2][64])
{
struct usb_device *dev = gspca_dev->dev;
int i, err;
@@ -686,7 +718,7 @@ static void spca504B_SetSizeType(struct gspca_dev *gspca_dev)
__u8 Type;
int rc;
- Size = gspca_dev->cam.cam_mode[(int) gspca_dev->curr_mode].mode;
+ Size = gspca_dev->cam.cam_mode[(int) gspca_dev->curr_mode].priv;
Type = 0;
switch (sd->bridge) {
case BRIDGE_SPCA533:
@@ -1273,7 +1305,7 @@ static void sd_close(struct gspca_dev *gspca_dev)
static void sd_pkt_scan(struct gspca_dev *gspca_dev,
struct gspca_frame *frame, /* target */
- unsigned char *data, /* isoc packet */
+ __u8 *data, /* isoc packet */
int len) /* iso packet length */
{
struct sd *sd = (struct sd *) gspca_dev;
@@ -1561,7 +1593,7 @@ static int sd_getautogain(struct gspca_dev *gspca_dev, __s32 *val)
}
/* sub-driver description */
-static struct sd_desc sd_desc = {
+static const struct sd_desc sd_desc = {
.name = MODULE_NAME,
.ctrls = sd_ctrls,
.nctrls = ARRAY_SIZE(sd_ctrls),
@@ -1576,7 +1608,7 @@ static struct sd_desc sd_desc = {
/* -- module initialisation -- */
#define DVNM(name) .driver_info = (kernel_ulong_t) name
-static __devinitdata struct usb_device_id device_table[] = {
+static const __devinitdata struct usb_device_id device_table[] = {
{USB_DEVICE(0x041e, 0x400b), DVNM("Creative PC-CAM 600")},
{USB_DEVICE(0x041e, 0x4012), DVNM("PC-Cam350")},
{USB_DEVICE(0x041e, 0x4013), DVNM("Creative Pccam750")},
diff --git a/linux/drivers/media/video/gspca/t613.c b/linux/drivers/media/video/gspca/t613.c
index 6393b96fd..78ee480e2 100644
--- a/linux/drivers/media/video/gspca/t613.c
+++ b/linux/drivers/media/video/gspca/t613.c
@@ -26,13 +26,8 @@
#define MODULE_NAME "t613"
#include "gspca.h"
-#define DRIVER_VERSION_NUMBER KERNEL_VERSION(2, 1, 0)
-static const char version[] = "2.1.0";
-
-struct control_menu_info {
- int value;
- char name[32];
-};
+#define DRIVER_VERSION_NUMBER KERNEL_VERSION(2, 1, 5)
+static const char version[] = "2.1.5";
#define MAX_GAMMA 0x10 /* 0 to 15 */
@@ -227,32 +222,49 @@ static struct ctrl sd_ctrls[] = {
},
};
-static struct control_menu_info effects_control[] = {
- {0, "Normal"},
- {1, "Emboss"}, /* disabled */
- {2, "Monochrome"},
- {3, "Sepia"},
- {4, "Sketch"},
- {5, "Sun Effect"}, /* disabled */
- {6, "Negative"},
+static char *effects_control[] = {
+ "Normal",
+ "Emboss", /* disabled */
+ "Monochrome",
+ "Sepia",
+ "Sketch",
+ "Sun Effect", /* disabled */
+ "Negative",
};
-#define NUM_EFFECTS_CONTROL \
- (sizeof(effects_control)/sizeof(effects_control[0]))
-
-static struct cam_mode vga_mode_t16[] = {
- {V4L2_PIX_FMT_JPEG, 160, 120, 4},
- {V4L2_PIX_FMT_JPEG, 176, 144, 3},
- {V4L2_PIX_FMT_JPEG, 320, 240, 2},
- {V4L2_PIX_FMT_JPEG, 352, 288, 1},
- {V4L2_PIX_FMT_JPEG, 640, 480, 0},
+static struct v4l2_pix_format vga_mode_t16[] = {
+ {160, 120, V4L2_PIX_FMT_JPEG, V4L2_FIELD_NONE,
+ .bytesperline = 160,
+ .sizeimage = 160 * 120 * 3 / 8 + 590,
+ .colorspace = V4L2_COLORSPACE_JPEG,
+ .priv = 4},
+ {176, 144, V4L2_PIX_FMT_JPEG, V4L2_FIELD_NONE,
+ .bytesperline = 176,
+ .sizeimage = 176 * 144 * 3 / 8 + 590,
+ .colorspace = V4L2_COLORSPACE_JPEG,
+ .priv = 3},
+ {320, 240, V4L2_PIX_FMT_JPEG, V4L2_FIELD_NONE,
+ .bytesperline = 320,
+ .sizeimage = 320 * 240 * 3 / 8 + 590,
+ .colorspace = V4L2_COLORSPACE_JPEG,
+ .priv = 2},
+ {352, 288, V4L2_PIX_FMT_JPEG, V4L2_FIELD_NONE,
+ .bytesperline = 352,
+ .sizeimage = 352 * 288 * 3 / 8 + 590,
+ .colorspace = V4L2_COLORSPACE_JPEG,
+ .priv = 1},
+ {640, 480, V4L2_PIX_FMT_JPEG, V4L2_FIELD_NONE,
+ .bytesperline = 640,
+ .sizeimage = 640 * 480 * 3 / 8 + 590,
+ .colorspace = V4L2_COLORSPACE_JPEG,
+ .priv = 0},
};
#define T16_OFFSET_DATA 631
#define MAX_EFFECTS 7
/* easily done by soft, this table could be removed,
* i keep it here just in case */
-unsigned char effects_table[MAX_EFFECTS][6] = {
+static const __u8 effects_table[MAX_EFFECTS][6] = {
{0xa8, 0xe8, 0xc6, 0xd2, 0xc0, 0x00}, /* Normal */
{0xa8, 0xc8, 0xc6, 0x52, 0xc0, 0x04}, /* Repujar */
{0xa8, 0xe8, 0xc6, 0xd2, 0xc0, 0x20}, /* Monochrome */
@@ -262,7 +274,7 @@ unsigned char effects_table[MAX_EFFECTS][6] = {
{0xa8, 0xc8, 0xc6, 0xd2, 0xc0, 0x40}, /* Negative */
};
-unsigned char gamma_table[MAX_GAMMA][34] = {
+static const __u8 gamma_table[MAX_GAMMA][34] = {
{0x90, 0x00, 0x91, 0x3e, 0x92, 0x69, 0x93, 0x85,
0x94, 0x95, 0x95, 0xa1, 0x96, 0xae, 0x97, 0xb9,
0x98, 0xc2, 0x99, 0xcb, 0x9a, 0xd4, 0x9b, 0xdb,
@@ -345,7 +357,7 @@ unsigned char gamma_table[MAX_GAMMA][34] = {
0xA0, 0xFF}
};
-static __u8 tas5130a_sensor_init[][8] = {
+static const __u8 tas5130a_sensor_init[][8] = {
{0x62, 0x08, 0x63, 0x70, 0x64, 0x1d, 0x60, 0x09},
{0x62, 0x20, 0x63, 0x01, 0x64, 0x02, 0x60, 0x09},
{0x62, 0x07, 0x63, 0x03, 0x64, 0x00, 0x60, 0x09},
@@ -366,13 +378,41 @@ static void t16RegRead(struct usb_device *dev,
static void t16RegWrite(struct usb_device *dev,
__u16 value,
- __u16 index, __u8 *buffer, __u16 length)
+ __u16 index,
+ const __u8 *buffer, __u16 len)
{
- usb_control_msg(dev,
- usb_sndctrlpipe(dev, 0),
- 0, /* request */
- USB_DIR_OUT | USB_TYPE_VENDOR | USB_RECIP_DEVICE,
- value, index, buffer, length, 500);
+ if (buffer == NULL) {
+ usb_control_msg(dev,
+ usb_sndctrlpipe(dev, 0),
+ 0,
+ USB_DIR_OUT | USB_TYPE_VENDOR | USB_RECIP_INTERFACE,
+ value, index,
+ NULL, 0, 500);
+ return;
+ }
+ if (len < 16) {
+ __u8 tmpbuf[16];
+
+ memcpy(tmpbuf, buffer, len);
+ usb_control_msg(dev,
+ usb_sndctrlpipe(dev, 0),
+ 0,
+ USB_DIR_OUT | USB_TYPE_VENDOR | USB_RECIP_INTERFACE,
+ value, index,
+ tmpbuf, len, 500);
+ } else {
+ __u8 *tmpbuf;
+
+ tmpbuf = kmalloc(len, GFP_KERNEL);
+ memcpy(tmpbuf, buffer, len);
+ usb_control_msg(dev,
+ usb_sndctrlpipe(dev, 0),
+ 0,
+ USB_DIR_OUT | USB_TYPE_VENDOR | USB_RECIP_INTERFACE,
+ value, index,
+ tmpbuf, len, 500);
+ kfree(tmpbuf);
+ }
}
/* this function is called at probe time */
@@ -425,18 +465,18 @@ static int init_default_parameters(struct gspca_dev *gspca_dev)
int i = 0;
__u8 test_byte;
- static unsigned char read_indexs[] =
+ static const __u8 read_indexs[] =
{ 0x06, 0x07, 0x0a, 0x0b, 0x66, 0x80, 0x81, 0x8e, 0x8f, 0xa5,
0xa6, 0xa8, 0xbb, 0xbc, 0xc6, 0x00, 0x00 };
- static unsigned char n1[6] =
+ static const __u8 n1[6] =
{0x08, 0x03, 0x09, 0x03, 0x12, 0x04};
- static unsigned char n2[2] =
+ static const __u8 n2[2] =
{0x08, 0x00};
- static unsigned char nset[6] =
+ static const __u8 nset[6] =
{ 0x61, 0x68, 0x62, 0xff, 0x60, 0x07 };
- static unsigned char n3[6] =
+ static const __u8 n3[6] =
{0x61, 0x68, 0x65, 0x0a, 0x60, 0x04};
- static unsigned char n4[0x46] =
+ static const __u8 n4[0x46] =
{0x09, 0x01, 0x12, 0x04, 0x66, 0x8a, 0x80, 0x3c,
0x81, 0x22, 0x84, 0x50, 0x8a, 0x78, 0x8b, 0x68,
0x8c, 0x88, 0x8e, 0x33, 0x8f, 0x24, 0xaa, 0xb1,
@@ -447,7 +487,7 @@ static int init_default_parameters(struct gspca_dev *gspca_dev)
0x87, 0x40, 0x89, 0x2b, 0x8d, 0xff, 0x83, 0x40,
0xac, 0x84, 0xad, 0x86, 0xaf, 0x46};
#if 0
- static unsigned char nset1[50] = {
+ static const __u8 nset1[50] = {
0x80, 0x3c, 0x81, 0x68, 0x83, 0xa0, 0x84, 0x20, 0x8a, 0x5c,
0x8b, 0x4c, 0x8c, 0x88, 0x8e, 0xb4,
0x8f, 0x24, 0xa1, 0xb1, 0xa2, 0x30, 0xa5, 0x18, 0xa6, 0x4a,
@@ -457,40 +497,40 @@ static int init_default_parameters(struct gspca_dev *gspca_dev)
0xc6, 0xd2
};
#endif
- static unsigned char nset4[18] = {
+ static const __u8 nset4[18] = {
0xe0, 0x60, 0xe1, 0xa8, 0xe2, 0xe0, 0xe3, 0x60, 0xe4, 0xa8,
0xe5, 0xe0, 0xe6, 0x60, 0xe7, 0xa8,
0xe8, 0xe0
};
/* ojo puede ser 0xe6 en vez de 0xe9 */
- static unsigned char nset2[20] = {
+ static const __u8 nset2[20] = {
0xd0, 0xbb, 0xd1, 0x28, 0xd2, 0x10, 0xd3, 0x10, 0xd4, 0xbb,
0xd5, 0x28, 0xd6, 0x1e, 0xd7, 0x27,
0xd8, 0xc8, 0xd9, 0xfc
};
- static unsigned char missing[8] =
+ static const __u8 missing[8] =
{ 0x87, 0x20, 0x88, 0x20, 0x89, 0x20, 0x80, 0x38 };
- static unsigned char nset3[18] = {
+ static const __u8 nset3[18] = {
0xc7, 0x60, 0xc8, 0xa8, 0xc9, 0xe0, 0xca, 0x60, 0xcb, 0xa8,
0xcc, 0xe0, 0xcd, 0x60, 0xce, 0xa8,
0xcf, 0xe0
};
- static unsigned char nset5[4] =
+ static const __u8 nset5[4] =
{ 0x8f, 0x24, 0xc3, 0x00 }; /* bright */
- static unsigned char nset6[34] = {
+ static const __u8 nset6[34] = {
0x90, 0x00, 0x91, 0x1c, 0x92, 0x30, 0x93, 0x43, 0x94, 0x54,
0x95, 0x65, 0x96, 0x75, 0x97, 0x84,
0x98, 0x93, 0x99, 0xa1, 0x9a, 0xb0, 0x9b, 0xbd, 0x9c, 0xca,
0x9d, 0xd8, 0x9e, 0xe5, 0x9f, 0xf2,
0xa0, 0xff
}; /* Gamma */
- static unsigned char nset7[4] =
+ static const __u8 nset7[4] =
{ 0x66, 0xca, 0xa8, 0xf8 }; /* 50/60 Hz */
- static unsigned char nset9[4] =
+ static const __u8 nset9[4] =
{ 0x0b, 0x04, 0x0a, 0x78 };
- static unsigned char nset8[6] =
+ static const __u8 nset8[6] =
{ 0xa8, 0xf0, 0xc6, 0x88, 0xc0, 0x00 };
- static unsigned char nset10[6] =
+ static const __u8 nset10[6] =
{ 0x0c, 0x03, 0xab, 0x10, 0x81, 0x20 };
t16RegWrite(dev, 0x01, 0x0000, n1, 0x06);
@@ -508,31 +548,31 @@ static int init_default_parameters(struct gspca_dev *gspca_dev)
t16RegWrite(dev, 0x01, 0x0000, n3, 0x06);
t16RegWrite(dev, 0x01, 0x0000, n4, 0x46);
t16RegRead(dev, 0x0080, &test_byte, 1);
- t16RegWrite(dev, 0x00, 0x2c80, 0x00, 0x0);
+ t16RegWrite(dev, 0x00, 0x2c80, NULL, 0);
t16RegWrite(dev, 0x01, 0x0000, nset2, 0x14);
t16RegWrite(dev, 0x01, 0x0000, nset3, 0x12);
t16RegWrite(dev, 0x01, 0x0000, nset4, 0x12);
- t16RegWrite(dev, 0x00, 0x3880, 0x00, 0x0);
- t16RegWrite(dev, 0x00, 0x3880, 0x00, 0x0);
- t16RegWrite(dev, 0x00, 0x338e, 0x00, 0x0);
- t16RegWrite(dev, 0x01, 00, nset5, 0x04);
- t16RegWrite(dev, 0x00, 0x00a9, 0x00, 0x0);
- t16RegWrite(dev, 0x01, 00, nset6, 0x22);
- t16RegWrite(dev, 0x00, 0x86bb, 0x00, 0x0);
- t16RegWrite(dev, 0x00, 0x4aa6, 0x00, 0x0);
-
- t16RegWrite(dev, 0x01, 00, missing, 0x08);
-
- t16RegWrite(dev, 0x00, 0x2087, 0x00, 0x0);
- t16RegWrite(dev, 0x00, 0x2088, 0x00, 0x0);
- t16RegWrite(dev, 0x00, 0x2089, 0x00, 0x0);
-
- t16RegWrite(dev, 0x01, 00, nset7, 0x4);
- t16RegWrite(dev, 0x01, 00, nset10, 0x06);
- t16RegWrite(dev, 0x01, 00, nset8, 0x06);
- t16RegWrite(dev, 0x01, 00, nset9, 0x04);
-
- t16RegWrite(dev, 0x00, 0x2880, 0x00, 0x0);
+ t16RegWrite(dev, 0x00, 0x3880, NULL, 0);
+ t16RegWrite(dev, 0x00, 0x3880, NULL, 0);
+ t16RegWrite(dev, 0x00, 0x338e, NULL, 0);
+ t16RegWrite(dev, 0x01, 0x0000, nset5, 0x04);
+ t16RegWrite(dev, 0x00, 0x00a9, NULL, 0);
+ t16RegWrite(dev, 0x01, 0x0000, nset6, 0x22);
+ t16RegWrite(dev, 0x00, 0x86bb, NULL, 0);
+ t16RegWrite(dev, 0x00, 0x4aa6, NULL, 0);
+
+ t16RegWrite(dev, 0x01, 0x0000, missing, 0x08);
+
+ t16RegWrite(dev, 0x00, 0x2087, NULL, 0);
+ t16RegWrite(dev, 0x00, 0x2088, NULL, 0);
+ t16RegWrite(dev, 0x00, 0x2089, NULL, 0);
+
+ t16RegWrite(dev, 0x01, 0x0000, nset7, 0x04);
+ t16RegWrite(dev, 0x01, 0x0000, nset10, 0x06);
+ t16RegWrite(dev, 0x01, 0x0000, nset8, 0x06);
+ t16RegWrite(dev, 0x01, 0x0000, nset9, 0x04);
+
+ t16RegWrite(dev, 0x00, 0x2880, NULL, 0);
t16RegWrite(dev, 0x01, 0x0000, nset2, 0x14);
t16RegWrite(dev, 0x01, 0x0000, nset3, 0x12);
t16RegWrite(dev, 0x01, 0x0000, nset4, 0x12);
@@ -545,7 +585,7 @@ static void setbrightness(struct gspca_dev *gspca_dev)
struct sd *sd = (struct sd *) gspca_dev;
struct usb_device *dev = gspca_dev->dev;
unsigned int brightness;
- unsigned char set6[4] = { 0x8f, 0x26, 0xc3, 0x80 };
+ __u8 set6[4] = { 0x8f, 0x26, 0xc3, 0x80 };
brightness = sd->brightness;
if (brightness < 7) {
@@ -563,7 +603,7 @@ static void setflip(struct gspca_dev *gspca_dev)
struct sd *sd = (struct sd *) gspca_dev;
struct usb_device *dev = gspca_dev->dev;
- unsigned char flipcmd[8] =
+ __u8 flipcmd[8] =
{ 0x62, 0x07, 0x63, 0x03, 0x64, 0x00, 0x60, 0x09 };
if (sd->mirror == 1)
@@ -585,9 +625,9 @@ static void seteffect(struct gspca_dev *gspca_dev)
}
if (sd->effect == 1 || sd->effect == 4)
- t16RegWrite(dev, 0x00, 0x4aa6, 0x00, 0x00);
+ t16RegWrite(dev, 0x00, 0x4aa6, NULL, 0);
else
- t16RegWrite(dev, 0x00, 0xfaa6, 0x00, 0x00);
+ t16RegWrite(dev, 0x00, 0xfaa6, NULL, 0);
}
static void setwhitebalance(struct gspca_dev *gspca_dev)
@@ -595,7 +635,7 @@ static void setwhitebalance(struct gspca_dev *gspca_dev)
struct sd *sd = (struct sd *) gspca_dev;
struct usb_device *dev = gspca_dev->dev;
- unsigned char white_balance[8] =
+ __u8 white_balance[8] =
{ 0x87, 0x20, 0x88, 0x20, 0x89, 0x20, 0x80, 0x38 };
if (sd->whitebalance == 1)
@@ -628,18 +668,17 @@ static void setcontrast(struct gspca_dev *gspca_dev)
else
reg_to_write = (0x00a9 + ((contrast - 7) * 0x200));
- t16RegWrite(dev, 0x00, reg_to_write, 0x00, 0);
-
+ t16RegWrite(dev, 0x00, reg_to_write, NULL, 0);
}
static void setcolors(struct gspca_dev *gspca_dev)
{
struct sd *sd = (struct sd *) gspca_dev;
struct usb_device *dev = gspca_dev->dev;
- __u16 reg_to_write = 0x00;
+ __u16 reg_to_write;
reg_to_write = 0xc0bb + sd->colors * 0x100;
- t16RegWrite(dev, 0x00, reg_to_write, 0x00, 0);
+ t16RegWrite(dev, 0x00, reg_to_write, NULL, 0);
}
static void setgamma(struct gspca_dev *gspca_dev)
@@ -658,11 +697,11 @@ static void setsharpness(struct gspca_dev *gspca_dev)
{
struct sd *sd = (struct sd *) gspca_dev;
struct usb_device *dev = gspca_dev->dev;
- __u16 reg_to_write = 0x00;
+ __u16 reg_to_write;
reg_to_write = 0x0aa6 + 0x1000 * sd->sharpness;
- t16RegWrite(dev, 0x00, reg_to_write, 0x00, 0x00);
+ t16RegWrite(dev, 0x00, reg_to_write, NULL, 0);
}
static int sd_setbrightness(struct gspca_dev *gspca_dev, __s32 val)
@@ -678,6 +717,7 @@ static int sd_setbrightness(struct gspca_dev *gspca_dev, __s32 val)
static int sd_getbrightness(struct gspca_dev *gspca_dev, __s32 *val)
{
struct sd *sd = (struct sd *) gspca_dev;
+
*val = sd->brightness;
return *val;
}
@@ -700,7 +740,6 @@ static int sd_getwhitebalance(struct gspca_dev *gspca_dev, __s32 *val)
return *val;
}
-
static int sd_setflip(struct gspca_dev *gspca_dev, __s32 val)
{
struct sd *sd = (struct sd *) gspca_dev;
@@ -834,9 +873,9 @@ static int sd_setlowlight(struct gspca_dev *gspca_dev, __s32 val)
sd->autogain = val;
if (val != 0)
- t16RegWrite(dev, 0x00, 0xf48e, 0x00, 0);
+ t16RegWrite(dev, 0x00, 0xf48e, NULL, 0);
else
- t16RegWrite(dev, 0x00, 0xb48e, 0x00, 0);
+ t16RegWrite(dev, 0x00, 0xb48e, NULL, 0);
return 0;
}
@@ -854,14 +893,14 @@ static void sd_start(struct gspca_dev *gspca_dev)
int mode;
__u8 test_byte;
- static __u8 t1[] = { 0x66, 0x00, 0xa8, 0xe8 };
+ static const __u8 t1[] = { 0x66, 0x00, 0xa8, 0xe8 };
__u8 t2[] = { 0x07, 0x00, 0x0d, 0x60, 0x0e, 0x80 };
- static __u8 t3[] =
+ static const __u8 t3[] =
{ 0xb3, 0x07, 0xb4, 0x00, 0xb5, 0x88, 0xb6, 0x02, 0xb7, 0x06,
0xb8, 0x00, 0xb9, 0xe7, 0xba, 0x01 };
- static __u8 t4[] = { 0x0b, 0x04, 0x0a, 0x40 };
+ static const __u8 t4[] = { 0x0b, 0x04, 0x0a, 0x40 };
- mode = gspca_dev->cam.cam_mode[(int) gspca_dev->curr_mode]. mode;
+ mode = gspca_dev->cam.cam_mode[(int) gspca_dev->curr_mode]. priv;
switch (mode) {
case 1: /* 352x288 */
t2[1] = 0x40;
@@ -883,16 +922,16 @@ static void sd_start(struct gspca_dev *gspca_dev)
t16RegWrite(dev, 0x01, 0x0000, tas5130a_sensor_init[1], 0x8);
t16RegWrite(dev, 0x01, 0x0000, tas5130a_sensor_init[2], 0x8);
t16RegWrite(dev, 0x01, 0x0000, tas5130a_sensor_init[3], 0x8);
- t16RegWrite(dev, 0x00, 0x3c80, 0x00, 0x00);
+ t16RegWrite(dev, 0x00, 0x3c80, NULL, 0);
/* just in case and to keep sync with logs (for mine) */
t16RegWrite(dev, 0x01, 0x0000, tas5130a_sensor_init[3], 0x8);
- t16RegWrite(dev, 0x00, 0x3c80, 0x00, 0x00);
+ t16RegWrite(dev, 0x00, 0x3c80, NULL, 0);
/* just in case and to keep sync with logs (for mine) */
t16RegWrite(dev, 0x01, 0x0000, t1, 4);
t16RegWrite(dev, 0x01, 0x0000, t2, 6);
- t16RegRead(dev, 0x0012, &test_byte, 0x1);
+ t16RegRead(dev, 0x0012, &test_byte, 0x01);
t16RegWrite(dev, 0x01, 0x0000, t3, 0x10);
- t16RegWrite(dev, 0x00, 0x0013, 0x00, 0x00);
+ t16RegWrite(dev, 0x00, 0x0013, NULL, 0);
t16RegWrite(dev, 0x01, 0x0000, t4, 0x4);
/* restart on each start, just in case, sometimes regs goes wrong
* when using controls from app */
@@ -919,11 +958,11 @@ static void sd_close(struct gspca_dev *gspca_dev)
static void sd_pkt_scan(struct gspca_dev *gspca_dev,
struct gspca_frame *frame, /* target */
- unsigned char *data, /* isoc packet */
+ __u8 *data, /* isoc packet */
int len) /* iso packet length */
{
int sof = 0;
- static unsigned char ffd9[] = { 0xff, 0xd9 };
+ static __u8 ffd9[] = { 0xff, 0xd9 };
if (data[0] == 0x5a) {
/* Control Packet, after this came the header again,
@@ -962,27 +1001,26 @@ static void sd_pkt_scan(struct gspca_dev *gspca_dev,
static int sd_querymenu(struct gspca_dev *gspca_dev,
struct v4l2_querymenu *menu)
{
- memset(menu->name, 0, sizeof menu->name);
-
switch (menu->id) {
case V4L2_CID_POWER_LINE_FREQUENCY:
switch (menu->index) {
case 1: /* V4L2_CID_POWER_LINE_FREQUENCY_50HZ */
- strcpy(menu->name, "50 Hz");
+ strcpy((char *) menu->name, "50 Hz");
return 0;
case 2: /* V4L2_CID_POWER_LINE_FREQUENCY_60HZ */
- strcpy(menu->name, "60 Hz");
+ strcpy((char *) menu->name, "60 Hz");
return 0;
}
break;
case V4L2_CID_EFFECTS:
- if (menu->index < 0 || menu->index >= NUM_EFFECTS_CONTROL)
- return -EINVAL;
- strncpy((char *) menu->name,
- effects_control[menu->index].name, 32);
+ if ((unsigned) menu->index < ARRAY_SIZE(effects_control)) {
+ strncpy((char *) menu->name,
+ effects_control[menu->index], 32);
+ return 0;
+ }
break;
}
- return 0;
+ return -EINVAL;
}
/* this function is called at open time */
@@ -993,7 +1031,7 @@ static int sd_open(struct gspca_dev *gspca_dev)
}
/* sub-driver description */
-static struct sd_desc sd_desc = {
+static const struct sd_desc sd_desc = {
.name = MODULE_NAME,
.ctrls = sd_ctrls,
.nctrls = ARRAY_SIZE(sd_ctrls),
@@ -1009,11 +1047,10 @@ static struct sd_desc sd_desc = {
/* -- module initialisation -- */
#define DVNM(name) .driver_info = (kernel_ulong_t) name
-static __devinitdata struct usb_device_id device_table[] = {
+static const __devinitdata struct usb_device_id device_table[] = {
{USB_DEVICE(0x17a1, 0x0128), DVNM("XPX Webcam")},
{}
};
-
MODULE_DEVICE_TABLE(usb, device_table);
/* -- device connect -- */
diff --git a/linux/drivers/media/video/gspca/tv8532.c b/linux/drivers/media/video/gspca/tv8532.c
index 9af2a51bb..b9837841c 100644
--- a/linux/drivers/media/video/gspca/tv8532.c
+++ b/linux/drivers/media/video/gspca/tv8532.c
@@ -22,8 +22,8 @@
#include "gspca.h"
-#define DRIVER_VERSION_NUMBER KERNEL_VERSION(2, 1, 0)
-static const char version[] = "2.1.0";
+#define DRIVER_VERSION_NUMBER KERNEL_VERSION(2, 1, 5)
+static const char version[] = "2.1.5";
MODULE_AUTHOR("Michel Xhaard <mxhaard@users.sourceforge.net>");
MODULE_DESCRIPTION("TV8532 USB Camera Driver");
@@ -81,9 +81,17 @@ static struct ctrl sd_ctrls[] = {
},
};
-static struct cam_mode sif_mode[] = {
- {V4L2_PIX_FMT_SBGGR8, 176, 144, 1},
- {V4L2_PIX_FMT_SBGGR8, 352, 288, 0},
+static struct v4l2_pix_format sif_mode[] = {
+ {176, 144, V4L2_PIX_FMT_SBGGR8, V4L2_FIELD_NONE,
+ .bytesperline = 176,
+ .sizeimage = 176 * 144,
+ .colorspace = V4L2_COLORSPACE_SRGB,
+ .priv = 1},
+ {352, 288, V4L2_PIX_FMT_SBGGR8, V4L2_FIELD_NONE,
+ .bytesperline = 352,
+ .sizeimage = 352 * 288,
+ .colorspace = V4L2_COLORSPACE_SRGB,
+ .priv = 0},
};
/*
@@ -152,7 +160,7 @@ static struct cam_mode sif_mode[] = {
#define TV8532_AD_ROWBEGIN_L 0x14
#define TV8532_AD_ROWBEGIN_H 0x15
-static __u32 tv_8532_eeprom_data[] = {
+static const __u32 tv_8532_eeprom_data[] = {
/* add dataL dataM dataH */
0x00010001, 0x01018011, 0x02050014, 0x0305001c,
0x040d001e, 0x0505001f, 0x06050519, 0x0705011b,
@@ -192,8 +200,7 @@ static void tv_8532WriteEEprom(struct gspca_dev *gspca_dev)
datacmd = 0xb0;;
reg_w(dev, TV8532_GPIO, &datacmd, 1);
datacmd = TV8532_CMD_EEprom_Open;
- reg_w(dev, TV8532_CTRL, &datacmd,
- 1);
+ reg_w(dev, TV8532_CTRL, &datacmd, 1);
/* msleep(1); */
while (tv_8532_eeprom_data[i]) {
reg = (tv_8532_eeprom_data[i] & 0xff000000) >> 24;
@@ -244,7 +251,7 @@ static int sd_config(struct gspca_dev *gspca_dev,
static void tv_8532ReadRegisters(struct gspca_dev *gspca_dev)
{
struct usb_device *dev = gspca_dev->dev;
- __u8 data = 0;
+ __u8 data;
/* __u16 vid, pid; */
reg_r(dev, 0x0001, &data);
@@ -276,7 +283,7 @@ static void tv_8532ReadRegisters(struct gspca_dev *gspca_dev)
static void tv_8532_setReg(struct gspca_dev *gspca_dev)
{
struct usb_device *dev = gspca_dev->dev;
- __u8 data = 0;
+ __u8 data;
__u8 value[2] = { 0, 0 };
data = ADCBEGINL;
@@ -321,7 +328,7 @@ static void tv_8532_setReg(struct gspca_dev *gspca_dev)
static void tv_8532_PollReg(struct gspca_dev *gspca_dev)
{
struct usb_device *dev = gspca_dev->dev;
- __u8 data = 0;
+ __u8 data;
int i;
/* strange polling from tgc */
@@ -339,9 +346,9 @@ static void tv_8532_PollReg(struct gspca_dev *gspca_dev)
static int sd_open(struct gspca_dev *gspca_dev)
{
struct usb_device *dev = gspca_dev->dev;
- __u8 data = 0;
- __u8 dataStart = 0;
- __u8 value[2] = { 0, 0 };
+ __u8 data;
+ __u8 dataStart;
+ __u8 value[2];
data = 0x32;
reg_w(dev, TV8532_AD_SLOPE, &data, 1);
@@ -390,8 +397,7 @@ static int sd_open(struct gspca_dev *gspca_dev)
tv_8532_setReg(gspca_dev);
/*************************************************/
data = 0x0b;
- reg_w(dev, TV8532_GPIO_OE, &data,
- 1);
+ reg_w(dev, TV8532_GPIO_OE, &data, 1);
/*************************************************/
tv_8532_setReg(gspca_dev);
/*************************************************/
@@ -417,8 +423,7 @@ static void setbrightness(struct gspca_dev *gspca_dev)
static void sd_start(struct gspca_dev *gspca_dev)
{
struct usb_device *dev = gspca_dev->dev;
- __u8 data = 0;
- __u8 dataStart = 0;
+ __u8 data;
__u8 value[2];
data = 0x32;
@@ -443,7 +448,7 @@ static void sd_start(struct gspca_dev *gspca_dev)
/************************************************/
data = TESTCOMP; /* 0x72 compressed mode */
reg_w(dev, TV8532_QUANT_COMP, &data, 1); /* 0x28 */
- if (gspca_dev->cam.cam_mode[(int) gspca_dev->curr_mode].mode) {
+ if (gspca_dev->cam.cam_mode[(int) gspca_dev->curr_mode].priv) {
/* 176x144 */
data = QCIFLINE; /* 0x84; // CIF | 4 packet */
reg_w(dev, TV8532_MODE_PACKET, &data, 1); /* 0x29 */
@@ -459,8 +464,8 @@ static void sd_start(struct gspca_dev *gspca_dev)
reg_w(dev, TV8532_POINT_L, &data, 1); /* 0x2d */
data = TESTPTH; /* 0x04; */
reg_w(dev, TV8532_POINT_H, &data, 1); /* 0x2e */
- dataStart = TESTPTBL; /* 0x04; */
- reg_w(dev, TV8532_POINTB_L, &dataStart, 1); /* 0x2f */
+ data = TESTPTBL; /* 0x04; */
+ reg_w(dev, TV8532_POINTB_L, &data, 1); /* 0x2f */
data = TESTPTBH; /* 0x04; */
reg_w(dev, TV8532_POINTB_H, &data, 1); /* 0x30 */
data = TV8532_CMD_UPDATE;
@@ -611,7 +616,7 @@ static void sd_pkt_scan(struct gspca_dev *gspca_dev,
static void setcontrast(struct gspca_dev *gspca_dev)
{
#if 0
- __u8 value[2] = { 0xfc, 0x01 };
+ __u8 value[2];
__u8 data;
value[0] = (gspca_dev->contrast) & 0xff;
@@ -662,7 +667,7 @@ static int sd_getcontrast(struct gspca_dev *gspca_dev, __s32 *val)
}
/* sub-driver description */
-static struct sd_desc sd_desc = {
+static const struct sd_desc sd_desc = {
.name = MODULE_NAME,
.ctrls = sd_ctrls,
.nctrls = ARRAY_SIZE(sd_ctrls),
@@ -677,7 +682,7 @@ static struct sd_desc sd_desc = {
/* -- module initialisation -- */
#define DVNM(name) .driver_info = (kernel_ulong_t) name
-static __devinitdata struct usb_device_id device_table[] = {
+static const __devinitdata struct usb_device_id device_table[] = {
{USB_DEVICE(0x046d, 0x0920), DVNM("QC Express")},
{USB_DEVICE(0x046d, 0x0921), DVNM("Labtec Webcam")},
{USB_DEVICE(0x0545, 0x808b), DVNM("Veo Stingray")},
diff --git a/linux/drivers/media/video/gspca/vc032x.c b/linux/drivers/media/video/gspca/vc032x.c
index 762869ff7..ad46273cd 100644
--- a/linux/drivers/media/video/gspca/vc032x.c
+++ b/linux/drivers/media/video/gspca/vc032x.c
@@ -24,8 +24,8 @@
#include "gspca.h"
-#define DRIVER_VERSION_NUMBER KERNEL_VERSION(2, 1, 0)
-static const char version[] = "2.1.0";
+#define DRIVER_VERSION_NUMBER KERNEL_VERSION(2, 1, 5)
+static const char version[] = "2.1.5";
MODULE_AUTHOR("Michel Xhaard <mxhaard@users.sourceforge.net>");
MODULE_DESCRIPTION("GSPCA/VC032X USB Camera Driver");
@@ -88,25 +88,41 @@ static struct ctrl sd_ctrls[] = {
},
};
-static struct cam_mode vc0321_mode[] = {
- {V4L2_PIX_FMT_YUYV, 320, 240, 1},
- {V4L2_PIX_FMT_YUYV, 640, 480, 0},
+static struct v4l2_pix_format vc0321_mode[] = {
+ {320, 240, V4L2_PIX_FMT_YUYV, V4L2_FIELD_NONE,
+ .bytesperline = 320 * 2,
+ .sizeimage = 320 * 240 * 2,
+ .colorspace = V4L2_COLORSPACE_SRGB,
+ .priv = 1},
+ {640, 480, V4L2_PIX_FMT_YUYV, V4L2_FIELD_NONE,
+ .bytesperline = 640 * 2,
+ .sizeimage = 640 * 480 * 2,
+ .colorspace = V4L2_COLORSPACE_SRGB,
+ .priv = 0},
};
-static struct cam_mode vc0323_mode[] = {
- {V4L2_PIX_FMT_JPEG, 320, 240, 1},
- {V4L2_PIX_FMT_JPEG, 640, 480, 0},
+static struct v4l2_pix_format vc0323_mode[] = {
+ {320, 240, V4L2_PIX_FMT_JPEG, V4L2_FIELD_NONE,
+ .bytesperline = 320,
+ .sizeimage = 320 * 240 * 3 / 8 + 590,
+ .colorspace = V4L2_COLORSPACE_JPEG,
+ .priv = 1},
+ {640, 480, V4L2_PIX_FMT_JPEG, V4L2_FIELD_NONE,
+ .bytesperline = 640,
+ .sizeimage = 640 * 480 * 3 / 8 + 590,
+ .colorspace = V4L2_COLORSPACE_JPEG,
+ .priv = 0},
};
#if 0
-static __u8 mi1310soc_gamma[17] = {
+static const __u8 mi1310soc_gamma[17] = {
0x00, 0x13, 0x38, 0x59, 0x79, 0x92, 0xa7, 0xb9, 0xc8,
0xd4, 0xdf, 0xe7, 0xee, 0xf4, 0xf9, 0xfc, 0xff
};
-static __u8 mi1310soc_matrix[9] = {
+static const __u8 mi1310soc_matrix[9] = {
0x56, 0xf0, 0xf6, 0xf3, 0x57, 0xf6, 0xf3, 0xef, 0x58
};
#endif
-static __u8 mi1310_socinitVGA_JPG[][4] = {
+static const __u8 mi1310_socinitVGA_JPG[][4] = {
{0xb0, 0x03, 0x19, 0xcc},
{0xb0, 0x04, 0x02, 0xcc},
{0xb3, 0x00, 0x64, 0xcc},
@@ -258,7 +274,7 @@ static __u8 mi1310_socinitVGA_JPG[][4] = {
{0x03, 0x03, 0xc0, 0xbb},
{},
};
-static __u8 mi1310_socinitQVGA_JPG[][4] = {
+static const __u8 mi1310_socinitQVGA_JPG[][4] = {
{0xb0, 0x03, 0x19, 0xcc}, {0xb0, 0x04, 0x02, 0xcc},
{0xb3, 0x00, 0x64, 0xcc}, {0xb3, 0x00, 0x65, 0xcc},
{0xb3, 0x05, 0x00, 0xcc}, {0xb3, 0x06, 0x00, 0xcc},
@@ -332,14 +348,14 @@ static __u8 mi1310_socinitQVGA_JPG[][4] = {
{},
};
-static __u8 mi1320_gamma[17] = {
+static const __u8 mi1320_gamma[17] = {
0x00, 0x13, 0x38, 0x59, 0x79, 0x92, 0xa7, 0xb9, 0xc8,
0xd4, 0xdf, 0xe7, 0xee, 0xf4, 0xf9, 0xfc, 0xff
};
-static __u8 mi1320_matrix[9] = {
+static const __u8 mi1320_matrix[9] = {
0x54, 0xda, 0x06, 0xf1, 0x50, 0xf4, 0xf7, 0xea, 0x52
};
-static __u8 mi1320_initVGA_data[][4] = {
+static const __u8 mi1320_initVGA_data[][4] = {
{0xb3, 0x01, 0x01, 0xcc}, {0x00, 0x00, 0x33, 0xdd},
{0xb0, 0x03, 0x19, 0xcc}, {0x00, 0x00, 0x33, 0xdd},
{0xb0, 0x04, 0x02, 0xcc}, {0x00, 0x00, 0x33, 0xdd},
@@ -418,7 +434,7 @@ static __u8 mi1320_initVGA_data[][4] = {
{0xb3, 0x5c, 0x01, 0xcc}, {0xb3, 0x01, 0x41, 0xcc},
{}
};
-static __u8 mi1320_initQVGA_data[][4] = {
+static const __u8 mi1320_initQVGA_data[][4] = {
{0xb3, 0x01, 0x01, 0xcc}, {0x00, 0x00, 0x33, 0xdd},
{0xb0, 0x03, 0x19, 0xcc}, {0x00, 0x00, 0x33, 0xdd},
{0xb0, 0x04, 0x02, 0xcc}, {0x00, 0x00, 0x33, 0xdd},
@@ -487,15 +503,15 @@ static __u8 mi1320_initQVGA_data[][4] = {
{}
};
-static __u8 po3130_gamma[17] = {
+static const __u8 po3130_gamma[17] = {
0x00, 0x13, 0x38, 0x59, 0x79, 0x92, 0xa7, 0xb9, 0xc8,
0xd4, 0xdf, 0xe7, 0xee, 0xf4, 0xf9, 0xfc, 0xff
};
-static __u8 po3130_matrix[9] = {
+static const __u8 po3130_matrix[9] = {
0x5f, 0xec, 0xf5, 0xf1, 0x5a, 0xf5, 0xf1, 0xec, 0x63
};
-static __u8 po3130_initVGA_data[][4] = {
+static const __u8 po3130_initVGA_data[][4] = {
{0xb0, 0x4d, 0x00, 0xcc}, {0xb3, 0x01, 0x01, 0xcc},
{0x00, 0x00, 0x50, 0xdd}, {0xb0, 0x03, 0x01, 0xcc},
{0xb3, 0x00, 0x04, 0xcc}, {0xb3, 0x00, 0x24, 0xcc},
@@ -578,7 +594,7 @@ static __u8 po3130_initVGA_data[][4] = {
{0xb3, 0x5c, 0x00, 0xcc}, {0xb3, 0x01, 0x41, 0xcc},
{}
};
-static __u8 po3130_rundata[][4] = {
+static const __u8 po3130_rundata[][4] = {
{0x00, 0x47, 0x45, 0xaa}, {0x00, 0x48, 0x9b, 0xaa},
{0x00, 0x49, 0x3a, 0xaa}, {0x00, 0x4a, 0x01, 0xaa},
{0x00, 0x44, 0x40, 0xaa},
@@ -593,7 +609,7 @@ static __u8 po3130_rundata[][4] = {
{}
};
-static __u8 po3130_initQVGA_data[][4] = {
+static const __u8 po3130_initQVGA_data[][4] = {
{0xb0, 0x4d, 0x00, 0xcc}, {0xb3, 0x01, 0x01, 0xcc},
{0x00, 0x00, 0x50, 0xdd}, {0xb0, 0x03, 0x09, 0xcc},
{0xb3, 0x00, 0x04, 0xcc}, {0xb3, 0x00, 0x24, 0xcc},
@@ -679,16 +695,16 @@ static __u8 po3130_initQVGA_data[][4] = {
{}
};
-static __u8 hv7131r_gamma[17] = {
+static const __u8 hv7131r_gamma[17] = {
/* 0x00, 0x13, 0x38, 0x59, 0x79, 0x92, 0xa7, 0xb9, 0xc8,
* 0xd4, 0xdf, 0xe7, 0xee, 0xf4, 0xf9, 0xfc, 0xff */
0x04, 0x1a, 0x36, 0x55, 0x6f, 0x87, 0x9d, 0xb0, 0xc1,
0xcf, 0xda, 0xe4, 0xec, 0xf3, 0xf8, 0xfd, 0xff
};
-static __u8 hv7131r_matrix[9] = {
+static const __u8 hv7131r_matrix[9] = {
0x5f, 0xec, 0xf5, 0xf1, 0x5a, 0xf5, 0xf1, 0xec, 0x63
};
-static __u8 hv7131r_initVGA_data[][4] = {
+static const __u8 hv7131r_initVGA_data[][4] = {
{0xb0, 0x4d, 0x00, 0xcc}, {0xb3, 0x01, 0x01, 0xcc},
{0x00, 0x00, 0x50, 0xdd}, {0xb0, 0x03, 0x01, 0xcc},
{0xb3, 0x00, 0x24, 0xcc},
@@ -731,7 +747,7 @@ static __u8 hv7131r_initVGA_data[][4] = {
{}
};
-static __u8 hv7131r_initQVGA_data[][4] = {
+static const __u8 hv7131r_initQVGA_data[][4] = {
{0xb0, 0x4d, 0x00, 0xcc}, {0xb3, 0x01, 0x01, 0xcc},
{0x00, 0x00, 0x50, 0xdd}, {0xb0, 0x03, 0x01, 0xcc},
{0xb3, 0x00, 0x24, 0xcc},
@@ -786,14 +802,14 @@ static __u8 hv7131r_initQVGA_data[][4] = {
{}
};
-static __u8 ov7660_gamma[17] = {
+static const __u8 ov7660_gamma[17] = {
0x00, 0x13, 0x38, 0x59, 0x79, 0x92, 0xa7, 0xb9, 0xc8,
0xd4, 0xdf, 0xe7, 0xee, 0xf4, 0xf9, 0xfc, 0xff
};
-static __u8 ov7660_matrix[9] = {
+static const __u8 ov7660_matrix[9] = {
0x5a, 0xf0, 0xf6, 0xf3, 0x57, 0xf6, 0xf3, 0xef, 0x62
};
-static __u8 ov7660_initVGA_data[][4] = {
+static const __u8 ov7660_initVGA_data[][4] = {
{0xb0, 0x4d, 0x00, 0xcc}, {0xb3, 0x01, 0x01, 0xcc},
{0x00, 0x00, 0x50, 0xdd},
{0xb0, 0x03, 0x01, 0xcc},
@@ -851,7 +867,7 @@ static __u8 ov7660_initVGA_data[][4] = {
{0x00, 0x29, 0x3c, 0xaa}, {0xb3, 0x01, 0x45, 0xcc},
{}
};
-static __u8 ov7660_initQVGA_data[][4] = {
+static const __u8 ov7660_initQVGA_data[][4] = {
{0xb0, 0x4d, 0x00, 0xcc}, {0xb3, 0x01, 0x01, 0xcc},
{0x00, 0x00, 0x50, 0xdd}, {0xb0, 0x03, 0x01, 0xcc},
{0xb3, 0x00, 0x21, 0xcc}, {0xb3, 0x00, 0x26, 0xcc},
@@ -920,26 +936,26 @@ static __u8 ov7660_initQVGA_data[][4] = {
{0x00, 0x00, 0x00, 0x00}
};
-static __u8 ov7660_50HZ[][4] = {
+static const __u8 ov7660_50HZ[][4] = {
{0x00, 0x3b, 0x08, 0xaa},
{0x00, 0x9d, 0x40, 0xaa},
{0x00, 0x13, 0xa7, 0xaa},
{0x00, 0x00, 0x00, 0x00}
};
-static __u8 ov7660_60HZ[][4] = {
+static const __u8 ov7660_60HZ[][4] = {
{0x00, 0x3b, 0x00, 0xaa},
{0x00, 0x9e, 0x40, 0xaa},
{0x00, 0x13, 0xa7, 0xaa},
{}
};
-static __u8 ov7660_NoFliker[][4] = {
+static const __u8 ov7660_NoFliker[][4] = {
{0x00, 0x13, 0x87, 0xaa},
{}
};
-static __u8 ov7670_initVGA_JPG[][4] = {
+static const __u8 ov7670_initVGA_JPG[][4] = {
{0xb3, 0x01, 0x05, 0xcc},
{0x00, 0x00, 0x30, 0xdd}, {0xb0, 0x03, 0x19, 0xcc},
{0x00, 0x00, 0x10, 0xdd},
@@ -1067,7 +1083,7 @@ static __u8 ov7670_initVGA_JPG[][4] = {
{},
};
-static __u8 ov7670_initQVGA_JPG[][4] = {
+static const __u8 ov7670_initQVGA_JPG[][4] = {
{0xb3, 0x01, 0x05, 0xcc}, {0x00, 0x00, 0x30, 0xdd},
{0xb0, 0x03, 0x19, 0xcc}, {0x00, 0x00, 0x10, 0xdd},
{0xb0, 0x04, 0x02, 0xcc}, {0x00, 0x00, 0x10, 0xdd},
@@ -1199,7 +1215,7 @@ static __u8 ov7670_initQVGA_JPG[][4] = {
{},
};
#if 0
-static __u8 ov7670_initQVGA_JPG[][4] = {
+static const __u8 ov7670_initQVGA_JPG[][4] = {
{0xb3, 0x00, 0x00, 0xcc},
{0xb0, 0x16, 0x0d, 0xcc},
{0x00, 0x00, 0x50, 0xdd}, {0xb0, 0x16, 0x00, 0xcc},
@@ -1380,7 +1396,7 @@ struct sensor_info {
__u8 op;
};
-static struct sensor_info sensor_info_data[] = {
+static const struct sensor_info sensor_info_data[] = {
/* sensorId, I2cAdd, IdAdd, VpId, m1, m2, op */
{SENSOR_HV7131R, 0x80 | 0x11, 0x00, 0x0209, 0x24, 0x25, 0x01},
{SENSOR_OV7660, 0x80 | 0x21, 0x0a, 0x7660, 0x26, 0x26, 0x05},
@@ -1462,7 +1478,7 @@ static int vc032x_probe_sensor(struct gspca_dev *gspca_dev)
int i;
__u8 data;
__u16 value;
- struct sensor_info *ptsensor_info;
+ const struct sensor_info *ptsensor_info;
reg_r(dev, 0xa1, 0xbfcf, &data, 1);
PDEBUG(D_PROBE, "check sensor header %d", data);
@@ -1489,7 +1505,7 @@ static int vc032x_probe_sensor(struct gspca_dev *gspca_dev)
}
static __u8 i2c_write(struct usb_device *dev,
- __u8 reg, __u8 *val, __u8 size)
+ __u8 reg, const __u8 *val, __u8 size)
{
__u8 retbyte;
@@ -1521,7 +1537,7 @@ static __u8 i2c_write(struct usb_device *dev,
}
static void put_tab_to_reg(struct gspca_dev *gspca_dev,
- __u8 *tab, __u8 tabsize, __u16 addr)
+ const __u8 *tab, __u8 tabsize, __u16 addr)
{
int j;
__u16 ad = addr;
@@ -1531,7 +1547,7 @@ static void put_tab_to_reg(struct gspca_dev *gspca_dev,
}
static void usb_exchange(struct gspca_dev *gspca_dev,
- __u8 data[][4])
+ const __u8 data[][4])
{
struct usb_device *dev = gspca_dev->dev;
int i = 0;
@@ -1708,7 +1724,7 @@ static void setautogain(struct gspca_dev *gspca_dev)
static void setlightfreq(struct gspca_dev *gspca_dev)
{
struct sd *sd = (struct sd *) gspca_dev;
- static __u8 (*ov7660_freq_tb[3])[4] =
+ static const __u8 (*ov7660_freq_tb[3])[4] =
{ov7660_NoFliker, ov7660_50HZ, ov7660_60HZ};
if (sd->sensor != SENSOR_OV7660)
@@ -1720,8 +1736,8 @@ static void sd_start(struct gspca_dev *gspca_dev)
{
struct sd *sd = (struct sd *) gspca_dev;
/* __u8 tmp2; */
- __u8 *GammaT = NULL;
- __u8 *MatrixT = NULL;
+ const __u8 *GammaT = NULL;
+ const __u8 *MatrixT = NULL;
int mode;
/* Assume start use the good resolution from gspca_dev->mode */
@@ -1732,7 +1748,7 @@ static void sd_start(struct gspca_dev *gspca_dev)
reg_w(gspca_dev->dev, 0xa0, 0xff, 0xbfef);
}
- mode = gspca_dev->cam.cam_mode[(int) gspca_dev->curr_mode].mode;
+ mode = gspca_dev->cam.cam_mode[(int) gspca_dev->curr_mode].priv;
switch (sd->sensor) {
case SENSOR_HV7131R:
GammaT = hv7131r_gamma;
@@ -1870,7 +1886,7 @@ static void sd_close(struct gspca_dev *gspca_dev)
static void sd_pkt_scan(struct gspca_dev *gspca_dev,
struct gspca_frame *frame, /* target */
- unsigned char *data, /* isoc packet */
+ __u8 *data, /* isoc packet */
int len) /* iso pkt length */
{
struct sd *sd = (struct sd *) gspca_dev;
@@ -1936,13 +1952,13 @@ static int sd_querymenu(struct gspca_dev *gspca_dev,
case V4L2_CID_POWER_LINE_FREQUENCY:
switch (menu->index) {
case 0: /* V4L2_CID_POWER_LINE_FREQUENCY_DISABLED */
- strcpy(menu->name, "NoFliker");
+ strcpy((char *) menu->name, "NoFliker");
return 0;
case 1: /* V4L2_CID_POWER_LINE_FREQUENCY_50HZ */
- strcpy(menu->name, "50 Hz");
+ strcpy((char *) menu->name, "50 Hz");
return 0;
case 2: /* V4L2_CID_POWER_LINE_FREQUENCY_60HZ */
- strcpy(menu->name, "60 Hz");
+ strcpy((char *) menu->name, "60 Hz");
return 0;
}
break;
@@ -1951,7 +1967,7 @@ static int sd_querymenu(struct gspca_dev *gspca_dev,
}
/* sub-driver description */
-static struct sd_desc sd_desc = {
+static const struct sd_desc sd_desc = {
.name = MODULE_NAME,
.ctrls = sd_ctrls,
.nctrls = ARRAY_SIZE(sd_ctrls),
@@ -1967,7 +1983,7 @@ static struct sd_desc sd_desc = {
/* -- module initialisation -- */
#define DVNM(name) .driver_info = (kernel_ulong_t) name
-static __devinitdata struct usb_device_id device_table[] = {
+static const __devinitdata struct usb_device_id device_table[] = {
{USB_DEVICE(0x046d, 0x0892), DVNM("Logitech Orbicam")},
{USB_DEVICE(0x046d, 0x0896), DVNM("Logitech Orbicam")},
{USB_DEVICE(0x0ac8, 0x0321), DVNM("Vimicro generic vc0321")},
diff --git a/linux/drivers/media/video/gspca/zc3xx.c b/linux/drivers/media/video/gspca/zc3xx.c
index f8a49a493..72ae1e006 100644
--- a/linux/drivers/media/video/gspca/zc3xx.c
+++ b/linux/drivers/media/video/gspca/zc3xx.c
@@ -24,8 +24,8 @@
#include "gspca.h"
-#define DRIVER_VERSION_NUMBER KERNEL_VERSION(2, 1, 0)
-static const char version[] = "2.1.0";
+#define DRIVER_VERSION_NUMBER KERNEL_VERSION(2, 1, 5)
+static const char version[] = "2.1.5";
MODULE_AUTHOR("Michel Xhaard <mxhaard@users.sourceforge.net>, "
"Serge A. Suchkov <Serge.A.S@tochka.ru>");
@@ -173,14 +173,30 @@ static struct ctrl sd_ctrls[] = {
},
};
-static struct cam_mode vga_mode[] = {
- {V4L2_PIX_FMT_JPEG, 320, 240, 1},
- {V4L2_PIX_FMT_JPEG, 640, 480, 0},
+static struct v4l2_pix_format vga_mode[] = {
+ {320, 240, V4L2_PIX_FMT_JPEG, V4L2_FIELD_NONE,
+ .bytesperline = 320,
+ .sizeimage = 320 * 240 * 3 / 8 + 590,
+ .colorspace = V4L2_COLORSPACE_JPEG,
+ .priv = 1},
+ {640, 480, V4L2_PIX_FMT_JPEG, V4L2_FIELD_NONE,
+ .bytesperline = 640,
+ .sizeimage = 640 * 480 * 3 / 8 + 590,
+ .colorspace = V4L2_COLORSPACE_JPEG,
+ .priv = 0},
};
-static struct cam_mode sif_mode[] = {
- {V4L2_PIX_FMT_JPEG, 176, 144, 1},
- {V4L2_PIX_FMT_JPEG, 352, 288, 0},
+static struct v4l2_pix_format sif_mode[] = {
+ {176, 144, V4L2_PIX_FMT_JPEG, V4L2_FIELD_NONE,
+ .bytesperline = 176,
+ .sizeimage = 176 * 144 * 3 / 8 + 590,
+ .colorspace = V4L2_COLORSPACE_JPEG,
+ .priv = 1},
+ {352, 288, V4L2_PIX_FMT_JPEG, V4L2_FIELD_NONE,
+ .bytesperline = 352,
+ .sizeimage = 352 * 288 * 3 / 8 + 590,
+ .colorspace = V4L2_COLORSPACE_JPEG,
+ .priv = 0},
};
/* usb exchanges */
@@ -190,7 +206,7 @@ struct usb_action {
__u16 idx;
};
-static struct usb_action cs2102_Initial[] = {
+static const struct usb_action cs2102_Initial[] = {
{0xa1, 0x01, 0x0008},
{0xa1, 0x01, 0x0008},
{0xa0, 0x01, 0x0000},
@@ -320,7 +336,7 @@ static struct usb_action cs2102_Initial[] = {
{}
};
-static struct usb_action cs2102_InitialScale[] = {
+static const struct usb_action cs2102_InitialScale[] = {
{0xa1, 0x01, 0x0008},
{0xa1, 0x01, 0x0008},
{0xa0, 0x01, 0x0000},
@@ -449,7 +465,7 @@ static struct usb_action cs2102_InitialScale[] = {
{0xa0, 0x40, 0x0118},
{}
};
-static struct usb_action cs2102_50HZ[] = {
+static const struct usb_action cs2102_50HZ[] = {
{0xa0, 0x00, 0x0019}, /* 00,19,00,cc */
{0xaa, 0x0f, 0x008c}, /* 00,0f,8c,aa */
{0xaa, 0x03, 0x0005}, /* 00,03,05,aa */
@@ -474,7 +490,7 @@ static struct usb_action cs2102_50HZ[] = {
{0xa0, 0xd0, 0x001f}, /* 00,1f,d0,cc */
{}
};
-static struct usb_action cs2102_50HZScale[] = {
+static const struct usb_action cs2102_50HZScale[] = {
{0xa0, 0x00, 0x0019}, /* 00,19,00,cc */
{0xaa, 0x0f, 0x0093}, /* 00,0f,93,aa */
{0xaa, 0x03, 0x0005}, /* 00,03,05,aa */
@@ -499,7 +515,7 @@ static struct usb_action cs2102_50HZScale[] = {
{0xa0, 0xd0, 0x001f}, /* 00,1f,d0,cc */
{}
};
-static struct usb_action cs2102_60HZ[] = {
+static const struct usb_action cs2102_60HZ[] = {
{0xa0, 0x00, 0x0019}, /* 00,19,00,cc */
{0xaa, 0x0f, 0x005d}, /* 00,0f,5d,aa */
{0xaa, 0x03, 0x0005}, /* 00,03,05,aa */
@@ -524,7 +540,7 @@ static struct usb_action cs2102_60HZ[] = {
{0xa0, 0xd0, 0x00c8}, /* 00,c8,d0,cc */
{}
};
-static struct usb_action cs2102_60HZScale[] = {
+static const struct usb_action cs2102_60HZScale[] = {
{0xa0, 0x00, 0x0019}, /* 00,19,00,cc */
{0xaa, 0x0f, 0x00b7}, /* 00,0f,b7,aa */
{0xaa, 0x03, 0x0005}, /* 00,03,05,aa */
@@ -549,7 +565,7 @@ static struct usb_action cs2102_60HZScale[] = {
{0xa0, 0xe8, 0x001f}, /* 00,1f,e8,cc */
{}
};
-static struct usb_action cs2102_NoFliker[] = {
+static const struct usb_action cs2102_NoFliker[] = {
{0xa0, 0x00, 0x0019}, /* 00,19,00,cc */
{0xaa, 0x0f, 0x0059}, /* 00,0f,59,aa */
{0xaa, 0x03, 0x0005}, /* 00,03,05,aa */
@@ -574,7 +590,7 @@ static struct usb_action cs2102_NoFliker[] = {
{0xa0, 0xc8, 0x001f}, /* 00,1f,c8,cc */
{}
};
-static struct usb_action cs2102_NoFlikerScale[] = {
+static const struct usb_action cs2102_NoFlikerScale[] = {
{0xa0, 0x00, 0x0019}, /* 00,19,00,cc */
{0xaa, 0x0f, 0x0059}, /* 00,0f,59,aa */
{0xaa, 0x03, 0x0005}, /* 00,03,05,aa */
@@ -601,7 +617,7 @@ static struct usb_action cs2102_NoFlikerScale[] = {
};
/* CS2102_KOCOM */
-static struct usb_action cs2102K_Initial[] = {
+static const struct usb_action cs2102K_Initial[] = {
{0xa0, 0x11, 0x0002},
{0xa0, 0x03, 0x0008},
{0xa0, 0x08, 0x0010},
@@ -860,7 +876,7 @@ static struct usb_action cs2102K_Initial[] = {
{}
};
-static struct usb_action cs2102K_InitialScale[] = {
+static const struct usb_action cs2102K_InitialScale[] = {
{0xa0, 0x11, 0x0002},
{0xa0, 0x00, 0x0002},
{0xa0, 0x03, 0x0008},
@@ -1437,7 +1453,7 @@ static struct usb_action cs2102K_InitialScale[] = {
{}
};
-static struct usb_action gc0305_Initial[] = { /* 640x480 */
+static const struct usb_action gc0305_Initial[] = { /* 640x480 */
{0xa0, 0x01, 0x0000}, /* 00,00,01,cc */
{0xa0, 0x03, 0x0008}, /* 00,08,03,cc */
{0xa0, 0x01, 0x0010}, /* 00,10,01,cc */
@@ -1501,7 +1517,7 @@ static struct usb_action gc0305_Initial[] = { /* 640x480 */
{0xa0, 0x03, 0x0113}, /* 01,13,03,cc */
{}
};
-static struct usb_action gc0305_InitialScale[] = { /* 320x240 */
+static const struct usb_action gc0305_InitialScale[] = { /* 320x240 */
{0xa0, 0x01, 0x0000}, /* 00,00,01,cc */
{0xa0, 0x03, 0x0008}, /* 00,08,03,cc */
{0xa0, 0x01, 0x0010}, /* 00,10,01,cc */
@@ -1564,7 +1580,7 @@ static struct usb_action gc0305_InitialScale[] = { /* 320x240 */
{0xa0, 0x03, 0x0113}, /* 01,13,03,cc */
{}
};
-static struct usb_action gc0305_50HZ[] = {
+static const struct usb_action gc0305_50HZ[] = {
{0xaa, 0x82, 0x0000}, /* 00,82,00,aa */
{0xaa, 0x83, 0x0002}, /* 00,83,02,aa */
{0xaa, 0x84, 0x0038}, /* 00,84,38,aa */ /* win: 00,84,ec */
@@ -1587,7 +1603,7 @@ static struct usb_action gc0305_50HZ[] = {
/* {0xa0, 0x85, 0x018d}, * 01,8d,85,cc * * if 640x480 */
{}
};
-static struct usb_action gc0305_60HZ[] = {
+static const struct usb_action gc0305_60HZ[] = {
{0xaa, 0x82, 0x0000}, /* 00,82,00,aa */
{0xaa, 0x83, 0x0000}, /* 00,83,00,aa */
{0xaa, 0x84, 0x00ec}, /* 00,84,ec,aa */
@@ -1611,7 +1627,7 @@ static struct usb_action gc0305_60HZ[] = {
{}
};
-static struct usb_action gc0305_NoFliker[] = {
+static const struct usb_action gc0305_NoFliker[] = {
{0xa0, 0x0c, 0x0100}, /* 01,00,0c,cc */
{0xaa, 0x82, 0x0000}, /* 00,82,00,aa */
{0xaa, 0x83, 0x0000}, /* 00,83,00,aa */
@@ -1635,7 +1651,7 @@ static struct usb_action gc0305_NoFliker[] = {
};
/* play poker with registers at your own risk !! */
-static struct usb_action hdcs2020xx_Initial[] = {
+static const struct usb_action hdcs2020xx_Initial[] = {
{0xa0, 0x01, 0x0000},
{0xa0, 0x03, 0x0008},
{0xa0, 0x0e, 0x0010},
@@ -1780,7 +1796,7 @@ static struct usb_action hdcs2020xx_Initial[] = {
{}
};
-static struct usb_action hdcs2020xx_InitialScale[] = {
+static const struct usb_action hdcs2020xx_InitialScale[] = {
{0xa0, 0x01, 0x0000},
{0xa0, 0x03, 0x0008},
{0xa0, 0x0e, 0x0010},
@@ -1922,7 +1938,7 @@ static struct usb_action hdcs2020xx_InitialScale[] = {
/* {0xa0, 0x18, 0x00fe}, */
{}
};
-static struct usb_action hdcs2020xb_Initial[] = {
+static const struct usb_action hdcs2020xb_Initial[] = {
{0xa0, 0x01, 0x0000},
{0xa0, 0x11, 0x0002},
{0xa0, 0x03, 0x0008}, /* qtable 0x05 */
@@ -2054,7 +2070,7 @@ static struct usb_action hdcs2020xb_Initial[] = {
{0xa0, 0x40, 0x0118},
{}
};
-static struct usb_action hdcs2020xb_InitialScale[] = {
+static const struct usb_action hdcs2020xb_InitialScale[] = {
{0xa0, 0x01, 0x0000},
{0xa0, 0x00, 0x0002},
{0xa0, 0x03, 0x0008},
@@ -2182,7 +2198,7 @@ static struct usb_action hdcs2020xb_InitialScale[] = {
{0xa0, 0x40, 0x0118},
{}
};
-static struct usb_action hdcs2020b_50HZ[] = {
+static const struct usb_action hdcs2020b_50HZ[] = {
{0xa0, 0x00, 0x0019}, /* 00,19,00,cc */
{0xaa, 0x13, 0x0018}, /* 00,13,18,aa */
{0xaa, 0x14, 0x0001}, /* 00,14,01,aa */
@@ -2203,7 +2219,7 @@ static struct usb_action hdcs2020b_50HZ[] = {
{0xa0, 0x2f, 0x001f}, /* 00,1f,2f,cc */
{}
};
-static struct usb_action hdcs2020b_60HZ[] = {
+static const struct usb_action hdcs2020b_60HZ[] = {
{0xa0, 0x00, 0x0019}, /* 00,19,00,cc */
{0xaa, 0x13, 0x0031}, /* 00,13,31,aa */
{0xaa, 0x14, 0x0001}, /* 00,14,01,aa */
@@ -2224,7 +2240,7 @@ static struct usb_action hdcs2020b_60HZ[] = {
{0xa0, 0x2c, 0x001f}, /* 00,1f,2c,cc */
{}
};
-static struct usb_action hdcs2020b_NoFliker[] = {
+static const struct usb_action hdcs2020b_NoFliker[] = {
{0xa0, 0x00, 0x0019}, /* 00,19,00,cc */
{0xaa, 0x13, 0x0010}, /* 00,13,10,aa */
{0xaa, 0x14, 0x0001}, /* 00,14,01,aa */
@@ -2246,7 +2262,7 @@ static struct usb_action hdcs2020b_NoFliker[] = {
{}
};
-static struct usb_action hv7131bxx_Initial[] = {
+static const struct usb_action hv7131bxx_Initial[] = {
{0xa0, 0x01, 0x0000},
{0xa0, 0x10, 0x0002},
{0xa0, 0x00, 0x0010},
@@ -2354,7 +2370,7 @@ static struct usb_action hv7131bxx_Initial[] = {
{}
};
-static struct usb_action hv7131bxx_InitialScale[] = {
+static const struct usb_action hv7131bxx_InitialScale[] = {
{0xa0, 0x01, 0x0000},
{0xa0, 0x00, 0x0002},
{0xa0, 0x00, 0x0010},
@@ -2460,7 +2476,7 @@ static struct usb_action hv7131bxx_InitialScale[] = {
{}
};
-static struct usb_action hv7131cxx_Initial[] = {
+static const struct usb_action hv7131cxx_Initial[] = {
{0xa0, 0x01, 0x0000},
{0xa0, 0x10, 0x0002},
{0xa0, 0x01, 0x0010},
@@ -2554,7 +2570,7 @@ static struct usb_action hv7131cxx_Initial[] = {
{}
};
-static struct usb_action hv7131cxx_InitialScale[] = {
+static const struct usb_action hv7131cxx_InitialScale[] = {
{0xa0, 0x01, 0x0000},
{0xa0, 0x00, 0x0002}, /* diff */
@@ -2655,7 +2671,7 @@ static struct usb_action hv7131cxx_InitialScale[] = {
{}
};
-static struct usb_action icm105axx_Initial[] = {
+static const struct usb_action icm105axx_Initial[] = {
{0xa0, 0x01, 0x0000},
{0xa0, 0x10, 0x0002},
{0xa0, 0x03, 0x0008},
@@ -2832,7 +2848,7 @@ static struct usb_action icm105axx_Initial[] = {
{}
};
-static struct usb_action icm105axx_InitialScale[] = {
+static const struct usb_action icm105axx_InitialScale[] = {
{0xa0, 0x01, 0x0000},
{0xa0, 0x00, 0x0002},
{0xa0, 0x03, 0x0008},
@@ -3011,7 +3027,7 @@ static struct usb_action icm105axx_InitialScale[] = {
{0xa0, 0x40, 0x0118},
{}
};
-static struct usb_action icm105a_50HZ[] = {
+static const struct usb_action icm105a_50HZ[] = {
{0xa0, 0x00, 0x0019}, /* 00,19,00,cc */
{0xaa, 0x0d, 0x0003}, /* 00,0d,03,aa */
{0xaa, 0x0c, 0x0020}, /* 00,0c,20,aa */
@@ -3042,7 +3058,7 @@ static struct usb_action icm105a_50HZ[] = {
{0xa0, 0xff, 0x0020}, /* 00,20,ff,cc */
{}
};
-static struct usb_action icm105a_50HZScale[] = {
+static const struct usb_action icm105a_50HZScale[] = {
{0xa0, 0x00, 0x0019}, /* 00,19,00,cc */
{0xaa, 0x0d, 0x0003}, /* 00,0d,03,aa */
{0xaa, 0x0c, 0x008c}, /* 00,0c,8c,aa */
@@ -3075,7 +3091,7 @@ static struct usb_action icm105a_50HZScale[] = {
{0xa0, 0xc0, 0x01a8}, /* 01,a8,c0,cc */
{}
};
-static struct usb_action icm105a_60HZ[] = {
+static const struct usb_action icm105a_60HZ[] = {
{0xa0, 0x00, 0x0019}, /* 00,19,00,cc */
{0xaa, 0x0d, 0x0003}, /* 00,0d,03,aa */
{0xaa, 0x0c, 0x0004}, /* 00,0c,04,aa */
@@ -3106,7 +3122,7 @@ static struct usb_action icm105a_60HZ[] = {
{0xa0, 0xff, 0x0020}, /* 00,20,ff,cc */
{}
};
-static struct usb_action icm105a_60HZScale[] = {
+static const struct usb_action icm105a_60HZScale[] = {
{0xa0, 0x00, 0x0019}, /* 00,19,00,cc */
{0xaa, 0x0d, 0x0003}, /* 00,0d,03,aa */
{0xaa, 0x0c, 0x0008}, /* 00,0c,08,aa */
@@ -3139,7 +3155,7 @@ static struct usb_action icm105a_60HZScale[] = {
{0xa0, 0xc0, 0x01a8}, /* 01,a8,c0,cc */
{}
};
-static struct usb_action icm105a_NoFliker[] = {
+static const struct usb_action icm105a_NoFliker[] = {
{0xa0, 0x00, 0x0019}, /* 00,19,00,cc */
{0xaa, 0x0d, 0x0003}, /* 00,0d,03,aa */
{0xaa, 0x0c, 0x0004}, /* 00,0c,04,aa */
@@ -3170,7 +3186,7 @@ static struct usb_action icm105a_NoFliker[] = {
{0xa0, 0xff, 0x0020}, /* 00,20,ff,cc */
{}
};
-static struct usb_action icm105a_NoFlikerScale[] = {
+static const struct usb_action icm105a_NoFlikerScale[] = {
{0xa0, 0x00, 0x0019}, /* 00,19,00,cc */
{0xaa, 0x0d, 0x0003}, /* 00,0d,03,aa */
{0xaa, 0x0c, 0x0004}, /* 00,0c,04,aa */
@@ -3204,7 +3220,7 @@ static struct usb_action icm105a_NoFlikerScale[] = {
{}
};
-static struct usb_action MC501CB_InitialScale[] = {
+static const struct usb_action MC501CB_InitialScale[] = {
{0xa0, 0x01, 0x0000}, /* 00,00,01,cc */
{0xa0, 0x00, 0x0002}, /* 00,02,00,cc */
{0xa0, 0x01, 0x0010}, /* 00,10,01,cc */
@@ -3324,7 +3340,7 @@ static struct usb_action MC501CB_InitialScale[] = {
{}
};
-static struct usb_action MC501CB_Initial[] = { /* 320x240 */
+static const struct usb_action MC501CB_Initial[] = { /* 320x240 */
{0xa0, 0x01, 0x0000}, /* 00,00,01,cc */
{0xa0, 0x10, 0x0002}, /* 00,02,10,cc */
{0xa0, 0x01, 0x0010}, /* 00,10,01,cc */
@@ -3443,7 +3459,7 @@ static struct usb_action MC501CB_Initial[] = { /* 320x240 */
{}
};
-static struct usb_action MC501CB_50HZ[] = {
+static const struct usb_action MC501CB_50HZ[] = {
{0xaa, 0x03, 0x0003}, /* 00,03,03,aa */
{0xaa, 0x10, 0x00fc}, /* 00,10,fc,aa */
{0xaa, 0x36, 0x001d}, /* 00,36,1D,aa */
@@ -3460,7 +3476,7 @@ static struct usb_action MC501CB_50HZ[] = {
{}
};
-static struct usb_action MC501CB_50HZScale[] = {
+static const struct usb_action MC501CB_50HZScale[] = {
{0xaa, 0x03, 0x0003}, /* 00,03,03,aa */
{0xaa, 0x10, 0x00fc}, /* 00,10,fc,aa */
{0xaa, 0x36, 0x003a}, /* 00,36,3A,aa */
@@ -3477,7 +3493,7 @@ static struct usb_action MC501CB_50HZScale[] = {
{}
};
-static struct usb_action MC501CB_60HZ[] = {
+static const struct usb_action MC501CB_60HZ[] = {
{0xaa, 0x03, 0x0003}, /* 00,03,03,aa */
{0xaa, 0x10, 0x00fc}, /* 00,10,fc,aa */
{0xaa, 0x36, 0x0018}, /* 00,36,18,aa */
@@ -3494,7 +3510,7 @@ static struct usb_action MC501CB_60HZ[] = {
{}
};
-static struct usb_action MC501CB_60HZScale[] = {
+static const struct usb_action MC501CB_60HZScale[] = {
{0xaa, 0x03, 0x0003}, /* 00,03,03,aa */
{0xaa, 0x10, 0x00fc}, /* 00,10,fc,aa */
{0xaa, 0x36, 0x0030}, /* 00,36,30,aa */
@@ -3511,7 +3527,7 @@ static struct usb_action MC501CB_60HZScale[] = {
{}
};
-static struct usb_action MC501CB_NoFliker[] = {
+static const struct usb_action MC501CB_NoFliker[] = {
{0xaa, 0x03, 0x0003}, /* 00,03,03,aa */
{0xaa, 0x10, 0x00fc}, /* 00,10,fc,aa */
{0xaa, 0x36, 0x0018}, /* 00,36,18,aa */
@@ -3528,7 +3544,7 @@ static struct usb_action MC501CB_NoFliker[] = {
{}
};
-static struct usb_action MC501CB_NoFlikerScale[] = {
+static const struct usb_action MC501CB_NoFlikerScale[] = {
{0xaa, 0x03, 0x0003}, /* 00,03,03,aa */
{0xaa, 0x10, 0x00fc}, /* 00,10,fc,aa */
{0xaa, 0x36, 0x0030}, /* 00,36,30,aa */
@@ -3541,7 +3557,7 @@ static struct usb_action MC501CB_NoFlikerScale[] = {
};
/* from zs211.inf - HKR,%OV7620%,Initial - 640x480 */
-static struct usb_action OV7620_mode0[] = {
+static const struct usb_action OV7620_mode0[] = {
{0xa0, 0x01, 0x0000}, /* 00,00,01,cc */
{0xa0, 0x40, 0x0002}, /* 00,02,40,cc */
#if 1 /*jfm*/
@@ -3616,7 +3632,7 @@ static struct usb_action OV7620_mode0[] = {
};
/* from zs211.inf - HKR,%OV7620%,InitialScale - 320x240 */
-static struct usb_action OV7620_mode1[] = {
+static const struct usb_action OV7620_mode1[] = {
{0xa0, 0x01, 0x0000}, /* 00,00,01,cc */
{0xa0, 0x50, 0x0002}, /* 00,02,50,cc */
{0xa0, 0x03, 0x0008}, /* 00,08,00,cc */ /* mx change? */
@@ -3687,7 +3703,7 @@ static struct usb_action OV7620_mode1[] = {
};
/* from zs211.inf - HKR,%OV7620%\AE,50HZ */
-static struct usb_action OV7620_50HZ[] = {
+static const struct usb_action OV7620_50HZ[] = {
{0xaa, 0x13, 0x00a3}, /* 00,13,a3,aa */
{0xdd, 0x00, 0x0100}, /* 00,01,00,dd */
{0xaa, 0x2b, 0x0096}, /* 00,2b,96,aa */
@@ -3706,7 +3722,7 @@ static struct usb_action OV7620_50HZ[] = {
};
/* from zs211.inf - HKR,%OV7620%\AE,60HZ */
-static struct usb_action OV7620_60HZ[] = {
+static const struct usb_action OV7620_60HZ[] = {
{0xaa, 0x13, 0x00a3}, /* 00,13,a3,aa */ /* (bug in zs211.inf) */
{0xdd, 0x00, 0x0100}, /* 00,01,00,dd */
{0xaa, 0x2b, 0x0000}, /* 00,2b,00,aa */
@@ -3728,7 +3744,7 @@ static struct usb_action OV7620_60HZ[] = {
};
/* from zs211.inf - HKR,%OV7620%\AE,NoFliker */
-static struct usb_action OV7620_NoFliker[] = {
+static const struct usb_action OV7620_NoFliker[] = {
{0xaa, 0x13, 0x00a3}, /* 00,13,a3,aa */ /* (bug in zs211.inf) */
{0xdd, 0x00, 0x0100}, /* 00,01,00,dd */
{0xaa, 0x2b, 0x0000}, /* 00,2b,00,aa */
@@ -3747,7 +3763,7 @@ static struct usb_action OV7620_NoFliker[] = {
{}
};
-static struct usb_action ov7630c_Initial[] = {
+static const struct usb_action ov7630c_Initial[] = {
{0xa0, 0x01, 0x0000},
{0xa0, 0x10, 0x0002},
{0xa0, 0x01, 0x0000},
@@ -3904,7 +3920,7 @@ static struct usb_action ov7630c_Initial[] = {
{}
};
-static struct usb_action ov7630c_InitialScale[] = {
+static const struct usb_action ov7630c_InitialScale[] = {
{0xa0, 0x01, 0x0000},
{0xa0, 0x00, 0x0002},
{0xa0, 0x03, 0x0008},
@@ -4061,7 +4077,7 @@ static struct usb_action ov7630c_InitialScale[] = {
{}
};
-static struct usb_action pas106b_Initial_com[] = {
+static const struct usb_action pas106b_Initial_com[] = {
/* Sream and Sensor specific */
{0xa1, 0x01, 0x0010}, /* CMOSSensorSelect */
/* System */
@@ -4075,7 +4091,7 @@ static struct usb_action pas106b_Initial_com[] = {
{}
};
-static struct usb_action pas106b_Initial[] = { /* 176x144 */
+static const struct usb_action pas106b_Initial[] = { /* 176x144 */
/* JPEG control */
{0xa0, 0x03, 0x0008}, /* ClockSetting */
/* Sream and Sensor specific */
@@ -4193,7 +4209,7 @@ static struct usb_action pas106b_Initial[] = { /* 176x144 */
{}
};
-static struct usb_action pas106b_InitialScale[] = { /* 352x288 */
+static const struct usb_action pas106b_InitialScale[] = { /* 352x288 */
/* JPEG control */
{0xa0, 0x03, 0x0008}, /* ClockSetting */
/* Sream and Sensor specific */
@@ -4316,7 +4332,7 @@ static struct usb_action pas106b_InitialScale[] = { /* 352x288 */
{0xa0, 0xff, 0x0018}, /* Frame adjust */
{}
};
-static struct usb_action pas106b_50HZ[] = {
+static const struct usb_action pas106b_50HZ[] = {
{0xa0, 0x00, 0x0190}, /* 01,90,00,cc */
{0xa0, 0x06, 0x0191}, /* 01,91,06,cc */
{0xa0, 0x54, 0x0192}, /* 01,92,54,cc */
@@ -4332,7 +4348,7 @@ static struct usb_action pas106b_50HZ[] = {
{0xa0, 0x04, 0x01a9}, /* 01,a9,04,cc */
{}
};
-static struct usb_action pas106b_60HZ[] = {
+static const struct usb_action pas106b_60HZ[] = {
{0xa0, 0x00, 0x0190}, /* 01,90,00,cc */
{0xa0, 0x06, 0x0191}, /* 01,91,06,cc */
{0xa0, 0x2e, 0x0192}, /* 01,92,2e,cc */
@@ -4348,7 +4364,7 @@ static struct usb_action pas106b_60HZ[] = {
{0xa0, 0x04, 0x01a9}, /* 01,a9,04,cc */
{}
};
-static struct usb_action pas106b_NoFliker[] = {
+static const struct usb_action pas106b_NoFliker[] = {
{0xa0, 0x00, 0x0190}, /* 01,90,00,cc */
{0xa0, 0x06, 0x0191}, /* 01,91,06,cc */
{0xa0, 0x50, 0x0192}, /* 01,92,50,cc */
@@ -4365,7 +4381,7 @@ static struct usb_action pas106b_NoFliker[] = {
{}
};
-static struct usb_action pb03303x_Initial[] = {
+static const struct usb_action pb03303x_Initial[] = {
{0xa0, 0x01, 0x0000},
{0xa0, 0x03, 0x0008},
{0xa0, 0x0a, 0x0010},
@@ -4511,7 +4527,7 @@ static struct usb_action pb03303x_Initial[] = {
{}
};
-static struct usb_action pb03303x_InitialScale[] = {
+static const struct usb_action pb03303x_InitialScale[] = {
{0xa0, 0x01, 0x0000},
{0xa0, 0x03, 0x0008},
{0xa0, 0x0a, 0x0010},
@@ -4659,7 +4675,7 @@ static struct usb_action pb03303x_InitialScale[] = {
{0xa0, 0x42, 0x0180},
{}
};
-static struct usb_action pb0330xx_Initial[] = {
+static const struct usb_action pb0330xx_Initial[] = {
{0xa1, 0x01, 0x0008},
{0xa1, 0x01, 0x0008},
{0xa0, 0x01, 0x0000},
@@ -4774,7 +4790,7 @@ static struct usb_action pb0330xx_Initial[] = {
{}
};
-static struct usb_action pb0330xx_InitialScale[] = {
+static const struct usb_action pb0330xx_InitialScale[] = {
{0xa1, 0x01, 0x0008},
{0xa1, 0x01, 0x0008},
{0xa0, 0x01, 0x0000},
@@ -4887,7 +4903,7 @@ static struct usb_action pb0330xx_InitialScale[] = {
/* {0xa0, 0x00, 0x0007}, */
{}
};
-static struct usb_action pb0330_50HZ[] = {
+static const struct usb_action pb0330_50HZ[] = {
{0xa0, 0x00, 0x0190}, /* 01,90,00,cc */
{0xa0, 0x07, 0x0191}, /* 01,91,07,cc */
{0xa0, 0xee, 0x0192}, /* 01,92,ee,cc */
@@ -4903,7 +4919,7 @@ static struct usb_action pb0330_50HZ[] = {
{0xa0, 0xc8, 0x001f}, /* 00,1f,c8,cc */
{}
};
-static struct usb_action pb0330_50HZScale[] = {
+static const struct usb_action pb0330_50HZScale[] = {
{0xa0, 0x00, 0x0019}, /* 00,19,00,cc */
{0xa0, 0x00, 0x0190}, /* 01,90,00,cc */
{0xa0, 0x07, 0x0191}, /* 01,91,07,cc */
@@ -4920,7 +4936,7 @@ static struct usb_action pb0330_50HZScale[] = {
{0xa0, 0xf8, 0x001f}, /* 00,1f,f8,cc */
{}
};
-static struct usb_action pb0330_60HZ[] = {
+static const struct usb_action pb0330_60HZ[] = {
{0xa0, 0x00, 0x0019}, /* 00,19,00,cc */
{0xa0, 0x00, 0x0190}, /* 01,90,00,cc */
{0xa0, 0x07, 0x0191}, /* 01,91,07,cc */
@@ -4937,7 +4953,7 @@ static struct usb_action pb0330_60HZ[] = {
{0xa0, 0x90, 0x001f}, /* 00,1f,90,cc */
{}
};
-static struct usb_action pb0330_60HZScale[] = {
+static const struct usb_action pb0330_60HZScale[] = {
{0xa0, 0x00, 0x0019}, /* 00,19,00,cc */
{0xa0, 0x00, 0x0190}, /* 01,90,00,cc */
{0xa0, 0x07, 0x0191}, /* 01,91,07,cc */
@@ -4954,7 +4970,7 @@ static struct usb_action pb0330_60HZScale[] = {
{0xa0, 0x90, 0x001f}, /* 00,1f,90,cc */
{}
};
-static struct usb_action pb0330_NoFliker[] = {
+static const struct usb_action pb0330_NoFliker[] = {
{0xa0, 0x00, 0x0019}, /* 00,19,00,cc */
{0xa0, 0x00, 0x0190}, /* 01,90,00,cc */
{0xa0, 0x07, 0x0191}, /* 01,91,07,cc */
@@ -4971,7 +4987,7 @@ static struct usb_action pb0330_NoFliker[] = {
{0xa0, 0x90, 0x001f}, /* 00,1f,90,cc */
{}
};
-static struct usb_action pb0330_NoFlikerScale[] = {
+static const struct usb_action pb0330_NoFlikerScale[] = {
{0xa0, 0x00, 0x0019}, /* 00,19,00,cc */
{0xa0, 0x00, 0x0190}, /* 01,90,00,cc */
{0xa0, 0x07, 0x0191}, /* 01,91,07,cc */
@@ -4990,7 +5006,7 @@ static struct usb_action pb0330_NoFlikerScale[] = {
};
/* from oem9.inf - HKR,%PO2030%,Initial - 640x480 - (close to CS2102) */
-static struct usb_action PO2030_mode0[] = {
+static const struct usb_action PO2030_mode0[] = {
{0xa0, 0x01, 0x0000}, /* 00,00,01,cc */
{0xa0, 0x04, 0x0002}, /* 00,02,04,cc */
{0xa0, 0x01, 0x0010}, /* 00,10,01,cc */
@@ -5067,7 +5083,7 @@ static struct usb_action PO2030_mode0[] = {
};
/* from oem9.inf - HKR,%PO2030%,InitialScale - 320x240 */
-static struct usb_action PO2030_mode1[] = {
+static const struct usb_action PO2030_mode1[] = {
{0xa0, 0x01, 0x0000}, /* 00,00,01,cc */
{0xa0, 0x10, 0x0002}, /* 00,02,10,cc */
{0xa0, 0x01, 0x0010}, /* 00,10,01,cc */
@@ -5143,7 +5159,7 @@ static struct usb_action PO2030_mode1[] = {
{}
};
-static struct usb_action PO2030_50HZ[] = {
+static const struct usb_action PO2030_50HZ[] = {
{0xaa, 0x8d, 0x0008}, /* 00,8d,08,aa */
{0xaa, 0x1a, 0x0001}, /* 00,1a,01,aa */
{0xaa, 0x1b, 0x000a}, /* 00,1b,0a,aa */
@@ -5165,7 +5181,7 @@ static struct usb_action PO2030_50HZ[] = {
{}
};
-static struct usb_action PO2030_60HZ[] = {
+static const struct usb_action PO2030_60HZ[] = {
{0xaa, 0x8d, 0x0008}, /* 00,8d,08,aa */
{0xaa, 0x1a, 0x0000}, /* 00,1a,00,aa */
{0xaa, 0x1b, 0x00de}, /* 00,1b,de,aa */
@@ -5187,7 +5203,7 @@ static struct usb_action PO2030_60HZ[] = {
{}
};
-static struct usb_action PO2030_NoFliker[] = {
+static const struct usb_action PO2030_NoFliker[] = {
{0xa0, 0x02, 0x0180}, /* 01,80,02,cc */
{0xaa, 0x8d, 0x000d}, /* 00,8d,0d,aa */
{0xaa, 0x1a, 0x0000}, /* 00,1a,00,aa */
@@ -5199,7 +5215,7 @@ static struct usb_action PO2030_NoFliker[] = {
};
/* TEST */
-static struct usb_action tas5130CK_Initial[] = {
+static const struct usb_action tas5130CK_Initial[] = {
{0xa0, 0x01, 0x0000},
{0xa0, 0x01, 0x003b},
{0xa0, 0x0e, 0x003a},
@@ -5402,7 +5418,7 @@ static struct usb_action tas5130CK_Initial[] = {
{}
};
-static struct usb_action tas5130CK_InitialScale[] = {
+static const struct usb_action tas5130CK_InitialScale[] = {
{0xa0, 0x01, 0x0000},
{0xa0, 0x01, 0x003b},
{0xa0, 0x0e, 0x003a},
@@ -5610,7 +5626,7 @@ static struct usb_action tas5130CK_InitialScale[] = {
{}
};
-static struct usb_action tas5130cxx_Initial[] = {
+static const struct usb_action tas5130cxx_Initial[] = {
{0xa0, 0x01, 0x0000},
{0xa0, 0x50, 0x0002},
{0xa0, 0x03, 0x0008},
@@ -5699,7 +5715,7 @@ static struct usb_action tas5130cxx_Initial[] = {
{0xa0, 0x42, 0x0180},
{}
};
-static struct usb_action tas5130cxx_InitialScale[] = {
+static const struct usb_action tas5130cxx_InitialScale[] = {
{0xa0, 0x01, 0x0000},
{0xa0, 0x01, 0x0000},
{0xa0, 0x40, 0x0002},
@@ -5789,7 +5805,7 @@ static struct usb_action tas5130cxx_InitialScale[] = {
{0xa0, 0x42, 0x0180},
{}
};
-static struct usb_action tas5130cxx_50HZ[] = {
+static const struct usb_action tas5130cxx_50HZ[] = {
{0xa0, 0x00, 0x0019}, /* 00,19,00,cc */
{0xaa, 0xa3, 0x0001}, /* 00,a3,01,aa */
{0xaa, 0xa4, 0x0063}, /* 00,a4,63,aa */
@@ -5812,7 +5828,7 @@ static struct usb_action tas5130cxx_50HZ[] = {
{0xa0, 0x03, 0x009f}, /* 00,9f,03,cc */
{}
};
-static struct usb_action tas5130cxx_50HZScale[] = {
+static const struct usb_action tas5130cxx_50HZScale[] = {
{0xa0, 0x00, 0x0019}, /* 00,19,00,cc */
{0xaa, 0xa3, 0x0001}, /* 00,a3,01,aa */
{0xaa, 0xa4, 0x0077}, /* 00,a4,77,aa */
@@ -5835,7 +5851,7 @@ static struct usb_action tas5130cxx_50HZScale[] = {
{0xa0, 0x03, 0x009f}, /* 00,9f,03,cc */
{}
};
-static struct usb_action tas5130cxx_60HZ[] = {
+static const struct usb_action tas5130cxx_60HZ[] = {
{0xa0, 0x00, 0x0019}, /* 00,19,00,cc */
{0xaa, 0xa3, 0x0001}, /* 00,a3,01,aa */
{0xaa, 0xa4, 0x0036}, /* 00,a4,36,aa */
@@ -5858,7 +5874,7 @@ static struct usb_action tas5130cxx_60HZ[] = {
{0xa0, 0x03, 0x009f}, /* 00,9f,03,cc */
{}
};
-static struct usb_action tas5130cxx_60HZScale[] = {
+static const struct usb_action tas5130cxx_60HZScale[] = {
{0xa0, 0x00, 0x0019}, /* 00,19,00,cc */
{0xaa, 0xa3, 0x0001}, /* 00,a3,01,aa */
{0xaa, 0xa4, 0x0077}, /* 00,a4,77,aa */
@@ -5881,7 +5897,7 @@ static struct usb_action tas5130cxx_60HZScale[] = {
{0xa0, 0x03, 0x009f}, /* 00,9f,03,cc */
{}
};
-static struct usb_action tas5130cxx_NoFliker[] = {
+static const struct usb_action tas5130cxx_NoFliker[] = {
{0xa0, 0x00, 0x0019}, /* 00,19,00,cc */
{0xaa, 0xa3, 0x0001}, /* 00,a3,01,aa */
{0xaa, 0xa4, 0x0040}, /* 00,a4,40,aa */
@@ -5905,7 +5921,7 @@ static struct usb_action tas5130cxx_NoFliker[] = {
{}
};
-static struct usb_action tas5130cxx_NoFlikerScale[] = {
+static const struct usb_action tas5130cxx_NoFlikerScale[] = {
{0xa0, 0x00, 0x0019}, /* 00,19,00,cc */
{0xaa, 0xa3, 0x0001}, /* 00,a3,01,aa */
{0xaa, 0xa4, 0x0090}, /* 00,a4,90,aa */
@@ -5929,7 +5945,7 @@ static struct usb_action tas5130cxx_NoFlikerScale[] = {
{}
};
-static struct usb_action tas5130c_vf0250_Initial[] = {
+static const struct usb_action tas5130c_vf0250_Initial[] = {
{0xa0, 0x01, 0x0000}, /* 00,00,01,cc, */
{0xa0, 0x02, 0x0008}, /* 00,08,02,cc, */
{0xa0, 0x01, 0x0010}, /* 00,10,01,cc, */
@@ -5993,7 +6009,7 @@ static struct usb_action tas5130c_vf0250_Initial[] = {
{}
};
-static struct usb_action tas5130c_vf0250_InitialScale[] = {
+static const struct usb_action tas5130c_vf0250_InitialScale[] = {
{0xa0, 0x01, 0x0000}, /* 00,00,01,cc, */
{0xa0, 0x02, 0x0008}, /* 00,08,02,cc, */
{0xa0, 0x01, 0x0010}, /* 00,10,01,cc, */
@@ -6057,7 +6073,7 @@ static struct usb_action tas5130c_vf0250_InitialScale[] = {
{}
};
/* "50HZ" light frequency banding filter */
-static struct usb_action tas5130c_vf0250_50HZ[] = {
+static const struct usb_action tas5130c_vf0250_50HZ[] = {
{0xaa, 0x82, 0x0000}, /* 00,82,00,aa */
{0xaa, 0x83, 0x0001}, /* 00,83,01,aa */
{0xaa, 0x84, 0x00aa}, /* 00,84,aa,aa */
@@ -6082,7 +6098,7 @@ static struct usb_action tas5130c_vf0250_50HZ[] = {
};
/* "50HZScale" light frequency banding filter */
-static struct usb_action tas5130c_vf0250_50HZScale[] = {
+static const struct usb_action tas5130c_vf0250_50HZScale[] = {
{0xaa, 0x82, 0x0000}, /* 00,82,00,aa */
{0xaa, 0x83, 0x0003}, /* 00,83,03,aa */
{0xaa, 0x84, 0x0054}, /* 00,84,54,aa */
@@ -6107,7 +6123,7 @@ static struct usb_action tas5130c_vf0250_50HZScale[] = {
};
/* "60HZ" light frequency banding filter */
-static struct usb_action tas5130c_vf0250_60HZ[] = {
+static const struct usb_action tas5130c_vf0250_60HZ[] = {
{0xaa, 0x82, 0x0000}, /* 00,82,00,aa */
{0xaa, 0x83, 0x0001}, /* 00,83,01,aa */
{0xaa, 0x84, 0x0062}, /* 00,84,62,aa */
@@ -6132,7 +6148,7 @@ static struct usb_action tas5130c_vf0250_60HZ[] = {
};
/* "60HZScale" light frequency banding ilter */
-static struct usb_action tas5130c_vf0250_60HZScale[] = {
+static const struct usb_action tas5130c_vf0250_60HZScale[] = {
{0xaa, 0x82, 0x0000}, /* 00,82,00,aa */
{0xaa, 0x83, 0x0002}, /* 00,83,02,aa */
{0xaa, 0x84, 0x00c4}, /* 00,84,c4,aa */
@@ -6157,7 +6173,7 @@ static struct usb_action tas5130c_vf0250_60HZScale[] = {
};
/* "NoFliker" light frequency banding flter */
-static struct usb_action tas5130c_vf0250_NoFliker[] = {
+static const struct usb_action tas5130c_vf0250_NoFliker[] = {
{0xa0, 0x0c, 0x0100}, /* 01,00,0c,cc, */
{0xaa, 0x82, 0x0000}, /* 00,82,00,aa */
{0xaa, 0x83, 0x0000}, /* 00,83,00,aa */
@@ -6180,7 +6196,7 @@ static struct usb_action tas5130c_vf0250_NoFliker[] = {
};
/* "NoFlikerScale" light frequency banding filter */
-static struct usb_action tas5130c_vf0250_NoFlikerScale[] = {
+static const struct usb_action tas5130c_vf0250_NoFlikerScale[] = {
{0xa0, 0x0c, 0x0100}, /* 01,00,0c,cc, */
{0xaa, 0x82, 0x0000}, /* 00,82,00,aa */
{0xaa, 0x83, 0x0000}, /* 00,83,00,aa */
@@ -6276,7 +6292,7 @@ static __u8 i2c_write(struct usb_device *dev,
}
static void usb_exchange(struct usb_device *dev,
- struct usb_action *action)
+ const struct usb_action *action)
{
__u8 buffread;
@@ -6308,12 +6324,12 @@ static void setmatrix(struct gspca_dev *gspca_dev)
{
struct sd *sd = (struct sd *) gspca_dev;
int i;
- __u8 *matrix;
- static __u8 gc0305_matrix[9] =
+ const __u8 *matrix;
+ static const __u8 gc0305_matrix[9] =
{0x50, 0xf8, 0xf8, 0xf8, 0x50, 0xf8, 0xf8, 0xf8, 0x50};
- static __u8 ov7620_matrix[9] =
+ static const __u8 ov7620_matrix[9] =
{0x58, 0xf4, 0xf4, 0xf4, 0x58, 0xf4, 0xf4, 0xf4, 0x58};
- static __u8 po2030_matrix[9] =
+ static const __u8 po2030_matrix[9] =
{0x60, 0xf0, 0xf0, 0xf0, 0x60, 0xf0, 0xf0, 0xf0, 0x60};
switch (sd->sensor) {
@@ -6365,7 +6381,7 @@ static void setsharpness(struct gspca_dev *gspca_dev)
struct usb_device *dev = gspca_dev->dev;
int sharpness;
__u8 retbyte;
- static __u8 sharpness_tb[][2] = {
+ static const __u8 sharpness_tb[][2] = {
{0x02, 0x03},
{0x04, 0x07},
{0x08, 0x0f},
@@ -6384,59 +6400,59 @@ static void setcontrast(struct gspca_dev *gspca_dev)
{
struct sd *sd = (struct sd *) gspca_dev;
struct usb_device *dev = gspca_dev->dev;
- __u8 *Tgamma, *Tgradient;
+ const __u8 *Tgamma, *Tgradient;
int g, i, k;
- static __u8 kgamma_tb[16] = /* delta for contrast */
+ static const __u8 kgamma_tb[16] = /* delta for contrast */
{0x15, 0x0d, 0x0a, 0x09, 0x08, 0x08, 0x08, 0x08,
0x08, 0x08, 0x08, 0x08, 0x08, 0x08, 0x08, 0x08};
- static __u8 kgrad_tb[16] =
+ static const __u8 kgrad_tb[16] =
{0x1b, 0x06, 0x03, 0x02, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0x06, 0x04};
- static __u8 Tgamma_1[16] =
+ static const __u8 Tgamma_1[16] =
{0x00, 0x00, 0x03, 0x0d, 0x1b, 0x2e, 0x45, 0x5f,
0x79, 0x93, 0xab, 0xc1, 0xd4, 0xe5, 0xf3, 0xff};
- static __u8 Tgradient_1[16] =
+ static const __u8 Tgradient_1[16] =
{0x00, 0x01, 0x05, 0x0b, 0x10, 0x15, 0x18, 0x1a,
0x1a, 0x18, 0x16, 0x14, 0x12, 0x0f, 0x0d, 0x06};
- static __u8 Tgamma_2[16] =
+ static const __u8 Tgamma_2[16] =
{0x01, 0x0c, 0x1f, 0x3a, 0x53, 0x6d, 0x85, 0x9c,
0xb0, 0xc2, 0xd1, 0xde, 0xe9, 0xf2, 0xf9, 0xff};
- static __u8 Tgradient_2[16] =
+ static const __u8 Tgradient_2[16] =
{0x05, 0x0f, 0x16, 0x1a, 0x19, 0x19, 0x17, 0x15,
0x12, 0x10, 0x0e, 0x0b, 0x09, 0x08, 0x06, 0x03};
- static __u8 Tgamma_3[16] =
+ static const __u8 Tgamma_3[16] =
{0x04, 0x16, 0x30, 0x4e, 0x68, 0x81, 0x98, 0xac,
0xbe, 0xcd, 0xda, 0xe4, 0xed, 0xf5, 0xfb, 0xff};
- static __u8 Tgradient_3[16] =
+ static const __u8 Tgradient_3[16] =
{0x0c, 0x16, 0x1b, 0x1c, 0x19, 0x18, 0x15, 0x12,
0x10, 0x0d, 0x0b, 0x09, 0x08, 0x06, 0x05, 0x03};
- static __u8 Tgamma_4[16] =
+ static const __u8 Tgamma_4[16] =
{0x13, 0x38, 0x59, 0x79, 0x92, 0xa7, 0xb9, 0xc8,
0xd4, 0xdf, 0xe7, 0xee, 0xf4, 0xf9, 0xfc, 0xff};
- static __u8 Tgradient_4[16] =
+ static const __u8 Tgradient_4[16] =
{0x26, 0x22, 0x20, 0x1c, 0x16, 0x13, 0x10, 0x0d,
0x0b, 0x09, 0x07, 0x06, 0x05, 0x04, 0x03, 0x02};
- static __u8 Tgamma_5[16] =
+ static const __u8 Tgamma_5[16] =
{0x20, 0x4b, 0x6e, 0x8d, 0xa3, 0xb5, 0xc5, 0xd2,
0xdc, 0xe5, 0xec, 0xf2, 0xf6, 0xfa, 0xfd, 0xff};
- static __u8 Tgradient_5[16] =
+ static const __u8 Tgradient_5[16] =
{0x37, 0x26, 0x20, 0x1a, 0x14, 0x10, 0x0e, 0x0b,
0x09, 0x07, 0x06, 0x05, 0x04, 0x03, 0x02, 0x02};
- static __u8 Tgamma_6[16] = /* ?? was gamma 5 */
+ static const __u8 Tgamma_6[16] = /* ?? was gamma 5 */
{0x24, 0x44, 0x64, 0x84, 0x9d, 0xb2, 0xc4, 0xd3,
0xe0, 0xeb, 0xf4, 0xff, 0xff, 0xff, 0xff, 0xff};
- static __u8 Tgradient_6[16] =
+ static const __u8 Tgradient_6[16] =
{0x18, 0x20, 0x20, 0x1c, 0x16, 0x13, 0x10, 0x0e,
0x0b, 0x09, 0x07, 0x00, 0x00, 0x00, 0x00, 0x01};
- static __u8 *gamma_tb[] = {
- 0, Tgamma_1, Tgamma_2,
+ static const __u8 *gamma_tb[] = {
+ NULL, Tgamma_1, Tgamma_2,
Tgamma_3, Tgamma_4, Tgamma_5, Tgamma_6
};
- static __u8 *gradient_tb[] = {
- 0, Tgradient_1, Tgradient_2,
+ static const __u8 *gradient_tb[] = {
+ NULL, Tgradient_1, Tgradient_2,
Tgradient_3, Tgradient_4, Tgradient_5, Tgradient_6
};
-#ifdef VIDEO_ADV_DEBUG
+#ifdef CONFIG_VIDEO_ADV_DEBUG
__u8 v[16];
#endif
@@ -6454,7 +6470,7 @@ static void setcontrast(struct gspca_dev *gspca_dev)
else if (g <= 0)
g = 1;
reg_w(dev, g, 0x0120 + i); /* gamma */
-#ifdef VIDEO_ADV_DEBUG
+#ifdef CONFIG_VIDEO_ADV_DEBUG
if (gspca_debug & D_CONF)
v[i] = g;
#endif
@@ -6474,7 +6490,7 @@ static void setcontrast(struct gspca_dev *gspca_dev)
g = 1;
}
reg_w(dev, g, 0x0130 + i); /* gradient */
-#ifdef VIDEO_ADV_DEBUG
+#ifdef CONFIG_VIDEO_ADV_DEBUG
if (gspca_debug & D_CONF)
v[i] = g;
#endif
@@ -6533,8 +6549,8 @@ static int setlightfreq(struct gspca_dev *gspca_dev)
{
struct sd *sd = (struct sd *) gspca_dev;
int i, mode;
- struct usb_action *zc3_freq;
- static struct usb_action *freq_tb[SENSOR_MAX][6] = {
+ const struct usb_action *zc3_freq;
+ static const struct usb_action *freq_tb[SENSOR_MAX][6] = {
/* SENSOR_CS2102 0 */
{cs2102_NoFliker, cs2102_NoFlikerScale,
cs2102_50HZ, cs2102_50HZScale,
@@ -6548,21 +6564,21 @@ static int setlightfreq(struct gspca_dev *gspca_dev)
gc0305_50HZ, gc0305_50HZ,
gc0305_60HZ, gc0305_60HZ},
/* SENSOR_HDCS2020 3 */
- {0, 0,
- 0, 0,
- 0, 0},
+ {NULL, NULL,
+ NULL, NULL,
+ NULL, NULL},
/* SENSOR_HDCS2020b 4 */
{hdcs2020b_NoFliker, hdcs2020b_NoFliker,
hdcs2020b_50HZ, hdcs2020b_50HZ,
hdcs2020b_60HZ, hdcs2020b_60HZ},
/* SENSOR_HV7131B 5 */
- {0, 0,
- 0, 0,
- 0, 0},
+ {NULL, NULL,
+ NULL, NULL,
+ NULL, NULL},
/* SENSOR_HV7131C 6 */
- {0, 0,
- 0, 0,
- 0, 0},
+ {NULL, NULL,
+ NULL, NULL,
+ NULL, NULL},
/* SENSOR_ICM105A 7 */
{icm105a_NoFliker, icm105a_NoFlikerScale,
icm105a_50HZ, icm105a_50HZScale,
@@ -6576,9 +6592,9 @@ static int setlightfreq(struct gspca_dev *gspca_dev)
OV7620_50HZ, OV7620_50HZ,
OV7620_60HZ, OV7620_60HZ},
/* SENSOR_OV7630C 10 */
- {0, 0,
- 0, 0,
- 0, 0},
+ {NULL, NULL,
+ NULL, NULL,
+ NULL, NULL},
/* SENSOR_PAS106 11 */
{pas106b_NoFliker, pas106b_NoFliker,
pas106b_50HZ, pas106b_50HZ,
@@ -6606,11 +6622,11 @@ static int setlightfreq(struct gspca_dev *gspca_dev)
};
i = sd->lightfreq * 2;
- mode = gspca_dev->cam.cam_mode[(int) gspca_dev->curr_mode].mode;
+ mode = gspca_dev->cam.cam_mode[(int) gspca_dev->curr_mode].priv;
if (!mode)
i++; /* 640x480 */
zc3_freq = freq_tb[(int) sd->sensor][i];
- if (zc3_freq != 0) {
+ if (zc3_freq != NULL) {
usb_exchange(gspca_dev->dev, zc3_freq);
switch (sd->sensor) {
case SENSOR_GC0305:
@@ -6956,7 +6972,7 @@ static int sd_config(struct gspca_dev *gspca_dev,
int sensor;
__u8 bsensor;
int vga = 1; /* 1: vga, 0: sif */
- static __u8 gamma[SENSOR_MAX] = {
+ static const __u8 gamma[SENSOR_MAX] = {
5, /* SENSOR_CS2102 0 */
5, /* SENSOR_CS2102K 1 */
4, /* SENSOR_GC0305 2 */
@@ -7149,10 +7165,10 @@ static void sd_start(struct gspca_dev *gspca_dev)
{
struct sd *sd = (struct sd *) gspca_dev;
struct usb_device *dev = gspca_dev->dev;
- struct usb_action *zc3_init;
+ const struct usb_action *zc3_init;
int mode;
__u8 retbyte;
- static struct usb_action *init_tb[SENSOR_MAX][2] = {
+ static const struct usb_action *init_tb[SENSOR_MAX][2] = {
{cs2102_InitialScale, cs2102_Initial}, /* 0 */
{cs2102K_InitialScale, cs2102K_Initial}, /* 1 */
{gc0305_Initial, gc0305_InitialScale}, /* 2 */
@@ -7174,7 +7190,7 @@ static void sd_start(struct gspca_dev *gspca_dev)
/* 16 */
};
- mode = gspca_dev->cam.cam_mode[(int) gspca_dev->curr_mode].mode;
+ mode = gspca_dev->cam.cam_mode[(int) gspca_dev->curr_mode].priv;
zc3_init = init_tb[(int) sd->sensor][mode];
switch (sd->sensor) {
case SENSOR_HV7131B:
@@ -7463,13 +7479,13 @@ static int sd_querymenu(struct gspca_dev *gspca_dev,
case V4L2_CID_POWER_LINE_FREQUENCY:
switch (menu->index) {
case 0: /* V4L2_CID_POWER_LINE_FREQUENCY_DISABLED */
- strcpy(menu->name, "NoFliker");
+ strcpy((char *) menu->name, "NoFliker");
return 0;
case 1: /* V4L2_CID_POWER_LINE_FREQUENCY_50HZ */
- strcpy(menu->name, "50 Hz");
+ strcpy((char *) menu->name, "50 Hz");
return 0;
case 2: /* V4L2_CID_POWER_LINE_FREQUENCY_60HZ */
- strcpy(menu->name, "60 Hz");
+ strcpy((char *) menu->name, "60 Hz");
return 0;
}
break;
@@ -7477,7 +7493,7 @@ static int sd_querymenu(struct gspca_dev *gspca_dev,
return -EINVAL;
}
-static struct sd_desc sd_desc = {
+static const struct sd_desc sd_desc = {
.name = MODULE_NAME,
.ctrls = sd_ctrls,
.nctrls = sizeof sd_ctrls / sizeof sd_ctrls[0],
@@ -7492,7 +7508,7 @@ static struct sd_desc sd_desc = {
};
#define DVNM(name) .driver_info = (kernel_ulong_t) name
-static __devinitdata struct usb_device_id device_table[] = {
+static const __devinitdata struct usb_device_id device_table[] = {
{USB_DEVICE(0x041e, 0x041e), DVNM("Creative WebCam Live!")},
{USB_DEVICE(0x041e, 0x4017), DVNM("Creative Webcam Mobile PD1090")},
{USB_DEVICE(0x041e, 0x401c), DVNM("Creative NX")},
diff --git a/linux/drivers/media/video/ir-kbd-i2c.c b/linux/drivers/media/video/ir-kbd-i2c.c
index 9a8795523..85806fe10 100644
--- a/linux/drivers/media/video/ir-kbd-i2c.c
+++ b/linux/drivers/media/video/ir-kbd-i2c.c
@@ -328,10 +328,8 @@ static int ir_detach(struct i2c_client *client);
static int ir_probe(struct i2c_adapter *adap);
static struct i2c_driver driver = {
-#if (LINUX_VERSION_CODE > KERNEL_VERSION(2,6,0))&&(LINUX_VERSION_CODE <= KERNEL_VERSION(2,6,15))
+#if LINUX_VERSION_CODE <= KERNEL_VERSION(2,6,15)
.owner = THIS_MODULE,
-#endif
-#if LINUX_VERSION_CODE <= KERNEL_VERSION(2,6,15)
.name = "ir-kbd-i2c",
.flags = I2C_DF_NOTIFY,
#else
diff --git a/linux/drivers/media/video/ivtv/ivtv-i2c.c b/linux/drivers/media/video/ivtv/ivtv-i2c.c
index b9e38c849..3446ab458 100644
--- a/linux/drivers/media/video/ivtv/ivtv-i2c.c
+++ b/linux/drivers/media/video/ivtv/ivtv-i2c.c
@@ -75,10 +75,6 @@
#define IVTV_REG_I2C_GETSCL_OFFSET 0x7008
#define IVTV_REG_I2C_GETSDA_OFFSET 0x700c
-#ifndef I2C_ADAP_CLASS_TV_ANALOG
-#define I2C_ADAP_CLASS_TV_ANALOG I2C_CLASS_TV_ANALOG
-#endif /* I2C_ADAP_CLASS_TV_ANALOG */
-
#define IVTV_CS53L32A_I2C_ADDR 0x11
#define IVTV_M52790_I2C_ADDR 0x48
#define IVTV_CX25840_I2C_ADDR 0x44
@@ -564,9 +560,7 @@ static struct i2c_adapter ivtv_i2c_adap_hw_template = {
.client_unregister = detach_inform,
.owner = THIS_MODULE,
#if LINUX_VERSION_CODE < KERNEL_VERSION(2, 6, 22)
-#ifdef I2C_ADAP_CLASS_TV_ANALOG
- .class = I2C_ADAP_CLASS_TV_ANALOG,
-#endif
+ .class = I2C_CLASS_TV_ANALOG,
#endif
};
@@ -622,9 +616,7 @@ static struct i2c_adapter ivtv_i2c_adap_template = {
.client_unregister = detach_inform,
.owner = THIS_MODULE,
#if LINUX_VERSION_CODE < KERNEL_VERSION(2, 6, 22)
-#ifdef I2C_ADAP_CLASS_TV_ANALOG
- .class = I2C_ADAP_CLASS_TV_ANALOG,
-#endif
+ .class = I2C_CLASS_TV_ANALOG,
#endif
};
diff --git a/linux/drivers/media/video/ivtv/ivtv-streams.c b/linux/drivers/media/video/ivtv/ivtv-streams.c
index d2dd89519..f8883b487 100644
--- a/linux/drivers/media/video/ivtv/ivtv-streams.c
+++ b/linux/drivers/media/video/ivtv/ivtv-streams.c
@@ -49,9 +49,7 @@ static const struct file_operations ivtv_v4l2_enc_fops = {
.write = ivtv_v4l2_write,
.open = ivtv_v4l2_open,
.ioctl = ivtv_v4l2_ioctl,
-#if LINUX_VERSION_CODE >= KERNEL_VERSION(2, 6, 11)
.compat_ioctl = v4l_compat_ioctl32,
-#endif
.release = ivtv_v4l2_close,
.poll = ivtv_v4l2_enc_poll,
};
@@ -62,9 +60,7 @@ static const struct file_operations ivtv_v4l2_dec_fops = {
.write = ivtv_v4l2_write,
.open = ivtv_v4l2_open,
.ioctl = ivtv_v4l2_ioctl,
-#if LINUX_VERSION_CODE >= KERNEL_VERSION(2, 6, 11)
.compat_ioctl = v4l_compat_ioctl32,
-#endif
.release = ivtv_v4l2_close,
.poll = ivtv_v4l2_dec_poll,
};
diff --git a/linux/drivers/media/video/m52790.c b/linux/drivers/media/video/m52790.c
index 77536ccfc..87e948caf 100644
--- a/linux/drivers/media/video/m52790.c
+++ b/linux/drivers/media/video/m52790.c
@@ -31,10 +31,6 @@
#include <media/v4l2-common.h>
#include <media/v4l2-chip-ident.h>
#include <media/v4l2-i2c-drv.h>
-#if LINUX_VERSION_CODE < KERNEL_VERSION(2, 5, 0)
-#include "i2c-compat.h"
-#include <linux/slab.h>
-#endif
#include "compat.h"
MODULE_DESCRIPTION("i2c device driver for m52790 A/V switch");
@@ -44,10 +40,6 @@ MODULE_LICENSE("GPL");
#if LINUX_VERSION_CODE < KERNEL_VERSION(2, 6, 22)
static unsigned short normal_i2c[] = { 0x90 >> 1, I2C_CLIENT_END };
-#if LINUX_VERSION_CODE < KERNEL_VERSION(2, 6, 13)
-static unsigned short normal_i2c_range[] = { I2C_CLIENT_END };
-#endif
-
I2C_CLIENT_INSMOD;
#endif
@@ -193,7 +185,3 @@ static struct v4l2_i2c_driver_data v4l2_i2c_data = {
.id_table = m52790_id,
#endif
};
-
-#if LINUX_VERSION_CODE < KERNEL_VERSION(2, 5, 0)
-EXPORT_NO_SYMBOLS;
-#endif
diff --git a/linux/drivers/media/video/msp3400-driver.c b/linux/drivers/media/video/msp3400-driver.c
index 5ea4fd801..cd92f1f68 100644
--- a/linux/drivers/media/video/msp3400-driver.c
+++ b/linux/drivers/media/video/msp3400-driver.c
@@ -57,17 +57,12 @@
#include <media/v4l2-i2c-drv-legacy.h>
#include <media/tvaudio.h>
#include <media/msp3400.h>
-#if LINUX_VERSION_CODE >= KERNEL_VERSION(2, 5, 0)
#include <linux/kthread.h>
#if LINUX_VERSION_CODE < KERNEL_VERSION(2, 6, 20)
#include <linux/suspend.h>
#else
#include <linux/freezer.h>
#endif
-#endif
-#if LINUX_VERSION_CODE < KERNEL_VERSION(2, 5, 0)
-#include "i2c-compat.h"
-#endif
#include "compat.h"
#include "msp3400-driver.h"
@@ -90,7 +85,6 @@ int msp_dolby;
int msp_stereo_thresh = 0x190; /* a2 threshold for stereo/bilingual
(msp34xxg only) 0x00a0-0x03c0 */
-#if LINUX_VERSION_CODE >= KERNEL_VERSION(2, 6, 0)
/* read-only */
module_param(opmode, int, 0444);
@@ -101,15 +95,6 @@ module_param_named(stereo_threshold, msp_stereo_thresh, int, 0644);
module_param_named(standard, msp_standard, int, 0644);
module_param_named(amsound, msp_amsound, bool, 0644);
module_param_named(dolby, msp_dolby, bool, 0644);
-#else
-MODULE_PARM(opmode, "i");
-MODULE_PARM(msp_once, "i");
-MODULE_PARM(msp_debug, "i");
-MODULE_PARM(msp_stereo_thresh, "i");
-MODULE_PARM(msp_standard, "i");
-MODULE_PARM(msp_amsound, "i");
-MODULE_PARM(msp_dolby, "i");
-#endif
MODULE_PARM_DESC(opmode, "Forces a MSP3400 opmode. 0=Manual, 1=Autodetect, 2=Autodetect and autoselect");
MODULE_PARM_DESC(once, "No continuous stereo monitoring");
@@ -130,9 +115,7 @@ MODULE_PARM_DESC(dolby, "Activates Dolby processsing");
/* Addresses to scan */
static unsigned short normal_i2c[] = { 0x80 >> 1, 0x88 >> 1, I2C_CLIENT_END };
-#if LINUX_VERSION_CODE < KERNEL_VERSION(2, 6, 13)
-static unsigned short normal_i2c_range[] = { I2C_CLIENT_END };
-#endif
+
I2C_CLIENT_INSMOD;
/* ----------------------------------------------------------------------- */
@@ -356,24 +339,6 @@ void msp_set_audio(struct i2c_client *client)
/* ------------------------------------------------------------------------ */
-#if LINUX_VERSION_CODE < KERNEL_VERSION(2, 5, 0)
-static void msp_setup_thread(struct msp_state *state)
-{
- daemonize();
- exit_files(current);
- reparent_to_init();
-
- spin_lock_irq(SIGMASK_LOCK(current));
- sigfillset(&current->blocked);
- spin_unlock_irq(SIGMASK_LOCK(current));
- strcpy(current->comm, "msp3400");
-
- state->kthread = current;
- if (state->notify != NULL)
- up(state->notify);
-}
-#endif
-
static void msp_wake_thread(struct i2c_client *client)
{
struct msp_state *state = i2c_get_clientdata(client);
@@ -390,11 +355,7 @@ int msp_sleep(struct msp_state *state, int timeout)
DECLARE_WAITQUEUE(wait, current);
add_wait_queue(&state->wq, &wait);
-#if LINUX_VERSION_CODE < KERNEL_VERSION(2, 5, 0)
- if (!(state->rmmod || signal_pending(current))) {
-#else
if (!kthread_should_stop()) {
-#endif
if (timeout < 0) {
set_current_state(TASK_INTERRUPTIBLE);
schedule();
@@ -1018,20 +979,10 @@ static int msp_probe(struct i2c_client *client, const struct i2c_device_id *id)
/* startup control thread if needed */
if (thread_func) {
-#if LINUX_VERSION_CODE >= KERNEL_VERSION(2, 5, 0)
state->kthread = kthread_run(thread_func, client, "msp34xx");
if (IS_ERR(state->kthread))
v4l_warn(client, "kernel_thread() failed\n");
-#else
- DECLARE_MUTEX_LOCKED(sem);
-
- state->kthread = NULL;
- state->notify = &sem;
- kernel_thread(thread_func, client, 0);
- down(&sem);
- state->notify = NULL;
-#endif
msp_wake_thread(client);
}
return 0;
@@ -1043,20 +994,8 @@ static int msp_remove(struct i2c_client *client)
/* shutdown control thread */
if (state->kthread) {
-#if LINUX_VERSION_CODE < KERNEL_VERSION(2, 5, 0)
- DECLARE_MUTEX_LOCKED(sem);
-#endif
state->restart = 1;
-#if LINUX_VERSION_CODE < KERNEL_VERSION(2, 5, 0)
- /* shutdown control thread */
- state->notify = &sem;
- state->rmmod = 1;
- wake_up_interruptible(&state->wq);
- down(&sem);
- state->notify = NULL;
-#else
kthread_stop(state->kthread);
-#endif
}
msp_reset(client);
@@ -1087,10 +1026,6 @@ static struct v4l2_i2c_driver_data v4l2_i2c_data = {
#endif
};
-#if LINUX_VERSION_CODE < KERNEL_VERSION(2, 5, 0)
-EXPORT_NO_SYMBOLS;
-#endif
-
/*
* Overrides for Emacs so that we follow Linus's tabbing style.
* ---------------------------------------------------------------------------
diff --git a/linux/drivers/media/video/msp3400-driver.h b/linux/drivers/media/video/msp3400-driver.h
index 20337567b..ab69a290e 100644
--- a/linux/drivers/media/video/msp3400-driver.h
+++ b/linux/drivers/media/video/msp3400-driver.h
@@ -92,10 +92,6 @@ struct msp_state {
/* thread */
struct task_struct *kthread;
wait_queue_head_t wq;
-#if LINUX_VERSION_CODE < KERNEL_VERSION(2, 5, 0)
- struct semaphore *notify;
- int rmmod:1;
-#endif
unsigned int restart:1;
unsigned int watch_stereo:1;
};
diff --git a/linux/drivers/media/video/msp3400-kthreads.c b/linux/drivers/media/video/msp3400-kthreads.c
index 0280feaac..ba19edac0 100644
--- a/linux/drivers/media/video/msp3400-kthreads.c
+++ b/linux/drivers/media/video/msp3400-kthreads.c
@@ -31,13 +31,8 @@
#include <linux/videodev2.h>
#include <media/v4l2-common.h>
#include <media/msp3400.h>
-#if LINUX_VERSION_CODE >= KERNEL_VERSION(2, 5, 0)
#include <linux/kthread.h>
#include <linux/suspend.h>
-#endif
-#if LINUX_VERSION_CODE < KERNEL_VERSION(2, 5, 0)
-#include "i2c-compat.h"
-#endif
#include "compat.h"
#include "msp3400-driver.h"
@@ -488,10 +483,6 @@ int msp3400c_thread(void *data)
struct msp3400c_carrier_detect *cd;
int count, max1, max2, val1, val2, val, i;
-#if LINUX_VERSION_CODE < KERNEL_VERSION(2, 5, 0)
- msp_setup_thread(state);
-#endif
-
v4l_dbg(1, msp_debug, client, "msp3400 daemon started\n");
set_freezable();
for (;;) {
@@ -502,11 +493,7 @@ int msp3400c_thread(void *data)
restart:
v4l_dbg(2, msp_debug, client, "thread: restart scan\n");
state->restart = 0;
-#if LINUX_VERSION_CODE < KERNEL_VERSION(2, 5, 0)
- if (state->rmmod || signal_pending(current))
-#else
if (kthread_should_stop())
-#endif
break;
if (state->radio || MSP_MODE_EXTERN == state->mode) {
@@ -669,12 +656,6 @@ no_second:
}
}
v4l_dbg(1, msp_debug, client, "thread: exit\n");
-#if LINUX_VERSION_CODE < KERNEL_VERSION(2, 5, 0)
- state->kthread = NULL;
-
- if (state->notify != NULL)
- up(state->notify);
-#endif
return 0;
}
@@ -685,9 +666,6 @@ int msp3410d_thread(void *data)
struct msp_state *state = i2c_get_clientdata(client);
int val, i, std, count;
-#if LINUX_VERSION_CODE < KERNEL_VERSION(2, 5, 0)
- msp_setup_thread(state);
-#endif
v4l_dbg(1, msp_debug, client, "msp3410 daemon started\n");
set_freezable();
for (;;) {
@@ -698,11 +676,7 @@ int msp3410d_thread(void *data)
restart:
v4l_dbg(2, msp_debug, client, "thread: restart scan\n");
state->restart = 0;
-#if LINUX_VERSION_CODE < KERNEL_VERSION(2, 5, 0)
- if (state->rmmod || signal_pending(current))
-#else
if (kthread_should_stop())
-#endif
break;
if (state->mode == MSP_MODE_EXTERN) {
@@ -842,12 +816,6 @@ restart:
}
}
v4l_dbg(1, msp_debug, client, "thread: exit\n");
-#if LINUX_VERSION_CODE < KERNEL_VERSION(2, 5, 0)
- state->kthread = NULL;
-
- if (state->notify != NULL)
- up(state->notify);
-#endif
return 0;
}
@@ -993,9 +961,6 @@ int msp34xxg_thread(void *data)
struct msp_state *state = i2c_get_clientdata(client);
int val, i;
-#if LINUX_VERSION_CODE < KERNEL_VERSION(2, 5, 0)
- msp_setup_thread(state);
-#endif
v4l_dbg(1, msp_debug, client, "msp34xxg daemon started\n");
set_freezable();
for (;;) {
@@ -1006,11 +971,7 @@ int msp34xxg_thread(void *data)
restart:
v4l_dbg(1, msp_debug, client, "thread: restart scan\n");
state->restart = 0;
-#if LINUX_VERSION_CODE < KERNEL_VERSION(2, 5, 0)
- if (state->rmmod || signal_pending(current))
-#else
if (kthread_should_stop())
-#endif
break;
if (state->mode == MSP_MODE_EXTERN) {
@@ -1087,12 +1048,6 @@ unmute:
}
}
v4l_dbg(1, msp_debug, client, "thread: exit\n");
-#if LINUX_VERSION_CODE < KERNEL_VERSION(2, 5, 0)
- state->kthread = NULL;
-
- if (state->notify != NULL)
- up(state->notify);
-#endif
return 0;
}
diff --git a/linux/drivers/media/video/pvrusb2/pvrusb2-hdw.c b/linux/drivers/media/video/pvrusb2/pvrusb2-hdw.c
index cf56b10d9..cbf848e82 100644
--- a/linux/drivers/media/video/pvrusb2/pvrusb2-hdw.c
+++ b/linux/drivers/media/video/pvrusb2/pvrusb2-hdw.c
@@ -3120,9 +3120,6 @@ static int pvr2_send_request_ex(struct pvr2_hdw *hdw,
write_len,
pvr2_ctl_write_complete,
hdw);
-#if LINUX_VERSION_CODE < KERNEL_VERSION(2,6,14)
- hdw->ctl_write_urb->transfer_flags |= URB_ASYNC_UNLINK;
-#endif
hdw->ctl_write_urb->actual_length = 0;
hdw->ctl_write_pend_flag = !0;
status = usb_submit_urb(hdw->ctl_write_urb,GFP_KERNEL);
@@ -3147,9 +3144,6 @@ static int pvr2_send_request_ex(struct pvr2_hdw *hdw,
read_len,
pvr2_ctl_read_complete,
hdw);
-#if LINUX_VERSION_CODE < KERNEL_VERSION(2,6,14)
- hdw->ctl_read_urb->transfer_flags |= URB_ASYNC_UNLINK;
-#endif
hdw->ctl_read_urb->actual_length = 0;
hdw->ctl_read_pend_flag = !0;
status = usb_submit_urb(hdw->ctl_read_urb,GFP_KERNEL);
diff --git a/linux/drivers/media/video/pvrusb2/pvrusb2-i2c-core.c b/linux/drivers/media/video/pvrusb2/pvrusb2-i2c-core.c
index 362ec49f5..797017066 100644
--- a/linux/drivers/media/video/pvrusb2/pvrusb2-i2c-core.c
+++ b/linux/drivers/media/video/pvrusb2/pvrusb2-i2c-core.c
@@ -1017,9 +1017,6 @@ static int pvr2_i2c_detach_inform(struct i2c_client *client)
}
static struct i2c_algorithm pvr2_i2c_algo_template = {
-#if LINUX_VERSION_CODE < KERNEL_VERSION(2,6,14)
- .id = I2C_HW_B_BT848,
-#endif
.master_xfer = pvr2_i2c_xfer,
.functionality = pvr2_i2c_functionality,
};
@@ -1081,9 +1078,6 @@ void pvr2_i2c_core_init(struct pvr2_hdw *hdw)
memcpy(&hdw->i2c_algo,&pvr2_i2c_algo_template,sizeof(hdw->i2c_algo));
strlcpy(hdw->i2c_adap.name,hdw->name,sizeof(hdw->i2c_adap.name));
hdw->i2c_adap.dev.parent = &hdw->usb_dev->dev;
-#if LINUX_VERSION_CODE < KERNEL_VERSION(2,6,14)
- strlcpy(hdw->i2c_algo.name,hdw->name,sizeof(hdw->i2c_algo.name));
-#endif
hdw->i2c_adap.algo = &hdw->i2c_algo;
hdw->i2c_adap.algo_data = hdw;
hdw->i2c_pend_mask = 0;
diff --git a/linux/drivers/media/video/pwc/pwc-ctrl.c b/linux/drivers/media/video/pwc/pwc-ctrl.c
index 04fbd2749..1cccd5c77 100644
--- a/linux/drivers/media/video/pwc/pwc-ctrl.c
+++ b/linux/drivers/media/video/pwc/pwc-ctrl.c
@@ -1255,8 +1255,6 @@ int pwc_get_cmos_sensor(struct pwc_device *pdev, int *sensor)
exactly the same otherwise.
*/
-#if LINUX_VERSION_CODE >= KERNEL_VERSION(2, 6, 0)
-
/* define local variable for arg */
#define ARG_DEF(ARG_type, ARG_name)\
ARG_type *ARG_name = arg;
@@ -1269,25 +1267,6 @@ int pwc_get_cmos_sensor(struct pwc_device *pdev, int *sensor)
/* copy local variable to arg */
#define ARG_OUT(ARG_name) /* nothing */
-#else
-
-#define ARG_DEF(ARG_type, ARG_name)\
- ARG_type ARG_name;
-#define ARG_IN(ARG_name)\
- if (copy_from_user(&ARG_name, arg, sizeof(ARG_name))) {\
- ret = -EFAULT;\
- break;\
- }
-#define ARGR(ARG_name) ARG_name
-#define ARGA(ARG_name) &ARG_name
-#define ARG_OUT(ARG_name)\
- if (copy_to_user(arg, &ARG_name, sizeof(ARG_name))) {\
- ret = -EFAULT;\
- break;\
- }
-
-#endif
-
int pwc_ioctl(struct pwc_device *pdev, unsigned int cmd, void *arg)
{
int ret = 0;
diff --git a/linux/drivers/media/video/pwc/pwc-if.c b/linux/drivers/media/video/pwc/pwc-if.c
index 8236b2b2d..c28490ae5 100644
--- a/linux/drivers/media/video/pwc/pwc-if.c
+++ b/linux/drivers/media/video/pwc/pwc-if.c
@@ -830,13 +830,9 @@ int pwc_isoc_init(struct pwc_device *pdev)
/* Get the current alternate interface, adjust packet size */
if (!udev->actconfig)
return -EFAULT;
-#if LINUX_VERSION_CODE < KERNEL_VERSION(2,6,5)
- idesc = &udev->actconfig->interface[0]->altsetting[pdev->valternate];
-#else
intf = usb_ifnum_to_if(udev, 0);
if (intf)
idesc = usb_altnum_to_altsetting(intf, pdev->valternate);
-#endif
if (!idesc)
return -EFAULT;
@@ -845,11 +841,7 @@ int pwc_isoc_init(struct pwc_device *pdev)
pdev->vmax_packet_size = -1;
for (i = 0; i < idesc->desc.bNumEndpoints; i++) {
if ((idesc->endpoint[i].desc.bEndpointAddress & 0xF) == pdev->vendpoint) {
-#if LINUX_VERSION_CODE < KERNEL_VERSION(2,6,11)
- pdev->vmax_packet_size = idesc->endpoint[i].desc.wMaxPacketSize;
-#else
pdev->vmax_packet_size = le16_to_cpu(idesc->endpoint[i].desc.wMaxPacketSize);
-#endif
break;
}
}
@@ -1472,15 +1464,9 @@ static int pwc_video_mmap(struct file *file, struct vm_area_struct *vma)
pos += (unsigned long)pdev->image_data;
while (size > 0) {
-#if LINUX_VERSION_CODE < KERNEL_VERSION(2,6,10)
- page = kvirt_to_pa(pos);
- if (remap_page_range(vma, start, page, PAGE_SIZE, PAGE_SHARED))
- return -EAGAIN;
-#else
page = vmalloc_to_pfn((void *)pos);
if (remap_pfn_range(vma, start, page, PAGE_SIZE, PAGE_SHARED))
return -EAGAIN;
-#endif
start += PAGE_SIZE;
pos += PAGE_SIZE;
if (size > PAGE_SIZE)
@@ -1508,13 +1494,8 @@ static int usb_pwc_probe(struct usb_interface *intf, const struct usb_device_id
int video_nr = -1; /* default: use next available device */
char serial_number[30], *name;
-#if LINUX_VERSION_CODE < KERNEL_VERSION(2,6,11)
- vendor_id = udev->descriptor.idVendor;
- product_id = udev->descriptor.idProduct;
-#else
vendor_id = le16_to_cpu(udev->descriptor.idVendor);
product_id = le16_to_cpu(udev->descriptor.idProduct);
-#endif
/* Check if we can handle this device */
PWC_DEBUG_PROBE("probe() called [%04X %04X], if %d\n",
@@ -1795,11 +1776,7 @@ static int usb_pwc_probe(struct usb_interface *intf, const struct usb_device_id
pdev->vdev->owner = THIS_MODULE;
video_set_drvdata(pdev->vdev, pdev);
-#if LINUX_VERSION_CODE < KERNEL_VERSION(2,6,11)
- pdev->release = udev->descriptor.bcdDevice;
-#else
pdev->release = le16_to_cpu(udev->descriptor.bcdDevice);
-#endif
PWC_DEBUG_PROBE("Release: %04x\n", pdev->release);
/* Now search device_hint[] table for a match, so we can hint a node number. */
@@ -1943,13 +1920,8 @@ module_param_named(trace, pwc_trace, int, 0644);
#endif
module_param(power_save, int, 0444);
module_param(compression, int, 0444);
-#if LINUX_VERSION_CODE < KERNEL_VERSION(2,6,10)
-module_param_array(leds, int, leds_nargs, 0444);
-module_param_array(dev_hint, charp, dev_hint_nargs, 0444);
-#else
module_param_array(leds, int, &leds_nargs, 0444);
module_param_array(dev_hint, charp, &dev_hint_nargs, 0444);
-#endif
MODULE_PARM_DESC(size, "Initial image size. One of sqcif, qsif, qcif, sif, cif, vga");
MODULE_PARM_DESC(fps, "Initial frames per second. Varies with model, useful range 5-30");
diff --git a/linux/drivers/media/video/pwc/pwc-ioctl.h b/linux/drivers/media/video/pwc/pwc-ioctl.h
index 58904acda..8c0cae7b3 100644
--- a/linux/drivers/media/video/pwc/pwc-ioctl.h
+++ b/linux/drivers/media/video/pwc/pwc-ioctl.h
@@ -54,11 +54,6 @@
#include <linux/types.h>
#include <linux/version.h>
-#if LINUX_VERSION_CODE <= KERNEL_VERSION(2, 6, 10)
-/* Compatibility for older kernel */
-typedef __u16 __le16;
-#endif
-
/* Enumeration of image sizes */
#define PSZ_SQCIF 0x00
#define PSZ_QSIF 0x01
diff --git a/linux/drivers/media/video/saa5246a.c b/linux/drivers/media/video/saa5246a.c
index 900185cf2..2ea5d70a9 100644
--- a/linux/drivers/media/video/saa5246a.c
+++ b/linux/drivers/media/video/saa5246a.c
@@ -73,9 +73,7 @@ static struct video_device saa_template; /* Declared near bottom */
/* Addresses to scan */
static unsigned short normal_i2c[] = { I2C_ADDRESS, I2C_CLIENT_END };
-#if LINUX_VERSION_CODE < KERNEL_VERSION(2,6,13)
-static unsigned short normal_i2c_range[] = { I2C_CLIENT_END };
-#endif
+
I2C_CLIENT_INSMOD;
static struct i2c_client client_template;
diff --git a/linux/drivers/media/video/saa5249.c b/linux/drivers/media/video/saa5249.c
index be71833d0..4443a023c 100644
--- a/linux/drivers/media/video/saa5249.c
+++ b/linux/drivers/media/video/saa5249.c
@@ -137,9 +137,7 @@ static struct video_device saa_template; /* Declared near bottom */
/* Addresses to scan */
static unsigned short normal_i2c[] = {34>>1,I2C_CLIENT_END};
-#if LINUX_VERSION_CODE < KERNEL_VERSION(2,6,13)
-static unsigned short normal_i2c_range[] = { I2C_CLIENT_END };
-#endif
+
I2C_CLIENT_INSMOD;
static struct i2c_client client_template;
diff --git a/linux/drivers/media/video/saa6588.c b/linux/drivers/media/video/saa6588.c
index 0774c351a..5efa5ab66 100644
--- a/linux/drivers/media/video/saa6588.c
+++ b/linux/drivers/media/video/saa6588.c
@@ -31,10 +31,6 @@
#include <linux/wait.h>
#include <asm/uaccess.h>
-#if LINUX_VERSION_CODE < KERNEL_VERSION(2,5,0)
-#include "i2c-compat.h"
-#endif
-
#include <media/rds.h>
#include "compat.h"
@@ -45,9 +41,6 @@ static unsigned short normal_i2c[] = {
I2C_CLIENT_END,
};
-#if LINUX_VERSION_CODE < KERNEL_VERSION(2,6,13)
-static unsigned short normal_i2c_range[] = { I2C_CLIENT_END };
-#endif
I2C_CLIENT_INSMOD;
/* insmod options */
@@ -404,11 +397,7 @@ static int saa6588_configure(struct saa6588 *s)
/* ---------------------------------------------------------------------- */
-#if LINUX_VERSION_CODE >= KERNEL_VERSION(2,5,0)
static int saa6588_attach(struct i2c_adapter *adap, int addr, int kind)
-#else
-static int saa6588_attach(struct i2c_adapter *adap, int addr, unsigned short flags, int kind)
-#endif
{
struct saa6588 *s;
client_template.adapter = adap;
@@ -448,28 +437,13 @@ static int saa6588_attach(struct i2c_adapter *adap, int addr, unsigned short fla
s->timer.function = saa6588_timer;
s->timer.data = (unsigned long)s;
schedule_work(&s->work);
-#if LINUX_VERSION_CODE < KERNEL_VERSION(2,5,0)
- MOD_INC_USE_COUNT;
-#endif
return 0;
}
static int saa6588_probe(struct i2c_adapter *adap)
{
-#ifdef I2C_CLASS_TV_ANALOG
if (adap->class & I2C_CLASS_TV_ANALOG)
return i2c_probe(adap, &addr_data, saa6588_attach);
-#else
- switch (adap->id) {
- case I2C_HW_B_BT848:
- case I2C_HW_B_RIVA:
-#if LINUX_VERSION_CODE >= KERNEL_VERSION(2,5,0)
- case I2C_HW_SAA7134:
-#endif
- return i2c_probe(adap, &addr_data, saa6588_attach);
- break;
- }
-#endif
return 0;
}
@@ -526,10 +500,8 @@ static int saa6588_command(struct i2c_client *client, unsigned int cmd,
/* ----------------------------------------------------------------------- */
static struct i2c_driver driver = {
-#if (LINUX_VERSION_CODE > KERNEL_VERSION(2,6,0)) && ( LINUX_VERSION_CODE <= KERNEL_VERSION(2,6,15))
+#if LINUX_VERSION_CODE <= KERNEL_VERSION(2,6,15)
.owner = THIS_MODULE,
-#endif
-#if LINUX_VERSION_CODE <= KERNEL_VERSION(2,6,15)
.name = "saa6588",
.flags = I2C_DF_NOTIFY,
#else
diff --git a/linux/drivers/media/video/saa7115.c b/linux/drivers/media/video/saa7115.c
index fc4c17bbd..5d99f8455 100644
--- a/linux/drivers/media/video/saa7115.c
+++ b/linux/drivers/media/video/saa7115.c
@@ -48,9 +48,6 @@
#include <media/v4l2-chip-ident.h>
#include <media/v4l2-i2c-drv-legacy.h>
#include <media/saa7115.h>
-#if LINUX_VERSION_CODE < KERNEL_VERSION(2,5,0)
-#include "i2c-compat.h"
-#endif
#include <asm/div64.h>
#include "compat.h"
@@ -62,11 +59,7 @@ MODULE_AUTHOR( "Maxim Yevtyushkin, Kevin Thayer, Chris Kennedy, "
MODULE_LICENSE("GPL");
static int debug;
-#if LINUX_VERSION_CODE >= KERNEL_VERSION(2, 6, 0)
module_param(debug, bool, 0644);
-#else
-MODULE_PARM(debug, "i");
-#endif
MODULE_PARM_DESC(debug, "Debug level (0-1)");
@@ -75,10 +68,6 @@ static unsigned short normal_i2c[] = {
0x42 >> 1, 0x40 >> 1, /* SAA7114, SAA7115 and SAA7118 */
I2C_CLIENT_END };
-#if LINUX_VERSION_CODE < KERNEL_VERSION(2,6,13)
-static unsigned short normal_i2c_range[] = { I2C_CLIENT_END };
-#endif
-
I2C_CLIENT_INSMOD;
struct saa711x_state {
@@ -1595,14 +1584,8 @@ static struct v4l2_i2c_driver_data v4l2_i2c_data = {
.command = saa7115_command,
.probe = saa7115_probe,
.remove = saa7115_remove,
-#ifdef I2C_CLASS_TV_ANALOG
.legacy_class = I2C_CLASS_TV_ANALOG | I2C_CLASS_TV_DIGITAL,
-#endif
#if LINUX_VERSION_CODE >= KERNEL_VERSION(2, 6, 26)
.id_table = saa7115_id,
#endif
};
-
-#if LINUX_VERSION_CODE < KERNEL_VERSION(2,5,0)
-EXPORT_NO_SYMBOLS;
-#endif
diff --git a/linux/drivers/media/video/saa7127.c b/linux/drivers/media/video/saa7127.c
index a73ae00af..28905adfb 100644
--- a/linux/drivers/media/video/saa7127.c
+++ b/linux/drivers/media/video/saa7127.c
@@ -57,9 +57,6 @@
#include <media/v4l2-chip-ident.h>
#include <media/v4l2-i2c-drv.h>
#include <media/saa7127.h>
-#if LINUX_VERSION_CODE < KERNEL_VERSION(2, 5, 0)
-#include "i2c-compat.h"
-#endif
#include "compat.h"
static int debug;
@@ -68,23 +65,14 @@ static int test_image;
MODULE_DESCRIPTION("Philips SAA7127/9 video encoder driver");
MODULE_AUTHOR("Kevin Thayer, Chris Kennedy, Hans Verkuil");
MODULE_LICENSE("GPL");
-#if LINUX_VERSION_CODE >= KERNEL_VERSION(2, 6, 0)
module_param(debug, int, 0644);
module_param(test_image, int, 0644);
-#else
-MODULE_PARM(debug, "i");
-MODULE_PARM(test_image, "i");
-#endif
MODULE_PARM_DESC(debug, "debug level (0-2)");
MODULE_PARM_DESC(test_image, "test_image (0-1)");
#if LINUX_VERSION_CODE < KERNEL_VERSION(2, 6, 22)
static unsigned short normal_i2c[] = { 0x88 >> 1, I2C_CLIENT_END };
-#if LINUX_VERSION_CODE < KERNEL_VERSION(2, 6, 13)
-static unsigned short normal_i2c_range[] = { I2C_CLIENT_END };
-#endif
-
I2C_CLIENT_INSMOD;
#endif
@@ -779,7 +767,3 @@ static struct v4l2_i2c_driver_data v4l2_i2c_data = {
.id_table = saa7127_id,
#endif
};
-
-#if LINUX_VERSION_CODE < KERNEL_VERSION(2, 5, 0)
-EXPORT_NO_SYMBOLS;
-#endif
diff --git a/linux/drivers/media/video/saa7134/saa6752hs.c b/linux/drivers/media/video/saa7134/saa6752hs.c
index c2b1be5d2..0143c8b28 100644
--- a/linux/drivers/media/video/saa7134/saa6752hs.c
+++ b/linux/drivers/media/video/saa7134/saa6752hs.c
@@ -14,10 +14,6 @@
#include <linux/init.h>
#include <linux/crc32.h>
-#if LINUX_VERSION_CODE < KERNEL_VERSION(2,5,0)
-#include "i2c-compat.h"
-#endif
-
#define MPEG_VIDEO_TARGET_BITRATE_MAX 27000
#define MPEG_VIDEO_MAX_BITRATE_MAX 27000
#define MPEG_TOTAL_TARGET_BITRATE_MAX 27000
@@ -25,9 +21,7 @@
/* Addresses to scan */
static unsigned short normal_i2c[] = {0x20, I2C_CLIENT_END};
-#if LINUX_VERSION_CODE < KERNEL_VERSION(2,6,13)
-static unsigned short normal_i2c_range[] = { I2C_CLIENT_END };
-#endif
+
I2C_CLIENT_INSMOD;
MODULE_DESCRIPTION("device driver for saa6752hs MPEG2 encoder");
@@ -695,11 +689,7 @@ static int saa6752hs_init(struct i2c_client* client)
return 0;
}
-#if LINUX_VERSION_CODE >= KERNEL_VERSION(2,5,0)
static int saa6752hs_attach(struct i2c_adapter *adap, int addr, int kind)
-#else
-static int saa6752hs_attach(struct i2c_adapter *adap, int addr, unsigned short flags, int kind)
-#endif
{
struct saa6752hs_state *h;
@@ -718,21 +708,13 @@ static int saa6752hs_attach(struct i2c_adapter *adap, int addr, unsigned short f
i2c_attach_client(&h->client);
v4l_info(&h->client,"saa6752hs: chip found @ 0x%x\n", addr<<1);
-
-#if LINUX_VERSION_CODE < KERNEL_VERSION(2,5,0)
- MOD_INC_USE_COUNT;
-#endif
return 0;
}
static int saa6752hs_probe(struct i2c_adapter *adap)
{
-#if I2C_CLASS_TV_ANALOG
if (adap->class & I2C_CLASS_TV_ANALOG)
return i2c_probe(adap, &addr_data, saa6752hs_attach);
-#else
- return i2c_probe(adap, &addr_data, saa6752hs_attach);
-#endif
return 0;
}
@@ -815,10 +797,8 @@ saa6752hs_command(struct i2c_client *client, unsigned int cmd, void *arg)
/* ----------------------------------------------------------------------- */
static struct i2c_driver driver = {
-#if (LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,0))&&(LINUX_VERSION_CODE <= KERNEL_VERSION(2,6,15))
+#if LINUX_VERSION_CODE <= KERNEL_VERSION(2,6,15)
.owner = THIS_MODULE,
-#endif
-#if LINUX_VERSION_CODE <= KERNEL_VERSION(2,6,15)
.name = "saa6752hs",
.flags = I2C_DF_NOTIFY,
#else
diff --git a/linux/drivers/media/video/saa7134/saa7134-alsa.c b/linux/drivers/media/video/saa7134/saa7134-alsa.c
index 900be78e3..6293eba34 100644
--- a/linux/drivers/media/video/saa7134/saa7134-alsa.c
+++ b/linux/drivers/media/video/saa7134/saa7134-alsa.c
@@ -16,7 +16,6 @@
*
*/
-#if LINUX_VERSION_CODE > KERNEL_VERSION(2,6,0)
#include <linux/init.h>
#include <linux/slab.h>
#include <linux/time.h>
@@ -52,14 +51,8 @@ static int index[SNDRV_CARDS] = SNDRV_DEFAULT_IDX; /* Index 0-MAX */
static char *id[SNDRV_CARDS] = SNDRV_DEFAULT_STR; /* ID for this card */
static int enable[SNDRV_CARDS] = {1, [1 ... (SNDRV_CARDS - 1)] = 1};
-#if LINUX_VERSION_CODE < KERNEL_VERSION(2,6,10)
-static int dummy;
-module_param_array(index, int, dummy, 0444);
-module_param_array(enable, int, dummy, 0444);
-#else
module_param_array(index, int, NULL, 0444);
module_param_array(enable, int, NULL, 0444);
-#endif
MODULE_PARM_DESC(index, "Index value for SAA7134 capture interface(s).");
MODULE_PARM_DESC(enable, "Enable (or not) the SAA7134 capture interface(s).");
@@ -88,10 +81,6 @@ typedef struct snd_card_saa7134 {
} snd_card_saa7134_t;
-#if LINUX_VERSION_CODE <= KERNEL_VERSION(2,6,8)
-#define chip_t snd_card_saa7134_t
-#endif
-
/*
* PCM structure
*/
@@ -1136,7 +1125,3 @@ late_initcall(saa7134_alsa_init);
module_exit(saa7134_alsa_exit);
MODULE_LICENSE("GPL");
MODULE_AUTHOR("Ricardo Cerqueira");
-
-
-#endif /* LINUX_VERSION_CODE */
-
diff --git a/linux/drivers/media/video/saa7134/saa7134-core.c b/linux/drivers/media/video/saa7134/saa7134-core.c
index 9ed2997f7..511941bca 100644
--- a/linux/drivers/media/video/saa7134/saa7134-core.c
+++ b/linux/drivers/media/video/saa7134/saa7134-core.c
@@ -80,28 +80,11 @@ static unsigned int tuner[] = {[0 ... (SAA7134_MAXBOARDS - 1)] = UNSET };
static unsigned int card[] = {[0 ... (SAA7134_MAXBOARDS - 1)] = UNSET };
-#if LINUX_VERSION_CODE < KERNEL_VERSION(2,5,0)
-MODULE_PARM(video_nr,"1-" __stringify(SAA7134_MAXBOARDS) "i");
-MODULE_PARM(vbi_nr,"1-" __stringify(SAA7134_MAXBOARDS) "i");
-MODULE_PARM(radio_nr,"1-" __stringify(SAA7134_MAXBOARDS) "i");
-MODULE_PARM(tuner_nr,"1-" __stringify(SAA7134_MAXBOARDS) "i");
-MODULE_PARM(card,"1-" __stringify(SAA7134_MAXBOARDS) "i");
-#else
-#if LINUX_VERSION_CODE < KERNEL_VERSION(2,6,10)
-static int dummy;
-module_param_array(video_nr, int, dummy, 0444);
-module_param_array(vbi_nr, int, dummy, 0444);
-module_param_array(radio_nr, int, dummy, 0444);
-module_param_array(tuner, int, dummy, 0444);
-module_param_array(card, int, dummy, 0444);
-#else
module_param_array(video_nr, int, NULL, 0444);
module_param_array(vbi_nr, int, NULL, 0444);
module_param_array(radio_nr, int, NULL, 0444);
module_param_array(tuner, int, NULL, 0444);
module_param_array(card, int, NULL, 0444);
-#endif
-#endif
MODULE_PARM_DESC(video_nr, "video device number");
MODULE_PARM_DESC(vbi_nr, "vbi device number");
@@ -209,20 +192,6 @@ static void dump_statusregs(struct saa7134_dev *dev)
#if defined(CONFIG_MODULES) && defined(MODULE)
-#if LINUX_VERSION_CODE < KERNEL_VERSION(2,5,0)
-
-static void request_submodules(struct saa7134_dev *dev){
- if (card_is_empress(dev))
- request_module("saa7134-empress");
- if (card_is_dvb(dev))
- request_module("saa7134-dvb");
- if (alsa)
- request_module("saa7134-alsa");
- if (oss)
- request_module("saa7134-oss");
-}
-#else
-
#if LINUX_VERSION_CODE < KERNEL_VERSION(2,6,20)
static void request_module_async(void *ptr){
struct saa7134_dev* dev=(struct saa7134_dev*)ptr;
@@ -249,7 +218,6 @@ static void request_submodules(struct saa7134_dev *dev)
#endif
schedule_work(&dev->request_module_wk);
}
-#endif
#else
#define request_submodules(dev)
@@ -893,10 +861,8 @@ static struct video_device *vdev_init(struct saa7134_dev *dev,
return NULL;
*vfd = *template;
vfd->minor = -1;
-#if LINUX_VERSION_CODE > KERNEL_VERSION(2,5,0)
vfd->dev = &dev->pci->dev;
vfd->release = video_device_release;
-#endif
vfd->debug = video_debug;
snprintf(vfd->name, sizeof(vfd->name), "%s %s (%s)",
dev->name, type, saa7134_boards[dev->board].name);
diff --git a/linux/drivers/media/video/saa7134/saa7134-empress.c b/linux/drivers/media/video/saa7134/saa7134-empress.c
index 837470f4d..d4afbce9d 100644
--- a/linux/drivers/media/video/saa7134/saa7134-empress.c
+++ b/linux/drivers/media/video/saa7134/saa7134-empress.c
@@ -37,16 +37,7 @@ MODULE_LICENSE("GPL");
static unsigned int empress_nr[] = {[0 ... (SAA7134_MAXBOARDS - 1)] = UNSET };
-#if LINUX_VERSION_CODE < KERNEL_VERSION(2,5,0)
-MODULE_PARM(empress_nr,"1-" __stringify(SAA7134_MAXBOARDS) "i");
-#else
-#if LINUX_VERSION_CODE < KERNEL_VERSION(2,6,10)
-static int dummy;
-module_param_array(empress_nr, int, dummy, 0444);
-#else
module_param_array(empress_nr, int, NULL, 0444);
-#endif
-#endif
MODULE_PARM_DESC(empress_nr,"ts device number");
static unsigned int debug;
@@ -482,10 +473,8 @@ static int empress_init(struct saa7134_dev *dev)
if (NULL == dev->empress_dev)
return -ENOMEM;
*(dev->empress_dev) = saa7134_empress_template;
-#if LINUX_VERSION_CODE > KERNEL_VERSION(2,5,0)
dev->empress_dev->dev = &dev->pci->dev;
dev->empress_dev->release = video_device_release;
-#endif
snprintf(dev->empress_dev->name, sizeof(dev->empress_dev->name),
"%s empress (%s)", dev->name,
saa7134_boards[dev->board].name);
diff --git a/linux/drivers/media/video/saa7134/saa7134-i2c.c b/linux/drivers/media/video/saa7134/saa7134-i2c.c
index 64858dfe8..610e506b5 100644
--- a/linux/drivers/media/video/saa7134/saa7134-i2c.c
+++ b/linux/drivers/media/video/saa7134/saa7134-i2c.c
@@ -368,12 +368,8 @@ static struct i2c_algorithm saa7134_algo = {
};
static struct i2c_adapter saa7134_adap_template = {
-#if LINUX_VERSION_CODE >= KERNEL_VERSION(2,5,0)
.owner = THIS_MODULE,
-#endif
-#ifdef I2C_CLASS_TV_ANALOG
.class = I2C_CLASS_TV_ANALOG,
-#endif
.name = "saa7134",
.id = I2C_HW_SAA7134,
.algo = &saa7134_algo,
@@ -447,9 +443,7 @@ void saa7134_i2c_call_clients(struct saa7134_dev *dev,
int saa7134_i2c_register(struct saa7134_dev *dev)
{
dev->i2c_adap = saa7134_adap_template;
-#if LINUX_VERSION_CODE >= KERNEL_VERSION(2,5,66)
dev->i2c_adap.dev.parent = &dev->pci->dev;
-#endif
strcpy(dev->i2c_adap.name,dev->name);
dev->i2c_adap.algo_data = dev;
i2c_add_adapter(&dev->i2c_adap);
diff --git a/linux/drivers/media/video/saa7134/saa7134-input.c b/linux/drivers/media/video/saa7134/saa7134-input.c
index aecaa7cd0..c12184a38 100644
--- a/linux/drivers/media/video/saa7134/saa7134-input.c
+++ b/linux/drivers/media/video/saa7134/saa7134-input.c
@@ -463,7 +463,6 @@ int saa7134_input_init1(struct saa7134_dev *dev)
ir_input_init(input_dev, &ir->ir, ir_type, ir_codes);
input_dev->name = ir->name;
-#if LINUX_VERSION_CODE > KERNEL_VERSION(2,5,0)
input_dev->phys = ir->phys;
input_dev->id.bustype = BUS_PCI;
input_dev->id.version = 1;
@@ -483,7 +482,6 @@ int saa7134_input_init1(struct saa7134_dev *dev)
input_dev->dev = &dev->pci->dev;
#endif
#endif
-#endif
dev->remote = ir;
saa7134_ir_start(dev, ir);
diff --git a/linux/drivers/media/video/saa7134/saa7134-tvaudio.c b/linux/drivers/media/video/saa7134/saa7134-tvaudio.c
index a4fe3c41b..f7a3f1d0a 100644
--- a/linux/drivers/media/video/saa7134/saa7134-tvaudio.c
+++ b/linux/drivers/media/video/saa7134/saa7134-tvaudio.c
@@ -496,14 +496,6 @@ static int tvaudio_thread(void *data)
unsigned int i, audio, nscan;
int max1,max2,carrier,rx,mode,lastmode,default_carrier;
-#if LINUX_VERSION_CODE < KERNEL_VERSION(2,5,61)
- lock_kernel();
- daemonize();
- sigfillset(&current->blocked);
- sprintf(current->comm, "%s", dev->name);
- unlock_kernel();
-#endif
-
#if LINUX_VERSION_CODE >= KERNEL_VERSION(2, 6, 23)
set_freezable();
#endif
@@ -821,14 +813,6 @@ static int tvaudio_thread_ddep(void *data)
struct saa7134_dev *dev = data;
u32 value, norms;
-#if LINUX_VERSION_CODE < KERNEL_VERSION(2,5,61)
- lock_kernel();
- daemonize();
- sigfillset(&current->blocked);
- sprintf(current->comm, "%s", dev->name);
- unlock_kernel();
-#endif
-
#if LINUX_VERSION_CODE >= KERNEL_VERSION(2, 6, 23)
set_freezable();
#endif
diff --git a/linux/drivers/media/video/saa7134/saa7134-video.c b/linux/drivers/media/video/saa7134/saa7134-video.c
index 33ad87e6b..e02bd2659 100644
--- a/linux/drivers/media/video/saa7134/saa7134-video.c
+++ b/linux/drivers/media/video/saa7134/saa7134-video.c
@@ -2356,9 +2356,7 @@ static const struct file_operations video_fops =
.poll = video_poll,
.mmap = video_mmap,
.ioctl = video_ioctl2,
-#if LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,11)
.compat_ioctl = v4l_compat_ioctl32,
-#endif
.llseek = no_llseek,
};
@@ -2368,9 +2366,7 @@ static const struct file_operations radio_fops =
.open = video_open,
.release = video_release,
.ioctl = video_ioctl2,
-#if LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,11)
.compat_ioctl = v4l_compat_ioctl32,
-#endif
.llseek = no_llseek,
};
diff --git a/linux/drivers/media/video/saa7134/saa7134.h b/linux/drivers/media/video/saa7134/saa7134.h
index 987c4338f..08bc1d0fa 100644
--- a/linux/drivers/media/video/saa7134/saa7134.h
+++ b/linux/drivers/media/video/saa7134/saa7134.h
@@ -41,12 +41,8 @@
#include <media/ir-common.h>
#include <media/ir-kbd-i2c.h>
#include <media/videobuf-dma-sg.h>
-#if LINUX_VERSION_CODE < KERNEL_VERSION(2,5,64)
-#include "i2c-compat.h"
-#else
#include <sound/core.h>
#include <sound/pcm.h>
-#endif
#if defined(CONFIG_VIDEO_SAA7134_DVB) || defined(CONFIG_VIDEO_SAA7134_DVB_MODULE)
#include <media/videobuf-dvb.h>
#endif
@@ -450,13 +446,11 @@ struct saa7134_dmasound {
unsigned int read_offset;
unsigned int read_count;
void * priv_data;
-#if LINUX_VERSION_CODE >= KERNEL_VERSION(2,5,0)
#if LINUX_VERSION_CODE <= KERNEL_VERSION(2,6,16)
snd_pcm_substream_t *substream;
#else
struct snd_pcm_substream *substream;
#endif
-#endif
};
/* ts/mpeg status */
diff --git a/linux/drivers/media/video/saa717x.c b/linux/drivers/media/video/saa717x.c
index adcc7adc5..a478bf25e 100644
--- a/linux/drivers/media/video/saa717x.c
+++ b/linux/drivers/media/video/saa717x.c
@@ -47,11 +47,7 @@ MODULE_AUTHOR("K. Ohta, T. Adachi, Hans Verkuil");
MODULE_LICENSE("GPL");
static int debug;
-#if LINUX_VERSION_CODE >= KERNEL_VERSION(2, 6, 0)
module_param(debug, int, 0644);
-#else
-MODULE_PARM(debug, "i");
-#endif
MODULE_PARM_DESC(debug, "Debug level (0-1)");
/*
@@ -60,9 +56,6 @@ MODULE_PARM_DESC(debug, "Debug level (0-1)");
*/
#if LINUX_VERSION_CODE < KERNEL_VERSION(2, 6, 22)
static unsigned short normal_i2c[] = { 0x42 >> 1, I2C_CLIENT_END };
-#if LINUX_VERSION_CODE < KERNEL_VERSION(2, 6, 13)
-static unsigned short normal_i2c_range[] = { I2C_CLIENT_END };
-#endif
I2C_CLIENT_INSMOD;
#endif
@@ -1535,13 +1528,8 @@ static struct v4l2_i2c_driver_data v4l2_i2c_data = {
.command = saa717x_command,
.probe = saa717x_probe,
.remove = saa717x_remove,
-#ifdef I2C_CLASS_TV_ANALOG
.legacy_class = I2C_CLASS_TV_ANALOG | I2C_CLASS_TV_DIGITAL,
-#endif
#if LINUX_VERSION_CODE >= KERNEL_VERSION(2, 6, 26)
.id_table = saa717x_id,
#endif
};
-#if LINUX_VERSION_CODE < KERNEL_VERSION(2, 5, 0)
-EXPORT_NO_SYMBOLS;
-#endif
diff --git a/linux/drivers/media/video/tda7432.c b/linux/drivers/media/video/tda7432.c
index 5c58967ce..1305820d2 100644
--- a/linux/drivers/media/video/tda7432.c
+++ b/linux/drivers/media/video/tda7432.c
@@ -47,10 +47,6 @@
#include <linux/videodev.h>
#include <linux/i2c.h>
-#if LINUX_VERSION_CODE < KERNEL_VERSION(2,5,0)
-#include "i2c-compat.h"
-#else
-#endif
#include <media/v4l2-common.h>
#include <media/i2c-addr.h>
#include "compat.h"
@@ -77,9 +73,7 @@ static unsigned short normal_i2c[] = {
I2C_ADDR_TDA7432 >> 1,
I2C_CLIENT_END,
};
-#if LINUX_VERSION_CODE < KERNEL_VERSION(2,6,13)
-static unsigned short normal_i2c_range[] = { I2C_CLIENT_END };
-#endif
+
I2C_CLIENT_INSMOD;
/* Structure of address and subaddresses for the tda7432 */
@@ -314,12 +308,7 @@ static void do_tda7432_init(struct i2c_client *client)
* i2c interface functions *
* *********************** */
-#if LINUX_VERSION_CODE >= KERNEL_VERSION(2,5,0)
static int tda7432_attach(struct i2c_adapter *adap, int addr, int kind)
-#else
-static int tda7432_attach(struct i2c_adapter *adap, int addr,
- unsigned short flags, int kind)
-#endif
{
struct tda7432 *t;
struct i2c_client *client;
@@ -335,9 +324,6 @@ static int tda7432_attach(struct i2c_adapter *adap, int addr,
i2c_set_clientdata(client, t);
do_tda7432_init(client);
-#if LINUX_VERSION_CODE < KERNEL_VERSION(2,5,0)
- MOD_INC_USE_COUNT;
-#endif
i2c_attach_client(client);
v4l_info(client, "chip found @ 0x%x (%s)\n", addr << 1, adap->name);
@@ -346,13 +332,8 @@ static int tda7432_attach(struct i2c_adapter *adap, int addr,
static int tda7432_probe(struct i2c_adapter *adap)
{
-#ifdef I2C_CLASS_TV_ANALOG
if (adap->class & I2C_CLASS_TV_ANALOG)
return i2c_probe(adap, &addr_data, tda7432_attach);
-#else
- if (adap->id == I2C_HW_B_BT848)
- return i2c_probe(adap, &addr_data, tda7432_attach);
-#endif
return 0;
}
@@ -364,9 +345,6 @@ static int tda7432_detach(struct i2c_client *client)
i2c_detach_client(client);
kfree(t);
-#if LINUX_VERSION_CODE < KERNEL_VERSION(2,5,0)
- MOD_DEC_USE_COUNT;
-#endif
return 0;
}
@@ -531,10 +509,8 @@ static int tda7432_command(struct i2c_client *client,
}
static struct i2c_driver driver = {
-#if (LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,0))&&(LINUX_VERSION_CODE <= KERNEL_VERSION(2,6,15))
+#if LINUX_VERSION_CODE <= KERNEL_VERSION(2,6,15)
.owner = THIS_MODULE,
-#endif
-#if LINUX_VERSION_CODE <= KERNEL_VERSION(2,6,15)
.name = "tda7432",
.flags = I2C_DF_NOTIFY,
#else
diff --git a/linux/drivers/media/video/tda9840.c b/linux/drivers/media/video/tda9840.c
index c41e50ba6..537a06492 100644
--- a/linux/drivers/media/video/tda9840.c
+++ b/linux/drivers/media/video/tda9840.c
@@ -51,9 +51,6 @@ MODULE_PARM_DESC(debug, "Turn on/off device debugging (default:off).");
/* addresses to scan, found only at 0x42 (7-Bit) */
static unsigned short normal_i2c[] = { I2C_ADDR_TDA9840, I2C_CLIENT_END };
-#if LINUX_VERSION_CODE < KERNEL_VERSION(2,6,13)
-static unsigned short normal_i2c_range[] = { I2C_CLIENT_END };
-#endif
/* magic definition of all other variables and things */
I2C_CLIENT_INSMOD;
@@ -231,10 +228,8 @@ static int detach(struct i2c_client *client)
}
static struct i2c_driver driver = {
-#if (LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,0)) &&(LINUX_VERSION_CODE <= KERNEL_VERSION(2,6,15))
- .owner = THIS_MODULE,
-#endif
#if LINUX_VERSION_CODE <= KERNEL_VERSION(2,6,15)
+ .owner = THIS_MODULE,
.name = "tda9840",
.flags = I2C_DF_NOTIFY,
#else
diff --git a/linux/drivers/media/video/tda9875.c b/linux/drivers/media/video/tda9875.c
index 340ea2300..86e721656 100644
--- a/linux/drivers/media/video/tda9875.c
+++ b/linux/drivers/media/video/tda9875.c
@@ -31,11 +31,6 @@
#include <linux/init.h>
#include "compat.h"
-#if LINUX_VERSION_CODE < KERNEL_VERSION(2,5,0)
-#include "id.h"
-#include "i2c-compat.h"
-#endif
-
#include <media/i2c-addr.h>
static int debug; /* insmod parameter */
@@ -47,9 +42,7 @@ static unsigned short normal_i2c[] = {
I2C_ADDR_TDA9875 >> 1,
I2C_CLIENT_END
};
-#if LINUX_VERSION_CODE < KERNEL_VERSION(2,6,13)
-static unsigned short normal_i2c_range[] = { I2C_CLIENT_END };
-#endif
+
I2C_CLIENT_INSMOD;
/* This is a superset of the TDA9875 */
@@ -244,12 +237,7 @@ static int tda9875_checkit(struct i2c_adapter *adap, int addr)
return(0);
}
-#if LINUX_VERSION_CODE >= KERNEL_VERSION(2,5,0)
static int tda9875_attach(struct i2c_adapter *adap, int addr, int kind)
-#else
-static int tda9875_attach(struct i2c_adapter *adap, int addr,
- unsigned short flags, int kind)
-#endif
{
struct tda9875 *t;
struct i2c_client *client;
@@ -271,9 +259,6 @@ static int tda9875_attach(struct i2c_adapter *adap, int addr,
}
do_tda9875_init(client);
-#if LINUX_VERSION_CODE < KERNEL_VERSION(2,5,0)
- MOD_INC_USE_COUNT;
-#endif
printk(KERN_INFO "tda9875: init\n");
i2c_attach_client(client);
@@ -282,13 +267,8 @@ static int tda9875_attach(struct i2c_adapter *adap, int addr,
static int tda9875_probe(struct i2c_adapter *adap)
{
-#ifdef I2C_CLASS_TV_ANALOG
if (adap->class & I2C_CLASS_TV_ANALOG)
return i2c_probe(adap, &addr_data, tda9875_attach);
-#else
- if (adap->id == I2C_HW_B_BT848)
- return i2c_probe(adap, &addr_data, tda9875_attach);
-#endif
return 0;
}
@@ -300,9 +280,6 @@ static int tda9875_detach(struct i2c_client *client)
i2c_detach_client(client);
kfree(t);
-#if LINUX_VERSION_CODE < KERNEL_VERSION(2,5,0)
- MOD_DEC_USE_COUNT;
-#endif
return 0;
}
@@ -456,10 +433,8 @@ static int tda9875_command(struct i2c_client *client,
static struct i2c_driver driver = {
-#if (LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,0))&&(LINUX_VERSION_CODE <= KERNEL_VERSION(2,6,15))
+#if LINUX_VERSION_CODE <= KERNEL_VERSION(2,6,15)
.owner = THIS_MODULE,
-#endif
-#if LINUX_VERSION_CODE <= KERNEL_VERSION(2,6,15)
.name = "tda9875",
.flags = I2C_DF_NOTIFY,
#else
diff --git a/linux/drivers/media/video/tea6415c.c b/linux/drivers/media/video/tea6415c.c
index 16f369195..cb700dde7 100644
--- a/linux/drivers/media/video/tea6415c.c
+++ b/linux/drivers/media/video/tea6415c.c
@@ -51,9 +51,6 @@ MODULE_PARM_DESC(debug, "Turn on/off device debugging (default:off).");
/* addresses to scan, found only at 0x03 and/or 0x43 (7-bit) */
static unsigned short normal_i2c[] = { I2C_TEA6415C_1, I2C_TEA6415C_2, I2C_CLIENT_END };
-#if LINUX_VERSION_CODE < KERNEL_VERSION(2,6,13)
-static unsigned short normal_i2c_range[] = { I2C_CLIENT_END };
-#endif
/* magic definition of all other variables and things */
I2C_CLIENT_INSMOD;
@@ -200,10 +197,8 @@ static int command(struct i2c_client *client, unsigned int cmd, void *arg)
}
static struct i2c_driver driver = {
-#if (LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,0)) &&(LINUX_VERSION_CODE <= KERNEL_VERSION(2,6,15))
- .owner = THIS_MODULE,
-#endif
#if LINUX_VERSION_CODE <= KERNEL_VERSION(2,6,15)
+ .owner = THIS_MODULE,
.name = "tea6415c",
.flags = I2C_DF_NOTIFY,
#else
diff --git a/linux/drivers/media/video/tea6420.c b/linux/drivers/media/video/tea6420.c
index 7a8fec9cf..f1bba1568 100644
--- a/linux/drivers/media/video/tea6420.c
+++ b/linux/drivers/media/video/tea6420.c
@@ -48,9 +48,6 @@ MODULE_PARM_DESC(debug, "Turn on/off device debugging (default:off).");
/* addresses to scan, found only at 0x4c and/or 0x4d (7-Bit) */
static unsigned short normal_i2c[] = { I2C_ADDR_TEA6420_1, I2C_ADDR_TEA6420_2, I2C_CLIENT_END };
-#if LINUX_VERSION_CODE < KERNEL_VERSION(2,6,13)
-static unsigned short normal_i2c_range[] = { I2C_CLIENT_END };
-#endif
/* magic definition of all other variables and things */
I2C_CLIENT_INSMOD;
@@ -176,10 +173,8 @@ static int command(struct i2c_client *client, unsigned int cmd, void *arg)
}
static struct i2c_driver driver = {
-#if (LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,0)) &&(LINUX_VERSION_CODE <= KERNEL_VERSION(2,6,15))
- .owner = THIS_MODULE,
-#endif
#if LINUX_VERSION_CODE <= KERNEL_VERSION(2,6,15)
+ .owner = THIS_MODULE,
.name = "tea6420",
.flags = I2C_DF_NOTIFY,
#else
diff --git a/linux/drivers/media/video/tlv320aic23b.c b/linux/drivers/media/video/tlv320aic23b.c
index 9f96e200c..b601c232a 100644
--- a/linux/drivers/media/video/tlv320aic23b.c
+++ b/linux/drivers/media/video/tlv320aic23b.c
@@ -32,10 +32,6 @@
#include <linux/videodev.h>
#include <media/v4l2-common.h>
#include <media/v4l2-i2c-drv-legacy.h>
-#if LINUX_VERSION_CODE < KERNEL_VERSION(2, 5, 0)
-#include "i2c-compat.h"
-#include <linux/slab.h>
-#endif
#include "compat.h"
MODULE_DESCRIPTION("tlv320aic23b driver");
@@ -44,10 +40,6 @@ MODULE_LICENSE("GPL");
static unsigned short normal_i2c[] = { 0x34 >> 1, I2C_CLIENT_END };
-#if LINUX_VERSION_CODE < KERNEL_VERSION(2, 6, 13)
-static unsigned short normal_i2c_range[] = { I2C_CLIENT_END };
-#endif
-
I2C_CLIENT_INSMOD;
/* ----------------------------------------------------------------------- */
@@ -175,9 +167,6 @@ static int tlv320aic23b_remove(struct i2c_client *client)
}
/* ----------------------------------------------------------------------- */
-#if LINUX_VERSION_CODE < KERNEL_VERSION(2, 5, 0)
-EXPORT_NO_SYMBOLS;
-#endif
#if LINUX_VERSION_CODE >= KERNEL_VERSION(2, 6, 26)
static const struct i2c_device_id tlv320aic23b_id[] = {
diff --git a/linux/drivers/media/video/tuner-core.c b/linux/drivers/media/video/tuner-core.c
index e0228b865..d80f7ee91 100644
--- a/linux/drivers/media/video/tuner-core.c
+++ b/linux/drivers/media/video/tuner-core.c
@@ -21,9 +21,6 @@
#include <media/tuner-types.h>
#include <media/v4l2-common.h>
#include <media/v4l2-i2c-drv-legacy.h>
-#if LINUX_VERSION_CODE < KERNEL_VERSION(2,5,0)
-#include "i2c-compat.h"
-#endif
#include "mt20xx.h"
#include "tda8290.h"
#include "tea5761.h"
@@ -114,9 +111,6 @@ static unsigned short normal_i2c[] = {
I2C_CLIENT_END
};
-#if LINUX_VERSION_CODE < KERNEL_VERSION(2,6,13)
-static unsigned short normal_i2c_range[] = { I2C_CLIENT_END };
-#endif
I2C_CLIENT_INSMOD;
/* insmod options used at init time => read/only */
@@ -162,17 +156,6 @@ static char secam[] = "--";
static char ntsc[] = "-";
-#if LINUX_VERSION_CODE < KERNEL_VERSION(2,5,0)
-MODULE_PARM(pal,"s");
-MODULE_PARM(secam,"s");
-MODULE_PARM(ntsc,"s");
-MODULE_PARM(tv_range,"2i");
-MODULE_PARM(radio_range,"2i");
-MODULE_PARM(no_autodetect, "i");
-MODULE_PARM(tuner_debug, "i");
-MODULE_PARM(addr, "i");
-MODULE_PARM(show_i2c, "i");
-#else
module_param(addr, int, 0444);
module_param(no_autodetect, int, 0444);
module_param(show_i2c, int, 0444);
@@ -180,15 +163,8 @@ module_param_named(debug,tuner_debug, int, 0644);
module_param_string(pal, pal, sizeof(pal), 0644);
module_param_string(secam, secam, sizeof(secam), 0644);
module_param_string(ntsc, ntsc, sizeof(ntsc), 0644);
-#if LINUX_VERSION_CODE < KERNEL_VERSION(2,6,10)
-static unsigned int dummy;
-module_param_array(tv_range, int, dummy, 0644);
-module_param_array(radio_range, int, dummy, 0644);
-#else
module_param_array(tv_range, int, NULL, 0644);
module_param_array(radio_range, int, NULL, 0644);
-#endif
-#endif
MODULE_DESCRIPTION("device driver for various TV and TV+FM radio tuners");
MODULE_AUTHOR("Ralph Metzler, Gerd Knorr, Gunther Mayer");
@@ -1280,11 +1256,7 @@ static int tuner_legacy_probe(struct i2c_adapter *adap)
normal_i2c[1] = I2C_CLIENT_END;
}
-#ifdef I2C_CLASS_TV_ANALOG
if ((adap->class & I2C_CLASS_TV_ANALOG) == 0)
-#else
- if (adap->id != I2C_HW_B_BT848)
-#endif
return 0;
/* HACK: Ignore 0x6b and 0x6f on cx88 boards.
@@ -1350,10 +1322,6 @@ static struct v4l2_i2c_driver_data v4l2_i2c_data = {
#endif
};
-#if LINUX_VERSION_CODE < KERNEL_VERSION(2, 5, 0)
-EXPORT_NO_SYMBOLS;
-#endif
-
/*
* Overrides for Emacs so that we follow Linus's tabbing style.
* ---------------------------------------------------------------------------
diff --git a/linux/drivers/media/video/tvaudio.c b/linux/drivers/media/video/tvaudio.c
index 830dbe8db..84e2c43b7 100644
--- a/linux/drivers/media/video/tvaudio.c
+++ b/linux/drivers/media/video/tvaudio.c
@@ -31,10 +31,6 @@
#endif
#include "compat.h"
-#if LINUX_VERSION_CODE < KERNEL_VERSION(2,5,0)
-#include "i2c-compat.h"
-#else
-#endif
#include <media/tvaudio.h>
#include <media/v4l2-common.h>
#include <media/v4l2-chip-ident.h>
@@ -151,9 +147,6 @@ static unsigned short normal_i2c[] = {
I2C_ADDR_TDA9874 >> 1,
I2C_ADDR_PIC16C54 >> 1,
I2C_CLIENT_END };
-#if LINUX_VERSION_CODE < KERNEL_VERSION(2,6,13)
-static unsigned short normal_i2c_range[] = { I2C_CLIENT_END };
-#endif
I2C_CLIENT_INSMOD;
/* ---------------------------------------------------------------------- */
@@ -283,9 +276,7 @@ static int chip_thread(void *data)
if (!kthread_should_stop())
schedule();
set_current_state(TASK_RUNNING);
-#if LINUX_VERSION_CODE > KERNEL_VERSION(2,6,12)
try_to_freeze();
-#endif
if (kthread_should_stop())
break;
v4l_dbg(1, debug, chip->c, "%s: thread wakeup\n", chip->c->name);
@@ -1847,19 +1838,8 @@ static int chip_legacy_probe(struct i2c_adapter *adap)
because dedicated drivers are used */
if ((adap->id == I2C_HW_SAA7146))
return 0;
-#ifdef I2C_CLASS_TV_ANALOG
if (adap->class & I2C_CLASS_TV_ANALOG)
return 1;
-#else
- switch (adap->id) {
- case I2C_HW_B_BT848:
- case I2C_HW_B_RIVA:
-#if LINUX_VERSION_CODE >= KERNEL_VERSION(2,5,0)
- case I2C_HW_SAA7134:
-#endif
- return 1;
- }
-#endif
return 0;
}
diff --git a/linux/drivers/media/video/tveeprom.c b/linux/drivers/media/video/tveeprom.c
index e38bda67a..dc0bd9fda 100644
--- a/linux/drivers/media/video/tveeprom.c
+++ b/linux/drivers/media/video/tveeprom.c
@@ -36,9 +36,6 @@
#include <linux/types.h>
#include <linux/videodev.h>
#include <linux/i2c.h>
-#if LINUX_VERSION_CODE < KERNEL_VERSION(2, 5, 0)
-#include <linux/slab.h>
-#endif
#include <media/tuner.h>
#include <media/tveeprom.h>
diff --git a/linux/drivers/media/video/tvmixer.c b/linux/drivers/media/video/tvmixer.c
index ca7330e10..2862efa93 100644
--- a/linux/drivers/media/video/tvmixer.c
+++ b/linux/drivers/media/video/tvmixer.c
@@ -19,16 +19,6 @@
#include <asm/semaphore.h>
#include <asm/uaccess.h>
-#if LINUX_VERSION_CODE < KERNEL_VERSION(2,5,0)
-# include "i2c-compat.h"
-#endif
-#if LINUX_VERSION_CODE < KERNEL_VERSION(2,5,71)
-# define strlcpy(dest,src,len) strncpy(dest,src,(len)-1)
-#endif
-#if LINUX_VERSION_CODE < KERNEL_VERSION(2,6,0)
-# define iminor(inode) minor(inode->i_rdev)
-#endif
-
#define DEV_MAX 4
static int devnr = -1;
@@ -206,14 +196,8 @@ static int tvmixer_open(struct inode *inode, struct file *file)
/* lock bttv in memory while the mixer is in use */
file->private_data = mix;
-#ifndef I2C_PEC
- if (client->adapter->inc_use)
- client->adapter->inc_use(client->adapter);
-#endif
-#if LINUX_VERSION_CODE > KERNEL_VERSION(2,5,54)
if (client->adapter->owner)
try_module_get(client->adapter->owner);
-#endif
return 0;
}
@@ -227,21 +211,13 @@ static int tvmixer_release(struct inode *inode, struct file *file)
return -ENODEV;
}
-#ifndef I2C_PEC
- if (client->adapter->dec_use)
- client->adapter->dec_use(client->adapter);
-#endif
-#if LINUX_VERSION_CODE > KERNEL_VERSION(2,5,54)
module_put(client->adapter->owner);
-#endif
return 0;
}
static struct i2c_driver driver = {
-#if (LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,0))&&(LINUX_VERSION_CODE <= KERNEL_VERSION(2,6,15))
- .owner = THIS_MODULE,
-#endif
#if LINUX_VERSION_CODE <= KERNEL_VERSION(2,6,15)
+ .owner = THIS_MODULE,
.name = "tvmixer",
.flags = I2C_DF_NOTIFY,
#else
@@ -269,20 +245,10 @@ static const struct file_operations tvmixer_fops = {
static int tvmixer_adapters(struct i2c_adapter *adap)
{
-#if LINUX_VERSION_CODE >= KERNEL_VERSION(2,5,54)
struct i2c_client *client;
list_for_each_entry(client, &adap->clients, list)
tvmixer_clients(client);
-#else
- int i;
-
- for (i=0; i<I2C_CLIENT_MAX; i++) {
- if (!adap->clients[i])
- continue;
- tvmixer_clients(adap->clients[i]);
- }
-#endif
return 0;
}
@@ -291,22 +257,8 @@ static int tvmixer_clients(struct i2c_client *client)
struct video_audio va;
int i,minor;
-#ifdef I2C_CLASS_TV_ANALOG
if (!(client->adapter->class & I2C_CLASS_TV_ANALOG))
return -1;
-#else
- /* TV card ??? */
- switch (client->adapter->id) {
- case I2C_HW_SMBUS_VOODOO3:
- case I2C_HW_B_BT848:
- case I2C_HW_B_RIVA:
- /* ok, have a look ... */
- break;
- default:
- /* ignore that one */
- return -1;
- }
-#endif
/* unregister ?? */
for (i = 0; i < DEV_MAX; i++) {
diff --git a/linux/drivers/media/video/tvp5150.c b/linux/drivers/media/video/tvp5150.c
index 7dc6623cc..3c0e2b316 100644
--- a/linux/drivers/media/video/tvp5150.c
+++ b/linux/drivers/media/video/tvp5150.c
@@ -12,12 +12,6 @@
#include <linux/video_decoder.h>
#include <media/v4l2-common.h>
#include <media/tvp5150.h>
-#if LINUX_VERSION_CODE < KERNEL_VERSION(2,5,0)
-#include <linux/module.h>
-#include <linux/delay.h>
-#include <linux/slab.h>
-#include "i2c-compat.h"
-#endif
#include "tvp5150_reg.h"
@@ -32,9 +26,6 @@ static unsigned short normal_i2c[] = {
I2C_CLIENT_END
};
-#if LINUX_VERSION_CODE < KERNEL_VERSION(2,6,13)
-static unsigned short normal_i2c_range[] = { I2C_CLIENT_END };
-#endif
I2C_CLIENT_INSMOD;
static int debug;
@@ -1148,13 +1139,8 @@ static struct i2c_client client_template = {
.driver = &driver,
};
-#if LINUX_VERSION_CODE >= KERNEL_VERSION(2,5,0)
static int tvp5150_detect_client(struct i2c_adapter *adapter,
int address, int kind)
-#else
-static int tvp5150_detect_client(struct i2c_adapter *adapter,
- int address, unsigned short flags, int kind)
-#endif
{
struct i2c_client *c;
struct tvp5150 *core;
@@ -1204,9 +1190,6 @@ static int tvp5150_detect_client(struct i2c_adapter *adapter,
if (debug > 1)
dump_reg(c);
-#if LINUX_VERSION_CODE < KERNEL_VERSION(2,5,0)
- MOD_INC_USE_COUNT;
-#endif
return 0;
}
@@ -1242,10 +1225,8 @@ static int tvp5150_detach_client(struct i2c_client *c)
/* ----------------------------------------------------------------------- */
static struct i2c_driver driver = {
-#if (LINUX_VERSION_CODE >= KERNEL_VERSION(2,5,0))&&(LINUX_VERSION_CODE <= KERNEL_VERSION(2,6,15))
+#if LINUX_VERSION_CODE <= KERNEL_VERSION(2,6,15)
.owner = THIS_MODULE,
-#endif
-#if LINUX_VERSION_CODE <= KERNEL_VERSION(2,6,15)
.name = "tvp5150",
.flags = I2C_DF_NOTIFY,
#else
diff --git a/linux/drivers/media/video/upd64031a.c b/linux/drivers/media/video/upd64031a.c
index c59944d72..dfca5ed6e 100644
--- a/linux/drivers/media/video/upd64031a.c
+++ b/linux/drivers/media/video/upd64031a.c
@@ -46,21 +46,13 @@ MODULE_AUTHOR("T. Adachi, Takeru KOMORIYA, Hans Verkuil");
MODULE_LICENSE("GPL");
static int debug;
-#if LINUX_VERSION_CODE >= KERNEL_VERSION(2, 6, 0)
module_param(debug, int, 0644);
-#else
-MODULE_PARM(debug, "i");
-#endif
MODULE_PARM_DESC(debug, "Debug level (0-1)");
#if LINUX_VERSION_CODE < KERNEL_VERSION(2, 6, 22)
static unsigned short normal_i2c[] = { 0x24 >> 1, 0x26 >> 1, I2C_CLIENT_END };
-#if LINUX_VERSION_CODE < KERNEL_VERSION(2, 6, 13)
-static unsigned short normal_i2c_range[] = { I2C_CLIENT_END };
-#endif
-
I2C_CLIENT_INSMOD;
#endif
@@ -241,9 +233,6 @@ static int upd64031a_remove(struct i2c_client *client)
}
/* ----------------------------------------------------------------------- */
-#if LINUX_VERSION_CODE < KERNEL_VERSION(2, 6, 0)
-EXPORT_NO_SYMBOLS;
-#endif
#if LINUX_VERSION_CODE >= KERNEL_VERSION(2, 6, 26)
static const struct i2c_device_id upd64031a_id[] = {
diff --git a/linux/drivers/media/video/upd64083.c b/linux/drivers/media/video/upd64083.c
index 3dcc5a293..5f0c6919d 100644
--- a/linux/drivers/media/video/upd64083.c
+++ b/linux/drivers/media/video/upd64083.c
@@ -37,21 +37,13 @@ MODULE_AUTHOR("T. Adachi, Takeru KOMORIYA, Hans Verkuil");
MODULE_LICENSE("GPL");
static int debug;
-#if LINUX_VERSION_CODE >= KERNEL_VERSION(2, 6, 0)
module_param(debug, bool, 0644);
-#else
-MODULE_PARM(debug, "i");
-#endif
MODULE_PARM_DESC(debug, "Debug level (0-1)");
#if LINUX_VERSION_CODE < KERNEL_VERSION(2, 6, 22)
static unsigned short normal_i2c[] = { 0xb8 >> 1, 0xba >> 1, I2C_CLIENT_END };
-#if LINUX_VERSION_CODE < KERNEL_VERSION(2, 6, 13)
-static unsigned short normal_i2c_range[] = { I2C_CLIENT_END };
-#endif
-
I2C_CLIENT_INSMOD;
#endif
@@ -218,9 +210,6 @@ static int upd64083_remove(struct i2c_client *client)
}
/* ----------------------------------------------------------------------- */
-#if LINUX_VERSION_CODE < KERNEL_VERSION(2, 6, 0)
-EXPORT_NO_SYMBOLS;
-#endif
#if LINUX_VERSION_CODE >= KERNEL_VERSION(2, 6, 26)
static const struct i2c_device_id upd64083_id[] = {
diff --git a/linux/drivers/media/video/usbvideo/konicawc.c b/linux/drivers/media/video/usbvideo/konicawc.c
index 7e2f04fb4..6fef59557 100644
--- a/linux/drivers/media/video/usbvideo/konicawc.c
+++ b/linux/drivers/media/video/usbvideo/konicawc.c
@@ -17,10 +17,8 @@
#include <linux/init.h>
#if LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,18)
#include <linux/usb/input.h>
-#elif LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,13)
-#include <linux/usb_input.h>
#else
-#include <linux/input.h>
+#include <linux/usb_input.h>
#endif
#include "usbvideo.h"
diff --git a/linux/drivers/media/video/usbvideo/quickcam_messenger.c b/linux/drivers/media/video/usbvideo/quickcam_messenger.c
index a4f1185c0..69f0fc770 100644
--- a/linux/drivers/media/video/usbvideo/quickcam_messenger.c
+++ b/linux/drivers/media/video/usbvideo/quickcam_messenger.c
@@ -35,7 +35,7 @@
#include <linux/input.h>
#if LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,18)
#include <linux/usb/input.h>
-#elif LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,13)
+#else
#include <linux/usb_input.h>
#endif
diff --git a/linux/drivers/media/video/usbvision/usbvision-core.c b/linux/drivers/media/video/usbvision/usbvision-core.c
index ce9348a07..bf464540c 100644
--- a/linux/drivers/media/video/usbvision/usbvision-core.c
+++ b/linux/drivers/media/video/usbvision/usbvision-core.c
@@ -45,13 +45,7 @@
#include <media/tuner.h>
#include <media/audiochip.h>
-#if LINUX_VERSION_CODE < KERNEL_VERSION(2,6,0)
-#include <linux/proc_fs.h>
-#include <linux/tqueue.h>
-#include <linux/wrapper.h>
-#else
#include <linux/workqueue.h>
-#endif
#ifdef CONFIG_KMOD
#include <linux/kmod.h>
@@ -174,40 +168,6 @@ static void usbvision_rvfree(void *mem, unsigned long size)
vfree(mem);
}
-#if LINUX_VERSION_CODE <= KERNEL_VERSION(2,4,24)
-/* helper functions to access driver private data. */
-static inline void *video_get_drvdata(struct video_device *dev)
-{
- return dev->priv;
-}
-
-static inline void video_set_drvdata(struct video_device *dev, void *data)
-{
- dev->priv = data;
-}
-
-struct video_device *video_device_alloc(void)
-{
- struct video_device *vfd;
-#if LINUX_VERSION_CODE < KERNEL_VERSION(2,6,15)
- vfd = kmalloc(sizeof(*vfd),GFP_KERNEL);
- if (NULL == vfd)
- return NULL;
- memset(vfd,0,sizeof(*vfd));
-#else
- vfd = kzalloc(sizeof(*vfd),GFP_KERNEL);
- if (NULL == vfd)
- return NULL;
-#endif
- return vfd;
-}
-
-void video_device_release(struct video_device *vfd)
-{
- kfree(vfd);
-}
-#endif
-
#if ENABLE_HEXDUMP
static void usbvision_hexdump(const unsigned char *data, int len)
@@ -1485,7 +1445,7 @@ static int usbvision_compress_isochronous(struct usb_usbvision *usbvision,
return totlen;
}
-#if LINUX_VERSION_CODE < KERNEL_VERSION(2,6,0) || LINUX_VERSION_CODE > KERNEL_VERSION(2,6,18)
+#if LINUX_VERSION_CODE > KERNEL_VERSION(2,6,18)
static void usbvision_isocIrq(struct urb *urb)
{
#else
@@ -1559,7 +1519,6 @@ static void usbvision_isocIrq(struct urb *urb, struct pt_regs *regs)
urb->iso_frame_desc[i].actual_length = 0;
}
-#if LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,0)
urb->status = 0;
urb->dev = usbvision->dev;
errCode = usb_submit_urb (urb, GFP_ATOMIC);
@@ -1568,7 +1527,6 @@ static void usbvision_isocIrq(struct urb *urb, struct pt_regs *regs)
err("%s: usb_submit_urb failed: error %d",
__func__, errCode);
}
-#endif
return;
}
@@ -1632,7 +1590,7 @@ int usbvision_write_reg(struct usb_usbvision *usbvision, unsigned char reg,
}
-#if LINUX_VERSION_CODE < KERNEL_VERSION(2,6,0) || LINUX_VERSION_CODE > KERNEL_VERSION(2,6,18)
+#if LINUX_VERSION_CODE > KERNEL_VERSION(2,6,18)
static void usbvision_ctrlUrb_complete(struct urb *urb)
#else
static void usbvision_ctrlUrb_complete(struct urb *urb, struct pt_regs *regs)
@@ -1662,19 +1620,11 @@ static int usbvision_write_reg_irq(struct usb_usbvision *usbvision,int address,
}
usbvision->ctrlUrbBusy = 1;
-#if LINUX_VERSION_CODE < KERNEL_VERSION(2,4,20)
- usbvision->ctrlUrbSetup.requesttype = USB_DIR_OUT | USB_TYPE_VENDOR | USB_RECIP_ENDPOINT;
- usbvision->ctrlUrbSetup.request = USBVISION_OP_CODE;
- usbvision->ctrlUrbSetup.value = 0;
- usbvision->ctrlUrbSetup.index = cpu_to_le16(address);
- usbvision->ctrlUrbSetup.length = cpu_to_le16(len);
-#else
usbvision->ctrlUrbSetup.bRequestType = USB_DIR_OUT | USB_TYPE_VENDOR | USB_RECIP_ENDPOINT;
usbvision->ctrlUrbSetup.bRequest = USBVISION_OP_CODE;
usbvision->ctrlUrbSetup.wValue = 0;
usbvision->ctrlUrbSetup.wIndex = cpu_to_le16(address);
usbvision->ctrlUrbSetup.wLength = cpu_to_le16(len);
-#endif
usb_fill_control_urb (usbvision->ctrlUrb, usbvision->dev,
usb_sndctrlpipe(usbvision->dev, 1),
(unsigned char *)&usbvision->ctrlUrbSetup,
@@ -1684,11 +1634,7 @@ static int usbvision_write_reg_irq(struct usb_usbvision *usbvision,int address,
memcpy(usbvision->ctrlUrbBuffer, data, len);
-#if LINUX_VERSION_CODE < KERNEL_VERSION(2,6,0)
- errCode = usb_submit_urb(usbvision->ctrlUrb);
-#else
errCode = usb_submit_urb(usbvision->ctrlUrb, GFP_ATOMIC);
-#endif
if (errCode < 0) {
// error in usb_submit_urb()
usbvision->ctrlUrbBusy = 0;
@@ -2385,18 +2331,12 @@ static void usbvision_powerOffTimer(unsigned long data)
PDEBUG(DBG_FUNC, "");
del_timer(&usbvision->powerOffTimer);
-#if LINUX_VERSION_CODE < KERNEL_VERSION(2,6,0)
- INIT_TQUEUE(&usbvision->powerOffTask, call_usbvision_power_off, usbvision);
- (void) schedule_task(&usbvision->powerOffTask);
-#else
#if LINUX_VERSION_CODE < KERNEL_VERSION(2,6,20)
INIT_WORK(&usbvision->powerOffWork, call_usbvision_power_off, usbvision);
#else
INIT_WORK(&usbvision->powerOffWork, call_usbvision_power_off);
#endif
(void) schedule_work(&usbvision->powerOffWork);
-#endif
-
}
void usbvision_init_powerOffTimer(struct usb_usbvision *usbvision)
@@ -2568,11 +2508,7 @@ int usbvision_init_isoc(struct usb_usbvision *usbvision)
int j, k;
struct urb *urb;
-#if LINUX_VERSION_CODE < KERNEL_VERSION(2,6,0)
- urb = usb_alloc_urb(USBVISION_URB_FRAMES);
-#else
urb = usb_alloc_urb(USBVISION_URB_FRAMES, GFP_KERNEL);
-#endif
if (urb == NULL) {
err("%s: usb_alloc_urb() failed", __func__);
return -ENOMEM;
@@ -2586,12 +2522,8 @@ int usbvision_init_isoc(struct usb_usbvision *usbvision)
urb->dev = dev;
urb->context = usbvision;
urb->pipe = usb_rcvisocpipe(dev, usbvision->video_endp);
-#if LINUX_VERSION_CODE < KERNEL_VERSION(2,6,0)
- urb->transfer_flags = USB_ISO_ASAP;
-#else
urb->transfer_flags = URB_ISO_ASAP;
urb->interval = 1;
-#endif
urb->transfer_buffer = usbvision->sbuf[bufIdx].data;
urb->complete = usbvision_isocIrq;
urb->number_of_packets = USBVISION_URB_FRAMES;
@@ -2605,28 +2537,10 @@ int usbvision_init_isoc(struct usb_usbvision *usbvision)
}
}
-#if LINUX_VERSION_CODE < KERNEL_VERSION(2,6,0)
- /* Link URBs into a ring so that they invoke each other infinitely */
- for (bufIdx = 0; bufIdx < USBVISION_NUMSBUF; bufIdx++) {
- if ((bufIdx + 1) < USBVISION_NUMSBUF) {
- usbvision->sbuf[bufIdx].urb->next =
- usbvision->sbuf[bufIdx + 1].urb;
- }
- else {
- usbvision->sbuf[bufIdx].urb->next =
- usbvision->sbuf[0].urb;
- }
- }
-#endif
-
/* Submit all URBs */
for (bufIdx = 0; bufIdx < USBVISION_NUMSBUF; bufIdx++) {
- #if LINUX_VERSION_CODE < KERNEL_VERSION(2,6,0)
- errCode = usb_submit_urb(usbvision->sbuf[bufIdx].urb);
- #else
errCode = usb_submit_urb(usbvision->sbuf[bufIdx].urb,
GFP_KERNEL);
- #endif
if (errCode) {
err("%s: usb_submit_urb(%d) failed: error %d",
__func__, bufIdx, errCode);
@@ -2656,7 +2570,6 @@ void usbvision_stop_isoc(struct usb_usbvision *usbvision)
return;
/* Unschedule all of the iso td's */
-#if LINUX_VERSION_CODE > KERNEL_VERSION(2,6,9)
for (bufIdx = 0; bufIdx < USBVISION_NUMSBUF; bufIdx++) {
usb_kill_urb(usbvision->sbuf[bufIdx].urb);
if (usbvision->sbuf[bufIdx].data){
@@ -2668,25 +2581,6 @@ void usbvision_stop_isoc(struct usb_usbvision *usbvision)
usb_free_urb(usbvision->sbuf[bufIdx].urb);
usbvision->sbuf[bufIdx].urb = NULL;
}
-#else
- for (bufIdx = 0; bufIdx < USBVISION_NUMSBUF; bufIdx++) {
- errCode = usb_unlink_urb(usbvision->sbuf[bufIdx].urb);
- if (errCode < 0)
- err("%s: usb_unlink_urb() failed: error %d",
- __func__, errCode);
- }
-
- if (usbvision->sbuf[bufIdx].data){
- usb_buffer_free(usbvision->dev,
- sb_size,
- usbvision->sbuf[bufIdx].data,
- usbvision->sbuf[bufIdx].urb->transfer_dma);
- }
- /* Delete them all */
- for (bufIdx = 0; bufIdx < USBVISION_NUMSBUF; bufIdx++)
- usb_free_urb(usbvision->sbuf[bufIdx].urb);
-#endif
-
PDEBUG(DBG_ISOC, "%s: streaming=Stream_Off\n", __func__);
usbvision->streaming = Stream_Off;
diff --git a/linux/drivers/media/video/usbvision/usbvision-i2c.c b/linux/drivers/media/video/usbvision/usbvision-i2c.c
index 67efd7821..1b6180573 100644
--- a/linux/drivers/media/video/usbvision/usbvision-i2c.c
+++ b/linux/drivers/media/video/usbvision/usbvision-i2c.c
@@ -193,28 +193,9 @@ static u32 functionality(struct i2c_adapter *adap)
return I2C_FUNC_SMBUS_EMUL | I2C_FUNC_10BIT_ADDR;
}
-#ifndef I2C_PEC
-static void inc_use(struct i2c_adapter *adap)
-{
- MOD_INC_USE_COUNT;
-}
-
-static void dec_use(struct i2c_adapter *adap)
-{
- MOD_DEC_USE_COUNT;
-}
-#endif
-
/* -----exported algorithm data: ------------------------------------- */
static struct i2c_algorithm usbvision_algo = {
-#if (LINUX_VERSION_CODE < KERNEL_VERSION(2,6,0)) && (LINUX_VERSION_CODE > KERNEL_VERSION(2,4,30))
- .owner = THIS_MODULE,
-#endif
-#if LINUX_VERSION_CODE < KERNEL_VERSION(2,6,14)
- .name = "USB algorithm",
- .id = I2C_ALGO_BIT, /* FIXME */
-#endif
.master_xfer = usbvision_i2c_xfer,
.smbus_xfer = NULL,
.functionality = functionality,
@@ -231,9 +212,6 @@ static int usbvision_i2c_usb_add_bus(struct i2c_adapter *adap)
/* register new adapter to i2c module... */
-#if LINUX_VERSION_CODE < KERNEL_VERSION(2,6,14)
- adap->id |= usbvision_algo.id;
-#endif
adap->algo = &usbvision_algo;
adap->timeout = 100; /* default values, should */
@@ -533,30 +511,16 @@ static int usbvision_i2c_read(struct usb_usbvision *usbvision, unsigned char add
}
static struct i2c_adapter i2c_adap_template = {
-#ifdef I2C_PEC
.owner = THIS_MODULE,
-#else
- .inc_use = inc_use,
- .dec_use = dec_use,
-#endif
.name = "usbvision",
.id = I2C_HW_B_BT848, /* FIXME */
.client_register = attach_inform,
.client_unregister = detach_inform,
-#ifdef I2C_ADAP_CLASS_TV_ANALOG
- .class = I2C_ADAP_CLASS_TV_ANALOG,
-#else
-#ifdef I2C_CLASS_TV_ANALOG
.class = I2C_CLASS_TV_ANALOG,
-#endif
-#endif
};
static struct i2c_client i2c_client_template = {
.name = "usbvision internal",
-#if LINUX_VERSION_CODE < KERNEL_VERSION(2, 6, 11)
- .id = -1,
-#endif
#if LINUX_VERSION_CODE <= KERNEL_VERSION(2,6,15)
.flags = I2C_CLIENT_ALLOW_USE,
#endif
diff --git a/linux/drivers/media/video/usbvision/usbvision-video.c b/linux/drivers/media/video/usbvision/usbvision-video.c
index 55b3f5e60..073d30454 100644
--- a/linux/drivers/media/video/usbvision/usbvision-video.c
+++ b/linux/drivers/media/video/usbvision/usbvision-video.c
@@ -68,13 +68,7 @@
#include <media/tuner.h>
#include <media/audiochip.h>
-#if LINUX_VERSION_CODE < KERNEL_VERSION(2,6,0)
-#include <linux/proc_fs.h>
-#include <linux/tqueue.h>
-#include <linux/wrapper.h>
-#else
#include <linux/workqueue.h>
-#endif
#ifdef CONFIG_KMOD
#include <linux/kmod.h>
@@ -173,10 +167,8 @@ MODULE_PARM_DESC(vbi_nr, "Set vbi device number (/dev/vbiX). Default: -1 (autod
MODULE_AUTHOR(DRIVER_AUTHOR);
MODULE_DESCRIPTION(DRIVER_DESC);
MODULE_LICENSE(DRIVER_LICENSE);
-#if LINUX_VERSION_CODE >= KERNEL_VERSION(2, 6, 0)
MODULE_VERSION(USBVISION_VERSION_STRING);
MODULE_ALIAS(DRIVER_ALIAS);
-#endif
/*****************************************************************************/
@@ -187,8 +179,6 @@ MODULE_ALIAS(DRIVER_ALIAS);
/* /sys/bus/usb/drivers/USBVision Video Grabber */
/*****************************************************************************/
-#if LINUX_VERSION_CODE >= KERNEL_VERSION(2, 6, 0)
-
#define YES_NO(x) ((x) ? "Yes" : "No")
static inline struct usb_usbvision *cd_to_usbvision(struct device *cd)
@@ -379,8 +369,6 @@ static void usbvision_remove_sysfs(struct video_device *vdev)
}
}
-#endif
-
/*
* usbvision_open()
*
@@ -389,25 +377,15 @@ static void usbvision_remove_sysfs(struct video_device *vdev)
* then allocates buffers needed for video processing.
*
*/
-#if LINUX_VERSION_CODE < KERNEL_VERSION(2,4,19)
-static int usbvision_v4l2_open(struct video_device *dev, int flags)
-{
- struct usb_usbvision *usbvision = (struct usb_usbvision *) dev;
-#else
static int usbvision_v4l2_open(struct inode *inode, struct file *file)
{
struct video_device *dev = video_devdata(file);
struct usb_usbvision *usbvision =
(struct usb_usbvision *) video_get_drvdata(dev);
-#endif
int errCode = 0;
PDEBUG(DBG_IO, "open");
-#if LINUX_VERSION_CODE < KERNEL_VERSION(2,6,0)
- MOD_INC_USE_COUNT;
-#endif
-
usbvision_reset_powerOffTimer(usbvision);
if (usbvision->user)
@@ -461,12 +439,6 @@ static int usbvision_v4l2_open(struct inode *inode, struct file *file)
mutex_unlock(&usbvision->lock);
}
- if (errCode) {
-#if LINUX_VERSION_CODE < KERNEL_VERSION(2,6,0)
- MOD_DEC_USE_COUNT;
-#endif
- }
-
/* prepare queues */
usbvision_empty_framequeues(usbvision);
@@ -482,17 +454,11 @@ static int usbvision_v4l2_open(struct inode *inode, struct file *file)
* allocated in usbvision_v4l2_open().
*
*/
-#if LINUX_VERSION_CODE < KERNEL_VERSION(2,4,19)
-static void usbvision_v4l2_close(struct video_device *dev)
-{
- struct usb_usbvision *usbvision = (struct usb_usbvision *) dev;
-#else
static int usbvision_v4l2_close(struct inode *inode, struct file *file)
{
struct video_device *dev = video_devdata(file);
struct usb_usbvision *usbvision =
(struct usb_usbvision *) video_get_drvdata(dev);
-#endif
PDEBUG(DBG_IO, "close");
mutex_lock(&usbvision->lock);
@@ -523,14 +489,7 @@ static int usbvision_v4l2_close(struct inode *inode, struct file *file)
}
PDEBUG(DBG_IO, "success");
-#if LINUX_VERSION_CODE < KERNEL_VERSION(2,6,0)
- MOD_DEC_USE_COUNT;
-#endif
-
-
-#if LINUX_VERSION_CODE >= KERNEL_VERSION(2,4,19)
return 0;
-#endif
}
@@ -1123,12 +1082,6 @@ static int vidioc_s_fmt_vid_cap(struct file *file, void *priv,
return 0;
}
-#if LINUX_VERSION_CODE < KERNEL_VERSION(2,4,19)
-static long usbvision_v4l2_read(struct video_device *dev, char *buf,
- unsigned long count, int noblock)
-{
- struct usb_usbvision *usbvision = (struct usb_usbvision *) dev;
-#else
static ssize_t usbvision_v4l2_read(struct file *file, char __user *buf,
size_t count, loff_t *ppos)
{
@@ -1136,7 +1089,6 @@ static ssize_t usbvision_v4l2_read(struct file *file, char __user *buf,
struct usb_usbvision *usbvision =
(struct usb_usbvision *) video_get_drvdata(dev);
int noblock = file->f_flags & O_NONBLOCK;
-#endif
unsigned long lock_flags;
int ret,i;
@@ -1302,24 +1254,15 @@ static int usbvision_v4l2_mmap(struct file *file, struct vm_area_struct *vma)
* Here comes the stuff for radio on usbvision based devices
*
*/
-#if LINUX_VERSION_CODE < KERNEL_VERSION(2,4,19)
-static int usbvision_radio_open(struct video_device *dev, int flags)
-{
- struct usb_usbvision *usbvision = (struct usb_usbvision *)dev->priv;
-#else
static int usbvision_radio_open(struct inode *inode, struct file *file)
{
struct video_device *dev = video_devdata(file);
struct usb_usbvision *usbvision =
(struct usb_usbvision *) video_get_drvdata(dev);
-#endif
int errCode = 0;
PDEBUG(DBG_IO, "%s:", __func__);
-#if LINUX_VERSION_CODE < KERNEL_VERSION(2,6,0)
- MOD_INC_USE_COUNT;
-#endif
mutex_lock(&usbvision->lock);
if (usbvision->user) {
@@ -1351,9 +1294,6 @@ static int usbvision_radio_open(struct inode *inode, struct file *file)
}
if (errCode) {
-#if LINUX_VERSION_CODE < KERNEL_VERSION(2,6,0)
- MOD_DEC_USE_COUNT;
-#endif
if (PowerOnAtOpen) {
usbvision_i2c_unregister(usbvision);
usbvision_power_off(usbvision);
@@ -1366,18 +1306,12 @@ out:
}
-#if LINUX_VERSION_CODE < KERNEL_VERSION(2,4,19)
-static void usbvision_radio_close(struct video_device *dev)
-{
- struct usb_usbvision *usbvision = (struct usb_usbvision *)dev->priv;
-#else
static int usbvision_radio_close(struct inode *inode, struct file *file)
{
struct video_device *dev = video_devdata(file);
struct usb_usbvision *usbvision =
(struct usb_usbvision *) video_get_drvdata(dev);
int errCode = 0;
-#endif
PDEBUG(DBG_IO, "");
@@ -1404,42 +1338,22 @@ static int usbvision_radio_close(struct inode *inode, struct file *file)
usbvision_release(usbvision);
}
-#if LINUX_VERSION_CODE < KERNEL_VERSION(2,6,0)
- MOD_DEC_USE_COUNT;
-#endif
-
PDEBUG(DBG_IO, "success");
-
-#if LINUX_VERSION_CODE >= KERNEL_VERSION(2,4,19)
return errCode;
-#endif
}
/*
* Here comes the stuff for vbi on usbvision based devices
*
*/
-#if LINUX_VERSION_CODE < KERNEL_VERSION(2,4,19)
-static int usbvision_vbi_open(struct video_device *dev, int flags)
-{
- struct usb_usbvision *usbvision = (struct usb_usbvision *)dev->priv;
-#else
static int usbvision_vbi_open(struct inode *inode, struct file *file)
{
-#endif
/* TODO */
return -ENODEV;
-
}
-#if LINUX_VERSION_CODE < KERNEL_VERSION(2,4,19)
-static void usbvision_vbi_close(struct video_device *dev)
-{
- struct usb_usbvision *usbvision = (struct usb_usbvision *)dev->priv;
-#else
static int usbvision_vbi_close(struct inode *inode, struct file *file)
{
-#endif
/* TODO */
return -ENODEV;
}
@@ -1463,21 +1377,8 @@ static int usbvision_vbi_ioctl(struct inode *inode, struct file *file,
//
// Video template
-#if LINUX_VERSION_CODE < KERNEL_VERSION(2,4,19)
-static struct video_device usbvision_video_template = {
- .type = VID_TYPE_TUNER | VID_TYPE_CAPTURE,
- .open = usbvision_v4l2_open,
- .close = usbvision_v4l2_close,
- .read = usbvision_v4l2_read,
- .mmap = usbvision_v4l2_mmap,
- .ioctl = video_ioctl2,
- .minor = -1,
-};
-#else
static const struct file_operations usbvision_fops = {
-#if LINUX_VERSION_CODE > KERNEL_VERSION(2,4,31)
.owner = THIS_MODULE,
-#endif
.open = usbvision_v4l2_open,
.release = usbvision_v4l2_close,
.read = usbvision_v4l2_read,
@@ -1485,20 +1386,14 @@ static const struct file_operations usbvision_fops = {
.ioctl = video_ioctl2,
.llseek = no_llseek,
/* .poll = video_poll, */
-#if LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,11)
.compat_ioctl = v4l_compat_ioctl32,
-#endif
};
static struct video_device usbvision_video_template = {
-#if LINUX_VERSION_CODE > KERNEL_VERSION(2,4,31)
.owner = THIS_MODULE,
-#endif
.type = VID_TYPE_TUNER | VID_TYPE_CAPTURE,
.fops = &usbvision_fops,
-#if LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,0)
.name = "usbvision-video",
.release = video_device_release,
-#endif
.minor = -1,
.vidioc_querycap = vidioc_querycap,
.vidioc_enum_fmt_vid_cap = vidioc_enum_fmt_vid_cap,
@@ -1534,44 +1429,25 @@ static struct video_device usbvision_video_template = {
.tvnorms = USBVISION_NORMS,
.current_norm = V4L2_STD_PAL
};
-#endif
// Radio template
-#if LINUX_VERSION_CODE < KERNEL_VERSION(2,4,19)
-static struct video_device usbvision_radio_template=
-{
- .type = VID_TYPE_TUNER,
- .open = usbvision_radio_open,
- .close = usbvision_radio_close,
- .ioctl = video_ioctl2,
- .minor -1,
-};
-#else
static const struct file_operations usbvision_radio_fops = {
-#if LINUX_VERSION_CODE > KERNEL_VERSION(2,4,31)
.owner = THIS_MODULE,
-#endif
.open = usbvision_radio_open,
.release = usbvision_radio_close,
.ioctl = video_ioctl2,
.llseek = no_llseek,
-#if LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,11)
.compat_ioctl = v4l_compat_ioctl32,
-#endif
};
static struct video_device usbvision_radio_template=
{
-#if LINUX_VERSION_CODE > KERNEL_VERSION(2,4,31)
.owner = THIS_MODULE,
-#endif
.type = VID_TYPE_TUNER,
.fops = &usbvision_radio_fops,
-#if LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,0)
.name = "usbvision-radio",
.release = video_device_release,
-#endif
.minor = -1,
.vidioc_querycap = vidioc_querycap,
.vidioc_enum_input = vidioc_enum_input,
@@ -1590,46 +1466,26 @@ static struct video_device usbvision_radio_template=
.tvnorms = USBVISION_NORMS,
.current_norm = V4L2_STD_PAL
};
-#endif
// vbi template
-#if LINUX_VERSION_CODE < KERNEL_VERSION(2,4,19)
-static struct video_device usbvision_vbi_template=
-{
- type: VID_TYPE_TELETEXT,
- open: usbvision_vbi_open,
- close: usbvision_vbi_close,
- ioctl: usbvision_vbi_ioctl,
- minor: -1,
-};
-#else
static const struct file_operations usbvision_vbi_fops = {
-#if LINUX_VERSION_CODE > KERNEL_VERSION(2,4,31)
.owner = THIS_MODULE,
-#endif
.open = usbvision_vbi_open,
.release = usbvision_vbi_close,
.ioctl = usbvision_vbi_ioctl,
.llseek = no_llseek,
-#if LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,11)
.compat_ioctl = v4l_compat_ioctl32,
-#endif
};
static struct video_device usbvision_vbi_template=
{
-#if LINUX_VERSION_CODE > KERNEL_VERSION(2,4,31)
.owner = THIS_MODULE,
-#endif
.type = VID_TYPE_TUNER,
.fops = &usbvision_vbi_fops,
-#if LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,0)
.release = video_device_release,
.name = "usbvision-vbi",
-#endif
.minor = -1,
};
-#endif
static struct video_device *usbvision_vdev_init(struct usb_usbvision *usbvision,
@@ -1650,9 +1506,7 @@ static struct video_device *usbvision_vdev_init(struct usb_usbvision *usbvision,
}
*vdev = *vdev_template;
// vdev->minor = -1;
-#if LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,0)
vdev->dev = &usb_dev->dev;
-#endif
snprintf(vdev->name, sizeof(vdev->name), "%s", name);
video_set_drvdata(vdev, usbvision);
return vdev;
@@ -1667,9 +1521,6 @@ static void usbvision_unregister_video(struct usb_usbvision *usbvision)
usbvision->vbi->minor & 0x1f);
if (usbvision->vbi->minor != -1) {
video_unregister_device(usbvision->vbi);
-#if LINUX_VERSION_CODE < KERNEL_VERSION(2,6,0)
- video_device_release(usbvision->vbi);
-#endif
} else {
video_device_release(usbvision->vbi);
}
@@ -1682,9 +1533,6 @@ static void usbvision_unregister_video(struct usb_usbvision *usbvision)
usbvision->rdev->minor & 0x1f);
if (usbvision->rdev->minor != -1) {
video_unregister_device(usbvision->rdev);
-#if LINUX_VERSION_CODE < KERNEL_VERSION(2,6,0)
- video_device_release(usbvision->rdev);
-#endif
} else {
video_device_release(usbvision->rdev);
}
@@ -1697,9 +1545,6 @@ static void usbvision_unregister_video(struct usb_usbvision *usbvision)
usbvision->vdev->minor & 0x1f);
if (usbvision->vdev->minor != -1) {
video_unregister_device(usbvision->vdev);
-#if LINUX_VERSION_CODE < KERNEL_VERSION(2,6,0)
- video_device_release(usbvision->vdev);
-#endif
} else {
video_device_release(usbvision->vdev);
}
@@ -1799,11 +1644,7 @@ static struct usb_usbvision *usbvision_alloc(struct usb_device *dev)
mutex_init(&usbvision->lock); /* available */
// prepare control urb for control messages during interrupts
-#if LINUX_VERSION_CODE < KERNEL_VERSION(2,6,0)
- usbvision->ctrlUrb = usb_alloc_urb(USBVISION_URB_FRAMES);
-#else
usbvision->ctrlUrb = usb_alloc_urb(USBVISION_URB_FRAMES, GFP_KERNEL);
-#endif
if (usbvision->ctrlUrb == NULL) {
goto err_exit;
}
@@ -2006,12 +1847,7 @@ static int __devinit usbvision_probe(struct usb_interface *intf,
usbvision_create_sysfs(usbvision->vdev);
PDEBUG(DBG_PROBE, "success");
-#if LINUX_VERSION_CODE < KERNEL_VERSION(2,6,0)
- MOD_DEC_USE_COUNT;
- return usbvision;
-#else
return 0;
-#endif
}
@@ -2023,15 +1859,9 @@ static int __devinit usbvision_probe(struct usb_interface *intf,
* with no ill consequences.
*
*/
-#if LINUX_VERSION_CODE < KERNEL_VERSION(2,6,0)
-static void usbvision_disconnect(struct usb_device *dev, void *ptr)
-{
- struct usb_usbvision *usbvision = (struct usb_usbvision *) ptr;
-#else
static void __devexit usbvision_disconnect(struct usb_interface *intf)
{
struct usb_usbvision *usbvision = usb_get_intfdata(intf);
-#endif
PDEBUG(DBG_PROBE, "");
@@ -2039,11 +1869,7 @@ static void __devexit usbvision_disconnect(struct usb_interface *intf)
err("%s: usb_get_intfdata() failed", __func__);
return;
}
-#if LINUX_VERSION_CODE < KERNEL_VERSION(2,6,0)
- MOD_INC_USE_COUNT;
-#else
usb_set_intfdata (intf, NULL);
-#endif
mutex_lock(&usbvision->lock);
@@ -2056,9 +1882,7 @@ static void __devexit usbvision_disconnect(struct usb_interface *intf)
}
usbvision->remove_pending = 1; // Now all ISO data will be ignored
-#if LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,0)
usb_put_dev(usbvision->dev);
-#endif
usbvision->dev = NULL; // USB device is no more
mutex_unlock(&usbvision->lock);
@@ -2073,15 +1897,10 @@ static void __devexit usbvision_disconnect(struct usb_interface *intf)
}
PDEBUG(DBG_PROBE, "success");
-
-#if LINUX_VERSION_CODE < KERNEL_VERSION(2,6,0)
- MOD_DEC_USE_COUNT;
-#endif
}
static struct usb_driver usbvision_driver = {
-#if (LINUX_VERSION_CODE >= KERNEL_VERSION(2,4,31)) && \
- (LINUX_VERSION_CODE < KERNEL_VERSION(2,6,16))
+#if LINUX_VERSION_CODE < KERNEL_VERSION(2,6,16)
.owner = THIS_MODULE,
#endif
.name = "usbvision",
diff --git a/linux/drivers/media/video/usbvision/usbvision.h b/linux/drivers/media/video/usbvision/usbvision.h
index 9f4c40dbf..371c6987f 100644
--- a/linux/drivers/media/video/usbvision/usbvision.h
+++ b/linux/drivers/media/video/usbvision/usbvision.h
@@ -401,11 +401,7 @@ struct usb_usbvision {
struct semaphore lock;
#endif
struct timer_list powerOffTimer;
-#if LINUX_VERSION_CODE < KERNEL_VERSION(2,6,0)
- struct tq_struct powerOffTask;
-#else
struct work_struct powerOffWork;
-#endif
int power; /* is the device powered on? */
int user; /* user count for exclusive use */
int initialized; /* Had we already sent init sequence? */
diff --git a/linux/drivers/media/video/uvc/uvc_driver.c b/linux/drivers/media/video/uvc/uvc_driver.c
index e7b469ca5..31a0e706a 100644
--- a/linux/drivers/media/video/uvc/uvc_driver.c
+++ b/linux/drivers/media/video/uvc/uvc_driver.c
@@ -298,7 +298,8 @@ static int uvc_parse_format(struct uvc_device *dev,
switch (buffer[2]) {
case VS_FORMAT_UNCOMPRESSED:
case VS_FORMAT_FRAME_BASED:
- if (buflen < 27) {
+ n = buffer[2] == VS_FORMAT_UNCOMPRESSED ? 27 : 28;
+ if (buflen < n) {
uvc_trace(UVC_TRACE_DESCR, "device %d videostreaming"
"interface %d FORMAT error\n",
dev->udev->devnum,
diff --git a/linux/drivers/media/video/uvc/uvc_status.c b/linux/drivers/media/video/uvc/uvc_status.c
index f401c44bd..7bfddad37 100644
--- a/linux/drivers/media/video/uvc/uvc_status.c
+++ b/linux/drivers/media/video/uvc/uvc_status.c
@@ -203,6 +203,6 @@ int uvc_status_resume(struct uvc_device *dev)
if (dev->int_urb == NULL)
return 0;
- return usb_submit_urb(dev->int_urb, GFP_KERNEL);
+ return usb_submit_urb(dev->int_urb, GFP_NOIO);
}
diff --git a/linux/drivers/media/video/uvc/uvc_video.c b/linux/drivers/media/video/uvc/uvc_video.c
index 83600f259..ad63794fd 100644
--- a/linux/drivers/media/video/uvc/uvc_video.c
+++ b/linux/drivers/media/video/uvc/uvc_video.c
@@ -554,9 +554,56 @@ static void uvc_video_complete(struct urb *urb)
}
/*
+ * Free transfer buffers.
+ */
+static void uvc_free_urb_buffers(struct uvc_video_device *video)
+{
+ unsigned int i;
+
+ for (i = 0; i < UVC_URBS; ++i) {
+ if (video->urb_buffer[i]) {
+ usb_buffer_free(video->dev->udev, video->urb_size,
+ video->urb_buffer[i], video->urb_dma[i]);
+ video->urb_buffer[i] = NULL;
+ }
+ }
+
+ video->urb_size = 0;
+}
+
+/*
+ * Allocate transfer buffers. This function can be called with buffers
+ * already allocated when resuming from suspend, in which case it will
+ * return without touching the buffers.
+ *
+ * Return 0 on success or -ENOMEM when out of memory.
+ */
+static int uvc_alloc_urb_buffers(struct uvc_video_device *video,
+ unsigned int size)
+{
+ unsigned int i;
+
+ /* Buffers are already allocated, bail out. */
+ if (video->urb_size)
+ return 0;
+
+ for (i = 0; i < UVC_URBS; ++i) {
+ video->urb_buffer[i] = usb_buffer_alloc(video->dev->udev,
+ size, GFP_KERNEL, &video->urb_dma[i]);
+ if (video->urb_buffer[i] == NULL) {
+ uvc_free_urb_buffers(video);
+ return -ENOMEM;
+ }
+ }
+
+ video->urb_size = size;
+ return 0;
+}
+
+/*
* Uninitialize isochronous/bulk URBs and free transfer buffers.
*/
-static void uvc_uninit_video(struct uvc_video_device *video)
+static void uvc_uninit_video(struct uvc_video_device *video, int free_buffers)
{
struct urb *urb;
unsigned int i;
@@ -566,19 +613,12 @@ static void uvc_uninit_video(struct uvc_video_device *video)
continue;
usb_kill_urb(urb);
- /* urb->transfer_buffer_length is not touched by USB core, so
- * we can use it here as the buffer length.
- */
- if (video->urb_buffer[i]) {
- usb_buffer_free(video->dev->udev,
- urb->transfer_buffer_length,
- video->urb_buffer[i], urb->transfer_dma);
- video->urb_buffer[i] = NULL;
- }
-
usb_free_urb(urb);
video->urb[i] = NULL;
}
+
+ if (free_buffers)
+ uvc_free_urb_buffers(video);
}
/*
@@ -586,7 +626,7 @@ static void uvc_uninit_video(struct uvc_video_device *video)
* is given by the endpoint.
*/
static int uvc_init_video_isoc(struct uvc_video_device *video,
- struct usb_host_endpoint *ep)
+ struct usb_host_endpoint *ep, gfp_t gfp_flags)
{
struct urb *urb;
unsigned int npackets, i, j;
@@ -610,18 +650,13 @@ static int uvc_init_video_isoc(struct uvc_video_device *video,
size = npackets * psize;
+ if (uvc_alloc_urb_buffers(video, size) < 0)
+ return -ENOMEM;
+
for (i = 0; i < UVC_URBS; ++i) {
- urb = usb_alloc_urb(npackets, GFP_KERNEL);
+ urb = usb_alloc_urb(npackets, gfp_flags);
if (urb == NULL) {
- uvc_uninit_video(video);
- return -ENOMEM;
- }
-
- video->urb_buffer[i] = usb_buffer_alloc(video->dev->udev,
- size, GFP_KERNEL, &urb->transfer_dma);
- if (video->urb_buffer[i] == NULL) {
- usb_free_urb(urb);
- uvc_uninit_video(video);
+ uvc_uninit_video(video, 1);
return -ENOMEM;
}
@@ -632,6 +667,7 @@ static int uvc_init_video_isoc(struct uvc_video_device *video,
urb->transfer_flags = URB_ISO_ASAP | URB_NO_TRANSFER_DMA_MAP;
urb->interval = ep->desc.bInterval;
urb->transfer_buffer = video->urb_buffer[i];
+ urb->transfer_dma = video->urb_dma[i];
urb->complete = uvc_video_complete;
urb->number_of_packets = npackets;
urb->transfer_buffer_length = size;
@@ -652,7 +688,7 @@ static int uvc_init_video_isoc(struct uvc_video_device *video,
* given by the endpoint.
*/
static int uvc_init_video_bulk(struct uvc_video_device *video,
- struct usb_host_endpoint *ep)
+ struct usb_host_endpoint *ep, gfp_t gfp_flags)
{
struct urb *urb;
unsigned int pipe, i;
@@ -671,20 +707,15 @@ static int uvc_init_video_bulk(struct uvc_video_device *video,
if (size > psize * UVC_MAX_ISO_PACKETS)
size = psize * UVC_MAX_ISO_PACKETS;
+ if (uvc_alloc_urb_buffers(video, size) < 0)
+ return -ENOMEM;
+
pipe = usb_rcvbulkpipe(video->dev->udev, ep->desc.bEndpointAddress);
for (i = 0; i < UVC_URBS; ++i) {
- urb = usb_alloc_urb(0, GFP_KERNEL);
+ urb = usb_alloc_urb(0, gfp_flags);
if (urb == NULL) {
- uvc_uninit_video(video);
- return -ENOMEM;
- }
-
- video->urb_buffer[i] = usb_buffer_alloc(video->dev->udev,
- size, GFP_KERNEL, &urb->transfer_dma);
- if (video->urb_buffer[i] == NULL) {
- usb_free_urb(urb);
- uvc_uninit_video(video);
+ uvc_uninit_video(video, 1);
return -ENOMEM;
}
@@ -692,6 +723,7 @@ static int uvc_init_video_bulk(struct uvc_video_device *video,
video->urb_buffer[i], size, uvc_video_complete,
video);
urb->transfer_flags = URB_NO_TRANSFER_DMA_MAP;
+ urb->transfer_dma = video->urb_dma[i];
video->urb[i] = urb;
}
@@ -702,7 +734,7 @@ static int uvc_init_video_bulk(struct uvc_video_device *video,
/*
* Initialize isochronous/bulk URBs and allocate transfer buffers.
*/
-static int uvc_init_video(struct uvc_video_device *video)
+static int uvc_init_video(struct uvc_video_device *video, gfp_t gfp_flags)
{
struct usb_interface *intf = video->streaming->intf;
struct usb_host_interface *alts;
@@ -747,7 +779,7 @@ static int uvc_init_video(struct uvc_video_device *video)
if ((ret = usb_set_interface(video->dev->udev, intfnum, i)) < 0)
return ret;
- ret = uvc_init_video_isoc(video, ep);
+ ret = uvc_init_video_isoc(video, ep, gfp_flags);
} else {
/* Bulk endpoint, proceed to URB initialization. */
ep = uvc_find_endpoint(&intf->altsetting[0],
@@ -755,7 +787,7 @@ static int uvc_init_video(struct uvc_video_device *video)
if (ep == NULL)
return -EIO;
- ret = uvc_init_video_bulk(video, ep);
+ ret = uvc_init_video_bulk(video, ep, gfp_flags);
}
if (ret < 0)
@@ -763,10 +795,10 @@ static int uvc_init_video(struct uvc_video_device *video)
/* Submit the URBs. */
for (i = 0; i < UVC_URBS; ++i) {
- if ((ret = usb_submit_urb(video->urb[i], GFP_KERNEL)) < 0) {
+ if ((ret = usb_submit_urb(video->urb[i], gfp_flags)) < 0) {
uvc_printk(KERN_ERR, "Failed to submit URB %u "
"(%d).\n", i, ret);
- uvc_uninit_video(video);
+ uvc_uninit_video(video, 1);
return ret;
}
}
@@ -791,7 +823,7 @@ int uvc_video_suspend(struct uvc_video_device *video)
return 0;
video->frozen = 1;
- uvc_uninit_video(video);
+ uvc_uninit_video(video, 0);
usb_set_interface(video->dev->udev, video->streaming->intfnum, 0);
return 0;
}
@@ -818,7 +850,7 @@ int uvc_video_resume(struct uvc_video_device *video)
if (!uvc_queue_streaming(&video->queue))
return 0;
- if ((ret = uvc_init_video(video)) < 0)
+ if ((ret = uvc_init_video(video, GFP_NOIO)) < 0)
uvc_queue_enable(&video->queue, 0);
return ret;
@@ -920,7 +952,7 @@ int uvc_video_enable(struct uvc_video_device *video, int enable)
int ret;
if (!enable) {
- uvc_uninit_video(video);
+ uvc_uninit_video(video, 1);
usb_set_interface(video->dev->udev,
video->streaming->intfnum, 0);
uvc_queue_enable(&video->queue, 0);
@@ -930,6 +962,6 @@ int uvc_video_enable(struct uvc_video_device *video, int enable)
if ((ret = uvc_queue_enable(&video->queue, 1)) < 0)
return ret;
- return uvc_init_video(video);
+ return uvc_init_video(video, GFP_KERNEL);
}
diff --git a/linux/drivers/media/video/uvc/uvcvideo.h b/linux/drivers/media/video/uvc/uvcvideo.h
index 605a6ccb1..bafe3406e 100644
--- a/linux/drivers/media/video/uvc/uvcvideo.h
+++ b/linux/drivers/media/video/uvc/uvcvideo.h
@@ -602,6 +602,8 @@ struct uvc_video_device {
struct urb *urb[UVC_URBS];
char *urb_buffer[UVC_URBS];
+ dma_addr_t urb_dma[UVC_URBS];
+ unsigned int urb_size;
__u8 last_fid;
};
diff --git a/linux/drivers/media/video/v4l2-common.c b/linux/drivers/media/video/v4l2-common.c
index b721aca4e..c8b3da9f6 100644
--- a/linux/drivers/media/video/v4l2-common.c
+++ b/linux/drivers/media/video/v4l2-common.c
@@ -732,9 +732,6 @@ int v4l2_i2c_attach(struct i2c_adapter *adapter, int address, struct i2c_driver
err = probe(client, NULL);
if (err == 0) {
i2c_attach_client(client);
-#if LINUX_VERSION_CODE < KERNEL_VERSION(2,5,0)
- MOD_INC_USE_COUNT;
-#endif
} else {
kfree(client);
}
diff --git a/linux/drivers/media/video/videobuf-dma-sg.c b/linux/drivers/media/video/videobuf-dma-sg.c
index 7d459ed6b..39ae44bda 100644
--- a/linux/drivers/media/video/videobuf-dma-sg.c
+++ b/linux/drivers/media/video/videobuf-dma-sg.c
@@ -265,11 +265,7 @@ int videobuf_dma_sync(struct videobuf_queue *q, struct videobuf_dmabuf *dma)
MAGIC_CHECK(dma->magic, MAGIC_DMABUF);
BUG_ON(!dma->sglen);
-#if LINUX_VERSION_CODE < KERNEL_VERSION(2,6,5)
- dma_sync_sg(q->dev, dma->sglist, dma->nr_pages, dma->direction);
-#else
dma_sync_sg_for_cpu(q->dev, dma->sglist, dma->nr_pages, dma->direction);
-#endif
return 0;
}
@@ -392,13 +388,8 @@ videobuf_vm_close(struct vm_area_struct *vma)
*/
#if LINUX_VERSION_CODE < KERNEL_VERSION(2, 6, 24)
static struct page*
-#if LINUX_VERSION_CODE < KERNEL_VERSION(2,6,1)
-videobuf_vm_nopage(struct vm_area_struct *vma, unsigned long vaddr,
- int write_access)
-#else
videobuf_vm_nopage(struct vm_area_struct *vma, unsigned long vaddr,
int *type)
-#endif
{
struct page *page;
@@ -409,15 +400,9 @@ videobuf_vm_nopage(struct vm_area_struct *vma, unsigned long vaddr,
page = alloc_page(GFP_USER | __GFP_DMA32);
if (!page)
return NOPAGE_OOM;
-#if LINUX_VERSION_CODE < KERNEL_VERSION(2,5,20)
- clear_user_page(page_address(page), vaddr);
-#else
clear_user_page(page_address(page), vaddr, page);
-#endif
-#if LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,1)
if (type)
*type = VM_FAULT_MINOR;
-#endif
return page;
}
#else
diff --git a/linux/drivers/media/video/videobuf-dvb.c b/linux/drivers/media/video/videobuf-dvb.c
index 9a821371a..d9979ab26 100644
--- a/linux/drivers/media/video/videobuf-dvb.c
+++ b/linux/drivers/media/video/videobuf-dvb.c
@@ -13,8 +13,6 @@
* (at your option) any later version.
*/
-#if LINUX_VERSION_CODE > KERNEL_VERSION(2,6,0)
-
#include <linux/module.h>
#include <linux/init.h>
#include <linux/device.h>
@@ -161,17 +159,10 @@ int videobuf_dvb_register(struct videobuf_dvb *dvb,
dvb->name, result);
goto fail_adapter;
}
-#if (LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,12))
dvb->adapter.priv = adapter_priv;
/* register frontend */
result = dvb_register_frontend(&dvb->adapter, dvb->frontend);
-#else
- dvb->adapter->priv = adapter_priv;
-
- /* register frontend */
- result = dvb_register_frontend(dvb->adapter, dvb->frontend);
-#endif
if (result < 0) {
printk(KERN_WARNING "%s: dvb_register_frontend failed (errno = %d)\n",
dvb->name, result);
@@ -197,11 +188,7 @@ int videobuf_dvb_register(struct videobuf_dvb *dvb,
dvb->dmxdev.filternum = 256;
dvb->dmxdev.demux = &dvb->demux.dmx;
dvb->dmxdev.capabilities = 0;
-#if (LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,12))
result = dvb_dmxdev_init(&dvb->dmxdev, &dvb->adapter);
-#else
- result = dvb_dmxdev_init(&dvb->dmxdev, dvb->adapter);
-#endif
if (result < 0) {
printk(KERN_WARNING "%s: dvb_dmxdev_init failed (errno = %d)\n",
dvb->name, result);
@@ -232,11 +219,7 @@ int videobuf_dvb_register(struct videobuf_dvb *dvb,
}
/* register network adapter */
-#if (LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,12))
dvb_net_init(&dvb->adapter, &dvb->net, &dvb->demux.dmx);
-#else
- dvb_net_init(dvb->adapter, &dvb->net, &dvb->demux.dmx);
-#endif
return 0;
fail_fe_conn:
@@ -251,11 +234,7 @@ fail_dmx:
dvb_unregister_frontend(dvb->frontend);
fail_frontend:
dvb_frontend_detach(dvb->frontend);
-#if (LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,12))
dvb_unregister_adapter(&dvb->adapter);
-#else
- dvb_unregister_adapter(dvb->adapter);
-#endif
fail_adapter:
return result;
}
@@ -269,11 +248,7 @@ void videobuf_dvb_unregister(struct videobuf_dvb *dvb)
dvb_dmx_release(&dvb->demux);
dvb_unregister_frontend(dvb->frontend);
dvb_frontend_detach(dvb->frontend);
-#if (LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,12))
dvb_unregister_adapter(&dvb->adapter);
-#else
- dvb_unregister_adapter(dvb->adapter);
-#endif
}
EXPORT_SYMBOL(videobuf_dvb_register);
@@ -286,5 +261,3 @@ EXPORT_SYMBOL(videobuf_dvb_unregister);
* compile-command: "make DVB=1"
* End:
*/
-#endif /* LINUX_VERSION_CODE */
-
diff --git a/linux/drivers/media/video/videodev.c b/linux/drivers/media/video/videodev.c
index 8c74621db..91fcf1695 100644
--- a/linux/drivers/media/video/videodev.c
+++ b/linux/drivers/media/video/videodev.c
@@ -379,42 +379,22 @@ EXPORT_SYMBOL(v4l_printk_ioctl);
* sysfs stuff
*/
-#if LINUX_VERSION_CODE < KERNEL_VERSION(2,6,13)
-static ssize_t show_index(struct class_device *cd, char *buf)
-#else
static ssize_t show_index(struct device *cd,
struct device_attribute *attr, char *buf)
-#endif
{
struct video_device *vfd = container_of(cd, struct video_device,
class_dev);
return sprintf(buf, "%i\n", vfd->index);
}
-#if LINUX_VERSION_CODE < KERNEL_VERSION(2,6,13)
-static ssize_t show_name(struct class_device *cd, char *buf)
-#else
static ssize_t show_name(struct device *cd,
struct device_attribute *attr, char *buf)
-#endif
{
struct video_device *vfd = container_of(cd, struct video_device,
class_dev);
return sprintf(buf, "%.*s\n", (int)sizeof(vfd->name), vfd->name);
}
-#if LINUX_VERSION_CODE < KERNEL_VERSION(2,6,12)
-static ssize_t show_dev(struct class_device *cd, char *buf)
-{
- struct video_device *vfd = container_of(cd, struct video_device,
- class_dev);
- dev_t dev = MKDEV(VIDEO_MAJOR, vfd->minor);
- return print_dev_t(buf,dev);
-}
-
-static DEVICE_ATTR(dev, S_IRUGO, show_dev, NULL);
-
-#endif
struct video_device *video_device_alloc(void)
{
struct video_device *vfd;
@@ -430,11 +410,7 @@ void video_device_release(struct video_device *vfd)
}
EXPORT_SYMBOL(video_device_release);
-#if LINUX_VERSION_CODE < KERNEL_VERSION(2,6,13)
-static void video_release(struct class_device *cd)
-#else
static void video_release(struct device *cd)
-#endif
{
struct video_device *vfd = container_of(cd, struct video_device,
class_dev);
@@ -447,22 +423,16 @@ static void video_release(struct device *cd)
vfd->release(vfd);
}
-#if LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,13)
static struct device_attribute video_device_attrs[] = {
__ATTR(name, S_IRUGO, show_name, NULL),
__ATTR(index, S_IRUGO, show_index, NULL),
__ATTR_NULL
};
-#endif
static struct class video_class = {
.name = VIDEO_NAME,
-#if LINUX_VERSION_CODE < KERNEL_VERSION(2,6,13)
- .release = video_release,
-#else
.dev_attrs = video_device_attrs,
.dev_release = video_release,
-#endif
};
/*
@@ -2229,46 +2199,17 @@ int video_register_device_index(struct video_device *vfd, int type, int nr,
/* sysfs class */
memset(&vfd->class_dev, 0x00, sizeof(vfd->class_dev));
-#if LINUX_VERSION_CODE < KERNEL_VERSION(2,6,13)
- if (vfd->dev)
- vfd->class_dev.dev = vfd->dev;
-#else
if (vfd->dev)
vfd->class_dev.parent = vfd->dev;
-#endif
vfd->class_dev.class = &video_class;
-#if LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,12)
vfd->class_dev.devt = MKDEV(VIDEO_MAJOR, vfd->minor);
-#endif
-#if LINUX_VERSION_CODE < KERNEL_VERSION(2,6,13)
- sprintf(vfd->class_dev.class_id, "%s%d", name_base, i - base);
-#else
sprintf(vfd->class_dev.bus_id, "%s%d", name_base, i - base);
-#endif
ret = device_register(&vfd->class_dev);
if (ret < 0) {
printk(KERN_ERR "%s: device_register failed\n",
__func__);
goto fail_minor;
}
-#if LINUX_VERSION_CODE < KERNEL_VERSION(2,6,13)
- ret = class_device_create_file(&vfd->class_dev, &class_device_attr_name);
- if (ret < 0) {
- printk(KERN_ERR "%s: class_device_create_file 'name' failed\n",
- __FUNCTION__);
- class_device_unregister(&vfd->class_dev);
- goto fail_minor;
- }
-#endif
-#if LINUX_VERSION_CODE < KERNEL_VERSION(2,6,12)
- ret = class_device_create_file(&vfd->class_dev, &class_device_attr_dev);
- if (ret < 0) {
- printk(KERN_ERR "%s: class_device_create_file 'dev' failed\n",
- __FUNCTION__);
- class_device_unregister(&vfd->class_dev);
- goto fail_minor;
- }
-#endif
#if 1 /* keep */
/* needed until all drivers are fixed */
diff --git a/linux/drivers/media/video/vivi.c b/linux/drivers/media/video/vivi.c
index 12307d4bd..98ee2225c 100644
--- a/linux/drivers/media/video/vivi.c
+++ b/linux/drivers/media/video/vivi.c
@@ -40,9 +40,7 @@
#include <linux/interrupt.h>
#include <media/videobuf-vmalloc.h>
#include <media/v4l2-common.h>
-#if LINUX_VERSION_CODE >= KERNEL_VERSION(2, 6, 0)
#include <linux/kthread.h>
-#endif
#include <linux/highmem.h>
#if LINUX_VERSION_CODE >= KERNEL_VERSION(2, 6, 20)
#include <linux/freezer.h>
@@ -161,10 +159,6 @@ struct vivi_dmaqueue {
/* thread for generating video stream*/
struct task_struct *kthread;
wait_queue_head_t wq;
-#if LINUX_VERSION_CODE < KERNEL_VERSION(2, 5, 0)
- struct semaphore *notify;
- int rmmod:1;
-#endif
/* Counters to control fps rate */
int frame;
int ini_jiffies;
@@ -446,13 +440,8 @@ static void vivi_sleep(struct vivi_fh *fh)
(unsigned long)dma_q);
add_wait_queue(&dma_q->wq, &wait);
-#if LINUX_VERSION_CODE < KERNEL_VERSION(2, 5, 0)
- if ((q->rmmod || signal_pending(current)))
- goto stop_task;
-#else
if (kthread_should_stop())
goto stop_task;
-#endif
/* Calculate time to wake up */
timeout = msecs_to_jiffies(frames_to_ms(1));
@@ -471,20 +460,6 @@ static int vivi_thread(void *data)
struct vivi_fh *fh = data;
struct vivi_dev *dev = fh->dev;
-#if LINUX_VERSION_CODE < KERNEL_VERSION(2, 5, 0)
- daemonize();
- exit_files(current);
- reparent_to_init();
-
- spin_lock_irq(SIGMASK_LOCK(current));
- sigfillset(&current->blocked);
- spin_unlock_irq(SIGMASK_LOCK(current));
- strcpy(current->comm, "vivi");
-
- dma_q->kthread = current;
- if (dma_q->notify != NULL)
- up(dma_q->notify);
-#endif
dprintk(dev, 1, "thread started\n");
set_freezable();
@@ -492,20 +467,10 @@ static int vivi_thread(void *data)
for (;;) {
vivi_sleep(fh);
-#if LINUX_VERSION_CODE < KERNEL_VERSION(2, 5, 0)
- if (dma_q->rmmod || signal_pending(current))
-#else
if (kthread_should_stop())
-#endif
break;
}
dprintk(dev, 1, "thread: exit\n");
-#if LINUX_VERSION_CODE < KERNEL_VERSION(2, 5, 0)
- dma_q->kthread = NULL;
-
- if (dma_q->notify != NULL)
- up(dma_q->notify);
-#endif
return 0;
}
@@ -519,28 +484,12 @@ static int vivi_start_thread(struct vivi_fh *fh)
dprintk(dev, 1, "%s\n", __func__);
-#if LINUX_VERSION_CODE >= KERNEL_VERSION(2, 5, 0)
dma_q->kthread = kthread_run(vivi_thread, fh, "vivi");
if (IS_ERR(dma_q->kthread)) {
printk(KERN_ERR "vivi: kernel_thread() failed\n");
return PTR_ERR(dma_q->kthread);
}
-#else
- DECLARE_MUTEX_LOCKED(sem);
-
- dma_q->kthread = NULL;
- dma_q->notify = &sem;
- dma_q->rmmod = 0;
-
- if (kernel_thread(vivi_thread, fh, 0) < 0) {
- printk(KERN_ERR "sdim: kernel_thread() failed\n");
- return -EINVAL;
- }
-
- down(&sem);
- dma_q->notify = NULL;
-#endif
/* Wakes thread */
wake_up_interruptible(&dma_q->wq);
@@ -555,19 +504,7 @@ static void vivi_stop_thread(struct vivi_dmaqueue *dma_q)
dprintk(dev, 1, "%s\n", __func__);
/* shutdown control thread */
if (dma_q->kthread) {
-#if LINUX_VERSION_CODE < KERNEL_VERSION(2, 5, 0)
- DECLARE_MUTEX_LOCKED(sem);
-
- /* shutdown control thread */
- dma_q->notify = &sem;
- dma_q->rmmod = 1;
- if (waitqueue_active(&dma_q->wq))
- wake_up_interruptible(&dma_q->wq);
- down(&sem);
- dma_q->notify = NULL;
-#else
kthread_stop(dma_q->kthread);
-#endif
dma_q->kthread = NULL;
}
}
@@ -1130,9 +1067,7 @@ static const struct file_operations vivi_fops = {
.read = vivi_read,
.poll = vivi_poll,
.ioctl = video_ioctl2, /* V4L2 ioctl handler */
-#if LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,11)
.compat_ioctl = v4l_compat_ioctl32,
-#endif
.mmap = vivi_mmap,
.llseek = no_llseek,
};
diff --git a/linux/drivers/media/video/vp27smpx.c b/linux/drivers/media/video/vp27smpx.c
index 25a69c7f5..6c47c5e5a 100644
--- a/linux/drivers/media/video/vp27smpx.c
+++ b/linux/drivers/media/video/vp27smpx.c
@@ -31,10 +31,6 @@
#include <media/v4l2-common.h>
#include <media/v4l2-chip-ident.h>
#include <media/v4l2-i2c-drv.h>
-#if LINUX_VERSION_CODE < KERNEL_VERSION(2, 5, 0)
-#include "i2c-compat.h"
-#include <linux/slab.h>
-#endif
#include "compat.h"
MODULE_DESCRIPTION("vp27smpx driver");
@@ -44,10 +40,6 @@ MODULE_LICENSE("GPL");
#if LINUX_VERSION_CODE < KERNEL_VERSION(2, 6, 22)
static unsigned short normal_i2c[] = { 0xb6 >> 1, I2C_CLIENT_END };
-#if LINUX_VERSION_CODE < KERNEL_VERSION(2, 6, 13)
-static unsigned short normal_i2c_range[] = { I2C_CLIENT_END };
-#endif
-
I2C_CLIENT_INSMOD;
#endif
@@ -183,14 +175,7 @@ static struct v4l2_i2c_driver_data v4l2_i2c_data = {
.command = vp27smpx_command,
.probe = vp27smpx_probe,
.remove = vp27smpx_remove,
-#ifndef I2C_CLASS_TV_ANALOG
- .legacy_id = I2C_HW_B_CX2341X,
-#endif
#if LINUX_VERSION_CODE >= KERNEL_VERSION(2, 6, 26)
.id_table = vp27smpx_id,
#endif
};
-
-#if LINUX_VERSION_CODE < KERNEL_VERSION(2, 5, 0)
-EXPORT_NO_SYMBOLS;
-#endif
diff --git a/linux/drivers/media/video/wm8739.c b/linux/drivers/media/video/wm8739.c
index d448dcf6e..b361d0d42 100644
--- a/linux/drivers/media/video/wm8739.c
+++ b/linux/drivers/media/video/wm8739.c
@@ -31,10 +31,6 @@
#include <media/v4l2-common.h>
#include <media/v4l2-chip-ident.h>
#include <media/v4l2-i2c-drv.h>
-#if LINUX_VERSION_CODE < KERNEL_VERSION(2, 5, 0)
-#include "i2c-compat.h"
-#include <linux/slab.h>
-#endif
#include "compat.h"
MODULE_DESCRIPTION("wm8739 driver");
@@ -43,21 +39,13 @@ MODULE_LICENSE("GPL");
static int debug;
-#if LINUX_VERSION_CODE >= KERNEL_VERSION(2, 6, 0)
module_param(debug, int, 0644);
-#else
-MODULE_PARM(debug, "i");
-#endif
MODULE_PARM_DESC(debug, "Debug level (0-1)");
#if LINUX_VERSION_CODE < KERNEL_VERSION(2, 6, 22)
static unsigned short normal_i2c[] = { 0x34 >> 1, 0x36 >> 1, I2C_CLIENT_END };
-#if LINUX_VERSION_CODE < KERNEL_VERSION(2, 6, 13)
-static unsigned short normal_i2c_range[] = { I2C_CLIENT_END };
-#endif
-
I2C_CLIENT_INSMOD;
#endif
@@ -345,14 +333,7 @@ static struct v4l2_i2c_driver_data v4l2_i2c_data = {
.command = wm8739_command,
.probe = wm8739_probe,
.remove = wm8739_remove,
-#ifndef I2C_CLASS_TV_ANALOG
- .legacy_id = I2C_HW_B_CX2341X,
-#endif
#if LINUX_VERSION_CODE >= KERNEL_VERSION(2, 6, 26)
.id_table = wm8739_id,
#endif
};
-
-#if LINUX_VERSION_CODE < KERNEL_VERSION(2, 5, 0)
-EXPORT_NO_SYMBOLS;
-#endif
diff --git a/linux/drivers/media/video/wm8775.c b/linux/drivers/media/video/wm8775.c
index 81a08d674..e7a2e0449 100644
--- a/linux/drivers/media/video/wm8775.c
+++ b/linux/drivers/media/video/wm8775.c
@@ -35,10 +35,6 @@
#include <media/v4l2-common.h>
#include <media/v4l2-chip-ident.h>
#include <media/v4l2-i2c-drv-legacy.h>
-#if LINUX_VERSION_CODE < KERNEL_VERSION(2, 5, 0)
-#include "i2c-compat.h"
-#include <linux/slab.h>
-#endif
#include "compat.h"
MODULE_DESCRIPTION("wm8775 driver");
@@ -47,10 +43,6 @@ MODULE_LICENSE("GPL");
static unsigned short normal_i2c[] = { 0x36 >> 1, I2C_CLIENT_END };
-#if LINUX_VERSION_CODE < KERNEL_VERSION(2, 6, 13)
-static unsigned short normal_i2c_range[] = { I2C_CLIENT_END };
-#endif
-
I2C_CLIENT_INSMOD;
@@ -242,7 +234,3 @@ static struct v4l2_i2c_driver_data v4l2_i2c_data = {
.id_table = wm8775_id,
#endif
};
-
-#if LINUX_VERSION_CODE < KERNEL_VERSION(2, 5, 0)
-EXPORT_NO_SYMBOLS;
-#endif
diff --git a/linux/include/linux/videodev2.h b/linux/include/linux/videodev2.h
index 716197646..e92b53dd0 100644
--- a/linux/include/linux/videodev2.h
+++ b/linux/include/linux/videodev2.h
@@ -310,6 +310,7 @@ struct v4l2_pix_format
/* see http://www.siliconimaging.com/RGB%20Bayer.htm */
#define V4L2_PIX_FMT_SBGGR8 v4l2_fourcc('B','A','8','1') /* 8 BGBG.. GRGR.. */
+#define V4L2_PIX_FMT_SGBRG8 v4l2_fourcc('G','B','R','G') /* 8 GBGB.. RGRG.. */
#define V4L2_PIX_FMT_SBGGR16 v4l2_fourcc('B','Y','R','2') /* 16 BGBG.. GRGR.. */
/* compressed formats */
@@ -325,7 +326,8 @@ struct v4l2_pix_format
#define V4L2_PIX_FMT_PWC2 v4l2_fourcc('P','W','C','2') /* pwc newer webcam */
#define V4L2_PIX_FMT_ET61X251 v4l2_fourcc('E','6','2','5') /* ET61X251 compression */
#define V4L2_PIX_FMT_SPCA501 v4l2_fourcc('S','5','0','1') /* YUYV per line */
-#define V4L2_PIX_FMT_SPCA561 v4l2_fourcc('S','5','6','1') /* compressed BGGR bayer */
+#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 */
/*
* F O R M A T E N U M E R A T I O N
diff --git a/linux/include/media/pwc-ioctl.h b/linux/include/media/pwc-ioctl.h
index 6e32ef4e2..0f19779c4 100644
--- a/linux/include/media/pwc-ioctl.h
+++ b/linux/include/media/pwc-ioctl.h
@@ -55,12 +55,7 @@
#include <linux/types.h>
#include <linux/version.h>
-#if LINUX_VERSION_CODE <= KERNEL_VERSION(2, 6, 10)
-/* Compatibility for older kernel */
-typedef __u16 __le16;
-#endif
-
- /* Enumeration of image sizes */
+/* Enumeration of image sizes */
#define PSZ_SQCIF 0x00
#define PSZ_QSIF 0x01
#define PSZ_QCIF 0x02
diff --git a/linux/include/media/v4l2-dev.h b/linux/include/media/v4l2-dev.h
index d1ca9664e..fb356eb57 100644
--- a/linux/include/media/v4l2-dev.h
+++ b/linux/include/media/v4l2-dev.h
@@ -14,9 +14,7 @@
#include <linux/poll.h>
#include <linux/fs.h>
-#if LINUX_VERSION_CODE > KERNEL_VERSION(2,5,0)
#include <linux/device.h>
-#endif
#if LINUX_VERSION_CODE > KERNEL_VERSION(2,6,15)
#include <linux/mutex.h>
#else
@@ -97,15 +95,9 @@ struct video_device
struct file_operations *fops;
#endif
-#if LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,0)
/* sysfs */
-#if LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,13)
struct device class_dev; /* v4l device */
-#else
- struct class_device class_dev;
-#endif
struct device *dev; /* device parent */
-#endif
/* device info */
char name[32];
@@ -399,15 +391,9 @@ extern int video_usercopy(struct inode *inode, struct file *file,
#ifdef CONFIG_VIDEO_V4L1_COMPAT
#include <linux/mm.h>
-#if LINUX_VERSION_CODE > KERNEL_VERSION(2,6,0)
static inline int __must_check
-#if LINUX_VERSION_CODE < KERNEL_VERSION(2,6,13)
-video_device_create_file(struct video_device *vfd,
- struct class_device_attribute *attr)
-#else
video_device_create_file(struct video_device *vfd,
struct device_attribute *attr)
-#endif
{
int ret = device_create_file(&vfd->class_dev, attr);
if (ret < 0)
@@ -420,7 +406,6 @@ video_device_remove_file(struct video_device *vfd,
{
device_remove_file(&vfd->class_dev, attr);
}
-#endif
#endif /* CONFIG_VIDEO_V4L1_COMPAT */
diff --git a/linux/include/media/v4l2-i2c-drv-legacy.h b/linux/include/media/v4l2-i2c-drv-legacy.h
index e95e2a072..738f87454 100644
--- a/linux/include/media/v4l2-i2c-drv-legacy.h
+++ b/linux/include/media/v4l2-i2c-drv-legacy.h
@@ -30,11 +30,7 @@ struct v4l2_i2c_driver_data {
int (*suspend)(struct i2c_client *client, pm_message_t state);
int (*resume)(struct i2c_client *client);
int (*legacy_probe)(struct i2c_adapter *adapter);
-#ifdef I2C_CLASS_TV_ANALOG
int legacy_class;
-#else
- int legacy_id;
-#endif
#if LINUX_VERSION_CODE >= KERNEL_VERSION(2, 6, 26)
const struct i2c_device_id *id_table;
#endif
@@ -49,12 +45,7 @@ static struct i2c_client_address_data addr_data;
static struct i2c_driver v4l2_i2c_driver_legacy;
static char v4l2_i2c_drv_name_legacy[32];
-#if LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,0)
static int v4l2_i2c_drv_attach_legacy(struct i2c_adapter *adapter, int address, int kind)
-#else
-static int v4l2_i2c_drv_attach_legacy(struct i2c_adapter *adapter, int address,
- unsigned short flags, int kind)
-#endif
{
return v4l2_i2c_attach(adapter, address, &v4l2_i2c_driver_legacy,
v4l2_i2c_drv_name_legacy, v4l2_i2c_data.probe);
@@ -67,11 +58,7 @@ static int v4l2_i2c_drv_probe_legacy(struct i2c_adapter *adapter)
return i2c_probe(adapter, &addr_data, v4l2_i2c_drv_attach_legacy);
return 0;
}
-#ifdef I2C_CLASS_TV_ANALOG
if (adapter->class & v4l2_i2c_data.legacy_class)
-#else
- if (adapter->id == v4l2_i2c_data.legacy_id)
-#endif
return i2c_probe(adapter, &addr_data, v4l2_i2c_drv_attach_legacy);
return 0;
}
@@ -87,14 +74,9 @@ static int v4l2_i2c_drv_detach_legacy(struct i2c_client *client)
if (err)
return err;
kfree(client);
-
-#if LINUX_VERSION_CODE < KERNEL_VERSION(2,5,0)
- MOD_DEC_USE_COUNT;
-#endif
return 0;
}
-#if LINUX_VERSION_CODE >= KERNEL_VERSION(2,5,0)
#if LINUX_VERSION_CODE > KERNEL_VERSION(2,6,14)
#if LINUX_VERSION_CODE > KERNEL_VERSION(2,6,20)
static int v4l2_i2c_drv_suspend_helper(struct i2c_client *client, pm_message_t state)
@@ -130,19 +112,17 @@ static int v4l2_i2c_drv_resume_helper(struct device * dev, u32 level)
#endif
return v4l2_i2c_data.resume ? v4l2_i2c_data.resume(client) : 0;
}
-#endif
/* ----------------------------------------------------------------------- */
/* i2c implementation */
static struct i2c_driver v4l2_i2c_driver_legacy = {
-#if (LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,0)) && (LINUX_VERSION_CODE <= KERNEL_VERSION(2,6,15))
+#if LINUX_VERSION_CODE <= KERNEL_VERSION(2,6,15)
.owner = THIS_MODULE,
#endif
#if LINUX_VERSION_CODE <= KERNEL_VERSION(2,6,15)
.flags = I2C_DF_NOTIFY,
#endif
-#if LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,0)
.driver = {
#if LINUX_VERSION_CODE > KERNEL_VERSION(2,6,15)
.owner = THIS_MODULE,
@@ -152,7 +132,6 @@ static struct i2c_driver v4l2_i2c_driver_legacy = {
.resume = v4l2_i2c_drv_resume_helper,
#endif
},
-#endif
.attach_adapter = v4l2_i2c_drv_probe_legacy,
.detach_client = v4l2_i2c_drv_detach_legacy,
#if LINUX_VERSION_CODE > KERNEL_VERSION(2,6,20)
@@ -184,13 +163,8 @@ static int __init v4l2_i2c_drv_init(void)
strlcpy(v4l2_i2c_drv_name_legacy, v4l2_i2c_data.name, sizeof(v4l2_i2c_drv_name_legacy));
strlcat(v4l2_i2c_drv_name_legacy, "'", sizeof(v4l2_i2c_drv_name_legacy));
-#ifdef I2C_CLASS_TV_ANALOG
if (v4l2_i2c_data.legacy_class == 0)
v4l2_i2c_data.legacy_class = I2C_CLASS_TV_ANALOG;
-#else
- if (v4l2_i2c_data.legacy_id == 0)
- v4l2_i2c_data.legacy_id = I2C_HW_B_BT848;
-#endif
#if LINUX_VERSION_CODE <= KERNEL_VERSION(2,6,15)
strlcpy(v4l2_i2c_driver_legacy.name, v4l2_i2c_drv_name_legacy, sizeof(v4l2_i2c_driver_legacy.name));
diff --git a/linux/include/media/v4l2-i2c-drv.h b/linux/include/media/v4l2-i2c-drv.h
index 73d713f07..f74c8a64a 100644
--- a/linux/include/media/v4l2-i2c-drv.h
+++ b/linux/include/media/v4l2-i2c-drv.h
@@ -35,11 +35,7 @@ struct v4l2_i2c_driver_data {
int (*suspend)(struct i2c_client *client, pm_message_t state);
int (*resume)(struct i2c_client *client);
int (*legacy_probe)(struct i2c_adapter *adapter);
-#ifdef I2C_CLASS_TV_ANALOG
int legacy_class;
-#else
- int legacy_id;
-#endif
#if LINUX_VERSION_CODE >= KERNEL_VERSION(2, 6, 26)
const struct i2c_device_id *id_table;
#endif
@@ -83,12 +79,7 @@ static struct i2c_client_address_data addr_data;
/* Bus-based I2C API is not present, add legacy code */
-#if LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,0)
static int v4l2_i2c_drv_attach_legacy(struct i2c_adapter *adapter, int address, int kind)
-#else
-static int v4l2_i2c_drv_attach_legacy(struct i2c_adapter *adapter, int address,
- unsigned short flags, int kind)
-#endif
{
return v4l2_i2c_attach(adapter, address, &v4l2_i2c_driver,
v4l2_i2c_data.name, v4l2_i2c_data.probe);
@@ -101,11 +92,7 @@ static int v4l2_i2c_drv_probe_legacy(struct i2c_adapter *adapter)
return i2c_probe(adapter, &addr_data, v4l2_i2c_drv_attach_legacy);
return 0;
}
-#ifdef I2C_CLASS_TV_ANALOG
if (adapter->class & v4l2_i2c_data.legacy_class)
-#else
- if (adapter->id == v4l2_i2c_data.legacy_id)
-#endif
return i2c_probe(adapter, &addr_data, v4l2_i2c_drv_attach_legacy);
return 0;
}
@@ -121,14 +108,9 @@ static int v4l2_i2c_drv_detach_legacy(struct i2c_client *client)
if (err)
return err;
kfree(client);
-
-#if LINUX_VERSION_CODE < KERNEL_VERSION(2,5,0)
- MOD_DEC_USE_COUNT;
-#endif
return 0;
}
-#if LINUX_VERSION_CODE >= KERNEL_VERSION(2,5,0)
#if LINUX_VERSION_CODE > KERNEL_VERSION(2,6,14)
#if LINUX_VERSION_CODE > KERNEL_VERSION(2,6,20)
static int v4l2_i2c_drv_suspend_helper(struct i2c_client *client, pm_message_t state)
@@ -164,18 +146,16 @@ static int v4l2_i2c_drv_resume_helper(struct device * dev, u32 level)
#endif
return v4l2_i2c_data.resume ? v4l2_i2c_data.resume(client) : 0;
}
-#endif
/* ----------------------------------------------------------------------- */
static struct i2c_driver v4l2_i2c_driver = {
-#if (LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,0)) && (LINUX_VERSION_CODE <= KERNEL_VERSION(2,6,15))
+#if LINUX_VERSION_CODE <= KERNEL_VERSION(2,6,15)
.owner = THIS_MODULE,
#endif
#if LINUX_VERSION_CODE <= KERNEL_VERSION(2,6,15)
.flags = I2C_DF_NOTIFY,
#endif
-#if LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,0)
.driver = {
#if LINUX_VERSION_CODE > KERNEL_VERSION(2,6,15)
.owner = THIS_MODULE,
@@ -185,7 +165,6 @@ static struct i2c_driver v4l2_i2c_driver = {
.resume = v4l2_i2c_drv_resume_helper,
#endif
},
-#endif
.attach_adapter = v4l2_i2c_drv_probe_legacy,
.detach_client = v4l2_i2c_drv_detach_legacy,
#if LINUX_VERSION_CODE > KERNEL_VERSION(2,6,20)
@@ -198,13 +177,8 @@ static struct i2c_driver v4l2_i2c_driver = {
static int __init v4l2_i2c_drv_init(void)
{
-#ifdef I2C_CLASS_TV_ANALOG
if (v4l2_i2c_data.legacy_class == 0)
v4l2_i2c_data.legacy_class = I2C_CLASS_TV_ANALOG;
-#else
- if (v4l2_i2c_data.legacy_id == 0)
- v4l2_i2c_data.legacy_id = I2C_HW_B_BT848;
-#endif
#if LINUX_VERSION_CODE <= KERNEL_VERSION(2,6,15)
strlcpy(v4l2_i2c_driver.name, v4l2_i2c_data.name, sizeof(v4l2_i2c_driver.name));
diff --git a/linux/include/media/videobuf-dvb.h b/linux/include/media/videobuf-dvb.h
index 14438bc98..84886be5e 100644
--- a/linux/include/media/videobuf-dvb.h
+++ b/linux/include/media/videobuf-dvb.h
@@ -20,11 +20,7 @@ struct videobuf_dvb {
int nfeeds;
/* videobuf_dvb_(un)register manges this */
-#if (LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,12))
struct dvb_adapter adapter;
-#else
- struct dvb_adapter *adapter;
-#endif
struct dvb_demux demux;
struct dmxdev dmxdev;
struct dmx_frontend fe_hw;
diff --git a/linux/sound/pci/bt87x.c b/linux/sound/pci/bt87x.c
index 7e6f22041..f9775c090 100644
--- a/linux/sound/pci/bt87x.c
+++ b/linux/sound/pci/bt87x.c
@@ -37,10 +37,6 @@
#include <sound/control.h>
#include <sound/initval.h>
#include "compat.h"
-#if LINUX_VERSION_CODE < KERNEL_VERSION(2,6,14)
-/* From linux/pch_ids.h, appeared in 2.6.14 */
-#define PCI_DEVICE_ID_BROOKTREE_879 0x0879
-#endif
#ifdef COMPAT_SND_CTL_BOOLEAN_MONO
static int snd_ctl_boolean_mono_info(struct snd_kcontrol *kcontrol,
struct snd_ctl_elem_info *uinfo)
diff --git a/v4l/compat.h b/v4l/compat.h
index 88afe3d83..b59d0ed04 100644
--- a/v4l/compat.h
+++ b/v4l/compat.h
@@ -31,248 +31,14 @@
#define cancel_delayed_work_sync cancel_rearming_delayed_work
#endif
-#if LINUX_VERSION_CODE < KERNEL_VERSION(2,4,18)
-# define minor(x) MINOR(x)
-#endif
-
-#if LINUX_VERSION_CODE < KERNEL_VERSION(2,6,13)
-# define DEVICE_ATTR(a,b,c,d) CLASS_DEVICE_ATTR(a,b,c,d)
-# define device_create_file(a,b) class_device_create_file(a,b)
-# define device_remove_file(a,b) class_device_remove_file(a,b)
-# define device_register(a) class_device_register(a)
-# define device_unregister(a) class_device_unregister(a)
-#endif
-
-#if LINUX_VERSION_CODE < KERNEL_VERSION(2,5,0)
-# include <linux/moduleparam.h>
-# include <linux/delay.h>
-# define need_resched() (current->need_resched)
-# define work_struct tq_struct
-#endif
-
-#if LINUX_VERSION_CODE < KERNEL_VERSION(2,4,19)
-# define BUG_ON(condition) do { if ((condition)!=0) BUG(); } while(0)
-#endif
-
-#if LINUX_VERSION_CODE < KERNEL_VERSION(2,4,23)
-# define irqreturn_t void
-# define IRQ_RETVAL(foobar)
-#endif
-
-#if LINUX_VERSION_CODE < KERNEL_VERSION(2,5,71)
-# define strlcpy(dest,src,len) strncpy(dest,src,(len)-1)
-#endif
-
-#if LINUX_VERSION_CODE < KERNEL_VERSION(2,6,0)
-# define iminor(inode) minor(inode->i_rdev)
-#endif
-
-#if defined(I2C_ADAP_CLASS_TV_ANALOG) && !defined(I2C_CLASS_TV_ANALOG)
-# define I2C_CLASS_TV_ANALOG I2C_ADAP_CLASS_TV_ANALOG
-# define I2C_CLASS_TV_DIGITAL I2C_ADAP_CLASS_TV_DIGITAL
-#endif
-
#ifndef __pure
# define __pure __attribute__((pure))
#endif
-#if LINUX_VERSION_CODE < KERNEL_VERSION(2,6,9)
-# define __user
-# define __kernel
-# define __iomem
-#endif
-
-#if LINUX_VERSION_CODE < KERNEL_VERSION(2,6,11)
-# define pm_message_t u32
-# define pci_choose_state(pci_dev, state) (state)
-# define PCI_D0 (0)
-# define assert_spin_locked(foobar)
-#endif
-
-/* Since v4l-dvb now includes it's own copy of linux/i2c-id.h these
- are no longer necessary */
-/*
-#if !defined(I2C_ALGO_SAA7134)
-#define I2C_ALGO_SAA7134 I2C_HW_B_BT848
-#endif
-#if !defined(I2C_HW_B_CX2388x)
-# define I2C_HW_B_CX2388x I2C_HW_B_BT848
-#endif
-#if !defined(I2C_HW_SAA7134)
-# define I2C_HW_SAA7134 I2C_ALGO_SAA7134
-#endif
-#if !defined(I2C_HW_SAA7146)
-# define I2C_HW_SAA7146 I2C_ALGO_SAA7146
-#endif
-#if !defined(I2C_HW_B_EM2820)
-#define I2C_HW_B_EM2820 0x99
-#endif
-*/
-
#ifndef I2C_M_IGNORE_NAK
# define I2C_M_IGNORE_NAK 0x1000
#endif
-/* v4l-dvb uses an out of kernel copy of i2c-id.h, which does not have
- some stuff that previous versions of i2c-id.h defined. */
-#if LINUX_VERSION_CODE < KERNEL_VERSION(2,6,14) && defined(LINUX_I2C_ID_H)
-# define I2C_ALGO_BIT 0x010000
-#endif
-
-#if LINUX_VERSION_CODE < KERNEL_VERSION(2,6,9)
-#define __le32 __u32
-#endif
-
-#if (LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,0)) && (LINUX_VERSION_CODE < KERNEL_VERSION(2,6,7))
-static inline unsigned long msecs_to_jiffies(const unsigned int m)
-{
-#if HZ <= 1000 && !(1000 % HZ)
- return (m + (1000 / HZ) - 1) / (1000 / HZ);
-#else
-#if HZ > 1000 && !(HZ % 1000)
- return m * (HZ / 1000);
-#else
- return (m * HZ + 999) / 1000;
-#endif
-#endif
-}
-static inline unsigned int jiffies_to_msecs(const unsigned long j)
-{
-#if HZ <= 1000 && !(1000 % HZ)
- return (1000 / HZ) * j;
-#else
-#if HZ > 1000 && !(HZ % 1000)
- return (j + (HZ / 1000) - 1)/(HZ / 1000);
-#else
- return (j * 1000) / HZ;
-#endif
-#endif
-}
-static inline void msleep(unsigned int msecs)
-{
- unsigned long timeout = msecs_to_jiffies(msecs);
- while (timeout) {
- set_current_state(TASK_UNINTERRUPTIBLE);
- timeout = schedule_timeout(timeout);
- }
-}
-#endif
-
-#if (LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,0)) && LINUX_VERSION_CODE < KERNEL_VERSION(2,6,9)
-static inline unsigned long msleep_interruptible(unsigned int msecs)
-{
- unsigned long timeout = msecs_to_jiffies(msecs);
-
- while (timeout) {
- set_current_state(TASK_INTERRUPTIBLE);
- timeout = schedule_timeout(timeout);
- }
- return jiffies_to_msecs(timeout);
-}
-#endif
-
-#if LINUX_VERSION_CODE < KERNEL_VERSION(2,6,0)
-/* some keys from 2.6.x which are not (yet?) in 2.4.x */
-# define KEY_PLAY 207
-# define KEY_PRINT 210
-# define KEY_EMAIL 215
-# define KEY_SEARCH 217
-# define KEY_SELECT 0x161
-# define KEY_GOTO 0x162
-# define KEY_INFO 0x166
-# define KEY_CHANNEL 0x16b
-# define KEY_LANGUAGE 0x170
-# define KEY_SUBTITLE 0x172
-# define KEY_ZOOM 0x174
-# define KEY_MODE 0x175
-# define KEY_TV 0x179
-# define KEY_CD 0x17f
-# define KEY_TUNER 0x182
-# define KEY_TEXT 0x184
-# define KEY_DVD 0x185
-# define KEY_AUDIO 0x188
-# define KEY_VIDEO 0x189
-# define KEY_RED 0x18e
-# define KEY_GREEN 0x18f
-# define KEY_YELLOW 0x190
-# define KEY_BLUE 0x191
-# define KEY_CHANNELUP 0x192
-# define KEY_CHANNELDOWN 0x193
-# define KEY_RESTART 0x198
-# define KEY_SHUFFLE 0x19a
-# define KEY_NEXT 0x197
-# define KEY_RADIO 0x181
-# define KEY_PREVIOUS 0x19c
-# define KEY_MHP 0x16f
-# define KEY_EPG 0x16d
-# define KEY_FASTFORWARD 208
-# define KEY_LIST 0x18b
-# define KEY_LAST 0x195
-# define KEY_CLEAR 0x163
-# define KEY_AUX 0x186
-# define KEY_SCREEN 0x177
-# define KEY_PC 0x178
-# define KEY_MEDIA 226
-# define KEY_SLOW 0x199
-# define KEY_OK 0x160
-# define KEY_DIGITS 0x19d
-#endif
-#if LINUX_VERSION_CODE < KERNEL_VERSION(2,6,14)
-# define KEY_SEND 231
-# define KEY_REPLY 232
-# define KEY_FORWARDMAIL 233
-# define KEY_SAVE 234
-# define KEY_DOCUMENTS 235
-#endif
-
-#if LINUX_VERSION_CODE < KERNEL_VERSION(2,5,0)
-#define container_of(ptr, type, member) ({ \
- const typeof( ((type *)0)->member ) *__mptr = (ptr); \
- (type *)( (char *)__mptr - offsetof(type,member) );})
-#endif
-
-#if LINUX_VERSION_CODE < KERNEL_VERSION(2,6,10)
-#include <linux/mm.h>
-static inline unsigned long vmalloc_to_pfn(void * vmalloc_addr)
-{
- return page_to_pfn(vmalloc_to_page(vmalloc_addr));
-}
-
-static unsigned long kvirt_to_pa(unsigned long adr)
-{
- unsigned long kva, ret;
-
- kva = (unsigned long) page_address(vmalloc_to_page((void *)adr));
- kva |= adr & (PAGE_SIZE-1); /* restore the offset */
- ret = __pa(kva);
- return ret;
-}
-
-#ifndef wait_event_timeout
-#define wait_event_timeout(wq, condition, timeout) \
-({ \
- long __ret = timeout; \
- if (!(condition)) \
- do { \
- DEFINE_WAIT(__wait); \
- for (;;) { \
- prepare_to_wait(&wq, &__wait, TASK_UNINTERRUPTIBLE); \
- if (condition) \
- break; \
- __ret = schedule_timeout(__ret); \
- if (!__ret) \
- break; \
- } \
- finish_wait(&wq, &__wait); \
- } while (0); \
- __ret; \
-})
-#endif
-
-#define remap_pfn_range remap_page_range
-
-#endif
-
/* vm_insert_page() was added in 2.6.15 */
#if LINUX_VERSION_CODE < KERNEL_VERSION(2,6,15) && defined(_LINUX_MM_H)
static inline int vm_insert_page(struct vm_area_struct *vma,
@@ -283,51 +49,7 @@ static inline int vm_insert_page(struct vm_area_struct *vma,
}
#endif
-#if LINUX_VERSION_CODE < KERNEL_VERSION(2,6,9)
-#ifndef kcalloc
-#define kcalloc(n,size,flags) \
-({ \
- void * __ret = NULL; \
- __ret = kmalloc(n * size, flags); \
- if (__ret) \
- memset(__ret, 0, n * size); \
- __ret; \
-})
-#endif
-#endif
-
-/* try_to_freeze() lost its argument. Must appear after linux/sched.h */
-#if LINUX_VERSION_CODE < KERNEL_VERSION(2,6,13) && defined(_LINUX_SCHED_H)
-# if LINUX_VERSION_CODE >= KERNEL_VERSION(2,5,0)
-# define try_to_freeze() try_to_freeze(PF_FREEZE)
-# else
-# define try_to_freeze() (0)
-# endif
-#endif
-
-#if LINUX_VERSION_CODE < KERNEL_VERSION(2,6,14)
-#ifndef kzalloc
-#define kzalloc(size, flags) \
-({ \
- void *__ret = kmalloc(size, flags); \
- if (__ret) \
- memset(__ret, 0, size); \
- __ret; \
-})
-#endif
-#endif
-
-/* The class_device system didn't appear until 2.5.69 */
-#if LINUX_VERSION_CODE < KERNEL_VERSION(2,6,0)
-#define class_device_create_file(a, b) (0)
-#endif
-
-#if LINUX_VERSION_CODE < KERNEL_VERSION(2,6,13)
-# define class_device_create(a, b, c, d, e, f, g, h) class_simple_device_add(a, c, d, e, f, g, h)
-# define class_device_destroy(a, b) class_simple_device_remove(b)
-# define class_create(a, b) class_simple_create(a, b)
-# define class_destroy(a) class_simple_destroy(a)
-#elif LINUX_VERSION_CODE < KERNEL_VERSION(2,6,15)
+#if LINUX_VERSION_CODE < KERNEL_VERSION(2,6,15)
# define class_device_create(a, b, c, d, e, f, g, h) class_device_create(a, c, d, e, f, g, h)
#endif
/* device_create/destroy added in 2.6.18 */
@@ -355,15 +77,6 @@ static inline int vm_insert_page(struct vm_area_struct *vma,
#define mutex_trylock(a) down_trylock(a)
#endif
-#if LINUX_VERSION_CODE < KERNEL_VERSION(2,6,14) && defined(_LINUX_SCHED_H)
-static inline signed long __sched
-schedule_timeout_interruptible(signed long timeout)
-{
- __set_current_state(TASK_INTERRUPTIBLE);
- return schedule_timeout(timeout);
-}
-#endif
-
/* New 4GB DMA zone was added in 2.6.15-rc2 */
#if LINUX_VERSION_CODE < KERNEL_VERSION(2,6,15)
# define __GFP_DMA32 __GFP_DMA
@@ -387,25 +100,6 @@ static inline void setup_timer(struct timer_list * timer,
#define IRQF_DISABLED SA_INTERRUPT
#endif
-/* linux/usb.h must be included _before_ compat.h for this code to get
- turned on. We can not just include usb.h here, because there is a
- lot of code which will not compile if it has usb.h included, due to
- conflicts with symbol names. */
-#if LINUX_VERSION_CODE < KERNEL_VERSION(2,6,13) && \
- defined(__LINUX_USB_H) && defined(_INPUT_H)
-#include <linux/input.h>
-/* Found in linux/usb_input.h in 2.6.13 */
-/* Moved to linux/usb/input.h in 2.6.18 */
-static inline void
-usb_to_input_id(const struct usb_device *dev, struct input_id *id)
-{
- id->bustype = BUS_USB;
- id->vendor = le16_to_cpu(dev->descriptor.idVendor);
- id->product = le16_to_cpu(dev->descriptor.idProduct);
- id->version = le16_to_cpu(dev->descriptor.bcdDevice);
-}
-#endif
-
#if LINUX_VERSION_CODE < KERNEL_VERSION(2,6,19)
# define PCIAGP_FAIL 0
@@ -433,11 +127,6 @@ typedef int bool;
#define SONY_PIC_COMMAND_SETCAMERA SONYPI_COMMAND_SETCAMERA
#endif
-/* Parameter to pci_match_device() changed in 2.6.13-rc2 */
-#if LINUX_VERSION_CODE < KERNEL_VERSION(2,6,13) && defined(LINUX_PCI_H)
-#define pci_match_device(drv, dev) pci_match_device((drv)->id_table, dev)
-#endif
-
/* pci_dev got a new revision field in 2.6.23-rc1 */
#if LINUX_VERSION_CODE < KERNEL_VERSION(2,6,23) && defined(LINUX_PCI_H)
/* Just make it easier to subsitute pci_dev->revision with
diff --git a/v4l/scripts/release.sh b/v4l/scripts/release.sh
index 557172875..4e9c810bc 100755
--- a/v4l/scripts/release.sh
+++ b/v4l/scripts/release.sh
@@ -9,7 +9,7 @@ ver_cx="0.0.4"
# common files
files_v4l="v4l*.[ch] video-buf.[ch] videodev*.h"
files_tuner="tuner.[ch] tda9887.[ch]"
-files_i2c="id.h audiochip.h i2c-compat.h"
+files_i2c="id.h audiochip.h"
files_common="$files_v4l $files_tuner $files_i2c doc"
# other files
diff --git a/v4l_experimental/dpl3518.c b/v4l_experimental/dpl3518.c
index 43533767e..a9ee6bd52 100644
--- a/v4l_experimental/dpl3518.c
+++ b/v4l_experimental/dpl3518.c
@@ -46,12 +46,7 @@
#include <linux/fs.h>
#include <asm/uaccess.h>
-#if LINUX_VERSION_CODE < KERNEL_VERSION(2,5,0)
-#include "id.h"
-#include "i2c-compat.h"
-#else
#include <media/id.h>
-#endif
#include "dpl3518.h"
@@ -60,9 +55,7 @@
static unsigned short normal_i2c[] = {
I2C_DPL3518 >> 1,
I2C_CLIENT_END};
-#if LINUX_VERSION_CODE < KERNEL_VERSION(2,6,13)
-static unsigned short normal_i2c_range[] = {I2C_CLIENT_END};
-#endif
+
I2C_CLIENT_INSMOD;
struct dpl3518 {
@@ -235,12 +228,7 @@ static void dpl3518_spatial(struct i2c_client *client, int spatial)
/* ----------------------------------------------------------------------- */
-#if LINUX_VERSION_CODE >= KERNEL_VERSION(2,5,0)
static int dpl3518_attach(struct i2c_adapter *adap, int addr, int kind)
-#else
-static int dpl3518_attach(struct i2c_adapter *adap, int addr,
- unsigned short flags, int kind)
-#endif
{
struct dpl3518 *dpl;
struct i2c_client *client;
@@ -365,9 +353,7 @@ static int dpl3518_dev_release(struct inode *inode, struct file *file)
/* ---------------------------------------------------------------------- */
static struct i2c_driver driver = {
-#if LINUX_VERSION_CODE >= KERNEL_VERSION(2,5,54)
.owner = THIS_MODULE,
-#endif
.name = "i2c dpl3518 driver",
.id = I2C_DRIVERID_DPL3518,
.flags = I2C_DF_NOTIFY,
diff --git a/v4l_experimental/v3tv/v3tv.c b/v4l_experimental/v3tv/v3tv.c
index 6f105cb3b..9029fa733 100644
--- a/v4l_experimental/v3tv/v3tv.c
+++ b/v4l_experimental/v3tv/v3tv.c
@@ -17,14 +17,8 @@
#include <asm/io.h>
#include <asm/pgtable.h>
-#if LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,0)
#include <media/tuner.h>
#include <media/audiochip.h>
-#else
-#include "/usr/src/linux/drivers/media/video/i2c-compat.h"
-#include "/usr/src/linux/drivers/media/video/audiochip.h"
-#include "/usr/src/linux/drivers/media/video/tuner.h"
-#endif
//#ifndef I2C_DRIVERID_VPX3224
//#include "vpx-common.h"
@@ -32,9 +26,6 @@
//#include <linux/i2c.h>
-//#if LINUX_VERSION_CODE < KERNEL_VERSION(2,5,0)
-//#include "../linux/drivers/media/video/i2c-compat.h"
-//#endif
#define UNSET (-1U)
@@ -549,12 +540,8 @@ static inline unsigned long uvirt_to_kva(pgd_t * pgd, unsigned long adr)
#endif
#endif
if (pte_present(pte)) {
-#if LINUX_VERSION_CODE >= KERNEL_VERSION(2,4,0)
ret =
(unsigned long)page_address(pte_page(pte));
-#else
- ret = pte_page(pte);
-#endif
ret |= (adr & (PAGE_SIZE - 1));
}
}
@@ -601,12 +588,8 @@ inline unsigned long kvirt_to_pa(unsigned long adr)
return ret;
}
-#if LINUX_VERSION_CODE <= KERNEL_VERSION(2,5,0)
-#include <linux/wrapper.h>
-#else
#define mem_map_reserve(p) set_bit(PG_reserved, &((p)->flags))
#define mem_map_unreserve(p) clear_bit(PG_reserved, &((p)->flags))
-#endif
void inline *rvmalloc(signed long size)
{
@@ -731,20 +714,8 @@ int v3tv_get_adapter(struct i2c_adapter *adapter)
if (debug)
printk(KERN_INFO "v3tv: v3tv_get_adapter trying: %s\n",
adapter->name);
-// if (I2C_CLASS_TV_ANALOG != adapter->class)
-// return 0;
-#ifdef I2C_CLASS_TV_ANALOG
if (!(adapter->class & I2C_CLASS_TV_ANALOG))
return 0;
-#else
- switch (adapter->id) {
- case I2C_ALGO_BIT | I2C_HW_B_VOO:
- if (!strnicmp(adapter->name, "I2C\0", 3))
- break;
- default:
- return 0;
- }
-#endif
if (debug)
printk(KERN_INFO "v3tv: i2c_attach_client found adapter: %s\n",
adapter->name);
@@ -753,25 +724,17 @@ int v3tv_get_adapter(struct i2c_adapter *adapter)
if (debug)
printk(KERN_INFO "v3tv: i2c_attach_client releasing adapter: %s\n",
adapter->name);
-#if LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,0)
module_put(voodoo->voodoo_i2c_adapter->owner);
-#else
- __MOD_DEC_USE_COUNT(voodoo->voodoo_i2c_adapter->owner);
-#endif
voodoo->voodoo_i2c_adapter = NULL;
return 0;
}
voodoo->voodoo_i2c_adapter = adapter;
-#if LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,0)
if (!try_module_get(adapter->owner)) {
printk("v3tv: Unable to get module %s\n",
adapter->owner->name);
return -ENODEV;
}
-#else
- __MOD_INC_USE_COUNT(voodoo->voodoo_i2c_adapter->owner);
-#endif
printk ("v3tv: i2c dummy driver registered: adapter: 0x%p\n",
voodoo->voodoo_i2c_adapter);
@@ -1402,10 +1365,6 @@ static int do_voodoo_mmap(const char *adr, unsigned long size)
* $Id: v3tv.c,v 1.1 2005/12/25 16:23:58 mkrufky Exp $
*/
-#if LINUX_VERSION_CODE <= KERNEL_VERSION(2,5,0)
-#define iminor(inode) minor(inode->i_rdev)
-#endif
-
/* External variables: Data struct */
//extern struct voodoo_data *voodoo;
//extern struct video_capture video_standard[];
@@ -2034,11 +1993,7 @@ static int v3tv_radio_open(struct inode *inode, struct file *file)
AUDC_SET_RADIO, &voodoo->tuner_type);
// up(&voodoo->lock);
-#if LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,0)
try_module_get(THIS_MODULE);
-#else
- MOD_INC_USE_COUNT;
-#endif
printk("v3tv: Radio device opened.\n");
return 0;
}
@@ -2053,11 +2008,7 @@ static int v3tv_radio_release(struct inode *inode, struct file *file)
file->private_data = NULL;
-#if LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,0)
module_put(THIS_MODULE);
-#else
- MOD_DEC_USE_COUNT;
-#endif
printk("v3tv: Radio device closed.\n");
@@ -2182,11 +2133,7 @@ static irqreturn_t v3tv_video_irq(int irq, void *dev_id, struct pt_regs *regs)
tempReg |= (1 << 31);
v3tv_regwrite(V3REG_intrCtrl, tempReg);
}
-#if LINUX_VERSION_CODE >= KERNEL_VERSION(2,5,0)
return capture_ready;
-#else
- return;
-#endif
}
void v3tv_set_palette(struct video_picture *picture_settings)
diff --git a/v4l_experimental/v3tv/vpx3224.c b/v4l_experimental/v3tv/vpx3224.c
index fb5f05b79..50c60ca53 100644
--- a/v4l_experimental/v3tv/vpx3224.c
+++ b/v4l_experimental/v3tv/vpx3224.c
@@ -45,9 +45,6 @@
#include <linux/i2c.h>
#include <linux/i2c-dev.h>
-#if LINUX_VERSION_CODE < KERNEL_VERSION(2,6,0)
-#include "i2c-compat.h"
-#endif
#include <linux/videodev.h>
#include <linux/video_decoder.h>
@@ -67,11 +64,9 @@ static int
vpx3224_write_fp_block(struct i2c_client *client,
const u16 * data, int len);
#endif
+
static int vpx3224_detect_client(struct i2c_adapter *adapter, int address,
-#if LINUX_VERSION_CODE < KERNEL_VERSION(2,6,0)
- unsigned short flags,
-#endif
- int kind);
+ int kind);
/* Each client has this additional data */
@@ -606,12 +601,6 @@ vpx3224_write_fp_block(struct i2c_client *client,
return res;
}
-#if LINUX_VERSION_CODE < KERNEL_VERSION(2,6,0)
-#if defined (CONFIG_V3TV_VERBOSEDEBUG) & defined (CONFIG_PROC_FS)
-#include "vpx3224-proc.c"
-#endif
-#endif
-
/* ----------------------------------------------------------------------
* Client procedures */
@@ -1078,13 +1067,8 @@ static int vpx3224_attach_adapter(struct i2c_adapter *adapter)
{
int res = 0;
-#ifdef I2C_ADAP_CLASS_TV_ANALOG
- if (adapter->class & I2C_ADAP_CLASS_TV_ANALOG)
- res = i2c_probe(adapter, &addr_data, vpx3224_detect_client);
-#else
- if (adapter->id & (I2C_HW_SMBUS_VOODOO3))
+ if (adapter->class & I2C_CLASS_TV_ANALOG)
res = i2c_probe(adapter, &addr_data, vpx3224_detect_client);
-#endif
DEB2(printk(KERN_INFO "%s: i2c_probe of adapter: %s returned %d\n",
THIS_MODULE->name, adapter->name, res));
@@ -1097,11 +1081,6 @@ static int vpx3224_detach_client(struct i2c_client *client)
struct vpx3224 *decoder = i2c_get_clientdata(client);
int res;
-#if LINUX_VERSION_CODE < KERNEL_VERSION(2,6,0)
-#if defined (CONFIG_PROC_FS) && defined (CONFIG_V3TV_VERBOSEDEBUG)
- vpx3224_del_proc(client);
-#endif
-#endif
res = i2c_detach_client(client);
DEB2(printk(KERN_INFO "%s: i2c_detach_client returned %d\n",
@@ -1111,11 +1090,7 @@ static int vpx3224_detach_client(struct i2c_client *client)
THIS_MODULE->name, client->name);
return res;
}
-#if LINUX_VERSION_CODE < KERNEL_VERSION(2,6,0)
-// MOD_DEC_USE_COUNT;
-#else
module_put(client->adapter->owner);
-#endif
kfree(decoder);
kfree(client);
vpx3224_i2c_id--;
@@ -1144,9 +1119,6 @@ static struct i2c_driver vpx3224_i2c_driver = {
/* vpx3224_detect_client - aka: i2c_client_found_addr_proc *found_proc
* so called by i2c_probe, res passed back to vpx3224_attach_adapter */
static int vpx3224_detect_client(struct i2c_adapter *adapter, int address,
-#if LINUX_VERSION_CODE < KERNEL_VERSION(2,6,0)
- unsigned short flags,
-#endif
int kind)
{
int res;
@@ -1230,17 +1202,7 @@ static int vpx3224_detect_client(struct i2c_adapter *adapter, int address,
printk(KERN_INFO "%s: %s client found at address 0x%x\n",
THIS_MODULE->name, client->name, client->addr);
-#if LINUX_VERSION_CODE < KERNEL_VERSION(2,6,0)
-#if defined (CONFIG_PROC_FS) && defined (CONFIG_V3TV_VERBOSEDEBUG)
- vpx3224_init_proc(client);
-#endif
-#endif
-
-#if LINUX_VERSION_CODE < KERNEL_VERSION(2,6,0)
-// MOD_INC_USE_COUNT;
-#else
try_module_get(client->adapter->owner);
-#endif
return vpx3224_i2c_id;
}