aboutsummaryrefslogtreecommitdiffstats
path: root/sound
diff options
context:
space:
mode:
authorTakashi Iwai <tiwai@suse.de>2008-12-19 04:09:47 -0500
committerTakashi Iwai <tiwai@suse.de>2008-12-19 09:09:38 -0500
commit766245348db4b047a9b53548b5b893cd5115decc (patch)
tree17b72e54c6667f6a5b79e169ae961aaed885f70b /sound
parentc21ca4a872697aeda4fe91bf9b6cc8380c62827c (diff)
ALSA: hda - Use more distinct name for a unique volume in STAC/IDT
When the line_out has only one DAC and it's unique (i.e. not shared by other outputs), assign a more reasonable and distinct mixer name such as "Headphone" or "Speaker". Signed-off-by: Takashi Iwai <tiwai@suse.de>
Diffstat (limited to 'sound')
-rw-r--r--sound/pci/hda/patch_sigmatel.c33
1 files changed, 29 insertions, 4 deletions
diff --git a/sound/pci/hda/patch_sigmatel.c b/sound/pci/hda/patch_sigmatel.c
index 171400216326..6b7eeba656ed 100644
--- a/sound/pci/hda/patch_sigmatel.c
+++ b/sound/pci/hda/patch_sigmatel.c
@@ -2949,17 +2949,30 @@ static int add_spec_extra_dacs(struct sigmatel_spec *spec, hda_nid_t nid)
2949 return 1; 2949 return 1;
2950} 2950}
2951 2951
2952static int is_unique_dac(struct sigmatel_spec *spec, hda_nid_t nid)
2953{
2954 int i;
2955
2956 if (spec->autocfg.line_outs != 1)
2957 return 0;
2958 if (spec->multiout.hp_nid == nid)
2959 return 0;
2960 for (i = 0; i < ARRAY_SIZE(spec->multiout.extra_out_nid); i++)
2961 if (spec->multiout.extra_out_nid[i] == nid)
2962 return 0;
2963 return 1;
2964}
2965
2952/* add playback controls from the parsed DAC table */ 2966/* add playback controls from the parsed DAC table */
2953static int stac92xx_auto_create_multi_out_ctls(struct hda_codec *codec, 2967static int stac92xx_auto_create_multi_out_ctls(struct hda_codec *codec,
2954 const struct auto_pin_cfg *cfg) 2968 const struct auto_pin_cfg *cfg)
2955{ 2969{
2970 struct sigmatel_spec *spec = codec->spec;
2956 static const char *chname[4] = { 2971 static const char *chname[4] = {
2957 "Front", "Surround", NULL /*CLFE*/, "Side" 2972 "Front", "Surround", NULL /*CLFE*/, "Side"
2958 }; 2973 };
2959 hda_nid_t nid = 0; 2974 hda_nid_t nid = 0;
2960 int i, err; 2975 int i, err, num_dacs;
2961
2962 struct sigmatel_spec *spec = codec->spec;
2963 unsigned int wid_caps, pincap; 2976 unsigned int wid_caps, pincap;
2964 2977
2965 for (i = 0; i < cfg->line_outs && spec->multiout.dac_nids[i]; i++) { 2978 for (i = 0; i < cfg->line_outs && spec->multiout.dac_nids[i]; i++) {
@@ -2985,7 +2998,19 @@ static int stac92xx_auto_create_multi_out_ctls(struct hda_codec *codec,
2985 } 2998 }
2986 2999
2987 } else { 3000 } else {
2988 err = create_controls(spec, chname[i], nid, 3); 3001 const char *name = chname[i];
3002 /* if it's a single DAC, assign a better name */
3003 if (!i && is_unique_dac(spec, nid)) {
3004 switch (cfg->line_out_type) {
3005 case AUTO_PIN_HP_OUT:
3006 name = "Headphone";
3007 break;
3008 case AUTO_PIN_SPEAKER_OUT:
3009 name = "Speaker";
3010 break;
3011 }
3012 }
3013 err = create_controls(spec, name, nid, 3);
2989 if (err < 0) 3014 if (err < 0)
2990 return err; 3015 return err;
2991 } 3016 }