lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <20200923132600.10652-3-dmurphy@ti.com>
Date:   Wed, 23 Sep 2020 08:25:57 -0500
From:   Dan Murphy <dmurphy@...com>
To:     <lgirdwood@...il.com>, <broonie@...nel.org>, <tiwai@...e.com>,
        <robh+dt@...nel.org>
CC:     <devicetree@...r.kernel.org>, <alsa-devel@...a-project.org>,
        <linux-kernel@...r.kernel.org>, Dan Murphy <dmurphy@...com>
Subject: [PATCH 3/6] ASoC: tas2770: Set regcache when shutting down and waking device

Set the regcache to cache data and mark cache as dirty when the device
is shutdown when suspend is called. When the device is woken up then
sync the cache and set to not caching the data.

Signed-off-by: Dan Murphy <dmurphy@...com>
---
 sound/soc/codecs/tas2770.c | 14 ++++++++++----
 1 file changed, 10 insertions(+), 4 deletions(-)

diff --git a/sound/soc/codecs/tas2770.c b/sound/soc/codecs/tas2770.c
index 9f7363927c50..c42e653cd653 100644
--- a/sound/soc/codecs/tas2770.c
+++ b/sound/soc/codecs/tas2770.c
@@ -82,14 +82,20 @@ static int tas2770_codec_suspend(struct snd_soc_component *component)
 	struct tas2770_priv *tas2770 = snd_soc_component_get_drvdata(component);
 	int ret = 0;
 
+	regcache_cache_only(tas2770->regmap, true);
+	regcache_mark_dirty(tas2770->regmap);
+
 	if (tas2770->sdz_gpio) {
 		gpiod_set_value_cansleep(tas2770->sdz_gpio, 0);
 	} else {
 		ret = snd_soc_component_update_bits(component, TAS2770_PWR_CTRL,
 						    TAS2770_PWR_CTRL_MASK,
 						    TAS2770_PWR_CTRL_SHUTDOWN);
-		if (ret < 0)
+		if (ret < 0) {
+			regcache_cache_only(tas2770->regmap, false);
+			regcache_sync(tas2770->regmap);
 			return ret;
+		}
 
 		ret = 0;
 	}
@@ -110,11 +116,11 @@ static int tas2770_codec_resume(struct snd_soc_component *component)
 						    TAS2770_PWR_CTRL_ACTIVE);
 		if (ret < 0)
 			return ret;
-
-		ret = 0;
 	}
 
-	return ret;
+	regcache_cache_only(tas2770->regmap, false);
+
+	return regcache_sync(tas2770->regmap);
 }
 #else
 #define tas2770_codec_suspend NULL
-- 
2.28.0

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ