Bill Richardson | e7c256f | 2015-02-02 12:26:25 +0100 | [diff] [blame] | 1 | /* |
| 2 | * cros_ec_dev - expose the Chrome OS Embedded Controller to userspace |
| 3 | * |
| 4 | * Copyright (C) 2014 Google, Inc. |
| 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, see <http://www.gnu.org/licenses/>. |
| 18 | */ |
| 19 | |
| 20 | #ifndef _CROS_EC_DEV_H_ |
| 21 | #define _CROS_EC_DEV_H_ |
| 22 | |
| 23 | #include <linux/ioctl.h> |
| 24 | #include <linux/types.h> |
| 25 | #include <linux/mfd/cros_ec.h> |
| 26 | |
Bill Richardson | e7c256f | 2015-02-02 12:26:25 +0100 | [diff] [blame] | 27 | #define CROS_EC_DEV_VERSION "1.0.0" |
| 28 | |
Enric Balletbo i Serra | e2bbf91 | 2018-07-18 18:09:56 +0200 | [diff] [blame] | 29 | /** |
| 30 | * struct cros_ec_readmem - Struct used to read mapped memory. |
| 31 | * @offset: Within EC_LPC_ADDR_MEMMAP region. |
| 32 | * @bytes: Number of bytes to read. Zero means "read a string" (including '\0') |
| 33 | * At most only EC_MEMMAP_SIZE bytes can be read. |
| 34 | * @buffer: Where to store the result. The ioctl returns the number of bytes |
| 35 | * read or negative on error. |
Bill Richardson | e7c256f | 2015-02-02 12:26:25 +0100 | [diff] [blame] | 36 | */ |
| 37 | struct cros_ec_readmem { |
| 38 | uint32_t offset; |
| 39 | uint32_t bytes; |
| 40 | uint8_t buffer[EC_MEMMAP_SIZE]; |
| 41 | }; |
| 42 | |
| 43 | #define CROS_EC_DEV_IOC 0xEC |
| 44 | #define CROS_EC_DEV_IOCXCMD _IOWR(CROS_EC_DEV_IOC, 0, struct cros_ec_command) |
| 45 | #define CROS_EC_DEV_IOCRDMEM _IOWR(CROS_EC_DEV_IOC, 1, struct cros_ec_readmem) |
| 46 | |
Bill Richardson | e7c256f | 2015-02-02 12:26:25 +0100 | [diff] [blame] | 47 | #endif /* _CROS_EC_DEV_H_ */ |