[alsa-devel] [PATCH 1/2] ASoC: Add support for Conexant CX2072X CODEC
Takashi Iwai
tiwai at suse.de
Thu May 2 09:52:40 CEST 2019
On Thu, 02 May 2019 09:04:06 +0200,
Takashi Iwai wrote:
>
> > > +int snd_soc_cx2072x_get_jack_state(struct snd_soc_component *codec)
> > > +{
> > > + struct cx2072x_priv *cx2072x = snd_soc_component_get_drvdata(codec);
> > > + unsigned int jack;
> > > + unsigned int type = 0;
> > > + int state = 0;
> > > + bool need_cache_bypass =
> > > + snd_soc_component_get_bias_level(codec) == SND_SOC_BIAS_OFF;
> > > +
> > > + if (need_cache_bypass)
> > > + regcache_cache_only(cx2072x->regmap, false);
> >
> > This looks funky and racy - what's going on here? If the register map
> > is live and usable why is it in cache only mode?
>
> Not to read the register while the chip is turned off, I suppose.
Actually other way round: the codec driver tries to avoid the whole
register access while the chip is in BIAS_OFF state. OTOH, the jack
state check is still required even in that state, so it flips the
cache-only flag temporarily at reading the jack detect bit.
I guess we may remove the cache-only behavior, although this is a
nice-to-have thing.
Takashi
More information about the Alsa-devel
mailing list