From patchwork Fri Sep 17 14:36:54 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: "Daniel Baluta (OSS)" X-Patchwork-Id: 12502311 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-16.7 required=3.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,HEADER_FROM_DIFFERENT_DOMAINS,INCLUDES_CR_TRAILER,INCLUDES_PATCH, MAILING_LIST_MULTI,MSGID_FROM_MTA_HEADER,SPF_HELO_NONE,SPF_PASS,URIBL_BLOCKED, USER_AGENT_GIT autolearn=unavailable autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 58E68C433FE for ; Fri, 17 Sep 2021 14:41:15 +0000 (UTC) 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 mail.kernel.org (Postfix) with ESMTPS id D596B60F5B for ; Fri, 17 Sep 2021 14:41:14 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.4.1 mail.kernel.org D596B60F5B Authentication-Results: mail.kernel.org; dmarc=fail (p=none dis=none) header.from=oss.nxp.com Authentication-Results: mail.kernel.org; spf=pass smtp.mailfrom=alsa-project.org 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 7B26817BD; Fri, 17 Sep 2021 16:40:23 +0200 (CEST) DKIM-Filter: OpenDKIM Filter v2.11.0 alsa0.perex.cz 7B26817BD DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=alsa-project.org; s=default; t=1631889673; bh=s8gAY7HwJZDe1gye1Io82H4m9te7Gf7hHvmui+oKtWU=; h=From:To:Subject:Date:In-Reply-To:References:Cc:List-Id: List-Unsubscribe:List-Archive:List-Post:List-Help:List-Subscribe: From; b=DIETaSlhTZDQkhQBKAN+n4MSxX4VF3TwYsnmPKRHNJwpG5wCy/h2s1B++5XgOu3Fv TucKkOfx31S2kgNiB9z6uEvMT0LYB4Nzvf2fEC3e5Le0oPs1ZFnL2d65gtB4J7Hxvr P2IY8tFlCsbDNzwmvByDjSvKOszeDycUNP1QG9F8= Received: from alsa1.perex.cz (localhost.localdomain [127.0.0.1]) by alsa1.perex.cz (Postfix) with ESMTP id F1496F8051D; Fri, 17 Sep 2021 16:37:50 +0200 (CEST) Received: by alsa1.perex.cz (Postfix, from userid 50401) id 7496DF80508; Fri, 17 Sep 2021 16:37:44 +0200 (CEST) Received: from EUR05-VI1-obe.outbound.protection.outlook.com (mail-vi1eur05on2055.outbound.protection.outlook.com [40.107.21.55]) (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 25A78F804E2 for ; Fri, 17 Sep 2021 16:37:34 +0200 (CEST) DKIM-Filter: OpenDKIM Filter v2.11.0 alsa1.perex.cz 25A78F804E2 Authentication-Results: alsa1.perex.cz; dkim=pass (1024-bit key) header.d=NXP1.onmicrosoft.com header.i=@NXP1.onmicrosoft.com header.b="K1MktcqQ" ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=FdwBKRkDM7XYn5Z8DA+BzAUYA2+gbwBY3w3h/DB7WJ9QRAu+9WHiCmpit8uJ4gJS0UXNhnBHd/tXxq4OMrND31TxCL3FBY123gNwdzriVS+JQNs1BkSjjZa8a71s4e0u6J+dFsyxCrtqkGP9eXAS/ER86C23yk+vuo3RMdyb7vLDwnEOq2kLK+FROcaEE7QJBNfmp9pghTkXMAcEc5r1NdE9gQqXpKeROAmqO0UJ29dzKb16hYbBaiBvdwVjKWW1kk01vY3uqBlyRRvE14xPUmX39e57dqfUEnrBmIV4aBc6Wjn5S5sbrKgOgjPzjUsulOufn3mBZ82iXPwCOu8+Fw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector9901; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version; bh=LWD5wI5iOs6NMlLphAnPqTADW6puHMn1kQwbgwbqxHc=; b=StriAxr+nDpF8jG3EyUgfLIZBJnFDFkImBVW31LUbS5/e5cdmoYTvyEopHJGMm1XWDhQ9UBod9cE7yT9icbDk+D+sz+aU2o8bASWkxCDqVnyg3kIeVmERm+bkAz75nDf0IS9In6EjmEQGn/rd1REFJ+L68E8OmMbpH2ZROQ8clFDpofkdZHlukW9PmUx3KHUtEQbONCuGn5QHBlfT1/3kzwcmKfyAnc50Q51FTtaxQm80Fpt73lVUwxhSBCbqE03ZScpEwY41ZbpOsFc3HPxaOujLa43f3nfbsK5B17MRjmwZMHE9j8rGvQm9yt6jTMPvNNCjCTFxkbkw1GWSdEV1g== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass smtp.mailfrom=oss.nxp.com; dmarc=pass action=none header.from=oss.nxp.com; dkim=pass header.d=oss.nxp.com; arc=none DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=NXP1.onmicrosoft.com; s=selector2-NXP1-onmicrosoft-com; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=LWD5wI5iOs6NMlLphAnPqTADW6puHMn1kQwbgwbqxHc=; b=K1MktcqQWK8/51fIYlFVsm08tDx/k4fp7LBo7feV82wFrAPK6pcgdW+EnzA4gapUwFRWCjfvWR2yNe0aYea5L08FyhsvtKqJH/DSpD3rKeX20xszry0anyUPf8cLGiIeZE4aMeVDor9ZxoSYC0qlwgi0PC7reffFVdlr2cN0qPg= Authentication-Results: kernel.org; dkim=none (message not signed) header.d=none;kernel.org; dmarc=none action=none header.from=oss.nxp.com; Received: from AM0PR04MB5140.eurprd04.prod.outlook.com (2603:10a6:208:ca::21) by AM0PR0402MB3506.eurprd04.prod.outlook.com (2603:10a6:208:17::29) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.4523.14; Fri, 17 Sep 2021 14:37:27 +0000 Received: from AM0PR04MB5140.eurprd04.prod.outlook.com ([fe80::dd84:b996:1c8:705]) by AM0PR04MB5140.eurprd04.prod.outlook.com ([fe80::dd84:b996:1c8:705%6]) with mapi id 15.20.4523.016; Fri, 17 Sep 2021 14:37:27 +0000 From: Daniel Baluta To: broonie@kernel.org Subject: [PATCH v2 07/12] ASoC: SOF: restore kcontrols for widget during set up Date: Fri, 17 Sep 2021 17:36:54 +0300 Message-Id: <20210917143659.401102-8-daniel.baluta@oss.nxp.com> X-Mailer: git-send-email 2.27.0 In-Reply-To: <20210917143659.401102-1-daniel.baluta@oss.nxp.com> References: <20210917143659.401102-1-daniel.baluta@oss.nxp.com> X-ClientProxiedBy: VI1P193CA0022.EURP193.PROD.OUTLOOK.COM (2603:10a6:800:bd::32) To AM0PR04MB5140.eurprd04.prod.outlook.com (2603:10a6:208:ca::21) MIME-Version: 1.0 X-MS-Exchange-MessageSentRepresentingType: 1 Received: from localhost.localdomain (2a02:2f08:5708:8600:8372:c747:541d:bbc9) by VI1P193CA0022.EURP193.PROD.OUTLOOK.COM (2603:10a6:800:bd::32) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.4523.14 via Frontend Transport; Fri, 17 Sep 2021 14:37:26 +0000 X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-Correlation-Id: 99efe8d7-ff42-4972-e514-08d979e8abc0 X-MS-TrafficTypeDiagnostic: AM0PR0402MB3506: X-MS-Exchange-SharedMailbox-RoutingAgent-Processed: True X-MS-Exchange-Transport-Forked: True X-Microsoft-Antispam-PRVS: X-MS-Oob-TLC-OOBClassifiers: OLM:669; X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: hrFbFoML3pBbjgMUiYvVATrH/mGH9moIRYFrn3l81m6lPNxxoiuqKZZEfzK++kuRoz+TQyfKAb2kOtxQ+echhPGL89JKxR57sLQeOLWJ3crkm11yWFBMWGb2ChK6rEOmy9Rks2WoowznJbI0pTf0CjnEWb77uV3B1M2yu5O1HW5TViiRcvuigm5lTulteAdwit561TCXxJxiF+Nj8pHxZvhwGQuqrkRcwGiBSk2ed0qDGeGo9W+elMGZivqEeDHO5v7jj9JwVq4AgbKFc1KbKm2kKZWV6vyUnYwneOaEf0mrie2UE293UB3YJHyHVXk/P4DD5tjqeIgTdj+MelWXvcGXa6d3W8zppV3s9InfSjb8endZZ42iRSWXLgSKlmA17mcfX8GZAxnW94wBxG4jNlrQJtGzHZMSLFOd3RArOvcCOQHvC8UYa7ery9DtfKRplNV6WGEqkfR68Dz8Ee/4gfrrJhaHnbA2CE+AEbFAIhX4/jr6iNQfzlSgzIhD6goLRLwE23BGxiP74W2F09WjpZhKQRUjp9wYJjMpB7aDLVPn/y/jlSGgNeh0xWBOD9SUhA6gD85hNWmDxa6SD+10e0GPfhqab6htB3OoRPETq/ewqQKE97bNpRnk3DQZDjGxR1zMU7J9mO6rsB07aD477A== X-Forefront-Antispam-Report: CIP:255.255.255.255; CTRY:; LANG:en; SCL:1; SRV:; IPV:NLI; SFV:NSPM; H:AM0PR04MB5140.eurprd04.prod.outlook.com; PTR:; CAT:NONE; SFS:(4636009)(346002)(396003)(39860400002)(136003)(366004)(376002)(186003)(316002)(54906003)(1076003)(7416002)(66476007)(2906002)(6486002)(5660300002)(38100700002)(2616005)(86362001)(66574015)(83380400001)(44832011)(478600001)(4326008)(52116002)(6506007)(6666004)(8936002)(6512007)(66946007)(6916009)(8676002)(66556008); DIR:OUT; SFP:1101; X-MS-Exchange-AntiSp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K6hhJzKnw6df?= =?utf-8?q?0ubcMCFGVMxrBKYYq6p+oG4iTiLMadhubv8Ai+6ZdQzAv/ITvIcX+8R2DZralF0/4?= =?utf-8?q?QQJKEm9/oKH7M9KlfSiahvcf59nY2z+YtFvS8u9rCml97bObq4N428FHhOYxm/Yp9?= =?utf-8?q?EQpHuISDKbLZ883ZqAkbMlali/OcL3x2Q3sSxPd1nryNacP8kTCb0WxcRONemTKKa?= =?utf-8?q?L+f7jIz4TRuFraImZ9+TzrsXr6XWxrrSseno8Giq2noxBhqmUs2vV5ihbxtJwRJv3?= =?utf-8?q?TjwZ41KyRjkTHq3K/IOlATq4bSqSml0Xq1NQ5hN/MG31ERkvEGjEcZWNwG5kQK+x3?= =?utf-8?q?SEtx/gqA2jJqqQyFy5LibHDZrZmVLUWVx52T+BaiN49m5/QGsF799OSM1CfEjxdWD?= =?utf-8?q?mgY6Mau04Pw72olTKnSzFB/DPAmCOJdTre8ALTORj2VWZeoL99Dmq5FQ5P4Uk868e?= =?utf-8?q?tPMLKYzDzHel67+EBIYVPMiEBoHwUIJn5UTD4C/SngRg/9DF9jpLr7jK9SEGmkyoH?= =?utf-8?q?kYt46/qIWrAVawU?= X-OriginatorOrg: oss.nxp.com X-MS-Exchange-CrossTenant-Network-Message-Id: 99efe8d7-ff42-4972-e514-08d979e8abc0 X-MS-Exchange-CrossTenant-AuthSource: AM0PR04MB5140.eurprd04.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 17 Sep 2021 14:37:27.2014 (UTC) X-MS-Exchange-CrossTenant-FromEntityHeader: Hosted X-MS-Exchange-CrossTenant-Id: 686ea1d3-bc2b-4c6f-a92c-d99c5c301635 X-MS-Exchange-CrossTenant-MailboxType: HOSTED X-MS-Exchange-CrossTenant-UserPrincipalName: sSBqPNRWcEsodilkstbx/6I58uu3yIlbCeXjhBemLIVeNix1gI+O53LWG3bq41q1nkjksrNkOebdieZJZI/qSA== X-MS-Exchange-Transport-CrossTenantHeadersStamped: AM0PR0402MB3506 Cc: pierre-louis.bossart@linux.intel.com, alsa-devel@alsa-project.org, Seppo Ingalsuo , kai.vehmanen@linux.intel.com, lgirdwood@gmail.com, linux-kernel@vger.kernel.org, =?utf-8?q?P=C3=A9ter_Ujf?= =?utf-8?q?alusi?= , ranjani.sridharan@linux.intel.com, Guennadi Liakhovetski , daniel.baluta@nxp.com 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: Ranjani Sridharan Restore kcontrols for each widget after it has been set up successfully. Signed-off-by: Ranjani Sridharan Signed-off-by: Kai Vehmanen Reviewed-by: Guennadi Liakhovetski Reviewed-by: Pierre-Louis Bossart Reviewed-by: Péter Ujfalusi Reviewed-by: Seppo Ingalsuo Signed-off-by: Daniel Baluta --- sound/soc/sof/sof-audio.c | 59 ++++++++++++++++++++++----------------- 1 file changed, 33 insertions(+), 26 deletions(-) diff --git a/sound/soc/sof/sof-audio.c b/sound/soc/sof/sof-audio.c index b52a453ae9d7..b27760208a4b 100644 --- a/sound/soc/sof/sof-audio.c +++ b/sound/soc/sof/sof-audio.c @@ -64,6 +64,25 @@ static int sof_dai_config_setup(struct snd_sof_dev *sdev, struct snd_sof_dai *da return ret; } +static int sof_widget_kcontrol_setup(struct snd_sof_dev *sdev, struct snd_sof_widget *swidget) +{ + struct snd_sof_control *scontrol; + int ret; + + /* set up all controls for the widget */ + list_for_each_entry(scontrol, &sdev->kcontrol_list, list) + if (scontrol->comp_id == swidget->comp_id) { + ret = sof_kcontrol_setup(sdev, scontrol); + if (ret < 0) { + dev_err(sdev->dev, "error: fail to set up kcontrols for widget %s\n", + swidget->widget->name); + return ret; + } + } + + return 0; +} + static int sof_widget_setup(struct snd_sof_dev *sdev, struct snd_sof_widget *swidget) { struct sof_ipc_pipe_new *pipeline; @@ -113,10 +132,20 @@ static int sof_widget_setup(struct snd_sof_dev *sdev, struct snd_sof_widget *swi &r, sizeof(r)); break; } - if (ret < 0) + if (ret < 0) { dev_err(sdev->dev, "error: failed to load widget %s\n", swidget->widget->name); - else - dev_dbg(sdev->dev, "widget %s setup complete\n", swidget->widget->name); + return ret; + } + + /* restore kcontrols for widget */ + ret = sof_widget_kcontrol_setup(sdev, swidget); + if (ret < 0) { + dev_err(sdev->dev, "error: failed to restore kcontrols for widget %s\n", + swidget->widget->name); + return ret; + } + + dev_dbg(sdev->dev, "widget %s setup complete\n", swidget->widget->name); return ret; } @@ -203,22 +232,6 @@ int sof_set_hw_params_upon_resume(struct device *dev) return snd_sof_dsp_hw_params_upon_resume(sdev); } -static int sof_restore_kcontrols(struct device *dev) -{ - struct snd_sof_dev *sdev = dev_get_drvdata(dev); - struct snd_sof_control *scontrol; - int ret = 0; - - /* restore kcontrol values */ - list_for_each_entry(scontrol, &sdev->kcontrol_list, list) { - ret = sof_kcontrol_setup(sdev, scontrol); - if (ret < 0) - return ret; - } - - return 0; -} - const struct sof_ipc_pipe_new *snd_sof_pipeline_find(struct snd_sof_dev *sdev, int pipeline_id) { @@ -309,13 +322,7 @@ int sof_restore_pipelines(struct device *dev) } } - /* restore pipeline kcontrols */ - ret = sof_restore_kcontrols(dev); - if (ret < 0) - dev_err(dev, - "error: restoring kcontrols after resume\n"); - - return ret; + return 0; } /* This function doesn't free widgets. It only resets the set up status for all routes */