diff options
author | Mark Brown <broonie@linaro.org> | 2013-09-23 14:14:32 -0400 |
---|---|---|
committer | Lee Jones <lee.jones@linaro.org> | 2013-10-23 11:21:24 -0400 |
commit | 0248b4bfe56f0545c051e6230939ca8b95f1b037 (patch) | |
tree | 7ffc3f6930b8ccf21a61b27bed03d48134bb88b9 | |
parent | b264a70eef880aff31652a10ffee9c03e949b69b (diff) |
mfd: mc13xxx: Move SPI erratum workaround into SPI I/O function
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>
-rw-r--r-- | drivers/mfd/mc13xxx-spi.c | 5 | ||||
-rw-r--r-- | include/linux/mfd/mc13xxx.h | 7 | ||||
-rw-r--r-- | sound/soc/codecs/mc13783.c | 4 |
3 files changed, 12 insertions, 4 deletions
diff --git a/drivers/mfd/mc13xxx-spi.c b/drivers/mfd/mc13xxx-spi.c index 77189daadf1e..5f14ef6693c2 100644 --- a/drivers/mfd/mc13xxx-spi.c +++ b/drivers/mfd/mc13xxx-spi.c | |||
@@ -94,10 +94,15 @@ static int mc13xxx_spi_write(void *context, const void *data, size_t count) | |||
94 | { | 94 | { |
95 | struct device *dev = context; | 95 | struct device *dev = context; |
96 | struct spi_device *spi = to_spi_device(dev); | 96 | struct spi_device *spi = to_spi_device(dev); |
97 | const char *reg = data; | ||
97 | 98 | ||
98 | if (count != 4) | 99 | if (count != 4) |
99 | return -ENOTSUPP; | 100 | return -ENOTSUPP; |
100 | 101 | ||
102 | /* include errata fix for spi audio problems */ | ||
103 | if (*reg == MC13783_AUDIO_CODEC || *reg == MC13783_AUDIO_DAC) | ||
104 | spi_write(spi, data, count); | ||
105 | |||
101 | return spi_write(spi, data, count); | 106 | return spi_write(spi, data, count); |
102 | } | 107 | } |
103 | 108 | ||
diff --git a/include/linux/mfd/mc13xxx.h b/include/linux/mfd/mc13xxx.h index 41ed59276c00..67c17b5a6f44 100644 --- a/include/linux/mfd/mc13xxx.h +++ b/include/linux/mfd/mc13xxx.h | |||
@@ -41,6 +41,13 @@ int mc13xxx_adc_do_conversion(struct mc13xxx *mc13xxx, | |||
41 | unsigned int mode, unsigned int channel, | 41 | unsigned int mode, unsigned int channel, |
42 | u8 ato, bool atox, unsigned int *sample); | 42 | u8 ato, bool atox, unsigned int *sample); |
43 | 43 | ||
44 | #define MC13783_AUDIO_RX0 36 | ||
45 | #define MC13783_AUDIO_RX1 37 | ||
46 | #define MC13783_AUDIO_TX 38 | ||
47 | #define MC13783_SSI_NETWORK 39 | ||
48 | #define MC13783_AUDIO_CODEC 40 | ||
49 | #define MC13783_AUDIO_DAC 41 | ||
50 | |||
44 | #define MC13XXX_IRQ_ADCDONE 0 | 51 | #define MC13XXX_IRQ_ADCDONE 0 |
45 | #define MC13XXX_IRQ_ADCBISDONE 1 | 52 | #define MC13XXX_IRQ_ADCBISDONE 1 |
46 | #define MC13XXX_IRQ_TS 2 | 53 | #define MC13XXX_IRQ_TS 2 |
diff --git a/sound/soc/codecs/mc13783.c b/sound/soc/codecs/mc13783.c index ea141e1d6f28..4d3c8fd8c5db 100644 --- a/sound/soc/codecs/mc13783.c +++ b/sound/soc/codecs/mc13783.c | |||
@@ -125,10 +125,6 @@ static int mc13783_write(struct snd_soc_codec *codec, | |||
125 | 125 | ||
126 | ret = mc13xxx_reg_write(priv->mc13xxx, reg, value); | 126 | ret = mc13xxx_reg_write(priv->mc13xxx, reg, value); |
127 | 127 | ||
128 | /* include errata fix for spi audio problems */ | ||
129 | if (reg == MC13783_AUDIO_CODEC || reg == MC13783_AUDIO_DAC) | ||
130 | ret = mc13xxx_reg_write(priv->mc13xxx, reg, value); | ||
131 | |||
132 | mc13xxx_unlock(priv->mc13xxx); | 128 | mc13xxx_unlock(priv->mc13xxx); |
133 | 129 | ||
134 | return ret; | 130 | return ret; |