From patchwork Mon Mar 7 18:10:54 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Ranjani Sridharan X-Patchwork-Id: 549346 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 CFAD1C433FE for ; Mon, 7 Mar 2022 18:12:55 +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 3F1271753; Mon, 7 Mar 2022 19:12:03 +0100 (CET) DKIM-Filter: OpenDKIM Filter v2.11.0 alsa0.perex.cz 3F1271753 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=alsa-project.org; s=default; t=1646676773; bh=GvwRtUM5etc5jOpQmyBLezTHk4i8Qjvpq6in2Y5Q8Bk=; h=From:To:Subject:Date:In-Reply-To:References:Cc:List-Id: List-Unsubscribe:List-Archive:List-Post:List-Help:List-Subscribe: From; b=NJoj9NErlzHWNmUBRs3L0pcJDv7jn4CaNmu1PR3mFLYUmHVGkUGRzvT4cxhWCiOyN XPrtrWo5VZPaBcng4Oqum+ly0wX28dN2zuQ1jHEFVJIwvnTojqvU5r0i0cr3zLpCyX XU4jtz/SinwY8lOfLmrgC+StjCljceTECr4UUZXc= Received: from alsa1.perex.cz (localhost.localdomain [127.0.0.1]) by alsa1.perex.cz (Postfix) with ESMTP id B5CD2F80519; Mon, 7 Mar 2022 19:11:35 +0100 (CET) Received: by alsa1.perex.cz (Postfix, from userid 50401) id AAEFBF80519; Mon, 7 Mar 2022 19:11:34 +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 6226CF80132 for ; Mon, 7 Mar 2022 19:11:27 +0100 (CET) DKIM-Filter: OpenDKIM Filter v2.11.0 alsa1.perex.cz 6226CF80132 Authentication-Results: alsa1.perex.cz; dkim=pass (2048-bit key) header.d=intel.com header.i=@intel.com header.b="f/vLwZ9X" DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1646676688; x=1678212688; h=from:to:cc:subject:date:message-id:in-reply-to: references:mime-version:content-transfer-encoding; bh=GvwRtUM5etc5jOpQmyBLezTHk4i8Qjvpq6in2Y5Q8Bk=; b=f/vLwZ9XlBO+dniZwEMmetKKZhOeFwisEgyNm5Rd6vAtFJjGflQ5L2np BE/lFvyp68T6lOOtS9Yzya0AXsRqHOTH7qOkSVNlT+RRSGlVxSvxQ9j7r NIJTR6iiMNYki4o54I8j6XNvhF++5M0Ne0AcQbO4Mf5b5pyjc/el9fxvx TdqgzPfYFH2VLUYYny+CQg0A3rTf5BxT9ljxTW2EKchXbGtUhUfxLoFsj lMP4gx2aBWXopU3K4DAWLX4T5EJgA8Q0q1GW806i8ies4wlZdAUjiky5u lESBaCvW+ieZhcxrwSaWIO6Lzmr1QunsIsW2EqdnyhoeCPAk57YCQLYcV w==; X-IronPort-AV: E=McAfee;i="6200,9189,10279"; a="254401310" X-IronPort-AV: E=Sophos;i="5.90,162,1643702400"; d="scan'208";a="254401310" 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="495146654" 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:24 -0800 From: Ranjani Sridharan To: alsa-devel@alsa-project.org Subject: [PATCH 01/18] ASoC: SOF: remove snd_sof_pipeline_find() Date: Mon, 7 Mar 2022 10:10:54 -0800 Message-Id: <20220307181111.49392-2-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" It is not used. Signed-off-by: Ranjani Sridharan Reviewed-by: Bard Liao Reviewed-by: Pierre-Louis Bossart --- sound/soc/sof/sof-audio.c | 16 ---------------- sound/soc/sof/sof-audio.h | 2 -- 2 files changed, 18 deletions(-) diff --git a/sound/soc/sof/sof-audio.c b/sound/soc/sof/sof-audio.c index 9e76b796502f..ac1edb4a082d 100644 --- a/sound/soc/sof/sof-audio.c +++ b/sound/soc/sof/sof-audio.c @@ -624,22 +624,6 @@ int sof_set_hw_params_upon_resume(struct device *dev) return snd_sof_dsp_hw_params_upon_resume(sdev); } -const struct sof_ipc_pipe_new *snd_sof_pipeline_find(struct snd_sof_dev *sdev, - int pipeline_id) -{ - const struct snd_sof_widget *swidget; - - list_for_each_entry(swidget, &sdev->widget_list, list) - if (swidget->id == snd_soc_dapm_scheduler) { - const struct sof_ipc_pipe_new *pipeline = - swidget->private; - if (pipeline->pipeline_id == pipeline_id) - return pipeline; - } - - return NULL; -} - int sof_set_up_pipelines(struct snd_sof_dev *sdev, bool verify) { struct sof_ipc_fw_version *v = &sdev->fw_ready.version; diff --git a/sound/soc/sof/sof-audio.h b/sound/soc/sof/sof-audio.h index f3009e6b91a1..107e0ef93e16 100644 --- a/sound/soc/sof/sof-audio.h +++ b/sound/soc/sof/sof-audio.h @@ -222,8 +222,6 @@ struct snd_sof_pcm *snd_sof_find_spcm_comp(struct snd_soc_component *scomp, int *direction); struct snd_sof_pcm *snd_sof_find_spcm_pcm_id(struct snd_soc_component *scomp, unsigned int pcm_id); -const struct sof_ipc_pipe_new *snd_sof_pipeline_find(struct snd_sof_dev *sdev, - int pipeline_id); void snd_sof_pcm_period_elapsed(struct snd_pcm_substream *substream); void snd_sof_pcm_init_elapsed_work(struct work_struct *work); From patchwork Mon Mar 7 18:10:55 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Ranjani Sridharan X-Patchwork-Id: 548901 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 44909C433F5 for ; Mon, 7 Mar 2022 18:13:15 +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 95195174C; Mon, 7 Mar 2022 19:12:22 +0100 (CET) DKIM-Filter: OpenDKIM Filter v2.11.0 alsa0.perex.cz 95195174C DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=alsa-project.org; s=default; t=1646676792; bh=+swSm3wPEFZSVw9Cfp5+ZQJFB6mQEStIMYUvZ9tTVNk=; h=From:To:Subject:Date:In-Reply-To:References:Cc:List-Id: List-Unsubscribe:List-Archive:List-Post:List-Help:List-Subscribe: From; b=MkehiUaSFibrZ8oaYMErELLjwupn83QcRwWkdcZ9v5kPjDaVVHUWztywax17pvyzN fU+f4Bp7x/j3SueHbfmL1+6hNA0grxd0FpqiU+yXwemitsn5SoDoFM/1BGLqlJ5Y+j v9Dhou7P2HrpE0J98ueBPUQufypmcFhC8cm3jLIE= Received: from alsa1.perex.cz (localhost.localdomain [127.0.0.1]) by alsa1.perex.cz (Postfix) with ESMTP id 11EA6F80526; Mon, 7 Mar 2022 19:11:38 +0100 (CET) Received: by alsa1.perex.cz (Postfix, from userid 50401) id 64BC3F80518; Mon, 7 Mar 2022 19:11:35 +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 E954AF80124 for ; Mon, 7 Mar 2022 19:11:27 +0100 (CET) DKIM-Filter: OpenDKIM Filter v2.11.0 alsa1.perex.cz E954AF80124 Authentication-Results: alsa1.perex.cz; dkim=pass (2048-bit key) header.d=intel.com header.i=@intel.com header.b="GWM7xj89" DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1646676689; x=1678212689; h=from:to:cc:subject:date:message-id:in-reply-to: references:mime-version:content-transfer-encoding; bh=+swSm3wPEFZSVw9Cfp5+ZQJFB6mQEStIMYUvZ9tTVNk=; b=GWM7xj89AgudCQRHxgtboNm+W+R0+M+4x6Ly/fFWH69AJ8eV8Xtc/E8S nTmqhsaS/oE0UMRyWMnAeJ7GxJe5yShwXItQOf/1SBhpnYs8BNBrVAnMM Zp683AfMyjIdeRuoEMKdbMfFpbvCwudTH18Yx1MPff0NmDtiNbM8wOIWF BrAUORuOcJZy5K84F0sXUQGZZVvKJqr0yE2NRQpumdp/YbQN6V15/KoLp lFn6kyv6E5dzrrU++kb9ur3qF03Rh1+x35xZ/fBoignIwpt143WfqM6yR Nj77Vdsq4WVJIfssDX9XtlrVMbednZv7iJ+wkKT1rt9w5aIj6ULpiz2Y0 g==; X-IronPort-AV: E=McAfee;i="6200,9189,10279"; a="254401311" X-IronPort-AV: E=Sophos;i="5.90,162,1643702400"; d="scan'208";a="254401311" 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="495146656" 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 02/18] ASoC: SOF: simplify snd_sof_device_remove() Date: Mon, 7 Mar 2022 10:10:55 -0800 Message-Id: <20220307181111.49392-3-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" The commit "ASoC: SOF: core: Unregister machine driver before IPC and debugfs" moved the call to unregister the machine driver to be done before freeing the IPC. With this change, we can safely move the call to snd_sof_remove() inside the same if() block just above. Signed-off-by: Ranjani Sridharan Reviewed-by: Bard Liao Reviewed-by: Pierre-Louis Bossart --- sound/soc/sof/core.c | 10 +--------- 1 file changed, 1 insertion(+), 9 deletions(-) diff --git a/sound/soc/sof/core.c b/sound/soc/sof/core.c index 2a35d8ddf43e..95a845d26f6e 100644 --- a/sound/soc/sof/core.c +++ b/sound/soc/sof/core.c @@ -442,16 +442,8 @@ int snd_sof_device_remove(struct device *dev) snd_sof_ipc_free(sdev); snd_sof_free_debug(sdev); - } - - /* - * Unregistering the machine driver results in unloading the topology. - * Some widgets, ex: scheduler, attempt to power down the core they are - * scheduled on, when they are unloaded. Therefore, the DSP must be - * removed only after the topology has been unloaded. - */ - if (sdev->fw_state > SOF_FW_BOOT_NOT_STARTED) snd_sof_remove(sdev); + } /* release firmware */ snd_sof_fw_unload(sdev); 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; From patchwork Mon Mar 7 18:10:57 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Ranjani Sridharan X-Patchwork-Id: 549342 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 655FCC433F5 for ; Mon, 7 Mar 2022 18:15:04 +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 8477517B7; Mon, 7 Mar 2022 19:14:12 +0100 (CET) DKIM-Filter: OpenDKIM Filter v2.11.0 alsa0.perex.cz 8477517B7 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=alsa-project.org; s=default; t=1646676902; bh=Cy1f/IJxo+TJxenqriDSLcWF9iUIrrmJzDsoqb5Hhz0=; h=From:To:Subject:Date:In-Reply-To:References:Cc:List-Id: List-Unsubscribe:List-Archive:List-Post:List-Help:List-Subscribe: From; b=EacKo9ndC8xy78vHYTOknTjmYf4Au7WBmwx2XnR9t4WrnU4aiv328+bOwK4SxhE6i vTnvbpErqNKauD4LMUOwjgeMEuJEGJsuZb5Cz2FZwfHRNxN9QBJFF5BZCXDKjKXjES LYOXyvjkh8ojBtUM36wHV8TMtDfYWVgA12yfmIOE= Received: from alsa1.perex.cz (localhost.localdomain [127.0.0.1]) by alsa1.perex.cz (Postfix) with ESMTP id 814C4F8020D; Mon, 7 Mar 2022 19:11:50 +0100 (CET) Received: by alsa1.perex.cz (Postfix, from userid 50401) id 259FDF8013F; Mon, 7 Mar 2022 19:11:42 +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 A6036F80431 for ; Mon, 7 Mar 2022 19:11:29 +0100 (CET) DKIM-Filter: OpenDKIM Filter v2.11.0 alsa1.perex.cz A6036F80431 Authentication-Results: alsa1.perex.cz; dkim=pass (2048-bit key) header.d=intel.com header.i=@intel.com header.b="ANy5w6qj" 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=Cy1f/IJxo+TJxenqriDSLcWF9iUIrrmJzDsoqb5Hhz0=; b=ANy5w6qjjhLT4Kg/50FIN/uCwBVcNjc0rx/4Ph8yEA+3KpUyo7Us24VS oFCn0jn5XC0095pJ51WatP9fmNF/zWpIMbHtFyVd2/DFShQnQx9Po73vJ WN/hfImZX+kvISg0s8+//Ku6njGCdfmFs8LK1TN6Ois9k7Y8PCQGOj0tM PveJBryYREOT7jo2GctEX6dVPNtE1r6/JQc6wY7QcMv+qSgUmhl1LSvIu RHdpOc8jAalhYR0dIZyGB4oG9Ur4JVPjvlisLeR2nZA68dj+5A+zj/NdK F0K4W1syL/Rw3cP56Qw1ND3w2adywDd+MobTXAbSIRm4twQlHV2VJqyLM g==; X-IronPort-AV: E=McAfee;i="6200,9189,10279"; a="254401314" X-IronPort-AV: E=Sophos;i="5.90,162,1643702400"; d="scan'208";a="254401314" 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:26 -0800 X-IronPort-AV: E=Sophos;i="5.90,162,1643702400"; d="scan'208";a="495146663" 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 04/18] ASoC: SOF: sof-audio: removed unused function Date: Mon, 7 Mar 2022 10:10:57 -0800 Message-Id: <20220307181111.49392-5-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, =?utf-8?q?P=C3=A9ter_Ujfalusi?= , Pierre-Louis Bossart , Ranjani Sridharan 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" From: Pierre-Louis Bossart cppcheck warning: sound/soc/sof/sof-audio.c:884:0: style: The function 'snd_sof_find_spcm_pcm_id' is never used. [unusedFunction] Signed-off-by: Pierre-Louis Bossart Reviewed-by: Ranjani Sridharan Reviewed-by: Péter Ujfalusi --- sound/soc/sof/sof-audio.c | 14 -------------- sound/soc/sof/sof-audio.h | 2 -- 2 files changed, 16 deletions(-) diff --git a/sound/soc/sof/sof-audio.c b/sound/soc/sof/sof-audio.c index 4816473cfd7d..e39f18e824b4 100644 --- a/sound/soc/sof/sof-audio.c +++ b/sound/soc/sof/sof-audio.c @@ -866,20 +866,6 @@ struct snd_sof_pcm *snd_sof_find_spcm_comp(struct snd_soc_component *scomp, return NULL; } -struct snd_sof_pcm *snd_sof_find_spcm_pcm_id(struct snd_soc_component *scomp, - unsigned int pcm_id) -{ - struct snd_sof_dev *sdev = snd_soc_component_get_drvdata(scomp); - struct snd_sof_pcm *spcm; - - list_for_each_entry(spcm, &sdev->pcm_list, list) { - if (le32_to_cpu(spcm->pcm.pcm_id) == pcm_id) - return spcm; - } - - return NULL; -} - struct snd_sof_widget *snd_sof_find_swidget(struct snd_soc_component *scomp, const char *name) { diff --git a/sound/soc/sof/sof-audio.h b/sound/soc/sof/sof-audio.h index 107e0ef93e16..f2f32f2065d3 100644 --- a/sound/soc/sof/sof-audio.h +++ b/sound/soc/sof/sof-audio.h @@ -220,8 +220,6 @@ struct snd_sof_pcm *snd_sof_find_spcm_name(struct snd_soc_component *scomp, struct snd_sof_pcm *snd_sof_find_spcm_comp(struct snd_soc_component *scomp, unsigned int comp_id, int *direction); -struct snd_sof_pcm *snd_sof_find_spcm_pcm_id(struct snd_soc_component *scomp, - unsigned int pcm_id); void snd_sof_pcm_period_elapsed(struct snd_pcm_substream *substream); void snd_sof_pcm_init_elapsed_work(struct work_struct *work); From patchwork Mon Mar 7 18:10:58 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Ranjani Sridharan X-Patchwork-Id: 548898 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 F115DC433EF for ; Mon, 7 Mar 2022 18:14:54 +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 3EF7C176C; Mon, 7 Mar 2022 19:14:03 +0100 (CET) DKIM-Filter: OpenDKIM Filter v2.11.0 alsa0.perex.cz 3EF7C176C DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=alsa-project.org; s=default; t=1646676893; bh=i9+nWjF9KpqPOgYOZbJl2zWHl8mmTVk/yRANRnOt52o=; h=From:To:Subject:Date:In-Reply-To:References:Cc:List-Id: List-Unsubscribe:List-Archive:List-Post:List-Help:List-Subscribe: From; b=IpcFiFcF8vRqmu6BLG1UGke0ISNBwh+wVTP4SC+6pWkdZuqBphdKCcfLKaMTMWaGv p9i3FYlIzIiuOBfNV8XSZQRHwbMSsK7pzHy+G5Nl0sEQNFkeaLk4MTqOu+DrhttfiY Va1y3WLa6F2/IDX/4PHhxiSqmVue/p3H2qXIHPhU= Received: from alsa1.perex.cz (localhost.localdomain [127.0.0.1]) by alsa1.perex.cz (Postfix) with ESMTP id 2CD54F80543; Mon, 7 Mar 2022 19:11:49 +0100 (CET) Received: by alsa1.perex.cz (Postfix, from userid 50401) id 12480F80537; Mon, 7 Mar 2022 19:11:42 +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 DF5AAF80508 for ; Mon, 7 Mar 2022 19:11:29 +0100 (CET) DKIM-Filter: OpenDKIM Filter v2.11.0 alsa1.perex.cz DF5AAF80508 Authentication-Results: alsa1.perex.cz; dkim=pass (2048-bit key) header.d=intel.com header.i=@intel.com header.b="S2/yuhFr" DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1646676691; x=1678212691; h=from:to:cc:subject:date:message-id:in-reply-to: references:mime-version:content-transfer-encoding; bh=i9+nWjF9KpqPOgYOZbJl2zWHl8mmTVk/yRANRnOt52o=; b=S2/yuhFrbhsVEb4tNwSRfoHzStKGhxFS3KNHu9Gq8IPOSEWmlxigW/Vc cJ0zVxxDZimmySzZpl9TXl4SJjm1pnd2a3j4S0JCdjruvavh4KJic62Pi B5E2P//nRSARM8z8vnkHaosb3uI2dcp3etIy2PPQI2XqC9WT1TYNspL60 lMWmWKe2EBpnz4y8TDC8Uwnn5v6xL7Eijkqgqq0JhTsbbvR/nRC5k1v6z /XmGyLduv6LDo73vVv+uhXlkmCqUzmTkKH0AvxB7IL5BfdUSIyA/o9BUb /zN0WPmBcSeyFNPBCE1CvMbd7X4OdGKcEUhDAcYpMcHqYETYAVZvql3q5 A==; X-IronPort-AV: E=McAfee;i="6200,9189,10279"; a="254401316" X-IronPort-AV: E=Sophos;i="5.90,162,1643702400"; d="scan'208";a="254401316" 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:26 -0800 X-IronPort-AV: E=Sophos;i="5.90,162,1643702400"; d="scan'208";a="495146664" 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:26 -0800 From: Ranjani Sridharan To: alsa-devel@alsa-project.org Subject: [PATCH 05/18] ASoC: SOF: topology: remove redundant code Date: Mon, 7 Mar 2022 10:10:58 -0800 Message-Id: <20220307181111.49392-6-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, Bard Liao , Ranjani Sridharan , Pierre-Louis Bossart , broonie@kernel.org, =?utf-8?q?P=C3=A9ter_Ujfalusi?= 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" With the change in the commit: "ASoC: SOF: Intel: hda: assign link DMA channel at run-time", there is no need to find the CPU DAI in sof_link_hda_load(). Fixes: bdf4ad3fd01f ('ASoC: SOF: Intel: hda: assign link DMA channel at run-time') Signed-off-by: Ranjani Sridharan Reviewed-by: Bard Liao Reviewed-by: Péter Ujfalusi Reviewed-by: Pierre-Louis Bossart --- sound/soc/sof/topology.c | 8 -------- 1 file changed, 8 deletions(-) diff --git a/sound/soc/sof/topology.c b/sound/soc/sof/topology.c index add0b3009588..15ec59596300 100644 --- a/sound/soc/sof/topology.c +++ b/sound/soc/sof/topology.c @@ -3140,7 +3140,6 @@ static int sof_link_hda_load(struct snd_soc_component *scomp, int index, { struct snd_sof_dev *sdev = snd_soc_component_get_drvdata(scomp); struct snd_soc_tplg_private *private = &cfg->priv; - struct snd_soc_dai *dai; u32 size = sizeof(*config); int ret; @@ -3161,13 +3160,6 @@ static int sof_link_hda_load(struct snd_soc_component *scomp, int index, dev_dbg(scomp->dev, "HDA config rate %d channels %d\n", config->hda.rate, config->hda.channels); - dai = snd_soc_find_dai(link->cpus); - if (!dai) { - dev_err(scomp->dev, "error: failed to find dai %s in %s", - link->cpus->dai_name, __func__); - return -EINVAL; - } - config->hda.link_dma_ch = DMA_CHAN_INVALID; ret = sof_set_dai_config(sdev, size, link, config); From patchwork Mon Mar 7 18:10:59 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Ranjani Sridharan X-Patchwork-Id: 548899 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 6743AC433F5 for ; Mon, 7 Mar 2022 18:14:13 +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 831EE1786; Mon, 7 Mar 2022 19:13:20 +0100 (CET) DKIM-Filter: OpenDKIM Filter v2.11.0 alsa0.perex.cz 831EE1786 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=alsa-project.org; s=default; t=1646676850; bh=OJ6GNJI5FJMmgTVuJ2vlGnKxlLNPjXO7cBU1IXOuRq8=; h=From:To:Subject:Date:In-Reply-To:References:Cc:List-Id: List-Unsubscribe:List-Archive:List-Post:List-Help:List-Subscribe: From; b=P3v1Y7im1yPE9UsGaaFc7wnhAPplITFC2rfTcZzuNheOYTriesAtTScwFx3mpkCux 6nR+plZNH/zhA+KZhqr95U5IHv5aNcyU+zSeeVjD5kVmkuOooEHxG7XcA4abfMA7va a5YOE0Y1P+ynq6T5esjpWbY/CXJeUWz3eGWuxZsw= Received: from alsa1.perex.cz (localhost.localdomain [127.0.0.1]) by alsa1.perex.cz (Postfix) with ESMTP id 450E0F8051A; Mon, 7 Mar 2022 19:11:47 +0100 (CET) Received: by alsa1.perex.cz (Postfix, from userid 50401) id D5A44F80536; Mon, 7 Mar 2022 19:11:41 +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 C3F86F8013F for ; Mon, 7 Mar 2022 19:11:30 +0100 (CET) DKIM-Filter: OpenDKIM Filter v2.11.0 alsa1.perex.cz C3F86F8013F Authentication-Results: alsa1.perex.cz; dkim=pass (2048-bit key) header.d=intel.com header.i=@intel.com header.b="DlRAN/Cu" DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1646676692; x=1678212692; h=from:to:cc:subject:date:message-id:in-reply-to: references:mime-version:content-transfer-encoding; bh=OJ6GNJI5FJMmgTVuJ2vlGnKxlLNPjXO7cBU1IXOuRq8=; b=DlRAN/CulSxbcB5fC3t7fng+5Y7HiNmqfVOWHrnJ8sXOfkS0BEI4zYHr 4q6JOpGMhXPC/N5cY+lm9C87SpuCREgy7tdKLgliOxolh3hQnd16cvrjr DfbW7GkzX92U1Wjs5gyQ74iA6d0qo67bktneFsbXN97d9adimY884/tvB wTEo06lWKJgZgIC4BWvpOBSDo+T4B9mq+onvGHQUAC9dI8Xos9mGkJeX6 Wew27ijiwIULkJFFTX6LsCq8fEcv+FdMTuh6EhnDdWSOkK67FYbqPmv6M TEGeRf7Ajmtxk8+XaMey2Cd7yTKoGdV2sX3KpKh09oNGAO/H6ndOEJ/TX g==; X-IronPort-AV: E=McAfee;i="6200,9189,10279"; a="254401317" X-IronPort-AV: E=Sophos;i="5.90,162,1643702400"; d="scan'208";a="254401317" 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:26 -0800 X-IronPort-AV: E=Sophos;i="5.90,162,1643702400"; d="scan'208";a="495146665" 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:26 -0800 From: Ranjani Sridharan To: alsa-devel@alsa-project.org Subject: [PATCH 06/18] ASoC: SOF: topology: remove redundant code in sof_link_afe_load() Date: Mon, 7 Mar 2022 10:10:59 -0800 Message-Id: <20220307181111.49392-7-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, Bard Liao , Ranjani Sridharan , Pierre-Louis Bossart , broonie@kernel.org, =?utf-8?q?P=C3=A9ter_Ujfalusi?= 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" Looks like a copy-paste error. The CPU DAI is never used. Signed-off-by: Ranjani Sridharan Reviewed-by: Bard Liao Reviewed-by: Péter Ujfalusi Reviewed-by: Pierre-Louis Bossart --- sound/soc/sof/topology.c | 7 ------- 1 file changed, 7 deletions(-) diff --git a/sound/soc/sof/topology.c b/sound/soc/sof/topology.c index 15ec59596300..c31358aa8a75 100644 --- a/sound/soc/sof/topology.c +++ b/sound/soc/sof/topology.c @@ -3014,7 +3014,6 @@ static int sof_link_afe_load(struct snd_soc_component *scomp, int index, { struct snd_sof_dev *sdev = snd_soc_component_get_drvdata(scomp); struct snd_soc_tplg_private *private = &cfg->priv; - struct snd_soc_dai *dai; u32 size = sizeof(*config); int ret; @@ -3033,12 +3032,6 @@ static int sof_link_afe_load(struct snd_soc_component *scomp, int index, dev_dbg(scomp->dev, "AFE config rate %d channels %d format:%d\n", config->afe.rate, config->afe.channels, config->afe.format); - dai = snd_soc_find_dai(link->cpus); - if (!dai) { - dev_err(scomp->dev, "%s: failed to find dai %s", __func__, link->cpus->dai_name); - return -EINVAL; - } - config->afe.stream_id = DMA_CHAN_INVALID; ret = sof_set_dai_config(sdev, size, link, config); From patchwork Mon Mar 7 18:11:00 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Ranjani Sridharan X-Patchwork-Id: 549344 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 9F238C433F5 for ; Mon, 7 Mar 2022 18:14:06 +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 08CDD1736; Mon, 7 Mar 2022 19:13:13 +0100 (CET) DKIM-Filter: OpenDKIM Filter v2.11.0 alsa0.perex.cz 08CDD1736 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=alsa-project.org; s=default; t=1646676843; bh=Qwl2gT+HUShVvX4bxNfJsfKBxAKHNoQDseaSoqIr3Nc=; h=From:To:Subject:Date:In-Reply-To:References:Cc:List-Id: List-Unsubscribe:List-Archive:List-Post:List-Help:List-Subscribe: From; b=tHZ2/Pai3uL/MNogJmN0ToDFLVal9SM1tgKqAlwDCF/4+J/pL6zkgUXtDq8nSzMg+ KnIMI4+PeGmhYP7d7VU10zt2ZF6VDKaPxxFji8vqLbCQB3yX97u9eYNKeNrs680zsD qCu+vo9Ekmazm10ceUMjIwoUvdWobWWSFxNoslAs= Received: from alsa1.perex.cz (localhost.localdomain [127.0.0.1]) by alsa1.perex.cz (Postfix) with ESMTP id 924B1F80537; Mon, 7 Mar 2022 19:11:44 +0100 (CET) Received: by alsa1.perex.cz (Postfix, from userid 50401) id 6787EF80535; Mon, 7 Mar 2022 19:11:41 +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 B68F0F80516 for ; Mon, 7 Mar 2022 19:11:32 +0100 (CET) DKIM-Filter: OpenDKIM Filter v2.11.0 alsa1.perex.cz B68F0F80516 Authentication-Results: alsa1.perex.cz; dkim=pass (2048-bit key) header.d=intel.com header.i=@intel.com header.b="Jc8bBnSd" DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1646676693; x=1678212693; h=from:to:cc:subject:date:message-id:in-reply-to: references:mime-version:content-transfer-encoding; bh=Qwl2gT+HUShVvX4bxNfJsfKBxAKHNoQDseaSoqIr3Nc=; b=Jc8bBnSduTCdv9pBJokxM9ipFgK+Cqv5Zd8lUfaSFBjiWYS7Pay7rXJC tWOTsQ+MRnE5eXfgsDg4mPmhFplba4LrVpOaaQzNiB4d5vAe803Kp7cXv yysbHio8KmLr0dRGSzFeAqhKw/J4zF6Yq/YZVDN3VSe7dxTe21LWlnjZV e/lakTidW48Q0VwBuqIaQOhL37B+Y95oFO7Djr0tEKNRBJiX66U3MCEQu 0EnpaComYNaKOpjXojZe/KQJyeV3OmZePYw2UKAJ8SR9biQE+ZK+sOqOd MR9ovOdcfXTuV752exEJd2NIeghX+i0vRDhoMs9/+9nyKKNfmehJ99ypj A==; X-IronPort-AV: E=McAfee;i="6200,9189,10279"; a="254401320" X-IronPort-AV: E=Sophos;i="5.90,162,1643702400"; d="scan'208";a="254401320" 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:27 -0800 X-IronPort-AV: E=Sophos;i="5.90,162,1643702400"; d="scan'208";a="495146668" 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:26 -0800 From: Ranjani Sridharan To: alsa-devel@alsa-project.org Subject: [PATCH 07/18] ASoC: SOF: topology: Drop the size parameter from struct sof_topology_token Date: Mon, 7 Mar 2022 10:11:00 -0800 Message-Id: <20220307181111.49392-8-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, Bard Liao , Ranjani Sridharan , Pierre-Louis Bossart , broonie@kernel.org, =?utf-8?q?P=C3=A9ter_Ujfalusi?= 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" It is always 0 and never used while parsing. Signed-off-by: Ranjani Sridharan Reviewed-by: Bard Liao Reviewed-by: Péter Ujfalusi Reviewed-by: Pierre-Louis Bossart --- sound/soc/sof/topology.c | 163 ++++++++++++++++++--------------------- 1 file changed, 75 insertions(+), 88 deletions(-) diff --git a/sound/soc/sof/topology.c b/sound/soc/sof/topology.c index c31358aa8a75..7280e14c13bc 100644 --- a/sound/soc/sof/topology.c +++ b/sound/soc/sof/topology.c @@ -473,12 +473,11 @@ static enum sof_comp_type find_process_comp_type(enum sof_ipc_process_type type) struct sof_topology_token { u32 token; u32 type; - int (*get_token)(void *elem, void *object, u32 offset, u32 size); + int (*get_token)(void *elem, void *object, u32 offset); u32 offset; - u32 size; }; -static int get_token_u32(void *elem, void *object, u32 offset, u32 size) +static int get_token_u32(void *elem, void *object, u32 offset) { struct snd_soc_tplg_vendor_value_elem *velem = elem; u32 *val = (u32 *)((u8 *)object + offset); @@ -487,7 +486,7 @@ static int get_token_u32(void *elem, void *object, u32 offset, u32 size) return 0; } -static int get_token_u16(void *elem, void *object, u32 offset, u32 size) +static int get_token_u16(void *elem, void *object, u32 offset) { struct snd_soc_tplg_vendor_value_elem *velem = elem; u16 *val = (u16 *)((u8 *)object + offset); @@ -496,7 +495,7 @@ static int get_token_u16(void *elem, void *object, u32 offset, u32 size) return 0; } -static int get_token_uuid(void *elem, void *object, u32 offset, u32 size) +static int get_token_uuid(void *elem, void *object, u32 offset) { struct snd_soc_tplg_vendor_uuid_elem *velem = elem; u8 *dst = (u8 *)object + offset; @@ -506,7 +505,7 @@ static int get_token_uuid(void *elem, void *object, u32 offset, u32 size) return 0; } -static int get_token_comp_format(void *elem, void *object, u32 offset, u32 size) +static int get_token_comp_format(void *elem, void *object, u32 offset) { struct snd_soc_tplg_vendor_string_elem *velem = elem; u32 *val = (u32 *)((u8 *)object + offset); @@ -515,7 +514,7 @@ static int get_token_comp_format(void *elem, void *object, u32 offset, u32 size) return 0; } -static int get_token_dai_type(void *elem, void *object, u32 offset, u32 size) +static int get_token_dai_type(void *elem, void *object, u32 offset) { struct snd_soc_tplg_vendor_string_elem *velem = elem; u32 *val = (u32 *)((u8 *)object + offset); @@ -524,8 +523,7 @@ static int get_token_dai_type(void *elem, void *object, u32 offset, u32 size) return 0; } -static int get_token_process_type(void *elem, void *object, u32 offset, - u32 size) +static int get_token_process_type(void *elem, void *object, u32 offset) { struct snd_soc_tplg_vendor_string_elem *velem = elem; u32 *val = (u32 *)((u8 *)object + offset); @@ -537,80 +535,80 @@ static int get_token_process_type(void *elem, void *object, u32 offset, /* Buffers */ static const struct sof_topology_token buffer_tokens[] = { {SOF_TKN_BUF_SIZE, SND_SOC_TPLG_TUPLE_TYPE_WORD, get_token_u32, - offsetof(struct sof_ipc_buffer, size), 0}, + offsetof(struct sof_ipc_buffer, size)}, {SOF_TKN_BUF_CAPS, SND_SOC_TPLG_TUPLE_TYPE_WORD, get_token_u32, - offsetof(struct sof_ipc_buffer, caps), 0}, + offsetof(struct sof_ipc_buffer, caps)}, }; /* DAI */ static const struct sof_topology_token dai_tokens[] = { {SOF_TKN_DAI_TYPE, SND_SOC_TPLG_TUPLE_TYPE_STRING, get_token_dai_type, - offsetof(struct sof_ipc_comp_dai, type), 0}, + offsetof(struct sof_ipc_comp_dai, type)}, {SOF_TKN_DAI_INDEX, SND_SOC_TPLG_TUPLE_TYPE_WORD, get_token_u32, - offsetof(struct sof_ipc_comp_dai, dai_index), 0}, + offsetof(struct sof_ipc_comp_dai, dai_index)}, {SOF_TKN_DAI_DIRECTION, SND_SOC_TPLG_TUPLE_TYPE_WORD, get_token_u32, - offsetof(struct sof_ipc_comp_dai, direction), 0}, + offsetof(struct sof_ipc_comp_dai, direction)}, }; /* BE DAI link */ static const struct sof_topology_token dai_link_tokens[] = { {SOF_TKN_DAI_TYPE, SND_SOC_TPLG_TUPLE_TYPE_STRING, get_token_dai_type, - offsetof(struct sof_ipc_dai_config, type), 0}, + offsetof(struct sof_ipc_dai_config, type)}, {SOF_TKN_DAI_INDEX, SND_SOC_TPLG_TUPLE_TYPE_WORD, get_token_u32, - offsetof(struct sof_ipc_dai_config, dai_index), 0}, + offsetof(struct sof_ipc_dai_config, dai_index)}, }; /* scheduling */ static const struct sof_topology_token sched_tokens[] = { {SOF_TKN_SCHED_PERIOD, SND_SOC_TPLG_TUPLE_TYPE_WORD, get_token_u32, - offsetof(struct sof_ipc_pipe_new, period), 0}, + offsetof(struct sof_ipc_pipe_new, period)}, {SOF_TKN_SCHED_PRIORITY, SND_SOC_TPLG_TUPLE_TYPE_WORD, get_token_u32, - offsetof(struct sof_ipc_pipe_new, priority), 0}, + offsetof(struct sof_ipc_pipe_new, priority)}, {SOF_TKN_SCHED_MIPS, SND_SOC_TPLG_TUPLE_TYPE_WORD, get_token_u32, - offsetof(struct sof_ipc_pipe_new, period_mips), 0}, + offsetof(struct sof_ipc_pipe_new, period_mips)}, {SOF_TKN_SCHED_CORE, SND_SOC_TPLG_TUPLE_TYPE_WORD, get_token_u32, - offsetof(struct sof_ipc_pipe_new, core), 0}, + offsetof(struct sof_ipc_pipe_new, core)}, {SOF_TKN_SCHED_FRAMES, SND_SOC_TPLG_TUPLE_TYPE_WORD, get_token_u32, - offsetof(struct sof_ipc_pipe_new, frames_per_sched), 0}, + offsetof(struct sof_ipc_pipe_new, frames_per_sched)}, {SOF_TKN_SCHED_TIME_DOMAIN, SND_SOC_TPLG_TUPLE_TYPE_WORD, get_token_u32, - offsetof(struct sof_ipc_pipe_new, time_domain), 0}, + offsetof(struct sof_ipc_pipe_new, time_domain)}, }; static const struct sof_topology_token pipeline_tokens[] = { {SOF_TKN_SCHED_DYNAMIC_PIPELINE, SND_SOC_TPLG_TUPLE_TYPE_BOOL, get_token_u16, - offsetof(struct snd_sof_widget, dynamic_pipeline_widget), 0}, + offsetof(struct snd_sof_widget, dynamic_pipeline_widget)}, }; /* volume */ static const struct sof_topology_token volume_tokens[] = { {SOF_TKN_VOLUME_RAMP_STEP_TYPE, SND_SOC_TPLG_TUPLE_TYPE_WORD, - get_token_u32, offsetof(struct sof_ipc_comp_volume, ramp), 0}, + get_token_u32, offsetof(struct sof_ipc_comp_volume, ramp)}, {SOF_TKN_VOLUME_RAMP_STEP_MS, SND_SOC_TPLG_TUPLE_TYPE_WORD, get_token_u32, - offsetof(struct sof_ipc_comp_volume, initial_ramp), 0}, + offsetof(struct sof_ipc_comp_volume, initial_ramp)}, }; /* SRC */ static const struct sof_topology_token src_tokens[] = { {SOF_TKN_SRC_RATE_IN, SND_SOC_TPLG_TUPLE_TYPE_WORD, get_token_u32, - offsetof(struct sof_ipc_comp_src, source_rate), 0}, + offsetof(struct sof_ipc_comp_src, source_rate)}, {SOF_TKN_SRC_RATE_OUT, SND_SOC_TPLG_TUPLE_TYPE_WORD, get_token_u32, - offsetof(struct sof_ipc_comp_src, sink_rate), 0}, + offsetof(struct sof_ipc_comp_src, sink_rate)}, }; /* ASRC */ static const struct sof_topology_token asrc_tokens[] = { {SOF_TKN_ASRC_RATE_IN, SND_SOC_TPLG_TUPLE_TYPE_WORD, get_token_u32, - offsetof(struct sof_ipc_comp_asrc, source_rate), 0}, + offsetof(struct sof_ipc_comp_asrc, source_rate)}, {SOF_TKN_ASRC_RATE_OUT, SND_SOC_TPLG_TUPLE_TYPE_WORD, get_token_u32, - offsetof(struct sof_ipc_comp_asrc, sink_rate), 0}, + offsetof(struct sof_ipc_comp_asrc, sink_rate)}, {SOF_TKN_ASRC_ASYNCHRONOUS_MODE, SND_SOC_TPLG_TUPLE_TYPE_WORD, get_token_u32, - offsetof(struct sof_ipc_comp_asrc, asynchronous_mode), 0}, + offsetof(struct sof_ipc_comp_asrc, asynchronous_mode)}, {SOF_TKN_ASRC_OPERATION_MODE, SND_SOC_TPLG_TUPLE_TYPE_WORD, get_token_u32, - offsetof(struct sof_ipc_comp_asrc, operation_mode), 0}, + offsetof(struct sof_ipc_comp_asrc, operation_mode)}, }; /* Tone */ @@ -621,62 +619,62 @@ static const struct sof_topology_token tone_tokens[] = { static const struct sof_topology_token process_tokens[] = { {SOF_TKN_PROCESS_TYPE, SND_SOC_TPLG_TUPLE_TYPE_STRING, get_token_process_type, - offsetof(struct sof_ipc_comp_process, type), 0}, + offsetof(struct sof_ipc_comp_process, type)}, }; /* PCM */ static const struct sof_topology_token pcm_tokens[] = { {SOF_TKN_PCM_DMAC_CONFIG, SND_SOC_TPLG_TUPLE_TYPE_WORD, get_token_u32, - offsetof(struct sof_ipc_comp_host, dmac_config), 0}, + offsetof(struct sof_ipc_comp_host, dmac_config)}, }; /* PCM */ static const struct sof_topology_token stream_tokens[] = { {SOF_TKN_STREAM_PLAYBACK_COMPATIBLE_D0I3, SND_SOC_TPLG_TUPLE_TYPE_BOOL, get_token_u16, - offsetof(struct snd_sof_pcm, stream[0].d0i3_compatible), 0}, + offsetof(struct snd_sof_pcm, stream[0].d0i3_compatible)}, {SOF_TKN_STREAM_CAPTURE_COMPATIBLE_D0I3, SND_SOC_TPLG_TUPLE_TYPE_BOOL, get_token_u16, - offsetof(struct snd_sof_pcm, stream[1].d0i3_compatible), 0}, + offsetof(struct snd_sof_pcm, stream[1].d0i3_compatible)}, }; /* Generic components */ static const struct sof_topology_token comp_tokens[] = { {SOF_TKN_COMP_PERIOD_SINK_COUNT, SND_SOC_TPLG_TUPLE_TYPE_WORD, get_token_u32, - offsetof(struct sof_ipc_comp_config, periods_sink), 0}, + offsetof(struct sof_ipc_comp_config, periods_sink)}, {SOF_TKN_COMP_PERIOD_SOURCE_COUNT, SND_SOC_TPLG_TUPLE_TYPE_WORD, get_token_u32, - offsetof(struct sof_ipc_comp_config, periods_source), 0}, + offsetof(struct sof_ipc_comp_config, periods_source)}, {SOF_TKN_COMP_FORMAT, SND_SOC_TPLG_TUPLE_TYPE_STRING, get_token_comp_format, - offsetof(struct sof_ipc_comp_config, frame_fmt), 0}, + offsetof(struct sof_ipc_comp_config, frame_fmt)}, }; /* SSP */ static const struct sof_topology_token ssp_tokens[] = { {SOF_TKN_INTEL_SSP_CLKS_CONTROL, SND_SOC_TPLG_TUPLE_TYPE_WORD, get_token_u32, - offsetof(struct sof_ipc_dai_ssp_params, clks_control), 0}, + offsetof(struct sof_ipc_dai_ssp_params, clks_control)}, {SOF_TKN_INTEL_SSP_MCLK_ID, SND_SOC_TPLG_TUPLE_TYPE_SHORT, get_token_u16, - offsetof(struct sof_ipc_dai_ssp_params, mclk_id), 0}, + offsetof(struct sof_ipc_dai_ssp_params, mclk_id)}, {SOF_TKN_INTEL_SSP_SAMPLE_BITS, SND_SOC_TPLG_TUPLE_TYPE_WORD, get_token_u32, - offsetof(struct sof_ipc_dai_ssp_params, sample_valid_bits), 0}, + offsetof(struct sof_ipc_dai_ssp_params, sample_valid_bits)}, {SOF_TKN_INTEL_SSP_FRAME_PULSE_WIDTH, SND_SOC_TPLG_TUPLE_TYPE_SHORT, get_token_u16, - offsetof(struct sof_ipc_dai_ssp_params, frame_pulse_width), 0}, + offsetof(struct sof_ipc_dai_ssp_params, frame_pulse_width)}, {SOF_TKN_INTEL_SSP_QUIRKS, SND_SOC_TPLG_TUPLE_TYPE_WORD, get_token_u32, - offsetof(struct sof_ipc_dai_ssp_params, quirks), 0}, + offsetof(struct sof_ipc_dai_ssp_params, quirks)}, {SOF_TKN_INTEL_SSP_TDM_PADDING_PER_SLOT, SND_SOC_TPLG_TUPLE_TYPE_BOOL, get_token_u16, offsetof(struct sof_ipc_dai_ssp_params, - tdm_per_slot_padding_flag), 0}, + tdm_per_slot_padding_flag)}, {SOF_TKN_INTEL_SSP_BCLK_DELAY, SND_SOC_TPLG_TUPLE_TYPE_WORD, get_token_u32, - offsetof(struct sof_ipc_dai_ssp_params, bclk_delay), 0}, + offsetof(struct sof_ipc_dai_ssp_params, bclk_delay)}, }; @@ -684,43 +682,42 @@ static const struct sof_topology_token ssp_tokens[] = { static const struct sof_topology_token alh_tokens[] = { {SOF_TKN_INTEL_ALH_RATE, SND_SOC_TPLG_TUPLE_TYPE_WORD, get_token_u32, - offsetof(struct sof_ipc_dai_alh_params, rate), 0}, + offsetof(struct sof_ipc_dai_alh_params, rate)}, {SOF_TKN_INTEL_ALH_CH, SND_SOC_TPLG_TUPLE_TYPE_WORD, get_token_u32, - offsetof(struct sof_ipc_dai_alh_params, channels), 0}, + offsetof(struct sof_ipc_dai_alh_params, channels)}, }; /* DMIC */ static const struct sof_topology_token dmic_tokens[] = { {SOF_TKN_INTEL_DMIC_DRIVER_VERSION, SND_SOC_TPLG_TUPLE_TYPE_WORD, get_token_u32, - offsetof(struct sof_ipc_dai_dmic_params, driver_ipc_version), - 0}, + offsetof(struct sof_ipc_dai_dmic_params, driver_ipc_version)}, {SOF_TKN_INTEL_DMIC_CLK_MIN, SND_SOC_TPLG_TUPLE_TYPE_WORD, get_token_u32, - offsetof(struct sof_ipc_dai_dmic_params, pdmclk_min), 0}, + offsetof(struct sof_ipc_dai_dmic_params, pdmclk_min)}, {SOF_TKN_INTEL_DMIC_CLK_MAX, SND_SOC_TPLG_TUPLE_TYPE_WORD, get_token_u32, - offsetof(struct sof_ipc_dai_dmic_params, pdmclk_max), 0}, + offsetof(struct sof_ipc_dai_dmic_params, pdmclk_max)}, {SOF_TKN_INTEL_DMIC_SAMPLE_RATE, SND_SOC_TPLG_TUPLE_TYPE_WORD, get_token_u32, - offsetof(struct sof_ipc_dai_dmic_params, fifo_fs), 0}, + offsetof(struct sof_ipc_dai_dmic_params, fifo_fs)}, {SOF_TKN_INTEL_DMIC_DUTY_MIN, SND_SOC_TPLG_TUPLE_TYPE_SHORT, get_token_u16, - offsetof(struct sof_ipc_dai_dmic_params, duty_min), 0}, + offsetof(struct sof_ipc_dai_dmic_params, duty_min)}, {SOF_TKN_INTEL_DMIC_DUTY_MAX, SND_SOC_TPLG_TUPLE_TYPE_SHORT, get_token_u16, - offsetof(struct sof_ipc_dai_dmic_params, duty_max), 0}, + offsetof(struct sof_ipc_dai_dmic_params, duty_max)}, {SOF_TKN_INTEL_DMIC_NUM_PDM_ACTIVE, SND_SOC_TPLG_TUPLE_TYPE_WORD, get_token_u32, offsetof(struct sof_ipc_dai_dmic_params, - num_pdm_active), 0}, + num_pdm_active)}, {SOF_TKN_INTEL_DMIC_FIFO_WORD_LENGTH, SND_SOC_TPLG_TUPLE_TYPE_SHORT, get_token_u16, - offsetof(struct sof_ipc_dai_dmic_params, fifo_bits), 0}, + offsetof(struct sof_ipc_dai_dmic_params, fifo_bits)}, {SOF_TKN_INTEL_DMIC_UNMUTE_RAMP_TIME_MS, SND_SOC_TPLG_TUPLE_TYPE_WORD, get_token_u32, - offsetof(struct sof_ipc_dai_dmic_params, unmute_ramp_time), 0}, + offsetof(struct sof_ipc_dai_dmic_params, unmute_ramp_time)}, }; @@ -728,28 +725,28 @@ static const struct sof_topology_token dmic_tokens[] = { static const struct sof_topology_token esai_tokens[] = { {SOF_TKN_IMX_ESAI_MCLK_ID, SND_SOC_TPLG_TUPLE_TYPE_SHORT, get_token_u16, - offsetof(struct sof_ipc_dai_esai_params, mclk_id), 0}, + offsetof(struct sof_ipc_dai_esai_params, mclk_id)}, }; /* SAI */ static const struct sof_topology_token sai_tokens[] = { {SOF_TKN_IMX_SAI_MCLK_ID, SND_SOC_TPLG_TUPLE_TYPE_SHORT, get_token_u16, - offsetof(struct sof_ipc_dai_sai_params, mclk_id), 0}, + offsetof(struct sof_ipc_dai_sai_params, mclk_id)}, }; /* Core tokens */ static const struct sof_topology_token core_tokens[] = { {SOF_TKN_COMP_CORE_ID, SND_SOC_TPLG_TUPLE_TYPE_WORD, get_token_u32, - offsetof(struct sof_ipc_comp, core), 0}, + offsetof(struct sof_ipc_comp, core)}, }; /* Component extended tokens */ static const struct sof_topology_token comp_ext_tokens[] = { {SOF_TKN_COMP_UUID, SND_SOC_TPLG_TUPLE_TYPE_UUID, get_token_uuid, - offsetof(struct sof_ipc_comp_ext, uuid), 0}, + offsetof(struct sof_ipc_comp_ext, uuid)}, }; /* @@ -761,63 +758,56 @@ static const struct sof_topology_token comp_ext_tokens[] = { static const struct sof_topology_token dmic_pdm_tokens[] = { {SOF_TKN_INTEL_DMIC_PDM_CTRL_ID, SND_SOC_TPLG_TUPLE_TYPE_SHORT, get_token_u16, - offsetof(struct sof_ipc_dai_dmic_pdm_ctrl, id), - 0}, + offsetof(struct sof_ipc_dai_dmic_pdm_ctrl, id),}, {SOF_TKN_INTEL_DMIC_PDM_MIC_A_Enable, SND_SOC_TPLG_TUPLE_TYPE_SHORT, get_token_u16, - offsetof(struct sof_ipc_dai_dmic_pdm_ctrl, enable_mic_a), - 0}, + offsetof(struct sof_ipc_dai_dmic_pdm_ctrl, enable_mic_a)}, {SOF_TKN_INTEL_DMIC_PDM_MIC_B_Enable, SND_SOC_TPLG_TUPLE_TYPE_SHORT, get_token_u16, - offsetof(struct sof_ipc_dai_dmic_pdm_ctrl, enable_mic_b), - 0}, + offsetof(struct sof_ipc_dai_dmic_pdm_ctrl, enable_mic_b)}, {SOF_TKN_INTEL_DMIC_PDM_POLARITY_A, SND_SOC_TPLG_TUPLE_TYPE_SHORT, get_token_u16, - offsetof(struct sof_ipc_dai_dmic_pdm_ctrl, polarity_mic_a), - 0}, + offsetof(struct sof_ipc_dai_dmic_pdm_ctrl, polarity_mic_a)}, {SOF_TKN_INTEL_DMIC_PDM_POLARITY_B, SND_SOC_TPLG_TUPLE_TYPE_SHORT, get_token_u16, - offsetof(struct sof_ipc_dai_dmic_pdm_ctrl, polarity_mic_b), - 0}, + offsetof(struct sof_ipc_dai_dmic_pdm_ctrl, polarity_mic_b)}, {SOF_TKN_INTEL_DMIC_PDM_CLK_EDGE, SND_SOC_TPLG_TUPLE_TYPE_SHORT, get_token_u16, - offsetof(struct sof_ipc_dai_dmic_pdm_ctrl, clk_edge), - 0}, + offsetof(struct sof_ipc_dai_dmic_pdm_ctrl, clk_edge)}, {SOF_TKN_INTEL_DMIC_PDM_SKEW, SND_SOC_TPLG_TUPLE_TYPE_SHORT, get_token_u16, - offsetof(struct sof_ipc_dai_dmic_pdm_ctrl, skew), - 0}, + offsetof(struct sof_ipc_dai_dmic_pdm_ctrl, skew)}, }; /* HDA */ static const struct sof_topology_token hda_tokens[] = { {SOF_TKN_INTEL_HDA_RATE, SND_SOC_TPLG_TUPLE_TYPE_WORD, get_token_u32, - offsetof(struct sof_ipc_dai_hda_params, rate), 0}, + offsetof(struct sof_ipc_dai_hda_params, rate)}, {SOF_TKN_INTEL_HDA_CH, SND_SOC_TPLG_TUPLE_TYPE_WORD, get_token_u32, - offsetof(struct sof_ipc_dai_hda_params, channels), 0}, + offsetof(struct sof_ipc_dai_hda_params, channels)}, }; /* Leds */ static const struct sof_topology_token led_tokens[] = { {SOF_TKN_MUTE_LED_USE, SND_SOC_TPLG_TUPLE_TYPE_WORD, get_token_u32, - offsetof(struct snd_sof_led_control, use_led), 0}, + offsetof(struct snd_sof_led_control, use_led)}, {SOF_TKN_MUTE_LED_DIRECTION, SND_SOC_TPLG_TUPLE_TYPE_WORD, - get_token_u32, offsetof(struct snd_sof_led_control, direction), 0}, + get_token_u32, offsetof(struct snd_sof_led_control, direction)}, }; /* AFE */ static const struct sof_topology_token afe_tokens[] = { {SOF_TKN_MEDIATEK_AFE_RATE, SND_SOC_TPLG_TUPLE_TYPE_WORD, get_token_u32, - offsetof(struct sof_ipc_dai_mtk_afe_params, rate), 0}, + offsetof(struct sof_ipc_dai_mtk_afe_params, rate)}, {SOF_TKN_MEDIATEK_AFE_CH, SND_SOC_TPLG_TUPLE_TYPE_WORD, get_token_u32, - offsetof(struct sof_ipc_dai_mtk_afe_params, channels), 0}, + offsetof(struct sof_ipc_dai_mtk_afe_params, channels)}, {SOF_TKN_MEDIATEK_AFE_FORMAT, SND_SOC_TPLG_TUPLE_TYPE_STRING, get_token_comp_format, - offsetof(struct sof_ipc_dai_mtk_afe_params, format), 0}, + offsetof(struct sof_ipc_dai_mtk_afe_params, format)}, }; static int sof_parse_uuid_tokens(struct snd_soc_component *scomp, @@ -847,8 +837,7 @@ static int sof_parse_uuid_tokens(struct snd_soc_component *scomp, /* matched - now load token */ tokens[j].get_token(elem, object, - offset + tokens[j].offset, - tokens[j].size); + offset + tokens[j].offset); found++; } @@ -884,8 +873,7 @@ static int sof_parse_string_tokens(struct snd_soc_component *scomp, /* matched - now load token */ tokens[j].get_token(elem, object, - offset + tokens[j].offset, - tokens[j].size); + offset + tokens[j].offset); found++; } @@ -924,8 +912,7 @@ static int sof_parse_word_tokens(struct snd_soc_component *scomp, /* load token */ tokens[j].get_token(elem, object, - offset + tokens[j].offset, - tokens[j].size); + offset + tokens[j].offset); found++; } From patchwork Mon Mar 7 18:11:01 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Ranjani Sridharan X-Patchwork-Id: 549345 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 2EF26C433FE for ; Mon, 7 Mar 2022 18:13:22 +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 8E621175D; Mon, 7 Mar 2022 19:12:28 +0100 (CET) DKIM-Filter: OpenDKIM Filter v2.11.0 alsa0.perex.cz 8E621175D DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=alsa-project.org; s=default; t=1646676798; bh=OdwpZhnkH3fsn24S2qyNFERuNq4To+pJrSgKfRredho=; h=From:To:Subject:Date:In-Reply-To:References:Cc:List-Id: List-Unsubscribe:List-Archive:List-Post:List-Help:List-Subscribe: From; b=nIk86Hli/CkIsurIGS10zgYoa72P1aSgjWrrqB27hdMJ25zg9fKJGBWIvIMDCTW71 Pzkk6zGVFRgetzevgqJPMNdcbh0+Hro4TgT8vZNhzLKbxjM9MEUxh0excR55AE3x8O AIJObkUBYwPLdo9v8k5usNz+SdKhjWdp4gIwNwJg= Received: from alsa1.perex.cz (localhost.localdomain [127.0.0.1]) by alsa1.perex.cz (Postfix) with ESMTP id 6AE2FF8052E; Mon, 7 Mar 2022 19:11:40 +0100 (CET) Received: by alsa1.perex.cz (Postfix, from userid 50401) id 53442F80529; 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 B68C9F802DF for ; Mon, 7 Mar 2022 19:11:32 +0100 (CET) DKIM-Filter: OpenDKIM Filter v2.11.0 alsa1.perex.cz B68C9F802DF Authentication-Results: alsa1.perex.cz; dkim=pass (2048-bit key) header.d=intel.com header.i=@intel.com header.b="hefbRIKn" DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1646676693; x=1678212693; h=from:to:cc:subject:date:message-id:in-reply-to: references:mime-version:content-transfer-encoding; bh=OdwpZhnkH3fsn24S2qyNFERuNq4To+pJrSgKfRredho=; b=hefbRIKnk9VkHGjLZx7nTI+Fmu7EaMJInqGFJ0Bo0L4hSX+bEU058Awe twGeGXcbe7a0Fvenygq4LEpivdKD9RI7fL8iVWJKIlLmmdstLvcokCpCd ZO1kl81SANqIOuq7IWuQyPb6iuP6uT5lwNhVPjjlzbkfnfeaDHbpKNMXo YKUbdnuEfRzMex6fKQhQX2/UmZDnJLOZuzU4aYmAE/q8LGgAoaTLlK3QN B7YKedV3a9QlI6+BiNYWYMAKCaj5+Ri1lbCbrAiyIxiRZe9eEmFrMNTS/ OBRvjQapnwWU2wKw5+tv/LZxxco0jbQBupsq4cx/hy0rHcDt91nvJUrUl A==; X-IronPort-AV: E=McAfee;i="6200,9189,10279"; a="254401321" X-IronPort-AV: E=Sophos;i="5.90,162,1643702400"; d="scan'208";a="254401321" 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:27 -0800 X-IronPort-AV: E=Sophos;i="5.90,162,1643702400"; d="scan'208";a="495146669" 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:27 -0800 From: Ranjani Sridharan To: alsa-devel@alsa-project.org Subject: [PATCH 08/18] ASoC: SOF: topology: Modify the get_token op for string tokens Date: Mon, 7 Mar 2022 10:11:01 -0800 Message-Id: <20220307181111.49392-9-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, Bard Liao , Ranjani Sridharan , Pierre-Louis Bossart , broonie@kernel.org, =?utf-8?q?P=C3=A9ter_Ujfalusi?= 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" Modify the get_token op for string type tokens to pass the string as the argument instead of a pointer to struct snd_soc_tplg_vendor_string_elem. Signed-off-by: Ranjani Sridharan Reviewed-by: Bard Liao Reviewed-by: Péter Ujfalusi Reviewed-by: Pierre-Louis Bossart --- sound/soc/sof/topology.c | 12 ++++-------- 1 file changed, 4 insertions(+), 8 deletions(-) diff --git a/sound/soc/sof/topology.c b/sound/soc/sof/topology.c index 7280e14c13bc..4ba46ea73c8a 100644 --- a/sound/soc/sof/topology.c +++ b/sound/soc/sof/topology.c @@ -507,28 +507,25 @@ static int get_token_uuid(void *elem, void *object, u32 offset) static int get_token_comp_format(void *elem, void *object, u32 offset) { - struct snd_soc_tplg_vendor_string_elem *velem = elem; u32 *val = (u32 *)((u8 *)object + offset); - *val = find_format(velem->string); + *val = find_format((const char *)elem); return 0; } static int get_token_dai_type(void *elem, void *object, u32 offset) { - struct snd_soc_tplg_vendor_string_elem *velem = elem; u32 *val = (u32 *)((u8 *)object + offset); - *val = find_dai(velem->string); + *val = find_dai((const char *)elem); return 0; } static int get_token_process_type(void *elem, void *object, u32 offset) { - struct snd_soc_tplg_vendor_string_elem *velem = elem; u32 *val = (u32 *)((u8 *)object + offset); - *val = find_process(velem->string); + *val = find_process((const char *)elem); return 0; } @@ -872,8 +869,7 @@ static int sof_parse_string_tokens(struct snd_soc_component *scomp, continue; /* matched - now load token */ - tokens[j].get_token(elem, object, - offset + tokens[j].offset); + tokens[j].get_token(elem->string, object, offset + tokens[j].offset); found++; } From patchwork Mon Mar 7 18:11:02 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Ranjani Sridharan X-Patchwork-Id: 549343 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 0A017C433F5 for ; Mon, 7 Mar 2022 18:14:34 +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 DD29A17A3; Mon, 7 Mar 2022 19:13:41 +0100 (CET) DKIM-Filter: OpenDKIM Filter v2.11.0 alsa0.perex.cz DD29A17A3 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=alsa-project.org; s=default; t=1646676871; bh=UVmT4vGTjHXhvY2uwKjrUYIq7VIV4m+y5CyPjaSCAus=; h=From:To:Subject:Date:In-Reply-To:References:Cc:List-Id: List-Unsubscribe:List-Archive:List-Post:List-Help:List-Subscribe: From; b=q2untmysY5uWyKqtz/rlXR8ghub/rTfO9tCVYf+2H5BVgg1WO6hDr4F2EmdYl4IFT mMSyHWEOab8sAuQc0iIY0GdrBbRrt0Sm+DoKHpLxozkPkt+nWQwCrnW9Lz5D2lVSfy c1sGfiTLTzqYB5CU8cbkENP73vVZ4FSS3HISLwAM= Received: from alsa1.perex.cz (localhost.localdomain [127.0.0.1]) by alsa1.perex.cz (Postfix) with ESMTP id 353DFF8053B; Mon, 7 Mar 2022 19:11:48 +0100 (CET) Received: by alsa1.perex.cz (Postfix, from userid 50401) id ED4EDF80516; Mon, 7 Mar 2022 19:11:41 +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 54BA8F80515 for ; Mon, 7 Mar 2022 19:11:33 +0100 (CET) DKIM-Filter: OpenDKIM Filter v2.11.0 alsa1.perex.cz 54BA8F80515 Authentication-Results: alsa1.perex.cz; dkim=pass (2048-bit key) header.d=intel.com header.i=@intel.com header.b="ce7FlvYF" DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1646676694; x=1678212694; h=from:to:cc:subject:date:message-id:in-reply-to: references:mime-version:content-transfer-encoding; bh=UVmT4vGTjHXhvY2uwKjrUYIq7VIV4m+y5CyPjaSCAus=; b=ce7FlvYFDcNChWEhIDxwDmJVVW76edf193PO/9e9e+zcUa0iRGWBPkZq V29OAPuLVKyIt+GEahmBih3RLlgI6+w2klyqqv1bbCk7CzICyw96QfS3B YUQKenhWvc6bgK2YPvgO/5NPG5qHPdkmZU7vtcM4+WK67tkXYB5riBDNS 5EB0s3s2hkeL3/S0OkZRuS5L7ef4gnRu+ki9nfk7FxFBq/gUfpWwacqd9 YGg+ujqS2e/gjO+eQOUbOcXla9H+x9TL+IsFRRX7Sqh370S5t9dYTaIGq TlR36+F5WcO2jkCbgXOlMHlibKhAgWlMR0L/ENkRgiAkA8O6DaiNLNPuU w==; X-IronPort-AV: E=McAfee;i="6200,9189,10279"; a="254401325" X-IronPort-AV: E=Sophos;i="5.90,162,1643702400"; d="scan'208";a="254401325" 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:27 -0800 X-IronPort-AV: E=Sophos;i="5.90,162,1643702400"; d="scan'208";a="495146671" 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:27 -0800 From: Ranjani Sridharan To: alsa-devel@alsa-project.org Subject: [PATCH 09/18] ASoC: SOF: topology: expose some get_token ops Date: Mon, 7 Mar 2022 10:11:02 -0800 Message-Id: <20220307181111.49392-10-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, Bard Liao , Ranjani Sridharan , Pierre-Louis Bossart , broonie@kernel.org, =?utf-8?q?P=C3=A9ter_Ujfalusi?= 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" These will be used later on by IPC-specific code. Signed-off-by: Ranjani Sridharan Reviewed-by: Bard Liao Reviewed-by: Péter Ujfalusi Reviewed-by: Pierre-Louis Bossart --- sound/soc/sof/sof-audio.h | 5 +++++ sound/soc/sof/topology.c | 10 +++++----- 2 files changed, 10 insertions(+), 5 deletions(-) diff --git a/sound/soc/sof/sof-audio.h b/sound/soc/sof/sof-audio.h index f2f32f2065d3..feda5793b589 100644 --- a/sound/soc/sof/sof-audio.h +++ b/sound/soc/sof/sof-audio.h @@ -260,4 +260,9 @@ int sof_pcm_dsp_pcm_free(struct snd_pcm_substream *substream, struct snd_sof_dev struct snd_sof_pcm *spcm); int sof_pcm_stream_free(struct snd_sof_dev *sdev, struct snd_pcm_substream *substream, struct snd_sof_pcm *spcm, int dir, bool free_widget_list); +int get_token_u32(void *elem, void *object, u32 offset); +int get_token_u16(void *elem, void *object, u32 offset); +int get_token_comp_format(void *elem, void *object, u32 offset); +int get_token_dai_type(void *elem, void *object, u32 offset); +int get_token_uuid(void *elem, void *object, u32 offset); #endif diff --git a/sound/soc/sof/topology.c b/sound/soc/sof/topology.c index 4ba46ea73c8a..dd1cc6e26686 100644 --- a/sound/soc/sof/topology.c +++ b/sound/soc/sof/topology.c @@ -477,7 +477,7 @@ struct sof_topology_token { u32 offset; }; -static int get_token_u32(void *elem, void *object, u32 offset) +int get_token_u32(void *elem, void *object, u32 offset) { struct snd_soc_tplg_vendor_value_elem *velem = elem; u32 *val = (u32 *)((u8 *)object + offset); @@ -486,7 +486,7 @@ static int get_token_u32(void *elem, void *object, u32 offset) return 0; } -static int get_token_u16(void *elem, void *object, u32 offset) +int get_token_u16(void *elem, void *object, u32 offset) { struct snd_soc_tplg_vendor_value_elem *velem = elem; u16 *val = (u16 *)((u8 *)object + offset); @@ -495,7 +495,7 @@ static int get_token_u16(void *elem, void *object, u32 offset) return 0; } -static int get_token_uuid(void *elem, void *object, u32 offset) +int get_token_uuid(void *elem, void *object, u32 offset) { struct snd_soc_tplg_vendor_uuid_elem *velem = elem; u8 *dst = (u8 *)object + offset; @@ -505,7 +505,7 @@ static int get_token_uuid(void *elem, void *object, u32 offset) return 0; } -static int get_token_comp_format(void *elem, void *object, u32 offset) +int get_token_comp_format(void *elem, void *object, u32 offset) { u32 *val = (u32 *)((u8 *)object + offset); @@ -513,7 +513,7 @@ static int get_token_comp_format(void *elem, void *object, u32 offset) return 0; } -static int get_token_dai_type(void *elem, void *object, u32 offset) +int get_token_dai_type(void *elem, void *object, u32 offset) { u32 *val = (u32 *)((u8 *)object + offset); From patchwork Mon Mar 7 18:11:03 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Ranjani Sridharan X-Patchwork-Id: 548897 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 00D37C433EF for ; Mon, 7 Mar 2022 18:15:27 +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 45C21179B; Mon, 7 Mar 2022 19:14:36 +0100 (CET) DKIM-Filter: OpenDKIM Filter v2.11.0 alsa0.perex.cz 45C21179B DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=alsa-project.org; s=default; t=1646676926; bh=awRSYm/ShBm2AHHz0TLp7CG7IR19eAKuSH9xjSUavE0=; h=From:To:Subject:Date:In-Reply-To:References:Cc:List-Id: List-Unsubscribe:List-Archive:List-Post:List-Help:List-Subscribe: From; b=kCOKKsn/aNVFQWSka7ULjmeXamv0znc7O9WtmmuOvgzPPADC7mBl3P6IaK68X1Qh8 TGohfSbGD5SC/mUbu934NBx0+f4pMhiOfLUYnnOsnp/W2ZDxrRcrOQB9DHpCLVGcaX kGrgId+t94d7SKlTMtutPYDfQ9mnquzqcR2vJ5Xg= Received: from alsa1.perex.cz (localhost.localdomain [127.0.0.1]) by alsa1.perex.cz (Postfix) with ESMTP id 8C2EAF80558; Mon, 7 Mar 2022 19:11:52 +0100 (CET) Received: by alsa1.perex.cz (Postfix, from userid 50401) id A7588F80539; Mon, 7 Mar 2022 19:11:44 +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 AE75BF80132 for ; Mon, 7 Mar 2022 19:11:34 +0100 (CET) DKIM-Filter: OpenDKIM Filter v2.11.0 alsa1.perex.cz AE75BF80132 Authentication-Results: alsa1.perex.cz; dkim=pass (2048-bit key) header.d=intel.com header.i=@intel.com header.b="kBDHrDfr" DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1646676696; x=1678212696; h=from:to:cc:subject:date:message-id:in-reply-to: references:mime-version:content-transfer-encoding; bh=awRSYm/ShBm2AHHz0TLp7CG7IR19eAKuSH9xjSUavE0=; b=kBDHrDfrFoiVQI3HT8PFeKdAZHqY6gI9AZ530rVhstRvEeYHqMMmrmAr W81KNYncuZZ6QmHvMoCWzHbb8jbZFZIbw6fy/RsU6AEyAguURd2v6gnow LL0ACRNHNSQD5nopSUgCZdPg7bpt0NkDqSannZ/KcH5soFnbycwOUh9XC Efaz3HTfO+qWLO4Cpvu91pgp5FfpnNySuXmhiLWiUBrPebzvA/+fP57va nE+FP2mw20DjQZUVhRQD4ttTm9i5Seg/MixWXfW0qjl3IkyxBdND/xMQg MGdx/Jz6AA17LYZabC/OQPmBU0wX32WAqBbS0BKvUvEvjRxeSiKn+sn2z Q==; X-IronPort-AV: E=McAfee;i="6200,9189,10279"; a="254401328" X-IronPort-AV: E=Sophos;i="5.90,162,1643702400"; d="scan'208";a="254401328" 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:27 -0800 X-IronPort-AV: E=Sophos;i="5.90,162,1643702400"; d="scan'208";a="495146673" 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:27 -0800 From: Ranjani Sridharan To: alsa-devel@alsa-project.org Subject: [PATCH 10/18] ASoC: SOF: change comp_dai to a pointer in struct snd_sof_dai Date: Mon, 7 Mar 2022 10:11:03 -0800 Message-Id: <20220307181111.49392-11-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, Bard Liao , Ranjani Sridharan , Pierre-Louis Bossart , broonie@kernel.org, =?utf-8?q?P=C3=A9ter_Ujfalusi?= 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" This will avoid having to add the extended data for DAI components during sof_widget_setup() as an extra step. Signed-off-by: Ranjani Sridharan Reviewed-by: Bard Liao Reviewed-by: Péter Ujfalusi Reviewed-by: Pierre-Louis Bossart --- sound/soc/sof/pcm.c | 6 +++--- sound/soc/sof/sof-audio.c | 18 +++--------------- sound/soc/sof/sof-audio.h | 2 +- sound/soc/sof/topology.c | 17 +++++------------ 4 files changed, 12 insertions(+), 31 deletions(-) diff --git a/sound/soc/sof/pcm.c b/sound/soc/sof/pcm.c index a312ed855f1a..1d04f75e6d32 100644 --- a/sound/soc/sof/pcm.c +++ b/sound/soc/sof/pcm.c @@ -717,7 +717,7 @@ int sof_pcm_dai_link_fixup(struct snd_soc_pcm_runtime *rtd, struct snd_pcm_hw_pa /* read format from topology */ snd_mask_none(fmt); - switch (dai->comp_dai.config.frame_fmt) { + switch (dai->comp_dai->config.frame_fmt) { case SOF_IPC_FRAME_S16_LE: snd_mask_set_format(fmt, SNDRV_PCM_FORMAT_S16_LE); break; @@ -752,10 +752,10 @@ int sof_pcm_dai_link_fixup(struct snd_soc_pcm_runtime *rtd, struct snd_pcm_hw_pa break; case SOF_DAI_INTEL_DMIC: /* DMIC only supports 16 or 32 bit formats */ - if (dai->comp_dai.config.frame_fmt == SOF_IPC_FRAME_S24_4LE) { + if (dai->comp_dai->config.frame_fmt == SOF_IPC_FRAME_S24_4LE) { dev_err(component->dev, "error: invalid fmt %d for DAI type %d\n", - dai->comp_dai.config.frame_fmt, + dai->comp_dai->config.frame_fmt, dai->dai_config->type); } break; diff --git a/sound/soc/sof/sof-audio.c b/sound/soc/sof/sof-audio.c index e39f18e824b4..b49d8e348077 100644 --- a/sound/soc/sof/sof-audio.c +++ b/sound/soc/sof/sof-audio.c @@ -170,7 +170,6 @@ int sof_widget_setup(struct snd_sof_dev *sdev, struct snd_sof_widget *swidget) struct sof_ipc_cmd_hdr *hdr; struct sof_ipc_comp *comp; struct snd_sof_dai *dai; - size_t ipc_size; int ret; /* skip if there is no private data */ @@ -192,23 +191,12 @@ int sof_widget_setup(struct snd_sof_dev *sdev, struct snd_sof_widget *swidget) switch (swidget->id) { case snd_soc_dapm_dai_in: case snd_soc_dapm_dai_out: - ipc_size = sizeof(struct sof_ipc_comp_dai) + sizeof(struct sof_ipc_comp_ext); - comp = kzalloc(ipc_size, GFP_KERNEL); - if (!comp) { - ret = -ENOMEM; - goto core_put; - } - dai = swidget->private; + comp = &dai->comp_dai->comp; dai->configured = false; - memcpy(comp, &dai->comp_dai, sizeof(struct sof_ipc_comp_dai)); - /* append extended data to the end of the component */ - memcpy((u8 *)comp + sizeof(struct sof_ipc_comp_dai), &swidget->comp_ext, - sizeof(swidget->comp_ext)); - - ret = sof_ipc_tx_message(sdev->ipc, comp->hdr.cmd, comp, ipc_size, &r, sizeof(r)); - kfree(comp); + ret = sof_ipc_tx_message(sdev->ipc, comp->hdr.cmd, dai->comp_dai, comp->hdr.size, + &r, sizeof(r)); if (ret < 0) { dev_err(sdev->dev, "error: failed to load widget %s\n", swidget->widget->name); diff --git a/sound/soc/sof/sof-audio.h b/sound/soc/sof/sof-audio.h index feda5793b589..a8eeffc12b24 100644 --- a/sound/soc/sof/sof-audio.h +++ b/sound/soc/sof/sof-audio.h @@ -134,7 +134,7 @@ struct snd_sof_dai { struct snd_soc_component *scomp; const char *name; - struct sof_ipc_comp_dai comp_dai; + struct sof_ipc_comp_dai *comp_dai; int number_configs; int current_config; bool configured; /* DAI configured during BE hw_params */ diff --git a/sound/soc/sof/topology.c b/sound/soc/sof/topology.c index dd1cc6e26686..41927e99ace2 100644 --- a/sound/soc/sof/topology.c +++ b/sound/soc/sof/topology.c @@ -1478,7 +1478,7 @@ static int sof_widget_load_dai(struct snd_soc_component *scomp, int index, if (ret != 0) { dev_err(scomp->dev, "error: parse dai tokens failed %d\n", le32_to_cpu(private->size)); - goto finish; + return ret; } ret = sof_parse_tokens(scomp, &comp_dai->config, comp_tokens, @@ -1487,7 +1487,7 @@ static int sof_widget_load_dai(struct snd_soc_component *scomp, int index, if (ret != 0) { dev_err(scomp->dev, "error: parse dai.cfg tokens failed %d\n", private->size); - goto finish; + return ret; } dev_dbg(scomp->dev, "dai %s: type %d index %d\n", @@ -1496,17 +1496,9 @@ static int sof_widget_load_dai(struct snd_soc_component *scomp, int index, if (dai) { dai->scomp = scomp; - - /* - * copy only the sof_ipc_comp_dai to avoid collapsing - * the snd_sof_dai, the extended data is kept in the - * snd_sof_widget. - */ - memcpy(&dai->comp_dai, comp_dai, sizeof(*comp_dai)); + dai->comp_dai = comp_dai; } -finish: - kfree(comp_dai); return ret; } @@ -2429,6 +2421,7 @@ static int sof_widget_unload(struct snd_soc_component *scomp, dai = swidget->private; if (dai) { + kfree(dai->comp_dai); /* free dai config */ kfree(dai->dai_config); list_del(&dai->list); @@ -2668,7 +2661,7 @@ static int sof_set_dai_config_multi(struct snd_sof_dev *sdev, u32 size, * dai_index. */ for (i = 0; i < num_conf; i++) - config[i].dai_index = dai->comp_dai.dai_index; + config[i].dai_index = dai->comp_dai->dai_index; dev_dbg(sdev->dev, "set DAI config for %s index %d\n", dai->name, config[curr_conf].dai_index); From patchwork Mon Mar 7 18:11:04 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Ranjani Sridharan X-Patchwork-Id: 548896 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 0D541C433EF for ; Mon, 7 Mar 2022 18:16:03 +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 52C9D17AD; Mon, 7 Mar 2022 19:15:11 +0100 (CET) DKIM-Filter: OpenDKIM Filter v2.11.0 alsa0.perex.cz 52C9D17AD DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=alsa-project.org; s=default; t=1646676961; bh=NTLg35mDE2YZqrmU9AKIjvw1s1/TEiT+xyq1YULuL7k=; h=From:To:Subject:Date:In-Reply-To:References:Cc:List-Id: List-Unsubscribe:List-Archive:List-Post:List-Help:List-Subscribe: From; b=dKwMqEOXeEWRpesWmtwpiGejhGAX5g4+hnmt2Vp1PA0BNtqqPnRH/7qawjM3+zULi hL/ChcvO482Dw5wpEU88t+YcoTwe4BDyEmgPl++YcESu7IWwxkbkXl+fUbvG9AMIw7 /l1lwmEQMqzDU1eQHMP/3le57IDppxfLOPNDSWEY= Received: from alsa1.perex.cz (localhost.localdomain [127.0.0.1]) by alsa1.perex.cz (Postfix) with ESMTP id D0D00F80564; Mon, 7 Mar 2022 19:11:53 +0100 (CET) Received: by alsa1.perex.cz (Postfix, from userid 50401) id 3938BF80132; Mon, 7 Mar 2022 19:11:47 +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 0CADBF8051A for ; Mon, 7 Mar 2022 19:11:34 +0100 (CET) DKIM-Filter: OpenDKIM Filter v2.11.0 alsa1.perex.cz 0CADBF8051A Authentication-Results: alsa1.perex.cz; dkim=pass (2048-bit key) header.d=intel.com header.i=@intel.com header.b="WyTTqF15" DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1646676696; x=1678212696; h=from:to:cc:subject:date:message-id:in-reply-to: references:mime-version:content-transfer-encoding; bh=NTLg35mDE2YZqrmU9AKIjvw1s1/TEiT+xyq1YULuL7k=; b=WyTTqF15jv1b9YtCilZ8FHphbEq2MiHKP3fJt6ywjESoUolkPxSqFc7C 43g1sgkURasUiLL3V610m/XwIVL2hGQsNp4CjQjYDpbUWWoJLmvgLUjDu lut5zb5bP46XXieqr1znUzFLYS3FQxbVWL8hOyuQP6YD0WMoEflqrJMpd m4q69hcHodqmBeF7ZCD7H7KoJrC4muvou0Heg0shuy3E2PY44UeRY3X3O qKZPrazyWbSwYezjlMnkoZzQlhFyhWbO3aEiQJ9n3paUEv7BwMGMuiYrO dBJyLNL7SeQH2EnEjzqiKm/mkQIoyPaslTI4AtKe/cPfiqadcg0QB4Lqs g==; X-IronPort-AV: E=McAfee;i="6200,9189,10279"; a="254401330" X-IronPort-AV: E=Sophos;i="5.90,162,1643702400"; d="scan'208";a="254401330" 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:28 -0800 X-IronPort-AV: E=Sophos;i="5.90,162,1643702400"; d="scan'208";a="495146679" 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:27 -0800 From: Ranjani Sridharan To: alsa-devel@alsa-project.org Subject: [PATCH 11/18] ASoC: SOF: make struct snd_sof_widget IPC agnostic Date: Mon, 7 Mar 2022 10:11:04 -0800 Message-Id: <20220307181111.49392-12-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, Bard Liao , Ranjani Sridharan , Pierre-Louis Bossart , broonie@kernel.org, =?utf-8?q?P=C3=A9ter_Ujfalusi?= 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" Parse the UUID token and save it in the new uuid field in struct snd_sof_widget. struct sof_ipc_comp_ext is no longer needed. So remove it too. Signed-off-by: Ranjani Sridharan Reviewed-by: Bard Liao Reviewed-by: Péter Ujfalusi Reviewed-by: Pierre-Louis Bossart --- include/sound/sof/topology.h | 5 ----- sound/soc/sof/sof-audio.h | 3 +-- sound/soc/sof/topology.c | 20 ++++++++++---------- 3 files changed, 11 insertions(+), 17 deletions(-) diff --git a/include/sound/sof/topology.h b/include/sound/sof/topology.h index adee6afd1490..33bd9eaffd50 100644 --- a/include/sound/sof/topology.h +++ b/include/sound/sof/topology.h @@ -303,9 +303,4 @@ enum sof_event_types { SOF_KEYWORD_DETECT_DAPM_EVENT, }; -/* extended data struct for UUID components */ -struct sof_ipc_comp_ext { - uint8_t uuid[SOF_UUID_SIZE]; -} __packed; - #endif diff --git a/sound/soc/sof/sof-audio.h b/sound/soc/sof/sof-audio.h index a8eeffc12b24..5c10df500ffb 100644 --- a/sound/soc/sof/sof-audio.h +++ b/sound/soc/sof/sof-audio.h @@ -110,8 +110,7 @@ struct snd_sof_widget { struct list_head list; /* list in sdev widget list */ struct snd_sof_widget *pipe_widget; - /* extended data for UUID components */ - struct sof_ipc_comp_ext comp_ext; + u8 uuid[SOF_UUID_SIZE]; void *private; /* core does not touch this */ }; diff --git a/sound/soc/sof/topology.c b/sound/soc/sof/topology.c index 41927e99ace2..45bac1ac9fdd 100644 --- a/sound/soc/sof/topology.c +++ b/sound/soc/sof/topology.c @@ -743,7 +743,7 @@ static const struct sof_topology_token core_tokens[] = { static const struct sof_topology_token comp_ext_tokens[] = { {SOF_TKN_COMP_UUID, SND_SOC_TPLG_TUPLE_TYPE_UUID, get_token_uuid, - offsetof(struct sof_ipc_comp_ext, uuid)}, + offsetof(struct snd_sof_widget, uuid)}, }; /* @@ -1419,16 +1419,17 @@ static int sof_connect_dai_widget(struct snd_soc_component *scomp, * * Return: The pointer to the new allocated component, NULL if failed. */ -static struct sof_ipc_comp *sof_comp_alloc(struct snd_sof_widget *swidget, - size_t *ipc_size, int index) +static struct sof_ipc_comp *sof_comp_alloc(struct snd_sof_widget *swidget, size_t *ipc_size, + int index) { u8 nil_uuid[SOF_UUID_SIZE] = {0}; struct sof_ipc_comp *comp; size_t total_size = *ipc_size; + size_t ext_size = sizeof(swidget->uuid); /* only non-zero UUID is valid */ - if (memcmp(&swidget->comp_ext, nil_uuid, SOF_UUID_SIZE)) - total_size += sizeof(swidget->comp_ext); + if (memcmp(swidget->uuid, nil_uuid, SOF_UUID_SIZE)) + total_size += ext_size; comp = kzalloc(total_size, GFP_KERNEL); if (!comp) @@ -1444,8 +1445,8 @@ static struct sof_ipc_comp *sof_comp_alloc(struct snd_sof_widget *swidget, /* handle the extended data if needed */ if (total_size > *ipc_size) { /* append extended data to the end of the component */ - memcpy((u8 *)comp + *ipc_size, &swidget->comp_ext, sizeof(swidget->comp_ext)); - comp->ext_data_length = sizeof(swidget->comp_ext); + memcpy((u8 *)comp + *ipc_size, swidget->uuid, ext_size); + comp->ext_data_length = ext_size; } /* update ipc_size and return */ @@ -2276,9 +2277,8 @@ static int sof_widget_ready(struct snd_soc_component *scomp, int index, swidget->core = comp.core; - ret = sof_parse_tokens(scomp, &swidget->comp_ext, comp_ext_tokens, - ARRAY_SIZE(comp_ext_tokens), tw->priv.array, - le32_to_cpu(tw->priv.size)); + ret = sof_parse_tokens(scomp, swidget, comp_ext_tokens, ARRAY_SIZE(comp_ext_tokens), + tw->priv.array, le32_to_cpu(tw->priv.size)); if (ret != 0) { dev_err(scomp->dev, "error: parsing comp_ext_tokens failed %d\n", ret); From patchwork Mon Mar 7 18:11:05 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Ranjani Sridharan X-Patchwork-Id: 549339 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 94EDDC433F5 for ; Mon, 7 Mar 2022 18:16:53 +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 D0F8C17E8; Mon, 7 Mar 2022 19:16:01 +0100 (CET) DKIM-Filter: OpenDKIM Filter v2.11.0 alsa0.perex.cz D0F8C17E8 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=alsa-project.org; s=default; t=1646677011; bh=SNNJD83batSNyrfyp3pNVVdEc8/JOKg1XtqFPlRXn7c=; h=From:To:Subject:Date:In-Reply-To:References:Cc:List-Id: List-Unsubscribe:List-Archive:List-Post:List-Help:List-Subscribe: From; b=QC+rQQfbKT/9F6673ShvPg1vR0noB6GYjyhPLYwMlFYIO0yKoL9vepRTWBmgPBwmD lcs+hewPPCs4UD6hMr9Cnoy+a4MSQt7Gf71CoClZc0ign+JUoVeD7ziD1jke9/bpED JAM/xHOLswkLP4pPSfYqbWDqwX0ZzvZC0lu7dLQ8= Received: from alsa1.perex.cz (localhost.localdomain [127.0.0.1]) by alsa1.perex.cz (Postfix) with ESMTP id 9272DF8057A; Mon, 7 Mar 2022 19:11:55 +0100 (CET) Received: by alsa1.perex.cz (Postfix, from userid 50401) id 0BE4BF80542; Mon, 7 Mar 2022 19:11:50 +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 61235F8051B for ; Mon, 7 Mar 2022 19:11:35 +0100 (CET) DKIM-Filter: OpenDKIM Filter v2.11.0 alsa1.perex.cz 61235F8051B Authentication-Results: alsa1.perex.cz; dkim=pass (2048-bit key) header.d=intel.com header.i=@intel.com header.b="QBsYRkxv" DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1646676696; x=1678212696; h=from:to:cc:subject:date:message-id:in-reply-to: references:mime-version:content-transfer-encoding; bh=SNNJD83batSNyrfyp3pNVVdEc8/JOKg1XtqFPlRXn7c=; b=QBsYRkxvB+tG5UTnWtN8x/aXJj3BHNuoy9R4AzExw0xR4q5AdPoObqZX l/h06bVhVoeUyIJFQEWwS16NnKlVI04qhu71tEKIPZY+C3D/6mpvkQmz+ v3irVz6K30SPdbi7bkKLayjF87aXA0MK6jSIPAOcA86vRunfKTxySYJLf mx7jmY/KPr6QwPsoCJVnVhxmYaWY02YwuOx7uKMOy/S5cFKMbgBu/Rh6l fZNd5jpSph5fHe0UMaHtrkJ07MXllpaP/uoNoQ7UWfLX/Gi5omTSE4r6M BdA8l5VJxXEk2FocxFs2X8ea5vbZyraa9JRZXg2utQYD8i1C/f+xWLrkI A==; X-IronPort-AV: E=McAfee;i="6200,9189,10279"; a="254401335" X-IronPort-AV: E=Sophos;i="5.90,162,1643702400"; d="scan'208";a="254401335" 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:28 -0800 X-IronPort-AV: E=Sophos;i="5.90,162,1643702400"; d="scan'208";a="495146681" 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:28 -0800 From: Ranjani Sridharan To: alsa-devel@alsa-project.org Subject: [PATCH 12/18] ASoC: SOF: topology: make sof_route_load() IPC agnostic Date: Mon, 7 Mar 2022 10:11:05 -0800 Message-Id: <20220307181111.49392-13-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, Bard Liao , Ranjani Sridharan , Pierre-Louis Bossart , broonie@kernel.org, =?utf-8?q?P=C3=A9ter_Ujfalusi?= 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" The IPC structure can be set up using the fields in struct snd_sof_route when the pipeline connections are established. Signed-off-by: Ranjani Sridharan Reviewed-by: Bard Liao Reviewed-by: Péter Ujfalusi Reviewed-by: Pierre-Louis Bossart --- sound/soc/sof/sof-audio.c | 15 ++++++--------- sound/soc/sof/topology.c | 17 ----------------- 2 files changed, 6 insertions(+), 26 deletions(-) diff --git a/sound/soc/sof/sof-audio.c b/sound/soc/sof/sof-audio.c index b49d8e348077..8fccfbb339a3 100644 --- a/sound/soc/sof/sof-audio.c +++ b/sound/soc/sof/sof-audio.c @@ -259,28 +259,25 @@ EXPORT_SYMBOL(sof_widget_setup); static int sof_route_setup_ipc(struct snd_sof_dev *sdev, struct snd_sof_route *sroute) { - struct sof_ipc_pipe_comp_connect *connect; + struct sof_ipc_pipe_comp_connect connect; struct sof_ipc_reply reply; int ret; - /* skip if there's no private data */ - if (!sroute->private) - return 0; - /* nothing to do if route is already set up */ if (sroute->setup) return 0; - connect = sroute->private; + connect.hdr.size = sizeof(connect); + connect.hdr.cmd = SOF_IPC_GLB_TPLG_MSG | SOF_IPC_TPLG_COMP_CONNECT; + connect.source_id = sroute->src_widget->comp_id; + connect.sink_id = sroute->sink_widget->comp_id; dev_dbg(sdev->dev, "setting up route %s -> %s\n", sroute->src_widget->widget->name, sroute->sink_widget->widget->name); /* send ipc */ - ret = sof_ipc_tx_message(sdev->ipc, - connect->hdr.cmd, - connect, sizeof(*connect), + ret = sof_ipc_tx_message(sdev->ipc, connect.hdr.cmd, &connect, sizeof(connect), &reply, sizeof(reply)); if (ret < 0) { dev_err(sdev->dev, "%s: route setup failed %d\n", __func__, ret); diff --git a/sound/soc/sof/topology.c b/sound/soc/sof/topology.c index 45bac1ac9fdd..bc32302f71c9 100644 --- a/sound/soc/sof/topology.c +++ b/sound/soc/sof/topology.c @@ -3323,7 +3323,6 @@ static int sof_route_load(struct snd_soc_component *scomp, int index, struct snd_soc_dapm_route *route) { struct snd_sof_dev *sdev = snd_soc_component_get_drvdata(scomp); - struct sof_ipc_pipe_comp_connect *connect; struct snd_sof_widget *source_swidget, *sink_swidget; struct snd_soc_dobj *dobj = &route->dobj; struct snd_sof_route *sroute; @@ -3335,16 +3334,6 @@ static int sof_route_load(struct snd_soc_component *scomp, int index, return -ENOMEM; sroute->scomp = scomp; - - connect = kzalloc(sizeof(*connect), GFP_KERNEL); - if (!connect) { - kfree(sroute); - return -ENOMEM; - } - - connect->hdr.size = sizeof(*connect); - connect->hdr.cmd = SOF_IPC_GLB_TPLG_MSG | SOF_IPC_TPLG_COMP_CONNECT; - dev_dbg(scomp->dev, "sink %s control %s source %s\n", route->sink, route->control ? route->control : "none", route->source); @@ -3368,8 +3357,6 @@ static int sof_route_load(struct snd_soc_component *scomp, int index, source_swidget->id == snd_soc_dapm_output) goto err; - connect->source_id = source_swidget->comp_id; - /* sink component */ sink_swidget = snd_sof_find_swidget(scomp, (char *)route->sink); if (!sink_swidget) { @@ -3387,8 +3374,6 @@ static int sof_route_load(struct snd_soc_component *scomp, int index, sink_swidget->id == snd_soc_dapm_output) goto err; - connect->sink_id = sink_swidget->comp_id; - /* * For virtual routes, both sink and source are not * buffer. Since only buffer linked to component is supported by @@ -3403,7 +3388,6 @@ static int sof_route_load(struct snd_soc_component *scomp, int index, } else { sroute->route = route; dobj->private = sroute; - sroute->private = connect; sroute->src_widget = source_swidget; sroute->sink_widget = sink_swidget; @@ -3414,7 +3398,6 @@ static int sof_route_load(struct snd_soc_component *scomp, int index, } err: - kfree(connect); kfree(sroute); return ret; } From patchwork Mon Mar 7 18:11:06 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Ranjani Sridharan X-Patchwork-Id: 549341 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 658EFC433EF for ; Mon, 7 Mar 2022 18:15:45 +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 AC02A175E; Mon, 7 Mar 2022 19:14:53 +0100 (CET) DKIM-Filter: OpenDKIM Filter v2.11.0 alsa0.perex.cz AC02A175E DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=alsa-project.org; s=default; t=1646676943; bh=/Dyha+Vfapt4I1Cyt3/2zZ8RIsPAyXnpIwQb5SG3LuI=; h=From:To:Subject:Date:In-Reply-To:References:Cc:List-Id: List-Unsubscribe:List-Archive:List-Post:List-Help:List-Subscribe: From; b=UdQ/pNN2b+TwmBFOODbeFgDZYjTnS8z0vqOrgH5ZjtSutwnK/Ko6aLevig77wZ0Zp erZEBI3iVo71F+9C3+0DYcohlMFt0S/hESC8DUscA6BDoc2I1P+M3ShEtZ6wd55xGR ShzYi/OcDLrSPrDPyV4ZwQ4XOAWh6zJudRDqQ+N8= Received: from alsa1.perex.cz (localhost.localdomain [127.0.0.1]) by alsa1.perex.cz (Postfix) with ESMTP id 30B91F8055B; Mon, 7 Mar 2022 19:11:53 +0100 (CET) Received: by alsa1.perex.cz (Postfix, from userid 50401) id D496FF80539; Mon, 7 Mar 2022 19:11:46 +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 65BD9F80529 for ; Mon, 7 Mar 2022 19:11:38 +0100 (CET) DKIM-Filter: OpenDKIM Filter v2.11.0 alsa1.perex.cz 65BD9F80529 Authentication-Results: alsa1.perex.cz; dkim=pass (2048-bit key) header.d=intel.com header.i=@intel.com header.b="SZXVlViD" DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1646676700; x=1678212700; h=from:to:cc:subject:date:message-id:in-reply-to: references:mime-version:content-transfer-encoding; bh=/Dyha+Vfapt4I1Cyt3/2zZ8RIsPAyXnpIwQb5SG3LuI=; b=SZXVlViD4uYqBe6BS271xvrLAjH8xHqHj3AedDnhfcC9oC5tySUsQXyU fNruwDax216onyRDuJM7scSlyBUZTdYKX7ZbAeNg0TSIFNC/G+BjyHNSy 0gPb/SGkUn1/eXD4yoGwJbHaOOunqMOu/3aksY1VBoL1F/GclHYqG/z/c S1swLS7XQhrsFOLvxyWlRosxWvFsDYAiEjHWRqoPBFL7FIO4fUWPBsC4X HG3O0tjxC7N48VXXsozeUEsybpxFj+Mjntrd5XWQ7TDVRKafWpmhAfikr 7j0uQIFXiRxL2LrOid6Q9VRAzpGUN9tO7SUVKDNHcfOuUfW2PovtMtKUG g==; X-IronPort-AV: E=McAfee;i="6200,9189,10279"; a="254401339" X-IronPort-AV: E=Sophos;i="5.90,162,1643702400"; d="scan'208";a="254401339" 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:28 -0800 X-IronPort-AV: E=Sophos;i="5.90,162,1643702400"; d="scan'208";a="495146683" 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:28 -0800 From: Ranjani Sridharan To: alsa-devel@alsa-project.org Subject: [PATCH 13/18] ASoC: SOF: Add a tuples array to struct snd_sof_widget Date: Mon, 7 Mar 2022 10:11:06 -0800 Message-Id: <20220307181111.49392-14-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, Bard Liao , Ranjani Sridharan , Pierre-Louis Bossart , broonie@kernel.org, =?utf-8?q?P=C3=A9ter_Ujfalusi?= 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" Add 2 new fields to snd_sof_widget to store an array of tuples defined by struct snd_sof_tuple and the number of tuples. When the topology gets parsed, the tuples associated with a widget will be stored in this array and will be used to construct the IPC structure depending on the IPC version. Signed-off-by: Ranjani Sridharan Reviewed-by: Bard Liao Reviewed-by: Péter Ujfalusi Reviewed-by: Pierre-Louis Bossart --- sound/soc/sof/sof-audio.h | 15 +++++++++++++++ 1 file changed, 15 insertions(+) diff --git a/sound/soc/sof/sof-audio.h b/sound/soc/sof/sof-audio.h index 5c10df500ffb..a6a11f0048b4 100644 --- a/sound/soc/sof/sof-audio.h +++ b/sound/soc/sof/sof-audio.h @@ -30,6 +30,18 @@ #define WIDGET_IS_DAI(id) ((id) == snd_soc_dapm_dai_in || (id) == snd_soc_dapm_dai_out) +/** struct snd_sof_tuple - Tuple info + * @token: Token ID + * @value: union of a string or a u32 values + */ +struct snd_sof_tuple { + u32 token; + union { + u32 v; + const char *s; + } value; +}; + /* PCM stream, mapped to FW component */ struct snd_sof_pcm_stream { u32 comp_id; @@ -112,6 +124,9 @@ struct snd_sof_widget { u8 uuid[SOF_UUID_SIZE]; + int num_tuples; + struct snd_sof_tuple *tuples; + void *private; /* core does not touch this */ }; From patchwork Mon Mar 7 18:11:07 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Ranjani Sridharan X-Patchwork-Id: 548895 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 935E0C433EF for ; Mon, 7 Mar 2022 18:16:36 +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 D06651777; Mon, 7 Mar 2022 19:15:44 +0100 (CET) DKIM-Filter: OpenDKIM Filter v2.11.0 alsa0.perex.cz D06651777 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=alsa-project.org; s=default; t=1646676994; bh=6+iK/RuqsPrSx1Kmi8ZS1uO64XgeFR9m7+XcK51DK8I=; h=From:To:Subject:Date:In-Reply-To:References:Cc:List-Id: List-Unsubscribe:List-Archive:List-Post:List-Help:List-Subscribe: From; b=m5gXgmfy5t5Gq8+NzC7UoNv8w8MARg9jlpQvOK3gGeZJD2MGv8jNvCat5hF65ZHfO 7zOYoTVJhIDk92cG2V1AAndlepUYEpLtEMb5L6p4JCFtSCSVHimlQbB1uVdyZ932yo cw/8tQBJkn105st1DJze5aLaguh6U8o/+pVZxyQU= Received: from alsa1.perex.cz (localhost.localdomain [127.0.0.1]) by alsa1.perex.cz (Postfix) with ESMTP id F17BAF80579; Mon, 7 Mar 2022 19:11:54 +0100 (CET) Received: by alsa1.perex.cz (Postfix, from userid 50401) id E7B37F80528; Mon, 7 Mar 2022 19:11:49 +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 39DEDF80528 for ; Mon, 7 Mar 2022 19:11:38 +0100 (CET) DKIM-Filter: OpenDKIM Filter v2.11.0 alsa1.perex.cz 39DEDF80528 Authentication-Results: alsa1.perex.cz; dkim=pass (2048-bit key) header.d=intel.com header.i=@intel.com header.b="joxGsgrs" DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1646676700; x=1678212700; h=from:to:cc:subject:date:message-id:in-reply-to: references:mime-version:content-transfer-encoding; bh=6+iK/RuqsPrSx1Kmi8ZS1uO64XgeFR9m7+XcK51DK8I=; b=joxGsgrsK8zIhaYlJDOnVB+jcCnwkY9ceaUKIDBEDPtdjX7niX2UrRDz K2DPB8sjTv3Gx9a490hlXvF0HlQDtFakbSFJp9n9F65j+BMidHGEmDjY/ 9UmvNWxSqOyzoV9y/6jobrAZMLu2IcNC32e07tXR72dpIV8LprkhWuRsY nVDdS+LDcof2gKin58H7uXTxv5BuSuJeAA435fVDzWjfdNo5mJduIIgv8 1ikLn2zPmZQyohzO86NDMTA3EYq1VwD9IeccetxUHfttmVKVH+W3c4fMC htgS67rXwGNysgJmKkUPGRLbFEhQAj3VC3zWyQkrQl1tgyKNhHLQvNIFw w==; X-IronPort-AV: E=McAfee;i="6200,9189,10279"; a="254401342" X-IronPort-AV: E=Sophos;i="5.90,162,1643702400"; d="scan'208";a="254401342" 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:29 -0800 X-IronPort-AV: E=Sophos;i="5.90,162,1643702400"; d="scan'208";a="495146684" 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:28 -0800 From: Ranjani Sridharan To: alsa-devel@alsa-project.org Subject: [PATCH 14/18] ASoC: SOF: topology: Modify signature for token parsing functions Date: Mon, 7 Mar 2022 10:11:07 -0800 Message-Id: <20220307181111.49392-15-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, Bard Liao , Ranjani Sridharan , Pierre-Louis Bossart , broonie@kernel.org, =?utf-8?q?P=C3=A9ter_Ujfalusi?= 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" Modify the signature for sof_parse_uuid_tokens(), sof_parse_word_tokens() and sof_parse_string_tokens() to reorder the arguments to be more intuitive and rename the count arg to num_tokens. Signed-off-by: Ranjani Sridharan Reviewed-by: Bard Liao Reviewed-by: Péter Ujfalusi Reviewed-by: Pierre-Louis Bossart --- sound/soc/sof/topology.c | 78 ++++++++++++++++++++++++++-------------- 1 file changed, 52 insertions(+), 26 deletions(-) diff --git a/sound/soc/sof/topology.c b/sound/soc/sof/topology.c index bc32302f71c9..4710a7e3f40a 100644 --- a/sound/soc/sof/topology.c +++ b/sound/soc/sof/topology.c @@ -807,12 +807,21 @@ static const struct sof_topology_token afe_tokens[] = { offsetof(struct sof_ipc_dai_mtk_afe_params, format)}, }; +/** + * sof_parse_uuid_tokens - Parse multiple sets of UUID tokens + * @scomp: pointer to soc component + * @object: target ipc struct for parsed values + * @offset: offset within the object pointer + * @tokens: array of struct sof_topology_token containing the tokens to be matched + * @num_tokens: number of tokens in tokens array + * @array: source pointer to consecutive vendor arrays in topology + * + * This function parses multiple sets of string type tokens in vendor arrays + */ static int sof_parse_uuid_tokens(struct snd_soc_component *scomp, - void *object, - const struct sof_topology_token *tokens, - int count, - struct snd_soc_tplg_vendor_array *array, - size_t offset) + void *object, size_t offset, + const struct sof_topology_token *tokens, int num_tokens, + struct snd_soc_tplg_vendor_array *array) { struct snd_soc_tplg_vendor_uuid_elem *elem; int found = 0; @@ -823,7 +832,7 @@ static int sof_parse_uuid_tokens(struct snd_soc_component *scomp, elem = &array->uuid[i]; /* search for token */ - for (j = 0; j < count; j++) { + for (j = 0; j < num_tokens; j++) { /* match token type */ if (tokens[j].type != SND_SOC_TPLG_TUPLE_TYPE_UUID) continue; @@ -843,12 +852,21 @@ static int sof_parse_uuid_tokens(struct snd_soc_component *scomp, return found; } +/** + * sof_parse_string_tokens - Parse multiple sets of tokens + * @scomp: pointer to soc component + * @object: target ipc struct for parsed values + * @offset: offset within the object pointer + * @tokens: array of struct sof_topology_token containing the tokens to be matched + * @num_tokens: number of tokens in tokens array + * @array: source pointer to consecutive vendor arrays in topology + * + * This function parses multiple sets of string type tokens in vendor arrays + */ static int sof_parse_string_tokens(struct snd_soc_component *scomp, - void *object, - const struct sof_topology_token *tokens, - int count, - struct snd_soc_tplg_vendor_array *array, - size_t offset) + void *object, int offset, + const struct sof_topology_token *tokens, int num_tokens, + struct snd_soc_tplg_vendor_array *array) { struct snd_soc_tplg_vendor_string_elem *elem; int found = 0; @@ -859,7 +877,7 @@ static int sof_parse_string_tokens(struct snd_soc_component *scomp, elem = &array->string[i]; /* search for token */ - for (j = 0; j < count; j++) { + for (j = 0; j < num_tokens; j++) { /* match token type */ if (tokens[j].type != SND_SOC_TPLG_TUPLE_TYPE_STRING) continue; @@ -878,12 +896,21 @@ static int sof_parse_string_tokens(struct snd_soc_component *scomp, return found; } +/** + * sof_parse_word_tokens - Parse multiple sets of tokens + * @scomp: pointer to soc component + * @object: target ipc struct for parsed values + * @offset: offset within the object pointer + * @tokens: array of struct sof_topology_token containing the tokens to be matched + * @num_tokens: number of tokens in tokens array + * @array: source pointer to consecutive vendor arrays in topology + * + * This function parses multiple sets of word type tokens in vendor arrays + */ static int sof_parse_word_tokens(struct snd_soc_component *scomp, - void *object, - const struct sof_topology_token *tokens, - int count, - struct snd_soc_tplg_vendor_array *array, - size_t offset) + void *object, int offset, + const struct sof_topology_token *tokens, int num_tokens, + struct snd_soc_tplg_vendor_array *array) { struct snd_soc_tplg_vendor_value_elem *elem; int found = 0; @@ -894,7 +921,7 @@ static int sof_parse_word_tokens(struct snd_soc_component *scomp, elem = &array->value[i]; /* search for token */ - for (j = 0; j < count; j++) { + for (j = 0; j < num_tokens; j++) { /* match token type */ if (!(tokens[j].type == SND_SOC_TPLG_TUPLE_TYPE_WORD || tokens[j].type == SND_SOC_TPLG_TUPLE_TYPE_SHORT || @@ -907,8 +934,7 @@ static int sof_parse_word_tokens(struct snd_soc_component *scomp, continue; /* load token */ - tokens[j].get_token(elem, object, - offset + tokens[j].offset); + tokens[j].get_token(elem, object, offset + tokens[j].offset); found++; } @@ -964,19 +990,19 @@ static int sof_parse_token_sets(struct snd_soc_component *scomp, /* call correct parser depending on type */ switch (le32_to_cpu(array->type)) { case SND_SOC_TPLG_TUPLE_TYPE_UUID: - found += sof_parse_uuid_tokens(scomp, object, tokens, - count, array, offset); + found += sof_parse_uuid_tokens(scomp, object, offset, tokens, count, + array); break; case SND_SOC_TPLG_TUPLE_TYPE_STRING: - found += sof_parse_string_tokens(scomp, object, tokens, - count, array, offset); + found += sof_parse_string_tokens(scomp, object, offset, tokens, count, + array); break; case SND_SOC_TPLG_TUPLE_TYPE_BOOL: case SND_SOC_TPLG_TUPLE_TYPE_BYTE: case SND_SOC_TPLG_TUPLE_TYPE_WORD: case SND_SOC_TPLG_TUPLE_TYPE_SHORT: - found += sof_parse_word_tokens(scomp, object, tokens, - count, array, offset); + found += sof_parse_word_tokens(scomp, object, offset, tokens, count, + array); break; default: dev_err(scomp->dev, "error: unknown token type %d\n", From patchwork Mon Mar 7 18:11:08 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Ranjani Sridharan X-Patchwork-Id: 549340 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 6CEACC433EF for ; Mon, 7 Mar 2022 18:16:18 +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 B383217D6; Mon, 7 Mar 2022 19:15:26 +0100 (CET) DKIM-Filter: OpenDKIM Filter v2.11.0 alsa0.perex.cz B383217D6 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=alsa-project.org; s=default; t=1646676976; bh=6nf6gjhKmCGxdmmQo1nS6ppCfQdNpjonM7KFNAfKu7I=; h=From:To:Subject:Date:In-Reply-To:References:Cc:List-Id: List-Unsubscribe:List-Archive:List-Post:List-Help:List-Subscribe: From; b=t2IZzdG15dAW1mtj6eQ7oeeKEuYsRciJCzCtq44Ub/Jmqwy20znw7SdjYVJpdQaDh oz6Br0B5V4XINgZexNNK5l34gZNllT5relJn4OVw14pPrqAOJB10olGnWi/hske3Hw usku9bHrUjLieP58Py4cLMuMnjOjcr57Tw79CQYQ= Received: from alsa1.perex.cz (localhost.localdomain [127.0.0.1]) by alsa1.perex.cz (Postfix) with ESMTP id 6B6D2F80567; Mon, 7 Mar 2022 19:11:54 +0100 (CET) Received: by alsa1.perex.cz (Postfix, from userid 50401) id DC627F8054A; Mon, 7 Mar 2022 19:11:49 +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 39CEBF8020D for ; Mon, 7 Mar 2022 19:11:38 +0100 (CET) DKIM-Filter: OpenDKIM Filter v2.11.0 alsa1.perex.cz 39CEBF8020D Authentication-Results: alsa1.perex.cz; dkim=pass (2048-bit key) header.d=intel.com header.i=@intel.com header.b="Vc54vmQI" DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1646676700; x=1678212700; h=from:to:cc:subject:date:message-id:in-reply-to: references:mime-version:content-transfer-encoding; bh=6nf6gjhKmCGxdmmQo1nS6ppCfQdNpjonM7KFNAfKu7I=; b=Vc54vmQIuF27TBZ1S0tscKPHOaJnFG3vMZEx8OntfFtmJ+FfyscgNLF3 kAr+rHWvA1CEf5V6stmv6px6MrAn29eD0YuMnT+sYXeLfN87NWSY/oSzk lnf5CX+6axrYw84oXzeWQToZbV3kpXb5HWnVZGG2MRY4576EhFWKJBYyP LFPoqwf2CdrrigZzTOqD0/wWxsCTsLgrz79nLPhtt5i1MUbHsat5ok/7B HUFdQE5iLpV8CzDYB9QUD5Snq0w9pCsYhCShemDwu/QzXipTshlPYcSld cTz3wZ4LjOeTV17JVhttpxl3bOgTHeZHepPp+lwdkk1wFtVzQER+lxtAC Q==; X-IronPort-AV: E=McAfee;i="6200,9189,10279"; a="254401344" X-IronPort-AV: E=Sophos;i="5.90,162,1643702400"; d="scan'208";a="254401344" 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:29 -0800 X-IronPort-AV: E=Sophos;i="5.90,162,1643702400"; d="scan'208";a="495146686" 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:29 -0800 From: Ranjani Sridharan To: alsa-devel@alsa-project.org Subject: [PATCH 15/18] ASoC: SOF: topology: Rename arguments in sof_parse_token_sets() Date: Mon, 7 Mar 2022 10:11:08 -0800 Message-Id: <20220307181111.49392-16-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, Bard Liao , Ranjani Sridharan , Pierre-Louis Bossart , broonie@kernel.org, =?utf-8?q?P=C3=A9ter_Ujfalusi?= 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" Rename the priv_size arg to array_size and clarify the arguments in the comments. Signed-off-by: Ranjani Sridharan Reviewed-by: Bard Liao Reviewed-by: Péter Ujfalusi Reviewed-by: Pierre-Louis Bossart --- sound/soc/sof/topology.c | 21 ++++++++++----------- 1 file changed, 10 insertions(+), 11 deletions(-) diff --git a/sound/soc/sof/topology.c b/sound/soc/sof/topology.c index 4710a7e3f40a..b96ecef43284 100644 --- a/sound/soc/sof/topology.c +++ b/sound/soc/sof/topology.c @@ -949,27 +949,26 @@ static int sof_parse_word_tokens(struct snd_soc_component *scomp, * @object: target ipc struct for parsed values * @tokens: token definition array describing what tokens to parse * @count: number of tokens in definition array - * @array: source pointer to consecutive vendor arrays to be parsed - * @priv_size: total size of the consecutive source arrays - * @sets: number of similar token sets to be parsed, 1 set has count elements + * @array: source pointer to consecutive vendor arrays in topology + * @array_size: total size of @array + * @token_instance_num: number of times the same tokens needs to be parsed i.e. the function + * looks for @token_instance_num of each token in the @tokens * @object_size: offset to next target ipc struct with multiple sets * * This function parses multiple sets of tokens in vendor arrays into * consecutive ipc structs. */ static int sof_parse_token_sets(struct snd_soc_component *scomp, - void *object, - const struct sof_topology_token *tokens, - int count, - struct snd_soc_tplg_vendor_array *array, - int priv_size, int sets, size_t object_size) + void *object, const struct sof_topology_token *tokens, + int count, struct snd_soc_tplg_vendor_array *array, + int array_size, int token_instance_num, size_t object_size) { size_t offset = 0; int found = 0; int total = 0; int asize; - while (priv_size > 0 && total < count * sets) { + while (array_size > 0 && total < count * token_instance_num) { asize = le32_to_cpu(array->size); /* validate asize */ @@ -980,8 +979,8 @@ static int sof_parse_token_sets(struct snd_soc_component *scomp, } /* make sure there is enough data before parsing */ - priv_size -= asize; - if (priv_size < 0) { + array_size -= asize; + if (array_size < 0) { dev_err(scomp->dev, "error: invalid array size 0x%x\n", asize); return -EINVAL; From patchwork Mon Mar 7 18:11:09 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Ranjani Sridharan X-Patchwork-Id: 548893 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 D1A8CC433EF for ; Mon, 7 Mar 2022 18:17:44 +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 0FC5F1831; Mon, 7 Mar 2022 19:16:53 +0100 (CET) DKIM-Filter: OpenDKIM Filter v2.11.0 alsa0.perex.cz 0FC5F1831 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=alsa-project.org; s=default; t=1646677063; bh=scbGiTy6fmadYaIGjLgmz4sDbgfeN2rLNb6RB+CCOEg=; h=From:To:Subject:Date:In-Reply-To:References:Cc:List-Id: List-Unsubscribe:List-Archive:List-Post:List-Help:List-Subscribe: From; b=BSZtXrSZp5osLlPmddzNK9mMkFaGidKZ56r6vzNhqjV9bOyP7Rxm9xE+DY7jIvWfu qpXRodHhPQaLIrb3oMCjiB1jEP14PnzEk9s63QP8cd6BYzdbT2AFHbOvqRNXAJ/om6 5yd2iQmwD3W1jpb4M/jHon3e5kapjIpHsIWSLax4= Received: from alsa1.perex.cz (localhost.localdomain [127.0.0.1]) by alsa1.perex.cz (Postfix) with ESMTP id 02E4EF805BA; Mon, 7 Mar 2022 19:11:58 +0100 (CET) Received: by alsa1.perex.cz (Postfix, from userid 50401) id 678ABF80566; Mon, 7 Mar 2022 19:11:53 +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 94FC1F80515 for ; Mon, 7 Mar 2022 19:11:41 +0100 (CET) DKIM-Filter: OpenDKIM Filter v2.11.0 alsa1.perex.cz 94FC1F80515 Authentication-Results: alsa1.perex.cz; dkim=pass (2048-bit key) header.d=intel.com header.i=@intel.com header.b="Jvp27R3U" DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1646676703; x=1678212703; h=from:to:cc:subject:date:message-id:in-reply-to: references:mime-version:content-transfer-encoding; bh=scbGiTy6fmadYaIGjLgmz4sDbgfeN2rLNb6RB+CCOEg=; b=Jvp27R3UYRQ/OxXsEepAG+TjjPSnkHtAEByLzZCzl6fXg9tHnJsrvOps frU/9+tAcz3kl2zsmOLJpcMBvdn6mkeq+CIn+wCwpauMKKyMb4Wusbud9 Op8Ug2LADdSXw4BO3Civ1dRYXxbXtjMUFAH6XEH/WK9t1jjl8RJyirnjd Z3i6/38eMb/EHuojmLXvkILA6uL/tUZRPmrigQo6bZAt/EUOJP/YEjb41 EG107tzpWVyFbGCtb5ndG1xWFwYmcUOPBUPjlGDG4uK6e6bkrHmYDYWQj TiLU3RcIyBQE+cn3Tw5ztnwkYRmcU8TCw5SOtuYlgsOP4OGqFyMLC6GJU g==; X-IronPort-AV: E=McAfee;i="6200,9189,10279"; a="254401356" X-IronPort-AV: E=Sophos;i="5.90,162,1643702400"; d="scan'208";a="254401356" 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:30 -0800 X-IronPort-AV: E=Sophos;i="5.90,162,1643702400"; d="scan'208";a="495146687" 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:29 -0800 From: Ranjani Sridharan To: alsa-devel@alsa-project.org Subject: [PATCH 16/18] ASoC: SOF: topology: Rename arguments in sof_parse_tokens() Date: Mon, 7 Mar 2022 10:11:09 -0800 Message-Id: <20220307181111.49392-17-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, Bard Liao , Ranjani Sridharan , Pierre-Louis Bossart , broonie@kernel.org, =?utf-8?q?P=C3=A9ter_Ujfalusi?= 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" Rename the count and priv_size arguments in sof_parse_tokens() and add comments to clarify the arguments. Signed-off-by: Ranjani Sridharan Reviewed-by: Bard Liao Reviewed-by: Péter Ujfalusi Reviewed-by: Pierre-Louis Bossart --- sound/soc/sof/topology.c | 25 ++++++++++++++++++------- 1 file changed, 18 insertions(+), 7 deletions(-) diff --git a/sound/soc/sof/topology.c b/sound/soc/sof/topology.c index b96ecef43284..71de61255779 100644 --- a/sound/soc/sof/topology.c +++ b/sound/soc/sof/topology.c @@ -1024,12 +1024,23 @@ static int sof_parse_token_sets(struct snd_soc_component *scomp, return 0; } -static int sof_parse_tokens(struct snd_soc_component *scomp, - void *object, - const struct sof_topology_token *tokens, - int count, +/** + * sof_parse_tokens - Parse one set of tokens + * @scomp: pointer to soc component + * @object: target ipc struct for parsed values + * @tokens: token definition array describing what tokens to parse + * @num_tokens: number of tokens in definition array + * @array: source pointer to consecutive vendor arrays in topology + * @array_size: total size of @array + * + * This function parses a single set of tokens in vendor arrays into + * consecutive ipc structs. + */ +static int sof_parse_tokens(struct snd_soc_component *scomp, void *object, + const struct sof_topology_token *tokens, int num_tokens, struct snd_soc_tplg_vendor_array *array, - int priv_size) + int array_size) + { /* * sof_parse_tokens is used when topology contains only a single set of @@ -1037,8 +1048,8 @@ static int sof_parse_tokens(struct snd_soc_component *scomp, * sof_parse_token_sets are sets = 1 (only 1 set) and * object_size = 0 (irrelevant). */ - return sof_parse_token_sets(scomp, object, tokens, count, array, - priv_size, 1, 0); + return sof_parse_token_sets(scomp, object, tokens, num_tokens, array, + array_size, 1, 0); } static void sof_dbg_comp_config(struct snd_soc_component *scomp, From patchwork Mon Mar 7 18:11:10 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Ranjani Sridharan X-Patchwork-Id: 549338 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 7E90BC433F5 for ; Mon, 7 Mar 2022 18:17:33 +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 BF2421828; Mon, 7 Mar 2022 19:16:41 +0100 (CET) DKIM-Filter: OpenDKIM Filter v2.11.0 alsa0.perex.cz BF2421828 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=alsa-project.org; s=default; t=1646677051; bh=FuA3/2BBAW7+sTosQAx2nZ57IKQ0o8FQFWn4vOvQf5s=; h=From:To:Subject:Date:In-Reply-To:References:Cc:List-Id: List-Unsubscribe:List-Archive:List-Post:List-Help:List-Subscribe: From; b=D3cYvuI3WQBQwZ7YaCmo69KTTjsBou0JPISJQzd3WHRHLiI2fi0kNkq3zpt2E3lKe zbAoh+u/4iiOZ39g7TVVcL7BhkLp+nXpXxNVSvH0kg2sDP2fmTmuDqzD1MG6UmLtdW 2v4wER+iiKqmsfrYFQwiWN0rNv+7/EG6VY0clm3U= Received: from alsa1.perex.cz (localhost.localdomain [127.0.0.1]) by alsa1.perex.cz (Postfix) with ESMTP id 7E470F805B5; Mon, 7 Mar 2022 19:11:57 +0100 (CET) Received: by alsa1.perex.cz (Postfix, from userid 50401) id 25D4CF80563; Mon, 7 Mar 2022 19:11:53 +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 950D7F80535 for ; Mon, 7 Mar 2022 19:11:41 +0100 (CET) DKIM-Filter: OpenDKIM Filter v2.11.0 alsa1.perex.cz 950D7F80535 Authentication-Results: alsa1.perex.cz; dkim=pass (2048-bit key) header.d=intel.com header.i=@intel.com header.b="lAXkZ+w8" DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1646676703; x=1678212703; h=from:to:cc:subject:date:message-id:in-reply-to: references:mime-version:content-transfer-encoding; bh=FuA3/2BBAW7+sTosQAx2nZ57IKQ0o8FQFWn4vOvQf5s=; b=lAXkZ+w8zwMtSQ11l26USqnM6hHC5ZxnzJUm6mSxQYFjjYrvvTCv1pA+ LazwA4VUQGC41zSrUP1fzqfHr32n5twbwlUnhmnzHD/ypz/RJRI5u5NT5 jnqnhhF78F+jeIqrpiUKAXNAqqpMp5dVDu20NLeYMiqu7vfgqgYvtMwAS DxFjNKl/8fleD2dU1BIEATu0NckjDVzkaGCFphs5XtkLOf2owvf9vezoQ BUmiF124rWVPbkDE5ms+AINmBTJFwRBMX3gq8uytetTQ0EPIBnbs9urEo QBFm2cgbycEYXonA89+dfsadFfkX434O20646IOAxANzrGvKkNjw+AYqB Q==; X-IronPort-AV: E=McAfee;i="6200,9189,10279"; a="254401358" X-IronPort-AV: E=Sophos;i="5.90,162,1643702400"; d="scan'208";a="254401358" 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:30 -0800 X-IronPort-AV: E=Sophos;i="5.90,162,1643702400"; d="scan'208";a="495146692" 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:30 -0800 From: Ranjani Sridharan To: alsa-devel@alsa-project.org Subject: [PATCH 17/18] ASoC: SOF: make struct snd_sof_dai IPC agnostic Date: Mon, 7 Mar 2022 10:11:10 -0800 Message-Id: <20220307181111.49392-18-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, Bard Liao , Ranjani Sridharan , Pierre-Louis Bossart , broonie@kernel.org, =?utf-8?q?P=C3=A9ter_Ujfalusi?= 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" Remove the comp_dai and dai_config members of struct snd_sof_dai and replace it with a void *private field. Introduce a new struct sof_dai_private_data that will contain the pointer to these two fields. The topology parser will populate this structure and save it as part of the "private" member in snd_sof_dai. Change all users of these fields to use the private member instead. Signed-off-by: Ranjani Sridharan Reviewed-by: Bard Liao Reviewed-by: Péter Ujfalusi Reviewed-by: Pierre-Louis Bossart --- include/sound/sof/dai.h | 5 +++ sound/soc/sof/intel/hda-dai.c | 27 +++++++++--- sound/soc/sof/intel/hda.c | 39 ++++++++++++++---- sound/soc/sof/pcm.c | 77 ++++++++++++++++++----------------- sound/soc/sof/sof-audio.c | 30 +++++++++----- sound/soc/sof/sof-audio.h | 3 +- sound/soc/sof/topology.c | 38 ++++++++++++----- 7 files changed, 143 insertions(+), 76 deletions(-) diff --git a/include/sound/sof/dai.h b/include/sound/sof/dai.h index 59ee50ac7705..a818a0f0a226 100644 --- a/include/sound/sof/dai.h +++ b/include/sound/sof/dai.h @@ -116,4 +116,9 @@ struct sof_ipc_dai_config { }; } __packed; +struct sof_dai_private_data { + struct sof_ipc_comp_dai *comp_dai; + struct sof_ipc_dai_config *dai_config; +}; + #endif diff --git a/sound/soc/sof/intel/hda-dai.c b/sound/soc/sof/intel/hda-dai.c index 75063140ed0c..9b78eea8d76b 100644 --- a/sound/soc/sof/intel/hda-dai.c +++ b/sound/soc/sof/intel/hda-dai.c @@ -167,6 +167,7 @@ static struct sof_ipc_dai_config *hda_dai_update_config(struct snd_soc_dapm_widg int channel) { struct snd_sof_widget *swidget = w->dobj.private; + struct sof_dai_private_data *private; struct sof_ipc_dai_config *config; struct snd_sof_dai *sof_dai; @@ -175,12 +176,19 @@ static struct sof_ipc_dai_config *hda_dai_update_config(struct snd_soc_dapm_widg sof_dai = swidget->private; - if (!sof_dai || !sof_dai->dai_config) { - dev_err(swidget->scomp->dev, "error: No config for DAI %s\n", w->name); + if (!sof_dai || !sof_dai->private) { + dev_err(swidget->scomp->dev, "%s: No private data for DAI %s\n", __func__, + w->name); return NULL; } - config = &sof_dai->dai_config[sof_dai->current_config]; + private = sof_dai->private; + if (!private->dai_config) { + dev_err(swidget->scomp->dev, "%s: No config for DAI %s\n", __func__, w->name); + return NULL; + } + + config = &private->dai_config[sof_dai->current_config]; /* update config with stream tag */ config->hda.link_dma_ch = channel; @@ -294,6 +302,7 @@ static int hda_link_dai_config_pause_push_ipc(struct snd_soc_dapm_widget *w) struct snd_sof_widget *swidget = w->dobj.private; struct snd_soc_component *component = swidget->scomp; struct snd_sof_dev *sdev = snd_soc_component_get_drvdata(component); + struct sof_dai_private_data *private; struct sof_ipc_dai_config *config; struct snd_sof_dai *sof_dai; struct sof_ipc_reply reply; @@ -301,12 +310,18 @@ static int hda_link_dai_config_pause_push_ipc(struct snd_soc_dapm_widget *w) sof_dai = swidget->private; - if (!sof_dai || !sof_dai->dai_config) { - dev_err(sdev->dev, "No config for DAI %s\n", w->name); + if (!sof_dai || !sof_dai->private) { + dev_err(sdev->dev, "%s: No private data for DAI %s\n", __func__, w->name); + return -EINVAL; + } + + private = sof_dai->private; + if (!private->dai_config) { + dev_err(sdev->dev, "%s: No config for DAI %s\n", __func__, w->name); return -EINVAL; } - config = &sof_dai->dai_config[sof_dai->current_config]; + config = &private->dai_config[sof_dai->current_config]; /* set PAUSE command flag */ config->flags = FIELD_PREP(SOF_DAI_CONFIG_FLAGS_CMD_MASK, SOF_DAI_CONFIG_FLAGS_PAUSE); diff --git a/sound/soc/sof/intel/hda.c b/sound/soc/sof/intel/hda.c index e42b45722e9d..21670a7aca2d 100644 --- a/sound/soc/sof/intel/hda.c +++ b/sound/soc/sof/intel/hda.c @@ -47,14 +47,21 @@ int hda_ctrl_dai_widget_setup(struct snd_soc_dapm_widget *w, unsigned int quirk_ struct snd_soc_component *component = swidget->scomp; struct snd_sof_dev *sdev = snd_soc_component_get_drvdata(component); struct sof_ipc_dai_config *config; + struct sof_dai_private_data *private; struct snd_sof_dai *sof_dai; struct sof_ipc_reply reply; int ret; sof_dai = swidget->private; - if (!sof_dai || !sof_dai->dai_config) { - dev_err(sdev->dev, "No config for DAI %s\n", w->name); + if (!sof_dai || !sof_dai->private) { + dev_err(sdev->dev, "%s: No private data for DAI %s\n", __func__, w->name); + return -EINVAL; + } + + private = sof_dai->private; + if (!private->dai_config) { + dev_err(sdev->dev, "%s: No config for DAI %s\n", __func__, w->name); return -EINVAL; } @@ -65,7 +72,7 @@ int hda_ctrl_dai_widget_setup(struct snd_soc_dapm_widget *w, unsigned int quirk_ return ret; } - config = &sof_dai->dai_config[sof_dai->current_config]; + config = &private->dai_config[sof_dai->current_config]; /* * For static pipelines, the DAI widget would already be set up and calling @@ -101,6 +108,7 @@ int hda_ctrl_dai_widget_free(struct snd_soc_dapm_widget *w, unsigned int quirk_f struct snd_sof_widget *swidget = w->dobj.private; struct snd_soc_component *component = swidget->scomp; struct snd_sof_dev *sdev = snd_soc_component_get_drvdata(component); + struct sof_dai_private_data *private; struct sof_ipc_dai_config *config; struct snd_sof_dai *sof_dai; struct sof_ipc_reply reply; @@ -108,8 +116,14 @@ int hda_ctrl_dai_widget_free(struct snd_soc_dapm_widget *w, unsigned int quirk_f sof_dai = swidget->private; - if (!sof_dai || !sof_dai->dai_config) { - dev_err(sdev->dev, "error: No config to free DAI %s\n", w->name); + if (!sof_dai || !sof_dai->private) { + dev_err(sdev->dev, "%s: No private data for DAI %s\n", __func__, w->name); + return -EINVAL; + } + + private = sof_dai->private; + if (!private->dai_config) { + dev_err(sdev->dev, "%s: No config for DAI %s\n", __func__, w->name); return -EINVAL; } @@ -117,7 +131,7 @@ int hda_ctrl_dai_widget_free(struct snd_soc_dapm_widget *w, unsigned int quirk_f if (!sof_dai->configured) return 0; - config = &sof_dai->dai_config[sof_dai->current_config]; + config = &private->dai_config[sof_dai->current_config]; /* set HW_FREE flag along with any quirks */ config->flags = SOF_DAI_CONFIG_FLAGS_HW_FREE | @@ -154,6 +168,7 @@ static int sdw_dai_config_ipc(struct snd_sof_dev *sdev, int link_id, int alh_stream_id, int dai_id, bool setup) { struct snd_sof_widget *swidget = w->dobj.private; + struct sof_dai_private_data *private; struct sof_ipc_dai_config *config; struct snd_sof_dai *sof_dai; @@ -164,12 +179,18 @@ static int sdw_dai_config_ipc(struct snd_sof_dev *sdev, sof_dai = swidget->private; - if (!sof_dai || !sof_dai->dai_config) { - dev_err(sdev->dev, "error: No config for DAI %s\n", w->name); + if (!sof_dai || !sof_dai->private) { + dev_err(sdev->dev, "%s: No private data for DAI %s\n", __func__, w->name); + return -EINVAL; + } + + private = sof_dai->private; + if (!private->dai_config) { + dev_err(sdev->dev, "%s: No config for DAI %s\n", __func__, w->name); return -EINVAL; } - config = &sof_dai->dai_config[sof_dai->current_config]; + config = &private->dai_config[sof_dai->current_config]; /* update config with link and stream ID */ config->dai_index = (link_id << 8) | dai_id; diff --git a/sound/soc/sof/pcm.c b/sound/soc/sof/pcm.c index 1d04f75e6d32..4628bc642fda 100644 --- a/sound/soc/sof/pcm.c +++ b/sound/soc/sof/pcm.c @@ -670,7 +670,9 @@ static void ssp_dai_config_pcm_params_match(struct snd_sof_dev *sdev, const char if (!dai->name || strcmp(link_name, dai->name)) continue; for (i = 0; i < dai->number_configs; i++) { - config = &dai->dai_config[i]; + struct sof_dai_private_data *private = dai->private; + + config = &private->dai_config[i]; if (config->ssp.fsync_rate == params_rate(params)) { dev_dbg(sdev->dev, "DAI config %d matches pcm hw params\n", i); dai->current_config = i; @@ -693,6 +695,7 @@ int sof_pcm_dai_link_fixup(struct snd_soc_pcm_runtime *rtd, struct snd_pcm_hw_pa struct snd_sof_dai *dai = snd_sof_find_dai(component, (char *)rtd->dai_link->name); struct snd_sof_dev *sdev = snd_soc_component_get_drvdata(component); + struct sof_dai_private_data *private = dai->private; struct snd_soc_dpcm *dpcm; /* no topology exists for this BE, try a common configuration */ @@ -717,7 +720,7 @@ int sof_pcm_dai_link_fixup(struct snd_soc_pcm_runtime *rtd, struct snd_pcm_hw_pa /* read format from topology */ snd_mask_none(fmt); - switch (dai->comp_dai->config.frame_fmt) { + switch (private->comp_dai->config.frame_fmt) { case SOF_IPC_FRAME_S16_LE: snd_mask_set_format(fmt, SNDRV_PCM_FORMAT_S16_LE); break; @@ -733,15 +736,15 @@ int sof_pcm_dai_link_fixup(struct snd_soc_pcm_runtime *rtd, struct snd_pcm_hw_pa } /* read rate and channels from topology */ - switch (dai->dai_config->type) { + switch (private->dai_config->type) { case SOF_DAI_INTEL_SSP: /* search for config to pcm params match, if not found use default */ ssp_dai_config_pcm_params_match(sdev, (char *)rtd->dai_link->name, params); - rate->min = dai->dai_config[dai->current_config].ssp.fsync_rate; - rate->max = dai->dai_config[dai->current_config].ssp.fsync_rate; - channels->min = dai->dai_config[dai->current_config].ssp.tdm_slots; - channels->max = dai->dai_config[dai->current_config].ssp.tdm_slots; + rate->min = private->dai_config[dai->current_config].ssp.fsync_rate; + rate->max = private->dai_config[dai->current_config].ssp.fsync_rate; + channels->min = private->dai_config[dai->current_config].ssp.tdm_slots; + channels->max = private->dai_config[dai->current_config].ssp.tdm_slots; dev_dbg(component->dev, "rate_min: %d rate_max: %d\n", rate->min, rate->max); @@ -752,11 +755,11 @@ int sof_pcm_dai_link_fixup(struct snd_soc_pcm_runtime *rtd, struct snd_pcm_hw_pa break; case SOF_DAI_INTEL_DMIC: /* DMIC only supports 16 or 32 bit formats */ - if (dai->comp_dai->config.frame_fmt == SOF_IPC_FRAME_S24_4LE) { + if (private->comp_dai->config.frame_fmt == SOF_IPC_FRAME_S24_4LE) { dev_err(component->dev, "error: invalid fmt %d for DAI type %d\n", - dai->comp_dai->config.frame_fmt, - dai->dai_config->type); + private->comp_dai->config.frame_fmt, + private->dai_config->type); } break; case SOF_DAI_INTEL_HDA: @@ -776,14 +779,14 @@ int sof_pcm_dai_link_fixup(struct snd_soc_pcm_runtime *rtd, struct snd_pcm_hw_pa * Dai could run with different channel count compared with * front end, so get dai channel count from topology */ - channels->min = dai->dai_config->alh.channels; - channels->max = dai->dai_config->alh.channels; + channels->min = private->dai_config->alh.channels; + channels->max = private->dai_config->alh.channels; break; case SOF_DAI_IMX_ESAI: - rate->min = dai->dai_config->esai.fsync_rate; - rate->max = dai->dai_config->esai.fsync_rate; - channels->min = dai->dai_config->esai.tdm_slots; - channels->max = dai->dai_config->esai.tdm_slots; + rate->min = private->dai_config->esai.fsync_rate; + rate->max = private->dai_config->esai.fsync_rate; + channels->min = private->dai_config->esai.tdm_slots; + channels->max = private->dai_config->esai.tdm_slots; dev_dbg(component->dev, "rate_min: %d rate_max: %d\n", rate->min, rate->max); @@ -792,10 +795,10 @@ int sof_pcm_dai_link_fixup(struct snd_soc_pcm_runtime *rtd, struct snd_pcm_hw_pa channels->min, channels->max); break; case SOF_DAI_MEDIATEK_AFE: - rate->min = dai->dai_config->afe.rate; - rate->max = dai->dai_config->afe.rate; - channels->min = dai->dai_config->afe.channels; - channels->max = dai->dai_config->afe.channels; + rate->min = private->dai_config->afe.rate; + rate->max = private->dai_config->afe.rate; + channels->min = private->dai_config->afe.channels; + channels->max = private->dai_config->afe.channels; dev_dbg(component->dev, "rate_min: %d rate_max: %d\n", rate->min, rate->max); @@ -804,10 +807,10 @@ int sof_pcm_dai_link_fixup(struct snd_soc_pcm_runtime *rtd, struct snd_pcm_hw_pa channels->min, channels->max); break; case SOF_DAI_IMX_SAI: - rate->min = dai->dai_config->sai.fsync_rate; - rate->max = dai->dai_config->sai.fsync_rate; - channels->min = dai->dai_config->sai.tdm_slots; - channels->max = dai->dai_config->sai.tdm_slots; + rate->min = private->dai_config->sai.fsync_rate; + rate->max = private->dai_config->sai.fsync_rate; + channels->min = private->dai_config->sai.tdm_slots; + channels->max = private->dai_config->sai.tdm_slots; dev_dbg(component->dev, "rate_min: %d rate_max: %d\n", rate->min, rate->max); @@ -816,10 +819,10 @@ int sof_pcm_dai_link_fixup(struct snd_soc_pcm_runtime *rtd, struct snd_pcm_hw_pa channels->min, channels->max); break; case SOF_DAI_AMD_BT: - rate->min = dai->dai_config->acpbt.fsync_rate; - rate->max = dai->dai_config->acpbt.fsync_rate; - channels->min = dai->dai_config->acpbt.tdm_slots; - channels->max = dai->dai_config->acpbt.tdm_slots; + rate->min = private->dai_config->acpbt.fsync_rate; + rate->max = private->dai_config->acpbt.fsync_rate; + channels->min = private->dai_config->acpbt.tdm_slots; + channels->max = private->dai_config->acpbt.tdm_slots; dev_dbg(component->dev, "AMD_BT rate_min: %d rate_max: %d\n", rate->min, rate->max); @@ -828,10 +831,10 @@ int sof_pcm_dai_link_fixup(struct snd_soc_pcm_runtime *rtd, struct snd_pcm_hw_pa channels->min, channels->max); break; case SOF_DAI_AMD_SP: - rate->min = dai->dai_config->acpsp.fsync_rate; - rate->max = dai->dai_config->acpsp.fsync_rate; - channels->min = dai->dai_config->acpsp.tdm_slots; - channels->max = dai->dai_config->acpsp.tdm_slots; + rate->min = private->dai_config->acpsp.fsync_rate; + rate->max = private->dai_config->acpsp.fsync_rate; + channels->min = private->dai_config->acpsp.tdm_slots; + channels->max = private->dai_config->acpsp.tdm_slots; dev_dbg(component->dev, "AMD_SP rate_min: %d rate_max: %d\n", rate->min, rate->max); @@ -840,10 +843,10 @@ int sof_pcm_dai_link_fixup(struct snd_soc_pcm_runtime *rtd, struct snd_pcm_hw_pa channels->min, channels->max); break; case SOF_DAI_AMD_DMIC: - rate->min = dai->dai_config->acpdmic.fsync_rate; - rate->max = dai->dai_config->acpdmic.fsync_rate; - channels->min = dai->dai_config->acpdmic.tdm_slots; - channels->max = dai->dai_config->acpdmic.tdm_slots; + rate->min = private->dai_config->acpdmic.fsync_rate; + rate->max = private->dai_config->acpdmic.fsync_rate; + channels->min = private->dai_config->acpdmic.tdm_slots; + channels->max = private->dai_config->acpdmic.tdm_slots; dev_dbg(component->dev, "AMD_DMIC rate_min: %d rate_max: %d\n", rate->min, rate->max); @@ -853,7 +856,7 @@ int sof_pcm_dai_link_fixup(struct snd_soc_pcm_runtime *rtd, struct snd_pcm_hw_pa break; default: dev_err(component->dev, "error: invalid DAI type %d\n", - dai->dai_config->type); + private->dai_config->type); break; } diff --git a/sound/soc/sof/sof-audio.c b/sound/soc/sof/sof-audio.c index 8fccfbb339a3..15c36a51f89f 100644 --- a/sound/soc/sof/sof-audio.c +++ b/sound/soc/sof/sof-audio.c @@ -29,11 +29,12 @@ static int sof_kcontrol_setup(struct snd_sof_dev *sdev, struct snd_sof_control * static int sof_dai_config_setup(struct snd_sof_dev *sdev, struct snd_sof_dai *dai) { + struct sof_dai_private_data *private = dai->private; struct sof_ipc_dai_config *config; struct sof_ipc_reply reply; int ret; - config = &dai->dai_config[dai->current_config]; + config = &private->dai_config[dai->current_config]; if (!config) { dev_err(sdev->dev, "error: no config for DAI %s\n", dai->name); return -EINVAL; @@ -191,12 +192,16 @@ int sof_widget_setup(struct snd_sof_dev *sdev, struct snd_sof_widget *swidget) switch (swidget->id) { case snd_soc_dapm_dai_in: case snd_soc_dapm_dai_out: + { + struct sof_dai_private_data *dai_data; + dai = swidget->private; - comp = &dai->comp_dai->comp; + dai_data = dai->private; + comp = &dai_data->comp_dai->comp; dai->configured = false; - ret = sof_ipc_tx_message(sdev->ipc, comp->hdr.cmd, dai->comp_dai, comp->hdr.size, - &r, sizeof(r)); + ret = sof_ipc_tx_message(sdev->ipc, comp->hdr.cmd, dai_data->comp_dai, + comp->hdr.size, &r, sizeof(r)); if (ret < 0) { dev_err(sdev->dev, "error: failed to load widget %s\n", swidget->widget->name); @@ -216,6 +221,7 @@ int sof_widget_setup(struct snd_sof_dev *sdev, struct snd_sof_widget *swidget) return ret; } break; + } case snd_soc_dapm_scheduler: pipeline = swidget->private; ret = sof_ipc_tx_message(sdev->ipc, pipeline->hdr.cmd, pipeline, @@ -620,12 +626,13 @@ int sof_set_up_pipelines(struct snd_sof_dev *sdev, bool verify) /* update DAI config. The IPC will be sent in sof_widget_setup() */ if (WIDGET_IS_DAI(swidget->id)) { struct snd_sof_dai *dai = swidget->private; + struct sof_dai_private_data *private = dai->private; struct sof_ipc_dai_config *config; - if (!dai || !dai->dai_config) + if (!dai || !private || !private->dai_config) continue; - config = dai->dai_config; + config = private->dai_config; /* * The link DMA channel would be invalidated for running * streams but not for streams that were in the PAUSED @@ -911,18 +918,19 @@ static int sof_dai_get_clk(struct snd_soc_pcm_runtime *rtd, int clk_type) snd_soc_rtdcom_lookup(rtd, SOF_AUDIO_PCM_DRV_NAME); struct snd_sof_dai *dai = snd_sof_find_dai(component, (char *)rtd->dai_link->name); + struct sof_dai_private_data *private = dai->private; /* use the tplg configured mclk if existed */ - if (!dai || !dai->dai_config) + if (!dai || !private || !private->dai_config) return 0; - switch (dai->dai_config->type) { + switch (private->dai_config->type) { case SOF_DAI_INTEL_SSP: switch (clk_type) { case SOF_DAI_CLK_INTEL_SSP_MCLK: - return dai->dai_config->ssp.mclk_rate; + return private->dai_config->ssp.mclk_rate; case SOF_DAI_CLK_INTEL_SSP_BCLK: - return dai->dai_config->ssp.bclk_rate; + return private->dai_config->ssp.bclk_rate; default: dev_err(rtd->dev, "fail to get SSP clk %d rate\n", clk_type); @@ -932,7 +940,7 @@ static int sof_dai_get_clk(struct snd_soc_pcm_runtime *rtd, int clk_type) default: /* not yet implemented for platforms other than the above */ dev_err(rtd->dev, "DAI type %d not supported yet!\n", - dai->dai_config->type); + private->dai_config->type); return -EINVAL; } } diff --git a/sound/soc/sof/sof-audio.h b/sound/soc/sof/sof-audio.h index a6a11f0048b4..a72e68e92dff 100644 --- a/sound/soc/sof/sof-audio.h +++ b/sound/soc/sof/sof-audio.h @@ -148,12 +148,11 @@ struct snd_sof_dai { struct snd_soc_component *scomp; const char *name; - struct sof_ipc_comp_dai *comp_dai; int number_configs; int current_config; bool configured; /* DAI configured during BE hw_params */ - struct sof_ipc_dai_config *dai_config; struct list_head list; /* list in sdev dai list */ + void *private; }; /* diff --git a/sound/soc/sof/topology.c b/sound/soc/sof/topology.c index 71de61255779..da729be8ddbc 100644 --- a/sound/soc/sof/topology.c +++ b/sound/soc/sof/topology.c @@ -1496,14 +1496,21 @@ static int sof_widget_load_dai(struct snd_soc_component *scomp, int index, struct snd_sof_dai *dai) { struct snd_soc_tplg_private *private = &tw->priv; + struct sof_dai_private_data *dai_data; struct sof_ipc_comp_dai *comp_dai; size_t ipc_size = sizeof(*comp_dai); int ret; + dai_data = kzalloc(sizeof(*dai_data), GFP_KERNEL); + if (!dai_data) + return -ENOMEM; + comp_dai = (struct sof_ipc_comp_dai *) sof_comp_alloc(swidget, &ipc_size, index); - if (!comp_dai) - return -ENOMEM; + if (!comp_dai) { + ret = -ENOMEM; + goto free; + } /* configure dai IPC message */ comp_dai->comp.type = SOF_COMP_DAI; @@ -1515,7 +1522,7 @@ static int sof_widget_load_dai(struct snd_soc_component *scomp, int index, if (ret != 0) { dev_err(scomp->dev, "error: parse dai tokens failed %d\n", le32_to_cpu(private->size)); - return ret; + goto free; } ret = sof_parse_tokens(scomp, &comp_dai->config, comp_tokens, @@ -1524,7 +1531,7 @@ static int sof_widget_load_dai(struct snd_soc_component *scomp, int index, if (ret != 0) { dev_err(scomp->dev, "error: parse dai.cfg tokens failed %d\n", private->size); - return ret; + goto free; } dev_dbg(scomp->dev, "dai %s: type %d index %d\n", @@ -1533,9 +1540,14 @@ static int sof_widget_load_dai(struct snd_soc_component *scomp, int index, if (dai) { dai->scomp = scomp; - dai->comp_dai = comp_dai; + dai_data->comp_dai = comp_dai; + dai->private = dai_data; } + return 0; + +free: + kfree(dai_data); return ret; } @@ -2457,9 +2469,11 @@ static int sof_widget_unload(struct snd_soc_component *scomp, dai = swidget->private; if (dai) { - kfree(dai->comp_dai); - /* free dai config */ - kfree(dai->dai_config); + struct sof_dai_private_data *dai_data = dai->private; + + kfree(dai_data->comp_dai); + kfree(dai_data->dai_config); + kfree(dai_data); list_del(&dai->list); } break; @@ -2681,11 +2695,13 @@ static int sof_set_dai_config_multi(struct snd_sof_dev *sdev, u32 size, struct sof_ipc_dai_config *config, int num_conf, int curr_conf) { + struct sof_dai_private_data *dai_data; struct snd_sof_dai *dai; int found = 0; int i; list_for_each_entry(dai, &sdev->dai_list, list) { + dai_data = dai->private; if (!dai->name) continue; @@ -2697,15 +2713,15 @@ static int sof_set_dai_config_multi(struct snd_sof_dev *sdev, u32 size, * dai_index. */ for (i = 0; i < num_conf; i++) - config[i].dai_index = dai->comp_dai->dai_index; + config[i].dai_index = dai_data->comp_dai->dai_index; dev_dbg(sdev->dev, "set DAI config for %s index %d\n", dai->name, config[curr_conf].dai_index); dai->number_configs = num_conf; dai->current_config = curr_conf; - dai->dai_config = kmemdup(config, size * num_conf, GFP_KERNEL); - if (!dai->dai_config) + dai_data->dai_config = kmemdup(config, size * num_conf, GFP_KERNEL); + if (!dai_data->dai_config) return -ENOMEM; found = 1; From patchwork Mon Mar 7 18:11:11 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Ranjani Sridharan X-Patchwork-Id: 548894 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 E83F2C433F5 for ; Mon, 7 Mar 2022 18:17:08 +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 2AE9317F0; Mon, 7 Mar 2022 19:16:17 +0100 (CET) DKIM-Filter: OpenDKIM Filter v2.11.0 alsa0.perex.cz 2AE9317F0 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=alsa-project.org; s=default; t=1646677027; bh=mqMyC96t4y2a7Hms6/q4IPPhUc1tUWOwO1EenyeBsJQ=; h=From:To:Subject:Date:In-Reply-To:References:Cc:List-Id: List-Unsubscribe:List-Archive:List-Post:List-Help:List-Subscribe: From; b=CdQef83BUagM1BoMapC6DpKy7k40/VRbLpQXEfKmTcUgDliTsFXvTfJJddBqmlFhY RsILDIzx6U/NPouFMKKVJ2QT6+2twUiIWZd47W8qguCCiinaB8DrwmxSFyfXpqIQJm SQzxq13Ybdz8Mnxjh7cA33Cg2xZUGWXrFslzqYl8= Received: from alsa1.perex.cz (localhost.localdomain [127.0.0.1]) by alsa1.perex.cz (Postfix) with ESMTP id 310E5F8058C; Mon, 7 Mar 2022 19:11:56 +0100 (CET) Received: by alsa1.perex.cz (Postfix, from userid 50401) id 3CA44F80549; Mon, 7 Mar 2022 19:11:51 +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 951BBF80536 for ; Mon, 7 Mar 2022 19:11:41 +0100 (CET) DKIM-Filter: OpenDKIM Filter v2.11.0 alsa1.perex.cz 951BBF80536 Authentication-Results: alsa1.perex.cz; dkim=pass (2048-bit key) header.d=intel.com header.i=@intel.com header.b="XjTWwe9e" DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1646676703; x=1678212703; h=from:to:cc:subject:date:message-id:in-reply-to: references:mime-version:content-transfer-encoding; bh=mqMyC96t4y2a7Hms6/q4IPPhUc1tUWOwO1EenyeBsJQ=; b=XjTWwe9eRLaC7RYETuxVDml8EeHr/+9CuEUn5LyaHdcJjYKmBly20ksz nHeYSJO6K4TM5uxWLXrRV08ZCVBoF2h7CCC8xWxyoOf2IF5H5a7HMVIEj eocr1KuA4pPZ3P+Ov31D8yHJeQumSaJBs9kM4ZAudVaxhnqDZy4aZKEi2 FkMk6Y357QhG1KwLxPgWEx9sag3mvs5CHZPD2Wa3LzjOXXG8PYFalDhF8 5ArwgEIllHLgT7a+6Q3U2Q0pl7gQG9nhlGwARt/boGHEWa/q8oVPghA24 4K96rr0LRN8MNhOKBcO5EaYYR7GKvd/RUQNTJ8OklwWdGF7gbzc6VQ3pe A==; X-IronPort-AV: E=McAfee;i="6200,9189,10279"; a="254401359" X-IronPort-AV: E=Sophos;i="5.90,162,1643702400"; d="scan'208";a="254401359" 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:30 -0800 X-IronPort-AV: E=Sophos;i="5.90,162,1643702400"; d="scan'208";a="495146700" 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:30 -0800 From: Ranjani Sridharan To: alsa-devel@alsa-project.org Subject: [PATCH 18/18] ASoC: SOF: move definition of snd_sof_ipc to header file Date: Mon, 7 Mar 2022 10:11:11 -0800 Message-Id: <20220307181111.49392-19-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, Pierre-Louis Bossart , Ranjani Sridharan , broonie@kernel.org, Rander Wang , =?utf-8?q?P=C3=A9ter_Ujfalusi?= 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" From: Rander Wang Move definition of struct snd_sof_ipc to the header file so it can be shared with new IPC versions. Signed-off-by: Rander Wang Reviewed-by: Péter Ujfalusi Reviewed-by: Ranjani Sridharan Reviewed-by: Pierre-Louis Bossart --- sound/soc/sof/ipc.c | 12 ------------ sound/soc/sof/sof-priv.h | 12 ++++++++++++ 2 files changed, 12 insertions(+), 12 deletions(-) diff --git a/sound/soc/sof/ipc.c b/sound/soc/sof/ipc.c index c729bb7bf8c8..34084e0008f1 100644 --- a/sound/soc/sof/ipc.c +++ b/sound/soc/sof/ipc.c @@ -27,18 +27,6 @@ static void ipc_stream_message(struct snd_sof_dev *sdev, void *msg_buf); * IPC message Tx/Rx message handling. */ -/* SOF generic IPC data */ -struct snd_sof_ipc { - struct snd_sof_dev *sdev; - - /* protects messages and the disable flag */ - struct mutex tx_mutex; - /* disables further sending of ipc's */ - bool disable_ipc_tx; - - struct snd_sof_ipc_msg msg; -}; - struct sof_ipc_ctrl_data_params { size_t msg_bytes; size_t hdr_bytes; diff --git a/sound/soc/sof/sof-priv.h b/sound/soc/sof/sof-priv.h index 2e19ac619ad5..7f0514db4d06 100644 --- a/sound/soc/sof/sof-priv.h +++ b/sound/soc/sof/sof-priv.h @@ -345,6 +345,18 @@ struct snd_sof_ipc_msg { bool ipc_complete; }; +/* SOF generic IPC data */ +struct snd_sof_ipc { + struct snd_sof_dev *sdev; + + /* protects messages and the disable flag */ + struct mutex tx_mutex; + /* disables further sending of ipc's */ + bool disable_ipc_tx; + + struct snd_sof_ipc_msg msg; +}; + /* * SOF Device Level. */