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, |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 101 | ALC262_AUTO, |
| 102 | ALC262_MODEL_LAST /* last tag */ |
| 103 | }; |
| 104 | |
Kailang Yang | a361d84 | 2007-06-05 12:30:55 +0200 | [diff] [blame] | 105 | /* ALC268 models */ |
| 106 | enum { |
| 107 | ALC268_3ST, |
Kailang Yang | d1a991a | 2007-08-15 16:21:59 +0200 | [diff] [blame] | 108 | ALC268_TOSHIBA, |
Takashi Iwai | d273809 | 2007-08-16 14:59:45 +0200 | [diff] [blame] | 109 | ALC268_ACER, |
Takashi Iwai | 3866f0b | 2008-01-15 12:37:42 +0100 | [diff] [blame] | 110 | ALC268_DELL, |
Mirco Tischler | f12462c | 2008-02-04 12:33:59 +0100 | [diff] [blame] | 111 | ALC268_ZEPTO, |
Jonathan Woithe | 86c53bd | 2008-01-08 12:33:19 +0100 | [diff] [blame] | 112 | #ifdef CONFIG_SND_DEBUG |
| 113 | ALC268_TEST, |
| 114 | #endif |
Kailang Yang | a361d84 | 2007-06-05 12:30:55 +0200 | [diff] [blame] | 115 | ALC268_AUTO, |
| 116 | ALC268_MODEL_LAST /* last tag */ |
| 117 | }; |
| 118 | |
Kailang Yang | f6a9224 | 2007-12-13 16:52:54 +0100 | [diff] [blame] | 119 | /* ALC269 models */ |
| 120 | enum { |
| 121 | ALC269_BASIC, |
| 122 | ALC269_AUTO, |
| 123 | ALC269_MODEL_LAST /* last tag */ |
| 124 | }; |
| 125 | |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 126 | /* ALC861 models */ |
| 127 | enum { |
| 128 | ALC861_3ST, |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 129 | ALC660_3ST, |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 130 | ALC861_3ST_DIG, |
| 131 | ALC861_6ST_DIG, |
Takashi Iwai | 22309c3 | 2006-08-09 16:57:28 +0200 | [diff] [blame] | 132 | ALC861_UNIWILL_M31, |
Tobin Davis | a53d1ae | 2006-10-17 12:00:28 +0200 | [diff] [blame] | 133 | ALC861_TOSHIBA, |
Mariusz Domanski | 7cdbff9 | 2006-10-23 13:42:56 +0200 | [diff] [blame] | 134 | ALC861_ASUS, |
Takashi Iwai | 56bb0ca | 2006-11-22 11:52:52 +0100 | [diff] [blame] | 135 | ALC861_ASUS_LAPTOP, |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 136 | ALC861_AUTO, |
| 137 | ALC861_MODEL_LAST, |
| 138 | }; |
| 139 | |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 140 | /* ALC861-VD models */ |
| 141 | enum { |
| 142 | ALC660VD_3ST, |
Mike Crash | 6963f84 | 2007-06-25 12:12:51 +0200 | [diff] [blame] | 143 | ALC660VD_3ST_DIG, |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 144 | ALC861VD_3ST, |
| 145 | ALC861VD_3ST_DIG, |
| 146 | ALC861VD_6ST_DIG, |
Kailang Yang | bdd148a | 2007-05-08 15:19:08 +0200 | [diff] [blame] | 147 | ALC861VD_LENOVO, |
Kailang Yang | 272a527 | 2007-05-14 11:00:38 +0200 | [diff] [blame] | 148 | ALC861VD_DALLAS, |
Kailang Yang | d1a991a | 2007-08-15 16:21:59 +0200 | [diff] [blame] | 149 | ALC861VD_HP, |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 150 | ALC861VD_AUTO, |
| 151 | ALC861VD_MODEL_LAST, |
| 152 | }; |
| 153 | |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 154 | /* ALC662 models */ |
| 155 | enum { |
| 156 | ALC662_3ST_2ch_DIG, |
| 157 | ALC662_3ST_6ch_DIG, |
| 158 | ALC662_3ST_6ch, |
| 159 | ALC662_5ST_DIG, |
| 160 | ALC662_LENOVO_101E, |
Kailang Yang | 291702f | 2007-10-16 14:28:03 +0200 | [diff] [blame] | 161 | ALC662_ASUS_EEEPC_P701, |
Kailang Yang | 8c42722 | 2008-01-10 13:03:59 +0100 | [diff] [blame] | 162 | ALC662_ASUS_EEEPC_EP20, |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 163 | ALC662_AUTO, |
| 164 | ALC662_MODEL_LAST, |
| 165 | }; |
| 166 | |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 167 | /* ALC882 models */ |
| 168 | enum { |
| 169 | ALC882_3ST_DIG, |
| 170 | ALC882_6ST_DIG, |
Takashi Iwai | 4b146cb | 2006-07-28 14:42:36 +0200 | [diff] [blame] | 171 | ALC882_ARIMA, |
Kailang Yang | bdd148a | 2007-05-08 15:19:08 +0200 | [diff] [blame] | 172 | ALC882_W2JC, |
Kailang Yang | 272a527 | 2007-05-14 11:00:38 +0200 | [diff] [blame] | 173 | ALC882_TARGA, |
| 174 | ALC882_ASUS_A7J, |
Takashi Iwai | 914759b | 2007-09-06 14:52:04 +0200 | [diff] [blame] | 175 | ALC882_ASUS_A7M, |
Tobin Davis | 9102cd1 | 2006-12-15 10:02:12 +0100 | [diff] [blame] | 176 | ALC885_MACPRO, |
Takashi Iwai | 87350ad | 2007-08-16 18:19:38 +0200 | [diff] [blame] | 177 | ALC885_MBP3, |
Nicola Fagnani | c54728d | 2007-07-19 23:28:52 +0200 | [diff] [blame] | 178 | ALC885_IMAC24, |
Kailang Yang | 272a527 | 2007-05-14 11:00:38 +0200 | [diff] [blame] | 179 | ALC882_AUTO, |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 180 | ALC882_MODEL_LAST, |
| 181 | }; |
| 182 | |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 183 | /* ALC883 models */ |
| 184 | enum { |
| 185 | ALC883_3ST_2ch_DIG, |
| 186 | ALC883_3ST_6ch_DIG, |
| 187 | ALC883_3ST_6ch, |
| 188 | ALC883_6ST_DIG, |
Kailang Yang | ccc656c | 2006-10-17 12:32:26 +0200 | [diff] [blame] | 189 | ALC883_TARGA_DIG, |
| 190 | ALC883_TARGA_2ch_DIG, |
Vladimir Avdonin | bab282b9 | 2006-08-22 13:31:58 +0200 | [diff] [blame] | 191 | ALC883_ACER, |
Tobin Davis | 2880a86 | 2007-08-07 11:50:26 +0200 | [diff] [blame] | 192 | ALC883_ACER_ASPIRE, |
Tobin Davis | c07584c | 2006-10-13 12:32:16 +0200 | [diff] [blame] | 193 | ALC883_MEDION, |
Kailang Yang | 272a527 | 2007-05-14 11:00:38 +0200 | [diff] [blame] | 194 | ALC883_MEDION_MD2, |
Andrew L. Neporada | b373bde | 2006-11-07 11:37:08 +0100 | [diff] [blame] | 195 | ALC883_LAPTOP_EAPD, |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 196 | ALC883_LENOVO_101E_2ch, |
Kailang Yang | 272a527 | 2007-05-14 11:00:38 +0200 | [diff] [blame] | 197 | ALC883_LENOVO_NB0763, |
Kailang Yang | 189609a | 2007-08-20 11:31:23 +0200 | [diff] [blame] | 198 | ALC888_LENOVO_MS7195_DIG, |
| 199 | ALC883_HAIER_W66, |
Claudio Matsuoka | 4723c02 | 2007-07-13 14:36:19 +0200 | [diff] [blame] | 200 | ALC888_6ST_HP, |
| 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[] = { |
| 1930 | {0x10, AC_VERB_SET_CONNECT_SEL, 0x02}, |
| 1931 | {0x11, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 1932 | {0x12, AC_VERB_SET_CONNECT_SEL, 0x01}, |
| 1933 | {0x13, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 1934 | |
| 1935 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 1936 | {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 1937 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 1938 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 1939 | |
| 1940 | {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80}, |
| 1941 | {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
| 1942 | {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80}, |
| 1943 | {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
| 1944 | {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 1945 | {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 1946 | {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 1947 | {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 1948 | {0x1c, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 1949 | |
Takashi Iwai | 937b416 | 2008-02-11 14:52:36 +0100 | [diff] [blame] | 1950 | {0x14, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN|ALC880_HP_EVENT}, |
| 1951 | {0x21, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN|ALC880_DCVOL_EVENT}, |
| 1952 | |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 1953 | { } |
| 1954 | }; |
| 1955 | |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 1956 | /* |
| 1957 | * ASUS pin configuration: |
| 1958 | * HP/front = 0x14, surr = 0x15, clfe = 0x16, mic = 0x18, line = 0x1a |
| 1959 | */ |
| 1960 | static struct hda_verb alc880_pin_asus_init_verbs[] = { |
| 1961 | {0x10, AC_VERB_SET_CONNECT_SEL, 0x02}, |
| 1962 | {0x11, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 1963 | {0x12, AC_VERB_SET_CONNECT_SEL, 0x01}, |
| 1964 | {0x13, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 1965 | |
| 1966 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 1967 | {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 1968 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 1969 | {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 1970 | {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 1971 | {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 1972 | {0x17, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 1973 | {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 1974 | |
| 1975 | {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80}, |
| 1976 | {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
| 1977 | {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80}, |
| 1978 | {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
| 1979 | {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
| 1980 | {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
| 1981 | {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 1982 | {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 1983 | {0x1c, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
| 1984 | |
| 1985 | { } |
| 1986 | }; |
| 1987 | |
| 1988 | /* Enable GPIO mask and set output */ |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 1989 | #define alc880_gpio1_init_verbs alc_gpio1_init_verbs |
| 1990 | #define alc880_gpio2_init_verbs alc_gpio2_init_verbs |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 1991 | |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 1992 | /* Clevo m520g init */ |
| 1993 | static struct hda_verb alc880_pin_clevo_init_verbs[] = { |
| 1994 | /* headphone output */ |
| 1995 | {0x11, AC_VERB_SET_CONNECT_SEL, 0x01}, |
| 1996 | /* line-out */ |
| 1997 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 1998 | {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 1999 | /* Line-in */ |
| 2000 | {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
| 2001 | {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 2002 | /* CD */ |
| 2003 | {0x1c, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
| 2004 | {0x1c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 2005 | /* Mic1 (rear panel) */ |
| 2006 | {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80}, |
| 2007 | {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 2008 | /* Mic2 (front panel) */ |
| 2009 | {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80}, |
| 2010 | {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 2011 | /* headphone */ |
| 2012 | {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 2013 | {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 2014 | /* change to EAPD mode */ |
| 2015 | {0x20, AC_VERB_SET_COEF_INDEX, 0x07}, |
| 2016 | {0x20, AC_VERB_SET_PROC_COEF, 0x3060}, |
| 2017 | |
| 2018 | { } |
| 2019 | }; |
| 2020 | |
| 2021 | static struct hda_verb alc880_pin_tcl_S700_init_verbs[] = { |
Takashi Iwai | 4b146cb | 2006-07-28 14:42:36 +0200 | [diff] [blame] | 2022 | /* change to EAPD mode */ |
| 2023 | {0x20, AC_VERB_SET_COEF_INDEX, 0x07}, |
| 2024 | {0x20, AC_VERB_SET_PROC_COEF, 0x3060}, |
| 2025 | |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 2026 | /* Headphone output */ |
| 2027 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 2028 | /* Front output*/ |
| 2029 | {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 2030 | {0x1b, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 2031 | |
| 2032 | /* Line In pin widget for input */ |
| 2033 | {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
| 2034 | /* CD pin widget for input */ |
| 2035 | {0x1c, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
| 2036 | /* Mic1 (rear panel) pin widget for input and vref at 80% */ |
| 2037 | {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80}, |
| 2038 | |
| 2039 | /* change to EAPD mode */ |
| 2040 | {0x20, AC_VERB_SET_COEF_INDEX, 0x07}, |
| 2041 | {0x20, AC_VERB_SET_PROC_COEF, 0x3070}, |
| 2042 | |
| 2043 | { } |
| 2044 | }; |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 2045 | |
| 2046 | /* |
Takashi Iwai | ae6b813 | 2006-03-03 16:47:17 +0100 | [diff] [blame] | 2047 | * LG m1 express dual |
| 2048 | * |
| 2049 | * Pin assignment: |
| 2050 | * Rear Line-In/Out (blue): 0x14 |
| 2051 | * Build-in Mic-In: 0x15 |
| 2052 | * Speaker-out: 0x17 |
| 2053 | * HP-Out (green): 0x1b |
| 2054 | * Mic-In/Out (red): 0x19 |
| 2055 | * SPDIF-Out: 0x1e |
| 2056 | */ |
| 2057 | |
| 2058 | /* To make 5.1 output working (green=Front, blue=Surr, red=CLFE) */ |
| 2059 | static hda_nid_t alc880_lg_dac_nids[3] = { |
| 2060 | 0x05, 0x02, 0x03 |
| 2061 | }; |
| 2062 | |
| 2063 | /* seems analog CD is not working */ |
| 2064 | static struct hda_input_mux alc880_lg_capture_source = { |
| 2065 | .num_items = 3, |
| 2066 | .items = { |
| 2067 | { "Mic", 0x1 }, |
| 2068 | { "Line", 0x5 }, |
| 2069 | { "Internal Mic", 0x6 }, |
| 2070 | }, |
| 2071 | }; |
| 2072 | |
| 2073 | /* 2,4,6 channel modes */ |
| 2074 | static struct hda_verb alc880_lg_ch2_init[] = { |
| 2075 | /* set line-in and mic-in to input */ |
| 2076 | { 0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN }, |
| 2077 | { 0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80 }, |
| 2078 | { } |
| 2079 | }; |
| 2080 | |
| 2081 | static struct hda_verb alc880_lg_ch4_init[] = { |
| 2082 | /* set line-in to out and mic-in to input */ |
| 2083 | { 0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP }, |
| 2084 | { 0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80 }, |
| 2085 | { } |
| 2086 | }; |
| 2087 | |
| 2088 | static struct hda_verb alc880_lg_ch6_init[] = { |
| 2089 | /* set line-in and mic-in to output */ |
| 2090 | { 0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP }, |
| 2091 | { 0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP }, |
| 2092 | { } |
| 2093 | }; |
| 2094 | |
| 2095 | static struct hda_channel_mode alc880_lg_ch_modes[3] = { |
| 2096 | { 2, alc880_lg_ch2_init }, |
| 2097 | { 4, alc880_lg_ch4_init }, |
| 2098 | { 6, alc880_lg_ch6_init }, |
| 2099 | }; |
| 2100 | |
| 2101 | static struct snd_kcontrol_new alc880_lg_mixer[] = { |
Takashi Iwai | 2134ea4 | 2008-01-10 16:53:55 +0100 | [diff] [blame] | 2102 | HDA_CODEC_VOLUME("Front Playback Volume", 0x0f, 0x0, HDA_OUTPUT), |
| 2103 | HDA_BIND_MUTE("Front Playback Switch", 0x0f, 2, HDA_INPUT), |
Takashi Iwai | ae6b813 | 2006-03-03 16:47:17 +0100 | [diff] [blame] | 2104 | HDA_CODEC_VOLUME("Surround Playback Volume", 0x0c, 0x0, HDA_OUTPUT), |
| 2105 | HDA_BIND_MUTE("Surround Playback Switch", 0x0c, 2, HDA_INPUT), |
| 2106 | HDA_CODEC_VOLUME_MONO("Center Playback Volume", 0x0d, 1, 0x0, HDA_OUTPUT), |
| 2107 | HDA_CODEC_VOLUME_MONO("LFE Playback Volume", 0x0d, 2, 0x0, HDA_OUTPUT), |
| 2108 | HDA_BIND_MUTE_MONO("Center Playback Switch", 0x0d, 1, 2, HDA_INPUT), |
| 2109 | HDA_BIND_MUTE_MONO("LFE Playback Switch", 0x0d, 2, 2, HDA_INPUT), |
| 2110 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x1, HDA_INPUT), |
| 2111 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x1, HDA_INPUT), |
| 2112 | HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x06, HDA_INPUT), |
| 2113 | HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x06, HDA_INPUT), |
| 2114 | HDA_CODEC_VOLUME("Internal Mic Playback Volume", 0x0b, 0x07, HDA_INPUT), |
| 2115 | HDA_CODEC_MUTE("Internal Mic Playback Switch", 0x0b, 0x07, HDA_INPUT), |
| 2116 | { |
| 2117 | .iface = SNDRV_CTL_ELEM_IFACE_MIXER, |
| 2118 | .name = "Channel Mode", |
| 2119 | .info = alc_ch_mode_info, |
| 2120 | .get = alc_ch_mode_get, |
| 2121 | .put = alc_ch_mode_put, |
| 2122 | }, |
| 2123 | { } /* end */ |
| 2124 | }; |
| 2125 | |
| 2126 | static struct hda_verb alc880_lg_init_verbs[] = { |
| 2127 | /* set capture source to mic-in */ |
| 2128 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 2129 | {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 2130 | {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 2131 | /* mute all amp mixer inputs */ |
| 2132 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(5)}, |
Takashi Iwai | cb53c62 | 2007-08-10 17:21:45 +0200 | [diff] [blame] | 2133 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(6)}, |
| 2134 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(7)}, |
Takashi Iwai | ae6b813 | 2006-03-03 16:47:17 +0100 | [diff] [blame] | 2135 | /* line-in to input */ |
| 2136 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
| 2137 | {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 2138 | /* built-in mic */ |
| 2139 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80}, |
| 2140 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 2141 | /* speaker-out */ |
| 2142 | {0x17, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 2143 | {0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 2144 | /* mic-in to input */ |
| 2145 | {0x11, AC_VERB_SET_CONNECT_SEL, 0x01}, |
| 2146 | {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80}, |
| 2147 | {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 2148 | /* HP-out */ |
| 2149 | {0x13, AC_VERB_SET_CONNECT_SEL, 0x03}, |
| 2150 | {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 2151 | {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 2152 | /* jack sense */ |
| 2153 | {0x1b, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | 0x1}, |
| 2154 | { } |
| 2155 | }; |
| 2156 | |
| 2157 | /* toggle speaker-output according to the hp-jack state */ |
| 2158 | static void alc880_lg_automute(struct hda_codec *codec) |
| 2159 | { |
| 2160 | unsigned int present; |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 2161 | unsigned char bits; |
Takashi Iwai | ae6b813 | 2006-03-03 16:47:17 +0100 | [diff] [blame] | 2162 | |
| 2163 | present = snd_hda_codec_read(codec, 0x1b, 0, |
| 2164 | AC_VERB_GET_PIN_SENSE, 0) & 0x80000000; |
Takashi Iwai | 47fd830 | 2007-08-10 17:11:07 +0200 | [diff] [blame] | 2165 | bits = present ? HDA_AMP_MUTE : 0; |
| 2166 | snd_hda_codec_amp_stereo(codec, 0x17, HDA_OUTPUT, 0, |
| 2167 | HDA_AMP_MUTE, bits); |
Takashi Iwai | ae6b813 | 2006-03-03 16:47:17 +0100 | [diff] [blame] | 2168 | } |
| 2169 | |
| 2170 | static void alc880_lg_unsol_event(struct hda_codec *codec, unsigned int res) |
| 2171 | { |
| 2172 | /* Looks like the unsol event is incompatible with the standard |
| 2173 | * definition. 4bit tag is placed at 28 bit! |
| 2174 | */ |
| 2175 | if ((res >> 28) == 0x01) |
| 2176 | alc880_lg_automute(codec); |
| 2177 | } |
| 2178 | |
| 2179 | /* |
Takashi Iwai | d681518 | 2006-03-23 16:06:23 +0100 | [diff] [blame] | 2180 | * LG LW20 |
| 2181 | * |
| 2182 | * Pin assignment: |
| 2183 | * Speaker-out: 0x14 |
| 2184 | * Mic-In: 0x18 |
Claudio Matsuoka | e4f41da | 2007-07-13 11:51:06 +0200 | [diff] [blame] | 2185 | * Built-in Mic-In: 0x19 |
| 2186 | * Line-In: 0x1b |
| 2187 | * HP-Out: 0x1a |
Takashi Iwai | d681518 | 2006-03-23 16:06:23 +0100 | [diff] [blame] | 2188 | * SPDIF-Out: 0x1e |
| 2189 | */ |
| 2190 | |
Takashi Iwai | d681518 | 2006-03-23 16:06:23 +0100 | [diff] [blame] | 2191 | static struct hda_input_mux alc880_lg_lw_capture_source = { |
Claudio Matsuoka | e4f41da | 2007-07-13 11:51:06 +0200 | [diff] [blame] | 2192 | .num_items = 3, |
Takashi Iwai | d681518 | 2006-03-23 16:06:23 +0100 | [diff] [blame] | 2193 | .items = { |
| 2194 | { "Mic", 0x0 }, |
| 2195 | { "Internal Mic", 0x1 }, |
Claudio Matsuoka | e4f41da | 2007-07-13 11:51:06 +0200 | [diff] [blame] | 2196 | { "Line In", 0x2 }, |
Takashi Iwai | d681518 | 2006-03-23 16:06:23 +0100 | [diff] [blame] | 2197 | }, |
| 2198 | }; |
| 2199 | |
Claudio Matsuoka | 0a8c5da | 2007-07-04 15:17:38 +0200 | [diff] [blame] | 2200 | #define alc880_lg_lw_modes alc880_threestack_modes |
| 2201 | |
Takashi Iwai | d681518 | 2006-03-23 16:06:23 +0100 | [diff] [blame] | 2202 | static struct snd_kcontrol_new alc880_lg_lw_mixer[] = { |
Claudio Matsuoka | 0a8c5da | 2007-07-04 15:17:38 +0200 | [diff] [blame] | 2203 | HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT), |
| 2204 | HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT), |
| 2205 | HDA_CODEC_VOLUME("Surround Playback Volume", 0x0f, 0x0, HDA_OUTPUT), |
| 2206 | HDA_BIND_MUTE("Surround Playback Switch", 0x0f, 2, HDA_INPUT), |
| 2207 | HDA_CODEC_VOLUME_MONO("Center Playback Volume", 0x0e, 1, 0x0, HDA_OUTPUT), |
| 2208 | HDA_CODEC_VOLUME_MONO("LFE Playback Volume", 0x0e, 2, 0x0, HDA_OUTPUT), |
| 2209 | HDA_BIND_MUTE_MONO("Center Playback Switch", 0x0e, 1, 2, HDA_INPUT), |
| 2210 | HDA_BIND_MUTE_MONO("LFE Playback Switch", 0x0e, 2, 2, HDA_INPUT), |
| 2211 | HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT), |
| 2212 | HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT), |
Takashi Iwai | d681518 | 2006-03-23 16:06:23 +0100 | [diff] [blame] | 2213 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), |
| 2214 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), |
| 2215 | HDA_CODEC_VOLUME("Internal Mic Playback Volume", 0x0b, 0x01, HDA_INPUT), |
| 2216 | HDA_CODEC_MUTE("Internal Mic Playback Switch", 0x0b, 0x01, HDA_INPUT), |
Claudio Matsuoka | 0a8c5da | 2007-07-04 15:17:38 +0200 | [diff] [blame] | 2217 | { |
| 2218 | .iface = SNDRV_CTL_ELEM_IFACE_MIXER, |
| 2219 | .name = "Channel Mode", |
| 2220 | .info = alc_ch_mode_info, |
| 2221 | .get = alc_ch_mode_get, |
| 2222 | .put = alc_ch_mode_put, |
| 2223 | }, |
Takashi Iwai | d681518 | 2006-03-23 16:06:23 +0100 | [diff] [blame] | 2224 | { } /* end */ |
| 2225 | }; |
| 2226 | |
| 2227 | static struct hda_verb alc880_lg_lw_init_verbs[] = { |
Claudio Matsuoka | 0a8c5da | 2007-07-04 15:17:38 +0200 | [diff] [blame] | 2228 | {0x13, AC_VERB_SET_CONNECT_SEL, 0x00}, /* HP */ |
| 2229 | {0x10, AC_VERB_SET_CONNECT_SEL, 0x02}, /* mic/clfe */ |
| 2230 | {0x12, AC_VERB_SET_CONNECT_SEL, 0x03}, /* line/surround */ |
| 2231 | |
Takashi Iwai | d681518 | 2006-03-23 16:06:23 +0100 | [diff] [blame] | 2232 | /* set capture source to mic-in */ |
| 2233 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 2234 | {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 2235 | {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
Takashi Iwai | cb53c62 | 2007-08-10 17:21:45 +0200 | [diff] [blame] | 2236 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(7)}, |
Takashi Iwai | d681518 | 2006-03-23 16:06:23 +0100 | [diff] [blame] | 2237 | /* speaker-out */ |
| 2238 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 2239 | {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 2240 | /* HP-out */ |
Takashi Iwai | d681518 | 2006-03-23 16:06:23 +0100 | [diff] [blame] | 2241 | {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 2242 | {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 2243 | /* mic-in to input */ |
| 2244 | {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80}, |
| 2245 | {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 2246 | /* built-in mic */ |
| 2247 | {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80}, |
| 2248 | {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 2249 | /* jack sense */ |
| 2250 | {0x1b, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | 0x1}, |
| 2251 | { } |
| 2252 | }; |
| 2253 | |
| 2254 | /* toggle speaker-output according to the hp-jack state */ |
| 2255 | static void alc880_lg_lw_automute(struct hda_codec *codec) |
| 2256 | { |
| 2257 | unsigned int present; |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 2258 | unsigned char bits; |
Takashi Iwai | d681518 | 2006-03-23 16:06:23 +0100 | [diff] [blame] | 2259 | |
| 2260 | present = snd_hda_codec_read(codec, 0x1b, 0, |
| 2261 | AC_VERB_GET_PIN_SENSE, 0) & 0x80000000; |
Takashi Iwai | 47fd830 | 2007-08-10 17:11:07 +0200 | [diff] [blame] | 2262 | bits = present ? HDA_AMP_MUTE : 0; |
| 2263 | snd_hda_codec_amp_stereo(codec, 0x14, HDA_OUTPUT, 0, |
| 2264 | HDA_AMP_MUTE, bits); |
Takashi Iwai | d681518 | 2006-03-23 16:06:23 +0100 | [diff] [blame] | 2265 | } |
| 2266 | |
| 2267 | static void alc880_lg_lw_unsol_event(struct hda_codec *codec, unsigned int res) |
| 2268 | { |
| 2269 | /* Looks like the unsol event is incompatible with the standard |
| 2270 | * definition. 4bit tag is placed at 28 bit! |
| 2271 | */ |
| 2272 | if ((res >> 28) == 0x01) |
| 2273 | alc880_lg_lw_automute(codec); |
| 2274 | } |
| 2275 | |
Takashi Iwai | cb53c62 | 2007-08-10 17:21:45 +0200 | [diff] [blame] | 2276 | #ifdef CONFIG_SND_HDA_POWER_SAVE |
| 2277 | static struct hda_amp_list alc880_loopbacks[] = { |
| 2278 | { 0x0b, HDA_INPUT, 0 }, |
| 2279 | { 0x0b, HDA_INPUT, 1 }, |
| 2280 | { 0x0b, HDA_INPUT, 2 }, |
| 2281 | { 0x0b, HDA_INPUT, 3 }, |
| 2282 | { 0x0b, HDA_INPUT, 4 }, |
| 2283 | { } /* end */ |
| 2284 | }; |
| 2285 | |
| 2286 | static struct hda_amp_list alc880_lg_loopbacks[] = { |
| 2287 | { 0x0b, HDA_INPUT, 1 }, |
| 2288 | { 0x0b, HDA_INPUT, 6 }, |
| 2289 | { 0x0b, HDA_INPUT, 7 }, |
| 2290 | { } /* end */ |
| 2291 | }; |
| 2292 | #endif |
| 2293 | |
Takashi Iwai | d681518 | 2006-03-23 16:06:23 +0100 | [diff] [blame] | 2294 | /* |
Takashi Iwai | ae6b813 | 2006-03-03 16:47:17 +0100 | [diff] [blame] | 2295 | * Common callbacks |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 2296 | */ |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 2297 | |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 2298 | static int alc_init(struct hda_codec *codec) |
| 2299 | { |
| 2300 | struct alc_spec *spec = codec->spec; |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 2301 | unsigned int i; |
| 2302 | |
| 2303 | for (i = 0; i < spec->num_init_verbs; i++) |
| 2304 | snd_hda_sequence_write(codec, spec->init_verbs[i]); |
Takashi Iwai | ae6b813 | 2006-03-03 16:47:17 +0100 | [diff] [blame] | 2305 | |
| 2306 | if (spec->init_hook) |
| 2307 | spec->init_hook(codec); |
| 2308 | |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 2309 | return 0; |
| 2310 | } |
| 2311 | |
Takashi Iwai | ae6b813 | 2006-03-03 16:47:17 +0100 | [diff] [blame] | 2312 | static void alc_unsol_event(struct hda_codec *codec, unsigned int res) |
| 2313 | { |
| 2314 | struct alc_spec *spec = codec->spec; |
| 2315 | |
| 2316 | if (spec->unsol_event) |
| 2317 | spec->unsol_event(codec, res); |
| 2318 | } |
| 2319 | |
Takashi Iwai | cb53c62 | 2007-08-10 17:21:45 +0200 | [diff] [blame] | 2320 | #ifdef CONFIG_SND_HDA_POWER_SAVE |
| 2321 | static int alc_check_power_status(struct hda_codec *codec, hda_nid_t nid) |
| 2322 | { |
| 2323 | struct alc_spec *spec = codec->spec; |
| 2324 | return snd_hda_check_amp_list_power(codec, &spec->loopback, nid); |
| 2325 | } |
| 2326 | #endif |
| 2327 | |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 2328 | /* |
| 2329 | * Analog playback callbacks |
| 2330 | */ |
| 2331 | static int alc880_playback_pcm_open(struct hda_pcm_stream *hinfo, |
| 2332 | struct hda_codec *codec, |
Takashi Iwai | c8b6bf9 | 2005-11-17 14:57:47 +0100 | [diff] [blame] | 2333 | struct snd_pcm_substream *substream) |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 2334 | { |
| 2335 | struct alc_spec *spec = codec->spec; |
Takashi Iwai | 9a08160 | 2008-02-12 18:37:26 +0100 | [diff] [blame] | 2336 | return snd_hda_multi_out_analog_open(codec, &spec->multiout, substream, |
| 2337 | hinfo); |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 2338 | } |
| 2339 | |
| 2340 | static int alc880_playback_pcm_prepare(struct hda_pcm_stream *hinfo, |
| 2341 | struct hda_codec *codec, |
| 2342 | unsigned int stream_tag, |
| 2343 | unsigned int format, |
Takashi Iwai | c8b6bf9 | 2005-11-17 14:57:47 +0100 | [diff] [blame] | 2344 | struct snd_pcm_substream *substream) |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 2345 | { |
| 2346 | struct alc_spec *spec = codec->spec; |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 2347 | return snd_hda_multi_out_analog_prepare(codec, &spec->multiout, |
| 2348 | stream_tag, format, substream); |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 2349 | } |
| 2350 | |
| 2351 | static int alc880_playback_pcm_cleanup(struct hda_pcm_stream *hinfo, |
| 2352 | struct hda_codec *codec, |
Takashi Iwai | c8b6bf9 | 2005-11-17 14:57:47 +0100 | [diff] [blame] | 2353 | struct snd_pcm_substream *substream) |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 2354 | { |
| 2355 | struct alc_spec *spec = codec->spec; |
| 2356 | return snd_hda_multi_out_analog_cleanup(codec, &spec->multiout); |
| 2357 | } |
| 2358 | |
| 2359 | /* |
| 2360 | * Digital out |
| 2361 | */ |
| 2362 | static int alc880_dig_playback_pcm_open(struct hda_pcm_stream *hinfo, |
| 2363 | struct hda_codec *codec, |
Takashi Iwai | c8b6bf9 | 2005-11-17 14:57:47 +0100 | [diff] [blame] | 2364 | struct snd_pcm_substream *substream) |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 2365 | { |
| 2366 | struct alc_spec *spec = codec->spec; |
| 2367 | return snd_hda_multi_out_dig_open(codec, &spec->multiout); |
| 2368 | } |
| 2369 | |
Takashi Iwai | 6b97eb4 | 2007-04-05 14:51:48 +0200 | [diff] [blame] | 2370 | static int alc880_dig_playback_pcm_prepare(struct hda_pcm_stream *hinfo, |
| 2371 | struct hda_codec *codec, |
| 2372 | unsigned int stream_tag, |
| 2373 | unsigned int format, |
| 2374 | struct snd_pcm_substream *substream) |
| 2375 | { |
| 2376 | struct alc_spec *spec = codec->spec; |
| 2377 | return snd_hda_multi_out_dig_prepare(codec, &spec->multiout, |
| 2378 | stream_tag, format, substream); |
| 2379 | } |
| 2380 | |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 2381 | static int alc880_dig_playback_pcm_close(struct hda_pcm_stream *hinfo, |
| 2382 | struct hda_codec *codec, |
Takashi Iwai | c8b6bf9 | 2005-11-17 14:57:47 +0100 | [diff] [blame] | 2383 | struct snd_pcm_substream *substream) |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 2384 | { |
| 2385 | struct alc_spec *spec = codec->spec; |
| 2386 | return snd_hda_multi_out_dig_close(codec, &spec->multiout); |
| 2387 | } |
| 2388 | |
| 2389 | /* |
| 2390 | * Analog capture |
| 2391 | */ |
Takashi Iwai | 6330079 | 2008-01-24 15:31:36 +0100 | [diff] [blame] | 2392 | static int alc880_alt_capture_pcm_prepare(struct hda_pcm_stream *hinfo, |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 2393 | struct hda_codec *codec, |
| 2394 | unsigned int stream_tag, |
| 2395 | unsigned int format, |
Takashi Iwai | c8b6bf9 | 2005-11-17 14:57:47 +0100 | [diff] [blame] | 2396 | struct snd_pcm_substream *substream) |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 2397 | { |
| 2398 | struct alc_spec *spec = codec->spec; |
| 2399 | |
Takashi Iwai | 6330079 | 2008-01-24 15:31:36 +0100 | [diff] [blame] | 2400 | snd_hda_codec_setup_stream(codec, spec->adc_nids[substream->number + 1], |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 2401 | stream_tag, 0, format); |
| 2402 | return 0; |
| 2403 | } |
| 2404 | |
Takashi Iwai | 6330079 | 2008-01-24 15:31:36 +0100 | [diff] [blame] | 2405 | static int alc880_alt_capture_pcm_cleanup(struct hda_pcm_stream *hinfo, |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 2406 | struct hda_codec *codec, |
Takashi Iwai | c8b6bf9 | 2005-11-17 14:57:47 +0100 | [diff] [blame] | 2407 | struct snd_pcm_substream *substream) |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 2408 | { |
| 2409 | struct alc_spec *spec = codec->spec; |
| 2410 | |
Takashi Iwai | 6330079 | 2008-01-24 15:31:36 +0100 | [diff] [blame] | 2411 | snd_hda_codec_setup_stream(codec, spec->adc_nids[substream->number + 1], |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 2412 | 0, 0, 0); |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 2413 | return 0; |
| 2414 | } |
| 2415 | |
| 2416 | |
| 2417 | /* |
| 2418 | */ |
| 2419 | static struct hda_pcm_stream alc880_pcm_analog_playback = { |
| 2420 | .substreams = 1, |
| 2421 | .channels_min = 2, |
| 2422 | .channels_max = 8, |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 2423 | /* NID is set in alc_build_pcms */ |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 2424 | .ops = { |
| 2425 | .open = alc880_playback_pcm_open, |
| 2426 | .prepare = alc880_playback_pcm_prepare, |
| 2427 | .cleanup = alc880_playback_pcm_cleanup |
| 2428 | }, |
| 2429 | }; |
| 2430 | |
| 2431 | static struct hda_pcm_stream alc880_pcm_analog_capture = { |
Takashi Iwai | 6330079 | 2008-01-24 15:31:36 +0100 | [diff] [blame] | 2432 | .substreams = 1, |
| 2433 | .channels_min = 2, |
| 2434 | .channels_max = 2, |
| 2435 | /* NID is set in alc_build_pcms */ |
| 2436 | }; |
| 2437 | |
| 2438 | static struct hda_pcm_stream alc880_pcm_analog_alt_playback = { |
| 2439 | .substreams = 1, |
| 2440 | .channels_min = 2, |
| 2441 | .channels_max = 2, |
| 2442 | /* NID is set in alc_build_pcms */ |
| 2443 | }; |
| 2444 | |
| 2445 | static struct hda_pcm_stream alc880_pcm_analog_alt_capture = { |
| 2446 | .substreams = 2, /* can be overridden */ |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 2447 | .channels_min = 2, |
| 2448 | .channels_max = 2, |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 2449 | /* NID is set in alc_build_pcms */ |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 2450 | .ops = { |
Takashi Iwai | 6330079 | 2008-01-24 15:31:36 +0100 | [diff] [blame] | 2451 | .prepare = alc880_alt_capture_pcm_prepare, |
| 2452 | .cleanup = alc880_alt_capture_pcm_cleanup |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 2453 | }, |
| 2454 | }; |
| 2455 | |
| 2456 | static struct hda_pcm_stream alc880_pcm_digital_playback = { |
| 2457 | .substreams = 1, |
| 2458 | .channels_min = 2, |
| 2459 | .channels_max = 2, |
| 2460 | /* NID is set in alc_build_pcms */ |
| 2461 | .ops = { |
| 2462 | .open = alc880_dig_playback_pcm_open, |
Takashi Iwai | 6b97eb4 | 2007-04-05 14:51:48 +0200 | [diff] [blame] | 2463 | .close = alc880_dig_playback_pcm_close, |
| 2464 | .prepare = alc880_dig_playback_pcm_prepare |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 2465 | }, |
| 2466 | }; |
| 2467 | |
| 2468 | static struct hda_pcm_stream alc880_pcm_digital_capture = { |
| 2469 | .substreams = 1, |
| 2470 | .channels_min = 2, |
| 2471 | .channels_max = 2, |
| 2472 | /* NID is set in alc_build_pcms */ |
| 2473 | }; |
| 2474 | |
Jonathan Woithe | 4c5186e | 2006-02-09 11:53:48 +0100 | [diff] [blame] | 2475 | /* 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] | 2476 | static struct hda_pcm_stream alc_pcm_null_stream = { |
Jonathan Woithe | 4c5186e | 2006-02-09 11:53:48 +0100 | [diff] [blame] | 2477 | .substreams = 0, |
| 2478 | .channels_min = 0, |
| 2479 | .channels_max = 0, |
| 2480 | }; |
| 2481 | |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 2482 | static int alc_build_pcms(struct hda_codec *codec) |
| 2483 | { |
| 2484 | struct alc_spec *spec = codec->spec; |
| 2485 | struct hda_pcm *info = spec->pcm_rec; |
| 2486 | int i; |
| 2487 | |
| 2488 | codec->num_pcms = 1; |
| 2489 | codec->pcm_info = info; |
| 2490 | |
| 2491 | info->name = spec->stream_name_analog; |
Takashi Iwai | 4a471b7 | 2005-12-07 13:56:29 +0100 | [diff] [blame] | 2492 | if (spec->stream_analog_playback) { |
| 2493 | snd_assert(spec->multiout.dac_nids, return -EINVAL); |
| 2494 | info->stream[SNDRV_PCM_STREAM_PLAYBACK] = *(spec->stream_analog_playback); |
| 2495 | info->stream[SNDRV_PCM_STREAM_PLAYBACK].nid = spec->multiout.dac_nids[0]; |
| 2496 | } |
| 2497 | if (spec->stream_analog_capture) { |
| 2498 | snd_assert(spec->adc_nids, return -EINVAL); |
| 2499 | info->stream[SNDRV_PCM_STREAM_CAPTURE] = *(spec->stream_analog_capture); |
| 2500 | info->stream[SNDRV_PCM_STREAM_CAPTURE].nid = spec->adc_nids[0]; |
| 2501 | } |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 2502 | |
Takashi Iwai | 4a471b7 | 2005-12-07 13:56:29 +0100 | [diff] [blame] | 2503 | if (spec->channel_mode) { |
| 2504 | info->stream[SNDRV_PCM_STREAM_PLAYBACK].channels_max = 0; |
| 2505 | for (i = 0; i < spec->num_channel_mode; i++) { |
| 2506 | if (spec->channel_mode[i].channels > info->stream[SNDRV_PCM_STREAM_PLAYBACK].channels_max) { |
| 2507 | info->stream[SNDRV_PCM_STREAM_PLAYBACK].channels_max = spec->channel_mode[i].channels; |
| 2508 | } |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 2509 | } |
| 2510 | } |
| 2511 | |
Takashi Iwai | e08a007 | 2006-09-07 17:52:14 +0200 | [diff] [blame] | 2512 | /* SPDIF for stream index #1 */ |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 2513 | if (spec->multiout.dig_out_nid || spec->dig_in_nid) { |
Takashi Iwai | e08a007 | 2006-09-07 17:52:14 +0200 | [diff] [blame] | 2514 | codec->num_pcms = 2; |
Takashi Iwai | c06134d | 2006-10-11 18:49:13 +0200 | [diff] [blame] | 2515 | info = spec->pcm_rec + 1; |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 2516 | info->name = spec->stream_name_digital; |
Takashi Iwai | 7ba72ba | 2008-02-06 14:03:20 +0100 | [diff] [blame] | 2517 | info->pcm_type = HDA_PCM_TYPE_SPDIF; |
Takashi Iwai | 4a471b7 | 2005-12-07 13:56:29 +0100 | [diff] [blame] | 2518 | if (spec->multiout.dig_out_nid && |
| 2519 | spec->stream_digital_playback) { |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 2520 | info->stream[SNDRV_PCM_STREAM_PLAYBACK] = *(spec->stream_digital_playback); |
| 2521 | info->stream[SNDRV_PCM_STREAM_PLAYBACK].nid = spec->multiout.dig_out_nid; |
| 2522 | } |
Takashi Iwai | 4a471b7 | 2005-12-07 13:56:29 +0100 | [diff] [blame] | 2523 | if (spec->dig_in_nid && |
| 2524 | spec->stream_digital_capture) { |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 2525 | info->stream[SNDRV_PCM_STREAM_CAPTURE] = *(spec->stream_digital_capture); |
| 2526 | info->stream[SNDRV_PCM_STREAM_CAPTURE].nid = spec->dig_in_nid; |
| 2527 | } |
| 2528 | } |
| 2529 | |
Takashi Iwai | e08a007 | 2006-09-07 17:52:14 +0200 | [diff] [blame] | 2530 | /* If the use of more than one ADC is requested for the current |
| 2531 | * model, configure a second analog capture-only PCM. |
| 2532 | */ |
| 2533 | /* Additional Analaog capture for index #2 */ |
Takashi Iwai | 6330079 | 2008-01-24 15:31:36 +0100 | [diff] [blame] | 2534 | if ((spec->alt_dac_nid && spec->stream_analog_alt_playback) || |
| 2535 | (spec->num_adc_nids > 1 && spec->stream_analog_alt_capture)) { |
Takashi Iwai | e08a007 | 2006-09-07 17:52:14 +0200 | [diff] [blame] | 2536 | codec->num_pcms = 3; |
Takashi Iwai | c06134d | 2006-10-11 18:49:13 +0200 | [diff] [blame] | 2537 | info = spec->pcm_rec + 2; |
Takashi Iwai | e08a007 | 2006-09-07 17:52:14 +0200 | [diff] [blame] | 2538 | info->name = spec->stream_name_analog; |
Takashi Iwai | 6330079 | 2008-01-24 15:31:36 +0100 | [diff] [blame] | 2539 | if (spec->alt_dac_nid) { |
| 2540 | info->stream[SNDRV_PCM_STREAM_PLAYBACK] = |
| 2541 | *spec->stream_analog_alt_playback; |
| 2542 | info->stream[SNDRV_PCM_STREAM_PLAYBACK].nid = |
| 2543 | spec->alt_dac_nid; |
| 2544 | } else { |
| 2545 | info->stream[SNDRV_PCM_STREAM_PLAYBACK] = |
| 2546 | alc_pcm_null_stream; |
| 2547 | info->stream[SNDRV_PCM_STREAM_PLAYBACK].nid = 0; |
| 2548 | } |
| 2549 | if (spec->num_adc_nids > 1) { |
| 2550 | info->stream[SNDRV_PCM_STREAM_CAPTURE] = |
| 2551 | *spec->stream_analog_alt_capture; |
| 2552 | info->stream[SNDRV_PCM_STREAM_CAPTURE].nid = |
| 2553 | spec->adc_nids[1]; |
| 2554 | info->stream[SNDRV_PCM_STREAM_CAPTURE].substreams = |
| 2555 | spec->num_adc_nids - 1; |
| 2556 | } else { |
| 2557 | info->stream[SNDRV_PCM_STREAM_CAPTURE] = |
| 2558 | alc_pcm_null_stream; |
| 2559 | info->stream[SNDRV_PCM_STREAM_CAPTURE].nid = 0; |
Takashi Iwai | e08a007 | 2006-09-07 17:52:14 +0200 | [diff] [blame] | 2560 | } |
| 2561 | } |
| 2562 | |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 2563 | return 0; |
| 2564 | } |
| 2565 | |
| 2566 | static void alc_free(struct hda_codec *codec) |
| 2567 | { |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 2568 | struct alc_spec *spec = codec->spec; |
| 2569 | unsigned int i; |
| 2570 | |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 2571 | if (!spec) |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 2572 | return; |
| 2573 | |
| 2574 | if (spec->kctl_alloc) { |
| 2575 | for (i = 0; i < spec->num_kctl_used; i++) |
| 2576 | kfree(spec->kctl_alloc[i].name); |
| 2577 | kfree(spec->kctl_alloc); |
| 2578 | } |
| 2579 | kfree(spec); |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 2580 | } |
| 2581 | |
| 2582 | /* |
| 2583 | */ |
| 2584 | static struct hda_codec_ops alc_patch_ops = { |
| 2585 | .build_controls = alc_build_controls, |
| 2586 | .build_pcms = alc_build_pcms, |
| 2587 | .init = alc_init, |
| 2588 | .free = alc_free, |
Takashi Iwai | ae6b813 | 2006-03-03 16:47:17 +0100 | [diff] [blame] | 2589 | .unsol_event = alc_unsol_event, |
Takashi Iwai | cb53c62 | 2007-08-10 17:21:45 +0200 | [diff] [blame] | 2590 | #ifdef CONFIG_SND_HDA_POWER_SAVE |
| 2591 | .check_power_status = alc_check_power_status, |
| 2592 | #endif |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 2593 | }; |
| 2594 | |
Takashi Iwai | 2fa522b | 2005-05-12 14:51:12 +0200 | [diff] [blame] | 2595 | |
| 2596 | /* |
| 2597 | * Test configuration for debugging |
| 2598 | * |
| 2599 | * Almost all inputs/outputs are enabled. I/O pins can be configured via |
| 2600 | * enum controls. |
| 2601 | */ |
| 2602 | #ifdef CONFIG_SND_DEBUG |
| 2603 | static hda_nid_t alc880_test_dac_nids[4] = { |
| 2604 | 0x02, 0x03, 0x04, 0x05 |
| 2605 | }; |
| 2606 | |
| 2607 | static struct hda_input_mux alc880_test_capture_source = { |
Takashi Iwai | ae6b813 | 2006-03-03 16:47:17 +0100 | [diff] [blame] | 2608 | .num_items = 7, |
Takashi Iwai | 2fa522b | 2005-05-12 14:51:12 +0200 | [diff] [blame] | 2609 | .items = { |
| 2610 | { "In-1", 0x0 }, |
| 2611 | { "In-2", 0x1 }, |
| 2612 | { "In-3", 0x2 }, |
| 2613 | { "In-4", 0x3 }, |
| 2614 | { "CD", 0x4 }, |
Takashi Iwai | ae6b813 | 2006-03-03 16:47:17 +0100 | [diff] [blame] | 2615 | { "Front", 0x5 }, |
| 2616 | { "Surround", 0x6 }, |
Takashi Iwai | 2fa522b | 2005-05-12 14:51:12 +0200 | [diff] [blame] | 2617 | }, |
| 2618 | }; |
| 2619 | |
Takashi Iwai | d2a6d7d | 2005-11-17 11:06:29 +0100 | [diff] [blame] | 2620 | static struct hda_channel_mode alc880_test_modes[4] = { |
Takashi Iwai | 2fa522b | 2005-05-12 14:51:12 +0200 | [diff] [blame] | 2621 | { 2, NULL }, |
Takashi Iwai | fd2c326 | 2005-05-13 17:18:42 +0200 | [diff] [blame] | 2622 | { 4, NULL }, |
Takashi Iwai | 2fa522b | 2005-05-12 14:51:12 +0200 | [diff] [blame] | 2623 | { 6, NULL }, |
Takashi Iwai | fd2c326 | 2005-05-13 17:18:42 +0200 | [diff] [blame] | 2624 | { 8, NULL }, |
Takashi Iwai | 2fa522b | 2005-05-12 14:51:12 +0200 | [diff] [blame] | 2625 | }; |
| 2626 | |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 2627 | static int alc_test_pin_ctl_info(struct snd_kcontrol *kcontrol, |
| 2628 | struct snd_ctl_elem_info *uinfo) |
Takashi Iwai | 2fa522b | 2005-05-12 14:51:12 +0200 | [diff] [blame] | 2629 | { |
| 2630 | static char *texts[] = { |
| 2631 | "N/A", "Line Out", "HP Out", |
| 2632 | "In Hi-Z", "In 50%", "In Grd", "In 80%", "In 100%" |
| 2633 | }; |
| 2634 | uinfo->type = SNDRV_CTL_ELEM_TYPE_ENUMERATED; |
| 2635 | uinfo->count = 1; |
| 2636 | uinfo->value.enumerated.items = 8; |
| 2637 | if (uinfo->value.enumerated.item >= 8) |
| 2638 | uinfo->value.enumerated.item = 7; |
| 2639 | strcpy(uinfo->value.enumerated.name, texts[uinfo->value.enumerated.item]); |
| 2640 | return 0; |
| 2641 | } |
| 2642 | |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 2643 | static int alc_test_pin_ctl_get(struct snd_kcontrol *kcontrol, |
| 2644 | struct snd_ctl_elem_value *ucontrol) |
Takashi Iwai | 2fa522b | 2005-05-12 14:51:12 +0200 | [diff] [blame] | 2645 | { |
| 2646 | struct hda_codec *codec = snd_kcontrol_chip(kcontrol); |
| 2647 | hda_nid_t nid = (hda_nid_t)kcontrol->private_value; |
| 2648 | unsigned int pin_ctl, item = 0; |
| 2649 | |
| 2650 | pin_ctl = snd_hda_codec_read(codec, nid, 0, |
| 2651 | AC_VERB_GET_PIN_WIDGET_CONTROL, 0); |
| 2652 | if (pin_ctl & AC_PINCTL_OUT_EN) { |
| 2653 | if (pin_ctl & AC_PINCTL_HP_EN) |
| 2654 | item = 2; |
| 2655 | else |
| 2656 | item = 1; |
| 2657 | } else if (pin_ctl & AC_PINCTL_IN_EN) { |
| 2658 | switch (pin_ctl & AC_PINCTL_VREFEN) { |
| 2659 | case AC_PINCTL_VREF_HIZ: item = 3; break; |
| 2660 | case AC_PINCTL_VREF_50: item = 4; break; |
| 2661 | case AC_PINCTL_VREF_GRD: item = 5; break; |
| 2662 | case AC_PINCTL_VREF_80: item = 6; break; |
| 2663 | case AC_PINCTL_VREF_100: item = 7; break; |
| 2664 | } |
| 2665 | } |
| 2666 | ucontrol->value.enumerated.item[0] = item; |
| 2667 | return 0; |
| 2668 | } |
| 2669 | |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 2670 | static int alc_test_pin_ctl_put(struct snd_kcontrol *kcontrol, |
| 2671 | struct snd_ctl_elem_value *ucontrol) |
Takashi Iwai | 2fa522b | 2005-05-12 14:51:12 +0200 | [diff] [blame] | 2672 | { |
| 2673 | struct hda_codec *codec = snd_kcontrol_chip(kcontrol); |
| 2674 | hda_nid_t nid = (hda_nid_t)kcontrol->private_value; |
| 2675 | static unsigned int ctls[] = { |
| 2676 | 0, AC_PINCTL_OUT_EN, AC_PINCTL_OUT_EN | AC_PINCTL_HP_EN, |
| 2677 | AC_PINCTL_IN_EN | AC_PINCTL_VREF_HIZ, |
| 2678 | AC_PINCTL_IN_EN | AC_PINCTL_VREF_50, |
| 2679 | AC_PINCTL_IN_EN | AC_PINCTL_VREF_GRD, |
| 2680 | AC_PINCTL_IN_EN | AC_PINCTL_VREF_80, |
| 2681 | AC_PINCTL_IN_EN | AC_PINCTL_VREF_100, |
| 2682 | }; |
| 2683 | unsigned int old_ctl, new_ctl; |
| 2684 | |
| 2685 | old_ctl = snd_hda_codec_read(codec, nid, 0, |
| 2686 | AC_VERB_GET_PIN_WIDGET_CONTROL, 0); |
| 2687 | new_ctl = ctls[ucontrol->value.enumerated.item[0]]; |
| 2688 | if (old_ctl != new_ctl) { |
Takashi Iwai | 82beb8f | 2007-08-10 17:09:26 +0200 | [diff] [blame] | 2689 | int val; |
| 2690 | snd_hda_codec_write_cache(codec, nid, 0, |
| 2691 | AC_VERB_SET_PIN_WIDGET_CONTROL, |
| 2692 | new_ctl); |
Takashi Iwai | 47fd830 | 2007-08-10 17:11:07 +0200 | [diff] [blame] | 2693 | val = ucontrol->value.enumerated.item[0] >= 3 ? |
| 2694 | HDA_AMP_MUTE : 0; |
| 2695 | snd_hda_codec_amp_stereo(codec, nid, HDA_OUTPUT, 0, |
| 2696 | HDA_AMP_MUTE, val); |
Takashi Iwai | 2fa522b | 2005-05-12 14:51:12 +0200 | [diff] [blame] | 2697 | return 1; |
| 2698 | } |
| 2699 | return 0; |
| 2700 | } |
| 2701 | |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 2702 | static int alc_test_pin_src_info(struct snd_kcontrol *kcontrol, |
| 2703 | struct snd_ctl_elem_info *uinfo) |
Takashi Iwai | 2fa522b | 2005-05-12 14:51:12 +0200 | [diff] [blame] | 2704 | { |
| 2705 | static char *texts[] = { |
| 2706 | "Front", "Surround", "CLFE", "Side" |
| 2707 | }; |
| 2708 | uinfo->type = SNDRV_CTL_ELEM_TYPE_ENUMERATED; |
| 2709 | uinfo->count = 1; |
| 2710 | uinfo->value.enumerated.items = 4; |
| 2711 | if (uinfo->value.enumerated.item >= 4) |
| 2712 | uinfo->value.enumerated.item = 3; |
| 2713 | strcpy(uinfo->value.enumerated.name, texts[uinfo->value.enumerated.item]); |
| 2714 | return 0; |
| 2715 | } |
| 2716 | |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 2717 | static int alc_test_pin_src_get(struct snd_kcontrol *kcontrol, |
| 2718 | struct snd_ctl_elem_value *ucontrol) |
Takashi Iwai | 2fa522b | 2005-05-12 14:51:12 +0200 | [diff] [blame] | 2719 | { |
| 2720 | struct hda_codec *codec = snd_kcontrol_chip(kcontrol); |
| 2721 | hda_nid_t nid = (hda_nid_t)kcontrol->private_value; |
| 2722 | unsigned int sel; |
| 2723 | |
| 2724 | sel = snd_hda_codec_read(codec, nid, 0, AC_VERB_GET_CONNECT_SEL, 0); |
| 2725 | ucontrol->value.enumerated.item[0] = sel & 3; |
| 2726 | return 0; |
| 2727 | } |
| 2728 | |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 2729 | static int alc_test_pin_src_put(struct snd_kcontrol *kcontrol, |
| 2730 | struct snd_ctl_elem_value *ucontrol) |
Takashi Iwai | 2fa522b | 2005-05-12 14:51:12 +0200 | [diff] [blame] | 2731 | { |
| 2732 | struct hda_codec *codec = snd_kcontrol_chip(kcontrol); |
| 2733 | hda_nid_t nid = (hda_nid_t)kcontrol->private_value; |
| 2734 | unsigned int sel; |
| 2735 | |
| 2736 | sel = snd_hda_codec_read(codec, nid, 0, AC_VERB_GET_CONNECT_SEL, 0) & 3; |
| 2737 | if (ucontrol->value.enumerated.item[0] != sel) { |
| 2738 | sel = ucontrol->value.enumerated.item[0] & 3; |
Takashi Iwai | 82beb8f | 2007-08-10 17:09:26 +0200 | [diff] [blame] | 2739 | snd_hda_codec_write_cache(codec, nid, 0, |
| 2740 | AC_VERB_SET_CONNECT_SEL, sel); |
Takashi Iwai | 2fa522b | 2005-05-12 14:51:12 +0200 | [diff] [blame] | 2741 | return 1; |
| 2742 | } |
| 2743 | return 0; |
| 2744 | } |
| 2745 | |
| 2746 | #define PIN_CTL_TEST(xname,nid) { \ |
| 2747 | .iface = SNDRV_CTL_ELEM_IFACE_MIXER, \ |
| 2748 | .name = xname, \ |
| 2749 | .info = alc_test_pin_ctl_info, \ |
| 2750 | .get = alc_test_pin_ctl_get, \ |
| 2751 | .put = alc_test_pin_ctl_put, \ |
| 2752 | .private_value = nid \ |
| 2753 | } |
| 2754 | |
| 2755 | #define PIN_SRC_TEST(xname,nid) { \ |
| 2756 | .iface = SNDRV_CTL_ELEM_IFACE_MIXER, \ |
| 2757 | .name = xname, \ |
| 2758 | .info = alc_test_pin_src_info, \ |
| 2759 | .get = alc_test_pin_src_get, \ |
| 2760 | .put = alc_test_pin_src_put, \ |
| 2761 | .private_value = nid \ |
| 2762 | } |
| 2763 | |
Takashi Iwai | c8b6bf9 | 2005-11-17 14:57:47 +0100 | [diff] [blame] | 2764 | static struct snd_kcontrol_new alc880_test_mixer[] = { |
Takashi Iwai | 05acb86 | 2005-06-10 19:50:25 +0200 | [diff] [blame] | 2765 | HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT), |
| 2766 | HDA_CODEC_VOLUME("Surround Playback Volume", 0x0d, 0x0, HDA_OUTPUT), |
| 2767 | HDA_CODEC_VOLUME("CLFE Playback Volume", 0x0e, 0x0, HDA_OUTPUT), |
| 2768 | HDA_CODEC_VOLUME("Side Playback Volume", 0x0f, 0x0, HDA_OUTPUT), |
Takashi Iwai | 985be54 | 2005-11-02 18:26:49 +0100 | [diff] [blame] | 2769 | HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT), |
| 2770 | HDA_BIND_MUTE("Surround Playback Switch", 0x0d, 2, HDA_INPUT), |
| 2771 | HDA_BIND_MUTE("CLFE Playback Switch", 0x0e, 2, HDA_INPUT), |
| 2772 | HDA_BIND_MUTE("Side Playback Switch", 0x0f, 2, HDA_INPUT), |
Takashi Iwai | 2fa522b | 2005-05-12 14:51:12 +0200 | [diff] [blame] | 2773 | PIN_CTL_TEST("Front Pin Mode", 0x14), |
| 2774 | PIN_CTL_TEST("Surround Pin Mode", 0x15), |
| 2775 | PIN_CTL_TEST("CLFE Pin Mode", 0x16), |
| 2776 | PIN_CTL_TEST("Side Pin Mode", 0x17), |
| 2777 | PIN_CTL_TEST("In-1 Pin Mode", 0x18), |
| 2778 | PIN_CTL_TEST("In-2 Pin Mode", 0x19), |
| 2779 | PIN_CTL_TEST("In-3 Pin Mode", 0x1a), |
| 2780 | PIN_CTL_TEST("In-4 Pin Mode", 0x1b), |
| 2781 | PIN_SRC_TEST("In-1 Pin Source", 0x18), |
| 2782 | PIN_SRC_TEST("In-2 Pin Source", 0x19), |
| 2783 | PIN_SRC_TEST("In-3 Pin Source", 0x1a), |
| 2784 | PIN_SRC_TEST("In-4 Pin Source", 0x1b), |
| 2785 | HDA_CODEC_VOLUME("In-1 Playback Volume", 0x0b, 0x0, HDA_INPUT), |
| 2786 | HDA_CODEC_MUTE("In-1 Playback Switch", 0x0b, 0x0, HDA_INPUT), |
| 2787 | HDA_CODEC_VOLUME("In-2 Playback Volume", 0x0b, 0x1, HDA_INPUT), |
| 2788 | HDA_CODEC_MUTE("In-2 Playback Switch", 0x0b, 0x1, HDA_INPUT), |
| 2789 | HDA_CODEC_VOLUME("In-3 Playback Volume", 0x0b, 0x2, HDA_INPUT), |
| 2790 | HDA_CODEC_MUTE("In-3 Playback Switch", 0x0b, 0x2, HDA_INPUT), |
| 2791 | HDA_CODEC_VOLUME("In-4 Playback Volume", 0x0b, 0x3, HDA_INPUT), |
| 2792 | HDA_CODEC_MUTE("In-4 Playback Switch", 0x0b, 0x3, HDA_INPUT), |
| 2793 | HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x4, HDA_INPUT), |
| 2794 | HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x4, HDA_INPUT), |
Takashi Iwai | 2fa522b | 2005-05-12 14:51:12 +0200 | [diff] [blame] | 2795 | { |
| 2796 | .iface = SNDRV_CTL_ELEM_IFACE_MIXER, |
| 2797 | .name = "Channel Mode", |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 2798 | .info = alc_ch_mode_info, |
| 2799 | .get = alc_ch_mode_get, |
| 2800 | .put = alc_ch_mode_put, |
Takashi Iwai | 2fa522b | 2005-05-12 14:51:12 +0200 | [diff] [blame] | 2801 | }, |
| 2802 | { } /* end */ |
| 2803 | }; |
| 2804 | |
| 2805 | static struct hda_verb alc880_test_init_verbs[] = { |
| 2806 | /* Unmute inputs of 0x0c - 0x0f */ |
Takashi Iwai | 05acb86 | 2005-06-10 19:50:25 +0200 | [diff] [blame] | 2807 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 2808 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 2809 | {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 2810 | {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 2811 | {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 2812 | {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 2813 | {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 2814 | {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
Takashi Iwai | 2fa522b | 2005-05-12 14:51:12 +0200 | [diff] [blame] | 2815 | /* Vol output for 0x0c-0x0f */ |
Takashi Iwai | 05acb86 | 2005-06-10 19:50:25 +0200 | [diff] [blame] | 2816 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 2817 | {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 2818 | {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 2819 | {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
Takashi Iwai | 2fa522b | 2005-05-12 14:51:12 +0200 | [diff] [blame] | 2820 | /* Set output pins 0x14-0x17 */ |
Takashi Iwai | 05acb86 | 2005-06-10 19:50:25 +0200 | [diff] [blame] | 2821 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 2822 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 2823 | {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 2824 | {0x17, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
Takashi Iwai | 2fa522b | 2005-05-12 14:51:12 +0200 | [diff] [blame] | 2825 | /* Unmute output pins 0x14-0x17 */ |
Takashi Iwai | 05acb86 | 2005-06-10 19:50:25 +0200 | [diff] [blame] | 2826 | {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 2827 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 2828 | {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 2829 | {0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
Takashi Iwai | 2fa522b | 2005-05-12 14:51:12 +0200 | [diff] [blame] | 2830 | /* Set input pins 0x18-0x1c */ |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 2831 | {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80}, |
| 2832 | {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80}, |
Takashi Iwai | 05acb86 | 2005-06-10 19:50:25 +0200 | [diff] [blame] | 2833 | {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
| 2834 | {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
| 2835 | {0x1c, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
Takashi Iwai | 2fa522b | 2005-05-12 14:51:12 +0200 | [diff] [blame] | 2836 | /* Mute input pins 0x18-0x1b */ |
Takashi Iwai | 05acb86 | 2005-06-10 19:50:25 +0200 | [diff] [blame] | 2837 | {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
| 2838 | {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
| 2839 | {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
| 2840 | {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
Takashi Iwai | 71fe7b8 | 2005-05-25 18:11:40 +0200 | [diff] [blame] | 2841 | /* ADC set up */ |
Takashi Iwai | 05acb86 | 2005-06-10 19:50:25 +0200 | [diff] [blame] | 2842 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
Takashi Iwai | 71fe7b8 | 2005-05-25 18:11:40 +0200 | [diff] [blame] | 2843 | {0x07, AC_VERB_SET_CONNECT_SEL, 0x00}, |
Takashi Iwai | 05acb86 | 2005-06-10 19:50:25 +0200 | [diff] [blame] | 2844 | {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
Takashi Iwai | 71fe7b8 | 2005-05-25 18:11:40 +0200 | [diff] [blame] | 2845 | {0x08, AC_VERB_SET_CONNECT_SEL, 0x00}, |
Takashi Iwai | 05acb86 | 2005-06-10 19:50:25 +0200 | [diff] [blame] | 2846 | {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
Takashi Iwai | 71fe7b8 | 2005-05-25 18:11:40 +0200 | [diff] [blame] | 2847 | {0x09, AC_VERB_SET_CONNECT_SEL, 0x00}, |
Takashi Iwai | 05acb86 | 2005-06-10 19:50:25 +0200 | [diff] [blame] | 2848 | /* Analog input/passthru */ |
| 2849 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 2850 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
| 2851 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)}, |
| 2852 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)}, |
| 2853 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)}, |
Takashi Iwai | 2fa522b | 2005-05-12 14:51:12 +0200 | [diff] [blame] | 2854 | { } |
| 2855 | }; |
| 2856 | #endif |
| 2857 | |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 2858 | /* |
| 2859 | */ |
| 2860 | |
Takashi Iwai | f5fcc13 | 2006-11-24 17:07:44 +0100 | [diff] [blame] | 2861 | static const char *alc880_models[ALC880_MODEL_LAST] = { |
| 2862 | [ALC880_3ST] = "3stack", |
| 2863 | [ALC880_TCL_S700] = "tcl", |
| 2864 | [ALC880_3ST_DIG] = "3stack-digout", |
| 2865 | [ALC880_CLEVO] = "clevo", |
| 2866 | [ALC880_5ST] = "5stack", |
| 2867 | [ALC880_5ST_DIG] = "5stack-digout", |
| 2868 | [ALC880_W810] = "w810", |
| 2869 | [ALC880_Z71V] = "z71v", |
| 2870 | [ALC880_6ST] = "6stack", |
| 2871 | [ALC880_6ST_DIG] = "6stack-digout", |
| 2872 | [ALC880_ASUS] = "asus", |
| 2873 | [ALC880_ASUS_W1V] = "asus-w1v", |
| 2874 | [ALC880_ASUS_DIG] = "asus-dig", |
| 2875 | [ALC880_ASUS_DIG2] = "asus-dig2", |
| 2876 | [ALC880_UNIWILL_DIG] = "uniwill", |
Tobin Davis | 2cf9f0f | 2007-02-07 16:04:25 +0100 | [diff] [blame] | 2877 | [ALC880_UNIWILL_P53] = "uniwill-p53", |
| 2878 | [ALC880_FUJITSU] = "fujitsu", |
Takashi Iwai | f5fcc13 | 2006-11-24 17:07:44 +0100 | [diff] [blame] | 2879 | [ALC880_F1734] = "F1734", |
| 2880 | [ALC880_LG] = "lg", |
| 2881 | [ALC880_LG_LW] = "lg-lw", |
Takashi Iwai | 2fa522b | 2005-05-12 14:51:12 +0200 | [diff] [blame] | 2882 | #ifdef CONFIG_SND_DEBUG |
Takashi Iwai | f5fcc13 | 2006-11-24 17:07:44 +0100 | [diff] [blame] | 2883 | [ALC880_TEST] = "test", |
Takashi Iwai | 2fa522b | 2005-05-12 14:51:12 +0200 | [diff] [blame] | 2884 | #endif |
Takashi Iwai | f5fcc13 | 2006-11-24 17:07:44 +0100 | [diff] [blame] | 2885 | [ALC880_AUTO] = "auto", |
| 2886 | }; |
| 2887 | |
| 2888 | static struct snd_pci_quirk alc880_cfg_tbl[] = { |
Takashi Iwai | ac3e374 | 2007-12-17 17:14:18 +0100 | [diff] [blame] | 2889 | SND_PCI_QUIRK(0x1019, 0x0f69, "Coeus G610P", ALC880_W810), |
Takashi Iwai | f5fcc13 | 2006-11-24 17:07:44 +0100 | [diff] [blame] | 2890 | SND_PCI_QUIRK(0x1019, 0xa880, "ECS", ALC880_5ST_DIG), |
| 2891 | SND_PCI_QUIRK(0x1019, 0xa884, "Acer APFV", ALC880_6ST), |
| 2892 | SND_PCI_QUIRK(0x1025, 0x0070, "ULI", ALC880_3ST_DIG), |
| 2893 | SND_PCI_QUIRK(0x1025, 0x0077, "ULI", ALC880_6ST_DIG), |
| 2894 | SND_PCI_QUIRK(0x1025, 0x0078, "ULI", ALC880_6ST_DIG), |
| 2895 | SND_PCI_QUIRK(0x1025, 0x0087, "ULI", ALC880_6ST_DIG), |
| 2896 | SND_PCI_QUIRK(0x1025, 0xe309, "ULI", ALC880_3ST_DIG), |
| 2897 | SND_PCI_QUIRK(0x1025, 0xe310, "ULI", ALC880_3ST), |
Takashi Iwai | f5fcc13 | 2006-11-24 17:07:44 +0100 | [diff] [blame] | 2898 | SND_PCI_QUIRK(0x1039, 0x1234, NULL, ALC880_6ST_DIG), |
| 2899 | SND_PCI_QUIRK(0x103c, 0x2a09, "HP", ALC880_5ST), |
Takashi Iwai | f5fcc13 | 2006-11-24 17:07:44 +0100 | [diff] [blame] | 2900 | SND_PCI_QUIRK(0x1043, 0x10b3, "ASUS W1V", ALC880_ASUS_W1V), |
| 2901 | SND_PCI_QUIRK(0x1043, 0x10c2, "ASUS W6A", ALC880_ASUS_DIG), |
| 2902 | SND_PCI_QUIRK(0x1043, 0x10c3, "ASUS Wxx", ALC880_ASUS_DIG), |
| 2903 | SND_PCI_QUIRK(0x1043, 0x1113, "ASUS", ALC880_ASUS_DIG), |
| 2904 | SND_PCI_QUIRK(0x1043, 0x1123, "ASUS", ALC880_ASUS_DIG), |
| 2905 | SND_PCI_QUIRK(0x1043, 0x1173, "ASUS", ALC880_ASUS_DIG), |
| 2906 | SND_PCI_QUIRK(0x1043, 0x1964, "ASUS Z71V", ALC880_Z71V), |
| 2907 | /* SND_PCI_QUIRK(0x1043, 0x1964, "ASUS", ALC880_ASUS_DIG), */ |
| 2908 | SND_PCI_QUIRK(0x1043, 0x1973, "ASUS", ALC880_ASUS_DIG), |
| 2909 | SND_PCI_QUIRK(0x1043, 0x19b3, "ASUS", ALC880_ASUS_DIG), |
Tobin Davis | 0e4ceb7 | 2007-01-08 10:54:26 +0100 | [diff] [blame] | 2910 | SND_PCI_QUIRK(0x1043, 0x814e, "ASUS", ALC880_ASUS), |
Takashi Iwai | f5fcc13 | 2006-11-24 17:07:44 +0100 | [diff] [blame] | 2911 | SND_PCI_QUIRK(0x1043, 0x8181, "ASUS P4GPL", ALC880_ASUS_DIG), |
| 2912 | SND_PCI_QUIRK(0x1043, 0x8196, "ASUS P5GD1", ALC880_6ST), |
| 2913 | SND_PCI_QUIRK(0x1043, 0x81b4, "ASUS", ALC880_6ST), |
Takashi Iwai | ac3e374 | 2007-12-17 17:14:18 +0100 | [diff] [blame] | 2914 | SND_PCI_QUIRK(0x1043, 0, "ASUS", ALC880_ASUS), /* default ASUS */ |
Takashi Iwai | f5fcc13 | 2006-11-24 17:07:44 +0100 | [diff] [blame] | 2915 | SND_PCI_QUIRK(0x104d, 0x81a0, "Sony", ALC880_3ST), |
Takashi Iwai | ac3e374 | 2007-12-17 17:14:18 +0100 | [diff] [blame] | 2916 | SND_PCI_QUIRK(0x104d, 0x81d6, "Sony", ALC880_3ST), |
| 2917 | SND_PCI_QUIRK(0x107b, 0x3032, "Gateway", ALC880_5ST), |
Takashi Iwai | f5fcc13 | 2006-11-24 17:07:44 +0100 | [diff] [blame] | 2918 | SND_PCI_QUIRK(0x107b, 0x3033, "Gateway", ALC880_5ST), |
| 2919 | SND_PCI_QUIRK(0x107b, 0x4039, "Gateway", ALC880_5ST), |
Takashi Iwai | f5fcc13 | 2006-11-24 17:07:44 +0100 | [diff] [blame] | 2920 | SND_PCI_QUIRK(0x1297, 0xc790, "Shuttle ST20G5", ALC880_6ST_DIG), |
| 2921 | SND_PCI_QUIRK(0x1458, 0xa102, "Gigabyte K8", ALC880_6ST_DIG), |
| 2922 | SND_PCI_QUIRK(0x1462, 0x1150, "MSI", ALC880_6ST_DIG), |
| 2923 | SND_PCI_QUIRK(0x1509, 0x925d, "FIC P4M", ALC880_6ST_DIG), |
Takashi Iwai | ac3e374 | 2007-12-17 17:14:18 +0100 | [diff] [blame] | 2924 | SND_PCI_QUIRK(0x1558, 0x0520, "Clevo m520G", ALC880_CLEVO), |
| 2925 | SND_PCI_QUIRK(0x1558, 0x0660, "Clevo m655n", ALC880_CLEVO), |
Takashi Iwai | f5fcc13 | 2006-11-24 17:07:44 +0100 | [diff] [blame] | 2926 | SND_PCI_QUIRK(0x1558, 0x5401, "ASUS", ALC880_ASUS_DIG2), |
Takashi Iwai | ac3e374 | 2007-12-17 17:14:18 +0100 | [diff] [blame] | 2927 | SND_PCI_QUIRK(0x1565, 0x8202, "Biostar", ALC880_5ST_DIG), |
Takashi Iwai | f5fcc13 | 2006-11-24 17:07:44 +0100 | [diff] [blame] | 2928 | SND_PCI_QUIRK(0x1584, 0x9050, "Uniwill", ALC880_UNIWILL_DIG), |
Takashi Iwai | ac3e374 | 2007-12-17 17:14:18 +0100 | [diff] [blame] | 2929 | SND_PCI_QUIRK(0x1584, 0x9054, "Uniwlll", ALC880_F1734), |
Takashi Iwai | f5fcc13 | 2006-11-24 17:07:44 +0100 | [diff] [blame] | 2930 | SND_PCI_QUIRK(0x1584, 0x9070, "Uniwill", ALC880_UNIWILL), |
| 2931 | SND_PCI_QUIRK(0x1584, 0x9077, "Uniwill P53", ALC880_UNIWILL_P53), |
Takashi Iwai | ac3e374 | 2007-12-17 17:14:18 +0100 | [diff] [blame] | 2932 | SND_PCI_QUIRK(0x161f, 0x203d, "W810", ALC880_W810), |
| 2933 | SND_PCI_QUIRK(0x1695, 0x400d, "EPoX", ALC880_5ST_DIG), |
Takashi Iwai | f5fcc13 | 2006-11-24 17:07:44 +0100 | [diff] [blame] | 2934 | SND_PCI_QUIRK(0x1695, 0x4012, "EPox EP-5LDA", ALC880_5ST_DIG), |
Takashi Iwai | f5fcc13 | 2006-11-24 17:07:44 +0100 | [diff] [blame] | 2935 | SND_PCI_QUIRK(0x1734, 0x107c, "FSC F1734", ALC880_F1734), |
Takashi Iwai | ac3e374 | 2007-12-17 17:14:18 +0100 | [diff] [blame] | 2936 | SND_PCI_QUIRK(0x1734, 0x10ac, "FSC", ALC880_UNIWILL), |
Tobin Davis | 2cf9f0f | 2007-02-07 16:04:25 +0100 | [diff] [blame] | 2937 | SND_PCI_QUIRK(0x1734, 0x10b0, "Fujitsu", ALC880_FUJITSU), |
Takashi Iwai | ac3e374 | 2007-12-17 17:14:18 +0100 | [diff] [blame] | 2938 | SND_PCI_QUIRK(0x1854, 0x0018, "LG LW20", ALC880_LG_LW), |
Takashi Iwai | f5fcc13 | 2006-11-24 17:07:44 +0100 | [diff] [blame] | 2939 | SND_PCI_QUIRK(0x1854, 0x003b, "LG", ALC880_LG), |
| 2940 | SND_PCI_QUIRK(0x1854, 0x0068, "LG w1", ALC880_LG), |
Takashi Iwai | f5fcc13 | 2006-11-24 17:07:44 +0100 | [diff] [blame] | 2941 | SND_PCI_QUIRK(0x1854, 0x0077, "LG LW25", ALC880_LG_LW), |
Takashi Iwai | ac3e374 | 2007-12-17 17:14:18 +0100 | [diff] [blame] | 2942 | SND_PCI_QUIRK(0x19db, 0x4188, "TCL S700", ALC880_TCL_S700), |
| 2943 | SND_PCI_QUIRK(0x2668, 0x8086, NULL, ALC880_6ST_DIG), /* broken BIOS */ |
| 2944 | SND_PCI_QUIRK(0x8086, 0x2668, NULL, ALC880_6ST_DIG), |
| 2945 | SND_PCI_QUIRK(0x8086, 0xa100, "Intel mobo", ALC880_5ST_DIG), |
Takashi Iwai | f5fcc13 | 2006-11-24 17:07:44 +0100 | [diff] [blame] | 2946 | SND_PCI_QUIRK(0x8086, 0xd400, "Intel mobo", ALC880_5ST_DIG), |
| 2947 | SND_PCI_QUIRK(0x8086, 0xd401, "Intel mobo", ALC880_5ST_DIG), |
Takashi Iwai | ac3e374 | 2007-12-17 17:14:18 +0100 | [diff] [blame] | 2948 | SND_PCI_QUIRK(0x8086, 0xd402, "Intel mobo", ALC880_3ST_DIG), |
Takashi Iwai | f5fcc13 | 2006-11-24 17:07:44 +0100 | [diff] [blame] | 2949 | SND_PCI_QUIRK(0x8086, 0xe224, "Intel mobo", ALC880_5ST_DIG), |
Takashi Iwai | ac3e374 | 2007-12-17 17:14:18 +0100 | [diff] [blame] | 2950 | SND_PCI_QUIRK(0x8086, 0xe305, "Intel mobo", ALC880_3ST_DIG), |
| 2951 | SND_PCI_QUIRK(0x8086, 0xe308, "Intel mobo", ALC880_3ST_DIG), |
Takashi Iwai | f5fcc13 | 2006-11-24 17:07:44 +0100 | [diff] [blame] | 2952 | SND_PCI_QUIRK(0x8086, 0xe400, "Intel mobo", ALC880_5ST_DIG), |
| 2953 | SND_PCI_QUIRK(0x8086, 0xe401, "Intel mobo", ALC880_5ST_DIG), |
| 2954 | SND_PCI_QUIRK(0x8086, 0xe402, "Intel mobo", ALC880_5ST_DIG), |
Takashi Iwai | ac3e374 | 2007-12-17 17:14:18 +0100 | [diff] [blame] | 2955 | SND_PCI_QUIRK(0x8086, 0, "Intel mobo", ALC880_3ST), /* default Intel */ |
| 2956 | SND_PCI_QUIRK(0xa0a0, 0x0560, "AOpen i915GMm-HFS", ALC880_5ST_DIG), |
| 2957 | SND_PCI_QUIRK(0xe803, 0x1019, NULL, ALC880_6ST_DIG), |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 2958 | {} |
| 2959 | }; |
| 2960 | |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 2961 | /* |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 2962 | * ALC880 codec presets |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 2963 | */ |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 2964 | static struct alc_config_preset alc880_presets[] = { |
| 2965 | [ALC880_3ST] = { |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 2966 | .mixers = { alc880_three_stack_mixer }, |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 2967 | .init_verbs = { alc880_volume_init_verbs, |
| 2968 | alc880_pin_3stack_init_verbs }, |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 2969 | .num_dacs = ARRAY_SIZE(alc880_dac_nids), |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 2970 | .dac_nids = alc880_dac_nids, |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 2971 | .num_channel_mode = ARRAY_SIZE(alc880_threestack_modes), |
| 2972 | .channel_mode = alc880_threestack_modes, |
Takashi Iwai | 4e195a7 | 2006-07-28 14:47:34 +0200 | [diff] [blame] | 2973 | .need_dac_fix = 1, |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 2974 | .input_mux = &alc880_capture_source, |
| 2975 | }, |
| 2976 | [ALC880_3ST_DIG] = { |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 2977 | .mixers = { alc880_three_stack_mixer }, |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 2978 | .init_verbs = { alc880_volume_init_verbs, |
| 2979 | alc880_pin_3stack_init_verbs }, |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 2980 | .num_dacs = ARRAY_SIZE(alc880_dac_nids), |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 2981 | .dac_nids = alc880_dac_nids, |
| 2982 | .dig_out_nid = ALC880_DIGOUT_NID, |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 2983 | .num_channel_mode = ARRAY_SIZE(alc880_threestack_modes), |
| 2984 | .channel_mode = alc880_threestack_modes, |
Takashi Iwai | 4e195a7 | 2006-07-28 14:47:34 +0200 | [diff] [blame] | 2985 | .need_dac_fix = 1, |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 2986 | .input_mux = &alc880_capture_source, |
| 2987 | }, |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 2988 | [ALC880_TCL_S700] = { |
| 2989 | .mixers = { alc880_tcl_s700_mixer }, |
| 2990 | .init_verbs = { alc880_volume_init_verbs, |
| 2991 | alc880_pin_tcl_S700_init_verbs, |
| 2992 | alc880_gpio2_init_verbs }, |
| 2993 | .num_dacs = ARRAY_SIZE(alc880_dac_nids), |
| 2994 | .dac_nids = alc880_dac_nids, |
| 2995 | .hp_nid = 0x03, |
| 2996 | .num_channel_mode = ARRAY_SIZE(alc880_2_jack_modes), |
| 2997 | .channel_mode = alc880_2_jack_modes, |
| 2998 | .input_mux = &alc880_capture_source, |
| 2999 | }, |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 3000 | [ALC880_5ST] = { |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 3001 | .mixers = { alc880_three_stack_mixer, |
| 3002 | alc880_five_stack_mixer}, |
| 3003 | .init_verbs = { alc880_volume_init_verbs, |
| 3004 | alc880_pin_5stack_init_verbs }, |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 3005 | .num_dacs = ARRAY_SIZE(alc880_dac_nids), |
| 3006 | .dac_nids = alc880_dac_nids, |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 3007 | .num_channel_mode = ARRAY_SIZE(alc880_fivestack_modes), |
| 3008 | .channel_mode = alc880_fivestack_modes, |
| 3009 | .input_mux = &alc880_capture_source, |
| 3010 | }, |
| 3011 | [ALC880_5ST_DIG] = { |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 3012 | .mixers = { alc880_three_stack_mixer, |
| 3013 | alc880_five_stack_mixer }, |
| 3014 | .init_verbs = { alc880_volume_init_verbs, |
| 3015 | alc880_pin_5stack_init_verbs }, |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 3016 | .num_dacs = ARRAY_SIZE(alc880_dac_nids), |
| 3017 | .dac_nids = alc880_dac_nids, |
| 3018 | .dig_out_nid = ALC880_DIGOUT_NID, |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 3019 | .num_channel_mode = ARRAY_SIZE(alc880_fivestack_modes), |
| 3020 | .channel_mode = alc880_fivestack_modes, |
| 3021 | .input_mux = &alc880_capture_source, |
| 3022 | }, |
Takashi Iwai | b6482d4 | 2005-06-27 15:32:43 +0200 | [diff] [blame] | 3023 | [ALC880_6ST] = { |
| 3024 | .mixers = { alc880_six_stack_mixer }, |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 3025 | .init_verbs = { alc880_volume_init_verbs, |
| 3026 | alc880_pin_6stack_init_verbs }, |
Takashi Iwai | b6482d4 | 2005-06-27 15:32:43 +0200 | [diff] [blame] | 3027 | .num_dacs = ARRAY_SIZE(alc880_6st_dac_nids), |
| 3028 | .dac_nids = alc880_6st_dac_nids, |
| 3029 | .num_channel_mode = ARRAY_SIZE(alc880_sixstack_modes), |
| 3030 | .channel_mode = alc880_sixstack_modes, |
| 3031 | .input_mux = &alc880_6stack_capture_source, |
| 3032 | }, |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 3033 | [ALC880_6ST_DIG] = { |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 3034 | .mixers = { alc880_six_stack_mixer }, |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 3035 | .init_verbs = { alc880_volume_init_verbs, |
| 3036 | alc880_pin_6stack_init_verbs }, |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 3037 | .num_dacs = ARRAY_SIZE(alc880_6st_dac_nids), |
| 3038 | .dac_nids = alc880_6st_dac_nids, |
| 3039 | .dig_out_nid = ALC880_DIGOUT_NID, |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 3040 | .num_channel_mode = ARRAY_SIZE(alc880_sixstack_modes), |
| 3041 | .channel_mode = alc880_sixstack_modes, |
| 3042 | .input_mux = &alc880_6stack_capture_source, |
| 3043 | }, |
| 3044 | [ALC880_W810] = { |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 3045 | .mixers = { alc880_w810_base_mixer }, |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 3046 | .init_verbs = { alc880_volume_init_verbs, |
| 3047 | alc880_pin_w810_init_verbs, |
Takashi Iwai | b0af0de | 2005-06-21 14:49:19 +0200 | [diff] [blame] | 3048 | alc880_gpio2_init_verbs }, |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 3049 | .num_dacs = ARRAY_SIZE(alc880_w810_dac_nids), |
| 3050 | .dac_nids = alc880_w810_dac_nids, |
| 3051 | .dig_out_nid = ALC880_DIGOUT_NID, |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 3052 | .num_channel_mode = ARRAY_SIZE(alc880_w810_modes), |
| 3053 | .channel_mode = alc880_w810_modes, |
| 3054 | .input_mux = &alc880_capture_source, |
| 3055 | }, |
| 3056 | [ALC880_Z71V] = { |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 3057 | .mixers = { alc880_z71v_mixer }, |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 3058 | .init_verbs = { alc880_volume_init_verbs, |
| 3059 | alc880_pin_z71v_init_verbs }, |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 3060 | .num_dacs = ARRAY_SIZE(alc880_z71v_dac_nids), |
| 3061 | .dac_nids = alc880_z71v_dac_nids, |
| 3062 | .dig_out_nid = ALC880_DIGOUT_NID, |
| 3063 | .hp_nid = 0x03, |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 3064 | .num_channel_mode = ARRAY_SIZE(alc880_2_jack_modes), |
| 3065 | .channel_mode = alc880_2_jack_modes, |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 3066 | .input_mux = &alc880_capture_source, |
| 3067 | }, |
| 3068 | [ALC880_F1734] = { |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 3069 | .mixers = { alc880_f1734_mixer }, |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 3070 | .init_verbs = { alc880_volume_init_verbs, |
| 3071 | alc880_pin_f1734_init_verbs }, |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 3072 | .num_dacs = ARRAY_SIZE(alc880_f1734_dac_nids), |
| 3073 | .dac_nids = alc880_f1734_dac_nids, |
| 3074 | .hp_nid = 0x02, |
| 3075 | .num_channel_mode = ARRAY_SIZE(alc880_2_jack_modes), |
| 3076 | .channel_mode = alc880_2_jack_modes, |
Takashi Iwai | 937b416 | 2008-02-11 14:52:36 +0100 | [diff] [blame] | 3077 | .input_mux = &alc880_f1734_capture_source, |
| 3078 | .unsol_event = alc880_uniwill_p53_unsol_event, |
| 3079 | .init_hook = alc880_uniwill_p53_hp_automute, |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 3080 | }, |
| 3081 | [ALC880_ASUS] = { |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 3082 | .mixers = { alc880_asus_mixer }, |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 3083 | .init_verbs = { alc880_volume_init_verbs, |
| 3084 | alc880_pin_asus_init_verbs, |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 3085 | alc880_gpio1_init_verbs }, |
| 3086 | .num_dacs = ARRAY_SIZE(alc880_asus_dac_nids), |
| 3087 | .dac_nids = alc880_asus_dac_nids, |
| 3088 | .num_channel_mode = ARRAY_SIZE(alc880_asus_modes), |
| 3089 | .channel_mode = alc880_asus_modes, |
Takashi Iwai | 4e195a7 | 2006-07-28 14:47:34 +0200 | [diff] [blame] | 3090 | .need_dac_fix = 1, |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 3091 | .input_mux = &alc880_capture_source, |
| 3092 | }, |
| 3093 | [ALC880_ASUS_DIG] = { |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 3094 | .mixers = { alc880_asus_mixer }, |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 3095 | .init_verbs = { alc880_volume_init_verbs, |
| 3096 | alc880_pin_asus_init_verbs, |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 3097 | alc880_gpio1_init_verbs }, |
| 3098 | .num_dacs = ARRAY_SIZE(alc880_asus_dac_nids), |
| 3099 | .dac_nids = alc880_asus_dac_nids, |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 3100 | .dig_out_nid = ALC880_DIGOUT_NID, |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 3101 | .num_channel_mode = ARRAY_SIZE(alc880_asus_modes), |
| 3102 | .channel_mode = alc880_asus_modes, |
Takashi Iwai | 4e195a7 | 2006-07-28 14:47:34 +0200 | [diff] [blame] | 3103 | .need_dac_fix = 1, |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 3104 | .input_mux = &alc880_capture_source, |
| 3105 | }, |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 3106 | [ALC880_ASUS_DIG2] = { |
| 3107 | .mixers = { alc880_asus_mixer }, |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 3108 | .init_verbs = { alc880_volume_init_verbs, |
| 3109 | alc880_pin_asus_init_verbs, |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 3110 | alc880_gpio2_init_verbs }, /* use GPIO2 */ |
| 3111 | .num_dacs = ARRAY_SIZE(alc880_asus_dac_nids), |
| 3112 | .dac_nids = alc880_asus_dac_nids, |
| 3113 | .dig_out_nid = ALC880_DIGOUT_NID, |
| 3114 | .num_channel_mode = ARRAY_SIZE(alc880_asus_modes), |
| 3115 | .channel_mode = alc880_asus_modes, |
Takashi Iwai | 4e195a7 | 2006-07-28 14:47:34 +0200 | [diff] [blame] | 3116 | .need_dac_fix = 1, |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 3117 | .input_mux = &alc880_capture_source, |
| 3118 | }, |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 3119 | [ALC880_ASUS_W1V] = { |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 3120 | .mixers = { alc880_asus_mixer, alc880_asus_w1v_mixer }, |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 3121 | .init_verbs = { alc880_volume_init_verbs, |
| 3122 | alc880_pin_asus_init_verbs, |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 3123 | alc880_gpio1_init_verbs }, |
| 3124 | .num_dacs = ARRAY_SIZE(alc880_asus_dac_nids), |
| 3125 | .dac_nids = alc880_asus_dac_nids, |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 3126 | .dig_out_nid = ALC880_DIGOUT_NID, |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 3127 | .num_channel_mode = ARRAY_SIZE(alc880_asus_modes), |
| 3128 | .channel_mode = alc880_asus_modes, |
Takashi Iwai | 4e195a7 | 2006-07-28 14:47:34 +0200 | [diff] [blame] | 3129 | .need_dac_fix = 1, |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 3130 | .input_mux = &alc880_capture_source, |
| 3131 | }, |
| 3132 | [ALC880_UNIWILL_DIG] = { |
Takashi Iwai | 3c10a9d | 2005-08-23 20:02:27 +0200 | [diff] [blame] | 3133 | .mixers = { alc880_asus_mixer, alc880_pcbeep_mixer }, |
Kailang Yang | ccc656c | 2006-10-17 12:32:26 +0200 | [diff] [blame] | 3134 | .init_verbs = { alc880_volume_init_verbs, |
| 3135 | alc880_pin_asus_init_verbs }, |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 3136 | .num_dacs = ARRAY_SIZE(alc880_asus_dac_nids), |
| 3137 | .dac_nids = alc880_asus_dac_nids, |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 3138 | .dig_out_nid = ALC880_DIGOUT_NID, |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 3139 | .num_channel_mode = ARRAY_SIZE(alc880_asus_modes), |
| 3140 | .channel_mode = alc880_asus_modes, |
Takashi Iwai | 4e195a7 | 2006-07-28 14:47:34 +0200 | [diff] [blame] | 3141 | .need_dac_fix = 1, |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 3142 | .input_mux = &alc880_capture_source, |
| 3143 | }, |
Kailang Yang | ccc656c | 2006-10-17 12:32:26 +0200 | [diff] [blame] | 3144 | [ALC880_UNIWILL] = { |
| 3145 | .mixers = { alc880_uniwill_mixer }, |
| 3146 | .init_verbs = { alc880_volume_init_verbs, |
| 3147 | alc880_uniwill_init_verbs }, |
| 3148 | .num_dacs = ARRAY_SIZE(alc880_asus_dac_nids), |
| 3149 | .dac_nids = alc880_asus_dac_nids, |
| 3150 | .dig_out_nid = ALC880_DIGOUT_NID, |
| 3151 | .num_channel_mode = ARRAY_SIZE(alc880_threestack_modes), |
| 3152 | .channel_mode = alc880_threestack_modes, |
| 3153 | .need_dac_fix = 1, |
| 3154 | .input_mux = &alc880_capture_source, |
| 3155 | .unsol_event = alc880_uniwill_unsol_event, |
| 3156 | .init_hook = alc880_uniwill_automute, |
| 3157 | }, |
| 3158 | [ALC880_UNIWILL_P53] = { |
| 3159 | .mixers = { alc880_uniwill_p53_mixer }, |
| 3160 | .init_verbs = { alc880_volume_init_verbs, |
| 3161 | alc880_uniwill_p53_init_verbs }, |
| 3162 | .num_dacs = ARRAY_SIZE(alc880_asus_dac_nids), |
| 3163 | .dac_nids = alc880_asus_dac_nids, |
| 3164 | .num_channel_mode = ARRAY_SIZE(alc880_w810_modes), |
Tobin Davis | 2cf9f0f | 2007-02-07 16:04:25 +0100 | [diff] [blame] | 3165 | .channel_mode = alc880_threestack_modes, |
| 3166 | .input_mux = &alc880_capture_source, |
| 3167 | .unsol_event = alc880_uniwill_p53_unsol_event, |
| 3168 | .init_hook = alc880_uniwill_p53_hp_automute, |
| 3169 | }, |
| 3170 | [ALC880_FUJITSU] = { |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 3171 | .mixers = { alc880_fujitsu_mixer, |
Tobin Davis | 2cf9f0f | 2007-02-07 16:04:25 +0100 | [diff] [blame] | 3172 | alc880_pcbeep_mixer, }, |
| 3173 | .init_verbs = { alc880_volume_init_verbs, |
| 3174 | alc880_uniwill_p53_init_verbs, |
| 3175 | alc880_beep_init_verbs }, |
| 3176 | .num_dacs = ARRAY_SIZE(alc880_dac_nids), |
| 3177 | .dac_nids = alc880_dac_nids, |
Takashi Iwai | d53d7d9 | 2007-08-20 15:20:02 +0200 | [diff] [blame] | 3178 | .dig_out_nid = ALC880_DIGOUT_NID, |
Tobin Davis | 2cf9f0f | 2007-02-07 16:04:25 +0100 | [diff] [blame] | 3179 | .num_channel_mode = ARRAY_SIZE(alc880_2_jack_modes), |
| 3180 | .channel_mode = alc880_2_jack_modes, |
Kailang Yang | ccc656c | 2006-10-17 12:32:26 +0200 | [diff] [blame] | 3181 | .input_mux = &alc880_capture_source, |
| 3182 | .unsol_event = alc880_uniwill_p53_unsol_event, |
| 3183 | .init_hook = alc880_uniwill_p53_hp_automute, |
| 3184 | }, |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 3185 | [ALC880_CLEVO] = { |
| 3186 | .mixers = { alc880_three_stack_mixer }, |
| 3187 | .init_verbs = { alc880_volume_init_verbs, |
| 3188 | alc880_pin_clevo_init_verbs }, |
| 3189 | .num_dacs = ARRAY_SIZE(alc880_dac_nids), |
| 3190 | .dac_nids = alc880_dac_nids, |
| 3191 | .hp_nid = 0x03, |
| 3192 | .num_channel_mode = ARRAY_SIZE(alc880_threestack_modes), |
| 3193 | .channel_mode = alc880_threestack_modes, |
Takashi Iwai | 4e195a7 | 2006-07-28 14:47:34 +0200 | [diff] [blame] | 3194 | .need_dac_fix = 1, |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 3195 | .input_mux = &alc880_capture_source, |
| 3196 | }, |
Takashi Iwai | ae6b813 | 2006-03-03 16:47:17 +0100 | [diff] [blame] | 3197 | [ALC880_LG] = { |
| 3198 | .mixers = { alc880_lg_mixer }, |
| 3199 | .init_verbs = { alc880_volume_init_verbs, |
| 3200 | alc880_lg_init_verbs }, |
| 3201 | .num_dacs = ARRAY_SIZE(alc880_lg_dac_nids), |
| 3202 | .dac_nids = alc880_lg_dac_nids, |
| 3203 | .dig_out_nid = ALC880_DIGOUT_NID, |
| 3204 | .num_channel_mode = ARRAY_SIZE(alc880_lg_ch_modes), |
| 3205 | .channel_mode = alc880_lg_ch_modes, |
Takashi Iwai | 4e195a7 | 2006-07-28 14:47:34 +0200 | [diff] [blame] | 3206 | .need_dac_fix = 1, |
Takashi Iwai | ae6b813 | 2006-03-03 16:47:17 +0100 | [diff] [blame] | 3207 | .input_mux = &alc880_lg_capture_source, |
| 3208 | .unsol_event = alc880_lg_unsol_event, |
| 3209 | .init_hook = alc880_lg_automute, |
Takashi Iwai | cb53c62 | 2007-08-10 17:21:45 +0200 | [diff] [blame] | 3210 | #ifdef CONFIG_SND_HDA_POWER_SAVE |
| 3211 | .loopbacks = alc880_lg_loopbacks, |
| 3212 | #endif |
Takashi Iwai | ae6b813 | 2006-03-03 16:47:17 +0100 | [diff] [blame] | 3213 | }, |
Takashi Iwai | d681518 | 2006-03-23 16:06:23 +0100 | [diff] [blame] | 3214 | [ALC880_LG_LW] = { |
| 3215 | .mixers = { alc880_lg_lw_mixer }, |
| 3216 | .init_verbs = { alc880_volume_init_verbs, |
| 3217 | alc880_lg_lw_init_verbs }, |
Claudio Matsuoka | 0a8c5da | 2007-07-04 15:17:38 +0200 | [diff] [blame] | 3218 | .num_dacs = ARRAY_SIZE(alc880_dac_nids), |
Takashi Iwai | d681518 | 2006-03-23 16:06:23 +0100 | [diff] [blame] | 3219 | .dac_nids = alc880_dac_nids, |
| 3220 | .dig_out_nid = ALC880_DIGOUT_NID, |
Claudio Matsuoka | 0a8c5da | 2007-07-04 15:17:38 +0200 | [diff] [blame] | 3221 | .num_channel_mode = ARRAY_SIZE(alc880_lg_lw_modes), |
| 3222 | .channel_mode = alc880_lg_lw_modes, |
Takashi Iwai | d681518 | 2006-03-23 16:06:23 +0100 | [diff] [blame] | 3223 | .input_mux = &alc880_lg_lw_capture_source, |
| 3224 | .unsol_event = alc880_lg_lw_unsol_event, |
| 3225 | .init_hook = alc880_lg_lw_automute, |
| 3226 | }, |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 3227 | #ifdef CONFIG_SND_DEBUG |
| 3228 | [ALC880_TEST] = { |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 3229 | .mixers = { alc880_test_mixer }, |
| 3230 | .init_verbs = { alc880_test_init_verbs }, |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 3231 | .num_dacs = ARRAY_SIZE(alc880_test_dac_nids), |
| 3232 | .dac_nids = alc880_test_dac_nids, |
| 3233 | .dig_out_nid = ALC880_DIGOUT_NID, |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 3234 | .num_channel_mode = ARRAY_SIZE(alc880_test_modes), |
| 3235 | .channel_mode = alc880_test_modes, |
| 3236 | .input_mux = &alc880_test_capture_source, |
| 3237 | }, |
| 3238 | #endif |
| 3239 | }; |
| 3240 | |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 3241 | /* |
| 3242 | * Automatic parse of I/O pins from the BIOS configuration |
| 3243 | */ |
| 3244 | |
| 3245 | #define NUM_CONTROL_ALLOC 32 |
| 3246 | #define NUM_VERB_ALLOC 32 |
| 3247 | |
| 3248 | enum { |
| 3249 | ALC_CTL_WIDGET_VOL, |
| 3250 | ALC_CTL_WIDGET_MUTE, |
| 3251 | ALC_CTL_BIND_MUTE, |
| 3252 | }; |
Takashi Iwai | c8b6bf9 | 2005-11-17 14:57:47 +0100 | [diff] [blame] | 3253 | static struct snd_kcontrol_new alc880_control_templates[] = { |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 3254 | HDA_CODEC_VOLUME(NULL, 0, 0, 0), |
| 3255 | HDA_CODEC_MUTE(NULL, 0, 0, 0), |
Takashi Iwai | 985be54 | 2005-11-02 18:26:49 +0100 | [diff] [blame] | 3256 | HDA_BIND_MUTE(NULL, 0, 0, 0), |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 3257 | }; |
| 3258 | |
| 3259 | /* add dynamic controls */ |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 3260 | static int add_control(struct alc_spec *spec, int type, const char *name, |
| 3261 | unsigned long val) |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 3262 | { |
Takashi Iwai | c8b6bf9 | 2005-11-17 14:57:47 +0100 | [diff] [blame] | 3263 | struct snd_kcontrol_new *knew; |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 3264 | |
| 3265 | if (spec->num_kctl_used >= spec->num_kctl_alloc) { |
| 3266 | int num = spec->num_kctl_alloc + NUM_CONTROL_ALLOC; |
| 3267 | |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 3268 | /* array + terminator */ |
| 3269 | knew = kcalloc(num + 1, sizeof(*knew), GFP_KERNEL); |
| 3270 | if (!knew) |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 3271 | return -ENOMEM; |
| 3272 | if (spec->kctl_alloc) { |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 3273 | memcpy(knew, spec->kctl_alloc, |
| 3274 | sizeof(*knew) * spec->num_kctl_alloc); |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 3275 | kfree(spec->kctl_alloc); |
| 3276 | } |
| 3277 | spec->kctl_alloc = knew; |
| 3278 | spec->num_kctl_alloc = num; |
| 3279 | } |
| 3280 | |
| 3281 | knew = &spec->kctl_alloc[spec->num_kctl_used]; |
| 3282 | *knew = alc880_control_templates[type]; |
Paulo Marques | 543537b | 2005-06-23 00:09:02 -0700 | [diff] [blame] | 3283 | knew->name = kstrdup(name, GFP_KERNEL); |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 3284 | if (!knew->name) |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 3285 | return -ENOMEM; |
| 3286 | knew->private_value = val; |
| 3287 | spec->num_kctl_used++; |
| 3288 | return 0; |
| 3289 | } |
| 3290 | |
| 3291 | #define alc880_is_fixed_pin(nid) ((nid) >= 0x14 && (nid) <= 0x17) |
| 3292 | #define alc880_fixed_pin_idx(nid) ((nid) - 0x14) |
| 3293 | #define alc880_is_multi_pin(nid) ((nid) >= 0x18) |
| 3294 | #define alc880_multi_pin_idx(nid) ((nid) - 0x18) |
| 3295 | #define alc880_is_input_pin(nid) ((nid) >= 0x18) |
| 3296 | #define alc880_input_pin_idx(nid) ((nid) - 0x18) |
| 3297 | #define alc880_idx_to_dac(nid) ((nid) + 0x02) |
| 3298 | #define alc880_dac_to_idx(nid) ((nid) - 0x02) |
| 3299 | #define alc880_idx_to_mixer(nid) ((nid) + 0x0c) |
| 3300 | #define alc880_idx_to_selector(nid) ((nid) + 0x10) |
| 3301 | #define ALC880_PIN_CD_NID 0x1c |
| 3302 | |
| 3303 | /* fill in the dac_nids table from the parsed pin configuration */ |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 3304 | static int alc880_auto_fill_dac_nids(struct alc_spec *spec, |
| 3305 | const struct auto_pin_cfg *cfg) |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 3306 | { |
| 3307 | hda_nid_t nid; |
| 3308 | int assigned[4]; |
| 3309 | int i, j; |
| 3310 | |
| 3311 | memset(assigned, 0, sizeof(assigned)); |
Takashi Iwai | b0af0de | 2005-06-21 14:49:19 +0200 | [diff] [blame] | 3312 | spec->multiout.dac_nids = spec->private_dac_nids; |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 3313 | |
| 3314 | /* check the pins hardwired to audio widget */ |
| 3315 | for (i = 0; i < cfg->line_outs; i++) { |
| 3316 | nid = cfg->line_out_pins[i]; |
| 3317 | if (alc880_is_fixed_pin(nid)) { |
| 3318 | int idx = alc880_fixed_pin_idx(nid); |
Libin Yang | 5014f19 | 2005-11-23 15:48:36 +0100 | [diff] [blame] | 3319 | spec->multiout.dac_nids[i] = alc880_idx_to_dac(idx); |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 3320 | assigned[idx] = 1; |
| 3321 | } |
| 3322 | } |
| 3323 | /* left pins can be connect to any audio widget */ |
| 3324 | for (i = 0; i < cfg->line_outs; i++) { |
| 3325 | nid = cfg->line_out_pins[i]; |
| 3326 | if (alc880_is_fixed_pin(nid)) |
| 3327 | continue; |
| 3328 | /* search for an empty channel */ |
| 3329 | for (j = 0; j < cfg->line_outs; j++) { |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 3330 | if (!assigned[j]) { |
| 3331 | spec->multiout.dac_nids[i] = |
| 3332 | alc880_idx_to_dac(j); |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 3333 | assigned[j] = 1; |
| 3334 | break; |
| 3335 | } |
| 3336 | } |
| 3337 | } |
| 3338 | spec->multiout.num_dacs = cfg->line_outs; |
| 3339 | return 0; |
| 3340 | } |
| 3341 | |
| 3342 | /* add playback controls from the parsed DAC table */ |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 3343 | static int alc880_auto_create_multi_out_ctls(struct alc_spec *spec, |
| 3344 | const struct auto_pin_cfg *cfg) |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 3345 | { |
| 3346 | char name[32]; |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 3347 | static const char *chname[4] = { |
| 3348 | "Front", "Surround", NULL /*CLFE*/, "Side" |
| 3349 | }; |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 3350 | hda_nid_t nid; |
| 3351 | int i, err; |
| 3352 | |
| 3353 | for (i = 0; i < cfg->line_outs; i++) { |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 3354 | if (!spec->multiout.dac_nids[i]) |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 3355 | continue; |
| 3356 | nid = alc880_idx_to_mixer(alc880_dac_to_idx(spec->multiout.dac_nids[i])); |
| 3357 | if (i == 2) { |
| 3358 | /* Center/LFE */ |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 3359 | err = add_control(spec, ALC_CTL_WIDGET_VOL, |
| 3360 | "Center Playback Volume", |
| 3361 | HDA_COMPOSE_AMP_VAL(nid, 1, 0, |
| 3362 | HDA_OUTPUT)); |
| 3363 | if (err < 0) |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 3364 | return err; |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 3365 | err = add_control(spec, ALC_CTL_WIDGET_VOL, |
| 3366 | "LFE Playback Volume", |
| 3367 | HDA_COMPOSE_AMP_VAL(nid, 2, 0, |
| 3368 | HDA_OUTPUT)); |
| 3369 | if (err < 0) |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 3370 | return err; |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 3371 | err = add_control(spec, ALC_CTL_BIND_MUTE, |
| 3372 | "Center Playback Switch", |
| 3373 | HDA_COMPOSE_AMP_VAL(nid, 1, 2, |
| 3374 | HDA_INPUT)); |
| 3375 | if (err < 0) |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 3376 | return err; |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 3377 | err = add_control(spec, ALC_CTL_BIND_MUTE, |
| 3378 | "LFE Playback Switch", |
| 3379 | HDA_COMPOSE_AMP_VAL(nid, 2, 2, |
| 3380 | HDA_INPUT)); |
| 3381 | if (err < 0) |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 3382 | return err; |
| 3383 | } else { |
| 3384 | sprintf(name, "%s Playback Volume", chname[i]); |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 3385 | err = add_control(spec, ALC_CTL_WIDGET_VOL, name, |
| 3386 | HDA_COMPOSE_AMP_VAL(nid, 3, 0, |
| 3387 | HDA_OUTPUT)); |
| 3388 | if (err < 0) |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 3389 | return err; |
| 3390 | sprintf(name, "%s Playback Switch", chname[i]); |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 3391 | err = add_control(spec, ALC_CTL_BIND_MUTE, name, |
| 3392 | HDA_COMPOSE_AMP_VAL(nid, 3, 2, |
| 3393 | HDA_INPUT)); |
| 3394 | if (err < 0) |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 3395 | return err; |
| 3396 | } |
| 3397 | } |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 3398 | return 0; |
| 3399 | } |
| 3400 | |
Takashi Iwai | 8d88bc3 | 2005-11-17 11:09:23 +0100 | [diff] [blame] | 3401 | /* add playback controls for speaker and HP outputs */ |
| 3402 | static int alc880_auto_create_extra_out(struct alc_spec *spec, hda_nid_t pin, |
| 3403 | const char *pfx) |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 3404 | { |
| 3405 | hda_nid_t nid; |
| 3406 | int err; |
Takashi Iwai | 8d88bc3 | 2005-11-17 11:09:23 +0100 | [diff] [blame] | 3407 | char name[32]; |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 3408 | |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 3409 | if (!pin) |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 3410 | return 0; |
| 3411 | |
| 3412 | if (alc880_is_fixed_pin(pin)) { |
| 3413 | nid = alc880_idx_to_dac(alc880_fixed_pin_idx(pin)); |
Takashi Iwai | 82bc955 | 2006-03-21 11:24:42 +0100 | [diff] [blame] | 3414 | /* specify the DAC as the extra output */ |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 3415 | if (!spec->multiout.hp_nid) |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 3416 | spec->multiout.hp_nid = nid; |
Takashi Iwai | 82bc955 | 2006-03-21 11:24:42 +0100 | [diff] [blame] | 3417 | else |
| 3418 | spec->multiout.extra_out_nid[0] = nid; |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 3419 | /* control HP volume/switch on the output mixer amp */ |
| 3420 | nid = alc880_idx_to_mixer(alc880_fixed_pin_idx(pin)); |
Takashi Iwai | 8d88bc3 | 2005-11-17 11:09:23 +0100 | [diff] [blame] | 3421 | sprintf(name, "%s Playback Volume", pfx); |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 3422 | err = add_control(spec, ALC_CTL_WIDGET_VOL, name, |
| 3423 | HDA_COMPOSE_AMP_VAL(nid, 3, 0, HDA_OUTPUT)); |
| 3424 | if (err < 0) |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 3425 | return err; |
Takashi Iwai | 8d88bc3 | 2005-11-17 11:09:23 +0100 | [diff] [blame] | 3426 | sprintf(name, "%s Playback Switch", pfx); |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 3427 | err = add_control(spec, ALC_CTL_BIND_MUTE, name, |
| 3428 | HDA_COMPOSE_AMP_VAL(nid, 3, 2, HDA_INPUT)); |
| 3429 | if (err < 0) |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 3430 | return err; |
| 3431 | } else if (alc880_is_multi_pin(pin)) { |
| 3432 | /* set manual connection */ |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 3433 | /* we have only a switch on HP-out PIN */ |
Takashi Iwai | 8d88bc3 | 2005-11-17 11:09:23 +0100 | [diff] [blame] | 3434 | sprintf(name, "%s Playback Switch", pfx); |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 3435 | err = add_control(spec, ALC_CTL_WIDGET_MUTE, name, |
| 3436 | HDA_COMPOSE_AMP_VAL(pin, 3, 0, HDA_OUTPUT)); |
| 3437 | if (err < 0) |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 3438 | return err; |
| 3439 | } |
| 3440 | return 0; |
| 3441 | } |
| 3442 | |
| 3443 | /* create input playback/capture controls for the given pin */ |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 3444 | static int new_analog_input(struct alc_spec *spec, hda_nid_t pin, |
| 3445 | const char *ctlname, |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 3446 | int idx, hda_nid_t mix_nid) |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 3447 | { |
| 3448 | char name[32]; |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 3449 | int err; |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 3450 | |
| 3451 | sprintf(name, "%s Playback Volume", ctlname); |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 3452 | err = add_control(spec, ALC_CTL_WIDGET_VOL, name, |
| 3453 | HDA_COMPOSE_AMP_VAL(mix_nid, 3, idx, HDA_INPUT)); |
| 3454 | if (err < 0) |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 3455 | return err; |
| 3456 | sprintf(name, "%s Playback Switch", ctlname); |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 3457 | err = add_control(spec, ALC_CTL_WIDGET_MUTE, name, |
| 3458 | HDA_COMPOSE_AMP_VAL(mix_nid, 3, idx, HDA_INPUT)); |
| 3459 | if (err < 0) |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 3460 | return err; |
| 3461 | return 0; |
| 3462 | } |
| 3463 | |
| 3464 | /* create playback/capture controls for input pins */ |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 3465 | static int alc880_auto_create_analog_input_ctls(struct alc_spec *spec, |
| 3466 | const struct auto_pin_cfg *cfg) |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 3467 | { |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 3468 | struct hda_input_mux *imux = &spec->private_imux; |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 3469 | int i, err, idx; |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 3470 | |
| 3471 | for (i = 0; i < AUTO_PIN_LAST; i++) { |
| 3472 | if (alc880_is_input_pin(cfg->input_pins[i])) { |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 3473 | idx = alc880_input_pin_idx(cfg->input_pins[i]); |
Takashi Iwai | 4a471b7 | 2005-12-07 13:56:29 +0100 | [diff] [blame] | 3474 | err = new_analog_input(spec, cfg->input_pins[i], |
| 3475 | auto_pin_cfg_labels[i], |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 3476 | idx, 0x0b); |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 3477 | if (err < 0) |
| 3478 | return err; |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 3479 | imux->items[imux->num_items].label = |
| 3480 | auto_pin_cfg_labels[i]; |
| 3481 | imux->items[imux->num_items].index = |
| 3482 | alc880_input_pin_idx(cfg->input_pins[i]); |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 3483 | imux->num_items++; |
| 3484 | } |
| 3485 | } |
| 3486 | return 0; |
| 3487 | } |
| 3488 | |
Takashi Iwai | f6c7e54 | 2008-02-12 18:32:23 +0100 | [diff] [blame] | 3489 | static void alc_set_pin_output(struct hda_codec *codec, hda_nid_t nid, |
| 3490 | unsigned int pin_type) |
| 3491 | { |
| 3492 | snd_hda_codec_write(codec, nid, 0, AC_VERB_SET_PIN_WIDGET_CONTROL, |
| 3493 | pin_type); |
| 3494 | /* unmute pin */ |
Takashi Iwai | d260cdf | 2008-02-13 17:19:35 +0100 | [diff] [blame] | 3495 | snd_hda_codec_write(codec, nid, 0, AC_VERB_SET_AMP_GAIN_MUTE, |
| 3496 | AMP_OUT_UNMUTE); |
Takashi Iwai | f6c7e54 | 2008-02-12 18:32:23 +0100 | [diff] [blame] | 3497 | } |
| 3498 | |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 3499 | static void alc880_auto_set_output_and_unmute(struct hda_codec *codec, |
| 3500 | hda_nid_t nid, int pin_type, |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 3501 | int dac_idx) |
| 3502 | { |
Takashi Iwai | f6c7e54 | 2008-02-12 18:32:23 +0100 | [diff] [blame] | 3503 | alc_set_pin_output(codec, nid, pin_type); |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 3504 | /* need the manual connection? */ |
| 3505 | if (alc880_is_multi_pin(nid)) { |
| 3506 | struct alc_spec *spec = codec->spec; |
| 3507 | int idx = alc880_multi_pin_idx(nid); |
| 3508 | snd_hda_codec_write(codec, alc880_idx_to_selector(idx), 0, |
| 3509 | AC_VERB_SET_CONNECT_SEL, |
| 3510 | alc880_dac_to_idx(spec->multiout.dac_nids[dac_idx])); |
| 3511 | } |
| 3512 | } |
| 3513 | |
Takashi Iwai | baba8ee | 2007-04-23 17:17:48 +0200 | [diff] [blame] | 3514 | static int get_pin_type(int line_out_type) |
| 3515 | { |
| 3516 | if (line_out_type == AUTO_PIN_HP_OUT) |
| 3517 | return PIN_HP; |
| 3518 | else |
| 3519 | return PIN_OUT; |
| 3520 | } |
| 3521 | |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 3522 | static void alc880_auto_init_multi_out(struct hda_codec *codec) |
| 3523 | { |
| 3524 | struct alc_spec *spec = codec->spec; |
| 3525 | int i; |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 3526 | |
| 3527 | alc_subsystem_id(codec, 0x15, 0x1b, 0x14); |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 3528 | for (i = 0; i < spec->autocfg.line_outs; i++) { |
| 3529 | hda_nid_t nid = spec->autocfg.line_out_pins[i]; |
Takashi Iwai | baba8ee | 2007-04-23 17:17:48 +0200 | [diff] [blame] | 3530 | int pin_type = get_pin_type(spec->autocfg.line_out_type); |
| 3531 | alc880_auto_set_output_and_unmute(codec, nid, pin_type, i); |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 3532 | } |
| 3533 | } |
| 3534 | |
Takashi Iwai | 8d88bc3 | 2005-11-17 11:09:23 +0100 | [diff] [blame] | 3535 | static void alc880_auto_init_extra_out(struct hda_codec *codec) |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 3536 | { |
| 3537 | struct alc_spec *spec = codec->spec; |
| 3538 | hda_nid_t pin; |
| 3539 | |
Takashi Iwai | 82bc955 | 2006-03-21 11:24:42 +0100 | [diff] [blame] | 3540 | pin = spec->autocfg.speaker_pins[0]; |
Takashi Iwai | 8d88bc3 | 2005-11-17 11:09:23 +0100 | [diff] [blame] | 3541 | if (pin) /* connect to front */ |
| 3542 | alc880_auto_set_output_and_unmute(codec, pin, PIN_OUT, 0); |
Takashi Iwai | eb06ed8 | 2006-09-20 17:10:27 +0200 | [diff] [blame] | 3543 | pin = spec->autocfg.hp_pins[0]; |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 3544 | if (pin) /* connect to front */ |
| 3545 | alc880_auto_set_output_and_unmute(codec, pin, PIN_HP, 0); |
| 3546 | } |
| 3547 | |
| 3548 | static void alc880_auto_init_analog_input(struct hda_codec *codec) |
| 3549 | { |
| 3550 | struct alc_spec *spec = codec->spec; |
| 3551 | int i; |
| 3552 | |
| 3553 | for (i = 0; i < AUTO_PIN_LAST; i++) { |
| 3554 | hda_nid_t nid = spec->autocfg.input_pins[i]; |
| 3555 | if (alc880_is_input_pin(nid)) { |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 3556 | snd_hda_codec_write(codec, nid, 0, |
| 3557 | AC_VERB_SET_PIN_WIDGET_CONTROL, |
| 3558 | i <= AUTO_PIN_FRONT_MIC ? |
| 3559 | PIN_VREF80 : PIN_IN); |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 3560 | if (nid != ALC880_PIN_CD_NID) |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 3561 | snd_hda_codec_write(codec, nid, 0, |
| 3562 | AC_VERB_SET_AMP_GAIN_MUTE, |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 3563 | AMP_OUT_MUTE); |
| 3564 | } |
| 3565 | } |
| 3566 | } |
| 3567 | |
| 3568 | /* parse the BIOS configuration and set up the alc_spec */ |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 3569 | /* return 1 if successful, 0 if the proper config is not found, |
| 3570 | * or a negative error code |
| 3571 | */ |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 3572 | static int alc880_parse_auto_config(struct hda_codec *codec) |
| 3573 | { |
| 3574 | struct alc_spec *spec = codec->spec; |
| 3575 | int err; |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 3576 | static hda_nid_t alc880_ignore[] = { 0x1d, 0 }; |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 3577 | |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 3578 | err = snd_hda_parse_pin_def_config(codec, &spec->autocfg, |
| 3579 | alc880_ignore); |
| 3580 | if (err < 0) |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 3581 | return err; |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 3582 | if (!spec->autocfg.line_outs) |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 3583 | return 0; /* can't find valid BIOS pin config */ |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 3584 | |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 3585 | err = alc880_auto_fill_dac_nids(spec, &spec->autocfg); |
| 3586 | if (err < 0) |
| 3587 | return err; |
| 3588 | err = alc880_auto_create_multi_out_ctls(spec, &spec->autocfg); |
| 3589 | if (err < 0) |
| 3590 | return err; |
| 3591 | err = alc880_auto_create_extra_out(spec, |
| 3592 | spec->autocfg.speaker_pins[0], |
| 3593 | "Speaker"); |
| 3594 | if (err < 0) |
| 3595 | return err; |
| 3596 | err = alc880_auto_create_extra_out(spec, spec->autocfg.hp_pins[0], |
| 3597 | "Headphone"); |
| 3598 | if (err < 0) |
| 3599 | return err; |
| 3600 | err = alc880_auto_create_analog_input_ctls(spec, &spec->autocfg); |
| 3601 | if (err < 0) |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 3602 | return err; |
| 3603 | |
| 3604 | spec->multiout.max_channels = spec->multiout.num_dacs * 2; |
| 3605 | |
| 3606 | if (spec->autocfg.dig_out_pin) |
| 3607 | spec->multiout.dig_out_nid = ALC880_DIGOUT_NID; |
| 3608 | if (spec->autocfg.dig_in_pin) |
| 3609 | spec->dig_in_nid = ALC880_DIGIN_NID; |
| 3610 | |
| 3611 | if (spec->kctl_alloc) |
| 3612 | spec->mixers[spec->num_mixers++] = spec->kctl_alloc; |
| 3613 | |
| 3614 | spec->init_verbs[spec->num_init_verbs++] = alc880_volume_init_verbs; |
| 3615 | |
Jonathan Woithe | a1e8d2d | 2006-03-28 12:47:09 +0200 | [diff] [blame] | 3616 | spec->num_mux_defs = 1; |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 3617 | spec->input_mux = &spec->private_imux; |
| 3618 | |
| 3619 | return 1; |
| 3620 | } |
| 3621 | |
Takashi Iwai | ae6b813 | 2006-03-03 16:47:17 +0100 | [diff] [blame] | 3622 | /* additional initialization for auto-configuration model */ |
| 3623 | static void alc880_auto_init(struct hda_codec *codec) |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 3624 | { |
Takashi Iwai | f6c7e54 | 2008-02-12 18:32:23 +0100 | [diff] [blame] | 3625 | struct alc_spec *spec = codec->spec; |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 3626 | alc880_auto_init_multi_out(codec); |
Takashi Iwai | 8d88bc3 | 2005-11-17 11:09:23 +0100 | [diff] [blame] | 3627 | alc880_auto_init_extra_out(codec); |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 3628 | alc880_auto_init_analog_input(codec); |
Takashi Iwai | f6c7e54 | 2008-02-12 18:32:23 +0100 | [diff] [blame] | 3629 | if (spec->unsol_event) |
| 3630 | alc_sku_automute(codec); |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 3631 | } |
| 3632 | |
| 3633 | /* |
| 3634 | * OK, here we have finally the patch for ALC880 |
| 3635 | */ |
| 3636 | |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 3637 | static int patch_alc880(struct hda_codec *codec) |
| 3638 | { |
| 3639 | struct alc_spec *spec; |
| 3640 | int board_config; |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 3641 | int err; |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 3642 | |
Takashi Iwai | e560d8d | 2005-09-09 14:21:46 +0200 | [diff] [blame] | 3643 | spec = kzalloc(sizeof(*spec), GFP_KERNEL); |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 3644 | if (spec == NULL) |
| 3645 | return -ENOMEM; |
| 3646 | |
| 3647 | codec->spec = spec; |
| 3648 | |
Takashi Iwai | f5fcc13 | 2006-11-24 17:07:44 +0100 | [diff] [blame] | 3649 | board_config = snd_hda_check_board_config(codec, ALC880_MODEL_LAST, |
| 3650 | alc880_models, |
| 3651 | alc880_cfg_tbl); |
| 3652 | if (board_config < 0) { |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 3653 | printk(KERN_INFO "hda_codec: Unknown model for ALC880, " |
| 3654 | "trying auto-probe from BIOS...\n"); |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 3655 | board_config = ALC880_AUTO; |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 3656 | } |
| 3657 | |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 3658 | if (board_config == ALC880_AUTO) { |
| 3659 | /* automatic parse from the BIOS config */ |
| 3660 | err = alc880_parse_auto_config(codec); |
| 3661 | if (err < 0) { |
| 3662 | alc_free(codec); |
| 3663 | return err; |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 3664 | } else if (!err) { |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 3665 | printk(KERN_INFO |
| 3666 | "hda_codec: Cannot set up configuration " |
| 3667 | "from BIOS. Using 3-stack mode...\n"); |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 3668 | board_config = ALC880_3ST; |
| 3669 | } |
| 3670 | } |
| 3671 | |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 3672 | if (board_config != ALC880_AUTO) |
| 3673 | setup_preset(spec, &alc880_presets[board_config]); |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 3674 | |
| 3675 | spec->stream_name_analog = "ALC880 Analog"; |
| 3676 | spec->stream_analog_playback = &alc880_pcm_analog_playback; |
| 3677 | spec->stream_analog_capture = &alc880_pcm_analog_capture; |
Takashi Iwai | 6330079 | 2008-01-24 15:31:36 +0100 | [diff] [blame] | 3678 | spec->stream_analog_alt_capture = &alc880_pcm_analog_alt_capture; |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 3679 | |
| 3680 | spec->stream_name_digital = "ALC880 Digital"; |
| 3681 | spec->stream_digital_playback = &alc880_pcm_digital_playback; |
| 3682 | spec->stream_digital_capture = &alc880_pcm_digital_capture; |
| 3683 | |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 3684 | if (!spec->adc_nids && spec->input_mux) { |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 3685 | /* check whether NID 0x07 is valid */ |
Takashi Iwai | 54d1740 | 2005-11-21 16:33:22 +0100 | [diff] [blame] | 3686 | unsigned int wcap = get_wcaps(codec, alc880_adc_nids[0]); |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 3687 | /* get type */ |
| 3688 | wcap = (wcap & AC_WCAP_TYPE) >> AC_WCAP_TYPE_SHIFT; |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 3689 | if (wcap != AC_WID_AUD_IN) { |
| 3690 | spec->adc_nids = alc880_adc_nids_alt; |
| 3691 | spec->num_adc_nids = ARRAY_SIZE(alc880_adc_nids_alt); |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 3692 | spec->mixers[spec->num_mixers] = |
| 3693 | alc880_capture_alt_mixer; |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 3694 | spec->num_mixers++; |
| 3695 | } else { |
| 3696 | spec->adc_nids = alc880_adc_nids; |
| 3697 | spec->num_adc_nids = ARRAY_SIZE(alc880_adc_nids); |
| 3698 | spec->mixers[spec->num_mixers] = alc880_capture_mixer; |
| 3699 | spec->num_mixers++; |
| 3700 | } |
| 3701 | } |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 3702 | |
Takashi Iwai | 2134ea4 | 2008-01-10 16:53:55 +0100 | [diff] [blame] | 3703 | spec->vmaster_nid = 0x0c; |
| 3704 | |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 3705 | codec->patch_ops = alc_patch_ops; |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 3706 | if (board_config == ALC880_AUTO) |
Takashi Iwai | ae6b813 | 2006-03-03 16:47:17 +0100 | [diff] [blame] | 3707 | spec->init_hook = alc880_auto_init; |
Takashi Iwai | cb53c62 | 2007-08-10 17:21:45 +0200 | [diff] [blame] | 3708 | #ifdef CONFIG_SND_HDA_POWER_SAVE |
| 3709 | if (!spec->loopback.amplist) |
| 3710 | spec->loopback.amplist = alc880_loopbacks; |
| 3711 | #endif |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 3712 | |
| 3713 | return 0; |
| 3714 | } |
| 3715 | |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 3716 | |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 3717 | /* |
| 3718 | * ALC260 support |
| 3719 | */ |
| 3720 | |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 3721 | static hda_nid_t alc260_dac_nids[1] = { |
| 3722 | /* front */ |
| 3723 | 0x02, |
| 3724 | }; |
| 3725 | |
| 3726 | static hda_nid_t alc260_adc_nids[1] = { |
| 3727 | /* ADC0 */ |
| 3728 | 0x04, |
| 3729 | }; |
| 3730 | |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 3731 | static hda_nid_t alc260_adc_nids_alt[1] = { |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 3732 | /* ADC1 */ |
| 3733 | 0x05, |
| 3734 | }; |
| 3735 | |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 3736 | static hda_nid_t alc260_hp_adc_nids[2] = { |
| 3737 | /* ADC1, 0 */ |
| 3738 | 0x05, 0x04 |
| 3739 | }; |
| 3740 | |
Jonathan Woithe | d57fdac | 2006-02-28 11:38:35 +0100 | [diff] [blame] | 3741 | /* NIDs used when simultaneous access to both ADCs makes sense. Note that |
| 3742 | * alc260_capture_mixer assumes ADC0 (nid 0x04) is the first ADC. |
| 3743 | */ |
| 3744 | static hda_nid_t alc260_dual_adc_nids[2] = { |
Jonathan Woithe | 4c5186e | 2006-02-09 11:53:48 +0100 | [diff] [blame] | 3745 | /* ADC0, ADC1 */ |
| 3746 | 0x04, 0x05 |
| 3747 | }; |
| 3748 | |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 3749 | #define ALC260_DIGOUT_NID 0x03 |
| 3750 | #define ALC260_DIGIN_NID 0x06 |
| 3751 | |
| 3752 | static struct hda_input_mux alc260_capture_source = { |
| 3753 | .num_items = 4, |
| 3754 | .items = { |
| 3755 | { "Mic", 0x0 }, |
| 3756 | { "Front Mic", 0x1 }, |
| 3757 | { "Line", 0x2 }, |
| 3758 | { "CD", 0x4 }, |
| 3759 | }, |
| 3760 | }; |
| 3761 | |
Jonathan Woithe | 17e7aec | 2006-02-28 11:35:18 +0100 | [diff] [blame] | 3762 | /* On Fujitsu S702x laptops capture only makes sense from Mic/LineIn jack, |
Jonathan Woithe | a1e8d2d | 2006-03-28 12:47:09 +0200 | [diff] [blame] | 3763 | * headphone jack and the internal CD lines since these are the only pins at |
| 3764 | * which audio can appear. For flexibility, also allow the option of |
| 3765 | * recording the mixer output on the second ADC (ADC0 doesn't have a |
| 3766 | * connection to the mixer output). |
Jonathan Woithe | a9430dd | 2005-09-16 19:12:48 +0200 | [diff] [blame] | 3767 | */ |
Jonathan Woithe | a1e8d2d | 2006-03-28 12:47:09 +0200 | [diff] [blame] | 3768 | static struct hda_input_mux alc260_fujitsu_capture_sources[2] = { |
| 3769 | { |
| 3770 | .num_items = 3, |
| 3771 | .items = { |
| 3772 | { "Mic/Line", 0x0 }, |
| 3773 | { "CD", 0x4 }, |
| 3774 | { "Headphone", 0x2 }, |
| 3775 | }, |
Jonathan Woithe | a9430dd | 2005-09-16 19:12:48 +0200 | [diff] [blame] | 3776 | }, |
Jonathan Woithe | a1e8d2d | 2006-03-28 12:47:09 +0200 | [diff] [blame] | 3777 | { |
| 3778 | .num_items = 4, |
| 3779 | .items = { |
| 3780 | { "Mic/Line", 0x0 }, |
| 3781 | { "CD", 0x4 }, |
| 3782 | { "Headphone", 0x2 }, |
| 3783 | { "Mixer", 0x5 }, |
| 3784 | }, |
| 3785 | }, |
| 3786 | |
Jonathan Woithe | a9430dd | 2005-09-16 19:12:48 +0200 | [diff] [blame] | 3787 | }; |
| 3788 | |
Jonathan Woithe | a1e8d2d | 2006-03-28 12:47:09 +0200 | [diff] [blame] | 3789 | /* Acer TravelMate(/Extensa/Aspire) notebooks have similar configuration to |
| 3790 | * the Fujitsu S702x, but jacks are marked differently. |
Jonathan Woithe | 0bfc90e | 2006-02-28 11:45:11 +0100 | [diff] [blame] | 3791 | */ |
Jonathan Woithe | a1e8d2d | 2006-03-28 12:47:09 +0200 | [diff] [blame] | 3792 | static struct hda_input_mux alc260_acer_capture_sources[2] = { |
| 3793 | { |
| 3794 | .num_items = 4, |
| 3795 | .items = { |
| 3796 | { "Mic", 0x0 }, |
| 3797 | { "Line", 0x2 }, |
| 3798 | { "CD", 0x4 }, |
| 3799 | { "Headphone", 0x5 }, |
| 3800 | }, |
| 3801 | }, |
| 3802 | { |
| 3803 | .num_items = 5, |
| 3804 | .items = { |
| 3805 | { "Mic", 0x0 }, |
| 3806 | { "Line", 0x2 }, |
| 3807 | { "CD", 0x4 }, |
| 3808 | { "Headphone", 0x6 }, |
| 3809 | { "Mixer", 0x5 }, |
| 3810 | }, |
Jonathan Woithe | 0bfc90e | 2006-02-28 11:45:11 +0100 | [diff] [blame] | 3811 | }, |
| 3812 | }; |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 3813 | /* |
| 3814 | * This is just place-holder, so there's something for alc_build_pcms to look |
| 3815 | * at when it calculates the maximum number of channels. ALC260 has no mixer |
| 3816 | * element which allows changing the channel mode, so the verb list is |
| 3817 | * never used. |
| 3818 | */ |
Takashi Iwai | d2a6d7d | 2005-11-17 11:06:29 +0100 | [diff] [blame] | 3819 | static struct hda_channel_mode alc260_modes[1] = { |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 3820 | { 2, NULL }, |
| 3821 | }; |
| 3822 | |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 3823 | |
| 3824 | /* Mixer combinations |
| 3825 | * |
| 3826 | * basic: base_output + input + pc_beep + capture |
| 3827 | * HP: base_output + input + capture_alt |
| 3828 | * HP_3013: hp_3013 + input + capture |
| 3829 | * fujitsu: fujitsu + capture |
Jonathan Woithe | 0bfc90e | 2006-02-28 11:45:11 +0100 | [diff] [blame] | 3830 | * acer: acer + capture |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 3831 | */ |
| 3832 | |
| 3833 | static struct snd_kcontrol_new alc260_base_output_mixer[] = { |
Takashi Iwai | 05acb86 | 2005-06-10 19:50:25 +0200 | [diff] [blame] | 3834 | HDA_CODEC_VOLUME("Front Playback Volume", 0x08, 0x0, HDA_OUTPUT), |
Takashi Iwai | 985be54 | 2005-11-02 18:26:49 +0100 | [diff] [blame] | 3835 | HDA_BIND_MUTE("Front Playback Switch", 0x08, 2, HDA_INPUT), |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 3836 | HDA_CODEC_VOLUME("Headphone Playback Volume", 0x09, 0x0, HDA_OUTPUT), |
| 3837 | HDA_BIND_MUTE("Headphone Playback Switch", 0x09, 2, HDA_INPUT), |
| 3838 | HDA_CODEC_VOLUME_MONO("Mono Playback Volume", 0x0a, 1, 0x0, HDA_OUTPUT), |
| 3839 | HDA_BIND_MUTE_MONO("Mono Playback Switch", 0x0a, 1, 2, HDA_INPUT), |
| 3840 | { } /* end */ |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 3841 | }; |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 3842 | |
| 3843 | static struct snd_kcontrol_new alc260_input_mixer[] = { |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 3844 | HDA_CODEC_VOLUME("CD Playback Volume", 0x07, 0x04, HDA_INPUT), |
| 3845 | HDA_CODEC_MUTE("CD Playback Switch", 0x07, 0x04, HDA_INPUT), |
| 3846 | HDA_CODEC_VOLUME("Line Playback Volume", 0x07, 0x02, HDA_INPUT), |
| 3847 | HDA_CODEC_MUTE("Line Playback Switch", 0x07, 0x02, HDA_INPUT), |
| 3848 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x07, 0x0, HDA_INPUT), |
| 3849 | HDA_CODEC_MUTE("Mic Playback Switch", 0x07, 0x0, HDA_INPUT), |
| 3850 | HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x07, 0x01, HDA_INPUT), |
| 3851 | HDA_CODEC_MUTE("Front Mic Playback Switch", 0x07, 0x01, HDA_INPUT), |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 3852 | { } /* end */ |
| 3853 | }; |
| 3854 | |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 3855 | static struct snd_kcontrol_new alc260_pc_beep_mixer[] = { |
| 3856 | HDA_CODEC_VOLUME("PC Speaker Playback Volume", 0x07, 0x05, HDA_INPUT), |
| 3857 | HDA_CODEC_MUTE("PC Speaker Playback Switch", 0x07, 0x05, HDA_INPUT), |
| 3858 | { } /* end */ |
| 3859 | }; |
| 3860 | |
Takashi Iwai | bec15c3 | 2008-01-28 18:16:30 +0100 | [diff] [blame] | 3861 | /* update HP, line and mono out pins according to the master switch */ |
| 3862 | static void alc260_hp_master_update(struct hda_codec *codec, |
| 3863 | hda_nid_t hp, hda_nid_t line, |
| 3864 | hda_nid_t mono) |
| 3865 | { |
| 3866 | struct alc_spec *spec = codec->spec; |
| 3867 | unsigned int val = spec->master_sw ? PIN_HP : 0; |
| 3868 | /* change HP and line-out pins */ |
| 3869 | snd_hda_codec_write(codec, 0x0f, 0, AC_VERB_SET_PIN_WIDGET_CONTROL, |
| 3870 | val); |
| 3871 | snd_hda_codec_write(codec, 0x10, 0, AC_VERB_SET_PIN_WIDGET_CONTROL, |
| 3872 | val); |
| 3873 | /* mono (speaker) depending on the HP jack sense */ |
| 3874 | val = (val && !spec->jack_present) ? PIN_OUT : 0; |
| 3875 | snd_hda_codec_write(codec, 0x11, 0, AC_VERB_SET_PIN_WIDGET_CONTROL, |
| 3876 | val); |
| 3877 | } |
| 3878 | |
| 3879 | static int alc260_hp_master_sw_get(struct snd_kcontrol *kcontrol, |
| 3880 | struct snd_ctl_elem_value *ucontrol) |
| 3881 | { |
| 3882 | struct hda_codec *codec = snd_kcontrol_chip(kcontrol); |
| 3883 | struct alc_spec *spec = codec->spec; |
| 3884 | *ucontrol->value.integer.value = spec->master_sw; |
| 3885 | return 0; |
| 3886 | } |
| 3887 | |
| 3888 | static int alc260_hp_master_sw_put(struct snd_kcontrol *kcontrol, |
| 3889 | struct snd_ctl_elem_value *ucontrol) |
| 3890 | { |
| 3891 | struct hda_codec *codec = snd_kcontrol_chip(kcontrol); |
| 3892 | struct alc_spec *spec = codec->spec; |
| 3893 | int val = !!*ucontrol->value.integer.value; |
| 3894 | hda_nid_t hp, line, mono; |
| 3895 | |
| 3896 | if (val == spec->master_sw) |
| 3897 | return 0; |
| 3898 | spec->master_sw = val; |
| 3899 | hp = (kcontrol->private_value >> 16) & 0xff; |
| 3900 | line = (kcontrol->private_value >> 8) & 0xff; |
| 3901 | mono = kcontrol->private_value & 0xff; |
| 3902 | alc260_hp_master_update(codec, hp, line, mono); |
| 3903 | return 1; |
| 3904 | } |
| 3905 | |
| 3906 | static struct snd_kcontrol_new alc260_hp_output_mixer[] = { |
| 3907 | { |
| 3908 | .iface = SNDRV_CTL_ELEM_IFACE_MIXER, |
| 3909 | .name = "Master Playback Switch", |
| 3910 | .info = snd_ctl_boolean_mono_info, |
| 3911 | .get = alc260_hp_master_sw_get, |
| 3912 | .put = alc260_hp_master_sw_put, |
| 3913 | .private_value = (0x0f << 16) | (0x10 << 8) | 0x11 |
| 3914 | }, |
| 3915 | HDA_CODEC_VOLUME("Front Playback Volume", 0x08, 0x0, HDA_OUTPUT), |
| 3916 | HDA_BIND_MUTE("Front Playback Switch", 0x08, 2, HDA_INPUT), |
| 3917 | HDA_CODEC_VOLUME("Headphone Playback Volume", 0x09, 0x0, HDA_OUTPUT), |
| 3918 | HDA_BIND_MUTE("Headphone Playback Switch", 0x09, 2, HDA_INPUT), |
| 3919 | HDA_CODEC_VOLUME_MONO("Speaker Playback Volume", 0x0a, 1, 0x0, |
| 3920 | HDA_OUTPUT), |
| 3921 | HDA_BIND_MUTE_MONO("Speaker Playback Switch", 0x0a, 1, 2, HDA_INPUT), |
| 3922 | { } /* end */ |
| 3923 | }; |
| 3924 | |
| 3925 | static struct hda_verb alc260_hp_unsol_verbs[] = { |
| 3926 | {0x10, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT}, |
| 3927 | {}, |
| 3928 | }; |
| 3929 | |
| 3930 | static void alc260_hp_automute(struct hda_codec *codec) |
| 3931 | { |
| 3932 | struct alc_spec *spec = codec->spec; |
| 3933 | unsigned int present; |
| 3934 | |
| 3935 | present = snd_hda_codec_read(codec, 0x10, 0, |
| 3936 | AC_VERB_GET_PIN_SENSE, 0); |
| 3937 | spec->jack_present = (present & AC_PINSENSE_PRESENCE) != 0; |
| 3938 | alc260_hp_master_update(codec, 0x0f, 0x10, 0x11); |
| 3939 | } |
| 3940 | |
| 3941 | static void alc260_hp_unsol_event(struct hda_codec *codec, unsigned int res) |
| 3942 | { |
| 3943 | if ((res >> 26) == ALC880_HP_EVENT) |
| 3944 | alc260_hp_automute(codec); |
| 3945 | } |
| 3946 | |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 3947 | static struct snd_kcontrol_new alc260_hp_3013_mixer[] = { |
Takashi Iwai | bec15c3 | 2008-01-28 18:16:30 +0100 | [diff] [blame] | 3948 | { |
| 3949 | .iface = SNDRV_CTL_ELEM_IFACE_MIXER, |
| 3950 | .name = "Master Playback Switch", |
| 3951 | .info = snd_ctl_boolean_mono_info, |
| 3952 | .get = alc260_hp_master_sw_get, |
| 3953 | .put = alc260_hp_master_sw_put, |
| 3954 | .private_value = (0x10 << 16) | (0x15 << 8) | 0x11 |
| 3955 | }, |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 3956 | HDA_CODEC_VOLUME("Front Playback Volume", 0x09, 0x0, HDA_OUTPUT), |
| 3957 | HDA_CODEC_MUTE("Front Playback Switch", 0x10, 0x0, HDA_OUTPUT), |
| 3958 | HDA_CODEC_VOLUME("Aux-In Playback Volume", 0x07, 0x06, HDA_INPUT), |
| 3959 | HDA_CODEC_MUTE("Aux-In Playback Switch", 0x07, 0x06, HDA_INPUT), |
| 3960 | HDA_CODEC_VOLUME("Headphone Playback Volume", 0x08, 0x0, HDA_OUTPUT), |
| 3961 | HDA_CODEC_MUTE("Headphone Playback Switch", 0x15, 0x0, HDA_OUTPUT), |
Takashi Iwai | 86cd929 | 2008-01-28 18:09:56 +0100 | [diff] [blame] | 3962 | HDA_CODEC_VOLUME_MONO("Speaker Playback Volume", 0x0a, 1, 0x0, HDA_OUTPUT), |
| 3963 | HDA_CODEC_MUTE_MONO("Speaker Playback Switch", 0x11, 1, 0x0, HDA_OUTPUT), |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 3964 | { } /* end */ |
| 3965 | }; |
| 3966 | |
Takashi Iwai | bec15c3 | 2008-01-28 18:16:30 +0100 | [diff] [blame] | 3967 | static struct hda_verb alc260_hp_3013_unsol_verbs[] = { |
| 3968 | {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT}, |
| 3969 | {}, |
| 3970 | }; |
| 3971 | |
| 3972 | static void alc260_hp_3013_automute(struct hda_codec *codec) |
| 3973 | { |
| 3974 | struct alc_spec *spec = codec->spec; |
| 3975 | unsigned int present; |
| 3976 | |
| 3977 | present = snd_hda_codec_read(codec, 0x15, 0, |
| 3978 | AC_VERB_GET_PIN_SENSE, 0); |
| 3979 | spec->jack_present = (present & AC_PINSENSE_PRESENCE) != 0; |
| 3980 | alc260_hp_master_update(codec, 0x10, 0x15, 0x11); |
| 3981 | } |
| 3982 | |
| 3983 | static void alc260_hp_3013_unsol_event(struct hda_codec *codec, |
| 3984 | unsigned int res) |
| 3985 | { |
| 3986 | if ((res >> 26) == ALC880_HP_EVENT) |
| 3987 | alc260_hp_3013_automute(codec); |
| 3988 | } |
| 3989 | |
Jonathan Woithe | a1e8d2d | 2006-03-28 12:47:09 +0200 | [diff] [blame] | 3990 | /* Fujitsu S702x series laptops. ALC260 pin usage: Mic/Line jack = 0x12, |
| 3991 | * HP jack = 0x14, CD audio = 0x16, internal speaker = 0x10. |
| 3992 | */ |
Takashi Iwai | c8b6bf9 | 2005-11-17 14:57:47 +0100 | [diff] [blame] | 3993 | static struct snd_kcontrol_new alc260_fujitsu_mixer[] = { |
Jonathan Woithe | a9430dd | 2005-09-16 19:12:48 +0200 | [diff] [blame] | 3994 | HDA_CODEC_VOLUME("Headphone Playback Volume", 0x08, 0x0, HDA_OUTPUT), |
Takashi Iwai | 985be54 | 2005-11-02 18:26:49 +0100 | [diff] [blame] | 3995 | HDA_BIND_MUTE("Headphone Playback Switch", 0x08, 2, HDA_INPUT), |
Jonathan Woithe | 4c5186e | 2006-02-09 11:53:48 +0100 | [diff] [blame] | 3996 | ALC_PIN_MODE("Headphone Jack Mode", 0x14, ALC_PIN_DIR_INOUT), |
Jonathan Woithe | a9430dd | 2005-09-16 19:12:48 +0200 | [diff] [blame] | 3997 | HDA_CODEC_VOLUME("CD Playback Volume", 0x07, 0x04, HDA_INPUT), |
| 3998 | HDA_CODEC_MUTE("CD Playback Switch", 0x07, 0x04, HDA_INPUT), |
| 3999 | HDA_CODEC_VOLUME("Mic/Line Playback Volume", 0x07, 0x0, HDA_INPUT), |
| 4000 | HDA_CODEC_MUTE("Mic/Line Playback Switch", 0x07, 0x0, HDA_INPUT), |
Jonathan Woithe | 4c5186e | 2006-02-09 11:53:48 +0100 | [diff] [blame] | 4001 | ALC_PIN_MODE("Mic/Line Jack Mode", 0x12, ALC_PIN_DIR_IN), |
Jonathan Woithe | a9430dd | 2005-09-16 19:12:48 +0200 | [diff] [blame] | 4002 | HDA_CODEC_VOLUME("Beep Playback Volume", 0x07, 0x05, HDA_INPUT), |
| 4003 | HDA_CODEC_MUTE("Beep Playback Switch", 0x07, 0x05, HDA_INPUT), |
Takashi Iwai | 31bffaa | 2008-02-27 16:10:44 +0100 | [diff] [blame] | 4004 | HDA_CODEC_VOLUME("Speaker Playback Volume", 0x09, 0x0, HDA_OUTPUT), |
| 4005 | HDA_BIND_MUTE("Speaker Playback Switch", 0x09, 2, HDA_INPUT), |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 4006 | { } /* end */ |
| 4007 | }; |
| 4008 | |
Jonathan Woithe | a1e8d2d | 2006-03-28 12:47:09 +0200 | [diff] [blame] | 4009 | /* Mixer for Acer TravelMate(/Extensa/Aspire) notebooks. Note that current |
| 4010 | * versions of the ALC260 don't act on requests to enable mic bias from NID |
| 4011 | * 0x0f (used to drive the headphone jack in these laptops). The ALC260 |
| 4012 | * datasheet doesn't mention this restriction. At this stage it's not clear |
| 4013 | * whether this behaviour is intentional or is a hardware bug in chip |
| 4014 | * revisions available in early 2006. Therefore for now allow the |
| 4015 | * "Headphone Jack Mode" control to span all choices, but if it turns out |
| 4016 | * that the lack of mic bias for this NID is intentional we could change the |
| 4017 | * mode from ALC_PIN_DIR_INOUT to ALC_PIN_DIR_INOUT_NOMICBIAS. |
| 4018 | * |
| 4019 | * In addition, Acer TravelMate(/Extensa/Aspire) notebooks in early 2006 |
| 4020 | * don't appear to make the mic bias available from the "line" jack, even |
| 4021 | * though the NID used for this jack (0x14) can supply it. The theory is |
| 4022 | * that perhaps Acer have included blocking capacitors between the ALC260 |
| 4023 | * and the output jack. If this turns out to be the case for all such |
| 4024 | * models the "Line Jack Mode" mode could be changed from ALC_PIN_DIR_INOUT |
| 4025 | * to ALC_PIN_DIR_INOUT_NOMICBIAS. |
Jonathan Woithe | bd86948 | 2006-11-28 11:35:52 +0100 | [diff] [blame] | 4026 | * |
| 4027 | * The C20x Tablet series have a mono internal speaker which is controlled |
| 4028 | * via the chip's Mono sum widget and pin complex, so include the necessary |
| 4029 | * controls for such models. On models without a "mono speaker" the control |
| 4030 | * won't do anything. |
Jonathan Woithe | a1e8d2d | 2006-03-28 12:47:09 +0200 | [diff] [blame] | 4031 | */ |
Jonathan Woithe | 0bfc90e | 2006-02-28 11:45:11 +0100 | [diff] [blame] | 4032 | static struct snd_kcontrol_new alc260_acer_mixer[] = { |
| 4033 | HDA_CODEC_VOLUME("Master Playback Volume", 0x08, 0x0, HDA_OUTPUT), |
| 4034 | HDA_BIND_MUTE("Master Playback Switch", 0x08, 2, HDA_INPUT), |
Jonathan Woithe | a1e8d2d | 2006-03-28 12:47:09 +0200 | [diff] [blame] | 4035 | ALC_PIN_MODE("Headphone Jack Mode", 0x0f, ALC_PIN_DIR_INOUT), |
Takashi Iwai | 31bffaa | 2008-02-27 16:10:44 +0100 | [diff] [blame] | 4036 | HDA_CODEC_VOLUME_MONO("Speaker Playback Volume", 0x0a, 1, 0x0, |
Jonathan Woithe | bd86948 | 2006-11-28 11:35:52 +0100 | [diff] [blame] | 4037 | HDA_OUTPUT), |
Takashi Iwai | 31bffaa | 2008-02-27 16:10:44 +0100 | [diff] [blame] | 4038 | HDA_BIND_MUTE_MONO("Speaker Playback Switch", 0x0a, 1, 2, |
Jonathan Woithe | bd86948 | 2006-11-28 11:35:52 +0100 | [diff] [blame] | 4039 | HDA_INPUT), |
Jonathan Woithe | 0bfc90e | 2006-02-28 11:45:11 +0100 | [diff] [blame] | 4040 | HDA_CODEC_VOLUME("CD Playback Volume", 0x07, 0x04, HDA_INPUT), |
| 4041 | HDA_CODEC_MUTE("CD Playback Switch", 0x07, 0x04, HDA_INPUT), |
| 4042 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x07, 0x0, HDA_INPUT), |
| 4043 | HDA_CODEC_MUTE("Mic Playback Switch", 0x07, 0x0, HDA_INPUT), |
| 4044 | ALC_PIN_MODE("Mic Jack Mode", 0x12, ALC_PIN_DIR_IN), |
| 4045 | HDA_CODEC_VOLUME("Line Playback Volume", 0x07, 0x02, HDA_INPUT), |
| 4046 | HDA_CODEC_MUTE("Line Playback Switch", 0x07, 0x02, HDA_INPUT), |
| 4047 | ALC_PIN_MODE("Line Jack Mode", 0x14, ALC_PIN_DIR_INOUT), |
| 4048 | HDA_CODEC_VOLUME("Beep Playback Volume", 0x07, 0x05, HDA_INPUT), |
| 4049 | HDA_CODEC_MUTE("Beep Playback Switch", 0x07, 0x05, HDA_INPUT), |
| 4050 | { } /* end */ |
| 4051 | }; |
| 4052 | |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 4053 | /* Packard bell V7900 ALC260 pin usage: HP = 0x0f, Mic jack = 0x12, |
| 4054 | * Line In jack = 0x14, CD audio = 0x16, pc beep = 0x17. |
| 4055 | */ |
| 4056 | static struct snd_kcontrol_new alc260_will_mixer[] = { |
| 4057 | HDA_CODEC_VOLUME("Master Playback Volume", 0x08, 0x0, HDA_OUTPUT), |
| 4058 | HDA_BIND_MUTE("Master Playback Switch", 0x08, 0x2, HDA_INPUT), |
| 4059 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x07, 0x0, HDA_INPUT), |
| 4060 | HDA_CODEC_MUTE("Mic Playback Switch", 0x07, 0x0, HDA_INPUT), |
| 4061 | ALC_PIN_MODE("Mic Jack Mode", 0x12, ALC_PIN_DIR_IN), |
| 4062 | HDA_CODEC_VOLUME("Line Playback Volume", 0x07, 0x02, HDA_INPUT), |
| 4063 | HDA_CODEC_MUTE("Line Playback Switch", 0x07, 0x02, HDA_INPUT), |
| 4064 | ALC_PIN_MODE("Line Jack Mode", 0x14, ALC_PIN_DIR_INOUT), |
| 4065 | HDA_CODEC_VOLUME("CD Playback Volume", 0x07, 0x04, HDA_INPUT), |
| 4066 | HDA_CODEC_MUTE("CD Playback Switch", 0x07, 0x04, HDA_INPUT), |
| 4067 | HDA_CODEC_VOLUME("Beep Playback Volume", 0x07, 0x05, HDA_INPUT), |
| 4068 | HDA_CODEC_MUTE("Beep Playback Switch", 0x07, 0x05, HDA_INPUT), |
| 4069 | { } /* end */ |
| 4070 | }; |
| 4071 | |
| 4072 | /* Replacer 672V ALC260 pin usage: Mic jack = 0x12, |
| 4073 | * Line In jack = 0x14, ATAPI Mic = 0x13, speaker = 0x0f. |
| 4074 | */ |
| 4075 | static struct snd_kcontrol_new alc260_replacer_672v_mixer[] = { |
| 4076 | HDA_CODEC_VOLUME("Master Playback Volume", 0x08, 0x0, HDA_OUTPUT), |
| 4077 | HDA_BIND_MUTE("Master Playback Switch", 0x08, 0x2, HDA_INPUT), |
| 4078 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x07, 0x0, HDA_INPUT), |
| 4079 | HDA_CODEC_MUTE("Mic Playback Switch", 0x07, 0x0, HDA_INPUT), |
| 4080 | ALC_PIN_MODE("Mic Jack Mode", 0x12, ALC_PIN_DIR_IN), |
| 4081 | HDA_CODEC_VOLUME("ATAPI Mic Playback Volume", 0x07, 0x1, HDA_INPUT), |
| 4082 | HDA_CODEC_MUTE("ATATI Mic Playback Switch", 0x07, 0x1, HDA_INPUT), |
| 4083 | HDA_CODEC_VOLUME("Line Playback Volume", 0x07, 0x02, HDA_INPUT), |
| 4084 | HDA_CODEC_MUTE("Line Playback Switch", 0x07, 0x02, HDA_INPUT), |
| 4085 | ALC_PIN_MODE("Line Jack Mode", 0x14, ALC_PIN_DIR_INOUT), |
| 4086 | { } /* end */ |
| 4087 | }; |
| 4088 | |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 4089 | /* capture mixer elements */ |
| 4090 | static struct snd_kcontrol_new alc260_capture_mixer[] = { |
Jonathan Woithe | a9430dd | 2005-09-16 19:12:48 +0200 | [diff] [blame] | 4091 | HDA_CODEC_VOLUME("Capture Volume", 0x04, 0x0, HDA_INPUT), |
| 4092 | HDA_CODEC_MUTE("Capture Switch", 0x04, 0x0, HDA_INPUT), |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 4093 | HDA_CODEC_VOLUME_IDX("Capture Volume", 1, 0x05, 0x0, HDA_INPUT), |
| 4094 | HDA_CODEC_MUTE_IDX("Capture Switch", 1, 0x05, 0x0, HDA_INPUT), |
Jonathan Woithe | a9430dd | 2005-09-16 19:12:48 +0200 | [diff] [blame] | 4095 | { |
| 4096 | .iface = SNDRV_CTL_ELEM_IFACE_MIXER, |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 4097 | /* The multiple "Capture Source" controls confuse alsamixer |
| 4098 | * So call somewhat different.. |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 4099 | */ |
| 4100 | /* .name = "Capture Source", */ |
| 4101 | .name = "Input Source", |
| 4102 | .count = 2, |
Jonathan Woithe | a9430dd | 2005-09-16 19:12:48 +0200 | [diff] [blame] | 4103 | .info = alc_mux_enum_info, |
| 4104 | .get = alc_mux_enum_get, |
| 4105 | .put = alc_mux_enum_put, |
| 4106 | }, |
| 4107 | { } /* end */ |
| 4108 | }; |
| 4109 | |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 4110 | static struct snd_kcontrol_new alc260_capture_alt_mixer[] = { |
| 4111 | HDA_CODEC_VOLUME("Capture Volume", 0x05, 0x0, HDA_INPUT), |
| 4112 | HDA_CODEC_MUTE("Capture Switch", 0x05, 0x0, HDA_INPUT), |
| 4113 | { |
| 4114 | .iface = SNDRV_CTL_ELEM_IFACE_MIXER, |
| 4115 | /* The multiple "Capture Source" controls confuse alsamixer |
| 4116 | * So call somewhat different.. |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 4117 | */ |
| 4118 | /* .name = "Capture Source", */ |
| 4119 | .name = "Input Source", |
| 4120 | .count = 1, |
| 4121 | .info = alc_mux_enum_info, |
| 4122 | .get = alc_mux_enum_get, |
| 4123 | .put = alc_mux_enum_put, |
| 4124 | }, |
| 4125 | { } /* end */ |
| 4126 | }; |
| 4127 | |
| 4128 | /* |
| 4129 | * initialization verbs |
| 4130 | */ |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 4131 | static struct hda_verb alc260_init_verbs[] = { |
| 4132 | /* Line In pin widget for input */ |
Takashi Iwai | 05acb86 | 2005-06-10 19:50:25 +0200 | [diff] [blame] | 4133 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 4134 | /* CD pin widget for input */ |
Takashi Iwai | 05acb86 | 2005-06-10 19:50:25 +0200 | [diff] [blame] | 4135 | {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 4136 | /* Mic1 (rear panel) pin widget for input and vref at 80% */ |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 4137 | {0x12, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80}, |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 4138 | /* Mic2 (front panel) pin widget for input and vref at 80% */ |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 4139 | {0x13, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80}, |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 4140 | /* LINE-2 is used for line-out in rear */ |
Takashi Iwai | 05acb86 | 2005-06-10 19:50:25 +0200 | [diff] [blame] | 4141 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 4142 | /* select line-out */ |
Jonathan Woithe | fd56f2d | 2006-01-24 10:35:46 +0100 | [diff] [blame] | 4143 | {0x0e, AC_VERB_SET_CONNECT_SEL, 0x00}, |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 4144 | /* LINE-OUT pin */ |
Takashi Iwai | 05acb86 | 2005-06-10 19:50:25 +0200 | [diff] [blame] | 4145 | {0x0f, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 4146 | /* enable HP */ |
Takashi Iwai | 05acb86 | 2005-06-10 19:50:25 +0200 | [diff] [blame] | 4147 | {0x10, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 4148 | /* enable Mono */ |
Takashi Iwai | 05acb86 | 2005-06-10 19:50:25 +0200 | [diff] [blame] | 4149 | {0x11, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 4150 | /* mute capture amp left and right */ |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 4151 | {0x04, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 4152 | /* set connection select to line in (default select for this ADC) */ |
| 4153 | {0x04, AC_VERB_SET_CONNECT_SEL, 0x02}, |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 4154 | /* mute capture amp left and right */ |
| 4155 | {0x05, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 4156 | /* set connection select to line in (default select for this ADC) */ |
| 4157 | {0x05, AC_VERB_SET_CONNECT_SEL, 0x02}, |
Takashi Iwai | 05acb86 | 2005-06-10 19:50:25 +0200 | [diff] [blame] | 4158 | /* set vol=0 Line-Out mixer amp left and right */ |
| 4159 | {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 4160 | /* unmute pin widget amp left and right (no gain on this amp) */ |
| 4161 | {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 4162 | /* set vol=0 HP mixer amp left and right */ |
| 4163 | {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 4164 | /* unmute pin widget amp left and right (no gain on this amp) */ |
| 4165 | {0x10, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 4166 | /* set vol=0 Mono mixer amp left and right */ |
| 4167 | {0x0a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 4168 | /* unmute pin widget amp left and right (no gain on this amp) */ |
| 4169 | {0x11, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 4170 | /* unmute LINE-2 out pin */ |
| 4171 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 4172 | /* Amp Indexes: CD = 0x04, Line In 1 = 0x02, Mic 1 = 0x00 & |
| 4173 | * Line In 2 = 0x03 |
| 4174 | */ |
Takashi Iwai | cb53c62 | 2007-08-10 17:21:45 +0200 | [diff] [blame] | 4175 | /* mute analog inputs */ |
| 4176 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 4177 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
| 4178 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)}, |
| 4179 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)}, |
| 4180 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)}, |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 4181 | /* Amp Indexes: DAC = 0x01 & mixer = 0x00 */ |
Takashi Iwai | 05acb86 | 2005-06-10 19:50:25 +0200 | [diff] [blame] | 4182 | /* mute Front out path */ |
| 4183 | {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 4184 | {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
| 4185 | /* mute Headphone out path */ |
| 4186 | {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 4187 | {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
| 4188 | /* mute Mono out path */ |
| 4189 | {0x0a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 4190 | {0x0a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 4191 | { } |
| 4192 | }; |
| 4193 | |
Takashi Iwai | 474167d | 2006-05-17 17:17:43 +0200 | [diff] [blame] | 4194 | #if 0 /* should be identical with alc260_init_verbs? */ |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 4195 | static struct hda_verb alc260_hp_init_verbs[] = { |
| 4196 | /* Headphone and output */ |
| 4197 | {0x10, AC_VERB_SET_PIN_WIDGET_CONTROL, 0xc0}, |
| 4198 | /* mono output */ |
| 4199 | {0x11, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x40}, |
| 4200 | /* Mic1 (rear panel) pin widget for input and vref at 80% */ |
| 4201 | {0x12, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24}, |
| 4202 | /* Mic2 (front panel) pin widget for input and vref at 80% */ |
| 4203 | {0x13, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24}, |
| 4204 | /* Line In pin widget for input */ |
| 4205 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20}, |
| 4206 | /* Line-2 pin widget for output */ |
| 4207 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x40}, |
| 4208 | /* CD pin widget for input */ |
| 4209 | {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20}, |
| 4210 | /* unmute amp left and right */ |
| 4211 | {0x04, AC_VERB_SET_AMP_GAIN_MUTE, 0x7000}, |
| 4212 | /* set connection select to line in (default select for this ADC) */ |
| 4213 | {0x04, AC_VERB_SET_CONNECT_SEL, 0x02}, |
| 4214 | /* unmute Line-Out mixer amp left and right (volume = 0) */ |
| 4215 | {0x08, AC_VERB_SET_AMP_GAIN_MUTE, 0xb000}, |
| 4216 | /* mute pin widget amp left and right (no gain on this amp) */ |
| 4217 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, 0x0000}, |
| 4218 | /* unmute HP mixer amp left and right (volume = 0) */ |
| 4219 | {0x09, AC_VERB_SET_AMP_GAIN_MUTE, 0xb000}, |
| 4220 | /* mute pin widget amp left and right (no gain on this amp) */ |
| 4221 | {0x10, AC_VERB_SET_AMP_GAIN_MUTE, 0x0000}, |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 4222 | /* Amp Indexes: CD = 0x04, Line In 1 = 0x02, Mic 1 = 0x00 & |
| 4223 | * Line In 2 = 0x03 |
| 4224 | */ |
Takashi Iwai | cb53c62 | 2007-08-10 17:21:45 +0200 | [diff] [blame] | 4225 | /* mute analog inputs */ |
| 4226 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 4227 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
| 4228 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)}, |
| 4229 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)}, |
| 4230 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)}, |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 4231 | /* Amp Indexes: DAC = 0x01 & mixer = 0x00 */ |
| 4232 | /* Unmute Front out path */ |
| 4233 | {0x08, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))}, |
| 4234 | {0x08, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x01 << 8))}, |
| 4235 | /* Unmute Headphone out path */ |
| 4236 | {0x09, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))}, |
| 4237 | {0x09, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x01 << 8))}, |
| 4238 | /* Unmute Mono out path */ |
| 4239 | {0x0a, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))}, |
| 4240 | {0x0a, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x01 << 8))}, |
| 4241 | { } |
| 4242 | }; |
Takashi Iwai | 474167d | 2006-05-17 17:17:43 +0200 | [diff] [blame] | 4243 | #endif |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 4244 | |
| 4245 | static struct hda_verb alc260_hp_3013_init_verbs[] = { |
| 4246 | /* Line out and output */ |
| 4247 | {0x10, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x40}, |
| 4248 | /* mono output */ |
| 4249 | {0x11, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x40}, |
| 4250 | /* Mic1 (rear panel) pin widget for input and vref at 80% */ |
| 4251 | {0x12, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24}, |
| 4252 | /* Mic2 (front panel) pin widget for input and vref at 80% */ |
| 4253 | {0x13, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24}, |
| 4254 | /* Line In pin widget for input */ |
| 4255 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20}, |
| 4256 | /* Headphone pin widget for output */ |
| 4257 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, 0xc0}, |
| 4258 | /* CD pin widget for input */ |
| 4259 | {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20}, |
| 4260 | /* unmute amp left and right */ |
| 4261 | {0x04, AC_VERB_SET_AMP_GAIN_MUTE, 0x7000}, |
| 4262 | /* set connection select to line in (default select for this ADC) */ |
| 4263 | {0x04, AC_VERB_SET_CONNECT_SEL, 0x02}, |
| 4264 | /* unmute Line-Out mixer amp left and right (volume = 0) */ |
| 4265 | {0x08, AC_VERB_SET_AMP_GAIN_MUTE, 0xb000}, |
| 4266 | /* mute pin widget amp left and right (no gain on this amp) */ |
| 4267 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, 0x0000}, |
| 4268 | /* unmute HP mixer amp left and right (volume = 0) */ |
| 4269 | {0x09, AC_VERB_SET_AMP_GAIN_MUTE, 0xb000}, |
| 4270 | /* mute pin widget amp left and right (no gain on this amp) */ |
| 4271 | {0x10, AC_VERB_SET_AMP_GAIN_MUTE, 0x0000}, |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 4272 | /* Amp Indexes: CD = 0x04, Line In 1 = 0x02, Mic 1 = 0x00 & |
| 4273 | * Line In 2 = 0x03 |
| 4274 | */ |
Takashi Iwai | cb53c62 | 2007-08-10 17:21:45 +0200 | [diff] [blame] | 4275 | /* mute analog inputs */ |
| 4276 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 4277 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
| 4278 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)}, |
| 4279 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)}, |
| 4280 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)}, |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 4281 | /* Amp Indexes: DAC = 0x01 & mixer = 0x00 */ |
| 4282 | /* Unmute Front out path */ |
| 4283 | {0x08, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))}, |
| 4284 | {0x08, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x01 << 8))}, |
| 4285 | /* Unmute Headphone out path */ |
| 4286 | {0x09, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))}, |
| 4287 | {0x09, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x01 << 8))}, |
| 4288 | /* Unmute Mono out path */ |
| 4289 | {0x0a, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))}, |
| 4290 | {0x0a, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x01 << 8))}, |
| 4291 | { } |
| 4292 | }; |
| 4293 | |
Jonathan Woithe | a9430dd | 2005-09-16 19:12:48 +0200 | [diff] [blame] | 4294 | /* Initialisation sequence for ALC260 as configured in Fujitsu S702x |
Jonathan Woithe | a1e8d2d | 2006-03-28 12:47:09 +0200 | [diff] [blame] | 4295 | * laptops. ALC260 pin usage: Mic/Line jack = 0x12, HP jack = 0x14, CD |
| 4296 | * audio = 0x16, internal speaker = 0x10. |
Jonathan Woithe | a9430dd | 2005-09-16 19:12:48 +0200 | [diff] [blame] | 4297 | */ |
| 4298 | static struct hda_verb alc260_fujitsu_init_verbs[] = { |
| 4299 | /* Disable all GPIOs */ |
| 4300 | {0x01, AC_VERB_SET_GPIO_MASK, 0}, |
| 4301 | /* Internal speaker is connected to headphone pin */ |
| 4302 | {0x10, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 4303 | /* Headphone/Line-out jack connects to Line1 pin; make it an output */ |
| 4304 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
Jonathan Woithe | f7ace40 | 2006-02-28 11:46:14 +0100 | [diff] [blame] | 4305 | /* Mic/Line-in jack is connected to mic1 pin, so make it an input */ |
| 4306 | {0x12, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
| 4307 | /* Ensure all other unused pins are disabled and muted. */ |
| 4308 | {0x0f, AC_VERB_SET_PIN_WIDGET_CONTROL, 0}, |
| 4309 | {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
Jonathan Woithe | a9430dd | 2005-09-16 19:12:48 +0200 | [diff] [blame] | 4310 | {0x11, AC_VERB_SET_PIN_WIDGET_CONTROL, 0}, |
Jonathan Woithe | f7ace40 | 2006-02-28 11:46:14 +0100 | [diff] [blame] | 4311 | {0x11, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
Jonathan Woithe | a9430dd | 2005-09-16 19:12:48 +0200 | [diff] [blame] | 4312 | {0x13, AC_VERB_SET_PIN_WIDGET_CONTROL, 0}, |
Jonathan Woithe | f7ace40 | 2006-02-28 11:46:14 +0100 | [diff] [blame] | 4313 | {0x13, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 4314 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, 0}, |
| 4315 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
Jonathan Woithe | a9430dd | 2005-09-16 19:12:48 +0200 | [diff] [blame] | 4316 | |
Jonathan Woithe | f7ace40 | 2006-02-28 11:46:14 +0100 | [diff] [blame] | 4317 | /* Disable digital (SPDIF) pins */ |
| 4318 | {0x03, AC_VERB_SET_DIGI_CONVERT_1, 0}, |
| 4319 | {0x06, AC_VERB_SET_DIGI_CONVERT_1, 0}, |
Jonathan Woithe | 4c5186e | 2006-02-09 11:53:48 +0100 | [diff] [blame] | 4320 | |
Jonathan Woithe | f7ace40 | 2006-02-28 11:46:14 +0100 | [diff] [blame] | 4321 | /* Ensure Line1 pin widget takes its input from the OUT1 sum bus |
| 4322 | * when acting as an output. |
| 4323 | */ |
| 4324 | {0x0d, AC_VERB_SET_CONNECT_SEL, 0}, |
| 4325 | |
| 4326 | /* Start with output sum widgets muted and their output gains at min */ |
Takashi Iwai | 8b33a5a | 2006-02-09 11:57:01 +0100 | [diff] [blame] | 4327 | {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 4328 | {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
| 4329 | {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 4330 | {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 4331 | {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
| 4332 | {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 4333 | {0x0a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 4334 | {0x0a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
| 4335 | {0x0a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
Jonathan Woithe | a9430dd | 2005-09-16 19:12:48 +0200 | [diff] [blame] | 4336 | |
Jonathan Woithe | f7ace40 | 2006-02-28 11:46:14 +0100 | [diff] [blame] | 4337 | /* Unmute HP pin widget amp left and right (no equiv mixer ctrl) */ |
| 4338 | {0x10, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 4339 | /* Unmute Line1 pin widget output buffer since it starts as an output. |
| 4340 | * If the pin mode is changed by the user the pin mode control will |
| 4341 | * take care of enabling the pin's input/output buffers as needed. |
| 4342 | * Therefore there's no need to enable the input buffer at this |
| 4343 | * stage. |
Jonathan Woithe | cdcd926 | 2006-02-28 11:36:42 +0100 | [diff] [blame] | 4344 | */ |
Jonathan Woithe | f7ace40 | 2006-02-28 11:46:14 +0100 | [diff] [blame] | 4345 | {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
Jonathan Woithe | cdcd926 | 2006-02-28 11:36:42 +0100 | [diff] [blame] | 4346 | /* Unmute input buffer of pin widget used for Line-in (no equiv |
| 4347 | * mixer ctrl) |
| 4348 | */ |
Jonathan Woithe | f7ace40 | 2006-02-28 11:46:14 +0100 | [diff] [blame] | 4349 | {0x12, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
Jonathan Woithe | a9430dd | 2005-09-16 19:12:48 +0200 | [diff] [blame] | 4350 | |
Jonathan Woithe | f7ace40 | 2006-02-28 11:46:14 +0100 | [diff] [blame] | 4351 | /* Mute capture amp left and right */ |
| 4352 | {0x04, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 4353 | /* Set ADC connection select to match default mixer setting - line |
| 4354 | * in (on mic1 pin) |
| 4355 | */ |
| 4356 | {0x04, AC_VERB_SET_CONNECT_SEL, 0x00}, |
Jonathan Woithe | a9430dd | 2005-09-16 19:12:48 +0200 | [diff] [blame] | 4357 | |
Jonathan Woithe | f7ace40 | 2006-02-28 11:46:14 +0100 | [diff] [blame] | 4358 | /* Do the same for the second ADC: mute capture input amp and |
| 4359 | * set ADC connection to line in (on mic1 pin) |
| 4360 | */ |
| 4361 | {0x05, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 4362 | {0x05, AC_VERB_SET_CONNECT_SEL, 0x00}, |
Jonathan Woithe | 4c5186e | 2006-02-09 11:53:48 +0100 | [diff] [blame] | 4363 | |
Jonathan Woithe | f7ace40 | 2006-02-28 11:46:14 +0100 | [diff] [blame] | 4364 | /* Mute all inputs to mixer widget (even unconnected ones) */ |
| 4365 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, /* mic1 pin */ |
| 4366 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, /* mic2 pin */ |
| 4367 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)}, /* line1 pin */ |
| 4368 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)}, /* line2 pin */ |
| 4369 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)}, /* CD pin */ |
| 4370 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(5)}, /* Beep-gen pin */ |
| 4371 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(6)}, /* Line-out pin */ |
| 4372 | {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] | 4373 | |
| 4374 | { } |
Jonathan Woithe | a9430dd | 2005-09-16 19:12:48 +0200 | [diff] [blame] | 4375 | }; |
| 4376 | |
Jonathan Woithe | 0bfc90e | 2006-02-28 11:45:11 +0100 | [diff] [blame] | 4377 | /* Initialisation sequence for ALC260 as configured in Acer TravelMate and |
| 4378 | * similar laptops (adapted from Fujitsu init verbs). |
| 4379 | */ |
| 4380 | static struct hda_verb alc260_acer_init_verbs[] = { |
| 4381 | /* On TravelMate laptops, GPIO 0 enables the internal speaker and |
| 4382 | * the headphone jack. Turn this on and rely on the standard mute |
| 4383 | * methods whenever the user wants to turn these outputs off. |
| 4384 | */ |
| 4385 | {0x01, AC_VERB_SET_GPIO_MASK, 0x01}, |
| 4386 | {0x01, AC_VERB_SET_GPIO_DIRECTION, 0x01}, |
| 4387 | {0x01, AC_VERB_SET_GPIO_DATA, 0x01}, |
| 4388 | /* Internal speaker/Headphone jack is connected to Line-out pin */ |
| 4389 | {0x0f, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 4390 | /* Internal microphone/Mic jack is connected to Mic1 pin */ |
| 4391 | {0x12, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF50}, |
| 4392 | /* Line In jack is connected to Line1 pin */ |
| 4393 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
Jonathan Woithe | bd86948 | 2006-11-28 11:35:52 +0100 | [diff] [blame] | 4394 | /* Some Acers (eg: C20x Tablets) use Mono pin for internal speaker */ |
| 4395 | {0x11, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
Jonathan Woithe | 0bfc90e | 2006-02-28 11:45:11 +0100 | [diff] [blame] | 4396 | /* Ensure all other unused pins are disabled and muted. */ |
| 4397 | {0x10, AC_VERB_SET_PIN_WIDGET_CONTROL, 0}, |
| 4398 | {0x10, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
Jonathan Woithe | 0bfc90e | 2006-02-28 11:45:11 +0100 | [diff] [blame] | 4399 | {0x13, AC_VERB_SET_PIN_WIDGET_CONTROL, 0}, |
| 4400 | {0x13, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 4401 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, 0}, |
| 4402 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 4403 | /* Disable digital (SPDIF) pins */ |
| 4404 | {0x03, AC_VERB_SET_DIGI_CONVERT_1, 0}, |
| 4405 | {0x06, AC_VERB_SET_DIGI_CONVERT_1, 0}, |
| 4406 | |
| 4407 | /* Ensure Mic1 and Line1 pin widgets take input from the OUT1 sum |
| 4408 | * bus when acting as outputs. |
| 4409 | */ |
| 4410 | {0x0b, AC_VERB_SET_CONNECT_SEL, 0}, |
| 4411 | {0x0d, AC_VERB_SET_CONNECT_SEL, 0}, |
| 4412 | |
| 4413 | /* Start with output sum widgets muted and their output gains at min */ |
| 4414 | {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 4415 | {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
| 4416 | {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 4417 | {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 4418 | {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
| 4419 | {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 4420 | {0x0a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 4421 | {0x0a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
| 4422 | {0x0a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 4423 | |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 4424 | /* Unmute Line-out pin widget amp left and right |
| 4425 | * (no equiv mixer ctrl) |
| 4426 | */ |
Jonathan Woithe | 0bfc90e | 2006-02-28 11:45:11 +0100 | [diff] [blame] | 4427 | {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
Jonathan Woithe | bd86948 | 2006-11-28 11:35:52 +0100 | [diff] [blame] | 4428 | /* Unmute mono pin widget amp output (no equiv mixer ctrl) */ |
| 4429 | {0x11, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
Jonathan Woithe | 0bfc90e | 2006-02-28 11:45:11 +0100 | [diff] [blame] | 4430 | /* Unmute Mic1 and Line1 pin widget input buffers since they start as |
| 4431 | * inputs. If the pin mode is changed by the user the pin mode control |
| 4432 | * will take care of enabling the pin's input/output buffers as needed. |
| 4433 | * Therefore there's no need to enable the input buffer at this |
| 4434 | * stage. |
| 4435 | */ |
| 4436 | {0x12, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 4437 | {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 4438 | |
| 4439 | /* Mute capture amp left and right */ |
| 4440 | {0x04, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 4441 | /* Set ADC connection select to match default mixer setting - mic |
| 4442 | * (on mic1 pin) |
| 4443 | */ |
| 4444 | {0x04, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 4445 | |
| 4446 | /* Do similar with the second ADC: mute capture input amp and |
Jonathan Woithe | a1e8d2d | 2006-03-28 12:47:09 +0200 | [diff] [blame] | 4447 | * set ADC connection to mic to match ALSA's default state. |
Jonathan Woithe | 0bfc90e | 2006-02-28 11:45:11 +0100 | [diff] [blame] | 4448 | */ |
| 4449 | {0x05, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
Jonathan Woithe | a1e8d2d | 2006-03-28 12:47:09 +0200 | [diff] [blame] | 4450 | {0x05, AC_VERB_SET_CONNECT_SEL, 0x00}, |
Jonathan Woithe | 0bfc90e | 2006-02-28 11:45:11 +0100 | [diff] [blame] | 4451 | |
| 4452 | /* Mute all inputs to mixer widget (even unconnected ones) */ |
| 4453 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, /* mic1 pin */ |
| 4454 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, /* mic2 pin */ |
| 4455 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)}, /* line1 pin */ |
| 4456 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)}, /* line2 pin */ |
| 4457 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)}, /* CD pin */ |
| 4458 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(5)}, /* Beep-gen pin */ |
| 4459 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(6)}, /* Line-out pin */ |
| 4460 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(7)}, /* HP-pin pin */ |
| 4461 | |
| 4462 | { } |
| 4463 | }; |
| 4464 | |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 4465 | static struct hda_verb alc260_will_verbs[] = { |
| 4466 | {0x0f, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 4467 | {0x0b, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 4468 | {0x0d, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 4469 | {0x0f, AC_VERB_SET_EAPD_BTLENABLE, 0x02}, |
| 4470 | {0x1a, AC_VERB_SET_COEF_INDEX, 0x07}, |
| 4471 | {0x1a, AC_VERB_SET_PROC_COEF, 0x3040}, |
| 4472 | {} |
| 4473 | }; |
| 4474 | |
| 4475 | static struct hda_verb alc260_replacer_672v_verbs[] = { |
| 4476 | {0x0f, AC_VERB_SET_EAPD_BTLENABLE, 0x02}, |
| 4477 | {0x1a, AC_VERB_SET_COEF_INDEX, 0x07}, |
| 4478 | {0x1a, AC_VERB_SET_PROC_COEF, 0x3050}, |
| 4479 | |
| 4480 | {0x01, AC_VERB_SET_GPIO_MASK, 0x01}, |
| 4481 | {0x01, AC_VERB_SET_GPIO_DIRECTION, 0x01}, |
| 4482 | {0x01, AC_VERB_SET_GPIO_DATA, 0x00}, |
| 4483 | |
| 4484 | {0x0f, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT}, |
| 4485 | {} |
| 4486 | }; |
| 4487 | |
| 4488 | /* toggle speaker-output according to the hp-jack state */ |
| 4489 | static void alc260_replacer_672v_automute(struct hda_codec *codec) |
| 4490 | { |
| 4491 | unsigned int present; |
| 4492 | |
| 4493 | /* speaker --> GPIO Data 0, hp or spdif --> GPIO data 1 */ |
| 4494 | present = snd_hda_codec_read(codec, 0x0f, 0, |
| 4495 | AC_VERB_GET_PIN_SENSE, 0) & 0x80000000; |
| 4496 | if (present) { |
Takashi Iwai | 82beb8f | 2007-08-10 17:09:26 +0200 | [diff] [blame] | 4497 | snd_hda_codec_write_cache(codec, 0x01, 0, |
| 4498 | AC_VERB_SET_GPIO_DATA, 1); |
| 4499 | snd_hda_codec_write_cache(codec, 0x0f, 0, |
| 4500 | AC_VERB_SET_PIN_WIDGET_CONTROL, |
| 4501 | PIN_HP); |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 4502 | } else { |
Takashi Iwai | 82beb8f | 2007-08-10 17:09:26 +0200 | [diff] [blame] | 4503 | snd_hda_codec_write_cache(codec, 0x01, 0, |
| 4504 | AC_VERB_SET_GPIO_DATA, 0); |
| 4505 | snd_hda_codec_write_cache(codec, 0x0f, 0, |
| 4506 | AC_VERB_SET_PIN_WIDGET_CONTROL, |
| 4507 | PIN_OUT); |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 4508 | } |
| 4509 | } |
| 4510 | |
| 4511 | static void alc260_replacer_672v_unsol_event(struct hda_codec *codec, |
| 4512 | unsigned int res) |
| 4513 | { |
| 4514 | if ((res >> 26) == ALC880_HP_EVENT) |
| 4515 | alc260_replacer_672v_automute(codec); |
| 4516 | } |
| 4517 | |
Jonathan Woithe | 7cf51e48 | 2006-02-09 12:01:26 +0100 | [diff] [blame] | 4518 | /* Test configuration for debugging, modelled after the ALC880 test |
| 4519 | * configuration. |
| 4520 | */ |
| 4521 | #ifdef CONFIG_SND_DEBUG |
| 4522 | static hda_nid_t alc260_test_dac_nids[1] = { |
| 4523 | 0x02, |
| 4524 | }; |
| 4525 | static hda_nid_t alc260_test_adc_nids[2] = { |
| 4526 | 0x04, 0x05, |
| 4527 | }; |
Jonathan Woithe | a1e8d2d | 2006-03-28 12:47:09 +0200 | [diff] [blame] | 4528 | /* For testing the ALC260, each input MUX needs its own definition since |
| 4529 | * the signal assignments are different. This assumes that the first ADC |
| 4530 | * is NID 0x04. |
Jonathan Woithe | 17e7aec | 2006-02-28 11:35:18 +0100 | [diff] [blame] | 4531 | */ |
Jonathan Woithe | a1e8d2d | 2006-03-28 12:47:09 +0200 | [diff] [blame] | 4532 | static struct hda_input_mux alc260_test_capture_sources[2] = { |
| 4533 | { |
| 4534 | .num_items = 7, |
| 4535 | .items = { |
| 4536 | { "MIC1 pin", 0x0 }, |
| 4537 | { "MIC2 pin", 0x1 }, |
| 4538 | { "LINE1 pin", 0x2 }, |
| 4539 | { "LINE2 pin", 0x3 }, |
| 4540 | { "CD pin", 0x4 }, |
| 4541 | { "LINE-OUT pin", 0x5 }, |
| 4542 | { "HP-OUT pin", 0x6 }, |
| 4543 | }, |
| 4544 | }, |
| 4545 | { |
| 4546 | .num_items = 8, |
| 4547 | .items = { |
| 4548 | { "MIC1 pin", 0x0 }, |
| 4549 | { "MIC2 pin", 0x1 }, |
| 4550 | { "LINE1 pin", 0x2 }, |
| 4551 | { "LINE2 pin", 0x3 }, |
| 4552 | { "CD pin", 0x4 }, |
| 4553 | { "Mixer", 0x5 }, |
| 4554 | { "LINE-OUT pin", 0x6 }, |
| 4555 | { "HP-OUT pin", 0x7 }, |
| 4556 | }, |
Jonathan Woithe | 7cf51e48 | 2006-02-09 12:01:26 +0100 | [diff] [blame] | 4557 | }, |
| 4558 | }; |
| 4559 | static struct snd_kcontrol_new alc260_test_mixer[] = { |
| 4560 | /* Output driver widgets */ |
| 4561 | HDA_CODEC_VOLUME_MONO("Mono Playback Volume", 0x0a, 1, 0x0, HDA_OUTPUT), |
| 4562 | HDA_BIND_MUTE_MONO("Mono Playback Switch", 0x0a, 1, 2, HDA_INPUT), |
| 4563 | HDA_CODEC_VOLUME("LOUT2 Playback Volume", 0x09, 0x0, HDA_OUTPUT), |
| 4564 | HDA_BIND_MUTE("LOUT2 Playback Switch", 0x09, 2, HDA_INPUT), |
| 4565 | HDA_CODEC_VOLUME("LOUT1 Playback Volume", 0x08, 0x0, HDA_OUTPUT), |
| 4566 | HDA_BIND_MUTE("LOUT1 Playback Switch", 0x08, 2, HDA_INPUT), |
| 4567 | |
Jonathan Woithe | a1e8d2d | 2006-03-28 12:47:09 +0200 | [diff] [blame] | 4568 | /* Modes for retasking pin widgets |
| 4569 | * Note: the ALC260 doesn't seem to act on requests to enable mic |
| 4570 | * bias from NIDs 0x0f and 0x10. The ALC260 datasheet doesn't |
| 4571 | * mention this restriction. At this stage it's not clear whether |
| 4572 | * this behaviour is intentional or is a hardware bug in chip |
| 4573 | * revisions available at least up until early 2006. Therefore for |
| 4574 | * now allow the "HP-OUT" and "LINE-OUT" Mode controls to span all |
| 4575 | * choices, but if it turns out that the lack of mic bias for these |
| 4576 | * NIDs is intentional we could change their modes from |
| 4577 | * ALC_PIN_DIR_INOUT to ALC_PIN_DIR_INOUT_NOMICBIAS. |
| 4578 | */ |
Jonathan Woithe | 7cf51e48 | 2006-02-09 12:01:26 +0100 | [diff] [blame] | 4579 | ALC_PIN_MODE("HP-OUT pin mode", 0x10, ALC_PIN_DIR_INOUT), |
| 4580 | ALC_PIN_MODE("LINE-OUT pin mode", 0x0f, ALC_PIN_DIR_INOUT), |
| 4581 | ALC_PIN_MODE("LINE2 pin mode", 0x15, ALC_PIN_DIR_INOUT), |
| 4582 | ALC_PIN_MODE("LINE1 pin mode", 0x14, ALC_PIN_DIR_INOUT), |
| 4583 | ALC_PIN_MODE("MIC2 pin mode", 0x13, ALC_PIN_DIR_INOUT), |
| 4584 | ALC_PIN_MODE("MIC1 pin mode", 0x12, ALC_PIN_DIR_INOUT), |
| 4585 | |
| 4586 | /* Loopback mixer controls */ |
| 4587 | HDA_CODEC_VOLUME("MIC1 Playback Volume", 0x07, 0x00, HDA_INPUT), |
| 4588 | HDA_CODEC_MUTE("MIC1 Playback Switch", 0x07, 0x00, HDA_INPUT), |
| 4589 | HDA_CODEC_VOLUME("MIC2 Playback Volume", 0x07, 0x01, HDA_INPUT), |
| 4590 | HDA_CODEC_MUTE("MIC2 Playback Switch", 0x07, 0x01, HDA_INPUT), |
| 4591 | HDA_CODEC_VOLUME("LINE1 Playback Volume", 0x07, 0x02, HDA_INPUT), |
| 4592 | HDA_CODEC_MUTE("LINE1 Playback Switch", 0x07, 0x02, HDA_INPUT), |
| 4593 | HDA_CODEC_VOLUME("LINE2 Playback Volume", 0x07, 0x03, HDA_INPUT), |
| 4594 | HDA_CODEC_MUTE("LINE2 Playback Switch", 0x07, 0x03, HDA_INPUT), |
| 4595 | HDA_CODEC_VOLUME("CD Playback Volume", 0x07, 0x04, HDA_INPUT), |
| 4596 | HDA_CODEC_MUTE("CD Playback Switch", 0x07, 0x04, HDA_INPUT), |
| 4597 | HDA_CODEC_VOLUME("Beep Playback Volume", 0x07, 0x05, HDA_INPUT), |
| 4598 | HDA_CODEC_MUTE("Beep Playback Switch", 0x07, 0x05, HDA_INPUT), |
| 4599 | HDA_CODEC_VOLUME("LINE-OUT loopback Playback Volume", 0x07, 0x06, HDA_INPUT), |
| 4600 | HDA_CODEC_MUTE("LINE-OUT loopback Playback Switch", 0x07, 0x06, HDA_INPUT), |
| 4601 | HDA_CODEC_VOLUME("HP-OUT loopback Playback Volume", 0x07, 0x7, HDA_INPUT), |
| 4602 | HDA_CODEC_MUTE("HP-OUT loopback Playback Switch", 0x07, 0x7, HDA_INPUT), |
Jonathan Woithe | 5c8f858 | 2006-02-28 11:43:27 +0100 | [diff] [blame] | 4603 | |
| 4604 | /* Controls for GPIO pins, assuming they are configured as outputs */ |
| 4605 | ALC_GPIO_DATA_SWITCH("GPIO pin 0", 0x01, 0x01), |
| 4606 | ALC_GPIO_DATA_SWITCH("GPIO pin 1", 0x01, 0x02), |
| 4607 | ALC_GPIO_DATA_SWITCH("GPIO pin 2", 0x01, 0x04), |
| 4608 | ALC_GPIO_DATA_SWITCH("GPIO pin 3", 0x01, 0x08), |
| 4609 | |
Jonathan Woithe | 92621f1 | 2006-02-28 11:47:47 +0100 | [diff] [blame] | 4610 | /* Switches to allow the digital IO pins to be enabled. The datasheet |
| 4611 | * is ambigious as to which NID is which; testing on laptops which |
| 4612 | * make this output available should provide clarification. |
| 4613 | */ |
| 4614 | ALC_SPDIF_CTRL_SWITCH("SPDIF Playback Switch", 0x03, 0x01), |
| 4615 | ALC_SPDIF_CTRL_SWITCH("SPDIF Capture Switch", 0x06, 0x01), |
| 4616 | |
Jonathan Woithe | f8225f6 | 2008-01-08 12:16:54 +0100 | [diff] [blame] | 4617 | /* A switch allowing EAPD to be enabled. Some laptops seem to use |
| 4618 | * this output to turn on an external amplifier. |
| 4619 | */ |
| 4620 | ALC_EAPD_CTRL_SWITCH("LINE-OUT EAPD Enable Switch", 0x0f, 0x02), |
| 4621 | ALC_EAPD_CTRL_SWITCH("HP-OUT EAPD Enable Switch", 0x10, 0x02), |
| 4622 | |
Jonathan Woithe | 7cf51e48 | 2006-02-09 12:01:26 +0100 | [diff] [blame] | 4623 | { } /* end */ |
| 4624 | }; |
| 4625 | static struct hda_verb alc260_test_init_verbs[] = { |
Jonathan Woithe | 5c8f858 | 2006-02-28 11:43:27 +0100 | [diff] [blame] | 4626 | /* Enable all GPIOs as outputs with an initial value of 0 */ |
| 4627 | {0x01, AC_VERB_SET_GPIO_DIRECTION, 0x0f}, |
| 4628 | {0x01, AC_VERB_SET_GPIO_DATA, 0x00}, |
| 4629 | {0x01, AC_VERB_SET_GPIO_MASK, 0x0f}, |
| 4630 | |
Jonathan Woithe | 7cf51e48 | 2006-02-09 12:01:26 +0100 | [diff] [blame] | 4631 | /* Enable retasking pins as output, initially without power amp */ |
| 4632 | {0x10, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 4633 | {0x0f, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 4634 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 4635 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 4636 | {0x13, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 4637 | {0x12, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 4638 | |
Jonathan Woithe | 92621f1 | 2006-02-28 11:47:47 +0100 | [diff] [blame] | 4639 | /* Disable digital (SPDIF) pins initially, but users can enable |
| 4640 | * them via a mixer switch. In the case of SPDIF-out, this initverb |
| 4641 | * payload also sets the generation to 0, output to be in "consumer" |
| 4642 | * PCM format, copyright asserted, no pre-emphasis and no validity |
| 4643 | * control. |
| 4644 | */ |
Jonathan Woithe | 7cf51e48 | 2006-02-09 12:01:26 +0100 | [diff] [blame] | 4645 | {0x03, AC_VERB_SET_DIGI_CONVERT_1, 0}, |
| 4646 | {0x06, AC_VERB_SET_DIGI_CONVERT_1, 0}, |
| 4647 | |
Jonathan Woithe | f7ace40 | 2006-02-28 11:46:14 +0100 | [diff] [blame] | 4648 | /* Ensure mic1, mic2, line1 and line2 pin widgets take input from the |
Jonathan Woithe | 7cf51e48 | 2006-02-09 12:01:26 +0100 | [diff] [blame] | 4649 | * OUT1 sum bus when acting as an output. |
| 4650 | */ |
| 4651 | {0x0b, AC_VERB_SET_CONNECT_SEL, 0}, |
| 4652 | {0x0c, AC_VERB_SET_CONNECT_SEL, 0}, |
| 4653 | {0x0d, AC_VERB_SET_CONNECT_SEL, 0}, |
| 4654 | {0x0e, AC_VERB_SET_CONNECT_SEL, 0}, |
| 4655 | |
| 4656 | /* Start with output sum widgets muted and their output gains at min */ |
| 4657 | {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 4658 | {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
| 4659 | {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 4660 | {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 4661 | {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
| 4662 | {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 4663 | {0x0a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 4664 | {0x0a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
| 4665 | {0x0a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 4666 | |
Jonathan Woithe | cdcd926 | 2006-02-28 11:36:42 +0100 | [diff] [blame] | 4667 | /* Unmute retasking pin widget output buffers since the default |
| 4668 | * state appears to be output. As the pin mode is changed by the |
| 4669 | * user the pin mode control will take care of enabling the pin's |
| 4670 | * input/output buffers as needed. |
| 4671 | */ |
Jonathan Woithe | 7cf51e48 | 2006-02-09 12:01:26 +0100 | [diff] [blame] | 4672 | {0x10, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 4673 | {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 4674 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 4675 | {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 4676 | {0x13, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 4677 | {0x12, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 4678 | /* Also unmute the mono-out pin widget */ |
| 4679 | {0x11, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 4680 | |
Jonathan Woithe | 7cf51e48 | 2006-02-09 12:01:26 +0100 | [diff] [blame] | 4681 | /* Mute capture amp left and right */ |
| 4682 | {0x04, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
Jonathan Woithe | f7ace40 | 2006-02-28 11:46:14 +0100 | [diff] [blame] | 4683 | /* Set ADC connection select to match default mixer setting (mic1 |
| 4684 | * pin) |
Jonathan Woithe | 7cf51e48 | 2006-02-09 12:01:26 +0100 | [diff] [blame] | 4685 | */ |
| 4686 | {0x04, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 4687 | |
| 4688 | /* Do the same for the second ADC: mute capture input amp and |
Jonathan Woithe | f7ace40 | 2006-02-28 11:46:14 +0100 | [diff] [blame] | 4689 | * set ADC connection to mic1 pin |
Jonathan Woithe | 7cf51e48 | 2006-02-09 12:01:26 +0100 | [diff] [blame] | 4690 | */ |
| 4691 | {0x05, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 4692 | {0x05, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 4693 | |
| 4694 | /* Mute all inputs to mixer widget (even unconnected ones) */ |
| 4695 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, /* mic1 pin */ |
| 4696 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, /* mic2 pin */ |
| 4697 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)}, /* line1 pin */ |
| 4698 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)}, /* line2 pin */ |
| 4699 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)}, /* CD pin */ |
| 4700 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(5)}, /* Beep-gen pin */ |
| 4701 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(6)}, /* Line-out pin */ |
| 4702 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(7)}, /* HP-pin pin */ |
| 4703 | |
| 4704 | { } |
| 4705 | }; |
| 4706 | #endif |
| 4707 | |
Takashi Iwai | 6330079 | 2008-01-24 15:31:36 +0100 | [diff] [blame] | 4708 | #define alc260_pcm_analog_playback alc880_pcm_analog_alt_playback |
| 4709 | #define alc260_pcm_analog_capture alc880_pcm_analog_capture |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 4710 | |
Takashi Iwai | a3bcba3 | 2005-12-06 19:05:29 +0100 | [diff] [blame] | 4711 | #define alc260_pcm_digital_playback alc880_pcm_digital_playback |
| 4712 | #define alc260_pcm_digital_capture alc880_pcm_digital_capture |
| 4713 | |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 4714 | /* |
| 4715 | * for BIOS auto-configuration |
| 4716 | */ |
| 4717 | |
| 4718 | static int alc260_add_playback_controls(struct alc_spec *spec, hda_nid_t nid, |
| 4719 | const char *pfx) |
| 4720 | { |
| 4721 | hda_nid_t nid_vol; |
| 4722 | unsigned long vol_val, sw_val; |
| 4723 | char name[32]; |
| 4724 | int err; |
| 4725 | |
| 4726 | if (nid >= 0x0f && nid < 0x11) { |
| 4727 | nid_vol = nid - 0x7; |
| 4728 | vol_val = HDA_COMPOSE_AMP_VAL(nid_vol, 3, 0, HDA_OUTPUT); |
| 4729 | sw_val = HDA_COMPOSE_AMP_VAL(nid, 3, 0, HDA_OUTPUT); |
| 4730 | } else if (nid == 0x11) { |
| 4731 | nid_vol = nid - 0x7; |
| 4732 | vol_val = HDA_COMPOSE_AMP_VAL(nid_vol, 2, 0, HDA_OUTPUT); |
| 4733 | sw_val = HDA_COMPOSE_AMP_VAL(nid, 2, 0, HDA_OUTPUT); |
| 4734 | } else if (nid >= 0x12 && nid <= 0x15) { |
| 4735 | nid_vol = 0x08; |
| 4736 | vol_val = HDA_COMPOSE_AMP_VAL(nid_vol, 3, 0, HDA_OUTPUT); |
| 4737 | sw_val = HDA_COMPOSE_AMP_VAL(nid, 3, 0, HDA_OUTPUT); |
| 4738 | } else |
| 4739 | return 0; /* N/A */ |
| 4740 | |
| 4741 | snprintf(name, sizeof(name), "%s Playback Volume", pfx); |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 4742 | err = add_control(spec, ALC_CTL_WIDGET_VOL, name, vol_val); |
| 4743 | if (err < 0) |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 4744 | return err; |
| 4745 | snprintf(name, sizeof(name), "%s Playback Switch", pfx); |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 4746 | err = add_control(spec, ALC_CTL_WIDGET_MUTE, name, sw_val); |
| 4747 | if (err < 0) |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 4748 | return err; |
| 4749 | return 1; |
| 4750 | } |
| 4751 | |
| 4752 | /* add playback controls from the parsed DAC table */ |
| 4753 | static int alc260_auto_create_multi_out_ctls(struct alc_spec *spec, |
| 4754 | const struct auto_pin_cfg *cfg) |
| 4755 | { |
| 4756 | hda_nid_t nid; |
| 4757 | int err; |
| 4758 | |
| 4759 | spec->multiout.num_dacs = 1; |
| 4760 | spec->multiout.dac_nids = spec->private_dac_nids; |
| 4761 | spec->multiout.dac_nids[0] = 0x02; |
| 4762 | |
| 4763 | nid = cfg->line_out_pins[0]; |
| 4764 | if (nid) { |
| 4765 | err = alc260_add_playback_controls(spec, nid, "Front"); |
| 4766 | if (err < 0) |
| 4767 | return err; |
| 4768 | } |
| 4769 | |
Takashi Iwai | 82bc955 | 2006-03-21 11:24:42 +0100 | [diff] [blame] | 4770 | nid = cfg->speaker_pins[0]; |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 4771 | if (nid) { |
| 4772 | err = alc260_add_playback_controls(spec, nid, "Speaker"); |
| 4773 | if (err < 0) |
| 4774 | return err; |
| 4775 | } |
| 4776 | |
Takashi Iwai | eb06ed8 | 2006-09-20 17:10:27 +0200 | [diff] [blame] | 4777 | nid = cfg->hp_pins[0]; |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 4778 | if (nid) { |
| 4779 | err = alc260_add_playback_controls(spec, nid, "Headphone"); |
| 4780 | if (err < 0) |
| 4781 | return err; |
| 4782 | } |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 4783 | return 0; |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 4784 | } |
| 4785 | |
| 4786 | /* create playback/capture controls for input pins */ |
| 4787 | static int alc260_auto_create_analog_input_ctls(struct alc_spec *spec, |
| 4788 | const struct auto_pin_cfg *cfg) |
| 4789 | { |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 4790 | struct hda_input_mux *imux = &spec->private_imux; |
| 4791 | int i, err, idx; |
| 4792 | |
| 4793 | for (i = 0; i < AUTO_PIN_LAST; i++) { |
| 4794 | if (cfg->input_pins[i] >= 0x12) { |
| 4795 | idx = cfg->input_pins[i] - 0x12; |
Takashi Iwai | 4a471b7 | 2005-12-07 13:56:29 +0100 | [diff] [blame] | 4796 | err = new_analog_input(spec, cfg->input_pins[i], |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 4797 | auto_pin_cfg_labels[i], idx, |
| 4798 | 0x07); |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 4799 | if (err < 0) |
| 4800 | return err; |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 4801 | imux->items[imux->num_items].label = |
| 4802 | auto_pin_cfg_labels[i]; |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 4803 | imux->items[imux->num_items].index = idx; |
| 4804 | imux->num_items++; |
| 4805 | } |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 4806 | if (cfg->input_pins[i] >= 0x0f && cfg->input_pins[i] <= 0x10){ |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 4807 | idx = cfg->input_pins[i] - 0x09; |
Takashi Iwai | 4a471b7 | 2005-12-07 13:56:29 +0100 | [diff] [blame] | 4808 | err = new_analog_input(spec, cfg->input_pins[i], |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 4809 | auto_pin_cfg_labels[i], idx, |
| 4810 | 0x07); |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 4811 | if (err < 0) |
| 4812 | return err; |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 4813 | imux->items[imux->num_items].label = |
| 4814 | auto_pin_cfg_labels[i]; |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 4815 | imux->items[imux->num_items].index = idx; |
| 4816 | imux->num_items++; |
| 4817 | } |
| 4818 | } |
| 4819 | return 0; |
| 4820 | } |
| 4821 | |
| 4822 | static void alc260_auto_set_output_and_unmute(struct hda_codec *codec, |
| 4823 | hda_nid_t nid, int pin_type, |
| 4824 | int sel_idx) |
| 4825 | { |
Takashi Iwai | f6c7e54 | 2008-02-12 18:32:23 +0100 | [diff] [blame] | 4826 | alc_set_pin_output(codec, nid, pin_type); |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 4827 | /* need the manual connection? */ |
| 4828 | if (nid >= 0x12) { |
| 4829 | int idx = nid - 0x12; |
| 4830 | snd_hda_codec_write(codec, idx + 0x0b, 0, |
| 4831 | AC_VERB_SET_CONNECT_SEL, sel_idx); |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 4832 | } |
| 4833 | } |
| 4834 | |
| 4835 | static void alc260_auto_init_multi_out(struct hda_codec *codec) |
| 4836 | { |
| 4837 | struct alc_spec *spec = codec->spec; |
| 4838 | hda_nid_t nid; |
| 4839 | |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 4840 | alc_subsystem_id(codec, 0x10, 0x15, 0x0f); |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 4841 | nid = spec->autocfg.line_out_pins[0]; |
Takashi Iwai | baba8ee | 2007-04-23 17:17:48 +0200 | [diff] [blame] | 4842 | if (nid) { |
| 4843 | int pin_type = get_pin_type(spec->autocfg.line_out_type); |
| 4844 | alc260_auto_set_output_and_unmute(codec, nid, pin_type, 0); |
| 4845 | } |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 4846 | |
Takashi Iwai | 82bc955 | 2006-03-21 11:24:42 +0100 | [diff] [blame] | 4847 | nid = spec->autocfg.speaker_pins[0]; |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 4848 | if (nid) |
| 4849 | alc260_auto_set_output_and_unmute(codec, nid, PIN_OUT, 0); |
| 4850 | |
Takashi Iwai | eb06ed8 | 2006-09-20 17:10:27 +0200 | [diff] [blame] | 4851 | nid = spec->autocfg.hp_pins[0]; |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 4852 | if (nid) |
Takashi Iwai | baba8ee | 2007-04-23 17:17:48 +0200 | [diff] [blame] | 4853 | alc260_auto_set_output_and_unmute(codec, nid, PIN_HP, 0); |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 4854 | } |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 4855 | |
| 4856 | #define ALC260_PIN_CD_NID 0x16 |
| 4857 | static void alc260_auto_init_analog_input(struct hda_codec *codec) |
| 4858 | { |
| 4859 | struct alc_spec *spec = codec->spec; |
| 4860 | int i; |
| 4861 | |
| 4862 | for (i = 0; i < AUTO_PIN_LAST; i++) { |
| 4863 | hda_nid_t nid = spec->autocfg.input_pins[i]; |
| 4864 | if (nid >= 0x12) { |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 4865 | snd_hda_codec_write(codec, nid, 0, |
| 4866 | AC_VERB_SET_PIN_WIDGET_CONTROL, |
| 4867 | i <= AUTO_PIN_FRONT_MIC ? |
| 4868 | PIN_VREF80 : PIN_IN); |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 4869 | if (nid != ALC260_PIN_CD_NID) |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 4870 | snd_hda_codec_write(codec, nid, 0, |
| 4871 | AC_VERB_SET_AMP_GAIN_MUTE, |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 4872 | AMP_OUT_MUTE); |
| 4873 | } |
| 4874 | } |
| 4875 | } |
| 4876 | |
| 4877 | /* |
| 4878 | * generic initialization of ADC, input mixers and output mixers |
| 4879 | */ |
| 4880 | static struct hda_verb alc260_volume_init_verbs[] = { |
| 4881 | /* |
| 4882 | * Unmute ADC0-1 and set the default input to mic-in |
| 4883 | */ |
| 4884 | {0x04, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 4885 | {0x04, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 4886 | {0x05, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 4887 | {0x05, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 4888 | |
| 4889 | /* Unmute input amps (CD, Line In, Mic 1 & Mic 2) of the analog-loopback |
| 4890 | * mixer widget |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 4891 | * Note: PASD motherboards uses the Line In 2 as the input for |
| 4892 | * front panel mic (mic 2) |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 4893 | */ |
| 4894 | /* Amp Indices: Mic1 = 0, Mic2 = 1, Line1 = 2, Line2 = 3, CD = 4 */ |
Takashi Iwai | cb53c62 | 2007-08-10 17:21:45 +0200 | [diff] [blame] | 4895 | /* mute analog inputs */ |
| 4896 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 4897 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
| 4898 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)}, |
| 4899 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)}, |
| 4900 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)}, |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 4901 | |
| 4902 | /* |
| 4903 | * Set up output mixers (0x08 - 0x0a) |
| 4904 | */ |
| 4905 | /* set vol=0 to output mixers */ |
| 4906 | {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 4907 | {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 4908 | {0x0a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 4909 | /* set up input amps for analog loopback */ |
| 4910 | /* Amp Indices: DAC = 0, mixer = 1 */ |
| 4911 | {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 4912 | {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 4913 | {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 4914 | {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 4915 | {0x0a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 4916 | {0x0a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 4917 | |
| 4918 | { } |
| 4919 | }; |
| 4920 | |
| 4921 | static int alc260_parse_auto_config(struct hda_codec *codec) |
| 4922 | { |
| 4923 | struct alc_spec *spec = codec->spec; |
| 4924 | unsigned int wcap; |
| 4925 | int err; |
| 4926 | static hda_nid_t alc260_ignore[] = { 0x17, 0 }; |
| 4927 | |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 4928 | err = snd_hda_parse_pin_def_config(codec, &spec->autocfg, |
| 4929 | alc260_ignore); |
| 4930 | if (err < 0) |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 4931 | return err; |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 4932 | err = alc260_auto_create_multi_out_ctls(spec, &spec->autocfg); |
| 4933 | if (err < 0) |
Takashi Iwai | 4a471b7 | 2005-12-07 13:56:29 +0100 | [diff] [blame] | 4934 | return err; |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 4935 | if (!spec->kctl_alloc) |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 4936 | return 0; /* can't find valid BIOS pin config */ |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 4937 | err = alc260_auto_create_analog_input_ctls(spec, &spec->autocfg); |
| 4938 | if (err < 0) |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 4939 | return err; |
| 4940 | |
| 4941 | spec->multiout.max_channels = 2; |
| 4942 | |
| 4943 | if (spec->autocfg.dig_out_pin) |
| 4944 | spec->multiout.dig_out_nid = ALC260_DIGOUT_NID; |
| 4945 | if (spec->kctl_alloc) |
| 4946 | spec->mixers[spec->num_mixers++] = spec->kctl_alloc; |
| 4947 | |
| 4948 | spec->init_verbs[spec->num_init_verbs++] = alc260_volume_init_verbs; |
| 4949 | |
Jonathan Woithe | a1e8d2d | 2006-03-28 12:47:09 +0200 | [diff] [blame] | 4950 | spec->num_mux_defs = 1; |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 4951 | spec->input_mux = &spec->private_imux; |
| 4952 | |
| 4953 | /* check whether NID 0x04 is valid */ |
Takashi Iwai | 4a471b7 | 2005-12-07 13:56:29 +0100 | [diff] [blame] | 4954 | wcap = get_wcaps(codec, 0x04); |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 4955 | wcap = (wcap & AC_WCAP_TYPE) >> AC_WCAP_TYPE_SHIFT; /* get type */ |
Takashi Iwai | 67ebcb0 | 2008-02-19 15:03:57 +0100 | [diff] [blame] | 4956 | if (wcap != AC_WID_AUD_IN || spec->input_mux->num_items == 1) { |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 4957 | spec->adc_nids = alc260_adc_nids_alt; |
| 4958 | spec->num_adc_nids = ARRAY_SIZE(alc260_adc_nids_alt); |
| 4959 | spec->mixers[spec->num_mixers] = alc260_capture_alt_mixer; |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 4960 | } else { |
| 4961 | spec->adc_nids = alc260_adc_nids; |
| 4962 | spec->num_adc_nids = ARRAY_SIZE(alc260_adc_nids); |
| 4963 | spec->mixers[spec->num_mixers] = alc260_capture_mixer; |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 4964 | } |
Takashi Iwai | 4a471b7 | 2005-12-07 13:56:29 +0100 | [diff] [blame] | 4965 | spec->num_mixers++; |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 4966 | |
| 4967 | return 1; |
| 4968 | } |
| 4969 | |
Takashi Iwai | ae6b813 | 2006-03-03 16:47:17 +0100 | [diff] [blame] | 4970 | /* additional initialization for auto-configuration model */ |
| 4971 | static void alc260_auto_init(struct hda_codec *codec) |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 4972 | { |
Takashi Iwai | f6c7e54 | 2008-02-12 18:32:23 +0100 | [diff] [blame] | 4973 | struct alc_spec *spec = codec->spec; |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 4974 | alc260_auto_init_multi_out(codec); |
| 4975 | alc260_auto_init_analog_input(codec); |
Takashi Iwai | f6c7e54 | 2008-02-12 18:32:23 +0100 | [diff] [blame] | 4976 | if (spec->unsol_event) |
| 4977 | alc_sku_automute(codec); |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 4978 | } |
| 4979 | |
Takashi Iwai | cb53c62 | 2007-08-10 17:21:45 +0200 | [diff] [blame] | 4980 | #ifdef CONFIG_SND_HDA_POWER_SAVE |
| 4981 | static struct hda_amp_list alc260_loopbacks[] = { |
| 4982 | { 0x07, HDA_INPUT, 0 }, |
| 4983 | { 0x07, HDA_INPUT, 1 }, |
| 4984 | { 0x07, HDA_INPUT, 2 }, |
| 4985 | { 0x07, HDA_INPUT, 3 }, |
| 4986 | { 0x07, HDA_INPUT, 4 }, |
| 4987 | { } /* end */ |
| 4988 | }; |
| 4989 | #endif |
| 4990 | |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 4991 | /* |
| 4992 | * ALC260 configurations |
| 4993 | */ |
Takashi Iwai | f5fcc13 | 2006-11-24 17:07:44 +0100 | [diff] [blame] | 4994 | static const char *alc260_models[ALC260_MODEL_LAST] = { |
| 4995 | [ALC260_BASIC] = "basic", |
| 4996 | [ALC260_HP] = "hp", |
| 4997 | [ALC260_HP_3013] = "hp-3013", |
| 4998 | [ALC260_FUJITSU_S702X] = "fujitsu", |
| 4999 | [ALC260_ACER] = "acer", |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 5000 | [ALC260_WILL] = "will", |
| 5001 | [ALC260_REPLACER_672V] = "replacer", |
Jonathan Woithe | 7cf51e48 | 2006-02-09 12:01:26 +0100 | [diff] [blame] | 5002 | #ifdef CONFIG_SND_DEBUG |
Takashi Iwai | f5fcc13 | 2006-11-24 17:07:44 +0100 | [diff] [blame] | 5003 | [ALC260_TEST] = "test", |
Jonathan Woithe | 7cf51e48 | 2006-02-09 12:01:26 +0100 | [diff] [blame] | 5004 | #endif |
Takashi Iwai | f5fcc13 | 2006-11-24 17:07:44 +0100 | [diff] [blame] | 5005 | [ALC260_AUTO] = "auto", |
| 5006 | }; |
| 5007 | |
| 5008 | static struct snd_pci_quirk alc260_cfg_tbl[] = { |
Jonathan Woithe | bd86948 | 2006-11-28 11:35:52 +0100 | [diff] [blame] | 5009 | SND_PCI_QUIRK(0x1025, 0x007b, "Acer C20x", ALC260_ACER), |
Takashi Iwai | f5fcc13 | 2006-11-24 17:07:44 +0100 | [diff] [blame] | 5010 | SND_PCI_QUIRK(0x1025, 0x008f, "Acer", ALC260_ACER), |
Takashi Iwai | 9720b71 | 2007-03-13 21:46:23 +0100 | [diff] [blame] | 5011 | SND_PCI_QUIRK(0x103c, 0x2808, "HP d5700", ALC260_HP_3013), |
Takashi Iwai | a8a5d06 | 2007-03-15 15:10:28 +0100 | [diff] [blame] | 5012 | SND_PCI_QUIRK(0x103c, 0x280a, "HP d5750", ALC260_HP_3013), |
Takashi Iwai | f5fcc13 | 2006-11-24 17:07:44 +0100 | [diff] [blame] | 5013 | SND_PCI_QUIRK(0x103c, 0x3010, "HP", ALC260_HP_3013), |
| 5014 | SND_PCI_QUIRK(0x103c, 0x3011, "HP", ALC260_HP), |
| 5015 | SND_PCI_QUIRK(0x103c, 0x3012, "HP", ALC260_HP_3013), |
| 5016 | SND_PCI_QUIRK(0x103c, 0x3013, "HP", ALC260_HP_3013), |
| 5017 | SND_PCI_QUIRK(0x103c, 0x3014, "HP", ALC260_HP), |
| 5018 | SND_PCI_QUIRK(0x103c, 0x3015, "HP", ALC260_HP), |
| 5019 | SND_PCI_QUIRK(0x103c, 0x3016, "HP", ALC260_HP), |
| 5020 | SND_PCI_QUIRK(0x104d, 0x81bb, "Sony VAIO", ALC260_BASIC), |
| 5021 | SND_PCI_QUIRK(0x104d, 0x81cc, "Sony VAIO", ALC260_BASIC), |
| 5022 | SND_PCI_QUIRK(0x104d, 0x81cd, "Sony VAIO", ALC260_BASIC), |
| 5023 | SND_PCI_QUIRK(0x10cf, 0x1326, "Fujitsu S702X", ALC260_FUJITSU_S702X), |
| 5024 | SND_PCI_QUIRK(0x152d, 0x0729, "CTL U553W", ALC260_BASIC), |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 5025 | SND_PCI_QUIRK(0x161f, 0x2057, "Replacer 672V", ALC260_REPLACER_672V), |
Takashi Iwai | ac3e374 | 2007-12-17 17:14:18 +0100 | [diff] [blame] | 5026 | SND_PCI_QUIRK(0x1631, 0xc017, "PB V7900", ALC260_WILL), |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 5027 | {} |
| 5028 | }; |
| 5029 | |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 5030 | static struct alc_config_preset alc260_presets[] = { |
| 5031 | [ALC260_BASIC] = { |
| 5032 | .mixers = { alc260_base_output_mixer, |
| 5033 | alc260_input_mixer, |
| 5034 | alc260_pc_beep_mixer, |
| 5035 | alc260_capture_mixer }, |
| 5036 | .init_verbs = { alc260_init_verbs }, |
| 5037 | .num_dacs = ARRAY_SIZE(alc260_dac_nids), |
| 5038 | .dac_nids = alc260_dac_nids, |
| 5039 | .num_adc_nids = ARRAY_SIZE(alc260_adc_nids), |
| 5040 | .adc_nids = alc260_adc_nids, |
| 5041 | .num_channel_mode = ARRAY_SIZE(alc260_modes), |
| 5042 | .channel_mode = alc260_modes, |
| 5043 | .input_mux = &alc260_capture_source, |
| 5044 | }, |
| 5045 | [ALC260_HP] = { |
Takashi Iwai | bec15c3 | 2008-01-28 18:16:30 +0100 | [diff] [blame] | 5046 | .mixers = { alc260_hp_output_mixer, |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 5047 | alc260_input_mixer, |
| 5048 | alc260_capture_alt_mixer }, |
Takashi Iwai | bec15c3 | 2008-01-28 18:16:30 +0100 | [diff] [blame] | 5049 | .init_verbs = { alc260_init_verbs, |
| 5050 | alc260_hp_unsol_verbs }, |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 5051 | .num_dacs = ARRAY_SIZE(alc260_dac_nids), |
| 5052 | .dac_nids = alc260_dac_nids, |
| 5053 | .num_adc_nids = ARRAY_SIZE(alc260_hp_adc_nids), |
| 5054 | .adc_nids = alc260_hp_adc_nids, |
| 5055 | .num_channel_mode = ARRAY_SIZE(alc260_modes), |
| 5056 | .channel_mode = alc260_modes, |
| 5057 | .input_mux = &alc260_capture_source, |
Takashi Iwai | bec15c3 | 2008-01-28 18:16:30 +0100 | [diff] [blame] | 5058 | .unsol_event = alc260_hp_unsol_event, |
| 5059 | .init_hook = alc260_hp_automute, |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 5060 | }, |
| 5061 | [ALC260_HP_3013] = { |
| 5062 | .mixers = { alc260_hp_3013_mixer, |
| 5063 | alc260_input_mixer, |
| 5064 | alc260_capture_alt_mixer }, |
Takashi Iwai | bec15c3 | 2008-01-28 18:16:30 +0100 | [diff] [blame] | 5065 | .init_verbs = { alc260_hp_3013_init_verbs, |
| 5066 | alc260_hp_3013_unsol_verbs }, |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 5067 | .num_dacs = ARRAY_SIZE(alc260_dac_nids), |
| 5068 | .dac_nids = alc260_dac_nids, |
| 5069 | .num_adc_nids = ARRAY_SIZE(alc260_hp_adc_nids), |
| 5070 | .adc_nids = alc260_hp_adc_nids, |
| 5071 | .num_channel_mode = ARRAY_SIZE(alc260_modes), |
| 5072 | .channel_mode = alc260_modes, |
| 5073 | .input_mux = &alc260_capture_source, |
Takashi Iwai | bec15c3 | 2008-01-28 18:16:30 +0100 | [diff] [blame] | 5074 | .unsol_event = alc260_hp_3013_unsol_event, |
| 5075 | .init_hook = alc260_hp_3013_automute, |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 5076 | }, |
| 5077 | [ALC260_FUJITSU_S702X] = { |
| 5078 | .mixers = { alc260_fujitsu_mixer, |
| 5079 | alc260_capture_mixer }, |
| 5080 | .init_verbs = { alc260_fujitsu_init_verbs }, |
| 5081 | .num_dacs = ARRAY_SIZE(alc260_dac_nids), |
| 5082 | .dac_nids = alc260_dac_nids, |
Jonathan Woithe | d57fdac | 2006-02-28 11:38:35 +0100 | [diff] [blame] | 5083 | .num_adc_nids = ARRAY_SIZE(alc260_dual_adc_nids), |
| 5084 | .adc_nids = alc260_dual_adc_nids, |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 5085 | .num_channel_mode = ARRAY_SIZE(alc260_modes), |
| 5086 | .channel_mode = alc260_modes, |
Jonathan Woithe | a1e8d2d | 2006-03-28 12:47:09 +0200 | [diff] [blame] | 5087 | .num_mux_defs = ARRAY_SIZE(alc260_fujitsu_capture_sources), |
| 5088 | .input_mux = alc260_fujitsu_capture_sources, |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 5089 | }, |
Jonathan Woithe | 0bfc90e | 2006-02-28 11:45:11 +0100 | [diff] [blame] | 5090 | [ALC260_ACER] = { |
| 5091 | .mixers = { alc260_acer_mixer, |
| 5092 | alc260_capture_mixer }, |
| 5093 | .init_verbs = { alc260_acer_init_verbs }, |
| 5094 | .num_dacs = ARRAY_SIZE(alc260_dac_nids), |
| 5095 | .dac_nids = alc260_dac_nids, |
| 5096 | .num_adc_nids = ARRAY_SIZE(alc260_dual_adc_nids), |
| 5097 | .adc_nids = alc260_dual_adc_nids, |
| 5098 | .num_channel_mode = ARRAY_SIZE(alc260_modes), |
| 5099 | .channel_mode = alc260_modes, |
Jonathan Woithe | a1e8d2d | 2006-03-28 12:47:09 +0200 | [diff] [blame] | 5100 | .num_mux_defs = ARRAY_SIZE(alc260_acer_capture_sources), |
| 5101 | .input_mux = alc260_acer_capture_sources, |
Jonathan Woithe | 0bfc90e | 2006-02-28 11:45:11 +0100 | [diff] [blame] | 5102 | }, |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 5103 | [ALC260_WILL] = { |
| 5104 | .mixers = { alc260_will_mixer, |
| 5105 | alc260_capture_mixer }, |
| 5106 | .init_verbs = { alc260_init_verbs, alc260_will_verbs }, |
| 5107 | .num_dacs = ARRAY_SIZE(alc260_dac_nids), |
| 5108 | .dac_nids = alc260_dac_nids, |
| 5109 | .num_adc_nids = ARRAY_SIZE(alc260_adc_nids), |
| 5110 | .adc_nids = alc260_adc_nids, |
| 5111 | .dig_out_nid = ALC260_DIGOUT_NID, |
| 5112 | .num_channel_mode = ARRAY_SIZE(alc260_modes), |
| 5113 | .channel_mode = alc260_modes, |
| 5114 | .input_mux = &alc260_capture_source, |
| 5115 | }, |
| 5116 | [ALC260_REPLACER_672V] = { |
| 5117 | .mixers = { alc260_replacer_672v_mixer, |
| 5118 | alc260_capture_mixer }, |
| 5119 | .init_verbs = { alc260_init_verbs, alc260_replacer_672v_verbs }, |
| 5120 | .num_dacs = ARRAY_SIZE(alc260_dac_nids), |
| 5121 | .dac_nids = alc260_dac_nids, |
| 5122 | .num_adc_nids = ARRAY_SIZE(alc260_adc_nids), |
| 5123 | .adc_nids = alc260_adc_nids, |
| 5124 | .dig_out_nid = ALC260_DIGOUT_NID, |
| 5125 | .num_channel_mode = ARRAY_SIZE(alc260_modes), |
| 5126 | .channel_mode = alc260_modes, |
| 5127 | .input_mux = &alc260_capture_source, |
| 5128 | .unsol_event = alc260_replacer_672v_unsol_event, |
| 5129 | .init_hook = alc260_replacer_672v_automute, |
| 5130 | }, |
Jonathan Woithe | 7cf51e48 | 2006-02-09 12:01:26 +0100 | [diff] [blame] | 5131 | #ifdef CONFIG_SND_DEBUG |
| 5132 | [ALC260_TEST] = { |
| 5133 | .mixers = { alc260_test_mixer, |
| 5134 | alc260_capture_mixer }, |
| 5135 | .init_verbs = { alc260_test_init_verbs }, |
| 5136 | .num_dacs = ARRAY_SIZE(alc260_test_dac_nids), |
| 5137 | .dac_nids = alc260_test_dac_nids, |
| 5138 | .num_adc_nids = ARRAY_SIZE(alc260_test_adc_nids), |
| 5139 | .adc_nids = alc260_test_adc_nids, |
| 5140 | .num_channel_mode = ARRAY_SIZE(alc260_modes), |
| 5141 | .channel_mode = alc260_modes, |
Jonathan Woithe | a1e8d2d | 2006-03-28 12:47:09 +0200 | [diff] [blame] | 5142 | .num_mux_defs = ARRAY_SIZE(alc260_test_capture_sources), |
| 5143 | .input_mux = alc260_test_capture_sources, |
Jonathan Woithe | 7cf51e48 | 2006-02-09 12:01:26 +0100 | [diff] [blame] | 5144 | }, |
| 5145 | #endif |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 5146 | }; |
| 5147 | |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 5148 | static int patch_alc260(struct hda_codec *codec) |
| 5149 | { |
| 5150 | struct alc_spec *spec; |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 5151 | int err, board_config; |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 5152 | |
Takashi Iwai | e560d8d | 2005-09-09 14:21:46 +0200 | [diff] [blame] | 5153 | spec = kzalloc(sizeof(*spec), GFP_KERNEL); |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 5154 | if (spec == NULL) |
| 5155 | return -ENOMEM; |
| 5156 | |
| 5157 | codec->spec = spec; |
| 5158 | |
Takashi Iwai | f5fcc13 | 2006-11-24 17:07:44 +0100 | [diff] [blame] | 5159 | board_config = snd_hda_check_board_config(codec, ALC260_MODEL_LAST, |
| 5160 | alc260_models, |
| 5161 | alc260_cfg_tbl); |
| 5162 | if (board_config < 0) { |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 5163 | snd_printd(KERN_INFO "hda_codec: Unknown model for ALC260, " |
| 5164 | "trying auto-probe from BIOS...\n"); |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 5165 | board_config = ALC260_AUTO; |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 5166 | } |
| 5167 | |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 5168 | if (board_config == ALC260_AUTO) { |
| 5169 | /* automatic parse from the BIOS config */ |
| 5170 | err = alc260_parse_auto_config(codec); |
| 5171 | if (err < 0) { |
| 5172 | alc_free(codec); |
| 5173 | return err; |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 5174 | } else if (!err) { |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 5175 | printk(KERN_INFO |
| 5176 | "hda_codec: Cannot set up configuration " |
| 5177 | "from BIOS. Using base mode...\n"); |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 5178 | board_config = ALC260_BASIC; |
| 5179 | } |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 5180 | } |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 5181 | |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 5182 | if (board_config != ALC260_AUTO) |
| 5183 | setup_preset(spec, &alc260_presets[board_config]); |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 5184 | |
| 5185 | spec->stream_name_analog = "ALC260 Analog"; |
| 5186 | spec->stream_analog_playback = &alc260_pcm_analog_playback; |
| 5187 | spec->stream_analog_capture = &alc260_pcm_analog_capture; |
| 5188 | |
Takashi Iwai | a3bcba3 | 2005-12-06 19:05:29 +0100 | [diff] [blame] | 5189 | spec->stream_name_digital = "ALC260 Digital"; |
| 5190 | spec->stream_digital_playback = &alc260_pcm_digital_playback; |
| 5191 | spec->stream_digital_capture = &alc260_pcm_digital_capture; |
| 5192 | |
Takashi Iwai | 2134ea4 | 2008-01-10 16:53:55 +0100 | [diff] [blame] | 5193 | spec->vmaster_nid = 0x08; |
| 5194 | |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 5195 | codec->patch_ops = alc_patch_ops; |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 5196 | if (board_config == ALC260_AUTO) |
Takashi Iwai | ae6b813 | 2006-03-03 16:47:17 +0100 | [diff] [blame] | 5197 | spec->init_hook = alc260_auto_init; |
Takashi Iwai | cb53c62 | 2007-08-10 17:21:45 +0200 | [diff] [blame] | 5198 | #ifdef CONFIG_SND_HDA_POWER_SAVE |
| 5199 | if (!spec->loopback.amplist) |
| 5200 | spec->loopback.amplist = alc260_loopbacks; |
| 5201 | #endif |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 5202 | |
| 5203 | return 0; |
| 5204 | } |
| 5205 | |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 5206 | |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 5207 | /* |
| 5208 | * ALC882 support |
| 5209 | * |
| 5210 | * ALC882 is almost identical with ALC880 but has cleaner and more flexible |
| 5211 | * configuration. Each pin widget can choose any input DACs and a mixer. |
| 5212 | * Each ADC is connected from a mixer of all inputs. This makes possible |
| 5213 | * 6-channel independent captures. |
| 5214 | * |
| 5215 | * In addition, an independent DAC for the multi-playback (not used in this |
| 5216 | * driver yet). |
| 5217 | */ |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 5218 | #define ALC882_DIGOUT_NID 0x06 |
| 5219 | #define ALC882_DIGIN_NID 0x0a |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 5220 | |
Takashi Iwai | d2a6d7d | 2005-11-17 11:06:29 +0100 | [diff] [blame] | 5221 | static struct hda_channel_mode alc882_ch_modes[1] = { |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 5222 | { 8, NULL } |
| 5223 | }; |
| 5224 | |
| 5225 | static hda_nid_t alc882_dac_nids[4] = { |
| 5226 | /* front, rear, clfe, rear_surr */ |
| 5227 | 0x02, 0x03, 0x04, 0x05 |
| 5228 | }; |
| 5229 | |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 5230 | /* identical with ALC880 */ |
| 5231 | #define alc882_adc_nids alc880_adc_nids |
| 5232 | #define alc882_adc_nids_alt alc880_adc_nids_alt |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 5233 | |
Takashi Iwai | e140634 | 2008-02-11 18:32:32 +0100 | [diff] [blame] | 5234 | static hda_nid_t alc882_capsrc_nids[3] = { 0x24, 0x23, 0x22 }; |
| 5235 | static hda_nid_t alc882_capsrc_nids_alt[2] = { 0x23, 0x22 }; |
| 5236 | |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 5237 | /* input MUX */ |
| 5238 | /* FIXME: should be a matrix-type input source selection */ |
| 5239 | |
| 5240 | static struct hda_input_mux alc882_capture_source = { |
| 5241 | .num_items = 4, |
| 5242 | .items = { |
| 5243 | { "Mic", 0x0 }, |
| 5244 | { "Front Mic", 0x1 }, |
| 5245 | { "Line", 0x2 }, |
| 5246 | { "CD", 0x4 }, |
| 5247 | }, |
| 5248 | }; |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 5249 | #define alc882_mux_enum_info alc_mux_enum_info |
| 5250 | #define alc882_mux_enum_get alc_mux_enum_get |
| 5251 | |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 5252 | static int alc882_mux_enum_put(struct snd_kcontrol *kcontrol, |
| 5253 | struct snd_ctl_elem_value *ucontrol) |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 5254 | { |
| 5255 | struct hda_codec *codec = snd_kcontrol_chip(kcontrol); |
| 5256 | struct alc_spec *spec = codec->spec; |
| 5257 | const struct hda_input_mux *imux = spec->input_mux; |
| 5258 | unsigned int adc_idx = snd_ctl_get_ioffidx(kcontrol, &ucontrol->id); |
Takashi Iwai | 88c71a9 | 2008-02-14 17:27:17 +0100 | [diff] [blame] | 5259 | hda_nid_t nid = spec->capsrc_nids ? |
| 5260 | spec->capsrc_nids[adc_idx] : spec->adc_nids[adc_idx]; |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 5261 | unsigned int *cur_val = &spec->cur_mux[adc_idx]; |
| 5262 | unsigned int i, idx; |
| 5263 | |
| 5264 | idx = ucontrol->value.enumerated.item[0]; |
| 5265 | if (idx >= imux->num_items) |
| 5266 | idx = imux->num_items - 1; |
Takashi Iwai | 82beb8f | 2007-08-10 17:09:26 +0200 | [diff] [blame] | 5267 | if (*cur_val == idx) |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 5268 | return 0; |
| 5269 | for (i = 0; i < imux->num_items; i++) { |
Takashi Iwai | 47fd830 | 2007-08-10 17:11:07 +0200 | [diff] [blame] | 5270 | unsigned int v = (i == idx) ? 0 : HDA_AMP_MUTE; |
| 5271 | snd_hda_codec_amp_stereo(codec, nid, HDA_INPUT, |
Takashi Iwai | 82beb8f | 2007-08-10 17:09:26 +0200 | [diff] [blame] | 5272 | imux->items[i].index, |
Takashi Iwai | 47fd830 | 2007-08-10 17:11:07 +0200 | [diff] [blame] | 5273 | HDA_AMP_MUTE, v); |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 5274 | } |
| 5275 | *cur_val = idx; |
| 5276 | return 1; |
| 5277 | } |
| 5278 | |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 5279 | /* |
Kailang Yang | 272a527 | 2007-05-14 11:00:38 +0200 | [diff] [blame] | 5280 | * 2ch mode |
| 5281 | */ |
| 5282 | static struct hda_verb alc882_3ST_ch2_init[] = { |
| 5283 | { 0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80 }, |
| 5284 | { 0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE }, |
| 5285 | { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN }, |
| 5286 | { 0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE }, |
| 5287 | { } /* end */ |
| 5288 | }; |
| 5289 | |
| 5290 | /* |
| 5291 | * 6ch mode |
| 5292 | */ |
| 5293 | static struct hda_verb alc882_3ST_ch6_init[] = { |
| 5294 | { 0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, |
| 5295 | { 0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE }, |
| 5296 | { 0x18, AC_VERB_SET_CONNECT_SEL, 0x02 }, |
| 5297 | { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, |
| 5298 | { 0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE }, |
| 5299 | { 0x1a, AC_VERB_SET_CONNECT_SEL, 0x01 }, |
| 5300 | { } /* end */ |
| 5301 | }; |
| 5302 | |
| 5303 | static struct hda_channel_mode alc882_3ST_6ch_modes[2] = { |
| 5304 | { 2, alc882_3ST_ch2_init }, |
| 5305 | { 6, alc882_3ST_ch6_init }, |
| 5306 | }; |
| 5307 | |
| 5308 | /* |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 5309 | * 6ch mode |
| 5310 | */ |
| 5311 | static struct hda_verb alc882_sixstack_ch6_init[] = { |
| 5312 | { 0x17, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x00 }, |
| 5313 | { 0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, |
| 5314 | { 0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, |
| 5315 | { 0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, |
| 5316 | { } /* end */ |
| 5317 | }; |
| 5318 | |
| 5319 | /* |
| 5320 | * 8ch mode |
| 5321 | */ |
| 5322 | static struct hda_verb alc882_sixstack_ch8_init[] = { |
| 5323 | { 0x17, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, |
| 5324 | { 0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, |
| 5325 | { 0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, |
| 5326 | { 0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, |
| 5327 | { } /* end */ |
| 5328 | }; |
| 5329 | |
| 5330 | static struct hda_channel_mode alc882_sixstack_modes[2] = { |
| 5331 | { 6, alc882_sixstack_ch6_init }, |
| 5332 | { 8, alc882_sixstack_ch8_init }, |
| 5333 | }; |
| 5334 | |
Takashi Iwai | 87350ad | 2007-08-16 18:19:38 +0200 | [diff] [blame] | 5335 | /* |
| 5336 | * macbook pro ALC885 can switch LineIn to LineOut without loosing Mic |
| 5337 | */ |
| 5338 | |
| 5339 | /* |
| 5340 | * 2ch mode |
| 5341 | */ |
| 5342 | static struct hda_verb alc885_mbp_ch2_init[] = { |
| 5343 | { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN }, |
| 5344 | { 0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 5345 | { 0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
| 5346 | { } /* end */ |
| 5347 | }; |
| 5348 | |
| 5349 | /* |
| 5350 | * 6ch mode |
| 5351 | */ |
| 5352 | static struct hda_verb alc885_mbp_ch6_init[] = { |
| 5353 | { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, |
| 5354 | { 0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 5355 | { 0x1a, AC_VERB_SET_CONNECT_SEL, 0x01 }, |
| 5356 | { 0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 5357 | { 0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 5358 | { } /* end */ |
| 5359 | }; |
| 5360 | |
| 5361 | static struct hda_channel_mode alc885_mbp_6ch_modes[2] = { |
| 5362 | { 2, alc885_mbp_ch2_init }, |
| 5363 | { 6, alc885_mbp_ch6_init }, |
| 5364 | }; |
| 5365 | |
| 5366 | |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 5367 | /* Pin assignment: Front=0x14, Rear=0x15, CLFE=0x16, Side=0x17 |
| 5368 | * Mic=0x18, Front Mic=0x19, Line-In=0x1a, HP=0x1b |
| 5369 | */ |
Takashi Iwai | c8b6bf9 | 2005-11-17 14:57:47 +0100 | [diff] [blame] | 5370 | static struct snd_kcontrol_new alc882_base_mixer[] = { |
Takashi Iwai | 05acb86 | 2005-06-10 19:50:25 +0200 | [diff] [blame] | 5371 | HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT), |
Takashi Iwai | 985be54 | 2005-11-02 18:26:49 +0100 | [diff] [blame] | 5372 | HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT), |
Takashi Iwai | 05acb86 | 2005-06-10 19:50:25 +0200 | [diff] [blame] | 5373 | HDA_CODEC_VOLUME("Surround Playback Volume", 0x0d, 0x0, HDA_OUTPUT), |
Takashi Iwai | 985be54 | 2005-11-02 18:26:49 +0100 | [diff] [blame] | 5374 | HDA_BIND_MUTE("Surround Playback Switch", 0x0d, 2, HDA_INPUT), |
Takashi Iwai | 05acb86 | 2005-06-10 19:50:25 +0200 | [diff] [blame] | 5375 | HDA_CODEC_VOLUME_MONO("Center Playback Volume", 0x0e, 1, 0x0, HDA_OUTPUT), |
| 5376 | HDA_CODEC_VOLUME_MONO("LFE Playback Volume", 0x0e, 2, 0x0, HDA_OUTPUT), |
Takashi Iwai | 985be54 | 2005-11-02 18:26:49 +0100 | [diff] [blame] | 5377 | HDA_BIND_MUTE_MONO("Center Playback Switch", 0x0e, 1, 2, HDA_INPUT), |
| 5378 | HDA_BIND_MUTE_MONO("LFE Playback Switch", 0x0e, 2, 2, HDA_INPUT), |
Takashi Iwai | 05acb86 | 2005-06-10 19:50:25 +0200 | [diff] [blame] | 5379 | HDA_CODEC_VOLUME("Side Playback Volume", 0x0f, 0x0, HDA_OUTPUT), |
Takashi Iwai | 985be54 | 2005-11-02 18:26:49 +0100 | [diff] [blame] | 5380 | HDA_BIND_MUTE("Side Playback Switch", 0x0f, 2, HDA_INPUT), |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 5381 | HDA_CODEC_MUTE("Headphone Playback Switch", 0x1b, 0x0, HDA_OUTPUT), |
| 5382 | HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT), |
| 5383 | HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT), |
| 5384 | HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT), |
| 5385 | HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT), |
| 5386 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), |
Thomas De Schampheleire | 3236041 | 2007-01-24 16:13:35 +0100 | [diff] [blame] | 5387 | HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT), |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 5388 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), |
| 5389 | HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x1, HDA_INPUT), |
Thomas De Schampheleire | 3236041 | 2007-01-24 16:13:35 +0100 | [diff] [blame] | 5390 | HDA_CODEC_VOLUME("Front Mic Boost", 0x19, 0, HDA_INPUT), |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 5391 | HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x1, HDA_INPUT), |
| 5392 | HDA_CODEC_VOLUME("PC Speaker Playback Volume", 0x0b, 0x05, HDA_INPUT), |
| 5393 | HDA_CODEC_MUTE("PC Speaker Playback Switch", 0x0b, 0x05, HDA_INPUT), |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 5394 | { } /* end */ |
| 5395 | }; |
| 5396 | |
Takashi Iwai | 87350ad | 2007-08-16 18:19:38 +0200 | [diff] [blame] | 5397 | static struct snd_kcontrol_new alc885_mbp3_mixer[] = { |
Takashi Iwai | 2134ea4 | 2008-01-10 16:53:55 +0100 | [diff] [blame] | 5398 | HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x00, HDA_OUTPUT), |
| 5399 | HDA_BIND_MUTE ("Front Playback Switch", 0x0c, 0x02, HDA_INPUT), |
| 5400 | HDA_CODEC_MUTE ("Speaker Playback Switch", 0x14, 0x00, HDA_OUTPUT), |
| 5401 | HDA_CODEC_VOLUME("Line-Out Playback Volume", 0x0d, 0x00, HDA_OUTPUT), |
| 5402 | HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT), |
| 5403 | HDA_CODEC_MUTE ("Line Playback Switch", 0x0b, 0x02, HDA_INPUT), |
Takashi Iwai | 87350ad | 2007-08-16 18:19:38 +0200 | [diff] [blame] | 5404 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x00, HDA_INPUT), |
| 5405 | HDA_CODEC_MUTE ("Mic Playback Switch", 0x0b, 0x00, HDA_INPUT), |
Takashi Iwai | 2134ea4 | 2008-01-10 16:53:55 +0100 | [diff] [blame] | 5406 | HDA_CODEC_VOLUME("Line Boost", 0x1a, 0x00, HDA_INPUT), |
Takashi Iwai | 87350ad | 2007-08-16 18:19:38 +0200 | [diff] [blame] | 5407 | HDA_CODEC_VOLUME("Mic Boost", 0x18, 0x00, HDA_INPUT), |
| 5408 | { } /* end */ |
| 5409 | }; |
Kailang Yang | bdd148a | 2007-05-08 15:19:08 +0200 | [diff] [blame] | 5410 | static struct snd_kcontrol_new alc882_w2jc_mixer[] = { |
| 5411 | HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT), |
| 5412 | HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT), |
| 5413 | HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT), |
| 5414 | HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT), |
| 5415 | HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT), |
| 5416 | HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT), |
| 5417 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), |
| 5418 | HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT), |
| 5419 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), |
| 5420 | HDA_CODEC_VOLUME("PC Speaker Playback Volume", 0x0b, 0x05, HDA_INPUT), |
| 5421 | HDA_CODEC_MUTE("PC Speaker Playback Switch", 0x0b, 0x05, HDA_INPUT), |
| 5422 | { } /* end */ |
| 5423 | }; |
| 5424 | |
Kailang Yang | 272a527 | 2007-05-14 11:00:38 +0200 | [diff] [blame] | 5425 | static struct snd_kcontrol_new alc882_targa_mixer[] = { |
| 5426 | HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT), |
| 5427 | HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT), |
| 5428 | HDA_CODEC_MUTE("Headphone Playback Switch", 0x1b, 0x0, HDA_OUTPUT), |
| 5429 | HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT), |
| 5430 | HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT), |
| 5431 | HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT), |
| 5432 | HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT), |
| 5433 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), |
| 5434 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), |
Takashi Iwai | 96fe7cc8 | 2007-09-07 10:57:44 +0200 | [diff] [blame] | 5435 | HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT), |
Kailang Yang | 272a527 | 2007-05-14 11:00:38 +0200 | [diff] [blame] | 5436 | HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x1, HDA_INPUT), |
| 5437 | HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x1, HDA_INPUT), |
Takashi Iwai | 96fe7cc8 | 2007-09-07 10:57:44 +0200 | [diff] [blame] | 5438 | HDA_CODEC_VOLUME("Front Mic Boost", 0x19, 0, HDA_INPUT), |
Kailang Yang | 272a527 | 2007-05-14 11:00:38 +0200 | [diff] [blame] | 5439 | { } /* end */ |
| 5440 | }; |
| 5441 | |
| 5442 | /* Pin assignment: Front=0x14, HP = 0x15, Front = 0x16, ??? |
| 5443 | * Front Mic=0x18, Line In = 0x1a, Line In = 0x1b, CD = 0x1c |
| 5444 | */ |
| 5445 | static struct snd_kcontrol_new alc882_asus_a7j_mixer[] = { |
| 5446 | HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT), |
| 5447 | HDA_CODEC_MUTE("Front Playback Switch", 0x14, 0x0, HDA_OUTPUT), |
| 5448 | HDA_CODEC_MUTE("Headphone Playback Switch", 0x15, 0x0, HDA_OUTPUT), |
| 5449 | HDA_CODEC_MUTE("Mobile Front Playback Switch", 0x16, 0x0, HDA_OUTPUT), |
| 5450 | HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT), |
| 5451 | HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT), |
| 5452 | HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT), |
| 5453 | HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT), |
| 5454 | HDA_CODEC_VOLUME("Mobile Line Playback Volume", 0x0b, 0x03, HDA_INPUT), |
| 5455 | HDA_CODEC_MUTE("Mobile Line Playback Switch", 0x0b, 0x03, HDA_INPUT), |
| 5456 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), |
| 5457 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), |
Takashi Iwai | 96fe7cc8 | 2007-09-07 10:57:44 +0200 | [diff] [blame] | 5458 | HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT), |
Kailang Yang | 272a527 | 2007-05-14 11:00:38 +0200 | [diff] [blame] | 5459 | { } /* end */ |
| 5460 | }; |
| 5461 | |
Takashi Iwai | 914759b | 2007-09-06 14:52:04 +0200 | [diff] [blame] | 5462 | static struct snd_kcontrol_new alc882_asus_a7m_mixer[] = { |
| 5463 | HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT), |
| 5464 | HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT), |
| 5465 | HDA_CODEC_MUTE("Headphone Playback Switch", 0x15, 0x0, HDA_OUTPUT), |
| 5466 | HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT), |
| 5467 | HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT), |
| 5468 | HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT), |
| 5469 | HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT), |
| 5470 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), |
| 5471 | HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT), |
| 5472 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), |
| 5473 | HDA_CODEC_VOLUME("PC Speaker Playback Volume", 0x0b, 0x05, HDA_INPUT), |
| 5474 | HDA_CODEC_MUTE("PC Speaker Playback Switch", 0x0b, 0x05, HDA_INPUT), |
| 5475 | { } /* end */ |
| 5476 | }; |
| 5477 | |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 5478 | static struct snd_kcontrol_new alc882_chmode_mixer[] = { |
| 5479 | { |
| 5480 | .iface = SNDRV_CTL_ELEM_IFACE_MIXER, |
| 5481 | .name = "Channel Mode", |
| 5482 | .info = alc_ch_mode_info, |
| 5483 | .get = alc_ch_mode_get, |
| 5484 | .put = alc_ch_mode_put, |
| 5485 | }, |
| 5486 | { } /* end */ |
| 5487 | }; |
| 5488 | |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 5489 | static struct hda_verb alc882_init_verbs[] = { |
| 5490 | /* Front mixer: unmute input/output amp left and right (volume = 0) */ |
Takashi Iwai | 05acb86 | 2005-06-10 19:50:25 +0200 | [diff] [blame] | 5491 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 5492 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 5493 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 5494 | /* Rear mixer */ |
Takashi Iwai | 05acb86 | 2005-06-10 19:50:25 +0200 | [diff] [blame] | 5495 | {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 5496 | {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 5497 | {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 5498 | /* CLFE mixer */ |
Takashi Iwai | 05acb86 | 2005-06-10 19:50:25 +0200 | [diff] [blame] | 5499 | {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 5500 | {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 5501 | {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 5502 | /* Side mixer */ |
Takashi Iwai | 05acb86 | 2005-06-10 19:50:25 +0200 | [diff] [blame] | 5503 | {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 5504 | {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 5505 | {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 5506 | |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 5507 | /* Front Pin: output 0 (0x0c) */ |
Takashi Iwai | 05acb86 | 2005-06-10 19:50:25 +0200 | [diff] [blame] | 5508 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
Takashi Iwai | 05acb86 | 2005-06-10 19:50:25 +0200 | [diff] [blame] | 5509 | {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 5510 | {0x14, AC_VERB_SET_CONNECT_SEL, 0x00}, |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 5511 | /* Rear Pin: output 1 (0x0d) */ |
Takashi Iwai | 05acb86 | 2005-06-10 19:50:25 +0200 | [diff] [blame] | 5512 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
Takashi Iwai | 05acb86 | 2005-06-10 19:50:25 +0200 | [diff] [blame] | 5513 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 5514 | {0x15, AC_VERB_SET_CONNECT_SEL, 0x01}, |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 5515 | /* CLFE Pin: output 2 (0x0e) */ |
Takashi Iwai | 05acb86 | 2005-06-10 19:50:25 +0200 | [diff] [blame] | 5516 | {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
Takashi Iwai | 05acb86 | 2005-06-10 19:50:25 +0200 | [diff] [blame] | 5517 | {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 5518 | {0x16, AC_VERB_SET_CONNECT_SEL, 0x02}, |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 5519 | /* Side Pin: output 3 (0x0f) */ |
Takashi Iwai | 05acb86 | 2005-06-10 19:50:25 +0200 | [diff] [blame] | 5520 | {0x17, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
Takashi Iwai | 05acb86 | 2005-06-10 19:50:25 +0200 | [diff] [blame] | 5521 | {0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 5522 | {0x17, AC_VERB_SET_CONNECT_SEL, 0x03}, |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 5523 | /* Mic (rear) pin: input vref at 80% */ |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 5524 | {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80}, |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 5525 | {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
| 5526 | /* Front Mic pin: input vref at 80% */ |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 5527 | {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80}, |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 5528 | {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
| 5529 | /* Line In pin: input */ |
Takashi Iwai | 05acb86 | 2005-06-10 19:50:25 +0200 | [diff] [blame] | 5530 | {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 5531 | {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
| 5532 | /* Line-2 In: Headphone output (output 0 - 0x0c) */ |
| 5533 | {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 5534 | {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 5535 | {0x1b, AC_VERB_SET_CONNECT_SEL, 0x00}, |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 5536 | /* CD pin widget for input */ |
Takashi Iwai | 05acb86 | 2005-06-10 19:50:25 +0200 | [diff] [blame] | 5537 | {0x1c, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 5538 | |
| 5539 | /* FIXME: use matrix-type input source selection */ |
| 5540 | /* Mixer elements: 0x18, 19, 1a, 1b, 1c, 1d, 14, 15, 16, 17, 0b */ |
| 5541 | /* Input mixer1: unmute Mic, F-Mic, Line, CD inputs */ |
Takashi Iwai | 05acb86 | 2005-06-10 19:50:25 +0200 | [diff] [blame] | 5542 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 5543 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)}, |
| 5544 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)}, |
| 5545 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)}, |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 5546 | /* Input mixer2 */ |
Takashi Iwai | 05acb86 | 2005-06-10 19:50:25 +0200 | [diff] [blame] | 5547 | {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 5548 | {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)}, |
| 5549 | {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)}, |
| 5550 | {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)}, |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 5551 | /* Input mixer3 */ |
Takashi Iwai | 05acb86 | 2005-06-10 19:50:25 +0200 | [diff] [blame] | 5552 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 5553 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)}, |
| 5554 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)}, |
| 5555 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)}, |
| 5556 | /* ADC1: mute amp left and right */ |
| 5557 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
Takashi Iwai | 71fe7b8 | 2005-05-25 18:11:40 +0200 | [diff] [blame] | 5558 | {0x07, AC_VERB_SET_CONNECT_SEL, 0x00}, |
Takashi Iwai | 05acb86 | 2005-06-10 19:50:25 +0200 | [diff] [blame] | 5559 | /* ADC2: mute amp left and right */ |
| 5560 | {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
Takashi Iwai | 71fe7b8 | 2005-05-25 18:11:40 +0200 | [diff] [blame] | 5561 | {0x08, AC_VERB_SET_CONNECT_SEL, 0x00}, |
Takashi Iwai | 05acb86 | 2005-06-10 19:50:25 +0200 | [diff] [blame] | 5562 | /* ADC3: mute amp left and right */ |
| 5563 | {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
Takashi Iwai | 71fe7b8 | 2005-05-25 18:11:40 +0200 | [diff] [blame] | 5564 | {0x09, AC_VERB_SET_CONNECT_SEL, 0x00}, |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 5565 | |
| 5566 | { } |
| 5567 | }; |
| 5568 | |
Takashi Iwai | 4b146cb | 2006-07-28 14:42:36 +0200 | [diff] [blame] | 5569 | static struct hda_verb alc882_eapd_verbs[] = { |
| 5570 | /* change to EAPD mode */ |
| 5571 | {0x20, AC_VERB_SET_COEF_INDEX, 0x07}, |
Andrew L. Neporada | b373bde | 2006-11-07 11:37:08 +0100 | [diff] [blame] | 5572 | {0x20, AC_VERB_SET_PROC_COEF, 0x3060}, |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 5573 | { } |
Takashi Iwai | 4b146cb | 2006-07-28 14:42:36 +0200 | [diff] [blame] | 5574 | }; |
| 5575 | |
Tobin Davis | 9102cd1 | 2006-12-15 10:02:12 +0100 | [diff] [blame] | 5576 | /* Mac Pro test */ |
| 5577 | static struct snd_kcontrol_new alc882_macpro_mixer[] = { |
| 5578 | HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT), |
| 5579 | HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT), |
| 5580 | HDA_CODEC_MUTE("Headphone Playback Switch", 0x18, 0x0, HDA_OUTPUT), |
| 5581 | HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x01, HDA_INPUT), |
| 5582 | HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x01, HDA_INPUT), |
| 5583 | HDA_CODEC_VOLUME("PC Speaker Playback Volume", 0x0b, 0x02, HDA_INPUT), |
| 5584 | HDA_CODEC_MUTE("PC Speaker Playback Switch", 0x0b, 0x02, HDA_INPUT), |
| 5585 | { } /* end */ |
| 5586 | }; |
| 5587 | |
| 5588 | static struct hda_verb alc882_macpro_init_verbs[] = { |
| 5589 | /* Front mixer: unmute input/output amp left and right (volume = 0) */ |
| 5590 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 5591 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 5592 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
| 5593 | /* Front Pin: output 0 (0x0c) */ |
| 5594 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 5595 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 5596 | {0x15, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 5597 | /* Front Mic pin: input vref at 80% */ |
| 5598 | {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80}, |
| 5599 | {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
| 5600 | /* Speaker: output */ |
| 5601 | {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 5602 | {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 5603 | {0x1a, AC_VERB_SET_CONNECT_SEL, 0x04}, |
| 5604 | /* Headphone output (output 0 - 0x0c) */ |
| 5605 | {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 5606 | {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 5607 | {0x18, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 5608 | |
| 5609 | /* FIXME: use matrix-type input source selection */ |
| 5610 | /* Mixer elements: 0x18, 19, 1a, 1b, 1c, 1d, 14, 15, 16, 17, 0b */ |
| 5611 | /* Input mixer1: unmute Mic, F-Mic, Line, CD inputs */ |
| 5612 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 5613 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)}, |
| 5614 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)}, |
| 5615 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)}, |
| 5616 | /* Input mixer2 */ |
| 5617 | {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 5618 | {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)}, |
| 5619 | {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)}, |
| 5620 | {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)}, |
| 5621 | /* Input mixer3 */ |
| 5622 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 5623 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)}, |
| 5624 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)}, |
| 5625 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)}, |
| 5626 | /* ADC1: mute amp left and right */ |
| 5627 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 5628 | {0x07, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 5629 | /* ADC2: mute amp left and right */ |
| 5630 | {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 5631 | {0x08, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 5632 | /* ADC3: mute amp left and right */ |
| 5633 | {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 5634 | {0x09, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 5635 | |
| 5636 | { } |
| 5637 | }; |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 5638 | |
Takashi Iwai | 87350ad | 2007-08-16 18:19:38 +0200 | [diff] [blame] | 5639 | /* Macbook Pro rev3 */ |
| 5640 | static struct hda_verb alc885_mbp3_init_verbs[] = { |
| 5641 | /* Front mixer: unmute input/output amp left and right (volume = 0) */ |
| 5642 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 5643 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 5644 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
| 5645 | /* Rear mixer */ |
| 5646 | {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 5647 | {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 5648 | {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
| 5649 | /* Front Pin: output 0 (0x0c) */ |
| 5650 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 5651 | {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 5652 | {0x14, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 5653 | /* HP Pin: output 0 (0x0d) */ |
| 5654 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, 0xc4}, |
| 5655 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
| 5656 | {0x15, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 5657 | {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN}, |
| 5658 | /* Mic (rear) pin: input vref at 80% */ |
| 5659 | {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80}, |
| 5660 | {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
| 5661 | /* Front Mic pin: input vref at 80% */ |
| 5662 | {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80}, |
| 5663 | {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
| 5664 | /* Line In pin: use output 1 when in LineOut mode */ |
| 5665 | {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
| 5666 | {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
| 5667 | {0x1a, AC_VERB_SET_CONNECT_SEL, 0x01}, |
| 5668 | |
| 5669 | /* FIXME: use matrix-type input source selection */ |
| 5670 | /* Mixer elements: 0x18, 19, 1a, 1b, 1c, 1d, 14, 15, 16, 17, 0b */ |
| 5671 | /* Input mixer1: unmute Mic, F-Mic, Line, CD inputs */ |
| 5672 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 5673 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)}, |
| 5674 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)}, |
| 5675 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)}, |
| 5676 | /* Input mixer2 */ |
| 5677 | {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 5678 | {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)}, |
| 5679 | {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)}, |
| 5680 | {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)}, |
| 5681 | /* Input mixer3 */ |
| 5682 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 5683 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)}, |
| 5684 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)}, |
| 5685 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)}, |
| 5686 | /* ADC1: mute amp left and right */ |
| 5687 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 5688 | {0x07, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 5689 | /* ADC2: mute amp left and right */ |
| 5690 | {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 5691 | {0x08, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 5692 | /* ADC3: mute amp left and right */ |
| 5693 | {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 5694 | {0x09, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 5695 | |
| 5696 | { } |
| 5697 | }; |
| 5698 | |
Nicola Fagnani | c54728d | 2007-07-19 23:28:52 +0200 | [diff] [blame] | 5699 | /* iMac 24 mixer. */ |
| 5700 | static struct snd_kcontrol_new alc885_imac24_mixer[] = { |
| 5701 | HDA_CODEC_VOLUME("Master Playback Volume", 0x0c, 0x00, HDA_OUTPUT), |
| 5702 | HDA_CODEC_MUTE("Master Playback Switch", 0x0c, 0x00, HDA_INPUT), |
| 5703 | { } /* end */ |
| 5704 | }; |
| 5705 | |
| 5706 | /* iMac 24 init verbs. */ |
| 5707 | static struct hda_verb alc885_imac24_init_verbs[] = { |
| 5708 | /* Internal speakers: output 0 (0x0c) */ |
| 5709 | {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 5710 | {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 5711 | {0x18, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 5712 | /* Internal speakers: output 0 (0x0c) */ |
| 5713 | {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 5714 | {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 5715 | {0x1a, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 5716 | /* Headphone: output 0 (0x0c) */ |
| 5717 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 5718 | {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 5719 | {0x14, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 5720 | {0x14, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN}, |
| 5721 | /* Front Mic: input vref at 80% */ |
| 5722 | {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80}, |
| 5723 | {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
| 5724 | { } |
| 5725 | }; |
| 5726 | |
| 5727 | /* Toggle speaker-output according to the hp-jack state */ |
| 5728 | static void alc885_imac24_automute(struct hda_codec *codec) |
| 5729 | { |
| 5730 | unsigned int present; |
| 5731 | |
| 5732 | present = snd_hda_codec_read(codec, 0x14, 0, |
| 5733 | AC_VERB_GET_PIN_SENSE, 0) & 0x80000000; |
Takashi Iwai | 47fd830 | 2007-08-10 17:11:07 +0200 | [diff] [blame] | 5734 | snd_hda_codec_amp_stereo(codec, 0x18, HDA_OUTPUT, 0, |
| 5735 | HDA_AMP_MUTE, present ? HDA_AMP_MUTE : 0); |
| 5736 | snd_hda_codec_amp_stereo(codec, 0x1a, HDA_OUTPUT, 0, |
| 5737 | HDA_AMP_MUTE, present ? HDA_AMP_MUTE : 0); |
Nicola Fagnani | c54728d | 2007-07-19 23:28:52 +0200 | [diff] [blame] | 5738 | } |
| 5739 | |
| 5740 | /* Processes unsolicited events. */ |
| 5741 | static void alc885_imac24_unsol_event(struct hda_codec *codec, |
| 5742 | unsigned int res) |
| 5743 | { |
| 5744 | /* Headphone insertion or removal. */ |
| 5745 | if ((res >> 26) == ALC880_HP_EVENT) |
| 5746 | alc885_imac24_automute(codec); |
| 5747 | } |
| 5748 | |
Takashi Iwai | 87350ad | 2007-08-16 18:19:38 +0200 | [diff] [blame] | 5749 | static void alc885_mbp3_automute(struct hda_codec *codec) |
| 5750 | { |
| 5751 | unsigned int present; |
| 5752 | |
| 5753 | present = snd_hda_codec_read(codec, 0x15, 0, |
| 5754 | AC_VERB_GET_PIN_SENSE, 0) & 0x80000000; |
| 5755 | snd_hda_codec_amp_stereo(codec, 0x14, HDA_OUTPUT, 0, |
| 5756 | HDA_AMP_MUTE, present ? HDA_AMP_MUTE : 0); |
| 5757 | snd_hda_codec_amp_stereo(codec, 0x15, HDA_OUTPUT, 0, |
| 5758 | HDA_AMP_MUTE, present ? 0 : HDA_AMP_MUTE); |
| 5759 | |
| 5760 | } |
| 5761 | static void alc885_mbp3_unsol_event(struct hda_codec *codec, |
| 5762 | unsigned int res) |
| 5763 | { |
| 5764 | /* Headphone insertion or removal. */ |
| 5765 | if ((res >> 26) == ALC880_HP_EVENT) |
| 5766 | alc885_mbp3_automute(codec); |
| 5767 | } |
| 5768 | |
| 5769 | |
Kailang Yang | 272a527 | 2007-05-14 11:00:38 +0200 | [diff] [blame] | 5770 | static struct hda_verb alc882_targa_verbs[] = { |
| 5771 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 5772 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 5773 | |
| 5774 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 5775 | {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 5776 | |
| 5777 | {0x18, AC_VERB_SET_CONNECT_SEL, 0x02}, /* mic/clfe */ |
| 5778 | {0x1a, AC_VERB_SET_CONNECT_SEL, 0x01}, /* line/surround */ |
| 5779 | {0x1b, AC_VERB_SET_CONNECT_SEL, 0x00}, /* HP */ |
| 5780 | |
| 5781 | {0x14, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN}, |
| 5782 | {0x01, AC_VERB_SET_GPIO_MASK, 0x03}, |
| 5783 | {0x01, AC_VERB_SET_GPIO_DIRECTION, 0x03}, |
| 5784 | {0x01, AC_VERB_SET_GPIO_DATA, 0x03}, |
| 5785 | { } /* end */ |
| 5786 | }; |
| 5787 | |
| 5788 | /* toggle speaker-output according to the hp-jack state */ |
| 5789 | static void alc882_targa_automute(struct hda_codec *codec) |
| 5790 | { |
| 5791 | unsigned int present; |
| 5792 | |
| 5793 | present = snd_hda_codec_read(codec, 0x14, 0, |
| 5794 | AC_VERB_GET_PIN_SENSE, 0) & 0x80000000; |
Takashi Iwai | 47fd830 | 2007-08-10 17:11:07 +0200 | [diff] [blame] | 5795 | snd_hda_codec_amp_stereo(codec, 0x1b, HDA_OUTPUT, 0, |
| 5796 | HDA_AMP_MUTE, present ? HDA_AMP_MUTE : 0); |
Takashi Iwai | 82beb8f | 2007-08-10 17:09:26 +0200 | [diff] [blame] | 5797 | snd_hda_codec_write_cache(codec, 1, 0, AC_VERB_SET_GPIO_DATA, |
| 5798 | present ? 1 : 3); |
Kailang Yang | 272a527 | 2007-05-14 11:00:38 +0200 | [diff] [blame] | 5799 | } |
| 5800 | |
| 5801 | static void alc882_targa_unsol_event(struct hda_codec *codec, unsigned int res) |
| 5802 | { |
| 5803 | /* Looks like the unsol event is incompatible with the standard |
| 5804 | * definition. 4bit tag is placed at 26 bit! |
| 5805 | */ |
| 5806 | if (((res >> 26) == ALC880_HP_EVENT)) { |
| 5807 | alc882_targa_automute(codec); |
| 5808 | } |
| 5809 | } |
| 5810 | |
| 5811 | static struct hda_verb alc882_asus_a7j_verbs[] = { |
| 5812 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 5813 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 5814 | |
| 5815 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 5816 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 5817 | {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 5818 | |
| 5819 | {0x14, AC_VERB_SET_CONNECT_SEL, 0x00}, /* Front */ |
| 5820 | {0x15, AC_VERB_SET_CONNECT_SEL, 0x00}, /* HP */ |
| 5821 | {0x16, AC_VERB_SET_CONNECT_SEL, 0x00}, /* Front */ |
| 5822 | |
| 5823 | {0x18, AC_VERB_SET_CONNECT_SEL, 0x02}, /* mic/clfe */ |
| 5824 | {0x1a, AC_VERB_SET_CONNECT_SEL, 0x01}, /* line/surround */ |
| 5825 | {0x1b, AC_VERB_SET_CONNECT_SEL, 0x00}, /* HP */ |
| 5826 | { } /* end */ |
| 5827 | }; |
| 5828 | |
Takashi Iwai | 914759b | 2007-09-06 14:52:04 +0200 | [diff] [blame] | 5829 | static struct hda_verb alc882_asus_a7m_verbs[] = { |
| 5830 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 5831 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 5832 | |
| 5833 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 5834 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 5835 | {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 5836 | |
| 5837 | {0x14, AC_VERB_SET_CONNECT_SEL, 0x00}, /* Front */ |
| 5838 | {0x15, AC_VERB_SET_CONNECT_SEL, 0x00}, /* HP */ |
| 5839 | {0x16, AC_VERB_SET_CONNECT_SEL, 0x00}, /* Front */ |
| 5840 | |
| 5841 | {0x18, AC_VERB_SET_CONNECT_SEL, 0x02}, /* mic/clfe */ |
| 5842 | {0x1a, AC_VERB_SET_CONNECT_SEL, 0x01}, /* line/surround */ |
| 5843 | {0x1b, AC_VERB_SET_CONNECT_SEL, 0x00}, /* HP */ |
| 5844 | { } /* end */ |
| 5845 | }; |
| 5846 | |
Tobin Davis | 9102cd1 | 2006-12-15 10:02:12 +0100 | [diff] [blame] | 5847 | static void alc882_gpio_mute(struct hda_codec *codec, int pin, int muted) |
| 5848 | { |
| 5849 | unsigned int gpiostate, gpiomask, gpiodir; |
| 5850 | |
| 5851 | gpiostate = snd_hda_codec_read(codec, codec->afg, 0, |
| 5852 | AC_VERB_GET_GPIO_DATA, 0); |
| 5853 | |
| 5854 | if (!muted) |
| 5855 | gpiostate |= (1 << pin); |
| 5856 | else |
| 5857 | gpiostate &= ~(1 << pin); |
| 5858 | |
| 5859 | gpiomask = snd_hda_codec_read(codec, codec->afg, 0, |
| 5860 | AC_VERB_GET_GPIO_MASK, 0); |
| 5861 | gpiomask |= (1 << pin); |
| 5862 | |
| 5863 | gpiodir = snd_hda_codec_read(codec, codec->afg, 0, |
| 5864 | AC_VERB_GET_GPIO_DIRECTION, 0); |
| 5865 | gpiodir |= (1 << pin); |
| 5866 | |
| 5867 | |
| 5868 | snd_hda_codec_write(codec, codec->afg, 0, |
| 5869 | AC_VERB_SET_GPIO_MASK, gpiomask); |
| 5870 | snd_hda_codec_write(codec, codec->afg, 0, |
| 5871 | AC_VERB_SET_GPIO_DIRECTION, gpiodir); |
| 5872 | |
| 5873 | msleep(1); |
| 5874 | |
| 5875 | snd_hda_codec_write(codec, codec->afg, 0, |
| 5876 | AC_VERB_SET_GPIO_DATA, gpiostate); |
| 5877 | } |
| 5878 | |
Takashi Iwai | 7debbe5 | 2007-08-16 15:01:03 +0200 | [diff] [blame] | 5879 | /* set up GPIO at initialization */ |
| 5880 | static void alc885_macpro_init_hook(struct hda_codec *codec) |
| 5881 | { |
| 5882 | alc882_gpio_mute(codec, 0, 0); |
| 5883 | alc882_gpio_mute(codec, 1, 0); |
| 5884 | } |
| 5885 | |
| 5886 | /* set up GPIO and update auto-muting at initialization */ |
| 5887 | static void alc885_imac24_init_hook(struct hda_codec *codec) |
| 5888 | { |
| 5889 | alc885_macpro_init_hook(codec); |
| 5890 | alc885_imac24_automute(codec); |
| 5891 | } |
| 5892 | |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 5893 | /* |
| 5894 | * generic initialization of ADC, input mixers and output mixers |
| 5895 | */ |
| 5896 | static struct hda_verb alc882_auto_init_verbs[] = { |
| 5897 | /* |
| 5898 | * Unmute ADC0-2 and set the default input to mic-in |
| 5899 | */ |
| 5900 | {0x07, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 5901 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 5902 | {0x08, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 5903 | {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 5904 | {0x09, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 5905 | {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 5906 | |
Takashi Iwai | cb53c62 | 2007-08-10 17:21:45 +0200 | [diff] [blame] | 5907 | /* 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] | 5908 | * mixer widget |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 5909 | * Note: PASD motherboards uses the Line In 2 as the input for |
| 5910 | * front panel mic (mic 2) |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 5911 | */ |
| 5912 | /* Amp Indices: Mic1 = 0, Mic2 = 1, Line1 = 2, Line2 = 3, CD = 4 */ |
Takashi Iwai | cb53c62 | 2007-08-10 17:21:45 +0200 | [diff] [blame] | 5913 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 5914 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
| 5915 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)}, |
| 5916 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)}, |
| 5917 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)}, |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 5918 | |
| 5919 | /* |
| 5920 | * Set up output mixers (0x0c - 0x0f) |
| 5921 | */ |
| 5922 | /* set vol=0 to output mixers */ |
| 5923 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 5924 | {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 5925 | {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 5926 | {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 5927 | /* set up input amps for analog loopback */ |
| 5928 | /* Amp Indices: DAC = 0, mixer = 1 */ |
| 5929 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 5930 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 5931 | {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 5932 | {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 5933 | {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 5934 | {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 5935 | {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 5936 | {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 5937 | {0x26, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 5938 | {0x26, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 5939 | |
| 5940 | /* FIXME: use matrix-type input source selection */ |
| 5941 | /* Mixer elements: 0x18, 19, 1a, 1b, 1c, 1d, 14, 15, 16, 17, 0b */ |
| 5942 | /* Input mixer1: unmute Mic, F-Mic, Line, CD inputs */ |
| 5943 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))}, |
| 5944 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x03 << 8))}, |
| 5945 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x02 << 8))}, |
| 5946 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x04 << 8))}, |
| 5947 | /* Input mixer2 */ |
| 5948 | {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))}, |
| 5949 | {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x03 << 8))}, |
| 5950 | {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x02 << 8))}, |
| 5951 | {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x04 << 8))}, |
| 5952 | /* Input mixer3 */ |
| 5953 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))}, |
| 5954 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x03 << 8))}, |
| 5955 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x02 << 8))}, |
| 5956 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x04 << 8))}, |
| 5957 | |
| 5958 | { } |
| 5959 | }; |
| 5960 | |
| 5961 | /* capture mixer elements */ |
| 5962 | static struct snd_kcontrol_new alc882_capture_alt_mixer[] = { |
| 5963 | HDA_CODEC_VOLUME("Capture Volume", 0x08, 0x0, HDA_INPUT), |
| 5964 | HDA_CODEC_MUTE("Capture Switch", 0x08, 0x0, HDA_INPUT), |
| 5965 | HDA_CODEC_VOLUME_IDX("Capture Volume", 1, 0x09, 0x0, HDA_INPUT), |
| 5966 | HDA_CODEC_MUTE_IDX("Capture Switch", 1, 0x09, 0x0, HDA_INPUT), |
| 5967 | { |
| 5968 | .iface = SNDRV_CTL_ELEM_IFACE_MIXER, |
| 5969 | /* The multiple "Capture Source" controls confuse alsamixer |
| 5970 | * So call somewhat different.. |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 5971 | */ |
| 5972 | /* .name = "Capture Source", */ |
| 5973 | .name = "Input Source", |
| 5974 | .count = 2, |
| 5975 | .info = alc882_mux_enum_info, |
| 5976 | .get = alc882_mux_enum_get, |
| 5977 | .put = alc882_mux_enum_put, |
| 5978 | }, |
| 5979 | { } /* end */ |
| 5980 | }; |
| 5981 | |
| 5982 | static struct snd_kcontrol_new alc882_capture_mixer[] = { |
| 5983 | HDA_CODEC_VOLUME("Capture Volume", 0x07, 0x0, HDA_INPUT), |
| 5984 | HDA_CODEC_MUTE("Capture Switch", 0x07, 0x0, HDA_INPUT), |
| 5985 | HDA_CODEC_VOLUME_IDX("Capture Volume", 1, 0x08, 0x0, HDA_INPUT), |
| 5986 | HDA_CODEC_MUTE_IDX("Capture Switch", 1, 0x08, 0x0, HDA_INPUT), |
| 5987 | HDA_CODEC_VOLUME_IDX("Capture Volume", 2, 0x09, 0x0, HDA_INPUT), |
| 5988 | HDA_CODEC_MUTE_IDX("Capture Switch", 2, 0x09, 0x0, HDA_INPUT), |
| 5989 | { |
| 5990 | .iface = SNDRV_CTL_ELEM_IFACE_MIXER, |
| 5991 | /* The multiple "Capture Source" controls confuse alsamixer |
| 5992 | * So call somewhat different.. |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 5993 | */ |
| 5994 | /* .name = "Capture Source", */ |
| 5995 | .name = "Input Source", |
| 5996 | .count = 3, |
| 5997 | .info = alc882_mux_enum_info, |
| 5998 | .get = alc882_mux_enum_get, |
| 5999 | .put = alc882_mux_enum_put, |
| 6000 | }, |
| 6001 | { } /* end */ |
| 6002 | }; |
| 6003 | |
Takashi Iwai | cb53c62 | 2007-08-10 17:21:45 +0200 | [diff] [blame] | 6004 | #ifdef CONFIG_SND_HDA_POWER_SAVE |
| 6005 | #define alc882_loopbacks alc880_loopbacks |
| 6006 | #endif |
| 6007 | |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 6008 | /* pcm configuration: identiacal with ALC880 */ |
| 6009 | #define alc882_pcm_analog_playback alc880_pcm_analog_playback |
| 6010 | #define alc882_pcm_analog_capture alc880_pcm_analog_capture |
| 6011 | #define alc882_pcm_digital_playback alc880_pcm_digital_playback |
| 6012 | #define alc882_pcm_digital_capture alc880_pcm_digital_capture |
| 6013 | |
| 6014 | /* |
| 6015 | * configuration and preset |
| 6016 | */ |
Takashi Iwai | f5fcc13 | 2006-11-24 17:07:44 +0100 | [diff] [blame] | 6017 | static const char *alc882_models[ALC882_MODEL_LAST] = { |
| 6018 | [ALC882_3ST_DIG] = "3stack-dig", |
| 6019 | [ALC882_6ST_DIG] = "6stack-dig", |
| 6020 | [ALC882_ARIMA] = "arima", |
Kailang Yang | bdd148a | 2007-05-08 15:19:08 +0200 | [diff] [blame] | 6021 | [ALC882_W2JC] = "w2jc", |
Takashi Iwai | 0438a00 | 2007-09-06 14:54:11 +0200 | [diff] [blame] | 6022 | [ALC882_TARGA] = "targa", |
| 6023 | [ALC882_ASUS_A7J] = "asus-a7j", |
| 6024 | [ALC882_ASUS_A7M] = "asus-a7m", |
Tobin Davis | 9102cd1 | 2006-12-15 10:02:12 +0100 | [diff] [blame] | 6025 | [ALC885_MACPRO] = "macpro", |
Takashi Iwai | 87350ad | 2007-08-16 18:19:38 +0200 | [diff] [blame] | 6026 | [ALC885_MBP3] = "mbp3", |
Nicola Fagnani | c54728d | 2007-07-19 23:28:52 +0200 | [diff] [blame] | 6027 | [ALC885_IMAC24] = "imac24", |
Takashi Iwai | f5fcc13 | 2006-11-24 17:07:44 +0100 | [diff] [blame] | 6028 | [ALC882_AUTO] = "auto", |
| 6029 | }; |
| 6030 | |
| 6031 | static struct snd_pci_quirk alc882_cfg_tbl[] = { |
| 6032 | SND_PCI_QUIRK(0x1019, 0x6668, "ECS", ALC882_6ST_DIG), |
Kailang Yang | 272a527 | 2007-05-14 11:00:38 +0200 | [diff] [blame] | 6033 | SND_PCI_QUIRK(0x1043, 0x060d, "Asus A7J", ALC882_ASUS_A7J), |
Kailang Yang | ac8842a | 2007-09-20 12:51:39 +0200 | [diff] [blame] | 6034 | SND_PCI_QUIRK(0x1043, 0x1243, "Asus A7J", ALC882_ASUS_A7J), |
Takashi Iwai | 914759b | 2007-09-06 14:52:04 +0200 | [diff] [blame] | 6035 | SND_PCI_QUIRK(0x1043, 0x13c2, "Asus A7M", ALC882_ASUS_A7M), |
Takashi Iwai | ac3e374 | 2007-12-17 17:14:18 +0100 | [diff] [blame] | 6036 | SND_PCI_QUIRK(0x1043, 0x1971, "Asus W2JC", ALC882_W2JC), |
Claudio Matsuoka | c5d9f1c | 2007-07-19 23:18:32 +0200 | [diff] [blame] | 6037 | SND_PCI_QUIRK(0x1043, 0x817f, "Asus P5LD2", ALC882_6ST_DIG), |
Tobin Davis | 7b9470d | 2006-12-28 13:56:48 +0100 | [diff] [blame] | 6038 | SND_PCI_QUIRK(0x1043, 0x81d8, "Asus P5WD", ALC882_6ST_DIG), |
Takashi Iwai | ac3e374 | 2007-12-17 17:14:18 +0100 | [diff] [blame] | 6039 | SND_PCI_QUIRK(0x105b, 0x6668, "Foxconn", ALC882_6ST_DIG), |
Jiang zhe | 4444704 | 2008-01-28 12:28:24 +0100 | [diff] [blame] | 6040 | SND_PCI_QUIRK(0x1458, 0xa002, "Gigabyte P35 DS3R", ALC882_6ST_DIG), |
Takashi Iwai | ac3e374 | 2007-12-17 17:14:18 +0100 | [diff] [blame] | 6041 | SND_PCI_QUIRK(0x1462, 0x28fb, "Targa T8", ALC882_TARGA), /* MSI-1049 T8 */ |
| 6042 | SND_PCI_QUIRK(0x1462, 0x6668, "MSI", ALC882_6ST_DIG), |
| 6043 | SND_PCI_QUIRK(0x161f, 0x2054, "Arima W820", ALC882_ARIMA), |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 6044 | {} |
| 6045 | }; |
| 6046 | |
| 6047 | static struct alc_config_preset alc882_presets[] = { |
| 6048 | [ALC882_3ST_DIG] = { |
| 6049 | .mixers = { alc882_base_mixer }, |
| 6050 | .init_verbs = { alc882_init_verbs }, |
| 6051 | .num_dacs = ARRAY_SIZE(alc882_dac_nids), |
| 6052 | .dac_nids = alc882_dac_nids, |
| 6053 | .dig_out_nid = ALC882_DIGOUT_NID, |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 6054 | .dig_in_nid = ALC882_DIGIN_NID, |
| 6055 | .num_channel_mode = ARRAY_SIZE(alc882_ch_modes), |
| 6056 | .channel_mode = alc882_ch_modes, |
Takashi Iwai | 4e195a7 | 2006-07-28 14:47:34 +0200 | [diff] [blame] | 6057 | .need_dac_fix = 1, |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 6058 | .input_mux = &alc882_capture_source, |
| 6059 | }, |
| 6060 | [ALC882_6ST_DIG] = { |
| 6061 | .mixers = { alc882_base_mixer, alc882_chmode_mixer }, |
| 6062 | .init_verbs = { alc882_init_verbs }, |
| 6063 | .num_dacs = ARRAY_SIZE(alc882_dac_nids), |
| 6064 | .dac_nids = alc882_dac_nids, |
| 6065 | .dig_out_nid = ALC882_DIGOUT_NID, |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 6066 | .dig_in_nid = ALC882_DIGIN_NID, |
| 6067 | .num_channel_mode = ARRAY_SIZE(alc882_sixstack_modes), |
| 6068 | .channel_mode = alc882_sixstack_modes, |
| 6069 | .input_mux = &alc882_capture_source, |
| 6070 | }, |
Takashi Iwai | 4b146cb | 2006-07-28 14:42:36 +0200 | [diff] [blame] | 6071 | [ALC882_ARIMA] = { |
| 6072 | .mixers = { alc882_base_mixer, alc882_chmode_mixer }, |
| 6073 | .init_verbs = { alc882_init_verbs, alc882_eapd_verbs }, |
| 6074 | .num_dacs = ARRAY_SIZE(alc882_dac_nids), |
| 6075 | .dac_nids = alc882_dac_nids, |
| 6076 | .num_channel_mode = ARRAY_SIZE(alc882_sixstack_modes), |
| 6077 | .channel_mode = alc882_sixstack_modes, |
| 6078 | .input_mux = &alc882_capture_source, |
| 6079 | }, |
Kailang Yang | bdd148a | 2007-05-08 15:19:08 +0200 | [diff] [blame] | 6080 | [ALC882_W2JC] = { |
| 6081 | .mixers = { alc882_w2jc_mixer, alc882_chmode_mixer }, |
| 6082 | .init_verbs = { alc882_init_verbs, alc882_eapd_verbs, |
| 6083 | alc880_gpio1_init_verbs }, |
| 6084 | .num_dacs = ARRAY_SIZE(alc882_dac_nids), |
| 6085 | .dac_nids = alc882_dac_nids, |
| 6086 | .num_channel_mode = ARRAY_SIZE(alc880_threestack_modes), |
| 6087 | .channel_mode = alc880_threestack_modes, |
| 6088 | .need_dac_fix = 1, |
| 6089 | .input_mux = &alc882_capture_source, |
| 6090 | .dig_out_nid = ALC882_DIGOUT_NID, |
| 6091 | }, |
Takashi Iwai | 87350ad | 2007-08-16 18:19:38 +0200 | [diff] [blame] | 6092 | [ALC885_MBP3] = { |
| 6093 | .mixers = { alc885_mbp3_mixer, alc882_chmode_mixer }, |
| 6094 | .init_verbs = { alc885_mbp3_init_verbs, |
| 6095 | alc880_gpio1_init_verbs }, |
| 6096 | .num_dacs = ARRAY_SIZE(alc882_dac_nids), |
| 6097 | .dac_nids = alc882_dac_nids, |
| 6098 | .channel_mode = alc885_mbp_6ch_modes, |
| 6099 | .num_channel_mode = ARRAY_SIZE(alc885_mbp_6ch_modes), |
| 6100 | .input_mux = &alc882_capture_source, |
| 6101 | .dig_out_nid = ALC882_DIGOUT_NID, |
| 6102 | .dig_in_nid = ALC882_DIGIN_NID, |
| 6103 | .unsol_event = alc885_mbp3_unsol_event, |
| 6104 | .init_hook = alc885_mbp3_automute, |
| 6105 | }, |
Tobin Davis | 9102cd1 | 2006-12-15 10:02:12 +0100 | [diff] [blame] | 6106 | [ALC885_MACPRO] = { |
| 6107 | .mixers = { alc882_macpro_mixer }, |
| 6108 | .init_verbs = { alc882_macpro_init_verbs }, |
| 6109 | .num_dacs = ARRAY_SIZE(alc882_dac_nids), |
| 6110 | .dac_nids = alc882_dac_nids, |
| 6111 | .dig_out_nid = ALC882_DIGOUT_NID, |
| 6112 | .dig_in_nid = ALC882_DIGIN_NID, |
| 6113 | .num_channel_mode = ARRAY_SIZE(alc882_ch_modes), |
| 6114 | .channel_mode = alc882_ch_modes, |
| 6115 | .input_mux = &alc882_capture_source, |
Takashi Iwai | 7debbe5 | 2007-08-16 15:01:03 +0200 | [diff] [blame] | 6116 | .init_hook = alc885_macpro_init_hook, |
Tobin Davis | 9102cd1 | 2006-12-15 10:02:12 +0100 | [diff] [blame] | 6117 | }, |
Nicola Fagnani | c54728d | 2007-07-19 23:28:52 +0200 | [diff] [blame] | 6118 | [ALC885_IMAC24] = { |
| 6119 | .mixers = { alc885_imac24_mixer }, |
| 6120 | .init_verbs = { alc885_imac24_init_verbs }, |
| 6121 | .num_dacs = ARRAY_SIZE(alc882_dac_nids), |
| 6122 | .dac_nids = alc882_dac_nids, |
| 6123 | .dig_out_nid = ALC882_DIGOUT_NID, |
| 6124 | .dig_in_nid = ALC882_DIGIN_NID, |
| 6125 | .num_channel_mode = ARRAY_SIZE(alc882_ch_modes), |
| 6126 | .channel_mode = alc882_ch_modes, |
| 6127 | .input_mux = &alc882_capture_source, |
| 6128 | .unsol_event = alc885_imac24_unsol_event, |
Takashi Iwai | 7debbe5 | 2007-08-16 15:01:03 +0200 | [diff] [blame] | 6129 | .init_hook = alc885_imac24_init_hook, |
Nicola Fagnani | c54728d | 2007-07-19 23:28:52 +0200 | [diff] [blame] | 6130 | }, |
Kailang Yang | 272a527 | 2007-05-14 11:00:38 +0200 | [diff] [blame] | 6131 | [ALC882_TARGA] = { |
| 6132 | .mixers = { alc882_targa_mixer, alc882_chmode_mixer, |
| 6133 | alc882_capture_mixer }, |
| 6134 | .init_verbs = { alc882_init_verbs, alc882_targa_verbs}, |
| 6135 | .num_dacs = ARRAY_SIZE(alc882_dac_nids), |
| 6136 | .dac_nids = alc882_dac_nids, |
| 6137 | .dig_out_nid = ALC882_DIGOUT_NID, |
| 6138 | .num_adc_nids = ARRAY_SIZE(alc882_adc_nids), |
| 6139 | .adc_nids = alc882_adc_nids, |
Takashi Iwai | e140634 | 2008-02-11 18:32:32 +0100 | [diff] [blame] | 6140 | .capsrc_nids = alc882_capsrc_nids, |
Kailang Yang | 272a527 | 2007-05-14 11:00:38 +0200 | [diff] [blame] | 6141 | .num_channel_mode = ARRAY_SIZE(alc882_3ST_6ch_modes), |
| 6142 | .channel_mode = alc882_3ST_6ch_modes, |
| 6143 | .need_dac_fix = 1, |
| 6144 | .input_mux = &alc882_capture_source, |
| 6145 | .unsol_event = alc882_targa_unsol_event, |
| 6146 | .init_hook = alc882_targa_automute, |
| 6147 | }, |
| 6148 | [ALC882_ASUS_A7J] = { |
| 6149 | .mixers = { alc882_asus_a7j_mixer, alc882_chmode_mixer, |
| 6150 | alc882_capture_mixer }, |
| 6151 | .init_verbs = { alc882_init_verbs, alc882_asus_a7j_verbs}, |
| 6152 | .num_dacs = ARRAY_SIZE(alc882_dac_nids), |
| 6153 | .dac_nids = alc882_dac_nids, |
| 6154 | .dig_out_nid = ALC882_DIGOUT_NID, |
| 6155 | .num_adc_nids = ARRAY_SIZE(alc882_adc_nids), |
| 6156 | .adc_nids = alc882_adc_nids, |
Takashi Iwai | e140634 | 2008-02-11 18:32:32 +0100 | [diff] [blame] | 6157 | .capsrc_nids = alc882_capsrc_nids, |
Kailang Yang | 272a527 | 2007-05-14 11:00:38 +0200 | [diff] [blame] | 6158 | .num_channel_mode = ARRAY_SIZE(alc882_3ST_6ch_modes), |
| 6159 | .channel_mode = alc882_3ST_6ch_modes, |
| 6160 | .need_dac_fix = 1, |
| 6161 | .input_mux = &alc882_capture_source, |
| 6162 | }, |
Takashi Iwai | 914759b | 2007-09-06 14:52:04 +0200 | [diff] [blame] | 6163 | [ALC882_ASUS_A7M] = { |
| 6164 | .mixers = { alc882_asus_a7m_mixer, alc882_chmode_mixer }, |
| 6165 | .init_verbs = { alc882_init_verbs, alc882_eapd_verbs, |
| 6166 | alc880_gpio1_init_verbs, |
| 6167 | alc882_asus_a7m_verbs }, |
| 6168 | .num_dacs = ARRAY_SIZE(alc882_dac_nids), |
| 6169 | .dac_nids = alc882_dac_nids, |
| 6170 | .dig_out_nid = ALC882_DIGOUT_NID, |
| 6171 | .num_channel_mode = ARRAY_SIZE(alc880_threestack_modes), |
| 6172 | .channel_mode = alc880_threestack_modes, |
| 6173 | .need_dac_fix = 1, |
| 6174 | .input_mux = &alc882_capture_source, |
| 6175 | }, |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 6176 | }; |
| 6177 | |
| 6178 | |
| 6179 | /* |
Takashi Iwai | f95474e | 2007-07-10 00:47:43 +0200 | [diff] [blame] | 6180 | * Pin config fixes |
| 6181 | */ |
| 6182 | enum { |
| 6183 | PINFIX_ABIT_AW9D_MAX |
| 6184 | }; |
| 6185 | |
| 6186 | static struct alc_pincfg alc882_abit_aw9d_pinfix[] = { |
| 6187 | { 0x15, 0x01080104 }, /* side */ |
| 6188 | { 0x16, 0x01011012 }, /* rear */ |
| 6189 | { 0x17, 0x01016011 }, /* clfe */ |
| 6190 | { } |
| 6191 | }; |
| 6192 | |
| 6193 | static const struct alc_pincfg *alc882_pin_fixes[] = { |
| 6194 | [PINFIX_ABIT_AW9D_MAX] = alc882_abit_aw9d_pinfix, |
| 6195 | }; |
| 6196 | |
| 6197 | static struct snd_pci_quirk alc882_pinfix_tbl[] = { |
| 6198 | SND_PCI_QUIRK(0x147b, 0x107a, "Abit AW9D-MAX", PINFIX_ABIT_AW9D_MAX), |
| 6199 | {} |
| 6200 | }; |
| 6201 | |
| 6202 | /* |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 6203 | * BIOS auto configuration |
| 6204 | */ |
| 6205 | static void alc882_auto_set_output_and_unmute(struct hda_codec *codec, |
| 6206 | hda_nid_t nid, int pin_type, |
| 6207 | int dac_idx) |
| 6208 | { |
| 6209 | /* set as output */ |
| 6210 | struct alc_spec *spec = codec->spec; |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 6211 | int idx; |
| 6212 | |
Takashi Iwai | f6c7e54 | 2008-02-12 18:32:23 +0100 | [diff] [blame] | 6213 | alc_set_pin_output(codec, nid, pin_type); |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 6214 | if (spec->multiout.dac_nids[dac_idx] == 0x25) |
| 6215 | idx = 4; |
| 6216 | else |
| 6217 | idx = spec->multiout.dac_nids[dac_idx] - 2; |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 6218 | snd_hda_codec_write(codec, nid, 0, AC_VERB_SET_CONNECT_SEL, idx); |
| 6219 | |
| 6220 | } |
| 6221 | |
| 6222 | static void alc882_auto_init_multi_out(struct hda_codec *codec) |
| 6223 | { |
| 6224 | struct alc_spec *spec = codec->spec; |
| 6225 | int i; |
| 6226 | |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 6227 | alc_subsystem_id(codec, 0x15, 0x1b, 0x14); |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 6228 | for (i = 0; i <= HDA_SIDE; i++) { |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 6229 | hda_nid_t nid = spec->autocfg.line_out_pins[i]; |
Takashi Iwai | baba8ee | 2007-04-23 17:17:48 +0200 | [diff] [blame] | 6230 | int pin_type = get_pin_type(spec->autocfg.line_out_type); |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 6231 | if (nid) |
Takashi Iwai | baba8ee | 2007-04-23 17:17:48 +0200 | [diff] [blame] | 6232 | alc882_auto_set_output_and_unmute(codec, nid, pin_type, |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 6233 | i); |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 6234 | } |
| 6235 | } |
| 6236 | |
| 6237 | static void alc882_auto_init_hp_out(struct hda_codec *codec) |
| 6238 | { |
| 6239 | struct alc_spec *spec = codec->spec; |
| 6240 | hda_nid_t pin; |
| 6241 | |
Takashi Iwai | eb06ed8 | 2006-09-20 17:10:27 +0200 | [diff] [blame] | 6242 | pin = spec->autocfg.hp_pins[0]; |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 6243 | if (pin) /* connect to front */ |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 6244 | /* use dac 0 */ |
| 6245 | alc882_auto_set_output_and_unmute(codec, pin, PIN_HP, 0); |
Takashi Iwai | f6c7e54 | 2008-02-12 18:32:23 +0100 | [diff] [blame] | 6246 | pin = spec->autocfg.speaker_pins[0]; |
| 6247 | if (pin) |
| 6248 | alc882_auto_set_output_and_unmute(codec, pin, PIN_OUT, 0); |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 6249 | } |
| 6250 | |
| 6251 | #define alc882_is_input_pin(nid) alc880_is_input_pin(nid) |
| 6252 | #define ALC882_PIN_CD_NID ALC880_PIN_CD_NID |
| 6253 | |
| 6254 | static void alc882_auto_init_analog_input(struct hda_codec *codec) |
| 6255 | { |
| 6256 | struct alc_spec *spec = codec->spec; |
| 6257 | int i; |
| 6258 | |
| 6259 | for (i = 0; i < AUTO_PIN_LAST; i++) { |
| 6260 | hda_nid_t nid = spec->autocfg.input_pins[i]; |
Takashi Iwai | 7194cae | 2008-03-06 16:58:17 +0100 | [diff] [blame^] | 6261 | unsigned int vref; |
| 6262 | if (!nid) |
| 6263 | continue; |
| 6264 | vref = PIN_IN; |
| 6265 | if (1 /*i <= AUTO_PIN_FRONT_MIC*/) { |
| 6266 | if (snd_hda_param_read(codec, nid, AC_PAR_PIN_CAP) & |
| 6267 | AC_PINCAP_VREF_80) |
| 6268 | vref = PIN_VREF80; |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 6269 | } |
Takashi Iwai | 7194cae | 2008-03-06 16:58:17 +0100 | [diff] [blame^] | 6270 | snd_hda_codec_write(codec, nid, 0, |
| 6271 | AC_VERB_SET_PIN_WIDGET_CONTROL, vref); |
| 6272 | if (get_wcaps(codec, nid) & AC_WCAP_OUT_AMP) |
| 6273 | snd_hda_codec_write(codec, nid, 0, |
| 6274 | AC_VERB_SET_AMP_GAIN_MUTE, |
| 6275 | AMP_OUT_MUTE); |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 6276 | } |
| 6277 | } |
| 6278 | |
Takashi Iwai | 776e184 | 2007-08-29 15:07:11 +0200 | [diff] [blame] | 6279 | /* add mic boosts if needed */ |
| 6280 | static int alc_auto_add_mic_boost(struct hda_codec *codec) |
| 6281 | { |
| 6282 | struct alc_spec *spec = codec->spec; |
| 6283 | int err; |
| 6284 | hda_nid_t nid; |
| 6285 | |
| 6286 | nid = spec->autocfg.input_pins[AUTO_PIN_MIC]; |
Takashi Iwai | ce22e03 | 2008-01-11 17:38:35 +0100 | [diff] [blame] | 6287 | if (nid && (get_wcaps(codec, nid) & AC_WCAP_IN_AMP)) { |
Takashi Iwai | 776e184 | 2007-08-29 15:07:11 +0200 | [diff] [blame] | 6288 | err = add_control(spec, ALC_CTL_WIDGET_VOL, |
| 6289 | "Mic Boost", |
| 6290 | HDA_COMPOSE_AMP_VAL(nid, 3, 0, HDA_INPUT)); |
| 6291 | if (err < 0) |
| 6292 | return err; |
| 6293 | } |
| 6294 | nid = spec->autocfg.input_pins[AUTO_PIN_FRONT_MIC]; |
Takashi Iwai | ce22e03 | 2008-01-11 17:38:35 +0100 | [diff] [blame] | 6295 | if (nid && (get_wcaps(codec, nid) & AC_WCAP_IN_AMP)) { |
Takashi Iwai | 776e184 | 2007-08-29 15:07:11 +0200 | [diff] [blame] | 6296 | err = add_control(spec, ALC_CTL_WIDGET_VOL, |
| 6297 | "Front Mic Boost", |
| 6298 | HDA_COMPOSE_AMP_VAL(nid, 3, 0, HDA_INPUT)); |
| 6299 | if (err < 0) |
| 6300 | return err; |
| 6301 | } |
| 6302 | return 0; |
| 6303 | } |
| 6304 | |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 6305 | /* almost identical with ALC880 parser... */ |
| 6306 | static int alc882_parse_auto_config(struct hda_codec *codec) |
| 6307 | { |
| 6308 | struct alc_spec *spec = codec->spec; |
| 6309 | int err = alc880_parse_auto_config(codec); |
| 6310 | |
| 6311 | if (err < 0) |
| 6312 | return err; |
Takashi Iwai | 776e184 | 2007-08-29 15:07:11 +0200 | [diff] [blame] | 6313 | else if (!err) |
| 6314 | return 0; /* no config found */ |
| 6315 | |
| 6316 | err = alc_auto_add_mic_boost(codec); |
| 6317 | if (err < 0) |
| 6318 | return err; |
| 6319 | |
| 6320 | /* hack - override the init verbs */ |
| 6321 | spec->init_verbs[0] = alc882_auto_init_verbs; |
| 6322 | |
| 6323 | return 1; /* config found */ |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 6324 | } |
| 6325 | |
Takashi Iwai | ae6b813 | 2006-03-03 16:47:17 +0100 | [diff] [blame] | 6326 | /* additional initialization for auto-configuration model */ |
| 6327 | static void alc882_auto_init(struct hda_codec *codec) |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 6328 | { |
Takashi Iwai | f6c7e54 | 2008-02-12 18:32:23 +0100 | [diff] [blame] | 6329 | struct alc_spec *spec = codec->spec; |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 6330 | alc882_auto_init_multi_out(codec); |
| 6331 | alc882_auto_init_hp_out(codec); |
| 6332 | alc882_auto_init_analog_input(codec); |
Takashi Iwai | f6c7e54 | 2008-02-12 18:32:23 +0100 | [diff] [blame] | 6333 | if (spec->unsol_event) |
| 6334 | alc_sku_automute(codec); |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 6335 | } |
| 6336 | |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 6337 | static int patch_alc882(struct hda_codec *codec) |
| 6338 | { |
| 6339 | struct alc_spec *spec; |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 6340 | int err, board_config; |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 6341 | |
Takashi Iwai | e560d8d | 2005-09-09 14:21:46 +0200 | [diff] [blame] | 6342 | spec = kzalloc(sizeof(*spec), GFP_KERNEL); |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 6343 | if (spec == NULL) |
| 6344 | return -ENOMEM; |
| 6345 | |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 6346 | codec->spec = spec; |
| 6347 | |
Takashi Iwai | f5fcc13 | 2006-11-24 17:07:44 +0100 | [diff] [blame] | 6348 | board_config = snd_hda_check_board_config(codec, ALC882_MODEL_LAST, |
| 6349 | alc882_models, |
| 6350 | alc882_cfg_tbl); |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 6351 | |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 6352 | if (board_config < 0 || board_config >= ALC882_MODEL_LAST) { |
Tobin Davis | 081d17c | 2007-02-15 17:46:18 +0100 | [diff] [blame] | 6353 | /* Pick up systems that don't supply PCI SSID */ |
| 6354 | switch (codec->subsystem_id) { |
| 6355 | case 0x106b0c00: /* Mac Pro */ |
| 6356 | board_config = ALC885_MACPRO; |
| 6357 | break; |
Nicola Fagnani | c54728d | 2007-07-19 23:28:52 +0200 | [diff] [blame] | 6358 | case 0x106b1000: /* iMac 24 */ |
| 6359 | board_config = ALC885_IMAC24; |
| 6360 | break; |
Jiang zhe | 3d5fa2e | 2008-01-10 13:05:47 +0100 | [diff] [blame] | 6361 | case 0x106b00a1: /* Macbook */ |
Takashi Iwai | 87350ad | 2007-08-16 18:19:38 +0200 | [diff] [blame] | 6362 | case 0x106b2c00: /* Macbook Pro rev3 */ |
| 6363 | board_config = ALC885_MBP3; |
| 6364 | break; |
Tobin Davis | 081d17c | 2007-02-15 17:46:18 +0100 | [diff] [blame] | 6365 | default: |
| 6366 | printk(KERN_INFO "hda_codec: Unknown model for ALC882, " |
| 6367 | "trying auto-probe from BIOS...\n"); |
| 6368 | board_config = ALC882_AUTO; |
| 6369 | } |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 6370 | } |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 6371 | |
Takashi Iwai | f95474e | 2007-07-10 00:47:43 +0200 | [diff] [blame] | 6372 | alc_fix_pincfg(codec, alc882_pinfix_tbl, alc882_pin_fixes); |
| 6373 | |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 6374 | if (board_config == ALC882_AUTO) { |
| 6375 | /* automatic parse from the BIOS config */ |
| 6376 | err = alc882_parse_auto_config(codec); |
| 6377 | if (err < 0) { |
| 6378 | alc_free(codec); |
| 6379 | return err; |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 6380 | } else if (!err) { |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 6381 | printk(KERN_INFO |
| 6382 | "hda_codec: Cannot set up configuration " |
| 6383 | "from BIOS. Using base mode...\n"); |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 6384 | board_config = ALC882_3ST_DIG; |
| 6385 | } |
| 6386 | } |
| 6387 | |
| 6388 | if (board_config != ALC882_AUTO) |
| 6389 | setup_preset(spec, &alc882_presets[board_config]); |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 6390 | |
| 6391 | spec->stream_name_analog = "ALC882 Analog"; |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 6392 | spec->stream_analog_playback = &alc882_pcm_analog_playback; |
| 6393 | spec->stream_analog_capture = &alc882_pcm_analog_capture; |
Takashi Iwai | 6330079 | 2008-01-24 15:31:36 +0100 | [diff] [blame] | 6394 | /* FIXME: setup DAC5 */ |
| 6395 | /*spec->stream_analog_alt_playback = &alc880_pcm_analog_alt_playback;*/ |
| 6396 | spec->stream_analog_alt_capture = &alc880_pcm_analog_alt_capture; |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 6397 | |
| 6398 | spec->stream_name_digital = "ALC882 Digital"; |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 6399 | spec->stream_digital_playback = &alc882_pcm_digital_playback; |
| 6400 | spec->stream_digital_capture = &alc882_pcm_digital_capture; |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 6401 | |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 6402 | if (!spec->adc_nids && spec->input_mux) { |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 6403 | /* check whether NID 0x07 is valid */ |
Takashi Iwai | 4a471b7 | 2005-12-07 13:56:29 +0100 | [diff] [blame] | 6404 | unsigned int wcap = get_wcaps(codec, 0x07); |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 6405 | /* get type */ |
| 6406 | wcap = (wcap & AC_WCAP_TYPE) >> AC_WCAP_TYPE_SHIFT; |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 6407 | if (wcap != AC_WID_AUD_IN) { |
| 6408 | spec->adc_nids = alc882_adc_nids_alt; |
| 6409 | spec->num_adc_nids = ARRAY_SIZE(alc882_adc_nids_alt); |
Takashi Iwai | e140634 | 2008-02-11 18:32:32 +0100 | [diff] [blame] | 6410 | spec->capsrc_nids = alc882_capsrc_nids_alt; |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 6411 | spec->mixers[spec->num_mixers] = |
| 6412 | alc882_capture_alt_mixer; |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 6413 | spec->num_mixers++; |
| 6414 | } else { |
| 6415 | spec->adc_nids = alc882_adc_nids; |
| 6416 | spec->num_adc_nids = ARRAY_SIZE(alc882_adc_nids); |
Takashi Iwai | e140634 | 2008-02-11 18:32:32 +0100 | [diff] [blame] | 6417 | spec->capsrc_nids = alc882_capsrc_nids; |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 6418 | spec->mixers[spec->num_mixers] = alc882_capture_mixer; |
| 6419 | spec->num_mixers++; |
| 6420 | } |
| 6421 | } |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 6422 | |
Takashi Iwai | 2134ea4 | 2008-01-10 16:53:55 +0100 | [diff] [blame] | 6423 | spec->vmaster_nid = 0x0c; |
| 6424 | |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 6425 | codec->patch_ops = alc_patch_ops; |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 6426 | if (board_config == ALC882_AUTO) |
Takashi Iwai | ae6b813 | 2006-03-03 16:47:17 +0100 | [diff] [blame] | 6427 | spec->init_hook = alc882_auto_init; |
Takashi Iwai | cb53c62 | 2007-08-10 17:21:45 +0200 | [diff] [blame] | 6428 | #ifdef CONFIG_SND_HDA_POWER_SAVE |
| 6429 | if (!spec->loopback.amplist) |
| 6430 | spec->loopback.amplist = alc882_loopbacks; |
| 6431 | #endif |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 6432 | |
| 6433 | return 0; |
| 6434 | } |
| 6435 | |
| 6436 | /* |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 6437 | * ALC883 support |
| 6438 | * |
| 6439 | * ALC883 is almost identical with ALC880 but has cleaner and more flexible |
| 6440 | * configuration. Each pin widget can choose any input DACs and a mixer. |
| 6441 | * Each ADC is connected from a mixer of all inputs. This makes possible |
| 6442 | * 6-channel independent captures. |
| 6443 | * |
| 6444 | * In addition, an independent DAC for the multi-playback (not used in this |
| 6445 | * driver yet). |
| 6446 | */ |
| 6447 | #define ALC883_DIGOUT_NID 0x06 |
| 6448 | #define ALC883_DIGIN_NID 0x0a |
| 6449 | |
| 6450 | static hda_nid_t alc883_dac_nids[4] = { |
| 6451 | /* front, rear, clfe, rear_surr */ |
| 6452 | 0x02, 0x04, 0x03, 0x05 |
| 6453 | }; |
| 6454 | |
| 6455 | static hda_nid_t alc883_adc_nids[2] = { |
| 6456 | /* ADC1-2 */ |
| 6457 | 0x08, 0x09, |
| 6458 | }; |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 6459 | |
Takashi Iwai | e140634 | 2008-02-11 18:32:32 +0100 | [diff] [blame] | 6460 | static hda_nid_t alc883_capsrc_nids[2] = { 0x23, 0x22 }; |
| 6461 | |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 6462 | /* input MUX */ |
| 6463 | /* FIXME: should be a matrix-type input source selection */ |
| 6464 | |
| 6465 | static struct hda_input_mux alc883_capture_source = { |
| 6466 | .num_items = 4, |
| 6467 | .items = { |
| 6468 | { "Mic", 0x0 }, |
| 6469 | { "Front Mic", 0x1 }, |
| 6470 | { "Line", 0x2 }, |
| 6471 | { "CD", 0x4 }, |
| 6472 | }, |
| 6473 | }; |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 6474 | |
| 6475 | static struct hda_input_mux alc883_lenovo_101e_capture_source = { |
| 6476 | .num_items = 2, |
| 6477 | .items = { |
| 6478 | { "Mic", 0x1 }, |
| 6479 | { "Line", 0x2 }, |
| 6480 | }, |
| 6481 | }; |
| 6482 | |
Kailang Yang | 272a527 | 2007-05-14 11:00:38 +0200 | [diff] [blame] | 6483 | static struct hda_input_mux alc883_lenovo_nb0763_capture_source = { |
| 6484 | .num_items = 4, |
| 6485 | .items = { |
| 6486 | { "Mic", 0x0 }, |
| 6487 | { "iMic", 0x1 }, |
| 6488 | { "Line", 0x2 }, |
| 6489 | { "CD", 0x4 }, |
| 6490 | }, |
| 6491 | }; |
| 6492 | |
Jiang zhe | fb97dc6 | 2008-03-06 11:07:11 +0100 | [diff] [blame] | 6493 | static struct hda_input_mux alc883_fujitsu_pi2515_capture_source = { |
| 6494 | .num_items = 2, |
| 6495 | .items = { |
| 6496 | { "Mic", 0x0 }, |
| 6497 | { "Int Mic", 0x1 }, |
| 6498 | }, |
| 6499 | }; |
| 6500 | |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 6501 | #define alc883_mux_enum_info alc_mux_enum_info |
| 6502 | #define alc883_mux_enum_get alc_mux_enum_get |
Takashi Iwai | e140634 | 2008-02-11 18:32:32 +0100 | [diff] [blame] | 6503 | /* ALC883 has the ALC882-type input selection */ |
| 6504 | #define alc883_mux_enum_put alc882_mux_enum_put |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 6505 | |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 6506 | /* |
| 6507 | * 2ch mode |
| 6508 | */ |
| 6509 | static struct hda_channel_mode alc883_3ST_2ch_modes[1] = { |
| 6510 | { 2, NULL } |
| 6511 | }; |
| 6512 | |
| 6513 | /* |
| 6514 | * 2ch mode |
| 6515 | */ |
| 6516 | static struct hda_verb alc883_3ST_ch2_init[] = { |
| 6517 | { 0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80 }, |
| 6518 | { 0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE }, |
| 6519 | { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN }, |
| 6520 | { 0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE }, |
| 6521 | { } /* end */ |
| 6522 | }; |
| 6523 | |
| 6524 | /* |
Tobin Davis | b201131 | 2007-09-17 12:45:11 +0200 | [diff] [blame] | 6525 | * 4ch mode |
| 6526 | */ |
| 6527 | static struct hda_verb alc883_3ST_ch4_init[] = { |
| 6528 | { 0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80 }, |
| 6529 | { 0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE }, |
| 6530 | { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, |
| 6531 | { 0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE }, |
| 6532 | { 0x1a, AC_VERB_SET_CONNECT_SEL, 0x01 }, |
| 6533 | { } /* end */ |
| 6534 | }; |
| 6535 | |
| 6536 | /* |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 6537 | * 6ch mode |
| 6538 | */ |
| 6539 | static struct hda_verb alc883_3ST_ch6_init[] = { |
| 6540 | { 0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, |
| 6541 | { 0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE }, |
| 6542 | { 0x18, AC_VERB_SET_CONNECT_SEL, 0x02 }, |
| 6543 | { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, |
| 6544 | { 0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE }, |
| 6545 | { 0x1a, AC_VERB_SET_CONNECT_SEL, 0x01 }, |
| 6546 | { } /* end */ |
| 6547 | }; |
| 6548 | |
Tobin Davis | b201131 | 2007-09-17 12:45:11 +0200 | [diff] [blame] | 6549 | static struct hda_channel_mode alc883_3ST_6ch_modes[3] = { |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 6550 | { 2, alc883_3ST_ch2_init }, |
Tobin Davis | b201131 | 2007-09-17 12:45:11 +0200 | [diff] [blame] | 6551 | { 4, alc883_3ST_ch4_init }, |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 6552 | { 6, alc883_3ST_ch6_init }, |
| 6553 | }; |
| 6554 | |
| 6555 | /* |
| 6556 | * 6ch mode |
| 6557 | */ |
| 6558 | static struct hda_verb alc883_sixstack_ch6_init[] = { |
| 6559 | { 0x17, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x00 }, |
| 6560 | { 0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, |
| 6561 | { 0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, |
| 6562 | { 0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, |
| 6563 | { } /* end */ |
| 6564 | }; |
| 6565 | |
| 6566 | /* |
| 6567 | * 8ch mode |
| 6568 | */ |
| 6569 | static struct hda_verb alc883_sixstack_ch8_init[] = { |
| 6570 | { 0x17, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, |
| 6571 | { 0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, |
| 6572 | { 0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, |
| 6573 | { 0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, |
| 6574 | { } /* end */ |
| 6575 | }; |
| 6576 | |
| 6577 | static struct hda_channel_mode alc883_sixstack_modes[2] = { |
| 6578 | { 6, alc883_sixstack_ch6_init }, |
| 6579 | { 8, alc883_sixstack_ch8_init }, |
| 6580 | }; |
| 6581 | |
Andrew L. Neporada | b373bde | 2006-11-07 11:37:08 +0100 | [diff] [blame] | 6582 | static struct hda_verb alc883_medion_eapd_verbs[] = { |
| 6583 | /* eanable EAPD on medion laptop */ |
| 6584 | {0x20, AC_VERB_SET_COEF_INDEX, 0x07}, |
| 6585 | {0x20, AC_VERB_SET_PROC_COEF, 0x3070}, |
| 6586 | { } |
| 6587 | }; |
| 6588 | |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 6589 | /* Pin assignment: Front=0x14, Rear=0x15, CLFE=0x16, Side=0x17 |
| 6590 | * Mic=0x18, Front Mic=0x19, Line-In=0x1a, HP=0x1b |
| 6591 | */ |
| 6592 | |
| 6593 | static struct snd_kcontrol_new alc883_base_mixer[] = { |
| 6594 | HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT), |
| 6595 | HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT), |
| 6596 | HDA_CODEC_VOLUME("Surround Playback Volume", 0x0d, 0x0, HDA_OUTPUT), |
| 6597 | HDA_BIND_MUTE("Surround Playback Switch", 0x0d, 2, HDA_INPUT), |
| 6598 | HDA_CODEC_VOLUME_MONO("Center Playback Volume", 0x0e, 1, 0x0, HDA_OUTPUT), |
| 6599 | HDA_CODEC_VOLUME_MONO("LFE Playback Volume", 0x0e, 2, 0x0, HDA_OUTPUT), |
| 6600 | HDA_BIND_MUTE_MONO("Center Playback Switch", 0x0e, 1, 2, HDA_INPUT), |
| 6601 | HDA_BIND_MUTE_MONO("LFE Playback Switch", 0x0e, 2, 2, HDA_INPUT), |
| 6602 | HDA_CODEC_VOLUME("Side Playback Volume", 0x0f, 0x0, HDA_OUTPUT), |
| 6603 | HDA_BIND_MUTE("Side Playback Switch", 0x0f, 2, HDA_INPUT), |
| 6604 | HDA_CODEC_MUTE("Headphone Playback Switch", 0x1b, 0x0, HDA_OUTPUT), |
| 6605 | HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT), |
| 6606 | HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT), |
| 6607 | HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT), |
| 6608 | HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT), |
| 6609 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), |
Thomas De Schampheleire | 3236041 | 2007-01-24 16:13:35 +0100 | [diff] [blame] | 6610 | HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT), |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 6611 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), |
| 6612 | HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x1, HDA_INPUT), |
Thomas De Schampheleire | 3236041 | 2007-01-24 16:13:35 +0100 | [diff] [blame] | 6613 | HDA_CODEC_VOLUME("Front Mic Boost", 0x19, 0, HDA_INPUT), |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 6614 | HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x1, HDA_INPUT), |
| 6615 | HDA_CODEC_VOLUME("PC Speaker Playback Volume", 0x0b, 0x05, HDA_INPUT), |
| 6616 | HDA_CODEC_MUTE("PC Speaker Playback Switch", 0x0b, 0x05, HDA_INPUT), |
| 6617 | HDA_CODEC_VOLUME("Capture Volume", 0x08, 0x0, HDA_INPUT), |
| 6618 | HDA_CODEC_MUTE("Capture Switch", 0x08, 0x0, HDA_INPUT), |
| 6619 | HDA_CODEC_VOLUME_IDX("Capture Volume", 1, 0x09, 0x0, HDA_INPUT), |
| 6620 | HDA_CODEC_MUTE_IDX("Capture Switch", 1, 0x09, 0x0, HDA_INPUT), |
| 6621 | { |
| 6622 | .iface = SNDRV_CTL_ELEM_IFACE_MIXER, |
| 6623 | /* .name = "Capture Source", */ |
| 6624 | .name = "Input Source", |
| 6625 | .count = 2, |
| 6626 | .info = alc883_mux_enum_info, |
| 6627 | .get = alc883_mux_enum_get, |
| 6628 | .put = alc883_mux_enum_put, |
| 6629 | }, |
| 6630 | { } /* end */ |
| 6631 | }; |
| 6632 | |
Andy Shevchenko | a8848bd | 2007-12-13 17:32:26 +0100 | [diff] [blame] | 6633 | static struct snd_kcontrol_new alc883_mitac_mixer[] = { |
| 6634 | HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT), |
| 6635 | HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT), |
| 6636 | HDA_CODEC_VOLUME_MONO("Center Playback Volume", 0x0e, 1, 0x0, HDA_OUTPUT), |
| 6637 | HDA_CODEC_VOLUME_MONO("LFE Playback Volume", 0x0e, 2, 0x0, HDA_OUTPUT), |
| 6638 | HDA_BIND_MUTE_MONO("Center Playback Switch", 0x0e, 1, 2, HDA_INPUT), |
| 6639 | HDA_BIND_MUTE_MONO("LFE Playback Switch", 0x0e, 2, 2, HDA_INPUT), |
| 6640 | HDA_CODEC_MUTE("Headphone Playback Switch", 0x15, 0x0, HDA_OUTPUT), |
| 6641 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), |
| 6642 | HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT), |
| 6643 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), |
| 6644 | HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x1, HDA_INPUT), |
| 6645 | HDA_CODEC_VOLUME("Front Mic Boost", 0x19, 0, HDA_INPUT), |
| 6646 | HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x1, HDA_INPUT), |
| 6647 | HDA_CODEC_VOLUME("Capture Volume", 0x08, 0x0, HDA_INPUT), |
| 6648 | HDA_CODEC_MUTE("Capture Switch", 0x08, 0x0, HDA_INPUT), |
| 6649 | HDA_CODEC_VOLUME_IDX("Capture Volume", 1, 0x09, 0x0, HDA_INPUT), |
| 6650 | HDA_CODEC_MUTE_IDX("Capture Switch", 1, 0x09, 0x0, HDA_INPUT), |
| 6651 | { |
| 6652 | .iface = SNDRV_CTL_ELEM_IFACE_MIXER, |
| 6653 | /* .name = "Capture Source", */ |
| 6654 | .name = "Input Source", |
| 6655 | .count = 2, |
| 6656 | .info = alc883_mux_enum_info, |
| 6657 | .get = alc883_mux_enum_get, |
| 6658 | .put = alc883_mux_enum_put, |
| 6659 | }, |
| 6660 | { } /* end */ |
| 6661 | }; |
| 6662 | |
Jiang zhe | 368c7a9 | 2008-03-04 11:20:33 +0100 | [diff] [blame] | 6663 | static struct snd_kcontrol_new alc883_clevo_m720r_mixer[] = { |
| 6664 | HDA_CODEC_VOLUME("Headphone Playback Volume", 0x0c, 0x0, HDA_OUTPUT), |
| 6665 | HDA_BIND_MUTE("Headphone Playback Switch", 0x0c, 2, HDA_INPUT), |
| 6666 | HDA_CODEC_VOLUME("Speaker Playback Volume", 0x0d, 0x0, HDA_OUTPUT), |
| 6667 | HDA_BIND_MUTE("Speaker Playback Switch", 0x0d, 2, HDA_INPUT), |
| 6668 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), |
| 6669 | HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT), |
| 6670 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), |
| 6671 | HDA_CODEC_VOLUME("Int Mic Playback Volume", 0x0b, 0x1, HDA_INPUT), |
| 6672 | HDA_CODEC_VOLUME("Int Mic Boost", 0x19, 0, HDA_INPUT), |
| 6673 | HDA_CODEC_MUTE("Int Mic Playback Switch", 0x0b, 0x1, HDA_INPUT), |
| 6674 | HDA_CODEC_VOLUME("Capture Volume", 0x08, 0x0, HDA_INPUT), |
| 6675 | HDA_CODEC_MUTE("Capture Switch", 0x08, 0x0, HDA_INPUT), |
| 6676 | HDA_CODEC_VOLUME_IDX("Capture Volume", 1, 0x09, 0x0, HDA_INPUT), |
| 6677 | HDA_CODEC_MUTE_IDX("Capture Switch", 1, 0x09, 0x0, HDA_INPUT), |
| 6678 | { |
| 6679 | .iface = SNDRV_CTL_ELEM_IFACE_MIXER, |
| 6680 | /* .name = "Capture Source", */ |
| 6681 | .name = "Input Source", |
| 6682 | .count = 2, |
| 6683 | .info = alc883_mux_enum_info, |
| 6684 | .get = alc883_mux_enum_get, |
| 6685 | .put = alc883_mux_enum_put, |
| 6686 | }, |
| 6687 | { } /* end */ |
| 6688 | }; |
| 6689 | |
Jiang zhe | fb97dc6 | 2008-03-06 11:07:11 +0100 | [diff] [blame] | 6690 | static struct snd_kcontrol_new alc883_2ch_fujitsu_pi2515_mixer[] = { |
| 6691 | HDA_CODEC_VOLUME("Headphone Playback Volume", 0x0c, 0x0, HDA_OUTPUT), |
| 6692 | HDA_BIND_MUTE("Headphone Playback Switch", 0x0c, 2, HDA_INPUT), |
| 6693 | HDA_CODEC_VOLUME("Speaker Playback Volume", 0x0d, 0x0, HDA_OUTPUT), |
| 6694 | HDA_BIND_MUTE("Speaker Playback Switch", 0x0d, 2, HDA_INPUT), |
| 6695 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), |
| 6696 | HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT), |
| 6697 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), |
| 6698 | HDA_CODEC_VOLUME("Int Mic Playback Volume", 0x0b, 0x1, HDA_INPUT), |
| 6699 | HDA_CODEC_VOLUME("Int Mic Boost", 0x19, 0, HDA_INPUT), |
| 6700 | HDA_CODEC_MUTE("Int Mic Playback Switch", 0x0b, 0x1, HDA_INPUT), |
| 6701 | HDA_CODEC_VOLUME("Capture Volume", 0x08, 0x0, HDA_INPUT), |
| 6702 | HDA_CODEC_MUTE("Capture Switch", 0x08, 0x0, HDA_INPUT), |
| 6703 | HDA_CODEC_VOLUME_IDX("Capture Volume", 1, 0x09, 0x0, HDA_INPUT), |
| 6704 | HDA_CODEC_MUTE_IDX("Capture Switch", 1, 0x09, 0x0, HDA_INPUT), |
| 6705 | { |
| 6706 | .iface = SNDRV_CTL_ELEM_IFACE_MIXER, |
| 6707 | /* .name = "Capture Source", */ |
| 6708 | .name = "Input Source", |
| 6709 | .count = 2, |
| 6710 | .info = alc883_mux_enum_info, |
| 6711 | .get = alc883_mux_enum_get, |
| 6712 | .put = alc883_mux_enum_put, |
| 6713 | }, |
| 6714 | { } /* end */ |
| 6715 | }; |
| 6716 | |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 6717 | static struct snd_kcontrol_new alc883_3ST_2ch_mixer[] = { |
| 6718 | HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT), |
| 6719 | HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT), |
| 6720 | HDA_CODEC_MUTE("Headphone Playback Switch", 0x1b, 0x0, HDA_OUTPUT), |
| 6721 | HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT), |
| 6722 | HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT), |
| 6723 | HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT), |
| 6724 | HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT), |
| 6725 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), |
Thomas De Schampheleire | 3236041 | 2007-01-24 16:13:35 +0100 | [diff] [blame] | 6726 | HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT), |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 6727 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), |
| 6728 | HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x1, HDA_INPUT), |
Thomas De Schampheleire | 3236041 | 2007-01-24 16:13:35 +0100 | [diff] [blame] | 6729 | HDA_CODEC_VOLUME("Front Mic Boost", 0x19, 0, HDA_INPUT), |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 6730 | HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x1, HDA_INPUT), |
| 6731 | HDA_CODEC_VOLUME("PC Speaker Playback Volume", 0x0b, 0x05, HDA_INPUT), |
| 6732 | HDA_CODEC_MUTE("PC Speaker Playback Switch", 0x0b, 0x05, HDA_INPUT), |
| 6733 | HDA_CODEC_VOLUME("Capture Volume", 0x08, 0x0, HDA_INPUT), |
| 6734 | HDA_CODEC_MUTE("Capture Switch", 0x08, 0x0, HDA_INPUT), |
| 6735 | HDA_CODEC_VOLUME_IDX("Capture Volume", 1, 0x09, 0x0, HDA_INPUT), |
| 6736 | HDA_CODEC_MUTE_IDX("Capture Switch", 1, 0x09, 0x0, HDA_INPUT), |
| 6737 | { |
| 6738 | .iface = SNDRV_CTL_ELEM_IFACE_MIXER, |
| 6739 | /* .name = "Capture Source", */ |
| 6740 | .name = "Input Source", |
| 6741 | .count = 2, |
| 6742 | .info = alc883_mux_enum_info, |
| 6743 | .get = alc883_mux_enum_get, |
| 6744 | .put = alc883_mux_enum_put, |
| 6745 | }, |
| 6746 | { } /* end */ |
| 6747 | }; |
| 6748 | |
| 6749 | static struct snd_kcontrol_new alc883_3ST_6ch_mixer[] = { |
| 6750 | HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT), |
| 6751 | HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT), |
| 6752 | HDA_CODEC_VOLUME("Surround Playback Volume", 0x0d, 0x0, HDA_OUTPUT), |
| 6753 | HDA_BIND_MUTE("Surround Playback Switch", 0x0d, 2, HDA_INPUT), |
| 6754 | HDA_CODEC_VOLUME_MONO("Center Playback Volume", 0x0e, 1, 0x0, HDA_OUTPUT), |
| 6755 | HDA_CODEC_VOLUME_MONO("LFE Playback Volume", 0x0e, 2, 0x0, HDA_OUTPUT), |
| 6756 | HDA_BIND_MUTE_MONO("Center Playback Switch", 0x0e, 1, 2, HDA_INPUT), |
| 6757 | HDA_BIND_MUTE_MONO("LFE Playback Switch", 0x0e, 2, 2, HDA_INPUT), |
| 6758 | HDA_CODEC_MUTE("Headphone Playback Switch", 0x1b, 0x0, HDA_OUTPUT), |
| 6759 | HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT), |
| 6760 | HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT), |
| 6761 | HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT), |
| 6762 | HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT), |
| 6763 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), |
Thomas De Schampheleire | 3236041 | 2007-01-24 16:13:35 +0100 | [diff] [blame] | 6764 | HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT), |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 6765 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), |
| 6766 | HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x1, HDA_INPUT), |
Thomas De Schampheleire | 3236041 | 2007-01-24 16:13:35 +0100 | [diff] [blame] | 6767 | HDA_CODEC_VOLUME("Front Mic Boost", 0x19, 0, HDA_INPUT), |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 6768 | HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x1, HDA_INPUT), |
| 6769 | HDA_CODEC_VOLUME("PC Speaker Playback Volume", 0x0b, 0x05, HDA_INPUT), |
| 6770 | HDA_CODEC_MUTE("PC Speaker Playback Switch", 0x0b, 0x05, HDA_INPUT), |
| 6771 | HDA_CODEC_VOLUME("Capture Volume", 0x08, 0x0, HDA_INPUT), |
| 6772 | HDA_CODEC_MUTE("Capture Switch", 0x08, 0x0, HDA_INPUT), |
| 6773 | HDA_CODEC_VOLUME_IDX("Capture Volume", 1, 0x09, 0x0, HDA_INPUT), |
| 6774 | HDA_CODEC_MUTE_IDX("Capture Switch", 1, 0x09, 0x0, HDA_INPUT), |
| 6775 | { |
| 6776 | .iface = SNDRV_CTL_ELEM_IFACE_MIXER, |
| 6777 | /* .name = "Capture Source", */ |
| 6778 | .name = "Input Source", |
| 6779 | .count = 2, |
| 6780 | .info = alc883_mux_enum_info, |
| 6781 | .get = alc883_mux_enum_get, |
| 6782 | .put = alc883_mux_enum_put, |
| 6783 | }, |
| 6784 | { } /* end */ |
| 6785 | }; |
| 6786 | |
Takashi Iwai | d1d985f | 2006-11-23 19:27:12 +0100 | [diff] [blame] | 6787 | static struct snd_kcontrol_new alc883_fivestack_mixer[] = { |
Tobin Davis | c07584c | 2006-10-13 12:32:16 +0200 | [diff] [blame] | 6788 | HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT), |
| 6789 | HDA_CODEC_MUTE("Front Playback Switch", 0x14, 0x0, HDA_OUTPUT), |
| 6790 | HDA_CODEC_VOLUME("Surround Playback Volume", 0x0d, 0x0, HDA_OUTPUT), |
| 6791 | HDA_CODEC_MUTE("Surround Playback Switch", 0x15, 0x0, HDA_OUTPUT), |
| 6792 | HDA_CODEC_VOLUME_MONO("Center Playback Volume", 0x0e, 1, 0x0, HDA_OUTPUT), |
| 6793 | HDA_CODEC_VOLUME_MONO("LFE Playback Volume", 0x0e, 2, 0x0, HDA_OUTPUT), |
| 6794 | HDA_CODEC_MUTE_MONO("Center Playback Switch", 0x16, 1, 0x0, HDA_OUTPUT), |
| 6795 | HDA_CODEC_MUTE_MONO("LFE Playback Switch", 0x16, 2, 0x0, HDA_OUTPUT), |
| 6796 | HDA_CODEC_MUTE("Headphone Playback Switch", 0x1b, 0x0, HDA_OUTPUT), |
| 6797 | HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT), |
| 6798 | HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT), |
| 6799 | HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT), |
| 6800 | HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT), |
| 6801 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), |
Thomas De Schampheleire | 3236041 | 2007-01-24 16:13:35 +0100 | [diff] [blame] | 6802 | HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT), |
Tobin Davis | c07584c | 2006-10-13 12:32:16 +0200 | [diff] [blame] | 6803 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), |
| 6804 | HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x1, HDA_INPUT), |
Thomas De Schampheleire | 3236041 | 2007-01-24 16:13:35 +0100 | [diff] [blame] | 6805 | HDA_CODEC_VOLUME("Front Mic Boost", 0x19, 0, HDA_INPUT), |
Tobin Davis | c07584c | 2006-10-13 12:32:16 +0200 | [diff] [blame] | 6806 | HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x1, HDA_INPUT), |
| 6807 | HDA_CODEC_VOLUME("PC Speaker Playback Volume", 0x0b, 0x05, HDA_INPUT), |
| 6808 | HDA_CODEC_MUTE("PC Speaker Playback Switch", 0x0b, 0x05, HDA_INPUT), |
| 6809 | HDA_CODEC_VOLUME("Capture Volume", 0x08, 0x0, HDA_INPUT), |
| 6810 | HDA_CODEC_MUTE("Capture Switch", 0x08, 0x0, HDA_INPUT), |
| 6811 | |
| 6812 | { |
| 6813 | .iface = SNDRV_CTL_ELEM_IFACE_MIXER, |
| 6814 | /* .name = "Capture Source", */ |
| 6815 | .name = "Input Source", |
| 6816 | .count = 1, |
| 6817 | .info = alc883_mux_enum_info, |
| 6818 | .get = alc883_mux_enum_get, |
| 6819 | .put = alc883_mux_enum_put, |
| 6820 | }, |
| 6821 | { } /* end */ |
| 6822 | }; |
| 6823 | |
Kailang Yang | ccc656c | 2006-10-17 12:32:26 +0200 | [diff] [blame] | 6824 | static struct snd_kcontrol_new alc883_tagra_mixer[] = { |
| 6825 | HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT), |
| 6826 | HDA_CODEC_MUTE("Headphone Playback Switch", 0x14, 0x0, HDA_OUTPUT), |
| 6827 | HDA_CODEC_MUTE("Front Playback Switch", 0x1b, 0x0, HDA_OUTPUT), |
| 6828 | HDA_CODEC_VOLUME("Surround Playback Volume", 0x0d, 0x0, HDA_OUTPUT), |
| 6829 | HDA_BIND_MUTE("Surround Playback Switch", 0x0d, 2, HDA_INPUT), |
| 6830 | HDA_CODEC_VOLUME_MONO("Center Playback Volume", 0x0e, 1, 0x0, HDA_OUTPUT), |
| 6831 | HDA_CODEC_VOLUME_MONO("LFE Playback Volume", 0x0e, 2, 0x0, HDA_OUTPUT), |
| 6832 | HDA_BIND_MUTE_MONO("Center Playback Switch", 0x0e, 1, 2, HDA_INPUT), |
| 6833 | HDA_BIND_MUTE_MONO("LFE Playback Switch", 0x0e, 2, 2, HDA_INPUT), |
| 6834 | HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT), |
| 6835 | HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT), |
| 6836 | HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT), |
| 6837 | HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT), |
| 6838 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), |
Thomas De Schampheleire | 3236041 | 2007-01-24 16:13:35 +0100 | [diff] [blame] | 6839 | HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT), |
Kailang Yang | ccc656c | 2006-10-17 12:32:26 +0200 | [diff] [blame] | 6840 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), |
| 6841 | HDA_CODEC_VOLUME("Capture Volume", 0x08, 0x0, HDA_INPUT), |
| 6842 | HDA_CODEC_MUTE("Capture Switch", 0x08, 0x0, HDA_INPUT), |
| 6843 | HDA_CODEC_VOLUME_IDX("Capture Volume", 1, 0x09, 0x0, HDA_INPUT), |
| 6844 | HDA_CODEC_MUTE_IDX("Capture Switch", 1, 0x09, 0x0, HDA_INPUT), |
| 6845 | { |
| 6846 | .iface = SNDRV_CTL_ELEM_IFACE_MIXER, |
| 6847 | /* .name = "Capture Source", */ |
| 6848 | .name = "Input Source", |
| 6849 | .count = 2, |
| 6850 | .info = alc883_mux_enum_info, |
| 6851 | .get = alc883_mux_enum_get, |
| 6852 | .put = alc883_mux_enum_put, |
| 6853 | }, |
| 6854 | { } /* end */ |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 6855 | }; |
Kailang Yang | ccc656c | 2006-10-17 12:32:26 +0200 | [diff] [blame] | 6856 | |
| 6857 | static struct snd_kcontrol_new alc883_tagra_2ch_mixer[] = { |
| 6858 | HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT), |
| 6859 | HDA_CODEC_MUTE("Headphone Playback Switch", 0x14, 0x0, HDA_OUTPUT), |
| 6860 | HDA_CODEC_MUTE("Front Playback Switch", 0x1b, 0x0, HDA_OUTPUT), |
| 6861 | HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT), |
| 6862 | HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT), |
| 6863 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), |
Thomas De Schampheleire | 3236041 | 2007-01-24 16:13:35 +0100 | [diff] [blame] | 6864 | HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT), |
Kailang Yang | ccc656c | 2006-10-17 12:32:26 +0200 | [diff] [blame] | 6865 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), |
| 6866 | HDA_CODEC_VOLUME("Capture Volume", 0x08, 0x0, HDA_INPUT), |
| 6867 | HDA_CODEC_MUTE("Capture Switch", 0x08, 0x0, HDA_INPUT), |
| 6868 | HDA_CODEC_VOLUME_IDX("Capture Volume", 1, 0x09, 0x0, HDA_INPUT), |
| 6869 | HDA_CODEC_MUTE_IDX("Capture Switch", 1, 0x09, 0x0, HDA_INPUT), |
| 6870 | { |
| 6871 | .iface = SNDRV_CTL_ELEM_IFACE_MIXER, |
| 6872 | /* .name = "Capture Source", */ |
| 6873 | .name = "Input Source", |
| 6874 | .count = 2, |
| 6875 | .info = alc883_mux_enum_info, |
| 6876 | .get = alc883_mux_enum_get, |
| 6877 | .put = alc883_mux_enum_put, |
| 6878 | }, |
| 6879 | { } /* end */ |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 6880 | }; |
Kailang Yang | ccc656c | 2006-10-17 12:32:26 +0200 | [diff] [blame] | 6881 | |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 6882 | static struct snd_kcontrol_new alc883_lenovo_101e_2ch_mixer[] = { |
| 6883 | HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT), |
| 6884 | HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT), |
Takashi Iwai | 86cd929 | 2008-01-28 18:09:56 +0100 | [diff] [blame] | 6885 | HDA_CODEC_VOLUME("Speaker Playback Volume", 0x0d, 0x0, HDA_OUTPUT), |
| 6886 | HDA_BIND_MUTE("Speaker Playback Switch", 0x0d, 2, HDA_INPUT), |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 6887 | HDA_CODEC_MUTE("Headphone Playback Switch", 0x1b, 0x0, HDA_OUTPUT), |
| 6888 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x1, HDA_INPUT), |
| 6889 | HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT), |
| 6890 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x1, HDA_INPUT), |
| 6891 | HDA_CODEC_VOLUME("Capture Volume", 0x08, 0x0, HDA_INPUT), |
| 6892 | HDA_CODEC_MUTE("Capture Switch", 0x08, 0x0, HDA_INPUT), |
| 6893 | { |
| 6894 | .iface = SNDRV_CTL_ELEM_IFACE_MIXER, |
| 6895 | /* .name = "Capture Source", */ |
| 6896 | .name = "Input Source", |
| 6897 | .count = 1, |
| 6898 | .info = alc883_mux_enum_info, |
| 6899 | .get = alc883_mux_enum_get, |
| 6900 | .put = alc883_mux_enum_put, |
| 6901 | }, |
| 6902 | { } /* end */ |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 6903 | }; |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 6904 | |
Kailang Yang | 272a527 | 2007-05-14 11:00:38 +0200 | [diff] [blame] | 6905 | static struct snd_kcontrol_new alc883_lenovo_nb0763_mixer[] = { |
| 6906 | HDA_CODEC_VOLUME("Speaker Playback Volume", 0x0c, 0x0, HDA_OUTPUT), |
| 6907 | HDA_BIND_MUTE("Speaker Playback Switch", 0x0c, 2, HDA_INPUT), |
| 6908 | HDA_CODEC_MUTE("Headphone Playback Switch", 0x14, 0x0, HDA_OUTPUT), |
| 6909 | HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT), |
| 6910 | HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT), |
| 6911 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), |
| 6912 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), |
| 6913 | HDA_CODEC_VOLUME("iMic Playback Volume", 0x0b, 0x1, HDA_INPUT), |
| 6914 | HDA_CODEC_MUTE("iMic Playback Switch", 0x0b, 0x1, HDA_INPUT), |
| 6915 | HDA_CODEC_VOLUME("Capture Volume", 0x08, 0x0, HDA_INPUT), |
| 6916 | HDA_CODEC_MUTE("Capture Switch", 0x08, 0x0, HDA_INPUT), |
| 6917 | HDA_CODEC_VOLUME_IDX("Capture Volume", 1, 0x09, 0x0, HDA_INPUT), |
| 6918 | HDA_CODEC_MUTE_IDX("Capture Switch", 1, 0x09, 0x0, HDA_INPUT), |
| 6919 | { |
| 6920 | .iface = SNDRV_CTL_ELEM_IFACE_MIXER, |
| 6921 | /* .name = "Capture Source", */ |
| 6922 | .name = "Input Source", |
| 6923 | .count = 2, |
| 6924 | .info = alc883_mux_enum_info, |
| 6925 | .get = alc883_mux_enum_get, |
| 6926 | .put = alc883_mux_enum_put, |
| 6927 | }, |
| 6928 | { } /* end */ |
| 6929 | }; |
| 6930 | |
| 6931 | static struct snd_kcontrol_new alc883_medion_md2_mixer[] = { |
| 6932 | HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT), |
| 6933 | HDA_CODEC_MUTE("Headphone Playback Switch", 0x14, 0x0, HDA_OUTPUT), |
| 6934 | HDA_CODEC_MUTE("Front Playback Switch", 0x15, 0x0, HDA_OUTPUT), |
| 6935 | HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT), |
| 6936 | HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT), |
| 6937 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), |
| 6938 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), |
| 6939 | HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT), |
| 6940 | HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT), |
| 6941 | HDA_CODEC_VOLUME("Capture Volume", 0x08, 0x0, HDA_INPUT), |
| 6942 | HDA_CODEC_MUTE("Capture Switch", 0x08, 0x0, HDA_INPUT), |
| 6943 | HDA_CODEC_VOLUME_IDX("Capture Volume", 1, 0x09, 0x0, HDA_INPUT), |
| 6944 | HDA_CODEC_MUTE_IDX("Capture Switch", 1, 0x09, 0x0, HDA_INPUT), |
| 6945 | { |
| 6946 | .iface = SNDRV_CTL_ELEM_IFACE_MIXER, |
| 6947 | /* .name = "Capture Source", */ |
| 6948 | .name = "Input Source", |
| 6949 | .count = 2, |
| 6950 | .info = alc883_mux_enum_info, |
| 6951 | .get = alc883_mux_enum_get, |
| 6952 | .put = alc883_mux_enum_put, |
| 6953 | }, |
| 6954 | { } /* end */ |
| 6955 | }; |
| 6956 | |
Claudio Matsuoka | 4723c02 | 2007-07-13 14:36:19 +0200 | [diff] [blame] | 6957 | static struct snd_kcontrol_new alc888_6st_hp_mixer[] = { |
Claudio Matsuoka | cd1e3b4 | 2007-07-06 12:10:01 +0200 | [diff] [blame] | 6958 | HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT), |
| 6959 | HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT), |
| 6960 | HDA_CODEC_VOLUME("Surround Playback Volume", 0x0e, 0x0, HDA_OUTPUT), |
| 6961 | HDA_BIND_MUTE("Surround Playback Switch", 0x0e, 2, HDA_INPUT), |
| 6962 | HDA_CODEC_VOLUME_MONO("Center Playback Volume", 0x0d, 1, 0x0, HDA_OUTPUT), |
| 6963 | HDA_CODEC_VOLUME_MONO("LFE Playback Volume", 0x0d, 2, 0x0, HDA_OUTPUT), |
| 6964 | HDA_BIND_MUTE_MONO("Center Playback Switch", 0x0d, 1, 2, HDA_INPUT), |
| 6965 | HDA_BIND_MUTE_MONO("LFE Playback Switch", 0x0d, 2, 2, HDA_INPUT), |
| 6966 | HDA_CODEC_VOLUME("Side Playback Volume", 0x0f, 0x0, HDA_OUTPUT), |
| 6967 | HDA_BIND_MUTE("Side Playback Switch", 0x0f, 2, HDA_INPUT), |
| 6968 | HDA_CODEC_MUTE("Headphone Playback Switch", 0x1b, 0x0, HDA_OUTPUT), |
| 6969 | HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT), |
| 6970 | HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT), |
| 6971 | HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT), |
| 6972 | HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT), |
| 6973 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), |
| 6974 | HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT), |
| 6975 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), |
| 6976 | HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x1, HDA_INPUT), |
| 6977 | HDA_CODEC_VOLUME("Front Mic Boost", 0x19, 0, HDA_INPUT), |
| 6978 | HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x1, HDA_INPUT), |
| 6979 | HDA_CODEC_VOLUME("PC Speaker Playback Volume", 0x0b, 0x05, HDA_INPUT), |
| 6980 | HDA_CODEC_MUTE("PC Speaker Playback Switch", 0x0b, 0x05, HDA_INPUT), |
| 6981 | HDA_CODEC_VOLUME("Capture Volume", 0x08, 0x0, HDA_INPUT), |
| 6982 | HDA_CODEC_MUTE("Capture Switch", 0x08, 0x0, HDA_INPUT), |
| 6983 | HDA_CODEC_VOLUME_IDX("Capture Volume", 1, 0x09, 0x0, HDA_INPUT), |
| 6984 | HDA_CODEC_MUTE_IDX("Capture Switch", 1, 0x09, 0x0, HDA_INPUT), |
| 6985 | { |
| 6986 | .iface = SNDRV_CTL_ELEM_IFACE_MIXER, |
| 6987 | /* .name = "Capture Source", */ |
| 6988 | .name = "Input Source", |
| 6989 | .count = 2, |
| 6990 | .info = alc883_mux_enum_info, |
| 6991 | .get = alc883_mux_enum_get, |
| 6992 | .put = alc883_mux_enum_put, |
| 6993 | }, |
| 6994 | { } /* end */ |
| 6995 | }; |
| 6996 | |
Claudio Matsuoka | 4723c02 | 2007-07-13 14:36:19 +0200 | [diff] [blame] | 6997 | static struct snd_kcontrol_new alc888_3st_hp_mixer[] = { |
Claudio Matsuoka | 8341de6 | 2007-07-06 12:10:45 +0200 | [diff] [blame] | 6998 | HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT), |
| 6999 | HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT), |
| 7000 | HDA_CODEC_VOLUME("Surround Playback Volume", 0x0e, 0x0, HDA_OUTPUT), |
| 7001 | HDA_BIND_MUTE("Surround Playback Switch", 0x0e, 2, HDA_INPUT), |
| 7002 | HDA_CODEC_VOLUME_MONO("Center Playback Volume", 0x0d, 1, 0x0, HDA_OUTPUT), |
| 7003 | HDA_CODEC_VOLUME_MONO("LFE Playback Volume", 0x0d, 2, 0x0, HDA_OUTPUT), |
| 7004 | HDA_BIND_MUTE_MONO("Center Playback Switch", 0x0d, 1, 2, HDA_INPUT), |
| 7005 | HDA_BIND_MUTE_MONO("LFE Playback Switch", 0x0d, 2, 2, HDA_INPUT), |
| 7006 | HDA_CODEC_MUTE("Headphone Playback Switch", 0x1b, 0x0, HDA_OUTPUT), |
| 7007 | HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT), |
| 7008 | HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT), |
| 7009 | HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT), |
| 7010 | HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT), |
| 7011 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), |
| 7012 | HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT), |
| 7013 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), |
| 7014 | HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x1, HDA_INPUT), |
| 7015 | HDA_CODEC_VOLUME("Front Mic Boost", 0x19, 0, HDA_INPUT), |
| 7016 | HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x1, HDA_INPUT), |
| 7017 | HDA_CODEC_VOLUME("PC Speaker Playback Volume", 0x0b, 0x05, HDA_INPUT), |
| 7018 | HDA_CODEC_MUTE("PC Speaker Playback Switch", 0x0b, 0x05, HDA_INPUT), |
| 7019 | HDA_CODEC_VOLUME("Capture Volume", 0x08, 0x0, HDA_INPUT), |
| 7020 | HDA_CODEC_MUTE("Capture Switch", 0x08, 0x0, HDA_INPUT), |
| 7021 | HDA_CODEC_VOLUME_IDX("Capture Volume", 1, 0x09, 0x0, HDA_INPUT), |
| 7022 | HDA_CODEC_MUTE_IDX("Capture Switch", 1, 0x09, 0x0, HDA_INPUT), |
| 7023 | { |
| 7024 | .iface = SNDRV_CTL_ELEM_IFACE_MIXER, |
| 7025 | /* .name = "Capture Source", */ |
| 7026 | .name = "Input Source", |
| 7027 | .count = 2, |
| 7028 | .info = alc883_mux_enum_info, |
| 7029 | .get = alc883_mux_enum_get, |
| 7030 | .put = alc883_mux_enum_put, |
| 7031 | }, |
| 7032 | { } /* end */ |
| 7033 | }; |
| 7034 | |
Claudio Matsuoka | 5795b9e | 2008-01-13 11:58:27 +0100 | [diff] [blame] | 7035 | static struct snd_kcontrol_new alc888_6st_dell_mixer[] = { |
| 7036 | HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT), |
| 7037 | HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT), |
| 7038 | HDA_CODEC_VOLUME("Surround Playback Volume", 0x0e, 0x0, HDA_OUTPUT), |
| 7039 | HDA_BIND_MUTE("Surround Playback Switch", 0x0e, 2, HDA_INPUT), |
| 7040 | HDA_CODEC_VOLUME_MONO("Center Playback Volume", 0x0d, 1, 0x0, HDA_OUTPUT), |
| 7041 | HDA_CODEC_VOLUME_MONO("LFE Playback Volume", 0x0d, 2, 0x0, HDA_OUTPUT), |
| 7042 | HDA_BIND_MUTE_MONO("Center Playback Switch", 0x0d, 1, 2, HDA_INPUT), |
| 7043 | HDA_BIND_MUTE_MONO("LFE Playback Switch", 0x0d, 2, 2, HDA_INPUT), |
| 7044 | HDA_CODEC_VOLUME("Side Playback Volume", 0x0f, 0x0, HDA_OUTPUT), |
| 7045 | HDA_BIND_MUTE("Side Playback Switch", 0x0f, 2, HDA_INPUT), |
| 7046 | HDA_CODEC_MUTE("Headphone Playback Switch", 0x1b, 0x0, HDA_OUTPUT), |
| 7047 | HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT), |
| 7048 | HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT), |
| 7049 | HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT), |
| 7050 | HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT), |
| 7051 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), |
| 7052 | HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT), |
| 7053 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), |
| 7054 | HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x1, HDA_INPUT), |
| 7055 | HDA_CODEC_VOLUME("Front Mic Boost", 0x19, 0, HDA_INPUT), |
| 7056 | HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x1, HDA_INPUT), |
| 7057 | HDA_CODEC_VOLUME("PC Speaker Playback Volume", 0x0b, 0x05, HDA_INPUT), |
| 7058 | HDA_CODEC_MUTE("PC Speaker Playback Switch", 0x0b, 0x05, HDA_INPUT), |
| 7059 | HDA_CODEC_VOLUME("Capture Volume", 0x08, 0x0, HDA_INPUT), |
| 7060 | HDA_CODEC_MUTE("Capture Switch", 0x08, 0x0, HDA_INPUT), |
| 7061 | HDA_CODEC_VOLUME_IDX("Capture Volume", 1, 0x09, 0x0, HDA_INPUT), |
| 7062 | HDA_CODEC_MUTE_IDX("Capture Switch", 1, 0x09, 0x0, HDA_INPUT), |
| 7063 | { |
| 7064 | .iface = SNDRV_CTL_ELEM_IFACE_MIXER, |
| 7065 | /* .name = "Capture Source", */ |
| 7066 | .name = "Input Source", |
| 7067 | .count = 2, |
| 7068 | .info = alc883_mux_enum_info, |
| 7069 | .get = alc883_mux_enum_get, |
| 7070 | .put = alc883_mux_enum_put, |
| 7071 | }, |
| 7072 | { } /* end */ |
| 7073 | }; |
| 7074 | |
Tobin Davis | 2880a86 | 2007-08-07 11:50:26 +0200 | [diff] [blame] | 7075 | static struct snd_kcontrol_new alc883_acer_aspire_mixer[] = { |
Kailang Yang | d1a991a | 2007-08-15 16:21:59 +0200 | [diff] [blame] | 7076 | HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT), |
| 7077 | HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT), |
Tobin Davis | 2880a86 | 2007-08-07 11:50:26 +0200 | [diff] [blame] | 7078 | HDA_CODEC_MUTE("Headphone Playback Switch", 0x14, 0x0, HDA_OUTPUT), |
Tobin Davis | 2880a86 | 2007-08-07 11:50:26 +0200 | [diff] [blame] | 7079 | HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT), |
| 7080 | HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT), |
Kailang Yang | d1a991a | 2007-08-15 16:21:59 +0200 | [diff] [blame] | 7081 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), |
| 7082 | HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT), |
| 7083 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), |
Tobin Davis | 2880a86 | 2007-08-07 11:50:26 +0200 | [diff] [blame] | 7084 | HDA_CODEC_VOLUME("Capture Volume", 0x08, 0x0, HDA_INPUT), |
| 7085 | HDA_CODEC_MUTE("Capture Switch", 0x08, 0x0, HDA_INPUT), |
| 7086 | HDA_CODEC_VOLUME_IDX("Capture Volume", 1, 0x09, 0x0, HDA_INPUT), |
| 7087 | HDA_CODEC_MUTE_IDX("Capture Switch", 1, 0x09, 0x0, HDA_INPUT), |
| 7088 | { |
| 7089 | .iface = SNDRV_CTL_ELEM_IFACE_MIXER, |
| 7090 | /* .name = "Capture Source", */ |
| 7091 | .name = "Input Source", |
| 7092 | .count = 2, |
| 7093 | .info = alc883_mux_enum_info, |
| 7094 | .get = alc883_mux_enum_get, |
| 7095 | .put = alc883_mux_enum_put, |
| 7096 | }, |
| 7097 | { } /* end */ |
Kailang Yang | d1a991a | 2007-08-15 16:21:59 +0200 | [diff] [blame] | 7098 | }; |
Tobin Davis | 2880a86 | 2007-08-07 11:50:26 +0200 | [diff] [blame] | 7099 | |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 7100 | static struct snd_kcontrol_new alc883_chmode_mixer[] = { |
| 7101 | { |
| 7102 | .iface = SNDRV_CTL_ELEM_IFACE_MIXER, |
| 7103 | .name = "Channel Mode", |
| 7104 | .info = alc_ch_mode_info, |
| 7105 | .get = alc_ch_mode_get, |
| 7106 | .put = alc_ch_mode_put, |
| 7107 | }, |
| 7108 | { } /* end */ |
| 7109 | }; |
| 7110 | |
| 7111 | static struct hda_verb alc883_init_verbs[] = { |
| 7112 | /* ADC1: mute amp left and right */ |
| 7113 | {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 7114 | {0x08, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 7115 | /* ADC2: mute amp left and right */ |
| 7116 | {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 7117 | {0x09, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 7118 | /* Front mixer: unmute input/output amp left and right (volume = 0) */ |
| 7119 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 7120 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 7121 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
| 7122 | /* Rear mixer */ |
| 7123 | {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 7124 | {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 7125 | {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
| 7126 | /* CLFE mixer */ |
| 7127 | {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 7128 | {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 7129 | {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
| 7130 | /* Side mixer */ |
| 7131 | {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 7132 | {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 7133 | {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
| 7134 | |
Takashi Iwai | cb53c62 | 2007-08-10 17:21:45 +0200 | [diff] [blame] | 7135 | /* mute analog input loopbacks */ |
| 7136 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 7137 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
| 7138 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)}, |
| 7139 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)}, |
| 7140 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)}, |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 7141 | |
| 7142 | /* Front Pin: output 0 (0x0c) */ |
| 7143 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 7144 | {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 7145 | {0x14, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 7146 | /* Rear Pin: output 1 (0x0d) */ |
| 7147 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 7148 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 7149 | {0x15, AC_VERB_SET_CONNECT_SEL, 0x01}, |
| 7150 | /* CLFE Pin: output 2 (0x0e) */ |
| 7151 | {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 7152 | {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 7153 | {0x16, AC_VERB_SET_CONNECT_SEL, 0x02}, |
| 7154 | /* Side Pin: output 3 (0x0f) */ |
| 7155 | {0x17, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 7156 | {0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 7157 | {0x17, AC_VERB_SET_CONNECT_SEL, 0x03}, |
| 7158 | /* Mic (rear) pin: input vref at 80% */ |
| 7159 | {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80}, |
| 7160 | {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
| 7161 | /* Front Mic pin: input vref at 80% */ |
| 7162 | {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80}, |
| 7163 | {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
| 7164 | /* Line In pin: input */ |
| 7165 | {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
| 7166 | {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
| 7167 | /* Line-2 In: Headphone output (output 0 - 0x0c) */ |
| 7168 | {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 7169 | {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 7170 | {0x1b, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 7171 | /* CD pin widget for input */ |
| 7172 | {0x1c, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
| 7173 | |
| 7174 | /* FIXME: use matrix-type input source selection */ |
| 7175 | /* Mixer elements: 0x18, 19, 1a, 1b, 1c, 1d, 14, 15, 16, 17, 0b */ |
| 7176 | /* Input mixer2 */ |
| 7177 | {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 7178 | {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 7179 | {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(2)}, |
| 7180 | {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(4)}, |
| 7181 | /* Input mixer3 */ |
| 7182 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 7183 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 7184 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(2)}, |
| 7185 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(4)}, |
| 7186 | { } |
| 7187 | }; |
| 7188 | |
Andy Shevchenko | a8848bd | 2007-12-13 17:32:26 +0100 | [diff] [blame] | 7189 | /* toggle speaker-output according to the hp-jack state */ |
| 7190 | static void alc883_mitac_hp_automute(struct hda_codec *codec) |
| 7191 | { |
| 7192 | unsigned int present; |
| 7193 | |
| 7194 | present = snd_hda_codec_read(codec, 0x15, 0, |
| 7195 | AC_VERB_GET_PIN_SENSE, 0) & 0x80000000; |
| 7196 | snd_hda_codec_amp_stereo(codec, 0x14, HDA_OUTPUT, 0, |
| 7197 | HDA_AMP_MUTE, present ? HDA_AMP_MUTE : 0); |
| 7198 | snd_hda_codec_amp_stereo(codec, 0x17, HDA_OUTPUT, 0, |
| 7199 | HDA_AMP_MUTE, present ? HDA_AMP_MUTE : 0); |
| 7200 | } |
| 7201 | |
| 7202 | /* auto-toggle front mic */ |
| 7203 | /* |
| 7204 | static void alc883_mitac_mic_automute(struct hda_codec *codec) |
| 7205 | { |
| 7206 | unsigned int present; |
| 7207 | unsigned char bits; |
| 7208 | |
| 7209 | present = snd_hda_codec_read(codec, 0x18, 0, |
| 7210 | AC_VERB_GET_PIN_SENSE, 0) & 0x80000000; |
| 7211 | bits = present ? HDA_AMP_MUTE : 0; |
| 7212 | snd_hda_codec_amp_stereo(codec, 0x0b, HDA_INPUT, 1, HDA_AMP_MUTE, bits); |
| 7213 | } |
| 7214 | */ |
| 7215 | |
| 7216 | static void alc883_mitac_automute(struct hda_codec *codec) |
| 7217 | { |
| 7218 | alc883_mitac_hp_automute(codec); |
| 7219 | /* alc883_mitac_mic_automute(codec); */ |
| 7220 | } |
| 7221 | |
| 7222 | static void alc883_mitac_unsol_event(struct hda_codec *codec, |
| 7223 | unsigned int res) |
| 7224 | { |
| 7225 | switch (res >> 26) { |
| 7226 | case ALC880_HP_EVENT: |
| 7227 | alc883_mitac_hp_automute(codec); |
| 7228 | break; |
| 7229 | case ALC880_MIC_EVENT: |
| 7230 | /* alc883_mitac_mic_automute(codec); */ |
| 7231 | break; |
| 7232 | } |
| 7233 | } |
| 7234 | |
| 7235 | static struct hda_verb alc883_mitac_verbs[] = { |
| 7236 | /* HP */ |
| 7237 | {0x15, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 7238 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 7239 | /* Subwoofer */ |
| 7240 | {0x17, AC_VERB_SET_CONNECT_SEL, 0x02}, |
| 7241 | {0x17, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 7242 | |
| 7243 | /* enable unsolicited event */ |
| 7244 | {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN}, |
| 7245 | /* {0x18, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_MIC_EVENT | AC_USRSP_EN}, */ |
| 7246 | |
| 7247 | { } /* end */ |
| 7248 | }; |
| 7249 | |
Jiang zhe | 368c7a9 | 2008-03-04 11:20:33 +0100 | [diff] [blame] | 7250 | static struct hda_verb alc883_clevo_m720r_verbs[] = { |
| 7251 | /* HP */ |
| 7252 | {0x15, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 7253 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 7254 | /* Int speaker */ |
| 7255 | {0x14, AC_VERB_SET_CONNECT_SEL, 0x01}, |
| 7256 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 7257 | |
| 7258 | /* enable unsolicited event */ |
| 7259 | {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN}, |
| 7260 | |
| 7261 | { } /* end */ |
| 7262 | }; |
| 7263 | |
Jiang zhe | fb97dc6 | 2008-03-06 11:07:11 +0100 | [diff] [blame] | 7264 | static struct hda_verb alc883_2ch_fujitsu_pi2515_verbs[] = { |
| 7265 | /* HP */ |
| 7266 | {0x14, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 7267 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 7268 | /* Subwoofer */ |
| 7269 | {0x15, AC_VERB_SET_CONNECT_SEL, 0x01}, |
| 7270 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 7271 | |
| 7272 | /* enable unsolicited event */ |
| 7273 | {0x14, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN}, |
| 7274 | |
| 7275 | { } /* end */ |
| 7276 | }; |
| 7277 | |
Kailang Yang | ccc656c | 2006-10-17 12:32:26 +0200 | [diff] [blame] | 7278 | static struct hda_verb alc883_tagra_verbs[] = { |
| 7279 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 7280 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 7281 | |
| 7282 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 7283 | {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 7284 | |
| 7285 | {0x18, AC_VERB_SET_CONNECT_SEL, 0x02}, /* mic/clfe */ |
| 7286 | {0x1a, AC_VERB_SET_CONNECT_SEL, 0x01}, /* line/surround */ |
| 7287 | {0x1b, AC_VERB_SET_CONNECT_SEL, 0x00}, /* HP */ |
| 7288 | |
| 7289 | {0x14, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN}, |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 7290 | {0x01, AC_VERB_SET_GPIO_MASK, 0x03}, |
| 7291 | {0x01, AC_VERB_SET_GPIO_DIRECTION, 0x03}, |
| 7292 | {0x01, AC_VERB_SET_GPIO_DATA, 0x03}, |
Kailang Yang | ccc656c | 2006-10-17 12:32:26 +0200 | [diff] [blame] | 7293 | |
| 7294 | { } /* end */ |
| 7295 | }; |
| 7296 | |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 7297 | static struct hda_verb alc883_lenovo_101e_verbs[] = { |
| 7298 | {0x15, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 7299 | {0x14, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_FRONT_EVENT|AC_USRSP_EN}, |
| 7300 | {0x1b, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT|AC_USRSP_EN}, |
| 7301 | { } /* end */ |
| 7302 | }; |
| 7303 | |
Kailang Yang | 272a527 | 2007-05-14 11:00:38 +0200 | [diff] [blame] | 7304 | static struct hda_verb alc883_lenovo_nb0763_verbs[] = { |
| 7305 | {0x15, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 7306 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 7307 | {0x14, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN}, |
| 7308 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 7309 | { } /* end */ |
| 7310 | }; |
| 7311 | |
| 7312 | static struct hda_verb alc888_lenovo_ms7195_verbs[] = { |
| 7313 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 7314 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 7315 | {0x15, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 7316 | {0x14, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_FRONT_EVENT | AC_USRSP_EN}, |
| 7317 | {0x1b, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN}, |
| 7318 | { } /* end */ |
| 7319 | }; |
| 7320 | |
Kailang Yang | 189609a | 2007-08-20 11:31:23 +0200 | [diff] [blame] | 7321 | static struct hda_verb alc883_haier_w66_verbs[] = { |
| 7322 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 7323 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 7324 | |
| 7325 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 7326 | |
| 7327 | {0x1b, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 7328 | {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 7329 | {0x1b, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN}, |
| 7330 | {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 7331 | { } /* end */ |
| 7332 | }; |
| 7333 | |
Claudio Matsuoka | 4723c02 | 2007-07-13 14:36:19 +0200 | [diff] [blame] | 7334 | static struct hda_verb alc888_6st_hp_verbs[] = { |
Claudio Matsuoka | cd1e3b4 | 2007-07-06 12:10:01 +0200 | [diff] [blame] | 7335 | {0x14, AC_VERB_SET_CONNECT_SEL, 0x00}, /* Front: output 0 (0x0c) */ |
| 7336 | {0x15, AC_VERB_SET_CONNECT_SEL, 0x02}, /* Rear : output 2 (0x0e) */ |
| 7337 | {0x16, AC_VERB_SET_CONNECT_SEL, 0x01}, /* CLFE : output 1 (0x0d) */ |
| 7338 | {0x17, AC_VERB_SET_CONNECT_SEL, 0x03}, /* Side : output 3 (0x0f) */ |
| 7339 | { } |
| 7340 | }; |
| 7341 | |
Claudio Matsuoka | 4723c02 | 2007-07-13 14:36:19 +0200 | [diff] [blame] | 7342 | static struct hda_verb alc888_3st_hp_verbs[] = { |
Claudio Matsuoka | 8341de6 | 2007-07-06 12:10:45 +0200 | [diff] [blame] | 7343 | {0x14, AC_VERB_SET_CONNECT_SEL, 0x00}, /* Front: output 0 (0x0c) */ |
| 7344 | {0x18, AC_VERB_SET_CONNECT_SEL, 0x01}, /* Rear : output 1 (0x0d) */ |
| 7345 | {0x16, AC_VERB_SET_CONNECT_SEL, 0x02}, /* CLFE : output 2 (0x0e) */ |
| 7346 | { } |
| 7347 | }; |
| 7348 | |
Claudio Matsuoka | 5795b9e | 2008-01-13 11:58:27 +0100 | [diff] [blame] | 7349 | static struct hda_verb alc888_6st_dell_verbs[] = { |
| 7350 | {0x14, AC_VERB_SET_CONNECT_SEL, 0x00}, /* Front: output 0 (0x0c) */ |
| 7351 | {0x15, AC_VERB_SET_CONNECT_SEL, 0x02}, /* Rear : output 1 (0x0e) */ |
| 7352 | {0x16, AC_VERB_SET_CONNECT_SEL, 0x01}, /* CLFE : output 2 (0x0d) */ |
| 7353 | {0x17, AC_VERB_SET_CONNECT_SEL, 0x03}, /* Side : output 3 (0x0f) */ |
| 7354 | {0x1b, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN}, |
| 7355 | { } |
| 7356 | }; |
| 7357 | |
Claudio Matsuoka | 4723c02 | 2007-07-13 14:36:19 +0200 | [diff] [blame] | 7358 | static struct hda_verb alc888_3st_hp_2ch_init[] = { |
Claudio Matsuoka | 8341de6 | 2007-07-06 12:10:45 +0200 | [diff] [blame] | 7359 | { 0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80 }, |
| 7360 | { 0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE }, |
| 7361 | { 0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN }, |
| 7362 | { 0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE }, |
| 7363 | { } |
| 7364 | }; |
| 7365 | |
Claudio Matsuoka | 4723c02 | 2007-07-13 14:36:19 +0200 | [diff] [blame] | 7366 | static struct hda_verb alc888_3st_hp_6ch_init[] = { |
Claudio Matsuoka | 8341de6 | 2007-07-06 12:10:45 +0200 | [diff] [blame] | 7367 | { 0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, |
| 7368 | { 0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE }, |
| 7369 | { 0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, |
| 7370 | { 0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE }, |
| 7371 | { } |
| 7372 | }; |
| 7373 | |
Claudio Matsuoka | 4723c02 | 2007-07-13 14:36:19 +0200 | [diff] [blame] | 7374 | static struct hda_channel_mode alc888_3st_hp_modes[2] = { |
| 7375 | { 2, alc888_3st_hp_2ch_init }, |
| 7376 | { 6, alc888_3st_hp_6ch_init }, |
Claudio Matsuoka | 8341de6 | 2007-07-06 12:10:45 +0200 | [diff] [blame] | 7377 | }; |
| 7378 | |
Kailang Yang | 272a527 | 2007-05-14 11:00:38 +0200 | [diff] [blame] | 7379 | /* toggle front-jack and RCA according to the hp-jack state */ |
| 7380 | static void alc888_lenovo_ms7195_front_automute(struct hda_codec *codec) |
| 7381 | { |
| 7382 | unsigned int present; |
| 7383 | |
| 7384 | present = snd_hda_codec_read(codec, 0x1b, 0, |
| 7385 | AC_VERB_GET_PIN_SENSE, 0) & 0x80000000; |
Takashi Iwai | 47fd830 | 2007-08-10 17:11:07 +0200 | [diff] [blame] | 7386 | snd_hda_codec_amp_stereo(codec, 0x14, HDA_OUTPUT, 0, |
| 7387 | HDA_AMP_MUTE, present ? HDA_AMP_MUTE : 0); |
| 7388 | snd_hda_codec_amp_stereo(codec, 0x15, HDA_OUTPUT, 0, |
| 7389 | HDA_AMP_MUTE, present ? HDA_AMP_MUTE : 0); |
Kailang Yang | 272a527 | 2007-05-14 11:00:38 +0200 | [diff] [blame] | 7390 | } |
| 7391 | |
| 7392 | /* toggle RCA according to the front-jack state */ |
| 7393 | static void alc888_lenovo_ms7195_rca_automute(struct hda_codec *codec) |
| 7394 | { |
| 7395 | unsigned int present; |
| 7396 | |
| 7397 | present = snd_hda_codec_read(codec, 0x14, 0, |
| 7398 | AC_VERB_GET_PIN_SENSE, 0) & 0x80000000; |
Takashi Iwai | 47fd830 | 2007-08-10 17:11:07 +0200 | [diff] [blame] | 7399 | snd_hda_codec_amp_stereo(codec, 0x15, HDA_OUTPUT, 0, |
| 7400 | HDA_AMP_MUTE, present ? HDA_AMP_MUTE : 0); |
Kailang Yang | 272a527 | 2007-05-14 11:00:38 +0200 | [diff] [blame] | 7401 | } |
Takashi Iwai | 47fd830 | 2007-08-10 17:11:07 +0200 | [diff] [blame] | 7402 | |
Kailang Yang | 272a527 | 2007-05-14 11:00:38 +0200 | [diff] [blame] | 7403 | static void alc883_lenovo_ms7195_unsol_event(struct hda_codec *codec, |
| 7404 | unsigned int res) |
| 7405 | { |
| 7406 | if ((res >> 26) == ALC880_HP_EVENT) |
| 7407 | alc888_lenovo_ms7195_front_automute(codec); |
| 7408 | if ((res >> 26) == ALC880_FRONT_EVENT) |
| 7409 | alc888_lenovo_ms7195_rca_automute(codec); |
| 7410 | } |
| 7411 | |
| 7412 | static struct hda_verb alc883_medion_md2_verbs[] = { |
| 7413 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 7414 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 7415 | |
| 7416 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 7417 | |
| 7418 | {0x14, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN}, |
| 7419 | { } /* end */ |
| 7420 | }; |
| 7421 | |
| 7422 | /* toggle speaker-output according to the hp-jack state */ |
| 7423 | static void alc883_medion_md2_automute(struct hda_codec *codec) |
| 7424 | { |
| 7425 | unsigned int present; |
| 7426 | |
| 7427 | present = snd_hda_codec_read(codec, 0x14, 0, |
| 7428 | AC_VERB_GET_PIN_SENSE, 0) & 0x80000000; |
Takashi Iwai | 47fd830 | 2007-08-10 17:11:07 +0200 | [diff] [blame] | 7429 | snd_hda_codec_amp_stereo(codec, 0x15, HDA_OUTPUT, 0, |
| 7430 | HDA_AMP_MUTE, present ? HDA_AMP_MUTE : 0); |
Kailang Yang | 272a527 | 2007-05-14 11:00:38 +0200 | [diff] [blame] | 7431 | } |
| 7432 | |
| 7433 | static void alc883_medion_md2_unsol_event(struct hda_codec *codec, |
| 7434 | unsigned int res) |
| 7435 | { |
| 7436 | if ((res >> 26) == ALC880_HP_EVENT) |
| 7437 | alc883_medion_md2_automute(codec); |
| 7438 | } |
| 7439 | |
Kailang Yang | ccc656c | 2006-10-17 12:32:26 +0200 | [diff] [blame] | 7440 | /* toggle speaker-output according to the hp-jack state */ |
| 7441 | static void alc883_tagra_automute(struct hda_codec *codec) |
| 7442 | { |
| 7443 | unsigned int present; |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 7444 | unsigned char bits; |
Kailang Yang | ccc656c | 2006-10-17 12:32:26 +0200 | [diff] [blame] | 7445 | |
| 7446 | present = snd_hda_codec_read(codec, 0x14, 0, |
| 7447 | AC_VERB_GET_PIN_SENSE, 0) & 0x80000000; |
Takashi Iwai | 47fd830 | 2007-08-10 17:11:07 +0200 | [diff] [blame] | 7448 | bits = present ? HDA_AMP_MUTE : 0; |
| 7449 | snd_hda_codec_amp_stereo(codec, 0x1b, HDA_OUTPUT, 0, |
| 7450 | HDA_AMP_MUTE, bits); |
Takashi Iwai | 82beb8f | 2007-08-10 17:09:26 +0200 | [diff] [blame] | 7451 | snd_hda_codec_write_cache(codec, 1, 0, AC_VERB_SET_GPIO_DATA, |
| 7452 | present ? 1 : 3); |
Kailang Yang | ccc656c | 2006-10-17 12:32:26 +0200 | [diff] [blame] | 7453 | } |
| 7454 | |
| 7455 | static void alc883_tagra_unsol_event(struct hda_codec *codec, unsigned int res) |
| 7456 | { |
| 7457 | if ((res >> 26) == ALC880_HP_EVENT) |
| 7458 | alc883_tagra_automute(codec); |
| 7459 | } |
| 7460 | |
Jiang zhe | 368c7a9 | 2008-03-04 11:20:33 +0100 | [diff] [blame] | 7461 | /* toggle speaker-output according to the hp-jack state */ |
| 7462 | static void alc883_clevo_m720r_automute(struct hda_codec *codec) |
| 7463 | { |
| 7464 | unsigned int present; |
| 7465 | unsigned char bits; |
| 7466 | |
| 7467 | present = snd_hda_codec_read(codec, 0x15, 0, AC_VERB_GET_PIN_SENSE, 0) |
| 7468 | & AC_PINSENSE_PRESENCE; |
| 7469 | bits = present ? HDA_AMP_MUTE : 0; |
| 7470 | snd_hda_codec_amp_stereo(codec, 0x14, HDA_OUTPUT, 0, |
| 7471 | HDA_AMP_MUTE, bits); |
| 7472 | } |
| 7473 | |
| 7474 | static void alc883_clevo_m720r_unsol_event(struct hda_codec *codec, |
| 7475 | unsigned int res) |
| 7476 | { |
| 7477 | if ((res >> 26) == ALC880_HP_EVENT) |
| 7478 | alc883_clevo_m720r_automute(codec); |
| 7479 | } |
| 7480 | |
Jiang zhe | fb97dc6 | 2008-03-06 11:07:11 +0100 | [diff] [blame] | 7481 | /* toggle speaker-output according to the hp-jack state */ |
| 7482 | static void alc883_2ch_fujitsu_pi2515_automute(struct hda_codec *codec) |
| 7483 | { |
| 7484 | unsigned int present; |
| 7485 | unsigned char bits; |
| 7486 | |
| 7487 | present = snd_hda_codec_read(codec, 0x14, 0, AC_VERB_GET_PIN_SENSE, 0) |
| 7488 | & AC_PINSENSE_PRESENCE; |
| 7489 | bits = present ? HDA_AMP_MUTE : 0; |
| 7490 | snd_hda_codec_amp_stereo(codec, 0x15, HDA_OUTPUT, 0, |
| 7491 | HDA_AMP_MUTE, bits); |
| 7492 | } |
| 7493 | |
| 7494 | static void alc883_2ch_fujitsu_pi2515_unsol_event(struct hda_codec *codec, |
| 7495 | unsigned int res) |
| 7496 | { |
| 7497 | if ((res >> 26) == ALC880_HP_EVENT) |
| 7498 | alc883_2ch_fujitsu_pi2515_automute(codec); |
| 7499 | } |
| 7500 | |
Kailang Yang | 189609a | 2007-08-20 11:31:23 +0200 | [diff] [blame] | 7501 | static void alc883_haier_w66_automute(struct hda_codec *codec) |
| 7502 | { |
| 7503 | unsigned int present; |
| 7504 | unsigned char bits; |
| 7505 | |
| 7506 | present = snd_hda_codec_read(codec, 0x1b, 0, |
| 7507 | AC_VERB_GET_PIN_SENSE, 0) & 0x80000000; |
| 7508 | bits = present ? 0x80 : 0; |
| 7509 | snd_hda_codec_amp_stereo(codec, 0x14, HDA_OUTPUT, 0, |
| 7510 | 0x80, bits); |
| 7511 | } |
| 7512 | |
| 7513 | static void alc883_haier_w66_unsol_event(struct hda_codec *codec, |
| 7514 | unsigned int res) |
| 7515 | { |
| 7516 | if ((res >> 26) == ALC880_HP_EVENT) |
| 7517 | alc883_haier_w66_automute(codec); |
| 7518 | } |
| 7519 | |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 7520 | static void alc883_lenovo_101e_ispeaker_automute(struct hda_codec *codec) |
| 7521 | { |
| 7522 | unsigned int present; |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 7523 | unsigned char bits; |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 7524 | |
| 7525 | present = snd_hda_codec_read(codec, 0x14, 0, |
| 7526 | AC_VERB_GET_PIN_SENSE, 0) & 0x80000000; |
Takashi Iwai | 47fd830 | 2007-08-10 17:11:07 +0200 | [diff] [blame] | 7527 | bits = present ? HDA_AMP_MUTE : 0; |
| 7528 | snd_hda_codec_amp_stereo(codec, 0x15, HDA_OUTPUT, 0, |
| 7529 | HDA_AMP_MUTE, bits); |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 7530 | } |
| 7531 | |
| 7532 | static void alc883_lenovo_101e_all_automute(struct hda_codec *codec) |
| 7533 | { |
| 7534 | unsigned int present; |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 7535 | unsigned char bits; |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 7536 | |
| 7537 | present = snd_hda_codec_read(codec, 0x1b, 0, |
| 7538 | AC_VERB_GET_PIN_SENSE, 0) & 0x80000000; |
Takashi Iwai | 47fd830 | 2007-08-10 17:11:07 +0200 | [diff] [blame] | 7539 | bits = present ? HDA_AMP_MUTE : 0; |
| 7540 | snd_hda_codec_amp_stereo(codec, 0x15, HDA_OUTPUT, 0, |
| 7541 | HDA_AMP_MUTE, bits); |
| 7542 | snd_hda_codec_amp_stereo(codec, 0x14, HDA_OUTPUT, 0, |
| 7543 | HDA_AMP_MUTE, bits); |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 7544 | } |
| 7545 | |
| 7546 | static void alc883_lenovo_101e_unsol_event(struct hda_codec *codec, |
| 7547 | unsigned int res) |
| 7548 | { |
| 7549 | if ((res >> 26) == ALC880_HP_EVENT) |
| 7550 | alc883_lenovo_101e_all_automute(codec); |
| 7551 | if ((res >> 26) == ALC880_FRONT_EVENT) |
| 7552 | alc883_lenovo_101e_ispeaker_automute(codec); |
| 7553 | } |
| 7554 | |
Takashi Iwai | 676a9b5 | 2007-08-16 15:23:35 +0200 | [diff] [blame] | 7555 | /* toggle speaker-output according to the hp-jack state */ |
| 7556 | static void alc883_acer_aspire_automute(struct hda_codec *codec) |
| 7557 | { |
| 7558 | unsigned int present; |
| 7559 | |
| 7560 | present = snd_hda_codec_read(codec, 0x14, 0, |
| 7561 | AC_VERB_GET_PIN_SENSE, 0) & 0x80000000; |
| 7562 | snd_hda_codec_amp_stereo(codec, 0x15, HDA_OUTPUT, 0, |
| 7563 | HDA_AMP_MUTE, present ? HDA_AMP_MUTE : 0); |
| 7564 | snd_hda_codec_amp_stereo(codec, 0x16, HDA_OUTPUT, 0, |
| 7565 | HDA_AMP_MUTE, present ? HDA_AMP_MUTE : 0); |
| 7566 | } |
| 7567 | |
| 7568 | static void alc883_acer_aspire_unsol_event(struct hda_codec *codec, |
| 7569 | unsigned int res) |
| 7570 | { |
| 7571 | if ((res >> 26) == ALC880_HP_EVENT) |
| 7572 | alc883_acer_aspire_automute(codec); |
| 7573 | } |
| 7574 | |
Kailang Yang | d1a991a | 2007-08-15 16:21:59 +0200 | [diff] [blame] | 7575 | static struct hda_verb alc883_acer_eapd_verbs[] = { |
| 7576 | /* HP Pin: output 0 (0x0c) */ |
| 7577 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 7578 | {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 7579 | {0x14, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 7580 | /* Front Pin: output 0 (0x0c) */ |
Takashi Iwai | 676a9b5 | 2007-08-16 15:23:35 +0200 | [diff] [blame] | 7581 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 7582 | {0x15, AC_VERB_SET_CONNECT_SEL, 0x00}, |
Kailang Yang | d1a991a | 2007-08-15 16:21:59 +0200 | [diff] [blame] | 7583 | {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
Kailang Yang | d1a991a | 2007-08-15 16:21:59 +0200 | [diff] [blame] | 7584 | {0x16, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 7585 | /* eanable EAPD on medion laptop */ |
| 7586 | {0x20, AC_VERB_SET_COEF_INDEX, 0x07}, |
| 7587 | {0x20, AC_VERB_SET_PROC_COEF, 0x3050}, |
Takashi Iwai | 676a9b5 | 2007-08-16 15:23:35 +0200 | [diff] [blame] | 7588 | /* enable unsolicited event */ |
| 7589 | {0x14, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN}, |
Kailang Yang | d1a991a | 2007-08-15 16:21:59 +0200 | [diff] [blame] | 7590 | { } |
| 7591 | }; |
| 7592 | |
Claudio Matsuoka | 5795b9e | 2008-01-13 11:58:27 +0100 | [diff] [blame] | 7593 | static void alc888_6st_dell_front_automute(struct hda_codec *codec) |
| 7594 | { |
| 7595 | unsigned int present; |
| 7596 | |
| 7597 | present = snd_hda_codec_read(codec, 0x1b, 0, |
| 7598 | AC_VERB_GET_PIN_SENSE, 0) & 0x80000000; |
| 7599 | snd_hda_codec_amp_stereo(codec, 0x14, HDA_OUTPUT, 0, |
| 7600 | HDA_AMP_MUTE, present ? HDA_AMP_MUTE : 0); |
| 7601 | snd_hda_codec_amp_stereo(codec, 0x15, HDA_OUTPUT, 0, |
| 7602 | HDA_AMP_MUTE, present ? HDA_AMP_MUTE : 0); |
| 7603 | snd_hda_codec_amp_stereo(codec, 0x16, HDA_OUTPUT, 0, |
| 7604 | HDA_AMP_MUTE, present ? HDA_AMP_MUTE : 0); |
| 7605 | snd_hda_codec_amp_stereo(codec, 0x17, HDA_OUTPUT, 0, |
| 7606 | HDA_AMP_MUTE, present ? HDA_AMP_MUTE : 0); |
| 7607 | } |
| 7608 | |
| 7609 | static void alc888_6st_dell_unsol_event(struct hda_codec *codec, |
| 7610 | unsigned int res) |
| 7611 | { |
| 7612 | switch (res >> 26) { |
| 7613 | case ALC880_HP_EVENT: |
| 7614 | printk("hp_event\n"); |
| 7615 | alc888_6st_dell_front_automute(codec); |
| 7616 | break; |
| 7617 | } |
| 7618 | } |
| 7619 | |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 7620 | /* |
| 7621 | * generic initialization of ADC, input mixers and output mixers |
| 7622 | */ |
| 7623 | static struct hda_verb alc883_auto_init_verbs[] = { |
| 7624 | /* |
| 7625 | * Unmute ADC0-2 and set the default input to mic-in |
| 7626 | */ |
| 7627 | {0x08, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 7628 | {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 7629 | {0x09, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 7630 | {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 7631 | |
Takashi Iwai | cb53c62 | 2007-08-10 17:21:45 +0200 | [diff] [blame] | 7632 | /* 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] | 7633 | * mixer widget |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 7634 | * Note: PASD motherboards uses the Line In 2 as the input for |
| 7635 | * front panel mic (mic 2) |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 7636 | */ |
| 7637 | /* Amp Indices: Mic1 = 0, Mic2 = 1, Line1 = 2, Line2 = 3, CD = 4 */ |
Takashi Iwai | cb53c62 | 2007-08-10 17:21:45 +0200 | [diff] [blame] | 7638 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 7639 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
| 7640 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)}, |
| 7641 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)}, |
| 7642 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)}, |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 7643 | |
| 7644 | /* |
| 7645 | * Set up output mixers (0x0c - 0x0f) |
| 7646 | */ |
| 7647 | /* set vol=0 to output mixers */ |
| 7648 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 7649 | {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 7650 | {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 7651 | {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 7652 | /* set up input amps for analog loopback */ |
| 7653 | /* Amp Indices: DAC = 0, mixer = 1 */ |
| 7654 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 7655 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 7656 | {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 7657 | {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 7658 | {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 7659 | {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 7660 | {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 7661 | {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 7662 | {0x26, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 7663 | {0x26, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 7664 | |
| 7665 | /* FIXME: use matrix-type input source selection */ |
| 7666 | /* Mixer elements: 0x18, 19, 1a, 1b, 1c, 1d, 14, 15, 16, 17, 0b */ |
| 7667 | /* Input mixer1 */ |
| 7668 | {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 7669 | {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 7670 | {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(2)}, |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 7671 | /* {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(3)}, */ |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 7672 | {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(4)}, |
| 7673 | /* Input mixer2 */ |
| 7674 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 7675 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 7676 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(2)}, |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 7677 | /* {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(3)}, */ |
Andy Shevchenko | e3cde64 | 2007-12-03 16:50:58 +0100 | [diff] [blame] | 7678 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(4)}, |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 7679 | |
| 7680 | { } |
| 7681 | }; |
| 7682 | |
| 7683 | /* capture mixer elements */ |
| 7684 | static struct snd_kcontrol_new alc883_capture_mixer[] = { |
| 7685 | HDA_CODEC_VOLUME("Capture Volume", 0x08, 0x0, HDA_INPUT), |
| 7686 | HDA_CODEC_MUTE("Capture Switch", 0x08, 0x0, HDA_INPUT), |
| 7687 | HDA_CODEC_VOLUME_IDX("Capture Volume", 1, 0x09, 0x0, HDA_INPUT), |
| 7688 | HDA_CODEC_MUTE_IDX("Capture Switch", 1, 0x09, 0x0, HDA_INPUT), |
| 7689 | { |
| 7690 | .iface = SNDRV_CTL_ELEM_IFACE_MIXER, |
| 7691 | /* The multiple "Capture Source" controls confuse alsamixer |
| 7692 | * So call somewhat different.. |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 7693 | */ |
| 7694 | /* .name = "Capture Source", */ |
| 7695 | .name = "Input Source", |
| 7696 | .count = 2, |
| 7697 | .info = alc882_mux_enum_info, |
| 7698 | .get = alc882_mux_enum_get, |
| 7699 | .put = alc882_mux_enum_put, |
| 7700 | }, |
| 7701 | { } /* end */ |
| 7702 | }; |
| 7703 | |
Takashi Iwai | cb53c62 | 2007-08-10 17:21:45 +0200 | [diff] [blame] | 7704 | #ifdef CONFIG_SND_HDA_POWER_SAVE |
| 7705 | #define alc883_loopbacks alc880_loopbacks |
| 7706 | #endif |
| 7707 | |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 7708 | /* pcm configuration: identiacal with ALC880 */ |
| 7709 | #define alc883_pcm_analog_playback alc880_pcm_analog_playback |
| 7710 | #define alc883_pcm_analog_capture alc880_pcm_analog_capture |
Takashi Iwai | 6330079 | 2008-01-24 15:31:36 +0100 | [diff] [blame] | 7711 | #define alc883_pcm_analog_alt_capture alc880_pcm_analog_alt_capture |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 7712 | #define alc883_pcm_digital_playback alc880_pcm_digital_playback |
| 7713 | #define alc883_pcm_digital_capture alc880_pcm_digital_capture |
| 7714 | |
| 7715 | /* |
| 7716 | * configuration and preset |
| 7717 | */ |
Takashi Iwai | f5fcc13 | 2006-11-24 17:07:44 +0100 | [diff] [blame] | 7718 | static const char *alc883_models[ALC883_MODEL_LAST] = { |
| 7719 | [ALC883_3ST_2ch_DIG] = "3stack-dig", |
| 7720 | [ALC883_3ST_6ch_DIG] = "3stack-6ch-dig", |
| 7721 | [ALC883_3ST_6ch] = "3stack-6ch", |
| 7722 | [ALC883_6ST_DIG] = "6stack-dig", |
| 7723 | [ALC883_TARGA_DIG] = "targa-dig", |
| 7724 | [ALC883_TARGA_2ch_DIG] = "targa-2ch-dig", |
Takashi Iwai | f5fcc13 | 2006-11-24 17:07:44 +0100 | [diff] [blame] | 7725 | [ALC883_ACER] = "acer", |
Tobin Davis | 2880a86 | 2007-08-07 11:50:26 +0200 | [diff] [blame] | 7726 | [ALC883_ACER_ASPIRE] = "acer-aspire", |
Takashi Iwai | f5fcc13 | 2006-11-24 17:07:44 +0100 | [diff] [blame] | 7727 | [ALC883_MEDION] = "medion", |
Kailang Yang | 272a527 | 2007-05-14 11:00:38 +0200 | [diff] [blame] | 7728 | [ALC883_MEDION_MD2] = "medion-md2", |
Takashi Iwai | f5fcc13 | 2006-11-24 17:07:44 +0100 | [diff] [blame] | 7729 | [ALC883_LAPTOP_EAPD] = "laptop-eapd", |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 7730 | [ALC883_LENOVO_101E_2ch] = "lenovo-101e", |
Kailang Yang | 272a527 | 2007-05-14 11:00:38 +0200 | [diff] [blame] | 7731 | [ALC883_LENOVO_NB0763] = "lenovo-nb0763", |
| 7732 | [ALC888_LENOVO_MS7195_DIG] = "lenovo-ms7195-dig", |
Kailang Yang | 189609a | 2007-08-20 11:31:23 +0200 | [diff] [blame] | 7733 | [ALC883_HAIER_W66] = "haier-w66", |
Claudio Matsuoka | 4723c02 | 2007-07-13 14:36:19 +0200 | [diff] [blame] | 7734 | [ALC888_6ST_HP] = "6stack-hp", |
| 7735 | [ALC888_3ST_HP] = "3stack-hp", |
Claudio Matsuoka | 5795b9e | 2008-01-13 11:58:27 +0100 | [diff] [blame] | 7736 | [ALC888_6ST_DELL] = "6stack-dell", |
Andy Shevchenko | a8848bd | 2007-12-13 17:32:26 +0100 | [diff] [blame] | 7737 | [ALC883_MITAC] = "mitac", |
Jiang zhe | 368c7a9 | 2008-03-04 11:20:33 +0100 | [diff] [blame] | 7738 | [ALC883_CLEVO_M720R] = "clevo-m720r", |
Jiang zhe | fb97dc6 | 2008-03-06 11:07:11 +0100 | [diff] [blame] | 7739 | [ALC883_FUJITSU_PI2515] = "fujitsu-pi2515", |
Takashi Iwai | f5fcc13 | 2006-11-24 17:07:44 +0100 | [diff] [blame] | 7740 | [ALC883_AUTO] = "auto", |
| 7741 | }; |
| 7742 | |
| 7743 | static struct snd_pci_quirk alc883_cfg_tbl[] = { |
| 7744 | SND_PCI_QUIRK(0x1019, 0x6668, "ECS", ALC883_3ST_6ch_DIG), |
Takashi Iwai | ac3e374 | 2007-12-17 17:14:18 +0100 | [diff] [blame] | 7745 | SND_PCI_QUIRK(0x1025, 0x006c, "Acer Aspire 9810", ALC883_ACER_ASPIRE), |
| 7746 | SND_PCI_QUIRK(0x1025, 0x0110, "Acer Aspire", ALC883_ACER_ASPIRE), |
| 7747 | SND_PCI_QUIRK(0x1025, 0x0112, "Acer Aspire 9303", ALC883_ACER_ASPIRE), |
| 7748 | SND_PCI_QUIRK(0x1025, 0, "Acer laptop", ALC883_ACER), /* default Acer */ |
Claudio Matsuoka | 5795b9e | 2008-01-13 11:58:27 +0100 | [diff] [blame] | 7749 | SND_PCI_QUIRK(0x1028, 0x020d, "Dell Inspiron 530", ALC888_6ST_DELL), |
Tobin Davis | febe337 | 2007-06-12 11:27:46 +0200 | [diff] [blame] | 7750 | SND_PCI_QUIRK(0x103c, 0x2a3d, "HP Pavillion", ALC883_6ST_DIG), |
Takashi Iwai | ac3e374 | 2007-12-17 17:14:18 +0100 | [diff] [blame] | 7751 | SND_PCI_QUIRK(0x103c, 0x2a4f, "HP Samba", ALC888_3ST_HP), |
| 7752 | SND_PCI_QUIRK(0x103c, 0x2a60, "HP Lucknow", ALC888_3ST_HP), |
| 7753 | SND_PCI_QUIRK(0x103c, 0x2a61, "HP Nettle", ALC888_6ST_HP), |
| 7754 | 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] | 7755 | SND_PCI_QUIRK(0x105b, 0x6668, "Foxconn", ALC883_6ST_DIG), |
Takashi Iwai | ac3e374 | 2007-12-17 17:14:18 +0100 | [diff] [blame] | 7756 | SND_PCI_QUIRK(0x1071, 0x8253, "Mitac 8252d", ALC883_MITAC), |
| 7757 | SND_PCI_QUIRK(0x1071, 0x8258, "Evesham Voyaeger", ALC883_LAPTOP_EAPD), |
| 7758 | SND_PCI_QUIRK(0x108e, 0x534d, NULL, ALC883_3ST_6ch), |
Tobin Davis | 57b14f2 | 2007-04-18 23:05:36 +0200 | [diff] [blame] | 7759 | SND_PCI_QUIRK(0x1458, 0xa002, "MSI", ALC883_6ST_DIG), |
Takashi Iwai | ac3e374 | 2007-12-17 17:14:18 +0100 | [diff] [blame] | 7760 | SND_PCI_QUIRK(0x1462, 0x0349, "MSI", ALC883_TARGA_2ch_DIG), |
| 7761 | SND_PCI_QUIRK(0x1462, 0x040d, "MSI", ALC883_TARGA_2ch_DIG), |
| 7762 | SND_PCI_QUIRK(0x1462, 0x0579, "MSI", ALC883_TARGA_2ch_DIG), |
| 7763 | SND_PCI_QUIRK(0x1462, 0x3729, "MSI S420", ALC883_TARGA_DIG), |
Pascal Terjan | 8280823 | 2008-03-04 11:33:28 +0100 | [diff] [blame] | 7764 | SND_PCI_QUIRK(0x1462, 0x3783, "NEC S970", ALC883_TARGA_DIG), |
Takashi Iwai | ac3e374 | 2007-12-17 17:14:18 +0100 | [diff] [blame] | 7765 | SND_PCI_QUIRK(0x1462, 0x3b7f, "MSI", ALC883_TARGA_2ch_DIG), |
| 7766 | SND_PCI_QUIRK(0x1462, 0x3ef9, "MSI", ALC883_TARGA_DIG), |
| 7767 | SND_PCI_QUIRK(0x1462, 0x3fc1, "MSI", ALC883_TARGA_DIG), |
| 7768 | SND_PCI_QUIRK(0x1462, 0x3fc3, "MSI", ALC883_TARGA_DIG), |
| 7769 | SND_PCI_QUIRK(0x1462, 0x3fcc, "MSI", ALC883_TARGA_DIG), |
| 7770 | SND_PCI_QUIRK(0x1462, 0x3fdf, "MSI", ALC883_TARGA_DIG), |
| 7771 | SND_PCI_QUIRK(0x1462, 0x4314, "MSI", ALC883_TARGA_DIG), |
| 7772 | SND_PCI_QUIRK(0x1462, 0x4319, "MSI", ALC883_TARGA_DIG), |
| 7773 | SND_PCI_QUIRK(0x1462, 0x4324, "MSI", ALC883_TARGA_DIG), |
Takashi Iwai | f5fcc13 | 2006-11-24 17:07:44 +0100 | [diff] [blame] | 7774 | SND_PCI_QUIRK(0x1462, 0x6668, "MSI", ALC883_6ST_DIG), |
| 7775 | SND_PCI_QUIRK(0x1462, 0x7187, "MSI", ALC883_6ST_DIG), |
Tobin Davis | 799f88a | 2007-05-29 14:29:08 +0200 | [diff] [blame] | 7776 | SND_PCI_QUIRK(0x1462, 0x7250, "MSI", ALC883_6ST_DIG), |
Leonard Norrgard | 2a296cb | 2007-01-08 11:28:22 +0100 | [diff] [blame] | 7777 | SND_PCI_QUIRK(0x1462, 0x7280, "MSI", ALC883_6ST_DIG), |
Tobin Davis | 2dcd522 | 2007-07-10 17:04:57 +0200 | [diff] [blame] | 7778 | SND_PCI_QUIRK(0x1462, 0x7327, "MSI", ALC883_6ST_DIG), |
Takashi Iwai | f5fcc13 | 2006-11-24 17:07:44 +0100 | [diff] [blame] | 7779 | SND_PCI_QUIRK(0x1462, 0xa422, "MSI", ALC883_TARGA_2ch_DIG), |
Takashi Iwai | ac3e374 | 2007-12-17 17:14:18 +0100 | [diff] [blame] | 7780 | SND_PCI_QUIRK(0x147b, 0x1083, "Abit IP35-PRO", ALC883_6ST_DIG), |
Jiang zhe | 368c7a9 | 2008-03-04 11:20:33 +0100 | [diff] [blame] | 7781 | SND_PCI_QUIRK(0x1558, 0x0721, "Clevo laptop M720R", ALC883_CLEVO_M720R), |
Takashi Iwai | ac3e374 | 2007-12-17 17:14:18 +0100 | [diff] [blame] | 7782 | SND_PCI_QUIRK(0x1558, 0, "Clevo laptop", ALC883_LAPTOP_EAPD), |
Daniel T Chen | e60623b | 2007-05-29 03:41:55 -0400 | [diff] [blame] | 7783 | SND_PCI_QUIRK(0x15d9, 0x8780, "Supermicro PDSBA", ALC883_3ST_6ch), |
Takashi Iwai | f5fcc13 | 2006-11-24 17:07:44 +0100 | [diff] [blame] | 7784 | SND_PCI_QUIRK(0x161f, 0x2054, "Medion laptop", ALC883_MEDION), |
Jiang zhe | fb97dc6 | 2008-03-06 11:07:11 +0100 | [diff] [blame] | 7785 | SND_PCI_QUIRK(0x1734, 0x1108, "Fujitsu AMILO Pi2515", ALC883_FUJITSU_PI2515), |
Kailang Yang | 272a527 | 2007-05-14 11:00:38 +0200 | [diff] [blame] | 7786 | SND_PCI_QUIRK(0x17aa, 0x101e, "Lenovo 101e", ALC883_LENOVO_101E_2ch), |
Kailang Yang | 272a527 | 2007-05-14 11:00:38 +0200 | [diff] [blame] | 7787 | SND_PCI_QUIRK(0x17aa, 0x2085, "Lenovo NB0763", ALC883_LENOVO_NB0763), |
Takashi Iwai | ac3e374 | 2007-12-17 17:14:18 +0100 | [diff] [blame] | 7788 | SND_PCI_QUIRK(0x17aa, 0x3bfc, "Lenovo NB0763", ALC883_LENOVO_NB0763), |
| 7789 | SND_PCI_QUIRK(0x17aa, 0x3bfd, "Lenovo NB0763", ALC883_LENOVO_NB0763), |
Kailang Yang | 272a527 | 2007-05-14 11:00:38 +0200 | [diff] [blame] | 7790 | SND_PCI_QUIRK(0x17c0, 0x4071, "MEDION MD2", ALC883_MEDION_MD2), |
Andrew Paprocki | 0b167bf | 2008-02-03 10:15:44 +0100 | [diff] [blame] | 7791 | SND_PCI_QUIRK(0x17f2, 0x5000, "Albatron KI690-AM2", ALC883_6ST_DIG), |
Kailang Yang | 189609a | 2007-08-20 11:31:23 +0200 | [diff] [blame] | 7792 | SND_PCI_QUIRK(0x1991, 0x5625, "Haier W66", ALC883_HAIER_W66), |
Takashi Iwai | ac3e374 | 2007-12-17 17:14:18 +0100 | [diff] [blame] | 7793 | SND_PCI_QUIRK(0x8086, 0xd601, "D102GGC", ALC883_3ST_6ch), |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 7794 | {} |
| 7795 | }; |
| 7796 | |
| 7797 | static struct alc_config_preset alc883_presets[] = { |
| 7798 | [ALC883_3ST_2ch_DIG] = { |
| 7799 | .mixers = { alc883_3ST_2ch_mixer }, |
| 7800 | .init_verbs = { alc883_init_verbs }, |
| 7801 | .num_dacs = ARRAY_SIZE(alc883_dac_nids), |
| 7802 | .dac_nids = alc883_dac_nids, |
| 7803 | .dig_out_nid = ALC883_DIGOUT_NID, |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 7804 | .dig_in_nid = ALC883_DIGIN_NID, |
| 7805 | .num_channel_mode = ARRAY_SIZE(alc883_3ST_2ch_modes), |
| 7806 | .channel_mode = alc883_3ST_2ch_modes, |
| 7807 | .input_mux = &alc883_capture_source, |
| 7808 | }, |
| 7809 | [ALC883_3ST_6ch_DIG] = { |
| 7810 | .mixers = { alc883_3ST_6ch_mixer, alc883_chmode_mixer }, |
| 7811 | .init_verbs = { alc883_init_verbs }, |
| 7812 | .num_dacs = ARRAY_SIZE(alc883_dac_nids), |
| 7813 | .dac_nids = alc883_dac_nids, |
| 7814 | .dig_out_nid = ALC883_DIGOUT_NID, |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 7815 | .dig_in_nid = ALC883_DIGIN_NID, |
| 7816 | .num_channel_mode = ARRAY_SIZE(alc883_3ST_6ch_modes), |
| 7817 | .channel_mode = alc883_3ST_6ch_modes, |
Takashi Iwai | 4e195a7 | 2006-07-28 14:47:34 +0200 | [diff] [blame] | 7818 | .need_dac_fix = 1, |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 7819 | .input_mux = &alc883_capture_source, |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 7820 | }, |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 7821 | [ALC883_3ST_6ch] = { |
| 7822 | .mixers = { alc883_3ST_6ch_mixer, alc883_chmode_mixer }, |
| 7823 | .init_verbs = { alc883_init_verbs }, |
| 7824 | .num_dacs = ARRAY_SIZE(alc883_dac_nids), |
| 7825 | .dac_nids = alc883_dac_nids, |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 7826 | .num_channel_mode = ARRAY_SIZE(alc883_3ST_6ch_modes), |
| 7827 | .channel_mode = alc883_3ST_6ch_modes, |
Takashi Iwai | 4e195a7 | 2006-07-28 14:47:34 +0200 | [diff] [blame] | 7828 | .need_dac_fix = 1, |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 7829 | .input_mux = &alc883_capture_source, |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 7830 | }, |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 7831 | [ALC883_6ST_DIG] = { |
| 7832 | .mixers = { alc883_base_mixer, alc883_chmode_mixer }, |
| 7833 | .init_verbs = { alc883_init_verbs }, |
| 7834 | .num_dacs = ARRAY_SIZE(alc883_dac_nids), |
| 7835 | .dac_nids = alc883_dac_nids, |
| 7836 | .dig_out_nid = ALC883_DIGOUT_NID, |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 7837 | .dig_in_nid = ALC883_DIGIN_NID, |
| 7838 | .num_channel_mode = ARRAY_SIZE(alc883_sixstack_modes), |
| 7839 | .channel_mode = alc883_sixstack_modes, |
| 7840 | .input_mux = &alc883_capture_source, |
| 7841 | }, |
Kailang Yang | ccc656c | 2006-10-17 12:32:26 +0200 | [diff] [blame] | 7842 | [ALC883_TARGA_DIG] = { |
| 7843 | .mixers = { alc883_tagra_mixer, alc883_chmode_mixer }, |
| 7844 | .init_verbs = { alc883_init_verbs, alc883_tagra_verbs}, |
| 7845 | .num_dacs = ARRAY_SIZE(alc883_dac_nids), |
| 7846 | .dac_nids = alc883_dac_nids, |
| 7847 | .dig_out_nid = ALC883_DIGOUT_NID, |
Kailang Yang | ccc656c | 2006-10-17 12:32:26 +0200 | [diff] [blame] | 7848 | .num_channel_mode = ARRAY_SIZE(alc883_3ST_6ch_modes), |
| 7849 | .channel_mode = alc883_3ST_6ch_modes, |
| 7850 | .need_dac_fix = 1, |
| 7851 | .input_mux = &alc883_capture_source, |
| 7852 | .unsol_event = alc883_tagra_unsol_event, |
| 7853 | .init_hook = alc883_tagra_automute, |
| 7854 | }, |
| 7855 | [ALC883_TARGA_2ch_DIG] = { |
| 7856 | .mixers = { alc883_tagra_2ch_mixer}, |
| 7857 | .init_verbs = { alc883_init_verbs, alc883_tagra_verbs}, |
| 7858 | .num_dacs = ARRAY_SIZE(alc883_dac_nids), |
| 7859 | .dac_nids = alc883_dac_nids, |
| 7860 | .dig_out_nid = ALC883_DIGOUT_NID, |
Kailang Yang | ccc656c | 2006-10-17 12:32:26 +0200 | [diff] [blame] | 7861 | .num_channel_mode = ARRAY_SIZE(alc883_3ST_2ch_modes), |
| 7862 | .channel_mode = alc883_3ST_2ch_modes, |
| 7863 | .input_mux = &alc883_capture_source, |
| 7864 | .unsol_event = alc883_tagra_unsol_event, |
| 7865 | .init_hook = alc883_tagra_automute, |
| 7866 | }, |
Vladimir Avdonin | bab282b9 | 2006-08-22 13:31:58 +0200 | [diff] [blame] | 7867 | [ALC883_ACER] = { |
Takashi Iwai | 676a9b5 | 2007-08-16 15:23:35 +0200 | [diff] [blame] | 7868 | .mixers = { alc883_base_mixer }, |
Vladimir Avdonin | bab282b9 | 2006-08-22 13:31:58 +0200 | [diff] [blame] | 7869 | /* On TravelMate laptops, GPIO 0 enables the internal speaker |
| 7870 | * and the headphone jack. Turn this on and rely on the |
| 7871 | * standard mute methods whenever the user wants to turn |
| 7872 | * these outputs off. |
| 7873 | */ |
| 7874 | .init_verbs = { alc883_init_verbs, alc880_gpio1_init_verbs }, |
| 7875 | .num_dacs = ARRAY_SIZE(alc883_dac_nids), |
| 7876 | .dac_nids = alc883_dac_nids, |
Vladimir Avdonin | bab282b9 | 2006-08-22 13:31:58 +0200 | [diff] [blame] | 7877 | .num_channel_mode = ARRAY_SIZE(alc883_3ST_2ch_modes), |
| 7878 | .channel_mode = alc883_3ST_2ch_modes, |
| 7879 | .input_mux = &alc883_capture_source, |
| 7880 | }, |
Tobin Davis | 2880a86 | 2007-08-07 11:50:26 +0200 | [diff] [blame] | 7881 | [ALC883_ACER_ASPIRE] = { |
Takashi Iwai | 676a9b5 | 2007-08-16 15:23:35 +0200 | [diff] [blame] | 7882 | .mixers = { alc883_acer_aspire_mixer }, |
Kailang Yang | d1a991a | 2007-08-15 16:21:59 +0200 | [diff] [blame] | 7883 | .init_verbs = { alc883_init_verbs, alc883_acer_eapd_verbs }, |
Tobin Davis | 2880a86 | 2007-08-07 11:50:26 +0200 | [diff] [blame] | 7884 | .num_dacs = ARRAY_SIZE(alc883_dac_nids), |
| 7885 | .dac_nids = alc883_dac_nids, |
| 7886 | .dig_out_nid = ALC883_DIGOUT_NID, |
Tobin Davis | 2880a86 | 2007-08-07 11:50:26 +0200 | [diff] [blame] | 7887 | .num_channel_mode = ARRAY_SIZE(alc883_3ST_2ch_modes), |
| 7888 | .channel_mode = alc883_3ST_2ch_modes, |
| 7889 | .input_mux = &alc883_capture_source, |
Takashi Iwai | 676a9b5 | 2007-08-16 15:23:35 +0200 | [diff] [blame] | 7890 | .unsol_event = alc883_acer_aspire_unsol_event, |
| 7891 | .init_hook = alc883_acer_aspire_automute, |
Kailang Yang | d1a991a | 2007-08-15 16:21:59 +0200 | [diff] [blame] | 7892 | }, |
Tobin Davis | c07584c | 2006-10-13 12:32:16 +0200 | [diff] [blame] | 7893 | [ALC883_MEDION] = { |
| 7894 | .mixers = { alc883_fivestack_mixer, |
| 7895 | alc883_chmode_mixer }, |
| 7896 | .init_verbs = { alc883_init_verbs, |
Andrew L. Neporada | b373bde | 2006-11-07 11:37:08 +0100 | [diff] [blame] | 7897 | alc883_medion_eapd_verbs }, |
Tobin Davis | c07584c | 2006-10-13 12:32:16 +0200 | [diff] [blame] | 7898 | .num_dacs = ARRAY_SIZE(alc883_dac_nids), |
| 7899 | .dac_nids = alc883_dac_nids, |
Tobin Davis | c07584c | 2006-10-13 12:32:16 +0200 | [diff] [blame] | 7900 | .num_channel_mode = ARRAY_SIZE(alc883_sixstack_modes), |
| 7901 | .channel_mode = alc883_sixstack_modes, |
| 7902 | .input_mux = &alc883_capture_source, |
Andrew L. Neporada | b373bde | 2006-11-07 11:37:08 +0100 | [diff] [blame] | 7903 | }, |
Kailang Yang | 272a527 | 2007-05-14 11:00:38 +0200 | [diff] [blame] | 7904 | [ALC883_MEDION_MD2] = { |
| 7905 | .mixers = { alc883_medion_md2_mixer}, |
| 7906 | .init_verbs = { alc883_init_verbs, alc883_medion_md2_verbs}, |
| 7907 | .num_dacs = ARRAY_SIZE(alc883_dac_nids), |
| 7908 | .dac_nids = alc883_dac_nids, |
| 7909 | .dig_out_nid = ALC883_DIGOUT_NID, |
Kailang Yang | 272a527 | 2007-05-14 11:00:38 +0200 | [diff] [blame] | 7910 | .num_channel_mode = ARRAY_SIZE(alc883_3ST_2ch_modes), |
| 7911 | .channel_mode = alc883_3ST_2ch_modes, |
| 7912 | .input_mux = &alc883_capture_source, |
| 7913 | .unsol_event = alc883_medion_md2_unsol_event, |
| 7914 | .init_hook = alc883_medion_md2_automute, |
| 7915 | }, |
Andrew L. Neporada | b373bde | 2006-11-07 11:37:08 +0100 | [diff] [blame] | 7916 | [ALC883_LAPTOP_EAPD] = { |
Takashi Iwai | 676a9b5 | 2007-08-16 15:23:35 +0200 | [diff] [blame] | 7917 | .mixers = { alc883_base_mixer }, |
Andrew L. Neporada | b373bde | 2006-11-07 11:37:08 +0100 | [diff] [blame] | 7918 | .init_verbs = { alc883_init_verbs, alc882_eapd_verbs }, |
| 7919 | .num_dacs = ARRAY_SIZE(alc883_dac_nids), |
| 7920 | .dac_nids = alc883_dac_nids, |
Andrew L. Neporada | b373bde | 2006-11-07 11:37:08 +0100 | [diff] [blame] | 7921 | .num_channel_mode = ARRAY_SIZE(alc883_3ST_2ch_modes), |
| 7922 | .channel_mode = alc883_3ST_2ch_modes, |
| 7923 | .input_mux = &alc883_capture_source, |
| 7924 | }, |
Jiang zhe | 368c7a9 | 2008-03-04 11:20:33 +0100 | [diff] [blame] | 7925 | [ALC883_CLEVO_M720R] = { |
| 7926 | .mixers = { alc883_clevo_m720r_mixer }, |
| 7927 | .init_verbs = { alc883_init_verbs, alc883_clevo_m720r_verbs }, |
| 7928 | .num_dacs = ARRAY_SIZE(alc883_dac_nids), |
| 7929 | .dac_nids = alc883_dac_nids, |
| 7930 | .dig_out_nid = ALC883_DIGOUT_NID, |
| 7931 | .num_channel_mode = ARRAY_SIZE(alc883_3ST_2ch_modes), |
| 7932 | .channel_mode = alc883_3ST_2ch_modes, |
| 7933 | .input_mux = &alc883_capture_source, |
| 7934 | .unsol_event = alc883_clevo_m720r_unsol_event, |
| 7935 | .init_hook = alc883_clevo_m720r_automute, |
| 7936 | }, |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 7937 | [ALC883_LENOVO_101E_2ch] = { |
| 7938 | .mixers = { alc883_lenovo_101e_2ch_mixer}, |
| 7939 | .init_verbs = { alc883_init_verbs, alc883_lenovo_101e_verbs}, |
| 7940 | .num_dacs = ARRAY_SIZE(alc883_dac_nids), |
| 7941 | .dac_nids = alc883_dac_nids, |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 7942 | .num_channel_mode = ARRAY_SIZE(alc883_3ST_2ch_modes), |
| 7943 | .channel_mode = alc883_3ST_2ch_modes, |
| 7944 | .input_mux = &alc883_lenovo_101e_capture_source, |
| 7945 | .unsol_event = alc883_lenovo_101e_unsol_event, |
| 7946 | .init_hook = alc883_lenovo_101e_all_automute, |
| 7947 | }, |
Kailang Yang | 272a527 | 2007-05-14 11:00:38 +0200 | [diff] [blame] | 7948 | [ALC883_LENOVO_NB0763] = { |
| 7949 | .mixers = { alc883_lenovo_nb0763_mixer }, |
| 7950 | .init_verbs = { alc883_init_verbs, alc883_lenovo_nb0763_verbs}, |
| 7951 | .num_dacs = ARRAY_SIZE(alc883_dac_nids), |
| 7952 | .dac_nids = alc883_dac_nids, |
Kailang Yang | 272a527 | 2007-05-14 11:00:38 +0200 | [diff] [blame] | 7953 | .num_channel_mode = ARRAY_SIZE(alc883_3ST_2ch_modes), |
| 7954 | .channel_mode = alc883_3ST_2ch_modes, |
| 7955 | .need_dac_fix = 1, |
| 7956 | .input_mux = &alc883_lenovo_nb0763_capture_source, |
| 7957 | .unsol_event = alc883_medion_md2_unsol_event, |
| 7958 | .init_hook = alc883_medion_md2_automute, |
| 7959 | }, |
| 7960 | [ALC888_LENOVO_MS7195_DIG] = { |
| 7961 | .mixers = { alc883_3ST_6ch_mixer, alc883_chmode_mixer }, |
| 7962 | .init_verbs = { alc883_init_verbs, alc888_lenovo_ms7195_verbs}, |
| 7963 | .num_dacs = ARRAY_SIZE(alc883_dac_nids), |
| 7964 | .dac_nids = alc883_dac_nids, |
| 7965 | .dig_out_nid = ALC883_DIGOUT_NID, |
Kailang Yang | 272a527 | 2007-05-14 11:00:38 +0200 | [diff] [blame] | 7966 | .num_channel_mode = ARRAY_SIZE(alc883_3ST_6ch_modes), |
| 7967 | .channel_mode = alc883_3ST_6ch_modes, |
| 7968 | .need_dac_fix = 1, |
| 7969 | .input_mux = &alc883_capture_source, |
| 7970 | .unsol_event = alc883_lenovo_ms7195_unsol_event, |
| 7971 | .init_hook = alc888_lenovo_ms7195_front_automute, |
Kailang Yang | 189609a | 2007-08-20 11:31:23 +0200 | [diff] [blame] | 7972 | }, |
| 7973 | [ALC883_HAIER_W66] = { |
| 7974 | .mixers = { alc883_tagra_2ch_mixer}, |
| 7975 | .init_verbs = { alc883_init_verbs, alc883_haier_w66_verbs}, |
| 7976 | .num_dacs = ARRAY_SIZE(alc883_dac_nids), |
| 7977 | .dac_nids = alc883_dac_nids, |
| 7978 | .dig_out_nid = ALC883_DIGOUT_NID, |
Kailang Yang | 189609a | 2007-08-20 11:31:23 +0200 | [diff] [blame] | 7979 | .num_channel_mode = ARRAY_SIZE(alc883_3ST_2ch_modes), |
| 7980 | .channel_mode = alc883_3ST_2ch_modes, |
| 7981 | .input_mux = &alc883_capture_source, |
| 7982 | .unsol_event = alc883_haier_w66_unsol_event, |
| 7983 | .init_hook = alc883_haier_w66_automute, |
Kailang Yang | 272a527 | 2007-05-14 11:00:38 +0200 | [diff] [blame] | 7984 | }, |
Claudio Matsuoka | 4723c02 | 2007-07-13 14:36:19 +0200 | [diff] [blame] | 7985 | [ALC888_6ST_HP] = { |
| 7986 | .mixers = { alc888_6st_hp_mixer, alc883_chmode_mixer }, |
| 7987 | .init_verbs = { alc883_init_verbs, alc888_6st_hp_verbs }, |
Claudio Matsuoka | cd1e3b4 | 2007-07-06 12:10:01 +0200 | [diff] [blame] | 7988 | .num_dacs = ARRAY_SIZE(alc883_dac_nids), |
| 7989 | .dac_nids = alc883_dac_nids, |
| 7990 | .dig_out_nid = ALC883_DIGOUT_NID, |
Claudio Matsuoka | cd1e3b4 | 2007-07-06 12:10:01 +0200 | [diff] [blame] | 7991 | .dig_in_nid = ALC883_DIGIN_NID, |
| 7992 | .num_channel_mode = ARRAY_SIZE(alc883_sixstack_modes), |
| 7993 | .channel_mode = alc883_sixstack_modes, |
| 7994 | .input_mux = &alc883_capture_source, |
| 7995 | }, |
Claudio Matsuoka | 4723c02 | 2007-07-13 14:36:19 +0200 | [diff] [blame] | 7996 | [ALC888_3ST_HP] = { |
| 7997 | .mixers = { alc888_3st_hp_mixer, alc883_chmode_mixer }, |
| 7998 | .init_verbs = { alc883_init_verbs, alc888_3st_hp_verbs }, |
Claudio Matsuoka | 8341de6 | 2007-07-06 12:10:45 +0200 | [diff] [blame] | 7999 | .num_dacs = ARRAY_SIZE(alc883_dac_nids), |
| 8000 | .dac_nids = alc883_dac_nids, |
Claudio Matsuoka | 4723c02 | 2007-07-13 14:36:19 +0200 | [diff] [blame] | 8001 | .num_channel_mode = ARRAY_SIZE(alc888_3st_hp_modes), |
| 8002 | .channel_mode = alc888_3st_hp_modes, |
Claudio Matsuoka | 8341de6 | 2007-07-06 12:10:45 +0200 | [diff] [blame] | 8003 | .need_dac_fix = 1, |
| 8004 | .input_mux = &alc883_capture_source, |
| 8005 | }, |
Claudio Matsuoka | 5795b9e | 2008-01-13 11:58:27 +0100 | [diff] [blame] | 8006 | [ALC888_6ST_DELL] = { |
| 8007 | .mixers = { alc888_6st_dell_mixer, alc883_chmode_mixer }, |
| 8008 | .init_verbs = { alc883_init_verbs, alc888_6st_dell_verbs }, |
| 8009 | .num_dacs = ARRAY_SIZE(alc883_dac_nids), |
| 8010 | .dac_nids = alc883_dac_nids, |
| 8011 | .dig_out_nid = ALC883_DIGOUT_NID, |
Claudio Matsuoka | 5795b9e | 2008-01-13 11:58:27 +0100 | [diff] [blame] | 8012 | .dig_in_nid = ALC883_DIGIN_NID, |
| 8013 | .num_channel_mode = ARRAY_SIZE(alc883_sixstack_modes), |
| 8014 | .channel_mode = alc883_sixstack_modes, |
| 8015 | .input_mux = &alc883_capture_source, |
| 8016 | .unsol_event = alc888_6st_dell_unsol_event, |
| 8017 | .init_hook = alc888_6st_dell_front_automute, |
| 8018 | }, |
Andy Shevchenko | a8848bd | 2007-12-13 17:32:26 +0100 | [diff] [blame] | 8019 | [ALC883_MITAC] = { |
| 8020 | .mixers = { alc883_mitac_mixer }, |
| 8021 | .init_verbs = { alc883_init_verbs, alc883_mitac_verbs }, |
| 8022 | .num_dacs = ARRAY_SIZE(alc883_dac_nids), |
| 8023 | .dac_nids = alc883_dac_nids, |
Andy Shevchenko | a8848bd | 2007-12-13 17:32:26 +0100 | [diff] [blame] | 8024 | .num_channel_mode = ARRAY_SIZE(alc883_3ST_2ch_modes), |
| 8025 | .channel_mode = alc883_3ST_2ch_modes, |
| 8026 | .input_mux = &alc883_capture_source, |
| 8027 | .unsol_event = alc883_mitac_unsol_event, |
| 8028 | .init_hook = alc883_mitac_automute, |
| 8029 | }, |
Jiang zhe | fb97dc6 | 2008-03-06 11:07:11 +0100 | [diff] [blame] | 8030 | [ALC883_FUJITSU_PI2515] = { |
| 8031 | .mixers = { alc883_2ch_fujitsu_pi2515_mixer }, |
| 8032 | .init_verbs = { alc883_init_verbs, |
| 8033 | alc883_2ch_fujitsu_pi2515_verbs}, |
| 8034 | .num_dacs = ARRAY_SIZE(alc883_dac_nids), |
| 8035 | .dac_nids = alc883_dac_nids, |
| 8036 | .dig_out_nid = ALC883_DIGOUT_NID, |
| 8037 | .num_channel_mode = ARRAY_SIZE(alc883_3ST_2ch_modes), |
| 8038 | .channel_mode = alc883_3ST_2ch_modes, |
| 8039 | .input_mux = &alc883_fujitsu_pi2515_capture_source, |
| 8040 | .unsol_event = alc883_2ch_fujitsu_pi2515_unsol_event, |
| 8041 | .init_hook = alc883_2ch_fujitsu_pi2515_automute, |
| 8042 | }, |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 8043 | }; |
| 8044 | |
| 8045 | |
| 8046 | /* |
| 8047 | * BIOS auto configuration |
| 8048 | */ |
| 8049 | static void alc883_auto_set_output_and_unmute(struct hda_codec *codec, |
| 8050 | hda_nid_t nid, int pin_type, |
| 8051 | int dac_idx) |
| 8052 | { |
| 8053 | /* set as output */ |
| 8054 | struct alc_spec *spec = codec->spec; |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 8055 | int idx; |
| 8056 | |
Takashi Iwai | f6c7e54 | 2008-02-12 18:32:23 +0100 | [diff] [blame] | 8057 | alc_set_pin_output(codec, nid, pin_type); |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 8058 | if (spec->multiout.dac_nids[dac_idx] == 0x25) |
| 8059 | idx = 4; |
| 8060 | else |
| 8061 | idx = spec->multiout.dac_nids[dac_idx] - 2; |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 8062 | snd_hda_codec_write(codec, nid, 0, AC_VERB_SET_CONNECT_SEL, idx); |
| 8063 | |
| 8064 | } |
| 8065 | |
| 8066 | static void alc883_auto_init_multi_out(struct hda_codec *codec) |
| 8067 | { |
| 8068 | struct alc_spec *spec = codec->spec; |
| 8069 | int i; |
| 8070 | |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 8071 | alc_subsystem_id(codec, 0x15, 0x1b, 0x14); |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 8072 | for (i = 0; i <= HDA_SIDE; i++) { |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 8073 | hda_nid_t nid = spec->autocfg.line_out_pins[i]; |
Takashi Iwai | baba8ee | 2007-04-23 17:17:48 +0200 | [diff] [blame] | 8074 | int pin_type = get_pin_type(spec->autocfg.line_out_type); |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 8075 | if (nid) |
Takashi Iwai | baba8ee | 2007-04-23 17:17:48 +0200 | [diff] [blame] | 8076 | alc883_auto_set_output_and_unmute(codec, nid, pin_type, |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 8077 | i); |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 8078 | } |
| 8079 | } |
| 8080 | |
| 8081 | static void alc883_auto_init_hp_out(struct hda_codec *codec) |
| 8082 | { |
| 8083 | struct alc_spec *spec = codec->spec; |
| 8084 | hda_nid_t pin; |
| 8085 | |
Takashi Iwai | eb06ed8 | 2006-09-20 17:10:27 +0200 | [diff] [blame] | 8086 | pin = spec->autocfg.hp_pins[0]; |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 8087 | if (pin) /* connect to front */ |
| 8088 | /* use dac 0 */ |
| 8089 | alc883_auto_set_output_and_unmute(codec, pin, PIN_HP, 0); |
Takashi Iwai | f6c7e54 | 2008-02-12 18:32:23 +0100 | [diff] [blame] | 8090 | pin = spec->autocfg.speaker_pins[0]; |
| 8091 | if (pin) |
| 8092 | alc883_auto_set_output_and_unmute(codec, pin, PIN_OUT, 0); |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 8093 | } |
| 8094 | |
| 8095 | #define alc883_is_input_pin(nid) alc880_is_input_pin(nid) |
| 8096 | #define ALC883_PIN_CD_NID ALC880_PIN_CD_NID |
| 8097 | |
| 8098 | static void alc883_auto_init_analog_input(struct hda_codec *codec) |
| 8099 | { |
| 8100 | struct alc_spec *spec = codec->spec; |
| 8101 | int i; |
| 8102 | |
| 8103 | for (i = 0; i < AUTO_PIN_LAST; i++) { |
| 8104 | hda_nid_t nid = spec->autocfg.input_pins[i]; |
| 8105 | if (alc883_is_input_pin(nid)) { |
| 8106 | snd_hda_codec_write(codec, nid, 0, |
| 8107 | AC_VERB_SET_PIN_WIDGET_CONTROL, |
| 8108 | (i <= AUTO_PIN_FRONT_MIC ? |
| 8109 | PIN_VREF80 : PIN_IN)); |
| 8110 | if (nid != ALC883_PIN_CD_NID) |
| 8111 | snd_hda_codec_write(codec, nid, 0, |
| 8112 | AC_VERB_SET_AMP_GAIN_MUTE, |
| 8113 | AMP_OUT_MUTE); |
| 8114 | } |
| 8115 | } |
| 8116 | } |
| 8117 | |
| 8118 | /* almost identical with ALC880 parser... */ |
| 8119 | static int alc883_parse_auto_config(struct hda_codec *codec) |
| 8120 | { |
| 8121 | struct alc_spec *spec = codec->spec; |
| 8122 | int err = alc880_parse_auto_config(codec); |
| 8123 | |
| 8124 | if (err < 0) |
| 8125 | return err; |
Takashi Iwai | 776e184 | 2007-08-29 15:07:11 +0200 | [diff] [blame] | 8126 | else if (!err) |
| 8127 | return 0; /* no config found */ |
| 8128 | |
| 8129 | err = alc_auto_add_mic_boost(codec); |
| 8130 | if (err < 0) |
| 8131 | return err; |
| 8132 | |
| 8133 | /* hack - override the init verbs */ |
| 8134 | spec->init_verbs[0] = alc883_auto_init_verbs; |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 8135 | spec->mixers[spec->num_mixers] = alc883_capture_mixer; |
| 8136 | spec->num_mixers++; |
Takashi Iwai | 776e184 | 2007-08-29 15:07:11 +0200 | [diff] [blame] | 8137 | |
| 8138 | return 1; /* config found */ |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 8139 | } |
| 8140 | |
| 8141 | /* additional initialization for auto-configuration model */ |
| 8142 | static void alc883_auto_init(struct hda_codec *codec) |
| 8143 | { |
Takashi Iwai | f6c7e54 | 2008-02-12 18:32:23 +0100 | [diff] [blame] | 8144 | struct alc_spec *spec = codec->spec; |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 8145 | alc883_auto_init_multi_out(codec); |
| 8146 | alc883_auto_init_hp_out(codec); |
| 8147 | alc883_auto_init_analog_input(codec); |
Takashi Iwai | f6c7e54 | 2008-02-12 18:32:23 +0100 | [diff] [blame] | 8148 | if (spec->unsol_event) |
| 8149 | alc_sku_automute(codec); |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 8150 | } |
| 8151 | |
| 8152 | static int patch_alc883(struct hda_codec *codec) |
| 8153 | { |
| 8154 | struct alc_spec *spec; |
| 8155 | int err, board_config; |
| 8156 | |
| 8157 | spec = kzalloc(sizeof(*spec), GFP_KERNEL); |
| 8158 | if (spec == NULL) |
| 8159 | return -ENOMEM; |
| 8160 | |
| 8161 | codec->spec = spec; |
| 8162 | |
Takashi Iwai | f5fcc13 | 2006-11-24 17:07:44 +0100 | [diff] [blame] | 8163 | board_config = snd_hda_check_board_config(codec, ALC883_MODEL_LAST, |
| 8164 | alc883_models, |
| 8165 | alc883_cfg_tbl); |
| 8166 | if (board_config < 0) { |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 8167 | printk(KERN_INFO "hda_codec: Unknown model for ALC883, " |
| 8168 | "trying auto-probe from BIOS...\n"); |
| 8169 | board_config = ALC883_AUTO; |
| 8170 | } |
| 8171 | |
| 8172 | if (board_config == ALC883_AUTO) { |
| 8173 | /* automatic parse from the BIOS config */ |
| 8174 | err = alc883_parse_auto_config(codec); |
| 8175 | if (err < 0) { |
| 8176 | alc_free(codec); |
| 8177 | return err; |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 8178 | } else if (!err) { |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 8179 | printk(KERN_INFO |
| 8180 | "hda_codec: Cannot set up configuration " |
| 8181 | "from BIOS. Using base mode...\n"); |
| 8182 | board_config = ALC883_3ST_2ch_DIG; |
| 8183 | } |
| 8184 | } |
| 8185 | |
| 8186 | if (board_config != ALC883_AUTO) |
| 8187 | setup_preset(spec, &alc883_presets[board_config]); |
| 8188 | |
| 8189 | spec->stream_name_analog = "ALC883 Analog"; |
| 8190 | spec->stream_analog_playback = &alc883_pcm_analog_playback; |
| 8191 | spec->stream_analog_capture = &alc883_pcm_analog_capture; |
Takashi Iwai | 6330079 | 2008-01-24 15:31:36 +0100 | [diff] [blame] | 8192 | spec->stream_analog_alt_capture = &alc883_pcm_analog_alt_capture; |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 8193 | |
| 8194 | spec->stream_name_digital = "ALC883 Digital"; |
| 8195 | spec->stream_digital_playback = &alc883_pcm_digital_playback; |
| 8196 | spec->stream_digital_capture = &alc883_pcm_digital_capture; |
| 8197 | |
Takashi Iwai | e140634 | 2008-02-11 18:32:32 +0100 | [diff] [blame] | 8198 | spec->num_adc_nids = ARRAY_SIZE(alc883_adc_nids); |
| 8199 | spec->adc_nids = alc883_adc_nids; |
| 8200 | spec->capsrc_nids = alc883_capsrc_nids; |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 8201 | |
Takashi Iwai | 2134ea4 | 2008-01-10 16:53:55 +0100 | [diff] [blame] | 8202 | spec->vmaster_nid = 0x0c; |
| 8203 | |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 8204 | codec->patch_ops = alc_patch_ops; |
| 8205 | if (board_config == ALC883_AUTO) |
| 8206 | spec->init_hook = alc883_auto_init; |
Takashi Iwai | cb53c62 | 2007-08-10 17:21:45 +0200 | [diff] [blame] | 8207 | #ifdef CONFIG_SND_HDA_POWER_SAVE |
| 8208 | if (!spec->loopback.amplist) |
| 8209 | spec->loopback.amplist = alc883_loopbacks; |
| 8210 | #endif |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 8211 | |
| 8212 | return 0; |
| 8213 | } |
| 8214 | |
| 8215 | /* |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 8216 | * ALC262 support |
| 8217 | */ |
| 8218 | |
| 8219 | #define ALC262_DIGOUT_NID ALC880_DIGOUT_NID |
| 8220 | #define ALC262_DIGIN_NID ALC880_DIGIN_NID |
| 8221 | |
| 8222 | #define alc262_dac_nids alc260_dac_nids |
| 8223 | #define alc262_adc_nids alc882_adc_nids |
| 8224 | #define alc262_adc_nids_alt alc882_adc_nids_alt |
Takashi Iwai | 88c71a9 | 2008-02-14 17:27:17 +0100 | [diff] [blame] | 8225 | #define alc262_capsrc_nids alc882_capsrc_nids |
| 8226 | #define alc262_capsrc_nids_alt alc882_capsrc_nids_alt |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 8227 | |
| 8228 | #define alc262_modes alc260_modes |
Takashi Iwai | c5f2ea0 | 2005-12-06 18:54:31 +0100 | [diff] [blame] | 8229 | #define alc262_capture_source alc882_capture_source |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 8230 | |
| 8231 | static struct snd_kcontrol_new alc262_base_mixer[] = { |
| 8232 | HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT), |
| 8233 | HDA_CODEC_MUTE("Front Playback Switch", 0x14, 0x0, HDA_OUTPUT), |
| 8234 | HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT), |
| 8235 | HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT), |
| 8236 | HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT), |
| 8237 | HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT), |
| 8238 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), |
| 8239 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), |
Takashi Iwai | cc69d12 | 2007-02-15 19:29:26 +0100 | [diff] [blame] | 8240 | HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT), |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 8241 | HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x01, HDA_INPUT), |
| 8242 | HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x01, HDA_INPUT), |
Takashi Iwai | cc69d12 | 2007-02-15 19:29:26 +0100 | [diff] [blame] | 8243 | HDA_CODEC_VOLUME("Front Mic Boost", 0x19, 0, HDA_INPUT), |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 8244 | /* HDA_CODEC_VOLUME("PC Beep Playback Volume", 0x0b, 0x05, HDA_INPUT), |
Takashi Iwai | 31bffaa | 2008-02-27 16:10:44 +0100 | [diff] [blame] | 8245 | HDA_CODEC_MUTE("PC Beep Playback Switch", 0x0b, 0x05, HDA_INPUT), */ |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 8246 | HDA_CODEC_VOLUME("Headphone Playback Volume", 0x0D, 0x0, HDA_OUTPUT), |
| 8247 | HDA_CODEC_MUTE("Headphone Playback Switch", 0x15, 0x0, HDA_OUTPUT), |
| 8248 | HDA_CODEC_VOLUME_MONO("Mono Playback Volume", 0x0e, 2, 0x0, HDA_OUTPUT), |
| 8249 | HDA_CODEC_MUTE_MONO("Mono Playback Switch", 0x16, 2, 0x0, HDA_OUTPUT), |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 8250 | { } /* end */ |
Takashi Iwai | 834be88 | 2006-03-01 14:16:17 +0100 | [diff] [blame] | 8251 | }; |
| 8252 | |
Kailang Yang | ccc656c | 2006-10-17 12:32:26 +0200 | [diff] [blame] | 8253 | static struct snd_kcontrol_new alc262_hippo1_mixer[] = { |
| 8254 | HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT), |
| 8255 | HDA_CODEC_MUTE("Front Playback Switch", 0x14, 0x0, HDA_OUTPUT), |
| 8256 | HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT), |
| 8257 | HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT), |
| 8258 | HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT), |
| 8259 | HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT), |
| 8260 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), |
| 8261 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), |
Takashi Iwai | cc69d12 | 2007-02-15 19:29:26 +0100 | [diff] [blame] | 8262 | HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT), |
Kailang Yang | ccc656c | 2006-10-17 12:32:26 +0200 | [diff] [blame] | 8263 | HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x01, HDA_INPUT), |
| 8264 | HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x01, HDA_INPUT), |
Takashi Iwai | cc69d12 | 2007-02-15 19:29:26 +0100 | [diff] [blame] | 8265 | HDA_CODEC_VOLUME("Front Mic Boost", 0x19, 0, HDA_INPUT), |
Kailang Yang | ccc656c | 2006-10-17 12:32:26 +0200 | [diff] [blame] | 8266 | /* HDA_CODEC_VOLUME("PC Beep Playback Volume", 0x0b, 0x05, HDA_INPUT), |
Takashi Iwai | 31bffaa | 2008-02-27 16:10:44 +0100 | [diff] [blame] | 8267 | HDA_CODEC_MUTE("PC Beep Playback Switch", 0x0b, 0x05, HDA_INPUT), */ |
Kailang Yang | ccc656c | 2006-10-17 12:32:26 +0200 | [diff] [blame] | 8268 | /*HDA_CODEC_VOLUME("Headphone Playback Volume", 0x0D, 0x0, HDA_OUTPUT),*/ |
| 8269 | HDA_CODEC_MUTE("Headphone Playback Switch", 0x1b, 0x0, HDA_OUTPUT), |
| 8270 | { } /* end */ |
| 8271 | }; |
| 8272 | |
Takashi Iwai | ce875f0 | 2008-01-28 18:17:43 +0100 | [diff] [blame] | 8273 | /* update HP, line and mono-out pins according to the master switch */ |
| 8274 | static void alc262_hp_master_update(struct hda_codec *codec) |
| 8275 | { |
| 8276 | struct alc_spec *spec = codec->spec; |
| 8277 | int val = spec->master_sw; |
| 8278 | |
| 8279 | /* HP & line-out */ |
| 8280 | snd_hda_codec_write_cache(codec, 0x1b, 0, |
| 8281 | AC_VERB_SET_PIN_WIDGET_CONTROL, |
| 8282 | val ? PIN_HP : 0); |
| 8283 | snd_hda_codec_write_cache(codec, 0x15, 0, |
| 8284 | AC_VERB_SET_PIN_WIDGET_CONTROL, |
| 8285 | val ? PIN_HP : 0); |
| 8286 | /* mono (speaker) depending on the HP jack sense */ |
| 8287 | val = val && !spec->jack_present; |
| 8288 | snd_hda_codec_write_cache(codec, 0x16, 0, |
| 8289 | AC_VERB_SET_PIN_WIDGET_CONTROL, |
| 8290 | val ? PIN_OUT : 0); |
| 8291 | } |
| 8292 | |
| 8293 | static void alc262_hp_bpc_automute(struct hda_codec *codec) |
| 8294 | { |
| 8295 | struct alc_spec *spec = codec->spec; |
| 8296 | unsigned int presence; |
| 8297 | presence = snd_hda_codec_read(codec, 0x1b, 0, |
| 8298 | AC_VERB_GET_PIN_SENSE, 0); |
| 8299 | spec->jack_present = !!(presence & AC_PINSENSE_PRESENCE); |
| 8300 | alc262_hp_master_update(codec); |
| 8301 | } |
| 8302 | |
| 8303 | static void alc262_hp_bpc_unsol_event(struct hda_codec *codec, unsigned int res) |
| 8304 | { |
| 8305 | if ((res >> 26) != ALC880_HP_EVENT) |
| 8306 | return; |
| 8307 | alc262_hp_bpc_automute(codec); |
| 8308 | } |
| 8309 | |
| 8310 | static void alc262_hp_wildwest_automute(struct hda_codec *codec) |
| 8311 | { |
| 8312 | struct alc_spec *spec = codec->spec; |
| 8313 | unsigned int presence; |
| 8314 | presence = snd_hda_codec_read(codec, 0x15, 0, |
| 8315 | AC_VERB_GET_PIN_SENSE, 0); |
| 8316 | spec->jack_present = !!(presence & AC_PINSENSE_PRESENCE); |
| 8317 | alc262_hp_master_update(codec); |
| 8318 | } |
| 8319 | |
| 8320 | static void alc262_hp_wildwest_unsol_event(struct hda_codec *codec, |
| 8321 | unsigned int res) |
| 8322 | { |
| 8323 | if ((res >> 26) != ALC880_HP_EVENT) |
| 8324 | return; |
| 8325 | alc262_hp_wildwest_automute(codec); |
| 8326 | } |
| 8327 | |
| 8328 | static int alc262_hp_master_sw_get(struct snd_kcontrol *kcontrol, |
| 8329 | struct snd_ctl_elem_value *ucontrol) |
| 8330 | { |
| 8331 | struct hda_codec *codec = snd_kcontrol_chip(kcontrol); |
| 8332 | struct alc_spec *spec = codec->spec; |
| 8333 | *ucontrol->value.integer.value = spec->master_sw; |
| 8334 | return 0; |
| 8335 | } |
| 8336 | |
| 8337 | static int alc262_hp_master_sw_put(struct snd_kcontrol *kcontrol, |
| 8338 | struct snd_ctl_elem_value *ucontrol) |
| 8339 | { |
| 8340 | struct hda_codec *codec = snd_kcontrol_chip(kcontrol); |
| 8341 | struct alc_spec *spec = codec->spec; |
| 8342 | int val = !!*ucontrol->value.integer.value; |
| 8343 | |
| 8344 | if (val == spec->master_sw) |
| 8345 | return 0; |
| 8346 | spec->master_sw = val; |
| 8347 | alc262_hp_master_update(codec); |
| 8348 | return 1; |
| 8349 | } |
| 8350 | |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 8351 | static struct snd_kcontrol_new alc262_HP_BPC_mixer[] = { |
Takashi Iwai | ce875f0 | 2008-01-28 18:17:43 +0100 | [diff] [blame] | 8352 | { |
| 8353 | .iface = SNDRV_CTL_ELEM_IFACE_MIXER, |
| 8354 | .name = "Master Playback Switch", |
| 8355 | .info = snd_ctl_boolean_mono_info, |
| 8356 | .get = alc262_hp_master_sw_get, |
| 8357 | .put = alc262_hp_master_sw_put, |
| 8358 | }, |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 8359 | HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT), |
| 8360 | HDA_CODEC_MUTE("Front Playback Switch", 0x15, 0x0, HDA_OUTPUT), |
| 8361 | HDA_CODEC_MUTE("Headphone Playback Switch", 0x1b, 0x0, HDA_OUTPUT), |
Takashi Iwai | ce875f0 | 2008-01-28 18:17:43 +0100 | [diff] [blame] | 8362 | HDA_CODEC_VOLUME_MONO("Speaker Playback Volume", 0x0e, 2, 0x0, |
| 8363 | HDA_OUTPUT), |
| 8364 | HDA_CODEC_MUTE_MONO("Speaker Playback Switch", 0x16, 2, 0x0, |
| 8365 | HDA_OUTPUT), |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 8366 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), |
| 8367 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), |
Takashi Iwai | cc69d12 | 2007-02-15 19:29:26 +0100 | [diff] [blame] | 8368 | HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT), |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 8369 | HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x01, HDA_INPUT), |
| 8370 | HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x01, HDA_INPUT), |
Takashi Iwai | cc69d12 | 2007-02-15 19:29:26 +0100 | [diff] [blame] | 8371 | HDA_CODEC_VOLUME("Front Mic Boost", 0x19, 0, HDA_INPUT), |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 8372 | HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT), |
| 8373 | HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT), |
| 8374 | HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT), |
| 8375 | HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT), |
| 8376 | HDA_CODEC_VOLUME("PC Beep Playback Volume", 0x0b, 0x05, HDA_INPUT), |
| 8377 | HDA_CODEC_MUTE("PC Beep Playback Switch", 0x0b, 0x05, HDA_INPUT), |
| 8378 | HDA_CODEC_VOLUME("AUX IN Playback Volume", 0x0b, 0x06, HDA_INPUT), |
| 8379 | HDA_CODEC_MUTE("AUX IN Playback Switch", 0x0b, 0x06, HDA_INPUT), |
| 8380 | { } /* end */ |
| 8381 | }; |
| 8382 | |
Kailang Yang | cd7509a | 2007-01-26 18:33:17 +0100 | [diff] [blame] | 8383 | static struct snd_kcontrol_new alc262_HP_BPC_WildWest_mixer[] = { |
Takashi Iwai | ce875f0 | 2008-01-28 18:17:43 +0100 | [diff] [blame] | 8384 | { |
| 8385 | .iface = SNDRV_CTL_ELEM_IFACE_MIXER, |
| 8386 | .name = "Master Playback Switch", |
| 8387 | .info = snd_ctl_boolean_mono_info, |
| 8388 | .get = alc262_hp_master_sw_get, |
| 8389 | .put = alc262_hp_master_sw_put, |
| 8390 | }, |
Kailang Yang | cd7509a | 2007-01-26 18:33:17 +0100 | [diff] [blame] | 8391 | HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT), |
| 8392 | HDA_CODEC_MUTE("Front Playback Switch", 0x1b, 0x0, HDA_OUTPUT), |
| 8393 | HDA_CODEC_VOLUME("Headphone Playback Volume", 0x0d, 0x0, HDA_OUTPUT), |
| 8394 | HDA_CODEC_MUTE("Headphone Playback Switch", 0x15, 0x0, HDA_OUTPUT), |
Takashi Iwai | ce875f0 | 2008-01-28 18:17:43 +0100 | [diff] [blame] | 8395 | HDA_CODEC_VOLUME_MONO("Speaker Playback Volume", 0x0e, 2, 0x0, |
| 8396 | HDA_OUTPUT), |
| 8397 | HDA_CODEC_MUTE_MONO("Speaker Playback Switch", 0x16, 2, 0x0, |
| 8398 | HDA_OUTPUT), |
Kailang Yang | cd7509a | 2007-01-26 18:33:17 +0100 | [diff] [blame] | 8399 | HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x02, HDA_INPUT), |
| 8400 | HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x02, HDA_INPUT), |
Takashi Iwai | cc69d12 | 2007-02-15 19:29:26 +0100 | [diff] [blame] | 8401 | HDA_CODEC_VOLUME("Front Mic Boost", 0x1a, 0, HDA_INPUT), |
Kailang Yang | cd7509a | 2007-01-26 18:33:17 +0100 | [diff] [blame] | 8402 | HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x01, HDA_INPUT), |
| 8403 | HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x01, HDA_INPUT), |
| 8404 | HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT), |
| 8405 | HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT), |
| 8406 | HDA_CODEC_VOLUME("PC Beep Playback Volume", 0x0b, 0x05, HDA_INPUT), |
| 8407 | HDA_CODEC_MUTE("PC Beep Playback Switch", 0x0b, 0x05, HDA_INPUT), |
| 8408 | { } /* end */ |
| 8409 | }; |
| 8410 | |
| 8411 | static struct snd_kcontrol_new alc262_HP_BPC_WildWest_option_mixer[] = { |
| 8412 | HDA_CODEC_VOLUME("Rear Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), |
| 8413 | HDA_CODEC_MUTE("Rear Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), |
Takashi Iwai | cc69d12 | 2007-02-15 19:29:26 +0100 | [diff] [blame] | 8414 | HDA_CODEC_VOLUME("Rear Mic Boost", 0x18, 0, HDA_INPUT), |
Kailang Yang | cd7509a | 2007-01-26 18:33:17 +0100 | [diff] [blame] | 8415 | { } /* end */ |
| 8416 | }; |
| 8417 | |
Kailang Yang | 66d2a9d | 2007-11-14 12:06:21 +0100 | [diff] [blame] | 8418 | /* mute/unmute internal speaker according to the hp jack and mute state */ |
| 8419 | static void alc262_hp_t5735_automute(struct hda_codec *codec, int force) |
| 8420 | { |
| 8421 | struct alc_spec *spec = codec->spec; |
Kailang Yang | 66d2a9d | 2007-11-14 12:06:21 +0100 | [diff] [blame] | 8422 | |
| 8423 | if (force || !spec->sense_updated) { |
| 8424 | unsigned int present; |
| 8425 | present = snd_hda_codec_read(codec, 0x15, 0, |
| 8426 | AC_VERB_GET_PIN_SENSE, 0); |
Takashi Iwai | 4bb2613 | 2008-01-28 18:12:42 +0100 | [diff] [blame] | 8427 | spec->jack_present = (present & AC_PINSENSE_PRESENCE) != 0; |
Kailang Yang | 66d2a9d | 2007-11-14 12:06:21 +0100 | [diff] [blame] | 8428 | spec->sense_updated = 1; |
| 8429 | } |
Takashi Iwai | 4bb2613 | 2008-01-28 18:12:42 +0100 | [diff] [blame] | 8430 | snd_hda_codec_amp_stereo(codec, 0x0c, HDA_OUTPUT, 0, HDA_AMP_MUTE, |
| 8431 | spec->jack_present ? HDA_AMP_MUTE : 0); |
Kailang Yang | 66d2a9d | 2007-11-14 12:06:21 +0100 | [diff] [blame] | 8432 | } |
| 8433 | |
| 8434 | static void alc262_hp_t5735_unsol_event(struct hda_codec *codec, |
| 8435 | unsigned int res) |
| 8436 | { |
| 8437 | if ((res >> 26) != ALC880_HP_EVENT) |
| 8438 | return; |
| 8439 | alc262_hp_t5735_automute(codec, 1); |
| 8440 | } |
| 8441 | |
| 8442 | static void alc262_hp_t5735_init_hook(struct hda_codec *codec) |
| 8443 | { |
| 8444 | alc262_hp_t5735_automute(codec, 1); |
| 8445 | } |
| 8446 | |
| 8447 | static struct snd_kcontrol_new alc262_hp_t5735_mixer[] = { |
Takashi Iwai | 86cd929 | 2008-01-28 18:09:56 +0100 | [diff] [blame] | 8448 | HDA_CODEC_VOLUME("Speaker Playback Volume", 0x0c, 0x0, HDA_OUTPUT), |
| 8449 | HDA_CODEC_MUTE("Speaker Playback Switch", 0x14, 0x0, HDA_OUTPUT), |
Kailang Yang | 66d2a9d | 2007-11-14 12:06:21 +0100 | [diff] [blame] | 8450 | HDA_CODEC_VOLUME("Headphone Playback Volume", 0x0d, 0x0, HDA_OUTPUT), |
| 8451 | HDA_CODEC_MUTE("Headphone Playback Switch", 0x15, 0x0, HDA_OUTPUT), |
| 8452 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), |
| 8453 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), |
| 8454 | HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT), |
| 8455 | { } /* end */ |
| 8456 | }; |
| 8457 | |
| 8458 | static struct hda_verb alc262_hp_t5735_verbs[] = { |
| 8459 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 8460 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 8461 | |
| 8462 | {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN}, |
| 8463 | { } |
| 8464 | }; |
| 8465 | |
Kailang Yang | 8c42722 | 2008-01-10 13:03:59 +0100 | [diff] [blame] | 8466 | static struct snd_kcontrol_new alc262_hp_rp5700_mixer[] = { |
Takashi Iwai | f2f48e1 | 2008-01-28 18:14:43 +0100 | [diff] [blame] | 8467 | HDA_CODEC_VOLUME("Headphone Playback Volume", 0x0c, 0x0, HDA_OUTPUT), |
| 8468 | HDA_CODEC_MUTE("Headphone Playback Switch", 0x1b, 0x0, HDA_OUTPUT), |
Takashi Iwai | 86cd929 | 2008-01-28 18:09:56 +0100 | [diff] [blame] | 8469 | HDA_CODEC_VOLUME("Speaker Playback Volume", 0x0e, 0x0, HDA_OUTPUT), |
| 8470 | HDA_CODEC_MUTE("Speaker Playback Switch", 0x16, 0x0, HDA_OUTPUT), |
Kailang Yang | 8c42722 | 2008-01-10 13:03:59 +0100 | [diff] [blame] | 8471 | HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x01, HDA_INPUT), |
| 8472 | HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x01, HDA_INPUT), |
| 8473 | { } /* end */ |
| 8474 | }; |
| 8475 | |
| 8476 | static struct hda_verb alc262_hp_rp5700_verbs[] = { |
| 8477 | {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 8478 | {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 8479 | {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 8480 | {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 8481 | {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
| 8482 | {0x1b, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 8483 | {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x01 << 8))}, |
| 8484 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x01 << 8))}, |
| 8485 | {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x00 << 8))}, |
| 8486 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x00 << 8))}, |
| 8487 | {} |
| 8488 | }; |
| 8489 | |
| 8490 | static struct hda_input_mux alc262_hp_rp5700_capture_source = { |
| 8491 | .num_items = 1, |
| 8492 | .items = { |
| 8493 | { "Line", 0x1 }, |
| 8494 | }, |
| 8495 | }; |
| 8496 | |
Takashi Iwai | 0724ea2 | 2007-08-23 00:31:43 +0200 | [diff] [blame] | 8497 | /* bind hp and internal speaker mute (with plug check) */ |
| 8498 | static int alc262_sony_master_sw_put(struct snd_kcontrol *kcontrol, |
| 8499 | struct snd_ctl_elem_value *ucontrol) |
| 8500 | { |
| 8501 | struct hda_codec *codec = snd_kcontrol_chip(kcontrol); |
| 8502 | long *valp = ucontrol->value.integer.value; |
| 8503 | int change; |
| 8504 | |
| 8505 | /* change hp mute */ |
| 8506 | change = snd_hda_codec_amp_update(codec, 0x15, 0, HDA_OUTPUT, 0, |
| 8507 | HDA_AMP_MUTE, |
| 8508 | valp[0] ? 0 : HDA_AMP_MUTE); |
| 8509 | change |= snd_hda_codec_amp_update(codec, 0x15, 1, HDA_OUTPUT, 0, |
| 8510 | HDA_AMP_MUTE, |
| 8511 | valp[1] ? 0 : HDA_AMP_MUTE); |
| 8512 | if (change) { |
| 8513 | /* change speaker according to HP jack state */ |
| 8514 | struct alc_spec *spec = codec->spec; |
| 8515 | unsigned int mute; |
| 8516 | if (spec->jack_present) |
| 8517 | mute = HDA_AMP_MUTE; |
| 8518 | else |
| 8519 | mute = snd_hda_codec_amp_read(codec, 0x15, 0, |
| 8520 | HDA_OUTPUT, 0); |
| 8521 | snd_hda_codec_amp_stereo(codec, 0x14, HDA_OUTPUT, 0, |
| 8522 | HDA_AMP_MUTE, mute); |
| 8523 | } |
| 8524 | return change; |
| 8525 | } |
Takashi Iwai | 5b31954 | 2007-07-26 11:49:22 +0200 | [diff] [blame] | 8526 | |
Kailang Yang | 272a527 | 2007-05-14 11:00:38 +0200 | [diff] [blame] | 8527 | static struct snd_kcontrol_new alc262_sony_mixer[] = { |
Takashi Iwai | 0724ea2 | 2007-08-23 00:31:43 +0200 | [diff] [blame] | 8528 | HDA_CODEC_VOLUME("Master Playback Volume", 0x0c, 0x0, HDA_OUTPUT), |
| 8529 | { |
| 8530 | .iface = SNDRV_CTL_ELEM_IFACE_MIXER, |
| 8531 | .name = "Master Playback Switch", |
| 8532 | .info = snd_hda_mixer_amp_switch_info, |
| 8533 | .get = snd_hda_mixer_amp_switch_get, |
| 8534 | .put = alc262_sony_master_sw_put, |
| 8535 | .private_value = HDA_COMPOSE_AMP_VAL(0x15, 3, 0, HDA_OUTPUT), |
| 8536 | }, |
Kailang Yang | 272a527 | 2007-05-14 11:00:38 +0200 | [diff] [blame] | 8537 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), |
| 8538 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), |
| 8539 | HDA_CODEC_VOLUME("ATAPI Mic Playback Volume", 0x0b, 0x01, HDA_INPUT), |
| 8540 | HDA_CODEC_MUTE("ATAPI Mic Playback Switch", 0x0b, 0x01, HDA_INPUT), |
| 8541 | { } /* end */ |
| 8542 | }; |
| 8543 | |
Kailang Yang | 83c3421 | 2007-07-05 11:43:05 +0200 | [diff] [blame] | 8544 | static struct snd_kcontrol_new alc262_benq_t31_mixer[] = { |
| 8545 | HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT), |
| 8546 | HDA_CODEC_MUTE("Front Playback Switch", 0x14, 0x0, HDA_OUTPUT), |
| 8547 | HDA_CODEC_MUTE("Headphone Playback Switch", 0x15, 0x0, HDA_OUTPUT), |
| 8548 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), |
| 8549 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), |
| 8550 | HDA_CODEC_VOLUME("ATAPI Mic Playback Volume", 0x0b, 0x01, HDA_INPUT), |
| 8551 | HDA_CODEC_MUTE("ATAPI Mic Playback Switch", 0x0b, 0x01, HDA_INPUT), |
| 8552 | { } /* end */ |
| 8553 | }; |
Kailang Yang | 272a527 | 2007-05-14 11:00:38 +0200 | [diff] [blame] | 8554 | |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 8555 | #define alc262_capture_mixer alc882_capture_mixer |
| 8556 | #define alc262_capture_alt_mixer alc882_capture_alt_mixer |
| 8557 | |
| 8558 | /* |
| 8559 | * generic initialization of ADC, input mixers and output mixers |
| 8560 | */ |
| 8561 | static struct hda_verb alc262_init_verbs[] = { |
| 8562 | /* |
| 8563 | * Unmute ADC0-2 and set the default input to mic-in |
| 8564 | */ |
| 8565 | {0x07, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 8566 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 8567 | {0x08, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 8568 | {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 8569 | {0x09, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 8570 | {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 8571 | |
Takashi Iwai | cb53c62 | 2007-08-10 17:21:45 +0200 | [diff] [blame] | 8572 | /* 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] | 8573 | * mixer widget |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 8574 | * Note: PASD motherboards uses the Line In 2 as the input for |
| 8575 | * front panel mic (mic 2) |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 8576 | */ |
| 8577 | /* Amp Indices: Mic1 = 0, Mic2 = 1, Line1 = 2, Line2 = 3, CD = 4 */ |
Takashi Iwai | cb53c62 | 2007-08-10 17:21:45 +0200 | [diff] [blame] | 8578 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 8579 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
| 8580 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)}, |
| 8581 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)}, |
| 8582 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)}, |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 8583 | |
| 8584 | /* |
| 8585 | * Set up output mixers (0x0c - 0x0e) |
| 8586 | */ |
| 8587 | /* set vol=0 to output mixers */ |
| 8588 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 8589 | {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 8590 | {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 8591 | /* set up input amps for analog loopback */ |
| 8592 | /* Amp Indices: DAC = 0, mixer = 1 */ |
| 8593 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 8594 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 8595 | {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 8596 | {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 8597 | {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 8598 | {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 8599 | |
| 8600 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x40}, |
| 8601 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, 0xc0}, |
| 8602 | {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x40}, |
| 8603 | {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24}, |
| 8604 | {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20}, |
| 8605 | {0x1c, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20}, |
| 8606 | |
| 8607 | {0x14, AC_VERB_SET_AMP_GAIN_MUTE, 0x0000}, |
| 8608 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, 0x0000}, |
| 8609 | {0x16, AC_VERB_SET_AMP_GAIN_MUTE, 0x0000}, |
| 8610 | {0x18, AC_VERB_SET_AMP_GAIN_MUTE, 0x0000}, |
| 8611 | {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, 0x0000}, |
| 8612 | |
| 8613 | {0x14, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 8614 | {0x15, AC_VERB_SET_CONNECT_SEL, 0x01}, |
| 8615 | |
| 8616 | /* FIXME: use matrix-type input source selection */ |
| 8617 | /* Mixer elements: 0x18, 19, 1a, 1b, 1c, 1d, 14, 15, 16, 17, 0b */ |
| 8618 | /* Input mixer1: unmute Mic, F-Mic, Line, CD inputs */ |
| 8619 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))}, |
| 8620 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x03 << 8))}, |
| 8621 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x02 << 8))}, |
| 8622 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x04 << 8))}, |
| 8623 | /* Input mixer2 */ |
| 8624 | {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))}, |
| 8625 | {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x03 << 8))}, |
| 8626 | {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x02 << 8))}, |
| 8627 | {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x04 << 8))}, |
| 8628 | /* Input mixer3 */ |
| 8629 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))}, |
| 8630 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x03 << 8))}, |
| 8631 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x02 << 8))}, |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 8632 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x04 << 8))}, |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 8633 | |
| 8634 | { } |
| 8635 | }; |
| 8636 | |
Kailang Yang | ccc656c | 2006-10-17 12:32:26 +0200 | [diff] [blame] | 8637 | static struct hda_verb alc262_hippo_unsol_verbs[] = { |
| 8638 | {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT}, |
| 8639 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 8640 | {} |
| 8641 | }; |
| 8642 | |
| 8643 | static struct hda_verb alc262_hippo1_unsol_verbs[] = { |
| 8644 | {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, 0xc0}, |
| 8645 | {0x1b, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 8646 | {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, 0x0000}, |
| 8647 | |
| 8648 | {0x1b, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT}, |
| 8649 | {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 8650 | {} |
| 8651 | }; |
| 8652 | |
Kailang Yang | 272a527 | 2007-05-14 11:00:38 +0200 | [diff] [blame] | 8653 | static struct hda_verb alc262_sony_unsol_verbs[] = { |
| 8654 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, 0xc0}, |
| 8655 | {0x15, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 8656 | {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24}, // Front Mic |
| 8657 | |
| 8658 | {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT}, |
| 8659 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 8660 | }; |
| 8661 | |
Kailang Yang | ccc656c | 2006-10-17 12:32:26 +0200 | [diff] [blame] | 8662 | /* mute/unmute internal speaker according to the hp jack and mute state */ |
Takashi Iwai | 5b31954 | 2007-07-26 11:49:22 +0200 | [diff] [blame] | 8663 | static void alc262_hippo_automute(struct hda_codec *codec) |
Kailang Yang | ccc656c | 2006-10-17 12:32:26 +0200 | [diff] [blame] | 8664 | { |
| 8665 | struct alc_spec *spec = codec->spec; |
| 8666 | unsigned int mute; |
Takashi Iwai | 5b31954 | 2007-07-26 11:49:22 +0200 | [diff] [blame] | 8667 | unsigned int present; |
Kailang Yang | ccc656c | 2006-10-17 12:32:26 +0200 | [diff] [blame] | 8668 | |
Takashi Iwai | 5b31954 | 2007-07-26 11:49:22 +0200 | [diff] [blame] | 8669 | /* need to execute and sync at first */ |
| 8670 | snd_hda_codec_read(codec, 0x15, 0, AC_VERB_SET_PIN_SENSE, 0); |
| 8671 | present = snd_hda_codec_read(codec, 0x15, 0, |
| 8672 | AC_VERB_GET_PIN_SENSE, 0); |
| 8673 | spec->jack_present = (present & 0x80000000) != 0; |
Kailang Yang | ccc656c | 2006-10-17 12:32:26 +0200 | [diff] [blame] | 8674 | if (spec->jack_present) { |
| 8675 | /* mute internal speaker */ |
Takashi Iwai | 47fd830 | 2007-08-10 17:11:07 +0200 | [diff] [blame] | 8676 | snd_hda_codec_amp_stereo(codec, 0x14, HDA_OUTPUT, 0, |
| 8677 | HDA_AMP_MUTE, HDA_AMP_MUTE); |
Kailang Yang | ccc656c | 2006-10-17 12:32:26 +0200 | [diff] [blame] | 8678 | } else { |
| 8679 | /* unmute internal speaker if necessary */ |
| 8680 | mute = snd_hda_codec_amp_read(codec, 0x15, 0, HDA_OUTPUT, 0); |
Takashi Iwai | 47fd830 | 2007-08-10 17:11:07 +0200 | [diff] [blame] | 8681 | snd_hda_codec_amp_stereo(codec, 0x14, HDA_OUTPUT, 0, |
| 8682 | HDA_AMP_MUTE, mute); |
Kailang Yang | ccc656c | 2006-10-17 12:32:26 +0200 | [diff] [blame] | 8683 | } |
| 8684 | } |
| 8685 | |
| 8686 | /* unsolicited event for HP jack sensing */ |
| 8687 | static void alc262_hippo_unsol_event(struct hda_codec *codec, |
| 8688 | unsigned int res) |
| 8689 | { |
| 8690 | if ((res >> 26) != ALC880_HP_EVENT) |
| 8691 | return; |
Takashi Iwai | 5b31954 | 2007-07-26 11:49:22 +0200 | [diff] [blame] | 8692 | alc262_hippo_automute(codec); |
Kailang Yang | ccc656c | 2006-10-17 12:32:26 +0200 | [diff] [blame] | 8693 | } |
| 8694 | |
Takashi Iwai | 5b31954 | 2007-07-26 11:49:22 +0200 | [diff] [blame] | 8695 | static void alc262_hippo1_automute(struct hda_codec *codec) |
Kailang Yang | ccc656c | 2006-10-17 12:32:26 +0200 | [diff] [blame] | 8696 | { |
Kailang Yang | ccc656c | 2006-10-17 12:32:26 +0200 | [diff] [blame] | 8697 | unsigned int mute; |
Takashi Iwai | 5b31954 | 2007-07-26 11:49:22 +0200 | [diff] [blame] | 8698 | unsigned int present; |
Kailang Yang | ccc656c | 2006-10-17 12:32:26 +0200 | [diff] [blame] | 8699 | |
Takashi Iwai | 5b31954 | 2007-07-26 11:49:22 +0200 | [diff] [blame] | 8700 | snd_hda_codec_read(codec, 0x1b, 0, AC_VERB_SET_PIN_SENSE, 0); |
| 8701 | present = snd_hda_codec_read(codec, 0x1b, 0, |
| 8702 | AC_VERB_GET_PIN_SENSE, 0); |
| 8703 | present = (present & 0x80000000) != 0; |
| 8704 | if (present) { |
Kailang Yang | ccc656c | 2006-10-17 12:32:26 +0200 | [diff] [blame] | 8705 | /* mute internal speaker */ |
Takashi Iwai | 47fd830 | 2007-08-10 17:11:07 +0200 | [diff] [blame] | 8706 | snd_hda_codec_amp_stereo(codec, 0x14, HDA_OUTPUT, 0, |
| 8707 | HDA_AMP_MUTE, HDA_AMP_MUTE); |
Kailang Yang | ccc656c | 2006-10-17 12:32:26 +0200 | [diff] [blame] | 8708 | } else { |
| 8709 | /* unmute internal speaker if necessary */ |
| 8710 | mute = snd_hda_codec_amp_read(codec, 0x1b, 0, HDA_OUTPUT, 0); |
Takashi Iwai | 47fd830 | 2007-08-10 17:11:07 +0200 | [diff] [blame] | 8711 | snd_hda_codec_amp_stereo(codec, 0x14, HDA_OUTPUT, 0, |
| 8712 | HDA_AMP_MUTE, mute); |
Kailang Yang | ccc656c | 2006-10-17 12:32:26 +0200 | [diff] [blame] | 8713 | } |
| 8714 | } |
| 8715 | |
| 8716 | /* unsolicited event for HP jack sensing */ |
| 8717 | static void alc262_hippo1_unsol_event(struct hda_codec *codec, |
| 8718 | unsigned int res) |
| 8719 | { |
| 8720 | if ((res >> 26) != ALC880_HP_EVENT) |
| 8721 | return; |
Takashi Iwai | 5b31954 | 2007-07-26 11:49:22 +0200 | [diff] [blame] | 8722 | alc262_hippo1_automute(codec); |
Kailang Yang | ccc656c | 2006-10-17 12:32:26 +0200 | [diff] [blame] | 8723 | } |
| 8724 | |
Takashi Iwai | 834be88 | 2006-03-01 14:16:17 +0100 | [diff] [blame] | 8725 | /* |
| 8726 | * fujitsu model |
| 8727 | * 0x14 = headphone/spdif-out, 0x15 = internal speaker |
| 8728 | */ |
| 8729 | |
| 8730 | #define ALC_HP_EVENT 0x37 |
| 8731 | |
| 8732 | static struct hda_verb alc262_fujitsu_unsol_verbs[] = { |
| 8733 | {0x14, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC_HP_EVENT}, |
| 8734 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 8735 | {} |
| 8736 | }; |
| 8737 | |
| 8738 | static struct hda_input_mux alc262_fujitsu_capture_source = { |
Takashi Iwai | 39d3ed3 | 2007-10-12 15:03:48 +0200 | [diff] [blame] | 8739 | .num_items = 3, |
Takashi Iwai | 834be88 | 2006-03-01 14:16:17 +0100 | [diff] [blame] | 8740 | .items = { |
| 8741 | { "Mic", 0x0 }, |
Takashi Iwai | 39d3ed3 | 2007-10-12 15:03:48 +0200 | [diff] [blame] | 8742 | { "Int Mic", 0x1 }, |
Takashi Iwai | 834be88 | 2006-03-01 14:16:17 +0100 | [diff] [blame] | 8743 | { "CD", 0x4 }, |
| 8744 | }, |
| 8745 | }; |
| 8746 | |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 8747 | static struct hda_input_mux alc262_HP_capture_source = { |
| 8748 | .num_items = 5, |
| 8749 | .items = { |
| 8750 | { "Mic", 0x0 }, |
zhejiang | accbe49 | 2007-08-31 12:36:05 +0200 | [diff] [blame] | 8751 | { "Front Mic", 0x1 }, |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 8752 | { "Line", 0x2 }, |
| 8753 | { "CD", 0x4 }, |
| 8754 | { "AUX IN", 0x6 }, |
| 8755 | }, |
| 8756 | }; |
| 8757 | |
zhejiang | accbe49 | 2007-08-31 12:36:05 +0200 | [diff] [blame] | 8758 | static struct hda_input_mux alc262_HP_D7000_capture_source = { |
| 8759 | .num_items = 4, |
| 8760 | .items = { |
| 8761 | { "Mic", 0x0 }, |
| 8762 | { "Front Mic", 0x2 }, |
| 8763 | { "Line", 0x1 }, |
| 8764 | { "CD", 0x4 }, |
| 8765 | }, |
| 8766 | }; |
| 8767 | |
Takashi Iwai | 834be88 | 2006-03-01 14:16:17 +0100 | [diff] [blame] | 8768 | /* mute/unmute internal speaker according to the hp jack and mute state */ |
| 8769 | static void alc262_fujitsu_automute(struct hda_codec *codec, int force) |
| 8770 | { |
| 8771 | struct alc_spec *spec = codec->spec; |
| 8772 | unsigned int mute; |
| 8773 | |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 8774 | if (force || !spec->sense_updated) { |
Takashi Iwai | 834be88 | 2006-03-01 14:16:17 +0100 | [diff] [blame] | 8775 | unsigned int present; |
| 8776 | /* need to execute and sync at first */ |
| 8777 | snd_hda_codec_read(codec, 0x14, 0, AC_VERB_SET_PIN_SENSE, 0); |
| 8778 | present = snd_hda_codec_read(codec, 0x14, 0, |
| 8779 | AC_VERB_GET_PIN_SENSE, 0); |
| 8780 | spec->jack_present = (present & 0x80000000) != 0; |
| 8781 | spec->sense_updated = 1; |
| 8782 | } |
| 8783 | if (spec->jack_present) { |
| 8784 | /* mute internal speaker */ |
Takashi Iwai | 47fd830 | 2007-08-10 17:11:07 +0200 | [diff] [blame] | 8785 | snd_hda_codec_amp_stereo(codec, 0x15, HDA_OUTPUT, 0, |
| 8786 | HDA_AMP_MUTE, HDA_AMP_MUTE); |
Takashi Iwai | 834be88 | 2006-03-01 14:16:17 +0100 | [diff] [blame] | 8787 | } else { |
| 8788 | /* unmute internal speaker if necessary */ |
| 8789 | mute = snd_hda_codec_amp_read(codec, 0x14, 0, HDA_OUTPUT, 0); |
Takashi Iwai | 47fd830 | 2007-08-10 17:11:07 +0200 | [diff] [blame] | 8790 | snd_hda_codec_amp_stereo(codec, 0x15, HDA_OUTPUT, 0, |
| 8791 | HDA_AMP_MUTE, mute); |
Takashi Iwai | 834be88 | 2006-03-01 14:16:17 +0100 | [diff] [blame] | 8792 | } |
| 8793 | } |
| 8794 | |
| 8795 | /* unsolicited event for HP jack sensing */ |
| 8796 | static void alc262_fujitsu_unsol_event(struct hda_codec *codec, |
| 8797 | unsigned int res) |
| 8798 | { |
| 8799 | if ((res >> 26) != ALC_HP_EVENT) |
| 8800 | return; |
| 8801 | alc262_fujitsu_automute(codec, 1); |
| 8802 | } |
| 8803 | |
| 8804 | /* bind volumes of both NID 0x0c and 0x0d */ |
Takashi Iwai | cca3b37 | 2007-08-10 17:12:15 +0200 | [diff] [blame] | 8805 | static struct hda_bind_ctls alc262_fujitsu_bind_master_vol = { |
| 8806 | .ops = &snd_hda_bind_vol, |
| 8807 | .values = { |
| 8808 | HDA_COMPOSE_AMP_VAL(0x0c, 3, 0, HDA_OUTPUT), |
| 8809 | HDA_COMPOSE_AMP_VAL(0x0d, 3, 0, HDA_OUTPUT), |
| 8810 | 0 |
| 8811 | }, |
| 8812 | }; |
Takashi Iwai | 834be88 | 2006-03-01 14:16:17 +0100 | [diff] [blame] | 8813 | |
| 8814 | /* bind hp and internal speaker mute (with plug check) */ |
| 8815 | static int alc262_fujitsu_master_sw_put(struct snd_kcontrol *kcontrol, |
| 8816 | struct snd_ctl_elem_value *ucontrol) |
| 8817 | { |
| 8818 | struct hda_codec *codec = snd_kcontrol_chip(kcontrol); |
| 8819 | long *valp = ucontrol->value.integer.value; |
| 8820 | int change; |
| 8821 | |
| 8822 | change = snd_hda_codec_amp_update(codec, 0x14, 0, HDA_OUTPUT, 0, |
Takashi Iwai | 47fd830 | 2007-08-10 17:11:07 +0200 | [diff] [blame] | 8823 | HDA_AMP_MUTE, |
| 8824 | valp[0] ? 0 : HDA_AMP_MUTE); |
Takashi Iwai | 834be88 | 2006-03-01 14:16:17 +0100 | [diff] [blame] | 8825 | change |= snd_hda_codec_amp_update(codec, 0x14, 1, HDA_OUTPUT, 0, |
Takashi Iwai | 47fd830 | 2007-08-10 17:11:07 +0200 | [diff] [blame] | 8826 | HDA_AMP_MUTE, |
| 8827 | valp[1] ? 0 : HDA_AMP_MUTE); |
Takashi Iwai | 82beb8f | 2007-08-10 17:09:26 +0200 | [diff] [blame] | 8828 | if (change) |
| 8829 | alc262_fujitsu_automute(codec, 0); |
Takashi Iwai | 834be88 | 2006-03-01 14:16:17 +0100 | [diff] [blame] | 8830 | return change; |
| 8831 | } |
| 8832 | |
| 8833 | static struct snd_kcontrol_new alc262_fujitsu_mixer[] = { |
Takashi Iwai | cca3b37 | 2007-08-10 17:12:15 +0200 | [diff] [blame] | 8834 | HDA_BIND_VOL("Master Playback Volume", &alc262_fujitsu_bind_master_vol), |
Takashi Iwai | 834be88 | 2006-03-01 14:16:17 +0100 | [diff] [blame] | 8835 | { |
| 8836 | .iface = SNDRV_CTL_ELEM_IFACE_MIXER, |
| 8837 | .name = "Master Playback Switch", |
| 8838 | .info = snd_hda_mixer_amp_switch_info, |
| 8839 | .get = snd_hda_mixer_amp_switch_get, |
| 8840 | .put = alc262_fujitsu_master_sw_put, |
| 8841 | .private_value = HDA_COMPOSE_AMP_VAL(0x14, 3, 0, HDA_OUTPUT), |
| 8842 | }, |
| 8843 | HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT), |
| 8844 | HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT), |
| 8845 | HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT), |
| 8846 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), |
| 8847 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), |
Takashi Iwai | 39d3ed3 | 2007-10-12 15:03:48 +0200 | [diff] [blame] | 8848 | HDA_CODEC_VOLUME("Int Mic Boost", 0x19, 0, HDA_INPUT), |
| 8849 | HDA_CODEC_VOLUME("Int Mic Playback Volume", 0x0b, 0x1, HDA_INPUT), |
| 8850 | HDA_CODEC_MUTE("Int Mic Playback Switch", 0x0b, 0x1, HDA_INPUT), |
Takashi Iwai | 834be88 | 2006-03-01 14:16:17 +0100 | [diff] [blame] | 8851 | { } /* end */ |
| 8852 | }; |
| 8853 | |
Takashi Iwai | 304dcaa | 2006-07-25 14:51:16 +0200 | [diff] [blame] | 8854 | /* additional init verbs for Benq laptops */ |
| 8855 | static struct hda_verb alc262_EAPD_verbs[] = { |
| 8856 | {0x20, AC_VERB_SET_COEF_INDEX, 0x07}, |
| 8857 | {0x20, AC_VERB_SET_PROC_COEF, 0x3070}, |
| 8858 | {} |
| 8859 | }; |
| 8860 | |
Kailang Yang | 83c3421 | 2007-07-05 11:43:05 +0200 | [diff] [blame] | 8861 | static struct hda_verb alc262_benq_t31_EAPD_verbs[] = { |
| 8862 | {0x15, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 8863 | {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24}, |
| 8864 | |
| 8865 | {0x20, AC_VERB_SET_COEF_INDEX, 0x07}, |
| 8866 | {0x20, AC_VERB_SET_PROC_COEF, 0x3050}, |
| 8867 | {} |
| 8868 | }; |
| 8869 | |
Tobin Davis | f651b50 | 2007-10-26 12:40:47 +0200 | [diff] [blame] | 8870 | /* Samsung Q1 Ultra Vista model setup */ |
| 8871 | static struct snd_kcontrol_new alc262_ultra_mixer[] = { |
| 8872 | HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT), |
| 8873 | HDA_CODEC_MUTE("Front Playback Switch", 0x14, 0x0, HDA_OUTPUT), |
| 8874 | HDA_CODEC_MUTE("Headphone Playback Switch", 0x15, 0x0, HDA_OUTPUT), |
| 8875 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x01, HDA_INPUT), |
| 8876 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x01, HDA_INPUT), |
| 8877 | HDA_CODEC_VOLUME("Mic Boost", 0x19, 0, HDA_INPUT), |
| 8878 | { } /* end */ |
| 8879 | }; |
| 8880 | |
| 8881 | static struct hda_verb alc262_ultra_verbs[] = { |
| 8882 | {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT}, |
| 8883 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 8884 | {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x40}, |
| 8885 | /* Mic is on Node 0x19 */ |
| 8886 | {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24}, |
| 8887 | {0x22, AC_VERB_SET_CONNECT_SEL, 0x01}, |
| 8888 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x01 << 8))}, |
| 8889 | {0x23, AC_VERB_SET_CONNECT_SEL, 0x01}, |
| 8890 | {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x01 << 8))}, |
| 8891 | {0x24, AC_VERB_SET_CONNECT_SEL, 0x01}, |
| 8892 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x01 << 8))}, |
| 8893 | {} |
| 8894 | }; |
| 8895 | |
| 8896 | static struct hda_input_mux alc262_ultra_capture_source = { |
| 8897 | .num_items = 1, |
| 8898 | .items = { |
| 8899 | { "Mic", 0x1 }, |
| 8900 | }, |
| 8901 | }; |
| 8902 | |
| 8903 | /* mute/unmute internal speaker according to the hp jack and mute state */ |
| 8904 | static void alc262_ultra_automute(struct hda_codec *codec) |
| 8905 | { |
| 8906 | struct alc_spec *spec = codec->spec; |
| 8907 | unsigned int mute; |
| 8908 | unsigned int present; |
| 8909 | |
| 8910 | /* need to execute and sync at first */ |
| 8911 | snd_hda_codec_read(codec, 0x15, 0, AC_VERB_SET_PIN_SENSE, 0); |
| 8912 | present = snd_hda_codec_read(codec, 0x15, 0, |
| 8913 | AC_VERB_GET_PIN_SENSE, 0); |
| 8914 | spec->jack_present = (present & 0x80000000) != 0; |
| 8915 | if (spec->jack_present) { |
| 8916 | /* mute internal speaker */ |
| 8917 | snd_hda_codec_amp_stereo(codec, 0x14, HDA_OUTPUT, 0, |
| 8918 | HDA_AMP_MUTE, HDA_AMP_MUTE); |
| 8919 | } else { |
| 8920 | /* unmute internal speaker if necessary */ |
| 8921 | mute = snd_hda_codec_amp_read(codec, 0x15, 0, HDA_OUTPUT, 0); |
| 8922 | snd_hda_codec_amp_stereo(codec, 0x14, HDA_OUTPUT, 0, |
| 8923 | HDA_AMP_MUTE, mute); |
| 8924 | } |
| 8925 | } |
| 8926 | |
| 8927 | /* unsolicited event for HP jack sensing */ |
| 8928 | static void alc262_ultra_unsol_event(struct hda_codec *codec, |
| 8929 | unsigned int res) |
| 8930 | { |
| 8931 | if ((res >> 26) != ALC880_HP_EVENT) |
| 8932 | return; |
| 8933 | alc262_ultra_automute(codec); |
| 8934 | } |
| 8935 | |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 8936 | /* add playback controls from the parsed DAC table */ |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 8937 | static int alc262_auto_create_multi_out_ctls(struct alc_spec *spec, |
| 8938 | const struct auto_pin_cfg *cfg) |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 8939 | { |
| 8940 | hda_nid_t nid; |
| 8941 | int err; |
| 8942 | |
| 8943 | spec->multiout.num_dacs = 1; /* only use one dac */ |
| 8944 | spec->multiout.dac_nids = spec->private_dac_nids; |
| 8945 | spec->multiout.dac_nids[0] = 2; |
| 8946 | |
| 8947 | nid = cfg->line_out_pins[0]; |
| 8948 | if (nid) { |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 8949 | err = add_control(spec, ALC_CTL_WIDGET_VOL, |
| 8950 | "Front Playback Volume", |
| 8951 | HDA_COMPOSE_AMP_VAL(0x0c, 3, 0, HDA_OUTPUT)); |
| 8952 | if (err < 0) |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 8953 | return err; |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 8954 | err = add_control(spec, ALC_CTL_WIDGET_MUTE, |
| 8955 | "Front Playback Switch", |
| 8956 | HDA_COMPOSE_AMP_VAL(nid, 3, 0, HDA_OUTPUT)); |
| 8957 | if (err < 0) |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 8958 | return err; |
| 8959 | } |
| 8960 | |
Takashi Iwai | 82bc955 | 2006-03-21 11:24:42 +0100 | [diff] [blame] | 8961 | nid = cfg->speaker_pins[0]; |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 8962 | if (nid) { |
| 8963 | if (nid == 0x16) { |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 8964 | err = add_control(spec, ALC_CTL_WIDGET_VOL, |
| 8965 | "Speaker Playback Volume", |
| 8966 | HDA_COMPOSE_AMP_VAL(0x0e, 2, 0, |
| 8967 | HDA_OUTPUT)); |
| 8968 | if (err < 0) |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 8969 | return err; |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 8970 | err = add_control(spec, ALC_CTL_WIDGET_MUTE, |
| 8971 | "Speaker Playback Switch", |
| 8972 | HDA_COMPOSE_AMP_VAL(nid, 2, 0, |
| 8973 | HDA_OUTPUT)); |
| 8974 | if (err < 0) |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 8975 | return err; |
| 8976 | } else { |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 8977 | err = add_control(spec, ALC_CTL_WIDGET_MUTE, |
| 8978 | "Speaker Playback Switch", |
| 8979 | HDA_COMPOSE_AMP_VAL(nid, 3, 0, |
| 8980 | HDA_OUTPUT)); |
| 8981 | if (err < 0) |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 8982 | return err; |
| 8983 | } |
| 8984 | } |
Takashi Iwai | eb06ed8 | 2006-09-20 17:10:27 +0200 | [diff] [blame] | 8985 | nid = cfg->hp_pins[0]; |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 8986 | if (nid) { |
| 8987 | /* spec->multiout.hp_nid = 2; */ |
| 8988 | if (nid == 0x16) { |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 8989 | err = add_control(spec, ALC_CTL_WIDGET_VOL, |
| 8990 | "Headphone Playback Volume", |
| 8991 | HDA_COMPOSE_AMP_VAL(0x0e, 2, 0, |
| 8992 | HDA_OUTPUT)); |
| 8993 | if (err < 0) |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 8994 | return err; |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 8995 | err = add_control(spec, ALC_CTL_WIDGET_MUTE, |
| 8996 | "Headphone Playback Switch", |
| 8997 | HDA_COMPOSE_AMP_VAL(nid, 2, 0, |
| 8998 | HDA_OUTPUT)); |
| 8999 | if (err < 0) |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 9000 | return err; |
| 9001 | } else { |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 9002 | err = add_control(spec, ALC_CTL_WIDGET_MUTE, |
| 9003 | "Headphone Playback Switch", |
| 9004 | HDA_COMPOSE_AMP_VAL(nid, 3, 0, |
| 9005 | HDA_OUTPUT)); |
| 9006 | if (err < 0) |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 9007 | return err; |
| 9008 | } |
| 9009 | } |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 9010 | return 0; |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 9011 | } |
| 9012 | |
| 9013 | /* identical with ALC880 */ |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 9014 | #define alc262_auto_create_analog_input_ctls \ |
| 9015 | alc880_auto_create_analog_input_ctls |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 9016 | |
| 9017 | /* |
| 9018 | * generic initialization of ADC, input mixers and output mixers |
| 9019 | */ |
| 9020 | static struct hda_verb alc262_volume_init_verbs[] = { |
| 9021 | /* |
| 9022 | * Unmute ADC0-2 and set the default input to mic-in |
| 9023 | */ |
| 9024 | {0x07, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 9025 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 9026 | {0x08, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 9027 | {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 9028 | {0x09, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 9029 | {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 9030 | |
Takashi Iwai | cb53c62 | 2007-08-10 17:21:45 +0200 | [diff] [blame] | 9031 | /* 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] | 9032 | * mixer widget |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 9033 | * Note: PASD motherboards uses the Line In 2 as the input for |
| 9034 | * front panel mic (mic 2) |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 9035 | */ |
| 9036 | /* Amp Indices: Mic1 = 0, Mic2 = 1, Line1 = 2, Line2 = 3, CD = 4 */ |
Takashi Iwai | cb53c62 | 2007-08-10 17:21:45 +0200 | [diff] [blame] | 9037 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 9038 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
| 9039 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)}, |
| 9040 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)}, |
| 9041 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)}, |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 9042 | |
| 9043 | /* |
| 9044 | * Set up output mixers (0x0c - 0x0f) |
| 9045 | */ |
| 9046 | /* set vol=0 to output mixers */ |
| 9047 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 9048 | {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 9049 | {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 9050 | |
| 9051 | /* set up input amps for analog loopback */ |
| 9052 | /* Amp Indices: DAC = 0, mixer = 1 */ |
| 9053 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 9054 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 9055 | {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 9056 | {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 9057 | {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 9058 | {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 9059 | |
| 9060 | /* FIXME: use matrix-type input source selection */ |
| 9061 | /* Mixer elements: 0x18, 19, 1a, 1b, 1c, 1d, 14, 15, 16, 17, 0b */ |
| 9062 | /* Input mixer1: unmute Mic, F-Mic, Line, CD inputs */ |
| 9063 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))}, |
| 9064 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x03 << 8))}, |
| 9065 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x02 << 8))}, |
| 9066 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x04 << 8))}, |
| 9067 | /* Input mixer2 */ |
| 9068 | {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))}, |
| 9069 | {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x03 << 8))}, |
| 9070 | {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x02 << 8))}, |
| 9071 | {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x04 << 8))}, |
| 9072 | /* Input mixer3 */ |
| 9073 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))}, |
| 9074 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x03 << 8))}, |
| 9075 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x02 << 8))}, |
| 9076 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x04 << 8))}, |
| 9077 | |
| 9078 | { } |
| 9079 | }; |
| 9080 | |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 9081 | static struct hda_verb alc262_HP_BPC_init_verbs[] = { |
| 9082 | /* |
| 9083 | * Unmute ADC0-2 and set the default input to mic-in |
| 9084 | */ |
| 9085 | {0x07, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 9086 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 9087 | {0x08, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 9088 | {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 9089 | {0x09, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 9090 | {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 9091 | |
Takashi Iwai | cb53c62 | 2007-08-10 17:21:45 +0200 | [diff] [blame] | 9092 | /* 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] | 9093 | * mixer widget |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 9094 | * Note: PASD motherboards uses the Line In 2 as the input for |
| 9095 | * front panel mic (mic 2) |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 9096 | */ |
| 9097 | /* Amp Indices: Mic1 = 0, Mic2 = 1, Line1 = 2, Line2 = 3, CD = 4 */ |
Takashi Iwai | cb53c62 | 2007-08-10 17:21:45 +0200 | [diff] [blame] | 9098 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 9099 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
| 9100 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)}, |
| 9101 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)}, |
| 9102 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)}, |
| 9103 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(5)}, |
| 9104 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(6)}, |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 9105 | |
| 9106 | /* |
| 9107 | * Set up output mixers (0x0c - 0x0e) |
| 9108 | */ |
| 9109 | /* set vol=0 to output mixers */ |
| 9110 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 9111 | {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 9112 | {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 9113 | |
| 9114 | /* set up input amps for analog loopback */ |
| 9115 | /* Amp Indices: DAC = 0, mixer = 1 */ |
| 9116 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 9117 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 9118 | {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 9119 | {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 9120 | {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 9121 | {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 9122 | |
Takashi Iwai | ce875f0 | 2008-01-28 18:17:43 +0100 | [diff] [blame] | 9123 | {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 9124 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, |
| 9125 | {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, |
| 9126 | |
| 9127 | {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE }, |
| 9128 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE }, |
| 9129 | |
| 9130 | {0x1b, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 9131 | {0x15, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 9132 | |
| 9133 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20}, |
| 9134 | {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24}, |
| 9135 | {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24}, |
| 9136 | {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20}, |
| 9137 | {0x1c, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20}, |
| 9138 | |
| 9139 | {0x14, AC_VERB_SET_AMP_GAIN_MUTE, 0x7023 }, |
| 9140 | {0x18, AC_VERB_SET_AMP_GAIN_MUTE, 0x7000 }, |
| 9141 | {0x19, AC_VERB_SET_AMP_GAIN_MUTE, 0x7000 }, |
| 9142 | {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, 0x7023 }, |
| 9143 | {0x1c, AC_VERB_SET_AMP_GAIN_MUTE, 0x7000 }, |
| 9144 | {0x1d, AC_VERB_SET_AMP_GAIN_MUTE, 0x7000 }, |
| 9145 | |
| 9146 | |
| 9147 | /* FIXME: use matrix-type input source selection */ |
| 9148 | /* Mixer elements: 0x18, 19, 1a, 1b, 1c, 1d, 14, 15, 16, 17, 0b */ |
| 9149 | /* Input mixer1: unmute Mic, F-Mic, Line, CD inputs */ |
| 9150 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))}, |
| 9151 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x03 << 8))}, |
| 9152 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x02 << 8))}, |
| 9153 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x04 << 8))}, |
| 9154 | /* Input mixer2 */ |
| 9155 | {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))}, |
| 9156 | {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x03 << 8))}, |
| 9157 | {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x02 << 8))}, |
| 9158 | {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x04 << 8))}, |
| 9159 | /* Input mixer3 */ |
| 9160 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))}, |
| 9161 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x03 << 8))}, |
| 9162 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x02 << 8))}, |
| 9163 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x04 << 8))}, |
| 9164 | |
Takashi Iwai | ce875f0 | 2008-01-28 18:17:43 +0100 | [diff] [blame] | 9165 | {0x1b, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN}, |
| 9166 | |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 9167 | { } |
| 9168 | }; |
| 9169 | |
Kailang Yang | cd7509a | 2007-01-26 18:33:17 +0100 | [diff] [blame] | 9170 | static struct hda_verb alc262_HP_BPC_WildWest_init_verbs[] = { |
| 9171 | /* |
| 9172 | * Unmute ADC0-2 and set the default input to mic-in |
| 9173 | */ |
| 9174 | {0x07, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 9175 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 9176 | {0x08, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 9177 | {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 9178 | {0x09, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 9179 | {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 9180 | |
Takashi Iwai | cb53c62 | 2007-08-10 17:21:45 +0200 | [diff] [blame] | 9181 | /* 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] | 9182 | * mixer widget |
| 9183 | * Note: PASD motherboards uses the Line In 2 as the input for front |
| 9184 | * panel mic (mic 2) |
| 9185 | */ |
| 9186 | /* Amp Indices: Mic1 = 0, Mic2 = 1, Line1 = 2, Line2 = 3, CD = 4 */ |
Takashi Iwai | cb53c62 | 2007-08-10 17:21:45 +0200 | [diff] [blame] | 9187 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 9188 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
| 9189 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)}, |
| 9190 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)}, |
| 9191 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)}, |
| 9192 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(5)}, |
| 9193 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(6)}, |
| 9194 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(7)}, |
Kailang Yang | cd7509a | 2007-01-26 18:33:17 +0100 | [diff] [blame] | 9195 | /* |
| 9196 | * Set up output mixers (0x0c - 0x0e) |
| 9197 | */ |
| 9198 | /* set vol=0 to output mixers */ |
| 9199 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 9200 | {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 9201 | {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 9202 | |
| 9203 | /* set up input amps for analog loopback */ |
| 9204 | /* Amp Indices: DAC = 0, mixer = 1 */ |
| 9205 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 9206 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 9207 | {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 9208 | {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 9209 | {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 9210 | {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 9211 | |
| 9212 | |
| 9213 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP }, /* HP */ |
| 9214 | {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, /* Mono */ |
| 9215 | {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80 }, /* rear MIC */ |
| 9216 | {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN }, /* Line in */ |
| 9217 | {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80 }, /* Front MIC */ |
| 9218 | {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, /* Line out */ |
| 9219 | {0x1c, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN }, /* CD in */ |
| 9220 | |
| 9221 | {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE }, |
| 9222 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE }, |
| 9223 | |
| 9224 | {0x1b, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 9225 | {0x15, AC_VERB_SET_CONNECT_SEL, 0x01}, |
| 9226 | |
| 9227 | /* {0x14, AC_VERB_SET_AMP_GAIN_MUTE, 0x7023 }, */ |
| 9228 | {0x18, AC_VERB_SET_AMP_GAIN_MUTE, 0x7000 }, |
| 9229 | {0x19, AC_VERB_SET_AMP_GAIN_MUTE, 0x7000 }, |
| 9230 | {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, 0x7023 }, |
| 9231 | {0x1c, AC_VERB_SET_AMP_GAIN_MUTE, 0x7000 }, |
| 9232 | {0x1d, AC_VERB_SET_AMP_GAIN_MUTE, 0x7000 }, |
| 9233 | |
| 9234 | /* FIXME: use matrix-type input source selection */ |
| 9235 | /* Mixer elements: 0x18, 19, 1a, 1b, 1c, 1d, 14, 15, 16, 17, 0b */ |
| 9236 | /* Input mixer1: unmute Mic, F-Mic, Line, CD inputs */ |
| 9237 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))}, /*rear MIC*/ |
| 9238 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x01 << 8))}, /*Line in*/ |
| 9239 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x02 << 8))}, /*F MIC*/ |
| 9240 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x03 << 8))}, /*Front*/ |
| 9241 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x04 << 8))}, /*CD*/ |
| 9242 | /* {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x06 << 8))}, */ |
| 9243 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x07 << 8))}, /*HP*/ |
| 9244 | /* Input mixer2 */ |
| 9245 | {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))}, |
| 9246 | {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x01 << 8))}, |
| 9247 | {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x02 << 8))}, |
| 9248 | {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x03 << 8))}, |
| 9249 | {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x04 << 8))}, |
| 9250 | /* {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x06 << 8))}, */ |
| 9251 | {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x07 << 8))}, |
| 9252 | /* Input mixer3 */ |
| 9253 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))}, |
| 9254 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x01 << 8))}, |
| 9255 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x02 << 8))}, |
| 9256 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x03 << 8))}, |
| 9257 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x04 << 8))}, |
| 9258 | /* {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x06 << 8))}, */ |
| 9259 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x07 << 8))}, |
| 9260 | |
Takashi Iwai | ce875f0 | 2008-01-28 18:17:43 +0100 | [diff] [blame] | 9261 | {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN}, |
| 9262 | |
Kailang Yang | cd7509a | 2007-01-26 18:33:17 +0100 | [diff] [blame] | 9263 | { } |
| 9264 | }; |
| 9265 | |
Takashi Iwai | cb53c62 | 2007-08-10 17:21:45 +0200 | [diff] [blame] | 9266 | #ifdef CONFIG_SND_HDA_POWER_SAVE |
| 9267 | #define alc262_loopbacks alc880_loopbacks |
| 9268 | #endif |
| 9269 | |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 9270 | /* pcm configuration: identiacal with ALC880 */ |
| 9271 | #define alc262_pcm_analog_playback alc880_pcm_analog_playback |
| 9272 | #define alc262_pcm_analog_capture alc880_pcm_analog_capture |
| 9273 | #define alc262_pcm_digital_playback alc880_pcm_digital_playback |
| 9274 | #define alc262_pcm_digital_capture alc880_pcm_digital_capture |
| 9275 | |
| 9276 | /* |
| 9277 | * BIOS auto configuration |
| 9278 | */ |
| 9279 | static int alc262_parse_auto_config(struct hda_codec *codec) |
| 9280 | { |
| 9281 | struct alc_spec *spec = codec->spec; |
| 9282 | int err; |
| 9283 | static hda_nid_t alc262_ignore[] = { 0x1d, 0 }; |
| 9284 | |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 9285 | err = snd_hda_parse_pin_def_config(codec, &spec->autocfg, |
| 9286 | alc262_ignore); |
| 9287 | if (err < 0) |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 9288 | return err; |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 9289 | if (!spec->autocfg.line_outs) |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 9290 | return 0; /* can't find valid BIOS pin config */ |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 9291 | err = alc262_auto_create_multi_out_ctls(spec, &spec->autocfg); |
| 9292 | if (err < 0) |
| 9293 | return err; |
| 9294 | err = alc262_auto_create_analog_input_ctls(spec, &spec->autocfg); |
| 9295 | if (err < 0) |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 9296 | return err; |
| 9297 | |
| 9298 | spec->multiout.max_channels = spec->multiout.num_dacs * 2; |
| 9299 | |
| 9300 | if (spec->autocfg.dig_out_pin) |
| 9301 | spec->multiout.dig_out_nid = ALC262_DIGOUT_NID; |
| 9302 | if (spec->autocfg.dig_in_pin) |
| 9303 | spec->dig_in_nid = ALC262_DIGIN_NID; |
| 9304 | |
| 9305 | if (spec->kctl_alloc) |
| 9306 | spec->mixers[spec->num_mixers++] = spec->kctl_alloc; |
| 9307 | |
| 9308 | spec->init_verbs[spec->num_init_verbs++] = alc262_volume_init_verbs; |
Jonathan Woithe | a1e8d2d | 2006-03-28 12:47:09 +0200 | [diff] [blame] | 9309 | spec->num_mux_defs = 1; |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 9310 | spec->input_mux = &spec->private_imux; |
| 9311 | |
Takashi Iwai | 776e184 | 2007-08-29 15:07:11 +0200 | [diff] [blame] | 9312 | err = alc_auto_add_mic_boost(codec); |
| 9313 | if (err < 0) |
| 9314 | return err; |
| 9315 | |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 9316 | return 1; |
| 9317 | } |
| 9318 | |
| 9319 | #define alc262_auto_init_multi_out alc882_auto_init_multi_out |
| 9320 | #define alc262_auto_init_hp_out alc882_auto_init_hp_out |
| 9321 | #define alc262_auto_init_analog_input alc882_auto_init_analog_input |
| 9322 | |
| 9323 | |
| 9324 | /* init callback for auto-configuration model -- overriding the default init */ |
Takashi Iwai | ae6b813 | 2006-03-03 16:47:17 +0100 | [diff] [blame] | 9325 | static void alc262_auto_init(struct hda_codec *codec) |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 9326 | { |
Takashi Iwai | f6c7e54 | 2008-02-12 18:32:23 +0100 | [diff] [blame] | 9327 | struct alc_spec *spec = codec->spec; |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 9328 | alc262_auto_init_multi_out(codec); |
| 9329 | alc262_auto_init_hp_out(codec); |
| 9330 | alc262_auto_init_analog_input(codec); |
Takashi Iwai | f6c7e54 | 2008-02-12 18:32:23 +0100 | [diff] [blame] | 9331 | if (spec->unsol_event) |
| 9332 | alc_sku_automute(codec); |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 9333 | } |
| 9334 | |
| 9335 | /* |
| 9336 | * configuration and preset |
| 9337 | */ |
Takashi Iwai | f5fcc13 | 2006-11-24 17:07:44 +0100 | [diff] [blame] | 9338 | static const char *alc262_models[ALC262_MODEL_LAST] = { |
| 9339 | [ALC262_BASIC] = "basic", |
| 9340 | [ALC262_HIPPO] = "hippo", |
| 9341 | [ALC262_HIPPO_1] = "hippo_1", |
| 9342 | [ALC262_FUJITSU] = "fujitsu", |
| 9343 | [ALC262_HP_BPC] = "hp-bpc", |
Kailang Yang | cd7509a | 2007-01-26 18:33:17 +0100 | [diff] [blame] | 9344 | [ALC262_HP_BPC_D7000_WL]= "hp-bpc-d7000", |
Takashi Iwai | 61dc35d | 2007-11-14 12:26:44 +0100 | [diff] [blame] | 9345 | [ALC262_HP_TC_T5735] = "hp-tc-t5735", |
Kailang Yang | 8c42722 | 2008-01-10 13:03:59 +0100 | [diff] [blame] | 9346 | [ALC262_HP_RP5700] = "hp-rp5700", |
Takashi Iwai | f5fcc13 | 2006-11-24 17:07:44 +0100 | [diff] [blame] | 9347 | [ALC262_BENQ_ED8] = "benq", |
Takashi Iwai | 0f40502 | 2007-07-06 12:24:11 +0200 | [diff] [blame] | 9348 | [ALC262_BENQ_T31] = "benq-t31", |
| 9349 | [ALC262_SONY_ASSAMD] = "sony-assamd", |
Tobin Davis | f651b50 | 2007-10-26 12:40:47 +0200 | [diff] [blame] | 9350 | [ALC262_ULTRA] = "ultra", |
Takashi Iwai | f5fcc13 | 2006-11-24 17:07:44 +0100 | [diff] [blame] | 9351 | [ALC262_AUTO] = "auto", |
| 9352 | }; |
| 9353 | |
| 9354 | static struct snd_pci_quirk alc262_cfg_tbl[] = { |
| 9355 | SND_PCI_QUIRK(0x1002, 0x437b, "Hippo", ALC262_HIPPO), |
| 9356 | SND_PCI_QUIRK(0x103c, 0x12fe, "HP xw9400", ALC262_HP_BPC), |
Kailang Yang | 7d87de2 | 2007-06-05 12:17:21 +0200 | [diff] [blame] | 9357 | SND_PCI_QUIRK(0x103c, 0x12ff, "HP xw4550", ALC262_HP_BPC), |
Takashi Iwai | ac3e374 | 2007-12-17 17:14:18 +0100 | [diff] [blame] | 9358 | SND_PCI_QUIRK(0x103c, 0x1306, "HP xw8600", ALC262_HP_BPC), |
| 9359 | SND_PCI_QUIRK(0x103c, 0x1307, "HP xw6600", ALC262_HP_BPC), |
Kailang Yang | 7d87de2 | 2007-06-05 12:17:21 +0200 | [diff] [blame] | 9360 | SND_PCI_QUIRK(0x103c, 0x1308, "HP xw4600", ALC262_HP_BPC), |
Takashi Iwai | b98f933 | 2007-11-07 14:18:01 +0100 | [diff] [blame] | 9361 | SND_PCI_QUIRK(0x103c, 0x1309, "HP xw4*00", ALC262_HP_BPC), |
Takashi Iwai | b98f933 | 2007-11-07 14:18:01 +0100 | [diff] [blame] | 9362 | SND_PCI_QUIRK(0x103c, 0x130a, "HP xw6*00", ALC262_HP_BPC), |
Takashi Iwai | b98f933 | 2007-11-07 14:18:01 +0100 | [diff] [blame] | 9363 | SND_PCI_QUIRK(0x103c, 0x130b, "HP xw8*00", ALC262_HP_BPC), |
Kailang Yang | cd7509a | 2007-01-26 18:33:17 +0100 | [diff] [blame] | 9364 | SND_PCI_QUIRK(0x103c, 0x2800, "HP D7000", ALC262_HP_BPC_D7000_WL), |
Kailang Yang | cd7509a | 2007-01-26 18:33:17 +0100 | [diff] [blame] | 9365 | SND_PCI_QUIRK(0x103c, 0x2801, "HP D7000", ALC262_HP_BPC_D7000_WF), |
Takashi Iwai | ac3e374 | 2007-12-17 17:14:18 +0100 | [diff] [blame] | 9366 | SND_PCI_QUIRK(0x103c, 0x2802, "HP D7000", ALC262_HP_BPC_D7000_WL), |
Kailang Yang | cd7509a | 2007-01-26 18:33:17 +0100 | [diff] [blame] | 9367 | SND_PCI_QUIRK(0x103c, 0x2803, "HP D7000", ALC262_HP_BPC_D7000_WF), |
Takashi Iwai | ac3e374 | 2007-12-17 17:14:18 +0100 | [diff] [blame] | 9368 | SND_PCI_QUIRK(0x103c, 0x2804, "HP D7000", ALC262_HP_BPC_D7000_WL), |
Kailang Yang | cd7509a | 2007-01-26 18:33:17 +0100 | [diff] [blame] | 9369 | SND_PCI_QUIRK(0x103c, 0x2805, "HP D7000", ALC262_HP_BPC_D7000_WF), |
Takashi Iwai | ac3e374 | 2007-12-17 17:14:18 +0100 | [diff] [blame] | 9370 | SND_PCI_QUIRK(0x103c, 0x2806, "HP D7000", ALC262_HP_BPC_D7000_WL), |
Kailang Yang | cd7509a | 2007-01-26 18:33:17 +0100 | [diff] [blame] | 9371 | SND_PCI_QUIRK(0x103c, 0x2807, "HP D7000", ALC262_HP_BPC_D7000_WF), |
Takashi Iwai | ac3e374 | 2007-12-17 17:14:18 +0100 | [diff] [blame] | 9372 | SND_PCI_QUIRK(0x103c, 0x280c, "HP xw4400", ALC262_HP_BPC), |
| 9373 | SND_PCI_QUIRK(0x103c, 0x3014, "HP xw6400", ALC262_HP_BPC), |
| 9374 | SND_PCI_QUIRK(0x103c, 0x3015, "HP xw8400", ALC262_HP_BPC), |
Kailang Yang | 66d2a9d | 2007-11-14 12:06:21 +0100 | [diff] [blame] | 9375 | SND_PCI_QUIRK(0x103c, 0x302f, "HP Thin Client T5735", |
| 9376 | ALC262_HP_TC_T5735), |
Kailang Yang | 8c42722 | 2008-01-10 13:03:59 +0100 | [diff] [blame] | 9377 | SND_PCI_QUIRK(0x103c, 0x2817, "HP RP5700", ALC262_HP_RP5700), |
Takashi Iwai | ac3e374 | 2007-12-17 17:14:18 +0100 | [diff] [blame] | 9378 | SND_PCI_QUIRK(0x104d, 0x1f00, "Sony ASSAMD", ALC262_SONY_ASSAMD), |
Takashi Iwai | f5fcc13 | 2006-11-24 17:07:44 +0100 | [diff] [blame] | 9379 | SND_PCI_QUIRK(0x104d, 0x8203, "Sony UX-90", ALC262_HIPPO), |
Takashi Iwai | ac3e374 | 2007-12-17 17:14:18 +0100 | [diff] [blame] | 9380 | SND_PCI_QUIRK(0x104d, 0x820f, "Sony ASSAMD", ALC262_SONY_ASSAMD), |
| 9381 | SND_PCI_QUIRK(0x104d, 0x900e, "Sony ASSAMD", ALC262_SONY_ASSAMD), |
| 9382 | SND_PCI_QUIRK(0x104d, 0x9015, "Sony 0x9015", ALC262_SONY_ASSAMD), |
Takashi Iwai | f5fcc13 | 2006-11-24 17:07:44 +0100 | [diff] [blame] | 9383 | SND_PCI_QUIRK(0x10cf, 0x1397, "Fujitsu", ALC262_FUJITSU), |
Tony Vroon | 3f1eeae | 2008-02-25 16:44:13 +0100 | [diff] [blame] | 9384 | SND_PCI_QUIRK(0x10cf, 0x142d, "Fujitsu Lifebook E8410", ALC262_FUJITSU), |
Takashi Iwai | ac3e374 | 2007-12-17 17:14:18 +0100 | [diff] [blame] | 9385 | SND_PCI_QUIRK(0x144d, 0xc032, "Samsung Q1 Ultra", ALC262_ULTRA), |
Takashi Iwai | f5fcc13 | 2006-11-24 17:07:44 +0100 | [diff] [blame] | 9386 | SND_PCI_QUIRK(0x17ff, 0x0560, "Benq ED8", ALC262_BENQ_ED8), |
Kailang Yang | 83c3421 | 2007-07-05 11:43:05 +0200 | [diff] [blame] | 9387 | SND_PCI_QUIRK(0x17ff, 0x058d, "Benq T31-16", ALC262_BENQ_T31), |
Takashi Iwai | ac3e374 | 2007-12-17 17:14:18 +0100 | [diff] [blame] | 9388 | SND_PCI_QUIRK(0x17ff, 0x058f, "Benq Hippo", ALC262_HIPPO_1), |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 9389 | {} |
| 9390 | }; |
| 9391 | |
| 9392 | static struct alc_config_preset alc262_presets[] = { |
| 9393 | [ALC262_BASIC] = { |
| 9394 | .mixers = { alc262_base_mixer }, |
| 9395 | .init_verbs = { alc262_init_verbs }, |
| 9396 | .num_dacs = ARRAY_SIZE(alc262_dac_nids), |
| 9397 | .dac_nids = alc262_dac_nids, |
| 9398 | .hp_nid = 0x03, |
| 9399 | .num_channel_mode = ARRAY_SIZE(alc262_modes), |
| 9400 | .channel_mode = alc262_modes, |
Takashi Iwai | a3bcba3 | 2005-12-06 19:05:29 +0100 | [diff] [blame] | 9401 | .input_mux = &alc262_capture_source, |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 9402 | }, |
Kailang Yang | ccc656c | 2006-10-17 12:32:26 +0200 | [diff] [blame] | 9403 | [ALC262_HIPPO] = { |
| 9404 | .mixers = { alc262_base_mixer }, |
| 9405 | .init_verbs = { alc262_init_verbs, alc262_hippo_unsol_verbs}, |
| 9406 | .num_dacs = ARRAY_SIZE(alc262_dac_nids), |
| 9407 | .dac_nids = alc262_dac_nids, |
| 9408 | .hp_nid = 0x03, |
| 9409 | .dig_out_nid = ALC262_DIGOUT_NID, |
| 9410 | .num_channel_mode = ARRAY_SIZE(alc262_modes), |
| 9411 | .channel_mode = alc262_modes, |
| 9412 | .input_mux = &alc262_capture_source, |
| 9413 | .unsol_event = alc262_hippo_unsol_event, |
Takashi Iwai | 5b31954 | 2007-07-26 11:49:22 +0200 | [diff] [blame] | 9414 | .init_hook = alc262_hippo_automute, |
Kailang Yang | ccc656c | 2006-10-17 12:32:26 +0200 | [diff] [blame] | 9415 | }, |
| 9416 | [ALC262_HIPPO_1] = { |
| 9417 | .mixers = { alc262_hippo1_mixer }, |
| 9418 | .init_verbs = { alc262_init_verbs, alc262_hippo1_unsol_verbs}, |
| 9419 | .num_dacs = ARRAY_SIZE(alc262_dac_nids), |
| 9420 | .dac_nids = alc262_dac_nids, |
| 9421 | .hp_nid = 0x02, |
| 9422 | .dig_out_nid = ALC262_DIGOUT_NID, |
| 9423 | .num_channel_mode = ARRAY_SIZE(alc262_modes), |
| 9424 | .channel_mode = alc262_modes, |
| 9425 | .input_mux = &alc262_capture_source, |
| 9426 | .unsol_event = alc262_hippo1_unsol_event, |
Takashi Iwai | 5b31954 | 2007-07-26 11:49:22 +0200 | [diff] [blame] | 9427 | .init_hook = alc262_hippo1_automute, |
Kailang Yang | ccc656c | 2006-10-17 12:32:26 +0200 | [diff] [blame] | 9428 | }, |
Takashi Iwai | 834be88 | 2006-03-01 14:16:17 +0100 | [diff] [blame] | 9429 | [ALC262_FUJITSU] = { |
| 9430 | .mixers = { alc262_fujitsu_mixer }, |
Takashi Iwai | 39d3ed3 | 2007-10-12 15:03:48 +0200 | [diff] [blame] | 9431 | .init_verbs = { alc262_init_verbs, alc262_EAPD_verbs, |
| 9432 | alc262_fujitsu_unsol_verbs }, |
Takashi Iwai | 834be88 | 2006-03-01 14:16:17 +0100 | [diff] [blame] | 9433 | .num_dacs = ARRAY_SIZE(alc262_dac_nids), |
| 9434 | .dac_nids = alc262_dac_nids, |
| 9435 | .hp_nid = 0x03, |
| 9436 | .dig_out_nid = ALC262_DIGOUT_NID, |
| 9437 | .num_channel_mode = ARRAY_SIZE(alc262_modes), |
| 9438 | .channel_mode = alc262_modes, |
| 9439 | .input_mux = &alc262_fujitsu_capture_source, |
Takashi Iwai | ae6b813 | 2006-03-03 16:47:17 +0100 | [diff] [blame] | 9440 | .unsol_event = alc262_fujitsu_unsol_event, |
Takashi Iwai | 834be88 | 2006-03-01 14:16:17 +0100 | [diff] [blame] | 9441 | }, |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 9442 | [ALC262_HP_BPC] = { |
| 9443 | .mixers = { alc262_HP_BPC_mixer }, |
| 9444 | .init_verbs = { alc262_HP_BPC_init_verbs }, |
| 9445 | .num_dacs = ARRAY_SIZE(alc262_dac_nids), |
| 9446 | .dac_nids = alc262_dac_nids, |
| 9447 | .hp_nid = 0x03, |
| 9448 | .num_channel_mode = ARRAY_SIZE(alc262_modes), |
| 9449 | .channel_mode = alc262_modes, |
| 9450 | .input_mux = &alc262_HP_capture_source, |
Takashi Iwai | ce875f0 | 2008-01-28 18:17:43 +0100 | [diff] [blame] | 9451 | .unsol_event = alc262_hp_bpc_unsol_event, |
| 9452 | .init_hook = alc262_hp_bpc_automute, |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 9453 | }, |
Kailang Yang | cd7509a | 2007-01-26 18:33:17 +0100 | [diff] [blame] | 9454 | [ALC262_HP_BPC_D7000_WF] = { |
| 9455 | .mixers = { alc262_HP_BPC_WildWest_mixer }, |
| 9456 | .init_verbs = { alc262_HP_BPC_WildWest_init_verbs }, |
| 9457 | .num_dacs = ARRAY_SIZE(alc262_dac_nids), |
| 9458 | .dac_nids = alc262_dac_nids, |
| 9459 | .hp_nid = 0x03, |
| 9460 | .num_channel_mode = ARRAY_SIZE(alc262_modes), |
| 9461 | .channel_mode = alc262_modes, |
zhejiang | accbe49 | 2007-08-31 12:36:05 +0200 | [diff] [blame] | 9462 | .input_mux = &alc262_HP_D7000_capture_source, |
Takashi Iwai | ce875f0 | 2008-01-28 18:17:43 +0100 | [diff] [blame] | 9463 | .unsol_event = alc262_hp_wildwest_unsol_event, |
| 9464 | .init_hook = alc262_hp_wildwest_automute, |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 9465 | }, |
Kailang Yang | cd7509a | 2007-01-26 18:33:17 +0100 | [diff] [blame] | 9466 | [ALC262_HP_BPC_D7000_WL] = { |
| 9467 | .mixers = { alc262_HP_BPC_WildWest_mixer, |
| 9468 | alc262_HP_BPC_WildWest_option_mixer }, |
| 9469 | .init_verbs = { alc262_HP_BPC_WildWest_init_verbs }, |
| 9470 | .num_dacs = ARRAY_SIZE(alc262_dac_nids), |
| 9471 | .dac_nids = alc262_dac_nids, |
| 9472 | .hp_nid = 0x03, |
| 9473 | .num_channel_mode = ARRAY_SIZE(alc262_modes), |
| 9474 | .channel_mode = alc262_modes, |
zhejiang | accbe49 | 2007-08-31 12:36:05 +0200 | [diff] [blame] | 9475 | .input_mux = &alc262_HP_D7000_capture_source, |
Takashi Iwai | ce875f0 | 2008-01-28 18:17:43 +0100 | [diff] [blame] | 9476 | .unsol_event = alc262_hp_wildwest_unsol_event, |
| 9477 | .init_hook = alc262_hp_wildwest_automute, |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 9478 | }, |
Kailang Yang | 66d2a9d | 2007-11-14 12:06:21 +0100 | [diff] [blame] | 9479 | [ALC262_HP_TC_T5735] = { |
| 9480 | .mixers = { alc262_hp_t5735_mixer }, |
| 9481 | .init_verbs = { alc262_init_verbs, alc262_hp_t5735_verbs }, |
| 9482 | .num_dacs = ARRAY_SIZE(alc262_dac_nids), |
| 9483 | .dac_nids = alc262_dac_nids, |
| 9484 | .hp_nid = 0x03, |
| 9485 | .num_channel_mode = ARRAY_SIZE(alc262_modes), |
| 9486 | .channel_mode = alc262_modes, |
| 9487 | .input_mux = &alc262_capture_source, |
| 9488 | .unsol_event = alc262_hp_t5735_unsol_event, |
| 9489 | .init_hook = alc262_hp_t5735_init_hook, |
Kailang Yang | 8c42722 | 2008-01-10 13:03:59 +0100 | [diff] [blame] | 9490 | }, |
| 9491 | [ALC262_HP_RP5700] = { |
| 9492 | .mixers = { alc262_hp_rp5700_mixer }, |
| 9493 | .init_verbs = { alc262_init_verbs, alc262_hp_rp5700_verbs }, |
| 9494 | .num_dacs = ARRAY_SIZE(alc262_dac_nids), |
| 9495 | .dac_nids = alc262_dac_nids, |
| 9496 | .num_channel_mode = ARRAY_SIZE(alc262_modes), |
| 9497 | .channel_mode = alc262_modes, |
| 9498 | .input_mux = &alc262_hp_rp5700_capture_source, |
Kailang Yang | 66d2a9d | 2007-11-14 12:06:21 +0100 | [diff] [blame] | 9499 | }, |
Takashi Iwai | 304dcaa | 2006-07-25 14:51:16 +0200 | [diff] [blame] | 9500 | [ALC262_BENQ_ED8] = { |
| 9501 | .mixers = { alc262_base_mixer }, |
| 9502 | .init_verbs = { alc262_init_verbs, alc262_EAPD_verbs }, |
| 9503 | .num_dacs = ARRAY_SIZE(alc262_dac_nids), |
| 9504 | .dac_nids = alc262_dac_nids, |
| 9505 | .hp_nid = 0x03, |
| 9506 | .num_channel_mode = ARRAY_SIZE(alc262_modes), |
| 9507 | .channel_mode = alc262_modes, |
| 9508 | .input_mux = &alc262_capture_source, |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 9509 | }, |
Kailang Yang | 272a527 | 2007-05-14 11:00:38 +0200 | [diff] [blame] | 9510 | [ALC262_SONY_ASSAMD] = { |
| 9511 | .mixers = { alc262_sony_mixer }, |
| 9512 | .init_verbs = { alc262_init_verbs, alc262_sony_unsol_verbs}, |
| 9513 | .num_dacs = ARRAY_SIZE(alc262_dac_nids), |
| 9514 | .dac_nids = alc262_dac_nids, |
| 9515 | .hp_nid = 0x02, |
| 9516 | .num_channel_mode = ARRAY_SIZE(alc262_modes), |
| 9517 | .channel_mode = alc262_modes, |
| 9518 | .input_mux = &alc262_capture_source, |
| 9519 | .unsol_event = alc262_hippo_unsol_event, |
Takashi Iwai | 5b31954 | 2007-07-26 11:49:22 +0200 | [diff] [blame] | 9520 | .init_hook = alc262_hippo_automute, |
Kailang Yang | 83c3421 | 2007-07-05 11:43:05 +0200 | [diff] [blame] | 9521 | }, |
| 9522 | [ALC262_BENQ_T31] = { |
| 9523 | .mixers = { alc262_benq_t31_mixer }, |
| 9524 | .init_verbs = { alc262_init_verbs, alc262_benq_t31_EAPD_verbs, alc262_hippo_unsol_verbs }, |
| 9525 | .num_dacs = ARRAY_SIZE(alc262_dac_nids), |
| 9526 | .dac_nids = alc262_dac_nids, |
| 9527 | .hp_nid = 0x03, |
| 9528 | .num_channel_mode = ARRAY_SIZE(alc262_modes), |
| 9529 | .channel_mode = alc262_modes, |
| 9530 | .input_mux = &alc262_capture_source, |
| 9531 | .unsol_event = alc262_hippo_unsol_event, |
Takashi Iwai | 5b31954 | 2007-07-26 11:49:22 +0200 | [diff] [blame] | 9532 | .init_hook = alc262_hippo_automute, |
Kailang Yang | 272a527 | 2007-05-14 11:00:38 +0200 | [diff] [blame] | 9533 | }, |
Tobin Davis | f651b50 | 2007-10-26 12:40:47 +0200 | [diff] [blame] | 9534 | [ALC262_ULTRA] = { |
| 9535 | .mixers = { alc262_ultra_mixer }, |
| 9536 | .init_verbs = { alc262_init_verbs, alc262_ultra_verbs }, |
| 9537 | .num_dacs = ARRAY_SIZE(alc262_dac_nids), |
| 9538 | .dac_nids = alc262_dac_nids, |
| 9539 | .hp_nid = 0x03, |
| 9540 | .dig_out_nid = ALC262_DIGOUT_NID, |
| 9541 | .num_channel_mode = ARRAY_SIZE(alc262_modes), |
| 9542 | .channel_mode = alc262_modes, |
| 9543 | .input_mux = &alc262_ultra_capture_source, |
| 9544 | .unsol_event = alc262_ultra_unsol_event, |
| 9545 | .init_hook = alc262_ultra_automute, |
| 9546 | }, |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 9547 | }; |
| 9548 | |
| 9549 | static int patch_alc262(struct hda_codec *codec) |
| 9550 | { |
| 9551 | struct alc_spec *spec; |
| 9552 | int board_config; |
| 9553 | int err; |
| 9554 | |
Robert P. J. Day | dc041e0 | 2006-12-19 14:44:15 +0100 | [diff] [blame] | 9555 | spec = kzalloc(sizeof(*spec), GFP_KERNEL); |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 9556 | if (spec == NULL) |
| 9557 | return -ENOMEM; |
| 9558 | |
| 9559 | codec->spec = spec; |
| 9560 | #if 0 |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 9561 | /* pshou 07/11/05 set a zero PCM sample to DAC when FIFO is |
| 9562 | * under-run |
| 9563 | */ |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 9564 | { |
| 9565 | int tmp; |
| 9566 | snd_hda_codec_write(codec, 0x1a, 0, AC_VERB_SET_COEF_INDEX, 7); |
| 9567 | tmp = snd_hda_codec_read(codec, 0x20, 0, AC_VERB_GET_PROC_COEF, 0); |
| 9568 | snd_hda_codec_write(codec, 0x1a, 0, AC_VERB_SET_COEF_INDEX, 7); |
| 9569 | snd_hda_codec_write(codec, 0x1a, 0, AC_VERB_SET_PROC_COEF, tmp | 0x80); |
| 9570 | } |
| 9571 | #endif |
| 9572 | |
Takashi Iwai | f5fcc13 | 2006-11-24 17:07:44 +0100 | [diff] [blame] | 9573 | board_config = snd_hda_check_board_config(codec, ALC262_MODEL_LAST, |
| 9574 | alc262_models, |
| 9575 | alc262_cfg_tbl); |
Kailang Yang | cd7509a | 2007-01-26 18:33:17 +0100 | [diff] [blame] | 9576 | |
Takashi Iwai | f5fcc13 | 2006-11-24 17:07:44 +0100 | [diff] [blame] | 9577 | if (board_config < 0) { |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 9578 | printk(KERN_INFO "hda_codec: Unknown model for ALC262, " |
| 9579 | "trying auto-probe from BIOS...\n"); |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 9580 | board_config = ALC262_AUTO; |
| 9581 | } |
| 9582 | |
| 9583 | if (board_config == ALC262_AUTO) { |
| 9584 | /* automatic parse from the BIOS config */ |
| 9585 | err = alc262_parse_auto_config(codec); |
| 9586 | if (err < 0) { |
| 9587 | alc_free(codec); |
| 9588 | return err; |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 9589 | } else if (!err) { |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 9590 | printk(KERN_INFO |
| 9591 | "hda_codec: Cannot set up configuration " |
| 9592 | "from BIOS. Using base mode...\n"); |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 9593 | board_config = ALC262_BASIC; |
| 9594 | } |
| 9595 | } |
| 9596 | |
| 9597 | if (board_config != ALC262_AUTO) |
| 9598 | setup_preset(spec, &alc262_presets[board_config]); |
| 9599 | |
| 9600 | spec->stream_name_analog = "ALC262 Analog"; |
| 9601 | spec->stream_analog_playback = &alc262_pcm_analog_playback; |
| 9602 | spec->stream_analog_capture = &alc262_pcm_analog_capture; |
| 9603 | |
| 9604 | spec->stream_name_digital = "ALC262 Digital"; |
| 9605 | spec->stream_digital_playback = &alc262_pcm_digital_playback; |
| 9606 | spec->stream_digital_capture = &alc262_pcm_digital_capture; |
| 9607 | |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 9608 | if (!spec->adc_nids && spec->input_mux) { |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 9609 | /* check whether NID 0x07 is valid */ |
Takashi Iwai | 4a471b7 | 2005-12-07 13:56:29 +0100 | [diff] [blame] | 9610 | unsigned int wcap = get_wcaps(codec, 0x07); |
| 9611 | |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 9612 | /* get type */ |
| 9613 | wcap = (wcap & AC_WCAP_TYPE) >> AC_WCAP_TYPE_SHIFT; |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 9614 | if (wcap != AC_WID_AUD_IN) { |
| 9615 | spec->adc_nids = alc262_adc_nids_alt; |
| 9616 | spec->num_adc_nids = ARRAY_SIZE(alc262_adc_nids_alt); |
Takashi Iwai | 88c71a9 | 2008-02-14 17:27:17 +0100 | [diff] [blame] | 9617 | spec->capsrc_nids = alc262_capsrc_nids_alt; |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 9618 | spec->mixers[spec->num_mixers] = |
| 9619 | alc262_capture_alt_mixer; |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 9620 | spec->num_mixers++; |
| 9621 | } else { |
| 9622 | spec->adc_nids = alc262_adc_nids; |
| 9623 | spec->num_adc_nids = ARRAY_SIZE(alc262_adc_nids); |
Takashi Iwai | 88c71a9 | 2008-02-14 17:27:17 +0100 | [diff] [blame] | 9624 | spec->capsrc_nids = alc262_capsrc_nids; |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 9625 | spec->mixers[spec->num_mixers] = alc262_capture_mixer; |
| 9626 | spec->num_mixers++; |
| 9627 | } |
| 9628 | } |
| 9629 | |
Takashi Iwai | 2134ea4 | 2008-01-10 16:53:55 +0100 | [diff] [blame] | 9630 | spec->vmaster_nid = 0x0c; |
| 9631 | |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 9632 | codec->patch_ops = alc_patch_ops; |
| 9633 | if (board_config == ALC262_AUTO) |
Takashi Iwai | ae6b813 | 2006-03-03 16:47:17 +0100 | [diff] [blame] | 9634 | spec->init_hook = alc262_auto_init; |
Takashi Iwai | cb53c62 | 2007-08-10 17:21:45 +0200 | [diff] [blame] | 9635 | #ifdef CONFIG_SND_HDA_POWER_SAVE |
| 9636 | if (!spec->loopback.amplist) |
| 9637 | spec->loopback.amplist = alc262_loopbacks; |
| 9638 | #endif |
Takashi Iwai | 834be88 | 2006-03-01 14:16:17 +0100 | [diff] [blame] | 9639 | |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 9640 | return 0; |
| 9641 | } |
| 9642 | |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 9643 | /* |
Kailang Yang | a361d84 | 2007-06-05 12:30:55 +0200 | [diff] [blame] | 9644 | * ALC268 channel source setting (2 channel) |
| 9645 | */ |
| 9646 | #define ALC268_DIGOUT_NID ALC880_DIGOUT_NID |
| 9647 | #define alc268_modes alc260_modes |
| 9648 | |
| 9649 | static hda_nid_t alc268_dac_nids[2] = { |
| 9650 | /* front, hp */ |
| 9651 | 0x02, 0x03 |
| 9652 | }; |
| 9653 | |
| 9654 | static hda_nid_t alc268_adc_nids[2] = { |
| 9655 | /* ADC0-1 */ |
| 9656 | 0x08, 0x07 |
| 9657 | }; |
| 9658 | |
| 9659 | static hda_nid_t alc268_adc_nids_alt[1] = { |
| 9660 | /* ADC0 */ |
| 9661 | 0x08 |
| 9662 | }; |
| 9663 | |
Takashi Iwai | e140634 | 2008-02-11 18:32:32 +0100 | [diff] [blame] | 9664 | static hda_nid_t alc268_capsrc_nids[2] = { 0x23, 0x24 }; |
| 9665 | |
Kailang Yang | a361d84 | 2007-06-05 12:30:55 +0200 | [diff] [blame] | 9666 | static struct snd_kcontrol_new alc268_base_mixer[] = { |
| 9667 | /* output mixer control */ |
| 9668 | HDA_CODEC_VOLUME("Front Playback Volume", 0x2, 0x0, HDA_OUTPUT), |
| 9669 | HDA_CODEC_MUTE("Front Playback Switch", 0x14, 0x0, HDA_OUTPUT), |
| 9670 | HDA_CODEC_VOLUME("Headphone Playback Volume", 0x3, 0x0, HDA_OUTPUT), |
| 9671 | HDA_CODEC_MUTE("Headphone Playback Switch", 0x15, 0x0, HDA_OUTPUT), |
Takashi Iwai | 33bf17a | 2007-08-21 11:51:42 +0200 | [diff] [blame] | 9672 | HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT), |
| 9673 | HDA_CODEC_VOLUME("Front Mic Boost", 0x19, 0, HDA_INPUT), |
| 9674 | HDA_CODEC_VOLUME("Line In Boost", 0x1a, 0, HDA_INPUT), |
Kailang Yang | a361d84 | 2007-06-05 12:30:55 +0200 | [diff] [blame] | 9675 | { } |
| 9676 | }; |
| 9677 | |
Takashi Iwai | aef9d31 | 2008-02-19 13:16:41 +0100 | [diff] [blame] | 9678 | /* bind Beep switches of both NID 0x0f and 0x10 */ |
| 9679 | static struct hda_bind_ctls alc268_bind_beep_sw = { |
| 9680 | .ops = &snd_hda_bind_sw, |
| 9681 | .values = { |
| 9682 | HDA_COMPOSE_AMP_VAL(0x0f, 3, 1, HDA_INPUT), |
| 9683 | HDA_COMPOSE_AMP_VAL(0x10, 3, 1, HDA_INPUT), |
| 9684 | 0 |
| 9685 | }, |
| 9686 | }; |
| 9687 | |
| 9688 | static struct snd_kcontrol_new alc268_beep_mixer[] = { |
| 9689 | HDA_CODEC_VOLUME("Beep Playback Volume", 0x1d, 0x0, HDA_INPUT), |
| 9690 | HDA_BIND_SW("Beep Playback Switch", &alc268_bind_beep_sw), |
| 9691 | { } |
| 9692 | }; |
| 9693 | |
Kailang Yang | d1a991a | 2007-08-15 16:21:59 +0200 | [diff] [blame] | 9694 | static struct hda_verb alc268_eapd_verbs[] = { |
| 9695 | {0x14, AC_VERB_SET_EAPD_BTLENABLE, 2}, |
| 9696 | {0x15, AC_VERB_SET_EAPD_BTLENABLE, 2}, |
| 9697 | { } |
| 9698 | }; |
| 9699 | |
Takashi Iwai | d273809 | 2007-08-16 14:59:45 +0200 | [diff] [blame] | 9700 | /* Toshiba specific */ |
| 9701 | #define alc268_toshiba_automute alc262_hippo_automute |
| 9702 | |
| 9703 | static struct hda_verb alc268_toshiba_verbs[] = { |
| 9704 | {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN}, |
| 9705 | { } /* end */ |
| 9706 | }; |
| 9707 | |
| 9708 | /* Acer specific */ |
Takashi Iwai | 889c439 | 2007-08-23 18:56:52 +0200 | [diff] [blame] | 9709 | /* bind volumes of both NID 0x02 and 0x03 */ |
Takashi Iwai | 6bc9685 | 2007-08-17 09:02:12 +0200 | [diff] [blame] | 9710 | static struct hda_bind_ctls alc268_acer_bind_master_vol = { |
| 9711 | .ops = &snd_hda_bind_vol, |
| 9712 | .values = { |
| 9713 | HDA_COMPOSE_AMP_VAL(0x02, 3, 0, HDA_OUTPUT), |
| 9714 | HDA_COMPOSE_AMP_VAL(0x03, 3, 0, HDA_OUTPUT), |
| 9715 | 0 |
| 9716 | }, |
| 9717 | }; |
| 9718 | |
Takashi Iwai | 889c439 | 2007-08-23 18:56:52 +0200 | [diff] [blame] | 9719 | /* mute/unmute internal speaker according to the hp jack and mute state */ |
| 9720 | static void alc268_acer_automute(struct hda_codec *codec, int force) |
| 9721 | { |
| 9722 | struct alc_spec *spec = codec->spec; |
| 9723 | unsigned int mute; |
| 9724 | |
| 9725 | if (force || !spec->sense_updated) { |
| 9726 | unsigned int present; |
| 9727 | present = snd_hda_codec_read(codec, 0x14, 0, |
| 9728 | AC_VERB_GET_PIN_SENSE, 0); |
| 9729 | spec->jack_present = (present & 0x80000000) != 0; |
| 9730 | spec->sense_updated = 1; |
| 9731 | } |
| 9732 | if (spec->jack_present) |
| 9733 | mute = HDA_AMP_MUTE; /* mute internal speaker */ |
| 9734 | else /* unmute internal speaker if necessary */ |
| 9735 | mute = snd_hda_codec_amp_read(codec, 0x14, 0, HDA_OUTPUT, 0); |
| 9736 | snd_hda_codec_amp_stereo(codec, 0x15, HDA_OUTPUT, 0, |
| 9737 | HDA_AMP_MUTE, mute); |
| 9738 | } |
| 9739 | |
| 9740 | |
| 9741 | /* bind hp and internal speaker mute (with plug check) */ |
| 9742 | static int alc268_acer_master_sw_put(struct snd_kcontrol *kcontrol, |
| 9743 | struct snd_ctl_elem_value *ucontrol) |
| 9744 | { |
| 9745 | struct hda_codec *codec = snd_kcontrol_chip(kcontrol); |
| 9746 | long *valp = ucontrol->value.integer.value; |
| 9747 | int change; |
| 9748 | |
| 9749 | change = snd_hda_codec_amp_update(codec, 0x14, 0, HDA_OUTPUT, 0, |
| 9750 | HDA_AMP_MUTE, |
| 9751 | valp[0] ? 0 : HDA_AMP_MUTE); |
| 9752 | change |= snd_hda_codec_amp_update(codec, 0x14, 1, HDA_OUTPUT, 0, |
| 9753 | HDA_AMP_MUTE, |
| 9754 | valp[1] ? 0 : HDA_AMP_MUTE); |
| 9755 | if (change) |
| 9756 | alc268_acer_automute(codec, 0); |
| 9757 | return change; |
| 9758 | } |
Takashi Iwai | d273809 | 2007-08-16 14:59:45 +0200 | [diff] [blame] | 9759 | |
| 9760 | static struct snd_kcontrol_new alc268_acer_mixer[] = { |
| 9761 | /* output mixer control */ |
| 9762 | HDA_BIND_VOL("Master Playback Volume", &alc268_acer_bind_master_vol), |
| 9763 | { |
| 9764 | .iface = SNDRV_CTL_ELEM_IFACE_MIXER, |
| 9765 | .name = "Master Playback Switch", |
| 9766 | .info = snd_hda_mixer_amp_switch_info, |
| 9767 | .get = snd_hda_mixer_amp_switch_get, |
| 9768 | .put = alc268_acer_master_sw_put, |
| 9769 | .private_value = HDA_COMPOSE_AMP_VAL(0x14, 3, 0, HDA_OUTPUT), |
| 9770 | }, |
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("Internal Mic Boost", 0x19, 0, HDA_INPUT), |
| 9773 | HDA_CODEC_VOLUME("Line In Boost", 0x1a, 0, HDA_INPUT), |
Takashi Iwai | d273809 | 2007-08-16 14:59:45 +0200 | [diff] [blame] | 9774 | { } |
| 9775 | }; |
| 9776 | |
| 9777 | static struct hda_verb alc268_acer_verbs[] = { |
| 9778 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 9779 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 9780 | |
| 9781 | {0x14, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN}, |
| 9782 | { } |
| 9783 | }; |
| 9784 | |
| 9785 | /* unsolicited event for HP jack sensing */ |
| 9786 | static void alc268_toshiba_unsol_event(struct hda_codec *codec, |
| 9787 | unsigned int res) |
| 9788 | { |
Takashi Iwai | 889c439 | 2007-08-23 18:56:52 +0200 | [diff] [blame] | 9789 | if ((res >> 26) != ALC880_HP_EVENT) |
Takashi Iwai | d273809 | 2007-08-16 14:59:45 +0200 | [diff] [blame] | 9790 | return; |
| 9791 | alc268_toshiba_automute(codec); |
| 9792 | } |
| 9793 | |
| 9794 | static void alc268_acer_unsol_event(struct hda_codec *codec, |
| 9795 | unsigned int res) |
| 9796 | { |
Takashi Iwai | 889c439 | 2007-08-23 18:56:52 +0200 | [diff] [blame] | 9797 | if ((res >> 26) != ALC880_HP_EVENT) |
Takashi Iwai | d273809 | 2007-08-16 14:59:45 +0200 | [diff] [blame] | 9798 | return; |
| 9799 | alc268_acer_automute(codec, 1); |
| 9800 | } |
| 9801 | |
Takashi Iwai | 889c439 | 2007-08-23 18:56:52 +0200 | [diff] [blame] | 9802 | static void alc268_acer_init_hook(struct hda_codec *codec) |
| 9803 | { |
| 9804 | alc268_acer_automute(codec, 1); |
| 9805 | } |
| 9806 | |
Takashi Iwai | 3866f0b | 2008-01-15 12:37:42 +0100 | [diff] [blame] | 9807 | static struct snd_kcontrol_new alc268_dell_mixer[] = { |
| 9808 | /* output mixer control */ |
| 9809 | HDA_CODEC_VOLUME("Speaker Playback Volume", 0x02, 0x0, HDA_OUTPUT), |
| 9810 | HDA_CODEC_MUTE("Speaker Playback Switch", 0x14, 0x0, HDA_OUTPUT), |
| 9811 | HDA_CODEC_VOLUME("Headphone Playback Volume", 0x03, 0x0, HDA_OUTPUT), |
| 9812 | HDA_CODEC_MUTE("Headphone Playback Switch", 0x15, 0x0, HDA_OUTPUT), |
| 9813 | HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT), |
| 9814 | HDA_CODEC_VOLUME("Internal Mic Boost", 0x19, 0, HDA_INPUT), |
| 9815 | { } |
| 9816 | }; |
| 9817 | |
| 9818 | static struct hda_verb alc268_dell_verbs[] = { |
| 9819 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 9820 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 9821 | {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN}, |
| 9822 | { } |
| 9823 | }; |
| 9824 | |
| 9825 | /* mute/unmute internal speaker according to the hp jack and mute state */ |
| 9826 | static void alc268_dell_automute(struct hda_codec *codec) |
| 9827 | { |
| 9828 | unsigned int present; |
| 9829 | unsigned int mute; |
| 9830 | |
| 9831 | present = snd_hda_codec_read(codec, 0x15, 0, AC_VERB_GET_PIN_SENSE, 0); |
| 9832 | if (present & 0x80000000) |
| 9833 | mute = HDA_AMP_MUTE; |
| 9834 | else |
| 9835 | mute = snd_hda_codec_amp_read(codec, 0x15, 0, HDA_OUTPUT, 0); |
| 9836 | snd_hda_codec_amp_stereo(codec, 0x14, HDA_OUTPUT, 0, |
| 9837 | HDA_AMP_MUTE, mute); |
| 9838 | } |
| 9839 | |
| 9840 | static void alc268_dell_unsol_event(struct hda_codec *codec, |
| 9841 | unsigned int res) |
| 9842 | { |
| 9843 | if ((res >> 26) != ALC880_HP_EVENT) |
| 9844 | return; |
| 9845 | alc268_dell_automute(codec); |
| 9846 | } |
| 9847 | |
| 9848 | #define alc268_dell_init_hook alc268_dell_automute |
| 9849 | |
Kailang Yang | a361d84 | 2007-06-05 12:30:55 +0200 | [diff] [blame] | 9850 | /* |
| 9851 | * generic initialization of ADC, input mixers and output mixers |
| 9852 | */ |
| 9853 | static struct hda_verb alc268_base_init_verbs[] = { |
| 9854 | /* Unmute DAC0-1 and set vol = 0 */ |
| 9855 | {0x02, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 9856 | {0x02, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 9857 | {0x02, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 9858 | {0x03, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 9859 | {0x03, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 9860 | {0x03, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 9861 | |
| 9862 | /* |
| 9863 | * Set up output mixers (0x0c - 0x0e) |
| 9864 | */ |
| 9865 | /* set vol=0 to output mixers */ |
| 9866 | {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 9867 | {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 9868 | {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 9869 | {0x0e, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 9870 | |
| 9871 | {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 9872 | {0x10, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 9873 | |
| 9874 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x40}, |
| 9875 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, 0xc0}, |
| 9876 | {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x40}, |
| 9877 | {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24}, |
| 9878 | {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24}, |
| 9879 | {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20}, |
| 9880 | {0x1c, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20}, |
| 9881 | {0x1d, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20}, |
| 9882 | |
| 9883 | {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
| 9884 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
| 9885 | {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
| 9886 | {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
| 9887 | {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
| 9888 | {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
| 9889 | {0x1c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
Takashi Iwai | aef9d31 | 2008-02-19 13:16:41 +0100 | [diff] [blame] | 9890 | |
| 9891 | /* set PCBEEP vol = 0, mute connections */ |
| 9892 | {0x1d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 9893 | {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
| 9894 | {0x10, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
Kailang Yang | a361d84 | 2007-06-05 12:30:55 +0200 | [diff] [blame] | 9895 | |
Jiang Zhe | a9b3aa8 | 2007-12-20 13:13:13 +0100 | [diff] [blame] | 9896 | /* Unmute Selector 23h,24h and set the default input to mic-in */ |
| 9897 | |
| 9898 | {0x23, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 9899 | {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 9900 | {0x24, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 9901 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
Kailang Yang | a361d84 | 2007-06-05 12:30:55 +0200 | [diff] [blame] | 9902 | |
Kailang Yang | a361d84 | 2007-06-05 12:30:55 +0200 | [diff] [blame] | 9903 | { } |
| 9904 | }; |
| 9905 | |
| 9906 | /* |
| 9907 | * generic initialization of ADC, input mixers and output mixers |
| 9908 | */ |
| 9909 | static struct hda_verb alc268_volume_init_verbs[] = { |
| 9910 | /* set output DAC */ |
| 9911 | {0x02, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 9912 | {0x02, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 9913 | {0x03, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 9914 | {0x03, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 9915 | |
| 9916 | {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24}, |
| 9917 | {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24}, |
| 9918 | {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20}, |
| 9919 | {0x1c, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20}, |
| 9920 | {0x1d, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20}, |
| 9921 | |
| 9922 | {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 9923 | {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 9924 | {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 9925 | {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 9926 | {0x10, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 9927 | |
| 9928 | {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
| 9929 | {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
| 9930 | {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
| 9931 | {0x1c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
| 9932 | |
Takashi Iwai | aef9d31 | 2008-02-19 13:16:41 +0100 | [diff] [blame] | 9933 | /* set PCBEEP vol = 0, mute connections */ |
| 9934 | {0x1d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 9935 | {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
| 9936 | {0x10, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
Kailang Yang | a361d84 | 2007-06-05 12:30:55 +0200 | [diff] [blame] | 9937 | |
| 9938 | { } |
| 9939 | }; |
| 9940 | |
| 9941 | #define alc268_mux_enum_info alc_mux_enum_info |
| 9942 | #define alc268_mux_enum_get alc_mux_enum_get |
Takashi Iwai | e140634 | 2008-02-11 18:32:32 +0100 | [diff] [blame] | 9943 | #define alc268_mux_enum_put alc_mux_enum_put |
Kailang Yang | a361d84 | 2007-06-05 12:30:55 +0200 | [diff] [blame] | 9944 | |
| 9945 | static struct snd_kcontrol_new alc268_capture_alt_mixer[] = { |
| 9946 | HDA_CODEC_VOLUME("Capture Volume", 0x23, 0x0, HDA_OUTPUT), |
| 9947 | HDA_CODEC_MUTE("Capture Switch", 0x23, 0x0, HDA_OUTPUT), |
| 9948 | { |
| 9949 | .iface = SNDRV_CTL_ELEM_IFACE_MIXER, |
| 9950 | /* The multiple "Capture Source" controls confuse alsamixer |
| 9951 | * So call somewhat different.. |
Kailang Yang | a361d84 | 2007-06-05 12:30:55 +0200 | [diff] [blame] | 9952 | */ |
| 9953 | /* .name = "Capture Source", */ |
| 9954 | .name = "Input Source", |
| 9955 | .count = 1, |
| 9956 | .info = alc268_mux_enum_info, |
| 9957 | .get = alc268_mux_enum_get, |
| 9958 | .put = alc268_mux_enum_put, |
| 9959 | }, |
| 9960 | { } /* end */ |
| 9961 | }; |
| 9962 | |
| 9963 | static struct snd_kcontrol_new alc268_capture_mixer[] = { |
| 9964 | HDA_CODEC_VOLUME("Capture Volume", 0x23, 0x0, HDA_OUTPUT), |
| 9965 | HDA_CODEC_MUTE("Capture Switch", 0x23, 0x0, HDA_OUTPUT), |
| 9966 | HDA_CODEC_VOLUME_IDX("Capture Volume", 1, 0x24, 0x0, HDA_OUTPUT), |
| 9967 | HDA_CODEC_MUTE_IDX("Capture Switch", 1, 0x24, 0x0, HDA_OUTPUT), |
| 9968 | { |
| 9969 | .iface = SNDRV_CTL_ELEM_IFACE_MIXER, |
| 9970 | /* The multiple "Capture Source" controls confuse alsamixer |
| 9971 | * So call somewhat different.. |
Kailang Yang | a361d84 | 2007-06-05 12:30:55 +0200 | [diff] [blame] | 9972 | */ |
| 9973 | /* .name = "Capture Source", */ |
| 9974 | .name = "Input Source", |
| 9975 | .count = 2, |
| 9976 | .info = alc268_mux_enum_info, |
| 9977 | .get = alc268_mux_enum_get, |
| 9978 | .put = alc268_mux_enum_put, |
| 9979 | }, |
| 9980 | { } /* end */ |
| 9981 | }; |
| 9982 | |
| 9983 | static struct hda_input_mux alc268_capture_source = { |
| 9984 | .num_items = 4, |
| 9985 | .items = { |
| 9986 | { "Mic", 0x0 }, |
| 9987 | { "Front Mic", 0x1 }, |
| 9988 | { "Line", 0x2 }, |
| 9989 | { "CD", 0x3 }, |
| 9990 | }, |
| 9991 | }; |
| 9992 | |
Jonathan Woithe | 86c53bd | 2008-01-08 12:33:19 +0100 | [diff] [blame] | 9993 | #ifdef CONFIG_SND_DEBUG |
| 9994 | static struct snd_kcontrol_new alc268_test_mixer[] = { |
Jonathan Woithe | 86c53bd | 2008-01-08 12:33:19 +0100 | [diff] [blame] | 9995 | /* Volume widgets */ |
| 9996 | HDA_CODEC_VOLUME("LOUT1 Playback Volume", 0x02, 0x0, HDA_OUTPUT), |
| 9997 | HDA_CODEC_VOLUME("LOUT2 Playback Volume", 0x03, 0x0, HDA_OUTPUT), |
| 9998 | HDA_BIND_MUTE_MONO("Mono sum Playback Switch", 0x0e, 1, 2, HDA_INPUT), |
| 9999 | HDA_BIND_MUTE("LINE-OUT sum Playback Switch", 0x0f, 2, HDA_INPUT), |
| 10000 | HDA_BIND_MUTE("HP-OUT sum Playback Switch", 0x10, 2, HDA_INPUT), |
| 10001 | HDA_BIND_MUTE("LINE-OUT Playback Switch", 0x14, 2, HDA_OUTPUT), |
| 10002 | HDA_BIND_MUTE("HP-OUT Playback Switch", 0x15, 2, HDA_OUTPUT), |
| 10003 | HDA_BIND_MUTE("Mono Playback Switch", 0x16, 2, HDA_OUTPUT), |
| 10004 | HDA_CODEC_VOLUME("MIC1 Capture Volume", 0x18, 0x0, HDA_INPUT), |
| 10005 | HDA_BIND_MUTE("MIC1 Capture Switch", 0x18, 2, HDA_OUTPUT), |
| 10006 | HDA_CODEC_VOLUME("MIC2 Capture Volume", 0x19, 0x0, HDA_INPUT), |
| 10007 | HDA_CODEC_VOLUME("LINE1 Capture Volume", 0x1a, 0x0, HDA_INPUT), |
| 10008 | HDA_BIND_MUTE("LINE1 Capture Switch", 0x1a, 2, HDA_OUTPUT), |
Takashi Iwai | f0747ee | 2008-01-15 11:41:41 +0100 | [diff] [blame] | 10009 | /* The below appears problematic on some hardwares */ |
| 10010 | /*HDA_CODEC_VOLUME("PCBEEP Playback Volume", 0x1d, 0x0, HDA_INPUT),*/ |
Jonathan Woithe | 86c53bd | 2008-01-08 12:33:19 +0100 | [diff] [blame] | 10011 | HDA_CODEC_VOLUME("PCM-IN1 Capture Volume", 0x23, 0x0, HDA_OUTPUT), |
| 10012 | HDA_BIND_MUTE("PCM-IN1 Capture Switch", 0x23, 2, HDA_OUTPUT), |
| 10013 | HDA_CODEC_VOLUME("PCM-IN2 Capture Volume", 0x24, 0x0, HDA_OUTPUT), |
| 10014 | HDA_BIND_MUTE("PCM-IN2 Capture Switch", 0x24, 2, HDA_OUTPUT), |
| 10015 | |
| 10016 | /* Modes for retasking pin widgets */ |
| 10017 | ALC_PIN_MODE("LINE-OUT pin mode", 0x14, ALC_PIN_DIR_INOUT), |
| 10018 | ALC_PIN_MODE("HP-OUT pin mode", 0x15, ALC_PIN_DIR_INOUT), |
| 10019 | ALC_PIN_MODE("MIC1 pin mode", 0x18, ALC_PIN_DIR_INOUT), |
| 10020 | ALC_PIN_MODE("LINE1 pin mode", 0x1a, ALC_PIN_DIR_INOUT), |
| 10021 | |
| 10022 | /* Controls for GPIO pins, assuming they are configured as outputs */ |
| 10023 | ALC_GPIO_DATA_SWITCH("GPIO pin 0", 0x01, 0x01), |
| 10024 | ALC_GPIO_DATA_SWITCH("GPIO pin 1", 0x01, 0x02), |
| 10025 | ALC_GPIO_DATA_SWITCH("GPIO pin 2", 0x01, 0x04), |
| 10026 | ALC_GPIO_DATA_SWITCH("GPIO pin 3", 0x01, 0x08), |
| 10027 | |
| 10028 | /* Switches to allow the digital SPDIF output pin to be enabled. |
| 10029 | * The ALC268 does not have an SPDIF input. |
| 10030 | */ |
| 10031 | ALC_SPDIF_CTRL_SWITCH("SPDIF Playback Switch", 0x06, 0x01), |
| 10032 | |
| 10033 | /* A switch allowing EAPD to be enabled. Some laptops seem to use |
| 10034 | * this output to turn on an external amplifier. |
| 10035 | */ |
| 10036 | ALC_EAPD_CTRL_SWITCH("LINE-OUT EAPD Enable Switch", 0x0f, 0x02), |
| 10037 | ALC_EAPD_CTRL_SWITCH("HP-OUT EAPD Enable Switch", 0x10, 0x02), |
| 10038 | |
| 10039 | { } /* end */ |
| 10040 | }; |
| 10041 | #endif |
| 10042 | |
Kailang Yang | a361d84 | 2007-06-05 12:30:55 +0200 | [diff] [blame] | 10043 | /* create input playback/capture controls for the given pin */ |
| 10044 | static int alc268_new_analog_output(struct alc_spec *spec, hda_nid_t nid, |
| 10045 | const char *ctlname, int idx) |
| 10046 | { |
| 10047 | char name[32]; |
| 10048 | int err; |
| 10049 | |
| 10050 | sprintf(name, "%s Playback Volume", ctlname); |
| 10051 | if (nid == 0x14) { |
| 10052 | err = add_control(spec, ALC_CTL_WIDGET_VOL, name, |
| 10053 | HDA_COMPOSE_AMP_VAL(0x02, 3, idx, |
| 10054 | HDA_OUTPUT)); |
| 10055 | if (err < 0) |
| 10056 | return err; |
| 10057 | } else if (nid == 0x15) { |
| 10058 | err = add_control(spec, ALC_CTL_WIDGET_VOL, name, |
| 10059 | HDA_COMPOSE_AMP_VAL(0x03, 3, idx, |
| 10060 | HDA_OUTPUT)); |
| 10061 | if (err < 0) |
| 10062 | return err; |
| 10063 | } else |
| 10064 | return -1; |
| 10065 | sprintf(name, "%s Playback Switch", ctlname); |
| 10066 | err = add_control(spec, ALC_CTL_WIDGET_MUTE, name, |
| 10067 | HDA_COMPOSE_AMP_VAL(nid, 3, idx, HDA_OUTPUT)); |
| 10068 | if (err < 0) |
| 10069 | return err; |
| 10070 | return 0; |
| 10071 | } |
| 10072 | |
| 10073 | /* add playback controls from the parsed DAC table */ |
| 10074 | static int alc268_auto_create_multi_out_ctls(struct alc_spec *spec, |
| 10075 | const struct auto_pin_cfg *cfg) |
| 10076 | { |
| 10077 | hda_nid_t nid; |
| 10078 | int err; |
| 10079 | |
| 10080 | spec->multiout.num_dacs = 2; /* only use one dac */ |
| 10081 | spec->multiout.dac_nids = spec->private_dac_nids; |
| 10082 | spec->multiout.dac_nids[0] = 2; |
| 10083 | spec->multiout.dac_nids[1] = 3; |
| 10084 | |
| 10085 | nid = cfg->line_out_pins[0]; |
| 10086 | if (nid) |
| 10087 | alc268_new_analog_output(spec, nid, "Front", 0); |
| 10088 | |
| 10089 | nid = cfg->speaker_pins[0]; |
| 10090 | if (nid == 0x1d) { |
| 10091 | err = add_control(spec, ALC_CTL_WIDGET_VOL, |
| 10092 | "Speaker Playback Volume", |
| 10093 | HDA_COMPOSE_AMP_VAL(nid, 3, 0, HDA_INPUT)); |
| 10094 | if (err < 0) |
| 10095 | return err; |
| 10096 | } |
| 10097 | nid = cfg->hp_pins[0]; |
| 10098 | if (nid) |
| 10099 | alc268_new_analog_output(spec, nid, "Headphone", 0); |
| 10100 | |
| 10101 | nid = cfg->line_out_pins[1] | cfg->line_out_pins[2]; |
| 10102 | if (nid == 0x16) { |
| 10103 | err = add_control(spec, ALC_CTL_WIDGET_MUTE, |
| 10104 | "Mono Playback Switch", |
| 10105 | HDA_COMPOSE_AMP_VAL(nid, 2, 0, HDA_INPUT)); |
| 10106 | if (err < 0) |
| 10107 | return err; |
| 10108 | } |
| 10109 | return 0; |
| 10110 | } |
| 10111 | |
| 10112 | /* create playback/capture controls for input pins */ |
| 10113 | static int alc268_auto_create_analog_input_ctls(struct alc_spec *spec, |
| 10114 | const struct auto_pin_cfg *cfg) |
| 10115 | { |
| 10116 | struct hda_input_mux *imux = &spec->private_imux; |
| 10117 | int i, idx1; |
| 10118 | |
| 10119 | for (i = 0; i < AUTO_PIN_LAST; i++) { |
| 10120 | switch(cfg->input_pins[i]) { |
| 10121 | case 0x18: |
| 10122 | idx1 = 0; /* Mic 1 */ |
| 10123 | break; |
| 10124 | case 0x19: |
| 10125 | idx1 = 1; /* Mic 2 */ |
| 10126 | break; |
| 10127 | case 0x1a: |
| 10128 | idx1 = 2; /* Line In */ |
| 10129 | break; |
| 10130 | case 0x1c: |
| 10131 | idx1 = 3; /* CD */ |
| 10132 | break; |
Takashi Iwai | 7194cae | 2008-03-06 16:58:17 +0100 | [diff] [blame^] | 10133 | case 0x12: |
| 10134 | case 0x13: |
| 10135 | idx1 = 6; /* digital mics */ |
| 10136 | break; |
Kailang Yang | a361d84 | 2007-06-05 12:30:55 +0200 | [diff] [blame] | 10137 | default: |
| 10138 | continue; |
| 10139 | } |
| 10140 | imux->items[imux->num_items].label = auto_pin_cfg_labels[i]; |
| 10141 | imux->items[imux->num_items].index = idx1; |
| 10142 | imux->num_items++; |
| 10143 | } |
| 10144 | return 0; |
| 10145 | } |
| 10146 | |
| 10147 | static void alc268_auto_init_mono_speaker_out(struct hda_codec *codec) |
| 10148 | { |
| 10149 | struct alc_spec *spec = codec->spec; |
| 10150 | hda_nid_t speaker_nid = spec->autocfg.speaker_pins[0]; |
| 10151 | hda_nid_t hp_nid = spec->autocfg.hp_pins[0]; |
| 10152 | hda_nid_t line_nid = spec->autocfg.line_out_pins[0]; |
| 10153 | unsigned int dac_vol1, dac_vol2; |
| 10154 | |
| 10155 | if (speaker_nid) { |
| 10156 | snd_hda_codec_write(codec, speaker_nid, 0, |
| 10157 | AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT); |
| 10158 | snd_hda_codec_write(codec, 0x0f, 0, |
| 10159 | AC_VERB_SET_AMP_GAIN_MUTE, |
| 10160 | AMP_IN_UNMUTE(1)); |
| 10161 | snd_hda_codec_write(codec, 0x10, 0, |
| 10162 | AC_VERB_SET_AMP_GAIN_MUTE, |
| 10163 | AMP_IN_UNMUTE(1)); |
| 10164 | } else { |
| 10165 | snd_hda_codec_write(codec, 0x0f, 0, |
| 10166 | AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)); |
| 10167 | snd_hda_codec_write(codec, 0x10, 0, |
| 10168 | AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)); |
| 10169 | } |
| 10170 | |
| 10171 | dac_vol1 = dac_vol2 = 0xb000 | 0x40; /* set max volume */ |
| 10172 | if (line_nid == 0x14) |
| 10173 | dac_vol2 = AMP_OUT_ZERO; |
| 10174 | else if (line_nid == 0x15) |
| 10175 | dac_vol1 = AMP_OUT_ZERO; |
| 10176 | if (hp_nid == 0x14) |
| 10177 | dac_vol2 = AMP_OUT_ZERO; |
| 10178 | else if (hp_nid == 0x15) |
| 10179 | dac_vol1 = AMP_OUT_ZERO; |
| 10180 | if (line_nid != 0x16 || hp_nid != 0x16 || |
| 10181 | spec->autocfg.line_out_pins[1] != 0x16 || |
| 10182 | spec->autocfg.line_out_pins[2] != 0x16) |
| 10183 | dac_vol1 = dac_vol2 = AMP_OUT_ZERO; |
| 10184 | |
| 10185 | snd_hda_codec_write(codec, 0x02, 0, |
| 10186 | AC_VERB_SET_AMP_GAIN_MUTE, dac_vol1); |
| 10187 | snd_hda_codec_write(codec, 0x03, 0, |
| 10188 | AC_VERB_SET_AMP_GAIN_MUTE, dac_vol2); |
| 10189 | } |
| 10190 | |
| 10191 | /* pcm configuration: identiacal with ALC880 */ |
| 10192 | #define alc268_pcm_analog_playback alc880_pcm_analog_playback |
| 10193 | #define alc268_pcm_analog_capture alc880_pcm_analog_capture |
Takashi Iwai | 6330079 | 2008-01-24 15:31:36 +0100 | [diff] [blame] | 10194 | #define alc268_pcm_analog_alt_capture alc880_pcm_analog_alt_capture |
Kailang Yang | a361d84 | 2007-06-05 12:30:55 +0200 | [diff] [blame] | 10195 | #define alc268_pcm_digital_playback alc880_pcm_digital_playback |
| 10196 | |
| 10197 | /* |
| 10198 | * BIOS auto configuration |
| 10199 | */ |
| 10200 | static int alc268_parse_auto_config(struct hda_codec *codec) |
| 10201 | { |
| 10202 | struct alc_spec *spec = codec->spec; |
| 10203 | int err; |
| 10204 | static hda_nid_t alc268_ignore[] = { 0 }; |
| 10205 | |
| 10206 | err = snd_hda_parse_pin_def_config(codec, &spec->autocfg, |
| 10207 | alc268_ignore); |
| 10208 | if (err < 0) |
| 10209 | return err; |
| 10210 | if (!spec->autocfg.line_outs) |
| 10211 | return 0; /* can't find valid BIOS pin config */ |
| 10212 | |
| 10213 | err = alc268_auto_create_multi_out_ctls(spec, &spec->autocfg); |
| 10214 | if (err < 0) |
| 10215 | return err; |
| 10216 | err = alc268_auto_create_analog_input_ctls(spec, &spec->autocfg); |
| 10217 | if (err < 0) |
| 10218 | return err; |
| 10219 | |
| 10220 | spec->multiout.max_channels = 2; |
| 10221 | |
| 10222 | /* digital only support output */ |
| 10223 | if (spec->autocfg.dig_out_pin) |
| 10224 | spec->multiout.dig_out_nid = ALC268_DIGOUT_NID; |
| 10225 | |
| 10226 | if (spec->kctl_alloc) |
| 10227 | spec->mixers[spec->num_mixers++] = spec->kctl_alloc; |
| 10228 | |
Takashi Iwai | aef9d31 | 2008-02-19 13:16:41 +0100 | [diff] [blame] | 10229 | if (spec->autocfg.speaker_pins[0] != 0x1d) |
| 10230 | spec->mixers[spec->num_mixers++] = alc268_beep_mixer; |
| 10231 | |
Kailang Yang | a361d84 | 2007-06-05 12:30:55 +0200 | [diff] [blame] | 10232 | spec->init_verbs[spec->num_init_verbs++] = alc268_volume_init_verbs; |
| 10233 | spec->num_mux_defs = 1; |
| 10234 | spec->input_mux = &spec->private_imux; |
| 10235 | |
Takashi Iwai | 776e184 | 2007-08-29 15:07:11 +0200 | [diff] [blame] | 10236 | err = alc_auto_add_mic_boost(codec); |
| 10237 | if (err < 0) |
| 10238 | return err; |
| 10239 | |
Kailang Yang | a361d84 | 2007-06-05 12:30:55 +0200 | [diff] [blame] | 10240 | return 1; |
| 10241 | } |
| 10242 | |
| 10243 | #define alc268_auto_init_multi_out alc882_auto_init_multi_out |
| 10244 | #define alc268_auto_init_hp_out alc882_auto_init_hp_out |
| 10245 | #define alc268_auto_init_analog_input alc882_auto_init_analog_input |
| 10246 | |
| 10247 | /* init callback for auto-configuration model -- overriding the default init */ |
| 10248 | static void alc268_auto_init(struct hda_codec *codec) |
| 10249 | { |
Takashi Iwai | f6c7e54 | 2008-02-12 18:32:23 +0100 | [diff] [blame] | 10250 | struct alc_spec *spec = codec->spec; |
Kailang Yang | a361d84 | 2007-06-05 12:30:55 +0200 | [diff] [blame] | 10251 | alc268_auto_init_multi_out(codec); |
| 10252 | alc268_auto_init_hp_out(codec); |
| 10253 | alc268_auto_init_mono_speaker_out(codec); |
| 10254 | alc268_auto_init_analog_input(codec); |
Takashi Iwai | f6c7e54 | 2008-02-12 18:32:23 +0100 | [diff] [blame] | 10255 | if (spec->unsol_event) |
| 10256 | alc_sku_automute(codec); |
Kailang Yang | a361d84 | 2007-06-05 12:30:55 +0200 | [diff] [blame] | 10257 | } |
| 10258 | |
| 10259 | /* |
| 10260 | * configuration and preset |
| 10261 | */ |
| 10262 | static const char *alc268_models[ALC268_MODEL_LAST] = { |
| 10263 | [ALC268_3ST] = "3stack", |
Takashi Iwai | 983f8ae | 2007-08-15 16:44:04 +0200 | [diff] [blame] | 10264 | [ALC268_TOSHIBA] = "toshiba", |
Takashi Iwai | d273809 | 2007-08-16 14:59:45 +0200 | [diff] [blame] | 10265 | [ALC268_ACER] = "acer", |
Takashi Iwai | 3866f0b | 2008-01-15 12:37:42 +0100 | [diff] [blame] | 10266 | [ALC268_DELL] = "dell", |
Mirco Tischler | f12462c | 2008-02-04 12:33:59 +0100 | [diff] [blame] | 10267 | [ALC268_ZEPTO] = "zepto", |
Jonathan Woithe | 86c53bd | 2008-01-08 12:33:19 +0100 | [diff] [blame] | 10268 | #ifdef CONFIG_SND_DEBUG |
| 10269 | [ALC268_TEST] = "test", |
| 10270 | #endif |
Kailang Yang | a361d84 | 2007-06-05 12:30:55 +0200 | [diff] [blame] | 10271 | [ALC268_AUTO] = "auto", |
| 10272 | }; |
| 10273 | |
| 10274 | static struct snd_pci_quirk alc268_cfg_tbl[] = { |
Takashi Iwai | ac3e374 | 2007-12-17 17:14:18 +0100 | [diff] [blame] | 10275 | SND_PCI_QUIRK(0x1025, 0x0126, "Acer", ALC268_ACER), |
Andy Shevchenko | dafc835 | 2008-01-25 11:53:50 +0100 | [diff] [blame] | 10276 | SND_PCI_QUIRK(0x1025, 0x012e, "Acer Aspire 5310", ALC268_ACER), |
Takashi Iwai | ac3e374 | 2007-12-17 17:14:18 +0100 | [diff] [blame] | 10277 | SND_PCI_QUIRK(0x1025, 0x0130, "Acer Extensa 5210", ALC268_ACER), |
Andy Shevchenko | 29a52c2 | 2008-01-24 17:29:00 +0100 | [diff] [blame] | 10278 | SND_PCI_QUIRK(0x1025, 0x0136, "Acer Aspire 5315", ALC268_ACER), |
Takashi Iwai | 3866f0b | 2008-01-15 12:37:42 +0100 | [diff] [blame] | 10279 | SND_PCI_QUIRK(0x1028, 0x0253, "Dell OEM", ALC268_DELL), |
Takashi Iwai | ac3e374 | 2007-12-17 17:14:18 +0100 | [diff] [blame] | 10280 | SND_PCI_QUIRK(0x103c, 0x30cc, "TOSHIBA", ALC268_TOSHIBA), |
Kailang Yang | a361d84 | 2007-06-05 12:30:55 +0200 | [diff] [blame] | 10281 | SND_PCI_QUIRK(0x1043, 0x1205, "ASUS W7J", ALC268_3ST), |
Kailang Yang | d1a991a | 2007-08-15 16:21:59 +0200 | [diff] [blame] | 10282 | SND_PCI_QUIRK(0x1179, 0xff10, "TOSHIBA A205", ALC268_TOSHIBA), |
Takashi Iwai | 8e7f00f | 2007-09-07 10:58:58 +0200 | [diff] [blame] | 10283 | SND_PCI_QUIRK(0x1179, 0xff50, "TOSHIBA A305", ALC268_TOSHIBA), |
Takashi Iwai | b875bf3 | 2007-09-06 15:00:27 +0200 | [diff] [blame] | 10284 | SND_PCI_QUIRK(0x152d, 0x0763, "Diverse (CPR2000)", ALC268_ACER), |
Mirco Tischler | f12462c | 2008-02-04 12:33:59 +0100 | [diff] [blame] | 10285 | SND_PCI_QUIRK(0x1170, 0x0040, "ZEPTO", ALC268_ZEPTO), |
Kailang Yang | a361d84 | 2007-06-05 12:30:55 +0200 | [diff] [blame] | 10286 | {} |
| 10287 | }; |
| 10288 | |
| 10289 | static struct alc_config_preset alc268_presets[] = { |
| 10290 | [ALC268_3ST] = { |
Takashi Iwai | aef9d31 | 2008-02-19 13:16:41 +0100 | [diff] [blame] | 10291 | .mixers = { alc268_base_mixer, alc268_capture_alt_mixer, |
| 10292 | alc268_beep_mixer }, |
Kailang Yang | a361d84 | 2007-06-05 12:30:55 +0200 | [diff] [blame] | 10293 | .init_verbs = { alc268_base_init_verbs }, |
| 10294 | .num_dacs = ARRAY_SIZE(alc268_dac_nids), |
| 10295 | .dac_nids = alc268_dac_nids, |
| 10296 | .num_adc_nids = ARRAY_SIZE(alc268_adc_nids_alt), |
| 10297 | .adc_nids = alc268_adc_nids_alt, |
Takashi Iwai | e140634 | 2008-02-11 18:32:32 +0100 | [diff] [blame] | 10298 | .capsrc_nids = alc268_capsrc_nids, |
Kailang Yang | a361d84 | 2007-06-05 12:30:55 +0200 | [diff] [blame] | 10299 | .hp_nid = 0x03, |
| 10300 | .dig_out_nid = ALC268_DIGOUT_NID, |
| 10301 | .num_channel_mode = ARRAY_SIZE(alc268_modes), |
| 10302 | .channel_mode = alc268_modes, |
| 10303 | .input_mux = &alc268_capture_source, |
| 10304 | }, |
Kailang Yang | d1a991a | 2007-08-15 16:21:59 +0200 | [diff] [blame] | 10305 | [ALC268_TOSHIBA] = { |
Takashi Iwai | aef9d31 | 2008-02-19 13:16:41 +0100 | [diff] [blame] | 10306 | .mixers = { alc268_base_mixer, alc268_capture_alt_mixer, |
| 10307 | alc268_beep_mixer }, |
Takashi Iwai | d273809 | 2007-08-16 14:59:45 +0200 | [diff] [blame] | 10308 | .init_verbs = { alc268_base_init_verbs, alc268_eapd_verbs, |
| 10309 | alc268_toshiba_verbs }, |
Kailang Yang | d1a991a | 2007-08-15 16:21:59 +0200 | [diff] [blame] | 10310 | .num_dacs = ARRAY_SIZE(alc268_dac_nids), |
| 10311 | .dac_nids = alc268_dac_nids, |
| 10312 | .num_adc_nids = ARRAY_SIZE(alc268_adc_nids_alt), |
| 10313 | .adc_nids = alc268_adc_nids_alt, |
Takashi Iwai | e140634 | 2008-02-11 18:32:32 +0100 | [diff] [blame] | 10314 | .capsrc_nids = alc268_capsrc_nids, |
Kailang Yang | d1a991a | 2007-08-15 16:21:59 +0200 | [diff] [blame] | 10315 | .hp_nid = 0x03, |
| 10316 | .num_channel_mode = ARRAY_SIZE(alc268_modes), |
| 10317 | .channel_mode = alc268_modes, |
| 10318 | .input_mux = &alc268_capture_source, |
Takashi Iwai | d273809 | 2007-08-16 14:59:45 +0200 | [diff] [blame] | 10319 | .unsol_event = alc268_toshiba_unsol_event, |
| 10320 | .init_hook = alc268_toshiba_automute, |
| 10321 | }, |
| 10322 | [ALC268_ACER] = { |
Takashi Iwai | aef9d31 | 2008-02-19 13:16:41 +0100 | [diff] [blame] | 10323 | .mixers = { alc268_acer_mixer, alc268_capture_alt_mixer, |
| 10324 | alc268_beep_mixer }, |
Takashi Iwai | d273809 | 2007-08-16 14:59:45 +0200 | [diff] [blame] | 10325 | .init_verbs = { alc268_base_init_verbs, alc268_eapd_verbs, |
| 10326 | alc268_acer_verbs }, |
| 10327 | .num_dacs = ARRAY_SIZE(alc268_dac_nids), |
| 10328 | .dac_nids = alc268_dac_nids, |
| 10329 | .num_adc_nids = ARRAY_SIZE(alc268_adc_nids_alt), |
| 10330 | .adc_nids = alc268_adc_nids_alt, |
Takashi Iwai | e140634 | 2008-02-11 18:32:32 +0100 | [diff] [blame] | 10331 | .capsrc_nids = alc268_capsrc_nids, |
Takashi Iwai | d273809 | 2007-08-16 14:59:45 +0200 | [diff] [blame] | 10332 | .hp_nid = 0x02, |
| 10333 | .num_channel_mode = ARRAY_SIZE(alc268_modes), |
| 10334 | .channel_mode = alc268_modes, |
| 10335 | .input_mux = &alc268_capture_source, |
| 10336 | .unsol_event = alc268_acer_unsol_event, |
Takashi Iwai | 889c439 | 2007-08-23 18:56:52 +0200 | [diff] [blame] | 10337 | .init_hook = alc268_acer_init_hook, |
Kailang Yang | d1a991a | 2007-08-15 16:21:59 +0200 | [diff] [blame] | 10338 | }, |
Takashi Iwai | 3866f0b | 2008-01-15 12:37:42 +0100 | [diff] [blame] | 10339 | [ALC268_DELL] = { |
Takashi Iwai | aef9d31 | 2008-02-19 13:16:41 +0100 | [diff] [blame] | 10340 | .mixers = { alc268_dell_mixer, alc268_beep_mixer }, |
Takashi Iwai | 3866f0b | 2008-01-15 12:37:42 +0100 | [diff] [blame] | 10341 | .init_verbs = { alc268_base_init_verbs, alc268_eapd_verbs, |
| 10342 | alc268_dell_verbs }, |
| 10343 | .num_dacs = ARRAY_SIZE(alc268_dac_nids), |
| 10344 | .dac_nids = alc268_dac_nids, |
| 10345 | .hp_nid = 0x02, |
| 10346 | .num_channel_mode = ARRAY_SIZE(alc268_modes), |
| 10347 | .channel_mode = alc268_modes, |
| 10348 | .unsol_event = alc268_dell_unsol_event, |
| 10349 | .init_hook = alc268_dell_init_hook, |
| 10350 | .input_mux = &alc268_capture_source, |
| 10351 | }, |
Mirco Tischler | f12462c | 2008-02-04 12:33:59 +0100 | [diff] [blame] | 10352 | [ALC268_ZEPTO] = { |
Takashi Iwai | aef9d31 | 2008-02-19 13:16:41 +0100 | [diff] [blame] | 10353 | .mixers = { alc268_base_mixer, alc268_capture_alt_mixer, |
| 10354 | alc268_beep_mixer }, |
Mirco Tischler | f12462c | 2008-02-04 12:33:59 +0100 | [diff] [blame] | 10355 | .init_verbs = { alc268_base_init_verbs, alc268_eapd_verbs, |
| 10356 | alc268_toshiba_verbs }, |
| 10357 | .num_dacs = ARRAY_SIZE(alc268_dac_nids), |
| 10358 | .dac_nids = alc268_dac_nids, |
| 10359 | .num_adc_nids = ARRAY_SIZE(alc268_adc_nids_alt), |
| 10360 | .adc_nids = alc268_adc_nids_alt, |
Takashi Iwai | e140634 | 2008-02-11 18:32:32 +0100 | [diff] [blame] | 10361 | .capsrc_nids = alc268_capsrc_nids, |
Mirco Tischler | f12462c | 2008-02-04 12:33:59 +0100 | [diff] [blame] | 10362 | .hp_nid = 0x03, |
| 10363 | .dig_out_nid = ALC268_DIGOUT_NID, |
| 10364 | .num_channel_mode = ARRAY_SIZE(alc268_modes), |
| 10365 | .channel_mode = alc268_modes, |
| 10366 | .input_mux = &alc268_capture_source, |
| 10367 | .unsol_event = alc268_toshiba_unsol_event, |
| 10368 | .init_hook = alc268_toshiba_automute |
| 10369 | }, |
Jonathan Woithe | 86c53bd | 2008-01-08 12:33:19 +0100 | [diff] [blame] | 10370 | #ifdef CONFIG_SND_DEBUG |
| 10371 | [ALC268_TEST] = { |
| 10372 | .mixers = { alc268_test_mixer, alc268_capture_mixer }, |
| 10373 | .init_verbs = { alc268_base_init_verbs, alc268_eapd_verbs, |
| 10374 | alc268_volume_init_verbs }, |
| 10375 | .num_dacs = ARRAY_SIZE(alc268_dac_nids), |
| 10376 | .dac_nids = alc268_dac_nids, |
| 10377 | .num_adc_nids = ARRAY_SIZE(alc268_adc_nids_alt), |
| 10378 | .adc_nids = alc268_adc_nids_alt, |
Takashi Iwai | e140634 | 2008-02-11 18:32:32 +0100 | [diff] [blame] | 10379 | .capsrc_nids = alc268_capsrc_nids, |
Jonathan Woithe | 86c53bd | 2008-01-08 12:33:19 +0100 | [diff] [blame] | 10380 | .hp_nid = 0x03, |
| 10381 | .dig_out_nid = ALC268_DIGOUT_NID, |
| 10382 | .num_channel_mode = ARRAY_SIZE(alc268_modes), |
| 10383 | .channel_mode = alc268_modes, |
| 10384 | .input_mux = &alc268_capture_source, |
| 10385 | }, |
| 10386 | #endif |
Kailang Yang | a361d84 | 2007-06-05 12:30:55 +0200 | [diff] [blame] | 10387 | }; |
| 10388 | |
| 10389 | static int patch_alc268(struct hda_codec *codec) |
| 10390 | { |
| 10391 | struct alc_spec *spec; |
| 10392 | int board_config; |
| 10393 | int err; |
| 10394 | |
| 10395 | spec = kcalloc(1, sizeof(*spec), GFP_KERNEL); |
| 10396 | if (spec == NULL) |
| 10397 | return -ENOMEM; |
| 10398 | |
| 10399 | codec->spec = spec; |
| 10400 | |
| 10401 | board_config = snd_hda_check_board_config(codec, ALC268_MODEL_LAST, |
| 10402 | alc268_models, |
| 10403 | alc268_cfg_tbl); |
| 10404 | |
| 10405 | if (board_config < 0 || board_config >= ALC268_MODEL_LAST) { |
| 10406 | printk(KERN_INFO "hda_codec: Unknown model for ALC268, " |
| 10407 | "trying auto-probe from BIOS...\n"); |
| 10408 | board_config = ALC268_AUTO; |
| 10409 | } |
| 10410 | |
| 10411 | if (board_config == ALC268_AUTO) { |
| 10412 | /* automatic parse from the BIOS config */ |
| 10413 | err = alc268_parse_auto_config(codec); |
| 10414 | if (err < 0) { |
| 10415 | alc_free(codec); |
| 10416 | return err; |
| 10417 | } else if (!err) { |
| 10418 | printk(KERN_INFO |
| 10419 | "hda_codec: Cannot set up configuration " |
| 10420 | "from BIOS. Using base mode...\n"); |
| 10421 | board_config = ALC268_3ST; |
| 10422 | } |
| 10423 | } |
| 10424 | |
| 10425 | if (board_config != ALC268_AUTO) |
| 10426 | setup_preset(spec, &alc268_presets[board_config]); |
| 10427 | |
| 10428 | spec->stream_name_analog = "ALC268 Analog"; |
| 10429 | spec->stream_analog_playback = &alc268_pcm_analog_playback; |
| 10430 | spec->stream_analog_capture = &alc268_pcm_analog_capture; |
Takashi Iwai | 6330079 | 2008-01-24 15:31:36 +0100 | [diff] [blame] | 10431 | spec->stream_analog_alt_capture = &alc268_pcm_analog_alt_capture; |
Kailang Yang | a361d84 | 2007-06-05 12:30:55 +0200 | [diff] [blame] | 10432 | |
| 10433 | spec->stream_name_digital = "ALC268 Digital"; |
| 10434 | spec->stream_digital_playback = &alc268_pcm_digital_playback; |
| 10435 | |
Takashi Iwai | aef9d31 | 2008-02-19 13:16:41 +0100 | [diff] [blame] | 10436 | if (!query_amp_caps(codec, 0x1d, HDA_INPUT)) |
| 10437 | /* override the amp caps for beep generator */ |
| 10438 | snd_hda_override_amp_caps(codec, 0x1d, HDA_INPUT, |
| 10439 | (0x0c << AC_AMPCAP_OFFSET_SHIFT) | |
| 10440 | (0x0c << AC_AMPCAP_NUM_STEPS_SHIFT) | |
| 10441 | (0x07 << AC_AMPCAP_STEP_SIZE_SHIFT) | |
| 10442 | (0 << AC_AMPCAP_MUTE_SHIFT)); |
| 10443 | |
Takashi Iwai | 3866f0b | 2008-01-15 12:37:42 +0100 | [diff] [blame] | 10444 | if (!spec->adc_nids && spec->input_mux) { |
| 10445 | /* check whether NID 0x07 is valid */ |
| 10446 | unsigned int wcap = get_wcaps(codec, 0x07); |
Takashi Iwai | 85860c0 | 2008-02-19 15:00:15 +0100 | [diff] [blame] | 10447 | int i; |
Kailang Yang | a361d84 | 2007-06-05 12:30:55 +0200 | [diff] [blame] | 10448 | |
Takashi Iwai | 3866f0b | 2008-01-15 12:37:42 +0100 | [diff] [blame] | 10449 | /* get type */ |
| 10450 | wcap = (wcap & AC_WCAP_TYPE) >> AC_WCAP_TYPE_SHIFT; |
Takashi Iwai | 67ebcb0 | 2008-02-19 15:03:57 +0100 | [diff] [blame] | 10451 | if (wcap != AC_WID_AUD_IN || spec->input_mux->num_items == 1) { |
Takashi Iwai | 3866f0b | 2008-01-15 12:37:42 +0100 | [diff] [blame] | 10452 | spec->adc_nids = alc268_adc_nids_alt; |
| 10453 | spec->num_adc_nids = ARRAY_SIZE(alc268_adc_nids_alt); |
| 10454 | spec->mixers[spec->num_mixers] = |
Kailang Yang | a361d84 | 2007-06-05 12:30:55 +0200 | [diff] [blame] | 10455 | alc268_capture_alt_mixer; |
Takashi Iwai | 3866f0b | 2008-01-15 12:37:42 +0100 | [diff] [blame] | 10456 | spec->num_mixers++; |
| 10457 | } else { |
| 10458 | spec->adc_nids = alc268_adc_nids; |
| 10459 | spec->num_adc_nids = ARRAY_SIZE(alc268_adc_nids); |
| 10460 | spec->mixers[spec->num_mixers] = |
| 10461 | alc268_capture_mixer; |
| 10462 | spec->num_mixers++; |
Kailang Yang | a361d84 | 2007-06-05 12:30:55 +0200 | [diff] [blame] | 10463 | } |
Takashi Iwai | e140634 | 2008-02-11 18:32:32 +0100 | [diff] [blame] | 10464 | spec->capsrc_nids = alc268_capsrc_nids; |
Takashi Iwai | 85860c0 | 2008-02-19 15:00:15 +0100 | [diff] [blame] | 10465 | /* set default input source */ |
| 10466 | for (i = 0; i < spec->num_adc_nids; i++) |
| 10467 | snd_hda_codec_write_cache(codec, alc268_capsrc_nids[i], |
| 10468 | 0, AC_VERB_SET_CONNECT_SEL, |
| 10469 | spec->input_mux->items[0].index); |
Kailang Yang | a361d84 | 2007-06-05 12:30:55 +0200 | [diff] [blame] | 10470 | } |
Takashi Iwai | 2134ea4 | 2008-01-10 16:53:55 +0100 | [diff] [blame] | 10471 | |
| 10472 | spec->vmaster_nid = 0x02; |
| 10473 | |
Kailang Yang | a361d84 | 2007-06-05 12:30:55 +0200 | [diff] [blame] | 10474 | codec->patch_ops = alc_patch_ops; |
| 10475 | if (board_config == ALC268_AUTO) |
| 10476 | spec->init_hook = alc268_auto_init; |
| 10477 | |
| 10478 | return 0; |
| 10479 | } |
| 10480 | |
| 10481 | /* |
Kailang Yang | f6a9224 | 2007-12-13 16:52:54 +0100 | [diff] [blame] | 10482 | * ALC269 channel source setting (2 channel) |
| 10483 | */ |
| 10484 | #define ALC269_DIGOUT_NID ALC880_DIGOUT_NID |
| 10485 | |
| 10486 | #define alc269_dac_nids alc260_dac_nids |
| 10487 | |
| 10488 | static hda_nid_t alc269_adc_nids[1] = { |
| 10489 | /* ADC1 */ |
| 10490 | 0x07, |
| 10491 | }; |
| 10492 | |
| 10493 | #define alc269_modes alc260_modes |
| 10494 | #define alc269_capture_source alc880_lg_lw_capture_source |
| 10495 | |
| 10496 | static struct snd_kcontrol_new alc269_base_mixer[] = { |
| 10497 | HDA_CODEC_VOLUME("Front Playback Volume", 0x02, 0x0, HDA_OUTPUT), |
| 10498 | HDA_CODEC_MUTE("Front Playback Switch", 0x14, 0x0, HDA_OUTPUT), |
| 10499 | HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT), |
| 10500 | HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT), |
| 10501 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), |
| 10502 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), |
| 10503 | HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT), |
| 10504 | HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x01, HDA_INPUT), |
| 10505 | HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x01, HDA_INPUT), |
| 10506 | HDA_CODEC_VOLUME("Front Mic Boost", 0x19, 0, HDA_INPUT), |
| 10507 | HDA_CODEC_MUTE("Headphone Playback Switch", 0x15, 0x0, HDA_OUTPUT), |
| 10508 | HDA_CODEC_MUTE_MONO("Mono Playback Switch", 0x16, 2, 0x0, HDA_OUTPUT), |
| 10509 | { } /* end */ |
| 10510 | }; |
| 10511 | |
| 10512 | /* capture mixer elements */ |
| 10513 | static struct snd_kcontrol_new alc269_capture_mixer[] = { |
| 10514 | HDA_CODEC_VOLUME("Capture Volume", 0x07, 0x0, HDA_INPUT), |
| 10515 | HDA_CODEC_MUTE("Capture Switch", 0x07, 0x0, HDA_INPUT), |
| 10516 | { |
| 10517 | .iface = SNDRV_CTL_ELEM_IFACE_MIXER, |
| 10518 | /* The multiple "Capture Source" controls confuse alsamixer |
| 10519 | * So call somewhat different.. |
Kailang Yang | f6a9224 | 2007-12-13 16:52:54 +0100 | [diff] [blame] | 10520 | */ |
| 10521 | /* .name = "Capture Source", */ |
| 10522 | .name = "Input Source", |
| 10523 | .count = 1, |
| 10524 | .info = alc_mux_enum_info, |
| 10525 | .get = alc_mux_enum_get, |
| 10526 | .put = alc_mux_enum_put, |
| 10527 | }, |
| 10528 | { } /* end */ |
| 10529 | }; |
| 10530 | |
| 10531 | /* |
| 10532 | * generic initialization of ADC, input mixers and output mixers |
| 10533 | */ |
| 10534 | static struct hda_verb alc269_init_verbs[] = { |
| 10535 | /* |
| 10536 | * Unmute ADC0 and set the default input to mic-in |
| 10537 | */ |
| 10538 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 10539 | |
| 10540 | /* Mute input amps (PCBeep, Line In, Mic 1 & Mic 2) of the |
| 10541 | * analog-loopback mixer widget |
| 10542 | * Note: PASD motherboards uses the Line In 2 as the input for |
| 10543 | * front panel mic (mic 2) |
| 10544 | */ |
| 10545 | /* Amp Indices: Mic1 = 0, Mic2 = 1, Line1 = 2, Line2 = 3, CD = 4 */ |
| 10546 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 10547 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
| 10548 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)}, |
| 10549 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)}, |
| 10550 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)}, |
| 10551 | |
| 10552 | /* |
| 10553 | * Set up output mixers (0x0c - 0x0e) |
| 10554 | */ |
| 10555 | /* set vol=0 to output mixers */ |
| 10556 | {0x02, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 10557 | {0x03, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 10558 | |
| 10559 | /* set up input amps for analog loopback */ |
| 10560 | /* Amp Indices: DAC = 0, mixer = 1 */ |
| 10561 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 10562 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 10563 | {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 10564 | {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 10565 | {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 10566 | {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 10567 | |
| 10568 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 10569 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 10570 | {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 10571 | {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80}, |
| 10572 | {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80}, |
| 10573 | {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
| 10574 | {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
| 10575 | |
| 10576 | {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 10577 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 10578 | {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
| 10579 | {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
| 10580 | {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
| 10581 | {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
| 10582 | {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
| 10583 | |
| 10584 | {0x14, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 10585 | {0x15, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 10586 | |
| 10587 | /* FIXME: use matrix-type input source selection */ |
| 10588 | /* Mixer elements: 0x18, 19, 1a, 1b, 1d, 0b */ |
| 10589 | /* Input mixer1: unmute Mic, F-Mic, Line, CD inputs */ |
| 10590 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 10591 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
| 10592 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)}, |
| 10593 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)}, |
| 10594 | |
| 10595 | /* set EAPD */ |
| 10596 | {0x14, AC_VERB_SET_EAPD_BTLENABLE, 2}, |
| 10597 | {0x15, AC_VERB_SET_EAPD_BTLENABLE, 2}, |
| 10598 | { } |
| 10599 | }; |
| 10600 | |
| 10601 | /* add playback controls from the parsed DAC table */ |
| 10602 | static int alc269_auto_create_multi_out_ctls(struct alc_spec *spec, |
| 10603 | const struct auto_pin_cfg *cfg) |
| 10604 | { |
| 10605 | hda_nid_t nid; |
| 10606 | int err; |
| 10607 | |
| 10608 | spec->multiout.num_dacs = 1; /* only use one dac */ |
| 10609 | spec->multiout.dac_nids = spec->private_dac_nids; |
| 10610 | spec->multiout.dac_nids[0] = 2; |
| 10611 | |
| 10612 | nid = cfg->line_out_pins[0]; |
| 10613 | if (nid) { |
| 10614 | err = add_control(spec, ALC_CTL_WIDGET_VOL, |
| 10615 | "Front Playback Volume", |
| 10616 | HDA_COMPOSE_AMP_VAL(0x02, 3, 0, HDA_OUTPUT)); |
| 10617 | if (err < 0) |
| 10618 | return err; |
| 10619 | err = add_control(spec, ALC_CTL_WIDGET_MUTE, |
| 10620 | "Front Playback Switch", |
| 10621 | HDA_COMPOSE_AMP_VAL(nid, 3, 0, HDA_OUTPUT)); |
| 10622 | if (err < 0) |
| 10623 | return err; |
| 10624 | } |
| 10625 | |
| 10626 | nid = cfg->speaker_pins[0]; |
| 10627 | if (nid) { |
| 10628 | if (!cfg->line_out_pins[0]) { |
| 10629 | err = add_control(spec, ALC_CTL_WIDGET_VOL, |
| 10630 | "Speaker Playback Volume", |
| 10631 | HDA_COMPOSE_AMP_VAL(0x02, 3, 0, |
| 10632 | HDA_OUTPUT)); |
| 10633 | if (err < 0) |
| 10634 | return err; |
| 10635 | } |
| 10636 | if (nid == 0x16) { |
| 10637 | err = add_control(spec, ALC_CTL_WIDGET_MUTE, |
| 10638 | "Speaker Playback Switch", |
| 10639 | HDA_COMPOSE_AMP_VAL(nid, 2, 0, |
| 10640 | HDA_OUTPUT)); |
| 10641 | if (err < 0) |
| 10642 | return err; |
| 10643 | } else { |
| 10644 | err = add_control(spec, ALC_CTL_WIDGET_MUTE, |
| 10645 | "Speaker Playback Switch", |
| 10646 | HDA_COMPOSE_AMP_VAL(nid, 3, 0, |
| 10647 | HDA_OUTPUT)); |
| 10648 | if (err < 0) |
| 10649 | return err; |
| 10650 | } |
| 10651 | } |
| 10652 | nid = cfg->hp_pins[0]; |
| 10653 | if (nid) { |
| 10654 | /* spec->multiout.hp_nid = 2; */ |
| 10655 | if (!cfg->line_out_pins[0] && !cfg->speaker_pins[0]) { |
| 10656 | err = add_control(spec, ALC_CTL_WIDGET_VOL, |
| 10657 | "Headphone Playback Volume", |
| 10658 | HDA_COMPOSE_AMP_VAL(0x02, 3, 0, |
| 10659 | HDA_OUTPUT)); |
| 10660 | if (err < 0) |
| 10661 | return err; |
| 10662 | } |
| 10663 | if (nid == 0x16) { |
| 10664 | err = add_control(spec, ALC_CTL_WIDGET_MUTE, |
| 10665 | "Headphone Playback Switch", |
| 10666 | HDA_COMPOSE_AMP_VAL(nid, 2, 0, |
| 10667 | HDA_OUTPUT)); |
| 10668 | if (err < 0) |
| 10669 | return err; |
| 10670 | } else { |
| 10671 | err = add_control(spec, ALC_CTL_WIDGET_MUTE, |
| 10672 | "Headphone Playback Switch", |
| 10673 | HDA_COMPOSE_AMP_VAL(nid, 3, 0, |
| 10674 | HDA_OUTPUT)); |
| 10675 | if (err < 0) |
| 10676 | return err; |
| 10677 | } |
| 10678 | } |
| 10679 | return 0; |
| 10680 | } |
| 10681 | |
| 10682 | #define alc269_auto_create_analog_input_ctls \ |
| 10683 | alc880_auto_create_analog_input_ctls |
| 10684 | |
| 10685 | #ifdef CONFIG_SND_HDA_POWER_SAVE |
| 10686 | #define alc269_loopbacks alc880_loopbacks |
| 10687 | #endif |
| 10688 | |
| 10689 | /* pcm configuration: identiacal with ALC880 */ |
| 10690 | #define alc269_pcm_analog_playback alc880_pcm_analog_playback |
| 10691 | #define alc269_pcm_analog_capture alc880_pcm_analog_capture |
| 10692 | #define alc269_pcm_digital_playback alc880_pcm_digital_playback |
| 10693 | #define alc269_pcm_digital_capture alc880_pcm_digital_capture |
| 10694 | |
| 10695 | /* |
| 10696 | * BIOS auto configuration |
| 10697 | */ |
| 10698 | static int alc269_parse_auto_config(struct hda_codec *codec) |
| 10699 | { |
| 10700 | struct alc_spec *spec = codec->spec; |
| 10701 | int err; |
| 10702 | static hda_nid_t alc269_ignore[] = { 0x1d, 0 }; |
| 10703 | |
| 10704 | err = snd_hda_parse_pin_def_config(codec, &spec->autocfg, |
| 10705 | alc269_ignore); |
| 10706 | if (err < 0) |
| 10707 | return err; |
| 10708 | |
| 10709 | err = alc269_auto_create_multi_out_ctls(spec, &spec->autocfg); |
| 10710 | if (err < 0) |
| 10711 | return err; |
| 10712 | err = alc269_auto_create_analog_input_ctls(spec, &spec->autocfg); |
| 10713 | if (err < 0) |
| 10714 | return err; |
| 10715 | |
| 10716 | spec->multiout.max_channels = spec->multiout.num_dacs * 2; |
| 10717 | |
| 10718 | if (spec->autocfg.dig_out_pin) |
| 10719 | spec->multiout.dig_out_nid = ALC269_DIGOUT_NID; |
| 10720 | |
| 10721 | if (spec->kctl_alloc) |
| 10722 | spec->mixers[spec->num_mixers++] = spec->kctl_alloc; |
| 10723 | |
| 10724 | spec->init_verbs[spec->num_init_verbs++] = alc269_init_verbs; |
| 10725 | spec->num_mux_defs = 1; |
| 10726 | spec->input_mux = &spec->private_imux; |
| 10727 | |
| 10728 | err = alc_auto_add_mic_boost(codec); |
| 10729 | if (err < 0) |
| 10730 | return err; |
| 10731 | |
| 10732 | return 1; |
| 10733 | } |
| 10734 | |
| 10735 | #define alc269_auto_init_multi_out alc882_auto_init_multi_out |
| 10736 | #define alc269_auto_init_hp_out alc882_auto_init_hp_out |
| 10737 | #define alc269_auto_init_analog_input alc882_auto_init_analog_input |
| 10738 | |
| 10739 | |
| 10740 | /* init callback for auto-configuration model -- overriding the default init */ |
| 10741 | static void alc269_auto_init(struct hda_codec *codec) |
| 10742 | { |
Takashi Iwai | f6c7e54 | 2008-02-12 18:32:23 +0100 | [diff] [blame] | 10743 | struct alc_spec *spec = codec->spec; |
Kailang Yang | f6a9224 | 2007-12-13 16:52:54 +0100 | [diff] [blame] | 10744 | alc269_auto_init_multi_out(codec); |
| 10745 | alc269_auto_init_hp_out(codec); |
| 10746 | alc269_auto_init_analog_input(codec); |
Takashi Iwai | f6c7e54 | 2008-02-12 18:32:23 +0100 | [diff] [blame] | 10747 | if (spec->unsol_event) |
| 10748 | alc_sku_automute(codec); |
Kailang Yang | f6a9224 | 2007-12-13 16:52:54 +0100 | [diff] [blame] | 10749 | } |
| 10750 | |
| 10751 | /* |
| 10752 | * configuration and preset |
| 10753 | */ |
| 10754 | static const char *alc269_models[ALC269_MODEL_LAST] = { |
| 10755 | [ALC269_BASIC] = "basic", |
| 10756 | }; |
| 10757 | |
| 10758 | static struct snd_pci_quirk alc269_cfg_tbl[] = { |
| 10759 | {} |
| 10760 | }; |
| 10761 | |
| 10762 | static struct alc_config_preset alc269_presets[] = { |
| 10763 | [ALC269_BASIC] = { |
| 10764 | .mixers = { alc269_base_mixer }, |
| 10765 | .init_verbs = { alc269_init_verbs }, |
| 10766 | .num_dacs = ARRAY_SIZE(alc269_dac_nids), |
| 10767 | .dac_nids = alc269_dac_nids, |
| 10768 | .hp_nid = 0x03, |
| 10769 | .num_channel_mode = ARRAY_SIZE(alc269_modes), |
| 10770 | .channel_mode = alc269_modes, |
| 10771 | .input_mux = &alc269_capture_source, |
| 10772 | }, |
| 10773 | }; |
| 10774 | |
| 10775 | static int patch_alc269(struct hda_codec *codec) |
| 10776 | { |
| 10777 | struct alc_spec *spec; |
| 10778 | int board_config; |
| 10779 | int err; |
| 10780 | |
| 10781 | spec = kzalloc(sizeof(*spec), GFP_KERNEL); |
| 10782 | if (spec == NULL) |
| 10783 | return -ENOMEM; |
| 10784 | |
| 10785 | codec->spec = spec; |
| 10786 | |
| 10787 | board_config = snd_hda_check_board_config(codec, ALC269_MODEL_LAST, |
| 10788 | alc269_models, |
| 10789 | alc269_cfg_tbl); |
| 10790 | |
| 10791 | if (board_config < 0) { |
| 10792 | printk(KERN_INFO "hda_codec: Unknown model for ALC269, " |
| 10793 | "trying auto-probe from BIOS...\n"); |
| 10794 | board_config = ALC269_AUTO; |
| 10795 | } |
| 10796 | |
| 10797 | if (board_config == ALC269_AUTO) { |
| 10798 | /* automatic parse from the BIOS config */ |
| 10799 | err = alc269_parse_auto_config(codec); |
| 10800 | if (err < 0) { |
| 10801 | alc_free(codec); |
| 10802 | return err; |
| 10803 | } else if (!err) { |
| 10804 | printk(KERN_INFO |
| 10805 | "hda_codec: Cannot set up configuration " |
| 10806 | "from BIOS. Using base mode...\n"); |
| 10807 | board_config = ALC269_BASIC; |
| 10808 | } |
| 10809 | } |
| 10810 | |
| 10811 | if (board_config != ALC269_AUTO) |
| 10812 | setup_preset(spec, &alc269_presets[board_config]); |
| 10813 | |
| 10814 | spec->stream_name_analog = "ALC269 Analog"; |
| 10815 | spec->stream_analog_playback = &alc269_pcm_analog_playback; |
| 10816 | spec->stream_analog_capture = &alc269_pcm_analog_capture; |
| 10817 | |
| 10818 | spec->stream_name_digital = "ALC269 Digital"; |
| 10819 | spec->stream_digital_playback = &alc269_pcm_digital_playback; |
| 10820 | spec->stream_digital_capture = &alc269_pcm_digital_capture; |
| 10821 | |
| 10822 | spec->adc_nids = alc269_adc_nids; |
| 10823 | spec->num_adc_nids = ARRAY_SIZE(alc269_adc_nids); |
| 10824 | spec->mixers[spec->num_mixers] = alc269_capture_mixer; |
| 10825 | spec->num_mixers++; |
| 10826 | |
| 10827 | codec->patch_ops = alc_patch_ops; |
| 10828 | if (board_config == ALC269_AUTO) |
| 10829 | spec->init_hook = alc269_auto_init; |
| 10830 | #ifdef CONFIG_SND_HDA_POWER_SAVE |
| 10831 | if (!spec->loopback.amplist) |
| 10832 | spec->loopback.amplist = alc269_loopbacks; |
| 10833 | #endif |
| 10834 | |
| 10835 | return 0; |
| 10836 | } |
| 10837 | |
| 10838 | /* |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 10839 | * ALC861 channel source setting (2/6 channel selection for 3-stack) |
| 10840 | */ |
| 10841 | |
| 10842 | /* |
| 10843 | * set the path ways for 2 channel output |
| 10844 | * need to set the codec line out and mic 1 pin widgets to inputs |
| 10845 | */ |
| 10846 | static struct hda_verb alc861_threestack_ch2_init[] = { |
| 10847 | /* set pin widget 1Ah (line in) for input */ |
| 10848 | { 0x0c, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20 }, |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 10849 | /* set pin widget 18h (mic1/2) for input, for mic also enable |
| 10850 | * the vref |
| 10851 | */ |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 10852 | { 0x0d, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24 }, |
| 10853 | |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 10854 | { 0x15, AC_VERB_SET_AMP_GAIN_MUTE, 0xb00c }, |
| 10855 | #if 0 |
| 10856 | { 0x15, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x01 << 8)) }, /*mic*/ |
| 10857 | { 0x15, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x02 << 8)) }, /*line-in*/ |
| 10858 | #endif |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 10859 | { } /* end */ |
| 10860 | }; |
| 10861 | /* |
| 10862 | * 6ch mode |
| 10863 | * need to set the codec line out and mic 1 pin widgets to outputs |
| 10864 | */ |
| 10865 | static struct hda_verb alc861_threestack_ch6_init[] = { |
| 10866 | /* set pin widget 1Ah (line in) for output (Back Surround)*/ |
| 10867 | { 0x0c, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x40 }, |
| 10868 | /* set pin widget 18h (mic1) for output (CLFE)*/ |
| 10869 | { 0x0d, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x40 }, |
| 10870 | |
| 10871 | { 0x0c, AC_VERB_SET_CONNECT_SEL, 0x00 }, |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 10872 | { 0x0d, AC_VERB_SET_CONNECT_SEL, 0x00 }, |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 10873 | |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 10874 | { 0x15, AC_VERB_SET_AMP_GAIN_MUTE, 0xb080 }, |
| 10875 | #if 0 |
| 10876 | { 0x15, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x01 << 8)) }, /*mic*/ |
| 10877 | { 0x15, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x02 << 8)) }, /*line in*/ |
| 10878 | #endif |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 10879 | { } /* end */ |
| 10880 | }; |
| 10881 | |
| 10882 | static struct hda_channel_mode alc861_threestack_modes[2] = { |
| 10883 | { 2, alc861_threestack_ch2_init }, |
| 10884 | { 6, alc861_threestack_ch6_init }, |
| 10885 | }; |
Takashi Iwai | 22309c3 | 2006-08-09 16:57:28 +0200 | [diff] [blame] | 10886 | /* Set mic1 as input and unmute the mixer */ |
| 10887 | static struct hda_verb alc861_uniwill_m31_ch2_init[] = { |
| 10888 | { 0x0d, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24 }, |
| 10889 | { 0x15, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x01 << 8)) }, /*mic*/ |
| 10890 | { } /* end */ |
| 10891 | }; |
| 10892 | /* Set mic1 as output and mute mixer */ |
| 10893 | static struct hda_verb alc861_uniwill_m31_ch4_init[] = { |
| 10894 | { 0x0d, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x40 }, |
| 10895 | { 0x15, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x01 << 8)) }, /*mic*/ |
| 10896 | { } /* end */ |
| 10897 | }; |
| 10898 | |
| 10899 | static struct hda_channel_mode alc861_uniwill_m31_modes[2] = { |
| 10900 | { 2, alc861_uniwill_m31_ch2_init }, |
| 10901 | { 4, alc861_uniwill_m31_ch4_init }, |
| 10902 | }; |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 10903 | |
Mariusz Domanski | 7cdbff9 | 2006-10-23 13:42:56 +0200 | [diff] [blame] | 10904 | /* Set mic1 and line-in as input and unmute the mixer */ |
| 10905 | static struct hda_verb alc861_asus_ch2_init[] = { |
| 10906 | /* set pin widget 1Ah (line in) for input */ |
| 10907 | { 0x0c, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20 }, |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 10908 | /* set pin widget 18h (mic1/2) for input, for mic also enable |
| 10909 | * the vref |
| 10910 | */ |
Mariusz Domanski | 7cdbff9 | 2006-10-23 13:42:56 +0200 | [diff] [blame] | 10911 | { 0x0d, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24 }, |
| 10912 | |
| 10913 | { 0x15, AC_VERB_SET_AMP_GAIN_MUTE, 0xb00c }, |
| 10914 | #if 0 |
| 10915 | { 0x15, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x01 << 8)) }, /*mic*/ |
| 10916 | { 0x15, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x02 << 8)) }, /*line-in*/ |
| 10917 | #endif |
| 10918 | { } /* end */ |
| 10919 | }; |
| 10920 | /* Set mic1 nad line-in as output and mute mixer */ |
| 10921 | static struct hda_verb alc861_asus_ch6_init[] = { |
| 10922 | /* set pin widget 1Ah (line in) for output (Back Surround)*/ |
| 10923 | { 0x0c, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x40 }, |
| 10924 | /* { 0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE }, */ |
| 10925 | /* set pin widget 18h (mic1) for output (CLFE)*/ |
| 10926 | { 0x0d, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x40 }, |
| 10927 | /* { 0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE }, */ |
| 10928 | { 0x0c, AC_VERB_SET_CONNECT_SEL, 0x00 }, |
| 10929 | { 0x0d, AC_VERB_SET_CONNECT_SEL, 0x00 }, |
| 10930 | |
| 10931 | { 0x15, AC_VERB_SET_AMP_GAIN_MUTE, 0xb080 }, |
| 10932 | #if 0 |
| 10933 | { 0x15, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x01 << 8)) }, /*mic*/ |
| 10934 | { 0x15, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x02 << 8)) }, /*line in*/ |
| 10935 | #endif |
| 10936 | { } /* end */ |
| 10937 | }; |
| 10938 | |
| 10939 | static struct hda_channel_mode alc861_asus_modes[2] = { |
| 10940 | { 2, alc861_asus_ch2_init }, |
| 10941 | { 6, alc861_asus_ch6_init }, |
| 10942 | }; |
| 10943 | |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 10944 | /* patch-ALC861 */ |
| 10945 | |
| 10946 | static struct snd_kcontrol_new alc861_base_mixer[] = { |
| 10947 | /* output mixer control */ |
| 10948 | HDA_CODEC_MUTE("Front Playback Switch", 0x03, 0x0, HDA_OUTPUT), |
| 10949 | HDA_CODEC_MUTE("Surround Playback Switch", 0x06, 0x0, HDA_OUTPUT), |
| 10950 | HDA_CODEC_MUTE_MONO("Center Playback Switch", 0x05, 1, 0x0, HDA_OUTPUT), |
| 10951 | HDA_CODEC_MUTE_MONO("LFE Playback Switch", 0x05, 2, 0x0, HDA_OUTPUT), |
| 10952 | HDA_CODEC_MUTE("Side Playback Switch", 0x04, 0x0, HDA_OUTPUT), |
| 10953 | |
| 10954 | /*Input mixer control */ |
| 10955 | /* HDA_CODEC_VOLUME("Input Playback Volume", 0x15, 0x0, HDA_OUTPUT), |
| 10956 | HDA_CODEC_MUTE("Input Playback Switch", 0x15, 0x0, HDA_OUTPUT), */ |
| 10957 | HDA_CODEC_VOLUME("CD Playback Volume", 0x15, 0x0, HDA_INPUT), |
| 10958 | HDA_CODEC_MUTE("CD Playback Switch", 0x15, 0x0, HDA_INPUT), |
| 10959 | HDA_CODEC_VOLUME("Line Playback Volume", 0x15, 0x02, HDA_INPUT), |
| 10960 | HDA_CODEC_MUTE("Line Playback Switch", 0x15, 0x02, HDA_INPUT), |
| 10961 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x15, 0x01, HDA_INPUT), |
| 10962 | HDA_CODEC_MUTE("Mic Playback Switch", 0x15, 0x01, HDA_INPUT), |
| 10963 | HDA_CODEC_MUTE("Front Mic Playback Switch", 0x10, 0x01, HDA_OUTPUT), |
| 10964 | HDA_CODEC_MUTE("Headphone Playback Switch", 0x1a, 0x03, HDA_INPUT), |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 10965 | |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 10966 | /* Capture mixer control */ |
| 10967 | HDA_CODEC_VOLUME("Capture Volume", 0x08, 0x0, HDA_INPUT), |
| 10968 | HDA_CODEC_MUTE("Capture Switch", 0x08, 0x0, HDA_INPUT), |
| 10969 | { |
| 10970 | .iface = SNDRV_CTL_ELEM_IFACE_MIXER, |
| 10971 | .name = "Capture Source", |
| 10972 | .count = 1, |
| 10973 | .info = alc_mux_enum_info, |
| 10974 | .get = alc_mux_enum_get, |
| 10975 | .put = alc_mux_enum_put, |
| 10976 | }, |
| 10977 | { } /* end */ |
| 10978 | }; |
| 10979 | |
| 10980 | static struct snd_kcontrol_new alc861_3ST_mixer[] = { |
| 10981 | /* output mixer control */ |
| 10982 | HDA_CODEC_MUTE("Front Playback Switch", 0x03, 0x0, HDA_OUTPUT), |
| 10983 | HDA_CODEC_MUTE("Surround Playback Switch", 0x06, 0x0, HDA_OUTPUT), |
| 10984 | HDA_CODEC_MUTE_MONO("Center Playback Switch", 0x05, 1, 0x0, HDA_OUTPUT), |
| 10985 | HDA_CODEC_MUTE_MONO("LFE Playback Switch", 0x05, 2, 0x0, HDA_OUTPUT), |
| 10986 | /*HDA_CODEC_MUTE("Side Playback Switch", 0x04, 0x0, HDA_OUTPUT), */ |
| 10987 | |
| 10988 | /* Input mixer control */ |
| 10989 | /* HDA_CODEC_VOLUME("Input Playback Volume", 0x15, 0x0, HDA_OUTPUT), |
| 10990 | HDA_CODEC_MUTE("Input Playback Switch", 0x15, 0x0, HDA_OUTPUT), */ |
| 10991 | HDA_CODEC_VOLUME("CD Playback Volume", 0x15, 0x0, HDA_INPUT), |
| 10992 | HDA_CODEC_MUTE("CD Playback Switch", 0x15, 0x0, HDA_INPUT), |
| 10993 | HDA_CODEC_VOLUME("Line Playback Volume", 0x15, 0x02, HDA_INPUT), |
| 10994 | HDA_CODEC_MUTE("Line Playback Switch", 0x15, 0x02, HDA_INPUT), |
| 10995 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x15, 0x01, HDA_INPUT), |
| 10996 | HDA_CODEC_MUTE("Mic Playback Switch", 0x15, 0x01, HDA_INPUT), |
| 10997 | HDA_CODEC_MUTE("Front Mic Playback Switch", 0x10, 0x01, HDA_OUTPUT), |
| 10998 | HDA_CODEC_MUTE("Headphone Playback Switch", 0x1a, 0x03, HDA_INPUT), |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 10999 | |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 11000 | /* Capture mixer control */ |
| 11001 | HDA_CODEC_VOLUME("Capture Volume", 0x08, 0x0, HDA_INPUT), |
| 11002 | HDA_CODEC_MUTE("Capture Switch", 0x08, 0x0, HDA_INPUT), |
| 11003 | { |
| 11004 | .iface = SNDRV_CTL_ELEM_IFACE_MIXER, |
| 11005 | .name = "Capture Source", |
| 11006 | .count = 1, |
| 11007 | .info = alc_mux_enum_info, |
| 11008 | .get = alc_mux_enum_get, |
| 11009 | .put = alc_mux_enum_put, |
| 11010 | }, |
| 11011 | { |
| 11012 | .iface = SNDRV_CTL_ELEM_IFACE_MIXER, |
| 11013 | .name = "Channel Mode", |
| 11014 | .info = alc_ch_mode_info, |
| 11015 | .get = alc_ch_mode_get, |
| 11016 | .put = alc_ch_mode_put, |
| 11017 | .private_value = ARRAY_SIZE(alc861_threestack_modes), |
| 11018 | }, |
| 11019 | { } /* end */ |
Tobin Davis | a53d1ae | 2006-10-17 12:00:28 +0200 | [diff] [blame] | 11020 | }; |
| 11021 | |
Takashi Iwai | d1d985f | 2006-11-23 19:27:12 +0100 | [diff] [blame] | 11022 | static struct snd_kcontrol_new alc861_toshiba_mixer[] = { |
Tobin Davis | a53d1ae | 2006-10-17 12:00:28 +0200 | [diff] [blame] | 11023 | /* output mixer control */ |
| 11024 | HDA_CODEC_MUTE("Master Playback Switch", 0x03, 0x0, HDA_OUTPUT), |
| 11025 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x15, 0x01, HDA_INPUT), |
| 11026 | HDA_CODEC_MUTE("Mic Playback Switch", 0x15, 0x01, HDA_INPUT), |
| 11027 | |
| 11028 | /*Capture mixer control */ |
| 11029 | HDA_CODEC_VOLUME("Capture Volume", 0x08, 0x0, HDA_INPUT), |
| 11030 | HDA_CODEC_MUTE("Capture Switch", 0x08, 0x0, HDA_INPUT), |
| 11031 | { |
| 11032 | .iface = SNDRV_CTL_ELEM_IFACE_MIXER, |
| 11033 | .name = "Capture Source", |
| 11034 | .count = 1, |
| 11035 | .info = alc_mux_enum_info, |
| 11036 | .get = alc_mux_enum_get, |
| 11037 | .put = alc_mux_enum_put, |
| 11038 | }, |
| 11039 | |
| 11040 | { } /* end */ |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 11041 | }; |
Tobin Davis | a53d1ae | 2006-10-17 12:00:28 +0200 | [diff] [blame] | 11042 | |
Takashi Iwai | 22309c3 | 2006-08-09 16:57:28 +0200 | [diff] [blame] | 11043 | static struct snd_kcontrol_new alc861_uniwill_m31_mixer[] = { |
| 11044 | /* output mixer control */ |
| 11045 | HDA_CODEC_MUTE("Front Playback Switch", 0x03, 0x0, HDA_OUTPUT), |
| 11046 | HDA_CODEC_MUTE("Surround Playback Switch", 0x06, 0x0, HDA_OUTPUT), |
| 11047 | HDA_CODEC_MUTE_MONO("Center Playback Switch", 0x05, 1, 0x0, HDA_OUTPUT), |
| 11048 | HDA_CODEC_MUTE_MONO("LFE Playback Switch", 0x05, 2, 0x0, HDA_OUTPUT), |
| 11049 | /*HDA_CODEC_MUTE("Side Playback Switch", 0x04, 0x0, HDA_OUTPUT), */ |
| 11050 | |
| 11051 | /* Input mixer control */ |
| 11052 | /* HDA_CODEC_VOLUME("Input Playback Volume", 0x15, 0x0, HDA_OUTPUT), |
| 11053 | HDA_CODEC_MUTE("Input Playback Switch", 0x15, 0x0, HDA_OUTPUT), */ |
| 11054 | HDA_CODEC_VOLUME("CD Playback Volume", 0x15, 0x0, HDA_INPUT), |
| 11055 | HDA_CODEC_MUTE("CD Playback Switch", 0x15, 0x0, HDA_INPUT), |
| 11056 | HDA_CODEC_VOLUME("Line Playback Volume", 0x15, 0x02, HDA_INPUT), |
| 11057 | HDA_CODEC_MUTE("Line Playback Switch", 0x15, 0x02, HDA_INPUT), |
| 11058 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x15, 0x01, HDA_INPUT), |
| 11059 | HDA_CODEC_MUTE("Mic Playback Switch", 0x15, 0x01, HDA_INPUT), |
| 11060 | HDA_CODEC_MUTE("Front Mic Playback Switch", 0x10, 0x01, HDA_OUTPUT), |
| 11061 | HDA_CODEC_MUTE("Headphone Playback Switch", 0x1a, 0x03, HDA_INPUT), |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 11062 | |
Takashi Iwai | 22309c3 | 2006-08-09 16:57:28 +0200 | [diff] [blame] | 11063 | /* Capture mixer control */ |
| 11064 | HDA_CODEC_VOLUME("Capture Volume", 0x08, 0x0, HDA_INPUT), |
| 11065 | HDA_CODEC_MUTE("Capture Switch", 0x08, 0x0, HDA_INPUT), |
| 11066 | { |
| 11067 | .iface = SNDRV_CTL_ELEM_IFACE_MIXER, |
| 11068 | .name = "Capture Source", |
| 11069 | .count = 1, |
| 11070 | .info = alc_mux_enum_info, |
| 11071 | .get = alc_mux_enum_get, |
| 11072 | .put = alc_mux_enum_put, |
| 11073 | }, |
| 11074 | { |
| 11075 | .iface = SNDRV_CTL_ELEM_IFACE_MIXER, |
| 11076 | .name = "Channel Mode", |
| 11077 | .info = alc_ch_mode_info, |
| 11078 | .get = alc_ch_mode_get, |
| 11079 | .put = alc_ch_mode_put, |
| 11080 | .private_value = ARRAY_SIZE(alc861_uniwill_m31_modes), |
| 11081 | }, |
| 11082 | { } /* end */ |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 11083 | }; |
Mariusz Domanski | 7cdbff9 | 2006-10-23 13:42:56 +0200 | [diff] [blame] | 11084 | |
| 11085 | static struct snd_kcontrol_new alc861_asus_mixer[] = { |
| 11086 | /* output mixer control */ |
| 11087 | HDA_CODEC_MUTE("Front Playback Switch", 0x03, 0x0, HDA_OUTPUT), |
| 11088 | HDA_CODEC_MUTE("Surround Playback Switch", 0x06, 0x0, HDA_OUTPUT), |
| 11089 | HDA_CODEC_MUTE_MONO("Center Playback Switch", 0x05, 1, 0x0, HDA_OUTPUT), |
| 11090 | HDA_CODEC_MUTE_MONO("LFE Playback Switch", 0x05, 2, 0x0, HDA_OUTPUT), |
| 11091 | HDA_CODEC_MUTE("Side Playback Switch", 0x04, 0x0, HDA_OUTPUT), |
| 11092 | |
| 11093 | /* Input mixer control */ |
| 11094 | HDA_CODEC_VOLUME("Input Playback Volume", 0x15, 0x0, HDA_OUTPUT), |
| 11095 | HDA_CODEC_MUTE("Input Playback Switch", 0x15, 0x0, HDA_OUTPUT), |
| 11096 | HDA_CODEC_VOLUME("CD Playback Volume", 0x15, 0x0, HDA_INPUT), |
| 11097 | HDA_CODEC_MUTE("CD Playback Switch", 0x15, 0x0, HDA_INPUT), |
| 11098 | HDA_CODEC_VOLUME("Line Playback Volume", 0x15, 0x02, HDA_INPUT), |
| 11099 | HDA_CODEC_MUTE("Line Playback Switch", 0x15, 0x02, HDA_INPUT), |
| 11100 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x15, 0x01, HDA_INPUT), |
| 11101 | HDA_CODEC_MUTE("Mic Playback Switch", 0x15, 0x01, HDA_INPUT), |
| 11102 | HDA_CODEC_MUTE("Front Mic Playback Switch", 0x10, 0x01, HDA_OUTPUT), |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 11103 | HDA_CODEC_MUTE("Headphone Playback Switch", 0x1a, 0x03, HDA_OUTPUT), |
| 11104 | |
Mariusz Domanski | 7cdbff9 | 2006-10-23 13:42:56 +0200 | [diff] [blame] | 11105 | /* Capture mixer control */ |
| 11106 | HDA_CODEC_VOLUME("Capture Volume", 0x08, 0x0, HDA_INPUT), |
| 11107 | HDA_CODEC_MUTE("Capture Switch", 0x08, 0x0, HDA_INPUT), |
| 11108 | { |
| 11109 | .iface = SNDRV_CTL_ELEM_IFACE_MIXER, |
| 11110 | .name = "Capture Source", |
| 11111 | .count = 1, |
| 11112 | .info = alc_mux_enum_info, |
| 11113 | .get = alc_mux_enum_get, |
| 11114 | .put = alc_mux_enum_put, |
| 11115 | }, |
| 11116 | { |
| 11117 | .iface = SNDRV_CTL_ELEM_IFACE_MIXER, |
| 11118 | .name = "Channel Mode", |
| 11119 | .info = alc_ch_mode_info, |
| 11120 | .get = alc_ch_mode_get, |
| 11121 | .put = alc_ch_mode_put, |
| 11122 | .private_value = ARRAY_SIZE(alc861_asus_modes), |
| 11123 | }, |
| 11124 | { } |
Takashi Iwai | 56bb0ca | 2006-11-22 11:52:52 +0100 | [diff] [blame] | 11125 | }; |
Mariusz Domanski | 7cdbff9 | 2006-10-23 13:42:56 +0200 | [diff] [blame] | 11126 | |
Takashi Iwai | 56bb0ca | 2006-11-22 11:52:52 +0100 | [diff] [blame] | 11127 | /* additional mixer */ |
Takashi Iwai | d1d985f | 2006-11-23 19:27:12 +0100 | [diff] [blame] | 11128 | static struct snd_kcontrol_new alc861_asus_laptop_mixer[] = { |
Takashi Iwai | 56bb0ca | 2006-11-22 11:52:52 +0100 | [diff] [blame] | 11129 | HDA_CODEC_VOLUME("CD Playback Volume", 0x15, 0x0, HDA_INPUT), |
| 11130 | HDA_CODEC_MUTE("CD Playback Switch", 0x15, 0x0, HDA_INPUT), |
| 11131 | HDA_CODEC_VOLUME("PC Beep Playback Volume", 0x23, 0x0, HDA_OUTPUT), |
| 11132 | HDA_CODEC_MUTE("PC Beep Playback Switch", 0x23, 0x0, HDA_OUTPUT), |
| 11133 | { } |
| 11134 | }; |
| 11135 | |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 11136 | /* |
| 11137 | * generic initialization of ADC, input mixers and output mixers |
| 11138 | */ |
| 11139 | static struct hda_verb alc861_base_init_verbs[] = { |
| 11140 | /* |
| 11141 | * Unmute ADC0 and set the default input to mic-in |
| 11142 | */ |
| 11143 | /* port-A for surround (rear panel) */ |
| 11144 | { 0x0e, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x40 }, |
| 11145 | { 0x0e, AC_VERB_SET_CONNECT_SEL, 0x00 }, |
| 11146 | /* port-B for mic-in (rear panel) with vref */ |
| 11147 | { 0x0d, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24 }, |
| 11148 | /* port-C for line-in (rear panel) */ |
| 11149 | { 0x0c, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20 }, |
| 11150 | /* port-D for Front */ |
| 11151 | { 0x0b, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x40 }, |
| 11152 | { 0x0b, AC_VERB_SET_CONNECT_SEL, 0x00 }, |
| 11153 | /* port-E for HP out (front panel) */ |
| 11154 | { 0x0f, AC_VERB_SET_PIN_WIDGET_CONTROL, 0xc0 }, |
| 11155 | /* route front PCM to HP */ |
Takashi Iwai | 9dece1d | 2006-11-16 17:12:49 +0100 | [diff] [blame] | 11156 | { 0x0f, AC_VERB_SET_CONNECT_SEL, 0x00 }, |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 11157 | /* port-F for mic-in (front panel) with vref */ |
| 11158 | { 0x10, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24 }, |
| 11159 | /* port-G for CLFE (rear panel) */ |
| 11160 | { 0x1f, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x40 }, |
| 11161 | { 0x1f, AC_VERB_SET_CONNECT_SEL, 0x00 }, |
| 11162 | /* port-H for side (rear panel) */ |
| 11163 | { 0x20, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x40 }, |
| 11164 | { 0x20, AC_VERB_SET_CONNECT_SEL, 0x00 }, |
| 11165 | /* CD-in */ |
| 11166 | { 0x11, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20 }, |
| 11167 | /* route front mic to ADC1*/ |
| 11168 | {0x08, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 11169 | {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 11170 | |
| 11171 | /* Unmute DAC0~3 & spdif out*/ |
| 11172 | {0x03, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 11173 | {0x04, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 11174 | {0x05, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 11175 | {0x06, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 11176 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 11177 | |
| 11178 | /* Unmute Mixer 14 (mic) 1c (Line in)*/ |
| 11179 | {0x014, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 11180 | {0x014, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 11181 | {0x01c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 11182 | {0x01c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 11183 | |
| 11184 | /* Unmute Stereo Mixer 15 */ |
| 11185 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 11186 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 11187 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(2)}, |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 11188 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, 0xb00c}, /* Output 0~12 step */ |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 11189 | |
| 11190 | {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 11191 | {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 11192 | {0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 11193 | {0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 11194 | {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 11195 | {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 11196 | {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 11197 | {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 11198 | /* hp used DAC 3 (Front) */ |
| 11199 | {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(3)}, |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 11200 | {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(2)}, |
| 11201 | |
| 11202 | { } |
| 11203 | }; |
| 11204 | |
| 11205 | static struct hda_verb alc861_threestack_init_verbs[] = { |
| 11206 | /* |
| 11207 | * Unmute ADC0 and set the default input to mic-in |
| 11208 | */ |
| 11209 | /* port-A for surround (rear panel) */ |
| 11210 | { 0x0e, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x00 }, |
| 11211 | /* port-B for mic-in (rear panel) with vref */ |
| 11212 | { 0x0d, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24 }, |
| 11213 | /* port-C for line-in (rear panel) */ |
| 11214 | { 0x0c, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20 }, |
| 11215 | /* port-D for Front */ |
| 11216 | { 0x0b, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x40 }, |
| 11217 | { 0x0b, AC_VERB_SET_CONNECT_SEL, 0x00 }, |
| 11218 | /* port-E for HP out (front panel) */ |
| 11219 | { 0x0f, AC_VERB_SET_PIN_WIDGET_CONTROL, 0xc0 }, |
| 11220 | /* route front PCM to HP */ |
Takashi Iwai | 9dece1d | 2006-11-16 17:12:49 +0100 | [diff] [blame] | 11221 | { 0x0f, AC_VERB_SET_CONNECT_SEL, 0x00 }, |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 11222 | /* port-F for mic-in (front panel) with vref */ |
| 11223 | { 0x10, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24 }, |
| 11224 | /* port-G for CLFE (rear panel) */ |
| 11225 | { 0x1f, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x00 }, |
| 11226 | /* port-H for side (rear panel) */ |
| 11227 | { 0x20, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x00 }, |
| 11228 | /* CD-in */ |
| 11229 | { 0x11, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20 }, |
| 11230 | /* route front mic to ADC1*/ |
| 11231 | {0x08, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 11232 | {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 11233 | /* Unmute DAC0~3 & spdif out*/ |
| 11234 | {0x03, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 11235 | {0x04, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 11236 | {0x05, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 11237 | {0x06, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 11238 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 11239 | |
| 11240 | /* Unmute Mixer 14 (mic) 1c (Line in)*/ |
| 11241 | {0x014, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 11242 | {0x014, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 11243 | {0x01c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 11244 | {0x01c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 11245 | |
| 11246 | /* Unmute Stereo Mixer 15 */ |
| 11247 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 11248 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 11249 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(2)}, |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 11250 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, 0xb00c}, /* Output 0~12 step */ |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 11251 | |
| 11252 | {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 11253 | {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 11254 | {0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 11255 | {0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 11256 | {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 11257 | {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 11258 | {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 11259 | {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 11260 | /* hp used DAC 3 (Front) */ |
| 11261 | {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(3)}, |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 11262 | {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(2)}, |
| 11263 | { } |
| 11264 | }; |
Takashi Iwai | 22309c3 | 2006-08-09 16:57:28 +0200 | [diff] [blame] | 11265 | |
| 11266 | static struct hda_verb alc861_uniwill_m31_init_verbs[] = { |
| 11267 | /* |
| 11268 | * Unmute ADC0 and set the default input to mic-in |
| 11269 | */ |
| 11270 | /* port-A for surround (rear panel) */ |
| 11271 | { 0x0e, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x00 }, |
| 11272 | /* port-B for mic-in (rear panel) with vref */ |
| 11273 | { 0x0d, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24 }, |
| 11274 | /* port-C for line-in (rear panel) */ |
| 11275 | { 0x0c, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20 }, |
| 11276 | /* port-D for Front */ |
| 11277 | { 0x0b, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x40 }, |
| 11278 | { 0x0b, AC_VERB_SET_CONNECT_SEL, 0x00 }, |
| 11279 | /* port-E for HP out (front panel) */ |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 11280 | /* this has to be set to VREF80 */ |
| 11281 | { 0x0f, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24 }, |
Takashi Iwai | 22309c3 | 2006-08-09 16:57:28 +0200 | [diff] [blame] | 11282 | /* route front PCM to HP */ |
Takashi Iwai | 9dece1d | 2006-11-16 17:12:49 +0100 | [diff] [blame] | 11283 | { 0x0f, AC_VERB_SET_CONNECT_SEL, 0x00 }, |
Takashi Iwai | 22309c3 | 2006-08-09 16:57:28 +0200 | [diff] [blame] | 11284 | /* port-F for mic-in (front panel) with vref */ |
| 11285 | { 0x10, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24 }, |
| 11286 | /* port-G for CLFE (rear panel) */ |
| 11287 | { 0x1f, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x00 }, |
| 11288 | /* port-H for side (rear panel) */ |
| 11289 | { 0x20, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x00 }, |
| 11290 | /* CD-in */ |
| 11291 | { 0x11, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20 }, |
| 11292 | /* route front mic to ADC1*/ |
| 11293 | {0x08, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 11294 | {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 11295 | /* Unmute DAC0~3 & spdif out*/ |
| 11296 | {0x03, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 11297 | {0x04, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 11298 | {0x05, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 11299 | {0x06, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 11300 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 11301 | |
| 11302 | /* Unmute Mixer 14 (mic) 1c (Line in)*/ |
| 11303 | {0x014, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 11304 | {0x014, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 11305 | {0x01c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 11306 | {0x01c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 11307 | |
| 11308 | /* Unmute Stereo Mixer 15 */ |
| 11309 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 11310 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 11311 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(2)}, |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 11312 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, 0xb00c}, /* Output 0~12 step */ |
Takashi Iwai | 22309c3 | 2006-08-09 16:57:28 +0200 | [diff] [blame] | 11313 | |
| 11314 | {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 11315 | {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 11316 | {0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 11317 | {0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 11318 | {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 11319 | {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 11320 | {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 11321 | {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 11322 | /* hp used DAC 3 (Front) */ |
| 11323 | {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(3)}, |
Takashi Iwai | 22309c3 | 2006-08-09 16:57:28 +0200 | [diff] [blame] | 11324 | {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(2)}, |
| 11325 | { } |
| 11326 | }; |
| 11327 | |
Mariusz Domanski | 7cdbff9 | 2006-10-23 13:42:56 +0200 | [diff] [blame] | 11328 | static struct hda_verb alc861_asus_init_verbs[] = { |
| 11329 | /* |
| 11330 | * Unmute ADC0 and set the default input to mic-in |
| 11331 | */ |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 11332 | /* port-A for surround (rear panel) |
| 11333 | * according to codec#0 this is the HP jack |
| 11334 | */ |
Mariusz Domanski | 7cdbff9 | 2006-10-23 13:42:56 +0200 | [diff] [blame] | 11335 | { 0x0e, AC_VERB_SET_PIN_WIDGET_CONTROL, 0xc0 }, /* was 0x00 */ |
| 11336 | /* route front PCM to HP */ |
| 11337 | { 0x0e, AC_VERB_SET_CONNECT_SEL, 0x01 }, |
| 11338 | /* port-B for mic-in (rear panel) with vref */ |
| 11339 | { 0x0d, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24 }, |
| 11340 | /* port-C for line-in (rear panel) */ |
| 11341 | { 0x0c, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20 }, |
| 11342 | /* port-D for Front */ |
| 11343 | { 0x0b, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x40 }, |
| 11344 | { 0x0b, AC_VERB_SET_CONNECT_SEL, 0x00 }, |
| 11345 | /* port-E for HP out (front panel) */ |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 11346 | /* this has to be set to VREF80 */ |
| 11347 | { 0x0f, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24 }, |
Mariusz Domanski | 7cdbff9 | 2006-10-23 13:42:56 +0200 | [diff] [blame] | 11348 | /* route front PCM to HP */ |
Takashi Iwai | 9dece1d | 2006-11-16 17:12:49 +0100 | [diff] [blame] | 11349 | { 0x0f, AC_VERB_SET_CONNECT_SEL, 0x00 }, |
Mariusz Domanski | 7cdbff9 | 2006-10-23 13:42:56 +0200 | [diff] [blame] | 11350 | /* port-F for mic-in (front panel) with vref */ |
| 11351 | { 0x10, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24 }, |
| 11352 | /* port-G for CLFE (rear panel) */ |
| 11353 | { 0x1f, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x40 }, |
| 11354 | /* port-H for side (rear panel) */ |
| 11355 | { 0x20, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x40 }, |
| 11356 | /* CD-in */ |
| 11357 | { 0x11, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20 }, |
| 11358 | /* route front mic to ADC1*/ |
| 11359 | {0x08, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 11360 | {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 11361 | /* Unmute DAC0~3 & spdif out*/ |
| 11362 | {0x03, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 11363 | {0x04, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 11364 | {0x05, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 11365 | {0x06, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 11366 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 11367 | /* Unmute Mixer 14 (mic) 1c (Line in)*/ |
| 11368 | {0x014, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 11369 | {0x014, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 11370 | {0x01c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 11371 | {0x01c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 11372 | |
| 11373 | /* Unmute Stereo Mixer 15 */ |
| 11374 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 11375 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 11376 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(2)}, |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 11377 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, 0xb00c}, /* Output 0~12 step */ |
Mariusz Domanski | 7cdbff9 | 2006-10-23 13:42:56 +0200 | [diff] [blame] | 11378 | |
| 11379 | {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 11380 | {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 11381 | {0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 11382 | {0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 11383 | {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 11384 | {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 11385 | {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 11386 | {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 11387 | /* hp used DAC 3 (Front) */ |
| 11388 | {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(3)}, |
Mariusz Domanski | 7cdbff9 | 2006-10-23 13:42:56 +0200 | [diff] [blame] | 11389 | {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(2)}, |
| 11390 | { } |
| 11391 | }; |
| 11392 | |
Takashi Iwai | 56bb0ca | 2006-11-22 11:52:52 +0100 | [diff] [blame] | 11393 | /* additional init verbs for ASUS laptops */ |
| 11394 | static struct hda_verb alc861_asus_laptop_init_verbs[] = { |
| 11395 | { 0x0f, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x45 }, /* HP-out */ |
| 11396 | { 0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2) }, /* mute line-in */ |
| 11397 | { } |
| 11398 | }; |
Mariusz Domanski | 7cdbff9 | 2006-10-23 13:42:56 +0200 | [diff] [blame] | 11399 | |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 11400 | /* |
| 11401 | * generic initialization of ADC, input mixers and output mixers |
| 11402 | */ |
| 11403 | static struct hda_verb alc861_auto_init_verbs[] = { |
| 11404 | /* |
| 11405 | * Unmute ADC0 and set the default input to mic-in |
| 11406 | */ |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 11407 | /* {0x08, AC_VERB_SET_CONNECT_SEL, 0x00}, */ |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 11408 | {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 11409 | |
| 11410 | /* Unmute DAC0~3 & spdif out*/ |
| 11411 | {0x03, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
| 11412 | {0x04, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
| 11413 | {0x05, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
| 11414 | {0x06, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
| 11415 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 11416 | |
| 11417 | /* Unmute Mixer 14 (mic) 1c (Line in)*/ |
| 11418 | {0x014, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 11419 | {0x014, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 11420 | {0x01c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 11421 | {0x01c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 11422 | |
| 11423 | /* Unmute Stereo Mixer 15 */ |
| 11424 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 11425 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 11426 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(2)}, |
| 11427 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, 0xb00c}, |
| 11428 | |
| 11429 | {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 11430 | {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 11431 | {0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 11432 | {0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 11433 | {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 11434 | {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 11435 | {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 11436 | {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 11437 | |
| 11438 | {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 11439 | {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 11440 | {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(2)}, |
| 11441 | {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(3)}, |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 11442 | {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 11443 | {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 11444 | {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(2)}, |
| 11445 | {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(3)}, |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 11446 | |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 11447 | {0x08, AC_VERB_SET_CONNECT_SEL, 0x00}, /* set Mic 1 */ |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 11448 | |
| 11449 | { } |
| 11450 | }; |
| 11451 | |
Tobin Davis | a53d1ae | 2006-10-17 12:00:28 +0200 | [diff] [blame] | 11452 | static struct hda_verb alc861_toshiba_init_verbs[] = { |
| 11453 | {0x0f, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT}, |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 11454 | |
Tobin Davis | a53d1ae | 2006-10-17 12:00:28 +0200 | [diff] [blame] | 11455 | { } |
| 11456 | }; |
| 11457 | |
| 11458 | /* toggle speaker-output according to the hp-jack state */ |
| 11459 | static void alc861_toshiba_automute(struct hda_codec *codec) |
| 11460 | { |
| 11461 | unsigned int present; |
| 11462 | |
| 11463 | present = snd_hda_codec_read(codec, 0x0f, 0, |
| 11464 | AC_VERB_GET_PIN_SENSE, 0) & 0x80000000; |
Takashi Iwai | 47fd830 | 2007-08-10 17:11:07 +0200 | [diff] [blame] | 11465 | snd_hda_codec_amp_stereo(codec, 0x16, HDA_INPUT, 0, |
| 11466 | HDA_AMP_MUTE, present ? HDA_AMP_MUTE : 0); |
| 11467 | snd_hda_codec_amp_stereo(codec, 0x1a, HDA_INPUT, 3, |
| 11468 | HDA_AMP_MUTE, present ? 0 : HDA_AMP_MUTE); |
Tobin Davis | a53d1ae | 2006-10-17 12:00:28 +0200 | [diff] [blame] | 11469 | } |
| 11470 | |
| 11471 | static void alc861_toshiba_unsol_event(struct hda_codec *codec, |
| 11472 | unsigned int res) |
| 11473 | { |
Tobin Davis | a53d1ae | 2006-10-17 12:00:28 +0200 | [diff] [blame] | 11474 | if ((res >> 26) == ALC880_HP_EVENT) |
| 11475 | alc861_toshiba_automute(codec); |
| 11476 | } |
| 11477 | |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 11478 | /* pcm configuration: identiacal with ALC880 */ |
| 11479 | #define alc861_pcm_analog_playback alc880_pcm_analog_playback |
| 11480 | #define alc861_pcm_analog_capture alc880_pcm_analog_capture |
| 11481 | #define alc861_pcm_digital_playback alc880_pcm_digital_playback |
| 11482 | #define alc861_pcm_digital_capture alc880_pcm_digital_capture |
| 11483 | |
| 11484 | |
| 11485 | #define ALC861_DIGOUT_NID 0x07 |
| 11486 | |
| 11487 | static struct hda_channel_mode alc861_8ch_modes[1] = { |
| 11488 | { 8, NULL } |
| 11489 | }; |
| 11490 | |
| 11491 | static hda_nid_t alc861_dac_nids[4] = { |
| 11492 | /* front, surround, clfe, side */ |
| 11493 | 0x03, 0x06, 0x05, 0x04 |
| 11494 | }; |
| 11495 | |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 11496 | static hda_nid_t alc660_dac_nids[3] = { |
| 11497 | /* front, clfe, surround */ |
| 11498 | 0x03, 0x05, 0x06 |
| 11499 | }; |
| 11500 | |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 11501 | static hda_nid_t alc861_adc_nids[1] = { |
| 11502 | /* ADC0-2 */ |
| 11503 | 0x08, |
| 11504 | }; |
| 11505 | |
| 11506 | static struct hda_input_mux alc861_capture_source = { |
| 11507 | .num_items = 5, |
| 11508 | .items = { |
| 11509 | { "Mic", 0x0 }, |
| 11510 | { "Front Mic", 0x3 }, |
| 11511 | { "Line", 0x1 }, |
| 11512 | { "CD", 0x4 }, |
| 11513 | { "Mixer", 0x5 }, |
| 11514 | }, |
| 11515 | }; |
| 11516 | |
| 11517 | /* fill in the dac_nids table from the parsed pin configuration */ |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 11518 | static int alc861_auto_fill_dac_nids(struct alc_spec *spec, |
| 11519 | const struct auto_pin_cfg *cfg) |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 11520 | { |
| 11521 | int i; |
| 11522 | hda_nid_t nid; |
| 11523 | |
| 11524 | spec->multiout.dac_nids = spec->private_dac_nids; |
| 11525 | for (i = 0; i < cfg->line_outs; i++) { |
| 11526 | nid = cfg->line_out_pins[i]; |
| 11527 | if (nid) { |
| 11528 | if (i >= ARRAY_SIZE(alc861_dac_nids)) |
| 11529 | continue; |
| 11530 | spec->multiout.dac_nids[i] = alc861_dac_nids[i]; |
| 11531 | } |
| 11532 | } |
| 11533 | spec->multiout.num_dacs = cfg->line_outs; |
| 11534 | return 0; |
| 11535 | } |
| 11536 | |
| 11537 | /* add playback controls from the parsed DAC table */ |
| 11538 | static int alc861_auto_create_multi_out_ctls(struct alc_spec *spec, |
| 11539 | const struct auto_pin_cfg *cfg) |
| 11540 | { |
| 11541 | char name[32]; |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 11542 | static const char *chname[4] = { |
| 11543 | "Front", "Surround", NULL /*CLFE*/, "Side" |
| 11544 | }; |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 11545 | hda_nid_t nid; |
| 11546 | int i, idx, err; |
| 11547 | |
| 11548 | for (i = 0; i < cfg->line_outs; i++) { |
| 11549 | nid = spec->multiout.dac_nids[i]; |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 11550 | if (!nid) |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 11551 | continue; |
| 11552 | if (nid == 0x05) { |
| 11553 | /* Center/LFE */ |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 11554 | err = add_control(spec, ALC_CTL_BIND_MUTE, |
| 11555 | "Center Playback Switch", |
| 11556 | HDA_COMPOSE_AMP_VAL(nid, 1, 0, |
| 11557 | HDA_OUTPUT)); |
| 11558 | if (err < 0) |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 11559 | return err; |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 11560 | err = add_control(spec, ALC_CTL_BIND_MUTE, |
| 11561 | "LFE Playback Switch", |
| 11562 | HDA_COMPOSE_AMP_VAL(nid, 2, 0, |
| 11563 | HDA_OUTPUT)); |
| 11564 | if (err < 0) |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 11565 | return err; |
| 11566 | } else { |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 11567 | for (idx = 0; idx < ARRAY_SIZE(alc861_dac_nids) - 1; |
| 11568 | idx++) |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 11569 | if (nid == alc861_dac_nids[idx]) |
| 11570 | break; |
| 11571 | sprintf(name, "%s Playback Switch", chname[idx]); |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 11572 | err = add_control(spec, ALC_CTL_BIND_MUTE, name, |
| 11573 | HDA_COMPOSE_AMP_VAL(nid, 3, 0, |
| 11574 | HDA_OUTPUT)); |
| 11575 | if (err < 0) |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 11576 | return err; |
| 11577 | } |
| 11578 | } |
| 11579 | return 0; |
| 11580 | } |
| 11581 | |
| 11582 | static int alc861_auto_create_hp_ctls(struct alc_spec *spec, hda_nid_t pin) |
| 11583 | { |
| 11584 | int err; |
| 11585 | hda_nid_t nid; |
| 11586 | |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 11587 | if (!pin) |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 11588 | return 0; |
| 11589 | |
| 11590 | if ((pin >= 0x0b && pin <= 0x10) || pin == 0x1f || pin == 0x20) { |
| 11591 | nid = 0x03; |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 11592 | err = add_control(spec, ALC_CTL_WIDGET_MUTE, |
| 11593 | "Headphone Playback Switch", |
| 11594 | HDA_COMPOSE_AMP_VAL(nid, 3, 0, HDA_OUTPUT)); |
| 11595 | if (err < 0) |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 11596 | return err; |
| 11597 | spec->multiout.hp_nid = nid; |
| 11598 | } |
| 11599 | return 0; |
| 11600 | } |
| 11601 | |
| 11602 | /* create playback/capture controls for input pins */ |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 11603 | static int alc861_auto_create_analog_input_ctls(struct alc_spec *spec, |
| 11604 | const struct auto_pin_cfg *cfg) |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 11605 | { |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 11606 | struct hda_input_mux *imux = &spec->private_imux; |
| 11607 | int i, err, idx, idx1; |
| 11608 | |
| 11609 | for (i = 0; i < AUTO_PIN_LAST; i++) { |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 11610 | switch (cfg->input_pins[i]) { |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 11611 | case 0x0c: |
| 11612 | idx1 = 1; |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 11613 | idx = 2; /* Line In */ |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 11614 | break; |
| 11615 | case 0x0f: |
| 11616 | idx1 = 2; |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 11617 | idx = 2; /* Line In */ |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 11618 | break; |
| 11619 | case 0x0d: |
| 11620 | idx1 = 0; |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 11621 | idx = 1; /* Mic In */ |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 11622 | break; |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 11623 | case 0x10: |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 11624 | idx1 = 3; |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 11625 | idx = 1; /* Mic In */ |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 11626 | break; |
| 11627 | case 0x11: |
| 11628 | idx1 = 4; |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 11629 | idx = 0; /* CD */ |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 11630 | break; |
| 11631 | default: |
| 11632 | continue; |
| 11633 | } |
| 11634 | |
Takashi Iwai | 4a471b7 | 2005-12-07 13:56:29 +0100 | [diff] [blame] | 11635 | err = new_analog_input(spec, cfg->input_pins[i], |
| 11636 | auto_pin_cfg_labels[i], idx, 0x15); |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 11637 | if (err < 0) |
| 11638 | return err; |
| 11639 | |
Takashi Iwai | 4a471b7 | 2005-12-07 13:56:29 +0100 | [diff] [blame] | 11640 | imux->items[imux->num_items].label = auto_pin_cfg_labels[i]; |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 11641 | imux->items[imux->num_items].index = idx1; |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 11642 | imux->num_items++; |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 11643 | } |
| 11644 | return 0; |
| 11645 | } |
| 11646 | |
| 11647 | static struct snd_kcontrol_new alc861_capture_mixer[] = { |
| 11648 | HDA_CODEC_VOLUME("Capture Volume", 0x08, 0x0, HDA_INPUT), |
| 11649 | HDA_CODEC_MUTE("Capture Switch", 0x08, 0x0, HDA_INPUT), |
| 11650 | |
| 11651 | { |
| 11652 | .iface = SNDRV_CTL_ELEM_IFACE_MIXER, |
| 11653 | /* The multiple "Capture Source" controls confuse alsamixer |
| 11654 | * So call somewhat different.. |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 11655 | */ |
| 11656 | /* .name = "Capture Source", */ |
| 11657 | .name = "Input Source", |
| 11658 | .count = 1, |
| 11659 | .info = alc_mux_enum_info, |
| 11660 | .get = alc_mux_enum_get, |
| 11661 | .put = alc_mux_enum_put, |
| 11662 | }, |
| 11663 | { } /* end */ |
| 11664 | }; |
| 11665 | |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 11666 | static void alc861_auto_set_output_and_unmute(struct hda_codec *codec, |
| 11667 | hda_nid_t nid, |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 11668 | int pin_type, int dac_idx) |
| 11669 | { |
Takashi Iwai | f6c7e54 | 2008-02-12 18:32:23 +0100 | [diff] [blame] | 11670 | alc_set_pin_output(codec, nid, pin_type); |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 11671 | } |
| 11672 | |
| 11673 | static void alc861_auto_init_multi_out(struct hda_codec *codec) |
| 11674 | { |
| 11675 | struct alc_spec *spec = codec->spec; |
| 11676 | int i; |
| 11677 | |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 11678 | alc_subsystem_id(codec, 0x0e, 0x0f, 0x0b); |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 11679 | for (i = 0; i < spec->autocfg.line_outs; i++) { |
| 11680 | hda_nid_t nid = spec->autocfg.line_out_pins[i]; |
Takashi Iwai | baba8ee | 2007-04-23 17:17:48 +0200 | [diff] [blame] | 11681 | int pin_type = get_pin_type(spec->autocfg.line_out_type); |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 11682 | if (nid) |
Takashi Iwai | baba8ee | 2007-04-23 17:17:48 +0200 | [diff] [blame] | 11683 | alc861_auto_set_output_and_unmute(codec, nid, pin_type, |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 11684 | spec->multiout.dac_nids[i]); |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 11685 | } |
| 11686 | } |
| 11687 | |
| 11688 | static void alc861_auto_init_hp_out(struct hda_codec *codec) |
| 11689 | { |
| 11690 | struct alc_spec *spec = codec->spec; |
| 11691 | hda_nid_t pin; |
| 11692 | |
Takashi Iwai | eb06ed8 | 2006-09-20 17:10:27 +0200 | [diff] [blame] | 11693 | pin = spec->autocfg.hp_pins[0]; |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 11694 | if (pin) /* connect to front */ |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 11695 | alc861_auto_set_output_and_unmute(codec, pin, PIN_HP, |
| 11696 | spec->multiout.dac_nids[0]); |
Takashi Iwai | f6c7e54 | 2008-02-12 18:32:23 +0100 | [diff] [blame] | 11697 | pin = spec->autocfg.speaker_pins[0]; |
| 11698 | if (pin) |
| 11699 | alc861_auto_set_output_and_unmute(codec, pin, PIN_OUT, 0); |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 11700 | } |
| 11701 | |
| 11702 | static void alc861_auto_init_analog_input(struct hda_codec *codec) |
| 11703 | { |
| 11704 | struct alc_spec *spec = codec->spec; |
| 11705 | int i; |
| 11706 | |
| 11707 | for (i = 0; i < AUTO_PIN_LAST; i++) { |
| 11708 | hda_nid_t nid = spec->autocfg.input_pins[i]; |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 11709 | if (nid >= 0x0c && nid <= 0x11) { |
| 11710 | snd_hda_codec_write(codec, nid, 0, |
| 11711 | AC_VERB_SET_PIN_WIDGET_CONTROL, |
| 11712 | i <= AUTO_PIN_FRONT_MIC ? |
| 11713 | PIN_VREF80 : PIN_IN); |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 11714 | } |
| 11715 | } |
| 11716 | } |
| 11717 | |
| 11718 | /* parse the BIOS configuration and set up the alc_spec */ |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 11719 | /* return 1 if successful, 0 if the proper config is not found, |
| 11720 | * or a negative error code |
| 11721 | */ |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 11722 | static int alc861_parse_auto_config(struct hda_codec *codec) |
| 11723 | { |
| 11724 | struct alc_spec *spec = codec->spec; |
| 11725 | int err; |
| 11726 | static hda_nid_t alc861_ignore[] = { 0x1d, 0 }; |
| 11727 | |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 11728 | err = snd_hda_parse_pin_def_config(codec, &spec->autocfg, |
| 11729 | alc861_ignore); |
| 11730 | if (err < 0) |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 11731 | return err; |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 11732 | if (!spec->autocfg.line_outs) |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 11733 | return 0; /* can't find valid BIOS pin config */ |
| 11734 | |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 11735 | err = alc861_auto_fill_dac_nids(spec, &spec->autocfg); |
| 11736 | if (err < 0) |
| 11737 | return err; |
| 11738 | err = alc861_auto_create_multi_out_ctls(spec, &spec->autocfg); |
| 11739 | if (err < 0) |
| 11740 | return err; |
| 11741 | err = alc861_auto_create_hp_ctls(spec, spec->autocfg.hp_pins[0]); |
| 11742 | if (err < 0) |
| 11743 | return err; |
| 11744 | err = alc861_auto_create_analog_input_ctls(spec, &spec->autocfg); |
| 11745 | if (err < 0) |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 11746 | return err; |
| 11747 | |
| 11748 | spec->multiout.max_channels = spec->multiout.num_dacs * 2; |
| 11749 | |
| 11750 | if (spec->autocfg.dig_out_pin) |
| 11751 | spec->multiout.dig_out_nid = ALC861_DIGOUT_NID; |
| 11752 | |
| 11753 | if (spec->kctl_alloc) |
| 11754 | spec->mixers[spec->num_mixers++] = spec->kctl_alloc; |
| 11755 | |
| 11756 | spec->init_verbs[spec->num_init_verbs++] = alc861_auto_init_verbs; |
| 11757 | |
Jonathan Woithe | a1e8d2d | 2006-03-28 12:47:09 +0200 | [diff] [blame] | 11758 | spec->num_mux_defs = 1; |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 11759 | spec->input_mux = &spec->private_imux; |
| 11760 | |
| 11761 | spec->adc_nids = alc861_adc_nids; |
| 11762 | spec->num_adc_nids = ARRAY_SIZE(alc861_adc_nids); |
| 11763 | spec->mixers[spec->num_mixers] = alc861_capture_mixer; |
| 11764 | spec->num_mixers++; |
| 11765 | |
| 11766 | return 1; |
| 11767 | } |
| 11768 | |
Takashi Iwai | ae6b813 | 2006-03-03 16:47:17 +0100 | [diff] [blame] | 11769 | /* additional initialization for auto-configuration model */ |
| 11770 | static void alc861_auto_init(struct hda_codec *codec) |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 11771 | { |
Takashi Iwai | f6c7e54 | 2008-02-12 18:32:23 +0100 | [diff] [blame] | 11772 | struct alc_spec *spec = codec->spec; |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 11773 | alc861_auto_init_multi_out(codec); |
| 11774 | alc861_auto_init_hp_out(codec); |
| 11775 | alc861_auto_init_analog_input(codec); |
Takashi Iwai | f6c7e54 | 2008-02-12 18:32:23 +0100 | [diff] [blame] | 11776 | if (spec->unsol_event) |
| 11777 | alc_sku_automute(codec); |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 11778 | } |
| 11779 | |
Takashi Iwai | cb53c62 | 2007-08-10 17:21:45 +0200 | [diff] [blame] | 11780 | #ifdef CONFIG_SND_HDA_POWER_SAVE |
| 11781 | static struct hda_amp_list alc861_loopbacks[] = { |
| 11782 | { 0x15, HDA_INPUT, 0 }, |
| 11783 | { 0x15, HDA_INPUT, 1 }, |
| 11784 | { 0x15, HDA_INPUT, 2 }, |
| 11785 | { 0x15, HDA_INPUT, 3 }, |
| 11786 | { } /* end */ |
| 11787 | }; |
| 11788 | #endif |
| 11789 | |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 11790 | |
| 11791 | /* |
| 11792 | * configuration and preset |
| 11793 | */ |
Takashi Iwai | f5fcc13 | 2006-11-24 17:07:44 +0100 | [diff] [blame] | 11794 | static const char *alc861_models[ALC861_MODEL_LAST] = { |
| 11795 | [ALC861_3ST] = "3stack", |
| 11796 | [ALC660_3ST] = "3stack-660", |
| 11797 | [ALC861_3ST_DIG] = "3stack-dig", |
| 11798 | [ALC861_6ST_DIG] = "6stack-dig", |
| 11799 | [ALC861_UNIWILL_M31] = "uniwill-m31", |
| 11800 | [ALC861_TOSHIBA] = "toshiba", |
| 11801 | [ALC861_ASUS] = "asus", |
| 11802 | [ALC861_ASUS_LAPTOP] = "asus-laptop", |
| 11803 | [ALC861_AUTO] = "auto", |
| 11804 | }; |
| 11805 | |
| 11806 | static struct snd_pci_quirk alc861_cfg_tbl[] = { |
Takashi Iwai | 687a47b | 2007-01-10 11:25:58 +0100 | [diff] [blame] | 11807 | SND_PCI_QUIRK(0x1043, 0x1205, "ASUS W7J", ALC861_3ST), |
Takashi Iwai | f5fcc13 | 2006-11-24 17:07:44 +0100 | [diff] [blame] | 11808 | SND_PCI_QUIRK(0x1043, 0x1335, "ASUS F2/3", ALC861_ASUS_LAPTOP), |
| 11809 | SND_PCI_QUIRK(0x1043, 0x1338, "ASUS F2/3", ALC861_ASUS_LAPTOP), |
| 11810 | SND_PCI_QUIRK(0x1043, 0x1393, "ASUS", ALC861_ASUS), |
Takashi Iwai | ac3e374 | 2007-12-17 17:14:18 +0100 | [diff] [blame] | 11811 | SND_PCI_QUIRK(0x1043, 0x13d7, "ASUS A9rp", ALC861_ASUS_LAPTOP), |
Kailang Yang | 83c3421 | 2007-07-05 11:43:05 +0200 | [diff] [blame] | 11812 | SND_PCI_QUIRK(0x1043, 0x81cb, "ASUS P1-AH2", ALC861_3ST_DIG), |
Tobin Davis | ad5e773 | 2007-01-08 10:57:32 +0100 | [diff] [blame] | 11813 | SND_PCI_QUIRK(0x1179, 0xff00, "Toshiba", ALC861_TOSHIBA), |
Takashi Iwai | 341d4eb | 2007-07-09 17:53:18 +0200 | [diff] [blame] | 11814 | /* FIXME: the entry below breaks Toshiba A100 (model=auto works!) |
| 11815 | * Any other models that need this preset? |
| 11816 | */ |
| 11817 | /* SND_PCI_QUIRK(0x1179, 0xff10, "Toshiba", ALC861_TOSHIBA), */ |
Claudio Matsuoka | ef64adb | 2007-07-14 00:26:16 +0200 | [diff] [blame] | 11818 | SND_PCI_QUIRK(0x1462, 0x7254, "HP dx2200 (MSI MS-7254)", ALC861_3ST), |
| 11819 | SND_PCI_QUIRK(0x1462, 0x7297, "HP dx2250 (MSI MS-7297)", ALC861_3ST), |
Takashi Iwai | ac3e374 | 2007-12-17 17:14:18 +0100 | [diff] [blame] | 11820 | SND_PCI_QUIRK(0x1584, 0x2b01, "Uniwill X40AIx", ALC861_UNIWILL_M31), |
| 11821 | SND_PCI_QUIRK(0x1584, 0x9072, "Uniwill m31", ALC861_UNIWILL_M31), |
| 11822 | SND_PCI_QUIRK(0x1584, 0x9075, "Airis Praxis N1212", ALC861_ASUS_LAPTOP), |
| 11823 | /* FIXME: the below seems conflict */ |
| 11824 | /* SND_PCI_QUIRK(0x1584, 0x9075, "Uniwill", ALC861_UNIWILL_M31), */ |
| 11825 | SND_PCI_QUIRK(0x1849, 0x0660, "Asrock 939SLI32", ALC660_3ST), |
| 11826 | SND_PCI_QUIRK(0x8086, 0xd600, "Intel", ALC861_3ST), |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 11827 | {} |
| 11828 | }; |
| 11829 | |
| 11830 | static struct alc_config_preset alc861_presets[] = { |
| 11831 | [ALC861_3ST] = { |
| 11832 | .mixers = { alc861_3ST_mixer }, |
| 11833 | .init_verbs = { alc861_threestack_init_verbs }, |
| 11834 | .num_dacs = ARRAY_SIZE(alc861_dac_nids), |
| 11835 | .dac_nids = alc861_dac_nids, |
| 11836 | .num_channel_mode = ARRAY_SIZE(alc861_threestack_modes), |
| 11837 | .channel_mode = alc861_threestack_modes, |
Takashi Iwai | 4e195a7 | 2006-07-28 14:47:34 +0200 | [diff] [blame] | 11838 | .need_dac_fix = 1, |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 11839 | .num_adc_nids = ARRAY_SIZE(alc861_adc_nids), |
| 11840 | .adc_nids = alc861_adc_nids, |
| 11841 | .input_mux = &alc861_capture_source, |
| 11842 | }, |
| 11843 | [ALC861_3ST_DIG] = { |
| 11844 | .mixers = { alc861_base_mixer }, |
| 11845 | .init_verbs = { alc861_threestack_init_verbs }, |
| 11846 | .num_dacs = ARRAY_SIZE(alc861_dac_nids), |
| 11847 | .dac_nids = alc861_dac_nids, |
| 11848 | .dig_out_nid = ALC861_DIGOUT_NID, |
| 11849 | .num_channel_mode = ARRAY_SIZE(alc861_threestack_modes), |
| 11850 | .channel_mode = alc861_threestack_modes, |
Takashi Iwai | 4e195a7 | 2006-07-28 14:47:34 +0200 | [diff] [blame] | 11851 | .need_dac_fix = 1, |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 11852 | .num_adc_nids = ARRAY_SIZE(alc861_adc_nids), |
| 11853 | .adc_nids = alc861_adc_nids, |
| 11854 | .input_mux = &alc861_capture_source, |
| 11855 | }, |
| 11856 | [ALC861_6ST_DIG] = { |
| 11857 | .mixers = { alc861_base_mixer }, |
| 11858 | .init_verbs = { alc861_base_init_verbs }, |
| 11859 | .num_dacs = ARRAY_SIZE(alc861_dac_nids), |
| 11860 | .dac_nids = alc861_dac_nids, |
| 11861 | .dig_out_nid = ALC861_DIGOUT_NID, |
| 11862 | .num_channel_mode = ARRAY_SIZE(alc861_8ch_modes), |
| 11863 | .channel_mode = alc861_8ch_modes, |
| 11864 | .num_adc_nids = ARRAY_SIZE(alc861_adc_nids), |
| 11865 | .adc_nids = alc861_adc_nids, |
| 11866 | .input_mux = &alc861_capture_source, |
| 11867 | }, |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 11868 | [ALC660_3ST] = { |
| 11869 | .mixers = { alc861_3ST_mixer }, |
| 11870 | .init_verbs = { alc861_threestack_init_verbs }, |
| 11871 | .num_dacs = ARRAY_SIZE(alc660_dac_nids), |
| 11872 | .dac_nids = alc660_dac_nids, |
| 11873 | .num_channel_mode = ARRAY_SIZE(alc861_threestack_modes), |
| 11874 | .channel_mode = alc861_threestack_modes, |
Takashi Iwai | 4e195a7 | 2006-07-28 14:47:34 +0200 | [diff] [blame] | 11875 | .need_dac_fix = 1, |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 11876 | .num_adc_nids = ARRAY_SIZE(alc861_adc_nids), |
| 11877 | .adc_nids = alc861_adc_nids, |
| 11878 | .input_mux = &alc861_capture_source, |
| 11879 | }, |
Takashi Iwai | 22309c3 | 2006-08-09 16:57:28 +0200 | [diff] [blame] | 11880 | [ALC861_UNIWILL_M31] = { |
| 11881 | .mixers = { alc861_uniwill_m31_mixer }, |
| 11882 | .init_verbs = { alc861_uniwill_m31_init_verbs }, |
| 11883 | .num_dacs = ARRAY_SIZE(alc861_dac_nids), |
| 11884 | .dac_nids = alc861_dac_nids, |
| 11885 | .dig_out_nid = ALC861_DIGOUT_NID, |
| 11886 | .num_channel_mode = ARRAY_SIZE(alc861_uniwill_m31_modes), |
| 11887 | .channel_mode = alc861_uniwill_m31_modes, |
| 11888 | .need_dac_fix = 1, |
| 11889 | .num_adc_nids = ARRAY_SIZE(alc861_adc_nids), |
| 11890 | .adc_nids = alc861_adc_nids, |
| 11891 | .input_mux = &alc861_capture_source, |
| 11892 | }, |
Tobin Davis | a53d1ae | 2006-10-17 12:00:28 +0200 | [diff] [blame] | 11893 | [ALC861_TOSHIBA] = { |
| 11894 | .mixers = { alc861_toshiba_mixer }, |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 11895 | .init_verbs = { alc861_base_init_verbs, |
| 11896 | alc861_toshiba_init_verbs }, |
Tobin Davis | a53d1ae | 2006-10-17 12:00:28 +0200 | [diff] [blame] | 11897 | .num_dacs = ARRAY_SIZE(alc861_dac_nids), |
| 11898 | .dac_nids = alc861_dac_nids, |
| 11899 | .num_channel_mode = ARRAY_SIZE(alc883_3ST_2ch_modes), |
| 11900 | .channel_mode = alc883_3ST_2ch_modes, |
| 11901 | .num_adc_nids = ARRAY_SIZE(alc861_adc_nids), |
| 11902 | .adc_nids = alc861_adc_nids, |
| 11903 | .input_mux = &alc861_capture_source, |
| 11904 | .unsol_event = alc861_toshiba_unsol_event, |
| 11905 | .init_hook = alc861_toshiba_automute, |
| 11906 | }, |
Mariusz Domanski | 7cdbff9 | 2006-10-23 13:42:56 +0200 | [diff] [blame] | 11907 | [ALC861_ASUS] = { |
| 11908 | .mixers = { alc861_asus_mixer }, |
| 11909 | .init_verbs = { alc861_asus_init_verbs }, |
| 11910 | .num_dacs = ARRAY_SIZE(alc861_dac_nids), |
| 11911 | .dac_nids = alc861_dac_nids, |
| 11912 | .dig_out_nid = ALC861_DIGOUT_NID, |
| 11913 | .num_channel_mode = ARRAY_SIZE(alc861_asus_modes), |
| 11914 | .channel_mode = alc861_asus_modes, |
| 11915 | .need_dac_fix = 1, |
| 11916 | .hp_nid = 0x06, |
| 11917 | .num_adc_nids = ARRAY_SIZE(alc861_adc_nids), |
| 11918 | .adc_nids = alc861_adc_nids, |
| 11919 | .input_mux = &alc861_capture_source, |
| 11920 | }, |
Takashi Iwai | 56bb0ca | 2006-11-22 11:52:52 +0100 | [diff] [blame] | 11921 | [ALC861_ASUS_LAPTOP] = { |
| 11922 | .mixers = { alc861_toshiba_mixer, alc861_asus_laptop_mixer }, |
| 11923 | .init_verbs = { alc861_asus_init_verbs, |
| 11924 | alc861_asus_laptop_init_verbs }, |
| 11925 | .num_dacs = ARRAY_SIZE(alc861_dac_nids), |
| 11926 | .dac_nids = alc861_dac_nids, |
| 11927 | .dig_out_nid = ALC861_DIGOUT_NID, |
| 11928 | .num_channel_mode = ARRAY_SIZE(alc883_3ST_2ch_modes), |
| 11929 | .channel_mode = alc883_3ST_2ch_modes, |
| 11930 | .need_dac_fix = 1, |
| 11931 | .num_adc_nids = ARRAY_SIZE(alc861_adc_nids), |
| 11932 | .adc_nids = alc861_adc_nids, |
| 11933 | .input_mux = &alc861_capture_source, |
| 11934 | }, |
| 11935 | }; |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 11936 | |
| 11937 | |
| 11938 | static int patch_alc861(struct hda_codec *codec) |
| 11939 | { |
| 11940 | struct alc_spec *spec; |
| 11941 | int board_config; |
| 11942 | int err; |
| 11943 | |
Robert P. J. Day | dc041e0 | 2006-12-19 14:44:15 +0100 | [diff] [blame] | 11944 | spec = kzalloc(sizeof(*spec), GFP_KERNEL); |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 11945 | if (spec == NULL) |
| 11946 | return -ENOMEM; |
| 11947 | |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 11948 | codec->spec = spec; |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 11949 | |
Takashi Iwai | f5fcc13 | 2006-11-24 17:07:44 +0100 | [diff] [blame] | 11950 | board_config = snd_hda_check_board_config(codec, ALC861_MODEL_LAST, |
| 11951 | alc861_models, |
| 11952 | alc861_cfg_tbl); |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 11953 | |
Takashi Iwai | f5fcc13 | 2006-11-24 17:07:44 +0100 | [diff] [blame] | 11954 | if (board_config < 0) { |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 11955 | printk(KERN_INFO "hda_codec: Unknown model for ALC861, " |
| 11956 | "trying auto-probe from BIOS...\n"); |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 11957 | board_config = ALC861_AUTO; |
| 11958 | } |
| 11959 | |
| 11960 | if (board_config == ALC861_AUTO) { |
| 11961 | /* automatic parse from the BIOS config */ |
| 11962 | err = alc861_parse_auto_config(codec); |
| 11963 | if (err < 0) { |
| 11964 | alc_free(codec); |
| 11965 | return err; |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 11966 | } else if (!err) { |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 11967 | printk(KERN_INFO |
| 11968 | "hda_codec: Cannot set up configuration " |
| 11969 | "from BIOS. Using base mode...\n"); |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 11970 | board_config = ALC861_3ST_DIG; |
| 11971 | } |
| 11972 | } |
| 11973 | |
| 11974 | if (board_config != ALC861_AUTO) |
| 11975 | setup_preset(spec, &alc861_presets[board_config]); |
| 11976 | |
| 11977 | spec->stream_name_analog = "ALC861 Analog"; |
| 11978 | spec->stream_analog_playback = &alc861_pcm_analog_playback; |
| 11979 | spec->stream_analog_capture = &alc861_pcm_analog_capture; |
| 11980 | |
| 11981 | spec->stream_name_digital = "ALC861 Digital"; |
| 11982 | spec->stream_digital_playback = &alc861_pcm_digital_playback; |
| 11983 | spec->stream_digital_capture = &alc861_pcm_digital_capture; |
| 11984 | |
Takashi Iwai | 2134ea4 | 2008-01-10 16:53:55 +0100 | [diff] [blame] | 11985 | spec->vmaster_nid = 0x03; |
| 11986 | |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 11987 | codec->patch_ops = alc_patch_ops; |
| 11988 | if (board_config == ALC861_AUTO) |
Takashi Iwai | ae6b813 | 2006-03-03 16:47:17 +0100 | [diff] [blame] | 11989 | spec->init_hook = alc861_auto_init; |
Takashi Iwai | cb53c62 | 2007-08-10 17:21:45 +0200 | [diff] [blame] | 11990 | #ifdef CONFIG_SND_HDA_POWER_SAVE |
| 11991 | if (!spec->loopback.amplist) |
| 11992 | spec->loopback.amplist = alc861_loopbacks; |
| 11993 | #endif |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 11994 | |
| 11995 | return 0; |
| 11996 | } |
| 11997 | |
| 11998 | /* |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 11999 | * ALC861-VD support |
| 12000 | * |
| 12001 | * Based on ALC882 |
| 12002 | * |
| 12003 | * In addition, an independent DAC |
| 12004 | */ |
| 12005 | #define ALC861VD_DIGOUT_NID 0x06 |
| 12006 | |
| 12007 | static hda_nid_t alc861vd_dac_nids[4] = { |
| 12008 | /* front, surr, clfe, side surr */ |
| 12009 | 0x02, 0x03, 0x04, 0x05 |
| 12010 | }; |
| 12011 | |
| 12012 | /* dac_nids for ALC660vd are in a different order - according to |
| 12013 | * Realtek's driver. |
| 12014 | * This should probably tesult in a different mixer for 6stack models |
| 12015 | * of ALC660vd codecs, but for now there is only 3stack mixer |
| 12016 | * - and it is the same as in 861vd. |
| 12017 | * adc_nids in ALC660vd are (is) the same as in 861vd |
| 12018 | */ |
| 12019 | static hda_nid_t alc660vd_dac_nids[3] = { |
| 12020 | /* front, rear, clfe, rear_surr */ |
| 12021 | 0x02, 0x04, 0x03 |
| 12022 | }; |
| 12023 | |
| 12024 | static hda_nid_t alc861vd_adc_nids[1] = { |
| 12025 | /* ADC0 */ |
| 12026 | 0x09, |
| 12027 | }; |
| 12028 | |
Takashi Iwai | e140634 | 2008-02-11 18:32:32 +0100 | [diff] [blame] | 12029 | static hda_nid_t alc861vd_capsrc_nids[1] = { 0x22 }; |
| 12030 | |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 12031 | /* input MUX */ |
| 12032 | /* FIXME: should be a matrix-type input source selection */ |
| 12033 | static struct hda_input_mux alc861vd_capture_source = { |
| 12034 | .num_items = 4, |
| 12035 | .items = { |
| 12036 | { "Mic", 0x0 }, |
| 12037 | { "Front Mic", 0x1 }, |
| 12038 | { "Line", 0x2 }, |
| 12039 | { "CD", 0x4 }, |
| 12040 | }, |
| 12041 | }; |
| 12042 | |
Kailang Yang | 272a527 | 2007-05-14 11:00:38 +0200 | [diff] [blame] | 12043 | static struct hda_input_mux alc861vd_dallas_capture_source = { |
| 12044 | .num_items = 3, |
| 12045 | .items = { |
| 12046 | { "Front Mic", 0x0 }, |
| 12047 | { "ATAPI Mic", 0x1 }, |
| 12048 | { "Line In", 0x5 }, |
| 12049 | }, |
| 12050 | }; |
| 12051 | |
Kailang Yang | d1a991a | 2007-08-15 16:21:59 +0200 | [diff] [blame] | 12052 | static struct hda_input_mux alc861vd_hp_capture_source = { |
| 12053 | .num_items = 2, |
| 12054 | .items = { |
| 12055 | { "Front Mic", 0x0 }, |
| 12056 | { "ATAPI Mic", 0x1 }, |
| 12057 | }, |
| 12058 | }; |
| 12059 | |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 12060 | #define alc861vd_mux_enum_info alc_mux_enum_info |
| 12061 | #define alc861vd_mux_enum_get alc_mux_enum_get |
Takashi Iwai | e140634 | 2008-02-11 18:32:32 +0100 | [diff] [blame] | 12062 | /* ALC861VD has the ALC882-type input selection (but has only one ADC) */ |
| 12063 | #define alc861vd_mux_enum_put alc882_mux_enum_put |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 12064 | |
| 12065 | /* |
| 12066 | * 2ch mode |
| 12067 | */ |
| 12068 | static struct hda_channel_mode alc861vd_3stack_2ch_modes[1] = { |
| 12069 | { 2, NULL } |
| 12070 | }; |
| 12071 | |
| 12072 | /* |
| 12073 | * 6ch mode |
| 12074 | */ |
| 12075 | static struct hda_verb alc861vd_6stack_ch6_init[] = { |
| 12076 | { 0x17, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x00 }, |
| 12077 | { 0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, |
| 12078 | { 0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, |
| 12079 | { 0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, |
| 12080 | { } /* end */ |
| 12081 | }; |
| 12082 | |
| 12083 | /* |
| 12084 | * 8ch mode |
| 12085 | */ |
| 12086 | static struct hda_verb alc861vd_6stack_ch8_init[] = { |
| 12087 | { 0x17, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, |
| 12088 | { 0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, |
| 12089 | { 0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, |
| 12090 | { 0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, |
| 12091 | { } /* end */ |
| 12092 | }; |
| 12093 | |
| 12094 | static struct hda_channel_mode alc861vd_6stack_modes[2] = { |
| 12095 | { 6, alc861vd_6stack_ch6_init }, |
| 12096 | { 8, alc861vd_6stack_ch8_init }, |
| 12097 | }; |
| 12098 | |
| 12099 | static struct snd_kcontrol_new alc861vd_chmode_mixer[] = { |
| 12100 | { |
| 12101 | .iface = SNDRV_CTL_ELEM_IFACE_MIXER, |
| 12102 | .name = "Channel Mode", |
| 12103 | .info = alc_ch_mode_info, |
| 12104 | .get = alc_ch_mode_get, |
| 12105 | .put = alc_ch_mode_put, |
| 12106 | }, |
| 12107 | { } /* end */ |
| 12108 | }; |
| 12109 | |
| 12110 | static struct snd_kcontrol_new alc861vd_capture_mixer[] = { |
| 12111 | HDA_CODEC_VOLUME("Capture Volume", 0x09, 0x0, HDA_INPUT), |
| 12112 | HDA_CODEC_MUTE("Capture Switch", 0x09, 0x0, HDA_INPUT), |
| 12113 | |
| 12114 | { |
| 12115 | .iface = SNDRV_CTL_ELEM_IFACE_MIXER, |
| 12116 | /* The multiple "Capture Source" controls confuse alsamixer |
| 12117 | * So call somewhat different.. |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 12118 | */ |
| 12119 | /* .name = "Capture Source", */ |
| 12120 | .name = "Input Source", |
| 12121 | .count = 1, |
| 12122 | .info = alc861vd_mux_enum_info, |
| 12123 | .get = alc861vd_mux_enum_get, |
| 12124 | .put = alc861vd_mux_enum_put, |
| 12125 | }, |
| 12126 | { } /* end */ |
| 12127 | }; |
| 12128 | |
| 12129 | /* Pin assignment: Front=0x14, Rear=0x15, CLFE=0x16, Side=0x17 |
| 12130 | * Mic=0x18, Front Mic=0x19, Line-In=0x1a, HP=0x1b |
| 12131 | */ |
| 12132 | static struct snd_kcontrol_new alc861vd_6st_mixer[] = { |
| 12133 | HDA_CODEC_VOLUME("Front Playback Volume", 0x02, 0x0, HDA_OUTPUT), |
| 12134 | HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT), |
| 12135 | |
| 12136 | HDA_CODEC_VOLUME("Surround Playback Volume", 0x03, 0x0, HDA_OUTPUT), |
| 12137 | HDA_BIND_MUTE("Surround Playback Switch", 0x0d, 2, HDA_INPUT), |
| 12138 | |
| 12139 | HDA_CODEC_VOLUME_MONO("Center Playback Volume", 0x04, 1, 0x0, |
| 12140 | HDA_OUTPUT), |
| 12141 | HDA_CODEC_VOLUME_MONO("LFE Playback Volume", 0x04, 2, 0x0, |
| 12142 | HDA_OUTPUT), |
| 12143 | HDA_BIND_MUTE_MONO("Center Playback Switch", 0x0e, 1, 2, HDA_INPUT), |
| 12144 | HDA_BIND_MUTE_MONO("LFE Playback Switch", 0x0e, 2, 2, HDA_INPUT), |
| 12145 | |
| 12146 | HDA_CODEC_VOLUME("Side Playback Volume", 0x05, 0x0, HDA_OUTPUT), |
| 12147 | HDA_BIND_MUTE("Side Playback Switch", 0x0f, 2, HDA_INPUT), |
| 12148 | |
| 12149 | HDA_CODEC_MUTE("Headphone Playback Switch", 0x1b, 0x0, HDA_OUTPUT), |
| 12150 | |
| 12151 | HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT), |
| 12152 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), |
| 12153 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), |
| 12154 | |
| 12155 | HDA_CODEC_VOLUME("Front Mic Boost", 0x19, 0, HDA_INPUT), |
| 12156 | HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x1, HDA_INPUT), |
| 12157 | HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x1, HDA_INPUT), |
| 12158 | |
| 12159 | HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT), |
| 12160 | HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT), |
| 12161 | |
| 12162 | HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT), |
| 12163 | HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT), |
| 12164 | |
| 12165 | HDA_CODEC_VOLUME("PC Speaker Playback Volume", 0x0b, 0x05, HDA_INPUT), |
| 12166 | HDA_CODEC_MUTE("PC Speaker Playback Switch", 0x0b, 0x05, HDA_INPUT), |
| 12167 | |
| 12168 | { } /* end */ |
| 12169 | }; |
| 12170 | |
| 12171 | static struct snd_kcontrol_new alc861vd_3st_mixer[] = { |
| 12172 | HDA_CODEC_VOLUME("Front Playback Volume", 0x02, 0x0, HDA_OUTPUT), |
| 12173 | HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT), |
| 12174 | |
| 12175 | HDA_CODEC_MUTE("Headphone Playback Switch", 0x1b, 0x0, HDA_OUTPUT), |
| 12176 | |
| 12177 | HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT), |
| 12178 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), |
| 12179 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), |
| 12180 | |
| 12181 | HDA_CODEC_VOLUME("Front Mic Boost", 0x19, 0, HDA_INPUT), |
| 12182 | HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x1, HDA_INPUT), |
| 12183 | HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x1, HDA_INPUT), |
| 12184 | |
| 12185 | HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT), |
| 12186 | HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT), |
| 12187 | |
| 12188 | HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT), |
| 12189 | HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT), |
| 12190 | |
| 12191 | HDA_CODEC_VOLUME("PC Speaker Playback Volume", 0x0b, 0x05, HDA_INPUT), |
| 12192 | HDA_CODEC_MUTE("PC Speaker Playback Switch", 0x0b, 0x05, HDA_INPUT), |
| 12193 | |
| 12194 | { } /* end */ |
| 12195 | }; |
| 12196 | |
Kailang Yang | bdd148a | 2007-05-08 15:19:08 +0200 | [diff] [blame] | 12197 | static struct snd_kcontrol_new alc861vd_lenovo_mixer[] = { |
| 12198 | HDA_CODEC_VOLUME("Front Playback Volume", 0x02, 0x0, HDA_OUTPUT), |
| 12199 | /*HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT),*/ |
| 12200 | HDA_CODEC_MUTE("Front Playback Switch", 0x14, 0x0, HDA_OUTPUT), |
| 12201 | |
| 12202 | HDA_CODEC_MUTE("Headphone Playback Switch", 0x1b, 0x0, HDA_OUTPUT), |
| 12203 | |
| 12204 | HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT), |
| 12205 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), |
| 12206 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), |
| 12207 | |
| 12208 | HDA_CODEC_VOLUME("Front Mic Boost", 0x19, 0, HDA_INPUT), |
| 12209 | HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x1, HDA_INPUT), |
| 12210 | HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x1, HDA_INPUT), |
| 12211 | |
| 12212 | HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT), |
| 12213 | HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT), |
| 12214 | |
| 12215 | { } /* end */ |
| 12216 | }; |
| 12217 | |
Kailang Yang | 272a527 | 2007-05-14 11:00:38 +0200 | [diff] [blame] | 12218 | /* Pin assignment: Front=0x14, HP = 0x15, |
| 12219 | * Front Mic=0x18, ATAPI Mic = 0x19, Line In = 0x1d |
| 12220 | */ |
| 12221 | static struct snd_kcontrol_new alc861vd_dallas_mixer[] = { |
| 12222 | HDA_CODEC_VOLUME("Front Playback Volume", 0x02, 0x0, HDA_OUTPUT), |
| 12223 | HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT), |
| 12224 | HDA_CODEC_VOLUME("Headphone Playback Volume", 0x03, 0x0, HDA_OUTPUT), |
| 12225 | HDA_BIND_MUTE("Headphone Playback Switch", 0x0d, 2, HDA_INPUT), |
| 12226 | HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), |
| 12227 | HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), |
| 12228 | HDA_CODEC_VOLUME("ATAPI Mic Playback Volume", 0x0b, 0x1, HDA_INPUT), |
| 12229 | HDA_CODEC_MUTE("ATAPI Mic Playback Switch", 0x0b, 0x1, HDA_INPUT), |
| 12230 | HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x05, HDA_INPUT), |
| 12231 | HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x05, HDA_INPUT), |
Kailang Yang | 272a527 | 2007-05-14 11:00:38 +0200 | [diff] [blame] | 12232 | { } /* end */ |
| 12233 | }; |
| 12234 | |
Kailang Yang | d1a991a | 2007-08-15 16:21:59 +0200 | [diff] [blame] | 12235 | /* Pin assignment: Speaker=0x14, Line-out = 0x15, |
| 12236 | * Front Mic=0x18, ATAPI Mic = 0x19, |
| 12237 | */ |
| 12238 | static struct snd_kcontrol_new alc861vd_hp_mixer[] = { |
| 12239 | HDA_CODEC_VOLUME("Front Playback Volume", 0x02, 0x0, HDA_OUTPUT), |
| 12240 | HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT), |
| 12241 | HDA_CODEC_VOLUME("Headphone Playback Volume", 0x03, 0x0, HDA_OUTPUT), |
| 12242 | HDA_BIND_MUTE("Headphone Playback Switch", 0x0d, 2, HDA_INPUT), |
| 12243 | HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), |
| 12244 | HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), |
| 12245 | HDA_CODEC_VOLUME("ATAPI Mic Playback Volume", 0x0b, 0x1, HDA_INPUT), |
| 12246 | HDA_CODEC_MUTE("ATAPI Mic Playback Switch", 0x0b, 0x1, HDA_INPUT), |
| 12247 | |
| 12248 | { } /* end */ |
| 12249 | }; |
| 12250 | |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 12251 | /* |
| 12252 | * generic initialization of ADC, input mixers and output mixers |
| 12253 | */ |
| 12254 | static struct hda_verb alc861vd_volume_init_verbs[] = { |
| 12255 | /* |
| 12256 | * Unmute ADC0 and set the default input to mic-in |
| 12257 | */ |
| 12258 | {0x09, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 12259 | {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 12260 | |
| 12261 | /* Unmute input amps (CD, Line In, Mic 1 & Mic 2) of |
| 12262 | * the analog-loopback mixer widget |
| 12263 | */ |
| 12264 | /* Amp Indices: Mic1 = 0, Mic2 = 1, Line1 = 2, Line2 = 3, CD = 4 */ |
Takashi Iwai | cb53c62 | 2007-08-10 17:21:45 +0200 | [diff] [blame] | 12265 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 12266 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
| 12267 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)}, |
| 12268 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)}, |
| 12269 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)}, |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 12270 | |
| 12271 | /* Capture mixer: unmute Mic, F-Mic, Line, CD inputs */ |
Kailang Yang | bdd148a | 2007-05-08 15:19:08 +0200 | [diff] [blame] | 12272 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 12273 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 12274 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(2)}, |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 12275 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(4)}, |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 12276 | |
| 12277 | /* |
| 12278 | * Set up output mixers (0x02 - 0x05) |
| 12279 | */ |
| 12280 | /* set vol=0 to output mixers */ |
| 12281 | {0x02, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 12282 | {0x03, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 12283 | {0x04, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 12284 | {0x05, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 12285 | |
| 12286 | /* set up input amps for analog loopback */ |
| 12287 | /* Amp Indices: DAC = 0, mixer = 1 */ |
| 12288 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 12289 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
| 12290 | {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 12291 | {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
| 12292 | {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 12293 | {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
| 12294 | {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 12295 | {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
| 12296 | |
| 12297 | { } |
| 12298 | }; |
| 12299 | |
| 12300 | /* |
| 12301 | * 3-stack pin configuration: |
| 12302 | * front = 0x14, mic/clfe = 0x18, HP = 0x19, line/surr = 0x1a, f-mic = 0x1b |
| 12303 | */ |
| 12304 | static struct hda_verb alc861vd_3stack_init_verbs[] = { |
| 12305 | /* |
| 12306 | * Set pin mode and muting |
| 12307 | */ |
| 12308 | /* set front pin widgets 0x14 for output */ |
| 12309 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 12310 | {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 12311 | {0x14, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 12312 | |
| 12313 | /* Mic (rear) pin: input vref at 80% */ |
| 12314 | {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80}, |
| 12315 | {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
| 12316 | /* Front Mic pin: input vref at 80% */ |
| 12317 | {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80}, |
| 12318 | {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
| 12319 | /* Line In pin: input */ |
| 12320 | {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
| 12321 | {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
| 12322 | /* Line-2 In: Headphone output (output 0 - 0x0c) */ |
| 12323 | {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 12324 | {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 12325 | {0x1b, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 12326 | /* CD pin widget for input */ |
| 12327 | {0x1c, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
| 12328 | |
| 12329 | { } |
| 12330 | }; |
| 12331 | |
| 12332 | /* |
| 12333 | * 6-stack pin configuration: |
| 12334 | */ |
| 12335 | static struct hda_verb alc861vd_6stack_init_verbs[] = { |
| 12336 | /* |
| 12337 | * Set pin mode and muting |
| 12338 | */ |
| 12339 | /* set front pin widgets 0x14 for output */ |
| 12340 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 12341 | {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 12342 | {0x14, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 12343 | |
| 12344 | /* Rear Pin: output 1 (0x0d) */ |
| 12345 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 12346 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 12347 | {0x15, AC_VERB_SET_CONNECT_SEL, 0x01}, |
| 12348 | /* CLFE Pin: output 2 (0x0e) */ |
| 12349 | {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 12350 | {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 12351 | {0x16, AC_VERB_SET_CONNECT_SEL, 0x02}, |
| 12352 | /* Side Pin: output 3 (0x0f) */ |
| 12353 | {0x17, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 12354 | {0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 12355 | {0x17, AC_VERB_SET_CONNECT_SEL, 0x03}, |
| 12356 | |
| 12357 | /* Mic (rear) pin: input vref at 80% */ |
| 12358 | {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80}, |
| 12359 | {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
| 12360 | /* Front Mic pin: input vref at 80% */ |
| 12361 | {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80}, |
| 12362 | {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
| 12363 | /* Line In pin: input */ |
| 12364 | {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
| 12365 | {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
| 12366 | /* Line-2 In: Headphone output (output 0 - 0x0c) */ |
| 12367 | {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 12368 | {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 12369 | {0x1b, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 12370 | /* CD pin widget for input */ |
| 12371 | {0x1c, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
| 12372 | |
| 12373 | { } |
| 12374 | }; |
| 12375 | |
Kailang Yang | bdd148a | 2007-05-08 15:19:08 +0200 | [diff] [blame] | 12376 | static struct hda_verb alc861vd_eapd_verbs[] = { |
| 12377 | {0x14, AC_VERB_SET_EAPD_BTLENABLE, 2}, |
| 12378 | { } |
| 12379 | }; |
| 12380 | |
| 12381 | static struct hda_verb alc861vd_lenovo_unsol_verbs[] = { |
| 12382 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 12383 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 12384 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(5)}, |
| 12385 | {0x1b, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT}, |
| 12386 | {0x18, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_MIC_EVENT}, |
| 12387 | {} |
| 12388 | }; |
| 12389 | |
| 12390 | /* toggle speaker-output according to the hp-jack state */ |
| 12391 | static void alc861vd_lenovo_hp_automute(struct hda_codec *codec) |
| 12392 | { |
| 12393 | unsigned int present; |
| 12394 | unsigned char bits; |
| 12395 | |
| 12396 | present = snd_hda_codec_read(codec, 0x1b, 0, |
| 12397 | AC_VERB_GET_PIN_SENSE, 0) & 0x80000000; |
Takashi Iwai | 47fd830 | 2007-08-10 17:11:07 +0200 | [diff] [blame] | 12398 | bits = present ? HDA_AMP_MUTE : 0; |
| 12399 | snd_hda_codec_amp_stereo(codec, 0x14, HDA_OUTPUT, 0, |
| 12400 | HDA_AMP_MUTE, bits); |
Kailang Yang | bdd148a | 2007-05-08 15:19:08 +0200 | [diff] [blame] | 12401 | } |
| 12402 | |
| 12403 | static void alc861vd_lenovo_mic_automute(struct hda_codec *codec) |
| 12404 | { |
| 12405 | unsigned int present; |
| 12406 | unsigned char bits; |
| 12407 | |
| 12408 | present = snd_hda_codec_read(codec, 0x18, 0, |
| 12409 | AC_VERB_GET_PIN_SENSE, 0) & 0x80000000; |
Takashi Iwai | 47fd830 | 2007-08-10 17:11:07 +0200 | [diff] [blame] | 12410 | bits = present ? HDA_AMP_MUTE : 0; |
| 12411 | snd_hda_codec_amp_stereo(codec, 0x0b, HDA_INPUT, 1, |
| 12412 | HDA_AMP_MUTE, bits); |
Kailang Yang | bdd148a | 2007-05-08 15:19:08 +0200 | [diff] [blame] | 12413 | } |
| 12414 | |
| 12415 | static void alc861vd_lenovo_automute(struct hda_codec *codec) |
| 12416 | { |
| 12417 | alc861vd_lenovo_hp_automute(codec); |
| 12418 | alc861vd_lenovo_mic_automute(codec); |
| 12419 | } |
| 12420 | |
| 12421 | static void alc861vd_lenovo_unsol_event(struct hda_codec *codec, |
| 12422 | unsigned int res) |
| 12423 | { |
| 12424 | switch (res >> 26) { |
| 12425 | case ALC880_HP_EVENT: |
| 12426 | alc861vd_lenovo_hp_automute(codec); |
| 12427 | break; |
| 12428 | case ALC880_MIC_EVENT: |
| 12429 | alc861vd_lenovo_mic_automute(codec); |
| 12430 | break; |
| 12431 | } |
| 12432 | } |
| 12433 | |
Kailang Yang | 272a527 | 2007-05-14 11:00:38 +0200 | [diff] [blame] | 12434 | static struct hda_verb alc861vd_dallas_verbs[] = { |
| 12435 | {0x02, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 12436 | {0x03, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 12437 | {0x04, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 12438 | {0x05, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 12439 | |
| 12440 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 12441 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 12442 | {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 12443 | {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
| 12444 | {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 12445 | {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
| 12446 | {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 12447 | {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
| 12448 | |
| 12449 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 12450 | {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 12451 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 12452 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 12453 | {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 12454 | {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 12455 | {0x17, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 12456 | {0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 12457 | |
| 12458 | {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF50}, |
| 12459 | {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
| 12460 | {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF50}, |
| 12461 | {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
| 12462 | {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
| 12463 | {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
| 12464 | {0x1c, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
| 12465 | {0x1d, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
| 12466 | |
| 12467 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 12468 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)}, |
| 12469 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)}, |
| 12470 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)}, |
| 12471 | |
| 12472 | {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 12473 | {0x09, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 12474 | {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT}, |
| 12475 | |
| 12476 | { } /* end */ |
| 12477 | }; |
| 12478 | |
| 12479 | /* toggle speaker-output according to the hp-jack state */ |
| 12480 | static void alc861vd_dallas_automute(struct hda_codec *codec) |
| 12481 | { |
| 12482 | unsigned int present; |
| 12483 | |
| 12484 | present = snd_hda_codec_read(codec, 0x15, 0, |
| 12485 | AC_VERB_GET_PIN_SENSE, 0) & 0x80000000; |
Takashi Iwai | 47fd830 | 2007-08-10 17:11:07 +0200 | [diff] [blame] | 12486 | snd_hda_codec_amp_stereo(codec, 0x14, HDA_OUTPUT, 0, |
| 12487 | HDA_AMP_MUTE, present ? HDA_AMP_MUTE : 0); |
Kailang Yang | 272a527 | 2007-05-14 11:00:38 +0200 | [diff] [blame] | 12488 | } |
| 12489 | |
| 12490 | static void alc861vd_dallas_unsol_event(struct hda_codec *codec, unsigned int res) |
| 12491 | { |
| 12492 | if ((res >> 26) == ALC880_HP_EVENT) |
| 12493 | alc861vd_dallas_automute(codec); |
| 12494 | } |
| 12495 | |
Takashi Iwai | cb53c62 | 2007-08-10 17:21:45 +0200 | [diff] [blame] | 12496 | #ifdef CONFIG_SND_HDA_POWER_SAVE |
| 12497 | #define alc861vd_loopbacks alc880_loopbacks |
| 12498 | #endif |
| 12499 | |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 12500 | /* pcm configuration: identiacal with ALC880 */ |
| 12501 | #define alc861vd_pcm_analog_playback alc880_pcm_analog_playback |
| 12502 | #define alc861vd_pcm_analog_capture alc880_pcm_analog_capture |
| 12503 | #define alc861vd_pcm_digital_playback alc880_pcm_digital_playback |
| 12504 | #define alc861vd_pcm_digital_capture alc880_pcm_digital_capture |
| 12505 | |
| 12506 | /* |
| 12507 | * configuration and preset |
| 12508 | */ |
| 12509 | static const char *alc861vd_models[ALC861VD_MODEL_LAST] = { |
| 12510 | [ALC660VD_3ST] = "3stack-660", |
Takashi Iwai | 983f8ae | 2007-08-15 16:44:04 +0200 | [diff] [blame] | 12511 | [ALC660VD_3ST_DIG] = "3stack-660-digout", |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 12512 | [ALC861VD_3ST] = "3stack", |
| 12513 | [ALC861VD_3ST_DIG] = "3stack-digout", |
| 12514 | [ALC861VD_6ST_DIG] = "6stack-digout", |
Kailang Yang | bdd148a | 2007-05-08 15:19:08 +0200 | [diff] [blame] | 12515 | [ALC861VD_LENOVO] = "lenovo", |
Kailang Yang | 272a527 | 2007-05-14 11:00:38 +0200 | [diff] [blame] | 12516 | [ALC861VD_DALLAS] = "dallas", |
Takashi Iwai | 983f8ae | 2007-08-15 16:44:04 +0200 | [diff] [blame] | 12517 | [ALC861VD_HP] = "hp", |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 12518 | [ALC861VD_AUTO] = "auto", |
| 12519 | }; |
| 12520 | |
| 12521 | static struct snd_pci_quirk alc861vd_cfg_tbl[] = { |
Takashi Iwai | ac3e374 | 2007-12-17 17:14:18 +0100 | [diff] [blame] | 12522 | SND_PCI_QUIRK(0x1019, 0xa88d, "Realtek ALC660 demo", ALC660VD_3ST), |
| 12523 | SND_PCI_QUIRK(0x103c, 0x30bf, "HP TX1000", ALC861VD_HP), |
Takashi Iwai | 07e038b | 2007-02-15 18:23:41 +0100 | [diff] [blame] | 12524 | SND_PCI_QUIRK(0x1043, 0x12e2, "Asus z35m", ALC660VD_3ST), |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 12525 | SND_PCI_QUIRK(0x1043, 0x1339, "Asus G1", ALC660VD_3ST), |
Mike Crash | 6963f84 | 2007-06-25 12:12:51 +0200 | [diff] [blame] | 12526 | SND_PCI_QUIRK(0x1043, 0x81e7, "ASUS", ALC660VD_3ST_DIG), |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 12527 | SND_PCI_QUIRK(0x10de, 0x03f0, "Realtek ALC660 demo", ALC660VD_3ST), |
Takashi Iwai | ac3e374 | 2007-12-17 17:14:18 +0100 | [diff] [blame] | 12528 | SND_PCI_QUIRK(0x1179, 0xff00, "Toshiba A135", ALC861VD_LENOVO), |
Takashi Iwai | 38baf5a | 2007-08-16 17:52:43 +0200 | [diff] [blame] | 12529 | /*SND_PCI_QUIRK(0x1179, 0xff00, "DALLAS", ALC861VD_DALLAS),*/ /*lenovo*/ |
Kailang Yang | 272a527 | 2007-05-14 11:00:38 +0200 | [diff] [blame] | 12530 | SND_PCI_QUIRK(0x1179, 0xff01, "DALLAS", ALC861VD_DALLAS), |
Takashi Iwai | 542d7c6 | 2007-08-16 18:57:30 +0200 | [diff] [blame] | 12531 | SND_PCI_QUIRK(0x1179, 0xff03, "Toshiba P205", ALC861VD_LENOVO), |
Takashi Iwai | 39c5d41 | 2007-08-15 16:24:17 +0200 | [diff] [blame] | 12532 | SND_PCI_QUIRK(0x1565, 0x820d, "Biostar NF61S SE", ALC861VD_6ST_DIG), |
Takashi Iwai | ac3e374 | 2007-12-17 17:14:18 +0100 | [diff] [blame] | 12533 | SND_PCI_QUIRK(0x17aa, 0x2066, "Lenovo", ALC861VD_LENOVO), |
| 12534 | SND_PCI_QUIRK(0x17aa, 0x3802, "Lenovo 3000 C200", ALC861VD_LENOVO), |
Tobin Davis | 625dc0b | 2007-07-30 21:42:10 +0200 | [diff] [blame] | 12535 | SND_PCI_QUIRK(0x1849, 0x0862, "ASRock K8NF6G-VSTA", ALC861VD_6ST_DIG), |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 12536 | {} |
| 12537 | }; |
| 12538 | |
| 12539 | static struct alc_config_preset alc861vd_presets[] = { |
| 12540 | [ALC660VD_3ST] = { |
| 12541 | .mixers = { alc861vd_3st_mixer }, |
| 12542 | .init_verbs = { alc861vd_volume_init_verbs, |
| 12543 | alc861vd_3stack_init_verbs }, |
| 12544 | .num_dacs = ARRAY_SIZE(alc660vd_dac_nids), |
| 12545 | .dac_nids = alc660vd_dac_nids, |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 12546 | .num_channel_mode = ARRAY_SIZE(alc861vd_3stack_2ch_modes), |
| 12547 | .channel_mode = alc861vd_3stack_2ch_modes, |
| 12548 | .input_mux = &alc861vd_capture_source, |
| 12549 | }, |
Mike Crash | 6963f84 | 2007-06-25 12:12:51 +0200 | [diff] [blame] | 12550 | [ALC660VD_3ST_DIG] = { |
| 12551 | .mixers = { alc861vd_3st_mixer }, |
| 12552 | .init_verbs = { alc861vd_volume_init_verbs, |
| 12553 | alc861vd_3stack_init_verbs }, |
| 12554 | .num_dacs = ARRAY_SIZE(alc660vd_dac_nids), |
| 12555 | .dac_nids = alc660vd_dac_nids, |
| 12556 | .dig_out_nid = ALC861VD_DIGOUT_NID, |
Mike Crash | 6963f84 | 2007-06-25 12:12:51 +0200 | [diff] [blame] | 12557 | .num_channel_mode = ARRAY_SIZE(alc861vd_3stack_2ch_modes), |
| 12558 | .channel_mode = alc861vd_3stack_2ch_modes, |
| 12559 | .input_mux = &alc861vd_capture_source, |
| 12560 | }, |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 12561 | [ALC861VD_3ST] = { |
| 12562 | .mixers = { alc861vd_3st_mixer }, |
| 12563 | .init_verbs = { alc861vd_volume_init_verbs, |
| 12564 | alc861vd_3stack_init_verbs }, |
| 12565 | .num_dacs = ARRAY_SIZE(alc861vd_dac_nids), |
| 12566 | .dac_nids = alc861vd_dac_nids, |
| 12567 | .num_channel_mode = ARRAY_SIZE(alc861vd_3stack_2ch_modes), |
| 12568 | .channel_mode = alc861vd_3stack_2ch_modes, |
| 12569 | .input_mux = &alc861vd_capture_source, |
| 12570 | }, |
| 12571 | [ALC861VD_3ST_DIG] = { |
| 12572 | .mixers = { alc861vd_3st_mixer }, |
| 12573 | .init_verbs = { alc861vd_volume_init_verbs, |
| 12574 | alc861vd_3stack_init_verbs }, |
| 12575 | .num_dacs = ARRAY_SIZE(alc861vd_dac_nids), |
| 12576 | .dac_nids = alc861vd_dac_nids, |
| 12577 | .dig_out_nid = ALC861VD_DIGOUT_NID, |
| 12578 | .num_channel_mode = ARRAY_SIZE(alc861vd_3stack_2ch_modes), |
| 12579 | .channel_mode = alc861vd_3stack_2ch_modes, |
| 12580 | .input_mux = &alc861vd_capture_source, |
| 12581 | }, |
| 12582 | [ALC861VD_6ST_DIG] = { |
| 12583 | .mixers = { alc861vd_6st_mixer, alc861vd_chmode_mixer }, |
| 12584 | .init_verbs = { alc861vd_volume_init_verbs, |
| 12585 | alc861vd_6stack_init_verbs }, |
| 12586 | .num_dacs = ARRAY_SIZE(alc861vd_dac_nids), |
| 12587 | .dac_nids = alc861vd_dac_nids, |
| 12588 | .dig_out_nid = ALC861VD_DIGOUT_NID, |
| 12589 | .num_channel_mode = ARRAY_SIZE(alc861vd_6stack_modes), |
| 12590 | .channel_mode = alc861vd_6stack_modes, |
| 12591 | .input_mux = &alc861vd_capture_source, |
| 12592 | }, |
Kailang Yang | bdd148a | 2007-05-08 15:19:08 +0200 | [diff] [blame] | 12593 | [ALC861VD_LENOVO] = { |
| 12594 | .mixers = { alc861vd_lenovo_mixer }, |
| 12595 | .init_verbs = { alc861vd_volume_init_verbs, |
| 12596 | alc861vd_3stack_init_verbs, |
| 12597 | alc861vd_eapd_verbs, |
| 12598 | alc861vd_lenovo_unsol_verbs }, |
| 12599 | .num_dacs = ARRAY_SIZE(alc660vd_dac_nids), |
| 12600 | .dac_nids = alc660vd_dac_nids, |
Kailang Yang | bdd148a | 2007-05-08 15:19:08 +0200 | [diff] [blame] | 12601 | .num_channel_mode = ARRAY_SIZE(alc861vd_3stack_2ch_modes), |
| 12602 | .channel_mode = alc861vd_3stack_2ch_modes, |
| 12603 | .input_mux = &alc861vd_capture_source, |
| 12604 | .unsol_event = alc861vd_lenovo_unsol_event, |
| 12605 | .init_hook = alc861vd_lenovo_automute, |
| 12606 | }, |
Kailang Yang | 272a527 | 2007-05-14 11:00:38 +0200 | [diff] [blame] | 12607 | [ALC861VD_DALLAS] = { |
| 12608 | .mixers = { alc861vd_dallas_mixer }, |
| 12609 | .init_verbs = { alc861vd_dallas_verbs }, |
| 12610 | .num_dacs = ARRAY_SIZE(alc861vd_dac_nids), |
| 12611 | .dac_nids = alc861vd_dac_nids, |
Kailang Yang | 272a527 | 2007-05-14 11:00:38 +0200 | [diff] [blame] | 12612 | .num_channel_mode = ARRAY_SIZE(alc861vd_3stack_2ch_modes), |
| 12613 | .channel_mode = alc861vd_3stack_2ch_modes, |
| 12614 | .input_mux = &alc861vd_dallas_capture_source, |
| 12615 | .unsol_event = alc861vd_dallas_unsol_event, |
| 12616 | .init_hook = alc861vd_dallas_automute, |
Kailang Yang | d1a991a | 2007-08-15 16:21:59 +0200 | [diff] [blame] | 12617 | }, |
| 12618 | [ALC861VD_HP] = { |
| 12619 | .mixers = { alc861vd_hp_mixer }, |
| 12620 | .init_verbs = { alc861vd_dallas_verbs, alc861vd_eapd_verbs }, |
| 12621 | .num_dacs = ARRAY_SIZE(alc861vd_dac_nids), |
| 12622 | .dac_nids = alc861vd_dac_nids, |
Kailang Yang | d1a991a | 2007-08-15 16:21:59 +0200 | [diff] [blame] | 12623 | .dig_out_nid = ALC861VD_DIGOUT_NID, |
Kailang Yang | d1a991a | 2007-08-15 16:21:59 +0200 | [diff] [blame] | 12624 | .num_channel_mode = ARRAY_SIZE(alc861vd_3stack_2ch_modes), |
| 12625 | .channel_mode = alc861vd_3stack_2ch_modes, |
| 12626 | .input_mux = &alc861vd_hp_capture_source, |
| 12627 | .unsol_event = alc861vd_dallas_unsol_event, |
| 12628 | .init_hook = alc861vd_dallas_automute, |
| 12629 | }, |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 12630 | }; |
| 12631 | |
| 12632 | /* |
| 12633 | * BIOS auto configuration |
| 12634 | */ |
| 12635 | static void alc861vd_auto_set_output_and_unmute(struct hda_codec *codec, |
| 12636 | hda_nid_t nid, int pin_type, int dac_idx) |
| 12637 | { |
Takashi Iwai | f6c7e54 | 2008-02-12 18:32:23 +0100 | [diff] [blame] | 12638 | alc_set_pin_output(codec, nid, pin_type); |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 12639 | } |
| 12640 | |
| 12641 | static void alc861vd_auto_init_multi_out(struct hda_codec *codec) |
| 12642 | { |
| 12643 | struct alc_spec *spec = codec->spec; |
| 12644 | int i; |
| 12645 | |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 12646 | alc_subsystem_id(codec, 0x15, 0x1b, 0x14); |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 12647 | for (i = 0; i <= HDA_SIDE; i++) { |
| 12648 | hda_nid_t nid = spec->autocfg.line_out_pins[i]; |
Takashi Iwai | baba8ee | 2007-04-23 17:17:48 +0200 | [diff] [blame] | 12649 | int pin_type = get_pin_type(spec->autocfg.line_out_type); |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 12650 | if (nid) |
| 12651 | alc861vd_auto_set_output_and_unmute(codec, nid, |
Takashi Iwai | baba8ee | 2007-04-23 17:17:48 +0200 | [diff] [blame] | 12652 | pin_type, i); |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 12653 | } |
| 12654 | } |
| 12655 | |
| 12656 | |
| 12657 | static void alc861vd_auto_init_hp_out(struct hda_codec *codec) |
| 12658 | { |
| 12659 | struct alc_spec *spec = codec->spec; |
| 12660 | hda_nid_t pin; |
| 12661 | |
| 12662 | pin = spec->autocfg.hp_pins[0]; |
| 12663 | if (pin) /* connect to front and use dac 0 */ |
| 12664 | alc861vd_auto_set_output_and_unmute(codec, pin, PIN_HP, 0); |
Takashi Iwai | f6c7e54 | 2008-02-12 18:32:23 +0100 | [diff] [blame] | 12665 | pin = spec->autocfg.speaker_pins[0]; |
| 12666 | if (pin) |
| 12667 | alc861vd_auto_set_output_and_unmute(codec, pin, PIN_OUT, 0); |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 12668 | } |
| 12669 | |
| 12670 | #define alc861vd_is_input_pin(nid) alc880_is_input_pin(nid) |
| 12671 | #define ALC861VD_PIN_CD_NID ALC880_PIN_CD_NID |
| 12672 | |
| 12673 | static void alc861vd_auto_init_analog_input(struct hda_codec *codec) |
| 12674 | { |
| 12675 | struct alc_spec *spec = codec->spec; |
| 12676 | int i; |
| 12677 | |
| 12678 | for (i = 0; i < AUTO_PIN_LAST; i++) { |
| 12679 | hda_nid_t nid = spec->autocfg.input_pins[i]; |
| 12680 | if (alc861vd_is_input_pin(nid)) { |
| 12681 | snd_hda_codec_write(codec, nid, 0, |
| 12682 | AC_VERB_SET_PIN_WIDGET_CONTROL, |
| 12683 | i <= AUTO_PIN_FRONT_MIC ? |
| 12684 | PIN_VREF80 : PIN_IN); |
| 12685 | if (nid != ALC861VD_PIN_CD_NID) |
| 12686 | snd_hda_codec_write(codec, nid, 0, |
| 12687 | AC_VERB_SET_AMP_GAIN_MUTE, |
| 12688 | AMP_OUT_MUTE); |
| 12689 | } |
| 12690 | } |
| 12691 | } |
| 12692 | |
| 12693 | #define alc861vd_idx_to_mixer_vol(nid) ((nid) + 0x02) |
| 12694 | #define alc861vd_idx_to_mixer_switch(nid) ((nid) + 0x0c) |
| 12695 | |
| 12696 | /* add playback controls from the parsed DAC table */ |
| 12697 | /* Based on ALC880 version. But ALC861VD has separate, |
| 12698 | * different NIDs for mute/unmute switch and volume control */ |
| 12699 | static int alc861vd_auto_create_multi_out_ctls(struct alc_spec *spec, |
| 12700 | const struct auto_pin_cfg *cfg) |
| 12701 | { |
| 12702 | char name[32]; |
| 12703 | static const char *chname[4] = {"Front", "Surround", "CLFE", "Side"}; |
| 12704 | hda_nid_t nid_v, nid_s; |
| 12705 | int i, err; |
| 12706 | |
| 12707 | for (i = 0; i < cfg->line_outs; i++) { |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 12708 | if (!spec->multiout.dac_nids[i]) |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 12709 | continue; |
| 12710 | nid_v = alc861vd_idx_to_mixer_vol( |
| 12711 | alc880_dac_to_idx( |
| 12712 | spec->multiout.dac_nids[i])); |
| 12713 | nid_s = alc861vd_idx_to_mixer_switch( |
| 12714 | alc880_dac_to_idx( |
| 12715 | spec->multiout.dac_nids[i])); |
| 12716 | |
| 12717 | if (i == 2) { |
| 12718 | /* Center/LFE */ |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 12719 | err = add_control(spec, ALC_CTL_WIDGET_VOL, |
| 12720 | "Center Playback Volume", |
| 12721 | HDA_COMPOSE_AMP_VAL(nid_v, 1, 0, |
| 12722 | HDA_OUTPUT)); |
| 12723 | if (err < 0) |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 12724 | return err; |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 12725 | err = add_control(spec, ALC_CTL_WIDGET_VOL, |
| 12726 | "LFE Playback Volume", |
| 12727 | HDA_COMPOSE_AMP_VAL(nid_v, 2, 0, |
| 12728 | HDA_OUTPUT)); |
| 12729 | if (err < 0) |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 12730 | return err; |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 12731 | err = add_control(spec, ALC_CTL_BIND_MUTE, |
| 12732 | "Center Playback Switch", |
| 12733 | HDA_COMPOSE_AMP_VAL(nid_s, 1, 2, |
| 12734 | HDA_INPUT)); |
| 12735 | if (err < 0) |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 12736 | return err; |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 12737 | err = add_control(spec, ALC_CTL_BIND_MUTE, |
| 12738 | "LFE Playback Switch", |
| 12739 | HDA_COMPOSE_AMP_VAL(nid_s, 2, 2, |
| 12740 | HDA_INPUT)); |
| 12741 | if (err < 0) |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 12742 | return err; |
| 12743 | } else { |
| 12744 | sprintf(name, "%s Playback Volume", chname[i]); |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 12745 | err = add_control(spec, ALC_CTL_WIDGET_VOL, name, |
| 12746 | HDA_COMPOSE_AMP_VAL(nid_v, 3, 0, |
| 12747 | HDA_OUTPUT)); |
| 12748 | if (err < 0) |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 12749 | return err; |
| 12750 | sprintf(name, "%s Playback Switch", chname[i]); |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 12751 | err = add_control(spec, ALC_CTL_BIND_MUTE, name, |
Kailang Yang | bdd148a | 2007-05-08 15:19:08 +0200 | [diff] [blame] | 12752 | HDA_COMPOSE_AMP_VAL(nid_s, 3, 2, |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 12753 | HDA_INPUT)); |
| 12754 | if (err < 0) |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 12755 | return err; |
| 12756 | } |
| 12757 | } |
| 12758 | return 0; |
| 12759 | } |
| 12760 | |
| 12761 | /* add playback controls for speaker and HP outputs */ |
| 12762 | /* Based on ALC880 version. But ALC861VD has separate, |
| 12763 | * different NIDs for mute/unmute switch and volume control */ |
| 12764 | static int alc861vd_auto_create_extra_out(struct alc_spec *spec, |
| 12765 | hda_nid_t pin, const char *pfx) |
| 12766 | { |
| 12767 | hda_nid_t nid_v, nid_s; |
| 12768 | int err; |
| 12769 | char name[32]; |
| 12770 | |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 12771 | if (!pin) |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 12772 | return 0; |
| 12773 | |
| 12774 | if (alc880_is_fixed_pin(pin)) { |
| 12775 | nid_v = alc880_idx_to_dac(alc880_fixed_pin_idx(pin)); |
| 12776 | /* specify the DAC as the extra output */ |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 12777 | if (!spec->multiout.hp_nid) |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 12778 | spec->multiout.hp_nid = nid_v; |
| 12779 | else |
| 12780 | spec->multiout.extra_out_nid[0] = nid_v; |
| 12781 | /* control HP volume/switch on the output mixer amp */ |
| 12782 | nid_v = alc861vd_idx_to_mixer_vol( |
| 12783 | alc880_fixed_pin_idx(pin)); |
| 12784 | nid_s = alc861vd_idx_to_mixer_switch( |
| 12785 | alc880_fixed_pin_idx(pin)); |
| 12786 | |
| 12787 | sprintf(name, "%s Playback Volume", pfx); |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 12788 | err = add_control(spec, ALC_CTL_WIDGET_VOL, name, |
| 12789 | HDA_COMPOSE_AMP_VAL(nid_v, 3, 0, HDA_OUTPUT)); |
| 12790 | if (err < 0) |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 12791 | return err; |
| 12792 | sprintf(name, "%s Playback Switch", pfx); |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 12793 | err = add_control(spec, ALC_CTL_BIND_MUTE, name, |
| 12794 | HDA_COMPOSE_AMP_VAL(nid_s, 3, 2, HDA_INPUT)); |
| 12795 | if (err < 0) |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 12796 | return err; |
| 12797 | } else if (alc880_is_multi_pin(pin)) { |
| 12798 | /* set manual connection */ |
| 12799 | /* we have only a switch on HP-out PIN */ |
| 12800 | sprintf(name, "%s Playback Switch", pfx); |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 12801 | err = add_control(spec, ALC_CTL_WIDGET_MUTE, name, |
| 12802 | HDA_COMPOSE_AMP_VAL(pin, 3, 0, HDA_OUTPUT)); |
| 12803 | if (err < 0) |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 12804 | return err; |
| 12805 | } |
| 12806 | return 0; |
| 12807 | } |
| 12808 | |
| 12809 | /* parse the BIOS configuration and set up the alc_spec |
| 12810 | * return 1 if successful, 0 if the proper config is not found, |
| 12811 | * or a negative error code |
| 12812 | * Based on ALC880 version - had to change it to override |
| 12813 | * alc880_auto_create_extra_out and alc880_auto_create_multi_out_ctls */ |
| 12814 | static int alc861vd_parse_auto_config(struct hda_codec *codec) |
| 12815 | { |
| 12816 | struct alc_spec *spec = codec->spec; |
| 12817 | int err; |
| 12818 | static hda_nid_t alc861vd_ignore[] = { 0x1d, 0 }; |
| 12819 | |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 12820 | err = snd_hda_parse_pin_def_config(codec, &spec->autocfg, |
| 12821 | alc861vd_ignore); |
| 12822 | if (err < 0) |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 12823 | return err; |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 12824 | if (!spec->autocfg.line_outs) |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 12825 | return 0; /* can't find valid BIOS pin config */ |
| 12826 | |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 12827 | err = alc880_auto_fill_dac_nids(spec, &spec->autocfg); |
| 12828 | if (err < 0) |
| 12829 | return err; |
| 12830 | err = alc861vd_auto_create_multi_out_ctls(spec, &spec->autocfg); |
| 12831 | if (err < 0) |
| 12832 | return err; |
| 12833 | err = alc861vd_auto_create_extra_out(spec, |
| 12834 | spec->autocfg.speaker_pins[0], |
| 12835 | "Speaker"); |
| 12836 | if (err < 0) |
| 12837 | return err; |
| 12838 | err = alc861vd_auto_create_extra_out(spec, |
| 12839 | spec->autocfg.hp_pins[0], |
| 12840 | "Headphone"); |
| 12841 | if (err < 0) |
| 12842 | return err; |
| 12843 | err = alc880_auto_create_analog_input_ctls(spec, &spec->autocfg); |
| 12844 | if (err < 0) |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 12845 | return err; |
| 12846 | |
| 12847 | spec->multiout.max_channels = spec->multiout.num_dacs * 2; |
| 12848 | |
| 12849 | if (spec->autocfg.dig_out_pin) |
| 12850 | spec->multiout.dig_out_nid = ALC861VD_DIGOUT_NID; |
| 12851 | |
| 12852 | if (spec->kctl_alloc) |
| 12853 | spec->mixers[spec->num_mixers++] = spec->kctl_alloc; |
| 12854 | |
| 12855 | spec->init_verbs[spec->num_init_verbs++] |
| 12856 | = alc861vd_volume_init_verbs; |
| 12857 | |
| 12858 | spec->num_mux_defs = 1; |
| 12859 | spec->input_mux = &spec->private_imux; |
| 12860 | |
Takashi Iwai | 776e184 | 2007-08-29 15:07:11 +0200 | [diff] [blame] | 12861 | err = alc_auto_add_mic_boost(codec); |
| 12862 | if (err < 0) |
| 12863 | return err; |
| 12864 | |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 12865 | return 1; |
| 12866 | } |
| 12867 | |
| 12868 | /* additional initialization for auto-configuration model */ |
| 12869 | static void alc861vd_auto_init(struct hda_codec *codec) |
| 12870 | { |
Takashi Iwai | f6c7e54 | 2008-02-12 18:32:23 +0100 | [diff] [blame] | 12871 | struct alc_spec *spec = codec->spec; |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 12872 | alc861vd_auto_init_multi_out(codec); |
| 12873 | alc861vd_auto_init_hp_out(codec); |
| 12874 | alc861vd_auto_init_analog_input(codec); |
Takashi Iwai | f6c7e54 | 2008-02-12 18:32:23 +0100 | [diff] [blame] | 12875 | if (spec->unsol_event) |
| 12876 | alc_sku_automute(codec); |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 12877 | } |
| 12878 | |
| 12879 | static int patch_alc861vd(struct hda_codec *codec) |
| 12880 | { |
| 12881 | struct alc_spec *spec; |
| 12882 | int err, board_config; |
| 12883 | |
| 12884 | spec = kzalloc(sizeof(*spec), GFP_KERNEL); |
| 12885 | if (spec == NULL) |
| 12886 | return -ENOMEM; |
| 12887 | |
| 12888 | codec->spec = spec; |
| 12889 | |
| 12890 | board_config = snd_hda_check_board_config(codec, ALC861VD_MODEL_LAST, |
| 12891 | alc861vd_models, |
| 12892 | alc861vd_cfg_tbl); |
| 12893 | |
| 12894 | if (board_config < 0 || board_config >= ALC861VD_MODEL_LAST) { |
| 12895 | printk(KERN_INFO "hda_codec: Unknown model for ALC660VD/" |
| 12896 | "ALC861VD, trying auto-probe from BIOS...\n"); |
| 12897 | board_config = ALC861VD_AUTO; |
| 12898 | } |
| 12899 | |
| 12900 | if (board_config == ALC861VD_AUTO) { |
| 12901 | /* automatic parse from the BIOS config */ |
| 12902 | err = alc861vd_parse_auto_config(codec); |
| 12903 | if (err < 0) { |
| 12904 | alc_free(codec); |
| 12905 | return err; |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 12906 | } else if (!err) { |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 12907 | printk(KERN_INFO |
| 12908 | "hda_codec: Cannot set up configuration " |
| 12909 | "from BIOS. Using base mode...\n"); |
| 12910 | board_config = ALC861VD_3ST; |
| 12911 | } |
| 12912 | } |
| 12913 | |
| 12914 | if (board_config != ALC861VD_AUTO) |
| 12915 | setup_preset(spec, &alc861vd_presets[board_config]); |
| 12916 | |
| 12917 | spec->stream_name_analog = "ALC861VD Analog"; |
| 12918 | spec->stream_analog_playback = &alc861vd_pcm_analog_playback; |
| 12919 | spec->stream_analog_capture = &alc861vd_pcm_analog_capture; |
| 12920 | |
| 12921 | spec->stream_name_digital = "ALC861VD Digital"; |
| 12922 | spec->stream_digital_playback = &alc861vd_pcm_digital_playback; |
| 12923 | spec->stream_digital_capture = &alc861vd_pcm_digital_capture; |
| 12924 | |
| 12925 | spec->adc_nids = alc861vd_adc_nids; |
| 12926 | spec->num_adc_nids = ARRAY_SIZE(alc861vd_adc_nids); |
Takashi Iwai | e140634 | 2008-02-11 18:32:32 +0100 | [diff] [blame] | 12927 | spec->capsrc_nids = alc861vd_capsrc_nids; |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 12928 | |
| 12929 | spec->mixers[spec->num_mixers] = alc861vd_capture_mixer; |
| 12930 | spec->num_mixers++; |
| 12931 | |
Takashi Iwai | 2134ea4 | 2008-01-10 16:53:55 +0100 | [diff] [blame] | 12932 | spec->vmaster_nid = 0x02; |
| 12933 | |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 12934 | codec->patch_ops = alc_patch_ops; |
| 12935 | |
| 12936 | if (board_config == ALC861VD_AUTO) |
| 12937 | spec->init_hook = alc861vd_auto_init; |
Takashi Iwai | cb53c62 | 2007-08-10 17:21:45 +0200 | [diff] [blame] | 12938 | #ifdef CONFIG_SND_HDA_POWER_SAVE |
| 12939 | if (!spec->loopback.amplist) |
| 12940 | spec->loopback.amplist = alc861vd_loopbacks; |
| 12941 | #endif |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 12942 | |
| 12943 | return 0; |
| 12944 | } |
| 12945 | |
| 12946 | /* |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 12947 | * ALC662 support |
| 12948 | * |
| 12949 | * ALC662 is almost identical with ALC880 but has cleaner and more flexible |
| 12950 | * configuration. Each pin widget can choose any input DACs and a mixer. |
| 12951 | * Each ADC is connected from a mixer of all inputs. This makes possible |
| 12952 | * 6-channel independent captures. |
| 12953 | * |
| 12954 | * In addition, an independent DAC for the multi-playback (not used in this |
| 12955 | * driver yet). |
| 12956 | */ |
| 12957 | #define ALC662_DIGOUT_NID 0x06 |
| 12958 | #define ALC662_DIGIN_NID 0x0a |
| 12959 | |
| 12960 | static hda_nid_t alc662_dac_nids[4] = { |
| 12961 | /* front, rear, clfe, rear_surr */ |
| 12962 | 0x02, 0x03, 0x04 |
| 12963 | }; |
| 12964 | |
| 12965 | static hda_nid_t alc662_adc_nids[1] = { |
| 12966 | /* ADC1-2 */ |
| 12967 | 0x09, |
| 12968 | }; |
Takashi Iwai | e140634 | 2008-02-11 18:32:32 +0100 | [diff] [blame] | 12969 | |
Kailang Yang | 77a261b | 2008-02-19 11:38:05 +0100 | [diff] [blame] | 12970 | static hda_nid_t alc662_capsrc_nids[1] = { 0x22 }; |
Takashi Iwai | e140634 | 2008-02-11 18:32:32 +0100 | [diff] [blame] | 12971 | |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 12972 | /* input MUX */ |
| 12973 | /* FIXME: should be a matrix-type input source selection */ |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 12974 | static struct hda_input_mux alc662_capture_source = { |
| 12975 | .num_items = 4, |
| 12976 | .items = { |
| 12977 | { "Mic", 0x0 }, |
| 12978 | { "Front Mic", 0x1 }, |
| 12979 | { "Line", 0x2 }, |
| 12980 | { "CD", 0x4 }, |
| 12981 | }, |
| 12982 | }; |
| 12983 | |
| 12984 | static struct hda_input_mux alc662_lenovo_101e_capture_source = { |
| 12985 | .num_items = 2, |
| 12986 | .items = { |
| 12987 | { "Mic", 0x1 }, |
| 12988 | { "Line", 0x2 }, |
| 12989 | }, |
| 12990 | }; |
Kailang Yang | 291702f | 2007-10-16 14:28:03 +0200 | [diff] [blame] | 12991 | |
| 12992 | static struct hda_input_mux alc662_eeepc_capture_source = { |
| 12993 | .num_items = 2, |
| 12994 | .items = { |
| 12995 | { "i-Mic", 0x1 }, |
| 12996 | { "e-Mic", 0x0 }, |
| 12997 | }, |
| 12998 | }; |
| 12999 | |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 13000 | #define alc662_mux_enum_info alc_mux_enum_info |
| 13001 | #define alc662_mux_enum_get alc_mux_enum_get |
Takashi Iwai | e140634 | 2008-02-11 18:32:32 +0100 | [diff] [blame] | 13002 | #define alc662_mux_enum_put alc882_mux_enum_put |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 13003 | |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 13004 | /* |
| 13005 | * 2ch mode |
| 13006 | */ |
| 13007 | static struct hda_channel_mode alc662_3ST_2ch_modes[1] = { |
| 13008 | { 2, NULL } |
| 13009 | }; |
| 13010 | |
| 13011 | /* |
| 13012 | * 2ch mode |
| 13013 | */ |
| 13014 | static struct hda_verb alc662_3ST_ch2_init[] = { |
| 13015 | { 0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80 }, |
| 13016 | { 0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE }, |
| 13017 | { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN }, |
| 13018 | { 0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE }, |
| 13019 | { } /* end */ |
| 13020 | }; |
| 13021 | |
| 13022 | /* |
| 13023 | * 6ch mode |
| 13024 | */ |
| 13025 | static struct hda_verb alc662_3ST_ch6_init[] = { |
| 13026 | { 0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, |
| 13027 | { 0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE }, |
| 13028 | { 0x18, AC_VERB_SET_CONNECT_SEL, 0x02 }, |
| 13029 | { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, |
| 13030 | { 0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE }, |
| 13031 | { 0x1a, AC_VERB_SET_CONNECT_SEL, 0x01 }, |
| 13032 | { } /* end */ |
| 13033 | }; |
| 13034 | |
| 13035 | static struct hda_channel_mode alc662_3ST_6ch_modes[2] = { |
| 13036 | { 2, alc662_3ST_ch2_init }, |
| 13037 | { 6, alc662_3ST_ch6_init }, |
| 13038 | }; |
| 13039 | |
| 13040 | /* |
| 13041 | * 2ch mode |
| 13042 | */ |
| 13043 | static struct hda_verb alc662_sixstack_ch6_init[] = { |
| 13044 | { 0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x00 }, |
| 13045 | { 0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x00 }, |
| 13046 | { 0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, |
| 13047 | { } /* end */ |
| 13048 | }; |
| 13049 | |
| 13050 | /* |
| 13051 | * 6ch mode |
| 13052 | */ |
| 13053 | static struct hda_verb alc662_sixstack_ch8_init[] = { |
| 13054 | { 0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, |
| 13055 | { 0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, |
| 13056 | { 0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, |
| 13057 | { } /* end */ |
| 13058 | }; |
| 13059 | |
| 13060 | static struct hda_channel_mode alc662_5stack_modes[2] = { |
| 13061 | { 2, alc662_sixstack_ch6_init }, |
| 13062 | { 6, alc662_sixstack_ch8_init }, |
| 13063 | }; |
| 13064 | |
| 13065 | /* Pin assignment: Front=0x14, Rear=0x15, CLFE=0x16, Side=0x17 |
| 13066 | * Mic=0x18, Front Mic=0x19, Line-In=0x1a, HP=0x1b |
| 13067 | */ |
| 13068 | |
| 13069 | static struct snd_kcontrol_new alc662_base_mixer[] = { |
| 13070 | /* output mixer control */ |
| 13071 | HDA_CODEC_VOLUME("Front Playback Volume", 0x2, 0x0, HDA_OUTPUT), |
| 13072 | HDA_CODEC_MUTE("Front Playback Switch", 0x02, 0x0, HDA_OUTPUT), |
| 13073 | HDA_CODEC_VOLUME("Surround Playback Volume", 0x3, 0x0, HDA_OUTPUT), |
| 13074 | HDA_CODEC_MUTE("Surround Playback Switch", 0x03, 0x0, HDA_OUTPUT), |
| 13075 | HDA_CODEC_VOLUME_MONO("Center Playback Volume", 0x04, 1, 0x0, HDA_OUTPUT), |
| 13076 | HDA_CODEC_VOLUME_MONO("LFE Playback Volume", 0x04, 2, 0x0, HDA_OUTPUT), |
| 13077 | HDA_BIND_MUTE_MONO("Center Playback Switch", 0x04, 1, 2, HDA_INPUT), |
| 13078 | HDA_BIND_MUTE_MONO("LFE Playback Switch", 0x04, 2, 2, HDA_INPUT), |
| 13079 | HDA_CODEC_MUTE("Headphone Playback Switch", 0x1b, 0x0, HDA_OUTPUT), |
| 13080 | |
| 13081 | /*Input mixer control */ |
| 13082 | HDA_CODEC_VOLUME("CD Playback Volume", 0xb, 0x4, HDA_INPUT), |
| 13083 | HDA_CODEC_MUTE("CD Playback Switch", 0xb, 0x4, HDA_INPUT), |
| 13084 | HDA_CODEC_VOLUME("Line Playback Volume", 0xb, 0x02, HDA_INPUT), |
| 13085 | HDA_CODEC_MUTE("Line Playback Switch", 0xb, 0x02, HDA_INPUT), |
| 13086 | HDA_CODEC_VOLUME("Mic Playback Volume", 0xb, 0x0, HDA_INPUT), |
| 13087 | HDA_CODEC_MUTE("Mic Playback Switch", 0xb, 0x0, HDA_INPUT), |
| 13088 | HDA_CODEC_VOLUME("Front Mic Playback Volume", 0xb, 0x01, HDA_INPUT), |
| 13089 | HDA_CODEC_MUTE("Front Mic Playback Switch", 0xb, 0x01, HDA_INPUT), |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 13090 | { } /* end */ |
| 13091 | }; |
| 13092 | |
| 13093 | static struct snd_kcontrol_new alc662_3ST_2ch_mixer[] = { |
| 13094 | HDA_CODEC_VOLUME("Front Playback Volume", 0x02, 0x0, HDA_OUTPUT), |
| 13095 | HDA_BIND_MUTE("Front Playback Switch", 0x02, 2, HDA_INPUT), |
| 13096 | HDA_CODEC_MUTE("Headphone Playback Switch", 0x1b, 0x0, HDA_OUTPUT), |
| 13097 | HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT), |
| 13098 | HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT), |
| 13099 | HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT), |
| 13100 | HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT), |
| 13101 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), |
| 13102 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), |
| 13103 | HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x1, HDA_INPUT), |
| 13104 | HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x1, HDA_INPUT), |
| 13105 | HDA_CODEC_VOLUME("PC Speaker Playback Volume", 0x0b, 0x05, HDA_INPUT), |
| 13106 | HDA_CODEC_MUTE("PC Speaker Playback Switch", 0x0b, 0x05, HDA_INPUT), |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 13107 | { } /* end */ |
| 13108 | }; |
| 13109 | |
| 13110 | static struct snd_kcontrol_new alc662_3ST_6ch_mixer[] = { |
| 13111 | HDA_CODEC_VOLUME("Front Playback Volume", 0x02, 0x0, HDA_OUTPUT), |
| 13112 | HDA_BIND_MUTE("Front Playback Switch", 0x02, 2, HDA_INPUT), |
| 13113 | HDA_CODEC_VOLUME("Surround Playback Volume", 0x03, 0x0, HDA_OUTPUT), |
| 13114 | HDA_BIND_MUTE("Surround Playback Switch", 0x03, 2, HDA_INPUT), |
| 13115 | HDA_CODEC_VOLUME_MONO("Center Playback Volume", 0x04, 1, 0x0, HDA_OUTPUT), |
| 13116 | HDA_CODEC_VOLUME_MONO("LFE Playback Volume", 0x04, 2, 0x0, HDA_OUTPUT), |
| 13117 | HDA_BIND_MUTE_MONO("Center Playback Switch", 0x04, 1, 2, HDA_INPUT), |
| 13118 | HDA_BIND_MUTE_MONO("LFE Playback Switch", 0x04, 2, 2, HDA_INPUT), |
| 13119 | HDA_CODEC_MUTE("Headphone Playback Switch", 0x1b, 0x0, HDA_OUTPUT), |
| 13120 | HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT), |
| 13121 | HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT), |
| 13122 | HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT), |
| 13123 | HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT), |
| 13124 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), |
| 13125 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), |
| 13126 | HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x1, HDA_INPUT), |
| 13127 | HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x1, HDA_INPUT), |
| 13128 | HDA_CODEC_VOLUME("PC Speaker Playback Volume", 0x0b, 0x05, HDA_INPUT), |
| 13129 | HDA_CODEC_MUTE("PC Speaker Playback Switch", 0x0b, 0x05, HDA_INPUT), |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 13130 | { } /* end */ |
| 13131 | }; |
| 13132 | |
| 13133 | static struct snd_kcontrol_new alc662_lenovo_101e_mixer[] = { |
| 13134 | HDA_CODEC_VOLUME("Front Playback Volume", 0x02, 0x0, HDA_OUTPUT), |
| 13135 | HDA_BIND_MUTE("Front Playback Switch", 0x02, 2, HDA_INPUT), |
Takashi Iwai | 86cd929 | 2008-01-28 18:09:56 +0100 | [diff] [blame] | 13136 | HDA_CODEC_VOLUME("Speaker Playback Volume", 0x03, 0x0, HDA_OUTPUT), |
| 13137 | HDA_BIND_MUTE("Speaker Playback Switch", 0x03, 2, HDA_INPUT), |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 13138 | HDA_CODEC_MUTE("Headphone Playback Switch", 0x1b, 0x0, HDA_OUTPUT), |
| 13139 | HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT), |
| 13140 | HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT), |
| 13141 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x1, HDA_INPUT), |
| 13142 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x1, HDA_INPUT), |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 13143 | { } /* end */ |
| 13144 | }; |
| 13145 | |
Kailang Yang | 291702f | 2007-10-16 14:28:03 +0200 | [diff] [blame] | 13146 | static struct snd_kcontrol_new alc662_eeepc_p701_mixer[] = { |
Takashi Iwai | 86cd929 | 2008-01-28 18:09:56 +0100 | [diff] [blame] | 13147 | HDA_CODEC_MUTE("Speaker Playback Switch", 0x14, 0x0, HDA_OUTPUT), |
Kailang Yang | 291702f | 2007-10-16 14:28:03 +0200 | [diff] [blame] | 13148 | |
Herton Ronaldo Krzesinski | b481849 | 2008-02-23 11:34:12 +0100 | [diff] [blame] | 13149 | HDA_CODEC_VOLUME("Line-Out Playback Volume", 0x02, 0x0, HDA_OUTPUT), |
| 13150 | HDA_CODEC_MUTE("Line-Out Playback Switch", 0x1b, 0x0, HDA_OUTPUT), |
Kailang Yang | 291702f | 2007-10-16 14:28:03 +0200 | [diff] [blame] | 13151 | |
| 13152 | HDA_CODEC_VOLUME("e-Mic Boost", 0x18, 0, HDA_INPUT), |
| 13153 | HDA_CODEC_VOLUME("e-Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), |
| 13154 | HDA_CODEC_MUTE("e-Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), |
| 13155 | |
| 13156 | HDA_CODEC_VOLUME("i-Mic Boost", 0x19, 0, HDA_INPUT), |
| 13157 | HDA_CODEC_VOLUME("i-Mic Playback Volume", 0x0b, 0x1, HDA_INPUT), |
| 13158 | HDA_CODEC_MUTE("i-Mic Playback Switch", 0x0b, 0x1, HDA_INPUT), |
| 13159 | { } /* end */ |
| 13160 | }; |
| 13161 | |
Kailang Yang | 8c42722 | 2008-01-10 13:03:59 +0100 | [diff] [blame] | 13162 | static struct snd_kcontrol_new alc662_eeepc_ep20_mixer[] = { |
Takashi Iwai | 31bffaa | 2008-02-27 16:10:44 +0100 | [diff] [blame] | 13163 | HDA_CODEC_VOLUME("Line-Out Playback Volume", 0x02, 0x0, HDA_OUTPUT), |
| 13164 | HDA_CODEC_MUTE("Line-Out Playback Switch", 0x14, 0x0, HDA_OUTPUT), |
Kailang Yang | 8c42722 | 2008-01-10 13:03:59 +0100 | [diff] [blame] | 13165 | HDA_CODEC_VOLUME("Surround Playback Volume", 0x03, 0x0, HDA_OUTPUT), |
| 13166 | HDA_BIND_MUTE("Surround Playback Switch", 0x03, 2, HDA_INPUT), |
| 13167 | HDA_CODEC_VOLUME_MONO("Center Playback Volume", 0x04, 1, 0x0, HDA_OUTPUT), |
| 13168 | HDA_CODEC_VOLUME_MONO("LFE Playback Volume", 0x04, 2, 0x0, HDA_OUTPUT), |
| 13169 | HDA_BIND_MUTE_MONO("Center Playback Switch", 0x04, 1, 2, HDA_INPUT), |
| 13170 | HDA_BIND_MUTE_MONO("LFE Playback Switch", 0x04, 2, 2, HDA_INPUT), |
Takashi Iwai | 86cd929 | 2008-01-28 18:09:56 +0100 | [diff] [blame] | 13171 | HDA_CODEC_MUTE("Speaker Playback Switch", 0x1b, 0x0, HDA_OUTPUT), |
Kailang Yang | 8c42722 | 2008-01-10 13:03:59 +0100 | [diff] [blame] | 13172 | HDA_BIND_MUTE("MuteCtrl Playback Switch", 0x0c, 2, HDA_INPUT), |
| 13173 | HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT), |
| 13174 | HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT), |
| 13175 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), |
| 13176 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), |
| 13177 | { } /* end */ |
| 13178 | }; |
| 13179 | |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 13180 | static struct snd_kcontrol_new alc662_chmode_mixer[] = { |
| 13181 | { |
| 13182 | .iface = SNDRV_CTL_ELEM_IFACE_MIXER, |
| 13183 | .name = "Channel Mode", |
| 13184 | .info = alc_ch_mode_info, |
| 13185 | .get = alc_ch_mode_get, |
| 13186 | .put = alc_ch_mode_put, |
| 13187 | }, |
| 13188 | { } /* end */ |
| 13189 | }; |
| 13190 | |
| 13191 | static struct hda_verb alc662_init_verbs[] = { |
| 13192 | /* ADC: mute amp left and right */ |
| 13193 | {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 13194 | {0x09, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 13195 | /* Front mixer: unmute input/output amp left and right (volume = 0) */ |
| 13196 | |
Takashi Iwai | cb53c62 | 2007-08-10 17:21:45 +0200 | [diff] [blame] | 13197 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 13198 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
| 13199 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)}, |
| 13200 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)}, |
| 13201 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)}, |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 13202 | |
Kailang Yang | b60dd39 | 2007-09-20 12:50:29 +0200 | [diff] [blame] | 13203 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 13204 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 13205 | {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 13206 | {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 13207 | {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 13208 | {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 13209 | |
| 13210 | /* Front Pin: output 0 (0x0c) */ |
| 13211 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 13212 | {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 13213 | |
| 13214 | /* Rear Pin: output 1 (0x0d) */ |
| 13215 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 13216 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 13217 | |
| 13218 | /* CLFE Pin: output 2 (0x0e) */ |
| 13219 | {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 13220 | {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 13221 | |
| 13222 | /* Mic (rear) pin: input vref at 80% */ |
| 13223 | {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80}, |
| 13224 | {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
| 13225 | /* Front Mic pin: input vref at 80% */ |
| 13226 | {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80}, |
| 13227 | {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
| 13228 | /* Line In pin: input */ |
| 13229 | {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
| 13230 | {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
| 13231 | /* Line-2 In: Headphone output (output 0 - 0x0c) */ |
| 13232 | {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 13233 | {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 13234 | {0x1b, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 13235 | /* CD pin widget for input */ |
| 13236 | {0x1c, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
| 13237 | |
| 13238 | /* FIXME: use matrix-type input source selection */ |
| 13239 | /* Mixer elements: 0x18, 19, 1a, 1b, 1c, 1d, 14, 15, 16, 17, 0b */ |
| 13240 | /* Input mixer */ |
| 13241 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 13242 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 13243 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(2)}, |
| 13244 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(4)}, |
Kailang Yang | 291702f | 2007-10-16 14:28:03 +0200 | [diff] [blame] | 13245 | |
| 13246 | {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 13247 | {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 13248 | {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(2)}, |
| 13249 | {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(4)}, |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 13250 | { } |
| 13251 | }; |
| 13252 | |
| 13253 | static struct hda_verb alc662_sue_init_verbs[] = { |
| 13254 | {0x14, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN|ALC880_FRONT_EVENT}, |
| 13255 | {0x1b, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN|ALC880_HP_EVENT}, |
Kailang Yang | 291702f | 2007-10-16 14:28:03 +0200 | [diff] [blame] | 13256 | {} |
| 13257 | }; |
| 13258 | |
| 13259 | static struct hda_verb alc662_eeepc_sue_init_verbs[] = { |
| 13260 | {0x18, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_MIC_EVENT}, |
| 13261 | {0x1b, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT}, |
| 13262 | {} |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 13263 | }; |
| 13264 | |
Kailang Yang | 8c42722 | 2008-01-10 13:03:59 +0100 | [diff] [blame] | 13265 | /* Set Unsolicited Event*/ |
| 13266 | static struct hda_verb alc662_eeepc_ep20_sue_init_verbs[] = { |
| 13267 | {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 13268 | {0x14, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT}, |
| 13269 | {} |
| 13270 | }; |
| 13271 | |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 13272 | /* |
| 13273 | * generic initialization of ADC, input mixers and output mixers |
| 13274 | */ |
| 13275 | static struct hda_verb alc662_auto_init_verbs[] = { |
| 13276 | /* |
| 13277 | * Unmute ADC and set the default input to mic-in |
| 13278 | */ |
| 13279 | {0x09, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 13280 | {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 13281 | |
| 13282 | /* Unmute input amps (CD, Line In, Mic 1 & Mic 2) of the analog-loopback |
| 13283 | * mixer widget |
| 13284 | * Note: PASD motherboards uses the Line In 2 as the input for front |
| 13285 | * panel mic (mic 2) |
| 13286 | */ |
| 13287 | /* Amp Indices: Mic1 = 0, Mic2 = 1, Line1 = 2, Line2 = 3, CD = 4 */ |
Takashi Iwai | cb53c62 | 2007-08-10 17:21:45 +0200 | [diff] [blame] | 13288 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 13289 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
| 13290 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)}, |
| 13291 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)}, |
| 13292 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)}, |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 13293 | |
| 13294 | /* |
| 13295 | * Set up output mixers (0x0c - 0x0f) |
| 13296 | */ |
| 13297 | /* set vol=0 to output mixers */ |
| 13298 | {0x02, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 13299 | {0x03, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 13300 | {0x04, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 13301 | |
| 13302 | /* set up input amps for analog loopback */ |
| 13303 | /* Amp Indices: DAC = 0, mixer = 1 */ |
Kailang Yang | b60dd39 | 2007-09-20 12:50:29 +0200 | [diff] [blame] | 13304 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 13305 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 13306 | {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 13307 | {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 13308 | {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 13309 | {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 13310 | |
| 13311 | |
| 13312 | /* FIXME: use matrix-type input source selection */ |
| 13313 | /* Mixer elements: 0x18, 19, 1a, 1b, 1c, 1d, 14, 15, 16, 17, 0b */ |
| 13314 | /* Input mixer */ |
| 13315 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
Kailang Yang | d1a991a | 2007-08-15 16:21:59 +0200 | [diff] [blame] | 13316 | {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 13317 | { } |
| 13318 | }; |
| 13319 | |
| 13320 | /* capture mixer elements */ |
| 13321 | static struct snd_kcontrol_new alc662_capture_mixer[] = { |
| 13322 | HDA_CODEC_VOLUME("Capture Volume", 0x09, 0x0, HDA_INPUT), |
| 13323 | HDA_CODEC_MUTE("Capture Switch", 0x09, 0x0, HDA_INPUT), |
| 13324 | { |
| 13325 | .iface = SNDRV_CTL_ELEM_IFACE_MIXER, |
| 13326 | /* The multiple "Capture Source" controls confuse alsamixer |
| 13327 | * So call somewhat different.. |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 13328 | */ |
| 13329 | /* .name = "Capture Source", */ |
| 13330 | .name = "Input Source", |
| 13331 | .count = 1, |
Herton Ronaldo Krzesinski | 6e7939b | 2007-12-19 17:49:02 +0100 | [diff] [blame] | 13332 | .info = alc662_mux_enum_info, |
| 13333 | .get = alc662_mux_enum_get, |
| 13334 | .put = alc662_mux_enum_put, |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 13335 | }, |
| 13336 | { } /* end */ |
| 13337 | }; |
| 13338 | |
| 13339 | static void alc662_lenovo_101e_ispeaker_automute(struct hda_codec *codec) |
| 13340 | { |
| 13341 | unsigned int present; |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 13342 | unsigned char bits; |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 13343 | |
| 13344 | present = snd_hda_codec_read(codec, 0x14, 0, |
| 13345 | AC_VERB_GET_PIN_SENSE, 0) & 0x80000000; |
Takashi Iwai | 47fd830 | 2007-08-10 17:11:07 +0200 | [diff] [blame] | 13346 | bits = present ? HDA_AMP_MUTE : 0; |
| 13347 | snd_hda_codec_amp_stereo(codec, 0x15, HDA_OUTPUT, 0, |
| 13348 | HDA_AMP_MUTE, bits); |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 13349 | } |
| 13350 | |
| 13351 | static void alc662_lenovo_101e_all_automute(struct hda_codec *codec) |
| 13352 | { |
| 13353 | unsigned int present; |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 13354 | unsigned char bits; |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 13355 | |
| 13356 | present = snd_hda_codec_read(codec, 0x1b, 0, |
| 13357 | AC_VERB_GET_PIN_SENSE, 0) & 0x80000000; |
Takashi Iwai | 47fd830 | 2007-08-10 17:11:07 +0200 | [diff] [blame] | 13358 | bits = present ? HDA_AMP_MUTE : 0; |
| 13359 | snd_hda_codec_amp_stereo(codec, 0x15, HDA_OUTPUT, 0, |
| 13360 | HDA_AMP_MUTE, bits); |
| 13361 | snd_hda_codec_amp_stereo(codec, 0x14, HDA_OUTPUT, 0, |
| 13362 | HDA_AMP_MUTE, bits); |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 13363 | } |
| 13364 | |
| 13365 | static void alc662_lenovo_101e_unsol_event(struct hda_codec *codec, |
| 13366 | unsigned int res) |
| 13367 | { |
| 13368 | if ((res >> 26) == ALC880_HP_EVENT) |
| 13369 | alc662_lenovo_101e_all_automute(codec); |
| 13370 | if ((res >> 26) == ALC880_FRONT_EVENT) |
| 13371 | alc662_lenovo_101e_ispeaker_automute(codec); |
| 13372 | } |
| 13373 | |
Kailang Yang | 291702f | 2007-10-16 14:28:03 +0200 | [diff] [blame] | 13374 | static void alc662_eeepc_mic_automute(struct hda_codec *codec) |
| 13375 | { |
| 13376 | unsigned int present; |
| 13377 | |
| 13378 | present = snd_hda_codec_read(codec, 0x18, 0, |
| 13379 | AC_VERB_GET_PIN_SENSE, 0) & 0x80000000; |
| 13380 | snd_hda_codec_write(codec, 0x22, 0, AC_VERB_SET_AMP_GAIN_MUTE, |
| 13381 | 0x7000 | (0x00 << 8) | (present ? 0 : 0x80)); |
| 13382 | snd_hda_codec_write(codec, 0x23, 0, AC_VERB_SET_AMP_GAIN_MUTE, |
| 13383 | 0x7000 | (0x00 << 8) | (present ? 0 : 0x80)); |
| 13384 | snd_hda_codec_write(codec, 0x22, 0, AC_VERB_SET_AMP_GAIN_MUTE, |
| 13385 | 0x7000 | (0x01 << 8) | (present ? 0x80 : 0)); |
| 13386 | snd_hda_codec_write(codec, 0x23, 0, AC_VERB_SET_AMP_GAIN_MUTE, |
| 13387 | 0x7000 | (0x01 << 8) | (present ? 0x80 : 0)); |
| 13388 | } |
| 13389 | |
| 13390 | /* unsolicited event for HP jack sensing */ |
| 13391 | static void alc662_eeepc_unsol_event(struct hda_codec *codec, |
| 13392 | unsigned int res) |
| 13393 | { |
| 13394 | if ((res >> 26) == ALC880_HP_EVENT) |
| 13395 | alc262_hippo1_automute( codec ); |
| 13396 | |
| 13397 | if ((res >> 26) == ALC880_MIC_EVENT) |
| 13398 | alc662_eeepc_mic_automute(codec); |
| 13399 | } |
| 13400 | |
| 13401 | static void alc662_eeepc_inithook(struct hda_codec *codec) |
| 13402 | { |
| 13403 | alc262_hippo1_automute( codec ); |
| 13404 | alc662_eeepc_mic_automute(codec); |
| 13405 | } |
| 13406 | |
Kailang Yang | 8c42722 | 2008-01-10 13:03:59 +0100 | [diff] [blame] | 13407 | static void alc662_eeepc_ep20_automute(struct hda_codec *codec) |
| 13408 | { |
| 13409 | unsigned int mute; |
| 13410 | unsigned int present; |
| 13411 | |
| 13412 | snd_hda_codec_read(codec, 0x14, 0, AC_VERB_SET_PIN_SENSE, 0); |
| 13413 | present = snd_hda_codec_read(codec, 0x14, 0, |
| 13414 | AC_VERB_GET_PIN_SENSE, 0); |
| 13415 | present = (present & 0x80000000) != 0; |
| 13416 | if (present) { |
| 13417 | /* mute internal speaker */ |
| 13418 | snd_hda_codec_amp_stereo(codec, 0x1b, HDA_OUTPUT, 0, |
| 13419 | HDA_AMP_MUTE, HDA_AMP_MUTE); |
| 13420 | } else { |
| 13421 | /* unmute internal speaker if necessary */ |
| 13422 | mute = snd_hda_codec_amp_read(codec, 0x14, 0, HDA_OUTPUT, 0); |
| 13423 | snd_hda_codec_amp_stereo(codec, 0x1b, HDA_OUTPUT, 0, |
| 13424 | HDA_AMP_MUTE, mute); |
| 13425 | } |
| 13426 | } |
| 13427 | |
| 13428 | /* unsolicited event for HP jack sensing */ |
| 13429 | static void alc662_eeepc_ep20_unsol_event(struct hda_codec *codec, |
| 13430 | unsigned int res) |
| 13431 | { |
| 13432 | if ((res >> 26) == ALC880_HP_EVENT) |
| 13433 | alc662_eeepc_ep20_automute(codec); |
| 13434 | } |
| 13435 | |
| 13436 | static void alc662_eeepc_ep20_inithook(struct hda_codec *codec) |
| 13437 | { |
| 13438 | alc662_eeepc_ep20_automute(codec); |
| 13439 | } |
| 13440 | |
Takashi Iwai | cb53c62 | 2007-08-10 17:21:45 +0200 | [diff] [blame] | 13441 | #ifdef CONFIG_SND_HDA_POWER_SAVE |
| 13442 | #define alc662_loopbacks alc880_loopbacks |
| 13443 | #endif |
| 13444 | |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 13445 | |
| 13446 | /* pcm configuration: identiacal with ALC880 */ |
| 13447 | #define alc662_pcm_analog_playback alc880_pcm_analog_playback |
| 13448 | #define alc662_pcm_analog_capture alc880_pcm_analog_capture |
| 13449 | #define alc662_pcm_digital_playback alc880_pcm_digital_playback |
| 13450 | #define alc662_pcm_digital_capture alc880_pcm_digital_capture |
| 13451 | |
| 13452 | /* |
| 13453 | * configuration and preset |
| 13454 | */ |
| 13455 | static const char *alc662_models[ALC662_MODEL_LAST] = { |
| 13456 | [ALC662_3ST_2ch_DIG] = "3stack-dig", |
| 13457 | [ALC662_3ST_6ch_DIG] = "3stack-6ch-dig", |
| 13458 | [ALC662_3ST_6ch] = "3stack-6ch", |
| 13459 | [ALC662_5ST_DIG] = "6stack-dig", |
| 13460 | [ALC662_LENOVO_101E] = "lenovo-101e", |
Takashi Iwai | b995d76 | 2007-10-17 10:41:06 +0200 | [diff] [blame] | 13461 | [ALC662_ASUS_EEEPC_P701] = "eeepc-p701", |
Kailang Yang | 8c42722 | 2008-01-10 13:03:59 +0100 | [diff] [blame] | 13462 | [ALC662_ASUS_EEEPC_EP20] = "eeepc-ep20", |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 13463 | [ALC662_AUTO] = "auto", |
| 13464 | }; |
| 13465 | |
| 13466 | static struct snd_pci_quirk alc662_cfg_tbl[] = { |
Kailang Yang | 291702f | 2007-10-16 14:28:03 +0200 | [diff] [blame] | 13467 | SND_PCI_QUIRK(0x1043, 0x82a1, "ASUS Eeepc", ALC662_ASUS_EEEPC_P701), |
Kailang Yang | 8c42722 | 2008-01-10 13:03:59 +0100 | [diff] [blame] | 13468 | SND_PCI_QUIRK(0x1043, 0x82d1, "ASUS Eeepc EP20", ALC662_ASUS_EEEPC_EP20), |
Takashi Iwai | ac3e374 | 2007-12-17 17:14:18 +0100 | [diff] [blame] | 13469 | SND_PCI_QUIRK(0x17aa, 0x101e, "Lenovo", ALC662_LENOVO_101E), |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 13470 | {} |
| 13471 | }; |
| 13472 | |
| 13473 | static struct alc_config_preset alc662_presets[] = { |
| 13474 | [ALC662_3ST_2ch_DIG] = { |
Kailang Yang | 291702f | 2007-10-16 14:28:03 +0200 | [diff] [blame] | 13475 | .mixers = { alc662_3ST_2ch_mixer, alc662_capture_mixer }, |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 13476 | .init_verbs = { alc662_init_verbs }, |
| 13477 | .num_dacs = ARRAY_SIZE(alc662_dac_nids), |
| 13478 | .dac_nids = alc662_dac_nids, |
| 13479 | .dig_out_nid = ALC662_DIGOUT_NID, |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 13480 | .dig_in_nid = ALC662_DIGIN_NID, |
| 13481 | .num_channel_mode = ARRAY_SIZE(alc662_3ST_2ch_modes), |
| 13482 | .channel_mode = alc662_3ST_2ch_modes, |
| 13483 | .input_mux = &alc662_capture_source, |
| 13484 | }, |
| 13485 | [ALC662_3ST_6ch_DIG] = { |
Kailang Yang | 291702f | 2007-10-16 14:28:03 +0200 | [diff] [blame] | 13486 | .mixers = { alc662_3ST_6ch_mixer, alc662_chmode_mixer, |
| 13487 | alc662_capture_mixer }, |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 13488 | .init_verbs = { alc662_init_verbs }, |
| 13489 | .num_dacs = ARRAY_SIZE(alc662_dac_nids), |
| 13490 | .dac_nids = alc662_dac_nids, |
| 13491 | .dig_out_nid = ALC662_DIGOUT_NID, |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 13492 | .dig_in_nid = ALC662_DIGIN_NID, |
| 13493 | .num_channel_mode = ARRAY_SIZE(alc662_3ST_6ch_modes), |
| 13494 | .channel_mode = alc662_3ST_6ch_modes, |
| 13495 | .need_dac_fix = 1, |
| 13496 | .input_mux = &alc662_capture_source, |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 13497 | }, |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 13498 | [ALC662_3ST_6ch] = { |
Kailang Yang | 291702f | 2007-10-16 14:28:03 +0200 | [diff] [blame] | 13499 | .mixers = { alc662_3ST_6ch_mixer, alc662_chmode_mixer, |
| 13500 | alc662_capture_mixer }, |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 13501 | .init_verbs = { alc662_init_verbs }, |
| 13502 | .num_dacs = ARRAY_SIZE(alc662_dac_nids), |
| 13503 | .dac_nids = alc662_dac_nids, |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 13504 | .num_channel_mode = ARRAY_SIZE(alc662_3ST_6ch_modes), |
| 13505 | .channel_mode = alc662_3ST_6ch_modes, |
| 13506 | .need_dac_fix = 1, |
| 13507 | .input_mux = &alc662_capture_source, |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 13508 | }, |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 13509 | [ALC662_5ST_DIG] = { |
Kailang Yang | 291702f | 2007-10-16 14:28:03 +0200 | [diff] [blame] | 13510 | .mixers = { alc662_base_mixer, alc662_chmode_mixer, |
| 13511 | alc662_capture_mixer }, |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 13512 | .init_verbs = { alc662_init_verbs }, |
| 13513 | .num_dacs = ARRAY_SIZE(alc662_dac_nids), |
| 13514 | .dac_nids = alc662_dac_nids, |
| 13515 | .dig_out_nid = ALC662_DIGOUT_NID, |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 13516 | .dig_in_nid = ALC662_DIGIN_NID, |
| 13517 | .num_channel_mode = ARRAY_SIZE(alc662_5stack_modes), |
| 13518 | .channel_mode = alc662_5stack_modes, |
| 13519 | .input_mux = &alc662_capture_source, |
| 13520 | }, |
| 13521 | [ALC662_LENOVO_101E] = { |
Kailang Yang | 291702f | 2007-10-16 14:28:03 +0200 | [diff] [blame] | 13522 | .mixers = { alc662_lenovo_101e_mixer, alc662_capture_mixer }, |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 13523 | .init_verbs = { alc662_init_verbs, alc662_sue_init_verbs }, |
| 13524 | .num_dacs = ARRAY_SIZE(alc662_dac_nids), |
| 13525 | .dac_nids = alc662_dac_nids, |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 13526 | .num_channel_mode = ARRAY_SIZE(alc662_3ST_2ch_modes), |
| 13527 | .channel_mode = alc662_3ST_2ch_modes, |
| 13528 | .input_mux = &alc662_lenovo_101e_capture_source, |
| 13529 | .unsol_event = alc662_lenovo_101e_unsol_event, |
| 13530 | .init_hook = alc662_lenovo_101e_all_automute, |
| 13531 | }, |
Kailang Yang | 291702f | 2007-10-16 14:28:03 +0200 | [diff] [blame] | 13532 | [ALC662_ASUS_EEEPC_P701] = { |
| 13533 | .mixers = { alc662_eeepc_p701_mixer, alc662_capture_mixer }, |
| 13534 | .init_verbs = { alc662_init_verbs, |
| 13535 | alc662_eeepc_sue_init_verbs }, |
| 13536 | .num_dacs = ARRAY_SIZE(alc662_dac_nids), |
| 13537 | .dac_nids = alc662_dac_nids, |
Kailang Yang | 291702f | 2007-10-16 14:28:03 +0200 | [diff] [blame] | 13538 | .num_channel_mode = ARRAY_SIZE(alc662_3ST_2ch_modes), |
| 13539 | .channel_mode = alc662_3ST_2ch_modes, |
| 13540 | .input_mux = &alc662_eeepc_capture_source, |
| 13541 | .unsol_event = alc662_eeepc_unsol_event, |
| 13542 | .init_hook = alc662_eeepc_inithook, |
| 13543 | }, |
Kailang Yang | 8c42722 | 2008-01-10 13:03:59 +0100 | [diff] [blame] | 13544 | [ALC662_ASUS_EEEPC_EP20] = { |
| 13545 | .mixers = { alc662_eeepc_ep20_mixer, alc662_capture_mixer, |
| 13546 | alc662_chmode_mixer }, |
| 13547 | .init_verbs = { alc662_init_verbs, |
| 13548 | alc662_eeepc_ep20_sue_init_verbs }, |
| 13549 | .num_dacs = ARRAY_SIZE(alc662_dac_nids), |
| 13550 | .dac_nids = alc662_dac_nids, |
Kailang Yang | 8c42722 | 2008-01-10 13:03:59 +0100 | [diff] [blame] | 13551 | .num_channel_mode = ARRAY_SIZE(alc662_3ST_6ch_modes), |
| 13552 | .channel_mode = alc662_3ST_6ch_modes, |
| 13553 | .input_mux = &alc662_lenovo_101e_capture_source, |
| 13554 | .unsol_event = alc662_eeepc_ep20_unsol_event, |
| 13555 | .init_hook = alc662_eeepc_ep20_inithook, |
| 13556 | }, |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 13557 | |
| 13558 | }; |
| 13559 | |
| 13560 | |
| 13561 | /* |
| 13562 | * BIOS auto configuration |
| 13563 | */ |
| 13564 | |
| 13565 | /* add playback controls from the parsed DAC table */ |
| 13566 | static int alc662_auto_create_multi_out_ctls(struct alc_spec *spec, |
| 13567 | const struct auto_pin_cfg *cfg) |
| 13568 | { |
| 13569 | char name[32]; |
| 13570 | static const char *chname[4] = { |
| 13571 | "Front", "Surround", NULL /*CLFE*/, "Side" |
| 13572 | }; |
| 13573 | hda_nid_t nid; |
| 13574 | int i, err; |
| 13575 | |
| 13576 | for (i = 0; i < cfg->line_outs; i++) { |
| 13577 | if (!spec->multiout.dac_nids[i]) |
| 13578 | continue; |
Kailang Yang | b60dd39 | 2007-09-20 12:50:29 +0200 | [diff] [blame] | 13579 | nid = alc880_idx_to_dac(i); |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 13580 | if (i == 2) { |
| 13581 | /* Center/LFE */ |
| 13582 | err = add_control(spec, ALC_CTL_WIDGET_VOL, |
| 13583 | "Center Playback Volume", |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 13584 | HDA_COMPOSE_AMP_VAL(nid, 1, 0, |
| 13585 | HDA_OUTPUT)); |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 13586 | if (err < 0) |
| 13587 | return err; |
| 13588 | err = add_control(spec, ALC_CTL_WIDGET_VOL, |
| 13589 | "LFE Playback Volume", |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 13590 | HDA_COMPOSE_AMP_VAL(nid, 2, 0, |
| 13591 | HDA_OUTPUT)); |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 13592 | if (err < 0) |
| 13593 | return err; |
| 13594 | err = add_control(spec, ALC_CTL_BIND_MUTE, |
| 13595 | "Center Playback Switch", |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 13596 | HDA_COMPOSE_AMP_VAL(nid, 1, 2, |
| 13597 | HDA_INPUT)); |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 13598 | if (err < 0) |
| 13599 | return err; |
| 13600 | err = add_control(spec, ALC_CTL_BIND_MUTE, |
| 13601 | "LFE Playback Switch", |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 13602 | HDA_COMPOSE_AMP_VAL(nid, 2, 2, |
| 13603 | HDA_INPUT)); |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 13604 | if (err < 0) |
| 13605 | return err; |
| 13606 | } else { |
| 13607 | sprintf(name, "%s Playback Volume", chname[i]); |
| 13608 | err = add_control(spec, ALC_CTL_WIDGET_VOL, name, |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 13609 | HDA_COMPOSE_AMP_VAL(nid, 3, 0, |
| 13610 | HDA_OUTPUT)); |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 13611 | if (err < 0) |
| 13612 | return err; |
| 13613 | sprintf(name, "%s Playback Switch", chname[i]); |
| 13614 | err = add_control(spec, ALC_CTL_BIND_MUTE, name, |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 13615 | HDA_COMPOSE_AMP_VAL(nid, 3, 2, |
| 13616 | HDA_INPUT)); |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 13617 | if (err < 0) |
| 13618 | return err; |
| 13619 | } |
| 13620 | } |
| 13621 | return 0; |
| 13622 | } |
| 13623 | |
| 13624 | /* add playback controls for speaker and HP outputs */ |
| 13625 | static int alc662_auto_create_extra_out(struct alc_spec *spec, hda_nid_t pin, |
| 13626 | const char *pfx) |
| 13627 | { |
| 13628 | hda_nid_t nid; |
| 13629 | int err; |
| 13630 | char name[32]; |
| 13631 | |
| 13632 | if (!pin) |
| 13633 | return 0; |
| 13634 | |
| 13635 | if (alc880_is_fixed_pin(pin)) { |
| 13636 | nid = alc880_idx_to_dac(alc880_fixed_pin_idx(pin)); |
| 13637 | /* printk("DAC nid=%x\n",nid); */ |
| 13638 | /* specify the DAC as the extra output */ |
| 13639 | if (!spec->multiout.hp_nid) |
| 13640 | spec->multiout.hp_nid = nid; |
| 13641 | else |
| 13642 | spec->multiout.extra_out_nid[0] = nid; |
| 13643 | /* control HP volume/switch on the output mixer amp */ |
| 13644 | nid = alc880_idx_to_dac(alc880_fixed_pin_idx(pin)); |
| 13645 | sprintf(name, "%s Playback Volume", pfx); |
| 13646 | err = add_control(spec, ALC_CTL_WIDGET_VOL, name, |
| 13647 | HDA_COMPOSE_AMP_VAL(nid, 3, 0, HDA_OUTPUT)); |
| 13648 | if (err < 0) |
| 13649 | return err; |
| 13650 | sprintf(name, "%s Playback Switch", pfx); |
| 13651 | err = add_control(spec, ALC_CTL_BIND_MUTE, name, |
| 13652 | HDA_COMPOSE_AMP_VAL(nid, 3, 2, HDA_INPUT)); |
| 13653 | if (err < 0) |
| 13654 | return err; |
| 13655 | } else if (alc880_is_multi_pin(pin)) { |
| 13656 | /* set manual connection */ |
| 13657 | /* we have only a switch on HP-out PIN */ |
| 13658 | sprintf(name, "%s Playback Switch", pfx); |
| 13659 | err = add_control(spec, ALC_CTL_WIDGET_MUTE, name, |
| 13660 | HDA_COMPOSE_AMP_VAL(pin, 3, 0, HDA_OUTPUT)); |
| 13661 | if (err < 0) |
| 13662 | return err; |
| 13663 | } |
| 13664 | return 0; |
| 13665 | } |
| 13666 | |
| 13667 | /* create playback/capture controls for input pins */ |
| 13668 | static int alc662_auto_create_analog_input_ctls(struct alc_spec *spec, |
| 13669 | const struct auto_pin_cfg *cfg) |
| 13670 | { |
| 13671 | struct hda_input_mux *imux = &spec->private_imux; |
| 13672 | int i, err, idx; |
| 13673 | |
| 13674 | for (i = 0; i < AUTO_PIN_LAST; i++) { |
| 13675 | if (alc880_is_input_pin(cfg->input_pins[i])) { |
| 13676 | idx = alc880_input_pin_idx(cfg->input_pins[i]); |
| 13677 | err = new_analog_input(spec, cfg->input_pins[i], |
| 13678 | auto_pin_cfg_labels[i], |
| 13679 | idx, 0x0b); |
| 13680 | if (err < 0) |
| 13681 | return err; |
| 13682 | imux->items[imux->num_items].label = |
| 13683 | auto_pin_cfg_labels[i]; |
| 13684 | imux->items[imux->num_items].index = |
| 13685 | alc880_input_pin_idx(cfg->input_pins[i]); |
| 13686 | imux->num_items++; |
| 13687 | } |
| 13688 | } |
| 13689 | return 0; |
| 13690 | } |
| 13691 | |
| 13692 | static void alc662_auto_set_output_and_unmute(struct hda_codec *codec, |
| 13693 | hda_nid_t nid, int pin_type, |
| 13694 | int dac_idx) |
| 13695 | { |
Takashi Iwai | f6c7e54 | 2008-02-12 18:32:23 +0100 | [diff] [blame] | 13696 | alc_set_pin_output(codec, nid, pin_type); |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 13697 | /* need the manual connection? */ |
| 13698 | if (alc880_is_multi_pin(nid)) { |
| 13699 | struct alc_spec *spec = codec->spec; |
| 13700 | int idx = alc880_multi_pin_idx(nid); |
| 13701 | snd_hda_codec_write(codec, alc880_idx_to_selector(idx), 0, |
| 13702 | AC_VERB_SET_CONNECT_SEL, |
| 13703 | alc880_dac_to_idx(spec->multiout.dac_nids[dac_idx])); |
| 13704 | } |
| 13705 | } |
| 13706 | |
| 13707 | static void alc662_auto_init_multi_out(struct hda_codec *codec) |
| 13708 | { |
| 13709 | struct alc_spec *spec = codec->spec; |
| 13710 | int i; |
| 13711 | |
Kailang Yang | 8c42722 | 2008-01-10 13:03:59 +0100 | [diff] [blame] | 13712 | alc_subsystem_id(codec, 0x15, 0x1b, 0x14); |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 13713 | for (i = 0; i <= HDA_SIDE; i++) { |
| 13714 | hda_nid_t nid = spec->autocfg.line_out_pins[i]; |
Takashi Iwai | baba8ee | 2007-04-23 17:17:48 +0200 | [diff] [blame] | 13715 | int pin_type = get_pin_type(spec->autocfg.line_out_type); |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 13716 | if (nid) |
Takashi Iwai | baba8ee | 2007-04-23 17:17:48 +0200 | [diff] [blame] | 13717 | alc662_auto_set_output_and_unmute(codec, nid, pin_type, |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 13718 | i); |
| 13719 | } |
| 13720 | } |
| 13721 | |
| 13722 | static void alc662_auto_init_hp_out(struct hda_codec *codec) |
| 13723 | { |
| 13724 | struct alc_spec *spec = codec->spec; |
| 13725 | hda_nid_t pin; |
| 13726 | |
| 13727 | pin = spec->autocfg.hp_pins[0]; |
| 13728 | if (pin) /* connect to front */ |
| 13729 | /* use dac 0 */ |
| 13730 | alc662_auto_set_output_and_unmute(codec, pin, PIN_HP, 0); |
Takashi Iwai | f6c7e54 | 2008-02-12 18:32:23 +0100 | [diff] [blame] | 13731 | pin = spec->autocfg.speaker_pins[0]; |
| 13732 | if (pin) |
| 13733 | alc662_auto_set_output_and_unmute(codec, pin, PIN_OUT, 0); |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 13734 | } |
| 13735 | |
| 13736 | #define alc662_is_input_pin(nid) alc880_is_input_pin(nid) |
| 13737 | #define ALC662_PIN_CD_NID ALC880_PIN_CD_NID |
| 13738 | |
| 13739 | static void alc662_auto_init_analog_input(struct hda_codec *codec) |
| 13740 | { |
| 13741 | struct alc_spec *spec = codec->spec; |
| 13742 | int i; |
| 13743 | |
| 13744 | for (i = 0; i < AUTO_PIN_LAST; i++) { |
| 13745 | hda_nid_t nid = spec->autocfg.input_pins[i]; |
| 13746 | if (alc662_is_input_pin(nid)) { |
| 13747 | snd_hda_codec_write(codec, nid, 0, |
| 13748 | AC_VERB_SET_PIN_WIDGET_CONTROL, |
| 13749 | (i <= AUTO_PIN_FRONT_MIC ? |
| 13750 | PIN_VREF80 : PIN_IN)); |
| 13751 | if (nid != ALC662_PIN_CD_NID) |
| 13752 | snd_hda_codec_write(codec, nid, 0, |
| 13753 | AC_VERB_SET_AMP_GAIN_MUTE, |
| 13754 | AMP_OUT_MUTE); |
| 13755 | } |
| 13756 | } |
| 13757 | } |
| 13758 | |
| 13759 | static int alc662_parse_auto_config(struct hda_codec *codec) |
| 13760 | { |
| 13761 | struct alc_spec *spec = codec->spec; |
| 13762 | int err; |
| 13763 | static hda_nid_t alc662_ignore[] = { 0x1d, 0 }; |
| 13764 | |
| 13765 | err = snd_hda_parse_pin_def_config(codec, &spec->autocfg, |
| 13766 | alc662_ignore); |
| 13767 | if (err < 0) |
| 13768 | return err; |
| 13769 | if (!spec->autocfg.line_outs) |
| 13770 | return 0; /* can't find valid BIOS pin config */ |
| 13771 | |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 13772 | err = alc880_auto_fill_dac_nids(spec, &spec->autocfg); |
| 13773 | if (err < 0) |
| 13774 | return err; |
| 13775 | err = alc662_auto_create_multi_out_ctls(spec, &spec->autocfg); |
| 13776 | if (err < 0) |
| 13777 | return err; |
| 13778 | err = alc662_auto_create_extra_out(spec, |
| 13779 | spec->autocfg.speaker_pins[0], |
| 13780 | "Speaker"); |
| 13781 | if (err < 0) |
| 13782 | return err; |
| 13783 | err = alc662_auto_create_extra_out(spec, spec->autocfg.hp_pins[0], |
| 13784 | "Headphone"); |
| 13785 | if (err < 0) |
| 13786 | return err; |
| 13787 | err = alc662_auto_create_analog_input_ctls(spec, &spec->autocfg); |
| 13788 | if (err < 0) |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 13789 | return err; |
| 13790 | |
| 13791 | spec->multiout.max_channels = spec->multiout.num_dacs * 2; |
| 13792 | |
| 13793 | if (spec->autocfg.dig_out_pin) |
| 13794 | spec->multiout.dig_out_nid = ALC880_DIGOUT_NID; |
| 13795 | |
| 13796 | if (spec->kctl_alloc) |
| 13797 | spec->mixers[spec->num_mixers++] = spec->kctl_alloc; |
| 13798 | |
| 13799 | spec->num_mux_defs = 1; |
| 13800 | spec->input_mux = &spec->private_imux; |
| 13801 | |
Takashi Iwai | 8c87286f | 2007-06-19 12:11:16 +0200 | [diff] [blame] | 13802 | spec->init_verbs[spec->num_init_verbs++] = alc662_auto_init_verbs; |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 13803 | spec->mixers[spec->num_mixers] = alc662_capture_mixer; |
| 13804 | spec->num_mixers++; |
Takashi Iwai | 8c87286f | 2007-06-19 12:11:16 +0200 | [diff] [blame] | 13805 | return 1; |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 13806 | } |
| 13807 | |
| 13808 | /* additional initialization for auto-configuration model */ |
| 13809 | static void alc662_auto_init(struct hda_codec *codec) |
| 13810 | { |
Takashi Iwai | f6c7e54 | 2008-02-12 18:32:23 +0100 | [diff] [blame] | 13811 | struct alc_spec *spec = codec->spec; |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 13812 | alc662_auto_init_multi_out(codec); |
| 13813 | alc662_auto_init_hp_out(codec); |
| 13814 | alc662_auto_init_analog_input(codec); |
Takashi Iwai | f6c7e54 | 2008-02-12 18:32:23 +0100 | [diff] [blame] | 13815 | if (spec->unsol_event) |
| 13816 | alc_sku_automute(codec); |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 13817 | } |
| 13818 | |
| 13819 | static int patch_alc662(struct hda_codec *codec) |
| 13820 | { |
| 13821 | struct alc_spec *spec; |
| 13822 | int err, board_config; |
| 13823 | |
| 13824 | spec = kzalloc(sizeof(*spec), GFP_KERNEL); |
| 13825 | if (!spec) |
| 13826 | return -ENOMEM; |
| 13827 | |
| 13828 | codec->spec = spec; |
| 13829 | |
| 13830 | board_config = snd_hda_check_board_config(codec, ALC662_MODEL_LAST, |
| 13831 | alc662_models, |
| 13832 | alc662_cfg_tbl); |
| 13833 | if (board_config < 0) { |
| 13834 | printk(KERN_INFO "hda_codec: Unknown model for ALC662, " |
| 13835 | "trying auto-probe from BIOS...\n"); |
| 13836 | board_config = ALC662_AUTO; |
| 13837 | } |
| 13838 | |
| 13839 | if (board_config == ALC662_AUTO) { |
| 13840 | /* automatic parse from the BIOS config */ |
| 13841 | err = alc662_parse_auto_config(codec); |
| 13842 | if (err < 0) { |
| 13843 | alc_free(codec); |
| 13844 | return err; |
Takashi Iwai | 8c87286f | 2007-06-19 12:11:16 +0200 | [diff] [blame] | 13845 | } else if (!err) { |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 13846 | printk(KERN_INFO |
| 13847 | "hda_codec: Cannot set up configuration " |
| 13848 | "from BIOS. Using base mode...\n"); |
| 13849 | board_config = ALC662_3ST_2ch_DIG; |
| 13850 | } |
| 13851 | } |
| 13852 | |
| 13853 | if (board_config != ALC662_AUTO) |
| 13854 | setup_preset(spec, &alc662_presets[board_config]); |
| 13855 | |
| 13856 | spec->stream_name_analog = "ALC662 Analog"; |
| 13857 | spec->stream_analog_playback = &alc662_pcm_analog_playback; |
| 13858 | spec->stream_analog_capture = &alc662_pcm_analog_capture; |
| 13859 | |
| 13860 | spec->stream_name_digital = "ALC662 Digital"; |
| 13861 | spec->stream_digital_playback = &alc662_pcm_digital_playback; |
| 13862 | spec->stream_digital_capture = &alc662_pcm_digital_capture; |
| 13863 | |
Takashi Iwai | e140634 | 2008-02-11 18:32:32 +0100 | [diff] [blame] | 13864 | spec->adc_nids = alc662_adc_nids; |
| 13865 | spec->num_adc_nids = ARRAY_SIZE(alc662_adc_nids); |
| 13866 | spec->capsrc_nids = alc662_capsrc_nids; |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 13867 | |
Takashi Iwai | 2134ea4 | 2008-01-10 16:53:55 +0100 | [diff] [blame] | 13868 | spec->vmaster_nid = 0x02; |
| 13869 | |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 13870 | codec->patch_ops = alc_patch_ops; |
| 13871 | if (board_config == ALC662_AUTO) |
| 13872 | spec->init_hook = alc662_auto_init; |
Takashi Iwai | cb53c62 | 2007-08-10 17:21:45 +0200 | [diff] [blame] | 13873 | #ifdef CONFIG_SND_HDA_POWER_SAVE |
| 13874 | if (!spec->loopback.amplist) |
| 13875 | spec->loopback.amplist = alc662_loopbacks; |
| 13876 | #endif |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 13877 | |
| 13878 | return 0; |
| 13879 | } |
| 13880 | |
| 13881 | /* |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 13882 | * patch entries |
| 13883 | */ |
| 13884 | struct hda_codec_preset snd_hda_preset_realtek[] = { |
| 13885 | { .id = 0x10ec0260, .name = "ALC260", .patch = patch_alc260 }, |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 13886 | { .id = 0x10ec0262, .name = "ALC262", .patch = patch_alc262 }, |
Kailang Yang | f6a9224 | 2007-12-13 16:52:54 +0100 | [diff] [blame] | 13887 | { .id = 0x10ec0267, .name = "ALC267", .patch = patch_alc268 }, |
Kailang Yang | a361d84 | 2007-06-05 12:30:55 +0200 | [diff] [blame] | 13888 | { .id = 0x10ec0268, .name = "ALC268", .patch = patch_alc268 }, |
Kailang Yang | f6a9224 | 2007-12-13 16:52:54 +0100 | [diff] [blame] | 13889 | { .id = 0x10ec0269, .name = "ALC269", .patch = patch_alc269 }, |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 13890 | { .id = 0x10ec0861, .rev = 0x100340, .name = "ALC660", |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 13891 | .patch = patch_alc861 }, |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 13892 | { .id = 0x10ec0660, .name = "ALC660-VD", .patch = patch_alc861vd }, |
| 13893 | { .id = 0x10ec0861, .name = "ALC861", .patch = patch_alc861 }, |
| 13894 | { .id = 0x10ec0862, .name = "ALC861-VD", .patch = patch_alc861vd }, |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 13895 | { .id = 0x10ec0662, .rev = 0x100002, .name = "ALC662 rev2", |
| 13896 | .patch = patch_alc883 }, |
| 13897 | { .id = 0x10ec0662, .rev = 0x100101, .name = "ALC662 rev1", |
| 13898 | .patch = patch_alc662 }, |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 13899 | { .id = 0x10ec0880, .name = "ALC880", .patch = patch_alc880 }, |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 13900 | { .id = 0x10ec0882, .name = "ALC882", .patch = patch_alc882 }, |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 13901 | { .id = 0x10ec0883, .name = "ALC883", .patch = patch_alc883 }, |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 13902 | { .id = 0x10ec0885, .name = "ALC885", .patch = patch_alc882 }, |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 13903 | { .id = 0x10ec0888, .name = "ALC888", .patch = patch_alc883 }, |
Kailang Yang | f6a9224 | 2007-12-13 16:52:54 +0100 | [diff] [blame] | 13904 | { .id = 0x10ec0889, .name = "ALC889", .patch = patch_alc883 }, |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 13905 | {} /* terminator */ |
| 13906 | }; |