blob: 6a80529411bb9f3eca9799700044b2c33940d0a4 [file] [log] [blame]
Bar Weiner0dae81b2013-02-14 13:53:54 +02001/* Copyright (c) 2011-2013, The Linux Foundation. All rights reserved.
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07002 *
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
21struct rmnet_ctrl_pkt {
22 void *buf;
23 int len;
24 struct list_head list;
25};
26
27struct grmnet {
28 struct usb_function func;
29
30 struct usb_ep *in;
31 struct usb_ep *out;
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -070032
33 /* to usb host, aka laptop, windows pc etc. Will
34 * be filled by usb driver of rmnet functionality
35 */
Hemant Kumarf60c0252011-11-03 12:37:07 -070036 int (*send_cpkt_response)(void *g, void *buf, size_t len);
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -070037
38 /* to modem, and to be filled by driver implementing
39 * control function
40 */
Hemant Kumarf60c0252011-11-03 12:37:07 -070041 int (*send_encap_cmd)(u8 port_num, void *buf, size_t len);
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -070042
Hemant Kumarf60c0252011-11-03 12:37:07 -070043 void (*notify_modem)(void *g, u8 port_num, int cbits);
Vamsi Krishna9e9921a2011-10-04 16:09:31 -070044
45 void (*disconnect)(struct grmnet *g);
46 void (*connect)(struct grmnet *g);
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -070047};
48
Bar Weiner6c817eb2013-04-15 20:52:18 +030049enum ctrl_client {
50 FRMNET_CTRL_CLIENT,
Bar Weinered1059e2013-04-16 11:23:55 +030051 GPS_CTRL_CLIENT,
Bar Weiner6c817eb2013-04-15 20:52:18 +030052
53 NR_CTRL_CLIENTS
54};
55
Ofir Cohena1c2a872011-12-14 10:26:34 +020056int gbam_setup(unsigned int no_bam_port, unsigned int no_bam2bam_port);
Tarun Gupta44ad2bb2013-09-30 18:01:58 +053057void gbam_cleanup(void);
Ofir Cohena1c2a872011-12-14 10:26:34 +020058int gbam_connect(struct grmnet *gr, u8 port_num,
Shimrit Malichidbf43d72013-03-16 03:32:27 +020059 enum transport_type trans, u8 src_connection_idx,
60 u8 dst_connection_idx);
61void gbam_disconnect(struct grmnet *gr, u8 port_num,
62 enum transport_type trans);
Amit Blaye5bb35e2012-05-08 20:38:20 +030063void gbam_suspend(struct grmnet *gr, u8 port_num, enum transport_type trans);
64void gbam_resume(struct grmnet *gr, u8 port_num, enum transport_type trans);
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -070065int gsmd_ctrl_connect(struct grmnet *gr, int port_num);
66void gsmd_ctrl_disconnect(struct grmnet *gr, u8 port_num);
Bar Weiner6c817eb2013-04-15 20:52:18 +030067int gsmd_ctrl_setup(enum ctrl_client client_num, unsigned int count,
68 u8 *first_port_idx);
Bar Weiner0dae81b2013-02-14 13:53:54 +020069int gqti_ctrl_connect(struct grmnet *gr);
70void gqti_ctrl_disconnect(struct grmnet *gr);
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -070071
72#endif /* __U_RMNET_H*/