staging: nvec: Include missing headers
[linux-2.6/linux-acpi-2.6/ibm-acpi-2.6.git] / drivers / staging / nvec / nvec.h
blob7cf9b01f898992284d3e932c3045a276eda69c53
1 #ifndef __LINUX_MFD_NVEC
2 #define __LINUX_MFD_NVEC
4 #include <linux/notifier.h>
5 #include <linux/semaphore.h>
7 typedef enum {
8 NVEC_2BYTES,
9 NVEC_3BYTES,
10 NVEC_VAR_SIZE
11 } nvec_size;
13 typedef enum {
14 NOT_REALLY,
15 YES,
16 NOT_AT_ALL,
17 } how_care;
19 typedef enum {
20 NVEC_SYS=1,
21 NVEC_BAT,
22 NVEC_KBD = 5,
23 NVEC_PS2,
24 NVEC_CNTL,
25 NVEC_KB_EVT = 0x80,
26 NVEC_PS2_EVT
27 } nvec_event;
29 typedef enum {
30 NVEC_WAIT,
31 NVEC_READ,
32 NVEC_WRITE
33 } nvec_state;
35 struct nvec_msg {
36 unsigned char *data;
37 unsigned short size;
38 unsigned short pos;
39 struct list_head node;
42 struct nvec_subdev {
43 const char *name;
44 void *platform_data;
45 int id;
48 struct nvec_platform_data {
49 int i2c_addr;
50 int gpio;
53 struct nvec_chip {
54 struct device *dev;
55 int gpio;
56 int irq;
57 int i2c_addr;
58 void __iomem *base;
59 struct clk *i2c_clk;
60 nvec_state state;
61 struct atomic_notifier_head notifier_list;
62 struct list_head rx_data, tx_data;
63 struct notifier_block nvec_status_notifier;
64 struct work_struct rx_work, tx_work;
65 struct nvec_msg *rx, *tx;
67 /* sync write stuff */
68 struct semaphore sync_write_mutex;
69 struct completion sync_write;
70 u16 sync_write_pending;
71 struct nvec_msg *last_sync_msg;
74 extern void nvec_write_async(struct nvec_chip *nvec, unsigned char *data, short size);
76 extern int nvec_register_notifier(struct nvec_chip *nvec,
77 struct notifier_block *nb, unsigned int events);
79 extern int nvec_unregister_notifier(struct device *dev,
80 struct notifier_block *nb, unsigned int events);
82 const char *nvec_send_msg(unsigned char *src, unsigned char *dst_size, how_care care_resp, void (*rt_handler)(unsigned char *data));
84 #define I2C_CNFG 0x00
85 #define I2C_CNFG_PACKET_MODE_EN (1<<10)
86 #define I2C_CNFG_NEW_MASTER_SFM (1<<11)
87 #define I2C_CNFG_DEBOUNCE_CNT_SHIFT 12
89 #define I2C_SL_CNFG 0x20
90 #define I2C_SL_NEWL (1<<2)
91 #define I2C_SL_NACK (1<<1)
92 #define I2C_SL_RESP (1<<0)
93 #define I2C_SL_IRQ (1<<3)
94 #define END_TRANS (1<<4)
95 #define RCVD (1<<2)
96 #define RNW (1<<1)
98 #define I2C_SL_RCVD 0x24
99 #define I2C_SL_STATUS 0x28
100 #define I2C_SL_ADDR1 0x2c
101 #define I2C_SL_ADDR2 0x30
102 #define I2C_SL_DELAY_COUNT 0x3c
104 #endif