From patchwork Wed Apr 1 11:31:01 2015 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Vinod Koul X-Patchwork-Id: 6139621 Return-Path: X-Original-To: patchwork-alsa-devel@patchwork.kernel.org Delivered-To: patchwork-parsemail@patchwork2.web.kernel.org Received: from mail.kernel.org (mail.kernel.org [198.145.29.136]) by patchwork2.web.kernel.org (Postfix) with ESMTP id 7F971BF4A6 for ; Wed, 1 Apr 2015 11:38:31 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id 9CAC3202D1 for ; Wed, 1 Apr 2015 11:38:30 +0000 (UTC) Received: from alsa0.perex.cz (alsa0.perex.cz [77.48.224.243]) by mail.kernel.org (Postfix) with ESMTP id 52AB8202BE for ; Wed, 1 Apr 2015 11:38:29 +0000 (UTC) Received: by alsa0.perex.cz (Postfix, from userid 1000) id 81276265294; Wed, 1 Apr 2015 13:38:28 +0200 (CEST) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on mail.kernel.org X-Spam-Level: X-Spam-Status: No, score=-1.9 required=5.0 tests=BAYES_00,NO_DNS_FOR_FROM, UNPARSEABLE_RELAY autolearn=no version=3.3.1 Received: from alsa0.perex.cz (localhost [IPv6:::1]) by alsa0.perex.cz (Postfix) with ESMTP id 7506B265383; Wed, 1 Apr 2015 13:37:02 +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 C1A67265382; Wed, 1 Apr 2015 13:37:00 +0200 (CEST) Received: from mga14.intel.com (mga14.intel.com [192.55.52.115]) by alsa0.perex.cz (Postfix) with ESMTP id DC63126527E for ; Wed, 1 Apr 2015 13:35:39 +0200 (CEST) Received: from fmsmga002.fm.intel.com ([10.253.24.26]) by fmsmga103.fm.intel.com with ESMTP; 01 Apr 2015 04:35:39 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.11,503,1422950400"; d="scan'208";a="701473340" Received: from vkoul-udesk3.iind.intel.com ([10.223.84.65]) by fmsmga002.fm.intel.com with ESMTP; 01 Apr 2015 04:35:35 -0700 From: Vinod Koul To: alsa-devel@alsa-project.org Date: Wed, 1 Apr 2015 17:01:01 +0530 Message-Id: <1427887862-29054-5-git-send-email-vinod.koul@intel.com> X-Mailer: git-send-email 1.7.9.5 In-Reply-To: <1427887862-29054-1-git-send-email-vinod.koul@intel.com> References: <1427887862-29054-1-git-send-email-vinod.koul@intel.com> Cc: tiwai@suse.de, patches.audio@intel.com, Vinod Koul , lgirdwood@gmail.com, Jeeja KP Subject: [alsa-devel] [PATCH v3 4/5] ALSA: hda - move dsp lock to hdac 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 DSP lock will be used by DSP code loader in hdac as well Signed-off-by: Jeeja KP Signed-off-by: Vinod Koul --- include/sound/hdaudio.h | 17 +++++++++++++++++ sound/pci/hda/hda_controller.c | 13 ------------- 2 files changed, 17 insertions(+), 13 deletions(-) diff --git a/include/sound/hdaudio.h b/include/sound/hdaudio.h index 647d5ef44222..df4033fc864d 100644 --- a/include/sound/hdaudio.h +++ b/include/sound/hdaudio.h @@ -15,6 +15,19 @@ #define HDA_MAX_CODECS 8 +/* DSP lock helpers */ +#ifdef CONFIG_SND_HDA_DSP_LOADER +#define dsp_lock_init(dev) mutex_init(&(dev)->dsp_mutex) +#define dsp_lock(dev) mutex_lock(&(dev)->dsp_mutex) +#define dsp_unlock(dev) mutex_unlock(&(dev)->dsp_mutex) +#define dsp_is_locked(dev) ((dev)->locked) +#else +#define dsp_lock_init(dev) do {} while (0) +#define dsp_lock(dev) do {} while (0) +#define dsp_unlock(dev) do {} while (0) +#define dsp_is_locked(dev) 0 +#endif + /* codec node id */ typedef u16 hda_nid_t; @@ -283,6 +296,7 @@ struct hdac_stream { unsigned int opened:1; unsigned int running:1; unsigned int no_period_wakeup:1; + unsigned int locked:1; /* timestamp */ unsigned long start_wallclk; /* start + minimum wallclk */ @@ -292,6 +306,9 @@ struct hdac_stream { int delay_negative_threshold; struct list_head list; + + /* DSP mutex */ + struct mutex dsp_mutex; }; void snd_hdac_bus_stream_init(struct hdac_bus *bus, struct hdac_stream *azx_dev, diff --git a/sound/pci/hda/hda_controller.c b/sound/pci/hda/hda_controller.c index abb3822f5488..318635184edd 100644 --- a/sound/pci/hda/hda_controller.c +++ b/sound/pci/hda/hda_controller.c @@ -34,19 +34,6 @@ #define CREATE_TRACE_POINTS #include "hda_intel_trace.h" -/* DSP lock helpers */ -#ifdef CONFIG_SND_HDA_DSP_LOADER -#define dsp_lock_init(dev) mutex_init(&(dev)->dsp_mutex) -#define dsp_lock(dev) mutex_lock(&(dev)->dsp_mutex) -#define dsp_unlock(dev) mutex_unlock(&(dev)->dsp_mutex) -#define dsp_is_locked(dev) ((dev)->locked) -#else -#define dsp_lock_init(dev) do {} while (0) -#define dsp_lock(dev) do {} while (0) -#define dsp_unlock(dev) do {} while (0) -#define dsp_is_locked(dev) 0 -#endif - /* * AZX stream operations. */