aboutsummaryrefslogtreecommitdiffstats
path: root/sound/soc/codecs/max98088.c
diff options
context:
space:
mode:
authorLars-Peter Clausen <lars@metafoo.de>2010-12-28 15:37:56 -0500
committerMark Brown <broonie@opensource.wolfsonmicro.com>2010-12-28 18:19:06 -0500
commitd24eb0db9c8a7ceecae860bdc636ed1e8a86943a (patch)
tree7253a7020a2f4f5438d987ee68d48c8a53686eb7 /sound/soc/codecs/max98088.c
parent7f984b55acb6530bf854bfcac13104228f3336c1 (diff)
ASoC: codecs: max98088: Fix register cache incoherency
The multi-component patch(commit f0fba2ad1) moved the allocation of the register cache from the driver to the ASoC core. Most drivers where adjusted to this, but the max98088 driver still uses its own register cache for its private functions, while functions from the ASoC core use the generic cache. Thus we end up with two from each other incoherent caches, which can lead to undefined behaviour. This patch fixes the issue by changing the max98088 driver to use the generic register cache in its private functions. Signed-off-by: Lars-Peter Clausen <lars@metafoo.de> Cc: Peter Hsiang <Peter.Hsiang@maxim-ic.com> Signed-off-by: Mark Brown <broonie@opensource.wolfsonmicro.com> Cc: stable@kernel.org (for 2.6.37 only)
Diffstat (limited to 'sound/soc/codecs/max98088.c')
-rw-r--r--sound/soc/codecs/max98088.c10
1 files changed, 4 insertions, 6 deletions
diff --git a/sound/soc/codecs/max98088.c b/sound/soc/codecs/max98088.c
index d63e28773eb1..6447dbb2f123 100644
--- a/sound/soc/codecs/max98088.c
+++ b/sound/soc/codecs/max98088.c
@@ -40,7 +40,6 @@ struct max98088_cdata {
40}; 40};
41 41
42struct max98088_priv { 42struct max98088_priv {
43 u8 reg_cache[M98088_REG_CNT];
44 enum max98088_type devtype; 43 enum max98088_type devtype;
45 void *control_data; 44 void *control_data;
46 struct max98088_pdata *pdata; 45 struct max98088_pdata *pdata;
@@ -1588,7 +1587,7 @@ static int max98088_dai2_set_fmt(struct snd_soc_dai *codec_dai,
1588 1587
1589static void max98088_sync_cache(struct snd_soc_codec *codec) 1588static void max98088_sync_cache(struct snd_soc_codec *codec)
1590{ 1589{
1591 struct max98088_priv *max98088 = snd_soc_codec_get_drvdata(codec); 1590 u16 *reg_cache = codec->reg_cache;
1592 int i; 1591 int i;
1593 1592
1594 if (!codec->cache_sync) 1593 if (!codec->cache_sync)
@@ -1599,14 +1598,14 @@ static void max98088_sync_cache(struct snd_soc_codec *codec)
1599 /* write back cached values if they're writeable and 1598 /* write back cached values if they're writeable and
1600 * different from the hardware default. 1599 * different from the hardware default.
1601 */ 1600 */
1602 for (i = 1; i < ARRAY_SIZE(max98088->reg_cache); i++) { 1601 for (i = 1; i < codec->driver->reg_cache_size; i++) {
1603 if (!max98088_access[i].writable) 1602 if (!max98088_access[i].writable)
1604 continue; 1603 continue;
1605 1604
1606 if (max98088->reg_cache[i] == max98088_reg[i]) 1605 if (reg_cache[i] == max98088_reg[i])
1607 continue; 1606 continue;
1608 1607
1609 snd_soc_write(codec, i, max98088->reg_cache[i]); 1608 snd_soc_write(codec, i, reg_cache[i]);
1610 } 1609 }
1611 1610
1612 codec->cache_sync = 0; 1611 codec->cache_sync = 0;
@@ -1951,7 +1950,6 @@ static int max98088_probe(struct snd_soc_codec *codec)
1951 int ret = 0; 1950 int ret = 0;
1952 1951
1953 codec->cache_sync = 1; 1952 codec->cache_sync = 1;
1954 memcpy(codec->reg_cache, max98088_reg, sizeof(max98088_reg));
1955 1953
1956 ret = snd_soc_codec_set_cache_io(codec, 8, 8, SND_SOC_I2C); 1954 ret = snd_soc_codec_set_cache_io(codec, 8, 8, SND_SOC_I2C);
1957 if (ret != 0) { 1955 if (ret != 0) {