Received: by 2002:a05:6a10:22f:0:0:0:0 with SMTP id 15csp3199676pxk; Mon, 21 Sep 2020 07:42:35 -0700 (PDT) X-Google-Smtp-Source: ABdhPJzfh5vHyUf0sHf071ainXzKJYKN69hiKgAHCvTdjD3ohNUP5h9/90IgDwxwDVguuT0VHApk X-Received: by 2002:a17:906:4d57:: with SMTP id b23mr13885789ejv.496.1600699355637; Mon, 21 Sep 2020 07:42:35 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1600699355; cv=none; d=google.com; s=arc-20160816; b=RVqJSl4oVKH9B1Z5hfyqKJ518T62uz/6fpJ6kfcAC5VSI0IyudKzT8fazLx8+SeMg/ 6HeIjxL2ME0Xl1DUJHnCy8JzIKIU23Hv3IppMJpv6WZXEWzLXaciZcz+AdyXIx6uwRHA pbJ6QvbswjclhYFpxb77jZLr2hcQVMl9kBEN/wQ3N4+w8TXyrNBvnKm5P3sGzR9FqFs0 TxhXasJ98MKfY4fvggn4DMJqrZFxvaw68OrwymzJCkX9vvvN9+BcWPEFO8xckvbiX9TL sfP5E+Qc8bfKUr9iryXVANLXoG+q7L8Z7qrW3QnBigrsA8ISkqjizpLY/5N5ITQZdzZw dN3A== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :references:in-reply-to:message-id:date:subject:cc:to:from :dkim-signature; bh=MHEkfb/+5Lq27TlC83f/Gb6sgBeDUmkMHtoJAQEuSr8=; b=Tbr04g7iNngtNZ4AYPQTChSacEU003S+s5ldXD3Gh+EIP7A3kfmkphBm7ErKzKuIZ9 BCe2IXVfpxnqvfHmkgadkKWrQa1GA5DN6lSnVcTwrWtgXfUTHhJi/vBeJMUZxVo+S19F noxrVO+R184YI+dUO1doaN1Z33XgqZWkGPjjlfwKv+nLtaENJpnErmM+5WMDbiHUQ6BR 55h/q/3fV0P0TnzwT0kNHEdzMssaFiS9sBXoorLUqR9rwNFpB+b3Jt+kgLwlAx7LJAMt YEnsG0HmXp3fDxdkA72saaJaGztNS/ao9c1Cu6ePQdY63W2UJ/vYVxXJTcS2S+uZZJPm A9iA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b=EbGLXQjq; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id df7si10341115edb.271.2020.09.21.07.42.12; Mon, 21 Sep 2020 07:42:35 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b=EbGLXQjq; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1727849AbgIUOko (ORCPT + 99 others); Mon, 21 Sep 2020 10:40:44 -0400 Received: from mail.kernel.org ([198.145.29.99]:49124 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1727466AbgIUOkd (ORCPT ); Mon, 21 Sep 2020 10:40:33 -0400 Received: from sasha-vm.mshome.net (c-73-47-72-35.hsd1.nh.comcast.net [73.47.72.35]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPSA id 358CB2389F; Mon, 21 Sep 2020 14:40:32 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1600699233; bh=DauaKu40AGkfpzJ37rbt4KkUyts9P4szYG6QDESdX/c=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=EbGLXQjqg7W5BXPSyarQvT1cystECX++29CE3wICjwL/Ml+cKUAS5ODPXHH619Njl nyukkE6MZFeP5V89TqmBaqiwIWfyxleL4hofNhBRInWc61atOY+rDZMYwVHovATlHg 8MLzZxVot/jdKVrVPhySbw1SX0VupqnPwAvI4l9A= From: Sasha Levin To: linux-kernel@vger.kernel.org, stable@vger.kernel.org Cc: Sylwester Nawrocki , Krzysztof Kozlowski , Charles Keepax , Mark Brown , Sasha Levin , patches@opensource.cirrus.com, alsa-devel@alsa-project.org Subject: [PATCH AUTOSEL 5.8 04/20] ASoC: wm8994: Ensure the device is resumed in wm89xx_mic_detect functions Date: Mon, 21 Sep 2020 10:40:11 -0400 Message-Id: <20200921144027.2135390-4-sashal@kernel.org> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20200921144027.2135390-1-sashal@kernel.org> References: <20200921144027.2135390-1-sashal@kernel.org> MIME-Version: 1.0 X-stable: review X-Patchwork-Hint: Ignore Content-Transfer-Encoding: 8bit Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org From: Sylwester Nawrocki [ Upstream commit f5a2cda4f1db89776b64c4f0f2c2ac609527ac70 ] When the wm8958_mic_detect, wm8994_mic_detect functions get called from the machine driver, e.g. from the card's late_probe() callback, the CODEC device may be PM runtime suspended and any regmap writes have no effect. Add PM runtime calls to these functions to ensure the device registers are updated as expected. This suppresses an error during boot "wm8994-codec: ASoC: error at snd_soc_component_update_bits on wm8994-codec" caused by the regmap access error due to the cache_only flag being set. Signed-off-by: Sylwester Nawrocki Acked-by: Krzysztof Kozlowski Acked-by: Charles Keepax Link: https://lore.kernel.org/r/20200827173357.31891-2-s.nawrocki@samsung.com Signed-off-by: Mark Brown Signed-off-by: Sasha Levin --- sound/soc/codecs/wm8994.c | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/sound/soc/codecs/wm8994.c b/sound/soc/codecs/wm8994.c index c2116836a7203..58f21329d0e99 100644 --- a/sound/soc/codecs/wm8994.c +++ b/sound/soc/codecs/wm8994.c @@ -3491,6 +3491,8 @@ int wm8994_mic_detect(struct snd_soc_component *component, struct snd_soc_jack * return -EINVAL; } + pm_runtime_get_sync(component->dev); + switch (micbias) { case 1: micdet = &wm8994->micdet[0]; @@ -3538,6 +3540,8 @@ int wm8994_mic_detect(struct snd_soc_component *component, struct snd_soc_jack * snd_soc_dapm_sync(dapm); + pm_runtime_put(component->dev); + return 0; } EXPORT_SYMBOL_GPL(wm8994_mic_detect); @@ -3905,6 +3909,8 @@ int wm8958_mic_detect(struct snd_soc_component *component, struct snd_soc_jack * return -EINVAL; } + pm_runtime_get_sync(component->dev); + if (jack) { snd_soc_dapm_force_enable_pin(dapm, "CLK_SYS"); snd_soc_dapm_sync(dapm); @@ -3973,6 +3979,8 @@ int wm8958_mic_detect(struct snd_soc_component *component, struct snd_soc_jack * snd_soc_dapm_sync(dapm); } + pm_runtime_put(component->dev); + return 0; } EXPORT_SYMBOL_GPL(wm8958_mic_detect); -- 2.25.1