[alsa-devel] [PATCH] ASoC: Add max98095 CODEC driver
Dimitris Papastamos
dp at opensource.wolfsonmicro.com
Thu Mar 24 12:42:11 CET 2011
On Wed, Mar 23, 2011 at 08:57:41PM -0700, Peter Hsiang wrote:
> +static inline int rate_value(int rate, u8 *value)
> +{
> + int i;
> +
> + for (i = 0; i < ARRAY_SIZE(rate_table); i++) {
> + if (rate_table[i].rate >= rate) {
> + *value = rate_table[i].sr;
> + return 0;
> + }
> + }
> + *value = rate_table[0].sr;
> + return -EINVAL;
> +}
Not too clear as to why this is an inline function?
> +static int max98095_probe(struct snd_soc_codec *codec)
> +{
> + struct max98095_priv *max98095 = snd_soc_codec_get_drvdata(codec);
> + struct max98095_cdata *cdata;
> + int ret = 0;
> +
> + codec->cache_sync = 1;
> + memcpy(codec->reg_cache, max98095_reg, sizeof(max98095_reg));
Keeping your own copy of the cache is rather deprecated. As Mark
mentioned, you can let the ASoC cache manage your register cache as well
as use snd_soc_cache_sync() for syncing.
Thanks,
Dimitris
More information about the Alsa-devel
mailing list