spca1528.c (52173c5f3f6476eb9100691ec47b10d6740eed4a) spca1528.c (37d5efb01910752d8d3846a2c4db0528c1dfa137)
1/*
2 * spca1528 subdriver
3 *
4 * Copyright (C) 2010-2011 Jean-Francois Moine (http://moinejf.free.fr)
5 *
6 * This program is free software; you can redistribute it and/or modify
7 * it under the terms of the GNU General Public License as published by
8 * the Free Software Foundation; either version 2 of the License, or

--- 61 unchanged lines hidden (view full) ---

70 return;
71 ret = usb_control_msg(dev, usb_rcvctrlpipe(dev, 0),
72 req,
73 USB_DIR_IN | USB_TYPE_VENDOR | USB_RECIP_DEVICE,
74 0x0000, /* value */
75 index,
76 gspca_dev->usb_buf, len,
77 500);
1/*
2 * spca1528 subdriver
3 *
4 * Copyright (C) 2010-2011 Jean-Francois Moine (http://moinejf.free.fr)
5 *
6 * This program is free software; you can redistribute it and/or modify
7 * it under the terms of the GNU General Public License as published by
8 * the Free Software Foundation; either version 2 of the License, or

--- 61 unchanged lines hidden (view full) ---

70 return;
71 ret = usb_control_msg(dev, usb_rcvctrlpipe(dev, 0),
72 req,
73 USB_DIR_IN | USB_TYPE_VENDOR | USB_RECIP_DEVICE,
74 0x0000, /* value */
75 index,
76 gspca_dev->usb_buf, len,
77 500);
78 PDEBUG(D_USBI, "GET %02x 0000 %04x %02x", req, index,
79 gspca_dev->usb_buf[0]);
78 gspca_dbg(gspca_dev, D_USBI, "GET %02x 0000 %04x %02x\n", req, index,
79 gspca_dev->usb_buf[0]);
80 if (ret < 0) {
81 pr_err("reg_r err %d\n", ret);
82 gspca_dev->usb_err = ret;
83 }
84}
85
86static void reg_w(struct gspca_dev *gspca_dev,
87 u8 req,
88 u16 value,
89 u16 index)
90{
91 struct usb_device *dev = gspca_dev->dev;
92 int ret;
93
94 if (gspca_dev->usb_err < 0)
95 return;
80 if (ret < 0) {
81 pr_err("reg_r err %d\n", ret);
82 gspca_dev->usb_err = ret;
83 }
84}
85
86static void reg_w(struct gspca_dev *gspca_dev,
87 u8 req,
88 u16 value,
89 u16 index)
90{
91 struct usb_device *dev = gspca_dev->dev;
92 int ret;
93
94 if (gspca_dev->usb_err < 0)
95 return;
96 PDEBUG(D_USBO, "SET %02x %04x %04x", req, value, index);
96 gspca_dbg(gspca_dev, D_USBO, "SET %02x %04x %04x\n", req, value, index);
97 ret = usb_control_msg(dev, usb_sndctrlpipe(dev, 0),
98 req,
99 USB_DIR_OUT | USB_TYPE_VENDOR | USB_RECIP_DEVICE,
100 value, index,
101 NULL, 0, 500);
102 if (ret < 0) {
103 pr_err("reg_w err %d\n", ret);
104 gspca_dev->usb_err = ret;

--- 6 unchanged lines hidden (view full) ---

111 u16 index,
112 u8 byte)
113{
114 struct usb_device *dev = gspca_dev->dev;
115 int ret;
116
117 if (gspca_dev->usb_err < 0)
118 return;
97 ret = usb_control_msg(dev, usb_sndctrlpipe(dev, 0),
98 req,
99 USB_DIR_OUT | USB_TYPE_VENDOR | USB_RECIP_DEVICE,
100 value, index,
101 NULL, 0, 500);
102 if (ret < 0) {
103 pr_err("reg_w err %d\n", ret);
104 gspca_dev->usb_err = ret;

--- 6 unchanged lines hidden (view full) ---

111 u16 index,
112 u8 byte)
113{
114 struct usb_device *dev = gspca_dev->dev;
115 int ret;
116
117 if (gspca_dev->usb_err < 0)
118 return;
119 PDEBUG(D_USBO, "SET %02x %04x %04x %02x", req, value, index, byte);
119 gspca_dbg(gspca_dev, D_USBO, "SET %02x %04x %04x %02x\n",
120 req, value, index, byte);
120 gspca_dev->usb_buf[0] = byte;
121 ret = usb_control_msg(dev, usb_sndctrlpipe(dev, 0),
122 req,
123 USB_DIR_OUT | USB_TYPE_VENDOR | USB_RECIP_DEVICE,
124 value, index,
125 gspca_dev->usb_buf, 1, 500);
126 if (ret < 0) {
127 pr_err("reg_w err %d\n", ret);

--- 83 unchanged lines hidden (view full) ---

211 msleep(8);
212 reg_w(gspca_dev, 0x00, 0x00c0, 0x206b);
213 reg_w(gspca_dev, 0x00, 0x0000, 0x206c);
214 reg_w(gspca_dev, 0x00, 0x0001, 0x2069);
215
216 reg_r(gspca_dev, 0x20, 0x0000, 1);
217 reg_r(gspca_dev, 0x20, 0x0000, 5);
218 reg_r(gspca_dev, 0x23, 0x0000, 64);
121 gspca_dev->usb_buf[0] = byte;
122 ret = usb_control_msg(dev, usb_sndctrlpipe(dev, 0),
123 req,
124 USB_DIR_OUT | USB_TYPE_VENDOR | USB_RECIP_DEVICE,
125 value, index,
126 gspca_dev->usb_buf, 1, 500);
127 if (ret < 0) {
128 pr_err("reg_w err %d\n", ret);

--- 83 unchanged lines hidden (view full) ---

212 msleep(8);
213 reg_w(gspca_dev, 0x00, 0x00c0, 0x206b);
214 reg_w(gspca_dev, 0x00, 0x0000, 0x206c);
215 reg_w(gspca_dev, 0x00, 0x0001, 0x2069);
216
217 reg_r(gspca_dev, 0x20, 0x0000, 1);
218 reg_r(gspca_dev, 0x20, 0x0000, 5);
219 reg_r(gspca_dev, 0x23, 0x0000, 64);
219 PDEBUG(D_PROBE, "%s%s", &gspca_dev->usb_buf[0x1c],
220 &gspca_dev->usb_buf[0x30]);
220 gspca_dbg(gspca_dev, D_PROBE, "%s%s\n", &gspca_dev->usb_buf[0x1c],
221 &gspca_dev->usb_buf[0x30]);
221 reg_r(gspca_dev, 0x23, 0x0001, 64);
222 return gspca_dev->usb_err;
223}
224
225/* function called at start time before URB creation */
226static int sd_isoc_init(struct gspca_dev *gspca_dev)
227{
228 u8 mode;

--- 213 unchanged lines hidden ---
222 reg_r(gspca_dev, 0x23, 0x0001, 64);
223 return gspca_dev->usb_err;
224}
225
226/* function called at start time before URB creation */
227static int sd_isoc_init(struct gspca_dev *gspca_dev)
228{
229 u8 mode;

--- 213 unchanged lines hidden ---