ALSA: hda: Apply aligned MMIO access only conditionally
authorTakashi Iwai <tiwai@suse.de>
Mon, 20 Jan 2020 10:41:27 +0000 (11:41 +0100)
committerTakashi Iwai <tiwai@suse.de>
Mon, 20 Jan 2020 10:42:15 +0000 (11:42 +0100)
commit4d024fe8f806e20e577cc934204c5784c7063293
tree9dd9b778a0efa15469e0324b4ebddad7c68c1423
parente5dbdcb31285a975d623d2bf2c9e7b2940489008
ALSA: hda: Apply aligned MMIO access only conditionally

It turned out that the recent simplification of HD-audio bus access
helpers caused a regression on the virtual HD-audio device on QEMU
with ARM platforms.  The driver got a CORB/RIRB timeout and couldn't
probe any codecs.

The essential difference that caused a problem was the enforced
aligned MMIO accesses by simplification.  Since snd-hda-tegra driver
is enabled on ARM, it enables CONFIG_SND_HDA_ALIGNED_MMIO, which makes
the all HD-audio drivers using the aligned MMIO accesses.  While this
is mandatory for snd-hda-tegra, it seems that snd-hda-intel on ARM
gets broken by this access pattern.

For addressing the regression, this patch introduces a new flag,
aligned_mmio, to hdac_bus object, and applies the aligned MMIO only
when this flag is set.  This change affects only platforms with
CONFIG_SND_HDA_ALIGNED_MMIO set, i.e. mostly only for ARM platforms.

Unfortunately the patch became a big bigger than it should be, just
because the former calls didn't take hdac_bus object in the argument,
hence we had to extend the call patterns.

Fixes: 19abfefd4c76 ("ALSA: hda: Direct MMIO accesses")
BugLink: https://bugzilla.opensuse.org/show_bug.cgi?id=1161152
Cc: <stable@vger.kernel.org>
Link: https://lore.kernel.org/r/20200120104127.28985-1-tiwai@suse.de
Signed-off-by: Takashi Iwai <tiwai@suse.de>
include/sound/hdaudio.h
sound/pci/hda/hda_tegra.c