From patchwork Thu Sep 16 11:16:41 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: 12498733 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, 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 311E7C433EF for ; Thu, 16 Sep 2021 11:20:43 +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 A797460F6D for ; Thu, 16 Sep 2021 11:20:42 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.4.1 mail.kernel.org A797460F6D 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 41EC718AB; Thu, 16 Sep 2021 13:19:51 +0200 (CEST) DKIM-Filter: OpenDKIM Filter v2.11.0 alsa0.perex.cz 41EC718AB DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=alsa-project.org; s=default; t=1631791241; bh=p0eQnZFTrLARXBAjbtsO+KJY25qNLRMvLKylKhIhSoE=; h=From:To:Subject:Date:In-Reply-To:References:Cc:List-Id: List-Unsubscribe:List-Archive:List-Post:List-Help:List-Subscribe: From; b=OgZ5uNfm69qTAtw7OPeQJEwhu3PH2Tk3npN79uiEY59CXAIgfcP8AjEMa/kBz2nqM DCDvez0uY53RZYVx61N1Xh4ADlbifeYboo0J7nybwOWb0+nZiIFibPuaCS62JHczpe jaQ5gteIr9Mvc+jDu7WTecr0aqQOWOJtF9Y/j4nk= Received: from alsa1.perex.cz (localhost.localdomain [127.0.0.1]) by alsa1.perex.cz (Postfix) with ESMTP id BBD5BF80519; Thu, 16 Sep 2021 13:17:36 +0200 (CEST) Received: by alsa1.perex.cz (Postfix, from userid 50401) id 2B34EF80510; Thu, 16 Sep 2021 13:17:32 +0200 (CEST) Received: from EUR03-VE1-obe.outbound.protection.outlook.com (mail-eopbgr50050.outbound.protection.outlook.com [40.107.5.50]) (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 D05ECF804CA for ; Thu, 16 Sep 2021 13:17:18 +0200 (CEST) DKIM-Filter: OpenDKIM Filter v2.11.0 alsa1.perex.cz D05ECF804CA Authentication-Results: alsa1.perex.cz; dkim=pass (1024-bit key) header.d=NXP1.onmicrosoft.com header.i=@NXP1.onmicrosoft.com header.b="lfM6eHzn" ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=Tf3ANdliIJGoHmoNpuhD2tQ0eyAGbPEPNT8nbB/zv2v5ZQKK5+V3y6YHz7YsOSzzd4lYmbf/9S/r5+H39D41U+M/98l4rDFki2/N3iw5C6qQKptNY3rAFISeJUQZeJhHn79QivnNJMWF8T5N1Y0vwqATfYDvP/IT7XAK0z4mpP+Ewfipt7H+1G8bOj3NxvSrx030JzZox0kF1+cMiMxELmRmEY1Oee0gOdfWcYUxUClZltgmzw4/T75SW3CAvKxbCeUcDYW4pJ8fJmUVY/tccDEkQuB2u4t9xlPCIdPX+7GyiDxTxVjmuQ6Wi8WaYGpZO4qJ07Q4CP5gg0u4/pqm3g== 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=qtCBUgXbw0Jm/D+hAyrYpV07ZReay7t/+4NPNz5XDgA=; b=Oj2VDHXgxTIsbU1ElWGZ4z+z/EXOqOaI6TMaCHBbzbs0jK209UV46l8IITPZ3iiLiFVLyAk1LnOgxLPUozs+tAJoBtPDYbDQnr8ATebwoT4Ij91cmHyBB8yASrFoohabjeJ+tXmYJWP3mb4rLZhUJUd5v1VPjlIxky5pRKr15Px6iZzHad65a0vgOe15UYVUgU1vkkZdE3SS31DRmRPSVMExar52GKzsU4QpirlIrk8yIHy75zQHTb5onwXZEfR3ag0yKxfN8tiliMHAttiEWhYRKS1JIRFStNglsNI5mI7xi8QRD4BuZHuO14Z5wiDrqY6zvopcWUPkeHGDGmSH3g== 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=qtCBUgXbw0Jm/D+hAyrYpV07ZReay7t/+4NPNz5XDgA=; b=lfM6eHznp2F2Y/jKlQFe86Aeh4ZTggjKe6O2XrE1bgTZw5/NoAkEMhgJ/5WEFyH4+9cZJVnEgv8s6+i3k0Wqz/wt5T+DY90Vh2w3E71JUEyHLm2vCLS94laD+tYc3t3gotK5Oo90b2j1FYNMSjVIu3W2h435e2uSmgl/N0J3K8k= 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 VI1PR04MB5151.eurprd04.prod.outlook.com (2603:10a6:803:61::28) by VI1PR04MB4926.eurprd04.prod.outlook.com (2603:10a6:803:51::16) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.4500.18; Thu, 16 Sep 2021 11:17:14 +0000 Received: from VI1PR04MB5151.eurprd04.prod.outlook.com ([fe80::499b:ba92:db2e:3f28]) by VI1PR04MB5151.eurprd04.prod.outlook.com ([fe80::499b:ba92:db2e:3f28%7]) with mapi id 15.20.4500.020; Thu, 16 Sep 2021 11:17:14 +0000 From: Daniel Baluta To: broonie@kernel.org Subject: [PATCH 07/12] ASoC: SOF: restore kcontrols for widget during set up Date: Thu, 16 Sep 2021 14:16:41 +0300 Message-Id: <20210916111646.367133-8-daniel.baluta@oss.nxp.com> X-Mailer: git-send-email 2.27.0 In-Reply-To: <20210916111646.367133-1-daniel.baluta@oss.nxp.com> References: <20210916111646.367133-1-daniel.baluta@oss.nxp.com> X-ClientProxiedBy: AM0PR04CA0037.eurprd04.prod.outlook.com (2603:10a6:208:1::14) To VI1PR04MB5151.eurprd04.prod.outlook.com (2603:10a6:803:61::28) MIME-Version: 1.0 X-MS-Exchange-MessageSentRepresentingType: 1 Received: from localhost.localdomain (2a02:2f08:5708:8600:b29c:ccfa:a961:8ebd) by AM0PR04CA0037.eurprd04.prod.outlook.com (2603:10a6:208:1::14) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.4523.14 via Frontend Transport; Thu, 16 Sep 2021 11:17:12 +0000 X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-Correlation-Id: 64e140bc-1185-45da-a63e-08d9790388d1 X-MS-TrafficTypeDiagnostic: VI1PR04MB4926: 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: 1a8uFkoRfN6aiPGn5ArN6x3TBtYQnVfb7HhlqZfz+XvOVf/+CedljUUF/Ivr1Ya5pksoXXpdO8cMVOJOkT+/sYp8lcFsH4qPyFitMNHq+kUeEy1d64fO0thGf7ITHMEZqiyX+76yaofXCTmW84t4LDNh6iyKhoEbhVFKoMDziSITodEBIO+7i1LzmnIqbpYmbvCBD/CjBZ7k7H+sKRpOjUTz0D2d0OUW/ERyeNzPe7nPDycIMvTWHxsgVK/fbxkRXDyLuj5F5tQQrsbBmjRxkjMI+MwYnYVOA+o8HtOckBvfqS8uFgedRAMaaEYs5TC6qUeG7DDT3qM4j4kJRnObajUu72GvQibtB+473ep9u6+1vjdL5KCxQqfG1ET/vWzOuWnE7QJdQuzEIrYpg6EG3Ytvgd1ABIEZnZGPl4T7rQBijwwGz8+h+sSZYtEKxh0oU2DT1zr6vgcWyvMNtRZ4v47x4l+yXfQCKKjAibc1ksCnGoL+DjP56vwrcSLhbwvQ3C/YuMXqX5zI6IzkP+UCP6IwKaiAJqHIo30+TcjxiFkwPVYfmYBmf2eNwAJvBYrRy9yT81DWjgzDzpZYAW3xkq5K9D2JjzzK8/9UgEsWaxZwlIIs5pTqje02Ij9ON7B3/Q7qtyanchnbmvcJXGEemQ== X-Forefront-Antispam-Report: CIP:255.255.255.255; CTRY:; LANG:en; SCL:1; SRV:; IPV:NLI; SFV:NSPM; H:VI1PR04MB5151.eurprd04.prod.outlook.com; PTR:; CAT:NONE; SFS:(4636009)(39860400002)(366004)(136003)(376002)(346002)(396003)(4326008)(8936002)(7416002)(6486002)(186003)(83380400001)(6916009)(2616005)(5660300002)(66946007)(52116002)(478600001)(8676002)(6512007)(6506007)(54906003)(86362001)(2906002)(66574015)(44832011)(66476007)(66556008)(316002)(1076003)(38100700002)(6666004); DIR:OUT; SFP:1101; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: =?utf-8?q?5IxGbk15YLT/+3Ck3UH4RRioRwMx?= =?utf-8?q?AnE0mi/GaTxZxemgLOPHu38lzTbXRTh2RZAsawZlQuBXAGtys8GI+bltoLYW7gtAs?= =?utf-8?q?UVabnuxrZMkeaiPj5LZroHdd33VbcCoro+iNLz5AT9YPlph2oDv0GAoVbbvgrLPKo?= =?utf-8?q?R1Fm9C1mPKdO524SWh6toR9guRCNd5AAcKAZyrIAzlaeBe1d6G+eJ+hlRdn3AnT2K?= =?utf-8?q?Mcq+cHtOe74EPFZRIaJFiKFWRq1iWpZbf5p78b/tR/A8vxuk1B4xZr0/VhKraeInd?= =?utf-8?q?dq0b5UqDAmp+l6i3m2BiPm/wRlJZbc9pfRkoFXX32Jd2okCVgDjRxEQJTM+zz6s4y?= =?utf-8?q?UzjTnCmzsW0nAl+8A/qcKXs9PpVD9pLpZ+VFAsQZJkbBFO6XreDqEvmNnO0jah2eq?= =?utf-8?q?/DDNEYjlR3u7kgJsxp/+aw919KwP7iZxn9BY3C6Ico01qGRts9qJBBEQVCh3SjdbC?= =?utf-8?q?dVEn9C60yB1iIv9oTwmAQLE7Ibhg+u4WkVUGAHOCAkDS7qKam7kVrkR5F/pfoms7q?= =?utf-8?q?wMDvlk+1sP7y9XCpEQrfwncHGUXXFzldcx/337am9MeNPW6vSANkvd9urMRs58SnQ?= =?utf-8?q?9PPgHU2cCHCzY+tsGV9wKzRbchNZ8ti62WStW+j9BMGFrhIcGs9c2mDeupyINfgXz?= =?utf-8?q?25P9MXFNK88HbJ79mP1gvD4y/YmShhAYb1X3g9koWBplQW0twuVOQBGw8cj/vX3QK?= =?utf-8?q?QarTkmbSRHJrk6hVVdxjvV6elqhgDxLtCUT9OyGv0qtk8BhyDdz8wfINO/L7K54EI?= =?utf-8?q?bD0uc5y1/o71tho/8rDJ115yNX7tVdlc1ZhrHWh2XGqksmQ73uAtTMzk9Ku0X/RIC?= =?utf-8?q?x5VZMLolhgCcgujkWLEox1hk87LnNQuhpdV1uAS5ko7BcdF8o/i6TCKk36+wR/Rdz?= =?utf-8?q?a4uyPiVoJfrv1uPiFg1E/33qkm7AQ/XNAEGEr+jjrTwc6qH2xA4M91vc+rNBUxW1e?= =?utf-8?q?mbWJ24TA3vOzZjqDeZPJYBVjrd1XbnKN6CQDPCSeaftFKQKZZ3ZJnxjYzwN8G/I16?= =?utf-8?q?Aqujhe+oFwvNppfBsy4GIoiTFqpwbsqau/A8pBMT+CSTXqMR4qCZCRC71gmioqjjO?= =?utf-8?q?dy7w0DCAw9X563jsmtR0GhtlXftit4plbsIchuiRB/lNLvhhtwaJ+tS7oaTwzaIW7?= =?utf-8?q?vTYqH57+yymXaHYIzXtV0cHTRXuXNssHHYHyzUUTTqFSvOSji9sjoNk2WKBgXhx2I?= =?utf-8?q?urgQq0vnII3bFN/kn5OdjX+/ljdTmmRgrCJgiRtKQCn6ThpYqZxdLOWFs2Bu6pRWf?= =?utf-8?q?6R+YsNGcBDIW0Zn+rpwy22p31qihUDy+38UyOF0JkPsGga96WVvdn036iXfkQKdGq?= =?utf-8?q?xeSCBsyZ5yhTdqFy24dXfLtVKzMlqviBGJdQg=3D=3D?= X-OriginatorOrg: oss.nxp.com X-MS-Exchange-CrossTenant-Network-Message-Id: 64e140bc-1185-45da-a63e-08d9790388d1 X-MS-Exchange-CrossTenant-AuthSource: VI1PR04MB5151.eurprd04.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 16 Sep 2021 11:17:13.9907 (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: KN4m427d8OCaSOgH9mmaiFlFh/LEYYMV2CbxA9Eh/xJy2O72sHSQkHjVvv6HVZocOlXJGbvhHdR4ctzCVHe3OA== X-MS-Exchange-Transport-CrossTenantHeadersStamped: VI1PR04MB4926 Cc: pierre-louis.bossart@linux.intel.com, alsa-devel@alsa-project.org, Seppo Ingalsuo , kai.vehmanen@linux.intel.com, lgirdwood@gmail.com, daniel.baluta@nxp.com, linux-kernel@vger.kernel.org, =?utf-8?q?P=C3=A9ter_Ujfalusi?= , ranjani.sridharan@linux.intel.com, Guennadi Liakhovetski , peter.ujfalusi@linux.intel.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 --- 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 */