greybus: es2.c: create dedicated struct for cport_in and cport_out
[cascardo/linux.git] / drivers / staging / greybus / es2.c
1 /*
2  * Greybus "AP" USB driver for "ES2" controller chips
3  *
4  * Copyright 2014-2015 Google Inc.
5  * Copyright 2014-2015 Linaro Ltd.
6  *
7  * Released under the GPLv2 only.
8  */
9 #include <linux/kthread.h>
10 #include <linux/sizes.h>
11 #include <linux/usb.h>
12 #include <linux/kfifo.h>
13 #include <linux/debugfs.h>
14 #include <asm/unaligned.h>
15
16 #include "greybus.h"
17 #include "svc_msg.h"
18 #include "kernel_ver.h"
19
20 /* Memory sizes for the buffers sent to/from the ES1 controller */
21 #define ES1_SVC_MSG_SIZE        (sizeof(struct svc_msg) + SZ_64K)
22 #define ES1_GBUF_MSG_SIZE_MAX   2048
23
24 static const struct usb_device_id id_table[] = {
25         /* Made up numbers for the SVC USB Bridge in ES2 */
26         { USB_DEVICE(0xffff, 0x0002) },
27         { },
28 };
29 MODULE_DEVICE_TABLE(usb, id_table);
30
31 #define APB1_LOG_SIZE           SZ_16K
32 static struct dentry *apb1_log_dentry;
33 static struct dentry *apb1_log_enable_dentry;
34 static struct task_struct *apb1_log_task;
35 static DEFINE_KFIFO(apb1_log_fifo, char, APB1_LOG_SIZE);
36
37 /*
38  * Number of CPort IN urbs in flight at any point in time.
39  * Adjust if we are having stalls in the USB buffer due to not enough urbs in
40  * flight.
41  */
42 #define NUM_CPORT_IN_URB        4
43
44 /* Number of CPort OUT urbs in flight at any point in time.
45  * Adjust if we get messages saying we are out of urbs in the system log.
46  */
47 #define NUM_CPORT_OUT_URB       8
48
49 /* vendor request AP message */
50 #define REQUEST_SVC             0x01
51
52 /* vendor request APB1 log */
53 #define REQUEST_LOG             0x02
54
55 /*
56  * @endpoint: bulk in endpoint for CPort data
57  * @urb: array of urbs for the CPort in messages
58  * @buffer: array of buffers for the @cport_in_urb urbs
59  */
60 struct es1_cport_in {
61         __u8 endpoint;
62         struct urb *urb[NUM_CPORT_IN_URB];
63         u8 *buffer[NUM_CPORT_IN_URB];
64 };
65
66 /*
67  * @endpoint: bulk out endpoint for CPort data
68  */
69 struct es1_cport_out {
70         __u8 endpoint;
71 };
72
73 /**
74  * es1_ap_dev - ES1 USB Bridge to AP structure
75  * @usb_dev: pointer to the USB device we are.
76  * @usb_intf: pointer to the USB interface we are bound to.
77  * @hd: pointer to our greybus_host_device structure
78  * @control_endpoint: endpoint to send data to SVC
79  * @svc_endpoint: endpoint for SVC data in
80
81  * @svc_buffer: buffer for SVC messages coming in on @svc_endpoint
82  * @svc_urb: urb for SVC messages coming in on @svc_endpoint
83  * @cport_in: endpoint, urbs and buffer for cport in messages
84  * @cport_out: endpoint for for cport out messages
85  * @cport_out_urb: array of urbs for the CPort out messages
86  * @cport_out_urb_busy: array of flags to see if the @cport_out_urb is busy or
87  *                      not.
88  * @cport_out_urb_lock: locks the @cport_out_urb_busy "list"
89  */
90 struct es1_ap_dev {
91         struct usb_device *usb_dev;
92         struct usb_interface *usb_intf;
93         struct greybus_host_device *hd;
94
95         __u8 control_endpoint;
96         __u8 svc_endpoint;
97
98         u8 *svc_buffer;
99         struct urb *svc_urb;
100
101         struct es1_cport_in cport_in;
102         struct es1_cport_out cport_out;
103         struct urb *cport_out_urb[NUM_CPORT_OUT_URB];
104         bool cport_out_urb_busy[NUM_CPORT_OUT_URB];
105         spinlock_t cport_out_urb_lock;
106 };
107
108 static inline struct es1_ap_dev *hd_to_es1(struct greybus_host_device *hd)
109 {
110         return (struct es1_ap_dev *)&hd->hd_priv;
111 }
112
113 static void cport_out_callback(struct urb *urb);
114 static void usb_log_enable(struct es1_ap_dev *es1);
115 static void usb_log_disable(struct es1_ap_dev *es1);
116
117 #define ES1_TIMEOUT     500     /* 500 ms for the SVC to do something */
118 static int submit_svc(struct svc_msg *svc_msg, struct greybus_host_device *hd)
119 {
120         struct es1_ap_dev *es1 = hd_to_es1(hd);
121         int retval;
122
123         /* SVC messages go down our control pipe */
124         retval = usb_control_msg(es1->usb_dev,
125                                  usb_sndctrlpipe(es1->usb_dev,
126                                                  es1->control_endpoint),
127                                  REQUEST_SVC,
128                                  USB_DIR_OUT | USB_TYPE_VENDOR | USB_RECIP_INTERFACE,
129                                  0x00, 0x00,
130                                  (char *)svc_msg,
131                                  sizeof(*svc_msg),
132                                  ES1_TIMEOUT);
133         if (retval != sizeof(*svc_msg))
134                 return retval;
135
136         return 0;
137 }
138
139 static struct urb *next_free_urb(struct es1_ap_dev *es1, gfp_t gfp_mask)
140 {
141         struct urb *urb = NULL;
142         unsigned long flags;
143         int i;
144
145         spin_lock_irqsave(&es1->cport_out_urb_lock, flags);
146
147         /* Look in our pool of allocated urbs first, as that's the "fastest" */
148         for (i = 0; i < NUM_CPORT_OUT_URB; ++i) {
149                 if (es1->cport_out_urb_busy[i] == false) {
150                         es1->cport_out_urb_busy[i] = true;
151                         urb = es1->cport_out_urb[i];
152                         break;
153                 }
154         }
155         spin_unlock_irqrestore(&es1->cport_out_urb_lock, flags);
156         if (urb)
157                 return urb;
158
159         /*
160          * Crap, pool is empty, complain to the syslog and go allocate one
161          * dynamically as we have to succeed.
162          */
163         dev_err(&es1->usb_dev->dev,
164                 "No free CPort OUT urbs, having to dynamically allocate one!\n");
165         return usb_alloc_urb(0, gfp_mask);
166 }
167
168 static void free_urb(struct es1_ap_dev *es1, struct urb *urb)
169 {
170         unsigned long flags;
171         int i;
172         /*
173          * See if this was an urb in our pool, if so mark it "free", otherwise
174          * we need to free it ourselves.
175          */
176         spin_lock_irqsave(&es1->cport_out_urb_lock, flags);
177         for (i = 0; i < NUM_CPORT_OUT_URB; ++i) {
178                 if (urb == es1->cport_out_urb[i]) {
179                         es1->cport_out_urb_busy[i] = false;
180                         urb = NULL;
181                         break;
182                 }
183         }
184         spin_unlock_irqrestore(&es1->cport_out_urb_lock, flags);
185
186         /* If urb is not NULL, then we need to free this urb */
187         usb_free_urb(urb);
188 }
189
190 /*
191  * Returns an opaque cookie value if successful, or a pointer coded
192  * error otherwise.  If the caller wishes to cancel the in-flight
193  * buffer, it must supply the returned cookie to the cancel routine.
194  */
195 static void *message_send(struct greybus_host_device *hd, u16 cport_id,
196                         struct gb_message *message, gfp_t gfp_mask)
197 {
198         struct es1_ap_dev *es1 = hd_to_es1(hd);
199         struct usb_device *udev = es1->usb_dev;
200         void *buffer;
201         size_t buffer_size;
202         int retval;
203         struct urb *urb;
204
205         buffer = message->buffer;
206         buffer_size = sizeof(*message->header) + message->payload_size;
207
208         /*
209          * The data actually transferred will include an indication
210          * of where the data should be sent.  Do one last check of
211          * the target CPort id before filling it in.
212          */
213         if (cport_id == CPORT_ID_BAD) {
214                 pr_err("request to send inbound data buffer\n");
215                 return ERR_PTR(-EINVAL);
216         }
217
218         /* Find a free urb */
219         urb = next_free_urb(es1, gfp_mask);
220         if (!urb)
221                 return ERR_PTR(-ENOMEM);
222
223         /*
224          * We (ab)use the operation-message header pad bytes to transfer the
225          * cport id in order to minimise overhead.
226          */
227         put_unaligned_le16(cport_id, message->header->pad);
228
229         usb_fill_bulk_urb(urb, udev,
230                           usb_sndbulkpipe(udev, es1->cport_out.endpoint),
231                           buffer, buffer_size,
232                           cport_out_callback, message);
233         retval = usb_submit_urb(urb, gfp_mask);
234         if (retval) {
235                 pr_err("error %d submitting URB\n", retval);
236                 free_urb(es1, urb);
237                 put_unaligned_le16(0, message->header->pad);
238                 return ERR_PTR(retval);
239         }
240
241         return urb;
242 }
243
244 /*
245  * The cookie value supplied is the value that message_send()
246  * returned to its caller.  It identifies the message that should be
247  * canceled.  This function must also handle (which is to say,
248  * ignore) a null cookie value.
249  */
250 static void message_cancel(void *cookie)
251 {
252
253         /*
254          * We really should be defensive and track all outstanding
255          * (sent) messages rather than trusting the cookie provided
256          * is valid.  For the time being, this will do.
257          */
258         if (cookie)
259                 usb_kill_urb(cookie);
260 }
261
262 static struct greybus_host_driver es1_driver = {
263         .hd_priv_size           = sizeof(struct es1_ap_dev),
264         .message_send           = message_send,
265         .message_cancel         = message_cancel,
266         .submit_svc             = submit_svc,
267 };
268
269 /* Common function to report consistent warnings based on URB status */
270 static int check_urb_status(struct urb *urb)
271 {
272         struct device *dev = &urb->dev->dev;
273         int status = urb->status;
274
275         switch (status) {
276         case 0:
277                 return 0;
278
279         case -EOVERFLOW:
280                 dev_err(dev, "%s: overflow actual length is %d\n",
281                         __func__, urb->actual_length);
282         case -ECONNRESET:
283         case -ENOENT:
284         case -ESHUTDOWN:
285         case -EILSEQ:
286         case -EPROTO:
287                 /* device is gone, stop sending */
288                 return status;
289         }
290         dev_err(dev, "%s: unknown status %d\n", __func__, status);
291
292         return -EAGAIN;
293 }
294
295 static void ap_disconnect(struct usb_interface *interface)
296 {
297         struct es1_ap_dev *es1;
298         struct usb_device *udev;
299         int i;
300
301         es1 = usb_get_intfdata(interface);
302         if (!es1)
303                 return;
304
305         usb_log_disable(es1);
306
307         /* Tear down everything! */
308         for (i = 0; i < NUM_CPORT_OUT_URB; ++i) {
309                 struct urb *urb = es1->cport_out_urb[i];
310
311                 if (!urb)
312                         break;
313                 usb_kill_urb(urb);
314                 usb_free_urb(urb);
315                 es1->cport_out_urb[i] = NULL;
316                 es1->cport_out_urb_busy[i] = false;     /* just to be anal */
317         }
318
319         for (i = 0; i < NUM_CPORT_IN_URB; ++i) {
320                 struct urb *urb = es1->cport_in.urb[i];
321
322                 if (!urb)
323                         break;
324                 usb_kill_urb(urb);
325                 usb_free_urb(urb);
326                 kfree(es1->cport_in.buffer[i]);
327                 es1->cport_in.buffer[i] = NULL;
328         }
329
330         usb_kill_urb(es1->svc_urb);
331         usb_free_urb(es1->svc_urb);
332         es1->svc_urb = NULL;
333         kfree(es1->svc_buffer);
334         es1->svc_buffer = NULL;
335
336         usb_set_intfdata(interface, NULL);
337         udev = es1->usb_dev;
338         greybus_remove_hd(es1->hd);
339
340         usb_put_dev(udev);
341 }
342
343 /* Callback for when we get a SVC message */
344 static void svc_in_callback(struct urb *urb)
345 {
346         struct greybus_host_device *hd = urb->context;
347         struct device *dev = &urb->dev->dev;
348         int status = check_urb_status(urb);
349         int retval;
350
351         if (status) {
352                 if ((status == -EAGAIN) || (status == -EPROTO))
353                         goto exit;
354                 dev_err(dev, "urb svc in error %d (dropped)\n", status);
355                 return;
356         }
357
358         /* We have a message, create a new message structure, add it to the
359          * list, and wake up our thread that will process the messages.
360          */
361         greybus_svc_in(hd, urb->transfer_buffer, urb->actual_length);
362
363 exit:
364         /* resubmit the urb to get more messages */
365         retval = usb_submit_urb(urb, GFP_ATOMIC);
366         if (retval)
367                 dev_err(dev, "Can not submit urb for AP data: %d\n", retval);
368 }
369
370 static void cport_in_callback(struct urb *urb)
371 {
372         struct greybus_host_device *hd = urb->context;
373         struct device *dev = &urb->dev->dev;
374         struct gb_operation_msg_hdr *header;
375         int status = check_urb_status(urb);
376         int retval;
377         u16 cport_id;
378
379         if (status) {
380                 if ((status == -EAGAIN) || (status == -EPROTO))
381                         goto exit;
382                 dev_err(dev, "urb cport in error %d (dropped)\n", status);
383                 return;
384         }
385
386         if (urb->actual_length < sizeof(*header)) {
387                 dev_err(dev, "%s: short message received\n", __func__);
388                 goto exit;
389         }
390
391         header = urb->transfer_buffer;
392         cport_id = get_unaligned_le16(header->pad);
393         put_unaligned_le16(0, header->pad);
394
395         greybus_data_rcvd(hd, cport_id, urb->transfer_buffer,
396                                                         urb->actual_length);
397 exit:
398         /* put our urb back in the request pool */
399         retval = usb_submit_urb(urb, GFP_ATOMIC);
400         if (retval)
401                 dev_err(dev, "%s: error %d in submitting urb.\n",
402                         __func__, retval);
403 }
404
405 static void cport_out_callback(struct urb *urb)
406 {
407         struct gb_message *message = urb->context;
408         struct greybus_host_device *hd = message->operation->connection->hd;
409         struct es1_ap_dev *es1 = hd_to_es1(hd);
410         int status = check_urb_status(urb);
411
412         /* Clear the pad bytes used for the cport id */
413         put_unaligned_le16(0, message->header->pad);
414
415         /*
416          * Tell the submitter that the message send (attempt) is
417          * complete, and report the status.
418          */
419         greybus_message_sent(hd, message, status);
420
421         free_urb(es1, urb);
422 }
423
424 #define APB1_LOG_MSG_SIZE       64
425 static void apb1_log_get(struct es1_ap_dev *es1, char *buf)
426 {
427         int retval;
428
429         /* SVC messages go down our control pipe */
430         do {
431                 retval = usb_control_msg(es1->usb_dev,
432                                         usb_rcvctrlpipe(es1->usb_dev,
433                                                         es1->control_endpoint),
434                                         REQUEST_LOG,
435                                         USB_DIR_IN | USB_TYPE_VENDOR | USB_RECIP_INTERFACE,
436                                         0x00, 0x00,
437                                         buf,
438                                         APB1_LOG_MSG_SIZE,
439                                         ES1_TIMEOUT);
440                 if (retval > 0)
441                         kfifo_in(&apb1_log_fifo, buf, retval);
442         } while (retval > 0);
443 }
444
445 static int apb1_log_poll(void *data)
446 {
447         struct es1_ap_dev *es1 = data;
448         char *buf;
449
450         buf = kmalloc(APB1_LOG_MSG_SIZE, GFP_KERNEL);
451         if (!buf)
452                 return -ENOMEM;
453
454         while (!kthread_should_stop()) {
455                 msleep(1000);
456                 apb1_log_get(es1, buf);
457         }
458
459         kfree(buf);
460
461         return 0;
462 }
463
464 static ssize_t apb1_log_read(struct file *f, char __user *buf,
465                                 size_t count, loff_t *ppos)
466 {
467         ssize_t ret;
468         size_t copied;
469         char *tmp_buf;
470
471         if (count > APB1_LOG_SIZE)
472                 count = APB1_LOG_SIZE;
473
474         tmp_buf = kmalloc(count, GFP_KERNEL);
475         if (!tmp_buf)
476                 return -ENOMEM;
477
478         copied = kfifo_out(&apb1_log_fifo, tmp_buf, count);
479         ret = simple_read_from_buffer(buf, count, ppos, tmp_buf, copied);
480
481         kfree(tmp_buf);
482
483         return ret;
484 }
485
486 static const struct file_operations apb1_log_fops = {
487         .read   = apb1_log_read,
488 };
489
490 static void usb_log_enable(struct es1_ap_dev *es1)
491 {
492         if (!IS_ERR_OR_NULL(apb1_log_task))
493                 return;
494
495         /* get log from APB1 */
496         apb1_log_task = kthread_run(apb1_log_poll, es1, "apb1_log");
497         if (IS_ERR(apb1_log_task))
498                 return;
499         apb1_log_dentry = debugfs_create_file("apb1_log", S_IRUGO,
500                                                 gb_debugfs_get(), NULL,
501                                                 &apb1_log_fops);
502 }
503
504 static void usb_log_disable(struct es1_ap_dev *es1)
505 {
506         if (IS_ERR_OR_NULL(apb1_log_task))
507                 return;
508
509         debugfs_remove(apb1_log_dentry);
510         apb1_log_dentry = NULL;
511
512         kthread_stop(apb1_log_task);
513         apb1_log_task = NULL;
514 }
515
516 static ssize_t apb1_log_enable_read(struct file *f, char __user *buf,
517                                 size_t count, loff_t *ppos)
518 {
519         char tmp_buf[3];
520         int enable = !IS_ERR_OR_NULL(apb1_log_task);
521
522         sprintf(tmp_buf, "%d\n", enable);
523         return simple_read_from_buffer(buf, count, ppos, tmp_buf, 3);
524 }
525
526 static ssize_t apb1_log_enable_write(struct file *f, const char __user *buf,
527                                 size_t count, loff_t *ppos)
528 {
529         int enable;
530         ssize_t retval;
531         struct es1_ap_dev *es1 = (struct es1_ap_dev *)f->f_inode->i_private;
532
533         retval = kstrtoint_from_user(buf, count, 10, &enable);
534         if (retval)
535                 return retval;
536
537         if (enable)
538                 usb_log_enable(es1);
539         else
540                 usb_log_disable(es1);
541
542         return count;
543 }
544
545 static const struct file_operations apb1_log_enable_fops = {
546         .read   = apb1_log_enable_read,
547         .write  = apb1_log_enable_write,
548 };
549
550 /*
551  * The ES1 USB Bridge device contains 4 endpoints
552  * 1 Control - usual USB stuff + AP -> SVC messages
553  * 1 Interrupt IN - SVC -> AP messages
554  * 1 Bulk IN - CPort data in
555  * 1 Bulk OUT - CPort data out
556  */
557 static int ap_probe(struct usb_interface *interface,
558                     const struct usb_device_id *id)
559 {
560         struct es1_ap_dev *es1;
561         struct greybus_host_device *hd;
562         struct usb_device *udev;
563         struct usb_host_interface *iface_desc;
564         struct usb_endpoint_descriptor *endpoint;
565         bool int_in_found = false;
566         bool bulk_in_found = false;
567         bool bulk_out_found = false;
568         int retval = -ENOMEM;
569         int i;
570         u16 endo_id = 0x4755;   // FIXME - get endo "ID" from the SVC
571         u8 ap_intf_id = 0x01;   // FIXME - get endo "ID" from the SVC
572         u8 svc_interval = 0;
573
574         udev = usb_get_dev(interface_to_usbdev(interface));
575
576         hd = greybus_create_hd(&es1_driver, &udev->dev, ES1_GBUF_MSG_SIZE_MAX);
577         if (IS_ERR(hd)) {
578                 usb_put_dev(udev);
579                 return PTR_ERR(hd);
580         }
581
582         es1 = hd_to_es1(hd);
583         es1->hd = hd;
584         es1->usb_intf = interface;
585         es1->usb_dev = udev;
586         spin_lock_init(&es1->cport_out_urb_lock);
587         usb_set_intfdata(interface, es1);
588
589         /* Control endpoint is the pipe to talk to this AP, so save it off */
590         endpoint = &udev->ep0.desc;
591         es1->control_endpoint = endpoint->bEndpointAddress;
592
593         /* find all 3 of our endpoints */
594         iface_desc = interface->cur_altsetting;
595         for (i = 0; i < iface_desc->desc.bNumEndpoints; ++i) {
596                 endpoint = &iface_desc->endpoint[i].desc;
597
598                 if (usb_endpoint_is_int_in(endpoint)) {
599                         es1->svc_endpoint = endpoint->bEndpointAddress;
600                         svc_interval = endpoint->bInterval;
601                         int_in_found = true;
602                 } else if (usb_endpoint_is_bulk_in(endpoint)) {
603                         es1->cport_in.endpoint = endpoint->bEndpointAddress;
604                         bulk_in_found = true;
605                 } else if (usb_endpoint_is_bulk_out(endpoint)) {
606                         es1->cport_out.endpoint = endpoint->bEndpointAddress;
607                         bulk_out_found = true;
608                 } else {
609                         dev_err(&udev->dev,
610                                 "Unknown endpoint type found, address %x\n",
611                                 endpoint->bEndpointAddress);
612                 }
613         }
614         if ((int_in_found == false) ||
615             (bulk_in_found == false) ||
616             (bulk_out_found == false)) {
617                 dev_err(&udev->dev, "Not enough endpoints found in device, aborting!\n");
618                 goto error;
619         }
620
621         /* Create our buffer and URB to get SVC messages, and start it up */
622         es1->svc_buffer = kmalloc(ES1_SVC_MSG_SIZE, GFP_KERNEL);
623         if (!es1->svc_buffer)
624                 goto error;
625
626         es1->svc_urb = usb_alloc_urb(0, GFP_KERNEL);
627         if (!es1->svc_urb)
628                 goto error;
629
630         usb_fill_int_urb(es1->svc_urb, udev,
631                          usb_rcvintpipe(udev, es1->svc_endpoint),
632                          es1->svc_buffer, ES1_SVC_MSG_SIZE, svc_in_callback,
633                          hd, svc_interval);
634
635         /* Allocate buffers for our cport in messages and start them up */
636         for (i = 0; i < NUM_CPORT_IN_URB; ++i) {
637                 struct urb *urb;
638                 u8 *buffer;
639
640                 urb = usb_alloc_urb(0, GFP_KERNEL);
641                 if (!urb)
642                         goto error;
643                 buffer = kmalloc(ES1_GBUF_MSG_SIZE_MAX, GFP_KERNEL);
644                 if (!buffer)
645                         goto error;
646
647                 usb_fill_bulk_urb(urb, udev,
648                                   usb_rcvbulkpipe(udev, es1->cport_in.endpoint),
649                                   buffer, ES1_GBUF_MSG_SIZE_MAX,
650                                   cport_in_callback, hd);
651                 es1->cport_in.urb[i] = urb;
652                 es1->cport_in.buffer[i] = buffer;
653                 retval = usb_submit_urb(urb, GFP_KERNEL);
654                 if (retval)
655                         goto error;
656         }
657
658         /* Allocate urbs for our CPort OUT messages */
659         for (i = 0; i < NUM_CPORT_OUT_URB; ++i) {
660                 struct urb *urb;
661
662                 urb = usb_alloc_urb(0, GFP_KERNEL);
663                 if (!urb)
664                         goto error;
665
666                 es1->cport_out_urb[i] = urb;
667                 es1->cport_out_urb_busy[i] = false;     /* just to be anal */
668         }
669
670         /* Start up our svc urb, which allows events to start flowing */
671         retval = usb_submit_urb(es1->svc_urb, GFP_KERNEL);
672         if (retval)
673                 goto error;
674
675         apb1_log_enable_dentry = debugfs_create_file("apb1_log_enable",
676                                                         (S_IWUSR | S_IRUGO),
677                                                         gb_debugfs_get(), es1,
678                                                         &apb1_log_enable_fops);
679
680         /*
681          * XXX Soon this will be initiated later, with a combination
682          * XXX of a Control protocol probe operation and a
683          * XXX subsequent Control protocol connected operation for
684          * XXX the SVC connection.  At that point we know we're
685          * XXX properly connected to an Endo.
686          */
687         retval = greybus_endo_setup(hd, endo_id, ap_intf_id);
688         if (retval)
689                 goto error;
690
691         return 0;
692 error:
693         ap_disconnect(interface);
694
695         return retval;
696 }
697
698 static struct usb_driver es1_ap_driver = {
699         .name =         "es2_ap_driver",
700         .probe =        ap_probe,
701         .disconnect =   ap_disconnect,
702         .id_table =     id_table,
703 };
704
705 module_usb_driver(es1_ap_driver);
706
707 MODULE_LICENSE("GPL v2");
708 MODULE_AUTHOR("Greg Kroah-Hartman <gregkh@linuxfoundation.org>");