[alsa-devel] snd soc spi read/write
scott.jiang.linux at gmail.com
Fri Aug 5 04:24:43 CEST 2011
2011/8/4 Mark Brown <broonie at opensource.wolfsonmicro.com>:
> On Thu, Aug 04, 2011 at 06:24:04PM +0800, Scott Jiang wrote:
>> My version is linux 3.0, I found snd_soc_spi_read/write didn't work at
>> 16-8 bit mode.
>> The addr is 16bit, the function compares reg with reg_cache_size. This
>> certainly causes failure.
>> In the former version, reg &= 0xff seems right. So how to use
>> snd_soc_16_8_write now?
> reg &= 0xff is clearly broken for 16 bit register values...
hw_write use 16bit reg, cache use 8bit reg, in former version
data = (reg >> 8) & 0xff;
data = reg & 0xff;
data = value;
reg &= 0xff;
if (reg < codec->reg_cache_size)
cache[reg] = value;
ret = codec->hw_write(codec->control_data, data, 3);
now in do_hw_write
if (!snd_soc_codec_volatile_register(codec, reg) &&
reg < codec->driver->reg_cache_size &&
ret = snd_soc_cache_write(codec, reg, value);
if (ret < 0)
reg > reg_cache_size, so will not write to cache
> Note that all this code will be replaced with regmap for 3.2.
Do you mean I must update to 3.2 to solve this problem?
More information about the Alsa-devel