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.c128
1 files changed, 63 insertions, 65 deletions
diff --git a/sound/pci/hda/patch_sigmatel.c b/sound/pci/hda/patch_sigmatel.c
index 1f6fd584e1c2..df13c0f84899 100644
--- a/sound/pci/hda/patch_sigmatel.c
+++ b/sound/pci/hda/patch_sigmatel.c
@@ -2811,7 +2811,6 @@ stac_control_new(struct sigmatel_spec *spec,
2811{ 2811{
2812 struct snd_kcontrol_new *knew; 2812 struct snd_kcontrol_new *knew;
2813 2813
2814 snd_array_init(&spec->kctls, sizeof(*knew), 32);
2815 knew = snd_array_new(&spec->kctls); 2814 knew = snd_array_new(&spec->kctls);
2816 if (!knew) 2815 if (!knew)
2817 return NULL; 2816 return NULL;
@@ -5159,20 +5158,34 @@ static const struct hda_codec_ops stac92xx_patch_ops = {
5159 .reboot_notify = stac92xx_shutup, 5158 .reboot_notify = stac92xx_shutup,
5160}; 5159};
5161 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
5162static int patch_stac9200(struct hda_codec *codec) 5177static int patch_stac9200(struct hda_codec *codec)
5163{ 5178{
5164 struct sigmatel_spec *spec; 5179 struct sigmatel_spec *spec;
5165 int err; 5180 int err;
5166 5181
5167 spec = kzalloc(sizeof(*spec), GFP_KERNEL); 5182 err = alloc_stac_spec(codec, ARRAY_SIZE(stac9200_pin_nids),
5168 if (spec == NULL) 5183 stac9200_pin_nids);
5169 return -ENOMEM; 5184 if (err < 0)
5185 return err;
5170 5186
5171 codec->no_trigger_sense = 1; 5187 spec = codec->spec;
5172 codec->spec = spec;
5173 spec->linear_tone_beep = 1; 5188 spec->linear_tone_beep = 1;
5174 spec->num_pins = ARRAY_SIZE(stac9200_pin_nids);
5175 spec->pin_nids = stac9200_pin_nids;
5176 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,
5177 stac9200_models, 5190 stac9200_models,
5178 stac9200_cfg_tbl); 5191 stac9200_cfg_tbl);
@@ -5228,15 +5241,13 @@ static int patch_stac925x(struct hda_codec *codec)
5228 struct sigmatel_spec *spec; 5241 struct sigmatel_spec *spec;
5229 int err; 5242 int err;
5230 5243
5231 spec = kzalloc(sizeof(*spec), GFP_KERNEL); 5244 err = alloc_stac_spec(codec, ARRAY_SIZE(stac925x_pin_nids),
5232 if (spec == NULL) 5245 stac925x_pin_nids);
5233 return -ENOMEM; 5246 if (err < 0)
5247 return err;
5234 5248
5235 codec->no_trigger_sense = 1; 5249 spec = codec->spec;
5236 codec->spec = spec;
5237 spec->linear_tone_beep = 1; 5250 spec->linear_tone_beep = 1;
5238 spec->num_pins = ARRAY_SIZE(stac925x_pin_nids);
5239 spec->pin_nids = stac925x_pin_nids;
5240 5251
5241 /* Check first for codec ID */ 5252 /* Check first for codec ID */
5242 spec->board_config = snd_hda_check_board_codec_sid_config(codec, 5253 spec->board_config = snd_hda_check_board_codec_sid_config(codec,
@@ -5311,19 +5322,17 @@ static int patch_stac92hd73xx(struct hda_codec *codec)
5311{ 5322{
5312 struct sigmatel_spec *spec; 5323 struct sigmatel_spec *spec;
5313 hda_nid_t conn[STAC92HD73_DAC_COUNT + 2]; 5324 hda_nid_t conn[STAC92HD73_DAC_COUNT + 2];
5314 int err = 0; 5325 int err;
5315 int num_dacs; 5326 int num_dacs;
5316 5327
5317 spec = kzalloc(sizeof(*spec), GFP_KERNEL); 5328 err = alloc_stac_spec(codec, ARRAY_SIZE(stac92hd73xx_pin_nids),
5318 if (spec == NULL) 5329 stac92hd73xx_pin_nids);
5319 return -ENOMEM; 5330 if (err < 0)
5331 return err;
5320 5332
5321 codec->no_trigger_sense = 1; 5333 spec = codec->spec;
5322 codec->spec = spec;
5323 spec->linear_tone_beep = 0; 5334 spec->linear_tone_beep = 0;
5324 codec->slave_dig_outs = stac92hd73xx_slave_dig_outs; 5335 codec->slave_dig_outs = stac92hd73xx_slave_dig_outs;
5325 spec->num_pins = ARRAY_SIZE(stac92hd73xx_pin_nids);
5326 spec->pin_nids = stac92hd73xx_pin_nids;
5327 spec->board_config = snd_hda_check_board_config(codec, 5336 spec->board_config = snd_hda_check_board_config(codec,
5328 STAC_92HD73XX_MODELS, 5337 STAC_92HD73XX_MODELS,
5329 stac92hd73xx_models, 5338 stac92hd73xx_models,
@@ -5600,9 +5609,9 @@ static int patch_stac92hd83xxx(struct hda_codec *codec)
5600 int default_polarity = -1; /* no default cfg */ 5609 int default_polarity = -1; /* no default cfg */
5601 int err; 5610 int err;
5602 5611
5603 spec = kzalloc(sizeof(*spec), GFP_KERNEL); 5612 err = alloc_stac_spec(codec, 0, NULL); /* pins filled later */
5604 if (spec == NULL) 5613 if (err < 0)
5605 return -ENOMEM; 5614 return err;
5606 5615
5607 if (hp_bnb2011_with_dock(codec)) { 5616 if (hp_bnb2011_with_dock(codec)) {
5608 snd_hda_codec_set_pincfg(codec, 0xa, 0x2101201f); 5617 snd_hda_codec_set_pincfg(codec, 0xa, 0x2101201f);
@@ -5610,11 +5619,9 @@ static int patch_stac92hd83xxx(struct hda_codec *codec)
5610 } 5619 }
5611 5620
5612 codec->epss = 0; /* longer delay needed for D3 */ 5621 codec->epss = 0; /* longer delay needed for D3 */
5613 codec->no_trigger_sense = 1;
5614 codec->spec = spec;
5615
5616 stac92hd8x_fill_auto_spec(codec); 5622 stac92hd8x_fill_auto_spec(codec);
5617 5623
5624 spec = codec->spec;
5618 spec->linear_tone_beep = 0; 5625 spec->linear_tone_beep = 0;
5619 codec->slave_dig_outs = stac92hd83xxx_slave_dig_outs; 5626 codec->slave_dig_outs = stac92hd83xxx_slave_dig_outs;
5620 spec->digbeep_nid = 0x21; 5627 spec->digbeep_nid = 0x21;
@@ -5783,21 +5790,19 @@ static int patch_stac92hd71bxx(struct hda_codec *codec)
5783 struct sigmatel_spec *spec; 5790 struct sigmatel_spec *spec;
5784 const struct hda_verb *unmute_init = stac92hd71bxx_unmute_core_init; 5791 const struct hda_verb *unmute_init = stac92hd71bxx_unmute_core_init;
5785 unsigned int pin_cfg; 5792 unsigned int pin_cfg;
5786 int err = 0; 5793 int err;
5787 5794
5788 spec = kzalloc(sizeof(*spec), GFP_KERNEL); 5795 err = alloc_stac_spec(codec, STAC92HD71BXX_NUM_PINS,
5789 if (spec == NULL) 5796 stac92hd71bxx_pin_nids_4port);
5790 return -ENOMEM; 5797 if (err < 0)
5798 return err;
5791 5799
5792 codec->no_trigger_sense = 1; 5800 spec = codec->spec;
5793 codec->spec = spec;
5794 spec->linear_tone_beep = 0; 5801 spec->linear_tone_beep = 0;
5795 codec->patch_ops = stac92xx_patch_ops; 5802 codec->patch_ops = stac92xx_patch_ops;
5796 spec->num_pins = STAC92HD71BXX_NUM_PINS;
5797 switch (codec->vendor_id) { 5803 switch (codec->vendor_id) {
5798 case 0x111d76b6: 5804 case 0x111d76b6:
5799 case 0x111d76b7: 5805 case 0x111d76b7:
5800 spec->pin_nids = stac92hd71bxx_pin_nids_4port;
5801 break; 5806 break;
5802 case 0x111d7603: 5807 case 0x111d7603:
5803 case 0x111d7608: 5808 case 0x111d7608:
@@ -6028,15 +6033,13 @@ static int patch_stac922x(struct hda_codec *codec)
6028 struct sigmatel_spec *spec; 6033 struct sigmatel_spec *spec;
6029 int err; 6034 int err;
6030 6035
6031 spec = kzalloc(sizeof(*spec), GFP_KERNEL); 6036 err = alloc_stac_spec(codec, ARRAY_SIZE(stac922x_pin_nids),
6032 if (spec == NULL) 6037 stac922x_pin_nids);
6033 return -ENOMEM; 6038 if (err < 0)
6039 return err;
6034 6040
6035 codec->no_trigger_sense = 1; 6041 spec = codec->spec;
6036 codec->spec = spec;
6037 spec->linear_tone_beep = 1; 6042 spec->linear_tone_beep = 1;
6038 spec->num_pins = ARRAY_SIZE(stac922x_pin_nids);
6039 spec->pin_nids = stac922x_pin_nids;
6040 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,
6041 stac922x_models, 6044 stac922x_models,
6042 stac922x_cfg_tbl); 6045 stac922x_cfg_tbl);
@@ -6133,16 +6136,14 @@ static int patch_stac927x(struct hda_codec *codec)
6133 struct sigmatel_spec *spec; 6136 struct sigmatel_spec *spec;
6134 int err; 6137 int err;
6135 6138
6136 spec = kzalloc(sizeof(*spec), GFP_KERNEL); 6139 err = alloc_stac_spec(codec, ARRAY_SIZE(stac927x_pin_nids),
6137 if (spec == NULL) 6140 stac927x_pin_nids);
6138 return -ENOMEM; 6141 if (err < 0)
6142 return err;
6139 6143
6140 codec->no_trigger_sense = 1; 6144 spec = codec->spec;
6141 codec->spec = spec;
6142 spec->linear_tone_beep = 1; 6145 spec->linear_tone_beep = 1;
6143 codec->slave_dig_outs = stac927x_slave_dig_outs; 6146 codec->slave_dig_outs = stac927x_slave_dig_outs;
6144 spec->num_pins = ARRAY_SIZE(stac927x_pin_nids);
6145 spec->pin_nids = stac927x_pin_nids;
6146 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,
6147 stac927x_models, 6148 stac927x_models,
6148 stac927x_cfg_tbl); 6149 stac927x_cfg_tbl);
@@ -6269,15 +6270,13 @@ static int patch_stac9205(struct hda_codec *codec)
6269 struct sigmatel_spec *spec; 6270 struct sigmatel_spec *spec;
6270 int err; 6271 int err;
6271 6272
6272 spec = kzalloc(sizeof(*spec), GFP_KERNEL); 6273 err = alloc_stac_spec(codec, ARRAY_SIZE(stac9205_pin_nids),
6273 if (spec == NULL) 6274 stac9205_pin_nids);
6274 return -ENOMEM; 6275 if (err < 0)
6276 return err;
6275 6277
6276 codec->no_trigger_sense = 1; 6278 spec = codec->spec;
6277 codec->spec = spec;
6278 spec->linear_tone_beep = 1; 6279 spec->linear_tone_beep = 1;
6279 spec->num_pins = ARRAY_SIZE(stac9205_pin_nids);
6280 spec->pin_nids = stac9205_pin_nids;
6281 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,
6282 stac9205_models, 6281 stac9205_models,
6283 stac9205_cfg_tbl); 6282 stac9205_cfg_tbl);
@@ -6425,14 +6424,13 @@ static int patch_stac9872(struct hda_codec *codec)
6425 struct sigmatel_spec *spec; 6424 struct sigmatel_spec *spec;
6426 int err; 6425 int err;
6427 6426
6428 spec = kzalloc(sizeof(*spec), GFP_KERNEL); 6427 err = alloc_stac_spec(codec, ARRAY_SIZE(stac9872_pin_nids),
6429 if (spec == NULL) 6428 stac9872_pin_nids);
6430 return -ENOMEM; 6429 if (err < 0)
6431 codec->no_trigger_sense = 1; 6430 return err;
6432 codec->spec = spec; 6431
6432 spec = codec->spec;
6433 spec->linear_tone_beep = 1; 6433 spec->linear_tone_beep = 1;
6434 spec->num_pins = ARRAY_SIZE(stac9872_pin_nids);
6435 spec->pin_nids = stac9872_pin_nids;
6436 6434
6437 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,
6438 stac9872_models, 6436 stac9872_models,