[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 13:21:37 CEST 2011

On Tuesday 27 September 2011 11:56:26 Mark Brown wrote:
> On Tue, Sep 27, 2011 at 09:16:16AM +0300, Péter Ujfalusi wrote:
> > On Monday 26 September 2011 22:21:42 Mark Brown wrote:
> > > 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.
> That's not what you're actually checking :)  This would generally be
> checked by comparing the shift registers - the basic reason we have the
> two functions at all is that we used to mash everything into a 32 bit
> int rather than using a pointer to struct.

I see what you mean, but..
The thing I'm after here is to select between the snd_soc_put_volsw, and 
snd_soc_put_volsw_2r to make the change in the HW.

In case of SOC_SINGLE_TLV I (will) need to call snd_soc_put_volsw
In case of SOC_DOUBLE_TLV I need to call  snd_soc_put_volsw
In case of SOC_DOUBLE_R_TLV I need to call  snd_soc_put_volsw_2r.

reg =		xreg,
rreg =	0,
shift =	xshift,
rshift = 	xshift,

reg =		xreg,
rreg =	0,
shift =	left_shift,
rshift = 	right_shift,

reg =		left_reg,
rreg =	right_reg,
shift =	xshift,
rshift = 	xshift,

To pick the correct snd_soc_put_* call it is easier to check if the rreg is 0, 
since in that case I need to use the snd_soc_put_volsw (and 
snd_soc_put_volsw_2r, when we have two registers to configure).


More information about the Alsa-devel mailing list