xref: /OK3568_Linux_fs/kernel/drivers/media/usb/gspca/dtcs033.c (revision 4882a59341e53eb6f0b4789bf948001014eff981)
1*4882a593Smuzhiyun // SPDX-License-Identifier: GPL-2.0-or-later
2*4882a593Smuzhiyun /*
3*4882a593Smuzhiyun  * Subdriver for Scopium astro-camera (DTCS033, 0547:7303)
4*4882a593Smuzhiyun  *
5*4882a593Smuzhiyun  * Copyright (C) 2014 Robert Butora (robert.butora.fi@gmail.com)
6*4882a593Smuzhiyun  */
7*4882a593Smuzhiyun 
8*4882a593Smuzhiyun #define pr_fmt(fmt) KBUILD_MODNAME ": " fmt
9*4882a593Smuzhiyun #define MODULE_NAME "dtcs033"
10*4882a593Smuzhiyun #include "gspca.h"
11*4882a593Smuzhiyun 
12*4882a593Smuzhiyun MODULE_AUTHOR("Robert Butora <robert.butora.fi@gmail.com>");
13*4882a593Smuzhiyun MODULE_DESCRIPTION("Scopium DTCS033 astro-cam USB Camera Driver");
14*4882a593Smuzhiyun MODULE_LICENSE("GPL");
15*4882a593Smuzhiyun 
16*4882a593Smuzhiyun struct dtcs033_usb_requests {
17*4882a593Smuzhiyun 	u8 bRequestType;
18*4882a593Smuzhiyun 	u8 bRequest;
19*4882a593Smuzhiyun 	u16 wValue;
20*4882a593Smuzhiyun 	u16 wIndex;
21*4882a593Smuzhiyun 	u16 wLength;
22*4882a593Smuzhiyun };
23*4882a593Smuzhiyun 
24*4882a593Smuzhiyun /* send a usb request */
reg_rw(struct gspca_dev * gspca_dev,u8 bRequestType,u8 bRequest,u16 wValue,u16 wIndex,u16 wLength)25*4882a593Smuzhiyun static void reg_rw(struct gspca_dev *gspca_dev,
26*4882a593Smuzhiyun 		u8 bRequestType, u8 bRequest,
27*4882a593Smuzhiyun 		u16 wValue, u16 wIndex, u16 wLength)
28*4882a593Smuzhiyun {
29*4882a593Smuzhiyun 	struct usb_device *udev = gspca_dev->dev;
30*4882a593Smuzhiyun 	int ret;
31*4882a593Smuzhiyun 
32*4882a593Smuzhiyun 	if (gspca_dev->usb_err < 0)
33*4882a593Smuzhiyun 		return;
34*4882a593Smuzhiyun 
35*4882a593Smuzhiyun 	ret = usb_control_msg(udev,
36*4882a593Smuzhiyun 		usb_rcvctrlpipe(udev, 0),
37*4882a593Smuzhiyun 		bRequest,
38*4882a593Smuzhiyun 		bRequestType,
39*4882a593Smuzhiyun 		wValue, wIndex,
40*4882a593Smuzhiyun 		gspca_dev->usb_buf, wLength, 500);
41*4882a593Smuzhiyun 
42*4882a593Smuzhiyun 	if (ret < 0) {
43*4882a593Smuzhiyun 		gspca_dev->usb_err = ret;
44*4882a593Smuzhiyun 		pr_err("usb_control_msg error %d\n", ret);
45*4882a593Smuzhiyun 	}
46*4882a593Smuzhiyun 
47*4882a593Smuzhiyun 	return;
48*4882a593Smuzhiyun }
49*4882a593Smuzhiyun /* send several usb in/out requests */
reg_reqs(struct gspca_dev * gspca_dev,const struct dtcs033_usb_requests * preqs,int n_reqs)50*4882a593Smuzhiyun static int reg_reqs(struct gspca_dev *gspca_dev,
51*4882a593Smuzhiyun 		    const struct dtcs033_usb_requests *preqs, int n_reqs)
52*4882a593Smuzhiyun {
53*4882a593Smuzhiyun 	int i = 0;
54*4882a593Smuzhiyun 	const struct dtcs033_usb_requests *preq;
55*4882a593Smuzhiyun 
56*4882a593Smuzhiyun 	while ((i < n_reqs) && (gspca_dev->usb_err >= 0)) {
57*4882a593Smuzhiyun 
58*4882a593Smuzhiyun 		preq = &preqs[i];
59*4882a593Smuzhiyun 
60*4882a593Smuzhiyun 		reg_rw(gspca_dev, preq->bRequestType, preq->bRequest,
61*4882a593Smuzhiyun 			preq->wValue, preq->wIndex, preq->wLength);
62*4882a593Smuzhiyun 
63*4882a593Smuzhiyun 		if (gspca_dev->usb_err < 0) {
64*4882a593Smuzhiyun 
65*4882a593Smuzhiyun 			gspca_err(gspca_dev, "usb error request no: %d / %d\n",
66*4882a593Smuzhiyun 				  i, n_reqs);
67*4882a593Smuzhiyun 		} else if (preq->bRequestType & USB_DIR_IN) {
68*4882a593Smuzhiyun 
69*4882a593Smuzhiyun 			gspca_dbg(gspca_dev, D_STREAM,
70*4882a593Smuzhiyun 				  "USB IN (%d) returned[%d] %3ph %s",
71*4882a593Smuzhiyun 				  i,
72*4882a593Smuzhiyun 				  preq->wLength,
73*4882a593Smuzhiyun 				  gspca_dev->usb_buf,
74*4882a593Smuzhiyun 				  preq->wLength > 3 ? "...\n" : "\n");
75*4882a593Smuzhiyun 		}
76*4882a593Smuzhiyun 
77*4882a593Smuzhiyun 		i++;
78*4882a593Smuzhiyun 	}
79*4882a593Smuzhiyun 	return gspca_dev->usb_err;
80*4882a593Smuzhiyun }
81*4882a593Smuzhiyun 
82*4882a593Smuzhiyun /* -- subdriver interface implementation -- */
83*4882a593Smuzhiyun 
84*4882a593Smuzhiyun #define DT_COLS (640)
85*4882a593Smuzhiyun static const struct v4l2_pix_format dtcs033_mode[] = {
86*4882a593Smuzhiyun 	/* raw Bayer patterned output */
87*4882a593Smuzhiyun 	{DT_COLS, 480, V4L2_PIX_FMT_GREY, V4L2_FIELD_NONE,
88*4882a593Smuzhiyun 		.bytesperline = DT_COLS,
89*4882a593Smuzhiyun 		.sizeimage = DT_COLS*480,
90*4882a593Smuzhiyun 		.colorspace = V4L2_COLORSPACE_SRGB,
91*4882a593Smuzhiyun 	},
92*4882a593Smuzhiyun 	/* this mode will demosaic the Bayer pattern */
93*4882a593Smuzhiyun 	{DT_COLS, 480, V4L2_PIX_FMT_SRGGB8, V4L2_FIELD_NONE,
94*4882a593Smuzhiyun 		.bytesperline = DT_COLS,
95*4882a593Smuzhiyun 		.sizeimage = DT_COLS*480,
96*4882a593Smuzhiyun 		.colorspace = V4L2_COLORSPACE_SRGB,
97*4882a593Smuzhiyun 	}
98*4882a593Smuzhiyun };
99*4882a593Smuzhiyun 
100*4882a593Smuzhiyun /* config called at probe time */
sd_config(struct gspca_dev * gspca_dev,const struct usb_device_id * id)101*4882a593Smuzhiyun static int sd_config(struct gspca_dev *gspca_dev,
102*4882a593Smuzhiyun 		const struct usb_device_id *id)
103*4882a593Smuzhiyun {
104*4882a593Smuzhiyun 	gspca_dev->cam.cam_mode = dtcs033_mode;
105*4882a593Smuzhiyun 	gspca_dev->cam.nmodes = ARRAY_SIZE(dtcs033_mode);
106*4882a593Smuzhiyun 
107*4882a593Smuzhiyun 	gspca_dev->cam.bulk = 1;
108*4882a593Smuzhiyun 	gspca_dev->cam.bulk_nurbs = 1;
109*4882a593Smuzhiyun 	gspca_dev->cam.bulk_size = DT_COLS*512;
110*4882a593Smuzhiyun 
111*4882a593Smuzhiyun 	return 0;
112*4882a593Smuzhiyun }
113*4882a593Smuzhiyun 
114*4882a593Smuzhiyun /* init called at probe and resume time */
sd_init(struct gspca_dev * gspca_dev)115*4882a593Smuzhiyun static int sd_init(struct gspca_dev *gspca_dev)
116*4882a593Smuzhiyun {
117*4882a593Smuzhiyun 	return 0;
118*4882a593Smuzhiyun }
119*4882a593Smuzhiyun 
120*4882a593Smuzhiyun /* start stop the camera */
121*4882a593Smuzhiyun static int  dtcs033_start(struct gspca_dev *gspca_dev);
122*4882a593Smuzhiyun static void dtcs033_stopN(struct gspca_dev *gspca_dev);
123*4882a593Smuzhiyun 
124*4882a593Smuzhiyun /* intercept camera image data */
dtcs033_pkt_scan(struct gspca_dev * gspca_dev,u8 * data,int len)125*4882a593Smuzhiyun static void dtcs033_pkt_scan(struct gspca_dev *gspca_dev,
126*4882a593Smuzhiyun 			u8 *data,  /* packet data */
127*4882a593Smuzhiyun 			int len)   /* packet data length */
128*4882a593Smuzhiyun {
129*4882a593Smuzhiyun 	/* drop incomplete frames */
130*4882a593Smuzhiyun 	if (len != DT_COLS*512) {
131*4882a593Smuzhiyun 		gspca_dev->last_packet_type = DISCARD_PACKET;
132*4882a593Smuzhiyun 		/* gspca.c: discard invalidates the whole frame. */
133*4882a593Smuzhiyun 		return;
134*4882a593Smuzhiyun 	}
135*4882a593Smuzhiyun 
136*4882a593Smuzhiyun 	/* forward complete frames */
137*4882a593Smuzhiyun 	gspca_frame_add(gspca_dev, FIRST_PACKET, NULL, 0);
138*4882a593Smuzhiyun 	gspca_frame_add(gspca_dev, INTER_PACKET,
139*4882a593Smuzhiyun 		data + 16*DT_COLS,
140*4882a593Smuzhiyun 		len  - 32*DT_COLS); /* skip first & last 16 lines */
141*4882a593Smuzhiyun 	gspca_frame_add(gspca_dev, LAST_PACKET,  NULL, 0);
142*4882a593Smuzhiyun 
143*4882a593Smuzhiyun 	return;
144*4882a593Smuzhiyun }
145*4882a593Smuzhiyun 
146*4882a593Smuzhiyun /* -- controls: exposure and gain -- */
147*4882a593Smuzhiyun 
dtcs033_setexposure(struct gspca_dev * gspca_dev,s32 expo,s32 gain)148*4882a593Smuzhiyun static void dtcs033_setexposure(struct gspca_dev *gspca_dev,
149*4882a593Smuzhiyun 			s32 expo, s32 gain)
150*4882a593Smuzhiyun {
151*4882a593Smuzhiyun 	/* gain [dB] encoding */
152*4882a593Smuzhiyun 	u16 sGain   = (u16)gain;
153*4882a593Smuzhiyun 	u16 gainVal = 224+(sGain-14)*(768-224)/(33-14);
154*4882a593Smuzhiyun 	u16 wIndex =  0x0100|(0x00FF&gainVal);
155*4882a593Smuzhiyun 	u16 wValue = (0xFF00&gainVal)>>8;
156*4882a593Smuzhiyun 
157*4882a593Smuzhiyun 	/* exposure time [msec] encoding */
158*4882a593Smuzhiyun 	u16 sXTime   = (u16)expo;
159*4882a593Smuzhiyun 	u16 xtimeVal = (524*(150-(sXTime-1)))/150;
160*4882a593Smuzhiyun 
161*4882a593Smuzhiyun 	const u8 bRequestType =
162*4882a593Smuzhiyun 		USB_DIR_OUT | USB_TYPE_VENDOR | USB_RECIP_DEVICE;
163*4882a593Smuzhiyun 	const u8 bRequest = 0x18;
164*4882a593Smuzhiyun 
165*4882a593Smuzhiyun 	reg_rw(gspca_dev,
166*4882a593Smuzhiyun 		bRequestType, bRequest, wValue, wIndex, 0);
167*4882a593Smuzhiyun 	if (gspca_dev->usb_err < 0)
168*4882a593Smuzhiyun 		gspca_err(gspca_dev, "usb error in setexposure(gain) sequence\n");
169*4882a593Smuzhiyun 
170*4882a593Smuzhiyun 	reg_rw(gspca_dev,
171*4882a593Smuzhiyun 		bRequestType, bRequest, (xtimeVal<<4), 0x6300, 0);
172*4882a593Smuzhiyun 	if (gspca_dev->usb_err < 0)
173*4882a593Smuzhiyun 		gspca_err(gspca_dev, "usb error in setexposure(time) sequence\n");
174*4882a593Smuzhiyun }
175*4882a593Smuzhiyun 
176*4882a593Smuzhiyun /* specific webcam descriptor */
177*4882a593Smuzhiyun struct sd {
178*4882a593Smuzhiyun 	struct gspca_dev gspca_dev;/* !! must be the first item */
179*4882a593Smuzhiyun 
180*4882a593Smuzhiyun 	/* exposure & gain controls */
181*4882a593Smuzhiyun 	struct {
182*4882a593Smuzhiyun 		struct v4l2_ctrl *exposure;
183*4882a593Smuzhiyun 		struct v4l2_ctrl *gain;
184*4882a593Smuzhiyun 	};
185*4882a593Smuzhiyun };
186*4882a593Smuzhiyun 
sd_s_ctrl(struct v4l2_ctrl * ctrl)187*4882a593Smuzhiyun static int sd_s_ctrl(struct v4l2_ctrl *ctrl)
188*4882a593Smuzhiyun {
189*4882a593Smuzhiyun 	struct gspca_dev *gspca_dev =
190*4882a593Smuzhiyun 	container_of(ctrl->handler,
191*4882a593Smuzhiyun 		struct gspca_dev, ctrl_handler);
192*4882a593Smuzhiyun 	struct sd *sd = (struct sd *) gspca_dev;
193*4882a593Smuzhiyun 
194*4882a593Smuzhiyun 	gspca_dev->usb_err = 0;
195*4882a593Smuzhiyun 
196*4882a593Smuzhiyun 	if (!gspca_dev->streaming)
197*4882a593Smuzhiyun 		return 0;
198*4882a593Smuzhiyun 
199*4882a593Smuzhiyun 	switch (ctrl->id) {
200*4882a593Smuzhiyun 	case V4L2_CID_EXPOSURE:
201*4882a593Smuzhiyun 		dtcs033_setexposure(gspca_dev,
202*4882a593Smuzhiyun 				ctrl->val, sd->gain->val);
203*4882a593Smuzhiyun 		break;
204*4882a593Smuzhiyun 	case V4L2_CID_GAIN:
205*4882a593Smuzhiyun 		dtcs033_setexposure(gspca_dev,
206*4882a593Smuzhiyun 				sd->exposure->val, ctrl->val);
207*4882a593Smuzhiyun 		break;
208*4882a593Smuzhiyun 	}
209*4882a593Smuzhiyun 	return gspca_dev->usb_err;
210*4882a593Smuzhiyun }
211*4882a593Smuzhiyun 
212*4882a593Smuzhiyun static const struct v4l2_ctrl_ops sd_ctrl_ops = {
213*4882a593Smuzhiyun 	.s_ctrl = sd_s_ctrl,
214*4882a593Smuzhiyun };
215*4882a593Smuzhiyun 
dtcs033_init_controls(struct gspca_dev * gspca_dev)216*4882a593Smuzhiyun static int dtcs033_init_controls(struct gspca_dev *gspca_dev)
217*4882a593Smuzhiyun {
218*4882a593Smuzhiyun 	struct v4l2_ctrl_handler *hdl = &gspca_dev->ctrl_handler;
219*4882a593Smuzhiyun 	struct sd *sd = (struct sd *) gspca_dev;
220*4882a593Smuzhiyun 
221*4882a593Smuzhiyun 	gspca_dev->vdev.ctrl_handler = hdl;
222*4882a593Smuzhiyun 	v4l2_ctrl_handler_init(hdl, 2);
223*4882a593Smuzhiyun 	/*                               min max step default */
224*4882a593Smuzhiyun 	sd->exposure = v4l2_ctrl_new_std(hdl, &sd_ctrl_ops,
225*4882a593Smuzhiyun 				V4L2_CID_EXPOSURE,
226*4882a593Smuzhiyun 				1,  150,  1,  75);/* [msec] */
227*4882a593Smuzhiyun 	sd->gain     = v4l2_ctrl_new_std(hdl, &sd_ctrl_ops,
228*4882a593Smuzhiyun 				V4L2_CID_GAIN,
229*4882a593Smuzhiyun 				14,  33,  1,  24);/* [dB] */
230*4882a593Smuzhiyun 	if (hdl->error) {
231*4882a593Smuzhiyun 		gspca_err(gspca_dev, "Could not initialize controls: %d\n",
232*4882a593Smuzhiyun 			  hdl->error);
233*4882a593Smuzhiyun 		return hdl->error;
234*4882a593Smuzhiyun 	}
235*4882a593Smuzhiyun 
236*4882a593Smuzhiyun 	v4l2_ctrl_cluster(2, &sd->exposure);
237*4882a593Smuzhiyun 	return 0;
238*4882a593Smuzhiyun }
239*4882a593Smuzhiyun 
240*4882a593Smuzhiyun /* sub-driver description */
241*4882a593Smuzhiyun static const struct sd_desc sd_desc = {
242*4882a593Smuzhiyun 	.name     = MODULE_NAME,
243*4882a593Smuzhiyun 	.config   = sd_config,
244*4882a593Smuzhiyun 	.init     = sd_init,
245*4882a593Smuzhiyun 	.start    = dtcs033_start,
246*4882a593Smuzhiyun 	.stopN    = dtcs033_stopN,
247*4882a593Smuzhiyun 	.pkt_scan = dtcs033_pkt_scan,
248*4882a593Smuzhiyun 	.init_controls = dtcs033_init_controls,
249*4882a593Smuzhiyun };
250*4882a593Smuzhiyun 
251*4882a593Smuzhiyun /* -- module initialisation -- */
252*4882a593Smuzhiyun 
253*4882a593Smuzhiyun static const struct usb_device_id device_table[] = {
254*4882a593Smuzhiyun 	{USB_DEVICE(0x0547, 0x7303)},
255*4882a593Smuzhiyun 	{}
256*4882a593Smuzhiyun };
257*4882a593Smuzhiyun MODULE_DEVICE_TABLE(usb, device_table);
258*4882a593Smuzhiyun 
259*4882a593Smuzhiyun /* device connect */
sd_probe(struct usb_interface * intf,const struct usb_device_id * id)260*4882a593Smuzhiyun static int sd_probe(struct usb_interface *intf,
261*4882a593Smuzhiyun 			const struct usb_device_id *id)
262*4882a593Smuzhiyun {
263*4882a593Smuzhiyun 	return gspca_dev_probe(intf, id,
264*4882a593Smuzhiyun 			&sd_desc, sizeof(struct sd),
265*4882a593Smuzhiyun 			THIS_MODULE);
266*4882a593Smuzhiyun }
267*4882a593Smuzhiyun 
268*4882a593Smuzhiyun static struct usb_driver sd_driver = {
269*4882a593Smuzhiyun 	.name       = MODULE_NAME,
270*4882a593Smuzhiyun 	.id_table   = device_table,
271*4882a593Smuzhiyun 	.probe      = sd_probe,
272*4882a593Smuzhiyun 	.disconnect   = gspca_disconnect,
273*4882a593Smuzhiyun #ifdef CONFIG_PM
274*4882a593Smuzhiyun 	.suspend      = gspca_suspend,
275*4882a593Smuzhiyun 	.resume       = gspca_resume,
276*4882a593Smuzhiyun 	.reset_resume = gspca_resume,
277*4882a593Smuzhiyun #endif
278*4882a593Smuzhiyun };
279*4882a593Smuzhiyun module_usb_driver(sd_driver);
280*4882a593Smuzhiyun 
281*4882a593Smuzhiyun 
282*4882a593Smuzhiyun /* ---------------------------------------------------------
283*4882a593Smuzhiyun  USB requests to start/stop the camera [USB 2.0 spec Ch.9].
284*4882a593Smuzhiyun 
285*4882a593Smuzhiyun  bRequestType :
286*4882a593Smuzhiyun  0x40 =  USB_DIR_OUT | USB_TYPE_VENDOR | USB_RECIP_DEVICE,
287*4882a593Smuzhiyun  0xC0 =  USB_DIR_IN  | USB_TYPE_VENDOR | USB_RECIP_DEVICE,
288*4882a593Smuzhiyun */
289*4882a593Smuzhiyun static const struct dtcs033_usb_requests dtcs033_start_reqs[] = {
290*4882a593Smuzhiyun /* -- bRequest,wValue,wIndex,wLength */
291*4882a593Smuzhiyun { 0x40, 0x01, 0x0001, 0x000F, 0x0000 },
292*4882a593Smuzhiyun { 0x40, 0x01, 0x0000, 0x000F, 0x0000 },
293*4882a593Smuzhiyun { 0x40, 0x01, 0x0001, 0x000F, 0x0000 },
294*4882a593Smuzhiyun { 0x40, 0x18, 0x0000, 0x7F00, 0x0000 },
295*4882a593Smuzhiyun { 0x40, 0x18, 0x0000, 0x1001, 0x0000 },
296*4882a593Smuzhiyun { 0x40, 0x18, 0x0000, 0x0004, 0x0000 },
297*4882a593Smuzhiyun { 0x40, 0x18, 0x0000, 0x7F01, 0x0000 },
298*4882a593Smuzhiyun { 0x40, 0x18, 0x30E0, 0x0009, 0x0000 },
299*4882a593Smuzhiyun { 0x40, 0x18, 0x0500, 0x012C, 0x0000 },
300*4882a593Smuzhiyun { 0x40, 0x18, 0x0380, 0x0200, 0x0000 },
301*4882a593Smuzhiyun { 0x40, 0x18, 0x0000, 0x035C, 0x0000 },
302*4882a593Smuzhiyun { 0x40, 0x18, 0x05C0, 0x0438, 0x0000 },
303*4882a593Smuzhiyun { 0x40, 0x18, 0x0440, 0x0500, 0x0000 },
304*4882a593Smuzhiyun { 0x40, 0x18, 0x0000, 0x0668, 0x0000 },
305*4882a593Smuzhiyun { 0x40, 0x18, 0x0000, 0x0700, 0x0000 },
306*4882a593Smuzhiyun { 0x40, 0x18, 0x0000, 0x0800, 0x0000 },
307*4882a593Smuzhiyun { 0x40, 0x18, 0x0000, 0x0900, 0x0000 },
308*4882a593Smuzhiyun { 0x40, 0x18, 0x0000, 0x0A00, 0x0000 },
309*4882a593Smuzhiyun { 0x40, 0x18, 0x0000, 0x0B00, 0x0000 },
310*4882a593Smuzhiyun { 0x40, 0x18, 0x30E0, 0x6009, 0x0000 },
311*4882a593Smuzhiyun { 0x40, 0x18, 0x0500, 0x612C, 0x0000 },
312*4882a593Smuzhiyun { 0x40, 0x18, 0x2090, 0x6274, 0x0000 },
313*4882a593Smuzhiyun { 0x40, 0x18, 0x05C0, 0x6338, 0x0000 },
314*4882a593Smuzhiyun { 0x40, 0x18, 0x0000, 0x6400, 0x0000 },
315*4882a593Smuzhiyun { 0x40, 0x18, 0x05C0, 0x6538, 0x0000 },
316*4882a593Smuzhiyun { 0x40, 0x18, 0x0000, 0x6600, 0x0000 },
317*4882a593Smuzhiyun { 0x40, 0x18, 0x0680, 0x6744, 0x0000 },
318*4882a593Smuzhiyun { 0x40, 0x18, 0x0000, 0x6800, 0x0000 },
319*4882a593Smuzhiyun { 0x40, 0x18, 0x0000, 0x6900, 0x0000 },
320*4882a593Smuzhiyun { 0x40, 0x18, 0x0000, 0x6A00, 0x0000 },
321*4882a593Smuzhiyun { 0x40, 0x18, 0x0000, 0x6B00, 0x0000 },
322*4882a593Smuzhiyun { 0x40, 0x18, 0x0000, 0x6C00, 0x0000 },
323*4882a593Smuzhiyun { 0x40, 0x18, 0x0000, 0x6D00, 0x0000 },
324*4882a593Smuzhiyun { 0x40, 0x18, 0x0000, 0x6E00, 0x0000 },
325*4882a593Smuzhiyun { 0x40, 0x18, 0x0000, 0x808C, 0x0000 },
326*4882a593Smuzhiyun { 0x40, 0x18, 0x0010, 0x8101, 0x0000 },
327*4882a593Smuzhiyun { 0x40, 0x18, 0x30E0, 0x8200, 0x0000 },
328*4882a593Smuzhiyun { 0x40, 0x18, 0x0810, 0x832C, 0x0000 },
329*4882a593Smuzhiyun { 0x40, 0x18, 0x0680, 0x842B, 0x0000 },
330*4882a593Smuzhiyun { 0x40, 0x18, 0x0000, 0x8500, 0x0000 },
331*4882a593Smuzhiyun { 0x40, 0x18, 0x0000, 0x8600, 0x0000 },
332*4882a593Smuzhiyun { 0x40, 0x18, 0x0280, 0x8715, 0x0000 },
333*4882a593Smuzhiyun { 0x40, 0x18, 0x0000, 0x880C, 0x0000 },
334*4882a593Smuzhiyun { 0x40, 0x18, 0x0010, 0x8901, 0x0000 },
335*4882a593Smuzhiyun { 0x40, 0x18, 0x30E0, 0x8A00, 0x0000 },
336*4882a593Smuzhiyun { 0x40, 0x18, 0x0810, 0x8B2C, 0x0000 },
337*4882a593Smuzhiyun { 0x40, 0x18, 0x0680, 0x8C2B, 0x0000 },
338*4882a593Smuzhiyun { 0x40, 0x18, 0x0000, 0x8D00, 0x0000 },
339*4882a593Smuzhiyun { 0x40, 0x18, 0x0000, 0x8E00, 0x0000 },
340*4882a593Smuzhiyun { 0x40, 0x18, 0x0280, 0x8F15, 0x0000 },
341*4882a593Smuzhiyun { 0x40, 0x18, 0x0010, 0xD040, 0x0000 },
342*4882a593Smuzhiyun { 0x40, 0x18, 0x0000, 0xD100, 0x0000 },
343*4882a593Smuzhiyun { 0x40, 0x18, 0x00B0, 0xD20A, 0x0000 },
344*4882a593Smuzhiyun { 0x40, 0x18, 0x0000, 0xD300, 0x0000 },
345*4882a593Smuzhiyun { 0x40, 0x18, 0x30E2, 0xD40D, 0x0000 },
346*4882a593Smuzhiyun { 0x40, 0x18, 0x0001, 0xD5C0, 0x0000 },
347*4882a593Smuzhiyun { 0x40, 0x18, 0x00A0, 0xD60A, 0x0000 },
348*4882a593Smuzhiyun { 0x40, 0x18, 0x0000, 0xD700, 0x0000 },
349*4882a593Smuzhiyun { 0x40, 0x18, 0x0000, 0x7F00, 0x0000 },
350*4882a593Smuzhiyun { 0x40, 0x18, 0x0000, 0x1501, 0x0000 },
351*4882a593Smuzhiyun { 0x40, 0x18, 0x0001, 0x01FF, 0x0000 },
352*4882a593Smuzhiyun { 0x40, 0x18, 0x0000, 0x0200, 0x0000 },
353*4882a593Smuzhiyun { 0x40, 0x18, 0x0000, 0x0304, 0x0000 },
354*4882a593Smuzhiyun { 0x40, 0x18, 0x0000, 0x1101, 0x0000 },
355*4882a593Smuzhiyun { 0x40, 0x18, 0x0000, 0x1201, 0x0000 },
356*4882a593Smuzhiyun { 0x40, 0x18, 0x0000, 0x1300, 0x0000 },
357*4882a593Smuzhiyun { 0x40, 0x18, 0x0000, 0x1400, 0x0000 },
358*4882a593Smuzhiyun { 0x40, 0x18, 0x0000, 0x1601, 0x0000 },
359*4882a593Smuzhiyun { 0x40, 0x18, 0x0000, 0x1800, 0x0000 },
360*4882a593Smuzhiyun { 0x40, 0x18, 0x0000, 0x1900, 0x0000 },
361*4882a593Smuzhiyun { 0x40, 0x18, 0x0000, 0x1A00, 0x0000 },
362*4882a593Smuzhiyun { 0x40, 0x18, 0x2000, 0x1B00, 0x0000 },
363*4882a593Smuzhiyun { 0x40, 0x18, 0x0000, 0x1C00, 0x0000 },
364*4882a593Smuzhiyun { 0x40, 0x18, 0x0000, 0x2100, 0x0000 },
365*4882a593Smuzhiyun { 0x40, 0x18, 0x00C0, 0x228E, 0x0000 },
366*4882a593Smuzhiyun { 0x40, 0x18, 0x0000, 0x3001, 0x0000 },
367*4882a593Smuzhiyun { 0x40, 0x18, 0x0010, 0x3101, 0x0000 },
368*4882a593Smuzhiyun { 0x40, 0x18, 0x0008, 0x3301, 0x0000 },
369*4882a593Smuzhiyun { 0x40, 0x18, 0x0000, 0x3400, 0x0000 },
370*4882a593Smuzhiyun { 0x40, 0x18, 0x0012, 0x3549, 0x0000 },
371*4882a593Smuzhiyun { 0x40, 0x18, 0x0000, 0x3620, 0x0000 },
372*4882a593Smuzhiyun { 0x40, 0x18, 0x0001, 0x3700, 0x0000 },
373*4882a593Smuzhiyun { 0x40, 0x18, 0x0000, 0x4000, 0x0000 },
374*4882a593Smuzhiyun { 0x40, 0x18, 0xFFFF, 0x41FF, 0x0000 },
375*4882a593Smuzhiyun { 0x40, 0x18, 0xFFFF, 0x42FF, 0x0000 },
376*4882a593Smuzhiyun { 0x40, 0x18, 0x0000, 0x500F, 0x0000 },
377*4882a593Smuzhiyun { 0x40, 0x18, 0x2272, 0x5108, 0x0000 },
378*4882a593Smuzhiyun { 0x40, 0x18, 0x2272, 0x5208, 0x0000 },
379*4882a593Smuzhiyun { 0x40, 0x18, 0xFFFF, 0x53FF, 0x0000 },
380*4882a593Smuzhiyun { 0x40, 0x18, 0xFFFF, 0x54FF, 0x0000 },
381*4882a593Smuzhiyun { 0x40, 0x18, 0x0000, 0x6000, 0x0000 },
382*4882a593Smuzhiyun { 0x40, 0x18, 0x0000, 0x6102, 0x0000 },
383*4882a593Smuzhiyun { 0x40, 0x18, 0x0010, 0x6214, 0x0000 },
384*4882a593Smuzhiyun { 0x40, 0x18, 0x0C80, 0x6300, 0x0000 },
385*4882a593Smuzhiyun { 0x40, 0x18, 0x0000, 0x6401, 0x0000 },
386*4882a593Smuzhiyun { 0x40, 0x18, 0x0680, 0x6551, 0x0000 },
387*4882a593Smuzhiyun { 0x40, 0x18, 0xFFFF, 0x66FF, 0x0000 },
388*4882a593Smuzhiyun { 0x40, 0x18, 0x0000, 0x6702, 0x0000 },
389*4882a593Smuzhiyun { 0x40, 0x18, 0x0010, 0x6800, 0x0000 },
390*4882a593Smuzhiyun { 0x40, 0x18, 0x0000, 0x6900, 0x0000 },
391*4882a593Smuzhiyun { 0x40, 0x18, 0x0000, 0x6A00, 0x0000 },
392*4882a593Smuzhiyun { 0x40, 0x18, 0x0000, 0x6B00, 0x0000 },
393*4882a593Smuzhiyun { 0x40, 0x18, 0x0000, 0x6C00, 0x0000 },
394*4882a593Smuzhiyun { 0x40, 0x18, 0x0000, 0x6D01, 0x0000 },
395*4882a593Smuzhiyun { 0x40, 0x18, 0x0000, 0x6E00, 0x0000 },
396*4882a593Smuzhiyun { 0x40, 0x18, 0x0000, 0x6F00, 0x0000 },
397*4882a593Smuzhiyun { 0x40, 0x18, 0x0000, 0x7000, 0x0000 },
398*4882a593Smuzhiyun { 0x40, 0x18, 0x0001, 0x7118, 0x0000 },
399*4882a593Smuzhiyun { 0x40, 0x18, 0x0000, 0x2001, 0x0000 },
400*4882a593Smuzhiyun { 0x40, 0x18, 0x0000, 0x1101, 0x0000 },
401*4882a593Smuzhiyun { 0x40, 0x18, 0x0000, 0x1301, 0x0000 },
402*4882a593Smuzhiyun { 0x40, 0x18, 0x0000, 0x1300, 0x0000 },
403*4882a593Smuzhiyun { 0x40, 0x18, 0x0000, 0x1501, 0x0000 },
404*4882a593Smuzhiyun { 0xC0, 0x11, 0x0000, 0x24C0, 0x0003 },
405*4882a593Smuzhiyun { 0x40, 0x18, 0x0000, 0x3000, 0x0000 },
406*4882a593Smuzhiyun { 0x40, 0x18, 0x0000, 0x3620, 0x0000 },
407*4882a593Smuzhiyun { 0x40, 0x18, 0x0000, 0x1501, 0x0000 },
408*4882a593Smuzhiyun { 0x40, 0x18, 0x0010, 0x6300, 0x0000 },
409*4882a593Smuzhiyun { 0x40, 0x18, 0x0002, 0x01F0, 0x0000 },
410*4882a593Smuzhiyun { 0x40, 0x01, 0x0003, 0x000F, 0x0000 }
411*4882a593Smuzhiyun };
412*4882a593Smuzhiyun 
413*4882a593Smuzhiyun static const struct dtcs033_usb_requests dtcs033_stop_reqs[] = {
414*4882a593Smuzhiyun /* -- bRequest,wValue,wIndex,wLength */
415*4882a593Smuzhiyun { 0x40, 0x01, 0x0001, 0x000F, 0x0000 },
416*4882a593Smuzhiyun { 0x40, 0x01, 0x0000, 0x000F, 0x0000 },
417*4882a593Smuzhiyun { 0x40, 0x18, 0x0000, 0x0003, 0x0000 }
418*4882a593Smuzhiyun };
dtcs033_start(struct gspca_dev * gspca_dev)419*4882a593Smuzhiyun static int dtcs033_start(struct gspca_dev *gspca_dev)
420*4882a593Smuzhiyun {
421*4882a593Smuzhiyun 	return reg_reqs(gspca_dev, dtcs033_start_reqs,
422*4882a593Smuzhiyun 		ARRAY_SIZE(dtcs033_start_reqs));
423*4882a593Smuzhiyun }
424*4882a593Smuzhiyun 
dtcs033_stopN(struct gspca_dev * gspca_dev)425*4882a593Smuzhiyun static void dtcs033_stopN(struct gspca_dev *gspca_dev)
426*4882a593Smuzhiyun {
427*4882a593Smuzhiyun 	reg_reqs(gspca_dev, dtcs033_stop_reqs,
428*4882a593Smuzhiyun 		ARRAY_SIZE(dtcs033_stop_reqs));
429*4882a593Smuzhiyun 	return;
430*4882a593Smuzhiyun }
431