Skip to content

Commit 43bcb1c

Browse files
kv2019ibroonie
authored andcommitted
ALSA: hda: do not override bus codec_mask in link_get()
snd_hdac_ext_bus_link_get() does not work correctly in case there are multiple codecs on the bus. It unconditionally resets the bus->codec_mask value. As per documentation in hdaudio.h and existing use in client code, this field should be used to store bit flag of detected codecs on the bus. By overwriting value of the codec_mask, information on all detected codecs is lost. No current user of hdac is impacted, but use of bus->codec_mask is planned in future patches for SOF. Signed-off-by: Kai Vehmanen <[email protected]> Reviewed-by: Ranjani Sridharan <[email protected]> Reviewed-by: Pierre-Louis Bossart <[email protected]> Reviewed-by: Takashi Iwai <[email protected]> Link: https://lore.kernel.org/r/[email protected] Signed-off-by: Mark Brown <[email protected]>
1 parent 9437bfd commit 43bcb1c

File tree

1 file changed

+6
-3
lines changed

1 file changed

+6
-3
lines changed

sound/hda/ext/hdac_ext_controller.c

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -254,6 +254,7 @@ EXPORT_SYMBOL_GPL(snd_hdac_ext_bus_link_power_down_all);
254254
int snd_hdac_ext_bus_link_get(struct hdac_bus *bus,
255255
struct hdac_ext_link *link)
256256
{
257+
unsigned long codec_mask;
257258
int ret = 0;
258259

259260
mutex_lock(&bus->lock);
@@ -280,9 +281,11 @@ int snd_hdac_ext_bus_link_get(struct hdac_bus *bus,
280281
* HDA spec section 4.3 - Codec Discovery
281282
*/
282283
udelay(521);
283-
bus->codec_mask = snd_hdac_chip_readw(bus, STATESTS);
284-
dev_dbg(bus->dev, "codec_mask = 0x%lx\n", bus->codec_mask);
285-
snd_hdac_chip_writew(bus, STATESTS, bus->codec_mask);
284+
codec_mask = snd_hdac_chip_readw(bus, STATESTS);
285+
dev_dbg(bus->dev, "codec_mask = 0x%lx\n", codec_mask);
286+
snd_hdac_chip_writew(bus, STATESTS, codec_mask);
287+
if (!bus->codec_mask)
288+
bus->codec_mask = codec_mask;
286289
}
287290

288291
mutex_unlock(&bus->lock);

0 commit comments

Comments
 (0)