diff options
author | Mark Brown <broonie@opensource.wolfsonmicro.com> | 2011-05-11 13:25:42 -0400 |
---|---|---|
committer | Mark Brown <broonie@opensource.wolfsonmicro.com> | 2011-05-15 11:50:59 -0400 |
commit | f7391fce6a1553ed3375ee4d73f2deaa3fd69732 (patch) | |
tree | a92dca2322e6c07ced600cec1da27bc2f3fef0f2 /sound/soc/soc-cache.c | |
parent | d5e4b0adf6e694f9a8fb31f51fc381bd8be17eae (diff) |
ASoC: Reintroduce do_spi_write()
There is an unfortunate difference in return values between spi_write()
and i2c_master_send() so we need an adaptor function to translate.
Reported-by: Lars-Peter Clausen <lars@metafoo.de>
Signed-off-by: Mark Brown <broonie@opensource.wolfsonmicro.com>
Acked-by: Liam Girdwood <lrg@ti.com>
Diffstat (limited to 'sound/soc/soc-cache.c')
-rw-r--r-- | sound/soc/soc-cache.c | 16 |
1 files changed, 15 insertions, 1 deletions
diff --git a/sound/soc/soc-cache.c b/sound/soc/soc-cache.c index 01e5b9846436..06b7b81a1601 100644 --- a/sound/soc/soc-cache.c +++ b/sound/soc/soc-cache.c | |||
@@ -20,6 +20,20 @@ | |||
20 | 20 | ||
21 | #include <trace/events/asoc.h> | 21 | #include <trace/events/asoc.h> |
22 | 22 | ||
23 | #ifdef CONFIG_SPI_MASTER | ||
24 | static int do_spi_write(void *control, const char *data, int len) | ||
25 | { | ||
26 | struct spi_device *spi = control; | ||
27 | int ret; | ||
28 | |||
29 | ret = spi_write(spi, data, len); | ||
30 | if (ret < 0) | ||
31 | return ret; | ||
32 | |||
33 | return len; | ||
34 | } | ||
35 | #endif | ||
36 | |||
23 | static int do_hw_write(struct snd_soc_codec *codec, unsigned int reg, | 37 | static int do_hw_write(struct snd_soc_codec *codec, unsigned int reg, |
24 | unsigned int value, const void *data, int len) | 38 | unsigned int value, const void *data, int len) |
25 | { | 39 | { |
@@ -412,7 +426,7 @@ int snd_soc_codec_set_cache_io(struct snd_soc_codec *codec, | |||
412 | 426 | ||
413 | case SND_SOC_SPI: | 427 | case SND_SOC_SPI: |
414 | #ifdef CONFIG_SPI_MASTER | 428 | #ifdef CONFIG_SPI_MASTER |
415 | codec->hw_write = (hw_write_t)spi_write; | 429 | codec->hw_write = do_spi_write; |
416 | #endif | 430 | #endif |
417 | 431 | ||
418 | codec->control_data = container_of(codec->dev, | 432 | codec->control_data = container_of(codec->dev, |