[PATCH 0/3] 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(-)
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);
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
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.... 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
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
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
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
participants (3)
-
Mark Brown
-
Pierre-Louis Bossart
-
Vinod Koul