ASoC: cs35l56/57/62/63: Use the correct SoundWire DP for feedback
Subsystems (4)
Richard Fitzgerald
maintainercover ASoC: cs35l56/57/62/63: Use the correct SoundWire DP for feedback
The amp feedback path (AEC) was incorrectly using SoundWire DP3. The firmware outputs SDCA OT25 feedback on DP4. DP3 is reserved for SDCA companion amp.
This series adds a DAI for OT25 and switches the sdw machine driver to use the new DAI for the feedback path.
Richard Fitzgerald (2):
ASoC: cs35l56: Add DAI for SDCA OT25 stream
ASoC: sdw_utils: Switch CS35L56/57/62/63 to use OT25 DAI
include/sound/cs35l56.h | 1 + sound/soc/codecs/cs35l56-sdw.c | 9 +++-- sound/soc/codecs/cs35l56.c | 54 +++++++++++++++++++++++++++++ sound/soc/sdw_utils/soc_sdw_utils.c | 8 ++--- 4 files changed, 66 insertions(+), 6 deletions(-)
Signature · 1 line
2.47.3
Richard Fitzgerald
maintainerPATCH 1/2 ASoC: cs35l56: Add DAI for SDCA OT25 stream
Add a DAI for the SDCA OT25 stream on SoundWire DP4.
The SDCA-defined OT25 stream is an amp reference feedback, typically used for AEC. The firmware outputs this on DP4. The firmware owns all control registers for this stream so there are no mixer controls or any other configuration options.
--- include/sound/cs35l56.h | 1 + sound/soc/codecs/cs35l56-sdw.c | 9 ++++-- sound/soc/codecs/cs35l56.c | 54 ++++++++++++++++++++++++++++++++++ 3 files changed, 62 insertions(+), 2 deletions(-)
include/sound/cs35l56.h +1 -0
@@ -312,6 +312,7 @@ struct snd_ctl_elem_value;#define CS35L56_SDW1_PLAYBACK_PORT 1#define CS35L56_SDW1_CAPTURE_PORT 3 +#define CS35L56_OT25_CAPTURE_PORT 4#define CS35L56_NUM_BULK_SUPPLIES 3#define CS35L56_NUM_DSP_REGIONS 5
sound/soc/codecs/cs35l56-sdw.c +7 -2
@@ -265,11 +265,11 @@ static int cs35l56_sdw_read_prop(struct sdw_slave *peripheral)if (ret ==0 ) prop->clk_stop_mode1 = !!clock_stop_1; - ports =devm_kcalloc (cs35l56->base.dev,2 ,sizeof (*ports),GFP_KERNEL ); + ports =devm_kcalloc (cs35l56->base.dev,3 ,sizeof (*ports),GFP_KERNEL );if (!ports)return -ENOMEM ; - prop->source_ports =BIT (CS35L56_SDW1_CAPTURE_PORT ); + prop->source_ports =BIT (CS35L56_SDW1_CAPTURE_PORT ) |BIT (CS35L56_OT25_CAPTURE_PORT ); prop->sink_ports =BIT (CS35L56_SDW1_PLAYBACK_PORT ); prop->paging_support = true; prop->use_domain_irq = true;
@@ -286,6 +286,11 @@ static int cs35l56_sdw_read_prop(struct sdw_slave *peripheral) ports[1 ].num =CS35L56_SDW1_CAPTURE_PORT ; ports[1 ].type =SDW_DPN_FULL ; ports[1 ].ch_prep_timeout =10 ; + +/* DP4 - capture */ + ports[2 ].num =CS35L56_OT25_CAPTURE_PORT ; + ports[2 ].type =SDW_DPN_FULL ; + ports[2 ].ch_prep_timeout =10 ; prop->src_dpn_prop = &ports[1 ]; dev_dbg(&peripheral->dev, "clock stop mode 1 supported: %s\n",
sound/soc/codecs/cs35l56.c +54 -0
90 lines not on this page · raw message
Signature · 1 line
2.47.3
Re: [PATCH 1/2] ASoC: cs35l56: Add DAI for SDCA OT25 stream
Hi,
v7.2.11 includes bf7a3ce1d563 ("ASoC: sdw_utils: Switch CS35L56/57/62/63 to use OT25 DAI") [ Upstream commit 4b7f393a01f88e8d03cba94cf4948652de14789b ]
but not this preceding patch from the same series, which adds the DAI it switches to.
sof_sdw tries to bind a DAI that the cs35l56 codec driver never registers, and card creation fails:
sof_sdw sof_sdw: ASoC: CODEC DAI cs35l56-ot25 not registered
On my Galaxy Book6 Pro with CS35L57, this breaks sound.
Please apply this commit 86c8360c97f6 ("ASoC: cs35l56: Add DAI for SDCA OT25 stream") to stable too.
Thanks,
Juhyung
Quoted 156 lines · Richard Fitzgerald
Add a DAI for the SDCA OT25 stream on SoundWire DP4.
The SDCA-defined OT25 stream is an amp reference feedback, typically used for AEC. The firmware outputs this on DP4. The firmware owns all control registers for this stream so there are no mixer controls or any other configuration options.
Signed-off-by Richard Fitzgerald <[email protected]>--- include/sound/cs35l56.h | 1 + sound/soc/codecs/cs35l56-sdw.c | 9 ++++-- sound/soc/codecs/cs35l56.c | 54 ++++++++++++++++++++++++++++++++++ 3 files changed, 62 insertions(+), 2 deletions(-)include/sound/cs35l56.h +1
-0@@ -312,6 +312,7 @@ struct snd_ctl_elem_value;#define CS35L56_SDW1_PLAYBACK_PORT 1#define CS35L56_SDW1_CAPTURE_PORT 3 +#define CS35L56_OT25_CAPTURE_PORT 4#define CS35L56_NUM_BULK_SUPPLIES 3#define CS35L56_NUM_DSP_REGIONS 5sound/soc/codecs/cs35l56-sdw.c +7
-2@@ -265,11 +265,11 @@ static int cs35l56_sdw_read_prop(struct sdw_slave *peripheral)if (ret ==0 ) prop->clk_stop_mode1 = !!clock_stop_1; - ports =devm_kcalloc (cs35l56->base.dev,2 ,sizeof (*ports),GFP_KERNEL ); + ports =devm_kcalloc (cs35l56->base.dev,3 ,sizeof (*ports),GFP_KERNEL );if (!ports)return -ENOMEM ; - prop->source_ports =BIT (CS35L56_SDW1_CAPTURE_PORT ); + prop->source_ports =BIT (CS35L56_SDW1_CAPTURE_PORT ) |BIT (CS35L56_OT25_CAPTURE_PORT ); prop->sink_ports =BIT (CS35L56_SDW1_PLAYBACK_PORT ); prop->paging_support = true; prop->use_domain_irq = true;@@ -286,6 +286,11 @@ static int cs35l56_sdw_read_prop(struct sdw_slave *peripheral) ports[1 ].num =CS35L56_SDW1_CAPTURE_PORT ; ports[1 ].type =SDW_DPN_FULL ; ports[1 ].ch_prep_timeout =10 ; + +/* DP4 - capture */ + ports[2 ].num =CS35L56_OT25_CAPTURE_PORT ; + ports[2 ].type =SDW_DPN_FULL ; + ports[2 ].ch_prep_timeout =10 ; prop->src_dpn_prop = &ports[1 ]; dev_dbg(&peripheral->dev, "clock stop mode 1 supported: %s\n",sound/soc/codecs/cs35l56.c +54
-0@@ -32,6 +32,7 @@#include <sound/cs-amp-lib.h> #include <sound/pcm.h> #include <sound/pcm_params.h> +#include <sound/sdw.h> #include <sound/soc.h> #include <sound/soc-dapm.h> #include <sound/tlv.h> @@ -324,6 +325,7 @@ static const struct snd_soc_dapm_widget cs35l56_dapm_widgets[] = {SND_SOC_DAPM_SIGGEN ("VDDBMON ADC" ),SND_SOC_DAPM_SIGGEN ("VBSTMON ADC" ),SND_SOC_DAPM_SIGGEN ("TEMPMON ADC" ), +SND_SOC_DAPM_SIGGEN ("OT25 Reference" ), SND_SOC_DAPM_INPUT("Calibrate"), };@@ -388,6 +390,8 @@ static const struct snd_soc_dapm_route cs35l56_audio_map[] = { { "SDW1 Capture", NULL, "SDW1 TX2 Source" }, { "SDW1 Capture", NULL, "SDW1 TX3 Source" }, { "SDW1 Capture", NULL, "SDW1 TX4 Source" }, + + { "OT25", NULL, "OT25 Reference" }, }; static int cs35l56_dsp_event(struct snd_soc_dapm_widget *w,@@ -722,6 +726,37 @@ static int cs35l56_sdw_dai_set_stream(struct snd_soc_dai *dai,return 0 ; } +static int cs35l56_ot25_dai_hw_params (struct snd_pcm_substream *substream, +struct snd_pcm_hw_params *params, +struct snd_soc_dai *dai) +{ +struct cs35l56_private *cs35l56 =snd_soc_component_get_drvdata (dai->component); +struct sdw_stream_runtime *sdw_stream =snd_soc_dai_get_dma_data (dai, substream); +struct sdw_stream_config sconfig = { }; +struct sdw_port_config pconfig = { }; +int ret; + +dev_dbg (cs35l56->base.dev,"%s: rate %d\n" , __func__,params_rate (params)); + +if (!cs35l56->base.init_done) +return -ENODEV ; + +if (!sdw_stream) +return -EINVAL ; + +snd_sdw_params_to_config (substream, params, &sconfig, &pconfig); + pconfig.num =CS35L56_OT25_CAPTURE_PORT ; + + ret =sdw_stream_add_slave (cs35l56->sdw_peripheral, &sconfig, &pconfig, +1 , sdw_stream); +if (ret) { +dev_err (dai->dev,"Failed to add OT25 stream: %d\n" , ret); +return ret; + } + +return 0 ; +} +static const struct snd_soc_dai_ops cs35l56_sdw_dai_ops = { .set_tdm_slot = cs35l56_sdw_dai_set_tdm_slot, .shutdown = cs35l56_sdw_dai_shutdown,@@ -730,6 +765,13 @@ static const struct snd_soc_dai_ops cs35l56_sdw_dai_ops = { .set_stream = cs35l56_sdw_dai_set_stream, }; +static const struct snd_soc_dai_ops cs35l56_ot25_dai_ops = { + .shutdown = cs35l56_sdw_dai_shutdown, + .hw_params = cs35l56_ot25_dai_hw_params, + .hw_free = cs35l56_sdw_dai_hw_free, + .set_stream = cs35l56_sdw_dai_set_stream, +}; +static struct snd_soc_dai_driver cs35l56_dai[] = { { .name ="cs35l56-asp1" ,@@ -778,6 +820,18 @@ static struct snd_soc_dai_driver cs35l56_dai[] = { .symmetric_rate = 1, .ops = &cs35l56_sdw_dai_ops, }, + { + .name = "cs35l56-ot25", + .id = 3, + .capture = { + .stream_name = "OT25", + .channels_min = 1, + .channels_max = 2, + .rates = CS35L56_RATES, + .formats = CS35L56_TX_FORMATS, + }, + .ops = &cs35l56_ot25_dai_ops, + }, };static int cs35l56_write_cal (struct cs35l56_private *cs35l56)
Re: [PATCH 1/2] ASoC: cs35l56: Add DAI for SDCA OT25 stream
Quoted 2 lines
Please apply this commit
86c8360c97f6("ASoC: cs35l56: Add DAI for SDCA OT25 stream") to stable too.
Queued for 7.2, thanks.
Signature · 2 lines
Thanks, Sasha
Richard Fitzgerald
maintainerPATCH 2/2 ASoC: sdw_utils: Switch CS35L56/57/62/63 to use OT25 DAI
In reply to Richard FitzgeraldChange the CS35L56/57/62/63 entries in codec_info_list[] to use the OT25 DAI for amp feedback.
The AMP feedback was incorrectly using a DAI connected to DP3, but that is reserved for SDCA companion amp. The correct amp output is DP4, which is the SDCA OT25 feedback output.
--- sound/soc/sdw_utils/soc_sdw_utils.c | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-)
sound/soc/sdw_utils/soc_sdw_utils.c +4 -4
@@ -1035,7 +1035,7 @@ struct asoc_sdw_codec_info codec_info_list[] = { }, { .direction = {false, true}, - .dai_name = "cs35l56-sdw1c", + .dai_name = "cs35l56-ot25", .dai_type = SOC_SDW_DAI_TYPE_AMP, .dailink = {SOC_SDW_UNUSED_DAI_ID, SOC_SDW_AMP_IN_DAI_ID}, },
@@ -1063,7 +1063,7 @@ struct asoc_sdw_codec_info codec_info_list[] = { }, { .direction = {false, true}, - .dai_name = "cs35l56-sdw1c", + .dai_name = "cs35l56-ot25", .dai_type = SOC_SDW_DAI_TYPE_AMP, .dailink = {SOC_SDW_UNUSED_DAI_ID, SOC_SDW_AMP_IN_DAI_ID}, },
@@ -1091,7 +1091,7 @@ struct asoc_sdw_codec_info codec_info_list[] = { }, { .direction = {false, true}, - .dai_name = "cs35l56-sdw1c", + .dai_name = "cs35l56-ot25", .dai_type = SOC_SDW_DAI_TYPE_AMP, .dailink = {SOC_SDW_UNUSED_DAI_ID, SOC_SDW_AMP_IN_DAI_ID}, },
@@ -1119,7 +1119,7 @@ struct asoc_sdw_codec_info codec_info_list[] = { }, { .direction = {false, true}, - .dai_name = "cs35l56-sdw1c", + .dai_name = "cs35l56-ot25", .dai_type = SOC_SDW_DAI_TYPE_AMP, .dailink = {SOC_SDW_UNUSED_DAI_ID, SOC_SDW_AMP_IN_DAI_ID}, },
Signature · 1 line
2.47.3
Quoted 6 lines · Richard Fitzgerald
The amp feedback path (AEC) was incorrectly using SoundWire DP3. The firmware outputs SDCA OT25 feedback on DP4. DP3 is reserved for SDCA companion amp.
This series adds a DAI for OT25 and switches the sdw machine driver to use the new DAI for the feedback path.
Is there any merit in keeping this DP3 exposed as a capture DAI, if indeed it's intended to be a side connection for a companion chip?
I never quite understood how those companion chips would be managed, IIRC we don't have support for device-to-device transfers, do we? the entire stream definition and bandwidth calculation are based on a host port as source or target.
Quoted 10 lines
Richard Fitzgerald (2):
ASoC: cs35l56: Add DAI for SDCA OT25 stream
ASoC:sdw_utils: Switch CS35L56/57/62/63 to use OT25 DAIinclude/sound/cs35l56.h | 1 + sound/soc/codecs/cs35l56-sdw.c | 9 +++-- sound/soc/codecs/cs35l56.c | 54 +++++++++++++++++++++++++++++ sound/soc/sdw_utils/soc_sdw_utils.c | 8 ++--- 4 files changed, 66 insertions(+), 6 deletions(-)
Richard Fitzgerald
maintainerQuoted 10 lines · Pierre-Louis Bossart
Quoted 6 lines · Richard Fitzgerald
The amp feedback path (AEC) was incorrectly using SoundWire DP3. The firmware outputs SDCA OT25 feedback on DP4. DP3 is reserved for SDCA companion amp.
This series adds a DAI for OT25 and switches the sdw machine driver to use the new DAI for the feedback path.
Is there any merit in keeping this DP3 exposed as a capture DAI, if indeed it's intended to be a side connection for a companion chip?
I kept this patch to a minimum because it is a Fixes: so it must apply to older kernels.
However, you are correct. DP3 isn't used now. Not even on companion amp. DP3 is a companion output from the amp (SDCA OT127), but Cirrus companion amp goes codec->amp so uses DP1 on the amp.
When the driver was being written the SDCA spec and firmware behavior were not fully defined so pairing of the symmetrical DP1+DP3 (for play+capture) was carried forward from previous amps. But SDCA doesn't provide any sort of UCM capability - widgets on the device have defined, fixed functionality that has to be preconfigured by the firmware to match what SDCA needs. Ultimately DP4 was more suitable for OT25. DP4 also works for loopback testing.
Removing DP3 would also solve some other problems that the driver and firmware are both "owning" the registers. We originally attempted to sync this up, then gave up on that complexity and overwrite the register settings the firmware made.
Quoted 27 lines · Richard Fitzgerald
Quoted 10 lines · Pierre-Louis Bossart
Quoted 6 lines · Richard Fitzgerald
The amp feedback path (AEC) was incorrectly using SoundWire DP3. The firmware outputs SDCA OT25 feedback on DP4. DP3 is reserved for SDCA companion amp.
This series adds a DAI for OT25 and switches the sdw machine driver to use the new DAI for the feedback path.
Is there any merit in keeping this DP3 exposed as a capture DAI, if indeed it's intended to be a side connection for a companion chip?
I kept this patch to a minimum because it is a Fixes: so it must apply to older kernels.
However, you are correct. DP3 isn't used now. Not even on companion amp. DP3 is a companion output from the amp (SDCA OT127), but Cirrus companion amp goes
codec->ampso uses DP1 on the amp.When the driver was being written the SDCA spec and firmware behavior were not fully defined so pairing of the symmetrical DP1+DP3 (for play+capture) was carried forward from previous amps. But SDCA doesn't provide any sort of UCM capability - widgets on the device have defined, fixed functionality that has to be preconfigured by the firmware to match what SDCA needs. Ultimately DP4 was more suitable for OT25. DP4 also works for loopback testing.
Quoted 4 lines
Removing DP3 would also solve some other problems that the driver and firmware are both "owning" the registers. We originally attempted to sync this up, then gave up on that complexity and overwrite the register settings the firmware made.
thanks for the explanations, I guess we'll see a follow-up patch to remove DP3 altogether at some point.
Quoted 10 lines · Richard Fitzgerald
The amp feedback path (AEC) was incorrectly using SoundWire DP3. The firmware outputs SDCA OT25 feedback on DP4. DP3 is reserved for SDCA companion amp.
This series adds a DAI for OT25 and switches the sdw machine driver to use the new DAI for the feedback path.
Richard Fitzgerald (2):
ASoC: cs35l56: Add DAI for SDCA OT25 stream
ASoC:sdw_utils: Switch CS35L56/57/62/63 to use OT25 DAI
Quoted 7 lines
include/sound/cs35l56.h | 1 + sound/soc/codecs/cs35l56-sdw.c | 9 +++-- sound/soc/codecs/cs35l56.c | 54 +++++++++++++++++++++++++++++ sound/soc/sdw_utils/soc_sdw_utils.c | 8 ++--- 4 files changed, 66 insertions(+), 6 deletions(-)
Mark Brown
maintainerQuoted 10 lines · Richard Fitzgerald
ASoC: cs35l56/57/62/63: Use the correct SoundWire DP for feedback
The amp feedback path (AEC) was incorrectly using SoundWire DP3. The firmware outputs SDCA OT25 feedback on DP4. DP3 is reserved for SDCA companion amp.
This series adds a DAI for OT25 and switches the sdw machine driver to use the new DAI for the feedback path.
[...]
Applied to
https://git.kernel.org/pub/scm/linux/kernel/git/broonie/sound.git for-7.3
Thanks!
[1/2] ASoC: cs35l56: Add DAI for SDCA OT25 stream
https://git.kernel.org/broonie/sound/c/86c8360c97f6 [2/2] ASoC: sdw_utils: Switch CS35L56/57/62/63 to use OT25 DAI https://git.kernel.org/broonie/sound/c/4b7f393a01f8
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