Thomas Gleixner | 1ccea77 | 2019-05-19 15:51:43 +0200 | [diff] [blame] | 1 | /* SPDX-License-Identifier: GPL-2.0-or-later */ |
Bill Richardson | e7c256f | 2015-02-02 12:26:25 +0100 | [diff] [blame] | 2 | /* |
| 3 | * cros_ec_dev - expose the Chrome OS Embedded Controller to userspace |
| 4 | * |
| 5 | * Copyright (C) 2014 Google, Inc. |
Bill Richardson | e7c256f | 2015-02-02 12:26:25 +0100 | [diff] [blame] | 6 | */ |
| 7 | |
| 8 | #ifndef _CROS_EC_DEV_H_ |
| 9 | #define _CROS_EC_DEV_H_ |
| 10 | |
| 11 | #include <linux/ioctl.h> |
| 12 | #include <linux/types.h> |
| 13 | #include <linux/mfd/cros_ec.h> |
| 14 | |
Bill Richardson | e7c256f | 2015-02-02 12:26:25 +0100 | [diff] [blame] | 15 | #define CROS_EC_DEV_VERSION "1.0.0" |
| 16 | |
Enric Balletbo i Serra | e2bbf91 | 2018-07-18 18:09:56 +0200 | [diff] [blame] | 17 | /** |
| 18 | * struct cros_ec_readmem - Struct used to read mapped memory. |
| 19 | * @offset: Within EC_LPC_ADDR_MEMMAP region. |
| 20 | * @bytes: Number of bytes to read. Zero means "read a string" (including '\0') |
| 21 | * At most only EC_MEMMAP_SIZE bytes can be read. |
| 22 | * @buffer: Where to store the result. The ioctl returns the number of bytes |
| 23 | * read or negative on error. |
Bill Richardson | e7c256f | 2015-02-02 12:26:25 +0100 | [diff] [blame] | 24 | */ |
| 25 | struct cros_ec_readmem { |
| 26 | uint32_t offset; |
| 27 | uint32_t bytes; |
| 28 | uint8_t buffer[EC_MEMMAP_SIZE]; |
| 29 | }; |
| 30 | |
| 31 | #define CROS_EC_DEV_IOC 0xEC |
| 32 | #define CROS_EC_DEV_IOCXCMD _IOWR(CROS_EC_DEV_IOC, 0, struct cros_ec_command) |
| 33 | #define CROS_EC_DEV_IOCRDMEM _IOWR(CROS_EC_DEV_IOC, 1, struct cros_ec_readmem) |
| 34 | |
Bill Richardson | e7c256f | 2015-02-02 12:26:25 +0100 | [diff] [blame] | 35 | #endif /* _CROS_EC_DEV_H_ */ |