Merge tag 'gpio-v3.13-3' of git://git.kernel.org/pub/scm/linux/kernel/git/linusw...
[linux-2.6.git] / drivers / staging / gdm724x / gdm_mux.h
blob0163b243d3e05a6e17ef82727312f75f3224a5d0
1 /*
2 * Copyright (c) 2012 GCT Semiconductor, Inc. All rights reserved.
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.
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.
14 #ifndef _GDM_MUX_H_
15 #define _GDM_MUX_H_
17 #include <linux/types.h>
18 #include <linux/usb.h>
19 #include <linux/list.h>
21 #include "gdm_tty.h"
23 #define PM_NORMAL 0
24 #define PM_SUSPEND 1
26 #define USB_RT_ACM (USB_TYPE_CLASS | USB_RECIP_INTERFACE)
28 #define START_FLAG 0xA512485A
29 #define MUX_HEADER_SIZE 14
30 #define MUX_TX_MAX_SIZE (1024*10)
31 #define MUX_RX_MAX_SIZE (1024*30)
32 #define AT_PKT_TYPE 0xF011
33 #define DM_PKT_TYPE 0xF010
35 #define RETRY_TIMER 30 /* msec */
37 struct mux_pkt_header {
38 unsigned int start_flag;
39 unsigned int seq_num;
40 unsigned int payload_size;
41 unsigned short packet_type;
42 unsigned char data[0];
45 struct mux_tx {
46 struct urb *urb;
47 u8 *buf;
48 int len;
49 void (*callback)(void *cb_data);
50 void *cb_data;
53 struct mux_rx {
54 struct list_head free_list;
55 struct list_head rx_submit_list;
56 struct list_head to_host_list;
57 struct urb *urb;
58 u8 *buf;
59 void *mux_dev;
60 u32 offset;
61 u32 len;
62 int (*callback)(void *data,
63 int len,
64 int tty_index,
65 struct tty_dev *tty_dev,
66 int complete);
69 struct rx_cxt {
70 struct list_head to_host_list;
71 struct list_head rx_submit_list;
72 struct list_head rx_free_list;
73 spinlock_t to_host_lock;
74 spinlock_t submit_list_lock;
75 spinlock_t free_list_lock;
78 struct mux_dev {
79 struct usb_device *usbdev;
80 struct usb_interface *control_intf;
81 struct usb_interface *data_intf;
82 struct rx_cxt rx;
83 struct delayed_work work_rx;
84 struct usb_interface *intf;
85 int usb_state;
86 int (*rx_cb)(void *data,
87 int len,
88 int tty_index,
89 struct tty_dev *tty_dev,
90 int complete);
91 spinlock_t write_lock;
92 struct tty_dev *tty_dev;
95 #endif /* _GDM_MUX_H_ */