summaryrefslogtreecommitdiff
path: root/include/linux/surface_aggregator
diff options
context:
space:
mode:
authorMaximilian Luz <luzmaximilian@gmail.com>2022-12-02 23:33:20 +0100
committerHans de Goede <hdegoede@redhat.com>2023-02-02 22:48:20 +0100
commit3f88b459a729ea397aa7cec9a7054a978882370a (patch)
treefdabe66e587d6da99e334264bc8c374dcb6c0aca /include/linux/surface_aggregator
parent070b3098ddefdadcc6310878cf50ef09b380db1d (diff)
platform/surface: aggregator: Improve documentation and handling of message target and source IDs
The `tid_in` and `tid_out` fields of the serial hub protocol command struct (struct ssh_command) are actually source and target IDs, indicating the peer from which the message originated and the peer for which it is intended. Change the naming of those fields accordingly and improve the protocol documentation. Additionally, introduce an enum containing all currently known peers, i.e. targets and sources. Signed-off-by: Maximilian Luz <luzmaximilian@gmail.com> Link: https://lore.kernel.org/r/20221202223327.690880-3-luzmaximilian@gmail.com Reviewed-by: Hans de Goede <hdegoede@redhat.com> Signed-off-by: Hans de Goede <hdegoede@redhat.com>
Diffstat (limited to 'include/linux/surface_aggregator')
-rw-r--r--include/linux/surface_aggregator/controller.h4
-rw-r--r--include/linux/surface_aggregator/serial_hub.h40
2 files changed, 29 insertions, 15 deletions
diff --git a/include/linux/surface_aggregator/controller.h b/include/linux/surface_aggregator/controller.h
index d11a1c6e3186..8932bc0bae18 100644
--- a/include/linux/surface_aggregator/controller.h
+++ b/include/linux/surface_aggregator/controller.h
@@ -912,10 +912,10 @@ enum ssam_event_mask {
})
#define SSAM_EVENT_REGISTRY_SAM \
- SSAM_EVENT_REGISTRY(SSAM_SSH_TC_SAM, 0x01, 0x0b, 0x0c)
+ SSAM_EVENT_REGISTRY(SSAM_SSH_TC_SAM, SSAM_SSH_TID_SAM, 0x0b, 0x0c)
#define SSAM_EVENT_REGISTRY_KIP \
- SSAM_EVENT_REGISTRY(SSAM_SSH_TC_KIP, 0x02, 0x27, 0x28)
+ SSAM_EVENT_REGISTRY(SSAM_SSH_TC_KIP, SSAM_SSH_TID_KIP, 0x27, 0x28)
#define SSAM_EVENT_REGISTRY_REG(tid)\
SSAM_EVENT_REGISTRY(SSAM_SSH_TC_REG, tid, 0x01, 0x02)
diff --git a/include/linux/surface_aggregator/serial_hub.h b/include/linux/surface_aggregator/serial_hub.h
index 45501b6e54e8..5c4ae1a26183 100644
--- a/include/linux/surface_aggregator/serial_hub.h
+++ b/include/linux/surface_aggregator/serial_hub.h
@@ -83,23 +83,21 @@ enum ssh_payload_type {
/**
* struct ssh_command - Payload of a command-type frame.
- * @type: The type of the payload. See &enum ssh_payload_type. Should be
- * SSH_PLD_TYPE_CMD for this struct.
- * @tc: Command target category.
- * @tid_out: Output target ID. Should be zero if this an incoming (EC to host)
- * message.
- * @tid_in: Input target ID. Should be zero if this is an outgoing (host to
- * EC) message.
- * @iid: Instance ID.
- * @rqid: Request ID. Used to match requests with responses and differentiate
- * between responses and events.
- * @cid: Command ID.
+ * @type: The type of the payload. See &enum ssh_payload_type. Should be
+ * SSH_PLD_TYPE_CMD for this struct.
+ * @tc: Command target category.
+ * @tid: Target ID. Indicates the target of the message.
+ * @sid: Source ID. Indicates the source of the message.
+ * @iid: Instance ID.
+ * @rqid: Request ID. Used to match requests with responses and differentiate
+ * between responses and events.
+ * @cid: Command ID.
*/
struct ssh_command {
u8 type;
u8 tc;
- u8 tid_out;
- u8 tid_in;
+ u8 tid;
+ u8 sid;
u8 iid;
__le16 rqid;
u8 cid;
@@ -280,6 +278,22 @@ struct ssam_span {
size_t len;
};
+/**
+ * enum ssam_ssh_tid - Target/source IDs for Serial Hub messages.
+ * @SSAM_SSH_TID_HOST: We as the kernel Serial Hub driver.
+ * @SSAM_SSH_TID_SAM: The Surface Aggregator EC.
+ * @SSAM_SSH_TID_KIP: Keyboard and perihperal controller.
+ * @SSAM_SSH_TID_DEBUG: Debug connector.
+ * @SSAM_SSH_TID_SURFLINK: SurfLink connector.
+ */
+enum ssam_ssh_tid {
+ SSAM_SSH_TID_HOST = 0x00,
+ SSAM_SSH_TID_SAM = 0x01,
+ SSAM_SSH_TID_KIP = 0x02,
+ SSAM_SSH_TID_DEBUG = 0x03,
+ SSAM_SSH_TID_SURFLINK = 0x04,
+};
+
/*
* Known SSH/EC target categories.
*