From patchwork Mon Mar 7 18:10:56 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Ranjani Sridharan X-Patchwork-Id: 548900 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from alsa0.perex.cz (alsa0.perex.cz [77.48.224.243]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id 50B57C433FE for ; Mon, 7 Mar 2022 18:13:46 +0000 (UTC) Received: from alsa1.perex.cz (alsa1.perex.cz [207.180.221.201]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by alsa0.perex.cz (Postfix) with ESMTPS id B9E731760; Mon, 7 Mar 2022 19:12:53 +0100 (CET) DKIM-Filter: OpenDKIM Filter v2.11.0 alsa0.perex.cz B9E731760 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=alsa-project.org; s=default; t=1646676823; bh=gC4hrOalaSWk2r0Ak+fB4dqt0ep0xnxf0zpjcz0cRlQ=; h=From:To:Subject:Date:In-Reply-To:References:Cc:List-Id: List-Unsubscribe:List-Archive:List-Post:List-Help:List-Subscribe: From; b=Yd+UOZSyUEmbdkcyNuEA1pFGVuVj8NN9PSPtentBRK47zm4pHVGSZnG43AUgf8rwm LnGUSfUcLv4HFOJ4OhQ6wJqwUZ9URG0ln3wgYsiztCCXd5UXbaYAJnfvR1b2E/AcKg JxIS+pUKZvK1c9/FQBTmGLaBMFKrzjXvE20YmiKY= Received: from alsa1.perex.cz (localhost.localdomain [127.0.0.1]) by alsa1.perex.cz (Postfix) with ESMTP id 9DA21F80534; Mon, 7 Mar 2022 19:11:41 +0100 (CET) Received: by alsa1.perex.cz (Postfix, from userid 50401) id 6CC23F8020D; Mon, 7 Mar 2022 19:11:38 +0100 (CET) Received: from mga03.intel.com (mga03.intel.com [134.134.136.65]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by alsa1.perex.cz (Postfix) with ESMTPS id D3A4EF8020D for ; Mon, 7 Mar 2022 19:11:28 +0100 (CET) DKIM-Filter: OpenDKIM Filter v2.11.0 alsa1.perex.cz D3A4EF8020D Authentication-Results: alsa1.perex.cz; dkim=pass (2048-bit key) header.d=intel.com header.i=@intel.com header.b="VcCcJVTh" DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1646676690; x=1678212690; h=from:to:cc:subject:date:message-id:in-reply-to: references:mime-version:content-transfer-encoding; bh=gC4hrOalaSWk2r0Ak+fB4dqt0ep0xnxf0zpjcz0cRlQ=; b=VcCcJVTha/s4uoSEc6x7K6hoi7gCPfCxP70tKuk0BILq13RdLiZeNZwM 2w1kmQbkV/UD0qqPDHT5gZ4VqfiySVisoTp424GYirI+k6KCf97Jm1i2K 7WH8xrZEtdonP1b3/7kT96EfuwdsunXubrhaNrKxc4wtGqy4ZBxURA3TW 88B9OOx2WDsI4i+XsdvpmXE9Sg/3y6vj5K/ESlOTodLI49FiLOYu0FAnc sNJ0yLrL4BvGQbNYfsZHqpNjRBZlFx/kUhMwRi6QKgKStbD76VA2vKwS5 4AVIGLjEWrUJdOTGVFsR4wevQeKslIV+AvUVcmvcO5CIdM4mzZJ1NlYvL w==; X-IronPort-AV: E=McAfee;i="6200,9189,10279"; a="254401313" X-IronPort-AV: E=Sophos;i="5.90,162,1643702400"; d="scan'208";a="254401313" Received: from orsmga003.jf.intel.com ([10.7.209.27]) by orsmga103.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 07 Mar 2022 10:11:25 -0800 X-IronPort-AV: E=Sophos;i="5.90,162,1643702400"; d="scan'208";a="495146659" Received: from echun1-mobl.amr.corp.intel.com (HELO rsridh2-mobl1.localdomain) ([10.251.130.219]) by orsmga003-auth.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 07 Mar 2022 10:11:25 -0800 From: Ranjani Sridharan To: alsa-devel@alsa-project.org Subject: [PATCH 03/18] ASoC: SOF: set swidget's core for scheduler widget Date: Mon, 7 Mar 2022 10:10:56 -0800 Message-Id: <20220307181111.49392-4-ranjani.sridharan@linux.intel.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20220307181111.49392-1-ranjani.sridharan@linux.intel.com> References: <20220307181111.49392-1-ranjani.sridharan@linux.intel.com> MIME-Version: 1.0 Cc: tiwai@suse.de, broonie@kernel.org, Bard Liao , Ranjani Sridharan , Pierre-Louis Bossart X-BeenThere: alsa-devel@alsa-project.org X-Mailman-Version: 2.1.15 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: , Errors-To: alsa-devel-bounces@alsa-project.org Sender: "Alsa-devel" Set the swidget's core for scheduler type widgets to match that of the pipeline core. This simplifies the flow for core get/put during widget setup/free. Signed-off-by: Ranjani Sridharan Reviewed-by: Bard Liao Reviewed-by: Pierre-Louis Bossart --- sound/soc/sof/sof-audio.c | 23 +++++------------------ sound/soc/sof/topology.c | 1 + 2 files changed, 6 insertions(+), 18 deletions(-) diff --git a/sound/soc/sof/sof-audio.c b/sound/soc/sof/sof-audio.c index ac1edb4a082d..4816473cfd7d 100644 --- a/sound/soc/sof/sof-audio.c +++ b/sound/soc/sof/sof-audio.c @@ -103,7 +103,7 @@ int sof_widget_free(struct snd_sof_dev *sdev, struct snd_sof_widget *swidget) .id = swidget->comp_id, }; struct sof_ipc_reply reply; - int ret, ret1, core; + int ret, ret1; if (!swidget->private) return 0; @@ -112,14 +112,9 @@ int sof_widget_free(struct snd_sof_dev *sdev, struct snd_sof_widget *swidget) if (--swidget->use_count) return 0; - core = swidget->core; - switch (swidget->id) { case snd_soc_dapm_scheduler: { - const struct sof_ipc_pipe_new *pipeline = swidget->private; - - core = pipeline->core; ipc_free.hdr.cmd |= SOF_IPC_TPLG_PIPE_FREE; break; } @@ -149,10 +144,10 @@ int sof_widget_free(struct snd_sof_dev *sdev, struct snd_sof_widget *swidget) * disable widget core. continue to route setup status and complete flag * even if this fails and return the appropriate error */ - ret1 = snd_sof_dsp_core_put(sdev, core); + ret1 = snd_sof_dsp_core_put(sdev, swidget->core); if (ret1 < 0) { dev_err(sdev->dev, "error: failed to disable target core: %d for widget %s\n", - core, swidget->widget->name); + swidget->core, swidget->widget->name); if (!ret) ret = ret1; } @@ -177,7 +172,6 @@ int sof_widget_setup(struct snd_sof_dev *sdev, struct snd_sof_widget *swidget) struct snd_sof_dai *dai; size_t ipc_size; int ret; - int core; /* skip if there is no private data */ if (!swidget->private) @@ -187,15 +181,8 @@ int sof_widget_setup(struct snd_sof_dev *sdev, struct snd_sof_widget *swidget) if (++swidget->use_count > 1) return 0; - /* set core ID */ - core = swidget->core; - if (swidget->id == snd_soc_dapm_scheduler) { - pipeline = swidget->private; - core = pipeline->core; - } - /* enable widget core */ - ret = snd_sof_dsp_core_get(sdev, core); + ret = snd_sof_dsp_core_get(sdev, swidget->core); if (ret < 0) { dev_err(sdev->dev, "error: failed to enable target core for widget %s\n", swidget->widget->name); @@ -275,7 +262,7 @@ int sof_widget_setup(struct snd_sof_dev *sdev, struct snd_sof_widget *swidget) return 0; core_put: - snd_sof_dsp_core_put(sdev, core); + snd_sof_dsp_core_put(sdev, swidget->core); use_count_dec: swidget->use_count--; return ret; diff --git a/sound/soc/sof/topology.c b/sound/soc/sof/topology.c index 1d119d1dd69d..add0b3009588 100644 --- a/sound/soc/sof/topology.c +++ b/sound/soc/sof/topology.c @@ -1707,6 +1707,7 @@ static int sof_widget_load_pipeline(struct snd_soc_component *scomp, int index, pipeline->period_mips, pipeline->core, pipeline->frames_per_sched, swidget->dynamic_pipeline_widget); + swidget->core = pipeline->core; swidget->private = pipeline; return 0;