Skip to content

Commit fd792f8

Browse files
broonieLee Jones
authored andcommitted
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>
1 parent c29c2d4 commit fd792f8

3 files changed

Lines changed: 12 additions & 4 deletions

File tree

‎drivers/mfd/mc13xxx-spi.c‎

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -94,10 +94,15 @@ static int mc13xxx_spi_write(void *context, const void *data, size_t count)
9494
{
9595
struct device *dev = context;
9696
struct spi_device *spi = to_spi_device(dev);
97+
const char *reg = data;
9798

9899
if (count != 4)
99100
return -ENOTSUPP;
100101

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+
101106
return spi_write(spi, data, count);
102107
}
103108

‎include/linux/mfd/mc13xxx.h‎

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -41,6 +41,13 @@ int mc13xxx_adc_do_conversion(struct mc13xxx *mc13xxx,
4141
unsigned int mode, unsigned int channel,
4242
u8 ato, bool atox, unsigned int *sample);
4343

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+
4451
#define MC13XXX_IRQ_ADCDONE 0
4552
#define MC13XXX_IRQ_ADCBISDONE 1
4653
#define MC13XXX_IRQ_TS 2

‎sound/soc/codecs/mc13783.c‎

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -125,10 +125,6 @@ static int mc13783_write(struct snd_soc_codec *codec,
125125

126126
ret = mc13xxx_reg_write(priv->mc13xxx, reg, value);
127127

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-
132128
mc13xxx_unlock(priv->mc13xxx);
133129

134130
return ret;

0 commit comments

Comments
 (0)