blob: 4ba2e9b4b165b7be42f109ee7d5f6ab289a9177a [file] [log] [blame]
Mayank Rana20c78842017-02-14 17:34:45 -08001/*
2 * Copyright (c) 2012-2017, The Linux Foundation. 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#ifndef _F_QDSS_H
15#define _F_QDSS_H
16
17#include <linux/kernel.h>
18#include <linux/usb/ch9.h>
19#include <linux/usb/gadget.h>
Mayank Rana20c78842017-02-14 17:34:45 -080020#include <linux/usb/composite.h>
21#include <linux/usb/usb_qdss.h>
22
Mayank Rana9f189e02017-02-27 14:55:09 -080023enum qti_port_type {
24 QTI_PORT_RMNET,
25 QTI_PORT_DPL,
26 QTI_NUM_PORTS
27};
Mayank Rana20c78842017-02-14 17:34:45 -080028
29struct usb_qdss_bam_connect_info {
30 u32 usb_bam_pipe_idx;
31 u32 peer_pipe_idx;
32 unsigned long usb_bam_handle;
33 struct sps_mem_buffer *data_fifo;
34};
35
36struct gqdss {
37 struct usb_function function;
38 struct usb_ep *ctrl_out;
39 struct usb_ep *ctrl_in;
40 struct usb_ep *data;
41 int (*send_encap_cmd)(enum qti_port_type qport, void *buf, size_t len);
42 void (*notify_modem)(void *g, enum qti_port_type qport, int cbits);
43};
44
45/* struct f_qdss - USB qdss function driver private structure */
46struct f_qdss {
47 struct gqdss port;
48 struct usb_qdss_bam_connect_info bam_info;
49 struct usb_gadget *gadget;
50 short int port_num;
51 u8 ctrl_iface_id;
52 u8 data_iface_id;
53 int usb_connected;
54 bool debug_inface_enabled;
55 struct usb_request *endless_req;
56 struct usb_qdss_ch ch;
57 struct list_head ctrl_read_pool;
58 struct list_head ctrl_write_pool;
59 struct work_struct connect_w;
60 struct work_struct disconnect_w;
61 spinlock_t lock;
62 unsigned int data_enabled:1;
63 unsigned int ctrl_in_enabled:1;
64 unsigned int ctrl_out_enabled:1;
65 struct workqueue_struct *wq;
66};
67
68struct usb_qdss_opts {
69 struct usb_function_instance func_inst;
70 struct f_qdss *usb_qdss;
71 char *channel_name;
72};
73
74int uninit_data(struct usb_ep *ep);
Vijayavardhan Vennapusab4a565e2017-03-15 13:31:02 +053075int set_qdss_data_connection(struct f_qdss *qdss, int enable);
Mayank Rana20c78842017-02-14 17:34:45 -080076#endif