Bar Weiner | 0dae81b | 2013-02-14 13:53:54 +0200 | [diff] [blame] | 1 | /* Copyright (c) 2011-2013, The Linux Foundation. All rights reserved. |
Bryan Huntsman | 3f2bc4d | 2011-08-16 17:27:22 -0700 | [diff] [blame] | 2 | * |
| 3 | * This program is free software; you can redistribute it and/or modify |
| 4 | * it under the terms of the GNU General Public License version 2 and |
| 5 | * only version 2 as published by the Free Software Foundation. |
| 6 | * |
| 7 | * This program is distributed in the hope that it will be useful, |
| 8 | * but WITHOUT ANY WARRANTY; without even the implied warranty of |
| 9 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
| 10 | * GNU General Public License for more details. |
| 11 | */ |
| 12 | |
| 13 | #ifndef __U_RMNET_H |
| 14 | #define __U_RMNET_H |
| 15 | |
| 16 | #include <linux/usb/composite.h> |
| 17 | #include <linux/usb/cdc.h> |
| 18 | #include <linux/wait.h> |
| 19 | #include <linux/workqueue.h> |
| 20 | |
| 21 | struct rmnet_ctrl_pkt { |
| 22 | void *buf; |
| 23 | int len; |
| 24 | struct list_head list; |
| 25 | }; |
| 26 | |
| 27 | struct grmnet { |
| 28 | struct usb_function func; |
| 29 | |
| 30 | struct usb_ep *in; |
| 31 | struct usb_ep *out; |
Bryan Huntsman | 3f2bc4d | 2011-08-16 17:27:22 -0700 | [diff] [blame] | 32 | |
| 33 | /* to usb host, aka laptop, windows pc etc. Will |
| 34 | * be filled by usb driver of rmnet functionality |
| 35 | */ |
Hemant Kumar | f60c025 | 2011-11-03 12:37:07 -0700 | [diff] [blame] | 36 | int (*send_cpkt_response)(void *g, void *buf, size_t len); |
Bryan Huntsman | 3f2bc4d | 2011-08-16 17:27:22 -0700 | [diff] [blame] | 37 | |
| 38 | /* to modem, and to be filled by driver implementing |
| 39 | * control function |
| 40 | */ |
Hemant Kumar | f60c025 | 2011-11-03 12:37:07 -0700 | [diff] [blame] | 41 | int (*send_encap_cmd)(u8 port_num, void *buf, size_t len); |
Bryan Huntsman | 3f2bc4d | 2011-08-16 17:27:22 -0700 | [diff] [blame] | 42 | |
Hemant Kumar | f60c025 | 2011-11-03 12:37:07 -0700 | [diff] [blame] | 43 | void (*notify_modem)(void *g, u8 port_num, int cbits); |
Vamsi Krishna | 9e9921a | 2011-10-04 16:09:31 -0700 | [diff] [blame] | 44 | |
| 45 | void (*disconnect)(struct grmnet *g); |
| 46 | void (*connect)(struct grmnet *g); |
Bryan Huntsman | 3f2bc4d | 2011-08-16 17:27:22 -0700 | [diff] [blame] | 47 | }; |
| 48 | |
Bar Weiner | 6c817eb | 2013-04-15 20:52:18 +0300 | [diff] [blame] | 49 | enum ctrl_client { |
| 50 | FRMNET_CTRL_CLIENT, |
Bar Weiner | ed1059e | 2013-04-16 11:23:55 +0300 | [diff] [blame] | 51 | GPS_CTRL_CLIENT, |
Bar Weiner | 6c817eb | 2013-04-15 20:52:18 +0300 | [diff] [blame] | 52 | |
| 53 | NR_CTRL_CLIENTS |
| 54 | }; |
| 55 | |
Ofir Cohen | a1c2a87 | 2011-12-14 10:26:34 +0200 | [diff] [blame] | 56 | int gbam_setup(unsigned int no_bam_port, unsigned int no_bam2bam_port); |
Tarun Gupta | 44ad2bb | 2013-09-30 18:01:58 +0530 | [diff] [blame] | 57 | void gbam_cleanup(void); |
Ofir Cohen | a1c2a87 | 2011-12-14 10:26:34 +0200 | [diff] [blame] | 58 | int gbam_connect(struct grmnet *gr, u8 port_num, |
Shimrit Malichi | dbf43d7 | 2013-03-16 03:32:27 +0200 | [diff] [blame] | 59 | enum transport_type trans, u8 src_connection_idx, |
| 60 | u8 dst_connection_idx); |
| 61 | void gbam_disconnect(struct grmnet *gr, u8 port_num, |
| 62 | enum transport_type trans); |
Amit Blay | e5bb35e | 2012-05-08 20:38:20 +0300 | [diff] [blame] | 63 | void gbam_suspend(struct grmnet *gr, u8 port_num, enum transport_type trans); |
| 64 | void gbam_resume(struct grmnet *gr, u8 port_num, enum transport_type trans); |
Bryan Huntsman | 3f2bc4d | 2011-08-16 17:27:22 -0700 | [diff] [blame] | 65 | int gsmd_ctrl_connect(struct grmnet *gr, int port_num); |
| 66 | void gsmd_ctrl_disconnect(struct grmnet *gr, u8 port_num); |
Bar Weiner | 6c817eb | 2013-04-15 20:52:18 +0300 | [diff] [blame] | 67 | int gsmd_ctrl_setup(enum ctrl_client client_num, unsigned int count, |
| 68 | u8 *first_port_idx); |
Bar Weiner | 0dae81b | 2013-02-14 13:53:54 +0200 | [diff] [blame] | 69 | int gqti_ctrl_connect(struct grmnet *gr); |
| 70 | void gqti_ctrl_disconnect(struct grmnet *gr); |
Bryan Huntsman | 3f2bc4d | 2011-08-16 17:27:22 -0700 | [diff] [blame] | 71 | |
| 72 | #endif /* __U_RMNET_H*/ |