Skip to contentSkip to conversation

SoundWire: ASoC interfaces for multi-cpu dais and DisCo helpers

PATCH Applied Pierre-Louis Bossart 3 participants 8 messages Feb 25, 2020 – Feb 26, 2020

Subsystems (3)
lore
Share & tools
lore
#0 lore raw

cover SoundWire: ASoC interfaces for multi-cpu dais and DisCo helpers

The first two patches prepare the support of multi-cpu dais for synchronized playback and capture. We remove an unused set of prototypes and add a get_sdw_stream() callback prototype currently missing (the implementation will come later as part of the synchronized playback)

The last exposes macros used internally, so that they can be reused to extract information from the _ADR 64-bit values in SOF platform drivers and related machine drivers.

I think it's simpler if all these simple patches are merged through the SoundWire tree. With the additional changes to remove the platform drivers and the merge of interrupt handling, that will result in a single immutable tag provided to Mark Brown.

Pierre-Louis Bossart (3):
soundwire: cadence: remove useless prototypes
ASoC: soc-dai: add get_sdw_stream() callback
soundwire: add helper macros for devID fields

 drivers/soundwire/bus.c            | 21 +++++----------------
 drivers/soundwire/cadence_master.h |  8 --------
 include/linux/soundwire/sdw.h      | 23 +++++++++++++++++++++++
 include/sound/soc-dai.h            | 21 +++++++++++++++++++++
 4 files changed, 49 insertions(+), 24 deletions(-)
Signature · 1 line
2.20.1
#1 lore raw

PATCH 1/3 soundwire: cadence: remove useless prototypes

These prototypes are no longer used, remove.

---
 drivers/soundwire/cadence_master.h | 8 --------
 1 file changed, 8 deletions(-)
drivers/soundwire/cadence_master.h +0 -8
index 001457cbe5ad..2de1b2493ffc 100644
@@ -148,20 +148,12 @@ int sdw_cdns_enable_interrupt(struct sdw_cdns *cdns, bool state);
 void sdw_cdns_debugfs_init(struct sdw_cdns *cdns, struct dentry *root);
 #endif
 
-int sdw_cdns_get_stream(struct sdw_cdns *cdns,
-			struct sdw_cdns_streams *stream,
-			u32 ch, u32 dir);
 struct sdw_cdns_pdi *sdw_cdns_alloc_pdi(struct sdw_cdns *cdns,
 					struct sdw_cdns_streams *stream,
 					u32 ch, u32 dir, int dai_id);
 void sdw_cdns_config_stream(struct sdw_cdns *cdns,
 			    u32 ch, u32 dir, struct sdw_cdns_pdi *pdi);
 
-int sdw_cdns_pcm_set_stream(struct snd_soc_dai *dai,
-			    void *stream, int direction);
-int sdw_cdns_pdm_set_stream(struct snd_soc_dai *dai,
-			    void *stream, int direction);
-
 enum sdw_command_response
 cdns_reset_page_addr(struct sdw_bus *bus, unsigned int dev_num);
 
Signature · 1 line
2.20.1
maintainer Applied
#2 lore raw

Re: [PATCH 1/3] soundwire: cadence: remove useless prototypes

Quoted 1 line · Pierre-Louis Bossart

These prototypes are no longer used, remove.

Applied, thanks

Signature · 1 line
~Vinod
#3 lore raw

PATCH 2/3 ASoC: soc-dai: add get_sdw_stream() callback

In reply to Pierre-Louis Bossart

We only have a set() operation, provide the dual get() operation to retrieve the stream information.

---
 include/sound/soc-dai.h | 21 +++++++++++++++++++++
 1 file changed, 21 insertions(+)
include/sound/soc-dai.h +21 -0
index eaaeb00e9e84..19027469a5c5 100644
@@ -202,6 +202,8 @@ struct snd_soc_dai_ops {
 
 	int (*set_sdw_stream)(struct snd_soc_dai *dai,
 			void *stream, int direction);
+	void *(*get_sdw_stream)(struct snd_soc_dai *dai, int direction);
+
 	/*
 	 * DAI digital mute - optional.
 	 * Called by soc-core to minimise any pops.
@@ -406,4 +408,23 @@ static inline int snd_soc_dai_set_sdw_stream(struct snd_soc_dai *dai,
 		return -ENOTSUPP;
 }
 
+/**
+ * snd_soc_dai_get_sdw_stream() - Retrieves SDW stream from DAI
+ * @dai: DAI
+ * @direction: Stream direction(Playback/Capture)
+ *
+ * This routine only retrieves that was previously configured
+ * with snd_soc_dai_get_sdw_stream()
+ *
+ * Returns pointer to stream or NULL;
+ */
+static inline void *snd_soc_dai_get_sdw_stream(struct snd_soc_dai *dai,
+					       int direction)
+{
+	if (dai->driver->ops->get_sdw_stream)
+		return dai->driver->ops->get_sdw_stream(dai, direction);
+	else
+		return NULL;
+}
+
 #endif
Signature · 1 line
2.20.1
maintainer
#4 lore raw

Applied "ASoC: soc-dai: add get_sdw_stream() callback" to the asoc tree

The patch

ASoC: soc-dai: add get_sdw_stream() callback

has been applied to the asoc tree at

https://git.kernel.org/pub/scm/linux/kernel/git/broonie/sound.git

All being well this means that it will be integrated into the linux-next tree (usually sometime in the next 24 hours) and sent to Linus during the next merge window (or sooner if it is a bug fix), however if problems are discovered then the patch may be dropped or reverted.

You may get further e-mails resulting from automated or manual testing and review of the tree, please engage with people reporting problems and send followup patches addressing any issues that are reported if needed.

If any updates are required or you are submitting further changes they should be sent as incremental updates against current git, existing patches will not be replaced.

Please add any relevant lists and maintainers to the CCs when replying to this mail.

Thanks,
Mark

From 36d73c4a9ed7c8a0988cfb9d1282c62d8c422a3b Mon Sep 17 00:00:00 2001
From: Pierre-Louis Bossart <[email protected]>
Date: Tue, 25 Feb 2020 11:00:40 -0600
Subject: [PATCH] ASoC: soc-dai: add get_sdw_stream() callback

We only have a set() operation, provide the dual get() operation to retrieve the stream information.

---
 include/sound/soc-dai.h | 21 +++++++++++++++++++++
 1 file changed, 21 insertions(+)
include/sound/soc-dai.h +21 -0
index 92c382690930..7f70db149b81 100644
@@ -202,6 +202,8 @@ struct snd_soc_dai_ops {
 
 	int (*set_sdw_stream)(struct snd_soc_dai *dai,
 			void *stream, int direction);
+	void *(*get_sdw_stream)(struct snd_soc_dai *dai, int direction);
+
 	/*
 	 * DAI digital mute - optional.
 	 * Called by soc-core to minimise any pops.
@@ -423,4 +425,23 @@ static inline int snd_soc_dai_set_sdw_stream(struct snd_soc_dai *dai,
 		return -ENOTSUPP;
 }
 
+/**
+ * snd_soc_dai_get_sdw_stream() - Retrieves SDW stream from DAI
+ * @dai: DAI
+ * @direction: Stream direction(Playback/Capture)
+ *
+ * This routine only retrieves that was previously configured
+ * with snd_soc_dai_get_sdw_stream()
+ *
+ * Returns pointer to stream or NULL;
+ */
+static inline void *snd_soc_dai_get_sdw_stream(struct snd_soc_dai *dai,
+					       int direction)
+{
+	if (dai->driver->ops->get_sdw_stream)
+		return dai->driver->ops->get_sdw_stream(dai, direction);
+	else
+		return NULL;
+}
+
 #endif
Signature · 1 line
2.20.1
#5 lore raw

PATCH 3/3 soundwire: add helper macros for devID fields

In reply to Pierre-Louis Bossart

Move bit extractors to macros, so that the definitions can be used by other drivers parsing the MIPI definitions extracted from firmware tables (ACPI or DT).

---
 drivers/soundwire/bus.c       | 21 +++++----------------
 include/linux/soundwire/sdw.h | 23 +++++++++++++++++++++++
 2 files changed, 28 insertions(+), 16 deletions(-)
drivers/soundwire/bus.c +5 -16
index b8a7a84aca1c..01be7220d117 100644
@@ -589,22 +589,11 @@ void sdw_extract_slave_id(struct sdw_bus *bus,
 {
 	dev_dbg(bus->dev, "SDW Slave Addr: %llx\n", addr);
 
-	/*
-	 * 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
-	 */
-	id->sdw_version = (addr >> 44) & GENMASK(3, 0);
-	id->unique_id = (addr >> 40) & GENMASK(3, 0);
-	id->mfg_id = (addr >> 24) & GENMASK(15, 0);
-	id->part_id = (addr >> 8) & GENMASK(15, 0);
-	id->class_id = addr & GENMASK(7, 0);
+	id->sdw_version = SDW_VERSION(addr);
+	id->unique_id = SDW_UNIQUE_ID(addr);
+	id->mfg_id = SDW_MFG_ID(addr);
+	id->part_id = SDW_PART_ID(addr);
+	id->class_id = SDW_CLASS_ID(addr);
 
 	dev_dbg(bus->dev,
 		"SDW Slave class_id %x, part_id %x, mfg_id %x, unique_id %x, version %x\n",
include/linux/soundwire/sdw.h +23 -0
index b8427df034ce..ee349a4c5349 100644
@@ -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
Signature · 1 line
2.20.1
maintainer Applied
#6 lore raw

Re: [PATCH 3/3] soundwire: add helper macros for devID fields

Quoted 3 lines · Pierre-Louis Bossart

Move bit extractors to macros, so that the definitions can be used by other drivers parsing the MIPI definitions extracted from firmware tables (ACPI or DT).

Applied, thanks

Signature · 1 line
~Vinod
maintainer
#7 lore raw
In reply to Pierre-Louis Bossart
Quoted 2 lines · Pierre-Louis Bossart

The first two patches prepare the support of multi-cpu dais for synchronized playback and capture. We remove an unused set of

Can you explain how this set does that..?

Quoted 1 line

prototypes and add a get_sdw_stream() callback prototype currently

Right, how does something which is unused and getting removed help in supporting multi-cpu dais?

Quoted 2 lines

missing (the implementation will come later as part of the synchronized playback)

I guess Mark can comment on this but we really want to see users of APIs as well.

Quoted 3 lines

The last exposes macros used internally, so that they can be reused to extract information from the _ADR 64-bit values in SOF platform drivers and related machine drivers.

On it is own, i think 1st and last patch look fine to me, so I guess I will go ahead and apply them. I can understand that last one can be used by SOF driver so can be pulled by Mark, will put on topic branch..

Quoted 18 lines

I think it's simpler if all these simple patches are merged through the SoundWire tree. With the additional changes to remove the platform drivers and the merge of interrupt handling, that will result in a single immutable tag provided to Mark Brown.

Pierre-Louis Bossart (3):
soundwire: cadence: remove useless prototypes
ASoC: soc-dai: add get_sdw_stream() callback
soundwire: add helper macros for devID fields

 drivers/soundwire/bus.c            | 21 +++++----------------
 drivers/soundwire/cadence_master.h |  8 --------
 include/linux/soundwire/sdw.h      | 23 +++++++++++++++++++++++
 include/sound/soc-dai.h            | 21 +++++++++++++++++++++
 4 files changed, 49 insertions(+), 24 deletions(-)
Signature · 1 line
2.20.1
Signature · 1 line
~Vinod