From mboxrd@z Thu Jan 1 00:00:00 1970 From: Vinod Koul Subject: Re: [PATCH 3/3] ALSA: HDA: wait for RIRB, CORB DMA to finish Date: Tue, 4 Aug 2015 14:40:48 +0530 Message-ID: <20150804091048.GD11789@localhost> References: <1438660720-30033-1-git-send-email-vinod.koul@intel.com> <1438660720-30033-4-git-send-email-vinod.koul@intel.com> Mime-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Return-path: Received: from mga03.intel.com (mga03.intel.com [134.134.136.65]) by alsa0.perex.cz (Postfix) with ESMTP id 2985126587B for ; Tue, 4 Aug 2015 11:09:02 +0200 (CEST) Content-Disposition: inline In-Reply-To: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: alsa-devel-bounces@alsa-project.org Sender: alsa-devel-bounces@alsa-project.org To: Takashi Iwai Cc: liam.r.girdwood@linux.intel.com, patches.audio@intel.com, alsa-devel@alsa-project.org, broonie@kernel.org, Jeeja KP List-Id: alsa-devel@alsa-project.org On Tue, Aug 04, 2015 at 07:13:12AM +0200, Takashi Iwai wrote: > > @@ -86,10 +86,24 @@ EXPORT_SYMBOL_GPL(snd_hdac_bus_init_cmd_io); > > */ > > void snd_hdac_bus_stop_cmd_io(struct hdac_bus *bus) > > { > > + unsigned long timeout; > > + > > spin_lock_irq(&bus->reg_lock); > > /* disable ringbuffer DMAs */ > > snd_hdac_chip_writeb(bus, RIRBCTL, 0); > > snd_hdac_chip_writeb(bus, CORBCTL, 0); > > + > > + /* poll DMAs to check if they stopped or not */ > > + > > + timeout = jiffies + msecs_to_jiffies(100); > > + while ((snd_hdac_chip_readb(bus, RIRBCTL) & AZX_RBCTL_DMA_EN) && > > + time_before(jiffies, timeout)) > > + usleep_range(500, 1000); > > You must not use *sleep() inside atomic context. Right, not sure why it didnt crib when we tested, will send updated one soon Thanks for the super quick review :) -- ~Vinod