OSDN Git Service

Merge remote-tracking branch 'x86/nougat-x86' into oreo-x86
[android-x86/device-generic-common.git] / tp_smapi / thinkpad_ec.h
1 /*
2  *  thinkpad_ec.h - interface to ThinkPad embedded controller LPC3 functions
3  *
4  *  Copyright (C) 2005 Shem Multinymous <multinymous@gmail.com>
5  *
6  *  This program is free software; you can redistribute it and/or modify
7  *  it under the terms of the GNU General Public License as published by
8  *  the Free Software Foundation; either version 2 of the License, or
9  *  (at your option) any later version.
10  *
11  *  This program is distributed in the hope that it will be useful,
12  *  but WITHOUT ANY WARRANTY; without even the implied warranty of
13  *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
14  *  GNU General Public License for more details.
15  *
16  *  You should have received a copy of the GNU General Public License
17  *  along with this program; if not, write to the Free Software
18  *  Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
19  */
20
21 #ifndef _THINKPAD_EC_H
22 #define _THINKPAD_EC_H
23
24 #ifdef __KERNEL__
25
26 #define TP_CONTROLLER_ROW_LEN 16
27
28 /* EC transactions input and output (possibly partial) vectors of 16 bytes. */
29 struct thinkpad_ec_row {
30         u16 mask; /* bitmap of which entries of val[] are meaningful */
31         u8 val[TP_CONTROLLER_ROW_LEN];
32 };
33
34 extern int __must_check thinkpad_ec_lock(void);
35 extern int __must_check thinkpad_ec_try_lock(void);
36 extern void thinkpad_ec_unlock(void);
37
38 extern int thinkpad_ec_read_row(const struct thinkpad_ec_row *args,
39                                 struct thinkpad_ec_row *data);
40 extern int thinkpad_ec_try_read_row(const struct thinkpad_ec_row *args,
41                                     struct thinkpad_ec_row *mask);
42 extern int thinkpad_ec_prefetch_row(const struct thinkpad_ec_row *args);
43 extern void thinkpad_ec_invalidate(void);
44
45
46 #endif /* __KERNEL */
47 #endif /* _THINKPAD_EC_H */