aboutsummaryrefslogtreecommitdiffstats
path: root/sound/pci/hda/patch_sigmatel.c
diff options
context:
space:
mode:
authorMatthew Ranostay <mranostay@embeddedalley.com>2008-09-13 16:45:39 -0400
committerJaroslav Kysela <perex@perex.cz>2008-09-23 02:17:59 -0400
commit2a9c78160895af2a69ebcb1ac8be54b84815cfcf (patch)
treea478fd08618fda281a816b77bfeda2142269b117 /sound/pci/hda/patch_sigmatel.c
parent418c8f89911dd3d4930221def3bd56b38b051789 (diff)
ALSA: hda: 92hd73xx fixes
Added support for defining the number of amps and the creation of the private_dimux dynamically for the 92hd73xx codec family. Signed-off-by: Matthew Ranostay <mranostay@embeddedalley.com> [Fixed a typo by tiwai] 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.c78
1 files changed, 49 insertions, 29 deletions
diff --git a/sound/pci/hda/patch_sigmatel.c b/sound/pci/hda/patch_sigmatel.c
index e2b45b2f8f39..16fc3aeeb136 100644
--- a/sound/pci/hda/patch_sigmatel.c
+++ b/sound/pci/hda/patch_sigmatel.c
@@ -157,13 +157,11 @@ struct sigmatel_spec {
157 unsigned int num_pwrs; 157 unsigned int num_pwrs;
158 unsigned int *pwr_mapping; 158 unsigned int *pwr_mapping;
159 hda_nid_t *pwr_nids; 159 hda_nid_t *pwr_nids;
160 hda_nid_t *amp_nids;
161 hda_nid_t *dac_list; 160 hda_nid_t *dac_list;
162 161
163 /* playback */ 162 /* playback */
164 struct hda_input_mux *mono_mux; 163 struct hda_input_mux *mono_mux;
165 struct hda_input_mux *amp_mux; 164 struct hda_input_mux *amp_mux;
166 unsigned int cur_amux;
167 unsigned int cur_mmux; 165 unsigned int cur_mmux;
168 struct hda_multi_out multiout; 166 struct hda_multi_out multiout;
169 hda_nid_t dac_nids[5]; 167 hda_nid_t dac_nids[5];
@@ -202,6 +200,9 @@ struct sigmatel_spec {
202 unsigned int cur_mux[3]; 200 unsigned int cur_mux[3];
203 struct hda_input_mux *sinput_mux; 201 struct hda_input_mux *sinput_mux;
204 unsigned int cur_smux[2]; 202 unsigned int cur_smux[2];
203 unsigned int cur_amux;
204 hda_nid_t *amp_nids;
205 unsigned int num_amps;
205 unsigned int powerdown_adcs; 206 unsigned int powerdown_adcs;
206 207
207 /* i/o switches */ 208 /* i/o switches */
@@ -248,8 +249,9 @@ static hda_nid_t stac92hd73xx_adc_nids[2] = {
248 0x1a, 0x1b 249 0x1a, 0x1b
249}; 250};
250 251
251static hda_nid_t stac92hd73xx_amp_nids[4] = { 252#define DELL_M6_AMP 2
252 0x0b, 0x0c, 0x0e, 0 253static hda_nid_t stac92hd73xx_amp_nids[3] = {
254 0x0b, 0x0c, 0x0e
253}; 255};
254 256
255#define STAC92HD73XX_NUM_DMICS 2 257#define STAC92HD73XX_NUM_DMICS 2
@@ -964,29 +966,33 @@ static struct snd_kcontrol_new stac9200_mixer[] = {
964 { } /* end */ 966 { } /* end */
965}; 967};
966 968
969#define DELL_M6_MIXER 6
967static struct snd_kcontrol_new stac92hd73xx_6ch_mixer[] = { 970static struct snd_kcontrol_new stac92hd73xx_6ch_mixer[] = {
968 STAC_ANALOG_LOOPBACK(0xFA0, 0x7A1, 3), 971 /* start of config #1 */
969
970 HDA_CODEC_VOLUME_IDX("Capture Volume", 0x0, 0x20, 0x0, HDA_OUTPUT),
971 HDA_CODEC_MUTE_IDX("Capture Switch", 0x0, 0x20, 0x0, HDA_OUTPUT),
972
973 HDA_CODEC_VOLUME_IDX("Capture Volume", 0x1, 0x21, 0x0, HDA_OUTPUT),
974 HDA_CODEC_MUTE_IDX("Capture Switch", 0x1, 0x21, 0x0, HDA_OUTPUT),
975
976 HDA_CODEC_VOLUME("Front Mic Mixer Capture Volume", 0x1d, 0, HDA_INPUT), 972 HDA_CODEC_VOLUME("Front Mic Mixer Capture Volume", 0x1d, 0, HDA_INPUT),
977 HDA_CODEC_MUTE("Front Mic Mixer Capture Switch", 0x1d, 0, HDA_INPUT), 973 HDA_CODEC_MUTE("Front Mic Mixer Capture Switch", 0x1d, 0, HDA_INPUT),
978 974
979 HDA_CODEC_VOLUME("Mic Mixer Capture Volume", 0x1d, 0x1, HDA_INPUT),
980 HDA_CODEC_MUTE("Mic Mixer Capture Switch", 0x1d, 0x1, HDA_INPUT),
981
982 HDA_CODEC_VOLUME("Line In Mixer Capture Volume", 0x1d, 0x2, HDA_INPUT), 975 HDA_CODEC_VOLUME("Line In Mixer Capture Volume", 0x1d, 0x2, HDA_INPUT),
983 HDA_CODEC_MUTE("Line In Mixer Capture Switch", 0x1d, 0x2, HDA_INPUT), 976 HDA_CODEC_MUTE("Line In Mixer Capture Switch", 0x1d, 0x2, HDA_INPUT),
984 977
978 HDA_CODEC_VOLUME("CD Mixer Capture Volume", 0x1d, 0x4, HDA_INPUT),
979 HDA_CODEC_MUTE("CD Mixer Capture Switch", 0x1d, 0x4, HDA_INPUT),
980
981 /* start of config #2 */
982 HDA_CODEC_VOLUME("Mic Mixer Capture Volume", 0x1d, 0x1, HDA_INPUT),
983 HDA_CODEC_MUTE("Mic Mixer Capture Switch", 0x1d, 0x1, HDA_INPUT),
984
985 HDA_CODEC_VOLUME("DAC Mixer Capture Volume", 0x1d, 0x3, HDA_INPUT), 985 HDA_CODEC_VOLUME("DAC Mixer Capture Volume", 0x1d, 0x3, HDA_INPUT),
986 HDA_CODEC_MUTE("DAC Mixer Capture Switch", 0x1d, 0x3, HDA_INPUT), 986 HDA_CODEC_MUTE("DAC Mixer Capture Switch", 0x1d, 0x3, HDA_INPUT),
987 987
988 HDA_CODEC_VOLUME("CD Mixer Capture Volume", 0x1d, 0x4, HDA_INPUT), 988 STAC_ANALOG_LOOPBACK(0xFA0, 0x7A1, 3),
989 HDA_CODEC_MUTE("CD Mixer Capture Switch", 0x1d, 0x4, HDA_INPUT), 989
990 HDA_CODEC_VOLUME_IDX("Capture Volume", 0x0, 0x20, 0x0, HDA_OUTPUT),
991 HDA_CODEC_MUTE_IDX("Capture Switch", 0x0, 0x20, 0x0, HDA_OUTPUT),
992
993 HDA_CODEC_VOLUME_IDX("Capture Volume", 0x1, 0x21, 0x0, HDA_OUTPUT),
994 HDA_CODEC_MUTE_IDX("Capture Switch", 0x1, 0x21, 0x0, HDA_OUTPUT),
995
990 { } /* end */ 996 { } /* end */
991}; 997};
992 998
@@ -2959,17 +2965,19 @@ static int stac92xx_auto_create_amp_output_ctls(struct hda_codec *codec)
2959 struct hda_input_mux *amp_mux = &spec->private_amp_mux; 2965 struct hda_input_mux *amp_mux = &spec->private_amp_mux;
2960 int i, err; 2966 int i, err;
2961 2967
2962 for (i = 0; i < ARRAY_SIZE(stac92xx_amp_labels); i++) { 2968 for (i = 0; i < spec->num_amps; i++) {
2963 amp_mux->items[amp_mux->num_items].label = 2969 amp_mux->items[amp_mux->num_items].label =
2964 stac92xx_amp_labels[i]; 2970 stac92xx_amp_labels[i];
2965 amp_mux->items[amp_mux->num_items].index = i; 2971 amp_mux->items[amp_mux->num_items].index = i;
2966 amp_mux->num_items++; 2972 amp_mux->num_items++;
2967 } 2973 }
2968 2974
2969 err = stac92xx_add_control(spec, STAC_CTL_WIDGET_AMP_MUX, 2975 if (spec->num_amps > 1) {
2970 "Amp Selector Capture Switch", 0); 2976 err = stac92xx_add_control(spec, STAC_CTL_WIDGET_AMP_MUX,
2971 if (err < 0) 2977 "Amp Selector Capture Switch", 0);
2972 return err; 2978 if (err < 0)
2979 return err;
2980 }
2973 return stac92xx_add_control(spec, STAC_CTL_WIDGET_AMP_VOL, 2981 return stac92xx_add_control(spec, STAC_CTL_WIDGET_AMP_VOL,
2974 "Amp Capture Volume", 2982 "Amp Capture Volume",
2975 HDA_COMPOSE_AMP_VAL(spec->amp_nids[0], 3, 0, HDA_INPUT)); 2983 HDA_COMPOSE_AMP_VAL(spec->amp_nids[0], 3, 0, HDA_INPUT));
@@ -3345,12 +3353,12 @@ static int stac92xx_parse_auto_config(struct hda_codec *codec, hda_nid_t dig_out
3345 if (err < 0) 3353 if (err < 0)
3346 return err; 3354 return err;
3347 } 3355 }
3348 if (spec->amp_nids) { 3356 if (spec->num_amps > 0) {
3349 err = stac92xx_auto_create_amp_output_ctls(codec); 3357 err = stac92xx_auto_create_amp_output_ctls(codec);
3350 if (err < 0) 3358 if (err < 0)
3351 return err; 3359 return err;
3352 } 3360 }
3353 if (spec->num_dmics > 0) 3361 if (spec->num_dmics > 0 && !spec->dinput_mux)
3354 if ((err = stac92xx_auto_create_dmic_input_ctls(codec, 3362 if ((err = stac92xx_auto_create_dmic_input_ctls(codec,
3355 &spec->autocfg)) < 0) 3363 &spec->autocfg)) < 0)
3356 return err; 3364 return err;
@@ -3378,8 +3386,7 @@ static int stac92xx_parse_auto_config(struct hda_codec *codec, hda_nid_t dig_out
3378 spec->mixers[spec->num_mixers++] = spec->kctl_alloc; 3386 spec->mixers[spec->num_mixers++] = spec->kctl_alloc;
3379 3387
3380 spec->input_mux = &spec->private_imux; 3388 spec->input_mux = &spec->private_imux;
3381 if (!spec->dinput_mux) 3389 spec->dinput_mux = &spec->private_dimux;
3382 spec->dinput_mux = &spec->private_dimux;
3383 spec->sinput_mux = &spec->private_smux; 3390 spec->sinput_mux = &spec->private_smux;
3384 spec->mono_mux = &spec->private_mono_mux; 3391 spec->mono_mux = &spec->private_mono_mux;
3385 spec->amp_mux = &spec->private_amp_mux; 3392 spec->amp_mux = &spec->private_amp_mux;
@@ -3978,9 +3985,9 @@ static struct hda_input_mux stac92hd73xx_dmux = {
3978 .num_items = 4, 3985 .num_items = 4,
3979 .items = { 3986 .items = {
3980 { "Analog Inputs", 0x0b }, 3987 { "Analog Inputs", 0x0b },
3981 { "CD", 0x08 },
3982 { "Digital Mic 1", 0x09 }, 3988 { "Digital Mic 1", 0x09 },
3983 { "Digital Mic 2", 0x0a }, 3989 { "Digital Mic 2", 0x0a },
3990 { "CD", 0x08 },
3984 } 3991 }
3985}; 3992};
3986 3993
@@ -4051,12 +4058,14 @@ again:
4051 spec->dmux_nids = stac92hd73xx_dmux_nids; 4058 spec->dmux_nids = stac92hd73xx_dmux_nids;
4052 spec->smux_nids = stac92hd73xx_smux_nids; 4059 spec->smux_nids = stac92hd73xx_smux_nids;
4053 spec->amp_nids = stac92hd73xx_amp_nids; 4060 spec->amp_nids = stac92hd73xx_amp_nids;
4061 spec->num_amps = ARRAY_SIZE(stac92hd73xx_amp_nids);
4054 4062
4055 spec->num_muxes = ARRAY_SIZE(stac92hd73xx_mux_nids); 4063 spec->num_muxes = ARRAY_SIZE(stac92hd73xx_mux_nids);
4056 spec->num_adcs = ARRAY_SIZE(stac92hd73xx_adc_nids); 4064 spec->num_adcs = ARRAY_SIZE(stac92hd73xx_adc_nids);
4057 spec->num_dmuxes = ARRAY_SIZE(stac92hd73xx_dmux_nids); 4065 spec->num_dmuxes = ARRAY_SIZE(stac92hd73xx_dmux_nids);
4058 spec->num_smuxes = ARRAY_SIZE(stac92hd73xx_smux_nids); 4066 memcpy(&spec->private_dimux, &stac92hd73xx_dmux,
4059 spec->dinput_mux = &stac92hd73xx_dmux; 4067 sizeof(stac92hd73xx_dmux));
4068
4060 /* GPIO0 High = Enable EAPD */ 4069 /* GPIO0 High = Enable EAPD */
4061 spec->eapd_mask = spec->gpio_mask = spec->gpio_dir = 0x1; 4070 spec->eapd_mask = spec->gpio_mask = spec->gpio_dir = 0x1;
4062 spec->gpio_data = 0x01; 4071 spec->gpio_data = 0x01;
@@ -4064,11 +4073,18 @@ again:
4064 switch (spec->board_config) { 4073 switch (spec->board_config) {
4065 case STAC_DELL_M6: 4074 case STAC_DELL_M6:
4066 spec->init = dell_eq_core_init; 4075 spec->init = dell_eq_core_init;
4076 spec->num_smuxes = 0;
4077 spec->multiout.hp_nid =
4078 spec->multiout.dac_nids[spec->multiout.num_dacs - 1];
4079 spec->mixer = &stac92hd73xx_6ch_mixer[DELL_M6_MIXER];
4080 spec->amp_nids = &stac92hd73xx_amp_nids[DELL_M6_AMP];
4081 spec->num_amps = 1;
4067 switch (codec->subsystem_id) { 4082 switch (codec->subsystem_id) {
4068 case 0x1028025e: /* Analog Mics */ 4083 case 0x1028025e: /* Analog Mics */
4069 case 0x1028025f: 4084 case 0x1028025f:
4070 stac92xx_set_config_reg(codec, 0x0b, 0x90A70170); 4085 stac92xx_set_config_reg(codec, 0x0b, 0x90A70170);
4071 spec->num_dmics = 0; 4086 spec->num_dmics = 0;
4087 spec->private_dimux.num_items = 1;
4072 break; 4088 break;
4073 case 0x10280271: /* Digital Mics */ 4089 case 0x10280271: /* Digital Mics */
4074 case 0x10280272: 4090 case 0x10280272:
@@ -4078,18 +4094,22 @@ again:
4078 case 0x10280255: 4094 case 0x10280255:
4079 stac92xx_set_config_reg(codec, 0x13, 0x90A60160); 4095 stac92xx_set_config_reg(codec, 0x13, 0x90A60160);
4080 spec->num_dmics = 1; 4096 spec->num_dmics = 1;
4097 spec->private_dimux.num_items = 2;
4081 break; 4098 break;
4082 case 0x10280256: /* Both */ 4099 case 0x10280256: /* Both */
4083 case 0x10280057: 4100 case 0x10280057:
4084 stac92xx_set_config_reg(codec, 0x0b, 0x90A70170); 4101 stac92xx_set_config_reg(codec, 0x0b, 0x90A70170);
4085 stac92xx_set_config_reg(codec, 0x13, 0x90A60160); 4102 stac92xx_set_config_reg(codec, 0x13, 0x90A60160);
4086 spec->num_dmics = 1; 4103 spec->num_dmics = 1;
4104 spec->private_dimux.num_items = 2;
4087 break; 4105 break;
4088 } 4106 }
4089 break; 4107 break;
4090 default: 4108 default:
4091 spec->num_dmics = STAC92HD73XX_NUM_DMICS; 4109 spec->num_dmics = STAC92HD73XX_NUM_DMICS;
4110 spec->num_smuxes = ARRAY_SIZE(stac92hd73xx_smux_nids);
4092 } 4111 }
4112 spec->dinput_mux = &spec->private_dimux;
4093 4113
4094 spec->num_pwrs = ARRAY_SIZE(stac92hd73xx_pwr_nids); 4114 spec->num_pwrs = ARRAY_SIZE(stac92hd73xx_pwr_nids);
4095 spec->pwr_nids = stac92hd73xx_pwr_nids; 4115 spec->pwr_nids = stac92hd73xx_pwr_nids;