GNU Linux-libre 4.14.290-gnu1
[releases.git] / drivers / staging / gdm724x / gdm_tty.h
1 /*
2  * Copyright (c) 2012 GCT Semiconductor, Inc. All rights reserved.
3  *
4  * This software is licensed under the terms of the GNU General Public
5  * License version 2, as published by the Free Software Foundation, and
6  * may be copied, distributed, and modified under those terms.
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 _GDM_TTY_H_
15 #define _GDM_TTY_H_
16
17 #include <linux/types.h>
18 #include <linux/tty.h>
19
20 #define TTY_MAX_COUNT           2
21
22 #define MAX_ISSUE_NUM 3
23
24 enum TO_HOST_RESULT {
25         TO_HOST_BUFFER_REQUEST_FAIL = 1,
26         TO_HOST_PORT_CLOSE = 2,
27         TO_HOST_INVALID_PACKET = 3,
28 };
29
30 enum RECV_PACKET_PROCESS {
31         RECV_PACKET_PROCESS_COMPLETE = 0,
32         RECV_PACKET_PROCESS_CONTINUE = 1,
33 };
34
35 struct gdm {
36         struct tty_dev *tty_dev;
37         struct tty_port port;
38         unsigned int index;
39         unsigned int minor;
40 };
41
42 struct tty_dev {
43         void *priv_dev;
44         int (*send_func)(void *priv_dev,
45                          void *data,
46                          int len,
47                          int tty_index,
48                          void (*cb)(void *cb_data),
49                          void *cb_data);
50         int (*recv_func)(void *priv_dev,
51                          int (*cb)(void *data,
52                                    int len,
53                                    int tty_index,
54                                    struct tty_dev *tty_dev,
55                                    int complete));
56         int (*send_control)(void *priv_dev,
57                             int request,
58                             int value,
59                             void *data,
60                             int len);
61         struct gdm *gdm[2];
62 };
63
64 int register_lte_tty_driver(void);
65 void unregister_lte_tty_driver(void);
66 int register_lte_tty_device(struct tty_dev *tty_dev, struct device *dev);
67 void unregister_lte_tty_device(struct tty_dev *tty_dev);
68
69 #endif /* _GDM_USB_H_ */
70