aboutsummaryrefslogtreecommitdiffstats
path: root/sound/pci/hda
diff options
context:
space:
mode:
authorTakashi Iwai <tiwai@suse.de>2009-03-06 04:13:24 -0500
committerTakashi Iwai <tiwai@suse.de>2009-03-06 04:13:24 -0500
commit668b9652be33510a2a42b290dd335d34d38e2068 (patch)
tree32477214a98a4503e163cd12696e21d7720bcb6d /sound/pci/hda
parent7a411ee01bf3114ba2a2ae013eaae4e3c41f8eb5 (diff)
ALSA: hda - Create multiple HP / speaker controls with index
Create multiple "Headphone" and "Speaker" controls with non-zero index numbers instead of "Headphone2", etc. Signed-off-by: Takashi Iwai <tiwai@suse.de>
Diffstat (limited to 'sound/pci/hda')
-rw-r--r--sound/pci/hda/patch_sigmatel.c33
1 files changed, 14 insertions, 19 deletions
diff --git a/sound/pci/hda/patch_sigmatel.c b/sound/pci/hda/patch_sigmatel.c
index edd2ed7ebb49..d19090fd2d13 100644
--- a/sound/pci/hda/patch_sigmatel.c
+++ b/sound/pci/hda/patch_sigmatel.c
@@ -1227,10 +1227,7 @@ static const char *slave_vols[] = {
1227 "LFE Playback Volume", 1227 "LFE Playback Volume",
1228 "Side Playback Volume", 1228 "Side Playback Volume",
1229 "Headphone Playback Volume", 1229 "Headphone Playback Volume",
1230 "Headphone2 Playback Volume",
1231 "Speaker Playback Volume", 1230 "Speaker Playback Volume",
1232 "External Speaker Playback Volume",
1233 "Speaker2 Playback Volume",
1234 NULL 1231 NULL
1235}; 1232};
1236 1233
@@ -1241,10 +1238,7 @@ static const char *slave_sws[] = {
1241 "LFE Playback Switch", 1238 "LFE Playback Switch",
1242 "Side Playback Switch", 1239 "Side Playback Switch",
1243 "Headphone Playback Switch", 1240 "Headphone Playback Switch",
1244 "Headphone2 Playback Switch",
1245 "Speaker Playback Switch", 1241 "Speaker Playback Switch",
1246 "External Speaker Playback Switch",
1247 "Speaker2 Playback Switch",
1248 "IEC958 Playback Switch", 1242 "IEC958 Playback Switch",
1249 NULL 1243 NULL
1250}; 1244};
@@ -2976,8 +2970,8 @@ static int stac92xx_auto_fill_dac_nids(struct hda_codec *codec)
2976} 2970}
2977 2971
2978/* create volume control/switch for the given prefx type */ 2972/* create volume control/switch for the given prefx type */
2979static int create_controls(struct hda_codec *codec, const char *pfx, 2973static int create_controls_idx(struct hda_codec *codec, const char *pfx,
2980 hda_nid_t nid, int chs) 2974 int idx, hda_nid_t nid, int chs)
2981{ 2975{
2982 struct sigmatel_spec *spec = codec->spec; 2976 struct sigmatel_spec *spec = codec->spec;
2983 char name[32]; 2977 char name[32];
@@ -3001,19 +2995,22 @@ static int create_controls(struct hda_codec *codec, const char *pfx,
3001 } 2995 }
3002 2996
3003 sprintf(name, "%s Playback Volume", pfx); 2997 sprintf(name, "%s Playback Volume", pfx);
3004 err = stac92xx_add_control(spec, STAC_CTL_WIDGET_VOL, name, 2998 err = stac92xx_add_control_idx(spec, STAC_CTL_WIDGET_VOL, idx, name,
3005 HDA_COMPOSE_AMP_VAL_OFS(nid, chs, 0, HDA_OUTPUT, 2999 HDA_COMPOSE_AMP_VAL_OFS(nid, chs, 0, HDA_OUTPUT,
3006 spec->volume_offset)); 3000 spec->volume_offset));
3007 if (err < 0) 3001 if (err < 0)
3008 return err; 3002 return err;
3009 sprintf(name, "%s Playback Switch", pfx); 3003 sprintf(name, "%s Playback Switch", pfx);
3010 err = stac92xx_add_control(spec, STAC_CTL_WIDGET_MUTE, name, 3004 err = stac92xx_add_control_idx(spec, STAC_CTL_WIDGET_MUTE, idx, name,
3011 HDA_COMPOSE_AMP_VAL(nid, chs, 0, HDA_OUTPUT)); 3005 HDA_COMPOSE_AMP_VAL(nid, chs, 0, HDA_OUTPUT));
3012 if (err < 0) 3006 if (err < 0)
3013 return err; 3007 return err;
3014 return 0; 3008 return 0;
3015} 3009}
3016 3010
3011#define create_controls(codec, pfx, nid, chs) \
3012 create_controls_idx(codec, pfx, 0, nid, chs)
3013
3017static int add_spec_dacs(struct sigmatel_spec *spec, hda_nid_t nid) 3014static int add_spec_dacs(struct sigmatel_spec *spec, hda_nid_t nid)
3018{ 3015{
3019 if (spec->multiout.num_dacs > 4) { 3016 if (spec->multiout.num_dacs > 4) {
@@ -3051,12 +3048,6 @@ static int create_multi_out_ctls(struct hda_codec *codec, int num_outs,
3051 static const char *chname[4] = { 3048 static const char *chname[4] = {
3052 "Front", "Surround", NULL /*CLFE*/, "Side" 3049 "Front", "Surround", NULL /*CLFE*/, "Side"
3053 }; 3050 };
3054 static const char *hp_pfxs[] = {
3055 "Headphone", "Headphone2", "Headphone3", "Headphone4"
3056 };
3057 static const char *speaker_pfxs[] = {
3058 "Speaker", "External Speaker", "Speaker2", "Speaker3"
3059 };
3060 hda_nid_t nid; 3051 hda_nid_t nid;
3061 int i, err; 3052 int i, err;
3062 unsigned int wid_caps; 3053 unsigned int wid_caps;
@@ -3087,18 +3078,22 @@ static int create_multi_out_ctls(struct hda_codec *codec, int num_outs,
3087 3078
3088 } else { 3079 } else {
3089 const char *name; 3080 const char *name;
3081 int idx;
3090 switch (type) { 3082 switch (type) {
3091 case AUTO_PIN_HP_OUT: 3083 case AUTO_PIN_HP_OUT:
3092 name = hp_pfxs[i]; 3084 name = "Headphone";
3085 idx = i;
3093 break; 3086 break;
3094 case AUTO_PIN_SPEAKER_OUT: 3087 case AUTO_PIN_SPEAKER_OUT:
3095 name = speaker_pfxs[i]; 3088 name = "Speaker";
3089 idx = i;
3096 break; 3090 break;
3097 default: 3091 default:
3098 name = chname[i]; 3092 name = chname[i];
3093 idx = 0;
3099 break; 3094 break;
3100 } 3095 }
3101 err = create_controls(codec, name, nid, 3); 3096 err = create_controls_idx(codec, name, idx, nid, 3);
3102 if (err < 0) 3097 if (err < 0)
3103 return err; 3098 return err;
3104 if (type == AUTO_PIN_HP_OUT && !spec->hp_detect) { 3099 if (type == AUTO_PIN_HP_OUT && !spec->hp_detect) {