ASoC: Intel: machine driver corrections
Subsystems (4)
cover ASoC: Intel: machine driver corrections
The first fix solves an underflow in SoundWire platforms using the max98373 amplifier, the rest of the patches are minor corrections in machine drivers.
The fix should be queued for the 5.14 cycle, the rest should be harmless but can be deferred for 5.15 if it's too late already.
Brent Lu (2):
ASoC: SOF: add a helper to get topology configured bclk
ASoC: Intel: sof_cs42l42: use helper function to get bclk frequency
Gongjun Song (1):
ASoC: Intel: soc-acpi: add support for SoundWire of TGL-H-RVP
Rander Wang (1):
ASoC: Intel: boards: fix xrun issue on platform with max98373
include/sound/sof.h | 1 + sound/soc/intel/boards/sof_cs42l42.c | 8 +- sound/soc/intel/boards/sof_sdw_max98373.c | 81 ++++++++++++------- .../intel/common/soc-acpi-intel-tgl-match.c | 15 ++++ sound/soc/sof/sof-audio.c | 42 ++++++++-- 5 files changed, 111 insertions(+), 36 deletions(-)
Signature · 1 line
2.25.1
PATCH 1/4 ASoC: Intel: boards: fix xrun issue on platform with max98373
From: Rander Wang <[email protected]>
On TGL platform with max98373 codec the trigger start sequence is fe first, then codec component and sdw link is the last. Recently a delay was introduced in max98373 codec driver and this resulted to the start of sdw stream transmission was delayed and the data transmitted by fw can't be consumed by sdw controller, so xrun happened.
Adding delay in trigger function is a bad idea. This patch enable spk pin in prepare function and disable it in hw_free to avoid xrun issue caused by delay in trigger.
--- sound/soc/intel/boards/sof_sdw_max98373.c | 81 +++++++++++++++-------- 1 file changed, 53 insertions(+), 28 deletions(-)
sound/soc/intel/boards/sof_sdw_max98373.c +53 -28
@@ -55,43 +55,68 @@ static int spk_init(struct snd_soc_pcm_runtime *rtd)return ret; } -static int max98373_sdw_trigger (struct snd_pcm_substream *substream,int cmd) +static int mx8373_enable_spk_pin (struct snd_pcm_substream *substream,bool enable) { +struct snd_soc_pcm_runtime *rtd =asoc_substream_to_rtd (substream); +struct snd_soc_dai *codec_dai; +struct snd_soc_dai *cpu_dai;int ret; +int j; -switch (cmd) { -case SNDRV_PCM_TRIGGER_START : -case SNDRV_PCM_TRIGGER_RESUME : -case SNDRV_PCM_TRIGGER_PAUSE_RELEASE : -/* enable max98373 first */ - ret =max_98373_trigger (substream, cmd); -if (ret <0 ) -break ; - - ret =sdw_trigger (substream, cmd); -break ; -case SNDRV_PCM_TRIGGER_STOP : -case SNDRV_PCM_TRIGGER_SUSPEND : -case SNDRV_PCM_TRIGGER_PAUSE_PUSH : - ret =sdw_trigger (substream, cmd); -if (ret <0 ) -break ; - - ret =max_98373_trigger (substream, cmd); -break ; -default : - ret = -EINVAL ; -break ; +/* set spk pin by playback only */ +if (substream->stream ==SNDRV_PCM_STREAM_CAPTURE ) +return 0 ; + + cpu_dai =asoc_rtd_to_cpu (rtd,0 ); +for_each_rtd_codec_dais (rtd, j, codec_dai) { +struct snd_soc_dapm_context *dapm = +snd_soc_component_get_dapm (cpu_dai->component); +char pin_name[16 ]; + +snprintf (pin_name,ARRAY_SIZE (pin_name),"%s Spk" , + codec_dai->component->name_prefix); + +if (enable) + ret =snd_soc_dapm_enable_pin (dapm, pin_name); +else + ret =snd_soc_dapm_disable_pin (dapm, pin_name); + +if (!ret) +snd_soc_dapm_sync (dapm); } -return ret; +return 0 ; +} + +static int mx8373_sdw_prepare (struct snd_pcm_substream *substream) +{ +int ret =0 ; + +/* according to soc_pcm_prepare dai link prepare is called first */ + ret =sdw_prepare (substream); +if (ret <0 ) +return ret; + +return mx8373_enable_spk_pin (substream, true); +} + +static int mx8373_sdw_hw_free (struct snd_pcm_substream *substream) +{ +int ret =0 ; + +/* according to soc_pcm_hw_free dai link free is called first */ + ret =sdw_hw_free (substream); +if (ret <0 ) +return ret; + +return mx8373_enable_spk_pin (substream, false); }static const struct snd_soc_ops max_98373_sdw_ops = { .startup = sdw_startup, - .prepare = sdw_prepare, - .trigger = max98373_sdw_trigger, - .hw_free = sdw_hw_free, + .prepare = mx8373_sdw_prepare, + .trigger = sdw_trigger, + .hw_free = mx8373_sdw_hw_free, .shutdown = sdw_shutdown, };
Signature · 1 line
2.25.1
PATCH 2/4 ASoC: Intel: soc-acpi: add support for SoundWire of TGL-H-RVP
In reply to Pierre-Louis BossartFrom: Gongjun Song <[email protected]>
snd_soc_acpi_intel_tgl_sdw_machines structure array does not contain the configuration information of TGL-H-RVP, which results in the inability to enable soundwire on the TGL-H-RVP platform.
Add the corresponding configuration information to enable soundwire on the TGL-H-RVP platform.
--- sound/soc/intel/common/soc-acpi-intel-tgl-match.c | 15 +++++++++++++++ 1 file changed, 15 insertions(+)
sound/soc/intel/common/soc-acpi-intel-tgl-match.c +15 -0
@@ -196,6 +196,15 @@ static const struct snd_soc_acpi_link_adr tgl_rvp[] = { {} }; +static const struct snd_soc_acpi_link_adr tgl_rvp_headset_only[] = { + { + .mask =BIT (0 ), + .num_adr =ARRAY_SIZE (rt711_0_adr), + .adr_d = rt711_0_adr, + }, + {} +}; +static const struct snd_soc_acpi_link_adr tgl_hp[] = { { .mask =BIT (0 ),
@@ -398,6 +407,12 @@ struct snd_soc_acpi_mach snd_soc_acpi_intel_tgl_sdw_machines[] = { .drv_name = "sof_sdw", .sof_tplg_filename = "sof-tgl-sdw-max98373-rt5682.tplg", }, + { + .link_mask = 0x1, /* rt711 on link 0 */ + .links = tgl_rvp_headset_only, + .drv_name = "sof_sdw", + .sof_tplg_filename = "sof-tgl-rt711.tplg", + }, {}, };EXPORT_SYMBOL_GPL (snd_soc_acpi_intel_tgl_sdw_machines);
Signature · 1 line
2.25.1
PATCH 3/4 ASoC: SOF: add a helper to get topology configured bclk
In reply to Pierre-Louis BossartFrom: Brent Lu <[email protected]>
Add helper function sof_dai_ssp_bclk() to get the BCLK frequency configured by topology.
--- include/sound/sof.h | 1 + sound/soc/sof/sof-audio.c | 42 ++++++++++++++++++++++++++++++++------- 2 files changed, 36 insertions(+), 7 deletions(-)
include/sound/sof.h +1 -0
@@ -101,5 +101,6 @@ struct sof_dev_desc { };int sof_dai_get_mclk (struct snd_soc_pcm_runtime *rtd); +int sof_dai_get_bclk (struct snd_soc_pcm_runtime *rtd);#endif
sound/soc/sof/sof-audio.c +35 -7
62 lines not on this page · raw message
Signature · 1 line
2.25.1
PATCH 4/4 ASoC: Intel: sof_cs42l42: use helper function to get bclk frequency
In reply to Pierre-Louis BossartFrom: Brent Lu <[email protected]>
Use sof_dai_get_bclk() function to get bclk frequency instead of a hard-coded magic number depending on configuration in topology.
--- sound/soc/intel/boards/sof_cs42l42.c | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-)
sound/soc/intel/boards/sof_cs42l42.c +7 -1
@@ -16,6 +16,7 @@#include <sound/pcm.h> #include <sound/pcm_params.h> #include <sound/soc.h> +#include <sound/sof.h> #include <sound/soc-acpi.h> #include <dt-bindings/sound/cs42l42.h> #include "../../codecs/hdac_hdmi.h"
@@ -122,7 +123,12 @@ static int sof_cs42l42_hw_params(struct snd_pcm_substream *substream,struct snd_soc_dai *codec_dai =asoc_rtd_to_codec (rtd,0 );int clk_freq, ret; - clk_freq =3072000 ;/* BCLK freq */ + clk_freq =sof_dai_get_bclk (rtd);/* BCLK freq */ + +if (clk_freq <=0 ) { +dev_err (rtd->dev,"get bclk freq failed: %d\n" , clk_freq); +return -EINVAL ; + }/* Configure sysclk for codec */ ret = snd_soc_dai_set_sysclk(codec_dai, 0,
Signature · 1 line
2.25.1
Mark Brown
maintainerRe: (subset) [PATCH 0/4] ASoC: Intel: machine driver corrections
In reply to Pierre-Louis BossartQuoted 8 lines · Pierre-Louis Bossart
The first fix solves an underflow in SoundWire platforms using the max98373 amplifier, the rest of the patches are minor corrections in machine drivers.
The fix should be queued for the 5.14 cycle, the rest should be harmless but can be deferred for 5.15 if it's too late already.
[...]
Applied to
https://git.kernel.org/pub/scm/linux/kernel/git/broonie/sound.git for-next
Thanks!
[1/4] ASoC: Intel: boards: fix xrun issue on platform with max98373
commit: 33c8516841ea4fa12fdb8961711bf95095c607ee
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
Mark Brown
maintainerRe: (subset) [PATCH 0/4] ASoC: Intel: machine driver corrections
In reply to Pierre-Louis BossartQuoted 8 lines · Pierre-Louis Bossart
The first fix solves an underflow in SoundWire platforms using the max98373 amplifier, the rest of the patches are minor corrections in machine drivers.
The fix should be queued for the 5.14 cycle, the rest should be harmless but can be deferred for 5.15 if it's too late already.
[...]
Applied to
https://git.kernel.org/pub/scm/linux/kernel/git/broonie/sound.git for-next
Thanks!
[2/4] ASoC: Intel: soc-acpi: add support for SoundWire of TGL-H-RVP
commit: f99acc259f621ae6667782778b2065c15e109693
[3/4] ASoC: SOF: add a helper to get topology configured bclk
commit: bc619cfc6278c87b4e310f9db9f45abc263220e8
[4/4] ASoC: Intel: sof_cs42l42: use helper function to get bclk frequency
commit: 837ad6da36ba765d9ff8120c93dd243b9200957eAll 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