[alsa-devel] [PATCH 2/4] ASoC: soc-cache: Add support for flat register caching

Dimitris Papastamos dp at opensource.wolfsonmicro.com
Fri Nov 5 10:34:37 CET 2010


On Thu, 2010-11-04 at 14:31 -0400, Mark Brown wrote:

> > @@ -680,6 +722,8 @@ int snd_soc_codec_set_cache_io(struct snd_soc_codec *codec,
> >  		return -EINVAL;
> >  	}
> >  
> > +	mutex_init(&cache_rw_mutex);
> > +
> 
> I'd kind of expect this to be with the other cache setup?

Do you mean that the mutex should also be used with the other caching
techniques?  That is not needed because we currently lock at a higher
level, in the function that delegates the calls to the implementation
functions.

> > @@ -3261,6 +3244,16 @@ int snd_soc_register_codec(struct device *dev,
> >  	INIT_LIST_HEAD(&codec->dapm_widgets);
> >  	INIT_LIST_HEAD(&codec->dapm_paths);
> >  
> > +	/* allocate CODEC register cache */
> > +	if (codec_drv->reg_cache_size && codec_drv->reg_word_size) {
> > +		ret = snd_soc_cache_init(codec);
> > +		if (ret < 0) {
> > +			dev_err(codec->dev, "Failed to set cache compression type: %d\n",
> > +				ret);
> > +			goto error_cache;
> > +		}
> > +	}
> 
> Are you sure that all the CODECs that rely on the existing shared
> register cache are going to call this?

What do you mean by 'shared register cache'?  Each codec gets its own
copy of their register cache.

Any CODEC driver that calls snd_soc_register_codec() and has provided
reg_cache_size and reg_word_size will have soc-core setting up its cache
accordingly.  By default the provided snd_soc_codec_driver is zero-ed
out, so its compress_type will default to the flat compression type.

Thanks,
Dimitrios



More information about the Alsa-devel mailing list