Re: [PATCH 03/16] ASoC: tas2781: disable regmap regcache

Gergo Koteles
2023-12-15T01:17:04Z

On Thu, 2023-12-07 at 22:39 +0000, Mark Brown wrote:
> On Thu, Dec 07, 2023 at 10:12:13PM +0100, Gergo Koteles wrote:
> > On Thu, 2023-12-07 at 20:36 +0000, Mark Brown wrote:
>
> > > > And only one, because tasdevice_change_chn_book directly changes the
> > > > address of i2c_client, so the unlucky one gets invalid values in its
> > > > actual book from regcache_sync.
>
> > > The code creates the impression that writing to one tas2781 writes to
> > > all of them, is that not the case?
>
> > Yes, the tasdevice_* functions, but the regcache_sync doesn't know
> > this.
>
> So this syncing is done in software not hardware? My understanding was
> that this was a hardware thing.

If you mean that the amplifier does not know that there are several
programs or configurations or profiles, but only runs the current one,
yes.

>
> > > How would the devices get their configuration restored?
>
> > tasdevice_tuning_switch calls tasdevice_select_tuningprm_cfg which
> > checks whether the devices needs a new program or configuration.
>
> > the runtime_suspend and system resume set the devices cur_prog,
> > cur_conf to -1.
>
> ...
>
> > The tas2781_hda_playback_hook calls the tasdevice_tuning_switch
>
> And there are no registers other than these programs?

The tas2781-hda writes 4 things:

1. Profiles from RCA file
eg. INT8866RCA2.bin has 4 profile:
Music degree 0
calibration
voice call
earpiece spk2 bypass

The profiles contain pre-power-up and pre-shutdown register+value
sequences for each amplifier.

2. Programs from DSP firmware.
eg. TAS2XXX3870.bin has 1 program:
Tuning Mode

3. Configurations from the DSP firmware.
eg. TAS2XXX3870.bin has 2 configurations:
configuration_Normal_Tuning Mode_48 KHz_s2_0
calibration_Tuning Mode_48 KHz_s2_0

Programs and configurations contain blocks with addresses where they
should be written.

4. Calibration data from EFI variables.
R0, INV_R0, R0LOW, POWER, TLIM,
Based on the chip, they should be written to 5 registers.

The code restores all of these in playback_hook, runtime_resume,
system_resume functions without regmap_cache_sync.