]> git.karo-electronics.de Git - karo-tx-linux.git/commitdiff
ALSA: hda: check stream decoupled register state
authorJeeja KP <jeeja.kp@intel.com>
Mon, 2 Jan 2017 07:14:28 +0000 (12:44 +0530)
committerMark Brown <broonie@kernel.org>
Fri, 6 Jan 2017 18:16:10 +0000 (18:16 +0000)
Check stream decoupled register value with requested value
before decoupling/coupling the stream.

Signed-off-by: Jeeja KP <jeeja.kp@intel.com>
Acked-by: Takashi Iwai <tiwai@suse.de>
Signed-off-by: Mark Brown <broonie@kernel.org>
sound/hda/ext/hdac_ext_stream.c

index 3be051ab55335746d57d46aa1445fb42f5eafce2..c96d7a7a36af033b0c8241e20538e7722828bc0e 100644 (file)
@@ -128,14 +128,17 @@ void snd_hdac_ext_stream_decouple(struct hdac_ext_bus *ebus,
 {
        struct hdac_stream *hstream = &stream->hstream;
        struct hdac_bus *bus = &ebus->bus;
+       u32 val;
+       int mask = AZX_PPCTL_PROCEN(hstream->index);
 
        spin_lock_irq(&bus->reg_lock);
-       if (decouple)
-               snd_hdac_updatel(bus->ppcap, AZX_REG_PP_PPCTL, 0,
-                               AZX_PPCTL_PROCEN(hstream->index));
-       else
-               snd_hdac_updatel(bus->ppcap, AZX_REG_PP_PPCTL,
-                                       AZX_PPCTL_PROCEN(hstream->index), 0);
+       val = readw(bus->ppcap + AZX_REG_PP_PPCTL) & mask;
+
+       if (decouple && !val)
+               snd_hdac_updatel(bus->ppcap, AZX_REG_PP_PPCTL, mask, mask);
+       else if (!decouple && val)
+               snd_hdac_updatel(bus->ppcap, AZX_REG_PP_PPCTL, mask, 0);
+
        stream->decoupled = decouple;
        spin_unlock_irq(&bus->reg_lock);
 }