* usage of SOC_ENUM_SINGLE
@ 2010-11-26 10:18 Koul, Vinod
2010-11-26 11:52 ` Mark Brown
0 siblings, 1 reply; 4+ messages in thread
From: Koul, Vinod @ 2010-11-26 10:18 UTC (permalink / raw)
To: alsa-devel@alsa-project.org; +Cc: Harsha, Priya, Mark Brown, Liam Girdwood
Hi
I am trying to add an output control which is basically a switch between headset
and earpiece. The H/W register for this asks me to write 0x40 for EP and 0x3 for
enabling Headset
So I did this:
static const char *headset_switch_text[] = {
"Earpiece", "HeadSet"
};
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
~Vinod
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: usage of SOC_ENUM_SINGLE
2010-11-26 10:18 usage of SOC_ENUM_SINGLE Koul, Vinod
@ 2010-11-26 11:52 ` Mark Brown
2010-11-26 14:45 ` Koul, Vinod
0 siblings, 1 reply; 4+ messages in thread
From: Mark Brown @ 2010-11-26 11:52 UTC (permalink / raw)
To: Koul, Vinod; +Cc: alsa-devel@alsa-project.org, Harsha, Priya, Liam Girdwood
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.
Note also that you should namespace the #defines for your register
names.
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: usage of SOC_ENUM_SINGLE
2010-11-26 11:52 ` Mark Brown
@ 2010-11-26 14:45 ` Koul, Vinod
2010-11-26 14:51 ` Mark Brown
0 siblings, 1 reply; 4+ messages in thread
From: Koul, Vinod @ 2010-11-26 14:45 UTC (permalink / raw)
To: Mark Brown; +Cc: alsa-devel@alsa-project.org, Harsha, Priya, Liam Girdwood
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
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: usage of SOC_ENUM_SINGLE
2010-11-26 14:45 ` Koul, Vinod
@ 2010-11-26 14:51 ` Mark Brown
0 siblings, 0 replies; 4+ messages in thread
From: Mark Brown @ 2010-11-26 14:51 UTC (permalink / raw)
To: Koul, Vinod; +Cc: alsa-devel@alsa-project.org, Harsha, Priya, Liam Girdwood
On Fri, Nov 26, 2010 at 08:15:11PM +0530, Koul, Vinod wrote:
> 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"
> };
No, that's not going to work and I'd be astonished if it compiled
cleanly. You need to pass the *values* you want to set - look at the
uses of this in exiting CODEC drivers for examples of how to use this.
^ permalink raw reply [flat|nested] 4+ messages in thread
end of thread, other threads:[~2010-11-26 14:51 UTC | newest]
Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2010-11-26 10:18 usage of SOC_ENUM_SINGLE Koul, Vinod
2010-11-26 11:52 ` Mark Brown
2010-11-26 14:45 ` Koul, Vinod
2010-11-26 14:51 ` Mark Brown
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox