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.c154
1 files changed, 79 insertions, 75 deletions
diff --git a/sound/pci/hda/patch_sigmatel.c b/sound/pci/hda/patch_sigmatel.c
index 770013ff556f..a86547ca17c8 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,
@@ -1724,7 +1725,7 @@ static const struct snd_pci_quirk stac92hd83xxx_cfg_tbl[] = {
1724 SND_PCI_QUIRK(PCI_VENDOR_ID_HP, 0x1658, 1725 SND_PCI_QUIRK(PCI_VENDOR_ID_HP, 0x1658,
1725 "HP", STAC_92HD83XXX_HP_cNB11_INTQUAD), 1726 "HP", STAC_92HD83XXX_HP_cNB11_INTQUAD),
1726 SND_PCI_QUIRK(PCI_VENDOR_ID_HP, 0x1659, 1727 SND_PCI_QUIRK(PCI_VENDOR_ID_HP, 0x1659,
1727 "HP", STAC_92HD83XXX_HP_cNB11_INTQUAD), 1728 "HP Pavilion dv7", STAC_HP_DV7_4000),
1728 SND_PCI_QUIRK(PCI_VENDOR_ID_HP, 0x165A, 1729 SND_PCI_QUIRK(PCI_VENDOR_ID_HP, 0x165A,
1729 "HP", STAC_92HD83XXX_HP_cNB11_INTQUAD), 1730 "HP", STAC_92HD83XXX_HP_cNB11_INTQUAD),
1730 SND_PCI_QUIRK(PCI_VENDOR_ID_HP, 0x165B, 1731 SND_PCI_QUIRK(PCI_VENDOR_ID_HP, 0x165B,
@@ -1763,6 +1764,8 @@ static const struct snd_pci_quirk stac92hd83xxx_cfg_tbl[] = {
1763 "HP", STAC_HP_ZEPHYR), 1764 "HP", STAC_HP_ZEPHYR),
1764 SND_PCI_QUIRK(PCI_VENDOR_ID_HP, 0x3660, 1765 SND_PCI_QUIRK(PCI_VENDOR_ID_HP, 0x3660,
1765 "HP Mini", STAC_92HD83XXX_HP_LED), 1766 "HP Mini", STAC_92HD83XXX_HP_LED),
1767 SND_PCI_QUIRK(PCI_VENDOR_ID_HP, 0x144E,
1768 "HP Pavilion dv5", STAC_92HD83XXX_HP_INV_LED),
1766 {} /* terminator */ 1769 {} /* terminator */
1767}; 1770};
1768 1771
@@ -2513,6 +2516,11 @@ static int stac92xx_build_pcms(struct hda_codec *codec)
2513 info->stream[SNDRV_PCM_STREAM_PLAYBACK] = stac92xx_pcm_analog_playback; 2516 info->stream[SNDRV_PCM_STREAM_PLAYBACK] = stac92xx_pcm_analog_playback;
2514 info->stream[SNDRV_PCM_STREAM_PLAYBACK].nid = 2517 info->stream[SNDRV_PCM_STREAM_PLAYBACK].nid =
2515 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
2516 info->stream[SNDRV_PCM_STREAM_CAPTURE] = stac92xx_pcm_analog_capture; 2524 info->stream[SNDRV_PCM_STREAM_CAPTURE] = stac92xx_pcm_analog_capture;
2517 info->stream[SNDRV_PCM_STREAM_CAPTURE].nid = spec->adc_nids[0]; 2525 info->stream[SNDRV_PCM_STREAM_CAPTURE].nid = spec->adc_nids[0];
2518 info->stream[SNDRV_PCM_STREAM_CAPTURE].substreams = spec->num_adcs; 2526 info->stream[SNDRV_PCM_STREAM_CAPTURE].substreams = spec->num_adcs;
@@ -2803,7 +2811,6 @@ stac_control_new(struct sigmatel_spec *spec,
2803{ 2811{
2804 struct snd_kcontrol_new *knew; 2812 struct snd_kcontrol_new *knew;
2805 2813
2806 snd_array_init(&spec->kctls, sizeof(*knew), 32);
2807 knew = snd_array_new(&spec->kctls); 2814 knew = snd_array_new(&spec->kctls);
2808 if (!knew) 2815 if (!knew)
2809 return NULL; 2816 return NULL;
@@ -3266,9 +3273,9 @@ static int create_multi_out_ctls(struct hda_codec *codec, int num_outs,
3266 idx = i; 3273 idx = i;
3267 break; 3274 break;
3268 case AUTO_PIN_SPEAKER_OUT: 3275 case AUTO_PIN_SPEAKER_OUT:
3269 if (num_outs <= 1) { 3276 if (num_outs <= 2) {
3270 name = "Speaker"; 3277 name = i ? "Bass Speaker" : "Speaker";
3271 idx = i; 3278 idx = 0;
3272 break; 3279 break;
3273 } 3280 }
3274 /* Fall through in case of multi speaker outs */ 3281 /* Fall through in case of multi speaker outs */
@@ -4567,8 +4574,6 @@ static void stac92xx_free(struct hda_codec *codec)
4567 if (! spec) 4574 if (! spec)
4568 return; 4575 return;
4569 4576
4570 stac92xx_shutup(codec);
4571
4572 kfree(spec); 4577 kfree(spec);
4573 snd_hda_detach_beep_device(codec); 4578 snd_hda_detach_beep_device(codec);
4574} 4579}
@@ -5153,20 +5158,34 @@ static const struct hda_codec_ops stac92xx_patch_ops = {
5153 .reboot_notify = stac92xx_shutup, 5158 .reboot_notify = stac92xx_shutup,
5154}; 5159};
5155 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
5156static int patch_stac9200(struct hda_codec *codec) 5177static int patch_stac9200(struct hda_codec *codec)
5157{ 5178{
5158 struct sigmatel_spec *spec; 5179 struct sigmatel_spec *spec;
5159 int err; 5180 int err;
5160 5181
5161 spec = kzalloc(sizeof(*spec), GFP_KERNEL); 5182 err = alloc_stac_spec(codec, ARRAY_SIZE(stac9200_pin_nids),
5162 if (spec == NULL) 5183 stac9200_pin_nids);
5163 return -ENOMEM; 5184 if (err < 0)
5185 return err;
5164 5186
5165 codec->no_trigger_sense = 1; 5187 spec = codec->spec;
5166 codec->spec = spec;
5167 spec->linear_tone_beep = 1; 5188 spec->linear_tone_beep = 1;
5168 spec->num_pins = ARRAY_SIZE(stac9200_pin_nids);
5169 spec->pin_nids = stac9200_pin_nids;
5170 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,
5171 stac9200_models, 5190 stac9200_models,
5172 stac9200_cfg_tbl); 5191 stac9200_cfg_tbl);
@@ -5222,15 +5241,13 @@ static int patch_stac925x(struct hda_codec *codec)
5222 struct sigmatel_spec *spec; 5241 struct sigmatel_spec *spec;
5223 int err; 5242 int err;
5224 5243
5225 spec = kzalloc(sizeof(*spec), GFP_KERNEL); 5244 err = alloc_stac_spec(codec, ARRAY_SIZE(stac925x_pin_nids),
5226 if (spec == NULL) 5245 stac925x_pin_nids);
5227 return -ENOMEM; 5246 if (err < 0)
5247 return err;
5228 5248
5229 codec->no_trigger_sense = 1; 5249 spec = codec->spec;
5230 codec->spec = spec;
5231 spec->linear_tone_beep = 1; 5250 spec->linear_tone_beep = 1;
5232 spec->num_pins = ARRAY_SIZE(stac925x_pin_nids);
5233 spec->pin_nids = stac925x_pin_nids;
5234 5251
5235 /* Check first for codec ID */ 5252 /* Check first for codec ID */
5236 spec->board_config = snd_hda_check_board_codec_sid_config(codec, 5253 spec->board_config = snd_hda_check_board_codec_sid_config(codec,
@@ -5305,19 +5322,17 @@ static int patch_stac92hd73xx(struct hda_codec *codec)
5305{ 5322{
5306 struct sigmatel_spec *spec; 5323 struct sigmatel_spec *spec;
5307 hda_nid_t conn[STAC92HD73_DAC_COUNT + 2]; 5324 hda_nid_t conn[STAC92HD73_DAC_COUNT + 2];
5308 int err = 0; 5325 int err;
5309 int num_dacs; 5326 int num_dacs;
5310 5327
5311 spec = kzalloc(sizeof(*spec), GFP_KERNEL); 5328 err = alloc_stac_spec(codec, ARRAY_SIZE(stac92hd73xx_pin_nids),
5312 if (spec == NULL) 5329 stac92hd73xx_pin_nids);
5313 return -ENOMEM; 5330 if (err < 0)
5331 return err;
5314 5332
5315 codec->no_trigger_sense = 1; 5333 spec = codec->spec;
5316 codec->spec = spec;
5317 spec->linear_tone_beep = 0; 5334 spec->linear_tone_beep = 0;
5318 codec->slave_dig_outs = stac92hd73xx_slave_dig_outs; 5335 codec->slave_dig_outs = stac92hd73xx_slave_dig_outs;
5319 spec->num_pins = ARRAY_SIZE(stac92hd73xx_pin_nids);
5320 spec->pin_nids = stac92hd73xx_pin_nids;
5321 spec->board_config = snd_hda_check_board_config(codec, 5336 spec->board_config = snd_hda_check_board_config(codec,
5322 STAC_92HD73XX_MODELS, 5337 STAC_92HD73XX_MODELS,
5323 stac92hd73xx_models, 5338 stac92hd73xx_models,
@@ -5594,9 +5609,9 @@ static int patch_stac92hd83xxx(struct hda_codec *codec)
5594 int default_polarity = -1; /* no default cfg */ 5609 int default_polarity = -1; /* no default cfg */
5595 int err; 5610 int err;
5596 5611
5597 spec = kzalloc(sizeof(*spec), GFP_KERNEL); 5612 err = alloc_stac_spec(codec, 0, NULL); /* pins filled later */
5598 if (spec == NULL) 5613 if (err < 0)
5599 return -ENOMEM; 5614 return err;
5600 5615
5601 if (hp_bnb2011_with_dock(codec)) { 5616 if (hp_bnb2011_with_dock(codec)) {
5602 snd_hda_codec_set_pincfg(codec, 0xa, 0x2101201f); 5617 snd_hda_codec_set_pincfg(codec, 0xa, 0x2101201f);
@@ -5604,11 +5619,9 @@ static int patch_stac92hd83xxx(struct hda_codec *codec)
5604 } 5619 }
5605 5620
5606 codec->epss = 0; /* longer delay needed for D3 */ 5621 codec->epss = 0; /* longer delay needed for D3 */
5607 codec->no_trigger_sense = 1;
5608 codec->spec = spec;
5609
5610 stac92hd8x_fill_auto_spec(codec); 5622 stac92hd8x_fill_auto_spec(codec);
5611 5623
5624 spec = codec->spec;
5612 spec->linear_tone_beep = 0; 5625 spec->linear_tone_beep = 0;
5613 codec->slave_dig_outs = stac92hd83xxx_slave_dig_outs; 5626 codec->slave_dig_outs = stac92hd83xxx_slave_dig_outs;
5614 spec->digbeep_nid = 0x21; 5627 spec->digbeep_nid = 0x21;
@@ -5777,21 +5790,19 @@ static int patch_stac92hd71bxx(struct hda_codec *codec)
5777 struct sigmatel_spec *spec; 5790 struct sigmatel_spec *spec;
5778 const struct hda_verb *unmute_init = stac92hd71bxx_unmute_core_init; 5791 const struct hda_verb *unmute_init = stac92hd71bxx_unmute_core_init;
5779 unsigned int pin_cfg; 5792 unsigned int pin_cfg;
5780 int err = 0; 5793 int err;
5781 5794
5782 spec = kzalloc(sizeof(*spec), GFP_KERNEL); 5795 err = alloc_stac_spec(codec, STAC92HD71BXX_NUM_PINS,
5783 if (spec == NULL) 5796 stac92hd71bxx_pin_nids_4port);
5784 return -ENOMEM; 5797 if (err < 0)
5798 return err;
5785 5799
5786 codec->no_trigger_sense = 1; 5800 spec = codec->spec;
5787 codec->spec = spec;
5788 spec->linear_tone_beep = 0; 5801 spec->linear_tone_beep = 0;
5789 codec->patch_ops = stac92xx_patch_ops; 5802 codec->patch_ops = stac92xx_patch_ops;
5790 spec->num_pins = STAC92HD71BXX_NUM_PINS;
5791 switch (codec->vendor_id) { 5803 switch (codec->vendor_id) {
5792 case 0x111d76b6: 5804 case 0x111d76b6:
5793 case 0x111d76b7: 5805 case 0x111d76b7:
5794 spec->pin_nids = stac92hd71bxx_pin_nids_4port;
5795 break; 5806 break;
5796 case 0x111d7603: 5807 case 0x111d7603:
5797 case 0x111d7608: 5808 case 0x111d7608:
@@ -6022,15 +6033,13 @@ static int patch_stac922x(struct hda_codec *codec)
6022 struct sigmatel_spec *spec; 6033 struct sigmatel_spec *spec;
6023 int err; 6034 int err;
6024 6035
6025 spec = kzalloc(sizeof(*spec), GFP_KERNEL); 6036 err = alloc_stac_spec(codec, ARRAY_SIZE(stac922x_pin_nids),
6026 if (spec == NULL) 6037 stac922x_pin_nids);
6027 return -ENOMEM; 6038 if (err < 0)
6039 return err;
6028 6040
6029 codec->no_trigger_sense = 1; 6041 spec = codec->spec;
6030 codec->spec = spec;
6031 spec->linear_tone_beep = 1; 6042 spec->linear_tone_beep = 1;
6032 spec->num_pins = ARRAY_SIZE(stac922x_pin_nids);
6033 spec->pin_nids = stac922x_pin_nids;
6034 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,
6035 stac922x_models, 6044 stac922x_models,
6036 stac922x_cfg_tbl); 6045 stac922x_cfg_tbl);
@@ -6127,16 +6136,14 @@ static int patch_stac927x(struct hda_codec *codec)
6127 struct sigmatel_spec *spec; 6136 struct sigmatel_spec *spec;
6128 int err; 6137 int err;
6129 6138
6130 spec = kzalloc(sizeof(*spec), GFP_KERNEL); 6139 err = alloc_stac_spec(codec, ARRAY_SIZE(stac927x_pin_nids),
6131 if (spec == NULL) 6140 stac927x_pin_nids);
6132 return -ENOMEM; 6141 if (err < 0)
6142 return err;
6133 6143
6134 codec->no_trigger_sense = 1; 6144 spec = codec->spec;
6135 codec->spec = spec;
6136 spec->linear_tone_beep = 1; 6145 spec->linear_tone_beep = 1;
6137 codec->slave_dig_outs = stac927x_slave_dig_outs; 6146 codec->slave_dig_outs = stac927x_slave_dig_outs;
6138 spec->num_pins = ARRAY_SIZE(stac927x_pin_nids);
6139 spec->pin_nids = stac927x_pin_nids;
6140 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,
6141 stac927x_models, 6148 stac927x_models,
6142 stac927x_cfg_tbl); 6149 stac927x_cfg_tbl);
@@ -6263,15 +6270,13 @@ static int patch_stac9205(struct hda_codec *codec)
6263 struct sigmatel_spec *spec; 6270 struct sigmatel_spec *spec;
6264 int err; 6271 int err;
6265 6272
6266 spec = kzalloc(sizeof(*spec), GFP_KERNEL); 6273 err = alloc_stac_spec(codec, ARRAY_SIZE(stac9205_pin_nids),
6267 if (spec == NULL) 6274 stac9205_pin_nids);
6268 return -ENOMEM; 6275 if (err < 0)
6276 return err;
6269 6277
6270 codec->no_trigger_sense = 1; 6278 spec = codec->spec;
6271 codec->spec = spec;
6272 spec->linear_tone_beep = 1; 6279 spec->linear_tone_beep = 1;
6273 spec->num_pins = ARRAY_SIZE(stac9205_pin_nids);
6274 spec->pin_nids = stac9205_pin_nids;
6275 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,
6276 stac9205_models, 6281 stac9205_models,
6277 stac9205_cfg_tbl); 6282 stac9205_cfg_tbl);
@@ -6419,14 +6424,13 @@ static int patch_stac9872(struct hda_codec *codec)
6419 struct sigmatel_spec *spec; 6424 struct sigmatel_spec *spec;
6420 int err; 6425 int err;
6421 6426
6422 spec = kzalloc(sizeof(*spec), GFP_KERNEL); 6427 err = alloc_stac_spec(codec, ARRAY_SIZE(stac9872_pin_nids),
6423 if (spec == NULL) 6428 stac9872_pin_nids);
6424 return -ENOMEM; 6429 if (err < 0)
6425 codec->no_trigger_sense = 1; 6430 return err;
6426 codec->spec = spec; 6431
6432 spec = codec->spec;
6427 spec->linear_tone_beep = 1; 6433 spec->linear_tone_beep = 1;
6428 spec->num_pins = ARRAY_SIZE(stac9872_pin_nids);
6429 spec->pin_nids = stac9872_pin_nids;
6430 6434
6431 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,
6432 stac9872_models, 6436 stac9872_models,