Skip to content

Commit 7cc3b56

Browse files
RanderWangbroonie
authored andcommitted
ASOC: Intel: sof_sdw: restore playback functionality with max98373 amps
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: ae3a391 ('ASoC: Intel: sof_sdw: add dailink .trigger callback') Fixes: 06998d4 ('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> Reviewed-by: Guennadi Liakhovetski <guennadi.liakhovetski@linux.intel.com> Reviewed-by: Ranjani Sridharan <ranjani.sridharan@linux.intel.com> Reviewed-by: Keyon Jie <yang.jie@linux.intel.com> Signed-off-by: Kai Vehmanen <kai.vehmanen@linux.intel.com> Link: https://lore.kernel.org/r/20200923080514.3242858-2-kai.vehmanen@linux.intel.com Signed-off-by: Mark Brown <broonie@kernel.org>
1 parent e787f5b commit 7cc3b56

3 files changed

Lines changed: 41 additions & 4 deletions

File tree

‎sound/soc/intel/boards/sof_sdw.c‎

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -165,7 +165,7 @@ int sdw_startup(struct snd_pcm_substream *substream)
165165
return sdw_startup_stream(substream);
166166
}
167167

168-
static int sdw_prepare(struct snd_pcm_substream *substream)
168+
int sdw_prepare(struct snd_pcm_substream *substream)
169169
{
170170
struct snd_soc_pcm_runtime *rtd = asoc_substream_to_rtd(substream);
171171
struct sdw_stream_runtime *sdw_stream;
@@ -184,7 +184,7 @@ static int sdw_prepare(struct snd_pcm_substream *substream)
184184
return sdw_prepare_stream(sdw_stream);
185185
}
186186

187-
static int sdw_trigger(struct snd_pcm_substream *substream, int cmd)
187+
int sdw_trigger(struct snd_pcm_substream *substream, int cmd)
188188
{
189189
struct snd_soc_pcm_runtime *rtd = asoc_substream_to_rtd(substream);
190190
struct sdw_stream_runtime *sdw_stream;
@@ -224,7 +224,7 @@ static int sdw_trigger(struct snd_pcm_substream *substream, int cmd)
224224
return ret;
225225
}
226226

227-
static int sdw_hw_free(struct snd_pcm_substream *substream)
227+
int sdw_hw_free(struct snd_pcm_substream *substream)
228228
{
229229
struct snd_soc_pcm_runtime *rtd = asoc_substream_to_rtd(substream);
230230
struct sdw_stream_runtime *sdw_stream;

‎sound/soc/intel/boards/sof_sdw_common.h‎

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -79,6 +79,9 @@ struct mc_private {
7979
extern unsigned long sof_sdw_quirk;
8080

8181
int sdw_startup(struct snd_pcm_substream *substream);
82+
int sdw_prepare(struct snd_pcm_substream *substream);
83+
int sdw_trigger(struct snd_pcm_substream *substream, int cmd);
84+
int sdw_hw_free(struct snd_pcm_substream *substream);
8285
void sdw_shutdown(struct snd_pcm_substream *substream);
8386

8487
/* generic HDMI support */

‎sound/soc/intel/boards/sof_sdw_max98373.c‎

Lines changed: 35 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -55,9 +55,43 @@ static int spk_init(struct snd_soc_pcm_runtime *rtd)
5555
return ret;
5656
}
5757

58+
static int max98373_sdw_trigger(struct snd_pcm_substream *substream, int cmd)
59+
{
60+
int ret;
61+
62+
switch (cmd) {
63+
case SNDRV_PCM_TRIGGER_START:
64+
case SNDRV_PCM_TRIGGER_RESUME:
65+
case SNDRV_PCM_TRIGGER_PAUSE_RELEASE:
66+
/* enable max98373 first */
67+
ret = max98373_trigger(substream, cmd);
68+
if (ret < 0)
69+
break;
70+
71+
ret = sdw_trigger(substream, cmd);
72+
break;
73+
case SNDRV_PCM_TRIGGER_STOP:
74+
case SNDRV_PCM_TRIGGER_SUSPEND:
75+
case SNDRV_PCM_TRIGGER_PAUSE_PUSH:
76+
ret = sdw_trigger(substream, cmd);
77+
if (ret < 0)
78+
break;
79+
80+
ret = max98373_trigger(substream, cmd);
81+
break;
82+
default:
83+
ret = -EINVAL;
84+
break;
85+
}
86+
87+
return ret;
88+
}
89+
5890
static const struct snd_soc_ops max_98373_sdw_ops = {
5991
.startup = sdw_startup,
60-
.trigger = max98373_trigger,
92+
.prepare = sdw_prepare,
93+
.trigger = max98373_sdw_trigger,
94+
.hw_free = sdw_hw_free,
6195
.shutdown = sdw_shutdown,
6296
};
6397

0 commit comments

Comments
 (0)