From patchwork Fri Nov 4 13:12:42 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Cezary Rojewski X-Patchwork-Id: 13031703 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 65FC7C433FE for ; Fri, 4 Nov 2022 12:57:30 +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 70034164D; Fri, 4 Nov 2022 13:56:38 +0100 (CET) DKIM-Filter: OpenDKIM Filter v2.11.0 alsa0.perex.cz 70034164D DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=alsa-project.org; s=default; t=1667566648; bh=gYttK6lyXB6FJSnFqhLPWNrRIzhDxzxvFT7b0LWR+kk=; h=From:To:Subject:Date:In-Reply-To:References:Cc:List-Id: List-Unsubscribe:List-Archive:List-Post:List-Help:List-Subscribe: From; b=Ulb+eyAFwdz/FzxCFiJhgAUrN8BiiaEw4GCuyUI0gHdJokUzCrsR1UFVgegeO8WUe /R628na3EURmlY+7UIWNLKKBm95V2QMMVQR1AGdkPtRlAiEAGpY2SqC+sH8gN9djRN obJHKe2EcqopKkRg400vbO4XzHCUBrG47ZEU/7fQ= Received: from alsa1.perex.cz (localhost.localdomain [127.0.0.1]) by alsa1.perex.cz (Postfix) with ESMTP id 7CB94F80448; Fri, 4 Nov 2022 13:56:19 +0100 (CET) Received: by alsa1.perex.cz (Postfix, from userid 50401) id D4D56F80506; Fri, 4 Nov 2022 13:56:17 +0100 (CET) Received: from mga17.intel.com (mga17.intel.com [192.55.52.151]) (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 2E651F80149 for ; Fri, 4 Nov 2022 13:56:10 +0100 (CET) DKIM-Filter: OpenDKIM Filter v2.11.0 alsa1.perex.cz 2E651F80149 Authentication-Results: alsa1.perex.cz; dkim=pass (2048-bit key) header.d=intel.com header.i=@intel.com header.b="Vs+v4DDb" DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1667566572; x=1699102572; h=from:to:cc:subject:date:message-id:in-reply-to: references:mime-version:content-transfer-encoding; bh=gYttK6lyXB6FJSnFqhLPWNrRIzhDxzxvFT7b0LWR+kk=; b=Vs+v4DDbvPlj8BM42MHTLXEflPgKuIVHjKj4SL7DqJxmxJ7tRFLw1Cfd gRuy7g1RsMKCezglb1PPTlrFGq6dYi2wknGfrYdWdOQnpq/39bdubMyqx lUNXOGGm1R+A61ULJjQZshRRxVxb73uLPi41gcrkwq+Td/UAcqm+F1xMo CfP+giUOIFVqGX16Q1VSNWqI7Gr8q9Dxkx9h4LPF+kSIoQyntzO9jFgZs zTcoiXw8Z+ah4CmeYm86ciY/nMF1roCjr+McO4628yMz6oNOAW5fAMJ7R dxRE7Xgj7nGVorql2g9ZFNrt8TZmZZpteVjtSzVdSTXJOekfM/jeckucN g==; X-IronPort-AV: E=McAfee;i="6500,9779,10520"; a="290347647" X-IronPort-AV: E=Sophos;i="5.96,137,1665471600"; d="scan'208";a="290347647" Received: from orsmga008.jf.intel.com ([10.7.209.65]) by fmsmga107.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 04 Nov 2022 05:55:50 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=McAfee;i="6500,9779,10520"; a="666357618" X-IronPort-AV: E=Sophos;i="5.96,137,1665471600"; d="scan'208";a="666357618" Received: from crojewsk-ctrl.igk.intel.com ([10.102.9.28]) by orsmga008.jf.intel.com with ESMTP; 04 Nov 2022 05:55:48 -0700 From: Cezary Rojewski To: alsa-devel@alsa-project.org, broonie@kernel.org Subject: [PATCH 1/3] ASoC: component: Propagate result of suspend and resume callbacks Date: Fri, 4 Nov 2022 14:12:42 +0100 Message-Id: <20221104131244.3920179-2-cezary.rojewski@intel.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20221104131244.3920179-1-cezary.rojewski@intel.com> References: <20221104131244.3920179-1-cezary.rojewski@intel.com> MIME-Version: 1.0 Cc: Cezary Rojewski , pierre-louis.bossart@linux.intel.com, tiwai@suse.com, hdegoede@redhat.com, amadeuszx.slawinski@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: Amadeusz Sławiński Both component->driver->suspend and ->resume() do return an int value but it isn't propagated to the core later on. Update snd_soc_component_suspend() and snd_soc_component_resume() so that the possible errors are not squelched. Signed-off-by: Amadeusz Sławiński Signed-off-by: Cezary Rojewski --- include/sound/soc-component.h | 4 ++-- sound/soc/soc-component.c | 22 ++++++++++++++++------ 2 files changed, 18 insertions(+), 8 deletions(-) diff --git a/include/sound/soc-component.h b/include/sound/soc-component.h index c26ffb033777..421f0fc4df3e 100644 --- a/include/sound/soc-component.h +++ b/include/sound/soc-component.h @@ -456,8 +456,8 @@ int snd_soc_component_open(struct snd_soc_component *component, int snd_soc_component_close(struct snd_soc_component *component, struct snd_pcm_substream *substream, int rollback); -void snd_soc_component_suspend(struct snd_soc_component *component); -void snd_soc_component_resume(struct snd_soc_component *component); +int snd_soc_component_suspend(struct snd_soc_component *component); +int snd_soc_component_resume(struct snd_soc_component *component); int snd_soc_component_is_suspended(struct snd_soc_component *component); int snd_soc_component_probe(struct snd_soc_component *component); void snd_soc_component_remove(struct snd_soc_component *component); diff --git a/sound/soc/soc-component.c b/sound/soc/soc-component.c index e12f8244242b..27b862ded846 100644 --- a/sound/soc/soc-component.c +++ b/sound/soc/soc-component.c @@ -318,18 +318,28 @@ int snd_soc_component_close(struct snd_soc_component *component, return soc_component_ret(component, ret); } -void snd_soc_component_suspend(struct snd_soc_component *component) +int snd_soc_component_suspend(struct snd_soc_component *component) { + int ret = 0; + if (component->driver->suspend) - component->driver->suspend(component); - component->suspended = 1; + ret = component->driver->suspend(component); + if (!ret) + component->suspended = 1; + + return soc_component_ret(component, ret); } -void snd_soc_component_resume(struct snd_soc_component *component) +int snd_soc_component_resume(struct snd_soc_component *component) { + int ret = 0; + if (component->driver->resume) - component->driver->resume(component); - component->suspended = 0; + ret = component->driver->resume(component); + if (!ret) + component->suspended = 0; + + return soc_component_ret(component, ret); } int snd_soc_component_is_suspended(struct snd_soc_component *component) From patchwork Fri Nov 4 13:12:43 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Cezary Rojewski X-Patchwork-Id: 13031705 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 3C85CC43217 for ; Fri, 4 Nov 2022 12:58:02 +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 50CAA167C; Fri, 4 Nov 2022 13:57:10 +0100 (CET) DKIM-Filter: OpenDKIM Filter v2.11.0 alsa0.perex.cz 50CAA167C DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=alsa-project.org; s=default; t=1667566680; bh=fcJRCq8vFAi69iV9pIYexezI37DVzt5sEIIONHErmt8=; h=From:To:Subject:Date:In-Reply-To:References:Cc:List-Id: List-Unsubscribe:List-Archive:List-Post:List-Help:List-Subscribe: From; b=t90EkB41IHdYgmox//FVK5t7e+9GDbEbFqk3qGpYhu8jV3x5BLjxQgV5neyUwNrfw 6iD4FOMw01TME/NpYftNi2ZBGb9nuxcw3+OktzM5h6z7gVX7YWwG4HxgpGSOyX6dj8 XxanuRFL+RG3G1o6ktwSBcPGmkTVrIbQC6bE/Gk4= Received: from alsa1.perex.cz (localhost.localdomain [127.0.0.1]) by alsa1.perex.cz (Postfix) with ESMTP id 8BB30F80559; Fri, 4 Nov 2022 13:56:22 +0100 (CET) Received: by alsa1.perex.cz (Postfix, from userid 50401) id 07EC8F80553; Fri, 4 Nov 2022 13:56:21 +0100 (CET) Received: from mga17.intel.com (mga17.intel.com [192.55.52.151]) (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 2CA2CF804AC for ; Fri, 4 Nov 2022 13:56:12 +0100 (CET) DKIM-Filter: OpenDKIM Filter v2.11.0 alsa1.perex.cz 2CA2CF804AC Authentication-Results: alsa1.perex.cz; dkim=pass (2048-bit key) header.d=intel.com header.i=@intel.com header.b="e6K1l1Rk" DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1667566574; x=1699102574; h=from:to:cc:subject:date:message-id:in-reply-to: references:mime-version:content-transfer-encoding; bh=fcJRCq8vFAi69iV9pIYexezI37DVzt5sEIIONHErmt8=; b=e6K1l1RkHwUvwuZpqY0cZjFfm/+4dgp0hbQ1CqKE4m9X2vEHKxlKW60F Pwbo5p+OD10Gt8JrbtYFRVPk1CxSkDKiaSElvFKSZYwCqo6Ln3XrNGyWt DIBg2+oA2lO1hov+nY+CDXOeDuskai7T+oEkVSuo+qjhDcmkvtaEA6elp a7972rP88Ms4yNtx+RM+uYkw5b06c/8oxo7NbjaUI/THtYYVYGJZR7dix 36iZ0BxLMRnxiZBDMxfglLTX56NuyC0olx3a3kj1NGJn5wtPvKomgMb09 ePonnOB7jI8BOoqMKQ//YU+9OaVrbneBPCH5jAvbkdy8PW/3FuAIvZ+TS A==; X-IronPort-AV: E=McAfee;i="6500,9779,10520"; a="290347658" X-IronPort-AV: E=Sophos;i="5.96,137,1665471600"; d="scan'208";a="290347658" Received: from orsmga008.jf.intel.com ([10.7.209.65]) by fmsmga107.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 04 Nov 2022 05:55:52 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=McAfee;i="6500,9779,10520"; a="666357632" X-IronPort-AV: E=Sophos;i="5.96,137,1665471600"; d="scan'208";a="666357632" Received: from crojewsk-ctrl.igk.intel.com ([10.102.9.28]) by orsmga008.jf.intel.com with ESMTP; 04 Nov 2022 05:55:50 -0700 From: Cezary Rojewski To: alsa-devel@alsa-project.org, broonie@kernel.org Subject: [PATCH 2/3] ASoC: core: Inline resume work back to resume function Date: Fri, 4 Nov 2022 14:12:43 +0100 Message-Id: <20221104131244.3920179-3-cezary.rojewski@intel.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20221104131244.3920179-1-cezary.rojewski@intel.com> References: <20221104131244.3920179-1-cezary.rojewski@intel.com> MIME-Version: 1.0 Cc: Cezary Rojewski , pierre-louis.bossart@linux.intel.com, tiwai@suse.com, hdegoede@redhat.com, amadeuszx.slawinski@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: Amadeusz Sławiński Commit 6ed2597883b1 ("ALSA: ASoC: Don't block system resume") introduced deferred_resume_work for ASoC subsystem. While this allows for potential speed up during boot on some slow devices, it doesn't allow to properly propagate return values in case something failed during system resume. Signed-off-by: Amadeusz Sławiński Signed-off-by: Cezary Rojewski --- include/sound/soc.h | 3 --- sound/soc/soc-core.c | 48 +++++++++++--------------------------------- 2 files changed, 12 insertions(+), 39 deletions(-) diff --git a/include/sound/soc.h b/include/sound/soc.h index 37bbfc8b45cb..3465aa075afe 100644 --- a/include/sound/soc.h +++ b/include/sound/soc.h @@ -1005,9 +1005,6 @@ struct snd_soc_card { #ifdef CONFIG_DEBUG_FS struct dentry *debugfs_card_root; -#endif -#ifdef CONFIG_PM_SLEEP - struct work_struct deferred_resume_work; #endif u32 pop_time; diff --git a/sound/soc/soc-core.c b/sound/soc/soc-core.c index a409fbed8f34..5f7e0735f0c1 100644 --- a/sound/soc/soc-core.c +++ b/sound/soc/soc-core.c @@ -643,17 +643,21 @@ int snd_soc_suspend(struct device *dev) } EXPORT_SYMBOL_GPL(snd_soc_suspend); -/* - * deferred resume work, so resume can complete before we finished - * setting our codec back up, which can be very slow on I2C - */ -static void soc_resume_deferred(struct work_struct *work) +/* powers up audio subsystem after a suspend */ +int snd_soc_resume(struct device *dev) { - struct snd_soc_card *card = - container_of(work, struct snd_soc_card, - deferred_resume_work); + struct snd_soc_card *card = dev_get_drvdata(dev); struct snd_soc_component *component; + /* If the card is not initialized yet there is nothing to do */ + if (!card->instantiated) + return 0; + + /* activate pins from sleep state */ + for_each_card_components(card, component) + if (snd_soc_component_active(component)) + pinctrl_pm_select_default_state(component->dev); + /* * our power state is still SNDRV_CTL_POWER_D3hot from suspend time, * so userspace apps are blocked from touching us @@ -686,40 +690,14 @@ static void soc_resume_deferred(struct work_struct *work) /* userspace can access us now we are back as we were before */ snd_power_change_state(card->snd_card, SNDRV_CTL_POWER_D0); -} - -/* powers up audio subsystem after a suspend */ -int snd_soc_resume(struct device *dev) -{ - struct snd_soc_card *card = dev_get_drvdata(dev); - struct snd_soc_component *component; - - /* If the card is not initialized yet there is nothing to do */ - if (!card->instantiated) - return 0; - - /* activate pins from sleep state */ - for_each_card_components(card, component) - if (snd_soc_component_active(component)) - pinctrl_pm_select_default_state(component->dev); - - dev_dbg(dev, "ASoC: Scheduling resume work\n"); - if (!schedule_work(&card->deferred_resume_work)) - dev_err(dev, "ASoC: resume work item may be lost\n"); return 0; } EXPORT_SYMBOL_GPL(snd_soc_resume); -static void soc_resume_init(struct snd_soc_card *card) -{ - /* deferred resume work */ - INIT_WORK(&card->deferred_resume_work, soc_resume_deferred); -} #else #define snd_soc_suspend NULL #define snd_soc_resume NULL -static inline void soc_resume_init(struct snd_soc_card *card) { } #endif static struct device_node @@ -1968,8 +1946,6 @@ static int snd_soc_bind_card(struct snd_soc_card *card) soc_init_card_debugfs(card); - soc_resume_init(card); - ret = snd_soc_dapm_new_controls(&card->dapm, card->dapm_widgets, card->num_dapm_widgets); if (ret < 0) From patchwork Fri Nov 4 13:12:44 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Cezary Rojewski X-Patchwork-Id: 13031704 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 DF7F3C4332F for ; Fri, 4 Nov 2022 12:57:56 +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 D63C8166C; Fri, 4 Nov 2022 13:57:04 +0100 (CET) DKIM-Filter: OpenDKIM Filter v2.11.0 alsa0.perex.cz D63C8166C DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=alsa-project.org; s=default; t=1667566674; bh=XKlb2jcWfVJnjIFMeDNH4bjJ4sd9I/JknSJojvq83WE=; h=From:To:Subject:Date:In-Reply-To:References:Cc:List-Id: List-Unsubscribe:List-Archive:List-Post:List-Help:List-Subscribe: From; b=ex+5Uovmon8jhZJd5O7r3FIDseX7uixM2MbckiZJMXQKIgSJT+FtbENaC6Q3Ndhx8 9bobN68ckBwKVJgwcAGbY9L0pvedpnmmoBKWfOoJB04dcgFkOs2mP4oDABZYzcZRBW jRhK62eqfP8Io6yY1ImnNfELcCb3ElA1efnLfFQw= Received: from alsa1.perex.cz (localhost.localdomain [127.0.0.1]) by alsa1.perex.cz (Postfix) with ESMTP id 23C18F80552; Fri, 4 Nov 2022 13:56:21 +0100 (CET) Received: by alsa1.perex.cz (Postfix, from userid 50401) id C5C49F80553; Fri, 4 Nov 2022 13:56:19 +0100 (CET) Received: from mga17.intel.com (mga17.intel.com [192.55.52.151]) (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 ADF14F80155 for ; Fri, 4 Nov 2022 13:56:14 +0100 (CET) DKIM-Filter: OpenDKIM Filter v2.11.0 alsa1.perex.cz ADF14F80155 Authentication-Results: alsa1.perex.cz; dkim=pass (2048-bit key) header.d=intel.com header.i=@intel.com header.b="gHWyjgJ9" DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1667566575; x=1699102575; h=from:to:cc:subject:date:message-id:in-reply-to: references:mime-version:content-transfer-encoding; bh=XKlb2jcWfVJnjIFMeDNH4bjJ4sd9I/JknSJojvq83WE=; b=gHWyjgJ9K+snFdlPHUwei+v4PplgpIjNS9t0t9Yg0cXNW//GC+xRM9FT MwiN6ghNTKxi7VMMkywrIBxusMUc0LOaef0NDTRLSrKrSFN2a7AHfbhdY bmm/kvVYLBBFxBJ2F0i8uaqpWW9FdGNgsldbujkSwO2kmGHvLtPx4lfQe c+9yKkJWQJWYD9+9lDRC/Vq5ONjMPilUgpEPmdIKFVTCfyb1hROA6dB/y dfEC7ev0rgG2Z34WQI+yjppzt4qHtDl4O9L7KabhV3priga42oqeDPOh0 Zf1ucO0ea6V7+S/foGq44JEk+OZ+5cAcwWXbq3AZX9lriDM+80+ZUHzpo w==; X-IronPort-AV: E=McAfee;i="6500,9779,10520"; a="290347662" X-IronPort-AV: E=Sophos;i="5.96,137,1665471600"; d="scan'208";a="290347662" Received: from orsmga008.jf.intel.com ([10.7.209.65]) by fmsmga107.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 04 Nov 2022 05:55:55 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=McAfee;i="6500,9779,10520"; a="666357639" X-IronPort-AV: E=Sophos;i="5.96,137,1665471600"; d="scan'208";a="666357639" Received: from crojewsk-ctrl.igk.intel.com ([10.102.9.28]) by orsmga008.jf.intel.com with ESMTP; 04 Nov 2022 05:55:52 -0700 From: Cezary Rojewski To: alsa-devel@alsa-project.org, broonie@kernel.org Subject: [PATCH 3/3] ASoC: core: Propagate component suspend/resume errors Date: Fri, 4 Nov 2022 14:12:44 +0100 Message-Id: <20221104131244.3920179-4-cezary.rojewski@intel.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20221104131244.3920179-1-cezary.rojewski@intel.com> References: <20221104131244.3920179-1-cezary.rojewski@intel.com> MIME-Version: 1.0 Cc: Cezary Rojewski , pierre-louis.bossart@linux.intel.com, tiwai@suse.com, hdegoede@redhat.com, amadeuszx.slawinski@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: Amadeusz Sławiński In case there is a failure during component suspend/resume, error should be propagated back to callers. Signed-off-by: Amadeusz Sławiński Signed-off-by: Cezary Rojewski --- sound/soc/soc-core.c | 27 ++++++++++++++++++++++----- 1 file changed, 22 insertions(+), 5 deletions(-) diff --git a/sound/soc/soc-core.c b/sound/soc/soc-core.c index 5f7e0735f0c1..931b4dc95234 100644 --- a/sound/soc/soc-core.c +++ b/sound/soc/soc-core.c @@ -550,6 +550,7 @@ int snd_soc_suspend(struct device *dev) struct snd_soc_card *card = dev_get_drvdata(dev); struct snd_soc_component *component; struct snd_soc_pcm_runtime *rtd; + int ret = 0; int i; /* If the card is not initialized yet there is nothing to do */ @@ -623,7 +624,14 @@ int snd_soc_suspend(struct device *dev) fallthrough; case SND_SOC_BIAS_OFF: - snd_soc_component_suspend(component); + ret = snd_soc_component_suspend(component); + if (ret) { + dev_err(component->dev, + "ASoC: Suspend component %s failed: %d\n", + component->name, ret); + goto exit; + } + if (component->regmap) regcache_mark_dirty(component->regmap); /* deactivate pins to sleep state */ @@ -639,7 +647,8 @@ int snd_soc_suspend(struct device *dev) snd_soc_card_suspend_post(card); - return 0; +exit: + return ret; } EXPORT_SYMBOL_GPL(snd_soc_suspend); @@ -648,6 +657,7 @@ int snd_soc_resume(struct device *dev) { struct snd_soc_card *card = dev_get_drvdata(dev); struct snd_soc_component *component; + int ret = 0; /* If the card is not initialized yet there is nothing to do */ if (!card->instantiated) @@ -671,8 +681,14 @@ int snd_soc_resume(struct device *dev) snd_soc_card_resume_pre(card); for_each_card_components(card, component) { - if (snd_soc_component_is_suspended(component)) - snd_soc_component_resume(component); + if (snd_soc_component_is_suspended(component)) { + ret = snd_soc_component_resume(component); + if (ret) { + dev_err(component->dev, "ASoC: Resume component %s failed: %d\n", + component->name, ret); + goto exit; + } + } } soc_dapm_suspend_resume(card, SND_SOC_DAPM_STREAM_RESUME); @@ -691,7 +707,8 @@ int snd_soc_resume(struct device *dev) /* userspace can access us now we are back as we were before */ snd_power_change_state(card->snd_card, SNDRV_CTL_POWER_D0); - return 0; +exit: + return ret; } EXPORT_SYMBOL_GPL(snd_soc_resume);