Skip to content

ASoC: hdac_hda: Fix module unbind/bind via sysfs

Peter Ujfalusi linux-sound stable 2 versions In review

Get series with b4
b4 am [email protected]

Versions newest first · linked by author and title

  1. v2 Latest3 patches 3 repliesIn review
  2. v13 patches 2 repliesSuperseded

Changes in v2 from the cover letter

- Add pm_runtime_set_active() after snd_hda_codec_device_new() in hdac_hda_codec_probe() function as reported and suggested by Sashiko Bot.

Patches in v2 No applies recorded yet

#Subject and filesSizeRepliesApplied
1/3ASoC: hdac_hda: Allocate the private data at codec driver bindsound/soc/codecs/hdac_hda.c sound/soc/sof/intel/hda-codec.c+16 -200 replies
2/3ASoC: hdac_hda: Restore the codec device type on unbindsound/soc/codecs/hdac_hda.c+12 -00 replies
3/3ASoC: hdac_hda: Fix codec runtime PM across remove and probesound/soc/codecs/hdac_hda.c+11 -00 replies

Reviews trailers per patch

No Reviewed-by, Acked-by or Tested-by trailers for v2 yet.

Read the v2 thread

Cover letter [PATCH v2 0/3] ASoC: hdac_hda: Fix module unbind/bind via sysfs

Hi,

Changes since v1:
- Add pm_runtime_set_active() after snd_hda_codec_device_new() in hdac_hda_codec_probe() function as reported and suggested by Sashiko Bot.

Expanded test plan run on the device to cover the previously missed scenario.

While looking at the reconfig lockup reported in
https://bugzilla.kernel.org/show_bug.cgi?id=222182
I checked whether the same can be done by unbinding and binding the HDA codec driver via sysfs:

echo -n ehdaudio0D0 > /sys/bus/hdaudio/drivers/snd_hda_codec_alc882/unbind echo -n ehdaudio0D0 > /sys/bus/hdaudio/drivers/snd_hda_codec_alc882/bind

The unbind works and the SOF card is removed, but the codec cannot be bound again. This has been broken for a long time with hdac_hda; the reconfig lockup itself is addressed by a separate patch.

Patch 1 and 2 fix the bind: the codec private data was lost on unbind and the codec device type was left as HDA_DEV_ASOC, so no HDA codec driver could match it anymore. Patch 2 depends on patch 1, otherwise the bind would dereference NULL drvdata instead of failing.

Patch 3 fixes an unbalanced runtime PM disable in the component remove, which leaves the codec with runtime PM disabled after the card is re-created. This is also visible with machine driver unbind/bind.

Tested on PTL (ALC888 + iDisp): repeated codec and machine driver unbind/bind, playback/capture, runtime suspend and module reload.

Regards,
Peter
---
Peter Ujfalusi (3):
ASoC: hdac_hda: Allocate the private data at codec driver bind
ASoC: hdac_hda: Restore the codec device type on unbind
ASoC: hdac_hda: Fix codec runtime PM across remove and probe

 sound/soc/codecs/hdac_hda.c     | 36 ++++++++++++++++++++++++++++++++-
 sound/soc/sof/intel/hda-codec.c | 23 ++++-----------------
 2 files changed, 39 insertions(+), 20 deletions(-)
Signature · 1 line
2.56.0