989713b75078e5cbbc4ac7fed3319f3a9895ec89
[cascardo/linux.git] / include / linux / mfd / chromeos_ec.h
1 /*
2  *  Copyright (C) 2012 Google, Inc
3  *
4  *  This program is free software; you can redistribute it and/or modify
5  *  it under the terms of the GNU General Public License as published by
6  *  the Free Software Foundation; either version 2 of the License, or
7  *  (at your option) any later version.
8  *
9  *  This program is distributed in the hope that it will be useful,
10  *  but WITHOUT ANY WARRANTY; without even the implied warranty of
11  *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
12  *  GNU General Public License for more details.
13  *
14  *  You should have received a copy of the GNU General Public License
15  *  along with this program; if not, write to the Free Software
16  *  Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
17  *
18  *
19  * ChromeOS EC multi function device
20  */
21
22 #ifndef __LINUX_MFD_CHROMEOS_EC_H
23 #define __LINUX_MFD_CHROMEOS_EC_H
24
25 struct i2c_msg;
26
27 struct chromeos_ec_msg {
28         u8 cmd;
29         uint8_t *out_buf;
30         int out_len;
31         uint8_t *in_buf;
32         int in_len;
33 };
34
35 struct chromeos_ec_device {
36         struct device *dev;
37         struct i2c_client *client;
38         int irq;
39         struct blocking_notifier_head event_notifier;
40         int (*command_send)(struct chromeos_ec_device *ec,
41                         char cmd, void *out_buf, int out_len);
42         int (*command_recv)(struct chromeos_ec_device *ec,
43                         char cmd, void *in_buf, int in_len);
44         int (*command_xfer)(struct chromeos_ec_device *ec,
45                         struct chromeos_ec_msg *msg);
46         int (*command_raw)(struct chromeos_ec_device *ec,
47                         struct i2c_msg *msgs, int num);
48 };
49
50 #endif /* __LINUX_MFD_CHROMEOS_EC_H */