21 #define pr_fmt(fmt) KBUILD_MODNAME ": " fmt
23 #define MODULE_NAME "spca508"
36 #define CreativeVista 0
37 #define HamaUSBSightcam 1
38 #define HamaUSBSightcam2 2
39 #define IntelEasyPCCamera 3
40 #define MicroInnovationIC200 4
41 #define ViewQuestVQ110 5
47 .sizeimage = 160 * 120 * 3 / 2,
52 .sizeimage = 176 * 144 * 3 / 2,
57 .sizeimage = 320 * 240 * 3 / 2,
62 .sizeimage = 352 * 288 * 3 / 2,
68 #define SPCA508_OFFSET_DATA 37
74 static const u16 spca508_init_data[][2] = {
486 static const u16 spca508cs110_init_data[][2] = {
570 static const u16 spca508_sightcam_init_data[][2] = {
653 static const u16 spca508_sightcam2_init_data[][2] = {
1000 static const u16 spca508_vista_init_data[][2] = {
1250 usb_sndctrlpipe(dev, 0),
1253 value, index,
NULL, 0, 500);
1254 PDEBUG(D_USBO,
"reg write i:0x%04x = 0x%02x",
1257 pr_err(
"reg write: error %d\n", ret);
1269 usb_rcvctrlpipe(gspca_dev->
dev, 0),
1276 PDEBUG(D_USBI,
"reg read i:%04x --> %02x",
1277 index, gspca_dev->
usb_buf[0]);
1279 pr_err(
"reg_read err %d\n", ret);
1286 static int ssi_w(
struct gspca_dev *gspca_dev,
1289 struct usb_device *dev = gspca_dev->
dev;
1295 ret =
reg_write(dev, 0x8801, reg & 0x00ff);
1298 if ((reg & 0xff00) == 0x1000) {
1299 ret =
reg_write(dev, 0x8805, val & 0x00ff);
1314 if (gspca_dev->
usb_buf[0] == 0)
1329 static int write_vector(
struct gspca_dev *gspca_dev,
1332 struct usb_device *dev = gspca_dev->
dev;
1335 while ((*
data)[1] != 0) {
1336 if ((*
data)[1] & 0x8000) {
1337 if ((*
data)[1] == 0xdd00)
1342 ret = ssi_w(gspca_dev, (*
data)[1], (*
data)[0]);
1352 static int sd_config(
struct gspca_dev *gspca_dev,
1355 struct sd *
sd = (
struct sd *) gspca_dev;
1357 const u16 (*init_data)[2];
1358 static const u16 (*(init_data_tb[]))[2] = {
1359 spca508_vista_init_data,
1360 spca508_sightcam_init_data,
1361 spca508_sightcam2_init_data,
1362 spca508cs110_init_data,
1363 spca508cs110_init_data,
1374 data1 =
reg_read(gspca_dev, 0x8104);
1375 data2 =
reg_read(gspca_dev, 0x8105);
1376 PDEBUG(D_PROBE,
"Webcam Vendor ID: 0x%02x%02x", data2, data1);
1378 data1 =
reg_read(gspca_dev, 0x8106);
1379 data2 =
reg_read(gspca_dev, 0x8107);
1380 PDEBUG(D_PROBE,
"Webcam Product ID: 0x%02x%02x", data2, data1);
1382 data1 =
reg_read(gspca_dev, 0x8621);
1383 PDEBUG(D_PROBE,
"Window 1 average luminance: %d", data1);
1386 cam = &gspca_dev->
cam;
1390 sd->
subtype =
id->driver_info;
1392 init_data = init_data_tb[sd->
subtype];
1393 return write_vector(gspca_dev, init_data);
1397 static int sd_init(
struct gspca_dev *gspca_dev)
1402 static int sd_start(
struct gspca_dev *gspca_dev)
1406 mode = gspca_dev->
cam.cam_mode[gspca_dev->
curr_mode].priv;
1423 static void sd_stopN(
struct gspca_dev *gspca_dev)
1429 static void sd_pkt_scan(
struct gspca_dev *gspca_dev,
1450 static void setbrightness(
struct gspca_dev *gspca_dev,
s32 brightness)
1461 struct gspca_dev *gspca_dev =
1471 setbrightness(gspca_dev, ctrl->
val);
1478 .s_ctrl = sd_s_ctrl,
1481 static int sd_init_controls(
struct gspca_dev *gspca_dev)
1485 gspca_dev->
vdev.ctrl_handler = hdl;
1491 pr_err(
"Could not initialize controls\n");
1500 .config = sd_config,
1502 .init_controls = sd_init_controls,
1505 .pkt_scan = sd_pkt_scan,
1528 static struct usb_driver sd_driver = {
1530 .id_table = device_table,
1534 .suspend = gspca_suspend,
1535 .resume = gspca_resume,
1536 .reset_resume = gspca_resume,