aboutsummaryrefslogtreecommitdiffstats
path: root/sound
diff options
context:
space:
mode:
authorTakashi Iwai <tiwai@suse.de>2010-09-09 08:21:17 -0400
committerTakashi Iwai <tiwai@suse.de>2010-09-09 10:45:58 -0400
commitb5786e85cb2ffd0b07e86dec38a442bd20765ad8 (patch)
treeb274f05600ab04ad189f48e342d02ebebc412140 /sound
parent6cb3b707f95954ac18f19b4b3919af235738371a (diff)
ALSA: hda - Keep char arrays in input_mux items
Keep char array in the input_mux item itself instead of pointing to an external string. This is a preliminary work for improving the input-mux name based on the pin role. Signed-off-by: Takashi Iwai <tiwai@suse.de>
Diffstat (limited to 'sound')
-rw-r--r--sound/pci/hda/hda_codec.c18
-rw-r--r--sound/pci/hda/hda_generic.c2
-rw-r--r--sound/pci/hda/hda_local.h6
-rw-r--r--sound/pci/hda/patch_analog.c6
-rw-r--r--sound/pci/hda/patch_realtek.c10
-rw-r--r--sound/pci/hda/patch_sigmatel.c16
-rw-r--r--sound/pci/hda/patch_via.c15
7 files changed, 34 insertions, 39 deletions
diff --git a/sound/pci/hda/hda_codec.c b/sound/pci/hda/hda_codec.c
index bfdde7b0bafb..4348c33c6b85 100644
--- a/sound/pci/hda/hda_codec.c
+++ b/sound/pci/hda/hda_codec.c
@@ -4662,17 +4662,8 @@ const char *auto_pin_cfg_labels[AUTO_PIN_LAST] = {
4662}; 4662};
4663EXPORT_SYMBOL_HDA(auto_pin_cfg_labels); 4663EXPORT_SYMBOL_HDA(auto_pin_cfg_labels);
4664 4664
4665static const char *input_labels[AUTO_PIN_LAST][4] = { 4665void snd_hda_get_input_pin_label(const struct auto_pin_cfg *cfg,
4666 { "Mic", "Mic 2", "Mic 3", "Mic 4" }, 4666 int input, char *str)
4667 { "Front Mic", "Front Mic 2", "Front Mic 3", "Front Mic 4" },
4668 { "Line", "Line 2", "Line 3", "Line 4" },
4669 { "Front Line", "Front Line 2", "Front Line 3", "Front Line 4" },
4670 { "CD", "CD 2", "CD 3", "CD 4" },
4671 { "Aux", "Aux 2", "Aux 3", "Aux 4" },
4672};
4673
4674const char *snd_hda_get_input_pin_label(const struct auto_pin_cfg *cfg,
4675 int input)
4676{ 4667{
4677 int type = cfg->inputs[input].type; 4668 int type = cfg->inputs[input].type;
4678 int idx; 4669 int idx;
@@ -4681,7 +4672,10 @@ const char *snd_hda_get_input_pin_label(const struct auto_pin_cfg *cfg,
4681 if (type != cfg->inputs[input].type) 4672 if (type != cfg->inputs[input].type)
4682 break; 4673 break;
4683 } 4674 }
4684 return input_labels[type][idx]; 4675 if (idx > 0)
4676 sprintf(str, "%s %d", auto_pin_cfg_labels[type], idx);
4677 else
4678 strcpy(str, auto_pin_cfg_labels[type]);
4685} 4679}
4686EXPORT_SYMBOL_HDA(snd_hda_get_input_pin_label); 4680EXPORT_SYMBOL_HDA(snd_hda_get_input_pin_label);
4687 4681
diff --git a/sound/pci/hda/hda_generic.c b/sound/pci/hda/hda_generic.c
index 5ea21285ee1f..cce18ba8b5a1 100644
--- a/sound/pci/hda/hda_generic.c
+++ b/sound/pci/hda/hda_generic.c
@@ -566,7 +566,7 @@ static int parse_adc_sub_nodes(struct hda_codec *codec, struct hda_gspec *spec,
566 } 566 }
567 label = spec->cap_labels[spec->input_mux.num_items]; 567 label = spec->cap_labels[spec->input_mux.num_items];
568 strcpy(label, type); 568 strcpy(label, type);
569 spec->input_mux.items[spec->input_mux.num_items].label = label; 569 strcpy(spec->input_mux.items[spec->input_mux.num_items].label, label);
570 570
571 /* unmute the PIN external input */ 571 /* unmute the PIN external input */
572 unmute_input(codec, node, 0); /* index = 0? */ 572 unmute_input(codec, node, 0); /* index = 0? */
diff --git a/sound/pci/hda/hda_local.h b/sound/pci/hda/hda_local.h
index fb561748adb8..b448b0a997b1 100644
--- a/sound/pci/hda/hda_local.h
+++ b/sound/pci/hda/hda_local.h
@@ -215,7 +215,7 @@ int snd_hda_create_spdif_in_ctls(struct hda_codec *codec, hda_nid_t nid);
215 */ 215 */
216#define HDA_MAX_NUM_INPUTS 16 216#define HDA_MAX_NUM_INPUTS 16
217struct hda_input_mux_item { 217struct hda_input_mux_item {
218 const char *label; 218 char label[32];
219 unsigned int index; 219 unsigned int index;
220}; 220};
221struct hda_input_mux { 221struct hda_input_mux {
@@ -391,8 +391,8 @@ struct auto_pin_cfg_item {
391}; 391};
392 392
393struct auto_pin_cfg; 393struct auto_pin_cfg;
394const char *snd_hda_get_input_pin_label(const struct auto_pin_cfg *cfg, 394void snd_hda_get_input_pin_label(const struct auto_pin_cfg *cfg,
395 int input); 395 int input, char *label);
396 396
397struct auto_pin_cfg { 397struct auto_pin_cfg {
398 int line_outs; 398 int line_outs;
diff --git a/sound/pci/hda/patch_analog.c b/sound/pci/hda/patch_analog.c
index 3409d315f507..8de3a0dc45e4 100644
--- a/sound/pci/hda/patch_analog.c
+++ b/sound/pci/hda/patch_analog.c
@@ -2926,13 +2926,13 @@ static int ad1988_auto_create_analog_input_ctls(struct ad198x_spec *spec,
2926 type <= AUTO_PIN_FRONT_MIC); 2926 type <= AUTO_PIN_FRONT_MIC);
2927 if (err < 0) 2927 if (err < 0)
2928 return err; 2928 return err;
2929 imux->items[imux->num_items].label = 2929 snd_hda_get_input_pin_label(cfg, i,
2930 snd_hda_get_input_pin_label(cfg, i); 2930 imux->items[imux->num_items].label);
2931 imux->items[imux->num_items].index = 2931 imux->items[imux->num_items].index =
2932 ad1988_pin_to_adc_idx(cfg->inputs[i].pin); 2932 ad1988_pin_to_adc_idx(cfg->inputs[i].pin);
2933 imux->num_items++; 2933 imux->num_items++;
2934 } 2934 }
2935 imux->items[imux->num_items].label = "Mix"; 2935 strcpy(imux->items[imux->num_items].label, "Mix");
2936 imux->items[imux->num_items].index = 9; 2936 imux->items[imux->num_items].index = 9;
2937 imux->num_items++; 2937 imux->num_items++;
2938 2938
diff --git a/sound/pci/hda/patch_realtek.c b/sound/pci/hda/patch_realtek.c
index 0c25d22be875..0a7d9d5ea40e 100644
--- a/sound/pci/hda/patch_realtek.c
+++ b/sound/pci/hda/patch_realtek.c
@@ -4974,8 +4974,8 @@ static int alc_auto_create_input_ctls(struct hda_codec *codec,
4974 if (idx < 0 && cap2) 4974 if (idx < 0 && cap2)
4975 idx = get_connection_index(codec, cap2, pin); 4975 idx = get_connection_index(codec, cap2, pin);
4976 if (idx >= 0) { 4976 if (idx >= 0) {
4977 imux->items[imux->num_items].label = 4977 snd_hda_get_input_pin_label(cfg, i,
4978 snd_hda_get_input_pin_label(cfg, i); 4978 imux->items[imux->num_items].label);
4979 imux->items[imux->num_items].index = idx; 4979 imux->items[imux->num_items].index = idx;
4980 imux->num_items++; 4980 imux->num_items++;
4981 } 4981 }
@@ -10626,9 +10626,9 @@ static int alc_auto_add_mic_boost(struct hda_codec *codec)
10626 break; 10626 break;
10627 nid = cfg->inputs[i].pin; 10627 nid = cfg->inputs[i].pin;
10628 if (get_wcaps(codec, nid) & AC_WCAP_IN_AMP) { 10628 if (get_wcaps(codec, nid) & AC_WCAP_IN_AMP) {
10629 char label[32]; 10629 char pinname[32], label[32];
10630 snprintf(label, sizeof(label), "%s Boost", 10630 snd_hda_get_input_pin_label(cfg, i, pinname);
10631 snd_hda_get_input_pin_label(cfg, i)); 10631 snprintf(label, sizeof(label), "%s Boost", pinname);
10632 err = add_control(spec, ALC_CTL_WIDGET_VOL, label, 0, 10632 err = add_control(spec, ALC_CTL_WIDGET_VOL, label, 0,
10633 HDA_COMPOSE_AMP_VAL(nid, 3, 0, HDA_INPUT)); 10633 HDA_COMPOSE_AMP_VAL(nid, 3, 0, HDA_INPUT));
10634 if (err < 0) 10634 if (err < 0)
diff --git a/sound/pci/hda/patch_sigmatel.c b/sound/pci/hda/patch_sigmatel.c
index 7f09e140953e..852dae91edb1 100644
--- a/sound/pci/hda/patch_sigmatel.c
+++ b/sound/pci/hda/patch_sigmatel.c
@@ -1116,7 +1116,7 @@ static int stac92xx_build_controls(struct hda_codec *codec)
1116 struct hda_input_mux *smux = &spec->private_smux; 1116 struct hda_input_mux *smux = &spec->private_smux;
1117 /* check for mute support on SPDIF out */ 1117 /* check for mute support on SPDIF out */
1118 if (wcaps & AC_WCAP_OUT_AMP) { 1118 if (wcaps & AC_WCAP_OUT_AMP) {
1119 smux->items[smux->num_items].label = "Off"; 1119 strcpy(smux->items[smux->num_items].label, "Off");
1120 smux->items[smux->num_items].index = 0; 1120 smux->items[smux->num_items].index = 0;
1121 smux->num_items++; 1121 smux->num_items++;
1122 spec->spdif_mute = 1; 1122 spec->spdif_mute = 1;
@@ -3274,8 +3274,8 @@ static int stac92xx_auto_create_mono_output_ctls(struct hda_codec *codec)
3274 return -EINVAL; 3274 return -EINVAL;
3275 3275
3276 for (i = 0; i < num_cons; i++) { 3276 for (i = 0; i < num_cons; i++) {
3277 mono_mux->items[mono_mux->num_items].label = 3277 strcpy(mono_mux->items[mono_mux->num_items].label,
3278 stac92xx_mono_labels[i]; 3278 stac92xx_mono_labels[i]);
3279 mono_mux->items[mono_mux->num_items].index = i; 3279 mono_mux->items[mono_mux->num_items].index = i;
3280 mono_mux->num_items++; 3280 mono_mux->num_items++;
3281 } 3281 }
@@ -3404,7 +3404,7 @@ static int stac92xx_auto_create_spdif_mux_ctls(struct hda_codec *codec)
3404 labels = stac92xx_spdif_labels; 3404 labels = stac92xx_spdif_labels;
3405 3405
3406 for (i = 0; i < num_cons; i++) { 3406 for (i = 0; i < num_cons; i++) {
3407 spdif_mux->items[spdif_mux->num_items].label = labels[i]; 3407 strcpy(spdif_mux->items[spdif_mux->num_items].label, labels[i]);
3408 spdif_mux->items[spdif_mux->num_items].index = i; 3408 spdif_mux->items[spdif_mux->num_items].index = i;
3409 spdif_mux->num_items++; 3409 spdif_mux->num_items++;
3410 } 3410 }
@@ -3538,7 +3538,7 @@ static int stac92xx_auto_create_dmic_input_ctls(struct hda_codec *codec,
3538 int err, i; 3538 int err, i;
3539 unsigned int def_conf; 3539 unsigned int def_conf;
3540 3540
3541 dimux->items[dimux->num_items].label = stac92xx_dmic_labels[0]; 3541 strcpy(dimux->items[dimux->num_items].label, stac92xx_dmic_labels[0]);
3542 dimux->items[dimux->num_items].index = 0; 3542 dimux->items[dimux->num_items].index = 0;
3543 dimux->num_items++; 3543 dimux->num_items++;
3544 3544
@@ -3572,11 +3572,11 @@ static int stac92xx_auto_create_dmic_input_ctls(struct hda_codec *codec,
3572 return err; 3572 return err;
3573 } 3573 }
3574 3574
3575 dimux->items[dimux->num_items].label = label; 3575 strcpy(dimux->items[dimux->num_items].label, label);
3576 dimux->items[dimux->num_items].index = index; 3576 dimux->items[dimux->num_items].index = index;
3577 dimux->num_items++; 3577 dimux->num_items++;
3578 if (snd_hda_get_bool_hint(codec, "separate_dmux") != 1) { 3578 if (snd_hda_get_bool_hint(codec, "separate_dmux") != 1) {
3579 imux->items[imux->num_items].label = label; 3579 strcpy(imux->items[imux->num_items].label, label);
3580 imux->items[imux->num_items].index = index; 3580 imux->items[imux->num_items].index = index;
3581 imux->num_items++; 3581 imux->num_items++;
3582 } 3582 }
@@ -3713,7 +3713,7 @@ static int stac92xx_auto_create_analog_input_ctls(struct hda_codec *codec, const
3713 if (err < 0) 3713 if (err < 0)
3714 return err; 3714 return err;
3715 3715
3716 imux->items[imux->num_items].label = label; 3716 strcpy(imux->items[imux->num_items].label, label);
3717 imux->items[imux->num_items].index = index; 3717 imux->items[imux->num_items].index = index;
3718 imux->num_items++; 3718 imux->num_items++;
3719 } 3719 }
diff --git a/sound/pci/hda/patch_via.c b/sound/pci/hda/patch_via.c
index 93b86adbce63..9c1909d398e3 100644
--- a/sound/pci/hda/patch_via.c
+++ b/sound/pci/hda/patch_via.c
@@ -2376,7 +2376,7 @@ static void create_hp_imux(struct via_spec *spec)
2376 /* for hp mode select */ 2376 /* for hp mode select */
2377 i = 0; 2377 i = 0;
2378 while (texts[i] != NULL) { 2378 while (texts[i] != NULL) {
2379 imux->items[imux->num_items].label = texts[i]; 2379 strcpy(imux->items[imux->num_items].label, texts[i]);
2380 imux->items[imux->num_items].index = i; 2380 imux->items[imux->num_items].index = i;
2381 imux->num_items++; 2381 imux->num_items++;
2382 i++; 2382 i++;
@@ -2423,7 +2423,8 @@ static int vt_auto_create_analog_input_ctls(struct via_spec *spec,
2423 /* for internal loopback recording select */ 2423 /* for internal loopback recording select */
2424 for (idx = 0; idx < num_idxs; idx++) { 2424 for (idx = 0; idx < num_idxs; idx++) {
2425 if (pin_idxs[idx] == 0xff) { 2425 if (pin_idxs[idx] == 0xff) {
2426 imux->items[imux->num_items].label = "Stereo Mixer"; 2426 strcpy(imux->items[imux->num_items].label,
2427 "Stereo Mixer");
2427 imux->items[imux->num_items].index = idx; 2428 imux->items[imux->num_items].index = idx;
2428 imux->num_items++; 2429 imux->num_items++;
2429 break; 2430 break;
@@ -2445,8 +2446,8 @@ static int vt_auto_create_analog_input_ctls(struct via_spec *spec,
2445 type_idx, idx, cap_nid); 2446 type_idx, idx, cap_nid);
2446 if (err < 0) 2447 if (err < 0)
2447 return err; 2448 return err;
2448 imux->items[imux->num_items].label = 2449 snd_hda_get_input_pin_label(cfg, i,
2449 snd_hda_get_input_pin_label(cfg, i); 2450 imux->items[imux->num_items].label);
2450 imux->items[imux->num_items].index = idx; 2451 imux->items[imux->num_items].index = idx;
2451 imux->num_items++; 2452 imux->num_items++;
2452 } 2453 }
@@ -4336,7 +4337,7 @@ static int vt1702_auto_create_hp_ctls(struct via_spec *spec, hda_nid_t pin)
4336 /* for hp mode select */ 4337 /* for hp mode select */
4337 i = 0; 4338 i = 0;
4338 while (texts[i] != NULL) { 4339 while (texts[i] != NULL) {
4339 imux->items[imux->num_items].label = texts[i]; 4340 strcpy(imux->items[imux->num_items].label, texts[i]);
4340 imux->items[imux->num_items].index = i; 4341 imux->items[imux->num_items].index = i;
4341 imux->num_items++; 4342 imux->num_items++;
4342 i++; 4343 i++;
@@ -5520,7 +5521,7 @@ static int vt2002P_auto_create_analog_input_ctls(struct via_spec *spec,
5520 return err; 5521 return err;
5521 5522
5522 /* for digital mic select */ 5523 /* for digital mic select */
5523 imux->items[imux->num_items].label = "Digital Mic"; 5524 strcpy(imux->items[imux->num_items].label, "Digital Mic");
5524 imux->items[imux->num_items].index = 4; 5525 imux->items[imux->num_items].index = 4;
5525 imux->num_items++; 5526 imux->num_items++;
5526 5527
@@ -5843,7 +5844,7 @@ static int vt1812_auto_create_analog_input_ctls(struct via_spec *spec,
5843 return err; 5844 return err;
5844 5845
5845 /* for digital mic select */ 5846 /* for digital mic select */
5846 imux->items[imux->num_items].label = "Digital Mic"; 5847 strcpy(imux->items[imux->num_items].label, "Digital Mic");
5847 imux->items[imux->num_items].index = 6; 5848 imux->items[imux->num_items].index = 6;
5848 imux->num_items++; 5849 imux->num_items++;
5849 5850