Skip to content

Commit f237c1d

Browse files
RanderWangkv2019i
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: 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>
1 parent 0771737 commit f237c1d

File tree

3 files changed

+38
-4
lines changed

3 files changed

+38
-4
lines changed

sound/soc/intel/boards/sof_sdw.c

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -225,7 +225,7 @@ int sdw_startup(struct snd_pcm_substream *substream)
225225
return sdw_startup_stream(substream);
226226
}
227227

228-
static int sdw_prepare(struct snd_pcm_substream *substream)
228+
int sdw_prepare(struct snd_pcm_substream *substream)
229229
{
230230
struct snd_soc_pcm_runtime *rtd = asoc_substream_to_rtd(substream);
231231
struct sdw_stream_runtime *sdw_stream;
@@ -244,7 +244,7 @@ static int sdw_prepare(struct snd_pcm_substream *substream)
244244
return sdw_prepare_stream(sdw_stream);
245245
}
246246

247-
static int sdw_trigger(struct snd_pcm_substream *substream, int cmd)
247+
int sdw_trigger(struct snd_pcm_substream *substream, int cmd)
248248
{
249249
struct snd_soc_pcm_runtime *rtd = asoc_substream_to_rtd(substream);
250250
struct sdw_stream_runtime *sdw_stream;
@@ -284,7 +284,7 @@ static int sdw_trigger(struct snd_pcm_substream *substream, int cmd)
284284
return ret;
285285
}
286286

287-
static int sdw_hw_free(struct snd_pcm_substream *substream)
287+
int sdw_hw_free(struct snd_pcm_substream *substream)
288288
{
289289
struct snd_soc_pcm_runtime *rtd = asoc_substream_to_rtd(substream);
290290
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: 32 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -55,9 +55,40 @@ 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+
}
83+
84+
return ret;
85+
}
86+
5887
static const struct snd_soc_ops max_98373_sdw_ops = {
5988
.startup = sdw_startup,
60-
.trigger = max98373_trigger,
89+
.prepare = sdw_prepare,
90+
.trigger = max98373_sdw_trigger,
91+
.hw_free = sdw_hw_free,
6192
.shutdown = sdw_shutdown,
6293
};
6394

0 commit comments

Comments
 (0)