Received: by 2002:a25:1985:0:0:0:0:0 with SMTP id 127csp83515ybz; Tue, 21 Apr 2020 05:12:44 -0700 (PDT) X-Google-Smtp-Source: APiQypKW/CI8Ar8TSnrlQBGZRHuCWooOip+LoHIt1eOPH2/dODA2usDJSLAhuCSyCPzvICaJojls X-Received: by 2002:a50:de44:: with SMTP id a4mr19006138edl.56.1587471164090; Tue, 21 Apr 2020 05:12:44 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1587471164; cv=none; d=google.com; s=arc-20160816; b=ZnLzMzS0xGdZGEXCa9MkJMFASSH6FdPaKc3JOeW/LKWMh4c6kMJAH2wKjK7noQ56WO OdB8HFuReVmYa3Lu9nP/2dZU0wkIGBbq7xmOgXGLsfFAJhUaUM8RpAf1JiZVfOebZrD9 YFvzI88klitV5twgi+X2DytIXeVUhs2gYwH9OJnlJmYjWtIeGuiyexPT9SB1pcGuwNh8 g8tM96Ej+7jtIzyaqSOHCybHyXEo+9XosRAlZTI4J8JcufSZCtIC9DfuifYbp1UhXGGH D69rSnf7pJVoAREmHb2WifgYiwb4EP/58AGzjTTshm4GF42NkGHWXnJIOmhcQ+xzVsy3 VBvw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:message-id:date:subject:to:from; bh=/YIE+PyFcb72vMK4E48sEV69ejOYLT6cOeoP73JcGfc=; b=zIOcqo8+aKNcY/UgXf+hJeHqmyoDIt2iT272q3PWV3/cKCAYsyZl8YsxyydHIE0HyZ d/tD412D4Lpoht6mrn1HH8+DP+mV5y1lWtpbM+kFlSYxNon3Ir2CkEDa6ntYC0wsHs9L BiQ/A3+9cRxi3c9HYkIqGc4cOIEwdYUKFmpBfEYCig9lP5nHl0aibQP8UczZ5Cmkhl4o qSTzXIEJjM6O/6/JUnJFaJA/oZhsg4JmWLFEsmQE/2yZDEmOqYbzk31cZe74U/kOsdus opLkNbBOSLriSQjYDKBJYLmRSuHkx4cv5+22qAy9f5KlY02n91rpOQ9Lko8Y8aqiZQgE cWng== ARC-Authentication-Results: i=1; mx.google.com; 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=fail (p=NONE sp=NONE dis=NONE) header.from=nxp.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id cf5si1463772ejb.171.2020.04.21.05.12.20; Tue, 21 Apr 2020 05:12:44 -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; 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=fail (p=NONE sp=NONE dis=NONE) header.from=nxp.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1728754AbgDUMKp (ORCPT + 99 others); Tue, 21 Apr 2020 08:10:45 -0400 Received: from inva021.nxp.com ([92.121.34.21]:55996 "EHLO inva021.nxp.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1728702AbgDUMKo (ORCPT ); Tue, 21 Apr 2020 08:10:44 -0400 Received: from inva021.nxp.com (localhost [127.0.0.1]) by inva021.eu-rdc02.nxp.com (Postfix) with ESMTP id 246E4200C8F; Tue, 21 Apr 2020 14:10:43 +0200 (CEST) Received: from invc005.ap-rdc01.nxp.com (invc005.ap-rdc01.nxp.com [165.114.16.14]) by inva021.eu-rdc02.nxp.com (Postfix) with ESMTP id 8FD72200C7B; Tue, 21 Apr 2020 14:10:38 +0200 (CEST) Received: from localhost.localdomain (shlinux2.ap.freescale.net [10.192.224.44]) by invc005.ap-rdc01.nxp.com (Postfix) with ESMTP id C567A4029E; Tue, 21 Apr 2020 20:10:32 +0800 (SGT) From: Shengjiu Wang To: lgirdwood@gmail.com, broonie@kernel.org, perex@perex.cz, tiwai@suse.com, shengjiu.wang@nxp.com, tglx@linutronix.de, allison@lohutok.net, info@metux.net, patches@opensource.cirrus.com, alsa-devel@alsa-project.org, linux-kernel@vger.kernel.org Subject: [PATCH] ASoC: wm8962: restore the CLOCKING2 register in resume Date: Tue, 21 Apr 2020 20:02:15 +0800 Message-Id: <1587470535-20469-1-git-send-email-shengjiu.wang@nxp.com> X-Mailer: git-send-email 2.7.4 X-Virus-Scanned: ClamAV using ClamSMTP Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org The CLOCKING2 is a volatile register, but some bits should be restored when resume, for example SYSCLK_SRC. otherwise the output clock is wrong Signed-off-by: Shengjiu Wang --- sound/soc/codecs/wm8962.c | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/sound/soc/codecs/wm8962.c b/sound/soc/codecs/wm8962.c index d9d59f45833f..6e96c0c5ad2a 100644 --- a/sound/soc/codecs/wm8962.c +++ b/sound/soc/codecs/wm8962.c @@ -82,6 +82,7 @@ struct wm8962_priv { #endif int irq; + u32 regcache_clocking2; }; /* We can't use the same notifier block for more than one supply and @@ -3813,6 +3814,10 @@ static int wm8962_runtime_resume(struct device *dev) regcache_sync(wm8962->regmap); + regmap_update_bits(wm8962->regmap, WM8962_CLOCKING2, + WM8962_SYSCLK_SRC_MASK, + wm8962->regcache_clocking2); + regmap_update_bits(wm8962->regmap, WM8962_ANTI_POP, WM8962_STARTUP_BIAS_ENA | WM8962_VMID_BUF_ENA, WM8962_STARTUP_BIAS_ENA | WM8962_VMID_BUF_ENA); @@ -3842,6 +3847,9 @@ static int wm8962_runtime_suspend(struct device *dev) WM8962_STARTUP_BIAS_ENA | WM8962_VMID_BUF_ENA, 0); + regmap_read(wm8962->regmap, WM8962_CLOCKING2, + &wm8962->regcache_clocking2); + regcache_cache_only(wm8962->regmap, true); regulator_bulk_disable(ARRAY_SIZE(wm8962->supplies), -- 2.21.0