From patchwork Tue May 15 06:40:56 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Sriram Periyasamy X-Patchwork-Id: 10400081 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork.web.codeaurora.org (Postfix) with ESMTP id D7087601D2 for ; Tue, 15 May 2018 06:52:00 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id A71D828508 for ; Tue, 15 May 2018 06:52:00 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 9BAF32856A; Tue, 15 May 2018 06:52:00 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-2.9 required=2.0 tests=BAYES_00, MAILING_LIST_MULTI, RCVD_IN_DNSWL_NONE autolearn=ham version=3.3.1 Received: from alsa0.perex.cz (alsa0.perex.cz [77.48.224.243]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 005B628508 for ; Tue, 15 May 2018 06:51:59 +0000 (UTC) Received: from alsa0.perex.cz (localhost [127.0.0.1]) by alsa0.perex.cz (Postfix) with ESMTP id 7BF432673A4; Tue, 15 May 2018 08:51:36 +0200 (CEST) X-Original-To: alsa-devel@alsa-project.org Delivered-To: alsa-devel@alsa-project.org Received: by alsa0.perex.cz (Postfix, from userid 1000) id 30F92267282; Tue, 15 May 2018 08:51:28 +0200 (CEST) Received: from mga06.intel.com (mga06.intel.com [134.134.136.31]) by alsa0.perex.cz (Postfix) with ESMTP id 11E38266F69 for ; Tue, 15 May 2018 08:51:25 +0200 (CEST) X-Amp-Result: SKIPPED(no attachment in message) X-Amp-File-Uploaded: False Received: from fmsmga001.fm.intel.com ([10.253.24.23]) by orsmga104.jf.intel.com with ESMTP/TLS/DHE-RSA-AES256-GCM-SHA384; 14 May 2018 23:51:25 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.49,403,1520924400"; d="scan'208";a="55277125" Received: from mtbf-optiplex-9010.iind.intel.com ([10.223.96.13]) by fmsmga001.fm.intel.com with ESMTP; 14 May 2018 23:51:23 -0700 From: Sriram Periyasamy To: ALSA ML , Mark Brown Date: Tue, 15 May 2018 12:10:56 +0530 Message-Id: <1526366456-20470-5-git-send-email-sriramx.periyasamy@intel.com> X-Mailer: git-send-email 2.7.4 In-Reply-To: <1526366456-20470-1-git-send-email-sriramx.periyasamy@intel.com> References: <1526366456-20470-1-git-send-email-sriramx.periyasamy@intel.com> Cc: Takashi Iwai , Liam Girdwood , Sriram Periyasamy , Pardha Saradhi K , Patches Audio Subject: [alsa-devel] [PATCH 4/4] ALSA: hda: check if stream is stopped in snd_hdac_stream_clear X-BeenThere: alsa-devel@alsa-project.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: "Alsa-devel mailing list for ALSA developers - http://www.alsa-project.org" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , MIME-Version: 1.0 Errors-To: alsa-devel-bounces@alsa-project.org Sender: alsa-devel-bounces@alsa-project.org X-Virus-Scanned: ClamAV using ClamSMTP From: Pardha Saradhi K Check if the DMA Channel is already stopped. There is no need to stop it again if stopped. Signed-off-by: Pardha Saradhi K Signed-off-by: Sriram Periyasamy --- sound/hda/hdac_stream.c | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/sound/hda/hdac_stream.c b/sound/hda/hdac_stream.c index aa8a2884289f..c1810eb7212b 100644 --- a/sound/hda/hdac_stream.c +++ b/sound/hda/hdac_stream.c @@ -89,6 +89,11 @@ void snd_hdac_stream_clear(struct hdac_stream *azx_dev) int timeout = 300; unsigned char val; + /* check if the DMA is already stopped */ + val = snd_hdac_stream_readb(azx_dev, SD_CTL) & SD_CTL_DMA_START; + if (!val) + return; + snd_hdac_stream_updateb(azx_dev, SD_CTL, SD_CTL_DMA_START | SD_INT_MASK, 0);