[alsa-devel] [PATCH] ASoC: core - Add platform read and write.

Liam Girdwood lrg at ti.com
Mon Jul 4 23:14:05 CEST 2011


On 04/07/11 20:41, Mark Brown wrote:
> On Mon, Jul 04, 2011 at 11:10:15AM +0100, Liam Girdwood wrote:
> 
>> +int snd_soc_platform_read(struct snd_soc_platform *platform,
>> +					unsigned int reg)
>> +{
>> +	unsigned int ret;
>> +
>> +	if (!platform->driver->read) {
>> +		dev_err(platform->dev, "platform has no read back\n");
>> +		return -1;
>> +	}
>> +
>> +	ret = platform->driver->read(platform, reg);
>> +	dev_dbg(platform->dev, "read %x => %x\n", reg, ret);
> 
> We should add tracepoints into these as well.

Ah, forgot to send that one with this one. It's on it's way now ;)

> 
>> +int snd_soc_platform_write(struct snd_soc_platform *platform,
>> +					 unsigned int reg, unsigned int val)
>> +{
>> +	if (!platform->driver->write) {
>> +		dev_err(platform->dev, "platform has no write back\n");
>> +		return -1;
> 
> Could return -EINVAL or something here - it's not like read where we're
> mixing with the in band data.

I was thinking that too, but consistency with the codec IO would mean return -1. 

However, I've no real preference. I happy to change to EINVAL.

Liam


More information about the Alsa-devel mailing list