linux/drivers/staging/gdm724x/gdm_mux.h
<<
>>
Prefs
   1/* SPDX-License-Identifier: GPL-2.0 */
   2/* Copyright (c) 2012 GCT Semiconductor, Inc. All rights reserved. */
   3
   4#ifndef _GDM_MUX_H_
   5#define _GDM_MUX_H_
   6
   7#include <linux/types.h>
   8#include <linux/usb.h>
   9#include <linux/list.h>
  10
  11#include "gdm_tty.h"
  12
  13#define PM_NORMAL 0
  14#define PM_SUSPEND 1
  15
  16#define USB_RT_ACM          (USB_TYPE_CLASS | USB_RECIP_INTERFACE)
  17
  18#define START_FLAG 0xA512485A
  19#define MUX_HEADER_SIZE 14
  20#define MUX_TX_MAX_SIZE (1024 * 10)
  21#define MUX_RX_MAX_SIZE (1024 * 30)
  22#define AT_PKT_TYPE 0xF011
  23#define DM_PKT_TYPE 0xF010
  24
  25#define RETRY_TIMER 30 /* msec */
  26
  27struct mux_pkt_header {
  28        __le32 start_flag;
  29        __le32 seq_num;
  30        __le32 payload_size;
  31        __le16 packet_type;
  32        unsigned char data[0];
  33};
  34
  35struct mux_tx {
  36        struct urb *urb;
  37        u8 *buf;
  38        int  len;
  39        void (*callback)(void *cb_data);
  40        void *cb_data;
  41};
  42
  43struct mux_rx {
  44        struct list_head free_list;
  45        struct list_head rx_submit_list;
  46        struct list_head to_host_list;
  47        struct urb *urb;
  48        u8 *buf;
  49        void *mux_dev;
  50        u32 offset;
  51        u32 len;
  52        int (*callback)(void *data,
  53                        int len,
  54                        int tty_index,
  55                        struct tty_dev *tty_dev,
  56                        int complete);
  57};
  58
  59struct rx_cxt {
  60        struct list_head to_host_list;
  61        struct list_head rx_submit_list;
  62        struct list_head rx_free_list;
  63        spinlock_t to_host_lock;
  64        spinlock_t submit_list_lock;
  65        spinlock_t free_list_lock;
  66};
  67
  68struct mux_dev {
  69        struct usb_device *usbdev;
  70        struct usb_interface *control_intf;
  71        struct usb_interface *data_intf;
  72        struct rx_cxt   rx;
  73        struct delayed_work work_rx;
  74        struct usb_interface *intf;
  75        int usb_state;
  76        int (*rx_cb)(void *data,
  77                     int len,
  78                     int tty_index,
  79                     struct tty_dev *tty_dev,
  80                     int complete);
  81        spinlock_t write_lock;
  82        struct tty_dev *tty_dev;
  83};
  84
  85#endif /* _GDM_MUX_H_ */
  86