28 #include <linux/module.h>
30 #include <linux/kernel.h>
31 #include <linux/errno.h>
32 #include <linux/slab.h>
42 static unsigned int input;
52 { USB_DEVICE(0x05e1, 0x0408) },
58 static unsigned short saa7113_addrs[] = {
69 int pipe = usb_rcvctrlpipe(dev->
udev, 0);
74 0x00, reg, value,
sizeof(
u8),
HZ);
87 int pipe = usb_sndctrlpipe(dev->
udev, 0);
104 static const u8 gctrl[] = {
105 0x98, 0x90, 0x88, 0x80, 0x98
121 static void stk1160_reg_reset(
struct stk1160 *
dev)
149 for (i = 0; ctl[
i].
reg != 0xffff; i++)
153 static void stk1160_release(
struct v4l2_device *v4l2_dev)
168 #define hb_mult(wMaxPacketSize) (1 + (((wMaxPacketSize) >> 11) & 0x03))
178 int i,
e, sizedescr,
size, ifnum;
181 bool has_video =
false, has_audio =
false;
184 ifnum = intf->altsetting[0].desc.bInterfaceNumber;
187 for (i = 0; i < intf->num_altsetting; i++) {
189 for (e = 0; e < intf->altsetting[
i].desc.bNumEndpoints; e++) {
192 desc = &intf->altsetting[
i].endpoint[
e].desc;
194 size = sizedescr & 0x7ff;
197 size = size *
hb_mult(sizedescr);
199 if (usb_endpoint_xfer_isoc(desc) &&
200 usb_endpoint_dir_in(desc)) {
207 max_pkt_size[
i] =
size;
215 if (!(has_audio || has_video)) {
216 dev_err(&udev->dev,
"no audio or video endpoints found\n");
220 switch (udev->speed) {
234 dev_info(&udev->dev,
"New device %s %s @ %s Mbps (%04x:%04x, interface %d, class %d)\n",
235 udev->manufacturer ? udev->manufacturer :
"",
236 udev->product ? udev->product :
"",
241 intf->altsetting->desc.bInterfaceNumber);
245 dev_warn(&udev->dev,
"audio interface %d found.\n\
246 This is not implemented by this driver,\
247 you should use snd-usb-audio instead\n", ifnum);
250 dev_info(&udev->dev,
"video interface %d found\n",
259 dev_warn(&udev->dev,
"must be connected to a high-speed USB 2.0 port\n\
260 You may not be able to stream video smoothly\n");
270 unsigned int *alt_max_pkt_size;
271 struct usb_device *
udev;
274 udev = interface_to_usbdev(interface);
284 alt_max_pkt_size =
kmalloc(
sizeof(alt_max_pkt_size[0]) *
286 if (alt_max_pkt_size ==
NULL)
293 rc = stk1160_scan_usb(interface, udev, alt_max_pkt_size);
295 kfree(alt_max_pkt_size);
301 kfree(alt_max_pkt_size);
307 dev->
num_alt = interface->num_altsetting;
311 dev->
dev = &interface->dev;
313 usb_set_intfdata(interface, dev);
330 stk1160_err(
"v4l2_ctrl_handler_init failed (%d)\n", rc);
339 dev->
v4l2_dev.release = stk1160_release;
343 stk1160_err(
"v4l2_device_register failed (%d)\n", rc);
356 "saa7115_auto", 0, saa7113_addrs);
366 stk1160_reg_reset(dev);
386 kfree(alt_max_pkt_size);
392 static void stk1160_disconnect(
struct usb_interface *interface)
396 dev = usb_get_intfdata(interface);
397 usb_set_intfdata(interface,
NULL);
430 static struct usb_driver stk1160_usb_driver = {
432 .id_table = stk1160_id_table,
433 .probe = stk1160_probe,
434 .disconnect = stk1160_disconnect,