diff options
| author | Bill Richardson <wfrichar@chromium.org> | 2014-06-18 14:14:00 -0400 |
|---|---|---|
| committer | Lee Jones <lee.jones@linaro.org> | 2014-07-09 09:58:16 -0400 |
| commit | 7e6cb5b4dbbc4b1d98289c88d0bc4092cac328be (patch) | |
| tree | e24bd8e98cd4e9125a74ca629dbf3dfbd6c930c2 /include/linux/mfd | |
| parent | 2ce701ae4e351d9407ec0b30f5f9dd56b6de4292 (diff) | |
mfd: cros_ec: Tweak struct cros_ec_device for clarity
The members of struct cros_ec_device were improperly commented, and
intermixed the private and public sections. This is just cleanup to make it
more obvious what goes with what.
[dianders: left lock in the structure but gave it the name that will
eventually be used.]
Signed-off-by: Bill Richardson <wfrichar@chromium.org>
Signed-off-by: Doug Anderson <dianders@chromium.org>
Signed-off-by: Lee Jones <lee.jones@linaro.org>
Diffstat (limited to 'include/linux/mfd')
| -rw-r--r-- | include/linux/mfd/cros_ec.h | 65 |
1 files changed, 35 insertions, 30 deletions
diff --git a/include/linux/mfd/cros_ec.h b/include/linux/mfd/cros_ec.h index 2ee3190b691c..79a35857cc9e 100644 --- a/include/linux/mfd/cros_ec.h +++ b/include/linux/mfd/cros_ec.h | |||
| @@ -16,7 +16,9 @@ | |||
| 16 | #ifndef __LINUX_MFD_CROS_EC_H | 16 | #ifndef __LINUX_MFD_CROS_EC_H |
| 17 | #define __LINUX_MFD_CROS_EC_H | 17 | #define __LINUX_MFD_CROS_EC_H |
| 18 | 18 | ||
| 19 | #include <linux/notifier.h> | ||
| 19 | #include <linux/mfd/cros_ec_commands.h> | 20 | #include <linux/mfd/cros_ec_commands.h> |
| 21 | #include <linux/mutex.h> | ||
| 20 | 22 | ||
| 21 | /* | 23 | /* |
| 22 | * Command interface between EC and AP, for LPC, I2C and SPI interfaces. | 24 | * Command interface between EC and AP, for LPC, I2C and SPI interfaces. |
| @@ -55,34 +57,53 @@ struct cros_ec_msg { | |||
| 55 | /** | 57 | /** |
| 56 | * struct cros_ec_device - Information about a ChromeOS EC device | 58 | * struct cros_ec_device - Information about a ChromeOS EC device |
| 57 | * | 59 | * |
| 60 | * @ec_name: name of EC device (e.g. 'chromeos-ec') | ||
| 61 | * @phys_name: name of physical comms layer (e.g. 'i2c-4') | ||
| 62 | * @dev: Device pointer | ||
| 63 | * @was_wake_device: true if this device was set to wake the system from | ||
| 64 | * sleep at the last suspend | ||
| 65 | * @event_notifier: interrupt event notifier for transport devices | ||
| 66 | * @command_send: send a command | ||
| 67 | * @command_recv: receive a response | ||
| 68 | * @command_sendrecv: send a command and receive a response | ||
| 69 | * | ||
| 58 | * @name: Name of this EC interface | 70 | * @name: Name of this EC interface |
| 59 | * @priv: Private data | 71 | * @priv: Private data |
| 60 | * @irq: Interrupt to use | 72 | * @irq: Interrupt to use |
| 61 | * @din: input buffer (from EC) | 73 | * @din: input buffer (for data from EC) |
| 62 | * @dout: output buffer (to EC) | 74 | * @dout: output buffer (for data to EC) |
| 63 | * \note | 75 | * \note |
| 64 | * These two buffers will always be dword-aligned and include enough | 76 | * These two buffers will always be dword-aligned and include enough |
| 65 | * space for up to 7 word-alignment bytes also, so we can ensure that | 77 | * space for up to 7 word-alignment bytes also, so we can ensure that |
| 66 | * the body of the message is always dword-aligned (64-bit). | 78 | * the body of the message is always dword-aligned (64-bit). |
| 67 | * | ||
| 68 | * We use this alignment to keep ARM and x86 happy. Probably word | 79 | * We use this alignment to keep ARM and x86 happy. Probably word |
| 69 | * alignment would be OK, there might be a small performance advantage | 80 | * alignment would be OK, there might be a small performance advantage |
| 70 | * to using dword. | 81 | * to using dword. |
| 71 | * @din_size: size of din buffer to allocate (zero to use static din) | 82 | * @din_size: size of din buffer to allocate (zero to use static din) |
| 72 | * @dout_size: size of dout buffer to allocate (zero to use static dout) | 83 | * @dout_size: size of dout buffer to allocate (zero to use static dout) |
| 73 | * @command_send: send a command | ||
| 74 | * @command_recv: receive a command | ||
| 75 | * @ec_name: name of EC device (e.g. 'chromeos-ec') | ||
| 76 | * @phys_name: name of physical comms layer (e.g. 'i2c-4') | ||
| 77 | * @parent: pointer to parent device (e.g. i2c or spi device) | 84 | * @parent: pointer to parent device (e.g. i2c or spi device) |
| 78 | * @dev: Device pointer | ||
| 79 | * dev_lock: Lock to prevent concurrent access | ||
| 80 | * @wake_enabled: true if this device can wake the system from sleep | 85 | * @wake_enabled: true if this device can wake the system from sleep |
| 81 | * @was_wake_device: true if this device was set to wake the system from | 86 | * @lock: one transaction at a time |
| 82 | * sleep at the last suspend | 87 | * @cmd_xfer: low-level channel to the EC |
| 83 | * @event_notifier: interrupt event notifier for transport devices | ||
| 84 | */ | 88 | */ |
| 85 | struct cros_ec_device { | 89 | struct cros_ec_device { |
| 90 | |||
| 91 | /* These are used by other drivers that want to talk to the EC */ | ||
| 92 | const char *ec_name; | ||
| 93 | const char *phys_name; | ||
| 94 | struct device *dev; | ||
| 95 | bool was_wake_device; | ||
| 96 | struct class *cros_class; | ||
| 97 | struct blocking_notifier_head event_notifier; | ||
| 98 | int (*command_send)(struct cros_ec_device *ec, | ||
| 99 | uint16_t cmd, void *out_buf, int out_len); | ||
| 100 | int (*command_recv)(struct cros_ec_device *ec, | ||
| 101 | uint16_t cmd, void *in_buf, int in_len); | ||
| 102 | int (*command_sendrecv)(struct cros_ec_device *ec, | ||
| 103 | uint16_t cmd, void *out_buf, int out_len, | ||
| 104 | void *in_buf, int in_len); | ||
| 105 | |||
| 106 | /* These are used to implement the platform-specific interface */ | ||
| 86 | const char *name; | 107 | const char *name; |
| 87 | void *priv; | 108 | void *priv; |
| 88 | int irq; | 109 | int irq; |
| @@ -90,26 +111,10 @@ struct cros_ec_device { | |||
| 90 | uint8_t *dout; | 111 | uint8_t *dout; |
| 91 | int din_size; | 112 | int din_size; |
| 92 | int dout_size; | 113 | int dout_size; |
| 93 | int (*command_send)(struct cros_ec_device *ec, | ||
| 94 | uint16_t cmd, void *out_buf, int out_len); | ||
| 95 | int (*command_recv)(struct cros_ec_device *ec, | ||
| 96 | uint16_t cmd, void *in_buf, int in_len); | ||
| 97 | int (*command_sendrecv)(struct cros_ec_device *ec, | ||
| 98 | uint16_t cmd, void *out_buf, int out_len, | ||
| 99 | void *in_buf, int in_len); | ||
| 100 | int (*command_xfer)(struct cros_ec_device *ec, | ||
| 101 | struct cros_ec_msg *msg); | ||
| 102 | |||
| 103 | const char *ec_name; | ||
| 104 | const char *phys_name; | ||
| 105 | struct device *parent; | 114 | struct device *parent; |
| 106 | |||
| 107 | /* These are --private-- fields - do not assign */ | ||
| 108 | struct device *dev; | ||
| 109 | struct mutex dev_lock; | ||
| 110 | bool wake_enabled; | 115 | bool wake_enabled; |
| 111 | bool was_wake_device; | 116 | struct mutex lock; |
| 112 | struct blocking_notifier_head event_notifier; | 117 | int (*cmd_xfer)(struct cros_ec_device *ec, struct cros_ec_msg *msg); |
| 113 | }; | 118 | }; |
| 114 | 119 | ||
| 115 | /** | 120 | /** |
