[alsa-devel] [PATCH v2 05/13] ALSA: hda: check stream decoupled register state
Jeeja KP
jeeja.kp at intel.com
Thu Dec 8 07:31:12 CET 2016
On Wed, Dec 07, 2016 at 02:41:59PM +0100, Takashi Iwai wrote:
> On Wed, 07 Dec 2016 14:44:27 +0100,
> jeeja.kp at intel.com wrote:
> >
> > From: Jeeja KP <jeeja.kp at intel.com>
> >
> > Check stream decoupled register value with requested value
> > before decoupling/coupling the stream.
> >
> > Signed-off-by: Jeeja KP <jeeja.kp at intel.com>
> > ---
> > sound/hda/ext/hdac_ext_stream.c | 15 +++++++++------
> > 1 file changed, 9 insertions(+), 6 deletions(-)
> >
> > diff --git a/sound/hda/ext/hdac_ext_stream.c b/sound/hda/ext/hdac_ext_stream.c
> > index 3be051a..f35b006 100644
> > --- a/sound/hda/ext/hdac_ext_stream.c
> > +++ b/sound/hda/ext/hdac_ext_stream.c
> > @@ -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) >> mask);
>
> This looks wrong.
> And you just need to know whether it's zero or not in below, so the
> shift is anyway superfluous.
Yes, shift is superfluous here. I will fix this.
>
>
> Takashi
>
>
> > + if (decouple && (val == 0))
> > + snd_hdac_updatel(bus->ppcap, AZX_REG_PP_PPCTL, mask, mask);
> > + else if (!decouple && (val > 0))
> > + snd_hdac_updatel(bus->ppcap, AZX_REG_PP_PPCTL, mask, 0);
> > +
> > stream->decoupled = decouple;
> > spin_unlock_irq(&bus->reg_lock);
> > }
> > --
> > 2.5.0
> >
--
More information about the Alsa-devel
mailing list