alsa-devel.alsa-project.org archive mirror
 help / color / mirror / Atom feed
From: Jeeja KP <jeeja.kp@intel.com>
To: Takashi Iwai <tiwai@suse.de>
Cc: patches.audio@intel.com, alsa-devel@alsa-project.org,
	broonie@kernel.org, liam.r.girdwood@intel.com
Subject: Re: [PATCH 04/12] ALSA: hda: check stream decoupled register state
Date: Mon, 5 Dec 2016 12:22:42 +0530	[thread overview]
Message-ID: <20161205065241.GA8021@kpjeeja-desk> (raw)
In-Reply-To: <s5hoa0u17d5.wl-tiwai@suse.de>

On Fri, Dec 02, 2016 at 08:03:18PM +0100, Takashi Iwai wrote:
> On Fri, 02 Dec 2016 18:41:41 +0100,
> jeeja.kp@intel.com wrote:
> > 
> > From: Jeeja KP <jeeja.kp@intel.com>
> > 
> > Check stream decoupled register value with requested value
> > before decoupling/coupling the stream.
> > 
> > Signed-off-by: Jeeja KP <jeeja.kp@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..bd8187b 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);
> > +
> > +	if (decouple && (val == 0))
> > +		snd_hdac_updatel(bus->ppcap, AZX_REG_PP_PPCTL, 0, mask);
> > +	else if (!decouple && (val > 0))
> > +		snd_hdac_updatel(bus->ppcap, AZX_REG_PP_PPCTL, mask, 0);
> > +
> 
> The usage of snd_hdac_updatel() looks strange.
> The third argument must be the mask bits and the fourth be the value
> bits.  So, usually for clearing a bit
> 
> 	snd_hdac_update(pcap, REG, mask, 0);
> 
> and for setting a bit
> 
> 	snd_hdac_update(pcap, REG, mask, mask);
> 
> Passing 0 to the mask bits means to replace the whole bits.
> 
> This usage pattern is found already in the old code, so it's not new,
> and I'm not sure whether this behavior is intentional...

Agreed, the correct way to set a bit is to pass third and fourth argument
as mask. Will fix this overall usage of this macro and send it in another
patch series.

> 
> 
> thanks,
> 
> Takashi

-- 

  reply	other threads:[~2016-12-05  6:42 UTC|newest]

Thread overview: 21+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2016-12-02 17:41 [PATCH 00/12] ASoC: Intel: Skylake: Driver updates jeeja.kp
2016-12-02 17:41 ` [PATCH 01/12] ASoC: Intel: Skylake: Add helper function to setup host/link dma jeeja.kp
2016-12-05 11:35   ` Mark Brown
2016-12-05 17:09     ` Jeeja KP
2016-12-02 17:41 ` [PATCH 02/12] ASoC: Intel: Skylake: Configure DMA in PRE_PMD handler of Mixer jeeja.kp
2016-12-15 12:20   ` Applied "ASoC: Intel: Skylake: Configure DMA in PRE_PMD handler of Mixer" to the asoc tree Mark Brown
2016-12-02 17:41 ` [PATCH 03/12] ASoC: Intel: Skylake: Removed unused skl_get_format() jeeja.kp
2016-12-15 12:20   ` Applied "ASoC: Intel: Skylake: Removed unused skl_get_format()" to the asoc tree Mark Brown
2016-12-02 17:41 ` [PATCH 04/12] ALSA: hda: check stream decoupled register state jeeja.kp
2016-12-02 19:03   ` Takashi Iwai
2016-12-05  6:52     ` Jeeja KP [this message]
2016-12-02 17:41 ` [PATCH 05/12] ASoC: Intel: Skylake: Add set_tristate DAI ops to enable SSP MCLK jeeja.kp
2016-12-02 17:41 ` [PATCH 06/12] ASoC: Intel: Skylake: Remove unused SSP BE prepare DAI ops jeeja.kp
2016-12-02 17:41 ` [PATCH 07/12] ASoC: Intel: Skylake: Add supply widget as non DSP widget jeeja.kp
2016-12-02 17:41 ` [PATCH 08/12] ASoC: Intel: Skylake: Add supply widget in skl_nau_max machine jeeja.kp
2016-12-02 17:41 ` [PATCH 09/12] ASoC: Intel: Skylake: Add supply widget in bxt_da_max machine jeeja.kp
2016-12-02 17:41 ` [PATCH 10/12] ASoC: Intel: Skylake: Don't reset pass-through pipe in BE prepare jeeja.kp
2017-01-19 18:03   ` Applied "ASoC: Intel: Skylake: Don't reset pass-through pipe in BE prepare" to the asoc tree Mark Brown
2016-12-02 17:41 ` [PATCH 11/12] ASoC: Intel: Skylake: set the resume point to LPIB jeeja.kp
2017-01-19 18:03   ` Applied "ASoC: Intel: Skylake: set the resume point to LPIB" to the asoc tree Mark Brown
2016-12-02 17:41 ` [PATCH 12/12] ASoC: hdac_hdmi: Enable pin and converter in prepare jeeja.kp

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20161205065241.GA8021@kpjeeja-desk \
    --to=jeeja.kp@intel.com \
    --cc=alsa-devel@alsa-project.org \
    --cc=broonie@kernel.org \
    --cc=liam.r.girdwood@intel.com \
    --cc=patches.audio@intel.com \
    --cc=tiwai@suse.de \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).