Blame view

include/linux/serio.h 5.09 KB
1da177e4c   Linus Torvalds   Linux-2.6.12-rc2
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
  #ifndef _SERIO_H
  #define _SERIO_H
  
  /*
   * Copyright (C) 1999-2002 Vojtech Pavlik
  *
   * This program is free software; you can redistribute it and/or modify it
   * under the terms of the GNU General Public License version 2 as published by
   * the Free Software Foundation.
   */
  
  #include <linux/ioctl.h>
  
  #define SPIOCSTYPE	_IOW('q', 0x01, unsigned long)
  
  #ifdef __KERNEL__
7e044e056   Dmitry Torokhov   Input: serio - do...
17
  #include <linux/types.h>
1da177e4c   Linus Torvalds   Linux-2.6.12-rc2
18
19
20
  #include <linux/interrupt.h>
  #include <linux/list.h>
  #include <linux/spinlock.h>
c4e32e9fa   Arjan van de Ven   Input: serio - se...
21
  #include <linux/mutex.h>
1da177e4c   Linus Torvalds   Linux-2.6.12-rc2
22
23
24
25
26
27
28
29
  #include <linux/device.h>
  #include <linux/mod_devicetable.h>
  
  struct serio {
  	void *port_data;
  
  	char name[32];
  	char phys[32];
7e044e056   Dmitry Torokhov   Input: serio - do...
30
  	bool manual_bind;
1da177e4c   Linus Torvalds   Linux-2.6.12-rc2
31
32
33
34
35
36
37
38
39
40
  
  	struct serio_device_id id;
  
  	spinlock_t lock;		/* protects critical sections from port's interrupt handler */
  
  	int (*write)(struct serio *, unsigned char);
  	int (*open)(struct serio *);
  	void (*close)(struct serio *);
  	int (*start)(struct serio *);
  	void (*stop)(struct serio *);
098225826   Dmitry Eremin-Solenikov   Input: serio - su...
41
42
43
  	struct serio *parent;
  	struct list_head child_node;	/* Entry in parent->children list */
  	struct list_head children;
88aa0103e   Jiri Kosina   Input: serio - ad...
44
  	unsigned int depth;		/* level of nesting in serio hierarchy */
1da177e4c   Linus Torvalds   Linux-2.6.12-rc2
45
46
  
  	struct serio_driver *drv;	/* accessed from interrupt, must be protected by serio->lock and serio->sem */
c4e32e9fa   Arjan van de Ven   Input: serio - se...
47
  	struct mutex drv_mutex;		/* protects serio->drv so attributes can pin driver */
1da177e4c   Linus Torvalds   Linux-2.6.12-rc2
48
49
  
  	struct device dev;
1da177e4c   Linus Torvalds   Linux-2.6.12-rc2
50
51
52
53
54
55
  
  	struct list_head node;
  };
  #define to_serio_port(d)	container_of(d, struct serio, dev)
  
  struct serio_driver {
ceee42714   Dmitry Torokhov   Input: serio_driv...
56
  	const char *description;
1da177e4c   Linus Torvalds   Linux-2.6.12-rc2
57

ceee42714   Dmitry Torokhov   Input: serio_driv...
58
  	const struct serio_device_id *id_table;
7e044e056   Dmitry Torokhov   Input: serio - do...
59
  	bool manual_bind;
1da177e4c   Linus Torvalds   Linux-2.6.12-rc2
60
61
  
  	void (*write_wakeup)(struct serio *);
7d12e780e   David Howells   IRQ: Maintain reg...
62
  	irqreturn_t (*interrupt)(struct serio *, unsigned char, unsigned int);
1da177e4c   Linus Torvalds   Linux-2.6.12-rc2
63
64
65
66
67
68
69
70
71
72
73
74
75
  	int  (*connect)(struct serio *, struct serio_driver *drv);
  	int  (*reconnect)(struct serio *);
  	void (*disconnect)(struct serio *);
  	void (*cleanup)(struct serio *);
  
  	struct device_driver driver;
  };
  #define to_serio_driver(d)	container_of(d, struct serio_driver, driver)
  
  int serio_open(struct serio *serio, struct serio_driver *drv);
  void serio_close(struct serio *serio);
  void serio_rescan(struct serio *serio);
  void serio_reconnect(struct serio *serio);
7d12e780e   David Howells   IRQ: Maintain reg...
76
  irqreturn_t serio_interrupt(struct serio *serio, unsigned char data, unsigned int flags);
1da177e4c   Linus Torvalds   Linux-2.6.12-rc2
77
78
  
  void __serio_register_port(struct serio *serio, struct module *owner);
eb5589a8f   Paul Gortmaker   include: convert ...
79
80
81
82
  
  /* use a define to avoid include chaining to get THIS_MODULE */
  #define serio_register_port(serio) \
  	__serio_register_port(serio, THIS_MODULE)
1da177e4c   Linus Torvalds   Linux-2.6.12-rc2
83
84
  
  void serio_unregister_port(struct serio *serio);
dbf4ccd60   Dmitry Torokhov   Input: psmouse - ...
85
  void serio_unregister_child_port(struct serio *serio);
1da177e4c   Linus Torvalds   Linux-2.6.12-rc2
86

eb5589a8f   Paul Gortmaker   include: convert ...
87
88
89
90
91
92
  int __must_check __serio_register_driver(struct serio_driver *drv,
  				struct module *owner, const char *mod_name);
  
  /* use a define to avoid include chaining to get THIS_MODULE & friends */
  #define serio_register_driver(drv) \
  	__serio_register_driver(drv, THIS_MODULE, KBUILD_MODNAME)
1da177e4c   Linus Torvalds   Linux-2.6.12-rc2
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
  void serio_unregister_driver(struct serio_driver *drv);
  
  static inline int serio_write(struct serio *serio, unsigned char data)
  {
  	if (serio->write)
  		return serio->write(serio, data);
  	else
  		return -1;
  }
  
  static inline void serio_drv_write_wakeup(struct serio *serio)
  {
  	if (serio->drv && serio->drv->write_wakeup)
  		serio->drv->write_wakeup(serio);
  }
1da177e4c   Linus Torvalds   Linux-2.6.12-rc2
108
  /*
0b28002fd   Akinobu Mita   [PATCH] more s/fu...
109
   * Use the following functions to manipulate serio's per-port
1da177e4c   Linus Torvalds   Linux-2.6.12-rc2
110
111
112
113
114
115
116
117
118
119
120
121
122
   * driver-specific data.
   */
  static inline void *serio_get_drvdata(struct serio *serio)
  {
  	return dev_get_drvdata(&serio->dev);
  }
  
  static inline void serio_set_drvdata(struct serio *serio, void *data)
  {
  	dev_set_drvdata(&serio->dev, data);
  }
  
  /*
0b28002fd   Akinobu Mita   [PATCH] more s/fu...
123
   * Use the following functions to protect critical sections in
1da177e4c   Linus Torvalds   Linux-2.6.12-rc2
124
125
126
127
128
129
130
131
132
133
134
   * driver code from port's interrupt handler
   */
  static inline void serio_pause_rx(struct serio *serio)
  {
  	spin_lock_irq(&serio->lock);
  }
  
  static inline void serio_continue_rx(struct serio *serio)
  {
  	spin_unlock_irq(&serio->lock);
  }
1da177e4c   Linus Torvalds   Linux-2.6.12-rc2
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
  #endif
  
  /*
   * bit masks for use in "interrupt" flags (3rd argument)
   */
  #define SERIO_TIMEOUT	1
  #define SERIO_PARITY	2
  #define SERIO_FRAME	4
  
  /*
   * Serio types
   */
  #define SERIO_XT	0x00
  #define SERIO_8042	0x01
  #define SERIO_RS232	0x02
  #define SERIO_HIL_MLC	0x03
  #define SERIO_PS_PSTHRU	0x05
  #define SERIO_8042_XL	0x06
  
  /*
f3d1eb19a   Niels de Vos   Input: serio - tr...
155
   * Serio protocols
1da177e4c   Linus Torvalds   Linux-2.6.12-rc2
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
   */
  #define SERIO_UNKNOWN	0x00
  #define SERIO_MSC	0x01
  #define SERIO_SUN	0x02
  #define SERIO_MS	0x03
  #define SERIO_MP	0x04
  #define SERIO_MZ	0x05
  #define SERIO_MZP	0x06
  #define SERIO_MZPP	0x07
  #define SERIO_VSXXXAA	0x08
  #define SERIO_SUNKBD	0x10
  #define SERIO_WARRIOR	0x18
  #define SERIO_SPACEORB	0x19
  #define SERIO_MAGELLAN	0x1a
  #define SERIO_SPACEBALL	0x1b
  #define SERIO_GUNZE	0x1c
  #define SERIO_IFORCE	0x1d
  #define SERIO_STINGER	0x1e
  #define SERIO_NEWTON	0x1f
  #define SERIO_STOWAWAY	0x20
  #define SERIO_H3600	0x21
  #define SERIO_PS2SER	0x22
  #define SERIO_TWIDKBD	0x23
  #define SERIO_TWIDJOY	0x24
  #define SERIO_HIL	0x25
  #define SERIO_SNES232	0x26
  #define SERIO_SEMTECH	0x27
  #define SERIO_LKKBD	0x28
  #define SERIO_ELO	0x29
  #define SERIO_MICROTOUCH	0x30
ee4799997   Rick Koch   Input: add driver...
186
  #define SERIO_PENMOUNT	0x31
4003dff41   Rick Koch   Input: add driver...
187
  #define SERIO_TOUCHRIGHT	0x32
11ea3173d   Rick Koch   Input: add driver...
188
  #define SERIO_TOUCHWIN	0x33
b9cdad748   Jean Delvare   i2c: New bus driv...
189
  #define SERIO_TAOSEVM	0x34
85f202d5d   Dmitry Torokhov   Input: add driver...
190
  #define SERIO_FUJITSU	0x35
3e24e2b5a   Martin Kebert   Input: add Zhen H...
191
  #define SERIO_ZHENHUA	0x36
3cadd2d98   Richard Lemon   Input: Add driver...
192
  #define SERIO_INEXIO	0x37
ab96ddec7   Dmitry Torokhov   Input: serio - fi...
193
  #define SERIO_TOUCHIT213	0x38
3eb1aa43e   Jaya Kumar   Input: add suppor...
194
  #define SERIO_W8001	0x39
a5f523bc0   Tias Guns   Input: add driver...
195
  #define SERIO_DYNAPRO	0x3a
422dee56b   Adam Bennett   Input: add driver...
196
  #define SERIO_HAMPSHIRE	0x3b
fc58d12be   Dmitry Eremin-Solenikov   Input: serio - ad...
197
  #define SERIO_PS2MULT	0x3c
f01536e3d   Sebastian Andrzej Siewior   Input: add a driv...
198
  #define SERIO_TSC40	0x3d
1da177e4c   Linus Torvalds   Linux-2.6.12-rc2
199
200
  
  #endif