Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

mfd: cros_ec: Add char dev and virtual dev pointers

The ChromeOS Embedded Controller has to be accessed by applications.
A virtual character device is used as an interface with user-space.

Extend the struct cros_ec_device with the fields needed by the driver
of this virtual character device.

Signed-off-by: Javier Martinez Canillas <javier.martinez@collabora.co.uk>
Acked-by: Lee Jones <lee.jones@linaro.org>
Tested-by: Gwendal Grignou <gwendal@chromium.org>
Reviewed-by: Gwendal Grignou <gwendal@chromium.org>
Signed-off-by: Olof Johansson <olof@lixom.net>

authored by

Javier Martinez Canillas and committed by
Olof Johansson
05c11ac4 1b84f2a4

+14 -1
+14 -1
include/linux/mfd/cros_ec.h
··· 16 16 #ifndef __LINUX_MFD_CROS_EC_H 17 17 #define __LINUX_MFD_CROS_EC_H 18 18 19 + #include <linux/cdev.h> 19 20 #include <linux/notifier.h> 20 21 #include <linux/mfd/cros_ec_commands.h> 21 22 #include <linux/mutex.h> ··· 60 59 * 61 60 * @ec_name: name of EC device (e.g. 'chromeos-ec') 62 61 * @phys_name: name of physical comms layer (e.g. 'i2c-4') 63 - * @dev: Device pointer 62 + * @dev: Device pointer for physical comms device 63 + * @vdev: Device pointer for virtual comms device 64 + * @cdev: Character device structure for virtual comms device 64 65 * @was_wake_device: true if this device was set to wake the system from 65 66 * sleep at the last suspend 67 + * @cmd_readmem: direct read of the EC memory-mapped region, if supported 68 + * @offset is within EC_LPC_ADDR_MEMMAP region. 69 + * @bytes: number of bytes to read. zero means "read a string" (including 70 + * the trailing '\0'). At most only EC_MEMMAP_SIZE bytes can be read. 71 + * Caller must ensure that the buffer is large enough for the result when 72 + * reading a string. 66 73 * 67 74 * @priv: Private data 68 75 * @irq: Interrupt to use ··· 99 90 const char *ec_name; 100 91 const char *phys_name; 101 92 struct device *dev; 93 + struct device *vdev; 94 + struct cdev cdev; 102 95 bool was_wake_device; 103 96 struct class *cros_class; 97 + int (*cmd_readmem)(struct cros_ec_device *ec, unsigned int offset, 98 + unsigned int bytes, void *dest); 104 99 105 100 /* These are used to implement the platform-specific interface */ 106 101 void *priv;