Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 1 | /* |
| 2 | * Universal Interface for Intel High Definition Audio Codec |
| 3 | * |
| 4 | * HD audio interface patch for ALC 260/880/882 codecs |
| 5 | * |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 6 | * Copyright (c) 2004 Kailang Yang <kailang@realtek.com.tw> |
| 7 | * PeiSen Hou <pshou@realtek.com.tw> |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 8 | * Takashi Iwai <tiwai@suse.de> |
Jonathan Woithe | 7cf51e48 | 2006-02-09 12:01:26 +0100 | [diff] [blame] | 9 | * Jonathan Woithe <jwoithe@physics.adelaide.edu.au> |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 10 | * |
| 11 | * This driver is free software; you can redistribute it and/or modify |
| 12 | * it under the terms of the GNU General Public License as published by |
| 13 | * the Free Software Foundation; either version 2 of the License, or |
| 14 | * (at your option) any later version. |
| 15 | * |
| 16 | * This driver is distributed in the hope that it will be useful, |
| 17 | * but WITHOUT ANY WARRANTY; without even the implied warranty of |
| 18 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
| 19 | * GNU General Public License for more details. |
| 20 | * |
| 21 | * You should have received a copy of the GNU General Public License |
| 22 | * along with this program; if not, write to the Free Software |
| 23 | * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA |
| 24 | */ |
| 25 | |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 26 | #include <linux/init.h> |
| 27 | #include <linux/delay.h> |
| 28 | #include <linux/slab.h> |
| 29 | #include <linux/pci.h> |
| 30 | #include <sound/core.h> |
| 31 | #include "hda_codec.h" |
| 32 | #include "hda_local.h" |
Harvey Harrison | 3c9a320 | 2008-02-29 11:59:26 +0100 | [diff] [blame] | 33 | #include "hda_patch.h" |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 34 | |
Kailang Yang | ccc656c | 2006-10-17 12:32:26 +0200 | [diff] [blame] | 35 | #define ALC880_FRONT_EVENT 0x01 |
| 36 | #define ALC880_DCVOL_EVENT 0x02 |
| 37 | #define ALC880_HP_EVENT 0x04 |
| 38 | #define ALC880_MIC_EVENT 0x08 |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 39 | |
| 40 | /* ALC880 board config type */ |
| 41 | enum { |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 42 | ALC880_3ST, |
| 43 | ALC880_3ST_DIG, |
| 44 | ALC880_5ST, |
| 45 | ALC880_5ST_DIG, |
| 46 | ALC880_W810, |
Takashi Iwai | dfc0ff6 | 2005-05-12 14:31:49 +0200 | [diff] [blame] | 47 | ALC880_Z71V, |
Takashi Iwai | b6482d4 | 2005-06-27 15:32:43 +0200 | [diff] [blame] | 48 | ALC880_6ST, |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 49 | ALC880_6ST_DIG, |
| 50 | ALC880_F1734, |
| 51 | ALC880_ASUS, |
| 52 | ALC880_ASUS_DIG, |
| 53 | ALC880_ASUS_W1V, |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 54 | ALC880_ASUS_DIG2, |
Tobin Davis | 2cf9f0f | 2007-02-07 16:04:25 +0100 | [diff] [blame] | 55 | ALC880_FUJITSU, |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 56 | ALC880_UNIWILL_DIG, |
Kailang Yang | ccc656c | 2006-10-17 12:32:26 +0200 | [diff] [blame] | 57 | ALC880_UNIWILL, |
| 58 | ALC880_UNIWILL_P53, |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 59 | ALC880_CLEVO, |
| 60 | ALC880_TCL_S700, |
Takashi Iwai | ae6b813 | 2006-03-03 16:47:17 +0100 | [diff] [blame] | 61 | ALC880_LG, |
Takashi Iwai | d681518 | 2006-03-23 16:06:23 +0100 | [diff] [blame] | 62 | ALC880_LG_LW, |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 63 | #ifdef CONFIG_SND_DEBUG |
| 64 | ALC880_TEST, |
| 65 | #endif |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 66 | ALC880_AUTO, |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 67 | ALC880_MODEL_LAST /* last tag */ |
| 68 | }; |
| 69 | |
| 70 | /* ALC260 models */ |
| 71 | enum { |
| 72 | ALC260_BASIC, |
| 73 | ALC260_HP, |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 74 | ALC260_HP_3013, |
| 75 | ALC260_FUJITSU_S702X, |
Jonathan Woithe | 0bfc90e | 2006-02-28 11:45:11 +0100 | [diff] [blame] | 76 | ALC260_ACER, |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 77 | ALC260_WILL, |
| 78 | ALC260_REPLACER_672V, |
Jonathan Woithe | 7cf51e48 | 2006-02-09 12:01:26 +0100 | [diff] [blame] | 79 | #ifdef CONFIG_SND_DEBUG |
| 80 | ALC260_TEST, |
| 81 | #endif |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 82 | ALC260_AUTO, |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 83 | ALC260_MODEL_LAST /* last tag */ |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 84 | }; |
| 85 | |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 86 | /* ALC262 models */ |
| 87 | enum { |
| 88 | ALC262_BASIC, |
Kailang Yang | ccc656c | 2006-10-17 12:32:26 +0200 | [diff] [blame] | 89 | ALC262_HIPPO, |
| 90 | ALC262_HIPPO_1, |
Takashi Iwai | 834be88 | 2006-03-01 14:16:17 +0100 | [diff] [blame] | 91 | ALC262_FUJITSU, |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 92 | ALC262_HP_BPC, |
Kailang Yang | cd7509a | 2007-01-26 18:33:17 +0100 | [diff] [blame] | 93 | ALC262_HP_BPC_D7000_WL, |
| 94 | ALC262_HP_BPC_D7000_WF, |
Kailang Yang | 66d2a9d | 2007-11-14 12:06:21 +0100 | [diff] [blame] | 95 | ALC262_HP_TC_T5735, |
Kailang Yang | 8c42722 | 2008-01-10 13:03:59 +0100 | [diff] [blame] | 96 | ALC262_HP_RP5700, |
Takashi Iwai | 304dcaa | 2006-07-25 14:51:16 +0200 | [diff] [blame] | 97 | ALC262_BENQ_ED8, |
Kailang Yang | 272a527 | 2007-05-14 11:00:38 +0200 | [diff] [blame] | 98 | ALC262_SONY_ASSAMD, |
Kailang Yang | 83c3421 | 2007-07-05 11:43:05 +0200 | [diff] [blame] | 99 | ALC262_BENQ_T31, |
Tobin Davis | f651b50 | 2007-10-26 12:40:47 +0200 | [diff] [blame] | 100 | ALC262_ULTRA, |
Jiang zhe | 0e31daf | 2008-03-20 12:12:39 +0100 | [diff] [blame] | 101 | ALC262_LENOVO_3000, |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 102 | ALC262_AUTO, |
| 103 | ALC262_MODEL_LAST /* last tag */ |
| 104 | }; |
| 105 | |
Kailang Yang | a361d84 | 2007-06-05 12:30:55 +0200 | [diff] [blame] | 106 | /* ALC268 models */ |
| 107 | enum { |
| 108 | ALC268_3ST, |
Kailang Yang | d1a991a | 2007-08-15 16:21:59 +0200 | [diff] [blame] | 109 | ALC268_TOSHIBA, |
Takashi Iwai | d273809 | 2007-08-16 14:59:45 +0200 | [diff] [blame] | 110 | ALC268_ACER, |
Takashi Iwai | 3866f0b | 2008-01-15 12:37:42 +0100 | [diff] [blame] | 111 | ALC268_DELL, |
Mirco Tischler | f12462c | 2008-02-04 12:33:59 +0100 | [diff] [blame] | 112 | ALC268_ZEPTO, |
Jonathan Woithe | 86c53bd | 2008-01-08 12:33:19 +0100 | [diff] [blame] | 113 | #ifdef CONFIG_SND_DEBUG |
| 114 | ALC268_TEST, |
| 115 | #endif |
Kailang Yang | a361d84 | 2007-06-05 12:30:55 +0200 | [diff] [blame] | 116 | ALC268_AUTO, |
| 117 | ALC268_MODEL_LAST /* last tag */ |
| 118 | }; |
| 119 | |
Kailang Yang | f6a9224 | 2007-12-13 16:52:54 +0100 | [diff] [blame] | 120 | /* ALC269 models */ |
| 121 | enum { |
| 122 | ALC269_BASIC, |
| 123 | ALC269_AUTO, |
| 124 | ALC269_MODEL_LAST /* last tag */ |
| 125 | }; |
| 126 | |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 127 | /* ALC861 models */ |
| 128 | enum { |
| 129 | ALC861_3ST, |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 130 | ALC660_3ST, |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 131 | ALC861_3ST_DIG, |
| 132 | ALC861_6ST_DIG, |
Takashi Iwai | 22309c3 | 2006-08-09 16:57:28 +0200 | [diff] [blame] | 133 | ALC861_UNIWILL_M31, |
Tobin Davis | a53d1ae | 2006-10-17 12:00:28 +0200 | [diff] [blame] | 134 | ALC861_TOSHIBA, |
Mariusz Domanski | 7cdbff9 | 2006-10-23 13:42:56 +0200 | [diff] [blame] | 135 | ALC861_ASUS, |
Takashi Iwai | 56bb0ca | 2006-11-22 11:52:52 +0100 | [diff] [blame] | 136 | ALC861_ASUS_LAPTOP, |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 137 | ALC861_AUTO, |
| 138 | ALC861_MODEL_LAST, |
| 139 | }; |
| 140 | |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 141 | /* ALC861-VD models */ |
| 142 | enum { |
| 143 | ALC660VD_3ST, |
Mike Crash | 6963f84 | 2007-06-25 12:12:51 +0200 | [diff] [blame] | 144 | ALC660VD_3ST_DIG, |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 145 | ALC861VD_3ST, |
| 146 | ALC861VD_3ST_DIG, |
| 147 | ALC861VD_6ST_DIG, |
Kailang Yang | bdd148a | 2007-05-08 15:19:08 +0200 | [diff] [blame] | 148 | ALC861VD_LENOVO, |
Kailang Yang | 272a527 | 2007-05-14 11:00:38 +0200 | [diff] [blame] | 149 | ALC861VD_DALLAS, |
Kailang Yang | d1a991a | 2007-08-15 16:21:59 +0200 | [diff] [blame] | 150 | ALC861VD_HP, |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 151 | ALC861VD_AUTO, |
| 152 | ALC861VD_MODEL_LAST, |
| 153 | }; |
| 154 | |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 155 | /* ALC662 models */ |
| 156 | enum { |
| 157 | ALC662_3ST_2ch_DIG, |
| 158 | ALC662_3ST_6ch_DIG, |
| 159 | ALC662_3ST_6ch, |
| 160 | ALC662_5ST_DIG, |
| 161 | ALC662_LENOVO_101E, |
Kailang Yang | 291702f | 2007-10-16 14:28:03 +0200 | [diff] [blame] | 162 | ALC662_ASUS_EEEPC_P701, |
Kailang Yang | 8c42722 | 2008-01-10 13:03:59 +0100 | [diff] [blame] | 163 | ALC662_ASUS_EEEPC_EP20, |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 164 | ALC662_AUTO, |
| 165 | ALC662_MODEL_LAST, |
| 166 | }; |
| 167 | |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 168 | /* ALC882 models */ |
| 169 | enum { |
| 170 | ALC882_3ST_DIG, |
| 171 | ALC882_6ST_DIG, |
Takashi Iwai | 4b146cb | 2006-07-28 14:42:36 +0200 | [diff] [blame] | 172 | ALC882_ARIMA, |
Kailang Yang | bdd148a | 2007-05-08 15:19:08 +0200 | [diff] [blame] | 173 | ALC882_W2JC, |
Kailang Yang | 272a527 | 2007-05-14 11:00:38 +0200 | [diff] [blame] | 174 | ALC882_TARGA, |
| 175 | ALC882_ASUS_A7J, |
Takashi Iwai | 914759b | 2007-09-06 14:52:04 +0200 | [diff] [blame] | 176 | ALC882_ASUS_A7M, |
Tobin Davis | 9102cd1 | 2006-12-15 10:02:12 +0100 | [diff] [blame] | 177 | ALC885_MACPRO, |
Takashi Iwai | 87350ad | 2007-08-16 18:19:38 +0200 | [diff] [blame] | 178 | ALC885_MBP3, |
Nicola Fagnani | c54728d | 2007-07-19 23:28:52 +0200 | [diff] [blame] | 179 | ALC885_IMAC24, |
Kailang Yang | 272a527 | 2007-05-14 11:00:38 +0200 | [diff] [blame] | 180 | ALC882_AUTO, |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 181 | ALC882_MODEL_LAST, |
| 182 | }; |
| 183 | |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 184 | /* ALC883 models */ |
| 185 | enum { |
| 186 | ALC883_3ST_2ch_DIG, |
| 187 | ALC883_3ST_6ch_DIG, |
| 188 | ALC883_3ST_6ch, |
| 189 | ALC883_6ST_DIG, |
Kailang Yang | ccc656c | 2006-10-17 12:32:26 +0200 | [diff] [blame] | 190 | ALC883_TARGA_DIG, |
| 191 | ALC883_TARGA_2ch_DIG, |
Vladimir Avdonin | bab282b9 | 2006-08-22 13:31:58 +0200 | [diff] [blame] | 192 | ALC883_ACER, |
Tobin Davis | 2880a86 | 2007-08-07 11:50:26 +0200 | [diff] [blame] | 193 | ALC883_ACER_ASPIRE, |
Tobin Davis | c07584c | 2006-10-13 12:32:16 +0200 | [diff] [blame] | 194 | ALC883_MEDION, |
Kailang Yang | 272a527 | 2007-05-14 11:00:38 +0200 | [diff] [blame] | 195 | ALC883_MEDION_MD2, |
Andrew L. Neporada | b373bde | 2006-11-07 11:37:08 +0100 | [diff] [blame] | 196 | ALC883_LAPTOP_EAPD, |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 197 | ALC883_LENOVO_101E_2ch, |
Kailang Yang | 272a527 | 2007-05-14 11:00:38 +0200 | [diff] [blame] | 198 | ALC883_LENOVO_NB0763, |
Kailang Yang | 189609a | 2007-08-20 11:31:23 +0200 | [diff] [blame] | 199 | ALC888_LENOVO_MS7195_DIG, |
| 200 | ALC883_HAIER_W66, |
Claudio Matsuoka | 4723c02 | 2007-07-13 14:36:19 +0200 | [diff] [blame] | 201 | ALC888_3ST_HP, |
Claudio Matsuoka | 5795b9e | 2008-01-13 11:58:27 +0100 | [diff] [blame] | 202 | ALC888_6ST_DELL, |
Andy Shevchenko | a8848bd | 2007-12-13 17:32:26 +0100 | [diff] [blame] | 203 | ALC883_MITAC, |
Jiang zhe | 368c7a9 | 2008-03-04 11:20:33 +0100 | [diff] [blame] | 204 | ALC883_CLEVO_M720R, |
Jiang zhe | fb97dc6 | 2008-03-06 11:07:11 +0100 | [diff] [blame] | 205 | ALC883_FUJITSU_PI2515, |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 206 | ALC883_AUTO, |
| 207 | ALC883_MODEL_LAST, |
| 208 | }; |
| 209 | |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 210 | /* for GPIO Poll */ |
| 211 | #define GPIO_MASK 0x03 |
| 212 | |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 213 | struct alc_spec { |
| 214 | /* codec parameterization */ |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 215 | struct snd_kcontrol_new *mixers[5]; /* mixer arrays */ |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 216 | unsigned int num_mixers; |
| 217 | |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 218 | const struct hda_verb *init_verbs[5]; /* initialization verbs |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 219 | * don't forget NULL |
| 220 | * termination! |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 221 | */ |
| 222 | unsigned int num_init_verbs; |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 223 | |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 224 | char *stream_name_analog; /* analog PCM stream */ |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 225 | struct hda_pcm_stream *stream_analog_playback; |
| 226 | struct hda_pcm_stream *stream_analog_capture; |
Takashi Iwai | 6330079 | 2008-01-24 15:31:36 +0100 | [diff] [blame] | 227 | struct hda_pcm_stream *stream_analog_alt_playback; |
| 228 | struct hda_pcm_stream *stream_analog_alt_capture; |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 229 | |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 230 | char *stream_name_digital; /* digital PCM stream */ |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 231 | struct hda_pcm_stream *stream_digital_playback; |
| 232 | struct hda_pcm_stream *stream_digital_capture; |
| 233 | |
| 234 | /* playback */ |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 235 | struct hda_multi_out multiout; /* playback set-up |
| 236 | * max_channels, dacs must be set |
| 237 | * dig_out_nid and hp_nid are optional |
| 238 | */ |
Takashi Iwai | 6330079 | 2008-01-24 15:31:36 +0100 | [diff] [blame] | 239 | hda_nid_t alt_dac_nid; |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 240 | |
| 241 | /* capture */ |
| 242 | unsigned int num_adc_nids; |
| 243 | hda_nid_t *adc_nids; |
Takashi Iwai | e140634 | 2008-02-11 18:32:32 +0100 | [diff] [blame] | 244 | hda_nid_t *capsrc_nids; |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 245 | hda_nid_t dig_in_nid; /* digital-in NID; optional */ |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 246 | |
| 247 | /* capture source */ |
Jonathan Woithe | a1e8d2d | 2006-03-28 12:47:09 +0200 | [diff] [blame] | 248 | unsigned int num_mux_defs; |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 249 | const struct hda_input_mux *input_mux; |
| 250 | unsigned int cur_mux[3]; |
| 251 | |
| 252 | /* channel model */ |
Takashi Iwai | d2a6d7d | 2005-11-17 11:06:29 +0100 | [diff] [blame] | 253 | const struct hda_channel_mode *channel_mode; |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 254 | int num_channel_mode; |
Takashi Iwai | 4e195a7 | 2006-07-28 14:47:34 +0200 | [diff] [blame] | 255 | int need_dac_fix; |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 256 | |
| 257 | /* PCM information */ |
Jonathan Woithe | 4c5186e | 2006-02-09 11:53:48 +0100 | [diff] [blame] | 258 | struct hda_pcm pcm_rec[3]; /* used in alc_build_pcms() */ |
Takashi Iwai | 41e41f1 | 2005-06-08 14:48:49 +0200 | [diff] [blame] | 259 | |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 260 | /* dynamic controls, init_verbs and input_mux */ |
| 261 | struct auto_pin_cfg autocfg; |
| 262 | unsigned int num_kctl_alloc, num_kctl_used; |
Takashi Iwai | c8b6bf9 | 2005-11-17 14:57:47 +0100 | [diff] [blame] | 263 | struct snd_kcontrol_new *kctl_alloc; |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 264 | struct hda_input_mux private_imux; |
Takashi Iwai | 41923e4 | 2007-10-22 17:20:10 +0200 | [diff] [blame] | 265 | hda_nid_t private_dac_nids[AUTO_CFG_MAX_OUTS]; |
Takashi Iwai | 834be88 | 2006-03-01 14:16:17 +0100 | [diff] [blame] | 266 | |
Takashi Iwai | ae6b813 | 2006-03-03 16:47:17 +0100 | [diff] [blame] | 267 | /* hooks */ |
| 268 | void (*init_hook)(struct hda_codec *codec); |
| 269 | void (*unsol_event)(struct hda_codec *codec, unsigned int res); |
| 270 | |
Takashi Iwai | 834be88 | 2006-03-01 14:16:17 +0100 | [diff] [blame] | 271 | /* for pin sensing */ |
| 272 | unsigned int sense_updated: 1; |
| 273 | unsigned int jack_present: 1; |
Takashi Iwai | bec15c3 | 2008-01-28 18:16:30 +0100 | [diff] [blame] | 274 | unsigned int master_sw: 1; |
Takashi Iwai | cb53c62 | 2007-08-10 17:21:45 +0200 | [diff] [blame] | 275 | |
Takashi Iwai | 2134ea4 | 2008-01-10 16:53:55 +0100 | [diff] [blame] | 276 | /* for virtual master */ |
| 277 | hda_nid_t vmaster_nid; |
Takashi Iwai | cb53c62 | 2007-08-10 17:21:45 +0200 | [diff] [blame] | 278 | #ifdef CONFIG_SND_HDA_POWER_SAVE |
| 279 | struct hda_loopback_check loopback; |
| 280 | #endif |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 281 | }; |
| 282 | |
| 283 | /* |
| 284 | * configuration template - to be copied to the spec instance |
| 285 | */ |
| 286 | struct alc_config_preset { |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 287 | struct snd_kcontrol_new *mixers[5]; /* should be identical size |
| 288 | * with spec |
| 289 | */ |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 290 | const struct hda_verb *init_verbs[5]; |
| 291 | unsigned int num_dacs; |
| 292 | hda_nid_t *dac_nids; |
| 293 | hda_nid_t dig_out_nid; /* optional */ |
| 294 | hda_nid_t hp_nid; /* optional */ |
| 295 | unsigned int num_adc_nids; |
| 296 | hda_nid_t *adc_nids; |
Takashi Iwai | e140634 | 2008-02-11 18:32:32 +0100 | [diff] [blame] | 297 | hda_nid_t *capsrc_nids; |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 298 | hda_nid_t dig_in_nid; |
| 299 | unsigned int num_channel_mode; |
| 300 | const struct hda_channel_mode *channel_mode; |
Takashi Iwai | 4e195a7 | 2006-07-28 14:47:34 +0200 | [diff] [blame] | 301 | int need_dac_fix; |
Jonathan Woithe | a1e8d2d | 2006-03-28 12:47:09 +0200 | [diff] [blame] | 302 | unsigned int num_mux_defs; |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 303 | const struct hda_input_mux *input_mux; |
Takashi Iwai | ae6b813 | 2006-03-03 16:47:17 +0100 | [diff] [blame] | 304 | void (*unsol_event)(struct hda_codec *, unsigned int); |
| 305 | void (*init_hook)(struct hda_codec *); |
Takashi Iwai | cb53c62 | 2007-08-10 17:21:45 +0200 | [diff] [blame] | 306 | #ifdef CONFIG_SND_HDA_POWER_SAVE |
| 307 | struct hda_amp_list *loopbacks; |
| 308 | #endif |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 309 | }; |
| 310 | |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 311 | |
| 312 | /* |
| 313 | * input MUX handling |
| 314 | */ |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 315 | static int alc_mux_enum_info(struct snd_kcontrol *kcontrol, |
| 316 | struct snd_ctl_elem_info *uinfo) |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 317 | { |
| 318 | struct hda_codec *codec = snd_kcontrol_chip(kcontrol); |
| 319 | struct alc_spec *spec = codec->spec; |
Jonathan Woithe | a1e8d2d | 2006-03-28 12:47:09 +0200 | [diff] [blame] | 320 | unsigned int mux_idx = snd_ctl_get_ioffidx(kcontrol, &uinfo->id); |
| 321 | if (mux_idx >= spec->num_mux_defs) |
| 322 | mux_idx = 0; |
| 323 | return snd_hda_input_mux_info(&spec->input_mux[mux_idx], uinfo); |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 324 | } |
| 325 | |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 326 | static int alc_mux_enum_get(struct snd_kcontrol *kcontrol, |
| 327 | struct snd_ctl_elem_value *ucontrol) |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 328 | { |
| 329 | struct hda_codec *codec = snd_kcontrol_chip(kcontrol); |
| 330 | struct alc_spec *spec = codec->spec; |
| 331 | unsigned int adc_idx = snd_ctl_get_ioffidx(kcontrol, &ucontrol->id); |
| 332 | |
| 333 | ucontrol->value.enumerated.item[0] = spec->cur_mux[adc_idx]; |
| 334 | return 0; |
| 335 | } |
| 336 | |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 337 | static int alc_mux_enum_put(struct snd_kcontrol *kcontrol, |
| 338 | struct snd_ctl_elem_value *ucontrol) |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 339 | { |
| 340 | struct hda_codec *codec = snd_kcontrol_chip(kcontrol); |
| 341 | struct alc_spec *spec = codec->spec; |
| 342 | unsigned int adc_idx = snd_ctl_get_ioffidx(kcontrol, &ucontrol->id); |
Jonathan Woithe | a1e8d2d | 2006-03-28 12:47:09 +0200 | [diff] [blame] | 343 | unsigned int mux_idx = adc_idx >= spec->num_mux_defs ? 0 : adc_idx; |
Takashi Iwai | e140634 | 2008-02-11 18:32:32 +0100 | [diff] [blame] | 344 | hda_nid_t nid = spec->capsrc_nids ? |
| 345 | spec->capsrc_nids[adc_idx] : spec->adc_nids[adc_idx]; |
Jonathan Woithe | a1e8d2d | 2006-03-28 12:47:09 +0200 | [diff] [blame] | 346 | return snd_hda_input_mux_put(codec, &spec->input_mux[mux_idx], ucontrol, |
Takashi Iwai | e140634 | 2008-02-11 18:32:32 +0100 | [diff] [blame] | 347 | nid, &spec->cur_mux[adc_idx]); |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 348 | } |
| 349 | |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 350 | |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 351 | /* |
| 352 | * channel mode setting |
| 353 | */ |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 354 | static int alc_ch_mode_info(struct snd_kcontrol *kcontrol, |
| 355 | struct snd_ctl_elem_info *uinfo) |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 356 | { |
| 357 | struct hda_codec *codec = snd_kcontrol_chip(kcontrol); |
| 358 | struct alc_spec *spec = codec->spec; |
Takashi Iwai | d2a6d7d | 2005-11-17 11:06:29 +0100 | [diff] [blame] | 359 | return snd_hda_ch_mode_info(codec, uinfo, spec->channel_mode, |
| 360 | spec->num_channel_mode); |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 361 | } |
| 362 | |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 363 | static int alc_ch_mode_get(struct snd_kcontrol *kcontrol, |
| 364 | struct snd_ctl_elem_value *ucontrol) |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 365 | { |
| 366 | struct hda_codec *codec = snd_kcontrol_chip(kcontrol); |
| 367 | struct alc_spec *spec = codec->spec; |
Takashi Iwai | d2a6d7d | 2005-11-17 11:06:29 +0100 | [diff] [blame] | 368 | return snd_hda_ch_mode_get(codec, ucontrol, spec->channel_mode, |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 369 | spec->num_channel_mode, |
| 370 | spec->multiout.max_channels); |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 371 | } |
| 372 | |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 373 | static int alc_ch_mode_put(struct snd_kcontrol *kcontrol, |
| 374 | struct snd_ctl_elem_value *ucontrol) |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 375 | { |
| 376 | struct hda_codec *codec = snd_kcontrol_chip(kcontrol); |
| 377 | struct alc_spec *spec = codec->spec; |
Takashi Iwai | 4e195a7 | 2006-07-28 14:47:34 +0200 | [diff] [blame] | 378 | int err = snd_hda_ch_mode_put(codec, ucontrol, spec->channel_mode, |
| 379 | spec->num_channel_mode, |
| 380 | &spec->multiout.max_channels); |
Takashi Iwai | bd2033f | 2006-10-10 19:49:31 +0200 | [diff] [blame] | 381 | if (err >= 0 && spec->need_dac_fix) |
Takashi Iwai | 4e195a7 | 2006-07-28 14:47:34 +0200 | [diff] [blame] | 382 | spec->multiout.num_dacs = spec->multiout.max_channels / 2; |
| 383 | return err; |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 384 | } |
| 385 | |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 386 | /* |
Jonathan Woithe | 4c5186e | 2006-02-09 11:53:48 +0100 | [diff] [blame] | 387 | * Control the mode of pin widget settings via the mixer. "pc" is used |
| 388 | * instead of "%" to avoid consequences of accidently treating the % as |
| 389 | * being part of a format specifier. Maximum allowed length of a value is |
| 390 | * 63 characters plus NULL terminator. |
Jonathan Woithe | 7cf51e48 | 2006-02-09 12:01:26 +0100 | [diff] [blame] | 391 | * |
| 392 | * Note: some retasking pin complexes seem to ignore requests for input |
| 393 | * states other than HiZ (eg: PIN_VREFxx) and revert to HiZ if any of these |
| 394 | * are requested. Therefore order this list so that this behaviour will not |
| 395 | * cause problems when mixer clients move through the enum sequentially. |
Jonathan Woithe | a1e8d2d | 2006-03-28 12:47:09 +0200 | [diff] [blame] | 396 | * NIDs 0x0f and 0x10 have been observed to have this behaviour as of |
| 397 | * March 2006. |
Jonathan Woithe | a9430dd | 2005-09-16 19:12:48 +0200 | [diff] [blame] | 398 | */ |
Jonathan Woithe | 4c5186e | 2006-02-09 11:53:48 +0100 | [diff] [blame] | 399 | static char *alc_pin_mode_names[] = { |
Jonathan Woithe | 7cf51e48 | 2006-02-09 12:01:26 +0100 | [diff] [blame] | 400 | "Mic 50pc bias", "Mic 80pc bias", |
| 401 | "Line in", "Line out", "Headphone out", |
Jonathan Woithe | 4c5186e | 2006-02-09 11:53:48 +0100 | [diff] [blame] | 402 | }; |
| 403 | static unsigned char alc_pin_mode_values[] = { |
Jonathan Woithe | 7cf51e48 | 2006-02-09 12:01:26 +0100 | [diff] [blame] | 404 | PIN_VREF50, PIN_VREF80, PIN_IN, PIN_OUT, PIN_HP, |
Jonathan Woithe | 4c5186e | 2006-02-09 11:53:48 +0100 | [diff] [blame] | 405 | }; |
| 406 | /* The control can present all 5 options, or it can limit the options based |
Jonathan Woithe | a1e8d2d | 2006-03-28 12:47:09 +0200 | [diff] [blame] | 407 | * in the pin being assumed to be exclusively an input or an output pin. In |
| 408 | * addition, "input" pins may or may not process the mic bias option |
| 409 | * depending on actual widget capability (NIDs 0x0f and 0x10 don't seem to |
| 410 | * accept requests for bias as of chip versions up to March 2006) and/or |
| 411 | * wiring in the computer. |
Jonathan Woithe | 4c5186e | 2006-02-09 11:53:48 +0100 | [diff] [blame] | 412 | */ |
Jonathan Woithe | a1e8d2d | 2006-03-28 12:47:09 +0200 | [diff] [blame] | 413 | #define ALC_PIN_DIR_IN 0x00 |
| 414 | #define ALC_PIN_DIR_OUT 0x01 |
| 415 | #define ALC_PIN_DIR_INOUT 0x02 |
| 416 | #define ALC_PIN_DIR_IN_NOMICBIAS 0x03 |
| 417 | #define ALC_PIN_DIR_INOUT_NOMICBIAS 0x04 |
Jonathan Woithe | 4c5186e | 2006-02-09 11:53:48 +0100 | [diff] [blame] | 418 | |
Jonathan Woithe | a1e8d2d | 2006-03-28 12:47:09 +0200 | [diff] [blame] | 419 | /* Info about the pin modes supported by the different pin direction modes. |
Jonathan Woithe | 4c5186e | 2006-02-09 11:53:48 +0100 | [diff] [blame] | 420 | * For each direction the minimum and maximum values are given. |
| 421 | */ |
Jonathan Woithe | a1e8d2d | 2006-03-28 12:47:09 +0200 | [diff] [blame] | 422 | static signed char alc_pin_mode_dir_info[5][2] = { |
Jonathan Woithe | 4c5186e | 2006-02-09 11:53:48 +0100 | [diff] [blame] | 423 | { 0, 2 }, /* ALC_PIN_DIR_IN */ |
| 424 | { 3, 4 }, /* ALC_PIN_DIR_OUT */ |
| 425 | { 0, 4 }, /* ALC_PIN_DIR_INOUT */ |
Jonathan Woithe | a1e8d2d | 2006-03-28 12:47:09 +0200 | [diff] [blame] | 426 | { 2, 2 }, /* ALC_PIN_DIR_IN_NOMICBIAS */ |
| 427 | { 2, 4 }, /* ALC_PIN_DIR_INOUT_NOMICBIAS */ |
Jonathan Woithe | 4c5186e | 2006-02-09 11:53:48 +0100 | [diff] [blame] | 428 | }; |
| 429 | #define alc_pin_mode_min(_dir) (alc_pin_mode_dir_info[_dir][0]) |
| 430 | #define alc_pin_mode_max(_dir) (alc_pin_mode_dir_info[_dir][1]) |
| 431 | #define alc_pin_mode_n_items(_dir) \ |
| 432 | (alc_pin_mode_max(_dir)-alc_pin_mode_min(_dir)+1) |
| 433 | |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 434 | static int alc_pin_mode_info(struct snd_kcontrol *kcontrol, |
| 435 | struct snd_ctl_elem_info *uinfo) |
Jonathan Woithe | a9430dd | 2005-09-16 19:12:48 +0200 | [diff] [blame] | 436 | { |
Jonathan Woithe | 4c5186e | 2006-02-09 11:53:48 +0100 | [diff] [blame] | 437 | unsigned int item_num = uinfo->value.enumerated.item; |
| 438 | unsigned char dir = (kcontrol->private_value >> 16) & 0xff; |
| 439 | |
| 440 | uinfo->type = SNDRV_CTL_ELEM_TYPE_ENUMERATED; |
Jonathan Woithe | a9430dd | 2005-09-16 19:12:48 +0200 | [diff] [blame] | 441 | uinfo->count = 1; |
Jonathan Woithe | 4c5186e | 2006-02-09 11:53:48 +0100 | [diff] [blame] | 442 | uinfo->value.enumerated.items = alc_pin_mode_n_items(dir); |
| 443 | |
| 444 | if (item_num<alc_pin_mode_min(dir) || item_num>alc_pin_mode_max(dir)) |
| 445 | item_num = alc_pin_mode_min(dir); |
| 446 | strcpy(uinfo->value.enumerated.name, alc_pin_mode_names[item_num]); |
Jonathan Woithe | a9430dd | 2005-09-16 19:12:48 +0200 | [diff] [blame] | 447 | return 0; |
| 448 | } |
| 449 | |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 450 | static int alc_pin_mode_get(struct snd_kcontrol *kcontrol, |
| 451 | struct snd_ctl_elem_value *ucontrol) |
Jonathan Woithe | a9430dd | 2005-09-16 19:12:48 +0200 | [diff] [blame] | 452 | { |
Jonathan Woithe | 4c5186e | 2006-02-09 11:53:48 +0100 | [diff] [blame] | 453 | unsigned int i; |
Jonathan Woithe | a9430dd | 2005-09-16 19:12:48 +0200 | [diff] [blame] | 454 | struct hda_codec *codec = snd_kcontrol_chip(kcontrol); |
| 455 | hda_nid_t nid = kcontrol->private_value & 0xffff; |
Jonathan Woithe | 4c5186e | 2006-02-09 11:53:48 +0100 | [diff] [blame] | 456 | unsigned char dir = (kcontrol->private_value >> 16) & 0xff; |
Jonathan Woithe | a9430dd | 2005-09-16 19:12:48 +0200 | [diff] [blame] | 457 | long *valp = ucontrol->value.integer.value; |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 458 | unsigned int pinctl = snd_hda_codec_read(codec, nid, 0, |
| 459 | AC_VERB_GET_PIN_WIDGET_CONTROL, |
| 460 | 0x00); |
Jonathan Woithe | a9430dd | 2005-09-16 19:12:48 +0200 | [diff] [blame] | 461 | |
Jonathan Woithe | 4c5186e | 2006-02-09 11:53:48 +0100 | [diff] [blame] | 462 | /* Find enumerated value for current pinctl setting */ |
| 463 | i = alc_pin_mode_min(dir); |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 464 | while (alc_pin_mode_values[i] != pinctl && i <= alc_pin_mode_max(dir)) |
Jonathan Woithe | 4c5186e | 2006-02-09 11:53:48 +0100 | [diff] [blame] | 465 | i++; |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 466 | *valp = i <= alc_pin_mode_max(dir) ? i: alc_pin_mode_min(dir); |
Jonathan Woithe | 4c5186e | 2006-02-09 11:53:48 +0100 | [diff] [blame] | 467 | return 0; |
| 468 | } |
| 469 | |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 470 | static int alc_pin_mode_put(struct snd_kcontrol *kcontrol, |
| 471 | struct snd_ctl_elem_value *ucontrol) |
Jonathan Woithe | 4c5186e | 2006-02-09 11:53:48 +0100 | [diff] [blame] | 472 | { |
| 473 | signed int change; |
| 474 | struct hda_codec *codec = snd_kcontrol_chip(kcontrol); |
| 475 | hda_nid_t nid = kcontrol->private_value & 0xffff; |
| 476 | unsigned char dir = (kcontrol->private_value >> 16) & 0xff; |
| 477 | long val = *ucontrol->value.integer.value; |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 478 | unsigned int pinctl = snd_hda_codec_read(codec, nid, 0, |
| 479 | AC_VERB_GET_PIN_WIDGET_CONTROL, |
| 480 | 0x00); |
Jonathan Woithe | 4c5186e | 2006-02-09 11:53:48 +0100 | [diff] [blame] | 481 | |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 482 | if (val < alc_pin_mode_min(dir) || val > alc_pin_mode_max(dir)) |
Jonathan Woithe | 4c5186e | 2006-02-09 11:53:48 +0100 | [diff] [blame] | 483 | val = alc_pin_mode_min(dir); |
| 484 | |
| 485 | change = pinctl != alc_pin_mode_values[val]; |
Jonathan Woithe | cdcd926 | 2006-02-28 11:36:42 +0100 | [diff] [blame] | 486 | if (change) { |
| 487 | /* Set pin mode to that requested */ |
Takashi Iwai | 82beb8f | 2007-08-10 17:09:26 +0200 | [diff] [blame] | 488 | snd_hda_codec_write_cache(codec, nid, 0, |
| 489 | AC_VERB_SET_PIN_WIDGET_CONTROL, |
| 490 | alc_pin_mode_values[val]); |
Jonathan Woithe | cdcd926 | 2006-02-28 11:36:42 +0100 | [diff] [blame] | 491 | |
| 492 | /* Also enable the retasking pin's input/output as required |
| 493 | * for the requested pin mode. Enum values of 2 or less are |
| 494 | * input modes. |
| 495 | * |
| 496 | * Dynamically switching the input/output buffers probably |
Jonathan Woithe | a1e8d2d | 2006-03-28 12:47:09 +0200 | [diff] [blame] | 497 | * reduces noise slightly (particularly on input) so we'll |
| 498 | * do it. However, having both input and output buffers |
| 499 | * enabled simultaneously doesn't seem to be problematic if |
| 500 | * this turns out to be necessary in the future. |
Jonathan Woithe | cdcd926 | 2006-02-28 11:36:42 +0100 | [diff] [blame] | 501 | */ |
| 502 | if (val <= 2) { |
Takashi Iwai | 47fd830 | 2007-08-10 17:11:07 +0200 | [diff] [blame] | 503 | snd_hda_codec_amp_stereo(codec, nid, HDA_OUTPUT, 0, |
| 504 | HDA_AMP_MUTE, HDA_AMP_MUTE); |
| 505 | snd_hda_codec_amp_stereo(codec, nid, HDA_INPUT, 0, |
| 506 | HDA_AMP_MUTE, 0); |
Jonathan Woithe | cdcd926 | 2006-02-28 11:36:42 +0100 | [diff] [blame] | 507 | } else { |
Takashi Iwai | 47fd830 | 2007-08-10 17:11:07 +0200 | [diff] [blame] | 508 | snd_hda_codec_amp_stereo(codec, nid, HDA_INPUT, 0, |
| 509 | HDA_AMP_MUTE, HDA_AMP_MUTE); |
| 510 | snd_hda_codec_amp_stereo(codec, nid, HDA_OUTPUT, 0, |
| 511 | HDA_AMP_MUTE, 0); |
Jonathan Woithe | cdcd926 | 2006-02-28 11:36:42 +0100 | [diff] [blame] | 512 | } |
| 513 | } |
Jonathan Woithe | a9430dd | 2005-09-16 19:12:48 +0200 | [diff] [blame] | 514 | return change; |
| 515 | } |
| 516 | |
Jonathan Woithe | 4c5186e | 2006-02-09 11:53:48 +0100 | [diff] [blame] | 517 | #define ALC_PIN_MODE(xname, nid, dir) \ |
Jonathan Woithe | a9430dd | 2005-09-16 19:12:48 +0200 | [diff] [blame] | 518 | { .iface = SNDRV_CTL_ELEM_IFACE_MIXER, .name = xname, .index = 0, \ |
Jonathan Woithe | 4c5186e | 2006-02-09 11:53:48 +0100 | [diff] [blame] | 519 | .info = alc_pin_mode_info, \ |
| 520 | .get = alc_pin_mode_get, \ |
| 521 | .put = alc_pin_mode_put, \ |
| 522 | .private_value = nid | (dir<<16) } |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 523 | |
Jonathan Woithe | 5c8f858 | 2006-02-28 11:43:27 +0100 | [diff] [blame] | 524 | /* A switch control for ALC260 GPIO pins. Multiple GPIOs can be ganged |
| 525 | * together using a mask with more than one bit set. This control is |
| 526 | * currently used only by the ALC260 test model. At this stage they are not |
| 527 | * needed for any "production" models. |
| 528 | */ |
| 529 | #ifdef CONFIG_SND_DEBUG |
Takashi Iwai | a5ce889 | 2007-07-23 15:42:26 +0200 | [diff] [blame] | 530 | #define alc_gpio_data_info snd_ctl_boolean_mono_info |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 531 | |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 532 | static int alc_gpio_data_get(struct snd_kcontrol *kcontrol, |
| 533 | struct snd_ctl_elem_value *ucontrol) |
Jonathan Woithe | 5c8f858 | 2006-02-28 11:43:27 +0100 | [diff] [blame] | 534 | { |
| 535 | struct hda_codec *codec = snd_kcontrol_chip(kcontrol); |
| 536 | hda_nid_t nid = kcontrol->private_value & 0xffff; |
| 537 | unsigned char mask = (kcontrol->private_value >> 16) & 0xff; |
| 538 | long *valp = ucontrol->value.integer.value; |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 539 | unsigned int val = snd_hda_codec_read(codec, nid, 0, |
| 540 | AC_VERB_GET_GPIO_DATA, 0x00); |
Jonathan Woithe | 5c8f858 | 2006-02-28 11:43:27 +0100 | [diff] [blame] | 541 | |
| 542 | *valp = (val & mask) != 0; |
| 543 | return 0; |
| 544 | } |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 545 | static int alc_gpio_data_put(struct snd_kcontrol *kcontrol, |
| 546 | struct snd_ctl_elem_value *ucontrol) |
Jonathan Woithe | 5c8f858 | 2006-02-28 11:43:27 +0100 | [diff] [blame] | 547 | { |
| 548 | signed int change; |
| 549 | struct hda_codec *codec = snd_kcontrol_chip(kcontrol); |
| 550 | hda_nid_t nid = kcontrol->private_value & 0xffff; |
| 551 | unsigned char mask = (kcontrol->private_value >> 16) & 0xff; |
| 552 | long val = *ucontrol->value.integer.value; |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 553 | unsigned int gpio_data = snd_hda_codec_read(codec, nid, 0, |
| 554 | AC_VERB_GET_GPIO_DATA, |
| 555 | 0x00); |
Jonathan Woithe | 5c8f858 | 2006-02-28 11:43:27 +0100 | [diff] [blame] | 556 | |
| 557 | /* Set/unset the masked GPIO bit(s) as needed */ |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 558 | change = (val == 0 ? 0 : mask) != (gpio_data & mask); |
| 559 | if (val == 0) |
Jonathan Woithe | 5c8f858 | 2006-02-28 11:43:27 +0100 | [diff] [blame] | 560 | gpio_data &= ~mask; |
| 561 | else |
| 562 | gpio_data |= mask; |
Takashi Iwai | 82beb8f | 2007-08-10 17:09:26 +0200 | [diff] [blame] | 563 | snd_hda_codec_write_cache(codec, nid, 0, |
| 564 | AC_VERB_SET_GPIO_DATA, gpio_data); |
Jonathan Woithe | 5c8f858 | 2006-02-28 11:43:27 +0100 | [diff] [blame] | 565 | |
| 566 | return change; |
| 567 | } |
| 568 | #define ALC_GPIO_DATA_SWITCH(xname, nid, mask) \ |
| 569 | { .iface = SNDRV_CTL_ELEM_IFACE_MIXER, .name = xname, .index = 0, \ |
| 570 | .info = alc_gpio_data_info, \ |
| 571 | .get = alc_gpio_data_get, \ |
| 572 | .put = alc_gpio_data_put, \ |
| 573 | .private_value = nid | (mask<<16) } |
| 574 | #endif /* CONFIG_SND_DEBUG */ |
| 575 | |
Jonathan Woithe | 92621f1 | 2006-02-28 11:47:47 +0100 | [diff] [blame] | 576 | /* A switch control to allow the enabling of the digital IO pins on the |
| 577 | * ALC260. This is incredibly simplistic; the intention of this control is |
| 578 | * to provide something in the test model allowing digital outputs to be |
| 579 | * identified if present. If models are found which can utilise these |
| 580 | * outputs a more complete mixer control can be devised for those models if |
| 581 | * necessary. |
| 582 | */ |
| 583 | #ifdef CONFIG_SND_DEBUG |
Takashi Iwai | a5ce889 | 2007-07-23 15:42:26 +0200 | [diff] [blame] | 584 | #define alc_spdif_ctrl_info snd_ctl_boolean_mono_info |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 585 | |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 586 | static int alc_spdif_ctrl_get(struct snd_kcontrol *kcontrol, |
| 587 | struct snd_ctl_elem_value *ucontrol) |
Jonathan Woithe | 92621f1 | 2006-02-28 11:47:47 +0100 | [diff] [blame] | 588 | { |
| 589 | struct hda_codec *codec = snd_kcontrol_chip(kcontrol); |
| 590 | hda_nid_t nid = kcontrol->private_value & 0xffff; |
| 591 | unsigned char mask = (kcontrol->private_value >> 16) & 0xff; |
| 592 | long *valp = ucontrol->value.integer.value; |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 593 | unsigned int val = snd_hda_codec_read(codec, nid, 0, |
Andrew Paprocki | 3982d17 | 2007-12-19 12:13:44 +0100 | [diff] [blame] | 594 | AC_VERB_GET_DIGI_CONVERT_1, 0x00); |
Jonathan Woithe | 92621f1 | 2006-02-28 11:47:47 +0100 | [diff] [blame] | 595 | |
| 596 | *valp = (val & mask) != 0; |
| 597 | return 0; |
| 598 | } |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 599 | static int alc_spdif_ctrl_put(struct snd_kcontrol *kcontrol, |
| 600 | struct snd_ctl_elem_value *ucontrol) |
Jonathan Woithe | 92621f1 | 2006-02-28 11:47:47 +0100 | [diff] [blame] | 601 | { |
| 602 | signed int change; |
| 603 | struct hda_codec *codec = snd_kcontrol_chip(kcontrol); |
| 604 | hda_nid_t nid = kcontrol->private_value & 0xffff; |
| 605 | unsigned char mask = (kcontrol->private_value >> 16) & 0xff; |
| 606 | long val = *ucontrol->value.integer.value; |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 607 | unsigned int ctrl_data = snd_hda_codec_read(codec, nid, 0, |
Andrew Paprocki | 3982d17 | 2007-12-19 12:13:44 +0100 | [diff] [blame] | 608 | AC_VERB_GET_DIGI_CONVERT_1, |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 609 | 0x00); |
Jonathan Woithe | 92621f1 | 2006-02-28 11:47:47 +0100 | [diff] [blame] | 610 | |
| 611 | /* Set/unset the masked control bit(s) as needed */ |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 612 | change = (val == 0 ? 0 : mask) != (ctrl_data & mask); |
Jonathan Woithe | 92621f1 | 2006-02-28 11:47:47 +0100 | [diff] [blame] | 613 | if (val==0) |
| 614 | ctrl_data &= ~mask; |
| 615 | else |
| 616 | ctrl_data |= mask; |
Takashi Iwai | 82beb8f | 2007-08-10 17:09:26 +0200 | [diff] [blame] | 617 | snd_hda_codec_write_cache(codec, nid, 0, AC_VERB_SET_DIGI_CONVERT_1, |
| 618 | ctrl_data); |
Jonathan Woithe | 92621f1 | 2006-02-28 11:47:47 +0100 | [diff] [blame] | 619 | |
| 620 | return change; |
| 621 | } |
| 622 | #define ALC_SPDIF_CTRL_SWITCH(xname, nid, mask) \ |
| 623 | { .iface = SNDRV_CTL_ELEM_IFACE_MIXER, .name = xname, .index = 0, \ |
| 624 | .info = alc_spdif_ctrl_info, \ |
| 625 | .get = alc_spdif_ctrl_get, \ |
| 626 | .put = alc_spdif_ctrl_put, \ |
| 627 | .private_value = nid | (mask<<16) } |
| 628 | #endif /* CONFIG_SND_DEBUG */ |
| 629 | |
Jonathan Woithe | f8225f6 | 2008-01-08 12:16:54 +0100 | [diff] [blame] | 630 | /* A switch control to allow the enabling EAPD digital outputs on the ALC26x. |
| 631 | * Again, this is only used in the ALC26x test models to help identify when |
| 632 | * the EAPD line must be asserted for features to work. |
| 633 | */ |
| 634 | #ifdef CONFIG_SND_DEBUG |
| 635 | #define alc_eapd_ctrl_info snd_ctl_boolean_mono_info |
| 636 | |
| 637 | static int alc_eapd_ctrl_get(struct snd_kcontrol *kcontrol, |
| 638 | struct snd_ctl_elem_value *ucontrol) |
| 639 | { |
| 640 | struct hda_codec *codec = snd_kcontrol_chip(kcontrol); |
| 641 | hda_nid_t nid = kcontrol->private_value & 0xffff; |
| 642 | unsigned char mask = (kcontrol->private_value >> 16) & 0xff; |
| 643 | long *valp = ucontrol->value.integer.value; |
| 644 | unsigned int val = snd_hda_codec_read(codec, nid, 0, |
| 645 | AC_VERB_GET_EAPD_BTLENABLE, 0x00); |
| 646 | |
| 647 | *valp = (val & mask) != 0; |
| 648 | return 0; |
| 649 | } |
| 650 | |
| 651 | static int alc_eapd_ctrl_put(struct snd_kcontrol *kcontrol, |
| 652 | struct snd_ctl_elem_value *ucontrol) |
| 653 | { |
| 654 | int change; |
| 655 | struct hda_codec *codec = snd_kcontrol_chip(kcontrol); |
| 656 | hda_nid_t nid = kcontrol->private_value & 0xffff; |
| 657 | unsigned char mask = (kcontrol->private_value >> 16) & 0xff; |
| 658 | long val = *ucontrol->value.integer.value; |
| 659 | unsigned int ctrl_data = snd_hda_codec_read(codec, nid, 0, |
| 660 | AC_VERB_GET_EAPD_BTLENABLE, |
| 661 | 0x00); |
| 662 | |
| 663 | /* Set/unset the masked control bit(s) as needed */ |
| 664 | change = (!val ? 0 : mask) != (ctrl_data & mask); |
| 665 | if (!val) |
| 666 | ctrl_data &= ~mask; |
| 667 | else |
| 668 | ctrl_data |= mask; |
| 669 | snd_hda_codec_write_cache(codec, nid, 0, AC_VERB_SET_EAPD_BTLENABLE, |
| 670 | ctrl_data); |
| 671 | |
| 672 | return change; |
| 673 | } |
| 674 | |
| 675 | #define ALC_EAPD_CTRL_SWITCH(xname, nid, mask) \ |
| 676 | { .iface = SNDRV_CTL_ELEM_IFACE_MIXER, .name = xname, .index = 0, \ |
| 677 | .info = alc_eapd_ctrl_info, \ |
| 678 | .get = alc_eapd_ctrl_get, \ |
| 679 | .put = alc_eapd_ctrl_put, \ |
| 680 | .private_value = nid | (mask<<16) } |
| 681 | #endif /* CONFIG_SND_DEBUG */ |
| 682 | |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 683 | /* |
| 684 | * set up from the preset table |
| 685 | */ |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 686 | static void setup_preset(struct alc_spec *spec, |
| 687 | const struct alc_config_preset *preset) |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 688 | { |
| 689 | int i; |
| 690 | |
| 691 | for (i = 0; i < ARRAY_SIZE(preset->mixers) && preset->mixers[i]; i++) |
| 692 | spec->mixers[spec->num_mixers++] = preset->mixers[i]; |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 693 | for (i = 0; i < ARRAY_SIZE(preset->init_verbs) && preset->init_verbs[i]; |
| 694 | i++) |
| 695 | spec->init_verbs[spec->num_init_verbs++] = |
| 696 | preset->init_verbs[i]; |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 697 | |
| 698 | spec->channel_mode = preset->channel_mode; |
| 699 | spec->num_channel_mode = preset->num_channel_mode; |
Takashi Iwai | 4e195a7 | 2006-07-28 14:47:34 +0200 | [diff] [blame] | 700 | spec->need_dac_fix = preset->need_dac_fix; |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 701 | |
| 702 | spec->multiout.max_channels = spec->channel_mode[0].channels; |
| 703 | |
| 704 | spec->multiout.num_dacs = preset->num_dacs; |
| 705 | spec->multiout.dac_nids = preset->dac_nids; |
| 706 | spec->multiout.dig_out_nid = preset->dig_out_nid; |
| 707 | spec->multiout.hp_nid = preset->hp_nid; |
| 708 | |
Jonathan Woithe | a1e8d2d | 2006-03-28 12:47:09 +0200 | [diff] [blame] | 709 | spec->num_mux_defs = preset->num_mux_defs; |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 710 | if (!spec->num_mux_defs) |
Jonathan Woithe | a1e8d2d | 2006-03-28 12:47:09 +0200 | [diff] [blame] | 711 | spec->num_mux_defs = 1; |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 712 | spec->input_mux = preset->input_mux; |
| 713 | |
| 714 | spec->num_adc_nids = preset->num_adc_nids; |
| 715 | spec->adc_nids = preset->adc_nids; |
Takashi Iwai | e140634 | 2008-02-11 18:32:32 +0100 | [diff] [blame] | 716 | spec->capsrc_nids = preset->capsrc_nids; |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 717 | spec->dig_in_nid = preset->dig_in_nid; |
Takashi Iwai | ae6b813 | 2006-03-03 16:47:17 +0100 | [diff] [blame] | 718 | |
| 719 | spec->unsol_event = preset->unsol_event; |
| 720 | spec->init_hook = preset->init_hook; |
Takashi Iwai | cb53c62 | 2007-08-10 17:21:45 +0200 | [diff] [blame] | 721 | #ifdef CONFIG_SND_HDA_POWER_SAVE |
| 722 | spec->loopback.amplist = preset->loopbacks; |
| 723 | #endif |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 724 | } |
| 725 | |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 726 | /* Enable GPIO mask and set output */ |
| 727 | static struct hda_verb alc_gpio1_init_verbs[] = { |
| 728 | {0x01, AC_VERB_SET_GPIO_MASK, 0x01}, |
| 729 | {0x01, AC_VERB_SET_GPIO_DIRECTION, 0x01}, |
| 730 | {0x01, AC_VERB_SET_GPIO_DATA, 0x01}, |
| 731 | { } |
| 732 | }; |
| 733 | |
| 734 | static struct hda_verb alc_gpio2_init_verbs[] = { |
| 735 | {0x01, AC_VERB_SET_GPIO_MASK, 0x02}, |
| 736 | {0x01, AC_VERB_SET_GPIO_DIRECTION, 0x02}, |
| 737 | {0x01, AC_VERB_SET_GPIO_DATA, 0x02}, |
| 738 | { } |
| 739 | }; |
| 740 | |
Kailang Yang | bdd148a | 2007-05-08 15:19:08 +0200 | [diff] [blame] | 741 | static struct hda_verb alc_gpio3_init_verbs[] = { |
| 742 | {0x01, AC_VERB_SET_GPIO_MASK, 0x03}, |
| 743 | {0x01, AC_VERB_SET_GPIO_DIRECTION, 0x03}, |
| 744 | {0x01, AC_VERB_SET_GPIO_DATA, 0x03}, |
| 745 | { } |
| 746 | }; |
| 747 | |
Kailang Yang | c9b5800 | 2007-10-16 14:30:01 +0200 | [diff] [blame] | 748 | static void alc_sku_automute(struct hda_codec *codec) |
| 749 | { |
| 750 | struct alc_spec *spec = codec->spec; |
Kailang Yang | c9b5800 | 2007-10-16 14:30:01 +0200 | [diff] [blame] | 751 | unsigned int present; |
| 752 | unsigned int hp_nid = spec->autocfg.hp_pins[0]; |
| 753 | unsigned int sp_nid = spec->autocfg.speaker_pins[0]; |
| 754 | |
| 755 | /* need to execute and sync at first */ |
| 756 | snd_hda_codec_read(codec, hp_nid, 0, AC_VERB_SET_PIN_SENSE, 0); |
| 757 | present = snd_hda_codec_read(codec, hp_nid, 0, |
| 758 | AC_VERB_GET_PIN_SENSE, 0); |
| 759 | spec->jack_present = (present & 0x80000000) != 0; |
Takashi Iwai | f6c7e54 | 2008-02-12 18:32:23 +0100 | [diff] [blame] | 760 | snd_hda_codec_write(codec, sp_nid, 0, AC_VERB_SET_PIN_WIDGET_CONTROL, |
| 761 | spec->jack_present ? 0 : PIN_OUT); |
Kailang Yang | c9b5800 | 2007-10-16 14:30:01 +0200 | [diff] [blame] | 762 | } |
| 763 | |
| 764 | /* unsolicited event for HP jack sensing */ |
| 765 | static void alc_sku_unsol_event(struct hda_codec *codec, unsigned int res) |
| 766 | { |
| 767 | if (codec->vendor_id == 0x10ec0880) |
| 768 | res >>= 28; |
| 769 | else |
| 770 | res >>= 26; |
| 771 | if (res != ALC880_HP_EVENT) |
| 772 | return; |
| 773 | |
| 774 | alc_sku_automute(codec); |
| 775 | } |
| 776 | |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 777 | /* 32-bit subsystem ID for BIOS loading in HD Audio codec. |
| 778 | * 31 ~ 16 : Manufacture ID |
| 779 | * 15 ~ 8 : SKU ID |
| 780 | * 7 ~ 0 : Assembly ID |
| 781 | * port-A --> pin 39/41, port-E --> pin 14/15, port-D --> pin 35/36 |
| 782 | */ |
| 783 | static void alc_subsystem_id(struct hda_codec *codec, |
| 784 | unsigned int porta, unsigned int porte, |
| 785 | unsigned int portd) |
| 786 | { |
Kailang Yang | c9b5800 | 2007-10-16 14:30:01 +0200 | [diff] [blame] | 787 | unsigned int ass, tmp, i; |
| 788 | unsigned nid; |
| 789 | struct alc_spec *spec = codec->spec; |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 790 | |
Kailang Yang | c9b5800 | 2007-10-16 14:30:01 +0200 | [diff] [blame] | 791 | ass = codec->subsystem_id & 0xffff; |
| 792 | if ((ass != codec->bus->pci->subsystem_device) && (ass & 1)) |
| 793 | goto do_sku; |
| 794 | |
| 795 | /* |
| 796 | * 31~30 : port conetcivity |
| 797 | * 29~21 : reserve |
| 798 | * 20 : PCBEEP input |
| 799 | * 19~16 : Check sum (15:1) |
| 800 | * 15~1 : Custom |
| 801 | * 0 : override |
| 802 | */ |
| 803 | nid = 0x1d; |
| 804 | if (codec->vendor_id == 0x10ec0260) |
| 805 | nid = 0x17; |
| 806 | ass = snd_hda_codec_read(codec, nid, 0, |
| 807 | AC_VERB_GET_CONFIG_DEFAULT, 0); |
| 808 | if (!(ass & 1) && !(ass & 0x100000)) |
| 809 | return; |
| 810 | if ((ass >> 30) != 1) /* no physical connection */ |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 811 | return; |
| 812 | |
Kailang Yang | c9b5800 | 2007-10-16 14:30:01 +0200 | [diff] [blame] | 813 | /* check sum */ |
| 814 | tmp = 0; |
| 815 | for (i = 1; i < 16; i++) { |
Kailang Yang | 8c42722 | 2008-01-10 13:03:59 +0100 | [diff] [blame] | 816 | if ((ass >> i) & 1) |
Kailang Yang | c9b5800 | 2007-10-16 14:30:01 +0200 | [diff] [blame] | 817 | tmp++; |
| 818 | } |
| 819 | if (((ass >> 16) & 0xf) != tmp) |
| 820 | return; |
| 821 | do_sku: |
| 822 | /* |
| 823 | * 0 : override |
| 824 | * 1 : Swap Jack |
| 825 | * 2 : 0 --> Desktop, 1 --> Laptop |
| 826 | * 3~5 : External Amplifier control |
| 827 | * 7~6 : Reserved |
| 828 | */ |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 829 | tmp = (ass & 0x38) >> 3; /* external Amp control */ |
| 830 | switch (tmp) { |
| 831 | case 1: |
| 832 | snd_hda_sequence_write(codec, alc_gpio1_init_verbs); |
| 833 | break; |
| 834 | case 3: |
| 835 | snd_hda_sequence_write(codec, alc_gpio2_init_verbs); |
| 836 | break; |
Kailang Yang | bdd148a | 2007-05-08 15:19:08 +0200 | [diff] [blame] | 837 | case 7: |
| 838 | snd_hda_sequence_write(codec, alc_gpio3_init_verbs); |
| 839 | break; |
Kailang Yang | c9b5800 | 2007-10-16 14:30:01 +0200 | [diff] [blame] | 840 | case 5: /* set EAPD output high */ |
Kailang Yang | bdd148a | 2007-05-08 15:19:08 +0200 | [diff] [blame] | 841 | switch (codec->vendor_id) { |
Kailang Yang | c9b5800 | 2007-10-16 14:30:01 +0200 | [diff] [blame] | 842 | case 0x10ec0260: |
| 843 | snd_hda_codec_write(codec, 0x0f, 0, |
| 844 | AC_VERB_SET_EAPD_BTLENABLE, 2); |
| 845 | snd_hda_codec_write(codec, 0x10, 0, |
| 846 | AC_VERB_SET_EAPD_BTLENABLE, 2); |
| 847 | break; |
| 848 | case 0x10ec0262: |
Kailang Yang | bdd148a | 2007-05-08 15:19:08 +0200 | [diff] [blame] | 849 | case 0x10ec0267: |
| 850 | case 0x10ec0268: |
Kailang Yang | c9b5800 | 2007-10-16 14:30:01 +0200 | [diff] [blame] | 851 | case 0x10ec0269: |
| 852 | case 0x10ec0862: |
| 853 | case 0x10ec0662: |
Kailang Yang | bdd148a | 2007-05-08 15:19:08 +0200 | [diff] [blame] | 854 | snd_hda_codec_write(codec, 0x14, 0, |
| 855 | AC_VERB_SET_EAPD_BTLENABLE, 2); |
| 856 | snd_hda_codec_write(codec, 0x15, 0, |
| 857 | AC_VERB_SET_EAPD_BTLENABLE, 2); |
Kailang Yang | c9b5800 | 2007-10-16 14:30:01 +0200 | [diff] [blame] | 858 | break; |
Kailang Yang | bdd148a | 2007-05-08 15:19:08 +0200 | [diff] [blame] | 859 | } |
Kailang Yang | c9b5800 | 2007-10-16 14:30:01 +0200 | [diff] [blame] | 860 | switch (codec->vendor_id) { |
| 861 | case 0x10ec0260: |
| 862 | snd_hda_codec_write(codec, 0x1a, 0, |
| 863 | AC_VERB_SET_COEF_INDEX, 7); |
| 864 | tmp = snd_hda_codec_read(codec, 0x1a, 0, |
| 865 | AC_VERB_GET_PROC_COEF, 0); |
| 866 | snd_hda_codec_write(codec, 0x1a, 0, |
| 867 | AC_VERB_SET_COEF_INDEX, 7); |
| 868 | snd_hda_codec_write(codec, 0x1a, 0, |
| 869 | AC_VERB_SET_PROC_COEF, |
| 870 | tmp | 0x2010); |
| 871 | break; |
| 872 | case 0x10ec0262: |
| 873 | case 0x10ec0880: |
| 874 | case 0x10ec0882: |
| 875 | case 0x10ec0883: |
| 876 | case 0x10ec0885: |
| 877 | case 0x10ec0888: |
| 878 | snd_hda_codec_write(codec, 0x20, 0, |
| 879 | AC_VERB_SET_COEF_INDEX, 7); |
| 880 | tmp = snd_hda_codec_read(codec, 0x20, 0, |
| 881 | AC_VERB_GET_PROC_COEF, 0); |
| 882 | snd_hda_codec_write(codec, 0x20, 0, |
| 883 | AC_VERB_SET_COEF_INDEX, 7); |
| 884 | snd_hda_codec_write(codec, 0x20, 0, |
| 885 | AC_VERB_SET_PROC_COEF, |
| 886 | tmp | 0x2010); |
| 887 | break; |
| 888 | case 0x10ec0267: |
| 889 | case 0x10ec0268: |
| 890 | snd_hda_codec_write(codec, 0x20, 0, |
| 891 | AC_VERB_SET_COEF_INDEX, 7); |
| 892 | tmp = snd_hda_codec_read(codec, 0x20, 0, |
| 893 | AC_VERB_GET_PROC_COEF, 0); |
| 894 | snd_hda_codec_write(codec, 0x20, 0, |
| 895 | AC_VERB_SET_COEF_INDEX, 7); |
| 896 | snd_hda_codec_write(codec, 0x20, 0, |
| 897 | AC_VERB_SET_PROC_COEF, |
| 898 | tmp | 0x3000); |
| 899 | break; |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 900 | } |
Kailang Yang | c9b5800 | 2007-10-16 14:30:01 +0200 | [diff] [blame] | 901 | default: |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 902 | break; |
| 903 | } |
Kailang Yang | c9b5800 | 2007-10-16 14:30:01 +0200 | [diff] [blame] | 904 | |
Kailang Yang | 8c42722 | 2008-01-10 13:03:59 +0100 | [diff] [blame] | 905 | /* is laptop or Desktop and enable the function "Mute internal speaker |
Kailang Yang | c9b5800 | 2007-10-16 14:30:01 +0200 | [diff] [blame] | 906 | * when the external headphone out jack is plugged" |
| 907 | */ |
Kailang Yang | 8c42722 | 2008-01-10 13:03:59 +0100 | [diff] [blame] | 908 | if (!(ass & 0x8000)) |
Kailang Yang | c9b5800 | 2007-10-16 14:30:01 +0200 | [diff] [blame] | 909 | return; |
| 910 | /* |
| 911 | * 10~8 : Jack location |
| 912 | * 12~11: Headphone out -> 00: PortA, 01: PortE, 02: PortD, 03: Resvered |
| 913 | * 14~13: Resvered |
| 914 | * 15 : 1 --> enable the function "Mute internal speaker |
| 915 | * when the external headphone out jack is plugged" |
| 916 | */ |
| 917 | if (!spec->autocfg.speaker_pins[0]) { |
Kailang Yang | 8c42722 | 2008-01-10 13:03:59 +0100 | [diff] [blame] | 918 | if (spec->autocfg.line_out_pins[0]) |
Kailang Yang | c9b5800 | 2007-10-16 14:30:01 +0200 | [diff] [blame] | 919 | spec->autocfg.speaker_pins[0] = |
Kailang Yang | 8c42722 | 2008-01-10 13:03:59 +0100 | [diff] [blame] | 920 | spec->autocfg.line_out_pins[0]; |
Kailang Yang | c9b5800 | 2007-10-16 14:30:01 +0200 | [diff] [blame] | 921 | else |
| 922 | return; |
| 923 | } |
| 924 | |
| 925 | if (!spec->autocfg.hp_pins[0]) { |
| 926 | tmp = (ass >> 11) & 0x3; /* HP to chassis */ |
| 927 | if (tmp == 0) |
| 928 | spec->autocfg.hp_pins[0] = porta; |
| 929 | else if (tmp == 1) |
| 930 | spec->autocfg.hp_pins[0] = porte; |
| 931 | else if (tmp == 2) |
| 932 | spec->autocfg.hp_pins[0] = portd; |
| 933 | else |
| 934 | return; |
| 935 | } |
| 936 | |
| 937 | snd_hda_codec_write(codec, spec->autocfg.hp_pins[0], 0, |
| 938 | AC_VERB_SET_UNSOLICITED_ENABLE, |
| 939 | AC_USRSP_EN | ALC880_HP_EVENT); |
| 940 | spec->unsol_event = alc_sku_unsol_event; |
| 941 | spec->init_hook = alc_sku_automute; |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 942 | } |
| 943 | |
Takashi Iwai | 41e41f1 | 2005-06-08 14:48:49 +0200 | [diff] [blame] | 944 | /* |
Takashi Iwai | f95474e | 2007-07-10 00:47:43 +0200 | [diff] [blame] | 945 | * Fix-up pin default configurations |
| 946 | */ |
| 947 | |
| 948 | struct alc_pincfg { |
| 949 | hda_nid_t nid; |
| 950 | u32 val; |
| 951 | }; |
| 952 | |
| 953 | static void alc_fix_pincfg(struct hda_codec *codec, |
| 954 | const struct snd_pci_quirk *quirk, |
| 955 | const struct alc_pincfg **pinfix) |
| 956 | { |
| 957 | const struct alc_pincfg *cfg; |
| 958 | |
| 959 | quirk = snd_pci_quirk_lookup(codec->bus->pci, quirk); |
| 960 | if (!quirk) |
| 961 | return; |
| 962 | |
| 963 | cfg = pinfix[quirk->value]; |
| 964 | for (; cfg->nid; cfg++) { |
| 965 | int i; |
| 966 | u32 val = cfg->val; |
| 967 | for (i = 0; i < 4; i++) { |
| 968 | snd_hda_codec_write(codec, cfg->nid, 0, |
| 969 | AC_VERB_SET_CONFIG_DEFAULT_BYTES_0 + i, |
| 970 | val & 0xff); |
| 971 | val >>= 8; |
| 972 | } |
| 973 | } |
| 974 | } |
| 975 | |
| 976 | /* |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 977 | * ALC880 3-stack model |
| 978 | * |
| 979 | * DAC: Front = 0x02 (0x0c), Surr = 0x05 (0x0f), CLFE = 0x04 (0x0e) |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 980 | * Pin assignment: Front = 0x14, Line-In/Surr = 0x1a, Mic/CLFE = 0x18, |
| 981 | * F-Mic = 0x1b, HP = 0x19 |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 982 | */ |
| 983 | |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 984 | static hda_nid_t alc880_dac_nids[4] = { |
| 985 | /* front, rear, clfe, rear_surr */ |
| 986 | 0x02, 0x05, 0x04, 0x03 |
| 987 | }; |
| 988 | |
| 989 | static hda_nid_t alc880_adc_nids[3] = { |
| 990 | /* ADC0-2 */ |
| 991 | 0x07, 0x08, 0x09, |
| 992 | }; |
| 993 | |
| 994 | /* The datasheet says the node 0x07 is connected from inputs, |
| 995 | * but it shows zero connection in the real implementation on some devices. |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 996 | * Note: this is a 915GAV bug, fixed on 915GLV |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 997 | */ |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 998 | static hda_nid_t alc880_adc_nids_alt[2] = { |
| 999 | /* ADC1-2 */ |
| 1000 | 0x08, 0x09, |
| 1001 | }; |
| 1002 | |
| 1003 | #define ALC880_DIGOUT_NID 0x06 |
| 1004 | #define ALC880_DIGIN_NID 0x0a |
| 1005 | |
| 1006 | static struct hda_input_mux alc880_capture_source = { |
| 1007 | .num_items = 4, |
| 1008 | .items = { |
| 1009 | { "Mic", 0x0 }, |
| 1010 | { "Front Mic", 0x3 }, |
| 1011 | { "Line", 0x2 }, |
| 1012 | { "CD", 0x4 }, |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 1013 | }, |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 1014 | }; |
| 1015 | |
| 1016 | /* channel source setting (2/6 channel selection for 3-stack) */ |
| 1017 | /* 2ch mode */ |
| 1018 | static struct hda_verb alc880_threestack_ch2_init[] = { |
| 1019 | /* set line-in to input, mute it */ |
| 1020 | { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN }, |
| 1021 | { 0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE }, |
| 1022 | /* set mic-in to input vref 80%, mute it */ |
| 1023 | { 0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80 }, |
| 1024 | { 0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE }, |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 1025 | { } /* end */ |
| 1026 | }; |
| 1027 | |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 1028 | /* 6ch mode */ |
| 1029 | static struct hda_verb alc880_threestack_ch6_init[] = { |
| 1030 | /* set line-in to output, unmute it */ |
| 1031 | { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, |
| 1032 | { 0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE }, |
| 1033 | /* set mic-in to output, unmute it */ |
| 1034 | { 0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, |
| 1035 | { 0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE }, |
| 1036 | { } /* end */ |
| 1037 | }; |
| 1038 | |
Takashi Iwai | d2a6d7d | 2005-11-17 11:06:29 +0100 | [diff] [blame] | 1039 | static struct hda_channel_mode alc880_threestack_modes[2] = { |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 1040 | { 2, alc880_threestack_ch2_init }, |
| 1041 | { 6, alc880_threestack_ch6_init }, |
| 1042 | }; |
| 1043 | |
Takashi Iwai | c8b6bf9 | 2005-11-17 14:57:47 +0100 | [diff] [blame] | 1044 | static struct snd_kcontrol_new alc880_three_stack_mixer[] = { |
Takashi Iwai | 05acb86 | 2005-06-10 19:50:25 +0200 | [diff] [blame] | 1045 | HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT), |
Takashi Iwai | 985be54 | 2005-11-02 18:26:49 +0100 | [diff] [blame] | 1046 | HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT), |
Takashi Iwai | 05acb86 | 2005-06-10 19:50:25 +0200 | [diff] [blame] | 1047 | HDA_CODEC_VOLUME("Surround Playback Volume", 0x0f, 0x0, HDA_OUTPUT), |
Takashi Iwai | 985be54 | 2005-11-02 18:26:49 +0100 | [diff] [blame] | 1048 | HDA_BIND_MUTE("Surround Playback Switch", 0x0f, 2, HDA_INPUT), |
Takashi Iwai | 05acb86 | 2005-06-10 19:50:25 +0200 | [diff] [blame] | 1049 | HDA_CODEC_VOLUME_MONO("Center Playback Volume", 0x0e, 1, 0x0, HDA_OUTPUT), |
| 1050 | HDA_CODEC_VOLUME_MONO("LFE Playback Volume", 0x0e, 2, 0x0, HDA_OUTPUT), |
Takashi Iwai | 985be54 | 2005-11-02 18:26:49 +0100 | [diff] [blame] | 1051 | HDA_BIND_MUTE_MONO("Center Playback Switch", 0x0e, 1, 2, HDA_INPUT), |
| 1052 | HDA_BIND_MUTE_MONO("LFE Playback Switch", 0x0e, 2, 2, HDA_INPUT), |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 1053 | HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT), |
| 1054 | HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT), |
| 1055 | HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT), |
| 1056 | HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT), |
| 1057 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), |
| 1058 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), |
| 1059 | HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x3, HDA_INPUT), |
| 1060 | HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x3, HDA_INPUT), |
| 1061 | HDA_CODEC_VOLUME("PC Speaker Playback Volume", 0x0b, 0x05, HDA_INPUT), |
| 1062 | HDA_CODEC_MUTE("PC Speaker Playback Switch", 0x0b, 0x05, HDA_INPUT), |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 1063 | HDA_CODEC_MUTE("Headphone Playback Switch", 0x19, 0x0, HDA_OUTPUT), |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 1064 | { |
| 1065 | .iface = SNDRV_CTL_ELEM_IFACE_MIXER, |
| 1066 | .name = "Channel Mode", |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 1067 | .info = alc_ch_mode_info, |
| 1068 | .get = alc_ch_mode_get, |
| 1069 | .put = alc_ch_mode_put, |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 1070 | }, |
| 1071 | { } /* end */ |
| 1072 | }; |
| 1073 | |
| 1074 | /* capture mixer elements */ |
Takashi Iwai | c8b6bf9 | 2005-11-17 14:57:47 +0100 | [diff] [blame] | 1075 | static struct snd_kcontrol_new alc880_capture_mixer[] = { |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 1076 | HDA_CODEC_VOLUME("Capture Volume", 0x07, 0x0, HDA_INPUT), |
| 1077 | HDA_CODEC_MUTE("Capture Switch", 0x07, 0x0, HDA_INPUT), |
| 1078 | HDA_CODEC_VOLUME_IDX("Capture Volume", 1, 0x08, 0x0, HDA_INPUT), |
| 1079 | HDA_CODEC_MUTE_IDX("Capture Switch", 1, 0x08, 0x0, HDA_INPUT), |
| 1080 | HDA_CODEC_VOLUME_IDX("Capture Volume", 2, 0x09, 0x0, HDA_INPUT), |
| 1081 | HDA_CODEC_MUTE_IDX("Capture Switch", 2, 0x09, 0x0, HDA_INPUT), |
| 1082 | { |
| 1083 | .iface = SNDRV_CTL_ELEM_IFACE_MIXER, |
| 1084 | /* The multiple "Capture Source" controls confuse alsamixer |
| 1085 | * So call somewhat different.. |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 1086 | */ |
| 1087 | /* .name = "Capture Source", */ |
| 1088 | .name = "Input Source", |
| 1089 | .count = 3, |
| 1090 | .info = alc_mux_enum_info, |
| 1091 | .get = alc_mux_enum_get, |
| 1092 | .put = alc_mux_enum_put, |
| 1093 | }, |
| 1094 | { } /* end */ |
| 1095 | }; |
| 1096 | |
| 1097 | /* capture mixer elements (in case NID 0x07 not available) */ |
Takashi Iwai | c8b6bf9 | 2005-11-17 14:57:47 +0100 | [diff] [blame] | 1098 | static struct snd_kcontrol_new alc880_capture_alt_mixer[] = { |
Takashi Iwai | 71fe7b8 | 2005-05-25 18:11:40 +0200 | [diff] [blame] | 1099 | HDA_CODEC_VOLUME("Capture Volume", 0x08, 0x0, HDA_INPUT), |
| 1100 | HDA_CODEC_MUTE("Capture Switch", 0x08, 0x0, HDA_INPUT), |
| 1101 | HDA_CODEC_VOLUME_IDX("Capture Volume", 1, 0x09, 0x0, HDA_INPUT), |
| 1102 | HDA_CODEC_MUTE_IDX("Capture Switch", 1, 0x09, 0x0, HDA_INPUT), |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 1103 | { |
| 1104 | .iface = SNDRV_CTL_ELEM_IFACE_MIXER, |
| 1105 | /* The multiple "Capture Source" controls confuse alsamixer |
| 1106 | * So call somewhat different.. |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 1107 | */ |
| 1108 | /* .name = "Capture Source", */ |
| 1109 | .name = "Input Source", |
| 1110 | .count = 2, |
| 1111 | .info = alc_mux_enum_info, |
| 1112 | .get = alc_mux_enum_get, |
| 1113 | .put = alc_mux_enum_put, |
| 1114 | }, |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 1115 | { } /* end */ |
| 1116 | }; |
| 1117 | |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 1118 | |
| 1119 | |
| 1120 | /* |
| 1121 | * ALC880 5-stack model |
| 1122 | * |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 1123 | * DAC: Front = 0x02 (0x0c), Surr = 0x05 (0x0f), CLFE = 0x04 (0x0d), |
| 1124 | * Side = 0x02 (0xd) |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 1125 | * Pin assignment: Front = 0x14, Surr = 0x17, CLFE = 0x16 |
| 1126 | * Line-In/Side = 0x1a, Mic = 0x18, F-Mic = 0x1b, HP = 0x19 |
| 1127 | */ |
| 1128 | |
| 1129 | /* additional mixers to alc880_three_stack_mixer */ |
Takashi Iwai | c8b6bf9 | 2005-11-17 14:57:47 +0100 | [diff] [blame] | 1130 | static struct snd_kcontrol_new alc880_five_stack_mixer[] = { |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 1131 | HDA_CODEC_VOLUME("Side Playback Volume", 0x0d, 0x0, HDA_OUTPUT), |
Takashi Iwai | 985be54 | 2005-11-02 18:26:49 +0100 | [diff] [blame] | 1132 | HDA_BIND_MUTE("Side Playback Switch", 0x0d, 2, HDA_INPUT), |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 1133 | { } /* end */ |
| 1134 | }; |
| 1135 | |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 1136 | /* channel source setting (6/8 channel selection for 5-stack) */ |
| 1137 | /* 6ch mode */ |
| 1138 | static struct hda_verb alc880_fivestack_ch6_init[] = { |
| 1139 | /* set line-in to input, mute it */ |
| 1140 | { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN }, |
| 1141 | { 0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE }, |
Takashi Iwai | dfc0ff6 | 2005-05-12 14:31:49 +0200 | [diff] [blame] | 1142 | { } /* end */ |
| 1143 | }; |
| 1144 | |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 1145 | /* 8ch mode */ |
| 1146 | static struct hda_verb alc880_fivestack_ch8_init[] = { |
| 1147 | /* set line-in to output, unmute it */ |
| 1148 | { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, |
| 1149 | { 0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE }, |
| 1150 | { } /* end */ |
| 1151 | }; |
| 1152 | |
Takashi Iwai | d2a6d7d | 2005-11-17 11:06:29 +0100 | [diff] [blame] | 1153 | static struct hda_channel_mode alc880_fivestack_modes[2] = { |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 1154 | { 6, alc880_fivestack_ch6_init }, |
| 1155 | { 8, alc880_fivestack_ch8_init }, |
| 1156 | }; |
| 1157 | |
| 1158 | |
| 1159 | /* |
| 1160 | * ALC880 6-stack model |
| 1161 | * |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 1162 | * DAC: Front = 0x02 (0x0c), Surr = 0x03 (0x0d), CLFE = 0x04 (0x0e), |
| 1163 | * Side = 0x05 (0x0f) |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 1164 | * Pin assignment: Front = 0x14, Surr = 0x15, CLFE = 0x16, Side = 0x17, |
| 1165 | * Mic = 0x18, F-Mic = 0x19, Line = 0x1a, HP = 0x1b |
| 1166 | */ |
| 1167 | |
| 1168 | static hda_nid_t alc880_6st_dac_nids[4] = { |
| 1169 | /* front, rear, clfe, rear_surr */ |
| 1170 | 0x02, 0x03, 0x04, 0x05 |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 1171 | }; |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 1172 | |
| 1173 | static struct hda_input_mux alc880_6stack_capture_source = { |
| 1174 | .num_items = 4, |
| 1175 | .items = { |
| 1176 | { "Mic", 0x0 }, |
| 1177 | { "Front Mic", 0x1 }, |
| 1178 | { "Line", 0x2 }, |
| 1179 | { "CD", 0x4 }, |
| 1180 | }, |
| 1181 | }; |
| 1182 | |
| 1183 | /* fixed 8-channels */ |
Takashi Iwai | d2a6d7d | 2005-11-17 11:06:29 +0100 | [diff] [blame] | 1184 | static struct hda_channel_mode alc880_sixstack_modes[1] = { |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 1185 | { 8, NULL }, |
| 1186 | }; |
| 1187 | |
Takashi Iwai | c8b6bf9 | 2005-11-17 14:57:47 +0100 | [diff] [blame] | 1188 | static struct snd_kcontrol_new alc880_six_stack_mixer[] = { |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 1189 | HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT), |
Takashi Iwai | 985be54 | 2005-11-02 18:26:49 +0100 | [diff] [blame] | 1190 | HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT), |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 1191 | HDA_CODEC_VOLUME("Surround Playback Volume", 0x0d, 0x0, HDA_OUTPUT), |
Takashi Iwai | 985be54 | 2005-11-02 18:26:49 +0100 | [diff] [blame] | 1192 | HDA_BIND_MUTE("Surround Playback Switch", 0x0d, 2, HDA_INPUT), |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 1193 | HDA_CODEC_VOLUME_MONO("Center Playback Volume", 0x0e, 1, 0x0, HDA_OUTPUT), |
| 1194 | HDA_CODEC_VOLUME_MONO("LFE Playback Volume", 0x0e, 2, 0x0, HDA_OUTPUT), |
Takashi Iwai | 985be54 | 2005-11-02 18:26:49 +0100 | [diff] [blame] | 1195 | HDA_BIND_MUTE_MONO("Center Playback Switch", 0x0e, 1, 2, HDA_INPUT), |
| 1196 | HDA_BIND_MUTE_MONO("LFE Playback Switch", 0x0e, 2, 2, HDA_INPUT), |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 1197 | HDA_CODEC_VOLUME("Side Playback Volume", 0x0f, 0x0, HDA_OUTPUT), |
Takashi Iwai | 985be54 | 2005-11-02 18:26:49 +0100 | [diff] [blame] | 1198 | HDA_BIND_MUTE("Side Playback Switch", 0x0f, 2, HDA_INPUT), |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 1199 | HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT), |
| 1200 | HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT), |
| 1201 | HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT), |
| 1202 | HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT), |
| 1203 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), |
| 1204 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), |
| 1205 | HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x1, HDA_INPUT), |
| 1206 | HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x1, HDA_INPUT), |
| 1207 | HDA_CODEC_VOLUME("PC Speaker Playback Volume", 0x0b, 0x05, HDA_INPUT), |
| 1208 | HDA_CODEC_MUTE("PC Speaker Playback Switch", 0x0b, 0x05, HDA_INPUT), |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 1209 | { |
| 1210 | .iface = SNDRV_CTL_ELEM_IFACE_MIXER, |
| 1211 | .name = "Channel Mode", |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 1212 | .info = alc_ch_mode_info, |
| 1213 | .get = alc_ch_mode_get, |
| 1214 | .put = alc_ch_mode_put, |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 1215 | }, |
| 1216 | { } /* end */ |
| 1217 | }; |
| 1218 | |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 1219 | |
| 1220 | /* |
| 1221 | * ALC880 W810 model |
| 1222 | * |
| 1223 | * W810 has rear IO for: |
| 1224 | * Front (DAC 02) |
| 1225 | * Surround (DAC 03) |
| 1226 | * Center/LFE (DAC 04) |
| 1227 | * Digital out (06) |
| 1228 | * |
| 1229 | * The system also has a pair of internal speakers, and a headphone jack. |
| 1230 | * These are both connected to Line2 on the codec, hence to DAC 02. |
| 1231 | * |
| 1232 | * There is a variable resistor to control the speaker or headphone |
| 1233 | * volume. This is a hardware-only device without a software API. |
| 1234 | * |
| 1235 | * Plugging headphones in will disable the internal speakers. This is |
| 1236 | * implemented in hardware, not via the driver using jack sense. In |
| 1237 | * a similar fashion, plugging into the rear socket marked "front" will |
| 1238 | * disable both the speakers and headphones. |
| 1239 | * |
| 1240 | * For input, there's a microphone jack, and an "audio in" jack. |
| 1241 | * These may not do anything useful with this driver yet, because I |
| 1242 | * haven't setup any initialization verbs for these yet... |
| 1243 | */ |
| 1244 | |
| 1245 | static hda_nid_t alc880_w810_dac_nids[3] = { |
| 1246 | /* front, rear/surround, clfe */ |
| 1247 | 0x02, 0x03, 0x04 |
| 1248 | }; |
| 1249 | |
| 1250 | /* fixed 6 channels */ |
Takashi Iwai | d2a6d7d | 2005-11-17 11:06:29 +0100 | [diff] [blame] | 1251 | static struct hda_channel_mode alc880_w810_modes[1] = { |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 1252 | { 6, NULL } |
| 1253 | }; |
| 1254 | |
| 1255 | /* Pin assignment: Front = 0x14, Surr = 0x15, CLFE = 0x16, HP = 0x1b */ |
Takashi Iwai | c8b6bf9 | 2005-11-17 14:57:47 +0100 | [diff] [blame] | 1256 | static struct snd_kcontrol_new alc880_w810_base_mixer[] = { |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 1257 | HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT), |
Takashi Iwai | 985be54 | 2005-11-02 18:26:49 +0100 | [diff] [blame] | 1258 | HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT), |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 1259 | HDA_CODEC_VOLUME("Surround Playback Volume", 0x0d, 0x0, HDA_OUTPUT), |
Takashi Iwai | 985be54 | 2005-11-02 18:26:49 +0100 | [diff] [blame] | 1260 | HDA_BIND_MUTE("Surround Playback Switch", 0x0d, 2, HDA_INPUT), |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 1261 | HDA_CODEC_VOLUME_MONO("Center Playback Volume", 0x0e, 1, 0x0, HDA_OUTPUT), |
| 1262 | HDA_CODEC_VOLUME_MONO("LFE Playback Volume", 0x0e, 2, 0x0, HDA_OUTPUT), |
Takashi Iwai | 985be54 | 2005-11-02 18:26:49 +0100 | [diff] [blame] | 1263 | HDA_BIND_MUTE_MONO("Center Playback Switch", 0x0e, 1, 2, HDA_INPUT), |
| 1264 | HDA_BIND_MUTE_MONO("LFE Playback Switch", 0x0e, 2, 2, HDA_INPUT), |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 1265 | HDA_CODEC_MUTE("Headphone Playback Switch", 0x1b, 0x0, HDA_OUTPUT), |
| 1266 | { } /* end */ |
| 1267 | }; |
| 1268 | |
| 1269 | |
| 1270 | /* |
| 1271 | * Z710V model |
| 1272 | * |
| 1273 | * DAC: Front = 0x02 (0x0c), HP = 0x03 (0x0d) |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 1274 | * Pin assignment: Front = 0x14, HP = 0x15, Mic = 0x18, Mic2 = 0x19(?), |
| 1275 | * Line = 0x1a |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 1276 | */ |
| 1277 | |
| 1278 | static hda_nid_t alc880_z71v_dac_nids[1] = { |
| 1279 | 0x02 |
| 1280 | }; |
| 1281 | #define ALC880_Z71V_HP_DAC 0x03 |
| 1282 | |
| 1283 | /* fixed 2 channels */ |
Takashi Iwai | d2a6d7d | 2005-11-17 11:06:29 +0100 | [diff] [blame] | 1284 | static struct hda_channel_mode alc880_2_jack_modes[1] = { |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 1285 | { 2, NULL } |
| 1286 | }; |
| 1287 | |
Takashi Iwai | c8b6bf9 | 2005-11-17 14:57:47 +0100 | [diff] [blame] | 1288 | static struct snd_kcontrol_new alc880_z71v_mixer[] = { |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 1289 | HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT), |
Takashi Iwai | 985be54 | 2005-11-02 18:26:49 +0100 | [diff] [blame] | 1290 | HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT), |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 1291 | HDA_CODEC_VOLUME("Headphone Playback Volume", 0x0d, 0x0, HDA_OUTPUT), |
Takashi Iwai | 985be54 | 2005-11-02 18:26:49 +0100 | [diff] [blame] | 1292 | HDA_BIND_MUTE("Headphone Playback Switch", 0x0d, 2, HDA_INPUT), |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 1293 | HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT), |
| 1294 | HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT), |
| 1295 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), |
| 1296 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), |
| 1297 | { } /* end */ |
| 1298 | }; |
| 1299 | |
| 1300 | |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 1301 | /* |
| 1302 | * ALC880 F1734 model |
| 1303 | * |
| 1304 | * DAC: HP = 0x02 (0x0c), Front = 0x03 (0x0d) |
| 1305 | * Pin assignment: HP = 0x14, Front = 0x15, Mic = 0x18 |
| 1306 | */ |
| 1307 | |
| 1308 | static hda_nid_t alc880_f1734_dac_nids[1] = { |
| 1309 | 0x03 |
| 1310 | }; |
| 1311 | #define ALC880_F1734_HP_DAC 0x02 |
| 1312 | |
Takashi Iwai | c8b6bf9 | 2005-11-17 14:57:47 +0100 | [diff] [blame] | 1313 | static struct snd_kcontrol_new alc880_f1734_mixer[] = { |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 1314 | HDA_CODEC_VOLUME("Headphone Playback Volume", 0x0c, 0x0, HDA_OUTPUT), |
Takashi Iwai | 985be54 | 2005-11-02 18:26:49 +0100 | [diff] [blame] | 1315 | HDA_BIND_MUTE("Headphone Playback Switch", 0x0c, 2, HDA_INPUT), |
Takashi Iwai | 2134ea4 | 2008-01-10 16:53:55 +0100 | [diff] [blame] | 1316 | HDA_CODEC_VOLUME("Speaker Playback Volume", 0x0d, 0x0, HDA_OUTPUT), |
| 1317 | HDA_BIND_MUTE("Speaker Playback Switch", 0x0d, 2, HDA_INPUT), |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 1318 | HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT), |
| 1319 | HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT), |
Takashi Iwai | 937b416 | 2008-02-11 14:52:36 +0100 | [diff] [blame] | 1320 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x1, HDA_INPUT), |
| 1321 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x1, HDA_INPUT), |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 1322 | { } /* end */ |
| 1323 | }; |
| 1324 | |
Takashi Iwai | 937b416 | 2008-02-11 14:52:36 +0100 | [diff] [blame] | 1325 | static struct hda_input_mux alc880_f1734_capture_source = { |
| 1326 | .num_items = 2, |
| 1327 | .items = { |
| 1328 | { "Mic", 0x1 }, |
| 1329 | { "CD", 0x4 }, |
| 1330 | }, |
| 1331 | }; |
| 1332 | |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 1333 | |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 1334 | /* |
| 1335 | * ALC880 ASUS model |
| 1336 | * |
| 1337 | * DAC: HP/Front = 0x02 (0x0c), Surr = 0x03 (0x0d), CLFE = 0x04 (0x0e) |
| 1338 | * Pin assignment: HP/Front = 0x14, Surr = 0x15, CLFE = 0x16, |
| 1339 | * Mic = 0x18, Line = 0x1a |
| 1340 | */ |
| 1341 | |
| 1342 | #define alc880_asus_dac_nids alc880_w810_dac_nids /* identical with w810 */ |
| 1343 | #define alc880_asus_modes alc880_threestack_modes /* 2/6 channel mode */ |
| 1344 | |
Takashi Iwai | c8b6bf9 | 2005-11-17 14:57:47 +0100 | [diff] [blame] | 1345 | static struct snd_kcontrol_new alc880_asus_mixer[] = { |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 1346 | HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT), |
Takashi Iwai | 985be54 | 2005-11-02 18:26:49 +0100 | [diff] [blame] | 1347 | HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT), |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 1348 | HDA_CODEC_VOLUME("Surround Playback Volume", 0x0d, 0x0, HDA_OUTPUT), |
Takashi Iwai | 985be54 | 2005-11-02 18:26:49 +0100 | [diff] [blame] | 1349 | HDA_BIND_MUTE("Surround Playback Switch", 0x0d, 2, HDA_INPUT), |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 1350 | HDA_CODEC_VOLUME_MONO("Center Playback Volume", 0x0e, 1, 0x0, HDA_OUTPUT), |
| 1351 | HDA_CODEC_VOLUME_MONO("LFE Playback Volume", 0x0e, 2, 0x0, HDA_OUTPUT), |
Takashi Iwai | 985be54 | 2005-11-02 18:26:49 +0100 | [diff] [blame] | 1352 | HDA_BIND_MUTE_MONO("Center Playback Switch", 0x0e, 1, 2, HDA_INPUT), |
| 1353 | HDA_BIND_MUTE_MONO("LFE Playback Switch", 0x0e, 2, 2, HDA_INPUT), |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 1354 | HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT), |
| 1355 | HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT), |
| 1356 | HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT), |
| 1357 | HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT), |
| 1358 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), |
| 1359 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 1360 | { |
| 1361 | .iface = SNDRV_CTL_ELEM_IFACE_MIXER, |
| 1362 | .name = "Channel Mode", |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 1363 | .info = alc_ch_mode_info, |
| 1364 | .get = alc_ch_mode_get, |
| 1365 | .put = alc_ch_mode_put, |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 1366 | }, |
| 1367 | { } /* end */ |
| 1368 | }; |
| 1369 | |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 1370 | /* |
| 1371 | * ALC880 ASUS W1V model |
| 1372 | * |
| 1373 | * DAC: HP/Front = 0x02 (0x0c), Surr = 0x03 (0x0d), CLFE = 0x04 (0x0e) |
| 1374 | * Pin assignment: HP/Front = 0x14, Surr = 0x15, CLFE = 0x16, |
| 1375 | * Mic = 0x18, Line = 0x1a, Line2 = 0x1b |
| 1376 | */ |
| 1377 | |
| 1378 | /* additional mixers to alc880_asus_mixer */ |
Takashi Iwai | c8b6bf9 | 2005-11-17 14:57:47 +0100 | [diff] [blame] | 1379 | static struct snd_kcontrol_new alc880_asus_w1v_mixer[] = { |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 1380 | HDA_CODEC_VOLUME("Line2 Playback Volume", 0x0b, 0x03, HDA_INPUT), |
| 1381 | HDA_CODEC_MUTE("Line2 Playback Switch", 0x0b, 0x03, HDA_INPUT), |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 1382 | { } /* end */ |
| 1383 | }; |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 1384 | |
Takashi Iwai | 3c10a9d | 2005-08-23 20:02:27 +0200 | [diff] [blame] | 1385 | /* additional mixers to alc880_asus_mixer */ |
Takashi Iwai | c8b6bf9 | 2005-11-17 14:57:47 +0100 | [diff] [blame] | 1386 | static struct snd_kcontrol_new alc880_pcbeep_mixer[] = { |
Takashi Iwai | 3c10a9d | 2005-08-23 20:02:27 +0200 | [diff] [blame] | 1387 | HDA_CODEC_VOLUME("PC Speaker Playback Volume", 0x0b, 0x05, HDA_INPUT), |
| 1388 | HDA_CODEC_MUTE("PC Speaker Playback Switch", 0x0b, 0x05, HDA_INPUT), |
| 1389 | { } /* end */ |
| 1390 | }; |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 1391 | |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 1392 | /* TCL S700 */ |
| 1393 | static struct snd_kcontrol_new alc880_tcl_s700_mixer[] = { |
| 1394 | HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT), |
| 1395 | HDA_CODEC_MUTE("Front Playback Switch", 0x1b, 0x0, HDA_OUTPUT), |
| 1396 | HDA_CODEC_MUTE("Headphone Playback Switch", 0x14, 0x0, HDA_OUTPUT), |
| 1397 | HDA_CODEC_VOLUME("CD Playback Volume", 0x0B, 0x04, HDA_INPUT), |
| 1398 | HDA_CODEC_MUTE("CD Playback Switch", 0x0B, 0x04, HDA_INPUT), |
| 1399 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0B, 0x0, HDA_INPUT), |
| 1400 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0B, 0x0, HDA_INPUT), |
| 1401 | HDA_CODEC_VOLUME("Capture Volume", 0x08, 0x0, HDA_INPUT), |
| 1402 | HDA_CODEC_MUTE("Capture Switch", 0x08, 0x0, HDA_INPUT), |
| 1403 | { |
| 1404 | .iface = SNDRV_CTL_ELEM_IFACE_MIXER, |
| 1405 | /* The multiple "Capture Source" controls confuse alsamixer |
| 1406 | * So call somewhat different.. |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 1407 | */ |
| 1408 | /* .name = "Capture Source", */ |
| 1409 | .name = "Input Source", |
| 1410 | .count = 1, |
| 1411 | .info = alc_mux_enum_info, |
| 1412 | .get = alc_mux_enum_get, |
| 1413 | .put = alc_mux_enum_put, |
| 1414 | }, |
| 1415 | { } /* end */ |
| 1416 | }; |
| 1417 | |
Kailang Yang | ccc656c | 2006-10-17 12:32:26 +0200 | [diff] [blame] | 1418 | /* Uniwill */ |
| 1419 | static struct snd_kcontrol_new alc880_uniwill_mixer[] = { |
Takashi Iwai | 2134ea4 | 2008-01-10 16:53:55 +0100 | [diff] [blame] | 1420 | HDA_CODEC_VOLUME("Headphone Playback Volume", 0x0c, 0x0, HDA_OUTPUT), |
| 1421 | HDA_BIND_MUTE("Headphone Playback Switch", 0x0c, 2, HDA_INPUT), |
| 1422 | HDA_CODEC_VOLUME("Speaker Playback Volume", 0x0d, 0x0, HDA_OUTPUT), |
| 1423 | HDA_BIND_MUTE("Speaker Playback Switch", 0x0d, 2, HDA_INPUT), |
Kailang Yang | ccc656c | 2006-10-17 12:32:26 +0200 | [diff] [blame] | 1424 | HDA_CODEC_VOLUME_MONO("Center Playback Volume", 0x0e, 1, 0x0, HDA_OUTPUT), |
| 1425 | HDA_CODEC_VOLUME_MONO("LFE Playback Volume", 0x0e, 2, 0x0, HDA_OUTPUT), |
| 1426 | HDA_BIND_MUTE_MONO("Center Playback Switch", 0x0e, 1, 2, HDA_INPUT), |
| 1427 | HDA_BIND_MUTE_MONO("LFE Playback Switch", 0x0e, 2, 2, HDA_INPUT), |
| 1428 | HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT), |
| 1429 | HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT), |
| 1430 | HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT), |
| 1431 | HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT), |
| 1432 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), |
| 1433 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), |
| 1434 | HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x1, HDA_INPUT), |
| 1435 | HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x1, HDA_INPUT), |
| 1436 | HDA_CODEC_VOLUME("PC Speaker Playback Volume", 0x0b, 0x05, HDA_INPUT), |
| 1437 | HDA_CODEC_MUTE("PC Speaker Playback Switch", 0x0b, 0x05, HDA_INPUT), |
| 1438 | { |
| 1439 | .iface = SNDRV_CTL_ELEM_IFACE_MIXER, |
| 1440 | .name = "Channel Mode", |
| 1441 | .info = alc_ch_mode_info, |
| 1442 | .get = alc_ch_mode_get, |
| 1443 | .put = alc_ch_mode_put, |
| 1444 | }, |
| 1445 | { } /* end */ |
| 1446 | }; |
| 1447 | |
Tobin Davis | 2cf9f0f | 2007-02-07 16:04:25 +0100 | [diff] [blame] | 1448 | static struct snd_kcontrol_new alc880_fujitsu_mixer[] = { |
| 1449 | HDA_CODEC_VOLUME("Headphone Playback Volume", 0x0c, 0x0, HDA_OUTPUT), |
| 1450 | HDA_BIND_MUTE("Headphone Playback Switch", 0x0c, 2, HDA_INPUT), |
| 1451 | HDA_CODEC_VOLUME("Speaker Playback Volume", 0x0d, 0x0, HDA_OUTPUT), |
| 1452 | HDA_BIND_MUTE("Speaker Playback Switch", 0x0d, 2, HDA_INPUT), |
| 1453 | HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT), |
| 1454 | HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT), |
| 1455 | HDA_CODEC_VOLUME("Ext Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), |
| 1456 | HDA_CODEC_MUTE("Ext Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), |
| 1457 | HDA_CODEC_VOLUME("Int Mic Playback Volume", 0x0b, 0x1, HDA_INPUT), |
| 1458 | HDA_CODEC_MUTE("Int Mic Playback Switch", 0x0b, 0x1, HDA_INPUT), |
| 1459 | { } /* end */ |
| 1460 | }; |
| 1461 | |
Kailang Yang | ccc656c | 2006-10-17 12:32:26 +0200 | [diff] [blame] | 1462 | static struct snd_kcontrol_new alc880_uniwill_p53_mixer[] = { |
Takashi Iwai | 2134ea4 | 2008-01-10 16:53:55 +0100 | [diff] [blame] | 1463 | HDA_CODEC_VOLUME("Headphone Playback Volume", 0x0c, 0x0, HDA_OUTPUT), |
| 1464 | HDA_BIND_MUTE("Headphone Playback Switch", 0x0c, 2, HDA_INPUT), |
| 1465 | HDA_CODEC_VOLUME("Speaker Playback Volume", 0x0d, 0x0, HDA_OUTPUT), |
| 1466 | HDA_BIND_MUTE("Speaker Playback Switch", 0x0d, 2, HDA_INPUT), |
Kailang Yang | ccc656c | 2006-10-17 12:32:26 +0200 | [diff] [blame] | 1467 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), |
| 1468 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), |
| 1469 | { } /* end */ |
| 1470 | }; |
| 1471 | |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 1472 | /* |
Takashi Iwai | 2134ea4 | 2008-01-10 16:53:55 +0100 | [diff] [blame] | 1473 | * virtual master controls |
| 1474 | */ |
| 1475 | |
| 1476 | /* |
| 1477 | * slave controls for virtual master |
| 1478 | */ |
| 1479 | static const char *alc_slave_vols[] = { |
| 1480 | "Front Playback Volume", |
| 1481 | "Surround Playback Volume", |
| 1482 | "Center Playback Volume", |
| 1483 | "LFE Playback Volume", |
| 1484 | "Side Playback Volume", |
| 1485 | "Headphone Playback Volume", |
| 1486 | "Speaker Playback Volume", |
| 1487 | "Mono Playback Volume", |
Takashi Iwai | 2134ea4 | 2008-01-10 16:53:55 +0100 | [diff] [blame] | 1488 | "Line-Out Playback Volume", |
| 1489 | NULL, |
| 1490 | }; |
| 1491 | |
| 1492 | static const char *alc_slave_sws[] = { |
| 1493 | "Front Playback Switch", |
| 1494 | "Surround Playback Switch", |
| 1495 | "Center Playback Switch", |
| 1496 | "LFE Playback Switch", |
| 1497 | "Side Playback Switch", |
| 1498 | "Headphone Playback Switch", |
| 1499 | "Speaker Playback Switch", |
| 1500 | "Mono Playback Switch", |
Takashi Iwai | edb54a5 | 2008-01-29 12:47:02 +0100 | [diff] [blame] | 1501 | "IEC958 Playback Switch", |
Takashi Iwai | 2134ea4 | 2008-01-10 16:53:55 +0100 | [diff] [blame] | 1502 | NULL, |
| 1503 | }; |
| 1504 | |
| 1505 | /* |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 1506 | * build control elements |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 1507 | */ |
| 1508 | static int alc_build_controls(struct hda_codec *codec) |
| 1509 | { |
| 1510 | struct alc_spec *spec = codec->spec; |
| 1511 | int err; |
| 1512 | int i; |
| 1513 | |
| 1514 | for (i = 0; i < spec->num_mixers; i++) { |
| 1515 | err = snd_hda_add_new_ctls(codec, spec->mixers[i]); |
| 1516 | if (err < 0) |
| 1517 | return err; |
| 1518 | } |
| 1519 | |
| 1520 | if (spec->multiout.dig_out_nid) { |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 1521 | err = snd_hda_create_spdif_out_ctls(codec, |
| 1522 | spec->multiout.dig_out_nid); |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 1523 | if (err < 0) |
| 1524 | return err; |
Takashi Iwai | 9a08160 | 2008-02-12 18:37:26 +0100 | [diff] [blame] | 1525 | err = snd_hda_create_spdif_share_sw(codec, |
| 1526 | &spec->multiout); |
| 1527 | if (err < 0) |
| 1528 | return err; |
| 1529 | spec->multiout.share_spdif = 1; |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 1530 | } |
| 1531 | if (spec->dig_in_nid) { |
| 1532 | err = snd_hda_create_spdif_in_ctls(codec, spec->dig_in_nid); |
| 1533 | if (err < 0) |
| 1534 | return err; |
| 1535 | } |
Takashi Iwai | 2134ea4 | 2008-01-10 16:53:55 +0100 | [diff] [blame] | 1536 | |
| 1537 | /* if we have no master control, let's create it */ |
| 1538 | if (!snd_hda_find_mixer_ctl(codec, "Master Playback Volume")) { |
Takashi Iwai | 1c82ed1 | 2008-02-18 13:05:50 +0100 | [diff] [blame] | 1539 | unsigned int vmaster_tlv[4]; |
Takashi Iwai | 2134ea4 | 2008-01-10 16:53:55 +0100 | [diff] [blame] | 1540 | snd_hda_set_vmaster_tlv(codec, spec->vmaster_nid, |
Takashi Iwai | 1c82ed1 | 2008-02-18 13:05:50 +0100 | [diff] [blame] | 1541 | HDA_OUTPUT, vmaster_tlv); |
Takashi Iwai | 2134ea4 | 2008-01-10 16:53:55 +0100 | [diff] [blame] | 1542 | err = snd_hda_add_vmaster(codec, "Master Playback Volume", |
Takashi Iwai | 1c82ed1 | 2008-02-18 13:05:50 +0100 | [diff] [blame] | 1543 | vmaster_tlv, alc_slave_vols); |
Takashi Iwai | 2134ea4 | 2008-01-10 16:53:55 +0100 | [diff] [blame] | 1544 | if (err < 0) |
| 1545 | return err; |
| 1546 | } |
| 1547 | if (!snd_hda_find_mixer_ctl(codec, "Master Playback Switch")) { |
| 1548 | err = snd_hda_add_vmaster(codec, "Master Playback Switch", |
| 1549 | NULL, alc_slave_sws); |
| 1550 | if (err < 0) |
| 1551 | return err; |
| 1552 | } |
| 1553 | |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 1554 | return 0; |
| 1555 | } |
| 1556 | |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 1557 | |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 1558 | /* |
| 1559 | * initialize the codec volumes, etc |
| 1560 | */ |
| 1561 | |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 1562 | /* |
| 1563 | * generic initialization of ADC, input mixers and output mixers |
| 1564 | */ |
| 1565 | static struct hda_verb alc880_volume_init_verbs[] = { |
| 1566 | /* |
| 1567 | * Unmute ADC0-2 and set the default input to mic-in |
| 1568 | */ |
Takashi Iwai | 71fe7b8 | 2005-05-25 18:11:40 +0200 | [diff] [blame] | 1569 | {0x07, AC_VERB_SET_CONNECT_SEL, 0x00}, |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 1570 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
Takashi Iwai | 71fe7b8 | 2005-05-25 18:11:40 +0200 | [diff] [blame] | 1571 | {0x08, AC_VERB_SET_CONNECT_SEL, 0x00}, |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 1572 | {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
Takashi Iwai | 71fe7b8 | 2005-05-25 18:11:40 +0200 | [diff] [blame] | 1573 | {0x09, AC_VERB_SET_CONNECT_SEL, 0x00}, |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 1574 | {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 1575 | |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 1576 | /* Unmute input amps (CD, Line In, Mic 1 & Mic 2) of the analog-loopback |
| 1577 | * mixer widget |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 1578 | * Note: PASD motherboards uses the Line In 2 as the input for front |
| 1579 | * panel mic (mic 2) |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 1580 | */ |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 1581 | /* Amp Indices: Mic1 = 0, Mic2 = 1, Line1 = 2, Line2 = 3, CD = 4 */ |
Takashi Iwai | cb53c62 | 2007-08-10 17:21:45 +0200 | [diff] [blame] | 1582 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 1583 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
| 1584 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)}, |
| 1585 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)}, |
| 1586 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)}, |
| 1587 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(6)}, |
| 1588 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(7)}, |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 1589 | |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 1590 | /* |
| 1591 | * Set up output mixers (0x0c - 0x0f) |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 1592 | */ |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 1593 | /* set vol=0 to output mixers */ |
| 1594 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 1595 | {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 1596 | {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 1597 | {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 1598 | /* set up input amps for analog loopback */ |
| 1599 | /* Amp Indices: DAC = 0, mixer = 1 */ |
Takashi Iwai | 05acb86 | 2005-06-10 19:50:25 +0200 | [diff] [blame] | 1600 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 1601 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
Takashi Iwai | 05acb86 | 2005-06-10 19:50:25 +0200 | [diff] [blame] | 1602 | {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 1603 | {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
Takashi Iwai | 05acb86 | 2005-06-10 19:50:25 +0200 | [diff] [blame] | 1604 | {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 1605 | {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
Takashi Iwai | 05acb86 | 2005-06-10 19:50:25 +0200 | [diff] [blame] | 1606 | {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 1607 | {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 1608 | |
| 1609 | { } |
| 1610 | }; |
| 1611 | |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 1612 | /* |
| 1613 | * 3-stack pin configuration: |
| 1614 | * front = 0x14, mic/clfe = 0x18, HP = 0x19, line/surr = 0x1a, f-mic = 0x1b |
| 1615 | */ |
| 1616 | static struct hda_verb alc880_pin_3stack_init_verbs[] = { |
| 1617 | /* |
| 1618 | * preset connection lists of input pins |
| 1619 | * 0 = front, 1 = rear_surr, 2 = CLFE, 3 = surround |
| 1620 | */ |
| 1621 | {0x10, AC_VERB_SET_CONNECT_SEL, 0x02}, /* mic/clfe */ |
| 1622 | {0x11, AC_VERB_SET_CONNECT_SEL, 0x00}, /* HP */ |
| 1623 | {0x12, AC_VERB_SET_CONNECT_SEL, 0x03}, /* line/surround */ |
| 1624 | |
| 1625 | /* |
| 1626 | * Set pin mode and muting |
| 1627 | */ |
| 1628 | /* set front pin widgets 0x14 for output */ |
| 1629 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 1630 | {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 1631 | /* Mic1 (rear panel) pin widget for input and vref at 80% */ |
| 1632 | {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80}, |
| 1633 | {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
| 1634 | /* Mic2 (as headphone out) for HP output */ |
| 1635 | {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 1636 | {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 1637 | /* Line In pin widget for input */ |
| 1638 | {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
| 1639 | {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
| 1640 | /* Line2 (as front mic) pin widget for input and vref at 80% */ |
| 1641 | {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80}, |
| 1642 | {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
| 1643 | /* CD pin widget for input */ |
| 1644 | {0x1c, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
| 1645 | |
| 1646 | { } |
| 1647 | }; |
| 1648 | |
| 1649 | /* |
| 1650 | * 5-stack pin configuration: |
| 1651 | * front = 0x14, surround = 0x17, clfe = 0x16, mic = 0x18, HP = 0x19, |
| 1652 | * line-in/side = 0x1a, f-mic = 0x1b |
| 1653 | */ |
| 1654 | static struct hda_verb alc880_pin_5stack_init_verbs[] = { |
| 1655 | /* |
| 1656 | * preset connection lists of input pins |
| 1657 | * 0 = front, 1 = rear_surr, 2 = CLFE, 3 = surround |
| 1658 | */ |
| 1659 | {0x11, AC_VERB_SET_CONNECT_SEL, 0x00}, /* HP */ |
| 1660 | {0x12, AC_VERB_SET_CONNECT_SEL, 0x01}, /* line/side */ |
| 1661 | |
| 1662 | /* |
| 1663 | * Set pin mode and muting |
| 1664 | */ |
| 1665 | /* set pin widgets 0x14-0x17 for output */ |
Takashi Iwai | 05acb86 | 2005-06-10 19:50:25 +0200 | [diff] [blame] | 1666 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 1667 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 1668 | {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 1669 | {0x17, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 1670 | /* unmute pins for output (no gain on this amp) */ |
| 1671 | {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 1672 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 1673 | {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 1674 | {0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 1675 | |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 1676 | /* Mic1 (rear panel) pin widget for input and vref at 80% */ |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 1677 | {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80}, |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 1678 | {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
| 1679 | /* Mic2 (as headphone out) for HP output */ |
| 1680 | {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
Takashi Iwai | 05acb86 | 2005-06-10 19:50:25 +0200 | [diff] [blame] | 1681 | {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 1682 | /* Line In pin widget for input */ |
| 1683 | {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
| 1684 | {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
| 1685 | /* Line2 (as front mic) pin widget for input and vref at 80% */ |
| 1686 | {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80}, |
| 1687 | {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
| 1688 | /* CD pin widget for input */ |
| 1689 | {0x1c, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 1690 | |
| 1691 | { } |
| 1692 | }; |
| 1693 | |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 1694 | /* |
| 1695 | * W810 pin configuration: |
| 1696 | * front = 0x14, surround = 0x15, clfe = 0x16, HP = 0x1b |
| 1697 | */ |
| 1698 | static struct hda_verb alc880_pin_w810_init_verbs[] = { |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 1699 | /* hphone/speaker input selector: front DAC */ |
| 1700 | {0x13, AC_VERB_SET_CONNECT_SEL, 0x0}, |
| 1701 | |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 1702 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 1703 | {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 1704 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 1705 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 1706 | {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 1707 | {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 1708 | |
| 1709 | {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
Takashi Iwai | 05acb86 | 2005-06-10 19:50:25 +0200 | [diff] [blame] | 1710 | {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 1711 | |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 1712 | { } |
| 1713 | }; |
| 1714 | |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 1715 | /* |
| 1716 | * Z71V pin configuration: |
| 1717 | * Speaker-out = 0x14, HP = 0x15, Mic = 0x18, Line-in = 0x1a, Mic2 = 0x1b (?) |
| 1718 | */ |
| 1719 | static struct hda_verb alc880_pin_z71v_init_verbs[] = { |
Takashi Iwai | 05acb86 | 2005-06-10 19:50:25 +0200 | [diff] [blame] | 1720 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 1721 | {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
Takashi Iwai | 05acb86 | 2005-06-10 19:50:25 +0200 | [diff] [blame] | 1722 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 1723 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
Takashi Iwai | dfc0ff6 | 2005-05-12 14:31:49 +0200 | [diff] [blame] | 1724 | |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 1725 | {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80}, |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 1726 | {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 1727 | {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80}, |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 1728 | {0x1c, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
Takashi Iwai | dfc0ff6 | 2005-05-12 14:31:49 +0200 | [diff] [blame] | 1729 | |
| 1730 | { } |
| 1731 | }; |
| 1732 | |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 1733 | /* |
| 1734 | * 6-stack pin configuration: |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 1735 | * front = 0x14, surr = 0x15, clfe = 0x16, side = 0x17, mic = 0x18, |
| 1736 | * f-mic = 0x19, line = 0x1a, HP = 0x1b |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 1737 | */ |
| 1738 | static struct hda_verb alc880_pin_6stack_init_verbs[] = { |
| 1739 | {0x13, AC_VERB_SET_CONNECT_SEL, 0x00}, /* HP */ |
| 1740 | |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 1741 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 1742 | {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 1743 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 1744 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 1745 | {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 1746 | {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 1747 | {0x17, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 1748 | {0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 1749 | |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 1750 | {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80}, |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 1751 | {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 1752 | {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80}, |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 1753 | {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 1754 | {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 1755 | {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 1756 | {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 1757 | {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 1758 | {0x1c, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
| 1759 | |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 1760 | { } |
| 1761 | }; |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 1762 | |
Kailang Yang | ccc656c | 2006-10-17 12:32:26 +0200 | [diff] [blame] | 1763 | /* |
| 1764 | * Uniwill pin configuration: |
| 1765 | * HP = 0x14, InternalSpeaker = 0x15, mic = 0x18, internal mic = 0x19, |
| 1766 | * line = 0x1a |
| 1767 | */ |
| 1768 | static struct hda_verb alc880_uniwill_init_verbs[] = { |
| 1769 | {0x13, AC_VERB_SET_CONNECT_SEL, 0x00}, /* HP */ |
| 1770 | |
| 1771 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 1772 | {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 1773 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 1774 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 1775 | {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 1776 | {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 1777 | {0x17, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 1778 | {0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 1779 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))}, |
| 1780 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x01 << 8))}, |
| 1781 | {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))}, |
| 1782 | {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x01 << 8))}, |
| 1783 | {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))}, |
| 1784 | {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x01 << 8))}, |
| 1785 | |
| 1786 | {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80}, |
| 1787 | {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
| 1788 | {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80}, |
| 1789 | {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
| 1790 | {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
| 1791 | {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
| 1792 | /* {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, */ |
| 1793 | /* {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, */ |
| 1794 | {0x1c, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
| 1795 | |
| 1796 | {0x14, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT}, |
| 1797 | {0x18, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_MIC_EVENT}, |
| 1798 | |
| 1799 | { } |
| 1800 | }; |
| 1801 | |
| 1802 | /* |
| 1803 | * Uniwill P53 |
| 1804 | * HP = 0x14, InternalSpeaker = 0x15, mic = 0x19, |
| 1805 | */ |
| 1806 | static struct hda_verb alc880_uniwill_p53_init_verbs[] = { |
| 1807 | {0x13, AC_VERB_SET_CONNECT_SEL, 0x00}, /* HP */ |
| 1808 | |
| 1809 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 1810 | {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 1811 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 1812 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 1813 | {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 1814 | {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 1815 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))}, |
| 1816 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x01 << 8))}, |
| 1817 | {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))}, |
| 1818 | {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x01 << 8))}, |
| 1819 | {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))}, |
| 1820 | {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x01 << 8))}, |
| 1821 | |
| 1822 | {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80}, |
| 1823 | {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
| 1824 | {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80}, |
| 1825 | {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
| 1826 | {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
| 1827 | {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
| 1828 | |
| 1829 | {0x14, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT}, |
| 1830 | {0x21, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_DCVOL_EVENT}, |
| 1831 | |
| 1832 | { } |
| 1833 | }; |
| 1834 | |
Tobin Davis | 2cf9f0f | 2007-02-07 16:04:25 +0100 | [diff] [blame] | 1835 | static struct hda_verb alc880_beep_init_verbs[] = { |
| 1836 | { 0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(5) }, |
| 1837 | { } |
| 1838 | }; |
| 1839 | |
Kailang Yang | ccc656c | 2006-10-17 12:32:26 +0200 | [diff] [blame] | 1840 | /* toggle speaker-output according to the hp-jack state */ |
Takashi Iwai | 458a4fa | 2007-05-05 12:18:40 +0200 | [diff] [blame] | 1841 | static void alc880_uniwill_hp_automute(struct hda_codec *codec) |
Kailang Yang | ccc656c | 2006-10-17 12:32:26 +0200 | [diff] [blame] | 1842 | { |
| 1843 | unsigned int present; |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 1844 | unsigned char bits; |
Kailang Yang | ccc656c | 2006-10-17 12:32:26 +0200 | [diff] [blame] | 1845 | |
| 1846 | present = snd_hda_codec_read(codec, 0x14, 0, |
| 1847 | AC_VERB_GET_PIN_SENSE, 0) & 0x80000000; |
Takashi Iwai | 47fd830 | 2007-08-10 17:11:07 +0200 | [diff] [blame] | 1848 | bits = present ? HDA_AMP_MUTE : 0; |
| 1849 | snd_hda_codec_amp_stereo(codec, 0x15, HDA_OUTPUT, 0, |
| 1850 | HDA_AMP_MUTE, bits); |
| 1851 | snd_hda_codec_amp_stereo(codec, 0x16, HDA_OUTPUT, 0, |
| 1852 | HDA_AMP_MUTE, bits); |
Takashi Iwai | 458a4fa | 2007-05-05 12:18:40 +0200 | [diff] [blame] | 1853 | } |
| 1854 | |
| 1855 | /* auto-toggle front mic */ |
| 1856 | static void alc880_uniwill_mic_automute(struct hda_codec *codec) |
| 1857 | { |
| 1858 | unsigned int present; |
| 1859 | unsigned char bits; |
Kailang Yang | ccc656c | 2006-10-17 12:32:26 +0200 | [diff] [blame] | 1860 | |
| 1861 | present = snd_hda_codec_read(codec, 0x18, 0, |
| 1862 | AC_VERB_GET_PIN_SENSE, 0) & 0x80000000; |
Takashi Iwai | 47fd830 | 2007-08-10 17:11:07 +0200 | [diff] [blame] | 1863 | bits = present ? HDA_AMP_MUTE : 0; |
| 1864 | snd_hda_codec_amp_stereo(codec, 0x0b, HDA_INPUT, 1, HDA_AMP_MUTE, bits); |
Takashi Iwai | 458a4fa | 2007-05-05 12:18:40 +0200 | [diff] [blame] | 1865 | } |
| 1866 | |
| 1867 | static void alc880_uniwill_automute(struct hda_codec *codec) |
| 1868 | { |
| 1869 | alc880_uniwill_hp_automute(codec); |
| 1870 | alc880_uniwill_mic_automute(codec); |
Kailang Yang | ccc656c | 2006-10-17 12:32:26 +0200 | [diff] [blame] | 1871 | } |
| 1872 | |
| 1873 | static void alc880_uniwill_unsol_event(struct hda_codec *codec, |
| 1874 | unsigned int res) |
| 1875 | { |
| 1876 | /* Looks like the unsol event is incompatible with the standard |
| 1877 | * definition. 4bit tag is placed at 28 bit! |
| 1878 | */ |
Takashi Iwai | 458a4fa | 2007-05-05 12:18:40 +0200 | [diff] [blame] | 1879 | switch (res >> 28) { |
| 1880 | case ALC880_HP_EVENT: |
| 1881 | alc880_uniwill_hp_automute(codec); |
| 1882 | break; |
| 1883 | case ALC880_MIC_EVENT: |
| 1884 | alc880_uniwill_mic_automute(codec); |
| 1885 | break; |
| 1886 | } |
Kailang Yang | ccc656c | 2006-10-17 12:32:26 +0200 | [diff] [blame] | 1887 | } |
| 1888 | |
| 1889 | static void alc880_uniwill_p53_hp_automute(struct hda_codec *codec) |
| 1890 | { |
| 1891 | unsigned int present; |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 1892 | unsigned char bits; |
Kailang Yang | ccc656c | 2006-10-17 12:32:26 +0200 | [diff] [blame] | 1893 | |
| 1894 | present = snd_hda_codec_read(codec, 0x14, 0, |
| 1895 | AC_VERB_GET_PIN_SENSE, 0) & 0x80000000; |
Takashi Iwai | 47fd830 | 2007-08-10 17:11:07 +0200 | [diff] [blame] | 1896 | bits = present ? HDA_AMP_MUTE : 0; |
| 1897 | snd_hda_codec_amp_stereo(codec, 0x15, HDA_INPUT, 0, HDA_AMP_MUTE, bits); |
Kailang Yang | ccc656c | 2006-10-17 12:32:26 +0200 | [diff] [blame] | 1898 | } |
| 1899 | |
| 1900 | static void alc880_uniwill_p53_dcvol_automute(struct hda_codec *codec) |
| 1901 | { |
| 1902 | unsigned int present; |
| 1903 | |
| 1904 | present = snd_hda_codec_read(codec, 0x21, 0, |
Takashi Iwai | 47fd830 | 2007-08-10 17:11:07 +0200 | [diff] [blame] | 1905 | AC_VERB_GET_VOLUME_KNOB_CONTROL, 0); |
| 1906 | present &= HDA_AMP_VOLMASK; |
| 1907 | snd_hda_codec_amp_stereo(codec, 0x0c, HDA_OUTPUT, 0, |
| 1908 | HDA_AMP_VOLMASK, present); |
| 1909 | snd_hda_codec_amp_stereo(codec, 0x0d, HDA_OUTPUT, 0, |
| 1910 | HDA_AMP_VOLMASK, present); |
Kailang Yang | ccc656c | 2006-10-17 12:32:26 +0200 | [diff] [blame] | 1911 | } |
Takashi Iwai | 47fd830 | 2007-08-10 17:11:07 +0200 | [diff] [blame] | 1912 | |
Kailang Yang | ccc656c | 2006-10-17 12:32:26 +0200 | [diff] [blame] | 1913 | static void alc880_uniwill_p53_unsol_event(struct hda_codec *codec, |
| 1914 | unsigned int res) |
| 1915 | { |
| 1916 | /* Looks like the unsol event is incompatible with the standard |
| 1917 | * definition. 4bit tag is placed at 28 bit! |
| 1918 | */ |
| 1919 | if ((res >> 28) == ALC880_HP_EVENT) |
| 1920 | alc880_uniwill_p53_hp_automute(codec); |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 1921 | if ((res >> 28) == ALC880_DCVOL_EVENT) |
Kailang Yang | ccc656c | 2006-10-17 12:32:26 +0200 | [diff] [blame] | 1922 | alc880_uniwill_p53_dcvol_automute(codec); |
| 1923 | } |
| 1924 | |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 1925 | /* |
| 1926 | * F1734 pin configuration: |
| 1927 | * HP = 0x14, speaker-out = 0x15, mic = 0x18 |
| 1928 | */ |
| 1929 | static struct hda_verb alc880_pin_f1734_init_verbs[] = { |
Michael Gruber | ee7a9c7 | 2008-03-10 11:30:59 +0100 | [diff] [blame] | 1930 | {0x07, AC_VERB_SET_CONNECT_SEL, 0x01}, |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 1931 | {0x10, AC_VERB_SET_CONNECT_SEL, 0x02}, |
| 1932 | {0x11, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 1933 | {0x12, AC_VERB_SET_CONNECT_SEL, 0x01}, |
| 1934 | {0x13, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 1935 | |
| 1936 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 1937 | {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 1938 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 1939 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 1940 | |
| 1941 | {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80}, |
| 1942 | {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
Michael Gruber | ee7a9c7 | 2008-03-10 11:30:59 +0100 | [diff] [blame] | 1943 | {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF50}, |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 1944 | {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
| 1945 | {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 1946 | {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 1947 | {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 1948 | {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 1949 | {0x1c, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 1950 | |
Takashi Iwai | 937b416 | 2008-02-11 14:52:36 +0100 | [diff] [blame] | 1951 | {0x14, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN|ALC880_HP_EVENT}, |
| 1952 | {0x21, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN|ALC880_DCVOL_EVENT}, |
| 1953 | |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 1954 | { } |
| 1955 | }; |
| 1956 | |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 1957 | /* |
| 1958 | * ASUS pin configuration: |
| 1959 | * HP/front = 0x14, surr = 0x15, clfe = 0x16, mic = 0x18, line = 0x1a |
| 1960 | */ |
| 1961 | static struct hda_verb alc880_pin_asus_init_verbs[] = { |
| 1962 | {0x10, AC_VERB_SET_CONNECT_SEL, 0x02}, |
| 1963 | {0x11, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 1964 | {0x12, AC_VERB_SET_CONNECT_SEL, 0x01}, |
| 1965 | {0x13, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 1966 | |
| 1967 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 1968 | {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 1969 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 1970 | {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 1971 | {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 1972 | {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 1973 | {0x17, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 1974 | {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 1975 | |
| 1976 | {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80}, |
| 1977 | {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
| 1978 | {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80}, |
| 1979 | {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
| 1980 | {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
| 1981 | {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
| 1982 | {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 1983 | {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 1984 | {0x1c, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
| 1985 | |
| 1986 | { } |
| 1987 | }; |
| 1988 | |
| 1989 | /* Enable GPIO mask and set output */ |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 1990 | #define alc880_gpio1_init_verbs alc_gpio1_init_verbs |
| 1991 | #define alc880_gpio2_init_verbs alc_gpio2_init_verbs |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 1992 | |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 1993 | /* Clevo m520g init */ |
| 1994 | static struct hda_verb alc880_pin_clevo_init_verbs[] = { |
| 1995 | /* headphone output */ |
| 1996 | {0x11, AC_VERB_SET_CONNECT_SEL, 0x01}, |
| 1997 | /* line-out */ |
| 1998 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 1999 | {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 2000 | /* Line-in */ |
| 2001 | {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
| 2002 | {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 2003 | /* CD */ |
| 2004 | {0x1c, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
| 2005 | {0x1c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 2006 | /* Mic1 (rear panel) */ |
| 2007 | {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80}, |
| 2008 | {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 2009 | /* Mic2 (front panel) */ |
| 2010 | {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80}, |
| 2011 | {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 2012 | /* headphone */ |
| 2013 | {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 2014 | {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 2015 | /* change to EAPD mode */ |
| 2016 | {0x20, AC_VERB_SET_COEF_INDEX, 0x07}, |
| 2017 | {0x20, AC_VERB_SET_PROC_COEF, 0x3060}, |
| 2018 | |
| 2019 | { } |
| 2020 | }; |
| 2021 | |
| 2022 | static struct hda_verb alc880_pin_tcl_S700_init_verbs[] = { |
Takashi Iwai | 4b146cb | 2006-07-28 14:42:36 +0200 | [diff] [blame] | 2023 | /* change to EAPD mode */ |
| 2024 | {0x20, AC_VERB_SET_COEF_INDEX, 0x07}, |
| 2025 | {0x20, AC_VERB_SET_PROC_COEF, 0x3060}, |
| 2026 | |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 2027 | /* Headphone output */ |
| 2028 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 2029 | /* Front output*/ |
| 2030 | {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 2031 | {0x1b, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 2032 | |
| 2033 | /* Line In pin widget for input */ |
| 2034 | {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
| 2035 | /* CD pin widget for input */ |
| 2036 | {0x1c, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
| 2037 | /* Mic1 (rear panel) pin widget for input and vref at 80% */ |
| 2038 | {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80}, |
| 2039 | |
| 2040 | /* change to EAPD mode */ |
| 2041 | {0x20, AC_VERB_SET_COEF_INDEX, 0x07}, |
| 2042 | {0x20, AC_VERB_SET_PROC_COEF, 0x3070}, |
| 2043 | |
| 2044 | { } |
| 2045 | }; |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 2046 | |
| 2047 | /* |
Takashi Iwai | ae6b813 | 2006-03-03 16:47:17 +0100 | [diff] [blame] | 2048 | * LG m1 express dual |
| 2049 | * |
| 2050 | * Pin assignment: |
| 2051 | * Rear Line-In/Out (blue): 0x14 |
| 2052 | * Build-in Mic-In: 0x15 |
| 2053 | * Speaker-out: 0x17 |
| 2054 | * HP-Out (green): 0x1b |
| 2055 | * Mic-In/Out (red): 0x19 |
| 2056 | * SPDIF-Out: 0x1e |
| 2057 | */ |
| 2058 | |
| 2059 | /* To make 5.1 output working (green=Front, blue=Surr, red=CLFE) */ |
| 2060 | static hda_nid_t alc880_lg_dac_nids[3] = { |
| 2061 | 0x05, 0x02, 0x03 |
| 2062 | }; |
| 2063 | |
| 2064 | /* seems analog CD is not working */ |
| 2065 | static struct hda_input_mux alc880_lg_capture_source = { |
| 2066 | .num_items = 3, |
| 2067 | .items = { |
| 2068 | { "Mic", 0x1 }, |
| 2069 | { "Line", 0x5 }, |
| 2070 | { "Internal Mic", 0x6 }, |
| 2071 | }, |
| 2072 | }; |
| 2073 | |
| 2074 | /* 2,4,6 channel modes */ |
| 2075 | static struct hda_verb alc880_lg_ch2_init[] = { |
| 2076 | /* set line-in and mic-in to input */ |
| 2077 | { 0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN }, |
| 2078 | { 0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80 }, |
| 2079 | { } |
| 2080 | }; |
| 2081 | |
| 2082 | static struct hda_verb alc880_lg_ch4_init[] = { |
| 2083 | /* set line-in to out and mic-in to input */ |
| 2084 | { 0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP }, |
| 2085 | { 0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80 }, |
| 2086 | { } |
| 2087 | }; |
| 2088 | |
| 2089 | static struct hda_verb alc880_lg_ch6_init[] = { |
| 2090 | /* set line-in and mic-in to output */ |
| 2091 | { 0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP }, |
| 2092 | { 0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP }, |
| 2093 | { } |
| 2094 | }; |
| 2095 | |
| 2096 | static struct hda_channel_mode alc880_lg_ch_modes[3] = { |
| 2097 | { 2, alc880_lg_ch2_init }, |
| 2098 | { 4, alc880_lg_ch4_init }, |
| 2099 | { 6, alc880_lg_ch6_init }, |
| 2100 | }; |
| 2101 | |
| 2102 | static struct snd_kcontrol_new alc880_lg_mixer[] = { |
Takashi Iwai | 2134ea4 | 2008-01-10 16:53:55 +0100 | [diff] [blame] | 2103 | HDA_CODEC_VOLUME("Front Playback Volume", 0x0f, 0x0, HDA_OUTPUT), |
| 2104 | HDA_BIND_MUTE("Front Playback Switch", 0x0f, 2, HDA_INPUT), |
Takashi Iwai | ae6b813 | 2006-03-03 16:47:17 +0100 | [diff] [blame] | 2105 | HDA_CODEC_VOLUME("Surround Playback Volume", 0x0c, 0x0, HDA_OUTPUT), |
| 2106 | HDA_BIND_MUTE("Surround Playback Switch", 0x0c, 2, HDA_INPUT), |
| 2107 | HDA_CODEC_VOLUME_MONO("Center Playback Volume", 0x0d, 1, 0x0, HDA_OUTPUT), |
| 2108 | HDA_CODEC_VOLUME_MONO("LFE Playback Volume", 0x0d, 2, 0x0, HDA_OUTPUT), |
| 2109 | HDA_BIND_MUTE_MONO("Center Playback Switch", 0x0d, 1, 2, HDA_INPUT), |
| 2110 | HDA_BIND_MUTE_MONO("LFE Playback Switch", 0x0d, 2, 2, HDA_INPUT), |
| 2111 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x1, HDA_INPUT), |
| 2112 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x1, HDA_INPUT), |
| 2113 | HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x06, HDA_INPUT), |
| 2114 | HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x06, HDA_INPUT), |
| 2115 | HDA_CODEC_VOLUME("Internal Mic Playback Volume", 0x0b, 0x07, HDA_INPUT), |
| 2116 | HDA_CODEC_MUTE("Internal Mic Playback Switch", 0x0b, 0x07, HDA_INPUT), |
| 2117 | { |
| 2118 | .iface = SNDRV_CTL_ELEM_IFACE_MIXER, |
| 2119 | .name = "Channel Mode", |
| 2120 | .info = alc_ch_mode_info, |
| 2121 | .get = alc_ch_mode_get, |
| 2122 | .put = alc_ch_mode_put, |
| 2123 | }, |
| 2124 | { } /* end */ |
| 2125 | }; |
| 2126 | |
| 2127 | static struct hda_verb alc880_lg_init_verbs[] = { |
| 2128 | /* set capture source to mic-in */ |
| 2129 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 2130 | {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 2131 | {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 2132 | /* mute all amp mixer inputs */ |
| 2133 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(5)}, |
Takashi Iwai | cb53c62 | 2007-08-10 17:21:45 +0200 | [diff] [blame] | 2134 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(6)}, |
| 2135 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(7)}, |
Takashi Iwai | ae6b813 | 2006-03-03 16:47:17 +0100 | [diff] [blame] | 2136 | /* line-in to input */ |
| 2137 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
| 2138 | {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 2139 | /* built-in mic */ |
| 2140 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80}, |
| 2141 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 2142 | /* speaker-out */ |
| 2143 | {0x17, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 2144 | {0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 2145 | /* mic-in to input */ |
| 2146 | {0x11, AC_VERB_SET_CONNECT_SEL, 0x01}, |
| 2147 | {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80}, |
| 2148 | {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 2149 | /* HP-out */ |
| 2150 | {0x13, AC_VERB_SET_CONNECT_SEL, 0x03}, |
| 2151 | {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 2152 | {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 2153 | /* jack sense */ |
| 2154 | {0x1b, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | 0x1}, |
| 2155 | { } |
| 2156 | }; |
| 2157 | |
| 2158 | /* toggle speaker-output according to the hp-jack state */ |
| 2159 | static void alc880_lg_automute(struct hda_codec *codec) |
| 2160 | { |
| 2161 | unsigned int present; |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 2162 | unsigned char bits; |
Takashi Iwai | ae6b813 | 2006-03-03 16:47:17 +0100 | [diff] [blame] | 2163 | |
| 2164 | present = snd_hda_codec_read(codec, 0x1b, 0, |
| 2165 | AC_VERB_GET_PIN_SENSE, 0) & 0x80000000; |
Takashi Iwai | 47fd830 | 2007-08-10 17:11:07 +0200 | [diff] [blame] | 2166 | bits = present ? HDA_AMP_MUTE : 0; |
| 2167 | snd_hda_codec_amp_stereo(codec, 0x17, HDA_OUTPUT, 0, |
| 2168 | HDA_AMP_MUTE, bits); |
Takashi Iwai | ae6b813 | 2006-03-03 16:47:17 +0100 | [diff] [blame] | 2169 | } |
| 2170 | |
| 2171 | static void alc880_lg_unsol_event(struct hda_codec *codec, unsigned int res) |
| 2172 | { |
| 2173 | /* Looks like the unsol event is incompatible with the standard |
| 2174 | * definition. 4bit tag is placed at 28 bit! |
| 2175 | */ |
| 2176 | if ((res >> 28) == 0x01) |
| 2177 | alc880_lg_automute(codec); |
| 2178 | } |
| 2179 | |
| 2180 | /* |
Takashi Iwai | d681518 | 2006-03-23 16:06:23 +0100 | [diff] [blame] | 2181 | * LG LW20 |
| 2182 | * |
| 2183 | * Pin assignment: |
| 2184 | * Speaker-out: 0x14 |
| 2185 | * Mic-In: 0x18 |
Claudio Matsuoka | e4f41da | 2007-07-13 11:51:06 +0200 | [diff] [blame] | 2186 | * Built-in Mic-In: 0x19 |
| 2187 | * Line-In: 0x1b |
| 2188 | * HP-Out: 0x1a |
Takashi Iwai | d681518 | 2006-03-23 16:06:23 +0100 | [diff] [blame] | 2189 | * SPDIF-Out: 0x1e |
| 2190 | */ |
| 2191 | |
Takashi Iwai | d681518 | 2006-03-23 16:06:23 +0100 | [diff] [blame] | 2192 | static struct hda_input_mux alc880_lg_lw_capture_source = { |
Claudio Matsuoka | e4f41da | 2007-07-13 11:51:06 +0200 | [diff] [blame] | 2193 | .num_items = 3, |
Takashi Iwai | d681518 | 2006-03-23 16:06:23 +0100 | [diff] [blame] | 2194 | .items = { |
| 2195 | { "Mic", 0x0 }, |
| 2196 | { "Internal Mic", 0x1 }, |
Claudio Matsuoka | e4f41da | 2007-07-13 11:51:06 +0200 | [diff] [blame] | 2197 | { "Line In", 0x2 }, |
Takashi Iwai | d681518 | 2006-03-23 16:06:23 +0100 | [diff] [blame] | 2198 | }, |
| 2199 | }; |
| 2200 | |
Claudio Matsuoka | 0a8c5da | 2007-07-04 15:17:38 +0200 | [diff] [blame] | 2201 | #define alc880_lg_lw_modes alc880_threestack_modes |
| 2202 | |
Takashi Iwai | d681518 | 2006-03-23 16:06:23 +0100 | [diff] [blame] | 2203 | static struct snd_kcontrol_new alc880_lg_lw_mixer[] = { |
Claudio Matsuoka | 0a8c5da | 2007-07-04 15:17:38 +0200 | [diff] [blame] | 2204 | HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT), |
| 2205 | HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT), |
| 2206 | HDA_CODEC_VOLUME("Surround Playback Volume", 0x0f, 0x0, HDA_OUTPUT), |
| 2207 | HDA_BIND_MUTE("Surround Playback Switch", 0x0f, 2, HDA_INPUT), |
| 2208 | HDA_CODEC_VOLUME_MONO("Center Playback Volume", 0x0e, 1, 0x0, HDA_OUTPUT), |
| 2209 | HDA_CODEC_VOLUME_MONO("LFE Playback Volume", 0x0e, 2, 0x0, HDA_OUTPUT), |
| 2210 | HDA_BIND_MUTE_MONO("Center Playback Switch", 0x0e, 1, 2, HDA_INPUT), |
| 2211 | HDA_BIND_MUTE_MONO("LFE Playback Switch", 0x0e, 2, 2, HDA_INPUT), |
| 2212 | HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT), |
| 2213 | HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT), |
Takashi Iwai | d681518 | 2006-03-23 16:06:23 +0100 | [diff] [blame] | 2214 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), |
| 2215 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), |
| 2216 | HDA_CODEC_VOLUME("Internal Mic Playback Volume", 0x0b, 0x01, HDA_INPUT), |
| 2217 | HDA_CODEC_MUTE("Internal Mic Playback Switch", 0x0b, 0x01, HDA_INPUT), |
Claudio Matsuoka | 0a8c5da | 2007-07-04 15:17:38 +0200 | [diff] [blame] | 2218 | { |
| 2219 | .iface = SNDRV_CTL_ELEM_IFACE_MIXER, |
| 2220 | .name = "Channel Mode", |
| 2221 | .info = alc_ch_mode_info, |
| 2222 | .get = alc_ch_mode_get, |
| 2223 | .put = alc_ch_mode_put, |
| 2224 | }, |
Takashi Iwai | d681518 | 2006-03-23 16:06:23 +0100 | [diff] [blame] | 2225 | { } /* end */ |
| 2226 | }; |
| 2227 | |
| 2228 | static struct hda_verb alc880_lg_lw_init_verbs[] = { |
Claudio Matsuoka | 0a8c5da | 2007-07-04 15:17:38 +0200 | [diff] [blame] | 2229 | {0x13, AC_VERB_SET_CONNECT_SEL, 0x00}, /* HP */ |
| 2230 | {0x10, AC_VERB_SET_CONNECT_SEL, 0x02}, /* mic/clfe */ |
| 2231 | {0x12, AC_VERB_SET_CONNECT_SEL, 0x03}, /* line/surround */ |
| 2232 | |
Takashi Iwai | d681518 | 2006-03-23 16:06:23 +0100 | [diff] [blame] | 2233 | /* set capture source to mic-in */ |
| 2234 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 2235 | {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 2236 | {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
Takashi Iwai | cb53c62 | 2007-08-10 17:21:45 +0200 | [diff] [blame] | 2237 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(7)}, |
Takashi Iwai | d681518 | 2006-03-23 16:06:23 +0100 | [diff] [blame] | 2238 | /* speaker-out */ |
| 2239 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 2240 | {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 2241 | /* HP-out */ |
Takashi Iwai | d681518 | 2006-03-23 16:06:23 +0100 | [diff] [blame] | 2242 | {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 2243 | {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 2244 | /* mic-in to input */ |
| 2245 | {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80}, |
| 2246 | {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 2247 | /* built-in mic */ |
| 2248 | {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80}, |
| 2249 | {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 2250 | /* jack sense */ |
| 2251 | {0x1b, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | 0x1}, |
| 2252 | { } |
| 2253 | }; |
| 2254 | |
| 2255 | /* toggle speaker-output according to the hp-jack state */ |
| 2256 | static void alc880_lg_lw_automute(struct hda_codec *codec) |
| 2257 | { |
| 2258 | unsigned int present; |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 2259 | unsigned char bits; |
Takashi Iwai | d681518 | 2006-03-23 16:06:23 +0100 | [diff] [blame] | 2260 | |
| 2261 | present = snd_hda_codec_read(codec, 0x1b, 0, |
| 2262 | AC_VERB_GET_PIN_SENSE, 0) & 0x80000000; |
Takashi Iwai | 47fd830 | 2007-08-10 17:11:07 +0200 | [diff] [blame] | 2263 | bits = present ? HDA_AMP_MUTE : 0; |
| 2264 | snd_hda_codec_amp_stereo(codec, 0x14, HDA_OUTPUT, 0, |
| 2265 | HDA_AMP_MUTE, bits); |
Takashi Iwai | d681518 | 2006-03-23 16:06:23 +0100 | [diff] [blame] | 2266 | } |
| 2267 | |
| 2268 | static void alc880_lg_lw_unsol_event(struct hda_codec *codec, unsigned int res) |
| 2269 | { |
| 2270 | /* Looks like the unsol event is incompatible with the standard |
| 2271 | * definition. 4bit tag is placed at 28 bit! |
| 2272 | */ |
| 2273 | if ((res >> 28) == 0x01) |
| 2274 | alc880_lg_lw_automute(codec); |
| 2275 | } |
| 2276 | |
Takashi Iwai | cb53c62 | 2007-08-10 17:21:45 +0200 | [diff] [blame] | 2277 | #ifdef CONFIG_SND_HDA_POWER_SAVE |
| 2278 | static struct hda_amp_list alc880_loopbacks[] = { |
| 2279 | { 0x0b, HDA_INPUT, 0 }, |
| 2280 | { 0x0b, HDA_INPUT, 1 }, |
| 2281 | { 0x0b, HDA_INPUT, 2 }, |
| 2282 | { 0x0b, HDA_INPUT, 3 }, |
| 2283 | { 0x0b, HDA_INPUT, 4 }, |
| 2284 | { } /* end */ |
| 2285 | }; |
| 2286 | |
| 2287 | static struct hda_amp_list alc880_lg_loopbacks[] = { |
| 2288 | { 0x0b, HDA_INPUT, 1 }, |
| 2289 | { 0x0b, HDA_INPUT, 6 }, |
| 2290 | { 0x0b, HDA_INPUT, 7 }, |
| 2291 | { } /* end */ |
| 2292 | }; |
| 2293 | #endif |
| 2294 | |
Takashi Iwai | d681518 | 2006-03-23 16:06:23 +0100 | [diff] [blame] | 2295 | /* |
Takashi Iwai | ae6b813 | 2006-03-03 16:47:17 +0100 | [diff] [blame] | 2296 | * Common callbacks |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 2297 | */ |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 2298 | |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 2299 | static int alc_init(struct hda_codec *codec) |
| 2300 | { |
| 2301 | struct alc_spec *spec = codec->spec; |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 2302 | unsigned int i; |
| 2303 | |
| 2304 | for (i = 0; i < spec->num_init_verbs; i++) |
| 2305 | snd_hda_sequence_write(codec, spec->init_verbs[i]); |
Takashi Iwai | ae6b813 | 2006-03-03 16:47:17 +0100 | [diff] [blame] | 2306 | |
| 2307 | if (spec->init_hook) |
| 2308 | spec->init_hook(codec); |
| 2309 | |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 2310 | return 0; |
| 2311 | } |
| 2312 | |
Takashi Iwai | ae6b813 | 2006-03-03 16:47:17 +0100 | [diff] [blame] | 2313 | static void alc_unsol_event(struct hda_codec *codec, unsigned int res) |
| 2314 | { |
| 2315 | struct alc_spec *spec = codec->spec; |
| 2316 | |
| 2317 | if (spec->unsol_event) |
| 2318 | spec->unsol_event(codec, res); |
| 2319 | } |
| 2320 | |
Takashi Iwai | cb53c62 | 2007-08-10 17:21:45 +0200 | [diff] [blame] | 2321 | #ifdef CONFIG_SND_HDA_POWER_SAVE |
| 2322 | static int alc_check_power_status(struct hda_codec *codec, hda_nid_t nid) |
| 2323 | { |
| 2324 | struct alc_spec *spec = codec->spec; |
| 2325 | return snd_hda_check_amp_list_power(codec, &spec->loopback, nid); |
| 2326 | } |
| 2327 | #endif |
| 2328 | |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 2329 | /* |
| 2330 | * Analog playback callbacks |
| 2331 | */ |
| 2332 | static int alc880_playback_pcm_open(struct hda_pcm_stream *hinfo, |
| 2333 | struct hda_codec *codec, |
Takashi Iwai | c8b6bf9 | 2005-11-17 14:57:47 +0100 | [diff] [blame] | 2334 | struct snd_pcm_substream *substream) |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 2335 | { |
| 2336 | struct alc_spec *spec = codec->spec; |
Takashi Iwai | 9a08160 | 2008-02-12 18:37:26 +0100 | [diff] [blame] | 2337 | return snd_hda_multi_out_analog_open(codec, &spec->multiout, substream, |
| 2338 | hinfo); |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 2339 | } |
| 2340 | |
| 2341 | static int alc880_playback_pcm_prepare(struct hda_pcm_stream *hinfo, |
| 2342 | struct hda_codec *codec, |
| 2343 | unsigned int stream_tag, |
| 2344 | unsigned int format, |
Takashi Iwai | c8b6bf9 | 2005-11-17 14:57:47 +0100 | [diff] [blame] | 2345 | struct snd_pcm_substream *substream) |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 2346 | { |
| 2347 | struct alc_spec *spec = codec->spec; |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 2348 | return snd_hda_multi_out_analog_prepare(codec, &spec->multiout, |
| 2349 | stream_tag, format, substream); |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 2350 | } |
| 2351 | |
| 2352 | static int alc880_playback_pcm_cleanup(struct hda_pcm_stream *hinfo, |
| 2353 | struct hda_codec *codec, |
Takashi Iwai | c8b6bf9 | 2005-11-17 14:57:47 +0100 | [diff] [blame] | 2354 | struct snd_pcm_substream *substream) |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 2355 | { |
| 2356 | struct alc_spec *spec = codec->spec; |
| 2357 | return snd_hda_multi_out_analog_cleanup(codec, &spec->multiout); |
| 2358 | } |
| 2359 | |
| 2360 | /* |
| 2361 | * Digital out |
| 2362 | */ |
| 2363 | static int alc880_dig_playback_pcm_open(struct hda_pcm_stream *hinfo, |
| 2364 | struct hda_codec *codec, |
Takashi Iwai | c8b6bf9 | 2005-11-17 14:57:47 +0100 | [diff] [blame] | 2365 | struct snd_pcm_substream *substream) |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 2366 | { |
| 2367 | struct alc_spec *spec = codec->spec; |
| 2368 | return snd_hda_multi_out_dig_open(codec, &spec->multiout); |
| 2369 | } |
| 2370 | |
Takashi Iwai | 6b97eb4 | 2007-04-05 14:51:48 +0200 | [diff] [blame] | 2371 | static int alc880_dig_playback_pcm_prepare(struct hda_pcm_stream *hinfo, |
| 2372 | struct hda_codec *codec, |
| 2373 | unsigned int stream_tag, |
| 2374 | unsigned int format, |
| 2375 | struct snd_pcm_substream *substream) |
| 2376 | { |
| 2377 | struct alc_spec *spec = codec->spec; |
| 2378 | return snd_hda_multi_out_dig_prepare(codec, &spec->multiout, |
| 2379 | stream_tag, format, substream); |
| 2380 | } |
| 2381 | |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 2382 | static int alc880_dig_playback_pcm_close(struct hda_pcm_stream *hinfo, |
| 2383 | struct hda_codec *codec, |
Takashi Iwai | c8b6bf9 | 2005-11-17 14:57:47 +0100 | [diff] [blame] | 2384 | struct snd_pcm_substream *substream) |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 2385 | { |
| 2386 | struct alc_spec *spec = codec->spec; |
| 2387 | return snd_hda_multi_out_dig_close(codec, &spec->multiout); |
| 2388 | } |
| 2389 | |
| 2390 | /* |
| 2391 | * Analog capture |
| 2392 | */ |
Takashi Iwai | 6330079 | 2008-01-24 15:31:36 +0100 | [diff] [blame] | 2393 | static int alc880_alt_capture_pcm_prepare(struct hda_pcm_stream *hinfo, |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 2394 | struct hda_codec *codec, |
| 2395 | unsigned int stream_tag, |
| 2396 | unsigned int format, |
Takashi Iwai | c8b6bf9 | 2005-11-17 14:57:47 +0100 | [diff] [blame] | 2397 | struct snd_pcm_substream *substream) |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 2398 | { |
| 2399 | struct alc_spec *spec = codec->spec; |
| 2400 | |
Takashi Iwai | 6330079 | 2008-01-24 15:31:36 +0100 | [diff] [blame] | 2401 | snd_hda_codec_setup_stream(codec, spec->adc_nids[substream->number + 1], |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 2402 | stream_tag, 0, format); |
| 2403 | return 0; |
| 2404 | } |
| 2405 | |
Takashi Iwai | 6330079 | 2008-01-24 15:31:36 +0100 | [diff] [blame] | 2406 | static int alc880_alt_capture_pcm_cleanup(struct hda_pcm_stream *hinfo, |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 2407 | struct hda_codec *codec, |
Takashi Iwai | c8b6bf9 | 2005-11-17 14:57:47 +0100 | [diff] [blame] | 2408 | struct snd_pcm_substream *substream) |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 2409 | { |
| 2410 | struct alc_spec *spec = codec->spec; |
| 2411 | |
Takashi Iwai | 888afa1 | 2008-03-18 09:57:50 +0100 | [diff] [blame] | 2412 | snd_hda_codec_cleanup_stream(codec, |
| 2413 | spec->adc_nids[substream->number + 1]); |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 2414 | return 0; |
| 2415 | } |
| 2416 | |
| 2417 | |
| 2418 | /* |
| 2419 | */ |
| 2420 | static struct hda_pcm_stream alc880_pcm_analog_playback = { |
| 2421 | .substreams = 1, |
| 2422 | .channels_min = 2, |
| 2423 | .channels_max = 8, |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 2424 | /* NID is set in alc_build_pcms */ |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 2425 | .ops = { |
| 2426 | .open = alc880_playback_pcm_open, |
| 2427 | .prepare = alc880_playback_pcm_prepare, |
| 2428 | .cleanup = alc880_playback_pcm_cleanup |
| 2429 | }, |
| 2430 | }; |
| 2431 | |
| 2432 | static struct hda_pcm_stream alc880_pcm_analog_capture = { |
Takashi Iwai | 6330079 | 2008-01-24 15:31:36 +0100 | [diff] [blame] | 2433 | .substreams = 1, |
| 2434 | .channels_min = 2, |
| 2435 | .channels_max = 2, |
| 2436 | /* NID is set in alc_build_pcms */ |
| 2437 | }; |
| 2438 | |
| 2439 | static struct hda_pcm_stream alc880_pcm_analog_alt_playback = { |
| 2440 | .substreams = 1, |
| 2441 | .channels_min = 2, |
| 2442 | .channels_max = 2, |
| 2443 | /* NID is set in alc_build_pcms */ |
| 2444 | }; |
| 2445 | |
| 2446 | static struct hda_pcm_stream alc880_pcm_analog_alt_capture = { |
| 2447 | .substreams = 2, /* can be overridden */ |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 2448 | .channels_min = 2, |
| 2449 | .channels_max = 2, |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 2450 | /* NID is set in alc_build_pcms */ |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 2451 | .ops = { |
Takashi Iwai | 6330079 | 2008-01-24 15:31:36 +0100 | [diff] [blame] | 2452 | .prepare = alc880_alt_capture_pcm_prepare, |
| 2453 | .cleanup = alc880_alt_capture_pcm_cleanup |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 2454 | }, |
| 2455 | }; |
| 2456 | |
| 2457 | static struct hda_pcm_stream alc880_pcm_digital_playback = { |
| 2458 | .substreams = 1, |
| 2459 | .channels_min = 2, |
| 2460 | .channels_max = 2, |
| 2461 | /* NID is set in alc_build_pcms */ |
| 2462 | .ops = { |
| 2463 | .open = alc880_dig_playback_pcm_open, |
Takashi Iwai | 6b97eb4 | 2007-04-05 14:51:48 +0200 | [diff] [blame] | 2464 | .close = alc880_dig_playback_pcm_close, |
| 2465 | .prepare = alc880_dig_playback_pcm_prepare |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 2466 | }, |
| 2467 | }; |
| 2468 | |
| 2469 | static struct hda_pcm_stream alc880_pcm_digital_capture = { |
| 2470 | .substreams = 1, |
| 2471 | .channels_min = 2, |
| 2472 | .channels_max = 2, |
| 2473 | /* NID is set in alc_build_pcms */ |
| 2474 | }; |
| 2475 | |
Jonathan Woithe | 4c5186e | 2006-02-09 11:53:48 +0100 | [diff] [blame] | 2476 | /* Used by alc_build_pcms to flag that a PCM has no playback stream */ |
Takashi Iwai | 6330079 | 2008-01-24 15:31:36 +0100 | [diff] [blame] | 2477 | static struct hda_pcm_stream alc_pcm_null_stream = { |
Jonathan Woithe | 4c5186e | 2006-02-09 11:53:48 +0100 | [diff] [blame] | 2478 | .substreams = 0, |
| 2479 | .channels_min = 0, |
| 2480 | .channels_max = 0, |
| 2481 | }; |
| 2482 | |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 2483 | static int alc_build_pcms(struct hda_codec *codec) |
| 2484 | { |
| 2485 | struct alc_spec *spec = codec->spec; |
| 2486 | struct hda_pcm *info = spec->pcm_rec; |
| 2487 | int i; |
| 2488 | |
| 2489 | codec->num_pcms = 1; |
| 2490 | codec->pcm_info = info; |
| 2491 | |
| 2492 | info->name = spec->stream_name_analog; |
Takashi Iwai | 4a471b7 | 2005-12-07 13:56:29 +0100 | [diff] [blame] | 2493 | if (spec->stream_analog_playback) { |
| 2494 | snd_assert(spec->multiout.dac_nids, return -EINVAL); |
| 2495 | info->stream[SNDRV_PCM_STREAM_PLAYBACK] = *(spec->stream_analog_playback); |
| 2496 | info->stream[SNDRV_PCM_STREAM_PLAYBACK].nid = spec->multiout.dac_nids[0]; |
| 2497 | } |
| 2498 | if (spec->stream_analog_capture) { |
| 2499 | snd_assert(spec->adc_nids, return -EINVAL); |
| 2500 | info->stream[SNDRV_PCM_STREAM_CAPTURE] = *(spec->stream_analog_capture); |
| 2501 | info->stream[SNDRV_PCM_STREAM_CAPTURE].nid = spec->adc_nids[0]; |
| 2502 | } |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 2503 | |
Takashi Iwai | 4a471b7 | 2005-12-07 13:56:29 +0100 | [diff] [blame] | 2504 | if (spec->channel_mode) { |
| 2505 | info->stream[SNDRV_PCM_STREAM_PLAYBACK].channels_max = 0; |
| 2506 | for (i = 0; i < spec->num_channel_mode; i++) { |
| 2507 | if (spec->channel_mode[i].channels > info->stream[SNDRV_PCM_STREAM_PLAYBACK].channels_max) { |
| 2508 | info->stream[SNDRV_PCM_STREAM_PLAYBACK].channels_max = spec->channel_mode[i].channels; |
| 2509 | } |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 2510 | } |
| 2511 | } |
| 2512 | |
Takashi Iwai | e08a007 | 2006-09-07 17:52:14 +0200 | [diff] [blame] | 2513 | /* SPDIF for stream index #1 */ |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 2514 | if (spec->multiout.dig_out_nid || spec->dig_in_nid) { |
Takashi Iwai | e08a007 | 2006-09-07 17:52:14 +0200 | [diff] [blame] | 2515 | codec->num_pcms = 2; |
Takashi Iwai | c06134d | 2006-10-11 18:49:13 +0200 | [diff] [blame] | 2516 | info = spec->pcm_rec + 1; |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 2517 | info->name = spec->stream_name_digital; |
Takashi Iwai | 7ba72ba | 2008-02-06 14:03:20 +0100 | [diff] [blame] | 2518 | info->pcm_type = HDA_PCM_TYPE_SPDIF; |
Takashi Iwai | 4a471b7 | 2005-12-07 13:56:29 +0100 | [diff] [blame] | 2519 | if (spec->multiout.dig_out_nid && |
| 2520 | spec->stream_digital_playback) { |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 2521 | info->stream[SNDRV_PCM_STREAM_PLAYBACK] = *(spec->stream_digital_playback); |
| 2522 | info->stream[SNDRV_PCM_STREAM_PLAYBACK].nid = spec->multiout.dig_out_nid; |
| 2523 | } |
Takashi Iwai | 4a471b7 | 2005-12-07 13:56:29 +0100 | [diff] [blame] | 2524 | if (spec->dig_in_nid && |
| 2525 | spec->stream_digital_capture) { |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 2526 | info->stream[SNDRV_PCM_STREAM_CAPTURE] = *(spec->stream_digital_capture); |
| 2527 | info->stream[SNDRV_PCM_STREAM_CAPTURE].nid = spec->dig_in_nid; |
| 2528 | } |
| 2529 | } |
| 2530 | |
Takashi Iwai | e08a007 | 2006-09-07 17:52:14 +0200 | [diff] [blame] | 2531 | /* If the use of more than one ADC is requested for the current |
| 2532 | * model, configure a second analog capture-only PCM. |
| 2533 | */ |
| 2534 | /* Additional Analaog capture for index #2 */ |
Takashi Iwai | 6330079 | 2008-01-24 15:31:36 +0100 | [diff] [blame] | 2535 | if ((spec->alt_dac_nid && spec->stream_analog_alt_playback) || |
| 2536 | (spec->num_adc_nids > 1 && spec->stream_analog_alt_capture)) { |
Takashi Iwai | e08a007 | 2006-09-07 17:52:14 +0200 | [diff] [blame] | 2537 | codec->num_pcms = 3; |
Takashi Iwai | c06134d | 2006-10-11 18:49:13 +0200 | [diff] [blame] | 2538 | info = spec->pcm_rec + 2; |
Takashi Iwai | e08a007 | 2006-09-07 17:52:14 +0200 | [diff] [blame] | 2539 | info->name = spec->stream_name_analog; |
Takashi Iwai | 6330079 | 2008-01-24 15:31:36 +0100 | [diff] [blame] | 2540 | if (spec->alt_dac_nid) { |
| 2541 | info->stream[SNDRV_PCM_STREAM_PLAYBACK] = |
| 2542 | *spec->stream_analog_alt_playback; |
| 2543 | info->stream[SNDRV_PCM_STREAM_PLAYBACK].nid = |
| 2544 | spec->alt_dac_nid; |
| 2545 | } else { |
| 2546 | info->stream[SNDRV_PCM_STREAM_PLAYBACK] = |
| 2547 | alc_pcm_null_stream; |
| 2548 | info->stream[SNDRV_PCM_STREAM_PLAYBACK].nid = 0; |
| 2549 | } |
| 2550 | if (spec->num_adc_nids > 1) { |
| 2551 | info->stream[SNDRV_PCM_STREAM_CAPTURE] = |
| 2552 | *spec->stream_analog_alt_capture; |
| 2553 | info->stream[SNDRV_PCM_STREAM_CAPTURE].nid = |
| 2554 | spec->adc_nids[1]; |
| 2555 | info->stream[SNDRV_PCM_STREAM_CAPTURE].substreams = |
| 2556 | spec->num_adc_nids - 1; |
| 2557 | } else { |
| 2558 | info->stream[SNDRV_PCM_STREAM_CAPTURE] = |
| 2559 | alc_pcm_null_stream; |
| 2560 | info->stream[SNDRV_PCM_STREAM_CAPTURE].nid = 0; |
Takashi Iwai | e08a007 | 2006-09-07 17:52:14 +0200 | [diff] [blame] | 2561 | } |
| 2562 | } |
| 2563 | |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 2564 | return 0; |
| 2565 | } |
| 2566 | |
| 2567 | static void alc_free(struct hda_codec *codec) |
| 2568 | { |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 2569 | struct alc_spec *spec = codec->spec; |
| 2570 | unsigned int i; |
| 2571 | |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 2572 | if (!spec) |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 2573 | return; |
| 2574 | |
| 2575 | if (spec->kctl_alloc) { |
| 2576 | for (i = 0; i < spec->num_kctl_used; i++) |
| 2577 | kfree(spec->kctl_alloc[i].name); |
| 2578 | kfree(spec->kctl_alloc); |
| 2579 | } |
| 2580 | kfree(spec); |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 2581 | } |
| 2582 | |
| 2583 | /* |
| 2584 | */ |
| 2585 | static struct hda_codec_ops alc_patch_ops = { |
| 2586 | .build_controls = alc_build_controls, |
| 2587 | .build_pcms = alc_build_pcms, |
| 2588 | .init = alc_init, |
| 2589 | .free = alc_free, |
Takashi Iwai | ae6b813 | 2006-03-03 16:47:17 +0100 | [diff] [blame] | 2590 | .unsol_event = alc_unsol_event, |
Takashi Iwai | cb53c62 | 2007-08-10 17:21:45 +0200 | [diff] [blame] | 2591 | #ifdef CONFIG_SND_HDA_POWER_SAVE |
| 2592 | .check_power_status = alc_check_power_status, |
| 2593 | #endif |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 2594 | }; |
| 2595 | |
Takashi Iwai | 2fa522b | 2005-05-12 14:51:12 +0200 | [diff] [blame] | 2596 | |
| 2597 | /* |
| 2598 | * Test configuration for debugging |
| 2599 | * |
| 2600 | * Almost all inputs/outputs are enabled. I/O pins can be configured via |
| 2601 | * enum controls. |
| 2602 | */ |
| 2603 | #ifdef CONFIG_SND_DEBUG |
| 2604 | static hda_nid_t alc880_test_dac_nids[4] = { |
| 2605 | 0x02, 0x03, 0x04, 0x05 |
| 2606 | }; |
| 2607 | |
| 2608 | static struct hda_input_mux alc880_test_capture_source = { |
Takashi Iwai | ae6b813 | 2006-03-03 16:47:17 +0100 | [diff] [blame] | 2609 | .num_items = 7, |
Takashi Iwai | 2fa522b | 2005-05-12 14:51:12 +0200 | [diff] [blame] | 2610 | .items = { |
| 2611 | { "In-1", 0x0 }, |
| 2612 | { "In-2", 0x1 }, |
| 2613 | { "In-3", 0x2 }, |
| 2614 | { "In-4", 0x3 }, |
| 2615 | { "CD", 0x4 }, |
Takashi Iwai | ae6b813 | 2006-03-03 16:47:17 +0100 | [diff] [blame] | 2616 | { "Front", 0x5 }, |
| 2617 | { "Surround", 0x6 }, |
Takashi Iwai | 2fa522b | 2005-05-12 14:51:12 +0200 | [diff] [blame] | 2618 | }, |
| 2619 | }; |
| 2620 | |
Takashi Iwai | d2a6d7d | 2005-11-17 11:06:29 +0100 | [diff] [blame] | 2621 | static struct hda_channel_mode alc880_test_modes[4] = { |
Takashi Iwai | 2fa522b | 2005-05-12 14:51:12 +0200 | [diff] [blame] | 2622 | { 2, NULL }, |
Takashi Iwai | fd2c326 | 2005-05-13 17:18:42 +0200 | [diff] [blame] | 2623 | { 4, NULL }, |
Takashi Iwai | 2fa522b | 2005-05-12 14:51:12 +0200 | [diff] [blame] | 2624 | { 6, NULL }, |
Takashi Iwai | fd2c326 | 2005-05-13 17:18:42 +0200 | [diff] [blame] | 2625 | { 8, NULL }, |
Takashi Iwai | 2fa522b | 2005-05-12 14:51:12 +0200 | [diff] [blame] | 2626 | }; |
| 2627 | |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 2628 | static int alc_test_pin_ctl_info(struct snd_kcontrol *kcontrol, |
| 2629 | struct snd_ctl_elem_info *uinfo) |
Takashi Iwai | 2fa522b | 2005-05-12 14:51:12 +0200 | [diff] [blame] | 2630 | { |
| 2631 | static char *texts[] = { |
| 2632 | "N/A", "Line Out", "HP Out", |
| 2633 | "In Hi-Z", "In 50%", "In Grd", "In 80%", "In 100%" |
| 2634 | }; |
| 2635 | uinfo->type = SNDRV_CTL_ELEM_TYPE_ENUMERATED; |
| 2636 | uinfo->count = 1; |
| 2637 | uinfo->value.enumerated.items = 8; |
| 2638 | if (uinfo->value.enumerated.item >= 8) |
| 2639 | uinfo->value.enumerated.item = 7; |
| 2640 | strcpy(uinfo->value.enumerated.name, texts[uinfo->value.enumerated.item]); |
| 2641 | return 0; |
| 2642 | } |
| 2643 | |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 2644 | static int alc_test_pin_ctl_get(struct snd_kcontrol *kcontrol, |
| 2645 | struct snd_ctl_elem_value *ucontrol) |
Takashi Iwai | 2fa522b | 2005-05-12 14:51:12 +0200 | [diff] [blame] | 2646 | { |
| 2647 | struct hda_codec *codec = snd_kcontrol_chip(kcontrol); |
| 2648 | hda_nid_t nid = (hda_nid_t)kcontrol->private_value; |
| 2649 | unsigned int pin_ctl, item = 0; |
| 2650 | |
| 2651 | pin_ctl = snd_hda_codec_read(codec, nid, 0, |
| 2652 | AC_VERB_GET_PIN_WIDGET_CONTROL, 0); |
| 2653 | if (pin_ctl & AC_PINCTL_OUT_EN) { |
| 2654 | if (pin_ctl & AC_PINCTL_HP_EN) |
| 2655 | item = 2; |
| 2656 | else |
| 2657 | item = 1; |
| 2658 | } else if (pin_ctl & AC_PINCTL_IN_EN) { |
| 2659 | switch (pin_ctl & AC_PINCTL_VREFEN) { |
| 2660 | case AC_PINCTL_VREF_HIZ: item = 3; break; |
| 2661 | case AC_PINCTL_VREF_50: item = 4; break; |
| 2662 | case AC_PINCTL_VREF_GRD: item = 5; break; |
| 2663 | case AC_PINCTL_VREF_80: item = 6; break; |
| 2664 | case AC_PINCTL_VREF_100: item = 7; break; |
| 2665 | } |
| 2666 | } |
| 2667 | ucontrol->value.enumerated.item[0] = item; |
| 2668 | return 0; |
| 2669 | } |
| 2670 | |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 2671 | static int alc_test_pin_ctl_put(struct snd_kcontrol *kcontrol, |
| 2672 | struct snd_ctl_elem_value *ucontrol) |
Takashi Iwai | 2fa522b | 2005-05-12 14:51:12 +0200 | [diff] [blame] | 2673 | { |
| 2674 | struct hda_codec *codec = snd_kcontrol_chip(kcontrol); |
| 2675 | hda_nid_t nid = (hda_nid_t)kcontrol->private_value; |
| 2676 | static unsigned int ctls[] = { |
| 2677 | 0, AC_PINCTL_OUT_EN, AC_PINCTL_OUT_EN | AC_PINCTL_HP_EN, |
| 2678 | AC_PINCTL_IN_EN | AC_PINCTL_VREF_HIZ, |
| 2679 | AC_PINCTL_IN_EN | AC_PINCTL_VREF_50, |
| 2680 | AC_PINCTL_IN_EN | AC_PINCTL_VREF_GRD, |
| 2681 | AC_PINCTL_IN_EN | AC_PINCTL_VREF_80, |
| 2682 | AC_PINCTL_IN_EN | AC_PINCTL_VREF_100, |
| 2683 | }; |
| 2684 | unsigned int old_ctl, new_ctl; |
| 2685 | |
| 2686 | old_ctl = snd_hda_codec_read(codec, nid, 0, |
| 2687 | AC_VERB_GET_PIN_WIDGET_CONTROL, 0); |
| 2688 | new_ctl = ctls[ucontrol->value.enumerated.item[0]]; |
| 2689 | if (old_ctl != new_ctl) { |
Takashi Iwai | 82beb8f | 2007-08-10 17:09:26 +0200 | [diff] [blame] | 2690 | int val; |
| 2691 | snd_hda_codec_write_cache(codec, nid, 0, |
| 2692 | AC_VERB_SET_PIN_WIDGET_CONTROL, |
| 2693 | new_ctl); |
Takashi Iwai | 47fd830 | 2007-08-10 17:11:07 +0200 | [diff] [blame] | 2694 | val = ucontrol->value.enumerated.item[0] >= 3 ? |
| 2695 | HDA_AMP_MUTE : 0; |
| 2696 | snd_hda_codec_amp_stereo(codec, nid, HDA_OUTPUT, 0, |
| 2697 | HDA_AMP_MUTE, val); |
Takashi Iwai | 2fa522b | 2005-05-12 14:51:12 +0200 | [diff] [blame] | 2698 | return 1; |
| 2699 | } |
| 2700 | return 0; |
| 2701 | } |
| 2702 | |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 2703 | static int alc_test_pin_src_info(struct snd_kcontrol *kcontrol, |
| 2704 | struct snd_ctl_elem_info *uinfo) |
Takashi Iwai | 2fa522b | 2005-05-12 14:51:12 +0200 | [diff] [blame] | 2705 | { |
| 2706 | static char *texts[] = { |
| 2707 | "Front", "Surround", "CLFE", "Side" |
| 2708 | }; |
| 2709 | uinfo->type = SNDRV_CTL_ELEM_TYPE_ENUMERATED; |
| 2710 | uinfo->count = 1; |
| 2711 | uinfo->value.enumerated.items = 4; |
| 2712 | if (uinfo->value.enumerated.item >= 4) |
| 2713 | uinfo->value.enumerated.item = 3; |
| 2714 | strcpy(uinfo->value.enumerated.name, texts[uinfo->value.enumerated.item]); |
| 2715 | return 0; |
| 2716 | } |
| 2717 | |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 2718 | static int alc_test_pin_src_get(struct snd_kcontrol *kcontrol, |
| 2719 | struct snd_ctl_elem_value *ucontrol) |
Takashi Iwai | 2fa522b | 2005-05-12 14:51:12 +0200 | [diff] [blame] | 2720 | { |
| 2721 | struct hda_codec *codec = snd_kcontrol_chip(kcontrol); |
| 2722 | hda_nid_t nid = (hda_nid_t)kcontrol->private_value; |
| 2723 | unsigned int sel; |
| 2724 | |
| 2725 | sel = snd_hda_codec_read(codec, nid, 0, AC_VERB_GET_CONNECT_SEL, 0); |
| 2726 | ucontrol->value.enumerated.item[0] = sel & 3; |
| 2727 | return 0; |
| 2728 | } |
| 2729 | |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 2730 | static int alc_test_pin_src_put(struct snd_kcontrol *kcontrol, |
| 2731 | struct snd_ctl_elem_value *ucontrol) |
Takashi Iwai | 2fa522b | 2005-05-12 14:51:12 +0200 | [diff] [blame] | 2732 | { |
| 2733 | struct hda_codec *codec = snd_kcontrol_chip(kcontrol); |
| 2734 | hda_nid_t nid = (hda_nid_t)kcontrol->private_value; |
| 2735 | unsigned int sel; |
| 2736 | |
| 2737 | sel = snd_hda_codec_read(codec, nid, 0, AC_VERB_GET_CONNECT_SEL, 0) & 3; |
| 2738 | if (ucontrol->value.enumerated.item[0] != sel) { |
| 2739 | sel = ucontrol->value.enumerated.item[0] & 3; |
Takashi Iwai | 82beb8f | 2007-08-10 17:09:26 +0200 | [diff] [blame] | 2740 | snd_hda_codec_write_cache(codec, nid, 0, |
| 2741 | AC_VERB_SET_CONNECT_SEL, sel); |
Takashi Iwai | 2fa522b | 2005-05-12 14:51:12 +0200 | [diff] [blame] | 2742 | return 1; |
| 2743 | } |
| 2744 | return 0; |
| 2745 | } |
| 2746 | |
| 2747 | #define PIN_CTL_TEST(xname,nid) { \ |
| 2748 | .iface = SNDRV_CTL_ELEM_IFACE_MIXER, \ |
| 2749 | .name = xname, \ |
| 2750 | .info = alc_test_pin_ctl_info, \ |
| 2751 | .get = alc_test_pin_ctl_get, \ |
| 2752 | .put = alc_test_pin_ctl_put, \ |
| 2753 | .private_value = nid \ |
| 2754 | } |
| 2755 | |
| 2756 | #define PIN_SRC_TEST(xname,nid) { \ |
| 2757 | .iface = SNDRV_CTL_ELEM_IFACE_MIXER, \ |
| 2758 | .name = xname, \ |
| 2759 | .info = alc_test_pin_src_info, \ |
| 2760 | .get = alc_test_pin_src_get, \ |
| 2761 | .put = alc_test_pin_src_put, \ |
| 2762 | .private_value = nid \ |
| 2763 | } |
| 2764 | |
Takashi Iwai | c8b6bf9 | 2005-11-17 14:57:47 +0100 | [diff] [blame] | 2765 | static struct snd_kcontrol_new alc880_test_mixer[] = { |
Takashi Iwai | 05acb86 | 2005-06-10 19:50:25 +0200 | [diff] [blame] | 2766 | HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT), |
| 2767 | HDA_CODEC_VOLUME("Surround Playback Volume", 0x0d, 0x0, HDA_OUTPUT), |
| 2768 | HDA_CODEC_VOLUME("CLFE Playback Volume", 0x0e, 0x0, HDA_OUTPUT), |
| 2769 | HDA_CODEC_VOLUME("Side Playback Volume", 0x0f, 0x0, HDA_OUTPUT), |
Takashi Iwai | 985be54 | 2005-11-02 18:26:49 +0100 | [diff] [blame] | 2770 | HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT), |
| 2771 | HDA_BIND_MUTE("Surround Playback Switch", 0x0d, 2, HDA_INPUT), |
| 2772 | HDA_BIND_MUTE("CLFE Playback Switch", 0x0e, 2, HDA_INPUT), |
| 2773 | HDA_BIND_MUTE("Side Playback Switch", 0x0f, 2, HDA_INPUT), |
Takashi Iwai | 2fa522b | 2005-05-12 14:51:12 +0200 | [diff] [blame] | 2774 | PIN_CTL_TEST("Front Pin Mode", 0x14), |
| 2775 | PIN_CTL_TEST("Surround Pin Mode", 0x15), |
| 2776 | PIN_CTL_TEST("CLFE Pin Mode", 0x16), |
| 2777 | PIN_CTL_TEST("Side Pin Mode", 0x17), |
| 2778 | PIN_CTL_TEST("In-1 Pin Mode", 0x18), |
| 2779 | PIN_CTL_TEST("In-2 Pin Mode", 0x19), |
| 2780 | PIN_CTL_TEST("In-3 Pin Mode", 0x1a), |
| 2781 | PIN_CTL_TEST("In-4 Pin Mode", 0x1b), |
| 2782 | PIN_SRC_TEST("In-1 Pin Source", 0x18), |
| 2783 | PIN_SRC_TEST("In-2 Pin Source", 0x19), |
| 2784 | PIN_SRC_TEST("In-3 Pin Source", 0x1a), |
| 2785 | PIN_SRC_TEST("In-4 Pin Source", 0x1b), |
| 2786 | HDA_CODEC_VOLUME("In-1 Playback Volume", 0x0b, 0x0, HDA_INPUT), |
| 2787 | HDA_CODEC_MUTE("In-1 Playback Switch", 0x0b, 0x0, HDA_INPUT), |
| 2788 | HDA_CODEC_VOLUME("In-2 Playback Volume", 0x0b, 0x1, HDA_INPUT), |
| 2789 | HDA_CODEC_MUTE("In-2 Playback Switch", 0x0b, 0x1, HDA_INPUT), |
| 2790 | HDA_CODEC_VOLUME("In-3 Playback Volume", 0x0b, 0x2, HDA_INPUT), |
| 2791 | HDA_CODEC_MUTE("In-3 Playback Switch", 0x0b, 0x2, HDA_INPUT), |
| 2792 | HDA_CODEC_VOLUME("In-4 Playback Volume", 0x0b, 0x3, HDA_INPUT), |
| 2793 | HDA_CODEC_MUTE("In-4 Playback Switch", 0x0b, 0x3, HDA_INPUT), |
| 2794 | HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x4, HDA_INPUT), |
| 2795 | HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x4, HDA_INPUT), |
Takashi Iwai | 2fa522b | 2005-05-12 14:51:12 +0200 | [diff] [blame] | 2796 | { |
| 2797 | .iface = SNDRV_CTL_ELEM_IFACE_MIXER, |
| 2798 | .name = "Channel Mode", |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 2799 | .info = alc_ch_mode_info, |
| 2800 | .get = alc_ch_mode_get, |
| 2801 | .put = alc_ch_mode_put, |
Takashi Iwai | 2fa522b | 2005-05-12 14:51:12 +0200 | [diff] [blame] | 2802 | }, |
| 2803 | { } /* end */ |
| 2804 | }; |
| 2805 | |
| 2806 | static struct hda_verb alc880_test_init_verbs[] = { |
| 2807 | /* Unmute inputs of 0x0c - 0x0f */ |
Takashi Iwai | 05acb86 | 2005-06-10 19:50:25 +0200 | [diff] [blame] | 2808 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 2809 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 2810 | {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 2811 | {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 2812 | {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 2813 | {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 2814 | {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 2815 | {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
Takashi Iwai | 2fa522b | 2005-05-12 14:51:12 +0200 | [diff] [blame] | 2816 | /* Vol output for 0x0c-0x0f */ |
Takashi Iwai | 05acb86 | 2005-06-10 19:50:25 +0200 | [diff] [blame] | 2817 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 2818 | {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 2819 | {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 2820 | {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
Takashi Iwai | 2fa522b | 2005-05-12 14:51:12 +0200 | [diff] [blame] | 2821 | /* Set output pins 0x14-0x17 */ |
Takashi Iwai | 05acb86 | 2005-06-10 19:50:25 +0200 | [diff] [blame] | 2822 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 2823 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 2824 | {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 2825 | {0x17, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
Takashi Iwai | 2fa522b | 2005-05-12 14:51:12 +0200 | [diff] [blame] | 2826 | /* Unmute output pins 0x14-0x17 */ |
Takashi Iwai | 05acb86 | 2005-06-10 19:50:25 +0200 | [diff] [blame] | 2827 | {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 2828 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 2829 | {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 2830 | {0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
Takashi Iwai | 2fa522b | 2005-05-12 14:51:12 +0200 | [diff] [blame] | 2831 | /* Set input pins 0x18-0x1c */ |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 2832 | {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80}, |
| 2833 | {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80}, |
Takashi Iwai | 05acb86 | 2005-06-10 19:50:25 +0200 | [diff] [blame] | 2834 | {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
| 2835 | {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
| 2836 | {0x1c, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
Takashi Iwai | 2fa522b | 2005-05-12 14:51:12 +0200 | [diff] [blame] | 2837 | /* Mute input pins 0x18-0x1b */ |
Takashi Iwai | 05acb86 | 2005-06-10 19:50:25 +0200 | [diff] [blame] | 2838 | {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
| 2839 | {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
| 2840 | {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
| 2841 | {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
Takashi Iwai | 71fe7b8 | 2005-05-25 18:11:40 +0200 | [diff] [blame] | 2842 | /* ADC set up */ |
Takashi Iwai | 05acb86 | 2005-06-10 19:50:25 +0200 | [diff] [blame] | 2843 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
Takashi Iwai | 71fe7b8 | 2005-05-25 18:11:40 +0200 | [diff] [blame] | 2844 | {0x07, AC_VERB_SET_CONNECT_SEL, 0x00}, |
Takashi Iwai | 05acb86 | 2005-06-10 19:50:25 +0200 | [diff] [blame] | 2845 | {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
Takashi Iwai | 71fe7b8 | 2005-05-25 18:11:40 +0200 | [diff] [blame] | 2846 | {0x08, AC_VERB_SET_CONNECT_SEL, 0x00}, |
Takashi Iwai | 05acb86 | 2005-06-10 19:50:25 +0200 | [diff] [blame] | 2847 | {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
Takashi Iwai | 71fe7b8 | 2005-05-25 18:11:40 +0200 | [diff] [blame] | 2848 | {0x09, AC_VERB_SET_CONNECT_SEL, 0x00}, |
Takashi Iwai | 05acb86 | 2005-06-10 19:50:25 +0200 | [diff] [blame] | 2849 | /* Analog input/passthru */ |
| 2850 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 2851 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
| 2852 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)}, |
| 2853 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)}, |
| 2854 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)}, |
Takashi Iwai | 2fa522b | 2005-05-12 14:51:12 +0200 | [diff] [blame] | 2855 | { } |
| 2856 | }; |
| 2857 | #endif |
| 2858 | |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 2859 | /* |
| 2860 | */ |
| 2861 | |
Takashi Iwai | f5fcc13 | 2006-11-24 17:07:44 +0100 | [diff] [blame] | 2862 | static const char *alc880_models[ALC880_MODEL_LAST] = { |
| 2863 | [ALC880_3ST] = "3stack", |
| 2864 | [ALC880_TCL_S700] = "tcl", |
| 2865 | [ALC880_3ST_DIG] = "3stack-digout", |
| 2866 | [ALC880_CLEVO] = "clevo", |
| 2867 | [ALC880_5ST] = "5stack", |
| 2868 | [ALC880_5ST_DIG] = "5stack-digout", |
| 2869 | [ALC880_W810] = "w810", |
| 2870 | [ALC880_Z71V] = "z71v", |
| 2871 | [ALC880_6ST] = "6stack", |
| 2872 | [ALC880_6ST_DIG] = "6stack-digout", |
| 2873 | [ALC880_ASUS] = "asus", |
| 2874 | [ALC880_ASUS_W1V] = "asus-w1v", |
| 2875 | [ALC880_ASUS_DIG] = "asus-dig", |
| 2876 | [ALC880_ASUS_DIG2] = "asus-dig2", |
| 2877 | [ALC880_UNIWILL_DIG] = "uniwill", |
Tobin Davis | 2cf9f0f | 2007-02-07 16:04:25 +0100 | [diff] [blame] | 2878 | [ALC880_UNIWILL_P53] = "uniwill-p53", |
| 2879 | [ALC880_FUJITSU] = "fujitsu", |
Takashi Iwai | f5fcc13 | 2006-11-24 17:07:44 +0100 | [diff] [blame] | 2880 | [ALC880_F1734] = "F1734", |
| 2881 | [ALC880_LG] = "lg", |
| 2882 | [ALC880_LG_LW] = "lg-lw", |
Takashi Iwai | 2fa522b | 2005-05-12 14:51:12 +0200 | [diff] [blame] | 2883 | #ifdef CONFIG_SND_DEBUG |
Takashi Iwai | f5fcc13 | 2006-11-24 17:07:44 +0100 | [diff] [blame] | 2884 | [ALC880_TEST] = "test", |
Takashi Iwai | 2fa522b | 2005-05-12 14:51:12 +0200 | [diff] [blame] | 2885 | #endif |
Takashi Iwai | f5fcc13 | 2006-11-24 17:07:44 +0100 | [diff] [blame] | 2886 | [ALC880_AUTO] = "auto", |
| 2887 | }; |
| 2888 | |
| 2889 | static struct snd_pci_quirk alc880_cfg_tbl[] = { |
Takashi Iwai | ac3e374 | 2007-12-17 17:14:18 +0100 | [diff] [blame] | 2890 | SND_PCI_QUIRK(0x1019, 0x0f69, "Coeus G610P", ALC880_W810), |
Takashi Iwai | f5fcc13 | 2006-11-24 17:07:44 +0100 | [diff] [blame] | 2891 | SND_PCI_QUIRK(0x1019, 0xa880, "ECS", ALC880_5ST_DIG), |
| 2892 | SND_PCI_QUIRK(0x1019, 0xa884, "Acer APFV", ALC880_6ST), |
| 2893 | SND_PCI_QUIRK(0x1025, 0x0070, "ULI", ALC880_3ST_DIG), |
| 2894 | SND_PCI_QUIRK(0x1025, 0x0077, "ULI", ALC880_6ST_DIG), |
| 2895 | SND_PCI_QUIRK(0x1025, 0x0078, "ULI", ALC880_6ST_DIG), |
| 2896 | SND_PCI_QUIRK(0x1025, 0x0087, "ULI", ALC880_6ST_DIG), |
| 2897 | SND_PCI_QUIRK(0x1025, 0xe309, "ULI", ALC880_3ST_DIG), |
| 2898 | SND_PCI_QUIRK(0x1025, 0xe310, "ULI", ALC880_3ST), |
Takashi Iwai | f5fcc13 | 2006-11-24 17:07:44 +0100 | [diff] [blame] | 2899 | SND_PCI_QUIRK(0x1039, 0x1234, NULL, ALC880_6ST_DIG), |
| 2900 | SND_PCI_QUIRK(0x103c, 0x2a09, "HP", ALC880_5ST), |
Takashi Iwai | f5fcc13 | 2006-11-24 17:07:44 +0100 | [diff] [blame] | 2901 | SND_PCI_QUIRK(0x1043, 0x10b3, "ASUS W1V", ALC880_ASUS_W1V), |
| 2902 | SND_PCI_QUIRK(0x1043, 0x10c2, "ASUS W6A", ALC880_ASUS_DIG), |
| 2903 | SND_PCI_QUIRK(0x1043, 0x10c3, "ASUS Wxx", ALC880_ASUS_DIG), |
| 2904 | SND_PCI_QUIRK(0x1043, 0x1113, "ASUS", ALC880_ASUS_DIG), |
| 2905 | SND_PCI_QUIRK(0x1043, 0x1123, "ASUS", ALC880_ASUS_DIG), |
| 2906 | SND_PCI_QUIRK(0x1043, 0x1173, "ASUS", ALC880_ASUS_DIG), |
| 2907 | SND_PCI_QUIRK(0x1043, 0x1964, "ASUS Z71V", ALC880_Z71V), |
| 2908 | /* SND_PCI_QUIRK(0x1043, 0x1964, "ASUS", ALC880_ASUS_DIG), */ |
| 2909 | SND_PCI_QUIRK(0x1043, 0x1973, "ASUS", ALC880_ASUS_DIG), |
| 2910 | SND_PCI_QUIRK(0x1043, 0x19b3, "ASUS", ALC880_ASUS_DIG), |
Tobin Davis | 0e4ceb7 | 2007-01-08 10:54:26 +0100 | [diff] [blame] | 2911 | SND_PCI_QUIRK(0x1043, 0x814e, "ASUS", ALC880_ASUS), |
Takashi Iwai | f5fcc13 | 2006-11-24 17:07:44 +0100 | [diff] [blame] | 2912 | SND_PCI_QUIRK(0x1043, 0x8181, "ASUS P4GPL", ALC880_ASUS_DIG), |
| 2913 | SND_PCI_QUIRK(0x1043, 0x8196, "ASUS P5GD1", ALC880_6ST), |
| 2914 | SND_PCI_QUIRK(0x1043, 0x81b4, "ASUS", ALC880_6ST), |
Takashi Iwai | ac3e374 | 2007-12-17 17:14:18 +0100 | [diff] [blame] | 2915 | SND_PCI_QUIRK(0x1043, 0, "ASUS", ALC880_ASUS), /* default ASUS */ |
Takashi Iwai | f5fcc13 | 2006-11-24 17:07:44 +0100 | [diff] [blame] | 2916 | SND_PCI_QUIRK(0x104d, 0x81a0, "Sony", ALC880_3ST), |
Takashi Iwai | ac3e374 | 2007-12-17 17:14:18 +0100 | [diff] [blame] | 2917 | SND_PCI_QUIRK(0x104d, 0x81d6, "Sony", ALC880_3ST), |
| 2918 | SND_PCI_QUIRK(0x107b, 0x3032, "Gateway", ALC880_5ST), |
Takashi Iwai | f5fcc13 | 2006-11-24 17:07:44 +0100 | [diff] [blame] | 2919 | SND_PCI_QUIRK(0x107b, 0x3033, "Gateway", ALC880_5ST), |
| 2920 | SND_PCI_QUIRK(0x107b, 0x4039, "Gateway", ALC880_5ST), |
Takashi Iwai | f5fcc13 | 2006-11-24 17:07:44 +0100 | [diff] [blame] | 2921 | SND_PCI_QUIRK(0x1297, 0xc790, "Shuttle ST20G5", ALC880_6ST_DIG), |
| 2922 | SND_PCI_QUIRK(0x1458, 0xa102, "Gigabyte K8", ALC880_6ST_DIG), |
| 2923 | SND_PCI_QUIRK(0x1462, 0x1150, "MSI", ALC880_6ST_DIG), |
| 2924 | SND_PCI_QUIRK(0x1509, 0x925d, "FIC P4M", ALC880_6ST_DIG), |
Takashi Iwai | ac3e374 | 2007-12-17 17:14:18 +0100 | [diff] [blame] | 2925 | SND_PCI_QUIRK(0x1558, 0x0520, "Clevo m520G", ALC880_CLEVO), |
| 2926 | SND_PCI_QUIRK(0x1558, 0x0660, "Clevo m655n", ALC880_CLEVO), |
Takashi Iwai | f5fcc13 | 2006-11-24 17:07:44 +0100 | [diff] [blame] | 2927 | SND_PCI_QUIRK(0x1558, 0x5401, "ASUS", ALC880_ASUS_DIG2), |
Takashi Iwai | ac3e374 | 2007-12-17 17:14:18 +0100 | [diff] [blame] | 2928 | SND_PCI_QUIRK(0x1565, 0x8202, "Biostar", ALC880_5ST_DIG), |
Takashi Iwai | f5fcc13 | 2006-11-24 17:07:44 +0100 | [diff] [blame] | 2929 | SND_PCI_QUIRK(0x1584, 0x9050, "Uniwill", ALC880_UNIWILL_DIG), |
Takashi Iwai | ac3e374 | 2007-12-17 17:14:18 +0100 | [diff] [blame] | 2930 | SND_PCI_QUIRK(0x1584, 0x9054, "Uniwlll", ALC880_F1734), |
Takashi Iwai | f5fcc13 | 2006-11-24 17:07:44 +0100 | [diff] [blame] | 2931 | SND_PCI_QUIRK(0x1584, 0x9070, "Uniwill", ALC880_UNIWILL), |
| 2932 | SND_PCI_QUIRK(0x1584, 0x9077, "Uniwill P53", ALC880_UNIWILL_P53), |
Takashi Iwai | ac3e374 | 2007-12-17 17:14:18 +0100 | [diff] [blame] | 2933 | SND_PCI_QUIRK(0x161f, 0x203d, "W810", ALC880_W810), |
| 2934 | SND_PCI_QUIRK(0x1695, 0x400d, "EPoX", ALC880_5ST_DIG), |
Takashi Iwai | f5fcc13 | 2006-11-24 17:07:44 +0100 | [diff] [blame] | 2935 | SND_PCI_QUIRK(0x1695, 0x4012, "EPox EP-5LDA", ALC880_5ST_DIG), |
Takashi Iwai | f5fcc13 | 2006-11-24 17:07:44 +0100 | [diff] [blame] | 2936 | SND_PCI_QUIRK(0x1734, 0x107c, "FSC F1734", ALC880_F1734), |
Takashi Iwai | ac3e374 | 2007-12-17 17:14:18 +0100 | [diff] [blame] | 2937 | SND_PCI_QUIRK(0x1734, 0x10ac, "FSC", ALC880_UNIWILL), |
Tobin Davis | 2cf9f0f | 2007-02-07 16:04:25 +0100 | [diff] [blame] | 2938 | SND_PCI_QUIRK(0x1734, 0x10b0, "Fujitsu", ALC880_FUJITSU), |
Takashi Iwai | ac3e374 | 2007-12-17 17:14:18 +0100 | [diff] [blame] | 2939 | SND_PCI_QUIRK(0x1854, 0x0018, "LG LW20", ALC880_LG_LW), |
Takashi Iwai | f5fcc13 | 2006-11-24 17:07:44 +0100 | [diff] [blame] | 2940 | SND_PCI_QUIRK(0x1854, 0x003b, "LG", ALC880_LG), |
| 2941 | SND_PCI_QUIRK(0x1854, 0x0068, "LG w1", ALC880_LG), |
Takashi Iwai | f5fcc13 | 2006-11-24 17:07:44 +0100 | [diff] [blame] | 2942 | SND_PCI_QUIRK(0x1854, 0x0077, "LG LW25", ALC880_LG_LW), |
Takashi Iwai | ac3e374 | 2007-12-17 17:14:18 +0100 | [diff] [blame] | 2943 | SND_PCI_QUIRK(0x19db, 0x4188, "TCL S700", ALC880_TCL_S700), |
| 2944 | SND_PCI_QUIRK(0x2668, 0x8086, NULL, ALC880_6ST_DIG), /* broken BIOS */ |
| 2945 | SND_PCI_QUIRK(0x8086, 0x2668, NULL, ALC880_6ST_DIG), |
| 2946 | SND_PCI_QUIRK(0x8086, 0xa100, "Intel mobo", ALC880_5ST_DIG), |
Takashi Iwai | f5fcc13 | 2006-11-24 17:07:44 +0100 | [diff] [blame] | 2947 | SND_PCI_QUIRK(0x8086, 0xd400, "Intel mobo", ALC880_5ST_DIG), |
| 2948 | SND_PCI_QUIRK(0x8086, 0xd401, "Intel mobo", ALC880_5ST_DIG), |
Takashi Iwai | ac3e374 | 2007-12-17 17:14:18 +0100 | [diff] [blame] | 2949 | SND_PCI_QUIRK(0x8086, 0xd402, "Intel mobo", ALC880_3ST_DIG), |
Takashi Iwai | f5fcc13 | 2006-11-24 17:07:44 +0100 | [diff] [blame] | 2950 | SND_PCI_QUIRK(0x8086, 0xe224, "Intel mobo", ALC880_5ST_DIG), |
Takashi Iwai | ac3e374 | 2007-12-17 17:14:18 +0100 | [diff] [blame] | 2951 | SND_PCI_QUIRK(0x8086, 0xe305, "Intel mobo", ALC880_3ST_DIG), |
| 2952 | SND_PCI_QUIRK(0x8086, 0xe308, "Intel mobo", ALC880_3ST_DIG), |
Takashi Iwai | f5fcc13 | 2006-11-24 17:07:44 +0100 | [diff] [blame] | 2953 | SND_PCI_QUIRK(0x8086, 0xe400, "Intel mobo", ALC880_5ST_DIG), |
| 2954 | SND_PCI_QUIRK(0x8086, 0xe401, "Intel mobo", ALC880_5ST_DIG), |
| 2955 | SND_PCI_QUIRK(0x8086, 0xe402, "Intel mobo", ALC880_5ST_DIG), |
Takashi Iwai | ac3e374 | 2007-12-17 17:14:18 +0100 | [diff] [blame] | 2956 | SND_PCI_QUIRK(0x8086, 0, "Intel mobo", ALC880_3ST), /* default Intel */ |
| 2957 | SND_PCI_QUIRK(0xa0a0, 0x0560, "AOpen i915GMm-HFS", ALC880_5ST_DIG), |
| 2958 | SND_PCI_QUIRK(0xe803, 0x1019, NULL, ALC880_6ST_DIG), |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 2959 | {} |
| 2960 | }; |
| 2961 | |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 2962 | /* |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 2963 | * ALC880 codec presets |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 2964 | */ |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 2965 | static struct alc_config_preset alc880_presets[] = { |
| 2966 | [ALC880_3ST] = { |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 2967 | .mixers = { alc880_three_stack_mixer }, |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 2968 | .init_verbs = { alc880_volume_init_verbs, |
| 2969 | alc880_pin_3stack_init_verbs }, |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 2970 | .num_dacs = ARRAY_SIZE(alc880_dac_nids), |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 2971 | .dac_nids = alc880_dac_nids, |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 2972 | .num_channel_mode = ARRAY_SIZE(alc880_threestack_modes), |
| 2973 | .channel_mode = alc880_threestack_modes, |
Takashi Iwai | 4e195a7 | 2006-07-28 14:47:34 +0200 | [diff] [blame] | 2974 | .need_dac_fix = 1, |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 2975 | .input_mux = &alc880_capture_source, |
| 2976 | }, |
| 2977 | [ALC880_3ST_DIG] = { |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 2978 | .mixers = { alc880_three_stack_mixer }, |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 2979 | .init_verbs = { alc880_volume_init_verbs, |
| 2980 | alc880_pin_3stack_init_verbs }, |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 2981 | .num_dacs = ARRAY_SIZE(alc880_dac_nids), |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 2982 | .dac_nids = alc880_dac_nids, |
| 2983 | .dig_out_nid = ALC880_DIGOUT_NID, |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 2984 | .num_channel_mode = ARRAY_SIZE(alc880_threestack_modes), |
| 2985 | .channel_mode = alc880_threestack_modes, |
Takashi Iwai | 4e195a7 | 2006-07-28 14:47:34 +0200 | [diff] [blame] | 2986 | .need_dac_fix = 1, |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 2987 | .input_mux = &alc880_capture_source, |
| 2988 | }, |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 2989 | [ALC880_TCL_S700] = { |
| 2990 | .mixers = { alc880_tcl_s700_mixer }, |
| 2991 | .init_verbs = { alc880_volume_init_verbs, |
| 2992 | alc880_pin_tcl_S700_init_verbs, |
| 2993 | alc880_gpio2_init_verbs }, |
| 2994 | .num_dacs = ARRAY_SIZE(alc880_dac_nids), |
| 2995 | .dac_nids = alc880_dac_nids, |
| 2996 | .hp_nid = 0x03, |
| 2997 | .num_channel_mode = ARRAY_SIZE(alc880_2_jack_modes), |
| 2998 | .channel_mode = alc880_2_jack_modes, |
| 2999 | .input_mux = &alc880_capture_source, |
| 3000 | }, |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 3001 | [ALC880_5ST] = { |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 3002 | .mixers = { alc880_three_stack_mixer, |
| 3003 | alc880_five_stack_mixer}, |
| 3004 | .init_verbs = { alc880_volume_init_verbs, |
| 3005 | alc880_pin_5stack_init_verbs }, |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 3006 | .num_dacs = ARRAY_SIZE(alc880_dac_nids), |
| 3007 | .dac_nids = alc880_dac_nids, |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 3008 | .num_channel_mode = ARRAY_SIZE(alc880_fivestack_modes), |
| 3009 | .channel_mode = alc880_fivestack_modes, |
| 3010 | .input_mux = &alc880_capture_source, |
| 3011 | }, |
| 3012 | [ALC880_5ST_DIG] = { |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 3013 | .mixers = { alc880_three_stack_mixer, |
| 3014 | alc880_five_stack_mixer }, |
| 3015 | .init_verbs = { alc880_volume_init_verbs, |
| 3016 | alc880_pin_5stack_init_verbs }, |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 3017 | .num_dacs = ARRAY_SIZE(alc880_dac_nids), |
| 3018 | .dac_nids = alc880_dac_nids, |
| 3019 | .dig_out_nid = ALC880_DIGOUT_NID, |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 3020 | .num_channel_mode = ARRAY_SIZE(alc880_fivestack_modes), |
| 3021 | .channel_mode = alc880_fivestack_modes, |
| 3022 | .input_mux = &alc880_capture_source, |
| 3023 | }, |
Takashi Iwai | b6482d4 | 2005-06-27 15:32:43 +0200 | [diff] [blame] | 3024 | [ALC880_6ST] = { |
| 3025 | .mixers = { alc880_six_stack_mixer }, |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 3026 | .init_verbs = { alc880_volume_init_verbs, |
| 3027 | alc880_pin_6stack_init_verbs }, |
Takashi Iwai | b6482d4 | 2005-06-27 15:32:43 +0200 | [diff] [blame] | 3028 | .num_dacs = ARRAY_SIZE(alc880_6st_dac_nids), |
| 3029 | .dac_nids = alc880_6st_dac_nids, |
| 3030 | .num_channel_mode = ARRAY_SIZE(alc880_sixstack_modes), |
| 3031 | .channel_mode = alc880_sixstack_modes, |
| 3032 | .input_mux = &alc880_6stack_capture_source, |
| 3033 | }, |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 3034 | [ALC880_6ST_DIG] = { |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 3035 | .mixers = { alc880_six_stack_mixer }, |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 3036 | .init_verbs = { alc880_volume_init_verbs, |
| 3037 | alc880_pin_6stack_init_verbs }, |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 3038 | .num_dacs = ARRAY_SIZE(alc880_6st_dac_nids), |
| 3039 | .dac_nids = alc880_6st_dac_nids, |
| 3040 | .dig_out_nid = ALC880_DIGOUT_NID, |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 3041 | .num_channel_mode = ARRAY_SIZE(alc880_sixstack_modes), |
| 3042 | .channel_mode = alc880_sixstack_modes, |
| 3043 | .input_mux = &alc880_6stack_capture_source, |
| 3044 | }, |
| 3045 | [ALC880_W810] = { |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 3046 | .mixers = { alc880_w810_base_mixer }, |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 3047 | .init_verbs = { alc880_volume_init_verbs, |
| 3048 | alc880_pin_w810_init_verbs, |
Takashi Iwai | b0af0de | 2005-06-21 14:49:19 +0200 | [diff] [blame] | 3049 | alc880_gpio2_init_verbs }, |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 3050 | .num_dacs = ARRAY_SIZE(alc880_w810_dac_nids), |
| 3051 | .dac_nids = alc880_w810_dac_nids, |
| 3052 | .dig_out_nid = ALC880_DIGOUT_NID, |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 3053 | .num_channel_mode = ARRAY_SIZE(alc880_w810_modes), |
| 3054 | .channel_mode = alc880_w810_modes, |
| 3055 | .input_mux = &alc880_capture_source, |
| 3056 | }, |
| 3057 | [ALC880_Z71V] = { |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 3058 | .mixers = { alc880_z71v_mixer }, |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 3059 | .init_verbs = { alc880_volume_init_verbs, |
| 3060 | alc880_pin_z71v_init_verbs }, |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 3061 | .num_dacs = ARRAY_SIZE(alc880_z71v_dac_nids), |
| 3062 | .dac_nids = alc880_z71v_dac_nids, |
| 3063 | .dig_out_nid = ALC880_DIGOUT_NID, |
| 3064 | .hp_nid = 0x03, |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 3065 | .num_channel_mode = ARRAY_SIZE(alc880_2_jack_modes), |
| 3066 | .channel_mode = alc880_2_jack_modes, |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 3067 | .input_mux = &alc880_capture_source, |
| 3068 | }, |
| 3069 | [ALC880_F1734] = { |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 3070 | .mixers = { alc880_f1734_mixer }, |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 3071 | .init_verbs = { alc880_volume_init_verbs, |
| 3072 | alc880_pin_f1734_init_verbs }, |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 3073 | .num_dacs = ARRAY_SIZE(alc880_f1734_dac_nids), |
| 3074 | .dac_nids = alc880_f1734_dac_nids, |
| 3075 | .hp_nid = 0x02, |
| 3076 | .num_channel_mode = ARRAY_SIZE(alc880_2_jack_modes), |
| 3077 | .channel_mode = alc880_2_jack_modes, |
Takashi Iwai | 937b416 | 2008-02-11 14:52:36 +0100 | [diff] [blame] | 3078 | .input_mux = &alc880_f1734_capture_source, |
| 3079 | .unsol_event = alc880_uniwill_p53_unsol_event, |
| 3080 | .init_hook = alc880_uniwill_p53_hp_automute, |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 3081 | }, |
| 3082 | [ALC880_ASUS] = { |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 3083 | .mixers = { alc880_asus_mixer }, |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 3084 | .init_verbs = { alc880_volume_init_verbs, |
| 3085 | alc880_pin_asus_init_verbs, |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 3086 | alc880_gpio1_init_verbs }, |
| 3087 | .num_dacs = ARRAY_SIZE(alc880_asus_dac_nids), |
| 3088 | .dac_nids = alc880_asus_dac_nids, |
| 3089 | .num_channel_mode = ARRAY_SIZE(alc880_asus_modes), |
| 3090 | .channel_mode = alc880_asus_modes, |
Takashi Iwai | 4e195a7 | 2006-07-28 14:47:34 +0200 | [diff] [blame] | 3091 | .need_dac_fix = 1, |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 3092 | .input_mux = &alc880_capture_source, |
| 3093 | }, |
| 3094 | [ALC880_ASUS_DIG] = { |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 3095 | .mixers = { alc880_asus_mixer }, |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 3096 | .init_verbs = { alc880_volume_init_verbs, |
| 3097 | alc880_pin_asus_init_verbs, |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 3098 | alc880_gpio1_init_verbs }, |
| 3099 | .num_dacs = ARRAY_SIZE(alc880_asus_dac_nids), |
| 3100 | .dac_nids = alc880_asus_dac_nids, |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 3101 | .dig_out_nid = ALC880_DIGOUT_NID, |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 3102 | .num_channel_mode = ARRAY_SIZE(alc880_asus_modes), |
| 3103 | .channel_mode = alc880_asus_modes, |
Takashi Iwai | 4e195a7 | 2006-07-28 14:47:34 +0200 | [diff] [blame] | 3104 | .need_dac_fix = 1, |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 3105 | .input_mux = &alc880_capture_source, |
| 3106 | }, |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 3107 | [ALC880_ASUS_DIG2] = { |
| 3108 | .mixers = { alc880_asus_mixer }, |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 3109 | .init_verbs = { alc880_volume_init_verbs, |
| 3110 | alc880_pin_asus_init_verbs, |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 3111 | alc880_gpio2_init_verbs }, /* use GPIO2 */ |
| 3112 | .num_dacs = ARRAY_SIZE(alc880_asus_dac_nids), |
| 3113 | .dac_nids = alc880_asus_dac_nids, |
| 3114 | .dig_out_nid = ALC880_DIGOUT_NID, |
| 3115 | .num_channel_mode = ARRAY_SIZE(alc880_asus_modes), |
| 3116 | .channel_mode = alc880_asus_modes, |
Takashi Iwai | 4e195a7 | 2006-07-28 14:47:34 +0200 | [diff] [blame] | 3117 | .need_dac_fix = 1, |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 3118 | .input_mux = &alc880_capture_source, |
| 3119 | }, |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 3120 | [ALC880_ASUS_W1V] = { |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 3121 | .mixers = { alc880_asus_mixer, alc880_asus_w1v_mixer }, |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 3122 | .init_verbs = { alc880_volume_init_verbs, |
| 3123 | alc880_pin_asus_init_verbs, |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 3124 | alc880_gpio1_init_verbs }, |
| 3125 | .num_dacs = ARRAY_SIZE(alc880_asus_dac_nids), |
| 3126 | .dac_nids = alc880_asus_dac_nids, |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 3127 | .dig_out_nid = ALC880_DIGOUT_NID, |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 3128 | .num_channel_mode = ARRAY_SIZE(alc880_asus_modes), |
| 3129 | .channel_mode = alc880_asus_modes, |
Takashi Iwai | 4e195a7 | 2006-07-28 14:47:34 +0200 | [diff] [blame] | 3130 | .need_dac_fix = 1, |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 3131 | .input_mux = &alc880_capture_source, |
| 3132 | }, |
| 3133 | [ALC880_UNIWILL_DIG] = { |
Takashi Iwai | 3c10a9d | 2005-08-23 20:02:27 +0200 | [diff] [blame] | 3134 | .mixers = { alc880_asus_mixer, alc880_pcbeep_mixer }, |
Kailang Yang | ccc656c | 2006-10-17 12:32:26 +0200 | [diff] [blame] | 3135 | .init_verbs = { alc880_volume_init_verbs, |
| 3136 | alc880_pin_asus_init_verbs }, |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 3137 | .num_dacs = ARRAY_SIZE(alc880_asus_dac_nids), |
| 3138 | .dac_nids = alc880_asus_dac_nids, |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 3139 | .dig_out_nid = ALC880_DIGOUT_NID, |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 3140 | .num_channel_mode = ARRAY_SIZE(alc880_asus_modes), |
| 3141 | .channel_mode = alc880_asus_modes, |
Takashi Iwai | 4e195a7 | 2006-07-28 14:47:34 +0200 | [diff] [blame] | 3142 | .need_dac_fix = 1, |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 3143 | .input_mux = &alc880_capture_source, |
| 3144 | }, |
Kailang Yang | ccc656c | 2006-10-17 12:32:26 +0200 | [diff] [blame] | 3145 | [ALC880_UNIWILL] = { |
| 3146 | .mixers = { alc880_uniwill_mixer }, |
| 3147 | .init_verbs = { alc880_volume_init_verbs, |
| 3148 | alc880_uniwill_init_verbs }, |
| 3149 | .num_dacs = ARRAY_SIZE(alc880_asus_dac_nids), |
| 3150 | .dac_nids = alc880_asus_dac_nids, |
| 3151 | .dig_out_nid = ALC880_DIGOUT_NID, |
| 3152 | .num_channel_mode = ARRAY_SIZE(alc880_threestack_modes), |
| 3153 | .channel_mode = alc880_threestack_modes, |
| 3154 | .need_dac_fix = 1, |
| 3155 | .input_mux = &alc880_capture_source, |
| 3156 | .unsol_event = alc880_uniwill_unsol_event, |
| 3157 | .init_hook = alc880_uniwill_automute, |
| 3158 | }, |
| 3159 | [ALC880_UNIWILL_P53] = { |
| 3160 | .mixers = { alc880_uniwill_p53_mixer }, |
| 3161 | .init_verbs = { alc880_volume_init_verbs, |
| 3162 | alc880_uniwill_p53_init_verbs }, |
| 3163 | .num_dacs = ARRAY_SIZE(alc880_asus_dac_nids), |
| 3164 | .dac_nids = alc880_asus_dac_nids, |
| 3165 | .num_channel_mode = ARRAY_SIZE(alc880_w810_modes), |
Tobin Davis | 2cf9f0f | 2007-02-07 16:04:25 +0100 | [diff] [blame] | 3166 | .channel_mode = alc880_threestack_modes, |
| 3167 | .input_mux = &alc880_capture_source, |
| 3168 | .unsol_event = alc880_uniwill_p53_unsol_event, |
| 3169 | .init_hook = alc880_uniwill_p53_hp_automute, |
| 3170 | }, |
| 3171 | [ALC880_FUJITSU] = { |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 3172 | .mixers = { alc880_fujitsu_mixer, |
Tobin Davis | 2cf9f0f | 2007-02-07 16:04:25 +0100 | [diff] [blame] | 3173 | alc880_pcbeep_mixer, }, |
| 3174 | .init_verbs = { alc880_volume_init_verbs, |
| 3175 | alc880_uniwill_p53_init_verbs, |
| 3176 | alc880_beep_init_verbs }, |
| 3177 | .num_dacs = ARRAY_SIZE(alc880_dac_nids), |
| 3178 | .dac_nids = alc880_dac_nids, |
Takashi Iwai | d53d7d9 | 2007-08-20 15:20:02 +0200 | [diff] [blame] | 3179 | .dig_out_nid = ALC880_DIGOUT_NID, |
Tobin Davis | 2cf9f0f | 2007-02-07 16:04:25 +0100 | [diff] [blame] | 3180 | .num_channel_mode = ARRAY_SIZE(alc880_2_jack_modes), |
| 3181 | .channel_mode = alc880_2_jack_modes, |
Kailang Yang | ccc656c | 2006-10-17 12:32:26 +0200 | [diff] [blame] | 3182 | .input_mux = &alc880_capture_source, |
| 3183 | .unsol_event = alc880_uniwill_p53_unsol_event, |
| 3184 | .init_hook = alc880_uniwill_p53_hp_automute, |
| 3185 | }, |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 3186 | [ALC880_CLEVO] = { |
| 3187 | .mixers = { alc880_three_stack_mixer }, |
| 3188 | .init_verbs = { alc880_volume_init_verbs, |
| 3189 | alc880_pin_clevo_init_verbs }, |
| 3190 | .num_dacs = ARRAY_SIZE(alc880_dac_nids), |
| 3191 | .dac_nids = alc880_dac_nids, |
| 3192 | .hp_nid = 0x03, |
| 3193 | .num_channel_mode = ARRAY_SIZE(alc880_threestack_modes), |
| 3194 | .channel_mode = alc880_threestack_modes, |
Takashi Iwai | 4e195a7 | 2006-07-28 14:47:34 +0200 | [diff] [blame] | 3195 | .need_dac_fix = 1, |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 3196 | .input_mux = &alc880_capture_source, |
| 3197 | }, |
Takashi Iwai | ae6b813 | 2006-03-03 16:47:17 +0100 | [diff] [blame] | 3198 | [ALC880_LG] = { |
| 3199 | .mixers = { alc880_lg_mixer }, |
| 3200 | .init_verbs = { alc880_volume_init_verbs, |
| 3201 | alc880_lg_init_verbs }, |
| 3202 | .num_dacs = ARRAY_SIZE(alc880_lg_dac_nids), |
| 3203 | .dac_nids = alc880_lg_dac_nids, |
| 3204 | .dig_out_nid = ALC880_DIGOUT_NID, |
| 3205 | .num_channel_mode = ARRAY_SIZE(alc880_lg_ch_modes), |
| 3206 | .channel_mode = alc880_lg_ch_modes, |
Takashi Iwai | 4e195a7 | 2006-07-28 14:47:34 +0200 | [diff] [blame] | 3207 | .need_dac_fix = 1, |
Takashi Iwai | ae6b813 | 2006-03-03 16:47:17 +0100 | [diff] [blame] | 3208 | .input_mux = &alc880_lg_capture_source, |
| 3209 | .unsol_event = alc880_lg_unsol_event, |
| 3210 | .init_hook = alc880_lg_automute, |
Takashi Iwai | cb53c62 | 2007-08-10 17:21:45 +0200 | [diff] [blame] | 3211 | #ifdef CONFIG_SND_HDA_POWER_SAVE |
| 3212 | .loopbacks = alc880_lg_loopbacks, |
| 3213 | #endif |
Takashi Iwai | ae6b813 | 2006-03-03 16:47:17 +0100 | [diff] [blame] | 3214 | }, |
Takashi Iwai | d681518 | 2006-03-23 16:06:23 +0100 | [diff] [blame] | 3215 | [ALC880_LG_LW] = { |
| 3216 | .mixers = { alc880_lg_lw_mixer }, |
| 3217 | .init_verbs = { alc880_volume_init_verbs, |
| 3218 | alc880_lg_lw_init_verbs }, |
Claudio Matsuoka | 0a8c5da | 2007-07-04 15:17:38 +0200 | [diff] [blame] | 3219 | .num_dacs = ARRAY_SIZE(alc880_dac_nids), |
Takashi Iwai | d681518 | 2006-03-23 16:06:23 +0100 | [diff] [blame] | 3220 | .dac_nids = alc880_dac_nids, |
| 3221 | .dig_out_nid = ALC880_DIGOUT_NID, |
Claudio Matsuoka | 0a8c5da | 2007-07-04 15:17:38 +0200 | [diff] [blame] | 3222 | .num_channel_mode = ARRAY_SIZE(alc880_lg_lw_modes), |
| 3223 | .channel_mode = alc880_lg_lw_modes, |
Takashi Iwai | d681518 | 2006-03-23 16:06:23 +0100 | [diff] [blame] | 3224 | .input_mux = &alc880_lg_lw_capture_source, |
| 3225 | .unsol_event = alc880_lg_lw_unsol_event, |
| 3226 | .init_hook = alc880_lg_lw_automute, |
| 3227 | }, |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 3228 | #ifdef CONFIG_SND_DEBUG |
| 3229 | [ALC880_TEST] = { |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 3230 | .mixers = { alc880_test_mixer }, |
| 3231 | .init_verbs = { alc880_test_init_verbs }, |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 3232 | .num_dacs = ARRAY_SIZE(alc880_test_dac_nids), |
| 3233 | .dac_nids = alc880_test_dac_nids, |
| 3234 | .dig_out_nid = ALC880_DIGOUT_NID, |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 3235 | .num_channel_mode = ARRAY_SIZE(alc880_test_modes), |
| 3236 | .channel_mode = alc880_test_modes, |
| 3237 | .input_mux = &alc880_test_capture_source, |
| 3238 | }, |
| 3239 | #endif |
| 3240 | }; |
| 3241 | |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 3242 | /* |
| 3243 | * Automatic parse of I/O pins from the BIOS configuration |
| 3244 | */ |
| 3245 | |
| 3246 | #define NUM_CONTROL_ALLOC 32 |
| 3247 | #define NUM_VERB_ALLOC 32 |
| 3248 | |
| 3249 | enum { |
| 3250 | ALC_CTL_WIDGET_VOL, |
| 3251 | ALC_CTL_WIDGET_MUTE, |
| 3252 | ALC_CTL_BIND_MUTE, |
| 3253 | }; |
Takashi Iwai | c8b6bf9 | 2005-11-17 14:57:47 +0100 | [diff] [blame] | 3254 | static struct snd_kcontrol_new alc880_control_templates[] = { |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 3255 | HDA_CODEC_VOLUME(NULL, 0, 0, 0), |
| 3256 | HDA_CODEC_MUTE(NULL, 0, 0, 0), |
Takashi Iwai | 985be54 | 2005-11-02 18:26:49 +0100 | [diff] [blame] | 3257 | HDA_BIND_MUTE(NULL, 0, 0, 0), |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 3258 | }; |
| 3259 | |
| 3260 | /* add dynamic controls */ |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 3261 | static int add_control(struct alc_spec *spec, int type, const char *name, |
| 3262 | unsigned long val) |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 3263 | { |
Takashi Iwai | c8b6bf9 | 2005-11-17 14:57:47 +0100 | [diff] [blame] | 3264 | struct snd_kcontrol_new *knew; |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 3265 | |
| 3266 | if (spec->num_kctl_used >= spec->num_kctl_alloc) { |
| 3267 | int num = spec->num_kctl_alloc + NUM_CONTROL_ALLOC; |
| 3268 | |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 3269 | /* array + terminator */ |
| 3270 | knew = kcalloc(num + 1, sizeof(*knew), GFP_KERNEL); |
| 3271 | if (!knew) |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 3272 | return -ENOMEM; |
| 3273 | if (spec->kctl_alloc) { |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 3274 | memcpy(knew, spec->kctl_alloc, |
| 3275 | sizeof(*knew) * spec->num_kctl_alloc); |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 3276 | kfree(spec->kctl_alloc); |
| 3277 | } |
| 3278 | spec->kctl_alloc = knew; |
| 3279 | spec->num_kctl_alloc = num; |
| 3280 | } |
| 3281 | |
| 3282 | knew = &spec->kctl_alloc[spec->num_kctl_used]; |
| 3283 | *knew = alc880_control_templates[type]; |
Paulo Marques | 543537b | 2005-06-23 00:09:02 -0700 | [diff] [blame] | 3284 | knew->name = kstrdup(name, GFP_KERNEL); |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 3285 | if (!knew->name) |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 3286 | return -ENOMEM; |
| 3287 | knew->private_value = val; |
| 3288 | spec->num_kctl_used++; |
| 3289 | return 0; |
| 3290 | } |
| 3291 | |
| 3292 | #define alc880_is_fixed_pin(nid) ((nid) >= 0x14 && (nid) <= 0x17) |
| 3293 | #define alc880_fixed_pin_idx(nid) ((nid) - 0x14) |
| 3294 | #define alc880_is_multi_pin(nid) ((nid) >= 0x18) |
| 3295 | #define alc880_multi_pin_idx(nid) ((nid) - 0x18) |
| 3296 | #define alc880_is_input_pin(nid) ((nid) >= 0x18) |
| 3297 | #define alc880_input_pin_idx(nid) ((nid) - 0x18) |
| 3298 | #define alc880_idx_to_dac(nid) ((nid) + 0x02) |
| 3299 | #define alc880_dac_to_idx(nid) ((nid) - 0x02) |
| 3300 | #define alc880_idx_to_mixer(nid) ((nid) + 0x0c) |
| 3301 | #define alc880_idx_to_selector(nid) ((nid) + 0x10) |
| 3302 | #define ALC880_PIN_CD_NID 0x1c |
| 3303 | |
| 3304 | /* fill in the dac_nids table from the parsed pin configuration */ |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 3305 | static int alc880_auto_fill_dac_nids(struct alc_spec *spec, |
| 3306 | const struct auto_pin_cfg *cfg) |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 3307 | { |
| 3308 | hda_nid_t nid; |
| 3309 | int assigned[4]; |
| 3310 | int i, j; |
| 3311 | |
| 3312 | memset(assigned, 0, sizeof(assigned)); |
Takashi Iwai | b0af0de | 2005-06-21 14:49:19 +0200 | [diff] [blame] | 3313 | spec->multiout.dac_nids = spec->private_dac_nids; |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 3314 | |
| 3315 | /* check the pins hardwired to audio widget */ |
| 3316 | for (i = 0; i < cfg->line_outs; i++) { |
| 3317 | nid = cfg->line_out_pins[i]; |
| 3318 | if (alc880_is_fixed_pin(nid)) { |
| 3319 | int idx = alc880_fixed_pin_idx(nid); |
Libin Yang | 5014f19 | 2005-11-23 15:48:36 +0100 | [diff] [blame] | 3320 | spec->multiout.dac_nids[i] = alc880_idx_to_dac(idx); |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 3321 | assigned[idx] = 1; |
| 3322 | } |
| 3323 | } |
| 3324 | /* left pins can be connect to any audio widget */ |
| 3325 | for (i = 0; i < cfg->line_outs; i++) { |
| 3326 | nid = cfg->line_out_pins[i]; |
| 3327 | if (alc880_is_fixed_pin(nid)) |
| 3328 | continue; |
| 3329 | /* search for an empty channel */ |
| 3330 | for (j = 0; j < cfg->line_outs; j++) { |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 3331 | if (!assigned[j]) { |
| 3332 | spec->multiout.dac_nids[i] = |
| 3333 | alc880_idx_to_dac(j); |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 3334 | assigned[j] = 1; |
| 3335 | break; |
| 3336 | } |
| 3337 | } |
| 3338 | } |
| 3339 | spec->multiout.num_dacs = cfg->line_outs; |
| 3340 | return 0; |
| 3341 | } |
| 3342 | |
| 3343 | /* add playback controls from the parsed DAC table */ |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 3344 | static int alc880_auto_create_multi_out_ctls(struct alc_spec *spec, |
| 3345 | const struct auto_pin_cfg *cfg) |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 3346 | { |
| 3347 | char name[32]; |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 3348 | static const char *chname[4] = { |
| 3349 | "Front", "Surround", NULL /*CLFE*/, "Side" |
| 3350 | }; |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 3351 | hda_nid_t nid; |
| 3352 | int i, err; |
| 3353 | |
| 3354 | for (i = 0; i < cfg->line_outs; i++) { |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 3355 | if (!spec->multiout.dac_nids[i]) |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 3356 | continue; |
| 3357 | nid = alc880_idx_to_mixer(alc880_dac_to_idx(spec->multiout.dac_nids[i])); |
| 3358 | if (i == 2) { |
| 3359 | /* Center/LFE */ |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 3360 | err = add_control(spec, ALC_CTL_WIDGET_VOL, |
| 3361 | "Center Playback Volume", |
| 3362 | HDA_COMPOSE_AMP_VAL(nid, 1, 0, |
| 3363 | HDA_OUTPUT)); |
| 3364 | if (err < 0) |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 3365 | return err; |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 3366 | err = add_control(spec, ALC_CTL_WIDGET_VOL, |
| 3367 | "LFE Playback Volume", |
| 3368 | HDA_COMPOSE_AMP_VAL(nid, 2, 0, |
| 3369 | HDA_OUTPUT)); |
| 3370 | if (err < 0) |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 3371 | return err; |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 3372 | err = add_control(spec, ALC_CTL_BIND_MUTE, |
| 3373 | "Center Playback Switch", |
| 3374 | HDA_COMPOSE_AMP_VAL(nid, 1, 2, |
| 3375 | HDA_INPUT)); |
| 3376 | if (err < 0) |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 3377 | return err; |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 3378 | err = add_control(spec, ALC_CTL_BIND_MUTE, |
| 3379 | "LFE Playback Switch", |
| 3380 | HDA_COMPOSE_AMP_VAL(nid, 2, 2, |
| 3381 | HDA_INPUT)); |
| 3382 | if (err < 0) |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 3383 | return err; |
| 3384 | } else { |
| 3385 | sprintf(name, "%s Playback Volume", chname[i]); |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 3386 | err = add_control(spec, ALC_CTL_WIDGET_VOL, name, |
| 3387 | HDA_COMPOSE_AMP_VAL(nid, 3, 0, |
| 3388 | HDA_OUTPUT)); |
| 3389 | if (err < 0) |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 3390 | return err; |
| 3391 | sprintf(name, "%s Playback Switch", chname[i]); |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 3392 | err = add_control(spec, ALC_CTL_BIND_MUTE, name, |
| 3393 | HDA_COMPOSE_AMP_VAL(nid, 3, 2, |
| 3394 | HDA_INPUT)); |
| 3395 | if (err < 0) |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 3396 | return err; |
| 3397 | } |
| 3398 | } |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 3399 | return 0; |
| 3400 | } |
| 3401 | |
Takashi Iwai | 8d88bc3 | 2005-11-17 11:09:23 +0100 | [diff] [blame] | 3402 | /* add playback controls for speaker and HP outputs */ |
| 3403 | static int alc880_auto_create_extra_out(struct alc_spec *spec, hda_nid_t pin, |
| 3404 | const char *pfx) |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 3405 | { |
| 3406 | hda_nid_t nid; |
| 3407 | int err; |
Takashi Iwai | 8d88bc3 | 2005-11-17 11:09:23 +0100 | [diff] [blame] | 3408 | char name[32]; |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 3409 | |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 3410 | if (!pin) |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 3411 | return 0; |
| 3412 | |
| 3413 | if (alc880_is_fixed_pin(pin)) { |
| 3414 | nid = alc880_idx_to_dac(alc880_fixed_pin_idx(pin)); |
Takashi Iwai | 82bc955 | 2006-03-21 11:24:42 +0100 | [diff] [blame] | 3415 | /* specify the DAC as the extra output */ |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 3416 | if (!spec->multiout.hp_nid) |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 3417 | spec->multiout.hp_nid = nid; |
Takashi Iwai | 82bc955 | 2006-03-21 11:24:42 +0100 | [diff] [blame] | 3418 | else |
| 3419 | spec->multiout.extra_out_nid[0] = nid; |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 3420 | /* control HP volume/switch on the output mixer amp */ |
| 3421 | nid = alc880_idx_to_mixer(alc880_fixed_pin_idx(pin)); |
Takashi Iwai | 8d88bc3 | 2005-11-17 11:09:23 +0100 | [diff] [blame] | 3422 | sprintf(name, "%s Playback Volume", pfx); |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 3423 | err = add_control(spec, ALC_CTL_WIDGET_VOL, name, |
| 3424 | HDA_COMPOSE_AMP_VAL(nid, 3, 0, HDA_OUTPUT)); |
| 3425 | if (err < 0) |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 3426 | return err; |
Takashi Iwai | 8d88bc3 | 2005-11-17 11:09:23 +0100 | [diff] [blame] | 3427 | sprintf(name, "%s Playback Switch", pfx); |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 3428 | err = add_control(spec, ALC_CTL_BIND_MUTE, name, |
| 3429 | HDA_COMPOSE_AMP_VAL(nid, 3, 2, HDA_INPUT)); |
| 3430 | if (err < 0) |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 3431 | return err; |
| 3432 | } else if (alc880_is_multi_pin(pin)) { |
| 3433 | /* set manual connection */ |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 3434 | /* we have only a switch on HP-out PIN */ |
Takashi Iwai | 8d88bc3 | 2005-11-17 11:09:23 +0100 | [diff] [blame] | 3435 | sprintf(name, "%s Playback Switch", pfx); |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 3436 | err = add_control(spec, ALC_CTL_WIDGET_MUTE, name, |
| 3437 | HDA_COMPOSE_AMP_VAL(pin, 3, 0, HDA_OUTPUT)); |
| 3438 | if (err < 0) |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 3439 | return err; |
| 3440 | } |
| 3441 | return 0; |
| 3442 | } |
| 3443 | |
| 3444 | /* create input playback/capture controls for the given pin */ |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 3445 | static int new_analog_input(struct alc_spec *spec, hda_nid_t pin, |
| 3446 | const char *ctlname, |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 3447 | int idx, hda_nid_t mix_nid) |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 3448 | { |
| 3449 | char name[32]; |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 3450 | int err; |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 3451 | |
| 3452 | sprintf(name, "%s Playback Volume", ctlname); |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 3453 | err = add_control(spec, ALC_CTL_WIDGET_VOL, name, |
| 3454 | HDA_COMPOSE_AMP_VAL(mix_nid, 3, idx, HDA_INPUT)); |
| 3455 | if (err < 0) |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 3456 | return err; |
| 3457 | sprintf(name, "%s Playback Switch", ctlname); |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 3458 | err = add_control(spec, ALC_CTL_WIDGET_MUTE, name, |
| 3459 | HDA_COMPOSE_AMP_VAL(mix_nid, 3, idx, HDA_INPUT)); |
| 3460 | if (err < 0) |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 3461 | return err; |
| 3462 | return 0; |
| 3463 | } |
| 3464 | |
| 3465 | /* create playback/capture controls for input pins */ |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 3466 | static int alc880_auto_create_analog_input_ctls(struct alc_spec *spec, |
| 3467 | const struct auto_pin_cfg *cfg) |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 3468 | { |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 3469 | struct hda_input_mux *imux = &spec->private_imux; |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 3470 | int i, err, idx; |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 3471 | |
| 3472 | for (i = 0; i < AUTO_PIN_LAST; i++) { |
| 3473 | if (alc880_is_input_pin(cfg->input_pins[i])) { |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 3474 | idx = alc880_input_pin_idx(cfg->input_pins[i]); |
Takashi Iwai | 4a471b7 | 2005-12-07 13:56:29 +0100 | [diff] [blame] | 3475 | err = new_analog_input(spec, cfg->input_pins[i], |
| 3476 | auto_pin_cfg_labels[i], |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 3477 | idx, 0x0b); |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 3478 | if (err < 0) |
| 3479 | return err; |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 3480 | imux->items[imux->num_items].label = |
| 3481 | auto_pin_cfg_labels[i]; |
| 3482 | imux->items[imux->num_items].index = |
| 3483 | alc880_input_pin_idx(cfg->input_pins[i]); |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 3484 | imux->num_items++; |
| 3485 | } |
| 3486 | } |
| 3487 | return 0; |
| 3488 | } |
| 3489 | |
Takashi Iwai | f6c7e54 | 2008-02-12 18:32:23 +0100 | [diff] [blame] | 3490 | static void alc_set_pin_output(struct hda_codec *codec, hda_nid_t nid, |
| 3491 | unsigned int pin_type) |
| 3492 | { |
| 3493 | snd_hda_codec_write(codec, nid, 0, AC_VERB_SET_PIN_WIDGET_CONTROL, |
| 3494 | pin_type); |
| 3495 | /* unmute pin */ |
Takashi Iwai | d260cdf | 2008-02-13 17:19:35 +0100 | [diff] [blame] | 3496 | snd_hda_codec_write(codec, nid, 0, AC_VERB_SET_AMP_GAIN_MUTE, |
| 3497 | AMP_OUT_UNMUTE); |
Takashi Iwai | f6c7e54 | 2008-02-12 18:32:23 +0100 | [diff] [blame] | 3498 | } |
| 3499 | |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 3500 | static void alc880_auto_set_output_and_unmute(struct hda_codec *codec, |
| 3501 | hda_nid_t nid, int pin_type, |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 3502 | int dac_idx) |
| 3503 | { |
Takashi Iwai | f6c7e54 | 2008-02-12 18:32:23 +0100 | [diff] [blame] | 3504 | alc_set_pin_output(codec, nid, pin_type); |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 3505 | /* need the manual connection? */ |
| 3506 | if (alc880_is_multi_pin(nid)) { |
| 3507 | struct alc_spec *spec = codec->spec; |
| 3508 | int idx = alc880_multi_pin_idx(nid); |
| 3509 | snd_hda_codec_write(codec, alc880_idx_to_selector(idx), 0, |
| 3510 | AC_VERB_SET_CONNECT_SEL, |
| 3511 | alc880_dac_to_idx(spec->multiout.dac_nids[dac_idx])); |
| 3512 | } |
| 3513 | } |
| 3514 | |
Takashi Iwai | baba8ee | 2007-04-23 17:17:48 +0200 | [diff] [blame] | 3515 | static int get_pin_type(int line_out_type) |
| 3516 | { |
| 3517 | if (line_out_type == AUTO_PIN_HP_OUT) |
| 3518 | return PIN_HP; |
| 3519 | else |
| 3520 | return PIN_OUT; |
| 3521 | } |
| 3522 | |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 3523 | static void alc880_auto_init_multi_out(struct hda_codec *codec) |
| 3524 | { |
| 3525 | struct alc_spec *spec = codec->spec; |
| 3526 | int i; |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 3527 | |
| 3528 | alc_subsystem_id(codec, 0x15, 0x1b, 0x14); |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 3529 | for (i = 0; i < spec->autocfg.line_outs; i++) { |
| 3530 | hda_nid_t nid = spec->autocfg.line_out_pins[i]; |
Takashi Iwai | baba8ee | 2007-04-23 17:17:48 +0200 | [diff] [blame] | 3531 | int pin_type = get_pin_type(spec->autocfg.line_out_type); |
| 3532 | alc880_auto_set_output_and_unmute(codec, nid, pin_type, i); |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 3533 | } |
| 3534 | } |
| 3535 | |
Takashi Iwai | 8d88bc3 | 2005-11-17 11:09:23 +0100 | [diff] [blame] | 3536 | static void alc880_auto_init_extra_out(struct hda_codec *codec) |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 3537 | { |
| 3538 | struct alc_spec *spec = codec->spec; |
| 3539 | hda_nid_t pin; |
| 3540 | |
Takashi Iwai | 82bc955 | 2006-03-21 11:24:42 +0100 | [diff] [blame] | 3541 | pin = spec->autocfg.speaker_pins[0]; |
Takashi Iwai | 8d88bc3 | 2005-11-17 11:09:23 +0100 | [diff] [blame] | 3542 | if (pin) /* connect to front */ |
| 3543 | alc880_auto_set_output_and_unmute(codec, pin, PIN_OUT, 0); |
Takashi Iwai | eb06ed8 | 2006-09-20 17:10:27 +0200 | [diff] [blame] | 3544 | pin = spec->autocfg.hp_pins[0]; |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 3545 | if (pin) /* connect to front */ |
| 3546 | alc880_auto_set_output_and_unmute(codec, pin, PIN_HP, 0); |
| 3547 | } |
| 3548 | |
| 3549 | static void alc880_auto_init_analog_input(struct hda_codec *codec) |
| 3550 | { |
| 3551 | struct alc_spec *spec = codec->spec; |
| 3552 | int i; |
| 3553 | |
| 3554 | for (i = 0; i < AUTO_PIN_LAST; i++) { |
| 3555 | hda_nid_t nid = spec->autocfg.input_pins[i]; |
| 3556 | if (alc880_is_input_pin(nid)) { |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 3557 | snd_hda_codec_write(codec, nid, 0, |
| 3558 | AC_VERB_SET_PIN_WIDGET_CONTROL, |
| 3559 | i <= AUTO_PIN_FRONT_MIC ? |
| 3560 | PIN_VREF80 : PIN_IN); |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 3561 | if (nid != ALC880_PIN_CD_NID) |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 3562 | snd_hda_codec_write(codec, nid, 0, |
| 3563 | AC_VERB_SET_AMP_GAIN_MUTE, |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 3564 | AMP_OUT_MUTE); |
| 3565 | } |
| 3566 | } |
| 3567 | } |
| 3568 | |
| 3569 | /* parse the BIOS configuration and set up the alc_spec */ |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 3570 | /* return 1 if successful, 0 if the proper config is not found, |
| 3571 | * or a negative error code |
| 3572 | */ |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 3573 | static int alc880_parse_auto_config(struct hda_codec *codec) |
| 3574 | { |
| 3575 | struct alc_spec *spec = codec->spec; |
| 3576 | int err; |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 3577 | static hda_nid_t alc880_ignore[] = { 0x1d, 0 }; |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 3578 | |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 3579 | err = snd_hda_parse_pin_def_config(codec, &spec->autocfg, |
| 3580 | alc880_ignore); |
| 3581 | if (err < 0) |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 3582 | return err; |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 3583 | if (!spec->autocfg.line_outs) |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 3584 | return 0; /* can't find valid BIOS pin config */ |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 3585 | |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 3586 | err = alc880_auto_fill_dac_nids(spec, &spec->autocfg); |
| 3587 | if (err < 0) |
| 3588 | return err; |
| 3589 | err = alc880_auto_create_multi_out_ctls(spec, &spec->autocfg); |
| 3590 | if (err < 0) |
| 3591 | return err; |
| 3592 | err = alc880_auto_create_extra_out(spec, |
| 3593 | spec->autocfg.speaker_pins[0], |
| 3594 | "Speaker"); |
| 3595 | if (err < 0) |
| 3596 | return err; |
| 3597 | err = alc880_auto_create_extra_out(spec, spec->autocfg.hp_pins[0], |
| 3598 | "Headphone"); |
| 3599 | if (err < 0) |
| 3600 | return err; |
| 3601 | err = alc880_auto_create_analog_input_ctls(spec, &spec->autocfg); |
| 3602 | if (err < 0) |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 3603 | return err; |
| 3604 | |
| 3605 | spec->multiout.max_channels = spec->multiout.num_dacs * 2; |
| 3606 | |
| 3607 | if (spec->autocfg.dig_out_pin) |
| 3608 | spec->multiout.dig_out_nid = ALC880_DIGOUT_NID; |
| 3609 | if (spec->autocfg.dig_in_pin) |
| 3610 | spec->dig_in_nid = ALC880_DIGIN_NID; |
| 3611 | |
| 3612 | if (spec->kctl_alloc) |
| 3613 | spec->mixers[spec->num_mixers++] = spec->kctl_alloc; |
| 3614 | |
| 3615 | spec->init_verbs[spec->num_init_verbs++] = alc880_volume_init_verbs; |
| 3616 | |
Jonathan Woithe | a1e8d2d | 2006-03-28 12:47:09 +0200 | [diff] [blame] | 3617 | spec->num_mux_defs = 1; |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 3618 | spec->input_mux = &spec->private_imux; |
| 3619 | |
| 3620 | return 1; |
| 3621 | } |
| 3622 | |
Takashi Iwai | ae6b813 | 2006-03-03 16:47:17 +0100 | [diff] [blame] | 3623 | /* additional initialization for auto-configuration model */ |
| 3624 | static void alc880_auto_init(struct hda_codec *codec) |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 3625 | { |
Takashi Iwai | f6c7e54 | 2008-02-12 18:32:23 +0100 | [diff] [blame] | 3626 | struct alc_spec *spec = codec->spec; |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 3627 | alc880_auto_init_multi_out(codec); |
Takashi Iwai | 8d88bc3 | 2005-11-17 11:09:23 +0100 | [diff] [blame] | 3628 | alc880_auto_init_extra_out(codec); |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 3629 | alc880_auto_init_analog_input(codec); |
Takashi Iwai | f6c7e54 | 2008-02-12 18:32:23 +0100 | [diff] [blame] | 3630 | if (spec->unsol_event) |
| 3631 | alc_sku_automute(codec); |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 3632 | } |
| 3633 | |
| 3634 | /* |
| 3635 | * OK, here we have finally the patch for ALC880 |
| 3636 | */ |
| 3637 | |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 3638 | static int patch_alc880(struct hda_codec *codec) |
| 3639 | { |
| 3640 | struct alc_spec *spec; |
| 3641 | int board_config; |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 3642 | int err; |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 3643 | |
Takashi Iwai | e560d8d | 2005-09-09 14:21:46 +0200 | [diff] [blame] | 3644 | spec = kzalloc(sizeof(*spec), GFP_KERNEL); |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 3645 | if (spec == NULL) |
| 3646 | return -ENOMEM; |
| 3647 | |
| 3648 | codec->spec = spec; |
| 3649 | |
Takashi Iwai | f5fcc13 | 2006-11-24 17:07:44 +0100 | [diff] [blame] | 3650 | board_config = snd_hda_check_board_config(codec, ALC880_MODEL_LAST, |
| 3651 | alc880_models, |
| 3652 | alc880_cfg_tbl); |
| 3653 | if (board_config < 0) { |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 3654 | printk(KERN_INFO "hda_codec: Unknown model for ALC880, " |
| 3655 | "trying auto-probe from BIOS...\n"); |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 3656 | board_config = ALC880_AUTO; |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 3657 | } |
| 3658 | |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 3659 | if (board_config == ALC880_AUTO) { |
| 3660 | /* automatic parse from the BIOS config */ |
| 3661 | err = alc880_parse_auto_config(codec); |
| 3662 | if (err < 0) { |
| 3663 | alc_free(codec); |
| 3664 | return err; |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 3665 | } else if (!err) { |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 3666 | printk(KERN_INFO |
| 3667 | "hda_codec: Cannot set up configuration " |
| 3668 | "from BIOS. Using 3-stack mode...\n"); |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 3669 | board_config = ALC880_3ST; |
| 3670 | } |
| 3671 | } |
| 3672 | |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 3673 | if (board_config != ALC880_AUTO) |
| 3674 | setup_preset(spec, &alc880_presets[board_config]); |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 3675 | |
| 3676 | spec->stream_name_analog = "ALC880 Analog"; |
| 3677 | spec->stream_analog_playback = &alc880_pcm_analog_playback; |
| 3678 | spec->stream_analog_capture = &alc880_pcm_analog_capture; |
Takashi Iwai | 6330079 | 2008-01-24 15:31:36 +0100 | [diff] [blame] | 3679 | spec->stream_analog_alt_capture = &alc880_pcm_analog_alt_capture; |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 3680 | |
| 3681 | spec->stream_name_digital = "ALC880 Digital"; |
| 3682 | spec->stream_digital_playback = &alc880_pcm_digital_playback; |
| 3683 | spec->stream_digital_capture = &alc880_pcm_digital_capture; |
| 3684 | |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 3685 | if (!spec->adc_nids && spec->input_mux) { |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 3686 | /* check whether NID 0x07 is valid */ |
Takashi Iwai | 54d1740 | 2005-11-21 16:33:22 +0100 | [diff] [blame] | 3687 | unsigned int wcap = get_wcaps(codec, alc880_adc_nids[0]); |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 3688 | /* get type */ |
| 3689 | wcap = (wcap & AC_WCAP_TYPE) >> AC_WCAP_TYPE_SHIFT; |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 3690 | if (wcap != AC_WID_AUD_IN) { |
| 3691 | spec->adc_nids = alc880_adc_nids_alt; |
| 3692 | spec->num_adc_nids = ARRAY_SIZE(alc880_adc_nids_alt); |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 3693 | spec->mixers[spec->num_mixers] = |
| 3694 | alc880_capture_alt_mixer; |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 3695 | spec->num_mixers++; |
| 3696 | } else { |
| 3697 | spec->adc_nids = alc880_adc_nids; |
| 3698 | spec->num_adc_nids = ARRAY_SIZE(alc880_adc_nids); |
| 3699 | spec->mixers[spec->num_mixers] = alc880_capture_mixer; |
| 3700 | spec->num_mixers++; |
| 3701 | } |
| 3702 | } |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 3703 | |
Takashi Iwai | 2134ea4 | 2008-01-10 16:53:55 +0100 | [diff] [blame] | 3704 | spec->vmaster_nid = 0x0c; |
| 3705 | |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 3706 | codec->patch_ops = alc_patch_ops; |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 3707 | if (board_config == ALC880_AUTO) |
Takashi Iwai | ae6b813 | 2006-03-03 16:47:17 +0100 | [diff] [blame] | 3708 | spec->init_hook = alc880_auto_init; |
Takashi Iwai | cb53c62 | 2007-08-10 17:21:45 +0200 | [diff] [blame] | 3709 | #ifdef CONFIG_SND_HDA_POWER_SAVE |
| 3710 | if (!spec->loopback.amplist) |
| 3711 | spec->loopback.amplist = alc880_loopbacks; |
| 3712 | #endif |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 3713 | |
| 3714 | return 0; |
| 3715 | } |
| 3716 | |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 3717 | |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 3718 | /* |
| 3719 | * ALC260 support |
| 3720 | */ |
| 3721 | |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 3722 | static hda_nid_t alc260_dac_nids[1] = { |
| 3723 | /* front */ |
| 3724 | 0x02, |
| 3725 | }; |
| 3726 | |
| 3727 | static hda_nid_t alc260_adc_nids[1] = { |
| 3728 | /* ADC0 */ |
| 3729 | 0x04, |
| 3730 | }; |
| 3731 | |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 3732 | static hda_nid_t alc260_adc_nids_alt[1] = { |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 3733 | /* ADC1 */ |
| 3734 | 0x05, |
| 3735 | }; |
| 3736 | |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 3737 | static hda_nid_t alc260_hp_adc_nids[2] = { |
| 3738 | /* ADC1, 0 */ |
| 3739 | 0x05, 0x04 |
| 3740 | }; |
| 3741 | |
Jonathan Woithe | d57fdac | 2006-02-28 11:38:35 +0100 | [diff] [blame] | 3742 | /* NIDs used when simultaneous access to both ADCs makes sense. Note that |
| 3743 | * alc260_capture_mixer assumes ADC0 (nid 0x04) is the first ADC. |
| 3744 | */ |
| 3745 | static hda_nid_t alc260_dual_adc_nids[2] = { |
Jonathan Woithe | 4c5186e | 2006-02-09 11:53:48 +0100 | [diff] [blame] | 3746 | /* ADC0, ADC1 */ |
| 3747 | 0x04, 0x05 |
| 3748 | }; |
| 3749 | |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 3750 | #define ALC260_DIGOUT_NID 0x03 |
| 3751 | #define ALC260_DIGIN_NID 0x06 |
| 3752 | |
| 3753 | static struct hda_input_mux alc260_capture_source = { |
| 3754 | .num_items = 4, |
| 3755 | .items = { |
| 3756 | { "Mic", 0x0 }, |
| 3757 | { "Front Mic", 0x1 }, |
| 3758 | { "Line", 0x2 }, |
| 3759 | { "CD", 0x4 }, |
| 3760 | }, |
| 3761 | }; |
| 3762 | |
Jonathan Woithe | 17e7aec | 2006-02-28 11:35:18 +0100 | [diff] [blame] | 3763 | /* On Fujitsu S702x laptops capture only makes sense from Mic/LineIn jack, |
Jonathan Woithe | a1e8d2d | 2006-03-28 12:47:09 +0200 | [diff] [blame] | 3764 | * headphone jack and the internal CD lines since these are the only pins at |
| 3765 | * which audio can appear. For flexibility, also allow the option of |
| 3766 | * recording the mixer output on the second ADC (ADC0 doesn't have a |
| 3767 | * connection to the mixer output). |
Jonathan Woithe | a9430dd | 2005-09-16 19:12:48 +0200 | [diff] [blame] | 3768 | */ |
Jonathan Woithe | a1e8d2d | 2006-03-28 12:47:09 +0200 | [diff] [blame] | 3769 | static struct hda_input_mux alc260_fujitsu_capture_sources[2] = { |
| 3770 | { |
| 3771 | .num_items = 3, |
| 3772 | .items = { |
| 3773 | { "Mic/Line", 0x0 }, |
| 3774 | { "CD", 0x4 }, |
| 3775 | { "Headphone", 0x2 }, |
| 3776 | }, |
Jonathan Woithe | a9430dd | 2005-09-16 19:12:48 +0200 | [diff] [blame] | 3777 | }, |
Jonathan Woithe | a1e8d2d | 2006-03-28 12:47:09 +0200 | [diff] [blame] | 3778 | { |
| 3779 | .num_items = 4, |
| 3780 | .items = { |
| 3781 | { "Mic/Line", 0x0 }, |
| 3782 | { "CD", 0x4 }, |
| 3783 | { "Headphone", 0x2 }, |
| 3784 | { "Mixer", 0x5 }, |
| 3785 | }, |
| 3786 | }, |
| 3787 | |
Jonathan Woithe | a9430dd | 2005-09-16 19:12:48 +0200 | [diff] [blame] | 3788 | }; |
| 3789 | |
Jonathan Woithe | a1e8d2d | 2006-03-28 12:47:09 +0200 | [diff] [blame] | 3790 | /* Acer TravelMate(/Extensa/Aspire) notebooks have similar configuration to |
| 3791 | * the Fujitsu S702x, but jacks are marked differently. |
Jonathan Woithe | 0bfc90e | 2006-02-28 11:45:11 +0100 | [diff] [blame] | 3792 | */ |
Jonathan Woithe | a1e8d2d | 2006-03-28 12:47:09 +0200 | [diff] [blame] | 3793 | static struct hda_input_mux alc260_acer_capture_sources[2] = { |
| 3794 | { |
| 3795 | .num_items = 4, |
| 3796 | .items = { |
| 3797 | { "Mic", 0x0 }, |
| 3798 | { "Line", 0x2 }, |
| 3799 | { "CD", 0x4 }, |
| 3800 | { "Headphone", 0x5 }, |
| 3801 | }, |
| 3802 | }, |
| 3803 | { |
| 3804 | .num_items = 5, |
| 3805 | .items = { |
| 3806 | { "Mic", 0x0 }, |
| 3807 | { "Line", 0x2 }, |
| 3808 | { "CD", 0x4 }, |
| 3809 | { "Headphone", 0x6 }, |
| 3810 | { "Mixer", 0x5 }, |
| 3811 | }, |
Jonathan Woithe | 0bfc90e | 2006-02-28 11:45:11 +0100 | [diff] [blame] | 3812 | }, |
| 3813 | }; |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 3814 | /* |
| 3815 | * This is just place-holder, so there's something for alc_build_pcms to look |
| 3816 | * at when it calculates the maximum number of channels. ALC260 has no mixer |
| 3817 | * element which allows changing the channel mode, so the verb list is |
| 3818 | * never used. |
| 3819 | */ |
Takashi Iwai | d2a6d7d | 2005-11-17 11:06:29 +0100 | [diff] [blame] | 3820 | static struct hda_channel_mode alc260_modes[1] = { |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 3821 | { 2, NULL }, |
| 3822 | }; |
| 3823 | |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 3824 | |
| 3825 | /* Mixer combinations |
| 3826 | * |
| 3827 | * basic: base_output + input + pc_beep + capture |
| 3828 | * HP: base_output + input + capture_alt |
| 3829 | * HP_3013: hp_3013 + input + capture |
| 3830 | * fujitsu: fujitsu + capture |
Jonathan Woithe | 0bfc90e | 2006-02-28 11:45:11 +0100 | [diff] [blame] | 3831 | * acer: acer + capture |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 3832 | */ |
| 3833 | |
| 3834 | static struct snd_kcontrol_new alc260_base_output_mixer[] = { |
Takashi Iwai | 05acb86 | 2005-06-10 19:50:25 +0200 | [diff] [blame] | 3835 | HDA_CODEC_VOLUME("Front Playback Volume", 0x08, 0x0, HDA_OUTPUT), |
Takashi Iwai | 985be54 | 2005-11-02 18:26:49 +0100 | [diff] [blame] | 3836 | HDA_BIND_MUTE("Front Playback Switch", 0x08, 2, HDA_INPUT), |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 3837 | HDA_CODEC_VOLUME("Headphone Playback Volume", 0x09, 0x0, HDA_OUTPUT), |
| 3838 | HDA_BIND_MUTE("Headphone Playback Switch", 0x09, 2, HDA_INPUT), |
| 3839 | HDA_CODEC_VOLUME_MONO("Mono Playback Volume", 0x0a, 1, 0x0, HDA_OUTPUT), |
| 3840 | HDA_BIND_MUTE_MONO("Mono Playback Switch", 0x0a, 1, 2, HDA_INPUT), |
| 3841 | { } /* end */ |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 3842 | }; |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 3843 | |
| 3844 | static struct snd_kcontrol_new alc260_input_mixer[] = { |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 3845 | HDA_CODEC_VOLUME("CD Playback Volume", 0x07, 0x04, HDA_INPUT), |
| 3846 | HDA_CODEC_MUTE("CD Playback Switch", 0x07, 0x04, HDA_INPUT), |
| 3847 | HDA_CODEC_VOLUME("Line Playback Volume", 0x07, 0x02, HDA_INPUT), |
| 3848 | HDA_CODEC_MUTE("Line Playback Switch", 0x07, 0x02, HDA_INPUT), |
| 3849 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x07, 0x0, HDA_INPUT), |
| 3850 | HDA_CODEC_MUTE("Mic Playback Switch", 0x07, 0x0, HDA_INPUT), |
| 3851 | HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x07, 0x01, HDA_INPUT), |
| 3852 | HDA_CODEC_MUTE("Front Mic Playback Switch", 0x07, 0x01, HDA_INPUT), |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 3853 | { } /* end */ |
| 3854 | }; |
| 3855 | |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 3856 | static struct snd_kcontrol_new alc260_pc_beep_mixer[] = { |
| 3857 | HDA_CODEC_VOLUME("PC Speaker Playback Volume", 0x07, 0x05, HDA_INPUT), |
| 3858 | HDA_CODEC_MUTE("PC Speaker Playback Switch", 0x07, 0x05, HDA_INPUT), |
| 3859 | { } /* end */ |
| 3860 | }; |
| 3861 | |
Takashi Iwai | bec15c3 | 2008-01-28 18:16:30 +0100 | [diff] [blame] | 3862 | /* update HP, line and mono out pins according to the master switch */ |
| 3863 | static void alc260_hp_master_update(struct hda_codec *codec, |
| 3864 | hda_nid_t hp, hda_nid_t line, |
| 3865 | hda_nid_t mono) |
| 3866 | { |
| 3867 | struct alc_spec *spec = codec->spec; |
| 3868 | unsigned int val = spec->master_sw ? PIN_HP : 0; |
| 3869 | /* change HP and line-out pins */ |
| 3870 | snd_hda_codec_write(codec, 0x0f, 0, AC_VERB_SET_PIN_WIDGET_CONTROL, |
| 3871 | val); |
| 3872 | snd_hda_codec_write(codec, 0x10, 0, AC_VERB_SET_PIN_WIDGET_CONTROL, |
| 3873 | val); |
| 3874 | /* mono (speaker) depending on the HP jack sense */ |
| 3875 | val = (val && !spec->jack_present) ? PIN_OUT : 0; |
| 3876 | snd_hda_codec_write(codec, 0x11, 0, AC_VERB_SET_PIN_WIDGET_CONTROL, |
| 3877 | val); |
| 3878 | } |
| 3879 | |
| 3880 | static int alc260_hp_master_sw_get(struct snd_kcontrol *kcontrol, |
| 3881 | struct snd_ctl_elem_value *ucontrol) |
| 3882 | { |
| 3883 | struct hda_codec *codec = snd_kcontrol_chip(kcontrol); |
| 3884 | struct alc_spec *spec = codec->spec; |
| 3885 | *ucontrol->value.integer.value = spec->master_sw; |
| 3886 | return 0; |
| 3887 | } |
| 3888 | |
| 3889 | static int alc260_hp_master_sw_put(struct snd_kcontrol *kcontrol, |
| 3890 | struct snd_ctl_elem_value *ucontrol) |
| 3891 | { |
| 3892 | struct hda_codec *codec = snd_kcontrol_chip(kcontrol); |
| 3893 | struct alc_spec *spec = codec->spec; |
| 3894 | int val = !!*ucontrol->value.integer.value; |
| 3895 | hda_nid_t hp, line, mono; |
| 3896 | |
| 3897 | if (val == spec->master_sw) |
| 3898 | return 0; |
| 3899 | spec->master_sw = val; |
| 3900 | hp = (kcontrol->private_value >> 16) & 0xff; |
| 3901 | line = (kcontrol->private_value >> 8) & 0xff; |
| 3902 | mono = kcontrol->private_value & 0xff; |
| 3903 | alc260_hp_master_update(codec, hp, line, mono); |
| 3904 | return 1; |
| 3905 | } |
| 3906 | |
| 3907 | static struct snd_kcontrol_new alc260_hp_output_mixer[] = { |
| 3908 | { |
| 3909 | .iface = SNDRV_CTL_ELEM_IFACE_MIXER, |
| 3910 | .name = "Master Playback Switch", |
| 3911 | .info = snd_ctl_boolean_mono_info, |
| 3912 | .get = alc260_hp_master_sw_get, |
| 3913 | .put = alc260_hp_master_sw_put, |
| 3914 | .private_value = (0x0f << 16) | (0x10 << 8) | 0x11 |
| 3915 | }, |
| 3916 | HDA_CODEC_VOLUME("Front Playback Volume", 0x08, 0x0, HDA_OUTPUT), |
| 3917 | HDA_BIND_MUTE("Front Playback Switch", 0x08, 2, HDA_INPUT), |
| 3918 | HDA_CODEC_VOLUME("Headphone Playback Volume", 0x09, 0x0, HDA_OUTPUT), |
| 3919 | HDA_BIND_MUTE("Headphone Playback Switch", 0x09, 2, HDA_INPUT), |
| 3920 | HDA_CODEC_VOLUME_MONO("Speaker Playback Volume", 0x0a, 1, 0x0, |
| 3921 | HDA_OUTPUT), |
| 3922 | HDA_BIND_MUTE_MONO("Speaker Playback Switch", 0x0a, 1, 2, HDA_INPUT), |
| 3923 | { } /* end */ |
| 3924 | }; |
| 3925 | |
| 3926 | static struct hda_verb alc260_hp_unsol_verbs[] = { |
| 3927 | {0x10, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT}, |
| 3928 | {}, |
| 3929 | }; |
| 3930 | |
| 3931 | static void alc260_hp_automute(struct hda_codec *codec) |
| 3932 | { |
| 3933 | struct alc_spec *spec = codec->spec; |
| 3934 | unsigned int present; |
| 3935 | |
| 3936 | present = snd_hda_codec_read(codec, 0x10, 0, |
| 3937 | AC_VERB_GET_PIN_SENSE, 0); |
| 3938 | spec->jack_present = (present & AC_PINSENSE_PRESENCE) != 0; |
| 3939 | alc260_hp_master_update(codec, 0x0f, 0x10, 0x11); |
| 3940 | } |
| 3941 | |
| 3942 | static void alc260_hp_unsol_event(struct hda_codec *codec, unsigned int res) |
| 3943 | { |
| 3944 | if ((res >> 26) == ALC880_HP_EVENT) |
| 3945 | alc260_hp_automute(codec); |
| 3946 | } |
| 3947 | |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 3948 | static struct snd_kcontrol_new alc260_hp_3013_mixer[] = { |
Takashi Iwai | bec15c3 | 2008-01-28 18:16:30 +0100 | [diff] [blame] | 3949 | { |
| 3950 | .iface = SNDRV_CTL_ELEM_IFACE_MIXER, |
| 3951 | .name = "Master Playback Switch", |
| 3952 | .info = snd_ctl_boolean_mono_info, |
| 3953 | .get = alc260_hp_master_sw_get, |
| 3954 | .put = alc260_hp_master_sw_put, |
| 3955 | .private_value = (0x10 << 16) | (0x15 << 8) | 0x11 |
| 3956 | }, |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 3957 | HDA_CODEC_VOLUME("Front Playback Volume", 0x09, 0x0, HDA_OUTPUT), |
| 3958 | HDA_CODEC_MUTE("Front Playback Switch", 0x10, 0x0, HDA_OUTPUT), |
| 3959 | HDA_CODEC_VOLUME("Aux-In Playback Volume", 0x07, 0x06, HDA_INPUT), |
| 3960 | HDA_CODEC_MUTE("Aux-In Playback Switch", 0x07, 0x06, HDA_INPUT), |
| 3961 | HDA_CODEC_VOLUME("Headphone Playback Volume", 0x08, 0x0, HDA_OUTPUT), |
| 3962 | HDA_CODEC_MUTE("Headphone Playback Switch", 0x15, 0x0, HDA_OUTPUT), |
Takashi Iwai | 86cd929 | 2008-01-28 18:09:56 +0100 | [diff] [blame] | 3963 | HDA_CODEC_VOLUME_MONO("Speaker Playback Volume", 0x0a, 1, 0x0, HDA_OUTPUT), |
| 3964 | HDA_CODEC_MUTE_MONO("Speaker Playback Switch", 0x11, 1, 0x0, HDA_OUTPUT), |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 3965 | { } /* end */ |
| 3966 | }; |
| 3967 | |
Takashi Iwai | bec15c3 | 2008-01-28 18:16:30 +0100 | [diff] [blame] | 3968 | static struct hda_verb alc260_hp_3013_unsol_verbs[] = { |
| 3969 | {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT}, |
| 3970 | {}, |
| 3971 | }; |
| 3972 | |
| 3973 | static void alc260_hp_3013_automute(struct hda_codec *codec) |
| 3974 | { |
| 3975 | struct alc_spec *spec = codec->spec; |
| 3976 | unsigned int present; |
| 3977 | |
| 3978 | present = snd_hda_codec_read(codec, 0x15, 0, |
| 3979 | AC_VERB_GET_PIN_SENSE, 0); |
| 3980 | spec->jack_present = (present & AC_PINSENSE_PRESENCE) != 0; |
| 3981 | alc260_hp_master_update(codec, 0x10, 0x15, 0x11); |
| 3982 | } |
| 3983 | |
| 3984 | static void alc260_hp_3013_unsol_event(struct hda_codec *codec, |
| 3985 | unsigned int res) |
| 3986 | { |
| 3987 | if ((res >> 26) == ALC880_HP_EVENT) |
| 3988 | alc260_hp_3013_automute(codec); |
| 3989 | } |
| 3990 | |
Jonathan Woithe | a1e8d2d | 2006-03-28 12:47:09 +0200 | [diff] [blame] | 3991 | /* Fujitsu S702x series laptops. ALC260 pin usage: Mic/Line jack = 0x12, |
| 3992 | * HP jack = 0x14, CD audio = 0x16, internal speaker = 0x10. |
| 3993 | */ |
Takashi Iwai | c8b6bf9 | 2005-11-17 14:57:47 +0100 | [diff] [blame] | 3994 | static struct snd_kcontrol_new alc260_fujitsu_mixer[] = { |
Jonathan Woithe | a9430dd | 2005-09-16 19:12:48 +0200 | [diff] [blame] | 3995 | HDA_CODEC_VOLUME("Headphone Playback Volume", 0x08, 0x0, HDA_OUTPUT), |
Takashi Iwai | 985be54 | 2005-11-02 18:26:49 +0100 | [diff] [blame] | 3996 | HDA_BIND_MUTE("Headphone Playback Switch", 0x08, 2, HDA_INPUT), |
Jonathan Woithe | 4c5186e | 2006-02-09 11:53:48 +0100 | [diff] [blame] | 3997 | ALC_PIN_MODE("Headphone Jack Mode", 0x14, ALC_PIN_DIR_INOUT), |
Jonathan Woithe | a9430dd | 2005-09-16 19:12:48 +0200 | [diff] [blame] | 3998 | HDA_CODEC_VOLUME("CD Playback Volume", 0x07, 0x04, HDA_INPUT), |
| 3999 | HDA_CODEC_MUTE("CD Playback Switch", 0x07, 0x04, HDA_INPUT), |
| 4000 | HDA_CODEC_VOLUME("Mic/Line Playback Volume", 0x07, 0x0, HDA_INPUT), |
| 4001 | HDA_CODEC_MUTE("Mic/Line Playback Switch", 0x07, 0x0, HDA_INPUT), |
Jonathan Woithe | 4c5186e | 2006-02-09 11:53:48 +0100 | [diff] [blame] | 4002 | ALC_PIN_MODE("Mic/Line Jack Mode", 0x12, ALC_PIN_DIR_IN), |
Jonathan Woithe | a9430dd | 2005-09-16 19:12:48 +0200 | [diff] [blame] | 4003 | HDA_CODEC_VOLUME("Beep Playback Volume", 0x07, 0x05, HDA_INPUT), |
| 4004 | HDA_CODEC_MUTE("Beep Playback Switch", 0x07, 0x05, HDA_INPUT), |
Takashi Iwai | 31bffaa | 2008-02-27 16:10:44 +0100 | [diff] [blame] | 4005 | HDA_CODEC_VOLUME("Speaker Playback Volume", 0x09, 0x0, HDA_OUTPUT), |
| 4006 | HDA_BIND_MUTE("Speaker Playback Switch", 0x09, 2, HDA_INPUT), |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 4007 | { } /* end */ |
| 4008 | }; |
| 4009 | |
Jonathan Woithe | a1e8d2d | 2006-03-28 12:47:09 +0200 | [diff] [blame] | 4010 | /* Mixer for Acer TravelMate(/Extensa/Aspire) notebooks. Note that current |
| 4011 | * versions of the ALC260 don't act on requests to enable mic bias from NID |
| 4012 | * 0x0f (used to drive the headphone jack in these laptops). The ALC260 |
| 4013 | * datasheet doesn't mention this restriction. At this stage it's not clear |
| 4014 | * whether this behaviour is intentional or is a hardware bug in chip |
| 4015 | * revisions available in early 2006. Therefore for now allow the |
| 4016 | * "Headphone Jack Mode" control to span all choices, but if it turns out |
| 4017 | * that the lack of mic bias for this NID is intentional we could change the |
| 4018 | * mode from ALC_PIN_DIR_INOUT to ALC_PIN_DIR_INOUT_NOMICBIAS. |
| 4019 | * |
| 4020 | * In addition, Acer TravelMate(/Extensa/Aspire) notebooks in early 2006 |
| 4021 | * don't appear to make the mic bias available from the "line" jack, even |
| 4022 | * though the NID used for this jack (0x14) can supply it. The theory is |
| 4023 | * that perhaps Acer have included blocking capacitors between the ALC260 |
| 4024 | * and the output jack. If this turns out to be the case for all such |
| 4025 | * models the "Line Jack Mode" mode could be changed from ALC_PIN_DIR_INOUT |
| 4026 | * to ALC_PIN_DIR_INOUT_NOMICBIAS. |
Jonathan Woithe | bd86948 | 2006-11-28 11:35:52 +0100 | [diff] [blame] | 4027 | * |
| 4028 | * The C20x Tablet series have a mono internal speaker which is controlled |
| 4029 | * via the chip's Mono sum widget and pin complex, so include the necessary |
| 4030 | * controls for such models. On models without a "mono speaker" the control |
| 4031 | * won't do anything. |
Jonathan Woithe | a1e8d2d | 2006-03-28 12:47:09 +0200 | [diff] [blame] | 4032 | */ |
Jonathan Woithe | 0bfc90e | 2006-02-28 11:45:11 +0100 | [diff] [blame] | 4033 | static struct snd_kcontrol_new alc260_acer_mixer[] = { |
| 4034 | HDA_CODEC_VOLUME("Master Playback Volume", 0x08, 0x0, HDA_OUTPUT), |
| 4035 | HDA_BIND_MUTE("Master Playback Switch", 0x08, 2, HDA_INPUT), |
Jonathan Woithe | a1e8d2d | 2006-03-28 12:47:09 +0200 | [diff] [blame] | 4036 | ALC_PIN_MODE("Headphone Jack Mode", 0x0f, ALC_PIN_DIR_INOUT), |
Takashi Iwai | 31bffaa | 2008-02-27 16:10:44 +0100 | [diff] [blame] | 4037 | HDA_CODEC_VOLUME_MONO("Speaker Playback Volume", 0x0a, 1, 0x0, |
Jonathan Woithe | bd86948 | 2006-11-28 11:35:52 +0100 | [diff] [blame] | 4038 | HDA_OUTPUT), |
Takashi Iwai | 31bffaa | 2008-02-27 16:10:44 +0100 | [diff] [blame] | 4039 | HDA_BIND_MUTE_MONO("Speaker Playback Switch", 0x0a, 1, 2, |
Jonathan Woithe | bd86948 | 2006-11-28 11:35:52 +0100 | [diff] [blame] | 4040 | HDA_INPUT), |
Jonathan Woithe | 0bfc90e | 2006-02-28 11:45:11 +0100 | [diff] [blame] | 4041 | HDA_CODEC_VOLUME("CD Playback Volume", 0x07, 0x04, HDA_INPUT), |
| 4042 | HDA_CODEC_MUTE("CD Playback Switch", 0x07, 0x04, HDA_INPUT), |
| 4043 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x07, 0x0, HDA_INPUT), |
| 4044 | HDA_CODEC_MUTE("Mic Playback Switch", 0x07, 0x0, HDA_INPUT), |
| 4045 | ALC_PIN_MODE("Mic Jack Mode", 0x12, ALC_PIN_DIR_IN), |
| 4046 | HDA_CODEC_VOLUME("Line Playback Volume", 0x07, 0x02, HDA_INPUT), |
| 4047 | HDA_CODEC_MUTE("Line Playback Switch", 0x07, 0x02, HDA_INPUT), |
| 4048 | ALC_PIN_MODE("Line Jack Mode", 0x14, ALC_PIN_DIR_INOUT), |
| 4049 | HDA_CODEC_VOLUME("Beep Playback Volume", 0x07, 0x05, HDA_INPUT), |
| 4050 | HDA_CODEC_MUTE("Beep Playback Switch", 0x07, 0x05, HDA_INPUT), |
| 4051 | { } /* end */ |
| 4052 | }; |
| 4053 | |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 4054 | /* Packard bell V7900 ALC260 pin usage: HP = 0x0f, Mic jack = 0x12, |
| 4055 | * Line In jack = 0x14, CD audio = 0x16, pc beep = 0x17. |
| 4056 | */ |
| 4057 | static struct snd_kcontrol_new alc260_will_mixer[] = { |
| 4058 | HDA_CODEC_VOLUME("Master Playback Volume", 0x08, 0x0, HDA_OUTPUT), |
| 4059 | HDA_BIND_MUTE("Master Playback Switch", 0x08, 0x2, HDA_INPUT), |
| 4060 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x07, 0x0, HDA_INPUT), |
| 4061 | HDA_CODEC_MUTE("Mic Playback Switch", 0x07, 0x0, HDA_INPUT), |
| 4062 | ALC_PIN_MODE("Mic Jack Mode", 0x12, ALC_PIN_DIR_IN), |
| 4063 | HDA_CODEC_VOLUME("Line Playback Volume", 0x07, 0x02, HDA_INPUT), |
| 4064 | HDA_CODEC_MUTE("Line Playback Switch", 0x07, 0x02, HDA_INPUT), |
| 4065 | ALC_PIN_MODE("Line Jack Mode", 0x14, ALC_PIN_DIR_INOUT), |
| 4066 | HDA_CODEC_VOLUME("CD Playback Volume", 0x07, 0x04, HDA_INPUT), |
| 4067 | HDA_CODEC_MUTE("CD Playback Switch", 0x07, 0x04, HDA_INPUT), |
| 4068 | HDA_CODEC_VOLUME("Beep Playback Volume", 0x07, 0x05, HDA_INPUT), |
| 4069 | HDA_CODEC_MUTE("Beep Playback Switch", 0x07, 0x05, HDA_INPUT), |
| 4070 | { } /* end */ |
| 4071 | }; |
| 4072 | |
| 4073 | /* Replacer 672V ALC260 pin usage: Mic jack = 0x12, |
| 4074 | * Line In jack = 0x14, ATAPI Mic = 0x13, speaker = 0x0f. |
| 4075 | */ |
| 4076 | static struct snd_kcontrol_new alc260_replacer_672v_mixer[] = { |
| 4077 | HDA_CODEC_VOLUME("Master Playback Volume", 0x08, 0x0, HDA_OUTPUT), |
| 4078 | HDA_BIND_MUTE("Master Playback Switch", 0x08, 0x2, HDA_INPUT), |
| 4079 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x07, 0x0, HDA_INPUT), |
| 4080 | HDA_CODEC_MUTE("Mic Playback Switch", 0x07, 0x0, HDA_INPUT), |
| 4081 | ALC_PIN_MODE("Mic Jack Mode", 0x12, ALC_PIN_DIR_IN), |
| 4082 | HDA_CODEC_VOLUME("ATAPI Mic Playback Volume", 0x07, 0x1, HDA_INPUT), |
| 4083 | HDA_CODEC_MUTE("ATATI Mic Playback Switch", 0x07, 0x1, HDA_INPUT), |
| 4084 | HDA_CODEC_VOLUME("Line Playback Volume", 0x07, 0x02, HDA_INPUT), |
| 4085 | HDA_CODEC_MUTE("Line Playback Switch", 0x07, 0x02, HDA_INPUT), |
| 4086 | ALC_PIN_MODE("Line Jack Mode", 0x14, ALC_PIN_DIR_INOUT), |
| 4087 | { } /* end */ |
| 4088 | }; |
| 4089 | |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 4090 | /* capture mixer elements */ |
| 4091 | static struct snd_kcontrol_new alc260_capture_mixer[] = { |
Jonathan Woithe | a9430dd | 2005-09-16 19:12:48 +0200 | [diff] [blame] | 4092 | HDA_CODEC_VOLUME("Capture Volume", 0x04, 0x0, HDA_INPUT), |
| 4093 | HDA_CODEC_MUTE("Capture Switch", 0x04, 0x0, HDA_INPUT), |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 4094 | HDA_CODEC_VOLUME_IDX("Capture Volume", 1, 0x05, 0x0, HDA_INPUT), |
| 4095 | HDA_CODEC_MUTE_IDX("Capture Switch", 1, 0x05, 0x0, HDA_INPUT), |
Jonathan Woithe | a9430dd | 2005-09-16 19:12:48 +0200 | [diff] [blame] | 4096 | { |
| 4097 | .iface = SNDRV_CTL_ELEM_IFACE_MIXER, |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 4098 | /* The multiple "Capture Source" controls confuse alsamixer |
| 4099 | * So call somewhat different.. |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 4100 | */ |
| 4101 | /* .name = "Capture Source", */ |
| 4102 | .name = "Input Source", |
| 4103 | .count = 2, |
Jonathan Woithe | a9430dd | 2005-09-16 19:12:48 +0200 | [diff] [blame] | 4104 | .info = alc_mux_enum_info, |
| 4105 | .get = alc_mux_enum_get, |
| 4106 | .put = alc_mux_enum_put, |
| 4107 | }, |
| 4108 | { } /* end */ |
| 4109 | }; |
| 4110 | |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 4111 | static struct snd_kcontrol_new alc260_capture_alt_mixer[] = { |
| 4112 | HDA_CODEC_VOLUME("Capture Volume", 0x05, 0x0, HDA_INPUT), |
| 4113 | HDA_CODEC_MUTE("Capture Switch", 0x05, 0x0, HDA_INPUT), |
| 4114 | { |
| 4115 | .iface = SNDRV_CTL_ELEM_IFACE_MIXER, |
| 4116 | /* The multiple "Capture Source" controls confuse alsamixer |
| 4117 | * So call somewhat different.. |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 4118 | */ |
| 4119 | /* .name = "Capture Source", */ |
| 4120 | .name = "Input Source", |
| 4121 | .count = 1, |
| 4122 | .info = alc_mux_enum_info, |
| 4123 | .get = alc_mux_enum_get, |
| 4124 | .put = alc_mux_enum_put, |
| 4125 | }, |
| 4126 | { } /* end */ |
| 4127 | }; |
| 4128 | |
| 4129 | /* |
| 4130 | * initialization verbs |
| 4131 | */ |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 4132 | static struct hda_verb alc260_init_verbs[] = { |
| 4133 | /* Line In pin widget for input */ |
Takashi Iwai | 05acb86 | 2005-06-10 19:50:25 +0200 | [diff] [blame] | 4134 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 4135 | /* CD pin widget for input */ |
Takashi Iwai | 05acb86 | 2005-06-10 19:50:25 +0200 | [diff] [blame] | 4136 | {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 4137 | /* Mic1 (rear panel) pin widget for input and vref at 80% */ |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 4138 | {0x12, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80}, |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 4139 | /* Mic2 (front panel) pin widget for input and vref at 80% */ |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 4140 | {0x13, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80}, |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 4141 | /* LINE-2 is used for line-out in rear */ |
Takashi Iwai | 05acb86 | 2005-06-10 19:50:25 +0200 | [diff] [blame] | 4142 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 4143 | /* select line-out */ |
Jonathan Woithe | fd56f2d | 2006-01-24 10:35:46 +0100 | [diff] [blame] | 4144 | {0x0e, AC_VERB_SET_CONNECT_SEL, 0x00}, |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 4145 | /* LINE-OUT pin */ |
Takashi Iwai | 05acb86 | 2005-06-10 19:50:25 +0200 | [diff] [blame] | 4146 | {0x0f, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 4147 | /* enable HP */ |
Takashi Iwai | 05acb86 | 2005-06-10 19:50:25 +0200 | [diff] [blame] | 4148 | {0x10, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 4149 | /* enable Mono */ |
Takashi Iwai | 05acb86 | 2005-06-10 19:50:25 +0200 | [diff] [blame] | 4150 | {0x11, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 4151 | /* mute capture amp left and right */ |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 4152 | {0x04, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 4153 | /* set connection select to line in (default select for this ADC) */ |
| 4154 | {0x04, AC_VERB_SET_CONNECT_SEL, 0x02}, |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 4155 | /* mute capture amp left and right */ |
| 4156 | {0x05, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 4157 | /* set connection select to line in (default select for this ADC) */ |
| 4158 | {0x05, AC_VERB_SET_CONNECT_SEL, 0x02}, |
Takashi Iwai | 05acb86 | 2005-06-10 19:50:25 +0200 | [diff] [blame] | 4159 | /* set vol=0 Line-Out mixer amp left and right */ |
| 4160 | {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 4161 | /* unmute pin widget amp left and right (no gain on this amp) */ |
| 4162 | {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 4163 | /* set vol=0 HP mixer amp left and right */ |
| 4164 | {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 4165 | /* unmute pin widget amp left and right (no gain on this amp) */ |
| 4166 | {0x10, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 4167 | /* set vol=0 Mono mixer amp left and right */ |
| 4168 | {0x0a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 4169 | /* unmute pin widget amp left and right (no gain on this amp) */ |
| 4170 | {0x11, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 4171 | /* unmute LINE-2 out pin */ |
| 4172 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 4173 | /* Amp Indexes: CD = 0x04, Line In 1 = 0x02, Mic 1 = 0x00 & |
| 4174 | * Line In 2 = 0x03 |
| 4175 | */ |
Takashi Iwai | cb53c62 | 2007-08-10 17:21:45 +0200 | [diff] [blame] | 4176 | /* mute analog inputs */ |
| 4177 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 4178 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
| 4179 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)}, |
| 4180 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)}, |
| 4181 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)}, |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 4182 | /* Amp Indexes: DAC = 0x01 & mixer = 0x00 */ |
Takashi Iwai | 05acb86 | 2005-06-10 19:50:25 +0200 | [diff] [blame] | 4183 | /* mute Front out path */ |
| 4184 | {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 4185 | {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
| 4186 | /* mute Headphone out path */ |
| 4187 | {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 4188 | {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
| 4189 | /* mute Mono out path */ |
| 4190 | {0x0a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 4191 | {0x0a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 4192 | { } |
| 4193 | }; |
| 4194 | |
Takashi Iwai | 474167d | 2006-05-17 17:17:43 +0200 | [diff] [blame] | 4195 | #if 0 /* should be identical with alc260_init_verbs? */ |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 4196 | static struct hda_verb alc260_hp_init_verbs[] = { |
| 4197 | /* Headphone and output */ |
| 4198 | {0x10, AC_VERB_SET_PIN_WIDGET_CONTROL, 0xc0}, |
| 4199 | /* mono output */ |
| 4200 | {0x11, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x40}, |
| 4201 | /* Mic1 (rear panel) pin widget for input and vref at 80% */ |
| 4202 | {0x12, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24}, |
| 4203 | /* Mic2 (front panel) pin widget for input and vref at 80% */ |
| 4204 | {0x13, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24}, |
| 4205 | /* Line In pin widget for input */ |
| 4206 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20}, |
| 4207 | /* Line-2 pin widget for output */ |
| 4208 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x40}, |
| 4209 | /* CD pin widget for input */ |
| 4210 | {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20}, |
| 4211 | /* unmute amp left and right */ |
| 4212 | {0x04, AC_VERB_SET_AMP_GAIN_MUTE, 0x7000}, |
| 4213 | /* set connection select to line in (default select for this ADC) */ |
| 4214 | {0x04, AC_VERB_SET_CONNECT_SEL, 0x02}, |
| 4215 | /* unmute Line-Out mixer amp left and right (volume = 0) */ |
| 4216 | {0x08, AC_VERB_SET_AMP_GAIN_MUTE, 0xb000}, |
| 4217 | /* mute pin widget amp left and right (no gain on this amp) */ |
| 4218 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, 0x0000}, |
| 4219 | /* unmute HP mixer amp left and right (volume = 0) */ |
| 4220 | {0x09, AC_VERB_SET_AMP_GAIN_MUTE, 0xb000}, |
| 4221 | /* mute pin widget amp left and right (no gain on this amp) */ |
| 4222 | {0x10, AC_VERB_SET_AMP_GAIN_MUTE, 0x0000}, |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 4223 | /* Amp Indexes: CD = 0x04, Line In 1 = 0x02, Mic 1 = 0x00 & |
| 4224 | * Line In 2 = 0x03 |
| 4225 | */ |
Takashi Iwai | cb53c62 | 2007-08-10 17:21:45 +0200 | [diff] [blame] | 4226 | /* mute analog inputs */ |
| 4227 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 4228 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
| 4229 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)}, |
| 4230 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)}, |
| 4231 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)}, |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 4232 | /* Amp Indexes: DAC = 0x01 & mixer = 0x00 */ |
| 4233 | /* Unmute Front out path */ |
| 4234 | {0x08, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))}, |
| 4235 | {0x08, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x01 << 8))}, |
| 4236 | /* Unmute Headphone out path */ |
| 4237 | {0x09, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))}, |
| 4238 | {0x09, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x01 << 8))}, |
| 4239 | /* Unmute Mono out path */ |
| 4240 | {0x0a, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))}, |
| 4241 | {0x0a, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x01 << 8))}, |
| 4242 | { } |
| 4243 | }; |
Takashi Iwai | 474167d | 2006-05-17 17:17:43 +0200 | [diff] [blame] | 4244 | #endif |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 4245 | |
| 4246 | static struct hda_verb alc260_hp_3013_init_verbs[] = { |
| 4247 | /* Line out and output */ |
| 4248 | {0x10, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x40}, |
| 4249 | /* mono output */ |
| 4250 | {0x11, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x40}, |
| 4251 | /* Mic1 (rear panel) pin widget for input and vref at 80% */ |
| 4252 | {0x12, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24}, |
| 4253 | /* Mic2 (front panel) pin widget for input and vref at 80% */ |
| 4254 | {0x13, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24}, |
| 4255 | /* Line In pin widget for input */ |
| 4256 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20}, |
| 4257 | /* Headphone pin widget for output */ |
| 4258 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, 0xc0}, |
| 4259 | /* CD pin widget for input */ |
| 4260 | {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20}, |
| 4261 | /* unmute amp left and right */ |
| 4262 | {0x04, AC_VERB_SET_AMP_GAIN_MUTE, 0x7000}, |
| 4263 | /* set connection select to line in (default select for this ADC) */ |
| 4264 | {0x04, AC_VERB_SET_CONNECT_SEL, 0x02}, |
| 4265 | /* unmute Line-Out mixer amp left and right (volume = 0) */ |
| 4266 | {0x08, AC_VERB_SET_AMP_GAIN_MUTE, 0xb000}, |
| 4267 | /* mute pin widget amp left and right (no gain on this amp) */ |
| 4268 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, 0x0000}, |
| 4269 | /* unmute HP mixer amp left and right (volume = 0) */ |
| 4270 | {0x09, AC_VERB_SET_AMP_GAIN_MUTE, 0xb000}, |
| 4271 | /* mute pin widget amp left and right (no gain on this amp) */ |
| 4272 | {0x10, AC_VERB_SET_AMP_GAIN_MUTE, 0x0000}, |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 4273 | /* Amp Indexes: CD = 0x04, Line In 1 = 0x02, Mic 1 = 0x00 & |
| 4274 | * Line In 2 = 0x03 |
| 4275 | */ |
Takashi Iwai | cb53c62 | 2007-08-10 17:21:45 +0200 | [diff] [blame] | 4276 | /* mute analog inputs */ |
| 4277 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 4278 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
| 4279 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)}, |
| 4280 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)}, |
| 4281 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)}, |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 4282 | /* Amp Indexes: DAC = 0x01 & mixer = 0x00 */ |
| 4283 | /* Unmute Front out path */ |
| 4284 | {0x08, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))}, |
| 4285 | {0x08, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x01 << 8))}, |
| 4286 | /* Unmute Headphone out path */ |
| 4287 | {0x09, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))}, |
| 4288 | {0x09, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x01 << 8))}, |
| 4289 | /* Unmute Mono out path */ |
| 4290 | {0x0a, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))}, |
| 4291 | {0x0a, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x01 << 8))}, |
| 4292 | { } |
| 4293 | }; |
| 4294 | |
Jonathan Woithe | a9430dd | 2005-09-16 19:12:48 +0200 | [diff] [blame] | 4295 | /* Initialisation sequence for ALC260 as configured in Fujitsu S702x |
Jonathan Woithe | a1e8d2d | 2006-03-28 12:47:09 +0200 | [diff] [blame] | 4296 | * laptops. ALC260 pin usage: Mic/Line jack = 0x12, HP jack = 0x14, CD |
| 4297 | * audio = 0x16, internal speaker = 0x10. |
Jonathan Woithe | a9430dd | 2005-09-16 19:12:48 +0200 | [diff] [blame] | 4298 | */ |
| 4299 | static struct hda_verb alc260_fujitsu_init_verbs[] = { |
| 4300 | /* Disable all GPIOs */ |
| 4301 | {0x01, AC_VERB_SET_GPIO_MASK, 0}, |
| 4302 | /* Internal speaker is connected to headphone pin */ |
| 4303 | {0x10, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 4304 | /* Headphone/Line-out jack connects to Line1 pin; make it an output */ |
| 4305 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
Jonathan Woithe | f7ace40 | 2006-02-28 11:46:14 +0100 | [diff] [blame] | 4306 | /* Mic/Line-in jack is connected to mic1 pin, so make it an input */ |
| 4307 | {0x12, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
| 4308 | /* Ensure all other unused pins are disabled and muted. */ |
| 4309 | {0x0f, AC_VERB_SET_PIN_WIDGET_CONTROL, 0}, |
| 4310 | {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
Jonathan Woithe | a9430dd | 2005-09-16 19:12:48 +0200 | [diff] [blame] | 4311 | {0x11, AC_VERB_SET_PIN_WIDGET_CONTROL, 0}, |
Jonathan Woithe | f7ace40 | 2006-02-28 11:46:14 +0100 | [diff] [blame] | 4312 | {0x11, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
Jonathan Woithe | a9430dd | 2005-09-16 19:12:48 +0200 | [diff] [blame] | 4313 | {0x13, AC_VERB_SET_PIN_WIDGET_CONTROL, 0}, |
Jonathan Woithe | f7ace40 | 2006-02-28 11:46:14 +0100 | [diff] [blame] | 4314 | {0x13, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 4315 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, 0}, |
| 4316 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
Jonathan Woithe | a9430dd | 2005-09-16 19:12:48 +0200 | [diff] [blame] | 4317 | |
Jonathan Woithe | f7ace40 | 2006-02-28 11:46:14 +0100 | [diff] [blame] | 4318 | /* Disable digital (SPDIF) pins */ |
| 4319 | {0x03, AC_VERB_SET_DIGI_CONVERT_1, 0}, |
| 4320 | {0x06, AC_VERB_SET_DIGI_CONVERT_1, 0}, |
Jonathan Woithe | 4c5186e | 2006-02-09 11:53:48 +0100 | [diff] [blame] | 4321 | |
Jonathan Woithe | f7ace40 | 2006-02-28 11:46:14 +0100 | [diff] [blame] | 4322 | /* Ensure Line1 pin widget takes its input from the OUT1 sum bus |
| 4323 | * when acting as an output. |
| 4324 | */ |
| 4325 | {0x0d, AC_VERB_SET_CONNECT_SEL, 0}, |
| 4326 | |
| 4327 | /* Start with output sum widgets muted and their output gains at min */ |
Takashi Iwai | 8b33a5a | 2006-02-09 11:57:01 +0100 | [diff] [blame] | 4328 | {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 4329 | {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
| 4330 | {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 4331 | {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 4332 | {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
| 4333 | {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 4334 | {0x0a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 4335 | {0x0a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
| 4336 | {0x0a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
Jonathan Woithe | a9430dd | 2005-09-16 19:12:48 +0200 | [diff] [blame] | 4337 | |
Jonathan Woithe | f7ace40 | 2006-02-28 11:46:14 +0100 | [diff] [blame] | 4338 | /* Unmute HP pin widget amp left and right (no equiv mixer ctrl) */ |
| 4339 | {0x10, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 4340 | /* Unmute Line1 pin widget output buffer since it starts as an output. |
| 4341 | * If the pin mode is changed by the user the pin mode control will |
| 4342 | * take care of enabling the pin's input/output buffers as needed. |
| 4343 | * Therefore there's no need to enable the input buffer at this |
| 4344 | * stage. |
Jonathan Woithe | cdcd926 | 2006-02-28 11:36:42 +0100 | [diff] [blame] | 4345 | */ |
Jonathan Woithe | f7ace40 | 2006-02-28 11:46:14 +0100 | [diff] [blame] | 4346 | {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
Jonathan Woithe | cdcd926 | 2006-02-28 11:36:42 +0100 | [diff] [blame] | 4347 | /* Unmute input buffer of pin widget used for Line-in (no equiv |
| 4348 | * mixer ctrl) |
| 4349 | */ |
Jonathan Woithe | f7ace40 | 2006-02-28 11:46:14 +0100 | [diff] [blame] | 4350 | {0x12, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
Jonathan Woithe | a9430dd | 2005-09-16 19:12:48 +0200 | [diff] [blame] | 4351 | |
Jonathan Woithe | f7ace40 | 2006-02-28 11:46:14 +0100 | [diff] [blame] | 4352 | /* Mute capture amp left and right */ |
| 4353 | {0x04, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 4354 | /* Set ADC connection select to match default mixer setting - line |
| 4355 | * in (on mic1 pin) |
| 4356 | */ |
| 4357 | {0x04, AC_VERB_SET_CONNECT_SEL, 0x00}, |
Jonathan Woithe | a9430dd | 2005-09-16 19:12:48 +0200 | [diff] [blame] | 4358 | |
Jonathan Woithe | f7ace40 | 2006-02-28 11:46:14 +0100 | [diff] [blame] | 4359 | /* Do the same for the second ADC: mute capture input amp and |
| 4360 | * set ADC connection to line in (on mic1 pin) |
| 4361 | */ |
| 4362 | {0x05, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 4363 | {0x05, AC_VERB_SET_CONNECT_SEL, 0x00}, |
Jonathan Woithe | 4c5186e | 2006-02-09 11:53:48 +0100 | [diff] [blame] | 4364 | |
Jonathan Woithe | f7ace40 | 2006-02-28 11:46:14 +0100 | [diff] [blame] | 4365 | /* Mute all inputs to mixer widget (even unconnected ones) */ |
| 4366 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, /* mic1 pin */ |
| 4367 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, /* mic2 pin */ |
| 4368 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)}, /* line1 pin */ |
| 4369 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)}, /* line2 pin */ |
| 4370 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)}, /* CD pin */ |
| 4371 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(5)}, /* Beep-gen pin */ |
| 4372 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(6)}, /* Line-out pin */ |
| 4373 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(7)}, /* HP-pin pin */ |
Takashi Iwai | 4a471b7 | 2005-12-07 13:56:29 +0100 | [diff] [blame] | 4374 | |
| 4375 | { } |
Jonathan Woithe | a9430dd | 2005-09-16 19:12:48 +0200 | [diff] [blame] | 4376 | }; |
| 4377 | |
Jonathan Woithe | 0bfc90e | 2006-02-28 11:45:11 +0100 | [diff] [blame] | 4378 | /* Initialisation sequence for ALC260 as configured in Acer TravelMate and |
| 4379 | * similar laptops (adapted from Fujitsu init verbs). |
| 4380 | */ |
| 4381 | static struct hda_verb alc260_acer_init_verbs[] = { |
| 4382 | /* On TravelMate laptops, GPIO 0 enables the internal speaker and |
| 4383 | * the headphone jack. Turn this on and rely on the standard mute |
| 4384 | * methods whenever the user wants to turn these outputs off. |
| 4385 | */ |
| 4386 | {0x01, AC_VERB_SET_GPIO_MASK, 0x01}, |
| 4387 | {0x01, AC_VERB_SET_GPIO_DIRECTION, 0x01}, |
| 4388 | {0x01, AC_VERB_SET_GPIO_DATA, 0x01}, |
| 4389 | /* Internal speaker/Headphone jack is connected to Line-out pin */ |
| 4390 | {0x0f, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 4391 | /* Internal microphone/Mic jack is connected to Mic1 pin */ |
| 4392 | {0x12, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF50}, |
| 4393 | /* Line In jack is connected to Line1 pin */ |
| 4394 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
Jonathan Woithe | bd86948 | 2006-11-28 11:35:52 +0100 | [diff] [blame] | 4395 | /* Some Acers (eg: C20x Tablets) use Mono pin for internal speaker */ |
| 4396 | {0x11, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
Jonathan Woithe | 0bfc90e | 2006-02-28 11:45:11 +0100 | [diff] [blame] | 4397 | /* Ensure all other unused pins are disabled and muted. */ |
| 4398 | {0x10, AC_VERB_SET_PIN_WIDGET_CONTROL, 0}, |
| 4399 | {0x10, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
Jonathan Woithe | 0bfc90e | 2006-02-28 11:45:11 +0100 | [diff] [blame] | 4400 | {0x13, AC_VERB_SET_PIN_WIDGET_CONTROL, 0}, |
| 4401 | {0x13, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 4402 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, 0}, |
| 4403 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 4404 | /* Disable digital (SPDIF) pins */ |
| 4405 | {0x03, AC_VERB_SET_DIGI_CONVERT_1, 0}, |
| 4406 | {0x06, AC_VERB_SET_DIGI_CONVERT_1, 0}, |
| 4407 | |
| 4408 | /* Ensure Mic1 and Line1 pin widgets take input from the OUT1 sum |
| 4409 | * bus when acting as outputs. |
| 4410 | */ |
| 4411 | {0x0b, AC_VERB_SET_CONNECT_SEL, 0}, |
| 4412 | {0x0d, AC_VERB_SET_CONNECT_SEL, 0}, |
| 4413 | |
| 4414 | /* Start with output sum widgets muted and their output gains at min */ |
| 4415 | {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 4416 | {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
| 4417 | {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 4418 | {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 4419 | {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
| 4420 | {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 4421 | {0x0a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 4422 | {0x0a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
| 4423 | {0x0a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 4424 | |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 4425 | /* Unmute Line-out pin widget amp left and right |
| 4426 | * (no equiv mixer ctrl) |
| 4427 | */ |
Jonathan Woithe | 0bfc90e | 2006-02-28 11:45:11 +0100 | [diff] [blame] | 4428 | {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
Jonathan Woithe | bd86948 | 2006-11-28 11:35:52 +0100 | [diff] [blame] | 4429 | /* Unmute mono pin widget amp output (no equiv mixer ctrl) */ |
| 4430 | {0x11, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
Jonathan Woithe | 0bfc90e | 2006-02-28 11:45:11 +0100 | [diff] [blame] | 4431 | /* Unmute Mic1 and Line1 pin widget input buffers since they start as |
| 4432 | * inputs. If the pin mode is changed by the user the pin mode control |
| 4433 | * will take care of enabling the pin's input/output buffers as needed. |
| 4434 | * Therefore there's no need to enable the input buffer at this |
| 4435 | * stage. |
| 4436 | */ |
| 4437 | {0x12, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 4438 | {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 4439 | |
| 4440 | /* Mute capture amp left and right */ |
| 4441 | {0x04, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 4442 | /* Set ADC connection select to match default mixer setting - mic |
| 4443 | * (on mic1 pin) |
| 4444 | */ |
| 4445 | {0x04, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 4446 | |
| 4447 | /* Do similar with the second ADC: mute capture input amp and |
Jonathan Woithe | a1e8d2d | 2006-03-28 12:47:09 +0200 | [diff] [blame] | 4448 | * set ADC connection to mic to match ALSA's default state. |
Jonathan Woithe | 0bfc90e | 2006-02-28 11:45:11 +0100 | [diff] [blame] | 4449 | */ |
| 4450 | {0x05, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
Jonathan Woithe | a1e8d2d | 2006-03-28 12:47:09 +0200 | [diff] [blame] | 4451 | {0x05, AC_VERB_SET_CONNECT_SEL, 0x00}, |
Jonathan Woithe | 0bfc90e | 2006-02-28 11:45:11 +0100 | [diff] [blame] | 4452 | |
| 4453 | /* Mute all inputs to mixer widget (even unconnected ones) */ |
| 4454 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, /* mic1 pin */ |
| 4455 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, /* mic2 pin */ |
| 4456 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)}, /* line1 pin */ |
| 4457 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)}, /* line2 pin */ |
| 4458 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)}, /* CD pin */ |
| 4459 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(5)}, /* Beep-gen pin */ |
| 4460 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(6)}, /* Line-out pin */ |
| 4461 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(7)}, /* HP-pin pin */ |
| 4462 | |
| 4463 | { } |
| 4464 | }; |
| 4465 | |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 4466 | static struct hda_verb alc260_will_verbs[] = { |
| 4467 | {0x0f, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 4468 | {0x0b, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 4469 | {0x0d, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 4470 | {0x0f, AC_VERB_SET_EAPD_BTLENABLE, 0x02}, |
| 4471 | {0x1a, AC_VERB_SET_COEF_INDEX, 0x07}, |
| 4472 | {0x1a, AC_VERB_SET_PROC_COEF, 0x3040}, |
| 4473 | {} |
| 4474 | }; |
| 4475 | |
| 4476 | static struct hda_verb alc260_replacer_672v_verbs[] = { |
| 4477 | {0x0f, AC_VERB_SET_EAPD_BTLENABLE, 0x02}, |
| 4478 | {0x1a, AC_VERB_SET_COEF_INDEX, 0x07}, |
| 4479 | {0x1a, AC_VERB_SET_PROC_COEF, 0x3050}, |
| 4480 | |
| 4481 | {0x01, AC_VERB_SET_GPIO_MASK, 0x01}, |
| 4482 | {0x01, AC_VERB_SET_GPIO_DIRECTION, 0x01}, |
| 4483 | {0x01, AC_VERB_SET_GPIO_DATA, 0x00}, |
| 4484 | |
| 4485 | {0x0f, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT}, |
| 4486 | {} |
| 4487 | }; |
| 4488 | |
| 4489 | /* toggle speaker-output according to the hp-jack state */ |
| 4490 | static void alc260_replacer_672v_automute(struct hda_codec *codec) |
| 4491 | { |
| 4492 | unsigned int present; |
| 4493 | |
| 4494 | /* speaker --> GPIO Data 0, hp or spdif --> GPIO data 1 */ |
| 4495 | present = snd_hda_codec_read(codec, 0x0f, 0, |
| 4496 | AC_VERB_GET_PIN_SENSE, 0) & 0x80000000; |
| 4497 | if (present) { |
Takashi Iwai | 82beb8f | 2007-08-10 17:09:26 +0200 | [diff] [blame] | 4498 | snd_hda_codec_write_cache(codec, 0x01, 0, |
| 4499 | AC_VERB_SET_GPIO_DATA, 1); |
| 4500 | snd_hda_codec_write_cache(codec, 0x0f, 0, |
| 4501 | AC_VERB_SET_PIN_WIDGET_CONTROL, |
| 4502 | PIN_HP); |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 4503 | } else { |
Takashi Iwai | 82beb8f | 2007-08-10 17:09:26 +0200 | [diff] [blame] | 4504 | snd_hda_codec_write_cache(codec, 0x01, 0, |
| 4505 | AC_VERB_SET_GPIO_DATA, 0); |
| 4506 | snd_hda_codec_write_cache(codec, 0x0f, 0, |
| 4507 | AC_VERB_SET_PIN_WIDGET_CONTROL, |
| 4508 | PIN_OUT); |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 4509 | } |
| 4510 | } |
| 4511 | |
| 4512 | static void alc260_replacer_672v_unsol_event(struct hda_codec *codec, |
| 4513 | unsigned int res) |
| 4514 | { |
| 4515 | if ((res >> 26) == ALC880_HP_EVENT) |
| 4516 | alc260_replacer_672v_automute(codec); |
| 4517 | } |
| 4518 | |
Jonathan Woithe | 7cf51e48 | 2006-02-09 12:01:26 +0100 | [diff] [blame] | 4519 | /* Test configuration for debugging, modelled after the ALC880 test |
| 4520 | * configuration. |
| 4521 | */ |
| 4522 | #ifdef CONFIG_SND_DEBUG |
| 4523 | static hda_nid_t alc260_test_dac_nids[1] = { |
| 4524 | 0x02, |
| 4525 | }; |
| 4526 | static hda_nid_t alc260_test_adc_nids[2] = { |
| 4527 | 0x04, 0x05, |
| 4528 | }; |
Jonathan Woithe | a1e8d2d | 2006-03-28 12:47:09 +0200 | [diff] [blame] | 4529 | /* For testing the ALC260, each input MUX needs its own definition since |
| 4530 | * the signal assignments are different. This assumes that the first ADC |
| 4531 | * is NID 0x04. |
Jonathan Woithe | 17e7aec | 2006-02-28 11:35:18 +0100 | [diff] [blame] | 4532 | */ |
Jonathan Woithe | a1e8d2d | 2006-03-28 12:47:09 +0200 | [diff] [blame] | 4533 | static struct hda_input_mux alc260_test_capture_sources[2] = { |
| 4534 | { |
| 4535 | .num_items = 7, |
| 4536 | .items = { |
| 4537 | { "MIC1 pin", 0x0 }, |
| 4538 | { "MIC2 pin", 0x1 }, |
| 4539 | { "LINE1 pin", 0x2 }, |
| 4540 | { "LINE2 pin", 0x3 }, |
| 4541 | { "CD pin", 0x4 }, |
| 4542 | { "LINE-OUT pin", 0x5 }, |
| 4543 | { "HP-OUT pin", 0x6 }, |
| 4544 | }, |
| 4545 | }, |
| 4546 | { |
| 4547 | .num_items = 8, |
| 4548 | .items = { |
| 4549 | { "MIC1 pin", 0x0 }, |
| 4550 | { "MIC2 pin", 0x1 }, |
| 4551 | { "LINE1 pin", 0x2 }, |
| 4552 | { "LINE2 pin", 0x3 }, |
| 4553 | { "CD pin", 0x4 }, |
| 4554 | { "Mixer", 0x5 }, |
| 4555 | { "LINE-OUT pin", 0x6 }, |
| 4556 | { "HP-OUT pin", 0x7 }, |
| 4557 | }, |
Jonathan Woithe | 7cf51e48 | 2006-02-09 12:01:26 +0100 | [diff] [blame] | 4558 | }, |
| 4559 | }; |
| 4560 | static struct snd_kcontrol_new alc260_test_mixer[] = { |
| 4561 | /* Output driver widgets */ |
| 4562 | HDA_CODEC_VOLUME_MONO("Mono Playback Volume", 0x0a, 1, 0x0, HDA_OUTPUT), |
| 4563 | HDA_BIND_MUTE_MONO("Mono Playback Switch", 0x0a, 1, 2, HDA_INPUT), |
| 4564 | HDA_CODEC_VOLUME("LOUT2 Playback Volume", 0x09, 0x0, HDA_OUTPUT), |
| 4565 | HDA_BIND_MUTE("LOUT2 Playback Switch", 0x09, 2, HDA_INPUT), |
| 4566 | HDA_CODEC_VOLUME("LOUT1 Playback Volume", 0x08, 0x0, HDA_OUTPUT), |
| 4567 | HDA_BIND_MUTE("LOUT1 Playback Switch", 0x08, 2, HDA_INPUT), |
| 4568 | |
Jonathan Woithe | a1e8d2d | 2006-03-28 12:47:09 +0200 | [diff] [blame] | 4569 | /* Modes for retasking pin widgets |
| 4570 | * Note: the ALC260 doesn't seem to act on requests to enable mic |
| 4571 | * bias from NIDs 0x0f and 0x10. The ALC260 datasheet doesn't |
| 4572 | * mention this restriction. At this stage it's not clear whether |
| 4573 | * this behaviour is intentional or is a hardware bug in chip |
| 4574 | * revisions available at least up until early 2006. Therefore for |
| 4575 | * now allow the "HP-OUT" and "LINE-OUT" Mode controls to span all |
| 4576 | * choices, but if it turns out that the lack of mic bias for these |
| 4577 | * NIDs is intentional we could change their modes from |
| 4578 | * ALC_PIN_DIR_INOUT to ALC_PIN_DIR_INOUT_NOMICBIAS. |
| 4579 | */ |
Jonathan Woithe | 7cf51e48 | 2006-02-09 12:01:26 +0100 | [diff] [blame] | 4580 | ALC_PIN_MODE("HP-OUT pin mode", 0x10, ALC_PIN_DIR_INOUT), |
| 4581 | ALC_PIN_MODE("LINE-OUT pin mode", 0x0f, ALC_PIN_DIR_INOUT), |
| 4582 | ALC_PIN_MODE("LINE2 pin mode", 0x15, ALC_PIN_DIR_INOUT), |
| 4583 | ALC_PIN_MODE("LINE1 pin mode", 0x14, ALC_PIN_DIR_INOUT), |
| 4584 | ALC_PIN_MODE("MIC2 pin mode", 0x13, ALC_PIN_DIR_INOUT), |
| 4585 | ALC_PIN_MODE("MIC1 pin mode", 0x12, ALC_PIN_DIR_INOUT), |
| 4586 | |
| 4587 | /* Loopback mixer controls */ |
| 4588 | HDA_CODEC_VOLUME("MIC1 Playback Volume", 0x07, 0x00, HDA_INPUT), |
| 4589 | HDA_CODEC_MUTE("MIC1 Playback Switch", 0x07, 0x00, HDA_INPUT), |
| 4590 | HDA_CODEC_VOLUME("MIC2 Playback Volume", 0x07, 0x01, HDA_INPUT), |
| 4591 | HDA_CODEC_MUTE("MIC2 Playback Switch", 0x07, 0x01, HDA_INPUT), |
| 4592 | HDA_CODEC_VOLUME("LINE1 Playback Volume", 0x07, 0x02, HDA_INPUT), |
| 4593 | HDA_CODEC_MUTE("LINE1 Playback Switch", 0x07, 0x02, HDA_INPUT), |
| 4594 | HDA_CODEC_VOLUME("LINE2 Playback Volume", 0x07, 0x03, HDA_INPUT), |
| 4595 | HDA_CODEC_MUTE("LINE2 Playback Switch", 0x07, 0x03, HDA_INPUT), |
| 4596 | HDA_CODEC_VOLUME("CD Playback Volume", 0x07, 0x04, HDA_INPUT), |
| 4597 | HDA_CODEC_MUTE("CD Playback Switch", 0x07, 0x04, HDA_INPUT), |
| 4598 | HDA_CODEC_VOLUME("Beep Playback Volume", 0x07, 0x05, HDA_INPUT), |
| 4599 | HDA_CODEC_MUTE("Beep Playback Switch", 0x07, 0x05, HDA_INPUT), |
| 4600 | HDA_CODEC_VOLUME("LINE-OUT loopback Playback Volume", 0x07, 0x06, HDA_INPUT), |
| 4601 | HDA_CODEC_MUTE("LINE-OUT loopback Playback Switch", 0x07, 0x06, HDA_INPUT), |
| 4602 | HDA_CODEC_VOLUME("HP-OUT loopback Playback Volume", 0x07, 0x7, HDA_INPUT), |
| 4603 | HDA_CODEC_MUTE("HP-OUT loopback Playback Switch", 0x07, 0x7, HDA_INPUT), |
Jonathan Woithe | 5c8f858 | 2006-02-28 11:43:27 +0100 | [diff] [blame] | 4604 | |
| 4605 | /* Controls for GPIO pins, assuming they are configured as outputs */ |
| 4606 | ALC_GPIO_DATA_SWITCH("GPIO pin 0", 0x01, 0x01), |
| 4607 | ALC_GPIO_DATA_SWITCH("GPIO pin 1", 0x01, 0x02), |
| 4608 | ALC_GPIO_DATA_SWITCH("GPIO pin 2", 0x01, 0x04), |
| 4609 | ALC_GPIO_DATA_SWITCH("GPIO pin 3", 0x01, 0x08), |
| 4610 | |
Jonathan Woithe | 92621f1 | 2006-02-28 11:47:47 +0100 | [diff] [blame] | 4611 | /* Switches to allow the digital IO pins to be enabled. The datasheet |
| 4612 | * is ambigious as to which NID is which; testing on laptops which |
| 4613 | * make this output available should provide clarification. |
| 4614 | */ |
| 4615 | ALC_SPDIF_CTRL_SWITCH("SPDIF Playback Switch", 0x03, 0x01), |
| 4616 | ALC_SPDIF_CTRL_SWITCH("SPDIF Capture Switch", 0x06, 0x01), |
| 4617 | |
Jonathan Woithe | f8225f6 | 2008-01-08 12:16:54 +0100 | [diff] [blame] | 4618 | /* A switch allowing EAPD to be enabled. Some laptops seem to use |
| 4619 | * this output to turn on an external amplifier. |
| 4620 | */ |
| 4621 | ALC_EAPD_CTRL_SWITCH("LINE-OUT EAPD Enable Switch", 0x0f, 0x02), |
| 4622 | ALC_EAPD_CTRL_SWITCH("HP-OUT EAPD Enable Switch", 0x10, 0x02), |
| 4623 | |
Jonathan Woithe | 7cf51e48 | 2006-02-09 12:01:26 +0100 | [diff] [blame] | 4624 | { } /* end */ |
| 4625 | }; |
| 4626 | static struct hda_verb alc260_test_init_verbs[] = { |
Jonathan Woithe | 5c8f858 | 2006-02-28 11:43:27 +0100 | [diff] [blame] | 4627 | /* Enable all GPIOs as outputs with an initial value of 0 */ |
| 4628 | {0x01, AC_VERB_SET_GPIO_DIRECTION, 0x0f}, |
| 4629 | {0x01, AC_VERB_SET_GPIO_DATA, 0x00}, |
| 4630 | {0x01, AC_VERB_SET_GPIO_MASK, 0x0f}, |
| 4631 | |
Jonathan Woithe | 7cf51e48 | 2006-02-09 12:01:26 +0100 | [diff] [blame] | 4632 | /* Enable retasking pins as output, initially without power amp */ |
| 4633 | {0x10, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 4634 | {0x0f, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 4635 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 4636 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 4637 | {0x13, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 4638 | {0x12, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 4639 | |
Jonathan Woithe | 92621f1 | 2006-02-28 11:47:47 +0100 | [diff] [blame] | 4640 | /* Disable digital (SPDIF) pins initially, but users can enable |
| 4641 | * them via a mixer switch. In the case of SPDIF-out, this initverb |
| 4642 | * payload also sets the generation to 0, output to be in "consumer" |
| 4643 | * PCM format, copyright asserted, no pre-emphasis and no validity |
| 4644 | * control. |
| 4645 | */ |
Jonathan Woithe | 7cf51e48 | 2006-02-09 12:01:26 +0100 | [diff] [blame] | 4646 | {0x03, AC_VERB_SET_DIGI_CONVERT_1, 0}, |
| 4647 | {0x06, AC_VERB_SET_DIGI_CONVERT_1, 0}, |
| 4648 | |
Jonathan Woithe | f7ace40 | 2006-02-28 11:46:14 +0100 | [diff] [blame] | 4649 | /* Ensure mic1, mic2, line1 and line2 pin widgets take input from the |
Jonathan Woithe | 7cf51e48 | 2006-02-09 12:01:26 +0100 | [diff] [blame] | 4650 | * OUT1 sum bus when acting as an output. |
| 4651 | */ |
| 4652 | {0x0b, AC_VERB_SET_CONNECT_SEL, 0}, |
| 4653 | {0x0c, AC_VERB_SET_CONNECT_SEL, 0}, |
| 4654 | {0x0d, AC_VERB_SET_CONNECT_SEL, 0}, |
| 4655 | {0x0e, AC_VERB_SET_CONNECT_SEL, 0}, |
| 4656 | |
| 4657 | /* Start with output sum widgets muted and their output gains at min */ |
| 4658 | {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 4659 | {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
| 4660 | {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 4661 | {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 4662 | {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
| 4663 | {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 4664 | {0x0a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 4665 | {0x0a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
| 4666 | {0x0a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 4667 | |
Jonathan Woithe | cdcd926 | 2006-02-28 11:36:42 +0100 | [diff] [blame] | 4668 | /* Unmute retasking pin widget output buffers since the default |
| 4669 | * state appears to be output. As the pin mode is changed by the |
| 4670 | * user the pin mode control will take care of enabling the pin's |
| 4671 | * input/output buffers as needed. |
| 4672 | */ |
Jonathan Woithe | 7cf51e48 | 2006-02-09 12:01:26 +0100 | [diff] [blame] | 4673 | {0x10, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 4674 | {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 4675 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 4676 | {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 4677 | {0x13, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 4678 | {0x12, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 4679 | /* Also unmute the mono-out pin widget */ |
| 4680 | {0x11, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 4681 | |
Jonathan Woithe | 7cf51e48 | 2006-02-09 12:01:26 +0100 | [diff] [blame] | 4682 | /* Mute capture amp left and right */ |
| 4683 | {0x04, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
Jonathan Woithe | f7ace40 | 2006-02-28 11:46:14 +0100 | [diff] [blame] | 4684 | /* Set ADC connection select to match default mixer setting (mic1 |
| 4685 | * pin) |
Jonathan Woithe | 7cf51e48 | 2006-02-09 12:01:26 +0100 | [diff] [blame] | 4686 | */ |
| 4687 | {0x04, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 4688 | |
| 4689 | /* Do the same for the second ADC: mute capture input amp and |
Jonathan Woithe | f7ace40 | 2006-02-28 11:46:14 +0100 | [diff] [blame] | 4690 | * set ADC connection to mic1 pin |
Jonathan Woithe | 7cf51e48 | 2006-02-09 12:01:26 +0100 | [diff] [blame] | 4691 | */ |
| 4692 | {0x05, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 4693 | {0x05, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 4694 | |
| 4695 | /* Mute all inputs to mixer widget (even unconnected ones) */ |
| 4696 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, /* mic1 pin */ |
| 4697 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, /* mic2 pin */ |
| 4698 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)}, /* line1 pin */ |
| 4699 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)}, /* line2 pin */ |
| 4700 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)}, /* CD pin */ |
| 4701 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(5)}, /* Beep-gen pin */ |
| 4702 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(6)}, /* Line-out pin */ |
| 4703 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(7)}, /* HP-pin pin */ |
| 4704 | |
| 4705 | { } |
| 4706 | }; |
| 4707 | #endif |
| 4708 | |
Takashi Iwai | 6330079 | 2008-01-24 15:31:36 +0100 | [diff] [blame] | 4709 | #define alc260_pcm_analog_playback alc880_pcm_analog_alt_playback |
| 4710 | #define alc260_pcm_analog_capture alc880_pcm_analog_capture |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 4711 | |
Takashi Iwai | a3bcba3 | 2005-12-06 19:05:29 +0100 | [diff] [blame] | 4712 | #define alc260_pcm_digital_playback alc880_pcm_digital_playback |
| 4713 | #define alc260_pcm_digital_capture alc880_pcm_digital_capture |
| 4714 | |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 4715 | /* |
| 4716 | * for BIOS auto-configuration |
| 4717 | */ |
| 4718 | |
| 4719 | static int alc260_add_playback_controls(struct alc_spec *spec, hda_nid_t nid, |
| 4720 | const char *pfx) |
| 4721 | { |
| 4722 | hda_nid_t nid_vol; |
| 4723 | unsigned long vol_val, sw_val; |
| 4724 | char name[32]; |
| 4725 | int err; |
| 4726 | |
| 4727 | if (nid >= 0x0f && nid < 0x11) { |
| 4728 | nid_vol = nid - 0x7; |
| 4729 | vol_val = HDA_COMPOSE_AMP_VAL(nid_vol, 3, 0, HDA_OUTPUT); |
| 4730 | sw_val = HDA_COMPOSE_AMP_VAL(nid, 3, 0, HDA_OUTPUT); |
| 4731 | } else if (nid == 0x11) { |
| 4732 | nid_vol = nid - 0x7; |
| 4733 | vol_val = HDA_COMPOSE_AMP_VAL(nid_vol, 2, 0, HDA_OUTPUT); |
| 4734 | sw_val = HDA_COMPOSE_AMP_VAL(nid, 2, 0, HDA_OUTPUT); |
| 4735 | } else if (nid >= 0x12 && nid <= 0x15) { |
| 4736 | nid_vol = 0x08; |
| 4737 | vol_val = HDA_COMPOSE_AMP_VAL(nid_vol, 3, 0, HDA_OUTPUT); |
| 4738 | sw_val = HDA_COMPOSE_AMP_VAL(nid, 3, 0, HDA_OUTPUT); |
| 4739 | } else |
| 4740 | return 0; /* N/A */ |
| 4741 | |
| 4742 | snprintf(name, sizeof(name), "%s Playback Volume", pfx); |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 4743 | err = add_control(spec, ALC_CTL_WIDGET_VOL, name, vol_val); |
| 4744 | if (err < 0) |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 4745 | return err; |
| 4746 | snprintf(name, sizeof(name), "%s Playback Switch", pfx); |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 4747 | err = add_control(spec, ALC_CTL_WIDGET_MUTE, name, sw_val); |
| 4748 | if (err < 0) |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 4749 | return err; |
| 4750 | return 1; |
| 4751 | } |
| 4752 | |
| 4753 | /* add playback controls from the parsed DAC table */ |
| 4754 | static int alc260_auto_create_multi_out_ctls(struct alc_spec *spec, |
| 4755 | const struct auto_pin_cfg *cfg) |
| 4756 | { |
| 4757 | hda_nid_t nid; |
| 4758 | int err; |
| 4759 | |
| 4760 | spec->multiout.num_dacs = 1; |
| 4761 | spec->multiout.dac_nids = spec->private_dac_nids; |
| 4762 | spec->multiout.dac_nids[0] = 0x02; |
| 4763 | |
| 4764 | nid = cfg->line_out_pins[0]; |
| 4765 | if (nid) { |
| 4766 | err = alc260_add_playback_controls(spec, nid, "Front"); |
| 4767 | if (err < 0) |
| 4768 | return err; |
| 4769 | } |
| 4770 | |
Takashi Iwai | 82bc955 | 2006-03-21 11:24:42 +0100 | [diff] [blame] | 4771 | nid = cfg->speaker_pins[0]; |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 4772 | if (nid) { |
| 4773 | err = alc260_add_playback_controls(spec, nid, "Speaker"); |
| 4774 | if (err < 0) |
| 4775 | return err; |
| 4776 | } |
| 4777 | |
Takashi Iwai | eb06ed8 | 2006-09-20 17:10:27 +0200 | [diff] [blame] | 4778 | nid = cfg->hp_pins[0]; |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 4779 | if (nid) { |
| 4780 | err = alc260_add_playback_controls(spec, nid, "Headphone"); |
| 4781 | if (err < 0) |
| 4782 | return err; |
| 4783 | } |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 4784 | return 0; |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 4785 | } |
| 4786 | |
| 4787 | /* create playback/capture controls for input pins */ |
| 4788 | static int alc260_auto_create_analog_input_ctls(struct alc_spec *spec, |
| 4789 | const struct auto_pin_cfg *cfg) |
| 4790 | { |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 4791 | struct hda_input_mux *imux = &spec->private_imux; |
| 4792 | int i, err, idx; |
| 4793 | |
| 4794 | for (i = 0; i < AUTO_PIN_LAST; i++) { |
| 4795 | if (cfg->input_pins[i] >= 0x12) { |
| 4796 | idx = cfg->input_pins[i] - 0x12; |
Takashi Iwai | 4a471b7 | 2005-12-07 13:56:29 +0100 | [diff] [blame] | 4797 | err = new_analog_input(spec, cfg->input_pins[i], |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 4798 | auto_pin_cfg_labels[i], idx, |
| 4799 | 0x07); |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 4800 | if (err < 0) |
| 4801 | return err; |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 4802 | imux->items[imux->num_items].label = |
| 4803 | auto_pin_cfg_labels[i]; |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 4804 | imux->items[imux->num_items].index = idx; |
| 4805 | imux->num_items++; |
| 4806 | } |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 4807 | if (cfg->input_pins[i] >= 0x0f && cfg->input_pins[i] <= 0x10){ |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 4808 | idx = cfg->input_pins[i] - 0x09; |
Takashi Iwai | 4a471b7 | 2005-12-07 13:56:29 +0100 | [diff] [blame] | 4809 | err = new_analog_input(spec, cfg->input_pins[i], |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 4810 | auto_pin_cfg_labels[i], idx, |
| 4811 | 0x07); |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 4812 | if (err < 0) |
| 4813 | return err; |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 4814 | imux->items[imux->num_items].label = |
| 4815 | auto_pin_cfg_labels[i]; |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 4816 | imux->items[imux->num_items].index = idx; |
| 4817 | imux->num_items++; |
| 4818 | } |
| 4819 | } |
| 4820 | return 0; |
| 4821 | } |
| 4822 | |
| 4823 | static void alc260_auto_set_output_and_unmute(struct hda_codec *codec, |
| 4824 | hda_nid_t nid, int pin_type, |
| 4825 | int sel_idx) |
| 4826 | { |
Takashi Iwai | f6c7e54 | 2008-02-12 18:32:23 +0100 | [diff] [blame] | 4827 | alc_set_pin_output(codec, nid, pin_type); |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 4828 | /* need the manual connection? */ |
| 4829 | if (nid >= 0x12) { |
| 4830 | int idx = nid - 0x12; |
| 4831 | snd_hda_codec_write(codec, idx + 0x0b, 0, |
| 4832 | AC_VERB_SET_CONNECT_SEL, sel_idx); |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 4833 | } |
| 4834 | } |
| 4835 | |
| 4836 | static void alc260_auto_init_multi_out(struct hda_codec *codec) |
| 4837 | { |
| 4838 | struct alc_spec *spec = codec->spec; |
| 4839 | hda_nid_t nid; |
| 4840 | |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 4841 | alc_subsystem_id(codec, 0x10, 0x15, 0x0f); |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 4842 | nid = spec->autocfg.line_out_pins[0]; |
Takashi Iwai | baba8ee | 2007-04-23 17:17:48 +0200 | [diff] [blame] | 4843 | if (nid) { |
| 4844 | int pin_type = get_pin_type(spec->autocfg.line_out_type); |
| 4845 | alc260_auto_set_output_and_unmute(codec, nid, pin_type, 0); |
| 4846 | } |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 4847 | |
Takashi Iwai | 82bc955 | 2006-03-21 11:24:42 +0100 | [diff] [blame] | 4848 | nid = spec->autocfg.speaker_pins[0]; |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 4849 | if (nid) |
| 4850 | alc260_auto_set_output_and_unmute(codec, nid, PIN_OUT, 0); |
| 4851 | |
Takashi Iwai | eb06ed8 | 2006-09-20 17:10:27 +0200 | [diff] [blame] | 4852 | nid = spec->autocfg.hp_pins[0]; |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 4853 | if (nid) |
Takashi Iwai | baba8ee | 2007-04-23 17:17:48 +0200 | [diff] [blame] | 4854 | alc260_auto_set_output_and_unmute(codec, nid, PIN_HP, 0); |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 4855 | } |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 4856 | |
| 4857 | #define ALC260_PIN_CD_NID 0x16 |
| 4858 | static void alc260_auto_init_analog_input(struct hda_codec *codec) |
| 4859 | { |
| 4860 | struct alc_spec *spec = codec->spec; |
| 4861 | int i; |
| 4862 | |
| 4863 | for (i = 0; i < AUTO_PIN_LAST; i++) { |
| 4864 | hda_nid_t nid = spec->autocfg.input_pins[i]; |
| 4865 | if (nid >= 0x12) { |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 4866 | snd_hda_codec_write(codec, nid, 0, |
| 4867 | AC_VERB_SET_PIN_WIDGET_CONTROL, |
| 4868 | i <= AUTO_PIN_FRONT_MIC ? |
| 4869 | PIN_VREF80 : PIN_IN); |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 4870 | if (nid != ALC260_PIN_CD_NID) |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 4871 | snd_hda_codec_write(codec, nid, 0, |
| 4872 | AC_VERB_SET_AMP_GAIN_MUTE, |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 4873 | AMP_OUT_MUTE); |
| 4874 | } |
| 4875 | } |
| 4876 | } |
| 4877 | |
| 4878 | /* |
| 4879 | * generic initialization of ADC, input mixers and output mixers |
| 4880 | */ |
| 4881 | static struct hda_verb alc260_volume_init_verbs[] = { |
| 4882 | /* |
| 4883 | * Unmute ADC0-1 and set the default input to mic-in |
| 4884 | */ |
| 4885 | {0x04, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 4886 | {0x04, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 4887 | {0x05, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 4888 | {0x05, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 4889 | |
| 4890 | /* Unmute input amps (CD, Line In, Mic 1 & Mic 2) of the analog-loopback |
| 4891 | * mixer widget |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 4892 | * Note: PASD motherboards uses the Line In 2 as the input for |
| 4893 | * front panel mic (mic 2) |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 4894 | */ |
| 4895 | /* Amp Indices: Mic1 = 0, Mic2 = 1, Line1 = 2, Line2 = 3, CD = 4 */ |
Takashi Iwai | cb53c62 | 2007-08-10 17:21:45 +0200 | [diff] [blame] | 4896 | /* mute analog inputs */ |
| 4897 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 4898 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
| 4899 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)}, |
| 4900 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)}, |
| 4901 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)}, |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 4902 | |
| 4903 | /* |
| 4904 | * Set up output mixers (0x08 - 0x0a) |
| 4905 | */ |
| 4906 | /* set vol=0 to output mixers */ |
| 4907 | {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 4908 | {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 4909 | {0x0a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 4910 | /* set up input amps for analog loopback */ |
| 4911 | /* Amp Indices: DAC = 0, mixer = 1 */ |
| 4912 | {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 4913 | {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 4914 | {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 4915 | {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 4916 | {0x0a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 4917 | {0x0a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 4918 | |
| 4919 | { } |
| 4920 | }; |
| 4921 | |
| 4922 | static int alc260_parse_auto_config(struct hda_codec *codec) |
| 4923 | { |
| 4924 | struct alc_spec *spec = codec->spec; |
| 4925 | unsigned int wcap; |
| 4926 | int err; |
| 4927 | static hda_nid_t alc260_ignore[] = { 0x17, 0 }; |
| 4928 | |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 4929 | err = snd_hda_parse_pin_def_config(codec, &spec->autocfg, |
| 4930 | alc260_ignore); |
| 4931 | if (err < 0) |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 4932 | return err; |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 4933 | err = alc260_auto_create_multi_out_ctls(spec, &spec->autocfg); |
| 4934 | if (err < 0) |
Takashi Iwai | 4a471b7 | 2005-12-07 13:56:29 +0100 | [diff] [blame] | 4935 | return err; |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 4936 | if (!spec->kctl_alloc) |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 4937 | return 0; /* can't find valid BIOS pin config */ |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 4938 | err = alc260_auto_create_analog_input_ctls(spec, &spec->autocfg); |
| 4939 | if (err < 0) |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 4940 | return err; |
| 4941 | |
| 4942 | spec->multiout.max_channels = 2; |
| 4943 | |
| 4944 | if (spec->autocfg.dig_out_pin) |
| 4945 | spec->multiout.dig_out_nid = ALC260_DIGOUT_NID; |
| 4946 | if (spec->kctl_alloc) |
| 4947 | spec->mixers[spec->num_mixers++] = spec->kctl_alloc; |
| 4948 | |
| 4949 | spec->init_verbs[spec->num_init_verbs++] = alc260_volume_init_verbs; |
| 4950 | |
Jonathan Woithe | a1e8d2d | 2006-03-28 12:47:09 +0200 | [diff] [blame] | 4951 | spec->num_mux_defs = 1; |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 4952 | spec->input_mux = &spec->private_imux; |
| 4953 | |
| 4954 | /* check whether NID 0x04 is valid */ |
Takashi Iwai | 4a471b7 | 2005-12-07 13:56:29 +0100 | [diff] [blame] | 4955 | wcap = get_wcaps(codec, 0x04); |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 4956 | wcap = (wcap & AC_WCAP_TYPE) >> AC_WCAP_TYPE_SHIFT; /* get type */ |
Takashi Iwai | 67ebcb0 | 2008-02-19 15:03:57 +0100 | [diff] [blame] | 4957 | if (wcap != AC_WID_AUD_IN || spec->input_mux->num_items == 1) { |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 4958 | spec->adc_nids = alc260_adc_nids_alt; |
| 4959 | spec->num_adc_nids = ARRAY_SIZE(alc260_adc_nids_alt); |
| 4960 | spec->mixers[spec->num_mixers] = alc260_capture_alt_mixer; |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 4961 | } else { |
| 4962 | spec->adc_nids = alc260_adc_nids; |
| 4963 | spec->num_adc_nids = ARRAY_SIZE(alc260_adc_nids); |
| 4964 | spec->mixers[spec->num_mixers] = alc260_capture_mixer; |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 4965 | } |
Takashi Iwai | 4a471b7 | 2005-12-07 13:56:29 +0100 | [diff] [blame] | 4966 | spec->num_mixers++; |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 4967 | |
| 4968 | return 1; |
| 4969 | } |
| 4970 | |
Takashi Iwai | ae6b813 | 2006-03-03 16:47:17 +0100 | [diff] [blame] | 4971 | /* additional initialization for auto-configuration model */ |
| 4972 | static void alc260_auto_init(struct hda_codec *codec) |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 4973 | { |
Takashi Iwai | f6c7e54 | 2008-02-12 18:32:23 +0100 | [diff] [blame] | 4974 | struct alc_spec *spec = codec->spec; |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 4975 | alc260_auto_init_multi_out(codec); |
| 4976 | alc260_auto_init_analog_input(codec); |
Takashi Iwai | f6c7e54 | 2008-02-12 18:32:23 +0100 | [diff] [blame] | 4977 | if (spec->unsol_event) |
| 4978 | alc_sku_automute(codec); |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 4979 | } |
| 4980 | |
Takashi Iwai | cb53c62 | 2007-08-10 17:21:45 +0200 | [diff] [blame] | 4981 | #ifdef CONFIG_SND_HDA_POWER_SAVE |
| 4982 | static struct hda_amp_list alc260_loopbacks[] = { |
| 4983 | { 0x07, HDA_INPUT, 0 }, |
| 4984 | { 0x07, HDA_INPUT, 1 }, |
| 4985 | { 0x07, HDA_INPUT, 2 }, |
| 4986 | { 0x07, HDA_INPUT, 3 }, |
| 4987 | { 0x07, HDA_INPUT, 4 }, |
| 4988 | { } /* end */ |
| 4989 | }; |
| 4990 | #endif |
| 4991 | |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 4992 | /* |
| 4993 | * ALC260 configurations |
| 4994 | */ |
Takashi Iwai | f5fcc13 | 2006-11-24 17:07:44 +0100 | [diff] [blame] | 4995 | static const char *alc260_models[ALC260_MODEL_LAST] = { |
| 4996 | [ALC260_BASIC] = "basic", |
| 4997 | [ALC260_HP] = "hp", |
| 4998 | [ALC260_HP_3013] = "hp-3013", |
| 4999 | [ALC260_FUJITSU_S702X] = "fujitsu", |
| 5000 | [ALC260_ACER] = "acer", |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 5001 | [ALC260_WILL] = "will", |
| 5002 | [ALC260_REPLACER_672V] = "replacer", |
Jonathan Woithe | 7cf51e48 | 2006-02-09 12:01:26 +0100 | [diff] [blame] | 5003 | #ifdef CONFIG_SND_DEBUG |
Takashi Iwai | f5fcc13 | 2006-11-24 17:07:44 +0100 | [diff] [blame] | 5004 | [ALC260_TEST] = "test", |
Jonathan Woithe | 7cf51e48 | 2006-02-09 12:01:26 +0100 | [diff] [blame] | 5005 | #endif |
Takashi Iwai | f5fcc13 | 2006-11-24 17:07:44 +0100 | [diff] [blame] | 5006 | [ALC260_AUTO] = "auto", |
| 5007 | }; |
| 5008 | |
| 5009 | static struct snd_pci_quirk alc260_cfg_tbl[] = { |
Jonathan Woithe | bd86948 | 2006-11-28 11:35:52 +0100 | [diff] [blame] | 5010 | SND_PCI_QUIRK(0x1025, 0x007b, "Acer C20x", ALC260_ACER), |
Takashi Iwai | f5fcc13 | 2006-11-24 17:07:44 +0100 | [diff] [blame] | 5011 | SND_PCI_QUIRK(0x1025, 0x008f, "Acer", ALC260_ACER), |
Takashi Iwai | 9720b71 | 2007-03-13 21:46:23 +0100 | [diff] [blame] | 5012 | SND_PCI_QUIRK(0x103c, 0x2808, "HP d5700", ALC260_HP_3013), |
Takashi Iwai | a8a5d06 | 2007-03-15 15:10:28 +0100 | [diff] [blame] | 5013 | SND_PCI_QUIRK(0x103c, 0x280a, "HP d5750", ALC260_HP_3013), |
Takashi Iwai | f5fcc13 | 2006-11-24 17:07:44 +0100 | [diff] [blame] | 5014 | SND_PCI_QUIRK(0x103c, 0x3010, "HP", ALC260_HP_3013), |
| 5015 | SND_PCI_QUIRK(0x103c, 0x3011, "HP", ALC260_HP), |
| 5016 | SND_PCI_QUIRK(0x103c, 0x3012, "HP", ALC260_HP_3013), |
| 5017 | SND_PCI_QUIRK(0x103c, 0x3013, "HP", ALC260_HP_3013), |
| 5018 | SND_PCI_QUIRK(0x103c, 0x3014, "HP", ALC260_HP), |
| 5019 | SND_PCI_QUIRK(0x103c, 0x3015, "HP", ALC260_HP), |
| 5020 | SND_PCI_QUIRK(0x103c, 0x3016, "HP", ALC260_HP), |
| 5021 | SND_PCI_QUIRK(0x104d, 0x81bb, "Sony VAIO", ALC260_BASIC), |
| 5022 | SND_PCI_QUIRK(0x104d, 0x81cc, "Sony VAIO", ALC260_BASIC), |
| 5023 | SND_PCI_QUIRK(0x104d, 0x81cd, "Sony VAIO", ALC260_BASIC), |
| 5024 | SND_PCI_QUIRK(0x10cf, 0x1326, "Fujitsu S702X", ALC260_FUJITSU_S702X), |
| 5025 | SND_PCI_QUIRK(0x152d, 0x0729, "CTL U553W", ALC260_BASIC), |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 5026 | SND_PCI_QUIRK(0x161f, 0x2057, "Replacer 672V", ALC260_REPLACER_672V), |
Takashi Iwai | ac3e374 | 2007-12-17 17:14:18 +0100 | [diff] [blame] | 5027 | SND_PCI_QUIRK(0x1631, 0xc017, "PB V7900", ALC260_WILL), |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 5028 | {} |
| 5029 | }; |
| 5030 | |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 5031 | static struct alc_config_preset alc260_presets[] = { |
| 5032 | [ALC260_BASIC] = { |
| 5033 | .mixers = { alc260_base_output_mixer, |
| 5034 | alc260_input_mixer, |
| 5035 | alc260_pc_beep_mixer, |
| 5036 | alc260_capture_mixer }, |
| 5037 | .init_verbs = { alc260_init_verbs }, |
| 5038 | .num_dacs = ARRAY_SIZE(alc260_dac_nids), |
| 5039 | .dac_nids = alc260_dac_nids, |
| 5040 | .num_adc_nids = ARRAY_SIZE(alc260_adc_nids), |
| 5041 | .adc_nids = alc260_adc_nids, |
| 5042 | .num_channel_mode = ARRAY_SIZE(alc260_modes), |
| 5043 | .channel_mode = alc260_modes, |
| 5044 | .input_mux = &alc260_capture_source, |
| 5045 | }, |
| 5046 | [ALC260_HP] = { |
Takashi Iwai | bec15c3 | 2008-01-28 18:16:30 +0100 | [diff] [blame] | 5047 | .mixers = { alc260_hp_output_mixer, |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 5048 | alc260_input_mixer, |
| 5049 | alc260_capture_alt_mixer }, |
Takashi Iwai | bec15c3 | 2008-01-28 18:16:30 +0100 | [diff] [blame] | 5050 | .init_verbs = { alc260_init_verbs, |
| 5051 | alc260_hp_unsol_verbs }, |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 5052 | .num_dacs = ARRAY_SIZE(alc260_dac_nids), |
| 5053 | .dac_nids = alc260_dac_nids, |
| 5054 | .num_adc_nids = ARRAY_SIZE(alc260_hp_adc_nids), |
| 5055 | .adc_nids = alc260_hp_adc_nids, |
| 5056 | .num_channel_mode = ARRAY_SIZE(alc260_modes), |
| 5057 | .channel_mode = alc260_modes, |
| 5058 | .input_mux = &alc260_capture_source, |
Takashi Iwai | bec15c3 | 2008-01-28 18:16:30 +0100 | [diff] [blame] | 5059 | .unsol_event = alc260_hp_unsol_event, |
| 5060 | .init_hook = alc260_hp_automute, |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 5061 | }, |
| 5062 | [ALC260_HP_3013] = { |
| 5063 | .mixers = { alc260_hp_3013_mixer, |
| 5064 | alc260_input_mixer, |
| 5065 | alc260_capture_alt_mixer }, |
Takashi Iwai | bec15c3 | 2008-01-28 18:16:30 +0100 | [diff] [blame] | 5066 | .init_verbs = { alc260_hp_3013_init_verbs, |
| 5067 | alc260_hp_3013_unsol_verbs }, |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 5068 | .num_dacs = ARRAY_SIZE(alc260_dac_nids), |
| 5069 | .dac_nids = alc260_dac_nids, |
| 5070 | .num_adc_nids = ARRAY_SIZE(alc260_hp_adc_nids), |
| 5071 | .adc_nids = alc260_hp_adc_nids, |
| 5072 | .num_channel_mode = ARRAY_SIZE(alc260_modes), |
| 5073 | .channel_mode = alc260_modes, |
| 5074 | .input_mux = &alc260_capture_source, |
Takashi Iwai | bec15c3 | 2008-01-28 18:16:30 +0100 | [diff] [blame] | 5075 | .unsol_event = alc260_hp_3013_unsol_event, |
| 5076 | .init_hook = alc260_hp_3013_automute, |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 5077 | }, |
| 5078 | [ALC260_FUJITSU_S702X] = { |
| 5079 | .mixers = { alc260_fujitsu_mixer, |
| 5080 | alc260_capture_mixer }, |
| 5081 | .init_verbs = { alc260_fujitsu_init_verbs }, |
| 5082 | .num_dacs = ARRAY_SIZE(alc260_dac_nids), |
| 5083 | .dac_nids = alc260_dac_nids, |
Jonathan Woithe | d57fdac | 2006-02-28 11:38:35 +0100 | [diff] [blame] | 5084 | .num_adc_nids = ARRAY_SIZE(alc260_dual_adc_nids), |
| 5085 | .adc_nids = alc260_dual_adc_nids, |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 5086 | .num_channel_mode = ARRAY_SIZE(alc260_modes), |
| 5087 | .channel_mode = alc260_modes, |
Jonathan Woithe | a1e8d2d | 2006-03-28 12:47:09 +0200 | [diff] [blame] | 5088 | .num_mux_defs = ARRAY_SIZE(alc260_fujitsu_capture_sources), |
| 5089 | .input_mux = alc260_fujitsu_capture_sources, |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 5090 | }, |
Jonathan Woithe | 0bfc90e | 2006-02-28 11:45:11 +0100 | [diff] [blame] | 5091 | [ALC260_ACER] = { |
| 5092 | .mixers = { alc260_acer_mixer, |
| 5093 | alc260_capture_mixer }, |
| 5094 | .init_verbs = { alc260_acer_init_verbs }, |
| 5095 | .num_dacs = ARRAY_SIZE(alc260_dac_nids), |
| 5096 | .dac_nids = alc260_dac_nids, |
| 5097 | .num_adc_nids = ARRAY_SIZE(alc260_dual_adc_nids), |
| 5098 | .adc_nids = alc260_dual_adc_nids, |
| 5099 | .num_channel_mode = ARRAY_SIZE(alc260_modes), |
| 5100 | .channel_mode = alc260_modes, |
Jonathan Woithe | a1e8d2d | 2006-03-28 12:47:09 +0200 | [diff] [blame] | 5101 | .num_mux_defs = ARRAY_SIZE(alc260_acer_capture_sources), |
| 5102 | .input_mux = alc260_acer_capture_sources, |
Jonathan Woithe | 0bfc90e | 2006-02-28 11:45:11 +0100 | [diff] [blame] | 5103 | }, |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 5104 | [ALC260_WILL] = { |
| 5105 | .mixers = { alc260_will_mixer, |
| 5106 | alc260_capture_mixer }, |
| 5107 | .init_verbs = { alc260_init_verbs, alc260_will_verbs }, |
| 5108 | .num_dacs = ARRAY_SIZE(alc260_dac_nids), |
| 5109 | .dac_nids = alc260_dac_nids, |
| 5110 | .num_adc_nids = ARRAY_SIZE(alc260_adc_nids), |
| 5111 | .adc_nids = alc260_adc_nids, |
| 5112 | .dig_out_nid = ALC260_DIGOUT_NID, |
| 5113 | .num_channel_mode = ARRAY_SIZE(alc260_modes), |
| 5114 | .channel_mode = alc260_modes, |
| 5115 | .input_mux = &alc260_capture_source, |
| 5116 | }, |
| 5117 | [ALC260_REPLACER_672V] = { |
| 5118 | .mixers = { alc260_replacer_672v_mixer, |
| 5119 | alc260_capture_mixer }, |
| 5120 | .init_verbs = { alc260_init_verbs, alc260_replacer_672v_verbs }, |
| 5121 | .num_dacs = ARRAY_SIZE(alc260_dac_nids), |
| 5122 | .dac_nids = alc260_dac_nids, |
| 5123 | .num_adc_nids = ARRAY_SIZE(alc260_adc_nids), |
| 5124 | .adc_nids = alc260_adc_nids, |
| 5125 | .dig_out_nid = ALC260_DIGOUT_NID, |
| 5126 | .num_channel_mode = ARRAY_SIZE(alc260_modes), |
| 5127 | .channel_mode = alc260_modes, |
| 5128 | .input_mux = &alc260_capture_source, |
| 5129 | .unsol_event = alc260_replacer_672v_unsol_event, |
| 5130 | .init_hook = alc260_replacer_672v_automute, |
| 5131 | }, |
Jonathan Woithe | 7cf51e48 | 2006-02-09 12:01:26 +0100 | [diff] [blame] | 5132 | #ifdef CONFIG_SND_DEBUG |
| 5133 | [ALC260_TEST] = { |
| 5134 | .mixers = { alc260_test_mixer, |
| 5135 | alc260_capture_mixer }, |
| 5136 | .init_verbs = { alc260_test_init_verbs }, |
| 5137 | .num_dacs = ARRAY_SIZE(alc260_test_dac_nids), |
| 5138 | .dac_nids = alc260_test_dac_nids, |
| 5139 | .num_adc_nids = ARRAY_SIZE(alc260_test_adc_nids), |
| 5140 | .adc_nids = alc260_test_adc_nids, |
| 5141 | .num_channel_mode = ARRAY_SIZE(alc260_modes), |
| 5142 | .channel_mode = alc260_modes, |
Jonathan Woithe | a1e8d2d | 2006-03-28 12:47:09 +0200 | [diff] [blame] | 5143 | .num_mux_defs = ARRAY_SIZE(alc260_test_capture_sources), |
| 5144 | .input_mux = alc260_test_capture_sources, |
Jonathan Woithe | 7cf51e48 | 2006-02-09 12:01:26 +0100 | [diff] [blame] | 5145 | }, |
| 5146 | #endif |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 5147 | }; |
| 5148 | |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 5149 | static int patch_alc260(struct hda_codec *codec) |
| 5150 | { |
| 5151 | struct alc_spec *spec; |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 5152 | int err, board_config; |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 5153 | |
Takashi Iwai | e560d8d | 2005-09-09 14:21:46 +0200 | [diff] [blame] | 5154 | spec = kzalloc(sizeof(*spec), GFP_KERNEL); |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 5155 | if (spec == NULL) |
| 5156 | return -ENOMEM; |
| 5157 | |
| 5158 | codec->spec = spec; |
| 5159 | |
Takashi Iwai | f5fcc13 | 2006-11-24 17:07:44 +0100 | [diff] [blame] | 5160 | board_config = snd_hda_check_board_config(codec, ALC260_MODEL_LAST, |
| 5161 | alc260_models, |
| 5162 | alc260_cfg_tbl); |
| 5163 | if (board_config < 0) { |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 5164 | snd_printd(KERN_INFO "hda_codec: Unknown model for ALC260, " |
| 5165 | "trying auto-probe from BIOS...\n"); |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 5166 | board_config = ALC260_AUTO; |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 5167 | } |
| 5168 | |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 5169 | if (board_config == ALC260_AUTO) { |
| 5170 | /* automatic parse from the BIOS config */ |
| 5171 | err = alc260_parse_auto_config(codec); |
| 5172 | if (err < 0) { |
| 5173 | alc_free(codec); |
| 5174 | return err; |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 5175 | } else if (!err) { |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 5176 | printk(KERN_INFO |
| 5177 | "hda_codec: Cannot set up configuration " |
| 5178 | "from BIOS. Using base mode...\n"); |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 5179 | board_config = ALC260_BASIC; |
| 5180 | } |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 5181 | } |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 5182 | |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 5183 | if (board_config != ALC260_AUTO) |
| 5184 | setup_preset(spec, &alc260_presets[board_config]); |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 5185 | |
| 5186 | spec->stream_name_analog = "ALC260 Analog"; |
| 5187 | spec->stream_analog_playback = &alc260_pcm_analog_playback; |
| 5188 | spec->stream_analog_capture = &alc260_pcm_analog_capture; |
| 5189 | |
Takashi Iwai | a3bcba3 | 2005-12-06 19:05:29 +0100 | [diff] [blame] | 5190 | spec->stream_name_digital = "ALC260 Digital"; |
| 5191 | spec->stream_digital_playback = &alc260_pcm_digital_playback; |
| 5192 | spec->stream_digital_capture = &alc260_pcm_digital_capture; |
| 5193 | |
Takashi Iwai | 2134ea4 | 2008-01-10 16:53:55 +0100 | [diff] [blame] | 5194 | spec->vmaster_nid = 0x08; |
| 5195 | |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 5196 | codec->patch_ops = alc_patch_ops; |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 5197 | if (board_config == ALC260_AUTO) |
Takashi Iwai | ae6b813 | 2006-03-03 16:47:17 +0100 | [diff] [blame] | 5198 | spec->init_hook = alc260_auto_init; |
Takashi Iwai | cb53c62 | 2007-08-10 17:21:45 +0200 | [diff] [blame] | 5199 | #ifdef CONFIG_SND_HDA_POWER_SAVE |
| 5200 | if (!spec->loopback.amplist) |
| 5201 | spec->loopback.amplist = alc260_loopbacks; |
| 5202 | #endif |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 5203 | |
| 5204 | return 0; |
| 5205 | } |
| 5206 | |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 5207 | |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 5208 | /* |
| 5209 | * ALC882 support |
| 5210 | * |
| 5211 | * ALC882 is almost identical with ALC880 but has cleaner and more flexible |
| 5212 | * configuration. Each pin widget can choose any input DACs and a mixer. |
| 5213 | * Each ADC is connected from a mixer of all inputs. This makes possible |
| 5214 | * 6-channel independent captures. |
| 5215 | * |
| 5216 | * In addition, an independent DAC for the multi-playback (not used in this |
| 5217 | * driver yet). |
| 5218 | */ |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 5219 | #define ALC882_DIGOUT_NID 0x06 |
| 5220 | #define ALC882_DIGIN_NID 0x0a |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 5221 | |
Takashi Iwai | d2a6d7d | 2005-11-17 11:06:29 +0100 | [diff] [blame] | 5222 | static struct hda_channel_mode alc882_ch_modes[1] = { |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 5223 | { 8, NULL } |
| 5224 | }; |
| 5225 | |
| 5226 | static hda_nid_t alc882_dac_nids[4] = { |
| 5227 | /* front, rear, clfe, rear_surr */ |
| 5228 | 0x02, 0x03, 0x04, 0x05 |
| 5229 | }; |
| 5230 | |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 5231 | /* identical with ALC880 */ |
| 5232 | #define alc882_adc_nids alc880_adc_nids |
| 5233 | #define alc882_adc_nids_alt alc880_adc_nids_alt |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 5234 | |
Takashi Iwai | e140634 | 2008-02-11 18:32:32 +0100 | [diff] [blame] | 5235 | static hda_nid_t alc882_capsrc_nids[3] = { 0x24, 0x23, 0x22 }; |
| 5236 | static hda_nid_t alc882_capsrc_nids_alt[2] = { 0x23, 0x22 }; |
| 5237 | |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 5238 | /* input MUX */ |
| 5239 | /* FIXME: should be a matrix-type input source selection */ |
| 5240 | |
| 5241 | static struct hda_input_mux alc882_capture_source = { |
| 5242 | .num_items = 4, |
| 5243 | .items = { |
| 5244 | { "Mic", 0x0 }, |
| 5245 | { "Front Mic", 0x1 }, |
| 5246 | { "Line", 0x2 }, |
| 5247 | { "CD", 0x4 }, |
| 5248 | }, |
| 5249 | }; |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 5250 | #define alc882_mux_enum_info alc_mux_enum_info |
| 5251 | #define alc882_mux_enum_get alc_mux_enum_get |
| 5252 | |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 5253 | static int alc882_mux_enum_put(struct snd_kcontrol *kcontrol, |
| 5254 | struct snd_ctl_elem_value *ucontrol) |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 5255 | { |
| 5256 | struct hda_codec *codec = snd_kcontrol_chip(kcontrol); |
| 5257 | struct alc_spec *spec = codec->spec; |
| 5258 | const struct hda_input_mux *imux = spec->input_mux; |
| 5259 | unsigned int adc_idx = snd_ctl_get_ioffidx(kcontrol, &ucontrol->id); |
Takashi Iwai | 88c71a9 | 2008-02-14 17:27:17 +0100 | [diff] [blame] | 5260 | hda_nid_t nid = spec->capsrc_nids ? |
| 5261 | spec->capsrc_nids[adc_idx] : spec->adc_nids[adc_idx]; |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 5262 | unsigned int *cur_val = &spec->cur_mux[adc_idx]; |
| 5263 | unsigned int i, idx; |
| 5264 | |
| 5265 | idx = ucontrol->value.enumerated.item[0]; |
| 5266 | if (idx >= imux->num_items) |
| 5267 | idx = imux->num_items - 1; |
Takashi Iwai | 82beb8f | 2007-08-10 17:09:26 +0200 | [diff] [blame] | 5268 | if (*cur_val == idx) |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 5269 | return 0; |
| 5270 | for (i = 0; i < imux->num_items; i++) { |
Takashi Iwai | 47fd830 | 2007-08-10 17:11:07 +0200 | [diff] [blame] | 5271 | unsigned int v = (i == idx) ? 0 : HDA_AMP_MUTE; |
| 5272 | snd_hda_codec_amp_stereo(codec, nid, HDA_INPUT, |
Takashi Iwai | 82beb8f | 2007-08-10 17:09:26 +0200 | [diff] [blame] | 5273 | imux->items[i].index, |
Takashi Iwai | 47fd830 | 2007-08-10 17:11:07 +0200 | [diff] [blame] | 5274 | HDA_AMP_MUTE, v); |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 5275 | } |
| 5276 | *cur_val = idx; |
| 5277 | return 1; |
| 5278 | } |
| 5279 | |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 5280 | /* |
Kailang Yang | 272a527 | 2007-05-14 11:00:38 +0200 | [diff] [blame] | 5281 | * 2ch mode |
| 5282 | */ |
| 5283 | static struct hda_verb alc882_3ST_ch2_init[] = { |
| 5284 | { 0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80 }, |
| 5285 | { 0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE }, |
| 5286 | { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN }, |
| 5287 | { 0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE }, |
| 5288 | { } /* end */ |
| 5289 | }; |
| 5290 | |
| 5291 | /* |
| 5292 | * 6ch mode |
| 5293 | */ |
| 5294 | static struct hda_verb alc882_3ST_ch6_init[] = { |
| 5295 | { 0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, |
| 5296 | { 0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE }, |
| 5297 | { 0x18, AC_VERB_SET_CONNECT_SEL, 0x02 }, |
| 5298 | { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, |
| 5299 | { 0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE }, |
| 5300 | { 0x1a, AC_VERB_SET_CONNECT_SEL, 0x01 }, |
| 5301 | { } /* end */ |
| 5302 | }; |
| 5303 | |
| 5304 | static struct hda_channel_mode alc882_3ST_6ch_modes[2] = { |
| 5305 | { 2, alc882_3ST_ch2_init }, |
| 5306 | { 6, alc882_3ST_ch6_init }, |
| 5307 | }; |
| 5308 | |
| 5309 | /* |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 5310 | * 6ch mode |
| 5311 | */ |
| 5312 | static struct hda_verb alc882_sixstack_ch6_init[] = { |
| 5313 | { 0x17, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x00 }, |
| 5314 | { 0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, |
| 5315 | { 0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, |
| 5316 | { 0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, |
| 5317 | { } /* end */ |
| 5318 | }; |
| 5319 | |
| 5320 | /* |
| 5321 | * 8ch mode |
| 5322 | */ |
| 5323 | static struct hda_verb alc882_sixstack_ch8_init[] = { |
| 5324 | { 0x17, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, |
| 5325 | { 0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, |
| 5326 | { 0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, |
| 5327 | { 0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, |
| 5328 | { } /* end */ |
| 5329 | }; |
| 5330 | |
| 5331 | static struct hda_channel_mode alc882_sixstack_modes[2] = { |
| 5332 | { 6, alc882_sixstack_ch6_init }, |
| 5333 | { 8, alc882_sixstack_ch8_init }, |
| 5334 | }; |
| 5335 | |
Takashi Iwai | 87350ad | 2007-08-16 18:19:38 +0200 | [diff] [blame] | 5336 | /* |
| 5337 | * macbook pro ALC885 can switch LineIn to LineOut without loosing Mic |
| 5338 | */ |
| 5339 | |
| 5340 | /* |
| 5341 | * 2ch mode |
| 5342 | */ |
| 5343 | static struct hda_verb alc885_mbp_ch2_init[] = { |
| 5344 | { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN }, |
| 5345 | { 0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 5346 | { 0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
| 5347 | { } /* end */ |
| 5348 | }; |
| 5349 | |
| 5350 | /* |
| 5351 | * 6ch mode |
| 5352 | */ |
| 5353 | static struct hda_verb alc885_mbp_ch6_init[] = { |
| 5354 | { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, |
| 5355 | { 0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 5356 | { 0x1a, AC_VERB_SET_CONNECT_SEL, 0x01 }, |
| 5357 | { 0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 5358 | { 0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 5359 | { } /* end */ |
| 5360 | }; |
| 5361 | |
| 5362 | static struct hda_channel_mode alc885_mbp_6ch_modes[2] = { |
| 5363 | { 2, alc885_mbp_ch2_init }, |
| 5364 | { 6, alc885_mbp_ch6_init }, |
| 5365 | }; |
| 5366 | |
| 5367 | |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 5368 | /* Pin assignment: Front=0x14, Rear=0x15, CLFE=0x16, Side=0x17 |
| 5369 | * Mic=0x18, Front Mic=0x19, Line-In=0x1a, HP=0x1b |
| 5370 | */ |
Takashi Iwai | c8b6bf9 | 2005-11-17 14:57:47 +0100 | [diff] [blame] | 5371 | static struct snd_kcontrol_new alc882_base_mixer[] = { |
Takashi Iwai | 05acb86 | 2005-06-10 19:50:25 +0200 | [diff] [blame] | 5372 | HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT), |
Takashi Iwai | 985be54 | 2005-11-02 18:26:49 +0100 | [diff] [blame] | 5373 | HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT), |
Takashi Iwai | 05acb86 | 2005-06-10 19:50:25 +0200 | [diff] [blame] | 5374 | HDA_CODEC_VOLUME("Surround Playback Volume", 0x0d, 0x0, HDA_OUTPUT), |
Takashi Iwai | 985be54 | 2005-11-02 18:26:49 +0100 | [diff] [blame] | 5375 | HDA_BIND_MUTE("Surround Playback Switch", 0x0d, 2, HDA_INPUT), |
Takashi Iwai | 05acb86 | 2005-06-10 19:50:25 +0200 | [diff] [blame] | 5376 | HDA_CODEC_VOLUME_MONO("Center Playback Volume", 0x0e, 1, 0x0, HDA_OUTPUT), |
| 5377 | HDA_CODEC_VOLUME_MONO("LFE Playback Volume", 0x0e, 2, 0x0, HDA_OUTPUT), |
Takashi Iwai | 985be54 | 2005-11-02 18:26:49 +0100 | [diff] [blame] | 5378 | HDA_BIND_MUTE_MONO("Center Playback Switch", 0x0e, 1, 2, HDA_INPUT), |
| 5379 | HDA_BIND_MUTE_MONO("LFE Playback Switch", 0x0e, 2, 2, HDA_INPUT), |
Takashi Iwai | 05acb86 | 2005-06-10 19:50:25 +0200 | [diff] [blame] | 5380 | HDA_CODEC_VOLUME("Side Playback Volume", 0x0f, 0x0, HDA_OUTPUT), |
Takashi Iwai | 985be54 | 2005-11-02 18:26:49 +0100 | [diff] [blame] | 5381 | HDA_BIND_MUTE("Side Playback Switch", 0x0f, 2, HDA_INPUT), |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 5382 | HDA_CODEC_MUTE("Headphone Playback Switch", 0x1b, 0x0, HDA_OUTPUT), |
| 5383 | HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT), |
| 5384 | HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT), |
| 5385 | HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT), |
| 5386 | HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT), |
| 5387 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), |
Thomas De Schampheleire | 3236041 | 2007-01-24 16:13:35 +0100 | [diff] [blame] | 5388 | HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT), |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 5389 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), |
| 5390 | HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x1, HDA_INPUT), |
Thomas De Schampheleire | 3236041 | 2007-01-24 16:13:35 +0100 | [diff] [blame] | 5391 | HDA_CODEC_VOLUME("Front Mic Boost", 0x19, 0, HDA_INPUT), |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 5392 | HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x1, HDA_INPUT), |
| 5393 | HDA_CODEC_VOLUME("PC Speaker Playback Volume", 0x0b, 0x05, HDA_INPUT), |
| 5394 | HDA_CODEC_MUTE("PC Speaker Playback Switch", 0x0b, 0x05, HDA_INPUT), |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 5395 | { } /* end */ |
| 5396 | }; |
| 5397 | |
Takashi Iwai | 87350ad | 2007-08-16 18:19:38 +0200 | [diff] [blame] | 5398 | static struct snd_kcontrol_new alc885_mbp3_mixer[] = { |
Takashi Iwai | 2134ea4 | 2008-01-10 16:53:55 +0100 | [diff] [blame] | 5399 | HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x00, HDA_OUTPUT), |
| 5400 | HDA_BIND_MUTE ("Front Playback Switch", 0x0c, 0x02, HDA_INPUT), |
| 5401 | HDA_CODEC_MUTE ("Speaker Playback Switch", 0x14, 0x00, HDA_OUTPUT), |
| 5402 | HDA_CODEC_VOLUME("Line-Out Playback Volume", 0x0d, 0x00, HDA_OUTPUT), |
| 5403 | HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT), |
| 5404 | HDA_CODEC_MUTE ("Line Playback Switch", 0x0b, 0x02, HDA_INPUT), |
Takashi Iwai | 87350ad | 2007-08-16 18:19:38 +0200 | [diff] [blame] | 5405 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x00, HDA_INPUT), |
| 5406 | HDA_CODEC_MUTE ("Mic Playback Switch", 0x0b, 0x00, HDA_INPUT), |
Takashi Iwai | 2134ea4 | 2008-01-10 16:53:55 +0100 | [diff] [blame] | 5407 | HDA_CODEC_VOLUME("Line Boost", 0x1a, 0x00, HDA_INPUT), |
Takashi Iwai | 87350ad | 2007-08-16 18:19:38 +0200 | [diff] [blame] | 5408 | HDA_CODEC_VOLUME("Mic Boost", 0x18, 0x00, HDA_INPUT), |
| 5409 | { } /* end */ |
| 5410 | }; |
Kailang Yang | bdd148a | 2007-05-08 15:19:08 +0200 | [diff] [blame] | 5411 | static struct snd_kcontrol_new alc882_w2jc_mixer[] = { |
| 5412 | HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT), |
| 5413 | HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT), |
| 5414 | HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT), |
| 5415 | HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT), |
| 5416 | HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT), |
| 5417 | HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT), |
| 5418 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), |
| 5419 | HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT), |
| 5420 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), |
| 5421 | HDA_CODEC_VOLUME("PC Speaker Playback Volume", 0x0b, 0x05, HDA_INPUT), |
| 5422 | HDA_CODEC_MUTE("PC Speaker Playback Switch", 0x0b, 0x05, HDA_INPUT), |
| 5423 | { } /* end */ |
| 5424 | }; |
| 5425 | |
Kailang Yang | 272a527 | 2007-05-14 11:00:38 +0200 | [diff] [blame] | 5426 | static struct snd_kcontrol_new alc882_targa_mixer[] = { |
| 5427 | HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT), |
| 5428 | HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT), |
| 5429 | HDA_CODEC_MUTE("Headphone Playback Switch", 0x1b, 0x0, HDA_OUTPUT), |
| 5430 | HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT), |
| 5431 | HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT), |
| 5432 | HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT), |
| 5433 | HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT), |
| 5434 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), |
| 5435 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), |
Takashi Iwai | 96fe7cc8 | 2007-09-07 10:57:44 +0200 | [diff] [blame] | 5436 | HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT), |
Kailang Yang | 272a527 | 2007-05-14 11:00:38 +0200 | [diff] [blame] | 5437 | HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x1, HDA_INPUT), |
| 5438 | HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x1, HDA_INPUT), |
Takashi Iwai | 96fe7cc8 | 2007-09-07 10:57:44 +0200 | [diff] [blame] | 5439 | HDA_CODEC_VOLUME("Front Mic Boost", 0x19, 0, HDA_INPUT), |
Kailang Yang | 272a527 | 2007-05-14 11:00:38 +0200 | [diff] [blame] | 5440 | { } /* end */ |
| 5441 | }; |
| 5442 | |
| 5443 | /* Pin assignment: Front=0x14, HP = 0x15, Front = 0x16, ??? |
| 5444 | * Front Mic=0x18, Line In = 0x1a, Line In = 0x1b, CD = 0x1c |
| 5445 | */ |
| 5446 | static struct snd_kcontrol_new alc882_asus_a7j_mixer[] = { |
| 5447 | HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT), |
| 5448 | HDA_CODEC_MUTE("Front Playback Switch", 0x14, 0x0, HDA_OUTPUT), |
| 5449 | HDA_CODEC_MUTE("Headphone Playback Switch", 0x15, 0x0, HDA_OUTPUT), |
| 5450 | HDA_CODEC_MUTE("Mobile Front Playback Switch", 0x16, 0x0, HDA_OUTPUT), |
| 5451 | HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT), |
| 5452 | HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT), |
| 5453 | HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT), |
| 5454 | HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT), |
| 5455 | HDA_CODEC_VOLUME("Mobile Line Playback Volume", 0x0b, 0x03, HDA_INPUT), |
| 5456 | HDA_CODEC_MUTE("Mobile Line Playback Switch", 0x0b, 0x03, HDA_INPUT), |
| 5457 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), |
| 5458 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), |
Takashi Iwai | 96fe7cc8 | 2007-09-07 10:57:44 +0200 | [diff] [blame] | 5459 | HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT), |
Kailang Yang | 272a527 | 2007-05-14 11:00:38 +0200 | [diff] [blame] | 5460 | { } /* end */ |
| 5461 | }; |
| 5462 | |
Takashi Iwai | 914759b | 2007-09-06 14:52:04 +0200 | [diff] [blame] | 5463 | static struct snd_kcontrol_new alc882_asus_a7m_mixer[] = { |
| 5464 | HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT), |
| 5465 | HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT), |
| 5466 | HDA_CODEC_MUTE("Headphone Playback Switch", 0x15, 0x0, HDA_OUTPUT), |
| 5467 | HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT), |
| 5468 | HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT), |
| 5469 | HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT), |
| 5470 | HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT), |
| 5471 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), |
| 5472 | HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT), |
| 5473 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), |
| 5474 | HDA_CODEC_VOLUME("PC Speaker Playback Volume", 0x0b, 0x05, HDA_INPUT), |
| 5475 | HDA_CODEC_MUTE("PC Speaker Playback Switch", 0x0b, 0x05, HDA_INPUT), |
| 5476 | { } /* end */ |
| 5477 | }; |
| 5478 | |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 5479 | static struct snd_kcontrol_new alc882_chmode_mixer[] = { |
| 5480 | { |
| 5481 | .iface = SNDRV_CTL_ELEM_IFACE_MIXER, |
| 5482 | .name = "Channel Mode", |
| 5483 | .info = alc_ch_mode_info, |
| 5484 | .get = alc_ch_mode_get, |
| 5485 | .put = alc_ch_mode_put, |
| 5486 | }, |
| 5487 | { } /* end */ |
| 5488 | }; |
| 5489 | |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 5490 | static struct hda_verb alc882_init_verbs[] = { |
| 5491 | /* Front mixer: unmute input/output amp left and right (volume = 0) */ |
Takashi Iwai | 05acb86 | 2005-06-10 19:50:25 +0200 | [diff] [blame] | 5492 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 5493 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 5494 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 5495 | /* Rear mixer */ |
Takashi Iwai | 05acb86 | 2005-06-10 19:50:25 +0200 | [diff] [blame] | 5496 | {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 5497 | {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 5498 | {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 5499 | /* CLFE mixer */ |
Takashi Iwai | 05acb86 | 2005-06-10 19:50:25 +0200 | [diff] [blame] | 5500 | {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 5501 | {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 5502 | {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 5503 | /* Side mixer */ |
Takashi Iwai | 05acb86 | 2005-06-10 19:50:25 +0200 | [diff] [blame] | 5504 | {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 5505 | {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 5506 | {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 5507 | |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 5508 | /* Front Pin: output 0 (0x0c) */ |
Takashi Iwai | 05acb86 | 2005-06-10 19:50:25 +0200 | [diff] [blame] | 5509 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
Takashi Iwai | 05acb86 | 2005-06-10 19:50:25 +0200 | [diff] [blame] | 5510 | {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 5511 | {0x14, AC_VERB_SET_CONNECT_SEL, 0x00}, |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 5512 | /* Rear Pin: output 1 (0x0d) */ |
Takashi Iwai | 05acb86 | 2005-06-10 19:50:25 +0200 | [diff] [blame] | 5513 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
Takashi Iwai | 05acb86 | 2005-06-10 19:50:25 +0200 | [diff] [blame] | 5514 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 5515 | {0x15, AC_VERB_SET_CONNECT_SEL, 0x01}, |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 5516 | /* CLFE Pin: output 2 (0x0e) */ |
Takashi Iwai | 05acb86 | 2005-06-10 19:50:25 +0200 | [diff] [blame] | 5517 | {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
Takashi Iwai | 05acb86 | 2005-06-10 19:50:25 +0200 | [diff] [blame] | 5518 | {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 5519 | {0x16, AC_VERB_SET_CONNECT_SEL, 0x02}, |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 5520 | /* Side Pin: output 3 (0x0f) */ |
Takashi Iwai | 05acb86 | 2005-06-10 19:50:25 +0200 | [diff] [blame] | 5521 | {0x17, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
Takashi Iwai | 05acb86 | 2005-06-10 19:50:25 +0200 | [diff] [blame] | 5522 | {0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 5523 | {0x17, AC_VERB_SET_CONNECT_SEL, 0x03}, |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 5524 | /* Mic (rear) pin: input vref at 80% */ |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 5525 | {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80}, |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 5526 | {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
| 5527 | /* Front Mic pin: input vref at 80% */ |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 5528 | {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80}, |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 5529 | {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
| 5530 | /* Line In pin: input */ |
Takashi Iwai | 05acb86 | 2005-06-10 19:50:25 +0200 | [diff] [blame] | 5531 | {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 5532 | {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
| 5533 | /* Line-2 In: Headphone output (output 0 - 0x0c) */ |
| 5534 | {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 5535 | {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 5536 | {0x1b, AC_VERB_SET_CONNECT_SEL, 0x00}, |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 5537 | /* CD pin widget for input */ |
Takashi Iwai | 05acb86 | 2005-06-10 19:50:25 +0200 | [diff] [blame] | 5538 | {0x1c, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 5539 | |
| 5540 | /* FIXME: use matrix-type input source selection */ |
| 5541 | /* Mixer elements: 0x18, 19, 1a, 1b, 1c, 1d, 14, 15, 16, 17, 0b */ |
| 5542 | /* Input mixer1: unmute Mic, F-Mic, Line, CD inputs */ |
Takashi Iwai | 05acb86 | 2005-06-10 19:50:25 +0200 | [diff] [blame] | 5543 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 5544 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)}, |
| 5545 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)}, |
| 5546 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)}, |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 5547 | /* Input mixer2 */ |
Takashi Iwai | 05acb86 | 2005-06-10 19:50:25 +0200 | [diff] [blame] | 5548 | {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 5549 | {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)}, |
| 5550 | {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)}, |
| 5551 | {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)}, |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 5552 | /* Input mixer3 */ |
Takashi Iwai | 05acb86 | 2005-06-10 19:50:25 +0200 | [diff] [blame] | 5553 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 5554 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)}, |
| 5555 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)}, |
| 5556 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)}, |
| 5557 | /* ADC1: mute amp left and right */ |
| 5558 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
Takashi Iwai | 71fe7b8 | 2005-05-25 18:11:40 +0200 | [diff] [blame] | 5559 | {0x07, AC_VERB_SET_CONNECT_SEL, 0x00}, |
Takashi Iwai | 05acb86 | 2005-06-10 19:50:25 +0200 | [diff] [blame] | 5560 | /* ADC2: mute amp left and right */ |
| 5561 | {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
Takashi Iwai | 71fe7b8 | 2005-05-25 18:11:40 +0200 | [diff] [blame] | 5562 | {0x08, AC_VERB_SET_CONNECT_SEL, 0x00}, |
Takashi Iwai | 05acb86 | 2005-06-10 19:50:25 +0200 | [diff] [blame] | 5563 | /* ADC3: mute amp left and right */ |
| 5564 | {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
Takashi Iwai | 71fe7b8 | 2005-05-25 18:11:40 +0200 | [diff] [blame] | 5565 | {0x09, AC_VERB_SET_CONNECT_SEL, 0x00}, |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 5566 | |
| 5567 | { } |
| 5568 | }; |
| 5569 | |
Takashi Iwai | 4b146cb | 2006-07-28 14:42:36 +0200 | [diff] [blame] | 5570 | static struct hda_verb alc882_eapd_verbs[] = { |
| 5571 | /* change to EAPD mode */ |
| 5572 | {0x20, AC_VERB_SET_COEF_INDEX, 0x07}, |
Andrew L. Neporada | b373bde | 2006-11-07 11:37:08 +0100 | [diff] [blame] | 5573 | {0x20, AC_VERB_SET_PROC_COEF, 0x3060}, |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 5574 | { } |
Takashi Iwai | 4b146cb | 2006-07-28 14:42:36 +0200 | [diff] [blame] | 5575 | }; |
| 5576 | |
Tobin Davis | 9102cd1 | 2006-12-15 10:02:12 +0100 | [diff] [blame] | 5577 | /* Mac Pro test */ |
| 5578 | static struct snd_kcontrol_new alc882_macpro_mixer[] = { |
| 5579 | HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT), |
| 5580 | HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT), |
| 5581 | HDA_CODEC_MUTE("Headphone Playback Switch", 0x18, 0x0, HDA_OUTPUT), |
| 5582 | HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x01, HDA_INPUT), |
| 5583 | HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x01, HDA_INPUT), |
| 5584 | HDA_CODEC_VOLUME("PC Speaker Playback Volume", 0x0b, 0x02, HDA_INPUT), |
| 5585 | HDA_CODEC_MUTE("PC Speaker Playback Switch", 0x0b, 0x02, HDA_INPUT), |
| 5586 | { } /* end */ |
| 5587 | }; |
| 5588 | |
| 5589 | static struct hda_verb alc882_macpro_init_verbs[] = { |
| 5590 | /* Front mixer: unmute input/output amp left and right (volume = 0) */ |
| 5591 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 5592 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 5593 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
| 5594 | /* Front Pin: output 0 (0x0c) */ |
| 5595 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 5596 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 5597 | {0x15, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 5598 | /* Front Mic pin: input vref at 80% */ |
| 5599 | {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80}, |
| 5600 | {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
| 5601 | /* Speaker: output */ |
| 5602 | {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 5603 | {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 5604 | {0x1a, AC_VERB_SET_CONNECT_SEL, 0x04}, |
| 5605 | /* Headphone output (output 0 - 0x0c) */ |
| 5606 | {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 5607 | {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 5608 | {0x18, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 5609 | |
| 5610 | /* FIXME: use matrix-type input source selection */ |
| 5611 | /* Mixer elements: 0x18, 19, 1a, 1b, 1c, 1d, 14, 15, 16, 17, 0b */ |
| 5612 | /* Input mixer1: unmute Mic, F-Mic, Line, CD inputs */ |
| 5613 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 5614 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)}, |
| 5615 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)}, |
| 5616 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)}, |
| 5617 | /* Input mixer2 */ |
| 5618 | {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 5619 | {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)}, |
| 5620 | {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)}, |
| 5621 | {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)}, |
| 5622 | /* Input mixer3 */ |
| 5623 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 5624 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)}, |
| 5625 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)}, |
| 5626 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)}, |
| 5627 | /* ADC1: mute amp left and right */ |
| 5628 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 5629 | {0x07, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 5630 | /* ADC2: mute amp left and right */ |
| 5631 | {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 5632 | {0x08, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 5633 | /* ADC3: mute amp left and right */ |
| 5634 | {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 5635 | {0x09, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 5636 | |
| 5637 | { } |
| 5638 | }; |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 5639 | |
Takashi Iwai | 87350ad | 2007-08-16 18:19:38 +0200 | [diff] [blame] | 5640 | /* Macbook Pro rev3 */ |
| 5641 | static struct hda_verb alc885_mbp3_init_verbs[] = { |
| 5642 | /* Front mixer: unmute input/output amp left and right (volume = 0) */ |
| 5643 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 5644 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 5645 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
| 5646 | /* Rear mixer */ |
| 5647 | {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 5648 | {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 5649 | {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
| 5650 | /* Front Pin: output 0 (0x0c) */ |
| 5651 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 5652 | {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 5653 | {0x14, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 5654 | /* HP Pin: output 0 (0x0d) */ |
| 5655 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, 0xc4}, |
| 5656 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
| 5657 | {0x15, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 5658 | {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN}, |
| 5659 | /* Mic (rear) pin: input vref at 80% */ |
| 5660 | {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80}, |
| 5661 | {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
| 5662 | /* Front Mic pin: input vref at 80% */ |
| 5663 | {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80}, |
| 5664 | {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
| 5665 | /* Line In pin: use output 1 when in LineOut mode */ |
| 5666 | {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
| 5667 | {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
| 5668 | {0x1a, AC_VERB_SET_CONNECT_SEL, 0x01}, |
| 5669 | |
| 5670 | /* FIXME: use matrix-type input source selection */ |
| 5671 | /* Mixer elements: 0x18, 19, 1a, 1b, 1c, 1d, 14, 15, 16, 17, 0b */ |
| 5672 | /* Input mixer1: unmute Mic, F-Mic, Line, CD inputs */ |
| 5673 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 5674 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)}, |
| 5675 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)}, |
| 5676 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)}, |
| 5677 | /* Input mixer2 */ |
| 5678 | {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 5679 | {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)}, |
| 5680 | {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)}, |
| 5681 | {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)}, |
| 5682 | /* Input mixer3 */ |
| 5683 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 5684 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)}, |
| 5685 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)}, |
| 5686 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)}, |
| 5687 | /* ADC1: mute amp left and right */ |
| 5688 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 5689 | {0x07, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 5690 | /* ADC2: mute amp left and right */ |
| 5691 | {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 5692 | {0x08, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 5693 | /* ADC3: mute amp left and right */ |
| 5694 | {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 5695 | {0x09, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 5696 | |
| 5697 | { } |
| 5698 | }; |
| 5699 | |
Nicola Fagnani | c54728d | 2007-07-19 23:28:52 +0200 | [diff] [blame] | 5700 | /* iMac 24 mixer. */ |
| 5701 | static struct snd_kcontrol_new alc885_imac24_mixer[] = { |
| 5702 | HDA_CODEC_VOLUME("Master Playback Volume", 0x0c, 0x00, HDA_OUTPUT), |
| 5703 | HDA_CODEC_MUTE("Master Playback Switch", 0x0c, 0x00, HDA_INPUT), |
| 5704 | { } /* end */ |
| 5705 | }; |
| 5706 | |
| 5707 | /* iMac 24 init verbs. */ |
| 5708 | static struct hda_verb alc885_imac24_init_verbs[] = { |
| 5709 | /* Internal speakers: output 0 (0x0c) */ |
| 5710 | {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 5711 | {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 5712 | {0x18, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 5713 | /* Internal speakers: output 0 (0x0c) */ |
| 5714 | {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 5715 | {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 5716 | {0x1a, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 5717 | /* Headphone: output 0 (0x0c) */ |
| 5718 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 5719 | {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 5720 | {0x14, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 5721 | {0x14, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN}, |
| 5722 | /* Front Mic: input vref at 80% */ |
| 5723 | {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80}, |
| 5724 | {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
| 5725 | { } |
| 5726 | }; |
| 5727 | |
| 5728 | /* Toggle speaker-output according to the hp-jack state */ |
| 5729 | static void alc885_imac24_automute(struct hda_codec *codec) |
| 5730 | { |
| 5731 | unsigned int present; |
| 5732 | |
| 5733 | present = snd_hda_codec_read(codec, 0x14, 0, |
| 5734 | AC_VERB_GET_PIN_SENSE, 0) & 0x80000000; |
Takashi Iwai | 47fd830 | 2007-08-10 17:11:07 +0200 | [diff] [blame] | 5735 | snd_hda_codec_amp_stereo(codec, 0x18, HDA_OUTPUT, 0, |
| 5736 | HDA_AMP_MUTE, present ? HDA_AMP_MUTE : 0); |
| 5737 | snd_hda_codec_amp_stereo(codec, 0x1a, HDA_OUTPUT, 0, |
| 5738 | HDA_AMP_MUTE, present ? HDA_AMP_MUTE : 0); |
Nicola Fagnani | c54728d | 2007-07-19 23:28:52 +0200 | [diff] [blame] | 5739 | } |
| 5740 | |
| 5741 | /* Processes unsolicited events. */ |
| 5742 | static void alc885_imac24_unsol_event(struct hda_codec *codec, |
| 5743 | unsigned int res) |
| 5744 | { |
| 5745 | /* Headphone insertion or removal. */ |
| 5746 | if ((res >> 26) == ALC880_HP_EVENT) |
| 5747 | alc885_imac24_automute(codec); |
| 5748 | } |
| 5749 | |
Takashi Iwai | 87350ad | 2007-08-16 18:19:38 +0200 | [diff] [blame] | 5750 | static void alc885_mbp3_automute(struct hda_codec *codec) |
| 5751 | { |
| 5752 | unsigned int present; |
| 5753 | |
| 5754 | present = snd_hda_codec_read(codec, 0x15, 0, |
| 5755 | AC_VERB_GET_PIN_SENSE, 0) & 0x80000000; |
| 5756 | snd_hda_codec_amp_stereo(codec, 0x14, HDA_OUTPUT, 0, |
| 5757 | HDA_AMP_MUTE, present ? HDA_AMP_MUTE : 0); |
| 5758 | snd_hda_codec_amp_stereo(codec, 0x15, HDA_OUTPUT, 0, |
| 5759 | HDA_AMP_MUTE, present ? 0 : HDA_AMP_MUTE); |
| 5760 | |
| 5761 | } |
| 5762 | static void alc885_mbp3_unsol_event(struct hda_codec *codec, |
| 5763 | unsigned int res) |
| 5764 | { |
| 5765 | /* Headphone insertion or removal. */ |
| 5766 | if ((res >> 26) == ALC880_HP_EVENT) |
| 5767 | alc885_mbp3_automute(codec); |
| 5768 | } |
| 5769 | |
| 5770 | |
Kailang Yang | 272a527 | 2007-05-14 11:00:38 +0200 | [diff] [blame] | 5771 | static struct hda_verb alc882_targa_verbs[] = { |
| 5772 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 5773 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 5774 | |
| 5775 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 5776 | {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 5777 | |
| 5778 | {0x18, AC_VERB_SET_CONNECT_SEL, 0x02}, /* mic/clfe */ |
| 5779 | {0x1a, AC_VERB_SET_CONNECT_SEL, 0x01}, /* line/surround */ |
| 5780 | {0x1b, AC_VERB_SET_CONNECT_SEL, 0x00}, /* HP */ |
| 5781 | |
| 5782 | {0x14, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN}, |
| 5783 | {0x01, AC_VERB_SET_GPIO_MASK, 0x03}, |
| 5784 | {0x01, AC_VERB_SET_GPIO_DIRECTION, 0x03}, |
| 5785 | {0x01, AC_VERB_SET_GPIO_DATA, 0x03}, |
| 5786 | { } /* end */ |
| 5787 | }; |
| 5788 | |
| 5789 | /* toggle speaker-output according to the hp-jack state */ |
| 5790 | static void alc882_targa_automute(struct hda_codec *codec) |
| 5791 | { |
| 5792 | unsigned int present; |
| 5793 | |
| 5794 | present = snd_hda_codec_read(codec, 0x14, 0, |
| 5795 | AC_VERB_GET_PIN_SENSE, 0) & 0x80000000; |
Takashi Iwai | 47fd830 | 2007-08-10 17:11:07 +0200 | [diff] [blame] | 5796 | snd_hda_codec_amp_stereo(codec, 0x1b, HDA_OUTPUT, 0, |
| 5797 | HDA_AMP_MUTE, present ? HDA_AMP_MUTE : 0); |
Takashi Iwai | 82beb8f | 2007-08-10 17:09:26 +0200 | [diff] [blame] | 5798 | snd_hda_codec_write_cache(codec, 1, 0, AC_VERB_SET_GPIO_DATA, |
| 5799 | present ? 1 : 3); |
Kailang Yang | 272a527 | 2007-05-14 11:00:38 +0200 | [diff] [blame] | 5800 | } |
| 5801 | |
| 5802 | static void alc882_targa_unsol_event(struct hda_codec *codec, unsigned int res) |
| 5803 | { |
| 5804 | /* Looks like the unsol event is incompatible with the standard |
| 5805 | * definition. 4bit tag is placed at 26 bit! |
| 5806 | */ |
| 5807 | if (((res >> 26) == ALC880_HP_EVENT)) { |
| 5808 | alc882_targa_automute(codec); |
| 5809 | } |
| 5810 | } |
| 5811 | |
| 5812 | static struct hda_verb alc882_asus_a7j_verbs[] = { |
| 5813 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 5814 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 5815 | |
| 5816 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 5817 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 5818 | {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 5819 | |
| 5820 | {0x14, AC_VERB_SET_CONNECT_SEL, 0x00}, /* Front */ |
| 5821 | {0x15, AC_VERB_SET_CONNECT_SEL, 0x00}, /* HP */ |
| 5822 | {0x16, AC_VERB_SET_CONNECT_SEL, 0x00}, /* Front */ |
| 5823 | |
| 5824 | {0x18, AC_VERB_SET_CONNECT_SEL, 0x02}, /* mic/clfe */ |
| 5825 | {0x1a, AC_VERB_SET_CONNECT_SEL, 0x01}, /* line/surround */ |
| 5826 | {0x1b, AC_VERB_SET_CONNECT_SEL, 0x00}, /* HP */ |
| 5827 | { } /* end */ |
| 5828 | }; |
| 5829 | |
Takashi Iwai | 914759b | 2007-09-06 14:52:04 +0200 | [diff] [blame] | 5830 | static struct hda_verb alc882_asus_a7m_verbs[] = { |
| 5831 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 5832 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 5833 | |
| 5834 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 5835 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 5836 | {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 5837 | |
| 5838 | {0x14, AC_VERB_SET_CONNECT_SEL, 0x00}, /* Front */ |
| 5839 | {0x15, AC_VERB_SET_CONNECT_SEL, 0x00}, /* HP */ |
| 5840 | {0x16, AC_VERB_SET_CONNECT_SEL, 0x00}, /* Front */ |
| 5841 | |
| 5842 | {0x18, AC_VERB_SET_CONNECT_SEL, 0x02}, /* mic/clfe */ |
| 5843 | {0x1a, AC_VERB_SET_CONNECT_SEL, 0x01}, /* line/surround */ |
| 5844 | {0x1b, AC_VERB_SET_CONNECT_SEL, 0x00}, /* HP */ |
| 5845 | { } /* end */ |
| 5846 | }; |
| 5847 | |
Tobin Davis | 9102cd1 | 2006-12-15 10:02:12 +0100 | [diff] [blame] | 5848 | static void alc882_gpio_mute(struct hda_codec *codec, int pin, int muted) |
| 5849 | { |
| 5850 | unsigned int gpiostate, gpiomask, gpiodir; |
| 5851 | |
| 5852 | gpiostate = snd_hda_codec_read(codec, codec->afg, 0, |
| 5853 | AC_VERB_GET_GPIO_DATA, 0); |
| 5854 | |
| 5855 | if (!muted) |
| 5856 | gpiostate |= (1 << pin); |
| 5857 | else |
| 5858 | gpiostate &= ~(1 << pin); |
| 5859 | |
| 5860 | gpiomask = snd_hda_codec_read(codec, codec->afg, 0, |
| 5861 | AC_VERB_GET_GPIO_MASK, 0); |
| 5862 | gpiomask |= (1 << pin); |
| 5863 | |
| 5864 | gpiodir = snd_hda_codec_read(codec, codec->afg, 0, |
| 5865 | AC_VERB_GET_GPIO_DIRECTION, 0); |
| 5866 | gpiodir |= (1 << pin); |
| 5867 | |
| 5868 | |
| 5869 | snd_hda_codec_write(codec, codec->afg, 0, |
| 5870 | AC_VERB_SET_GPIO_MASK, gpiomask); |
| 5871 | snd_hda_codec_write(codec, codec->afg, 0, |
| 5872 | AC_VERB_SET_GPIO_DIRECTION, gpiodir); |
| 5873 | |
| 5874 | msleep(1); |
| 5875 | |
| 5876 | snd_hda_codec_write(codec, codec->afg, 0, |
| 5877 | AC_VERB_SET_GPIO_DATA, gpiostate); |
| 5878 | } |
| 5879 | |
Takashi Iwai | 7debbe5 | 2007-08-16 15:01:03 +0200 | [diff] [blame] | 5880 | /* set up GPIO at initialization */ |
| 5881 | static void alc885_macpro_init_hook(struct hda_codec *codec) |
| 5882 | { |
| 5883 | alc882_gpio_mute(codec, 0, 0); |
| 5884 | alc882_gpio_mute(codec, 1, 0); |
| 5885 | } |
| 5886 | |
| 5887 | /* set up GPIO and update auto-muting at initialization */ |
| 5888 | static void alc885_imac24_init_hook(struct hda_codec *codec) |
| 5889 | { |
| 5890 | alc885_macpro_init_hook(codec); |
| 5891 | alc885_imac24_automute(codec); |
| 5892 | } |
| 5893 | |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 5894 | /* |
| 5895 | * generic initialization of ADC, input mixers and output mixers |
| 5896 | */ |
| 5897 | static struct hda_verb alc882_auto_init_verbs[] = { |
| 5898 | /* |
| 5899 | * Unmute ADC0-2 and set the default input to mic-in |
| 5900 | */ |
| 5901 | {0x07, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 5902 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 5903 | {0x08, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 5904 | {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 5905 | {0x09, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 5906 | {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 5907 | |
Takashi Iwai | cb53c62 | 2007-08-10 17:21:45 +0200 | [diff] [blame] | 5908 | /* Mute input amps (CD, Line In, Mic 1 & Mic 2) of the analog-loopback |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 5909 | * mixer widget |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 5910 | * Note: PASD motherboards uses the Line In 2 as the input for |
| 5911 | * front panel mic (mic 2) |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 5912 | */ |
| 5913 | /* Amp Indices: Mic1 = 0, Mic2 = 1, Line1 = 2, Line2 = 3, CD = 4 */ |
Takashi Iwai | cb53c62 | 2007-08-10 17:21:45 +0200 | [diff] [blame] | 5914 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 5915 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
| 5916 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)}, |
| 5917 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)}, |
| 5918 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)}, |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 5919 | |
| 5920 | /* |
| 5921 | * Set up output mixers (0x0c - 0x0f) |
| 5922 | */ |
| 5923 | /* set vol=0 to output mixers */ |
| 5924 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 5925 | {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 5926 | {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 5927 | {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 5928 | /* set up input amps for analog loopback */ |
| 5929 | /* Amp Indices: DAC = 0, mixer = 1 */ |
| 5930 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 5931 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 5932 | {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 5933 | {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 5934 | {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 5935 | {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 5936 | {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 5937 | {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 5938 | {0x26, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 5939 | {0x26, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 5940 | |
| 5941 | /* FIXME: use matrix-type input source selection */ |
| 5942 | /* Mixer elements: 0x18, 19, 1a, 1b, 1c, 1d, 14, 15, 16, 17, 0b */ |
| 5943 | /* Input mixer1: unmute Mic, F-Mic, Line, CD inputs */ |
| 5944 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))}, |
| 5945 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x03 << 8))}, |
| 5946 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x02 << 8))}, |
| 5947 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x04 << 8))}, |
| 5948 | /* Input mixer2 */ |
| 5949 | {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))}, |
| 5950 | {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x03 << 8))}, |
| 5951 | {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x02 << 8))}, |
| 5952 | {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x04 << 8))}, |
| 5953 | /* Input mixer3 */ |
| 5954 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))}, |
| 5955 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x03 << 8))}, |
| 5956 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x02 << 8))}, |
| 5957 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x04 << 8))}, |
| 5958 | |
| 5959 | { } |
| 5960 | }; |
| 5961 | |
| 5962 | /* capture mixer elements */ |
| 5963 | static struct snd_kcontrol_new alc882_capture_alt_mixer[] = { |
| 5964 | HDA_CODEC_VOLUME("Capture Volume", 0x08, 0x0, HDA_INPUT), |
| 5965 | HDA_CODEC_MUTE("Capture Switch", 0x08, 0x0, HDA_INPUT), |
| 5966 | HDA_CODEC_VOLUME_IDX("Capture Volume", 1, 0x09, 0x0, HDA_INPUT), |
| 5967 | HDA_CODEC_MUTE_IDX("Capture Switch", 1, 0x09, 0x0, HDA_INPUT), |
| 5968 | { |
| 5969 | .iface = SNDRV_CTL_ELEM_IFACE_MIXER, |
| 5970 | /* The multiple "Capture Source" controls confuse alsamixer |
| 5971 | * So call somewhat different.. |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 5972 | */ |
| 5973 | /* .name = "Capture Source", */ |
| 5974 | .name = "Input Source", |
| 5975 | .count = 2, |
| 5976 | .info = alc882_mux_enum_info, |
| 5977 | .get = alc882_mux_enum_get, |
| 5978 | .put = alc882_mux_enum_put, |
| 5979 | }, |
| 5980 | { } /* end */ |
| 5981 | }; |
| 5982 | |
| 5983 | static struct snd_kcontrol_new alc882_capture_mixer[] = { |
| 5984 | HDA_CODEC_VOLUME("Capture Volume", 0x07, 0x0, HDA_INPUT), |
| 5985 | HDA_CODEC_MUTE("Capture Switch", 0x07, 0x0, HDA_INPUT), |
| 5986 | HDA_CODEC_VOLUME_IDX("Capture Volume", 1, 0x08, 0x0, HDA_INPUT), |
| 5987 | HDA_CODEC_MUTE_IDX("Capture Switch", 1, 0x08, 0x0, HDA_INPUT), |
| 5988 | HDA_CODEC_VOLUME_IDX("Capture Volume", 2, 0x09, 0x0, HDA_INPUT), |
| 5989 | HDA_CODEC_MUTE_IDX("Capture Switch", 2, 0x09, 0x0, HDA_INPUT), |
| 5990 | { |
| 5991 | .iface = SNDRV_CTL_ELEM_IFACE_MIXER, |
| 5992 | /* The multiple "Capture Source" controls confuse alsamixer |
| 5993 | * So call somewhat different.. |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 5994 | */ |
| 5995 | /* .name = "Capture Source", */ |
| 5996 | .name = "Input Source", |
| 5997 | .count = 3, |
| 5998 | .info = alc882_mux_enum_info, |
| 5999 | .get = alc882_mux_enum_get, |
| 6000 | .put = alc882_mux_enum_put, |
| 6001 | }, |
| 6002 | { } /* end */ |
| 6003 | }; |
| 6004 | |
Takashi Iwai | cb53c62 | 2007-08-10 17:21:45 +0200 | [diff] [blame] | 6005 | #ifdef CONFIG_SND_HDA_POWER_SAVE |
| 6006 | #define alc882_loopbacks alc880_loopbacks |
| 6007 | #endif |
| 6008 | |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 6009 | /* pcm configuration: identiacal with ALC880 */ |
| 6010 | #define alc882_pcm_analog_playback alc880_pcm_analog_playback |
| 6011 | #define alc882_pcm_analog_capture alc880_pcm_analog_capture |
| 6012 | #define alc882_pcm_digital_playback alc880_pcm_digital_playback |
| 6013 | #define alc882_pcm_digital_capture alc880_pcm_digital_capture |
| 6014 | |
| 6015 | /* |
| 6016 | * configuration and preset |
| 6017 | */ |
Takashi Iwai | f5fcc13 | 2006-11-24 17:07:44 +0100 | [diff] [blame] | 6018 | static const char *alc882_models[ALC882_MODEL_LAST] = { |
| 6019 | [ALC882_3ST_DIG] = "3stack-dig", |
| 6020 | [ALC882_6ST_DIG] = "6stack-dig", |
| 6021 | [ALC882_ARIMA] = "arima", |
Kailang Yang | bdd148a | 2007-05-08 15:19:08 +0200 | [diff] [blame] | 6022 | [ALC882_W2JC] = "w2jc", |
Takashi Iwai | 0438a00 | 2007-09-06 14:54:11 +0200 | [diff] [blame] | 6023 | [ALC882_TARGA] = "targa", |
| 6024 | [ALC882_ASUS_A7J] = "asus-a7j", |
| 6025 | [ALC882_ASUS_A7M] = "asus-a7m", |
Tobin Davis | 9102cd1 | 2006-12-15 10:02:12 +0100 | [diff] [blame] | 6026 | [ALC885_MACPRO] = "macpro", |
Takashi Iwai | 87350ad | 2007-08-16 18:19:38 +0200 | [diff] [blame] | 6027 | [ALC885_MBP3] = "mbp3", |
Nicola Fagnani | c54728d | 2007-07-19 23:28:52 +0200 | [diff] [blame] | 6028 | [ALC885_IMAC24] = "imac24", |
Takashi Iwai | f5fcc13 | 2006-11-24 17:07:44 +0100 | [diff] [blame] | 6029 | [ALC882_AUTO] = "auto", |
| 6030 | }; |
| 6031 | |
| 6032 | static struct snd_pci_quirk alc882_cfg_tbl[] = { |
| 6033 | SND_PCI_QUIRK(0x1019, 0x6668, "ECS", ALC882_6ST_DIG), |
Kailang Yang | 272a527 | 2007-05-14 11:00:38 +0200 | [diff] [blame] | 6034 | SND_PCI_QUIRK(0x1043, 0x060d, "Asus A7J", ALC882_ASUS_A7J), |
Kailang Yang | ac8842a | 2007-09-20 12:51:39 +0200 | [diff] [blame] | 6035 | SND_PCI_QUIRK(0x1043, 0x1243, "Asus A7J", ALC882_ASUS_A7J), |
Takashi Iwai | 914759b | 2007-09-06 14:52:04 +0200 | [diff] [blame] | 6036 | SND_PCI_QUIRK(0x1043, 0x13c2, "Asus A7M", ALC882_ASUS_A7M), |
Takashi Iwai | ac3e374 | 2007-12-17 17:14:18 +0100 | [diff] [blame] | 6037 | SND_PCI_QUIRK(0x1043, 0x1971, "Asus W2JC", ALC882_W2JC), |
Claudio Matsuoka | c5d9f1c | 2007-07-19 23:18:32 +0200 | [diff] [blame] | 6038 | SND_PCI_QUIRK(0x1043, 0x817f, "Asus P5LD2", ALC882_6ST_DIG), |
Tobin Davis | 7b9470d | 2006-12-28 13:56:48 +0100 | [diff] [blame] | 6039 | SND_PCI_QUIRK(0x1043, 0x81d8, "Asus P5WD", ALC882_6ST_DIG), |
Takashi Iwai | ac3e374 | 2007-12-17 17:14:18 +0100 | [diff] [blame] | 6040 | SND_PCI_QUIRK(0x105b, 0x6668, "Foxconn", ALC882_6ST_DIG), |
Jiang zhe | 4444704 | 2008-01-28 12:28:24 +0100 | [diff] [blame] | 6041 | SND_PCI_QUIRK(0x1458, 0xa002, "Gigabyte P35 DS3R", ALC882_6ST_DIG), |
Takashi Iwai | ac3e374 | 2007-12-17 17:14:18 +0100 | [diff] [blame] | 6042 | SND_PCI_QUIRK(0x1462, 0x28fb, "Targa T8", ALC882_TARGA), /* MSI-1049 T8 */ |
| 6043 | SND_PCI_QUIRK(0x1462, 0x6668, "MSI", ALC882_6ST_DIG), |
| 6044 | SND_PCI_QUIRK(0x161f, 0x2054, "Arima W820", ALC882_ARIMA), |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 6045 | {} |
| 6046 | }; |
| 6047 | |
| 6048 | static struct alc_config_preset alc882_presets[] = { |
| 6049 | [ALC882_3ST_DIG] = { |
| 6050 | .mixers = { alc882_base_mixer }, |
| 6051 | .init_verbs = { alc882_init_verbs }, |
| 6052 | .num_dacs = ARRAY_SIZE(alc882_dac_nids), |
| 6053 | .dac_nids = alc882_dac_nids, |
| 6054 | .dig_out_nid = ALC882_DIGOUT_NID, |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 6055 | .dig_in_nid = ALC882_DIGIN_NID, |
| 6056 | .num_channel_mode = ARRAY_SIZE(alc882_ch_modes), |
| 6057 | .channel_mode = alc882_ch_modes, |
Takashi Iwai | 4e195a7 | 2006-07-28 14:47:34 +0200 | [diff] [blame] | 6058 | .need_dac_fix = 1, |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 6059 | .input_mux = &alc882_capture_source, |
| 6060 | }, |
| 6061 | [ALC882_6ST_DIG] = { |
| 6062 | .mixers = { alc882_base_mixer, alc882_chmode_mixer }, |
| 6063 | .init_verbs = { alc882_init_verbs }, |
| 6064 | .num_dacs = ARRAY_SIZE(alc882_dac_nids), |
| 6065 | .dac_nids = alc882_dac_nids, |
| 6066 | .dig_out_nid = ALC882_DIGOUT_NID, |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 6067 | .dig_in_nid = ALC882_DIGIN_NID, |
| 6068 | .num_channel_mode = ARRAY_SIZE(alc882_sixstack_modes), |
| 6069 | .channel_mode = alc882_sixstack_modes, |
| 6070 | .input_mux = &alc882_capture_source, |
| 6071 | }, |
Takashi Iwai | 4b146cb | 2006-07-28 14:42:36 +0200 | [diff] [blame] | 6072 | [ALC882_ARIMA] = { |
| 6073 | .mixers = { alc882_base_mixer, alc882_chmode_mixer }, |
| 6074 | .init_verbs = { alc882_init_verbs, alc882_eapd_verbs }, |
| 6075 | .num_dacs = ARRAY_SIZE(alc882_dac_nids), |
| 6076 | .dac_nids = alc882_dac_nids, |
| 6077 | .num_channel_mode = ARRAY_SIZE(alc882_sixstack_modes), |
| 6078 | .channel_mode = alc882_sixstack_modes, |
| 6079 | .input_mux = &alc882_capture_source, |
| 6080 | }, |
Kailang Yang | bdd148a | 2007-05-08 15:19:08 +0200 | [diff] [blame] | 6081 | [ALC882_W2JC] = { |
| 6082 | .mixers = { alc882_w2jc_mixer, alc882_chmode_mixer }, |
| 6083 | .init_verbs = { alc882_init_verbs, alc882_eapd_verbs, |
| 6084 | alc880_gpio1_init_verbs }, |
| 6085 | .num_dacs = ARRAY_SIZE(alc882_dac_nids), |
| 6086 | .dac_nids = alc882_dac_nids, |
| 6087 | .num_channel_mode = ARRAY_SIZE(alc880_threestack_modes), |
| 6088 | .channel_mode = alc880_threestack_modes, |
| 6089 | .need_dac_fix = 1, |
| 6090 | .input_mux = &alc882_capture_source, |
| 6091 | .dig_out_nid = ALC882_DIGOUT_NID, |
| 6092 | }, |
Takashi Iwai | 87350ad | 2007-08-16 18:19:38 +0200 | [diff] [blame] | 6093 | [ALC885_MBP3] = { |
| 6094 | .mixers = { alc885_mbp3_mixer, alc882_chmode_mixer }, |
| 6095 | .init_verbs = { alc885_mbp3_init_verbs, |
| 6096 | alc880_gpio1_init_verbs }, |
| 6097 | .num_dacs = ARRAY_SIZE(alc882_dac_nids), |
| 6098 | .dac_nids = alc882_dac_nids, |
| 6099 | .channel_mode = alc885_mbp_6ch_modes, |
| 6100 | .num_channel_mode = ARRAY_SIZE(alc885_mbp_6ch_modes), |
| 6101 | .input_mux = &alc882_capture_source, |
| 6102 | .dig_out_nid = ALC882_DIGOUT_NID, |
| 6103 | .dig_in_nid = ALC882_DIGIN_NID, |
| 6104 | .unsol_event = alc885_mbp3_unsol_event, |
| 6105 | .init_hook = alc885_mbp3_automute, |
| 6106 | }, |
Tobin Davis | 9102cd1 | 2006-12-15 10:02:12 +0100 | [diff] [blame] | 6107 | [ALC885_MACPRO] = { |
| 6108 | .mixers = { alc882_macpro_mixer }, |
| 6109 | .init_verbs = { alc882_macpro_init_verbs }, |
| 6110 | .num_dacs = ARRAY_SIZE(alc882_dac_nids), |
| 6111 | .dac_nids = alc882_dac_nids, |
| 6112 | .dig_out_nid = ALC882_DIGOUT_NID, |
| 6113 | .dig_in_nid = ALC882_DIGIN_NID, |
| 6114 | .num_channel_mode = ARRAY_SIZE(alc882_ch_modes), |
| 6115 | .channel_mode = alc882_ch_modes, |
| 6116 | .input_mux = &alc882_capture_source, |
Takashi Iwai | 7debbe5 | 2007-08-16 15:01:03 +0200 | [diff] [blame] | 6117 | .init_hook = alc885_macpro_init_hook, |
Tobin Davis | 9102cd1 | 2006-12-15 10:02:12 +0100 | [diff] [blame] | 6118 | }, |
Nicola Fagnani | c54728d | 2007-07-19 23:28:52 +0200 | [diff] [blame] | 6119 | [ALC885_IMAC24] = { |
| 6120 | .mixers = { alc885_imac24_mixer }, |
| 6121 | .init_verbs = { alc885_imac24_init_verbs }, |
| 6122 | .num_dacs = ARRAY_SIZE(alc882_dac_nids), |
| 6123 | .dac_nids = alc882_dac_nids, |
| 6124 | .dig_out_nid = ALC882_DIGOUT_NID, |
| 6125 | .dig_in_nid = ALC882_DIGIN_NID, |
| 6126 | .num_channel_mode = ARRAY_SIZE(alc882_ch_modes), |
| 6127 | .channel_mode = alc882_ch_modes, |
| 6128 | .input_mux = &alc882_capture_source, |
| 6129 | .unsol_event = alc885_imac24_unsol_event, |
Takashi Iwai | 7debbe5 | 2007-08-16 15:01:03 +0200 | [diff] [blame] | 6130 | .init_hook = alc885_imac24_init_hook, |
Nicola Fagnani | c54728d | 2007-07-19 23:28:52 +0200 | [diff] [blame] | 6131 | }, |
Kailang Yang | 272a527 | 2007-05-14 11:00:38 +0200 | [diff] [blame] | 6132 | [ALC882_TARGA] = { |
| 6133 | .mixers = { alc882_targa_mixer, alc882_chmode_mixer, |
| 6134 | alc882_capture_mixer }, |
| 6135 | .init_verbs = { alc882_init_verbs, alc882_targa_verbs}, |
| 6136 | .num_dacs = ARRAY_SIZE(alc882_dac_nids), |
| 6137 | .dac_nids = alc882_dac_nids, |
| 6138 | .dig_out_nid = ALC882_DIGOUT_NID, |
| 6139 | .num_adc_nids = ARRAY_SIZE(alc882_adc_nids), |
| 6140 | .adc_nids = alc882_adc_nids, |
Takashi Iwai | e140634 | 2008-02-11 18:32:32 +0100 | [diff] [blame] | 6141 | .capsrc_nids = alc882_capsrc_nids, |
Kailang Yang | 272a527 | 2007-05-14 11:00:38 +0200 | [diff] [blame] | 6142 | .num_channel_mode = ARRAY_SIZE(alc882_3ST_6ch_modes), |
| 6143 | .channel_mode = alc882_3ST_6ch_modes, |
| 6144 | .need_dac_fix = 1, |
| 6145 | .input_mux = &alc882_capture_source, |
| 6146 | .unsol_event = alc882_targa_unsol_event, |
| 6147 | .init_hook = alc882_targa_automute, |
| 6148 | }, |
| 6149 | [ALC882_ASUS_A7J] = { |
| 6150 | .mixers = { alc882_asus_a7j_mixer, alc882_chmode_mixer, |
| 6151 | alc882_capture_mixer }, |
| 6152 | .init_verbs = { alc882_init_verbs, alc882_asus_a7j_verbs}, |
| 6153 | .num_dacs = ARRAY_SIZE(alc882_dac_nids), |
| 6154 | .dac_nids = alc882_dac_nids, |
| 6155 | .dig_out_nid = ALC882_DIGOUT_NID, |
| 6156 | .num_adc_nids = ARRAY_SIZE(alc882_adc_nids), |
| 6157 | .adc_nids = alc882_adc_nids, |
Takashi Iwai | e140634 | 2008-02-11 18:32:32 +0100 | [diff] [blame] | 6158 | .capsrc_nids = alc882_capsrc_nids, |
Kailang Yang | 272a527 | 2007-05-14 11:00:38 +0200 | [diff] [blame] | 6159 | .num_channel_mode = ARRAY_SIZE(alc882_3ST_6ch_modes), |
| 6160 | .channel_mode = alc882_3ST_6ch_modes, |
| 6161 | .need_dac_fix = 1, |
| 6162 | .input_mux = &alc882_capture_source, |
| 6163 | }, |
Takashi Iwai | 914759b | 2007-09-06 14:52:04 +0200 | [diff] [blame] | 6164 | [ALC882_ASUS_A7M] = { |
| 6165 | .mixers = { alc882_asus_a7m_mixer, alc882_chmode_mixer }, |
| 6166 | .init_verbs = { alc882_init_verbs, alc882_eapd_verbs, |
| 6167 | alc880_gpio1_init_verbs, |
| 6168 | alc882_asus_a7m_verbs }, |
| 6169 | .num_dacs = ARRAY_SIZE(alc882_dac_nids), |
| 6170 | .dac_nids = alc882_dac_nids, |
| 6171 | .dig_out_nid = ALC882_DIGOUT_NID, |
| 6172 | .num_channel_mode = ARRAY_SIZE(alc880_threestack_modes), |
| 6173 | .channel_mode = alc880_threestack_modes, |
| 6174 | .need_dac_fix = 1, |
| 6175 | .input_mux = &alc882_capture_source, |
| 6176 | }, |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 6177 | }; |
| 6178 | |
| 6179 | |
| 6180 | /* |
Takashi Iwai | f95474e | 2007-07-10 00:47:43 +0200 | [diff] [blame] | 6181 | * Pin config fixes |
| 6182 | */ |
| 6183 | enum { |
| 6184 | PINFIX_ABIT_AW9D_MAX |
| 6185 | }; |
| 6186 | |
| 6187 | static struct alc_pincfg alc882_abit_aw9d_pinfix[] = { |
| 6188 | { 0x15, 0x01080104 }, /* side */ |
| 6189 | { 0x16, 0x01011012 }, /* rear */ |
| 6190 | { 0x17, 0x01016011 }, /* clfe */ |
| 6191 | { } |
| 6192 | }; |
| 6193 | |
| 6194 | static const struct alc_pincfg *alc882_pin_fixes[] = { |
| 6195 | [PINFIX_ABIT_AW9D_MAX] = alc882_abit_aw9d_pinfix, |
| 6196 | }; |
| 6197 | |
| 6198 | static struct snd_pci_quirk alc882_pinfix_tbl[] = { |
| 6199 | SND_PCI_QUIRK(0x147b, 0x107a, "Abit AW9D-MAX", PINFIX_ABIT_AW9D_MAX), |
| 6200 | {} |
| 6201 | }; |
| 6202 | |
| 6203 | /* |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 6204 | * BIOS auto configuration |
| 6205 | */ |
| 6206 | static void alc882_auto_set_output_and_unmute(struct hda_codec *codec, |
| 6207 | hda_nid_t nid, int pin_type, |
| 6208 | int dac_idx) |
| 6209 | { |
| 6210 | /* set as output */ |
| 6211 | struct alc_spec *spec = codec->spec; |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 6212 | int idx; |
| 6213 | |
Takashi Iwai | f6c7e54 | 2008-02-12 18:32:23 +0100 | [diff] [blame] | 6214 | alc_set_pin_output(codec, nid, pin_type); |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 6215 | if (spec->multiout.dac_nids[dac_idx] == 0x25) |
| 6216 | idx = 4; |
| 6217 | else |
| 6218 | idx = spec->multiout.dac_nids[dac_idx] - 2; |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 6219 | snd_hda_codec_write(codec, nid, 0, AC_VERB_SET_CONNECT_SEL, idx); |
| 6220 | |
| 6221 | } |
| 6222 | |
| 6223 | static void alc882_auto_init_multi_out(struct hda_codec *codec) |
| 6224 | { |
| 6225 | struct alc_spec *spec = codec->spec; |
| 6226 | int i; |
| 6227 | |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 6228 | alc_subsystem_id(codec, 0x15, 0x1b, 0x14); |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 6229 | for (i = 0; i <= HDA_SIDE; i++) { |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 6230 | hda_nid_t nid = spec->autocfg.line_out_pins[i]; |
Takashi Iwai | baba8ee | 2007-04-23 17:17:48 +0200 | [diff] [blame] | 6231 | int pin_type = get_pin_type(spec->autocfg.line_out_type); |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 6232 | if (nid) |
Takashi Iwai | baba8ee | 2007-04-23 17:17:48 +0200 | [diff] [blame] | 6233 | alc882_auto_set_output_and_unmute(codec, nid, pin_type, |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 6234 | i); |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 6235 | } |
| 6236 | } |
| 6237 | |
| 6238 | static void alc882_auto_init_hp_out(struct hda_codec *codec) |
| 6239 | { |
| 6240 | struct alc_spec *spec = codec->spec; |
| 6241 | hda_nid_t pin; |
| 6242 | |
Takashi Iwai | eb06ed8 | 2006-09-20 17:10:27 +0200 | [diff] [blame] | 6243 | pin = spec->autocfg.hp_pins[0]; |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 6244 | if (pin) /* connect to front */ |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 6245 | /* use dac 0 */ |
| 6246 | alc882_auto_set_output_and_unmute(codec, pin, PIN_HP, 0); |
Takashi Iwai | f6c7e54 | 2008-02-12 18:32:23 +0100 | [diff] [blame] | 6247 | pin = spec->autocfg.speaker_pins[0]; |
| 6248 | if (pin) |
| 6249 | alc882_auto_set_output_and_unmute(codec, pin, PIN_OUT, 0); |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 6250 | } |
| 6251 | |
| 6252 | #define alc882_is_input_pin(nid) alc880_is_input_pin(nid) |
| 6253 | #define ALC882_PIN_CD_NID ALC880_PIN_CD_NID |
| 6254 | |
| 6255 | static void alc882_auto_init_analog_input(struct hda_codec *codec) |
| 6256 | { |
| 6257 | struct alc_spec *spec = codec->spec; |
| 6258 | int i; |
| 6259 | |
| 6260 | for (i = 0; i < AUTO_PIN_LAST; i++) { |
| 6261 | hda_nid_t nid = spec->autocfg.input_pins[i]; |
Takashi Iwai | 7194cae | 2008-03-06 16:58:17 +0100 | [diff] [blame] | 6262 | unsigned int vref; |
| 6263 | if (!nid) |
| 6264 | continue; |
| 6265 | vref = PIN_IN; |
| 6266 | if (1 /*i <= AUTO_PIN_FRONT_MIC*/) { |
| 6267 | if (snd_hda_param_read(codec, nid, AC_PAR_PIN_CAP) & |
| 6268 | AC_PINCAP_VREF_80) |
| 6269 | vref = PIN_VREF80; |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 6270 | } |
Takashi Iwai | 7194cae | 2008-03-06 16:58:17 +0100 | [diff] [blame] | 6271 | snd_hda_codec_write(codec, nid, 0, |
| 6272 | AC_VERB_SET_PIN_WIDGET_CONTROL, vref); |
| 6273 | if (get_wcaps(codec, nid) & AC_WCAP_OUT_AMP) |
| 6274 | snd_hda_codec_write(codec, nid, 0, |
| 6275 | AC_VERB_SET_AMP_GAIN_MUTE, |
| 6276 | AMP_OUT_MUTE); |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 6277 | } |
| 6278 | } |
| 6279 | |
Takashi Iwai | 776e184 | 2007-08-29 15:07:11 +0200 | [diff] [blame] | 6280 | /* add mic boosts if needed */ |
| 6281 | static int alc_auto_add_mic_boost(struct hda_codec *codec) |
| 6282 | { |
| 6283 | struct alc_spec *spec = codec->spec; |
| 6284 | int err; |
| 6285 | hda_nid_t nid; |
| 6286 | |
| 6287 | nid = spec->autocfg.input_pins[AUTO_PIN_MIC]; |
Takashi Iwai | ce22e03 | 2008-01-11 17:38:35 +0100 | [diff] [blame] | 6288 | if (nid && (get_wcaps(codec, nid) & AC_WCAP_IN_AMP)) { |
Takashi Iwai | 776e184 | 2007-08-29 15:07:11 +0200 | [diff] [blame] | 6289 | err = add_control(spec, ALC_CTL_WIDGET_VOL, |
| 6290 | "Mic Boost", |
| 6291 | HDA_COMPOSE_AMP_VAL(nid, 3, 0, HDA_INPUT)); |
| 6292 | if (err < 0) |
| 6293 | return err; |
| 6294 | } |
| 6295 | nid = spec->autocfg.input_pins[AUTO_PIN_FRONT_MIC]; |
Takashi Iwai | ce22e03 | 2008-01-11 17:38:35 +0100 | [diff] [blame] | 6296 | if (nid && (get_wcaps(codec, nid) & AC_WCAP_IN_AMP)) { |
Takashi Iwai | 776e184 | 2007-08-29 15:07:11 +0200 | [diff] [blame] | 6297 | err = add_control(spec, ALC_CTL_WIDGET_VOL, |
| 6298 | "Front Mic Boost", |
| 6299 | HDA_COMPOSE_AMP_VAL(nid, 3, 0, HDA_INPUT)); |
| 6300 | if (err < 0) |
| 6301 | return err; |
| 6302 | } |
| 6303 | return 0; |
| 6304 | } |
| 6305 | |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 6306 | /* almost identical with ALC880 parser... */ |
| 6307 | static int alc882_parse_auto_config(struct hda_codec *codec) |
| 6308 | { |
| 6309 | struct alc_spec *spec = codec->spec; |
| 6310 | int err = alc880_parse_auto_config(codec); |
| 6311 | |
| 6312 | if (err < 0) |
| 6313 | return err; |
Takashi Iwai | 776e184 | 2007-08-29 15:07:11 +0200 | [diff] [blame] | 6314 | else if (!err) |
| 6315 | return 0; /* no config found */ |
| 6316 | |
| 6317 | err = alc_auto_add_mic_boost(codec); |
| 6318 | if (err < 0) |
| 6319 | return err; |
| 6320 | |
| 6321 | /* hack - override the init verbs */ |
| 6322 | spec->init_verbs[0] = alc882_auto_init_verbs; |
| 6323 | |
| 6324 | return 1; /* config found */ |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 6325 | } |
| 6326 | |
Takashi Iwai | ae6b813 | 2006-03-03 16:47:17 +0100 | [diff] [blame] | 6327 | /* additional initialization for auto-configuration model */ |
| 6328 | static void alc882_auto_init(struct hda_codec *codec) |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 6329 | { |
Takashi Iwai | f6c7e54 | 2008-02-12 18:32:23 +0100 | [diff] [blame] | 6330 | struct alc_spec *spec = codec->spec; |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 6331 | alc882_auto_init_multi_out(codec); |
| 6332 | alc882_auto_init_hp_out(codec); |
| 6333 | alc882_auto_init_analog_input(codec); |
Takashi Iwai | f6c7e54 | 2008-02-12 18:32:23 +0100 | [diff] [blame] | 6334 | if (spec->unsol_event) |
| 6335 | alc_sku_automute(codec); |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 6336 | } |
| 6337 | |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 6338 | static int patch_alc882(struct hda_codec *codec) |
| 6339 | { |
| 6340 | struct alc_spec *spec; |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 6341 | int err, board_config; |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 6342 | |
Takashi Iwai | e560d8d | 2005-09-09 14:21:46 +0200 | [diff] [blame] | 6343 | spec = kzalloc(sizeof(*spec), GFP_KERNEL); |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 6344 | if (spec == NULL) |
| 6345 | return -ENOMEM; |
| 6346 | |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 6347 | codec->spec = spec; |
| 6348 | |
Takashi Iwai | f5fcc13 | 2006-11-24 17:07:44 +0100 | [diff] [blame] | 6349 | board_config = snd_hda_check_board_config(codec, ALC882_MODEL_LAST, |
| 6350 | alc882_models, |
| 6351 | alc882_cfg_tbl); |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 6352 | |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 6353 | if (board_config < 0 || board_config >= ALC882_MODEL_LAST) { |
Tobin Davis | 081d17c | 2007-02-15 17:46:18 +0100 | [diff] [blame] | 6354 | /* Pick up systems that don't supply PCI SSID */ |
| 6355 | switch (codec->subsystem_id) { |
| 6356 | case 0x106b0c00: /* Mac Pro */ |
| 6357 | board_config = ALC885_MACPRO; |
| 6358 | break; |
Nicola Fagnani | c54728d | 2007-07-19 23:28:52 +0200 | [diff] [blame] | 6359 | case 0x106b1000: /* iMac 24 */ |
| 6360 | board_config = ALC885_IMAC24; |
| 6361 | break; |
Jiang zhe | 3d5fa2e | 2008-01-10 13:05:47 +0100 | [diff] [blame] | 6362 | case 0x106b00a1: /* Macbook */ |
Takashi Iwai | 87350ad | 2007-08-16 18:19:38 +0200 | [diff] [blame] | 6363 | case 0x106b2c00: /* Macbook Pro rev3 */ |
| 6364 | board_config = ALC885_MBP3; |
| 6365 | break; |
Tobin Davis | 081d17c | 2007-02-15 17:46:18 +0100 | [diff] [blame] | 6366 | default: |
| 6367 | printk(KERN_INFO "hda_codec: Unknown model for ALC882, " |
| 6368 | "trying auto-probe from BIOS...\n"); |
| 6369 | board_config = ALC882_AUTO; |
| 6370 | } |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 6371 | } |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 6372 | |
Takashi Iwai | f95474e | 2007-07-10 00:47:43 +0200 | [diff] [blame] | 6373 | alc_fix_pincfg(codec, alc882_pinfix_tbl, alc882_pin_fixes); |
| 6374 | |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 6375 | if (board_config == ALC882_AUTO) { |
| 6376 | /* automatic parse from the BIOS config */ |
| 6377 | err = alc882_parse_auto_config(codec); |
| 6378 | if (err < 0) { |
| 6379 | alc_free(codec); |
| 6380 | return err; |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 6381 | } else if (!err) { |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 6382 | printk(KERN_INFO |
| 6383 | "hda_codec: Cannot set up configuration " |
| 6384 | "from BIOS. Using base mode...\n"); |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 6385 | board_config = ALC882_3ST_DIG; |
| 6386 | } |
| 6387 | } |
| 6388 | |
| 6389 | if (board_config != ALC882_AUTO) |
| 6390 | setup_preset(spec, &alc882_presets[board_config]); |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 6391 | |
| 6392 | spec->stream_name_analog = "ALC882 Analog"; |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 6393 | spec->stream_analog_playback = &alc882_pcm_analog_playback; |
| 6394 | spec->stream_analog_capture = &alc882_pcm_analog_capture; |
Takashi Iwai | 6330079 | 2008-01-24 15:31:36 +0100 | [diff] [blame] | 6395 | /* FIXME: setup DAC5 */ |
| 6396 | /*spec->stream_analog_alt_playback = &alc880_pcm_analog_alt_playback;*/ |
| 6397 | spec->stream_analog_alt_capture = &alc880_pcm_analog_alt_capture; |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 6398 | |
| 6399 | spec->stream_name_digital = "ALC882 Digital"; |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 6400 | spec->stream_digital_playback = &alc882_pcm_digital_playback; |
| 6401 | spec->stream_digital_capture = &alc882_pcm_digital_capture; |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 6402 | |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 6403 | if (!spec->adc_nids && spec->input_mux) { |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 6404 | /* check whether NID 0x07 is valid */ |
Takashi Iwai | 4a471b7 | 2005-12-07 13:56:29 +0100 | [diff] [blame] | 6405 | unsigned int wcap = get_wcaps(codec, 0x07); |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 6406 | /* get type */ |
| 6407 | wcap = (wcap & AC_WCAP_TYPE) >> AC_WCAP_TYPE_SHIFT; |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 6408 | if (wcap != AC_WID_AUD_IN) { |
| 6409 | spec->adc_nids = alc882_adc_nids_alt; |
| 6410 | spec->num_adc_nids = ARRAY_SIZE(alc882_adc_nids_alt); |
Takashi Iwai | e140634 | 2008-02-11 18:32:32 +0100 | [diff] [blame] | 6411 | spec->capsrc_nids = alc882_capsrc_nids_alt; |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 6412 | spec->mixers[spec->num_mixers] = |
| 6413 | alc882_capture_alt_mixer; |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 6414 | spec->num_mixers++; |
| 6415 | } else { |
| 6416 | spec->adc_nids = alc882_adc_nids; |
| 6417 | spec->num_adc_nids = ARRAY_SIZE(alc882_adc_nids); |
Takashi Iwai | e140634 | 2008-02-11 18:32:32 +0100 | [diff] [blame] | 6418 | spec->capsrc_nids = alc882_capsrc_nids; |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 6419 | spec->mixers[spec->num_mixers] = alc882_capture_mixer; |
| 6420 | spec->num_mixers++; |
| 6421 | } |
| 6422 | } |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 6423 | |
Takashi Iwai | 2134ea4 | 2008-01-10 16:53:55 +0100 | [diff] [blame] | 6424 | spec->vmaster_nid = 0x0c; |
| 6425 | |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 6426 | codec->patch_ops = alc_patch_ops; |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 6427 | if (board_config == ALC882_AUTO) |
Takashi Iwai | ae6b813 | 2006-03-03 16:47:17 +0100 | [diff] [blame] | 6428 | spec->init_hook = alc882_auto_init; |
Takashi Iwai | cb53c62 | 2007-08-10 17:21:45 +0200 | [diff] [blame] | 6429 | #ifdef CONFIG_SND_HDA_POWER_SAVE |
| 6430 | if (!spec->loopback.amplist) |
| 6431 | spec->loopback.amplist = alc882_loopbacks; |
| 6432 | #endif |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 6433 | |
| 6434 | return 0; |
| 6435 | } |
| 6436 | |
| 6437 | /* |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 6438 | * ALC883 support |
| 6439 | * |
| 6440 | * ALC883 is almost identical with ALC880 but has cleaner and more flexible |
| 6441 | * configuration. Each pin widget can choose any input DACs and a mixer. |
| 6442 | * Each ADC is connected from a mixer of all inputs. This makes possible |
| 6443 | * 6-channel independent captures. |
| 6444 | * |
| 6445 | * In addition, an independent DAC for the multi-playback (not used in this |
| 6446 | * driver yet). |
| 6447 | */ |
| 6448 | #define ALC883_DIGOUT_NID 0x06 |
| 6449 | #define ALC883_DIGIN_NID 0x0a |
| 6450 | |
| 6451 | static hda_nid_t alc883_dac_nids[4] = { |
| 6452 | /* front, rear, clfe, rear_surr */ |
Herton Ronaldo Krzesinski | f32a19e | 2008-03-18 09:27:08 +0100 | [diff] [blame] | 6453 | 0x02, 0x03, 0x04, 0x05 |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 6454 | }; |
| 6455 | |
| 6456 | static hda_nid_t alc883_adc_nids[2] = { |
| 6457 | /* ADC1-2 */ |
| 6458 | 0x08, 0x09, |
| 6459 | }; |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 6460 | |
Takashi Iwai | e140634 | 2008-02-11 18:32:32 +0100 | [diff] [blame] | 6461 | static hda_nid_t alc883_capsrc_nids[2] = { 0x23, 0x22 }; |
| 6462 | |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 6463 | /* input MUX */ |
| 6464 | /* FIXME: should be a matrix-type input source selection */ |
| 6465 | |
| 6466 | static struct hda_input_mux alc883_capture_source = { |
| 6467 | .num_items = 4, |
| 6468 | .items = { |
| 6469 | { "Mic", 0x0 }, |
| 6470 | { "Front Mic", 0x1 }, |
| 6471 | { "Line", 0x2 }, |
| 6472 | { "CD", 0x4 }, |
| 6473 | }, |
| 6474 | }; |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 6475 | |
| 6476 | static struct hda_input_mux alc883_lenovo_101e_capture_source = { |
| 6477 | .num_items = 2, |
| 6478 | .items = { |
| 6479 | { "Mic", 0x1 }, |
| 6480 | { "Line", 0x2 }, |
| 6481 | }, |
| 6482 | }; |
| 6483 | |
Kailang Yang | 272a527 | 2007-05-14 11:00:38 +0200 | [diff] [blame] | 6484 | static struct hda_input_mux alc883_lenovo_nb0763_capture_source = { |
| 6485 | .num_items = 4, |
| 6486 | .items = { |
| 6487 | { "Mic", 0x0 }, |
| 6488 | { "iMic", 0x1 }, |
| 6489 | { "Line", 0x2 }, |
| 6490 | { "CD", 0x4 }, |
| 6491 | }, |
| 6492 | }; |
| 6493 | |
Jiang zhe | fb97dc6 | 2008-03-06 11:07:11 +0100 | [diff] [blame] | 6494 | static struct hda_input_mux alc883_fujitsu_pi2515_capture_source = { |
| 6495 | .num_items = 2, |
| 6496 | .items = { |
| 6497 | { "Mic", 0x0 }, |
| 6498 | { "Int Mic", 0x1 }, |
| 6499 | }, |
| 6500 | }; |
| 6501 | |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 6502 | #define alc883_mux_enum_info alc_mux_enum_info |
| 6503 | #define alc883_mux_enum_get alc_mux_enum_get |
Takashi Iwai | e140634 | 2008-02-11 18:32:32 +0100 | [diff] [blame] | 6504 | /* ALC883 has the ALC882-type input selection */ |
| 6505 | #define alc883_mux_enum_put alc882_mux_enum_put |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 6506 | |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 6507 | /* |
| 6508 | * 2ch mode |
| 6509 | */ |
| 6510 | static struct hda_channel_mode alc883_3ST_2ch_modes[1] = { |
| 6511 | { 2, NULL } |
| 6512 | }; |
| 6513 | |
| 6514 | /* |
| 6515 | * 2ch mode |
| 6516 | */ |
| 6517 | static struct hda_verb alc883_3ST_ch2_init[] = { |
| 6518 | { 0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80 }, |
| 6519 | { 0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE }, |
| 6520 | { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN }, |
| 6521 | { 0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE }, |
| 6522 | { } /* end */ |
| 6523 | }; |
| 6524 | |
| 6525 | /* |
Tobin Davis | b201131 | 2007-09-17 12:45:11 +0200 | [diff] [blame] | 6526 | * 4ch mode |
| 6527 | */ |
| 6528 | static struct hda_verb alc883_3ST_ch4_init[] = { |
| 6529 | { 0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80 }, |
| 6530 | { 0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE }, |
| 6531 | { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, |
| 6532 | { 0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE }, |
| 6533 | { 0x1a, AC_VERB_SET_CONNECT_SEL, 0x01 }, |
| 6534 | { } /* end */ |
| 6535 | }; |
| 6536 | |
| 6537 | /* |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 6538 | * 6ch mode |
| 6539 | */ |
| 6540 | static struct hda_verb alc883_3ST_ch6_init[] = { |
| 6541 | { 0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, |
| 6542 | { 0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE }, |
| 6543 | { 0x18, AC_VERB_SET_CONNECT_SEL, 0x02 }, |
| 6544 | { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, |
| 6545 | { 0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE }, |
| 6546 | { 0x1a, AC_VERB_SET_CONNECT_SEL, 0x01 }, |
| 6547 | { } /* end */ |
| 6548 | }; |
| 6549 | |
Tobin Davis | b201131 | 2007-09-17 12:45:11 +0200 | [diff] [blame] | 6550 | static struct hda_channel_mode alc883_3ST_6ch_modes[3] = { |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 6551 | { 2, alc883_3ST_ch2_init }, |
Tobin Davis | b201131 | 2007-09-17 12:45:11 +0200 | [diff] [blame] | 6552 | { 4, alc883_3ST_ch4_init }, |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 6553 | { 6, alc883_3ST_ch6_init }, |
| 6554 | }; |
| 6555 | |
| 6556 | /* |
| 6557 | * 6ch mode |
| 6558 | */ |
| 6559 | static struct hda_verb alc883_sixstack_ch6_init[] = { |
| 6560 | { 0x17, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x00 }, |
| 6561 | { 0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, |
| 6562 | { 0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, |
| 6563 | { 0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, |
| 6564 | { } /* end */ |
| 6565 | }; |
| 6566 | |
| 6567 | /* |
| 6568 | * 8ch mode |
| 6569 | */ |
| 6570 | static struct hda_verb alc883_sixstack_ch8_init[] = { |
| 6571 | { 0x17, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, |
| 6572 | { 0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, |
| 6573 | { 0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, |
| 6574 | { 0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, |
| 6575 | { } /* end */ |
| 6576 | }; |
| 6577 | |
| 6578 | static struct hda_channel_mode alc883_sixstack_modes[2] = { |
| 6579 | { 6, alc883_sixstack_ch6_init }, |
| 6580 | { 8, alc883_sixstack_ch8_init }, |
| 6581 | }; |
| 6582 | |
Andrew L. Neporada | b373bde | 2006-11-07 11:37:08 +0100 | [diff] [blame] | 6583 | static struct hda_verb alc883_medion_eapd_verbs[] = { |
| 6584 | /* eanable EAPD on medion laptop */ |
| 6585 | {0x20, AC_VERB_SET_COEF_INDEX, 0x07}, |
| 6586 | {0x20, AC_VERB_SET_PROC_COEF, 0x3070}, |
| 6587 | { } |
| 6588 | }; |
| 6589 | |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 6590 | /* Pin assignment: Front=0x14, Rear=0x15, CLFE=0x16, Side=0x17 |
| 6591 | * Mic=0x18, Front Mic=0x19, Line-In=0x1a, HP=0x1b |
| 6592 | */ |
| 6593 | |
| 6594 | static struct snd_kcontrol_new alc883_base_mixer[] = { |
| 6595 | HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT), |
| 6596 | HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT), |
| 6597 | HDA_CODEC_VOLUME("Surround Playback Volume", 0x0d, 0x0, HDA_OUTPUT), |
| 6598 | HDA_BIND_MUTE("Surround Playback Switch", 0x0d, 2, HDA_INPUT), |
| 6599 | HDA_CODEC_VOLUME_MONO("Center Playback Volume", 0x0e, 1, 0x0, HDA_OUTPUT), |
| 6600 | HDA_CODEC_VOLUME_MONO("LFE Playback Volume", 0x0e, 2, 0x0, HDA_OUTPUT), |
| 6601 | HDA_BIND_MUTE_MONO("Center Playback Switch", 0x0e, 1, 2, HDA_INPUT), |
| 6602 | HDA_BIND_MUTE_MONO("LFE Playback Switch", 0x0e, 2, 2, HDA_INPUT), |
| 6603 | HDA_CODEC_VOLUME("Side Playback Volume", 0x0f, 0x0, HDA_OUTPUT), |
| 6604 | HDA_BIND_MUTE("Side Playback Switch", 0x0f, 2, HDA_INPUT), |
| 6605 | HDA_CODEC_MUTE("Headphone Playback Switch", 0x1b, 0x0, HDA_OUTPUT), |
| 6606 | HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT), |
| 6607 | HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT), |
| 6608 | HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT), |
| 6609 | HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT), |
| 6610 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), |
Thomas De Schampheleire | 3236041 | 2007-01-24 16:13:35 +0100 | [diff] [blame] | 6611 | HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT), |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 6612 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), |
| 6613 | HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x1, HDA_INPUT), |
Thomas De Schampheleire | 3236041 | 2007-01-24 16:13:35 +0100 | [diff] [blame] | 6614 | HDA_CODEC_VOLUME("Front Mic Boost", 0x19, 0, HDA_INPUT), |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 6615 | HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x1, HDA_INPUT), |
| 6616 | HDA_CODEC_VOLUME("PC Speaker Playback Volume", 0x0b, 0x05, HDA_INPUT), |
| 6617 | HDA_CODEC_MUTE("PC Speaker Playback Switch", 0x0b, 0x05, HDA_INPUT), |
| 6618 | HDA_CODEC_VOLUME("Capture Volume", 0x08, 0x0, HDA_INPUT), |
| 6619 | HDA_CODEC_MUTE("Capture Switch", 0x08, 0x0, HDA_INPUT), |
| 6620 | HDA_CODEC_VOLUME_IDX("Capture Volume", 1, 0x09, 0x0, HDA_INPUT), |
| 6621 | HDA_CODEC_MUTE_IDX("Capture Switch", 1, 0x09, 0x0, HDA_INPUT), |
| 6622 | { |
| 6623 | .iface = SNDRV_CTL_ELEM_IFACE_MIXER, |
| 6624 | /* .name = "Capture Source", */ |
| 6625 | .name = "Input Source", |
| 6626 | .count = 2, |
| 6627 | .info = alc883_mux_enum_info, |
| 6628 | .get = alc883_mux_enum_get, |
| 6629 | .put = alc883_mux_enum_put, |
| 6630 | }, |
| 6631 | { } /* end */ |
| 6632 | }; |
| 6633 | |
Andy Shevchenko | a8848bd | 2007-12-13 17:32:26 +0100 | [diff] [blame] | 6634 | static struct snd_kcontrol_new alc883_mitac_mixer[] = { |
| 6635 | HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT), |
| 6636 | HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT), |
| 6637 | HDA_CODEC_VOLUME_MONO("Center Playback Volume", 0x0e, 1, 0x0, HDA_OUTPUT), |
| 6638 | HDA_CODEC_VOLUME_MONO("LFE Playback Volume", 0x0e, 2, 0x0, HDA_OUTPUT), |
| 6639 | HDA_BIND_MUTE_MONO("Center Playback Switch", 0x0e, 1, 2, HDA_INPUT), |
| 6640 | HDA_BIND_MUTE_MONO("LFE Playback Switch", 0x0e, 2, 2, HDA_INPUT), |
| 6641 | HDA_CODEC_MUTE("Headphone Playback Switch", 0x15, 0x0, HDA_OUTPUT), |
| 6642 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), |
| 6643 | HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT), |
| 6644 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), |
| 6645 | HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x1, HDA_INPUT), |
| 6646 | HDA_CODEC_VOLUME("Front Mic Boost", 0x19, 0, HDA_INPUT), |
| 6647 | HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x1, HDA_INPUT), |
| 6648 | HDA_CODEC_VOLUME("Capture Volume", 0x08, 0x0, HDA_INPUT), |
| 6649 | HDA_CODEC_MUTE("Capture Switch", 0x08, 0x0, HDA_INPUT), |
| 6650 | HDA_CODEC_VOLUME_IDX("Capture Volume", 1, 0x09, 0x0, HDA_INPUT), |
| 6651 | HDA_CODEC_MUTE_IDX("Capture Switch", 1, 0x09, 0x0, HDA_INPUT), |
| 6652 | { |
| 6653 | .iface = SNDRV_CTL_ELEM_IFACE_MIXER, |
| 6654 | /* .name = "Capture Source", */ |
| 6655 | .name = "Input Source", |
| 6656 | .count = 2, |
| 6657 | .info = alc883_mux_enum_info, |
| 6658 | .get = alc883_mux_enum_get, |
| 6659 | .put = alc883_mux_enum_put, |
| 6660 | }, |
| 6661 | { } /* end */ |
| 6662 | }; |
| 6663 | |
Jiang zhe | 368c7a9 | 2008-03-04 11:20:33 +0100 | [diff] [blame] | 6664 | static struct snd_kcontrol_new alc883_clevo_m720r_mixer[] = { |
| 6665 | HDA_CODEC_VOLUME("Headphone Playback Volume", 0x0c, 0x0, HDA_OUTPUT), |
| 6666 | HDA_BIND_MUTE("Headphone Playback Switch", 0x0c, 2, HDA_INPUT), |
| 6667 | HDA_CODEC_VOLUME("Speaker Playback Volume", 0x0d, 0x0, HDA_OUTPUT), |
| 6668 | HDA_BIND_MUTE("Speaker Playback Switch", 0x0d, 2, HDA_INPUT), |
| 6669 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), |
| 6670 | HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT), |
| 6671 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), |
| 6672 | HDA_CODEC_VOLUME("Int Mic Playback Volume", 0x0b, 0x1, HDA_INPUT), |
| 6673 | HDA_CODEC_VOLUME("Int Mic Boost", 0x19, 0, HDA_INPUT), |
| 6674 | HDA_CODEC_MUTE("Int Mic Playback Switch", 0x0b, 0x1, HDA_INPUT), |
| 6675 | HDA_CODEC_VOLUME("Capture Volume", 0x08, 0x0, HDA_INPUT), |
| 6676 | HDA_CODEC_MUTE("Capture Switch", 0x08, 0x0, HDA_INPUT), |
| 6677 | HDA_CODEC_VOLUME_IDX("Capture Volume", 1, 0x09, 0x0, HDA_INPUT), |
| 6678 | HDA_CODEC_MUTE_IDX("Capture Switch", 1, 0x09, 0x0, HDA_INPUT), |
| 6679 | { |
| 6680 | .iface = SNDRV_CTL_ELEM_IFACE_MIXER, |
| 6681 | /* .name = "Capture Source", */ |
| 6682 | .name = "Input Source", |
| 6683 | .count = 2, |
| 6684 | .info = alc883_mux_enum_info, |
| 6685 | .get = alc883_mux_enum_get, |
| 6686 | .put = alc883_mux_enum_put, |
| 6687 | }, |
| 6688 | { } /* end */ |
| 6689 | }; |
| 6690 | |
Jiang zhe | fb97dc6 | 2008-03-06 11:07:11 +0100 | [diff] [blame] | 6691 | static struct snd_kcontrol_new alc883_2ch_fujitsu_pi2515_mixer[] = { |
| 6692 | HDA_CODEC_VOLUME("Headphone Playback Volume", 0x0c, 0x0, HDA_OUTPUT), |
| 6693 | HDA_BIND_MUTE("Headphone Playback Switch", 0x0c, 2, HDA_INPUT), |
| 6694 | HDA_CODEC_VOLUME("Speaker Playback Volume", 0x0d, 0x0, HDA_OUTPUT), |
| 6695 | HDA_BIND_MUTE("Speaker Playback Switch", 0x0d, 2, HDA_INPUT), |
| 6696 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), |
| 6697 | HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT), |
| 6698 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), |
| 6699 | HDA_CODEC_VOLUME("Int Mic Playback Volume", 0x0b, 0x1, HDA_INPUT), |
| 6700 | HDA_CODEC_VOLUME("Int Mic Boost", 0x19, 0, HDA_INPUT), |
| 6701 | HDA_CODEC_MUTE("Int Mic Playback Switch", 0x0b, 0x1, HDA_INPUT), |
| 6702 | HDA_CODEC_VOLUME("Capture Volume", 0x08, 0x0, HDA_INPUT), |
| 6703 | HDA_CODEC_MUTE("Capture Switch", 0x08, 0x0, HDA_INPUT), |
| 6704 | HDA_CODEC_VOLUME_IDX("Capture Volume", 1, 0x09, 0x0, HDA_INPUT), |
| 6705 | HDA_CODEC_MUTE_IDX("Capture Switch", 1, 0x09, 0x0, HDA_INPUT), |
| 6706 | { |
| 6707 | .iface = SNDRV_CTL_ELEM_IFACE_MIXER, |
| 6708 | /* .name = "Capture Source", */ |
| 6709 | .name = "Input Source", |
| 6710 | .count = 2, |
| 6711 | .info = alc883_mux_enum_info, |
| 6712 | .get = alc883_mux_enum_get, |
| 6713 | .put = alc883_mux_enum_put, |
| 6714 | }, |
| 6715 | { } /* end */ |
| 6716 | }; |
| 6717 | |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 6718 | static struct snd_kcontrol_new alc883_3ST_2ch_mixer[] = { |
| 6719 | HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT), |
| 6720 | HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT), |
| 6721 | HDA_CODEC_MUTE("Headphone Playback Switch", 0x1b, 0x0, HDA_OUTPUT), |
| 6722 | HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT), |
| 6723 | HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT), |
| 6724 | HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT), |
| 6725 | HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT), |
| 6726 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), |
Thomas De Schampheleire | 3236041 | 2007-01-24 16:13:35 +0100 | [diff] [blame] | 6727 | HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT), |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 6728 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), |
| 6729 | HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x1, HDA_INPUT), |
Thomas De Schampheleire | 3236041 | 2007-01-24 16:13:35 +0100 | [diff] [blame] | 6730 | HDA_CODEC_VOLUME("Front Mic Boost", 0x19, 0, HDA_INPUT), |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 6731 | HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x1, HDA_INPUT), |
| 6732 | HDA_CODEC_VOLUME("PC Speaker Playback Volume", 0x0b, 0x05, HDA_INPUT), |
| 6733 | HDA_CODEC_MUTE("PC Speaker Playback Switch", 0x0b, 0x05, HDA_INPUT), |
| 6734 | HDA_CODEC_VOLUME("Capture Volume", 0x08, 0x0, HDA_INPUT), |
| 6735 | HDA_CODEC_MUTE("Capture Switch", 0x08, 0x0, HDA_INPUT), |
| 6736 | HDA_CODEC_VOLUME_IDX("Capture Volume", 1, 0x09, 0x0, HDA_INPUT), |
| 6737 | HDA_CODEC_MUTE_IDX("Capture Switch", 1, 0x09, 0x0, HDA_INPUT), |
| 6738 | { |
| 6739 | .iface = SNDRV_CTL_ELEM_IFACE_MIXER, |
| 6740 | /* .name = "Capture Source", */ |
| 6741 | .name = "Input Source", |
| 6742 | .count = 2, |
| 6743 | .info = alc883_mux_enum_info, |
| 6744 | .get = alc883_mux_enum_get, |
| 6745 | .put = alc883_mux_enum_put, |
| 6746 | }, |
| 6747 | { } /* end */ |
| 6748 | }; |
| 6749 | |
| 6750 | static struct snd_kcontrol_new alc883_3ST_6ch_mixer[] = { |
| 6751 | HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT), |
| 6752 | HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT), |
| 6753 | HDA_CODEC_VOLUME("Surround Playback Volume", 0x0d, 0x0, HDA_OUTPUT), |
| 6754 | HDA_BIND_MUTE("Surround Playback Switch", 0x0d, 2, HDA_INPUT), |
| 6755 | HDA_CODEC_VOLUME_MONO("Center Playback Volume", 0x0e, 1, 0x0, HDA_OUTPUT), |
| 6756 | HDA_CODEC_VOLUME_MONO("LFE Playback Volume", 0x0e, 2, 0x0, HDA_OUTPUT), |
| 6757 | HDA_BIND_MUTE_MONO("Center Playback Switch", 0x0e, 1, 2, HDA_INPUT), |
| 6758 | HDA_BIND_MUTE_MONO("LFE Playback Switch", 0x0e, 2, 2, HDA_INPUT), |
| 6759 | HDA_CODEC_MUTE("Headphone Playback Switch", 0x1b, 0x0, HDA_OUTPUT), |
| 6760 | HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT), |
| 6761 | HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT), |
| 6762 | HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT), |
| 6763 | HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT), |
| 6764 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), |
Thomas De Schampheleire | 3236041 | 2007-01-24 16:13:35 +0100 | [diff] [blame] | 6765 | HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT), |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 6766 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), |
| 6767 | HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x1, HDA_INPUT), |
Thomas De Schampheleire | 3236041 | 2007-01-24 16:13:35 +0100 | [diff] [blame] | 6768 | HDA_CODEC_VOLUME("Front Mic Boost", 0x19, 0, HDA_INPUT), |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 6769 | HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x1, HDA_INPUT), |
| 6770 | HDA_CODEC_VOLUME("PC Speaker Playback Volume", 0x0b, 0x05, HDA_INPUT), |
| 6771 | HDA_CODEC_MUTE("PC Speaker Playback Switch", 0x0b, 0x05, HDA_INPUT), |
| 6772 | HDA_CODEC_VOLUME("Capture Volume", 0x08, 0x0, HDA_INPUT), |
| 6773 | HDA_CODEC_MUTE("Capture Switch", 0x08, 0x0, HDA_INPUT), |
| 6774 | HDA_CODEC_VOLUME_IDX("Capture Volume", 1, 0x09, 0x0, HDA_INPUT), |
| 6775 | HDA_CODEC_MUTE_IDX("Capture Switch", 1, 0x09, 0x0, HDA_INPUT), |
| 6776 | { |
| 6777 | .iface = SNDRV_CTL_ELEM_IFACE_MIXER, |
| 6778 | /* .name = "Capture Source", */ |
| 6779 | .name = "Input Source", |
| 6780 | .count = 2, |
| 6781 | .info = alc883_mux_enum_info, |
| 6782 | .get = alc883_mux_enum_get, |
| 6783 | .put = alc883_mux_enum_put, |
| 6784 | }, |
| 6785 | { } /* end */ |
| 6786 | }; |
| 6787 | |
Takashi Iwai | d1d985f | 2006-11-23 19:27:12 +0100 | [diff] [blame] | 6788 | static struct snd_kcontrol_new alc883_fivestack_mixer[] = { |
Tobin Davis | c07584c | 2006-10-13 12:32:16 +0200 | [diff] [blame] | 6789 | HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT), |
| 6790 | HDA_CODEC_MUTE("Front Playback Switch", 0x14, 0x0, HDA_OUTPUT), |
| 6791 | HDA_CODEC_VOLUME("Surround Playback Volume", 0x0d, 0x0, HDA_OUTPUT), |
| 6792 | HDA_CODEC_MUTE("Surround Playback Switch", 0x15, 0x0, HDA_OUTPUT), |
| 6793 | HDA_CODEC_VOLUME_MONO("Center Playback Volume", 0x0e, 1, 0x0, HDA_OUTPUT), |
| 6794 | HDA_CODEC_VOLUME_MONO("LFE Playback Volume", 0x0e, 2, 0x0, HDA_OUTPUT), |
| 6795 | HDA_CODEC_MUTE_MONO("Center Playback Switch", 0x16, 1, 0x0, HDA_OUTPUT), |
| 6796 | HDA_CODEC_MUTE_MONO("LFE Playback Switch", 0x16, 2, 0x0, HDA_OUTPUT), |
| 6797 | HDA_CODEC_MUTE("Headphone Playback Switch", 0x1b, 0x0, HDA_OUTPUT), |
| 6798 | HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT), |
| 6799 | HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT), |
| 6800 | HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT), |
| 6801 | HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT), |
| 6802 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), |
Thomas De Schampheleire | 3236041 | 2007-01-24 16:13:35 +0100 | [diff] [blame] | 6803 | HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT), |
Tobin Davis | c07584c | 2006-10-13 12:32:16 +0200 | [diff] [blame] | 6804 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), |
| 6805 | HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x1, HDA_INPUT), |
Thomas De Schampheleire | 3236041 | 2007-01-24 16:13:35 +0100 | [diff] [blame] | 6806 | HDA_CODEC_VOLUME("Front Mic Boost", 0x19, 0, HDA_INPUT), |
Tobin Davis | c07584c | 2006-10-13 12:32:16 +0200 | [diff] [blame] | 6807 | HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x1, HDA_INPUT), |
| 6808 | HDA_CODEC_VOLUME("PC Speaker Playback Volume", 0x0b, 0x05, HDA_INPUT), |
| 6809 | HDA_CODEC_MUTE("PC Speaker Playback Switch", 0x0b, 0x05, HDA_INPUT), |
| 6810 | HDA_CODEC_VOLUME("Capture Volume", 0x08, 0x0, HDA_INPUT), |
| 6811 | HDA_CODEC_MUTE("Capture Switch", 0x08, 0x0, HDA_INPUT), |
| 6812 | |
| 6813 | { |
| 6814 | .iface = SNDRV_CTL_ELEM_IFACE_MIXER, |
| 6815 | /* .name = "Capture Source", */ |
| 6816 | .name = "Input Source", |
| 6817 | .count = 1, |
| 6818 | .info = alc883_mux_enum_info, |
| 6819 | .get = alc883_mux_enum_get, |
| 6820 | .put = alc883_mux_enum_put, |
| 6821 | }, |
| 6822 | { } /* end */ |
| 6823 | }; |
| 6824 | |
Kailang Yang | ccc656c | 2006-10-17 12:32:26 +0200 | [diff] [blame] | 6825 | static struct snd_kcontrol_new alc883_tagra_mixer[] = { |
| 6826 | HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT), |
| 6827 | HDA_CODEC_MUTE("Headphone Playback Switch", 0x14, 0x0, HDA_OUTPUT), |
| 6828 | HDA_CODEC_MUTE("Front Playback Switch", 0x1b, 0x0, HDA_OUTPUT), |
| 6829 | HDA_CODEC_VOLUME("Surround Playback Volume", 0x0d, 0x0, HDA_OUTPUT), |
| 6830 | HDA_BIND_MUTE("Surround Playback Switch", 0x0d, 2, HDA_INPUT), |
| 6831 | HDA_CODEC_VOLUME_MONO("Center Playback Volume", 0x0e, 1, 0x0, HDA_OUTPUT), |
| 6832 | HDA_CODEC_VOLUME_MONO("LFE Playback Volume", 0x0e, 2, 0x0, HDA_OUTPUT), |
| 6833 | HDA_BIND_MUTE_MONO("Center Playback Switch", 0x0e, 1, 2, HDA_INPUT), |
| 6834 | HDA_BIND_MUTE_MONO("LFE Playback Switch", 0x0e, 2, 2, HDA_INPUT), |
| 6835 | HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT), |
| 6836 | HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT), |
| 6837 | HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT), |
| 6838 | HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT), |
| 6839 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), |
Thomas De Schampheleire | 3236041 | 2007-01-24 16:13:35 +0100 | [diff] [blame] | 6840 | HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT), |
Kailang Yang | ccc656c | 2006-10-17 12:32:26 +0200 | [diff] [blame] | 6841 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), |
| 6842 | HDA_CODEC_VOLUME("Capture Volume", 0x08, 0x0, HDA_INPUT), |
| 6843 | HDA_CODEC_MUTE("Capture Switch", 0x08, 0x0, HDA_INPUT), |
| 6844 | HDA_CODEC_VOLUME_IDX("Capture Volume", 1, 0x09, 0x0, HDA_INPUT), |
| 6845 | HDA_CODEC_MUTE_IDX("Capture Switch", 1, 0x09, 0x0, HDA_INPUT), |
| 6846 | { |
| 6847 | .iface = SNDRV_CTL_ELEM_IFACE_MIXER, |
| 6848 | /* .name = "Capture Source", */ |
| 6849 | .name = "Input Source", |
| 6850 | .count = 2, |
| 6851 | .info = alc883_mux_enum_info, |
| 6852 | .get = alc883_mux_enum_get, |
| 6853 | .put = alc883_mux_enum_put, |
| 6854 | }, |
| 6855 | { } /* end */ |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 6856 | }; |
Kailang Yang | ccc656c | 2006-10-17 12:32:26 +0200 | [diff] [blame] | 6857 | |
| 6858 | static struct snd_kcontrol_new alc883_tagra_2ch_mixer[] = { |
| 6859 | HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT), |
| 6860 | HDA_CODEC_MUTE("Headphone Playback Switch", 0x14, 0x0, HDA_OUTPUT), |
| 6861 | HDA_CODEC_MUTE("Front Playback Switch", 0x1b, 0x0, HDA_OUTPUT), |
| 6862 | HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT), |
| 6863 | HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT), |
| 6864 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), |
Thomas De Schampheleire | 3236041 | 2007-01-24 16:13:35 +0100 | [diff] [blame] | 6865 | HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT), |
Kailang Yang | ccc656c | 2006-10-17 12:32:26 +0200 | [diff] [blame] | 6866 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), |
| 6867 | HDA_CODEC_VOLUME("Capture Volume", 0x08, 0x0, HDA_INPUT), |
| 6868 | HDA_CODEC_MUTE("Capture Switch", 0x08, 0x0, HDA_INPUT), |
| 6869 | HDA_CODEC_VOLUME_IDX("Capture Volume", 1, 0x09, 0x0, HDA_INPUT), |
| 6870 | HDA_CODEC_MUTE_IDX("Capture Switch", 1, 0x09, 0x0, HDA_INPUT), |
| 6871 | { |
| 6872 | .iface = SNDRV_CTL_ELEM_IFACE_MIXER, |
| 6873 | /* .name = "Capture Source", */ |
| 6874 | .name = "Input Source", |
| 6875 | .count = 2, |
| 6876 | .info = alc883_mux_enum_info, |
| 6877 | .get = alc883_mux_enum_get, |
| 6878 | .put = alc883_mux_enum_put, |
| 6879 | }, |
| 6880 | { } /* end */ |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 6881 | }; |
Kailang Yang | ccc656c | 2006-10-17 12:32:26 +0200 | [diff] [blame] | 6882 | |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 6883 | static struct snd_kcontrol_new alc883_lenovo_101e_2ch_mixer[] = { |
| 6884 | HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT), |
| 6885 | HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT), |
Takashi Iwai | 86cd929 | 2008-01-28 18:09:56 +0100 | [diff] [blame] | 6886 | HDA_CODEC_VOLUME("Speaker Playback Volume", 0x0d, 0x0, HDA_OUTPUT), |
| 6887 | HDA_BIND_MUTE("Speaker Playback Switch", 0x0d, 2, HDA_INPUT), |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 6888 | HDA_CODEC_MUTE("Headphone Playback Switch", 0x1b, 0x0, HDA_OUTPUT), |
| 6889 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x1, HDA_INPUT), |
| 6890 | HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT), |
| 6891 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x1, HDA_INPUT), |
| 6892 | HDA_CODEC_VOLUME("Capture Volume", 0x08, 0x0, HDA_INPUT), |
| 6893 | HDA_CODEC_MUTE("Capture Switch", 0x08, 0x0, HDA_INPUT), |
| 6894 | { |
| 6895 | .iface = SNDRV_CTL_ELEM_IFACE_MIXER, |
| 6896 | /* .name = "Capture Source", */ |
| 6897 | .name = "Input Source", |
| 6898 | .count = 1, |
| 6899 | .info = alc883_mux_enum_info, |
| 6900 | .get = alc883_mux_enum_get, |
| 6901 | .put = alc883_mux_enum_put, |
| 6902 | }, |
| 6903 | { } /* end */ |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 6904 | }; |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 6905 | |
Kailang Yang | 272a527 | 2007-05-14 11:00:38 +0200 | [diff] [blame] | 6906 | static struct snd_kcontrol_new alc883_lenovo_nb0763_mixer[] = { |
| 6907 | HDA_CODEC_VOLUME("Speaker Playback Volume", 0x0c, 0x0, HDA_OUTPUT), |
| 6908 | HDA_BIND_MUTE("Speaker Playback Switch", 0x0c, 2, HDA_INPUT), |
| 6909 | HDA_CODEC_MUTE("Headphone Playback Switch", 0x14, 0x0, HDA_OUTPUT), |
| 6910 | HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT), |
| 6911 | HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT), |
| 6912 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), |
| 6913 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), |
| 6914 | HDA_CODEC_VOLUME("iMic Playback Volume", 0x0b, 0x1, HDA_INPUT), |
| 6915 | HDA_CODEC_MUTE("iMic Playback Switch", 0x0b, 0x1, HDA_INPUT), |
| 6916 | HDA_CODEC_VOLUME("Capture Volume", 0x08, 0x0, HDA_INPUT), |
| 6917 | HDA_CODEC_MUTE("Capture Switch", 0x08, 0x0, HDA_INPUT), |
| 6918 | HDA_CODEC_VOLUME_IDX("Capture Volume", 1, 0x09, 0x0, HDA_INPUT), |
| 6919 | HDA_CODEC_MUTE_IDX("Capture Switch", 1, 0x09, 0x0, HDA_INPUT), |
| 6920 | { |
| 6921 | .iface = SNDRV_CTL_ELEM_IFACE_MIXER, |
| 6922 | /* .name = "Capture Source", */ |
| 6923 | .name = "Input Source", |
| 6924 | .count = 2, |
| 6925 | .info = alc883_mux_enum_info, |
| 6926 | .get = alc883_mux_enum_get, |
| 6927 | .put = alc883_mux_enum_put, |
| 6928 | }, |
| 6929 | { } /* end */ |
| 6930 | }; |
| 6931 | |
| 6932 | static struct snd_kcontrol_new alc883_medion_md2_mixer[] = { |
| 6933 | HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT), |
| 6934 | HDA_CODEC_MUTE("Headphone Playback Switch", 0x14, 0x0, HDA_OUTPUT), |
| 6935 | HDA_CODEC_MUTE("Front Playback Switch", 0x15, 0x0, HDA_OUTPUT), |
| 6936 | HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT), |
| 6937 | HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT), |
| 6938 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), |
| 6939 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), |
| 6940 | HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT), |
| 6941 | HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT), |
| 6942 | HDA_CODEC_VOLUME("Capture Volume", 0x08, 0x0, HDA_INPUT), |
| 6943 | HDA_CODEC_MUTE("Capture Switch", 0x08, 0x0, HDA_INPUT), |
| 6944 | HDA_CODEC_VOLUME_IDX("Capture Volume", 1, 0x09, 0x0, HDA_INPUT), |
| 6945 | HDA_CODEC_MUTE_IDX("Capture Switch", 1, 0x09, 0x0, HDA_INPUT), |
| 6946 | { |
| 6947 | .iface = SNDRV_CTL_ELEM_IFACE_MIXER, |
| 6948 | /* .name = "Capture Source", */ |
| 6949 | .name = "Input Source", |
| 6950 | .count = 2, |
| 6951 | .info = alc883_mux_enum_info, |
| 6952 | .get = alc883_mux_enum_get, |
| 6953 | .put = alc883_mux_enum_put, |
| 6954 | }, |
| 6955 | { } /* end */ |
| 6956 | }; |
| 6957 | |
Claudio Matsuoka | 4723c02 | 2007-07-13 14:36:19 +0200 | [diff] [blame] | 6958 | static struct snd_kcontrol_new alc888_3st_hp_mixer[] = { |
Claudio Matsuoka | 8341de6 | 2007-07-06 12:10:45 +0200 | [diff] [blame] | 6959 | HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT), |
| 6960 | HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT), |
Herton Ronaldo Krzesinski | f32a19e | 2008-03-18 09:27:08 +0100 | [diff] [blame] | 6961 | HDA_CODEC_VOLUME("Surround Playback Volume", 0x0d, 0x0, HDA_OUTPUT), |
| 6962 | HDA_BIND_MUTE("Surround Playback Switch", 0x0d, 2, HDA_INPUT), |
| 6963 | HDA_CODEC_VOLUME_MONO("Center Playback Volume", 0x0e, 1, 0x0, HDA_OUTPUT), |
| 6964 | HDA_CODEC_VOLUME_MONO("LFE Playback Volume", 0x0e, 2, 0x0, HDA_OUTPUT), |
| 6965 | HDA_BIND_MUTE_MONO("Center Playback Switch", 0x0e, 1, 2, HDA_INPUT), |
| 6966 | HDA_BIND_MUTE_MONO("LFE Playback Switch", 0x0e, 2, 2, HDA_INPUT), |
Claudio Matsuoka | 8341de6 | 2007-07-06 12:10:45 +0200 | [diff] [blame] | 6967 | HDA_CODEC_MUTE("Headphone Playback Switch", 0x1b, 0x0, HDA_OUTPUT), |
| 6968 | HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT), |
| 6969 | HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT), |
| 6970 | HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT), |
| 6971 | HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT), |
| 6972 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), |
| 6973 | HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT), |
| 6974 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), |
| 6975 | HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x1, HDA_INPUT), |
| 6976 | HDA_CODEC_VOLUME("Front Mic Boost", 0x19, 0, HDA_INPUT), |
| 6977 | HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x1, HDA_INPUT), |
| 6978 | HDA_CODEC_VOLUME("PC Speaker Playback Volume", 0x0b, 0x05, HDA_INPUT), |
| 6979 | HDA_CODEC_MUTE("PC Speaker Playback Switch", 0x0b, 0x05, HDA_INPUT), |
| 6980 | HDA_CODEC_VOLUME("Capture Volume", 0x08, 0x0, HDA_INPUT), |
| 6981 | HDA_CODEC_MUTE("Capture Switch", 0x08, 0x0, HDA_INPUT), |
| 6982 | HDA_CODEC_VOLUME_IDX("Capture Volume", 1, 0x09, 0x0, HDA_INPUT), |
| 6983 | HDA_CODEC_MUTE_IDX("Capture Switch", 1, 0x09, 0x0, HDA_INPUT), |
| 6984 | { |
| 6985 | .iface = SNDRV_CTL_ELEM_IFACE_MIXER, |
| 6986 | /* .name = "Capture Source", */ |
| 6987 | .name = "Input Source", |
| 6988 | .count = 2, |
| 6989 | .info = alc883_mux_enum_info, |
| 6990 | .get = alc883_mux_enum_get, |
| 6991 | .put = alc883_mux_enum_put, |
| 6992 | }, |
| 6993 | { } /* end */ |
| 6994 | }; |
| 6995 | |
Claudio Matsuoka | 5795b9e | 2008-01-13 11:58:27 +0100 | [diff] [blame] | 6996 | static struct snd_kcontrol_new alc888_6st_dell_mixer[] = { |
| 6997 | HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT), |
| 6998 | HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT), |
Herton Ronaldo Krzesinski | f32a19e | 2008-03-18 09:27:08 +0100 | [diff] [blame] | 6999 | HDA_CODEC_VOLUME("Surround Playback Volume", 0x0d, 0x0, HDA_OUTPUT), |
| 7000 | HDA_BIND_MUTE("Surround Playback Switch", 0x0d, 2, HDA_INPUT), |
| 7001 | HDA_CODEC_VOLUME_MONO("Center Playback Volume", 0x0e, 1, 0x0, HDA_OUTPUT), |
| 7002 | HDA_CODEC_VOLUME_MONO("LFE Playback Volume", 0x0e, 2, 0x0, HDA_OUTPUT), |
| 7003 | HDA_BIND_MUTE_MONO("Center Playback Switch", 0x0e, 1, 2, HDA_INPUT), |
| 7004 | HDA_BIND_MUTE_MONO("LFE Playback Switch", 0x0e, 2, 2, HDA_INPUT), |
Claudio Matsuoka | 5795b9e | 2008-01-13 11:58:27 +0100 | [diff] [blame] | 7005 | HDA_CODEC_VOLUME("Side Playback Volume", 0x0f, 0x0, HDA_OUTPUT), |
| 7006 | HDA_BIND_MUTE("Side Playback Switch", 0x0f, 2, HDA_INPUT), |
| 7007 | HDA_CODEC_MUTE("Headphone Playback Switch", 0x1b, 0x0, HDA_OUTPUT), |
| 7008 | HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT), |
| 7009 | HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT), |
| 7010 | HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT), |
| 7011 | HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT), |
| 7012 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), |
| 7013 | HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT), |
| 7014 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), |
| 7015 | HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x1, HDA_INPUT), |
| 7016 | HDA_CODEC_VOLUME("Front Mic Boost", 0x19, 0, HDA_INPUT), |
| 7017 | HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x1, HDA_INPUT), |
| 7018 | HDA_CODEC_VOLUME("PC Speaker Playback Volume", 0x0b, 0x05, HDA_INPUT), |
| 7019 | HDA_CODEC_MUTE("PC Speaker Playback Switch", 0x0b, 0x05, HDA_INPUT), |
| 7020 | HDA_CODEC_VOLUME("Capture Volume", 0x08, 0x0, HDA_INPUT), |
| 7021 | HDA_CODEC_MUTE("Capture Switch", 0x08, 0x0, HDA_INPUT), |
| 7022 | HDA_CODEC_VOLUME_IDX("Capture Volume", 1, 0x09, 0x0, HDA_INPUT), |
| 7023 | HDA_CODEC_MUTE_IDX("Capture Switch", 1, 0x09, 0x0, HDA_INPUT), |
| 7024 | { |
| 7025 | .iface = SNDRV_CTL_ELEM_IFACE_MIXER, |
| 7026 | /* .name = "Capture Source", */ |
| 7027 | .name = "Input Source", |
| 7028 | .count = 2, |
| 7029 | .info = alc883_mux_enum_info, |
| 7030 | .get = alc883_mux_enum_get, |
| 7031 | .put = alc883_mux_enum_put, |
| 7032 | }, |
| 7033 | { } /* end */ |
| 7034 | }; |
| 7035 | |
Tobin Davis | 2880a86 | 2007-08-07 11:50:26 +0200 | [diff] [blame] | 7036 | static struct snd_kcontrol_new alc883_acer_aspire_mixer[] = { |
Kailang Yang | d1a991a | 2007-08-15 16:21:59 +0200 | [diff] [blame] | 7037 | HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT), |
| 7038 | HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT), |
Tobin Davis | 2880a86 | 2007-08-07 11:50:26 +0200 | [diff] [blame] | 7039 | HDA_CODEC_MUTE("Headphone Playback Switch", 0x14, 0x0, HDA_OUTPUT), |
Tobin Davis | 2880a86 | 2007-08-07 11:50:26 +0200 | [diff] [blame] | 7040 | HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT), |
| 7041 | HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT), |
Kailang Yang | d1a991a | 2007-08-15 16:21:59 +0200 | [diff] [blame] | 7042 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), |
| 7043 | HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT), |
| 7044 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), |
Tobin Davis | 2880a86 | 2007-08-07 11:50:26 +0200 | [diff] [blame] | 7045 | HDA_CODEC_VOLUME("Capture Volume", 0x08, 0x0, HDA_INPUT), |
| 7046 | HDA_CODEC_MUTE("Capture Switch", 0x08, 0x0, HDA_INPUT), |
| 7047 | HDA_CODEC_VOLUME_IDX("Capture Volume", 1, 0x09, 0x0, HDA_INPUT), |
| 7048 | HDA_CODEC_MUTE_IDX("Capture Switch", 1, 0x09, 0x0, HDA_INPUT), |
| 7049 | { |
| 7050 | .iface = SNDRV_CTL_ELEM_IFACE_MIXER, |
| 7051 | /* .name = "Capture Source", */ |
| 7052 | .name = "Input Source", |
| 7053 | .count = 2, |
| 7054 | .info = alc883_mux_enum_info, |
| 7055 | .get = alc883_mux_enum_get, |
| 7056 | .put = alc883_mux_enum_put, |
| 7057 | }, |
| 7058 | { } /* end */ |
Kailang Yang | d1a991a | 2007-08-15 16:21:59 +0200 | [diff] [blame] | 7059 | }; |
Tobin Davis | 2880a86 | 2007-08-07 11:50:26 +0200 | [diff] [blame] | 7060 | |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 7061 | static struct snd_kcontrol_new alc883_chmode_mixer[] = { |
| 7062 | { |
| 7063 | .iface = SNDRV_CTL_ELEM_IFACE_MIXER, |
| 7064 | .name = "Channel Mode", |
| 7065 | .info = alc_ch_mode_info, |
| 7066 | .get = alc_ch_mode_get, |
| 7067 | .put = alc_ch_mode_put, |
| 7068 | }, |
| 7069 | { } /* end */ |
| 7070 | }; |
| 7071 | |
| 7072 | static struct hda_verb alc883_init_verbs[] = { |
| 7073 | /* ADC1: mute amp left and right */ |
| 7074 | {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 7075 | {0x08, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 7076 | /* ADC2: mute amp left and right */ |
| 7077 | {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 7078 | {0x09, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 7079 | /* Front mixer: unmute input/output amp left and right (volume = 0) */ |
| 7080 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 7081 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 7082 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
| 7083 | /* Rear mixer */ |
| 7084 | {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 7085 | {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 7086 | {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
| 7087 | /* CLFE mixer */ |
| 7088 | {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 7089 | {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 7090 | {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
| 7091 | /* Side mixer */ |
| 7092 | {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 7093 | {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 7094 | {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
| 7095 | |
Takashi Iwai | cb53c62 | 2007-08-10 17:21:45 +0200 | [diff] [blame] | 7096 | /* mute analog input loopbacks */ |
| 7097 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 7098 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
| 7099 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)}, |
| 7100 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)}, |
| 7101 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)}, |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 7102 | |
| 7103 | /* Front Pin: output 0 (0x0c) */ |
| 7104 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 7105 | {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 7106 | {0x14, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 7107 | /* Rear Pin: output 1 (0x0d) */ |
| 7108 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 7109 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 7110 | {0x15, AC_VERB_SET_CONNECT_SEL, 0x01}, |
| 7111 | /* CLFE Pin: output 2 (0x0e) */ |
| 7112 | {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 7113 | {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 7114 | {0x16, AC_VERB_SET_CONNECT_SEL, 0x02}, |
| 7115 | /* Side Pin: output 3 (0x0f) */ |
| 7116 | {0x17, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 7117 | {0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 7118 | {0x17, AC_VERB_SET_CONNECT_SEL, 0x03}, |
| 7119 | /* Mic (rear) pin: input vref at 80% */ |
| 7120 | {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80}, |
| 7121 | {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
| 7122 | /* Front Mic pin: input vref at 80% */ |
| 7123 | {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80}, |
| 7124 | {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
| 7125 | /* Line In pin: input */ |
| 7126 | {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
| 7127 | {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
| 7128 | /* Line-2 In: Headphone output (output 0 - 0x0c) */ |
| 7129 | {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 7130 | {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 7131 | {0x1b, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 7132 | /* CD pin widget for input */ |
| 7133 | {0x1c, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
| 7134 | |
| 7135 | /* FIXME: use matrix-type input source selection */ |
| 7136 | /* Mixer elements: 0x18, 19, 1a, 1b, 1c, 1d, 14, 15, 16, 17, 0b */ |
| 7137 | /* Input mixer2 */ |
| 7138 | {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 7139 | {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 7140 | {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(2)}, |
| 7141 | {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(4)}, |
| 7142 | /* Input mixer3 */ |
| 7143 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 7144 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 7145 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(2)}, |
| 7146 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(4)}, |
| 7147 | { } |
| 7148 | }; |
| 7149 | |
Andy Shevchenko | a8848bd | 2007-12-13 17:32:26 +0100 | [diff] [blame] | 7150 | /* toggle speaker-output according to the hp-jack state */ |
| 7151 | static void alc883_mitac_hp_automute(struct hda_codec *codec) |
| 7152 | { |
| 7153 | unsigned int present; |
| 7154 | |
| 7155 | present = snd_hda_codec_read(codec, 0x15, 0, |
| 7156 | AC_VERB_GET_PIN_SENSE, 0) & 0x80000000; |
| 7157 | snd_hda_codec_amp_stereo(codec, 0x14, HDA_OUTPUT, 0, |
| 7158 | HDA_AMP_MUTE, present ? HDA_AMP_MUTE : 0); |
| 7159 | snd_hda_codec_amp_stereo(codec, 0x17, HDA_OUTPUT, 0, |
| 7160 | HDA_AMP_MUTE, present ? HDA_AMP_MUTE : 0); |
| 7161 | } |
| 7162 | |
| 7163 | /* auto-toggle front mic */ |
| 7164 | /* |
| 7165 | static void alc883_mitac_mic_automute(struct hda_codec *codec) |
| 7166 | { |
| 7167 | unsigned int present; |
| 7168 | unsigned char bits; |
| 7169 | |
| 7170 | present = snd_hda_codec_read(codec, 0x18, 0, |
| 7171 | AC_VERB_GET_PIN_SENSE, 0) & 0x80000000; |
| 7172 | bits = present ? HDA_AMP_MUTE : 0; |
| 7173 | snd_hda_codec_amp_stereo(codec, 0x0b, HDA_INPUT, 1, HDA_AMP_MUTE, bits); |
| 7174 | } |
| 7175 | */ |
| 7176 | |
| 7177 | static void alc883_mitac_automute(struct hda_codec *codec) |
| 7178 | { |
| 7179 | alc883_mitac_hp_automute(codec); |
| 7180 | /* alc883_mitac_mic_automute(codec); */ |
| 7181 | } |
| 7182 | |
| 7183 | static void alc883_mitac_unsol_event(struct hda_codec *codec, |
| 7184 | unsigned int res) |
| 7185 | { |
| 7186 | switch (res >> 26) { |
| 7187 | case ALC880_HP_EVENT: |
| 7188 | alc883_mitac_hp_automute(codec); |
| 7189 | break; |
| 7190 | case ALC880_MIC_EVENT: |
| 7191 | /* alc883_mitac_mic_automute(codec); */ |
| 7192 | break; |
| 7193 | } |
| 7194 | } |
| 7195 | |
| 7196 | static struct hda_verb alc883_mitac_verbs[] = { |
| 7197 | /* HP */ |
| 7198 | {0x15, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 7199 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 7200 | /* Subwoofer */ |
| 7201 | {0x17, AC_VERB_SET_CONNECT_SEL, 0x02}, |
| 7202 | {0x17, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 7203 | |
| 7204 | /* enable unsolicited event */ |
| 7205 | {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN}, |
| 7206 | /* {0x18, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_MIC_EVENT | AC_USRSP_EN}, */ |
| 7207 | |
| 7208 | { } /* end */ |
| 7209 | }; |
| 7210 | |
Jiang zhe | 368c7a9 | 2008-03-04 11:20:33 +0100 | [diff] [blame] | 7211 | static struct hda_verb alc883_clevo_m720r_verbs[] = { |
| 7212 | /* HP */ |
| 7213 | {0x15, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 7214 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 7215 | /* Int speaker */ |
| 7216 | {0x14, AC_VERB_SET_CONNECT_SEL, 0x01}, |
| 7217 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 7218 | |
| 7219 | /* enable unsolicited event */ |
| 7220 | {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN}, |
| 7221 | |
| 7222 | { } /* end */ |
| 7223 | }; |
| 7224 | |
Jiang zhe | fb97dc6 | 2008-03-06 11:07:11 +0100 | [diff] [blame] | 7225 | static struct hda_verb alc883_2ch_fujitsu_pi2515_verbs[] = { |
| 7226 | /* HP */ |
| 7227 | {0x14, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 7228 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 7229 | /* Subwoofer */ |
| 7230 | {0x15, AC_VERB_SET_CONNECT_SEL, 0x01}, |
| 7231 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 7232 | |
| 7233 | /* enable unsolicited event */ |
| 7234 | {0x14, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN}, |
| 7235 | |
| 7236 | { } /* end */ |
| 7237 | }; |
| 7238 | |
Kailang Yang | ccc656c | 2006-10-17 12:32:26 +0200 | [diff] [blame] | 7239 | static struct hda_verb alc883_tagra_verbs[] = { |
| 7240 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 7241 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 7242 | |
| 7243 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 7244 | {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 7245 | |
| 7246 | {0x18, AC_VERB_SET_CONNECT_SEL, 0x02}, /* mic/clfe */ |
| 7247 | {0x1a, AC_VERB_SET_CONNECT_SEL, 0x01}, /* line/surround */ |
| 7248 | {0x1b, AC_VERB_SET_CONNECT_SEL, 0x00}, /* HP */ |
| 7249 | |
| 7250 | {0x14, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN}, |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 7251 | {0x01, AC_VERB_SET_GPIO_MASK, 0x03}, |
| 7252 | {0x01, AC_VERB_SET_GPIO_DIRECTION, 0x03}, |
| 7253 | {0x01, AC_VERB_SET_GPIO_DATA, 0x03}, |
Kailang Yang | ccc656c | 2006-10-17 12:32:26 +0200 | [diff] [blame] | 7254 | |
| 7255 | { } /* end */ |
| 7256 | }; |
| 7257 | |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 7258 | static struct hda_verb alc883_lenovo_101e_verbs[] = { |
| 7259 | {0x15, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 7260 | {0x14, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_FRONT_EVENT|AC_USRSP_EN}, |
| 7261 | {0x1b, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT|AC_USRSP_EN}, |
| 7262 | { } /* end */ |
| 7263 | }; |
| 7264 | |
Kailang Yang | 272a527 | 2007-05-14 11:00:38 +0200 | [diff] [blame] | 7265 | static struct hda_verb alc883_lenovo_nb0763_verbs[] = { |
| 7266 | {0x15, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 7267 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 7268 | {0x14, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN}, |
| 7269 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 7270 | { } /* end */ |
| 7271 | }; |
| 7272 | |
| 7273 | static struct hda_verb alc888_lenovo_ms7195_verbs[] = { |
| 7274 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 7275 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 7276 | {0x15, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 7277 | {0x14, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_FRONT_EVENT | AC_USRSP_EN}, |
| 7278 | {0x1b, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN}, |
| 7279 | { } /* end */ |
| 7280 | }; |
| 7281 | |
Kailang Yang | 189609a | 2007-08-20 11:31:23 +0200 | [diff] [blame] | 7282 | static struct hda_verb alc883_haier_w66_verbs[] = { |
| 7283 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 7284 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 7285 | |
| 7286 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 7287 | |
| 7288 | {0x1b, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 7289 | {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 7290 | {0x1b, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN}, |
| 7291 | {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 7292 | { } /* end */ |
| 7293 | }; |
| 7294 | |
Claudio Matsuoka | 4723c02 | 2007-07-13 14:36:19 +0200 | [diff] [blame] | 7295 | static struct hda_verb alc888_3st_hp_verbs[] = { |
Claudio Matsuoka | 8341de6 | 2007-07-06 12:10:45 +0200 | [diff] [blame] | 7296 | {0x14, AC_VERB_SET_CONNECT_SEL, 0x00}, /* Front: output 0 (0x0c) */ |
Herton Ronaldo Krzesinski | f32a19e | 2008-03-18 09:27:08 +0100 | [diff] [blame] | 7297 | {0x16, AC_VERB_SET_CONNECT_SEL, 0x01}, /* Rear : output 1 (0x0d) */ |
| 7298 | {0x18, AC_VERB_SET_CONNECT_SEL, 0x02}, /* CLFE : output 2 (0x0e) */ |
Claudio Matsuoka | 8341de6 | 2007-07-06 12:10:45 +0200 | [diff] [blame] | 7299 | { } |
| 7300 | }; |
| 7301 | |
Claudio Matsuoka | 5795b9e | 2008-01-13 11:58:27 +0100 | [diff] [blame] | 7302 | static struct hda_verb alc888_6st_dell_verbs[] = { |
Claudio Matsuoka | 5795b9e | 2008-01-13 11:58:27 +0100 | [diff] [blame] | 7303 | {0x1b, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN}, |
| 7304 | { } |
| 7305 | }; |
| 7306 | |
Claudio Matsuoka | 4723c02 | 2007-07-13 14:36:19 +0200 | [diff] [blame] | 7307 | static struct hda_verb alc888_3st_hp_2ch_init[] = { |
Claudio Matsuoka | 8341de6 | 2007-07-06 12:10:45 +0200 | [diff] [blame] | 7308 | { 0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80 }, |
| 7309 | { 0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE }, |
| 7310 | { 0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN }, |
| 7311 | { 0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE }, |
| 7312 | { } |
| 7313 | }; |
| 7314 | |
Claudio Matsuoka | 4723c02 | 2007-07-13 14:36:19 +0200 | [diff] [blame] | 7315 | static struct hda_verb alc888_3st_hp_6ch_init[] = { |
Claudio Matsuoka | 8341de6 | 2007-07-06 12:10:45 +0200 | [diff] [blame] | 7316 | { 0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, |
| 7317 | { 0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE }, |
| 7318 | { 0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, |
| 7319 | { 0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE }, |
| 7320 | { } |
| 7321 | }; |
| 7322 | |
Claudio Matsuoka | 4723c02 | 2007-07-13 14:36:19 +0200 | [diff] [blame] | 7323 | static struct hda_channel_mode alc888_3st_hp_modes[2] = { |
| 7324 | { 2, alc888_3st_hp_2ch_init }, |
| 7325 | { 6, alc888_3st_hp_6ch_init }, |
Claudio Matsuoka | 8341de6 | 2007-07-06 12:10:45 +0200 | [diff] [blame] | 7326 | }; |
| 7327 | |
Kailang Yang | 272a527 | 2007-05-14 11:00:38 +0200 | [diff] [blame] | 7328 | /* toggle front-jack and RCA according to the hp-jack state */ |
| 7329 | static void alc888_lenovo_ms7195_front_automute(struct hda_codec *codec) |
| 7330 | { |
| 7331 | unsigned int present; |
| 7332 | |
| 7333 | present = snd_hda_codec_read(codec, 0x1b, 0, |
| 7334 | AC_VERB_GET_PIN_SENSE, 0) & 0x80000000; |
Takashi Iwai | 47fd830 | 2007-08-10 17:11:07 +0200 | [diff] [blame] | 7335 | snd_hda_codec_amp_stereo(codec, 0x14, HDA_OUTPUT, 0, |
| 7336 | HDA_AMP_MUTE, present ? HDA_AMP_MUTE : 0); |
| 7337 | snd_hda_codec_amp_stereo(codec, 0x15, HDA_OUTPUT, 0, |
| 7338 | HDA_AMP_MUTE, present ? HDA_AMP_MUTE : 0); |
Kailang Yang | 272a527 | 2007-05-14 11:00:38 +0200 | [diff] [blame] | 7339 | } |
| 7340 | |
| 7341 | /* toggle RCA according to the front-jack state */ |
| 7342 | static void alc888_lenovo_ms7195_rca_automute(struct hda_codec *codec) |
| 7343 | { |
| 7344 | unsigned int present; |
| 7345 | |
| 7346 | present = snd_hda_codec_read(codec, 0x14, 0, |
| 7347 | AC_VERB_GET_PIN_SENSE, 0) & 0x80000000; |
Takashi Iwai | 47fd830 | 2007-08-10 17:11:07 +0200 | [diff] [blame] | 7348 | snd_hda_codec_amp_stereo(codec, 0x15, HDA_OUTPUT, 0, |
| 7349 | HDA_AMP_MUTE, present ? HDA_AMP_MUTE : 0); |
Kailang Yang | 272a527 | 2007-05-14 11:00:38 +0200 | [diff] [blame] | 7350 | } |
Takashi Iwai | 47fd830 | 2007-08-10 17:11:07 +0200 | [diff] [blame] | 7351 | |
Kailang Yang | 272a527 | 2007-05-14 11:00:38 +0200 | [diff] [blame] | 7352 | static void alc883_lenovo_ms7195_unsol_event(struct hda_codec *codec, |
| 7353 | unsigned int res) |
| 7354 | { |
| 7355 | if ((res >> 26) == ALC880_HP_EVENT) |
| 7356 | alc888_lenovo_ms7195_front_automute(codec); |
| 7357 | if ((res >> 26) == ALC880_FRONT_EVENT) |
| 7358 | alc888_lenovo_ms7195_rca_automute(codec); |
| 7359 | } |
| 7360 | |
| 7361 | static struct hda_verb alc883_medion_md2_verbs[] = { |
| 7362 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 7363 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 7364 | |
| 7365 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 7366 | |
| 7367 | {0x14, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN}, |
| 7368 | { } /* end */ |
| 7369 | }; |
| 7370 | |
| 7371 | /* toggle speaker-output according to the hp-jack state */ |
| 7372 | static void alc883_medion_md2_automute(struct hda_codec *codec) |
| 7373 | { |
| 7374 | unsigned int present; |
| 7375 | |
| 7376 | present = snd_hda_codec_read(codec, 0x14, 0, |
| 7377 | AC_VERB_GET_PIN_SENSE, 0) & 0x80000000; |
Takashi Iwai | 47fd830 | 2007-08-10 17:11:07 +0200 | [diff] [blame] | 7378 | snd_hda_codec_amp_stereo(codec, 0x15, HDA_OUTPUT, 0, |
| 7379 | HDA_AMP_MUTE, present ? HDA_AMP_MUTE : 0); |
Kailang Yang | 272a527 | 2007-05-14 11:00:38 +0200 | [diff] [blame] | 7380 | } |
| 7381 | |
| 7382 | static void alc883_medion_md2_unsol_event(struct hda_codec *codec, |
| 7383 | unsigned int res) |
| 7384 | { |
| 7385 | if ((res >> 26) == ALC880_HP_EVENT) |
| 7386 | alc883_medion_md2_automute(codec); |
| 7387 | } |
| 7388 | |
Kailang Yang | ccc656c | 2006-10-17 12:32:26 +0200 | [diff] [blame] | 7389 | /* toggle speaker-output according to the hp-jack state */ |
| 7390 | static void alc883_tagra_automute(struct hda_codec *codec) |
| 7391 | { |
| 7392 | unsigned int present; |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 7393 | unsigned char bits; |
Kailang Yang | ccc656c | 2006-10-17 12:32:26 +0200 | [diff] [blame] | 7394 | |
| 7395 | present = snd_hda_codec_read(codec, 0x14, 0, |
| 7396 | AC_VERB_GET_PIN_SENSE, 0) & 0x80000000; |
Takashi Iwai | 47fd830 | 2007-08-10 17:11:07 +0200 | [diff] [blame] | 7397 | bits = present ? HDA_AMP_MUTE : 0; |
| 7398 | snd_hda_codec_amp_stereo(codec, 0x1b, HDA_OUTPUT, 0, |
| 7399 | HDA_AMP_MUTE, bits); |
Takashi Iwai | 82beb8f | 2007-08-10 17:09:26 +0200 | [diff] [blame] | 7400 | snd_hda_codec_write_cache(codec, 1, 0, AC_VERB_SET_GPIO_DATA, |
| 7401 | present ? 1 : 3); |
Kailang Yang | ccc656c | 2006-10-17 12:32:26 +0200 | [diff] [blame] | 7402 | } |
| 7403 | |
| 7404 | static void alc883_tagra_unsol_event(struct hda_codec *codec, unsigned int res) |
| 7405 | { |
| 7406 | if ((res >> 26) == ALC880_HP_EVENT) |
| 7407 | alc883_tagra_automute(codec); |
| 7408 | } |
| 7409 | |
Jiang zhe | 368c7a9 | 2008-03-04 11:20:33 +0100 | [diff] [blame] | 7410 | /* toggle speaker-output according to the hp-jack state */ |
| 7411 | static void alc883_clevo_m720r_automute(struct hda_codec *codec) |
| 7412 | { |
| 7413 | unsigned int present; |
| 7414 | unsigned char bits; |
| 7415 | |
| 7416 | present = snd_hda_codec_read(codec, 0x15, 0, AC_VERB_GET_PIN_SENSE, 0) |
| 7417 | & AC_PINSENSE_PRESENCE; |
| 7418 | bits = present ? HDA_AMP_MUTE : 0; |
| 7419 | snd_hda_codec_amp_stereo(codec, 0x14, HDA_OUTPUT, 0, |
| 7420 | HDA_AMP_MUTE, bits); |
| 7421 | } |
| 7422 | |
| 7423 | static void alc883_clevo_m720r_unsol_event(struct hda_codec *codec, |
| 7424 | unsigned int res) |
| 7425 | { |
| 7426 | if ((res >> 26) == ALC880_HP_EVENT) |
| 7427 | alc883_clevo_m720r_automute(codec); |
| 7428 | } |
| 7429 | |
Jiang zhe | fb97dc6 | 2008-03-06 11:07:11 +0100 | [diff] [blame] | 7430 | /* toggle speaker-output according to the hp-jack state */ |
| 7431 | static void alc883_2ch_fujitsu_pi2515_automute(struct hda_codec *codec) |
| 7432 | { |
| 7433 | unsigned int present; |
| 7434 | unsigned char bits; |
| 7435 | |
| 7436 | present = snd_hda_codec_read(codec, 0x14, 0, AC_VERB_GET_PIN_SENSE, 0) |
| 7437 | & AC_PINSENSE_PRESENCE; |
| 7438 | bits = present ? HDA_AMP_MUTE : 0; |
| 7439 | snd_hda_codec_amp_stereo(codec, 0x15, HDA_OUTPUT, 0, |
| 7440 | HDA_AMP_MUTE, bits); |
| 7441 | } |
| 7442 | |
| 7443 | static void alc883_2ch_fujitsu_pi2515_unsol_event(struct hda_codec *codec, |
| 7444 | unsigned int res) |
| 7445 | { |
| 7446 | if ((res >> 26) == ALC880_HP_EVENT) |
| 7447 | alc883_2ch_fujitsu_pi2515_automute(codec); |
| 7448 | } |
| 7449 | |
Kailang Yang | 189609a | 2007-08-20 11:31:23 +0200 | [diff] [blame] | 7450 | static void alc883_haier_w66_automute(struct hda_codec *codec) |
| 7451 | { |
| 7452 | unsigned int present; |
| 7453 | unsigned char bits; |
| 7454 | |
| 7455 | present = snd_hda_codec_read(codec, 0x1b, 0, |
| 7456 | AC_VERB_GET_PIN_SENSE, 0) & 0x80000000; |
| 7457 | bits = present ? 0x80 : 0; |
| 7458 | snd_hda_codec_amp_stereo(codec, 0x14, HDA_OUTPUT, 0, |
| 7459 | 0x80, bits); |
| 7460 | } |
| 7461 | |
| 7462 | static void alc883_haier_w66_unsol_event(struct hda_codec *codec, |
| 7463 | unsigned int res) |
| 7464 | { |
| 7465 | if ((res >> 26) == ALC880_HP_EVENT) |
| 7466 | alc883_haier_w66_automute(codec); |
| 7467 | } |
| 7468 | |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 7469 | static void alc883_lenovo_101e_ispeaker_automute(struct hda_codec *codec) |
| 7470 | { |
| 7471 | unsigned int present; |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 7472 | unsigned char bits; |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 7473 | |
| 7474 | present = snd_hda_codec_read(codec, 0x14, 0, |
| 7475 | AC_VERB_GET_PIN_SENSE, 0) & 0x80000000; |
Takashi Iwai | 47fd830 | 2007-08-10 17:11:07 +0200 | [diff] [blame] | 7476 | bits = present ? HDA_AMP_MUTE : 0; |
| 7477 | snd_hda_codec_amp_stereo(codec, 0x15, HDA_OUTPUT, 0, |
| 7478 | HDA_AMP_MUTE, bits); |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 7479 | } |
| 7480 | |
| 7481 | static void alc883_lenovo_101e_all_automute(struct hda_codec *codec) |
| 7482 | { |
| 7483 | unsigned int present; |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 7484 | unsigned char bits; |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 7485 | |
| 7486 | present = snd_hda_codec_read(codec, 0x1b, 0, |
| 7487 | AC_VERB_GET_PIN_SENSE, 0) & 0x80000000; |
Takashi Iwai | 47fd830 | 2007-08-10 17:11:07 +0200 | [diff] [blame] | 7488 | bits = present ? HDA_AMP_MUTE : 0; |
| 7489 | snd_hda_codec_amp_stereo(codec, 0x15, HDA_OUTPUT, 0, |
| 7490 | HDA_AMP_MUTE, bits); |
| 7491 | snd_hda_codec_amp_stereo(codec, 0x14, HDA_OUTPUT, 0, |
| 7492 | HDA_AMP_MUTE, bits); |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 7493 | } |
| 7494 | |
| 7495 | static void alc883_lenovo_101e_unsol_event(struct hda_codec *codec, |
| 7496 | unsigned int res) |
| 7497 | { |
| 7498 | if ((res >> 26) == ALC880_HP_EVENT) |
| 7499 | alc883_lenovo_101e_all_automute(codec); |
| 7500 | if ((res >> 26) == ALC880_FRONT_EVENT) |
| 7501 | alc883_lenovo_101e_ispeaker_automute(codec); |
| 7502 | } |
| 7503 | |
Takashi Iwai | 676a9b5 | 2007-08-16 15:23:35 +0200 | [diff] [blame] | 7504 | /* toggle speaker-output according to the hp-jack state */ |
| 7505 | static void alc883_acer_aspire_automute(struct hda_codec *codec) |
| 7506 | { |
| 7507 | unsigned int present; |
| 7508 | |
| 7509 | present = snd_hda_codec_read(codec, 0x14, 0, |
| 7510 | AC_VERB_GET_PIN_SENSE, 0) & 0x80000000; |
| 7511 | snd_hda_codec_amp_stereo(codec, 0x15, HDA_OUTPUT, 0, |
| 7512 | HDA_AMP_MUTE, present ? HDA_AMP_MUTE : 0); |
| 7513 | snd_hda_codec_amp_stereo(codec, 0x16, HDA_OUTPUT, 0, |
| 7514 | HDA_AMP_MUTE, present ? HDA_AMP_MUTE : 0); |
| 7515 | } |
| 7516 | |
| 7517 | static void alc883_acer_aspire_unsol_event(struct hda_codec *codec, |
| 7518 | unsigned int res) |
| 7519 | { |
| 7520 | if ((res >> 26) == ALC880_HP_EVENT) |
| 7521 | alc883_acer_aspire_automute(codec); |
| 7522 | } |
| 7523 | |
Kailang Yang | d1a991a | 2007-08-15 16:21:59 +0200 | [diff] [blame] | 7524 | static struct hda_verb alc883_acer_eapd_verbs[] = { |
| 7525 | /* HP Pin: output 0 (0x0c) */ |
| 7526 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 7527 | {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 7528 | {0x14, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 7529 | /* Front Pin: output 0 (0x0c) */ |
Takashi Iwai | 676a9b5 | 2007-08-16 15:23:35 +0200 | [diff] [blame] | 7530 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 7531 | {0x15, AC_VERB_SET_CONNECT_SEL, 0x00}, |
Kailang Yang | d1a991a | 2007-08-15 16:21:59 +0200 | [diff] [blame] | 7532 | {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
Kailang Yang | d1a991a | 2007-08-15 16:21:59 +0200 | [diff] [blame] | 7533 | {0x16, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 7534 | /* eanable EAPD on medion laptop */ |
| 7535 | {0x20, AC_VERB_SET_COEF_INDEX, 0x07}, |
| 7536 | {0x20, AC_VERB_SET_PROC_COEF, 0x3050}, |
Takashi Iwai | 676a9b5 | 2007-08-16 15:23:35 +0200 | [diff] [blame] | 7537 | /* enable unsolicited event */ |
| 7538 | {0x14, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN}, |
Kailang Yang | d1a991a | 2007-08-15 16:21:59 +0200 | [diff] [blame] | 7539 | { } |
| 7540 | }; |
| 7541 | |
Claudio Matsuoka | 5795b9e | 2008-01-13 11:58:27 +0100 | [diff] [blame] | 7542 | static void alc888_6st_dell_front_automute(struct hda_codec *codec) |
| 7543 | { |
| 7544 | unsigned int present; |
| 7545 | |
| 7546 | present = snd_hda_codec_read(codec, 0x1b, 0, |
| 7547 | AC_VERB_GET_PIN_SENSE, 0) & 0x80000000; |
| 7548 | snd_hda_codec_amp_stereo(codec, 0x14, HDA_OUTPUT, 0, |
| 7549 | HDA_AMP_MUTE, present ? HDA_AMP_MUTE : 0); |
| 7550 | snd_hda_codec_amp_stereo(codec, 0x15, HDA_OUTPUT, 0, |
| 7551 | HDA_AMP_MUTE, present ? HDA_AMP_MUTE : 0); |
| 7552 | snd_hda_codec_amp_stereo(codec, 0x16, HDA_OUTPUT, 0, |
| 7553 | HDA_AMP_MUTE, present ? HDA_AMP_MUTE : 0); |
| 7554 | snd_hda_codec_amp_stereo(codec, 0x17, HDA_OUTPUT, 0, |
| 7555 | HDA_AMP_MUTE, present ? HDA_AMP_MUTE : 0); |
| 7556 | } |
| 7557 | |
| 7558 | static void alc888_6st_dell_unsol_event(struct hda_codec *codec, |
| 7559 | unsigned int res) |
| 7560 | { |
| 7561 | switch (res >> 26) { |
| 7562 | case ALC880_HP_EVENT: |
| 7563 | printk("hp_event\n"); |
| 7564 | alc888_6st_dell_front_automute(codec); |
| 7565 | break; |
| 7566 | } |
| 7567 | } |
| 7568 | |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 7569 | /* |
| 7570 | * generic initialization of ADC, input mixers and output mixers |
| 7571 | */ |
| 7572 | static struct hda_verb alc883_auto_init_verbs[] = { |
| 7573 | /* |
| 7574 | * Unmute ADC0-2 and set the default input to mic-in |
| 7575 | */ |
| 7576 | {0x08, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 7577 | {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 7578 | {0x09, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 7579 | {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 7580 | |
Takashi Iwai | cb53c62 | 2007-08-10 17:21:45 +0200 | [diff] [blame] | 7581 | /* Mute input amps (CD, Line In, Mic 1 & Mic 2) of the analog-loopback |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 7582 | * mixer widget |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 7583 | * Note: PASD motherboards uses the Line In 2 as the input for |
| 7584 | * front panel mic (mic 2) |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 7585 | */ |
| 7586 | /* Amp Indices: Mic1 = 0, Mic2 = 1, Line1 = 2, Line2 = 3, CD = 4 */ |
Takashi Iwai | cb53c62 | 2007-08-10 17:21:45 +0200 | [diff] [blame] | 7587 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 7588 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
| 7589 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)}, |
| 7590 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)}, |
| 7591 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)}, |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 7592 | |
| 7593 | /* |
| 7594 | * Set up output mixers (0x0c - 0x0f) |
| 7595 | */ |
| 7596 | /* set vol=0 to output mixers */ |
| 7597 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 7598 | {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 7599 | {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 7600 | {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 7601 | /* set up input amps for analog loopback */ |
| 7602 | /* Amp Indices: DAC = 0, mixer = 1 */ |
| 7603 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 7604 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 7605 | {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 7606 | {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 7607 | {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 7608 | {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 7609 | {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 7610 | {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 7611 | {0x26, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 7612 | {0x26, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 7613 | |
| 7614 | /* FIXME: use matrix-type input source selection */ |
| 7615 | /* Mixer elements: 0x18, 19, 1a, 1b, 1c, 1d, 14, 15, 16, 17, 0b */ |
| 7616 | /* Input mixer1 */ |
| 7617 | {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 7618 | {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 7619 | {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(2)}, |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 7620 | /* {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(3)}, */ |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 7621 | {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(4)}, |
| 7622 | /* Input mixer2 */ |
| 7623 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 7624 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 7625 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(2)}, |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 7626 | /* {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(3)}, */ |
Andy Shevchenko | e3cde64 | 2007-12-03 16:50:58 +0100 | [diff] [blame] | 7627 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(4)}, |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 7628 | |
| 7629 | { } |
| 7630 | }; |
| 7631 | |
| 7632 | /* capture mixer elements */ |
| 7633 | static struct snd_kcontrol_new alc883_capture_mixer[] = { |
| 7634 | HDA_CODEC_VOLUME("Capture Volume", 0x08, 0x0, HDA_INPUT), |
| 7635 | HDA_CODEC_MUTE("Capture Switch", 0x08, 0x0, HDA_INPUT), |
| 7636 | HDA_CODEC_VOLUME_IDX("Capture Volume", 1, 0x09, 0x0, HDA_INPUT), |
| 7637 | HDA_CODEC_MUTE_IDX("Capture Switch", 1, 0x09, 0x0, HDA_INPUT), |
| 7638 | { |
| 7639 | .iface = SNDRV_CTL_ELEM_IFACE_MIXER, |
| 7640 | /* The multiple "Capture Source" controls confuse alsamixer |
| 7641 | * So call somewhat different.. |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 7642 | */ |
| 7643 | /* .name = "Capture Source", */ |
| 7644 | .name = "Input Source", |
| 7645 | .count = 2, |
| 7646 | .info = alc882_mux_enum_info, |
| 7647 | .get = alc882_mux_enum_get, |
| 7648 | .put = alc882_mux_enum_put, |
| 7649 | }, |
| 7650 | { } /* end */ |
| 7651 | }; |
| 7652 | |
Takashi Iwai | cb53c62 | 2007-08-10 17:21:45 +0200 | [diff] [blame] | 7653 | #ifdef CONFIG_SND_HDA_POWER_SAVE |
| 7654 | #define alc883_loopbacks alc880_loopbacks |
| 7655 | #endif |
| 7656 | |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 7657 | /* pcm configuration: identiacal with ALC880 */ |
| 7658 | #define alc883_pcm_analog_playback alc880_pcm_analog_playback |
| 7659 | #define alc883_pcm_analog_capture alc880_pcm_analog_capture |
Takashi Iwai | 6330079 | 2008-01-24 15:31:36 +0100 | [diff] [blame] | 7660 | #define alc883_pcm_analog_alt_capture alc880_pcm_analog_alt_capture |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 7661 | #define alc883_pcm_digital_playback alc880_pcm_digital_playback |
| 7662 | #define alc883_pcm_digital_capture alc880_pcm_digital_capture |
| 7663 | |
| 7664 | /* |
| 7665 | * configuration and preset |
| 7666 | */ |
Takashi Iwai | f5fcc13 | 2006-11-24 17:07:44 +0100 | [diff] [blame] | 7667 | static const char *alc883_models[ALC883_MODEL_LAST] = { |
| 7668 | [ALC883_3ST_2ch_DIG] = "3stack-dig", |
| 7669 | [ALC883_3ST_6ch_DIG] = "3stack-6ch-dig", |
| 7670 | [ALC883_3ST_6ch] = "3stack-6ch", |
| 7671 | [ALC883_6ST_DIG] = "6stack-dig", |
| 7672 | [ALC883_TARGA_DIG] = "targa-dig", |
| 7673 | [ALC883_TARGA_2ch_DIG] = "targa-2ch-dig", |
Takashi Iwai | f5fcc13 | 2006-11-24 17:07:44 +0100 | [diff] [blame] | 7674 | [ALC883_ACER] = "acer", |
Tobin Davis | 2880a86 | 2007-08-07 11:50:26 +0200 | [diff] [blame] | 7675 | [ALC883_ACER_ASPIRE] = "acer-aspire", |
Takashi Iwai | f5fcc13 | 2006-11-24 17:07:44 +0100 | [diff] [blame] | 7676 | [ALC883_MEDION] = "medion", |
Kailang Yang | 272a527 | 2007-05-14 11:00:38 +0200 | [diff] [blame] | 7677 | [ALC883_MEDION_MD2] = "medion-md2", |
Takashi Iwai | f5fcc13 | 2006-11-24 17:07:44 +0100 | [diff] [blame] | 7678 | [ALC883_LAPTOP_EAPD] = "laptop-eapd", |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 7679 | [ALC883_LENOVO_101E_2ch] = "lenovo-101e", |
Kailang Yang | 272a527 | 2007-05-14 11:00:38 +0200 | [diff] [blame] | 7680 | [ALC883_LENOVO_NB0763] = "lenovo-nb0763", |
| 7681 | [ALC888_LENOVO_MS7195_DIG] = "lenovo-ms7195-dig", |
Kailang Yang | 189609a | 2007-08-20 11:31:23 +0200 | [diff] [blame] | 7682 | [ALC883_HAIER_W66] = "haier-w66", |
Claudio Matsuoka | 4723c02 | 2007-07-13 14:36:19 +0200 | [diff] [blame] | 7683 | [ALC888_3ST_HP] = "3stack-hp", |
Claudio Matsuoka | 5795b9e | 2008-01-13 11:58:27 +0100 | [diff] [blame] | 7684 | [ALC888_6ST_DELL] = "6stack-dell", |
Andy Shevchenko | a8848bd | 2007-12-13 17:32:26 +0100 | [diff] [blame] | 7685 | [ALC883_MITAC] = "mitac", |
Jiang zhe | 368c7a9 | 2008-03-04 11:20:33 +0100 | [diff] [blame] | 7686 | [ALC883_CLEVO_M720R] = "clevo-m720r", |
Jiang zhe | fb97dc6 | 2008-03-06 11:07:11 +0100 | [diff] [blame] | 7687 | [ALC883_FUJITSU_PI2515] = "fujitsu-pi2515", |
Takashi Iwai | f5fcc13 | 2006-11-24 17:07:44 +0100 | [diff] [blame] | 7688 | [ALC883_AUTO] = "auto", |
| 7689 | }; |
| 7690 | |
| 7691 | static struct snd_pci_quirk alc883_cfg_tbl[] = { |
| 7692 | SND_PCI_QUIRK(0x1019, 0x6668, "ECS", ALC883_3ST_6ch_DIG), |
Takashi Iwai | ac3e374 | 2007-12-17 17:14:18 +0100 | [diff] [blame] | 7693 | SND_PCI_QUIRK(0x1025, 0x006c, "Acer Aspire 9810", ALC883_ACER_ASPIRE), |
| 7694 | SND_PCI_QUIRK(0x1025, 0x0110, "Acer Aspire", ALC883_ACER_ASPIRE), |
| 7695 | SND_PCI_QUIRK(0x1025, 0x0112, "Acer Aspire 9303", ALC883_ACER_ASPIRE), |
| 7696 | SND_PCI_QUIRK(0x1025, 0, "Acer laptop", ALC883_ACER), /* default Acer */ |
Claudio Matsuoka | 5795b9e | 2008-01-13 11:58:27 +0100 | [diff] [blame] | 7697 | SND_PCI_QUIRK(0x1028, 0x020d, "Dell Inspiron 530", ALC888_6ST_DELL), |
Tobin Davis | febe337 | 2007-06-12 11:27:46 +0200 | [diff] [blame] | 7698 | SND_PCI_QUIRK(0x103c, 0x2a3d, "HP Pavillion", ALC883_6ST_DIG), |
Takashi Iwai | ac3e374 | 2007-12-17 17:14:18 +0100 | [diff] [blame] | 7699 | SND_PCI_QUIRK(0x103c, 0x2a4f, "HP Samba", ALC888_3ST_HP), |
| 7700 | SND_PCI_QUIRK(0x103c, 0x2a60, "HP Lucknow", ALC888_3ST_HP), |
Herton Ronaldo Krzesinski | 5d85f8d | 2008-03-20 12:13:46 +0100 | [diff] [blame^] | 7701 | SND_PCI_QUIRK(0x103c, 0x2a61, "HP Nettle", ALC883_6ST_DIG), |
Takashi Iwai | ac3e374 | 2007-12-17 17:14:18 +0100 | [diff] [blame] | 7702 | SND_PCI_QUIRK(0x1043, 0x8249, "Asus M2A-VM HDMI", ALC883_3ST_6ch_DIG), |
Takashi Iwai | f5fcc13 | 2006-11-24 17:07:44 +0100 | [diff] [blame] | 7703 | SND_PCI_QUIRK(0x105b, 0x6668, "Foxconn", ALC883_6ST_DIG), |
Takashi Iwai | ac3e374 | 2007-12-17 17:14:18 +0100 | [diff] [blame] | 7704 | SND_PCI_QUIRK(0x1071, 0x8253, "Mitac 8252d", ALC883_MITAC), |
| 7705 | SND_PCI_QUIRK(0x1071, 0x8258, "Evesham Voyaeger", ALC883_LAPTOP_EAPD), |
| 7706 | SND_PCI_QUIRK(0x108e, 0x534d, NULL, ALC883_3ST_6ch), |
Tobin Davis | 57b14f2 | 2007-04-18 23:05:36 +0200 | [diff] [blame] | 7707 | SND_PCI_QUIRK(0x1458, 0xa002, "MSI", ALC883_6ST_DIG), |
Takashi Iwai | ac3e374 | 2007-12-17 17:14:18 +0100 | [diff] [blame] | 7708 | SND_PCI_QUIRK(0x1462, 0x0349, "MSI", ALC883_TARGA_2ch_DIG), |
| 7709 | SND_PCI_QUIRK(0x1462, 0x040d, "MSI", ALC883_TARGA_2ch_DIG), |
| 7710 | SND_PCI_QUIRK(0x1462, 0x0579, "MSI", ALC883_TARGA_2ch_DIG), |
| 7711 | SND_PCI_QUIRK(0x1462, 0x3729, "MSI S420", ALC883_TARGA_DIG), |
Pascal Terjan | 8280823 | 2008-03-04 11:33:28 +0100 | [diff] [blame] | 7712 | SND_PCI_QUIRK(0x1462, 0x3783, "NEC S970", ALC883_TARGA_DIG), |
Takashi Iwai | ac3e374 | 2007-12-17 17:14:18 +0100 | [diff] [blame] | 7713 | SND_PCI_QUIRK(0x1462, 0x3b7f, "MSI", ALC883_TARGA_2ch_DIG), |
| 7714 | SND_PCI_QUIRK(0x1462, 0x3ef9, "MSI", ALC883_TARGA_DIG), |
| 7715 | SND_PCI_QUIRK(0x1462, 0x3fc1, "MSI", ALC883_TARGA_DIG), |
| 7716 | SND_PCI_QUIRK(0x1462, 0x3fc3, "MSI", ALC883_TARGA_DIG), |
| 7717 | SND_PCI_QUIRK(0x1462, 0x3fcc, "MSI", ALC883_TARGA_DIG), |
| 7718 | SND_PCI_QUIRK(0x1462, 0x3fdf, "MSI", ALC883_TARGA_DIG), |
| 7719 | SND_PCI_QUIRK(0x1462, 0x4314, "MSI", ALC883_TARGA_DIG), |
| 7720 | SND_PCI_QUIRK(0x1462, 0x4319, "MSI", ALC883_TARGA_DIG), |
| 7721 | SND_PCI_QUIRK(0x1462, 0x4324, "MSI", ALC883_TARGA_DIG), |
Takashi Iwai | f5fcc13 | 2006-11-24 17:07:44 +0100 | [diff] [blame] | 7722 | SND_PCI_QUIRK(0x1462, 0x6668, "MSI", ALC883_6ST_DIG), |
| 7723 | SND_PCI_QUIRK(0x1462, 0x7187, "MSI", ALC883_6ST_DIG), |
Tobin Davis | 799f88a | 2007-05-29 14:29:08 +0200 | [diff] [blame] | 7724 | SND_PCI_QUIRK(0x1462, 0x7250, "MSI", ALC883_6ST_DIG), |
Herton Ronaldo Krzesinski | 86d34b7 | 2008-03-18 09:27:59 +0100 | [diff] [blame] | 7725 | SND_PCI_QUIRK(0x1462, 0x7267, "MSI", ALC883_3ST_6ch_DIG), |
Leonard Norrgard | 2a296cb | 2007-01-08 11:28:22 +0100 | [diff] [blame] | 7726 | SND_PCI_QUIRK(0x1462, 0x7280, "MSI", ALC883_6ST_DIG), |
Tobin Davis | 2dcd522 | 2007-07-10 17:04:57 +0200 | [diff] [blame] | 7727 | SND_PCI_QUIRK(0x1462, 0x7327, "MSI", ALC883_6ST_DIG), |
Takashi Iwai | f5fcc13 | 2006-11-24 17:07:44 +0100 | [diff] [blame] | 7728 | SND_PCI_QUIRK(0x1462, 0xa422, "MSI", ALC883_TARGA_2ch_DIG), |
Takashi Iwai | ac3e374 | 2007-12-17 17:14:18 +0100 | [diff] [blame] | 7729 | SND_PCI_QUIRK(0x147b, 0x1083, "Abit IP35-PRO", ALC883_6ST_DIG), |
Jiang zhe | 368c7a9 | 2008-03-04 11:20:33 +0100 | [diff] [blame] | 7730 | SND_PCI_QUIRK(0x1558, 0x0721, "Clevo laptop M720R", ALC883_CLEVO_M720R), |
Takashi Iwai | ac3e374 | 2007-12-17 17:14:18 +0100 | [diff] [blame] | 7731 | SND_PCI_QUIRK(0x1558, 0, "Clevo laptop", ALC883_LAPTOP_EAPD), |
Daniel T Chen | e60623b | 2007-05-29 03:41:55 -0400 | [diff] [blame] | 7732 | SND_PCI_QUIRK(0x15d9, 0x8780, "Supermicro PDSBA", ALC883_3ST_6ch), |
Takashi Iwai | f5fcc13 | 2006-11-24 17:07:44 +0100 | [diff] [blame] | 7733 | SND_PCI_QUIRK(0x161f, 0x2054, "Medion laptop", ALC883_MEDION), |
Jiang zhe | fb97dc6 | 2008-03-06 11:07:11 +0100 | [diff] [blame] | 7734 | SND_PCI_QUIRK(0x1734, 0x1108, "Fujitsu AMILO Pi2515", ALC883_FUJITSU_PI2515), |
Kailang Yang | 272a527 | 2007-05-14 11:00:38 +0200 | [diff] [blame] | 7735 | SND_PCI_QUIRK(0x17aa, 0x101e, "Lenovo 101e", ALC883_LENOVO_101E_2ch), |
Kailang Yang | 272a527 | 2007-05-14 11:00:38 +0200 | [diff] [blame] | 7736 | SND_PCI_QUIRK(0x17aa, 0x2085, "Lenovo NB0763", ALC883_LENOVO_NB0763), |
Takashi Iwai | ac3e374 | 2007-12-17 17:14:18 +0100 | [diff] [blame] | 7737 | SND_PCI_QUIRK(0x17aa, 0x3bfc, "Lenovo NB0763", ALC883_LENOVO_NB0763), |
| 7738 | SND_PCI_QUIRK(0x17aa, 0x3bfd, "Lenovo NB0763", ALC883_LENOVO_NB0763), |
Kailang Yang | 272a527 | 2007-05-14 11:00:38 +0200 | [diff] [blame] | 7739 | SND_PCI_QUIRK(0x17c0, 0x4071, "MEDION MD2", ALC883_MEDION_MD2), |
Andrew Paprocki | 0b167bf | 2008-02-03 10:15:44 +0100 | [diff] [blame] | 7740 | SND_PCI_QUIRK(0x17f2, 0x5000, "Albatron KI690-AM2", ALC883_6ST_DIG), |
Kailang Yang | 189609a | 2007-08-20 11:31:23 +0200 | [diff] [blame] | 7741 | SND_PCI_QUIRK(0x1991, 0x5625, "Haier W66", ALC883_HAIER_W66), |
Takashi Iwai | ac3e374 | 2007-12-17 17:14:18 +0100 | [diff] [blame] | 7742 | SND_PCI_QUIRK(0x8086, 0xd601, "D102GGC", ALC883_3ST_6ch), |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 7743 | {} |
| 7744 | }; |
| 7745 | |
| 7746 | static struct alc_config_preset alc883_presets[] = { |
| 7747 | [ALC883_3ST_2ch_DIG] = { |
| 7748 | .mixers = { alc883_3ST_2ch_mixer }, |
| 7749 | .init_verbs = { alc883_init_verbs }, |
| 7750 | .num_dacs = ARRAY_SIZE(alc883_dac_nids), |
| 7751 | .dac_nids = alc883_dac_nids, |
| 7752 | .dig_out_nid = ALC883_DIGOUT_NID, |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 7753 | .dig_in_nid = ALC883_DIGIN_NID, |
| 7754 | .num_channel_mode = ARRAY_SIZE(alc883_3ST_2ch_modes), |
| 7755 | .channel_mode = alc883_3ST_2ch_modes, |
| 7756 | .input_mux = &alc883_capture_source, |
| 7757 | }, |
| 7758 | [ALC883_3ST_6ch_DIG] = { |
| 7759 | .mixers = { alc883_3ST_6ch_mixer, alc883_chmode_mixer }, |
| 7760 | .init_verbs = { alc883_init_verbs }, |
| 7761 | .num_dacs = ARRAY_SIZE(alc883_dac_nids), |
| 7762 | .dac_nids = alc883_dac_nids, |
| 7763 | .dig_out_nid = ALC883_DIGOUT_NID, |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 7764 | .dig_in_nid = ALC883_DIGIN_NID, |
| 7765 | .num_channel_mode = ARRAY_SIZE(alc883_3ST_6ch_modes), |
| 7766 | .channel_mode = alc883_3ST_6ch_modes, |
Takashi Iwai | 4e195a7 | 2006-07-28 14:47:34 +0200 | [diff] [blame] | 7767 | .need_dac_fix = 1, |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 7768 | .input_mux = &alc883_capture_source, |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 7769 | }, |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 7770 | [ALC883_3ST_6ch] = { |
| 7771 | .mixers = { alc883_3ST_6ch_mixer, alc883_chmode_mixer }, |
| 7772 | .init_verbs = { alc883_init_verbs }, |
| 7773 | .num_dacs = ARRAY_SIZE(alc883_dac_nids), |
| 7774 | .dac_nids = alc883_dac_nids, |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 7775 | .num_channel_mode = ARRAY_SIZE(alc883_3ST_6ch_modes), |
| 7776 | .channel_mode = alc883_3ST_6ch_modes, |
Takashi Iwai | 4e195a7 | 2006-07-28 14:47:34 +0200 | [diff] [blame] | 7777 | .need_dac_fix = 1, |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 7778 | .input_mux = &alc883_capture_source, |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 7779 | }, |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 7780 | [ALC883_6ST_DIG] = { |
| 7781 | .mixers = { alc883_base_mixer, alc883_chmode_mixer }, |
| 7782 | .init_verbs = { alc883_init_verbs }, |
| 7783 | .num_dacs = ARRAY_SIZE(alc883_dac_nids), |
| 7784 | .dac_nids = alc883_dac_nids, |
| 7785 | .dig_out_nid = ALC883_DIGOUT_NID, |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 7786 | .dig_in_nid = ALC883_DIGIN_NID, |
| 7787 | .num_channel_mode = ARRAY_SIZE(alc883_sixstack_modes), |
| 7788 | .channel_mode = alc883_sixstack_modes, |
| 7789 | .input_mux = &alc883_capture_source, |
| 7790 | }, |
Kailang Yang | ccc656c | 2006-10-17 12:32:26 +0200 | [diff] [blame] | 7791 | [ALC883_TARGA_DIG] = { |
| 7792 | .mixers = { alc883_tagra_mixer, alc883_chmode_mixer }, |
| 7793 | .init_verbs = { alc883_init_verbs, alc883_tagra_verbs}, |
| 7794 | .num_dacs = ARRAY_SIZE(alc883_dac_nids), |
| 7795 | .dac_nids = alc883_dac_nids, |
| 7796 | .dig_out_nid = ALC883_DIGOUT_NID, |
Kailang Yang | ccc656c | 2006-10-17 12:32:26 +0200 | [diff] [blame] | 7797 | .num_channel_mode = ARRAY_SIZE(alc883_3ST_6ch_modes), |
| 7798 | .channel_mode = alc883_3ST_6ch_modes, |
| 7799 | .need_dac_fix = 1, |
| 7800 | .input_mux = &alc883_capture_source, |
| 7801 | .unsol_event = alc883_tagra_unsol_event, |
| 7802 | .init_hook = alc883_tagra_automute, |
| 7803 | }, |
| 7804 | [ALC883_TARGA_2ch_DIG] = { |
| 7805 | .mixers = { alc883_tagra_2ch_mixer}, |
| 7806 | .init_verbs = { alc883_init_verbs, alc883_tagra_verbs}, |
| 7807 | .num_dacs = ARRAY_SIZE(alc883_dac_nids), |
| 7808 | .dac_nids = alc883_dac_nids, |
| 7809 | .dig_out_nid = ALC883_DIGOUT_NID, |
Kailang Yang | ccc656c | 2006-10-17 12:32:26 +0200 | [diff] [blame] | 7810 | .num_channel_mode = ARRAY_SIZE(alc883_3ST_2ch_modes), |
| 7811 | .channel_mode = alc883_3ST_2ch_modes, |
| 7812 | .input_mux = &alc883_capture_source, |
| 7813 | .unsol_event = alc883_tagra_unsol_event, |
| 7814 | .init_hook = alc883_tagra_automute, |
| 7815 | }, |
Vladimir Avdonin | bab282b9 | 2006-08-22 13:31:58 +0200 | [diff] [blame] | 7816 | [ALC883_ACER] = { |
Takashi Iwai | 676a9b5 | 2007-08-16 15:23:35 +0200 | [diff] [blame] | 7817 | .mixers = { alc883_base_mixer }, |
Vladimir Avdonin | bab282b9 | 2006-08-22 13:31:58 +0200 | [diff] [blame] | 7818 | /* On TravelMate laptops, GPIO 0 enables the internal speaker |
| 7819 | * and the headphone jack. Turn this on and rely on the |
| 7820 | * standard mute methods whenever the user wants to turn |
| 7821 | * these outputs off. |
| 7822 | */ |
| 7823 | .init_verbs = { alc883_init_verbs, alc880_gpio1_init_verbs }, |
| 7824 | .num_dacs = ARRAY_SIZE(alc883_dac_nids), |
| 7825 | .dac_nids = alc883_dac_nids, |
Vladimir Avdonin | bab282b9 | 2006-08-22 13:31:58 +0200 | [diff] [blame] | 7826 | .num_channel_mode = ARRAY_SIZE(alc883_3ST_2ch_modes), |
| 7827 | .channel_mode = alc883_3ST_2ch_modes, |
| 7828 | .input_mux = &alc883_capture_source, |
| 7829 | }, |
Tobin Davis | 2880a86 | 2007-08-07 11:50:26 +0200 | [diff] [blame] | 7830 | [ALC883_ACER_ASPIRE] = { |
Takashi Iwai | 676a9b5 | 2007-08-16 15:23:35 +0200 | [diff] [blame] | 7831 | .mixers = { alc883_acer_aspire_mixer }, |
Kailang Yang | d1a991a | 2007-08-15 16:21:59 +0200 | [diff] [blame] | 7832 | .init_verbs = { alc883_init_verbs, alc883_acer_eapd_verbs }, |
Tobin Davis | 2880a86 | 2007-08-07 11:50:26 +0200 | [diff] [blame] | 7833 | .num_dacs = ARRAY_SIZE(alc883_dac_nids), |
| 7834 | .dac_nids = alc883_dac_nids, |
| 7835 | .dig_out_nid = ALC883_DIGOUT_NID, |
Tobin Davis | 2880a86 | 2007-08-07 11:50:26 +0200 | [diff] [blame] | 7836 | .num_channel_mode = ARRAY_SIZE(alc883_3ST_2ch_modes), |
| 7837 | .channel_mode = alc883_3ST_2ch_modes, |
| 7838 | .input_mux = &alc883_capture_source, |
Takashi Iwai | 676a9b5 | 2007-08-16 15:23:35 +0200 | [diff] [blame] | 7839 | .unsol_event = alc883_acer_aspire_unsol_event, |
| 7840 | .init_hook = alc883_acer_aspire_automute, |
Kailang Yang | d1a991a | 2007-08-15 16:21:59 +0200 | [diff] [blame] | 7841 | }, |
Tobin Davis | c07584c | 2006-10-13 12:32:16 +0200 | [diff] [blame] | 7842 | [ALC883_MEDION] = { |
| 7843 | .mixers = { alc883_fivestack_mixer, |
| 7844 | alc883_chmode_mixer }, |
| 7845 | .init_verbs = { alc883_init_verbs, |
Andrew L. Neporada | b373bde | 2006-11-07 11:37:08 +0100 | [diff] [blame] | 7846 | alc883_medion_eapd_verbs }, |
Tobin Davis | c07584c | 2006-10-13 12:32:16 +0200 | [diff] [blame] | 7847 | .num_dacs = ARRAY_SIZE(alc883_dac_nids), |
| 7848 | .dac_nids = alc883_dac_nids, |
Tobin Davis | c07584c | 2006-10-13 12:32:16 +0200 | [diff] [blame] | 7849 | .num_channel_mode = ARRAY_SIZE(alc883_sixstack_modes), |
| 7850 | .channel_mode = alc883_sixstack_modes, |
| 7851 | .input_mux = &alc883_capture_source, |
Andrew L. Neporada | b373bde | 2006-11-07 11:37:08 +0100 | [diff] [blame] | 7852 | }, |
Kailang Yang | 272a527 | 2007-05-14 11:00:38 +0200 | [diff] [blame] | 7853 | [ALC883_MEDION_MD2] = { |
| 7854 | .mixers = { alc883_medion_md2_mixer}, |
| 7855 | .init_verbs = { alc883_init_verbs, alc883_medion_md2_verbs}, |
| 7856 | .num_dacs = ARRAY_SIZE(alc883_dac_nids), |
| 7857 | .dac_nids = alc883_dac_nids, |
| 7858 | .dig_out_nid = ALC883_DIGOUT_NID, |
Kailang Yang | 272a527 | 2007-05-14 11:00:38 +0200 | [diff] [blame] | 7859 | .num_channel_mode = ARRAY_SIZE(alc883_3ST_2ch_modes), |
| 7860 | .channel_mode = alc883_3ST_2ch_modes, |
| 7861 | .input_mux = &alc883_capture_source, |
| 7862 | .unsol_event = alc883_medion_md2_unsol_event, |
| 7863 | .init_hook = alc883_medion_md2_automute, |
| 7864 | }, |
Andrew L. Neporada | b373bde | 2006-11-07 11:37:08 +0100 | [diff] [blame] | 7865 | [ALC883_LAPTOP_EAPD] = { |
Takashi Iwai | 676a9b5 | 2007-08-16 15:23:35 +0200 | [diff] [blame] | 7866 | .mixers = { alc883_base_mixer }, |
Andrew L. Neporada | b373bde | 2006-11-07 11:37:08 +0100 | [diff] [blame] | 7867 | .init_verbs = { alc883_init_verbs, alc882_eapd_verbs }, |
| 7868 | .num_dacs = ARRAY_SIZE(alc883_dac_nids), |
| 7869 | .dac_nids = alc883_dac_nids, |
Andrew L. Neporada | b373bde | 2006-11-07 11:37:08 +0100 | [diff] [blame] | 7870 | .num_channel_mode = ARRAY_SIZE(alc883_3ST_2ch_modes), |
| 7871 | .channel_mode = alc883_3ST_2ch_modes, |
| 7872 | .input_mux = &alc883_capture_source, |
| 7873 | }, |
Jiang zhe | 368c7a9 | 2008-03-04 11:20:33 +0100 | [diff] [blame] | 7874 | [ALC883_CLEVO_M720R] = { |
| 7875 | .mixers = { alc883_clevo_m720r_mixer }, |
| 7876 | .init_verbs = { alc883_init_verbs, alc883_clevo_m720r_verbs }, |
| 7877 | .num_dacs = ARRAY_SIZE(alc883_dac_nids), |
| 7878 | .dac_nids = alc883_dac_nids, |
| 7879 | .dig_out_nid = ALC883_DIGOUT_NID, |
| 7880 | .num_channel_mode = ARRAY_SIZE(alc883_3ST_2ch_modes), |
| 7881 | .channel_mode = alc883_3ST_2ch_modes, |
| 7882 | .input_mux = &alc883_capture_source, |
| 7883 | .unsol_event = alc883_clevo_m720r_unsol_event, |
| 7884 | .init_hook = alc883_clevo_m720r_automute, |
| 7885 | }, |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 7886 | [ALC883_LENOVO_101E_2ch] = { |
| 7887 | .mixers = { alc883_lenovo_101e_2ch_mixer}, |
| 7888 | .init_verbs = { alc883_init_verbs, alc883_lenovo_101e_verbs}, |
| 7889 | .num_dacs = ARRAY_SIZE(alc883_dac_nids), |
| 7890 | .dac_nids = alc883_dac_nids, |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 7891 | .num_channel_mode = ARRAY_SIZE(alc883_3ST_2ch_modes), |
| 7892 | .channel_mode = alc883_3ST_2ch_modes, |
| 7893 | .input_mux = &alc883_lenovo_101e_capture_source, |
| 7894 | .unsol_event = alc883_lenovo_101e_unsol_event, |
| 7895 | .init_hook = alc883_lenovo_101e_all_automute, |
| 7896 | }, |
Kailang Yang | 272a527 | 2007-05-14 11:00:38 +0200 | [diff] [blame] | 7897 | [ALC883_LENOVO_NB0763] = { |
| 7898 | .mixers = { alc883_lenovo_nb0763_mixer }, |
| 7899 | .init_verbs = { alc883_init_verbs, alc883_lenovo_nb0763_verbs}, |
| 7900 | .num_dacs = ARRAY_SIZE(alc883_dac_nids), |
| 7901 | .dac_nids = alc883_dac_nids, |
Kailang Yang | 272a527 | 2007-05-14 11:00:38 +0200 | [diff] [blame] | 7902 | .num_channel_mode = ARRAY_SIZE(alc883_3ST_2ch_modes), |
| 7903 | .channel_mode = alc883_3ST_2ch_modes, |
| 7904 | .need_dac_fix = 1, |
| 7905 | .input_mux = &alc883_lenovo_nb0763_capture_source, |
| 7906 | .unsol_event = alc883_medion_md2_unsol_event, |
| 7907 | .init_hook = alc883_medion_md2_automute, |
| 7908 | }, |
| 7909 | [ALC888_LENOVO_MS7195_DIG] = { |
| 7910 | .mixers = { alc883_3ST_6ch_mixer, alc883_chmode_mixer }, |
| 7911 | .init_verbs = { alc883_init_verbs, alc888_lenovo_ms7195_verbs}, |
| 7912 | .num_dacs = ARRAY_SIZE(alc883_dac_nids), |
| 7913 | .dac_nids = alc883_dac_nids, |
| 7914 | .dig_out_nid = ALC883_DIGOUT_NID, |
Kailang Yang | 272a527 | 2007-05-14 11:00:38 +0200 | [diff] [blame] | 7915 | .num_channel_mode = ARRAY_SIZE(alc883_3ST_6ch_modes), |
| 7916 | .channel_mode = alc883_3ST_6ch_modes, |
| 7917 | .need_dac_fix = 1, |
| 7918 | .input_mux = &alc883_capture_source, |
| 7919 | .unsol_event = alc883_lenovo_ms7195_unsol_event, |
| 7920 | .init_hook = alc888_lenovo_ms7195_front_automute, |
Kailang Yang | 189609a | 2007-08-20 11:31:23 +0200 | [diff] [blame] | 7921 | }, |
| 7922 | [ALC883_HAIER_W66] = { |
| 7923 | .mixers = { alc883_tagra_2ch_mixer}, |
| 7924 | .init_verbs = { alc883_init_verbs, alc883_haier_w66_verbs}, |
| 7925 | .num_dacs = ARRAY_SIZE(alc883_dac_nids), |
| 7926 | .dac_nids = alc883_dac_nids, |
| 7927 | .dig_out_nid = ALC883_DIGOUT_NID, |
Kailang Yang | 189609a | 2007-08-20 11:31:23 +0200 | [diff] [blame] | 7928 | .num_channel_mode = ARRAY_SIZE(alc883_3ST_2ch_modes), |
| 7929 | .channel_mode = alc883_3ST_2ch_modes, |
| 7930 | .input_mux = &alc883_capture_source, |
| 7931 | .unsol_event = alc883_haier_w66_unsol_event, |
| 7932 | .init_hook = alc883_haier_w66_automute, |
Kailang Yang | 272a527 | 2007-05-14 11:00:38 +0200 | [diff] [blame] | 7933 | }, |
Claudio Matsuoka | 4723c02 | 2007-07-13 14:36:19 +0200 | [diff] [blame] | 7934 | [ALC888_3ST_HP] = { |
| 7935 | .mixers = { alc888_3st_hp_mixer, alc883_chmode_mixer }, |
| 7936 | .init_verbs = { alc883_init_verbs, alc888_3st_hp_verbs }, |
Claudio Matsuoka | 8341de6 | 2007-07-06 12:10:45 +0200 | [diff] [blame] | 7937 | .num_dacs = ARRAY_SIZE(alc883_dac_nids), |
| 7938 | .dac_nids = alc883_dac_nids, |
Claudio Matsuoka | 4723c02 | 2007-07-13 14:36:19 +0200 | [diff] [blame] | 7939 | .num_channel_mode = ARRAY_SIZE(alc888_3st_hp_modes), |
| 7940 | .channel_mode = alc888_3st_hp_modes, |
Claudio Matsuoka | 8341de6 | 2007-07-06 12:10:45 +0200 | [diff] [blame] | 7941 | .need_dac_fix = 1, |
| 7942 | .input_mux = &alc883_capture_source, |
| 7943 | }, |
Claudio Matsuoka | 5795b9e | 2008-01-13 11:58:27 +0100 | [diff] [blame] | 7944 | [ALC888_6ST_DELL] = { |
| 7945 | .mixers = { alc888_6st_dell_mixer, alc883_chmode_mixer }, |
| 7946 | .init_verbs = { alc883_init_verbs, alc888_6st_dell_verbs }, |
| 7947 | .num_dacs = ARRAY_SIZE(alc883_dac_nids), |
| 7948 | .dac_nids = alc883_dac_nids, |
| 7949 | .dig_out_nid = ALC883_DIGOUT_NID, |
Claudio Matsuoka | 5795b9e | 2008-01-13 11:58:27 +0100 | [diff] [blame] | 7950 | .dig_in_nid = ALC883_DIGIN_NID, |
| 7951 | .num_channel_mode = ARRAY_SIZE(alc883_sixstack_modes), |
| 7952 | .channel_mode = alc883_sixstack_modes, |
| 7953 | .input_mux = &alc883_capture_source, |
| 7954 | .unsol_event = alc888_6st_dell_unsol_event, |
| 7955 | .init_hook = alc888_6st_dell_front_automute, |
| 7956 | }, |
Andy Shevchenko | a8848bd | 2007-12-13 17:32:26 +0100 | [diff] [blame] | 7957 | [ALC883_MITAC] = { |
| 7958 | .mixers = { alc883_mitac_mixer }, |
| 7959 | .init_verbs = { alc883_init_verbs, alc883_mitac_verbs }, |
| 7960 | .num_dacs = ARRAY_SIZE(alc883_dac_nids), |
| 7961 | .dac_nids = alc883_dac_nids, |
Andy Shevchenko | a8848bd | 2007-12-13 17:32:26 +0100 | [diff] [blame] | 7962 | .num_channel_mode = ARRAY_SIZE(alc883_3ST_2ch_modes), |
| 7963 | .channel_mode = alc883_3ST_2ch_modes, |
| 7964 | .input_mux = &alc883_capture_source, |
| 7965 | .unsol_event = alc883_mitac_unsol_event, |
| 7966 | .init_hook = alc883_mitac_automute, |
| 7967 | }, |
Jiang zhe | fb97dc6 | 2008-03-06 11:07:11 +0100 | [diff] [blame] | 7968 | [ALC883_FUJITSU_PI2515] = { |
| 7969 | .mixers = { alc883_2ch_fujitsu_pi2515_mixer }, |
| 7970 | .init_verbs = { alc883_init_verbs, |
| 7971 | alc883_2ch_fujitsu_pi2515_verbs}, |
| 7972 | .num_dacs = ARRAY_SIZE(alc883_dac_nids), |
| 7973 | .dac_nids = alc883_dac_nids, |
| 7974 | .dig_out_nid = ALC883_DIGOUT_NID, |
| 7975 | .num_channel_mode = ARRAY_SIZE(alc883_3ST_2ch_modes), |
| 7976 | .channel_mode = alc883_3ST_2ch_modes, |
| 7977 | .input_mux = &alc883_fujitsu_pi2515_capture_source, |
| 7978 | .unsol_event = alc883_2ch_fujitsu_pi2515_unsol_event, |
| 7979 | .init_hook = alc883_2ch_fujitsu_pi2515_automute, |
| 7980 | }, |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 7981 | }; |
| 7982 | |
| 7983 | |
| 7984 | /* |
| 7985 | * BIOS auto configuration |
| 7986 | */ |
| 7987 | static void alc883_auto_set_output_and_unmute(struct hda_codec *codec, |
| 7988 | hda_nid_t nid, int pin_type, |
| 7989 | int dac_idx) |
| 7990 | { |
| 7991 | /* set as output */ |
| 7992 | struct alc_spec *spec = codec->spec; |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 7993 | int idx; |
| 7994 | |
Takashi Iwai | f6c7e54 | 2008-02-12 18:32:23 +0100 | [diff] [blame] | 7995 | alc_set_pin_output(codec, nid, pin_type); |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 7996 | if (spec->multiout.dac_nids[dac_idx] == 0x25) |
| 7997 | idx = 4; |
| 7998 | else |
| 7999 | idx = spec->multiout.dac_nids[dac_idx] - 2; |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 8000 | snd_hda_codec_write(codec, nid, 0, AC_VERB_SET_CONNECT_SEL, idx); |
| 8001 | |
| 8002 | } |
| 8003 | |
| 8004 | static void alc883_auto_init_multi_out(struct hda_codec *codec) |
| 8005 | { |
| 8006 | struct alc_spec *spec = codec->spec; |
| 8007 | int i; |
| 8008 | |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 8009 | alc_subsystem_id(codec, 0x15, 0x1b, 0x14); |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 8010 | for (i = 0; i <= HDA_SIDE; i++) { |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 8011 | hda_nid_t nid = spec->autocfg.line_out_pins[i]; |
Takashi Iwai | baba8ee | 2007-04-23 17:17:48 +0200 | [diff] [blame] | 8012 | int pin_type = get_pin_type(spec->autocfg.line_out_type); |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 8013 | if (nid) |
Takashi Iwai | baba8ee | 2007-04-23 17:17:48 +0200 | [diff] [blame] | 8014 | alc883_auto_set_output_and_unmute(codec, nid, pin_type, |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 8015 | i); |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 8016 | } |
| 8017 | } |
| 8018 | |
| 8019 | static void alc883_auto_init_hp_out(struct hda_codec *codec) |
| 8020 | { |
| 8021 | struct alc_spec *spec = codec->spec; |
| 8022 | hda_nid_t pin; |
| 8023 | |
Takashi Iwai | eb06ed8 | 2006-09-20 17:10:27 +0200 | [diff] [blame] | 8024 | pin = spec->autocfg.hp_pins[0]; |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 8025 | if (pin) /* connect to front */ |
| 8026 | /* use dac 0 */ |
| 8027 | alc883_auto_set_output_and_unmute(codec, pin, PIN_HP, 0); |
Takashi Iwai | f6c7e54 | 2008-02-12 18:32:23 +0100 | [diff] [blame] | 8028 | pin = spec->autocfg.speaker_pins[0]; |
| 8029 | if (pin) |
| 8030 | alc883_auto_set_output_and_unmute(codec, pin, PIN_OUT, 0); |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 8031 | } |
| 8032 | |
| 8033 | #define alc883_is_input_pin(nid) alc880_is_input_pin(nid) |
| 8034 | #define ALC883_PIN_CD_NID ALC880_PIN_CD_NID |
| 8035 | |
| 8036 | static void alc883_auto_init_analog_input(struct hda_codec *codec) |
| 8037 | { |
| 8038 | struct alc_spec *spec = codec->spec; |
| 8039 | int i; |
| 8040 | |
| 8041 | for (i = 0; i < AUTO_PIN_LAST; i++) { |
| 8042 | hda_nid_t nid = spec->autocfg.input_pins[i]; |
| 8043 | if (alc883_is_input_pin(nid)) { |
| 8044 | snd_hda_codec_write(codec, nid, 0, |
| 8045 | AC_VERB_SET_PIN_WIDGET_CONTROL, |
| 8046 | (i <= AUTO_PIN_FRONT_MIC ? |
| 8047 | PIN_VREF80 : PIN_IN)); |
| 8048 | if (nid != ALC883_PIN_CD_NID) |
| 8049 | snd_hda_codec_write(codec, nid, 0, |
| 8050 | AC_VERB_SET_AMP_GAIN_MUTE, |
| 8051 | AMP_OUT_MUTE); |
| 8052 | } |
| 8053 | } |
| 8054 | } |
| 8055 | |
| 8056 | /* almost identical with ALC880 parser... */ |
| 8057 | static int alc883_parse_auto_config(struct hda_codec *codec) |
| 8058 | { |
| 8059 | struct alc_spec *spec = codec->spec; |
| 8060 | int err = alc880_parse_auto_config(codec); |
| 8061 | |
| 8062 | if (err < 0) |
| 8063 | return err; |
Takashi Iwai | 776e184 | 2007-08-29 15:07:11 +0200 | [diff] [blame] | 8064 | else if (!err) |
| 8065 | return 0; /* no config found */ |
| 8066 | |
| 8067 | err = alc_auto_add_mic_boost(codec); |
| 8068 | if (err < 0) |
| 8069 | return err; |
| 8070 | |
| 8071 | /* hack - override the init verbs */ |
| 8072 | spec->init_verbs[0] = alc883_auto_init_verbs; |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 8073 | spec->mixers[spec->num_mixers] = alc883_capture_mixer; |
| 8074 | spec->num_mixers++; |
Takashi Iwai | 776e184 | 2007-08-29 15:07:11 +0200 | [diff] [blame] | 8075 | |
| 8076 | return 1; /* config found */ |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 8077 | } |
| 8078 | |
| 8079 | /* additional initialization for auto-configuration model */ |
| 8080 | static void alc883_auto_init(struct hda_codec *codec) |
| 8081 | { |
Takashi Iwai | f6c7e54 | 2008-02-12 18:32:23 +0100 | [diff] [blame] | 8082 | struct alc_spec *spec = codec->spec; |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 8083 | alc883_auto_init_multi_out(codec); |
| 8084 | alc883_auto_init_hp_out(codec); |
| 8085 | alc883_auto_init_analog_input(codec); |
Takashi Iwai | f6c7e54 | 2008-02-12 18:32:23 +0100 | [diff] [blame] | 8086 | if (spec->unsol_event) |
| 8087 | alc_sku_automute(codec); |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 8088 | } |
| 8089 | |
| 8090 | static int patch_alc883(struct hda_codec *codec) |
| 8091 | { |
| 8092 | struct alc_spec *spec; |
| 8093 | int err, board_config; |
| 8094 | |
| 8095 | spec = kzalloc(sizeof(*spec), GFP_KERNEL); |
| 8096 | if (spec == NULL) |
| 8097 | return -ENOMEM; |
| 8098 | |
| 8099 | codec->spec = spec; |
| 8100 | |
Takashi Iwai | f5fcc13 | 2006-11-24 17:07:44 +0100 | [diff] [blame] | 8101 | board_config = snd_hda_check_board_config(codec, ALC883_MODEL_LAST, |
| 8102 | alc883_models, |
| 8103 | alc883_cfg_tbl); |
| 8104 | if (board_config < 0) { |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 8105 | printk(KERN_INFO "hda_codec: Unknown model for ALC883, " |
| 8106 | "trying auto-probe from BIOS...\n"); |
| 8107 | board_config = ALC883_AUTO; |
| 8108 | } |
| 8109 | |
| 8110 | if (board_config == ALC883_AUTO) { |
| 8111 | /* automatic parse from the BIOS config */ |
| 8112 | err = alc883_parse_auto_config(codec); |
| 8113 | if (err < 0) { |
| 8114 | alc_free(codec); |
| 8115 | return err; |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 8116 | } else if (!err) { |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 8117 | printk(KERN_INFO |
| 8118 | "hda_codec: Cannot set up configuration " |
| 8119 | "from BIOS. Using base mode...\n"); |
| 8120 | board_config = ALC883_3ST_2ch_DIG; |
| 8121 | } |
| 8122 | } |
| 8123 | |
| 8124 | if (board_config != ALC883_AUTO) |
| 8125 | setup_preset(spec, &alc883_presets[board_config]); |
| 8126 | |
| 8127 | spec->stream_name_analog = "ALC883 Analog"; |
| 8128 | spec->stream_analog_playback = &alc883_pcm_analog_playback; |
| 8129 | spec->stream_analog_capture = &alc883_pcm_analog_capture; |
Takashi Iwai | 6330079 | 2008-01-24 15:31:36 +0100 | [diff] [blame] | 8130 | spec->stream_analog_alt_capture = &alc883_pcm_analog_alt_capture; |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 8131 | |
| 8132 | spec->stream_name_digital = "ALC883 Digital"; |
| 8133 | spec->stream_digital_playback = &alc883_pcm_digital_playback; |
| 8134 | spec->stream_digital_capture = &alc883_pcm_digital_capture; |
| 8135 | |
Takashi Iwai | e140634 | 2008-02-11 18:32:32 +0100 | [diff] [blame] | 8136 | spec->num_adc_nids = ARRAY_SIZE(alc883_adc_nids); |
| 8137 | spec->adc_nids = alc883_adc_nids; |
| 8138 | spec->capsrc_nids = alc883_capsrc_nids; |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 8139 | |
Takashi Iwai | 2134ea4 | 2008-01-10 16:53:55 +0100 | [diff] [blame] | 8140 | spec->vmaster_nid = 0x0c; |
| 8141 | |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 8142 | codec->patch_ops = alc_patch_ops; |
| 8143 | if (board_config == ALC883_AUTO) |
| 8144 | spec->init_hook = alc883_auto_init; |
Takashi Iwai | cb53c62 | 2007-08-10 17:21:45 +0200 | [diff] [blame] | 8145 | #ifdef CONFIG_SND_HDA_POWER_SAVE |
| 8146 | if (!spec->loopback.amplist) |
| 8147 | spec->loopback.amplist = alc883_loopbacks; |
| 8148 | #endif |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 8149 | |
| 8150 | return 0; |
| 8151 | } |
| 8152 | |
| 8153 | /* |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 8154 | * ALC262 support |
| 8155 | */ |
| 8156 | |
| 8157 | #define ALC262_DIGOUT_NID ALC880_DIGOUT_NID |
| 8158 | #define ALC262_DIGIN_NID ALC880_DIGIN_NID |
| 8159 | |
| 8160 | #define alc262_dac_nids alc260_dac_nids |
| 8161 | #define alc262_adc_nids alc882_adc_nids |
| 8162 | #define alc262_adc_nids_alt alc882_adc_nids_alt |
Takashi Iwai | 88c71a9 | 2008-02-14 17:27:17 +0100 | [diff] [blame] | 8163 | #define alc262_capsrc_nids alc882_capsrc_nids |
| 8164 | #define alc262_capsrc_nids_alt alc882_capsrc_nids_alt |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 8165 | |
| 8166 | #define alc262_modes alc260_modes |
Takashi Iwai | c5f2ea0 | 2005-12-06 18:54:31 +0100 | [diff] [blame] | 8167 | #define alc262_capture_source alc882_capture_source |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 8168 | |
| 8169 | static struct snd_kcontrol_new alc262_base_mixer[] = { |
| 8170 | HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT), |
| 8171 | HDA_CODEC_MUTE("Front Playback Switch", 0x14, 0x0, HDA_OUTPUT), |
| 8172 | HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT), |
| 8173 | HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT), |
| 8174 | HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT), |
| 8175 | HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT), |
| 8176 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), |
| 8177 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), |
Takashi Iwai | cc69d12 | 2007-02-15 19:29:26 +0100 | [diff] [blame] | 8178 | HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT), |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 8179 | HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x01, HDA_INPUT), |
| 8180 | HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x01, HDA_INPUT), |
Takashi Iwai | cc69d12 | 2007-02-15 19:29:26 +0100 | [diff] [blame] | 8181 | HDA_CODEC_VOLUME("Front Mic Boost", 0x19, 0, HDA_INPUT), |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 8182 | /* HDA_CODEC_VOLUME("PC Beep Playback Volume", 0x0b, 0x05, HDA_INPUT), |
Takashi Iwai | 31bffaa | 2008-02-27 16:10:44 +0100 | [diff] [blame] | 8183 | HDA_CODEC_MUTE("PC Beep Playback Switch", 0x0b, 0x05, HDA_INPUT), */ |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 8184 | HDA_CODEC_VOLUME("Headphone Playback Volume", 0x0D, 0x0, HDA_OUTPUT), |
| 8185 | HDA_CODEC_MUTE("Headphone Playback Switch", 0x15, 0x0, HDA_OUTPUT), |
| 8186 | HDA_CODEC_VOLUME_MONO("Mono Playback Volume", 0x0e, 2, 0x0, HDA_OUTPUT), |
| 8187 | HDA_CODEC_MUTE_MONO("Mono Playback Switch", 0x16, 2, 0x0, HDA_OUTPUT), |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 8188 | { } /* end */ |
Takashi Iwai | 834be88 | 2006-03-01 14:16:17 +0100 | [diff] [blame] | 8189 | }; |
| 8190 | |
Kailang Yang | ccc656c | 2006-10-17 12:32:26 +0200 | [diff] [blame] | 8191 | static struct snd_kcontrol_new alc262_hippo1_mixer[] = { |
| 8192 | HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT), |
| 8193 | HDA_CODEC_MUTE("Front Playback Switch", 0x14, 0x0, HDA_OUTPUT), |
| 8194 | HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT), |
| 8195 | HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT), |
| 8196 | HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT), |
| 8197 | HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT), |
| 8198 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), |
| 8199 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), |
Takashi Iwai | cc69d12 | 2007-02-15 19:29:26 +0100 | [diff] [blame] | 8200 | HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT), |
Kailang Yang | ccc656c | 2006-10-17 12:32:26 +0200 | [diff] [blame] | 8201 | HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x01, HDA_INPUT), |
| 8202 | HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x01, HDA_INPUT), |
Takashi Iwai | cc69d12 | 2007-02-15 19:29:26 +0100 | [diff] [blame] | 8203 | HDA_CODEC_VOLUME("Front Mic Boost", 0x19, 0, HDA_INPUT), |
Kailang Yang | ccc656c | 2006-10-17 12:32:26 +0200 | [diff] [blame] | 8204 | /* HDA_CODEC_VOLUME("PC Beep Playback Volume", 0x0b, 0x05, HDA_INPUT), |
Takashi Iwai | 31bffaa | 2008-02-27 16:10:44 +0100 | [diff] [blame] | 8205 | HDA_CODEC_MUTE("PC Beep Playback Switch", 0x0b, 0x05, HDA_INPUT), */ |
Kailang Yang | ccc656c | 2006-10-17 12:32:26 +0200 | [diff] [blame] | 8206 | /*HDA_CODEC_VOLUME("Headphone Playback Volume", 0x0D, 0x0, HDA_OUTPUT),*/ |
| 8207 | HDA_CODEC_MUTE("Headphone Playback Switch", 0x1b, 0x0, HDA_OUTPUT), |
| 8208 | { } /* end */ |
| 8209 | }; |
| 8210 | |
Takashi Iwai | ce875f0 | 2008-01-28 18:17:43 +0100 | [diff] [blame] | 8211 | /* update HP, line and mono-out pins according to the master switch */ |
| 8212 | static void alc262_hp_master_update(struct hda_codec *codec) |
| 8213 | { |
| 8214 | struct alc_spec *spec = codec->spec; |
| 8215 | int val = spec->master_sw; |
| 8216 | |
| 8217 | /* HP & line-out */ |
| 8218 | snd_hda_codec_write_cache(codec, 0x1b, 0, |
| 8219 | AC_VERB_SET_PIN_WIDGET_CONTROL, |
| 8220 | val ? PIN_HP : 0); |
| 8221 | snd_hda_codec_write_cache(codec, 0x15, 0, |
| 8222 | AC_VERB_SET_PIN_WIDGET_CONTROL, |
| 8223 | val ? PIN_HP : 0); |
| 8224 | /* mono (speaker) depending on the HP jack sense */ |
| 8225 | val = val && !spec->jack_present; |
| 8226 | snd_hda_codec_write_cache(codec, 0x16, 0, |
| 8227 | AC_VERB_SET_PIN_WIDGET_CONTROL, |
| 8228 | val ? PIN_OUT : 0); |
| 8229 | } |
| 8230 | |
| 8231 | static void alc262_hp_bpc_automute(struct hda_codec *codec) |
| 8232 | { |
| 8233 | struct alc_spec *spec = codec->spec; |
| 8234 | unsigned int presence; |
| 8235 | presence = snd_hda_codec_read(codec, 0x1b, 0, |
| 8236 | AC_VERB_GET_PIN_SENSE, 0); |
| 8237 | spec->jack_present = !!(presence & AC_PINSENSE_PRESENCE); |
| 8238 | alc262_hp_master_update(codec); |
| 8239 | } |
| 8240 | |
| 8241 | static void alc262_hp_bpc_unsol_event(struct hda_codec *codec, unsigned int res) |
| 8242 | { |
| 8243 | if ((res >> 26) != ALC880_HP_EVENT) |
| 8244 | return; |
| 8245 | alc262_hp_bpc_automute(codec); |
| 8246 | } |
| 8247 | |
| 8248 | static void alc262_hp_wildwest_automute(struct hda_codec *codec) |
| 8249 | { |
| 8250 | struct alc_spec *spec = codec->spec; |
| 8251 | unsigned int presence; |
| 8252 | presence = snd_hda_codec_read(codec, 0x15, 0, |
| 8253 | AC_VERB_GET_PIN_SENSE, 0); |
| 8254 | spec->jack_present = !!(presence & AC_PINSENSE_PRESENCE); |
| 8255 | alc262_hp_master_update(codec); |
| 8256 | } |
| 8257 | |
| 8258 | static void alc262_hp_wildwest_unsol_event(struct hda_codec *codec, |
| 8259 | unsigned int res) |
| 8260 | { |
| 8261 | if ((res >> 26) != ALC880_HP_EVENT) |
| 8262 | return; |
| 8263 | alc262_hp_wildwest_automute(codec); |
| 8264 | } |
| 8265 | |
| 8266 | static int alc262_hp_master_sw_get(struct snd_kcontrol *kcontrol, |
| 8267 | struct snd_ctl_elem_value *ucontrol) |
| 8268 | { |
| 8269 | struct hda_codec *codec = snd_kcontrol_chip(kcontrol); |
| 8270 | struct alc_spec *spec = codec->spec; |
| 8271 | *ucontrol->value.integer.value = spec->master_sw; |
| 8272 | return 0; |
| 8273 | } |
| 8274 | |
| 8275 | static int alc262_hp_master_sw_put(struct snd_kcontrol *kcontrol, |
| 8276 | struct snd_ctl_elem_value *ucontrol) |
| 8277 | { |
| 8278 | struct hda_codec *codec = snd_kcontrol_chip(kcontrol); |
| 8279 | struct alc_spec *spec = codec->spec; |
| 8280 | int val = !!*ucontrol->value.integer.value; |
| 8281 | |
| 8282 | if (val == spec->master_sw) |
| 8283 | return 0; |
| 8284 | spec->master_sw = val; |
| 8285 | alc262_hp_master_update(codec); |
| 8286 | return 1; |
| 8287 | } |
| 8288 | |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 8289 | static struct snd_kcontrol_new alc262_HP_BPC_mixer[] = { |
Takashi Iwai | ce875f0 | 2008-01-28 18:17:43 +0100 | [diff] [blame] | 8290 | { |
| 8291 | .iface = SNDRV_CTL_ELEM_IFACE_MIXER, |
| 8292 | .name = "Master Playback Switch", |
| 8293 | .info = snd_ctl_boolean_mono_info, |
| 8294 | .get = alc262_hp_master_sw_get, |
| 8295 | .put = alc262_hp_master_sw_put, |
| 8296 | }, |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 8297 | HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT), |
| 8298 | HDA_CODEC_MUTE("Front Playback Switch", 0x15, 0x0, HDA_OUTPUT), |
| 8299 | HDA_CODEC_MUTE("Headphone Playback Switch", 0x1b, 0x0, HDA_OUTPUT), |
Takashi Iwai | ce875f0 | 2008-01-28 18:17:43 +0100 | [diff] [blame] | 8300 | HDA_CODEC_VOLUME_MONO("Speaker Playback Volume", 0x0e, 2, 0x0, |
| 8301 | HDA_OUTPUT), |
| 8302 | HDA_CODEC_MUTE_MONO("Speaker Playback Switch", 0x16, 2, 0x0, |
| 8303 | HDA_OUTPUT), |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 8304 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), |
| 8305 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), |
Takashi Iwai | cc69d12 | 2007-02-15 19:29:26 +0100 | [diff] [blame] | 8306 | HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT), |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 8307 | HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x01, HDA_INPUT), |
| 8308 | HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x01, HDA_INPUT), |
Takashi Iwai | cc69d12 | 2007-02-15 19:29:26 +0100 | [diff] [blame] | 8309 | HDA_CODEC_VOLUME("Front Mic Boost", 0x19, 0, HDA_INPUT), |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 8310 | HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT), |
| 8311 | HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT), |
| 8312 | HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT), |
| 8313 | HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT), |
| 8314 | HDA_CODEC_VOLUME("PC Beep Playback Volume", 0x0b, 0x05, HDA_INPUT), |
| 8315 | HDA_CODEC_MUTE("PC Beep Playback Switch", 0x0b, 0x05, HDA_INPUT), |
| 8316 | HDA_CODEC_VOLUME("AUX IN Playback Volume", 0x0b, 0x06, HDA_INPUT), |
| 8317 | HDA_CODEC_MUTE("AUX IN Playback Switch", 0x0b, 0x06, HDA_INPUT), |
| 8318 | { } /* end */ |
| 8319 | }; |
| 8320 | |
Kailang Yang | cd7509a | 2007-01-26 18:33:17 +0100 | [diff] [blame] | 8321 | static struct snd_kcontrol_new alc262_HP_BPC_WildWest_mixer[] = { |
Takashi Iwai | ce875f0 | 2008-01-28 18:17:43 +0100 | [diff] [blame] | 8322 | { |
| 8323 | .iface = SNDRV_CTL_ELEM_IFACE_MIXER, |
| 8324 | .name = "Master Playback Switch", |
| 8325 | .info = snd_ctl_boolean_mono_info, |
| 8326 | .get = alc262_hp_master_sw_get, |
| 8327 | .put = alc262_hp_master_sw_put, |
| 8328 | }, |
Kailang Yang | cd7509a | 2007-01-26 18:33:17 +0100 | [diff] [blame] | 8329 | HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT), |
| 8330 | HDA_CODEC_MUTE("Front Playback Switch", 0x1b, 0x0, HDA_OUTPUT), |
| 8331 | HDA_CODEC_VOLUME("Headphone Playback Volume", 0x0d, 0x0, HDA_OUTPUT), |
| 8332 | HDA_CODEC_MUTE("Headphone Playback Switch", 0x15, 0x0, HDA_OUTPUT), |
Takashi Iwai | ce875f0 | 2008-01-28 18:17:43 +0100 | [diff] [blame] | 8333 | HDA_CODEC_VOLUME_MONO("Speaker Playback Volume", 0x0e, 2, 0x0, |
| 8334 | HDA_OUTPUT), |
| 8335 | HDA_CODEC_MUTE_MONO("Speaker Playback Switch", 0x16, 2, 0x0, |
| 8336 | HDA_OUTPUT), |
Kailang Yang | cd7509a | 2007-01-26 18:33:17 +0100 | [diff] [blame] | 8337 | HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x02, HDA_INPUT), |
| 8338 | HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x02, HDA_INPUT), |
Takashi Iwai | cc69d12 | 2007-02-15 19:29:26 +0100 | [diff] [blame] | 8339 | HDA_CODEC_VOLUME("Front Mic Boost", 0x1a, 0, HDA_INPUT), |
Kailang Yang | cd7509a | 2007-01-26 18:33:17 +0100 | [diff] [blame] | 8340 | HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x01, HDA_INPUT), |
| 8341 | HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x01, HDA_INPUT), |
| 8342 | HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT), |
| 8343 | HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT), |
| 8344 | HDA_CODEC_VOLUME("PC Beep Playback Volume", 0x0b, 0x05, HDA_INPUT), |
| 8345 | HDA_CODEC_MUTE("PC Beep Playback Switch", 0x0b, 0x05, HDA_INPUT), |
| 8346 | { } /* end */ |
| 8347 | }; |
| 8348 | |
| 8349 | static struct snd_kcontrol_new alc262_HP_BPC_WildWest_option_mixer[] = { |
| 8350 | HDA_CODEC_VOLUME("Rear Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), |
| 8351 | HDA_CODEC_MUTE("Rear Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), |
Takashi Iwai | cc69d12 | 2007-02-15 19:29:26 +0100 | [diff] [blame] | 8352 | HDA_CODEC_VOLUME("Rear Mic Boost", 0x18, 0, HDA_INPUT), |
Kailang Yang | cd7509a | 2007-01-26 18:33:17 +0100 | [diff] [blame] | 8353 | { } /* end */ |
| 8354 | }; |
| 8355 | |
Kailang Yang | 66d2a9d | 2007-11-14 12:06:21 +0100 | [diff] [blame] | 8356 | /* mute/unmute internal speaker according to the hp jack and mute state */ |
| 8357 | static void alc262_hp_t5735_automute(struct hda_codec *codec, int force) |
| 8358 | { |
| 8359 | struct alc_spec *spec = codec->spec; |
Kailang Yang | 66d2a9d | 2007-11-14 12:06:21 +0100 | [diff] [blame] | 8360 | |
| 8361 | if (force || !spec->sense_updated) { |
| 8362 | unsigned int present; |
| 8363 | present = snd_hda_codec_read(codec, 0x15, 0, |
| 8364 | AC_VERB_GET_PIN_SENSE, 0); |
Takashi Iwai | 4bb2613 | 2008-01-28 18:12:42 +0100 | [diff] [blame] | 8365 | spec->jack_present = (present & AC_PINSENSE_PRESENCE) != 0; |
Kailang Yang | 66d2a9d | 2007-11-14 12:06:21 +0100 | [diff] [blame] | 8366 | spec->sense_updated = 1; |
| 8367 | } |
Takashi Iwai | 4bb2613 | 2008-01-28 18:12:42 +0100 | [diff] [blame] | 8368 | snd_hda_codec_amp_stereo(codec, 0x0c, HDA_OUTPUT, 0, HDA_AMP_MUTE, |
| 8369 | spec->jack_present ? HDA_AMP_MUTE : 0); |
Kailang Yang | 66d2a9d | 2007-11-14 12:06:21 +0100 | [diff] [blame] | 8370 | } |
| 8371 | |
| 8372 | static void alc262_hp_t5735_unsol_event(struct hda_codec *codec, |
| 8373 | unsigned int res) |
| 8374 | { |
| 8375 | if ((res >> 26) != ALC880_HP_EVENT) |
| 8376 | return; |
| 8377 | alc262_hp_t5735_automute(codec, 1); |
| 8378 | } |
| 8379 | |
| 8380 | static void alc262_hp_t5735_init_hook(struct hda_codec *codec) |
| 8381 | { |
| 8382 | alc262_hp_t5735_automute(codec, 1); |
| 8383 | } |
| 8384 | |
| 8385 | static struct snd_kcontrol_new alc262_hp_t5735_mixer[] = { |
Takashi Iwai | 86cd929 | 2008-01-28 18:09:56 +0100 | [diff] [blame] | 8386 | HDA_CODEC_VOLUME("Speaker Playback Volume", 0x0c, 0x0, HDA_OUTPUT), |
| 8387 | HDA_CODEC_MUTE("Speaker Playback Switch", 0x14, 0x0, HDA_OUTPUT), |
Kailang Yang | 66d2a9d | 2007-11-14 12:06:21 +0100 | [diff] [blame] | 8388 | HDA_CODEC_VOLUME("Headphone Playback Volume", 0x0d, 0x0, HDA_OUTPUT), |
| 8389 | HDA_CODEC_MUTE("Headphone Playback Switch", 0x15, 0x0, HDA_OUTPUT), |
| 8390 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), |
| 8391 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), |
| 8392 | HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT), |
| 8393 | { } /* end */ |
| 8394 | }; |
| 8395 | |
| 8396 | static struct hda_verb alc262_hp_t5735_verbs[] = { |
| 8397 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 8398 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 8399 | |
| 8400 | {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN}, |
| 8401 | { } |
| 8402 | }; |
| 8403 | |
Kailang Yang | 8c42722 | 2008-01-10 13:03:59 +0100 | [diff] [blame] | 8404 | static struct snd_kcontrol_new alc262_hp_rp5700_mixer[] = { |
Takashi Iwai | f2f48e1 | 2008-01-28 18:14:43 +0100 | [diff] [blame] | 8405 | HDA_CODEC_VOLUME("Headphone Playback Volume", 0x0c, 0x0, HDA_OUTPUT), |
| 8406 | HDA_CODEC_MUTE("Headphone Playback Switch", 0x1b, 0x0, HDA_OUTPUT), |
Takashi Iwai | 86cd929 | 2008-01-28 18:09:56 +0100 | [diff] [blame] | 8407 | HDA_CODEC_VOLUME("Speaker Playback Volume", 0x0e, 0x0, HDA_OUTPUT), |
| 8408 | HDA_CODEC_MUTE("Speaker Playback Switch", 0x16, 0x0, HDA_OUTPUT), |
Kailang Yang | 8c42722 | 2008-01-10 13:03:59 +0100 | [diff] [blame] | 8409 | HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x01, HDA_INPUT), |
| 8410 | HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x01, HDA_INPUT), |
| 8411 | { } /* end */ |
| 8412 | }; |
| 8413 | |
| 8414 | static struct hda_verb alc262_hp_rp5700_verbs[] = { |
| 8415 | {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 8416 | {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 8417 | {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 8418 | {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 8419 | {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
| 8420 | {0x1b, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 8421 | {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x01 << 8))}, |
| 8422 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x01 << 8))}, |
| 8423 | {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x00 << 8))}, |
| 8424 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x00 << 8))}, |
| 8425 | {} |
| 8426 | }; |
| 8427 | |
| 8428 | static struct hda_input_mux alc262_hp_rp5700_capture_source = { |
| 8429 | .num_items = 1, |
| 8430 | .items = { |
| 8431 | { "Line", 0x1 }, |
| 8432 | }, |
| 8433 | }; |
| 8434 | |
Takashi Iwai | 0724ea2 | 2007-08-23 00:31:43 +0200 | [diff] [blame] | 8435 | /* bind hp and internal speaker mute (with plug check) */ |
| 8436 | static int alc262_sony_master_sw_put(struct snd_kcontrol *kcontrol, |
| 8437 | struct snd_ctl_elem_value *ucontrol) |
| 8438 | { |
| 8439 | struct hda_codec *codec = snd_kcontrol_chip(kcontrol); |
| 8440 | long *valp = ucontrol->value.integer.value; |
| 8441 | int change; |
| 8442 | |
| 8443 | /* change hp mute */ |
| 8444 | change = snd_hda_codec_amp_update(codec, 0x15, 0, HDA_OUTPUT, 0, |
| 8445 | HDA_AMP_MUTE, |
| 8446 | valp[0] ? 0 : HDA_AMP_MUTE); |
| 8447 | change |= snd_hda_codec_amp_update(codec, 0x15, 1, HDA_OUTPUT, 0, |
| 8448 | HDA_AMP_MUTE, |
| 8449 | valp[1] ? 0 : HDA_AMP_MUTE); |
| 8450 | if (change) { |
| 8451 | /* change speaker according to HP jack state */ |
| 8452 | struct alc_spec *spec = codec->spec; |
| 8453 | unsigned int mute; |
| 8454 | if (spec->jack_present) |
| 8455 | mute = HDA_AMP_MUTE; |
| 8456 | else |
| 8457 | mute = snd_hda_codec_amp_read(codec, 0x15, 0, |
| 8458 | HDA_OUTPUT, 0); |
| 8459 | snd_hda_codec_amp_stereo(codec, 0x14, HDA_OUTPUT, 0, |
| 8460 | HDA_AMP_MUTE, mute); |
| 8461 | } |
| 8462 | return change; |
| 8463 | } |
Takashi Iwai | 5b31954 | 2007-07-26 11:49:22 +0200 | [diff] [blame] | 8464 | |
Kailang Yang | 272a527 | 2007-05-14 11:00:38 +0200 | [diff] [blame] | 8465 | static struct snd_kcontrol_new alc262_sony_mixer[] = { |
Takashi Iwai | 0724ea2 | 2007-08-23 00:31:43 +0200 | [diff] [blame] | 8466 | HDA_CODEC_VOLUME("Master Playback Volume", 0x0c, 0x0, HDA_OUTPUT), |
| 8467 | { |
| 8468 | .iface = SNDRV_CTL_ELEM_IFACE_MIXER, |
| 8469 | .name = "Master Playback Switch", |
| 8470 | .info = snd_hda_mixer_amp_switch_info, |
| 8471 | .get = snd_hda_mixer_amp_switch_get, |
| 8472 | .put = alc262_sony_master_sw_put, |
| 8473 | .private_value = HDA_COMPOSE_AMP_VAL(0x15, 3, 0, HDA_OUTPUT), |
| 8474 | }, |
Kailang Yang | 272a527 | 2007-05-14 11:00:38 +0200 | [diff] [blame] | 8475 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), |
| 8476 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), |
| 8477 | HDA_CODEC_VOLUME("ATAPI Mic Playback Volume", 0x0b, 0x01, HDA_INPUT), |
| 8478 | HDA_CODEC_MUTE("ATAPI Mic Playback Switch", 0x0b, 0x01, HDA_INPUT), |
| 8479 | { } /* end */ |
| 8480 | }; |
| 8481 | |
Kailang Yang | 83c3421 | 2007-07-05 11:43:05 +0200 | [diff] [blame] | 8482 | static struct snd_kcontrol_new alc262_benq_t31_mixer[] = { |
| 8483 | HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT), |
| 8484 | HDA_CODEC_MUTE("Front Playback Switch", 0x14, 0x0, HDA_OUTPUT), |
| 8485 | HDA_CODEC_MUTE("Headphone Playback Switch", 0x15, 0x0, HDA_OUTPUT), |
| 8486 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), |
| 8487 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), |
| 8488 | HDA_CODEC_VOLUME("ATAPI Mic Playback Volume", 0x0b, 0x01, HDA_INPUT), |
| 8489 | HDA_CODEC_MUTE("ATAPI Mic Playback Switch", 0x0b, 0x01, HDA_INPUT), |
| 8490 | { } /* end */ |
| 8491 | }; |
Kailang Yang | 272a527 | 2007-05-14 11:00:38 +0200 | [diff] [blame] | 8492 | |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 8493 | #define alc262_capture_mixer alc882_capture_mixer |
| 8494 | #define alc262_capture_alt_mixer alc882_capture_alt_mixer |
| 8495 | |
| 8496 | /* |
| 8497 | * generic initialization of ADC, input mixers and output mixers |
| 8498 | */ |
| 8499 | static struct hda_verb alc262_init_verbs[] = { |
| 8500 | /* |
| 8501 | * Unmute ADC0-2 and set the default input to mic-in |
| 8502 | */ |
| 8503 | {0x07, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 8504 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 8505 | {0x08, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 8506 | {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 8507 | {0x09, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 8508 | {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 8509 | |
Takashi Iwai | cb53c62 | 2007-08-10 17:21:45 +0200 | [diff] [blame] | 8510 | /* Mute input amps (CD, Line In, Mic 1 & Mic 2) of the analog-loopback |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 8511 | * mixer widget |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 8512 | * Note: PASD motherboards uses the Line In 2 as the input for |
| 8513 | * front panel mic (mic 2) |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 8514 | */ |
| 8515 | /* Amp Indices: Mic1 = 0, Mic2 = 1, Line1 = 2, Line2 = 3, CD = 4 */ |
Takashi Iwai | cb53c62 | 2007-08-10 17:21:45 +0200 | [diff] [blame] | 8516 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 8517 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
| 8518 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)}, |
| 8519 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)}, |
| 8520 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)}, |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 8521 | |
| 8522 | /* |
| 8523 | * Set up output mixers (0x0c - 0x0e) |
| 8524 | */ |
| 8525 | /* set vol=0 to output mixers */ |
| 8526 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 8527 | {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 8528 | {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 8529 | /* set up input amps for analog loopback */ |
| 8530 | /* Amp Indices: DAC = 0, mixer = 1 */ |
| 8531 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 8532 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 8533 | {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 8534 | {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 8535 | {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 8536 | {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 8537 | |
| 8538 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x40}, |
| 8539 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, 0xc0}, |
| 8540 | {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x40}, |
| 8541 | {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24}, |
| 8542 | {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20}, |
| 8543 | {0x1c, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20}, |
| 8544 | |
| 8545 | {0x14, AC_VERB_SET_AMP_GAIN_MUTE, 0x0000}, |
| 8546 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, 0x0000}, |
| 8547 | {0x16, AC_VERB_SET_AMP_GAIN_MUTE, 0x0000}, |
| 8548 | {0x18, AC_VERB_SET_AMP_GAIN_MUTE, 0x0000}, |
| 8549 | {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, 0x0000}, |
| 8550 | |
| 8551 | {0x14, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 8552 | {0x15, AC_VERB_SET_CONNECT_SEL, 0x01}, |
| 8553 | |
| 8554 | /* FIXME: use matrix-type input source selection */ |
| 8555 | /* Mixer elements: 0x18, 19, 1a, 1b, 1c, 1d, 14, 15, 16, 17, 0b */ |
| 8556 | /* Input mixer1: unmute Mic, F-Mic, Line, CD inputs */ |
| 8557 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))}, |
| 8558 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x03 << 8))}, |
| 8559 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x02 << 8))}, |
| 8560 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x04 << 8))}, |
| 8561 | /* Input mixer2 */ |
| 8562 | {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))}, |
| 8563 | {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x03 << 8))}, |
| 8564 | {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x02 << 8))}, |
| 8565 | {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x04 << 8))}, |
| 8566 | /* Input mixer3 */ |
| 8567 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))}, |
| 8568 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x03 << 8))}, |
| 8569 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x02 << 8))}, |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 8570 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x04 << 8))}, |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 8571 | |
| 8572 | { } |
| 8573 | }; |
| 8574 | |
Kailang Yang | ccc656c | 2006-10-17 12:32:26 +0200 | [diff] [blame] | 8575 | static struct hda_verb alc262_hippo_unsol_verbs[] = { |
| 8576 | {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT}, |
| 8577 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 8578 | {} |
| 8579 | }; |
| 8580 | |
| 8581 | static struct hda_verb alc262_hippo1_unsol_verbs[] = { |
| 8582 | {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, 0xc0}, |
| 8583 | {0x1b, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 8584 | {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, 0x0000}, |
| 8585 | |
| 8586 | {0x1b, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT}, |
| 8587 | {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 8588 | {} |
| 8589 | }; |
| 8590 | |
Kailang Yang | 272a527 | 2007-05-14 11:00:38 +0200 | [diff] [blame] | 8591 | static struct hda_verb alc262_sony_unsol_verbs[] = { |
| 8592 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, 0xc0}, |
| 8593 | {0x15, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 8594 | {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24}, // Front Mic |
| 8595 | |
| 8596 | {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT}, |
| 8597 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 8598 | }; |
| 8599 | |
Kailang Yang | ccc656c | 2006-10-17 12:32:26 +0200 | [diff] [blame] | 8600 | /* mute/unmute internal speaker according to the hp jack and mute state */ |
Takashi Iwai | 5b31954 | 2007-07-26 11:49:22 +0200 | [diff] [blame] | 8601 | static void alc262_hippo_automute(struct hda_codec *codec) |
Kailang Yang | ccc656c | 2006-10-17 12:32:26 +0200 | [diff] [blame] | 8602 | { |
| 8603 | struct alc_spec *spec = codec->spec; |
| 8604 | unsigned int mute; |
Takashi Iwai | 5b31954 | 2007-07-26 11:49:22 +0200 | [diff] [blame] | 8605 | unsigned int present; |
Kailang Yang | ccc656c | 2006-10-17 12:32:26 +0200 | [diff] [blame] | 8606 | |
Takashi Iwai | 5b31954 | 2007-07-26 11:49:22 +0200 | [diff] [blame] | 8607 | /* need to execute and sync at first */ |
| 8608 | snd_hda_codec_read(codec, 0x15, 0, AC_VERB_SET_PIN_SENSE, 0); |
| 8609 | present = snd_hda_codec_read(codec, 0x15, 0, |
| 8610 | AC_VERB_GET_PIN_SENSE, 0); |
| 8611 | spec->jack_present = (present & 0x80000000) != 0; |
Kailang Yang | ccc656c | 2006-10-17 12:32:26 +0200 | [diff] [blame] | 8612 | if (spec->jack_present) { |
| 8613 | /* mute internal speaker */ |
Takashi Iwai | 47fd830 | 2007-08-10 17:11:07 +0200 | [diff] [blame] | 8614 | snd_hda_codec_amp_stereo(codec, 0x14, HDA_OUTPUT, 0, |
| 8615 | HDA_AMP_MUTE, HDA_AMP_MUTE); |
Kailang Yang | ccc656c | 2006-10-17 12:32:26 +0200 | [diff] [blame] | 8616 | } else { |
| 8617 | /* unmute internal speaker if necessary */ |
| 8618 | mute = snd_hda_codec_amp_read(codec, 0x15, 0, HDA_OUTPUT, 0); |
Takashi Iwai | 47fd830 | 2007-08-10 17:11:07 +0200 | [diff] [blame] | 8619 | snd_hda_codec_amp_stereo(codec, 0x14, HDA_OUTPUT, 0, |
| 8620 | HDA_AMP_MUTE, mute); |
Kailang Yang | ccc656c | 2006-10-17 12:32:26 +0200 | [diff] [blame] | 8621 | } |
| 8622 | } |
| 8623 | |
| 8624 | /* unsolicited event for HP jack sensing */ |
| 8625 | static void alc262_hippo_unsol_event(struct hda_codec *codec, |
| 8626 | unsigned int res) |
| 8627 | { |
| 8628 | if ((res >> 26) != ALC880_HP_EVENT) |
| 8629 | return; |
Takashi Iwai | 5b31954 | 2007-07-26 11:49:22 +0200 | [diff] [blame] | 8630 | alc262_hippo_automute(codec); |
Kailang Yang | ccc656c | 2006-10-17 12:32:26 +0200 | [diff] [blame] | 8631 | } |
| 8632 | |
Takashi Iwai | 5b31954 | 2007-07-26 11:49:22 +0200 | [diff] [blame] | 8633 | static void alc262_hippo1_automute(struct hda_codec *codec) |
Kailang Yang | ccc656c | 2006-10-17 12:32:26 +0200 | [diff] [blame] | 8634 | { |
Kailang Yang | ccc656c | 2006-10-17 12:32:26 +0200 | [diff] [blame] | 8635 | unsigned int mute; |
Takashi Iwai | 5b31954 | 2007-07-26 11:49:22 +0200 | [diff] [blame] | 8636 | unsigned int present; |
Kailang Yang | ccc656c | 2006-10-17 12:32:26 +0200 | [diff] [blame] | 8637 | |
Takashi Iwai | 5b31954 | 2007-07-26 11:49:22 +0200 | [diff] [blame] | 8638 | snd_hda_codec_read(codec, 0x1b, 0, AC_VERB_SET_PIN_SENSE, 0); |
| 8639 | present = snd_hda_codec_read(codec, 0x1b, 0, |
| 8640 | AC_VERB_GET_PIN_SENSE, 0); |
| 8641 | present = (present & 0x80000000) != 0; |
| 8642 | if (present) { |
Kailang Yang | ccc656c | 2006-10-17 12:32:26 +0200 | [diff] [blame] | 8643 | /* mute internal speaker */ |
Takashi Iwai | 47fd830 | 2007-08-10 17:11:07 +0200 | [diff] [blame] | 8644 | snd_hda_codec_amp_stereo(codec, 0x14, HDA_OUTPUT, 0, |
| 8645 | HDA_AMP_MUTE, HDA_AMP_MUTE); |
Kailang Yang | ccc656c | 2006-10-17 12:32:26 +0200 | [diff] [blame] | 8646 | } else { |
| 8647 | /* unmute internal speaker if necessary */ |
| 8648 | mute = snd_hda_codec_amp_read(codec, 0x1b, 0, HDA_OUTPUT, 0); |
Takashi Iwai | 47fd830 | 2007-08-10 17:11:07 +0200 | [diff] [blame] | 8649 | snd_hda_codec_amp_stereo(codec, 0x14, HDA_OUTPUT, 0, |
| 8650 | HDA_AMP_MUTE, mute); |
Kailang Yang | ccc656c | 2006-10-17 12:32:26 +0200 | [diff] [blame] | 8651 | } |
| 8652 | } |
| 8653 | |
| 8654 | /* unsolicited event for HP jack sensing */ |
| 8655 | static void alc262_hippo1_unsol_event(struct hda_codec *codec, |
| 8656 | unsigned int res) |
| 8657 | { |
| 8658 | if ((res >> 26) != ALC880_HP_EVENT) |
| 8659 | return; |
Takashi Iwai | 5b31954 | 2007-07-26 11:49:22 +0200 | [diff] [blame] | 8660 | alc262_hippo1_automute(codec); |
Kailang Yang | ccc656c | 2006-10-17 12:32:26 +0200 | [diff] [blame] | 8661 | } |
| 8662 | |
Takashi Iwai | 834be88 | 2006-03-01 14:16:17 +0100 | [diff] [blame] | 8663 | /* |
| 8664 | * fujitsu model |
Tony Vroon | 5d9fab2 | 2008-03-14 17:09:18 +0100 | [diff] [blame] | 8665 | * 0x14 = headphone/spdif-out, 0x15 = internal speaker, |
| 8666 | * 0x1b = port replicator headphone out |
Takashi Iwai | 834be88 | 2006-03-01 14:16:17 +0100 | [diff] [blame] | 8667 | */ |
| 8668 | |
| 8669 | #define ALC_HP_EVENT 0x37 |
| 8670 | |
| 8671 | static struct hda_verb alc262_fujitsu_unsol_verbs[] = { |
| 8672 | {0x14, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC_HP_EVENT}, |
| 8673 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
Tony Vroon | 5d9fab2 | 2008-03-14 17:09:18 +0100 | [diff] [blame] | 8674 | {0x1b, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC_HP_EVENT}, |
| 8675 | {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
Takashi Iwai | 834be88 | 2006-03-01 14:16:17 +0100 | [diff] [blame] | 8676 | {} |
| 8677 | }; |
| 8678 | |
Jiang zhe | 0e31daf | 2008-03-20 12:12:39 +0100 | [diff] [blame] | 8679 | static struct hda_verb alc262_lenovo_3000_unsol_verbs[] = { |
| 8680 | {0x1b, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC_HP_EVENT}, |
| 8681 | {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 8682 | {} |
| 8683 | }; |
| 8684 | |
Takashi Iwai | 834be88 | 2006-03-01 14:16:17 +0100 | [diff] [blame] | 8685 | static struct hda_input_mux alc262_fujitsu_capture_source = { |
Takashi Iwai | 39d3ed3 | 2007-10-12 15:03:48 +0200 | [diff] [blame] | 8686 | .num_items = 3, |
Takashi Iwai | 834be88 | 2006-03-01 14:16:17 +0100 | [diff] [blame] | 8687 | .items = { |
| 8688 | { "Mic", 0x0 }, |
Takashi Iwai | 39d3ed3 | 2007-10-12 15:03:48 +0200 | [diff] [blame] | 8689 | { "Int Mic", 0x1 }, |
Takashi Iwai | 834be88 | 2006-03-01 14:16:17 +0100 | [diff] [blame] | 8690 | { "CD", 0x4 }, |
| 8691 | }, |
| 8692 | }; |
| 8693 | |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 8694 | static struct hda_input_mux alc262_HP_capture_source = { |
| 8695 | .num_items = 5, |
| 8696 | .items = { |
| 8697 | { "Mic", 0x0 }, |
zhejiang | accbe49 | 2007-08-31 12:36:05 +0200 | [diff] [blame] | 8698 | { "Front Mic", 0x1 }, |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 8699 | { "Line", 0x2 }, |
| 8700 | { "CD", 0x4 }, |
| 8701 | { "AUX IN", 0x6 }, |
| 8702 | }, |
| 8703 | }; |
| 8704 | |
zhejiang | accbe49 | 2007-08-31 12:36:05 +0200 | [diff] [blame] | 8705 | static struct hda_input_mux alc262_HP_D7000_capture_source = { |
| 8706 | .num_items = 4, |
| 8707 | .items = { |
| 8708 | { "Mic", 0x0 }, |
| 8709 | { "Front Mic", 0x2 }, |
| 8710 | { "Line", 0x1 }, |
| 8711 | { "CD", 0x4 }, |
| 8712 | }, |
| 8713 | }; |
| 8714 | |
Takashi Iwai | 834be88 | 2006-03-01 14:16:17 +0100 | [diff] [blame] | 8715 | /* mute/unmute internal speaker according to the hp jack and mute state */ |
| 8716 | static void alc262_fujitsu_automute(struct hda_codec *codec, int force) |
| 8717 | { |
| 8718 | struct alc_spec *spec = codec->spec; |
| 8719 | unsigned int mute; |
| 8720 | |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 8721 | if (force || !spec->sense_updated) { |
Tony Vroon | 5d9fab2 | 2008-03-14 17:09:18 +0100 | [diff] [blame] | 8722 | unsigned int present_int_hp, present_dock_hp; |
Takashi Iwai | 834be88 | 2006-03-01 14:16:17 +0100 | [diff] [blame] | 8723 | /* need to execute and sync at first */ |
| 8724 | snd_hda_codec_read(codec, 0x14, 0, AC_VERB_SET_PIN_SENSE, 0); |
Tony Vroon | 5d9fab2 | 2008-03-14 17:09:18 +0100 | [diff] [blame] | 8725 | present_int_hp = snd_hda_codec_read(codec, 0x14, 0, |
| 8726 | AC_VERB_GET_PIN_SENSE, 0); |
| 8727 | snd_hda_codec_read(codec, 0x1B, 0, AC_VERB_SET_PIN_SENSE, 0); |
| 8728 | present_dock_hp = snd_hda_codec_read(codec, 0x1b, 0, |
| 8729 | AC_VERB_GET_PIN_SENSE, 0); |
| 8730 | spec->jack_present = (present_int_hp & 0x80000000) != 0; |
| 8731 | spec->jack_present |= (present_dock_hp & 0x80000000) != 0; |
Takashi Iwai | 834be88 | 2006-03-01 14:16:17 +0100 | [diff] [blame] | 8732 | spec->sense_updated = 1; |
| 8733 | } |
| 8734 | if (spec->jack_present) { |
| 8735 | /* mute internal speaker */ |
Takashi Iwai | 47fd830 | 2007-08-10 17:11:07 +0200 | [diff] [blame] | 8736 | snd_hda_codec_amp_stereo(codec, 0x15, HDA_OUTPUT, 0, |
| 8737 | HDA_AMP_MUTE, HDA_AMP_MUTE); |
Takashi Iwai | 834be88 | 2006-03-01 14:16:17 +0100 | [diff] [blame] | 8738 | } else { |
| 8739 | /* unmute internal speaker if necessary */ |
| 8740 | mute = snd_hda_codec_amp_read(codec, 0x14, 0, HDA_OUTPUT, 0); |
Takashi Iwai | 47fd830 | 2007-08-10 17:11:07 +0200 | [diff] [blame] | 8741 | snd_hda_codec_amp_stereo(codec, 0x15, HDA_OUTPUT, 0, |
| 8742 | HDA_AMP_MUTE, mute); |
Takashi Iwai | 834be88 | 2006-03-01 14:16:17 +0100 | [diff] [blame] | 8743 | } |
| 8744 | } |
| 8745 | |
| 8746 | /* unsolicited event for HP jack sensing */ |
| 8747 | static void alc262_fujitsu_unsol_event(struct hda_codec *codec, |
| 8748 | unsigned int res) |
| 8749 | { |
| 8750 | if ((res >> 26) != ALC_HP_EVENT) |
| 8751 | return; |
| 8752 | alc262_fujitsu_automute(codec, 1); |
| 8753 | } |
| 8754 | |
| 8755 | /* bind volumes of both NID 0x0c and 0x0d */ |
Takashi Iwai | cca3b37 | 2007-08-10 17:12:15 +0200 | [diff] [blame] | 8756 | static struct hda_bind_ctls alc262_fujitsu_bind_master_vol = { |
| 8757 | .ops = &snd_hda_bind_vol, |
| 8758 | .values = { |
| 8759 | HDA_COMPOSE_AMP_VAL(0x0c, 3, 0, HDA_OUTPUT), |
| 8760 | HDA_COMPOSE_AMP_VAL(0x0d, 3, 0, HDA_OUTPUT), |
| 8761 | 0 |
| 8762 | }, |
| 8763 | }; |
Takashi Iwai | 834be88 | 2006-03-01 14:16:17 +0100 | [diff] [blame] | 8764 | |
Jiang zhe | 0e31daf | 2008-03-20 12:12:39 +0100 | [diff] [blame] | 8765 | /* mute/unmute internal speaker according to the hp jack and mute state */ |
| 8766 | static void alc262_lenovo_3000_automute(struct hda_codec *codec, int force) |
| 8767 | { |
| 8768 | struct alc_spec *spec = codec->spec; |
| 8769 | unsigned int mute; |
| 8770 | |
| 8771 | if (force || !spec->sense_updated) { |
| 8772 | unsigned int present_int_hp; |
| 8773 | /* need to execute and sync at first */ |
| 8774 | snd_hda_codec_read(codec, 0x1b, 0, AC_VERB_SET_PIN_SENSE, 0); |
| 8775 | present_int_hp = snd_hda_codec_read(codec, 0x1b, 0, |
| 8776 | AC_VERB_GET_PIN_SENSE, 0); |
| 8777 | spec->jack_present = (present_int_hp & 0x80000000) != 0; |
| 8778 | spec->sense_updated = 1; |
| 8779 | } |
| 8780 | if (spec->jack_present) { |
| 8781 | /* mute internal speaker */ |
| 8782 | snd_hda_codec_amp_stereo(codec, 0x14, HDA_OUTPUT, 0, |
| 8783 | HDA_AMP_MUTE, HDA_AMP_MUTE); |
| 8784 | snd_hda_codec_amp_stereo(codec, 0x16, HDA_OUTPUT, 0, |
| 8785 | HDA_AMP_MUTE, HDA_AMP_MUTE); |
| 8786 | } else { |
| 8787 | /* unmute internal speaker if necessary */ |
| 8788 | mute = snd_hda_codec_amp_read(codec, 0x1b, 0, HDA_OUTPUT, 0); |
| 8789 | snd_hda_codec_amp_stereo(codec, 0x14, HDA_OUTPUT, 0, |
| 8790 | HDA_AMP_MUTE, mute); |
| 8791 | snd_hda_codec_amp_stereo(codec, 0x16, HDA_OUTPUT, 0, |
| 8792 | HDA_AMP_MUTE, mute); |
| 8793 | } |
| 8794 | } |
| 8795 | |
| 8796 | /* unsolicited event for HP jack sensing */ |
| 8797 | static void alc262_lenovo_3000_unsol_event(struct hda_codec *codec, |
| 8798 | unsigned int res) |
| 8799 | { |
| 8800 | if ((res >> 26) != ALC_HP_EVENT) |
| 8801 | return; |
| 8802 | alc262_lenovo_3000_automute(codec, 1); |
| 8803 | } |
| 8804 | |
Takashi Iwai | 834be88 | 2006-03-01 14:16:17 +0100 | [diff] [blame] | 8805 | /* bind hp and internal speaker mute (with plug check) */ |
| 8806 | static int alc262_fujitsu_master_sw_put(struct snd_kcontrol *kcontrol, |
| 8807 | struct snd_ctl_elem_value *ucontrol) |
| 8808 | { |
| 8809 | struct hda_codec *codec = snd_kcontrol_chip(kcontrol); |
| 8810 | long *valp = ucontrol->value.integer.value; |
| 8811 | int change; |
| 8812 | |
Tony Vroon | 5d9fab2 | 2008-03-14 17:09:18 +0100 | [diff] [blame] | 8813 | change = snd_hda_codec_amp_stereo(codec, 0x14, HDA_OUTPUT, 0, |
| 8814 | HDA_AMP_MUTE, |
| 8815 | valp ? 0 : HDA_AMP_MUTE); |
| 8816 | change |= snd_hda_codec_amp_stereo(codec, 0x1b, HDA_OUTPUT, 0, |
| 8817 | HDA_AMP_MUTE, |
| 8818 | valp ? 0 : HDA_AMP_MUTE); |
| 8819 | |
Takashi Iwai | 82beb8f | 2007-08-10 17:09:26 +0200 | [diff] [blame] | 8820 | if (change) |
| 8821 | alc262_fujitsu_automute(codec, 0); |
Takashi Iwai | 834be88 | 2006-03-01 14:16:17 +0100 | [diff] [blame] | 8822 | return change; |
| 8823 | } |
| 8824 | |
| 8825 | static struct snd_kcontrol_new alc262_fujitsu_mixer[] = { |
Takashi Iwai | cca3b37 | 2007-08-10 17:12:15 +0200 | [diff] [blame] | 8826 | HDA_BIND_VOL("Master Playback Volume", &alc262_fujitsu_bind_master_vol), |
Takashi Iwai | 834be88 | 2006-03-01 14:16:17 +0100 | [diff] [blame] | 8827 | { |
| 8828 | .iface = SNDRV_CTL_ELEM_IFACE_MIXER, |
| 8829 | .name = "Master Playback Switch", |
| 8830 | .info = snd_hda_mixer_amp_switch_info, |
| 8831 | .get = snd_hda_mixer_amp_switch_get, |
| 8832 | .put = alc262_fujitsu_master_sw_put, |
| 8833 | .private_value = HDA_COMPOSE_AMP_VAL(0x14, 3, 0, HDA_OUTPUT), |
| 8834 | }, |
| 8835 | HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT), |
| 8836 | HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT), |
| 8837 | HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT), |
| 8838 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), |
| 8839 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), |
Takashi Iwai | 39d3ed3 | 2007-10-12 15:03:48 +0200 | [diff] [blame] | 8840 | HDA_CODEC_VOLUME("Int Mic Boost", 0x19, 0, HDA_INPUT), |
| 8841 | HDA_CODEC_VOLUME("Int Mic Playback Volume", 0x0b, 0x1, HDA_INPUT), |
| 8842 | HDA_CODEC_MUTE("Int Mic Playback Switch", 0x0b, 0x1, HDA_INPUT), |
Takashi Iwai | 834be88 | 2006-03-01 14:16:17 +0100 | [diff] [blame] | 8843 | { } /* end */ |
| 8844 | }; |
| 8845 | |
Jiang zhe | 0e31daf | 2008-03-20 12:12:39 +0100 | [diff] [blame] | 8846 | /* bind hp and internal speaker mute (with plug check) */ |
| 8847 | static int alc262_lenovo_3000_master_sw_put(struct snd_kcontrol *kcontrol, |
| 8848 | struct snd_ctl_elem_value *ucontrol) |
| 8849 | { |
| 8850 | struct hda_codec *codec = snd_kcontrol_chip(kcontrol); |
| 8851 | long *valp = ucontrol->value.integer.value; |
| 8852 | int change; |
| 8853 | |
| 8854 | change = snd_hda_codec_amp_stereo(codec, 0x1b, HDA_OUTPUT, 0, |
| 8855 | HDA_AMP_MUTE, |
| 8856 | valp ? 0 : HDA_AMP_MUTE); |
| 8857 | |
| 8858 | if (change) |
| 8859 | alc262_lenovo_3000_automute(codec, 0); |
| 8860 | return change; |
| 8861 | } |
| 8862 | |
| 8863 | static struct snd_kcontrol_new alc262_lenovo_3000_mixer[] = { |
| 8864 | HDA_BIND_VOL("Master Playback Volume", &alc262_fujitsu_bind_master_vol), |
| 8865 | { |
| 8866 | .iface = SNDRV_CTL_ELEM_IFACE_MIXER, |
| 8867 | .name = "Master Playback Switch", |
| 8868 | .info = snd_hda_mixer_amp_switch_info, |
| 8869 | .get = snd_hda_mixer_amp_switch_get, |
| 8870 | .put = alc262_lenovo_3000_master_sw_put, |
| 8871 | .private_value = HDA_COMPOSE_AMP_VAL(0x1b, 3, 0, HDA_OUTPUT), |
| 8872 | }, |
| 8873 | HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT), |
| 8874 | HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT), |
| 8875 | HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT), |
| 8876 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), |
| 8877 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), |
| 8878 | HDA_CODEC_VOLUME("Int Mic Boost", 0x19, 0, HDA_INPUT), |
| 8879 | HDA_CODEC_VOLUME("Int Mic Playback Volume", 0x0b, 0x1, HDA_INPUT), |
| 8880 | HDA_CODEC_MUTE("Int Mic Playback Switch", 0x0b, 0x1, HDA_INPUT), |
| 8881 | { } /* end */ |
| 8882 | }; |
| 8883 | |
Takashi Iwai | 304dcaa | 2006-07-25 14:51:16 +0200 | [diff] [blame] | 8884 | /* additional init verbs for Benq laptops */ |
| 8885 | static struct hda_verb alc262_EAPD_verbs[] = { |
| 8886 | {0x20, AC_VERB_SET_COEF_INDEX, 0x07}, |
| 8887 | {0x20, AC_VERB_SET_PROC_COEF, 0x3070}, |
| 8888 | {} |
| 8889 | }; |
| 8890 | |
Kailang Yang | 83c3421 | 2007-07-05 11:43:05 +0200 | [diff] [blame] | 8891 | static struct hda_verb alc262_benq_t31_EAPD_verbs[] = { |
| 8892 | {0x15, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 8893 | {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24}, |
| 8894 | |
| 8895 | {0x20, AC_VERB_SET_COEF_INDEX, 0x07}, |
| 8896 | {0x20, AC_VERB_SET_PROC_COEF, 0x3050}, |
| 8897 | {} |
| 8898 | }; |
| 8899 | |
Tobin Davis | f651b50 | 2007-10-26 12:40:47 +0200 | [diff] [blame] | 8900 | /* Samsung Q1 Ultra Vista model setup */ |
| 8901 | static struct snd_kcontrol_new alc262_ultra_mixer[] = { |
Takashi Iwai | bb9f76c | 2008-03-12 12:51:09 +0100 | [diff] [blame] | 8902 | HDA_CODEC_VOLUME("Master Playback Volume", 0x0c, 0x0, HDA_OUTPUT), |
| 8903 | HDA_BIND_MUTE("Master Playback Switch", 0x0c, 2, HDA_INPUT), |
Tobin Davis | f651b50 | 2007-10-26 12:40:47 +0200 | [diff] [blame] | 8904 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x01, HDA_INPUT), |
| 8905 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x01, HDA_INPUT), |
| 8906 | HDA_CODEC_VOLUME("Mic Boost", 0x19, 0, HDA_INPUT), |
Takashi Iwai | bb9f76c | 2008-03-12 12:51:09 +0100 | [diff] [blame] | 8907 | HDA_CODEC_VOLUME("Headphone Mic Boost", 0x15, 0, HDA_INPUT), |
Tobin Davis | f651b50 | 2007-10-26 12:40:47 +0200 | [diff] [blame] | 8908 | { } /* end */ |
| 8909 | }; |
| 8910 | |
| 8911 | static struct hda_verb alc262_ultra_verbs[] = { |
Takashi Iwai | bb9f76c | 2008-03-12 12:51:09 +0100 | [diff] [blame] | 8912 | /* output mixer */ |
| 8913 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 8914 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
| 8915 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 8916 | /* speaker */ |
| 8917 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 8918 | {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
| 8919 | {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 8920 | {0x14, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 8921 | /* HP */ |
Tobin Davis | f651b50 | 2007-10-26 12:40:47 +0200 | [diff] [blame] | 8922 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
Takashi Iwai | bb9f76c | 2008-03-12 12:51:09 +0100 | [diff] [blame] | 8923 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
| 8924 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 8925 | {0x15, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 8926 | {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT}, |
| 8927 | /* internal mic */ |
| 8928 | {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80}, |
| 8929 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
| 8930 | /* ADC, choose mic */ |
| 8931 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 8932 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 8933 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 8934 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)}, |
| 8935 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)}, |
| 8936 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)}, |
| 8937 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(5)}, |
| 8938 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(6)}, |
| 8939 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(7)}, |
| 8940 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(8)}, |
Tobin Davis | f651b50 | 2007-10-26 12:40:47 +0200 | [diff] [blame] | 8941 | {} |
| 8942 | }; |
| 8943 | |
Tobin Davis | f651b50 | 2007-10-26 12:40:47 +0200 | [diff] [blame] | 8944 | /* mute/unmute internal speaker according to the hp jack and mute state */ |
| 8945 | static void alc262_ultra_automute(struct hda_codec *codec) |
| 8946 | { |
| 8947 | struct alc_spec *spec = codec->spec; |
| 8948 | unsigned int mute; |
Tobin Davis | f651b50 | 2007-10-26 12:40:47 +0200 | [diff] [blame] | 8949 | |
Takashi Iwai | bb9f76c | 2008-03-12 12:51:09 +0100 | [diff] [blame] | 8950 | mute = 0; |
| 8951 | /* auto-mute only when HP is used as HP */ |
| 8952 | if (!spec->cur_mux[0]) { |
| 8953 | unsigned int present; |
| 8954 | /* need to execute and sync at first */ |
| 8955 | snd_hda_codec_read(codec, 0x15, 0, AC_VERB_SET_PIN_SENSE, 0); |
| 8956 | present = snd_hda_codec_read(codec, 0x15, 0, |
| 8957 | AC_VERB_GET_PIN_SENSE, 0); |
| 8958 | spec->jack_present = (present & AC_PINSENSE_PRESENCE) != 0; |
| 8959 | if (spec->jack_present) |
| 8960 | mute = HDA_AMP_MUTE; |
Tobin Davis | f651b50 | 2007-10-26 12:40:47 +0200 | [diff] [blame] | 8961 | } |
Takashi Iwai | bb9f76c | 2008-03-12 12:51:09 +0100 | [diff] [blame] | 8962 | /* mute/unmute internal speaker */ |
| 8963 | snd_hda_codec_amp_stereo(codec, 0x14, HDA_OUTPUT, 0, |
| 8964 | HDA_AMP_MUTE, mute); |
| 8965 | /* mute/unmute HP */ |
| 8966 | snd_hda_codec_amp_stereo(codec, 0x15, HDA_OUTPUT, 0, |
| 8967 | HDA_AMP_MUTE, mute ? 0 : HDA_AMP_MUTE); |
Tobin Davis | f651b50 | 2007-10-26 12:40:47 +0200 | [diff] [blame] | 8968 | } |
| 8969 | |
| 8970 | /* unsolicited event for HP jack sensing */ |
| 8971 | static void alc262_ultra_unsol_event(struct hda_codec *codec, |
| 8972 | unsigned int res) |
| 8973 | { |
| 8974 | if ((res >> 26) != ALC880_HP_EVENT) |
| 8975 | return; |
| 8976 | alc262_ultra_automute(codec); |
| 8977 | } |
| 8978 | |
Takashi Iwai | bb9f76c | 2008-03-12 12:51:09 +0100 | [diff] [blame] | 8979 | static struct hda_input_mux alc262_ultra_capture_source = { |
| 8980 | .num_items = 2, |
| 8981 | .items = { |
| 8982 | { "Mic", 0x1 }, |
| 8983 | { "Headphone", 0x7 }, |
| 8984 | }, |
| 8985 | }; |
| 8986 | |
| 8987 | static int alc262_ultra_mux_enum_put(struct snd_kcontrol *kcontrol, |
| 8988 | struct snd_ctl_elem_value *ucontrol) |
| 8989 | { |
| 8990 | struct hda_codec *codec = snd_kcontrol_chip(kcontrol); |
| 8991 | struct alc_spec *spec = codec->spec; |
| 8992 | int ret; |
| 8993 | |
| 8994 | ret = alc882_mux_enum_put(kcontrol, ucontrol); |
| 8995 | if (!ret) |
| 8996 | return 0; |
| 8997 | /* reprogram the HP pin as mic or HP according to the input source */ |
| 8998 | snd_hda_codec_write_cache(codec, 0x15, 0, |
| 8999 | AC_VERB_SET_PIN_WIDGET_CONTROL, |
| 9000 | spec->cur_mux[0] ? PIN_VREF80 : PIN_HP); |
| 9001 | alc262_ultra_automute(codec); /* mute/unmute HP */ |
| 9002 | return ret; |
| 9003 | } |
| 9004 | |
| 9005 | static struct snd_kcontrol_new alc262_ultra_capture_mixer[] = { |
| 9006 | HDA_CODEC_VOLUME("Capture Volume", 0x07, 0x0, HDA_INPUT), |
| 9007 | HDA_CODEC_MUTE("Capture Switch", 0x07, 0x0, HDA_INPUT), |
| 9008 | { |
| 9009 | .iface = SNDRV_CTL_ELEM_IFACE_MIXER, |
| 9010 | .name = "Capture Source", |
| 9011 | .info = alc882_mux_enum_info, |
| 9012 | .get = alc882_mux_enum_get, |
| 9013 | .put = alc262_ultra_mux_enum_put, |
| 9014 | }, |
| 9015 | { } /* end */ |
| 9016 | }; |
| 9017 | |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 9018 | /* add playback controls from the parsed DAC table */ |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 9019 | static int alc262_auto_create_multi_out_ctls(struct alc_spec *spec, |
| 9020 | const struct auto_pin_cfg *cfg) |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 9021 | { |
| 9022 | hda_nid_t nid; |
| 9023 | int err; |
| 9024 | |
| 9025 | spec->multiout.num_dacs = 1; /* only use one dac */ |
| 9026 | spec->multiout.dac_nids = spec->private_dac_nids; |
| 9027 | spec->multiout.dac_nids[0] = 2; |
| 9028 | |
| 9029 | nid = cfg->line_out_pins[0]; |
| 9030 | if (nid) { |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 9031 | err = add_control(spec, ALC_CTL_WIDGET_VOL, |
| 9032 | "Front Playback Volume", |
| 9033 | HDA_COMPOSE_AMP_VAL(0x0c, 3, 0, HDA_OUTPUT)); |
| 9034 | if (err < 0) |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 9035 | return err; |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 9036 | err = add_control(spec, ALC_CTL_WIDGET_MUTE, |
| 9037 | "Front Playback Switch", |
| 9038 | HDA_COMPOSE_AMP_VAL(nid, 3, 0, HDA_OUTPUT)); |
| 9039 | if (err < 0) |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 9040 | return err; |
| 9041 | } |
| 9042 | |
Takashi Iwai | 82bc955 | 2006-03-21 11:24:42 +0100 | [diff] [blame] | 9043 | nid = cfg->speaker_pins[0]; |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 9044 | if (nid) { |
| 9045 | if (nid == 0x16) { |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 9046 | err = add_control(spec, ALC_CTL_WIDGET_VOL, |
| 9047 | "Speaker Playback Volume", |
| 9048 | HDA_COMPOSE_AMP_VAL(0x0e, 2, 0, |
| 9049 | HDA_OUTPUT)); |
| 9050 | if (err < 0) |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 9051 | return err; |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 9052 | err = add_control(spec, ALC_CTL_WIDGET_MUTE, |
| 9053 | "Speaker Playback Switch", |
| 9054 | HDA_COMPOSE_AMP_VAL(nid, 2, 0, |
| 9055 | HDA_OUTPUT)); |
| 9056 | if (err < 0) |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 9057 | return err; |
| 9058 | } else { |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 9059 | err = add_control(spec, ALC_CTL_WIDGET_MUTE, |
| 9060 | "Speaker Playback Switch", |
| 9061 | HDA_COMPOSE_AMP_VAL(nid, 3, 0, |
| 9062 | HDA_OUTPUT)); |
| 9063 | if (err < 0) |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 9064 | return err; |
| 9065 | } |
| 9066 | } |
Takashi Iwai | eb06ed8 | 2006-09-20 17:10:27 +0200 | [diff] [blame] | 9067 | nid = cfg->hp_pins[0]; |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 9068 | if (nid) { |
| 9069 | /* spec->multiout.hp_nid = 2; */ |
| 9070 | if (nid == 0x16) { |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 9071 | err = add_control(spec, ALC_CTL_WIDGET_VOL, |
| 9072 | "Headphone Playback Volume", |
| 9073 | HDA_COMPOSE_AMP_VAL(0x0e, 2, 0, |
| 9074 | HDA_OUTPUT)); |
| 9075 | if (err < 0) |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 9076 | return err; |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 9077 | err = add_control(spec, ALC_CTL_WIDGET_MUTE, |
| 9078 | "Headphone Playback Switch", |
| 9079 | HDA_COMPOSE_AMP_VAL(nid, 2, 0, |
| 9080 | HDA_OUTPUT)); |
| 9081 | if (err < 0) |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 9082 | return err; |
| 9083 | } else { |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 9084 | err = add_control(spec, ALC_CTL_WIDGET_MUTE, |
| 9085 | "Headphone Playback Switch", |
| 9086 | HDA_COMPOSE_AMP_VAL(nid, 3, 0, |
| 9087 | HDA_OUTPUT)); |
| 9088 | if (err < 0) |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 9089 | return err; |
| 9090 | } |
| 9091 | } |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 9092 | return 0; |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 9093 | } |
| 9094 | |
| 9095 | /* identical with ALC880 */ |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 9096 | #define alc262_auto_create_analog_input_ctls \ |
| 9097 | alc880_auto_create_analog_input_ctls |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 9098 | |
| 9099 | /* |
| 9100 | * generic initialization of ADC, input mixers and output mixers |
| 9101 | */ |
| 9102 | static struct hda_verb alc262_volume_init_verbs[] = { |
| 9103 | /* |
| 9104 | * Unmute ADC0-2 and set the default input to mic-in |
| 9105 | */ |
| 9106 | {0x07, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 9107 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 9108 | {0x08, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 9109 | {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 9110 | {0x09, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 9111 | {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 9112 | |
Takashi Iwai | cb53c62 | 2007-08-10 17:21:45 +0200 | [diff] [blame] | 9113 | /* Mute input amps (CD, Line In, Mic 1 & Mic 2) of the analog-loopback |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 9114 | * mixer widget |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 9115 | * Note: PASD motherboards uses the Line In 2 as the input for |
| 9116 | * front panel mic (mic 2) |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 9117 | */ |
| 9118 | /* Amp Indices: Mic1 = 0, Mic2 = 1, Line1 = 2, Line2 = 3, CD = 4 */ |
Takashi Iwai | cb53c62 | 2007-08-10 17:21:45 +0200 | [diff] [blame] | 9119 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 9120 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
| 9121 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)}, |
| 9122 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)}, |
| 9123 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)}, |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 9124 | |
| 9125 | /* |
| 9126 | * Set up output mixers (0x0c - 0x0f) |
| 9127 | */ |
| 9128 | /* set vol=0 to output mixers */ |
| 9129 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 9130 | {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 9131 | {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 9132 | |
| 9133 | /* set up input amps for analog loopback */ |
| 9134 | /* Amp Indices: DAC = 0, mixer = 1 */ |
| 9135 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 9136 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 9137 | {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 9138 | {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 9139 | {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 9140 | {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 9141 | |
| 9142 | /* FIXME: use matrix-type input source selection */ |
| 9143 | /* Mixer elements: 0x18, 19, 1a, 1b, 1c, 1d, 14, 15, 16, 17, 0b */ |
| 9144 | /* Input mixer1: unmute Mic, F-Mic, Line, CD inputs */ |
| 9145 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))}, |
| 9146 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x03 << 8))}, |
| 9147 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x02 << 8))}, |
| 9148 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x04 << 8))}, |
| 9149 | /* Input mixer2 */ |
| 9150 | {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))}, |
| 9151 | {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x03 << 8))}, |
| 9152 | {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x02 << 8))}, |
| 9153 | {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x04 << 8))}, |
| 9154 | /* Input mixer3 */ |
| 9155 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))}, |
| 9156 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x03 << 8))}, |
| 9157 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x02 << 8))}, |
| 9158 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x04 << 8))}, |
| 9159 | |
| 9160 | { } |
| 9161 | }; |
| 9162 | |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 9163 | static struct hda_verb alc262_HP_BPC_init_verbs[] = { |
| 9164 | /* |
| 9165 | * Unmute ADC0-2 and set the default input to mic-in |
| 9166 | */ |
| 9167 | {0x07, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 9168 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 9169 | {0x08, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 9170 | {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 9171 | {0x09, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 9172 | {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 9173 | |
Takashi Iwai | cb53c62 | 2007-08-10 17:21:45 +0200 | [diff] [blame] | 9174 | /* Mute input amps (CD, Line In, Mic 1 & Mic 2) of the analog-loopback |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 9175 | * mixer widget |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 9176 | * Note: PASD motherboards uses the Line In 2 as the input for |
| 9177 | * front panel mic (mic 2) |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 9178 | */ |
| 9179 | /* Amp Indices: Mic1 = 0, Mic2 = 1, Line1 = 2, Line2 = 3, CD = 4 */ |
Takashi Iwai | cb53c62 | 2007-08-10 17:21:45 +0200 | [diff] [blame] | 9180 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 9181 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
| 9182 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)}, |
| 9183 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)}, |
| 9184 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)}, |
| 9185 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(5)}, |
| 9186 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(6)}, |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 9187 | |
| 9188 | /* |
| 9189 | * Set up output mixers (0x0c - 0x0e) |
| 9190 | */ |
| 9191 | /* set vol=0 to output mixers */ |
| 9192 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 9193 | {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 9194 | {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 9195 | |
| 9196 | /* set up input amps for analog loopback */ |
| 9197 | /* Amp Indices: DAC = 0, mixer = 1 */ |
| 9198 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 9199 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 9200 | {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 9201 | {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 9202 | {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 9203 | {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 9204 | |
Takashi Iwai | ce875f0 | 2008-01-28 18:17:43 +0100 | [diff] [blame] | 9205 | {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 9206 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, |
| 9207 | {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, |
| 9208 | |
| 9209 | {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE }, |
| 9210 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE }, |
| 9211 | |
| 9212 | {0x1b, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 9213 | {0x15, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 9214 | |
| 9215 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20}, |
| 9216 | {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24}, |
| 9217 | {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24}, |
| 9218 | {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20}, |
| 9219 | {0x1c, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20}, |
| 9220 | |
| 9221 | {0x14, AC_VERB_SET_AMP_GAIN_MUTE, 0x7023 }, |
| 9222 | {0x18, AC_VERB_SET_AMP_GAIN_MUTE, 0x7000 }, |
| 9223 | {0x19, AC_VERB_SET_AMP_GAIN_MUTE, 0x7000 }, |
| 9224 | {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, 0x7023 }, |
| 9225 | {0x1c, AC_VERB_SET_AMP_GAIN_MUTE, 0x7000 }, |
| 9226 | {0x1d, AC_VERB_SET_AMP_GAIN_MUTE, 0x7000 }, |
| 9227 | |
| 9228 | |
| 9229 | /* FIXME: use matrix-type input source selection */ |
| 9230 | /* Mixer elements: 0x18, 19, 1a, 1b, 1c, 1d, 14, 15, 16, 17, 0b */ |
| 9231 | /* Input mixer1: unmute Mic, F-Mic, Line, CD inputs */ |
| 9232 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))}, |
| 9233 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x03 << 8))}, |
| 9234 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x02 << 8))}, |
| 9235 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x04 << 8))}, |
| 9236 | /* Input mixer2 */ |
| 9237 | {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))}, |
| 9238 | {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x03 << 8))}, |
| 9239 | {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x02 << 8))}, |
| 9240 | {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x04 << 8))}, |
| 9241 | /* Input mixer3 */ |
| 9242 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))}, |
| 9243 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x03 << 8))}, |
| 9244 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x02 << 8))}, |
| 9245 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x04 << 8))}, |
| 9246 | |
Takashi Iwai | ce875f0 | 2008-01-28 18:17:43 +0100 | [diff] [blame] | 9247 | {0x1b, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN}, |
| 9248 | |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 9249 | { } |
| 9250 | }; |
| 9251 | |
Kailang Yang | cd7509a | 2007-01-26 18:33:17 +0100 | [diff] [blame] | 9252 | static struct hda_verb alc262_HP_BPC_WildWest_init_verbs[] = { |
| 9253 | /* |
| 9254 | * Unmute ADC0-2 and set the default input to mic-in |
| 9255 | */ |
| 9256 | {0x07, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 9257 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 9258 | {0x08, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 9259 | {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 9260 | {0x09, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 9261 | {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 9262 | |
Takashi Iwai | cb53c62 | 2007-08-10 17:21:45 +0200 | [diff] [blame] | 9263 | /* Mute input amps (CD, Line In, Mic 1 & Mic 2) of the analog-loopback |
Kailang Yang | cd7509a | 2007-01-26 18:33:17 +0100 | [diff] [blame] | 9264 | * mixer widget |
| 9265 | * Note: PASD motherboards uses the Line In 2 as the input for front |
| 9266 | * panel mic (mic 2) |
| 9267 | */ |
| 9268 | /* Amp Indices: Mic1 = 0, Mic2 = 1, Line1 = 2, Line2 = 3, CD = 4 */ |
Takashi Iwai | cb53c62 | 2007-08-10 17:21:45 +0200 | [diff] [blame] | 9269 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 9270 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
| 9271 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)}, |
| 9272 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)}, |
| 9273 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)}, |
| 9274 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(5)}, |
| 9275 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(6)}, |
| 9276 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(7)}, |
Kailang Yang | cd7509a | 2007-01-26 18:33:17 +0100 | [diff] [blame] | 9277 | /* |
| 9278 | * Set up output mixers (0x0c - 0x0e) |
| 9279 | */ |
| 9280 | /* set vol=0 to output mixers */ |
| 9281 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 9282 | {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 9283 | {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 9284 | |
| 9285 | /* set up input amps for analog loopback */ |
| 9286 | /* Amp Indices: DAC = 0, mixer = 1 */ |
| 9287 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 9288 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 9289 | {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 9290 | {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 9291 | {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 9292 | {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 9293 | |
| 9294 | |
| 9295 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP }, /* HP */ |
| 9296 | {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, /* Mono */ |
| 9297 | {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80 }, /* rear MIC */ |
| 9298 | {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN }, /* Line in */ |
| 9299 | {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80 }, /* Front MIC */ |
| 9300 | {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, /* Line out */ |
| 9301 | {0x1c, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN }, /* CD in */ |
| 9302 | |
| 9303 | {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE }, |
| 9304 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE }, |
| 9305 | |
| 9306 | {0x1b, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 9307 | {0x15, AC_VERB_SET_CONNECT_SEL, 0x01}, |
| 9308 | |
| 9309 | /* {0x14, AC_VERB_SET_AMP_GAIN_MUTE, 0x7023 }, */ |
| 9310 | {0x18, AC_VERB_SET_AMP_GAIN_MUTE, 0x7000 }, |
| 9311 | {0x19, AC_VERB_SET_AMP_GAIN_MUTE, 0x7000 }, |
| 9312 | {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, 0x7023 }, |
| 9313 | {0x1c, AC_VERB_SET_AMP_GAIN_MUTE, 0x7000 }, |
| 9314 | {0x1d, AC_VERB_SET_AMP_GAIN_MUTE, 0x7000 }, |
| 9315 | |
| 9316 | /* FIXME: use matrix-type input source selection */ |
| 9317 | /* Mixer elements: 0x18, 19, 1a, 1b, 1c, 1d, 14, 15, 16, 17, 0b */ |
| 9318 | /* Input mixer1: unmute Mic, F-Mic, Line, CD inputs */ |
| 9319 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))}, /*rear MIC*/ |
| 9320 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x01 << 8))}, /*Line in*/ |
| 9321 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x02 << 8))}, /*F MIC*/ |
| 9322 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x03 << 8))}, /*Front*/ |
| 9323 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x04 << 8))}, /*CD*/ |
| 9324 | /* {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x06 << 8))}, */ |
| 9325 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x07 << 8))}, /*HP*/ |
| 9326 | /* Input mixer2 */ |
| 9327 | {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))}, |
| 9328 | {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x01 << 8))}, |
| 9329 | {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x02 << 8))}, |
| 9330 | {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x03 << 8))}, |
| 9331 | {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x04 << 8))}, |
| 9332 | /* {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x06 << 8))}, */ |
| 9333 | {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x07 << 8))}, |
| 9334 | /* Input mixer3 */ |
| 9335 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))}, |
| 9336 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x01 << 8))}, |
| 9337 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x02 << 8))}, |
| 9338 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x03 << 8))}, |
| 9339 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x04 << 8))}, |
| 9340 | /* {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x06 << 8))}, */ |
| 9341 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x07 << 8))}, |
| 9342 | |
Takashi Iwai | ce875f0 | 2008-01-28 18:17:43 +0100 | [diff] [blame] | 9343 | {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN}, |
| 9344 | |
Kailang Yang | cd7509a | 2007-01-26 18:33:17 +0100 | [diff] [blame] | 9345 | { } |
| 9346 | }; |
| 9347 | |
Takashi Iwai | cb53c62 | 2007-08-10 17:21:45 +0200 | [diff] [blame] | 9348 | #ifdef CONFIG_SND_HDA_POWER_SAVE |
| 9349 | #define alc262_loopbacks alc880_loopbacks |
| 9350 | #endif |
| 9351 | |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 9352 | /* pcm configuration: identiacal with ALC880 */ |
| 9353 | #define alc262_pcm_analog_playback alc880_pcm_analog_playback |
| 9354 | #define alc262_pcm_analog_capture alc880_pcm_analog_capture |
| 9355 | #define alc262_pcm_digital_playback alc880_pcm_digital_playback |
| 9356 | #define alc262_pcm_digital_capture alc880_pcm_digital_capture |
| 9357 | |
| 9358 | /* |
| 9359 | * BIOS auto configuration |
| 9360 | */ |
| 9361 | static int alc262_parse_auto_config(struct hda_codec *codec) |
| 9362 | { |
| 9363 | struct alc_spec *spec = codec->spec; |
| 9364 | int err; |
| 9365 | static hda_nid_t alc262_ignore[] = { 0x1d, 0 }; |
| 9366 | |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 9367 | err = snd_hda_parse_pin_def_config(codec, &spec->autocfg, |
| 9368 | alc262_ignore); |
| 9369 | if (err < 0) |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 9370 | return err; |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 9371 | if (!spec->autocfg.line_outs) |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 9372 | return 0; /* can't find valid BIOS pin config */ |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 9373 | err = alc262_auto_create_multi_out_ctls(spec, &spec->autocfg); |
| 9374 | if (err < 0) |
| 9375 | return err; |
| 9376 | err = alc262_auto_create_analog_input_ctls(spec, &spec->autocfg); |
| 9377 | if (err < 0) |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 9378 | return err; |
| 9379 | |
| 9380 | spec->multiout.max_channels = spec->multiout.num_dacs * 2; |
| 9381 | |
| 9382 | if (spec->autocfg.dig_out_pin) |
| 9383 | spec->multiout.dig_out_nid = ALC262_DIGOUT_NID; |
| 9384 | if (spec->autocfg.dig_in_pin) |
| 9385 | spec->dig_in_nid = ALC262_DIGIN_NID; |
| 9386 | |
| 9387 | if (spec->kctl_alloc) |
| 9388 | spec->mixers[spec->num_mixers++] = spec->kctl_alloc; |
| 9389 | |
| 9390 | spec->init_verbs[spec->num_init_verbs++] = alc262_volume_init_verbs; |
Jonathan Woithe | a1e8d2d | 2006-03-28 12:47:09 +0200 | [diff] [blame] | 9391 | spec->num_mux_defs = 1; |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 9392 | spec->input_mux = &spec->private_imux; |
| 9393 | |
Takashi Iwai | 776e184 | 2007-08-29 15:07:11 +0200 | [diff] [blame] | 9394 | err = alc_auto_add_mic_boost(codec); |
| 9395 | if (err < 0) |
| 9396 | return err; |
| 9397 | |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 9398 | return 1; |
| 9399 | } |
| 9400 | |
| 9401 | #define alc262_auto_init_multi_out alc882_auto_init_multi_out |
| 9402 | #define alc262_auto_init_hp_out alc882_auto_init_hp_out |
| 9403 | #define alc262_auto_init_analog_input alc882_auto_init_analog_input |
| 9404 | |
| 9405 | |
| 9406 | /* init callback for auto-configuration model -- overriding the default init */ |
Takashi Iwai | ae6b813 | 2006-03-03 16:47:17 +0100 | [diff] [blame] | 9407 | static void alc262_auto_init(struct hda_codec *codec) |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 9408 | { |
Takashi Iwai | f6c7e54 | 2008-02-12 18:32:23 +0100 | [diff] [blame] | 9409 | struct alc_spec *spec = codec->spec; |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 9410 | alc262_auto_init_multi_out(codec); |
| 9411 | alc262_auto_init_hp_out(codec); |
| 9412 | alc262_auto_init_analog_input(codec); |
Takashi Iwai | f6c7e54 | 2008-02-12 18:32:23 +0100 | [diff] [blame] | 9413 | if (spec->unsol_event) |
| 9414 | alc_sku_automute(codec); |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 9415 | } |
| 9416 | |
| 9417 | /* |
| 9418 | * configuration and preset |
| 9419 | */ |
Takashi Iwai | f5fcc13 | 2006-11-24 17:07:44 +0100 | [diff] [blame] | 9420 | static const char *alc262_models[ALC262_MODEL_LAST] = { |
| 9421 | [ALC262_BASIC] = "basic", |
| 9422 | [ALC262_HIPPO] = "hippo", |
| 9423 | [ALC262_HIPPO_1] = "hippo_1", |
| 9424 | [ALC262_FUJITSU] = "fujitsu", |
| 9425 | [ALC262_HP_BPC] = "hp-bpc", |
Kailang Yang | cd7509a | 2007-01-26 18:33:17 +0100 | [diff] [blame] | 9426 | [ALC262_HP_BPC_D7000_WL]= "hp-bpc-d7000", |
Takashi Iwai | 61dc35d | 2007-11-14 12:26:44 +0100 | [diff] [blame] | 9427 | [ALC262_HP_TC_T5735] = "hp-tc-t5735", |
Kailang Yang | 8c42722 | 2008-01-10 13:03:59 +0100 | [diff] [blame] | 9428 | [ALC262_HP_RP5700] = "hp-rp5700", |
Takashi Iwai | f5fcc13 | 2006-11-24 17:07:44 +0100 | [diff] [blame] | 9429 | [ALC262_BENQ_ED8] = "benq", |
Takashi Iwai | 0f40502 | 2007-07-06 12:24:11 +0200 | [diff] [blame] | 9430 | [ALC262_BENQ_T31] = "benq-t31", |
| 9431 | [ALC262_SONY_ASSAMD] = "sony-assamd", |
Tobin Davis | f651b50 | 2007-10-26 12:40:47 +0200 | [diff] [blame] | 9432 | [ALC262_ULTRA] = "ultra", |
Jiang zhe | 0e31daf | 2008-03-20 12:12:39 +0100 | [diff] [blame] | 9433 | [ALC262_LENOVO_3000] = "lenovo-3000", |
Takashi Iwai | f5fcc13 | 2006-11-24 17:07:44 +0100 | [diff] [blame] | 9434 | [ALC262_AUTO] = "auto", |
| 9435 | }; |
| 9436 | |
| 9437 | static struct snd_pci_quirk alc262_cfg_tbl[] = { |
| 9438 | SND_PCI_QUIRK(0x1002, 0x437b, "Hippo", ALC262_HIPPO), |
| 9439 | SND_PCI_QUIRK(0x103c, 0x12fe, "HP xw9400", ALC262_HP_BPC), |
Kailang Yang | 7d87de2 | 2007-06-05 12:17:21 +0200 | [diff] [blame] | 9440 | SND_PCI_QUIRK(0x103c, 0x12ff, "HP xw4550", ALC262_HP_BPC), |
Takashi Iwai | ac3e374 | 2007-12-17 17:14:18 +0100 | [diff] [blame] | 9441 | SND_PCI_QUIRK(0x103c, 0x1306, "HP xw8600", ALC262_HP_BPC), |
| 9442 | SND_PCI_QUIRK(0x103c, 0x1307, "HP xw6600", ALC262_HP_BPC), |
Kailang Yang | 7d87de2 | 2007-06-05 12:17:21 +0200 | [diff] [blame] | 9443 | SND_PCI_QUIRK(0x103c, 0x1308, "HP xw4600", ALC262_HP_BPC), |
Takashi Iwai | b98f933 | 2007-11-07 14:18:01 +0100 | [diff] [blame] | 9444 | SND_PCI_QUIRK(0x103c, 0x1309, "HP xw4*00", ALC262_HP_BPC), |
Takashi Iwai | b98f933 | 2007-11-07 14:18:01 +0100 | [diff] [blame] | 9445 | SND_PCI_QUIRK(0x103c, 0x130a, "HP xw6*00", ALC262_HP_BPC), |
Takashi Iwai | b98f933 | 2007-11-07 14:18:01 +0100 | [diff] [blame] | 9446 | SND_PCI_QUIRK(0x103c, 0x130b, "HP xw8*00", ALC262_HP_BPC), |
Kailang Yang | cd7509a | 2007-01-26 18:33:17 +0100 | [diff] [blame] | 9447 | SND_PCI_QUIRK(0x103c, 0x2800, "HP D7000", ALC262_HP_BPC_D7000_WL), |
Kailang Yang | cd7509a | 2007-01-26 18:33:17 +0100 | [diff] [blame] | 9448 | SND_PCI_QUIRK(0x103c, 0x2801, "HP D7000", ALC262_HP_BPC_D7000_WF), |
Takashi Iwai | ac3e374 | 2007-12-17 17:14:18 +0100 | [diff] [blame] | 9449 | SND_PCI_QUIRK(0x103c, 0x2802, "HP D7000", ALC262_HP_BPC_D7000_WL), |
Kailang Yang | cd7509a | 2007-01-26 18:33:17 +0100 | [diff] [blame] | 9450 | SND_PCI_QUIRK(0x103c, 0x2803, "HP D7000", ALC262_HP_BPC_D7000_WF), |
Takashi Iwai | ac3e374 | 2007-12-17 17:14:18 +0100 | [diff] [blame] | 9451 | SND_PCI_QUIRK(0x103c, 0x2804, "HP D7000", ALC262_HP_BPC_D7000_WL), |
Kailang Yang | cd7509a | 2007-01-26 18:33:17 +0100 | [diff] [blame] | 9452 | SND_PCI_QUIRK(0x103c, 0x2805, "HP D7000", ALC262_HP_BPC_D7000_WF), |
Takashi Iwai | ac3e374 | 2007-12-17 17:14:18 +0100 | [diff] [blame] | 9453 | SND_PCI_QUIRK(0x103c, 0x2806, "HP D7000", ALC262_HP_BPC_D7000_WL), |
Kailang Yang | cd7509a | 2007-01-26 18:33:17 +0100 | [diff] [blame] | 9454 | SND_PCI_QUIRK(0x103c, 0x2807, "HP D7000", ALC262_HP_BPC_D7000_WF), |
Takashi Iwai | ac3e374 | 2007-12-17 17:14:18 +0100 | [diff] [blame] | 9455 | SND_PCI_QUIRK(0x103c, 0x280c, "HP xw4400", ALC262_HP_BPC), |
| 9456 | SND_PCI_QUIRK(0x103c, 0x3014, "HP xw6400", ALC262_HP_BPC), |
| 9457 | SND_PCI_QUIRK(0x103c, 0x3015, "HP xw8400", ALC262_HP_BPC), |
Kailang Yang | 66d2a9d | 2007-11-14 12:06:21 +0100 | [diff] [blame] | 9458 | SND_PCI_QUIRK(0x103c, 0x302f, "HP Thin Client T5735", |
| 9459 | ALC262_HP_TC_T5735), |
Kailang Yang | 8c42722 | 2008-01-10 13:03:59 +0100 | [diff] [blame] | 9460 | SND_PCI_QUIRK(0x103c, 0x2817, "HP RP5700", ALC262_HP_RP5700), |
Takashi Iwai | ac3e374 | 2007-12-17 17:14:18 +0100 | [diff] [blame] | 9461 | SND_PCI_QUIRK(0x104d, 0x1f00, "Sony ASSAMD", ALC262_SONY_ASSAMD), |
Takashi Iwai | f5fcc13 | 2006-11-24 17:07:44 +0100 | [diff] [blame] | 9462 | SND_PCI_QUIRK(0x104d, 0x8203, "Sony UX-90", ALC262_HIPPO), |
Takashi Iwai | ac3e374 | 2007-12-17 17:14:18 +0100 | [diff] [blame] | 9463 | SND_PCI_QUIRK(0x104d, 0x820f, "Sony ASSAMD", ALC262_SONY_ASSAMD), |
| 9464 | SND_PCI_QUIRK(0x104d, 0x900e, "Sony ASSAMD", ALC262_SONY_ASSAMD), |
| 9465 | SND_PCI_QUIRK(0x104d, 0x9015, "Sony 0x9015", ALC262_SONY_ASSAMD), |
Takashi Iwai | f5fcc13 | 2006-11-24 17:07:44 +0100 | [diff] [blame] | 9466 | SND_PCI_QUIRK(0x10cf, 0x1397, "Fujitsu", ALC262_FUJITSU), |
Tony Vroon | 3f1eeae | 2008-02-25 16:44:13 +0100 | [diff] [blame] | 9467 | SND_PCI_QUIRK(0x10cf, 0x142d, "Fujitsu Lifebook E8410", ALC262_FUJITSU), |
Takashi Iwai | ac3e374 | 2007-12-17 17:14:18 +0100 | [diff] [blame] | 9468 | SND_PCI_QUIRK(0x144d, 0xc032, "Samsung Q1 Ultra", ALC262_ULTRA), |
Takashi Iwai | bb9f76c | 2008-03-12 12:51:09 +0100 | [diff] [blame] | 9469 | SND_PCI_QUIRK(0x144d, 0xc039, "Samsung Q1U EL", ALC262_ULTRA), |
Jiang zhe | 0e31daf | 2008-03-20 12:12:39 +0100 | [diff] [blame] | 9470 | SND_PCI_QUIRK(0x17aa, 0x384e, "Lenovo 3000 y410", ALC262_LENOVO_3000), |
Takashi Iwai | f5fcc13 | 2006-11-24 17:07:44 +0100 | [diff] [blame] | 9471 | SND_PCI_QUIRK(0x17ff, 0x0560, "Benq ED8", ALC262_BENQ_ED8), |
Kailang Yang | 83c3421 | 2007-07-05 11:43:05 +0200 | [diff] [blame] | 9472 | SND_PCI_QUIRK(0x17ff, 0x058d, "Benq T31-16", ALC262_BENQ_T31), |
Takashi Iwai | ac3e374 | 2007-12-17 17:14:18 +0100 | [diff] [blame] | 9473 | SND_PCI_QUIRK(0x17ff, 0x058f, "Benq Hippo", ALC262_HIPPO_1), |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 9474 | {} |
| 9475 | }; |
| 9476 | |
| 9477 | static struct alc_config_preset alc262_presets[] = { |
| 9478 | [ALC262_BASIC] = { |
| 9479 | .mixers = { alc262_base_mixer }, |
| 9480 | .init_verbs = { alc262_init_verbs }, |
| 9481 | .num_dacs = ARRAY_SIZE(alc262_dac_nids), |
| 9482 | .dac_nids = alc262_dac_nids, |
| 9483 | .hp_nid = 0x03, |
| 9484 | .num_channel_mode = ARRAY_SIZE(alc262_modes), |
| 9485 | .channel_mode = alc262_modes, |
Takashi Iwai | a3bcba3 | 2005-12-06 19:05:29 +0100 | [diff] [blame] | 9486 | .input_mux = &alc262_capture_source, |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 9487 | }, |
Kailang Yang | ccc656c | 2006-10-17 12:32:26 +0200 | [diff] [blame] | 9488 | [ALC262_HIPPO] = { |
| 9489 | .mixers = { alc262_base_mixer }, |
| 9490 | .init_verbs = { alc262_init_verbs, alc262_hippo_unsol_verbs}, |
| 9491 | .num_dacs = ARRAY_SIZE(alc262_dac_nids), |
| 9492 | .dac_nids = alc262_dac_nids, |
| 9493 | .hp_nid = 0x03, |
| 9494 | .dig_out_nid = ALC262_DIGOUT_NID, |
| 9495 | .num_channel_mode = ARRAY_SIZE(alc262_modes), |
| 9496 | .channel_mode = alc262_modes, |
| 9497 | .input_mux = &alc262_capture_source, |
| 9498 | .unsol_event = alc262_hippo_unsol_event, |
Takashi Iwai | 5b31954 | 2007-07-26 11:49:22 +0200 | [diff] [blame] | 9499 | .init_hook = alc262_hippo_automute, |
Kailang Yang | ccc656c | 2006-10-17 12:32:26 +0200 | [diff] [blame] | 9500 | }, |
| 9501 | [ALC262_HIPPO_1] = { |
| 9502 | .mixers = { alc262_hippo1_mixer }, |
| 9503 | .init_verbs = { alc262_init_verbs, alc262_hippo1_unsol_verbs}, |
| 9504 | .num_dacs = ARRAY_SIZE(alc262_dac_nids), |
| 9505 | .dac_nids = alc262_dac_nids, |
| 9506 | .hp_nid = 0x02, |
| 9507 | .dig_out_nid = ALC262_DIGOUT_NID, |
| 9508 | .num_channel_mode = ARRAY_SIZE(alc262_modes), |
| 9509 | .channel_mode = alc262_modes, |
| 9510 | .input_mux = &alc262_capture_source, |
| 9511 | .unsol_event = alc262_hippo1_unsol_event, |
Takashi Iwai | 5b31954 | 2007-07-26 11:49:22 +0200 | [diff] [blame] | 9512 | .init_hook = alc262_hippo1_automute, |
Kailang Yang | ccc656c | 2006-10-17 12:32:26 +0200 | [diff] [blame] | 9513 | }, |
Takashi Iwai | 834be88 | 2006-03-01 14:16:17 +0100 | [diff] [blame] | 9514 | [ALC262_FUJITSU] = { |
| 9515 | .mixers = { alc262_fujitsu_mixer }, |
Takashi Iwai | 39d3ed3 | 2007-10-12 15:03:48 +0200 | [diff] [blame] | 9516 | .init_verbs = { alc262_init_verbs, alc262_EAPD_verbs, |
| 9517 | alc262_fujitsu_unsol_verbs }, |
Takashi Iwai | 834be88 | 2006-03-01 14:16:17 +0100 | [diff] [blame] | 9518 | .num_dacs = ARRAY_SIZE(alc262_dac_nids), |
| 9519 | .dac_nids = alc262_dac_nids, |
| 9520 | .hp_nid = 0x03, |
| 9521 | .dig_out_nid = ALC262_DIGOUT_NID, |
| 9522 | .num_channel_mode = ARRAY_SIZE(alc262_modes), |
| 9523 | .channel_mode = alc262_modes, |
| 9524 | .input_mux = &alc262_fujitsu_capture_source, |
Takashi Iwai | ae6b813 | 2006-03-03 16:47:17 +0100 | [diff] [blame] | 9525 | .unsol_event = alc262_fujitsu_unsol_event, |
Takashi Iwai | 834be88 | 2006-03-01 14:16:17 +0100 | [diff] [blame] | 9526 | }, |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 9527 | [ALC262_HP_BPC] = { |
| 9528 | .mixers = { alc262_HP_BPC_mixer }, |
| 9529 | .init_verbs = { alc262_HP_BPC_init_verbs }, |
| 9530 | .num_dacs = ARRAY_SIZE(alc262_dac_nids), |
| 9531 | .dac_nids = alc262_dac_nids, |
| 9532 | .hp_nid = 0x03, |
| 9533 | .num_channel_mode = ARRAY_SIZE(alc262_modes), |
| 9534 | .channel_mode = alc262_modes, |
| 9535 | .input_mux = &alc262_HP_capture_source, |
Takashi Iwai | ce875f0 | 2008-01-28 18:17:43 +0100 | [diff] [blame] | 9536 | .unsol_event = alc262_hp_bpc_unsol_event, |
| 9537 | .init_hook = alc262_hp_bpc_automute, |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 9538 | }, |
Kailang Yang | cd7509a | 2007-01-26 18:33:17 +0100 | [diff] [blame] | 9539 | [ALC262_HP_BPC_D7000_WF] = { |
| 9540 | .mixers = { alc262_HP_BPC_WildWest_mixer }, |
| 9541 | .init_verbs = { alc262_HP_BPC_WildWest_init_verbs }, |
| 9542 | .num_dacs = ARRAY_SIZE(alc262_dac_nids), |
| 9543 | .dac_nids = alc262_dac_nids, |
| 9544 | .hp_nid = 0x03, |
| 9545 | .num_channel_mode = ARRAY_SIZE(alc262_modes), |
| 9546 | .channel_mode = alc262_modes, |
zhejiang | accbe49 | 2007-08-31 12:36:05 +0200 | [diff] [blame] | 9547 | .input_mux = &alc262_HP_D7000_capture_source, |
Takashi Iwai | ce875f0 | 2008-01-28 18:17:43 +0100 | [diff] [blame] | 9548 | .unsol_event = alc262_hp_wildwest_unsol_event, |
| 9549 | .init_hook = alc262_hp_wildwest_automute, |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 9550 | }, |
Kailang Yang | cd7509a | 2007-01-26 18:33:17 +0100 | [diff] [blame] | 9551 | [ALC262_HP_BPC_D7000_WL] = { |
| 9552 | .mixers = { alc262_HP_BPC_WildWest_mixer, |
| 9553 | alc262_HP_BPC_WildWest_option_mixer }, |
| 9554 | .init_verbs = { alc262_HP_BPC_WildWest_init_verbs }, |
| 9555 | .num_dacs = ARRAY_SIZE(alc262_dac_nids), |
| 9556 | .dac_nids = alc262_dac_nids, |
| 9557 | .hp_nid = 0x03, |
| 9558 | .num_channel_mode = ARRAY_SIZE(alc262_modes), |
| 9559 | .channel_mode = alc262_modes, |
zhejiang | accbe49 | 2007-08-31 12:36:05 +0200 | [diff] [blame] | 9560 | .input_mux = &alc262_HP_D7000_capture_source, |
Takashi Iwai | ce875f0 | 2008-01-28 18:17:43 +0100 | [diff] [blame] | 9561 | .unsol_event = alc262_hp_wildwest_unsol_event, |
| 9562 | .init_hook = alc262_hp_wildwest_automute, |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 9563 | }, |
Kailang Yang | 66d2a9d | 2007-11-14 12:06:21 +0100 | [diff] [blame] | 9564 | [ALC262_HP_TC_T5735] = { |
| 9565 | .mixers = { alc262_hp_t5735_mixer }, |
| 9566 | .init_verbs = { alc262_init_verbs, alc262_hp_t5735_verbs }, |
| 9567 | .num_dacs = ARRAY_SIZE(alc262_dac_nids), |
| 9568 | .dac_nids = alc262_dac_nids, |
| 9569 | .hp_nid = 0x03, |
| 9570 | .num_channel_mode = ARRAY_SIZE(alc262_modes), |
| 9571 | .channel_mode = alc262_modes, |
| 9572 | .input_mux = &alc262_capture_source, |
| 9573 | .unsol_event = alc262_hp_t5735_unsol_event, |
| 9574 | .init_hook = alc262_hp_t5735_init_hook, |
Kailang Yang | 8c42722 | 2008-01-10 13:03:59 +0100 | [diff] [blame] | 9575 | }, |
| 9576 | [ALC262_HP_RP5700] = { |
| 9577 | .mixers = { alc262_hp_rp5700_mixer }, |
| 9578 | .init_verbs = { alc262_init_verbs, alc262_hp_rp5700_verbs }, |
| 9579 | .num_dacs = ARRAY_SIZE(alc262_dac_nids), |
| 9580 | .dac_nids = alc262_dac_nids, |
| 9581 | .num_channel_mode = ARRAY_SIZE(alc262_modes), |
| 9582 | .channel_mode = alc262_modes, |
| 9583 | .input_mux = &alc262_hp_rp5700_capture_source, |
Kailang Yang | 66d2a9d | 2007-11-14 12:06:21 +0100 | [diff] [blame] | 9584 | }, |
Takashi Iwai | 304dcaa | 2006-07-25 14:51:16 +0200 | [diff] [blame] | 9585 | [ALC262_BENQ_ED8] = { |
| 9586 | .mixers = { alc262_base_mixer }, |
| 9587 | .init_verbs = { alc262_init_verbs, alc262_EAPD_verbs }, |
| 9588 | .num_dacs = ARRAY_SIZE(alc262_dac_nids), |
| 9589 | .dac_nids = alc262_dac_nids, |
| 9590 | .hp_nid = 0x03, |
| 9591 | .num_channel_mode = ARRAY_SIZE(alc262_modes), |
| 9592 | .channel_mode = alc262_modes, |
| 9593 | .input_mux = &alc262_capture_source, |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 9594 | }, |
Kailang Yang | 272a527 | 2007-05-14 11:00:38 +0200 | [diff] [blame] | 9595 | [ALC262_SONY_ASSAMD] = { |
| 9596 | .mixers = { alc262_sony_mixer }, |
| 9597 | .init_verbs = { alc262_init_verbs, alc262_sony_unsol_verbs}, |
| 9598 | .num_dacs = ARRAY_SIZE(alc262_dac_nids), |
| 9599 | .dac_nids = alc262_dac_nids, |
| 9600 | .hp_nid = 0x02, |
| 9601 | .num_channel_mode = ARRAY_SIZE(alc262_modes), |
| 9602 | .channel_mode = alc262_modes, |
| 9603 | .input_mux = &alc262_capture_source, |
| 9604 | .unsol_event = alc262_hippo_unsol_event, |
Takashi Iwai | 5b31954 | 2007-07-26 11:49:22 +0200 | [diff] [blame] | 9605 | .init_hook = alc262_hippo_automute, |
Kailang Yang | 83c3421 | 2007-07-05 11:43:05 +0200 | [diff] [blame] | 9606 | }, |
| 9607 | [ALC262_BENQ_T31] = { |
| 9608 | .mixers = { alc262_benq_t31_mixer }, |
| 9609 | .init_verbs = { alc262_init_verbs, alc262_benq_t31_EAPD_verbs, alc262_hippo_unsol_verbs }, |
| 9610 | .num_dacs = ARRAY_SIZE(alc262_dac_nids), |
| 9611 | .dac_nids = alc262_dac_nids, |
| 9612 | .hp_nid = 0x03, |
| 9613 | .num_channel_mode = ARRAY_SIZE(alc262_modes), |
| 9614 | .channel_mode = alc262_modes, |
| 9615 | .input_mux = &alc262_capture_source, |
| 9616 | .unsol_event = alc262_hippo_unsol_event, |
Takashi Iwai | 5b31954 | 2007-07-26 11:49:22 +0200 | [diff] [blame] | 9617 | .init_hook = alc262_hippo_automute, |
Kailang Yang | 272a527 | 2007-05-14 11:00:38 +0200 | [diff] [blame] | 9618 | }, |
Tobin Davis | f651b50 | 2007-10-26 12:40:47 +0200 | [diff] [blame] | 9619 | [ALC262_ULTRA] = { |
Takashi Iwai | bb9f76c | 2008-03-12 12:51:09 +0100 | [diff] [blame] | 9620 | .mixers = { alc262_ultra_mixer, alc262_ultra_capture_mixer }, |
| 9621 | .init_verbs = { alc262_ultra_verbs }, |
Tobin Davis | f651b50 | 2007-10-26 12:40:47 +0200 | [diff] [blame] | 9622 | .num_dacs = ARRAY_SIZE(alc262_dac_nids), |
| 9623 | .dac_nids = alc262_dac_nids, |
Tobin Davis | f651b50 | 2007-10-26 12:40:47 +0200 | [diff] [blame] | 9624 | .num_channel_mode = ARRAY_SIZE(alc262_modes), |
| 9625 | .channel_mode = alc262_modes, |
| 9626 | .input_mux = &alc262_ultra_capture_source, |
Takashi Iwai | bb9f76c | 2008-03-12 12:51:09 +0100 | [diff] [blame] | 9627 | .adc_nids = alc262_adc_nids, /* ADC0 */ |
| 9628 | .capsrc_nids = alc262_capsrc_nids, |
| 9629 | .num_adc_nids = 1, /* single ADC */ |
Tobin Davis | f651b50 | 2007-10-26 12:40:47 +0200 | [diff] [blame] | 9630 | .unsol_event = alc262_ultra_unsol_event, |
| 9631 | .init_hook = alc262_ultra_automute, |
| 9632 | }, |
Jiang zhe | 0e31daf | 2008-03-20 12:12:39 +0100 | [diff] [blame] | 9633 | [ALC262_LENOVO_3000] = { |
| 9634 | .mixers = { alc262_lenovo_3000_mixer }, |
| 9635 | .init_verbs = { alc262_init_verbs, alc262_EAPD_verbs, |
| 9636 | alc262_lenovo_3000_unsol_verbs }, |
| 9637 | .num_dacs = ARRAY_SIZE(alc262_dac_nids), |
| 9638 | .dac_nids = alc262_dac_nids, |
| 9639 | .hp_nid = 0x03, |
| 9640 | .dig_out_nid = ALC262_DIGOUT_NID, |
| 9641 | .num_channel_mode = ARRAY_SIZE(alc262_modes), |
| 9642 | .channel_mode = alc262_modes, |
| 9643 | .input_mux = &alc262_fujitsu_capture_source, |
| 9644 | .unsol_event = alc262_lenovo_3000_unsol_event, |
| 9645 | }, |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 9646 | }; |
| 9647 | |
| 9648 | static int patch_alc262(struct hda_codec *codec) |
| 9649 | { |
| 9650 | struct alc_spec *spec; |
| 9651 | int board_config; |
| 9652 | int err; |
| 9653 | |
Robert P. J. Day | dc041e0 | 2006-12-19 14:44:15 +0100 | [diff] [blame] | 9654 | spec = kzalloc(sizeof(*spec), GFP_KERNEL); |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 9655 | if (spec == NULL) |
| 9656 | return -ENOMEM; |
| 9657 | |
| 9658 | codec->spec = spec; |
| 9659 | #if 0 |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 9660 | /* pshou 07/11/05 set a zero PCM sample to DAC when FIFO is |
| 9661 | * under-run |
| 9662 | */ |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 9663 | { |
| 9664 | int tmp; |
| 9665 | snd_hda_codec_write(codec, 0x1a, 0, AC_VERB_SET_COEF_INDEX, 7); |
| 9666 | tmp = snd_hda_codec_read(codec, 0x20, 0, AC_VERB_GET_PROC_COEF, 0); |
| 9667 | snd_hda_codec_write(codec, 0x1a, 0, AC_VERB_SET_COEF_INDEX, 7); |
| 9668 | snd_hda_codec_write(codec, 0x1a, 0, AC_VERB_SET_PROC_COEF, tmp | 0x80); |
| 9669 | } |
| 9670 | #endif |
| 9671 | |
Takashi Iwai | f5fcc13 | 2006-11-24 17:07:44 +0100 | [diff] [blame] | 9672 | board_config = snd_hda_check_board_config(codec, ALC262_MODEL_LAST, |
| 9673 | alc262_models, |
| 9674 | alc262_cfg_tbl); |
Kailang Yang | cd7509a | 2007-01-26 18:33:17 +0100 | [diff] [blame] | 9675 | |
Takashi Iwai | f5fcc13 | 2006-11-24 17:07:44 +0100 | [diff] [blame] | 9676 | if (board_config < 0) { |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 9677 | printk(KERN_INFO "hda_codec: Unknown model for ALC262, " |
| 9678 | "trying auto-probe from BIOS...\n"); |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 9679 | board_config = ALC262_AUTO; |
| 9680 | } |
| 9681 | |
| 9682 | if (board_config == ALC262_AUTO) { |
| 9683 | /* automatic parse from the BIOS config */ |
| 9684 | err = alc262_parse_auto_config(codec); |
| 9685 | if (err < 0) { |
| 9686 | alc_free(codec); |
| 9687 | return err; |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 9688 | } else if (!err) { |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 9689 | printk(KERN_INFO |
| 9690 | "hda_codec: Cannot set up configuration " |
| 9691 | "from BIOS. Using base mode...\n"); |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 9692 | board_config = ALC262_BASIC; |
| 9693 | } |
| 9694 | } |
| 9695 | |
| 9696 | if (board_config != ALC262_AUTO) |
| 9697 | setup_preset(spec, &alc262_presets[board_config]); |
| 9698 | |
| 9699 | spec->stream_name_analog = "ALC262 Analog"; |
| 9700 | spec->stream_analog_playback = &alc262_pcm_analog_playback; |
| 9701 | spec->stream_analog_capture = &alc262_pcm_analog_capture; |
| 9702 | |
| 9703 | spec->stream_name_digital = "ALC262 Digital"; |
| 9704 | spec->stream_digital_playback = &alc262_pcm_digital_playback; |
| 9705 | spec->stream_digital_capture = &alc262_pcm_digital_capture; |
| 9706 | |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 9707 | if (!spec->adc_nids && spec->input_mux) { |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 9708 | /* check whether NID 0x07 is valid */ |
Takashi Iwai | 4a471b7 | 2005-12-07 13:56:29 +0100 | [diff] [blame] | 9709 | unsigned int wcap = get_wcaps(codec, 0x07); |
| 9710 | |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 9711 | /* get type */ |
| 9712 | wcap = (wcap & AC_WCAP_TYPE) >> AC_WCAP_TYPE_SHIFT; |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 9713 | if (wcap != AC_WID_AUD_IN) { |
| 9714 | spec->adc_nids = alc262_adc_nids_alt; |
| 9715 | spec->num_adc_nids = ARRAY_SIZE(alc262_adc_nids_alt); |
Takashi Iwai | 88c71a9 | 2008-02-14 17:27:17 +0100 | [diff] [blame] | 9716 | spec->capsrc_nids = alc262_capsrc_nids_alt; |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 9717 | spec->mixers[spec->num_mixers] = |
| 9718 | alc262_capture_alt_mixer; |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 9719 | spec->num_mixers++; |
| 9720 | } else { |
| 9721 | spec->adc_nids = alc262_adc_nids; |
| 9722 | spec->num_adc_nids = ARRAY_SIZE(alc262_adc_nids); |
Takashi Iwai | 88c71a9 | 2008-02-14 17:27:17 +0100 | [diff] [blame] | 9723 | spec->capsrc_nids = alc262_capsrc_nids; |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 9724 | spec->mixers[spec->num_mixers] = alc262_capture_mixer; |
| 9725 | spec->num_mixers++; |
| 9726 | } |
| 9727 | } |
| 9728 | |
Takashi Iwai | 2134ea4 | 2008-01-10 16:53:55 +0100 | [diff] [blame] | 9729 | spec->vmaster_nid = 0x0c; |
| 9730 | |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 9731 | codec->patch_ops = alc_patch_ops; |
| 9732 | if (board_config == ALC262_AUTO) |
Takashi Iwai | ae6b813 | 2006-03-03 16:47:17 +0100 | [diff] [blame] | 9733 | spec->init_hook = alc262_auto_init; |
Takashi Iwai | cb53c62 | 2007-08-10 17:21:45 +0200 | [diff] [blame] | 9734 | #ifdef CONFIG_SND_HDA_POWER_SAVE |
| 9735 | if (!spec->loopback.amplist) |
| 9736 | spec->loopback.amplist = alc262_loopbacks; |
| 9737 | #endif |
Takashi Iwai | 834be88 | 2006-03-01 14:16:17 +0100 | [diff] [blame] | 9738 | |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 9739 | return 0; |
| 9740 | } |
| 9741 | |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 9742 | /* |
Kailang Yang | a361d84 | 2007-06-05 12:30:55 +0200 | [diff] [blame] | 9743 | * ALC268 channel source setting (2 channel) |
| 9744 | */ |
| 9745 | #define ALC268_DIGOUT_NID ALC880_DIGOUT_NID |
| 9746 | #define alc268_modes alc260_modes |
| 9747 | |
| 9748 | static hda_nid_t alc268_dac_nids[2] = { |
| 9749 | /* front, hp */ |
| 9750 | 0x02, 0x03 |
| 9751 | }; |
| 9752 | |
| 9753 | static hda_nid_t alc268_adc_nids[2] = { |
| 9754 | /* ADC0-1 */ |
| 9755 | 0x08, 0x07 |
| 9756 | }; |
| 9757 | |
| 9758 | static hda_nid_t alc268_adc_nids_alt[1] = { |
| 9759 | /* ADC0 */ |
| 9760 | 0x08 |
| 9761 | }; |
| 9762 | |
Takashi Iwai | e140634 | 2008-02-11 18:32:32 +0100 | [diff] [blame] | 9763 | static hda_nid_t alc268_capsrc_nids[2] = { 0x23, 0x24 }; |
| 9764 | |
Kailang Yang | a361d84 | 2007-06-05 12:30:55 +0200 | [diff] [blame] | 9765 | static struct snd_kcontrol_new alc268_base_mixer[] = { |
| 9766 | /* output mixer control */ |
| 9767 | HDA_CODEC_VOLUME("Front Playback Volume", 0x2, 0x0, HDA_OUTPUT), |
| 9768 | HDA_CODEC_MUTE("Front Playback Switch", 0x14, 0x0, HDA_OUTPUT), |
| 9769 | HDA_CODEC_VOLUME("Headphone Playback Volume", 0x3, 0x0, HDA_OUTPUT), |
| 9770 | HDA_CODEC_MUTE("Headphone Playback Switch", 0x15, 0x0, HDA_OUTPUT), |
Takashi Iwai | 33bf17a | 2007-08-21 11:51:42 +0200 | [diff] [blame] | 9771 | HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT), |
| 9772 | HDA_CODEC_VOLUME("Front Mic Boost", 0x19, 0, HDA_INPUT), |
| 9773 | HDA_CODEC_VOLUME("Line In Boost", 0x1a, 0, HDA_INPUT), |
Kailang Yang | a361d84 | 2007-06-05 12:30:55 +0200 | [diff] [blame] | 9774 | { } |
| 9775 | }; |
| 9776 | |
Takashi Iwai | aef9d31 | 2008-02-19 13:16:41 +0100 | [diff] [blame] | 9777 | /* bind Beep switches of both NID 0x0f and 0x10 */ |
| 9778 | static struct hda_bind_ctls alc268_bind_beep_sw = { |
| 9779 | .ops = &snd_hda_bind_sw, |
| 9780 | .values = { |
| 9781 | HDA_COMPOSE_AMP_VAL(0x0f, 3, 1, HDA_INPUT), |
| 9782 | HDA_COMPOSE_AMP_VAL(0x10, 3, 1, HDA_INPUT), |
| 9783 | 0 |
| 9784 | }, |
| 9785 | }; |
| 9786 | |
| 9787 | static struct snd_kcontrol_new alc268_beep_mixer[] = { |
| 9788 | HDA_CODEC_VOLUME("Beep Playback Volume", 0x1d, 0x0, HDA_INPUT), |
| 9789 | HDA_BIND_SW("Beep Playback Switch", &alc268_bind_beep_sw), |
| 9790 | { } |
| 9791 | }; |
| 9792 | |
Kailang Yang | d1a991a | 2007-08-15 16:21:59 +0200 | [diff] [blame] | 9793 | static struct hda_verb alc268_eapd_verbs[] = { |
| 9794 | {0x14, AC_VERB_SET_EAPD_BTLENABLE, 2}, |
| 9795 | {0x15, AC_VERB_SET_EAPD_BTLENABLE, 2}, |
| 9796 | { } |
| 9797 | }; |
| 9798 | |
Takashi Iwai | d273809 | 2007-08-16 14:59:45 +0200 | [diff] [blame] | 9799 | /* Toshiba specific */ |
| 9800 | #define alc268_toshiba_automute alc262_hippo_automute |
| 9801 | |
| 9802 | static struct hda_verb alc268_toshiba_verbs[] = { |
| 9803 | {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN}, |
| 9804 | { } /* end */ |
| 9805 | }; |
| 9806 | |
| 9807 | /* Acer specific */ |
Takashi Iwai | 889c439 | 2007-08-23 18:56:52 +0200 | [diff] [blame] | 9808 | /* bind volumes of both NID 0x02 and 0x03 */ |
Takashi Iwai | 6bc9685 | 2007-08-17 09:02:12 +0200 | [diff] [blame] | 9809 | static struct hda_bind_ctls alc268_acer_bind_master_vol = { |
| 9810 | .ops = &snd_hda_bind_vol, |
| 9811 | .values = { |
| 9812 | HDA_COMPOSE_AMP_VAL(0x02, 3, 0, HDA_OUTPUT), |
| 9813 | HDA_COMPOSE_AMP_VAL(0x03, 3, 0, HDA_OUTPUT), |
| 9814 | 0 |
| 9815 | }, |
| 9816 | }; |
| 9817 | |
Takashi Iwai | 889c439 | 2007-08-23 18:56:52 +0200 | [diff] [blame] | 9818 | /* mute/unmute internal speaker according to the hp jack and mute state */ |
| 9819 | static void alc268_acer_automute(struct hda_codec *codec, int force) |
| 9820 | { |
| 9821 | struct alc_spec *spec = codec->spec; |
| 9822 | unsigned int mute; |
| 9823 | |
| 9824 | if (force || !spec->sense_updated) { |
| 9825 | unsigned int present; |
| 9826 | present = snd_hda_codec_read(codec, 0x14, 0, |
| 9827 | AC_VERB_GET_PIN_SENSE, 0); |
| 9828 | spec->jack_present = (present & 0x80000000) != 0; |
| 9829 | spec->sense_updated = 1; |
| 9830 | } |
| 9831 | if (spec->jack_present) |
| 9832 | mute = HDA_AMP_MUTE; /* mute internal speaker */ |
| 9833 | else /* unmute internal speaker if necessary */ |
| 9834 | mute = snd_hda_codec_amp_read(codec, 0x14, 0, HDA_OUTPUT, 0); |
| 9835 | snd_hda_codec_amp_stereo(codec, 0x15, HDA_OUTPUT, 0, |
| 9836 | HDA_AMP_MUTE, mute); |
| 9837 | } |
| 9838 | |
| 9839 | |
| 9840 | /* bind hp and internal speaker mute (with plug check) */ |
| 9841 | static int alc268_acer_master_sw_put(struct snd_kcontrol *kcontrol, |
| 9842 | struct snd_ctl_elem_value *ucontrol) |
| 9843 | { |
| 9844 | struct hda_codec *codec = snd_kcontrol_chip(kcontrol); |
| 9845 | long *valp = ucontrol->value.integer.value; |
| 9846 | int change; |
| 9847 | |
| 9848 | change = snd_hda_codec_amp_update(codec, 0x14, 0, HDA_OUTPUT, 0, |
| 9849 | HDA_AMP_MUTE, |
| 9850 | valp[0] ? 0 : HDA_AMP_MUTE); |
| 9851 | change |= snd_hda_codec_amp_update(codec, 0x14, 1, HDA_OUTPUT, 0, |
| 9852 | HDA_AMP_MUTE, |
| 9853 | valp[1] ? 0 : HDA_AMP_MUTE); |
| 9854 | if (change) |
| 9855 | alc268_acer_automute(codec, 0); |
| 9856 | return change; |
| 9857 | } |
Takashi Iwai | d273809 | 2007-08-16 14:59:45 +0200 | [diff] [blame] | 9858 | |
| 9859 | static struct snd_kcontrol_new alc268_acer_mixer[] = { |
| 9860 | /* output mixer control */ |
| 9861 | HDA_BIND_VOL("Master Playback Volume", &alc268_acer_bind_master_vol), |
| 9862 | { |
| 9863 | .iface = SNDRV_CTL_ELEM_IFACE_MIXER, |
| 9864 | .name = "Master Playback Switch", |
| 9865 | .info = snd_hda_mixer_amp_switch_info, |
| 9866 | .get = snd_hda_mixer_amp_switch_get, |
| 9867 | .put = alc268_acer_master_sw_put, |
| 9868 | .private_value = HDA_COMPOSE_AMP_VAL(0x14, 3, 0, HDA_OUTPUT), |
| 9869 | }, |
Takashi Iwai | 33bf17a | 2007-08-21 11:51:42 +0200 | [diff] [blame] | 9870 | HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT), |
| 9871 | HDA_CODEC_VOLUME("Internal Mic Boost", 0x19, 0, HDA_INPUT), |
| 9872 | HDA_CODEC_VOLUME("Line In Boost", 0x1a, 0, HDA_INPUT), |
Takashi Iwai | d273809 | 2007-08-16 14:59:45 +0200 | [diff] [blame] | 9873 | { } |
| 9874 | }; |
| 9875 | |
| 9876 | static struct hda_verb alc268_acer_verbs[] = { |
Takashi Iwai | 0ccb541 | 2008-03-06 16:58:35 +0100 | [diff] [blame] | 9877 | {0x12, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, /* internal dmic? */ |
| 9878 | {0x13, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
Takashi Iwai | d273809 | 2007-08-16 14:59:45 +0200 | [diff] [blame] | 9879 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 9880 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
Takashi Iwai | 0ccb541 | 2008-03-06 16:58:35 +0100 | [diff] [blame] | 9881 | {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80}, |
| 9882 | {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80}, |
Takashi Iwai | d273809 | 2007-08-16 14:59:45 +0200 | [diff] [blame] | 9883 | |
| 9884 | {0x14, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN}, |
| 9885 | { } |
| 9886 | }; |
| 9887 | |
| 9888 | /* unsolicited event for HP jack sensing */ |
| 9889 | static void alc268_toshiba_unsol_event(struct hda_codec *codec, |
| 9890 | unsigned int res) |
| 9891 | { |
Takashi Iwai | 889c439 | 2007-08-23 18:56:52 +0200 | [diff] [blame] | 9892 | if ((res >> 26) != ALC880_HP_EVENT) |
Takashi Iwai | d273809 | 2007-08-16 14:59:45 +0200 | [diff] [blame] | 9893 | return; |
| 9894 | alc268_toshiba_automute(codec); |
| 9895 | } |
| 9896 | |
| 9897 | static void alc268_acer_unsol_event(struct hda_codec *codec, |
| 9898 | unsigned int res) |
| 9899 | { |
Takashi Iwai | 889c439 | 2007-08-23 18:56:52 +0200 | [diff] [blame] | 9900 | if ((res >> 26) != ALC880_HP_EVENT) |
Takashi Iwai | d273809 | 2007-08-16 14:59:45 +0200 | [diff] [blame] | 9901 | return; |
| 9902 | alc268_acer_automute(codec, 1); |
| 9903 | } |
| 9904 | |
Takashi Iwai | 889c439 | 2007-08-23 18:56:52 +0200 | [diff] [blame] | 9905 | static void alc268_acer_init_hook(struct hda_codec *codec) |
| 9906 | { |
| 9907 | alc268_acer_automute(codec, 1); |
| 9908 | } |
| 9909 | |
Takashi Iwai | 3866f0b | 2008-01-15 12:37:42 +0100 | [diff] [blame] | 9910 | static struct snd_kcontrol_new alc268_dell_mixer[] = { |
| 9911 | /* output mixer control */ |
| 9912 | HDA_CODEC_VOLUME("Speaker Playback Volume", 0x02, 0x0, HDA_OUTPUT), |
| 9913 | HDA_CODEC_MUTE("Speaker Playback Switch", 0x14, 0x0, HDA_OUTPUT), |
| 9914 | HDA_CODEC_VOLUME("Headphone Playback Volume", 0x03, 0x0, HDA_OUTPUT), |
| 9915 | HDA_CODEC_MUTE("Headphone Playback Switch", 0x15, 0x0, HDA_OUTPUT), |
| 9916 | HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT), |
| 9917 | HDA_CODEC_VOLUME("Internal Mic Boost", 0x19, 0, HDA_INPUT), |
| 9918 | { } |
| 9919 | }; |
| 9920 | |
| 9921 | static struct hda_verb alc268_dell_verbs[] = { |
| 9922 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 9923 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 9924 | {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN}, |
| 9925 | { } |
| 9926 | }; |
| 9927 | |
| 9928 | /* mute/unmute internal speaker according to the hp jack and mute state */ |
| 9929 | static void alc268_dell_automute(struct hda_codec *codec) |
| 9930 | { |
| 9931 | unsigned int present; |
| 9932 | unsigned int mute; |
| 9933 | |
| 9934 | present = snd_hda_codec_read(codec, 0x15, 0, AC_VERB_GET_PIN_SENSE, 0); |
| 9935 | if (present & 0x80000000) |
| 9936 | mute = HDA_AMP_MUTE; |
| 9937 | else |
| 9938 | mute = snd_hda_codec_amp_read(codec, 0x15, 0, HDA_OUTPUT, 0); |
| 9939 | snd_hda_codec_amp_stereo(codec, 0x14, HDA_OUTPUT, 0, |
| 9940 | HDA_AMP_MUTE, mute); |
| 9941 | } |
| 9942 | |
| 9943 | static void alc268_dell_unsol_event(struct hda_codec *codec, |
| 9944 | unsigned int res) |
| 9945 | { |
| 9946 | if ((res >> 26) != ALC880_HP_EVENT) |
| 9947 | return; |
| 9948 | alc268_dell_automute(codec); |
| 9949 | } |
| 9950 | |
| 9951 | #define alc268_dell_init_hook alc268_dell_automute |
| 9952 | |
Kailang Yang | a361d84 | 2007-06-05 12:30:55 +0200 | [diff] [blame] | 9953 | /* |
| 9954 | * generic initialization of ADC, input mixers and output mixers |
| 9955 | */ |
| 9956 | static struct hda_verb alc268_base_init_verbs[] = { |
| 9957 | /* Unmute DAC0-1 and set vol = 0 */ |
| 9958 | {0x02, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 9959 | {0x02, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 9960 | {0x02, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 9961 | {0x03, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 9962 | {0x03, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 9963 | {0x03, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 9964 | |
| 9965 | /* |
| 9966 | * Set up output mixers (0x0c - 0x0e) |
| 9967 | */ |
| 9968 | /* set vol=0 to output mixers */ |
| 9969 | {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 9970 | {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 9971 | {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 9972 | {0x0e, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 9973 | |
| 9974 | {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 9975 | {0x10, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 9976 | |
| 9977 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x40}, |
| 9978 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, 0xc0}, |
| 9979 | {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x40}, |
| 9980 | {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24}, |
| 9981 | {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24}, |
| 9982 | {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20}, |
| 9983 | {0x1c, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20}, |
| 9984 | {0x1d, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20}, |
| 9985 | |
| 9986 | {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
| 9987 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
| 9988 | {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
| 9989 | {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
| 9990 | {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
| 9991 | {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
| 9992 | {0x1c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
Takashi Iwai | aef9d31 | 2008-02-19 13:16:41 +0100 | [diff] [blame] | 9993 | |
| 9994 | /* set PCBEEP vol = 0, mute connections */ |
| 9995 | {0x1d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 9996 | {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
| 9997 | {0x10, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
Kailang Yang | a361d84 | 2007-06-05 12:30:55 +0200 | [diff] [blame] | 9998 | |
Jiang Zhe | a9b3aa8 | 2007-12-20 13:13:13 +0100 | [diff] [blame] | 9999 | /* Unmute Selector 23h,24h and set the default input to mic-in */ |
| 10000 | |
| 10001 | {0x23, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 10002 | {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 10003 | {0x24, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 10004 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
Kailang Yang | a361d84 | 2007-06-05 12:30:55 +0200 | [diff] [blame] | 10005 | |
Kailang Yang | a361d84 | 2007-06-05 12:30:55 +0200 | [diff] [blame] | 10006 | { } |
| 10007 | }; |
| 10008 | |
| 10009 | /* |
| 10010 | * generic initialization of ADC, input mixers and output mixers |
| 10011 | */ |
| 10012 | static struct hda_verb alc268_volume_init_verbs[] = { |
| 10013 | /* set output DAC */ |
| 10014 | {0x02, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 10015 | {0x02, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 10016 | {0x03, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 10017 | {0x03, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 10018 | |
| 10019 | {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24}, |
| 10020 | {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24}, |
| 10021 | {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20}, |
| 10022 | {0x1c, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20}, |
| 10023 | {0x1d, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20}, |
| 10024 | |
| 10025 | {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 10026 | {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 10027 | {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 10028 | {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 10029 | {0x10, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 10030 | |
| 10031 | {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
| 10032 | {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
| 10033 | {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
| 10034 | {0x1c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
| 10035 | |
Takashi Iwai | aef9d31 | 2008-02-19 13:16:41 +0100 | [diff] [blame] | 10036 | /* set PCBEEP vol = 0, mute connections */ |
| 10037 | {0x1d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 10038 | {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
| 10039 | {0x10, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
Kailang Yang | a361d84 | 2007-06-05 12:30:55 +0200 | [diff] [blame] | 10040 | |
| 10041 | { } |
| 10042 | }; |
| 10043 | |
| 10044 | #define alc268_mux_enum_info alc_mux_enum_info |
| 10045 | #define alc268_mux_enum_get alc_mux_enum_get |
Takashi Iwai | e140634 | 2008-02-11 18:32:32 +0100 | [diff] [blame] | 10046 | #define alc268_mux_enum_put alc_mux_enum_put |
Kailang Yang | a361d84 | 2007-06-05 12:30:55 +0200 | [diff] [blame] | 10047 | |
| 10048 | static struct snd_kcontrol_new alc268_capture_alt_mixer[] = { |
| 10049 | HDA_CODEC_VOLUME("Capture Volume", 0x23, 0x0, HDA_OUTPUT), |
| 10050 | HDA_CODEC_MUTE("Capture Switch", 0x23, 0x0, HDA_OUTPUT), |
| 10051 | { |
| 10052 | .iface = SNDRV_CTL_ELEM_IFACE_MIXER, |
| 10053 | /* The multiple "Capture Source" controls confuse alsamixer |
| 10054 | * So call somewhat different.. |
Kailang Yang | a361d84 | 2007-06-05 12:30:55 +0200 | [diff] [blame] | 10055 | */ |
| 10056 | /* .name = "Capture Source", */ |
| 10057 | .name = "Input Source", |
| 10058 | .count = 1, |
| 10059 | .info = alc268_mux_enum_info, |
| 10060 | .get = alc268_mux_enum_get, |
| 10061 | .put = alc268_mux_enum_put, |
| 10062 | }, |
| 10063 | { } /* end */ |
| 10064 | }; |
| 10065 | |
| 10066 | static struct snd_kcontrol_new alc268_capture_mixer[] = { |
| 10067 | HDA_CODEC_VOLUME("Capture Volume", 0x23, 0x0, HDA_OUTPUT), |
| 10068 | HDA_CODEC_MUTE("Capture Switch", 0x23, 0x0, HDA_OUTPUT), |
| 10069 | HDA_CODEC_VOLUME_IDX("Capture Volume", 1, 0x24, 0x0, HDA_OUTPUT), |
| 10070 | HDA_CODEC_MUTE_IDX("Capture Switch", 1, 0x24, 0x0, HDA_OUTPUT), |
| 10071 | { |
| 10072 | .iface = SNDRV_CTL_ELEM_IFACE_MIXER, |
| 10073 | /* The multiple "Capture Source" controls confuse alsamixer |
| 10074 | * So call somewhat different.. |
Kailang Yang | a361d84 | 2007-06-05 12:30:55 +0200 | [diff] [blame] | 10075 | */ |
| 10076 | /* .name = "Capture Source", */ |
| 10077 | .name = "Input Source", |
| 10078 | .count = 2, |
| 10079 | .info = alc268_mux_enum_info, |
| 10080 | .get = alc268_mux_enum_get, |
| 10081 | .put = alc268_mux_enum_put, |
| 10082 | }, |
| 10083 | { } /* end */ |
| 10084 | }; |
| 10085 | |
| 10086 | static struct hda_input_mux alc268_capture_source = { |
| 10087 | .num_items = 4, |
| 10088 | .items = { |
| 10089 | { "Mic", 0x0 }, |
| 10090 | { "Front Mic", 0x1 }, |
| 10091 | { "Line", 0x2 }, |
| 10092 | { "CD", 0x3 }, |
| 10093 | }, |
| 10094 | }; |
| 10095 | |
Takashi Iwai | 0ccb541 | 2008-03-06 16:58:35 +0100 | [diff] [blame] | 10096 | static struct hda_input_mux alc268_acer_capture_source = { |
| 10097 | .num_items = 3, |
| 10098 | .items = { |
| 10099 | { "Mic", 0x0 }, |
| 10100 | { "Internal Mic", 0x6 }, |
| 10101 | { "Line", 0x2 }, |
| 10102 | }, |
| 10103 | }; |
| 10104 | |
Jonathan Woithe | 86c53bd | 2008-01-08 12:33:19 +0100 | [diff] [blame] | 10105 | #ifdef CONFIG_SND_DEBUG |
| 10106 | static struct snd_kcontrol_new alc268_test_mixer[] = { |
Jonathan Woithe | 86c53bd | 2008-01-08 12:33:19 +0100 | [diff] [blame] | 10107 | /* Volume widgets */ |
| 10108 | HDA_CODEC_VOLUME("LOUT1 Playback Volume", 0x02, 0x0, HDA_OUTPUT), |
| 10109 | HDA_CODEC_VOLUME("LOUT2 Playback Volume", 0x03, 0x0, HDA_OUTPUT), |
| 10110 | HDA_BIND_MUTE_MONO("Mono sum Playback Switch", 0x0e, 1, 2, HDA_INPUT), |
| 10111 | HDA_BIND_MUTE("LINE-OUT sum Playback Switch", 0x0f, 2, HDA_INPUT), |
| 10112 | HDA_BIND_MUTE("HP-OUT sum Playback Switch", 0x10, 2, HDA_INPUT), |
| 10113 | HDA_BIND_MUTE("LINE-OUT Playback Switch", 0x14, 2, HDA_OUTPUT), |
| 10114 | HDA_BIND_MUTE("HP-OUT Playback Switch", 0x15, 2, HDA_OUTPUT), |
| 10115 | HDA_BIND_MUTE("Mono Playback Switch", 0x16, 2, HDA_OUTPUT), |
| 10116 | HDA_CODEC_VOLUME("MIC1 Capture Volume", 0x18, 0x0, HDA_INPUT), |
| 10117 | HDA_BIND_MUTE("MIC1 Capture Switch", 0x18, 2, HDA_OUTPUT), |
| 10118 | HDA_CODEC_VOLUME("MIC2 Capture Volume", 0x19, 0x0, HDA_INPUT), |
| 10119 | HDA_CODEC_VOLUME("LINE1 Capture Volume", 0x1a, 0x0, HDA_INPUT), |
| 10120 | HDA_BIND_MUTE("LINE1 Capture Switch", 0x1a, 2, HDA_OUTPUT), |
Takashi Iwai | f0747ee | 2008-01-15 11:41:41 +0100 | [diff] [blame] | 10121 | /* The below appears problematic on some hardwares */ |
| 10122 | /*HDA_CODEC_VOLUME("PCBEEP Playback Volume", 0x1d, 0x0, HDA_INPUT),*/ |
Jonathan Woithe | 86c53bd | 2008-01-08 12:33:19 +0100 | [diff] [blame] | 10123 | HDA_CODEC_VOLUME("PCM-IN1 Capture Volume", 0x23, 0x0, HDA_OUTPUT), |
| 10124 | HDA_BIND_MUTE("PCM-IN1 Capture Switch", 0x23, 2, HDA_OUTPUT), |
| 10125 | HDA_CODEC_VOLUME("PCM-IN2 Capture Volume", 0x24, 0x0, HDA_OUTPUT), |
| 10126 | HDA_BIND_MUTE("PCM-IN2 Capture Switch", 0x24, 2, HDA_OUTPUT), |
| 10127 | |
| 10128 | /* Modes for retasking pin widgets */ |
| 10129 | ALC_PIN_MODE("LINE-OUT pin mode", 0x14, ALC_PIN_DIR_INOUT), |
| 10130 | ALC_PIN_MODE("HP-OUT pin mode", 0x15, ALC_PIN_DIR_INOUT), |
| 10131 | ALC_PIN_MODE("MIC1 pin mode", 0x18, ALC_PIN_DIR_INOUT), |
| 10132 | ALC_PIN_MODE("LINE1 pin mode", 0x1a, ALC_PIN_DIR_INOUT), |
| 10133 | |
| 10134 | /* Controls for GPIO pins, assuming they are configured as outputs */ |
| 10135 | ALC_GPIO_DATA_SWITCH("GPIO pin 0", 0x01, 0x01), |
| 10136 | ALC_GPIO_DATA_SWITCH("GPIO pin 1", 0x01, 0x02), |
| 10137 | ALC_GPIO_DATA_SWITCH("GPIO pin 2", 0x01, 0x04), |
| 10138 | ALC_GPIO_DATA_SWITCH("GPIO pin 3", 0x01, 0x08), |
| 10139 | |
| 10140 | /* Switches to allow the digital SPDIF output pin to be enabled. |
| 10141 | * The ALC268 does not have an SPDIF input. |
| 10142 | */ |
| 10143 | ALC_SPDIF_CTRL_SWITCH("SPDIF Playback Switch", 0x06, 0x01), |
| 10144 | |
| 10145 | /* A switch allowing EAPD to be enabled. Some laptops seem to use |
| 10146 | * this output to turn on an external amplifier. |
| 10147 | */ |
| 10148 | ALC_EAPD_CTRL_SWITCH("LINE-OUT EAPD Enable Switch", 0x0f, 0x02), |
| 10149 | ALC_EAPD_CTRL_SWITCH("HP-OUT EAPD Enable Switch", 0x10, 0x02), |
| 10150 | |
| 10151 | { } /* end */ |
| 10152 | }; |
| 10153 | #endif |
| 10154 | |
Kailang Yang | a361d84 | 2007-06-05 12:30:55 +0200 | [diff] [blame] | 10155 | /* create input playback/capture controls for the given pin */ |
| 10156 | static int alc268_new_analog_output(struct alc_spec *spec, hda_nid_t nid, |
| 10157 | const char *ctlname, int idx) |
| 10158 | { |
| 10159 | char name[32]; |
| 10160 | int err; |
| 10161 | |
| 10162 | sprintf(name, "%s Playback Volume", ctlname); |
| 10163 | if (nid == 0x14) { |
| 10164 | err = add_control(spec, ALC_CTL_WIDGET_VOL, name, |
| 10165 | HDA_COMPOSE_AMP_VAL(0x02, 3, idx, |
| 10166 | HDA_OUTPUT)); |
| 10167 | if (err < 0) |
| 10168 | return err; |
| 10169 | } else if (nid == 0x15) { |
| 10170 | err = add_control(spec, ALC_CTL_WIDGET_VOL, name, |
| 10171 | HDA_COMPOSE_AMP_VAL(0x03, 3, idx, |
| 10172 | HDA_OUTPUT)); |
| 10173 | if (err < 0) |
| 10174 | return err; |
| 10175 | } else |
| 10176 | return -1; |
| 10177 | sprintf(name, "%s Playback Switch", ctlname); |
| 10178 | err = add_control(spec, ALC_CTL_WIDGET_MUTE, name, |
| 10179 | HDA_COMPOSE_AMP_VAL(nid, 3, idx, HDA_OUTPUT)); |
| 10180 | if (err < 0) |
| 10181 | return err; |
| 10182 | return 0; |
| 10183 | } |
| 10184 | |
| 10185 | /* add playback controls from the parsed DAC table */ |
| 10186 | static int alc268_auto_create_multi_out_ctls(struct alc_spec *spec, |
| 10187 | const struct auto_pin_cfg *cfg) |
| 10188 | { |
| 10189 | hda_nid_t nid; |
| 10190 | int err; |
| 10191 | |
| 10192 | spec->multiout.num_dacs = 2; /* only use one dac */ |
| 10193 | spec->multiout.dac_nids = spec->private_dac_nids; |
| 10194 | spec->multiout.dac_nids[0] = 2; |
| 10195 | spec->multiout.dac_nids[1] = 3; |
| 10196 | |
| 10197 | nid = cfg->line_out_pins[0]; |
| 10198 | if (nid) |
| 10199 | alc268_new_analog_output(spec, nid, "Front", 0); |
| 10200 | |
| 10201 | nid = cfg->speaker_pins[0]; |
| 10202 | if (nid == 0x1d) { |
| 10203 | err = add_control(spec, ALC_CTL_WIDGET_VOL, |
| 10204 | "Speaker Playback Volume", |
| 10205 | HDA_COMPOSE_AMP_VAL(nid, 3, 0, HDA_INPUT)); |
| 10206 | if (err < 0) |
| 10207 | return err; |
| 10208 | } |
| 10209 | nid = cfg->hp_pins[0]; |
| 10210 | if (nid) |
| 10211 | alc268_new_analog_output(spec, nid, "Headphone", 0); |
| 10212 | |
| 10213 | nid = cfg->line_out_pins[1] | cfg->line_out_pins[2]; |
| 10214 | if (nid == 0x16) { |
| 10215 | err = add_control(spec, ALC_CTL_WIDGET_MUTE, |
| 10216 | "Mono Playback Switch", |
| 10217 | HDA_COMPOSE_AMP_VAL(nid, 2, 0, HDA_INPUT)); |
| 10218 | if (err < 0) |
| 10219 | return err; |
| 10220 | } |
| 10221 | return 0; |
| 10222 | } |
| 10223 | |
| 10224 | /* create playback/capture controls for input pins */ |
| 10225 | static int alc268_auto_create_analog_input_ctls(struct alc_spec *spec, |
| 10226 | const struct auto_pin_cfg *cfg) |
| 10227 | { |
| 10228 | struct hda_input_mux *imux = &spec->private_imux; |
| 10229 | int i, idx1; |
| 10230 | |
| 10231 | for (i = 0; i < AUTO_PIN_LAST; i++) { |
| 10232 | switch(cfg->input_pins[i]) { |
| 10233 | case 0x18: |
| 10234 | idx1 = 0; /* Mic 1 */ |
| 10235 | break; |
| 10236 | case 0x19: |
| 10237 | idx1 = 1; /* Mic 2 */ |
| 10238 | break; |
| 10239 | case 0x1a: |
| 10240 | idx1 = 2; /* Line In */ |
| 10241 | break; |
| 10242 | case 0x1c: |
| 10243 | idx1 = 3; /* CD */ |
| 10244 | break; |
Takashi Iwai | 7194cae | 2008-03-06 16:58:17 +0100 | [diff] [blame] | 10245 | case 0x12: |
| 10246 | case 0x13: |
| 10247 | idx1 = 6; /* digital mics */ |
| 10248 | break; |
Kailang Yang | a361d84 | 2007-06-05 12:30:55 +0200 | [diff] [blame] | 10249 | default: |
| 10250 | continue; |
| 10251 | } |
| 10252 | imux->items[imux->num_items].label = auto_pin_cfg_labels[i]; |
| 10253 | imux->items[imux->num_items].index = idx1; |
| 10254 | imux->num_items++; |
| 10255 | } |
| 10256 | return 0; |
| 10257 | } |
| 10258 | |
| 10259 | static void alc268_auto_init_mono_speaker_out(struct hda_codec *codec) |
| 10260 | { |
| 10261 | struct alc_spec *spec = codec->spec; |
| 10262 | hda_nid_t speaker_nid = spec->autocfg.speaker_pins[0]; |
| 10263 | hda_nid_t hp_nid = spec->autocfg.hp_pins[0]; |
| 10264 | hda_nid_t line_nid = spec->autocfg.line_out_pins[0]; |
| 10265 | unsigned int dac_vol1, dac_vol2; |
| 10266 | |
| 10267 | if (speaker_nid) { |
| 10268 | snd_hda_codec_write(codec, speaker_nid, 0, |
| 10269 | AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT); |
| 10270 | snd_hda_codec_write(codec, 0x0f, 0, |
| 10271 | AC_VERB_SET_AMP_GAIN_MUTE, |
| 10272 | AMP_IN_UNMUTE(1)); |
| 10273 | snd_hda_codec_write(codec, 0x10, 0, |
| 10274 | AC_VERB_SET_AMP_GAIN_MUTE, |
| 10275 | AMP_IN_UNMUTE(1)); |
| 10276 | } else { |
| 10277 | snd_hda_codec_write(codec, 0x0f, 0, |
| 10278 | AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)); |
| 10279 | snd_hda_codec_write(codec, 0x10, 0, |
| 10280 | AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)); |
| 10281 | } |
| 10282 | |
| 10283 | dac_vol1 = dac_vol2 = 0xb000 | 0x40; /* set max volume */ |
| 10284 | if (line_nid == 0x14) |
| 10285 | dac_vol2 = AMP_OUT_ZERO; |
| 10286 | else if (line_nid == 0x15) |
| 10287 | dac_vol1 = AMP_OUT_ZERO; |
| 10288 | if (hp_nid == 0x14) |
| 10289 | dac_vol2 = AMP_OUT_ZERO; |
| 10290 | else if (hp_nid == 0x15) |
| 10291 | dac_vol1 = AMP_OUT_ZERO; |
| 10292 | if (line_nid != 0x16 || hp_nid != 0x16 || |
| 10293 | spec->autocfg.line_out_pins[1] != 0x16 || |
| 10294 | spec->autocfg.line_out_pins[2] != 0x16) |
| 10295 | dac_vol1 = dac_vol2 = AMP_OUT_ZERO; |
| 10296 | |
| 10297 | snd_hda_codec_write(codec, 0x02, 0, |
| 10298 | AC_VERB_SET_AMP_GAIN_MUTE, dac_vol1); |
| 10299 | snd_hda_codec_write(codec, 0x03, 0, |
| 10300 | AC_VERB_SET_AMP_GAIN_MUTE, dac_vol2); |
| 10301 | } |
| 10302 | |
| 10303 | /* pcm configuration: identiacal with ALC880 */ |
| 10304 | #define alc268_pcm_analog_playback alc880_pcm_analog_playback |
| 10305 | #define alc268_pcm_analog_capture alc880_pcm_analog_capture |
Takashi Iwai | 6330079 | 2008-01-24 15:31:36 +0100 | [diff] [blame] | 10306 | #define alc268_pcm_analog_alt_capture alc880_pcm_analog_alt_capture |
Kailang Yang | a361d84 | 2007-06-05 12:30:55 +0200 | [diff] [blame] | 10307 | #define alc268_pcm_digital_playback alc880_pcm_digital_playback |
| 10308 | |
| 10309 | /* |
| 10310 | * BIOS auto configuration |
| 10311 | */ |
| 10312 | static int alc268_parse_auto_config(struct hda_codec *codec) |
| 10313 | { |
| 10314 | struct alc_spec *spec = codec->spec; |
| 10315 | int err; |
| 10316 | static hda_nid_t alc268_ignore[] = { 0 }; |
| 10317 | |
| 10318 | err = snd_hda_parse_pin_def_config(codec, &spec->autocfg, |
| 10319 | alc268_ignore); |
| 10320 | if (err < 0) |
| 10321 | return err; |
| 10322 | if (!spec->autocfg.line_outs) |
| 10323 | return 0; /* can't find valid BIOS pin config */ |
| 10324 | |
| 10325 | err = alc268_auto_create_multi_out_ctls(spec, &spec->autocfg); |
| 10326 | if (err < 0) |
| 10327 | return err; |
| 10328 | err = alc268_auto_create_analog_input_ctls(spec, &spec->autocfg); |
| 10329 | if (err < 0) |
| 10330 | return err; |
| 10331 | |
| 10332 | spec->multiout.max_channels = 2; |
| 10333 | |
| 10334 | /* digital only support output */ |
| 10335 | if (spec->autocfg.dig_out_pin) |
| 10336 | spec->multiout.dig_out_nid = ALC268_DIGOUT_NID; |
| 10337 | |
| 10338 | if (spec->kctl_alloc) |
| 10339 | spec->mixers[spec->num_mixers++] = spec->kctl_alloc; |
| 10340 | |
Takashi Iwai | aef9d31 | 2008-02-19 13:16:41 +0100 | [diff] [blame] | 10341 | if (spec->autocfg.speaker_pins[0] != 0x1d) |
| 10342 | spec->mixers[spec->num_mixers++] = alc268_beep_mixer; |
| 10343 | |
Kailang Yang | a361d84 | 2007-06-05 12:30:55 +0200 | [diff] [blame] | 10344 | spec->init_verbs[spec->num_init_verbs++] = alc268_volume_init_verbs; |
| 10345 | spec->num_mux_defs = 1; |
| 10346 | spec->input_mux = &spec->private_imux; |
| 10347 | |
Takashi Iwai | 776e184 | 2007-08-29 15:07:11 +0200 | [diff] [blame] | 10348 | err = alc_auto_add_mic_boost(codec); |
| 10349 | if (err < 0) |
| 10350 | return err; |
| 10351 | |
Kailang Yang | a361d84 | 2007-06-05 12:30:55 +0200 | [diff] [blame] | 10352 | return 1; |
| 10353 | } |
| 10354 | |
| 10355 | #define alc268_auto_init_multi_out alc882_auto_init_multi_out |
| 10356 | #define alc268_auto_init_hp_out alc882_auto_init_hp_out |
| 10357 | #define alc268_auto_init_analog_input alc882_auto_init_analog_input |
| 10358 | |
| 10359 | /* init callback for auto-configuration model -- overriding the default init */ |
| 10360 | static void alc268_auto_init(struct hda_codec *codec) |
| 10361 | { |
Takashi Iwai | f6c7e54 | 2008-02-12 18:32:23 +0100 | [diff] [blame] | 10362 | struct alc_spec *spec = codec->spec; |
Kailang Yang | a361d84 | 2007-06-05 12:30:55 +0200 | [diff] [blame] | 10363 | alc268_auto_init_multi_out(codec); |
| 10364 | alc268_auto_init_hp_out(codec); |
| 10365 | alc268_auto_init_mono_speaker_out(codec); |
| 10366 | alc268_auto_init_analog_input(codec); |
Takashi Iwai | f6c7e54 | 2008-02-12 18:32:23 +0100 | [diff] [blame] | 10367 | if (spec->unsol_event) |
| 10368 | alc_sku_automute(codec); |
Kailang Yang | a361d84 | 2007-06-05 12:30:55 +0200 | [diff] [blame] | 10369 | } |
| 10370 | |
| 10371 | /* |
| 10372 | * configuration and preset |
| 10373 | */ |
| 10374 | static const char *alc268_models[ALC268_MODEL_LAST] = { |
| 10375 | [ALC268_3ST] = "3stack", |
Takashi Iwai | 983f8ae | 2007-08-15 16:44:04 +0200 | [diff] [blame] | 10376 | [ALC268_TOSHIBA] = "toshiba", |
Takashi Iwai | d273809 | 2007-08-16 14:59:45 +0200 | [diff] [blame] | 10377 | [ALC268_ACER] = "acer", |
Takashi Iwai | 3866f0b | 2008-01-15 12:37:42 +0100 | [diff] [blame] | 10378 | [ALC268_DELL] = "dell", |
Mirco Tischler | f12462c | 2008-02-04 12:33:59 +0100 | [diff] [blame] | 10379 | [ALC268_ZEPTO] = "zepto", |
Jonathan Woithe | 86c53bd | 2008-01-08 12:33:19 +0100 | [diff] [blame] | 10380 | #ifdef CONFIG_SND_DEBUG |
| 10381 | [ALC268_TEST] = "test", |
| 10382 | #endif |
Kailang Yang | a361d84 | 2007-06-05 12:30:55 +0200 | [diff] [blame] | 10383 | [ALC268_AUTO] = "auto", |
| 10384 | }; |
| 10385 | |
| 10386 | static struct snd_pci_quirk alc268_cfg_tbl[] = { |
Takashi Iwai | ac3e374 | 2007-12-17 17:14:18 +0100 | [diff] [blame] | 10387 | SND_PCI_QUIRK(0x1025, 0x0126, "Acer", ALC268_ACER), |
Andy Shevchenko | dafc835 | 2008-01-25 11:53:50 +0100 | [diff] [blame] | 10388 | SND_PCI_QUIRK(0x1025, 0x012e, "Acer Aspire 5310", ALC268_ACER), |
Takashi Iwai | ac3e374 | 2007-12-17 17:14:18 +0100 | [diff] [blame] | 10389 | SND_PCI_QUIRK(0x1025, 0x0130, "Acer Extensa 5210", ALC268_ACER), |
Andy Shevchenko | 29a52c2 | 2008-01-24 17:29:00 +0100 | [diff] [blame] | 10390 | SND_PCI_QUIRK(0x1025, 0x0136, "Acer Aspire 5315", ALC268_ACER), |
Takashi Iwai | 3866f0b | 2008-01-15 12:37:42 +0100 | [diff] [blame] | 10391 | SND_PCI_QUIRK(0x1028, 0x0253, "Dell OEM", ALC268_DELL), |
Takashi Iwai | ac3e374 | 2007-12-17 17:14:18 +0100 | [diff] [blame] | 10392 | SND_PCI_QUIRK(0x103c, 0x30cc, "TOSHIBA", ALC268_TOSHIBA), |
Kailang Yang | a361d84 | 2007-06-05 12:30:55 +0200 | [diff] [blame] | 10393 | SND_PCI_QUIRK(0x1043, 0x1205, "ASUS W7J", ALC268_3ST), |
Kailang Yang | d1a991a | 2007-08-15 16:21:59 +0200 | [diff] [blame] | 10394 | SND_PCI_QUIRK(0x1179, 0xff10, "TOSHIBA A205", ALC268_TOSHIBA), |
Takashi Iwai | 8e7f00f | 2007-09-07 10:58:58 +0200 | [diff] [blame] | 10395 | SND_PCI_QUIRK(0x1179, 0xff50, "TOSHIBA A305", ALC268_TOSHIBA), |
Takashi Iwai | b875bf3 | 2007-09-06 15:00:27 +0200 | [diff] [blame] | 10396 | SND_PCI_QUIRK(0x152d, 0x0763, "Diverse (CPR2000)", ALC268_ACER), |
Mirco Tischler | f12462c | 2008-02-04 12:33:59 +0100 | [diff] [blame] | 10397 | SND_PCI_QUIRK(0x1170, 0x0040, "ZEPTO", ALC268_ZEPTO), |
Kailang Yang | a361d84 | 2007-06-05 12:30:55 +0200 | [diff] [blame] | 10398 | {} |
| 10399 | }; |
| 10400 | |
| 10401 | static struct alc_config_preset alc268_presets[] = { |
| 10402 | [ALC268_3ST] = { |
Takashi Iwai | aef9d31 | 2008-02-19 13:16:41 +0100 | [diff] [blame] | 10403 | .mixers = { alc268_base_mixer, alc268_capture_alt_mixer, |
| 10404 | alc268_beep_mixer }, |
Kailang Yang | a361d84 | 2007-06-05 12:30:55 +0200 | [diff] [blame] | 10405 | .init_verbs = { alc268_base_init_verbs }, |
| 10406 | .num_dacs = ARRAY_SIZE(alc268_dac_nids), |
| 10407 | .dac_nids = alc268_dac_nids, |
| 10408 | .num_adc_nids = ARRAY_SIZE(alc268_adc_nids_alt), |
| 10409 | .adc_nids = alc268_adc_nids_alt, |
Takashi Iwai | e140634 | 2008-02-11 18:32:32 +0100 | [diff] [blame] | 10410 | .capsrc_nids = alc268_capsrc_nids, |
Kailang Yang | a361d84 | 2007-06-05 12:30:55 +0200 | [diff] [blame] | 10411 | .hp_nid = 0x03, |
| 10412 | .dig_out_nid = ALC268_DIGOUT_NID, |
| 10413 | .num_channel_mode = ARRAY_SIZE(alc268_modes), |
| 10414 | .channel_mode = alc268_modes, |
| 10415 | .input_mux = &alc268_capture_source, |
| 10416 | }, |
Kailang Yang | d1a991a | 2007-08-15 16:21:59 +0200 | [diff] [blame] | 10417 | [ALC268_TOSHIBA] = { |
Takashi Iwai | aef9d31 | 2008-02-19 13:16:41 +0100 | [diff] [blame] | 10418 | .mixers = { alc268_base_mixer, alc268_capture_alt_mixer, |
| 10419 | alc268_beep_mixer }, |
Takashi Iwai | d273809 | 2007-08-16 14:59:45 +0200 | [diff] [blame] | 10420 | .init_verbs = { alc268_base_init_verbs, alc268_eapd_verbs, |
| 10421 | alc268_toshiba_verbs }, |
Kailang Yang | d1a991a | 2007-08-15 16:21:59 +0200 | [diff] [blame] | 10422 | .num_dacs = ARRAY_SIZE(alc268_dac_nids), |
| 10423 | .dac_nids = alc268_dac_nids, |
| 10424 | .num_adc_nids = ARRAY_SIZE(alc268_adc_nids_alt), |
| 10425 | .adc_nids = alc268_adc_nids_alt, |
Takashi Iwai | e140634 | 2008-02-11 18:32:32 +0100 | [diff] [blame] | 10426 | .capsrc_nids = alc268_capsrc_nids, |
Kailang Yang | d1a991a | 2007-08-15 16:21:59 +0200 | [diff] [blame] | 10427 | .hp_nid = 0x03, |
| 10428 | .num_channel_mode = ARRAY_SIZE(alc268_modes), |
| 10429 | .channel_mode = alc268_modes, |
| 10430 | .input_mux = &alc268_capture_source, |
Takashi Iwai | d273809 | 2007-08-16 14:59:45 +0200 | [diff] [blame] | 10431 | .unsol_event = alc268_toshiba_unsol_event, |
| 10432 | .init_hook = alc268_toshiba_automute, |
| 10433 | }, |
| 10434 | [ALC268_ACER] = { |
Takashi Iwai | aef9d31 | 2008-02-19 13:16:41 +0100 | [diff] [blame] | 10435 | .mixers = { alc268_acer_mixer, alc268_capture_alt_mixer, |
| 10436 | alc268_beep_mixer }, |
Takashi Iwai | d273809 | 2007-08-16 14:59:45 +0200 | [diff] [blame] | 10437 | .init_verbs = { alc268_base_init_verbs, alc268_eapd_verbs, |
| 10438 | alc268_acer_verbs }, |
| 10439 | .num_dacs = ARRAY_SIZE(alc268_dac_nids), |
| 10440 | .dac_nids = alc268_dac_nids, |
| 10441 | .num_adc_nids = ARRAY_SIZE(alc268_adc_nids_alt), |
| 10442 | .adc_nids = alc268_adc_nids_alt, |
Takashi Iwai | e140634 | 2008-02-11 18:32:32 +0100 | [diff] [blame] | 10443 | .capsrc_nids = alc268_capsrc_nids, |
Takashi Iwai | d273809 | 2007-08-16 14:59:45 +0200 | [diff] [blame] | 10444 | .hp_nid = 0x02, |
| 10445 | .num_channel_mode = ARRAY_SIZE(alc268_modes), |
| 10446 | .channel_mode = alc268_modes, |
Takashi Iwai | 0ccb541 | 2008-03-06 16:58:35 +0100 | [diff] [blame] | 10447 | .input_mux = &alc268_acer_capture_source, |
Takashi Iwai | d273809 | 2007-08-16 14:59:45 +0200 | [diff] [blame] | 10448 | .unsol_event = alc268_acer_unsol_event, |
Takashi Iwai | 889c439 | 2007-08-23 18:56:52 +0200 | [diff] [blame] | 10449 | .init_hook = alc268_acer_init_hook, |
Kailang Yang | d1a991a | 2007-08-15 16:21:59 +0200 | [diff] [blame] | 10450 | }, |
Takashi Iwai | 3866f0b | 2008-01-15 12:37:42 +0100 | [diff] [blame] | 10451 | [ALC268_DELL] = { |
Takashi Iwai | aef9d31 | 2008-02-19 13:16:41 +0100 | [diff] [blame] | 10452 | .mixers = { alc268_dell_mixer, alc268_beep_mixer }, |
Takashi Iwai | 3866f0b | 2008-01-15 12:37:42 +0100 | [diff] [blame] | 10453 | .init_verbs = { alc268_base_init_verbs, alc268_eapd_verbs, |
| 10454 | alc268_dell_verbs }, |
| 10455 | .num_dacs = ARRAY_SIZE(alc268_dac_nids), |
| 10456 | .dac_nids = alc268_dac_nids, |
| 10457 | .hp_nid = 0x02, |
| 10458 | .num_channel_mode = ARRAY_SIZE(alc268_modes), |
| 10459 | .channel_mode = alc268_modes, |
| 10460 | .unsol_event = alc268_dell_unsol_event, |
| 10461 | .init_hook = alc268_dell_init_hook, |
| 10462 | .input_mux = &alc268_capture_source, |
| 10463 | }, |
Mirco Tischler | f12462c | 2008-02-04 12:33:59 +0100 | [diff] [blame] | 10464 | [ALC268_ZEPTO] = { |
Takashi Iwai | aef9d31 | 2008-02-19 13:16:41 +0100 | [diff] [blame] | 10465 | .mixers = { alc268_base_mixer, alc268_capture_alt_mixer, |
| 10466 | alc268_beep_mixer }, |
Mirco Tischler | f12462c | 2008-02-04 12:33:59 +0100 | [diff] [blame] | 10467 | .init_verbs = { alc268_base_init_verbs, alc268_eapd_verbs, |
| 10468 | alc268_toshiba_verbs }, |
| 10469 | .num_dacs = ARRAY_SIZE(alc268_dac_nids), |
| 10470 | .dac_nids = alc268_dac_nids, |
| 10471 | .num_adc_nids = ARRAY_SIZE(alc268_adc_nids_alt), |
| 10472 | .adc_nids = alc268_adc_nids_alt, |
Takashi Iwai | e140634 | 2008-02-11 18:32:32 +0100 | [diff] [blame] | 10473 | .capsrc_nids = alc268_capsrc_nids, |
Mirco Tischler | f12462c | 2008-02-04 12:33:59 +0100 | [diff] [blame] | 10474 | .hp_nid = 0x03, |
| 10475 | .dig_out_nid = ALC268_DIGOUT_NID, |
| 10476 | .num_channel_mode = ARRAY_SIZE(alc268_modes), |
| 10477 | .channel_mode = alc268_modes, |
| 10478 | .input_mux = &alc268_capture_source, |
| 10479 | .unsol_event = alc268_toshiba_unsol_event, |
| 10480 | .init_hook = alc268_toshiba_automute |
| 10481 | }, |
Jonathan Woithe | 86c53bd | 2008-01-08 12:33:19 +0100 | [diff] [blame] | 10482 | #ifdef CONFIG_SND_DEBUG |
| 10483 | [ALC268_TEST] = { |
| 10484 | .mixers = { alc268_test_mixer, alc268_capture_mixer }, |
| 10485 | .init_verbs = { alc268_base_init_verbs, alc268_eapd_verbs, |
| 10486 | alc268_volume_init_verbs }, |
| 10487 | .num_dacs = ARRAY_SIZE(alc268_dac_nids), |
| 10488 | .dac_nids = alc268_dac_nids, |
| 10489 | .num_adc_nids = ARRAY_SIZE(alc268_adc_nids_alt), |
| 10490 | .adc_nids = alc268_adc_nids_alt, |
Takashi Iwai | e140634 | 2008-02-11 18:32:32 +0100 | [diff] [blame] | 10491 | .capsrc_nids = alc268_capsrc_nids, |
Jonathan Woithe | 86c53bd | 2008-01-08 12:33:19 +0100 | [diff] [blame] | 10492 | .hp_nid = 0x03, |
| 10493 | .dig_out_nid = ALC268_DIGOUT_NID, |
| 10494 | .num_channel_mode = ARRAY_SIZE(alc268_modes), |
| 10495 | .channel_mode = alc268_modes, |
| 10496 | .input_mux = &alc268_capture_source, |
| 10497 | }, |
| 10498 | #endif |
Kailang Yang | a361d84 | 2007-06-05 12:30:55 +0200 | [diff] [blame] | 10499 | }; |
| 10500 | |
| 10501 | static int patch_alc268(struct hda_codec *codec) |
| 10502 | { |
| 10503 | struct alc_spec *spec; |
| 10504 | int board_config; |
| 10505 | int err; |
| 10506 | |
| 10507 | spec = kcalloc(1, sizeof(*spec), GFP_KERNEL); |
| 10508 | if (spec == NULL) |
| 10509 | return -ENOMEM; |
| 10510 | |
| 10511 | codec->spec = spec; |
| 10512 | |
| 10513 | board_config = snd_hda_check_board_config(codec, ALC268_MODEL_LAST, |
| 10514 | alc268_models, |
| 10515 | alc268_cfg_tbl); |
| 10516 | |
| 10517 | if (board_config < 0 || board_config >= ALC268_MODEL_LAST) { |
| 10518 | printk(KERN_INFO "hda_codec: Unknown model for ALC268, " |
| 10519 | "trying auto-probe from BIOS...\n"); |
| 10520 | board_config = ALC268_AUTO; |
| 10521 | } |
| 10522 | |
| 10523 | if (board_config == ALC268_AUTO) { |
| 10524 | /* automatic parse from the BIOS config */ |
| 10525 | err = alc268_parse_auto_config(codec); |
| 10526 | if (err < 0) { |
| 10527 | alc_free(codec); |
| 10528 | return err; |
| 10529 | } else if (!err) { |
| 10530 | printk(KERN_INFO |
| 10531 | "hda_codec: Cannot set up configuration " |
| 10532 | "from BIOS. Using base mode...\n"); |
| 10533 | board_config = ALC268_3ST; |
| 10534 | } |
| 10535 | } |
| 10536 | |
| 10537 | if (board_config != ALC268_AUTO) |
| 10538 | setup_preset(spec, &alc268_presets[board_config]); |
| 10539 | |
| 10540 | spec->stream_name_analog = "ALC268 Analog"; |
| 10541 | spec->stream_analog_playback = &alc268_pcm_analog_playback; |
| 10542 | spec->stream_analog_capture = &alc268_pcm_analog_capture; |
Takashi Iwai | 6330079 | 2008-01-24 15:31:36 +0100 | [diff] [blame] | 10543 | spec->stream_analog_alt_capture = &alc268_pcm_analog_alt_capture; |
Kailang Yang | a361d84 | 2007-06-05 12:30:55 +0200 | [diff] [blame] | 10544 | |
| 10545 | spec->stream_name_digital = "ALC268 Digital"; |
| 10546 | spec->stream_digital_playback = &alc268_pcm_digital_playback; |
| 10547 | |
Takashi Iwai | aef9d31 | 2008-02-19 13:16:41 +0100 | [diff] [blame] | 10548 | if (!query_amp_caps(codec, 0x1d, HDA_INPUT)) |
| 10549 | /* override the amp caps for beep generator */ |
| 10550 | snd_hda_override_amp_caps(codec, 0x1d, HDA_INPUT, |
| 10551 | (0x0c << AC_AMPCAP_OFFSET_SHIFT) | |
| 10552 | (0x0c << AC_AMPCAP_NUM_STEPS_SHIFT) | |
| 10553 | (0x07 << AC_AMPCAP_STEP_SIZE_SHIFT) | |
| 10554 | (0 << AC_AMPCAP_MUTE_SHIFT)); |
| 10555 | |
Takashi Iwai | 3866f0b | 2008-01-15 12:37:42 +0100 | [diff] [blame] | 10556 | if (!spec->adc_nids && spec->input_mux) { |
| 10557 | /* check whether NID 0x07 is valid */ |
| 10558 | unsigned int wcap = get_wcaps(codec, 0x07); |
Takashi Iwai | 85860c0 | 2008-02-19 15:00:15 +0100 | [diff] [blame] | 10559 | int i; |
Kailang Yang | a361d84 | 2007-06-05 12:30:55 +0200 | [diff] [blame] | 10560 | |
Takashi Iwai | 3866f0b | 2008-01-15 12:37:42 +0100 | [diff] [blame] | 10561 | /* get type */ |
| 10562 | wcap = (wcap & AC_WCAP_TYPE) >> AC_WCAP_TYPE_SHIFT; |
Takashi Iwai | 67ebcb0 | 2008-02-19 15:03:57 +0100 | [diff] [blame] | 10563 | if (wcap != AC_WID_AUD_IN || spec->input_mux->num_items == 1) { |
Takashi Iwai | 3866f0b | 2008-01-15 12:37:42 +0100 | [diff] [blame] | 10564 | spec->adc_nids = alc268_adc_nids_alt; |
| 10565 | spec->num_adc_nids = ARRAY_SIZE(alc268_adc_nids_alt); |
| 10566 | spec->mixers[spec->num_mixers] = |
Kailang Yang | a361d84 | 2007-06-05 12:30:55 +0200 | [diff] [blame] | 10567 | alc268_capture_alt_mixer; |
Takashi Iwai | 3866f0b | 2008-01-15 12:37:42 +0100 | [diff] [blame] | 10568 | spec->num_mixers++; |
| 10569 | } else { |
| 10570 | spec->adc_nids = alc268_adc_nids; |
| 10571 | spec->num_adc_nids = ARRAY_SIZE(alc268_adc_nids); |
| 10572 | spec->mixers[spec->num_mixers] = |
| 10573 | alc268_capture_mixer; |
| 10574 | spec->num_mixers++; |
Kailang Yang | a361d84 | 2007-06-05 12:30:55 +0200 | [diff] [blame] | 10575 | } |
Takashi Iwai | e140634 | 2008-02-11 18:32:32 +0100 | [diff] [blame] | 10576 | spec->capsrc_nids = alc268_capsrc_nids; |
Takashi Iwai | 85860c0 | 2008-02-19 15:00:15 +0100 | [diff] [blame] | 10577 | /* set default input source */ |
| 10578 | for (i = 0; i < spec->num_adc_nids; i++) |
| 10579 | snd_hda_codec_write_cache(codec, alc268_capsrc_nids[i], |
| 10580 | 0, AC_VERB_SET_CONNECT_SEL, |
| 10581 | spec->input_mux->items[0].index); |
Kailang Yang | a361d84 | 2007-06-05 12:30:55 +0200 | [diff] [blame] | 10582 | } |
Takashi Iwai | 2134ea4 | 2008-01-10 16:53:55 +0100 | [diff] [blame] | 10583 | |
| 10584 | spec->vmaster_nid = 0x02; |
| 10585 | |
Kailang Yang | a361d84 | 2007-06-05 12:30:55 +0200 | [diff] [blame] | 10586 | codec->patch_ops = alc_patch_ops; |
| 10587 | if (board_config == ALC268_AUTO) |
| 10588 | spec->init_hook = alc268_auto_init; |
| 10589 | |
| 10590 | return 0; |
| 10591 | } |
| 10592 | |
| 10593 | /* |
Kailang Yang | f6a9224 | 2007-12-13 16:52:54 +0100 | [diff] [blame] | 10594 | * ALC269 channel source setting (2 channel) |
| 10595 | */ |
| 10596 | #define ALC269_DIGOUT_NID ALC880_DIGOUT_NID |
| 10597 | |
| 10598 | #define alc269_dac_nids alc260_dac_nids |
| 10599 | |
| 10600 | static hda_nid_t alc269_adc_nids[1] = { |
| 10601 | /* ADC1 */ |
| 10602 | 0x07, |
| 10603 | }; |
| 10604 | |
| 10605 | #define alc269_modes alc260_modes |
| 10606 | #define alc269_capture_source alc880_lg_lw_capture_source |
| 10607 | |
| 10608 | static struct snd_kcontrol_new alc269_base_mixer[] = { |
| 10609 | HDA_CODEC_VOLUME("Front Playback Volume", 0x02, 0x0, HDA_OUTPUT), |
| 10610 | HDA_CODEC_MUTE("Front Playback Switch", 0x14, 0x0, HDA_OUTPUT), |
| 10611 | HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT), |
| 10612 | HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT), |
| 10613 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), |
| 10614 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), |
| 10615 | HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT), |
| 10616 | HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x01, HDA_INPUT), |
| 10617 | HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x01, HDA_INPUT), |
| 10618 | HDA_CODEC_VOLUME("Front Mic Boost", 0x19, 0, HDA_INPUT), |
| 10619 | HDA_CODEC_MUTE("Headphone Playback Switch", 0x15, 0x0, HDA_OUTPUT), |
| 10620 | HDA_CODEC_MUTE_MONO("Mono Playback Switch", 0x16, 2, 0x0, HDA_OUTPUT), |
| 10621 | { } /* end */ |
| 10622 | }; |
| 10623 | |
| 10624 | /* capture mixer elements */ |
| 10625 | static struct snd_kcontrol_new alc269_capture_mixer[] = { |
| 10626 | HDA_CODEC_VOLUME("Capture Volume", 0x07, 0x0, HDA_INPUT), |
| 10627 | HDA_CODEC_MUTE("Capture Switch", 0x07, 0x0, HDA_INPUT), |
| 10628 | { |
| 10629 | .iface = SNDRV_CTL_ELEM_IFACE_MIXER, |
| 10630 | /* The multiple "Capture Source" controls confuse alsamixer |
| 10631 | * So call somewhat different.. |
Kailang Yang | f6a9224 | 2007-12-13 16:52:54 +0100 | [diff] [blame] | 10632 | */ |
| 10633 | /* .name = "Capture Source", */ |
| 10634 | .name = "Input Source", |
| 10635 | .count = 1, |
| 10636 | .info = alc_mux_enum_info, |
| 10637 | .get = alc_mux_enum_get, |
| 10638 | .put = alc_mux_enum_put, |
| 10639 | }, |
| 10640 | { } /* end */ |
| 10641 | }; |
| 10642 | |
| 10643 | /* |
| 10644 | * generic initialization of ADC, input mixers and output mixers |
| 10645 | */ |
| 10646 | static struct hda_verb alc269_init_verbs[] = { |
| 10647 | /* |
| 10648 | * Unmute ADC0 and set the default input to mic-in |
| 10649 | */ |
| 10650 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 10651 | |
| 10652 | /* Mute input amps (PCBeep, Line In, Mic 1 & Mic 2) of the |
| 10653 | * analog-loopback mixer widget |
| 10654 | * Note: PASD motherboards uses the Line In 2 as the input for |
| 10655 | * front panel mic (mic 2) |
| 10656 | */ |
| 10657 | /* Amp Indices: Mic1 = 0, Mic2 = 1, Line1 = 2, Line2 = 3, CD = 4 */ |
| 10658 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 10659 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
| 10660 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)}, |
| 10661 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)}, |
| 10662 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)}, |
| 10663 | |
| 10664 | /* |
| 10665 | * Set up output mixers (0x0c - 0x0e) |
| 10666 | */ |
| 10667 | /* set vol=0 to output mixers */ |
| 10668 | {0x02, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 10669 | {0x03, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 10670 | |
| 10671 | /* set up input amps for analog loopback */ |
| 10672 | /* Amp Indices: DAC = 0, mixer = 1 */ |
| 10673 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 10674 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 10675 | {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 10676 | {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 10677 | {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 10678 | {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 10679 | |
| 10680 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 10681 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 10682 | {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 10683 | {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80}, |
| 10684 | {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80}, |
| 10685 | {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
| 10686 | {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
| 10687 | |
| 10688 | {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 10689 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 10690 | {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
| 10691 | {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
| 10692 | {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
| 10693 | {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
| 10694 | {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
| 10695 | |
| 10696 | {0x14, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 10697 | {0x15, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 10698 | |
| 10699 | /* FIXME: use matrix-type input source selection */ |
| 10700 | /* Mixer elements: 0x18, 19, 1a, 1b, 1d, 0b */ |
| 10701 | /* Input mixer1: unmute Mic, F-Mic, Line, CD inputs */ |
| 10702 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 10703 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
| 10704 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)}, |
| 10705 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)}, |
| 10706 | |
| 10707 | /* set EAPD */ |
| 10708 | {0x14, AC_VERB_SET_EAPD_BTLENABLE, 2}, |
| 10709 | {0x15, AC_VERB_SET_EAPD_BTLENABLE, 2}, |
| 10710 | { } |
| 10711 | }; |
| 10712 | |
| 10713 | /* add playback controls from the parsed DAC table */ |
| 10714 | static int alc269_auto_create_multi_out_ctls(struct alc_spec *spec, |
| 10715 | const struct auto_pin_cfg *cfg) |
| 10716 | { |
| 10717 | hda_nid_t nid; |
| 10718 | int err; |
| 10719 | |
| 10720 | spec->multiout.num_dacs = 1; /* only use one dac */ |
| 10721 | spec->multiout.dac_nids = spec->private_dac_nids; |
| 10722 | spec->multiout.dac_nids[0] = 2; |
| 10723 | |
| 10724 | nid = cfg->line_out_pins[0]; |
| 10725 | if (nid) { |
| 10726 | err = add_control(spec, ALC_CTL_WIDGET_VOL, |
| 10727 | "Front Playback Volume", |
| 10728 | HDA_COMPOSE_AMP_VAL(0x02, 3, 0, HDA_OUTPUT)); |
| 10729 | if (err < 0) |
| 10730 | return err; |
| 10731 | err = add_control(spec, ALC_CTL_WIDGET_MUTE, |
| 10732 | "Front Playback Switch", |
| 10733 | HDA_COMPOSE_AMP_VAL(nid, 3, 0, HDA_OUTPUT)); |
| 10734 | if (err < 0) |
| 10735 | return err; |
| 10736 | } |
| 10737 | |
| 10738 | nid = cfg->speaker_pins[0]; |
| 10739 | if (nid) { |
| 10740 | if (!cfg->line_out_pins[0]) { |
| 10741 | err = add_control(spec, ALC_CTL_WIDGET_VOL, |
| 10742 | "Speaker Playback Volume", |
| 10743 | HDA_COMPOSE_AMP_VAL(0x02, 3, 0, |
| 10744 | HDA_OUTPUT)); |
| 10745 | if (err < 0) |
| 10746 | return err; |
| 10747 | } |
| 10748 | if (nid == 0x16) { |
| 10749 | err = add_control(spec, ALC_CTL_WIDGET_MUTE, |
| 10750 | "Speaker Playback Switch", |
| 10751 | HDA_COMPOSE_AMP_VAL(nid, 2, 0, |
| 10752 | HDA_OUTPUT)); |
| 10753 | if (err < 0) |
| 10754 | return err; |
| 10755 | } else { |
| 10756 | err = add_control(spec, ALC_CTL_WIDGET_MUTE, |
| 10757 | "Speaker Playback Switch", |
| 10758 | HDA_COMPOSE_AMP_VAL(nid, 3, 0, |
| 10759 | HDA_OUTPUT)); |
| 10760 | if (err < 0) |
| 10761 | return err; |
| 10762 | } |
| 10763 | } |
| 10764 | nid = cfg->hp_pins[0]; |
| 10765 | if (nid) { |
| 10766 | /* spec->multiout.hp_nid = 2; */ |
| 10767 | if (!cfg->line_out_pins[0] && !cfg->speaker_pins[0]) { |
| 10768 | err = add_control(spec, ALC_CTL_WIDGET_VOL, |
| 10769 | "Headphone Playback Volume", |
| 10770 | HDA_COMPOSE_AMP_VAL(0x02, 3, 0, |
| 10771 | HDA_OUTPUT)); |
| 10772 | if (err < 0) |
| 10773 | return err; |
| 10774 | } |
| 10775 | if (nid == 0x16) { |
| 10776 | err = add_control(spec, ALC_CTL_WIDGET_MUTE, |
| 10777 | "Headphone Playback Switch", |
| 10778 | HDA_COMPOSE_AMP_VAL(nid, 2, 0, |
| 10779 | HDA_OUTPUT)); |
| 10780 | if (err < 0) |
| 10781 | return err; |
| 10782 | } else { |
| 10783 | err = add_control(spec, ALC_CTL_WIDGET_MUTE, |
| 10784 | "Headphone Playback Switch", |
| 10785 | HDA_COMPOSE_AMP_VAL(nid, 3, 0, |
| 10786 | HDA_OUTPUT)); |
| 10787 | if (err < 0) |
| 10788 | return err; |
| 10789 | } |
| 10790 | } |
| 10791 | return 0; |
| 10792 | } |
| 10793 | |
| 10794 | #define alc269_auto_create_analog_input_ctls \ |
| 10795 | alc880_auto_create_analog_input_ctls |
| 10796 | |
| 10797 | #ifdef CONFIG_SND_HDA_POWER_SAVE |
| 10798 | #define alc269_loopbacks alc880_loopbacks |
| 10799 | #endif |
| 10800 | |
| 10801 | /* pcm configuration: identiacal with ALC880 */ |
| 10802 | #define alc269_pcm_analog_playback alc880_pcm_analog_playback |
| 10803 | #define alc269_pcm_analog_capture alc880_pcm_analog_capture |
| 10804 | #define alc269_pcm_digital_playback alc880_pcm_digital_playback |
| 10805 | #define alc269_pcm_digital_capture alc880_pcm_digital_capture |
| 10806 | |
| 10807 | /* |
| 10808 | * BIOS auto configuration |
| 10809 | */ |
| 10810 | static int alc269_parse_auto_config(struct hda_codec *codec) |
| 10811 | { |
| 10812 | struct alc_spec *spec = codec->spec; |
| 10813 | int err; |
| 10814 | static hda_nid_t alc269_ignore[] = { 0x1d, 0 }; |
| 10815 | |
| 10816 | err = snd_hda_parse_pin_def_config(codec, &spec->autocfg, |
| 10817 | alc269_ignore); |
| 10818 | if (err < 0) |
| 10819 | return err; |
| 10820 | |
| 10821 | err = alc269_auto_create_multi_out_ctls(spec, &spec->autocfg); |
| 10822 | if (err < 0) |
| 10823 | return err; |
| 10824 | err = alc269_auto_create_analog_input_ctls(spec, &spec->autocfg); |
| 10825 | if (err < 0) |
| 10826 | return err; |
| 10827 | |
| 10828 | spec->multiout.max_channels = spec->multiout.num_dacs * 2; |
| 10829 | |
| 10830 | if (spec->autocfg.dig_out_pin) |
| 10831 | spec->multiout.dig_out_nid = ALC269_DIGOUT_NID; |
| 10832 | |
| 10833 | if (spec->kctl_alloc) |
| 10834 | spec->mixers[spec->num_mixers++] = spec->kctl_alloc; |
| 10835 | |
| 10836 | spec->init_verbs[spec->num_init_verbs++] = alc269_init_verbs; |
| 10837 | spec->num_mux_defs = 1; |
| 10838 | spec->input_mux = &spec->private_imux; |
| 10839 | |
| 10840 | err = alc_auto_add_mic_boost(codec); |
| 10841 | if (err < 0) |
| 10842 | return err; |
| 10843 | |
| 10844 | return 1; |
| 10845 | } |
| 10846 | |
| 10847 | #define alc269_auto_init_multi_out alc882_auto_init_multi_out |
| 10848 | #define alc269_auto_init_hp_out alc882_auto_init_hp_out |
| 10849 | #define alc269_auto_init_analog_input alc882_auto_init_analog_input |
| 10850 | |
| 10851 | |
| 10852 | /* init callback for auto-configuration model -- overriding the default init */ |
| 10853 | static void alc269_auto_init(struct hda_codec *codec) |
| 10854 | { |
Takashi Iwai | f6c7e54 | 2008-02-12 18:32:23 +0100 | [diff] [blame] | 10855 | struct alc_spec *spec = codec->spec; |
Kailang Yang | f6a9224 | 2007-12-13 16:52:54 +0100 | [diff] [blame] | 10856 | alc269_auto_init_multi_out(codec); |
| 10857 | alc269_auto_init_hp_out(codec); |
| 10858 | alc269_auto_init_analog_input(codec); |
Takashi Iwai | f6c7e54 | 2008-02-12 18:32:23 +0100 | [diff] [blame] | 10859 | if (spec->unsol_event) |
| 10860 | alc_sku_automute(codec); |
Kailang Yang | f6a9224 | 2007-12-13 16:52:54 +0100 | [diff] [blame] | 10861 | } |
| 10862 | |
| 10863 | /* |
| 10864 | * configuration and preset |
| 10865 | */ |
| 10866 | static const char *alc269_models[ALC269_MODEL_LAST] = { |
| 10867 | [ALC269_BASIC] = "basic", |
| 10868 | }; |
| 10869 | |
| 10870 | static struct snd_pci_quirk alc269_cfg_tbl[] = { |
| 10871 | {} |
| 10872 | }; |
| 10873 | |
| 10874 | static struct alc_config_preset alc269_presets[] = { |
| 10875 | [ALC269_BASIC] = { |
| 10876 | .mixers = { alc269_base_mixer }, |
| 10877 | .init_verbs = { alc269_init_verbs }, |
| 10878 | .num_dacs = ARRAY_SIZE(alc269_dac_nids), |
| 10879 | .dac_nids = alc269_dac_nids, |
| 10880 | .hp_nid = 0x03, |
| 10881 | .num_channel_mode = ARRAY_SIZE(alc269_modes), |
| 10882 | .channel_mode = alc269_modes, |
| 10883 | .input_mux = &alc269_capture_source, |
| 10884 | }, |
| 10885 | }; |
| 10886 | |
| 10887 | static int patch_alc269(struct hda_codec *codec) |
| 10888 | { |
| 10889 | struct alc_spec *spec; |
| 10890 | int board_config; |
| 10891 | int err; |
| 10892 | |
| 10893 | spec = kzalloc(sizeof(*spec), GFP_KERNEL); |
| 10894 | if (spec == NULL) |
| 10895 | return -ENOMEM; |
| 10896 | |
| 10897 | codec->spec = spec; |
| 10898 | |
| 10899 | board_config = snd_hda_check_board_config(codec, ALC269_MODEL_LAST, |
| 10900 | alc269_models, |
| 10901 | alc269_cfg_tbl); |
| 10902 | |
| 10903 | if (board_config < 0) { |
| 10904 | printk(KERN_INFO "hda_codec: Unknown model for ALC269, " |
| 10905 | "trying auto-probe from BIOS...\n"); |
| 10906 | board_config = ALC269_AUTO; |
| 10907 | } |
| 10908 | |
| 10909 | if (board_config == ALC269_AUTO) { |
| 10910 | /* automatic parse from the BIOS config */ |
| 10911 | err = alc269_parse_auto_config(codec); |
| 10912 | if (err < 0) { |
| 10913 | alc_free(codec); |
| 10914 | return err; |
| 10915 | } else if (!err) { |
| 10916 | printk(KERN_INFO |
| 10917 | "hda_codec: Cannot set up configuration " |
| 10918 | "from BIOS. Using base mode...\n"); |
| 10919 | board_config = ALC269_BASIC; |
| 10920 | } |
| 10921 | } |
| 10922 | |
| 10923 | if (board_config != ALC269_AUTO) |
| 10924 | setup_preset(spec, &alc269_presets[board_config]); |
| 10925 | |
| 10926 | spec->stream_name_analog = "ALC269 Analog"; |
| 10927 | spec->stream_analog_playback = &alc269_pcm_analog_playback; |
| 10928 | spec->stream_analog_capture = &alc269_pcm_analog_capture; |
| 10929 | |
| 10930 | spec->stream_name_digital = "ALC269 Digital"; |
| 10931 | spec->stream_digital_playback = &alc269_pcm_digital_playback; |
| 10932 | spec->stream_digital_capture = &alc269_pcm_digital_capture; |
| 10933 | |
| 10934 | spec->adc_nids = alc269_adc_nids; |
| 10935 | spec->num_adc_nids = ARRAY_SIZE(alc269_adc_nids); |
| 10936 | spec->mixers[spec->num_mixers] = alc269_capture_mixer; |
| 10937 | spec->num_mixers++; |
| 10938 | |
| 10939 | codec->patch_ops = alc_patch_ops; |
| 10940 | if (board_config == ALC269_AUTO) |
| 10941 | spec->init_hook = alc269_auto_init; |
| 10942 | #ifdef CONFIG_SND_HDA_POWER_SAVE |
| 10943 | if (!spec->loopback.amplist) |
| 10944 | spec->loopback.amplist = alc269_loopbacks; |
| 10945 | #endif |
| 10946 | |
| 10947 | return 0; |
| 10948 | } |
| 10949 | |
| 10950 | /* |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 10951 | * ALC861 channel source setting (2/6 channel selection for 3-stack) |
| 10952 | */ |
| 10953 | |
| 10954 | /* |
| 10955 | * set the path ways for 2 channel output |
| 10956 | * need to set the codec line out and mic 1 pin widgets to inputs |
| 10957 | */ |
| 10958 | static struct hda_verb alc861_threestack_ch2_init[] = { |
| 10959 | /* set pin widget 1Ah (line in) for input */ |
| 10960 | { 0x0c, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20 }, |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 10961 | /* set pin widget 18h (mic1/2) for input, for mic also enable |
| 10962 | * the vref |
| 10963 | */ |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 10964 | { 0x0d, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24 }, |
| 10965 | |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 10966 | { 0x15, AC_VERB_SET_AMP_GAIN_MUTE, 0xb00c }, |
| 10967 | #if 0 |
| 10968 | { 0x15, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x01 << 8)) }, /*mic*/ |
| 10969 | { 0x15, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x02 << 8)) }, /*line-in*/ |
| 10970 | #endif |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 10971 | { } /* end */ |
| 10972 | }; |
| 10973 | /* |
| 10974 | * 6ch mode |
| 10975 | * need to set the codec line out and mic 1 pin widgets to outputs |
| 10976 | */ |
| 10977 | static struct hda_verb alc861_threestack_ch6_init[] = { |
| 10978 | /* set pin widget 1Ah (line in) for output (Back Surround)*/ |
| 10979 | { 0x0c, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x40 }, |
| 10980 | /* set pin widget 18h (mic1) for output (CLFE)*/ |
| 10981 | { 0x0d, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x40 }, |
| 10982 | |
| 10983 | { 0x0c, AC_VERB_SET_CONNECT_SEL, 0x00 }, |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 10984 | { 0x0d, AC_VERB_SET_CONNECT_SEL, 0x00 }, |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 10985 | |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 10986 | { 0x15, AC_VERB_SET_AMP_GAIN_MUTE, 0xb080 }, |
| 10987 | #if 0 |
| 10988 | { 0x15, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x01 << 8)) }, /*mic*/ |
| 10989 | { 0x15, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x02 << 8)) }, /*line in*/ |
| 10990 | #endif |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 10991 | { } /* end */ |
| 10992 | }; |
| 10993 | |
| 10994 | static struct hda_channel_mode alc861_threestack_modes[2] = { |
| 10995 | { 2, alc861_threestack_ch2_init }, |
| 10996 | { 6, alc861_threestack_ch6_init }, |
| 10997 | }; |
Takashi Iwai | 22309c3 | 2006-08-09 16:57:28 +0200 | [diff] [blame] | 10998 | /* Set mic1 as input and unmute the mixer */ |
| 10999 | static struct hda_verb alc861_uniwill_m31_ch2_init[] = { |
| 11000 | { 0x0d, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24 }, |
| 11001 | { 0x15, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x01 << 8)) }, /*mic*/ |
| 11002 | { } /* end */ |
| 11003 | }; |
| 11004 | /* Set mic1 as output and mute mixer */ |
| 11005 | static struct hda_verb alc861_uniwill_m31_ch4_init[] = { |
| 11006 | { 0x0d, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x40 }, |
| 11007 | { 0x15, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x01 << 8)) }, /*mic*/ |
| 11008 | { } /* end */ |
| 11009 | }; |
| 11010 | |
| 11011 | static struct hda_channel_mode alc861_uniwill_m31_modes[2] = { |
| 11012 | { 2, alc861_uniwill_m31_ch2_init }, |
| 11013 | { 4, alc861_uniwill_m31_ch4_init }, |
| 11014 | }; |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 11015 | |
Mariusz Domanski | 7cdbff9 | 2006-10-23 13:42:56 +0200 | [diff] [blame] | 11016 | /* Set mic1 and line-in as input and unmute the mixer */ |
| 11017 | static struct hda_verb alc861_asus_ch2_init[] = { |
| 11018 | /* set pin widget 1Ah (line in) for input */ |
| 11019 | { 0x0c, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20 }, |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 11020 | /* set pin widget 18h (mic1/2) for input, for mic also enable |
| 11021 | * the vref |
| 11022 | */ |
Mariusz Domanski | 7cdbff9 | 2006-10-23 13:42:56 +0200 | [diff] [blame] | 11023 | { 0x0d, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24 }, |
| 11024 | |
| 11025 | { 0x15, AC_VERB_SET_AMP_GAIN_MUTE, 0xb00c }, |
| 11026 | #if 0 |
| 11027 | { 0x15, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x01 << 8)) }, /*mic*/ |
| 11028 | { 0x15, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x02 << 8)) }, /*line-in*/ |
| 11029 | #endif |
| 11030 | { } /* end */ |
| 11031 | }; |
| 11032 | /* Set mic1 nad line-in as output and mute mixer */ |
| 11033 | static struct hda_verb alc861_asus_ch6_init[] = { |
| 11034 | /* set pin widget 1Ah (line in) for output (Back Surround)*/ |
| 11035 | { 0x0c, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x40 }, |
| 11036 | /* { 0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE }, */ |
| 11037 | /* set pin widget 18h (mic1) for output (CLFE)*/ |
| 11038 | { 0x0d, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x40 }, |
| 11039 | /* { 0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE }, */ |
| 11040 | { 0x0c, AC_VERB_SET_CONNECT_SEL, 0x00 }, |
| 11041 | { 0x0d, AC_VERB_SET_CONNECT_SEL, 0x00 }, |
| 11042 | |
| 11043 | { 0x15, AC_VERB_SET_AMP_GAIN_MUTE, 0xb080 }, |
| 11044 | #if 0 |
| 11045 | { 0x15, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x01 << 8)) }, /*mic*/ |
| 11046 | { 0x15, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x02 << 8)) }, /*line in*/ |
| 11047 | #endif |
| 11048 | { } /* end */ |
| 11049 | }; |
| 11050 | |
| 11051 | static struct hda_channel_mode alc861_asus_modes[2] = { |
| 11052 | { 2, alc861_asus_ch2_init }, |
| 11053 | { 6, alc861_asus_ch6_init }, |
| 11054 | }; |
| 11055 | |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 11056 | /* patch-ALC861 */ |
| 11057 | |
| 11058 | static struct snd_kcontrol_new alc861_base_mixer[] = { |
| 11059 | /* output mixer control */ |
| 11060 | HDA_CODEC_MUTE("Front Playback Switch", 0x03, 0x0, HDA_OUTPUT), |
| 11061 | HDA_CODEC_MUTE("Surround Playback Switch", 0x06, 0x0, HDA_OUTPUT), |
| 11062 | HDA_CODEC_MUTE_MONO("Center Playback Switch", 0x05, 1, 0x0, HDA_OUTPUT), |
| 11063 | HDA_CODEC_MUTE_MONO("LFE Playback Switch", 0x05, 2, 0x0, HDA_OUTPUT), |
| 11064 | HDA_CODEC_MUTE("Side Playback Switch", 0x04, 0x0, HDA_OUTPUT), |
| 11065 | |
| 11066 | /*Input mixer control */ |
| 11067 | /* HDA_CODEC_VOLUME("Input Playback Volume", 0x15, 0x0, HDA_OUTPUT), |
| 11068 | HDA_CODEC_MUTE("Input Playback Switch", 0x15, 0x0, HDA_OUTPUT), */ |
| 11069 | HDA_CODEC_VOLUME("CD Playback Volume", 0x15, 0x0, HDA_INPUT), |
| 11070 | HDA_CODEC_MUTE("CD Playback Switch", 0x15, 0x0, HDA_INPUT), |
| 11071 | HDA_CODEC_VOLUME("Line Playback Volume", 0x15, 0x02, HDA_INPUT), |
| 11072 | HDA_CODEC_MUTE("Line Playback Switch", 0x15, 0x02, HDA_INPUT), |
| 11073 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x15, 0x01, HDA_INPUT), |
| 11074 | HDA_CODEC_MUTE("Mic Playback Switch", 0x15, 0x01, HDA_INPUT), |
| 11075 | HDA_CODEC_MUTE("Front Mic Playback Switch", 0x10, 0x01, HDA_OUTPUT), |
| 11076 | HDA_CODEC_MUTE("Headphone Playback Switch", 0x1a, 0x03, HDA_INPUT), |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 11077 | |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 11078 | /* Capture mixer control */ |
| 11079 | HDA_CODEC_VOLUME("Capture Volume", 0x08, 0x0, HDA_INPUT), |
| 11080 | HDA_CODEC_MUTE("Capture Switch", 0x08, 0x0, HDA_INPUT), |
| 11081 | { |
| 11082 | .iface = SNDRV_CTL_ELEM_IFACE_MIXER, |
| 11083 | .name = "Capture Source", |
| 11084 | .count = 1, |
| 11085 | .info = alc_mux_enum_info, |
| 11086 | .get = alc_mux_enum_get, |
| 11087 | .put = alc_mux_enum_put, |
| 11088 | }, |
| 11089 | { } /* end */ |
| 11090 | }; |
| 11091 | |
| 11092 | static struct snd_kcontrol_new alc861_3ST_mixer[] = { |
| 11093 | /* output mixer control */ |
| 11094 | HDA_CODEC_MUTE("Front Playback Switch", 0x03, 0x0, HDA_OUTPUT), |
| 11095 | HDA_CODEC_MUTE("Surround Playback Switch", 0x06, 0x0, HDA_OUTPUT), |
| 11096 | HDA_CODEC_MUTE_MONO("Center Playback Switch", 0x05, 1, 0x0, HDA_OUTPUT), |
| 11097 | HDA_CODEC_MUTE_MONO("LFE Playback Switch", 0x05, 2, 0x0, HDA_OUTPUT), |
| 11098 | /*HDA_CODEC_MUTE("Side Playback Switch", 0x04, 0x0, HDA_OUTPUT), */ |
| 11099 | |
| 11100 | /* Input mixer control */ |
| 11101 | /* HDA_CODEC_VOLUME("Input Playback Volume", 0x15, 0x0, HDA_OUTPUT), |
| 11102 | HDA_CODEC_MUTE("Input Playback Switch", 0x15, 0x0, HDA_OUTPUT), */ |
| 11103 | HDA_CODEC_VOLUME("CD Playback Volume", 0x15, 0x0, HDA_INPUT), |
| 11104 | HDA_CODEC_MUTE("CD Playback Switch", 0x15, 0x0, HDA_INPUT), |
| 11105 | HDA_CODEC_VOLUME("Line Playback Volume", 0x15, 0x02, HDA_INPUT), |
| 11106 | HDA_CODEC_MUTE("Line Playback Switch", 0x15, 0x02, HDA_INPUT), |
| 11107 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x15, 0x01, HDA_INPUT), |
| 11108 | HDA_CODEC_MUTE("Mic Playback Switch", 0x15, 0x01, HDA_INPUT), |
| 11109 | HDA_CODEC_MUTE("Front Mic Playback Switch", 0x10, 0x01, HDA_OUTPUT), |
| 11110 | HDA_CODEC_MUTE("Headphone Playback Switch", 0x1a, 0x03, HDA_INPUT), |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 11111 | |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 11112 | /* Capture mixer control */ |
| 11113 | HDA_CODEC_VOLUME("Capture Volume", 0x08, 0x0, HDA_INPUT), |
| 11114 | HDA_CODEC_MUTE("Capture Switch", 0x08, 0x0, HDA_INPUT), |
| 11115 | { |
| 11116 | .iface = SNDRV_CTL_ELEM_IFACE_MIXER, |
| 11117 | .name = "Capture Source", |
| 11118 | .count = 1, |
| 11119 | .info = alc_mux_enum_info, |
| 11120 | .get = alc_mux_enum_get, |
| 11121 | .put = alc_mux_enum_put, |
| 11122 | }, |
| 11123 | { |
| 11124 | .iface = SNDRV_CTL_ELEM_IFACE_MIXER, |
| 11125 | .name = "Channel Mode", |
| 11126 | .info = alc_ch_mode_info, |
| 11127 | .get = alc_ch_mode_get, |
| 11128 | .put = alc_ch_mode_put, |
| 11129 | .private_value = ARRAY_SIZE(alc861_threestack_modes), |
| 11130 | }, |
| 11131 | { } /* end */ |
Tobin Davis | a53d1ae | 2006-10-17 12:00:28 +0200 | [diff] [blame] | 11132 | }; |
| 11133 | |
Takashi Iwai | d1d985f | 2006-11-23 19:27:12 +0100 | [diff] [blame] | 11134 | static struct snd_kcontrol_new alc861_toshiba_mixer[] = { |
Tobin Davis | a53d1ae | 2006-10-17 12:00:28 +0200 | [diff] [blame] | 11135 | /* output mixer control */ |
| 11136 | HDA_CODEC_MUTE("Master Playback Switch", 0x03, 0x0, HDA_OUTPUT), |
| 11137 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x15, 0x01, HDA_INPUT), |
| 11138 | HDA_CODEC_MUTE("Mic Playback Switch", 0x15, 0x01, HDA_INPUT), |
| 11139 | |
| 11140 | /*Capture mixer control */ |
| 11141 | HDA_CODEC_VOLUME("Capture Volume", 0x08, 0x0, HDA_INPUT), |
| 11142 | HDA_CODEC_MUTE("Capture Switch", 0x08, 0x0, HDA_INPUT), |
| 11143 | { |
| 11144 | .iface = SNDRV_CTL_ELEM_IFACE_MIXER, |
| 11145 | .name = "Capture Source", |
| 11146 | .count = 1, |
| 11147 | .info = alc_mux_enum_info, |
| 11148 | .get = alc_mux_enum_get, |
| 11149 | .put = alc_mux_enum_put, |
| 11150 | }, |
| 11151 | |
| 11152 | { } /* end */ |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 11153 | }; |
Tobin Davis | a53d1ae | 2006-10-17 12:00:28 +0200 | [diff] [blame] | 11154 | |
Takashi Iwai | 22309c3 | 2006-08-09 16:57:28 +0200 | [diff] [blame] | 11155 | static struct snd_kcontrol_new alc861_uniwill_m31_mixer[] = { |
| 11156 | /* output mixer control */ |
| 11157 | HDA_CODEC_MUTE("Front Playback Switch", 0x03, 0x0, HDA_OUTPUT), |
| 11158 | HDA_CODEC_MUTE("Surround Playback Switch", 0x06, 0x0, HDA_OUTPUT), |
| 11159 | HDA_CODEC_MUTE_MONO("Center Playback Switch", 0x05, 1, 0x0, HDA_OUTPUT), |
| 11160 | HDA_CODEC_MUTE_MONO("LFE Playback Switch", 0x05, 2, 0x0, HDA_OUTPUT), |
| 11161 | /*HDA_CODEC_MUTE("Side Playback Switch", 0x04, 0x0, HDA_OUTPUT), */ |
| 11162 | |
| 11163 | /* Input mixer control */ |
| 11164 | /* HDA_CODEC_VOLUME("Input Playback Volume", 0x15, 0x0, HDA_OUTPUT), |
| 11165 | HDA_CODEC_MUTE("Input Playback Switch", 0x15, 0x0, HDA_OUTPUT), */ |
| 11166 | HDA_CODEC_VOLUME("CD Playback Volume", 0x15, 0x0, HDA_INPUT), |
| 11167 | HDA_CODEC_MUTE("CD Playback Switch", 0x15, 0x0, HDA_INPUT), |
| 11168 | HDA_CODEC_VOLUME("Line Playback Volume", 0x15, 0x02, HDA_INPUT), |
| 11169 | HDA_CODEC_MUTE("Line Playback Switch", 0x15, 0x02, HDA_INPUT), |
| 11170 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x15, 0x01, HDA_INPUT), |
| 11171 | HDA_CODEC_MUTE("Mic Playback Switch", 0x15, 0x01, HDA_INPUT), |
| 11172 | HDA_CODEC_MUTE("Front Mic Playback Switch", 0x10, 0x01, HDA_OUTPUT), |
| 11173 | HDA_CODEC_MUTE("Headphone Playback Switch", 0x1a, 0x03, HDA_INPUT), |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 11174 | |
Takashi Iwai | 22309c3 | 2006-08-09 16:57:28 +0200 | [diff] [blame] | 11175 | /* Capture mixer control */ |
| 11176 | HDA_CODEC_VOLUME("Capture Volume", 0x08, 0x0, HDA_INPUT), |
| 11177 | HDA_CODEC_MUTE("Capture Switch", 0x08, 0x0, HDA_INPUT), |
| 11178 | { |
| 11179 | .iface = SNDRV_CTL_ELEM_IFACE_MIXER, |
| 11180 | .name = "Capture Source", |
| 11181 | .count = 1, |
| 11182 | .info = alc_mux_enum_info, |
| 11183 | .get = alc_mux_enum_get, |
| 11184 | .put = alc_mux_enum_put, |
| 11185 | }, |
| 11186 | { |
| 11187 | .iface = SNDRV_CTL_ELEM_IFACE_MIXER, |
| 11188 | .name = "Channel Mode", |
| 11189 | .info = alc_ch_mode_info, |
| 11190 | .get = alc_ch_mode_get, |
| 11191 | .put = alc_ch_mode_put, |
| 11192 | .private_value = ARRAY_SIZE(alc861_uniwill_m31_modes), |
| 11193 | }, |
| 11194 | { } /* end */ |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 11195 | }; |
Mariusz Domanski | 7cdbff9 | 2006-10-23 13:42:56 +0200 | [diff] [blame] | 11196 | |
| 11197 | static struct snd_kcontrol_new alc861_asus_mixer[] = { |
| 11198 | /* output mixer control */ |
| 11199 | HDA_CODEC_MUTE("Front Playback Switch", 0x03, 0x0, HDA_OUTPUT), |
| 11200 | HDA_CODEC_MUTE("Surround Playback Switch", 0x06, 0x0, HDA_OUTPUT), |
| 11201 | HDA_CODEC_MUTE_MONO("Center Playback Switch", 0x05, 1, 0x0, HDA_OUTPUT), |
| 11202 | HDA_CODEC_MUTE_MONO("LFE Playback Switch", 0x05, 2, 0x0, HDA_OUTPUT), |
| 11203 | HDA_CODEC_MUTE("Side Playback Switch", 0x04, 0x0, HDA_OUTPUT), |
| 11204 | |
| 11205 | /* Input mixer control */ |
| 11206 | HDA_CODEC_VOLUME("Input Playback Volume", 0x15, 0x0, HDA_OUTPUT), |
| 11207 | HDA_CODEC_MUTE("Input Playback Switch", 0x15, 0x0, HDA_OUTPUT), |
| 11208 | HDA_CODEC_VOLUME("CD Playback Volume", 0x15, 0x0, HDA_INPUT), |
| 11209 | HDA_CODEC_MUTE("CD Playback Switch", 0x15, 0x0, HDA_INPUT), |
| 11210 | HDA_CODEC_VOLUME("Line Playback Volume", 0x15, 0x02, HDA_INPUT), |
| 11211 | HDA_CODEC_MUTE("Line Playback Switch", 0x15, 0x02, HDA_INPUT), |
| 11212 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x15, 0x01, HDA_INPUT), |
| 11213 | HDA_CODEC_MUTE("Mic Playback Switch", 0x15, 0x01, HDA_INPUT), |
| 11214 | HDA_CODEC_MUTE("Front Mic Playback Switch", 0x10, 0x01, HDA_OUTPUT), |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 11215 | HDA_CODEC_MUTE("Headphone Playback Switch", 0x1a, 0x03, HDA_OUTPUT), |
| 11216 | |
Mariusz Domanski | 7cdbff9 | 2006-10-23 13:42:56 +0200 | [diff] [blame] | 11217 | /* Capture mixer control */ |
| 11218 | HDA_CODEC_VOLUME("Capture Volume", 0x08, 0x0, HDA_INPUT), |
| 11219 | HDA_CODEC_MUTE("Capture Switch", 0x08, 0x0, HDA_INPUT), |
| 11220 | { |
| 11221 | .iface = SNDRV_CTL_ELEM_IFACE_MIXER, |
| 11222 | .name = "Capture Source", |
| 11223 | .count = 1, |
| 11224 | .info = alc_mux_enum_info, |
| 11225 | .get = alc_mux_enum_get, |
| 11226 | .put = alc_mux_enum_put, |
| 11227 | }, |
| 11228 | { |
| 11229 | .iface = SNDRV_CTL_ELEM_IFACE_MIXER, |
| 11230 | .name = "Channel Mode", |
| 11231 | .info = alc_ch_mode_info, |
| 11232 | .get = alc_ch_mode_get, |
| 11233 | .put = alc_ch_mode_put, |
| 11234 | .private_value = ARRAY_SIZE(alc861_asus_modes), |
| 11235 | }, |
| 11236 | { } |
Takashi Iwai | 56bb0ca | 2006-11-22 11:52:52 +0100 | [diff] [blame] | 11237 | }; |
Mariusz Domanski | 7cdbff9 | 2006-10-23 13:42:56 +0200 | [diff] [blame] | 11238 | |
Takashi Iwai | 56bb0ca | 2006-11-22 11:52:52 +0100 | [diff] [blame] | 11239 | /* additional mixer */ |
Takashi Iwai | d1d985f | 2006-11-23 19:27:12 +0100 | [diff] [blame] | 11240 | static struct snd_kcontrol_new alc861_asus_laptop_mixer[] = { |
Takashi Iwai | 56bb0ca | 2006-11-22 11:52:52 +0100 | [diff] [blame] | 11241 | HDA_CODEC_VOLUME("CD Playback Volume", 0x15, 0x0, HDA_INPUT), |
| 11242 | HDA_CODEC_MUTE("CD Playback Switch", 0x15, 0x0, HDA_INPUT), |
| 11243 | HDA_CODEC_VOLUME("PC Beep Playback Volume", 0x23, 0x0, HDA_OUTPUT), |
| 11244 | HDA_CODEC_MUTE("PC Beep Playback Switch", 0x23, 0x0, HDA_OUTPUT), |
| 11245 | { } |
| 11246 | }; |
| 11247 | |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 11248 | /* |
| 11249 | * generic initialization of ADC, input mixers and output mixers |
| 11250 | */ |
| 11251 | static struct hda_verb alc861_base_init_verbs[] = { |
| 11252 | /* |
| 11253 | * Unmute ADC0 and set the default input to mic-in |
| 11254 | */ |
| 11255 | /* port-A for surround (rear panel) */ |
| 11256 | { 0x0e, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x40 }, |
| 11257 | { 0x0e, AC_VERB_SET_CONNECT_SEL, 0x00 }, |
| 11258 | /* port-B for mic-in (rear panel) with vref */ |
| 11259 | { 0x0d, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24 }, |
| 11260 | /* port-C for line-in (rear panel) */ |
| 11261 | { 0x0c, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20 }, |
| 11262 | /* port-D for Front */ |
| 11263 | { 0x0b, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x40 }, |
| 11264 | { 0x0b, AC_VERB_SET_CONNECT_SEL, 0x00 }, |
| 11265 | /* port-E for HP out (front panel) */ |
| 11266 | { 0x0f, AC_VERB_SET_PIN_WIDGET_CONTROL, 0xc0 }, |
| 11267 | /* route front PCM to HP */ |
Takashi Iwai | 9dece1d | 2006-11-16 17:12:49 +0100 | [diff] [blame] | 11268 | { 0x0f, AC_VERB_SET_CONNECT_SEL, 0x00 }, |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 11269 | /* port-F for mic-in (front panel) with vref */ |
| 11270 | { 0x10, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24 }, |
| 11271 | /* port-G for CLFE (rear panel) */ |
| 11272 | { 0x1f, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x40 }, |
| 11273 | { 0x1f, AC_VERB_SET_CONNECT_SEL, 0x00 }, |
| 11274 | /* port-H for side (rear panel) */ |
| 11275 | { 0x20, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x40 }, |
| 11276 | { 0x20, AC_VERB_SET_CONNECT_SEL, 0x00 }, |
| 11277 | /* CD-in */ |
| 11278 | { 0x11, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20 }, |
| 11279 | /* route front mic to ADC1*/ |
| 11280 | {0x08, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 11281 | {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 11282 | |
| 11283 | /* Unmute DAC0~3 & spdif out*/ |
| 11284 | {0x03, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 11285 | {0x04, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 11286 | {0x05, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 11287 | {0x06, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 11288 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 11289 | |
| 11290 | /* Unmute Mixer 14 (mic) 1c (Line in)*/ |
| 11291 | {0x014, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 11292 | {0x014, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 11293 | {0x01c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 11294 | {0x01c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 11295 | |
| 11296 | /* Unmute Stereo Mixer 15 */ |
| 11297 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 11298 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 11299 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(2)}, |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 11300 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, 0xb00c}, /* Output 0~12 step */ |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 11301 | |
| 11302 | {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 11303 | {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 11304 | {0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 11305 | {0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 11306 | {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 11307 | {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 11308 | {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 11309 | {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 11310 | /* hp used DAC 3 (Front) */ |
| 11311 | {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(3)}, |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 11312 | {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(2)}, |
| 11313 | |
| 11314 | { } |
| 11315 | }; |
| 11316 | |
| 11317 | static struct hda_verb alc861_threestack_init_verbs[] = { |
| 11318 | /* |
| 11319 | * Unmute ADC0 and set the default input to mic-in |
| 11320 | */ |
| 11321 | /* port-A for surround (rear panel) */ |
| 11322 | { 0x0e, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x00 }, |
| 11323 | /* port-B for mic-in (rear panel) with vref */ |
| 11324 | { 0x0d, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24 }, |
| 11325 | /* port-C for line-in (rear panel) */ |
| 11326 | { 0x0c, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20 }, |
| 11327 | /* port-D for Front */ |
| 11328 | { 0x0b, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x40 }, |
| 11329 | { 0x0b, AC_VERB_SET_CONNECT_SEL, 0x00 }, |
| 11330 | /* port-E for HP out (front panel) */ |
| 11331 | { 0x0f, AC_VERB_SET_PIN_WIDGET_CONTROL, 0xc0 }, |
| 11332 | /* route front PCM to HP */ |
Takashi Iwai | 9dece1d | 2006-11-16 17:12:49 +0100 | [diff] [blame] | 11333 | { 0x0f, AC_VERB_SET_CONNECT_SEL, 0x00 }, |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 11334 | /* port-F for mic-in (front panel) with vref */ |
| 11335 | { 0x10, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24 }, |
| 11336 | /* port-G for CLFE (rear panel) */ |
| 11337 | { 0x1f, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x00 }, |
| 11338 | /* port-H for side (rear panel) */ |
| 11339 | { 0x20, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x00 }, |
| 11340 | /* CD-in */ |
| 11341 | { 0x11, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20 }, |
| 11342 | /* route front mic to ADC1*/ |
| 11343 | {0x08, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 11344 | {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 11345 | /* Unmute DAC0~3 & spdif out*/ |
| 11346 | {0x03, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 11347 | {0x04, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 11348 | {0x05, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 11349 | {0x06, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 11350 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 11351 | |
| 11352 | /* Unmute Mixer 14 (mic) 1c (Line in)*/ |
| 11353 | {0x014, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 11354 | {0x014, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 11355 | {0x01c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 11356 | {0x01c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 11357 | |
| 11358 | /* Unmute Stereo Mixer 15 */ |
| 11359 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 11360 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 11361 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(2)}, |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 11362 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, 0xb00c}, /* Output 0~12 step */ |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 11363 | |
| 11364 | {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 11365 | {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 11366 | {0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 11367 | {0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 11368 | {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 11369 | {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 11370 | {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 11371 | {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 11372 | /* hp used DAC 3 (Front) */ |
| 11373 | {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(3)}, |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 11374 | {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(2)}, |
| 11375 | { } |
| 11376 | }; |
Takashi Iwai | 22309c3 | 2006-08-09 16:57:28 +0200 | [diff] [blame] | 11377 | |
| 11378 | static struct hda_verb alc861_uniwill_m31_init_verbs[] = { |
| 11379 | /* |
| 11380 | * Unmute ADC0 and set the default input to mic-in |
| 11381 | */ |
| 11382 | /* port-A for surround (rear panel) */ |
| 11383 | { 0x0e, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x00 }, |
| 11384 | /* port-B for mic-in (rear panel) with vref */ |
| 11385 | { 0x0d, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24 }, |
| 11386 | /* port-C for line-in (rear panel) */ |
| 11387 | { 0x0c, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20 }, |
| 11388 | /* port-D for Front */ |
| 11389 | { 0x0b, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x40 }, |
| 11390 | { 0x0b, AC_VERB_SET_CONNECT_SEL, 0x00 }, |
| 11391 | /* port-E for HP out (front panel) */ |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 11392 | /* this has to be set to VREF80 */ |
| 11393 | { 0x0f, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24 }, |
Takashi Iwai | 22309c3 | 2006-08-09 16:57:28 +0200 | [diff] [blame] | 11394 | /* route front PCM to HP */ |
Takashi Iwai | 9dece1d | 2006-11-16 17:12:49 +0100 | [diff] [blame] | 11395 | { 0x0f, AC_VERB_SET_CONNECT_SEL, 0x00 }, |
Takashi Iwai | 22309c3 | 2006-08-09 16:57:28 +0200 | [diff] [blame] | 11396 | /* port-F for mic-in (front panel) with vref */ |
| 11397 | { 0x10, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24 }, |
| 11398 | /* port-G for CLFE (rear panel) */ |
| 11399 | { 0x1f, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x00 }, |
| 11400 | /* port-H for side (rear panel) */ |
| 11401 | { 0x20, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x00 }, |
| 11402 | /* CD-in */ |
| 11403 | { 0x11, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20 }, |
| 11404 | /* route front mic to ADC1*/ |
| 11405 | {0x08, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 11406 | {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 11407 | /* Unmute DAC0~3 & spdif out*/ |
| 11408 | {0x03, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 11409 | {0x04, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 11410 | {0x05, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 11411 | {0x06, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 11412 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 11413 | |
| 11414 | /* Unmute Mixer 14 (mic) 1c (Line in)*/ |
| 11415 | {0x014, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 11416 | {0x014, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 11417 | {0x01c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 11418 | {0x01c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 11419 | |
| 11420 | /* Unmute Stereo Mixer 15 */ |
| 11421 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 11422 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 11423 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(2)}, |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 11424 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, 0xb00c}, /* Output 0~12 step */ |
Takashi Iwai | 22309c3 | 2006-08-09 16:57:28 +0200 | [diff] [blame] | 11425 | |
| 11426 | {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 11427 | {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 11428 | {0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 11429 | {0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 11430 | {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 11431 | {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 11432 | {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 11433 | {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 11434 | /* hp used DAC 3 (Front) */ |
| 11435 | {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(3)}, |
Takashi Iwai | 22309c3 | 2006-08-09 16:57:28 +0200 | [diff] [blame] | 11436 | {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(2)}, |
| 11437 | { } |
| 11438 | }; |
| 11439 | |
Mariusz Domanski | 7cdbff9 | 2006-10-23 13:42:56 +0200 | [diff] [blame] | 11440 | static struct hda_verb alc861_asus_init_verbs[] = { |
| 11441 | /* |
| 11442 | * Unmute ADC0 and set the default input to mic-in |
| 11443 | */ |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 11444 | /* port-A for surround (rear panel) |
| 11445 | * according to codec#0 this is the HP jack |
| 11446 | */ |
Mariusz Domanski | 7cdbff9 | 2006-10-23 13:42:56 +0200 | [diff] [blame] | 11447 | { 0x0e, AC_VERB_SET_PIN_WIDGET_CONTROL, 0xc0 }, /* was 0x00 */ |
| 11448 | /* route front PCM to HP */ |
| 11449 | { 0x0e, AC_VERB_SET_CONNECT_SEL, 0x01 }, |
| 11450 | /* port-B for mic-in (rear panel) with vref */ |
| 11451 | { 0x0d, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24 }, |
| 11452 | /* port-C for line-in (rear panel) */ |
| 11453 | { 0x0c, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20 }, |
| 11454 | /* port-D for Front */ |
| 11455 | { 0x0b, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x40 }, |
| 11456 | { 0x0b, AC_VERB_SET_CONNECT_SEL, 0x00 }, |
| 11457 | /* port-E for HP out (front panel) */ |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 11458 | /* this has to be set to VREF80 */ |
| 11459 | { 0x0f, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24 }, |
Mariusz Domanski | 7cdbff9 | 2006-10-23 13:42:56 +0200 | [diff] [blame] | 11460 | /* route front PCM to HP */ |
Takashi Iwai | 9dece1d | 2006-11-16 17:12:49 +0100 | [diff] [blame] | 11461 | { 0x0f, AC_VERB_SET_CONNECT_SEL, 0x00 }, |
Mariusz Domanski | 7cdbff9 | 2006-10-23 13:42:56 +0200 | [diff] [blame] | 11462 | /* port-F for mic-in (front panel) with vref */ |
| 11463 | { 0x10, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24 }, |
| 11464 | /* port-G for CLFE (rear panel) */ |
| 11465 | { 0x1f, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x40 }, |
| 11466 | /* port-H for side (rear panel) */ |
| 11467 | { 0x20, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x40 }, |
| 11468 | /* CD-in */ |
| 11469 | { 0x11, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20 }, |
| 11470 | /* route front mic to ADC1*/ |
| 11471 | {0x08, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 11472 | {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 11473 | /* Unmute DAC0~3 & spdif out*/ |
| 11474 | {0x03, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 11475 | {0x04, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 11476 | {0x05, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 11477 | {0x06, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 11478 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 11479 | /* Unmute Mixer 14 (mic) 1c (Line in)*/ |
| 11480 | {0x014, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 11481 | {0x014, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 11482 | {0x01c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 11483 | {0x01c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 11484 | |
| 11485 | /* Unmute Stereo Mixer 15 */ |
| 11486 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 11487 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 11488 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(2)}, |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 11489 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, 0xb00c}, /* Output 0~12 step */ |
Mariusz Domanski | 7cdbff9 | 2006-10-23 13:42:56 +0200 | [diff] [blame] | 11490 | |
| 11491 | {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 11492 | {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 11493 | {0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 11494 | {0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 11495 | {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 11496 | {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 11497 | {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 11498 | {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 11499 | /* hp used DAC 3 (Front) */ |
| 11500 | {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(3)}, |
Mariusz Domanski | 7cdbff9 | 2006-10-23 13:42:56 +0200 | [diff] [blame] | 11501 | {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(2)}, |
| 11502 | { } |
| 11503 | }; |
| 11504 | |
Takashi Iwai | 56bb0ca | 2006-11-22 11:52:52 +0100 | [diff] [blame] | 11505 | /* additional init verbs for ASUS laptops */ |
| 11506 | static struct hda_verb alc861_asus_laptop_init_verbs[] = { |
| 11507 | { 0x0f, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x45 }, /* HP-out */ |
| 11508 | { 0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2) }, /* mute line-in */ |
| 11509 | { } |
| 11510 | }; |
Mariusz Domanski | 7cdbff9 | 2006-10-23 13:42:56 +0200 | [diff] [blame] | 11511 | |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 11512 | /* |
| 11513 | * generic initialization of ADC, input mixers and output mixers |
| 11514 | */ |
| 11515 | static struct hda_verb alc861_auto_init_verbs[] = { |
| 11516 | /* |
| 11517 | * Unmute ADC0 and set the default input to mic-in |
| 11518 | */ |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 11519 | /* {0x08, AC_VERB_SET_CONNECT_SEL, 0x00}, */ |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 11520 | {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 11521 | |
| 11522 | /* Unmute DAC0~3 & spdif out*/ |
| 11523 | {0x03, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
| 11524 | {0x04, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
| 11525 | {0x05, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
| 11526 | {0x06, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
| 11527 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 11528 | |
| 11529 | /* Unmute Mixer 14 (mic) 1c (Line in)*/ |
| 11530 | {0x014, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 11531 | {0x014, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 11532 | {0x01c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 11533 | {0x01c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 11534 | |
| 11535 | /* Unmute Stereo Mixer 15 */ |
| 11536 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 11537 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 11538 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(2)}, |
| 11539 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, 0xb00c}, |
| 11540 | |
| 11541 | {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 11542 | {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 11543 | {0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 11544 | {0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 11545 | {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 11546 | {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 11547 | {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 11548 | {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 11549 | |
| 11550 | {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 11551 | {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 11552 | {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(2)}, |
| 11553 | {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(3)}, |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 11554 | {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 11555 | {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 11556 | {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(2)}, |
| 11557 | {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(3)}, |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 11558 | |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 11559 | {0x08, AC_VERB_SET_CONNECT_SEL, 0x00}, /* set Mic 1 */ |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 11560 | |
| 11561 | { } |
| 11562 | }; |
| 11563 | |
Tobin Davis | a53d1ae | 2006-10-17 12:00:28 +0200 | [diff] [blame] | 11564 | static struct hda_verb alc861_toshiba_init_verbs[] = { |
| 11565 | {0x0f, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT}, |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 11566 | |
Tobin Davis | a53d1ae | 2006-10-17 12:00:28 +0200 | [diff] [blame] | 11567 | { } |
| 11568 | }; |
| 11569 | |
| 11570 | /* toggle speaker-output according to the hp-jack state */ |
| 11571 | static void alc861_toshiba_automute(struct hda_codec *codec) |
| 11572 | { |
| 11573 | unsigned int present; |
| 11574 | |
| 11575 | present = snd_hda_codec_read(codec, 0x0f, 0, |
| 11576 | AC_VERB_GET_PIN_SENSE, 0) & 0x80000000; |
Takashi Iwai | 47fd830 | 2007-08-10 17:11:07 +0200 | [diff] [blame] | 11577 | snd_hda_codec_amp_stereo(codec, 0x16, HDA_INPUT, 0, |
| 11578 | HDA_AMP_MUTE, present ? HDA_AMP_MUTE : 0); |
| 11579 | snd_hda_codec_amp_stereo(codec, 0x1a, HDA_INPUT, 3, |
| 11580 | HDA_AMP_MUTE, present ? 0 : HDA_AMP_MUTE); |
Tobin Davis | a53d1ae | 2006-10-17 12:00:28 +0200 | [diff] [blame] | 11581 | } |
| 11582 | |
| 11583 | static void alc861_toshiba_unsol_event(struct hda_codec *codec, |
| 11584 | unsigned int res) |
| 11585 | { |
Tobin Davis | a53d1ae | 2006-10-17 12:00:28 +0200 | [diff] [blame] | 11586 | if ((res >> 26) == ALC880_HP_EVENT) |
| 11587 | alc861_toshiba_automute(codec); |
| 11588 | } |
| 11589 | |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 11590 | /* pcm configuration: identiacal with ALC880 */ |
| 11591 | #define alc861_pcm_analog_playback alc880_pcm_analog_playback |
| 11592 | #define alc861_pcm_analog_capture alc880_pcm_analog_capture |
| 11593 | #define alc861_pcm_digital_playback alc880_pcm_digital_playback |
| 11594 | #define alc861_pcm_digital_capture alc880_pcm_digital_capture |
| 11595 | |
| 11596 | |
| 11597 | #define ALC861_DIGOUT_NID 0x07 |
| 11598 | |
| 11599 | static struct hda_channel_mode alc861_8ch_modes[1] = { |
| 11600 | { 8, NULL } |
| 11601 | }; |
| 11602 | |
| 11603 | static hda_nid_t alc861_dac_nids[4] = { |
| 11604 | /* front, surround, clfe, side */ |
| 11605 | 0x03, 0x06, 0x05, 0x04 |
| 11606 | }; |
| 11607 | |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 11608 | static hda_nid_t alc660_dac_nids[3] = { |
| 11609 | /* front, clfe, surround */ |
| 11610 | 0x03, 0x05, 0x06 |
| 11611 | }; |
| 11612 | |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 11613 | static hda_nid_t alc861_adc_nids[1] = { |
| 11614 | /* ADC0-2 */ |
| 11615 | 0x08, |
| 11616 | }; |
| 11617 | |
| 11618 | static struct hda_input_mux alc861_capture_source = { |
| 11619 | .num_items = 5, |
| 11620 | .items = { |
| 11621 | { "Mic", 0x0 }, |
| 11622 | { "Front Mic", 0x3 }, |
| 11623 | { "Line", 0x1 }, |
| 11624 | { "CD", 0x4 }, |
| 11625 | { "Mixer", 0x5 }, |
| 11626 | }, |
| 11627 | }; |
| 11628 | |
| 11629 | /* fill in the dac_nids table from the parsed pin configuration */ |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 11630 | static int alc861_auto_fill_dac_nids(struct alc_spec *spec, |
| 11631 | const struct auto_pin_cfg *cfg) |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 11632 | { |
| 11633 | int i; |
| 11634 | hda_nid_t nid; |
| 11635 | |
| 11636 | spec->multiout.dac_nids = spec->private_dac_nids; |
| 11637 | for (i = 0; i < cfg->line_outs; i++) { |
| 11638 | nid = cfg->line_out_pins[i]; |
| 11639 | if (nid) { |
| 11640 | if (i >= ARRAY_SIZE(alc861_dac_nids)) |
| 11641 | continue; |
| 11642 | spec->multiout.dac_nids[i] = alc861_dac_nids[i]; |
| 11643 | } |
| 11644 | } |
| 11645 | spec->multiout.num_dacs = cfg->line_outs; |
| 11646 | return 0; |
| 11647 | } |
| 11648 | |
| 11649 | /* add playback controls from the parsed DAC table */ |
| 11650 | static int alc861_auto_create_multi_out_ctls(struct alc_spec *spec, |
| 11651 | const struct auto_pin_cfg *cfg) |
| 11652 | { |
| 11653 | char name[32]; |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 11654 | static const char *chname[4] = { |
| 11655 | "Front", "Surround", NULL /*CLFE*/, "Side" |
| 11656 | }; |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 11657 | hda_nid_t nid; |
| 11658 | int i, idx, err; |
| 11659 | |
| 11660 | for (i = 0; i < cfg->line_outs; i++) { |
| 11661 | nid = spec->multiout.dac_nids[i]; |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 11662 | if (!nid) |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 11663 | continue; |
| 11664 | if (nid == 0x05) { |
| 11665 | /* Center/LFE */ |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 11666 | err = add_control(spec, ALC_CTL_BIND_MUTE, |
| 11667 | "Center Playback Switch", |
| 11668 | HDA_COMPOSE_AMP_VAL(nid, 1, 0, |
| 11669 | HDA_OUTPUT)); |
| 11670 | if (err < 0) |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 11671 | return err; |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 11672 | err = add_control(spec, ALC_CTL_BIND_MUTE, |
| 11673 | "LFE Playback Switch", |
| 11674 | HDA_COMPOSE_AMP_VAL(nid, 2, 0, |
| 11675 | HDA_OUTPUT)); |
| 11676 | if (err < 0) |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 11677 | return err; |
| 11678 | } else { |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 11679 | for (idx = 0; idx < ARRAY_SIZE(alc861_dac_nids) - 1; |
| 11680 | idx++) |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 11681 | if (nid == alc861_dac_nids[idx]) |
| 11682 | break; |
| 11683 | sprintf(name, "%s Playback Switch", chname[idx]); |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 11684 | err = add_control(spec, ALC_CTL_BIND_MUTE, name, |
| 11685 | HDA_COMPOSE_AMP_VAL(nid, 3, 0, |
| 11686 | HDA_OUTPUT)); |
| 11687 | if (err < 0) |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 11688 | return err; |
| 11689 | } |
| 11690 | } |
| 11691 | return 0; |
| 11692 | } |
| 11693 | |
| 11694 | static int alc861_auto_create_hp_ctls(struct alc_spec *spec, hda_nid_t pin) |
| 11695 | { |
| 11696 | int err; |
| 11697 | hda_nid_t nid; |
| 11698 | |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 11699 | if (!pin) |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 11700 | return 0; |
| 11701 | |
| 11702 | if ((pin >= 0x0b && pin <= 0x10) || pin == 0x1f || pin == 0x20) { |
| 11703 | nid = 0x03; |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 11704 | err = add_control(spec, ALC_CTL_WIDGET_MUTE, |
| 11705 | "Headphone Playback Switch", |
| 11706 | HDA_COMPOSE_AMP_VAL(nid, 3, 0, HDA_OUTPUT)); |
| 11707 | if (err < 0) |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 11708 | return err; |
| 11709 | spec->multiout.hp_nid = nid; |
| 11710 | } |
| 11711 | return 0; |
| 11712 | } |
| 11713 | |
| 11714 | /* create playback/capture controls for input pins */ |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 11715 | static int alc861_auto_create_analog_input_ctls(struct alc_spec *spec, |
| 11716 | const struct auto_pin_cfg *cfg) |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 11717 | { |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 11718 | struct hda_input_mux *imux = &spec->private_imux; |
| 11719 | int i, err, idx, idx1; |
| 11720 | |
| 11721 | for (i = 0; i < AUTO_PIN_LAST; i++) { |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 11722 | switch (cfg->input_pins[i]) { |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 11723 | case 0x0c: |
| 11724 | idx1 = 1; |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 11725 | idx = 2; /* Line In */ |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 11726 | break; |
| 11727 | case 0x0f: |
| 11728 | idx1 = 2; |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 11729 | idx = 2; /* Line In */ |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 11730 | break; |
| 11731 | case 0x0d: |
| 11732 | idx1 = 0; |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 11733 | idx = 1; /* Mic In */ |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 11734 | break; |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 11735 | case 0x10: |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 11736 | idx1 = 3; |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 11737 | idx = 1; /* Mic In */ |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 11738 | break; |
| 11739 | case 0x11: |
| 11740 | idx1 = 4; |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 11741 | idx = 0; /* CD */ |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 11742 | break; |
| 11743 | default: |
| 11744 | continue; |
| 11745 | } |
| 11746 | |
Takashi Iwai | 4a471b7 | 2005-12-07 13:56:29 +0100 | [diff] [blame] | 11747 | err = new_analog_input(spec, cfg->input_pins[i], |
| 11748 | auto_pin_cfg_labels[i], idx, 0x15); |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 11749 | if (err < 0) |
| 11750 | return err; |
| 11751 | |
Takashi Iwai | 4a471b7 | 2005-12-07 13:56:29 +0100 | [diff] [blame] | 11752 | imux->items[imux->num_items].label = auto_pin_cfg_labels[i]; |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 11753 | imux->items[imux->num_items].index = idx1; |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 11754 | imux->num_items++; |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 11755 | } |
| 11756 | return 0; |
| 11757 | } |
| 11758 | |
| 11759 | static struct snd_kcontrol_new alc861_capture_mixer[] = { |
| 11760 | HDA_CODEC_VOLUME("Capture Volume", 0x08, 0x0, HDA_INPUT), |
| 11761 | HDA_CODEC_MUTE("Capture Switch", 0x08, 0x0, HDA_INPUT), |
| 11762 | |
| 11763 | { |
| 11764 | .iface = SNDRV_CTL_ELEM_IFACE_MIXER, |
| 11765 | /* The multiple "Capture Source" controls confuse alsamixer |
| 11766 | * So call somewhat different.. |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 11767 | */ |
| 11768 | /* .name = "Capture Source", */ |
| 11769 | .name = "Input Source", |
| 11770 | .count = 1, |
| 11771 | .info = alc_mux_enum_info, |
| 11772 | .get = alc_mux_enum_get, |
| 11773 | .put = alc_mux_enum_put, |
| 11774 | }, |
| 11775 | { } /* end */ |
| 11776 | }; |
| 11777 | |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 11778 | static void alc861_auto_set_output_and_unmute(struct hda_codec *codec, |
| 11779 | hda_nid_t nid, |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 11780 | int pin_type, int dac_idx) |
| 11781 | { |
Takashi Iwai | f6c7e54 | 2008-02-12 18:32:23 +0100 | [diff] [blame] | 11782 | alc_set_pin_output(codec, nid, pin_type); |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 11783 | } |
| 11784 | |
| 11785 | static void alc861_auto_init_multi_out(struct hda_codec *codec) |
| 11786 | { |
| 11787 | struct alc_spec *spec = codec->spec; |
| 11788 | int i; |
| 11789 | |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 11790 | alc_subsystem_id(codec, 0x0e, 0x0f, 0x0b); |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 11791 | for (i = 0; i < spec->autocfg.line_outs; i++) { |
| 11792 | hda_nid_t nid = spec->autocfg.line_out_pins[i]; |
Takashi Iwai | baba8ee | 2007-04-23 17:17:48 +0200 | [diff] [blame] | 11793 | int pin_type = get_pin_type(spec->autocfg.line_out_type); |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 11794 | if (nid) |
Takashi Iwai | baba8ee | 2007-04-23 17:17:48 +0200 | [diff] [blame] | 11795 | alc861_auto_set_output_and_unmute(codec, nid, pin_type, |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 11796 | spec->multiout.dac_nids[i]); |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 11797 | } |
| 11798 | } |
| 11799 | |
| 11800 | static void alc861_auto_init_hp_out(struct hda_codec *codec) |
| 11801 | { |
| 11802 | struct alc_spec *spec = codec->spec; |
| 11803 | hda_nid_t pin; |
| 11804 | |
Takashi Iwai | eb06ed8 | 2006-09-20 17:10:27 +0200 | [diff] [blame] | 11805 | pin = spec->autocfg.hp_pins[0]; |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 11806 | if (pin) /* connect to front */ |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 11807 | alc861_auto_set_output_and_unmute(codec, pin, PIN_HP, |
| 11808 | spec->multiout.dac_nids[0]); |
Takashi Iwai | f6c7e54 | 2008-02-12 18:32:23 +0100 | [diff] [blame] | 11809 | pin = spec->autocfg.speaker_pins[0]; |
| 11810 | if (pin) |
| 11811 | alc861_auto_set_output_and_unmute(codec, pin, PIN_OUT, 0); |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 11812 | } |
| 11813 | |
| 11814 | static void alc861_auto_init_analog_input(struct hda_codec *codec) |
| 11815 | { |
| 11816 | struct alc_spec *spec = codec->spec; |
| 11817 | int i; |
| 11818 | |
| 11819 | for (i = 0; i < AUTO_PIN_LAST; i++) { |
| 11820 | hda_nid_t nid = spec->autocfg.input_pins[i]; |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 11821 | if (nid >= 0x0c && nid <= 0x11) { |
| 11822 | snd_hda_codec_write(codec, nid, 0, |
| 11823 | AC_VERB_SET_PIN_WIDGET_CONTROL, |
| 11824 | i <= AUTO_PIN_FRONT_MIC ? |
| 11825 | PIN_VREF80 : PIN_IN); |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 11826 | } |
| 11827 | } |
| 11828 | } |
| 11829 | |
| 11830 | /* parse the BIOS configuration and set up the alc_spec */ |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 11831 | /* return 1 if successful, 0 if the proper config is not found, |
| 11832 | * or a negative error code |
| 11833 | */ |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 11834 | static int alc861_parse_auto_config(struct hda_codec *codec) |
| 11835 | { |
| 11836 | struct alc_spec *spec = codec->spec; |
| 11837 | int err; |
| 11838 | static hda_nid_t alc861_ignore[] = { 0x1d, 0 }; |
| 11839 | |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 11840 | err = snd_hda_parse_pin_def_config(codec, &spec->autocfg, |
| 11841 | alc861_ignore); |
| 11842 | if (err < 0) |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 11843 | return err; |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 11844 | if (!spec->autocfg.line_outs) |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 11845 | return 0; /* can't find valid BIOS pin config */ |
| 11846 | |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 11847 | err = alc861_auto_fill_dac_nids(spec, &spec->autocfg); |
| 11848 | if (err < 0) |
| 11849 | return err; |
| 11850 | err = alc861_auto_create_multi_out_ctls(spec, &spec->autocfg); |
| 11851 | if (err < 0) |
| 11852 | return err; |
| 11853 | err = alc861_auto_create_hp_ctls(spec, spec->autocfg.hp_pins[0]); |
| 11854 | if (err < 0) |
| 11855 | return err; |
| 11856 | err = alc861_auto_create_analog_input_ctls(spec, &spec->autocfg); |
| 11857 | if (err < 0) |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 11858 | return err; |
| 11859 | |
| 11860 | spec->multiout.max_channels = spec->multiout.num_dacs * 2; |
| 11861 | |
| 11862 | if (spec->autocfg.dig_out_pin) |
| 11863 | spec->multiout.dig_out_nid = ALC861_DIGOUT_NID; |
| 11864 | |
| 11865 | if (spec->kctl_alloc) |
| 11866 | spec->mixers[spec->num_mixers++] = spec->kctl_alloc; |
| 11867 | |
| 11868 | spec->init_verbs[spec->num_init_verbs++] = alc861_auto_init_verbs; |
| 11869 | |
Jonathan Woithe | a1e8d2d | 2006-03-28 12:47:09 +0200 | [diff] [blame] | 11870 | spec->num_mux_defs = 1; |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 11871 | spec->input_mux = &spec->private_imux; |
| 11872 | |
| 11873 | spec->adc_nids = alc861_adc_nids; |
| 11874 | spec->num_adc_nids = ARRAY_SIZE(alc861_adc_nids); |
| 11875 | spec->mixers[spec->num_mixers] = alc861_capture_mixer; |
| 11876 | spec->num_mixers++; |
| 11877 | |
| 11878 | return 1; |
| 11879 | } |
| 11880 | |
Takashi Iwai | ae6b813 | 2006-03-03 16:47:17 +0100 | [diff] [blame] | 11881 | /* additional initialization for auto-configuration model */ |
| 11882 | static void alc861_auto_init(struct hda_codec *codec) |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 11883 | { |
Takashi Iwai | f6c7e54 | 2008-02-12 18:32:23 +0100 | [diff] [blame] | 11884 | struct alc_spec *spec = codec->spec; |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 11885 | alc861_auto_init_multi_out(codec); |
| 11886 | alc861_auto_init_hp_out(codec); |
| 11887 | alc861_auto_init_analog_input(codec); |
Takashi Iwai | f6c7e54 | 2008-02-12 18:32:23 +0100 | [diff] [blame] | 11888 | if (spec->unsol_event) |
| 11889 | alc_sku_automute(codec); |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 11890 | } |
| 11891 | |
Takashi Iwai | cb53c62 | 2007-08-10 17:21:45 +0200 | [diff] [blame] | 11892 | #ifdef CONFIG_SND_HDA_POWER_SAVE |
| 11893 | static struct hda_amp_list alc861_loopbacks[] = { |
| 11894 | { 0x15, HDA_INPUT, 0 }, |
| 11895 | { 0x15, HDA_INPUT, 1 }, |
| 11896 | { 0x15, HDA_INPUT, 2 }, |
| 11897 | { 0x15, HDA_INPUT, 3 }, |
| 11898 | { } /* end */ |
| 11899 | }; |
| 11900 | #endif |
| 11901 | |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 11902 | |
| 11903 | /* |
| 11904 | * configuration and preset |
| 11905 | */ |
Takashi Iwai | f5fcc13 | 2006-11-24 17:07:44 +0100 | [diff] [blame] | 11906 | static const char *alc861_models[ALC861_MODEL_LAST] = { |
| 11907 | [ALC861_3ST] = "3stack", |
| 11908 | [ALC660_3ST] = "3stack-660", |
| 11909 | [ALC861_3ST_DIG] = "3stack-dig", |
| 11910 | [ALC861_6ST_DIG] = "6stack-dig", |
| 11911 | [ALC861_UNIWILL_M31] = "uniwill-m31", |
| 11912 | [ALC861_TOSHIBA] = "toshiba", |
| 11913 | [ALC861_ASUS] = "asus", |
| 11914 | [ALC861_ASUS_LAPTOP] = "asus-laptop", |
| 11915 | [ALC861_AUTO] = "auto", |
| 11916 | }; |
| 11917 | |
| 11918 | static struct snd_pci_quirk alc861_cfg_tbl[] = { |
Takashi Iwai | 687a47b | 2007-01-10 11:25:58 +0100 | [diff] [blame] | 11919 | SND_PCI_QUIRK(0x1043, 0x1205, "ASUS W7J", ALC861_3ST), |
Takashi Iwai | f5fcc13 | 2006-11-24 17:07:44 +0100 | [diff] [blame] | 11920 | SND_PCI_QUIRK(0x1043, 0x1335, "ASUS F2/3", ALC861_ASUS_LAPTOP), |
| 11921 | SND_PCI_QUIRK(0x1043, 0x1338, "ASUS F2/3", ALC861_ASUS_LAPTOP), |
| 11922 | SND_PCI_QUIRK(0x1043, 0x1393, "ASUS", ALC861_ASUS), |
Takashi Iwai | ac3e374 | 2007-12-17 17:14:18 +0100 | [diff] [blame] | 11923 | SND_PCI_QUIRK(0x1043, 0x13d7, "ASUS A9rp", ALC861_ASUS_LAPTOP), |
Kailang Yang | 83c3421 | 2007-07-05 11:43:05 +0200 | [diff] [blame] | 11924 | SND_PCI_QUIRK(0x1043, 0x81cb, "ASUS P1-AH2", ALC861_3ST_DIG), |
Tobin Davis | ad5e773 | 2007-01-08 10:57:32 +0100 | [diff] [blame] | 11925 | SND_PCI_QUIRK(0x1179, 0xff00, "Toshiba", ALC861_TOSHIBA), |
Takashi Iwai | 341d4eb | 2007-07-09 17:53:18 +0200 | [diff] [blame] | 11926 | /* FIXME: the entry below breaks Toshiba A100 (model=auto works!) |
| 11927 | * Any other models that need this preset? |
| 11928 | */ |
| 11929 | /* SND_PCI_QUIRK(0x1179, 0xff10, "Toshiba", ALC861_TOSHIBA), */ |
Claudio Matsuoka | ef64adb | 2007-07-14 00:26:16 +0200 | [diff] [blame] | 11930 | SND_PCI_QUIRK(0x1462, 0x7254, "HP dx2200 (MSI MS-7254)", ALC861_3ST), |
| 11931 | SND_PCI_QUIRK(0x1462, 0x7297, "HP dx2250 (MSI MS-7297)", ALC861_3ST), |
Takashi Iwai | ac3e374 | 2007-12-17 17:14:18 +0100 | [diff] [blame] | 11932 | SND_PCI_QUIRK(0x1584, 0x2b01, "Uniwill X40AIx", ALC861_UNIWILL_M31), |
| 11933 | SND_PCI_QUIRK(0x1584, 0x9072, "Uniwill m31", ALC861_UNIWILL_M31), |
| 11934 | SND_PCI_QUIRK(0x1584, 0x9075, "Airis Praxis N1212", ALC861_ASUS_LAPTOP), |
| 11935 | /* FIXME: the below seems conflict */ |
| 11936 | /* SND_PCI_QUIRK(0x1584, 0x9075, "Uniwill", ALC861_UNIWILL_M31), */ |
| 11937 | SND_PCI_QUIRK(0x1849, 0x0660, "Asrock 939SLI32", ALC660_3ST), |
| 11938 | SND_PCI_QUIRK(0x8086, 0xd600, "Intel", ALC861_3ST), |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 11939 | {} |
| 11940 | }; |
| 11941 | |
| 11942 | static struct alc_config_preset alc861_presets[] = { |
| 11943 | [ALC861_3ST] = { |
| 11944 | .mixers = { alc861_3ST_mixer }, |
| 11945 | .init_verbs = { alc861_threestack_init_verbs }, |
| 11946 | .num_dacs = ARRAY_SIZE(alc861_dac_nids), |
| 11947 | .dac_nids = alc861_dac_nids, |
| 11948 | .num_channel_mode = ARRAY_SIZE(alc861_threestack_modes), |
| 11949 | .channel_mode = alc861_threestack_modes, |
Takashi Iwai | 4e195a7 | 2006-07-28 14:47:34 +0200 | [diff] [blame] | 11950 | .need_dac_fix = 1, |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 11951 | .num_adc_nids = ARRAY_SIZE(alc861_adc_nids), |
| 11952 | .adc_nids = alc861_adc_nids, |
| 11953 | .input_mux = &alc861_capture_source, |
| 11954 | }, |
| 11955 | [ALC861_3ST_DIG] = { |
| 11956 | .mixers = { alc861_base_mixer }, |
| 11957 | .init_verbs = { alc861_threestack_init_verbs }, |
| 11958 | .num_dacs = ARRAY_SIZE(alc861_dac_nids), |
| 11959 | .dac_nids = alc861_dac_nids, |
| 11960 | .dig_out_nid = ALC861_DIGOUT_NID, |
| 11961 | .num_channel_mode = ARRAY_SIZE(alc861_threestack_modes), |
| 11962 | .channel_mode = alc861_threestack_modes, |
Takashi Iwai | 4e195a7 | 2006-07-28 14:47:34 +0200 | [diff] [blame] | 11963 | .need_dac_fix = 1, |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 11964 | .num_adc_nids = ARRAY_SIZE(alc861_adc_nids), |
| 11965 | .adc_nids = alc861_adc_nids, |
| 11966 | .input_mux = &alc861_capture_source, |
| 11967 | }, |
| 11968 | [ALC861_6ST_DIG] = { |
| 11969 | .mixers = { alc861_base_mixer }, |
| 11970 | .init_verbs = { alc861_base_init_verbs }, |
| 11971 | .num_dacs = ARRAY_SIZE(alc861_dac_nids), |
| 11972 | .dac_nids = alc861_dac_nids, |
| 11973 | .dig_out_nid = ALC861_DIGOUT_NID, |
| 11974 | .num_channel_mode = ARRAY_SIZE(alc861_8ch_modes), |
| 11975 | .channel_mode = alc861_8ch_modes, |
| 11976 | .num_adc_nids = ARRAY_SIZE(alc861_adc_nids), |
| 11977 | .adc_nids = alc861_adc_nids, |
| 11978 | .input_mux = &alc861_capture_source, |
| 11979 | }, |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 11980 | [ALC660_3ST] = { |
| 11981 | .mixers = { alc861_3ST_mixer }, |
| 11982 | .init_verbs = { alc861_threestack_init_verbs }, |
| 11983 | .num_dacs = ARRAY_SIZE(alc660_dac_nids), |
| 11984 | .dac_nids = alc660_dac_nids, |
| 11985 | .num_channel_mode = ARRAY_SIZE(alc861_threestack_modes), |
| 11986 | .channel_mode = alc861_threestack_modes, |
Takashi Iwai | 4e195a7 | 2006-07-28 14:47:34 +0200 | [diff] [blame] | 11987 | .need_dac_fix = 1, |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 11988 | .num_adc_nids = ARRAY_SIZE(alc861_adc_nids), |
| 11989 | .adc_nids = alc861_adc_nids, |
| 11990 | .input_mux = &alc861_capture_source, |
| 11991 | }, |
Takashi Iwai | 22309c3 | 2006-08-09 16:57:28 +0200 | [diff] [blame] | 11992 | [ALC861_UNIWILL_M31] = { |
| 11993 | .mixers = { alc861_uniwill_m31_mixer }, |
| 11994 | .init_verbs = { alc861_uniwill_m31_init_verbs }, |
| 11995 | .num_dacs = ARRAY_SIZE(alc861_dac_nids), |
| 11996 | .dac_nids = alc861_dac_nids, |
| 11997 | .dig_out_nid = ALC861_DIGOUT_NID, |
| 11998 | .num_channel_mode = ARRAY_SIZE(alc861_uniwill_m31_modes), |
| 11999 | .channel_mode = alc861_uniwill_m31_modes, |
| 12000 | .need_dac_fix = 1, |
| 12001 | .num_adc_nids = ARRAY_SIZE(alc861_adc_nids), |
| 12002 | .adc_nids = alc861_adc_nids, |
| 12003 | .input_mux = &alc861_capture_source, |
| 12004 | }, |
Tobin Davis | a53d1ae | 2006-10-17 12:00:28 +0200 | [diff] [blame] | 12005 | [ALC861_TOSHIBA] = { |
| 12006 | .mixers = { alc861_toshiba_mixer }, |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 12007 | .init_verbs = { alc861_base_init_verbs, |
| 12008 | alc861_toshiba_init_verbs }, |
Tobin Davis | a53d1ae | 2006-10-17 12:00:28 +0200 | [diff] [blame] | 12009 | .num_dacs = ARRAY_SIZE(alc861_dac_nids), |
| 12010 | .dac_nids = alc861_dac_nids, |
| 12011 | .num_channel_mode = ARRAY_SIZE(alc883_3ST_2ch_modes), |
| 12012 | .channel_mode = alc883_3ST_2ch_modes, |
| 12013 | .num_adc_nids = ARRAY_SIZE(alc861_adc_nids), |
| 12014 | .adc_nids = alc861_adc_nids, |
| 12015 | .input_mux = &alc861_capture_source, |
| 12016 | .unsol_event = alc861_toshiba_unsol_event, |
| 12017 | .init_hook = alc861_toshiba_automute, |
| 12018 | }, |
Mariusz Domanski | 7cdbff9 | 2006-10-23 13:42:56 +0200 | [diff] [blame] | 12019 | [ALC861_ASUS] = { |
| 12020 | .mixers = { alc861_asus_mixer }, |
| 12021 | .init_verbs = { alc861_asus_init_verbs }, |
| 12022 | .num_dacs = ARRAY_SIZE(alc861_dac_nids), |
| 12023 | .dac_nids = alc861_dac_nids, |
| 12024 | .dig_out_nid = ALC861_DIGOUT_NID, |
| 12025 | .num_channel_mode = ARRAY_SIZE(alc861_asus_modes), |
| 12026 | .channel_mode = alc861_asus_modes, |
| 12027 | .need_dac_fix = 1, |
| 12028 | .hp_nid = 0x06, |
| 12029 | .num_adc_nids = ARRAY_SIZE(alc861_adc_nids), |
| 12030 | .adc_nids = alc861_adc_nids, |
| 12031 | .input_mux = &alc861_capture_source, |
| 12032 | }, |
Takashi Iwai | 56bb0ca | 2006-11-22 11:52:52 +0100 | [diff] [blame] | 12033 | [ALC861_ASUS_LAPTOP] = { |
| 12034 | .mixers = { alc861_toshiba_mixer, alc861_asus_laptop_mixer }, |
| 12035 | .init_verbs = { alc861_asus_init_verbs, |
| 12036 | alc861_asus_laptop_init_verbs }, |
| 12037 | .num_dacs = ARRAY_SIZE(alc861_dac_nids), |
| 12038 | .dac_nids = alc861_dac_nids, |
| 12039 | .dig_out_nid = ALC861_DIGOUT_NID, |
| 12040 | .num_channel_mode = ARRAY_SIZE(alc883_3ST_2ch_modes), |
| 12041 | .channel_mode = alc883_3ST_2ch_modes, |
| 12042 | .need_dac_fix = 1, |
| 12043 | .num_adc_nids = ARRAY_SIZE(alc861_adc_nids), |
| 12044 | .adc_nids = alc861_adc_nids, |
| 12045 | .input_mux = &alc861_capture_source, |
| 12046 | }, |
| 12047 | }; |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 12048 | |
| 12049 | |
| 12050 | static int patch_alc861(struct hda_codec *codec) |
| 12051 | { |
| 12052 | struct alc_spec *spec; |
| 12053 | int board_config; |
| 12054 | int err; |
| 12055 | |
Robert P. J. Day | dc041e0 | 2006-12-19 14:44:15 +0100 | [diff] [blame] | 12056 | spec = kzalloc(sizeof(*spec), GFP_KERNEL); |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 12057 | if (spec == NULL) |
| 12058 | return -ENOMEM; |
| 12059 | |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 12060 | codec->spec = spec; |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 12061 | |
Takashi Iwai | f5fcc13 | 2006-11-24 17:07:44 +0100 | [diff] [blame] | 12062 | board_config = snd_hda_check_board_config(codec, ALC861_MODEL_LAST, |
| 12063 | alc861_models, |
| 12064 | alc861_cfg_tbl); |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 12065 | |
Takashi Iwai | f5fcc13 | 2006-11-24 17:07:44 +0100 | [diff] [blame] | 12066 | if (board_config < 0) { |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 12067 | printk(KERN_INFO "hda_codec: Unknown model for ALC861, " |
| 12068 | "trying auto-probe from BIOS...\n"); |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 12069 | board_config = ALC861_AUTO; |
| 12070 | } |
| 12071 | |
| 12072 | if (board_config == ALC861_AUTO) { |
| 12073 | /* automatic parse from the BIOS config */ |
| 12074 | err = alc861_parse_auto_config(codec); |
| 12075 | if (err < 0) { |
| 12076 | alc_free(codec); |
| 12077 | return err; |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 12078 | } else if (!err) { |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 12079 | printk(KERN_INFO |
| 12080 | "hda_codec: Cannot set up configuration " |
| 12081 | "from BIOS. Using base mode...\n"); |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 12082 | board_config = ALC861_3ST_DIG; |
| 12083 | } |
| 12084 | } |
| 12085 | |
| 12086 | if (board_config != ALC861_AUTO) |
| 12087 | setup_preset(spec, &alc861_presets[board_config]); |
| 12088 | |
| 12089 | spec->stream_name_analog = "ALC861 Analog"; |
| 12090 | spec->stream_analog_playback = &alc861_pcm_analog_playback; |
| 12091 | spec->stream_analog_capture = &alc861_pcm_analog_capture; |
| 12092 | |
| 12093 | spec->stream_name_digital = "ALC861 Digital"; |
| 12094 | spec->stream_digital_playback = &alc861_pcm_digital_playback; |
| 12095 | spec->stream_digital_capture = &alc861_pcm_digital_capture; |
| 12096 | |
Takashi Iwai | 2134ea4 | 2008-01-10 16:53:55 +0100 | [diff] [blame] | 12097 | spec->vmaster_nid = 0x03; |
| 12098 | |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 12099 | codec->patch_ops = alc_patch_ops; |
| 12100 | if (board_config == ALC861_AUTO) |
Takashi Iwai | ae6b813 | 2006-03-03 16:47:17 +0100 | [diff] [blame] | 12101 | spec->init_hook = alc861_auto_init; |
Takashi Iwai | cb53c62 | 2007-08-10 17:21:45 +0200 | [diff] [blame] | 12102 | #ifdef CONFIG_SND_HDA_POWER_SAVE |
| 12103 | if (!spec->loopback.amplist) |
| 12104 | spec->loopback.amplist = alc861_loopbacks; |
| 12105 | #endif |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 12106 | |
| 12107 | return 0; |
| 12108 | } |
| 12109 | |
| 12110 | /* |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 12111 | * ALC861-VD support |
| 12112 | * |
| 12113 | * Based on ALC882 |
| 12114 | * |
| 12115 | * In addition, an independent DAC |
| 12116 | */ |
| 12117 | #define ALC861VD_DIGOUT_NID 0x06 |
| 12118 | |
| 12119 | static hda_nid_t alc861vd_dac_nids[4] = { |
| 12120 | /* front, surr, clfe, side surr */ |
| 12121 | 0x02, 0x03, 0x04, 0x05 |
| 12122 | }; |
| 12123 | |
| 12124 | /* dac_nids for ALC660vd are in a different order - according to |
| 12125 | * Realtek's driver. |
| 12126 | * This should probably tesult in a different mixer for 6stack models |
| 12127 | * of ALC660vd codecs, but for now there is only 3stack mixer |
| 12128 | * - and it is the same as in 861vd. |
| 12129 | * adc_nids in ALC660vd are (is) the same as in 861vd |
| 12130 | */ |
| 12131 | static hda_nid_t alc660vd_dac_nids[3] = { |
| 12132 | /* front, rear, clfe, rear_surr */ |
| 12133 | 0x02, 0x04, 0x03 |
| 12134 | }; |
| 12135 | |
| 12136 | static hda_nid_t alc861vd_adc_nids[1] = { |
| 12137 | /* ADC0 */ |
| 12138 | 0x09, |
| 12139 | }; |
| 12140 | |
Takashi Iwai | e140634 | 2008-02-11 18:32:32 +0100 | [diff] [blame] | 12141 | static hda_nid_t alc861vd_capsrc_nids[1] = { 0x22 }; |
| 12142 | |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 12143 | /* input MUX */ |
| 12144 | /* FIXME: should be a matrix-type input source selection */ |
| 12145 | static struct hda_input_mux alc861vd_capture_source = { |
| 12146 | .num_items = 4, |
| 12147 | .items = { |
| 12148 | { "Mic", 0x0 }, |
| 12149 | { "Front Mic", 0x1 }, |
| 12150 | { "Line", 0x2 }, |
| 12151 | { "CD", 0x4 }, |
| 12152 | }, |
| 12153 | }; |
| 12154 | |
Kailang Yang | 272a527 | 2007-05-14 11:00:38 +0200 | [diff] [blame] | 12155 | static struct hda_input_mux alc861vd_dallas_capture_source = { |
Tobin Davis | b419f34 | 2008-03-07 11:57:51 +0100 | [diff] [blame] | 12156 | .num_items = 2, |
Kailang Yang | 272a527 | 2007-05-14 11:00:38 +0200 | [diff] [blame] | 12157 | .items = { |
Tobin Davis | b419f34 | 2008-03-07 11:57:51 +0100 | [diff] [blame] | 12158 | { "Ext Mic", 0x0 }, |
| 12159 | { "Int Mic", 0x1 }, |
Kailang Yang | 272a527 | 2007-05-14 11:00:38 +0200 | [diff] [blame] | 12160 | }, |
| 12161 | }; |
| 12162 | |
Kailang Yang | d1a991a | 2007-08-15 16:21:59 +0200 | [diff] [blame] | 12163 | static struct hda_input_mux alc861vd_hp_capture_source = { |
| 12164 | .num_items = 2, |
| 12165 | .items = { |
| 12166 | { "Front Mic", 0x0 }, |
| 12167 | { "ATAPI Mic", 0x1 }, |
| 12168 | }, |
| 12169 | }; |
| 12170 | |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 12171 | #define alc861vd_mux_enum_info alc_mux_enum_info |
| 12172 | #define alc861vd_mux_enum_get alc_mux_enum_get |
Takashi Iwai | e140634 | 2008-02-11 18:32:32 +0100 | [diff] [blame] | 12173 | /* ALC861VD has the ALC882-type input selection (but has only one ADC) */ |
| 12174 | #define alc861vd_mux_enum_put alc882_mux_enum_put |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 12175 | |
| 12176 | /* |
| 12177 | * 2ch mode |
| 12178 | */ |
| 12179 | static struct hda_channel_mode alc861vd_3stack_2ch_modes[1] = { |
| 12180 | { 2, NULL } |
| 12181 | }; |
| 12182 | |
| 12183 | /* |
| 12184 | * 6ch mode |
| 12185 | */ |
| 12186 | static struct hda_verb alc861vd_6stack_ch6_init[] = { |
| 12187 | { 0x17, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x00 }, |
| 12188 | { 0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, |
| 12189 | { 0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, |
| 12190 | { 0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, |
| 12191 | { } /* end */ |
| 12192 | }; |
| 12193 | |
| 12194 | /* |
| 12195 | * 8ch mode |
| 12196 | */ |
| 12197 | static struct hda_verb alc861vd_6stack_ch8_init[] = { |
| 12198 | { 0x17, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, |
| 12199 | { 0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, |
| 12200 | { 0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, |
| 12201 | { 0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, |
| 12202 | { } /* end */ |
| 12203 | }; |
| 12204 | |
| 12205 | static struct hda_channel_mode alc861vd_6stack_modes[2] = { |
| 12206 | { 6, alc861vd_6stack_ch6_init }, |
| 12207 | { 8, alc861vd_6stack_ch8_init }, |
| 12208 | }; |
| 12209 | |
| 12210 | static struct snd_kcontrol_new alc861vd_chmode_mixer[] = { |
| 12211 | { |
| 12212 | .iface = SNDRV_CTL_ELEM_IFACE_MIXER, |
| 12213 | .name = "Channel Mode", |
| 12214 | .info = alc_ch_mode_info, |
| 12215 | .get = alc_ch_mode_get, |
| 12216 | .put = alc_ch_mode_put, |
| 12217 | }, |
| 12218 | { } /* end */ |
| 12219 | }; |
| 12220 | |
| 12221 | static struct snd_kcontrol_new alc861vd_capture_mixer[] = { |
| 12222 | HDA_CODEC_VOLUME("Capture Volume", 0x09, 0x0, HDA_INPUT), |
| 12223 | HDA_CODEC_MUTE("Capture Switch", 0x09, 0x0, HDA_INPUT), |
| 12224 | |
| 12225 | { |
| 12226 | .iface = SNDRV_CTL_ELEM_IFACE_MIXER, |
| 12227 | /* The multiple "Capture Source" controls confuse alsamixer |
| 12228 | * So call somewhat different.. |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 12229 | */ |
| 12230 | /* .name = "Capture Source", */ |
| 12231 | .name = "Input Source", |
| 12232 | .count = 1, |
| 12233 | .info = alc861vd_mux_enum_info, |
| 12234 | .get = alc861vd_mux_enum_get, |
| 12235 | .put = alc861vd_mux_enum_put, |
| 12236 | }, |
| 12237 | { } /* end */ |
| 12238 | }; |
| 12239 | |
| 12240 | /* Pin assignment: Front=0x14, Rear=0x15, CLFE=0x16, Side=0x17 |
| 12241 | * Mic=0x18, Front Mic=0x19, Line-In=0x1a, HP=0x1b |
| 12242 | */ |
| 12243 | static struct snd_kcontrol_new alc861vd_6st_mixer[] = { |
| 12244 | HDA_CODEC_VOLUME("Front Playback Volume", 0x02, 0x0, HDA_OUTPUT), |
| 12245 | HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT), |
| 12246 | |
| 12247 | HDA_CODEC_VOLUME("Surround Playback Volume", 0x03, 0x0, HDA_OUTPUT), |
| 12248 | HDA_BIND_MUTE("Surround Playback Switch", 0x0d, 2, HDA_INPUT), |
| 12249 | |
| 12250 | HDA_CODEC_VOLUME_MONO("Center Playback Volume", 0x04, 1, 0x0, |
| 12251 | HDA_OUTPUT), |
| 12252 | HDA_CODEC_VOLUME_MONO("LFE Playback Volume", 0x04, 2, 0x0, |
| 12253 | HDA_OUTPUT), |
| 12254 | HDA_BIND_MUTE_MONO("Center Playback Switch", 0x0e, 1, 2, HDA_INPUT), |
| 12255 | HDA_BIND_MUTE_MONO("LFE Playback Switch", 0x0e, 2, 2, HDA_INPUT), |
| 12256 | |
| 12257 | HDA_CODEC_VOLUME("Side Playback Volume", 0x05, 0x0, HDA_OUTPUT), |
| 12258 | HDA_BIND_MUTE("Side Playback Switch", 0x0f, 2, HDA_INPUT), |
| 12259 | |
| 12260 | HDA_CODEC_MUTE("Headphone Playback Switch", 0x1b, 0x0, HDA_OUTPUT), |
| 12261 | |
| 12262 | HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT), |
| 12263 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), |
| 12264 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), |
| 12265 | |
| 12266 | HDA_CODEC_VOLUME("Front Mic Boost", 0x19, 0, HDA_INPUT), |
| 12267 | HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x1, HDA_INPUT), |
| 12268 | HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x1, HDA_INPUT), |
| 12269 | |
| 12270 | HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT), |
| 12271 | HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT), |
| 12272 | |
| 12273 | HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT), |
| 12274 | HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT), |
| 12275 | |
| 12276 | HDA_CODEC_VOLUME("PC Speaker Playback Volume", 0x0b, 0x05, HDA_INPUT), |
| 12277 | HDA_CODEC_MUTE("PC Speaker Playback Switch", 0x0b, 0x05, HDA_INPUT), |
| 12278 | |
| 12279 | { } /* end */ |
| 12280 | }; |
| 12281 | |
| 12282 | static struct snd_kcontrol_new alc861vd_3st_mixer[] = { |
| 12283 | HDA_CODEC_VOLUME("Front Playback Volume", 0x02, 0x0, HDA_OUTPUT), |
| 12284 | HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT), |
| 12285 | |
| 12286 | HDA_CODEC_MUTE("Headphone Playback Switch", 0x1b, 0x0, HDA_OUTPUT), |
| 12287 | |
| 12288 | HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT), |
| 12289 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), |
| 12290 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), |
| 12291 | |
| 12292 | HDA_CODEC_VOLUME("Front Mic Boost", 0x19, 0, HDA_INPUT), |
| 12293 | HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x1, HDA_INPUT), |
| 12294 | HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x1, HDA_INPUT), |
| 12295 | |
| 12296 | HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT), |
| 12297 | HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT), |
| 12298 | |
| 12299 | HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT), |
| 12300 | HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT), |
| 12301 | |
| 12302 | HDA_CODEC_VOLUME("PC Speaker Playback Volume", 0x0b, 0x05, HDA_INPUT), |
| 12303 | HDA_CODEC_MUTE("PC Speaker Playback Switch", 0x0b, 0x05, HDA_INPUT), |
| 12304 | |
| 12305 | { } /* end */ |
| 12306 | }; |
| 12307 | |
Kailang Yang | bdd148a | 2007-05-08 15:19:08 +0200 | [diff] [blame] | 12308 | static struct snd_kcontrol_new alc861vd_lenovo_mixer[] = { |
| 12309 | HDA_CODEC_VOLUME("Front Playback Volume", 0x02, 0x0, HDA_OUTPUT), |
| 12310 | /*HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT),*/ |
| 12311 | HDA_CODEC_MUTE("Front Playback Switch", 0x14, 0x0, HDA_OUTPUT), |
| 12312 | |
| 12313 | HDA_CODEC_MUTE("Headphone Playback Switch", 0x1b, 0x0, HDA_OUTPUT), |
| 12314 | |
| 12315 | HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT), |
| 12316 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), |
| 12317 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), |
| 12318 | |
| 12319 | HDA_CODEC_VOLUME("Front Mic Boost", 0x19, 0, HDA_INPUT), |
| 12320 | HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x1, HDA_INPUT), |
| 12321 | HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x1, HDA_INPUT), |
| 12322 | |
| 12323 | HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT), |
| 12324 | HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT), |
| 12325 | |
| 12326 | { } /* end */ |
| 12327 | }; |
| 12328 | |
Tobin Davis | b419f34 | 2008-03-07 11:57:51 +0100 | [diff] [blame] | 12329 | /* Pin assignment: Speaker=0x14, HP = 0x15, |
| 12330 | * Ext Mic=0x18, Int Mic = 0x19, CD = 0x1c, PC Beep = 0x1d |
Kailang Yang | 272a527 | 2007-05-14 11:00:38 +0200 | [diff] [blame] | 12331 | */ |
| 12332 | static struct snd_kcontrol_new alc861vd_dallas_mixer[] = { |
Tobin Davis | b419f34 | 2008-03-07 11:57:51 +0100 | [diff] [blame] | 12333 | HDA_CODEC_VOLUME("Speaker Playback Volume", 0x02, 0x0, HDA_OUTPUT), |
| 12334 | HDA_BIND_MUTE("Speaker Playback Switch", 0x0c, 2, HDA_INPUT), |
Kailang Yang | 272a527 | 2007-05-14 11:00:38 +0200 | [diff] [blame] | 12335 | HDA_CODEC_VOLUME("Headphone Playback Volume", 0x03, 0x0, HDA_OUTPUT), |
| 12336 | HDA_BIND_MUTE("Headphone Playback Switch", 0x0d, 2, HDA_INPUT), |
Tobin Davis | b419f34 | 2008-03-07 11:57:51 +0100 | [diff] [blame] | 12337 | HDA_CODEC_VOLUME("Ext Mic Boost", 0x18, 0, HDA_INPUT), |
| 12338 | HDA_CODEC_VOLUME("Ext Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), |
| 12339 | HDA_CODEC_MUTE("Ext Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), |
| 12340 | HDA_CODEC_VOLUME("Int Mic Boost", 0x19, 0, HDA_INPUT), |
| 12341 | HDA_CODEC_VOLUME("Int Mic Playback Volume", 0x0b, 0x1, HDA_INPUT), |
| 12342 | HDA_CODEC_MUTE("Int Mic Playback Switch", 0x0b, 0x1, HDA_INPUT), |
| 12343 | HDA_CODEC_VOLUME("PC Beep Volume", 0x0b, 0x05, HDA_INPUT), |
| 12344 | HDA_CODEC_MUTE("PC Beep Switch", 0x0b, 0x05, HDA_INPUT), |
Kailang Yang | 272a527 | 2007-05-14 11:00:38 +0200 | [diff] [blame] | 12345 | { } /* end */ |
| 12346 | }; |
| 12347 | |
Kailang Yang | d1a991a | 2007-08-15 16:21:59 +0200 | [diff] [blame] | 12348 | /* Pin assignment: Speaker=0x14, Line-out = 0x15, |
| 12349 | * Front Mic=0x18, ATAPI Mic = 0x19, |
| 12350 | */ |
| 12351 | static struct snd_kcontrol_new alc861vd_hp_mixer[] = { |
| 12352 | HDA_CODEC_VOLUME("Front Playback Volume", 0x02, 0x0, HDA_OUTPUT), |
| 12353 | HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT), |
| 12354 | HDA_CODEC_VOLUME("Headphone Playback Volume", 0x03, 0x0, HDA_OUTPUT), |
| 12355 | HDA_BIND_MUTE("Headphone Playback Switch", 0x0d, 2, HDA_INPUT), |
| 12356 | HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), |
| 12357 | HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), |
| 12358 | HDA_CODEC_VOLUME("ATAPI Mic Playback Volume", 0x0b, 0x1, HDA_INPUT), |
| 12359 | HDA_CODEC_MUTE("ATAPI Mic Playback Switch", 0x0b, 0x1, HDA_INPUT), |
| 12360 | |
| 12361 | { } /* end */ |
| 12362 | }; |
| 12363 | |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 12364 | /* |
| 12365 | * generic initialization of ADC, input mixers and output mixers |
| 12366 | */ |
| 12367 | static struct hda_verb alc861vd_volume_init_verbs[] = { |
| 12368 | /* |
| 12369 | * Unmute ADC0 and set the default input to mic-in |
| 12370 | */ |
| 12371 | {0x09, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 12372 | {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 12373 | |
| 12374 | /* Unmute input amps (CD, Line In, Mic 1 & Mic 2) of |
| 12375 | * the analog-loopback mixer widget |
| 12376 | */ |
| 12377 | /* Amp Indices: Mic1 = 0, Mic2 = 1, Line1 = 2, Line2 = 3, CD = 4 */ |
Takashi Iwai | cb53c62 | 2007-08-10 17:21:45 +0200 | [diff] [blame] | 12378 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 12379 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
| 12380 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)}, |
| 12381 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)}, |
| 12382 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)}, |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 12383 | |
| 12384 | /* Capture mixer: unmute Mic, F-Mic, Line, CD inputs */ |
Kailang Yang | bdd148a | 2007-05-08 15:19:08 +0200 | [diff] [blame] | 12385 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 12386 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 12387 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(2)}, |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 12388 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(4)}, |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 12389 | |
| 12390 | /* |
| 12391 | * Set up output mixers (0x02 - 0x05) |
| 12392 | */ |
| 12393 | /* set vol=0 to output mixers */ |
| 12394 | {0x02, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 12395 | {0x03, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 12396 | {0x04, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 12397 | {0x05, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 12398 | |
| 12399 | /* set up input amps for analog loopback */ |
| 12400 | /* Amp Indices: DAC = 0, mixer = 1 */ |
| 12401 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 12402 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
| 12403 | {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 12404 | {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
| 12405 | {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 12406 | {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
| 12407 | {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 12408 | {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
| 12409 | |
| 12410 | { } |
| 12411 | }; |
| 12412 | |
| 12413 | /* |
| 12414 | * 3-stack pin configuration: |
| 12415 | * front = 0x14, mic/clfe = 0x18, HP = 0x19, line/surr = 0x1a, f-mic = 0x1b |
| 12416 | */ |
| 12417 | static struct hda_verb alc861vd_3stack_init_verbs[] = { |
| 12418 | /* |
| 12419 | * Set pin mode and muting |
| 12420 | */ |
| 12421 | /* set front pin widgets 0x14 for output */ |
| 12422 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 12423 | {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 12424 | {0x14, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 12425 | |
| 12426 | /* Mic (rear) pin: input vref at 80% */ |
| 12427 | {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80}, |
| 12428 | {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
| 12429 | /* Front Mic pin: input vref at 80% */ |
| 12430 | {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80}, |
| 12431 | {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
| 12432 | /* Line In pin: input */ |
| 12433 | {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
| 12434 | {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
| 12435 | /* Line-2 In: Headphone output (output 0 - 0x0c) */ |
| 12436 | {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 12437 | {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 12438 | {0x1b, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 12439 | /* CD pin widget for input */ |
| 12440 | {0x1c, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
| 12441 | |
| 12442 | { } |
| 12443 | }; |
| 12444 | |
| 12445 | /* |
| 12446 | * 6-stack pin configuration: |
| 12447 | */ |
| 12448 | static struct hda_verb alc861vd_6stack_init_verbs[] = { |
| 12449 | /* |
| 12450 | * Set pin mode and muting |
| 12451 | */ |
| 12452 | /* set front pin widgets 0x14 for output */ |
| 12453 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 12454 | {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 12455 | {0x14, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 12456 | |
| 12457 | /* Rear Pin: output 1 (0x0d) */ |
| 12458 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 12459 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 12460 | {0x15, AC_VERB_SET_CONNECT_SEL, 0x01}, |
| 12461 | /* CLFE Pin: output 2 (0x0e) */ |
| 12462 | {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 12463 | {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 12464 | {0x16, AC_VERB_SET_CONNECT_SEL, 0x02}, |
| 12465 | /* Side Pin: output 3 (0x0f) */ |
| 12466 | {0x17, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 12467 | {0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 12468 | {0x17, AC_VERB_SET_CONNECT_SEL, 0x03}, |
| 12469 | |
| 12470 | /* Mic (rear) pin: input vref at 80% */ |
| 12471 | {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80}, |
| 12472 | {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
| 12473 | /* Front Mic pin: input vref at 80% */ |
| 12474 | {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80}, |
| 12475 | {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
| 12476 | /* Line In pin: input */ |
| 12477 | {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
| 12478 | {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
| 12479 | /* Line-2 In: Headphone output (output 0 - 0x0c) */ |
| 12480 | {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 12481 | {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 12482 | {0x1b, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 12483 | /* CD pin widget for input */ |
| 12484 | {0x1c, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
| 12485 | |
| 12486 | { } |
| 12487 | }; |
| 12488 | |
Kailang Yang | bdd148a | 2007-05-08 15:19:08 +0200 | [diff] [blame] | 12489 | static struct hda_verb alc861vd_eapd_verbs[] = { |
| 12490 | {0x14, AC_VERB_SET_EAPD_BTLENABLE, 2}, |
| 12491 | { } |
| 12492 | }; |
| 12493 | |
| 12494 | static struct hda_verb alc861vd_lenovo_unsol_verbs[] = { |
| 12495 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 12496 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 12497 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(5)}, |
| 12498 | {0x1b, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT}, |
| 12499 | {0x18, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_MIC_EVENT}, |
| 12500 | {} |
| 12501 | }; |
| 12502 | |
| 12503 | /* toggle speaker-output according to the hp-jack state */ |
| 12504 | static void alc861vd_lenovo_hp_automute(struct hda_codec *codec) |
| 12505 | { |
| 12506 | unsigned int present; |
| 12507 | unsigned char bits; |
| 12508 | |
| 12509 | present = snd_hda_codec_read(codec, 0x1b, 0, |
| 12510 | AC_VERB_GET_PIN_SENSE, 0) & 0x80000000; |
Takashi Iwai | 47fd830 | 2007-08-10 17:11:07 +0200 | [diff] [blame] | 12511 | bits = present ? HDA_AMP_MUTE : 0; |
| 12512 | snd_hda_codec_amp_stereo(codec, 0x14, HDA_OUTPUT, 0, |
| 12513 | HDA_AMP_MUTE, bits); |
Kailang Yang | bdd148a | 2007-05-08 15:19:08 +0200 | [diff] [blame] | 12514 | } |
| 12515 | |
| 12516 | static void alc861vd_lenovo_mic_automute(struct hda_codec *codec) |
| 12517 | { |
| 12518 | unsigned int present; |
| 12519 | unsigned char bits; |
| 12520 | |
| 12521 | present = snd_hda_codec_read(codec, 0x18, 0, |
| 12522 | AC_VERB_GET_PIN_SENSE, 0) & 0x80000000; |
Takashi Iwai | 47fd830 | 2007-08-10 17:11:07 +0200 | [diff] [blame] | 12523 | bits = present ? HDA_AMP_MUTE : 0; |
| 12524 | snd_hda_codec_amp_stereo(codec, 0x0b, HDA_INPUT, 1, |
| 12525 | HDA_AMP_MUTE, bits); |
Kailang Yang | bdd148a | 2007-05-08 15:19:08 +0200 | [diff] [blame] | 12526 | } |
| 12527 | |
| 12528 | static void alc861vd_lenovo_automute(struct hda_codec *codec) |
| 12529 | { |
| 12530 | alc861vd_lenovo_hp_automute(codec); |
| 12531 | alc861vd_lenovo_mic_automute(codec); |
| 12532 | } |
| 12533 | |
| 12534 | static void alc861vd_lenovo_unsol_event(struct hda_codec *codec, |
| 12535 | unsigned int res) |
| 12536 | { |
| 12537 | switch (res >> 26) { |
| 12538 | case ALC880_HP_EVENT: |
| 12539 | alc861vd_lenovo_hp_automute(codec); |
| 12540 | break; |
| 12541 | case ALC880_MIC_EVENT: |
| 12542 | alc861vd_lenovo_mic_automute(codec); |
| 12543 | break; |
| 12544 | } |
| 12545 | } |
| 12546 | |
Kailang Yang | 272a527 | 2007-05-14 11:00:38 +0200 | [diff] [blame] | 12547 | static struct hda_verb alc861vd_dallas_verbs[] = { |
| 12548 | {0x02, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 12549 | {0x03, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 12550 | {0x04, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 12551 | {0x05, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 12552 | |
| 12553 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 12554 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 12555 | {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 12556 | {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
| 12557 | {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 12558 | {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
| 12559 | {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 12560 | {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
| 12561 | |
| 12562 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 12563 | {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 12564 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 12565 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 12566 | {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 12567 | {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 12568 | {0x17, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 12569 | {0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 12570 | |
| 12571 | {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF50}, |
| 12572 | {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
| 12573 | {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF50}, |
| 12574 | {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
| 12575 | {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
| 12576 | {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
| 12577 | {0x1c, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
| 12578 | {0x1d, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
| 12579 | |
| 12580 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 12581 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)}, |
| 12582 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)}, |
| 12583 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)}, |
| 12584 | |
| 12585 | {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 12586 | {0x09, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 12587 | {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT}, |
| 12588 | |
| 12589 | { } /* end */ |
| 12590 | }; |
| 12591 | |
| 12592 | /* toggle speaker-output according to the hp-jack state */ |
| 12593 | static void alc861vd_dallas_automute(struct hda_codec *codec) |
| 12594 | { |
| 12595 | unsigned int present; |
| 12596 | |
| 12597 | present = snd_hda_codec_read(codec, 0x15, 0, |
| 12598 | AC_VERB_GET_PIN_SENSE, 0) & 0x80000000; |
Takashi Iwai | 47fd830 | 2007-08-10 17:11:07 +0200 | [diff] [blame] | 12599 | snd_hda_codec_amp_stereo(codec, 0x14, HDA_OUTPUT, 0, |
| 12600 | HDA_AMP_MUTE, present ? HDA_AMP_MUTE : 0); |
Kailang Yang | 272a527 | 2007-05-14 11:00:38 +0200 | [diff] [blame] | 12601 | } |
| 12602 | |
| 12603 | static void alc861vd_dallas_unsol_event(struct hda_codec *codec, unsigned int res) |
| 12604 | { |
| 12605 | if ((res >> 26) == ALC880_HP_EVENT) |
| 12606 | alc861vd_dallas_automute(codec); |
| 12607 | } |
| 12608 | |
Takashi Iwai | cb53c62 | 2007-08-10 17:21:45 +0200 | [diff] [blame] | 12609 | #ifdef CONFIG_SND_HDA_POWER_SAVE |
| 12610 | #define alc861vd_loopbacks alc880_loopbacks |
| 12611 | #endif |
| 12612 | |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 12613 | /* pcm configuration: identiacal with ALC880 */ |
| 12614 | #define alc861vd_pcm_analog_playback alc880_pcm_analog_playback |
| 12615 | #define alc861vd_pcm_analog_capture alc880_pcm_analog_capture |
| 12616 | #define alc861vd_pcm_digital_playback alc880_pcm_digital_playback |
| 12617 | #define alc861vd_pcm_digital_capture alc880_pcm_digital_capture |
| 12618 | |
| 12619 | /* |
| 12620 | * configuration and preset |
| 12621 | */ |
| 12622 | static const char *alc861vd_models[ALC861VD_MODEL_LAST] = { |
| 12623 | [ALC660VD_3ST] = "3stack-660", |
Takashi Iwai | 983f8ae | 2007-08-15 16:44:04 +0200 | [diff] [blame] | 12624 | [ALC660VD_3ST_DIG] = "3stack-660-digout", |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 12625 | [ALC861VD_3ST] = "3stack", |
| 12626 | [ALC861VD_3ST_DIG] = "3stack-digout", |
| 12627 | [ALC861VD_6ST_DIG] = "6stack-digout", |
Kailang Yang | bdd148a | 2007-05-08 15:19:08 +0200 | [diff] [blame] | 12628 | [ALC861VD_LENOVO] = "lenovo", |
Kailang Yang | 272a527 | 2007-05-14 11:00:38 +0200 | [diff] [blame] | 12629 | [ALC861VD_DALLAS] = "dallas", |
Takashi Iwai | 983f8ae | 2007-08-15 16:44:04 +0200 | [diff] [blame] | 12630 | [ALC861VD_HP] = "hp", |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 12631 | [ALC861VD_AUTO] = "auto", |
| 12632 | }; |
| 12633 | |
| 12634 | static struct snd_pci_quirk alc861vd_cfg_tbl[] = { |
Takashi Iwai | ac3e374 | 2007-12-17 17:14:18 +0100 | [diff] [blame] | 12635 | SND_PCI_QUIRK(0x1019, 0xa88d, "Realtek ALC660 demo", ALC660VD_3ST), |
| 12636 | SND_PCI_QUIRK(0x103c, 0x30bf, "HP TX1000", ALC861VD_HP), |
Takashi Iwai | 07e038b | 2007-02-15 18:23:41 +0100 | [diff] [blame] | 12637 | SND_PCI_QUIRK(0x1043, 0x12e2, "Asus z35m", ALC660VD_3ST), |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 12638 | SND_PCI_QUIRK(0x1043, 0x1339, "Asus G1", ALC660VD_3ST), |
Mike Crash | 6963f84 | 2007-06-25 12:12:51 +0200 | [diff] [blame] | 12639 | SND_PCI_QUIRK(0x1043, 0x81e7, "ASUS", ALC660VD_3ST_DIG), |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 12640 | SND_PCI_QUIRK(0x10de, 0x03f0, "Realtek ALC660 demo", ALC660VD_3ST), |
Takashi Iwai | ac3e374 | 2007-12-17 17:14:18 +0100 | [diff] [blame] | 12641 | SND_PCI_QUIRK(0x1179, 0xff00, "Toshiba A135", ALC861VD_LENOVO), |
Takashi Iwai | 38baf5a | 2007-08-16 17:52:43 +0200 | [diff] [blame] | 12642 | /*SND_PCI_QUIRK(0x1179, 0xff00, "DALLAS", ALC861VD_DALLAS),*/ /*lenovo*/ |
Kailang Yang | 272a527 | 2007-05-14 11:00:38 +0200 | [diff] [blame] | 12643 | SND_PCI_QUIRK(0x1179, 0xff01, "DALLAS", ALC861VD_DALLAS), |
Takashi Iwai | 542d7c6 | 2007-08-16 18:57:30 +0200 | [diff] [blame] | 12644 | SND_PCI_QUIRK(0x1179, 0xff03, "Toshiba P205", ALC861VD_LENOVO), |
Tobin Davis | b419f34 | 2008-03-07 11:57:51 +0100 | [diff] [blame] | 12645 | SND_PCI_QUIRK(0x1179, 0xff31, "Toshiba L30-149", ALC861VD_DALLAS), |
Takashi Iwai | 39c5d41 | 2007-08-15 16:24:17 +0200 | [diff] [blame] | 12646 | SND_PCI_QUIRK(0x1565, 0x820d, "Biostar NF61S SE", ALC861VD_6ST_DIG), |
Takashi Iwai | ac3e374 | 2007-12-17 17:14:18 +0100 | [diff] [blame] | 12647 | SND_PCI_QUIRK(0x17aa, 0x2066, "Lenovo", ALC861VD_LENOVO), |
| 12648 | SND_PCI_QUIRK(0x17aa, 0x3802, "Lenovo 3000 C200", ALC861VD_LENOVO), |
Tobin Davis | 625dc0b | 2007-07-30 21:42:10 +0200 | [diff] [blame] | 12649 | SND_PCI_QUIRK(0x1849, 0x0862, "ASRock K8NF6G-VSTA", ALC861VD_6ST_DIG), |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 12650 | {} |
| 12651 | }; |
| 12652 | |
| 12653 | static struct alc_config_preset alc861vd_presets[] = { |
| 12654 | [ALC660VD_3ST] = { |
| 12655 | .mixers = { alc861vd_3st_mixer }, |
| 12656 | .init_verbs = { alc861vd_volume_init_verbs, |
| 12657 | alc861vd_3stack_init_verbs }, |
| 12658 | .num_dacs = ARRAY_SIZE(alc660vd_dac_nids), |
| 12659 | .dac_nids = alc660vd_dac_nids, |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 12660 | .num_channel_mode = ARRAY_SIZE(alc861vd_3stack_2ch_modes), |
| 12661 | .channel_mode = alc861vd_3stack_2ch_modes, |
| 12662 | .input_mux = &alc861vd_capture_source, |
| 12663 | }, |
Mike Crash | 6963f84 | 2007-06-25 12:12:51 +0200 | [diff] [blame] | 12664 | [ALC660VD_3ST_DIG] = { |
| 12665 | .mixers = { alc861vd_3st_mixer }, |
| 12666 | .init_verbs = { alc861vd_volume_init_verbs, |
| 12667 | alc861vd_3stack_init_verbs }, |
| 12668 | .num_dacs = ARRAY_SIZE(alc660vd_dac_nids), |
| 12669 | .dac_nids = alc660vd_dac_nids, |
| 12670 | .dig_out_nid = ALC861VD_DIGOUT_NID, |
Mike Crash | 6963f84 | 2007-06-25 12:12:51 +0200 | [diff] [blame] | 12671 | .num_channel_mode = ARRAY_SIZE(alc861vd_3stack_2ch_modes), |
| 12672 | .channel_mode = alc861vd_3stack_2ch_modes, |
| 12673 | .input_mux = &alc861vd_capture_source, |
| 12674 | }, |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 12675 | [ALC861VD_3ST] = { |
| 12676 | .mixers = { alc861vd_3st_mixer }, |
| 12677 | .init_verbs = { alc861vd_volume_init_verbs, |
| 12678 | alc861vd_3stack_init_verbs }, |
| 12679 | .num_dacs = ARRAY_SIZE(alc861vd_dac_nids), |
| 12680 | .dac_nids = alc861vd_dac_nids, |
| 12681 | .num_channel_mode = ARRAY_SIZE(alc861vd_3stack_2ch_modes), |
| 12682 | .channel_mode = alc861vd_3stack_2ch_modes, |
| 12683 | .input_mux = &alc861vd_capture_source, |
| 12684 | }, |
| 12685 | [ALC861VD_3ST_DIG] = { |
| 12686 | .mixers = { alc861vd_3st_mixer }, |
| 12687 | .init_verbs = { alc861vd_volume_init_verbs, |
| 12688 | alc861vd_3stack_init_verbs }, |
| 12689 | .num_dacs = ARRAY_SIZE(alc861vd_dac_nids), |
| 12690 | .dac_nids = alc861vd_dac_nids, |
| 12691 | .dig_out_nid = ALC861VD_DIGOUT_NID, |
| 12692 | .num_channel_mode = ARRAY_SIZE(alc861vd_3stack_2ch_modes), |
| 12693 | .channel_mode = alc861vd_3stack_2ch_modes, |
| 12694 | .input_mux = &alc861vd_capture_source, |
| 12695 | }, |
| 12696 | [ALC861VD_6ST_DIG] = { |
| 12697 | .mixers = { alc861vd_6st_mixer, alc861vd_chmode_mixer }, |
| 12698 | .init_verbs = { alc861vd_volume_init_verbs, |
| 12699 | alc861vd_6stack_init_verbs }, |
| 12700 | .num_dacs = ARRAY_SIZE(alc861vd_dac_nids), |
| 12701 | .dac_nids = alc861vd_dac_nids, |
| 12702 | .dig_out_nid = ALC861VD_DIGOUT_NID, |
| 12703 | .num_channel_mode = ARRAY_SIZE(alc861vd_6stack_modes), |
| 12704 | .channel_mode = alc861vd_6stack_modes, |
| 12705 | .input_mux = &alc861vd_capture_source, |
| 12706 | }, |
Kailang Yang | bdd148a | 2007-05-08 15:19:08 +0200 | [diff] [blame] | 12707 | [ALC861VD_LENOVO] = { |
| 12708 | .mixers = { alc861vd_lenovo_mixer }, |
| 12709 | .init_verbs = { alc861vd_volume_init_verbs, |
| 12710 | alc861vd_3stack_init_verbs, |
| 12711 | alc861vd_eapd_verbs, |
| 12712 | alc861vd_lenovo_unsol_verbs }, |
| 12713 | .num_dacs = ARRAY_SIZE(alc660vd_dac_nids), |
| 12714 | .dac_nids = alc660vd_dac_nids, |
Kailang Yang | bdd148a | 2007-05-08 15:19:08 +0200 | [diff] [blame] | 12715 | .num_channel_mode = ARRAY_SIZE(alc861vd_3stack_2ch_modes), |
| 12716 | .channel_mode = alc861vd_3stack_2ch_modes, |
| 12717 | .input_mux = &alc861vd_capture_source, |
| 12718 | .unsol_event = alc861vd_lenovo_unsol_event, |
| 12719 | .init_hook = alc861vd_lenovo_automute, |
| 12720 | }, |
Kailang Yang | 272a527 | 2007-05-14 11:00:38 +0200 | [diff] [blame] | 12721 | [ALC861VD_DALLAS] = { |
| 12722 | .mixers = { alc861vd_dallas_mixer }, |
| 12723 | .init_verbs = { alc861vd_dallas_verbs }, |
| 12724 | .num_dacs = ARRAY_SIZE(alc861vd_dac_nids), |
| 12725 | .dac_nids = alc861vd_dac_nids, |
Kailang Yang | 272a527 | 2007-05-14 11:00:38 +0200 | [diff] [blame] | 12726 | .num_channel_mode = ARRAY_SIZE(alc861vd_3stack_2ch_modes), |
| 12727 | .channel_mode = alc861vd_3stack_2ch_modes, |
| 12728 | .input_mux = &alc861vd_dallas_capture_source, |
| 12729 | .unsol_event = alc861vd_dallas_unsol_event, |
| 12730 | .init_hook = alc861vd_dallas_automute, |
Kailang Yang | d1a991a | 2007-08-15 16:21:59 +0200 | [diff] [blame] | 12731 | }, |
| 12732 | [ALC861VD_HP] = { |
| 12733 | .mixers = { alc861vd_hp_mixer }, |
| 12734 | .init_verbs = { alc861vd_dallas_verbs, alc861vd_eapd_verbs }, |
| 12735 | .num_dacs = ARRAY_SIZE(alc861vd_dac_nids), |
| 12736 | .dac_nids = alc861vd_dac_nids, |
Kailang Yang | d1a991a | 2007-08-15 16:21:59 +0200 | [diff] [blame] | 12737 | .dig_out_nid = ALC861VD_DIGOUT_NID, |
Kailang Yang | d1a991a | 2007-08-15 16:21:59 +0200 | [diff] [blame] | 12738 | .num_channel_mode = ARRAY_SIZE(alc861vd_3stack_2ch_modes), |
| 12739 | .channel_mode = alc861vd_3stack_2ch_modes, |
| 12740 | .input_mux = &alc861vd_hp_capture_source, |
| 12741 | .unsol_event = alc861vd_dallas_unsol_event, |
| 12742 | .init_hook = alc861vd_dallas_automute, |
| 12743 | }, |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 12744 | }; |
| 12745 | |
| 12746 | /* |
| 12747 | * BIOS auto configuration |
| 12748 | */ |
| 12749 | static void alc861vd_auto_set_output_and_unmute(struct hda_codec *codec, |
| 12750 | hda_nid_t nid, int pin_type, int dac_idx) |
| 12751 | { |
Takashi Iwai | f6c7e54 | 2008-02-12 18:32:23 +0100 | [diff] [blame] | 12752 | alc_set_pin_output(codec, nid, pin_type); |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 12753 | } |
| 12754 | |
| 12755 | static void alc861vd_auto_init_multi_out(struct hda_codec *codec) |
| 12756 | { |
| 12757 | struct alc_spec *spec = codec->spec; |
| 12758 | int i; |
| 12759 | |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 12760 | alc_subsystem_id(codec, 0x15, 0x1b, 0x14); |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 12761 | for (i = 0; i <= HDA_SIDE; i++) { |
| 12762 | hda_nid_t nid = spec->autocfg.line_out_pins[i]; |
Takashi Iwai | baba8ee | 2007-04-23 17:17:48 +0200 | [diff] [blame] | 12763 | int pin_type = get_pin_type(spec->autocfg.line_out_type); |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 12764 | if (nid) |
| 12765 | alc861vd_auto_set_output_and_unmute(codec, nid, |
Takashi Iwai | baba8ee | 2007-04-23 17:17:48 +0200 | [diff] [blame] | 12766 | pin_type, i); |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 12767 | } |
| 12768 | } |
| 12769 | |
| 12770 | |
| 12771 | static void alc861vd_auto_init_hp_out(struct hda_codec *codec) |
| 12772 | { |
| 12773 | struct alc_spec *spec = codec->spec; |
| 12774 | hda_nid_t pin; |
| 12775 | |
| 12776 | pin = spec->autocfg.hp_pins[0]; |
| 12777 | if (pin) /* connect to front and use dac 0 */ |
| 12778 | alc861vd_auto_set_output_and_unmute(codec, pin, PIN_HP, 0); |
Takashi Iwai | f6c7e54 | 2008-02-12 18:32:23 +0100 | [diff] [blame] | 12779 | pin = spec->autocfg.speaker_pins[0]; |
| 12780 | if (pin) |
| 12781 | alc861vd_auto_set_output_and_unmute(codec, pin, PIN_OUT, 0); |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 12782 | } |
| 12783 | |
| 12784 | #define alc861vd_is_input_pin(nid) alc880_is_input_pin(nid) |
| 12785 | #define ALC861VD_PIN_CD_NID ALC880_PIN_CD_NID |
| 12786 | |
| 12787 | static void alc861vd_auto_init_analog_input(struct hda_codec *codec) |
| 12788 | { |
| 12789 | struct alc_spec *spec = codec->spec; |
| 12790 | int i; |
| 12791 | |
| 12792 | for (i = 0; i < AUTO_PIN_LAST; i++) { |
| 12793 | hda_nid_t nid = spec->autocfg.input_pins[i]; |
| 12794 | if (alc861vd_is_input_pin(nid)) { |
| 12795 | snd_hda_codec_write(codec, nid, 0, |
| 12796 | AC_VERB_SET_PIN_WIDGET_CONTROL, |
| 12797 | i <= AUTO_PIN_FRONT_MIC ? |
| 12798 | PIN_VREF80 : PIN_IN); |
| 12799 | if (nid != ALC861VD_PIN_CD_NID) |
| 12800 | snd_hda_codec_write(codec, nid, 0, |
| 12801 | AC_VERB_SET_AMP_GAIN_MUTE, |
| 12802 | AMP_OUT_MUTE); |
| 12803 | } |
| 12804 | } |
| 12805 | } |
| 12806 | |
| 12807 | #define alc861vd_idx_to_mixer_vol(nid) ((nid) + 0x02) |
| 12808 | #define alc861vd_idx_to_mixer_switch(nid) ((nid) + 0x0c) |
| 12809 | |
| 12810 | /* add playback controls from the parsed DAC table */ |
| 12811 | /* Based on ALC880 version. But ALC861VD has separate, |
| 12812 | * different NIDs for mute/unmute switch and volume control */ |
| 12813 | static int alc861vd_auto_create_multi_out_ctls(struct alc_spec *spec, |
| 12814 | const struct auto_pin_cfg *cfg) |
| 12815 | { |
| 12816 | char name[32]; |
| 12817 | static const char *chname[4] = {"Front", "Surround", "CLFE", "Side"}; |
| 12818 | hda_nid_t nid_v, nid_s; |
| 12819 | int i, err; |
| 12820 | |
| 12821 | for (i = 0; i < cfg->line_outs; i++) { |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 12822 | if (!spec->multiout.dac_nids[i]) |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 12823 | continue; |
| 12824 | nid_v = alc861vd_idx_to_mixer_vol( |
| 12825 | alc880_dac_to_idx( |
| 12826 | spec->multiout.dac_nids[i])); |
| 12827 | nid_s = alc861vd_idx_to_mixer_switch( |
| 12828 | alc880_dac_to_idx( |
| 12829 | spec->multiout.dac_nids[i])); |
| 12830 | |
| 12831 | if (i == 2) { |
| 12832 | /* Center/LFE */ |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 12833 | err = add_control(spec, ALC_CTL_WIDGET_VOL, |
| 12834 | "Center Playback Volume", |
| 12835 | HDA_COMPOSE_AMP_VAL(nid_v, 1, 0, |
| 12836 | HDA_OUTPUT)); |
| 12837 | if (err < 0) |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 12838 | return err; |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 12839 | err = add_control(spec, ALC_CTL_WIDGET_VOL, |
| 12840 | "LFE Playback Volume", |
| 12841 | HDA_COMPOSE_AMP_VAL(nid_v, 2, 0, |
| 12842 | HDA_OUTPUT)); |
| 12843 | if (err < 0) |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 12844 | return err; |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 12845 | err = add_control(spec, ALC_CTL_BIND_MUTE, |
| 12846 | "Center Playback Switch", |
| 12847 | HDA_COMPOSE_AMP_VAL(nid_s, 1, 2, |
| 12848 | HDA_INPUT)); |
| 12849 | if (err < 0) |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 12850 | return err; |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 12851 | err = add_control(spec, ALC_CTL_BIND_MUTE, |
| 12852 | "LFE Playback Switch", |
| 12853 | HDA_COMPOSE_AMP_VAL(nid_s, 2, 2, |
| 12854 | HDA_INPUT)); |
| 12855 | if (err < 0) |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 12856 | return err; |
| 12857 | } else { |
| 12858 | sprintf(name, "%s Playback Volume", chname[i]); |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 12859 | err = add_control(spec, ALC_CTL_WIDGET_VOL, name, |
| 12860 | HDA_COMPOSE_AMP_VAL(nid_v, 3, 0, |
| 12861 | HDA_OUTPUT)); |
| 12862 | if (err < 0) |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 12863 | return err; |
| 12864 | sprintf(name, "%s Playback Switch", chname[i]); |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 12865 | err = add_control(spec, ALC_CTL_BIND_MUTE, name, |
Kailang Yang | bdd148a | 2007-05-08 15:19:08 +0200 | [diff] [blame] | 12866 | HDA_COMPOSE_AMP_VAL(nid_s, 3, 2, |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 12867 | HDA_INPUT)); |
| 12868 | if (err < 0) |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 12869 | return err; |
| 12870 | } |
| 12871 | } |
| 12872 | return 0; |
| 12873 | } |
| 12874 | |
| 12875 | /* add playback controls for speaker and HP outputs */ |
| 12876 | /* Based on ALC880 version. But ALC861VD has separate, |
| 12877 | * different NIDs for mute/unmute switch and volume control */ |
| 12878 | static int alc861vd_auto_create_extra_out(struct alc_spec *spec, |
| 12879 | hda_nid_t pin, const char *pfx) |
| 12880 | { |
| 12881 | hda_nid_t nid_v, nid_s; |
| 12882 | int err; |
| 12883 | char name[32]; |
| 12884 | |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 12885 | if (!pin) |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 12886 | return 0; |
| 12887 | |
| 12888 | if (alc880_is_fixed_pin(pin)) { |
| 12889 | nid_v = alc880_idx_to_dac(alc880_fixed_pin_idx(pin)); |
| 12890 | /* specify the DAC as the extra output */ |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 12891 | if (!spec->multiout.hp_nid) |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 12892 | spec->multiout.hp_nid = nid_v; |
| 12893 | else |
| 12894 | spec->multiout.extra_out_nid[0] = nid_v; |
| 12895 | /* control HP volume/switch on the output mixer amp */ |
| 12896 | nid_v = alc861vd_idx_to_mixer_vol( |
| 12897 | alc880_fixed_pin_idx(pin)); |
| 12898 | nid_s = alc861vd_idx_to_mixer_switch( |
| 12899 | alc880_fixed_pin_idx(pin)); |
| 12900 | |
| 12901 | sprintf(name, "%s Playback Volume", pfx); |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 12902 | err = add_control(spec, ALC_CTL_WIDGET_VOL, name, |
| 12903 | HDA_COMPOSE_AMP_VAL(nid_v, 3, 0, HDA_OUTPUT)); |
| 12904 | if (err < 0) |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 12905 | return err; |
| 12906 | sprintf(name, "%s Playback Switch", pfx); |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 12907 | err = add_control(spec, ALC_CTL_BIND_MUTE, name, |
| 12908 | HDA_COMPOSE_AMP_VAL(nid_s, 3, 2, HDA_INPUT)); |
| 12909 | if (err < 0) |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 12910 | return err; |
| 12911 | } else if (alc880_is_multi_pin(pin)) { |
| 12912 | /* set manual connection */ |
| 12913 | /* we have only a switch on HP-out PIN */ |
| 12914 | sprintf(name, "%s Playback Switch", pfx); |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 12915 | err = add_control(spec, ALC_CTL_WIDGET_MUTE, name, |
| 12916 | HDA_COMPOSE_AMP_VAL(pin, 3, 0, HDA_OUTPUT)); |
| 12917 | if (err < 0) |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 12918 | return err; |
| 12919 | } |
| 12920 | return 0; |
| 12921 | } |
| 12922 | |
| 12923 | /* parse the BIOS configuration and set up the alc_spec |
| 12924 | * return 1 if successful, 0 if the proper config is not found, |
| 12925 | * or a negative error code |
| 12926 | * Based on ALC880 version - had to change it to override |
| 12927 | * alc880_auto_create_extra_out and alc880_auto_create_multi_out_ctls */ |
| 12928 | static int alc861vd_parse_auto_config(struct hda_codec *codec) |
| 12929 | { |
| 12930 | struct alc_spec *spec = codec->spec; |
| 12931 | int err; |
| 12932 | static hda_nid_t alc861vd_ignore[] = { 0x1d, 0 }; |
| 12933 | |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 12934 | err = snd_hda_parse_pin_def_config(codec, &spec->autocfg, |
| 12935 | alc861vd_ignore); |
| 12936 | if (err < 0) |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 12937 | return err; |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 12938 | if (!spec->autocfg.line_outs) |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 12939 | return 0; /* can't find valid BIOS pin config */ |
| 12940 | |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 12941 | err = alc880_auto_fill_dac_nids(spec, &spec->autocfg); |
| 12942 | if (err < 0) |
| 12943 | return err; |
| 12944 | err = alc861vd_auto_create_multi_out_ctls(spec, &spec->autocfg); |
| 12945 | if (err < 0) |
| 12946 | return err; |
| 12947 | err = alc861vd_auto_create_extra_out(spec, |
| 12948 | spec->autocfg.speaker_pins[0], |
| 12949 | "Speaker"); |
| 12950 | if (err < 0) |
| 12951 | return err; |
| 12952 | err = alc861vd_auto_create_extra_out(spec, |
| 12953 | spec->autocfg.hp_pins[0], |
| 12954 | "Headphone"); |
| 12955 | if (err < 0) |
| 12956 | return err; |
| 12957 | err = alc880_auto_create_analog_input_ctls(spec, &spec->autocfg); |
| 12958 | if (err < 0) |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 12959 | return err; |
| 12960 | |
| 12961 | spec->multiout.max_channels = spec->multiout.num_dacs * 2; |
| 12962 | |
| 12963 | if (spec->autocfg.dig_out_pin) |
| 12964 | spec->multiout.dig_out_nid = ALC861VD_DIGOUT_NID; |
| 12965 | |
| 12966 | if (spec->kctl_alloc) |
| 12967 | spec->mixers[spec->num_mixers++] = spec->kctl_alloc; |
| 12968 | |
| 12969 | spec->init_verbs[spec->num_init_verbs++] |
| 12970 | = alc861vd_volume_init_verbs; |
| 12971 | |
| 12972 | spec->num_mux_defs = 1; |
| 12973 | spec->input_mux = &spec->private_imux; |
| 12974 | |
Takashi Iwai | 776e184 | 2007-08-29 15:07:11 +0200 | [diff] [blame] | 12975 | err = alc_auto_add_mic_boost(codec); |
| 12976 | if (err < 0) |
| 12977 | return err; |
| 12978 | |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 12979 | return 1; |
| 12980 | } |
| 12981 | |
| 12982 | /* additional initialization for auto-configuration model */ |
| 12983 | static void alc861vd_auto_init(struct hda_codec *codec) |
| 12984 | { |
Takashi Iwai | f6c7e54 | 2008-02-12 18:32:23 +0100 | [diff] [blame] | 12985 | struct alc_spec *spec = codec->spec; |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 12986 | alc861vd_auto_init_multi_out(codec); |
| 12987 | alc861vd_auto_init_hp_out(codec); |
| 12988 | alc861vd_auto_init_analog_input(codec); |
Takashi Iwai | f6c7e54 | 2008-02-12 18:32:23 +0100 | [diff] [blame] | 12989 | if (spec->unsol_event) |
| 12990 | alc_sku_automute(codec); |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 12991 | } |
| 12992 | |
| 12993 | static int patch_alc861vd(struct hda_codec *codec) |
| 12994 | { |
| 12995 | struct alc_spec *spec; |
| 12996 | int err, board_config; |
| 12997 | |
| 12998 | spec = kzalloc(sizeof(*spec), GFP_KERNEL); |
| 12999 | if (spec == NULL) |
| 13000 | return -ENOMEM; |
| 13001 | |
| 13002 | codec->spec = spec; |
| 13003 | |
| 13004 | board_config = snd_hda_check_board_config(codec, ALC861VD_MODEL_LAST, |
| 13005 | alc861vd_models, |
| 13006 | alc861vd_cfg_tbl); |
| 13007 | |
| 13008 | if (board_config < 0 || board_config >= ALC861VD_MODEL_LAST) { |
| 13009 | printk(KERN_INFO "hda_codec: Unknown model for ALC660VD/" |
| 13010 | "ALC861VD, trying auto-probe from BIOS...\n"); |
| 13011 | board_config = ALC861VD_AUTO; |
| 13012 | } |
| 13013 | |
| 13014 | if (board_config == ALC861VD_AUTO) { |
| 13015 | /* automatic parse from the BIOS config */ |
| 13016 | err = alc861vd_parse_auto_config(codec); |
| 13017 | if (err < 0) { |
| 13018 | alc_free(codec); |
| 13019 | return err; |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 13020 | } else if (!err) { |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 13021 | printk(KERN_INFO |
| 13022 | "hda_codec: Cannot set up configuration " |
| 13023 | "from BIOS. Using base mode...\n"); |
| 13024 | board_config = ALC861VD_3ST; |
| 13025 | } |
| 13026 | } |
| 13027 | |
| 13028 | if (board_config != ALC861VD_AUTO) |
| 13029 | setup_preset(spec, &alc861vd_presets[board_config]); |
| 13030 | |
| 13031 | spec->stream_name_analog = "ALC861VD Analog"; |
| 13032 | spec->stream_analog_playback = &alc861vd_pcm_analog_playback; |
| 13033 | spec->stream_analog_capture = &alc861vd_pcm_analog_capture; |
| 13034 | |
| 13035 | spec->stream_name_digital = "ALC861VD Digital"; |
| 13036 | spec->stream_digital_playback = &alc861vd_pcm_digital_playback; |
| 13037 | spec->stream_digital_capture = &alc861vd_pcm_digital_capture; |
| 13038 | |
| 13039 | spec->adc_nids = alc861vd_adc_nids; |
| 13040 | spec->num_adc_nids = ARRAY_SIZE(alc861vd_adc_nids); |
Takashi Iwai | e140634 | 2008-02-11 18:32:32 +0100 | [diff] [blame] | 13041 | spec->capsrc_nids = alc861vd_capsrc_nids; |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 13042 | |
| 13043 | spec->mixers[spec->num_mixers] = alc861vd_capture_mixer; |
| 13044 | spec->num_mixers++; |
| 13045 | |
Takashi Iwai | 2134ea4 | 2008-01-10 16:53:55 +0100 | [diff] [blame] | 13046 | spec->vmaster_nid = 0x02; |
| 13047 | |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 13048 | codec->patch_ops = alc_patch_ops; |
| 13049 | |
| 13050 | if (board_config == ALC861VD_AUTO) |
| 13051 | spec->init_hook = alc861vd_auto_init; |
Takashi Iwai | cb53c62 | 2007-08-10 17:21:45 +0200 | [diff] [blame] | 13052 | #ifdef CONFIG_SND_HDA_POWER_SAVE |
| 13053 | if (!spec->loopback.amplist) |
| 13054 | spec->loopback.amplist = alc861vd_loopbacks; |
| 13055 | #endif |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 13056 | |
| 13057 | return 0; |
| 13058 | } |
| 13059 | |
| 13060 | /* |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 13061 | * ALC662 support |
| 13062 | * |
| 13063 | * ALC662 is almost identical with ALC880 but has cleaner and more flexible |
| 13064 | * configuration. Each pin widget can choose any input DACs and a mixer. |
| 13065 | * Each ADC is connected from a mixer of all inputs. This makes possible |
| 13066 | * 6-channel independent captures. |
| 13067 | * |
| 13068 | * In addition, an independent DAC for the multi-playback (not used in this |
| 13069 | * driver yet). |
| 13070 | */ |
| 13071 | #define ALC662_DIGOUT_NID 0x06 |
| 13072 | #define ALC662_DIGIN_NID 0x0a |
| 13073 | |
| 13074 | static hda_nid_t alc662_dac_nids[4] = { |
| 13075 | /* front, rear, clfe, rear_surr */ |
| 13076 | 0x02, 0x03, 0x04 |
| 13077 | }; |
| 13078 | |
| 13079 | static hda_nid_t alc662_adc_nids[1] = { |
| 13080 | /* ADC1-2 */ |
| 13081 | 0x09, |
| 13082 | }; |
Takashi Iwai | e140634 | 2008-02-11 18:32:32 +0100 | [diff] [blame] | 13083 | |
Kailang Yang | 77a261b | 2008-02-19 11:38:05 +0100 | [diff] [blame] | 13084 | static hda_nid_t alc662_capsrc_nids[1] = { 0x22 }; |
Takashi Iwai | e140634 | 2008-02-11 18:32:32 +0100 | [diff] [blame] | 13085 | |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 13086 | /* input MUX */ |
| 13087 | /* FIXME: should be a matrix-type input source selection */ |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 13088 | static struct hda_input_mux alc662_capture_source = { |
| 13089 | .num_items = 4, |
| 13090 | .items = { |
| 13091 | { "Mic", 0x0 }, |
| 13092 | { "Front Mic", 0x1 }, |
| 13093 | { "Line", 0x2 }, |
| 13094 | { "CD", 0x4 }, |
| 13095 | }, |
| 13096 | }; |
| 13097 | |
| 13098 | static struct hda_input_mux alc662_lenovo_101e_capture_source = { |
| 13099 | .num_items = 2, |
| 13100 | .items = { |
| 13101 | { "Mic", 0x1 }, |
| 13102 | { "Line", 0x2 }, |
| 13103 | }, |
| 13104 | }; |
Kailang Yang | 291702f | 2007-10-16 14:28:03 +0200 | [diff] [blame] | 13105 | |
| 13106 | static struct hda_input_mux alc662_eeepc_capture_source = { |
| 13107 | .num_items = 2, |
| 13108 | .items = { |
| 13109 | { "i-Mic", 0x1 }, |
| 13110 | { "e-Mic", 0x0 }, |
| 13111 | }, |
| 13112 | }; |
| 13113 | |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 13114 | #define alc662_mux_enum_info alc_mux_enum_info |
| 13115 | #define alc662_mux_enum_get alc_mux_enum_get |
Takashi Iwai | e140634 | 2008-02-11 18:32:32 +0100 | [diff] [blame] | 13116 | #define alc662_mux_enum_put alc882_mux_enum_put |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 13117 | |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 13118 | /* |
| 13119 | * 2ch mode |
| 13120 | */ |
| 13121 | static struct hda_channel_mode alc662_3ST_2ch_modes[1] = { |
| 13122 | { 2, NULL } |
| 13123 | }; |
| 13124 | |
| 13125 | /* |
| 13126 | * 2ch mode |
| 13127 | */ |
| 13128 | static struct hda_verb alc662_3ST_ch2_init[] = { |
| 13129 | { 0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80 }, |
| 13130 | { 0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE }, |
| 13131 | { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN }, |
| 13132 | { 0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE }, |
| 13133 | { } /* end */ |
| 13134 | }; |
| 13135 | |
| 13136 | /* |
| 13137 | * 6ch mode |
| 13138 | */ |
| 13139 | static struct hda_verb alc662_3ST_ch6_init[] = { |
| 13140 | { 0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, |
| 13141 | { 0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE }, |
| 13142 | { 0x18, AC_VERB_SET_CONNECT_SEL, 0x02 }, |
| 13143 | { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, |
| 13144 | { 0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE }, |
| 13145 | { 0x1a, AC_VERB_SET_CONNECT_SEL, 0x01 }, |
| 13146 | { } /* end */ |
| 13147 | }; |
| 13148 | |
| 13149 | static struct hda_channel_mode alc662_3ST_6ch_modes[2] = { |
| 13150 | { 2, alc662_3ST_ch2_init }, |
| 13151 | { 6, alc662_3ST_ch6_init }, |
| 13152 | }; |
| 13153 | |
| 13154 | /* |
| 13155 | * 2ch mode |
| 13156 | */ |
| 13157 | static struct hda_verb alc662_sixstack_ch6_init[] = { |
| 13158 | { 0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x00 }, |
| 13159 | { 0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x00 }, |
| 13160 | { 0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, |
| 13161 | { } /* end */ |
| 13162 | }; |
| 13163 | |
| 13164 | /* |
| 13165 | * 6ch mode |
| 13166 | */ |
| 13167 | static struct hda_verb alc662_sixstack_ch8_init[] = { |
| 13168 | { 0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, |
| 13169 | { 0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, |
| 13170 | { 0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, |
| 13171 | { } /* end */ |
| 13172 | }; |
| 13173 | |
| 13174 | static struct hda_channel_mode alc662_5stack_modes[2] = { |
| 13175 | { 2, alc662_sixstack_ch6_init }, |
| 13176 | { 6, alc662_sixstack_ch8_init }, |
| 13177 | }; |
| 13178 | |
| 13179 | /* Pin assignment: Front=0x14, Rear=0x15, CLFE=0x16, Side=0x17 |
| 13180 | * Mic=0x18, Front Mic=0x19, Line-In=0x1a, HP=0x1b |
| 13181 | */ |
| 13182 | |
| 13183 | static struct snd_kcontrol_new alc662_base_mixer[] = { |
| 13184 | /* output mixer control */ |
| 13185 | HDA_CODEC_VOLUME("Front Playback Volume", 0x2, 0x0, HDA_OUTPUT), |
Herton Ronaldo Krzesinski | 7055ad8 | 2008-03-14 12:52:20 +0100 | [diff] [blame] | 13186 | HDA_CODEC_MUTE("Front Playback Switch", 0x0c, 0x0, HDA_INPUT), |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 13187 | HDA_CODEC_VOLUME("Surround Playback Volume", 0x3, 0x0, HDA_OUTPUT), |
Herton Ronaldo Krzesinski | 7055ad8 | 2008-03-14 12:52:20 +0100 | [diff] [blame] | 13188 | HDA_CODEC_MUTE("Surround Playback Switch", 0x0d, 0x0, HDA_INPUT), |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 13189 | HDA_CODEC_VOLUME_MONO("Center Playback Volume", 0x04, 1, 0x0, HDA_OUTPUT), |
| 13190 | HDA_CODEC_VOLUME_MONO("LFE Playback Volume", 0x04, 2, 0x0, HDA_OUTPUT), |
Herton Ronaldo Krzesinski | 7055ad8 | 2008-03-14 12:52:20 +0100 | [diff] [blame] | 13191 | HDA_CODEC_MUTE_MONO("Center Playback Switch", 0x0e, 1, 0x0, HDA_INPUT), |
| 13192 | HDA_CODEC_MUTE_MONO("LFE Playback Switch", 0x0e, 2, 0x0, HDA_INPUT), |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 13193 | HDA_CODEC_MUTE("Headphone Playback Switch", 0x1b, 0x0, HDA_OUTPUT), |
| 13194 | |
| 13195 | /*Input mixer control */ |
| 13196 | HDA_CODEC_VOLUME("CD Playback Volume", 0xb, 0x4, HDA_INPUT), |
| 13197 | HDA_CODEC_MUTE("CD Playback Switch", 0xb, 0x4, HDA_INPUT), |
| 13198 | HDA_CODEC_VOLUME("Line Playback Volume", 0xb, 0x02, HDA_INPUT), |
| 13199 | HDA_CODEC_MUTE("Line Playback Switch", 0xb, 0x02, HDA_INPUT), |
| 13200 | HDA_CODEC_VOLUME("Mic Playback Volume", 0xb, 0x0, HDA_INPUT), |
| 13201 | HDA_CODEC_MUTE("Mic Playback Switch", 0xb, 0x0, HDA_INPUT), |
| 13202 | HDA_CODEC_VOLUME("Front Mic Playback Volume", 0xb, 0x01, HDA_INPUT), |
| 13203 | HDA_CODEC_MUTE("Front Mic Playback Switch", 0xb, 0x01, HDA_INPUT), |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 13204 | { } /* end */ |
| 13205 | }; |
| 13206 | |
| 13207 | static struct snd_kcontrol_new alc662_3ST_2ch_mixer[] = { |
| 13208 | HDA_CODEC_VOLUME("Front Playback Volume", 0x02, 0x0, HDA_OUTPUT), |
Herton Ronaldo Krzesinski | 7055ad8 | 2008-03-14 12:52:20 +0100 | [diff] [blame] | 13209 | HDA_CODEC_MUTE("Front Playback Switch", 0x0c, 0x0, HDA_INPUT), |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 13210 | HDA_CODEC_MUTE("Headphone Playback Switch", 0x1b, 0x0, HDA_OUTPUT), |
| 13211 | HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT), |
| 13212 | HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT), |
| 13213 | HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT), |
| 13214 | HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT), |
| 13215 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), |
| 13216 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), |
| 13217 | HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x1, HDA_INPUT), |
| 13218 | HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x1, HDA_INPUT), |
| 13219 | HDA_CODEC_VOLUME("PC Speaker Playback Volume", 0x0b, 0x05, HDA_INPUT), |
| 13220 | HDA_CODEC_MUTE("PC Speaker Playback Switch", 0x0b, 0x05, HDA_INPUT), |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 13221 | { } /* end */ |
| 13222 | }; |
| 13223 | |
| 13224 | static struct snd_kcontrol_new alc662_3ST_6ch_mixer[] = { |
| 13225 | HDA_CODEC_VOLUME("Front Playback Volume", 0x02, 0x0, HDA_OUTPUT), |
Herton Ronaldo Krzesinski | 7055ad8 | 2008-03-14 12:52:20 +0100 | [diff] [blame] | 13226 | HDA_CODEC_MUTE("Front Playback Switch", 0x0c, 0x0, HDA_INPUT), |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 13227 | HDA_CODEC_VOLUME("Surround Playback Volume", 0x03, 0x0, HDA_OUTPUT), |
Herton Ronaldo Krzesinski | 7055ad8 | 2008-03-14 12:52:20 +0100 | [diff] [blame] | 13228 | HDA_CODEC_MUTE("Surround Playback Switch", 0x0d, 0x0, HDA_INPUT), |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 13229 | HDA_CODEC_VOLUME_MONO("Center Playback Volume", 0x04, 1, 0x0, HDA_OUTPUT), |
| 13230 | HDA_CODEC_VOLUME_MONO("LFE Playback Volume", 0x04, 2, 0x0, HDA_OUTPUT), |
Herton Ronaldo Krzesinski | 7055ad8 | 2008-03-14 12:52:20 +0100 | [diff] [blame] | 13231 | HDA_CODEC_MUTE_MONO("Center Playback Switch", 0x0e, 1, 0x0, HDA_INPUT), |
| 13232 | HDA_CODEC_MUTE_MONO("LFE Playback Switch", 0x0e, 2, 0x0, HDA_INPUT), |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 13233 | HDA_CODEC_MUTE("Headphone Playback Switch", 0x1b, 0x0, HDA_OUTPUT), |
| 13234 | HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT), |
| 13235 | HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT), |
| 13236 | HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT), |
| 13237 | HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT), |
| 13238 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), |
| 13239 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), |
| 13240 | HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x1, HDA_INPUT), |
| 13241 | HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x1, HDA_INPUT), |
| 13242 | HDA_CODEC_VOLUME("PC Speaker Playback Volume", 0x0b, 0x05, HDA_INPUT), |
| 13243 | HDA_CODEC_MUTE("PC Speaker Playback Switch", 0x0b, 0x05, HDA_INPUT), |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 13244 | { } /* end */ |
| 13245 | }; |
| 13246 | |
| 13247 | static struct snd_kcontrol_new alc662_lenovo_101e_mixer[] = { |
| 13248 | HDA_CODEC_VOLUME("Front Playback Volume", 0x02, 0x0, HDA_OUTPUT), |
| 13249 | HDA_BIND_MUTE("Front Playback Switch", 0x02, 2, HDA_INPUT), |
Takashi Iwai | 86cd929 | 2008-01-28 18:09:56 +0100 | [diff] [blame] | 13250 | HDA_CODEC_VOLUME("Speaker Playback Volume", 0x03, 0x0, HDA_OUTPUT), |
| 13251 | HDA_BIND_MUTE("Speaker Playback Switch", 0x03, 2, HDA_INPUT), |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 13252 | HDA_CODEC_MUTE("Headphone Playback Switch", 0x1b, 0x0, HDA_OUTPUT), |
| 13253 | HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT), |
| 13254 | HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT), |
| 13255 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x1, HDA_INPUT), |
| 13256 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x1, HDA_INPUT), |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 13257 | { } /* end */ |
| 13258 | }; |
| 13259 | |
Kailang Yang | 291702f | 2007-10-16 14:28:03 +0200 | [diff] [blame] | 13260 | static struct snd_kcontrol_new alc662_eeepc_p701_mixer[] = { |
Takashi Iwai | 86cd929 | 2008-01-28 18:09:56 +0100 | [diff] [blame] | 13261 | HDA_CODEC_MUTE("Speaker Playback Switch", 0x14, 0x0, HDA_OUTPUT), |
Kailang Yang | 291702f | 2007-10-16 14:28:03 +0200 | [diff] [blame] | 13262 | |
Herton Ronaldo Krzesinski | b481849 | 2008-02-23 11:34:12 +0100 | [diff] [blame] | 13263 | HDA_CODEC_VOLUME("Line-Out Playback Volume", 0x02, 0x0, HDA_OUTPUT), |
| 13264 | HDA_CODEC_MUTE("Line-Out Playback Switch", 0x1b, 0x0, HDA_OUTPUT), |
Kailang Yang | 291702f | 2007-10-16 14:28:03 +0200 | [diff] [blame] | 13265 | |
| 13266 | HDA_CODEC_VOLUME("e-Mic Boost", 0x18, 0, HDA_INPUT), |
| 13267 | HDA_CODEC_VOLUME("e-Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), |
| 13268 | HDA_CODEC_MUTE("e-Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), |
| 13269 | |
| 13270 | HDA_CODEC_VOLUME("i-Mic Boost", 0x19, 0, HDA_INPUT), |
| 13271 | HDA_CODEC_VOLUME("i-Mic Playback Volume", 0x0b, 0x1, HDA_INPUT), |
| 13272 | HDA_CODEC_MUTE("i-Mic Playback Switch", 0x0b, 0x1, HDA_INPUT), |
| 13273 | { } /* end */ |
| 13274 | }; |
| 13275 | |
Kailang Yang | 8c42722 | 2008-01-10 13:03:59 +0100 | [diff] [blame] | 13276 | static struct snd_kcontrol_new alc662_eeepc_ep20_mixer[] = { |
Takashi Iwai | 31bffaa | 2008-02-27 16:10:44 +0100 | [diff] [blame] | 13277 | HDA_CODEC_VOLUME("Line-Out Playback Volume", 0x02, 0x0, HDA_OUTPUT), |
| 13278 | HDA_CODEC_MUTE("Line-Out Playback Switch", 0x14, 0x0, HDA_OUTPUT), |
Kailang Yang | 8c42722 | 2008-01-10 13:03:59 +0100 | [diff] [blame] | 13279 | HDA_CODEC_VOLUME("Surround Playback Volume", 0x03, 0x0, HDA_OUTPUT), |
| 13280 | HDA_BIND_MUTE("Surround Playback Switch", 0x03, 2, HDA_INPUT), |
| 13281 | HDA_CODEC_VOLUME_MONO("Center Playback Volume", 0x04, 1, 0x0, HDA_OUTPUT), |
| 13282 | HDA_CODEC_VOLUME_MONO("LFE Playback Volume", 0x04, 2, 0x0, HDA_OUTPUT), |
| 13283 | HDA_BIND_MUTE_MONO("Center Playback Switch", 0x04, 1, 2, HDA_INPUT), |
| 13284 | HDA_BIND_MUTE_MONO("LFE Playback Switch", 0x04, 2, 2, HDA_INPUT), |
Takashi Iwai | 86cd929 | 2008-01-28 18:09:56 +0100 | [diff] [blame] | 13285 | HDA_CODEC_MUTE("Speaker Playback Switch", 0x1b, 0x0, HDA_OUTPUT), |
Kailang Yang | 8c42722 | 2008-01-10 13:03:59 +0100 | [diff] [blame] | 13286 | HDA_BIND_MUTE("MuteCtrl Playback Switch", 0x0c, 2, HDA_INPUT), |
| 13287 | HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT), |
| 13288 | HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT), |
| 13289 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), |
| 13290 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), |
| 13291 | { } /* end */ |
| 13292 | }; |
| 13293 | |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 13294 | static struct snd_kcontrol_new alc662_chmode_mixer[] = { |
| 13295 | { |
| 13296 | .iface = SNDRV_CTL_ELEM_IFACE_MIXER, |
| 13297 | .name = "Channel Mode", |
| 13298 | .info = alc_ch_mode_info, |
| 13299 | .get = alc_ch_mode_get, |
| 13300 | .put = alc_ch_mode_put, |
| 13301 | }, |
| 13302 | { } /* end */ |
| 13303 | }; |
| 13304 | |
| 13305 | static struct hda_verb alc662_init_verbs[] = { |
| 13306 | /* ADC: mute amp left and right */ |
| 13307 | {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 13308 | {0x09, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 13309 | /* Front mixer: unmute input/output amp left and right (volume = 0) */ |
| 13310 | |
Takashi Iwai | cb53c62 | 2007-08-10 17:21:45 +0200 | [diff] [blame] | 13311 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 13312 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
| 13313 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)}, |
| 13314 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)}, |
| 13315 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)}, |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 13316 | |
Kailang Yang | b60dd39 | 2007-09-20 12:50:29 +0200 | [diff] [blame] | 13317 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 13318 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 13319 | {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 13320 | {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 13321 | {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 13322 | {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 13323 | |
| 13324 | /* Front Pin: output 0 (0x0c) */ |
| 13325 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 13326 | {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 13327 | |
| 13328 | /* Rear Pin: output 1 (0x0d) */ |
| 13329 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 13330 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 13331 | |
| 13332 | /* CLFE Pin: output 2 (0x0e) */ |
| 13333 | {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 13334 | {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 13335 | |
| 13336 | /* Mic (rear) pin: input vref at 80% */ |
| 13337 | {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80}, |
| 13338 | {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
| 13339 | /* Front Mic pin: input vref at 80% */ |
| 13340 | {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80}, |
| 13341 | {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
| 13342 | /* Line In pin: input */ |
| 13343 | {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
| 13344 | {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
| 13345 | /* Line-2 In: Headphone output (output 0 - 0x0c) */ |
| 13346 | {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 13347 | {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 13348 | {0x1b, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 13349 | /* CD pin widget for input */ |
| 13350 | {0x1c, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
| 13351 | |
| 13352 | /* FIXME: use matrix-type input source selection */ |
| 13353 | /* Mixer elements: 0x18, 19, 1a, 1b, 1c, 1d, 14, 15, 16, 17, 0b */ |
| 13354 | /* Input mixer */ |
| 13355 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 13356 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 13357 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(2)}, |
| 13358 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(4)}, |
Kailang Yang | 291702f | 2007-10-16 14:28:03 +0200 | [diff] [blame] | 13359 | |
| 13360 | {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 13361 | {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 13362 | {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(2)}, |
| 13363 | {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(4)}, |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 13364 | { } |
| 13365 | }; |
| 13366 | |
| 13367 | static struct hda_verb alc662_sue_init_verbs[] = { |
| 13368 | {0x14, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN|ALC880_FRONT_EVENT}, |
| 13369 | {0x1b, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN|ALC880_HP_EVENT}, |
Kailang Yang | 291702f | 2007-10-16 14:28:03 +0200 | [diff] [blame] | 13370 | {} |
| 13371 | }; |
| 13372 | |
| 13373 | static struct hda_verb alc662_eeepc_sue_init_verbs[] = { |
| 13374 | {0x18, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_MIC_EVENT}, |
| 13375 | {0x1b, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT}, |
| 13376 | {} |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 13377 | }; |
| 13378 | |
Kailang Yang | 8c42722 | 2008-01-10 13:03:59 +0100 | [diff] [blame] | 13379 | /* Set Unsolicited Event*/ |
| 13380 | static struct hda_verb alc662_eeepc_ep20_sue_init_verbs[] = { |
| 13381 | {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 13382 | {0x14, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT}, |
| 13383 | {} |
| 13384 | }; |
| 13385 | |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 13386 | /* |
| 13387 | * generic initialization of ADC, input mixers and output mixers |
| 13388 | */ |
| 13389 | static struct hda_verb alc662_auto_init_verbs[] = { |
| 13390 | /* |
| 13391 | * Unmute ADC and set the default input to mic-in |
| 13392 | */ |
| 13393 | {0x09, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 13394 | {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 13395 | |
| 13396 | /* Unmute input amps (CD, Line In, Mic 1 & Mic 2) of the analog-loopback |
| 13397 | * mixer widget |
| 13398 | * Note: PASD motherboards uses the Line In 2 as the input for front |
| 13399 | * panel mic (mic 2) |
| 13400 | */ |
| 13401 | /* Amp Indices: Mic1 = 0, Mic2 = 1, Line1 = 2, Line2 = 3, CD = 4 */ |
Takashi Iwai | cb53c62 | 2007-08-10 17:21:45 +0200 | [diff] [blame] | 13402 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 13403 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
| 13404 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)}, |
| 13405 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)}, |
| 13406 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)}, |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 13407 | |
| 13408 | /* |
| 13409 | * Set up output mixers (0x0c - 0x0f) |
| 13410 | */ |
| 13411 | /* set vol=0 to output mixers */ |
| 13412 | {0x02, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 13413 | {0x03, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 13414 | {0x04, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 13415 | |
| 13416 | /* set up input amps for analog loopback */ |
| 13417 | /* Amp Indices: DAC = 0, mixer = 1 */ |
Kailang Yang | b60dd39 | 2007-09-20 12:50:29 +0200 | [diff] [blame] | 13418 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 13419 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 13420 | {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 13421 | {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 13422 | {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 13423 | {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 13424 | |
| 13425 | |
| 13426 | /* FIXME: use matrix-type input source selection */ |
| 13427 | /* Mixer elements: 0x18, 19, 1a, 1b, 1c, 1d, 14, 15, 16, 17, 0b */ |
| 13428 | /* Input mixer */ |
| 13429 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
Kailang Yang | d1a991a | 2007-08-15 16:21:59 +0200 | [diff] [blame] | 13430 | {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 13431 | { } |
| 13432 | }; |
| 13433 | |
| 13434 | /* capture mixer elements */ |
| 13435 | static struct snd_kcontrol_new alc662_capture_mixer[] = { |
| 13436 | HDA_CODEC_VOLUME("Capture Volume", 0x09, 0x0, HDA_INPUT), |
| 13437 | HDA_CODEC_MUTE("Capture Switch", 0x09, 0x0, HDA_INPUT), |
| 13438 | { |
| 13439 | .iface = SNDRV_CTL_ELEM_IFACE_MIXER, |
| 13440 | /* The multiple "Capture Source" controls confuse alsamixer |
| 13441 | * So call somewhat different.. |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 13442 | */ |
| 13443 | /* .name = "Capture Source", */ |
| 13444 | .name = "Input Source", |
| 13445 | .count = 1, |
Herton Ronaldo Krzesinski | 6e7939b | 2007-12-19 17:49:02 +0100 | [diff] [blame] | 13446 | .info = alc662_mux_enum_info, |
| 13447 | .get = alc662_mux_enum_get, |
| 13448 | .put = alc662_mux_enum_put, |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 13449 | }, |
| 13450 | { } /* end */ |
| 13451 | }; |
| 13452 | |
| 13453 | static void alc662_lenovo_101e_ispeaker_automute(struct hda_codec *codec) |
| 13454 | { |
| 13455 | unsigned int present; |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 13456 | unsigned char bits; |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 13457 | |
| 13458 | present = snd_hda_codec_read(codec, 0x14, 0, |
| 13459 | AC_VERB_GET_PIN_SENSE, 0) & 0x80000000; |
Takashi Iwai | 47fd830 | 2007-08-10 17:11:07 +0200 | [diff] [blame] | 13460 | bits = present ? HDA_AMP_MUTE : 0; |
| 13461 | snd_hda_codec_amp_stereo(codec, 0x15, HDA_OUTPUT, 0, |
| 13462 | HDA_AMP_MUTE, bits); |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 13463 | } |
| 13464 | |
| 13465 | static void alc662_lenovo_101e_all_automute(struct hda_codec *codec) |
| 13466 | { |
| 13467 | unsigned int present; |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 13468 | unsigned char bits; |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 13469 | |
| 13470 | present = snd_hda_codec_read(codec, 0x1b, 0, |
| 13471 | AC_VERB_GET_PIN_SENSE, 0) & 0x80000000; |
Takashi Iwai | 47fd830 | 2007-08-10 17:11:07 +0200 | [diff] [blame] | 13472 | bits = present ? HDA_AMP_MUTE : 0; |
| 13473 | snd_hda_codec_amp_stereo(codec, 0x15, HDA_OUTPUT, 0, |
| 13474 | HDA_AMP_MUTE, bits); |
| 13475 | snd_hda_codec_amp_stereo(codec, 0x14, HDA_OUTPUT, 0, |
| 13476 | HDA_AMP_MUTE, bits); |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 13477 | } |
| 13478 | |
| 13479 | static void alc662_lenovo_101e_unsol_event(struct hda_codec *codec, |
| 13480 | unsigned int res) |
| 13481 | { |
| 13482 | if ((res >> 26) == ALC880_HP_EVENT) |
| 13483 | alc662_lenovo_101e_all_automute(codec); |
| 13484 | if ((res >> 26) == ALC880_FRONT_EVENT) |
| 13485 | alc662_lenovo_101e_ispeaker_automute(codec); |
| 13486 | } |
| 13487 | |
Kailang Yang | 291702f | 2007-10-16 14:28:03 +0200 | [diff] [blame] | 13488 | static void alc662_eeepc_mic_automute(struct hda_codec *codec) |
| 13489 | { |
| 13490 | unsigned int present; |
| 13491 | |
| 13492 | present = snd_hda_codec_read(codec, 0x18, 0, |
| 13493 | AC_VERB_GET_PIN_SENSE, 0) & 0x80000000; |
| 13494 | snd_hda_codec_write(codec, 0x22, 0, AC_VERB_SET_AMP_GAIN_MUTE, |
| 13495 | 0x7000 | (0x00 << 8) | (present ? 0 : 0x80)); |
| 13496 | snd_hda_codec_write(codec, 0x23, 0, AC_VERB_SET_AMP_GAIN_MUTE, |
| 13497 | 0x7000 | (0x00 << 8) | (present ? 0 : 0x80)); |
| 13498 | snd_hda_codec_write(codec, 0x22, 0, AC_VERB_SET_AMP_GAIN_MUTE, |
| 13499 | 0x7000 | (0x01 << 8) | (present ? 0x80 : 0)); |
| 13500 | snd_hda_codec_write(codec, 0x23, 0, AC_VERB_SET_AMP_GAIN_MUTE, |
| 13501 | 0x7000 | (0x01 << 8) | (present ? 0x80 : 0)); |
| 13502 | } |
| 13503 | |
| 13504 | /* unsolicited event for HP jack sensing */ |
| 13505 | static void alc662_eeepc_unsol_event(struct hda_codec *codec, |
| 13506 | unsigned int res) |
| 13507 | { |
| 13508 | if ((res >> 26) == ALC880_HP_EVENT) |
| 13509 | alc262_hippo1_automute( codec ); |
| 13510 | |
| 13511 | if ((res >> 26) == ALC880_MIC_EVENT) |
| 13512 | alc662_eeepc_mic_automute(codec); |
| 13513 | } |
| 13514 | |
| 13515 | static void alc662_eeepc_inithook(struct hda_codec *codec) |
| 13516 | { |
| 13517 | alc262_hippo1_automute( codec ); |
| 13518 | alc662_eeepc_mic_automute(codec); |
| 13519 | } |
| 13520 | |
Kailang Yang | 8c42722 | 2008-01-10 13:03:59 +0100 | [diff] [blame] | 13521 | static void alc662_eeepc_ep20_automute(struct hda_codec *codec) |
| 13522 | { |
| 13523 | unsigned int mute; |
| 13524 | unsigned int present; |
| 13525 | |
| 13526 | snd_hda_codec_read(codec, 0x14, 0, AC_VERB_SET_PIN_SENSE, 0); |
| 13527 | present = snd_hda_codec_read(codec, 0x14, 0, |
| 13528 | AC_VERB_GET_PIN_SENSE, 0); |
| 13529 | present = (present & 0x80000000) != 0; |
| 13530 | if (present) { |
| 13531 | /* mute internal speaker */ |
| 13532 | snd_hda_codec_amp_stereo(codec, 0x1b, HDA_OUTPUT, 0, |
| 13533 | HDA_AMP_MUTE, HDA_AMP_MUTE); |
| 13534 | } else { |
| 13535 | /* unmute internal speaker if necessary */ |
| 13536 | mute = snd_hda_codec_amp_read(codec, 0x14, 0, HDA_OUTPUT, 0); |
| 13537 | snd_hda_codec_amp_stereo(codec, 0x1b, HDA_OUTPUT, 0, |
| 13538 | HDA_AMP_MUTE, mute); |
| 13539 | } |
| 13540 | } |
| 13541 | |
| 13542 | /* unsolicited event for HP jack sensing */ |
| 13543 | static void alc662_eeepc_ep20_unsol_event(struct hda_codec *codec, |
| 13544 | unsigned int res) |
| 13545 | { |
| 13546 | if ((res >> 26) == ALC880_HP_EVENT) |
| 13547 | alc662_eeepc_ep20_automute(codec); |
| 13548 | } |
| 13549 | |
| 13550 | static void alc662_eeepc_ep20_inithook(struct hda_codec *codec) |
| 13551 | { |
| 13552 | alc662_eeepc_ep20_automute(codec); |
| 13553 | } |
| 13554 | |
Takashi Iwai | cb53c62 | 2007-08-10 17:21:45 +0200 | [diff] [blame] | 13555 | #ifdef CONFIG_SND_HDA_POWER_SAVE |
| 13556 | #define alc662_loopbacks alc880_loopbacks |
| 13557 | #endif |
| 13558 | |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 13559 | |
| 13560 | /* pcm configuration: identiacal with ALC880 */ |
| 13561 | #define alc662_pcm_analog_playback alc880_pcm_analog_playback |
| 13562 | #define alc662_pcm_analog_capture alc880_pcm_analog_capture |
| 13563 | #define alc662_pcm_digital_playback alc880_pcm_digital_playback |
| 13564 | #define alc662_pcm_digital_capture alc880_pcm_digital_capture |
| 13565 | |
| 13566 | /* |
| 13567 | * configuration and preset |
| 13568 | */ |
| 13569 | static const char *alc662_models[ALC662_MODEL_LAST] = { |
| 13570 | [ALC662_3ST_2ch_DIG] = "3stack-dig", |
| 13571 | [ALC662_3ST_6ch_DIG] = "3stack-6ch-dig", |
| 13572 | [ALC662_3ST_6ch] = "3stack-6ch", |
| 13573 | [ALC662_5ST_DIG] = "6stack-dig", |
| 13574 | [ALC662_LENOVO_101E] = "lenovo-101e", |
Takashi Iwai | b995d76 | 2007-10-17 10:41:06 +0200 | [diff] [blame] | 13575 | [ALC662_ASUS_EEEPC_P701] = "eeepc-p701", |
Kailang Yang | 8c42722 | 2008-01-10 13:03:59 +0100 | [diff] [blame] | 13576 | [ALC662_ASUS_EEEPC_EP20] = "eeepc-ep20", |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 13577 | [ALC662_AUTO] = "auto", |
| 13578 | }; |
| 13579 | |
| 13580 | static struct snd_pci_quirk alc662_cfg_tbl[] = { |
Herton Ronaldo Krzesinski | 3da23ca | 2008-03-14 12:52:59 +0100 | [diff] [blame] | 13581 | SND_PCI_QUIRK(0x1043, 0x8290, "ASUS P5GC-MX", ALC662_3ST_6ch_DIG), |
Kailang Yang | 291702f | 2007-10-16 14:28:03 +0200 | [diff] [blame] | 13582 | SND_PCI_QUIRK(0x1043, 0x82a1, "ASUS Eeepc", ALC662_ASUS_EEEPC_P701), |
Kailang Yang | 8c42722 | 2008-01-10 13:03:59 +0100 | [diff] [blame] | 13583 | SND_PCI_QUIRK(0x1043, 0x82d1, "ASUS Eeepc EP20", ALC662_ASUS_EEEPC_EP20), |
Takashi Iwai | ac3e374 | 2007-12-17 17:14:18 +0100 | [diff] [blame] | 13584 | SND_PCI_QUIRK(0x17aa, 0x101e, "Lenovo", ALC662_LENOVO_101E), |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 13585 | {} |
| 13586 | }; |
| 13587 | |
| 13588 | static struct alc_config_preset alc662_presets[] = { |
| 13589 | [ALC662_3ST_2ch_DIG] = { |
Kailang Yang | 291702f | 2007-10-16 14:28:03 +0200 | [diff] [blame] | 13590 | .mixers = { alc662_3ST_2ch_mixer, alc662_capture_mixer }, |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 13591 | .init_verbs = { alc662_init_verbs }, |
| 13592 | .num_dacs = ARRAY_SIZE(alc662_dac_nids), |
| 13593 | .dac_nids = alc662_dac_nids, |
| 13594 | .dig_out_nid = ALC662_DIGOUT_NID, |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 13595 | .dig_in_nid = ALC662_DIGIN_NID, |
| 13596 | .num_channel_mode = ARRAY_SIZE(alc662_3ST_2ch_modes), |
| 13597 | .channel_mode = alc662_3ST_2ch_modes, |
| 13598 | .input_mux = &alc662_capture_source, |
| 13599 | }, |
| 13600 | [ALC662_3ST_6ch_DIG] = { |
Kailang Yang | 291702f | 2007-10-16 14:28:03 +0200 | [diff] [blame] | 13601 | .mixers = { alc662_3ST_6ch_mixer, alc662_chmode_mixer, |
| 13602 | alc662_capture_mixer }, |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 13603 | .init_verbs = { alc662_init_verbs }, |
| 13604 | .num_dacs = ARRAY_SIZE(alc662_dac_nids), |
| 13605 | .dac_nids = alc662_dac_nids, |
| 13606 | .dig_out_nid = ALC662_DIGOUT_NID, |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 13607 | .dig_in_nid = ALC662_DIGIN_NID, |
| 13608 | .num_channel_mode = ARRAY_SIZE(alc662_3ST_6ch_modes), |
| 13609 | .channel_mode = alc662_3ST_6ch_modes, |
| 13610 | .need_dac_fix = 1, |
| 13611 | .input_mux = &alc662_capture_source, |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 13612 | }, |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 13613 | [ALC662_3ST_6ch] = { |
Kailang Yang | 291702f | 2007-10-16 14:28:03 +0200 | [diff] [blame] | 13614 | .mixers = { alc662_3ST_6ch_mixer, alc662_chmode_mixer, |
| 13615 | alc662_capture_mixer }, |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 13616 | .init_verbs = { alc662_init_verbs }, |
| 13617 | .num_dacs = ARRAY_SIZE(alc662_dac_nids), |
| 13618 | .dac_nids = alc662_dac_nids, |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 13619 | .num_channel_mode = ARRAY_SIZE(alc662_3ST_6ch_modes), |
| 13620 | .channel_mode = alc662_3ST_6ch_modes, |
| 13621 | .need_dac_fix = 1, |
| 13622 | .input_mux = &alc662_capture_source, |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 13623 | }, |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 13624 | [ALC662_5ST_DIG] = { |
Kailang Yang | 291702f | 2007-10-16 14:28:03 +0200 | [diff] [blame] | 13625 | .mixers = { alc662_base_mixer, alc662_chmode_mixer, |
| 13626 | alc662_capture_mixer }, |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 13627 | .init_verbs = { alc662_init_verbs }, |
| 13628 | .num_dacs = ARRAY_SIZE(alc662_dac_nids), |
| 13629 | .dac_nids = alc662_dac_nids, |
| 13630 | .dig_out_nid = ALC662_DIGOUT_NID, |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 13631 | .dig_in_nid = ALC662_DIGIN_NID, |
| 13632 | .num_channel_mode = ARRAY_SIZE(alc662_5stack_modes), |
| 13633 | .channel_mode = alc662_5stack_modes, |
| 13634 | .input_mux = &alc662_capture_source, |
| 13635 | }, |
| 13636 | [ALC662_LENOVO_101E] = { |
Kailang Yang | 291702f | 2007-10-16 14:28:03 +0200 | [diff] [blame] | 13637 | .mixers = { alc662_lenovo_101e_mixer, alc662_capture_mixer }, |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 13638 | .init_verbs = { alc662_init_verbs, alc662_sue_init_verbs }, |
| 13639 | .num_dacs = ARRAY_SIZE(alc662_dac_nids), |
| 13640 | .dac_nids = alc662_dac_nids, |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 13641 | .num_channel_mode = ARRAY_SIZE(alc662_3ST_2ch_modes), |
| 13642 | .channel_mode = alc662_3ST_2ch_modes, |
| 13643 | .input_mux = &alc662_lenovo_101e_capture_source, |
| 13644 | .unsol_event = alc662_lenovo_101e_unsol_event, |
| 13645 | .init_hook = alc662_lenovo_101e_all_automute, |
| 13646 | }, |
Kailang Yang | 291702f | 2007-10-16 14:28:03 +0200 | [diff] [blame] | 13647 | [ALC662_ASUS_EEEPC_P701] = { |
| 13648 | .mixers = { alc662_eeepc_p701_mixer, alc662_capture_mixer }, |
| 13649 | .init_verbs = { alc662_init_verbs, |
| 13650 | alc662_eeepc_sue_init_verbs }, |
| 13651 | .num_dacs = ARRAY_SIZE(alc662_dac_nids), |
| 13652 | .dac_nids = alc662_dac_nids, |
Kailang Yang | 291702f | 2007-10-16 14:28:03 +0200 | [diff] [blame] | 13653 | .num_channel_mode = ARRAY_SIZE(alc662_3ST_2ch_modes), |
| 13654 | .channel_mode = alc662_3ST_2ch_modes, |
| 13655 | .input_mux = &alc662_eeepc_capture_source, |
| 13656 | .unsol_event = alc662_eeepc_unsol_event, |
| 13657 | .init_hook = alc662_eeepc_inithook, |
| 13658 | }, |
Kailang Yang | 8c42722 | 2008-01-10 13:03:59 +0100 | [diff] [blame] | 13659 | [ALC662_ASUS_EEEPC_EP20] = { |
| 13660 | .mixers = { alc662_eeepc_ep20_mixer, alc662_capture_mixer, |
| 13661 | alc662_chmode_mixer }, |
| 13662 | .init_verbs = { alc662_init_verbs, |
| 13663 | alc662_eeepc_ep20_sue_init_verbs }, |
| 13664 | .num_dacs = ARRAY_SIZE(alc662_dac_nids), |
| 13665 | .dac_nids = alc662_dac_nids, |
Kailang Yang | 8c42722 | 2008-01-10 13:03:59 +0100 | [diff] [blame] | 13666 | .num_channel_mode = ARRAY_SIZE(alc662_3ST_6ch_modes), |
| 13667 | .channel_mode = alc662_3ST_6ch_modes, |
| 13668 | .input_mux = &alc662_lenovo_101e_capture_source, |
| 13669 | .unsol_event = alc662_eeepc_ep20_unsol_event, |
| 13670 | .init_hook = alc662_eeepc_ep20_inithook, |
| 13671 | }, |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 13672 | |
| 13673 | }; |
| 13674 | |
| 13675 | |
| 13676 | /* |
| 13677 | * BIOS auto configuration |
| 13678 | */ |
| 13679 | |
| 13680 | /* add playback controls from the parsed DAC table */ |
| 13681 | static int alc662_auto_create_multi_out_ctls(struct alc_spec *spec, |
| 13682 | const struct auto_pin_cfg *cfg) |
| 13683 | { |
| 13684 | char name[32]; |
| 13685 | static const char *chname[4] = { |
| 13686 | "Front", "Surround", NULL /*CLFE*/, "Side" |
| 13687 | }; |
| 13688 | hda_nid_t nid; |
| 13689 | int i, err; |
| 13690 | |
| 13691 | for (i = 0; i < cfg->line_outs; i++) { |
| 13692 | if (!spec->multiout.dac_nids[i]) |
| 13693 | continue; |
Kailang Yang | b60dd39 | 2007-09-20 12:50:29 +0200 | [diff] [blame] | 13694 | nid = alc880_idx_to_dac(i); |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 13695 | if (i == 2) { |
| 13696 | /* Center/LFE */ |
| 13697 | err = add_control(spec, ALC_CTL_WIDGET_VOL, |
| 13698 | "Center Playback Volume", |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 13699 | HDA_COMPOSE_AMP_VAL(nid, 1, 0, |
| 13700 | HDA_OUTPUT)); |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 13701 | if (err < 0) |
| 13702 | return err; |
| 13703 | err = add_control(spec, ALC_CTL_WIDGET_VOL, |
| 13704 | "LFE Playback Volume", |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 13705 | HDA_COMPOSE_AMP_VAL(nid, 2, 0, |
| 13706 | HDA_OUTPUT)); |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 13707 | if (err < 0) |
| 13708 | return err; |
| 13709 | err = add_control(spec, ALC_CTL_BIND_MUTE, |
| 13710 | "Center Playback Switch", |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 13711 | HDA_COMPOSE_AMP_VAL(nid, 1, 2, |
| 13712 | HDA_INPUT)); |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 13713 | if (err < 0) |
| 13714 | return err; |
| 13715 | err = add_control(spec, ALC_CTL_BIND_MUTE, |
| 13716 | "LFE Playback Switch", |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 13717 | HDA_COMPOSE_AMP_VAL(nid, 2, 2, |
| 13718 | HDA_INPUT)); |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 13719 | if (err < 0) |
| 13720 | return err; |
| 13721 | } else { |
| 13722 | sprintf(name, "%s Playback Volume", chname[i]); |
| 13723 | err = add_control(spec, ALC_CTL_WIDGET_VOL, name, |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 13724 | HDA_COMPOSE_AMP_VAL(nid, 3, 0, |
| 13725 | HDA_OUTPUT)); |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 13726 | if (err < 0) |
| 13727 | return err; |
| 13728 | sprintf(name, "%s Playback Switch", chname[i]); |
| 13729 | err = add_control(spec, ALC_CTL_BIND_MUTE, name, |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 13730 | HDA_COMPOSE_AMP_VAL(nid, 3, 2, |
| 13731 | HDA_INPUT)); |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 13732 | if (err < 0) |
| 13733 | return err; |
| 13734 | } |
| 13735 | } |
| 13736 | return 0; |
| 13737 | } |
| 13738 | |
| 13739 | /* add playback controls for speaker and HP outputs */ |
| 13740 | static int alc662_auto_create_extra_out(struct alc_spec *spec, hda_nid_t pin, |
| 13741 | const char *pfx) |
| 13742 | { |
| 13743 | hda_nid_t nid; |
| 13744 | int err; |
| 13745 | char name[32]; |
| 13746 | |
| 13747 | if (!pin) |
| 13748 | return 0; |
| 13749 | |
| 13750 | if (alc880_is_fixed_pin(pin)) { |
| 13751 | nid = alc880_idx_to_dac(alc880_fixed_pin_idx(pin)); |
| 13752 | /* printk("DAC nid=%x\n",nid); */ |
| 13753 | /* specify the DAC as the extra output */ |
| 13754 | if (!spec->multiout.hp_nid) |
| 13755 | spec->multiout.hp_nid = nid; |
| 13756 | else |
| 13757 | spec->multiout.extra_out_nid[0] = nid; |
| 13758 | /* control HP volume/switch on the output mixer amp */ |
| 13759 | nid = alc880_idx_to_dac(alc880_fixed_pin_idx(pin)); |
| 13760 | sprintf(name, "%s Playback Volume", pfx); |
| 13761 | err = add_control(spec, ALC_CTL_WIDGET_VOL, name, |
| 13762 | HDA_COMPOSE_AMP_VAL(nid, 3, 0, HDA_OUTPUT)); |
| 13763 | if (err < 0) |
| 13764 | return err; |
| 13765 | sprintf(name, "%s Playback Switch", pfx); |
| 13766 | err = add_control(spec, ALC_CTL_BIND_MUTE, name, |
| 13767 | HDA_COMPOSE_AMP_VAL(nid, 3, 2, HDA_INPUT)); |
| 13768 | if (err < 0) |
| 13769 | return err; |
| 13770 | } else if (alc880_is_multi_pin(pin)) { |
| 13771 | /* set manual connection */ |
| 13772 | /* we have only a switch on HP-out PIN */ |
| 13773 | sprintf(name, "%s Playback Switch", pfx); |
| 13774 | err = add_control(spec, ALC_CTL_WIDGET_MUTE, name, |
| 13775 | HDA_COMPOSE_AMP_VAL(pin, 3, 0, HDA_OUTPUT)); |
| 13776 | if (err < 0) |
| 13777 | return err; |
| 13778 | } |
| 13779 | return 0; |
| 13780 | } |
| 13781 | |
| 13782 | /* create playback/capture controls for input pins */ |
| 13783 | static int alc662_auto_create_analog_input_ctls(struct alc_spec *spec, |
| 13784 | const struct auto_pin_cfg *cfg) |
| 13785 | { |
| 13786 | struct hda_input_mux *imux = &spec->private_imux; |
| 13787 | int i, err, idx; |
| 13788 | |
| 13789 | for (i = 0; i < AUTO_PIN_LAST; i++) { |
| 13790 | if (alc880_is_input_pin(cfg->input_pins[i])) { |
| 13791 | idx = alc880_input_pin_idx(cfg->input_pins[i]); |
| 13792 | err = new_analog_input(spec, cfg->input_pins[i], |
| 13793 | auto_pin_cfg_labels[i], |
| 13794 | idx, 0x0b); |
| 13795 | if (err < 0) |
| 13796 | return err; |
| 13797 | imux->items[imux->num_items].label = |
| 13798 | auto_pin_cfg_labels[i]; |
| 13799 | imux->items[imux->num_items].index = |
| 13800 | alc880_input_pin_idx(cfg->input_pins[i]); |
| 13801 | imux->num_items++; |
| 13802 | } |
| 13803 | } |
| 13804 | return 0; |
| 13805 | } |
| 13806 | |
| 13807 | static void alc662_auto_set_output_and_unmute(struct hda_codec *codec, |
| 13808 | hda_nid_t nid, int pin_type, |
| 13809 | int dac_idx) |
| 13810 | { |
Takashi Iwai | f6c7e54 | 2008-02-12 18:32:23 +0100 | [diff] [blame] | 13811 | alc_set_pin_output(codec, nid, pin_type); |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 13812 | /* need the manual connection? */ |
| 13813 | if (alc880_is_multi_pin(nid)) { |
| 13814 | struct alc_spec *spec = codec->spec; |
| 13815 | int idx = alc880_multi_pin_idx(nid); |
| 13816 | snd_hda_codec_write(codec, alc880_idx_to_selector(idx), 0, |
| 13817 | AC_VERB_SET_CONNECT_SEL, |
| 13818 | alc880_dac_to_idx(spec->multiout.dac_nids[dac_idx])); |
| 13819 | } |
| 13820 | } |
| 13821 | |
| 13822 | static void alc662_auto_init_multi_out(struct hda_codec *codec) |
| 13823 | { |
| 13824 | struct alc_spec *spec = codec->spec; |
| 13825 | int i; |
| 13826 | |
Kailang Yang | 8c42722 | 2008-01-10 13:03:59 +0100 | [diff] [blame] | 13827 | alc_subsystem_id(codec, 0x15, 0x1b, 0x14); |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 13828 | for (i = 0; i <= HDA_SIDE; i++) { |
| 13829 | hda_nid_t nid = spec->autocfg.line_out_pins[i]; |
Takashi Iwai | baba8ee | 2007-04-23 17:17:48 +0200 | [diff] [blame] | 13830 | int pin_type = get_pin_type(spec->autocfg.line_out_type); |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 13831 | if (nid) |
Takashi Iwai | baba8ee | 2007-04-23 17:17:48 +0200 | [diff] [blame] | 13832 | alc662_auto_set_output_and_unmute(codec, nid, pin_type, |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 13833 | i); |
| 13834 | } |
| 13835 | } |
| 13836 | |
| 13837 | static void alc662_auto_init_hp_out(struct hda_codec *codec) |
| 13838 | { |
| 13839 | struct alc_spec *spec = codec->spec; |
| 13840 | hda_nid_t pin; |
| 13841 | |
| 13842 | pin = spec->autocfg.hp_pins[0]; |
| 13843 | if (pin) /* connect to front */ |
| 13844 | /* use dac 0 */ |
| 13845 | alc662_auto_set_output_and_unmute(codec, pin, PIN_HP, 0); |
Takashi Iwai | f6c7e54 | 2008-02-12 18:32:23 +0100 | [diff] [blame] | 13846 | pin = spec->autocfg.speaker_pins[0]; |
| 13847 | if (pin) |
| 13848 | alc662_auto_set_output_and_unmute(codec, pin, PIN_OUT, 0); |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 13849 | } |
| 13850 | |
| 13851 | #define alc662_is_input_pin(nid) alc880_is_input_pin(nid) |
| 13852 | #define ALC662_PIN_CD_NID ALC880_PIN_CD_NID |
| 13853 | |
| 13854 | static void alc662_auto_init_analog_input(struct hda_codec *codec) |
| 13855 | { |
| 13856 | struct alc_spec *spec = codec->spec; |
| 13857 | int i; |
| 13858 | |
| 13859 | for (i = 0; i < AUTO_PIN_LAST; i++) { |
| 13860 | hda_nid_t nid = spec->autocfg.input_pins[i]; |
| 13861 | if (alc662_is_input_pin(nid)) { |
| 13862 | snd_hda_codec_write(codec, nid, 0, |
| 13863 | AC_VERB_SET_PIN_WIDGET_CONTROL, |
| 13864 | (i <= AUTO_PIN_FRONT_MIC ? |
| 13865 | PIN_VREF80 : PIN_IN)); |
| 13866 | if (nid != ALC662_PIN_CD_NID) |
| 13867 | snd_hda_codec_write(codec, nid, 0, |
| 13868 | AC_VERB_SET_AMP_GAIN_MUTE, |
| 13869 | AMP_OUT_MUTE); |
| 13870 | } |
| 13871 | } |
| 13872 | } |
| 13873 | |
| 13874 | static int alc662_parse_auto_config(struct hda_codec *codec) |
| 13875 | { |
| 13876 | struct alc_spec *spec = codec->spec; |
| 13877 | int err; |
| 13878 | static hda_nid_t alc662_ignore[] = { 0x1d, 0 }; |
| 13879 | |
| 13880 | err = snd_hda_parse_pin_def_config(codec, &spec->autocfg, |
| 13881 | alc662_ignore); |
| 13882 | if (err < 0) |
| 13883 | return err; |
| 13884 | if (!spec->autocfg.line_outs) |
| 13885 | return 0; /* can't find valid BIOS pin config */ |
| 13886 | |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 13887 | err = alc880_auto_fill_dac_nids(spec, &spec->autocfg); |
| 13888 | if (err < 0) |
| 13889 | return err; |
| 13890 | err = alc662_auto_create_multi_out_ctls(spec, &spec->autocfg); |
| 13891 | if (err < 0) |
| 13892 | return err; |
| 13893 | err = alc662_auto_create_extra_out(spec, |
| 13894 | spec->autocfg.speaker_pins[0], |
| 13895 | "Speaker"); |
| 13896 | if (err < 0) |
| 13897 | return err; |
| 13898 | err = alc662_auto_create_extra_out(spec, spec->autocfg.hp_pins[0], |
| 13899 | "Headphone"); |
| 13900 | if (err < 0) |
| 13901 | return err; |
| 13902 | err = alc662_auto_create_analog_input_ctls(spec, &spec->autocfg); |
| 13903 | if (err < 0) |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 13904 | return err; |
| 13905 | |
| 13906 | spec->multiout.max_channels = spec->multiout.num_dacs * 2; |
| 13907 | |
| 13908 | if (spec->autocfg.dig_out_pin) |
| 13909 | spec->multiout.dig_out_nid = ALC880_DIGOUT_NID; |
| 13910 | |
| 13911 | if (spec->kctl_alloc) |
| 13912 | spec->mixers[spec->num_mixers++] = spec->kctl_alloc; |
| 13913 | |
| 13914 | spec->num_mux_defs = 1; |
| 13915 | spec->input_mux = &spec->private_imux; |
| 13916 | |
Takashi Iwai | 8c87286f | 2007-06-19 12:11:16 +0200 | [diff] [blame] | 13917 | spec->init_verbs[spec->num_init_verbs++] = alc662_auto_init_verbs; |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 13918 | spec->mixers[spec->num_mixers] = alc662_capture_mixer; |
| 13919 | spec->num_mixers++; |
Takashi Iwai | 8c87286f | 2007-06-19 12:11:16 +0200 | [diff] [blame] | 13920 | return 1; |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 13921 | } |
| 13922 | |
| 13923 | /* additional initialization for auto-configuration model */ |
| 13924 | static void alc662_auto_init(struct hda_codec *codec) |
| 13925 | { |
Takashi Iwai | f6c7e54 | 2008-02-12 18:32:23 +0100 | [diff] [blame] | 13926 | struct alc_spec *spec = codec->spec; |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 13927 | alc662_auto_init_multi_out(codec); |
| 13928 | alc662_auto_init_hp_out(codec); |
| 13929 | alc662_auto_init_analog_input(codec); |
Takashi Iwai | f6c7e54 | 2008-02-12 18:32:23 +0100 | [diff] [blame] | 13930 | if (spec->unsol_event) |
| 13931 | alc_sku_automute(codec); |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 13932 | } |
| 13933 | |
| 13934 | static int patch_alc662(struct hda_codec *codec) |
| 13935 | { |
| 13936 | struct alc_spec *spec; |
| 13937 | int err, board_config; |
| 13938 | |
| 13939 | spec = kzalloc(sizeof(*spec), GFP_KERNEL); |
| 13940 | if (!spec) |
| 13941 | return -ENOMEM; |
| 13942 | |
| 13943 | codec->spec = spec; |
| 13944 | |
| 13945 | board_config = snd_hda_check_board_config(codec, ALC662_MODEL_LAST, |
| 13946 | alc662_models, |
| 13947 | alc662_cfg_tbl); |
| 13948 | if (board_config < 0) { |
| 13949 | printk(KERN_INFO "hda_codec: Unknown model for ALC662, " |
| 13950 | "trying auto-probe from BIOS...\n"); |
| 13951 | board_config = ALC662_AUTO; |
| 13952 | } |
| 13953 | |
| 13954 | if (board_config == ALC662_AUTO) { |
| 13955 | /* automatic parse from the BIOS config */ |
| 13956 | err = alc662_parse_auto_config(codec); |
| 13957 | if (err < 0) { |
| 13958 | alc_free(codec); |
| 13959 | return err; |
Takashi Iwai | 8c87286f | 2007-06-19 12:11:16 +0200 | [diff] [blame] | 13960 | } else if (!err) { |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 13961 | printk(KERN_INFO |
| 13962 | "hda_codec: Cannot set up configuration " |
| 13963 | "from BIOS. Using base mode...\n"); |
| 13964 | board_config = ALC662_3ST_2ch_DIG; |
| 13965 | } |
| 13966 | } |
| 13967 | |
| 13968 | if (board_config != ALC662_AUTO) |
| 13969 | setup_preset(spec, &alc662_presets[board_config]); |
| 13970 | |
| 13971 | spec->stream_name_analog = "ALC662 Analog"; |
| 13972 | spec->stream_analog_playback = &alc662_pcm_analog_playback; |
| 13973 | spec->stream_analog_capture = &alc662_pcm_analog_capture; |
| 13974 | |
| 13975 | spec->stream_name_digital = "ALC662 Digital"; |
| 13976 | spec->stream_digital_playback = &alc662_pcm_digital_playback; |
| 13977 | spec->stream_digital_capture = &alc662_pcm_digital_capture; |
| 13978 | |
Takashi Iwai | e140634 | 2008-02-11 18:32:32 +0100 | [diff] [blame] | 13979 | spec->adc_nids = alc662_adc_nids; |
| 13980 | spec->num_adc_nids = ARRAY_SIZE(alc662_adc_nids); |
| 13981 | spec->capsrc_nids = alc662_capsrc_nids; |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 13982 | |
Takashi Iwai | 2134ea4 | 2008-01-10 16:53:55 +0100 | [diff] [blame] | 13983 | spec->vmaster_nid = 0x02; |
| 13984 | |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 13985 | codec->patch_ops = alc_patch_ops; |
| 13986 | if (board_config == ALC662_AUTO) |
| 13987 | spec->init_hook = alc662_auto_init; |
Takashi Iwai | cb53c62 | 2007-08-10 17:21:45 +0200 | [diff] [blame] | 13988 | #ifdef CONFIG_SND_HDA_POWER_SAVE |
| 13989 | if (!spec->loopback.amplist) |
| 13990 | spec->loopback.amplist = alc662_loopbacks; |
| 13991 | #endif |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 13992 | |
| 13993 | return 0; |
| 13994 | } |
| 13995 | |
| 13996 | /* |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 13997 | * patch entries |
| 13998 | */ |
| 13999 | struct hda_codec_preset snd_hda_preset_realtek[] = { |
| 14000 | { .id = 0x10ec0260, .name = "ALC260", .patch = patch_alc260 }, |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 14001 | { .id = 0x10ec0262, .name = "ALC262", .patch = patch_alc262 }, |
Kailang Yang | f6a9224 | 2007-12-13 16:52:54 +0100 | [diff] [blame] | 14002 | { .id = 0x10ec0267, .name = "ALC267", .patch = patch_alc268 }, |
Kailang Yang | a361d84 | 2007-06-05 12:30:55 +0200 | [diff] [blame] | 14003 | { .id = 0x10ec0268, .name = "ALC268", .patch = patch_alc268 }, |
Kailang Yang | f6a9224 | 2007-12-13 16:52:54 +0100 | [diff] [blame] | 14004 | { .id = 0x10ec0269, .name = "ALC269", .patch = patch_alc269 }, |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 14005 | { .id = 0x10ec0861, .rev = 0x100340, .name = "ALC660", |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 14006 | .patch = patch_alc861 }, |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 14007 | { .id = 0x10ec0660, .name = "ALC660-VD", .patch = patch_alc861vd }, |
| 14008 | { .id = 0x10ec0861, .name = "ALC861", .patch = patch_alc861 }, |
| 14009 | { .id = 0x10ec0862, .name = "ALC861-VD", .patch = patch_alc861vd }, |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 14010 | { .id = 0x10ec0662, .rev = 0x100002, .name = "ALC662 rev2", |
| 14011 | .patch = patch_alc883 }, |
| 14012 | { .id = 0x10ec0662, .rev = 0x100101, .name = "ALC662 rev1", |
| 14013 | .patch = patch_alc662 }, |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 14014 | { .id = 0x10ec0880, .name = "ALC880", .patch = patch_alc880 }, |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 14015 | { .id = 0x10ec0882, .name = "ALC882", .patch = patch_alc882 }, |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 14016 | { .id = 0x10ec0883, .name = "ALC883", .patch = patch_alc883 }, |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 14017 | { .id = 0x10ec0885, .name = "ALC885", .patch = patch_alc882 }, |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 14018 | { .id = 0x10ec0888, .name = "ALC888", .patch = patch_alc883 }, |
Kailang Yang | f6a9224 | 2007-12-13 16:52:54 +0100 | [diff] [blame] | 14019 | { .id = 0x10ec0889, .name = "ALC889", .patch = patch_alc883 }, |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 14020 | {} /* terminator */ |
| 14021 | }; |