[alsa-devel] usage of SOC_ENUM_SINGLE

Koul, Vinod vinod.koul at intel.com
Fri Nov 26 15:45:11 CET 2010


On Fri, Nov 26, 2010 at 05:22:35PM +0530, Mark Brown wrote:
> On Fri, Nov 26, 2010 at 03:48:49PM +0530, Koul, Vinod wrote:
> 
> > static const struct snd_kcontrol_new intel_msic_snd_controls[] = {
> > SOC_ENUM_SINGLE(OUTEN, 0x43, 0x40, headset_switch_text),
> > };
> 
> > Would this be the right thing, I am interpreting that 0x40 will be written
> for
> > earpiece in above and 0x3 for headset
> 
> No, that will cause you to have an enumeration with 0x40 elements
> starting at bit 0x43 in the register.  You're looking for a
> SOC_VALUE_ENUM, not a SOC_ENUM - SOC_ENUM covers contiguous ranges of
> values in the enumeration.
Thanks Mark,
So this should do, right?

SOC_VALUE_ENUM_SINGLE(MSIC_OUTEN, 0, 0x43,
		ARRAY_SIZE(headset_switch_text),
		headset_switch_text, headset_switch_values)

With, static const char *headset_switch_values[] = {
	"0x40", "0x03"
};

I am interpreting that for earpiece 0x40 will be written to this register and 
for headset 0x03 to register offset MSIC_OUTEN with mask value of 0x43 (not 
changing other bits in this register).

I am interpreting xmask as a mask value that will be applied while changing this 
value, so that other bits are not changes
 
> Note also that you should namespace the #defines for your register
> names.
Yup, added MSIC_ to register defines

Thanks
Vinod


More information about the Alsa-devel mailing list