Vamsi Krishna | 5b94471 | 2012-06-29 18:36:23 -0700 | [diff] [blame] | 1 | /* |
| 2 | * Copyright (c) 2012, Code Aurora Forum. All rights reserved. |
| 3 | * |
| 4 | * This program is free software; you can redistribute it and/or modify |
| 5 | * it under the terms of the GNU General Public License version 2 and |
| 6 | * only version 2 as published by the Free Software Foundation. |
| 7 | * |
| 8 | * This program is distributed in the hope that it will be useful, |
| 9 | * but WITHOUT ANY WARRANTY; without even the implied warranty of |
| 10 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
| 11 | * GNU General Public License for more details. |
| 12 | */ |
| 13 | |
| 14 | /* add additional information to our printk's */ |
| 15 | #define pr_fmt(fmt) "%s: " fmt "\n", __func__ |
| 16 | |
| 17 | #include <linux/kernel.h> |
| 18 | #include <linux/errno.h> |
| 19 | #include <linux/init.h> |
| 20 | #include <linux/slab.h> |
| 21 | #include <linux/module.h> |
| 22 | #include <linux/kref.h> |
| 23 | #include <linux/platform_device.h> |
| 24 | #include <linux/ratelimit.h> |
| 25 | #include <linux/uaccess.h> |
| 26 | #include <linux/usb.h> |
| 27 | #include <linux/debugfs.h> |
| 28 | #include <linux/seq_file.h> |
| 29 | #include <linux/miscdevice.h> |
| 30 | #include <linux/list.h> |
| 31 | #include <linux/wait.h> |
| 32 | |
| 33 | #define DRIVER_DESC "USB host ks bridge driver" |
| 34 | #define DRIVER_VERSION "1.0" |
| 35 | |
| 36 | struct data_pkt { |
| 37 | int n_read; |
| 38 | char *buf; |
| 39 | size_t len; |
| 40 | struct list_head list; |
| 41 | void *ctxt; |
| 42 | }; |
| 43 | |
| 44 | #define FILE_OPENED BIT(0) |
| 45 | #define USB_DEV_CONNECTED BIT(1) |
| 46 | #define NO_RX_REQS 10 |
| 47 | #define NO_BRIDGE_INSTANCES 2 |
| 48 | #define BOOT_BRIDGE_INDEX 0 |
| 49 | #define EFS_BRIDGE_INDEX 1 |
| 50 | #define MAX_DATA_PKT_SIZE 16384 |
Hemant Kumar | b3779d1 | 2012-09-16 20:28:56 -0700 | [diff] [blame] | 51 | #define PENDING_URB_TIMEOUT 10 |
Vamsi Krishna | 5b94471 | 2012-06-29 18:36:23 -0700 | [diff] [blame] | 52 | |
| 53 | struct ks_bridge { |
| 54 | char *name; |
| 55 | spinlock_t lock; |
| 56 | struct workqueue_struct *wq; |
| 57 | struct work_struct to_mdm_work; |
| 58 | struct work_struct start_rx_work; |
| 59 | struct list_head to_mdm_list; |
| 60 | struct list_head to_ks_list; |
| 61 | wait_queue_head_t ks_wait_q; |
Hemant Kumar | b3779d1 | 2012-09-16 20:28:56 -0700 | [diff] [blame] | 62 | wait_queue_head_t pending_urb_wait; |
Hemant Kumar | da86bd2 | 2012-08-24 19:42:31 -0700 | [diff] [blame] | 63 | struct miscdevice *fs_dev; |
Hemant Kumar | b3779d1 | 2012-09-16 20:28:56 -0700 | [diff] [blame] | 64 | atomic_t tx_pending_cnt; |
| 65 | atomic_t rx_pending_cnt; |
Vamsi Krishna | 5b94471 | 2012-06-29 18:36:23 -0700 | [diff] [blame] | 66 | |
| 67 | /* usb specific */ |
| 68 | struct usb_device *udev; |
| 69 | struct usb_interface *ifc; |
| 70 | __u8 in_epAddr; |
| 71 | __u8 out_epAddr; |
| 72 | unsigned int in_pipe; |
| 73 | unsigned int out_pipe; |
| 74 | struct usb_anchor submitted; |
| 75 | |
| 76 | unsigned long flags; |
Vamsi Krishna | 5b94471 | 2012-06-29 18:36:23 -0700 | [diff] [blame] | 77 | |
| 78 | #define DBG_MSG_LEN 40 |
| 79 | #define DBG_MAX_MSG 500 |
| 80 | unsigned int dbg_idx; |
| 81 | rwlock_t dbg_lock; |
| 82 | char (dbgbuf[DBG_MAX_MSG])[DBG_MSG_LEN]; /* buffer */ |
| 83 | }; |
| 84 | struct ks_bridge *__ksb[NO_BRIDGE_INSTANCES]; |
| 85 | |
| 86 | /* by default debugging is enabled */ |
| 87 | static unsigned int enable_dbg = 1; |
| 88 | module_param(enable_dbg, uint, S_IRUGO | S_IWUSR); |
| 89 | |
| 90 | static void |
| 91 | dbg_log_event(struct ks_bridge *ksb, char *event, int d1, int d2) |
| 92 | { |
| 93 | unsigned long flags; |
| 94 | unsigned long long t; |
| 95 | unsigned long nanosec; |
| 96 | |
| 97 | if (!enable_dbg) |
| 98 | return; |
| 99 | |
| 100 | write_lock_irqsave(&ksb->dbg_lock, flags); |
| 101 | t = cpu_clock(smp_processor_id()); |
| 102 | nanosec = do_div(t, 1000000000)/1000; |
| 103 | scnprintf(ksb->dbgbuf[ksb->dbg_idx], DBG_MSG_LEN, "%5lu.%06lu:%s:%x:%x", |
| 104 | (unsigned long)t, nanosec, event, d1, d2); |
| 105 | |
| 106 | ksb->dbg_idx++; |
| 107 | ksb->dbg_idx = ksb->dbg_idx % DBG_MAX_MSG; |
| 108 | write_unlock_irqrestore(&ksb->dbg_lock, flags); |
| 109 | } |
| 110 | |
| 111 | static |
| 112 | struct data_pkt *ksb_alloc_data_pkt(size_t count, gfp_t flags, void *ctxt) |
| 113 | { |
| 114 | struct data_pkt *pkt; |
| 115 | |
| 116 | pkt = kzalloc(sizeof(struct data_pkt), flags); |
| 117 | if (!pkt) { |
| 118 | pr_err("failed to allocate data packet\n"); |
| 119 | return ERR_PTR(-ENOMEM); |
| 120 | } |
| 121 | |
| 122 | pkt->buf = kmalloc(count, flags); |
| 123 | if (!pkt->buf) { |
| 124 | pr_err("failed to allocate data buffer\n"); |
| 125 | kfree(pkt); |
| 126 | return ERR_PTR(-ENOMEM); |
| 127 | } |
| 128 | |
| 129 | pkt->len = count; |
| 130 | INIT_LIST_HEAD(&pkt->list); |
| 131 | pkt->ctxt = ctxt; |
| 132 | |
| 133 | return pkt; |
| 134 | } |
| 135 | |
| 136 | static void ksb_free_data_pkt(struct data_pkt *pkt) |
| 137 | { |
| 138 | kfree(pkt->buf); |
| 139 | kfree(pkt); |
| 140 | } |
| 141 | |
| 142 | |
Pavankumar Kondeti | 5c915c1 | 2012-12-14 15:12:46 +0530 | [diff] [blame] | 143 | static void |
| 144 | submit_one_urb(struct ks_bridge *ksb, gfp_t flags, struct data_pkt *pkt); |
Vamsi Krishna | 5b94471 | 2012-06-29 18:36:23 -0700 | [diff] [blame] | 145 | static ssize_t ksb_fs_read(struct file *fp, char __user *buf, |
| 146 | size_t count, loff_t *pos) |
| 147 | { |
| 148 | int ret; |
| 149 | unsigned long flags; |
| 150 | struct ks_bridge *ksb = fp->private_data; |
| 151 | struct data_pkt *pkt; |
| 152 | size_t space, copied; |
| 153 | |
| 154 | read_start: |
| 155 | if (!test_bit(USB_DEV_CONNECTED, &ksb->flags)) |
| 156 | return -ENODEV; |
| 157 | |
| 158 | spin_lock_irqsave(&ksb->lock, flags); |
| 159 | if (list_empty(&ksb->to_ks_list)) { |
| 160 | spin_unlock_irqrestore(&ksb->lock, flags); |
| 161 | ret = wait_event_interruptible(ksb->ks_wait_q, |
| 162 | !list_empty(&ksb->to_ks_list) || |
| 163 | !test_bit(USB_DEV_CONNECTED, &ksb->flags)); |
| 164 | if (ret < 0) |
| 165 | return ret; |
| 166 | |
| 167 | goto read_start; |
| 168 | } |
| 169 | |
| 170 | space = count; |
| 171 | copied = 0; |
| 172 | while (!list_empty(&ksb->to_ks_list) && space) { |
| 173 | size_t len; |
| 174 | |
| 175 | pkt = list_first_entry(&ksb->to_ks_list, struct data_pkt, list); |
Hemant Kumar | b48f473 | 2012-09-24 12:32:32 -0700 | [diff] [blame] | 176 | len = min_t(size_t, space, pkt->len - pkt->n_read); |
Vamsi Krishna | 5b94471 | 2012-06-29 18:36:23 -0700 | [diff] [blame] | 177 | spin_unlock_irqrestore(&ksb->lock, flags); |
| 178 | |
Hemant Kumar | b48f473 | 2012-09-24 12:32:32 -0700 | [diff] [blame] | 179 | ret = copy_to_user(buf + copied, pkt->buf + pkt->n_read, len); |
Vamsi Krishna | 5b94471 | 2012-06-29 18:36:23 -0700 | [diff] [blame] | 180 | if (ret) { |
| 181 | pr_err("copy_to_user failed err:%d\n", ret); |
| 182 | ksb_free_data_pkt(pkt); |
Vamsi Krishna | 5b94471 | 2012-06-29 18:36:23 -0700 | [diff] [blame] | 183 | return ret; |
| 184 | } |
| 185 | |
Hemant Kumar | b48f473 | 2012-09-24 12:32:32 -0700 | [diff] [blame] | 186 | pkt->n_read += len; |
Vamsi Krishna | 5b94471 | 2012-06-29 18:36:23 -0700 | [diff] [blame] | 187 | space -= len; |
| 188 | copied += len; |
| 189 | |
| 190 | spin_lock_irqsave(&ksb->lock, flags); |
| 191 | if (pkt->n_read == pkt->len) { |
Pavankumar Kondeti | 5c915c1 | 2012-12-14 15:12:46 +0530 | [diff] [blame] | 192 | /* |
| 193 | * re-init the packet and queue it |
| 194 | * for more data. |
| 195 | */ |
Vamsi Krishna | 5b94471 | 2012-06-29 18:36:23 -0700 | [diff] [blame] | 196 | list_del_init(&pkt->list); |
Pavankumar Kondeti | 5c915c1 | 2012-12-14 15:12:46 +0530 | [diff] [blame] | 197 | pkt->n_read = 0; |
| 198 | pkt->len = MAX_DATA_PKT_SIZE; |
| 199 | spin_unlock_irqrestore(&ksb->lock, flags); |
| 200 | submit_one_urb(ksb, GFP_KERNEL, pkt); |
| 201 | spin_lock_irqsave(&ksb->lock, flags); |
Vamsi Krishna | 5b94471 | 2012-06-29 18:36:23 -0700 | [diff] [blame] | 202 | } |
| 203 | } |
| 204 | spin_unlock_irqrestore(&ksb->lock, flags); |
| 205 | |
| 206 | dbg_log_event(ksb, "KS_READ", copied, 0); |
| 207 | |
| 208 | pr_debug("count:%d space:%d copied:%d", count, space, copied); |
| 209 | |
| 210 | return copied; |
| 211 | } |
| 212 | |
| 213 | static void ksb_tx_cb(struct urb *urb) |
| 214 | { |
| 215 | struct data_pkt *pkt = urb->context; |
| 216 | struct ks_bridge *ksb = pkt->ctxt; |
| 217 | |
| 218 | dbg_log_event(ksb, "C TX_URB", urb->status, 0); |
| 219 | pr_debug("status:%d", urb->status); |
| 220 | |
Hemant Kumar | b3779d1 | 2012-09-16 20:28:56 -0700 | [diff] [blame] | 221 | if (test_bit(USB_DEV_CONNECTED, &ksb->flags)) |
Vamsi Krishna | 5b94471 | 2012-06-29 18:36:23 -0700 | [diff] [blame] | 222 | usb_autopm_put_interface_async(ksb->ifc); |
| 223 | |
| 224 | if (urb->status < 0) |
| 225 | pr_err_ratelimited("urb failed with err:%d", urb->status); |
| 226 | |
| 227 | ksb_free_data_pkt(pkt); |
Hemant Kumar | b3779d1 | 2012-09-16 20:28:56 -0700 | [diff] [blame] | 228 | |
| 229 | atomic_dec(&ksb->tx_pending_cnt); |
| 230 | wake_up(&ksb->pending_urb_wait); |
Vamsi Krishna | 5b94471 | 2012-06-29 18:36:23 -0700 | [diff] [blame] | 231 | } |
| 232 | |
| 233 | static void ksb_tomdm_work(struct work_struct *w) |
| 234 | { |
| 235 | struct ks_bridge *ksb = container_of(w, struct ks_bridge, to_mdm_work); |
| 236 | struct data_pkt *pkt; |
| 237 | unsigned long flags; |
| 238 | struct urb *urb; |
| 239 | int ret; |
| 240 | |
| 241 | spin_lock_irqsave(&ksb->lock, flags); |
| 242 | while (!list_empty(&ksb->to_mdm_list) |
| 243 | && test_bit(USB_DEV_CONNECTED, &ksb->flags)) { |
| 244 | pkt = list_first_entry(&ksb->to_mdm_list, |
| 245 | struct data_pkt, list); |
| 246 | list_del_init(&pkt->list); |
| 247 | spin_unlock_irqrestore(&ksb->lock, flags); |
| 248 | |
| 249 | urb = usb_alloc_urb(0, GFP_KERNEL); |
| 250 | if (!urb) { |
| 251 | pr_err_ratelimited("unable to allocate urb"); |
| 252 | ksb_free_data_pkt(pkt); |
| 253 | return; |
| 254 | } |
| 255 | |
| 256 | ret = usb_autopm_get_interface(ksb->ifc); |
| 257 | if (ret < 0 && ret != -EAGAIN && ret != -EACCES) { |
| 258 | pr_err_ratelimited("autopm_get failed:%d", ret); |
| 259 | usb_free_urb(urb); |
| 260 | ksb_free_data_pkt(pkt); |
| 261 | return; |
| 262 | } |
| 263 | usb_fill_bulk_urb(urb, ksb->udev, ksb->out_pipe, |
| 264 | pkt->buf, pkt->len, ksb_tx_cb, pkt); |
| 265 | usb_anchor_urb(urb, &ksb->submitted); |
| 266 | |
| 267 | dbg_log_event(ksb, "S TX_URB", pkt->len, 0); |
| 268 | |
Hemant Kumar | b3779d1 | 2012-09-16 20:28:56 -0700 | [diff] [blame] | 269 | atomic_inc(&ksb->tx_pending_cnt); |
Vamsi Krishna | 5b94471 | 2012-06-29 18:36:23 -0700 | [diff] [blame] | 270 | ret = usb_submit_urb(urb, GFP_KERNEL); |
| 271 | if (ret) { |
| 272 | pr_err("out urb submission failed"); |
| 273 | usb_unanchor_urb(urb); |
| 274 | usb_free_urb(urb); |
| 275 | ksb_free_data_pkt(pkt); |
| 276 | usb_autopm_put_interface(ksb->ifc); |
Hemant Kumar | b3779d1 | 2012-09-16 20:28:56 -0700 | [diff] [blame] | 277 | atomic_dec(&ksb->tx_pending_cnt); |
| 278 | wake_up(&ksb->pending_urb_wait); |
Vamsi Krishna | 5b94471 | 2012-06-29 18:36:23 -0700 | [diff] [blame] | 279 | return; |
| 280 | } |
| 281 | |
Hemant Kumar | 1432f6f | 2012-09-19 12:40:11 -0700 | [diff] [blame] | 282 | usb_free_urb(urb); |
| 283 | |
Vamsi Krishna | 5b94471 | 2012-06-29 18:36:23 -0700 | [diff] [blame] | 284 | spin_lock_irqsave(&ksb->lock, flags); |
| 285 | } |
| 286 | spin_unlock_irqrestore(&ksb->lock, flags); |
| 287 | } |
| 288 | |
| 289 | static ssize_t ksb_fs_write(struct file *fp, const char __user *buf, |
| 290 | size_t count, loff_t *pos) |
| 291 | { |
| 292 | int ret; |
| 293 | struct data_pkt *pkt; |
| 294 | unsigned long flags; |
| 295 | struct ks_bridge *ksb = fp->private_data; |
| 296 | |
Hemant Kumar | 2f20bda | 2012-09-17 14:05:54 -0700 | [diff] [blame] | 297 | if (!test_bit(USB_DEV_CONNECTED, &ksb->flags)) |
| 298 | return -ENODEV; |
| 299 | |
Vamsi Krishna | 5b94471 | 2012-06-29 18:36:23 -0700 | [diff] [blame] | 300 | pkt = ksb_alloc_data_pkt(count, GFP_KERNEL, ksb); |
| 301 | if (IS_ERR(pkt)) { |
| 302 | pr_err("unable to allocate data packet"); |
| 303 | return PTR_ERR(pkt); |
| 304 | } |
| 305 | |
| 306 | ret = copy_from_user(pkt->buf, buf, count); |
| 307 | if (ret) { |
| 308 | pr_err("copy_from_user failed: err:%d", ret); |
| 309 | ksb_free_data_pkt(pkt); |
| 310 | return ret; |
| 311 | } |
| 312 | |
| 313 | spin_lock_irqsave(&ksb->lock, flags); |
| 314 | list_add_tail(&pkt->list, &ksb->to_mdm_list); |
| 315 | spin_unlock_irqrestore(&ksb->lock, flags); |
| 316 | |
| 317 | queue_work(ksb->wq, &ksb->to_mdm_work); |
| 318 | |
| 319 | return count; |
| 320 | } |
| 321 | |
| 322 | static int efs_fs_open(struct inode *ip, struct file *fp) |
| 323 | { |
| 324 | struct ks_bridge *ksb = __ksb[EFS_BRIDGE_INDEX]; |
| 325 | |
| 326 | pr_debug(":%s", ksb->name); |
| 327 | dbg_log_event(ksb, "EFS-FS-OPEN", 0, 0); |
| 328 | |
| 329 | if (!ksb) { |
| 330 | pr_err("ksb is being removed"); |
| 331 | return -ENODEV; |
| 332 | } |
| 333 | |
| 334 | fp->private_data = ksb; |
| 335 | set_bit(FILE_OPENED, &ksb->flags); |
| 336 | |
| 337 | if (test_bit(USB_DEV_CONNECTED, &ksb->flags)) |
| 338 | queue_work(ksb->wq, &ksb->start_rx_work); |
| 339 | |
| 340 | return 0; |
| 341 | } |
| 342 | |
| 343 | static int ksb_fs_open(struct inode *ip, struct file *fp) |
| 344 | { |
| 345 | struct ks_bridge *ksb = __ksb[BOOT_BRIDGE_INDEX]; |
| 346 | |
| 347 | pr_debug(":%s", ksb->name); |
| 348 | dbg_log_event(ksb, "KS-FS-OPEN", 0, 0); |
| 349 | |
| 350 | if (!ksb) { |
| 351 | pr_err("ksb is being removed"); |
| 352 | return -ENODEV; |
| 353 | } |
| 354 | |
| 355 | fp->private_data = ksb; |
| 356 | set_bit(FILE_OPENED, &ksb->flags); |
| 357 | |
| 358 | if (test_bit(USB_DEV_CONNECTED, &ksb->flags)) |
| 359 | queue_work(ksb->wq, &ksb->start_rx_work); |
| 360 | |
| 361 | return 0; |
| 362 | } |
| 363 | |
| 364 | static int ksb_fs_release(struct inode *ip, struct file *fp) |
| 365 | { |
| 366 | struct ks_bridge *ksb = fp->private_data; |
| 367 | |
| 368 | pr_debug(":%s", ksb->name); |
| 369 | dbg_log_event(ksb, "FS-RELEASE", 0, 0); |
| 370 | |
| 371 | clear_bit(FILE_OPENED, &ksb->flags); |
| 372 | fp->private_data = NULL; |
| 373 | |
| 374 | return 0; |
| 375 | } |
| 376 | |
| 377 | static const struct file_operations ksb_fops = { |
| 378 | .owner = THIS_MODULE, |
| 379 | .read = ksb_fs_read, |
| 380 | .write = ksb_fs_write, |
| 381 | .open = ksb_fs_open, |
| 382 | .release = ksb_fs_release, |
| 383 | }; |
| 384 | |
| 385 | static struct miscdevice ksb_fboot_dev = { |
| 386 | .minor = MISC_DYNAMIC_MINOR, |
| 387 | .name = "ks_bridge", |
| 388 | .fops = &ksb_fops, |
| 389 | }; |
| 390 | |
| 391 | static const struct file_operations efs_fops = { |
| 392 | .owner = THIS_MODULE, |
| 393 | .read = ksb_fs_read, |
| 394 | .write = ksb_fs_write, |
| 395 | .open = efs_fs_open, |
| 396 | .release = ksb_fs_release, |
| 397 | }; |
| 398 | |
| 399 | static struct miscdevice ksb_efs_dev = { |
| 400 | .minor = MISC_DYNAMIC_MINOR, |
| 401 | .name = "efs_bridge", |
| 402 | .fops = &efs_fops, |
| 403 | }; |
| 404 | |
| 405 | static const struct usb_device_id ksb_usb_ids[] = { |
| 406 | { USB_DEVICE(0x5c6, 0x9008), |
| 407 | .driver_info = (unsigned long)&ksb_fboot_dev, }, |
| 408 | { USB_DEVICE(0x5c6, 0x9048), |
| 409 | .driver_info = (unsigned long)&ksb_efs_dev, }, |
| 410 | { USB_DEVICE(0x5c6, 0x904C), |
| 411 | .driver_info = (unsigned long)&ksb_efs_dev, }, |
Hemant Kumar | ce3c5bf | 2012-12-06 15:52:02 -0800 | [diff] [blame] | 412 | { USB_DEVICE(0x5c6, 0x9075), |
| 413 | .driver_info = (unsigned long)&ksb_efs_dev, }, |
Vamsi Krishna | 5b94471 | 2012-06-29 18:36:23 -0700 | [diff] [blame] | 414 | |
| 415 | {} /* terminating entry */ |
| 416 | }; |
| 417 | MODULE_DEVICE_TABLE(usb, ksb_usb_ids); |
| 418 | |
| 419 | static void ksb_rx_cb(struct urb *urb); |
Pavankumar Kondeti | 5c915c1 | 2012-12-14 15:12:46 +0530 | [diff] [blame] | 420 | static void |
| 421 | submit_one_urb(struct ks_bridge *ksb, gfp_t flags, struct data_pkt *pkt) |
Vamsi Krishna | 5b94471 | 2012-06-29 18:36:23 -0700 | [diff] [blame] | 422 | { |
Vamsi Krishna | 5b94471 | 2012-06-29 18:36:23 -0700 | [diff] [blame] | 423 | struct urb *urb; |
| 424 | int ret; |
| 425 | |
Pavankumar Kondeti | 5c915c1 | 2012-12-14 15:12:46 +0530 | [diff] [blame] | 426 | urb = usb_alloc_urb(0, flags); |
Vamsi Krishna | 5b94471 | 2012-06-29 18:36:23 -0700 | [diff] [blame] | 427 | if (!urb) { |
| 428 | pr_err("unable to allocate urb"); |
| 429 | ksb_free_data_pkt(pkt); |
| 430 | return; |
| 431 | } |
Vamsi Krishna | 5b94471 | 2012-06-29 18:36:23 -0700 | [diff] [blame] | 432 | |
| 433 | usb_fill_bulk_urb(urb, ksb->udev, ksb->in_pipe, |
| 434 | pkt->buf, pkt->len, |
| 435 | ksb_rx_cb, pkt); |
| 436 | usb_anchor_urb(urb, &ksb->submitted); |
| 437 | |
Hemant Kumar | b3779d1 | 2012-09-16 20:28:56 -0700 | [diff] [blame] | 438 | if (!test_bit(USB_DEV_CONNECTED, &ksb->flags)) { |
| 439 | usb_unanchor_urb(urb); |
| 440 | usb_free_urb(urb); |
| 441 | ksb_free_data_pkt(pkt); |
Hemant Kumar | b3779d1 | 2012-09-16 20:28:56 -0700 | [diff] [blame] | 442 | return; |
| 443 | } |
Vamsi Krishna | 5b94471 | 2012-06-29 18:36:23 -0700 | [diff] [blame] | 444 | |
Hemant Kumar | b3779d1 | 2012-09-16 20:28:56 -0700 | [diff] [blame] | 445 | atomic_inc(&ksb->rx_pending_cnt); |
Pavankumar Kondeti | 5c915c1 | 2012-12-14 15:12:46 +0530 | [diff] [blame] | 446 | ret = usb_submit_urb(urb, flags); |
Vamsi Krishna | 5b94471 | 2012-06-29 18:36:23 -0700 | [diff] [blame] | 447 | if (ret) { |
| 448 | pr_err("in urb submission failed"); |
| 449 | usb_unanchor_urb(urb); |
| 450 | usb_free_urb(urb); |
| 451 | ksb_free_data_pkt(pkt); |
Hemant Kumar | b3779d1 | 2012-09-16 20:28:56 -0700 | [diff] [blame] | 452 | atomic_dec(&ksb->rx_pending_cnt); |
| 453 | wake_up(&ksb->pending_urb_wait); |
Vamsi Krishna | 5b94471 | 2012-06-29 18:36:23 -0700 | [diff] [blame] | 454 | return; |
| 455 | } |
| 456 | |
Hemant Kumar | b3779d1 | 2012-09-16 20:28:56 -0700 | [diff] [blame] | 457 | dbg_log_event(ksb, "S RX_URB", pkt->len, 0); |
| 458 | |
Vamsi Krishna | 5b94471 | 2012-06-29 18:36:23 -0700 | [diff] [blame] | 459 | usb_free_urb(urb); |
| 460 | } |
| 461 | static void ksb_rx_cb(struct urb *urb) |
| 462 | { |
| 463 | struct data_pkt *pkt = urb->context; |
| 464 | struct ks_bridge *ksb = pkt->ctxt; |
| 465 | |
| 466 | dbg_log_event(ksb, "C RX_URB", urb->status, urb->actual_length); |
| 467 | |
| 468 | pr_debug("status:%d actual:%d", urb->status, urb->actual_length); |
| 469 | |
Hemant Kumar | 853ebf6 | 2012-08-31 18:38:32 -0700 | [diff] [blame] | 470 | /*non zero len of data received while unlinking urb*/ |
| 471 | if (urb->status == -ENOENT && urb->actual_length > 0) |
| 472 | goto add_to_list; |
| 473 | |
Vamsi Krishna | 5b94471 | 2012-06-29 18:36:23 -0700 | [diff] [blame] | 474 | if (urb->status < 0) { |
Hemant Kumar | 853ebf6 | 2012-08-31 18:38:32 -0700 | [diff] [blame] | 475 | if (urb->status != -ESHUTDOWN && urb->status != -ENOENT |
| 476 | && urb->status != -EPROTO) |
Vamsi Krishna | 5b94471 | 2012-06-29 18:36:23 -0700 | [diff] [blame] | 477 | pr_err_ratelimited("urb failed with err:%d", |
| 478 | urb->status); |
| 479 | ksb_free_data_pkt(pkt); |
Hemant Kumar | b3779d1 | 2012-09-16 20:28:56 -0700 | [diff] [blame] | 480 | goto done; |
Vamsi Krishna | 5b94471 | 2012-06-29 18:36:23 -0700 | [diff] [blame] | 481 | } |
| 482 | |
| 483 | if (urb->actual_length == 0) { |
Pavankumar Kondeti | 5c915c1 | 2012-12-14 15:12:46 +0530 | [diff] [blame] | 484 | submit_one_urb(ksb, GFP_ATOMIC, pkt); |
| 485 | goto done; |
Vamsi Krishna | 5b94471 | 2012-06-29 18:36:23 -0700 | [diff] [blame] | 486 | } |
| 487 | |
Hemant Kumar | 853ebf6 | 2012-08-31 18:38:32 -0700 | [diff] [blame] | 488 | add_to_list: |
Vamsi Krishna | 5b94471 | 2012-06-29 18:36:23 -0700 | [diff] [blame] | 489 | spin_lock(&ksb->lock); |
| 490 | pkt->len = urb->actual_length; |
| 491 | list_add_tail(&pkt->list, &ksb->to_ks_list); |
| 492 | spin_unlock(&ksb->lock); |
| 493 | |
| 494 | /* wake up read thread */ |
| 495 | wake_up(&ksb->ks_wait_q); |
| 496 | |
Hemant Kumar | b3779d1 | 2012-09-16 20:28:56 -0700 | [diff] [blame] | 497 | done: |
| 498 | atomic_dec(&ksb->rx_pending_cnt); |
| 499 | wake_up(&ksb->pending_urb_wait); |
Vamsi Krishna | 5b94471 | 2012-06-29 18:36:23 -0700 | [diff] [blame] | 500 | } |
| 501 | |
| 502 | static void ksb_start_rx_work(struct work_struct *w) |
| 503 | { |
| 504 | struct ks_bridge *ksb = |
| 505 | container_of(w, struct ks_bridge, start_rx_work); |
| 506 | struct data_pkt *pkt; |
| 507 | struct urb *urb; |
| 508 | int i = 0; |
| 509 | int ret; |
| 510 | |
| 511 | for (i = 0; i < NO_RX_REQS; i++) { |
Hemant Kumar | b3779d1 | 2012-09-16 20:28:56 -0700 | [diff] [blame] | 512 | |
| 513 | if (!test_bit(USB_DEV_CONNECTED, &ksb->flags)) |
| 514 | return; |
| 515 | |
Vamsi Krishna | 5b94471 | 2012-06-29 18:36:23 -0700 | [diff] [blame] | 516 | pkt = ksb_alloc_data_pkt(MAX_DATA_PKT_SIZE, GFP_KERNEL, ksb); |
| 517 | if (IS_ERR(pkt)) { |
| 518 | pr_err("unable to allocate data pkt"); |
| 519 | return; |
| 520 | } |
| 521 | |
| 522 | urb = usb_alloc_urb(0, GFP_KERNEL); |
| 523 | if (!urb) { |
| 524 | pr_err("unable to allocate urb"); |
| 525 | ksb_free_data_pkt(pkt); |
| 526 | return; |
| 527 | } |
| 528 | |
| 529 | ret = usb_autopm_get_interface(ksb->ifc); |
| 530 | if (ret < 0 && ret != -EAGAIN && ret != -EACCES) { |
| 531 | pr_err_ratelimited("autopm_get failed:%d", ret); |
| 532 | usb_free_urb(urb); |
| 533 | ksb_free_data_pkt(pkt); |
| 534 | return; |
| 535 | } |
Vamsi Krishna | 5b94471 | 2012-06-29 18:36:23 -0700 | [diff] [blame] | 536 | |
| 537 | usb_fill_bulk_urb(urb, ksb->udev, ksb->in_pipe, |
| 538 | pkt->buf, pkt->len, |
| 539 | ksb_rx_cb, pkt); |
| 540 | usb_anchor_urb(urb, &ksb->submitted); |
| 541 | |
| 542 | dbg_log_event(ksb, "S RX_URB", pkt->len, 0); |
| 543 | |
Hemant Kumar | b3779d1 | 2012-09-16 20:28:56 -0700 | [diff] [blame] | 544 | atomic_inc(&ksb->rx_pending_cnt); |
Vamsi Krishna | 5b94471 | 2012-06-29 18:36:23 -0700 | [diff] [blame] | 545 | ret = usb_submit_urb(urb, GFP_KERNEL); |
| 546 | if (ret) { |
| 547 | pr_err("in urb submission failed"); |
| 548 | usb_unanchor_urb(urb); |
| 549 | usb_free_urb(urb); |
| 550 | ksb_free_data_pkt(pkt); |
Vamsi Krishna | 5b94471 | 2012-06-29 18:36:23 -0700 | [diff] [blame] | 551 | usb_autopm_put_interface(ksb->ifc); |
Hemant Kumar | b3779d1 | 2012-09-16 20:28:56 -0700 | [diff] [blame] | 552 | atomic_dec(&ksb->rx_pending_cnt); |
| 553 | wake_up(&ksb->pending_urb_wait); |
Vamsi Krishna | 5b94471 | 2012-06-29 18:36:23 -0700 | [diff] [blame] | 554 | return; |
| 555 | } |
| 556 | |
| 557 | usb_autopm_put_interface_async(ksb->ifc); |
| 558 | usb_free_urb(urb); |
| 559 | } |
| 560 | } |
| 561 | |
| 562 | static int |
| 563 | ksb_usb_probe(struct usb_interface *ifc, const struct usb_device_id *id) |
| 564 | { |
| 565 | __u8 ifc_num; |
| 566 | struct usb_host_interface *ifc_desc; |
| 567 | struct usb_endpoint_descriptor *ep_desc; |
| 568 | int i; |
| 569 | struct ks_bridge *ksb; |
Hemant Kumar | 2f20bda | 2012-09-17 14:05:54 -0700 | [diff] [blame] | 570 | unsigned long flags; |
| 571 | struct data_pkt *pkt; |
Vamsi Krishna | 5b94471 | 2012-06-29 18:36:23 -0700 | [diff] [blame] | 572 | |
| 573 | ifc_num = ifc->cur_altsetting->desc.bInterfaceNumber; |
| 574 | |
| 575 | switch (id->idProduct) { |
| 576 | case 0x9008: |
| 577 | if (ifc_num != 0) |
| 578 | return -ENODEV; |
| 579 | ksb = __ksb[BOOT_BRIDGE_INDEX]; |
| 580 | break; |
| 581 | case 0x9048: |
| 582 | case 0x904C: |
| 583 | if (ifc_num != 2) |
| 584 | return -ENODEV; |
| 585 | ksb = __ksb[EFS_BRIDGE_INDEX]; |
| 586 | break; |
| 587 | default: |
| 588 | return -ENODEV; |
| 589 | } |
| 590 | |
| 591 | if (!ksb) { |
| 592 | pr_err("ksb is not initialized"); |
| 593 | return -ENODEV; |
| 594 | } |
| 595 | |
| 596 | ksb->udev = usb_get_dev(interface_to_usbdev(ifc)); |
| 597 | ksb->ifc = ifc; |
| 598 | ifc_desc = ifc->cur_altsetting; |
| 599 | |
| 600 | for (i = 0; i < ifc_desc->desc.bNumEndpoints; i++) { |
| 601 | ep_desc = &ifc_desc->endpoint[i].desc; |
| 602 | |
| 603 | if (!ksb->in_epAddr && usb_endpoint_is_bulk_in(ep_desc)) |
| 604 | ksb->in_epAddr = ep_desc->bEndpointAddress; |
| 605 | |
| 606 | if (!ksb->out_epAddr && usb_endpoint_is_bulk_out(ep_desc)) |
| 607 | ksb->out_epAddr = ep_desc->bEndpointAddress; |
| 608 | } |
| 609 | |
| 610 | if (!(ksb->in_epAddr && ksb->out_epAddr)) { |
| 611 | pr_err("could not find bulk in and bulk out endpoints"); |
| 612 | usb_put_dev(ksb->udev); |
| 613 | ksb->ifc = NULL; |
| 614 | return -ENODEV; |
| 615 | } |
| 616 | |
| 617 | ksb->in_pipe = usb_rcvbulkpipe(ksb->udev, ksb->in_epAddr); |
| 618 | ksb->out_pipe = usb_sndbulkpipe(ksb->udev, ksb->out_epAddr); |
| 619 | |
| 620 | usb_set_intfdata(ifc, ksb); |
| 621 | set_bit(USB_DEV_CONNECTED, &ksb->flags); |
Hemant Kumar | b3779d1 | 2012-09-16 20:28:56 -0700 | [diff] [blame] | 622 | atomic_set(&ksb->tx_pending_cnt, 0); |
| 623 | atomic_set(&ksb->rx_pending_cnt, 0); |
Vamsi Krishna | 5b94471 | 2012-06-29 18:36:23 -0700 | [diff] [blame] | 624 | |
| 625 | dbg_log_event(ksb, "PID-ATT", id->idProduct, 0); |
| 626 | |
Hemant Kumar | 2f20bda | 2012-09-17 14:05:54 -0700 | [diff] [blame] | 627 | /*free up stale buffers if any from previous disconnect*/ |
| 628 | spin_lock_irqsave(&ksb->lock, flags); |
| 629 | while (!list_empty(&ksb->to_ks_list)) { |
| 630 | pkt = list_first_entry(&ksb->to_ks_list, |
| 631 | struct data_pkt, list); |
| 632 | list_del_init(&pkt->list); |
| 633 | ksb_free_data_pkt(pkt); |
Hemant Kumar | 2f20bda | 2012-09-17 14:05:54 -0700 | [diff] [blame] | 634 | } |
| 635 | while (!list_empty(&ksb->to_mdm_list)) { |
| 636 | pkt = list_first_entry(&ksb->to_mdm_list, |
| 637 | struct data_pkt, list); |
| 638 | list_del_init(&pkt->list); |
| 639 | ksb_free_data_pkt(pkt); |
| 640 | } |
| 641 | spin_unlock_irqrestore(&ksb->lock, flags); |
| 642 | |
Hemant Kumar | da86bd2 | 2012-08-24 19:42:31 -0700 | [diff] [blame] | 643 | ksb->fs_dev = (struct miscdevice *)id->driver_info; |
| 644 | misc_register(ksb->fs_dev); |
Vamsi Krishna | 5b94471 | 2012-06-29 18:36:23 -0700 | [diff] [blame] | 645 | |
Hemant Kumar | d26076c | 2012-09-07 19:00:21 -0700 | [diff] [blame] | 646 | ifc->needs_remote_wakeup = 1; |
Vamsi Krishna | 5b94471 | 2012-06-29 18:36:23 -0700 | [diff] [blame] | 647 | usb_enable_autosuspend(ksb->udev); |
| 648 | |
| 649 | pr_debug("usb dev connected"); |
| 650 | |
| 651 | return 0; |
| 652 | } |
| 653 | |
| 654 | static int ksb_usb_suspend(struct usb_interface *ifc, pm_message_t message) |
| 655 | { |
| 656 | struct ks_bridge *ksb = usb_get_intfdata(ifc); |
| 657 | |
| 658 | dbg_log_event(ksb, "SUSPEND", 0, 0); |
| 659 | |
Vamsi Krishna | 5b94471 | 2012-06-29 18:36:23 -0700 | [diff] [blame] | 660 | usb_kill_anchored_urbs(&ksb->submitted); |
| 661 | |
| 662 | return 0; |
| 663 | } |
| 664 | |
| 665 | static int ksb_usb_resume(struct usb_interface *ifc) |
| 666 | { |
| 667 | struct ks_bridge *ksb = usb_get_intfdata(ifc); |
| 668 | |
| 669 | dbg_log_event(ksb, "RESUME", 0, 0); |
| 670 | |
| 671 | if (test_bit(FILE_OPENED, &ksb->flags)) |
| 672 | queue_work(ksb->wq, &ksb->start_rx_work); |
| 673 | |
| 674 | return 0; |
| 675 | } |
| 676 | |
| 677 | static void ksb_usb_disconnect(struct usb_interface *ifc) |
| 678 | { |
| 679 | struct ks_bridge *ksb = usb_get_intfdata(ifc); |
| 680 | unsigned long flags; |
| 681 | struct data_pkt *pkt; |
| 682 | |
| 683 | dbg_log_event(ksb, "PID-DETACH", 0, 0); |
| 684 | |
| 685 | clear_bit(USB_DEV_CONNECTED, &ksb->flags); |
| 686 | wake_up(&ksb->ks_wait_q); |
| 687 | cancel_work_sync(&ksb->to_mdm_work); |
Hemant Kumar | b3779d1 | 2012-09-16 20:28:56 -0700 | [diff] [blame] | 688 | cancel_work_sync(&ksb->start_rx_work); |
Vamsi Krishna | 5b94471 | 2012-06-29 18:36:23 -0700 | [diff] [blame] | 689 | |
Hemant Kumar | 2f20bda | 2012-09-17 14:05:54 -0700 | [diff] [blame] | 690 | misc_deregister(ksb->fs_dev); |
| 691 | |
Vamsi Krishna | 5b94471 | 2012-06-29 18:36:23 -0700 | [diff] [blame] | 692 | usb_kill_anchored_urbs(&ksb->submitted); |
| 693 | |
Hemant Kumar | b3779d1 | 2012-09-16 20:28:56 -0700 | [diff] [blame] | 694 | wait_event_interruptible_timeout( |
| 695 | ksb->pending_urb_wait, |
| 696 | !atomic_read(&ksb->tx_pending_cnt) && |
| 697 | !atomic_read(&ksb->rx_pending_cnt), |
| 698 | msecs_to_jiffies(PENDING_URB_TIMEOUT)); |
| 699 | |
Vamsi Krishna | 5b94471 | 2012-06-29 18:36:23 -0700 | [diff] [blame] | 700 | spin_lock_irqsave(&ksb->lock, flags); |
| 701 | while (!list_empty(&ksb->to_ks_list)) { |
| 702 | pkt = list_first_entry(&ksb->to_ks_list, |
| 703 | struct data_pkt, list); |
| 704 | list_del_init(&pkt->list); |
| 705 | ksb_free_data_pkt(pkt); |
| 706 | } |
| 707 | while (!list_empty(&ksb->to_mdm_list)) { |
| 708 | pkt = list_first_entry(&ksb->to_mdm_list, |
| 709 | struct data_pkt, list); |
| 710 | list_del_init(&pkt->list); |
| 711 | ksb_free_data_pkt(pkt); |
| 712 | } |
| 713 | spin_unlock_irqrestore(&ksb->lock, flags); |
| 714 | |
Hemant Kumar | d26076c | 2012-09-07 19:00:21 -0700 | [diff] [blame] | 715 | ifc->needs_remote_wakeup = 0; |
Vamsi Krishna | 5b94471 | 2012-06-29 18:36:23 -0700 | [diff] [blame] | 716 | usb_put_dev(ksb->udev); |
| 717 | ksb->ifc = NULL; |
| 718 | usb_set_intfdata(ifc, NULL); |
| 719 | |
| 720 | return; |
| 721 | } |
| 722 | |
| 723 | static struct usb_driver ksb_usb_driver = { |
| 724 | .name = "ks_bridge", |
| 725 | .probe = ksb_usb_probe, |
| 726 | .disconnect = ksb_usb_disconnect, |
| 727 | .suspend = ksb_usb_suspend, |
| 728 | .resume = ksb_usb_resume, |
| 729 | .id_table = ksb_usb_ids, |
| 730 | .supports_autosuspend = 1, |
| 731 | }; |
| 732 | |
| 733 | static ssize_t ksb_debug_show(struct seq_file *s, void *unused) |
| 734 | { |
| 735 | unsigned long flags; |
| 736 | struct ks_bridge *ksb = s->private; |
| 737 | int i; |
| 738 | |
| 739 | read_lock_irqsave(&ksb->dbg_lock, flags); |
| 740 | for (i = 0; i < DBG_MAX_MSG; i++) { |
| 741 | if (i == (ksb->dbg_idx - 1)) |
| 742 | seq_printf(s, "-->%s\n", ksb->dbgbuf[i]); |
| 743 | else |
| 744 | seq_printf(s, "%s\n", ksb->dbgbuf[i]); |
| 745 | } |
| 746 | read_unlock_irqrestore(&ksb->dbg_lock, flags); |
| 747 | |
| 748 | return 0; |
| 749 | } |
| 750 | |
| 751 | static int ksb_debug_open(struct inode *ip, struct file *fp) |
| 752 | { |
| 753 | return single_open(fp, ksb_debug_show, ip->i_private); |
| 754 | |
| 755 | return 0; |
| 756 | } |
| 757 | |
| 758 | static const struct file_operations dbg_fops = { |
| 759 | .open = ksb_debug_open, |
| 760 | .read = seq_read, |
| 761 | .llseek = seq_lseek, |
| 762 | .release = single_release, |
| 763 | }; |
| 764 | static struct dentry *dbg_dir; |
| 765 | static int __init ksb_init(void) |
| 766 | { |
| 767 | struct ks_bridge *ksb; |
| 768 | int num_instances = 0; |
| 769 | int ret = 0; |
| 770 | int i; |
| 771 | |
| 772 | dbg_dir = debugfs_create_dir("ks_bridge", NULL); |
| 773 | if (IS_ERR(dbg_dir)) |
| 774 | pr_err("unable to create debug dir"); |
| 775 | |
| 776 | for (i = 0; i < NO_BRIDGE_INSTANCES; i++) { |
| 777 | ksb = kzalloc(sizeof(struct ks_bridge), GFP_KERNEL); |
| 778 | if (!ksb) { |
| 779 | pr_err("unable to allocat mem for ks_bridge"); |
Hemant Kumar | da86bd2 | 2012-08-24 19:42:31 -0700 | [diff] [blame] | 780 | ret = -ENOMEM; |
| 781 | goto dev_free; |
Vamsi Krishna | 5b94471 | 2012-06-29 18:36:23 -0700 | [diff] [blame] | 782 | } |
| 783 | __ksb[i] = ksb; |
| 784 | |
| 785 | ksb->name = kasprintf(GFP_KERNEL, "ks_bridge:%i", i + 1); |
| 786 | if (!ksb->name) { |
| 787 | pr_info("unable to allocate name"); |
| 788 | kfree(ksb); |
| 789 | ret = -ENOMEM; |
| 790 | goto dev_free; |
| 791 | } |
| 792 | |
| 793 | spin_lock_init(&ksb->lock); |
| 794 | INIT_LIST_HEAD(&ksb->to_mdm_list); |
| 795 | INIT_LIST_HEAD(&ksb->to_ks_list); |
| 796 | init_waitqueue_head(&ksb->ks_wait_q); |
Hemant Kumar | b3779d1 | 2012-09-16 20:28:56 -0700 | [diff] [blame] | 797 | init_waitqueue_head(&ksb->pending_urb_wait); |
Vamsi Krishna | 5b94471 | 2012-06-29 18:36:23 -0700 | [diff] [blame] | 798 | ksb->wq = create_singlethread_workqueue(ksb->name); |
| 799 | if (!ksb->wq) { |
| 800 | pr_err("unable to allocate workqueue"); |
| 801 | kfree(ksb->name); |
| 802 | kfree(ksb); |
| 803 | ret = -ENOMEM; |
| 804 | goto dev_free; |
| 805 | } |
| 806 | |
| 807 | INIT_WORK(&ksb->to_mdm_work, ksb_tomdm_work); |
| 808 | INIT_WORK(&ksb->start_rx_work, ksb_start_rx_work); |
| 809 | init_usb_anchor(&ksb->submitted); |
| 810 | |
| 811 | ksb->dbg_idx = 0; |
| 812 | ksb->dbg_lock = __RW_LOCK_UNLOCKED(lck); |
| 813 | |
| 814 | if (!IS_ERR(dbg_dir)) |
| 815 | debugfs_create_file(ksb->name, S_IRUGO, dbg_dir, |
| 816 | ksb, &dbg_fops); |
| 817 | |
| 818 | num_instances++; |
| 819 | } |
| 820 | |
| 821 | ret = usb_register(&ksb_usb_driver); |
| 822 | if (ret) { |
| 823 | pr_err("unable to register ks bridge driver"); |
| 824 | goto dev_free; |
| 825 | } |
| 826 | |
| 827 | pr_info("init done"); |
| 828 | |
| 829 | return 0; |
| 830 | |
| 831 | dev_free: |
| 832 | if (!IS_ERR(dbg_dir)) |
| 833 | debugfs_remove_recursive(dbg_dir); |
| 834 | |
| 835 | for (i = 0; i < num_instances; i++) { |
| 836 | ksb = __ksb[i]; |
| 837 | |
| 838 | destroy_workqueue(ksb->wq); |
| 839 | kfree(ksb->name); |
| 840 | kfree(ksb); |
| 841 | } |
| 842 | |
| 843 | return ret; |
| 844 | |
| 845 | } |
| 846 | |
| 847 | static void __exit ksb_exit(void) |
| 848 | { |
| 849 | struct ks_bridge *ksb; |
| 850 | int i; |
| 851 | |
| 852 | if (!IS_ERR(dbg_dir)) |
| 853 | debugfs_remove_recursive(dbg_dir); |
| 854 | |
| 855 | usb_deregister(&ksb_usb_driver); |
| 856 | |
| 857 | for (i = 0; i < NO_BRIDGE_INSTANCES; i++) { |
| 858 | ksb = __ksb[i]; |
| 859 | |
| 860 | destroy_workqueue(ksb->wq); |
| 861 | kfree(ksb->name); |
| 862 | kfree(ksb); |
| 863 | } |
| 864 | } |
| 865 | |
| 866 | module_init(ksb_init); |
| 867 | module_exit(ksb_exit); |
| 868 | |
| 869 | MODULE_DESCRIPTION(DRIVER_DESC); |
| 870 | MODULE_VERSION(DRIVER_VERSION); |
| 871 | MODULE_LICENSE("GPL v2"); |