diff options
| author | Enric Balletbo i Serra <enric.balletbo@collabora.com> | 2018-07-18 12:09:56 -0400 |
|---|---|---|
| committer | Benson Leung <bleung@chromium.org> | 2018-09-07 03:56:37 -0400 |
| commit | e2bbf91cad09118d7500f1fdaaa83d7741d30395 (patch) | |
| tree | a6c32330446d2d45e652caff08ea245aef9d4904 | |
| parent | cc8a4ea182efac95ad4582053f8a51271fab734d (diff) | |
mfd: cros_ec: Fix and improve kerneldoc comments.
cros-ec includes inside the MFD subsystem, specially the file
cros_ec_commands.h, has been modified several times and it has grown a
lot, unfortunately, we didn't have care too much about the documentation.
This patch tries to improve the documentation and also fixes all the
issues reported by kerneldoc script.
Signed-off-by: Enric Balletbo i Serra <enric.balletbo@collabora.com>
Signed-off-by: Benson Leung <bleung@chromium.org>
| -rw-r--r-- | drivers/mfd/cros_ec_dev.h | 13 | ||||
| -rw-r--r-- | include/linux/mfd/cros_ec.h | 214 | ||||
| -rw-r--r-- | include/linux/mfd/cros_ec_commands.h | 295 |
3 files changed, 310 insertions, 212 deletions
diff --git a/drivers/mfd/cros_ec_dev.h b/drivers/mfd/cros_ec_dev.h index 45e9453608c5..978d836a0248 100644 --- a/drivers/mfd/cros_ec_dev.h +++ b/drivers/mfd/cros_ec_dev.h | |||
| @@ -26,12 +26,13 @@ | |||
| 26 | 26 | ||
| 27 | #define CROS_EC_DEV_VERSION "1.0.0" | 27 | #define CROS_EC_DEV_VERSION "1.0.0" |
| 28 | 28 | ||
| 29 | /* | 29 | /** |
| 30 | * @offset: within EC_LPC_ADDR_MEMMAP region | 30 | * struct cros_ec_readmem - Struct used to read mapped memory. |
| 31 | * @bytes: number of bytes to read. zero means "read a string" (including '\0') | 31 | * @offset: Within EC_LPC_ADDR_MEMMAP region. |
| 32 | * (at most only EC_MEMMAP_SIZE bytes can be read) | 32 | * @bytes: Number of bytes to read. Zero means "read a string" (including '\0') |
| 33 | * @buffer: where to store the result | 33 | * At most only EC_MEMMAP_SIZE bytes can be read. |
| 34 | * ioctl returns the number of bytes read, negative on error | 34 | * @buffer: Where to store the result. The ioctl returns the number of bytes |
| 35 | * read or negative on error. | ||
| 35 | */ | 36 | */ |
| 36 | struct cros_ec_readmem { | 37 | struct cros_ec_readmem { |
| 37 | uint32_t offset; | 38 | uint32_t offset; |
diff --git a/include/linux/mfd/cros_ec.h b/include/linux/mfd/cros_ec.h index 20949dde35cd..e44e3ec8a9c7 100644 --- a/include/linux/mfd/cros_ec.h +++ b/include/linux/mfd/cros_ec.h | |||
| @@ -36,7 +36,7 @@ | |||
| 36 | * I2C requires 1 additional byte for requests. | 36 | * I2C requires 1 additional byte for requests. |
| 37 | * I2C requires 2 additional bytes for responses. | 37 | * I2C requires 2 additional bytes for responses. |
| 38 | * SPI requires up to 32 additional bytes for responses. | 38 | * SPI requires up to 32 additional bytes for responses. |
| 39 | * */ | 39 | */ |
| 40 | #define EC_PROTO_VERSION_UNKNOWN 0 | 40 | #define EC_PROTO_VERSION_UNKNOWN 0 |
| 41 | #define EC_MAX_REQUEST_OVERHEAD 1 | 41 | #define EC_MAX_REQUEST_OVERHEAD 1 |
| 42 | #define EC_MAX_RESPONSE_OVERHEAD 32 | 42 | #define EC_MAX_RESPONSE_OVERHEAD 32 |
| @@ -58,13 +58,14 @@ enum { | |||
| 58 | EC_MAX_MSG_BYTES = 64 * 1024, | 58 | EC_MAX_MSG_BYTES = 64 * 1024, |
| 59 | }; | 59 | }; |
| 60 | 60 | ||
| 61 | /* | 61 | /** |
| 62 | * @version: Command version number (often 0) | 62 | * struct cros_ec_command - Information about a ChromeOS EC command. |
| 63 | * @command: Command to send (EC_CMD_...) | 63 | * @version: Command version number (often 0). |
| 64 | * @outsize: Outgoing length in bytes | 64 | * @command: Command to send (EC_CMD_...). |
| 65 | * @insize: Max number of bytes to accept from EC | 65 | * @outsize: Outgoing length in bytes. |
| 66 | * @result: EC's response to the command (separate from communication failure) | 66 | * @insize: Max number of bytes to accept from the EC. |
| 67 | * @data: Where to put the incoming data from EC and outgoing data to EC | 67 | * @result: EC's response to the command (separate from communication failure). |
| 68 | * @data: Where to put the incoming data from EC and outgoing data to EC. | ||
| 68 | */ | 69 | */ |
| 69 | struct cros_ec_command { | 70 | struct cros_ec_command { |
| 70 | uint32_t version; | 71 | uint32_t version; |
| @@ -76,48 +77,55 @@ struct cros_ec_command { | |||
| 76 | }; | 77 | }; |
| 77 | 78 | ||
| 78 | /** | 79 | /** |
| 79 | * struct cros_ec_device - Information about a ChromeOS EC device | 80 | * struct cros_ec_device - Information about a ChromeOS EC device. |
| 80 | * | 81 | * @phys_name: Name of physical comms layer (e.g. 'i2c-4'). |
| 81 | * @phys_name: name of physical comms layer (e.g. 'i2c-4') | ||
| 82 | * @dev: Device pointer for physical comms device | 82 | * @dev: Device pointer for physical comms device |
| 83 | * @was_wake_device: true if this device was set to wake the system from | 83 | * @was_wake_device: True if this device was set to wake the system from |
| 84 | * sleep at the last suspend | 84 | * sleep at the last suspend. |
| 85 | * @cmd_readmem: direct read of the EC memory-mapped region, if supported | 85 | * @cros_class: The class structure for this device. |
| 86 | * @offset is within EC_LPC_ADDR_MEMMAP region. | 86 | * @cmd_readmem: Direct read of the EC memory-mapped region, if supported. |
| 87 | * @bytes: number of bytes to read. zero means "read a string" (including | 87 | * @offset: Is within EC_LPC_ADDR_MEMMAP region. |
| 88 | * the trailing '\0'). At most only EC_MEMMAP_SIZE bytes can be read. | 88 | * @bytes: Number of bytes to read. zero means "read a string" (including |
| 89 | * Caller must ensure that the buffer is large enough for the result when | 89 | * the trailing '\0'). At most only EC_MEMMAP_SIZE bytes can be |
| 90 | * reading a string. | 90 | * read. Caller must ensure that the buffer is large enough for the |
| 91 | * | 91 | * result when reading a string. |
| 92 | * @priv: Private data | 92 | * @max_request: Max size of message requested. |
| 93 | * @irq: Interrupt to use | 93 | * @max_response: Max size of message response. |
| 94 | * @id: Device id | 94 | * @max_passthru: Max sice of passthru message. |
| 95 | * @din: input buffer (for data from EC) | 95 | * @proto_version: The protocol version used for this device. |
| 96 | * @dout: output buffer (for data to EC) | 96 | * @priv: Private data. |
| 97 | * \note | 97 | * @irq: Interrupt to use. |
| 98 | * These two buffers will always be dword-aligned and include enough | 98 | * @id: Device id. |
| 99 | * space for up to 7 word-alignment bytes also, so we can ensure that | 99 | * @din: Input buffer (for data from EC). This buffer will always be |
| 100 | * the body of the message is always dword-aligned (64-bit). | 100 | * dword-aligned and include enough space for up to 7 word-alignment |
| 101 | * We use this alignment to keep ARM and x86 happy. Probably word | 101 | * bytes also, so we can ensure that the body of the message is always |
| 102 | * alignment would be OK, there might be a small performance advantage | 102 | * dword-aligned (64-bit). We use this alignment to keep ARM and x86 |
| 103 | * to using dword. | 103 | * happy. Probably word alignment would be OK, there might be a small |
| 104 | * @din_size: size of din buffer to allocate (zero to use static din) | 104 | * performance advantage to using dword. |
| 105 | * @dout_size: size of dout buffer to allocate (zero to use static dout) | 105 | * @dout: Output buffer (for data to EC). This buffer will always be |
| 106 | * @wake_enabled: true if this device can wake the system from sleep | 106 | * dword-aligned and include enough space for up to 7 word-alignment |
| 107 | * @suspended: true if this device had been suspended | 107 | * bytes also, so we can ensure that the body of the message is always |
| 108 | * @cmd_xfer: send command to EC and get response | 108 | * dword-aligned (64-bit). We use this alignment to keep ARM and x86 |
| 109 | * Returns the number of bytes received if the communication succeeded, but | 109 | * happy. Probably word alignment would be OK, there might be a small |
| 110 | * that doesn't mean the EC was happy with the command. The caller | 110 | * performance advantage to using dword. |
| 111 | * should check msg.result for the EC's result code. | 111 | * @din_size: Size of din buffer to allocate (zero to use static din). |
| 112 | * @pkt_xfer: send packet to EC and get response | 112 | * @dout_size: Size of dout buffer to allocate (zero to use static dout). |
| 113 | * @lock: one transaction at a time | 113 | * @wake_enabled: True if this device can wake the system from sleep. |
| 114 | * @mkbp_event_supported: true if this EC supports the MKBP event protocol. | 114 | * @suspended: True if this device had been suspended. |
| 115 | * @event_notifier: interrupt event notifier for transport devices. | 115 | * @cmd_xfer: Send command to EC and get response. |
| 116 | * @event_data: raw payload transferred with the MKBP event. | 116 | * Returns the number of bytes received if the communication |
| 117 | * @event_size: size in bytes of the event data. | 117 | * succeeded, but that doesn't mean the EC was happy with the |
| 118 | * command. The caller should check msg.result for the EC's result | ||
| 119 | * code. | ||
| 120 | * @pkt_xfer: Send packet to EC and get response. | ||
| 121 | * @lock: One transaction at a time. | ||
| 122 | * @mkbp_event_supported: True if this EC supports the MKBP event protocol. | ||
| 123 | * @event_notifier: Interrupt event notifier for transport devices. | ||
| 124 | * @event_data: Raw payload transferred with the MKBP event. | ||
| 125 | * @event_size: Size in bytes of the event data. | ||
| 126 | * @host_event_wake_mask: Mask of host events that cause wake from suspend. | ||
| 118 | */ | 127 | */ |
| 119 | struct cros_ec_device { | 128 | struct cros_ec_device { |
| 120 | |||
| 121 | /* These are used by other drivers that want to talk to the EC */ | 129 | /* These are used by other drivers that want to talk to the EC */ |
| 122 | const char *phys_name; | 130 | const char *phys_name; |
| 123 | struct device *dev; | 131 | struct device *dev; |
| @@ -153,20 +161,19 @@ struct cros_ec_device { | |||
| 153 | }; | 161 | }; |
| 154 | 162 | ||
| 155 | /** | 163 | /** |
| 156 | * struct cros_ec_sensor_platform - ChromeOS EC sensor platform information | 164 | * struct cros_ec_sensor_platform - ChromeOS EC sensor platform information. |
| 157 | * | ||
| 158 | * @sensor_num: Id of the sensor, as reported by the EC. | 165 | * @sensor_num: Id of the sensor, as reported by the EC. |
| 159 | */ | 166 | */ |
| 160 | struct cros_ec_sensor_platform { | 167 | struct cros_ec_sensor_platform { |
| 161 | u8 sensor_num; | 168 | u8 sensor_num; |
| 162 | }; | 169 | }; |
| 163 | 170 | ||
| 164 | /* struct cros_ec_platform - ChromeOS EC platform information | 171 | /** |
| 165 | * | 172 | * struct cros_ec_platform - ChromeOS EC platform information. |
| 166 | * @ec_name: name of EC device (e.g. 'cros-ec', 'cros-pd', ...) | 173 | * @ec_name: Name of EC device (e.g. 'cros-ec', 'cros-pd', ...) |
| 167 | * used in /dev/ and sysfs. | 174 | * used in /dev/ and sysfs. |
| 168 | * @cmd_offset: offset to apply for each command. Set when | 175 | * @cmd_offset: Offset to apply for each command. Set when |
| 169 | * registering a devicde behind another one. | 176 | * registering a device behind another one. |
| 170 | */ | 177 | */ |
| 171 | struct cros_ec_platform { | 178 | struct cros_ec_platform { |
| 172 | const char *ec_name; | 179 | const char *ec_name; |
| @@ -175,16 +182,16 @@ struct cros_ec_platform { | |||
| 175 | 182 | ||
| 176 | struct cros_ec_debugfs; | 183 | struct cros_ec_debugfs; |
| 177 | 184 | ||
| 178 | /* | 185 | /** |
| 179 | * struct cros_ec_dev - ChromeOS EC device entry point | 186 | * struct cros_ec_dev - ChromeOS EC device entry point. |
| 180 | * | 187 | * @class_dev: Device structure used in sysfs. |
| 181 | * @class_dev: Device structure used in sysfs | 188 | * @cdev: Character device structure in /dev. |
| 182 | * @cdev: Character device structure in /dev | 189 | * @ec_dev: cros_ec_device structure to talk to the physical device. |
| 183 | * @ec_dev: cros_ec_device structure to talk to the physical device | 190 | * @dev: Pointer to the platform device. |
| 184 | * @dev: pointer to the platform device | 191 | * @debug_info: cros_ec_debugfs structure for debugging information. |
| 185 | * @debug_info: cros_ec_debugfs structure for debugging information | 192 | * @has_kb_wake_angle: True if at least 2 accelerometer are connected to the EC. |
| 186 | |||
