Linux Kernel
3.7.1
Main Page
Related Pages
Modules
Namespaces
Data Structures
Files
File List
Globals
All
Data Structures
Namespaces
Files
Functions
Variables
Typedefs
Enumerations
Enumerator
Macros
Groups
Pages
drivers
staging
nvec
nvec.h
Go to the documentation of this file.
1
/*
2
* NVEC: NVIDIA compliant embedded controller interface
3
*
4
* Copyright (C) 2011 The AC100 Kernel Team <
[email protected]
>
5
*
6
* Authors: Pierre-Hugues Husson <
[email protected]
>
7
* Ilya Petrov <
[email protected]
>
8
* Marc Dietrich <
[email protected]
>
9
* Julian Andres Klode <
[email protected]
>
10
*
11
* This file is subject to the terms and conditions of the GNU General Public
12
* License. See the file "COPYING" in the main directory of this archive
13
* for more details.
14
*
15
*/
16
17
#ifndef __LINUX_MFD_NVEC
18
#define __LINUX_MFD_NVEC
19
20
#include <
linux/atomic.h
>
21
#include <
linux/clk.h
>
22
#include <
linux/completion.h
>
23
#include <linux/list.h>
24
#include <
linux/mutex.h
>
25
#include <
linux/notifier.h
>
26
#include <
linux/spinlock.h
>
27
#include <
linux/workqueue.h
>
28
29
/* NVEC_POOL_SIZE - Size of the pool in &struct nvec_msg */
30
#define NVEC_POOL_SIZE 64
31
32
/*
33
* NVEC_MSG_SIZE - Maximum size of the data field of &struct nvec_msg.
34
*
35
* A message must store up to a SMBus block operation which consists of
36
* one command byte, one count byte, and up to 32 payload bytes = 34
37
* byte.
38
*/
39
#define NVEC_MSG_SIZE 34
40
52
enum
nvec_event_size
{
53
NVEC_2BYTES
,
54
NVEC_3BYTES
,
55
NVEC_VAR_SIZE
,
56
};
57
71
enum
nvec_msg_type
{
72
NVEC_SYS
= 1,
73
NVEC_BAT
,
74
NVEC_KBD
= 5,
75
NVEC_PS2
,
76
NVEC_CNTL
,
77
NVEC_KB_EVT
= 0x80,
78
NVEC_PS2_EVT
,
79
};
80
94
struct
nvec_msg
{
95
struct
list_head
node
;
96
unsigned
char
data
[
NVEC_MSG_SIZE
];
97
unsigned
short
size
;
98
unsigned
short
pos
;
99
atomic_t
used
;
100
};
101
108
struct
nvec_subdev
{
109
const
char
*
name
;
110
void
*
platform_data
;
111
int
id
;
112
};
113
122
struct
nvec_platform_data
{
123
int
i2c_addr
;
124
int
gpio
;
125
};
126
157
struct
nvec_chip
{
158
struct
device
*
dev
;
159
int
gpio
;
160
int
irq
;
161
int
i2c_addr
;
162
void
__iomem
*
base
;
163
struct
clk
*
i2c_clk
;
164
struct
atomic_notifier_head
notifier_list
;
165
struct
list_head
rx_data
,
tx_data
;
166
struct
notifier_block
nvec_status_notifier
;
167
struct
work_struct
rx_work
,
tx_work
;
168
struct
workqueue_struct
*
wq
;
169
struct
nvec_msg
msg_pool
[
NVEC_POOL_SIZE
];
170
struct
nvec_msg
*
rx
;
171
172
struct
nvec_msg
*
tx
;
173
struct
nvec_msg
tx_scratch
;
174
struct
completion
ec_transfer
;
175
176
spinlock_t
tx_lock
,
rx_lock
;
177
178
/* sync write stuff */
179
struct
mutex
sync_write_mutex
;
180
struct
completion
sync_write
;
181
u16
sync_write_pending
;
182
struct
nvec_msg
*
last_sync_msg
;
183
184
int
state
;
185
};
186
187
extern
int
nvec_write_async
(
struct
nvec_chip
*nvec,
const
unsigned
char
*
data
,
188
short
size
);
189
190
extern
struct
nvec_msg
*
nvec_write_sync
(
struct
nvec_chip
*nvec,
191
const
unsigned
char
*
data
,
short
size
);
192
193
extern
int
nvec_register_notifier
(
struct
nvec_chip
*nvec,
194
struct
notifier_block
*nb,
195
unsigned
int
events
);
196
197
extern
int
nvec_unregister_notifier
(
struct
device
*
dev
,
198
struct
notifier_block
*nb,
199
unsigned
int
events
);
200
201
extern
void
nvec_msg_free
(
struct
nvec_chip
*nvec,
struct
nvec_msg
*
msg
);
202
203
#endif
Generated on Thu Jan 10 2013 14:29:47 for Linux Kernel by
1.8.2