All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH] ASoC: Reintroduce do_spi_write()
@ 2011-05-11 17:25 Mark Brown
  2011-05-11 19:05 ` [PATCH] ASoC: snd_soc_hw_bulk_write_raw: Use the codec's hw_write callback Lars-Peter Clausen
  2011-05-12  8:42 ` [PATCH] ASoC: Reintroduce do_spi_write() Liam Girdwood
  0 siblings, 2 replies; 4+ messages in thread
From: Mark Brown @ 2011-05-11 17:25 UTC (permalink / raw)
  To: Lars-Peter Clausen, Liam Girdwood; +Cc: alsa-devel, patches, Mark Brown

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>
---
 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 04861c4..dee86fc 100644
--- a/sound/soc/soc-cache.c
+++ b/sound/soc/soc-cache.c
@@ -20,6 +20,20 @@
 
 #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,
 		       unsigned int value, const void *data, int len)
 {
@@ -409,7 +423,7 @@ int snd_soc_codec_set_cache_io(struct snd_soc_codec *codec,
 
 	case SND_SOC_SPI:
 #ifdef CONFIG_SPI_MASTER
-		codec->hw_write = (hw_write_t)spi_write;
+		codec->hw_write = do_spi_write;
 #endif
 
 		codec->control_data = container_of(codec->dev,
-- 
1.7.5.1

^ permalink raw reply related	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2011-05-12  8:42 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2011-05-11 17:25 [PATCH] ASoC: Reintroduce do_spi_write() Mark Brown
2011-05-11 19:05 ` [PATCH] ASoC: snd_soc_hw_bulk_write_raw: Use the codec's hw_write callback Lars-Peter Clausen
2011-05-11 20:00   ` Mark Brown
2011-05-12  8:42 ` [PATCH] ASoC: Reintroduce do_spi_write() Liam Girdwood

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.