aboutsummaryrefslogtreecommitdiffstats
path: root/include/linux/mfd/cros_ec.h
diff options
context:
space:
mode:
Diffstat (limited to 'include/linux/mfd/cros_ec.h')
-rw-r--r--include/linux/mfd/cros_ec.h24
1 files changed, 18 insertions, 6 deletions
diff --git a/include/linux/mfd/cros_ec.h b/include/linux/mfd/cros_ec.h
index fcbe9d129a9d..0e166b92f5b4 100644
--- a/include/linux/mfd/cros_ec.h
+++ b/include/linux/mfd/cros_ec.h
@@ -62,10 +62,6 @@ struct cros_ec_command {
62 * @dev: Device pointer 62 * @dev: Device pointer
63 * @was_wake_device: true if this device was set to wake the system from 63 * @was_wake_device: true if this device was set to wake the system from
64 * sleep at the last suspend 64 * sleep at the last suspend
65 * @cmd_xfer: send command to EC and get response
66 * Returns the number of bytes received if the communication succeeded, but
67 * that doesn't mean the EC was happy with the command. The caller
68 * should check msg.result for the EC's result code.
69 * 65 *
70 * @priv: Private data 66 * @priv: Private data
71 * @irq: Interrupt to use 67 * @irq: Interrupt to use
@@ -82,6 +78,10 @@ struct cros_ec_command {
82 * @dout_size: size of dout buffer to allocate (zero to use static dout) 78 * @dout_size: size of dout buffer to allocate (zero to use static dout)
83 * @parent: pointer to parent device (e.g. i2c or spi device) 79 * @parent: pointer to parent device (e.g. i2c or spi device)
84 * @wake_enabled: true if this device can wake the system from sleep 80 * @wake_enabled: true if this device can wake the system from sleep
81 * @cmd_xfer: send command to EC and get response
82 * Returns the number of bytes received if the communication succeeded, but
83 * that doesn't mean the EC was happy with the command. The caller
84 * should check msg.result for the EC's result code.
85 * @lock: one transaction at a time 85 * @lock: one transaction at a time
86 */ 86 */
87struct cros_ec_device { 87struct cros_ec_device {
@@ -92,8 +92,6 @@ struct cros_ec_device {
92 struct device *dev; 92 struct device *dev;
93 bool was_wake_device; 93 bool was_wake_device;
94 struct class *cros_class; 94 struct class *cros_class;
95 int (*cmd_xfer)(struct cros_ec_device *ec,
96 struct cros_ec_command *msg);
97 95
98 /* These are used to implement the platform-specific interface */ 96 /* These are used to implement the platform-specific interface */
99 void *priv; 97 void *priv;
@@ -104,6 +102,8 @@ struct cros_ec_device {
104 int dout_size; 102 int dout_size;
105 struct device *parent; 103 struct device *parent;
106 bool wake_enabled; 104 bool wake_enabled;
105 int (*cmd_xfer)(struct cros_ec_device *ec,
106 struct cros_ec_command *msg);
107 struct mutex lock; 107 struct mutex lock;
108}; 108};
109 109
@@ -153,6 +153,18 @@ int cros_ec_check_result(struct cros_ec_device *ec_dev,
153 struct cros_ec_command *msg); 153 struct cros_ec_command *msg);
154 154
155/** 155/**
156 * cros_ec_cmd_xfer - Send a command to the ChromeOS EC
157 *
158 * Call this to send a command to the ChromeOS EC. This should be used
159 * instead of calling the EC's cmd_xfer() callback directly.
160 *
161 * @ec_dev: EC device
162 * @msg: Message to write
163 */
164int cros_ec_cmd_xfer(struct cros_ec_device *ec_dev,
165 struct cros_ec_command *msg);
166
167/**
156 * cros_ec_remove - Remove a ChromeOS EC 168 * cros_ec_remove - Remove a ChromeOS EC
157 * 169 *
158 * Call this to deregister a ChromeOS EC, then clean up any private data. 170 * Call this to deregister a ChromeOS EC, then clean up any private data.