Skip to content

Commit

Permalink
---
Browse files Browse the repository at this point in the history
yaml
---
r: 115674
b: refs/heads/master
c: 17ea88a
h: refs/heads/master
v: v3
  • Loading branch information
Erik Andren authored and Mauro Carvalho Chehab committed Oct 17, 2008
1 parent 88fac65 commit 089859f
Show file tree
Hide file tree
Showing 8 changed files with 67 additions and 99 deletions.
2 changes: 1 addition & 1 deletion [refs]
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
---
refs/heads/master: 0c505e688bb22c1b4431b4c07cd1fcff22fe37a2
refs/heads/master: 17ea88ae956279b20e7be8e2906212fbdde24f3d
27 changes: 0 additions & 27 deletions trunk/drivers/media/video/gspca/m5602/m5602_bridge.h
Original file line number Diff line number Diff line change
Expand Up @@ -25,33 +25,6 @@

/*****************************************************************************/

#undef PDEBUG
#undef info
#undef err

#define err(format, arg...) printk(KERN_ERR KBUILD_MODNAME ": " \
format "\n" , ## arg)
#define info(format, arg...) printk(KERN_INFO KBUILD_MODNAME ": " \
format "\n" , ## arg)

/* Debug parameters */
#define DBG_INIT 0x1
#define DBG_PROBE 0x2
#define DBG_V4L2 0x4
#define DBG_TRACE 0x8
#define DBG_DATA 0x10
#define DBG_V4L2_CID 0x20
#define DBG_GSPCA 0x40

#define PDEBUG(level, fmt, args...) \
do { \
if (m5602_debug & level) \
info("[%s:%d] " fmt, __func__, __LINE__ , \
## args); \
} while (0)

/*****************************************************************************/

#define M5602_XB_SENSOR_TYPE 0x00
#define M5602_XB_SENSOR_CTRL 0x01
#define M5602_XB_LINE_OF_FRAME_H 0x02
Expand Down
34 changes: 14 additions & 20 deletions trunk/drivers/media/video/gspca/m5602/m5602_core.c
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
/*
/*
* USB Driver for ALi m5602 based webcams
*
* Copyright (C) 2008 Erik Andrén
Expand Down Expand Up @@ -26,7 +26,6 @@
int force_sensor;
int dump_bridge;
int dump_sensor;
unsigned int m5602_debug;

static const __devinitdata struct usb_device_id m5602_table[] = {
{USB_DEVICE(0x0402, 0x5602)},
Expand All @@ -48,7 +47,7 @@ int m5602_read_bridge(struct sd *sd, u8 address, u8 *i2c_data)
1, M5602_URB_MSG_TIMEOUT);
*i2c_data = buf[0];

PDEBUG(DBG_TRACE, "Reading bridge register 0x%x containing 0x%x",
PDEBUG(D_CONF, "Reading bridge register 0x%x containing 0x%x",
address, *i2c_data);

/* usb_control_msg(...) returns the number of bytes sent upon success,
Expand All @@ -63,7 +62,7 @@ int m5602_write_bridge(struct sd *sd, u8 address, u8 i2c_data)
struct usb_device *udev = sd->gspca_dev.dev;
__u8 *buf = sd->gspca_dev.usb_buf;

PDEBUG(DBG_TRACE, "Writing bridge register 0x%x with 0x%x",
PDEBUG(D_CONF, "Writing bridge register 0x%x with 0x%x",
address, i2c_data);

memcpy(buf, bridge_urb_skeleton,
Expand Down Expand Up @@ -91,7 +90,8 @@ static void m5602_dump_bridge(struct sd *sd)
m5602_read_bridge(sd, i, &val);
info("ALi m5602 address 0x%x contains 0x%x", i, val);
}
info("Warning: The camera probably won't work until it's power cycled");
info("Warning: The ALi m5602 webcam probably won't work "
"until it's power cycled");
}

static int m5602_probe_sensor(struct sd *sd)
Expand Down Expand Up @@ -135,7 +135,7 @@ static int m5602_init(struct gspca_dev *gspca_dev)
struct sd *sd = (struct sd *) gspca_dev;
int err;

PDEBUG(DBG_TRACE, "Initializing ALi m5602 webcam");
PDEBUG(D_CONF, "Initializing ALi m5602 webcam");
/* Run the init sequence */
err = sd->sensor->init(sd);

Expand All @@ -156,7 +156,7 @@ static int m5602_start_transfer(struct gspca_dev *gspca_dev)
0x04, 0x40, 0x19, 0x0000, buf,
4, M5602_URB_MSG_TIMEOUT);

PDEBUG(DBG_V4L2, "Transfer started");
PDEBUG(D_STREAM, "Transfer started");
return (err < 0) ? err : 0;
}

Expand All @@ -167,14 +167,14 @@ static void m5602_urb_complete(struct gspca_dev *gspca_dev,
struct sd *sd = (struct sd *) gspca_dev;

if (len < 6) {
PDEBUG(DBG_DATA, "Packet is less than 6 bytes");
PDEBUG(D_PACK, "Packet is less than 6 bytes");
return;
}

/* Frame delimiter: ff xx xx xx ff ff */
if (data[0] == 0xff && data[4] == 0xff && data[5] == 0xff &&
data[2] != sd->frame_id) {
PDEBUG(DBG_DATA, "Frame delimiter detected");
PDEBUG(D_FRAM, "Frame delimiter detected");
sd->frame_id = data[2];

/* Remove the extra fluff appended on each header */
Expand All @@ -189,7 +189,7 @@ static void m5602_urb_complete(struct gspca_dev *gspca_dev,
/* Create a new frame */
gspca_frame_add(gspca_dev, FIRST_PACKET, frame, data, len);

PDEBUG(DBG_V4L2, "Starting new frame %d",
PDEBUG(D_FRAM, "Starting new frame %d",
sd->frame_count);

} else {
Expand All @@ -200,7 +200,7 @@ static void m5602_urb_complete(struct gspca_dev *gspca_dev,
len -= 4;

if (cur_frame_len + len <= frame->v4l2_buf.length) {
PDEBUG(DBG_DATA, "Continuing frame %d copying %d bytes",
PDEBUG(D_FRAM, "Continuing frame %d copying %d bytes",
sd->frame_count, len);

gspca_frame_add(gspca_dev, INTER_PACKET, frame,
Expand Down Expand Up @@ -236,8 +236,6 @@ static int m5602_configure(struct gspca_dev *gspca_dev,
struct cam *cam;
int err;

PDEBUG(DBG_GSPCA, "m5602_configure start");

cam = &gspca_dev->cam;
cam->epaddr = M5602_ISOC_ENDPOINT_ADDR;
sd->desc = &sd_desc;
Expand All @@ -250,11 +248,10 @@ static int m5602_configure(struct gspca_dev *gspca_dev,
if (err)
goto fail;

PDEBUG(DBG_GSPCA, "m5602_configure end");
return 0;

fail:
PDEBUG(DBG_GSPCA, "m5602_configure failed");
PDEBUG(D_ERR, "ALi m5602 webcam failed");
cam->cam_mode = NULL;
cam->nmodes = 0;

Expand Down Expand Up @@ -284,13 +281,13 @@ static int __init mod_m5602_init(void)
{
if (usb_register(&sd_driver) < 0)
return -1;
PDEBUG(D_PROBE, "m5602 module registered");
PDEBUG(D_PROBE, "registered");
return 0;
}
static void __exit mod_m5602_exit(void)
{
usb_deregister(&sd_driver);
PDEBUG(D_PROBE, "m5602 module deregistered");
PDEBUG(D_PROBE, "deregistered");
}

module_init(mod_m5602_init);
Expand All @@ -299,9 +296,6 @@ module_exit(mod_m5602_exit);
MODULE_AUTHOR(DRIVER_AUTHOR);
MODULE_DESCRIPTION(DRIVER_DESC);
MODULE_LICENSE("GPL");
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);
MODULE_PARM_DESC(force_sensor,
"force detection of sensor, "
Expand Down
16 changes: 8 additions & 8 deletions trunk/drivers/media/video/gspca/m5602/m5602_mt9m111.c
Original file line number Diff line number Diff line change
Expand Up @@ -107,7 +107,7 @@ int mt9m111_get_vflip(struct gspca_dev *gspca_dev, __s32 *val)
err = mt9m111_read_sensor(sd, MT9M111_SC_R_MODE_CONTEXT_B,
data, 2);
*val = data[0] & MT9M111_RMB_MIRROR_ROWS;
PDEBUG(DBG_V4L2_CID, "Read vertical flip %d", *val);
PDEBUG(D_V4L2, "Read vertical flip %d", *val);

return (err < 0) ? err : 0;
}
Expand All @@ -118,7 +118,7 @@ int mt9m111_set_vflip(struct gspca_dev *gspca_dev, __s32 val)
u8 data[2] = {0x00, 0x00};
struct sd *sd = (struct sd *) gspca_dev;

PDEBUG(DBG_V4L2_CID, "Set vertical flip to %d", val);
PDEBUG(D_V4L2, "Set vertical flip to %d", val);

/* Set the correct page map */
err = mt9m111_write_sensor(sd, MT9M111_PAGE_MAP, data, 2);
Expand All @@ -145,7 +145,7 @@ int mt9m111_get_hflip(struct gspca_dev *gspca_dev, __s32 *val)
err = mt9m111_read_sensor(sd, MT9M111_SC_R_MODE_CONTEXT_B,
data, 2);
*val = data[0] & MT9M111_RMB_MIRROR_COLS;
PDEBUG(DBG_V4L2_CID, "Read horizontal flip %d", *val);
PDEBUG(D_V4L2, "Read horizontal flip %d", *val);

return (err < 0) ? err : 0;
}
Expand All @@ -156,7 +156,7 @@ int mt9m111_set_hflip(struct gspca_dev *gspca_dev, __s32 val)
u8 data[2] = {0x00, 0x00};
struct sd *sd = (struct sd *) gspca_dev;

PDEBUG(DBG_V4L2_CID, "Set horizontal flip to %d", val);
PDEBUG(D_V4L2, "Set horizontal flip to %d", val);

/* Set the correct page map */
err = mt9m111_write_sensor(sd, MT9M111_PAGE_MAP, data, 2);
Expand Down Expand Up @@ -188,7 +188,7 @@ int mt9m111_get_gain(struct gspca_dev *gspca_dev, __s32 *val)
((tmp & (1 << 8)) * 2) |
(tmp & 0x7f);

PDEBUG(DBG_V4L2_CID, "Read gain %d", *val);
PDEBUG(D_V4L2, "Read gain %d", *val);

return (err < 0) ? err : 0;
}
Expand Down Expand Up @@ -222,7 +222,7 @@ int mt9m111_set_gain(struct gspca_dev *gspca_dev, __s32 val)

data[1] = (tmp & 0xff00) >> 8;
data[0] = (tmp & 0xff);
PDEBUG(DBG_V4L2_CID, "tmp=%d, data[1]=%d, data[0]=%d", tmp,
PDEBUG(D_V4L2, "tmp=%d, data[1]=%d, data[0]=%d", tmp,
data[1], data[0]);

err = mt9m111_write_sensor(sd, MT9M111_SC_GLOBAL_GAIN,
Expand Down Expand Up @@ -257,7 +257,7 @@ int mt9m111_read_sensor(struct sd *sd, const u8 address,
for (i = 0; i < len && !err; i++) {
err = m5602_read_bridge(sd, M5602_XB_I2C_DATA, &(i2c_data[i]));

PDEBUG(DBG_TRACE, "Reading sensor register "
PDEBUG(D_CONF, "Reading sensor register "
"0x%x contains 0x%x ", address, *i2c_data);
}
out:
Expand Down Expand Up @@ -290,7 +290,7 @@ int mt9m111_write_sensor(struct sd *sd, const u8 address,
memcpy(p, sensor_urb_skeleton + 16, 4);
p[3] = i2c_data[i];
p += 4;
PDEBUG(DBG_TRACE, "Writing sensor register 0x%x with 0x%x",
PDEBUG(D_CONF, "Writing sensor register 0x%x with 0x%x",
address, i2c_data[i]);
}

Expand Down
Loading

0 comments on commit 089859f

Please sign in to comment.