1 /* SPDX-License-Identifier: GPL-2.0 */
2 /* Copyright (c) 2012 GCT Semiconductor, Inc. All rights reserved. */
3 
4 #ifndef _GDM_TTY_H_
5 #define _GDM_TTY_H_
6 
7 #include <linux/types.h>
8 #include <linux/tty.h>
9 
10 #define TTY_MAX_COUNT		2
11 
12 #define MAX_ISSUE_NUM 3
13 
14 enum TO_HOST_RESULT {
15 	TO_HOST_BUFFER_REQUEST_FAIL = 1,
16 	TO_HOST_PORT_CLOSE = 2,
17 	TO_HOST_INVALID_PACKET = 3,
18 };
19 
20 enum RECV_PACKET_PROCESS {
21 	RECV_PACKET_PROCESS_COMPLETE = 0,
22 	RECV_PACKET_PROCESS_CONTINUE = 1,
23 };
24 
25 struct gdm {
26 	struct tty_dev *tty_dev;
27 	struct tty_port port;
28 	unsigned int index;
29 	unsigned int minor;
30 };
31 
32 struct tty_dev {
33 	void *priv_dev;
34 	int (*send_func)(void *priv_dev,
35 			 void *data,
36 			 int len,
37 			 int tty_index,
38 			 void (*cb)(void *cb_data),
39 			 void *cb_data);
40 	int (*recv_func)(void *priv_dev,
41 			 int (*cb)(void *data,
42 				   int len,
43 				   int tty_index,
44 				   struct tty_dev *tty_dev,
45 				   int complete));
46 	int (*send_control)(void *priv_dev,
47 			    int request,
48 			    int value,
49 			    void *data,
50 			    int len);
51 	struct gdm *gdm[2];
52 };
53 
54 int register_lte_tty_driver(void);
55 void unregister_lte_tty_driver(void);
56 int register_lte_tty_device(struct tty_dev *tty_dev, struct device *dev);
57 void unregister_lte_tty_device(struct tty_dev *tty_dev);
58 
59 #endif /* _GDM_USB_H_ */
60 
61