Mayank Rana | 20c7884 | 2017-02-14 17:34:45 -0800 | [diff] [blame] | 1 | /* |
| 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 Rana | 20c7884 | 2017-02-14 17:34:45 -0800 | [diff] [blame] | 20 | #include <linux/usb/composite.h> |
| 21 | #include <linux/usb/usb_qdss.h> |
| 22 | |
Mayank Rana | 9f189e0 | 2017-02-27 14:55:09 -0800 | [diff] [blame] | 23 | enum qti_port_type { |
| 24 | QTI_PORT_RMNET, |
| 25 | QTI_PORT_DPL, |
| 26 | QTI_NUM_PORTS |
| 27 | }; |
Mayank Rana | 20c7884 | 2017-02-14 17:34:45 -0800 | [diff] [blame] | 28 | |
| 29 | struct 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 | |
| 36 | struct 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 */ |
| 46 | struct 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 | |
| 68 | struct usb_qdss_opts { |
| 69 | struct usb_function_instance func_inst; |
| 70 | struct f_qdss *usb_qdss; |
| 71 | char *channel_name; |
| 72 | }; |
| 73 | |
| 74 | int uninit_data(struct usb_ep *ep); |
Vijayavardhan Vennapusa | b4a565e | 2017-03-15 13:31:02 +0530 | [diff] [blame] | 75 | int set_qdss_data_connection(struct f_qdss *qdss, int enable); |
Mayank Rana | 20c7884 | 2017-02-14 17:34:45 -0800 | [diff] [blame] | 76 | #endif |