aboutsummaryrefslogtreecommitdiffstats
path: root/sound/pci/hda/patch_sigmatel.c
diff options
context:
space:
mode:
Diffstat (limited to 'sound/pci/hda/patch_sigmatel.c')
-rw-r--r--sound/pci/hda/patch_sigmatel.c150
1 files changed, 76 insertions, 74 deletions
diff --git a/sound/pci/hda/patch_sigmatel.c b/sound/pci/hda/patch_sigmatel.c
index 9ba8af056170..df13c0f84899 100644
--- a/sound/pci/hda/patch_sigmatel.c
+++ b/sound/pci/hda/patch_sigmatel.c
@@ -1081,7 +1081,7 @@ static struct snd_kcontrol_new stac_smux_mixer = {
1081 1081
1082static const char * const slave_pfxs[] = { 1082static const char * const slave_pfxs[] = {
1083 "Front", "Surround", "Center", "LFE", "Side", 1083 "Front", "Surround", "Center", "LFE", "Side",
1084 "Headphone", "Speaker", "IEC958", "PCM", 1084 "Headphone", "Speaker", "Bass Speaker", "IEC958", "PCM",
1085 NULL 1085 NULL
1086}; 1086};
1087 1087
@@ -1136,9 +1136,10 @@ static int stac92xx_build_controls(struct hda_codec *codec)
1136 } 1136 }
1137 1137
1138 if (spec->multiout.dig_out_nid) { 1138 if (spec->multiout.dig_out_nid) {
1139 err = snd_hda_create_spdif_out_ctls(codec, 1139 err = snd_hda_create_dig_out_ctls(codec,
1140 spec->multiout.dig_out_nid, 1140 spec->multiout.dig_out_nid,
1141 spec->multiout.dig_out_nid); 1141 spec->multiout.dig_out_nid,
1142 spec->autocfg.dig_out_type[0]);
1142 if (err < 0) 1143 if (err < 0)
1143 return err; 1144 return err;
1144 err = snd_hda_create_spdif_share_sw(codec, 1145 err = snd_hda_create_spdif_share_sw(codec,
@@ -2515,6 +2516,11 @@ static int stac92xx_build_pcms(struct hda_codec *codec)
2515 info->stream[SNDRV_PCM_STREAM_PLAYBACK] = stac92xx_pcm_analog_playback; 2516 info->stream[SNDRV_PCM_STREAM_PLAYBACK] = stac92xx_pcm_analog_playback;
2516 info->stream[SNDRV_PCM_STREAM_PLAYBACK].nid = 2517 info->stream[SNDRV_PCM_STREAM_PLAYBACK].nid =
2517 spec->multiout.dac_nids[0]; 2518 spec->multiout.dac_nids[0];
2519 if (spec->autocfg.line_out_type == AUTO_PIN_SPEAKER_OUT &&
2520 spec->autocfg.line_outs == 2)
2521 info->stream[SNDRV_PCM_STREAM_PLAYBACK].chmap =
2522 snd_pcm_2_1_chmaps;
2523
2518 info->stream[SNDRV_PCM_STREAM_CAPTURE] = stac92xx_pcm_analog_capture; 2524 info->stream[SNDRV_PCM_STREAM_CAPTURE] = stac92xx_pcm_analog_capture;
2519 info->stream[SNDRV_PCM_STREAM_CAPTURE].nid = spec->adc_nids[0]; 2525 info->stream[SNDRV_PCM_STREAM_CAPTURE].nid = spec->adc_nids[0];
2520 info->stream[SNDRV_PCM_STREAM_CAPTURE].substreams = spec->num_adcs; 2526 info->stream[SNDRV_PCM_STREAM_CAPTURE].substreams = spec->num_adcs;
@@ -2805,7 +2811,6 @@ stac_control_new(struct sigmatel_spec *spec,
2805{ 2811{
2806 struct snd_kcontrol_new *knew; 2812 struct snd_kcontrol_new *knew;
2807 2813
2808 snd_array_init(&spec->kctls, sizeof(*knew), 32);
2809 knew = snd_array_new(&spec->kctls); 2814 knew = snd_array_new(&spec->kctls);
2810 if (!knew) 2815 if (!knew)
2811 return NULL; 2816 return NULL;
@@ -3268,9 +3273,9 @@ static int create_multi_out_ctls(struct hda_codec *codec, int num_outs,
3268 idx = i; 3273 idx = i;
3269 break; 3274 break;
3270 case AUTO_PIN_SPEAKER_OUT: 3275 case AUTO_PIN_SPEAKER_OUT:
3271 if (num_outs <= 1) { 3276 if (num_outs <= 2) {
3272 name = "Speaker"; 3277 name = i ? "Bass Speaker" : "Speaker";
3273 idx = i; 3278 idx = 0;
3274 break; 3279 break;
3275 } 3280 }
3276 /* Fall through in case of multi speaker outs */ 3281 /* Fall through in case of multi speaker outs */
@@ -4569,8 +4574,6 @@ static void stac92xx_free(struct hda_codec *codec)
4569 if (! spec) 4574 if (! spec)
4570 return; 4575 return;
4571 4576
4572 stac92xx_shutup(codec);
4573
4574 kfree(spec); 4577 kfree(spec);
4575 snd_hda_detach_beep_device(codec); 4578 snd_hda_detach_beep_device(codec);
4576} 4579}
@@ -5155,20 +5158,34 @@ static const struct hda_codec_ops stac92xx_patch_ops = {
5155 .reboot_notify = stac92xx_shutup, 5158 .reboot_notify = stac92xx_shutup,
5156}; 5159};
5157 5160
5161static int alloc_stac_spec(struct hda_codec *codec, int num_pins,
5162 const hda_nid_t *pin_nids)
5163{
5164 struct sigmatel_spec *spec;
5165
5166 spec = kzalloc(sizeof(*spec), GFP_KERNEL);
5167 if (!spec)
5168 return -ENOMEM;
5169 codec->spec = spec;
5170 codec->no_trigger_sense = 1; /* seems common with STAC/IDT codecs */
5171 spec->num_pins = num_pins;
5172 spec->pin_nids = pin_nids;
5173 snd_array_init(&spec->kctls, sizeof(struct snd_kcontrol_new), 32);
5174 return 0;
5175}
5176
5158static int patch_stac9200(struct hda_codec *codec) 5177static int patch_stac9200(struct hda_codec *codec)
5159{ 5178{
5160 struct sigmatel_spec *spec; 5179 struct sigmatel_spec *spec;
5161 int err; 5180 int err;
5162 5181
5163 spec = kzalloc(sizeof(*spec), GFP_KERNEL); 5182 err = alloc_stac_spec(codec, ARRAY_SIZE(stac9200_pin_nids),
5164 if (spec == NULL) 5183 stac9200_pin_nids);
5165 return -ENOMEM; 5184 if (err < 0)
5185 return err;
5166 5186
5167 codec->no_trigger_sense = 1; 5187 spec = codec->spec;
5168 codec->spec = spec;
5169 spec->linear_tone_beep = 1; 5188 spec->linear_tone_beep = 1;
5170 spec->num_pins = ARRAY_SIZE(stac9200_pin_nids);
5171 spec->pin_nids = stac9200_pin_nids;
5172 spec->board_config = snd_hda_check_board_config(codec, STAC_9200_MODELS, 5189 spec->board_config = snd_hda_check_board_config(codec, STAC_9200_MODELS,
5173 stac9200_models, 5190 stac9200_models,
5174 stac9200_cfg_tbl); 5191 stac9200_cfg_tbl);
@@ -5224,15 +5241,13 @@ static int patch_stac925x(struct hda_codec *codec)
5224 struct sigmatel_spec *spec; 5241 struct sigmatel_spec *spec;
5225 int err; 5242 int err;
5226 5243
5227 spec = kzalloc(sizeof(*spec), GFP_KERNEL); 5244 err = alloc_stac_spec(codec, ARRAY_SIZE(stac925x_pin_nids),
5228 if (spec == NULL) 5245 stac925x_pin_nids);
5229 return -ENOMEM; 5246 if (err < 0)
5247 return err;
5230 5248
5231 codec->no_trigger_sense = 1; 5249 spec = codec->spec;
5232 codec->spec = spec;
5233 spec->linear_tone_beep = 1; 5250 spec->linear_tone_beep = 1;
5234 spec->num_pins = ARRAY_SIZE(stac925x_pin_nids);
5235 spec->pin_nids = stac925x_pin_nids;
5236 5251
5237 /* Check first for codec ID */ 5252 /* Check first for codec ID */
5238 spec->board_config = snd_hda_check_board_codec_sid_config(codec, 5253 spec->board_config = snd_hda_check_board_codec_sid_config(codec,
@@ -5307,19 +5322,17 @@ static int patch_stac92hd73xx(struct hda_codec *codec)
5307{ 5322{
5308 struct sigmatel_spec *spec; 5323 struct sigmatel_spec *spec;
5309 hda_nid_t conn[STAC92HD73_DAC_COUNT + 2]; 5324 hda_nid_t conn[STAC92HD73_DAC_COUNT + 2];
5310 int err = 0; 5325 int err;
5311 int num_dacs; 5326 int num_dacs;
5312 5327
5313 spec = kzalloc(sizeof(*spec), GFP_KERNEL); 5328 err = alloc_stac_spec(codec, ARRAY_SIZE(stac92hd73xx_pin_nids),
5314 if (spec == NULL) 5329 stac92hd73xx_pin_nids);
5315 return -ENOMEM; 5330 if (err < 0)
5331 return err;
5316 5332
5317 codec->no_trigger_sense = 1; 5333 spec = codec->spec;
5318 codec->spec = spec;
5319 spec->linear_tone_beep = 0; 5334 spec->linear_tone_beep = 0;
5320 codec->slave_dig_outs = stac92hd73xx_slave_dig_outs; 5335 codec->slave_dig_outs = stac92hd73xx_slave_dig_outs;
5321 spec->num_pins = ARRAY_SIZE(stac92hd73xx_pin_nids);
5322 spec->pin_nids = stac92hd73xx_pin_nids;
5323 spec->board_config = snd_hda_check_board_config(codec, 5336 spec->board_config = snd_hda_check_board_config(codec,
5324 STAC_92HD73XX_MODELS, 5337 STAC_92HD73XX_MODELS,
5325 stac92hd73xx_models, 5338 stac92hd73xx_models,
@@ -5596,9 +5609,9 @@ static int patch_stac92hd83xxx(struct hda_codec *codec)
5596 int default_polarity = -1; /* no default cfg */ 5609 int default_polarity = -1; /* no default cfg */
5597 int err; 5610 int err;
5598 5611
5599 spec = kzalloc(sizeof(*spec), GFP_KERNEL); 5612 err = alloc_stac_spec(codec, 0, NULL); /* pins filled later */
5600 if (spec == NULL) 5613 if (err < 0)
5601 return -ENOMEM; 5614 return err;
5602 5615
5603 if (hp_bnb2011_with_dock(codec)) { 5616 if (hp_bnb2011_with_dock(codec)) {
5604 snd_hda_codec_set_pincfg(codec, 0xa, 0x2101201f); 5617 snd_hda_codec_set_pincfg(codec, 0xa, 0x2101201f);
@@ -5606,11 +5619,9 @@ static int patch_stac92hd83xxx(struct hda_codec *codec)
5606 } 5619 }
5607 5620
5608 codec->epss = 0; /* longer delay needed for D3 */ 5621 codec->epss = 0; /* longer delay needed for D3 */
5609 codec->no_trigger_sense = 1;
5610 codec->spec = spec;
5611
5612 stac92hd8x_fill_auto_spec(codec); 5622 stac92hd8x_fill_auto_spec(codec);
5613 5623
5624 spec = codec->spec;
5614 spec->linear_tone_beep = 0; 5625 spec->linear_tone_beep = 0;
5615 codec->slave_dig_outs = stac92hd83xxx_slave_dig_outs; 5626 codec->slave_dig_outs = stac92hd83xxx_slave_dig_outs;
5616 spec->digbeep_nid = 0x21; 5627 spec->digbeep_nid = 0x21;
@@ -5779,21 +5790,19 @@ static int patch_stac92hd71bxx(struct hda_codec *codec)
5779 struct sigmatel_spec *spec; 5790 struct sigmatel_spec *spec;
5780 const struct hda_verb *unmute_init = stac92hd71bxx_unmute_core_init; 5791 const struct hda_verb *unmute_init = stac92hd71bxx_unmute_core_init;
5781 unsigned int pin_cfg; 5792 unsigned int pin_cfg;
5782 int err = 0; 5793 int err;
5783 5794
5784 spec = kzalloc(sizeof(*spec), GFP_KERNEL); 5795 err = alloc_stac_spec(codec, STAC92HD71BXX_NUM_PINS,
5785 if (spec == NULL) 5796 stac92hd71bxx_pin_nids_4port);
5786 return -ENOMEM; 5797 if (err < 0)
5798 return err;
5787 5799
5788 codec->no_trigger_sense = 1; 5800 spec = codec->spec;
5789 codec->spec = spec;
5790 spec->linear_tone_beep = 0; 5801 spec->linear_tone_beep = 0;
5791 codec->patch_ops = stac92xx_patch_ops; 5802 codec->patch_ops = stac92xx_patch_ops;
5792 spec->num_pins = STAC92HD71BXX_NUM_PINS;
5793 switch (codec->vendor_id) { 5803 switch (codec->vendor_id) {
5794 case 0x111d76b6: 5804 case 0x111d76b6:
5795 case 0x111d76b7: 5805 case 0x111d76b7:
5796 spec->pin_nids = stac92hd71bxx_pin_nids_4port;
5797 break; 5806 break;
5798 case 0x111d7603: 5807 case 0x111d7603:
5799 case 0x111d7608: 5808 case 0x111d7608:
@@ -6024,15 +6033,13 @@ static int patch_stac922x(struct hda_codec *codec)
6024 struct sigmatel_spec *spec; 6033 struct sigmatel_spec *spec;
6025 int err; 6034 int err;
6026 6035
6027 spec = kzalloc(sizeof(*spec), GFP_KERNEL); 6036 err = alloc_stac_spec(codec, ARRAY_SIZE(stac922x_pin_nids),
6028 if (spec == NULL) 6037 stac922x_pin_nids);
6029 return -ENOMEM; 6038 if (err < 0)
6039 return err;
6030 6040
6031 codec->no_trigger_sense = 1; 6041 spec = codec->spec;
6032 codec->spec = spec;
6033 spec->linear_tone_beep = 1; 6042 spec->linear_tone_beep = 1;
6034 spec->num_pins = ARRAY_SIZE(stac922x_pin_nids);
6035 spec->pin_nids = stac922x_pin_nids;
6036 spec->board_config = snd_hda_check_board_config(codec, STAC_922X_MODELS, 6043 spec->board_config = snd_hda_check_board_config(codec, STAC_922X_MODELS,
6037 stac922x_models, 6044 stac922x_models,
6038 stac922x_cfg_tbl); 6045 stac922x_cfg_tbl);
@@ -6129,16 +6136,14 @@ static int patch_stac927x(struct hda_codec *codec)
6129 struct sigmatel_spec *spec; 6136 struct sigmatel_spec *spec;
6130 int err; 6137 int err;
6131 6138
6132 spec = kzalloc(sizeof(*spec), GFP_KERNEL); 6139 err = alloc_stac_spec(codec, ARRAY_SIZE(stac927x_pin_nids),
6133 if (spec == NULL) 6140 stac927x_pin_nids);
6134 return -ENOMEM; 6141 if (err < 0)
6142 return err;
6135 6143
6136 codec->no_trigger_sense = 1; 6144 spec = codec->spec;
6137 codec->spec = spec;
6138 spec->linear_tone_beep = 1; 6145 spec->linear_tone_beep = 1;
6139 codec->slave_dig_outs = stac927x_slave_dig_outs; 6146 codec->slave_dig_outs = stac927x_slave_dig_outs;
6140 spec->num_pins = ARRAY_SIZE(stac927x_pin_nids);
6141 spec->pin_nids = stac927x_pin_nids;
6142 spec->board_config = snd_hda_check_board_config(codec, STAC_927X_MODELS, 6147 spec->board_config = snd_hda_check_board_config(codec, STAC_927X_MODELS,
6143 stac927x_models, 6148 stac927x_models,
6144 stac927x_cfg_tbl); 6149 stac927x_cfg_tbl);
@@ -6265,15 +6270,13 @@ static int patch_stac9205(struct hda_codec *codec)
6265 struct sigmatel_spec *spec; 6270 struct sigmatel_spec *spec;
6266 int err; 6271 int err;
6267 6272
6268 spec = kzalloc(sizeof(*spec), GFP_KERNEL); 6273 err = alloc_stac_spec(codec, ARRAY_SIZE(stac9205_pin_nids),
6269 if (spec == NULL) 6274 stac9205_pin_nids);
6270 return -ENOMEM; 6275 if (err < 0)
6276 return err;
6271 6277
6272 codec->no_trigger_sense = 1; 6278 spec = codec->spec;
6273 codec->spec = spec;
6274 spec->linear_tone_beep = 1; 6279 spec->linear_tone_beep = 1;
6275 spec->num_pins = ARRAY_SIZE(stac9205_pin_nids);
6276 spec->pin_nids = stac9205_pin_nids;
6277 spec->board_config = snd_hda_check_board_config(codec, STAC_9205_MODELS, 6280 spec->board_config = snd_hda_check_board_config(codec, STAC_9205_MODELS,
6278 stac9205_models, 6281 stac9205_models,
6279 stac9205_cfg_tbl); 6282 stac9205_cfg_tbl);
@@ -6421,14 +6424,13 @@ static int patch_stac9872(struct hda_codec *codec)
6421 struct sigmatel_spec *spec; 6424 struct sigmatel_spec *spec;
6422 int err; 6425 int err;
6423 6426
6424 spec = kzalloc(sizeof(*spec), GFP_KERNEL); 6427 err = alloc_stac_spec(codec, ARRAY_SIZE(stac9872_pin_nids),
6425 if (spec == NULL) 6428 stac9872_pin_nids);
6426 return -ENOMEM; 6429 if (err < 0)
6427 codec->no_trigger_sense = 1; 6430 return err;
6428 codec->spec = spec; 6431
6432 spec = codec->spec;
6429 spec->linear_tone_beep = 1; 6433 spec->linear_tone_beep = 1;
6430 spec->num_pins = ARRAY_SIZE(stac9872_pin_nids);
6431 spec->pin_nids = stac9872_pin_nids;
6432 6434
6433 spec->board_config = snd_hda_check_board_config(codec, STAC_9872_MODELS, 6435 spec->board_config = snd_hda_check_board_config(codec, STAC_9872_MODELS,
6434 stac9872_models, 6436 stac9872_models,