Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit c1b88ee2 authored by Mark Brown's avatar Mark Brown
Browse files

ASoC: wm8904: Fix cache only management



We should be using the regmap API consistently for all the cache only
configuration and we should be going cache only before we power down
the supplies.

Signed-off-by: default avatarMark Brown <broonie@opensource.wolfsonmicro.com>
parent 433897f7
Loading
Loading
Loading
Loading
+4 −9
Original line number Original line Diff line number Diff line
@@ -1863,6 +1863,7 @@ static int wm8904_set_bias_level(struct snd_soc_codec *codec,
				return ret;
				return ret;
			}
			}


			regcache_cache_only(wm8904->regmap, false);
			regcache_sync(wm8904->regmap);
			regcache_sync(wm8904->regmap);


			/* Enable bias */
			/* Enable bias */
@@ -1899,14 +1900,8 @@ static int wm8904_set_bias_level(struct snd_soc_codec *codec,
		snd_soc_update_bits(codec, WM8904_BIAS_CONTROL_0,
		snd_soc_update_bits(codec, WM8904_BIAS_CONTROL_0,
				    WM8904_BIAS_ENA, 0);
				    WM8904_BIAS_ENA, 0);


#ifdef CONFIG_REGULATOR
		regcache_cache_only(wm8904->regmap, true);
		/* Post 2.6.34 we will be able to get a callback when
		regcache_mark_dirty(wm8904->regmap);
		 * the regulators are disabled which we can use but
		 * for now just assume that the power will be cut if
		 * the regulator API is in use.
		 */
		codec->cache_sync = 1;
#endif


		regulator_bulk_disable(ARRAY_SIZE(wm8904->supplies),
		regulator_bulk_disable(ARRAY_SIZE(wm8904->supplies),
				       wm8904->supplies);
				       wm8904->supplies);
@@ -2086,7 +2081,6 @@ static int wm8904_probe(struct snd_soc_codec *codec)
	struct wm8904_pdata *pdata = wm8904->pdata;
	struct wm8904_pdata *pdata = wm8904->pdata;
	int ret, i;
	int ret, i;


	codec->cache_sync = 1;
	codec->control_data = wm8904->regmap;
	codec->control_data = wm8904->regmap;


	switch (wm8904->devtype) {
	switch (wm8904->devtype) {
@@ -2149,6 +2143,7 @@ static int wm8904_probe(struct snd_soc_codec *codec)
		goto err_enable;
		goto err_enable;
	}
	}


	regcache_cache_only(wm8904->regmap, true);
	/* Change some default settings - latch VU and enable ZC */
	/* Change some default settings - latch VU and enable ZC */
	snd_soc_update_bits(codec, WM8904_ADC_DIGITAL_VOLUME_LEFT,
	snd_soc_update_bits(codec, WM8904_ADC_DIGITAL_VOLUME_LEFT,
			    WM8904_ADC_VU, WM8904_ADC_VU);
			    WM8904_ADC_VU, WM8904_ADC_VU);