Uh oh!
There was an error while loading. Please reload this page.
ASOC: Intel: sof_sdw: restore playback functionality with max98373 amps - #2424
Conversation
RanderWang
commented
Sep 9, 2020
I checked the PR on TGL RVP but missed volteer. I found this issue in weekly validation later. |
0c3da4d to
6a447bdCompareUh oh!
There was an error while loading. Please reload this page.
plbossart
left a comment
There was a problem hiding this comment.
Sorry, I don't understand why we would use dailink functions for a codec specifically.
Something is not right here.
Uh oh!
There was an error while loading. Please reload this page.
| .trigger = max98373_trigger, | ||
| .prepare = sdw_prepare, | ||
| .trigger = sdw_trigger, | ||
| .hw_free = sdw_hw_free, |
There was a problem hiding this comment.
why is this here? This makes no sense to me.
plbossart
commented
Sep 9, 2020
Build fail as well |
ranj063
commented
Sep 9, 2020
@RanderWang what playback issue does this fix? Can you please tag the issue here if one is filed? |
plbossart
commented
Sep 10, 2020
I would really recommend checking why we use sdw_startup and sdw_shutdown in the existing code. diff --git a/sound/soc/intel/boards/sof_sdw.c b/sound/soc/intel/boards/sof_sdw.c
index 210b66d1f9a2..9aeb34ef83c8 100644
--- a/sound/soc/intel/boards/sof_sdw.c+++ b/sound/soc/intel/boards/sof_sdw.c@@ -220,7 +220,7 @@ static struct snd_soc_dai_link_component platform_component[] = {
};
/* these wrappers are only needed to avoid typecast compilation errors */
-int sdw_startup(struct snd_pcm_substream *substream)+static int sdw_startup(struct snd_pcm_substream *substream)
{
return sdw_startup_stream(substream);
}
@@ -303,7 +303,7 @@ static int sdw_hw_free(struct snd_pcm_substream *substream)
return sdw_deprepare_stream(sdw_stream);
}
-void sdw_shutdown(struct snd_pcm_substream *substream)+static void sdw_shutdown(struct snd_pcm_substream *substream)
{
sdw_shutdown_stream(substream);
}
diff --git a/sound/soc/intel/boards/sof_sdw_common.h b/sound/soc/intel/boards/sof_sdw_common.h
index 6a5d46589baf..911bce2b8336 100644
--- a/sound/soc/intel/boards/sof_sdw_common.h+++ b/sound/soc/intel/boards/sof_sdw_common.h@@ -78,9 +78,6 @@ struct mc_private {
extern unsigned long sof_sdw_quirk;
-int sdw_startup(struct snd_pcm_substream *substream);-void sdw_shutdown(struct snd_pcm_substream *substream);-
/* generic HDMI support */
int sof_sdw_hdmi_init(struct snd_soc_pcm_runtime *rtd);
diff --git a/sound/soc/intel/boards/sof_sdw_max98373.c b/sound/soc/intel/boards/sof_sdw_max98373.c
index 905582aaf58c..0afe99cf3f2f 100644
--- a/sound/soc/intel/boards/sof_sdw_max98373.c+++ b/sound/soc/intel/boards/sof_sdw_max98373.c@@ -56,9 +56,7 @@ static int spk_init(struct snd_soc_pcm_runtime *rtd)
}
static const struct snd_soc_ops max_98373_sdw_ops = {
- .startup = sdw_startup,
.trigger = max98373_trigger,
- .shutdown = sdw_shutdown,
};
int sof_sdw_mx8373_init(const struct snd_soc_acpi_link_adr *link, |
RanderWang
commented
Sep 10, 2020
I didn't create a issue. playback can't work on 98373 since the sdw master is never triggered |
RanderWang
commented
Sep 10, 2020
@plbossart dai link ops sdw_ops is set at https://github.com/thesofproject/linux/blob/topic/sof-dev/sound/soc/intel/boards/sof_sdw.c#L810, but in following code https://github.com/thesofproject/linux/blob/topic/sof-dev/sound/soc/intel/boards/sof_sdw.c#L812 --> sof_sdw_mx8373_init will override it with its own ops at https://github.com/thesofproject/linux/blob/topic/sof-dev/sound/soc/intel/boards/sof_sdw_max98373.c#L75. Since sdw_ops is const and the dai->ops is also const, we can't change it dynamically such as changing trigger function only, so I create another dai ops for 98373 |
6a447bd to
31e8d06Compare31e8d06 to
dcd2589CompareRanderWang
commented
Sep 10, 2020
update my PR, thanks for review! |
plbossart
commented
Sep 10, 2020
@RanderWang I still don't get why the dailink ops is overridden. Why was this done in the first place? it seems that was a miss in the initial reviews and it's quite ugly architecturally. Blurring concepts like this is not quite right. |
RanderWang
commented
Sep 11, 2020
First let`s check a6c4e1a. It fixed issue "[TGL] runtime PM always in active on TGL chromebook/I2S mode " (#2053) Then we also have a the same bug on SDW mode #2162. So I ported this commit to sdw platform with #2201 |
RanderWang
commented
Sep 11, 2020
Maybe I misuse "override" on max98373. Before we moved some sdw ops from sdw component driver to machine driver, we didn't set trigger function in our dai link ops. Max98373 used trigger function to enable | disable spk switch pin in dai link ops. This is a corner case. Now we move trigger function to dai link ops so we need to merge two trigger function into to one. I called it "override". |
RanderWang
commented
Sep 11, 2020
@plbossart@bardliao I also have another solution: move the trigger function of max98373 to codec driver to enable | disable spk switch. what is your idea ? |
bardliao
commented
Sep 11, 2020
I am not sure if it is a common issue on max98373 codec. I think it will be no issue if "VI Sense Switch" and "SpkFB Sense Switch" controls are off. |
plbossart
commented
Sep 11, 2020
I don't think this belongs in the codec driver, this is needed because of the smart amp processing only, no? |
plbossart
commented
Sep 11, 2020
I don't see why we need to merge. The ASoC core will call the dailink .trigger and then the dai .trigger staticintsoc_pcm_trigger(structsnd_pcm_substream*substream, intcmd)
{
intret=-EINVAL;
switch (cmd) {
caseSNDRV_PCM_TRIGGER_START:
caseSNDRV_PCM_TRIGGER_RESUME:
caseSNDRV_PCM_TRIGGER_PAUSE_RELEASE:
ret=snd_soc_link_trigger(substream, cmd);
if (ret<0)
break;
ret=snd_soc_pcm_component_trigger(substream, cmd);
if (ret<0)
break;
ret=snd_soc_pcm_dai_trigger(substream, cmd);
break;
caseSNDRV_PCM_TRIGGER_STOP:
caseSNDRV_PCM_TRIGGER_SUSPEND:
caseSNDRV_PCM_TRIGGER_PAUSE_PUSH:
ret=snd_soc_pcm_dai_trigger(substream, cmd);
if (ret<0)
break;
ret=snd_soc_pcm_component_trigger(substream, cmd);
if (ret<0)
break;
ret=snd_soc_link_trigger(substream, cmd);
break;
}
returnret;
}I don't see why we are doing in the machine driver what the ASoC core does already? |
| cpus + *cpu_id, cpu_dai_num, | ||
| codecs, codec_num, | ||
| NULL, &sdw_ops); | ||
| NULL, codec_info_list[codec_index].ops); |
There was a problem hiding this comment.
@RanderWang this change is really hard to follow. Can youplease explain this in the commit message? I cant quite understand what this does
There was a problem hiding this comment.
thanks, I will update it when we get a conclusion
bardliao
commented
Sep 14, 2020
@plbossart Currently, max98373_trigger is a dailink trigger, and we overwrite dailink ops in sof_sdw_mx8373_init(). |
plbossart
commented
Sep 14, 2020
But WHY? the dailink operations should only be about the stream handling. Why do we conflate the dailink and dai operations? |
plbossart
commented
Sep 15, 2020
After reading through the comments, I think I get what @RanderWang was trying to do, but I don't think any of the suggested patches ever worked. @RanderWang can you look at the attached patch and let me know if this is what you were trying to do. If yes, please push it. If not, please explain further what the issue is. 0001-ASOC-Intel-sof_sdw-restore-playback-functionality-wi.patch.txt |
The Max98373 amplifier provides I/V feedback information, which keeps a DAPM path active even when there is no playback happening. This prevents entry in low-power mode. Rather than adding new controls and require UCM/user interaction, the method previously applied is to enable/disable the Speaker pin during the dailink trigger operations. Recent changes in the SoundWire stream management moved the stream trigger to the dailink trigger. This change removed the Maxim-specific pin handling and resulted in a regression. This patch restores functionality by combining the SoundWire stream trigger with the pin enable/disable. Fixes: 7eec07f ('ASOC: Intel: sof_sdw: add dailink .trigger callback') Fixes: 5595f95 ('ASOC: Intel: sof_sdw: add dailink .prepare and .hw_free callback'). Signed-off-by: Rander Wang <rander.wang@intel.com> Signed-off-by: Pierre-Louis Bossart <pierre-louis.bossart@linux.intel.com>
dcd2589 to
ebedda4CompareRanderWang
commented
Sep 16, 2020
Thanks! It works on my volteer. |
RanderWang
commented
Sep 16, 2020
update my PR, thanks! |
The Max98373 amplifier provides I/V feedback information, which keeps
a DAPM path active even when there is no playback happening. This
prevents entry in low-power mode. Rather than adding new controls and
require UCM/user interaction, the method previously applied is to
enable/disable the Speaker pin during the dailink trigger operations.