diff options
Diffstat (limited to 'sound/pci')
-rw-r--r-- | sound/pci/asihpi/asihpi.c | 3 | ||||
-rw-r--r-- | sound/pci/hda/hda_codec.c | 35 | ||||
-rw-r--r-- | sound/pci/hda/patch_ca0132.c | 36 | ||||
-rw-r--r-- | sound/pci/hda/patch_cirrus.c | 4 | ||||
-rw-r--r-- | sound/pci/hda/patch_realtek.c | 2 | ||||
-rw-r--r-- | sound/pci/hda/patch_sigmatel.c | 29 | ||||
-rw-r--r-- | sound/pci/ice1712/ice1712.c | 2 |
7 files changed, 83 insertions, 28 deletions
diff --git a/sound/pci/asihpi/asihpi.c b/sound/pci/asihpi/asihpi.c index 3536b076b529..0aabfedeecba 100644 --- a/sound/pci/asihpi/asihpi.c +++ b/sound/pci/asihpi/asihpi.c | |||
@@ -2549,7 +2549,7 @@ static int snd_asihpi_sampleclock_add(struct snd_card_asihpi *asihpi, | |||
2549 | 2549 | ||
2550 | static int snd_card_asihpi_mixer_new(struct snd_card_asihpi *asihpi) | 2550 | static int snd_card_asihpi_mixer_new(struct snd_card_asihpi *asihpi) |
2551 | { | 2551 | { |
2552 | struct snd_card *card = asihpi->card; | 2552 | struct snd_card *card; |
2553 | unsigned int idx = 0; | 2553 | unsigned int idx = 0; |
2554 | unsigned int subindex = 0; | 2554 | unsigned int subindex = 0; |
2555 | int err; | 2555 | int err; |
@@ -2557,6 +2557,7 @@ static int snd_card_asihpi_mixer_new(struct snd_card_asihpi *asihpi) | |||
2557 | 2557 | ||
2558 | if (snd_BUG_ON(!asihpi)) | 2558 | if (snd_BUG_ON(!asihpi)) |
2559 | return -EINVAL; | 2559 | return -EINVAL; |
2560 | card = asihpi->card; | ||
2560 | strcpy(card->mixername, "Asihpi Mixer"); | 2561 | strcpy(card->mixername, "Asihpi Mixer"); |
2561 | 2562 | ||
2562 | err = | 2563 | err = |
diff --git a/sound/pci/hda/hda_codec.c b/sound/pci/hda/hda_codec.c index 04b57383e8cb..a9ebcf9e3710 100644 --- a/sound/pci/hda/hda_codec.c +++ b/sound/pci/hda/hda_codec.c | |||
@@ -494,7 +494,7 @@ static unsigned int get_num_conns(struct hda_codec *codec, hda_nid_t nid) | |||
494 | 494 | ||
495 | int snd_hda_get_num_raw_conns(struct hda_codec *codec, hda_nid_t nid) | 495 | int snd_hda_get_num_raw_conns(struct hda_codec *codec, hda_nid_t nid) |
496 | { | 496 | { |
497 | return get_num_conns(codec, nid) & AC_CLIST_LENGTH; | 497 | return snd_hda_get_raw_connections(codec, nid, NULL, 0); |
498 | } | 498 | } |
499 | 499 | ||
500 | /** | 500 | /** |
@@ -517,9 +517,6 @@ int snd_hda_get_raw_connections(struct hda_codec *codec, hda_nid_t nid, | |||
517 | hda_nid_t prev_nid; | 517 | hda_nid_t prev_nid; |
518 | int null_count = 0; | 518 | int null_count = 0; |
519 | 519 | ||
520 | if (snd_BUG_ON(!conn_list || max_conns <= 0)) | ||
521 | return -EINVAL; | ||
522 | |||
523 | parm = get_num_conns(codec, nid); | 520 | parm = get_num_conns(codec, nid); |
524 | if (!parm) | 521 | if (!parm) |
525 | return 0; | 522 | return 0; |
@@ -545,7 +542,8 @@ int snd_hda_get_raw_connections(struct hda_codec *codec, hda_nid_t nid, | |||
545 | AC_VERB_GET_CONNECT_LIST, 0); | 542 | AC_VERB_GET_CONNECT_LIST, 0); |
546 | if (parm == -1 && codec->bus->rirb_error) | 543 | if (parm == -1 && codec->bus->rirb_error) |
547 | return -EIO; | 544 | return -EIO; |
548 | conn_list[0] = parm & mask; | 545 | if (conn_list) |
546 | conn_list[0] = parm & mask; | ||
549 | return 1; | 547 | return 1; |
550 | } | 548 | } |
551 | 549 | ||
@@ -580,14 +578,20 @@ int snd_hda_get_raw_connections(struct hda_codec *codec, hda_nid_t nid, | |||
580 | continue; | 578 | continue; |
581 | } | 579 | } |
582 | for (n = prev_nid + 1; n <= val; n++) { | 580 | for (n = prev_nid + 1; n <= val; n++) { |
581 | if (conn_list) { | ||
582 | if (conns >= max_conns) | ||
583 | return -ENOSPC; | ||
584 | conn_list[conns] = n; | ||
585 | } | ||
586 | conns++; | ||
587 | } | ||
588 | } else { | ||
589 | if (conn_list) { | ||
583 | if (conns >= max_conns) | 590 | if (conns >= max_conns) |
584 | return -ENOSPC; | 591 | return -ENOSPC; |
585 | conn_list[conns++] = n; | 592 | conn_list[conns] = val; |
586 | } | 593 | } |
587 | } else { | 594 | conns++; |
588 | if (conns >= max_conns) | ||
589 | return -ENOSPC; | ||
590 | conn_list[conns++] = val; | ||
591 | } | 595 | } |
592 | prev_nid = val; | 596 | prev_nid = val; |
593 | } | 597 | } |
@@ -3334,6 +3338,8 @@ int snd_hda_create_dig_out_ctls(struct hda_codec *codec, | |||
3334 | return -EBUSY; | 3338 | return -EBUSY; |
3335 | } | 3339 | } |
3336 | spdif = snd_array_new(&codec->spdif_out); | 3340 | spdif = snd_array_new(&codec->spdif_out); |
3341 | if (!spdif) | ||
3342 | return -ENOMEM; | ||
3337 | for (dig_mix = dig_mixes; dig_mix->name; dig_mix++) { | 3343 | for (dig_mix = dig_mixes; dig_mix->name; dig_mix++) { |
3338 | kctl = snd_ctl_new1(dig_mix, codec); | 3344 | kctl = snd_ctl_new1(dig_mix, codec); |
3339 | if (!kctl) | 3345 | if (!kctl) |
@@ -3431,11 +3437,16 @@ static struct snd_kcontrol_new spdif_share_sw = { | |||
3431 | int snd_hda_create_spdif_share_sw(struct hda_codec *codec, | 3437 | int snd_hda_create_spdif_share_sw(struct hda_codec *codec, |
3432 | struct hda_multi_out *mout) | 3438 | struct hda_multi_out *mout) |
3433 | { | 3439 | { |
3440 | struct snd_kcontrol *kctl; | ||
3441 | |||
3434 | if (!mout->dig_out_nid) | 3442 | if (!mout->dig_out_nid) |
3435 | return 0; | 3443 | return 0; |
3444 | |||
3445 | kctl = snd_ctl_new1(&spdif_share_sw, mout); | ||
3446 | if (!kctl) | ||
3447 | return -ENOMEM; | ||
3436 | /* ATTENTION: here mout is passed as private_data, instead of codec */ | 3448 | /* ATTENTION: here mout is passed as private_data, instead of codec */ |
3437 | return snd_hda_ctl_add(codec, mout->dig_out_nid, | 3449 | return snd_hda_ctl_add(codec, mout->dig_out_nid, kctl); |
3438 | snd_ctl_new1(&spdif_share_sw, mout)); | ||
3439 | } | 3450 | } |
3440 | EXPORT_SYMBOL_HDA(snd_hda_create_spdif_share_sw); | 3451 | EXPORT_SYMBOL_HDA(snd_hda_create_spdif_share_sw); |
3441 | 3452 | ||
diff --git a/sound/pci/hda/patch_ca0132.c b/sound/pci/hda/patch_ca0132.c index db02c1e96b08..0792b5725f9c 100644 --- a/sound/pci/hda/patch_ca0132.c +++ b/sound/pci/hda/patch_ca0132.c | |||
@@ -2298,6 +2298,11 @@ static int dspxfr_one_seg(struct hda_codec *codec, | |||
2298 | hda_frame_size_words = ((sample_rate_div == 0) ? 0 : | 2298 | hda_frame_size_words = ((sample_rate_div == 0) ? 0 : |
2299 | (num_chans * sample_rate_mul / sample_rate_div)); | 2299 | (num_chans * sample_rate_mul / sample_rate_div)); |
2300 | 2300 | ||
2301 | if (hda_frame_size_words == 0) { | ||
2302 | snd_printdd(KERN_ERR "frmsz zero\n"); | ||
2303 | return -EINVAL; | ||
2304 | } | ||
2305 | |||
2301 | buffer_size_words = min(buffer_size_words, | 2306 | buffer_size_words = min(buffer_size_words, |
2302 | (unsigned int)(UC_RANGE(chip_addx, 1) ? | 2307 | (unsigned int)(UC_RANGE(chip_addx, 1) ? |
2303 | 65536 : 32768)); | 2308 | 65536 : 32768)); |
@@ -2308,8 +2313,7 @@ static int dspxfr_one_seg(struct hda_codec *codec, | |||
2308 | chip_addx, hda_frame_size_words, num_chans, | 2313 | chip_addx, hda_frame_size_words, num_chans, |
2309 | sample_rate_mul, sample_rate_div, buffer_size_words); | 2314 | sample_rate_mul, sample_rate_div, buffer_size_words); |
2310 | 2315 | ||
2311 | if ((buffer_addx == NULL) || (hda_frame_size_words == 0) || | 2316 | if (buffer_size_words < hda_frame_size_words) { |
2312 | (buffer_size_words < hda_frame_size_words)) { | ||
2313 | snd_printdd(KERN_ERR "dspxfr_one_seg:failed\n"); | 2317 | snd_printdd(KERN_ERR "dspxfr_one_seg:failed\n"); |
2314 | return -EINVAL; | 2318 | return -EINVAL; |
2315 | } | 2319 | } |
@@ -3235,7 +3239,7 @@ static int ca0132_set_vipsource(struct hda_codec *codec, int val) | |||
3235 | struct ca0132_spec *spec = codec->spec; | 3239 | struct ca0132_spec *spec = codec->spec; |
3236 | unsigned int tmp; | 3240 | unsigned int tmp; |
3237 | 3241 | ||
3238 | if (!dspload_is_loaded(codec)) | 3242 | if (spec->dsp_state != DSP_DOWNLOADED) |
3239 | return 0; | 3243 | return 0; |
3240 | 3244 | ||
3241 | /* if CrystalVoice if off, vipsource should be 0 */ | 3245 | /* if CrystalVoice if off, vipsource should be 0 */ |
@@ -4263,11 +4267,12 @@ static void ca0132_refresh_widget_caps(struct hda_codec *codec) | |||
4263 | */ | 4267 | */ |
4264 | static void ca0132_setup_defaults(struct hda_codec *codec) | 4268 | static void ca0132_setup_defaults(struct hda_codec *codec) |
4265 | { | 4269 | { |
4270 | struct ca0132_spec *spec = codec->spec; | ||
4266 | unsigned int tmp; | 4271 | unsigned int tmp; |
4267 | int num_fx; | 4272 | int num_fx; |
4268 | int idx, i; | 4273 | int idx, i; |
4269 | 4274 | ||
4270 | if (!dspload_is_loaded(codec)) | 4275 | if (spec->dsp_state != DSP_DOWNLOADED) |
4271 | return; | 4276 | return; |
4272 | 4277 | ||
4273 | /* out, in effects + voicefx */ | 4278 | /* out, in effects + voicefx */ |
@@ -4347,12 +4352,16 @@ static bool ca0132_download_dsp_images(struct hda_codec *codec) | |||
4347 | return false; | 4352 | return false; |
4348 | 4353 | ||
4349 | dsp_os_image = (struct dsp_image_seg *)(fw_entry->data); | 4354 | dsp_os_image = (struct dsp_image_seg *)(fw_entry->data); |
4350 | dspload_image(codec, dsp_os_image, 0, 0, true, 0); | 4355 | if (dspload_image(codec, dsp_os_image, 0, 0, true, 0)) { |
4356 | pr_err("ca0132 dspload_image failed.\n"); | ||
4357 | goto exit_download; | ||
4358 | } | ||
4359 | |||
4351 | dsp_loaded = dspload_wait_loaded(codec); | 4360 | dsp_loaded = dspload_wait_loaded(codec); |
4352 | 4361 | ||
4362 | exit_download: | ||
4353 | release_firmware(fw_entry); | 4363 | release_firmware(fw_entry); |
4354 | 4364 | ||
4355 | |||
4356 | return dsp_loaded; | 4365 | return dsp_loaded; |
4357 | } | 4366 | } |
4358 | 4367 | ||
@@ -4363,16 +4372,13 @@ static void ca0132_download_dsp(struct hda_codec *codec) | |||
4363 | #ifndef CONFIG_SND_HDA_CODEC_CA0132_DSP | 4372 | #ifndef CONFIG_SND_HDA_CODEC_CA0132_DSP |
4364 | return; /* NOP */ | 4373 | return; /* NOP */ |
4365 | #endif | 4374 | #endif |
4366 | spec->dsp_state = DSP_DOWNLOAD_INIT; | ||
4367 | 4375 | ||
4368 | if (spec->dsp_state == DSP_DOWNLOAD_INIT) { | 4376 | chipio_enable_clocks(codec); |
4369 | chipio_enable_clocks(codec); | 4377 | spec->dsp_state = DSP_DOWNLOADING; |
4370 | spec->dsp_state = DSP_DOWNLOADING; | 4378 | if (!ca0132_download_dsp_images(codec)) |
4371 | if (!ca0132_download_dsp_images(codec)) | 4379 | spec->dsp_state = DSP_DOWNLOAD_FAILED; |
4372 | spec->dsp_state = DSP_DOWNLOAD_FAILED; | 4380 | else |
4373 | else | 4381 | spec->dsp_state = DSP_DOWNLOADED; |
4374 | spec->dsp_state = DSP_DOWNLOADED; | ||
4375 | } | ||
4376 | 4382 | ||
4377 | if (spec->dsp_state == DSP_DOWNLOADED) | 4383 | if (spec->dsp_state == DSP_DOWNLOADED) |
4378 | ca0132_set_dsp_msr(codec, true); | 4384 | ca0132_set_dsp_msr(codec, true); |
diff --git a/sound/pci/hda/patch_cirrus.c b/sound/pci/hda/patch_cirrus.c index 72ebb8a36b13..60d08f669f0c 100644 --- a/sound/pci/hda/patch_cirrus.c +++ b/sound/pci/hda/patch_cirrus.c | |||
@@ -506,6 +506,8 @@ static int patch_cs420x(struct hda_codec *codec) | |||
506 | if (!spec) | 506 | if (!spec) |
507 | return -ENOMEM; | 507 | return -ENOMEM; |
508 | 508 | ||
509 | spec->gen.automute_hook = cs_automute; | ||
510 | |||
509 | snd_hda_pick_fixup(codec, cs420x_models, cs420x_fixup_tbl, | 511 | snd_hda_pick_fixup(codec, cs420x_models, cs420x_fixup_tbl, |
510 | cs420x_fixups); | 512 | cs420x_fixups); |
511 | snd_hda_apply_fixup(codec, HDA_FIXUP_ACT_PRE_PROBE); | 513 | snd_hda_apply_fixup(codec, HDA_FIXUP_ACT_PRE_PROBE); |
@@ -893,6 +895,8 @@ static int patch_cs4210(struct hda_codec *codec) | |||
893 | if (!spec) | 895 | if (!spec) |
894 | return -ENOMEM; | 896 | return -ENOMEM; |
895 | 897 | ||
898 | spec->gen.automute_hook = cs_automute; | ||
899 | |||
896 | snd_hda_pick_fixup(codec, cs421x_models, cs421x_fixup_tbl, | 900 | snd_hda_pick_fixup(codec, cs421x_models, cs421x_fixup_tbl, |
897 | cs421x_fixups); | 901 | cs421x_fixups); |
898 | snd_hda_apply_fixup(codec, HDA_FIXUP_ACT_PRE_PROBE); | 902 | snd_hda_apply_fixup(codec, HDA_FIXUP_ACT_PRE_PROBE); |
diff --git a/sound/pci/hda/patch_realtek.c b/sound/pci/hda/patch_realtek.c index 2d4237bc0d8e..563c24df4d6f 100644 --- a/sound/pci/hda/patch_realtek.c +++ b/sound/pci/hda/patch_realtek.c | |||
@@ -3163,6 +3163,7 @@ static int patch_alc269(struct hda_codec *codec) | |||
3163 | case 0x10ec0290: | 3163 | case 0x10ec0290: |
3164 | spec->codec_variant = ALC269_TYPE_ALC280; | 3164 | spec->codec_variant = ALC269_TYPE_ALC280; |
3165 | break; | 3165 | break; |
3166 | case 0x10ec0233: | ||
3166 | case 0x10ec0282: | 3167 | case 0x10ec0282: |
3167 | case 0x10ec0283: | 3168 | case 0x10ec0283: |
3168 | spec->codec_variant = ALC269_TYPE_ALC282; | 3169 | spec->codec_variant = ALC269_TYPE_ALC282; |
@@ -3862,6 +3863,7 @@ static int patch_alc680(struct hda_codec *codec) | |||
3862 | */ | 3863 | */ |
3863 | static const struct hda_codec_preset snd_hda_preset_realtek[] = { | 3864 | static const struct hda_codec_preset snd_hda_preset_realtek[] = { |
3864 | { .id = 0x10ec0221, .name = "ALC221", .patch = patch_alc269 }, | 3865 | { .id = 0x10ec0221, .name = "ALC221", .patch = patch_alc269 }, |
3866 | { .id = 0x10ec0233, .name = "ALC233", .patch = patch_alc269 }, | ||
3865 | { .id = 0x10ec0260, .name = "ALC260", .patch = patch_alc260 }, | 3867 | { .id = 0x10ec0260, .name = "ALC260", .patch = patch_alc260 }, |
3866 | { .id = 0x10ec0262, .name = "ALC262", .patch = patch_alc262 }, | 3868 | { .id = 0x10ec0262, .name = "ALC262", .patch = patch_alc262 }, |
3867 | { .id = 0x10ec0267, .name = "ALC267", .patch = patch_alc268 }, | 3869 | { .id = 0x10ec0267, .name = "ALC267", .patch = patch_alc268 }, |
diff --git a/sound/pci/hda/patch_sigmatel.c b/sound/pci/hda/patch_sigmatel.c index 83d5335ac348..dafe04ae8c72 100644 --- a/sound/pci/hda/patch_sigmatel.c +++ b/sound/pci/hda/patch_sigmatel.c | |||
@@ -815,6 +815,29 @@ static int find_mute_led_cfg(struct hda_codec *codec, int default_polarity) | |||
815 | return 0; | 815 | return 0; |
816 | } | 816 | } |
817 | 817 | ||
818 | /* check whether a built-in speaker is included in parsed pins */ | ||
819 | static bool has_builtin_speaker(struct hda_codec *codec) | ||
820 | { | ||
821 | struct sigmatel_spec *spec = codec->spec; | ||
822 | hda_nid_t *nid_pin; | ||
823 | int nids, i; | ||
824 | |||
825 | if (spec->gen.autocfg.line_out_type == AUTO_PIN_SPEAKER_OUT) { | ||
826 | nid_pin = spec->gen.autocfg.line_out_pins; | ||
827 | nids = spec->gen.autocfg.line_outs; | ||
828 | } else { | ||
829 | nid_pin = spec->gen.autocfg.speaker_pins; | ||
830 | nids = spec->gen.autocfg.speaker_outs; | ||
831 | } | ||
832 | |||
833 | for (i = 0; i < nids; i++) { | ||
834 | unsigned int def_conf = snd_hda_codec_get_pincfg(codec, nid_pin[i]); | ||
835 | if (snd_hda_get_input_pin_attr(def_conf) == INPUT_PIN_ATTR_INT) | ||
836 | return true; | ||
837 | } | ||
838 | return false; | ||
839 | } | ||
840 | |||
818 | /* | 841 | /* |
819 | * PC beep controls | 842 | * PC beep controls |
820 | */ | 843 | */ |
@@ -3890,6 +3913,12 @@ static int patch_stac92hd73xx(struct hda_codec *codec) | |||
3890 | return err; | 3913 | return err; |
3891 | } | 3914 | } |
3892 | 3915 | ||
3916 | /* Don't GPIO-mute speakers if there are no internal speakers, because | ||
3917 | * the GPIO might be necessary for Headphone | ||
3918 | */ | ||
3919 | if (spec->eapd_switch && !has_builtin_speaker(codec)) | ||
3920 | spec->eapd_switch = 0; | ||
3921 | |||
3893 | codec->proc_widget_hook = stac92hd7x_proc_hook; | 3922 | codec->proc_widget_hook = stac92hd7x_proc_hook; |
3894 | 3923 | ||
3895 | snd_hda_apply_fixup(codec, HDA_FIXUP_ACT_PROBE); | 3924 | snd_hda_apply_fixup(codec, HDA_FIXUP_ACT_PROBE); |
diff --git a/sound/pci/ice1712/ice1712.c b/sound/pci/ice1712/ice1712.c index 2ffdc35d5ffd..806407a3973e 100644 --- a/sound/pci/ice1712/ice1712.c +++ b/sound/pci/ice1712/ice1712.c | |||
@@ -2594,6 +2594,8 @@ static int snd_ice1712_create(struct snd_card *card, | |||
2594 | snd_ice1712_proc_init(ice); | 2594 | snd_ice1712_proc_init(ice); |
2595 | synchronize_irq(pci->irq); | 2595 | synchronize_irq(pci->irq); |
2596 | 2596 | ||
2597 | card->private_data = ice; | ||
2598 | |||
2597 | err = pci_request_regions(pci, "ICE1712"); | 2599 | err = pci_request_regions(pci, "ICE1712"); |
2598 | if (err < 0) { | 2600 | if (err < 0) { |
2599 | kfree(ice); | 2601 | kfree(ice); |