Received: by 2002:a05:6a10:206:0:0:0:0 with SMTP id 6csp4744442pxj; Wed, 12 May 2021 12:13:09 -0700 (PDT) X-Google-Smtp-Source: ABdhPJy4WzVmNv5oZX38Pafm7dxUQMQc2keisEUpg9gEkaiFVc9quW53xG3xS0UorqNJ/xLLwK04 X-Received: by 2002:a17:907:f81:: with SMTP id kb1mr39997319ejc.476.1620846789737; Wed, 12 May 2021 12:13:09 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1620846789; cv=none; d=google.com; s=arc-20160816; b=Fpv+5V7STrGwX8mgZrMVCVjS1nMndmd1SI7fLxm/pHnVZjUyEJZrfaX7nxwY4I8I9t 9cvMiEH72sicCX8TAe82hNljDGRX4/VSnL/mYDyQ41pOrs0Dh+6sM96bWhmb6htjZQJY aocmwhZPcEkTeLTun3FN4KqiJIUytDf/FBMgDywfDg9FdHtaNtdd2hDrn1NCVG4G4vKU 6RqMK4/7A+KYPWHXnLcC93d9IekZqhaFsWJq/+p+QyfiAt6yTinsG1LM0tfKa5BlVirD l3pSUAnqwl+xOucjgEAeDtrC8V/ek5hAHLDEPra+C29VpQa1nuKsELjLgCBlTPInTGSg eV6g== 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 :user-agent:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=ShDK9FHIwCOY5Ve1CFyVjgpJhLnK3JXJgafNv7bCp34=; b=tzMR7Hh5mHGxa3jvfoJaaRj9thISORyBzZlGBI3HB9gku7tClmkwCuW2MuJKYH/tVI wHMznLQlKLt3wuYI4x3Ot1aUDh1netJcMi7Frz3xxJRrqvGNGIfKyKRg7BUlC36dilGc PSQDta08Qv0PG52ywAsKM/sWdumCdPhaetjSTbXAIrzUZv7+3HRcgCezmh7jx7uMnCwu jc4Oj7J+V520lzG/XPJEyFbq8R3+UqoJ72RzNXTSWORPIn6jQoIgvg8DVs3IywxZoqLv eW+hiHWjxwh0MXx/mvvR8/br+bNI12tEO1yRxl4oGdoWL9H2SAJnopcwNnW8vvbjUzea b0fg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=YQtuH7s4; 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=linuxfoundation.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id z18si500333edd.346.2021.05.12.12.12.45; Wed, 12 May 2021 12:13:09 -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=@linuxfoundation.org header.s=korg header.b=YQtuH7s4; 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=linuxfoundation.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1376500AbhELSyx (ORCPT + 99 others); Wed, 12 May 2021 14:54:53 -0400 Received: from mail.kernel.org ([198.145.29.99]:33484 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S244056AbhELQma (ORCPT ); Wed, 12 May 2021 12:42:30 -0400 Received: by mail.kernel.org (Postfix) with ESMTPSA id 1154C61D28; Wed, 12 May 2021 16:10:00 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1620835801; bh=SeBajVR7zxpy//SZFnXe9Iv0C+6kzb39wDAbpArz2Ds=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=YQtuH7s4hfLdGsxp03nPGEPIYRnxyvP9nOFRF7vJTIHxh/JbHxIBw07eU+rJEG4w6 2j/vHK8spKTSnExUdqRa6L2LnGVIwPDr5XaoTisLZMSo1OLXyAf3pPA1J2Gy+y/FPG 8PqHCAQJOj6WfanVHc5EuxG7sRjOu45x55Va065A= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Dmitry Osipenko , Mark Brown , Sasha Levin Subject: [PATCH 5.12 455/677] ASoC: tegra30: i2s: Restore hardware state on runtime PM resume Date: Wed, 12 May 2021 16:48:21 +0200 Message-Id: <20210512144852.473359210@linuxfoundation.org> X-Mailer: git-send-email 2.31.1 In-Reply-To: <20210512144837.204217980@linuxfoundation.org> References: <20210512144837.204217980@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org From: Dmitry Osipenko [ Upstream commit 0bbcecaaab15a74ba69f93df46c753f2a64eadca ] Tegra30 I2S driver syncs regmap cache only on resume from system suspend, but hardware is reset across the runtime suspend because RPM of the parent AHUB driver resets the I2S hardware, hence h/w state is lost after each RPM resume. The problem isn't visible because hardware happens to be fully reprogrammed after each RPM resume. Move hardware syncing to RPM resume in order to restore h/w state properly. Fixes: ed9ce1ed2239 ("ASoC: tegra: ahub: Reset hardware properly") Signed-off-by: Dmitry Osipenko Link: https://lore.kernel.org/r/20210314154459.15375-4-digetx@gmail.com Signed-off-by: Mark Brown Signed-off-by: Sasha Levin --- sound/soc/tegra/tegra30_i2s.c | 40 +++++++++++------------------------ 1 file changed, 12 insertions(+), 28 deletions(-) diff --git a/sound/soc/tegra/tegra30_i2s.c b/sound/soc/tegra/tegra30_i2s.c index 6740df541508..3d22c1be6f3d 100644 --- a/sound/soc/tegra/tegra30_i2s.c +++ b/sound/soc/tegra/tegra30_i2s.c @@ -58,8 +58,18 @@ static int tegra30_i2s_runtime_resume(struct device *dev) } regcache_cache_only(i2s->regmap, false); + regcache_mark_dirty(i2s->regmap); + + ret = regcache_sync(i2s->regmap); + if (ret) + goto disable_clocks; return 0; + +disable_clocks: + clk_disable_unprepare(i2s->clk_i2s); + + return ret; } static int tegra30_i2s_set_fmt(struct snd_soc_dai *dai, @@ -551,37 +561,11 @@ static int tegra30_i2s_platform_remove(struct platform_device *pdev) return 0; } -#ifdef CONFIG_PM_SLEEP -static int tegra30_i2s_suspend(struct device *dev) -{ - struct tegra30_i2s *i2s = dev_get_drvdata(dev); - - regcache_mark_dirty(i2s->regmap); - - return 0; -} - -static int tegra30_i2s_resume(struct device *dev) -{ - struct tegra30_i2s *i2s = dev_get_drvdata(dev); - int ret; - - ret = pm_runtime_get_sync(dev); - if (ret < 0) { - pm_runtime_put(dev); - return ret; - } - ret = regcache_sync(i2s->regmap); - pm_runtime_put(dev); - - return ret; -} -#endif - static const struct dev_pm_ops tegra30_i2s_pm_ops = { SET_RUNTIME_PM_OPS(tegra30_i2s_runtime_suspend, tegra30_i2s_runtime_resume, NULL) - SET_SYSTEM_SLEEP_PM_OPS(tegra30_i2s_suspend, tegra30_i2s_resume) + SET_SYSTEM_SLEEP_PM_OPS(pm_runtime_force_suspend, + pm_runtime_force_resume) }; static struct platform_driver tegra30_i2s_driver = { -- 2.30.2