Bryan Huntsman | 3f2bc4d | 2011-08-16 17:27:22 -0700 | [diff] [blame] | 1 | /* include/asm-arm/arch-msm/usbdiag.h |
| 2 | * |
Shalabh Jain | 737fca7 | 2012-11-14 21:53:43 -0800 | [diff] [blame] | 3 | * Copyright (c) 2008-2010, 2012, The Linux Foundation. All rights reserved. |
Bryan Huntsman | 3f2bc4d | 2011-08-16 17:27:22 -0700 | [diff] [blame] | 4 | * |
| 5 | * All source code in this file is licensed under the following license except |
| 6 | * where indicated. |
| 7 | * |
| 8 | * This program is free software; you can redistribute it and/or modify it |
| 9 | * under the terms of the GNU General Public License version 2 as published |
| 10 | * by the Free Software Foundation. |
| 11 | * |
| 12 | * This program is distributed in the hope that it will be useful, |
| 13 | * but WITHOUT ANY WARRANTY; without even the implied warranty of |
| 14 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. |
| 15 | * |
| 16 | * See the GNU General Public License for more details. |
| 17 | * You should have received a copy of the GNU General Public License |
| 18 | * along with this program; if not, you can find it at http://www.fsf.org |
| 19 | */ |
| 20 | |
| 21 | #ifndef _DRIVERS_USB_DIAG_H_ |
| 22 | #define _DRIVERS_USB_DIAG_H_ |
| 23 | |
Pavankumar Kondeti | 20d985f | 2012-11-21 14:52:15 +0530 | [diff] [blame] | 24 | #include <linux/err.h> |
| 25 | |
Bryan Huntsman | 3f2bc4d | 2011-08-16 17:27:22 -0700 | [diff] [blame] | 26 | #define DIAG_LEGACY "diag" |
| 27 | #define DIAG_MDM "diag_mdm" |
Shalabh Jain | 737fca7 | 2012-11-14 21:53:43 -0800 | [diff] [blame] | 28 | #define DIAG_QSC "diag_qsc" |
Shalabh Jain | b0037c0 | 2013-01-18 12:47:40 -0800 | [diff] [blame] | 29 | #define DIAG_MDM2 "diag_mdm2" |
Bryan Huntsman | 3f2bc4d | 2011-08-16 17:27:22 -0700 | [diff] [blame] | 30 | |
| 31 | #define USB_DIAG_CONNECT 0 |
| 32 | #define USB_DIAG_DISCONNECT 1 |
| 33 | #define USB_DIAG_WRITE_DONE 2 |
| 34 | #define USB_DIAG_READ_DONE 3 |
| 35 | |
| 36 | struct diag_request { |
| 37 | char *buf; |
| 38 | int length; |
| 39 | int actual; |
| 40 | int status; |
| 41 | void *context; |
| 42 | }; |
| 43 | |
| 44 | struct usb_diag_ch { |
| 45 | const char *name; |
| 46 | struct list_head list; |
| 47 | void (*notify)(void *priv, unsigned event, struct diag_request *d_req); |
| 48 | void *priv; |
| 49 | void *priv_usb; |
| 50 | }; |
| 51 | |
Pavankumar Kondeti | 20d985f | 2012-11-21 14:52:15 +0530 | [diff] [blame] | 52 | #ifdef CONFIG_USB_G_ANDROID |
Bryan Huntsman | 3f2bc4d | 2011-08-16 17:27:22 -0700 | [diff] [blame] | 53 | struct usb_diag_ch *usb_diag_open(const char *name, void *priv, |
| 54 | void (*notify)(void *, unsigned, struct diag_request *)); |
| 55 | void usb_diag_close(struct usb_diag_ch *ch); |
| 56 | int usb_diag_alloc_req(struct usb_diag_ch *ch, int n_write, int n_read); |
| 57 | void usb_diag_free_req(struct usb_diag_ch *ch); |
| 58 | int usb_diag_read(struct usb_diag_ch *ch, struct diag_request *d_req); |
| 59 | int usb_diag_write(struct usb_diag_ch *ch, struct diag_request *d_req); |
Pavankumar Kondeti | 20d985f | 2012-11-21 14:52:15 +0530 | [diff] [blame] | 60 | #else |
| 61 | static inline struct usb_diag_ch *usb_diag_open(const char *name, void *priv, |
| 62 | void (*notify)(void *, unsigned, struct diag_request *)) |
| 63 | { |
| 64 | return ERR_PTR(-ENODEV); |
| 65 | } |
| 66 | static inline void usb_diag_close(struct usb_diag_ch *ch) |
| 67 | { |
| 68 | } |
| 69 | static inline |
| 70 | int usb_diag_alloc_req(struct usb_diag_ch *ch, int n_write, int n_read) |
| 71 | { |
| 72 | return -ENODEV; |
| 73 | } |
| 74 | static inline void usb_diag_free_req(struct usb_diag_ch *ch) |
| 75 | { |
| 76 | } |
| 77 | static inline |
| 78 | int usb_diag_read(struct usb_diag_ch *ch, struct diag_request *d_req) |
| 79 | { |
| 80 | return -ENODEV; |
| 81 | } |
| 82 | static inline |
| 83 | int usb_diag_write(struct usb_diag_ch *ch, struct diag_request *d_req) |
| 84 | { |
| 85 | return -ENODEV; |
| 86 | } |
| 87 | #endif /* CONFIG_USB_G_ANDROID */ |
Bryan Huntsman | 3f2bc4d | 2011-08-16 17:27:22 -0700 | [diff] [blame] | 88 | #endif /* _DRIVERS_USB_DIAG_H_ */ |