22 #define pr_fmt(fmt) KBUILD_MODNAME ": " fmt
24 #define MODULE_NAME "mars"
59 .sizeimage = 320 * 240 * 3 / 8 + 590,
64 .sizeimage = 640 * 480 * 3 / 8 + 590,
69 static const __u8 mi_data[0x20] = {
71 0x48, 0x22, 0x01, 0x47, 0x10, 0x00, 0x00, 0x00,
73 0x00, 0x01, 0x30, 0x01, 0x30, 0x01, 0x30, 0x01,
75 0x30, 0x00, 0x04, 0x00, 0x06, 0x01, 0xe2, 0x02,
77 0x82, 0x00, 0x20, 0x17, 0x80, 0x08, 0x0c, 0x00
90 usb_sndbulkpipe(gspca_dev->
dev, 4),
96 pr_err(
"reg write [%02x] error %d\n",
102 static void mi_w(
struct gspca_dev *gspca_dev,
114 static void setbrightness(
struct gspca_dev *gspca_dev,
s32 val)
121 static void setcolors(
struct gspca_dev *gspca_dev,
s32 val)
124 gspca_dev->
usb_buf[1] = val << 3;
125 gspca_dev->
usb_buf[2] = ((val >> 2) & 0xf8) | 0x04;
129 static void setgamma(
struct gspca_dev *gspca_dev,
s32 val)
132 gspca_dev->
usb_buf[1] = val * 0x40;
136 static void setsharpness(
struct gspca_dev *gspca_dev,
s32 val)
139 gspca_dev->
usb_buf[1] = val * 4 + 3;
143 static void setilluminators(
struct gspca_dev *gspca_dev,
bool top,
bool bottom)
158 struct gspca_dev *gspca_dev =
160 struct sd *
sd = (
struct sd *)gspca_dev;
177 setbrightness(gspca_dev, ctrl->
val);
180 setcolors(gspca_dev, ctrl->
val);
183 setgamma(gspca_dev, ctrl->
val);
186 setilluminators(gspca_dev, sd->
illum_top->val,
190 setsharpness(gspca_dev, ctrl->
val);
199 .s_ctrl = mars_s_ctrl,
203 static int sd_init_controls(
struct gspca_dev *gspca_dev)
205 struct sd *sd = (
struct sd *) gspca_dev;
208 gspca_dev->
vdev.ctrl_handler = hdl;
225 pr_err(
"Could not initialize controls\n");
233 static int sd_config(
struct gspca_dev *gspca_dev,
238 cam = &gspca_dev->
cam;
245 static int sd_init(
struct gspca_dev *gspca_dev)
250 static int sd_start(
struct gspca_dev *gspca_dev)
252 struct sd *sd = (
struct sd *) gspca_dev;
271 data[1] = 0x0c | 0x01;
273 data[3] = gspca_dev->
width / 8;
274 data[4] = gspca_dev->
height / 8;
287 reg_w(gspca_dev, 11);
335 for (i = 0; i <
sizeof mi_data; i++)
336 mi_w(gspca_dev, i + 1, mi_data[i]);
348 static void sd_stopN(
struct gspca_dev *gspca_dev)
350 struct sd *sd = (
struct sd *) gspca_dev;
354 setilluminators(gspca_dev,
false,
false);
363 static void sd_pkt_scan(
struct gspca_dev *gspca_dev,
367 struct sd *sd = (
struct sd *) gspca_dev;
374 for (p = 0; p < len - 6; p++) {
375 if (data[0 + p] == 0xff
376 && data[1 + p] == 0xff
377 && data[2 + p] == 0x00
378 && data[3 + p] == 0xff
379 && data[4 + p] == 0x96) {
380 if (data[5 + p] == 0x64
381 || data[5 + p] == 0x65
382 || data[5 + p] == 0x66
383 || data[5 + p] == 0x67) {
384 PDEBUG(D_PACK,
"sof offset: %d len: %d",
406 .init_controls = sd_init_controls,
409 .pkt_scan = sd_pkt_scan,
414 {USB_DEVICE(0x093a, 0x050f)},
427 static struct usb_driver sd_driver = {
429 .id_table = device_table,
433 .suspend = gspca_suspend,
434 .resume = gspca_resume,
435 .reset_resume = gspca_resume,