diff options
Diffstat (limited to 'sound/pci/hda')
-rw-r--r-- | sound/pci/hda/Makefile | 2 | ||||
-rw-r--r-- | sound/pci/hda/hda_codec.c | 201 | ||||
-rw-r--r-- | sound/pci/hda/hda_codec.h | 13 | ||||
-rw-r--r-- | sound/pci/hda/hda_generic.c | 4 | ||||
-rw-r--r-- | sound/pci/hda/hda_intel.c | 459 | ||||
-rw-r--r-- | sound/pci/hda/hda_local.h | 20 | ||||
-rw-r--r-- | sound/pci/hda/hda_patch.h | 28 | ||||
-rw-r--r-- | sound/pci/hda/patch_analog.c | 581 | ||||
-rw-r--r-- | sound/pci/hda/patch_atihdmi.c | 8 | ||||
-rw-r--r-- | sound/pci/hda/patch_cmedia.c | 13 | ||||
-rw-r--r-- | sound/pci/hda/patch_conexant.c | 68 | ||||
-rw-r--r-- | sound/pci/hda/patch_realtek.c | 1248 | ||||
-rw-r--r-- | sound/pci/hda/patch_si3054.c | 4 | ||||
-rw-r--r-- | sound/pci/hda/patch_sigmatel.c | 391 | ||||
-rw-r--r-- | sound/pci/hda/patch_via.c | 14 | ||||
-rw-r--r-- | sound/pci/hda/vmaster.c | 364 |
16 files changed, 2246 insertions, 1172 deletions
diff --git a/sound/pci/hda/Makefile b/sound/pci/hda/Makefile index 9e0d8a1268aa..ab0c726d648e 100644 --- a/sound/pci/hda/Makefile +++ b/sound/pci/hda/Makefile | |||
@@ -2,7 +2,7 @@ snd-hda-intel-y := hda_intel.o | |||
2 | # since snd-hda-intel is the only driver using hda-codec, | 2 | # since snd-hda-intel is the only driver using hda-codec, |
3 | # merge it into a single module although it was originally | 3 | # merge it into a single module although it was originally |
4 | # designed to be individual modules | 4 | # designed to be individual modules |
5 | snd-hda-intel-y += hda_codec.o vmaster.o | 5 | snd-hda-intel-y += hda_codec.o |
6 | snd-hda-intel-$(CONFIG_PROC_FS) += hda_proc.o | 6 | snd-hda-intel-$(CONFIG_PROC_FS) += hda_proc.o |
7 | snd-hda-intel-$(CONFIG_SND_HDA_HWDEP) += hda_hwdep.o | 7 | snd-hda-intel-$(CONFIG_SND_HDA_HWDEP) += hda_hwdep.o |
8 | snd-hda-intel-$(CONFIG_SND_HDA_GENERIC) += hda_generic.o | 8 | snd-hda-intel-$(CONFIG_SND_HDA_GENERIC) += hda_generic.o |
diff --git a/sound/pci/hda/hda_codec.c b/sound/pci/hda/hda_codec.c index 37c413923db8..a6be6e3e8716 100644 --- a/sound/pci/hda/hda_codec.c +++ b/sound/pci/hda/hda_codec.c | |||
@@ -31,6 +31,7 @@ | |||
31 | #include <sound/initval.h> | 31 | #include <sound/initval.h> |
32 | #include "hda_local.h" | 32 | #include "hda_local.h" |
33 | #include <sound/hda_hwdep.h> | 33 | #include <sound/hda_hwdep.h> |
34 | #include "hda_patch.h" /* codec presets */ | ||
34 | 35 | ||
35 | #ifdef CONFIG_SND_HDA_POWER_SAVE | 36 | #ifdef CONFIG_SND_HDA_POWER_SAVE |
36 | /* define this option here to hide as static */ | 37 | /* define this option here to hide as static */ |
@@ -51,21 +52,50 @@ struct hda_vendor_id { | |||
51 | 52 | ||
52 | /* codec vendor labels */ | 53 | /* codec vendor labels */ |
53 | static struct hda_vendor_id hda_vendor_ids[] = { | 54 | static struct hda_vendor_id hda_vendor_ids[] = { |
54 | { 0x10ec, "Realtek" }, | 55 | { 0x1002, "ATI" }, |
55 | { 0x1057, "Motorola" }, | 56 | { 0x1057, "Motorola" }, |
57 | { 0x1095, "Silicon Image" }, | ||
58 | { 0x10ec, "Realtek" }, | ||
56 | { 0x1106, "VIA" }, | 59 | { 0x1106, "VIA" }, |
57 | { 0x111d, "IDT" }, | 60 | { 0x111d, "IDT" }, |
61 | { 0x11c1, "LSI" }, | ||
58 | { 0x11d4, "Analog Devices" }, | 62 | { 0x11d4, "Analog Devices" }, |
59 | { 0x13f6, "C-Media" }, | 63 | { 0x13f6, "C-Media" }, |
60 | { 0x14f1, "Conexant" }, | 64 | { 0x14f1, "Conexant" }, |
65 | { 0x17e8, "Chrontel" }, | ||
66 | { 0x1854, "LG" }, | ||
61 | { 0x434d, "C-Media" }, | 67 | { 0x434d, "C-Media" }, |
62 | { 0x8384, "SigmaTel" }, | 68 | { 0x8384, "SigmaTel" }, |
63 | {} /* terminator */ | 69 | {} /* terminator */ |
64 | }; | 70 | }; |
65 | 71 | ||
66 | /* codec presets */ | 72 | static const struct hda_codec_preset *hda_preset_tables[] = { |
67 | #include "hda_patch.h" | 73 | #ifdef CONFIG_SND_HDA_CODEC_REALTEK |
68 | 74 | snd_hda_preset_realtek, | |
75 | #endif | ||
76 | #ifdef CONFIG_SND_HDA_CODEC_CMEDIA | ||
77 | snd_hda_preset_cmedia, | ||
78 | #endif | ||
79 | #ifdef CONFIG_SND_HDA_CODEC_ANALOG | ||
80 | snd_hda_preset_analog, | ||
81 | #endif | ||
82 | #ifdef CONFIG_SND_HDA_CODEC_SIGMATEL | ||
83 | snd_hda_preset_sigmatel, | ||
84 | #endif | ||
85 | #ifdef CONFIG_SND_HDA_CODEC_SI3054 | ||
86 | snd_hda_preset_si3054, | ||
87 | #endif | ||
88 | #ifdef CONFIG_SND_HDA_CODEC_ATIHDMI | ||
89 | snd_hda_preset_atihdmi, | ||
90 | #endif | ||
91 | #ifdef CONFIG_SND_HDA_CODEC_CONEXANT | ||
92 | snd_hda_preset_conexant, | ||
93 | #endif | ||
94 | #ifdef CONFIG_SND_HDA_CODEC_VIA | ||
95 | snd_hda_preset_via, | ||
96 | #endif | ||
97 | NULL | ||
98 | }; | ||
69 | 99 | ||
70 | #ifdef CONFIG_SND_HDA_POWER_SAVE | 100 | #ifdef CONFIG_SND_HDA_POWER_SAVE |
71 | static void hda_power_work(struct work_struct *work); | 101 | static void hda_power_work(struct work_struct *work); |
@@ -690,6 +720,19 @@ void snd_hda_codec_setup_stream(struct hda_codec *codec, hda_nid_t nid, | |||
690 | snd_hda_codec_write(codec, nid, 0, AC_VERB_SET_STREAM_FORMAT, format); | 720 | snd_hda_codec_write(codec, nid, 0, AC_VERB_SET_STREAM_FORMAT, format); |
691 | } | 721 | } |
692 | 722 | ||
723 | void snd_hda_codec_cleanup_stream(struct hda_codec *codec, hda_nid_t nid) | ||
724 | { | ||
725 | if (!nid) | ||
726 | return; | ||
727 | |||
728 | snd_printdd("hda_codec_cleanup_stream: NID=0x%x\n", nid); | ||
729 | snd_hda_codec_write(codec, nid, 0, AC_VERB_SET_CHANNEL_STREAMID, 0); | ||
730 | #if 0 /* keep the format */ | ||
731 | msleep(1); | ||
732 | snd_hda_codec_write(codec, nid, 0, AC_VERB_SET_STREAM_FORMAT, 0); | ||
733 | #endif | ||
734 | } | ||
735 | |||
693 | /* | 736 | /* |
694 | * amp access functions | 737 | * amp access functions |
695 | */ | 738 | */ |
@@ -1037,16 +1080,24 @@ void snd_hda_set_vmaster_tlv(struct hda_codec *codec, hda_nid_t nid, int dir, | |||
1037 | } | 1080 | } |
1038 | 1081 | ||
1039 | /* find a mixer control element with the given name */ | 1082 | /* find a mixer control element with the given name */ |
1040 | struct snd_kcontrol *snd_hda_find_mixer_ctl(struct hda_codec *codec, | 1083 | static struct snd_kcontrol * |
1041 | const char *name) | 1084 | _snd_hda_find_mixer_ctl(struct hda_codec *codec, |
1085 | const char *name, int idx) | ||
1042 | { | 1086 | { |
1043 | struct snd_ctl_elem_id id; | 1087 | struct snd_ctl_elem_id id; |
1044 | memset(&id, 0, sizeof(id)); | 1088 | memset(&id, 0, sizeof(id)); |
1045 | id.iface = SNDRV_CTL_ELEM_IFACE_MIXER; | 1089 | id.iface = SNDRV_CTL_ELEM_IFACE_MIXER; |
1090 | id.index = idx; | ||
1046 | strcpy(id.name, name); | 1091 | strcpy(id.name, name); |
1047 | return snd_ctl_find_id(codec->bus->card, &id); | 1092 | return snd_ctl_find_id(codec->bus->card, &id); |
1048 | } | 1093 | } |
1049 | 1094 | ||
1095 | struct snd_kcontrol *snd_hda_find_mixer_ctl(struct hda_codec *codec, | ||
1096 | const char *name) | ||
1097 | { | ||
1098 | return _snd_hda_find_mixer_ctl(codec, name, 0); | ||
1099 | } | ||
1100 | |||
1050 | /* create a virtual master control and add slaves */ | 1101 | /* create a virtual master control and add slaves */ |
1051 | int snd_hda_add_vmaster(struct hda_codec *codec, char *name, | 1102 | int snd_hda_add_vmaster(struct hda_codec *codec, char *name, |
1052 | unsigned int *tlv, const char **slaves) | 1103 | unsigned int *tlv, const char **slaves) |
@@ -1481,6 +1532,8 @@ static struct snd_kcontrol_new dig_mixes[] = { | |||
1481 | { } /* end */ | 1532 | { } /* end */ |
1482 | }; | 1533 | }; |
1483 | 1534 | ||
1535 | #define SPDIF_MAX_IDX 4 /* 4 instances should be enough to probe */ | ||
1536 | |||
1484 | /** | 1537 | /** |
1485 | * snd_hda_create_spdif_out_ctls - create Output SPDIF-related controls | 1538 | * snd_hda_create_spdif_out_ctls - create Output SPDIF-related controls |
1486 | * @codec: the HDA codec | 1539 | * @codec: the HDA codec |
@@ -1496,9 +1549,20 @@ int snd_hda_create_spdif_out_ctls(struct hda_codec *codec, hda_nid_t nid) | |||
1496 | int err; | 1549 | int err; |
1497 | struct snd_kcontrol *kctl; | 1550 | struct snd_kcontrol *kctl; |
1498 | struct snd_kcontrol_new *dig_mix; | 1551 | struct snd_kcontrol_new *dig_mix; |
1552 | int idx; | ||
1499 | 1553 | ||
1554 | for (idx = 0; idx < SPDIF_MAX_IDX; idx++) { | ||
1555 | if (!_snd_hda_find_mixer_ctl(codec, "IEC958 Playback Switch", | ||
1556 | idx)) | ||
1557 | break; | ||
1558 | } | ||
1559 | if (idx >= SPDIF_MAX_IDX) { | ||
1560 | printk(KERN_ERR "hda_codec: too many IEC958 outputs\n"); | ||
1561 | return -EBUSY; | ||
1562 | } | ||
1500 | for (dig_mix = dig_mixes; dig_mix->name; dig_mix++) { | 1563 | for (dig_mix = dig_mixes; dig_mix->name; dig_mix++) { |
1501 | kctl = snd_ctl_new1(dig_mix, codec); | 1564 | kctl = snd_ctl_new1(dig_mix, codec); |
1565 | kctl->id.index = idx; | ||
1502 | kctl->private_value = nid; | 1566 | kctl->private_value = nid; |
1503 | err = snd_ctl_add(codec->bus->card, kctl); | 1567 | err = snd_ctl_add(codec->bus->card, kctl); |
1504 | if (err < 0) | 1568 | if (err < 0) |
@@ -1512,6 +1576,43 @@ int snd_hda_create_spdif_out_ctls(struct hda_codec *codec, hda_nid_t nid) | |||
1512 | } | 1576 | } |
1513 | 1577 | ||
1514 | /* | 1578 | /* |
1579 | * SPDIF sharing with analog output | ||
1580 | */ | ||
1581 | static int spdif_share_sw_get(struct snd_kcontrol *kcontrol, | ||
1582 | struct snd_ctl_elem_value *ucontrol) | ||
1583 | { | ||
1584 | struct hda_multi_out *mout = snd_kcontrol_chip(kcontrol); | ||
1585 | ucontrol->value.integer.value[0] = mout->share_spdif; | ||
1586 | return 0; | ||
1587 | } | ||
1588 | |||
1589 | static int spdif_share_sw_put(struct snd_kcontrol *kcontrol, | ||
1590 | struct snd_ctl_elem_value *ucontrol) | ||
1591 | { | ||
1592 | struct hda_multi_out *mout = snd_kcontrol_chip(kcontrol); | ||
1593 | mout->share_spdif = !!ucontrol->value.integer.value[0]; | ||
1594 | return 0; | ||
1595 | } | ||
1596 | |||
1597 | static struct snd_kcontrol_new spdif_share_sw = { | ||
1598 | .iface = SNDRV_CTL_ELEM_IFACE_MIXER, | ||
1599 | .name = "IEC958 Default PCM Playback Switch", | ||
1600 | .info = snd_ctl_boolean_mono_info, | ||
1601 | .get = spdif_share_sw_get, | ||
1602 | .put = spdif_share_sw_put, | ||
1603 | }; | ||
1604 | |||
1605 | int snd_hda_create_spdif_share_sw(struct hda_codec *codec, | ||
1606 | struct hda_multi_out *mout) | ||
1607 | { | ||
1608 | if (!mout->dig_out_nid) | ||
1609 | return 0; | ||
1610 | /* ATTENTION: here mout is passed as private_data, instead of codec */ | ||
1611 | return snd_ctl_add(codec->bus->card, | ||
1612 | snd_ctl_new1(&spdif_share_sw, mout)); | ||
1613 | } | ||
1614 | |||
1615 | /* | ||
1515 | * SPDIF input | 1616 | * SPDIF input |
1516 | */ | 1617 | */ |
1517 | 1618 | ||
@@ -1595,7 +1696,17 @@ int snd_hda_create_spdif_in_ctls(struct hda_codec *codec, hda_nid_t nid) | |||
1595 | int err; | 1696 | int err; |
1596 | struct snd_kcontrol *kctl; | 1697 | struct snd_kcontrol *kctl; |
1597 | struct snd_kcontrol_new *dig_mix; | 1698 | struct snd_kcontrol_new *dig_mix; |
1699 | int idx; | ||
1598 | 1700 | ||
1701 | for (idx = 0; idx < SPDIF_MAX_IDX; idx++) { | ||
1702 | if (!_snd_hda_find_mixer_ctl(codec, "IEC958 Capture Switch", | ||
1703 | idx)) | ||
1704 | break; | ||
1705 | } | ||
1706 | if (idx >= SPDIF_MAX_IDX) { | ||
1707 | printk(KERN_ERR "hda_codec: too many IEC958 inputs\n"); | ||
1708 | return -EBUSY; | ||
1709 | } | ||
1599 | for (dig_mix = dig_in_ctls; dig_mix->name; dig_mix++) { | 1710 | for (dig_mix = dig_in_ctls; dig_mix->name; dig_mix++) { |
1600 | kctl = snd_ctl_new1(dig_mix, codec); | 1711 | kctl = snd_ctl_new1(dig_mix, codec); |
1601 | kctl->private_value = nid; | 1712 | kctl->private_value = nid; |
@@ -2106,7 +2217,7 @@ static int hda_pcm_default_cleanup(struct hda_pcm_stream *hinfo, | |||
2106 | struct hda_codec *codec, | 2217 | struct hda_codec *codec, |
2107 | struct snd_pcm_substream *substream) | 2218 | struct snd_pcm_substream *substream) |
2108 | { | 2219 | { |
2109 | snd_hda_codec_setup_stream(codec, hinfo->nid, 0, 0, 0); | 2220 | snd_hda_codec_cleanup_stream(codec, hinfo->nid); |
2110 | return 0; | 2221 | return 0; |
2111 | } | 2222 | } |
2112 | 2223 | ||
@@ -2491,7 +2602,7 @@ int snd_hda_multi_out_dig_open(struct hda_codec *codec, | |||
2491 | mutex_lock(&codec->spdif_mutex); | 2602 | mutex_lock(&codec->spdif_mutex); |
2492 | if (mout->dig_out_used == HDA_DIG_ANALOG_DUP) | 2603 | if (mout->dig_out_used == HDA_DIG_ANALOG_DUP) |
2493 | /* already opened as analog dup; reset it once */ | 2604 | /* already opened as analog dup; reset it once */ |
2494 | snd_hda_codec_setup_stream(codec, mout->dig_out_nid, 0, 0, 0); | 2605 | snd_hda_codec_cleanup_stream(codec, mout->dig_out_nid); |
2495 | mout->dig_out_used = HDA_DIG_EXCLUSIVE; | 2606 | mout->dig_out_used = HDA_DIG_EXCLUSIVE; |
2496 | mutex_unlock(&codec->spdif_mutex); | 2607 | mutex_unlock(&codec->spdif_mutex); |
2497 | return 0; | 2608 | return 0; |
@@ -2526,9 +2637,36 @@ int snd_hda_multi_out_dig_close(struct hda_codec *codec, | |||
2526 | */ | 2637 | */ |
2527 | int snd_hda_multi_out_analog_open(struct hda_codec *codec, | 2638 | int snd_hda_multi_out_analog_open(struct hda_codec *codec, |
2528 | struct hda_multi_out *mout, | 2639 | struct hda_multi_out *mout, |
2529 | struct snd_pcm_substream *substream) | 2640 | struct snd_pcm_substream *substream, |
2530 | { | 2641 | struct hda_pcm_stream *hinfo) |
2531 | substream->runtime->hw.channels_max = mout->max_channels; | 2642 | { |
2643 | struct snd_pcm_runtime *runtime = substream->runtime; | ||
2644 | runtime->hw.channels_max = mout->max_channels; | ||
2645 | if (mout->dig_out_nid) { | ||
2646 | if (!mout->analog_rates) { | ||
2647 | mout->analog_rates = hinfo->rates; | ||
2648 | mout->analog_formats = hinfo->formats; | ||
2649 | mout->analog_maxbps = hinfo->maxbps; | ||
2650 | } else { | ||
2651 | runtime->hw.rates = mout->analog_rates; | ||
2652 | runtime->hw.formats = mout->analog_formats; | ||
2653 | hinfo->maxbps = mout->analog_maxbps; | ||
2654 | } | ||
2655 | if (!mout->spdif_rates) { | ||
2656 | snd_hda_query_supported_pcm(codec, mout->dig_out_nid, | ||
2657 | &mout->spdif_rates, | ||
2658 | &mout->spdif_formats, | ||
2659 | &mout->spdif_maxbps); | ||
2660 | } | ||
2661 | mutex_lock(&codec->spdif_mutex); | ||
2662 | if (mout->share_spdif) { | ||
2663 | runtime->hw.rates &= mout->spdif_rates; | ||
2664 | runtime->hw.formats &= mout->spdif_formats; | ||
2665 | if (mout->spdif_maxbps < hinfo->maxbps) | ||
2666 | hinfo->maxbps = mout->spdif_maxbps; | ||
2667 | } | ||
2668 | mutex_unlock(&codec->spdif_mutex); | ||
2669 | } | ||
2532 | return snd_pcm_hw_constraint_step(substream->runtime, 0, | 2670 | return snd_pcm_hw_constraint_step(substream->runtime, 0, |
2533 | SNDRV_PCM_HW_PARAM_CHANNELS, 2); | 2671 | SNDRV_PCM_HW_PARAM_CHANNELS, 2); |
2534 | } | 2672 | } |
@@ -2548,7 +2686,8 @@ int snd_hda_multi_out_analog_prepare(struct hda_codec *codec, | |||
2548 | int i; | 2686 | int i; |
2549 | 2687 | ||
2550 | mutex_lock(&codec->spdif_mutex); | 2688 | mutex_lock(&codec->spdif_mutex); |
2551 | if (mout->dig_out_nid && mout->dig_out_used != HDA_DIG_EXCLUSIVE) { | 2689 | if (mout->dig_out_nid && mout->share_spdif && |
2690 | mout->dig_out_used != HDA_DIG_EXCLUSIVE) { | ||
2552 | if (chs == 2 && | 2691 | if (chs == 2 && |
2553 | snd_hda_is_supported_format(codec, mout->dig_out_nid, | 2692 | snd_hda_is_supported_format(codec, mout->dig_out_nid, |
2554 | format) && | 2693 | format) && |
@@ -2558,8 +2697,7 @@ int snd_hda_multi_out_analog_prepare(struct hda_codec *codec, | |||
2558 | stream_tag, format); | 2697 | stream_tag, format); |
2559 | } else { | 2698 | } else { |
2560 | mout->dig_out_used = 0; | 2699 | mout->dig_out_used = 0; |
2561 | snd_hda_codec_setup_stream(codec, mout->dig_out_nid, | 2700 | snd_hda_codec_cleanup_stream(codec, mout->dig_out_nid); |
2562 | 0, 0, 0); | ||
2563 | } | 2701 | } |
2564 | } | 2702 | } |
2565 | mutex_unlock(&codec->spdif_mutex); | 2703 | mutex_unlock(&codec->spdif_mutex); |
@@ -2601,17 +2739,16 @@ int snd_hda_multi_out_analog_cleanup(struct hda_codec *codec, | |||
2601 | int i; | 2739 | int i; |
2602 | 2740 | ||
2603 | for (i = 0; i < mout->num_dacs; i++) | 2741 | for (i = 0; i < mout->num_dacs; i++) |
2604 | snd_hda_codec_setup_stream(codec, nids[i], 0, 0, 0); | 2742 | snd_hda_codec_cleanup_stream(codec, nids[i]); |
2605 | if (mout->hp_nid) | 2743 | if (mout->hp_nid) |
2606 | snd_hda_codec_setup_stream(codec, mout->hp_nid, 0, 0, 0); | 2744 | snd_hda_codec_cleanup_stream(codec, mout->hp_nid); |
2607 | for (i = 0; i < ARRAY_SIZE(mout->extra_out_nid); i++) | 2745 | for (i = 0; i < ARRAY_SIZE(mout->extra_out_nid); i++) |
2608 | if (mout->extra_out_nid[i]) | 2746 | if (mout->extra_out_nid[i]) |
2609 | snd_hda_codec_setup_stream(codec, | 2747 | snd_hda_codec_cleanup_stream(codec, |
2610 | mout->extra_out_nid[i], | 2748 | mout->extra_out_nid[i]); |
2611 | 0, 0, 0); | ||
2612 | mutex_lock(&codec->spdif_mutex); | 2749 | mutex_lock(&codec->spdif_mutex); |
2613 | if (mout->dig_out_nid && mout->dig_out_used == HDA_DIG_ANALOG_DUP) { | 2750 | if (mout->dig_out_nid && mout->dig_out_used == HDA_DIG_ANALOG_DUP) { |
2614 | snd_hda_codec_setup_stream(codec, mout->dig_out_nid, 0, 0, 0); | 2751 | snd_hda_codec_cleanup_stream(codec, mout->dig_out_nid); |
2615 | mout->dig_out_used = 0; | 2752 | mout->dig_out_used = 0; |
2616 | } | 2753 | } |
2617 | mutex_unlock(&codec->spdif_mutex); | 2754 | mutex_unlock(&codec->spdif_mutex); |
@@ -2790,6 +2927,30 @@ int snd_hda_parse_pin_def_config(struct hda_codec *codec, | |||
2790 | } | 2927 | } |
2791 | } | 2928 | } |
2792 | 2929 | ||
2930 | /* FIX-UP: | ||
2931 | * If no line-out is defined but multiple HPs are found, | ||
2932 | * some of them might be the real line-outs. | ||
2933 | */ | ||
2934 | if (!cfg->line_outs && cfg->hp_outs > 1) { | ||
2935 | int i = 0; | ||
2936 | while (i < cfg->hp_outs) { | ||
2937 | /* The real HPs should have the sequence 0x0f */ | ||
2938 | if ((sequences_hp[i] & 0x0f) == 0x0f) { | ||
2939 | i++; | ||
2940 | continue; | ||
2941 | } | ||
2942 | /* Move it to the line-out table */ | ||
2943 | cfg->line_out_pins[cfg->line_outs] = cfg->hp_pins[i]; | ||
2944 | sequences_line_out[cfg->line_outs] = sequences_hp[i]; | ||
2945 | cfg->line_outs++; | ||
2946 | cfg->hp_outs--; | ||
2947 | memmove(cfg->hp_pins + i, cfg->hp_pins + i + 1, | ||
2948 | sizeof(cfg->hp_pins[0]) * (cfg->hp_outs - i)); | ||
2949 | memmove(sequences_hp + i - 1, sequences_hp + i, | ||
2950 | sizeof(sequences_hp[0]) * (cfg->hp_outs - i)); | ||
2951 | } | ||
2952 | } | ||
2953 | |||
2793 | /* sort by sequence */ | 2954 | /* sort by sequence */ |
2794 | sort_pins_by_sequence(cfg->line_out_pins, sequences_line_out, | 2955 | sort_pins_by_sequence(cfg->line_out_pins, sequences_line_out, |
2795 | cfg->line_outs); | 2956 | cfg->line_outs); |
diff --git a/sound/pci/hda/hda_codec.h b/sound/pci/hda/hda_codec.h index f14871151be9..dcd390b2bbaa 100644 --- a/sound/pci/hda/hda_codec.h +++ b/sound/pci/hda/hda_codec.h | |||
@@ -590,11 +590,21 @@ struct hda_pcm_stream { | |||
590 | struct hda_pcm_ops ops; | 590 | struct hda_pcm_ops ops; |
591 | }; | 591 | }; |
592 | 592 | ||
593 | /* PCM types */ | ||
594 | enum { | ||
595 | HDA_PCM_TYPE_AUDIO, | ||
596 | HDA_PCM_TYPE_SPDIF, | ||
597 | HDA_PCM_TYPE_HDMI, | ||
598 | HDA_PCM_TYPE_MODEM, | ||
599 | HDA_PCM_NTYPES | ||
600 | }; | ||
601 | |||
593 | /* for PCM creation */ | 602 | /* for PCM creation */ |
594 | struct hda_pcm { | 603 | struct hda_pcm { |
595 | char *name; | 604 | char *name; |
596 | struct hda_pcm_stream stream[2]; | 605 | struct hda_pcm_stream stream[2]; |
597 | unsigned int is_modem; /* modem codec? */ | 606 | unsigned int pcm_type; /* HDA_PCM_TYPE_XXX */ |
607 | int device; /* assigned device number */ | ||
598 | }; | 608 | }; |
599 | 609 | ||
600 | /* codec information */ | 610 | /* codec information */ |
@@ -712,6 +722,7 @@ int snd_hda_build_pcms(struct hda_bus *bus); | |||
712 | void snd_hda_codec_setup_stream(struct hda_codec *codec, hda_nid_t nid, | 722 | void snd_hda_codec_setup_stream(struct hda_codec *codec, hda_nid_t nid, |
713 | u32 stream_tag, | 723 | u32 stream_tag, |
714 | int channel_id, int format); | 724 | int channel_id, int format); |
725 | void snd_hda_codec_cleanup_stream(struct hda_codec *codec, hda_nid_t nid); | ||
715 | unsigned int snd_hda_calc_stream_format(unsigned int rate, | 726 | unsigned int snd_hda_calc_stream_format(unsigned int rate, |
716 | unsigned int channels, | 727 | unsigned int channels, |
717 | unsigned int format, | 728 | unsigned int format, |
diff --git a/sound/pci/hda/hda_generic.c b/sound/pci/hda/hda_generic.c index f9de7c467c25..59e4389c94a4 100644 --- a/sound/pci/hda/hda_generic.c +++ b/sound/pci/hda/hda_generic.c | |||
@@ -1007,8 +1007,8 @@ static int generic_pcm2_cleanup(struct hda_pcm_stream *hinfo, | |||
1007 | { | 1007 | { |
1008 | struct hda_gspec *spec = codec->spec; | 1008 | struct hda_gspec *spec = codec->spec; |
1009 | 1009 | ||
1010 | snd_hda_codec_setup_stream(codec, hinfo->nid, 0, 0, 0); | 1010 | snd_hda_codec_cleanup_stream(codec, hinfo->nid); |
1011 | snd_hda_codec_setup_stream(codec, spec->dac_node[1]->nid, 0, 0, 0); | 1011 | snd_hda_codec_cleanup_stream(codec, spec->dac_node[1]->nid); |
1012 | return 0; | 1012 | return 0; |
1013 | } | 1013 | } |
1014 | 1014 | ||
diff --git a/sound/pci/hda/hda_intel.c b/sound/pci/hda/hda_intel.c index 4be36c84b36c..b3a618eb42cd 100644 --- a/sound/pci/hda/hda_intel.c +++ b/sound/pci/hda/hda_intel.c | |||
@@ -39,6 +39,7 @@ | |||
39 | #include <linux/interrupt.h> | 39 | #include <linux/interrupt.h> |
40 | #include <linux/kernel.h> | 40 | #include <linux/kernel.h> |
41 | #include <linux/module.h> | 41 | #include <linux/module.h> |
42 | #include <linux/dma-mapping.h> | ||
42 | #include <linux/moduleparam.h> | 43 | #include <linux/moduleparam.h> |
43 | #include <linux/init.h> | 44 | #include <linux/init.h> |
44 | #include <linux/slab.h> | 45 | #include <linux/slab.h> |
@@ -185,35 +186,28 @@ enum { SDI0, SDI1, SDI2, SDI3, SDO0, SDO1, SDO2, SDO3 }; | |||
185 | 186 | ||
186 | /* max number of SDs */ | 187 | /* max number of SDs */ |
187 | /* ICH, ATI and VIA have 4 playback and 4 capture */ | 188 | /* ICH, ATI and VIA have 4 playback and 4 capture */ |
188 | #define ICH6_CAPTURE_INDEX 0 | ||
189 | #define ICH6_NUM_CAPTURE 4 | 189 | #define ICH6_NUM_CAPTURE 4 |
190 | #define ICH6_PLAYBACK_INDEX 4 | ||
191 | #define ICH6_NUM_PLAYBACK 4 | 190 | #define ICH6_NUM_PLAYBACK 4 |
192 | 191 | ||
193 | /* ULI has 6 playback and 5 capture */ | 192 | /* ULI has 6 playback and 5 capture */ |
194 | #define ULI_CAPTURE_INDEX 0 | ||
195 | #define ULI_NUM_CAPTURE 5 | 193 | #define ULI_NUM_CAPTURE 5 |
196 | #define ULI_PLAYBACK_INDEX 5 | ||
197 | #define ULI_NUM_PLAYBACK 6 | 194 | #define ULI_NUM_PLAYBACK 6 |
198 | 195 | ||
199 | /* ATI HDMI has 1 playback and 0 capture */ | 196 | /* ATI HDMI has 1 playback and 0 capture */ |
200 | #define ATIHDMI_CAPTURE_INDEX 0 | ||
201 | #define ATIHDMI_NUM_CAPTURE 0 | 197 | #define ATIHDMI_NUM_CAPTURE 0 |
202 | #define ATIHDMI_PLAYBACK_INDEX 0 | ||
203 | #define ATIHDMI_NUM_PLAYBACK 1 | 198 | #define ATIHDMI_NUM_PLAYBACK 1 |
204 | 199 | ||
205 | /* this number is statically defined for simplicity */ | 200 | /* this number is statically defined for simplicity */ |
206 | #define MAX_AZX_DEV 16 | 201 | #define MAX_AZX_DEV 16 |
207 | 202 | ||
208 | /* max number of fragments - we may use more if allocating more pages for BDL */ | 203 | /* max number of fragments - we may use more if allocating more pages for BDL */ |
209 | #define BDL_SIZE PAGE_ALIGN(8192) | 204 | #define BDL_SIZE 4096 |
210 | #define AZX_MAX_FRAG (BDL_SIZE / (MAX_AZX_DEV * 16)) | 205 | #define AZX_MAX_BDL_ENTRIES (BDL_SIZE / 16) |
206 | #define AZX_MAX_FRAG 32 | ||
211 | /* max buffer size - no h/w limit, you can increase as you like */ | 207 | /* max buffer size - no h/w limit, you can increase as you like */ |
212 | #define AZX_MAX_BUF_SIZE (1024*1024*1024) | 208 | #define AZX_MAX_BUF_SIZE (1024*1024*1024) |
213 | /* max number of PCM devics per card */ | 209 | /* max number of PCM devics per card */ |
214 | #define AZX_MAX_AUDIO_PCMS 6 | 210 | #define AZX_MAX_PCMS 8 |
215 | #define AZX_MAX_MODEM_PCMS 2 | ||
216 | #define AZX_MAX_PCMS (AZX_MAX_AUDIO_PCMS + AZX_MAX_MODEM_PCMS) | ||
217 | 211 | ||
218 | /* RIRB int mask: overrun[2], response[0] */ | 212 | /* RIRB int mask: overrun[2], response[0] */ |
219 | #define RIRB_INT_RESPONSE 0x01 | 213 | #define RIRB_INT_RESPONSE 0x01 |
@@ -227,6 +221,9 @@ enum { SDI0, SDI1, SDI2, SDI3, SDO0, SDO1, SDO2, SDO3 }; | |||
227 | /* SD_CTL bits */ | 221 | /* SD_CTL bits */ |
228 | #define SD_CTL_STREAM_RESET 0x01 /* stream reset bit */ | 222 | #define SD_CTL_STREAM_RESET 0x01 /* stream reset bit */ |
229 | #define SD_CTL_DMA_START 0x02 /* stream DMA start bit */ | 223 | #define SD_CTL_DMA_START 0x02 /* stream DMA start bit */ |
224 | #define SD_CTL_STRIPE (3 << 16) /* stripe control */ | ||
225 | #define SD_CTL_TRAFFIC_PRIO (1 << 18) /* traffic priority */ | ||
226 | #define SD_CTL_DIR (1 << 19) /* bi-directional stream */ | ||
230 | #define SD_CTL_STREAM_TAG_MASK (0xf << 20) | 227 | #define SD_CTL_STREAM_TAG_MASK (0xf << 20) |
231 | #define SD_CTL_STREAM_TAG_SHIFT 20 | 228 | #define SD_CTL_STREAM_TAG_SHIFT 20 |
232 | 229 | ||
@@ -284,12 +281,10 @@ enum { | |||
284 | */ | 281 | */ |
285 | 282 | ||
286 | struct azx_dev { | 283 | struct azx_dev { |
287 | u32 *bdl; /* virtual address of the BDL */ | 284 | struct snd_dma_buffer bdl; /* BDL buffer */ |
288 | dma_addr_t bdl_addr; /* physical address of the BDL */ | ||
289 | u32 *posbuf; /* position buffer pointer */ | 285 | u32 *posbuf; /* position buffer pointer */ |
290 | 286 | ||
291 | unsigned int bufsize; /* size of the play buffer in bytes */ | 287 | unsigned int bufsize; /* size of the play buffer in bytes */ |
292 | unsigned int fragsize; /* size of each period in bytes */ | ||
293 | unsigned int frags; /* number for period in the play buffer */ | 288 | unsigned int frags; /* number for period in the play buffer */ |
294 | unsigned int fifo_size; /* FIFO size */ | 289 | unsigned int fifo_size; /* FIFO size */ |
295 | 290 | ||
@@ -350,7 +345,6 @@ struct azx { | |||
350 | struct azx_dev *azx_dev; | 345 | struct azx_dev *azx_dev; |
351 | 346 | ||
352 | /* PCM */ | 347 | /* PCM */ |
353 | unsigned int pcm_devs; | ||
354 | struct snd_pcm *pcm[AZX_MAX_PCMS]; | 348 | struct snd_pcm *pcm[AZX_MAX_PCMS]; |
355 | 349 | ||
356 | /* HD codec */ | 350 | /* HD codec */ |
@@ -361,8 +355,7 @@ struct azx { | |||
361 | struct azx_rb corb; | 355 | struct azx_rb corb; |
362 | struct azx_rb rirb; | 356 | struct azx_rb rirb; |
363 | 357 | ||
364 | /* BDL, CORB/RIRB and position buffers */ | 358 | /* CORB/RIRB and position buffers */ |
365 | struct snd_dma_buffer bdl; | ||
366 | struct snd_dma_buffer rb; | 359 | struct snd_dma_buffer rb; |
367 | struct snd_dma_buffer posbuf; | 360 | struct snd_dma_buffer posbuf; |
368 | 361 | ||
@@ -546,8 +539,9 @@ static void azx_update_rirb(struct azx *chip) | |||
546 | if (res_ex & ICH6_RIRB_EX_UNSOL_EV) | 539 | if (res_ex & ICH6_RIRB_EX_UNSOL_EV) |
547 | snd_hda_queue_unsol_event(chip->bus, res, res_ex); | 540 | snd_hda_queue_unsol_event(chip->bus, res, res_ex); |
548 | else if (chip->rirb.cmds) { | 541 | else if (chip->rirb.cmds) { |
549 | chip->rirb.cmds--; | ||
550 | chip->rirb.res = res; | 542 | chip->rirb.res = res; |
543 | smp_wmb(); | ||
544 | chip->rirb.cmds--; | ||
551 | } | 545 | } |
552 | } | 546 | } |
553 | } | 547 | } |
@@ -566,8 +560,10 @@ static unsigned int azx_rirb_get_response(struct hda_codec *codec) | |||
566 | azx_update_rirb(chip); | 560 | azx_update_rirb(chip); |
567 | spin_unlock_irq(&chip->reg_lock); | 561 | spin_unlock_irq(&chip->reg_lock); |
568 | } | 562 | } |
569 | if (!chip->rirb.cmds) | 563 | if (!chip->rirb.cmds) { |
564 | smp_rmb(); | ||
570 | return chip->rirb.res; /* the last value */ | 565 | return chip->rirb.res; /* the last value */ |
566 | } | ||
571 | if (time_after(jiffies, timeout)) | 567 | if (time_after(jiffies, timeout)) |
572 | break; | 568 | break; |
573 | if (codec->bus->needs_damn_long_delay) | 569 | if (codec->bus->needs_damn_long_delay) |
@@ -965,30 +961,57 @@ static irqreturn_t azx_interrupt(int irq, void *dev_id) | |||
965 | /* | 961 | /* |
966 | * set up BDL entries | 962 | * set up BDL entries |
967 | */ | 963 | */ |
968 | static void azx_setup_periods(struct azx_dev *azx_dev) | 964 | static int azx_setup_periods(struct snd_pcm_substream *substream, |
965 | struct azx_dev *azx_dev) | ||
969 | { | 966 | { |
970 | u32 *bdl = azx_dev->bdl; | 967 | struct snd_sg_buf *sgbuf = snd_pcm_substream_sgbuf(substream); |
971 | dma_addr_t dma_addr = azx_dev->substream->runtime->dma_addr; | 968 | u32 *bdl; |
972 | int idx; | 969 | int i, ofs, periods, period_bytes; |
973 | 970 | ||
974 | /* reset BDL address */ | 971 | /* reset BDL address */ |
975 | azx_sd_writel(azx_dev, SD_BDLPL, 0); | 972 | azx_sd_writel(azx_dev, SD_BDLPL, 0); |
976 | azx_sd_writel(azx_dev, SD_BDLPU, 0); | 973 | azx_sd_writel(azx_dev, SD_BDLPU, 0); |
977 | 974 | ||
975 | period_bytes = snd_pcm_lib_period_bytes(substream); | ||
976 | periods = azx_dev->bufsize / period_bytes; | ||
977 | |||
978 | /* program the initial BDL entries */ | 978 | /* program the initial BDL entries */ |
979 | for (idx = 0; idx < azx_dev->frags; idx++) { | 979 | bdl = (u32 *)azx_dev->bdl.area; |
980 | unsigned int off = idx << 2; /* 4 dword step */ | 980 | ofs = 0; |
981 | dma_addr_t addr = dma_addr + idx * azx_dev->fragsize; | 981 | azx_dev->frags = 0; |
982 | /* program the address field of the BDL entry */ | 982 | for (i = 0; i < periods; i++) { |
983 | bdl[off] = cpu_to_le32((u32)addr); | 983 | int size, rest; |
984 | bdl[off+1] = cpu_to_le32(upper_32bit(addr)); | 984 | if (i >= AZX_MAX_BDL_ENTRIES) { |
985 | 985 | snd_printk(KERN_ERR "Too many BDL entries: " | |
986 | /* program the size field of the BDL entry */ | 986 | "buffer=%d, period=%d\n", |
987 | bdl[off+2] = cpu_to_le32(azx_dev->fragsize); | 987 | azx_dev->bufsize, period_bytes); |
988 | 988 | /* reset */ | |
989 | /* program the IOC to enable interrupt when buffer completes */ | 989 | azx_sd_writel(azx_dev, SD_BDLPL, 0); |
990 | bdl[off+3] = cpu_to_le32(0x01); | 990 | azx_sd_writel(azx_dev, SD_BDLPU, 0); |
991 | return -EINVAL; | ||
992 | } | ||
993 | rest = period_bytes; | ||
994 | do { | ||
995 | dma_addr_t addr = snd_pcm_sgbuf_get_addr(sgbuf, ofs); | ||
996 | /* program the address field of the BDL entry */ | ||
997 | bdl[0] = cpu_to_le32((u32)addr); | ||
998 | bdl[1] = cpu_to_le32(upper_32bit(addr)); | ||
999 | /* program the size field of the BDL entry */ | ||
1000 | size = PAGE_SIZE - (ofs % PAGE_SIZE); | ||
1001 | if (rest < size) | ||
1002 | size = rest; | ||
1003 | bdl[2] = cpu_to_le32(size); | ||
1004 | /* program the IOC to enable interrupt | ||
1005 | * only when the whole fragment is processed | ||
1006 | */ | ||
1007 | rest -= size; | ||
1008 | bdl[3] = rest ? 0 : cpu_to_le32(0x01); | ||
1009 | bdl += 4; | ||
1010 | azx_dev->frags++; | ||
1011 | ofs += size; | ||
1012 | } while (rest > 0); | ||
991 | } | 1013 | } |
1014 | return 0; | ||
992 | } | 1015 | } |
993 | 1016 | ||
994 | /* | 1017 | /* |
@@ -1037,14 +1060,17 @@ static int azx_setup_controller(struct azx *chip, struct azx_dev *azx_dev) | |||
1037 | 1060 | ||
1038 | /* program the BDL address */ | 1061 | /* program the BDL address */ |
1039 | /* lower BDL address */ | 1062 | /* lower BDL address */ |
1040 | azx_sd_writel(azx_dev, SD_BDLPL, (u32)azx_dev->bdl_addr); | 1063 | azx_sd_writel(azx_dev, SD_BDLPL, (u32)azx_dev->bdl.addr); |
1041 | /* upper BDL address */ | 1064 | /* upper BDL address */ |
1042 | azx_sd_writel(azx_dev, SD_BDLPU, upper_32bit(azx_dev->bdl_addr)); | 1065 | azx_sd_writel(azx_dev, SD_BDLPU, upper_32bit(azx_dev->bdl.addr)); |
1043 | 1066 | ||
1044 | /* enable the position buffer */ | 1067 | /* enable the position buffer */ |
1045 | if (!(azx_readl(chip, DPLBASE) & ICH6_DPLBASE_ENABLE)) | 1068 | if (chip->position_fix == POS_FIX_POSBUF || |
1046 | azx_writel(chip, DPLBASE, | 1069 | chip->position_fix == POS_FIX_AUTO) { |
1047 | (u32)chip->posbuf.addr |ICH6_DPLBASE_ENABLE); | 1070 | if (!(azx_readl(chip, DPLBASE) & ICH6_DPLBASE_ENABLE)) |
1071 | azx_writel(chip, DPLBASE, | ||
1072 | (u32)chip->posbuf.addr | ICH6_DPLBASE_ENABLE); | ||
1073 | } | ||
1048 | 1074 | ||
1049 | /* set the interrupt enable bits in the descriptor control register */ | 1075 | /* set the interrupt enable bits in the descriptor control register */ |
1050 | azx_sd_writel(azx_dev, SD_CTL, | 1076 | azx_sd_writel(azx_dev, SD_CTL, |
@@ -1157,7 +1183,8 @@ static struct snd_pcm_hardware azx_pcm_hw = { | |||
1157 | SNDRV_PCM_INFO_MMAP_VALID | | 1183 | SNDRV_PCM_INFO_MMAP_VALID | |
1158 | /* No full-resume yet implemented */ | 1184 | /* No full-resume yet implemented */ |
1159 | /* SNDRV_PCM_INFO_RESUME |*/ | 1185 | /* SNDRV_PCM_INFO_RESUME |*/ |
1160 | SNDRV_PCM_INFO_PAUSE), | 1186 | SNDRV_PCM_INFO_PAUSE | |
1187 | SNDRV_PCM_INFO_SYNC_START), | ||
1161 | .formats = SNDRV_PCM_FMTBIT_S16_LE, | 1188 | .formats = SNDRV_PCM_FMTBIT_S16_LE, |
1162 | .rates = SNDRV_PCM_RATE_48000, | 1189 | .rates = SNDRV_PCM_RATE_48000, |
1163 | .rate_min = 48000, | 1190 | .rate_min = 48000, |
@@ -1219,6 +1246,7 @@ static int azx_pcm_open(struct snd_pcm_substream *substream) | |||
1219 | spin_unlock_irqrestore(&chip->reg_lock, flags); | 1246 | spin_unlock_irqrestore(&chip->reg_lock, flags); |
1220 | 1247 | ||
1221 | runtime->private_data = azx_dev; | 1248 | runtime->private_data = azx_dev; |
1249 | snd_pcm_set_sync(substream); | ||
1222 | mutex_unlock(&chip->open_mutex); | 1250 | mutex_unlock(&chip->open_mutex); |
1223 | return 0; | 1251 | return 0; |
1224 | } | 1252 | } |
@@ -1275,8 +1303,6 @@ static int azx_pcm_prepare(struct snd_pcm_substream *substream) | |||
1275 | struct snd_pcm_runtime *runtime = substream->runtime; | 1303 | struct snd_pcm_runtime *runtime = substream->runtime; |
1276 | 1304 | ||
1277 | azx_dev->bufsize = snd_pcm_lib_buffer_bytes(substream); | 1305 | azx_dev->bufsize = snd_pcm_lib_buffer_bytes(substream); |
1278 | azx_dev->fragsize = snd_pcm_lib_period_bytes(substream); | ||
1279 | azx_dev->frags = azx_dev->bufsize / azx_dev->fragsize; | ||
1280 | azx_dev->format_val = snd_hda_calc_stream_format(runtime->rate, | 1306 | azx_dev->format_val = snd_hda_calc_stream_format(runtime->rate, |
1281 | runtime->channels, | 1307 | runtime->channels, |
1282 | runtime->format, | 1308 | runtime->format, |
@@ -1288,10 +1314,10 @@ static int azx_pcm_prepare(struct snd_pcm_substream *substream) | |||
1288 | return -EINVAL; | 1314 | return -EINVAL; |
1289 | } | 1315 | } |
1290 | 1316 | ||
1291 | snd_printdd("azx_pcm_prepare: bufsize=0x%x, fragsize=0x%x, " | 1317 | snd_printdd("azx_pcm_prepare: bufsize=0x%x, format=0x%x\n", |
1292 | "format=0x%x\n", | 1318 | azx_dev->bufsize, azx_dev->format_val); |
1293 | azx_dev->bufsize, azx_dev->fragsize, azx_dev->format_val); | 1319 | if (azx_setup_periods(substream, azx_dev) < 0) |
1294 | azx_setup_periods(azx_dev); | 1320 | return -EINVAL; |
1295 | azx_setup_controller(chip, azx_dev); | 1321 | azx_setup_controller(chip, azx_dev); |
1296 | if (substream->stream == SNDRV_PCM_STREAM_PLAYBACK) | 1322 | if (substream->stream == SNDRV_PCM_STREAM_PLAYBACK) |
1297 | azx_dev->fifo_size = azx_sd_readw(azx_dev, SD_FIFOSIZE) + 1; | 1323 | azx_dev->fifo_size = azx_sd_readw(azx_dev, SD_FIFOSIZE) + 1; |
@@ -1305,37 +1331,94 @@ static int azx_pcm_prepare(struct snd_pcm_substream *substream) | |||
1305 | static int azx_pcm_trigger(struct snd_pcm_substream *substream, int cmd) | 1331 | static int azx_pcm_trigger(struct snd_pcm_substream *substream, int cmd) |
1306 | { | 1332 | { |
1307 | struct azx_pcm *apcm = snd_pcm_substream_chip(substream); | 1333 | struct azx_pcm *apcm = snd_pcm_substream_chip(substream); |
1308 | struct azx_dev *azx_dev = get_azx_dev(substream); | ||
1309 | struct azx *chip = apcm->chip; | 1334 | struct azx *chip = apcm->chip; |
1310 | int err = 0; | 1335 | struct azx_dev *azx_dev; |
1336 | struct snd_pcm_substream *s; | ||
1337 | int start, nsync = 0, sbits = 0; | ||
1338 | int nwait, timeout; | ||
1311 | 1339 | ||
1312 | spin_lock(&chip->reg_lock); | ||
1313 | switch (cmd) { | 1340 | switch (cmd) { |
1314 | case SNDRV_PCM_TRIGGER_PAUSE_RELEASE: | 1341 | case SNDRV_PCM_TRIGGER_PAUSE_RELEASE: |
1315 | case SNDRV_PCM_TRIGGER_RESUME: | 1342 | case SNDRV_PCM_TRIGGER_RESUME: |
1316 | case SNDRV_PCM_TRIGGER_START: | 1343 | case SNDRV_PCM_TRIGGER_START: |
1317 | azx_stream_start(chip, azx_dev); | 1344 | start = 1; |
1318 | azx_dev->running = 1; | ||
1319 | break; | 1345 | break; |
1320 | case SNDRV_PCM_TRIGGER_PAUSE_PUSH: | 1346 | case SNDRV_PCM_TRIGGER_PAUSE_PUSH: |
1321 | case SNDRV_PCM_TRIGGER_SUSPEND: | 1347 | case SNDRV_PCM_TRIGGER_SUSPEND: |
1322 | case SNDRV_PCM_TRIGGER_STOP: | 1348 | case SNDRV_PCM_TRIGGER_STOP: |
1323 | azx_stream_stop(chip, azx_dev); | 1349 | start = 0; |
1324 | azx_dev->running = 0; | ||
1325 | break; | 1350 | break; |
1326 | default: | 1351 | default: |
1327 | err = -EINVAL; | 1352 | return -EINVAL; |
1353 | } | ||
1354 | |||
1355 | snd_pcm_group_for_each_entry(s, substream) { | ||
1356 | if (s->pcm->card != substream->pcm->card) | ||
1357 | continue; | ||
1358 | azx_dev = get_azx_dev(s); | ||
1359 | sbits |= 1 << azx_dev->index; | ||
1360 | nsync++; | ||
1361 | snd_pcm_trigger_done(s, substream); | ||
1362 | } | ||
1363 | |||
1364 | spin_lock(&chip->reg_lock); | ||
1365 | if (nsync > 1) { | ||
1366 | /* first, set SYNC bits of corresponding streams */ | ||
1367 | azx_writel(chip, SYNC, azx_readl(chip, SYNC) | sbits); | ||
1368 | } | ||
1369 | snd_pcm_group_for_each_entry(s, substream) { | ||
1370 | if (s->pcm->card != substream->pcm->card) | ||
1371 | continue; | ||
1372 | azx_dev = get_azx_dev(s); | ||
1373 | if (start) | ||
1374 | azx_stream_start(chip, azx_dev); | ||
1375 | else | ||
1376 | azx_stream_stop(chip, azx_dev); | ||
1377 | azx_dev->running = start; | ||
1328 | } | 1378 | } |
1329 | spin_unlock(&chip->reg_lock); | 1379 | spin_unlock(&chip->reg_lock); |
1330 | if (cmd == SNDRV_PCM_TRIGGER_PAUSE_PUSH || | 1380 | if (start) { |
1331 | cmd == SNDRV_PCM_TRIGGER_SUSPEND || | 1381 | if (nsync == 1) |
1332 | cmd == SNDRV_PCM_TRIGGER_STOP) { | 1382 | return 0; |
1333 | int timeout = 5000; | 1383 | /* wait until all FIFOs get ready */ |
1334 | while ((azx_sd_readb(azx_dev, SD_CTL) & SD_CTL_DMA_START) && | 1384 | for (timeout = 5000; timeout; timeout--) { |
1335 | --timeout) | 1385 | nwait = 0; |
1336 | ; | 1386 | snd_pcm_group_for_each_entry(s, substream) { |
1387 | if (s->pcm->card != substream->pcm->card) | ||
1388 | continue; | ||
1389 | azx_dev = get_azx_dev(s); | ||
1390 | if (!(azx_sd_readb(azx_dev, SD_STS) & | ||
1391 | SD_STS_FIFO_READY)) | ||
1392 | nwait++; | ||
1393 | } | ||
1394 | if (!nwait) | ||
1395 | break; | ||
1396 | cpu_relax(); | ||
1397 | } | ||
1398 | } else { | ||
1399 | /* wait until all RUN bits are cleared */ | ||
1400 | for (timeout = 5000; timeout; timeout--) { | ||
1401 | nwait = 0; | ||
1402 | snd_pcm_group_for_each_entry(s, substream) { | ||
1403 | if (s->pcm->card != substream->pcm->card) | ||
1404 | continue; | ||
1405 | azx_dev = get_azx_dev(s); | ||
1406 | if (azx_sd_readb(azx_dev, SD_CTL) & | ||
1407 | SD_CTL_DMA_START) | ||
1408 | nwait++; | ||
1409 | } | ||
1410 | if (!nwait) | ||
1411 | break; | ||
1412 | cpu_relax(); | ||
1413 | } | ||
1337 | } | 1414 | } |
1338 | return err; | 1415 | if (nsync > 1) { |
1416 | spin_lock(&chip->reg_lock); | ||
1417 | /* reset SYNC bits */ | ||
1418 | azx_writel(chip, SYNC, azx_readl(chip, SYNC) & ~sbits); | ||
1419 | spin_unlock(&chip->reg_lock); | ||
1420 | } | ||
1421 | return 0; | ||
1339 | } | 1422 | } |
1340 | 1423 | ||
1341 | static snd_pcm_uframes_t azx_pcm_pointer(struct snd_pcm_substream *substream) | 1424 | static snd_pcm_uframes_t azx_pcm_pointer(struct snd_pcm_substream *substream) |
@@ -1378,6 +1461,7 @@ static struct snd_pcm_ops azx_pcm_ops = { | |||
1378 | .prepare = azx_pcm_prepare, | 1461 | .prepare = azx_pcm_prepare, |
1379 | .trigger = azx_pcm_trigger, | 1462 | .trigger = azx_pcm_trigger, |
1380 | .pointer = azx_pcm_pointer, | 1463 | .pointer = azx_pcm_pointer, |
1464 | .page = snd_pcm_sgbuf_ops_page, | ||
1381 | }; | 1465 | }; |
1382 | 1466 | ||
1383 | static void azx_pcm_free(struct snd_pcm *pcm) | 1467 | static void azx_pcm_free(struct snd_pcm *pcm) |
@@ -1386,7 +1470,7 @@ static void azx_pcm_free(struct snd_pcm *pcm) | |||
1386 | } | 1470 | } |
1387 | 1471 | ||
1388 | static int __devinit create_codec_pcm(struct azx *chip, struct hda_codec *codec, | 1472 | static int __devinit create_codec_pcm(struct azx *chip, struct hda_codec *codec, |
1389 | struct hda_pcm *cpcm, int pcm_dev) | 1473 | struct hda_pcm *cpcm) |
1390 | { | 1474 | { |
1391 | int err; | 1475 | int err; |
1392 | struct snd_pcm *pcm; | 1476 | struct snd_pcm *pcm; |
@@ -1400,7 +1484,7 @@ static int __devinit create_codec_pcm(struct azx *chip, struct hda_codec *codec, | |||
1400 | 1484 | ||
1401 | snd_assert(cpcm->name, return -EINVAL); | 1485 | snd_assert(cpcm->name, return -EINVAL); |
1402 | 1486 | ||
1403 | err = snd_pcm_new(chip->card, cpcm->name, pcm_dev, | 1487 | err = snd_pcm_new(chip->card, cpcm->name, cpcm->device, |
1404 | cpcm->stream[0].substreams, | 1488 | cpcm->stream[0].substreams, |
1405 | cpcm->stream[1].substreams, | 1489 | cpcm->stream[1].substreams, |
1406 | &pcm); | 1490 | &pcm); |
@@ -1420,62 +1504,70 @@ static int __devinit create_codec_pcm(struct azx *chip, struct hda_codec *codec, | |||
1420 | snd_pcm_set_ops(pcm, SNDRV_PCM_STREAM_PLAYBACK, &azx_pcm_ops); | 1504 | snd_pcm_set_ops(pcm, SNDRV_PCM_STREAM_PLAYBACK, &azx_pcm_ops); |
1421 | if (cpcm->stream[1].substreams) | 1505 | if (cpcm->stream[1].substreams) |
1422 | snd_pcm_set_ops(pcm, SNDRV_PCM_STREAM_CAPTURE, &azx_pcm_ops); | 1506 | snd_pcm_set_ops(pcm, SNDRV_PCM_STREAM_CAPTURE, &azx_pcm_ops); |
1423 | snd_pcm_lib_preallocate_pages_for_all(pcm, SNDRV_DMA_TYPE_DEV, | 1507 | snd_pcm_lib_preallocate_pages_for_all(pcm, SNDRV_DMA_TYPE_DEV_SG, |
1424 | snd_dma_pci_data(chip->pci), | 1508 | snd_dma_pci_data(chip->pci), |
1425 | 1024 * 64, 1024 * 1024); | 1509 | 1024 * 64, 1024 * 1024); |
1426 | chip->pcm[pcm_dev] = pcm; | 1510 | chip->pcm[cpcm->device] = pcm; |
1427 | if (chip->pcm_devs < pcm_dev + 1) | ||
1428 | chip->pcm_devs = pcm_dev + 1; | ||
1429 | |||
1430 | return 0; | 1511 | return 0; |
1431 | } | 1512 | } |
1432 | 1513 | ||
1433 | static int __devinit azx_pcm_create(struct azx *chip) | 1514 | static int __devinit azx_pcm_create(struct azx *chip) |
1434 | { | 1515 | { |
1516 | static const char *dev_name[HDA_PCM_NTYPES] = { | ||
1517 | "Audio", "SPDIF", "HDMI", "Modem" | ||
1518 | }; | ||
1519 | /* starting device index for each PCM type */ | ||
1520 | static int dev_idx[HDA_PCM_NTYPES] = { | ||
1521 | [HDA_PCM_TYPE_AUDIO] = 0, | ||
1522 | [HDA_PCM_TYPE_SPDIF] = 1, | ||
1523 | [HDA_PCM_TYPE_HDMI] = 3, | ||
1524 | [HDA_PCM_TYPE_MODEM] = 6 | ||
1525 | }; | ||
1526 | /* normal audio device indices; not linear to keep compatibility */ | ||
1527 | static int audio_idx[4] = { 0, 2, 4, 5 }; | ||
1435 | struct hda_codec *codec; | 1528 | struct hda_codec *codec; |
1436 | int c, err; | 1529 | int c, err; |
1437 | int pcm_dev; | 1530 | int num_devs[HDA_PCM_NTYPES]; |
1438 | 1531 | ||
1439 | err = snd_hda_build_pcms(chip->bus); | 1532 | err = snd_hda_build_pcms(chip->bus); |
1440 | if (err < 0) | 1533 | if (err < 0) |
1441 | return err; | 1534 | return err; |
1442 | 1535 | ||
1443 | /* create audio PCMs */ | 1536 | /* create audio PCMs */ |
1444 | pcm_dev = 0; | 1537 | memset(num_devs, 0, sizeof(num_devs)); |
1445 | list_for_each_entry(codec, &chip->bus->codec_list, list) { | ||
1446 | for (c = 0; c < codec->num_pcms; c++) { | ||
1447 | if (codec->pcm_info[c].is_modem) | ||
1448 | continue; /* create later */ | ||
1449 | if (pcm_dev >= AZX_MAX_AUDIO_PCMS) { | ||
1450 | snd_printk(KERN_ERR SFX | ||
1451 | "Too many audio PCMs\n"); | ||
1452 | return -EINVAL; | ||
1453 | } | ||
1454 | err = create_codec_pcm(chip, codec, | ||
1455 | &codec->pcm_info[c], pcm_dev); | ||
1456 | if (err < 0) | ||
1457 | return err; | ||
1458 | pcm_dev++; | ||
1459 | } | ||
1460 | } | ||
1461 | |||
1462 | /* create modem PCMs */ | ||
1463 | pcm_dev = AZX_MAX_AUDIO_PCMS; | ||
1464 | list_for_each_entry(codec, &chip->bus->codec_list, list) { | 1538 | list_for_each_entry(codec, &chip->bus->codec_list, list) { |
1465 | for (c = 0; c < codec->num_pcms; c++) { | 1539 | for (c = 0; c < codec->num_pcms; c++) { |
1466 | if (!codec->pcm_info[c].is_modem) | 1540 | struct hda_pcm *cpcm = &codec->pcm_info[c]; |
1467 | continue; /* already created */ | 1541 | int type = cpcm->pcm_type; |
1468 | if (pcm_dev >= AZX_MAX_PCMS) { | 1542 | switch (type) { |
1469 | snd_printk(KERN_ERR SFX | 1543 | case HDA_PCM_TYPE_AUDIO: |
1470 | "Too many modem PCMs\n"); | 1544 | if (num_devs[type] >= ARRAY_SIZE(audio_idx)) { |
1471 | return -EINVAL; | 1545 | snd_printk(KERN_WARNING |
1546 | "Too many audio devices\n"); | ||
1547 | continue; | ||
1548 | } | ||
1549 | cpcm->device = audio_idx[num_devs[type]]; | ||
1550 | break; | ||
1551 | case HDA_PCM_TYPE_SPDIF: | ||
1552 | case HDA_PCM_TYPE_HDMI: | ||
1553 | case HDA_PCM_TYPE_MODEM: | ||
1554 | if (num_devs[type]) { | ||
1555 | snd_printk(KERN_WARNING | ||
1556 | "%s already defined\n", | ||
1557 | dev_name[type]); | ||
1558 | continue; | ||
1559 | } | ||
1560 | cpcm->device = dev_idx[type]; | ||
1561 | break; | ||
1562 | default: | ||
1563 | snd_printk(KERN_WARNING | ||
1564 | "Invalid PCM type %d\n", type); | ||
1565 | continue; | ||
1472 | } | 1566 | } |
1473 | err = create_codec_pcm(chip, codec, | 1567 | num_devs[type]++; |
1474 | &codec->pcm_info[c], pcm_dev); | 1568 | err = create_codec_pcm(chip, codec, cpcm); |
1475 | if (err < 0) | 1569 | if (err < 0) |
1476 | return err; | 1570 | return err; |
1477 | chip->pcm[pcm_dev]->dev_class = SNDRV_PCM_CLASS_MODEM; | ||
1478 | pcm_dev++; | ||
1479 | } | 1571 | } |
1480 | } | 1572 | } |
1481 | return 0; | 1573 | return 0; |
@@ -1502,10 +1594,7 @@ static int __devinit azx_init_stream(struct azx *chip) | |||
1502 | * and initialize | 1594 | * and initialize |
1503 | */ | 1595 | */ |
1504 | for (i = 0; i < chip->num_streams; i++) { | 1596 | for (i = 0; i < chip->num_streams; i++) { |
1505 | unsigned int off = sizeof(u32) * (i * AZX_MAX_FRAG * 4); | ||
1506 | struct azx_dev *azx_dev = &chip->azx_dev[i]; | 1597 | struct azx_dev *azx_dev = &chip->azx_dev[i]; |
1507 | azx_dev->bdl = (u32 *)(chip->bdl.area + off); | ||
1508 | azx_dev->bdl_addr = chip->bdl.addr + off; | ||
1509 | azx_dev->posbuf = (u32 __iomem *)(chip->posbuf.area + i * 8); | 1598 | azx_dev->posbuf = (u32 __iomem *)(chip->posbuf.area + i * 8); |
1510 | /* offset: SDI0=0x80, SDI1=0xa0, ... SDO3=0x160 */ | 1599 | /* offset: SDI0=0x80, SDI1=0xa0, ... SDO3=0x160 */ |
1511 | azx_dev->sd_addr = chip->remap_addr + (0x20 * i + 0x80); | 1600 | azx_dev->sd_addr = chip->remap_addr + (0x20 * i + 0x80); |
@@ -1587,13 +1676,12 @@ static int azx_suspend(struct pci_dev *pci, pm_message_t state) | |||
1587 | int i; | 1676 | int i; |
1588 | 1677 | ||
1589 | snd_power_change_state(card, SNDRV_CTL_POWER_D3hot); | 1678 | snd_power_change_state(card, SNDRV_CTL_POWER_D3hot); |
1590 | for (i = 0; i < chip->pcm_devs; i++) | 1679 | for (i = 0; i < AZX_MAX_PCMS; i++) |
1591 | snd_pcm_suspend_all(chip->pcm[i]); | 1680 | snd_pcm_suspend_all(chip->pcm[i]); |
1592 | if (chip->initialized) | 1681 | if (chip->initialized) |
1593 | snd_hda_suspend(chip->bus, state); | 1682 | snd_hda_suspend(chip->bus, state); |
1594 | azx_stop_chip(chip); | 1683 | azx_stop_chip(chip); |
1595 | if (chip->irq >= 0) { | 1684 | if (chip->irq >= 0) { |
1596 | synchronize_irq(chip->irq); | ||
1597 | free_irq(chip->irq, chip); | 1685 | free_irq(chip->irq, chip); |
1598 | chip->irq = -1; | 1686 | chip->irq = -1; |
1599 | } | 1687 | } |
@@ -1641,24 +1729,26 @@ static int azx_resume(struct pci_dev *pci) | |||
1641 | */ | 1729 | */ |
1642 | static int azx_free(struct azx *chip) | 1730 | static int azx_free(struct azx *chip) |
1643 | { | 1731 | { |
1732 | int i; | ||
1733 | |||
1644 | if (chip->initialized) { | 1734 | if (chip->initialized) { |
1645 | int i; | ||
1646 | for (i = 0; i < chip->num_streams; i++) | 1735 | for (i = 0; i < chip->num_streams; i++) |
1647 | azx_stream_stop(chip, &chip->azx_dev[i]); | 1736 | azx_stream_stop(chip, &chip->azx_dev[i]); |
1648 | azx_stop_chip(chip); | 1737 | azx_stop_chip(chip); |
1649 | } | 1738 | } |
1650 | 1739 | ||
1651 | if (chip->irq >= 0) { | 1740 | if (chip->irq >= 0) |
1652 | synchronize_irq(chip->irq); | ||
1653 | free_irq(chip->irq, (void*)chip); | 1741 | free_irq(chip->irq, (void*)chip); |
1654 | } | ||
1655 | if (chip->msi) | 1742 | if (chip->msi) |
1656 | pci_disable_msi(chip->pci); | 1743 | pci_disable_msi(chip->pci); |
1657 | if (chip->remap_addr) | 1744 | if (chip->remap_addr) |
1658 | iounmap(chip->remap_addr); | 1745 | iounmap(chip->remap_addr); |
1659 | 1746 | ||
1660 | if (chip->bdl.area) | 1747 | if (chip->azx_dev) { |
1661 | snd_dma_free_pages(&chip->bdl); | 1748 | for (i = 0; i < chip->num_streams; i++) |
1749 | if (chip->azx_dev[i].bdl.area) | ||
1750 | snd_dma_free_pages(&chip->azx_dev[i].bdl); | ||
1751 | } | ||
1662 | if (chip->rb.area) | 1752 | if (chip->rb.area) |
1663 | snd_dma_free_pages(&chip->rb); | 1753 | snd_dma_free_pages(&chip->rb); |
1664 | if (chip->posbuf.area) | 1754 | if (chip->posbuf.area) |
@@ -1682,6 +1772,7 @@ static int azx_dev_free(struct snd_device *device) | |||
1682 | static struct snd_pci_quirk position_fix_list[] __devinitdata = { | 1772 | static struct snd_pci_quirk position_fix_list[] __devinitdata = { |
1683 | SND_PCI_QUIRK(0x1028, 0x01cc, "Dell D820", POS_FIX_NONE), | 1773 | SND_PCI_QUIRK(0x1028, 0x01cc, "Dell D820", POS_FIX_NONE), |
1684 | SND_PCI_QUIRK(0x1028, 0x01de, "Dell Precision 390", POS_FIX_NONE), | 1774 | SND_PCI_QUIRK(0x1028, 0x01de, "Dell Precision 390", POS_FIX_NONE), |
1775 | SND_PCI_QUIRK(0x1043, 0x813d, "ASUS P5AD2", POS_FIX_NONE), | ||
1685 | {} | 1776 | {} |
1686 | }; | 1777 | }; |
1687 | 1778 | ||
@@ -1740,7 +1831,7 @@ static int __devinit azx_create(struct snd_card *card, struct pci_dev *pci, | |||
1740 | struct azx **rchip) | 1831 | struct azx **rchip) |
1741 | { | 1832 | { |
1742 | struct azx *chip; | 1833 | struct azx *chip; |
1743 | int err; | 1834 | int i, err; |
1744 | unsigned short gcap; | 1835 | unsigned short gcap; |
1745 | static struct snd_device_ops ops = { | 1836 | static struct snd_device_ops ops = { |
1746 | .dev_free = azx_dev_free, | 1837 | .dev_free = azx_dev_free, |
@@ -1812,38 +1903,35 @@ static int __devinit azx_create(struct snd_card *card, struct pci_dev *pci, | |||
1812 | gcap = azx_readw(chip, GCAP); | 1903 | gcap = azx_readw(chip, GCAP); |
1813 | snd_printdd("chipset global capabilities = 0x%x\n", gcap); | 1904 | snd_printdd("chipset global capabilities = 0x%x\n", gcap); |
1814 | 1905 | ||
1815 | if (gcap) { | 1906 | /* allow 64bit DMA address if supported by H/W */ |
1816 | /* read number of streams from GCAP register instead of using | 1907 | if ((gcap & 0x01) && !pci_set_dma_mask(pci, DMA_64BIT_MASK)) |
1817 | * hardcoded value | 1908 | pci_set_consistent_dma_mask(pci, DMA_64BIT_MASK); |
1818 | */ | 1909 | |
1819 | chip->playback_streams = (gcap & (0xF << 12)) >> 12; | 1910 | /* read number of streams from GCAP register instead of using |
1820 | chip->capture_streams = (gcap & (0xF << 8)) >> 8; | 1911 | * hardcoded value |
1821 | chip->playback_index_offset = chip->capture_streams; | 1912 | */ |
1822 | chip->capture_index_offset = 0; | 1913 | chip->capture_streams = (gcap >> 8) & 0x0f; |
1823 | } else { | 1914 | chip->playback_streams = (gcap >> 12) & 0x0f; |
1915 | if (!chip->playback_streams && !chip->capture_streams) { | ||
1824 | /* gcap didn't give any info, switching to old method */ | 1916 | /* gcap didn't give any info, switching to old method */ |
1825 | 1917 | ||
1826 | switch (chip->driver_type) { | 1918 | switch (chip->driver_type) { |
1827 | case AZX_DRIVER_ULI: | 1919 | case AZX_DRIVER_ULI: |
1828 | chip->playback_streams = ULI_NUM_PLAYBACK; | 1920 | chip->playback_streams = ULI_NUM_PLAYBACK; |
1829 | chip->capture_streams = ULI_NUM_CAPTURE; | 1921 | chip->capture_streams = ULI_NUM_CAPTURE; |
1830 | chip->playback_index_offset = ULI_PLAYBACK_INDEX; | ||
1831 | chip->capture_index_offset = ULI_CAPTURE_INDEX; | ||
1832 | break; | 1922 | break; |
1833 | case AZX_DRIVER_ATIHDMI: | 1923 | case AZX_DRIVER_ATIHDMI: |
1834 | chip->playback_streams = ATIHDMI_NUM_PLAYBACK; | 1924 | chip->playback_streams = ATIHDMI_NUM_PLAYBACK; |
1835 | chip->capture_streams = ATIHDMI_NUM_CAPTURE; | 1925 | chip->capture_streams = ATIHDMI_NUM_CAPTURE; |
1836 | chip->playback_index_offset = ATIHDMI_PLAYBACK_INDEX; | ||
1837 | chip->capture_index_offset = ATIHDMI_CAPTURE_INDEX; | ||
1838 | break; | 1926 | break; |
1839 | default: | 1927 | default: |
1840 | chip->playback_streams = ICH6_NUM_PLAYBACK; | 1928 | chip->playback_streams = ICH6_NUM_PLAYBACK; |
1841 | chip->capture_streams = ICH6_NUM_CAPTURE; | 1929 | chip->capture_streams = ICH6_NUM_CAPTURE; |
1842 | chip->playback_index_offset = ICH6_PLAYBACK_INDEX; | ||
1843 | chip->capture_index_offset = ICH6_CAPTURE_INDEX; | ||
1844 | break; | 1930 | break; |
1845 | } | 1931 | } |
1846 | } | 1932 | } |
1933 | chip->capture_index_offset = 0; | ||
1934 | chip->playback_index_offset = chip->capture_streams; | ||
1847 | chip->num_streams = chip->playback_streams + chip->capture_streams; | 1935 | chip->num_streams = chip->playback_streams + chip->capture_streams; |
1848 | chip->azx_dev = kcalloc(chip->num_streams, sizeof(*chip->azx_dev), | 1936 | chip->azx_dev = kcalloc(chip->num_streams, sizeof(*chip->azx_dev), |
1849 | GFP_KERNEL); | 1937 | GFP_KERNEL); |
@@ -1852,13 +1940,15 @@ static int __devinit azx_create(struct snd_card *card, struct pci_dev *pci, | |||
1852 | goto errout; | 1940 | goto errout; |
1853 | } | 1941 | } |
1854 | 1942 | ||
1855 | /* allocate memory for the BDL for each stream */ | 1943 | for (i = 0; i < chip->num_streams; i++) { |
1856 | err = snd_dma_alloc_pages(SNDRV_DMA_TYPE_DEV, | 1944 | /* allocate memory for the BDL for each stream */ |
1857 | snd_dma_pci_data(chip->pci), | 1945 | err = snd_dma_alloc_pages(SNDRV_DMA_TYPE_DEV, |
1858 | BDL_SIZE, &chip->bdl); | 1946 | snd_dma_pci_data(chip->pci), |
1859 | if (err < 0) { | 1947 | BDL_SIZE, &chip->azx_dev[i].bdl); |
1860 | snd_printk(KERN_ERR SFX "cannot allocate BDL\n"); | 1948 | if (err < 0) { |
1861 | goto errout; | 1949 | snd_printk(KERN_ERR SFX "cannot allocate BDL\n"); |
1950 | goto errout; | ||
1951 | } | ||
1862 | } | 1952 | } |
1863 | /* allocate memory for the position buffer */ | 1953 | /* allocate memory for the position buffer */ |
1864 | err = snd_dma_alloc_pages(SNDRV_DMA_TYPE_DEV, | 1954 | err = snd_dma_alloc_pages(SNDRV_DMA_TYPE_DEV, |
@@ -1994,48 +2084,63 @@ static void __devexit azx_remove(struct pci_dev *pci) | |||
1994 | 2084 | ||
1995 | /* PCI IDs */ | 2085 | /* PCI IDs */ |
1996 | static struct pci_device_id azx_ids[] = { | 2086 | static struct pci_device_id azx_ids[] = { |
1997 | { 0x8086, 0x2668, PCI_ANY_ID, PCI_ANY_ID, 0, 0, AZX_DRIVER_ICH }, /* ICH6 */ | 2087 | /* ICH 6..10 */ |
1998 | { 0x8086, 0x27d8, PCI_ANY_ID, PCI_ANY_ID, 0, 0, AZX_DRIVER_ICH }, /* ICH7 */ | 2088 | { PCI_DEVICE(0x8086, 0x2668), .driver_data = AZX_DRIVER_ICH }, |
1999 | { 0x8086, 0x269a, PCI_ANY_ID, PCI_ANY_ID, 0, 0, AZX_DRIVER_ICH }, /* ESB2 */ | 2089 | { PCI_DEVICE(0x8086, 0x27d8), .driver_data = AZX_DRIVER_ICH }, |
2000 | { 0x8086, 0x284b, PCI_ANY_ID, PCI_ANY_ID, 0, 0, AZX_DRIVER_ICH }, /* ICH8 */ | 2090 | { PCI_DEVICE(0x8086, 0x269a), .driver_data = AZX_DRIVER_ICH }, |
2001 | { 0x8086, 0x293e, PCI_ANY_ID, PCI_ANY_ID, 0, 0, AZX_DRIVER_ICH }, /* ICH9 */ | 2091 | { PCI_DEVICE(0x8086, 0x284b), .driver_data = AZX_DRIVER_ICH }, |
2002 | { 0x8086, 0x293f, PCI_ANY_ID, PCI_ANY_ID, 0, 0, AZX_DRIVER_ICH }, /* ICH9 */ | 2092 | { PCI_DEVICE(0x8086, 0x293e), .driver_data = AZX_DRIVER_ICH }, |
2003 | { 0x8086, 0x3a3e, PCI_ANY_ID, PCI_ANY_ID, 0, 0, AZX_DRIVER_ICH }, /* ICH10 */ | 2093 | { PCI_DEVICE(0x8086, 0x293f), .driver_data = AZX_DRIVER_ICH }, |
2004 | { 0x8086, 0x3a6e, PCI_ANY_ID, PCI_ANY_ID, 0, 0, AZX_DRIVER_ICH }, /* ICH10 */ | 2094 | { PCI_DEVICE(0x8086, 0x3a3e), .driver_data = AZX_DRIVER_ICH }, |
2005 | { 0x8086, 0x811b, PCI_ANY_ID, PCI_ANY_ID, 0, 0, AZX_DRIVER_SCH }, /* SCH*/ | 2095 | { PCI_DEVICE(0x8086, 0x3a6e), .driver_data = AZX_DRIVER_ICH }, |
2006 | { 0x1002, 0x437b, PCI_ANY_ID, PCI_ANY_ID, 0, 0, AZX_DRIVER_ATI }, /* ATI SB450 */ | 2096 | /* SCH */ |
2007 | { 0x1002, 0x4383, PCI_ANY_ID, PCI_ANY_ID, 0, 0, AZX_DRIVER_ATI }, /* ATI SB600 */ | 2097 | { PCI_DEVICE(0x8086, 0x811b), .driver_data = AZX_DRIVER_SCH }, |
2008 | { 0x1002, 0x793b, PCI_ANY_ID, PCI_ANY_ID, 0, 0, AZX_DRIVER_ATIHDMI }, /* ATI RS600 HDMI */ | 2098 | /* ATI SB 450/600 */ |
2009 | { 0x1002, 0x7919, PCI_ANY_ID, PCI_ANY_ID, 0, 0, AZX_DRIVER_ATIHDMI }, /* ATI RS690 HDMI */ | 2099 | { PCI_DEVICE(0x1002, 0x437b), .driver_data = AZX_DRIVER_ATI }, |
2010 | { 0x1002, 0x960f, PCI_ANY_ID, PCI_ANY_ID, 0, 0, AZX_DRIVER_ATIHDMI }, /* ATI RS780 HDMI */ | 2100 | { PCI_DEVICE(0x1002, 0x4383), .driver_data = AZX_DRIVER_ATI }, |
2011 | { 0x1002, 0xaa00, PCI_ANY_ID, PCI_ANY_ID, 0, 0, AZX_DRIVER_ATIHDMI }, /* ATI R600 HDMI */ | 2101 | /* ATI HDMI */ |
2012 | { 0x1002, 0xaa08, PCI_ANY_ID, PCI_ANY_ID, 0, 0, AZX_DRIVER_ATIHDMI }, /* ATI RV630 HDMI */ | 2102 | { PCI_DEVICE(0x1002, 0x793b), .driver_data = AZX_DRIVER_ATIHDMI }, |
2013 | { 0x1002, 0xaa10, PCI_ANY_ID, PCI_ANY_ID, 0, 0, AZX_DRIVER_ATIHDMI }, /* ATI RV610 HDMI */ | 2103 | { PCI_DEVICE(0x1002, 0x7919), .driver_data = AZX_DRIVER_ATIHDMI }, |
2014 | { 0x1002, 0xaa18, PCI_ANY_ID, PCI_ANY_ID, 0, 0, AZX_DRIVER_ATIHDMI }, /* ATI RV670 HDMI */ | 2104 | { PCI_DEVICE(0x1002, 0x960f), .driver_data = AZX_DRIVER_ATIHDMI }, |
2015 | { 0x1002, 0xaa20, PCI_ANY_ID, PCI_ANY_ID, 0, 0, AZX_DRIVER_ATIHDMI }, /* ATI RV635 HDMI */ | 2105 | { PCI_DEVICE(0x1002, 0xaa00), .driver_data = AZX_DRIVER_ATIHDMI }, |
2016 | { 0x1002, 0xaa28, PCI_ANY_ID, PCI_ANY_ID, 0, 0, AZX_DRIVER_ATIHDMI }, /* ATI RV620 HDMI */ | 2106 | { PCI_DEVICE(0x1002, 0xaa08), .driver_data = AZX_DRIVER_ATIHDMI }, |
2017 | { 0x1002, 0xaa30, PCI_ANY_ID, PCI_ANY_ID, 0, 0, AZX_DRIVER_ATIHDMI }, /* ATI RV770 HDMI */ | 2107 | { PCI_DEVICE(0x1002, 0xaa10), .driver_data = AZX_DRIVER_ATIHDMI }, |
2018 | { 0x1106, 0x3288, PCI_ANY_ID, PCI_ANY_ID, 0, 0, AZX_DRIVER_VIA }, /* VIA VT8251/VT8237A */ | 2108 | { PCI_DEVICE(0x1002, 0xaa18), .driver_data = AZX_DRIVER_ATIHDMI }, |
2019 | { 0x1039, 0x7502, PCI_ANY_ID, PCI_ANY_ID, 0, 0, AZX_DRIVER_SIS }, /* SIS966 */ | 2109 | { PCI_DEVICE(0x1002, 0xaa20), .driver_data = AZX_DRIVER_ATIHDMI }, |
2020 | { 0x10b9, 0x5461, PCI_ANY_ID, PCI_ANY_ID, 0, 0, AZX_DRIVER_ULI }, /* ULI M5461 */ | 2110 | { PCI_DEVICE(0x1002, 0xaa28), .driver_data = AZX_DRIVER_ATIHDMI }, |
2021 | { 0x10de, 0x026c, PCI_ANY_ID, PCI_ANY_ID, 0, 0, AZX_DRIVER_NVIDIA }, /* NVIDIA MCP51 */ | 2111 | { PCI_DEVICE(0x1002, 0xaa30), .driver_data = AZX_DRIVER_ATIHDMI }, |
2022 | { 0x10de, 0x0371, PCI_ANY_ID, PCI_ANY_ID, 0, 0, AZX_DRIVER_NVIDIA }, /* NVIDIA MCP55 */ | 2112 | { PCI_DEVICE(0x1002, 0xaa38), .driver_data = AZX_DRIVER_ATIHDMI }, |
2023 | { 0x10de, 0x03e4, PCI_ANY_ID, PCI_ANY_ID, 0, 0, AZX_DRIVER_NVIDIA }, /* NVIDIA MCP61 */ | 2113 | { PCI_DEVICE(0x1002, 0xaa40), .driver_data = AZX_DRIVER_ATIHDMI }, |
2024 | { 0x10de, 0x03f0, PCI_ANY_ID, PCI_ANY_ID, 0, 0, AZX_DRIVER_NVIDIA }, /* NVIDIA MCP61 */ | 2114 | { PCI_DEVICE(0x1002, 0xaa48), .driver_data = AZX_DRIVER_ATIHDMI }, |
2025 | { 0x10de, 0x044a, PCI_ANY_ID, PCI_ANY_ID, 0, 0, AZX_DRIVER_NVIDIA }, /* NVIDIA MCP65 */ | 2115 | /* VIA VT8251/VT8237A */ |
2026 | { 0x10de, 0x044b, PCI_ANY_ID, PCI_ANY_ID, 0, 0, AZX_DRIVER_NVIDIA }, /* NVIDIA MCP65 */ | 2116 | { PCI_DEVICE(0x1106, 0x3288), .driver_data = AZX_DRIVER_VIA }, |
2027 | { 0x10de, 0x055c, PCI_ANY_ID, PCI_ANY_ID, 0, 0, AZX_DRIVER_NVIDIA }, /* NVIDIA MCP67 */ | 2117 | /* SIS966 */ |
2028 | { 0x10de, 0x055d, PCI_ANY_ID, PCI_ANY_ID, 0, 0, AZX_DRIVER_NVIDIA }, /* NVIDIA MCP67 */ | 2118 | { PCI_DEVICE(0x1039, 0x7502), .driver_data = AZX_DRIVER_SIS }, |
2029 | { 0x10de, 0x07fc, PCI_ANY_ID, PCI_ANY_ID, 0, 0, AZX_DRIVER_NVIDIA }, /* NVIDIA MCP73 */ | 2119 | /* ULI M5461 */ |
2030 | { 0x10de, 0x07fd, PCI_ANY_ID, PCI_ANY_ID, 0, 0, AZX_DRIVER_NVIDIA }, /* NVIDIA MCP73 */ | 2120 | { PCI_DEVICE(0x10b9, 0x5461), .driver_data = AZX_DRIVER_ULI }, |
2031 | { 0x10de, 0x0774, PCI_ANY_ID, PCI_ANY_ID, 0, 0, AZX_DRIVER_NVIDIA }, /* NVIDIA MCP77 */ | 2121 | /* NVIDIA MCP */ |
2032 | { 0x10de, 0x0775, PCI_ANY_ID, PCI_ANY_ID, 0, 0, AZX_DRIVER_NVIDIA }, /* NVIDIA MCP77 */ | 2122 | { PCI_DEVICE(0x10de, 0x026c), .driver_data = AZX_DRIVER_NVIDIA }, |
2033 | { 0x10de, 0x0776, PCI_ANY_ID, PCI_ANY_ID, 0, 0, AZX_DRIVER_NVIDIA }, /* NVIDIA MCP77 */ | 2123 | { PCI_DEVICE(0x10de, 0x0371), .driver_data = AZX_DRIVER_NVIDIA }, |
2034 | { 0x10de, 0x0777, PCI_ANY_ID, PCI_ANY_ID, 0, 0, AZX_DRIVER_NVIDIA }, /* NVIDIA MCP77 */ | 2124 | { PCI_DEVICE(0x10de, 0x03e4), .driver_data = AZX_DRIVER_NVIDIA }, |
2035 | { 0x10de, 0x0ac0, PCI_ANY_ID, PCI_ANY_ID, 0, 0, AZX_DRIVER_NVIDIA }, /* NVIDIA MCP79 */ | 2125 | { PCI_DEVICE(0x10de, 0x03f0), .driver_data = AZX_DRIVER_NVIDIA }, |
2036 | { 0x10de, 0x0ac1, PCI_ANY_ID, PCI_ANY_ID, 0, 0, AZX_DRIVER_NVIDIA }, /* NVIDIA MCP79 */ | 2126 | { PCI_DEVICE(0x10de, 0x044a), .driver_data = AZX_DRIVER_NVIDIA }, |
2037 | { 0x10de, 0x0ac2, PCI_ANY_ID, PCI_ANY_ID, 0, 0, AZX_DRIVER_NVIDIA }, /* NVIDIA MCP79 */ | 2127 | { PCI_DEVICE(0x10de, 0x044b), .driver_data = AZX_DRIVER_NVIDIA }, |
2038 | { 0x10de, 0x0ac3, PCI_ANY_ID, PCI_ANY_ID, 0, 0, AZX_DRIVER_NVIDIA }, /* NVIDIA MCP79 */ | 2128 | { PCI_DEVICE(0x10de, 0x055c), .driver_data = AZX_DRIVER_NVIDIA }, |
2129 | { PCI_DEVICE(0x10de, 0x055d), .driver_data = AZX_DRIVER_NVIDIA }, | ||
2130 | { PCI_DEVICE(0x10de, 0x0774), .driver_data = AZX_DRIVER_NVIDIA }, | ||
2131 | { PCI_DEVICE(0x10de, 0x0775), .driver_data = AZX_DRIVER_NVIDIA }, | ||
2132 | { PCI_DEVICE(0x10de, 0x0776), .driver_data = AZX_DRIVER_NVIDIA }, | ||
2133 | { PCI_DEVICE(0x10de, 0x0777), .driver_data = AZX_DRIVER_NVIDIA }, | ||
2134 | { PCI_DEVICE(0x10de, 0x07fc), .driver_data = AZX_DRIVER_NVIDIA }, | ||
2135 | { PCI_DEVICE(0x10de, 0x07fd), .driver_data = AZX_DRIVER_NVIDIA }, | ||
2136 | { PCI_DEVICE(0x10de, 0x0ac0), .driver_data = AZX_DRIVER_NVIDIA }, | ||
2137 | { PCI_DEVICE(0x10de, 0x0ac1), .driver_data = AZX_DRIVER_NVIDIA }, | ||
2138 | { PCI_DEVICE(0x10de, 0x0ac2), .driver_data = AZX_DRIVER_NVIDIA }, | ||
2139 | { PCI_DEVICE(0x10de, 0x0ac3), .driver_data = AZX_DRIVER_NVIDIA }, | ||
2140 | { PCI_DEVICE(0x10de, 0x0bd4), .driver_data = AZX_DRIVER_NVIDIA }, | ||
2141 | { PCI_DEVICE(0x10de, 0x0bd5), .driver_data = AZX_DRIVER_NVIDIA }, | ||
2142 | { PCI_DEVICE(0x10de, 0x0bd6), .driver_data = AZX_DRIVER_NVIDIA }, | ||
2143 | { PCI_DEVICE(0x10de, 0x0bd7), .driver_data = AZX_DRIVER_NVIDIA }, | ||
2039 | { 0, } | 2144 | { 0, } |
2040 | }; | 2145 | }; |
2041 | MODULE_DEVICE_TABLE(pci, azx_ids); | 2146 | MODULE_DEVICE_TABLE(pci, azx_ids); |
diff --git a/sound/pci/hda/hda_local.h b/sound/pci/hda/hda_local.h index ad0014ab71f9..5c9e578f7f2d 100644 --- a/sound/pci/hda/hda_local.h +++ b/sound/pci/hda/hda_local.h | |||
@@ -228,8 +228,18 @@ struct hda_multi_out { | |||
228 | int max_channels; /* currently supported analog channels */ | 228 | int max_channels; /* currently supported analog channels */ |
229 | int dig_out_used; /* current usage of digital out (HDA_DIG_XXX) */ | 229 | int dig_out_used; /* current usage of digital out (HDA_DIG_XXX) */ |
230 | int no_share_stream; /* don't share a stream with multiple pins */ | 230 | int no_share_stream; /* don't share a stream with multiple pins */ |
231 | int share_spdif; /* share SPDIF pin */ | ||
232 | /* PCM information for both analog and SPDIF DACs */ | ||
233 | unsigned int analog_rates; | ||
234 | unsigned int analog_maxbps; | ||
235 | u64 analog_formats; | ||
236 | unsigned int spdif_rates; | ||
237 | unsigned int spdif_maxbps; | ||
238 | u64 spdif_formats; | ||
231 | }; | 239 | }; |
232 | 240 | ||
241 | int snd_hda_create_spdif_share_sw(struct hda_codec *codec, | ||
242 | struct hda_multi_out *mout); | ||
233 | int snd_hda_multi_out_dig_open(struct hda_codec *codec, | 243 | int snd_hda_multi_out_dig_open(struct hda_codec *codec, |
234 | struct hda_multi_out *mout); | 244 | struct hda_multi_out *mout); |
235 | int snd_hda_multi_out_dig_close(struct hda_codec *codec, | 245 | int snd_hda_multi_out_dig_close(struct hda_codec *codec, |
@@ -241,7 +251,8 @@ int snd_hda_multi_out_dig_prepare(struct hda_codec *codec, | |||
241 | struct snd_pcm_substream *substream); | 251 | struct snd_pcm_substream *substream); |
242 | int snd_hda_multi_out_analog_open(struct hda_codec *codec, | 252 | int snd_hda_multi_out_analog_open(struct hda_codec *codec, |
243 | struct hda_multi_out *mout, | 253 | struct hda_multi_out *mout, |
244 | struct snd_pcm_substream *substream); | 254 | struct snd_pcm_substream *substream, |
255 | struct hda_pcm_stream *hinfo); | ||
245 | int snd_hda_multi_out_analog_prepare(struct hda_codec *codec, | 256 | int snd_hda_multi_out_analog_prepare(struct hda_codec *codec, |
246 | struct hda_multi_out *mout, | 257 | struct hda_multi_out *mout, |
247 | unsigned int stream_tag, | 258 | unsigned int stream_tag, |
@@ -407,11 +418,4 @@ int snd_hda_check_amp_list_power(struct hda_codec *codec, | |||
407 | hda_nid_t nid); | 418 | hda_nid_t nid); |
408 | #endif /* CONFIG_SND_HDA_POWER_SAVE */ | 419 | #endif /* CONFIG_SND_HDA_POWER_SAVE */ |
409 | 420 | ||
410 | /* | ||
411 | * virtual master control | ||
412 | */ | ||
413 | struct snd_kcontrol *snd_ctl_make_virtual_master(char *name, | ||
414 | const unsigned int *tlv); | ||
415 | int snd_ctl_add_slave(struct snd_kcontrol *master, struct snd_kcontrol *slave); | ||
416 | |||
417 | #endif /* __SOUND_HDA_LOCAL_H */ | 421 | #endif /* __SOUND_HDA_LOCAL_H */ |
diff --git a/sound/pci/hda/hda_patch.h b/sound/pci/hda/hda_patch.h index f5c23bb16d7e..2fdf2358dbc2 100644 --- a/sound/pci/hda/hda_patch.h +++ b/sound/pci/hda/hda_patch.h | |||
@@ -18,31 +18,3 @@ extern struct hda_codec_preset snd_hda_preset_atihdmi[]; | |||
18 | extern struct hda_codec_preset snd_hda_preset_conexant[]; | 18 | extern struct hda_codec_preset snd_hda_preset_conexant[]; |
19 | /* VIA codecs */ | 19 | /* VIA codecs */ |
20 | extern struct hda_codec_preset snd_hda_preset_via[]; | 20 | extern struct hda_codec_preset snd_hda_preset_via[]; |
21 | |||
22 | static const struct hda_codec_preset *hda_preset_tables[] = { | ||
23 | #ifdef CONFIG_SND_HDA_CODEC_REALTEK | ||
24 | snd_hda_preset_realtek, | ||
25 | #endif | ||
26 | #ifdef CONFIG_SND_HDA_CODEC_CMEDIA | ||
27 | snd_hda_preset_cmedia, | ||
28 | #endif | ||
29 | #ifdef CONFIG_SND_HDA_CODEC_ANALOG | ||
30 | snd_hda_preset_analog, | ||
31 | #endif | ||
32 | #ifdef CONFIG_SND_HDA_CODEC_SIGMATEL | ||
33 | snd_hda_preset_sigmatel, | ||
34 | #endif | ||
35 | #ifdef CONFIG_SND_HDA_CODEC_SI3054 | ||
36 | snd_hda_preset_si3054, | ||
37 | #endif | ||
38 | #ifdef CONFIG_SND_HDA_CODEC_ATIHDMI | ||
39 | snd_hda_preset_atihdmi, | ||
40 | #endif | ||
41 | #ifdef CONFIG_SND_HDA_CODEC_CONEXANT | ||
42 | snd_hda_preset_conexant, | ||
43 | #endif | ||
44 | #ifdef CONFIG_SND_HDA_CODEC_VIA | ||
45 | snd_hda_preset_via, | ||
46 | #endif | ||
47 | NULL | ||
48 | }; | ||
diff --git a/sound/pci/hda/patch_analog.c b/sound/pci/hda/patch_analog.c index c8649282c2cf..e0a605adde42 100644 --- a/sound/pci/hda/patch_analog.c +++ b/sound/pci/hda/patch_analog.c | |||
@@ -28,6 +28,7 @@ | |||
28 | #include <sound/core.h> | 28 | #include <sound/core.h> |
29 | #include "hda_codec.h" | 29 | #include "hda_codec.h" |
30 | #include "hda_local.h" | 30 | #include "hda_local.h" |
31 | #include "hda_patch.h" | ||
31 | 32 | ||
32 | struct ad198x_spec { | 33 | struct ad198x_spec { |
33 | struct snd_kcontrol_new *mixers[5]; | 34 | struct snd_kcontrol_new *mixers[5]; |
@@ -80,7 +81,6 @@ struct ad198x_spec { | |||
80 | #endif | 81 | #endif |
81 | /* for virtual master */ | 82 | /* for virtual master */ |
82 | hda_nid_t vmaster_nid; | 83 | hda_nid_t vmaster_nid; |
83 | u32 vmaster_tlv[4]; | ||
84 | const char **slave_vols; | 84 | const char **slave_vols; |
85 | const char **slave_sws; | 85 | const char **slave_sws; |
86 | }; | 86 | }; |
@@ -171,6 +171,11 @@ static int ad198x_build_controls(struct hda_codec *codec) | |||
171 | err = snd_hda_create_spdif_out_ctls(codec, spec->multiout.dig_out_nid); | 171 | err = snd_hda_create_spdif_out_ctls(codec, spec->multiout.dig_out_nid); |
172 | if (err < 0) | 172 | if (err < 0) |
173 | return err; | 173 | return err; |
174 | err = snd_hda_create_spdif_share_sw(codec, | ||
175 | &spec->multiout); | ||
176 | if (err < 0) | ||
177 | return err; | ||
178 | spec->multiout.share_spdif = 1; | ||
174 | } | 179 | } |
175 | if (spec->dig_in_nid) { | 180 | if (spec->dig_in_nid) { |
176 | err = snd_hda_create_spdif_in_ctls(codec, spec->dig_in_nid); | 181 | err = snd_hda_create_spdif_in_ctls(codec, spec->dig_in_nid); |
@@ -180,10 +185,11 @@ static int ad198x_build_controls(struct hda_codec *codec) | |||
180 | 185 | ||
181 | /* if we have no master control, let's create it */ | 186 | /* if we have no master control, let's create it */ |
182 | if (!snd_hda_find_mixer_ctl(codec, "Master Playback Volume")) { | 187 | if (!snd_hda_find_mixer_ctl(codec, "Master Playback Volume")) { |
188 | unsigned int vmaster_tlv[4]; | ||
183 | snd_hda_set_vmaster_tlv(codec, spec->vmaster_nid, | 189 | snd_hda_set_vmaster_tlv(codec, spec->vmaster_nid, |
184 | HDA_OUTPUT, spec->vmaster_tlv); | 190 | HDA_OUTPUT, vmaster_tlv); |
185 | err = snd_hda_add_vmaster(codec, "Master Playback Volume", | 191 | err = snd_hda_add_vmaster(codec, "Master Playback Volume", |
186 | spec->vmaster_tlv, | 192 | vmaster_tlv, |
187 | (spec->slave_vols ? | 193 | (spec->slave_vols ? |
188 | spec->slave_vols : ad_slave_vols)); | 194 | spec->slave_vols : ad_slave_vols)); |
189 | if (err < 0) | 195 | if (err < 0) |
@@ -217,7 +223,8 @@ static int ad198x_playback_pcm_open(struct hda_pcm_stream *hinfo, | |||
217 | struct snd_pcm_substream *substream) | 223 | struct snd_pcm_substream *substream) |
218 | { | 224 | { |
219 | struct ad198x_spec *spec = codec->spec; | 225 | struct ad198x_spec *spec = codec->spec; |
220 | return snd_hda_multi_out_analog_open(codec, &spec->multiout, substream); | 226 | return snd_hda_multi_out_analog_open(codec, &spec->multiout, substream, |
227 | hinfo); | ||
221 | } | 228 | } |
222 | 229 | ||
223 | static int ad198x_playback_pcm_prepare(struct hda_pcm_stream *hinfo, | 230 | static int ad198x_playback_pcm_prepare(struct hda_pcm_stream *hinfo, |
@@ -289,8 +296,7 @@ static int ad198x_capture_pcm_cleanup(struct hda_pcm_stream *hinfo, | |||
289 | struct snd_pcm_substream *substream) | 296 | struct snd_pcm_substream *substream) |
290 | { | 297 | { |
291 | struct ad198x_spec *spec = codec->spec; | 298 | struct ad198x_spec *spec = codec->spec; |
292 | snd_hda_codec_setup_stream(codec, spec->adc_nids[substream->number], | 299 | snd_hda_codec_cleanup_stream(codec, spec->adc_nids[substream->number]); |
293 | 0, 0, 0); | ||
294 | return 0; | 300 | return 0; |
295 | } | 301 | } |
296 | 302 | ||
@@ -359,6 +365,7 @@ static int ad198x_build_pcms(struct hda_codec *codec) | |||
359 | info++; | 365 | info++; |
360 | codec->num_pcms++; | 366 | codec->num_pcms++; |
361 | info->name = "AD198x Digital"; | 367 | info->name = "AD198x Digital"; |
368 | info->pcm_type = HDA_PCM_TYPE_SPDIF; | ||
362 | info->stream[SNDRV_PCM_STREAM_PLAYBACK] = ad198x_pcm_digital_playback; | 369 | info->stream[SNDRV_PCM_STREAM_PLAYBACK] = ad198x_pcm_digital_playback; |
363 | info->stream[SNDRV_PCM_STREAM_PLAYBACK].nid = spec->multiout.dig_out_nid; | 370 | info->stream[SNDRV_PCM_STREAM_PLAYBACK].nid = spec->multiout.dig_out_nid; |
364 | if (spec->dig_in_nid) { | 371 | if (spec->dig_in_nid) { |
@@ -611,13 +618,19 @@ static struct hda_input_mux ad1986a_laptop_eapd_capture_source = { | |||
611 | }, | 618 | }, |
612 | }; | 619 | }; |
613 | 620 | ||
621 | static struct hda_input_mux ad1986a_automic_capture_source = { | ||
622 | .num_items = 2, | ||
623 | .items = { | ||
624 | { "Mic", 0x0 }, | ||
625 | { "Mix", 0x5 }, | ||
626 | }, | ||
627 | }; | ||
628 | |||
614 | static struct snd_kcontrol_new ad1986a_laptop_eapd_mixers[] = { | 629 | static struct snd_kcontrol_new ad1986a_laptop_eapd_mixers[] = { |
615 | HDA_BIND_VOL("Master Playback Volume", &ad1986a_laptop_master_vol), | 630 | HDA_BIND_VOL("Master Playback Volume", &ad1986a_laptop_master_vol), |
616 | HDA_BIND_SW("Master Playback Switch", &ad1986a_laptop_master_sw), | 631 | HDA_BIND_SW("Master Playback Switch", &ad1986a_laptop_master_sw), |
617 | HDA_CODEC_VOLUME("PCM Playback Volume", 0x03, 0x0, HDA_OUTPUT), | 632 | HDA_CODEC_VOLUME("PCM Playback Volume", 0x03, 0x0, HDA_OUTPUT), |
618 | HDA_CODEC_MUTE("PCM Playback Switch", 0x03, 0x0, HDA_OUTPUT), | 633 | HDA_CODEC_MUTE("PCM Playback Switch", 0x03, 0x0, HDA_OUTPUT), |
619 | HDA_CODEC_VOLUME("Internal Mic Playback Volume", 0x17, 0x0, HDA_OUTPUT), | ||
620 | HDA_CODEC_MUTE("Internal Mic Playback Switch", 0x17, 0x0, HDA_OUTPUT), | ||
621 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x13, 0x0, HDA_OUTPUT), | 634 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x13, 0x0, HDA_OUTPUT), |
622 | HDA_CODEC_MUTE("Mic Playback Switch", 0x13, 0x0, HDA_OUTPUT), | 635 | HDA_CODEC_MUTE("Mic Playback Switch", 0x13, 0x0, HDA_OUTPUT), |
623 | HDA_CODEC_VOLUME("Mic Boost", 0x0f, 0x0, HDA_OUTPUT), | 636 | HDA_CODEC_VOLUME("Mic Boost", 0x0f, 0x0, HDA_OUTPUT), |
@@ -641,6 +654,33 @@ static struct snd_kcontrol_new ad1986a_laptop_eapd_mixers[] = { | |||
641 | { } /* end */ | 654 | { } /* end */ |
642 | }; | 655 | }; |
643 | 656 | ||
657 | /* re-connect the mic boost input according to the jack sensing */ | ||
658 | static void ad1986a_automic(struct hda_codec *codec) | ||
659 | { | ||
660 | unsigned int present; | ||
661 | present = snd_hda_codec_read(codec, 0x1f, 0, AC_VERB_GET_PIN_SENSE, 0); | ||
662 | /* 0 = 0x1f, 2 = 0x1d, 4 = mixed */ | ||
663 | snd_hda_codec_write(codec, 0x0f, 0, AC_VERB_SET_CONNECT_SEL, | ||
664 | (present & AC_PINSENSE_PRESENCE) ? 0 : 2); | ||
665 | } | ||
666 | |||
667 | #define AD1986A_MIC_EVENT 0x36 | ||
668 | |||
669 | static void ad1986a_automic_unsol_event(struct hda_codec *codec, | ||
670 | unsigned int res) | ||
671 | { | ||
672 | if ((res >> 26) != AD1986A_MIC_EVENT) | ||
673 | return; | ||
674 | ad1986a_automic(codec); | ||
675 | } | ||
676 | |||
677 | static int ad1986a_automic_init(struct hda_codec *codec) | ||
678 | { | ||
679 | ad198x_init(codec); | ||
680 | ad1986a_automic(codec); | ||
681 | return 0; | ||
682 | } | ||
683 | |||
644 | /* laptop-automute - 2ch only */ | 684 | /* laptop-automute - 2ch only */ |
645 | 685 | ||
646 | static void ad1986a_update_hp(struct hda_codec *codec) | 686 | static void ad1986a_update_hp(struct hda_codec *codec) |
@@ -844,6 +884,15 @@ static struct hda_verb ad1986a_eapd_init_verbs[] = { | |||
844 | {} | 884 | {} |
845 | }; | 885 | }; |
846 | 886 | ||
887 | static struct hda_verb ad1986a_automic_verbs[] = { | ||
888 | {0x1d, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80}, | ||
889 | {0x1f, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80}, | ||
890 | /*{0x20, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},*/ | ||
891 | {0x0f, AC_VERB_SET_CONNECT_SEL, 0x0}, | ||
892 | {0x1f, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | AD1986A_MIC_EVENT}, | ||
893 | {} | ||
894 | }; | ||
895 | |||
847 | /* Ultra initialization */ | 896 | /* Ultra initialization */ |
848 | static struct hda_verb ad1986a_ultra_init[] = { | 897 | static struct hda_verb ad1986a_ultra_init[] = { |
849 | /* eapd initialization */ | 898 | /* eapd initialization */ |
@@ -986,14 +1035,17 @@ static int patch_ad1986a(struct hda_codec *codec) | |||
986 | break; | 1035 | break; |
987 | case AD1986A_LAPTOP_EAPD: | 1036 | case AD1986A_LAPTOP_EAPD: |
988 | spec->mixers[0] = ad1986a_laptop_eapd_mixers; | 1037 | spec->mixers[0] = ad1986a_laptop_eapd_mixers; |
989 | spec->num_init_verbs = 2; | 1038 | spec->num_init_verbs = 3; |
990 | spec->init_verbs[1] = ad1986a_eapd_init_verbs; | 1039 | spec->init_verbs[1] = ad1986a_eapd_init_verbs; |
1040 | spec->init_verbs[2] = ad1986a_automic_verbs; | ||
991 | spec->multiout.max_channels = 2; | 1041 | spec->multiout.max_channels = 2; |
992 | spec->multiout.num_dacs = 1; | 1042 | spec->multiout.num_dacs = 1; |
993 | spec->multiout.dac_nids = ad1986a_laptop_dac_nids; | 1043 | spec->multiout.dac_nids = ad1986a_laptop_dac_nids; |
994 | if (!is_jack_available(codec, 0x25)) | 1044 | if (!is_jack_available(codec, 0x25)) |
995 | spec->multiout.dig_out_nid = 0; | 1045 | spec->multiout.dig_out_nid = 0; |
996 | spec->input_mux = &ad1986a_laptop_eapd_capture_source; | 1046 | spec->input_mux = &ad1986a_automic_capture_source; |
1047 | codec->patch_ops.unsol_event = ad1986a_automic_unsol_event; | ||
1048 | codec->patch_ops.init = ad1986a_automic_init; | ||
997 | break; | 1049 | break; |
998 | case AD1986A_LAPTOP_AUTOMUTE: | 1050 | case AD1986A_LAPTOP_AUTOMUTE: |
999 | spec->mixers[0] = ad1986a_laptop_automute_mixers; | 1051 | spec->mixers[0] = ad1986a_laptop_automute_mixers; |
@@ -1365,7 +1417,10 @@ static int ad1981_hp_master_sw_put(struct snd_kcontrol *kcontrol, | |||
1365 | 1417 | ||
1366 | if (! ad198x_eapd_put(kcontrol, ucontrol)) | 1418 | if (! ad198x_eapd_put(kcontrol, ucontrol)) |
1367 | return 0; | 1419 | return 0; |
1368 | 1420 | /* change speaker pin appropriately */ | |
1421 | snd_hda_codec_write(codec, 0x05, 0, | ||
1422 | AC_VERB_SET_PIN_WIDGET_CONTROL, | ||
1423 | spec->cur_eapd ? PIN_OUT : 0); | ||
1369 | /* toggle HP mute appropriately */ | 1424 | /* toggle HP mute appropriately */ |
1370 | snd_hda_codec_amp_stereo(codec, 0x06, HDA_OUTPUT, 0, | 1425 | snd_hda_codec_amp_stereo(codec, 0x06, HDA_OUTPUT, 0, |
1371 | HDA_AMP_MUTE, | 1426 | HDA_AMP_MUTE, |
@@ -2087,6 +2142,10 @@ static struct snd_kcontrol_new ad1988_spdif_in_mixers[] = { | |||
2087 | { } /* end */ | 2142 | { } /* end */ |
2088 | }; | 2143 | }; |
2089 | 2144 | ||
2145 | static struct snd_kcontrol_new ad1989_spdif_out_mixers[] = { | ||
2146 | HDA_CODEC_VOLUME("IEC958 Playback Volume", 0x1b, 0x0, HDA_OUTPUT), | ||
2147 | { } /* end */ | ||
2148 | }; | ||
2090 | 2149 | ||
2091 | /* | 2150 | /* |
2092 | * initialization verbs | 2151 | * initialization verbs |
@@ -2187,6 +2246,13 @@ static struct hda_verb ad1988_spdif_init_verbs[] = { | |||
2187 | { } | 2246 | { } |
2188 | }; | 2247 | }; |
2189 | 2248 | ||
2249 | /* AD1989 has no ADC -> SPDIF route */ | ||
2250 | static struct hda_verb ad1989_spdif_init_verbs[] = { | ||
2251 | /* SPDIF out pin */ | ||
2252 | {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE | 0x27}, /* 0dB */ | ||
2253 | { } | ||
2254 | }; | ||
2255 | |||
2190 | /* | 2256 | /* |
2191 | * verbs for 3stack (+dig) | 2257 | * verbs for 3stack (+dig) |
2192 | */ | 2258 | */ |
@@ -2894,10 +2960,19 @@ static int patch_ad1988(struct hda_codec *codec) | |||
2894 | spec->mixers[spec->num_mixers++] = ad1988_capture_mixers; | 2960 | spec->mixers[spec->num_mixers++] = ad1988_capture_mixers; |
2895 | spec->init_verbs[spec->num_init_verbs++] = ad1988_capture_init_verbs; | 2961 | spec->init_verbs[spec->num_init_verbs++] = ad1988_capture_init_verbs; |
2896 | if (spec->multiout.dig_out_nid) { | 2962 | if (spec->multiout.dig_out_nid) { |
2897 | spec->mixers[spec->num_mixers++] = ad1988_spdif_out_mixers; | 2963 | if (codec->vendor_id >= 0x11d4989a) { |
2898 | spec->init_verbs[spec->num_init_verbs++] = ad1988_spdif_init_verbs; | 2964 | spec->mixers[spec->num_mixers++] = |
2965 | ad1989_spdif_out_mixers; | ||
2966 | spec->init_verbs[spec->num_init_verbs++] = | ||
2967 | ad1989_spdif_init_verbs; | ||
2968 | } else { | ||
2969 | spec->mixers[spec->num_mixers++] = | ||
2970 | ad1988_spdif_out_mixers; | ||
2971 | spec->init_verbs[spec->num_init_verbs++] = | ||
2972 | ad1988_spdif_init_verbs; | ||
2973 | } | ||
2899 | } | 2974 | } |
2900 | if (spec->dig_in_nid) | 2975 | if (spec->dig_in_nid && codec->vendor_id < 0x11d4989a) |
2901 | spec->mixers[spec->num_mixers++] = ad1988_spdif_in_mixers; | 2976 | spec->mixers[spec->num_mixers++] = ad1988_spdif_in_mixers; |
2902 | 2977 | ||
2903 | codec->patch_ops = ad198x_patch_ops; | 2978 | codec->patch_ops = ad198x_patch_ops; |
@@ -3133,11 +3208,12 @@ static int patch_ad1884(struct hda_codec *codec) | |||
3133 | * Lenovo Thinkpad T61/X61 | 3208 | * Lenovo Thinkpad T61/X61 |
3134 | */ | 3209 | */ |
3135 | static struct hda_input_mux ad1984_thinkpad_capture_source = { | 3210 | static struct hda_input_mux ad1984_thinkpad_capture_source = { |
3136 | .num_items = 3, | 3211 | .num_items = 4, |
3137 | .items = { | 3212 | .items = { |
3138 | { "Mic", 0x0 }, | 3213 | { "Mic", 0x0 }, |
3139 | { "Internal Mic", 0x1 }, | 3214 | { "Internal Mic", 0x1 }, |
3140 | { "Mix", 0x3 }, | 3215 | { "Mix", 0x3 }, |
3216 | { "Docking-Station", 0x4 }, | ||
3141 | }, | 3217 | }, |
3142 | }; | 3218 | }; |
3143 | 3219 | ||
@@ -3268,8 +3344,7 @@ static int ad1984_pcm_dmic_cleanup(struct hda_pcm_stream *hinfo, | |||
3268 | struct hda_codec *codec, | 3344 | struct hda_codec *codec, |
3269 | struct snd_pcm_substream *substream) | 3345 | struct snd_pcm_substream *substream) |
3270 | { | 3346 | { |
3271 | snd_hda_codec_setup_stream(codec, 0x05 + substream->number, | 3347 | snd_hda_codec_cleanup_stream(codec, 0x05 + substream->number); |
3272 | 0, 0, 0); | ||
3273 | return 0; | 3348 | return 0; |
3274 | } | 3349 | } |
3275 | 3350 | ||
@@ -3356,6 +3431,472 @@ static int patch_ad1984(struct hda_codec *codec) | |||
3356 | 3431 | ||
3357 | 3432 | ||
3358 | /* | 3433 | /* |
3434 | * AD1883 / AD1884A / AD1984A / AD1984B | ||
3435 | * | ||
3436 | * port-B (0x14) - front mic-in | ||
3437 | * port-E (0x1c) - rear mic-in | ||
3438 | * port-F (0x16) - CD / ext out | ||
3439 | * port-C (0x15) - rear line-in | ||
3440 | * port-D (0x12) - rear line-out | ||
3441 | * port-A (0x11) - front hp-out | ||
3442 | * | ||
3443 | * AD1984A = AD1884A + digital-mic | ||
3444 | * AD1883 = equivalent with AD1984A | ||
3445 | * AD1984B = AD1984A + extra SPDIF-out | ||
3446 | * | ||
3447 | * FIXME: | ||
3448 | * We share the single DAC for both HP and line-outs (see AD1884/1984). | ||
3449 | */ | ||
3450 | |||
3451 | static hda_nid_t ad1884a_dac_nids[1] = { | ||
3452 | 0x03, | ||
3453 | }; | ||
3454 | |||
3455 | #define ad1884a_adc_nids ad1884_adc_nids | ||
3456 | #define ad1884a_capsrc_nids ad1884_capsrc_nids | ||
3457 | |||
3458 | #define AD1884A_SPDIF_OUT 0x02 | ||
3459 | |||
3460 | static struct hda_input_mux ad1884a_capture_source = { | ||
3461 | .num_items = 5, | ||
3462 | .items = { | ||
3463 | { "Front Mic", 0x0 }, | ||
3464 | { "Mic", 0x4 }, | ||
3465 | { "Line", 0x1 }, | ||
3466 | { "CD", 0x2 }, | ||
3467 | { "Mix", 0x3 }, | ||
3468 | }, | ||
3469 | }; | ||
3470 | |||
3471 | static struct snd_kcontrol_new ad1884a_base_mixers[] = { | ||
3472 | HDA_CODEC_VOLUME("Master Playback Volume", 0x21, 0x0, HDA_OUTPUT), | ||
3473 | HDA_CODEC_MUTE("Master Playback Switch", 0x21, 0x0, HDA_OUTPUT), | ||
3474 | HDA_CODEC_MUTE("Headphone Playback Switch", 0x11, 0x0, HDA_OUTPUT), | ||
3475 | HDA_CODEC_MUTE("Front Playback Switch", 0x12, 0x0, HDA_OUTPUT), | ||
3476 | HDA_CODEC_VOLUME_MONO("Mono Playback Volume", 0x13, 1, 0x0, HDA_OUTPUT), | ||
3477 | HDA_CODEC_MUTE_MONO("Mono Playback Switch", 0x13, 1, 0x0, HDA_OUTPUT), | ||
3478 | HDA_CODEC_VOLUME("PCM Playback Volume", 0x20, 0x5, HDA_INPUT), | ||
3479 | HDA_CODEC_MUTE("PCM Playback Switch", 0x20, 0x5, HDA_INPUT), | ||
3480 | HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x20, 0x00, HDA_INPUT), | ||
3481 | HDA_CODEC_MUTE("Front Mic Playback Switch", 0x20, 0x00, HDA_INPUT), | ||
3482 | HDA_CODEC_VOLUME("Line Playback Volume", 0x20, 0x01, HDA_INPUT), | ||
3483 | HDA_CODEC_MUTE("Line Playback Switch", 0x20, 0x01, HDA_INPUT), | ||
3484 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x20, 0x04, HDA_INPUT), | ||
3485 | HDA_CODEC_MUTE("Mic Playback Switch", 0x20, 0x04, HDA_INPUT), | ||
3486 | HDA_CODEC_VOLUME("CD Playback Volume", 0x20, 0x02, HDA_INPUT), | ||
3487 | HDA_CODEC_MUTE("CD Playback Switch", 0x20, 0x02, HDA_INPUT), | ||
3488 | HDA_CODEC_VOLUME("Beep Playback Volume", 0x20, 0x03, HDA_INPUT), | ||
3489 | HDA_CODEC_MUTE("Beep Playback Switch", 0x20, 0x03, HDA_INPUT), | ||
3490 | HDA_CODEC_VOLUME("Front Mic Boost", 0x14, 0x0, HDA_INPUT), | ||
3491 | HDA_CODEC_VOLUME("Line Boost", 0x15, 0x0, HDA_INPUT), | ||
3492 | HDA_CODEC_VOLUME("Mic Boost", 0x25, 0x0, HDA_OUTPUT), | ||
3493 | HDA_CODEC_VOLUME("Capture Volume", 0x0c, 0x0, HDA_OUTPUT), | ||
3494 | HDA_CODEC_MUTE("Capture Switch", 0x0c, 0x0, HDA_OUTPUT), | ||
3495 | HDA_CODEC_VOLUME_IDX("Capture Volume", 1, 0x0d, 0x0, HDA_OUTPUT), | ||
3496 | HDA_CODEC_MUTE_IDX("Capture Switch", 1, 0x0d, 0x0, HDA_OUTPUT), | ||
3497 | { | ||
3498 | .iface = SNDRV_CTL_ELEM_IFACE_MIXER, | ||
3499 | /* The multiple "Capture Source" controls confuse alsamixer | ||
3500 | * So call somewhat different.. | ||
3501 | */ | ||
3502 | /* .name = "Capture Source", */ | ||
3503 | .name = "Input Source", | ||
3504 | .count = 2, | ||
3505 | .info = ad198x_mux_enum_info, | ||
3506 | .get = ad198x_mux_enum_get, | ||
3507 | .put = ad198x_mux_enum_put, | ||
3508 | }, | ||
3509 | /* SPDIF controls */ | ||
3510 | HDA_CODEC_VOLUME("IEC958 Playback Volume", 0x1b, 0x0, HDA_OUTPUT), | ||
3511 | { | ||
3512 | .iface = SNDRV_CTL_ELEM_IFACE_MIXER, | ||
3513 | .name = SNDRV_CTL_NAME_IEC958("",PLAYBACK,NONE) "Source", | ||
3514 | /* identical with ad1983 */ | ||
3515 | .info = ad1983_spdif_route_info, | ||
3516 | .get = ad1983_spdif_route_get, | ||
3517 | .put = ad1983_spdif_route_put, | ||
3518 | }, | ||
3519 | { } /* end */ | ||
3520 | }; | ||
3521 | |||
3522 | /* | ||
3523 | * initialization verbs | ||
3524 | */ | ||
3525 | static struct hda_verb ad1884a_init_verbs[] = { | ||
3526 | /* DACs; unmute as default */ | ||
3527 | {0x03, AC_VERB_SET_AMP_GAIN_MUTE, 0x27}, /* 0dB */ | ||
3528 | {0x04, AC_VERB_SET_AMP_GAIN_MUTE, 0x27}, /* 0dB */ | ||
3529 | /* Port-A (HP) mixer - route only from analog mixer */ | ||
3530 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, | ||
3531 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, | ||
3532 | /* Port-A pin */ | ||
3533 | {0x11, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, | ||
3534 | {0x11, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, | ||
3535 | /* Port-D (Line-out) mixer - route only from analog mixer */ | ||
3536 | {0x0a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, | ||
3537 | {0x0a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, | ||
3538 | /* Port-D pin */ | ||
3539 | {0x12, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, | ||
3540 | {0x12, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, | ||
3541 | /* Mono-out mixer - route only from analog mixer */ | ||
3542 | {0x1e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, | ||
3543 | {0x1e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, | ||
3544 | /* Mono-out pin */ | ||
3545 | {0x13, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, | ||
3546 | {0x13, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, | ||
3547 | /* Port-B (front mic) pin */ | ||
3548 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80}, | ||
3549 | {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, | ||
3550 | /* Port-C (rear line-in) pin */ | ||
3551 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, | ||
3552 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, | ||
3553 | /* Port-E (rear mic) pin */ | ||
3554 | {0x1c, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80}, | ||
3555 | {0x1c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, | ||
3556 | {0x25, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, /* no boost */ | ||
3557 | /* Port-F (CD) pin */ | ||
3558 | {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, | ||
3559 | {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, | ||
3560 | /* Analog mixer; mute as default */ | ||
3561 | {0x20, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, | ||
3562 | {0x20, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, | ||
3563 | {0x20, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)}, | ||
3564 | {0x20, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)}, | ||
3565 | {0x20, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(4)}, /* aux */ | ||
3566 | {0x20, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(5)}, | ||
3567 | /* Analog Mix output amp */ | ||
3568 | {0x21, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, | ||
3569 | /* capture sources */ | ||
3570 | {0x0c, AC_VERB_SET_CONNECT_SEL, 0x0}, | ||
3571 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, | ||
3572 | {0x0d, AC_VERB_SET_CONNECT_SEL, 0x0}, | ||
3573 | {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, | ||
3574 | /* SPDIF output amp */ | ||
3575 | {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE | 0x27}, /* 0dB */ | ||
3576 | { } /* end */ | ||
3577 | }; | ||
3578 | |||
3579 | #ifdef CONFIG_SND_HDA_POWER_SAVE | ||
3580 | static struct hda_amp_list ad1884a_loopbacks[] = { | ||
3581 | { 0x20, HDA_INPUT, 0 }, /* Front Mic */ | ||
3582 | { 0x20, HDA_INPUT, 1 }, /* Mic */ | ||
3583 | { 0x20, HDA_INPUT, 2 }, /* CD */ | ||
3584 | { 0x20, HDA_INPUT, 4 }, /* Docking */ | ||
3585 | { } /* end */ | ||
3586 | }; | ||
3587 | #endif | ||
3588 | |||
3589 | /* | ||
3590 | * Laptop model | ||
3591 | * | ||
3592 | * Port A: Headphone jack | ||
3593 | * Port B: MIC jack | ||
3594 | * Port C: Internal MIC | ||
3595 | * Port D: Dock Line Out (if enabled) | ||
3596 | * Port E: Dock Line In (if enabled) | ||
3597 | * Port F: Internal speakers | ||
3598 | */ | ||
3599 | |||
3600 | static struct hda_input_mux ad1884a_laptop_capture_source = { | ||
3601 | .num_items = 4, | ||
3602 | .items = { | ||
3603 | { "Mic", 0x0 }, /* port-B */ | ||
3604 | { "Internal Mic", 0x1 }, /* port-C */ | ||
3605 | { "Dock Mic", 0x4 }, /* port-E */ | ||
3606 | { "Mix", 0x3 }, | ||
3607 | }, | ||
3608 | }; | ||
3609 | |||
3610 | static struct snd_kcontrol_new ad1884a_laptop_mixers[] = { | ||
3611 | HDA_CODEC_VOLUME("Master Playback Volume", 0x21, 0x0, HDA_OUTPUT), | ||
3612 | HDA_CODEC_MUTE("Master Playback Switch", 0x21, 0x0, HDA_OUTPUT), | ||
3613 | HDA_CODEC_MUTE("Dock Playback Switch", 0x12, 0x0, HDA_OUTPUT), | ||
3614 | HDA_CODEC_VOLUME("PCM Playback Volume", 0x20, 0x5, HDA_INPUT), | ||
3615 | HDA_CODEC_MUTE("PCM Playback Switch", 0x20, 0x5, HDA_INPUT), | ||
3616 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x20, 0x00, HDA_INPUT), | ||
3617 | HDA_CODEC_MUTE("Mic Playback Switch", 0x20, 0x00, HDA_INPUT), | ||
3618 | HDA_CODEC_VOLUME("Internal Mic Playback Volume", 0x20, 0x01, HDA_INPUT), | ||
3619 | HDA_CODEC_MUTE("Internal Mic Playback Switch", 0x20, 0x01, HDA_INPUT), | ||
3620 | HDA_CODEC_VOLUME("Dock Mic Playback Volume", 0x20, 0x04, HDA_INPUT), | ||
3621 | HDA_CODEC_MUTE("Dock Mic Playback Switch", 0x20, 0x04, HDA_INPUT), | ||
3622 | HDA_CODEC_VOLUME("Beep Playback Volume", 0x20, 0x03, HDA_INPUT), | ||
3623 | HDA_CODEC_MUTE("Beep Playback Switch", 0x20, 0x03, HDA_INPUT), | ||
3624 | HDA_CODEC_VOLUME("Mic Boost", 0x14, 0x0, HDA_INPUT), | ||
3625 | HDA_CODEC_VOLUME("Internal Mic Boost", 0x15, 0x0, HDA_INPUT), | ||
3626 | HDA_CODEC_VOLUME("Dock Mic Boost", 0x25, 0x0, HDA_OUTPUT), | ||
3627 | HDA_CODEC_VOLUME("Capture Volume", 0x0c, 0x0, HDA_OUTPUT), | ||
3628 | HDA_CODEC_MUTE("Capture Switch", 0x0c, 0x0, HDA_OUTPUT), | ||
3629 | HDA_CODEC_VOLUME_IDX("Capture Volume", 1, 0x0d, 0x0, HDA_OUTPUT), | ||
3630 | HDA_CODEC_MUTE_IDX("Capture Switch", 1, 0x0d, 0x0, HDA_OUTPUT), | ||
3631 | { | ||
3632 | .iface = SNDRV_CTL_ELEM_IFACE_MIXER, | ||
3633 | /* The multiple "Capture Source" controls confuse alsamixer | ||
3634 | * So call somewhat different.. | ||
3635 | */ | ||
3636 | /* .name = "Capture Source", */ | ||
3637 | .name = "Input Source", | ||
3638 | .count = 2, | ||
3639 | .info = ad198x_mux_enum_info, | ||
3640 | .get = ad198x_mux_enum_get, | ||
3641 | .put = ad198x_mux_enum_put, | ||
3642 | }, | ||
3643 | { } /* end */ | ||
3644 | }; | ||
3645 | |||
3646 | static struct hda_input_mux ad1884a_mobile_capture_source = { | ||
3647 | .num_items = 2, | ||
3648 | .items = { | ||
3649 | { "Mic", 0x1 }, /* port-C */ | ||
3650 | { "Mix", 0x3 }, | ||
3651 | }, | ||
3652 | }; | ||
3653 | |||
3654 | static struct snd_kcontrol_new ad1884a_mobile_mixers[] = { | ||
3655 | HDA_CODEC_VOLUME("Master Playback Volume", 0x21, 0x0, HDA_OUTPUT), | ||
3656 | HDA_CODEC_MUTE("Master Playback Switch", 0x21, 0x0, HDA_OUTPUT), | ||
3657 | HDA_CODEC_VOLUME("PCM Playback Volume", 0x20, 0x5, HDA_INPUT), | ||
3658 | HDA_CODEC_MUTE("PCM Playback Switch", 0x20, 0x5, HDA_INPUT), | ||
3659 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x20, 0x01, HDA_INPUT), | ||
3660 | HDA_CODEC_MUTE("Mic Playback Switch", 0x20, 0x01, HDA_INPUT), | ||
3661 | HDA_CODEC_VOLUME("Beep Playback Volume", 0x20, 0x03, HDA_INPUT), | ||
3662 | HDA_CODEC_MUTE("Beep Playback Switch", 0x20, 0x03, HDA_INPUT), | ||
3663 | HDA_CODEC_VOLUME("Mic Boost", 0x15, 0x0, HDA_INPUT), | ||
3664 | HDA_CODEC_VOLUME("Capture Volume", 0x0c, 0x0, HDA_OUTPUT), | ||
3665 | HDA_CODEC_MUTE("Capture Switch", 0x0c, 0x0, HDA_OUTPUT), | ||
3666 | { | ||
3667 | .iface = SNDRV_CTL_ELEM_IFACE_MIXER, | ||
3668 | .name = "Capture Source", | ||
3669 | .info = ad198x_mux_enum_info, | ||
3670 | .get = ad198x_mux_enum_get, | ||
3671 | .put = ad198x_mux_enum_put, | ||
3672 | }, | ||
3673 | { } /* end */ | ||
3674 | }; | ||
3675 | |||
3676 | /* mute internal speaker if HP is plugged */ | ||
3677 | static void ad1884a_hp_automute(struct hda_codec *codec) | ||
3678 | { | ||
3679 | unsigned int present; | ||
3680 | |||
3681 | present = snd_hda_codec_read(codec, 0x11, 0, | ||
3682 | AC_VERB_GET_PIN_SENSE, 0) & 0x80000000; | ||
3683 | snd_hda_codec_amp_stereo(codec, 0x16, HDA_OUTPUT, 0, | ||
3684 | HDA_AMP_MUTE, present ? HDA_AMP_MUTE : 0); | ||
3685 | snd_hda_codec_write(codec, 0x16, 0, AC_VERB_SET_EAPD_BTLENABLE, | ||
3686 | present ? 0x00 : 0x02); | ||
3687 | } | ||
3688 | |||
3689 | #define AD1884A_HP_EVENT 0x37 | ||
3690 | |||
3691 | /* unsolicited event for HP jack sensing */ | ||
3692 | static void ad1884a_hp_unsol_event(struct hda_codec *codec, unsigned int res) | ||
3693 | { | ||
3694 | if ((res >> 26) != AD1884A_HP_EVENT) | ||
3695 | return; | ||
3696 | ad1884a_hp_automute(codec); | ||
3697 | } | ||
3698 | |||
3699 | /* initialize jack-sensing, too */ | ||
3700 | static int ad1884a_hp_init(struct hda_codec *codec) | ||
3701 | { | ||
3702 | ad198x_init(codec); | ||
3703 | ad1884a_hp_automute(codec); | ||
3704 | return 0; | ||
3705 | } | ||
3706 | |||
3707 | /* additional verbs for laptop model */ | ||
3708 | static struct hda_verb ad1884a_laptop_verbs[] = { | ||
3709 | /* Port-A (HP) pin - always unmuted */ | ||
3710 | {0x11, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, | ||
3711 | /* Port-F (int speaker) mixer - route only from analog mixer */ | ||
3712 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, | ||
3713 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, | ||
3714 | /* Port-F pin */ | ||
3715 | {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, | ||
3716 | {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, | ||
3717 | /* analog mix */ | ||
3718 | {0x20, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)}, | ||
3719 | /* unsolicited event for pin-sense */ | ||
3720 | {0x11, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | AD1884A_HP_EVENT}, | ||
3721 | { } /* end */ | ||
3722 | }; | ||
3723 | |||
3724 | /* | ||
3725 | * Thinkpad X300 | ||
3726 | * 0x11 - HP | ||
3727 | * 0x12 - speaker | ||
3728 | * 0x14 - mic-in | ||
3729 | * 0x17 - built-in mic | ||
3730 | */ | ||
3731 | |||
3732 | static struct hda_verb ad1984a_thinkpad_verbs[] = { | ||
3733 | /* HP unmute */ | ||
3734 | {0x11, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, | ||
3735 | /* analog mix */ | ||
3736 | {0x20, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)}, | ||
3737 | /* turn on EAPD */ | ||
3738 | {0x12, AC_VERB_SET_EAPD_BTLENABLE, 0x02}, | ||
3739 | /* unsolicited event for pin-sense */ | ||
3740 | {0x11, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | AD1884A_HP_EVENT}, | ||
3741 | /* internal mic - dmic */ | ||
3742 | {0x17, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, | ||
3743 | /* set magic COEFs for dmic */ | ||
3744 | {0x01, AC_VERB_SET_COEF_INDEX, 0x13f7}, | ||
3745 | {0x01, AC_VERB_SET_PROC_COEF, 0x08}, | ||
3746 | { } /* end */ | ||
3747 | }; | ||
3748 | |||
3749 | static struct snd_kcontrol_new ad1984a_thinkpad_mixers[] = { | ||
3750 | HDA_CODEC_VOLUME("Master Playback Volume", 0x21, 0x0, HDA_OUTPUT), | ||
3751 | HDA_CODEC_MUTE("Master Playback Switch", 0x21, 0x0, HDA_OUTPUT), | ||
3752 | HDA_CODEC_VOLUME("PCM Playback Volume", 0x20, 0x5, HDA_INPUT), | ||
3753 | HDA_CODEC_MUTE("PCM Playback Switch", 0x20, 0x5, HDA_INPUT), | ||
3754 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x20, 0x00, HDA_INPUT), | ||
3755 | HDA_CODEC_MUTE("Mic Playback Switch", 0x20, 0x00, HDA_INPUT), | ||
3756 | HDA_CODEC_VOLUME("Beep Playback Volume", 0x20, 0x03, HDA_INPUT), | ||
3757 | HDA_CODEC_MUTE("Beep Playback Switch", 0x20, 0x03, HDA_INPUT), | ||
3758 | HDA_CODEC_VOLUME("Mic Boost", 0x14, 0x0, HDA_INPUT), | ||
3759 | HDA_CODEC_VOLUME("Internal Mic Boost", 0x17, 0x0, HDA_INPUT), | ||
3760 | HDA_CODEC_VOLUME("Capture Volume", 0x0c, 0x0, HDA_OUTPUT), | ||
3761 | HDA_CODEC_MUTE("Capture Switch", 0x0c, 0x0, HDA_OUTPUT), | ||
3762 | { | ||
3763 | .iface = SNDRV_CTL_ELEM_IFACE_MIXER, | ||
3764 | .name = "Capture Source", | ||
3765 | .info = ad198x_mux_enum_info, | ||
3766 | .get = ad198x_mux_enum_get, | ||
3767 | .put = ad198x_mux_enum_put, | ||
3768 | }, | ||
3769 | { } /* end */ | ||
3770 | }; | ||
3771 | |||
3772 | static struct hda_input_mux ad1984a_thinkpad_capture_source = { | ||
3773 | .num_items = 3, | ||
3774 | .items = { | ||
3775 | { "Mic", 0x0 }, | ||
3776 | { "Internal Mic", 0x5 }, | ||
3777 | { "Mix", 0x3 }, | ||
3778 | }, | ||
3779 | }; | ||
3780 | |||
3781 | /* mute internal speaker if HP is plugged */ | ||
3782 | static void ad1984a_thinkpad_automute(struct hda_codec *codec) | ||
3783 | { | ||
3784 | unsigned int present; | ||
3785 | |||
3786 | present = snd_hda_codec_read(codec, 0x11, 0, AC_VERB_GET_PIN_SENSE, 0) | ||
3787 | & AC_PINSENSE_PRESENCE; | ||
3788 | snd_hda_codec_amp_stereo(codec, 0x12, HDA_OUTPUT, 0, | ||
3789 | HDA_AMP_MUTE, present ? HDA_AMP_MUTE : 0); | ||
3790 | } | ||
3791 | |||
3792 | /* unsolicited event for HP jack sensing */ | ||
3793 | static void ad1984a_thinkpad_unsol_event(struct hda_codec *codec, | ||
3794 | unsigned int res) | ||
3795 | { | ||
3796 | if ((res >> 26) != AD1884A_HP_EVENT) | ||
3797 | return; | ||
3798 | ad1984a_thinkpad_automute(codec); | ||
3799 | } | ||
3800 | |||
3801 | /* initialize jack-sensing, too */ | ||
3802 | static int ad1984a_thinkpad_init(struct hda_codec *codec) | ||
3803 | { | ||
3804 | ad198x_init(codec); | ||
3805 | ad1984a_thinkpad_automute(codec); | ||
3806 | return 0; | ||
3807 | } | ||
3808 | |||
3809 | /* | ||
3810 | */ | ||
3811 | |||
3812 | enum { | ||
3813 | AD1884A_DESKTOP, | ||
3814 | AD1884A_LAPTOP, | ||
3815 | AD1884A_MOBILE, | ||
3816 | AD1884A_THINKPAD, | ||
3817 | AD1884A_MODELS | ||
3818 | }; | ||
3819 | |||
3820 | static const char *ad1884a_models[AD1884A_MODELS] = { | ||
3821 | [AD1884A_DESKTOP] = "desktop", | ||
3822 | [AD1884A_LAPTOP] = "laptop", | ||
3823 | [AD1884A_MOBILE] = "mobile", | ||
3824 | [AD1884A_THINKPAD] = "thinkpad", | ||
3825 | }; | ||
3826 | |||
3827 | static struct snd_pci_quirk ad1884a_cfg_tbl[] = { | ||
3828 | SND_PCI_QUIRK(0x103c, 0x3030, "HP", AD1884A_MOBILE), | ||
3829 | SND_PCI_QUIRK(0x17aa, 0x20ac, "Thinkpad X300", AD1884A_THINKPAD), | ||
3830 | {} | ||
3831 | }; | ||
3832 | |||
3833 | static int patch_ad1884a(struct hda_codec *codec) | ||
3834 | { | ||
3835 | struct ad198x_spec *spec; | ||
3836 | int board_config; | ||
3837 | |||
3838 | spec = kzalloc(sizeof(*spec), GFP_KERNEL); | ||
3839 | if (spec == NULL) | ||
3840 | return -ENOMEM; | ||
3841 | |||
3842 | mutex_init(&spec->amp_mutex); | ||
3843 | codec->spec = spec; | ||
3844 | |||
3845 | spec->multiout.max_channels = 2; | ||
3846 | spec->multiout.num_dacs = ARRAY_SIZE(ad1884a_dac_nids); | ||
3847 | spec->multiout.dac_nids = ad1884a_dac_nids; | ||
3848 | spec->multiout.dig_out_nid = AD1884A_SPDIF_OUT; | ||
3849 | spec->num_adc_nids = ARRAY_SIZE(ad1884a_adc_nids); | ||
3850 | spec->adc_nids = ad1884a_adc_nids; | ||
3851 | spec->capsrc_nids = ad1884a_capsrc_nids; | ||
3852 | spec->input_mux = &ad1884a_capture_source; | ||
3853 | spec->num_mixers = 1; | ||
3854 | spec->mixers[0] = ad1884a_base_mixers; | ||
3855 | spec->num_init_verbs = 1; | ||
3856 | spec->init_verbs[0] = ad1884a_init_verbs; | ||
3857 | spec->spdif_route = 0; | ||
3858 | #ifdef CONFIG_SND_HDA_POWER_SAVE | ||
3859 | spec->loopback.amplist = ad1884a_loopbacks; | ||
3860 | #endif | ||
3861 | codec->patch_ops = ad198x_patch_ops; | ||
3862 | |||
3863 | /* override some parameters */ | ||
3864 | board_config = snd_hda_check_board_config(codec, AD1884A_MODELS, | ||
3865 | ad1884a_models, | ||
3866 | ad1884a_cfg_tbl); | ||
3867 | switch (board_config) { | ||
3868 | case AD1884A_LAPTOP: | ||
3869 | spec->mixers[0] = ad1884a_laptop_mixers; | ||
3870 | spec->init_verbs[spec->num_init_verbs++] = ad1884a_laptop_verbs; | ||
3871 | spec->multiout.dig_out_nid = 0; | ||
3872 | spec->input_mux = &ad1884a_laptop_capture_source; | ||
3873 | codec->patch_ops.unsol_event = ad1884a_hp_unsol_event; | ||
3874 | codec->patch_ops.init = ad1884a_hp_init; | ||
3875 | break; | ||
3876 | case AD1884A_MOBILE: | ||
3877 | spec->mixers[0] = ad1884a_mobile_mixers; | ||
3878 | spec->init_verbs[spec->num_init_verbs++] = ad1884a_laptop_verbs; | ||
3879 | spec->multiout.dig_out_nid = 0; | ||
3880 | spec->input_mux = &ad1884a_mobile_capture_source; | ||
3881 | codec->patch_ops.unsol_event = ad1884a_hp_unsol_event; | ||
3882 | codec->patch_ops.init = ad1884a_hp_init; | ||
3883 | break; | ||
3884 | case AD1884A_THINKPAD: | ||
3885 | spec->mixers[0] = ad1984a_thinkpad_mixers; | ||
3886 | spec->init_verbs[spec->num_init_verbs++] = | ||
3887 | ad1984a_thinkpad_verbs; | ||
3888 | spec->multiout.dig_out_nid = 0; | ||
3889 | spec->input_mux = &ad1984a_thinkpad_capture_source; | ||
3890 | codec->patch_ops.unsol_event = ad1984a_thinkpad_unsol_event; | ||
3891 | codec->patch_ops.init = ad1984a_thinkpad_init; | ||
3892 | break; | ||
3893 | } | ||
3894 | |||
3895 | return 0; | ||
3896 | } | ||
3897 | |||
3898 | |||
3899 | /* | ||
3359 | * AD1882 | 3900 | * AD1882 |
3360 | * | 3901 | * |
3361 | * port-A - front hp-out | 3902 | * port-A - front hp-out |
@@ -3654,13 +4195,19 @@ static int patch_ad1882(struct hda_codec *codec) | |||
3654 | * patch entries | 4195 | * patch entries |
3655 | */ | 4196 | */ |
3656 | struct hda_codec_preset snd_hda_preset_analog[] = { | 4197 | struct hda_codec_preset snd_hda_preset_analog[] = { |
4198 | { .id = 0x11d4184a, .name = "AD1884A", .patch = patch_ad1884a }, | ||
3657 | { .id = 0x11d41882, .name = "AD1882", .patch = patch_ad1882 }, | 4199 | { .id = 0x11d41882, .name = "AD1882", .patch = patch_ad1882 }, |
4200 | { .id = 0x11d41883, .name = "AD1883", .patch = patch_ad1884a }, | ||
3658 | { .id = 0x11d41884, .name = "AD1884", .patch = patch_ad1884 }, | 4201 | { .id = 0x11d41884, .name = "AD1884", .patch = patch_ad1884 }, |
4202 | { .id = 0x11d4194a, .name = "AD1984A", .patch = patch_ad1884a }, | ||
4203 | { .id = 0x11d4194b, .name = "AD1984B", .patch = patch_ad1884a }, | ||
3659 | { .id = 0x11d41981, .name = "AD1981", .patch = patch_ad1981 }, | 4204 | { .id = 0x11d41981, .name = "AD1981", .patch = patch_ad1981 }, |
3660 | { .id = 0x11d41983, .name = "AD1983", .patch = patch_ad1983 }, | 4205 | { .id = 0x11d41983, .name = "AD1983", .patch = patch_ad1983 }, |
3661 | { .id = 0x11d41984, .name = "AD1984", .patch = patch_ad1984 }, | 4206 | { .id = 0x11d41984, .name = "AD1984", .patch = patch_ad1984 }, |
3662 | { .id = 0x11d41986, .name = "AD1986A", .patch = patch_ad1986a }, | 4207 | { .id = 0x11d41986, .name = "AD1986A", .patch = patch_ad1986a }, |
3663 | { .id = 0x11d41988, .name = "AD1988", .patch = patch_ad1988 }, | 4208 | { .id = 0x11d41988, .name = "AD1988", .patch = patch_ad1988 }, |
3664 | { .id = 0x11d4198b, .name = "AD1988B", .patch = patch_ad1988 }, | 4209 | { .id = 0x11d4198b, .name = "AD1988B", .patch = patch_ad1988 }, |
4210 | { .id = 0x11d4989a, .name = "AD1989A", .patch = patch_ad1988 }, | ||
4211 | { .id = 0x11d4989b, .name = "AD1989B", .patch = patch_ad1988 }, | ||
3665 | {} /* terminator */ | 4212 | {} /* terminator */ |
3666 | }; | 4213 | }; |
diff --git a/sound/pci/hda/patch_atihdmi.c b/sound/pci/hda/patch_atihdmi.c index 9a8bb4ce3f8d..12272508b112 100644 --- a/sound/pci/hda/patch_atihdmi.c +++ b/sound/pci/hda/patch_atihdmi.c | |||
@@ -27,6 +27,7 @@ | |||
27 | #include <sound/core.h> | 27 | #include <sound/core.h> |
28 | #include "hda_codec.h" | 28 | #include "hda_codec.h" |
29 | #include "hda_local.h" | 29 | #include "hda_local.h" |
30 | #include "hda_patch.h" | ||
30 | 31 | ||
31 | struct atihdmi_spec { | 32 | struct atihdmi_spec { |
32 | struct hda_multi_out multiout; | 33 | struct hda_multi_out multiout; |
@@ -58,6 +59,10 @@ static int atihdmi_build_controls(struct hda_codec *codec) | |||
58 | static int atihdmi_init(struct hda_codec *codec) | 59 | static int atihdmi_init(struct hda_codec *codec) |
59 | { | 60 | { |
60 | snd_hda_sequence_write(codec, atihdmi_basic_init); | 61 | snd_hda_sequence_write(codec, atihdmi_basic_init); |
62 | /* SI codec requires to unmute the pin */ | ||
63 | if (get_wcaps(codec, 0x03) & AC_WCAP_OUT_AMP) | ||
64 | snd_hda_codec_write(codec, 0x03, 0, AC_VERB_SET_AMP_GAIN_MUTE, | ||
65 | AMP_OUT_UNMUTE); | ||
61 | return 0; | 66 | return 0; |
62 | } | 67 | } |
63 | 68 | ||
@@ -112,6 +117,7 @@ static int atihdmi_build_pcms(struct hda_codec *codec) | |||
112 | codec->pcm_info = info; | 117 | codec->pcm_info = info; |
113 | 118 | ||
114 | info->name = "ATI HDMI"; | 119 | info->name = "ATI HDMI"; |
120 | info->pcm_type = HDA_PCM_TYPE_HDMI; | ||
115 | info->stream[SNDRV_PCM_STREAM_PLAYBACK] = atihdmi_pcm_digital_playback; | 121 | info->stream[SNDRV_PCM_STREAM_PLAYBACK] = atihdmi_pcm_digital_playback; |
116 | 122 | ||
117 | return 0; | 123 | return 0; |
@@ -158,5 +164,7 @@ struct hda_codec_preset snd_hda_preset_atihdmi[] = { | |||
158 | { .id = 0x10027919, .name = "ATI RS600 HDMI", .patch = patch_atihdmi }, | 164 | { .id = 0x10027919, .name = "ATI RS600 HDMI", .patch = patch_atihdmi }, |
159 | { .id = 0x1002791a, .name = "ATI RS690/780 HDMI", .patch = patch_atihdmi }, | 165 | { .id = 0x1002791a, .name = "ATI RS690/780 HDMI", .patch = patch_atihdmi }, |
160 | { .id = 0x1002aa01, .name = "ATI R6xx HDMI", .patch = patch_atihdmi }, | 166 | { .id = 0x1002aa01, .name = "ATI R6xx HDMI", .patch = patch_atihdmi }, |
167 | { .id = 0x10951392, .name = "SiI1392 HDMI", .patch = patch_atihdmi }, | ||
168 | { .id = 0x17e80047, .name = "Chrontel HDMI", .patch = patch_atihdmi }, | ||
161 | {} /* terminator */ | 169 | {} /* terminator */ |
162 | }; | 170 | }; |
diff --git a/sound/pci/hda/patch_cmedia.c b/sound/pci/hda/patch_cmedia.c index 3d6097ba1d68..c73ce074a6ea 100644 --- a/sound/pci/hda/patch_cmedia.c +++ b/sound/pci/hda/patch_cmedia.c | |||
@@ -28,6 +28,7 @@ | |||
28 | #include <sound/core.h> | 28 | #include <sound/core.h> |
29 | #include "hda_codec.h" | 29 | #include "hda_codec.h" |
30 | #include "hda_local.h" | 30 | #include "hda_local.h" |
31 | #include "hda_patch.h" | ||
31 | #define NUM_PINS 11 | 32 | #define NUM_PINS 11 |
32 | 33 | ||
33 | 34 | ||
@@ -329,6 +330,11 @@ static int cmi9880_build_controls(struct hda_codec *codec) | |||
329 | err = snd_hda_create_spdif_out_ctls(codec, spec->multiout.dig_out_nid); | 330 | err = snd_hda_create_spdif_out_ctls(codec, spec->multiout.dig_out_nid); |
330 | if (err < 0) | 331 | if (err < 0) |
331 | return err; | 332 | return err; |
333 | err = snd_hda_create_spdif_share_sw(codec, | ||
334 | &spec->multiout); | ||
335 | if (err < 0) | ||
336 | return err; | ||
337 | spec->multiout.share_spdif = 1; | ||
332 | } | 338 | } |
333 | if (spec->dig_in_nid) { | 339 | if (spec->dig_in_nid) { |
334 | err = snd_hda_create_spdif_in_ctls(codec, spec->dig_in_nid); | 340 | err = snd_hda_create_spdif_in_ctls(codec, spec->dig_in_nid); |
@@ -432,7 +438,8 @@ static int cmi9880_playback_pcm_open(struct hda_pcm_stream *hinfo, | |||
432 | struct snd_pcm_substream *substream) | 438 | struct snd_pcm_substream *substream) |
433 | { | 439 | { |
434 | struct cmi_spec *spec = codec->spec; | 440 | struct cmi_spec *spec = codec->spec; |
435 | return snd_hda_multi_out_analog_open(codec, &spec->multiout, substream); | 441 | return snd_hda_multi_out_analog_open(codec, &spec->multiout, substream, |
442 | hinfo); | ||
436 | } | 443 | } |
437 | 444 | ||
438 | static int cmi9880_playback_pcm_prepare(struct hda_pcm_stream *hinfo, | 445 | static int cmi9880_playback_pcm_prepare(struct hda_pcm_stream *hinfo, |
@@ -506,7 +513,7 @@ static int cmi9880_capture_pcm_cleanup(struct hda_pcm_stream *hinfo, | |||
506 | { | 513 | { |
507 | struct cmi_spec *spec = codec->spec; | 514 | struct cmi_spec *spec = codec->spec; |
508 | 515 | ||
509 | snd_hda_codec_setup_stream(codec, spec->adc_nids[substream->number], 0, 0, 0); | 516 | snd_hda_codec_cleanup_stream(codec, spec->adc_nids[substream->number]); |
510 | return 0; | 517 | return 0; |
511 | } | 518 | } |
512 | 519 | ||
@@ -571,6 +578,7 @@ static int cmi9880_build_pcms(struct hda_codec *codec) | |||
571 | codec->num_pcms++; | 578 | codec->num_pcms++; |
572 | info++; | 579 | info++; |
573 | info->name = "CMI9880 Digital"; | 580 | info->name = "CMI9880 Digital"; |
581 | info->pcm_type = HDA_PCM_TYPE_SPDIF; | ||
574 | if (spec->multiout.dig_out_nid) { | 582 | if (spec->multiout.dig_out_nid) { |
575 | info->stream[SNDRV_PCM_STREAM_PLAYBACK] = cmi9880_pcm_digital_playback; | 583 | info->stream[SNDRV_PCM_STREAM_PLAYBACK] = cmi9880_pcm_digital_playback; |
576 | info->stream[SNDRV_PCM_STREAM_PLAYBACK].nid = spec->multiout.dig_out_nid; | 584 | info->stream[SNDRV_PCM_STREAM_PLAYBACK].nid = spec->multiout.dig_out_nid; |
@@ -603,6 +611,7 @@ static const char *cmi9880_models[CMI_MODELS] = { | |||
603 | 611 | ||
604 | static struct snd_pci_quirk cmi9880_cfg_tbl[] = { | 612 | static struct snd_pci_quirk cmi9880_cfg_tbl[] = { |
605 | SND_PCI_QUIRK(0x1043, 0x813d, "ASUS P5AD2", CMI_FULL_DIG), | 613 | SND_PCI_QUIRK(0x1043, 0x813d, "ASUS P5AD2", CMI_FULL_DIG), |
614 | SND_PCI_QUIRK(0x1854, 0x0032, "LG", CMI_FULL_DIG), | ||
606 | {} /* terminator */ | 615 | {} /* terminator */ |
607 | }; | 616 | }; |
608 | 617 | ||
diff --git a/sound/pci/hda/patch_conexant.c b/sound/pci/hda/patch_conexant.c index 7206b30cbf94..36fd85260035 100644 --- a/sound/pci/hda/patch_conexant.c +++ b/sound/pci/hda/patch_conexant.c | |||
@@ -27,6 +27,7 @@ | |||
27 | #include <sound/core.h> | 27 | #include <sound/core.h> |
28 | #include "hda_codec.h" | 28 | #include "hda_codec.h" |
29 | #include "hda_local.h" | 29 | #include "hda_local.h" |
30 | #include "hda_patch.h" | ||
30 | 31 | ||
31 | #define CXT_PIN_DIR_IN 0x00 | 32 | #define CXT_PIN_DIR_IN 0x00 |
32 | #define CXT_PIN_DIR_OUT 0x01 | 33 | #define CXT_PIN_DIR_OUT 0x01 |
@@ -98,7 +99,8 @@ static int conexant_playback_pcm_open(struct hda_pcm_stream *hinfo, | |||
98 | struct snd_pcm_substream *substream) | 99 | struct snd_pcm_substream *substream) |
99 | { | 100 | { |
100 | struct conexant_spec *spec = codec->spec; | 101 | struct conexant_spec *spec = codec->spec; |
101 | return snd_hda_multi_out_analog_open(codec, &spec->multiout, substream); | 102 | return snd_hda_multi_out_analog_open(codec, &spec->multiout, substream, |
103 | hinfo); | ||
102 | } | 104 | } |
103 | 105 | ||
104 | static int conexant_playback_pcm_prepare(struct hda_pcm_stream *hinfo, | 106 | static int conexant_playback_pcm_prepare(struct hda_pcm_stream *hinfo, |
@@ -172,8 +174,7 @@ static int conexant_capture_pcm_cleanup(struct hda_pcm_stream *hinfo, | |||
172 | struct snd_pcm_substream *substream) | 174 | struct snd_pcm_substream *substream) |
173 | { | 175 | { |
174 | struct conexant_spec *spec = codec->spec; | 176 | struct conexant_spec *spec = codec->spec; |
175 | snd_hda_codec_setup_stream(codec, spec->adc_nids[substream->number], | 177 | snd_hda_codec_cleanup_stream(codec, spec->adc_nids[substream->number]); |
176 | 0, 0, 0); | ||
177 | return 0; | 178 | return 0; |
178 | } | 179 | } |
179 | 180 | ||
@@ -241,7 +242,7 @@ static int cx5051_capture_pcm_cleanup(struct hda_pcm_stream *hinfo, | |||
241 | struct snd_pcm_substream *substream) | 242 | struct snd_pcm_substream *substream) |
242 | { | 243 | { |
243 | struct conexant_spec *spec = codec->spec; | 244 | struct conexant_spec *spec = codec->spec; |
244 | snd_hda_codec_setup_stream(codec, spec->cur_adc, 0, 0, 0); | 245 | snd_hda_codec_cleanup_stream(codec, spec->cur_adc); |
245 | spec->cur_adc = 0; | 246 | spec->cur_adc = 0; |
246 | return 0; | 247 | return 0; |
247 | } | 248 | } |
@@ -284,6 +285,7 @@ static int conexant_build_pcms(struct hda_codec *codec) | |||
284 | info++; | 285 | info++; |
285 | codec->num_pcms++; | 286 | codec->num_pcms++; |
286 | info->name = "Conexant Digital"; | 287 | info->name = "Conexant Digital"; |
288 | info->pcm_type = HDA_PCM_TYPE_SPDIF; | ||
287 | info->stream[SNDRV_PCM_STREAM_PLAYBACK] = | 289 | info->stream[SNDRV_PCM_STREAM_PLAYBACK] = |
288 | conexant_pcm_digital_playback; | 290 | conexant_pcm_digital_playback; |
289 | info->stream[SNDRV_PCM_STREAM_PLAYBACK].nid = | 291 | info->stream[SNDRV_PCM_STREAM_PLAYBACK].nid = |
@@ -371,6 +373,11 @@ static int conexant_build_controls(struct hda_codec *codec) | |||
371 | spec->multiout.dig_out_nid); | 373 | spec->multiout.dig_out_nid); |
372 | if (err < 0) | 374 | if (err < 0) |
373 | return err; | 375 | return err; |
376 | err = snd_hda_create_spdif_share_sw(codec, | ||
377 | &spec->multiout); | ||
378 | if (err < 0) | ||
379 | return err; | ||
380 | spec->multiout.share_spdif = 1; | ||
374 | } | 381 | } |
375 | if (spec->dig_in_nid) { | 382 | if (spec->dig_in_nid) { |
376 | err = snd_hda_create_spdif_in_ctls(codec,spec->dig_in_nid); | 383 | err = snd_hda_create_spdif_in_ctls(codec,spec->dig_in_nid); |
@@ -511,6 +518,14 @@ static struct hda_input_mux cxt5045_capture_source_benq = { | |||
511 | } | 518 | } |
512 | }; | 519 | }; |
513 | 520 | ||
521 | static struct hda_input_mux cxt5045_capture_source_hp530 = { | ||
522 | .num_items = 2, | ||
523 | .items = { | ||
524 | { "ExtMic", 0x1 }, | ||
525 | { "IntMic", 0x2 }, | ||
526 | } | ||
527 | }; | ||
528 | |||
514 | /* turn on/off EAPD (+ mute HP) as a master switch */ | 529 | /* turn on/off EAPD (+ mute HP) as a master switch */ |
515 | static int cxt5045_hp_master_sw_put(struct snd_kcontrol *kcontrol, | 530 | static int cxt5045_hp_master_sw_put(struct snd_kcontrol *kcontrol, |
516 | struct snd_ctl_elem_value *ucontrol) | 531 | struct snd_ctl_elem_value *ucontrol) |
@@ -639,6 +654,37 @@ static struct snd_kcontrol_new cxt5045_benq_mixers[] = { | |||
639 | {} | 654 | {} |
640 | }; | 655 | }; |
641 | 656 | ||
657 | static struct snd_kcontrol_new cxt5045_mixers_hp530[] = { | ||
658 | { | ||
659 | .iface = SNDRV_CTL_ELEM_IFACE_MIXER, | ||
660 | .name = "Capture Source", | ||
661 | .info = conexant_mux_enum_info, | ||
662 | .get = conexant_mux_enum_get, | ||
663 | .put = conexant_mux_enum_put | ||
664 | }, | ||
665 | HDA_CODEC_VOLUME("Int Mic Capture Volume", 0x1a, 0x02, HDA_INPUT), | ||
666 | HDA_CODEC_MUTE("Int Mic Capture Switch", 0x1a, 0x02, HDA_INPUT), | ||
667 | HDA_CODEC_VOLUME("Ext Mic Capture Volume", 0x1a, 0x01, HDA_INPUT), | ||
668 | HDA_CODEC_MUTE("Ext Mic Capture Switch", 0x1a, 0x01, HDA_INPUT), | ||
669 | HDA_CODEC_VOLUME("PCM Playback Volume", 0x17, 0x0, HDA_INPUT), | ||
670 | HDA_CODEC_MUTE("PCM Playback Switch", 0x17, 0x0, HDA_INPUT), | ||
671 | HDA_CODEC_VOLUME("Int Mic Playback Volume", 0x17, 0x2, HDA_INPUT), | ||
672 | HDA_CODEC_MUTE("Int Mic Playback Switch", 0x17, 0x2, HDA_INPUT), | ||
673 | HDA_CODEC_VOLUME("Ext Mic Playback Volume", 0x17, 0x1, HDA_INPUT), | ||
674 | HDA_CODEC_MUTE("Ext Mic Playback Switch", 0x17, 0x1, HDA_INPUT), | ||
675 | HDA_BIND_VOL("Master Playback Volume", &cxt5045_hp_bind_master_vol), | ||
676 | { | ||
677 | .iface = SNDRV_CTL_ELEM_IFACE_MIXER, | ||
678 | .name = "Master Playback Switch", | ||
679 | .info = cxt_eapd_info, | ||
680 | .get = cxt_eapd_get, | ||
681 | .put = cxt5045_hp_master_sw_put, | ||
682 | .private_value = 0x10, | ||
683 | }, | ||
684 | |||
685 | {} | ||
686 | }; | ||
687 | |||
642 | static struct hda_verb cxt5045_init_verbs[] = { | 688 | static struct hda_verb cxt5045_init_verbs[] = { |
643 | /* Line in, Mic */ | 689 | /* Line in, Mic */ |
644 | {0x12, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN }, | 690 | {0x12, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN }, |
@@ -833,6 +879,7 @@ enum { | |||
833 | CXT5045_LAPTOP_MICSENSE, | 879 | CXT5045_LAPTOP_MICSENSE, |
834 | CXT5045_LAPTOP_HPMICSENSE, | 880 | CXT5045_LAPTOP_HPMICSENSE, |
835 | CXT5045_BENQ, | 881 | CXT5045_BENQ, |
882 | CXT5045_LAPTOP_HP530, | ||
836 | #ifdef CONFIG_SND_DEBUG | 883 | #ifdef CONFIG_SND_DEBUG |
837 | CXT5045_TEST, | 884 | CXT5045_TEST, |
838 | #endif | 885 | #endif |
@@ -844,6 +891,7 @@ static const char *cxt5045_models[CXT5045_MODELS] = { | |||
844 | [CXT5045_LAPTOP_MICSENSE] = "laptop-micsense", | 891 | [CXT5045_LAPTOP_MICSENSE] = "laptop-micsense", |
845 | [CXT5045_LAPTOP_HPMICSENSE] = "laptop-hpmicsense", | 892 | [CXT5045_LAPTOP_HPMICSENSE] = "laptop-hpmicsense", |
846 | [CXT5045_BENQ] = "benq", | 893 | [CXT5045_BENQ] = "benq", |
894 | [CXT5045_LAPTOP_HP530] = "laptop-hp530", | ||
847 | #ifdef CONFIG_SND_DEBUG | 895 | #ifdef CONFIG_SND_DEBUG |
848 | [CXT5045_TEST] = "test", | 896 | [CXT5045_TEST] = "test", |
849 | #endif | 897 | #endif |
@@ -857,7 +905,7 @@ static struct snd_pci_quirk cxt5045_cfg_tbl[] = { | |||
857 | SND_PCI_QUIRK(0x103c, 0x30bb, "HP DV8000", CXT5045_LAPTOP_HPSENSE), | 905 | SND_PCI_QUIRK(0x103c, 0x30bb, "HP DV8000", CXT5045_LAPTOP_HPSENSE), |
858 | SND_PCI_QUIRK(0x103c, 0x30cd, "HP DV Series", CXT5045_LAPTOP_HPSENSE), | 906 | SND_PCI_QUIRK(0x103c, 0x30cd, "HP DV Series", CXT5045_LAPTOP_HPSENSE), |
859 | SND_PCI_QUIRK(0x103c, 0x30cf, "HP DV9533EG", CXT5045_LAPTOP_HPSENSE), | 907 | SND_PCI_QUIRK(0x103c, 0x30cf, "HP DV9533EG", CXT5045_LAPTOP_HPSENSE), |
860 | SND_PCI_QUIRK(0x103c, 0x30d5, "HP 530", CXT5045_LAPTOP_HPSENSE), | 908 | SND_PCI_QUIRK(0x103c, 0x30d5, "HP 530", CXT5045_LAPTOP_HP530), |
861 | SND_PCI_QUIRK(0x103c, 0x30d9, "HP Spartan", CXT5045_LAPTOP_HPSENSE), | 909 | SND_PCI_QUIRK(0x103c, 0x30d9, "HP Spartan", CXT5045_LAPTOP_HPSENSE), |
862 | SND_PCI_QUIRK(0x152d, 0x0753, "Benq R55E", CXT5045_BENQ), | 910 | SND_PCI_QUIRK(0x152d, 0x0753, "Benq R55E", CXT5045_BENQ), |
863 | SND_PCI_QUIRK(0x1734, 0x10ad, "Fujitsu Si1520", CXT5045_LAPTOP_MICSENSE), | 911 | SND_PCI_QUIRK(0x1734, 0x10ad, "Fujitsu Si1520", CXT5045_LAPTOP_MICSENSE), |
@@ -941,6 +989,14 @@ static int patch_cxt5045(struct hda_codec *codec) | |||
941 | spec->num_mixers = 2; | 989 | spec->num_mixers = 2; |
942 | codec->patch_ops.init = cxt5045_init; | 990 | codec->patch_ops.init = cxt5045_init; |
943 | break; | 991 | break; |
992 | case CXT5045_LAPTOP_HP530: | ||
993 | codec->patch_ops.unsol_event = cxt5045_hp_unsol_event; | ||
994 | spec->input_mux = &cxt5045_capture_source_hp530; | ||
995 | spec->num_init_verbs = 2; | ||
996 | spec->init_verbs[1] = cxt5045_hp_sense_init_verbs; | ||
997 | spec->mixers[0] = cxt5045_mixers_hp530; | ||
998 | codec->patch_ops.init = cxt5045_init; | ||
999 | break; | ||
944 | #ifdef CONFIG_SND_DEBUG | 1000 | #ifdef CONFIG_SND_DEBUG |
945 | case CXT5045_TEST: | 1001 | case CXT5045_TEST: |
946 | spec->input_mux = &cxt5045_test_capture_source; | 1002 | spec->input_mux = &cxt5045_test_capture_source; |
@@ -1537,7 +1593,7 @@ static void cxt5051_portc_automic(struct hda_codec *codec) | |||
1537 | new_adc = spec->adc_nids[spec->cur_adc_idx]; | 1593 | new_adc = spec->adc_nids[spec->cur_adc_idx]; |
1538 | if (spec->cur_adc && spec->cur_adc != new_adc) { | 1594 | if (spec->cur_adc && spec->cur_adc != new_adc) { |
1539 | /* stream is running, let's swap the current ADC */ | 1595 | /* stream is running, let's swap the current ADC */ |
1540 | snd_hda_codec_setup_stream(codec, spec->cur_adc, 0, 0, 0); | 1596 | snd_hda_codec_cleanup_stream(codec, spec->cur_adc); |
1541 | spec->cur_adc = new_adc; | 1597 | spec->cur_adc = new_adc; |
1542 | snd_hda_codec_setup_stream(codec, new_adc, | 1598 | snd_hda_codec_setup_stream(codec, new_adc, |
1543 | spec->cur_adc_stream_tag, 0, | 1599 | spec->cur_adc_stream_tag, 0, |
diff --git a/sound/pci/hda/patch_realtek.c b/sound/pci/hda/patch_realtek.c index 33282f9c01c7..cdda64b02f46 100644 --- a/sound/pci/hda/patch_realtek.c +++ b/sound/pci/hda/patch_realtek.c | |||
@@ -30,6 +30,7 @@ | |||
30 | #include <sound/core.h> | 30 | #include <sound/core.h> |
31 | #include "hda_codec.h" | 31 | #include "hda_codec.h" |
32 | #include "hda_local.h" | 32 | #include "hda_local.h" |
33 | #include "hda_patch.h" | ||
33 | 34 | ||
34 | #define ALC880_FRONT_EVENT 0x01 | 35 | #define ALC880_FRONT_EVENT 0x01 |
35 | #define ALC880_DCVOL_EVENT 0x02 | 36 | #define ALC880_DCVOL_EVENT 0x02 |
@@ -97,16 +98,19 @@ enum { | |||
97 | ALC262_SONY_ASSAMD, | 98 | ALC262_SONY_ASSAMD, |
98 | ALC262_BENQ_T31, | 99 | ALC262_BENQ_T31, |
99 | ALC262_ULTRA, | 100 | ALC262_ULTRA, |
101 | ALC262_LENOVO_3000, | ||
100 | ALC262_AUTO, | 102 | ALC262_AUTO, |
101 | ALC262_MODEL_LAST /* last tag */ | 103 | ALC262_MODEL_LAST /* last tag */ |
102 | }; | 104 | }; |
103 | 105 | ||
104 | /* ALC268 models */ | 106 | /* ALC268 models */ |
105 | enum { | 107 | enum { |
108 | ALC267_QUANTA_IL1, | ||
106 | ALC268_3ST, | 109 | ALC268_3ST, |
107 | ALC268_TOSHIBA, | 110 | ALC268_TOSHIBA, |
108 | ALC268_ACER, | 111 | ALC268_ACER, |
109 | ALC268_DELL, | 112 | ALC268_DELL, |
113 | ALC268_ZEPTO, | ||
110 | #ifdef CONFIG_SND_DEBUG | 114 | #ifdef CONFIG_SND_DEBUG |
111 | ALC268_TEST, | 115 | ALC268_TEST, |
112 | #endif | 116 | #endif |
@@ -195,10 +199,11 @@ enum { | |||
195 | ALC883_LENOVO_NB0763, | 199 | ALC883_LENOVO_NB0763, |
196 | ALC888_LENOVO_MS7195_DIG, | 200 | ALC888_LENOVO_MS7195_DIG, |
197 | ALC883_HAIER_W66, | 201 | ALC883_HAIER_W66, |
198 | ALC888_6ST_HP, | ||
199 | ALC888_3ST_HP, | 202 | ALC888_3ST_HP, |
200 | ALC888_6ST_DELL, | 203 | ALC888_6ST_DELL, |
201 | ALC883_MITAC, | 204 | ALC883_MITAC, |
205 | ALC883_CLEVO_M720, | ||
206 | ALC883_FUJITSU_PI2515, | ||
202 | ALC883_AUTO, | 207 | ALC883_AUTO, |
203 | ALC883_MODEL_LAST, | 208 | ALC883_MODEL_LAST, |
204 | }; | 209 | }; |
@@ -237,6 +242,7 @@ struct alc_spec { | |||
237 | /* capture */ | 242 | /* capture */ |
238 | unsigned int num_adc_nids; | 243 | unsigned int num_adc_nids; |
239 | hda_nid_t *adc_nids; | 244 | hda_nid_t *adc_nids; |
245 | hda_nid_t *capsrc_nids; | ||
240 | hda_nid_t dig_in_nid; /* digital-in NID; optional */ | 246 | hda_nid_t dig_in_nid; /* digital-in NID; optional */ |
241 | 247 | ||
242 | /* capture source */ | 248 | /* capture source */ |
@@ -270,7 +276,6 @@ struct alc_spec { | |||
270 | 276 | ||
271 | /* for virtual master */ | 277 | /* for virtual master */ |
272 | hda_nid_t vmaster_nid; | 278 | hda_nid_t vmaster_nid; |
273 | u32 vmaster_tlv[4]; | ||
274 | #ifdef CONFIG_SND_HDA_POWER_SAVE | 279 | #ifdef CONFIG_SND_HDA_POWER_SAVE |
275 | struct hda_loopback_check loopback; | 280 | struct hda_loopback_check loopback; |
276 | #endif | 281 | #endif |
@@ -290,6 +295,7 @@ struct alc_config_preset { | |||
290 | hda_nid_t hp_nid; /* optional */ | 295 | hda_nid_t hp_nid; /* optional */ |
291 | unsigned int num_adc_nids; | 296 | unsigned int num_adc_nids; |
292 | hda_nid_t *adc_nids; | 297 | hda_nid_t *adc_nids; |
298 | hda_nid_t *capsrc_nids; | ||
293 | hda_nid_t dig_in_nid; | 299 | hda_nid_t dig_in_nid; |
294 | unsigned int num_channel_mode; | 300 | unsigned int num_channel_mode; |
295 | const struct hda_channel_mode *channel_mode; | 301 | const struct hda_channel_mode *channel_mode; |
@@ -336,9 +342,10 @@ static int alc_mux_enum_put(struct snd_kcontrol *kcontrol, | |||
336 | struct alc_spec *spec = codec->spec; | 342 | struct alc_spec *spec = codec->spec; |
337 | unsigned int adc_idx = snd_ctl_get_ioffidx(kcontrol, &ucontrol->id); | 343 | unsigned int adc_idx = snd_ctl_get_ioffidx(kcontrol, &ucontrol->id); |
338 | unsigned int mux_idx = adc_idx >= spec->num_mux_defs ? 0 : adc_idx; | 344 | unsigned int mux_idx = adc_idx >= spec->num_mux_defs ? 0 : adc_idx; |
345 | hda_nid_t nid = spec->capsrc_nids ? | ||
346 | spec->capsrc_nids[adc_idx] : spec->adc_nids[adc_idx]; | ||
339 | return snd_hda_input_mux_put(codec, &spec->input_mux[mux_idx], ucontrol, | 347 | return snd_hda_input_mux_put(codec, &spec->input_mux[mux_idx], ucontrol, |
340 | spec->adc_nids[adc_idx], | 348 | nid, &spec->cur_mux[adc_idx]); |
341 | &spec->cur_mux[adc_idx]); | ||
342 | } | 349 | } |
343 | 350 | ||
344 | 351 | ||
@@ -707,6 +714,7 @@ static void setup_preset(struct alc_spec *spec, | |||
707 | 714 | ||
708 | spec->num_adc_nids = preset->num_adc_nids; | 715 | spec->num_adc_nids = preset->num_adc_nids; |
709 | spec->adc_nids = preset->adc_nids; | 716 | spec->adc_nids = preset->adc_nids; |
717 | spec->capsrc_nids = preset->capsrc_nids; | ||
710 | spec->dig_in_nid = preset->dig_in_nid; | 718 | spec->dig_in_nid = preset->dig_in_nid; |
711 | 719 | ||
712 | spec->unsol_event = preset->unsol_event; | 720 | spec->unsol_event = preset->unsol_event; |
@@ -741,7 +749,6 @@ static struct hda_verb alc_gpio3_init_verbs[] = { | |||
741 | static void alc_sku_automute(struct hda_codec *codec) | 749 | static void alc_sku_automute(struct hda_codec *codec) |
742 | { | 750 | { |
743 | struct alc_spec *spec = codec->spec; | 751 | struct alc_spec *spec = codec->spec; |
744 | unsigned int mute; | ||
745 | unsigned int present; | 752 | unsigned int present; |
746 | unsigned int hp_nid = spec->autocfg.hp_pins[0]; | 753 | unsigned int hp_nid = spec->autocfg.hp_pins[0]; |
747 | unsigned int sp_nid = spec->autocfg.speaker_pins[0]; | 754 | unsigned int sp_nid = spec->autocfg.speaker_pins[0]; |
@@ -751,16 +758,8 @@ static void alc_sku_automute(struct hda_codec *codec) | |||
751 | present = snd_hda_codec_read(codec, hp_nid, 0, | 758 | present = snd_hda_codec_read(codec, hp_nid, 0, |
752 | AC_VERB_GET_PIN_SENSE, 0); | 759 | AC_VERB_GET_PIN_SENSE, 0); |
753 | spec->jack_present = (present & 0x80000000) != 0; | 760 | spec->jack_present = (present & 0x80000000) != 0; |
754 | if (spec->jack_present) { | 761 | snd_hda_codec_write(codec, sp_nid, 0, AC_VERB_SET_PIN_WIDGET_CONTROL, |
755 | /* mute internal speaker */ | 762 | spec->jack_present ? 0 : PIN_OUT); |
756 | snd_hda_codec_amp_stereo(codec, sp_nid, HDA_OUTPUT, 0, | ||
757 | HDA_AMP_MUTE, HDA_AMP_MUTE); | ||
758 | } else { | ||
759 | /* unmute internal speaker if necessary */ | ||
760 | mute = snd_hda_codec_amp_read(codec, hp_nid, 0, HDA_OUTPUT, 0); | ||
761 | snd_hda_codec_amp_stereo(codec, sp_nid, HDA_OUTPUT, 0, | ||
762 | HDA_AMP_MUTE, mute); | ||
763 | } | ||
764 | } | 763 | } |
765 | 764 | ||
766 | /* unsolicited event for HP jack sensing */ | 765 | /* unsolicited event for HP jack sensing */ |
@@ -1319,11 +1318,19 @@ static struct snd_kcontrol_new alc880_f1734_mixer[] = { | |||
1319 | HDA_BIND_MUTE("Speaker Playback Switch", 0x0d, 2, HDA_INPUT), | 1318 | HDA_BIND_MUTE("Speaker Playback Switch", 0x0d, 2, HDA_INPUT), |
1320 | HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT), | 1319 | HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT), |
1321 | HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT), | 1320 | HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT), |
1322 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), | 1321 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x1, HDA_INPUT), |
1323 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), | 1322 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x1, HDA_INPUT), |
1324 | { } /* end */ | 1323 | { } /* end */ |
1325 | }; | 1324 | }; |
1326 | 1325 | ||
1326 | static struct hda_input_mux alc880_f1734_capture_source = { | ||
1327 | .num_items = 2, | ||
1328 | .items = { | ||
1329 | { "Mic", 0x1 }, | ||
1330 | { "CD", 0x4 }, | ||
1331 | }, | ||
1332 | }; | ||
1333 | |||
1327 | 1334 | ||
1328 | /* | 1335 | /* |
1329 | * ALC880 ASUS model | 1336 | * ALC880 ASUS model |
@@ -1516,6 +1523,11 @@ static int alc_build_controls(struct hda_codec *codec) | |||
1516 | spec->multiout.dig_out_nid); | 1523 | spec->multiout.dig_out_nid); |
1517 | if (err < 0) | 1524 | if (err < 0) |
1518 | return err; | 1525 | return err; |
1526 | err = snd_hda_create_spdif_share_sw(codec, | ||
1527 | &spec->multiout); | ||
1528 | if (err < 0) | ||
1529 | return err; | ||
1530 | spec->multiout.share_spdif = 1; | ||
1519 | } | 1531 | } |
1520 | if (spec->dig_in_nid) { | 1532 | if (spec->dig_in_nid) { |
1521 | err = snd_hda_create_spdif_in_ctls(codec, spec->dig_in_nid); | 1533 | err = snd_hda_create_spdif_in_ctls(codec, spec->dig_in_nid); |
@@ -1525,10 +1537,11 @@ static int alc_build_controls(struct hda_codec *codec) | |||
1525 | 1537 | ||
1526 | /* if we have no master control, let's create it */ | 1538 | /* if we have no master control, let's create it */ |
1527 | if (!snd_hda_find_mixer_ctl(codec, "Master Playback Volume")) { | 1539 | if (!snd_hda_find_mixer_ctl(codec, "Master Playback Volume")) { |
1540 | unsigned int vmaster_tlv[4]; | ||
1528 | snd_hda_set_vmaster_tlv(codec, spec->vmaster_nid, | 1541 | snd_hda_set_vmaster_tlv(codec, spec->vmaster_nid, |
1529 | HDA_OUTPUT, spec->vmaster_tlv); | 1542 | HDA_OUTPUT, vmaster_tlv); |
1530 | err = snd_hda_add_vmaster(codec, "Master Playback Volume", | 1543 | err = snd_hda_add_vmaster(codec, "Master Playback Volume", |
1531 | spec->vmaster_tlv, alc_slave_vols); | 1544 | vmaster_tlv, alc_slave_vols); |
1532 | if (err < 0) | 1545 | if (err < 0) |
1533 | return err; | 1546 | return err; |
1534 | } | 1547 | } |
@@ -1882,7 +1895,7 @@ static void alc880_uniwill_p53_hp_automute(struct hda_codec *codec) | |||
1882 | present = snd_hda_codec_read(codec, 0x14, 0, | 1895 | present = snd_hda_codec_read(codec, 0x14, 0, |
1883 | AC_VERB_GET_PIN_SENSE, 0) & 0x80000000; | 1896 | AC_VERB_GET_PIN_SENSE, 0) & 0x80000000; |
1884 | bits = present ? HDA_AMP_MUTE : 0; | 1897 | bits = present ? HDA_AMP_MUTE : 0; |
1885 | snd_hda_codec_amp_stereo(codec, 0x15, HDA_INPUT, 0, HDA_AMP_MUTE, bits); | 1898 | snd_hda_codec_amp_stereo(codec, 0x15, HDA_OUTPUT, 0, HDA_AMP_MUTE, bits); |
1886 | } | 1899 | } |
1887 | 1900 | ||
1888 | static void alc880_uniwill_p53_dcvol_automute(struct hda_codec *codec) | 1901 | static void alc880_uniwill_p53_dcvol_automute(struct hda_codec *codec) |
@@ -1915,6 +1928,7 @@ static void alc880_uniwill_p53_unsol_event(struct hda_codec *codec, | |||
1915 | * HP = 0x14, speaker-out = 0x15, mic = 0x18 | 1928 | * HP = 0x14, speaker-out = 0x15, mic = 0x18 |
1916 | */ | 1929 | */ |
1917 | static struct hda_verb alc880_pin_f1734_init_verbs[] = { | 1930 | static struct hda_verb alc880_pin_f1734_init_verbs[] = { |
1931 | {0x07, AC_VERB_SET_CONNECT_SEL, 0x01}, | ||
1918 | {0x10, AC_VERB_SET_CONNECT_SEL, 0x02}, | 1932 | {0x10, AC_VERB_SET_CONNECT_SEL, 0x02}, |
1919 | {0x11, AC_VERB_SET_CONNECT_SEL, 0x00}, | 1933 | {0x11, AC_VERB_SET_CONNECT_SEL, 0x00}, |
1920 | {0x12, AC_VERB_SET_CONNECT_SEL, 0x01}, | 1934 | {0x12, AC_VERB_SET_CONNECT_SEL, 0x01}, |
@@ -1927,7 +1941,7 @@ static struct hda_verb alc880_pin_f1734_init_verbs[] = { | |||
1927 | 1941 | ||
1928 | {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80}, | 1942 | {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80}, |
1929 | {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, | 1943 | {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
1930 | {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80}, | 1944 | {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF50}, |
1931 | {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, | 1945 | {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
1932 | {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, | 1946 | {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
1933 | {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, | 1947 | {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
@@ -1935,6 +1949,9 @@ static struct hda_verb alc880_pin_f1734_init_verbs[] = { | |||
1935 | {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, | 1949 | {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
1936 | {0x1c, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, | 1950 | {0x1c, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
1937 | 1951 | ||
1952 | {0x14, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN|ALC880_HP_EVENT}, | ||
1953 | {0x21, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN|ALC880_DCVOL_EVENT}, | ||
1954 | |||
1938 | { } | 1955 | { } |
1939 | }; | 1956 | }; |
1940 | 1957 | ||
@@ -2318,7 +2335,8 @@ static int alc880_playback_pcm_open(struct hda_pcm_stream *hinfo, | |||
2318 | struct snd_pcm_substream *substream) | 2335 | struct snd_pcm_substream *substream) |
2319 | { | 2336 | { |
2320 | struct alc_spec *spec = codec->spec; | 2337 | struct alc_spec *spec = codec->spec; |
2321 | return snd_hda_multi_out_analog_open(codec, &spec->multiout, substream); | 2338 | return snd_hda_multi_out_analog_open(codec, &spec->multiout, substream, |
2339 | hinfo); | ||
2322 | } | 2340 | } |
2323 | 2341 | ||
2324 | static int alc880_playback_pcm_prepare(struct hda_pcm_stream *hinfo, | 2342 | static int alc880_playback_pcm_prepare(struct hda_pcm_stream *hinfo, |
@@ -2392,8 +2410,8 @@ static int alc880_alt_capture_pcm_cleanup(struct hda_pcm_stream *hinfo, | |||
2392 | { | 2410 | { |
2393 | struct alc_spec *spec = codec->spec; | 2411 | struct alc_spec *spec = codec->spec; |
2394 | 2412 | ||
2395 | snd_hda_codec_setup_stream(codec, spec->adc_nids[substream->number + 1], | 2413 | snd_hda_codec_cleanup_stream(codec, |
2396 | 0, 0, 0); | 2414 | spec->adc_nids[substream->number + 1]); |
2397 | return 0; | 2415 | return 0; |
2398 | } | 2416 | } |
2399 | 2417 | ||
@@ -2498,6 +2516,7 @@ static int alc_build_pcms(struct hda_codec *codec) | |||
2498 | codec->num_pcms = 2; | 2516 | codec->num_pcms = 2; |
2499 | info = spec->pcm_rec + 1; | 2517 | info = spec->pcm_rec + 1; |
2500 | info->name = spec->stream_name_digital; | 2518 | info->name = spec->stream_name_digital; |
2519 | info->pcm_type = HDA_PCM_TYPE_SPDIF; | ||
2501 | if (spec->multiout.dig_out_nid && | 2520 | if (spec->multiout.dig_out_nid && |
2502 | spec->stream_digital_playback) { | 2521 | spec->stream_digital_playback) { |
2503 | info->stream[SNDRV_PCM_STREAM_PLAYBACK] = *(spec->stream_digital_playback); | 2522 | info->stream[SNDRV_PCM_STREAM_PLAYBACK] = *(spec->stream_digital_playback); |
@@ -2560,6 +2579,7 @@ static void alc_free(struct hda_codec *codec) | |||
2560 | kfree(spec->kctl_alloc); | 2579 | kfree(spec->kctl_alloc); |
2561 | } | 2580 | } |
2562 | kfree(spec); | 2581 | kfree(spec); |
2582 | codec->spec = NULL; /* to be sure */ | ||
2563 | } | 2583 | } |
2564 | 2584 | ||
2565 | /* | 2585 | /* |
@@ -3057,7 +3077,9 @@ static struct alc_config_preset alc880_presets[] = { | |||
3057 | .hp_nid = 0x02, | 3077 | .hp_nid = 0x02, |
3058 | .num_channel_mode = ARRAY_SIZE(alc880_2_jack_modes), | 3078 | .num_channel_mode = ARRAY_SIZE(alc880_2_jack_modes), |
3059 | .channel_mode = alc880_2_jack_modes, | 3079 | .channel_mode = alc880_2_jack_modes, |
3060 | .input_mux = &alc880_capture_source, | 3080 | .input_mux = &alc880_f1734_capture_source, |
3081 | .unsol_event = alc880_uniwill_p53_unsol_event, | ||
3082 | .init_hook = alc880_uniwill_p53_hp_automute, | ||
3061 | }, | 3083 | }, |
3062 | [ALC880_ASUS] = { | 3084 | [ALC880_ASUS] = { |
3063 | .mixers = { alc880_asus_mixer }, | 3085 | .mixers = { alc880_asus_mixer }, |
@@ -3467,15 +3489,21 @@ static int alc880_auto_create_analog_input_ctls(struct alc_spec *spec, | |||
3467 | return 0; | 3489 | return 0; |
3468 | } | 3490 | } |
3469 | 3491 | ||
3470 | static void alc880_auto_set_output_and_unmute(struct hda_codec *codec, | 3492 | static void alc_set_pin_output(struct hda_codec *codec, hda_nid_t nid, |
3471 | hda_nid_t nid, int pin_type, | 3493 | unsigned int pin_type) |
3472 | int dac_idx) | ||
3473 | { | 3494 | { |
3474 | /* set as output */ | ||
3475 | snd_hda_codec_write(codec, nid, 0, AC_VERB_SET_PIN_WIDGET_CONTROL, | 3495 | snd_hda_codec_write(codec, nid, 0, AC_VERB_SET_PIN_WIDGET_CONTROL, |
3476 | pin_type); | 3496 | pin_type); |
3497 | /* unmute pin */ | ||
3477 | snd_hda_codec_write(codec, nid, 0, AC_VERB_SET_AMP_GAIN_MUTE, | 3498 | snd_hda_codec_write(codec, nid, 0, AC_VERB_SET_AMP_GAIN_MUTE, |
3478 | AMP_OUT_UNMUTE); | 3499 | AMP_OUT_UNMUTE); |
3500 | } | ||
3501 | |||
3502 | static void alc880_auto_set_output_and_unmute(struct hda_codec *codec, | ||
3503 | hda_nid_t nid, int pin_type, | ||
3504 | int dac_idx) | ||
3505 | { | ||
3506 | alc_set_pin_output(codec, nid, pin_type); | ||
3479 | /* need the manual connection? */ | 3507 | /* need the manual connection? */ |
3480 | if (alc880_is_multi_pin(nid)) { | 3508 | if (alc880_is_multi_pin(nid)) { |
3481 | struct alc_spec *spec = codec->spec; | 3509 | struct alc_spec *spec = codec->spec; |
@@ -3597,9 +3625,12 @@ static int alc880_parse_auto_config(struct hda_codec *codec) | |||
3597 | /* additional initialization for auto-configuration model */ | 3625 | /* additional initialization for auto-configuration model */ |
3598 | static void alc880_auto_init(struct hda_codec *codec) | 3626 | static void alc880_auto_init(struct hda_codec *codec) |
3599 | { | 3627 | { |
3628 | struct alc_spec *spec = codec->spec; | ||
3600 | alc880_auto_init_multi_out(codec); | 3629 | alc880_auto_init_multi_out(codec); |
3601 | alc880_auto_init_extra_out(codec); | 3630 | alc880_auto_init_extra_out(codec); |
3602 | alc880_auto_init_analog_input(codec); | 3631 | alc880_auto_init_analog_input(codec); |
3632 | if (spec->unsol_event) | ||
3633 | alc_sku_automute(codec); | ||
3603 | } | 3634 | } |
3604 | 3635 | ||
3605 | /* | 3636 | /* |
@@ -4795,11 +4826,7 @@ static void alc260_auto_set_output_and_unmute(struct hda_codec *codec, | |||
4795 | hda_nid_t nid, int pin_type, | 4826 | hda_nid_t nid, int pin_type, |
4796 | int sel_idx) | 4827 | int sel_idx) |
4797 | { | 4828 | { |
4798 | /* set as output */ | 4829 | alc_set_pin_output(codec, nid, pin_type); |
4799 | snd_hda_codec_write(codec, nid, 0, AC_VERB_SET_PIN_WIDGET_CONTROL, | ||
4800 | pin_type); | ||
4801 | snd_hda_codec_write(codec, nid, 0, AC_VERB_SET_AMP_GAIN_MUTE, | ||
4802 | AMP_OUT_UNMUTE); | ||
4803 | /* need the manual connection? */ | 4830 | /* need the manual connection? */ |
4804 | if (nid >= 0x12) { | 4831 | if (nid >= 0x12) { |
4805 | int idx = nid - 0x12; | 4832 | int idx = nid - 0x12; |
@@ -4929,7 +4956,7 @@ static int alc260_parse_auto_config(struct hda_codec *codec) | |||
4929 | /* check whether NID 0x04 is valid */ | 4956 | /* check whether NID 0x04 is valid */ |
4930 | wcap = get_wcaps(codec, 0x04); | 4957 | wcap = get_wcaps(codec, 0x04); |
4931 | wcap = (wcap & AC_WCAP_TYPE) >> AC_WCAP_TYPE_SHIFT; /* get type */ | 4958 | wcap = (wcap & AC_WCAP_TYPE) >> AC_WCAP_TYPE_SHIFT; /* get type */ |
4932 | if (wcap != AC_WID_AUD_IN) { | 4959 | if (wcap != AC_WID_AUD_IN || spec->input_mux->num_items == 1) { |
4933 | spec->adc_nids = alc260_adc_nids_alt; | 4960 | spec->adc_nids = alc260_adc_nids_alt; |
4934 | spec->num_adc_nids = ARRAY_SIZE(alc260_adc_nids_alt); | 4961 | spec->num_adc_nids = ARRAY_SIZE(alc260_adc_nids_alt); |
4935 | spec->mixers[spec->num_mixers] = alc260_capture_alt_mixer; | 4962 | spec->mixers[spec->num_mixers] = alc260_capture_alt_mixer; |
@@ -4946,8 +4973,11 @@ static int alc260_parse_auto_config(struct hda_codec *codec) | |||
4946 | /* additional initialization for auto-configuration model */ | 4973 | /* additional initialization for auto-configuration model */ |
4947 | static void alc260_auto_init(struct hda_codec *codec) | 4974 | static void alc260_auto_init(struct hda_codec *codec) |
4948 | { | 4975 | { |
4976 | struct alc_spec *spec = codec->spec; | ||
4949 | alc260_auto_init_multi_out(codec); | 4977 | alc260_auto_init_multi_out(codec); |
4950 | alc260_auto_init_analog_input(codec); | 4978 | alc260_auto_init_analog_input(codec); |
4979 | if (spec->unsol_event) | ||
4980 | alc_sku_automute(codec); | ||
4951 | } | 4981 | } |
4952 | 4982 | ||
4953 | #ifdef CONFIG_SND_HDA_POWER_SAVE | 4983 | #ifdef CONFIG_SND_HDA_POWER_SAVE |
@@ -5204,6 +5234,9 @@ static hda_nid_t alc882_dac_nids[4] = { | |||
5204 | #define alc882_adc_nids alc880_adc_nids | 5234 | #define alc882_adc_nids alc880_adc_nids |
5205 | #define alc882_adc_nids_alt alc880_adc_nids_alt | 5235 | #define alc882_adc_nids_alt alc880_adc_nids_alt |
5206 | 5236 | ||
5237 | static hda_nid_t alc882_capsrc_nids[3] = { 0x24, 0x23, 0x22 }; | ||
5238 | static hda_nid_t alc882_capsrc_nids_alt[2] = { 0x23, 0x22 }; | ||
5239 | |||
5207 | /* input MUX */ | 5240 | /* input MUX */ |
5208 | /* FIXME: should be a matrix-type input source selection */ | 5241 | /* FIXME: should be a matrix-type input source selection */ |
5209 | 5242 | ||
@@ -5226,15 +5259,11 @@ static int alc882_mux_enum_put(struct snd_kcontrol *kcontrol, | |||
5226 | struct alc_spec *spec = codec->spec; | 5259 | struct alc_spec *spec = codec->spec; |
5227 | const struct hda_input_mux *imux = spec->input_mux; | 5260 | const struct hda_input_mux *imux = spec->input_mux; |
5228 | unsigned int adc_idx = snd_ctl_get_ioffidx(kcontrol, &ucontrol->id); | 5261 | unsigned int adc_idx = snd_ctl_get_ioffidx(kcontrol, &ucontrol->id); |
5229 | static hda_nid_t capture_mixers[3] = { 0x24, 0x23, 0x22 }; | 5262 | hda_nid_t nid = spec->capsrc_nids ? |
5230 | hda_nid_t nid; | 5263 | spec->capsrc_nids[adc_idx] : spec->adc_nids[adc_idx]; |
5231 | unsigned int *cur_val = &spec->cur_mux[adc_idx]; | 5264 | unsigned int *cur_val = &spec->cur_mux[adc_idx]; |
5232 | unsigned int i, idx; | 5265 | unsigned int i, idx; |
5233 | 5266 | ||
5234 | if (spec->num_adc_nids < 3) | ||
5235 | nid = capture_mixers[adc_idx + 1]; | ||
5236 | else | ||
5237 | nid = capture_mixers[adc_idx]; | ||
5238 | idx = ucontrol->value.enumerated.item[0]; | 5267 | idx = ucontrol->value.enumerated.item[0]; |
5239 | if (idx >= imux->num_items) | 5268 | if (idx >= imux->num_items) |
5240 | idx = imux->num_items - 1; | 5269 | idx = imux->num_items - 1; |
@@ -6111,6 +6140,7 @@ static struct alc_config_preset alc882_presets[] = { | |||
6111 | .dig_out_nid = ALC882_DIGOUT_NID, | 6140 | .dig_out_nid = ALC882_DIGOUT_NID, |
6112 | .num_adc_nids = ARRAY_SIZE(alc882_adc_nids), | 6141 | .num_adc_nids = ARRAY_SIZE(alc882_adc_nids), |
6113 | .adc_nids = alc882_adc_nids, | 6142 | .adc_nids = alc882_adc_nids, |
6143 | .capsrc_nids = alc882_capsrc_nids, | ||
6114 | .num_channel_mode = ARRAY_SIZE(alc882_3ST_6ch_modes), | 6144 | .num_channel_mode = ARRAY_SIZE(alc882_3ST_6ch_modes), |
6115 | .channel_mode = alc882_3ST_6ch_modes, | 6145 | .channel_mode = alc882_3ST_6ch_modes, |
6116 | .need_dac_fix = 1, | 6146 | .need_dac_fix = 1, |
@@ -6127,6 +6157,7 @@ static struct alc_config_preset alc882_presets[] = { | |||
6127 | .dig_out_nid = ALC882_DIGOUT_NID, | 6157 | .dig_out_nid = ALC882_DIGOUT_NID, |
6128 | .num_adc_nids = ARRAY_SIZE(alc882_adc_nids), | 6158 | .num_adc_nids = ARRAY_SIZE(alc882_adc_nids), |
6129 | .adc_nids = alc882_adc_nids, | 6159 | .adc_nids = alc882_adc_nids, |
6160 | .capsrc_nids = alc882_capsrc_nids, | ||
6130 | .num_channel_mode = ARRAY_SIZE(alc882_3ST_6ch_modes), | 6161 | .num_channel_mode = ARRAY_SIZE(alc882_3ST_6ch_modes), |
6131 | .channel_mode = alc882_3ST_6ch_modes, | 6162 | .channel_mode = alc882_3ST_6ch_modes, |
6132 | .need_dac_fix = 1, | 6163 | .need_dac_fix = 1, |
@@ -6182,15 +6213,11 @@ static void alc882_auto_set_output_and_unmute(struct hda_codec *codec, | |||
6182 | struct alc_spec *spec = codec->spec; | 6213 | struct alc_spec *spec = codec->spec; |
6183 | int idx; | 6214 | int idx; |
6184 | 6215 | ||
6216 | alc_set_pin_output(codec, nid, pin_type); | ||
6185 | if (spec->multiout.dac_nids[dac_idx] == 0x25) | 6217 | if (spec->multiout.dac_nids[dac_idx] == 0x25) |
6186 | idx = 4; | 6218 | idx = 4; |
6187 | else | 6219 | else |
6188 | idx = spec->multiout.dac_nids[dac_idx] - 2; | 6220 | idx = spec->multiout.dac_nids[dac_idx] - 2; |
6189 | |||
6190 | snd_hda_codec_write(codec, nid, 0, AC_VERB_SET_PIN_WIDGET_CONTROL, | ||
6191 | pin_type); | ||
6192 | snd_hda_codec_write(codec, nid, 0, AC_VERB_SET_AMP_GAIN_MUTE, | ||
6193 | AMP_OUT_UNMUTE); | ||
6194 | snd_hda_codec_write(codec, nid, 0, AC_VERB_SET_CONNECT_SEL, idx); | 6221 | snd_hda_codec_write(codec, nid, 0, AC_VERB_SET_CONNECT_SEL, idx); |
6195 | 6222 | ||
6196 | } | 6223 | } |
@@ -6219,6 +6246,9 @@ static void alc882_auto_init_hp_out(struct hda_codec *codec) | |||
6219 | if (pin) /* connect to front */ | 6246 | if (pin) /* connect to front */ |
6220 | /* use dac 0 */ | 6247 | /* use dac 0 */ |
6221 | alc882_auto_set_output_and_unmute(codec, pin, PIN_HP, 0); | 6248 | alc882_auto_set_output_and_unmute(codec, pin, PIN_HP, 0); |
6249 | pin = spec->autocfg.speaker_pins[0]; | ||
6250 | if (pin) | ||
6251 | alc882_auto_set_output_and_unmute(codec, pin, PIN_OUT, 0); | ||
6222 | } | 6252 | } |
6223 | 6253 | ||
6224 | #define alc882_is_input_pin(nid) alc880_is_input_pin(nid) | 6254 | #define alc882_is_input_pin(nid) alc880_is_input_pin(nid) |
@@ -6231,16 +6261,21 @@ static void alc882_auto_init_analog_input(struct hda_codec *codec) | |||
6231 | 6261 | ||
6232 | for (i = 0; i < AUTO_PIN_LAST; i++) { | 6262 | for (i = 0; i < AUTO_PIN_LAST; i++) { |
6233 | hda_nid_t nid = spec->autocfg.input_pins[i]; | 6263 | hda_nid_t nid = spec->autocfg.input_pins[i]; |
6234 | if (alc882_is_input_pin(nid)) { | 6264 | unsigned int vref; |
6235 | snd_hda_codec_write(codec, nid, 0, | 6265 | if (!nid) |
6236 | AC_VERB_SET_PIN_WIDGET_CONTROL, | 6266 | continue; |
6237 | i <= AUTO_PIN_FRONT_MIC ? | 6267 | vref = PIN_IN; |
6238 | PIN_VREF80 : PIN_IN); | 6268 | if (1 /*i <= AUTO_PIN_FRONT_MIC*/) { |
6239 | if (nid != ALC882_PIN_CD_NID) | 6269 | if (snd_hda_param_read(codec, nid, AC_PAR_PIN_CAP) & |
6240 | snd_hda_codec_write(codec, nid, 0, | 6270 | AC_PINCAP_VREF_80) |
6241 | AC_VERB_SET_AMP_GAIN_MUTE, | 6271 | vref = PIN_VREF80; |
6242 | AMP_OUT_MUTE); | ||
6243 | } | 6272 | } |
6273 | snd_hda_codec_write(codec, nid, 0, | ||
6274 | AC_VERB_SET_PIN_WIDGET_CONTROL, vref); | ||
6275 | if (get_wcaps(codec, nid) & AC_WCAP_OUT_AMP) | ||
6276 | snd_hda_codec_write(codec, nid, 0, | ||
6277 | AC_VERB_SET_AMP_GAIN_MUTE, | ||
6278 | AMP_OUT_MUTE); | ||
6244 | } | 6279 | } |
6245 | } | 6280 | } |
6246 | 6281 | ||
@@ -6294,11 +6329,16 @@ static int alc882_parse_auto_config(struct hda_codec *codec) | |||
6294 | /* additional initialization for auto-configuration model */ | 6329 | /* additional initialization for auto-configuration model */ |
6295 | static void alc882_auto_init(struct hda_codec *codec) | 6330 | static void alc882_auto_init(struct hda_codec *codec) |
6296 | { | 6331 | { |
6332 | struct alc_spec *spec = codec->spec; | ||
6297 | alc882_auto_init_multi_out(codec); | 6333 | alc882_auto_init_multi_out(codec); |
6298 | alc882_auto_init_hp_out(codec); | 6334 | alc882_auto_init_hp_out(codec); |
6299 | alc882_auto_init_analog_input(codec); | 6335 | alc882_auto_init_analog_input(codec); |
6336 | if (spec->unsol_event) | ||
6337 | alc_sku_automute(codec); | ||
6300 | } | 6338 | } |
6301 | 6339 | ||
6340 | static int patch_alc883(struct hda_codec *codec); /* called in patch_alc882() */ | ||
6341 | |||
6302 | static int patch_alc882(struct hda_codec *codec) | 6342 | static int patch_alc882(struct hda_codec *codec) |
6303 | { | 6343 | { |
6304 | struct alc_spec *spec; | 6344 | struct alc_spec *spec; |
@@ -6328,6 +6368,11 @@ static int patch_alc882(struct hda_codec *codec) | |||
6328 | board_config = ALC885_MBP3; | 6368 | board_config = ALC885_MBP3; |
6329 | break; | 6369 | break; |
6330 | default: | 6370 | default: |
6371 | /* ALC889A is handled better as ALC888-compatible */ | ||
6372 | if (codec->revision_id == 0x100103) { | ||
6373 | alc_free(codec); | ||
6374 | return patch_alc883(codec); | ||
6375 | } | ||
6331 | printk(KERN_INFO "hda_codec: Unknown model for ALC882, " | 6376 | printk(KERN_INFO "hda_codec: Unknown model for ALC882, " |
6332 | "trying auto-probe from BIOS...\n"); | 6377 | "trying auto-probe from BIOS...\n"); |
6333 | board_config = ALC882_AUTO; | 6378 | board_config = ALC882_AUTO; |
@@ -6372,12 +6417,14 @@ static int patch_alc882(struct hda_codec *codec) | |||
6372 | if (wcap != AC_WID_AUD_IN) { | 6417 | if (wcap != AC_WID_AUD_IN) { |
6373 | spec->adc_nids = alc882_adc_nids_alt; | 6418 | spec->adc_nids = alc882_adc_nids_alt; |
6374 | spec->num_adc_nids = ARRAY_SIZE(alc882_adc_nids_alt); | 6419 | spec->num_adc_nids = ARRAY_SIZE(alc882_adc_nids_alt); |
6420 | spec->capsrc_nids = alc882_capsrc_nids_alt; | ||
6375 | spec->mixers[spec->num_mixers] = | 6421 | spec->mixers[spec->num_mixers] = |
6376 | alc882_capture_alt_mixer; | 6422 | alc882_capture_alt_mixer; |
6377 | spec->num_mixers++; | 6423 | spec->num_mixers++; |
6378 | } else { | 6424 | } else { |
6379 | spec->adc_nids = alc882_adc_nids; | 6425 | spec->adc_nids = alc882_adc_nids; |
6380 | spec->num_adc_nids = ARRAY_SIZE(alc882_adc_nids); | 6426 | spec->num_adc_nids = ARRAY_SIZE(alc882_adc_nids); |
6427 | spec->capsrc_nids = alc882_capsrc_nids; | ||
6381 | spec->mixers[spec->num_mixers] = alc882_capture_mixer; | 6428 | spec->mixers[spec->num_mixers] = alc882_capture_mixer; |
6382 | spec->num_mixers++; | 6429 | spec->num_mixers++; |
6383 | } | 6430 | } |
@@ -6412,7 +6459,7 @@ static int patch_alc882(struct hda_codec *codec) | |||
6412 | 6459 | ||
6413 | static hda_nid_t alc883_dac_nids[4] = { | 6460 | static hda_nid_t alc883_dac_nids[4] = { |
6414 | /* front, rear, clfe, rear_surr */ | 6461 | /* front, rear, clfe, rear_surr */ |
6415 | 0x02, 0x04, 0x03, 0x05 | 6462 | 0x02, 0x03, 0x04, 0x05 |
6416 | }; | 6463 | }; |
6417 | 6464 | ||
6418 | static hda_nid_t alc883_adc_nids[2] = { | 6465 | static hda_nid_t alc883_adc_nids[2] = { |
@@ -6420,6 +6467,8 @@ static hda_nid_t alc883_adc_nids[2] = { | |||
6420 | 0x08, 0x09, | 6467 | 0x08, 0x09, |
6421 | }; | 6468 | }; |
6422 | 6469 | ||
6470 | static hda_nid_t alc883_capsrc_nids[2] = { 0x23, 0x22 }; | ||
6471 | |||
6423 | /* input MUX */ | 6472 | /* input MUX */ |
6424 | /* FIXME: should be a matrix-type input source selection */ | 6473 | /* FIXME: should be a matrix-type input source selection */ |
6425 | 6474 | ||
@@ -6451,35 +6500,18 @@ static struct hda_input_mux alc883_lenovo_nb0763_capture_source = { | |||
6451 | }, | 6500 | }, |
6452 | }; | 6501 | }; |
6453 | 6502 | ||
6503 | static struct hda_input_mux alc883_fujitsu_pi2515_capture_source = { | ||
6504 | .num_items = 2, | ||
6505 | .items = { | ||
6506 | { "Mic", 0x0 }, | ||
6507 | { "Int Mic", 0x1 }, | ||
6508 | }, | ||
6509 | }; | ||
6510 | |||
6454 | #define alc883_mux_enum_info alc_mux_enum_info | 6511 | #define alc883_mux_enum_info alc_mux_enum_info |
6455 | #define alc883_mux_enum_get alc_mux_enum_get | 6512 | #define alc883_mux_enum_get alc_mux_enum_get |
6456 | 6513 | /* ALC883 has the ALC882-type input selection */ | |
6457 | static int alc883_mux_enum_put(struct snd_kcontrol *kcontrol, | 6514 | #define alc883_mux_enum_put alc882_mux_enum_put |
6458 | struct snd_ctl_elem_value *ucontrol) | ||
6459 | { | ||
6460 | struct hda_codec *codec = snd_kcontrol_chip(kcontrol); | ||
6461 | struct alc_spec *spec = codec->spec; | ||
6462 | const struct hda_input_mux *imux = spec->input_mux; | ||
6463 | unsigned int adc_idx = snd_ctl_get_ioffidx(kcontrol, &ucontrol->id); | ||
6464 | static hda_nid_t capture_mixers[2] = { 0x23, 0x22 }; | ||
6465 | hda_nid_t nid = capture_mixers[adc_idx]; | ||
6466 | unsigned int *cur_val = &spec->cur_mux[adc_idx]; | ||
6467 | unsigned int i, idx; | ||
6468 | |||
6469 | idx = ucontrol->value.enumerated.item[0]; | ||
6470 | if (idx >= imux->num_items) | ||
6471 | idx = imux->num_items - 1; | ||
6472 | if (*cur_val == idx) | ||
6473 | return 0; | ||
6474 | for (i = 0; i < imux->num_items; i++) { | ||
6475 | unsigned int v = (i == idx) ? 0 : HDA_AMP_MUTE; | ||
6476 | snd_hda_codec_amp_stereo(codec, nid, HDA_INPUT, | ||
6477 | imux->items[i].index, | ||
6478 | HDA_AMP_MUTE, v); | ||
6479 | } | ||
6480 | *cur_val = idx; | ||
6481 | return 1; | ||
6482 | } | ||
6483 | 6515 | ||
6484 | /* | 6516 | /* |
6485 | * 2ch mode | 6517 | * 2ch mode |
@@ -6638,6 +6670,60 @@ static struct snd_kcontrol_new alc883_mitac_mixer[] = { | |||
6638 | { } /* end */ | 6670 | { } /* end */ |
6639 | }; | 6671 | }; |
6640 | 6672 | ||
6673 | static struct snd_kcontrol_new alc883_clevo_m720_mixer[] = { | ||
6674 | HDA_CODEC_VOLUME("Headphone Playback Volume", 0x0c, 0x0, HDA_OUTPUT), | ||
6675 | HDA_BIND_MUTE("Headphone Playback Switch", 0x0c, 2, HDA_INPUT), | ||
6676 | HDA_CODEC_VOLUME("Speaker Playback Volume", 0x0d, 0x0, HDA_OUTPUT), | ||
6677 | HDA_BIND_MUTE("Speaker Playback Switch", 0x0d, 2, HDA_INPUT), | ||
6678 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), | ||
6679 | HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT), | ||
6680 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), | ||
6681 | HDA_CODEC_VOLUME("Int Mic Playback Volume", 0x0b, 0x1, HDA_INPUT), | ||
6682 | HDA_CODEC_VOLUME("Int Mic Boost", 0x19, 0, HDA_INPUT), | ||
6683 | HDA_CODEC_MUTE("Int Mic Playback Switch", 0x0b, 0x1, HDA_INPUT), | ||
6684 | HDA_CODEC_VOLUME("Capture Volume", 0x08, 0x0, HDA_INPUT), | ||
6685 | HDA_CODEC_MUTE("Capture Switch", 0x08, 0x0, HDA_INPUT), | ||
6686 | HDA_CODEC_VOLUME_IDX("Capture Volume", 1, 0x09, 0x0, HDA_INPUT), | ||
6687 | HDA_CODEC_MUTE_IDX("Capture Switch", 1, 0x09, 0x0, HDA_INPUT), | ||
6688 | { | ||
6689 | .iface = SNDRV_CTL_ELEM_IFACE_MIXER, | ||
6690 | /* .name = "Capture Source", */ | ||
6691 | .name = "Input Source", | ||
6692 | .count = 2, | ||
6693 | .info = alc883_mux_enum_info, | ||
6694 | .get = alc883_mux_enum_get, | ||
6695 | .put = alc883_mux_enum_put, | ||
6696 | }, | ||
6697 | { } /* end */ | ||
6698 | }; | ||
6699 | |||
6700 | static struct snd_kcontrol_new alc883_2ch_fujitsu_pi2515_mixer[] = { | ||
6701 | HDA_CODEC_VOLUME("Headphone Playback Volume", 0x0c, 0x0, HDA_OUTPUT), | ||
6702 | HDA_BIND_MUTE("Headphone Playback Switch", 0x0c, 2, HDA_INPUT), | ||
6703 | HDA_CODEC_VOLUME("Speaker Playback Volume", 0x0d, 0x0, HDA_OUTPUT), | ||
6704 | HDA_BIND_MUTE("Speaker Playback Switch", 0x0d, 2, HDA_INPUT), | ||
6705 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), | ||
6706 | HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT), | ||
6707 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), | ||
6708 | HDA_CODEC_VOLUME("Int Mic Playback Volume", 0x0b, 0x1, HDA_INPUT), | ||
6709 | HDA_CODEC_VOLUME("Int Mic Boost", 0x19, 0, HDA_INPUT), | ||
6710 | HDA_CODEC_MUTE("Int Mic Playback Switch", 0x0b, 0x1, HDA_INPUT), | ||
6711 | HDA_CODEC_VOLUME("Capture Volume", 0x08, 0x0, HDA_INPUT), | ||
6712 | HDA_CODEC_MUTE("Capture Switch", 0x08, 0x0, HDA_INPUT), | ||
6713 | HDA_CODEC_VOLUME_IDX("Capture Volume", 1, 0x09, 0x0, HDA_INPUT), | ||
6714 | HDA_CODEC_MUTE_IDX("Capture Switch", 1, 0x09, 0x0, HDA_INPUT), | ||
6715 | { | ||
6716 | .iface = SNDRV_CTL_ELEM_IFACE_MIXER, | ||
6717 | /* .name = "Capture Source", */ | ||
6718 | .name = "Input Source", | ||
6719 | .count = 2, | ||
6720 | .info = alc883_mux_enum_info, | ||
6721 | .get = alc883_mux_enum_get, | ||
6722 | .put = alc883_mux_enum_put, | ||
6723 | }, | ||
6724 | { } /* end */ | ||
6725 | }; | ||
6726 | |||
6641 | static struct snd_kcontrol_new alc883_3ST_2ch_mixer[] = { | 6727 | static struct snd_kcontrol_new alc883_3ST_2ch_mixer[] = { |
6642 | HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT), | 6728 | HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT), |
6643 | HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT), | 6729 | HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT), |
@@ -6787,6 +6873,9 @@ static struct snd_kcontrol_new alc883_tagra_2ch_mixer[] = { | |||
6787 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), | 6873 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), |
6788 | HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT), | 6874 | HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT), |
6789 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), | 6875 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), |
6876 | HDA_CODEC_VOLUME("Int Mic Playback Volume", 0x0b, 0x1, HDA_INPUT), | ||
6877 | HDA_CODEC_VOLUME("Int Mic Boost", 0x19, 0, HDA_INPUT), | ||
6878 | HDA_CODEC_MUTE("Int Mic Playback Switch", 0x0b, 0x1, HDA_INPUT), | ||
6790 | HDA_CODEC_VOLUME("Capture Volume", 0x08, 0x0, HDA_INPUT), | 6879 | HDA_CODEC_VOLUME("Capture Volume", 0x08, 0x0, HDA_INPUT), |
6791 | HDA_CODEC_MUTE("Capture Switch", 0x08, 0x0, HDA_INPUT), | 6880 | HDA_CODEC_MUTE("Capture Switch", 0x08, 0x0, HDA_INPUT), |
6792 | HDA_CODEC_VOLUME_IDX("Capture Volume", 1, 0x09, 0x0, HDA_INPUT), | 6881 | HDA_CODEC_VOLUME_IDX("Capture Volume", 1, 0x09, 0x0, HDA_INPUT), |
@@ -6878,124 +6967,6 @@ static struct snd_kcontrol_new alc883_medion_md2_mixer[] = { | |||
6878 | { } /* end */ | 6967 | { } /* end */ |
6879 | }; | 6968 | }; |
6880 | 6969 | ||
6881 | static struct snd_kcontrol_new alc888_6st_hp_mixer[] = { | ||
6882 | HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT), | ||
6883 | HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT), | ||
6884 | HDA_CODEC_VOLUME("Surround Playback Volume", 0x0e, 0x0, HDA_OUTPUT), | ||
6885 | HDA_BIND_MUTE("Surround Playback Switch", 0x0e, 2, HDA_INPUT), | ||
6886 | HDA_CODEC_VOLUME_MONO("Center Playback Volume", 0x0d, 1, 0x0, HDA_OUTPUT), | ||
6887 | HDA_CODEC_VOLUME_MONO("LFE Playback Volume", 0x0d, 2, 0x0, HDA_OUTPUT), | ||
6888 | HDA_BIND_MUTE_MONO("Center Playback Switch", 0x0d, 1, 2, HDA_INPUT), | ||
6889 | HDA_BIND_MUTE_MONO("LFE Playback Switch", 0x0d, 2, 2, HDA_INPUT), | ||
6890 | HDA_CODEC_VOLUME("Side Playback Volume", 0x0f, 0x0, HDA_OUTPUT), | ||
6891 | HDA_BIND_MUTE("Side Playback Switch", 0x0f, 2, HDA_INPUT), | ||
6892 | HDA_CODEC_MUTE("Headphone Playback Switch", 0x1b, 0x0, HDA_OUTPUT), | ||
6893 | HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT), | ||
6894 | HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT), | ||
6895 | HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT), | ||
6896 | HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT), | ||
6897 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), | ||
6898 | HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT), | ||
6899 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), | ||
6900 | HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x1, HDA_INPUT), | ||
6901 | HDA_CODEC_VOLUME("Front Mic Boost", 0x19, 0, HDA_INPUT), | ||
6902 | HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x1, HDA_INPUT), | ||
6903 | HDA_CODEC_VOLUME("PC Speaker Playback Volume", 0x0b, 0x05, HDA_INPUT), | ||
6904 | HDA_CODEC_MUTE("PC Speaker Playback Switch", 0x0b, 0x05, HDA_INPUT), | ||
6905 | HDA_CODEC_VOLUME("Capture Volume", 0x08, 0x0, HDA_INPUT), | ||
6906 | HDA_CODEC_MUTE("Capture Switch", 0x08, 0x0, HDA_INPUT), | ||
6907 | HDA_CODEC_VOLUME_IDX("Capture Volume", 1, 0x09, 0x0, HDA_INPUT), | ||
6908 | HDA_CODEC_MUTE_IDX("Capture Switch", 1, 0x09, 0x0, HDA_INPUT), | ||
6909 | { | ||
6910 | .iface = SNDRV_CTL_ELEM_IFACE_MIXER, | ||
6911 | /* .name = "Capture Source", */ | ||
6912 | .name = "Input Source", | ||
6913 | .count = 2, | ||
6914 | .info = alc883_mux_enum_info, | ||
6915 | .get = alc883_mux_enum_get, | ||
6916 | .put = alc883_mux_enum_put, | ||
6917 | }, | ||
6918 | { } /* end */ | ||
6919 | }; | ||
6920 | |||
6921 | static struct snd_kcontrol_new alc888_3st_hp_mixer[] = { | ||
6922 | HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT), | ||
6923 | HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT), | ||
6924 | HDA_CODEC_VOLUME("Surround Playback Volume", 0x0e, 0x0, HDA_OUTPUT), | ||
6925 | HDA_BIND_MUTE("Surround Playback Switch", 0x0e, 2, HDA_INPUT), | ||
6926 | HDA_CODEC_VOLUME_MONO("Center Playback Volume", 0x0d, 1, 0x0, HDA_OUTPUT), | ||
6927 | HDA_CODEC_VOLUME_MONO("LFE Playback Volume", 0x0d, 2, 0x0, HDA_OUTPUT), | ||
6928 | HDA_BIND_MUTE_MONO("Center Playback Switch", 0x0d, 1, 2, HDA_INPUT), | ||
6929 | HDA_BIND_MUTE_MONO("LFE Playback Switch", 0x0d, 2, 2, HDA_INPUT), | ||
6930 | HDA_CODEC_MUTE("Headphone Playback Switch", 0x1b, 0x0, HDA_OUTPUT), | ||
6931 | HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT), | ||
6932 | HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT), | ||
6933 | HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT), | ||
6934 | HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT), | ||
6935 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), | ||
6936 | HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT), | ||
6937 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), | ||
6938 | HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x1, HDA_INPUT), | ||
6939 | HDA_CODEC_VOLUME("Front Mic Boost", 0x19, 0, HDA_INPUT), | ||
6940 | HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x1, HDA_INPUT), | ||
6941 | HDA_CODEC_VOLUME("PC Speaker Playback Volume", 0x0b, 0x05, HDA_INPUT), | ||
6942 | HDA_CODEC_MUTE("PC Speaker Playback Switch", 0x0b, 0x05, HDA_INPUT), | ||
6943 | HDA_CODEC_VOLUME("Capture Volume", 0x08, 0x0, HDA_INPUT), | ||
6944 | HDA_CODEC_MUTE("Capture Switch", 0x08, 0x0, HDA_INPUT), | ||
6945 | HDA_CODEC_VOLUME_IDX("Capture Volume", 1, 0x09, 0x0, HDA_INPUT), | ||
6946 | HDA_CODEC_MUTE_IDX("Capture Switch", 1, 0x09, 0x0, HDA_INPUT), | ||
6947 | { | ||
6948 | .iface = SNDRV_CTL_ELEM_IFACE_MIXER, | ||
6949 | /* .name = "Capture Source", */ | ||
6950 | .name = "Input Source", | ||
6951 | .count = 2, | ||
6952 | .info = alc883_mux_enum_info, | ||
6953 | .get = alc883_mux_enum_get, | ||
6954 | .put = alc883_mux_enum_put, | ||
6955 | }, | ||
6956 | { } /* end */ | ||
6957 | }; | ||
6958 | |||
6959 | static struct snd_kcontrol_new alc888_6st_dell_mixer[] = { | ||
6960 | HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT), | ||
6961 | HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT), | ||
6962 | HDA_CODEC_VOLUME("Surround Playback Volume", 0x0e, 0x0, HDA_OUTPUT), | ||
6963 | HDA_BIND_MUTE("Surround Playback Switch", 0x0e, 2, HDA_INPUT), | ||
6964 | HDA_CODEC_VOLUME_MONO("Center Playback Volume", 0x0d, 1, 0x0, HDA_OUTPUT), | ||
6965 | HDA_CODEC_VOLUME_MONO("LFE Playback Volume", 0x0d, 2, 0x0, HDA_OUTPUT), | ||
6966 | HDA_BIND_MUTE_MONO("Center Playback Switch", 0x0d, 1, 2, HDA_INPUT), | ||
6967 | HDA_BIND_MUTE_MONO("LFE Playback Switch", 0x0d, 2, 2, HDA_INPUT), | ||
6968 | HDA_CODEC_VOLUME("Side Playback Volume", 0x0f, 0x0, HDA_OUTPUT), | ||
6969 | HDA_BIND_MUTE("Side Playback Switch", 0x0f, 2, HDA_INPUT), | ||
6970 | HDA_CODEC_MUTE("Headphone Playback Switch", 0x1b, 0x0, HDA_OUTPUT), | ||
6971 | HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT), | ||
6972 | HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT), | ||
6973 | HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT), | ||
6974 | HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT), | ||
6975 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), | ||
6976 | HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT), | ||
6977 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), | ||
6978 | HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x1, HDA_INPUT), | ||
6979 | HDA_CODEC_VOLUME("Front Mic Boost", 0x19, 0, HDA_INPUT), | ||
6980 | HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x1, HDA_INPUT), | ||
6981 | HDA_CODEC_VOLUME("PC Speaker Playback Volume", 0x0b, 0x05, HDA_INPUT), | ||
6982 | HDA_CODEC_MUTE("PC Speaker Playback Switch", 0x0b, 0x05, HDA_INPUT), | ||
6983 | HDA_CODEC_VOLUME("Capture Volume", 0x08, 0x0, HDA_INPUT), | ||
6984 | HDA_CODEC_MUTE("Capture Switch", 0x08, 0x0, HDA_INPUT), | ||
6985 | HDA_CODEC_VOLUME_IDX("Capture Volume", 1, 0x09, 0x0, HDA_INPUT), | ||
6986 | HDA_CODEC_MUTE_IDX("Capture Switch", 1, 0x09, 0x0, HDA_INPUT), | ||
6987 | { | ||
6988 | .iface = SNDRV_CTL_ELEM_IFACE_MIXER, | ||
6989 | /* .name = "Capture Source", */ | ||
6990 | .name = "Input Source", | ||
6991 | .count = 2, | ||
6992 | .info = alc883_mux_enum_info, | ||
6993 | .get = alc883_mux_enum_get, | ||
6994 | .put = alc883_mux_enum_put, | ||
6995 | }, | ||
6996 | { } /* end */ | ||
6997 | }; | ||
6998 | |||
6999 | static struct snd_kcontrol_new alc883_acer_aspire_mixer[] = { | 6970 | static struct snd_kcontrol_new alc883_acer_aspire_mixer[] = { |
7000 | HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT), | 6971 | HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT), |
7001 | HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT), | 6972 | HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT), |
@@ -7171,6 +7142,35 @@ static struct hda_verb alc883_mitac_verbs[] = { | |||
7171 | { } /* end */ | 7142 | { } /* end */ |
7172 | }; | 7143 | }; |
7173 | 7144 | ||
7145 | static struct hda_verb alc883_clevo_m720_verbs[] = { | ||
7146 | /* HP */ | ||
7147 | {0x15, AC_VERB_SET_CONNECT_SEL, 0x00}, | ||
7148 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, | ||
7149 | /* Int speaker */ | ||
7150 | {0x14, AC_VERB_SET_CONNECT_SEL, 0x01}, | ||
7151 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, | ||
7152 | |||
7153 | /* enable unsolicited event */ | ||
7154 | {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN}, | ||
7155 | {0x18, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_MIC_EVENT | AC_USRSP_EN}, | ||
7156 | |||
7157 | { } /* end */ | ||
7158 | }; | ||
7159 | |||
7160 | static struct hda_verb alc883_2ch_fujitsu_pi2515_verbs[] = { | ||
7161 | /* HP */ | ||
7162 | {0x14, AC_VERB_SET_CONNECT_SEL, 0x00}, | ||
7163 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, | ||
7164 | /* Subwoofer */ | ||
7165 | {0x15, AC_VERB_SET_CONNECT_SEL, 0x01}, | ||
7166 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, | ||
7167 | |||
7168 | /* enable unsolicited event */ | ||
7169 | {0x14, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN}, | ||
7170 | |||
7171 | { } /* end */ | ||
7172 | }; | ||
7173 | |||
7174 | static struct hda_verb alc883_tagra_verbs[] = { | 7174 | static struct hda_verb alc883_tagra_verbs[] = { |
7175 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, | 7175 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
7176 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, | 7176 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
@@ -7227,26 +7227,14 @@ static struct hda_verb alc883_haier_w66_verbs[] = { | |||
7227 | { } /* end */ | 7227 | { } /* end */ |
7228 | }; | 7228 | }; |
7229 | 7229 | ||
7230 | static struct hda_verb alc888_6st_hp_verbs[] = { | ||
7231 | {0x14, AC_VERB_SET_CONNECT_SEL, 0x00}, /* Front: output 0 (0x0c) */ | ||
7232 | {0x15, AC_VERB_SET_CONNECT_SEL, 0x02}, /* Rear : output 2 (0x0e) */ | ||
7233 | {0x16, AC_VERB_SET_CONNECT_SEL, 0x01}, /* CLFE : output 1 (0x0d) */ | ||
7234 | {0x17, AC_VERB_SET_CONNECT_SEL, 0x03}, /* Side : output 3 (0x0f) */ | ||
7235 | { } | ||
7236 | }; | ||
7237 | |||
7238 | static struct hda_verb alc888_3st_hp_verbs[] = { | 7230 | static struct hda_verb alc888_3st_hp_verbs[] = { |
7239 | {0x14, AC_VERB_SET_CONNECT_SEL, 0x00}, /* Front: output 0 (0x0c) */ | 7231 | {0x14, AC_VERB_SET_CONNECT_SEL, 0x00}, /* Front: output 0 (0x0c) */ |
7240 | {0x18, AC_VERB_SET_CONNECT_SEL, 0x01}, /* Rear : output 1 (0x0d) */ | 7232 | {0x16, AC_VERB_SET_CONNECT_SEL, 0x01}, /* Rear : output 1 (0x0d) */ |
7241 | {0x16, AC_VERB_SET_CONNECT_SEL, 0x02}, /* CLFE : output 2 (0x0e) */ | 7233 | {0x18, AC_VERB_SET_CONNECT_SEL, 0x02}, /* CLFE : output 2 (0x0e) */ |
7242 | { } | 7234 | { } |
7243 | }; | 7235 | }; |
7244 | 7236 | ||
7245 | static struct hda_verb alc888_6st_dell_verbs[] = { | 7237 | static struct hda_verb alc888_6st_dell_verbs[] = { |
7246 | {0x14, AC_VERB_SET_CONNECT_SEL, 0x00}, /* Front: output 0 (0x0c) */ | ||
7247 | {0x15, AC_VERB_SET_CONNECT_SEL, 0x02}, /* Rear : output 1 (0x0e) */ | ||
7248 | {0x16, AC_VERB_SET_CONNECT_SEL, 0x01}, /* CLFE : output 2 (0x0d) */ | ||
7249 | {0x17, AC_VERB_SET_CONNECT_SEL, 0x03}, /* Side : output 3 (0x0f) */ | ||
7250 | {0x1b, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN}, | 7238 | {0x1b, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN}, |
7251 | { } | 7239 | { } |
7252 | }; | 7240 | }; |
@@ -7354,6 +7342,68 @@ static void alc883_tagra_unsol_event(struct hda_codec *codec, unsigned int res) | |||
7354 | alc883_tagra_automute(codec); | 7342 | alc883_tagra_automute(codec); |
7355 | } | 7343 | } |
7356 | 7344 | ||
7345 | /* toggle speaker-output according to the hp-jack state */ | ||
7346 | static void alc883_clevo_m720_hp_automute(struct hda_codec *codec) | ||
7347 | { | ||
7348 | unsigned int present; | ||
7349 | unsigned char bits; | ||
7350 | |||
7351 | present = snd_hda_codec_read(codec, 0x15, 0, AC_VERB_GET_PIN_SENSE, 0) | ||
7352 | & AC_PINSENSE_PRESENCE; | ||
7353 | bits = present ? HDA_AMP_MUTE : 0; | ||
7354 | snd_hda_codec_amp_stereo(codec, 0x14, HDA_OUTPUT, 0, | ||
7355 | HDA_AMP_MUTE, bits); | ||
7356 | } | ||
7357 | |||
7358 | static void alc883_clevo_m720_mic_automute(struct hda_codec *codec) | ||
7359 | { | ||
7360 | unsigned int present; | ||
7361 | |||
7362 | present = snd_hda_codec_read(codec, 0x18, 0, | ||
7363 | AC_VERB_GET_PIN_SENSE, 0) & 0x80000000; | ||
7364 | snd_hda_codec_amp_stereo(codec, 0x0b, HDA_INPUT, 1, | ||
7365 | HDA_AMP_MUTE, present ? HDA_AMP_MUTE : 0); | ||
7366 | } | ||
7367 | |||
7368 | static void alc883_clevo_m720_automute(struct hda_codec *codec) | ||
7369 | { | ||
7370 | alc883_clevo_m720_hp_automute(codec); | ||
7371 | alc883_clevo_m720_mic_automute(codec); | ||
7372 | } | ||
7373 | |||
7374 | static void alc883_clevo_m720_unsol_event(struct hda_codec *codec, | ||
7375 | unsigned int res) | ||
7376 | { | ||
7377 | switch (res >> 26) { | ||
7378 | case ALC880_HP_EVENT: | ||
7379 | alc883_clevo_m720_hp_automute(codec); | ||
7380 | break; | ||
7381 | case ALC880_MIC_EVENT: | ||
7382 | alc883_clevo_m720_mic_automute(codec); | ||
7383 | break; | ||
7384 | } | ||
7385 | } | ||
7386 | |||
7387 | /* toggle speaker-output according to the hp-jack state */ | ||
7388 | static void alc883_2ch_fujitsu_pi2515_automute(struct hda_codec *codec) | ||
7389 | { | ||
7390 | unsigned int present; | ||
7391 | unsigned char bits; | ||
7392 | |||
7393 | present = snd_hda_codec_read(codec, 0x14, 0, AC_VERB_GET_PIN_SENSE, 0) | ||
7394 | & AC_PINSENSE_PRESENCE; | ||
7395 | bits = present ? HDA_AMP_MUTE : 0; | ||
7396 | snd_hda_codec_amp_stereo(codec, 0x15, HDA_OUTPUT, 0, | ||
7397 | HDA_AMP_MUTE, bits); | ||
7398 | } | ||
7399 | |||
7400 | static void alc883_2ch_fujitsu_pi2515_unsol_event(struct hda_codec *codec, | ||
7401 | unsigned int res) | ||
7402 | { | ||
7403 | if ((res >> 26) == ALC880_HP_EVENT) | ||
7404 | alc883_2ch_fujitsu_pi2515_automute(codec); | ||
7405 | } | ||
7406 | |||
7357 | static void alc883_haier_w66_automute(struct hda_codec *codec) | 7407 | static void alc883_haier_w66_automute(struct hda_codec *codec) |
7358 | { | 7408 | { |
7359 | unsigned int present; | 7409 | unsigned int present; |
@@ -7587,10 +7637,11 @@ static const char *alc883_models[ALC883_MODEL_LAST] = { | |||
7587 | [ALC883_LENOVO_NB0763] = "lenovo-nb0763", | 7637 | [ALC883_LENOVO_NB0763] = "lenovo-nb0763", |
7588 | [ALC888_LENOVO_MS7195_DIG] = "lenovo-ms7195-dig", | 7638 | [ALC888_LENOVO_MS7195_DIG] = "lenovo-ms7195-dig", |
7589 | [ALC883_HAIER_W66] = "haier-w66", | 7639 | [ALC883_HAIER_W66] = "haier-w66", |
7590 | [ALC888_6ST_HP] = "6stack-hp", | ||
7591 | [ALC888_3ST_HP] = "3stack-hp", | 7640 | [ALC888_3ST_HP] = "3stack-hp", |
7592 | [ALC888_6ST_DELL] = "6stack-dell", | 7641 | [ALC888_6ST_DELL] = "6stack-dell", |
7593 | [ALC883_MITAC] = "mitac", | 7642 | [ALC883_MITAC] = "mitac", |
7643 | [ALC883_CLEVO_M720] = "clevo-m720", | ||
7644 | [ALC883_FUJITSU_PI2515] = "fujitsu-pi2515", | ||
7594 | [ALC883_AUTO] = "auto", | 7645 | [ALC883_AUTO] = "auto", |
7595 | }; | 7646 | }; |
7596 | 7647 | ||
@@ -7604,7 +7655,7 @@ static struct snd_pci_quirk alc883_cfg_tbl[] = { | |||
7604 | SND_PCI_QUIRK(0x103c, 0x2a3d, "HP Pavillion", ALC883_6ST_DIG), | 7655 | SND_PCI_QUIRK(0x103c, 0x2a3d, "HP Pavillion", ALC883_6ST_DIG), |
7605 | SND_PCI_QUIRK(0x103c, 0x2a4f, "HP Samba", ALC888_3ST_HP), | 7656 | SND_PCI_QUIRK(0x103c, 0x2a4f, "HP Samba", ALC888_3ST_HP), |
7606 | SND_PCI_QUIRK(0x103c, 0x2a60, "HP Lucknow", ALC888_3ST_HP), | 7657 | SND_PCI_QUIRK(0x103c, 0x2a60, "HP Lucknow", ALC888_3ST_HP), |
7607 | SND_PCI_QUIRK(0x103c, 0x2a61, "HP Nettle", ALC888_6ST_HP), | 7658 | SND_PCI_QUIRK(0x103c, 0x2a61, "HP Nettle", ALC883_6ST_DIG), |
7608 | SND_PCI_QUIRK(0x1043, 0x8249, "Asus M2A-VM HDMI", ALC883_3ST_6ch_DIG), | 7659 | SND_PCI_QUIRK(0x1043, 0x8249, "Asus M2A-VM HDMI", ALC883_3ST_6ch_DIG), |
7609 | SND_PCI_QUIRK(0x105b, 0x6668, "Foxconn", ALC883_6ST_DIG), | 7660 | SND_PCI_QUIRK(0x105b, 0x6668, "Foxconn", ALC883_6ST_DIG), |
7610 | SND_PCI_QUIRK(0x1071, 0x8253, "Mitac 8252d", ALC883_MITAC), | 7661 | SND_PCI_QUIRK(0x1071, 0x8253, "Mitac 8252d", ALC883_MITAC), |
@@ -7614,7 +7665,9 @@ static struct snd_pci_quirk alc883_cfg_tbl[] = { | |||
7614 | SND_PCI_QUIRK(0x1462, 0x0349, "MSI", ALC883_TARGA_2ch_DIG), | 7665 | SND_PCI_QUIRK(0x1462, 0x0349, "MSI", ALC883_TARGA_2ch_DIG), |
7615 | SND_PCI_QUIRK(0x1462, 0x040d, "MSI", ALC883_TARGA_2ch_DIG), | 7666 | SND_PCI_QUIRK(0x1462, 0x040d, "MSI", ALC883_TARGA_2ch_DIG), |
7616 | SND_PCI_QUIRK(0x1462, 0x0579, "MSI", ALC883_TARGA_2ch_DIG), | 7667 | SND_PCI_QUIRK(0x1462, 0x0579, "MSI", ALC883_TARGA_2ch_DIG), |
7668 | SND_PCI_QUIRK(0x1462, 0x2fb3, "MSI", ALC883_TARGA_2ch_DIG), | ||
7617 | SND_PCI_QUIRK(0x1462, 0x3729, "MSI S420", ALC883_TARGA_DIG), | 7669 | SND_PCI_QUIRK(0x1462, 0x3729, "MSI S420", ALC883_TARGA_DIG), |
7670 | SND_PCI_QUIRK(0x1462, 0x3783, "NEC S970", ALC883_TARGA_DIG), | ||
7618 | SND_PCI_QUIRK(0x1462, 0x3b7f, "MSI", ALC883_TARGA_2ch_DIG), | 7671 | SND_PCI_QUIRK(0x1462, 0x3b7f, "MSI", ALC883_TARGA_2ch_DIG), |
7619 | SND_PCI_QUIRK(0x1462, 0x3ef9, "MSI", ALC883_TARGA_DIG), | 7672 | SND_PCI_QUIRK(0x1462, 0x3ef9, "MSI", ALC883_TARGA_DIG), |
7620 | SND_PCI_QUIRK(0x1462, 0x3fc1, "MSI", ALC883_TARGA_DIG), | 7673 | SND_PCI_QUIRK(0x1462, 0x3fc1, "MSI", ALC883_TARGA_DIG), |
@@ -7627,13 +7680,17 @@ static struct snd_pci_quirk alc883_cfg_tbl[] = { | |||
7627 | SND_PCI_QUIRK(0x1462, 0x6668, "MSI", ALC883_6ST_DIG), | 7680 | SND_PCI_QUIRK(0x1462, 0x6668, "MSI", ALC883_6ST_DIG), |
7628 | SND_PCI_QUIRK(0x1462, 0x7187, "MSI", ALC883_6ST_DIG), | 7681 | SND_PCI_QUIRK(0x1462, 0x7187, "MSI", ALC883_6ST_DIG), |
7629 | SND_PCI_QUIRK(0x1462, 0x7250, "MSI", ALC883_6ST_DIG), | 7682 | SND_PCI_QUIRK(0x1462, 0x7250, "MSI", ALC883_6ST_DIG), |
7683 | SND_PCI_QUIRK(0x1462, 0x7267, "MSI", ALC883_3ST_6ch_DIG), | ||
7630 | SND_PCI_QUIRK(0x1462, 0x7280, "MSI", ALC883_6ST_DIG), | 7684 | SND_PCI_QUIRK(0x1462, 0x7280, "MSI", ALC883_6ST_DIG), |
7631 | SND_PCI_QUIRK(0x1462, 0x7327, "MSI", ALC883_6ST_DIG), | 7685 | SND_PCI_QUIRK(0x1462, 0x7327, "MSI", ALC883_6ST_DIG), |
7632 | SND_PCI_QUIRK(0x1462, 0xa422, "MSI", ALC883_TARGA_2ch_DIG), | 7686 | SND_PCI_QUIRK(0x1462, 0xa422, "MSI", ALC883_TARGA_2ch_DIG), |
7633 | SND_PCI_QUIRK(0x147b, 0x1083, "Abit IP35-PRO", ALC883_6ST_DIG), | 7687 | SND_PCI_QUIRK(0x147b, 0x1083, "Abit IP35-PRO", ALC883_6ST_DIG), |
7688 | SND_PCI_QUIRK(0x1558, 0x0721, "Clevo laptop M720R", ALC883_CLEVO_M720), | ||
7689 | SND_PCI_QUIRK(0x1558, 0x0722, "Clevo laptop M720SR", ALC883_CLEVO_M720), | ||
7634 | SND_PCI_QUIRK(0x1558, 0, "Clevo laptop", ALC883_LAPTOP_EAPD), | 7690 | SND_PCI_QUIRK(0x1558, 0, "Clevo laptop", ALC883_LAPTOP_EAPD), |
7635 | SND_PCI_QUIRK(0x15d9, 0x8780, "Supermicro PDSBA", ALC883_3ST_6ch), | 7691 | SND_PCI_QUIRK(0x15d9, 0x8780, "Supermicro PDSBA", ALC883_3ST_6ch), |
7636 | SND_PCI_QUIRK(0x161f, 0x2054, "Medion laptop", ALC883_MEDION), | 7692 | SND_PCI_QUIRK(0x161f, 0x2054, "Medion laptop", ALC883_MEDION), |
7693 | SND_PCI_QUIRK(0x1734, 0x1108, "Fujitsu AMILO Pi2515", ALC883_FUJITSU_PI2515), | ||
7637 | SND_PCI_QUIRK(0x17aa, 0x101e, "Lenovo 101e", ALC883_LENOVO_101E_2ch), | 7694 | SND_PCI_QUIRK(0x17aa, 0x101e, "Lenovo 101e", ALC883_LENOVO_101E_2ch), |
7638 | SND_PCI_QUIRK(0x17aa, 0x2085, "Lenovo NB0763", ALC883_LENOVO_NB0763), | 7695 | SND_PCI_QUIRK(0x17aa, 0x2085, "Lenovo NB0763", ALC883_LENOVO_NB0763), |
7639 | SND_PCI_QUIRK(0x17aa, 0x3bfc, "Lenovo NB0763", ALC883_LENOVO_NB0763), | 7696 | SND_PCI_QUIRK(0x17aa, 0x3bfc, "Lenovo NB0763", ALC883_LENOVO_NB0763), |
@@ -7652,8 +7709,6 @@ static struct alc_config_preset alc883_presets[] = { | |||
7652 | .num_dacs = ARRAY_SIZE(alc883_dac_nids), | 7709 | .num_dacs = ARRAY_SIZE(alc883_dac_nids), |
7653 | .dac_nids = alc883_dac_nids, | 7710 | .dac_nids = alc883_dac_nids, |
7654 | .dig_out_nid = ALC883_DIGOUT_NID, | 7711 | .dig_out_nid = ALC883_DIGOUT_NID, |
7655 | .num_adc_nids = ARRAY_SIZE(alc883_adc_nids), | ||
7656 | .adc_nids = alc883_adc_nids, | ||
7657 | .dig_in_nid = ALC883_DIGIN_NID, | 7712 | .dig_in_nid = ALC883_DIGIN_NID, |
7658 | .num_channel_mode = ARRAY_SIZE(alc883_3ST_2ch_modes), | 7713 | .num_channel_mode = ARRAY_SIZE(alc883_3ST_2ch_modes), |
7659 | .channel_mode = alc883_3ST_2ch_modes, | 7714 | .channel_mode = alc883_3ST_2ch_modes, |
@@ -7665,8 +7720,6 @@ static struct alc_config_preset alc883_presets[] = { | |||
7665 | .num_dacs = ARRAY_SIZE(alc883_dac_nids), | 7720 | .num_dacs = ARRAY_SIZE(alc883_dac_nids), |
7666 | .dac_nids = alc883_dac_nids, | 7721 | .dac_nids = alc883_dac_nids, |
7667 | .dig_out_nid = ALC883_DIGOUT_NID, | 7722 | .dig_out_nid = ALC883_DIGOUT_NID, |
7668 | .num_adc_nids = ARRAY_SIZE(alc883_adc_nids), | ||
7669 | .adc_nids = alc883_adc_nids, | ||
7670 | .dig_in_nid = ALC883_DIGIN_NID, | 7723 | .dig_in_nid = ALC883_DIGIN_NID, |
7671 | .num_channel_mode = ARRAY_SIZE(alc883_3ST_6ch_modes), | 7724 | .num_channel_mode = ARRAY_SIZE(alc883_3ST_6ch_modes), |
7672 | .channel_mode = alc883_3ST_6ch_modes, | 7725 | .channel_mode = alc883_3ST_6ch_modes, |
@@ -7678,8 +7731,6 @@ static struct alc_config_preset alc883_presets[] = { | |||
7678 | .init_verbs = { alc883_init_verbs }, | 7731 | .init_verbs = { alc883_init_verbs }, |
7679 | .num_dacs = ARRAY_SIZE(alc883_dac_nids), | 7732 | .num_dacs = ARRAY_SIZE(alc883_dac_nids), |
7680 | .dac_nids = alc883_dac_nids, | 7733 | .dac_nids = alc883_dac_nids, |
7681 | .num_adc_nids = ARRAY_SIZE(alc883_adc_nids), | ||
7682 | .adc_nids = alc883_adc_nids, | ||
7683 | .num_channel_mode = ARRAY_SIZE(alc883_3ST_6ch_modes), | 7734 | .num_channel_mode = ARRAY_SIZE(alc883_3ST_6ch_modes), |
7684 | .channel_mode = alc883_3ST_6ch_modes, | 7735 | .channel_mode = alc883_3ST_6ch_modes, |
7685 | .need_dac_fix = 1, | 7736 | .need_dac_fix = 1, |
@@ -7691,8 +7742,6 @@ static struct alc_config_preset alc883_presets[] = { | |||
7691 | .num_dacs = ARRAY_SIZE(alc883_dac_nids), | 7742 | .num_dacs = ARRAY_SIZE(alc883_dac_nids), |
7692 | .dac_nids = alc883_dac_nids, | 7743 | .dac_nids = alc883_dac_nids, |
7693 | .dig_out_nid = ALC883_DIGOUT_NID, | 7744 | .dig_out_nid = ALC883_DIGOUT_NID, |
7694 | .num_adc_nids = ARRAY_SIZE(alc883_adc_nids), | ||
7695 | .adc_nids = alc883_adc_nids, | ||
7696 | .dig_in_nid = ALC883_DIGIN_NID, | 7745 | .dig_in_nid = ALC883_DIGIN_NID, |
7697 | .num_channel_mode = ARRAY_SIZE(alc883_sixstack_modes), | 7746 | .num_channel_mode = ARRAY_SIZE(alc883_sixstack_modes), |
7698 | .channel_mode = alc883_sixstack_modes, | 7747 | .channel_mode = alc883_sixstack_modes, |
@@ -7704,8 +7753,6 @@ static struct alc_config_preset alc883_presets[] = { | |||
7704 | .num_dacs = ARRAY_SIZE(alc883_dac_nids), | 7753 | .num_dacs = ARRAY_SIZE(alc883_dac_nids), |
7705 | .dac_nids = alc883_dac_nids, | 7754 | .dac_nids = alc883_dac_nids, |
7706 | .dig_out_nid = ALC883_DIGOUT_NID, | 7755 | .dig_out_nid = ALC883_DIGOUT_NID, |
7707 | .num_adc_nids = ARRAY_SIZE(alc883_adc_nids), | ||
7708 | .adc_nids = alc883_adc_nids, | ||
7709 | .num_channel_mode = ARRAY_SIZE(alc883_3ST_6ch_modes), | 7756 | .num_channel_mode = ARRAY_SIZE(alc883_3ST_6ch_modes), |
7710 | .channel_mode = alc883_3ST_6ch_modes, | 7757 | .channel_mode = alc883_3ST_6ch_modes, |
7711 | .need_dac_fix = 1, | 7758 | .need_dac_fix = 1, |
@@ -7719,8 +7766,6 @@ static struct alc_config_preset alc883_presets[] = { | |||
7719 | .num_dacs = ARRAY_SIZE(alc883_dac_nids), | 7766 | .num_dacs = ARRAY_SIZE(alc883_dac_nids), |
7720 | .dac_nids = alc883_dac_nids, | 7767 | .dac_nids = alc883_dac_nids, |
7721 | .dig_out_nid = ALC883_DIGOUT_NID, | 7768 | .dig_out_nid = ALC883_DIGOUT_NID, |
7722 | .num_adc_nids = ARRAY_SIZE(alc883_adc_nids), | ||
7723 | .adc_nids = alc883_adc_nids, | ||
7724 | .num_channel_mode = ARRAY_SIZE(alc883_3ST_2ch_modes), | 7769 | .num_channel_mode = ARRAY_SIZE(alc883_3ST_2ch_modes), |
7725 | .channel_mode = alc883_3ST_2ch_modes, | 7770 | .channel_mode = alc883_3ST_2ch_modes, |
7726 | .input_mux = &alc883_capture_source, | 7771 | .input_mux = &alc883_capture_source, |
@@ -7737,8 +7782,6 @@ static struct alc_config_preset alc883_presets[] = { | |||
7737 | .init_verbs = { alc883_init_verbs, alc880_gpio1_init_verbs }, | 7782 | .init_verbs = { alc883_init_verbs, alc880_gpio1_init_verbs }, |
7738 | .num_dacs = ARRAY_SIZE(alc883_dac_nids), | 7783 | .num_dacs = ARRAY_SIZE(alc883_dac_nids), |
7739 | .dac_nids = alc883_dac_nids, | 7784 | .dac_nids = alc883_dac_nids, |
7740 | .num_adc_nids = ARRAY_SIZE(alc883_adc_nids), | ||
7741 | .adc_nids = alc883_adc_nids, | ||
7742 | .num_channel_mode = ARRAY_SIZE(alc883_3ST_2ch_modes), | 7785 | .num_channel_mode = ARRAY_SIZE(alc883_3ST_2ch_modes), |
7743 | .channel_mode = alc883_3ST_2ch_modes, | 7786 | .channel_mode = alc883_3ST_2ch_modes, |
7744 | .input_mux = &alc883_capture_source, | 7787 | .input_mux = &alc883_capture_source, |
@@ -7749,8 +7792,6 @@ static struct alc_config_preset alc883_presets[] = { | |||
7749 | .num_dacs = ARRAY_SIZE(alc883_dac_nids), | 7792 | .num_dacs = ARRAY_SIZE(alc883_dac_nids), |
7750 | .dac_nids = alc883_dac_nids, | 7793 | .dac_nids = alc883_dac_nids, |
7751 | .dig_out_nid = ALC883_DIGOUT_NID, | 7794 | .dig_out_nid = ALC883_DIGOUT_NID, |
7752 | .num_adc_nids = ARRAY_SIZE(alc883_adc_nids), | ||
7753 | .adc_nids = alc883_adc_nids, | ||
7754 | .num_channel_mode = ARRAY_SIZE(alc883_3ST_2ch_modes), | 7795 | .num_channel_mode = ARRAY_SIZE(alc883_3ST_2ch_modes), |
7755 | .channel_mode = alc883_3ST_2ch_modes, | 7796 | .channel_mode = alc883_3ST_2ch_modes, |
7756 | .input_mux = &alc883_capture_source, | 7797 | .input_mux = &alc883_capture_source, |
@@ -7764,8 +7805,6 @@ static struct alc_config_preset alc883_presets[] = { | |||
7764 | alc883_medion_eapd_verbs }, | 7805 | alc883_medion_eapd_verbs }, |
7765 | .num_dacs = ARRAY_SIZE(alc883_dac_nids), | 7806 | .num_dacs = ARRAY_SIZE(alc883_dac_nids), |
7766 | .dac_nids = alc883_dac_nids, | 7807 | .dac_nids = alc883_dac_nids, |
7767 | .num_adc_nids = ARRAY_SIZE(alc883_adc_nids), | ||
7768 | .adc_nids = alc883_adc_nids, | ||
7769 | .num_channel_mode = ARRAY_SIZE(alc883_sixstack_modes), | 7808 | .num_channel_mode = ARRAY_SIZE(alc883_sixstack_modes), |
7770 | .channel_mode = alc883_sixstack_modes, | 7809 | .channel_mode = alc883_sixstack_modes, |
7771 | .input_mux = &alc883_capture_source, | 7810 | .input_mux = &alc883_capture_source, |
@@ -7776,8 +7815,6 @@ static struct alc_config_preset alc883_presets[] = { | |||
7776 | .num_dacs = ARRAY_SIZE(alc883_dac_nids), | 7815 | .num_dacs = ARRAY_SIZE(alc883_dac_nids), |
7777 | .dac_nids = alc883_dac_nids, | 7816 | .dac_nids = alc883_dac_nids, |
7778 | .dig_out_nid = ALC883_DIGOUT_NID, | 7817 | .dig_out_nid = ALC883_DIGOUT_NID, |
7779 | .num_adc_nids = ARRAY_SIZE(alc883_adc_nids), | ||
7780 | .adc_nids = alc883_adc_nids, | ||
7781 | .num_channel_mode = ARRAY_SIZE(alc883_3ST_2ch_modes), | 7818 | .num_channel_mode = ARRAY_SIZE(alc883_3ST_2ch_modes), |
7782 | .channel_mode = alc883_3ST_2ch_modes, | 7819 | .channel_mode = alc883_3ST_2ch_modes, |
7783 | .input_mux = &alc883_capture_source, | 7820 | .input_mux = &alc883_capture_source, |
@@ -7789,19 +7826,27 @@ static struct alc_config_preset alc883_presets[] = { | |||
7789 | .init_verbs = { alc883_init_verbs, alc882_eapd_verbs }, | 7826 | .init_verbs = { alc883_init_verbs, alc882_eapd_verbs }, |
7790 | .num_dacs = ARRAY_SIZE(alc883_dac_nids), | 7827 | .num_dacs = ARRAY_SIZE(alc883_dac_nids), |
7791 | .dac_nids = alc883_dac_nids, | 7828 | .dac_nids = alc883_dac_nids, |
7792 | .num_adc_nids = ARRAY_SIZE(alc883_adc_nids), | ||
7793 | .adc_nids = alc883_adc_nids, | ||
7794 | .num_channel_mode = ARRAY_SIZE(alc883_3ST_2ch_modes), | 7829 | .num_channel_mode = ARRAY_SIZE(alc883_3ST_2ch_modes), |
7795 | .channel_mode = alc883_3ST_2ch_modes, | 7830 | .channel_mode = alc883_3ST_2ch_modes, |
7796 | .input_mux = &alc883_capture_source, | 7831 | .input_mux = &alc883_capture_source, |
7797 | }, | 7832 | }, |
7833 | [ALC883_CLEVO_M720] = { | ||
7834 | .mixers = { alc883_clevo_m720_mixer }, | ||
7835 | .init_verbs = { alc883_init_verbs, alc883_clevo_m720_verbs }, | ||
7836 | .num_dacs = ARRAY_SIZE(alc883_dac_nids), | ||
7837 | .dac_nids = alc883_dac_nids, | ||
7838 | .dig_out_nid = ALC883_DIGOUT_NID, | ||
7839 | .num_channel_mode = ARRAY_SIZE(alc883_3ST_2ch_modes), | ||
7840 | .channel_mode = alc883_3ST_2ch_modes, | ||
7841 | .input_mux = &alc883_capture_source, | ||
7842 | .unsol_event = alc883_clevo_m720_unsol_event, | ||
7843 | .init_hook = alc883_clevo_m720_automute, | ||
7844 | }, | ||
7798 | [ALC883_LENOVO_101E_2ch] = { | 7845 | [ALC883_LENOVO_101E_2ch] = { |
7799 | .mixers = { alc883_lenovo_101e_2ch_mixer}, | 7846 | .mixers = { alc883_lenovo_101e_2ch_mixer}, |
7800 | .init_verbs = { alc883_init_verbs, alc883_lenovo_101e_verbs}, | 7847 | .init_verbs = { alc883_init_verbs, alc883_lenovo_101e_verbs}, |
7801 | .num_dacs = ARRAY_SIZE(alc883_dac_nids), | 7848 | .num_dacs = ARRAY_SIZE(alc883_dac_nids), |
7802 | .dac_nids = alc883_dac_nids, | 7849 | .dac_nids = alc883_dac_nids, |
7803 | .num_adc_nids = ARRAY_SIZE(alc883_adc_nids), | ||
7804 | .adc_nids = alc883_adc_nids, | ||
7805 | .num_channel_mode = ARRAY_SIZE(alc883_3ST_2ch_modes), | 7850 | .num_channel_mode = ARRAY_SIZE(alc883_3ST_2ch_modes), |
7806 | .channel_mode = alc883_3ST_2ch_modes, | 7851 | .channel_mode = alc883_3ST_2ch_modes, |
7807 | .input_mux = &alc883_lenovo_101e_capture_source, | 7852 | .input_mux = &alc883_lenovo_101e_capture_source, |
@@ -7813,8 +7858,6 @@ static struct alc_config_preset alc883_presets[] = { | |||
7813 | .init_verbs = { alc883_init_verbs, alc883_lenovo_nb0763_verbs}, | 7858 | .init_verbs = { alc883_init_verbs, alc883_lenovo_nb0763_verbs}, |
7814 | .num_dacs = ARRAY_SIZE(alc883_dac_nids), | 7859 | .num_dacs = ARRAY_SIZE(alc883_dac_nids), |
7815 | .dac_nids = alc883_dac_nids, | 7860 | .dac_nids = alc883_dac_nids, |
7816 | .num_adc_nids = ARRAY_SIZE(alc883_adc_nids), | ||
7817 | .adc_nids = alc883_adc_nids, | ||
7818 | .num_channel_mode = ARRAY_SIZE(alc883_3ST_2ch_modes), | 7861 | .num_channel_mode = ARRAY_SIZE(alc883_3ST_2ch_modes), |
7819 | .channel_mode = alc883_3ST_2ch_modes, | 7862 | .channel_mode = alc883_3ST_2ch_modes, |
7820 | .need_dac_fix = 1, | 7863 | .need_dac_fix = 1, |
@@ -7828,8 +7871,6 @@ static struct alc_config_preset alc883_presets[] = { | |||
7828 | .num_dacs = ARRAY_SIZE(alc883_dac_nids), | 7871 | .num_dacs = ARRAY_SIZE(alc883_dac_nids), |
7829 | .dac_nids = alc883_dac_nids, | 7872 | .dac_nids = alc883_dac_nids, |
7830 | .dig_out_nid = ALC883_DIGOUT_NID, | 7873 | .dig_out_nid = ALC883_DIGOUT_NID, |
7831 | .num_adc_nids = ARRAY_SIZE(alc883_adc_nids), | ||
7832 | .adc_nids = alc883_adc_nids, | ||
7833 | .num_channel_mode = ARRAY_SIZE(alc883_3ST_6ch_modes), | 7874 | .num_channel_mode = ARRAY_SIZE(alc883_3ST_6ch_modes), |
7834 | .channel_mode = alc883_3ST_6ch_modes, | 7875 | .channel_mode = alc883_3ST_6ch_modes, |
7835 | .need_dac_fix = 1, | 7876 | .need_dac_fix = 1, |
@@ -7843,47 +7884,28 @@ static struct alc_config_preset alc883_presets[] = { | |||
7843 | .num_dacs = ARRAY_SIZE(alc883_dac_nids), | 7884 | .num_dacs = ARRAY_SIZE(alc883_dac_nids), |
7844 | .dac_nids = alc883_dac_nids, | 7885 | .dac_nids = alc883_dac_nids, |
7845 | .dig_out_nid = ALC883_DIGOUT_NID, | 7886 | .dig_out_nid = ALC883_DIGOUT_NID, |
7846 | .num_adc_nids = ARRAY_SIZE(alc883_adc_nids), | ||
7847 | .adc_nids = alc883_adc_nids, | ||
7848 | .num_channel_mode = ARRAY_SIZE(alc883_3ST_2ch_modes), | 7887 | .num_channel_mode = ARRAY_SIZE(alc883_3ST_2ch_modes), |
7849 | .channel_mode = alc883_3ST_2ch_modes, | 7888 | .channel_mode = alc883_3ST_2ch_modes, |
7850 | .input_mux = &alc883_capture_source, | 7889 | .input_mux = &alc883_capture_source, |
7851 | .unsol_event = alc883_haier_w66_unsol_event, | 7890 | .unsol_event = alc883_haier_w66_unsol_event, |
7852 | .init_hook = alc883_haier_w66_automute, | 7891 | .init_hook = alc883_haier_w66_automute, |
7853 | }, | ||
7854 | [ALC888_6ST_HP] = { | ||
7855 | .mixers = { alc888_6st_hp_mixer, alc883_chmode_mixer }, | ||
7856 | .init_verbs = { alc883_init_verbs, alc888_6st_hp_verbs }, | ||
7857 | .num_dacs = ARRAY_SIZE(alc883_dac_nids), | ||
7858 | .dac_nids = alc883_dac_nids, | ||
7859 | .dig_out_nid = ALC883_DIGOUT_NID, | ||
7860 | .num_adc_nids = ARRAY_SIZE(alc883_adc_nids), | ||
7861 | .adc_nids = alc883_adc_nids, | ||
7862 | .dig_in_nid = ALC883_DIGIN_NID, | ||
7863 | .num_channel_mode = ARRAY_SIZE(alc883_sixstack_modes), | ||
7864 | .channel_mode = alc883_sixstack_modes, | ||
7865 | .input_mux = &alc883_capture_source, | ||
7866 | }, | 7892 | }, |
7867 | [ALC888_3ST_HP] = { | 7893 | [ALC888_3ST_HP] = { |
7868 | .mixers = { alc888_3st_hp_mixer, alc883_chmode_mixer }, | 7894 | .mixers = { alc883_3ST_6ch_mixer, alc883_chmode_mixer }, |
7869 | .init_verbs = { alc883_init_verbs, alc888_3st_hp_verbs }, | 7895 | .init_verbs = { alc883_init_verbs, alc888_3st_hp_verbs }, |
7870 | .num_dacs = ARRAY_SIZE(alc883_dac_nids), | 7896 | .num_dacs = ARRAY_SIZE(alc883_dac_nids), |
7871 | .dac_nids = alc883_dac_nids, | 7897 | .dac_nids = alc883_dac_nids, |
7872 | .num_adc_nids = ARRAY_SIZE(alc883_adc_nids), | ||
7873 | .adc_nids = alc883_adc_nids, | ||
7874 | .num_channel_mode = ARRAY_SIZE(alc888_3st_hp_modes), | 7898 | .num_channel_mode = ARRAY_SIZE(alc888_3st_hp_modes), |
7875 | .channel_mode = alc888_3st_hp_modes, | 7899 | .channel_mode = alc888_3st_hp_modes, |
7876 | .need_dac_fix = 1, | 7900 | .need_dac_fix = 1, |
7877 | .input_mux = &alc883_capture_source, | 7901 | .input_mux = &alc883_capture_source, |
7878 | }, | 7902 | }, |
7879 | [ALC888_6ST_DELL] = { | 7903 | [ALC888_6ST_DELL] = { |
7880 | .mixers = { alc888_6st_dell_mixer, alc883_chmode_mixer }, | 7904 | .mixers = { alc883_base_mixer, alc883_chmode_mixer }, |
7881 | .init_verbs = { alc883_init_verbs, alc888_6st_dell_verbs }, | 7905 | .init_verbs = { alc883_init_verbs, alc888_6st_dell_verbs }, |
7882 | .num_dacs = ARRAY_SIZE(alc883_dac_nids), | 7906 | .num_dacs = ARRAY_SIZE(alc883_dac_nids), |
7883 | .dac_nids = alc883_dac_nids, | 7907 | .dac_nids = alc883_dac_nids, |
7884 | .dig_out_nid = ALC883_DIGOUT_NID, | 7908 | .dig_out_nid = ALC883_DIGOUT_NID, |
7885 | .num_adc_nids = ARRAY_SIZE(alc883_adc_nids), | ||
7886 | .adc_nids = alc883_adc_nids, | ||
7887 | .dig_in_nid = ALC883_DIGIN_NID, | 7909 | .dig_in_nid = ALC883_DIGIN_NID, |
7888 | .num_channel_mode = ARRAY_SIZE(alc883_sixstack_modes), | 7910 | .num_channel_mode = ARRAY_SIZE(alc883_sixstack_modes), |
7889 | .channel_mode = alc883_sixstack_modes, | 7911 | .channel_mode = alc883_sixstack_modes, |
@@ -7896,14 +7918,25 @@ static struct alc_config_preset alc883_presets[] = { | |||
7896 | .init_verbs = { alc883_init_verbs, alc883_mitac_verbs }, | 7918 | .init_verbs = { alc883_init_verbs, alc883_mitac_verbs }, |
7897 | .num_dacs = ARRAY_SIZE(alc883_dac_nids), | 7919 | .num_dacs = ARRAY_SIZE(alc883_dac_nids), |
7898 | .dac_nids = alc883_dac_nids, | 7920 | .dac_nids = alc883_dac_nids, |
7899 | .num_adc_nids = ARRAY_SIZE(alc883_adc_nids), | ||
7900 | .adc_nids = alc883_adc_nids, | ||
7901 | .num_channel_mode = ARRAY_SIZE(alc883_3ST_2ch_modes), | 7921 | .num_channel_mode = ARRAY_SIZE(alc883_3ST_2ch_modes), |
7902 | .channel_mode = alc883_3ST_2ch_modes, | 7922 | .channel_mode = alc883_3ST_2ch_modes, |
7903 | .input_mux = &alc883_capture_source, | 7923 | .input_mux = &alc883_capture_source, |
7904 | .unsol_event = alc883_mitac_unsol_event, | 7924 | .unsol_event = alc883_mitac_unsol_event, |
7905 | .init_hook = alc883_mitac_automute, | 7925 | .init_hook = alc883_mitac_automute, |
7906 | }, | 7926 | }, |
7927 | [ALC883_FUJITSU_PI2515] = { | ||
7928 | .mixers = { alc883_2ch_fujitsu_pi2515_mixer }, | ||
7929 | .init_verbs = { alc883_init_verbs, | ||
7930 | alc883_2ch_fujitsu_pi2515_verbs}, | ||
7931 | .num_dacs = ARRAY_SIZE(alc883_dac_nids), | ||
7932 | .dac_nids = alc883_dac_nids, | ||
7933 | .dig_out_nid = ALC883_DIGOUT_NID, | ||
7934 | .num_channel_mode = ARRAY_SIZE(alc883_3ST_2ch_modes), | ||
7935 | .channel_mode = alc883_3ST_2ch_modes, | ||
7936 | .input_mux = &alc883_fujitsu_pi2515_capture_source, | ||
7937 | .unsol_event = alc883_2ch_fujitsu_pi2515_unsol_event, | ||
7938 | .init_hook = alc883_2ch_fujitsu_pi2515_automute, | ||
7939 | }, | ||
7907 | }; | 7940 | }; |
7908 | 7941 | ||
7909 | 7942 | ||
@@ -7918,15 +7951,11 @@ static void alc883_auto_set_output_and_unmute(struct hda_codec *codec, | |||
7918 | struct alc_spec *spec = codec->spec; | 7951 | struct alc_spec *spec = codec->spec; |
7919 | int idx; | 7952 | int idx; |
7920 | 7953 | ||
7954 | alc_set_pin_output(codec, nid, pin_type); | ||
7921 | if (spec->multiout.dac_nids[dac_idx] == 0x25) | 7955 | if (spec->multiout.dac_nids[dac_idx] == 0x25) |
7922 | idx = 4; | 7956 | idx = 4; |
7923 | else | 7957 | else |
7924 | idx = spec->multiout.dac_nids[dac_idx] - 2; | 7958 | idx = spec->multiout.dac_nids[dac_idx] - 2; |
7925 | |||
7926 | snd_hda_codec_write(codec, nid, 0, AC_VERB_SET_PIN_WIDGET_CONTROL, | ||
7927 | pin_type); | ||
7928 | snd_hda_codec_write(codec, nid, 0, AC_VERB_SET_AMP_GAIN_MUTE, | ||
7929 | AMP_OUT_UNMUTE); | ||
7930 | snd_hda_codec_write(codec, nid, 0, AC_VERB_SET_CONNECT_SEL, idx); | 7959 | snd_hda_codec_write(codec, nid, 0, AC_VERB_SET_CONNECT_SEL, idx); |
7931 | 7960 | ||
7932 | } | 7961 | } |
@@ -7955,6 +7984,9 @@ static void alc883_auto_init_hp_out(struct hda_codec *codec) | |||
7955 | if (pin) /* connect to front */ | 7984 | if (pin) /* connect to front */ |
7956 | /* use dac 0 */ | 7985 | /* use dac 0 */ |
7957 | alc883_auto_set_output_and_unmute(codec, pin, PIN_HP, 0); | 7986 | alc883_auto_set_output_and_unmute(codec, pin, PIN_HP, 0); |
7987 | pin = spec->autocfg.speaker_pins[0]; | ||
7988 | if (pin) | ||
7989 | alc883_auto_set_output_and_unmute(codec, pin, PIN_OUT, 0); | ||
7958 | } | 7990 | } |
7959 | 7991 | ||
7960 | #define alc883_is_input_pin(nid) alc880_is_input_pin(nid) | 7992 | #define alc883_is_input_pin(nid) alc880_is_input_pin(nid) |
@@ -8006,9 +8038,12 @@ static int alc883_parse_auto_config(struct hda_codec *codec) | |||
8006 | /* additional initialization for auto-configuration model */ | 8038 | /* additional initialization for auto-configuration model */ |
8007 | static void alc883_auto_init(struct hda_codec *codec) | 8039 | static void alc883_auto_init(struct hda_codec *codec) |
8008 | { | 8040 | { |
8041 | struct alc_spec *spec = codec->spec; | ||
8009 | alc883_auto_init_multi_out(codec); | 8042 | alc883_auto_init_multi_out(codec); |
8010 | alc883_auto_init_hp_out(codec); | 8043 | alc883_auto_init_hp_out(codec); |
8011 | alc883_auto_init_analog_input(codec); | 8044 | alc883_auto_init_analog_input(codec); |
8045 | if (spec->unsol_event) | ||
8046 | alc_sku_automute(codec); | ||
8012 | } | 8047 | } |
8013 | 8048 | ||
8014 | static int patch_alc883(struct hda_codec *codec) | 8049 | static int patch_alc883(struct hda_codec *codec) |
@@ -8057,10 +8092,9 @@ static int patch_alc883(struct hda_codec *codec) | |||
8057 | spec->stream_digital_playback = &alc883_pcm_digital_playback; | 8092 | spec->stream_digital_playback = &alc883_pcm_digital_playback; |
8058 | spec->stream_digital_capture = &alc883_pcm_digital_capture; | 8093 | spec->stream_digital_capture = &alc883_pcm_digital_capture; |
8059 | 8094 | ||
8060 | if (!spec->adc_nids && spec->input_mux) { | 8095 | spec->num_adc_nids = ARRAY_SIZE(alc883_adc_nids); |
8061 | spec->adc_nids = alc883_adc_nids; | 8096 | spec->adc_nids = alc883_adc_nids; |
8062 | spec->num_adc_nids = ARRAY_SIZE(alc883_adc_nids); | 8097 | spec->capsrc_nids = alc883_capsrc_nids; |
8063 | } | ||
8064 | 8098 | ||
8065 | spec->vmaster_nid = 0x0c; | 8099 | spec->vmaster_nid = 0x0c; |
8066 | 8100 | ||
@@ -8085,6 +8119,8 @@ static int patch_alc883(struct hda_codec *codec) | |||
8085 | #define alc262_dac_nids alc260_dac_nids | 8119 | #define alc262_dac_nids alc260_dac_nids |
8086 | #define alc262_adc_nids alc882_adc_nids | 8120 | #define alc262_adc_nids alc882_adc_nids |
8087 | #define alc262_adc_nids_alt alc882_adc_nids_alt | 8121 | #define alc262_adc_nids_alt alc882_adc_nids_alt |
8122 | #define alc262_capsrc_nids alc882_capsrc_nids | ||
8123 | #define alc262_capsrc_nids_alt alc882_capsrc_nids_alt | ||
8088 | 8124 | ||
8089 | #define alc262_modes alc260_modes | 8125 | #define alc262_modes alc260_modes |
8090 | #define alc262_capture_source alc882_capture_source | 8126 | #define alc262_capture_source alc882_capture_source |
@@ -8585,7 +8621,8 @@ static void alc262_hippo1_unsol_event(struct hda_codec *codec, | |||
8585 | 8621 | ||
8586 | /* | 8622 | /* |
8587 | * fujitsu model | 8623 | * fujitsu model |
8588 | * 0x14 = headphone/spdif-out, 0x15 = internal speaker | 8624 | * 0x14 = headphone/spdif-out, 0x15 = internal speaker, |
8625 | * 0x1b = port replicator headphone out | ||
8589 | */ | 8626 | */ |
8590 | 8627 | ||
8591 | #define ALC_HP_EVENT 0x37 | 8628 | #define ALC_HP_EVENT 0x37 |
@@ -8593,6 +8630,14 @@ static void alc262_hippo1_unsol_event(struct hda_codec *codec, | |||
8593 | static struct hda_verb alc262_fujitsu_unsol_verbs[] = { | 8630 | static struct hda_verb alc262_fujitsu_unsol_verbs[] = { |
8594 | {0x14, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC_HP_EVENT}, | 8631 | {0x14, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC_HP_EVENT}, |
8595 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, | 8632 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
8633 | {0x1b, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC_HP_EVENT}, | ||
8634 | {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, | ||
8635 | {} | ||
8636 | }; | ||
8637 | |||
8638 | static struct hda_verb alc262_lenovo_3000_unsol_verbs[] = { | ||
8639 | {0x1b, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC_HP_EVENT}, | ||
8640 | {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, | ||
8596 | {} | 8641 | {} |
8597 | }; | 8642 | }; |
8598 | 8643 | ||
@@ -8633,12 +8678,16 @@ static void alc262_fujitsu_automute(struct hda_codec *codec, int force) | |||
8633 | unsigned int mute; | 8678 | unsigned int mute; |
8634 | 8679 | ||
8635 | if (force || !spec->sense_updated) { | 8680 | if (force || !spec->sense_updated) { |
8636 | unsigned int present; | 8681 | unsigned int present_int_hp, present_dock_hp; |
8637 | /* need to execute and sync at first */ | 8682 | /* need to execute and sync at first */ |
8638 | snd_hda_codec_read(codec, 0x14, 0, AC_VERB_SET_PIN_SENSE, 0); | 8683 | snd_hda_codec_read(codec, 0x14, 0, AC_VERB_SET_PIN_SENSE, 0); |
8639 | present = snd_hda_codec_read(codec, 0x14, 0, | 8684 | present_int_hp = snd_hda_codec_read(codec, 0x14, 0, |
8640 | AC_VERB_GET_PIN_SENSE, 0); | 8685 | AC_VERB_GET_PIN_SENSE, 0); |
8641 | spec->jack_present = (present & 0x80000000) != 0; | 8686 | snd_hda_codec_read(codec, 0x1B, 0, AC_VERB_SET_PIN_SENSE, 0); |
8687 | present_dock_hp = snd_hda_codec_read(codec, 0x1b, 0, | ||
8688 | AC_VERB_GET_PIN_SENSE, 0); | ||
8689 | spec->jack_present = (present_int_hp & 0x80000000) != 0; | ||
8690 | spec->jack_present |= (present_dock_hp & 0x80000000) != 0; | ||
8642 | spec->sense_updated = 1; | 8691 | spec->sense_updated = 1; |
8643 | } | 8692 | } |
8644 | if (spec->jack_present) { | 8693 | if (spec->jack_present) { |
@@ -8672,6 +8721,46 @@ static struct hda_bind_ctls alc262_fujitsu_bind_master_vol = { | |||
8672 | }, | 8721 | }, |
8673 | }; | 8722 | }; |
8674 | 8723 | ||
8724 | /* mute/unmute internal speaker according to the hp jack and mute state */ | ||
8725 | static void alc262_lenovo_3000_automute(struct hda_codec *codec, int force) | ||
8726 | { | ||
8727 | struct alc_spec *spec = codec->spec; | ||
8728 | unsigned int mute; | ||
8729 | |||
8730 | if (force || !spec->sense_updated) { | ||
8731 | unsigned int present_int_hp; | ||
8732 | /* need to execute and sync at first */ | ||
8733 | snd_hda_codec_read(codec, 0x1b, 0, AC_VERB_SET_PIN_SENSE, 0); | ||
8734 | present_int_hp = snd_hda_codec_read(codec, 0x1b, 0, | ||
8735 | AC_VERB_GET_PIN_SENSE, 0); | ||
8736 | spec->jack_present = (present_int_hp & 0x80000000) != 0; | ||
8737 | spec->sense_updated = 1; | ||
8738 | } | ||
8739 | if (spec->jack_present) { | ||
8740 | /* mute internal speaker */ | ||
8741 | snd_hda_codec_amp_stereo(codec, 0x14, HDA_OUTPUT, 0, | ||
8742 | HDA_AMP_MUTE, HDA_AMP_MUTE); | ||
8743 | snd_hda_codec_amp_stereo(codec, 0x16, HDA_OUTPUT, 0, | ||
8744 | HDA_AMP_MUTE, HDA_AMP_MUTE); | ||
8745 | } else { | ||
8746 | /* unmute internal speaker if necessary */ | ||
8747 | mute = snd_hda_codec_amp_read(codec, 0x1b, 0, HDA_OUTPUT, 0); | ||
8748 | snd_hda_codec_amp_stereo(codec, 0x14, HDA_OUTPUT, 0, | ||
8749 | HDA_AMP_MUTE, mute); | ||
8750 | snd_hda_codec_amp_stereo(codec, 0x16, HDA_OUTPUT, 0, | ||
8751 | HDA_AMP_MUTE, mute); | ||
8752 | } | ||
8753 | } | ||
8754 | |||
8755 | /* unsolicited event for HP jack sensing */ | ||
8756 | static void alc262_lenovo_3000_unsol_event(struct hda_codec *codec, | ||
8757 | unsigned int res) | ||
8758 | { | ||
8759 | if ((res >> 26) != ALC_HP_EVENT) | ||
8760 | return; | ||
8761 | alc262_lenovo_3000_automute(codec, 1); | ||
8762 | } | ||
8763 | |||
8675 | /* bind hp and internal speaker mute (with plug check) */ | 8764 | /* bind hp and internal speaker mute (with plug check) */ |
8676 | static int alc262_fujitsu_master_sw_put(struct snd_kcontrol *kcontrol, | 8765 | static int alc262_fujitsu_master_sw_put(struct snd_kcontrol *kcontrol, |
8677 | struct snd_ctl_elem_value *ucontrol) | 8766 | struct snd_ctl_elem_value *ucontrol) |
@@ -8680,12 +8769,13 @@ static int alc262_fujitsu_master_sw_put(struct snd_kcontrol *kcontrol, | |||
8680 | long *valp = ucontrol->value.integer.value; | 8769 | long *valp = ucontrol->value.integer.value; |
8681 | int change; | 8770 | int change; |
8682 | 8771 | ||
8683 | change = snd_hda_codec_amp_update(codec, 0x14, 0, HDA_OUTPUT, 0, | 8772 | change = snd_hda_codec_amp_stereo(codec, 0x14, HDA_OUTPUT, 0, |
8684 | HDA_AMP_MUTE, | 8773 | HDA_AMP_MUTE, |
8685 | valp[0] ? 0 : HDA_AMP_MUTE); | 8774 | valp ? 0 : HDA_AMP_MUTE); |
8686 | change |= snd_hda_codec_amp_update(codec, 0x14, 1, HDA_OUTPUT, 0, | 8775 | change |= snd_hda_codec_amp_stereo(codec, 0x1b, HDA_OUTPUT, 0, |
8687 | HDA_AMP_MUTE, | 8776 | HDA_AMP_MUTE, |
8688 | valp[1] ? 0 : HDA_AMP_MUTE); | 8777 | valp ? 0 : HDA_AMP_MUTE); |
8778 | |||
8689 | if (change) | 8779 | if (change) |
8690 | alc262_fujitsu_automute(codec, 0); | 8780 | alc262_fujitsu_automute(codec, 0); |
8691 | return change; | 8781 | return change; |
@@ -8703,6 +8793,46 @@ static struct snd_kcontrol_new alc262_fujitsu_mixer[] = { | |||
8703 | }, | 8793 | }, |
8704 | HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT), | 8794 | HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT), |
8705 | HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT), | 8795 | HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT), |
8796 | HDA_CODEC_VOLUME("PC Speaker Volume", 0x0b, 0x05, HDA_INPUT), | ||
8797 | HDA_CODEC_MUTE("PC Speaker Switch", 0x0b, 0x05, HDA_INPUT), | ||
8798 | HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT), | ||
8799 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), | ||
8800 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), | ||
8801 | HDA_CODEC_VOLUME("Int Mic Boost", 0x19, 0, HDA_INPUT), | ||
8802 | HDA_CODEC_VOLUME("Int Mic Playback Volume", 0x0b, 0x1, HDA_INPUT), | ||
8803 | HDA_CODEC_MUTE("Int Mic Playback Switch", 0x0b, 0x1, HDA_INPUT), | ||
8804 | { } /* end */ | ||
8805 | }; | ||
8806 | |||
8807 | /* bind hp and internal speaker mute (with plug check) */ | ||
8808 | static int alc262_lenovo_3000_master_sw_put(struct snd_kcontrol *kcontrol, | ||
8809 | struct snd_ctl_elem_value *ucontrol) | ||
8810 | { | ||
8811 | struct hda_codec *codec = snd_kcontrol_chip(kcontrol); | ||
8812 | long *valp = ucontrol->value.integer.value; | ||
8813 | int change; | ||
8814 | |||
8815 | change = snd_hda_codec_amp_stereo(codec, 0x1b, HDA_OUTPUT, 0, | ||
8816 | HDA_AMP_MUTE, | ||
8817 | valp ? 0 : HDA_AMP_MUTE); | ||
8818 | |||
8819 | if (change) | ||
8820 | alc262_lenovo_3000_automute(codec, 0); | ||
8821 | return change; | ||
8822 | } | ||
8823 | |||
8824 | static struct snd_kcontrol_new alc262_lenovo_3000_mixer[] = { | ||
8825 | HDA_BIND_VOL("Master Playback Volume", &alc262_fujitsu_bind_master_vol), | ||
8826 | { | ||
8827 | .iface = SNDRV_CTL_ELEM_IFACE_MIXER, | ||
8828 | .name = "Master Playback Switch", | ||
8829 | .info = snd_hda_mixer_amp_switch_info, | ||
8830 | .get = snd_hda_mixer_amp_switch_get, | ||
8831 | .put = alc262_lenovo_3000_master_sw_put, | ||
8832 | .private_value = HDA_COMPOSE_AMP_VAL(0x1b, 3, 0, HDA_OUTPUT), | ||
8833 | }, | ||
8834 | HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT), | ||
8835 | HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT), | ||
8706 | HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT), | 8836 | HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT), |
8707 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), | 8837 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), |
8708 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), | 8838 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), |
@@ -8730,59 +8860,72 @@ static struct hda_verb alc262_benq_t31_EAPD_verbs[] = { | |||
8730 | 8860 | ||
8731 | /* Samsung Q1 Ultra Vista model setup */ | 8861 | /* Samsung Q1 Ultra Vista model setup */ |
8732 | static struct snd_kcontrol_new alc262_ultra_mixer[] = { | 8862 | static struct snd_kcontrol_new alc262_ultra_mixer[] = { |
8733 | HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT), | 8863 | HDA_CODEC_VOLUME("Master Playback Volume", 0x0c, 0x0, HDA_OUTPUT), |
8734 | HDA_CODEC_MUTE("Front Playback Switch", 0x14, 0x0, HDA_OUTPUT), | 8864 | HDA_BIND_MUTE("Master Playback Switch", 0x0c, 2, HDA_INPUT), |
8735 | HDA_CODEC_MUTE("Headphone Playback Switch", 0x15, 0x0, HDA_OUTPUT), | ||
8736 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x01, HDA_INPUT), | 8865 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x01, HDA_INPUT), |
8737 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x01, HDA_INPUT), | 8866 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x01, HDA_INPUT), |
8738 | HDA_CODEC_VOLUME("Mic Boost", 0x19, 0, HDA_INPUT), | 8867 | HDA_CODEC_VOLUME("Mic Boost", 0x19, 0, HDA_INPUT), |
8868 | HDA_CODEC_VOLUME("Headphone Mic Boost", 0x15, 0, HDA_INPUT), | ||
8739 | { } /* end */ | 8869 | { } /* end */ |
8740 | }; | 8870 | }; |
8741 | 8871 | ||
8742 | static struct hda_verb alc262_ultra_verbs[] = { | 8872 | static struct hda_verb alc262_ultra_verbs[] = { |
8743 | {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT}, | 8873 | /* output mixer */ |
8874 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, | ||
8875 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, | ||
8876 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, | ||
8877 | /* speaker */ | ||
8878 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, | ||
8879 | {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, | ||
8880 | {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, | ||
8881 | {0x14, AC_VERB_SET_CONNECT_SEL, 0x00}, | ||
8882 | /* HP */ | ||
8744 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, | 8883 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
8745 | {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x40}, | 8884 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
8746 | /* Mic is on Node 0x19 */ | 8885 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
8747 | {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24}, | 8886 | {0x15, AC_VERB_SET_CONNECT_SEL, 0x00}, |
8748 | {0x22, AC_VERB_SET_CONNECT_SEL, 0x01}, | 8887 | {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT}, |
8749 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x01 << 8))}, | 8888 | /* internal mic */ |
8750 | {0x23, AC_VERB_SET_CONNECT_SEL, 0x01}, | 8889 | {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80}, |
8751 | {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x01 << 8))}, | 8890 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
8752 | {0x24, AC_VERB_SET_CONNECT_SEL, 0x01}, | 8891 | /* ADC, choose mic */ |
8753 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x01 << 8))}, | 8892 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
8893 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, | ||
8894 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, | ||
8895 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)}, | ||
8896 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)}, | ||
8897 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)}, | ||
8898 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(5)}, | ||
8899 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(6)}, | ||
8900 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(7)}, | ||
8901 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(8)}, | ||
8754 | {} | 8902 | {} |
8755 | }; | 8903 | }; |
8756 | 8904 | ||
8757 | static struct hda_input_mux alc262_ultra_capture_source = { | ||
8758 | .num_items = 1, | ||
8759 | .items = { | ||
8760 | { "Mic", 0x1 }, | ||
8761 | }, | ||
8762 | }; | ||
8763 | |||
8764 | /* mute/unmute internal speaker according to the hp jack and mute state */ | 8905 | /* mute/unmute internal speaker according to the hp jack and mute state */ |
8765 | static void alc262_ultra_automute(struct hda_codec *codec) | 8906 | static void alc262_ultra_automute(struct hda_codec *codec) |
8766 | { | 8907 | { |
8767 | struct alc_spec *spec = codec->spec; | 8908 | struct alc_spec *spec = codec->spec; |
8768 | unsigned int mute; | 8909 | unsigned int mute; |
8769 | unsigned int present; | ||
8770 | 8910 | ||
8771 | /* need to execute and sync at first */ | 8911 | mute = 0; |
8772 | snd_hda_codec_read(codec, 0x15, 0, AC_VERB_SET_PIN_SENSE, 0); | 8912 | /* auto-mute only when HP is used as HP */ |
8773 | present = snd_hda_codec_read(codec, 0x15, 0, | 8913 | if (!spec->cur_mux[0]) { |
8774 | AC_VERB_GET_PIN_SENSE, 0); | 8914 | unsigned int present; |
8775 | spec->jack_present = (present & 0x80000000) != 0; | 8915 | /* need to execute and sync at first */ |
8776 | if (spec->jack_present) { | 8916 | snd_hda_codec_read(codec, 0x15, 0, AC_VERB_SET_PIN_SENSE, 0); |
8777 | /* mute internal speaker */ | 8917 | present = snd_hda_codec_read(codec, 0x15, 0, |
8778 | snd_hda_codec_amp_stereo(codec, 0x14, HDA_OUTPUT, 0, | 8918 | AC_VERB_GET_PIN_SENSE, 0); |
8779 | HDA_AMP_MUTE, HDA_AMP_MUTE); | 8919 | spec->jack_present = (present & AC_PINSENSE_PRESENCE) != 0; |
8780 | } else { | 8920 | if (spec->jack_present) |
8781 | /* unmute internal speaker if necessary */ | 8921 | mute = HDA_AMP_MUTE; |
8782 | mute = snd_hda_codec_amp_read(codec, 0x15, 0, HDA_OUTPUT, 0); | ||
8783 | snd_hda_codec_amp_stereo(codec, 0x14, HDA_OUTPUT, 0, | ||
8784 | HDA_AMP_MUTE, mute); | ||
8785 | } | 8922 | } |
8923 | /* mute/unmute internal speaker */ | ||
8924 | snd_hda_codec_amp_stereo(codec, 0x14, HDA_OUTPUT, 0, | ||
8925 | HDA_AMP_MUTE, mute); | ||
8926 | /* mute/unmute HP */ | ||
8927 | snd_hda_codec_amp_stereo(codec, 0x15, HDA_OUTPUT, 0, | ||
8928 | HDA_AMP_MUTE, mute ? 0 : HDA_AMP_MUTE); | ||
8786 | } | 8929 | } |
8787 | 8930 | ||
8788 | /* unsolicited event for HP jack sensing */ | 8931 | /* unsolicited event for HP jack sensing */ |
@@ -8794,6 +8937,45 @@ static void alc262_ultra_unsol_event(struct hda_codec *codec, | |||
8794 | alc262_ultra_automute(codec); | 8937 | alc262_ultra_automute(codec); |
8795 | } | 8938 | } |
8796 | 8939 | ||
8940 | static struct hda_input_mux alc262_ultra_capture_source = { | ||
8941 | .num_items = 2, | ||
8942 | .items = { | ||
8943 | { "Mic", 0x1 }, | ||
8944 | { "Headphone", 0x7 }, | ||
8945 | }, | ||
8946 | }; | ||
8947 | |||
8948 | static int alc262_ultra_mux_enum_put(struct snd_kcontrol *kcontrol, | ||
8949 | struct snd_ctl_elem_value *ucontrol) | ||
8950 | { | ||
8951 | struct hda_codec *codec = snd_kcontrol_chip(kcontrol); | ||
8952 | struct alc_spec *spec = codec->spec; | ||
8953 | int ret; | ||
8954 | |||
8955 | ret = alc882_mux_enum_put(kcontrol, ucontrol); | ||
8956 | if (!ret) | ||
8957 | return 0; | ||
8958 | /* reprogram the HP pin as mic or HP according to the input source */ | ||
8959 | snd_hda_codec_write_cache(codec, 0x15, 0, | ||
8960 | AC_VERB_SET_PIN_WIDGET_CONTROL, | ||
8961 | spec->cur_mux[0] ? PIN_VREF80 : PIN_HP); | ||
8962 | alc262_ultra_automute(codec); /* mute/unmute HP */ | ||
8963 | return ret; | ||
8964 | } | ||
8965 | |||
8966 | static struct snd_kcontrol_new alc262_ultra_capture_mixer[] = { | ||
8967 | HDA_CODEC_VOLUME("Capture Volume", 0x07, 0x0, HDA_INPUT), | ||
8968 | HDA_CODEC_MUTE("Capture Switch", 0x07, 0x0, HDA_INPUT), | ||
8969 | { | ||
8970 | .iface = SNDRV_CTL_ELEM_IFACE_MIXER, | ||
8971 | .name = "Capture Source", | ||
8972 | .info = alc882_mux_enum_info, | ||
8973 | .get = alc882_mux_enum_get, | ||
8974 | .put = alc262_ultra_mux_enum_put, | ||
8975 | }, | ||
8976 | { } /* end */ | ||
8977 | }; | ||
8978 | |||
8797 | /* add playback controls from the parsed DAC table */ | 8979 | /* add playback controls from the parsed DAC table */ |
8798 | static int alc262_auto_create_multi_out_ctls(struct alc_spec *spec, | 8980 | static int alc262_auto_create_multi_out_ctls(struct alc_spec *spec, |
8799 | const struct auto_pin_cfg *cfg) | 8981 | const struct auto_pin_cfg *cfg) |
@@ -9185,9 +9367,12 @@ static int alc262_parse_auto_config(struct hda_codec *codec) | |||
9185 | /* init callback for auto-configuration model -- overriding the default init */ | 9367 | /* init callback for auto-configuration model -- overriding the default init */ |
9186 | static void alc262_auto_init(struct hda_codec *codec) | 9368 | static void alc262_auto_init(struct hda_codec *codec) |
9187 | { | 9369 | { |
9370 | struct alc_spec *spec = codec->spec; | ||
9188 | alc262_auto_init_multi_out(codec); | 9371 | alc262_auto_init_multi_out(codec); |
9189 | alc262_auto_init_hp_out(codec); | 9372 | alc262_auto_init_hp_out(codec); |
9190 | alc262_auto_init_analog_input(codec); | 9373 | alc262_auto_init_analog_input(codec); |
9374 | if (spec->unsol_event) | ||
9375 | alc_sku_automute(codec); | ||
9191 | } | 9376 | } |
9192 | 9377 | ||
9193 | /* | 9378 | /* |
@@ -9206,6 +9391,7 @@ static const char *alc262_models[ALC262_MODEL_LAST] = { | |||
9206 | [ALC262_BENQ_T31] = "benq-t31", | 9391 | [ALC262_BENQ_T31] = "benq-t31", |
9207 | [ALC262_SONY_ASSAMD] = "sony-assamd", | 9392 | [ALC262_SONY_ASSAMD] = "sony-assamd", |
9208 | [ALC262_ULTRA] = "ultra", | 9393 | [ALC262_ULTRA] = "ultra", |
9394 | [ALC262_LENOVO_3000] = "lenovo-3000", | ||
9209 | [ALC262_AUTO] = "auto", | 9395 | [ALC262_AUTO] = "auto", |
9210 | }; | 9396 | }; |
9211 | 9397 | ||
@@ -9241,6 +9427,8 @@ static struct snd_pci_quirk alc262_cfg_tbl[] = { | |||
9241 | SND_PCI_QUIRK(0x10cf, 0x1397, "Fujitsu", ALC262_FUJITSU), | 9427 | SND_PCI_QUIRK(0x10cf, 0x1397, "Fujitsu", ALC262_FUJITSU), |
9242 | SND_PCI_QUIRK(0x10cf, 0x142d, "Fujitsu Lifebook E8410", ALC262_FUJITSU), | 9428 | SND_PCI_QUIRK(0x10cf, 0x142d, "Fujitsu Lifebook E8410", ALC262_FUJITSU), |
9243 | SND_PCI_QUIRK(0x144d, 0xc032, "Samsung Q1 Ultra", ALC262_ULTRA), | 9429 | SND_PCI_QUIRK(0x144d, 0xc032, "Samsung Q1 Ultra", ALC262_ULTRA), |
9430 | SND_PCI_QUIRK(0x144d, 0xc039, "Samsung Q1U EL", ALC262_ULTRA), | ||
9431 | SND_PCI_QUIRK(0x17aa, 0x384e, "Lenovo 3000 y410", ALC262_LENOVO_3000), | ||
9244 | SND_PCI_QUIRK(0x17ff, 0x0560, "Benq ED8", ALC262_BENQ_ED8), | 9432 | SND_PCI_QUIRK(0x17ff, 0x0560, "Benq ED8", ALC262_BENQ_ED8), |
9245 | SND_PCI_QUIRK(0x17ff, 0x058d, "Benq T31-16", ALC262_BENQ_T31), | 9433 | SND_PCI_QUIRK(0x17ff, 0x058d, "Benq T31-16", ALC262_BENQ_T31), |
9246 | SND_PCI_QUIRK(0x17ff, 0x058f, "Benq Hippo", ALC262_HIPPO_1), | 9434 | SND_PCI_QUIRK(0x17ff, 0x058f, "Benq Hippo", ALC262_HIPPO_1), |
@@ -9390,18 +9578,32 @@ static struct alc_config_preset alc262_presets[] = { | |||
9390 | .init_hook = alc262_hippo_automute, | 9578 | .init_hook = alc262_hippo_automute, |
9391 | }, | 9579 | }, |
9392 | [ALC262_ULTRA] = { | 9580 | [ALC262_ULTRA] = { |
9393 | .mixers = { alc262_ultra_mixer }, | 9581 | .mixers = { alc262_ultra_mixer, alc262_ultra_capture_mixer }, |
9394 | .init_verbs = { alc262_init_verbs, alc262_ultra_verbs }, | 9582 | .init_verbs = { alc262_ultra_verbs }, |
9395 | .num_dacs = ARRAY_SIZE(alc262_dac_nids), | 9583 | .num_dacs = ARRAY_SIZE(alc262_dac_nids), |
9396 | .dac_nids = alc262_dac_nids, | 9584 | .dac_nids = alc262_dac_nids, |
9397 | .hp_nid = 0x03, | ||
9398 | .dig_out_nid = ALC262_DIGOUT_NID, | ||
9399 | .num_channel_mode = ARRAY_SIZE(alc262_modes), | 9585 | .num_channel_mode = ARRAY_SIZE(alc262_modes), |
9400 | .channel_mode = alc262_modes, | 9586 | .channel_mode = alc262_modes, |
9401 | .input_mux = &alc262_ultra_capture_source, | 9587 | .input_mux = &alc262_ultra_capture_source, |
9588 | .adc_nids = alc262_adc_nids, /* ADC0 */ | ||
9589 | .capsrc_nids = alc262_capsrc_nids, | ||
9590 | .num_adc_nids = 1, /* single ADC */ | ||
9402 | .unsol_event = alc262_ultra_unsol_event, | 9591 | .unsol_event = alc262_ultra_unsol_event, |
9403 | .init_hook = alc262_ultra_automute, | 9592 | .init_hook = alc262_ultra_automute, |
9404 | }, | 9593 | }, |
9594 | [ALC262_LENOVO_3000] = { | ||
9595 | .mixers = { alc262_lenovo_3000_mixer }, | ||
9596 | .init_verbs = { alc262_init_verbs, alc262_EAPD_verbs, | ||
9597 | alc262_lenovo_3000_unsol_verbs }, | ||
9598 | .num_dacs = ARRAY_SIZE(alc262_dac_nids), | ||
9599 | .dac_nids = alc262_dac_nids, | ||
9600 | .hp_nid = 0x03, | ||
9601 | .dig_out_nid = ALC262_DIGOUT_NID, | ||
9602 | .num_channel_mode = ARRAY_SIZE(alc262_modes), | ||
9603 | .channel_mode = alc262_modes, | ||
9604 | .input_mux = &alc262_fujitsu_capture_source, | ||
9605 | .unsol_event = alc262_lenovo_3000_unsol_event, | ||
9606 | }, | ||
9405 | }; | 9607 | }; |
9406 | 9608 | ||
9407 | static int patch_alc262(struct hda_codec *codec) | 9609 | static int patch_alc262(struct hda_codec *codec) |
@@ -9472,12 +9674,14 @@ static int patch_alc262(struct hda_codec *codec) | |||
9472 | if (wcap != AC_WID_AUD_IN) { | 9674 | if (wcap != AC_WID_AUD_IN) { |
9473 | spec->adc_nids = alc262_adc_nids_alt; | 9675 | spec->adc_nids = alc262_adc_nids_alt; |
9474 | spec->num_adc_nids = ARRAY_SIZE(alc262_adc_nids_alt); | 9676 | spec->num_adc_nids = ARRAY_SIZE(alc262_adc_nids_alt); |
9677 | spec->capsrc_nids = alc262_capsrc_nids_alt; | ||
9475 | spec->mixers[spec->num_mixers] = | 9678 | spec->mixers[spec->num_mixers] = |
9476 | alc262_capture_alt_mixer; | 9679 | alc262_capture_alt_mixer; |
9477 | spec->num_mixers++; | 9680 | spec->num_mixers++; |
9478 | } else { | 9681 | } else { |
9479 | spec->adc_nids = alc262_adc_nids; | 9682 | spec->adc_nids = alc262_adc_nids; |
9480 | spec->num_adc_nids = ARRAY_SIZE(alc262_adc_nids); | 9683 | spec->num_adc_nids = ARRAY_SIZE(alc262_adc_nids); |
9684 | spec->capsrc_nids = alc262_capsrc_nids; | ||
9481 | spec->mixers[spec->num_mixers] = alc262_capture_mixer; | 9685 | spec->mixers[spec->num_mixers] = alc262_capture_mixer; |
9482 | spec->num_mixers++; | 9686 | spec->num_mixers++; |
9483 | } | 9687 | } |
@@ -9517,6 +9721,8 @@ static hda_nid_t alc268_adc_nids_alt[1] = { | |||
9517 | 0x08 | 9721 | 0x08 |
9518 | }; | 9722 | }; |
9519 | 9723 | ||
9724 | static hda_nid_t alc268_capsrc_nids[2] = { 0x23, 0x24 }; | ||
9725 | |||
9520 | static struct snd_kcontrol_new alc268_base_mixer[] = { | 9726 | static struct snd_kcontrol_new alc268_base_mixer[] = { |
9521 | /* output mixer control */ | 9727 | /* output mixer control */ |
9522 | HDA_CODEC_VOLUME("Front Playback Volume", 0x2, 0x0, HDA_OUTPUT), | 9728 | HDA_CODEC_VOLUME("Front Playback Volume", 0x2, 0x0, HDA_OUTPUT), |
@@ -9529,6 +9735,22 @@ static struct snd_kcontrol_new alc268_base_mixer[] = { | |||
9529 | { } | 9735 | { } |
9530 | }; | 9736 | }; |
9531 | 9737 | ||
9738 | /* bind Beep switches of both NID 0x0f and 0x10 */ | ||
9739 | static struct hda_bind_ctls alc268_bind_beep_sw = { | ||
9740 | .ops = &snd_hda_bind_sw, | ||
9741 | .values = { | ||
9742 | HDA_COMPOSE_AMP_VAL(0x0f, 3, 1, HDA_INPUT), | ||
9743 | HDA_COMPOSE_AMP_VAL(0x10, 3, 1, HDA_INPUT), | ||
9744 | 0 | ||
9745 | }, | ||
9746 | }; | ||
9747 | |||
9748 | static struct snd_kcontrol_new alc268_beep_mixer[] = { | ||
9749 | HDA_CODEC_VOLUME("Beep Playback Volume", 0x1d, 0x0, HDA_INPUT), | ||
9750 | HDA_BIND_SW("Beep Playback Switch", &alc268_bind_beep_sw), | ||
9751 | { } | ||
9752 | }; | ||
9753 | |||
9532 | static struct hda_verb alc268_eapd_verbs[] = { | 9754 | static struct hda_verb alc268_eapd_verbs[] = { |
9533 | {0x14, AC_VERB_SET_EAPD_BTLENABLE, 2}, | 9755 | {0x14, AC_VERB_SET_EAPD_BTLENABLE, 2}, |
9534 | {0x15, AC_VERB_SET_EAPD_BTLENABLE, 2}, | 9756 | {0x15, AC_VERB_SET_EAPD_BTLENABLE, 2}, |
@@ -9613,8 +9835,12 @@ static struct snd_kcontrol_new alc268_acer_mixer[] = { | |||
9613 | }; | 9835 | }; |
9614 | 9836 | ||
9615 | static struct hda_verb alc268_acer_verbs[] = { | 9837 | static struct hda_verb alc268_acer_verbs[] = { |
9838 | {0x12, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, /* internal dmic? */ | ||
9839 | {0x13, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, | ||
9616 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, | 9840 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
9617 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, | 9841 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
9842 | {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80}, | ||
9843 | {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80}, | ||
9618 | 9844 | ||
9619 | {0x14, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN}, | 9845 | {0x14, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN}, |
9620 | { } | 9846 | { } |
@@ -9685,6 +9911,64 @@ static void alc268_dell_unsol_event(struct hda_codec *codec, | |||
9685 | 9911 | ||
9686 | #define alc268_dell_init_hook alc268_dell_automute | 9912 | #define alc268_dell_init_hook alc268_dell_automute |
9687 | 9913 | ||
9914 | static struct snd_kcontrol_new alc267_quanta_il1_mixer[] = { | ||
9915 | HDA_CODEC_VOLUME("Speaker Playback Volume", 0x2, 0x0, HDA_OUTPUT), | ||
9916 | HDA_CODEC_MUTE("Speaker Playback Switch", 0x14, 0x0, HDA_OUTPUT), | ||
9917 | HDA_CODEC_VOLUME("Headphone Playback Volume", 0x3, 0x0, HDA_OUTPUT), | ||
9918 | HDA_CODEC_MUTE("Headphone Playback Switch", 0x15, 0x0, HDA_OUTPUT), | ||
9919 | HDA_CODEC_VOLUME("Mic Capture Volume", 0x23, 0x0, HDA_OUTPUT), | ||
9920 | HDA_BIND_MUTE("Mic Capture Switch", 0x23, 2, HDA_OUTPUT), | ||
9921 | HDA_CODEC_VOLUME("Ext Mic Boost", 0x18, 0, HDA_INPUT), | ||
9922 | HDA_CODEC_VOLUME("Int Mic Boost", 0x19, 0, HDA_INPUT), | ||
9923 | { } | ||
9924 | }; | ||
9925 | |||
9926 | static struct hda_verb alc267_quanta_il1_verbs[] = { | ||
9927 | {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN}, | ||
9928 | {0x18, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_MIC_EVENT | AC_USRSP_EN}, | ||
9929 | { } | ||
9930 | }; | ||
9931 | |||
9932 | static void alc267_quanta_il1_hp_automute(struct hda_codec *codec) | ||
9933 | { | ||
9934 | unsigned int present; | ||
9935 | |||
9936 | present = snd_hda_codec_read(codec, 0x15, 0, AC_VERB_GET_PIN_SENSE, 0) | ||
9937 | & AC_PINSENSE_PRESENCE; | ||
9938 | snd_hda_codec_write(codec, 0x14, 0, AC_VERB_SET_PIN_WIDGET_CONTROL, | ||
9939 | present ? 0 : PIN_OUT); | ||
9940 | } | ||
9941 | |||
9942 | static void alc267_quanta_il1_mic_automute(struct hda_codec *codec) | ||
9943 | { | ||
9944 | unsigned int present; | ||
9945 | |||
9946 | present = snd_hda_codec_read(codec, 0x18, 0, | ||
9947 | AC_VERB_GET_PIN_SENSE, 0) & 0x80000000; | ||
9948 | snd_hda_codec_write(codec, 0x23, 0, | ||
9949 | AC_VERB_SET_CONNECT_SEL, | ||
9950 | present ? 0x00 : 0x01); | ||
9951 | } | ||
9952 | |||
9953 | static void alc267_quanta_il1_automute(struct hda_codec *codec) | ||
9954 | { | ||
9955 | alc267_quanta_il1_hp_automute(codec); | ||
9956 | alc267_quanta_il1_mic_automute(codec); | ||
9957 | } | ||
9958 | |||
9959 | static void alc267_quanta_il1_unsol_event(struct hda_codec *codec, | ||
9960 | unsigned int res) | ||
9961 | { | ||
9962 | switch (res >> 26) { | ||
9963 | case ALC880_HP_EVENT: | ||
9964 | alc267_quanta_il1_hp_automute(codec); | ||
9965 | break; | ||
9966 | case ALC880_MIC_EVENT: | ||
9967 | alc267_quanta_il1_mic_automute(codec); | ||
9968 | break; | ||
9969 | } | ||
9970 | } | ||
9971 | |||
9688 | /* | 9972 | /* |
9689 | * generic initialization of ADC, input mixers and output mixers | 9973 | * generic initialization of ADC, input mixers and output mixers |
9690 | */ | 9974 | */ |
@@ -9725,7 +10009,11 @@ static struct hda_verb alc268_base_init_verbs[] = { | |||
9725 | {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, | 10009 | {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
9726 | {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, | 10010 | {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
9727 | {0x1c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, | 10011 | {0x1c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
9728 | {0x1d, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))}, | 10012 | |
10013 | /* set PCBEEP vol = 0, mute connections */ | ||
10014 | {0x1d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, | ||
10015 | {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, | ||
10016 | {0x10, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, | ||
9729 | 10017 | ||
9730 | /* Unmute Selector 23h,24h and set the default input to mic-in */ | 10018 | /* Unmute Selector 23h,24h and set the default input to mic-in */ |
9731 | 10019 | ||
@@ -9764,29 +10052,17 @@ static struct hda_verb alc268_volume_init_verbs[] = { | |||
9764 | {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, | 10052 | {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
9765 | {0x1c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, | 10053 | {0x1c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
9766 | 10054 | ||
9767 | /* set PCBEEP vol = 0 */ | 10055 | /* set PCBEEP vol = 0, mute connections */ |
9768 | {0x1d, AC_VERB_SET_AMP_GAIN_MUTE, (0xb000 | (0x00 << 8))}, | 10056 | {0x1d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
10057 | {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, | ||
10058 | {0x10, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, | ||
9769 | 10059 | ||
9770 | { } | 10060 | { } |
9771 | }; | 10061 | }; |
9772 | 10062 | ||
9773 | #define alc268_mux_enum_info alc_mux_enum_info | 10063 | #define alc268_mux_enum_info alc_mux_enum_info |
9774 | #define alc268_mux_enum_get alc_mux_enum_get | 10064 | #define alc268_mux_enum_get alc_mux_enum_get |
9775 | 10065 | #define alc268_mux_enum_put alc_mux_enum_put | |
9776 | static int alc268_mux_enum_put(struct snd_kcontrol *kcontrol, | ||
9777 | struct snd_ctl_elem_value *ucontrol) | ||
9778 | { | ||
9779 | struct hda_codec *codec = snd_kcontrol_chip(kcontrol); | ||
9780 | struct alc_spec *spec = codec->spec; | ||
9781 | |||
9782 | unsigned int adc_idx = snd_ctl_get_ioffidx(kcontrol, &ucontrol->id); | ||
9783 | static hda_nid_t capture_mixers[3] = { 0x23, 0x24 }; | ||
9784 | hda_nid_t nid = capture_mixers[adc_idx]; | ||
9785 | |||
9786 | return snd_hda_input_mux_put(codec, spec->input_mux, ucontrol, | ||
9787 | nid, | ||
9788 | &spec->cur_mux[adc_idx]); | ||
9789 | } | ||
9790 | 10066 | ||
9791 | static struct snd_kcontrol_new alc268_capture_alt_mixer[] = { | 10067 | static struct snd_kcontrol_new alc268_capture_alt_mixer[] = { |
9792 | HDA_CODEC_VOLUME("Capture Volume", 0x23, 0x0, HDA_OUTPUT), | 10068 | HDA_CODEC_VOLUME("Capture Volume", 0x23, 0x0, HDA_OUTPUT), |
@@ -9836,13 +10112,17 @@ static struct hda_input_mux alc268_capture_source = { | |||
9836 | }, | 10112 | }, |
9837 | }; | 10113 | }; |
9838 | 10114 | ||
10115 | static struct hda_input_mux alc268_acer_capture_source = { | ||
10116 | .num_items = 3, | ||
10117 | .items = { | ||
10118 | { "Mic", 0x0 }, | ||
10119 | { "Internal Mic", 0x6 }, | ||
10120 | { "Line", 0x2 }, | ||
10121 | }, | ||
10122 | }; | ||
10123 | |||
9839 | #ifdef CONFIG_SND_DEBUG | 10124 | #ifdef CONFIG_SND_DEBUG |
9840 | static struct snd_kcontrol_new alc268_test_mixer[] = { | 10125 | static struct snd_kcontrol_new alc268_test_mixer[] = { |
9841 | HDA_CODEC_VOLUME("Front Playback Volume", 0x2, 0x0, HDA_OUTPUT), | ||
9842 | HDA_CODEC_MUTE("Front Playback Switch", 0x14, 0x0, HDA_OUTPUT), | ||
9843 | HDA_CODEC_VOLUME("Headphone Playback Volume", 0x3, 0x0, HDA_OUTPUT), | ||
9844 | HDA_CODEC_MUTE("Headphone Playback Switch", 0x15, 0x0, HDA_OUTPUT), | ||
9845 | |||
9846 | /* Volume widgets */ | 10126 | /* Volume widgets */ |
9847 | HDA_CODEC_VOLUME("LOUT1 Playback Volume", 0x02, 0x0, HDA_OUTPUT), | 10127 | HDA_CODEC_VOLUME("LOUT1 Playback Volume", 0x02, 0x0, HDA_OUTPUT), |
9848 | HDA_CODEC_VOLUME("LOUT2 Playback Volume", 0x03, 0x0, HDA_OUTPUT), | 10128 | HDA_CODEC_VOLUME("LOUT2 Playback Volume", 0x03, 0x0, HDA_OUTPUT), |
@@ -9981,6 +10261,10 @@ static int alc268_auto_create_analog_input_ctls(struct alc_spec *spec, | |||
9981 | case 0x1c: | 10261 | case 0x1c: |
9982 | idx1 = 3; /* CD */ | 10262 | idx1 = 3; /* CD */ |
9983 | break; | 10263 | break; |
10264 | case 0x12: | ||
10265 | case 0x13: | ||
10266 | idx1 = 6; /* digital mics */ | ||
10267 | break; | ||
9984 | default: | 10268 | default: |
9985 | continue; | 10269 | continue; |
9986 | } | 10270 | } |
@@ -10073,6 +10357,9 @@ static int alc268_parse_auto_config(struct hda_codec *codec) | |||
10073 | if (spec->kctl_alloc) | 10357 | if (spec->kctl_alloc) |
10074 | spec->mixers[spec->num_mixers++] = spec->kctl_alloc; | 10358 | spec->mixers[spec->num_mixers++] = spec->kctl_alloc; |
10075 | 10359 | ||
10360 | if (spec->autocfg.speaker_pins[0] != 0x1d) | ||
10361 | spec->mixers[spec->num_mixers++] = alc268_beep_mixer; | ||
10362 | |||
10076 | spec->init_verbs[spec->num_init_verbs++] = alc268_volume_init_verbs; | 10363 | spec->init_verbs[spec->num_init_verbs++] = alc268_volume_init_verbs; |
10077 | spec->num_mux_defs = 1; | 10364 | spec->num_mux_defs = 1; |
10078 | spec->input_mux = &spec->private_imux; | 10365 | spec->input_mux = &spec->private_imux; |
@@ -10091,20 +10378,25 @@ static int alc268_parse_auto_config(struct hda_codec *codec) | |||
10091 | /* init callback for auto-configuration model -- overriding the default init */ | 10378 | /* init callback for auto-configuration model -- overriding the default init */ |
10092 | static void alc268_auto_init(struct hda_codec *codec) | 10379 | static void alc268_auto_init(struct hda_codec *codec) |
10093 | { | 10380 | { |
10381 | struct alc_spec *spec = codec->spec; | ||
10094 | alc268_auto_init_multi_out(codec); | 10382 | alc268_auto_init_multi_out(codec); |
10095 | alc268_auto_init_hp_out(codec); | 10383 | alc268_auto_init_hp_out(codec); |
10096 | alc268_auto_init_mono_speaker_out(codec); | 10384 | alc268_auto_init_mono_speaker_out(codec); |
10097 | alc268_auto_init_analog_input(codec); | 10385 | alc268_auto_init_analog_input(codec); |
10386 | if (spec->unsol_event) | ||
10387 | alc_sku_automute(codec); | ||
10098 | } | 10388 | } |
10099 | 10389 | ||
10100 | /* | 10390 | /* |
10101 | * configuration and preset | 10391 | * configuration and preset |
10102 | */ | 10392 | */ |
10103 | static const char *alc268_models[ALC268_MODEL_LAST] = { | 10393 | static const char *alc268_models[ALC268_MODEL_LAST] = { |
10394 | [ALC267_QUANTA_IL1] = "quanta-il1", | ||
10104 | [ALC268_3ST] = "3stack", | 10395 | [ALC268_3ST] = "3stack", |
10105 | [ALC268_TOSHIBA] = "toshiba", | 10396 | [ALC268_TOSHIBA] = "toshiba", |
10106 | [ALC268_ACER] = "acer", | 10397 | [ALC268_ACER] = "acer", |
10107 | [ALC268_DELL] = "dell", | 10398 | [ALC268_DELL] = "dell", |
10399 | [ALC268_ZEPTO] = "zepto", | ||
10108 | #ifdef CONFIG_SND_DEBUG | 10400 | #ifdef CONFIG_SND_DEBUG |
10109 | [ALC268_TEST] = "test", | 10401 | [ALC268_TEST] = "test", |
10110 | #endif | 10402 | #endif |
@@ -10112,6 +10404,7 @@ static const char *alc268_models[ALC268_MODEL_LAST] = { | |||
10112 | }; | 10404 | }; |
10113 | 10405 | ||
10114 | static struct snd_pci_quirk alc268_cfg_tbl[] = { | 10406 | static struct snd_pci_quirk alc268_cfg_tbl[] = { |
10407 | SND_PCI_QUIRK(0x1025, 0x011e, "Acer Aspire 5720z", ALC268_ACER), | ||
10115 | SND_PCI_QUIRK(0x1025, 0x0126, "Acer", ALC268_ACER), | 10408 | SND_PCI_QUIRK(0x1025, 0x0126, "Acer", ALC268_ACER), |
10116 | SND_PCI_QUIRK(0x1025, 0x012e, "Acer Aspire 5310", ALC268_ACER), | 10409 | SND_PCI_QUIRK(0x1025, 0x012e, "Acer Aspire 5310", ALC268_ACER), |
10117 | SND_PCI_QUIRK(0x1025, 0x0130, "Acer Extensa 5210", ALC268_ACER), | 10410 | SND_PCI_QUIRK(0x1025, 0x0130, "Acer Extensa 5210", ALC268_ACER), |
@@ -10122,17 +10415,36 @@ static struct snd_pci_quirk alc268_cfg_tbl[] = { | |||
10122 | SND_PCI_QUIRK(0x1179, 0xff10, "TOSHIBA A205", ALC268_TOSHIBA), | 10415 | SND_PCI_QUIRK(0x1179, 0xff10, "TOSHIBA A205", ALC268_TOSHIBA), |
10123 | SND_PCI_QUIRK(0x1179, 0xff50, "TOSHIBA A305", ALC268_TOSHIBA), | 10416 | SND_PCI_QUIRK(0x1179, 0xff50, "TOSHIBA A305", ALC268_TOSHIBA), |
10124 | SND_PCI_QUIRK(0x152d, 0x0763, "Diverse (CPR2000)", ALC268_ACER), | 10417 | SND_PCI_QUIRK(0x152d, 0x0763, "Diverse (CPR2000)", ALC268_ACER), |
10418 | SND_PCI_QUIRK(0x152d, 0x0771, "Quanta IL1", ALC267_QUANTA_IL1), | ||
10419 | SND_PCI_QUIRK(0x1170, 0x0040, "ZEPTO", ALC268_ZEPTO), | ||
10125 | {} | 10420 | {} |
10126 | }; | 10421 | }; |
10127 | 10422 | ||
10128 | static struct alc_config_preset alc268_presets[] = { | 10423 | static struct alc_config_preset alc268_presets[] = { |
10424 | [ALC267_QUANTA_IL1] = { | ||
10425 | .mixers = { alc267_quanta_il1_mixer }, | ||
10426 | .init_verbs = { alc268_base_init_verbs, alc268_eapd_verbs, | ||
10427 | alc267_quanta_il1_verbs }, | ||
10428 | .num_dacs = ARRAY_SIZE(alc268_dac_nids), | ||
10429 | .dac_nids = alc268_dac_nids, | ||
10430 | .num_adc_nids = ARRAY_SIZE(alc268_adc_nids_alt), | ||
10431 | .adc_nids = alc268_adc_nids_alt, | ||
10432 | .hp_nid = 0x03, | ||
10433 | .num_channel_mode = ARRAY_SIZE(alc268_modes), | ||
10434 | .channel_mode = alc268_modes, | ||
10435 | .input_mux = &alc268_capture_source, | ||
10436 | .unsol_event = alc267_quanta_il1_unsol_event, | ||
10437 | .init_hook = alc267_quanta_il1_automute, | ||
10438 | }, | ||
10129 | [ALC268_3ST] = { | 10439 | [ALC268_3ST] = { |
10130 | .mixers = { alc268_base_mixer, alc268_capture_alt_mixer }, | 10440 | .mixers = { alc268_base_mixer, alc268_capture_alt_mixer, |
10441 | alc268_beep_mixer }, | ||
10131 | .init_verbs = { alc268_base_init_verbs }, | 10442 | .init_verbs = { alc268_base_init_verbs }, |
10132 | .num_dacs = ARRAY_SIZE(alc268_dac_nids), | 10443 | .num_dacs = ARRAY_SIZE(alc268_dac_nids), |
10133 | .dac_nids = alc268_dac_nids, | 10444 | .dac_nids = alc268_dac_nids, |
10134 | .num_adc_nids = ARRAY_SIZE(alc268_adc_nids_alt), | 10445 | .num_adc_nids = ARRAY_SIZE(alc268_adc_nids_alt), |
10135 | .adc_nids = alc268_adc_nids_alt, | 10446 | .adc_nids = alc268_adc_nids_alt, |
10447 | .capsrc_nids = alc268_capsrc_nids, | ||
10136 | .hp_nid = 0x03, | 10448 | .hp_nid = 0x03, |
10137 | .dig_out_nid = ALC268_DIGOUT_NID, | 10449 | .dig_out_nid = ALC268_DIGOUT_NID, |
10138 | .num_channel_mode = ARRAY_SIZE(alc268_modes), | 10450 | .num_channel_mode = ARRAY_SIZE(alc268_modes), |
@@ -10140,13 +10452,15 @@ static struct alc_config_preset alc268_presets[] = { | |||
10140 | .input_mux = &alc268_capture_source, | 10452 | .input_mux = &alc268_capture_source, |
10141 | }, | 10453 | }, |
10142 | [ALC268_TOSHIBA] = { | 10454 | [ALC268_TOSHIBA] = { |
10143 | .mixers = { alc268_base_mixer, alc268_capture_alt_mixer }, | 10455 | .mixers = { alc268_base_mixer, alc268_capture_alt_mixer, |
10456 | alc268_beep_mixer }, | ||
10144 | .init_verbs = { alc268_base_init_verbs, alc268_eapd_verbs, | 10457 | .init_verbs = { alc268_base_init_verbs, alc268_eapd_verbs, |
10145 | alc268_toshiba_verbs }, | 10458 | alc268_toshiba_verbs }, |
10146 | .num_dacs = ARRAY_SIZE(alc268_dac_nids), | 10459 | .num_dacs = ARRAY_SIZE(alc268_dac_nids), |
10147 | .dac_nids = alc268_dac_nids, | 10460 | .dac_nids = alc268_dac_nids, |
10148 | .num_adc_nids = ARRAY_SIZE(alc268_adc_nids_alt), | 10461 | .num_adc_nids = ARRAY_SIZE(alc268_adc_nids_alt), |
10149 | .adc_nids = alc268_adc_nids_alt, | 10462 | .adc_nids = alc268_adc_nids_alt, |
10463 | .capsrc_nids = alc268_capsrc_nids, | ||
10150 | .hp_nid = 0x03, | 10464 | .hp_nid = 0x03, |
10151 | .num_channel_mode = ARRAY_SIZE(alc268_modes), | 10465 | .num_channel_mode = ARRAY_SIZE(alc268_modes), |
10152 | .channel_mode = alc268_modes, | 10466 | .channel_mode = alc268_modes, |
@@ -10155,22 +10469,24 @@ static struct alc_config_preset alc268_presets[] = { | |||
10155 | .init_hook = alc268_toshiba_automute, | 10469 | .init_hook = alc268_toshiba_automute, |
10156 | }, | 10470 | }, |
10157 | [ALC268_ACER] = { | 10471 | [ALC268_ACER] = { |
10158 | .mixers = { alc268_acer_mixer, alc268_capture_alt_mixer }, | 10472 | .mixers = { alc268_acer_mixer, alc268_capture_alt_mixer, |
10473 | alc268_beep_mixer }, | ||
10159 | .init_verbs = { alc268_base_init_verbs, alc268_eapd_verbs, | 10474 | .init_verbs = { alc268_base_init_verbs, alc268_eapd_verbs, |
10160 | alc268_acer_verbs }, | 10475 | alc268_acer_verbs }, |
10161 | .num_dacs = ARRAY_SIZE(alc268_dac_nids), | 10476 | .num_dacs = ARRAY_SIZE(alc268_dac_nids), |
10162 | .dac_nids = alc268_dac_nids, | 10477 | .dac_nids = alc268_dac_nids, |
10163 | .num_adc_nids = ARRAY_SIZE(alc268_adc_nids_alt), | 10478 | .num_adc_nids = ARRAY_SIZE(alc268_adc_nids_alt), |
10164 | .adc_nids = alc268_adc_nids_alt, | 10479 | .adc_nids = alc268_adc_nids_alt, |
10480 | .capsrc_nids = alc268_capsrc_nids, | ||
10165 | .hp_nid = 0x02, | 10481 | .hp_nid = 0x02, |
10166 | .num_channel_mode = ARRAY_SIZE(alc268_modes), | 10482 | .num_channel_mode = ARRAY_SIZE(alc268_modes), |
10167 | .channel_mode = alc268_modes, | 10483 | .channel_mode = alc268_modes, |
10168 | .input_mux = &alc268_capture_source, | 10484 | .input_mux = &alc268_acer_capture_source, |
10169 | .unsol_event = alc268_acer_unsol_event, | 10485 | .unsol_event = alc268_acer_unsol_event, |
10170 | .init_hook = alc268_acer_init_hook, | 10486 | .init_hook = alc268_acer_init_hook, |
10171 | }, | 10487 | }, |
10172 | [ALC268_DELL] = { | 10488 | [ALC268_DELL] = { |
10173 | .mixers = { alc268_dell_mixer }, | 10489 | .mixers = { alc268_dell_mixer, alc268_beep_mixer }, |
10174 | .init_verbs = { alc268_base_init_verbs, alc268_eapd_verbs, | 10490 | .init_verbs = { alc268_base_init_verbs, alc268_eapd_verbs, |
10175 | alc268_dell_verbs }, | 10491 | alc268_dell_verbs }, |
10176 | .num_dacs = ARRAY_SIZE(alc268_dac_nids), | 10492 | .num_dacs = ARRAY_SIZE(alc268_dac_nids), |
@@ -10182,6 +10498,24 @@ static struct alc_config_preset alc268_presets[] = { | |||
10182 | .init_hook = alc268_dell_init_hook, | 10498 | .init_hook = alc268_dell_init_hook, |
10183 | .input_mux = &alc268_capture_source, | 10499 | .input_mux = &alc268_capture_source, |
10184 | }, | 10500 | }, |
10501 | [ALC268_ZEPTO] = { | ||
10502 | .mixers = { alc268_base_mixer, alc268_capture_alt_mixer, | ||
10503 | alc268_beep_mixer }, | ||
10504 | .init_verbs = { alc268_base_init_verbs, alc268_eapd_verbs, | ||
10505 | alc268_toshiba_verbs }, | ||
10506 | .num_dacs = ARRAY_SIZE(alc268_dac_nids), | ||
10507 | .dac_nids = alc268_dac_nids, | ||
10508 | .num_adc_nids = ARRAY_SIZE(alc268_adc_nids_alt), | ||
10509 | .adc_nids = alc268_adc_nids_alt, | ||
10510 | .capsrc_nids = alc268_capsrc_nids, | ||
10511 | .hp_nid = 0x03, | ||
10512 | .dig_out_nid = ALC268_DIGOUT_NID, | ||
10513 | .num_channel_mode = ARRAY_SIZE(alc268_modes), | ||
10514 | .channel_mode = alc268_modes, | ||
10515 | .input_mux = &alc268_capture_source, | ||
10516 | .unsol_event = alc268_toshiba_unsol_event, | ||
10517 | .init_hook = alc268_toshiba_automute | ||
10518 | }, | ||
10185 | #ifdef CONFIG_SND_DEBUG | 10519 | #ifdef CONFIG_SND_DEBUG |
10186 | [ALC268_TEST] = { | 10520 | [ALC268_TEST] = { |
10187 | .mixers = { alc268_test_mixer, alc268_capture_mixer }, | 10521 | .mixers = { alc268_test_mixer, alc268_capture_mixer }, |
@@ -10191,6 +10525,7 @@ static struct alc_config_preset alc268_presets[] = { | |||
10191 | .dac_nids = alc268_dac_nids, | 10525 | .dac_nids = alc268_dac_nids, |
10192 | .num_adc_nids = ARRAY_SIZE(alc268_adc_nids_alt), | 10526 | .num_adc_nids = ARRAY_SIZE(alc268_adc_nids_alt), |
10193 | .adc_nids = alc268_adc_nids_alt, | 10527 | .adc_nids = alc268_adc_nids_alt, |
10528 | .capsrc_nids = alc268_capsrc_nids, | ||
10194 | .hp_nid = 0x03, | 10529 | .hp_nid = 0x03, |
10195 | .dig_out_nid = ALC268_DIGOUT_NID, | 10530 | .dig_out_nid = ALC268_DIGOUT_NID, |
10196 | .num_channel_mode = ARRAY_SIZE(alc268_modes), | 10531 | .num_channel_mode = ARRAY_SIZE(alc268_modes), |
@@ -10247,13 +10582,22 @@ static int patch_alc268(struct hda_codec *codec) | |||
10247 | spec->stream_name_digital = "ALC268 Digital"; | 10582 | spec->stream_name_digital = "ALC268 Digital"; |
10248 | spec->stream_digital_playback = &alc268_pcm_digital_playback; | 10583 | spec->stream_digital_playback = &alc268_pcm_digital_playback; |
10249 | 10584 | ||
10585 | if (!query_amp_caps(codec, 0x1d, HDA_INPUT)) | ||
10586 | /* override the amp caps for beep generator */ | ||
10587 | snd_hda_override_amp_caps(codec, 0x1d, HDA_INPUT, | ||
10588 | (0x0c << AC_AMPCAP_OFFSET_SHIFT) | | ||
10589 | (0x0c << AC_AMPCAP_NUM_STEPS_SHIFT) | | ||
10590 | (0x07 << AC_AMPCAP_STEP_SIZE_SHIFT) | | ||
10591 | (0 << AC_AMPCAP_MUTE_SHIFT)); | ||
10592 | |||
10250 | if (!spec->adc_nids && spec->input_mux) { | 10593 | if (!spec->adc_nids && spec->input_mux) { |
10251 | /* check whether NID 0x07 is valid */ | 10594 | /* check whether NID 0x07 is valid */ |
10252 | unsigned int wcap = get_wcaps(codec, 0x07); | 10595 | unsigned int wcap = get_wcaps(codec, 0x07); |
10596 | int i; | ||
10253 | 10597 | ||
10254 | /* get type */ | 10598 | /* get type */ |
10255 | wcap = (wcap & AC_WCAP_TYPE) >> AC_WCAP_TYPE_SHIFT; | 10599 | wcap = (wcap & AC_WCAP_TYPE) >> AC_WCAP_TYPE_SHIFT; |
10256 | if (wcap != AC_WID_AUD_IN) { | 10600 | if (wcap != AC_WID_AUD_IN || spec->input_mux->num_items == 1) { |
10257 | spec->adc_nids = alc268_adc_nids_alt; | 10601 | spec->adc_nids = alc268_adc_nids_alt; |
10258 | spec->num_adc_nids = ARRAY_SIZE(alc268_adc_nids_alt); | 10602 | spec->num_adc_nids = ARRAY_SIZE(alc268_adc_nids_alt); |
10259 | spec->mixers[spec->num_mixers] = | 10603 | spec->mixers[spec->num_mixers] = |
@@ -10266,6 +10610,12 @@ static int patch_alc268(struct hda_codec *codec) | |||
10266 | alc268_capture_mixer; | 10610 | alc268_capture_mixer; |
10267 | spec->num_mixers++; | 10611 | spec->num_mixers++; |
10268 | } | 10612 | } |
10613 | spec->capsrc_nids = alc268_capsrc_nids; | ||
10614 | /* set default input source */ | ||
10615 | for (i = 0; i < spec->num_adc_nids; i++) | ||
10616 | snd_hda_codec_write_cache(codec, alc268_capsrc_nids[i], | ||
10617 | 0, AC_VERB_SET_CONNECT_SEL, | ||
10618 | spec->input_mux->items[0].index); | ||
10269 | } | 10619 | } |
10270 | 10620 | ||
10271 | spec->vmaster_nid = 0x02; | 10621 | spec->vmaster_nid = 0x02; |
@@ -10539,9 +10889,12 @@ static int alc269_parse_auto_config(struct hda_codec *codec) | |||
10539 | /* init callback for auto-configuration model -- overriding the default init */ | 10889 | /* init callback for auto-configuration model -- overriding the default init */ |
10540 | static void alc269_auto_init(struct hda_codec *codec) | 10890 | static void alc269_auto_init(struct hda_codec *codec) |
10541 | { | 10891 | { |
10892 | struct alc_spec *spec = codec->spec; | ||
10542 | alc269_auto_init_multi_out(codec); | 10893 | alc269_auto_init_multi_out(codec); |
10543 | alc269_auto_init_hp_out(codec); | 10894 | alc269_auto_init_hp_out(codec); |
10544 | alc269_auto_init_analog_input(codec); | 10895 | alc269_auto_init_analog_input(codec); |
10896 | if (spec->unsol_event) | ||
10897 | alc_sku_automute(codec); | ||
10545 | } | 10898 | } |
10546 | 10899 | ||
10547 | /* | 10900 | /* |
@@ -11463,13 +11816,7 @@ static void alc861_auto_set_output_and_unmute(struct hda_codec *codec, | |||
11463 | hda_nid_t nid, | 11816 | hda_nid_t nid, |
11464 | int pin_type, int dac_idx) | 11817 | int pin_type, int dac_idx) |
11465 | { | 11818 | { |
11466 | /* set as output */ | 11819 | alc_set_pin_output(codec, nid, pin_type); |
11467 | |||
11468 | snd_hda_codec_write(codec, nid, 0, AC_VERB_SET_PIN_WIDGET_CONTROL, | ||
11469 | pin_type); | ||
11470 | snd_hda_codec_write(codec, dac_idx, 0, AC_VERB_SET_AMP_GAIN_MUTE, | ||
11471 | AMP_OUT_UNMUTE); | ||
11472 | |||
11473 | } | 11820 | } |
11474 | 11821 | ||
11475 | static void alc861_auto_init_multi_out(struct hda_codec *codec) | 11822 | static void alc861_auto_init_multi_out(struct hda_codec *codec) |
@@ -11496,6 +11843,9 @@ static void alc861_auto_init_hp_out(struct hda_codec *codec) | |||
11496 | if (pin) /* connect to front */ | 11843 | if (pin) /* connect to front */ |
11497 | alc861_auto_set_output_and_unmute(codec, pin, PIN_HP, | 11844 | alc861_auto_set_output_and_unmute(codec, pin, PIN_HP, |
11498 | spec->multiout.dac_nids[0]); | 11845 | spec->multiout.dac_nids[0]); |
11846 | pin = spec->autocfg.speaker_pins[0]; | ||
11847 | if (pin) | ||
11848 | alc861_auto_set_output_and_unmute(codec, pin, PIN_OUT, 0); | ||
11499 | } | 11849 | } |
11500 | 11850 | ||
11501 | static void alc861_auto_init_analog_input(struct hda_codec *codec) | 11851 | static void alc861_auto_init_analog_input(struct hda_codec *codec) |
@@ -11568,9 +11918,12 @@ static int alc861_parse_auto_config(struct hda_codec *codec) | |||
11568 | /* additional initialization for auto-configuration model */ | 11918 | /* additional initialization for auto-configuration model */ |
11569 | static void alc861_auto_init(struct hda_codec *codec) | 11919 | static void alc861_auto_init(struct hda_codec *codec) |
11570 | { | 11920 | { |
11921 | struct alc_spec *spec = codec->spec; | ||
11571 | alc861_auto_init_multi_out(codec); | 11922 | alc861_auto_init_multi_out(codec); |
11572 | alc861_auto_init_hp_out(codec); | 11923 | alc861_auto_init_hp_out(codec); |
11573 | alc861_auto_init_analog_input(codec); | 11924 | alc861_auto_init_analog_input(codec); |
11925 | if (spec->unsol_event) | ||
11926 | alc_sku_automute(codec); | ||
11574 | } | 11927 | } |
11575 | 11928 | ||
11576 | #ifdef CONFIG_SND_HDA_POWER_SAVE | 11929 | #ifdef CONFIG_SND_HDA_POWER_SAVE |
@@ -11822,6 +12175,8 @@ static hda_nid_t alc861vd_adc_nids[1] = { | |||
11822 | 0x09, | 12175 | 0x09, |
11823 | }; | 12176 | }; |
11824 | 12177 | ||
12178 | static hda_nid_t alc861vd_capsrc_nids[1] = { 0x22 }; | ||
12179 | |||
11825 | /* input MUX */ | 12180 | /* input MUX */ |
11826 | /* FIXME: should be a matrix-type input source selection */ | 12181 | /* FIXME: should be a matrix-type input source selection */ |
11827 | static struct hda_input_mux alc861vd_capture_source = { | 12182 | static struct hda_input_mux alc861vd_capture_source = { |
@@ -11835,11 +12190,10 @@ static struct hda_input_mux alc861vd_capture_source = { | |||
11835 | }; | 12190 | }; |
11836 | 12191 | ||
11837 | static struct hda_input_mux alc861vd_dallas_capture_source = { | 12192 | static struct hda_input_mux alc861vd_dallas_capture_source = { |
11838 | .num_items = 3, | 12193 | .num_items = 2, |
11839 | .items = { | 12194 | .items = { |
11840 | { "Front Mic", 0x0 }, | 12195 | { "Ext Mic", 0x0 }, |
11841 | { "ATAPI Mic", 0x1 }, | 12196 | { "Int Mic", 0x1 }, |
11842 | { "Line In", 0x5 }, | ||
11843 | }, | 12197 | }, |
11844 | }; | 12198 | }; |
11845 | 12199 | ||
@@ -11853,33 +12207,8 @@ static struct hda_input_mux alc861vd_hp_capture_source = { | |||
11853 | 12207 | ||
11854 | #define alc861vd_mux_enum_info alc_mux_enum_info | 12208 | #define alc861vd_mux_enum_info alc_mux_enum_info |
11855 | #define alc861vd_mux_enum_get alc_mux_enum_get | 12209 | #define alc861vd_mux_enum_get alc_mux_enum_get |
11856 | 12210 | /* ALC861VD has the ALC882-type input selection (but has only one ADC) */ | |
11857 | static int alc861vd_mux_enum_put(struct snd_kcontrol *kcontrol, | 12211 | #define alc861vd_mux_enum_put alc882_mux_enum_put |
11858 | struct snd_ctl_elem_value *ucontrol) | ||
11859 | { | ||
11860 | struct hda_codec *codec = snd_kcontrol_chip(kcontrol); | ||
11861 | struct alc_spec *spec = codec->spec; | ||
11862 | const struct hda_input_mux *imux = spec->input_mux; | ||
11863 | unsigned int adc_idx = snd_ctl_get_ioffidx(kcontrol, &ucontrol->id); | ||
11864 | static hda_nid_t capture_mixers[1] = { 0x22 }; | ||
11865 | hda_nid_t nid = capture_mixers[adc_idx]; | ||
11866 | unsigned int *cur_val = &spec->cur_mux[adc_idx]; | ||
11867 | unsigned int i, idx; | ||
11868 | |||
11869 | idx = ucontrol->value.enumerated.item[0]; | ||
11870 | if (idx >= imux->num_items) | ||
11871 | idx = imux->num_items - 1; | ||
11872 | if (*cur_val == idx) | ||
11873 | return 0; | ||
11874 | for (i = 0; i < imux->num_items; i++) { | ||
11875 | unsigned int v = (i == idx) ? 0 : HDA_AMP_MUTE; | ||
11876 | snd_hda_codec_amp_stereo(codec, nid, HDA_INPUT, | ||
11877 | imux->items[i].index, | ||
11878 | HDA_AMP_MUTE, v); | ||
11879 | } | ||
11880 | *cur_val = idx; | ||
11881 | return 1; | ||
11882 | } | ||
11883 | 12212 | ||
11884 | /* | 12213 | /* |
11885 | * 2ch mode | 12214 | * 2ch mode |
@@ -12034,20 +12363,22 @@ static struct snd_kcontrol_new alc861vd_lenovo_mixer[] = { | |||
12034 | { } /* end */ | 12363 | { } /* end */ |
12035 | }; | 12364 | }; |
12036 | 12365 | ||
12037 | /* Pin assignment: Front=0x14, HP = 0x15, | 12366 | /* Pin assignment: Speaker=0x14, HP = 0x15, |
12038 | * Front Mic=0x18, ATAPI Mic = 0x19, Line In = 0x1d | 12367 | * Ext Mic=0x18, Int Mic = 0x19, CD = 0x1c, PC Beep = 0x1d |
12039 | */ | 12368 | */ |
12040 | static struct snd_kcontrol_new alc861vd_dallas_mixer[] = { | 12369 | static struct snd_kcontrol_new alc861vd_dallas_mixer[] = { |
12041 | HDA_CODEC_VOLUME("Front Playback Volume", 0x02, 0x0, HDA_OUTPUT), | 12370 | HDA_CODEC_VOLUME("Speaker Playback Volume", 0x02, 0x0, HDA_OUTPUT), |
12042 | HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT), | 12371 | HDA_BIND_MUTE("Speaker Playback Switch", 0x0c, 2, HDA_INPUT), |
12043 | HDA_CODEC_VOLUME("Headphone Playback Volume", 0x03, 0x0, HDA_OUTPUT), | 12372 | HDA_CODEC_VOLUME("Headphone Playback Volume", 0x03, 0x0, HDA_OUTPUT), |
12044 | HDA_BIND_MUTE("Headphone Playback Switch", 0x0d, 2, HDA_INPUT), | 12373 | HDA_BIND_MUTE("Headphone Playback Switch", 0x0d, 2, HDA_INPUT), |
12045 | HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), | 12374 | HDA_CODEC_VOLUME("Ext Mic Boost", 0x18, 0, HDA_INPUT), |
12046 | HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), | 12375 | HDA_CODEC_VOLUME("Ext Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), |
12047 | HDA_CODEC_VOLUME("ATAPI Mic Playback Volume", 0x0b, 0x1, HDA_INPUT), | 12376 | HDA_CODEC_MUTE("Ext Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), |
12048 | HDA_CODEC_MUTE("ATAPI Mic Playback Switch", 0x0b, 0x1, HDA_INPUT), | 12377 | HDA_CODEC_VOLUME("Int Mic Boost", 0x19, 0, HDA_INPUT), |
12049 | HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x05, HDA_INPUT), | 12378 | HDA_CODEC_VOLUME("Int Mic Playback Volume", 0x0b, 0x1, HDA_INPUT), |
12050 | HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x05, HDA_INPUT), | 12379 | HDA_CODEC_MUTE("Int Mic Playback Switch", 0x0b, 0x1, HDA_INPUT), |
12380 | HDA_CODEC_VOLUME("PC Beep Volume", 0x0b, 0x05, HDA_INPUT), | ||
12381 | HDA_CODEC_MUTE("PC Beep Switch", 0x0b, 0x05, HDA_INPUT), | ||
12051 | { } /* end */ | 12382 | { } /* end */ |
12052 | }; | 12383 | }; |
12053 | 12384 | ||
@@ -12348,6 +12679,7 @@ static struct snd_pci_quirk alc861vd_cfg_tbl[] = { | |||
12348 | /*SND_PCI_QUIRK(0x1179, 0xff00, "DALLAS", ALC861VD_DALLAS),*/ /*lenovo*/ | 12679 | /*SND_PCI_QUIRK(0x1179, 0xff00, "DALLAS", ALC861VD_DALLAS),*/ /*lenovo*/ |
12349 | SND_PCI_QUIRK(0x1179, 0xff01, "DALLAS", ALC861VD_DALLAS), | 12680 | SND_PCI_QUIRK(0x1179, 0xff01, "DALLAS", ALC861VD_DALLAS), |
12350 | SND_PCI_QUIRK(0x1179, 0xff03, "Toshiba P205", ALC861VD_LENOVO), | 12681 | SND_PCI_QUIRK(0x1179, 0xff03, "Toshiba P205", ALC861VD_LENOVO), |
12682 | SND_PCI_QUIRK(0x1179, 0xff31, "Toshiba L30-149", ALC861VD_DALLAS), | ||
12351 | SND_PCI_QUIRK(0x1565, 0x820d, "Biostar NF61S SE", ALC861VD_6ST_DIG), | 12683 | SND_PCI_QUIRK(0x1565, 0x820d, "Biostar NF61S SE", ALC861VD_6ST_DIG), |
12352 | SND_PCI_QUIRK(0x17aa, 0x2066, "Lenovo", ALC861VD_LENOVO), | 12684 | SND_PCI_QUIRK(0x17aa, 0x2066, "Lenovo", ALC861VD_LENOVO), |
12353 | SND_PCI_QUIRK(0x17aa, 0x3802, "Lenovo 3000 C200", ALC861VD_LENOVO), | 12685 | SND_PCI_QUIRK(0x17aa, 0x3802, "Lenovo 3000 C200", ALC861VD_LENOVO), |
@@ -12362,8 +12694,6 @@ static struct alc_config_preset alc861vd_presets[] = { | |||
12362 | alc861vd_3stack_init_verbs }, | 12694 | alc861vd_3stack_init_verbs }, |
12363 | .num_dacs = ARRAY_SIZE(alc660vd_dac_nids), | 12695 | .num_dacs = ARRAY_SIZE(alc660vd_dac_nids), |
12364 | .dac_nids = alc660vd_dac_nids, | 12696 | .dac_nids = alc660vd_dac_nids, |
12365 | .num_adc_nids = ARRAY_SIZE(alc861vd_adc_nids), | ||
12366 | .adc_nids = alc861vd_adc_nids, | ||
12367 | .num_channel_mode = ARRAY_SIZE(alc861vd_3stack_2ch_modes), | 12697 | .num_channel_mode = ARRAY_SIZE(alc861vd_3stack_2ch_modes), |
12368 | .channel_mode = alc861vd_3stack_2ch_modes, | 12698 | .channel_mode = alc861vd_3stack_2ch_modes, |
12369 | .input_mux = &alc861vd_capture_source, | 12699 | .input_mux = &alc861vd_capture_source, |
@@ -12375,8 +12705,6 @@ static struct alc_config_preset alc861vd_presets[] = { | |||
12375 | .num_dacs = ARRAY_SIZE(alc660vd_dac_nids), | 12705 | .num_dacs = ARRAY_SIZE(alc660vd_dac_nids), |
12376 | .dac_nids = alc660vd_dac_nids, | 12706 | .dac_nids = alc660vd_dac_nids, |
12377 | .dig_out_nid = ALC861VD_DIGOUT_NID, | 12707 | .dig_out_nid = ALC861VD_DIGOUT_NID, |
12378 | .num_adc_nids = ARRAY_SIZE(alc861vd_adc_nids), | ||
12379 | .adc_nids = alc861vd_adc_nids, | ||
12380 | .num_channel_mode = ARRAY_SIZE(alc861vd_3stack_2ch_modes), | 12708 | .num_channel_mode = ARRAY_SIZE(alc861vd_3stack_2ch_modes), |
12381 | .channel_mode = alc861vd_3stack_2ch_modes, | 12709 | .channel_mode = alc861vd_3stack_2ch_modes, |
12382 | .input_mux = &alc861vd_capture_source, | 12710 | .input_mux = &alc861vd_capture_source, |
@@ -12421,8 +12749,6 @@ static struct alc_config_preset alc861vd_presets[] = { | |||
12421 | alc861vd_lenovo_unsol_verbs }, | 12749 | alc861vd_lenovo_unsol_verbs }, |
12422 | .num_dacs = ARRAY_SIZE(alc660vd_dac_nids), | 12750 | .num_dacs = ARRAY_SIZE(alc660vd_dac_nids), |
12423 | .dac_nids = alc660vd_dac_nids, | 12751 | .dac_nids = alc660vd_dac_nids, |
12424 | .num_adc_nids = ARRAY_SIZE(alc861vd_adc_nids), | ||
12425 | .adc_nids = alc861vd_adc_nids, | ||
12426 | .num_channel_mode = ARRAY_SIZE(alc861vd_3stack_2ch_modes), | 12752 | .num_channel_mode = ARRAY_SIZE(alc861vd_3stack_2ch_modes), |
12427 | .channel_mode = alc861vd_3stack_2ch_modes, | 12753 | .channel_mode = alc861vd_3stack_2ch_modes, |
12428 | .input_mux = &alc861vd_capture_source, | 12754 | .input_mux = &alc861vd_capture_source, |
@@ -12434,8 +12760,6 @@ static struct alc_config_preset alc861vd_presets[] = { | |||
12434 | .init_verbs = { alc861vd_dallas_verbs }, | 12760 | .init_verbs = { alc861vd_dallas_verbs }, |
12435 | .num_dacs = ARRAY_SIZE(alc861vd_dac_nids), | 12761 | .num_dacs = ARRAY_SIZE(alc861vd_dac_nids), |
12436 | .dac_nids = alc861vd_dac_nids, | 12762 | .dac_nids = alc861vd_dac_nids, |
12437 | .num_adc_nids = ARRAY_SIZE(alc861vd_adc_nids), | ||
12438 | .adc_nids = alc861vd_adc_nids, | ||
12439 | .num_channel_mode = ARRAY_SIZE(alc861vd_3stack_2ch_modes), | 12763 | .num_channel_mode = ARRAY_SIZE(alc861vd_3stack_2ch_modes), |
12440 | .channel_mode = alc861vd_3stack_2ch_modes, | 12764 | .channel_mode = alc861vd_3stack_2ch_modes, |
12441 | .input_mux = &alc861vd_dallas_capture_source, | 12765 | .input_mux = &alc861vd_dallas_capture_source, |
@@ -12447,9 +12771,7 @@ static struct alc_config_preset alc861vd_presets[] = { | |||
12447 | .init_verbs = { alc861vd_dallas_verbs, alc861vd_eapd_verbs }, | 12771 | .init_verbs = { alc861vd_dallas_verbs, alc861vd_eapd_verbs }, |
12448 | .num_dacs = ARRAY_SIZE(alc861vd_dac_nids), | 12772 | .num_dacs = ARRAY_SIZE(alc861vd_dac_nids), |
12449 | .dac_nids = alc861vd_dac_nids, | 12773 | .dac_nids = alc861vd_dac_nids, |
12450 | .num_adc_nids = ARRAY_SIZE(alc861vd_adc_nids), | ||
12451 | .dig_out_nid = ALC861VD_DIGOUT_NID, | 12774 | .dig_out_nid = ALC861VD_DIGOUT_NID, |
12452 | .adc_nids = alc861vd_adc_nids, | ||
12453 | .num_channel_mode = ARRAY_SIZE(alc861vd_3stack_2ch_modes), | 12775 | .num_channel_mode = ARRAY_SIZE(alc861vd_3stack_2ch_modes), |
12454 | .channel_mode = alc861vd_3stack_2ch_modes, | 12776 | .channel_mode = alc861vd_3stack_2ch_modes, |
12455 | .input_mux = &alc861vd_hp_capture_source, | 12777 | .input_mux = &alc861vd_hp_capture_source, |
@@ -12464,11 +12786,7 @@ static struct alc_config_preset alc861vd_presets[] = { | |||
12464 | static void alc861vd_auto_set_output_and_unmute(struct hda_codec *codec, | 12786 | static void alc861vd_auto_set_output_and_unmute(struct hda_codec *codec, |
12465 | hda_nid_t nid, int pin_type, int dac_idx) | 12787 | hda_nid_t nid, int pin_type, int dac_idx) |
12466 | { | 12788 | { |
12467 | /* set as output */ | 12789 | alc_set_pin_output(codec, nid, pin_type); |
12468 | snd_hda_codec_write(codec, nid, 0, | ||
12469 | AC_VERB_SET_PIN_WIDGET_CONTROL, pin_type); | ||
12470 | snd_hda_codec_write(codec, nid, 0, | ||
12471 | AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE); | ||
12472 | } | 12790 | } |
12473 | 12791 | ||
12474 | static void alc861vd_auto_init_multi_out(struct hda_codec *codec) | 12792 | static void alc861vd_auto_init_multi_out(struct hda_codec *codec) |
@@ -12495,6 +12813,9 @@ static void alc861vd_auto_init_hp_out(struct hda_codec *codec) | |||
12495 | pin = spec->autocfg.hp_pins[0]; | 12813 | pin = spec->autocfg.hp_pins[0]; |
12496 | if (pin) /* connect to front and use dac 0 */ | 12814 | if (pin) /* connect to front and use dac 0 */ |
12497 | alc861vd_auto_set_output_and_unmute(codec, pin, PIN_HP, 0); | 12815 | alc861vd_auto_set_output_and_unmute(codec, pin, PIN_HP, 0); |
12816 | pin = spec->autocfg.speaker_pins[0]; | ||
12817 | if (pin) | ||
12818 | alc861vd_auto_set_output_and_unmute(codec, pin, PIN_OUT, 0); | ||
12498 | } | 12819 | } |
12499 | 12820 | ||
12500 | #define alc861vd_is_input_pin(nid) alc880_is_input_pin(nid) | 12821 | #define alc861vd_is_input_pin(nid) alc880_is_input_pin(nid) |
@@ -12698,9 +13019,12 @@ static int alc861vd_parse_auto_config(struct hda_codec *codec) | |||
12698 | /* additional initialization for auto-configuration model */ | 13019 | /* additional initialization for auto-configuration model */ |
12699 | static void alc861vd_auto_init(struct hda_codec *codec) | 13020 | static void alc861vd_auto_init(struct hda_codec *codec) |
12700 | { | 13021 | { |
13022 | struct alc_spec *spec = codec->spec; | ||
12701 | alc861vd_auto_init_multi_out(codec); | 13023 | alc861vd_auto_init_multi_out(codec); |
12702 | alc861vd_auto_init_hp_out(codec); | 13024 | alc861vd_auto_init_hp_out(codec); |
12703 | alc861vd_auto_init_analog_input(codec); | 13025 | alc861vd_auto_init_analog_input(codec); |
13026 | if (spec->unsol_event) | ||
13027 | alc_sku_automute(codec); | ||
12704 | } | 13028 | } |
12705 | 13029 | ||
12706 | static int patch_alc861vd(struct hda_codec *codec) | 13030 | static int patch_alc861vd(struct hda_codec *codec) |
@@ -12751,6 +13075,7 @@ static int patch_alc861vd(struct hda_codec *codec) | |||
12751 | 13075 | ||
12752 | spec->adc_nids = alc861vd_adc_nids; | 13076 | spec->adc_nids = alc861vd_adc_nids; |
12753 | spec->num_adc_nids = ARRAY_SIZE(alc861vd_adc_nids); | 13077 | spec->num_adc_nids = ARRAY_SIZE(alc861vd_adc_nids); |
13078 | spec->capsrc_nids = alc861vd_capsrc_nids; | ||
12754 | 13079 | ||
12755 | spec->mixers[spec->num_mixers] = alc861vd_capture_mixer; | 13080 | spec->mixers[spec->num_mixers] = alc861vd_capture_mixer; |
12756 | spec->num_mixers++; | 13081 | spec->num_mixers++; |
@@ -12792,9 +13117,11 @@ static hda_nid_t alc662_adc_nids[1] = { | |||
12792 | /* ADC1-2 */ | 13117 | /* ADC1-2 */ |
12793 | 0x09, | 13118 | 0x09, |
12794 | }; | 13119 | }; |
13120 | |||
13121 | static hda_nid_t alc662_capsrc_nids[1] = { 0x22 }; | ||
13122 | |||
12795 | /* input MUX */ | 13123 | /* input MUX */ |
12796 | /* FIXME: should be a matrix-type input source selection */ | 13124 | /* FIXME: should be a matrix-type input source selection */ |
12797 | |||
12798 | static struct hda_input_mux alc662_capture_source = { | 13125 | static struct hda_input_mux alc662_capture_source = { |
12799 | .num_items = 4, | 13126 | .num_items = 4, |
12800 | .items = { | 13127 | .items = { |
@@ -12823,33 +13150,8 @@ static struct hda_input_mux alc662_eeepc_capture_source = { | |||
12823 | 13150 | ||
12824 | #define alc662_mux_enum_info alc_mux_enum_info | 13151 | #define alc662_mux_enum_info alc_mux_enum_info |
12825 | #define alc662_mux_enum_get alc_mux_enum_get | 13152 | #define alc662_mux_enum_get alc_mux_enum_get |
13153 | #define alc662_mux_enum_put alc882_mux_enum_put | ||
12826 | 13154 | ||
12827 | static int alc662_mux_enum_put(struct snd_kcontrol *kcontrol, | ||
12828 | struct snd_ctl_elem_value *ucontrol) | ||
12829 | { | ||
12830 | struct hda_codec *codec = snd_kcontrol_chip(kcontrol); | ||
12831 | struct alc_spec *spec = codec->spec; | ||
12832 | const struct hda_input_mux *imux = spec->input_mux; | ||
12833 | unsigned int adc_idx = snd_ctl_get_ioffidx(kcontrol, &ucontrol->id); | ||
12834 | static hda_nid_t capture_mixers[2] = { 0x23, 0x22 }; | ||
12835 | hda_nid_t nid = capture_mixers[adc_idx]; | ||
12836 | unsigned int *cur_val = &spec->cur_mux[adc_idx]; | ||
12837 | unsigned int i, idx; | ||
12838 | |||
12839 | idx = ucontrol->value.enumerated.item[0]; | ||
12840 | if (idx >= imux->num_items) | ||
12841 | idx = imux->num_items - 1; | ||
12842 | if (*cur_val == idx) | ||
12843 | return 0; | ||
12844 | for (i = 0; i < imux->num_items; i++) { | ||
12845 | unsigned int v = (i == idx) ? 0 : HDA_AMP_MUTE; | ||
12846 | snd_hda_codec_amp_stereo(codec, nid, HDA_INPUT, | ||
12847 | imux->items[i].index, | ||
12848 | HDA_AMP_MUTE, v); | ||
12849 | } | ||
12850 | *cur_val = idx; | ||
12851 | return 1; | ||
12852 | } | ||
12853 | /* | 13155 | /* |
12854 | * 2ch mode | 13156 | * 2ch mode |
12855 | */ | 13157 | */ |
@@ -12918,13 +13220,13 @@ static struct hda_channel_mode alc662_5stack_modes[2] = { | |||
12918 | static struct snd_kcontrol_new alc662_base_mixer[] = { | 13220 | static struct snd_kcontrol_new alc662_base_mixer[] = { |
12919 | /* output mixer control */ | 13221 | /* output mixer control */ |
12920 | HDA_CODEC_VOLUME("Front Playback Volume", 0x2, 0x0, HDA_OUTPUT), | 13222 | HDA_CODEC_VOLUME("Front Playback Volume", 0x2, 0x0, HDA_OUTPUT), |
12921 | HDA_CODEC_MUTE("Front Playback Switch", 0x02, 0x0, HDA_OUTPUT), | 13223 | HDA_CODEC_MUTE("Front Playback Switch", 0x0c, 0x0, HDA_INPUT), |
12922 | HDA_CODEC_VOLUME("Surround Playback Volume", 0x3, 0x0, HDA_OUTPUT), | 13224 | HDA_CODEC_VOLUME("Surround Playback Volume", 0x3, 0x0, HDA_OUTPUT), |
12923 | HDA_CODEC_MUTE("Surround Playback Switch", 0x03, 0x0, HDA_OUTPUT), | 13225 | HDA_CODEC_MUTE("Surround Playback Switch", 0x0d, 0x0, HDA_INPUT), |
12924 | HDA_CODEC_VOLUME_MONO("Center Playback Volume", 0x04, 1, 0x0, HDA_OUTPUT), | 13226 | HDA_CODEC_VOLUME_MONO("Center Playback Volume", 0x04, 1, 0x0, HDA_OUTPUT), |
12925 | HDA_CODEC_VOLUME_MONO("LFE Playback Volume", 0x04, 2, 0x0, HDA_OUTPUT), | 13227 | HDA_CODEC_VOLUME_MONO("LFE Playback Volume", 0x04, 2, 0x0, HDA_OUTPUT), |
12926 | HDA_BIND_MUTE_MONO("Center Playback Switch", 0x04, 1, 2, HDA_INPUT), | 13228 | HDA_CODEC_MUTE_MONO("Center Playback Switch", 0x0e, 1, 0x0, HDA_INPUT), |
12927 | HDA_BIND_MUTE_MONO("LFE Playback Switch", 0x04, 2, 2, HDA_INPUT), | 13229 | HDA_CODEC_MUTE_MONO("LFE Playback Switch", 0x0e, 2, 0x0, HDA_INPUT), |
12928 | HDA_CODEC_MUTE("Headphone Playback Switch", 0x1b, 0x0, HDA_OUTPUT), | 13230 | HDA_CODEC_MUTE("Headphone Playback Switch", 0x1b, 0x0, HDA_OUTPUT), |
12929 | 13231 | ||
12930 | /*Input mixer control */ | 13232 | /*Input mixer control */ |
@@ -12941,7 +13243,7 @@ static struct snd_kcontrol_new alc662_base_mixer[] = { | |||
12941 | 13243 | ||
12942 | static struct snd_kcontrol_new alc662_3ST_2ch_mixer[] = { | 13244 | static struct snd_kcontrol_new alc662_3ST_2ch_mixer[] = { |
12943 | HDA_CODEC_VOLUME("Front Playback Volume", 0x02, 0x0, HDA_OUTPUT), | 13245 | HDA_CODEC_VOLUME("Front Playback Volume", 0x02, 0x0, HDA_OUTPUT), |
12944 | HDA_BIND_MUTE("Front Playback Switch", 0x02, 2, HDA_INPUT), | 13246 | HDA_CODEC_MUTE("Front Playback Switch", 0x0c, 0x0, HDA_INPUT), |
12945 | HDA_CODEC_MUTE("Headphone Playback Switch", 0x1b, 0x0, HDA_OUTPUT), | 13247 | HDA_CODEC_MUTE("Headphone Playback Switch", 0x1b, 0x0, HDA_OUTPUT), |
12946 | HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT), | 13248 | HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT), |
12947 | HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT), | 13249 | HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT), |
@@ -12958,13 +13260,13 @@ static struct snd_kcontrol_new alc662_3ST_2ch_mixer[] = { | |||
12958 | 13260 | ||
12959 | static struct snd_kcontrol_new alc662_3ST_6ch_mixer[] = { | 13261 | static struct snd_kcontrol_new alc662_3ST_6ch_mixer[] = { |
12960 | HDA_CODEC_VOLUME("Front Playback Volume", 0x02, 0x0, HDA_OUTPUT), | 13262 | HDA_CODEC_VOLUME("Front Playback Volume", 0x02, 0x0, HDA_OUTPUT), |
12961 | HDA_BIND_MUTE("Front Playback Switch", 0x02, 2, HDA_INPUT), | 13263 | HDA_CODEC_MUTE("Front Playback Switch", 0x0c, 0x0, HDA_INPUT), |
12962 | HDA_CODEC_VOLUME("Surround Playback Volume", 0x03, 0x0, HDA_OUTPUT), | 13264 | HDA_CODEC_VOLUME("Surround Playback Volume", 0x03, 0x0, HDA_OUTPUT), |
12963 | HDA_BIND_MUTE("Surround Playback Switch", 0x03, 2, HDA_INPUT), | 13265 | HDA_CODEC_MUTE("Surround Playback Switch", 0x0d, 0x0, HDA_INPUT), |
12964 | HDA_CODEC_VOLUME_MONO("Center Playback Volume", 0x04, 1, 0x0, HDA_OUTPUT), | 13266 | HDA_CODEC_VOLUME_MONO("Center Playback Volume", 0x04, 1, 0x0, HDA_OUTPUT), |
12965 | HDA_CODEC_VOLUME_MONO("LFE Playback Volume", 0x04, 2, 0x0, HDA_OUTPUT), | 13267 | HDA_CODEC_VOLUME_MONO("LFE Playback Volume", 0x04, 2, 0x0, HDA_OUTPUT), |
12966 | HDA_BIND_MUTE_MONO("Center Playback Switch", 0x04, 1, 2, HDA_INPUT), | 13268 | HDA_CODEC_MUTE_MONO("Center Playback Switch", 0x0e, 1, 0x0, HDA_INPUT), |
12967 | HDA_BIND_MUTE_MONO("LFE Playback Switch", 0x04, 2, 2, HDA_INPUT), | 13269 | HDA_CODEC_MUTE_MONO("LFE Playback Switch", 0x0e, 2, 0x0, HDA_INPUT), |
12968 | HDA_CODEC_MUTE("Headphone Playback Switch", 0x1b, 0x0, HDA_OUTPUT), | 13270 | HDA_CODEC_MUTE("Headphone Playback Switch", 0x1b, 0x0, HDA_OUTPUT), |
12969 | HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT), | 13271 | HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT), |
12970 | HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT), | 13272 | HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT), |
@@ -13313,6 +13615,7 @@ static const char *alc662_models[ALC662_MODEL_LAST] = { | |||
13313 | }; | 13615 | }; |
13314 | 13616 | ||
13315 | static struct snd_pci_quirk alc662_cfg_tbl[] = { | 13617 | static struct snd_pci_quirk alc662_cfg_tbl[] = { |
13618 | SND_PCI_QUIRK(0x1043, 0x8290, "ASUS P5GC-MX", ALC662_3ST_6ch_DIG), | ||
13316 | SND_PCI_QUIRK(0x1043, 0x82a1, "ASUS Eeepc", ALC662_ASUS_EEEPC_P701), | 13619 | SND_PCI_QUIRK(0x1043, 0x82a1, "ASUS Eeepc", ALC662_ASUS_EEEPC_P701), |
13317 | SND_PCI_QUIRK(0x1043, 0x82d1, "ASUS Eeepc EP20", ALC662_ASUS_EEEPC_EP20), | 13620 | SND_PCI_QUIRK(0x1043, 0x82d1, "ASUS Eeepc EP20", ALC662_ASUS_EEEPC_EP20), |
13318 | SND_PCI_QUIRK(0x17aa, 0x101e, "Lenovo", ALC662_LENOVO_101E), | 13621 | SND_PCI_QUIRK(0x17aa, 0x101e, "Lenovo", ALC662_LENOVO_101E), |
@@ -13326,8 +13629,6 @@ static struct alc_config_preset alc662_presets[] = { | |||
13326 | .num_dacs = ARRAY_SIZE(alc662_dac_nids), | 13629 | .num_dacs = ARRAY_SIZE(alc662_dac_nids), |
13327 | .dac_nids = alc662_dac_nids, | 13630 | .dac_nids = alc662_dac_nids, |
13328 | .dig_out_nid = ALC662_DIGOUT_NID, | 13631 | .dig_out_nid = ALC662_DIGOUT_NID, |
13329 | .num_adc_nids = ARRAY_SIZE(alc662_adc_nids), | ||
13330 | .adc_nids = alc662_adc_nids, | ||
13331 | .dig_in_nid = ALC662_DIGIN_NID, | 13632 | .dig_in_nid = ALC662_DIGIN_NID, |
13332 | .num_channel_mode = ARRAY_SIZE(alc662_3ST_2ch_modes), | 13633 | .num_channel_mode = ARRAY_SIZE(alc662_3ST_2ch_modes), |
13333 | .channel_mode = alc662_3ST_2ch_modes, | 13634 | .channel_mode = alc662_3ST_2ch_modes, |
@@ -13340,8 +13641,6 @@ static struct alc_config_preset alc662_presets[] = { | |||
13340 | .num_dacs = ARRAY_SIZE(alc662_dac_nids), | 13641 | .num_dacs = ARRAY_SIZE(alc662_dac_nids), |
13341 | .dac_nids = alc662_dac_nids, | 13642 | .dac_nids = alc662_dac_nids, |
13342 | .dig_out_nid = ALC662_DIGOUT_NID, | 13643 | .dig_out_nid = ALC662_DIGOUT_NID, |
13343 | .num_adc_nids = ARRAY_SIZE(alc662_adc_nids), | ||
13344 | .adc_nids = alc662_adc_nids, | ||
13345 | .dig_in_nid = ALC662_DIGIN_NID, | 13644 | .dig_in_nid = ALC662_DIGIN_NID, |
13346 | .num_channel_mode = ARRAY_SIZE(alc662_3ST_6ch_modes), | 13645 | .num_channel_mode = ARRAY_SIZE(alc662_3ST_6ch_modes), |
13347 | .channel_mode = alc662_3ST_6ch_modes, | 13646 | .channel_mode = alc662_3ST_6ch_modes, |
@@ -13354,8 +13653,6 @@ static struct alc_config_preset alc662_presets[] = { | |||
13354 | .init_verbs = { alc662_init_verbs }, | 13653 | .init_verbs = { alc662_init_verbs }, |
13355 | .num_dacs = ARRAY_SIZE(alc662_dac_nids), | 13654 | .num_dacs = ARRAY_SIZE(alc662_dac_nids), |
13356 | .dac_nids = alc662_dac_nids, | 13655 | .dac_nids = alc662_dac_nids, |
13357 | .num_adc_nids = ARRAY_SIZE(alc662_adc_nids), | ||
13358 | .adc_nids = alc662_adc_nids, | ||
13359 | .num_channel_mode = ARRAY_SIZE(alc662_3ST_6ch_modes), | 13656 | .num_channel_mode = ARRAY_SIZE(alc662_3ST_6ch_modes), |
13360 | .channel_mode = alc662_3ST_6ch_modes, | 13657 | .channel_mode = alc662_3ST_6ch_modes, |
13361 | .need_dac_fix = 1, | 13658 | .need_dac_fix = 1, |
@@ -13368,8 +13665,6 @@ static struct alc_config_preset alc662_presets[] = { | |||
13368 | .num_dacs = ARRAY_SIZE(alc662_dac_nids), | 13665 | .num_dacs = ARRAY_SIZE(alc662_dac_nids), |
13369 | .dac_nids = alc662_dac_nids, | 13666 | .dac_nids = alc662_dac_nids, |
13370 | .dig_out_nid = ALC662_DIGOUT_NID, | 13667 | .dig_out_nid = ALC662_DIGOUT_NID, |
13371 | .num_adc_nids = ARRAY_SIZE(alc662_adc_nids), | ||
13372 | .adc_nids = alc662_adc_nids, | ||
13373 | .dig_in_nid = ALC662_DIGIN_NID, | 13668 | .dig_in_nid = ALC662_DIGIN_NID, |
13374 | .num_channel_mode = ARRAY_SIZE(alc662_5stack_modes), | 13669 | .num_channel_mode = ARRAY_SIZE(alc662_5stack_modes), |
13375 | .channel_mode = alc662_5stack_modes, | 13670 | .channel_mode = alc662_5stack_modes, |
@@ -13380,8 +13675,6 @@ static struct alc_config_preset alc662_presets[] = { | |||
13380 | .init_verbs = { alc662_init_verbs, alc662_sue_init_verbs }, | 13675 | .init_verbs = { alc662_init_verbs, alc662_sue_init_verbs }, |
13381 | .num_dacs = ARRAY_SIZE(alc662_dac_nids), | 13676 | .num_dacs = ARRAY_SIZE(alc662_dac_nids), |
13382 | .dac_nids = alc662_dac_nids, | 13677 | .dac_nids = alc662_dac_nids, |
13383 | .num_adc_nids = ARRAY_SIZE(alc662_adc_nids), | ||
13384 | .adc_nids = alc662_adc_nids, | ||
13385 | .num_channel_mode = ARRAY_SIZE(alc662_3ST_2ch_modes), | 13678 | .num_channel_mode = ARRAY_SIZE(alc662_3ST_2ch_modes), |
13386 | .channel_mode = alc662_3ST_2ch_modes, | 13679 | .channel_mode = alc662_3ST_2ch_modes, |
13387 | .input_mux = &alc662_lenovo_101e_capture_source, | 13680 | .input_mux = &alc662_lenovo_101e_capture_source, |
@@ -13394,8 +13687,6 @@ static struct alc_config_preset alc662_presets[] = { | |||
13394 | alc662_eeepc_sue_init_verbs }, | 13687 | alc662_eeepc_sue_init_verbs }, |
13395 | .num_dacs = ARRAY_SIZE(alc662_dac_nids), | 13688 | .num_dacs = ARRAY_SIZE(alc662_dac_nids), |
13396 | .dac_nids = alc662_dac_nids, | 13689 | .dac_nids = alc662_dac_nids, |
13397 | .num_adc_nids = ARRAY_SIZE(alc861vd_adc_nids), | ||
13398 | .adc_nids = alc662_adc_nids, | ||
13399 | .num_channel_mode = ARRAY_SIZE(alc662_3ST_2ch_modes), | 13690 | .num_channel_mode = ARRAY_SIZE(alc662_3ST_2ch_modes), |
13400 | .channel_mode = alc662_3ST_2ch_modes, | 13691 | .channel_mode = alc662_3ST_2ch_modes, |
13401 | .input_mux = &alc662_eeepc_capture_source, | 13692 | .input_mux = &alc662_eeepc_capture_source, |
@@ -13409,8 +13700,6 @@ static struct alc_config_preset alc662_presets[] = { | |||
13409 | alc662_eeepc_ep20_sue_init_verbs }, | 13700 | alc662_eeepc_ep20_sue_init_verbs }, |
13410 | .num_dacs = ARRAY_SIZE(alc662_dac_nids), | 13701 | .num_dacs = ARRAY_SIZE(alc662_dac_nids), |
13411 | .dac_nids = alc662_dac_nids, | 13702 | .dac_nids = alc662_dac_nids, |
13412 | .num_adc_nids = ARRAY_SIZE(alc662_adc_nids), | ||
13413 | .adc_nids = alc662_adc_nids, | ||
13414 | .num_channel_mode = ARRAY_SIZE(alc662_3ST_6ch_modes), | 13703 | .num_channel_mode = ARRAY_SIZE(alc662_3ST_6ch_modes), |
13415 | .channel_mode = alc662_3ST_6ch_modes, | 13704 | .channel_mode = alc662_3ST_6ch_modes, |
13416 | .input_mux = &alc662_lenovo_101e_capture_source, | 13705 | .input_mux = &alc662_lenovo_101e_capture_source, |
@@ -13556,11 +13845,7 @@ static void alc662_auto_set_output_and_unmute(struct hda_codec *codec, | |||
13556 | hda_nid_t nid, int pin_type, | 13845 | hda_nid_t nid, int pin_type, |
13557 | int dac_idx) | 13846 | int dac_idx) |
13558 | { | 13847 | { |
13559 | /* set as output */ | 13848 | alc_set_pin_output(codec, nid, pin_type); |
13560 | snd_hda_codec_write(codec, nid, 0, | ||
13561 | AC_VERB_SET_PIN_WIDGET_CONTROL, pin_type); | ||
13562 | snd_hda_codec_write(codec, nid, 0, | ||
13563 | AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE); | ||
13564 | /* need the manual connection? */ | 13849 | /* need the manual connection? */ |
13565 | if (alc880_is_multi_pin(nid)) { | 13850 | if (alc880_is_multi_pin(nid)) { |
13566 | struct alc_spec *spec = codec->spec; | 13851 | struct alc_spec *spec = codec->spec; |
@@ -13595,6 +13880,9 @@ static void alc662_auto_init_hp_out(struct hda_codec *codec) | |||
13595 | if (pin) /* connect to front */ | 13880 | if (pin) /* connect to front */ |
13596 | /* use dac 0 */ | 13881 | /* use dac 0 */ |
13597 | alc662_auto_set_output_and_unmute(codec, pin, PIN_HP, 0); | 13882 | alc662_auto_set_output_and_unmute(codec, pin, PIN_HP, 0); |
13883 | pin = spec->autocfg.speaker_pins[0]; | ||
13884 | if (pin) | ||
13885 | alc662_auto_set_output_and_unmute(codec, pin, PIN_OUT, 0); | ||
13598 | } | 13886 | } |
13599 | 13887 | ||
13600 | #define alc662_is_input_pin(nid) alc880_is_input_pin(nid) | 13888 | #define alc662_is_input_pin(nid) alc880_is_input_pin(nid) |
@@ -13672,9 +13960,12 @@ static int alc662_parse_auto_config(struct hda_codec *codec) | |||
13672 | /* additional initialization for auto-configuration model */ | 13960 | /* additional initialization for auto-configuration model */ |
13673 | static void alc662_auto_init(struct hda_codec *codec) | 13961 | static void alc662_auto_init(struct hda_codec *codec) |
13674 | { | 13962 | { |
13963 | struct alc_spec *spec = codec->spec; | ||
13675 | alc662_auto_init_multi_out(codec); | 13964 | alc662_auto_init_multi_out(codec); |
13676 | alc662_auto_init_hp_out(codec); | 13965 | alc662_auto_init_hp_out(codec); |
13677 | alc662_auto_init_analog_input(codec); | 13966 | alc662_auto_init_analog_input(codec); |
13967 | if (spec->unsol_event) | ||
13968 | alc_sku_automute(codec); | ||
13678 | } | 13969 | } |
13679 | 13970 | ||
13680 | static int patch_alc662(struct hda_codec *codec) | 13971 | static int patch_alc662(struct hda_codec *codec) |
@@ -13722,10 +14013,9 @@ static int patch_alc662(struct hda_codec *codec) | |||
13722 | spec->stream_digital_playback = &alc662_pcm_digital_playback; | 14013 | spec->stream_digital_playback = &alc662_pcm_digital_playback; |
13723 | spec->stream_digital_capture = &alc662_pcm_digital_capture; | 14014 | spec->stream_digital_capture = &alc662_pcm_digital_capture; |
13724 | 14015 | ||
13725 | if (!spec->adc_nids && spec->input_mux) { | 14016 | spec->adc_nids = alc662_adc_nids; |
13726 | spec->adc_nids = alc662_adc_nids; | 14017 | spec->num_adc_nids = ARRAY_SIZE(alc662_adc_nids); |
13727 | spec->num_adc_nids = ARRAY_SIZE(alc662_adc_nids); | 14018 | spec->capsrc_nids = alc662_capsrc_nids; |
13728 | } | ||
13729 | 14019 | ||
13730 | spec->vmaster_nid = 0x02; | 14020 | spec->vmaster_nid = 0x02; |
13731 | 14021 | ||
@@ -13761,6 +14051,8 @@ struct hda_codec_preset snd_hda_preset_realtek[] = { | |||
13761 | { .id = 0x10ec0880, .name = "ALC880", .patch = patch_alc880 }, | 14051 | { .id = 0x10ec0880, .name = "ALC880", .patch = patch_alc880 }, |
13762 | { .id = 0x10ec0882, .name = "ALC882", .patch = patch_alc882 }, | 14052 | { .id = 0x10ec0882, .name = "ALC882", .patch = patch_alc882 }, |
13763 | { .id = 0x10ec0883, .name = "ALC883", .patch = patch_alc883 }, | 14053 | { .id = 0x10ec0883, .name = "ALC883", .patch = patch_alc883 }, |
14054 | { .id = 0x10ec0885, .rev = 0x100103, .name = "ALC889A", | ||
14055 | .patch = patch_alc882 }, /* should be patch_alc883() in future */ | ||
13764 | { .id = 0x10ec0885, .name = "ALC885", .patch = patch_alc882 }, | 14056 | { .id = 0x10ec0885, .name = "ALC885", .patch = patch_alc882 }, |
13765 | { .id = 0x10ec0888, .name = "ALC888", .patch = patch_alc883 }, | 14057 | { .id = 0x10ec0888, .name = "ALC888", .patch = patch_alc883 }, |
13766 | { .id = 0x10ec0889, .name = "ALC889", .patch = patch_alc883 }, | 14058 | { .id = 0x10ec0889, .name = "ALC889", .patch = patch_alc883 }, |
diff --git a/sound/pci/hda/patch_si3054.c b/sound/pci/hda/patch_si3054.c index d22f5a6b850f..9332b63e406c 100644 --- a/sound/pci/hda/patch_si3054.c +++ b/sound/pci/hda/patch_si3054.c | |||
@@ -28,7 +28,7 @@ | |||
28 | #include <sound/core.h> | 28 | #include <sound/core.h> |
29 | #include "hda_codec.h" | 29 | #include "hda_codec.h" |
30 | #include "hda_local.h" | 30 | #include "hda_local.h" |
31 | 31 | #include "hda_patch.h" | |
32 | 32 | ||
33 | /* si3054 verbs */ | 33 | /* si3054 verbs */ |
34 | #define SI3054_VERB_READ_NODE 0x900 | 34 | #define SI3054_VERB_READ_NODE 0x900 |
@@ -206,7 +206,7 @@ static int si3054_build_pcms(struct hda_codec *codec) | |||
206 | info->name = "Si3054 Modem"; | 206 | info->name = "Si3054 Modem"; |
207 | info->stream[SNDRV_PCM_STREAM_PLAYBACK] = si3054_pcm; | 207 | info->stream[SNDRV_PCM_STREAM_PLAYBACK] = si3054_pcm; |
208 | info->stream[SNDRV_PCM_STREAM_CAPTURE] = si3054_pcm; | 208 | info->stream[SNDRV_PCM_STREAM_CAPTURE] = si3054_pcm; |
209 | info->is_modem = 1; | 209 | info->pcm_type = HDA_PCM_TYPE_MODEM; |
210 | return 0; | 210 | return 0; |
211 | } | 211 | } |
212 | 212 | ||
diff --git a/sound/pci/hda/patch_sigmatel.c b/sound/pci/hda/patch_sigmatel.c index caf48edaa921..b3a15d616873 100644 --- a/sound/pci/hda/patch_sigmatel.c +++ b/sound/pci/hda/patch_sigmatel.c | |||
@@ -32,6 +32,7 @@ | |||
32 | #include <sound/asoundef.h> | 32 | #include <sound/asoundef.h> |
33 | #include "hda_codec.h" | 33 | #include "hda_codec.h" |
34 | #include "hda_local.h" | 34 | #include "hda_local.h" |
35 | #include "hda_patch.h" | ||
35 | 36 | ||
36 | #define NUM_CONTROL_ALLOC 32 | 37 | #define NUM_CONTROL_ALLOC 32 |
37 | #define STAC_PWR_EVENT 0x20 | 38 | #define STAC_PWR_EVENT 0x20 |
@@ -39,6 +40,7 @@ | |||
39 | 40 | ||
40 | enum { | 41 | enum { |
41 | STAC_REF, | 42 | STAC_REF, |
43 | STAC_9200_OQO, | ||
42 | STAC_9200_DELL_D21, | 44 | STAC_9200_DELL_D21, |
43 | STAC_9200_DELL_D22, | 45 | STAC_9200_DELL_D22, |
44 | STAC_9200_DELL_D23, | 46 | STAC_9200_DELL_D23, |
@@ -50,6 +52,7 @@ enum { | |||
50 | STAC_9200_DELL_M26, | 52 | STAC_9200_DELL_M26, |
51 | STAC_9200_DELL_M27, | 53 | STAC_9200_DELL_M27, |
52 | STAC_9200_GATEWAY, | 54 | STAC_9200_GATEWAY, |
55 | STAC_9200_PANASONIC, | ||
53 | STAC_9200_MODELS | 56 | STAC_9200_MODELS |
54 | }; | 57 | }; |
55 | 58 | ||
@@ -63,11 +66,14 @@ enum { | |||
63 | 66 | ||
64 | enum { | 67 | enum { |
65 | STAC_92HD73XX_REF, | 68 | STAC_92HD73XX_REF, |
69 | STAC_DELL_M6, | ||
66 | STAC_92HD73XX_MODELS | 70 | STAC_92HD73XX_MODELS |
67 | }; | 71 | }; |
68 | 72 | ||
69 | enum { | 73 | enum { |
70 | STAC_92HD71BXX_REF, | 74 | STAC_92HD71BXX_REF, |
75 | STAC_DELL_M4_1, | ||
76 | STAC_DELL_M4_2, | ||
71 | STAC_92HD71BXX_MODELS | 77 | STAC_92HD71BXX_MODELS |
72 | }; | 78 | }; |
73 | 79 | ||
@@ -123,6 +129,7 @@ struct sigmatel_spec { | |||
123 | unsigned int hp_detect: 1; | 129 | unsigned int hp_detect: 1; |
124 | 130 | ||
125 | /* gpio lines */ | 131 | /* gpio lines */ |
132 | unsigned int eapd_mask; | ||
126 | unsigned int gpio_mask; | 133 | unsigned int gpio_mask; |
127 | unsigned int gpio_dir; | 134 | unsigned int gpio_dir; |
128 | unsigned int gpio_data; | 135 | unsigned int gpio_data; |
@@ -135,6 +142,7 @@ struct sigmatel_spec { | |||
135 | /* power management */ | 142 | /* power management */ |
136 | unsigned int num_pwrs; | 143 | unsigned int num_pwrs; |
137 | hda_nid_t *pwr_nids; | 144 | hda_nid_t *pwr_nids; |
145 | hda_nid_t *dac_list; | ||
138 | 146 | ||
139 | /* playback */ | 147 | /* playback */ |
140 | struct hda_input_mux *mono_mux; | 148 | struct hda_input_mux *mono_mux; |
@@ -173,6 +181,7 @@ struct sigmatel_spec { | |||
173 | /* i/o switches */ | 181 | /* i/o switches */ |
174 | unsigned int io_switch[2]; | 182 | unsigned int io_switch[2]; |
175 | unsigned int clfe_swap; | 183 | unsigned int clfe_swap; |
184 | unsigned int hp_switch; | ||
176 | unsigned int aloopback; | 185 | unsigned int aloopback; |
177 | 186 | ||
178 | struct hda_pcm pcm_rec[2]; /* PCM information */ | 187 | struct hda_pcm pcm_rec[2]; /* PCM information */ |
@@ -184,9 +193,6 @@ struct sigmatel_spec { | |||
184 | struct hda_input_mux private_dimux; | 193 | struct hda_input_mux private_dimux; |
185 | struct hda_input_mux private_imux; | 194 | struct hda_input_mux private_imux; |
186 | struct hda_input_mux private_mono_mux; | 195 | struct hda_input_mux private_mono_mux; |
187 | |||
188 | /* virtual master */ | ||
189 | unsigned int vmaster_tlv[4]; | ||
190 | }; | 196 | }; |
191 | 197 | ||
192 | static hda_nid_t stac9200_adc_nids[1] = { | 198 | static hda_nid_t stac9200_adc_nids[1] = { |
@@ -244,7 +250,7 @@ static hda_nid_t stac92hd71bxx_dmux_nids[1] = { | |||
244 | 0x1c, | 250 | 0x1c, |
245 | }; | 251 | }; |
246 | 252 | ||
247 | static hda_nid_t stac92hd71bxx_dac_nids[2] = { | 253 | static hda_nid_t stac92hd71bxx_dac_nids[1] = { |
248 | 0x10, /*0x11, */ | 254 | 0x10, /*0x11, */ |
249 | }; | 255 | }; |
250 | 256 | ||
@@ -290,6 +296,10 @@ static hda_nid_t stac927x_mux_nids[3] = { | |||
290 | 0x15, 0x16, 0x17 | 296 | 0x15, 0x16, 0x17 |
291 | }; | 297 | }; |
292 | 298 | ||
299 | static hda_nid_t stac927x_dac_nids[6] = { | ||
300 | 0x02, 0x03, 0x04, 0x05, 0x06, 0 | ||
301 | }; | ||
302 | |||
293 | static hda_nid_t stac927x_dmux_nids[1] = { | 303 | static hda_nid_t stac927x_dmux_nids[1] = { |
294 | 0x1b, | 304 | 0x1b, |
295 | }; | 305 | }; |
@@ -331,10 +341,10 @@ static hda_nid_t stac922x_pin_nids[10] = { | |||
331 | 0x0f, 0x10, 0x11, 0x15, 0x1b, | 341 | 0x0f, 0x10, 0x11, 0x15, 0x1b, |
332 | }; | 342 | }; |
333 | 343 | ||
334 | static hda_nid_t stac92hd73xx_pin_nids[12] = { | 344 | static hda_nid_t stac92hd73xx_pin_nids[13] = { |
335 | 0x0a, 0x0b, 0x0c, 0x0d, 0x0e, | 345 | 0x0a, 0x0b, 0x0c, 0x0d, 0x0e, |
336 | 0x0f, 0x10, 0x11, 0x12, 0x13, | 346 | 0x0f, 0x10, 0x11, 0x12, 0x13, |
337 | 0x14, 0x22 | 347 | 0x14, 0x1e, 0x22 |
338 | }; | 348 | }; |
339 | 349 | ||
340 | static hda_nid_t stac92hd71bxx_pin_nids[10] = { | 350 | static hda_nid_t stac92hd71bxx_pin_nids[10] = { |
@@ -527,6 +537,43 @@ static struct hda_verb stac92hd73xx_6ch_core_init[] = { | |||
527 | {} | 537 | {} |
528 | }; | 538 | }; |
529 | 539 | ||
540 | static struct hda_verb dell_eq_core_init[] = { | ||
541 | /* set master volume to max value without distortion | ||
542 | * and direct control */ | ||
543 | { 0x1f, AC_VERB_SET_VOLUME_KNOB_CONTROL, 0xec}, | ||
544 | /* setup audio connections */ | ||
545 | { 0x0d, AC_VERB_SET_CONNECT_SEL, 0x00}, | ||
546 | { 0x0a, AC_VERB_SET_CONNECT_SEL, 0x01}, | ||
547 | { 0x0f, AC_VERB_SET_CONNECT_SEL, 0x02}, | ||
548 | /* setup adcs to point to mixer */ | ||
549 | { 0x20, AC_VERB_SET_CONNECT_SEL, 0x0b}, | ||
550 | { 0x21, AC_VERB_SET_CONNECT_SEL, 0x0b}, | ||
551 | /* setup import muxs */ | ||
552 | { 0x28, AC_VERB_SET_CONNECT_SEL, 0x01}, | ||
553 | { 0x29, AC_VERB_SET_CONNECT_SEL, 0x01}, | ||
554 | { 0x2a, AC_VERB_SET_CONNECT_SEL, 0x01}, | ||
555 | { 0x2b, AC_VERB_SET_CONNECT_SEL, 0x00}, | ||
556 | {} | ||
557 | }; | ||
558 | |||
559 | static struct hda_verb dell_m6_core_init[] = { | ||
560 | /* set master volume and direct control */ | ||
561 | { 0x1f, AC_VERB_SET_VOLUME_KNOB_CONTROL, 0xff}, | ||
562 | /* setup audio connections */ | ||
563 | { 0x0d, AC_VERB_SET_CONNECT_SEL, 0x00}, | ||
564 | { 0x0a, AC_VERB_SET_CONNECT_SEL, 0x01}, | ||
565 | { 0x0f, AC_VERB_SET_CONNECT_SEL, 0x02}, | ||
566 | /* setup adcs to point to mixer */ | ||
567 | { 0x20, AC_VERB_SET_CONNECT_SEL, 0x0b}, | ||
568 | { 0x21, AC_VERB_SET_CONNECT_SEL, 0x0b}, | ||
569 | /* setup import muxs */ | ||
570 | { 0x28, AC_VERB_SET_CONNECT_SEL, 0x01}, | ||
571 | { 0x29, AC_VERB_SET_CONNECT_SEL, 0x01}, | ||
572 | { 0x2a, AC_VERB_SET_CONNECT_SEL, 0x01}, | ||
573 | { 0x2b, AC_VERB_SET_CONNECT_SEL, 0x00}, | ||
574 | {} | ||
575 | }; | ||
576 | |||
530 | static struct hda_verb stac92hd73xx_8ch_core_init[] = { | 577 | static struct hda_verb stac92hd73xx_8ch_core_init[] = { |
531 | /* set master volume and direct control */ | 578 | /* set master volume and direct control */ |
532 | { 0x1f, AC_VERB_SET_VOLUME_KNOB_CONTROL, 0xff}, | 579 | { 0x1f, AC_VERB_SET_VOLUME_KNOB_CONTROL, 0xff}, |
@@ -910,6 +957,11 @@ static int stac92xx_build_controls(struct hda_codec *codec) | |||
910 | err = snd_hda_create_spdif_out_ctls(codec, spec->multiout.dig_out_nid); | 957 | err = snd_hda_create_spdif_out_ctls(codec, spec->multiout.dig_out_nid); |
911 | if (err < 0) | 958 | if (err < 0) |
912 | return err; | 959 | return err; |
960 | err = snd_hda_create_spdif_share_sw(codec, | ||
961 | &spec->multiout); | ||
962 | if (err < 0) | ||
963 | return err; | ||
964 | spec->multiout.share_spdif = 1; | ||
913 | } | 965 | } |
914 | if (spec->dig_in_nid) { | 966 | if (spec->dig_in_nid) { |
915 | err = snd_hda_create_spdif_in_ctls(codec, spec->dig_in_nid); | 967 | err = snd_hda_create_spdif_in_ctls(codec, spec->dig_in_nid); |
@@ -919,10 +971,11 @@ static int stac92xx_build_controls(struct hda_codec *codec) | |||
919 | 971 | ||
920 | /* if we have no master control, let's create it */ | 972 | /* if we have no master control, let's create it */ |
921 | if (!snd_hda_find_mixer_ctl(codec, "Master Playback Volume")) { | 973 | if (!snd_hda_find_mixer_ctl(codec, "Master Playback Volume")) { |
974 | unsigned int vmaster_tlv[4]; | ||
922 | snd_hda_set_vmaster_tlv(codec, spec->multiout.dac_nids[0], | 975 | snd_hda_set_vmaster_tlv(codec, spec->multiout.dac_nids[0], |
923 | HDA_OUTPUT, spec->vmaster_tlv); | 976 | HDA_OUTPUT, vmaster_tlv); |
924 | err = snd_hda_add_vmaster(codec, "Master Playback Volume", | 977 | err = snd_hda_add_vmaster(codec, "Master Playback Volume", |
925 | spec->vmaster_tlv, slave_vols); | 978 | vmaster_tlv, slave_vols); |
926 | if (err < 0) | 979 | if (err < 0) |
927 | return err; | 980 | return err; |
928 | } | 981 | } |
@@ -1052,9 +1105,15 @@ static unsigned int dell9200_m27_pin_configs[8] = { | |||
1052 | 0x90170310, 0x04a11020, 0x90170310, 0x40f003fc, | 1105 | 0x90170310, 0x04a11020, 0x90170310, 0x40f003fc, |
1053 | }; | 1106 | }; |
1054 | 1107 | ||
1108 | static unsigned int oqo9200_pin_configs[8] = { | ||
1109 | 0x40c000f0, 0x404000f1, 0x0221121f, 0x02211210, | ||
1110 | 0x90170111, 0x90a70120, 0x400000f2, 0x400000f3, | ||
1111 | }; | ||
1112 | |||
1055 | 1113 | ||
1056 | static unsigned int *stac9200_brd_tbl[STAC_9200_MODELS] = { | 1114 | static unsigned int *stac9200_brd_tbl[STAC_9200_MODELS] = { |
1057 | [STAC_REF] = ref9200_pin_configs, | 1115 | [STAC_REF] = ref9200_pin_configs, |
1116 | [STAC_9200_OQO] = oqo9200_pin_configs, | ||
1058 | [STAC_9200_DELL_D21] = dell9200_d21_pin_configs, | 1117 | [STAC_9200_DELL_D21] = dell9200_d21_pin_configs, |
1059 | [STAC_9200_DELL_D22] = dell9200_d22_pin_configs, | 1118 | [STAC_9200_DELL_D22] = dell9200_d22_pin_configs, |
1060 | [STAC_9200_DELL_D23] = dell9200_d23_pin_configs, | 1119 | [STAC_9200_DELL_D23] = dell9200_d23_pin_configs, |
@@ -1065,10 +1124,12 @@ static unsigned int *stac9200_brd_tbl[STAC_9200_MODELS] = { | |||
1065 | [STAC_9200_DELL_M25] = dell9200_m25_pin_configs, | 1124 | [STAC_9200_DELL_M25] = dell9200_m25_pin_configs, |
1066 | [STAC_9200_DELL_M26] = dell9200_m26_pin_configs, | 1125 | [STAC_9200_DELL_M26] = dell9200_m26_pin_configs, |
1067 | [STAC_9200_DELL_M27] = dell9200_m27_pin_configs, | 1126 | [STAC_9200_DELL_M27] = dell9200_m27_pin_configs, |
1127 | [STAC_9200_PANASONIC] = ref9200_pin_configs, | ||
1068 | }; | 1128 | }; |
1069 | 1129 | ||
1070 | static const char *stac9200_models[STAC_9200_MODELS] = { | 1130 | static const char *stac9200_models[STAC_9200_MODELS] = { |
1071 | [STAC_REF] = "ref", | 1131 | [STAC_REF] = "ref", |
1132 | [STAC_9200_OQO] = "oqo", | ||
1072 | [STAC_9200_DELL_D21] = "dell-d21", | 1133 | [STAC_9200_DELL_D21] = "dell-d21", |
1073 | [STAC_9200_DELL_D22] = "dell-d22", | 1134 | [STAC_9200_DELL_D22] = "dell-d22", |
1074 | [STAC_9200_DELL_D23] = "dell-d23", | 1135 | [STAC_9200_DELL_D23] = "dell-d23", |
@@ -1080,6 +1141,7 @@ static const char *stac9200_models[STAC_9200_MODELS] = { | |||
1080 | [STAC_9200_DELL_M26] = "dell-m26", | 1141 | [STAC_9200_DELL_M26] = "dell-m26", |
1081 | [STAC_9200_DELL_M27] = "dell-m27", | 1142 | [STAC_9200_DELL_M27] = "dell-m27", |
1082 | [STAC_9200_GATEWAY] = "gateway", | 1143 | [STAC_9200_GATEWAY] = "gateway", |
1144 | [STAC_9200_PANASONIC] = "panasonic", | ||
1083 | }; | 1145 | }; |
1084 | 1146 | ||
1085 | static struct snd_pci_quirk stac9200_cfg_tbl[] = { | 1147 | static struct snd_pci_quirk stac9200_cfg_tbl[] = { |
@@ -1146,13 +1208,15 @@ static struct snd_pci_quirk stac9200_cfg_tbl[] = { | |||
1146 | SND_PCI_QUIRK(PCI_VENDOR_ID_DELL, 0x01f6, | 1208 | SND_PCI_QUIRK(PCI_VENDOR_ID_DELL, 0x01f6, |
1147 | "unknown Dell", STAC_9200_DELL_M26), | 1209 | "unknown Dell", STAC_9200_DELL_M26), |
1148 | /* Panasonic */ | 1210 | /* Panasonic */ |
1149 | SND_PCI_QUIRK(0x10f7, 0x8338, "Panasonic CF-74", STAC_REF), | 1211 | SND_PCI_QUIRK(0x10f7, 0x8338, "Panasonic CF-74", STAC_9200_PANASONIC), |
1150 | /* Gateway machines needs EAPD to be set on resume */ | 1212 | /* Gateway machines needs EAPD to be set on resume */ |
1151 | SND_PCI_QUIRK(0x107b, 0x0205, "Gateway S-7110M", STAC_9200_GATEWAY), | 1213 | SND_PCI_QUIRK(0x107b, 0x0205, "Gateway S-7110M", STAC_9200_GATEWAY), |
1152 | SND_PCI_QUIRK(0x107b, 0x0317, "Gateway MT3423, MX341*", | 1214 | SND_PCI_QUIRK(0x107b, 0x0317, "Gateway MT3423, MX341*", |
1153 | STAC_9200_GATEWAY), | 1215 | STAC_9200_GATEWAY), |
1154 | SND_PCI_QUIRK(0x107b, 0x0318, "Gateway ML3019, MT3707", | 1216 | SND_PCI_QUIRK(0x107b, 0x0318, "Gateway ML3019, MT3707", |
1155 | STAC_9200_GATEWAY), | 1217 | STAC_9200_GATEWAY), |
1218 | /* OQO Mobile */ | ||
1219 | SND_PCI_QUIRK(0x1106, 0x3288, "OQO Model 2", STAC_9200_OQO), | ||
1156 | {} /* terminator */ | 1220 | {} /* terminator */ |
1157 | }; | 1221 | }; |
1158 | 1222 | ||
@@ -1202,24 +1266,48 @@ static struct snd_pci_quirk stac925x_cfg_tbl[] = { | |||
1202 | {} /* terminator */ | 1266 | {} /* terminator */ |
1203 | }; | 1267 | }; |
1204 | 1268 | ||
1205 | static unsigned int ref92hd73xx_pin_configs[12] = { | 1269 | static unsigned int ref92hd73xx_pin_configs[13] = { |
1206 | 0x02214030, 0x02a19040, 0x01a19020, 0x02214030, | 1270 | 0x02214030, 0x02a19040, 0x01a19020, 0x02214030, |
1207 | 0x0181302e, 0x01014010, 0x01014020, 0x01014030, | 1271 | 0x0181302e, 0x01014010, 0x01014020, 0x01014030, |
1208 | 0x02319040, 0x90a000f0, 0x90a000f0, 0x01452050, | 1272 | 0x02319040, 0x90a000f0, 0x90a000f0, 0x01452050, |
1273 | 0x01452050, | ||
1274 | }; | ||
1275 | |||
1276 | static unsigned int dell_m6_pin_configs[13] = { | ||
1277 | 0x0321101f, 0x4f00000f, 0x4f0000f0, 0x90170110, | ||
1278 | 0x03a11020, 0x0321101f, 0x4f0000f0, 0x4f0000f0, | ||
1279 | 0x4f0000f0, 0x90a60160, 0x4f0000f0, 0x4f0000f0, | ||
1280 | 0x4f0000f0, | ||
1209 | }; | 1281 | }; |
1210 | 1282 | ||
1211 | static unsigned int *stac92hd73xx_brd_tbl[STAC_92HD73XX_MODELS] = { | 1283 | static unsigned int *stac92hd73xx_brd_tbl[STAC_92HD73XX_MODELS] = { |
1212 | [STAC_92HD73XX_REF] = ref92hd73xx_pin_configs, | 1284 | [STAC_92HD73XX_REF] = ref92hd73xx_pin_configs, |
1285 | [STAC_DELL_M6] = dell_m6_pin_configs, | ||
1213 | }; | 1286 | }; |
1214 | 1287 | ||
1215 | static const char *stac92hd73xx_models[STAC_92HD73XX_MODELS] = { | 1288 | static const char *stac92hd73xx_models[STAC_92HD73XX_MODELS] = { |
1216 | [STAC_92HD73XX_REF] = "ref", | 1289 | [STAC_92HD73XX_REF] = "ref", |
1290 | [STAC_DELL_M6] = "dell-m6", | ||
1217 | }; | 1291 | }; |
1218 | 1292 | ||
1219 | static struct snd_pci_quirk stac92hd73xx_cfg_tbl[] = { | 1293 | static struct snd_pci_quirk stac92hd73xx_cfg_tbl[] = { |
1220 | /* SigmaTel reference board */ | 1294 | /* SigmaTel reference board */ |
1221 | SND_PCI_QUIRK(PCI_VENDOR_ID_INTEL, 0x2668, | 1295 | SND_PCI_QUIRK(PCI_VENDOR_ID_INTEL, 0x2668, |
1222 | "DFI LanParty", STAC_92HD73XX_REF), | 1296 | "DFI LanParty", STAC_92HD73XX_REF), |
1297 | SND_PCI_QUIRK(PCI_VENDOR_ID_DELL, 0x0254, | ||
1298 | "unknown Dell", STAC_DELL_M6), | ||
1299 | SND_PCI_QUIRK(PCI_VENDOR_ID_DELL, 0x0255, | ||
1300 | "unknown Dell", STAC_DELL_M6), | ||
1301 | SND_PCI_QUIRK(PCI_VENDOR_ID_DELL, 0x0256, | ||
1302 | "unknown Dell", STAC_DELL_M6), | ||
1303 | SND_PCI_QUIRK(PCI_VENDOR_ID_DELL, 0x0257, | ||
1304 | "unknown Dell", STAC_DELL_M6), | ||
1305 | SND_PCI_QUIRK(PCI_VENDOR_ID_DELL, 0x025e, | ||
1306 | "unknown Dell", STAC_DELL_M6), | ||
1307 | SND_PCI_QUIRK(PCI_VENDOR_ID_DELL, 0x025f, | ||
1308 | "unknown Dell", STAC_DELL_M6), | ||
1309 | SND_PCI_QUIRK(PCI_VENDOR_ID_DELL, 0x0271, | ||
1310 | "unknown Dell", STAC_DELL_M6), | ||
1223 | {} /* terminator */ | 1311 | {} /* terminator */ |
1224 | }; | 1312 | }; |
1225 | 1313 | ||
@@ -1229,18 +1317,56 @@ static unsigned int ref92hd71bxx_pin_configs[10] = { | |||
1229 | 0x90a000f0, 0x01452050, | 1317 | 0x90a000f0, 0x01452050, |
1230 | }; | 1318 | }; |
1231 | 1319 | ||
1320 | static unsigned int dell_m4_1_pin_configs[13] = { | ||
1321 | 0x0421101f, 0x04a11221, 0x40f000f0, 0x90170110, | ||
1322 | 0x23a1902e, 0x23014250, 0x40f000f0, 0x90a000f0, | ||
1323 | 0x40f000f0, 0x4f0000f0, | ||
1324 | }; | ||
1325 | |||
1326 | static unsigned int dell_m4_2_pin_configs[13] = { | ||
1327 | 0x0421101f, 0x04a11221, 0x90a70330, 0x90170110, | ||
1328 | 0x23a1902e, 0x23014250, 0x40f000f0, 0x40f000f0, | ||
1329 | 0x40f000f0, 0x044413b0, | ||
1330 | }; | ||
1331 | |||
1232 | static unsigned int *stac92hd71bxx_brd_tbl[STAC_92HD71BXX_MODELS] = { | 1332 | static unsigned int *stac92hd71bxx_brd_tbl[STAC_92HD71BXX_MODELS] = { |
1233 | [STAC_92HD71BXX_REF] = ref92hd71bxx_pin_configs, | 1333 | [STAC_92HD71BXX_REF] = ref92hd71bxx_pin_configs, |
1334 | [STAC_DELL_M4_1] = dell_m4_1_pin_configs, | ||
1335 | [STAC_DELL_M4_2] = dell_m4_2_pin_configs, | ||
1234 | }; | 1336 | }; |
1235 | 1337 | ||
1236 | static const char *stac92hd71bxx_models[STAC_92HD71BXX_MODELS] = { | 1338 | static const char *stac92hd71bxx_models[STAC_92HD71BXX_MODELS] = { |
1237 | [STAC_92HD71BXX_REF] = "ref", | 1339 | [STAC_92HD71BXX_REF] = "ref", |
1340 | [STAC_DELL_M4_1] = "dell-m4-1", | ||
1341 | [STAC_DELL_M4_2] = "dell-m4-2", | ||
1238 | }; | 1342 | }; |
1239 | 1343 | ||
1240 | static struct snd_pci_quirk stac92hd71bxx_cfg_tbl[] = { | 1344 | static struct snd_pci_quirk stac92hd71bxx_cfg_tbl[] = { |
1241 | /* SigmaTel reference board */ | 1345 | /* SigmaTel reference board */ |
1242 | SND_PCI_QUIRK(PCI_VENDOR_ID_INTEL, 0x2668, | 1346 | SND_PCI_QUIRK(PCI_VENDOR_ID_INTEL, 0x2668, |
1243 | "DFI LanParty", STAC_92HD71BXX_REF), | 1347 | "DFI LanParty", STAC_92HD71BXX_REF), |
1348 | SND_PCI_QUIRK(PCI_VENDOR_ID_DELL, 0x0233, | ||
1349 | "unknown Dell", STAC_DELL_M4_1), | ||
1350 | SND_PCI_QUIRK(PCI_VENDOR_ID_DELL, 0x0234, | ||
1351 | "unknown Dell", STAC_DELL_M4_1), | ||
1352 | SND_PCI_QUIRK(PCI_VENDOR_ID_DELL, 0x0250, | ||
1353 | "unknown Dell", STAC_DELL_M4_1), | ||
1354 | SND_PCI_QUIRK(PCI_VENDOR_ID_DELL, 0x024f, | ||
1355 | "unknown Dell", STAC_DELL_M4_1), | ||
1356 | SND_PCI_QUIRK(PCI_VENDOR_ID_DELL, 0x024d, | ||
1357 | "unknown Dell", STAC_DELL_M4_1), | ||
1358 | SND_PCI_QUIRK(PCI_VENDOR_ID_DELL, 0x0251, | ||
1359 | "unknown Dell", STAC_DELL_M4_1), | ||
1360 | SND_PCI_QUIRK(PCI_VENDOR_ID_DELL, 0x0277, | ||
1361 | "unknown Dell", STAC_DELL_M4_1), | ||
1362 | SND_PCI_QUIRK(PCI_VENDOR_ID_DELL, 0x0263, | ||
1363 | "unknown Dell", STAC_DELL_M4_2), | ||
1364 | SND_PCI_QUIRK(PCI_VENDOR_ID_DELL, 0x0265, | ||
1365 | "unknown Dell", STAC_DELL_M4_2), | ||
1366 | SND_PCI_QUIRK(PCI_VENDOR_ID_DELL, 0x0262, | ||
1367 | "unknown Dell", STAC_DELL_M4_2), | ||
1368 | SND_PCI_QUIRK(PCI_VENDOR_ID_DELL, 0x0264, | ||
1369 | "unknown Dell", STAC_DELL_M4_2), | ||
1244 | {} /* terminator */ | 1370 | {} /* terminator */ |
1245 | }; | 1371 | }; |
1246 | 1372 | ||
@@ -1733,7 +1859,8 @@ static int stac92xx_playback_pcm_open(struct hda_pcm_stream *hinfo, | |||
1733 | struct snd_pcm_substream *substream) | 1859 | struct snd_pcm_substream *substream) |
1734 | { | 1860 | { |
1735 | struct sigmatel_spec *spec = codec->spec; | 1861 | struct sigmatel_spec *spec = codec->spec; |
1736 | return snd_hda_multi_out_analog_open(codec, &spec->multiout, substream); | 1862 | return snd_hda_multi_out_analog_open(codec, &spec->multiout, substream, |
1863 | hinfo); | ||
1737 | } | 1864 | } |
1738 | 1865 | ||
1739 | static int stac92xx_playback_pcm_prepare(struct hda_pcm_stream *hinfo, | 1866 | static int stac92xx_playback_pcm_prepare(struct hda_pcm_stream *hinfo, |
@@ -1807,7 +1934,7 @@ static int stac92xx_capture_pcm_cleanup(struct hda_pcm_stream *hinfo, | |||
1807 | { | 1934 | { |
1808 | struct sigmatel_spec *spec = codec->spec; | 1935 | struct sigmatel_spec *spec = codec->spec; |
1809 | 1936 | ||
1810 | snd_hda_codec_setup_stream(codec, spec->adc_nids[substream->number], 0, 0, 0); | 1937 | snd_hda_codec_cleanup_stream(codec, spec->adc_nids[substream->number]); |
1811 | return 0; | 1938 | return 0; |
1812 | } | 1939 | } |
1813 | 1940 | ||
@@ -1889,6 +2016,7 @@ static int stac92xx_build_pcms(struct hda_codec *codec) | |||
1889 | codec->num_pcms++; | 2016 | codec->num_pcms++; |
1890 | info++; | 2017 | info++; |
1891 | info->name = "STAC92xx Digital"; | 2018 | info->name = "STAC92xx Digital"; |
2019 | info->pcm_type = HDA_PCM_TYPE_SPDIF; | ||
1892 | if (spec->multiout.dig_out_nid) { | 2020 | if (spec->multiout.dig_out_nid) { |
1893 | info->stream[SNDRV_PCM_STREAM_PLAYBACK] = stac92xx_pcm_digital_playback; | 2021 | info->stream[SNDRV_PCM_STREAM_PLAYBACK] = stac92xx_pcm_digital_playback; |
1894 | info->stream[SNDRV_PCM_STREAM_PLAYBACK].nid = spec->multiout.dig_out_nid; | 2022 | info->stream[SNDRV_PCM_STREAM_PLAYBACK].nid = spec->multiout.dig_out_nid; |
@@ -1925,6 +2053,34 @@ static void stac92xx_auto_set_pinctl(struct hda_codec *codec, hda_nid_t nid, int | |||
1925 | AC_VERB_SET_PIN_WIDGET_CONTROL, pin_type); | 2053 | AC_VERB_SET_PIN_WIDGET_CONTROL, pin_type); |
1926 | } | 2054 | } |
1927 | 2055 | ||
2056 | #define stac92xx_hp_switch_info snd_ctl_boolean_mono_info | ||
2057 | |||
2058 | static int stac92xx_hp_switch_get(struct snd_kcontrol *kcontrol, | ||
2059 | struct snd_ctl_elem_value *ucontrol) | ||
2060 | { | ||
2061 | struct hda_codec *codec = snd_kcontrol_chip(kcontrol); | ||
2062 | struct sigmatel_spec *spec = codec->spec; | ||
2063 | |||
2064 | ucontrol->value.integer.value[0] = spec->hp_switch; | ||
2065 | return 0; | ||
2066 | } | ||
2067 | |||
2068 | static int stac92xx_hp_switch_put(struct snd_kcontrol *kcontrol, | ||
2069 | struct snd_ctl_elem_value *ucontrol) | ||
2070 | { | ||
2071 | struct hda_codec *codec = snd_kcontrol_chip(kcontrol); | ||
2072 | struct sigmatel_spec *spec = codec->spec; | ||
2073 | |||
2074 | spec->hp_switch = ucontrol->value.integer.value[0]; | ||
2075 | |||
2076 | /* check to be sure that the ports are upto date with | ||
2077 | * switch changes | ||
2078 | */ | ||
2079 | codec->patch_ops.unsol_event(codec, STAC_HP_EVENT << 26); | ||
2080 | |||
2081 | return 1; | ||
2082 | } | ||
2083 | |||
1928 | #define stac92xx_io_switch_info snd_ctl_boolean_mono_info | 2084 | #define stac92xx_io_switch_info snd_ctl_boolean_mono_info |
1929 | 2085 | ||
1930 | static int stac92xx_io_switch_get(struct snd_kcontrol *kcontrol, struct snd_ctl_elem_value *ucontrol) | 2086 | static int stac92xx_io_switch_get(struct snd_kcontrol *kcontrol, struct snd_ctl_elem_value *ucontrol) |
@@ -1996,6 +2152,15 @@ static int stac92xx_clfe_switch_put(struct snd_kcontrol *kcontrol, | |||
1996 | return 1; | 2152 | return 1; |
1997 | } | 2153 | } |
1998 | 2154 | ||
2155 | #define STAC_CODEC_HP_SWITCH(xname) \ | ||
2156 | { .iface = SNDRV_CTL_ELEM_IFACE_MIXER, \ | ||
2157 | .name = xname, \ | ||
2158 | .index = 0, \ | ||
2159 | .info = stac92xx_hp_switch_info, \ | ||
2160 | .get = stac92xx_hp_switch_get, \ | ||
2161 | .put = stac92xx_hp_switch_put, \ | ||
2162 | } | ||
2163 | |||
1999 | #define STAC_CODEC_IO_SWITCH(xname, xpval) \ | 2164 | #define STAC_CODEC_IO_SWITCH(xname, xpval) \ |
2000 | { .iface = SNDRV_CTL_ELEM_IFACE_MIXER, \ | 2165 | { .iface = SNDRV_CTL_ELEM_IFACE_MIXER, \ |
2001 | .name = xname, \ | 2166 | .name = xname, \ |
@@ -2020,6 +2185,7 @@ enum { | |||
2020 | STAC_CTL_WIDGET_VOL, | 2185 | STAC_CTL_WIDGET_VOL, |
2021 | STAC_CTL_WIDGET_MUTE, | 2186 | STAC_CTL_WIDGET_MUTE, |
2022 | STAC_CTL_WIDGET_MONO_MUX, | 2187 | STAC_CTL_WIDGET_MONO_MUX, |
2188 | STAC_CTL_WIDGET_HP_SWITCH, | ||
2023 | STAC_CTL_WIDGET_IO_SWITCH, | 2189 | STAC_CTL_WIDGET_IO_SWITCH, |
2024 | STAC_CTL_WIDGET_CLFE_SWITCH | 2190 | STAC_CTL_WIDGET_CLFE_SWITCH |
2025 | }; | 2191 | }; |
@@ -2028,6 +2194,7 @@ static struct snd_kcontrol_new stac92xx_control_templates[] = { | |||
2028 | HDA_CODEC_VOLUME(NULL, 0, 0, 0), | 2194 | HDA_CODEC_VOLUME(NULL, 0, 0, 0), |
2029 | HDA_CODEC_MUTE(NULL, 0, 0, 0), | 2195 | HDA_CODEC_MUTE(NULL, 0, 0, 0), |
2030 | STAC_MONO_MUX, | 2196 | STAC_MONO_MUX, |
2197 | STAC_CODEC_HP_SWITCH(NULL), | ||
2031 | STAC_CODEC_IO_SWITCH(NULL, 0), | 2198 | STAC_CODEC_IO_SWITCH(NULL, 0), |
2032 | STAC_CODEC_CLFE_SWITCH(NULL, 0), | 2199 | STAC_CODEC_CLFE_SWITCH(NULL, 0), |
2033 | }; | 2200 | }; |
@@ -2222,6 +2389,29 @@ static int create_controls(struct sigmatel_spec *spec, const char *pfx, hda_nid_ | |||
2222 | return 0; | 2389 | return 0; |
2223 | } | 2390 | } |
2224 | 2391 | ||
2392 | static int add_spec_dacs(struct sigmatel_spec *spec, hda_nid_t nid) | ||
2393 | { | ||
2394 | if (!spec->multiout.hp_nid) | ||
2395 | spec->multiout.hp_nid = nid; | ||
2396 | else if (spec->multiout.num_dacs > 4) { | ||
2397 | printk(KERN_WARNING "stac92xx: No space for DAC 0x%x\n", nid); | ||
2398 | return 1; | ||
2399 | } else { | ||
2400 | spec->multiout.dac_nids[spec->multiout.num_dacs] = nid; | ||
2401 | spec->multiout.num_dacs++; | ||
2402 | } | ||
2403 | return 0; | ||
2404 | } | ||
2405 | |||
2406 | static int check_in_dac_nids(struct sigmatel_spec *spec, hda_nid_t nid) | ||
2407 | { | ||
2408 | if (is_in_dac_nids(spec, nid)) | ||
2409 | return 1; | ||
2410 | if (spec->multiout.hp_nid == nid) | ||
2411 | return 1; | ||
2412 | return 0; | ||
2413 | } | ||
2414 | |||
2225 | /* add playback controls from the parsed DAC table */ | 2415 | /* add playback controls from the parsed DAC table */ |
2226 | static int stac92xx_auto_create_multi_out_ctls(struct hda_codec *codec, | 2416 | static int stac92xx_auto_create_multi_out_ctls(struct hda_codec *codec, |
2227 | const struct auto_pin_cfg *cfg) | 2417 | const struct auto_pin_cfg *cfg) |
@@ -2236,7 +2426,7 @@ static int stac92xx_auto_create_multi_out_ctls(struct hda_codec *codec, | |||
2236 | unsigned int wid_caps, pincap; | 2426 | unsigned int wid_caps, pincap; |
2237 | 2427 | ||
2238 | 2428 | ||
2239 | for (i = 0; i < cfg->line_outs; i++) { | 2429 | for (i = 0; i < cfg->line_outs && i < spec->multiout.num_dacs; i++) { |
2240 | if (!spec->multiout.dac_nids[i]) | 2430 | if (!spec->multiout.dac_nids[i]) |
2241 | continue; | 2431 | continue; |
2242 | 2432 | ||
@@ -2269,6 +2459,14 @@ static int stac92xx_auto_create_multi_out_ctls(struct hda_codec *codec, | |||
2269 | } | 2459 | } |
2270 | } | 2460 | } |
2271 | 2461 | ||
2462 | if (cfg->hp_outs > 1) { | ||
2463 | err = stac92xx_add_control(spec, | ||
2464 | STAC_CTL_WIDGET_HP_SWITCH, | ||
2465 | "Headphone as Line Out Switch", 0); | ||
2466 | if (err < 0) | ||
2467 | return err; | ||
2468 | } | ||
2469 | |||
2272 | if (spec->line_switch) { | 2470 | if (spec->line_switch) { |
2273 | nid = cfg->input_pins[AUTO_PIN_LINE]; | 2471 | nid = cfg->input_pins[AUTO_PIN_LINE]; |
2274 | pincap = snd_hda_param_read(codec, nid, | 2472 | pincap = snd_hda_param_read(codec, nid, |
@@ -2284,10 +2482,11 @@ static int stac92xx_auto_create_multi_out_ctls(struct hda_codec *codec, | |||
2284 | 2482 | ||
2285 | if (spec->mic_switch) { | 2483 | if (spec->mic_switch) { |
2286 | unsigned int def_conf; | 2484 | unsigned int def_conf; |
2287 | nid = cfg->input_pins[AUTO_PIN_MIC]; | 2485 | unsigned int mic_pin = AUTO_PIN_MIC; |
2486 | again: | ||
2487 | nid = cfg->input_pins[mic_pin]; | ||
2288 | def_conf = snd_hda_codec_read(codec, nid, 0, | 2488 | def_conf = snd_hda_codec_read(codec, nid, 0, |
2289 | AC_VERB_GET_CONFIG_DEFAULT, 0); | 2489 | AC_VERB_GET_CONFIG_DEFAULT, 0); |
2290 | |||
2291 | /* some laptops have an internal analog microphone | 2490 | /* some laptops have an internal analog microphone |
2292 | * which can't be used as a output */ | 2491 | * which can't be used as a output */ |
2293 | if (get_defcfg_connect(def_conf) != AC_JACK_PORT_FIXED) { | 2492 | if (get_defcfg_connect(def_conf) != AC_JACK_PORT_FIXED) { |
@@ -2297,38 +2496,22 @@ static int stac92xx_auto_create_multi_out_ctls(struct hda_codec *codec, | |||
2297 | err = stac92xx_add_control(spec, | 2496 | err = stac92xx_add_control(spec, |
2298 | STAC_CTL_WIDGET_IO_SWITCH, | 2497 | STAC_CTL_WIDGET_IO_SWITCH, |
2299 | "Mic as Output Switch", (nid << 8) | 1); | 2498 | "Mic as Output Switch", (nid << 8) | 1); |
2499 | nid = snd_hda_codec_read(codec, nid, 0, | ||
2500 | AC_VERB_GET_CONNECT_LIST, 0) & 0xff; | ||
2501 | if (!check_in_dac_nids(spec, nid)) | ||
2502 | add_spec_dacs(spec, nid); | ||
2300 | if (err < 0) | 2503 | if (err < 0) |
2301 | return err; | 2504 | return err; |
2302 | } | 2505 | } |
2506 | } else if (mic_pin == AUTO_PIN_MIC) { | ||
2507 | mic_pin = AUTO_PIN_FRONT_MIC; | ||
2508 | goto again; | ||
2303 | } | 2509 | } |
2304 | } | 2510 | } |
2305 | 2511 | ||
2306 | return 0; | 2512 | return 0; |
2307 | } | 2513 | } |
2308 | 2514 | ||
2309 | static int check_in_dac_nids(struct sigmatel_spec *spec, hda_nid_t nid) | ||
2310 | { | ||
2311 | if (is_in_dac_nids(spec, nid)) | ||
2312 | return 1; | ||
2313 | if (spec->multiout.hp_nid == nid) | ||
2314 | return 1; | ||
2315 | return 0; | ||
2316 | } | ||
2317 | |||
2318 | static int add_spec_dacs(struct sigmatel_spec *spec, hda_nid_t nid) | ||
2319 | { | ||
2320 | if (!spec->multiout.hp_nid) | ||
2321 | spec->multiout.hp_nid = nid; | ||
2322 | else if (spec->multiout.num_dacs > 4) { | ||
2323 | printk(KERN_WARNING "stac92xx: No space for DAC 0x%x\n", nid); | ||
2324 | return 1; | ||
2325 | } else { | ||
2326 | spec->multiout.dac_nids[spec->multiout.num_dacs] = nid; | ||
2327 | spec->multiout.num_dacs++; | ||
2328 | } | ||
2329 | return 0; | ||
2330 | } | ||
2331 | |||
2332 | /* add playback controls for Speaker and HP outputs */ | 2515 | /* add playback controls for Speaker and HP outputs */ |
2333 | static int stac92xx_auto_create_hp_ctls(struct hda_codec *codec, | 2516 | static int stac92xx_auto_create_hp_ctls(struct hda_codec *codec, |
2334 | struct auto_pin_cfg *cfg) | 2517 | struct auto_pin_cfg *cfg) |
@@ -2378,12 +2561,8 @@ static int stac92xx_auto_create_hp_ctls(struct hda_codec *codec, | |||
2378 | return err; | 2561 | return err; |
2379 | } | 2562 | } |
2380 | if (spec->multiout.hp_nid) { | 2563 | if (spec->multiout.hp_nid) { |
2381 | const char *pfx; | 2564 | err = create_controls(spec, "Headphone", |
2382 | if (old_num_dacs == spec->multiout.num_dacs) | 2565 | spec->multiout.hp_nid, 3); |
2383 | pfx = "Master"; | ||
2384 | else | ||
2385 | pfx = "Headphone"; | ||
2386 | err = create_controls(spec, pfx, spec->multiout.hp_nid, 3); | ||
2387 | if (err < 0) | 2566 | if (err < 0) |
2388 | return err; | 2567 | return err; |
2389 | } | 2568 | } |
@@ -2745,7 +2924,7 @@ static int stac9200_auto_create_lfe_ctls(struct hda_codec *codec, | |||
2745 | */ | 2924 | */ |
2746 | for (i = 0; i < spec->autocfg.speaker_outs && lfe_pin == 0x0; i++) { | 2925 | for (i = 0; i < spec->autocfg.speaker_outs && lfe_pin == 0x0; i++) { |
2747 | hda_nid_t pin = spec->autocfg.speaker_pins[i]; | 2926 | hda_nid_t pin = spec->autocfg.speaker_pins[i]; |
2748 | unsigned long wcaps = get_wcaps(codec, pin); | 2927 | unsigned int wcaps = get_wcaps(codec, pin); |
2749 | wcaps &= (AC_WCAP_STEREO | AC_WCAP_OUT_AMP); | 2928 | wcaps &= (AC_WCAP_STEREO | AC_WCAP_OUT_AMP); |
2750 | if (wcaps == AC_WCAP_OUT_AMP) | 2929 | if (wcaps == AC_WCAP_OUT_AMP) |
2751 | /* found a mono speaker with an amp, must be lfe */ | 2930 | /* found a mono speaker with an amp, must be lfe */ |
@@ -2756,12 +2935,12 @@ static int stac9200_auto_create_lfe_ctls(struct hda_codec *codec, | |||
2756 | if (lfe_pin == 0 && spec->autocfg.speaker_outs == 0) { | 2935 | if (lfe_pin == 0 && spec->autocfg.speaker_outs == 0) { |
2757 | for (i = 0; i < spec->autocfg.line_outs && lfe_pin == 0x0; i++) { | 2936 | for (i = 0; i < spec->autocfg.line_outs && lfe_pin == 0x0; i++) { |
2758 | hda_nid_t pin = spec->autocfg.line_out_pins[i]; | 2937 | hda_nid_t pin = spec->autocfg.line_out_pins[i]; |
2759 | unsigned long cfg; | 2938 | unsigned int defcfg; |
2760 | cfg = snd_hda_codec_read(codec, pin, 0, | 2939 | defcfg = snd_hda_codec_read(codec, pin, 0, |
2761 | AC_VERB_GET_CONFIG_DEFAULT, | 2940 | AC_VERB_GET_CONFIG_DEFAULT, |
2762 | 0x00); | 2941 | 0x00); |
2763 | if (get_defcfg_device(cfg) == AC_JACK_SPEAKER) { | 2942 | if (get_defcfg_device(defcfg) == AC_JACK_SPEAKER) { |
2764 | unsigned long wcaps = get_wcaps(codec, pin); | 2943 | unsigned int wcaps = get_wcaps(codec, pin); |
2765 | wcaps &= (AC_WCAP_STEREO | AC_WCAP_OUT_AMP); | 2944 | wcaps &= (AC_WCAP_STEREO | AC_WCAP_OUT_AMP); |
2766 | if (wcaps == AC_WCAP_OUT_AMP) | 2945 | if (wcaps == AC_WCAP_OUT_AMP) |
2767 | /* found a mono speaker with an amp, | 2946 | /* found a mono speaker with an amp, |
@@ -2866,6 +3045,19 @@ static int is_nid_hp_pin(struct auto_pin_cfg *cfg, hda_nid_t nid) | |||
2866 | return 0; /* nid is not a HP-Out */ | 3045 | return 0; /* nid is not a HP-Out */ |
2867 | }; | 3046 | }; |
2868 | 3047 | ||
3048 | static void stac92xx_power_down(struct hda_codec *codec) | ||
3049 | { | ||
3050 | struct sigmatel_spec *spec = codec->spec; | ||
3051 | |||
3052 | /* power down inactive DACs */ | ||
3053 | hda_nid_t *dac; | ||
3054 | for (dac = spec->dac_list; *dac; dac++) | ||
3055 | if (!is_in_dac_nids(spec, *dac) && | ||
3056 | spec->multiout.hp_nid != *dac) | ||
3057 | snd_hda_codec_write_cache(codec, *dac, 0, | ||
3058 | AC_VERB_SET_POWER_STATE, AC_PWRST_D3); | ||
3059 | } | ||
3060 | |||
2869 | static int stac92xx_init(struct hda_codec *codec) | 3061 | static int stac92xx_init(struct hda_codec *codec) |
2870 | { | 3062 | { |
2871 | struct sigmatel_spec *spec = codec->spec; | 3063 | struct sigmatel_spec *spec = codec->spec; |
@@ -2909,16 +3101,21 @@ static int stac92xx_init(struct hda_codec *codec) | |||
2909 | ? STAC_HP_EVENT : STAC_PWR_EVENT; | 3101 | ? STAC_HP_EVENT : STAC_PWR_EVENT; |
2910 | int pinctl = snd_hda_codec_read(codec, spec->pwr_nids[i], | 3102 | int pinctl = snd_hda_codec_read(codec, spec->pwr_nids[i], |
2911 | 0, AC_VERB_GET_PIN_WIDGET_CONTROL, 0); | 3103 | 0, AC_VERB_GET_PIN_WIDGET_CONTROL, 0); |
3104 | int def_conf = snd_hda_codec_read(codec, spec->pwr_nids[i], | ||
3105 | 0, AC_VERB_GET_CONFIG_DEFAULT, 0); | ||
2912 | /* outputs are only ports capable of power management | 3106 | /* outputs are only ports capable of power management |
2913 | * any attempts on powering down a input port cause the | 3107 | * any attempts on powering down a input port cause the |
2914 | * referenced VREF to act quirky. | 3108 | * referenced VREF to act quirky. |
2915 | */ | 3109 | */ |
2916 | if (pinctl & AC_PINCTL_IN_EN) | 3110 | if (pinctl & AC_PINCTL_IN_EN) |
2917 | continue; | 3111 | continue; |
3112 | if (get_defcfg_connect(def_conf) != AC_JACK_PORT_FIXED) | ||
3113 | continue; | ||
2918 | enable_pin_detect(codec, spec->pwr_nids[i], event | i); | 3114 | enable_pin_detect(codec, spec->pwr_nids[i], event | i); |
2919 | codec->patch_ops.unsol_event(codec, (event | i) << 26); | 3115 | codec->patch_ops.unsol_event(codec, (event | i) << 26); |
2920 | } | 3116 | } |
2921 | 3117 | if (spec->dac_list) | |
3118 | stac92xx_power_down(codec); | ||
2922 | if (cfg->dig_out_pin) | 3119 | if (cfg->dig_out_pin) |
2923 | stac92xx_auto_set_pinctl(codec, cfg->dig_out_pin, | 3120 | stac92xx_auto_set_pinctl(codec, cfg->dig_out_pin, |
2924 | AC_PINCTL_OUT_EN); | 3121 | AC_PINCTL_OUT_EN); |
@@ -3014,6 +3211,7 @@ static void stac92xx_hp_detect(struct hda_codec *codec, unsigned int res) | |||
3014 | { | 3211 | { |
3015 | struct sigmatel_spec *spec = codec->spec; | 3212 | struct sigmatel_spec *spec = codec->spec; |
3016 | struct auto_pin_cfg *cfg = &spec->autocfg; | 3213 | struct auto_pin_cfg *cfg = &spec->autocfg; |
3214 | int nid = cfg->hp_pins[cfg->hp_outs - 1]; | ||
3017 | int i, presence; | 3215 | int i, presence; |
3018 | 3216 | ||
3019 | presence = 0; | 3217 | presence = 0; |
@@ -3024,26 +3222,42 @@ static void stac92xx_hp_detect(struct hda_codec *codec, unsigned int res) | |||
3024 | for (i = 0; i < cfg->hp_outs; i++) { | 3222 | for (i = 0; i < cfg->hp_outs; i++) { |
3025 | if (presence) | 3223 | if (presence) |
3026 | break; | 3224 | break; |
3225 | if (spec->hp_switch && cfg->hp_pins[i] == nid) | ||
3226 | break; | ||
3027 | presence = get_hp_pin_presence(codec, cfg->hp_pins[i]); | 3227 | presence = get_hp_pin_presence(codec, cfg->hp_pins[i]); |
3028 | } | 3228 | } |
3029 | 3229 | ||
3030 | if (presence) { | 3230 | if (presence) { |
3031 | /* disable lineouts, enable hp */ | 3231 | /* disable lineouts, enable hp */ |
3232 | if (spec->hp_switch) | ||
3233 | stac92xx_reset_pinctl(codec, nid, AC_PINCTL_OUT_EN); | ||
3032 | for (i = 0; i < cfg->line_outs; i++) | 3234 | for (i = 0; i < cfg->line_outs; i++) |
3033 | stac92xx_reset_pinctl(codec, cfg->line_out_pins[i], | 3235 | stac92xx_reset_pinctl(codec, cfg->line_out_pins[i], |
3034 | AC_PINCTL_OUT_EN); | 3236 | AC_PINCTL_OUT_EN); |
3035 | for (i = 0; i < cfg->speaker_outs; i++) | 3237 | for (i = 0; i < cfg->speaker_outs; i++) |
3036 | stac92xx_reset_pinctl(codec, cfg->speaker_pins[i], | 3238 | stac92xx_reset_pinctl(codec, cfg->speaker_pins[i], |
3037 | AC_PINCTL_OUT_EN); | 3239 | AC_PINCTL_OUT_EN); |
3240 | if (spec->eapd_mask) | ||
3241 | stac_gpio_set(codec, spec->gpio_mask, | ||
3242 | spec->gpio_dir, spec->gpio_data & | ||
3243 | ~spec->eapd_mask); | ||
3038 | } else { | 3244 | } else { |
3039 | /* enable lineouts, disable hp */ | 3245 | /* enable lineouts, disable hp */ |
3246 | if (spec->hp_switch) | ||
3247 | stac92xx_set_pinctl(codec, nid, AC_PINCTL_OUT_EN); | ||
3040 | for (i = 0; i < cfg->line_outs; i++) | 3248 | for (i = 0; i < cfg->line_outs; i++) |
3041 | stac92xx_set_pinctl(codec, cfg->line_out_pins[i], | 3249 | stac92xx_set_pinctl(codec, cfg->line_out_pins[i], |
3042 | AC_PINCTL_OUT_EN); | 3250 | AC_PINCTL_OUT_EN); |
3043 | for (i = 0; i < cfg->speaker_outs; i++) | 3251 | for (i = 0; i < cfg->speaker_outs; i++) |
3044 | stac92xx_set_pinctl(codec, cfg->speaker_pins[i], | 3252 | stac92xx_set_pinctl(codec, cfg->speaker_pins[i], |
3045 | AC_PINCTL_OUT_EN); | 3253 | AC_PINCTL_OUT_EN); |
3254 | if (spec->eapd_mask) | ||
3255 | stac_gpio_set(codec, spec->gpio_mask, | ||
3256 | spec->gpio_dir, spec->gpio_data | | ||
3257 | spec->eapd_mask); | ||
3046 | } | 3258 | } |
3259 | if (!spec->hp_switch && cfg->hp_outs > 1 && presence) | ||
3260 | stac92xx_set_pinctl(codec, nid, AC_PINCTL_OUT_EN); | ||
3047 | } | 3261 | } |
3048 | 3262 | ||
3049 | static void stac92xx_pin_sense(struct hda_codec *codec, int idx) | 3263 | static void stac92xx_pin_sense(struct hda_codec *codec, int idx) |
@@ -3091,6 +3305,9 @@ static int stac92xx_resume(struct hda_codec *codec) | |||
3091 | spec->gpio_dir, spec->gpio_data); | 3305 | spec->gpio_dir, spec->gpio_data); |
3092 | snd_hda_codec_resume_amp(codec); | 3306 | snd_hda_codec_resume_amp(codec); |
3093 | snd_hda_codec_resume_cache(codec); | 3307 | snd_hda_codec_resume_cache(codec); |
3308 | /* power down inactive DACs */ | ||
3309 | if (spec->dac_list) | ||
3310 | stac92xx_power_down(codec); | ||
3094 | /* invoke unsolicited event to reset the HP state */ | 3311 | /* invoke unsolicited event to reset the HP state */ |
3095 | if (spec->hp_detect) | 3312 | if (spec->hp_detect) |
3096 | codec->patch_ops.unsol_event(codec, STAC_HP_EVENT << 26); | 3313 | codec->patch_ops.unsol_event(codec, STAC_HP_EVENT << 26); |
@@ -3147,12 +3364,18 @@ static int patch_stac9200(struct hda_codec *codec) | |||
3147 | spec->num_adcs = 1; | 3364 | spec->num_adcs = 1; |
3148 | spec->num_pwrs = 0; | 3365 | spec->num_pwrs = 0; |
3149 | 3366 | ||
3150 | if (spec->board_config == STAC_9200_GATEWAY) | 3367 | if (spec->board_config == STAC_9200_GATEWAY || |
3368 | spec->board_config == STAC_9200_OQO) | ||
3151 | spec->init = stac9200_eapd_init; | 3369 | spec->init = stac9200_eapd_init; |
3152 | else | 3370 | else |
3153 | spec->init = stac9200_core_init; | 3371 | spec->init = stac9200_core_init; |
3154 | spec->mixer = stac9200_mixer; | 3372 | spec->mixer = stac9200_mixer; |
3155 | 3373 | ||
3374 | if (spec->board_config == STAC_9200_PANASONIC) { | ||
3375 | spec->gpio_mask = spec->gpio_dir = 0x09; | ||
3376 | spec->gpio_data = 0x00; | ||
3377 | } | ||
3378 | |||
3156 | err = stac9200_parse_auto_config(codec); | 3379 | err = stac9200_parse_auto_config(codec); |
3157 | if (err < 0) { | 3380 | if (err < 0) { |
3158 | stac92xx_free(codec); | 3381 | stac92xx_free(codec); |
@@ -3293,6 +3516,7 @@ again: | |||
3293 | 3516 | ||
3294 | switch (spec->multiout.num_dacs) { | 3517 | switch (spec->multiout.num_dacs) { |
3295 | case 0x3: /* 6 Channel */ | 3518 | case 0x3: /* 6 Channel */ |
3519 | spec->multiout.hp_nid = 0x17; | ||
3296 | spec->mixer = stac92hd73xx_6ch_mixer; | 3520 | spec->mixer = stac92hd73xx_6ch_mixer; |
3297 | spec->init = stac92hd73xx_6ch_core_init; | 3521 | spec->init = stac92hd73xx_6ch_core_init; |
3298 | break; | 3522 | break; |
@@ -3318,13 +3542,42 @@ again: | |||
3318 | 3542 | ||
3319 | spec->num_muxes = ARRAY_SIZE(stac92hd73xx_mux_nids); | 3543 | spec->num_muxes = ARRAY_SIZE(stac92hd73xx_mux_nids); |
3320 | spec->num_adcs = ARRAY_SIZE(stac92hd73xx_adc_nids); | 3544 | spec->num_adcs = ARRAY_SIZE(stac92hd73xx_adc_nids); |
3321 | spec->num_dmics = STAC92HD73XX_NUM_DMICS; | ||
3322 | spec->num_dmuxes = ARRAY_SIZE(stac92hd73xx_dmux_nids); | 3545 | spec->num_dmuxes = ARRAY_SIZE(stac92hd73xx_dmux_nids); |
3323 | spec->dinput_mux = &stac92hd73xx_dmux; | 3546 | spec->dinput_mux = &stac92hd73xx_dmux; |
3324 | /* GPIO0 High = Enable EAPD */ | 3547 | /* GPIO0 High = Enable EAPD */ |
3325 | spec->gpio_mask = spec->gpio_dir = 0x1; | 3548 | spec->eapd_mask = spec->gpio_mask = spec->gpio_dir = 0x1; |
3326 | spec->gpio_data = 0x01; | 3549 | spec->gpio_data = 0x01; |
3327 | 3550 | ||
3551 | switch (spec->board_config) { | ||
3552 | case STAC_DELL_M6: | ||
3553 | spec->init = dell_eq_core_init; | ||
3554 | switch (codec->subsystem_id) { | ||
3555 | case 0x1028025e: /* Analog Mics */ | ||
3556 | case 0x1028025f: | ||
3557 | stac92xx_set_config_reg(codec, 0x0b, 0x90A70170); | ||
3558 | spec->num_dmics = 0; | ||
3559 | break; | ||
3560 | case 0x10280271: /* Digital Mics */ | ||
3561 | case 0x10280272: | ||
3562 | spec->init = dell_m6_core_init; | ||
3563 | /* fall-through */ | ||
3564 | case 0x10280254: | ||
3565 | case 0x10280255: | ||
3566 | stac92xx_set_config_reg(codec, 0x13, 0x90A60160); | ||
3567 | spec->num_dmics = 1; | ||
3568 | break; | ||
3569 | case 0x10280256: /* Both */ | ||
3570 | case 0x10280057: | ||
3571 | stac92xx_set_config_reg(codec, 0x0b, 0x90A70170); | ||
3572 | stac92xx_set_config_reg(codec, 0x13, 0x90A60160); | ||
3573 | spec->num_dmics = 1; | ||
3574 | break; | ||
3575 | } | ||
3576 | break; | ||
3577 | default: | ||
3578 | spec->num_dmics = STAC92HD73XX_NUM_DMICS; | ||
3579 | } | ||
3580 | |||
3328 | spec->num_pwrs = ARRAY_SIZE(stac92hd73xx_pwr_nids); | 3581 | spec->num_pwrs = ARRAY_SIZE(stac92hd73xx_pwr_nids); |
3329 | spec->pwr_nids = stac92hd73xx_pwr_nids; | 3582 | spec->pwr_nids = stac92hd73xx_pwr_nids; |
3330 | 3583 | ||
@@ -3398,7 +3651,10 @@ again: | |||
3398 | spec->aloopback_shift = 0; | 3651 | spec->aloopback_shift = 0; |
3399 | 3652 | ||
3400 | /* GPIO0 High = EAPD */ | 3653 | /* GPIO0 High = EAPD */ |
3401 | spec->gpio_mask = spec->gpio_dir = spec->gpio_data = 0x1; | 3654 | spec->gpio_mask = 0x01; |
3655 | spec->gpio_dir = 0x01; | ||
3656 | spec->gpio_mask = 0x01; | ||
3657 | spec->gpio_data = 0x01; | ||
3402 | 3658 | ||
3403 | spec->mux_nids = stac92hd71bxx_mux_nids; | 3659 | spec->mux_nids = stac92hd71bxx_mux_nids; |
3404 | spec->adc_nids = stac92hd71bxx_adc_nids; | 3660 | spec->adc_nids = stac92hd71bxx_adc_nids; |
@@ -3413,7 +3669,7 @@ again: | |||
3413 | spec->num_pwrs = ARRAY_SIZE(stac92hd71bxx_pwr_nids); | 3669 | spec->num_pwrs = ARRAY_SIZE(stac92hd71bxx_pwr_nids); |
3414 | spec->pwr_nids = stac92hd71bxx_pwr_nids; | 3670 | spec->pwr_nids = stac92hd71bxx_pwr_nids; |
3415 | 3671 | ||
3416 | spec->multiout.num_dacs = 2; | 3672 | spec->multiout.num_dacs = 1; |
3417 | spec->multiout.hp_nid = 0x11; | 3673 | spec->multiout.hp_nid = 0x11; |
3418 | spec->multiout.dac_nids = stac92hd71bxx_dac_nids; | 3674 | spec->multiout.dac_nids = stac92hd71bxx_dac_nids; |
3419 | 3675 | ||
@@ -3577,13 +3833,14 @@ static int patch_stac927x(struct hda_codec *codec) | |||
3577 | spec->num_adcs = ARRAY_SIZE(stac927x_adc_nids); | 3833 | spec->num_adcs = ARRAY_SIZE(stac927x_adc_nids); |
3578 | spec->mux_nids = stac927x_mux_nids; | 3834 | spec->mux_nids = stac927x_mux_nids; |
3579 | spec->num_muxes = ARRAY_SIZE(stac927x_mux_nids); | 3835 | spec->num_muxes = ARRAY_SIZE(stac927x_mux_nids); |
3836 | spec->dac_list = stac927x_dac_nids; | ||
3580 | spec->multiout.dac_nids = spec->dac_nids; | 3837 | spec->multiout.dac_nids = spec->dac_nids; |
3581 | 3838 | ||
3582 | switch (spec->board_config) { | 3839 | switch (spec->board_config) { |
3583 | case STAC_D965_3ST: | 3840 | case STAC_D965_3ST: |
3584 | case STAC_D965_5ST: | 3841 | case STAC_D965_5ST: |
3585 | /* GPIO0 High = Enable EAPD */ | 3842 | /* GPIO0 High = Enable EAPD */ |
3586 | spec->gpio_mask = spec->gpio_dir = 0x01; | 3843 | spec->eapd_mask = spec->gpio_mask = spec->gpio_dir = 0x01; |
3587 | spec->gpio_data = 0x01; | 3844 | spec->gpio_data = 0x01; |
3588 | spec->num_dmics = 0; | 3845 | spec->num_dmics = 0; |
3589 | 3846 | ||
@@ -3591,14 +3848,23 @@ static int patch_stac927x(struct hda_codec *codec) | |||
3591 | spec->mixer = stac927x_mixer; | 3848 | spec->mixer = stac927x_mixer; |
3592 | break; | 3849 | break; |
3593 | case STAC_DELL_BIOS: | 3850 | case STAC_DELL_BIOS: |
3851 | switch (codec->subsystem_id) { | ||
3852 | case 0x10280209: | ||
3853 | case 0x1028022e: | ||
3854 | /* correct the device field to SPDIF out */ | ||
3855 | stac92xx_set_config_reg(codec, 0x21, 0x01442070); | ||
3856 | break; | ||
3857 | }; | ||
3858 | /* configure the analog microphone on some laptops */ | ||
3859 | stac92xx_set_config_reg(codec, 0x0c, 0x90a79130); | ||
3594 | /* correct the front output jack as a hp out */ | 3860 | /* correct the front output jack as a hp out */ |
3595 | stac92xx_set_config_reg(codec, 0x0f, 0x02270110); | 3861 | stac92xx_set_config_reg(codec, 0x0f, 0x0227011f); |
3596 | /* correct the front input jack as a mic */ | 3862 | /* correct the front input jack as a mic */ |
3597 | stac92xx_set_config_reg(codec, 0x0e, 0x02a79130); | 3863 | stac92xx_set_config_reg(codec, 0x0e, 0x02a79130); |
3598 | /* fallthru */ | 3864 | /* fallthru */ |
3599 | case STAC_DELL_3ST: | 3865 | case STAC_DELL_3ST: |
3600 | /* GPIO2 High = Enable EAPD */ | 3866 | /* GPIO2 High = Enable EAPD */ |
3601 | spec->gpio_mask = spec->gpio_dir = 0x04; | 3867 | spec->eapd_mask = spec->gpio_mask = spec->gpio_dir = 0x04; |
3602 | spec->gpio_data = 0x04; | 3868 | spec->gpio_data = 0x04; |
3603 | spec->dmic_nids = stac927x_dmic_nids; | 3869 | spec->dmic_nids = stac927x_dmic_nids; |
3604 | spec->num_dmics = STAC927X_NUM_DMICS; | 3870 | spec->num_dmics = STAC927X_NUM_DMICS; |
@@ -3610,7 +3876,7 @@ static int patch_stac927x(struct hda_codec *codec) | |||
3610 | break; | 3876 | break; |
3611 | default: | 3877 | default: |
3612 | /* GPIO0 High = Enable EAPD */ | 3878 | /* GPIO0 High = Enable EAPD */ |
3613 | spec->gpio_mask = spec->gpio_dir = 0x1; | 3879 | spec->eapd_mask = spec->gpio_mask = spec->gpio_dir = 0x1; |
3614 | spec->gpio_data = 0x01; | 3880 | spec->gpio_data = 0x01; |
3615 | spec->num_dmics = 0; | 3881 | spec->num_dmics = 0; |
3616 | 3882 | ||
@@ -3714,6 +3980,7 @@ static int patch_stac9205(struct hda_codec *codec) | |||
3714 | (AC_USRSP_EN | STAC_HP_EVENT)); | 3980 | (AC_USRSP_EN | STAC_HP_EVENT)); |
3715 | 3981 | ||
3716 | spec->gpio_dir = 0x0b; | 3982 | spec->gpio_dir = 0x0b; |
3983 | spec->eapd_mask = 0x01; | ||
3717 | spec->gpio_mask = 0x1b; | 3984 | spec->gpio_mask = 0x1b; |
3718 | spec->gpio_mute = 0x10; | 3985 | spec->gpio_mute = 0x10; |
3719 | /* GPIO0 High = EAPD, GPIO1 Low = Headphone Mute, | 3986 | /* GPIO0 High = EAPD, GPIO1 Low = Headphone Mute, |
@@ -3723,7 +3990,7 @@ static int patch_stac9205(struct hda_codec *codec) | |||
3723 | break; | 3990 | break; |
3724 | default: | 3991 | default: |
3725 | /* GPIO0 High = EAPD */ | 3992 | /* GPIO0 High = EAPD */ |
3726 | spec->gpio_mask = spec->gpio_dir = 0x1; | 3993 | spec->eapd_mask = spec->gpio_mask = spec->gpio_dir = 0x1; |
3727 | spec->gpio_data = 0x01; | 3994 | spec->gpio_data = 0x01; |
3728 | break; | 3995 | break; |
3729 | } | 3996 | } |
diff --git a/sound/pci/hda/patch_via.c b/sound/pci/hda/patch_via.c index 4e5dd4cf36f5..52b1d81a26f7 100644 --- a/sound/pci/hda/patch_via.c +++ b/sound/pci/hda/patch_via.c | |||
@@ -39,7 +39,7 @@ | |||
39 | #include <sound/core.h> | 39 | #include <sound/core.h> |
40 | #include "hda_codec.h" | 40 | #include "hda_codec.h" |
41 | #include "hda_local.h" | 41 | #include "hda_local.h" |
42 | 42 | #include "hda_patch.h" | |
43 | 43 | ||
44 | /* amp values */ | 44 | /* amp values */ |
45 | #define AMP_VAL_IDX_SHIFT 19 | 45 | #define AMP_VAL_IDX_SHIFT 19 |
@@ -357,7 +357,8 @@ static int via_playback_pcm_open(struct hda_pcm_stream *hinfo, | |||
357 | struct snd_pcm_substream *substream) | 357 | struct snd_pcm_substream *substream) |
358 | { | 358 | { |
359 | struct via_spec *spec = codec->spec; | 359 | struct via_spec *spec = codec->spec; |
360 | return snd_hda_multi_out_analog_open(codec, &spec->multiout, substream); | 360 | return snd_hda_multi_out_analog_open(codec, &spec->multiout, substream, |
361 | hinfo); | ||
361 | } | 362 | } |
362 | 363 | ||
363 | static int via_playback_pcm_prepare(struct hda_pcm_stream *hinfo, | 364 | static int via_playback_pcm_prepare(struct hda_pcm_stream *hinfo, |
@@ -430,8 +431,7 @@ static int via_capture_pcm_cleanup(struct hda_pcm_stream *hinfo, | |||
430 | struct snd_pcm_substream *substream) | 431 | struct snd_pcm_substream *substream) |
431 | { | 432 | { |
432 | struct via_spec *spec = codec->spec; | 433 | struct via_spec *spec = codec->spec; |
433 | snd_hda_codec_setup_stream(codec, spec->adc_nids[substream->number], | 434 | snd_hda_codec_cleanup_stream(codec, spec->adc_nids[substream->number]); |
434 | 0, 0, 0); | ||
435 | return 0; | 435 | return 0; |
436 | } | 436 | } |
437 | 437 | ||
@@ -493,6 +493,11 @@ static int via_build_controls(struct hda_codec *codec) | |||
493 | spec->multiout.dig_out_nid); | 493 | spec->multiout.dig_out_nid); |
494 | if (err < 0) | 494 | if (err < 0) |
495 | return err; | 495 | return err; |
496 | err = snd_hda_create_spdif_share_sw(codec, | ||
497 | &spec->multiout); | ||
498 | if (err < 0) | ||
499 | return err; | ||
500 | spec->multiout.share_spdif = 1; | ||
496 | } | 501 | } |
497 | if (spec->dig_in_nid) { | 502 | if (spec->dig_in_nid) { |
498 | err = snd_hda_create_spdif_in_ctls(codec, spec->dig_in_nid); | 503 | err = snd_hda_create_spdif_in_ctls(codec, spec->dig_in_nid); |
@@ -523,6 +528,7 @@ static int via_build_pcms(struct hda_codec *codec) | |||
523 | codec->num_pcms++; | 528 | codec->num_pcms++; |
524 | info++; | 529 | info++; |
525 | info->name = spec->stream_name_digital; | 530 | info->name = spec->stream_name_digital; |
531 | info->pcm_type = HDA_PCM_TYPE_SPDIF; | ||
526 | if (spec->multiout.dig_out_nid) { | 532 | if (spec->multiout.dig_out_nid) { |
527 | info->stream[SNDRV_PCM_STREAM_PLAYBACK] = | 533 | info->stream[SNDRV_PCM_STREAM_PLAYBACK] = |
528 | *(spec->stream_digital_playback); | 534 | *(spec->stream_digital_playback); |
diff --git a/sound/pci/hda/vmaster.c b/sound/pci/hda/vmaster.c deleted file mode 100644 index 2da49d20a1fc..000000000000 --- a/sound/pci/hda/vmaster.c +++ /dev/null | |||
@@ -1,364 +0,0 @@ | |||
1 | /* | ||
2 | * Virtual master and slave controls | ||
3 | * | ||
4 | * Copyright (c) 2008 by Takashi Iwai <tiwai@suse.de> | ||
5 | * | ||
6 | * This program is free software; you can redistribute it and/or | ||
7 | * modify it under the terms of the GNU General Public License as | ||
8 | * published by the Free Software Foundation, version 2. | ||
9 | * | ||
10 | */ | ||
11 | |||
12 | #include <linux/slab.h> | ||
13 | #include <sound/core.h> | ||
14 | #include <sound/control.h> | ||
15 | |||
16 | /* | ||
17 | * a subset of information returned via ctl info callback | ||
18 | */ | ||
19 | struct link_ctl_info { | ||
20 | int type; /* value type */ | ||
21 | int count; /* item count */ | ||
22 | int min_val, max_val; /* min, max values */ | ||
23 | }; | ||
24 | |||
25 | /* | ||
26 | * link master - this contains a list of slave controls that are | ||
27 | * identical types, i.e. info returns the same value type and value | ||
28 | * ranges, but may have different number of counts. | ||
29 | * | ||
30 | * The master control is so far only mono volume/switch for simplicity. | ||
31 | * The same value will be applied to all slaves. | ||
32 | */ | ||
33 | struct link_master { | ||
34 | struct list_head slaves; | ||
35 | struct link_ctl_info info; | ||
36 | int val; /* the master value */ | ||
37 | }; | ||
38 | |||
39 | /* | ||
40 | * link slave - this contains a slave control element | ||
41 | * | ||
42 | * It fakes the control callbacsk with additional attenuation by the | ||
43 | * master control. A slave may have either one or two channels. | ||
44 | */ | ||
45 | |||
46 | struct link_slave { | ||
47 | struct list_head list; | ||
48 | struct link_master *master; | ||
49 | struct link_ctl_info info; | ||
50 | int vals[2]; /* current values */ | ||
51 | struct snd_kcontrol slave; /* the copy of original control entry */ | ||
52 | }; | ||
53 | |||
54 | /* get the slave ctl info and save the initial values */ | ||
55 | static int slave_init(struct link_slave *slave) | ||
56 | { | ||
57 | struct snd_ctl_elem_info *uinfo; | ||
58 | struct snd_ctl_elem_value *uctl; | ||
59 | int err, ch; | ||
60 | |||
61 | if (slave->info.count) | ||
62 | return 0; /* already initialized */ | ||
63 | |||
64 | uinfo = kmalloc(sizeof(*uinfo), GFP_KERNEL); | ||
65 | if (!uinfo) | ||
66 | return -ENOMEM; | ||
67 | uinfo->id = slave->slave.id; | ||
68 | err = slave->slave.info(&slave->slave, uinfo); | ||
69 | if (err < 0) { | ||
70 | kfree(uinfo); | ||
71 | return err; | ||
72 | } | ||
73 | slave->info.type = uinfo->type; | ||
74 | slave->info.count = uinfo->count; | ||
75 | if (slave->info.count > 2 || | ||
76 | (slave->info.type != SNDRV_CTL_ELEM_TYPE_INTEGER && | ||
77 | slave->info.type != SNDRV_CTL_ELEM_TYPE_BOOLEAN)) { | ||
78 | snd_printk(KERN_ERR "invalid slave element\n"); | ||
79 | kfree(uinfo); | ||
80 | return -EINVAL; | ||
81 | } | ||
82 | slave->info.min_val = uinfo->value.integer.min; | ||
83 | slave->info.max_val = uinfo->value.integer.max; | ||
84 | kfree(uinfo); | ||
85 | |||
86 | uctl = kmalloc(sizeof(*uctl), GFP_KERNEL); | ||
87 | if (!uctl) | ||
88 | return -ENOMEM; | ||
89 | uctl->id = slave->slave.id; | ||
90 | err = slave->slave.get(&slave->slave, uctl); | ||
91 | for (ch = 0; ch < slave->info.count; ch++) | ||
92 | slave->vals[ch] = uctl->value.integer.value[ch]; | ||
93 | kfree(uctl); | ||
94 | return 0; | ||
95 | } | ||
96 | |||
97 | /* initialize master volume */ | ||
98 | static int master_init(struct link_master *master) | ||
99 | { | ||
100 | struct link_slave *slave; | ||
101 | |||
102 | if (master->info.count) | ||
103 | return 0; /* already initialized */ | ||
104 | |||
105 | list_for_each_entry(slave, &master->slaves, list) { | ||
106 | int err = slave_init(slave); | ||
107 | if (err < 0) | ||
108 | return err; | ||
109 | master->info = slave->info; | ||
110 | master->info.count = 1; /* always mono */ | ||
111 | /* set full volume as default (= no attenuation) */ | ||
112 | master->val = master->info.max_val; | ||
113 | return 0; | ||
114 | } | ||
115 | return -ENOENT; | ||
116 | } | ||
117 | |||
118 | static int slave_get_val(struct link_slave *slave, | ||
119 | struct snd_ctl_elem_value *ucontrol) | ||
120 | { | ||
121 | int err, ch; | ||
122 | |||
123 | err = slave_init(slave); | ||
124 | if (err < 0) | ||
125 | return err; | ||
126 | for (ch = 0; ch < slave->info.count; ch++) | ||
127 | ucontrol->value.integer.value[ch] = slave->vals[ch]; | ||
128 | return 0; | ||
129 | } | ||
130 | |||
131 | static int slave_put_val(struct link_slave *slave, | ||
132 | struct snd_ctl_elem_value *ucontrol) | ||
133 | { | ||
134 | int err, ch, vol; | ||
135 | |||
136 | err = master_init(slave->master); | ||
137 | if (err < 0) | ||
138 | return err; | ||
139 | |||
140 | switch (slave->info.type) { | ||
141 | case SNDRV_CTL_ELEM_TYPE_BOOLEAN: | ||
142 | for (ch = 0; ch < slave->info.count; ch++) | ||
143 | ucontrol->value.integer.value[ch] &= | ||
144 | !!slave->master->val; | ||
145 | break; | ||
146 | case SNDRV_CTL_ELEM_TYPE_INTEGER: | ||
147 | for (ch = 0; ch < slave->info.count; ch++) { | ||
148 | /* max master volume is supposed to be 0 dB */ | ||
149 | vol = ucontrol->value.integer.value[ch]; | ||
150 | vol += slave->master->val - slave->master->info.max_val; | ||
151 | if (vol < slave->info.min_val) | ||
152 | vol = slave->info.min_val; | ||
153 | else if (vol > slave->info.max_val) | ||
154 | vol = slave->info.max_val; | ||
155 | ucontrol->value.integer.value[ch] = vol; | ||
156 | } | ||
157 | break; | ||
158 | } | ||
159 | return slave->slave.put(&slave->slave, ucontrol); | ||
160 | } | ||
161 | |||
162 | /* | ||
163 | * ctl callbacks for slaves | ||
164 | */ | ||
165 | static int slave_info(struct snd_kcontrol *kcontrol, | ||
166 | struct snd_ctl_elem_info *uinfo) | ||
167 | { | ||
168 | struct link_slave *slave = snd_kcontrol_chip(kcontrol); | ||
169 | return slave->slave.info(&slave->slave, uinfo); | ||
170 | } | ||
171 | |||
172 | static int slave_get(struct snd_kcontrol *kcontrol, | ||
173 | struct snd_ctl_elem_value *ucontrol) | ||
174 | { | ||
175 | struct link_slave *slave = snd_kcontrol_chip(kcontrol); | ||
176 | return slave_get_val(slave, ucontrol); | ||
177 | } | ||
178 | |||
179 | static int slave_put(struct snd_kcontrol *kcontrol, | ||
180 | struct snd_ctl_elem_value *ucontrol) | ||
181 | { | ||
182 | struct link_slave *slave = snd_kcontrol_chip(kcontrol); | ||
183 | int err, ch, changed = 0; | ||
184 | |||
185 | err = slave_init(slave); | ||
186 | if (err < 0) | ||
187 | return err; | ||
188 | for (ch = 0; ch < slave->info.count; ch++) { | ||
189 | if (slave->vals[ch] != ucontrol->value.integer.value[ch]) { | ||
190 | changed = 1; | ||
191 | slave->vals[ch] = ucontrol->value.integer.value[ch]; | ||
192 | } | ||
193 | } | ||
194 | if (!changed) | ||
195 | return 0; | ||
196 | return slave_put_val(slave, ucontrol); | ||
197 | } | ||
198 | |||
199 | static int slave_tlv_cmd(struct snd_kcontrol *kcontrol, | ||
200 | int op_flag, unsigned int size, | ||
201 | unsigned int __user *tlv) | ||
202 | { | ||
203 | struct link_slave *slave = snd_kcontrol_chip(kcontrol); | ||
204 | /* FIXME: this assumes that the max volume is 0 dB */ | ||
205 | return slave->slave.tlv.c(&slave->slave, op_flag, size, tlv); | ||
206 | } | ||
207 | |||
208 | static void slave_free(struct snd_kcontrol *kcontrol) | ||
209 | { | ||
210 | struct link_slave *slave = snd_kcontrol_chip(kcontrol); | ||
211 | if (slave->slave.private_free) | ||
212 | slave->slave.private_free(&slave->slave); | ||
213 | if (slave->master) | ||
214 | list_del(&slave->list); | ||
215 | kfree(slave); | ||
216 | } | ||
217 | |||
218 | /* | ||
219 | * Add a slave control to the group with the given master control | ||
220 | * | ||
221 | * All slaves must be the same type (returning the same information | ||
222 | * via info callback). The fucntion doesn't check it, so it's your | ||
223 | * responsibility. | ||
224 | * | ||
225 | * Also, some additional limitations: | ||
226 | * - at most two channels | ||
227 | * - logarithmic volume control (dB level), no linear volume | ||
228 | * - master can only attenuate the volume, no gain | ||
229 | */ | ||
230 | int snd_ctl_add_slave(struct snd_kcontrol *master, struct snd_kcontrol *slave) | ||
231 | { | ||
232 | struct link_master *master_link = snd_kcontrol_chip(master); | ||
233 | struct link_slave *srec; | ||
234 | |||
235 | srec = kzalloc(sizeof(*srec) + | ||
236 | slave->count * sizeof(*slave->vd), GFP_KERNEL); | ||
237 | if (!srec) | ||
238 | return -ENOMEM; | ||
239 | srec->slave = *slave; | ||
240 | memcpy(srec->slave.vd, slave->vd, slave->count * sizeof(*slave->vd)); | ||
241 | srec->master = master_link; | ||
242 | |||
243 | /* override callbacks */ | ||
244 | slave->info = slave_info; | ||
245 | slave->get = slave_get; | ||
246 | slave->put = slave_put; | ||
247 | if (slave->vd[0].access & SNDRV_CTL_ELEM_ACCESS_TLV_CALLBACK) | ||
248 | slave->tlv.c = slave_tlv_cmd; | ||
249 | slave->private_data = srec; | ||
250 | slave->private_free = slave_free; | ||
251 | |||
252 | list_add_tail(&srec->list, &master_link->slaves); | ||
253 | return 0; | ||
254 | } | ||
255 | |||
256 | /* | ||
257 | * ctl callbacks for master controls | ||
258 | */ | ||
259 | static int master_info(struct snd_kcontrol *kcontrol, | ||
260 | struct snd_ctl_elem_info *uinfo) | ||
261 | { | ||
262 | struct link_master *master = snd_kcontrol_chip(kcontrol); | ||
263 | int ret; | ||
264 | |||
265 | ret = master_init(master); | ||
266 | if (ret < 0) | ||
267 | return ret; | ||
268 | uinfo->type = master->info.type; | ||
269 | uinfo->count = master->info.count; | ||
270 | uinfo->value.integer.min = master->info.min_val; | ||
271 | uinfo->value.integer.max = master->info.max_val; | ||
272 | return 0; | ||
273 | } | ||
274 | |||
275 | static int master_get(struct snd_kcontrol *kcontrol, | ||
276 | struct snd_ctl_elem_value *ucontrol) | ||
277 | { | ||
278 | struct link_master *master = snd_kcontrol_chip(kcontrol); | ||
279 | int err = master_init(master); | ||
280 | if (err < 0) | ||
281 | return err; | ||
282 | ucontrol->value.integer.value[0] = master->val; | ||
283 | return 0; | ||
284 | } | ||
285 | |||
286 | static int master_put(struct snd_kcontrol *kcontrol, | ||
287 | struct snd_ctl_elem_value *ucontrol) | ||
288 | { | ||
289 | struct link_master *master = snd_kcontrol_chip(kcontrol); | ||
290 | struct link_slave *slave; | ||
291 | struct snd_ctl_elem_value *uval; | ||
292 | int err, old_val; | ||
293 | |||
294 | err = master_init(master); | ||
295 | if (err < 0) | ||
296 | return err; | ||
297 | old_val = master->val; | ||
298 | if (ucontrol->value.integer.value[0] == old_val) | ||
299 | return 0; | ||
300 | |||
301 | uval = kmalloc(sizeof(*uval), GFP_KERNEL); | ||
302 | if (!uval) | ||
303 | return -ENOMEM; | ||
304 | list_for_each_entry(slave, &master->slaves, list) { | ||
305 | master->val = old_val; | ||
306 | uval->id = slave->slave.id; | ||
307 | slave_get_val(slave, uval); | ||
308 | master->val = ucontrol->value.integer.value[0]; | ||
309 | slave_put_val(slave, uval); | ||
310 | } | ||
311 | kfree(uval); | ||
312 | return 1; | ||
313 | } | ||
314 | |||
315 | static void master_free(struct snd_kcontrol *kcontrol) | ||
316 | { | ||
317 | struct link_master *master = snd_kcontrol_chip(kcontrol); | ||
318 | struct link_slave *slave; | ||
319 | |||
320 | list_for_each_entry(slave, &master->slaves, list) | ||
321 | slave->master = NULL; | ||
322 | kfree(master); | ||
323 | } | ||
324 | |||
325 | |||
326 | /* | ||
327 | * Create a virtual master control with the given name | ||
328 | */ | ||
329 | struct snd_kcontrol *snd_ctl_make_virtual_master(char *name, | ||
330 | const unsigned int *tlv) | ||
331 | { | ||
332 | struct link_master *master; | ||
333 | struct snd_kcontrol *kctl; | ||
334 | struct snd_kcontrol_new knew; | ||
335 | |||
336 | memset(&knew, 0, sizeof(knew)); | ||
337 | knew.iface = SNDRV_CTL_ELEM_IFACE_MIXER; | ||
338 | knew.name = name; | ||
339 | knew.info = master_info; | ||
340 | |||
341 | master = kzalloc(sizeof(*master), GFP_KERNEL); | ||
342 | if (!master) | ||
343 | return NULL; | ||
344 | INIT_LIST_HEAD(&master->slaves); | ||
345 | |||
346 | kctl = snd_ctl_new1(&knew, master); | ||
347 | if (!kctl) { | ||
348 | kfree(master); | ||
349 | return NULL; | ||
350 | } | ||
351 | /* override some callbacks */ | ||
352 | kctl->info = master_info; | ||
353 | kctl->get = master_get; | ||
354 | kctl->put = master_put; | ||
355 | kctl->private_free = master_free; | ||
356 | |||
357 | /* additional (constant) TLV read */ | ||
358 | if (tlv) { | ||
359 | /* FIXME: this assumes that the max volume is 0 dB */ | ||
360 | kctl->vd[0].access |= SNDRV_CTL_ELEM_ACCESS_TLV_READ; | ||
361 | kctl->tlv.p = tlv; | ||
362 | } | ||
363 | return kctl; | ||
364 | } | ||