diff options
author | Takashi Iwai <tiwai@suse.de> | 2010-09-09 14:21:17 +0200 |
---|---|---|
committer | Takashi Iwai <tiwai@suse.de> | 2010-09-09 16:45:58 +0200 |
commit | b5786e85cb2ffd0b07e86dec38a442bd20765ad8 (patch) | |
tree | b274f05600ab04ad189f48e342d02ebebc412140 /sound/pci | |
parent | 6cb3b707f95954ac18f19b4b3919af235738371a (diff) | |
download | linux-b5786e85cb2ffd0b07e86dec38a442bd20765ad8.tar.bz2 |
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/pci')
-rw-r--r-- | sound/pci/hda/hda_codec.c | 18 | ||||
-rw-r--r-- | sound/pci/hda/hda_generic.c | 2 | ||||
-rw-r--r-- | sound/pci/hda/hda_local.h | 6 | ||||
-rw-r--r-- | sound/pci/hda/patch_analog.c | 6 | ||||
-rw-r--r-- | sound/pci/hda/patch_realtek.c | 10 | ||||
-rw-r--r-- | sound/pci/hda/patch_sigmatel.c | 16 | ||||
-rw-r--r-- | sound/pci/hda/patch_via.c | 15 |
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] = { }; EXPORT_SYMBOL_HDA(auto_pin_cfg_labels); -static const char *input_labels[AUTO_PIN_LAST][4] = { - { "Mic", "Mic 2", "Mic 3", "Mic 4" }, - { "Front Mic", "Front Mic 2", "Front Mic 3", "Front Mic 4" }, - { "Line", "Line 2", "Line 3", "Line 4" }, - { "Front Line", "Front Line 2", "Front Line 3", "Front Line 4" }, - { "CD", "CD 2", "CD 3", "CD 4" }, - { "Aux", "Aux 2", "Aux 3", "Aux 4" }, -}; - -const char *snd_hda_get_input_pin_label(const struct auto_pin_cfg *cfg, - int input) +void snd_hda_get_input_pin_label(const struct auto_pin_cfg *cfg, + int input, char *str) { int type = cfg->inputs[input].type; int idx; @@ -4681,7 +4672,10 @@ const char *snd_hda_get_input_pin_label(const struct auto_pin_cfg *cfg, if (type != cfg->inputs[input].type) break; } - return input_labels[type][idx]; + if (idx > 0) + sprintf(str, "%s %d", auto_pin_cfg_labels[type], idx); + else + strcpy(str, auto_pin_cfg_labels[type]); } EXPORT_SYMBOL_HDA(snd_hda_get_input_pin_label); 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, } label = spec->cap_labels[spec->input_mux.num_items]; strcpy(label, type); - spec->input_mux.items[spec->input_mux.num_items].label = label; + strcpy(spec->input_mux.items[spec->input_mux.num_items].label, label); /* unmute the PIN external input */ 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); */ #define HDA_MAX_NUM_INPUTS 16 struct hda_input_mux_item { - const char *label; + char label[32]; unsigned int index; }; struct hda_input_mux { @@ -391,8 +391,8 @@ struct auto_pin_cfg_item { }; struct auto_pin_cfg; -const char *snd_hda_get_input_pin_label(const struct auto_pin_cfg *cfg, - int input); +void snd_hda_get_input_pin_label(const struct auto_pin_cfg *cfg, + int input, char *label); struct auto_pin_cfg { 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, type <= AUTO_PIN_FRONT_MIC); if (err < 0) return err; - imux->items[imux->num_items].label = - snd_hda_get_input_pin_label(cfg, i); + snd_hda_get_input_pin_label(cfg, i, + imux->items[imux->num_items].label); imux->items[imux->num_items].index = ad1988_pin_to_adc_idx(cfg->inputs[i].pin); imux->num_items++; } - imux->items[imux->num_items].label = "Mix"; + strcpy(imux->items[imux->num_items].label, "Mix"); imux->items[imux->num_items].index = 9; imux->num_items++; 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, if (idx < 0 && cap2) idx = get_connection_index(codec, cap2, pin); if (idx >= 0) { - imux->items[imux->num_items].label = - snd_hda_get_input_pin_label(cfg, i); + snd_hda_get_input_pin_label(cfg, i, + imux->items[imux->num_items].label); imux->items[imux->num_items].index = idx; imux->num_items++; } @@ -10626,9 +10626,9 @@ static int alc_auto_add_mic_boost(struct hda_codec *codec) break; nid = cfg->inputs[i].pin; if (get_wcaps(codec, nid) & AC_WCAP_IN_AMP) { - char label[32]; - snprintf(label, sizeof(label), "%s Boost", - snd_hda_get_input_pin_label(cfg, i)); + char pinname[32], label[32]; + snd_hda_get_input_pin_label(cfg, i, pinname); + snprintf(label, sizeof(label), "%s Boost", pinname); err = add_control(spec, ALC_CTL_WIDGET_VOL, label, 0, HDA_COMPOSE_AMP_VAL(nid, 3, 0, HDA_INPUT)); 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) struct hda_input_mux *smux = &spec->private_smux; /* check for mute support on SPDIF out */ if (wcaps & AC_WCAP_OUT_AMP) { - smux->items[smux->num_items].label = "Off"; + strcpy(smux->items[smux->num_items].label, "Off"); smux->items[smux->num_items].index = 0; smux->num_items++; spec->spdif_mute = 1; @@ -3274,8 +3274,8 @@ static int stac92xx_auto_create_mono_output_ctls(struct hda_codec *codec) return -EINVAL; for (i = 0; i < num_cons; i++) { - mono_mux->items[mono_mux->num_items].label = - stac92xx_mono_labels[i]; + strcpy(mono_mux->items[mono_mux->num_items].label, + stac92xx_mono_labels[i]); mono_mux->items[mono_mux->num_items].index = i; mono_mux->num_items++; } @@ -3404,7 +3404,7 @@ static int stac92xx_auto_create_spdif_mux_ctls(struct hda_codec *codec) labels = stac92xx_spdif_labels; for (i = 0; i < num_cons; i++) { - spdif_mux->items[spdif_mux->num_items].label = labels[i]; + strcpy(spdif_mux->items[spdif_mux->num_items].label, labels[i]); spdif_mux->items[spdif_mux->num_items].index = i; spdif_mux->num_items++; } @@ -3538,7 +3538,7 @@ static int stac92xx_auto_create_dmic_input_ctls(struct hda_codec *codec, int err, i; unsigned int def_conf; - dimux->items[dimux->num_items].label = stac92xx_dmic_labels[0]; + strcpy(dimux->items[dimux->num_items].label, stac92xx_dmic_labels[0]); dimux->items[dimux->num_items].index = 0; dimux->num_items++; @@ -3572,11 +3572,11 @@ static int stac92xx_auto_create_dmic_input_ctls(struct hda_codec *codec, return err; } - dimux->items[dimux->num_items].label = label; + strcpy(dimux->items[dimux->num_items].label, label); dimux->items[dimux->num_items].index = index; dimux->num_items++; if (snd_hda_get_bool_hint(codec, "separate_dmux") != 1) { - imux->items[imux->num_items].label = label; + strcpy(imux->items[imux->num_items].label, label); imux->items[imux->num_items].index = index; imux->num_items++; } @@ -3713,7 +3713,7 @@ static int stac92xx_auto_create_analog_input_ctls(struct hda_codec *codec, const if (err < 0) return err; - imux->items[imux->num_items].label = label; + strcpy(imux->items[imux->num_items].label, label); imux->items[imux->num_items].index = index; imux->num_items++; } 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) /* for hp mode select */ i = 0; while (texts[i] != NULL) { - imux->items[imux->num_items].label = texts[i]; + strcpy(imux->items[imux->num_items].label, texts[i]); imux->items[imux->num_items].index = i; imux->num_items++; i++; @@ -2423,7 +2423,8 @@ static int vt_auto_create_analog_input_ctls(struct via_spec *spec, /* for internal loopback recording select */ for (idx = 0; idx < num_idxs; idx++) { if (pin_idxs[idx] == 0xff) { - imux->items[imux->num_items].label = "Stereo Mixer"; + strcpy(imux->items[imux->num_items].label, + "Stereo Mixer"); imux->items[imux->num_items].index = idx; imux->num_items++; break; @@ -2445,8 +2446,8 @@ static int vt_auto_create_analog_input_ctls(struct via_spec *spec, type_idx, idx, cap_nid); if (err < 0) return err; - imux->items[imux->num_items].label = - snd_hda_get_input_pin_label(cfg, i); + snd_hda_get_input_pin_label(cfg, i, + imux->items[imux->num_items].label); imux->items[imux->num_items].index = idx; imux->num_items++; } @@ -4336,7 +4337,7 @@ static int vt1702_auto_create_hp_ctls(struct via_spec *spec, hda_nid_t pin) /* for hp mode select */ i = 0; while (texts[i] != NULL) { - imux->items[imux->num_items].label = texts[i]; + strcpy(imux->items[imux->num_items].label, texts[i]); imux->items[imux->num_items].index = i; imux->num_items++; i++; @@ -5520,7 +5521,7 @@ static int vt2002P_auto_create_analog_input_ctls(struct via_spec *spec, return err; /* for digital mic select */ - imux->items[imux->num_items].label = "Digital Mic"; + strcpy(imux->items[imux->num_items].label, "Digital Mic"); imux->items[imux->num_items].index = 4; imux->num_items++; @@ -5843,7 +5844,7 @@ static int vt1812_auto_create_analog_input_ctls(struct via_spec *spec, return err; /* for digital mic select */ - imux->items[imux->num_items].label = "Digital Mic"; + strcpy(imux->items[imux->num_items].label, "Digital Mic"); imux->items[imux->num_items].index = 6; imux->num_items++; |