diff options
| author | Hemant Kumar <hemantk@codeaurora.org> | 2016-01-28 12:16:55 -0800 |
|---|---|---|
| committer | David Keitel <dkeitel@codeaurora.org> | 2016-03-22 11:03:01 -0700 |
| commit | 2e6b9bea067b15ba0d211cfb5f38db7dc0fe002d (patch) | |
| tree | e8bcad1228bc436b8dba689653f9721439583d0d /include/linux | |
| parent | c03ffc42548044e4c28262c03a94a9234eedc153 (diff) | |
usb: gadget: Add snapshot of DIAG function driver
Add function driver to support Qualcomm diagnostics port over USB.
This snapshot is taken as of msm-3.18 commit:
commit e70ad0cd5e (Promotion of kernel.lnx.3.18-151201)
Change-Id: I51aaa8f6a2e05fc252ea810244ddfc99ca2741cc
Signed-off-by: Hemant Kumar <hemantk@codeaurora.org>
Diffstat (limited to 'include/linux')
| -rw-r--r-- | include/linux/usb/usbdiag.h | 85 |
1 files changed, 85 insertions, 0 deletions
diff --git a/include/linux/usb/usbdiag.h b/include/linux/usb/usbdiag.h new file mode 100644 index 000000000000..1be8e634fcda --- /dev/null +++ b/include/linux/usb/usbdiag.h @@ -0,0 +1,85 @@ +/* + * Copyright (c) 2008-2010, 2012-2014, The Linux Foundation. + * All rights reserved. + * + * All source code in this file is licensed under the following license except + * where indicated. + * + * This program is free software; you can redistribute it and/or modify it + * under the terms of the GNU General Public License version 2 as published + * by the Free Software Foundation. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. + * + * See the GNU General Public License for more details. + * You should have received a copy of the GNU General Public License + * along with this program; if not, you can find it at http://www.fsf.org + */ + +#ifndef _DRIVERS_USB_DIAG_H_ +#define _DRIVERS_USB_DIAG_H_ + +#include <linux/err.h> + +#define DIAG_LEGACY "diag" +#define DIAG_MDM "diag_mdm" +#define DIAG_QSC "diag_qsc" +#define DIAG_MDM2 "diag_mdm2" + +#define USB_DIAG_CONNECT 0 +#define USB_DIAG_DISCONNECT 1 +#define USB_DIAG_WRITE_DONE 2 +#define USB_DIAG_READ_DONE 3 + +struct diag_request { + char *buf; + int length; + int actual; + int status; + void *context; +}; + +struct usb_diag_ch { + const char *name; + struct list_head list; + void (*notify)(void *priv, unsigned event, struct diag_request *d_req); + void *priv; + void *priv_usb; +}; + +#ifdef CONFIG_USB_G_ANDROID +int usb_diag_request_size(struct usb_diag_ch *ch); +struct usb_diag_ch *usb_diag_open(const char *name, void *priv, + void (*notify)(void *, unsigned, struct diag_request *)); +void usb_diag_close(struct usb_diag_ch *ch); +int usb_diag_alloc_req(struct usb_diag_ch *ch, int n_write, int n_read); +int usb_diag_read(struct usb_diag_ch *ch, struct diag_request *d_req); +int usb_diag_write(struct usb_diag_ch *ch, struct diag_request *d_req); +#else +static inline struct usb_diag_ch *usb_diag_open(const char *name, void *priv, + void (*notify)(void *, unsigned, struct diag_request *)) +{ + return ERR_PTR(-ENODEV); +} +static inline void usb_diag_close(struct usb_diag_ch *ch) +{ +} +static inline +int usb_diag_alloc_req(struct usb_diag_ch *ch, int n_write, int n_read) +{ + return -ENODEV; +} +static inline +int usb_diag_read(struct usb_diag_ch *ch, struct diag_request *d_req) +{ + return -ENODEV; +} +static inline +int usb_diag_write(struct usb_diag_ch *ch, struct diag_request *d_req) +{ + return -ENODEV; +} +#endif /* CONFIG_USB_G_ANDROID */ +#endif /* _DRIVERS_USB_DIAG_H_ */ |
