[alsa-devel] [PATCH 7/8] ASoC: Add SPI support for WM8731

Alan Horstmann gineera at aspect135.co.uk
Wed Sep 3 18:01:46 CEST 2008


On Monday 01 September 2008 18:47, Mark Brown wrote:
> From: Cliff Cai <cliff.cai at analog.com>
>
> [Modified to allow runtime selection between I2C and SPI and to select
> SPI_MASTER for all codecs build so this is included. -- broonie]
>
> Signed-off-by: Cliff Cai <cliff.cai at analog.com>
> Signed-off-by: Bryan Wu <cooloney at kernel.org>
> Signed-off-by: Mark Brown <broonie at opensource.wolfsonmicro.com>
> ---

What architecture has this SPI code been tested on?  Specifically, what 
endianess?

> --- a/sound/soc/codecs/wm8731.c
> +++ b/sound/soc/codecs/wm8731.c

 
> +static int wm8731_spi_write(struct spi_device *spi, const char *data, int
> len) +{
> +	struct spi_transfer t;
> +	struct spi_message m;
> +	u16 msg[2];
> +
> +	if (len <= 0)
> +		return 0;
> +
> +	msg[0] = (data[0] << 8) + data[1];
> +
> +	spi_message_init(&m);
> +	memset(&t, 0, (sizeof t));
> +
> +	t.tx_buf = &msg[0];
> +	t.len = len;
> +
> +	spi_message_add_tail(&t, &m);
> +	spi_sync(spi, &m);
> +
> +	return len;
> +}

Is this _spi_write arch BE/LE proof?

Alan



More information about the Alsa-devel mailing list