]> git.karo-electronics.de Git - karo-tx-linux.git/commitdiff
mfd: mc13xxx: Move SPI erratum workaround into SPI I/O function
authorMark Brown <broonie@linaro.org>
Mon, 23 Sep 2013 18:14:32 +0000 (19:14 +0100)
committerLee Jones <lee.jones@linaro.org>
Wed, 23 Oct 2013 15:21:24 +0000 (16:21 +0100)
Move the workaround for double sending AUDIO_CODEC and AUDIO_DAC writes
into the SPI core, aiding refactoring to eliminate the ASoC custom I/O
functions and avoiding the extra writes for I2C.

Signed-off-by: Mark Brown <broonie@linaro.org>
Signed-off-by: Lee Jones <lee.jones@linaro.org>
drivers/mfd/mc13xxx-spi.c
include/linux/mfd/mc13xxx.h
sound/soc/codecs/mc13783.c

index 77189daadf1e774c44714beed041d89d08870e4b..5f14ef6693c22abd073b62ea6114dab2b09d76b8 100644 (file)
@@ -94,10 +94,15 @@ static int mc13xxx_spi_write(void *context, const void *data, size_t count)
 {
        struct device *dev = context;
        struct spi_device *spi = to_spi_device(dev);
+       const char *reg = data;
 
        if (count != 4)
                return -ENOTSUPP;
 
+       /* include errata fix for spi audio problems */
+       if (*reg == MC13783_AUDIO_CODEC || *reg == MC13783_AUDIO_DAC)
+               spi_write(spi, data, count);
+
        return spi_write(spi, data, count);
 }
 
index 41ed59276c002fc77b598ed60fb5fc68501e72c6..67c17b5a6f449cc760a28a621daf5f5ef0529586 100644 (file)
@@ -41,6 +41,13 @@ int mc13xxx_adc_do_conversion(struct mc13xxx *mc13xxx,
                unsigned int mode, unsigned int channel,
                u8 ato, bool atox, unsigned int *sample);
 
+#define MC13783_AUDIO_RX0      36
+#define MC13783_AUDIO_RX1      37
+#define MC13783_AUDIO_TX       38
+#define MC13783_SSI_NETWORK    39
+#define MC13783_AUDIO_CODEC    40
+#define MC13783_AUDIO_DAC      41
+
 #define MC13XXX_IRQ_ADCDONE    0
 #define MC13XXX_IRQ_ADCBISDONE 1
 #define MC13XXX_IRQ_TS         2
index ea141e1d6f280733fdc832f7b5e2d054f2e8fff4..4d3c8fd8c5db5aeec4632e958d3737a0d59adc0f 100644 (file)
@@ -125,10 +125,6 @@ static int mc13783_write(struct snd_soc_codec *codec,
 
        ret = mc13xxx_reg_write(priv->mc13xxx, reg, value);
 
-       /* include errata fix for spi audio problems */
-       if (reg == MC13783_AUDIO_CODEC || reg == MC13783_AUDIO_DAC)
-               ret = mc13xxx_reg_write(priv->mc13xxx, reg, value);
-
        mc13xxx_unlock(priv->mc13xxx);
 
        return ret;