aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/include/linux/soundwire
diff options
context:
space:
mode:
authorVinod Koul <vkoul@kernel.org>2020-02-26 14:18:34 +0530
committerVinod Koul <vkoul@kernel.org>2020-02-26 14:18:34 +0530
commited29a0a67267777d78f7505c7044032329e6ee5f (patch)
tree3b841946fa7da66de46e3c8587ef0d3c32971e34 /include/linux/soundwire
parentsoundwire: cadence: remove useless prototypes (diff)
parentsoundwire: add helper macros for devID fields (diff)
downloadwireguard-linux-ed29a0a67267777d78f7505c7044032329e6ee5f.tar.xz
wireguard-linux-ed29a0a67267777d78f7505c7044032329e6ee5f.zip
Merge branch 'topic/asoc' into next
Diffstat (limited to 'include/linux/soundwire')
-rw-r--r--include/linux/soundwire/sdw.h23
1 files changed, 23 insertions, 0 deletions
diff --git a/include/linux/soundwire/sdw.h b/include/linux/soundwire/sdw.h
index b8427df034ce..ee349a4c5349 100644
--- a/include/linux/soundwire/sdw.h
+++ b/include/linux/soundwire/sdw.h
@@ -439,6 +439,29 @@ struct sdw_slave_id {
__u8 sdw_version:4;
};
+/*
+ * Helper macros to extract the MIPI-defined IDs
+ *
+ * Spec definition
+ * Register Bit Contents
+ * DevId_0 [7:4] 47:44 sdw_version
+ * DevId_0 [3:0] 43:40 unique_id
+ * DevId_1 39:32 mfg_id [15:8]
+ * DevId_2 31:24 mfg_id [7:0]
+ * DevId_3 23:16 part_id [15:8]
+ * DevId_4 15:08 part_id [7:0]
+ * DevId_5 07:00 class_id
+ *
+ * The MIPI DisCo for SoundWire defines in addition the link_id as bits 51:48
+ */
+
+#define SDW_DISCO_LINK_ID(adr) (((adr) >> 48) & GENMASK(3, 0))
+#define SDW_VERSION(adr) (((adr) >> 44) & GENMASK(3, 0))
+#define SDW_UNIQUE_ID(adr) (((adr) >> 40) & GENMASK(3, 0))
+#define SDW_MFG_ID(adr) (((adr) >> 24) & GENMASK(15, 0))
+#define SDW_PART_ID(adr) (((adr) >> 8) & GENMASK(15, 0))
+#define SDW_CLASS_ID(adr) ((adr) & GENMASK(7, 0))
+
/**
* struct sdw_slave_intr_status - Slave interrupt status
* @control_port: control port status