The patch
ASoC: topology: Fix logical inversion in set_link_hw_format()
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 7f34c3f38e9666216fda155b6ebededd1073f5aa Mon Sep 17 00:00:00 2001
From: Pan Xiuli xiuli.pan@linux.intel.com Date: Fri, 23 Feb 2018 06:01:28 +0800 Subject: [PATCH] ASoC: topology: Fix logical inversion in set_link_hw_format()
The master/slave conventions are wrt. the codec. The topology code contains a logical inversion, fix to follow ASoC usage.
Signed-off-by: Pan Xiuli xiuli.pan@linux.intel.com Signed-off-by: Mark Brown broonie@kernel.org Cc: stable@vger.kernel.org --- sound/soc/soc-topology.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-)
diff --git a/sound/soc/soc-topology.c b/sound/soc/soc-topology.c index 01a50413c66f..5f507993c43e 100644 --- a/sound/soc/soc-topology.c +++ b/sound/soc/soc-topology.c @@ -1996,11 +1996,11 @@ static void set_link_hw_format(struct snd_soc_dai_link *link, /* clock masters */ bclk_master = hw_config->bclk_master; fsync_master = hw_config->fsync_master; - if (!bclk_master && !fsync_master) + if (bclk_master && fsync_master) link->dai_fmt |= SND_SOC_DAIFMT_CBM_CFM; - else if (bclk_master && !fsync_master) - link->dai_fmt |= SND_SOC_DAIFMT_CBS_CFM; else if (!bclk_master && fsync_master) + link->dai_fmt |= SND_SOC_DAIFMT_CBS_CFM; + else if (bclk_master && !fsync_master) link->dai_fmt |= SND_SOC_DAIFMT_CBM_CFS; else link->dai_fmt |= SND_SOC_DAIFMT_CBS_CFS;
Hello Mark Brown, Pan Xiuli,
As far as I understand, the suggested commit *breaks* the functionality instead of fixing it, and should not be applied. Please correct me if I am wrong.
1. The existing functionality works correctly, nothing to fix here.
Below is a comment from include/sound/soc-dai.h:77
~~~~ /* * DAI hardware clock masters. * * This is wrt the codec, the inverse is true for the interface * i.e. if the codec is clk and FRM master then the interface is * clk and frame slave. */ #define SND_SOC_DAIFMT_CBM_CFM (1 << 12) /* codec clk & FRM master */ #define SND_SOC_DAIFMT_CBS_CFM (2 << 12) /* codec clk slave & FRM master */ #define SND_SOC_DAIFMT_CBM_CFS (3 << 12) /* codec clk master & frame slave */ #define SND_SOC_DAIFMT_CBS_CFS (4 << 12) /* codec clk & FRM slave */ ~~~~
According to the comment, the existing functionality works correctly "WRT the interface". The suggested commit doesn't fix the behaviour: instead, it reverts the logic to "WRT the codec". But the existing implementation is also valid.
2. The suggested commit breaks the existing ASoC.
The existing functionality already works with several existing ASoC by Intel. The suggested commit will break it for the following reason:
The ALSA topology mechanism loads the binary topology file into ASoC. The suggested commit modifies the parser, but the binaries are already created for the existing functionality. As a result, all existing binaries will be parsed incorrectly.
3. The suggested commit should not go into stable.
For the reasons explained earlier, applying the suggested commit into stable kernel will break the stable kernel.
As I am not in the mailing list, I will not be able to stop Greg K-H gregkh@linuxfoundation.org when he will ask "If you, or anyone else, feels it should not be added to the stable tree, please let stable@vger.kernel.org know about it."
@Mark Brown could you please add me to the thread if such situation happens, so that I could share my point for the stable patches.
Best Regards, Kirill
On 2/26/18 10:34 AM, Kirill Marinushkin wrote:
Hello Mark Brown, Pan Xiuli,
As far as I understand, the suggested commit *breaks* the functionality instead of fixing it, and should not be applied. Please correct me if I am wrong.
- The existing functionality works correctly, nothing to fix here.
Below is a comment from include/sound/soc-dai.h:77
/* * DAI hardware clock masters. * * This is wrt the codec, the inverse is true for the interface * i.e. if the codec is clk and FRM master then the interface is * clk and frame slave. */ #define SND_SOC_DAIFMT_CBM_CFM (1 << 12) /* codec clk & FRM master */ #define SND_SOC_DAIFMT_CBS_CFM (2 << 12) /* codec clk slave & FRM master */ #define SND_SOC_DAIFMT_CBM_CFS (3 << 12) /* codec clk master & frame slave */ #define SND_SOC_DAIFMT_CBS_CFS (4 << 12) /* codec clk & FRM slave */
According to the comment, the existing functionality works correctly "WRT the interface". The suggested commit doesn't fix the behaviour: instead, it reverts the logic to "WRT the codec". But the existing implementation is also valid.
Look at all the machine drivers, they always use the mask by looking at the codec side. The comment on top means that the SOC side ('the interface') is the dual of the codec side.
This issue was found during the development of SOF (Sound Open Firmware) where we get the reverse of the intended behavior when using the same conventions in topology files as in machine drivers.
- The suggested commit breaks the existing ASoC.
The existing functionality already works with several existing ASoC by Intel. The suggested commit will break it for the following reason:
The ALSA topology mechanism loads the binary topology file into ASoC. The suggested commit modifies the parser, but the binaries are already created for the existing functionality. As a result, all existing binaries will be parsed incorrectly.
I know there is a similar inversion in the alsa-lib topology files for Broadwell, the codec is marked as master when it really is slave. I don't know how Intel handled this on SKL.
But you have a point that if people used this inversion in the past it'd break functionality on existing devices which retrieve topology information from ACPI tables and binary files.
Gah. Maybe we should keep this inversion then, document it and compensate for it in topology creating tools. Liam, what do you think?
- The suggested commit should not go into stable.
For the reasons explained earlier, applying the suggested commit into stable kernel will break the stable kernel.
As I am not in the mailing list, I will not be able to stop Greg K-H gregkh@linuxfoundation.org when he will ask "If you, or anyone else, feels it should not be added to the stable tree, please let stable@vger.kernel.org know about it."
@Mark Brown could you please add me to the thread if such situation happens, so that I could share my point for the stable patches.
Best Regards, Kirill _______________________________________________ Alsa-devel mailing list Alsa-devel@alsa-project.org http://mailman.alsa-project.org/mailman/listinfo/alsa-devel
On 02/27/18 03:30, Pierre-Louis Bossart wrote:
On 2/26/18 10:34 AM, Kirill Marinushkin wrote:
Hello Mark Brown, Pan Xiuli,
As far as I understand, the suggested commit *breaks* the functionality instead of fixing it, and should not be applied. Please correct me if I am wrong.
- The existing functionality works correctly, nothing to fix here.
Below is a comment from include/sound/soc-dai.h:77
/* * DAI hardware clock masters. * * This is wrt the codec, the inverse is true for the interface * i.e. if the codec is clk and FRM master then the interface is * clk and frame slave. */ #define SND_SOC_DAIFMT_CBM_CFM (1 << 12) /* codec clk & FRM master */ #define SND_SOC_DAIFMT_CBS_CFM (2 << 12) /* codec clk slave & FRM master */ #define SND_SOC_DAIFMT_CBM_CFS (3 << 12) /* codec clk master & frame slave */ #define SND_SOC_DAIFMT_CBS_CFS (4 << 12) /* codec clk & FRM slave */
According to the comment, the existing functionality works correctly "WRT the interface". The suggested commit doesn't fix the behaviour: instead, it reverts the logic to "WRT the codec". But the existing implementation is also valid.
Look at all the machine drivers, they always use the mask by looking at the codec side. The comment on top means that the SOC side ('the interface') is the dual of the codec side.
Yes, you are right. Analyzing from the codec side makes more sense.
This issue was found during the development of SOF (Sound Open Firmware) where we get the reverse of the intended behavior when using the same conventions in topology files as in machine drivers.
- The suggested commit breaks the existing ASoC.
The existing functionality already works with several existing ASoC by Intel. The suggested commit will break it for the following reason:
The ALSA topology mechanism loads the binary topology file into ASoC. The suggested commit modifies the parser, but the binaries are already created for the existing functionality. As a result, all existing binaries will be parsed incorrectly.
I know there is a similar inversion in the alsa-lib topology files for Broadwell, the codec is marked as master when it really is slave. I don't know how Intel handled this on SKL.
But you have a point that if people used this inversion in the past it'd break functionality on existing devices which retrieve topology information from ACPI tables and binary files.
Yes. The Broadwell conf files, which you mentioned, demonstrate that this functionality is already used as it is.
Gah. Maybe we should keep this inversion then, document it and compensate for it in topology creating tools. Liam, what do you think?
- The suggested commit should not go into stable.
For the reasons explained earlier, applying the suggested commit into stable kernel will break the stable kernel.
As I am not in the mailing list, I will not be able to stop Greg K-H gregkh@linuxfoundation.org when he will ask "If you, or anyone else, feels it should not be added to the stable tree, please let stable@vger.kernel.org know about it."
@Mark Brown could you please add me to the thread if such situation happens, so that I could share my point for the stable patches.
Best Regards, Kirill _______________________________________________ Alsa-devel mailing list Alsa-devel@alsa-project.org http://mailman.alsa-project.org/mailman/listinfo/alsa-devel
linux-stable-mirror@lists.linaro.org