blob: e9d980ec7fbd447636476b4ed48a80d354e85946 [file] [log] [blame]
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07001/* include/asm-arm/arch-msm/usbdiag.h
2 *
Pavankumar Kondeti20d985f2012-11-21 14:52:15 +05303 * 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"
28
29#define USB_DIAG_CONNECT 0
30#define USB_DIAG_DISCONNECT 1
31#define USB_DIAG_WRITE_DONE 2
32#define USB_DIAG_READ_DONE 3
33
34struct diag_request {
35 char *buf;
36 int length;
37 int actual;
38 int status;
39 void *context;
40};
41
42struct usb_diag_ch {
43 const char *name;
44 struct list_head list;
45 void (*notify)(void *priv, unsigned event, struct diag_request *d_req);
46 void *priv;
47 void *priv_usb;
48};
49
Pavankumar Kondeti20d985f2012-11-21 14:52:15 +053050#ifdef CONFIG_USB_G_ANDROID
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -070051struct usb_diag_ch *usb_diag_open(const char *name, void *priv,
52 void (*notify)(void *, unsigned, struct diag_request *));
53void usb_diag_close(struct usb_diag_ch *ch);
54int usb_diag_alloc_req(struct usb_diag_ch *ch, int n_write, int n_read);
55void usb_diag_free_req(struct usb_diag_ch *ch);
56int usb_diag_read(struct usb_diag_ch *ch, struct diag_request *d_req);
57int usb_diag_write(struct usb_diag_ch *ch, struct diag_request *d_req);
Pavankumar Kondeti20d985f2012-11-21 14:52:15 +053058#else
59static inline struct usb_diag_ch *usb_diag_open(const char *name, void *priv,
60 void (*notify)(void *, unsigned, struct diag_request *))
61{
62 return ERR_PTR(-ENODEV);
63}
64static inline void usb_diag_close(struct usb_diag_ch *ch)
65{
66}
67static inline
68int usb_diag_alloc_req(struct usb_diag_ch *ch, int n_write, int n_read)
69{
70 return -ENODEV;
71}
72static inline void usb_diag_free_req(struct usb_diag_ch *ch)
73{
74}
75static inline
76int usb_diag_read(struct usb_diag_ch *ch, struct diag_request *d_req)
77{
78 return -ENODEV;
79}
80static inline
81int usb_diag_write(struct usb_diag_ch *ch, struct diag_request *d_req)
82{
83 return -ENODEV;
84}
85#endif /* CONFIG_USB_G_ANDROID */
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -070086#endif /* _DRIVERS_USB_DIAG_H_ */