aboutsummaryrefslogtreecommitdiffstats
path: root/sound/pci/hda/patch_sigmatel.c
diff options
context:
space:
mode:
authorMatthew Ranostay <mranostay@embeddedalley.com>2008-09-16 10:39:37 -0400
committerJaroslav Kysela <perex@perex.cz>2008-09-23 02:18:20 -0400
commit6597363219585be451e3b98c9485630ba656a536 (patch)
treea57a469127b8af5b4bceffa38132ffa742e2be94 /sound/pci/hda/patch_sigmatel.c
parent2f3dfaf5da3d43a1483b063e9d0692789241febb (diff)
ALSA: hda: SPDIF mux fixes for STAC927x
Corrected bounds-checking in stac92xx_auto_create_mux_input_ctls() and added a spec->spdif_labels pointer for custom SPDIF mux labels for non-standard codec connections. Signed-off-by: Matthew Ranostay <mranostay@embeddedalley.com> Signed-off-by: Takashi Iwai <tiwai@suse.de> Signed-off-by: Jaroslav Kysela <perex@perex.cz>
Diffstat (limited to 'sound/pci/hda/patch_sigmatel.c')
-rw-r--r--sound/pci/hda/patch_sigmatel.c20
1 files changed, 15 insertions, 5 deletions
diff --git a/sound/pci/hda/patch_sigmatel.c b/sound/pci/hda/patch_sigmatel.c
index 16fc3aeeb136..bd0d6f8ab430 100644
--- a/sound/pci/hda/patch_sigmatel.c
+++ b/sound/pci/hda/patch_sigmatel.c
@@ -177,6 +177,7 @@ struct sigmatel_spec {
177 unsigned int num_dmuxes; 177 unsigned int num_dmuxes;
178 hda_nid_t *smux_nids; 178 hda_nid_t *smux_nids;
179 unsigned int num_smuxes; 179 unsigned int num_smuxes;
180 const char **spdif_labels;
180 181
181 hda_nid_t dig_in_nid; 182 hda_nid_t dig_in_nid;
182 hda_nid_t mono_nid; 183 hda_nid_t mono_nid;
@@ -394,6 +395,11 @@ static hda_nid_t stac927x_dmic_nids[STAC927X_NUM_DMICS + 1] = {
394 0x13, 0x14, 0 395 0x13, 0x14, 0
395}; 396};
396 397
398static const char *stac927x_spdif_labels[5] = {
399 "Digital Playback", "ADAT", "Analog Mux 1",
400 "Analog Mux 2", "Analog Mux 3"
401};
402
397static hda_nid_t stac9205_adc_nids[2] = { 403static hda_nid_t stac9205_adc_nids[2] = {
398 0x12, 0x13 404 0x12, 0x13
399}; 405};
@@ -3033,26 +3039,29 @@ static int stac92xx_auto_create_mux_input_ctls(struct hda_codec *codec)
3033}; 3039};
3034 3040
3035static const char *stac92xx_spdif_labels[3] = { 3041static const char *stac92xx_spdif_labels[3] = {
3036 "Digital Playback", "Analog Mux 1", "Analog Mux 2" 3042 "Digital Playback", "Analog Mux 1", "Analog Mux 2",
3037}; 3043};
3038 3044
3039static int stac92xx_auto_create_spdif_mux_ctls(struct hda_codec *codec) 3045static int stac92xx_auto_create_spdif_mux_ctls(struct hda_codec *codec)
3040{ 3046{
3041 struct sigmatel_spec *spec = codec->spec; 3047 struct sigmatel_spec *spec = codec->spec;
3042 struct hda_input_mux *spdif_mux = &spec->private_smux; 3048 struct hda_input_mux *spdif_mux = &spec->private_smux;
3049 const char **labels = spec->spdif_labels;
3043 int i, num_cons; 3050 int i, num_cons;
3044 hda_nid_t con_lst[ARRAY_SIZE(stac92xx_spdif_labels)]; 3051 hda_nid_t con_lst[HDA_MAX_NUM_INPUTS];
3045 3052
3046 num_cons = snd_hda_get_connections(codec, 3053 num_cons = snd_hda_get_connections(codec,
3047 spec->smux_nids[0], 3054 spec->smux_nids[0],
3048 con_lst, 3055 con_lst,
3049 HDA_MAX_NUM_INPUTS); 3056 HDA_MAX_NUM_INPUTS);
3050 if (!num_cons || num_cons > ARRAY_SIZE(stac92xx_spdif_labels)) 3057 if (!num_cons)
3051 return -EINVAL; 3058 return -EINVAL;
3052 3059
3060 if (!labels)
3061 labels = stac92xx_spdif_labels;
3062
3053 for (i = 0; i < num_cons; i++) { 3063 for (i = 0; i < num_cons; i++) {
3054 spdif_mux->items[spdif_mux->num_items].label = 3064 spdif_mux->items[spdif_mux->num_items].label = labels[i];
3055 stac92xx_spdif_labels[i];
3056 spdif_mux->items[spdif_mux->num_items].index = i; 3065 spdif_mux->items[spdif_mux->num_items].index = i;
3057 spdif_mux->num_items++; 3066 spdif_mux->num_items++;
3058 } 3067 }
@@ -4547,6 +4556,7 @@ static int patch_stac927x(struct hda_codec *codec)
4547 spec->num_muxes = ARRAY_SIZE(stac927x_mux_nids); 4556 spec->num_muxes = ARRAY_SIZE(stac927x_mux_nids);
4548 spec->smux_nids = stac927x_smux_nids; 4557 spec->smux_nids = stac927x_smux_nids;
4549 spec->num_smuxes = ARRAY_SIZE(stac927x_smux_nids); 4558 spec->num_smuxes = ARRAY_SIZE(stac927x_smux_nids);
4559 spec->spdif_labels = stac927x_spdif_labels;
4550 spec->dac_list = stac927x_dac_nids; 4560 spec->dac_list = stac927x_dac_nids;
4551 spec->multiout.dac_nids = spec->dac_nids; 4561 spec->multiout.dac_nids = spec->dac_nids;
4552 4562