xref: /linux/drivers/media/usb/gspca/dtcs033.c (revision 58e16d792a6a8c6b750f637a4649967fcac853dc)
1*fd9871f7SThomas Gleixner // SPDX-License-Identifier: GPL-2.0-or-later
230ece903SRobert Butora /*
330ece903SRobert Butora  * Subdriver for Scopium astro-camera (DTCS033, 0547:7303)
430ece903SRobert Butora  *
530ece903SRobert Butora  * Copyright (C) 2014 Robert Butora (robert.butora.fi@gmail.com)
630ece903SRobert Butora  */
730ece903SRobert Butora 
830ece903SRobert Butora #define pr_fmt(fmt) KBUILD_MODNAME ": " fmt
930ece903SRobert Butora #define MODULE_NAME "dtcs033"
1030ece903SRobert Butora #include "gspca.h"
1130ece903SRobert Butora 
1230ece903SRobert Butora MODULE_AUTHOR("Robert Butora <robert.butora.fi@gmail.com>");
1330ece903SRobert Butora MODULE_DESCRIPTION("Scopium DTCS033 astro-cam USB Camera Driver");
1430ece903SRobert Butora MODULE_LICENSE("GPL");
1530ece903SRobert Butora 
16ac9687a2SRobert Butora struct dtcs033_usb_requests {
17ac9687a2SRobert Butora 	u8 bRequestType;
18ac9687a2SRobert Butora 	u8 bRequest;
19ac9687a2SRobert Butora 	u16 wValue;
20ac9687a2SRobert Butora 	u16 wIndex;
21ac9687a2SRobert Butora 	u16 wLength;
22ac9687a2SRobert Butora };
2330ece903SRobert Butora 
2430ece903SRobert Butora /* send a usb request */
reg_rw(struct gspca_dev * gspca_dev,u8 bRequestType,u8 bRequest,u16 wValue,u16 wIndex,u16 wLength)2530ece903SRobert Butora static void reg_rw(struct gspca_dev *gspca_dev,
2630ece903SRobert Butora 		u8 bRequestType, u8 bRequest,
2730ece903SRobert Butora 		u16 wValue, u16 wIndex, u16 wLength)
2830ece903SRobert Butora {
2930ece903SRobert Butora 	struct usb_device *udev = gspca_dev->dev;
3030ece903SRobert Butora 	int ret;
3130ece903SRobert Butora 
3230ece903SRobert Butora 	if (gspca_dev->usb_err < 0)
3330ece903SRobert Butora 		return;
3430ece903SRobert Butora 
3530ece903SRobert Butora 	ret = usb_control_msg(udev,
3630ece903SRobert Butora 		usb_rcvctrlpipe(udev, 0),
3730ece903SRobert Butora 		bRequest,
3830ece903SRobert Butora 		bRequestType,
3930ece903SRobert Butora 		wValue, wIndex,
4030ece903SRobert Butora 		gspca_dev->usb_buf, wLength, 500);
4130ece903SRobert Butora 
4230ece903SRobert Butora 	if (ret < 0) {
4330ece903SRobert Butora 		gspca_dev->usb_err = ret;
4430ece903SRobert Butora 		pr_err("usb_control_msg error %d\n", ret);
4530ece903SRobert Butora 	}
4630ece903SRobert Butora 
4730ece903SRobert Butora 	return;
4830ece903SRobert Butora }
4930ece903SRobert Butora /* send several usb in/out requests */
reg_reqs(struct gspca_dev * gspca_dev,const struct dtcs033_usb_requests * preqs,int n_reqs)5030ece903SRobert Butora static int reg_reqs(struct gspca_dev *gspca_dev,
51ac9687a2SRobert Butora 		    const struct dtcs033_usb_requests *preqs, int n_reqs)
5230ece903SRobert Butora {
5330ece903SRobert Butora 	int i = 0;
54ac9687a2SRobert Butora 	const struct dtcs033_usb_requests *preq;
5530ece903SRobert Butora 
5630ece903SRobert Butora 	while ((i < n_reqs) && (gspca_dev->usb_err >= 0)) {
5730ece903SRobert Butora 
5830ece903SRobert Butora 		preq = &preqs[i];
5930ece903SRobert Butora 
6030ece903SRobert Butora 		reg_rw(gspca_dev, preq->bRequestType, preq->bRequest,
6130ece903SRobert Butora 			preq->wValue, preq->wIndex, preq->wLength);
6230ece903SRobert Butora 
6330ece903SRobert Butora 		if (gspca_dev->usb_err < 0) {
6430ece903SRobert Butora 
6552173c5fSJoe Perches 			gspca_err(gspca_dev, "usb error request no: %d / %d\n",
6630ece903SRobert Butora 				  i, n_reqs);
6730ece903SRobert Butora 		} else if (preq->bRequestType & USB_DIR_IN) {
6830ece903SRobert Butora 
6937d5efb0SJoe Perches 			gspca_dbg(gspca_dev, D_STREAM,
70c32678eaSAntonio Cardace 				  "USB IN (%d) returned[%d] %3ph %s",
7130ece903SRobert Butora 				  i,
7230ece903SRobert Butora 				  preq->wLength,
73c32678eaSAntonio Cardace 				  gspca_dev->usb_buf,
7430ece903SRobert Butora 				  preq->wLength > 3 ? "...\n" : "\n");
7530ece903SRobert Butora 		}
7630ece903SRobert Butora 
7730ece903SRobert Butora 		i++;
7830ece903SRobert Butora 	}
7930ece903SRobert Butora 	return gspca_dev->usb_err;
8030ece903SRobert Butora }
8130ece903SRobert Butora 
8230ece903SRobert Butora /* -- subdriver interface implementation -- */
8330ece903SRobert Butora 
8430ece903SRobert Butora #define DT_COLS (640)
8530ece903SRobert Butora static const struct v4l2_pix_format dtcs033_mode[] = {
8630ece903SRobert Butora 	/* raw Bayer patterned output */
8730ece903SRobert Butora 	{DT_COLS, 480, V4L2_PIX_FMT_GREY, V4L2_FIELD_NONE,
8830ece903SRobert Butora 		.bytesperline = DT_COLS,
8930ece903SRobert Butora 		.sizeimage = DT_COLS*480,
9030ece903SRobert Butora 		.colorspace = V4L2_COLORSPACE_SRGB,
9130ece903SRobert Butora 	},
9230ece903SRobert Butora 	/* this mode will demosaic the Bayer pattern */
9330ece903SRobert Butora 	{DT_COLS, 480, V4L2_PIX_FMT_SRGGB8, V4L2_FIELD_NONE,
9430ece903SRobert Butora 		.bytesperline = DT_COLS,
9530ece903SRobert Butora 		.sizeimage = DT_COLS*480,
9630ece903SRobert Butora 		.colorspace = V4L2_COLORSPACE_SRGB,
9730ece903SRobert Butora 	}
9830ece903SRobert Butora };
9930ece903SRobert Butora 
10030ece903SRobert Butora /* config called at probe time */
sd_config(struct gspca_dev * gspca_dev,const struct usb_device_id * id)10130ece903SRobert Butora static int sd_config(struct gspca_dev *gspca_dev,
10230ece903SRobert Butora 		const struct usb_device_id *id)
10330ece903SRobert Butora {
10430ece903SRobert Butora 	gspca_dev->cam.cam_mode = dtcs033_mode;
10530ece903SRobert Butora 	gspca_dev->cam.nmodes = ARRAY_SIZE(dtcs033_mode);
10630ece903SRobert Butora 
10730ece903SRobert Butora 	gspca_dev->cam.bulk = 1;
10830ece903SRobert Butora 	gspca_dev->cam.bulk_nurbs = 1;
10930ece903SRobert Butora 	gspca_dev->cam.bulk_size = DT_COLS*512;
11030ece903SRobert Butora 
11130ece903SRobert Butora 	return 0;
11230ece903SRobert Butora }
11330ece903SRobert Butora 
11430ece903SRobert Butora /* init called at probe and resume time */
sd_init(struct gspca_dev * gspca_dev)11530ece903SRobert Butora static int sd_init(struct gspca_dev *gspca_dev)
11630ece903SRobert Butora {
11730ece903SRobert Butora 	return 0;
11830ece903SRobert Butora }
11930ece903SRobert Butora 
12030ece903SRobert Butora /* start stop the camera */
12130ece903SRobert Butora static int  dtcs033_start(struct gspca_dev *gspca_dev);
12230ece903SRobert Butora static void dtcs033_stopN(struct gspca_dev *gspca_dev);
12330ece903SRobert Butora 
12430ece903SRobert Butora /* intercept camera image data */
dtcs033_pkt_scan(struct gspca_dev * gspca_dev,u8 * data,int len)12530ece903SRobert Butora static void dtcs033_pkt_scan(struct gspca_dev *gspca_dev,
12630ece903SRobert Butora 			u8 *data,  /* packet data */
12730ece903SRobert Butora 			int len)   /* packet data length */
12830ece903SRobert Butora {
12930ece903SRobert Butora 	/* drop incomplete frames */
13030ece903SRobert Butora 	if (len != DT_COLS*512) {
13130ece903SRobert Butora 		gspca_dev->last_packet_type = DISCARD_PACKET;
13230ece903SRobert Butora 		/* gspca.c: discard invalidates the whole frame. */
13330ece903SRobert Butora 		return;
13430ece903SRobert Butora 	}
13530ece903SRobert Butora 
13630ece903SRobert Butora 	/* forward complete frames */
13730ece903SRobert Butora 	gspca_frame_add(gspca_dev, FIRST_PACKET, NULL, 0);
13830ece903SRobert Butora 	gspca_frame_add(gspca_dev, INTER_PACKET,
13930ece903SRobert Butora 		data + 16*DT_COLS,
14030ece903SRobert Butora 		len  - 32*DT_COLS); /* skip first & last 16 lines */
14130ece903SRobert Butora 	gspca_frame_add(gspca_dev, LAST_PACKET,  NULL, 0);
14230ece903SRobert Butora 
14330ece903SRobert Butora 	return;
14430ece903SRobert Butora }
14530ece903SRobert Butora 
14630ece903SRobert Butora /* -- controls: exposure and gain -- */
14730ece903SRobert Butora 
dtcs033_setexposure(struct gspca_dev * gspca_dev,s32 expo,s32 gain)14830ece903SRobert Butora static void dtcs033_setexposure(struct gspca_dev *gspca_dev,
14930ece903SRobert Butora 			s32 expo, s32 gain)
15030ece903SRobert Butora {
15130ece903SRobert Butora 	/* gain [dB] encoding */
15230ece903SRobert Butora 	u16 sGain   = (u16)gain;
15330ece903SRobert Butora 	u16 gainVal = 224+(sGain-14)*(768-224)/(33-14);
15430ece903SRobert Butora 	u16 wIndex =  0x0100|(0x00FF&gainVal);
15530ece903SRobert Butora 	u16 wValue = (0xFF00&gainVal)>>8;
15630ece903SRobert Butora 
15730ece903SRobert Butora 	/* exposure time [msec] encoding */
15830ece903SRobert Butora 	u16 sXTime   = (u16)expo;
15930ece903SRobert Butora 	u16 xtimeVal = (524*(150-(sXTime-1)))/150;
16030ece903SRobert Butora 
16130ece903SRobert Butora 	const u8 bRequestType =
16230ece903SRobert Butora 		USB_DIR_OUT | USB_TYPE_VENDOR | USB_RECIP_DEVICE;
16330ece903SRobert Butora 	const u8 bRequest = 0x18;
16430ece903SRobert Butora 
16530ece903SRobert Butora 	reg_rw(gspca_dev,
16630ece903SRobert Butora 		bRequestType, bRequest, wValue, wIndex, 0);
16730ece903SRobert Butora 	if (gspca_dev->usb_err < 0)
16852173c5fSJoe Perches 		gspca_err(gspca_dev, "usb error in setexposure(gain) sequence\n");
16930ece903SRobert Butora 
17030ece903SRobert Butora 	reg_rw(gspca_dev,
17130ece903SRobert Butora 		bRequestType, bRequest, (xtimeVal<<4), 0x6300, 0);
17230ece903SRobert Butora 	if (gspca_dev->usb_err < 0)
17352173c5fSJoe Perches 		gspca_err(gspca_dev, "usb error in setexposure(time) sequence\n");
17430ece903SRobert Butora }
17530ece903SRobert Butora 
17630ece903SRobert Butora /* specific webcam descriptor */
17730ece903SRobert Butora struct sd {
17830ece903SRobert Butora 	struct gspca_dev gspca_dev;/* !! must be the first item */
17930ece903SRobert Butora 
18030ece903SRobert Butora 	/* exposure & gain controls */
18130ece903SRobert Butora 	struct {
18230ece903SRobert Butora 		struct v4l2_ctrl *exposure;
18330ece903SRobert Butora 		struct v4l2_ctrl *gain;
18430ece903SRobert Butora 	};
18530ece903SRobert Butora };
18630ece903SRobert Butora 
sd_s_ctrl(struct v4l2_ctrl * ctrl)18730ece903SRobert Butora static int sd_s_ctrl(struct v4l2_ctrl *ctrl)
18830ece903SRobert Butora {
18930ece903SRobert Butora 	struct gspca_dev *gspca_dev =
19030ece903SRobert Butora 	container_of(ctrl->handler,
19130ece903SRobert Butora 		struct gspca_dev, ctrl_handler);
19230ece903SRobert Butora 	struct sd *sd = (struct sd *) gspca_dev;
19330ece903SRobert Butora 
19430ece903SRobert Butora 	gspca_dev->usb_err = 0;
19530ece903SRobert Butora 
19630ece903SRobert Butora 	if (!gspca_dev->streaming)
19730ece903SRobert Butora 		return 0;
19830ece903SRobert Butora 
19930ece903SRobert Butora 	switch (ctrl->id) {
20030ece903SRobert Butora 	case V4L2_CID_EXPOSURE:
20130ece903SRobert Butora 		dtcs033_setexposure(gspca_dev,
20230ece903SRobert Butora 				ctrl->val, sd->gain->val);
20330ece903SRobert Butora 		break;
20430ece903SRobert Butora 	case V4L2_CID_GAIN:
20530ece903SRobert Butora 		dtcs033_setexposure(gspca_dev,
20630ece903SRobert Butora 				sd->exposure->val, ctrl->val);
20730ece903SRobert Butora 		break;
20830ece903SRobert Butora 	}
20930ece903SRobert Butora 	return gspca_dev->usb_err;
21030ece903SRobert Butora }
21130ece903SRobert Butora 
21230ece903SRobert Butora static const struct v4l2_ctrl_ops sd_ctrl_ops = {
21330ece903SRobert Butora 	.s_ctrl = sd_s_ctrl,
21430ece903SRobert Butora };
21530ece903SRobert Butora 
dtcs033_init_controls(struct gspca_dev * gspca_dev)21630ece903SRobert Butora static int dtcs033_init_controls(struct gspca_dev *gspca_dev)
21730ece903SRobert Butora {
21830ece903SRobert Butora 	struct v4l2_ctrl_handler *hdl = &gspca_dev->ctrl_handler;
21930ece903SRobert Butora 	struct sd *sd = (struct sd *) gspca_dev;
22030ece903SRobert Butora 
22130ece903SRobert Butora 	gspca_dev->vdev.ctrl_handler = hdl;
22230ece903SRobert Butora 	v4l2_ctrl_handler_init(hdl, 2);
22330ece903SRobert Butora 	/*                               min max step default */
22430ece903SRobert Butora 	sd->exposure = v4l2_ctrl_new_std(hdl, &sd_ctrl_ops,
22530ece903SRobert Butora 				V4L2_CID_EXPOSURE,
22630ece903SRobert Butora 				1,  150,  1,  75);/* [msec] */
22730ece903SRobert Butora 	sd->gain     = v4l2_ctrl_new_std(hdl, &sd_ctrl_ops,
22830ece903SRobert Butora 				V4L2_CID_GAIN,
22930ece903SRobert Butora 				14,  33,  1,  24);/* [dB] */
23030ece903SRobert Butora 	if (hdl->error) {
23152173c5fSJoe Perches 		gspca_err(gspca_dev, "Could not initialize controls: %d\n",
23230ece903SRobert Butora 			  hdl->error);
23330ece903SRobert Butora 		return hdl->error;
23430ece903SRobert Butora 	}
23530ece903SRobert Butora 
23630ece903SRobert Butora 	v4l2_ctrl_cluster(2, &sd->exposure);
23730ece903SRobert Butora 	return 0;
23830ece903SRobert Butora }
23930ece903SRobert Butora 
24030ece903SRobert Butora /* sub-driver description */
24130ece903SRobert Butora static const struct sd_desc sd_desc = {
24230ece903SRobert Butora 	.name     = MODULE_NAME,
24330ece903SRobert Butora 	.config   = sd_config,
24430ece903SRobert Butora 	.init     = sd_init,
24530ece903SRobert Butora 	.start    = dtcs033_start,
24630ece903SRobert Butora 	.stopN    = dtcs033_stopN,
24730ece903SRobert Butora 	.pkt_scan = dtcs033_pkt_scan,
24830ece903SRobert Butora 	.init_controls = dtcs033_init_controls,
24930ece903SRobert Butora };
25030ece903SRobert Butora 
25130ece903SRobert Butora /* -- module initialisation -- */
25230ece903SRobert Butora 
25330ece903SRobert Butora static const struct usb_device_id device_table[] = {
25430ece903SRobert Butora 	{USB_DEVICE(0x0547, 0x7303)},
25530ece903SRobert Butora 	{}
25630ece903SRobert Butora };
25730ece903SRobert Butora MODULE_DEVICE_TABLE(usb, device_table);
25830ece903SRobert Butora 
25930ece903SRobert Butora /* device connect */
sd_probe(struct usb_interface * intf,const struct usb_device_id * id)26030ece903SRobert Butora static int sd_probe(struct usb_interface *intf,
26130ece903SRobert Butora 			const struct usb_device_id *id)
26230ece903SRobert Butora {
26330ece903SRobert Butora 	return gspca_dev_probe(intf, id,
26430ece903SRobert Butora 			&sd_desc, sizeof(struct sd),
26530ece903SRobert Butora 			THIS_MODULE);
26630ece903SRobert Butora }
26730ece903SRobert Butora 
26830ece903SRobert Butora static struct usb_driver sd_driver = {
26930ece903SRobert Butora 	.name       = MODULE_NAME,
27030ece903SRobert Butora 	.id_table   = device_table,
27130ece903SRobert Butora 	.probe      = sd_probe,
27230ece903SRobert Butora 	.disconnect   = gspca_disconnect,
27330ece903SRobert Butora #ifdef CONFIG_PM
27430ece903SRobert Butora 	.suspend      = gspca_suspend,
27530ece903SRobert Butora 	.resume       = gspca_resume,
27630ece903SRobert Butora 	.reset_resume = gspca_resume,
27730ece903SRobert Butora #endif
27830ece903SRobert Butora };
27930ece903SRobert Butora module_usb_driver(sd_driver);
28030ece903SRobert Butora 
28130ece903SRobert Butora 
28230ece903SRobert Butora /* ---------------------------------------------------------
28330ece903SRobert Butora  USB requests to start/stop the camera [USB 2.0 spec Ch.9].
28430ece903SRobert Butora 
28530ece903SRobert Butora  bRequestType :
28630ece903SRobert Butora  0x40 =  USB_DIR_OUT | USB_TYPE_VENDOR | USB_RECIP_DEVICE,
28730ece903SRobert Butora  0xC0 =  USB_DIR_IN  | USB_TYPE_VENDOR | USB_RECIP_DEVICE,
28830ece903SRobert Butora */
289ac9687a2SRobert Butora static const struct dtcs033_usb_requests dtcs033_start_reqs[] = {
29030ece903SRobert Butora /* -- bRequest,wValue,wIndex,wLength */
29130ece903SRobert Butora { 0x40, 0x01, 0x0001, 0x000F, 0x0000 },
29230ece903SRobert Butora { 0x40, 0x01, 0x0000, 0x000F, 0x0000 },
29330ece903SRobert Butora { 0x40, 0x01, 0x0001, 0x000F, 0x0000 },
29430ece903SRobert Butora { 0x40, 0x18, 0x0000, 0x7F00, 0x0000 },
29530ece903SRobert Butora { 0x40, 0x18, 0x0000, 0x1001, 0x0000 },
29630ece903SRobert Butora { 0x40, 0x18, 0x0000, 0x0004, 0x0000 },
29730ece903SRobert Butora { 0x40, 0x18, 0x0000, 0x7F01, 0x0000 },
29830ece903SRobert Butora { 0x40, 0x18, 0x30E0, 0x0009, 0x0000 },
29930ece903SRobert Butora { 0x40, 0x18, 0x0500, 0x012C, 0x0000 },
30030ece903SRobert Butora { 0x40, 0x18, 0x0380, 0x0200, 0x0000 },
30130ece903SRobert Butora { 0x40, 0x18, 0x0000, 0x035C, 0x0000 },
30230ece903SRobert Butora { 0x40, 0x18, 0x05C0, 0x0438, 0x0000 },
30330ece903SRobert Butora { 0x40, 0x18, 0x0440, 0x0500, 0x0000 },
30430ece903SRobert Butora { 0x40, 0x18, 0x0000, 0x0668, 0x0000 },
30530ece903SRobert Butora { 0x40, 0x18, 0x0000, 0x0700, 0x0000 },
30630ece903SRobert Butora { 0x40, 0x18, 0x0000, 0x0800, 0x0000 },
30730ece903SRobert Butora { 0x40, 0x18, 0x0000, 0x0900, 0x0000 },
30830ece903SRobert Butora { 0x40, 0x18, 0x0000, 0x0A00, 0x0000 },
30930ece903SRobert Butora { 0x40, 0x18, 0x0000, 0x0B00, 0x0000 },
31030ece903SRobert Butora { 0x40, 0x18, 0x30E0, 0x6009, 0x0000 },
31130ece903SRobert Butora { 0x40, 0x18, 0x0500, 0x612C, 0x0000 },
31230ece903SRobert Butora { 0x40, 0x18, 0x2090, 0x6274, 0x0000 },
31330ece903SRobert Butora { 0x40, 0x18, 0x05C0, 0x6338, 0x0000 },
31430ece903SRobert Butora { 0x40, 0x18, 0x0000, 0x6400, 0x0000 },
31530ece903SRobert Butora { 0x40, 0x18, 0x05C0, 0x6538, 0x0000 },
31630ece903SRobert Butora { 0x40, 0x18, 0x0000, 0x6600, 0x0000 },
31730ece903SRobert Butora { 0x40, 0x18, 0x0680, 0x6744, 0x0000 },
31830ece903SRobert Butora { 0x40, 0x18, 0x0000, 0x6800, 0x0000 },
31930ece903SRobert Butora { 0x40, 0x18, 0x0000, 0x6900, 0x0000 },
32030ece903SRobert Butora { 0x40, 0x18, 0x0000, 0x6A00, 0x0000 },
32130ece903SRobert Butora { 0x40, 0x18, 0x0000, 0x6B00, 0x0000 },
32230ece903SRobert Butora { 0x40, 0x18, 0x0000, 0x6C00, 0x0000 },
32330ece903SRobert Butora { 0x40, 0x18, 0x0000, 0x6D00, 0x0000 },
32430ece903SRobert Butora { 0x40, 0x18, 0x0000, 0x6E00, 0x0000 },
32530ece903SRobert Butora { 0x40, 0x18, 0x0000, 0x808C, 0x0000 },
32630ece903SRobert Butora { 0x40, 0x18, 0x0010, 0x8101, 0x0000 },
32730ece903SRobert Butora { 0x40, 0x18, 0x30E0, 0x8200, 0x0000 },
32830ece903SRobert Butora { 0x40, 0x18, 0x0810, 0x832C, 0x0000 },
32930ece903SRobert Butora { 0x40, 0x18, 0x0680, 0x842B, 0x0000 },
33030ece903SRobert Butora { 0x40, 0x18, 0x0000, 0x8500, 0x0000 },
33130ece903SRobert Butora { 0x40, 0x18, 0x0000, 0x8600, 0x0000 },
33230ece903SRobert Butora { 0x40, 0x18, 0x0280, 0x8715, 0x0000 },
33330ece903SRobert Butora { 0x40, 0x18, 0x0000, 0x880C, 0x0000 },
33430ece903SRobert Butora { 0x40, 0x18, 0x0010, 0x8901, 0x0000 },
33530ece903SRobert Butora { 0x40, 0x18, 0x30E0, 0x8A00, 0x0000 },
33630ece903SRobert Butora { 0x40, 0x18, 0x0810, 0x8B2C, 0x0000 },
33730ece903SRobert Butora { 0x40, 0x18, 0x0680, 0x8C2B, 0x0000 },
33830ece903SRobert Butora { 0x40, 0x18, 0x0000, 0x8D00, 0x0000 },
33930ece903SRobert Butora { 0x40, 0x18, 0x0000, 0x8E00, 0x0000 },
34030ece903SRobert Butora { 0x40, 0x18, 0x0280, 0x8F15, 0x0000 },
34130ece903SRobert Butora { 0x40, 0x18, 0x0010, 0xD040, 0x0000 },
34230ece903SRobert Butora { 0x40, 0x18, 0x0000, 0xD100, 0x0000 },
34330ece903SRobert Butora { 0x40, 0x18, 0x00B0, 0xD20A, 0x0000 },
34430ece903SRobert Butora { 0x40, 0x18, 0x0000, 0xD300, 0x0000 },
34530ece903SRobert Butora { 0x40, 0x18, 0x30E2, 0xD40D, 0x0000 },
34630ece903SRobert Butora { 0x40, 0x18, 0x0001, 0xD5C0, 0x0000 },
34730ece903SRobert Butora { 0x40, 0x18, 0x00A0, 0xD60A, 0x0000 },
34830ece903SRobert Butora { 0x40, 0x18, 0x0000, 0xD700, 0x0000 },
34930ece903SRobert Butora { 0x40, 0x18, 0x0000, 0x7F00, 0x0000 },
35030ece903SRobert Butora { 0x40, 0x18, 0x0000, 0x1501, 0x0000 },
35130ece903SRobert Butora { 0x40, 0x18, 0x0001, 0x01FF, 0x0000 },
35230ece903SRobert Butora { 0x40, 0x18, 0x0000, 0x0200, 0x0000 },
35330ece903SRobert Butora { 0x40, 0x18, 0x0000, 0x0304, 0x0000 },
35430ece903SRobert Butora { 0x40, 0x18, 0x0000, 0x1101, 0x0000 },
35530ece903SRobert Butora { 0x40, 0x18, 0x0000, 0x1201, 0x0000 },
35630ece903SRobert Butora { 0x40, 0x18, 0x0000, 0x1300, 0x0000 },
35730ece903SRobert Butora { 0x40, 0x18, 0x0000, 0x1400, 0x0000 },
35830ece903SRobert Butora { 0x40, 0x18, 0x0000, 0x1601, 0x0000 },
35930ece903SRobert Butora { 0x40, 0x18, 0x0000, 0x1800, 0x0000 },
36030ece903SRobert Butora { 0x40, 0x18, 0x0000, 0x1900, 0x0000 },
36130ece903SRobert Butora { 0x40, 0x18, 0x0000, 0x1A00, 0x0000 },
36230ece903SRobert Butora { 0x40, 0x18, 0x2000, 0x1B00, 0x0000 },
36330ece903SRobert Butora { 0x40, 0x18, 0x0000, 0x1C00, 0x0000 },
36430ece903SRobert Butora { 0x40, 0x18, 0x0000, 0x2100, 0x0000 },
36530ece903SRobert Butora { 0x40, 0x18, 0x00C0, 0x228E, 0x0000 },
36630ece903SRobert Butora { 0x40, 0x18, 0x0000, 0x3001, 0x0000 },
36730ece903SRobert Butora { 0x40, 0x18, 0x0010, 0x3101, 0x0000 },
36830ece903SRobert Butora { 0x40, 0x18, 0x0008, 0x3301, 0x0000 },
36930ece903SRobert Butora { 0x40, 0x18, 0x0000, 0x3400, 0x0000 },
37030ece903SRobert Butora { 0x40, 0x18, 0x0012, 0x3549, 0x0000 },
37130ece903SRobert Butora { 0x40, 0x18, 0x0000, 0x3620, 0x0000 },
37230ece903SRobert Butora { 0x40, 0x18, 0x0001, 0x3700, 0x0000 },
37330ece903SRobert Butora { 0x40, 0x18, 0x0000, 0x4000, 0x0000 },
37430ece903SRobert Butora { 0x40, 0x18, 0xFFFF, 0x41FF, 0x0000 },
37530ece903SRobert Butora { 0x40, 0x18, 0xFFFF, 0x42FF, 0x0000 },
37630ece903SRobert Butora { 0x40, 0x18, 0x0000, 0x500F, 0x0000 },
37730ece903SRobert Butora { 0x40, 0x18, 0x2272, 0x5108, 0x0000 },
37830ece903SRobert Butora { 0x40, 0x18, 0x2272, 0x5208, 0x0000 },
37930ece903SRobert Butora { 0x40, 0x18, 0xFFFF, 0x53FF, 0x0000 },
38030ece903SRobert Butora { 0x40, 0x18, 0xFFFF, 0x54FF, 0x0000 },
38130ece903SRobert Butora { 0x40, 0x18, 0x0000, 0x6000, 0x0000 },
38230ece903SRobert Butora { 0x40, 0x18, 0x0000, 0x6102, 0x0000 },
38330ece903SRobert Butora { 0x40, 0x18, 0x0010, 0x6214, 0x0000 },
38430ece903SRobert Butora { 0x40, 0x18, 0x0C80, 0x6300, 0x0000 },
38530ece903SRobert Butora { 0x40, 0x18, 0x0000, 0x6401, 0x0000 },
38630ece903SRobert Butora { 0x40, 0x18, 0x0680, 0x6551, 0x0000 },
38730ece903SRobert Butora { 0x40, 0x18, 0xFFFF, 0x66FF, 0x0000 },
38830ece903SRobert Butora { 0x40, 0x18, 0x0000, 0x6702, 0x0000 },
38930ece903SRobert Butora { 0x40, 0x18, 0x0010, 0x6800, 0x0000 },
39030ece903SRobert Butora { 0x40, 0x18, 0x0000, 0x6900, 0x0000 },
39130ece903SRobert Butora { 0x40, 0x18, 0x0000, 0x6A00, 0x0000 },
39230ece903SRobert Butora { 0x40, 0x18, 0x0000, 0x6B00, 0x0000 },
39330ece903SRobert Butora { 0x40, 0x18, 0x0000, 0x6C00, 0x0000 },
39430ece903SRobert Butora { 0x40, 0x18, 0x0000, 0x6D01, 0x0000 },
39530ece903SRobert Butora { 0x40, 0x18, 0x0000, 0x6E00, 0x0000 },
39630ece903SRobert Butora { 0x40, 0x18, 0x0000, 0x6F00, 0x0000 },
39730ece903SRobert Butora { 0x40, 0x18, 0x0000, 0x7000, 0x0000 },
39830ece903SRobert Butora { 0x40, 0x18, 0x0001, 0x7118, 0x0000 },
39930ece903SRobert Butora { 0x40, 0x18, 0x0000, 0x2001, 0x0000 },
40030ece903SRobert Butora { 0x40, 0x18, 0x0000, 0x1101, 0x0000 },
40130ece903SRobert Butora { 0x40, 0x18, 0x0000, 0x1301, 0x0000 },
40230ece903SRobert Butora { 0x40, 0x18, 0x0000, 0x1300, 0x0000 },
40330ece903SRobert Butora { 0x40, 0x18, 0x0000, 0x1501, 0x0000 },
40430ece903SRobert Butora { 0xC0, 0x11, 0x0000, 0x24C0, 0x0003 },
40530ece903SRobert Butora { 0x40, 0x18, 0x0000, 0x3000, 0x0000 },
40630ece903SRobert Butora { 0x40, 0x18, 0x0000, 0x3620, 0x0000 },
40730ece903SRobert Butora { 0x40, 0x18, 0x0000, 0x1501, 0x0000 },
40830ece903SRobert Butora { 0x40, 0x18, 0x0010, 0x6300, 0x0000 },
40930ece903SRobert Butora { 0x40, 0x18, 0x0002, 0x01F0, 0x0000 },
41030ece903SRobert Butora { 0x40, 0x01, 0x0003, 0x000F, 0x0000 }
41130ece903SRobert Butora };
41230ece903SRobert Butora 
413ac9687a2SRobert Butora static const struct dtcs033_usb_requests dtcs033_stop_reqs[] = {
41430ece903SRobert Butora /* -- bRequest,wValue,wIndex,wLength */
41530ece903SRobert Butora { 0x40, 0x01, 0x0001, 0x000F, 0x0000 },
41630ece903SRobert Butora { 0x40, 0x01, 0x0000, 0x000F, 0x0000 },
41730ece903SRobert Butora { 0x40, 0x18, 0x0000, 0x0003, 0x0000 }
41830ece903SRobert Butora };
dtcs033_start(struct gspca_dev * gspca_dev)41930ece903SRobert Butora static int dtcs033_start(struct gspca_dev *gspca_dev)
42030ece903SRobert Butora {
42130ece903SRobert Butora 	return reg_reqs(gspca_dev, dtcs033_start_reqs,
42230ece903SRobert Butora 		ARRAY_SIZE(dtcs033_start_reqs));
42330ece903SRobert Butora }
42430ece903SRobert Butora 
dtcs033_stopN(struct gspca_dev * gspca_dev)42530ece903SRobert Butora static void dtcs033_stopN(struct gspca_dev *gspca_dev)
42630ece903SRobert Butora {
42730ece903SRobert Butora 	reg_reqs(gspca_dev, dtcs033_stop_reqs,
42830ece903SRobert Butora 		ARRAY_SIZE(dtcs033_stop_reqs));
42930ece903SRobert Butora 	return;
43030ece903SRobert Butora }
431