blob: 15f478336dd3903f669b4f8a2421cc287edd20a4 [file] [log] [blame]
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07001/* include/asm-arm/arch-msm/usbdiag.h
2 *
Shalabh Jain737fca72012-11-14 21:53:43 -08003 * Copyright (c) 2008-2010, 2012, The Linux Foundation. All rights reserved.
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07004 *
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 Kondeti20d985f2012-11-21 14:52:15 +053024#include <linux/err.h>
25
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -070026#define DIAG_LEGACY "diag"
27#define DIAG_MDM "diag_mdm"
Shalabh Jain737fca72012-11-14 21:53:43 -080028#define DIAG_QSC "diag_qsc"
Shalabh Jainb0037c02013-01-18 12:47:40 -080029#define DIAG_MDM2 "diag_mdm2"
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -070030
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
36struct diag_request {
37 char *buf;
38 int length;
39 int actual;
40 int status;
41 void *context;
42};
43
44struct 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 Kondeti20d985f2012-11-21 14:52:15 +053052#ifdef CONFIG_USB_G_ANDROID
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -070053struct usb_diag_ch *usb_diag_open(const char *name, void *priv,
54 void (*notify)(void *, unsigned, struct diag_request *));
55void usb_diag_close(struct usb_diag_ch *ch);
56int usb_diag_alloc_req(struct usb_diag_ch *ch, int n_write, int n_read);
57void usb_diag_free_req(struct usb_diag_ch *ch);
58int usb_diag_read(struct usb_diag_ch *ch, struct diag_request *d_req);
59int usb_diag_write(struct usb_diag_ch *ch, struct diag_request *d_req);
Pavankumar Kondeti20d985f2012-11-21 14:52:15 +053060#else
61static 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}
66static inline void usb_diag_close(struct usb_diag_ch *ch)
67{
68}
69static inline
70int usb_diag_alloc_req(struct usb_diag_ch *ch, int n_write, int n_read)
71{
72 return -ENODEV;
73}
74static inline void usb_diag_free_req(struct usb_diag_ch *ch)
75{
76}
77static inline
78int usb_diag_read(struct usb_diag_ch *ch, struct diag_request *d_req)
79{
80 return -ENODEV;
81}
82static inline
83int 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 Huntsman3f2bc4d2011-08-16 17:27:22 -070088#endif /* _DRIVERS_USB_DIAG_H_ */