unify {de,}mangle_poll(), get rid of kernel-side POLL...
[cris-mirror.git] / include / linux / mfd / cros_ec_lpc_reg.h
blob5560bef63c2bd92103875ea1e57581b6ddf6c075
1 /*
2 * cros_ec_lpc_reg - LPC access to the Chrome OS Embedded Controller
4 * Copyright (C) 2016 Google, Inc
6 * This software is licensed under the terms of the GNU General Public
7 * License version 2, as published by the Free Software Foundation, and
8 * may be copied, distributed, and modified under those terms.
10 * This program is distributed in the hope that it will be useful,
11 * but WITHOUT ANY WARRANTY; without even the implied warranty of
12 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13 * GNU General Public License for more details.
15 * This driver uses the Chrome OS EC byte-level message-based protocol for
16 * communicating the keyboard state (which keys are pressed) from a keyboard EC
17 * to the AP over some bus (such as i2c, lpc, spi). The EC does debouncing,
18 * but everything else (including deghosting) is done here. The main
19 * motivation for this is to keep the EC firmware as simple as possible, since
20 * it cannot be easily upgraded and EC flash/IRAM space is relatively
21 * expensive.
24 #ifndef __LINUX_MFD_CROS_EC_REG_H
25 #define __LINUX_MFD_CROS_EC_REG_H
27 /**
28 * cros_ec_lpc_read_bytes - Read bytes from a given LPC-mapped address.
29 * Returns 8-bit checksum of all bytes read.
31 * @offset: Base read address
32 * @length: Number of bytes to read
33 * @dest: Destination buffer
35 u8 cros_ec_lpc_read_bytes(unsigned int offset, unsigned int length, u8 *dest);
37 /**
38 * cros_ec_lpc_write_bytes - Write bytes to a given LPC-mapped address.
39 * Returns 8-bit checksum of all bytes written.
41 * @offset: Base write address
42 * @length: Number of bytes to write
43 * @msg: Write data buffer
45 u8 cros_ec_lpc_write_bytes(unsigned int offset, unsigned int length, u8 *msg);
47 /**
48 * cros_ec_lpc_reg_init
50 * Initialize register I/O.
52 void cros_ec_lpc_reg_init(void);
54 /**
55 * cros_ec_lpc_reg_destroy
57 * Cleanup reg I/O.
59 void cros_ec_lpc_reg_destroy(void);
61 #endif /* __LINUX_MFD_CROS_EC_REG_H */