From cf40a792704411e384568bb705e0115a21a44f2a Mon Sep 17 00:00:00 2001 From: Jean-Francois Moine Date: Sun, 5 Oct 2008 09:21:24 +0200 Subject: gspca: Set the vertical flip at streamon time in sonixj. From: Jean-Francois Moine Priority: normal Signed-off-by: Jean-Francois Moine --- linux/drivers/media/video/gspca/sonixj.c | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) (limited to 'linux/drivers') diff --git a/linux/drivers/media/video/gspca/sonixj.c b/linux/drivers/media/video/gspca/sonixj.c index f68faf6bd..aa11df134 100644 --- a/linux/drivers/media/video/gspca/sonixj.c +++ b/linux/drivers/media/video/gspca/sonixj.c @@ -1365,6 +1365,9 @@ static int sd_start(struct gspca_dev *gspca_dev) setbrightness(gspca_dev); setcontrast(gspca_dev); break; + case SENSOR_OV7630: + setvflip(sd); + /* fall thru */ default: /* OV76xx */ setbrightcont(gspca_dev); break; @@ -1597,7 +1600,8 @@ static int sd_setvflip(struct gspca_dev *gspca_dev, __s32 val) struct sd *sd = (struct sd *) gspca_dev; sd->vflip = val; - setvflip(sd); + if (gspca_dev->streaming) + setvflip(sd); return 0; } -- cgit v1.2.3 From 47e01ca0b2bc9e796927fe93340f11221521b4e2 Mon Sep 17 00:00:00 2001 From: Jean-Francois Moine Date: Sun, 5 Oct 2008 09:22:10 +0200 Subject: gspca: Don't destroy the URBs on disconnect. From: Jean-Francois Moine Priority: normal Signed-off-by: Jean-Francois Moine --- linux/drivers/media/video/gspca/gspca.c | 11 +++-------- 1 file changed, 3 insertions(+), 8 deletions(-) (limited to 'linux/drivers') diff --git a/linux/drivers/media/video/gspca/gspca.c b/linux/drivers/media/video/gspca/gspca.c index 12e3a4360..c2ad862b6 100644 --- a/linux/drivers/media/video/gspca/gspca.c +++ b/linux/drivers/media/video/gspca/gspca.c @@ -1913,17 +1913,12 @@ void gspca_disconnect(struct usb_interface *intf) usb_set_intfdata(intf, NULL); - gspca_dev->present = 0; - mutex_lock(&gspca_dev->queue_lock); - mutex_lock(&gspca_dev->usb_lock); - gspca_dev->streaming = 0; - destroy_urbs(gspca_dev); - mutex_unlock(&gspca_dev->usb_lock); - mutex_unlock(&gspca_dev->queue_lock); - /* We don't want people trying to open up the device */ video_unregister_device(&gspca_dev->vdev); + gspca_dev->present = 0; + gspca_dev->streaming = 0; + kref_put(&gspca_dev->kref, gspca_delete); PDEBUG(D_PROBE, "disconnect complete"); -- cgit v1.2.3 From 8243740c92ed60cdc3b2535e0ae1a7a174e539dc Mon Sep 17 00:00:00 2001 From: Jean-Francois Moine Date: Sun, 5 Oct 2008 09:46:11 +0200 Subject: gspca: sd_desc->start returns a value and static functions in m5602. From: Jean-Francois Moine Priority: high Signed-off-by: Jean-Francois Moine --- .../drivers/media/video/gspca/m5602/m5602_bridge.h | 12 ------- linux/drivers/media/video/gspca/m5602/m5602_core.c | 37 ++++++++++++---------- 2 files changed, 21 insertions(+), 28 deletions(-) (limited to 'linux/drivers') diff --git a/linux/drivers/media/video/gspca/m5602/m5602_bridge.h b/linux/drivers/media/video/gspca/m5602/m5602_bridge.h index 6b2441e84..60c588dff 100644 --- a/linux/drivers/media/video/gspca/m5602/m5602_bridge.h +++ b/linux/drivers/media/video/gspca/m5602/m5602_bridge.h @@ -167,16 +167,4 @@ int m5602_read_bridge( int m5602_write_bridge( struct sd *sd, u8 address, u8 i2c_data); -int m5602_configure(struct gspca_dev *gspca_dev, - const struct usb_device_id *id); - -int m5602_init(struct gspca_dev *gspca_dev); - -void m5602_start_transfer(struct gspca_dev *gspca_dev); - -void m5602_stop_transfer(struct gspca_dev *gspca_dev); - -void m5602_urb_complete(struct gspca_dev *gspca_dev, struct gspca_frame *frame, - __u8 *data, int len); - #endif diff --git a/linux/drivers/media/video/gspca/m5602/m5602_core.c b/linux/drivers/media/video/gspca/m5602/m5602_core.c index 30efe7d4b..1d1658294 100644 --- a/linux/drivers/media/video/gspca/m5602/m5602_core.c +++ b/linux/drivers/media/video/gspca/m5602/m5602_core.c @@ -35,16 +35,6 @@ static const __devinitdata struct usb_device_id m5602_table[] = { MODULE_DEVICE_TABLE(usb, m5602_table); -/* sub-driver description, the ctrl and nctrl is filled at probe time */ -static struct sd_desc sd_desc = { - .name = MODULE_NAME, - .config = m5602_configure, - .init = m5602_init, - .start = m5602_start_transfer, - .stopN = m5602_stop_transfer, - .pkt_scan = m5602_urb_complete -}; - /* Reads a byte from the m5602 */ int m5602_read_bridge(struct sd *sd, u8 address, u8 *i2c_data) { @@ -104,7 +94,7 @@ static void m5602_dump_bridge(struct sd *sd) info("Warning: The camera probably won't work until it's power cycled"); } -int m5602_probe_sensor(struct sd *sd) +static int m5602_probe_sensor(struct sd *sd) { /* Try the po1030 */ sd->sensor = &po1030; @@ -137,7 +127,10 @@ int m5602_probe_sensor(struct sd *sd) return -ENODEV; } -int m5602_init(struct gspca_dev *gspca_dev) +static int m5602_configure(struct gspca_dev *gspca_dev, + const struct usb_device_id *id); + +static int m5602_init(struct gspca_dev *gspca_dev) { struct sd *sd = (struct sd *) gspca_dev; int err; @@ -149,7 +142,7 @@ int m5602_init(struct gspca_dev *gspca_dev) return err; } -void m5602_start_transfer(struct gspca_dev *gspca_dev) +static int m5602_start_transfer(struct gspca_dev *gspca_dev) { struct sd *sd = (struct sd *) gspca_dev; __u8 *buf = sd->gspca_dev.usb_buf; @@ -162,9 +155,11 @@ void m5602_start_transfer(struct gspca_dev *gspca_dev) 4, M5602_URB_MSG_TIMEOUT); PDEBUG(DBG_V4L2, "Transfer started"); + return 0; } -void m5602_urb_complete(struct gspca_dev *gspca_dev, struct gspca_frame *frame, +static void m5602_urb_complete(struct gspca_dev *gspca_dev, + struct gspca_frame *frame, __u8 *data, int len) { struct sd *sd = (struct sd *) gspca_dev; @@ -216,13 +211,23 @@ void m5602_urb_complete(struct gspca_dev *gspca_dev, struct gspca_frame *frame, } } -void m5602_stop_transfer(struct gspca_dev *gspca_dev) +static void m5602_stop_transfer(struct gspca_dev *gspca_dev) { /* Is there are a command to stop a data transfer? */ } +/* sub-driver description, the ctrl and nctrl is filled at probe time */ +static struct sd_desc sd_desc = { + .name = MODULE_NAME, + .config = m5602_configure, + .init = m5602_init, + .start = m5602_start_transfer, + .stopN = m5602_stop_transfer, + .pkt_scan = m5602_urb_complete +}; + /* this function is called at probe time */ -int m5602_configure(struct gspca_dev *gspca_dev, +static int m5602_configure(struct gspca_dev *gspca_dev, const struct usb_device_id *id) { struct sd *sd = (struct sd *) gspca_dev; -- cgit v1.2.3 From 0ded89570a1185ff2c07d7b2451b48464864955e Mon Sep 17 00:00:00 2001 From: Jean-Francois Moine Date: Sun, 5 Oct 2008 09:55:24 +0200 Subject: gspca: Add the subdriver finepix in Kconfig and Makefile. From: Jean-Francois Moine Priority: high Signed-off-by: Jean-Francois Moine --- linux/drivers/media/video/gspca/Kconfig | 9 +++++++++ linux/drivers/media/video/gspca/Makefile | 2 ++ 2 files changed, 11 insertions(+) (limited to 'linux/drivers') diff --git a/linux/drivers/media/video/gspca/Kconfig b/linux/drivers/media/video/gspca/Kconfig index aa7f3eb7e..f130a218f 100644 --- a/linux/drivers/media/video/gspca/Kconfig +++ b/linux/drivers/media/video/gspca/Kconfig @@ -37,6 +37,15 @@ config USB_GSPCA_ETOMS To compile this driver as a module, choose M here: the module will be called gspca_etoms. +config USB_GSPCA_FINEPIX + tristate "Fujifilm FinePix USB V4L2 driver" + depends on VIDEO_V4L2 && USB_GSPCA + help + Say Y here if you want support for cameras based on the FinePix chip. + + To compile this driver as a module, choose M here: the + module will be called gspca_finepix. + config USB_GSPCA_MARS tristate "Mars USB Camera Driver" depends on VIDEO_V4L2 && USB_GSPCA diff --git a/linux/drivers/media/video/gspca/Makefile b/linux/drivers/media/video/gspca/Makefile index b87322f4a..22734f5a6 100644 --- a/linux/drivers/media/video/gspca/Makefile +++ b/linux/drivers/media/video/gspca/Makefile @@ -1,6 +1,7 @@ obj-$(CONFIG_USB_GSPCA) += gspca_main.o obj-$(CONFIG_USB_GSPCA_CONEX) += gspca_conex.o obj-$(CONFIG_USB_GSPCA_ETOMS) += gspca_etoms.o +obj-$(CONFIG_USB_GSPCA_FINEPIX) += gspca_finepix.o obj-$(CONFIG_USB_GSPCA_MARS) += gspca_mars.o obj-$(CONFIG_USB_GSPCA_OV519) += gspca_ov519.o obj-$(CONFIG_USB_GSPCA_PAC207) += gspca_pac207.o @@ -23,6 +24,7 @@ obj-$(CONFIG_USB_GSPCA_ZC3XX) += gspca_zc3xx.o gspca_main-objs := gspca.o gspca_conex-objs := conex.o gspca_etoms-objs := etoms.o +gspca_finepix-objs := finepix.o gspca_mars-objs := mars.o gspca_ov519-objs := ov519.o gspca_pac207-objs := pac207.o -- cgit v1.2.3 From b25ca90b2b7d8281bb777184a1cbd16d74021f04 Mon Sep 17 00:00:00 2001 From: Jean-Francois Moine Date: Mon, 6 Oct 2008 08:16:08 +0200 Subject: gspca: Bad name of the sunplus subdriver in Kconfig. From: Jean-Francois Moine Priority: high Signed-off-by: Jean-Francois Moine --- linux/drivers/media/video/gspca/Kconfig | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'linux/drivers') diff --git a/linux/drivers/media/video/gspca/Kconfig b/linux/drivers/media/video/gspca/Kconfig index f130a218f..655301837 100644 --- a/linux/drivers/media/video/gspca/Kconfig +++ b/linux/drivers/media/video/gspca/Kconfig @@ -163,8 +163,8 @@ config USB_GSPCA_STK014 To compile this driver as a module, choose M here: the module will be called gspca_stk014. -config USB_GSPCA_SPCA5XX - tristate "SPCA5xx USB Camera Driver" +config USB_GSPCA_SUNPLUS + tristate "SUNPLUS USB Camera Driver" depends on VIDEO_V4L2 && USB_GSPCA help Say Y here if you want support for cameras based on the Sunplus -- cgit v1.2.3 From e9bb7ebe630e3665f756275cd39ef0d75455ab1c Mon Sep 17 00:00:00 2001 From: Jean-Francois Moine Date: Tue, 7 Oct 2008 08:02:59 +0200 Subject: gspca: Add some lost controls to the s5k83a sensor. From: Erik Andren Priority: normal Signed-off-by: Erik Andren Signed-off-by: Jean-Francois Moine --- .../drivers/media/video/gspca/m5602/m5602_s5k83a.c | 92 +++++++++++++++++++++- .../drivers/media/video/gspca/m5602/m5602_s5k83a.h | 58 +++++++++++--- 2 files changed, 140 insertions(+), 10 deletions(-) (limited to 'linux/drivers') diff --git a/linux/drivers/media/video/gspca/m5602/m5602_s5k83a.c b/linux/drivers/media/video/gspca/m5602/m5602_s5k83a.c index c1ff967b1..b4b33c2d0 100644 --- a/linux/drivers/media/video/gspca/m5602/m5602_s5k83a.c +++ b/linux/drivers/media/video/gspca/m5602/m5602_s5k83a.c @@ -321,7 +321,7 @@ int s5k83a_get_gain(struct gspca_dev *gspca_dev, __s32 *val) int s5k83a_set_gain(struct gspca_dev *gspca_dev, __s32 val) { - int err = 0; + int err; u8 data[2]; struct sd *sd = (struct sd *) gspca_dev; @@ -331,3 +331,93 @@ int s5k83a_set_gain(struct gspca_dev *gspca_dev, __s32 val) return (err < 0) ? err : 0; } + +int s5k83a_get_vflip(struct gspca_dev *gspca_dev, __s32 *val) +{ + int err; + u8 data[1]; + struct sd *sd = (struct sd *) gspca_dev; + + data[0] = 0x05; + err = s5k83a_write_sensor(sd, S5K83A_PAGE_MAP, data, 1); + if (err < 0) + return err; + + err = s5k83a_read_sensor(sd, S5K83A_FLIP, data, 1); + *val = (data[0] | 0x40) ? 1 : 0; + + return (err < 0) ? err : 0; +} + +int s5k83a_set_vflip(struct gspca_dev *gspca_dev, __s32 val) +{ + int err; + u8 data[1]; + struct sd *sd = (struct sd *) gspca_dev; + + data[0] = 0x05; + err = s5k83a_write_sensor(sd, S5K83A_PAGE_MAP, data, 1); + if (err < 0) + return err; + + err = s5k83a_read_sensor(sd, S5K83A_FLIP, data, 1); + if (err < 0) + return err; + + /* set or zero six bit, seven is hflip */ + data[0] = (val) ? (data[0] & 0x80) | 0x40 | S5K83A_FLIP_MASK + : (data[0] & 0x80) | S5K83A_FLIP_MASK; + err = s5k83a_write_sensor(sd, S5K83A_FLIP, data, 1); + if (err < 0) + return err; + + data[0] = (val) ? 0x0b : 0x0a; + err = s5k83a_write_sensor(sd, S5K83A_VFLIP_TUNE, data, 1); + + return (err < 0) ? err : 0; +} + +int s5k83a_get_hflip(struct gspca_dev *gspca_dev, __s32 *val) +{ + int err; + u8 data[1]; + struct sd *sd = (struct sd *) gspca_dev; + + data[0] = 0x05; + err = s5k83a_write_sensor(sd, S5K83A_PAGE_MAP, data, 1); + if (err < 0) + return err; + + err = s5k83a_read_sensor(sd, S5K83A_FLIP, data, 1); + *val = (data[0] | 0x80) ? 1 : 0; + + return (err < 0) ? err : 0; +} + +int s5k83a_set_hflip(struct gspca_dev *gspca_dev, __s32 val) +{ + int err; + u8 data[1]; + struct sd *sd = (struct sd *) gspca_dev; + + data[0] = 0x05; + err = s5k83a_write_sensor(sd, S5K83A_PAGE_MAP, data, 1); + if (err < 0) + return err; + + err = s5k83a_read_sensor(sd, S5K83A_FLIP, data, 1); + if (err < 0) + return err; + + /* set or zero seven bit, six is vflip */ + data[0] = (val) ? (data[0] & 0x40) | 0x80 | S5K83A_FLIP_MASK + : (data[0] & 0x40) | S5K83A_FLIP_MASK; + err = s5k83a_write_sensor(sd, S5K83A_FLIP, data, 1); + if (err < 0) + return err; + + data[0] = (val) ? 0x0a : 0x0b; + err = s5k83a_write_sensor(sd, S5K83A_HFLIP_TUNE, data, 1); + + return (err < 0) ? err : 0; +} diff --git a/linux/drivers/media/video/gspca/m5602/m5602_s5k83a.h b/linux/drivers/media/video/gspca/m5602/m5602_s5k83a.h index 67432b5a5..8e9fb61a0 100644 --- a/linux/drivers/media/video/gspca/m5602/m5602_s5k83a.h +++ b/linux/drivers/media/video/gspca/m5602/m5602_s5k83a.h @@ -21,15 +21,20 @@ #include "m5602_sensor.h" -#define S5K83A_PAGE_MAP 0xec -#define S5K83A_GAIN 0x18 +#define S5K83A_FLIP 0x01 +#define S5K83A_HFLIP_TUNE 0x03 +#define S5K83A_VFLIP_TUNE 0x05 #define S5K83A_WHITENESS 0x0a -#define S5K83A_BRIGHTNESS 0x1b +#define S5K83A_GAIN 0x18 +#define S5K83A_BRIGHTNESS 0x1b +#define S5K83A_PAGE_MAP 0xec #define S5K83A_DEFAULT_BRIGHTNESS 0x71 #define S5K83A_DEFAULT_WHITENESS 0x7e -#define S5K83A_DEFAULT_GAIN 0x00 -#define S5K83A_MAXIMUM_GAIN 0x3c +#define S5K83A_DEFAULT_GAIN 0x00 +#define S5K83A_MAXIMUM_GAIN 0x3c +#define S5K83A_FLIP_MASK 0x10 + /*****************************************************************************/ @@ -56,6 +61,11 @@ int s5k83a_set_whiteness(struct gspca_dev *gspca_dev, __s32 val); int s5k83a_get_whiteness(struct gspca_dev *gspca_dev, __s32 *val); int s5k83a_set_gain(struct gspca_dev *gspca_dev, __s32 val); int s5k83a_get_gain(struct gspca_dev *gspca_dev, __s32 *val); +int s5k83a_get_vflip(struct gspca_dev *gspca_dev, __s32 *val); +int s5k83a_set_vflip(struct gspca_dev *gspca_dev, __s32 val); +int s5k83a_get_hflip(struct gspca_dev *gspca_dev, __s32 *val); +int s5k83a_set_hflip(struct gspca_dev *gspca_dev, __s32 val); + static struct m5602_sensor s5k83a = { .name = "S5K83A", @@ -65,7 +75,7 @@ static struct m5602_sensor s5k83a = { .read_sensor = s5k83a_read_sensor, .write_sensor = s5k83a_write_sensor, .i2c_slave_id = 0x5a, - .nctrls = 3, + .nctrls = 5, .ctrls = { { { @@ -107,7 +117,31 @@ static struct m5602_sensor s5k83a = { }, .set = s5k83a_set_gain, .get = s5k83a_get_gain - } + }, { + { + .id = V4L2_CID_HFLIP, + .type = V4L2_CTRL_TYPE_BOOLEAN, + .name = "horizontal flip", + .minimum = 0, + .maximum = 1, + .step = 1, + .default_value = 0 + }, + .set = s5k83a_set_hflip, + .get = s5k83a_get_hflip + }, { + { + .id = V4L2_CID_VFLIP, + .type = V4L2_CTRL_TYPE_BOOLEAN, + .name = "vertical flip", + .minimum = 0, + .maximum = 1, + .step = 1, + .default_value = 0 + }, + .set = s5k83a_set_vflip, + .get = s5k83a_get_vflip + } }, .nmodes = 1, .modes = { @@ -121,7 +155,6 @@ static struct m5602_sensor s5k83a = { .bytesperline = M5602_DEFAULT_FRAME_WIDTH, .colorspace = V4L2_COLORSPACE_SRGB, .priv = 1 - } } }; @@ -438,7 +471,14 @@ static const unsigned char init_s5k83a[][4] = {SENSOR, S5K83A_WHITENESS, S5K83A_DEFAULT_WHITENESS, 0x00}, /* set default gain */ - {SENSOR_LONG, 0x18, 0x00, S5K83A_DEFAULT_GAIN} + {SENSOR_LONG, 0x18, 0x00, S5K83A_DEFAULT_GAIN}, + + /* set default flip */ + {SENSOR, S5K83A_PAGE_MAP, 0x05, 0x00}, + {SENSOR, S5K83A_FLIP, 0x00 | S5K83A_FLIP_MASK, 0x00}, + {SENSOR, S5K83A_HFLIP_TUNE, 0x0b, 0x00}, + {SENSOR, S5K83A_VFLIP_TUNE, 0x0a, 0x00} + }; #endif -- cgit v1.2.3 From 0946b827f37a3728f61636efe79dce10ea0fb8cf Mon Sep 17 00:00:00 2001 From: Jean-Francois Moine Date: Tue, 7 Oct 2008 13:42:30 +0200 Subject: gspca: Bad name of the tv8532 subdriver in Kconfig. From: Jean-Francois Moine Priority: high Signed-off-by: Jean-Francois Moine --- linux/drivers/media/video/gspca/Kconfig | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'linux/drivers') diff --git a/linux/drivers/media/video/gspca/Kconfig b/linux/drivers/media/video/gspca/Kconfig index 655301837..4d0817471 100644 --- a/linux/drivers/media/video/gspca/Kconfig +++ b/linux/drivers/media/video/gspca/Kconfig @@ -182,7 +182,7 @@ config USB_GSPCA_T613 To compile this driver as a module, choose M here: the module will be called gspca_t613. -config USB_GSPCA_TV8531 +config USB_GSPCA_TV8532 tristate "TV8532 USB Camera Driver" depends on VIDEO_V4L2 && USB_GSPCA help -- cgit v1.2.3 From f4575151c70f193cff12f4bbcbd577580546a021 Mon Sep 17 00:00:00 2001 From: Jean-Francois Moine Date: Wed, 8 Oct 2008 13:06:08 +0200 Subject: gspca: Big rewrite of t613. From: Jean-Francois Moine - separate functions for bridge and sensor exchanges - delays added after some exchanges - other sensor type Priority: normal Signed-off-by: Jean-Francois Moine --- linux/drivers/media/video/gspca/t613.c | 613 ++++++++++++++++++--------------- 1 file changed, 327 insertions(+), 286 deletions(-) (limited to 'linux/drivers') diff --git a/linux/drivers/media/video/gspca/t613.c b/linux/drivers/media/video/gspca/t613.c index 06f3b8718..df3f1ff9d 100644 --- a/linux/drivers/media/video/gspca/t613.c +++ b/linux/drivers/media/video/gspca/t613.c @@ -28,8 +28,6 @@ #include "gspca.h" -#define MAX_GAMMA 0x10 /* 0 to 15 */ - #define V4L2_CID_EFFECTS (V4L2_CID_PRIVATE_BASE + 0) MODULE_AUTHOR("Leandro Costantino "); @@ -49,6 +47,10 @@ struct sd { unsigned char whitebalance; unsigned char mirror; unsigned char effect; + + __u8 sensor; +#define SENSOR_TAS5130A 0 +#define SENSOR_OTHER 1 }; /* V4L2 controls supported by the driver */ @@ -83,9 +85,9 @@ static struct ctrl sd_ctrls[] = { .type = V4L2_CTRL_TYPE_INTEGER, .name = "Brightness", .minimum = 0, - .maximum = 0x0f, + .maximum = 14, .step = 1, - .default_value = 0x09, + .default_value = 8, }, .set = sd_setbrightness, .get = sd_getbrightness, @@ -118,16 +120,17 @@ static struct ctrl sd_ctrls[] = { .set = sd_setcolors, .get = sd_getcolors, }, -#define SD_GAMMA 3 +#define GAMMA_MAX 16 +#define GAMMA_DEF 10 { { .id = V4L2_CID_GAMMA, /* (gamma on win) */ .type = V4L2_CTRL_TYPE_INTEGER, - .name = "Gamma (Untested)", + .name = "Gamma", .minimum = 0, - .maximum = MAX_GAMMA, + .maximum = GAMMA_MAX - 1, .step = 1, - .default_value = 0x09, + .default_value = GAMMA_DEF, }, .set = sd_setgamma, .get = sd_getgamma, @@ -197,7 +200,7 @@ static struct ctrl sd_ctrls[] = { .type = V4L2_CTRL_TYPE_INTEGER, .name = "Sharpness", .minimum = 0, - .maximum = MAX_GAMMA, /* 0 to 16 */ + .maximum = 15, .step = 1, .default_value = 0x06, }, @@ -258,7 +261,6 @@ static struct v4l2_pix_format vga_mode_t16[] = { .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 */ @@ -272,87 +274,87 @@ static const __u8 effects_table[MAX_EFFECTS][6] = { {0xa8, 0xc8, 0xc6, 0xd2, 0xc0, 0x40}, /* Negative */ }; -static const __u8 gamma_table[MAX_GAMMA][34] = { - {0x90, 0x00, 0x91, 0x3e, 0x92, 0x69, 0x93, 0x85, +static const __u8 gamma_table[GAMMA_MAX][34] = { + {0x90, 0x00, 0x91, 0x3e, 0x92, 0x69, 0x93, 0x85, /* 0 */ 0x94, 0x95, 0x95, 0xa1, 0x96, 0xae, 0x97, 0xb9, 0x98, 0xc2, 0x99, 0xcb, 0x9a, 0xd4, 0x9b, 0xdb, 0x9c, 0xe3, 0x9d, 0xea, 0x9e, 0xf1, 0x9f, 0xf8, 0xa0, 0xff}, - {0x90, 0x00, 0x91, 0x33, 0x92, 0x5A, 0x93, 0x75, - 0x94, 0x85, 0x95, 0x93, 0x96, 0xA1, 0x97, 0xAD, - 0x98, 0xB7, 0x99, 0xC2, 0x9A, 0xCB, 0x9B, 0xD4, - 0x9C, 0xDE, 0x9D, 0xE7, 0x9E, 0xF0, 0x9F, 0xF7, + {0x90, 0x00, 0x91, 0x33, 0x92, 0x5a, 0x93, 0x75, /* 1 */ + 0x94, 0x85, 0x95, 0x93, 0x96, 0xa1, 0x97, 0xad, + 0x98, 0xb7, 0x99, 0xc2, 0x9a, 0xcb, 0x9b, 0xd4, + 0x9c, 0xde, 0x9D, 0xe7, 0x9e, 0xf0, 0x9f, 0xf7, 0xa0, 0xff}, - {0x90, 0x00, 0x91, 0x2F, 0x92, 0x51, 0x93, 0x6B, - 0x94, 0x7C, 0x95, 0x8A, 0x96, 0x99, 0x97, 0xA6, - 0x98, 0xB1, 0x99, 0xBC, 0x9A, 0xC6, 0x9B, 0xD0, - 0x9C, 0xDB, 0x9D, 0xE4, 0x9E, 0xED, 0x9F, 0xF6, + {0x90, 0x00, 0x91, 0x2f, 0x92, 0x51, 0x93, 0x6b, /* 2 */ + 0x94, 0x7c, 0x95, 0x8a, 0x96, 0x99, 0x97, 0xa6, + 0x98, 0xb1, 0x99, 0xbc, 0x9a, 0xc6, 0x9b, 0xd0, + 0x9c, 0xdb, 0x9d, 0xe4, 0x9e, 0xed, 0x9f, 0xf6, 0xa0, 0xff}, - {0x90, 0x00, 0x91, 0x29, 0x92, 0x48, 0x93, 0x60, - 0x94, 0x72, 0x95, 0x81, 0x96, 0x90, 0x97, 0x9E, - 0x98, 0xAA, 0x99, 0xB5, 0x9A, 0xBF, 0x9B, 0xCB, - 0x9C, 0xD6, 0x9D, 0xE1, 0x9E, 0xEB, 0x9F, 0xF5, + {0x90, 0x00, 0x91, 0x29, 0x92, 0x48, 0x93, 0x60, /* 3 */ + 0x94, 0x72, 0x95, 0x81, 0x96, 0x90, 0x97, 0x9e, + 0x98, 0xaa, 0x99, 0xb5, 0x9a, 0xbf, 0x9b, 0xcb, + 0x9c, 0xd6, 0x9d, 0xe1, 0x9e, 0xeb, 0x9f, 0xf5, 0xa0, 0xff}, - {0x90, 0x00, 0x91, 0x23, 0x92, 0x3F, 0x93, 0x55, + {0x90, 0x00, 0x91, 0x23, 0x92, 0x3f, 0x93, 0x55, /* 4 */ 0x94, 0x68, 0x95, 0x77, 0x96, 0x86, 0x97, 0x95, - 0x98, 0xA2, 0x99, 0xAD, 0x9A, 0xB9, 0x9B, 0xC6, - 0x9C, 0xD2, 0x9D, 0xDE, 0x9E, 0xE9, 0x9F, 0xF4, + 0x98, 0xa2, 0x99, 0xad, 0x9a, 0xb9, 0x9b, 0xc6, + 0x9c, 0xd2, 0x9d, 0xde, 0x9e, 0xe9, 0x9f, 0xf4, 0xa0, 0xff}, - {0x90, 0x00, 0x91, 0x1B, 0x92, 0x33, 0x93, 0x48, + {0x90, 0x00, 0x91, 0x1b, 0x92, 0x33, 0x93, 0x48, /* 5 */ 0x94, 0x59, 0x95, 0x69, 0x96, 0x79, 0x97, 0x87, - 0x98, 0x96, 0x99, 0xA3, 0x9A, 0xB1, 0x9B, 0xBE, - 0x9C, 0xCC, 0x9D, 0xDA, 0x9E, 0xE7, 0x9F, 0xF3, + 0x98, 0x96, 0x99, 0xa3, 0x9a, 0xb1, 0x9b, 0xbe, + 0x9c, 0xcc, 0x9d, 0xda, 0x9e, 0xe7, 0x9f, 0xf3, 0xa0, 0xff}, - {0x90, 0x00, 0x91, 0x02, 0x92, 0x10, 0x93, 0x20, + {0x90, 0x00, 0x91, 0x02, 0x92, 0x10, 0x93, 0x20, /* 6 */ 0x94, 0x32, 0x95, 0x40, 0x96, 0x57, 0x97, 0x67, 0x98, 0x77, 0x99, 0x88, 0x9a, 0x99, 0x9b, 0xaa, 0x9c, 0xbb, 0x9d, 0xcc, 0x9e, 0xdd, 0x9f, 0xee, 0xa0, 0xff}, - {0x90, 0x00, 0x91, 0x02, 0x92, 0x14, 0x93, 0x26, - 0x94, 0x38, 0x95, 0x4A, 0x96, 0x60, 0x97, 0x70, - 0x98, 0x80, 0x99, 0x90, 0x9A, 0xA0, 0x9B, 0xB0, - 0x9C, 0xC0, 0x9D, 0xD0, 0x9E, 0xE0, 0x9F, 0xF0, + {0x90, 0x00, 0x91, 0x02, 0x92, 0x14, 0x93, 0x26, /* 7 */ + 0x94, 0x38, 0x95, 0x4a, 0x96, 0x60, 0x97, 0x70, + 0x98, 0x80, 0x99, 0x90, 0x9a, 0xa0, 0x9b, 0xb0, + 0x9c, 0xc0, 0x9D, 0xd0, 0x9e, 0xe0, 0x9f, 0xf0, 0xa0, 0xff}, - {0x90, 0x00, 0x91, 0x10, 0x92, 0x22, 0x93, 0x35, - 0x94, 0x47, 0x95, 0x5A, 0x96, 0x69, 0x97, 0x79, - 0x98, 0x88, 0x99, 0x97, 0x9A, 0xA7, 0x9B, 0xB6, - 0x9C, 0xC4, 0x9D, 0xD3, 0x9E, 0xE0, 0x9F, 0xF0, + {0x90, 0x00, 0x91, 0x10, 0x92, 0x22, 0x93, 0x35, /* 8 */ + 0x94, 0x47, 0x95, 0x5a, 0x96, 0x69, 0x97, 0x79, + 0x98, 0x88, 0x99, 0x97, 0x9a, 0xa7, 0x9b, 0xb6, + 0x9c, 0xc4, 0x9d, 0xd3, 0x9e, 0xe0, 0x9f, 0xf0, 0xa0, 0xff}, - {0x90, 0x00, 0x91, 0x10, 0x92, 0x26, 0x93, 0x40, + {0x90, 0x00, 0x91, 0x10, 0x92, 0x26, 0x93, 0x40, /* 9 */ 0x94, 0x54, 0x95, 0x65, 0x96, 0x75, 0x97, 0x84, 0x98, 0x93, 0x99, 0xa1, 0x9a, 0xb0, 0x9b, 0xbd, 0x9c, 0xca, 0x9d, 0xd6, 0x9e, 0xe0, 0x9f, 0xf0, 0xa0, 0xff}, - {0x90, 0x00, 0x91, 0x18, 0x92, 0x2B, 0x93, 0x44, - 0x94, 0x60, 0x95, 0x70, 0x96, 0x80, 0x97, 0x8E, - 0x98, 0x9C, 0x99, 0xAA, 0x9A, 0xB7, 0x9B, 0xC4, - 0x9C, 0xD0, 0x9D, 0xD8, 0x9E, 0xE2, 0x9F, 0xF0, + {0x90, 0x00, 0x91, 0x18, 0x92, 0x2b, 0x93, 0x44, /* 10 */ + 0x94, 0x60, 0x95, 0x70, 0x96, 0x80, 0x97, 0x8e, + 0x98, 0x9c, 0x99, 0xaa, 0x9a, 0xb7, 0x9b, 0xc4, + 0x9c, 0xd0, 0x9d, 0xd8, 0x9e, 0xe2, 0x9f, 0xf0, + 0xa0, 0xff}, + {0x90, 0x00, 0x91, 0x1a, 0x92, 0x34, 0x93, 0x52, /* 11 */ + 0x94, 0x66, 0x95, 0x7e, 0x96, 0x8D, 0x97, 0x9B, + 0x98, 0xa8, 0x99, 0xb4, 0x9a, 0xc0, 0x9b, 0xcb, + 0x9c, 0xd6, 0x9d, 0xe1, 0x9e, 0xeb, 0x9f, 0xf5, 0xa0, 0xff}, - {0x90, 0x00, 0x91, 0x1A, 0x92, 0x34, 0x93, 0x52, - 0x94, 0x66, 0x95, 0x7E, 0x96, 0x8D, 0x97, 0x9B, - 0x98, 0xA8, 0x99, 0xB4, 0x9A, 0xC0, 0x9B, 0xCB, - 0x9C, 0xD6, 0x9D, 0xE1, 0x9E, 0xEB, 0x9F, 0xF5, + {0x90, 0x00, 0x91, 0x3f, 0x92, 0x5a, 0x93, 0x6e, /* 12 */ + 0x94, 0x7f, 0x95, 0x8e, 0x96, 0x9c, 0x97, 0xa8, + 0x98, 0xb4, 0x99, 0xbf, 0x9a, 0xc9, 0x9b, 0xd3, + 0x9c, 0xdc, 0x9d, 0xe5, 0x9e, 0xee, 0x9f, 0xf6, 0xa0, 0xff}, - {0x90, 0x00, 0x91, 0x3F, 0x92, 0x5A, 0x93, 0x6E, - 0x94, 0x7F, 0x95, 0x8E, 0x96, 0x9C, 0x97, 0xA8, - 0x98, 0xB4, 0x99, 0xBF, 0x9A, 0xC9, 0x9B, 0xD3, - 0x9C, 0xDC, 0x9D, 0xE5, 0x9E, 0xEE, 0x9F, 0xF6, - 0xA0, 0xFF}, - {0x90, 0x00, 0x91, 0x54, 0x92, 0x6F, 0x93, 0x83, - 0x94, 0x93, 0x95, 0xA0, 0x96, 0xAD, 0x97, 0xB7, - 0x98, 0xC2, 0x99, 0xCB, 0x9A, 0xD4, 0x9B, 0xDC, - 0x9C, 0xE4, 0x9D, 0xEB, 0x9E, 0xF2, 0x9F, 0xF9, + {0x90, 0x00, 0x91, 0x54, 0x92, 0x6f, 0x93, 0x83, /* 13 */ + 0x94, 0x93, 0x95, 0xa0, 0x96, 0xad, 0x97, 0xb7, + 0x98, 0xc2, 0x99, 0xcb, 0x9a, 0xd4, 0x9b, 0xdc, + 0x9c, 0xe4, 0x9d, 0xeb, 0x9e, 0xf2, 0x9f, 0xf9, 0xa0, 0xff}, - {0x90, 0x00, 0x91, 0x6E, 0x92, 0x88, 0x93, 0x9A, - 0x94, 0xA8, 0x95, 0xB3, 0x96, 0xBD, 0x97, 0xC6, - 0x98, 0xCF, 0x99, 0xD6, 0x9A, 0xDD, 0x9B, 0xE3, - 0x9C, 0xE9, 0x9D, 0xEF, 0x9E, 0xF4, 0x9F, 0xFA, + {0x90, 0x00, 0x91, 0x6e, 0x92, 0x88, 0x93, 0x9a, /* 14 */ + 0x94, 0xa8, 0x95, 0xb3, 0x96, 0xbd, 0x97, 0xc6, + 0x98, 0xcf, 0x99, 0xd6, 0x9a, 0xdd, 0x9b, 0xe3, + 0x9c, 0xe9, 0x9d, 0xef, 0x9e, 0xf4, 0x9f, 0xfa, 0xa0, 0xff}, - {0x90, 0x00, 0x91, 0x93, 0x92, 0xA8, 0x93, 0xB7, - 0x94, 0xC1, 0x95, 0xCA, 0x96, 0xD2, 0x97, 0xD8, - 0x98, 0xDE, 0x99, 0xE3, 0x9A, 0xE8, 0x9B, 0xED, - 0x9C, 0xF1, 0x9D, 0xF5, 0x9E, 0xF8, 0x9F, 0xFC, - 0xA0, 0xFF} + {0x90, 0x00, 0x91, 0x93, 0x92, 0xa8, 0x93, 0xb7, /* 15 */ + 0x94, 0xc1, 0x95, 0xca, 0x96, 0xd2, 0x97, 0xd8, + 0x98, 0xde, 0x99, 0xe3, 0x9a, 0xe8, 0x9b, 0xed, + 0x9c, 0xf1, 0x9d, 0xf5, 0x9e, 0xf8, 0x9f, 0xfc, + 0xa0, 0xff} }; static const __u8 tas5130a_sensor_init[][8] = { @@ -364,7 +366,7 @@ static const __u8 tas5130a_sensor_init[][8] = { }; /* read 1 byte */ -static int reg_r_1(struct gspca_dev *gspca_dev, +static int reg_r(struct gspca_dev *gspca_dev, __u16 index) { usb_control_msg(gspca_dev->dev, @@ -378,26 +380,26 @@ static int reg_r_1(struct gspca_dev *gspca_dev, } static void reg_w(struct gspca_dev *gspca_dev, - __u16 value, - __u16 index, - const __u8 *buffer, __u16 len) + __u16 index) +{ + usb_control_msg(gspca_dev->dev, + usb_sndctrlpipe(gspca_dev->dev, 0), + 0, + USB_DIR_OUT | USB_TYPE_VENDOR | USB_RECIP_INTERFACE, + 0, index, + NULL, 0, 500); +} + +static void i2c_w(struct gspca_dev *gspca_dev, + const __u8 *buffer, __u16 len) { - if (buffer == NULL) { - usb_control_msg(gspca_dev->dev, - usb_sndctrlpipe(gspca_dev->dev, 0), - 0, - USB_DIR_OUT | USB_TYPE_VENDOR | USB_RECIP_INTERFACE, - value, index, - NULL, 0, 500); - return; - } if (len <= USB_BUF_SZ) { memcpy(gspca_dev->usb_buf, buffer, len); usb_control_msg(gspca_dev->dev, usb_sndctrlpipe(gspca_dev->dev, 0), 0, USB_DIR_OUT | USB_TYPE_VENDOR | USB_RECIP_INTERFACE, - value, index, + 0x01, 0, gspca_dev->usb_buf, len, 500); } else { __u8 *tmpbuf; @@ -408,12 +410,56 @@ static void reg_w(struct gspca_dev *gspca_dev, usb_sndctrlpipe(gspca_dev->dev, 0), 0, USB_DIR_OUT | USB_TYPE_VENDOR | USB_RECIP_INTERFACE, - value, index, + 0x01, 0, tmpbuf, len, 500); kfree(tmpbuf); } } +static void other_sensor_init(struct gspca_dev *gspca_dev) +{ + int i; + const __u8 *p; + __u8 byte; + __u8 val[6] = {0x62, 0, 0x64, 0, 0x60, 0x05}; + static const __u8 sensor_init[] = { + 0xdf, 0x6d, + 0xdd, 0x18, + 0x5a, 0xe0, + 0x5c, 0x07, + 0x5d, 0xb0, + 0x5e, 0x1e, + 0x60, 0x71, + 0xef, 0x00, + 0xe9, 0x00, + 0xea, 0x00, + 0x90, 0x24, + 0x91, 0xb2, + 0x82, 0x32, + 0xfd, 0x00, + 0xfd, 0x01, + 0xfd, 0x41, + 0x00 /* table end */ + }; + + p = sensor_init; + while (*p != 0) { + val[1] = *p++; + val[3] = *p++; + if (*p == 0) + reg_w(gspca_dev, 0x3c80); + i2c_w(gspca_dev, val, sizeof val); + i = 4; + while (--i >= 0) { + msleep(15); + byte = reg_r(gspca_dev, 0x60); + if (!(byte & 0x01)) + break; + } + } + reg_w(gspca_dev, 0x3c80); +} + /* this function is called at probe time */ static int sd_config(struct gspca_dev *gspca_dev, const struct usb_device_id *id) @@ -430,7 +476,7 @@ static int sd_config(struct gspca_dev *gspca_dev, 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->gamma = sd_ctrls[SD_GAMMA].qctrl.default_value; + sd->gamma = GAMMA_DEF; sd->mirror = sd_ctrls[SD_MIRROR].qctrl.default_value; sd->freq = sd_ctrls[SD_LIGHTFREQ].qctrl.default_value; sd->whitebalance = sd_ctrls[SD_WHITE_BALANCE].qctrl.default_value; @@ -439,27 +485,37 @@ static int sd_config(struct gspca_dev *gspca_dev, return 0; } -static int init_default_parameters(struct gspca_dev *gspca_dev) +static void setgamma(struct gspca_dev *gspca_dev) +{ + struct sd *sd = (struct sd *) gspca_dev; + + PDEBUG(D_CONF, "Gamma: %d", sd->gamma); + i2c_w(gspca_dev, gamma_table[sd->gamma], sizeof gamma_table[0]); +} + +/* this function is called at probe and resume time */ +static int sd_init(struct gspca_dev *gspca_dev) { /* some of this registers are not really neded, because * they are overriden by setbrigthness, setcontrast, etc, * but wont hurt anyway, and can help someone with similar webcam * to see the initial parameters.*/ - int i = 0; - __u8 test_byte; + struct sd *sd = (struct sd *) gspca_dev; + int i; + __u8 byte, test_byte; static const __u8 read_indexs[] = { 0x06, 0x07, 0x0a, 0x0b, 0x66, 0x80, 0x81, 0x8e, 0x8f, 0xa5, 0xa6, 0xa8, 0xbb, 0xbc, 0xc6, 0x00, 0x00 }; - static const __u8 n1[6] = + static const __u8 n1[] = {0x08, 0x03, 0x09, 0x03, 0x12, 0x04}; - static const __u8 n2[2] = + static const __u8 n2[] = {0x08, 0x00}; - static const __u8 nset[6] = - { 0x61, 0x68, 0x62, 0xff, 0x60, 0x07 }; - static const __u8 n3[6] = + static const __u8 nset[] = + { 0x61, 0x68, 0x62, 0xff, 0x60, 0x07 }; + static const __u8 n3[] = {0x61, 0x68, 0x65, 0x0a, 0x60, 0x04}; - static const __u8 n4[0x46] = + static const __u8 n4[] = {0x09, 0x01, 0x12, 0x04, 0x66, 0x8a, 0x80, 0x3c, 0x81, 0x22, 0x84, 0x50, 0x8a, 0x78, 0x8b, 0x68, 0x8c, 0x88, 0x8e, 0x33, 0x8f, 0x24, 0xaa, 0xb1, @@ -469,44 +525,26 @@ static int init_default_parameters(struct gspca_dev *gspca_dev) 0x65, 0x0a, 0xbb, 0x86, 0xaf, 0x58, 0xb0, 0x68, 0x87, 0x40, 0x89, 0x2b, 0x8d, 0xff, 0x83, 0x40, 0xac, 0x84, 0xad, 0x86, 0xaf, 0x46}; -#if 0 - 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, - 0xae, 0x03, 0xb1, 0x44, 0xb2, 0x08, - 0xb7, 0x06, 0xb9, 0xe7, 0xbb, 0xc4, 0xbc, 0x4a, 0xbe, 0x36, - 0xbf, 0xff, 0xc2, 0x88, 0xc5, 0xc0, - 0xc6, 0xd2 - }; -#endif - static const __u8 nset4[18] = { + static const __u8 nset4[] = { 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 const __u8 nset2[20] = { + static const __u8 nset2[] = { 0xd0, 0xbb, 0xd1, 0x28, 0xd2, 0x10, 0xd3, 0x10, 0xd4, 0xbb, 0xd5, 0x28, 0xd6, 0x1e, 0xd7, 0x27, 0xd8, 0xc8, 0xd9, 0xfc }; - static const __u8 missing[8] = + static const __u8 missing[] = { 0x87, 0x20, 0x88, 0x20, 0x89, 0x20, 0x80, 0x38 }; - static const __u8 nset3[18] = { + static const __u8 nset3[] = { 0xc7, 0x60, 0xc8, 0xa8, 0xc9, 0xe0, 0xca, 0x60, 0xcb, 0xa8, 0xcc, 0xe0, 0xcd, 0x60, 0xce, 0xa8, 0xcf, 0xe0 }; - static const __u8 nset5[4] = - { 0x8f, 0x24, 0xc3, 0x00 }; /* bright */ - 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 const __u8 nset5[] = + { 0x8f, 0x24, 0xc3, 0x00 }; /* bright */ static const __u8 nset7[4] = { 0x66, 0xca, 0xa8, 0xf8 }; /* 50/60 Hz */ static const __u8 nset9[4] = @@ -516,95 +554,111 @@ static int init_default_parameters(struct gspca_dev *gspca_dev) static const __u8 nset10[6] = { 0x0c, 0x03, 0xab, 0x10, 0x81, 0x20 }; - reg_w(gspca_dev, 0x01, 0x0000, n1, 0x06); - reg_w(gspca_dev, 0x01, 0x0000, nset, 0x06); - reg_r_1(gspca_dev, 0x0063); - reg_w(gspca_dev, 0x01, 0x0000, n2, 0x02); + byte = reg_r(gspca_dev, 0x06); + test_byte = reg_r(gspca_dev, 0x07); + if (byte == 0x08 && test_byte == 0x07) { + PDEBUG(D_CONF, "other sensor"); + sd->sensor = SENSOR_OTHER; + } else { + PDEBUG(D_CONF, "sensor %02x %02x", byte, test_byte); + sd->sensor = SENSOR_TAS5130A; + } + + i2c_w(gspca_dev, n1, sizeof n1); + test_byte = 0; + i = 5; + while (--i >= 0) { + i2c_w(gspca_dev, nset, sizeof nset); + msleep(5); + test_byte = reg_r(gspca_dev, 0x0063); + msleep(100); + if (test_byte == 0x17) + break; /* OK */ + } + if (i < 0) { + err("Bad sensor reset %02x", test_byte); +/* return -EIO; */ +/*fixme: test - continue */ + } + i2c_w(gspca_dev, n2, sizeof n2); + i = 0; while (read_indexs[i] != 0x00) { - test_byte = reg_r_1(gspca_dev, read_indexs[i]); - PDEBUG(D_CONF, "Reg 0x%02x => 0x%02x", read_indexs[i], + test_byte = reg_r(gspca_dev, read_indexs[i]); + PDEBUG(D_STREAM, "Reg 0x%02x = 0x%02x", read_indexs[i], test_byte); i++; } - reg_w(gspca_dev, 0x01, 0x0000, n3, 0x06); - reg_w(gspca_dev, 0x01, 0x0000, n4, 0x46); - reg_r_1(gspca_dev, 0x0080); - reg_w(gspca_dev, 0x00, 0x2c80, NULL, 0); - reg_w(gspca_dev, 0x01, 0x0000, nset2, 0x14); - reg_w(gspca_dev, 0x01, 0x0000, nset3, 0x12); - reg_w(gspca_dev, 0x01, 0x0000, nset4, 0x12); - reg_w(gspca_dev, 0x00, 0x3880, NULL, 0); - reg_w(gspca_dev, 0x00, 0x3880, NULL, 0); - reg_w(gspca_dev, 0x00, 0x338e, NULL, 0); - reg_w(gspca_dev, 0x01, 0x0000, nset5, 0x04); - reg_w(gspca_dev, 0x00, 0x00a9, NULL, 0); - reg_w(gspca_dev, 0x01, 0x0000, nset6, 0x22); - reg_w(gspca_dev, 0x00, 0x86bb, NULL, 0); - reg_w(gspca_dev, 0x00, 0x4aa6, NULL, 0); - - reg_w(gspca_dev, 0x01, 0x0000, missing, 0x08); - - reg_w(gspca_dev, 0x00, 0x2087, NULL, 0); - reg_w(gspca_dev, 0x00, 0x2088, NULL, 0); - reg_w(gspca_dev, 0x00, 0x2089, NULL, 0); - - reg_w(gspca_dev, 0x01, 0x0000, nset7, 0x04); - reg_w(gspca_dev, 0x01, 0x0000, nset10, 0x06); - reg_w(gspca_dev, 0x01, 0x0000, nset8, 0x06); - reg_w(gspca_dev, 0x01, 0x0000, nset9, 0x04); - - reg_w(gspca_dev, 0x00, 0x2880, NULL, 0); - reg_w(gspca_dev, 0x01, 0x0000, nset2, 0x14); - reg_w(gspca_dev, 0x01, 0x0000, nset3, 0x12); - reg_w(gspca_dev, 0x01, 0x0000, nset4, 0x12); + i2c_w(gspca_dev, n3, sizeof n3); + i2c_w(gspca_dev, n4, sizeof n4); + reg_r(gspca_dev, 0x0080); + reg_w(gspca_dev, 0x2c80); + i2c_w(gspca_dev, nset2, sizeof nset2); + i2c_w(gspca_dev, nset3, sizeof nset3); + i2c_w(gspca_dev, nset4, sizeof nset4); + reg_w(gspca_dev, 0x3880); + reg_w(gspca_dev, 0x3880); + reg_w(gspca_dev, 0x338e); + i2c_w(gspca_dev, nset5, sizeof nset5); + reg_w(gspca_dev, 0x00a9); + setgamma(gspca_dev); + reg_w(gspca_dev, 0x86bb); + reg_w(gspca_dev, 0x4aa6); + + i2c_w(gspca_dev, missing, sizeof missing); + + reg_w(gspca_dev, 0x2087); + reg_w(gspca_dev, 0x2088); + reg_w(gspca_dev, 0x2089); + + i2c_w(gspca_dev, nset7, sizeof nset7); + i2c_w(gspca_dev, nset10, sizeof nset10); + i2c_w(gspca_dev, nset8, sizeof nset8); + i2c_w(gspca_dev, nset9, sizeof nset9); + + reg_w(gspca_dev, 0x2880); + i2c_w(gspca_dev, nset2, sizeof nset2); + i2c_w(gspca_dev, nset3, sizeof nset3); + i2c_w(gspca_dev, nset4, sizeof nset4); return 0; } -/* this function is called at probe and resume time */ -static int sd_init(struct gspca_dev *gspca_dev) -{ - init_default_parameters(gspca_dev); - return 0; -} - static void setbrightness(struct gspca_dev *gspca_dev) { struct sd *sd = (struct sd *) gspca_dev; unsigned int brightness; - __u8 set6[4] = { 0x8f, 0x26, 0xc3, 0x80 }; - brightness = sd->brightness; + __u8 set6[4] = { 0x8f, 0x26, 0xc3, 0x00 }; + brightness = sd->brightness; if (brightness < 7) { - set6[3] = 0x70 - (brightness * 0xa); + set6[3] = 0x70 - brightness * 0x10; } else { set6[1] = 0x24; - set6[3] = 0x00 + ((brightness - 7) * 0xa); + set6[3] = 0x00 + ((brightness - 7) * 0x10); } - reg_w(gspca_dev, 0x01, 0x0000, set6, 4); + i2c_w(gspca_dev, set6, sizeof set6); } static void setflip(struct gspca_dev *gspca_dev) { struct sd *sd = (struct sd *) gspca_dev; - __u8 flipcmd[8] = - { 0x62, 0x07, 0x63, 0x03, 0x64, 0x00, 0x60, 0x09 }; + {0x62, 0x07, 0x63, 0x03, 0x64, 0x00, 0x60, 0x09}; - if (sd->mirror == 1) + if (sd->mirror) flipcmd[3] = 0x01; - reg_w(gspca_dev, 0x01, 0x0000, flipcmd, 8); + i2c_w(gspca_dev, flipcmd, sizeof flipcmd); } static void seteffect(struct gspca_dev *gspca_dev) { struct sd *sd = (struct sd *) gspca_dev; - reg_w(gspca_dev, 0x01, 0x0000, effects_table[sd->effect], 0x06); + i2c_w(gspca_dev, effects_table[sd->effect], sizeof effects_table[0]); if (sd->effect == 1 || sd->effect == 5) { PDEBUG(D_CONF, "This effect have been disabled for webcam \"safety\""); @@ -612,9 +666,9 @@ static void seteffect(struct gspca_dev *gspca_dev) } if (sd->effect == 1 || sd->effect == 4) - reg_w(gspca_dev, 0x00, 0x4aa6, NULL, 0); + reg_w(gspca_dev, 0x4aa6); else - reg_w(gspca_dev, 0x00, 0xfaa6, NULL, 0); + reg_w(gspca_dev, 0xfaa6); } static void setwhitebalance(struct gspca_dev *gspca_dev) @@ -627,7 +681,7 @@ static void setwhitebalance(struct gspca_dev *gspca_dev) if (sd->whitebalance == 1) white_balance[7] = 0x3c; - reg_w(gspca_dev, 0x01, 0x0000, white_balance, 8); + i2c_w(gspca_dev, white_balance, sizeof white_balance); } static void setlightfreq(struct gspca_dev *gspca_dev) @@ -638,21 +692,21 @@ static void setlightfreq(struct gspca_dev *gspca_dev) if (sd->freq == 2) /* 60hz */ freq[1] = 0x00; - reg_w(gspca_dev, 0x1, 0x0000, freq, 0x4); + i2c_w(gspca_dev, freq, sizeof freq); } static void setcontrast(struct gspca_dev *gspca_dev) { struct sd *sd = (struct sd *) gspca_dev; unsigned int contrast = sd->contrast; - __u16 reg_to_write = 0x00; + __u16 reg_to_write; if (contrast < 7) reg_to_write = 0x8ea9 - (0x200 * contrast); else reg_to_write = (0x00a9 + ((contrast - 7) * 0x200)); - reg_w(gspca_dev, 0x00, reg_to_write, NULL, 0); + reg_w(gspca_dev, reg_to_write); } static void setcolors(struct gspca_dev *gspca_dev) @@ -661,29 +715,113 @@ static void setcolors(struct gspca_dev *gspca_dev) __u16 reg_to_write; reg_to_write = 0xc0bb + sd->colors * 0x100; - reg_w(gspca_dev, 0x00, reg_to_write, NULL, 0); + reg_w(gspca_dev, reg_to_write); } -static void setgamma(struct gspca_dev *gspca_dev) +static void setsharpness(struct gspca_dev *gspca_dev) { -#if 0 struct sd *sd = (struct sd *) gspca_dev; - struct usb_device *dev = gspca_dev->dev; + __u16 reg_to_write; - PDEBUG(D_CONF, "Gamma: %d", sd->gamma); + reg_to_write = 0x0aa6 + 0x1000 * sd->sharpness; - reg_w(gspca_dev, 0x01, 0x0000, gamma_table[sd->gamma], 34); -#endif + reg_w(gspca_dev, reg_to_write); } -static void setsharpness(struct gspca_dev *gspca_dev) +static int sd_start(struct gspca_dev *gspca_dev) { struct sd *sd = (struct sd *) gspca_dev; - __u16 reg_to_write; + int i, mode; + static const __u8 t1[] = { 0x66, 0x00, 0xa8, 0xe8 }; + __u8 t2[] = { 0x07, 0x00, 0x0d, 0x60, 0x0e, 0x80 }; + static const __u8 t3[] = + { 0xb3, 0x07, 0xb4, 0x00, 0xb5, 0x88, 0xb6, 0x02, 0xb7, 0x06, + 0xb8, 0x00, 0xb9, 0xe7, 0xba, 0x01 }; + static const __u8 t4[] = { 0x0b, 0x04, 0x0a, 0x40 }; - reg_to_write = 0x0aa6 + 0x1000 * sd->sharpness; + mode = gspca_dev->cam.cam_mode[(int) gspca_dev->curr_mode]. priv; + switch (mode) { + case 1: /* 352x288 */ + t2[1] = 0x40; + break; + case 2: /* 320x240 */ + t2[1] = 0x10; + break; + case 3: /* 176x144 */ + t2[1] = 0x50; + break; + case 4: /* 160x120 */ + t2[1] = 0x20; + break; + default: /* 640x480 (0x00) */ + break; + } - reg_w(gspca_dev, 0x00, reg_to_write, NULL, 0); + if (sd->sensor == SENSOR_TAS5130A) { + i = 0; + while (tas5130a_sensor_init[i][0] != 0) { + i2c_w(gspca_dev, tas5130a_sensor_init[i], + sizeof tas5130a_sensor_init[0]); + i++; + } + reg_w(gspca_dev, 0x3c80); + /* just in case and to keep sync with logs (for mine) */ + i2c_w(gspca_dev, tas5130a_sensor_init[3], + sizeof tas5130a_sensor_init[0]); + reg_w(gspca_dev, 0x3c80); + } else { + other_sensor_init(gspca_dev); + } + /* just in case and to keep sync with logs (for mine) */ + i2c_w(gspca_dev, t1, sizeof t1); + i2c_w(gspca_dev, t2, sizeof t2); + reg_r(gspca_dev, 0x0012); + i2c_w(gspca_dev, t3, sizeof t3); + reg_w(gspca_dev, 0x0013); + i2c_w(gspca_dev, t4, sizeof t4); + /* restart on each start, just in case, sometimes regs goes wrong + * when using controls from app */ + setbrightness(gspca_dev); + setcontrast(gspca_dev); + setcolors(gspca_dev); +#if 0 + seteffect(gspca_dev); + setflip(gspca_dev); +#endif + return 0; +} + +static void sd_pkt_scan(struct gspca_dev *gspca_dev, + struct gspca_frame *frame, /* target */ + __u8 *data, /* isoc packet */ + int len) /* iso packet length */ +{ + static __u8 ffd9[] = { 0xff, 0xd9 }; + + if (data[0] == 0x5a) { + /* Control Packet, after this came the header again, + * but extra bytes came in the packet before this, + * sometimes an EOF arrives, sometimes not... */ + return; + } + data += 2; + len -= 2; + if (data[0] == 0xff && data[1] == 0xd8) { + /* extra bytes....., could be processed too but would be + * a waste of time, right now leave the application and + * libjpeg do it for ourserlves.. */ + frame = gspca_frame_add(gspca_dev, LAST_PACKET, frame, + ffd9, 2); + gspca_frame_add(gspca_dev, FIRST_PACKET, frame, data, len); + return; + } + + if (data[len - 2] == 0xff && data[len - 1] == 0xd9) { + /* Just in case, i have seen packets with the marker, + * other's do not include it... */ + len -= 2; + } + gspca_frame_add(gspca_dev, INTER_PACKET, frame, data, len); } static int sd_setbrightness(struct gspca_dev *gspca_dev, __s32 val) @@ -807,6 +945,7 @@ static int sd_setgamma(struct gspca_dev *gspca_dev, __s32 val) static int sd_getgamma(struct gspca_dev *gspca_dev, __s32 *val) { struct sd *sd = (struct sd *) gspca_dev; + *val = sd->gamma; return 0; } @@ -854,9 +993,9 @@ static int sd_setlowlight(struct gspca_dev *gspca_dev, __s32 val) sd->autogain = val; if (val != 0) - reg_w(gspca_dev, 0x00, 0xf48e, NULL, 0); + reg_w(gspca_dev, 0xf48e); else - reg_w(gspca_dev, 0x00, 0xb48e, NULL, 0); + reg_w(gspca_dev, 0xb48e); return 0; } @@ -868,104 +1007,6 @@ static int sd_getlowlight(struct gspca_dev *gspca_dev, __s32 *val) return 0; } -static int sd_start(struct gspca_dev *gspca_dev) -{ - int mode; - - static const __u8 t1[] = { 0x66, 0x00, 0xa8, 0xe8 }; - __u8 t2[] = { 0x07, 0x00, 0x0d, 0x60, 0x0e, 0x80 }; - static const __u8 t3[] = - { 0xb3, 0x07, 0xb4, 0x00, 0xb5, 0x88, 0xb6, 0x02, 0xb7, 0x06, - 0xb8, 0x00, 0xb9, 0xe7, 0xba, 0x01 }; - static const __u8 t4[] = { 0x0b, 0x04, 0x0a, 0x40 }; - - mode = gspca_dev->cam.cam_mode[(int) gspca_dev->curr_mode]. priv; - switch (mode) { - case 1: /* 352x288 */ - t2[1] = 0x40; - break; - case 2: /* 320x240 */ - t2[1] = 0x10; - break; - case 3: /* 176x144 */ - t2[1] = 0x50; - break; - case 4: /* 160x120 */ - t2[1] = 0x20; - break; - default: /* 640x480 (0x00) */ - break; - } - - reg_w(gspca_dev, 0x01, 0x0000, tas5130a_sensor_init[0], 0x8); - reg_w(gspca_dev, 0x01, 0x0000, tas5130a_sensor_init[1], 0x8); - reg_w(gspca_dev, 0x01, 0x0000, tas5130a_sensor_init[2], 0x8); - reg_w(gspca_dev, 0x01, 0x0000, tas5130a_sensor_init[3], 0x8); - reg_w(gspca_dev, 0x00, 0x3c80, NULL, 0); - /* just in case and to keep sync with logs (for mine) */ - reg_w(gspca_dev, 0x01, 0x0000, tas5130a_sensor_init[3], 0x8); - reg_w(gspca_dev, 0x00, 0x3c80, NULL, 0); - /* just in case and to keep sync with logs (for mine) */ - reg_w(gspca_dev, 0x01, 0x0000, t1, 4); - reg_w(gspca_dev, 0x01, 0x0000, t2, 6); - reg_r_1(gspca_dev, 0x0012); - reg_w(gspca_dev, 0x01, 0x0000, t3, 0x10); - reg_w(gspca_dev, 0x00, 0x0013, NULL, 0); - reg_w(gspca_dev, 0x01, 0x0000, t4, 0x4); - /* restart on each start, just in case, sometimes regs goes wrong - * when using controls from app */ - setbrightness(gspca_dev); - setcontrast(gspca_dev); - setcolors(gspca_dev); -#if 0 - seteffect(gspca_dev); - setflip(gspca_dev); -#endif - return 0; -} - -static void sd_pkt_scan(struct gspca_dev *gspca_dev, - struct gspca_frame *frame, /* target */ - __u8 *data, /* isoc packet */ - int len) /* iso packet length */ -{ - int sof = 0; - static __u8 ffd9[] = { 0xff, 0xd9 }; - - if (data[0] == 0x5a) { - /* Control Packet, after this came the header again, - * but extra bytes came in the packet before this, - * sometimes an EOF arrives, sometimes not... */ - return; - } - - if (data[len - 2] == 0xff && data[len - 1] == 0xd9) { - /* Just in case, i have seen packets with the marker, - * other's do not include it... */ - data += 2; - len -= 4; - } else if (data[2] == 0xff && data[3] == 0xd8) { - sof = 1; - data += 2; - len -= 2; - } else { - data += 2; - len -= 2; - } - - if (sof) { - /* extra bytes....., could be processed too but would be - * a waste of time, right now leave the application and - * libjpeg do it for ourserlves.. */ - frame = gspca_frame_add(gspca_dev, LAST_PACKET, frame, - ffd9, 2); - gspca_frame_add(gspca_dev, FIRST_PACKET, frame, data, len); - return; - } - - gspca_frame_add(gspca_dev, INTER_PACKET, frame, data, len); -} - static int sd_querymenu(struct gspca_dev *gspca_dev, struct v4l2_querymenu *menu) { -- cgit v1.2.3 From ceadf20dadce549bd38cba5913f04e4af0db4e9c Mon Sep 17 00:00:00 2001 From: Jean-Francois Moine Date: Thu, 9 Oct 2008 08:14:03 +0200 Subject: gspca: Fix some compilation warnings in m5602. From: Jean-Francois Moine Priority: normal Signed-off-by: Jean-Francois Moine --- linux/drivers/media/video/gspca/m5602/m5602_mt9m111.c | 2 +- linux/drivers/media/video/gspca/m5602/m5602_ov9650.h | 6 +++++- linux/drivers/media/video/gspca/m5602/m5602_s5k4aa.h | 6 +++++- 3 files changed, 11 insertions(+), 3 deletions(-) (limited to 'linux/drivers') diff --git a/linux/drivers/media/video/gspca/m5602/m5602_mt9m111.c b/linux/drivers/media/video/gspca/m5602/m5602_mt9m111.c index ea2250217..566d4925a 100644 --- a/linux/drivers/media/video/gspca/m5602/m5602_mt9m111.c +++ b/linux/drivers/media/video/gspca/m5602/m5602_mt9m111.c @@ -69,7 +69,7 @@ sensor_found: int mt9m111_init(struct sd *sd) { - int i, err; + int i, err = 0; /* Init the sensor */ for (i = 0; i < ARRAY_SIZE(init_mt9m111); i++) { diff --git a/linux/drivers/media/video/gspca/m5602/m5602_ov9650.h b/linux/drivers/media/video/gspca/m5602/m5602_ov9650.h index 70429b411..f5830a0f7 100644 --- a/linux/drivers/media/video/gspca/m5602/m5602_ov9650.h +++ b/linux/drivers/media/video/gspca/m5602/m5602_ov9650.h @@ -466,7 +466,11 @@ static const unsigned char power_down_ov9650[][3] = /* Vertically and horizontally flips the image if matched, needed for machines where the sensor is mounted upside down */ -static const struct dmi_system_id ov9650_flip_dmi_table[] = { +static +#if LINUX_VERSION_CODE >= KERNEL_VERSION(2, 6, 24) + const +#endif + struct dmi_system_id ov9650_flip_dmi_table[] = { { .ident = "ASUS A6VC", .matches = { diff --git a/linux/drivers/media/video/gspca/m5602/m5602_s5k4aa.h b/linux/drivers/media/video/gspca/m5602/m5602_s5k4aa.h index 5d808a750..a39183252 100644 --- a/linux/drivers/media/video/gspca/m5602/m5602_s5k4aa.h +++ b/linux/drivers/media/video/gspca/m5602/m5602_s5k4aa.h @@ -339,7 +339,11 @@ static const unsigned char init_s5k4aa[][4] = {SENSOR, S5K4AA_GAIN_2, 0xa0, 0x00} }; -static const struct dmi_system_id s5k4aa_vflip_dmi_table[] = { +static +#if LINUX_VERSION_CODE >= KERNEL_VERSION(2, 6, 24) + const +#endif + struct dmi_system_id s5k4aa_vflip_dmi_table[] = { { .ident = "Fujitsu-Siemens Amilo Xa 2528", .matches = { -- cgit v1.2.3 From 21e61b2c212edb8d0c30ed8098b04dd1b74bb000 Mon Sep 17 00:00:00 2001 From: Mauro Carvalho Chehab Date: Sat, 11 Oct 2008 08:47:28 -0300 Subject: af9013/m5602: Fix compilation at in-kernel MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit From: Mauro Carvalho Chehab This patch fixes a few errors that were breaking in-kernel compilation. The first one were at m5602 that were including "gspca.h" from another directory. A trivial change at m5602/Makefile fixed the issue. A harder to fix error were caused by the fact that both af9013 and m5602 were declaring an external var called 'debug'. If you compile both modules in-kernel, you'll have troubles. This is even worse, since there are two other drivers outside the subsystem with a similar mistake. To make things worse, gcc do a very great job of fooling the developers, by blaming the wrong lines anf files when such error occurs. So, I was having errors like: drivers/media/dvb/built-in.o: In function `dvb_usercopy': /home/v4l/tokernel/git/drivers/media/dvb/dvb-core/dvbdev.c:403: multiple definition of `debug' drivers/media/video/built-in.o:/home/v4l/tokernel/git/drivers/media/video/bt819.c:264: first defined here or: drivers/media/dvb/built-in.o: In function `dvb_usercopy': /home/v4l/tokernel/git/drivers/media/dvb/dvb-core/dvbdev.c:403: multiple definition of `debug' drivers/media/video/built-in.o:/home/v4l/tokernel/git/drivers/media/video/vpx3220.c:125: first defined here The two above errors caused by m5602 driver. After fixing m5602, I got this: drivers/built-in.o: In function `SiS_SetGroup2': /home/v4l/tokernel/git/drivers/video/sis/init301.c:6996: multiple definition of `debug' arch/x86/kernel/built-in.o:/home/v4l/tokernel/git/arch/x86/kernel/entry_32.S:810: first defined here This one caused by af9013. This patch fixes those erros by prefixing the debug vars with the name of the module, without changing the name of the parameter. Next time, please prepend all extern vars with the name of the module. To avoid bisect troubles, I've folded those changes with the original commits that added those modules at my -git tree. kernel-sync: CC: Jean-Francois Moine CC: Antti Palosaari CC: Erik Andrén Signed-off-by: Mauro Carvalho Chehab --- linux/drivers/media/dvb/Makefile | 2 +- linux/drivers/media/dvb/frontends/af9013.c | 4 ++-- linux/drivers/media/dvb/frontends/af9013_priv.h | 4 ++-- linux/drivers/media/video/gspca/m5602/Makefile | 3 +++ linux/drivers/media/video/gspca/m5602/m5602_bridge.h | 2 +- linux/drivers/media/video/gspca/m5602/m5602_core.c | 4 ++-- linux/drivers/media/video/gspca/m5602/m5602_mt9m111.h | 2 +- linux/drivers/media/video/gspca/m5602/m5602_ov9650.h | 2 +- linux/drivers/media/video/gspca/m5602/m5602_po1030.h | 2 +- linux/drivers/media/video/gspca/m5602/m5602_s5k4aa.h | 2 +- linux/drivers/media/video/gspca/m5602/m5602_s5k83a.h | 2 +- 11 files changed, 16 insertions(+), 13 deletions(-) (limited to 'linux/drivers') diff --git a/linux/drivers/media/dvb/Makefile b/linux/drivers/media/dvb/Makefile index ea953a03e..f91e9eb15 100644 --- a/linux/drivers/media/dvb/Makefile +++ b/linux/drivers/media/dvb/Makefile @@ -2,4 +2,4 @@ # Makefile for the kernel multimedia device drivers. # -obj-y := dvb-core/ frontends/ ttpci/ ttusb-dec/ ttusb-budget/ b2c2/ bt8xx/ cinergyT2/ dvb-usb/ pluto2/ siano/ dm1105/ +obj-y := dvb-core/ frontends/ ttpci/ ttusb-dec/ ttusb-budget/ b2c2/ bt8xx/ dvb-usb/ pluto2/ siano/ dm1105/ diff --git a/linux/drivers/media/dvb/frontends/af9013.c b/linux/drivers/media/dvb/frontends/af9013.c index 739d885b3..50e1e3f30 100644 --- a/linux/drivers/media/dvb/frontends/af9013.c +++ b/linux/drivers/media/dvb/frontends/af9013.c @@ -34,7 +34,7 @@ #include "af9013_priv.h" #include "af9013.h" -int debug; +int af9013_debug; struct af9013_state { struct i2c_adapter *i2c; @@ -1679,7 +1679,7 @@ static struct dvb_frontend_ops af9013_ops = { .read_ucblocks = af9013_read_ucblocks, }; -module_param(debug, int, 0644); +module_param_named(debug, af9013_debug, int, 0644); MODULE_PARM_DESC(debug, "Turn on/off frontend debugging (default:off)."); MODULE_AUTHOR("Antti Palosaari "); diff --git a/linux/drivers/media/dvb/frontends/af9013_priv.h b/linux/drivers/media/dvb/frontends/af9013_priv.h index b62e4cc9b..163e251d0 100644 --- a/linux/drivers/media/dvb/frontends/af9013_priv.h +++ b/linux/drivers/media/dvb/frontends/af9013_priv.h @@ -25,7 +25,7 @@ #define _AF9013_PRIV_ #define LOG_PREFIX "af9013" -extern int debug; +extern int af9013_debug; #define dprintk(var, level, args...) \ do { if ((var & level)) printk(args); } while (0) @@ -37,7 +37,7 @@ extern int debug; func("\n");\ } -#define deb_info(args...) dprintk(debug, 0x01, args) +#define deb_info(args...) dprintk(af9013_debug, 0x01, args) #undef err #define err(f, arg...) printk(KERN_ERR LOG_PREFIX": " f "\n" , ## arg) diff --git a/linux/drivers/media/video/gspca/m5602/Makefile b/linux/drivers/media/video/gspca/m5602/Makefile index 672fb6bb5..226ab4fc9 100644 --- a/linux/drivers/media/video/gspca/m5602/Makefile +++ b/linux/drivers/media/video/gspca/m5602/Makefile @@ -6,3 +6,6 @@ gspca_m5602-objs := m5602_core.o \ m5602_po1030.o \ m5602_s5k83a.o \ m5602_s5k4aa.o + +EXTRA_CFLAGS += -Idrivers/media/video/gspca + diff --git a/linux/drivers/media/video/gspca/m5602/m5602_bridge.h b/linux/drivers/media/video/gspca/m5602/m5602_bridge.h index 6b2441e84..18ca19a94 100644 --- a/linux/drivers/media/video/gspca/m5602/m5602_bridge.h +++ b/linux/drivers/media/video/gspca/m5602/m5602_bridge.h @@ -45,7 +45,7 @@ #define PDEBUG(level, fmt, args...) \ do { \ - if (debug & level) \ + if (m5602_debug & level) \ info("[%s:%d] " fmt, __func__, __LINE__ , \ ## args); \ } while (0) diff --git a/linux/drivers/media/video/gspca/m5602/m5602_core.c b/linux/drivers/media/video/gspca/m5602/m5602_core.c index 30efe7d4b..475073501 100644 --- a/linux/drivers/media/video/gspca/m5602/m5602_core.c +++ b/linux/drivers/media/video/gspca/m5602/m5602_core.c @@ -26,7 +26,7 @@ int force_sensor; int dump_bridge; int dump_sensor; -unsigned int debug; +unsigned int m5602_debug; static const __devinitdata struct usb_device_id m5602_table[] = { {USB_DEVICE(0x0402, 0x5602)}, @@ -292,7 +292,7 @@ module_exit(mod_m5602_exit); MODULE_AUTHOR(DRIVER_AUTHOR); MODULE_DESCRIPTION(DRIVER_DESC); MODULE_LICENSE("GPL"); -module_param(debug, int, S_IRUGO | S_IWUSR); +module_param_named(debug, m5602_debug, int, S_IRUGO | S_IWUSR); MODULE_PARM_DESC(debug, "toggles debug on/off"); module_param(force_sensor, int, S_IRUGO | S_IWUSR); diff --git a/linux/drivers/media/video/gspca/m5602/m5602_mt9m111.h b/linux/drivers/media/video/gspca/m5602/m5602_mt9m111.h index f914547b9..79a5d8878 100644 --- a/linux/drivers/media/video/gspca/m5602/m5602_mt9m111.h +++ b/linux/drivers/media/video/gspca/m5602/m5602_mt9m111.h @@ -82,7 +82,7 @@ /* Kernel module parameters */ extern int force_sensor; extern int dump_sensor; -extern unsigned int debug; +extern unsigned int m5602_debug; int mt9m111_probe(struct sd *sd); int mt9m111_init(struct sd *sd); diff --git a/linux/drivers/media/video/gspca/m5602/m5602_ov9650.h b/linux/drivers/media/video/gspca/m5602/m5602_ov9650.h index 70429b411..486ea337a 100644 --- a/linux/drivers/media/video/gspca/m5602/m5602_ov9650.h +++ b/linux/drivers/media/video/gspca/m5602/m5602_ov9650.h @@ -121,7 +121,7 @@ /* Kernel module parameters */ extern int force_sensor; extern int dump_sensor; -extern unsigned int debug; +extern unsigned int m5602_debug; int ov9650_probe(struct sd *sd); int ov9650_init(struct sd *sd); diff --git a/linux/drivers/media/video/gspca/m5602/m5602_po1030.h b/linux/drivers/media/video/gspca/m5602/m5602_po1030.h index db86a9287..68f34c97b 100644 --- a/linux/drivers/media/video/gspca/m5602/m5602_po1030.h +++ b/linux/drivers/media/video/gspca/m5602/m5602_po1030.h @@ -121,7 +121,7 @@ /* Kernel module parameters */ extern int force_sensor; extern int dump_sensor; -extern unsigned int debug; +extern unsigned int m5602_debug; int po1030_probe(struct sd *sd); int po1030_init(struct sd *sd); diff --git a/linux/drivers/media/video/gspca/m5602/m5602_s5k4aa.h b/linux/drivers/media/video/gspca/m5602/m5602_s5k4aa.h index 5d808a750..1e4213a73 100644 --- a/linux/drivers/media/video/gspca/m5602/m5602_s5k4aa.h +++ b/linux/drivers/media/video/gspca/m5602/m5602_s5k4aa.h @@ -63,7 +63,7 @@ /* Kernel module parameters */ extern int force_sensor; extern int dump_sensor; -extern unsigned int debug; +extern unsigned int m5602_debug; int s5k4aa_probe(struct sd *sd); int s5k4aa_init(struct sd *sd); diff --git a/linux/drivers/media/video/gspca/m5602/m5602_s5k83a.h b/linux/drivers/media/video/gspca/m5602/m5602_s5k83a.h index 67432b5a5..a57f623d8 100644 --- a/linux/drivers/media/video/gspca/m5602/m5602_s5k83a.h +++ b/linux/drivers/media/video/gspca/m5602/m5602_s5k83a.h @@ -36,7 +36,7 @@ /* Kernel module parameters */ extern int force_sensor; extern int dump_sensor; -extern unsigned int debug; +extern unsigned int m5602_debug; int s5k83a_probe(struct sd *sd); -- cgit v1.2.3 From 0d1d720c6adb0f1d7eba935c7d843c9a0a287f28 Mon Sep 17 00:00:00 2001 From: Mauro Carvalho Chehab Date: Fri, 10 Oct 2008 08:08:23 +0000 Subject: USB: remove info() macro from usb media drivers From: Greg Kroah-Hartman USB should not be having it's own printk macros, so remove info() and use the system-wide standard of dev_info() wherever possible. Signed-off-by: Greg Kroah-Hartman CC: Douglas Landgraf CC: Mike Isely CC: Thierry Merle CC: Antoine Jacquet Signed-off-by: Mauro Carvalho Chehab --- linux/drivers/media/radio/dsbr100.c | 3 +- linux/drivers/media/video/dabusb.c | 3 +- linux/drivers/media/video/ov511.c | 105 +++++++------ linux/drivers/media/video/ov511.h | 3 +- linux/drivers/media/video/pvrusb2/pvrusb2-main.c | 8 +- linux/drivers/media/video/se401.c | 37 +++-- linux/drivers/media/video/stv680.c | 6 +- linux/drivers/media/video/usbvideo/ibmcam.c | 78 ++++++---- linux/drivers/media/video/usbvideo/konicawc.c | 17 ++- .../media/video/usbvideo/quickcam_messenger.c | 3 +- linux/drivers/media/video/usbvideo/ultracam.c | 29 ++-- linux/drivers/media/video/usbvideo/usbvideo.c | 163 ++++++++++++++------- .../drivers/media/video/usbvision/usbvision-core.c | 3 +- .../drivers/media/video/usbvision/usbvision-i2c.c | 3 +- .../media/video/usbvision/usbvision-video.c | 3 +- linux/drivers/media/video/zr364xx.c | 50 ++++--- 16 files changed, 312 insertions(+), 202 deletions(-) (limited to 'linux/drivers') diff --git a/linux/drivers/media/radio/dsbr100.c b/linux/drivers/media/radio/dsbr100.c index c03274e46..f3af92b59 100644 --- a/linux/drivers/media/radio/dsbr100.c +++ b/linux/drivers/media/radio/dsbr100.c @@ -511,7 +511,8 @@ static int usb_dsbr100_probe(struct usb_interface *intf, static int __init dsbr100_init(void) { int retval = usb_register(&usb_dsbr100_driver); - info(DRIVER_VERSION ":" DRIVER_DESC); + printk(KERN_INFO KBUILD_MODNAME ": " DRIVER_VERSION ":" + DRIVER_DESC "\n"); return retval; } diff --git a/linux/drivers/media/video/dabusb.c b/linux/drivers/media/video/dabusb.c index 4acba6e92..21280dbc3 100644 --- a/linux/drivers/media/video/dabusb.c +++ b/linux/drivers/media/video/dabusb.c @@ -929,7 +929,8 @@ static int __init dabusb_init (void) dbg("dabusb_init: driver registered"); - info(DRIVER_VERSION ":" DRIVER_DESC); + printk(KERN_INFO KBUILD_MODNAME ": " DRIVER_VERSION ":" + DRIVER_DESC "\n"); out: return retval; diff --git a/linux/drivers/media/video/ov511.c b/linux/drivers/media/video/ov511.c index 3f1d7a660..9a5662024 100644 --- a/linux/drivers/media/video/ov511.c +++ b/linux/drivers/media/video/ov511.c @@ -974,14 +974,14 @@ dump_i2c_range(struct usb_ov511 *ov, int reg1, int regn) for (i = reg1; i <= regn; i++) { rc = i2c_r(ov, i); - info("Sensor[0x%02X] = 0x%02X", i, rc); + dev_info(&ov->dev->dev, "Sensor[0x%02X] = 0x%02X\n", i, rc); } } static void dump_i2c_regs(struct usb_ov511 *ov) { - info("I2C REGS"); + dev_info(&ov->dev->dev, "I2C REGS\n"); dump_i2c_range(ov, 0x00, 0x7C); } @@ -992,28 +992,28 @@ dump_reg_range(struct usb_ov511 *ov, int reg1, int regn) for (i = reg1; i <= regn; i++) { rc = reg_r(ov, i); - info("OV511[0x%02X] = 0x%02X", i, rc); + dev_info(&ov->dev->dev, "OV511[0x%02X] = 0x%02X\n", i, rc); } } static void ov511_dump_regs(struct usb_ov511 *ov) { - info("CAMERA INTERFACE REGS"); + dev_info(&ov->dev->dev, "CAMERA INTERFACE REGS\n"); dump_reg_range(ov, 0x10, 0x1f); - info("DRAM INTERFACE REGS"); + dev_info(&ov->dev->dev, "DRAM INTERFACE REGS\n"); dump_reg_range(ov, 0x20, 0x23); - info("ISO FIFO REGS"); + dev_info(&ov->dev->dev, "ISO FIFO REGS\n"); dump_reg_range(ov, 0x30, 0x31); - info("PIO REGS"); + dev_info(&ov->dev->dev, "PIO REGS\n"); dump_reg_range(ov, 0x38, 0x39); dump_reg_range(ov, 0x3e, 0x3e); - info("I2C REGS"); + dev_info(&ov->dev->dev, "I2C REGS\n"); dump_reg_range(ov, 0x40, 0x49); - info("SYSTEM CONTROL REGS"); + dev_info(&ov->dev->dev, "SYSTEM CONTROL REGS\n"); dump_reg_range(ov, 0x50, 0x55); dump_reg_range(ov, 0x5e, 0x5f); - info("OmniCE REGS"); + dev_info(&ov->dev->dev, "OmniCE REGS\n"); dump_reg_range(ov, 0x70, 0x79); /* NOTE: Quantization tables are not readable. You will get the value * in reg. 0x79 for every table register */ @@ -1025,25 +1025,25 @@ ov511_dump_regs(struct usb_ov511 *ov) static void ov518_dump_regs(struct usb_ov511 *ov) { - info("VIDEO MODE REGS"); + dev_info(&ov->dev->dev, "VIDEO MODE REGS\n"); dump_reg_range(ov, 0x20, 0x2f); - info("DATA PUMP AND SNAPSHOT REGS"); + dev_info(&ov->dev->dev, "DATA PUMP AND SNAPSHOT REGS\n"); dump_reg_range(ov, 0x30, 0x3f); - info("I2C REGS"); + dev_info(&ov->dev->dev, "I2C REGS\n"); dump_reg_range(ov, 0x40, 0x4f); - info("SYSTEM CONTROL AND VENDOR REGS"); + dev_info(&ov->dev->dev, "SYSTEM CONTROL AND VENDOR REGS\n"); dump_reg_range(ov, 0x50, 0x5f); - info("60 - 6F"); + dev_info(&ov->dev->dev, "60 - 6F\n"); dump_reg_range(ov, 0x60, 0x6f); - info("70 - 7F"); + dev_info(&ov->dev->dev, "70 - 7F\n"); dump_reg_range(ov, 0x70, 0x7f); - info("Y QUANTIZATION TABLE"); + dev_info(&ov->dev->dev, "Y QUANTIZATION TABLE\n"); dump_reg_range(ov, 0x80, 0x8f); - info("UV QUANTIZATION TABLE"); + dev_info(&ov->dev->dev, "UV QUANTIZATION TABLE\n"); dump_reg_range(ov, 0x90, 0x9f); - info("A0 - BF"); + dev_info(&ov->dev->dev, "A0 - BF\n"); dump_reg_range(ov, 0xa0, 0xbf); - info("CBR"); + dev_info(&ov->dev->dev, "CBR\n"); dump_reg_range(ov, 0xc0, 0xcf); } #endif @@ -3205,9 +3205,10 @@ ov511_move_data(struct usb_ov511 *ov, unsigned char *in, int n) */ if (printph) { - info("ph(%3d): %2x %2x %2x %2x %2x %2x %2x %2x %2x %2x %2x %2x", - pnum, in[0], in[1], in[2], in[3], in[4], in[5], in[6], - in[7], in[8], in[9], in[10], in[11]); + dev_info(&ov->dev->dev, + "ph(%3d): %2x %2x %2x %2x %2x %2x %2x %2x %2x %2x %2x %2x\n", + pnum, in[0], in[1], in[2], in[3], in[4], in[5], in[6], + in[7], in[8], in[9], in[10], in[11]); } /* Check for SOF/EOF packet */ @@ -3366,8 +3367,10 @@ ov518_move_data(struct usb_ov511 *ov, unsigned char *in, int n) * the definitive SOF/EOF format */ if ((!(in[0] | in[1] | in[2] | in[3] | in[5])) && in[6]) { if (printph) { - info("ph: %2x %2x %2x %2x %2x %2x %2x %2x", in[0], - in[1], in[2], in[3], in[4], in[5], in[6], in[7]); + dev_info(&ov->dev->dev, + "ph: %2x %2x %2x %2x %2x %2x %2x %2x\n", + in[0], in[1], in[2], in[3], in[4], in[5], + in[6], in[7]); } if (frame->scanstate == STATE_LINES) { @@ -3650,14 +3653,16 @@ ov51x_init_isoc(struct usb_ov511 *ov) if (packetsize == -1) { ov518_set_packet_size(ov, 640); } else { - info("Forcing packet size to %d", packetsize); + dev_info(&ov->dev->dev, "Forcing packet size to %d\n", + packetsize); ov518_set_packet_size(ov, packetsize); } } else { if (packetsize == -1) { ov511_set_packet_size(ov, size); } else { - info("Forcing packet size to %d", packetsize); + dev_info(&ov->dev->dev, "Forcing packet size to %d\n", + packetsize); ov511_set_packet_size(ov, packetsize); } } @@ -4125,7 +4130,7 @@ ov51x_v4l1_ioctl_internal(struct inode *inode, struct file *file, return -EIO; if (force_palette && p->palette != force_palette) { - info("Palette rejected (%s)", + dev_info(&ov->dev->dev, "Palette rejected (%s)\n", symbolic(v4l1_plist, p->palette)); return -EINVAL; } @@ -4853,26 +4858,27 @@ ov7xx0_configure(struct usb_ov511 *ov) err("Error detecting sensor type"); return -1; } else if ((rc & 3) == 3) { - info("Sensor is an OV7610"); + dev_info(&ov->dev->dev, "Sensor is an OV7610\n"); ov->sensor = SEN_OV7610; } else if ((rc & 3) == 1) { /* I don't know what's different about the 76BE yet. */ if (i2c_r(ov, 0x15) & 1) - info("Sensor is an OV7620AE"); + dev_info(&ov->dev->dev, "Sensor is an OV7620AE\n"); else - info("Sensor is an OV76BE"); + dev_info(&ov->dev->dev, "Sensor is an OV76BE\n"); /* OV511+ will return all zero isoc data unless we * configure the sensor as a 7620. Someone needs to * find the exact reg. setting that causes this. */ if (ov->bridge == BRG_OV511PLUS) { - info("Enabling 511+/7620AE workaround"); + dev_info(&ov->dev->dev, + "Enabling 511+/7620AE workaround\n"); ov->sensor = SEN_OV7620; } else { ov->sensor = SEN_OV76BE; } } else if ((rc & 3) == 0) { - info("Sensor is an OV7620"); + dev_info(&ov->dev->dev, "Sensor is an OV7620\n"); ov->sensor = SEN_OV7620; } else { err("Unknown image sensor version: %d", rc & 3); @@ -5028,16 +5034,16 @@ ov6xx0_configure(struct usb_ov511 *ov) if ((rc & 3) == 0) { ov->sensor = SEN_OV6630; - info("Sensor is an OV6630"); + dev_info(&ov->dev->dev, "Sensor is an OV6630\n"); } else if ((rc & 3) == 1) { ov->sensor = SEN_OV6620; - info("Sensor is an OV6620"); + dev_info(&ov->dev->dev, "Sensor is an OV6620\n"); } else if ((rc & 3) == 2) { ov->sensor = SEN_OV6630; - info("Sensor is an OV6630AE"); + dev_info(&ov->dev->dev, "Sensor is an OV6630AE\n"); } else if ((rc & 3) == 3) { ov->sensor = SEN_OV6630; - info("Sensor is an OV6630AF"); + dev_info(&ov->dev->dev, "Sensor is an OV6630AF\n"); } /* Set sensor-specific vars */ @@ -5092,10 +5098,10 @@ ks0127_configure(struct usb_ov511 *ov) err("Error detecting sensor type"); return -1; } else if ((rc & 0x0f) == 0) { - info("Sensor is a KS0127"); + dev_info(&ov->dev->dev, "Sensor is a KS0127\n"); ov->sensor = SEN_KS0127; } else if ((rc & 0x0f) == 9) { - info("Sensor is a KS0127B Rev. A"); + dev_info(&ov->dev->dev, "Sensor is a KS0127B Rev. A\n"); ov->sensor = SEN_KS0127B; } } else { @@ -5204,7 +5210,8 @@ saa7111a_configure(struct usb_ov511 *ov) err("Error detecting sensor version"); return -1; } else { - info("Sensor is an SAA7111A (version 0x%x)", rc); + dev_info(&ov->dev->dev, + "Sensor is an SAA7111A (version 0x%x)\n", rc); ov->sensor = SEN_SAA7111A; } @@ -5266,7 +5273,7 @@ ov511_configure(struct usb_ov511 *ov) PDEBUG (1, "CustomID = %d", ov->customid); ov->desc = symbolic(camlist, ov->customid); - info("model: %s", ov->desc); + dev_info(&ov->dev->dev, "model: %s\n", ov->desc); if (0 == strcmp(ov->desc, NOT_DEFINED_STR)) { err("Camera type (%d) not recognized", ov->customid); @@ -5430,7 +5437,8 @@ ov518_configure(struct usb_ov511 *ov) PDEBUG(4, ""); /* First 5 bits of custom ID reg are a revision ID on OV518 */ - info("Device revision %d", 0x1F & reg_r(ov, R511_SYS_CUST_ID)); + dev_info(&ov->dev->dev, "Device revision %d\n", + 0x1F & reg_r(ov, R511_SYS_CUST_ID)); /* Give it the default description */ ov->desc = symbolic(camlist, 0); @@ -5777,7 +5785,8 @@ ov51x_probe(struct usb_interface *intf, const struct usb_device_id *id) goto error; } - info("USB %s video device found", symbolic(brglist, ov->bridge)); + dev_info(&intf->dev, "USB %s video device found\n", + symbolic(brglist, ov->bridge)); init_waitqueue_head(&ov->wq); @@ -5858,8 +5867,8 @@ ov51x_probe(struct usb_interface *intf, const struct usb_device_id *id) goto error; } - info("Device at %s registered to minor %d", ov->usb_path, - ov->vdev->minor); + dev_info(&intf->dev, "Device at %s registered to minor %d\n", + ov->usb_path, ov->vdev->minor); usb_set_intfdata(intf, ov); if (ov_create_sysfs(ov->vdev)) { @@ -5962,7 +5971,8 @@ usb_ov511_init(void) if (retval) goto out; - info(DRIVER_VERSION " : " DRIVER_DESC); + printk(KERN_INFO KBUILD_MODNAME ": " DRIVER_VERSION ":" + DRIVER_DESC "\n"); out: return retval; @@ -5972,8 +5982,7 @@ static void __exit usb_ov511_exit(void) { usb_deregister(&ov511_driver); - info("driver deregistered"); - + printk(KERN_INFO KBUILD_MODNAME ": driver deregistered\n"); } module_init(usb_ov511_init); diff --git a/linux/drivers/media/video/ov511.h b/linux/drivers/media/video/ov511.h index eba9f2e64..c303ac5a8 100644 --- a/linux/drivers/media/video/ov511.h +++ b/linux/drivers/media/video/ov511.h @@ -13,7 +13,8 @@ #ifdef OV511_DEBUG #define PDEBUG(level, fmt, args...) \ - if (debug >= (level)) info("[%s:%d] " fmt, \ + if (debug >= (level)) \ + printk(KERN_INFO KBUILD_MODNAME "[%s:%d] \n" fmt, \ __func__, __LINE__ , ## args) #else #define PDEBUG(level, fmt, args...) do {} while(0) diff --git a/linux/drivers/media/video/pvrusb2/pvrusb2-main.c b/linux/drivers/media/video/pvrusb2/pvrusb2-main.c index 9a3ad0905..2399959a8 100644 --- a/linux/drivers/media/video/pvrusb2/pvrusb2-main.c +++ b/linux/drivers/media/video/pvrusb2/pvrusb2-main.c @@ -138,9 +138,11 @@ static int __init pvr_init(void) ret = usb_register(&pvr_driver); if (ret == 0) - info(DRIVER_DESC " : " DRIVER_VERSION); - if (pvrusb2_debug) info("Debug mask is %d (0x%x)", - pvrusb2_debug,pvrusb2_debug); + printk(KERN_INFO KBUILD_MODNAME ": " DRIVER_VERSION ":" + DRIVER_DESC "\n"); + if (pvrusb2_debug) + printk(KERN_INFO KBUILD_MODNAME ": Debug mask is %d (0x%x)\n", + pvrusb2_debug,pvrusb2_debug); pvr2_trace(PVR2_TRACE_INIT,"pvr_init complete"); diff --git a/linux/drivers/media/video/se401.c b/linux/drivers/media/video/se401.c index 4b55b7dd7..5a346d0c5 100644 --- a/linux/drivers/media/video/se401.c +++ b/linux/drivers/media/video/se401.c @@ -292,7 +292,7 @@ static void se401_button_irq(struct urb *urb) int status; if (!se401->dev) { - info("ohoh: device vapourished"); + dev_info(&urb->dev->dev, "device vapourished\n"); return; } @@ -336,7 +336,7 @@ static void se401_video_irq(struct urb *urb) return; if (!se401->dev) { - info ("ohoh: device vapourished"); + dev_info(&urb->dev->dev, "device vapourished\n"); return; } @@ -383,7 +383,7 @@ static void se401_video_irq(struct urb *urb) urb->status=0; urb->dev=se401->dev; if(usb_submit_urb(urb, GFP_KERNEL)) - info("urb burned down"); + dev_info(&urb->dev->dev, "urb burned down\n"); return; } @@ -868,7 +868,8 @@ static int se401_newframe(struct usb_se401 *se401, int framenr) ); if (se401->nullpackets > SE401_MAX_NULLPACKETS) { se401->nullpackets=0; - info("to many null length packets, restarting capture"); + dev_info(&se401->dev->dev, + "too many null length packets, restarting capture\n"); se401_stop_stream(se401); se401_start_stream(se401); } else { @@ -888,7 +889,8 @@ static int se401_newframe(struct usb_se401 *se401, int framenr) se401->scratch_use=0; if (errors > SE401_MAX_ERRORS) { errors=0; - info("to much errors, restarting capture"); + dev_info(&se401->dev->dev, + "too many errors, restarting capture\n"); se401_stop_stream(se401); se401_start_stream(se401); } @@ -921,7 +923,7 @@ static void usb_se401_remove_disconnected (struct usb_se401 *se401) usb_kill_urb(se401->inturb); usb_free_urb(se401->inturb); } - info("%s disconnected", se401->camera_name); + dev_info(&se401->dev->dev, "%s disconnected", se401->camera_name); /* Free the memory */ kfree(se401->width); @@ -968,8 +970,8 @@ static int se401_close(struct inode *inode, struct file *file) rvfree(se401->fbuf, se401->maxframesize * SE401_NUMFRAMES); if (se401->removed) { + dev_info(&se401->dev->dev, "device unregistered\n"); usb_se401_remove_disconnected(se401); - info("device unregistered"); } else { for (i=0; iframe[i].grabstate=FRAME_UNUSED; @@ -1284,7 +1286,7 @@ static int se401_init(struct usb_se401 *se401, int button) for (i=0; isizes; i++) { sprintf(temp, "%s %dx%d", temp, se401->width[i], se401->height[i]); } - info("%s", temp); + dev_info(&se401->dev->dev, "%s\n", temp); se401->maxframesize=se401->width[se401->sizes-1]*se401->height[se401->sizes-1]*3; rc=se401_sndctrl(0, se401, SE401_REQ_GET_WIDTH, 0, cp, sizeof(cp)); @@ -1318,7 +1320,8 @@ static int se401_init(struct usb_se401 *se401, int button) if (button) { se401->inturb=usb_alloc_urb(0, GFP_KERNEL); if (!se401->inturb) { - info("Allocation of inturb failed"); + dev_info(&se401->dev->dev, + "Allocation of inturb failed\n"); return 1; } usb_fill_int_urb(se401->inturb, se401->dev, @@ -1329,7 +1332,7 @@ static int se401_init(struct usb_se401 *se401, int button) 8 ); if (usb_submit_urb(se401->inturb, GFP_KERNEL)) { - info("int urb burned down"); + dev_info(&se401->dev->dev, "int urb burned down\n"); return 1; } } else @@ -1386,7 +1389,7 @@ static int se401_probe(struct usb_interface *intf, return -ENODEV; /* We found one */ - info("SE401 camera found: %s", camera_name); + dev_info(&intf->dev, "SE401 camera found: %s\n", camera_name); if ((se401 = kzalloc(sizeof(*se401), GFP_KERNEL)) == NULL) { err("couldn't kmalloc se401 struct"); @@ -1397,7 +1400,8 @@ static int se401_probe(struct usb_interface *intf, se401->iface = interface->bInterfaceNumber; se401->camera_name = camera_name; - info("firmware version: %02x", le16_to_cpu(dev->descriptor.bcdDevice) & 255); + dev_info(&intf->dev, "firmware version: %02x\n", + le16_to_cpu(dev->descriptor.bcdDevice) & 255); if (se401_init(se401, button)) { kfree(se401); @@ -1415,7 +1419,8 @@ static int se401_probe(struct usb_interface *intf, err("video_register_device failed"); return -EIO; } - info("registered new video device: video%d", se401->vdev.minor); + dev_info(&intf->dev, "registered new video device: video%d\n", + se401->vdev.minor); usb_set_intfdata (intf, se401); return 0; @@ -1459,10 +1464,10 @@ static struct usb_driver se401_driver = { static int __init usb_se401_init(void) { - info("SE401 usb camera driver version %s registering", version); + printk(KERN_INFO "SE401 usb camera driver version %s registering\n", version); if (flickerless) if (flickerless!=50 && flickerless!=60) { - info("Invallid flickerless value, use 0, 50 or 60."); + printk(KERN_ERR "Invallid flickerless value, use 0, 50 or 60.\n"); return -1; } return usb_register(&se401_driver); @@ -1471,7 +1476,7 @@ static int __init usb_se401_init(void) static void __exit usb_se401_exit(void) { usb_deregister(&se401_driver); - info("SE401 driver deregistered"); + printk(KERN_INFO "SE401 driver deregistered\frame"); } module_init(usb_se401_init); diff --git a/linux/drivers/media/video/stv680.c b/linux/drivers/media/video/stv680.c index 8df48a547..f74c08b41 100644 --- a/linux/drivers/media/video/stv680.c +++ b/linux/drivers/media/video/stv680.c @@ -85,7 +85,8 @@ static unsigned int debug; #define PDEBUG(level, fmt, args...) \ do { \ if (debug >= level) \ - info("[%s:%d] " fmt, __func__, __LINE__ , ## args); \ + printk(KERN_INFO KBUILD_MODNAME " [%s:%d] \n" fmt, \ + __func__, __LINE__ , ## args); \ } while (0) @@ -1557,7 +1558,8 @@ static int __init usb_stv680_init (void) } PDEBUG (0, "STV(i): usb camera driver version %s registering", DRIVER_VERSION); - info(DRIVER_DESC " " DRIVER_VERSION); + printk(KERN_INFO KBUILD_MODNAME ": " DRIVER_VERSION ":" + DRIVER_DESC "\n"); return 0; } diff --git a/linux/drivers/media/video/usbvideo/ibmcam.c b/linux/drivers/media/video/usbvideo/ibmcam.c index 697e74a24..d202feac0 100644 --- a/linux/drivers/media/video/usbvideo/ibmcam.c +++ b/linux/drivers/media/video/usbvideo/ibmcam.c @@ -258,7 +258,9 @@ static enum ParseState ibmcam_find_header(struct uvd *uvd) /* FIXME: Add frame h (RING_QUEUE_PEEK(&uvd->dp, 2) == 0x00)) { #if 0 /* keep */ /* This code helps to detect new frame markers */ - info("Header sig: 00 FF 00 %02X", RING_QUEUE_PEEK(&uvd->dp, 3)); + dev_info(&uvd->dev->dev, + "Header sig: 00 FF 00 %02X\n", + RING_QUEUE_PEEK(&uvd->dp, 3)); #endif frame->header = RING_QUEUE_PEEK(&uvd->dp, 3); if ((frame->header == HDRSIG_MODEL1_128x96) || @@ -266,7 +268,8 @@ static enum ParseState ibmcam_find_header(struct uvd *uvd) /* FIXME: Add frame h (frame->header == HDRSIG_MODEL1_352x288)) { #if 0 /* keep */ - info("Header found."); + dev_info(&uvd->dev->dev, + "Header found.\n"); #endif RING_QUEUE_DEQUEUE_BYTES(&uvd->dp, marker_len); icam->has_hdr = 1; @@ -295,7 +298,7 @@ case IBMCAM_MODEL_4: (RING_QUEUE_PEEK(&uvd->dp, 1) == 0xFF)) { #if 0 /* keep */ - info("Header found."); + dev_info(&uvd->dev->dev, "Header found.\n"); #endif RING_QUEUE_DEQUEUE_BYTES(&uvd->dp, marker_len); icam->has_hdr = 1; @@ -338,7 +341,7 @@ case IBMCAM_MODEL_4: byte4 = RING_QUEUE_PEEK(&uvd->dp, 3); frame->header = (byte3 << 8) | byte4; #if 0 /* keep */ - info("Header found."); + dev_info(&uvd->dev->dev, "Header found.\n"); #endif RING_QUEUE_DEQUEUE_BYTES(&uvd->dp, marker_len); icam->has_hdr = 1; @@ -354,7 +357,8 @@ case IBMCAM_MODEL_4: } if (!icam->has_hdr) { if (uvd->debug > 2) - info("Skipping frame, no header"); + dev_info(&uvd->dev->dev, + "Skipping frame, no header\n"); return scan_EndParse; } @@ -881,7 +885,9 @@ static enum ParseState ibmcam_model3_parse_lines( */ if ((frame->curline + 1) >= data_h) { if (uvd->debug >= 3) - info("Reached line %d. (frame is done)", frame->curline); + dev_info(&uvd->dev->dev, + "Reached line %d. (frame is done)\n", + frame->curline); return scan_NextFrame; } @@ -954,8 +960,9 @@ static enum ParseState ibmcam_model3_parse_lines( if (frame->curline >= VIDEOSIZE_Y(frame->request)) { if (uvd->debug >= 3) { - info("All requested lines (%ld.) done.", - VIDEOSIZE_Y(frame->request)); + dev_info(&uvd->dev->dev, + "All requested lines (%ld.) done.\n", + VIDEOSIZE_Y(frame->request)); } return scan_NextFrame; } else @@ -1000,7 +1007,9 @@ static enum ParseState ibmcam_model4_128x96_parse_lines( */ if ((frame->curline + 1) >= data_h) { if (uvd->debug >= 3) - info("Reached line %d. (frame is done)", frame->curline); + dev_info(&uvd->dev->dev, + "Reached line %d. (frame is done)\n", + frame->curline); return scan_NextFrame; } @@ -1049,8 +1058,9 @@ static enum ParseState ibmcam_model4_128x96_parse_lines( if (frame->curline >= VIDEOSIZE_Y(frame->request)) { if (uvd->debug >= 3) { - info("All requested lines (%ld.) done.", - VIDEOSIZE_Y(frame->request)); + dev_info(&uvd->dev->dev, + "All requested lines (%ld.) done.\n", + VIDEOSIZE_Y(frame->request)); } return scan_NextFrame; } else @@ -1171,10 +1181,11 @@ static int ibmcam_veio( sizeof(cp), 1000); #if 0 /* keep */ - info("USB => %02x%02x%02x%02x%02x%02x%02x%02x " - "(req=$%02x val=$%04x ind=$%04x)", - cp[0],cp[1],cp[2],cp[3],cp[4],cp[5],cp[6],cp[7], - req, value, index); + dev_info(&uvd->dev->dev, + "USB => %02x%02x%02x%02x%02x%02x%02x%02x " + "(req=$%02x val=$%04x ind=$%04x)\n", + cp[0],cp[1],cp[2],cp[3],cp[4],cp[5],cp[6],cp[7], + req, value, index); #endif } else { i = usb_control_msg( @@ -1449,10 +1460,9 @@ static void ibmcam_adjust_contrast(struct uvd *uvd) */ static void ibmcam_change_lighting_conditions(struct uvd *uvd) { - static const char proc[] = "ibmcam_change_lighting_conditions"; - if (debug > 0) - info("%s: Set lighting to %hu.", proc, lighting); + dev_info(&uvd->dev->dev, + "%s: Set lighting to %hu.\n", __func__, lighting); switch (IBMCAM_T(uvd)->camera_model) { case IBMCAM_MODEL_1: @@ -1495,8 +1505,6 @@ static void ibmcam_change_lighting_conditions(struct uvd *uvd) */ static void ibmcam_set_sharpness(struct uvd *uvd) { - static const char proc[] = "ibmcam_set_sharpness"; - switch (IBMCAM_T(uvd)->camera_model) { case IBMCAM_MODEL_1: { @@ -1505,7 +1513,8 @@ static void ibmcam_set_sharpness(struct uvd *uvd) RESTRICT_TO_RANGE(sharpness, SHARPNESS_MIN, SHARPNESS_MAX); if (debug > 0) - info("%s: Set sharpness to %hu.", proc, sharpness); + dev_info(&uvd->dev->dev, "%s: Set sharpness to %hu.\n", + __func__, sharpness); sv = sa[sharpness - SHARPNESS_MIN]; for (i=0; i < 2; i++) { @@ -1564,11 +1573,11 @@ static void ibmcam_set_sharpness(struct uvd *uvd) */ static void ibmcam_set_brightness(struct uvd *uvd) { - static const char proc[] = "ibmcam_set_brightness"; static const unsigned short n = 1; if (debug > 0) - info("%s: Set brightness to %hu.", proc, uvd->vpic.brightness); + dev_info(&uvd->dev->dev, "%s: Set brightness to %hu.\n", + __func__, uvd->vpic.brightness); switch (IBMCAM_T(uvd)->camera_model) { case IBMCAM_MODEL_1: @@ -2115,7 +2124,8 @@ static void ibmcam_model2_setup_after_video_if(struct uvd *uvd) break; } if (uvd->debug > 0) - info("Framerate (hardware): %hd.", hw_fps); + dev_info(&uvd->dev->dev, "Framerate (hardware): %hd.\n", + hw_fps); RESTRICT_TO_RANGE(hw_fps, 0, 31); ibmcam_model2_Packet1(uvd, mod2_set_framerate, hw_fps); } @@ -3487,7 +3497,7 @@ static void ibmcam_model3_setup_after_video_if(struct uvd *uvd) /* 01.01.08 - Added for RCA video in support -LO */ if(init_model3_input) { if (debug > 0) - info("Setting input to RCA."); + dev_info(&uvd->dev->dev, "Setting input to RCA.\n"); for (i=0; i < ARRAY_SIZE(initData); i++) { ibmcam_veio(uvd, initData[i].req, initData[i].value, initData[i].index); } @@ -3685,7 +3695,7 @@ static int ibmcam_probe(struct usb_interface *intf, const struct usb_device_id * unsigned char video_ep = 0; if (debug >= 1) - info("ibmcam_probe(%p,%u.)", intf, ifnum); + dev_info(&uvd->dev->dev, "ibmcam_probe(%p,%u.)\n", intf, ifnum); /* We don't handle multi-config cameras */ if (dev->descriptor.bNumConfigurations != 1) @@ -3736,14 +3746,16 @@ static int ibmcam_probe(struct usb_interface *intf, const struct usb_device_id * brand = "IBM PC Camera"; /* a.k.a. Xirlink C-It */ break; } - info("%s USB camera found (model %d, rev. 0x%04x)", - brand, model, le16_to_cpu(dev->descriptor.bcdDevice)); + dev_info(&uvd->dev->dev, + "%s USB camera found (model %d, rev. 0x%04x)\n", + brand, model, le16_to_cpu(dev->descriptor.bcdDevice)); } while (0); /* Validate found interface: must have one ISO endpoint */ nas = intf->num_altsetting; if (debug > 0) - info("Number of alternate settings=%d.", nas); + dev_info(&uvd->dev->dev, "Number of alternate settings=%d.\n", + nas); if (nas < 2) { err("Too few alternate settings for this camera!"); return -ENODEV; @@ -3787,7 +3799,9 @@ static int ibmcam_probe(struct usb_interface *intf, const struct usb_device_id * actInterface = i; maxPS = le16_to_cpu(endpoint->wMaxPacketSize); if (debug > 0) - info("Active setting=%d. maxPS=%d.", i, maxPS); + dev_info(&uvd->dev->dev, + "Active setting=%d. " + "maxPS=%d.\n", i, maxPS); } else err("More than one active alt. setting! Ignoring #%d.", i); } @@ -3826,7 +3840,7 @@ static int ibmcam_probe(struct usb_interface *intf, const struct usb_device_id * RESTRICT_TO_RANGE(framerate, 0, 5); break; default: - info("IBM camera: using 320x240"); + dev_info(&uvd->dev->dev, "IBM camera: using 320x240\n"); size = SIZE_320x240; /* No break here */ case SIZE_320x240: @@ -3855,7 +3869,7 @@ static int ibmcam_probe(struct usb_interface *intf, const struct usb_device_id * canvasY = 120; break; default: - info("IBM NetCamera: using 176x144"); + dev_info(&uvd->dev->dev, "IBM NetCamera: using 176x144\n"); size = SIZE_176x144; /* No break here */ case SIZE_176x144: diff --git a/linux/drivers/media/video/usbvideo/konicawc.c b/linux/drivers/media/video/usbvideo/konicawc.c index 25f9b4286..5c11ea64c 100644 --- a/linux/drivers/media/video/usbvideo/konicawc.c +++ b/linux/drivers/media/video/usbvideo/konicawc.c @@ -346,7 +346,8 @@ static int konicawc_compress_iso(struct uvd *uvd, struct urb *dataurb, struct ur } if((sts > 0x01) && (sts < 0x80)) { - info("unknown status %2.2x", sts); + dev_info(&uvd->dev->dev, "unknown status %2.2x\n", + sts); bad++; continue; } @@ -581,8 +582,12 @@ static void konicawc_process_isoc(struct uvd *uvd, struct usbvideo_frame *frame) fdrops = (0x80 + curframe - cam->lastframe) & 0x7F; fdrops--; if(fdrops) { - info("Dropped %d frames (%d -> %d)", fdrops, - cam->lastframe, curframe); + dev_info(&uvd->dev->dev, + "Dropped %d frames " + "(%d -> %d)\n", + fdrops, + cam->lastframe, + curframe); } } cam->lastframe = curframe; @@ -797,7 +802,8 @@ static int konicawc_probe(struct usb_interface *intf, const struct usb_device_id if (dev->descriptor.bNumConfigurations != 1) return -ENODEV; - info("Konica Webcam (rev. 0x%04x)", le16_to_cpu(dev->descriptor.bcdDevice)); + dev_info(&intf->dev, "Konica Webcam (rev. 0x%04x)\n", + le16_to_cpu(dev->descriptor.bcdDevice)); RESTRICT_TO_RANGE(speed, 0, MAX_SPEED); /* Validate found interface: must have one ISO endpoint */ @@ -938,7 +944,8 @@ static struct usb_device_id id_table[] = { static int __init konicawc_init(void) { struct usbvideo_cb cbTbl; - info(DRIVER_DESC " " DRIVER_VERSION); + printk(KERN_INFO KBUILD_MODNAME ": " DRIVER_VERSION ":" + DRIVER_DESC "\n"); memset(&cbTbl, 0, sizeof(cbTbl)); cbTbl.probe = konicawc_probe; cbTbl.setupOnOpen = konicawc_setup_on_open; diff --git a/linux/drivers/media/video/usbvideo/quickcam_messenger.c b/linux/drivers/media/video/usbvideo/quickcam_messenger.c index f079e8d66..2f7274aba 100644 --- a/linux/drivers/media/video/usbvideo/quickcam_messenger.c +++ b/linux/drivers/media/video/usbvideo/quickcam_messenger.c @@ -1097,7 +1097,8 @@ static struct usbvideo_cb qcm_driver = { static int __init qcm_init(void) { - info(DRIVER_DESC " " DRIVER_VERSION); + printk(KERN_INFO KBUILD_MODNAME ": " DRIVER_VERSION ":" + DRIVER_DESC "\n"); return usbvideo_register( &cams, diff --git a/linux/drivers/media/video/usbvideo/ultracam.c b/linux/drivers/media/video/usbvideo/ultracam.c index bd89e6862..d29e6a81b 100644 --- a/linux/drivers/media/video/usbvideo/ultracam.c +++ b/linux/drivers/media/video/usbvideo/ultracam.c @@ -156,10 +156,11 @@ static int ultracam_veio( sizeof(cp), 1000); #if 1 /* keep */ - info("USB => %02x%02x%02x%02x%02x%02x%02x%02x " - "(req=$%02x val=$%04x ind=$%04x)", - cp[0],cp[1],cp[2],cp[3],cp[4],cp[5],cp[6],cp[7], - req, value, index); + dev_info(&uvd->dev->dev, + "USB => %02x%02x%02x%02x%02x%02x%02x%02x " + "(req=$%02x val=$%04x ind=$%04x)\n", + cp[0],cp[1],cp[2],cp[3],cp[4],cp[5],cp[6],cp[7], + req, value, index); #endif } else { i = usb_control_msg( @@ -517,19 +518,20 @@ static int ultracam_probe(struct usb_interface *intf, const struct usb_device_id unsigned char video_ep = 0; if (debug >= 1) - info("ultracam_probe(%p)", intf); + dev_info(&intf->dev, "ultracam_probe\n"); /* We don't handle multi-config cameras */ if (dev->descriptor.bNumConfigurations != 1) return -ENODEV; - info("IBM Ultra camera found (rev. 0x%04x)", - le16_to_cpu(dev->descriptor.bcdDevice)); + dev_info(&intf->dev, "IBM Ultra camera found (rev. 0x%04x)\n", + le16_to_cpu(dev->descriptor.bcdDevice)); /* Validate found interface: must have one ISO endpoint */ nas = intf->num_altsetting; if (debug > 0) - info("Number of alternate settings=%d.", nas); + dev_info(&intf->dev, "Number of alternate settings=%d.\n", + nas); if (nas < 8) { err("Too few alternate settings for this camera!"); return -ENODEV; @@ -576,7 +578,9 @@ static int ultracam_probe(struct usb_interface *intf, const struct usb_device_id actInterface = i; maxPS = le16_to_cpu(endpoint->wMaxPacketSize); if (debug > 0) - info("Active setting=%d. maxPS=%d.", i, maxPS); + dev_info(&intf->dev, + "Active setting=%d. " + "maxPS=%d.\n", i, maxPS); } else { /* Got another active alt. setting */ if (maxPS < le16_to_cpu(endpoint->wMaxPacketSize)) { @@ -584,8 +588,11 @@ static int ultracam_probe(struct usb_interface *intf, const struct usb_device_id actInterface = i; maxPS = le16_to_cpu(endpoint->wMaxPacketSize); if (debug > 0) { - info("Even better ctive setting=%d. maxPS=%d.", - i, maxPS); + dev_info(&intf->dev, + "Even better ctive " + "setting=%d. " + "maxPS=%d.\n", + i, maxPS); } } } diff --git a/linux/drivers/media/video/usbvideo/usbvideo.c b/linux/drivers/media/video/usbvideo/usbvideo.c index 2e29d95b6..c6d1e7dca 100644 --- a/linux/drivers/media/video/usbvideo/usbvideo.c +++ b/linux/drivers/media/video/usbvideo/usbvideo.c @@ -468,8 +468,9 @@ static void usbvideo_ReportStatistics(const struct uvd *uvd) percent = (100 * goodPackets) / allPackets; else percent = goodPackets / (allPackets / 100); - info("Packet Statistics: Total=%lu. Empty=%lu. Usage=%lu%%", - allPackets, badPackets, percent); + dev_info(&uvd->dev->dev, + "Packet Statistics: Total=%lu. Empty=%lu. Usage=%lu%%\n", + allPackets, badPackets, percent); if (uvd->iso_packet_len > 0) { unsigned long allBytes, xferBytes; char multiplier = ' '; @@ -497,8 +498,9 @@ static void usbvideo_ReportStatistics(const struct uvd *uvd) } } } - info("Transfer Statistics: Transferred=%lu%cB Usage=%lu%%", - xferBytes, multiplier, percent); + dev_info(&uvd->dev->dev, + "Transfer Statistics: Transferred=%lu%cB Usage=%lu%%\n", + xferBytes, multiplier, percent); } } } @@ -545,7 +547,7 @@ void usbvideo_TestPattern(struct uvd *uvd, int fullframe, int pmode) { /* For debugging purposes only */ char tmp[20]; usbvideo_VideosizeToString(tmp, sizeof(tmp), frame->request); - info("testpattern: frame=%s", tmp); + dev_info(&uvd->dev->dev, "testpattern: frame=%s\n", tmp); } #endif /* Form every scan line */ @@ -854,7 +856,7 @@ static void usbvideo_Disconnect(struct usb_interface *intf) usbvideo_ClientIncModCount(uvd); if (uvd->debug > 0) - info("%s(%p.)", __func__, intf); + dev_info(&intf->dev, "%s(%p.)\n", __func__, intf); mutex_lock(&uvd->lock); uvd->remove_pending = 1; /* Now all ISO data will be ignored */ @@ -870,14 +872,15 @@ static void usbvideo_Disconnect(struct usb_interface *intf) video_unregister_device(&uvd->vdev); if (uvd->debug > 0) - info("%s: Video unregistered.", __func__); + dev_info(&intf->dev, "%s: Video unregistered.\n", __func__); if (uvd->user) - info("%s: In use, disconnect pending.", __func__); + dev_info(&intf->dev, "%s: In use, disconnect pending.\n", + __func__); else usbvideo_CameraRelease(uvd); mutex_unlock(&uvd->lock); - info("USB camera disconnected."); + dev_info(&intf->dev, "USB camera disconnected.\n"); usbvideo_ClientDecModCount(uvd); } @@ -1015,14 +1018,17 @@ int usbvideo_RegisterVideoDevice(struct uvd *uvd) return -EINVAL; } if (uvd->video_endp == 0) { - info("%s: No video endpoint specified; data pump disabled.", __func__); + dev_info(&uvd->dev->dev, + "%s: No video endpoint specified; data pump disabled.\n", + __func__); } if (uvd->paletteBits == 0) { err("%s: No palettes specified!", __func__); return -EINVAL; } if (uvd->defaultPalette == 0) { - info("%s: No default palette!", __func__); + dev_info(&uvd->dev->dev, "%s: No default palette!\n", + __func__); } uvd->max_frame_size = VIDEOSIZE_X(uvd->canvas) * @@ -1031,8 +1037,10 @@ int usbvideo_RegisterVideoDevice(struct uvd *uvd) usbvideo_VideosizeToString(tmp2, sizeof(tmp2), uvd->canvas); if (uvd->debug > 0) { - info("%s: iface=%d. endpoint=$%02x paletteBits=$%08lx", - __func__, uvd->iface, uvd->video_endp, uvd->paletteBits); + dev_info(&uvd->dev->dev, + "%s: iface=%d. endpoint=$%02x paletteBits=$%08lx\n", + __func__, uvd->iface, uvd->video_endp, + uvd->paletteBits); } if (uvd->dev == NULL) { err("%s: uvd->dev == NULL", __func__); @@ -1045,12 +1053,13 @@ int usbvideo_RegisterVideoDevice(struct uvd *uvd) return -EPIPE; } if (uvd->debug > 1) { - info("%s: video_register_device() successful", __func__); + dev_info(&uvd->dev->dev, + "%s: video_register_device() successful\n", __func__); } - info("%s on /dev/video%d: canvas=%s videosize=%s", - (uvd->handle != NULL) ? uvd->handle->drvName : "???", - uvd->vdev.minor, tmp2, tmp1); + dev_info(&uvd->dev->dev, "%s on /dev/video%d: canvas=%s videosize=%s\n", + (uvd->handle != NULL) ? uvd->handle->drvName : "???", + uvd->vdev.minor, tmp2, tmp1); usb_get_dev(uvd->dev); return 0; @@ -1112,7 +1121,7 @@ static int usbvideo_v4l_open(struct inode *inode, struct file *file) int i, errCode = 0; if (uvd->debug > 1) - info("%s($%p)", __func__, dev); + dev_info(&uvd->dev->dev, "%s($%p)\n", __func__, dev); if (0 < usbvideo_ClientIncModCount(uvd)) return -ENODEV; @@ -1179,19 +1188,25 @@ static int usbvideo_v4l_open(struct inode *inode, struct file *file) if (errCode == 0) { if (VALID_CALLBACK(uvd, setupOnOpen)) { if (uvd->debug > 1) - info("%s: setupOnOpen callback", __func__); + dev_info(&uvd->dev->dev, + "%s: setupOnOpen callback\n", + __func__); errCode = GET_CALLBACK(uvd, setupOnOpen)(uvd); if (errCode < 0) { err("%s: setupOnOpen callback failed (%d.).", __func__, errCode); } else if (uvd->debug > 1) { - info("%s: setupOnOpen callback successful", __func__); + dev_info(&uvd->dev->dev, + "%s: setupOnOpen callback successful\n", + __func__); } } if (errCode == 0) { uvd->settingsAdjusted = 0; if (uvd->debug > 1) - info("%s: Open succeeded.", __func__); + dev_info(&uvd->dev->dev, + "%s: Open succeeded.\n", + __func__); uvd->user++; file->private_data = uvd; } @@ -1201,7 +1216,8 @@ static int usbvideo_v4l_open(struct inode *inode, struct file *file) if (errCode != 0) usbvideo_ClientDecModCount(uvd); if (uvd->debug > 0) - info("%s: Returning %d.", __func__, errCode); + dev_info(&uvd->dev->dev, "%s: Returning %d.\n", __func__, + errCode); return errCode; } @@ -1224,7 +1240,7 @@ static int usbvideo_v4l_close(struct inode *inode, struct file *file) int i; if (uvd->debug > 1) - info("%s($%p)", __func__, dev); + dev_info(&uvd->dev->dev, "%s($%p)\n", __func__, dev); mutex_lock(&uvd->lock); GET_CALLBACK(uvd, stopDataPump)(uvd); @@ -1244,14 +1260,15 @@ static int usbvideo_v4l_close(struct inode *inode, struct file *file) uvd->user--; if (uvd->remove_pending) { if (uvd->debug > 0) - info("usbvideo_v4l_close: Final disconnect."); + dev_info(&uvd->dev->dev, "%s: Final disconnect.\n", + __func__); usbvideo_CameraRelease(uvd); } mutex_unlock(&uvd->lock); usbvideo_ClientDecModCount(uvd); if (uvd->debug > 1) - info("%s: Completed.", __func__); + dev_info(&uvd->dev->dev, "%s: Completed.\n", __func__); file->private_data = NULL; return 0; } @@ -1365,8 +1382,9 @@ static int usbvideo_v4l_do_ioctl(struct inode *inode, struct file *file, struct video_mmap *vm = arg; if (uvd->debug >= 1) { - info("VIDIOCMCAPTURE: frame=%d. size=%dx%d, format=%d.", - vm->frame, vm->width, vm->height, vm->format); + dev_info(&uvd->dev->dev, + "VIDIOCMCAPTURE: frame=%d. size=%dx%d, format=%d.\n", + vm->frame, vm->width, vm->height, vm->format); } /* * Check if the requested size is supported. If the requestor @@ -1384,18 +1402,24 @@ static int usbvideo_v4l_do_ioctl(struct inode *inode, struct file *file, if ((vm->width > VIDEOSIZE_X(uvd->canvas)) || (vm->height > VIDEOSIZE_Y(uvd->canvas))) { if (uvd->debug > 0) { - info("VIDIOCMCAPTURE: Size=%dx%d too large; " - "allowed only up to %ldx%ld", vm->width, vm->height, - VIDEOSIZE_X(uvd->canvas), VIDEOSIZE_Y(uvd->canvas)); + dev_info(&uvd->dev->dev, + "VIDIOCMCAPTURE: Size=%dx%d " + "too large; allowed only up " + "to %ldx%ld\n", vm->width, + vm->height, + VIDEOSIZE_X(uvd->canvas), + VIDEOSIZE_Y(uvd->canvas)); } return -EINVAL; } /* Check if the palette is supported */ if (((1L << vm->format) & uvd->paletteBits) == 0) { if (uvd->debug > 0) { - info("VIDIOCMCAPTURE: format=%d. not supported" - " (paletteBits=$%08lx)", - vm->format, uvd->paletteBits); + dev_info(&uvd->dev->dev, + "VIDIOCMCAPTURE: format=%d. " + "not supported " + "(paletteBits=$%08lx)\n", + vm->format, uvd->paletteBits); } return -EINVAL; } @@ -1423,7 +1447,9 @@ static int usbvideo_v4l_do_ioctl(struct inode *inode, struct file *file, return -EINVAL; if (uvd->debug >= 1) - info("VIDIOCSYNC: syncing to frame %d.", *frameNum); + dev_info(&uvd->dev->dev, + "VIDIOCSYNC: syncing to frame %d.\n", + *frameNum); if (uvd->flags & FLAGS_NO_DECODING) ret = usbvideo_GetFrame(uvd, *frameNum); else if (VALID_CALLBACK(uvd, getFrame)) { @@ -1505,7 +1531,9 @@ static ssize_t usbvideo_v4l_read(struct file *file, char __user *buf, return -EFAULT; if (uvd->debug >= 1) - info("%s: %Zd. bytes, noblock=%d.", __func__, count, noblock); + dev_info(&uvd->dev->dev, + "%s: %Zd. bytes, noblock=%d.\n", + __func__, count, noblock); mutex_lock(&uvd->lock); @@ -1690,18 +1718,21 @@ static void usbvideo_IsocIrq(struct urb *urb) return; #if 0 /* keep */ if (urb->actual_length > 0) { - info("urb=$%p status=%d. errcount=%d. length=%d.", - urb, urb->status, urb->error_count, urb->actual_length); + dev_info(&uvd->dev->dev, + "urb=$%p status=%d. errcount=%d. length=%d.\n", + urb, urb->status, urb->error_count, + urb->actual_length); } else { static int c = 0; if (c++ % 100 == 0) - info("No Isoc data"); + dev_info(&uvd->dev->dev, "No Isoc data\n"); } #endif if (!uvd->streaming) { if (uvd->debug >= 1) - info("Not streaming, but interrupt!"); + dev_info(&uvd->dev->dev, + "Not streaming, but interrupt!\n"); return; } @@ -1746,7 +1777,7 @@ static int usbvideo_StartDataPump(struct uvd *uvd) int i, errFlag; if (uvd->debug > 1) - info("%s($%p)", __func__, uvd); + dev_info(&uvd->dev->dev, "%s($%p)\n", __func__, uvd); if (!CAMERA_IS_OPERATIONAL(uvd)) { err("%s: Camera is not operational", __func__); @@ -1794,7 +1825,9 @@ static int usbvideo_StartDataPump(struct uvd *uvd) uvd->streaming = 1; if (uvd->debug > 1) - info("%s: streaming=1 video_endp=$%02x", __func__, uvd->video_endp); + dev_info(&uvd->dev->dev, + "%s: streaming=1 video_endp=$%02x\n", __func__, + uvd->video_endp); return 0; } @@ -1816,14 +1849,14 @@ static void usbvideo_StopDataPump(struct uvd *uvd) return; if (uvd->debug > 1) - info("%s($%p)", __func__, uvd); + dev_info(&uvd->dev->dev, "%s($%p)\n", __func__, uvd); /* Unschedule all of the iso td's */ for (i=0; i < USBVIDEO_NUMSBUF; i++) { usb_kill_urb(uvd->sbuf[i].urb); } if (uvd->debug > 1) - info("%s: streaming=0", __func__); + dev_info(&uvd->dev->dev, "%s: streaming=0\n", __func__); uvd->streaming = 0; if (!uvd->remove_pending) { @@ -1855,7 +1888,8 @@ static int usbvideo_NewFrame(struct uvd *uvd, int framenum) int n; if (uvd->debug > 1) - info("usbvideo_NewFrame($%p,%d.)", uvd, framenum); + dev_info(&uvd->dev->dev, "usbvideo_NewFrame($%p,%d.)\n", uvd, + framenum); /* If we're not grabbing a frame right now and the other frame is */ /* ready to be grabbed into, then use it instead */ @@ -1960,12 +1994,14 @@ static int usbvideo_GetFrame(struct uvd *uvd, int frameNum) struct usbvideo_frame *frame = &uvd->frame[frameNum]; if (uvd->debug >= 2) - info("%s($%p,%d.)", __func__, uvd, frameNum); + dev_info(&uvd->dev->dev, "%s($%p,%d.)\n", __func__, uvd, + frameNum); switch (frame->frameState) { case FrameState_Unused: if (uvd->debug >= 2) - info("%s: FrameState_Unused", __func__); + dev_info(&uvd->dev->dev, "%s: FrameState_Unused\n", + __func__); return -EINVAL; case FrameState_Ready: case FrameState_Grabbing: @@ -1975,7 +2011,9 @@ static int usbvideo_GetFrame(struct uvd *uvd, int frameNum) redo: if (!CAMERA_IS_OPERATIONAL(uvd)) { if (uvd->debug >= 2) - info("%s: Camera is not operational (1)", __func__); + dev_info(&uvd->dev->dev, + "%s: Camera is not operational (1)\n", + __func__); return -EIO; } ntries = 0; @@ -1984,24 +2022,33 @@ static int usbvideo_GetFrame(struct uvd *uvd, int frameNum) signalPending = signal_pending(current); if (!CAMERA_IS_OPERATIONAL(uvd)) { if (uvd->debug >= 2) - info("%s: Camera is not operational (2)", __func__); + dev_info(&uvd->dev->dev, + "%s: Camera is not " + "operational (2)\n", __func__); return -EIO; } assert(uvd->fbuf != NULL); if (signalPending) { if (uvd->debug >= 2) - info("%s: Signal=$%08x", __func__, signalPending); + dev_info(&uvd->dev->dev, + "%s: Signal=$%08x\n", __func__, + signalPending); if (uvd->flags & FLAGS_RETRY_VIDIOCSYNC) { usbvideo_TestPattern(uvd, 1, 0); uvd->curframe = -1; uvd->stats.frame_num++; if (uvd->debug >= 2) - info("%s: Forced test pattern screen", __func__); + dev_info(&uvd->dev->dev, + "%s: Forced test " + "pattern screen\n", + __func__); return 0; } else { /* Standard answer: Interrupted! */ if (uvd->debug >= 2) - info("%s: Interrupted!", __func__); + dev_info(&uvd->dev->dev, + "%s: Interrupted!\n", + __func__); return -EINTR; } } else { @@ -2015,8 +2062,10 @@ static int usbvideo_GetFrame(struct uvd *uvd, int frameNum) } } while (frame->frameState == FrameState_Grabbing); if (uvd->debug >= 2) { - info("%s: Grabbing done; state=%d. (%lu. bytes)", - __func__, frame->frameState, frame->seqRead_Length); + dev_info(&uvd->dev->dev, + "%s: Grabbing done; state=%d. (%lu. bytes)\n", + __func__, frame->frameState, + frame->seqRead_Length); } if (frame->frameState == FrameState_Error) { int ret = usbvideo_NewFrame(uvd, frameNum); @@ -2053,7 +2102,9 @@ static int usbvideo_GetFrame(struct uvd *uvd, int frameNum) } frame->frameState = FrameState_Done_Hold; if (uvd->debug >= 2) - info("%s: Entered FrameState_Done_Hold state.", __func__); + dev_info(&uvd->dev->dev, + "%s: Entered FrameState_Done_Hold state.\n", + __func__); return 0; case FrameState_Done_Hold: @@ -2064,7 +2115,9 @@ static int usbvideo_GetFrame(struct uvd *uvd, int frameNum) * it will be released back into the wild to roam freely. */ if (uvd->debug >= 2) - info("%s: FrameState_Done_Hold state.", __func__); + dev_info(&uvd->dev->dev, + "%s: FrameState_Done_Hold state.\n", + __func__); return 0; } diff --git a/linux/drivers/media/video/usbvision/usbvision-core.c b/linux/drivers/media/video/usbvision/usbvision-core.c index 8c2b53513..d66cce1a5 100644 --- a/linux/drivers/media/video/usbvision/usbvision-core.c +++ b/linux/drivers/media/video/usbvision/usbvision-core.c @@ -84,7 +84,8 @@ MODULE_PARM_DESC(adjust_Y_Offset, "adjust Y offset display [core]"); #ifdef USBVISION_DEBUG #define PDEBUG(level, fmt, args...) { \ if (core_debug & (level)) \ - info("[%s:%d] " fmt, __func__, __LINE__ , ## args); \ + printk(KERN_INFO KBUILD_MODNAME ":[%s:%d] " fmt, \ + __func__, __LINE__ , ## args); \ } #else #define PDEBUG(level, fmt, args...) do {} while(0) diff --git a/linux/drivers/media/video/usbvision/usbvision-i2c.c b/linux/drivers/media/video/usbvision/usbvision-i2c.c index 9d2f6b985..d98eb913e 100644 --- a/linux/drivers/media/video/usbvision/usbvision-i2c.c +++ b/linux/drivers/media/video/usbvision/usbvision-i2c.c @@ -48,7 +48,8 @@ MODULE_PARM_DESC(i2c_debug, "enable debug messages [i2c]"); #define PDEBUG(level, fmt, args...) { \ if (i2c_debug & (level)) \ - info("[%s:%d] " fmt, __func__, __LINE__ , ## args); \ + printk(KERN_INFO KBUILD_MODNAME ":[%s:%d] " fmt, \ + __func__, __LINE__ , ## args); \ } static int usbvision_i2c_write(struct usb_usbvision *usbvision, unsigned char addr, char *buf, diff --git a/linux/drivers/media/video/usbvision/usbvision-video.c b/linux/drivers/media/video/usbvision/usbvision-video.c index 782ee6436..e10b256ae 100644 --- a/linux/drivers/media/video/usbvision/usbvision-video.c +++ b/linux/drivers/media/video/usbvision/usbvision-video.c @@ -98,7 +98,8 @@ USBVISION_DRIVER_VERSION_PATCHLEVEL) #ifdef USBVISION_DEBUG #define PDEBUG(level, fmt, args...) { \ if (video_debug & (level)) \ - info("[%s:%d] " fmt, __func__, __LINE__ , ## args); \ + printk(KERN_INFO KBUILD_MODNAME ":[%s:%d] " fmt, \ + __func__, __LINE__ , ## args); \ } #else #define PDEBUG(level, fmt, args...) do {} while(0) diff --git a/linux/drivers/media/video/zr364xx.c b/linux/drivers/media/video/zr364xx.c index a2a632534..b0da282a5 100644 --- a/linux/drivers/media/video/zr364xx.c +++ b/linux/drivers/media/video/zr364xx.c @@ -53,7 +53,7 @@ /* Debug macro */ -#define DBG(x...) if (debug) info(x) +#define DBG(x...) if (debug) printk(KERN_INFO KBUILD_MODNAME x) /* Init methods, need to find nicer names for these @@ -129,7 +129,7 @@ static int send_control_msg(struct usb_device *udev, u8 request, u16 value, unsigned char *transfer_buffer = kmalloc(size, GFP_KERNEL); if (!transfer_buffer) { - info("kmalloc(%d) failed", size); + dev_err(&udev->dev, "kmalloc(%d) failed\n", size); return -ENOMEM; } @@ -145,7 +145,8 @@ static int send_control_msg(struct usb_device *udev, u8 request, u16 value, kfree(transfer_buffer); if (status < 0) - info("Failed sending control message, error %d.", status); + dev_err(&udev->dev, + "Failed sending control message, error %d.\n", status); return status; } @@ -305,11 +306,11 @@ static int read_frame(struct zr364xx_camera *cam, int framenum) DBG("buffer : %d %d", cam->buffer[0], cam->buffer[1]); DBG("bulk : n=%d size=%d", n, actual_length); if (n < 0) { - info("error reading bulk msg"); + dev_err(&cam->udev->dev, "error reading bulk msg\n"); return 0; } if (actual_length < 0 || actual_length > BUFFER_SIZE) { - info("wrong number of bytes"); + dev_err(&cam->udev->dev, "wrong number of bytes\n"); return 0; } @@ -653,7 +654,7 @@ static int zr364xx_open(struct inode *inode, struct file *file) if (!cam->framebuf) { cam->framebuf = vmalloc_32(MAX_FRAME_SIZE * FRAMES); if (!cam->framebuf) { - info("vmalloc_32 failed!"); + dev_err(&cam->udev->dev, "vmalloc_32 failed!\n"); err = -ENOMEM; goto out; } @@ -665,7 +666,8 @@ static int zr364xx_open(struct inode *inode, struct file *file) 0, init[cam->method][i].bytes, init[cam->method][i].size); if (err < 0) { - info("error during open sequence: %d", i); + dev_err(&cam->udev->dev, + "error during open sequence: %d\n", i); goto out; } } @@ -713,7 +715,7 @@ static int zr364xx_release(struct inode *inode, struct file *file) 0, init[i][cam->method].bytes, init[cam->method][i].size); if (err < 0) { - info("error during release sequence"); + dev_err(&udev->dev, "error during release sequence\n"); goto out; } } @@ -809,13 +811,14 @@ static int zr364xx_probe(struct usb_interface *intf, DBG("probing..."); - info(DRIVER_DESC " compatible webcam plugged"); - info("model %04x:%04x detected", udev->descriptor.idVendor, - udev->descriptor.idProduct); + dev_info(&intf->dev, DRIVER_DESC " compatible webcam plugged\n"); + dev_info(&intf->dev, "model %04x:%04x detected\n", + le16_to_cpu(udev->descriptor.idVendor), + le16_to_cpu(udev->descriptor.idProduct)); cam = kzalloc(sizeof(struct zr364xx_camera), GFP_KERNEL); if (cam == NULL) { - info("cam: out of memory !"); + dev_err(&udev->dev, "cam: out of memory !\n"); return -ENOMEM; } /* save the init method used by this camera */ @@ -823,7 +826,7 @@ static int zr364xx_probe(struct usb_interface *intf, cam->vdev = video_device_alloc(); if (cam->vdev == NULL) { - info("cam->vdev: out of memory !"); + dev_err(&udev->dev, "cam->vdev: out of memory !\n"); kfree(cam); return -ENOMEM; } @@ -835,7 +838,7 @@ static int zr364xx_probe(struct usb_interface *intf, cam->udev = udev; if ((cam->buffer = kmalloc(BUFFER_SIZE, GFP_KERNEL)) == NULL) { - info("cam->buffer: out of memory !"); + dev_info(&udev->dev, "cam->buffer: out of memory !\n"); video_device_release(cam->vdev); kfree(cam); return -ENODEV; @@ -843,17 +846,17 @@ static int zr364xx_probe(struct usb_interface *intf, switch (mode) { case 1: - info("160x120 mode selected"); + dev_info(&udev->dev, "160x120 mode selected\n"); cam->width = 160; cam->height = 120; break; case 2: - info("640x480 mode selected"); + dev_info(&udev->dev, "640x480 mode selected\n"); cam->width = 640; cam->height = 480; break; default: - info("320x240 mode selected"); + dev_info(&udev->dev, "320x240 mode selected\n"); cam->width = 320; cam->height = 240; break; @@ -873,7 +876,7 @@ static int zr364xx_probe(struct usb_interface *intf, err = video_register_device(cam->vdev, VFL_TYPE_GRABBER, -1); if (err) { - info("video_register_device failed"); + dev_err(&udev->dev, "video_register_device failed\n"); video_device_release(cam->vdev); kfree(cam->buffer); kfree(cam); @@ -882,7 +885,8 @@ static int zr364xx_probe(struct usb_interface *intf, usb_set_intfdata(intf, cam); - info(DRIVER_DESC " controlling video device %d", cam->vdev->minor); + dev_info(&udev->dev, DRIVER_DESC " controlling video device %d\n", + cam->vdev->minor); return 0; } @@ -892,7 +896,7 @@ static void zr364xx_disconnect(struct usb_interface *intf) struct zr364xx_camera *cam = usb_get_intfdata(intf); usb_set_intfdata(intf, NULL); dev_set_drvdata(&intf->dev, NULL); - info(DRIVER_DESC " webcam unplugged"); + dev_info(&intf->dev, DRIVER_DESC " webcam unplugged\n"); if (cam->vdev) video_unregister_device(cam->vdev); cam->vdev = NULL; @@ -921,16 +925,16 @@ static int __init zr364xx_init(void) int retval; retval = usb_register(&zr364xx_driver); if (retval) - info("usb_register failed!"); + printk(KERN_ERR KBUILD_MODNAME ": usb_register failed!\n"); else - info(DRIVER_DESC " module loaded"); + printk(KERN_INFO KBUILD_MODNAME ": " DRIVER_DESC "\n"); return retval; } static void __exit zr364xx_exit(void) { - info(DRIVER_DESC " module unloaded"); + printk(KERN_INFO KBUILD_MODNAME ": " DRIVER_DESC " module unloaded\n"); usb_deregister(&zr364xx_driver); } -- cgit v1.2.3 From f41c4cd9c72ad4735d27445c0b0dbe1a3cb25cfc Mon Sep 17 00:00:00 2001 From: Mauro Carvalho Chehab Date: Fri, 10 Oct 2008 21:16:12 -0700 Subject: security: avoid calling a NULL function pointer in drivers/video/tvaudio.c From: Arjan van de Ven NULL function pointers are very bad security wise. This one got caught by kerneloops.org quite a few times, so it's happening in the field.... Fix is simple, check the function pointer for NULL, like 6 other places in the same function are already doing. Signed-off-by: Arjan van de Ven Signed-off-by: Mauro Carvalho Chehab --- linux/drivers/media/video/tvaudio.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'linux/drivers') diff --git a/linux/drivers/media/video/tvaudio.c b/linux/drivers/media/video/tvaudio.c index 53ece95db..7e670f2bc 100644 --- a/linux/drivers/media/video/tvaudio.c +++ b/linux/drivers/media/video/tvaudio.c @@ -1804,7 +1804,7 @@ static int chip_command(struct i2c_client *client, break; case VIDIOC_S_FREQUENCY: chip->mode = 0; /* automatic */ - if (desc->checkmode) { + if (desc->checkmode && desc->setmode) { desc->setmode(chip,V4L2_TUNER_MODE_MONO); if (chip->prevmode != V4L2_TUNER_MODE_MONO) chip->prevmode = -1; /* reset previous mode */ -- cgit v1.2.3