[alsa-devel] [PATCH 02/10] ASoC: twl6040: Combine the custom volsw get, and put functions

Péter Ujfalusi peter.ujfalusi at ti.com
Tue Sep 27 08:16:16 CEST 2011


On Monday 26 September 2011 22:21:42 Mark Brown wrote:
> On Mon, Sep 26, 2011 at 04:26:25PM +0300, Peter Ujfalusi wrote:
> 
> Applied, thanks.
> 
> > -	ret = snd_soc_put_volsw(kcontrol, ucontrol);
> > +	/* call the appropriate handler depending on the rreg */
> > +	if (mc->rreg)
> > +		ret = snd_soc_put_volsw_2r(kcontrol, ucontrol);
> > +	else
> > +		ret = snd_soc_put_volsw(kcontrol, ucontrol);
> > +
> 
> Traditionally this would be done by comparing reg and rreg - if they're
> the same they're a mono control.

I'm not looking for the mono/stereo, but looking for the gain value(s) are in 
the same register, but in different offset VS gain values are at the same 
offset, but in two different registers.
The mono/stereo handling within snd_soc_put_volsw sufficient, and at the 
moment the twl6040 has only stereo controls handled this way, but if we have 
stereo, it is not a big job to implement.

The macros for SOC_DOUBLE, SOC_DOUBLE_TLV only assignes the .reg, leaving the 
.rreg to be zero.
SOC_DOUBLE_R, SOC_DOUBLE_R_TLV on the other hand assigning the .reg, and the 
.rreg.

--
Péter


More information about the Alsa-devel mailing list