linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH 0/3] SoundWire: ASoC interfaces for multi-cpu dais and DisCo helpers
@ 2020-02-25 17:00 Pierre-Louis Bossart
  2020-02-25 17:00 ` [PATCH 1/3] soundwire: cadence: remove useless prototypes Pierre-Louis Bossart
                   ` (3 more replies)
  0 siblings, 4 replies; 8+ messages in thread
From: Pierre-Louis Bossart @ 2020-02-25 17:00 UTC (permalink / raw)
  To: alsa-devel
  Cc: linux-kernel, tiwai, broonie, vkoul, gregkh, jank,
	srinivas.kandagatla, slawomir.blauciak, Bard liao, Rander Wang,
	Ranjani Sridharan, Hui Wang, 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
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(-)

-- 
2.20.1


^ permalink raw reply	[flat|nested] 8+ messages in thread

* [PATCH 1/3] soundwire: cadence: remove useless prototypes
  2020-02-25 17:00 [PATCH 0/3] SoundWire: ASoC interfaces for multi-cpu dais and DisCo helpers Pierre-Louis Bossart
@ 2020-02-25 17:00 ` Pierre-Louis Bossart
  2020-02-26  8:39   ` Vinod Koul
  2020-02-25 17:00 ` [PATCH 2/3] ASoC: soc-dai: add get_sdw_stream() callback Pierre-Louis Bossart
                   ` (2 subsequent siblings)
  3 siblings, 1 reply; 8+ messages in thread
From: Pierre-Louis Bossart @ 2020-02-25 17:00 UTC (permalink / raw)
  To: alsa-devel
  Cc: linux-kernel, tiwai, broonie, vkoul, gregkh, jank,
	srinivas.kandagatla, slawomir.blauciak, Bard liao, Rander Wang,
	Ranjani Sridharan, Hui Wang, Pierre-Louis Bossart, Sanyog Kale

These prototypes are no longer used, remove.

Signed-off-by: Pierre-Louis Bossart <pierre-louis.bossart@linux.intel.com>
---
 drivers/soundwire/cadence_master.h | 8 --------
 1 file changed, 8 deletions(-)

diff --git a/drivers/soundwire/cadence_master.h b/drivers/soundwire/cadence_master.h
index 001457cbe5ad..2de1b2493ffc 100644
--- a/drivers/soundwire/cadence_master.h
+++ b/drivers/soundwire/cadence_master.h
@@ -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);
 
-- 
2.20.1


^ permalink raw reply related	[flat|nested] 8+ messages in thread

* [PATCH 2/3] ASoC: soc-dai: add get_sdw_stream() callback
  2020-02-25 17:00 [PATCH 0/3] SoundWire: ASoC interfaces for multi-cpu dais and DisCo helpers Pierre-Louis Bossart
  2020-02-25 17:00 ` [PATCH 1/3] soundwire: cadence: remove useless prototypes Pierre-Louis Bossart
@ 2020-02-25 17:00 ` Pierre-Louis Bossart
  2020-02-26 18:47   ` Applied "ASoC: soc-dai: add get_sdw_stream() callback" to the asoc tree Mark Brown
  2020-02-25 17:00 ` [PATCH 3/3] soundwire: add helper macros for devID fields Pierre-Louis Bossart
  2020-02-26  8:36 ` [PATCH 0/3] SoundWire: ASoC interfaces for multi-cpu dais and DisCo helpers Vinod Koul
  3 siblings, 1 reply; 8+ messages in thread
From: Pierre-Louis Bossart @ 2020-02-25 17:00 UTC (permalink / raw)
  To: alsa-devel
  Cc: linux-kernel, tiwai, broonie, vkoul, gregkh, jank,
	srinivas.kandagatla, slawomir.blauciak, Bard liao, Rander Wang,
	Ranjani Sridharan, Hui Wang, Pierre-Louis Bossart, Liam Girdwood,
	Jaroslav Kysela, Takashi Iwai

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

Signed-off-by: Pierre-Louis Bossart <pierre-louis.bossart@linux.intel.com>
---
 include/sound/soc-dai.h | 21 +++++++++++++++++++++
 1 file changed, 21 insertions(+)

diff --git a/include/sound/soc-dai.h b/include/sound/soc-dai.h
index eaaeb00e9e84..19027469a5c5 100644
--- a/include/sound/soc-dai.h
+++ b/include/sound/soc-dai.h
@@ -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
-- 
2.20.1


^ permalink raw reply related	[flat|nested] 8+ messages in thread

* [PATCH 3/3] soundwire: add helper macros for devID fields
  2020-02-25 17:00 [PATCH 0/3] SoundWire: ASoC interfaces for multi-cpu dais and DisCo helpers Pierre-Louis Bossart
  2020-02-25 17:00 ` [PATCH 1/3] soundwire: cadence: remove useless prototypes Pierre-Louis Bossart
  2020-02-25 17:00 ` [PATCH 2/3] ASoC: soc-dai: add get_sdw_stream() callback Pierre-Louis Bossart
@ 2020-02-25 17:00 ` Pierre-Louis Bossart
  2020-02-26  8:39   ` Vinod Koul
  2020-02-26  8:36 ` [PATCH 0/3] SoundWire: ASoC interfaces for multi-cpu dais and DisCo helpers Vinod Koul
  3 siblings, 1 reply; 8+ messages in thread
From: Pierre-Louis Bossart @ 2020-02-25 17:00 UTC (permalink / raw)
  To: alsa-devel
  Cc: linux-kernel, tiwai, broonie, vkoul, gregkh, jank,
	srinivas.kandagatla, slawomir.blauciak, Bard liao, Rander Wang,
	Ranjani Sridharan, Hui Wang, Pierre-Louis Bossart, Sanyog Kale

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).

Signed-off-by: Pierre-Louis Bossart <pierre-louis.bossart@linux.intel.com>
---
 drivers/soundwire/bus.c       | 21 +++++----------------
 include/linux/soundwire/sdw.h | 23 +++++++++++++++++++++++
 2 files changed, 28 insertions(+), 16 deletions(-)

diff --git a/drivers/soundwire/bus.c b/drivers/soundwire/bus.c
index b8a7a84aca1c..01be7220d117 100644
--- a/drivers/soundwire/bus.c
+++ b/drivers/soundwire/bus.c
@@ -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",
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
-- 
2.20.1


^ permalink raw reply related	[flat|nested] 8+ messages in thread

* Re: [PATCH 0/3] SoundWire: ASoC interfaces for multi-cpu dais and DisCo helpers
  2020-02-25 17:00 [PATCH 0/3] SoundWire: ASoC interfaces for multi-cpu dais and DisCo helpers Pierre-Louis Bossart
                   ` (2 preceding siblings ...)
  2020-02-25 17:00 ` [PATCH 3/3] soundwire: add helper macros for devID fields Pierre-Louis Bossart
@ 2020-02-26  8:36 ` Vinod Koul
  3 siblings, 0 replies; 8+ messages in thread
From: Vinod Koul @ 2020-02-26  8:36 UTC (permalink / raw)
  To: Pierre-Louis Bossart
  Cc: alsa-devel, linux-kernel, tiwai, broonie, gregkh, jank,
	srinivas.kandagatla, slawomir.blauciak, Bard liao, Rander Wang,
	Ranjani Sridharan, Hui Wang

On 25-02-20, 11:00, Pierre-Louis Bossart wrote:
> 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..?

> 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?

> 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.

> 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..

> 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(-)
> 
> -- 
> 2.20.1

-- 
~Vinod

^ permalink raw reply	[flat|nested] 8+ messages in thread

* Re: [PATCH 1/3] soundwire: cadence: remove useless prototypes
  2020-02-25 17:00 ` [PATCH 1/3] soundwire: cadence: remove useless prototypes Pierre-Louis Bossart
@ 2020-02-26  8:39   ` Vinod Koul
  0 siblings, 0 replies; 8+ messages in thread
From: Vinod Koul @ 2020-02-26  8:39 UTC (permalink / raw)
  To: Pierre-Louis Bossart
  Cc: alsa-devel, linux-kernel, tiwai, broonie, gregkh, jank,
	srinivas.kandagatla, slawomir.blauciak, Bard liao, Rander Wang,
	Ranjani Sridharan, Hui Wang, Sanyog Kale

On 25-02-20, 11:00, Pierre-Louis Bossart wrote:
> These prototypes are no longer used, remove.

Applied, thanks

-- 
~Vinod

^ permalink raw reply	[flat|nested] 8+ messages in thread

* Re: [PATCH 3/3] soundwire: add helper macros for devID fields
  2020-02-25 17:00 ` [PATCH 3/3] soundwire: add helper macros for devID fields Pierre-Louis Bossart
@ 2020-02-26  8:39   ` Vinod Koul
  0 siblings, 0 replies; 8+ messages in thread
From: Vinod Koul @ 2020-02-26  8:39 UTC (permalink / raw)
  To: Pierre-Louis Bossart
  Cc: alsa-devel, linux-kernel, tiwai, broonie, gregkh, jank,
	srinivas.kandagatla, slawomir.blauciak, Bard liao, Rander Wang,
	Ranjani Sridharan, Hui Wang, Sanyog Kale

On 25-02-20, 11:00, Pierre-Louis Bossart wrote:
> 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

-- 
~Vinod

^ permalink raw reply	[flat|nested] 8+ messages in thread

* Applied "ASoC: soc-dai: add get_sdw_stream() callback" to the asoc tree
  2020-02-25 17:00 ` [PATCH 2/3] ASoC: soc-dai: add get_sdw_stream() callback Pierre-Louis Bossart
@ 2020-02-26 18:47   ` Mark Brown
  0 siblings, 0 replies; 8+ messages in thread
From: Mark Brown @ 2020-02-26 18:47 UTC (permalink / raw)
  To: Pierre-Louis Bossart
  Cc: alsa-devel, Bard liao, broonie, gregkh, Hui Wang, jank,
	Liam Girdwood, linux-kernel, Mark Brown, Rander Wang,
	Ranjani Sridharan, slawomir.blauciak, srinivas.kandagatla,
	Takashi Iwai, tiwai, vkoul

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 <pierre-louis.bossart@linux.intel.com>
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.

Signed-off-by: Pierre-Louis Bossart <pierre-louis.bossart@linux.intel.com>
Link: https://lore.kernel.org/r/20200225170041.23644-3-pierre-louis.bossart@linux.intel.com
Signed-off-by: Mark Brown <broonie@kernel.org>
---
 include/sound/soc-dai.h | 21 +++++++++++++++++++++
 1 file changed, 21 insertions(+)

diff --git a/include/sound/soc-dai.h b/include/sound/soc-dai.h
index 92c382690930..7f70db149b81 100644
--- a/include/sound/soc-dai.h
+++ b/include/sound/soc-dai.h
@@ -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
-- 
2.20.1


^ permalink raw reply related	[flat|nested] 8+ messages in thread

end of thread, other threads:[~2020-02-26 18:47 UTC | newest]

Thread overview: 8+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2020-02-25 17:00 [PATCH 0/3] SoundWire: ASoC interfaces for multi-cpu dais and DisCo helpers Pierre-Louis Bossart
2020-02-25 17:00 ` [PATCH 1/3] soundwire: cadence: remove useless prototypes Pierre-Louis Bossart
2020-02-26  8:39   ` Vinod Koul
2020-02-25 17:00 ` [PATCH 2/3] ASoC: soc-dai: add get_sdw_stream() callback Pierre-Louis Bossart
2020-02-26 18:47   ` Applied "ASoC: soc-dai: add get_sdw_stream() callback" to the asoc tree Mark Brown
2020-02-25 17:00 ` [PATCH 3/3] soundwire: add helper macros for devID fields Pierre-Louis Bossart
2020-02-26  8:39   ` Vinod Koul
2020-02-26  8:36 ` [PATCH 0/3] SoundWire: ASoC interfaces for multi-cpu dais and DisCo helpers Vinod Koul

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).