From: Nickolas Lloyd <ultrageek.lloyd@gmail.com>
To: Takashi Iwai <tiwai@suse.de>
Cc: alsa-devel@alsa-project.org,
Matthew Ranostay <mranostay@embeddedalley.com>
Subject: Re: [PATCH] snd-hda-intel: Jack Mode changes for Sigmatel boards
Date: Wed, 27 May 2009 14:14:08 +0000 [thread overview]
Message-ID: <4A1D4AB0.40904@gmail.com> (raw)
In-Reply-To: <s5hy6sj9fl0.wl%tiwai@suse.de>
Takashi Iwai wrote:
> Well, a goto loop is old-fashioned as a code in 21st century :)
>
> Also, it might be better to use auto_pin_cfg_labels[] to each unique
> control name instead of index.
> It's often more intuitive.
>
>
> Takashi
>
>
Thanks for the suggestions. Indeed, using the labels array does make it
much more intuitive.
+static inline int stac92xx_add_jack_mode_control(struct hda_codec *codec,
+ hda_nid_t nid, int idx)
+{
+ int def_conf = snd_hda_codec_get_pincfg(codec, nid);
+ int control = 0;
+ struct sigmatel_spec *spec = codec->spec;
+ char name[22];
+
+ if (!((get_defcfg_connect(def_conf)) & AC_JACK_PORT_FIXED)) {
+ if (stac92xx_get_vref(codec, nid) == AC_PINCTL_VREF_GRD
+ && nid == spec->line_switch)
+ control = STAC_CTL_WIDGET_IO_SWITCH;
+ else if (snd_hda_query_pin_caps(codec, nid)
+ & (AC_PINCAP_VREF_GRD << AC_PINCAP_VREF_SHIFT))
+ control = STAC_CTL_WIDGET_DC_BIAS;
+ else if (nid == spec->mic_switch)
+ control = STAC_CTL_WIDGET_IO_SWITCH;
+ }
+
+ if (control) {
+ strcpy(name, auto_pin_cfg_labels[idx]);
+ return stac92xx_add_control(codec->spec, control,
+ strcat(name, " Jack Mode"), nid);
+ }
+
+ return 0;
+}
+
One question here is if it's possible for a Line In jack to act as a Mic
Jack via the use of a DC bias.
@@ -3269,20 +3336,13 @@ static int stac92xx_auto_create_multi_ou
return err;
}
- if (spec->line_switch) {
- err = stac92xx_add_control(spec, STAC_CTL_WIDGET_IO_SWITCH,
- "Line In as Output Switch",
- spec->line_switch << 8);
- if (err < 0)
- return err;
- }
-
- if (spec->mic_switch) {
- err = stac92xx_add_control(spec, STAC_CTL_WIDGET_DC_BIAS,
- "Mic Jack Mode",
- spec->mic_switch);
- if (err < 0)
- return err;
+ for (idx = AUTO_PIN_MIC; idx <= AUTO_PIN_FRONT_LINE; idx++) {
+ nid = cfg->input_pins[idx];
+ if (nid) {
+ err = stac92xx_add_jack_mode_control(codec, nid, idx);
+ if (err < 0)
+ return err;
+ }
Do these sections look alright? And if so, should I re-up the whole
thing? Also, is there anything else you think I should change, or any
other suggestions you have?
Thanks,
Nick
next prev parent reply other threads:[~2009-05-27 21:04 UTC|newest]
Thread overview: 10+ messages / expand[flat|nested] mbox.gz Atom feed top
2009-05-20 12:35 [PATCH] snd-hda-intel: Jack Mode changes for Sigmatel boards Nickolas Lloyd
2009-05-25 10:07 ` Takashi Iwai
2009-05-25 18:07 ` Nickolas Lloyd
2009-05-25 19:18 ` Nickolas Lloyd
2009-05-27 7:20 ` Takashi Iwai
2009-05-27 14:14 ` Nickolas Lloyd [this message]
2009-05-29 6:40 ` Takashi Iwai
2009-05-29 13:16 ` Nickolas Lloyd
2009-05-29 16:41 ` Nickolas Lloyd
2009-06-01 9:13 ` Takashi Iwai
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=4A1D4AB0.40904@gmail.com \
--to=ultrageek.lloyd@gmail.com \
--cc=alsa-devel@alsa-project.org \
--cc=mranostay@embeddedalley.com \
--cc=tiwai@suse.de \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox