All of lore.kernel.org
 help / color / mirror / Atom feed
* [BUG] ASoC: Intel: sof_es8336: speaker amp GPIO stays off after stream stop/restart (no sound until "Speaker Switch" is toggled)
@ 2026-10-04 17:12 David Márquez
  2026-10-05 11:22 ` Pierre-Louis Bossart
  0 siblings, 1 reply; 6+ messages in thread
From: David Márquez @ 2026-10-04 17:12 UTC (permalink / raw)
  To: linux-sound
  Cc: sound-open-firmware, broonie, kai.vehmanen, pierre-louis.bossart

Hello,

Resending this report in plain text: my first attempt was rejected by
vger because it contained an HTML part. Sorry for any duplicate.

I am a user of an Adreamer Leobook 13 laptop (Intel Gemini Lake, ES8336
codec on SSP2, board name PN1308P) running Linux Mint 22 with the Ubuntu
kernel 6.8.0-139-generic (based on v6.8), SOF firmware sof-glk.ri 2.2.0,
topology sof-glk-es8336-ssp2.tplg, PipeWire 1.0.5, WirePlumber 0.4.17.

Problem
-------
The speaker randomly goes silent, typically when a browser stops and
restarts playback (for example YouTube ad transitions). While it is
silent the PCM is RUNNING and hw_ptr advances at 48 kHz, PipeWire reports
no errors, the ALSA mixer is unchanged and nothing is logged in dmesg.
Toggling "Speaker Switch" off and on restores the sound without closing
the PCM. Before I worked around it, this happened 15 times in about 10
hours of use on one day.

Evidence
--------
I captured the full DAPM debugfs tree, the ES8336 regmap registers and
/sys/kernel/debug/gpio in the broken and in the working state. Everything
is identical (including "Speaker Power: On" and "Speaker: On") except the
speaker enable GPIO:

  broken:   gpio-541 (speakers-enable) out lo ACTIVE LOW
  working:  gpio-541 (speakers-enable) out hi ACTIVE LOW

Setting pmdown_time to 0 on the codec and BE links did not prevent it.

Analysis
--------
In sound/soc/intel/boards/sof_es8336.c, sof_8336_trigger() drives the
speaker GPIO to the "off" level on PAUSE_PUSH, SUSPEND and STOP without
updating priv->speaker_en, while START, PAUSE_RELEASE and RESUME do
nothing. The GPIO is only restored by sof_es8316_speaker_power_event()
when DAPM actually powers the "Speaker Power" supply down and up again.
If the stream is stopped and started again without that full power
cycle, nothing re-enables the amplifier: the GPIO stays off while DAPM
still considers the speaker on. I have not determined which exact path
triggers it on my machine (pause/resume, xrun recovery, or a restart
within pmdown_time).

Proposed change (sketch, not a formal patch)
--------------------------------------------
Re-enable the amplifier on resume when the driver believes it is on:

case SNDRV_PCM_TRIGGER_START:
case SNDRV_PCM_TRIGGER_PAUSE_RELEASE:
case SNDRV_PCM_TRIGGER_RESUME:
+ if (substream->stream == 0 && priv->speaker_en == false)
+ schedule_delayed_work(&priv->pcm_pop_work,
+      msecs_to_jiffies(70));
break;

Result
------
I tested this change (with an extra dev_info message to count the
occurrences) on 6.8.0-139, built out-of-tree as a replacement for the
module. In about 42 hours of YouTube and Netflix use it caught and fixed
the condition 6 times, with no audible dropouts and no interventions
from a userspace watchdog that I kept running as a safety net. Before
loading the patched module, the same watchdog had to intervene 15 times
in about 10 hours on one day.

From reading a recent mainline tree, sof_8336_trigger() looks unchanged
there, but I have not tested mainline. I am happy to test other
proposals, to provide the full debugfs dumps, or to turn this into a
formal patch if the approach looks acceptable.

Thank you,
David Marquez Fernandez

^ permalink raw reply	[flat|nested] 6+ messages in thread

end of thread, other threads:[~2026-10-07  5:37 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2026-10-04 17:12 [BUG] ASoC: Intel: sof_es8336: speaker amp GPIO stays off after stream stop/restart (no sound until "Speaker Switch" is toggled) David Márquez
2026-10-05 11:22 ` Pierre-Louis Bossart
2026-10-05 12:17   ` Mark Brown
2026-10-05 21:30     ` David Márquez
2026-10-06 21:27       ` David Márquez
2026-10-07  5:37         ` David Márquez

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.