Re: [alsa-devel] [PATCH v5] ASoC: TSCS42xx: Add support for Tempo Semiconductor's TSCS42xx audio CODEC

From: Charles Keepax
Date: Thu Dec 14 2017 - 04:34:00 EST


On Tue, Dec 12, 2017 at 03:31:16PM -0600, Steven Eckhoff wrote:
> On Tue, Dec 12, 2017 at 04:32:54PM +0000, Mark Brown wrote:
> > On Mon, Dec 11, 2017 at 01:54:25PM -0600, Steven Eckhoff wrote:
> > > +static int tscs42xx_probe(struct snd_soc_codec *codec)
> > > +{
> > > + int i;
> > > + int ret;
> > > +
> > > + for (i = 0; i < ARRAY_SIZE(r_inits); ++i) {
> > > + ret = snd_soc_write(codec, r_inits[i].reg, r_inits[i].def);
> > > + if (ret < 0) {
> > > + dev_err(codec->dev,
> > > + "Failed to write codec defaults (%d)\n", ret);
> > > + return ret;
> > > + }
> > > + }
> >
> > I'd expect the driver to just reset the CODEC (it appears to have that
> > feature) and the regmap.
> >
> These init values were meant to be driver defaults that differed from
> the device defaults. In hindsight this was a bad idea. I am removing
> them in the next revision and will have the machine driver setup the
> codec appropriately.
>

Not sure what you mean here but setting up CODEC registers
directly from the machine driver is probably not ideal. You
should probably be looking into regmap_register_patch this lets
you apply a bunch of register settings to the chip every time you
do a regmap_cache_sync. This is useful for situations like the
chip has terrible register defaults you want to correct.

Thanks,
Charles