All of lore.kernel.org
 help / color / mirror / Atom feed
* [alsa-devel] [PATCH 1/3] ALSA: hda: do not override bus codec_mask in link_get()
@ 2020-02-06 20:02 Kai Vehmanen
  2020-02-06 20:02 ` [alsa-devel] [PATCH 2/3] ASoC: SOF: Intel: hda: fix ordering bug in resume flow Kai Vehmanen
                   ` (3 more replies)
  0 siblings, 4 replies; 9+ messages in thread
From: Kai Vehmanen @ 2020-02-06 20:02 UTC (permalink / raw)
  To: alsa-devel, broonie
  Cc: tiwai, pierre-louis.bossart, Kai Vehmanen, ranjani.sridharan

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 <kai.vehmanen@linux.intel.com>
Reviewed-by: Ranjani Sridharan <ranjani.sridharan@linux.intel.com>
Reviewed-by: Pierre-Louis Bossart <pierre-louis.bossart@linux.intel.com>
---
 sound/hda/ext/hdac_ext_controller.c | 9 ++++++---
 1 file changed, 6 insertions(+), 3 deletions(-)

diff --git a/sound/hda/ext/hdac_ext_controller.c b/sound/hda/ext/hdac_ext_controller.c
index cfab60d88c92..09ff209df4a3 100644
--- a/sound/hda/ext/hdac_ext_controller.c
+++ b/sound/hda/ext/hdac_ext_controller.c
@@ -254,6 +254,7 @@ EXPORT_SYMBOL_GPL(snd_hdac_ext_bus_link_power_down_all);
 int snd_hdac_ext_bus_link_get(struct hdac_bus *bus,
 				struct hdac_ext_link *link)
 {
+	unsigned long codec_mask;
 	int ret = 0;
 
 	mutex_lock(&bus->lock);
@@ -280,9 +281,11 @@ int snd_hdac_ext_bus_link_get(struct hdac_bus *bus,
 		 *  HDA spec section 4.3 - Codec Discovery
 		 */
 		udelay(521);
-		bus->codec_mask = snd_hdac_chip_readw(bus, STATESTS);
-		dev_dbg(bus->dev, "codec_mask = 0x%lx\n", bus->codec_mask);
-		snd_hdac_chip_writew(bus, STATESTS, bus->codec_mask);
+		codec_mask = snd_hdac_chip_readw(bus, STATESTS);
+		dev_dbg(bus->dev, "codec_mask = 0x%lx\n", codec_mask);
+		snd_hdac_chip_writew(bus, STATESTS, codec_mask);
+		if (!bus->codec_mask)
+			bus->codec_mask = codec_mask;
 	}
 
 	mutex_unlock(&bus->lock);
-- 
2.17.1

_______________________________________________
Alsa-devel mailing list
Alsa-devel@alsa-project.org
https://mailman.alsa-project.org/mailman/listinfo/alsa-devel

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

end of thread, other threads:[~2020-02-10 14:17 UTC | newest]

Thread overview: 9+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2020-02-06 20:02 [alsa-devel] [PATCH 1/3] ALSA: hda: do not override bus codec_mask in link_get() Kai Vehmanen
2020-02-06 20:02 ` [alsa-devel] [PATCH 2/3] ASoC: SOF: Intel: hda: fix ordering bug in resume flow Kai Vehmanen
2020-02-07  8:21   ` Takashi Iwai
2020-02-10 14:07   ` [alsa-devel] Applied "ASoC: SOF: Intel: hda: fix ordering bug in resume flow" to the asoc tree Mark Brown
2020-02-06 20:02 ` [alsa-devel] [PATCH 3/3] ASoC: SOF: Intel: hda: move i915 init earlier Kai Vehmanen
2020-02-07  8:21   ` Takashi Iwai
2020-02-10 14:07   ` [alsa-devel] Applied "ASoC: SOF: Intel: hda: move i915 init earlier" to the asoc tree Mark Brown
2020-02-07  8:21 ` [alsa-devel] [PATCH 1/3] ALSA: hda: do not override bus codec_mask in link_get() Takashi Iwai
2020-02-10 14:07 ` [alsa-devel] Applied "ALSA: hda: do not override bus codec_mask in link_get()" to the asoc tree Mark Brown

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.