提交 f7391fce 编写于 作者: M Mark Brown

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: NLars-Peter Clausen <lars@metafoo.de>
Signed-off-by: NMark Brown <broonie@opensource.wolfsonmicro.com>
Acked-by: NLiam Girdwood <lrg@ti.com>
上级 d5e4b0ad
...@@ -20,6 +20,20 @@ ...@@ -20,6 +20,20 @@
#include <trace/events/asoc.h> #include <trace/events/asoc.h>
#ifdef CONFIG_SPI_MASTER
static int do_spi_write(void *control, const char *data, int len)
{
struct spi_device *spi = control;
int ret;
ret = spi_write(spi, data, len);
if (ret < 0)
return ret;
return len;
}
#endif
static int do_hw_write(struct snd_soc_codec *codec, unsigned int reg, static int do_hw_write(struct snd_soc_codec *codec, unsigned int reg,
unsigned int value, const void *data, int len) unsigned int value, const void *data, int len)
{ {
...@@ -412,7 +426,7 @@ int snd_soc_codec_set_cache_io(struct snd_soc_codec *codec, ...@@ -412,7 +426,7 @@ int snd_soc_codec_set_cache_io(struct snd_soc_codec *codec,
case SND_SOC_SPI: case SND_SOC_SPI:
#ifdef CONFIG_SPI_MASTER #ifdef CONFIG_SPI_MASTER
codec->hw_write = (hw_write_t)spi_write; codec->hw_write = do_spi_write;
#endif #endif
codec->control_data = container_of(codec->dev, codec->control_data = container_of(codec->dev,
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册