diff options
author | Mark Brown <broonie@opensource.wolfsonmicro.com> | 2011-12-03 07:33:55 -0500 |
---|---|---|
committer | Mark Brown <broonie@opensource.wolfsonmicro.com> | 2012-01-21 16:15:38 -0500 |
commit | 8a713da8d1ce9ceaf738b32e2b24f22d4432f886 (patch) | |
tree | c0fb13d21f18ed19c82e4d9214d440e34b0c474b /sound/soc/soc-core.c | |
parent | 278047fd654dde7ed95c8604fcefeeacc5c0bb2b (diff) |
ASoC: Use regmap update bits operation for drivers using regmap
If a driver is using regmap directly ensure that we're coherent with
non-ASoC register updates by using the regmap API directly to do our
read/modify/write cycles. This will bypass the ASoC cache but drivers
using regmap directly should not be using the ASoC cache.
Signed-off-by: Mark Brown <broonie@opensource.wolfsonmicro.com>
Diffstat (limited to 'sound/soc/soc-core.c')
-rw-r--r-- | sound/soc/soc-core.c | 25 |
1 files changed, 15 insertions, 10 deletions
diff --git a/sound/soc/soc-core.c b/sound/soc/soc-core.c index 41c8e45a23e2..35a1e639d7f9 100644 --- a/sound/soc/soc-core.c +++ b/sound/soc/soc-core.c | |||
@@ -1869,23 +1869,28 @@ EXPORT_SYMBOL_GPL(snd_soc_bulk_write_raw); | |||
1869 | int snd_soc_update_bits(struct snd_soc_codec *codec, unsigned short reg, | 1869 | int snd_soc_update_bits(struct snd_soc_codec *codec, unsigned short reg, |
1870 | unsigned int mask, unsigned int value) | 1870 | unsigned int mask, unsigned int value) |
1871 | { | 1871 | { |
1872 | int change; | 1872 | bool change; |
1873 | unsigned int old, new; | 1873 | unsigned int old, new; |
1874 | int ret; | 1874 | int ret; |
1875 | 1875 | ||
1876 | ret = snd_soc_read(codec, reg); | 1876 | if (codec->using_regmap) { |
1877 | if (ret < 0) | 1877 | ret = regmap_update_bits_check(codec->control_data, reg, |
1878 | return ret; | 1878 | mask, value, &change); |
1879 | 1879 | } else { | |
1880 | old = ret; | 1880 | ret = snd_soc_read(codec, reg); |
1881 | new = (old & ~mask) | (value & mask); | ||
1882 | change = old != new; | ||
1883 | if (change) { | ||
1884 | ret = snd_soc_write(codec, reg, new); | ||
1885 | if (ret < 0) | 1881 | if (ret < 0) |
1886 | return ret; | 1882 | return ret; |
1883 | |||
1884 | old = ret; | ||
1885 | new = (old & ~mask) | (value & mask); | ||
1886 | change = old != new; | ||
1887 | if (change) | ||
1888 | ret = snd_soc_write(codec, reg, new); | ||
1887 | } | 1889 | } |
1888 | 1890 | ||
1891 | if (ret < 0) | ||
1892 | return ret; | ||
1893 | |||
1889 | return change; | 1894 | return change; |
1890 | } | 1895 | } |
1891 | EXPORT_SYMBOL_GPL(snd_soc_update_bits); | 1896 | EXPORT_SYMBOL_GPL(snd_soc_update_bits); |