Re: [PATCH v3] ALSA: hda: Notify IEC958 Default PCM switch state changes
From: Takashi Iwai
Date: Fri Apr 03 2026 - 04:15:47 EST
On Fri, 03 Apr 2026 05:21:34 +0200,
Cássio Gabriel wrote:
>
> The "IEC958 Default PCM Playback Switch" control is backed directly by
> mout->share_spdif. The share-switch callbacks currently access that state
> without serialization, and spdif_share_sw_put() always returns 0, so
> normal userspace writes never emit the standard ALSA control value
> notification.
>
> snd_hda_multi_out_analog_open() may also clear mout->share_spdif when the
> analog PCM capabilities and the SPDIF capabilities no longer intersect.
> That fallback is still needed to avoid creating an impossible hw
> constraint set, but it changes the mixer backing value without notifying
> subscribers.
>
> Protect the share-switch callbacks with spdif_mutex like the other SPDIF
> control handlers, return the actual change value from spdif_share_sw_put(),
> and notify the cached control when the open path forcibly disables
> shared SPDIF mode after dropping spdif_mutex.
>
> This keeps the existing auto-disable behavior while making switch state
> changes visible to userspace.
>
> Fixes: 9a08160bdbe3 ("[ALSA] hda-codec - Add "IEC958 Default PCM" switch")
> Fixes: 022b466fc353 ("ALSA: hda - Avoid invalid formats and rates with shared SPDIF")
> Suggested-by: Takashi Iwai <tiwai@xxxxxxx>
> Signed-off-by: Cássio Gabriel <cassiogabrielcontato@xxxxxxxxx>
Applied to for-next branch now. Thanks.
Takashi